diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 0bdaced..489fb40 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: false typescript: - version: 1.4.1 + version: 1.5.0 additionalDependencies: dependencies: {} devDependencies: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 2038593..fa919fd 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,18 +1,18 @@ -speakeasyVersion: 1.369.0 +speakeasyVersion: 1.376.0 sources: openapi: sourceNamespace: openapi - sourceRevisionDigest: sha256:9b23164c63cb86b765915fb16fe576a049193d891ad7187b8b07933709cce52d - sourceBlobDigest: sha256:7a77d65d39072fc44b01f8f6d61e871955a17efd6f9ea7b21114566ae9199507 + sourceRevisionDigest: sha256:3e6d52e3f6893aa962869edcca40f482a24867be190e6a4469914dfe62d872ff + sourceBlobDigest: sha256:f76f9d1e8be466eef2d0e9612845ce19f9a5f507682e92d7a4355b3b13eaa921 tags: - latest - - main + - push-suoktzlvrumw targets: first-target: source: openapi sourceNamespace: openapi - sourceRevisionDigest: sha256:9b23164c63cb86b765915fb16fe576a049193d891ad7187b8b07933709cce52d - sourceBlobDigest: sha256:7a77d65d39072fc44b01f8f6d61e871955a17efd6f9ea7b21114566ae9199507 + sourceRevisionDigest: sha256:3e6d52e3f6893aa962869edcca40f482a24867be190e6a4469914dfe62d872ff + sourceBlobDigest: sha256:f76f9d1e8be466eef2d0e9612845ce19f9a5f507682e92d7a4355b3b13eaa921 outLocation: packages/opa workflow: workflowVersion: 1.0.0 diff --git a/package-lock.json b/package-lock.json index 63f94b2..8efa002 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9881,7 +9881,7 @@ }, "packages/opa": { "name": "@styra/opa", - "version": "1.4.1", + "version": "1.5.0", "license": "Apache-2.0", "devDependencies": { "@types/node": "^20.14.9", diff --git a/packages/opa-react/src/authz-provider.tsx b/packages/opa-react/src/authz-provider.tsx index bbbacfc..b589e2f 100644 --- a/packages/opa-react/src/authz-provider.tsx +++ b/packages/opa-react/src/authz-provider.tsx @@ -13,7 +13,7 @@ import { type RequestOptions, type BatchRequestOptions, } from "@styra/opa"; -import { type ServerError } from "@styra/opa/sdk/models/components"; +import { type ServerErrorWithStatusCode } from "@styra/opa/sdk/models/components"; import { create, windowScheduler } from "@yornaath/batshit"; type EvalQuery = { @@ -59,13 +59,13 @@ const evals = (sdk: OPAClient) => Object.entries(res).map(([k, res]) => [ k, fromRs[k] ? fromRs[k](res) : res, - ]), - ), + ]) + ) ); - }), + }) ).then((all: object[]) => // combine result arrays of objects (if there's more than one) - all.length == 1 ? all[0] : Object.assign({}, ...all), + all.length == 1 ? all[0] : Object.assign({}, ...all) ); }, resolver: (results, query) => results[key(query)] ?? null, @@ -79,21 +79,21 @@ export interface OPAClient { evaluate( path: string, input?: In, - opts?: RequestOptions, + opts?: RequestOptions ): Promise; /** Evaluate the server's default policy, with optional `input` and `RequestOptions`. */ evaluateDefault( input?: In, - opts?: RequestOptions, + opts?: RequestOptions ): Promise; /** Evaluate a policy against a batch of inputs. */ evaluateBatch( path: string, inputs: { [k: string]: In }, - opts?: BatchRequestOptions, - ): Promise<{ [k: string]: Res | ServerError }>; + opts?: BatchRequestOptions + ): Promise<{ [k: string]: Res | ServerErrorWithStatusCode }>; } export type AuthzProviderContext = { @@ -115,7 +115,7 @@ export type AuthzProviderContext = { // Reference: https://reacttraining.com/blog/react-context-with-typescript export const AuthzContext = createContext( - undefined, + undefined ); export interface AuthzProviderProps @@ -151,7 +151,7 @@ export default function AuthzProvider({ }: AuthzProviderProps) { const batcher = useMemo( () => batch && opaClient && evals(opaClient), - [opaClient, batch], + [opaClient, batch] ); const defaultQueryFn = useCallback( async ({ @@ -182,7 +182,7 @@ export default function AuthzProvider({ return batcher.fetch({ path, input, fromResult }); }, - [batcher, batch], + [batcher, batch] ); const queryClient = useMemo( () => @@ -194,7 +194,7 @@ export default function AuthzProvider({ }, }, }), - [defaultQueryFn, retry], + [defaultQueryFn, retry] ); const context = useMemo( @@ -205,7 +205,7 @@ export default function AuthzProvider({ defaultFromResult, queryClient: queryClient!, }), - [opaClient, defaultPath, defaultInput, defaultFromResult, queryClient], + [opaClient, defaultPath, defaultInput, defaultFromResult, queryClient] ); if (!queryClient) return null; diff --git a/packages/opa/.speakeasy/gen.lock b/packages/opa/.speakeasy/gen.lock index 6656750..12fc410 100755 --- a/packages/opa/.speakeasy/gen.lock +++ b/packages/opa/.speakeasy/gen.lock @@ -1,20 +1,20 @@ lockVersion: 2.0.0 id: 078615ff-ff96-44f8-8aca-2f4d3e687bf0 management: - docChecksum: 899b27d9399190d5ff40fc3e7c07c252 + docChecksum: 54d33facef3aa19f358d15ab44e34141 docVersion: 0.2.0 - speakeasyVersion: 1.369.0 - generationVersion: 2.399.0 - releaseVersion: 1.4.1 - configChecksum: c714d6cd61c0b03af384266ab1d93b6b + speakeasyVersion: 1.376.0 + generationVersion: 2.402.5 + releaseVersion: 1.5.0 + configChecksum: dc4ad85128f07abee67816f11d9d50e5 repoURL: https://github.com/StyraInc/opa-typescript.git repoSubDirectory: packages/opa installationURL: https://gitpkg.now.sh/StyraInc/opa-typescript/packages/opa features: typescript: additionalDependencies: 0.1.0 - constsAndDefaults: 0.1.8 - core: 3.13.2 + constsAndDefaults: 0.1.10 + core: 3.14.1 defaultEnabledRetries: 0.1.0 envVarSecurityUsage: 0.1.1 examples: 2.81.4 @@ -113,8 +113,8 @@ generatedFiles: - docs/sdk/models/components/gzipcontentencoding.md - docs/sdk/models/components/location.md - docs/sdk/models/components/errors.md - - docs/sdk/models/components/servererror.md - - docs/sdk/models/components/responsessuccessfulpolicyresponse.md + - docs/sdk/models/components/servererrorwithstatuscode.md + - docs/sdk/models/components/successfulpolicyresponsewithstatuscode.md - docs/sdk/models/components/responses.md - docs/sdk/models/components/batchmixedresults.md - docs/sdk/models/components/batchsuccessfulpolicyevaluation.md diff --git a/packages/opa/README.md b/packages/opa/README.md index f4cacab..b3fe10e 100644 --- a/packages/opa/README.md +++ b/packages/opa/README.md @@ -389,7 +389,9 @@ run(); ## Debugging -To log HTTP requests and responses, you can pass a logger that matches `console`'s interface as an SDK option. +You can setup your SDK to emit debug logs for SDK requests and responses. + +You can pass a logger that matches `console`'s interface as an SDK option. > [!WARNING] > Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production. diff --git a/packages/opa/RELEASES.md b/packages/opa/RELEASES.md index a7e384d..10b0a31 100644 --- a/packages/opa/RELEASES.md +++ b/packages/opa/RELEASES.md @@ -413,4 +413,12 @@ Based on: - OpenAPI Doc - Speakeasy CLI 1.369.0 (2.399.0) https://github.com/speakeasy-api/speakeasy ### Generated -- [typescript v1.4.1] packages/opa \ No newline at end of file +- [typescript v1.4.1] packages/opa + +## 2024-08-20 07:54:42 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.376.0 (2.402.5) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v1.5.0] packages/opa \ No newline at end of file diff --git a/packages/opa/docs/sdk/models/components/batchmixedresults.md b/packages/opa/docs/sdk/models/components/batchmixedresults.md index 4009dbe..e5e8bd6 100644 --- a/packages/opa/docs/sdk/models/components/batchmixedresults.md +++ b/packages/opa/docs/sdk/models/components/batchmixedresults.md @@ -8,8 +8,8 @@ import { BatchMixedResults } from "@styra/opa/sdk/models/components"; let value: BatchMixedResults = { responses: { key: { - result: 3927.85, httpStatusCode: "200", + result: 3927.85, }, }, }; diff --git a/packages/opa/docs/sdk/models/components/responses.md b/packages/opa/docs/sdk/models/components/responses.md index 28b9525..1397c5b 100644 --- a/packages/opa/docs/sdk/models/components/responses.md +++ b/packages/opa/docs/sdk/models/components/responses.md @@ -6,24 +6,24 @@ import { Responses } from "@styra/opa/sdk/models/components"; let value: Responses = { + httpStatusCode: "200", code: "", message: "", decisionId: "b84cf736-213c-4932-a8e4-bb5c648f1b4d", - httpStatusCode: "200", }; ``` ## Supported Types -### `components.ResponsesSuccessfulPolicyResponse` +### `components.SuccessfulPolicyResponseWithStatusCode` ```typescript -const value: components.ResponsesSuccessfulPolicyResponse = /* values here */ +const value: components.SuccessfulPolicyResponseWithStatusCode = /* values here */ ``` -### `components.ServerError` +### `components.ServerErrorWithStatusCode` ```typescript -const value: components.ServerError = /* values here */ +const value: components.ServerErrorWithStatusCode = /* values here */ ``` diff --git a/packages/opa/docs/sdk/models/components/servererror.md b/packages/opa/docs/sdk/models/components/servererrorwithstatuscode.md similarity index 94% rename from packages/opa/docs/sdk/models/components/servererror.md rename to packages/opa/docs/sdk/models/components/servererrorwithstatuscode.md index db1fc44..3e74a21 100644 --- a/packages/opa/docs/sdk/models/components/servererror.md +++ b/packages/opa/docs/sdk/models/components/servererrorwithstatuscode.md @@ -1,15 +1,15 @@ -# ServerError +# ServerErrorWithStatusCode ## Example Usage ```typescript -import { ServerError } from "@styra/opa/sdk/models/components"; +import { ServerErrorWithStatusCode } from "@styra/opa/sdk/models/components"; -let value: ServerError = { +let value: ServerErrorWithStatusCode = { + httpStatusCode: "200", code: "", message: "", decisionId: "b84cf736-213c-4932-a8e4-bb5c648f1b4d", - httpStatusCode: "200", }; ``` @@ -17,8 +17,8 @@ let value: ServerError = { | Field | Type | Required | Description | Example | | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `httpStatusCode` | *string* | :heavy_minus_sign: | N/A | 200 | | `code` | *string* | :heavy_check_mark: | N/A | | | `message` | *string* | :heavy_check_mark: | N/A | | | `errors` | [components.Errors](../../../sdk/models/components/errors.md)[] | :heavy_minus_sign: | N/A | | -| `decisionId` | *string* | :heavy_minus_sign: | N/A | b84cf736-213c-4932-a8e4-bb5c648f1b4d | -| `httpStatusCode` | *string* | :heavy_minus_sign: | N/A | 200 | \ No newline at end of file +| `decisionId` | *string* | :heavy_minus_sign: | N/A | b84cf736-213c-4932-a8e4-bb5c648f1b4d | \ No newline at end of file diff --git a/packages/opa/docs/sdk/models/components/responsessuccessfulpolicyresponse.md b/packages/opa/docs/sdk/models/components/successfulpolicyresponsewithstatuscode.md similarity index 97% rename from packages/opa/docs/sdk/models/components/responsessuccessfulpolicyresponse.md rename to packages/opa/docs/sdk/models/components/successfulpolicyresponsewithstatuscode.md index 11f6863..ec9013e 100644 --- a/packages/opa/docs/sdk/models/components/responsessuccessfulpolicyresponse.md +++ b/packages/opa/docs/sdk/models/components/successfulpolicyresponsewithstatuscode.md @@ -1,17 +1,17 @@ -# ResponsesSuccessfulPolicyResponse +# SuccessfulPolicyResponseWithStatusCode ## Example Usage ```typescript -import { ResponsesSuccessfulPolicyResponse } from "@styra/opa/sdk/models/components"; +import { SuccessfulPolicyResponseWithStatusCode } from "@styra/opa/sdk/models/components"; -let value: ResponsesSuccessfulPolicyResponse = { +let value: SuccessfulPolicyResponseWithStatusCode = { + httpStatusCode: "200", result: { allow: true, user_is_admin: true, user_is_granted: [""], }, - httpStatusCode: "200", }; ``` @@ -19,8 +19,8 @@ let value: ResponsesSuccessfulPolicyResponse = { | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `httpStatusCode` | *string* | :heavy_minus_sign: | N/A | 200 | | `result` | *components.Result* | :heavy_minus_sign: | The base or virtual document referred to by the URL path. If the path is undefined, this key will be omitted. | | | `metrics` | Record | :heavy_minus_sign: | If query metrics are enabled, this field contains query performance metrics collected during the parse, compile, and evaluation steps. | | | `decisionId` | *string* | :heavy_minus_sign: | If decision logging is enabled, this field contains a string that uniquely identifies the decision. The identifier will be included in the decision log event for this decision. Callers can use the identifier for correlation purposes. | | -| `provenance` | [components.Provenance](../../../sdk/models/components/provenance.md) | :heavy_minus_sign: | Provenance information can be requested on individual API calls and are returned inline with the API response. To obtain provenance information on an API call, specify the `provenance=true` query parameter when executing the API call. | | -| `httpStatusCode` | *string* | :heavy_minus_sign: | N/A | 200 | \ No newline at end of file +| `provenance` | [components.Provenance](../../../sdk/models/components/provenance.md) | :heavy_minus_sign: | Provenance information can be requested on individual API calls and are returned inline with the API response. To obtain provenance information on an API call, specify the `provenance=true` query parameter when executing the API call. | | \ No newline at end of file diff --git a/packages/opa/docs/sdk/models/operations/executebatchpolicywithinputresponse.md b/packages/opa/docs/sdk/models/operations/executebatchpolicywithinputresponse.md index 9d5c253..2e3c92f 100644 --- a/packages/opa/docs/sdk/models/operations/executebatchpolicywithinputresponse.md +++ b/packages/opa/docs/sdk/models/operations/executebatchpolicywithinputresponse.md @@ -23,10 +23,10 @@ let value: ExecuteBatchPolicyWithInputResponse = { batchMixedResults: { responses: { key: { + httpStatusCode: "200", code: "", message: "", decisionId: "b84cf736-213c-4932-a8e4-bb5c648f1b4d", - httpStatusCode: "200", }, }, }, diff --git a/packages/opa/jsr.json b/packages/opa/jsr.json index b603788..6c1617f 100644 --- a/packages/opa/jsr.json +++ b/packages/opa/jsr.json @@ -2,7 +2,7 @@ { "name": "@styra/opa", - "version": "1.4.1", + "version": "1.5.0", "exports": { ".": "./src/index.ts", "./sdk/models/errors": "./src/sdk/models/errors/index.ts", diff --git a/packages/opa/package.json b/packages/opa/package.json index 1222e20..e94f5e5 100644 --- a/packages/opa/package.json +++ b/packages/opa/package.json @@ -1,7 +1,10 @@ { "name": "@styra/opa", - "version": "1.4.1", + "version": "1.5.0", "author": "Styra", + "publishConfig": { + "access": "public" + }, "keywords": [ "OPA", "Open Policy Agent", @@ -12,9 +15,6 @@ "role based access control" ], "license": "Apache-2.0", - "publishConfig": { - "access": "public" - }, "tshy": { "exports": { ".": "./src/index.ts", diff --git a/packages/opa/src/lib/config.ts b/packages/opa/src/lib/config.ts index f3bbd0d..ec8fbf5 100644 --- a/packages/opa/src/lib/config.ts +++ b/packages/opa/src/lib/config.ts @@ -57,7 +57,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "0.2.0", - sdkVersion: "1.4.1", - genVersion: "2.399.0", - userAgent: "speakeasy-sdk/typescript 1.4.1 2.399.0 0.2.0 @styra/opa", + sdkVersion: "1.5.0", + genVersion: "2.402.5", + userAgent: "speakeasy-sdk/typescript 1.5.0 2.402.5 0.2.0 @styra/opa", } as const; diff --git a/packages/opa/src/opaclient.ts b/packages/opa/src/opaclient.ts index b57a57f..d34457c 100644 --- a/packages/opa/src/opaclient.ts +++ b/packages/opa/src/opaclient.ts @@ -2,11 +2,10 @@ import { OpaApiClient } from "./sdk/index.js"; import { type Input, type Result, - type ResponsesSuccessfulPolicyResponse, - type ServerError, + type SuccessfulPolicyResponse, + type ServerErrorWithStatusCode, BatchMixedResults, BatchSuccessfulPolicyEvaluation, - SuccessfulPolicyResponse, } from "./sdk/models/components/index.js"; import { ExecutePolicyWithInputResponse, @@ -178,7 +177,7 @@ export class OPAClient { path: string, inputs: { [k: string]: In }, opts?: BatchRequestOptions, - ): Promise<{ [k: string]: Res | ServerError }> { + ): Promise<{ [k: string]: Res | ServerErrorWithStatusCode }> { const inps = Object.fromEntries( Object.entries(inputs).map(([k, inp]) => [ k, @@ -228,8 +227,10 @@ export class OPAClient { path: string, inputs: { [k: string]: Input }, opts?: BatchRequestOptions, - ): Promise<{ [k: string]: ServerError | SuccessfulPolicyResponse }> { - let items: [string, ServerError | SuccessfulPolicyResponse][]; + ): Promise<{ + [k: string]: ServerErrorWithStatusCode | SuccessfulPolicyResponse; + }> { + let items: [string, ServerErrorWithStatusCode | SuccessfulPolicyResponse][]; const keys = Object.keys(inputs); const ps = Object.values(inputs).map((input) => this.opa @@ -256,7 +257,7 @@ export class OPAClient { ...(res.reason as ServerError_).data$, httpStatusCode: "500", }, - ] as [string, ServerError]; + ] as [string, ServerErrorWithStatusCode]; } return [keys[i], res.value] as [string, SuccessfulPolicyResponse]; }); @@ -268,13 +269,14 @@ export class OPAClient { } function processResult( - res: ResponsesSuccessfulPolicyResponse | ServerError, + res: SuccessfulPolicyResponse | ServerErrorWithStatusCode, opts?: BatchRequestOptions, -): Promise { +): Promise { if (res && "code" in res) { - if (opts?.rejectMixed) return Promise.reject(res as ServerError); + if (opts?.rejectMixed) + return Promise.reject(res as ServerErrorWithStatusCode); - return Promise.resolve(res as ServerError); + return Promise.resolve(res as ServerErrorWithStatusCode); } const fromResult = opts?.fromResult || id; diff --git a/packages/opa/src/sdk/models/components/batchmixedresults.ts b/packages/opa/src/sdk/models/components/batchmixedresults.ts index 0799c63..4d7a683 100644 --- a/packages/opa/src/sdk/models/components/batchmixedresults.ts +++ b/packages/opa/src/sdk/models/components/batchmixedresults.ts @@ -24,15 +24,16 @@ export type Errors = { location?: Location | undefined; }; -export type ServerError = { +export type ServerErrorWithStatusCode = { + httpStatusCode?: string | undefined; code: string; message: string; errors?: Array | undefined; decisionId?: string | undefined; - httpStatusCode?: string | undefined; }; -export type ResponsesSuccessfulPolicyResponse = { +export type SuccessfulPolicyResponseWithStatusCode = { + httpStatusCode?: string | undefined; /** * The base or virtual document referred to by the URL path. If the path is undefined, this key will be omitted. */ @@ -49,12 +50,11 @@ export type ResponsesSuccessfulPolicyResponse = { * Provenance information can be requested on individual API calls and are returned inline with the API response. To obtain provenance information on an API call, specify the `provenance=true` query parameter when executing the API call. */ provenance?: Provenance | undefined; - httpStatusCode?: string | undefined; }; export type Responses = - | (ResponsesSuccessfulPolicyResponse & { httpStatusCode: "200" }) - | (ServerError & { httpStatusCode: "500" }); + | (SuccessfulPolicyResponseWithStatusCode & { httpStatusCode: "200" }) + | (ServerErrorWithStatusCode & { httpStatusCode: "500" }); export type BatchMixedResults = { batchDecisionId?: string | undefined; @@ -65,8 +65,8 @@ export type BatchMixedResults = { responses?: | { [k: string]: - | (ResponsesSuccessfulPolicyResponse & { httpStatusCode: "200" }) - | (ServerError & { httpStatusCode: "500" }); + | (SuccessfulPolicyResponseWithStatusCode & { httpStatusCode: "200" }) + | (ServerErrorWithStatusCode & { httpStatusCode: "500" }); } | undefined; }; @@ -141,47 +141,51 @@ export namespace Errors$ { } /** @internal */ -export const ServerError$inboundSchema: z.ZodType = z +export const ServerErrorWithStatusCode$inboundSchema: z.ZodType< + ServerErrorWithStatusCode, + z.ZodTypeDef, + unknown +> = z .object({ + http_status_code: z.string().optional(), code: z.string(), message: z.string(), errors: z.array(z.lazy(() => Errors$inboundSchema)).optional(), decision_id: z.string().optional(), - http_status_code: z.string().optional(), }) .transform((v) => { return remap$(v, { - decision_id: "decisionId", http_status_code: "httpStatusCode", + decision_id: "decisionId", }); }); /** @internal */ -export type ServerError$Outbound = { +export type ServerErrorWithStatusCode$Outbound = { + http_status_code?: string | undefined; code: string; message: string; errors?: Array | undefined; decision_id?: string | undefined; - http_status_code?: string | undefined; }; /** @internal */ -export const ServerError$outboundSchema: z.ZodType< - ServerError$Outbound, +export const ServerErrorWithStatusCode$outboundSchema: z.ZodType< + ServerErrorWithStatusCode$Outbound, z.ZodTypeDef, - ServerError + ServerErrorWithStatusCode > = z .object({ + httpStatusCode: z.string().optional(), code: z.string(), message: z.string(), errors: z.array(z.lazy(() => Errors$outboundSchema)).optional(), decisionId: z.string().optional(), - httpStatusCode: z.string().optional(), }) .transform((v) => { return remap$(v, { - decisionId: "decision_id", httpStatusCode: "http_status_code", + decisionId: "decision_id", }); }); @@ -189,61 +193,61 @@ export const ServerError$outboundSchema: z.ZodType< * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ -export namespace ServerError$ { - /** @deprecated use `ServerError$inboundSchema` instead. */ - export const inboundSchema = ServerError$inboundSchema; - /** @deprecated use `ServerError$outboundSchema` instead. */ - export const outboundSchema = ServerError$outboundSchema; - /** @deprecated use `ServerError$Outbound` instead. */ - export type Outbound = ServerError$Outbound; +export namespace ServerErrorWithStatusCode$ { + /** @deprecated use `ServerErrorWithStatusCode$inboundSchema` instead. */ + export const inboundSchema = ServerErrorWithStatusCode$inboundSchema; + /** @deprecated use `ServerErrorWithStatusCode$outboundSchema` instead. */ + export const outboundSchema = ServerErrorWithStatusCode$outboundSchema; + /** @deprecated use `ServerErrorWithStatusCode$Outbound` instead. */ + export type Outbound = ServerErrorWithStatusCode$Outbound; } /** @internal */ -export const ResponsesSuccessfulPolicyResponse$inboundSchema: z.ZodType< - ResponsesSuccessfulPolicyResponse, +export const SuccessfulPolicyResponseWithStatusCode$inboundSchema: z.ZodType< + SuccessfulPolicyResponseWithStatusCode, z.ZodTypeDef, unknown > = z .object({ + http_status_code: z.string().optional(), result: Result$inboundSchema.optional(), metrics: z.record(z.any()).optional(), decision_id: z.string().optional(), provenance: Provenance$inboundSchema.optional(), - http_status_code: z.string().optional(), }) .transform((v) => { return remap$(v, { - decision_id: "decisionId", http_status_code: "httpStatusCode", + decision_id: "decisionId", }); }); /** @internal */ -export type ResponsesSuccessfulPolicyResponse$Outbound = { +export type SuccessfulPolicyResponseWithStatusCode$Outbound = { + http_status_code?: string | undefined; result?: Result$Outbound | undefined; metrics?: { [k: string]: any } | undefined; decision_id?: string | undefined; provenance?: Provenance$Outbound | undefined; - http_status_code?: string | undefined; }; /** @internal */ -export const ResponsesSuccessfulPolicyResponse$outboundSchema: z.ZodType< - ResponsesSuccessfulPolicyResponse$Outbound, +export const SuccessfulPolicyResponseWithStatusCode$outboundSchema: z.ZodType< + SuccessfulPolicyResponseWithStatusCode$Outbound, z.ZodTypeDef, - ResponsesSuccessfulPolicyResponse + SuccessfulPolicyResponseWithStatusCode > = z .object({ + httpStatusCode: z.string().optional(), result: Result$outboundSchema.optional(), metrics: z.record(z.any()).optional(), decisionId: z.string().optional(), provenance: Provenance$outboundSchema.optional(), - httpStatusCode: z.string().optional(), }) .transform((v) => { return remap$(v, { - decisionId: "decision_id", httpStatusCode: "http_status_code", + decisionId: "decision_id", }); }); @@ -251,26 +255,26 @@ export const ResponsesSuccessfulPolicyResponse$outboundSchema: z.ZodType< * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ -export namespace ResponsesSuccessfulPolicyResponse$ { - /** @deprecated use `ResponsesSuccessfulPolicyResponse$inboundSchema` instead. */ - export const inboundSchema = ResponsesSuccessfulPolicyResponse$inboundSchema; - /** @deprecated use `ResponsesSuccessfulPolicyResponse$outboundSchema` instead. */ - export const outboundSchema = ResponsesSuccessfulPolicyResponse$outboundSchema; - /** @deprecated use `ResponsesSuccessfulPolicyResponse$Outbound` instead. */ - export type Outbound = ResponsesSuccessfulPolicyResponse$Outbound; +export namespace SuccessfulPolicyResponseWithStatusCode$ { + /** @deprecated use `SuccessfulPolicyResponseWithStatusCode$inboundSchema` instead. */ + export const inboundSchema = SuccessfulPolicyResponseWithStatusCode$inboundSchema; + /** @deprecated use `SuccessfulPolicyResponseWithStatusCode$outboundSchema` instead. */ + export const outboundSchema = SuccessfulPolicyResponseWithStatusCode$outboundSchema; + /** @deprecated use `SuccessfulPolicyResponseWithStatusCode$Outbound` instead. */ + export type Outbound = SuccessfulPolicyResponseWithStatusCode$Outbound; } /** @internal */ export const Responses$inboundSchema: z.ZodType = z.union([ z - .lazy(() => ResponsesSuccessfulPolicyResponse$inboundSchema) + .lazy(() => SuccessfulPolicyResponseWithStatusCode$inboundSchema) .and( z .object({ http_status_code: z.literal("200") }) .transform((v) => ({ httpStatusCode: v.http_status_code })) ), z - .lazy(() => ServerError$inboundSchema) + .lazy(() => ServerErrorWithStatusCode$inboundSchema) .and( z .object({ http_status_code: z.literal("500") }) @@ -280,21 +284,21 @@ export const Responses$inboundSchema: z.ZodType = z.union([ z - .lazy(() => ResponsesSuccessfulPolicyResponse$outboundSchema) + .lazy(() => SuccessfulPolicyResponseWithStatusCode$outboundSchema) .and( z .object({ httpStatusCode: z.literal("200") }) .transform((v) => ({ http_status_code: v.httpStatusCode })) ), z - .lazy(() => ServerError$outboundSchema) + .lazy(() => ServerErrorWithStatusCode$outboundSchema) .and( z .object({ httpStatusCode: z.literal("500") }) @@ -325,14 +329,14 @@ export const BatchMixedResults$inboundSchema: z.ZodType ResponsesSuccessfulPolicyResponse$inboundSchema) + .lazy(() => SuccessfulPolicyResponseWithStatusCode$inboundSchema) .and( z .object({ http_status_code: z.literal("200") }) .transform((v) => ({ httpStatusCode: v.http_status_code })) ), z - .lazy(() => ServerError$inboundSchema) + .lazy(() => ServerErrorWithStatusCode$inboundSchema) .and( z .object({ http_status_code: z.literal("500") }) @@ -355,8 +359,8 @@ export type BatchMixedResults$Outbound = { responses?: | { [k: string]: - | (ResponsesSuccessfulPolicyResponse$Outbound & { http_status_code: "200" }) - | (ServerError$Outbound & { http_status_code: "500" }); + | (SuccessfulPolicyResponseWithStatusCode$Outbound & { http_status_code: "200" }) + | (ServerErrorWithStatusCode$Outbound & { http_status_code: "500" }); } | undefined; }; @@ -374,14 +378,14 @@ export const BatchMixedResults$outboundSchema: z.ZodType< .record( z.union([ z - .lazy(() => ResponsesSuccessfulPolicyResponse$outboundSchema) + .lazy(() => SuccessfulPolicyResponseWithStatusCode$outboundSchema) .and( z .object({ httpStatusCode: z.literal("200") }) .transform((v) => ({ http_status_code: v.httpStatusCode })) ), z - .lazy(() => ServerError$outboundSchema) + .lazy(() => ServerErrorWithStatusCode$outboundSchema) .and( z .object({ httpStatusCode: z.literal("500") }) diff --git a/packages/opa/src/sdk/models/operations/health.ts b/packages/opa/src/sdk/models/operations/health.ts index 8562522..4bf9714 100644 --- a/packages/opa/src/sdk/models/operations/health.ts +++ b/packages/opa/src/sdk/models/operations/health.ts @@ -32,8 +32,8 @@ export type HealthResponse = { /** @internal */ export const HealthRequest$inboundSchema: z.ZodType = z .object({ - bundles: z.boolean().default(false), - plugins: z.boolean().default(false), + bundles: z.boolean(), + plugins: z.boolean(), "exclude-plugin": z.array(z.string()).optional(), }) .transform((v) => {