Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit 7176549

Browse files
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.300.0 (#74)
Co-authored-by: speakeasybot <[email protected]>
1 parent fb14aa1 commit 7176549

20 files changed

+274
-380
lines changed

Diff for: .speakeasy/gen.lock

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ id: 2f8b2839-3001-46b4-b5e0-cec0aad583ed
33
management:
44
docChecksum: 11b8c1e1d3f9d5dab18c36b33f81200d
55
docVersion: 0.2.0
6-
speakeasyVersion: 1.299.6
7-
generationVersion: 2.338.12
8-
releaseVersion: 1.0.0
9-
configChecksum: a34d9161551fa1e6338554d167cbc20c
6+
speakeasyVersion: 1.300.0
7+
generationVersion: 2.338.14
8+
releaseVersion: 1.0.1
9+
configChecksum: e72b96a6dad7207536f38fdf46f00942
1010
repoURL: https://github.com/StyraInc/opa-typescript.git
1111
installationURL: https://github.com/StyraInc/opa-typescript
1212
published: true
1313
features:
1414
typescript:
1515
additionalDependencies: 0.1.0
1616
constsAndDefaults: 0.1.5
17-
core: 3.9.11
17+
core: 3.9.12
1818
examples: 2.81.4
1919
flattening: 2.81.1
2020
globalSecurityCallbacks: 0.1.0
@@ -32,6 +32,7 @@ generatedFiles:
3232
- src/lib/encodings.ts
3333
- src/lib/http.ts
3434
- src/lib/is-plain-object.ts
35+
- src/lib/primitives.ts
3536
- src/lib/retries.ts
3637
- src/lib/schemas.ts
3738
- src/lib/sdks.ts

Diff for: .speakeasy/gen.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ generation:
1212
auth:
1313
oAuth2ClientCredentialsEnabled: false
1414
typescript:
15-
version: 1.0.0
15+
version: 1.0.1
1616
additionalDependencies:
1717
dependencies: {}
1818
devDependencies:

Diff for: .speakeasy/workflow.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
speakeasyVersion: 1.299.6
1+
speakeasyVersion: 1.300.0
22
sources:
33
openapi:
44
sourceNamespace: openapi
5-
sourceRevisionDigest: sha256:6ec91c16a2cb3686bf0f809c3241287085e5c61f9088e9a5baf3ed3e95d48ed0
6-
sourceBlobDigest: sha256:5fe47030247a3de8f6f5765dcbfea985c64f84652d63a45f8eb9d50f81791cbd
5+
sourceRevisionDigest: sha256:547cdca6b7559fd5773972a2df2f5a92bc7fee20ec5044f055058f4f31f49622
6+
sourceBlobDigest: sha256:ed87807bf992a3c96bff2d5560860f030ddf4b98f8371948d055d1f5c69a4e48
77
tags:
88
- latest
99
- main
1010
targets:
1111
first-target:
1212
source: openapi
1313
sourceNamespace: openapi
14-
sourceRevisionDigest: sha256:6ec91c16a2cb3686bf0f809c3241287085e5c61f9088e9a5baf3ed3e95d48ed0
15-
sourceBlobDigest: sha256:5fe47030247a3de8f6f5765dcbfea985c64f84652d63a45f8eb9d50f81791cbd
14+
sourceRevisionDigest: sha256:547cdca6b7559fd5773972a2df2f5a92bc7fee20ec5044f055058f4f31f49622
15+
sourceBlobDigest: sha256:ed87807bf992a3c96bff2d5560860f030ddf4b98f8371948d055d1f5c69a4e48
1616
outLocation: /github/workspace/repo
1717
workflow:
1818
workflowVersion: 1.0.0

Diff for: RELEASES.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -258,4 +258,14 @@ Based on:
258258
### Generated
259259
- [typescript v1.0.0] .
260260
### Releases
261-
- [NPM v1.0.0] https://www.npmjs.com/package/@styra/opa/v/1.0.0 - .
261+
- [NPM v1.0.0] https://www.npmjs.com/package/@styra/opa/v/1.0.0 - .
262+
263+
## 2024-06-06 00:15:16
264+
### Changes
265+
Based on:
266+
- OpenAPI Doc
267+
- Speakeasy CLI 1.300.0 (2.338.14) https://github.com/speakeasy-api/speakeasy
268+
### Generated
269+
- [typescript v1.0.1] .
270+
### Releases
271+
- [NPM v1.0.1] https://www.npmjs.com/package/@styra/opa/v/1.0.1 - .

Diff for: jsr.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{
44
"name": "@styra/opa",
5-
"version": "1.0.0",
5+
"version": "1.0.1",
66
"exports": {
77
".": "./src/index.ts",
88
"./sdk/models/errors": "./src/sdk/models/errors/index.ts",

Diff for: package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@styra/opa",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"author": "Styra",
55
"main": "./index.js",
66
"sideEffects": false,

Diff for: src/lib/config.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
5252
export const SDK_METADATA = {
5353
language: "typescript",
5454
openapiDocVersion: "0.2.0",
55-
sdkVersion: "1.0.0",
56-
genVersion: "2.338.12",
57-
userAgent: "speakeasy-sdk/typescript 1.0.0 2.338.12 0.2.0 @styra/opa",
55+
sdkVersion: "1.0.1",
56+
genVersion: "2.338.14",
57+
userAgent: "speakeasy-sdk/typescript 1.0.1 2.338.14 0.2.0 @styra/opa",
5858
} as const;

Diff for: src/lib/primitives.ts

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
3+
*/
4+
5+
export type Remap<Inp, Mapping extends { [k in keyof Inp]?: string | null }> = {
6+
[k in keyof Inp as Mapping[k] extends string /* if we have a string mapping for this key then use it */
7+
? Mapping[k]
8+
: Mapping[k] extends null /* if the mapping is to `null` then drop the key */
9+
? never
10+
: k /* otherwise keep the key as-is */]: Inp[k];
11+
};
12+
13+
/**
14+
* Converts or omits an object's keys according to a mapping.
15+
*
16+
* @param inp An object whose keys will be remapped
17+
* @param mappings A mapping of original keys to new keys. If a key is not present in the mapping, it will be left as is. If a key is mapped to `null`, it will be removed in the resulting object.
18+
* @returns A new object with keys remapped or omitted according to the mappings
19+
*/
20+
export function remap<
21+
Inp extends Record<string, unknown>,
22+
const Mapping extends { [k in keyof Inp]?: string | null },
23+
>(inp: Inp, mappings: Mapping): Remap<Inp, Mapping> {
24+
let out: any = {};
25+
26+
if (!Object.keys(mappings).length) {
27+
out = inp;
28+
return out;
29+
}
30+
31+
for (const [k, v] of Object.entries(inp)) {
32+
const j = mappings[k];
33+
if (j === null) {
34+
continue;
35+
}
36+
out[j ?? k] = v;
37+
}
38+
39+
return out;
40+
}

Diff for: src/lib/schemas.ts

+37-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
33
*/
44

5-
import { ZodError } from "zod";
6-
import * as errors from "../sdk/models/errors";
5+
import { output, ZodEffects, ZodError, ZodObject, ZodRawShape, ZodTypeAny } from "zod";
6+
import { SDKValidationError } from "../sdk/models/errors/sdkvalidationerror";
77

88
/**
99
* Utility function that executes some code which may throw a ZodError. It
@@ -15,8 +15,42 @@ export function parse<Inp, Out>(rawValue: Inp, fn: (value: Inp) => Out, errorMes
1515
return fn(rawValue);
1616
} catch (err) {
1717
if (err instanceof ZodError) {
18-
throw new errors.SDKValidationError(errorMessage, err, rawValue);
18+
throw new SDKValidationError(errorMessage, err, rawValue);
1919
}
2020
throw err;
2121
}
2222
}
23+
24+
export function collectExtraKeys<
25+
Shape extends ZodRawShape,
26+
Catchall extends ZodTypeAny,
27+
K extends string
28+
>(
29+
obj: ZodObject<Shape, "strip", Catchall>,
30+
extrasKey: K
31+
): ZodEffects<
32+
typeof obj,
33+
output<ZodObject<Shape, "strict">> & {
34+
[k in K]: Record<string, output<Catchall>>;
35+
}
36+
> {
37+
return obj.transform((val) => {
38+
const extras: Record<string, output<Catchall>> = {};
39+
const { shape } = obj;
40+
for (const [key] of Object.entries(val)) {
41+
if (key in shape) {
42+
continue;
43+
}
44+
45+
const v = val[key];
46+
if (typeof v === "undefined") {
47+
continue;
48+
}
49+
50+
extras[key] = v;
51+
delete val[key];
52+
}
53+
54+
return { ...val, [extrasKey]: extras };
55+
});
56+
}

Diff for: src/sdk/models/components/httpmetadata.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
33
*/
44

5+
import { remap as remap$ } from "../../../lib/primitives";
56
import * as z from "zod";
67

78
export type HTTPMetadata = {
@@ -23,10 +24,10 @@ export namespace HTTPMetadata$ {
2324
Request: z.instanceof(Request),
2425
})
2526
.transform((v) => {
26-
return {
27-
response: v.Response,
28-
request: v.Request,
29-
};
27+
return remap$(v, {
28+
Response: "response",
29+
Request: "request",
30+
});
3031
});
3132

3233
export type Outbound = {
@@ -44,9 +45,9 @@ export namespace HTTPMetadata$ {
4445
}),
4546
})
4647
.transform((v) => {
47-
return {
48-
Response: v.response,
49-
Request: v.request,
50-
};
48+
return remap$(v, {
49+
response: "Response",
50+
request: "Request",
51+
});
5152
});
5253
}

Diff for: src/sdk/models/components/provenance.ts

+17-32
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
33
*/
44

5+
import { remap as remap$ } from "../../../lib/primitives";
56
import * as z from "zod";
67

78
export type Revision = {
@@ -21,29 +22,17 @@ export type Provenance = {
2122

2223
/** @internal */
2324
export namespace Revision$ {
24-
export const inboundSchema: z.ZodType<Revision, z.ZodTypeDef, unknown> = z
25-
.object({
26-
revision: z.string(),
27-
})
28-
.transform((v) => {
29-
return {
30-
revision: v.revision,
31-
};
32-
});
25+
export const inboundSchema: z.ZodType<Revision, z.ZodTypeDef, unknown> = z.object({
26+
revision: z.string(),
27+
});
3328

3429
export type Outbound = {
3530
revision: string;
3631
};
3732

38-
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, Revision> = z
39-
.object({
40-
revision: z.string(),
41-
})
42-
.transform((v) => {
43-
return {
44-
revision: v.revision,
45-
};
46-
});
33+
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, Revision> = z.object({
34+
revision: z.string(),
35+
});
4736
}
4837

4938
/** @internal */
@@ -61,13 +50,11 @@ export namespace Provenance$ {
6150
bundles: z.record(z.lazy(() => Revision$.inboundSchema)).optional(),
6251
})
6352
.transform((v) => {
64-
return {
65-
...(v.version === undefined ? null : { version: v.version }),
66-
...(v.build_commit === undefined ? null : { buildCommit: v.build_commit }),
67-
...(v.build_timestamp === undefined ? null : { buildTimestamp: v.build_timestamp }),
68-
...(v.build_host === undefined ? null : { buildHost: v.build_host }),
69-
...(v.bundles === undefined ? null : { bundles: v.bundles }),
70-
};
53+
return remap$(v, {
54+
build_commit: "buildCommit",
55+
build_timestamp: "buildTimestamp",
56+
build_host: "buildHost",
57+
});
7158
});
7259

7360
export type Outbound = {
@@ -90,12 +77,10 @@ export namespace Provenance$ {
9077
bundles: z.record(z.lazy(() => Revision$.outboundSchema)).optional(),
9178
})
9279
.transform((v) => {
93-
return {
94-
...(v.version === undefined ? null : { version: v.version }),
95-
...(v.buildCommit === undefined ? null : { build_commit: v.buildCommit }),
96-
...(v.buildTimestamp === undefined ? null : { build_timestamp: v.buildTimestamp }),
97-
...(v.buildHost === undefined ? null : { build_host: v.buildHost }),
98-
...(v.bundles === undefined ? null : { bundles: v.bundles }),
99-
};
80+
return remap$(v, {
81+
buildCommit: "build_commit",
82+
buildTimestamp: "build_timestamp",
83+
buildHost: "build_host",
84+
});
10085
});
10186
}

Diff for: src/sdk/models/components/successfulpolicyevaluation.ts

+7-12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
33
*/
44

5+
import { remap as remap$ } from "../../../lib/primitives";
56
import { Provenance, Provenance$ } from "./provenance";
67
import { Result, Result$ } from "./result";
78
import * as z from "zod";
@@ -35,12 +36,9 @@ export namespace SuccessfulPolicyEvaluation$ {
3536
provenance: Provenance$.inboundSchema.optional(),
3637
})
3738
.transform((v) => {
38-
return {
39-
...(v.result === undefined ? null : { result: v.result }),
40-
...(v.metrics === undefined ? null : { metrics: v.metrics }),
41-
...(v.decision_id === undefined ? null : { decisionId: v.decision_id }),
42-
...(v.provenance === undefined ? null : { provenance: v.provenance }),
43-
};
39+
return remap$(v, {
40+
decision_id: "decisionId",
41+
});
4442
});
4543

4644
export type Outbound = {
@@ -58,11 +56,8 @@ export namespace SuccessfulPolicyEvaluation$ {
5856
provenance: Provenance$.outboundSchema.optional(),
5957
})
6058
.transform((v) => {
61-
return {
62-
...(v.result === undefined ? null : { result: v.result }),
63-
...(v.metrics === undefined ? null : { metrics: v.metrics }),
64-
...(v.decisionId === undefined ? null : { decision_id: v.decisionId }),
65-
...(v.provenance === undefined ? null : { provenance: v.provenance }),
66-
};
59+
return remap$(v, {
60+
decisionId: "decision_id",
61+
});
6762
});
6863
}

0 commit comments

Comments
 (0)