From 5d4d146a7485090fe00d78a177959ab19cacb1f6 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Mon, 13 May 2024 00:15:47 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.286.0 --- .speakeasy/gen.lock | 17 +++++++++------- .speakeasy/gen.yaml | 3 ++- .speakeasy/workflow.lock | 15 ++++++++++++-- .speakeasy/workflow.yaml | 2 ++ RELEASES.md | 12 ++++++++++- docs/sdks/opaapiclient/README.md | 8 ++------ jsr.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/lib/config.ts | 6 +++--- src/lib/http.ts | 12 ++++++++++- src/sdk/sdk.ts | 34 +++++++++++++++++--------------- 12 files changed, 76 insertions(+), 41 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index a7104a1..9993878 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -3,22 +3,25 @@ id: 2f8b2839-3001-46b4-b5e0-cec0aad583ed management: docChecksum: 2422daf10293e923232daf08349ae0ae docVersion: 0.2.0 - speakeasyVersion: 1.277.1 - generationVersion: 2.317.0 - releaseVersion: 0.4.2 - configChecksum: 79144134c7663495fdf07e9a4393b783 + speakeasyVersion: 1.286.0 + generationVersion: 2.326.3 + releaseVersion: 0.5.0 + configChecksum: 12a2529c34d131d1a3a61086b3fd32dc repoURL: https://github.com/StyraInc/opa-typescript.git installationURL: https://github.com/StyraInc/opa-typescript published: true features: typescript: + additionalDependencies: 0.1.0 constsAndDefaults: 0.1.5 - core: 3.9.2 - examples: 2.81.3 + core: 3.9.3 + examples: 2.81.4 flattening: 2.81.1 + globalSecurityCallbacks: 0.1.0 globalServerURLs: 2.82.4 responseFormat: 0.2.3 - unions: 2.85.3 + sdkHooks: 0.1.0 + unions: 2.85.4 generatedFiles: - src/sdk/sdk.ts - RUNTIMES.md diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 61693bd..2d6f2da 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: false typescript: - version: 0.4.2 + version: 0.5.0 additionalDependencies: dependencies: {} devDependencies: @@ -39,6 +39,7 @@ typescript: webhooks: sdk/models/webhooks inputModelSuffix: input maxMethodParams: 4 + methodArguments: require-security-and-request outputModelSuffix: output packageName: '@styra/opa' responseFormat: envelope-http diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index d714752..02246bc 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,18 @@ -speakeasyVersion: 1.277.1 +speakeasyVersion: 1.286.0 sources: - openapi: {} + openapi: + sourceNamespace: openapi + sourceRevisionDigest: sha256:a533ab22170eaa56a25bda5a6ea2b4ce81e458a192b449c4f2d3b2e0041b19ac + sourceBlobDigest: sha256:2e4510c88bf40f5ebe1982d8a370214696a9eaa4b11a656b904a93c3e4788325 + tags: + - latest + - main targets: first-target: source: openapi + sourceNamespace: openapi + sourceRevisionDigest: sha256:a533ab22170eaa56a25bda5a6ea2b4ce81e458a192b449c4f2d3b2e0041b19ac + sourceBlobDigest: sha256:2e4510c88bf40f5ebe1982d8a370214696a9eaa4b11a656b904a93c3e4788325 outLocation: /github/workspace/repo workflow: workflowVersion: 1.0.0 @@ -12,6 +21,8 @@ workflow: openapi: inputs: - location: https://raw.githubusercontent.com/StyraInc/enterprise-opa/main/openapi/openapi.yaml + registry: + location: registry.speakeasyapi.dev/styra/styra/openapi targets: first-target: target: typescript diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 438883d..b295a9d 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -4,6 +4,8 @@ sources: openapi: inputs: - location: https://raw.githubusercontent.com/StyraInc/enterprise-opa/main/openapi/openapi.yaml + registry: + location: registry.speakeasyapi.dev/styra/styra/openapi targets: first-target: target: typescript diff --git a/RELEASES.md b/RELEASES.md index 529898c..f01ef9e 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -188,4 +188,14 @@ Based on: ### Generated - [typescript v0.4.2] . ### Releases -- [NPM v0.4.2] https://www.npmjs.com/package/@styra/opa/v/0.4.2 - . \ No newline at end of file +- [NPM v0.4.2] https://www.npmjs.com/package/@styra/opa/v/0.4.2 - . + +## 2024-05-13 00:15:08 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.286.0 (2.326.3) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v0.5.0] . +### Releases +- [NPM v0.5.0] https://www.npmjs.com/package/@styra/opa/v/0.5.0 - . \ No newline at end of file diff --git a/docs/sdks/opaapiclient/README.md b/docs/sdks/opaapiclient/README.md index e35cb5a..c2910fe 100644 --- a/docs/sdks/opaapiclient/README.md +++ b/docs/sdks/opaapiclient/README.md @@ -112,13 +112,9 @@ import { OpaApiClient } from "@styra/opa"; const opaApiClient = new OpaApiClient(); async function run() { - const bundles = false; - const plugins = false; - const excludePlugin = [ + const result = await opaApiClient.health(false, false, [ "", - ]; - - const result = await opaApiClient.health(bundles, plugins, excludePlugin); + ]); // Handle the result console.log(result) diff --git a/jsr.json b/jsr.json index 628a016..d327932 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "@styra/opa", - "version": "0.4.2", + "version": "0.5.0", "exports": { ".": "./src/index.ts", "./sdk/models/errors": "./src/sdk/models/errors/index.ts", diff --git a/package-lock.json b/package-lock.json index 3283963..fecc666 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@styra/opa", - "version": "0.4.2", + "version": "0.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@styra/opa", - "version": "0.4.2", + "version": "0.5.0", "devDependencies": { "@types/jsonpath": "^0.2.4", "@typescript-eslint/eslint-plugin": "^7.7.1", diff --git a/package.json b/package.json index 038b1c3..a2e5e30 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@styra/opa", - "version": "0.4.2", + "version": "0.5.0", "author": "Styra", "main": "./index.js", "sideEffects": false, diff --git a/src/lib/config.ts b/src/lib/config.ts index 2fe0b4a..086dfd3 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -52,7 +52,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "0.2.0", - sdkVersion: "0.4.2", - genVersion: "2.317.0", - userAgent: "speakeasy-sdk/typescript 0.4.2 2.317.0 0.2.0 @styra/opa", + sdkVersion: "0.5.0", + genVersion: "2.326.3", + userAgent: "speakeasy-sdk/typescript 0.5.0 2.326.3 0.2.0 @styra/opa", } as const; diff --git a/src/lib/http.ts b/src/lib/http.ts index b4e519c..4c1edfd 100644 --- a/src/lib/http.ts +++ b/src/lib/http.ts @@ -9,7 +9,17 @@ export type Fetcher = ( export type Awaitable = T | Promise; -const DEFAULT_FETCHER: Fetcher = (input, init) => fetch(input, init); +const DEFAULT_FETCHER: Fetcher = (input, init) => { + // If input is a Request and init is undefined, Bun will discard the method, + // headers, body and other options that were set on the request object. + // Node.js and browers would ignore an undefined init value. This check is + // therefore needed for interop with Bun. + if (init == null) { + return fetch(input); + } else { + return fetch(input, init); + } +}; export type RequestInput = { /** diff --git a/src/sdk/sdk.ts b/src/sdk/sdk.ts index a72f78e..d6cdee9 100644 --- a/src/sdk/sdk.ts +++ b/src/sdk/sdk.ts @@ -42,15 +42,16 @@ export class OpaApiClient extends ClientSDK { * Execute a policy */ async executePolicy( - input: operations.ExecutePolicyRequest, + request: operations.ExecutePolicyRequest, options?: RequestOptions ): Promise { + const input$ = request; const headers$ = new Headers(); headers$.set("user-agent", SDK_METADATA.userAgent); headers$.set("Accept", "application/json"); const payload$ = schemas$.parse( - input, + input$, (value$) => operations.ExecutePolicyRequest$.outboundSchema.parse(value$), "Input validation failed" ); @@ -100,18 +101,18 @@ export class OpaApiClient extends ClientSDK { const context = { operationID: "executePolicy", oAuth2Scopes: [], securitySource: null }; const doOptions = { context, errorCodes: ["400", "4XX", "500", "5XX"] }; - const request = this.createRequest$( + const request$ = this.createRequest$( context, { method: "GET", path: path$, headers: headers$, query: query$, body: body$ }, options ); - const response = await this.do$(request, doOptions); + const response = await this.do$(request$, doOptions); const responseFields$ = { HttpMeta: { Response: response, - Request: request, + Request: request$, }, }; @@ -158,7 +159,7 @@ export class OpaApiClient extends ClientSDK { } else { throw new errors.SDKError("Unexpected API response status or content-type", { response, - request, + request: request$, }); } } @@ -167,16 +168,17 @@ export class OpaApiClient extends ClientSDK { * Execute a policy given an input */ async executePolicyWithInput( - input: operations.ExecutePolicyWithInputRequest, + request: operations.ExecutePolicyWithInputRequest, options?: RequestOptions ): Promise { + const input$ = request; const headers$ = new Headers(); headers$.set("user-agent", SDK_METADATA.userAgent); headers$.set("Content-Type", "application/json"); headers$.set("Accept", "application/json"); const payload$ = schemas$.parse( - input, + input$, (value$) => operations.ExecutePolicyWithInputRequest$.outboundSchema.parse(value$), "Input validation failed" ); @@ -237,18 +239,18 @@ export class OpaApiClient extends ClientSDK { }; const doOptions = { context, errorCodes: ["400", "4XX", "500", "5XX"] }; - const request = this.createRequest$( + const request$ = this.createRequest$( context, { method: "POST", path: path$, headers: headers$, query: query$, body: body$ }, options ); - const response = await this.do$(request, doOptions); + const response = await this.do$(request$, doOptions); const responseFields$ = { HttpMeta: { Response: response, - Request: request, + Request: request$, }, }; @@ -295,7 +297,7 @@ export class OpaApiClient extends ClientSDK { } else { throw new errors.SDKError("Unexpected API response status or content-type", { response, - request, + request: request$, }); } } @@ -350,18 +352,18 @@ export class OpaApiClient extends ClientSDK { const context = { operationID: "health", oAuth2Scopes: [], securitySource: null }; const doOptions = { context, errorCodes: ["4XX", "500", "5XX"] }; - const request = this.createRequest$( + const request$ = this.createRequest$( context, { method: "GET", path: path$, headers: headers$, query: query$, body: body$ }, options ); - const response = await this.do$(request, doOptions); + const response = await this.do$(request$, doOptions); const responseFields$ = { HttpMeta: { Response: response, - Request: request, + Request: request$, }, }; @@ -394,7 +396,7 @@ export class OpaApiClient extends ClientSDK { } else { throw new errors.SDKError("Unexpected API response status or content-type", { response, - request, + request: request$, }); } }