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

Commit 387fe71

Browse files
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.277.1 (#58)
Co-authored-by: speakeasybot <bot@speakeasyapi.dev>
1 parent c4e5b4e commit 387fe71

File tree

12 files changed

+87
-36
lines changed

12 files changed

+87
-36
lines changed

.speakeasy/gen.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ id: 2f8b2839-3001-46b4-b5e0-cec0aad583ed
33
management:
44
docChecksum: 2422daf10293e923232daf08349ae0ae
55
docVersion: 0.2.0
6-
speakeasyVersion: 1.276.0
7-
generationVersion: 2.314.0
8-
releaseVersion: 0.4.1
9-
configChecksum: 02bbee7871c8eb9f1e6449a9a884ae2e
6+
speakeasyVersion: 1.277.1
7+
generationVersion: 2.317.0
8+
releaseVersion: 0.4.2
9+
configChecksum: 79144134c7663495fdf07e9a4393b783
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
constsAndDefaults: 0.1.5
16-
core: 3.9.0
16+
core: 3.9.2
1717
examples: 2.81.3
1818
flattening: 2.81.1
1919
globalServerURLs: 2.82.4

.speakeasy/gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ generation:
1212
auth:
1313
oAuth2ClientCredentialsEnabled: false
1414
typescript:
15-
version: 0.4.1
15+
version: 0.4.2
1616
additionalDependencies:
1717
dependencies: {}
1818
devDependencies:

.speakeasy/workflow.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
speakeasyVersion: 1.276.0
1+
speakeasyVersion: 1.277.1
22
sources:
33
openapi: {}
44
targets:

RELEASES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,14 @@ Based on:
178178
### Generated
179179
- [typescript v0.4.1] .
180180
### Releases
181-
- [NPM v0.4.1] https://www.npmjs.com/package/@styra/opa/v/0.4.1 - .
181+
- [NPM v0.4.1] https://www.npmjs.com/package/@styra/opa/v/0.4.1 - .
182+
183+
## 2024-04-30 08:48:47
184+
### Changes
185+
Based on:
186+
- OpenAPI Doc
187+
- Speakeasy CLI 1.277.1 (2.317.0) https://github.com/speakeasy-api/speakeasy
188+
### Generated
189+
- [typescript v0.4.2] .
190+
### Releases
191+
- [NPM v0.4.2] https://www.npmjs.com/package/@styra/opa/v/0.4.2 - .

jsr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@styra/opa",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"author": "Styra",
55
"main": "./index.js",
66
"sideEffects": false,

src/lib/config.ts

Lines changed: 3 additions & 3 deletions
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: "0.4.1",
56-
genVersion: "2.314.0",
57-
userAgent: "speakeasy-sdk/typescript 0.4.1 2.314.0 0.2.0 @styra/opa",
55+
sdkVersion: "0.4.2",
56+
genVersion: "2.317.0",
57+
userAgent: "speakeasy-sdk/typescript 0.4.2 2.317.0 0.2.0 @styra/opa",
5858
} as const;

src/lib/http.ts

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -141,29 +141,56 @@ export class HTTPClient {
141141
}
142142
}
143143

144-
export function matchContentType(response: Response, pattern: string): boolean {
145-
if (pattern === "*" || pattern === "*/*") {
144+
// A semicolon surrounded by optional whitespace characters is used to separate
145+
// segments in a media type string.
146+
const mediaParamSeparator = /\s*;\s*/g;
147+
148+
function matchContentType(response: Response, pattern: string): boolean {
149+
// `*` is a special case which means anything is acceptable.
150+
if (pattern === "*") {
146151
return true;
147152
}
148153

149-
const contentType =
150-
response.headers.get("content-type") ?? "application/octet-stream";
154+
let contentType =
155+
response.headers.get("content-type")?.trim() || "application/octet-stream";
156+
contentType = contentType.toLowerCase();
151157

152-
const idx = contentType.split(";").findIndex((raw) => {
153-
const ctype = raw.trim();
154-
if (ctype === pattern) {
155-
return true;
156-
}
158+
const wantParts = pattern.toLowerCase().trim().split(mediaParamSeparator);
159+
const [wantType = "", ...wantParams] = wantParts;
160+
161+
if (wantType.split("/").length !== 2) {
162+
return false;
163+
}
164+
165+
const gotParts = contentType.split(mediaParamSeparator);
166+
const [gotType = "", ...gotParams] = gotParts;
167+
168+
const [type = "", subtype = ""] = gotType.split("/");
169+
if (!type || !subtype) {
170+
return false;
171+
}
157172

158-
const parts = ctype.split("/");
159-
if (parts.length !== 2) {
173+
if (
174+
wantType !== "*/*" &&
175+
gotType !== wantType &&
176+
`${type}/*` !== wantType &&
177+
`*/${subtype}` !== wantType
178+
) {
179+
return false;
180+
}
181+
182+
if (gotParams.length < wantParams.length) {
183+
return false;
184+
}
185+
186+
const params = new Set(gotParams);
187+
for (const wantParam of wantParams) {
188+
if (!params.has(wantParam)) {
160189
return false;
161190
}
191+
}
162192

163-
return `${parts[0]}/*` === pattern || `*/${parts[1]}` === pattern;
164-
});
165-
166-
return idx >= 0;
193+
return true;
167194
}
168195

169196
const codeRangeRE = new RegExp("^[0-9]xx$", "i");

src/lib/security.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ type SecurityInputOAuth2 = {
6565

6666
type SecurityInputOAuth2ClientCredentials = {
6767
type: "oauth2:client_credentials";
68-
value: string | null | undefined;
69-
fieldName: "clientID" | "clientSecret";
68+
value: { clientID?: string | undefined; clientSecret?: string | undefined } | null | undefined;
7069
};
7170

7271
export type SecurityInput =
@@ -91,6 +90,8 @@ export function resolveSecurity(...options: SecurityInput[][]): SecurityState |
9190
return false;
9291
} else if (o.type === "http:basic") {
9392
return o.value.username != null || o.value.password != null;
93+
} else if (o.type === "oauth2:client_credentials") {
94+
return o.value.clientID != null || o.value.clientSecret != null;
9495
} else if (typeof o.value === "string") {
9596
return !!o.value;
9697
} else {

0 commit comments

Comments
 (0)