Skip to content

Commit a5d11f1

Browse files
committed
ci: regenerated with OpenAPI Doc 0.3.0, Speakeay CLI 1.78.3
1 parent e33beef commit a5d11f1

File tree

14 files changed

+416
-245
lines changed

14 files changed

+416
-245
lines changed

RELEASES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,4 +826,14 @@ Based on:
826826
### Generated
827827
- [typescript v1.55.1] .
828828
### Releases
829-
- [NPM v1.55.1] https://www.npmjs.com/package/@speakeasy-api/speakeasy-client-sdk-typescript/v/1.55.1 - .
829+
- [NPM v1.55.1] https://www.npmjs.com/package/@speakeasy-api/speakeasy-client-sdk-typescript/v/1.55.1 - .
830+
831+
## 2023-09-05 00:10:23
832+
### Changes
833+
Based on:
834+
- OpenAPI Doc 0.3.0 https://docs.speakeasyapi.dev/openapi.yaml
835+
- Speakeasy CLI 1.78.3 (2.96.3) https://github.com/speakeasy-api/speakeasy
836+
### Generated
837+
- [typescript v1.56.0] .
838+
### Releases
839+
- [NPM v1.56.0] https://www.npmjs.com/package/@speakeasy-api/speakeasy-client-sdk-typescript/v/1.56.0 - .

gen.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ configVersion: 1.0.0
22
management:
33
docChecksum: 8c4f3932e054e1b349a9a34f12cf7e8c
44
docVersion: 0.3.0
5-
speakeasyVersion: 1.77.2
6-
generationVersion: 2.93.0
5+
speakeasyVersion: 1.78.3
6+
generationVersion: 2.96.3
77
generation:
88
sdkClassName: speakeasy
99
singleTagPerOp: false
1010
telemetryEnabled: true
1111
features:
1212
typescript:
1313
acceptHeaders: 2.81.1
14-
core: 2.85.2
14+
core: 2.87.0
1515
examples: 2.81.1
1616
globalSecurity: 2.81.1
1717
globalServerURLs: 2.82.0
1818
inputOutputModels: 2.81.1
1919
serverIDs: 2.81.1
2020
typescript:
21-
version: 1.55.1
21+
version: 1.56.0
2222
author: Speakeasy
2323
maxMethodParams: 0
2424
packageName: '@speakeasy-api/speakeasy-client-sdk-typescript'

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": "@speakeasy-api/speakeasy-client-sdk-typescript",
3-
"version": "1.55.1",
3+
"version": "1.56.0",
44
"author": "Speakeasy",
55
"scripts": {
66
"prepare": "tsc --build"

src/internal/utils/requestbody.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function serializeRequestBody(
1515
request: any,
1616
requestFieldName: string,
1717
serializationMethod: string
18-
): [object, any] {
18+
): [Record<string, any>, any] {
1919
if (
2020
request !== Object(request) ||
2121
!request.hasOwnProperty(requestFieldName)
@@ -46,8 +46,8 @@ export function serializeRequestBody(
4646
const serializeContentType = (
4747
contentType: string,
4848
reqBody: any
49-
): [object, any] => {
50-
let [requestHeaders, requestBody]: [object, any] = [{}, {}];
49+
): [Record<string, any>, any] => {
50+
let [requestHeaders, requestBody]: [Record<string, string>, any] = [{}, {}];
5151

5252
switch (contentType) {
5353
case "multipart/form-data":

src/internal/utils/security.ts

Lines changed: 39 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
33
*/
44

5-
import { AxiosInstance } from "axios";
6-
75
const securityMetadataKey = "security";
86

9-
export function createSecurityClient(
10-
client: AxiosInstance,
7+
export type SecurityProperties = {
8+
params: Record<string, string>,
9+
headers: Record<string, string>,
10+
}
11+
12+
export function parseSecurityProperties(
1113
security: any
12-
): AxiosInstance {
13-
return parseSecurityClass(client, security);
14+
): SecurityProperties {
15+
return parseSecurityClass(security);
1416
}
1517

1618
function parseSecurityDecorator(securityAnn: string): SecurityDecorator {
@@ -51,10 +53,13 @@ function parseSecurityDecorator(securityAnn: string): SecurityDecorator {
5153
}
5254

5355
function parseSecurityClass(
54-
client: AxiosInstance,
5556
security: any
56-
): AxiosInstance {
57+
): SecurityProperties {
5758
const fieldNames: string[] = Object.getOwnPropertyNames(security);
59+
const properties: SecurityProperties = {
60+
params: {},
61+
headers: {},
62+
}
5863
fieldNames.forEach((fname) => {
5964
const securityAnn: string = Reflect.getMetadata(
6065
securityMetadataKey,
@@ -69,23 +74,23 @@ function parseSecurityClass(
6974
const value = security[fname];
7075

7176
if (securityDecorator.Option) {
72-
return parseSecurityOption(client, value);
77+
return parseSecurityOption(properties, value);
7378
} else if (securityDecorator.Scheme) {
7479
if (securityDecorator.SubType === "basic" && value !== Object(value)) {
75-
return parseSecurityScheme(client, securityDecorator, security);
80+
return parseSecurityScheme(properties, securityDecorator, security);
7681
} else {
77-
client = parseSecurityScheme(client, securityDecorator, value);
82+
return parseSecurityScheme(properties, securityDecorator, value);
7883
}
7984
}
8085
});
8186

82-
return client;
87+
return properties;
8388
}
8489

8590
function parseSecurityOption(
86-
client: AxiosInstance,
91+
properties: SecurityProperties,
8792
optionType: any
88-
): AxiosInstance {
93+
): void {
8994
const fieldNames: string[] = Object.getOwnPropertyNames(optionType);
9095
fieldNames.forEach((fname) => {
9196
const securityAnn: string = Reflect.getMetadata(
@@ -97,23 +102,21 @@ function parseSecurityOption(
97102
const securityDecorator: SecurityDecorator =
98103
parseSecurityDecorator(securityAnn);
99104
if (securityDecorator == null || !securityDecorator.Scheme) return;
100-
return parseSecurityScheme(client, securityDecorator, optionType[fname]);
105+
return parseSecurityScheme(properties, securityDecorator, optionType[fname]);
101106
});
102-
103-
return client;
104107
}
105108

106109
function parseSecurityScheme(
107-
client: AxiosInstance,
110+
properties: SecurityProperties,
108111
schemeDecorator: SecurityDecorator,
109112
scheme: any
110-
): AxiosInstance {
113+
): void {
111114
if (scheme === Object(scheme)) {
112115
if (
113116
schemeDecorator.Type === "http" &&
114117
schemeDecorator.SubType === "basic"
115118
) {
116-
return parseBasicAuthScheme(client, scheme);
119+
return parseBasicAuthScheme(properties, scheme);
117120
}
118121

119122
const fieldNames: string[] = Object.getOwnPropertyNames(scheme);
@@ -128,64 +131,62 @@ function parseSecurityScheme(
128131
parseSecurityDecorator(securityAnn);
129132
if (securityDecorator == null || securityDecorator.Name === "") return;
130133

131-
client = parseSecuritySchemeValue(
132-
client,
134+
return parseSecuritySchemeValue(
135+
properties,
133136
schemeDecorator,
134137
securityDecorator,
135138
scheme[fname]
136139
);
137140
});
138141
} else {
139-
client = parseSecuritySchemeValue(
140-
client,
142+
return parseSecuritySchemeValue(
143+
properties,
141144
schemeDecorator,
142145
schemeDecorator,
143146
scheme
144147
);
145148
}
146-
147-
return client;
148149
}
149150

150151
function parseSecuritySchemeValue(
151-
client: AxiosInstance,
152+
properties: SecurityProperties,
152153
schemeDecorator: SecurityDecorator,
153154
securityDecorator: SecurityDecorator,
154155
value: any
155-
): AxiosInstance {
156+
): void {
156157
switch (schemeDecorator.Type) {
157158
case "apiKey":
158159
switch (schemeDecorator.SubType) {
159160
case "header":
160-
client.defaults.headers.common[securityDecorator.Name] = value;
161+
properties.headers[securityDecorator.Name] = value;
161162
break;
162163
case "query":
163-
client.defaults.params[securityDecorator.Name] = value;
164+
properties.params[securityDecorator.Name] = value;
164165
break;
165166
case "cookie": {
166167
const securityDecoratorName: string = securityDecorator.Name;
167168
const val: string = value;
168-
client.defaults.headers.common[
169+
properties.headers[
169170
"Cookie"
170-
] = `${securityDecoratorName}=${val}`;
171+
] = `${securityDecoratorName}=${val}`;
171172
break;
172173
}
173174
default:
174175
throw new Error("not supported");
175176
}
176177
break;
177178
case "openIdConnect":
178-
client.defaults.headers.common[securityDecorator.Name] = value;
179+
properties.headers[securityDecorator.Name] = value;
179180
break;
180181
case "oauth2":
181-
client.defaults.headers.common[securityDecorator.Name] = value;
182+
properties.headers[securityDecorator.Name] = value;
182183
break;
183184
case "http":
184185
switch (schemeDecorator.SubType) {
185186
case "basic":
186187
break;
187188
case "bearer":
188-
client.defaults.headers.common[securityDecorator.Name] = value.toLowerCase().startsWith("bearer ") ? value : `Bearer ${value}`;
189+
properties.headers[securityDecorator.Name] = value.toLowerCase().startsWith("bearer ") ? value : `Bearer ${value}`;
189190
break;
190191
default:
191192
throw new Error("not supported");
@@ -194,14 +195,12 @@ function parseSecuritySchemeValue(
194195
default:
195196
throw new Error("not supported");
196197
}
197-
198-
return client;
199198
}
200199

201200
function parseBasicAuthScheme(
202-
client: AxiosInstance,
201+
properties: SecurityProperties,
203202
scheme: any
204-
): AxiosInstance {
203+
): void {
205204
let username,
206205
password = "";
207206

@@ -227,11 +226,7 @@ function parseBasicAuthScheme(
227226
}
228227
});
229228

230-
client.defaults.headers.common["Authorization"] = `Basic ${Buffer.from(
231-
`${username}:${password}`
232-
).toString("base64")}`;
233-
234-
return client;
229+
properties.headers["Authorization"] = `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`;
235230
}
236231

237232
class SecurityDecorator {

0 commit comments

Comments
 (0)