@aws/nx-plugin 0.102.0 → 0.104.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-THIRD-PARTY +207 -0
- package/package.json +1 -1
- package/src/open-api/ts-client/__snapshots__/generator.additional-properties.spec.ts.snap +202 -0
- package/src/open-api/ts-client/__snapshots__/generator.content-type.spec.ts.snap +475 -0
- package/src/open-api/ts-client/__snapshots__/generator.fast-api.spec.ts.snap +353 -0
- package/src/open-api/ts-client/files/client.gen.ts.template +22 -1
- package/src/open-api/ts-client/files/types.gen.ts.template +5 -1
- package/src/open-api/utils/codegen-data.js +7 -2
- package/src/open-api/utils/codegen-data.js.map +1 -1
- package/src/open-api/utils/normalise.js +14 -0
- package/src/open-api/utils/normalise.js.map +1 -1
- package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +518 -9
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/py/mcp-server/files/deploy/Dockerfile.template +1 -1
- package/src/py/project/generator.js +4 -4
- package/src/py/strands-agent/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/py/strands-agent/files/deploy/Dockerfile.template +1 -1
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +437 -0
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +522 -1
- package/src/utils/agent-connection/files/py-core-auth/auth/sigv4.py.template +1 -1
- package/src/utils/api-constructs/files/cdk/app/apis/http/__apiNameKebabCase__.ts.template +1 -1
- package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +7 -1
- package/src/utils/api-constructs/files/cdk/core/api/rest/rest-api.ts.template +99 -1
- package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +1 -1
- package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +21 -1
- package/src/utils/api-constructs/files/terraform/core/api/rest/rest-api/rest-api.tf.template +115 -0
- package/src/utils/function-constructs/function-constructs.js +2 -2
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`openApiTsClientGenerator - content type header > should not force Content-Type for multipart/form-data bodies > client.gen.ts 1`] = `
|
|
4
|
+
"import type { PostUploadRequest } from './types.gen.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Utility for serialisation and deserialisation of API types.
|
|
8
|
+
*/
|
|
9
|
+
export class $IO {
|
|
10
|
+
protected static $mapValues = (data: any, fn: (item: any) => any) =>
|
|
11
|
+
Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Client configuration for TestApi
|
|
16
|
+
*/
|
|
17
|
+
export interface TestApiConfig {
|
|
18
|
+
/**
|
|
19
|
+
* Base URL for the API
|
|
20
|
+
*/
|
|
21
|
+
url: string;
|
|
22
|
+
/**
|
|
23
|
+
* Custom instance of fetch. By default the global 'fetch' is used.
|
|
24
|
+
* You can override this to add custom middleware for use cases such as adding authentication headers.
|
|
25
|
+
*/
|
|
26
|
+
fetch?: typeof fetch;
|
|
27
|
+
/**
|
|
28
|
+
* Additional configuration
|
|
29
|
+
*/
|
|
30
|
+
options?: {
|
|
31
|
+
/**
|
|
32
|
+
* By default, the client will add a Content-Type header, set to the media type defined for
|
|
33
|
+
* the request in the OpenAPI specification.
|
|
34
|
+
* Set this to false to omit this header.
|
|
35
|
+
*/
|
|
36
|
+
omitContentTypeHeader?: boolean;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* API Client for TestApi
|
|
42
|
+
*/
|
|
43
|
+
export class TestApi {
|
|
44
|
+
private $config: TestApiConfig;
|
|
45
|
+
|
|
46
|
+
constructor(config: TestApiConfig) {
|
|
47
|
+
this.$config = config;
|
|
48
|
+
|
|
49
|
+
this.postUpload = this.postUpload.bind(this);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private $url = (
|
|
53
|
+
path: string,
|
|
54
|
+
pathParameters: { [key: string]: any },
|
|
55
|
+
queryParameters: { [key: string]: any },
|
|
56
|
+
collectionFormats?: { [key: string]: 'multi' | 'csv' },
|
|
57
|
+
): string => {
|
|
58
|
+
const baseUrl = this.$config.url.endsWith('/')
|
|
59
|
+
? this.$config.url.slice(0, -1)
|
|
60
|
+
: this.$config.url;
|
|
61
|
+
const pathWithParameters = Object.entries(pathParameters).reduce(
|
|
62
|
+
(withParams, [key, value]) =>
|
|
63
|
+
withParams.replace(\`{\${key}}\`, encodeURIComponent(\`\${value}\`)),
|
|
64
|
+
path,
|
|
65
|
+
);
|
|
66
|
+
const queryString = Object.entries(queryParameters)
|
|
67
|
+
.map(([key, value]) => {
|
|
68
|
+
if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
|
|
69
|
+
return value
|
|
70
|
+
.map(
|
|
71
|
+
(v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
|
|
72
|
+
)
|
|
73
|
+
.join('&');
|
|
74
|
+
}
|
|
75
|
+
return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
|
|
76
|
+
})
|
|
77
|
+
.join('&');
|
|
78
|
+
return (
|
|
79
|
+
baseUrl + pathWithParameters + (queryString ? \`?\${queryString}\` : '')
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
private $headers = (
|
|
84
|
+
headerParameters: { [key: string]: any },
|
|
85
|
+
collectionFormats?: { [key: string]: 'multi' | 'csv' },
|
|
86
|
+
): [string, string][] => {
|
|
87
|
+
return Object.entries(headerParameters).flatMap(([key, value]) => {
|
|
88
|
+
if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
|
|
89
|
+
return value.map((v) => [key, String(v)]) as [string, string][];
|
|
90
|
+
}
|
|
91
|
+
return [[key, String(value)]];
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
private $fetch: typeof fetch = (...args) =>
|
|
96
|
+
(this.$config.fetch ?? fetch)(...args);
|
|
97
|
+
|
|
98
|
+
public async postUpload(input: PostUploadRequest): Promise<void> {
|
|
99
|
+
const pathParameters: { [key: string]: any } = {};
|
|
100
|
+
const queryParameters: { [key: string]: any } = {};
|
|
101
|
+
const headerParameters: { [key: string]: any } = {};
|
|
102
|
+
const body = input as any;
|
|
103
|
+
|
|
104
|
+
const response = await this.$fetch(
|
|
105
|
+
this.$url('/upload', pathParameters, queryParameters),
|
|
106
|
+
{
|
|
107
|
+
headers: this.$headers(headerParameters),
|
|
108
|
+
method: 'POST',
|
|
109
|
+
body,
|
|
110
|
+
},
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
if (response.status === 204) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
throw new Error(
|
|
117
|
+
\`Unknown response status \${response.status} returned by API\`,
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
"
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
exports[`openApiTsClientGenerator - content type header > should not force Content-Type for multipart/form-data bodies > types.gen.ts 1`] = `
|
|
125
|
+
"export type PostUploadRequest = unknown;
|
|
126
|
+
export type PostUploadError = never;
|
|
127
|
+
"
|
|
128
|
+
`;
|
|
129
|
+
|
|
130
|
+
exports[`openApiTsClientGenerator - content type header > should pick a single wire media type when the spec lists multiple > client.gen.ts 1`] = `
|
|
131
|
+
"import type { PostMultiRequestContent, PostMultiRequest } from './types.gen.js';
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Utility for serialisation and deserialisation of API types.
|
|
135
|
+
*/
|
|
136
|
+
export class $IO {
|
|
137
|
+
protected static $mapValues = (data: any, fn: (item: any) => any) =>
|
|
138
|
+
Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
|
|
139
|
+
|
|
140
|
+
public static PostMultiRequestContent = {
|
|
141
|
+
toJson: (model: PostMultiRequestContent): any => {
|
|
142
|
+
if (model === undefined || model === null) {
|
|
143
|
+
return model;
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
...(model.m === undefined
|
|
147
|
+
? {}
|
|
148
|
+
: {
|
|
149
|
+
m: model.m,
|
|
150
|
+
}),
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
fromJson: (json: any): PostMultiRequestContent => {
|
|
154
|
+
if (json === undefined || json === null) {
|
|
155
|
+
return json;
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
...(json['m'] === undefined
|
|
159
|
+
? {}
|
|
160
|
+
: {
|
|
161
|
+
m: json['m'],
|
|
162
|
+
}),
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Client configuration for TestApi
|
|
170
|
+
*/
|
|
171
|
+
export interface TestApiConfig {
|
|
172
|
+
/**
|
|
173
|
+
* Base URL for the API
|
|
174
|
+
*/
|
|
175
|
+
url: string;
|
|
176
|
+
/**
|
|
177
|
+
* Custom instance of fetch. By default the global 'fetch' is used.
|
|
178
|
+
* You can override this to add custom middleware for use cases such as adding authentication headers.
|
|
179
|
+
*/
|
|
180
|
+
fetch?: typeof fetch;
|
|
181
|
+
/**
|
|
182
|
+
* Additional configuration
|
|
183
|
+
*/
|
|
184
|
+
options?: {
|
|
185
|
+
/**
|
|
186
|
+
* By default, the client will add a Content-Type header, set to the media type defined for
|
|
187
|
+
* the request in the OpenAPI specification.
|
|
188
|
+
* Set this to false to omit this header.
|
|
189
|
+
*/
|
|
190
|
+
omitContentTypeHeader?: boolean;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* API Client for TestApi
|
|
196
|
+
*/
|
|
197
|
+
export class TestApi {
|
|
198
|
+
private $config: TestApiConfig;
|
|
199
|
+
|
|
200
|
+
constructor(config: TestApiConfig) {
|
|
201
|
+
this.$config = config;
|
|
202
|
+
|
|
203
|
+
this.postMulti = this.postMulti.bind(this);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
private $url = (
|
|
207
|
+
path: string,
|
|
208
|
+
pathParameters: { [key: string]: any },
|
|
209
|
+
queryParameters: { [key: string]: any },
|
|
210
|
+
collectionFormats?: { [key: string]: 'multi' | 'csv' },
|
|
211
|
+
): string => {
|
|
212
|
+
const baseUrl = this.$config.url.endsWith('/')
|
|
213
|
+
? this.$config.url.slice(0, -1)
|
|
214
|
+
: this.$config.url;
|
|
215
|
+
const pathWithParameters = Object.entries(pathParameters).reduce(
|
|
216
|
+
(withParams, [key, value]) =>
|
|
217
|
+
withParams.replace(\`{\${key}}\`, encodeURIComponent(\`\${value}\`)),
|
|
218
|
+
path,
|
|
219
|
+
);
|
|
220
|
+
const queryString = Object.entries(queryParameters)
|
|
221
|
+
.map(([key, value]) => {
|
|
222
|
+
if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
|
|
223
|
+
return value
|
|
224
|
+
.map(
|
|
225
|
+
(v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
|
|
226
|
+
)
|
|
227
|
+
.join('&');
|
|
228
|
+
}
|
|
229
|
+
return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
|
|
230
|
+
})
|
|
231
|
+
.join('&');
|
|
232
|
+
return (
|
|
233
|
+
baseUrl + pathWithParameters + (queryString ? \`?\${queryString}\` : '')
|
|
234
|
+
);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
private $headers = (
|
|
238
|
+
headerParameters: { [key: string]: any },
|
|
239
|
+
collectionFormats?: { [key: string]: 'multi' | 'csv' },
|
|
240
|
+
): [string, string][] => {
|
|
241
|
+
return Object.entries(headerParameters).flatMap(([key, value]) => {
|
|
242
|
+
if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
|
|
243
|
+
return value.map((v) => [key, String(v)]) as [string, string][];
|
|
244
|
+
}
|
|
245
|
+
return [[key, String(value)]];
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
private $fetch: typeof fetch = (...args) =>
|
|
250
|
+
(this.$config.fetch ?? fetch)(...args);
|
|
251
|
+
|
|
252
|
+
public async postMulti(input: PostMultiRequest): Promise<void> {
|
|
253
|
+
const pathParameters: { [key: string]: any } = {};
|
|
254
|
+
const queryParameters: { [key: string]: any } = {};
|
|
255
|
+
const headerParameters: { [key: string]: any } = {};
|
|
256
|
+
if (!this.$config.options?.omitContentTypeHeader) {
|
|
257
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
258
|
+
}
|
|
259
|
+
const body =
|
|
260
|
+
typeof input === 'object'
|
|
261
|
+
? JSON.stringify($IO.PostMultiRequestContent.toJson(input))
|
|
262
|
+
: String($IO.PostMultiRequestContent.toJson(input));
|
|
263
|
+
|
|
264
|
+
const response = await this.$fetch(
|
|
265
|
+
this.$url('/multi', pathParameters, queryParameters),
|
|
266
|
+
{
|
|
267
|
+
headers: this.$headers(headerParameters),
|
|
268
|
+
method: 'POST',
|
|
269
|
+
body,
|
|
270
|
+
},
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
if (response.status === 204) {
|
|
274
|
+
return undefined;
|
|
275
|
+
}
|
|
276
|
+
throw new Error(
|
|
277
|
+
\`Unknown response status \${response.status} returned by API\`,
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
"
|
|
282
|
+
`;
|
|
283
|
+
|
|
284
|
+
exports[`openApiTsClientGenerator - content type header > should pick a single wire media type when the spec lists multiple > types.gen.ts 1`] = `
|
|
285
|
+
"export type PostMultiRequestContent = {
|
|
286
|
+
m?: string;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
export type PostMultiRequest = PostMultiRequestContent;
|
|
290
|
+
export type PostMultiError = never;
|
|
291
|
+
"
|
|
292
|
+
`;
|
|
293
|
+
|
|
294
|
+
exports[`openApiTsClientGenerator - content type header > should serialise cookie parameters into a Cookie request header > client.gen.ts 1`] = `
|
|
295
|
+
"import type {
|
|
296
|
+
GetSecretRequestCookieParameters,
|
|
297
|
+
GetSecretRequest,
|
|
298
|
+
} from './types.gen.js';
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Utility for serialisation and deserialisation of API types.
|
|
302
|
+
*/
|
|
303
|
+
export class $IO {
|
|
304
|
+
protected static $mapValues = (data: any, fn: (item: any) => any) =>
|
|
305
|
+
Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
|
|
306
|
+
|
|
307
|
+
public static GetSecretRequestCookieParameters = {
|
|
308
|
+
toJson: (model: GetSecretRequestCookieParameters): any => {
|
|
309
|
+
if (model === undefined || model === null) {
|
|
310
|
+
return model;
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
...(model.session === undefined
|
|
314
|
+
? {}
|
|
315
|
+
: {
|
|
316
|
+
session: model.session,
|
|
317
|
+
}),
|
|
318
|
+
...(model.preference === undefined
|
|
319
|
+
? {}
|
|
320
|
+
: {
|
|
321
|
+
preference: model.preference,
|
|
322
|
+
}),
|
|
323
|
+
};
|
|
324
|
+
},
|
|
325
|
+
fromJson: (json: any): GetSecretRequestCookieParameters => {
|
|
326
|
+
if (json === undefined || json === null) {
|
|
327
|
+
return json;
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
...(json['session'] === undefined
|
|
331
|
+
? {}
|
|
332
|
+
: {
|
|
333
|
+
session: json['session'],
|
|
334
|
+
}),
|
|
335
|
+
...(json['preference'] === undefined
|
|
336
|
+
? {}
|
|
337
|
+
: {
|
|
338
|
+
preference: json['preference'],
|
|
339
|
+
}),
|
|
340
|
+
};
|
|
341
|
+
},
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Client configuration for TestApi
|
|
347
|
+
*/
|
|
348
|
+
export interface TestApiConfig {
|
|
349
|
+
/**
|
|
350
|
+
* Base URL for the API
|
|
351
|
+
*/
|
|
352
|
+
url: string;
|
|
353
|
+
/**
|
|
354
|
+
* Custom instance of fetch. By default the global 'fetch' is used.
|
|
355
|
+
* You can override this to add custom middleware for use cases such as adding authentication headers.
|
|
356
|
+
*/
|
|
357
|
+
fetch?: typeof fetch;
|
|
358
|
+
/**
|
|
359
|
+
* Additional configuration
|
|
360
|
+
*/
|
|
361
|
+
options?: {
|
|
362
|
+
/**
|
|
363
|
+
* By default, the client will add a Content-Type header, set to the media type defined for
|
|
364
|
+
* the request in the OpenAPI specification.
|
|
365
|
+
* Set this to false to omit this header.
|
|
366
|
+
*/
|
|
367
|
+
omitContentTypeHeader?: boolean;
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* API Client for TestApi
|
|
373
|
+
*/
|
|
374
|
+
export class TestApi {
|
|
375
|
+
private $config: TestApiConfig;
|
|
376
|
+
|
|
377
|
+
constructor(config: TestApiConfig) {
|
|
378
|
+
this.$config = config;
|
|
379
|
+
|
|
380
|
+
this.getSecret = this.getSecret.bind(this);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
private $url = (
|
|
384
|
+
path: string,
|
|
385
|
+
pathParameters: { [key: string]: any },
|
|
386
|
+
queryParameters: { [key: string]: any },
|
|
387
|
+
collectionFormats?: { [key: string]: 'multi' | 'csv' },
|
|
388
|
+
): string => {
|
|
389
|
+
const baseUrl = this.$config.url.endsWith('/')
|
|
390
|
+
? this.$config.url.slice(0, -1)
|
|
391
|
+
: this.$config.url;
|
|
392
|
+
const pathWithParameters = Object.entries(pathParameters).reduce(
|
|
393
|
+
(withParams, [key, value]) =>
|
|
394
|
+
withParams.replace(\`{\${key}}\`, encodeURIComponent(\`\${value}\`)),
|
|
395
|
+
path,
|
|
396
|
+
);
|
|
397
|
+
const queryString = Object.entries(queryParameters)
|
|
398
|
+
.map(([key, value]) => {
|
|
399
|
+
if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
|
|
400
|
+
return value
|
|
401
|
+
.map(
|
|
402
|
+
(v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
|
|
403
|
+
)
|
|
404
|
+
.join('&');
|
|
405
|
+
}
|
|
406
|
+
return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
|
|
407
|
+
})
|
|
408
|
+
.join('&');
|
|
409
|
+
return (
|
|
410
|
+
baseUrl + pathWithParameters + (queryString ? \`?\${queryString}\` : '')
|
|
411
|
+
);
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
private $headers = (
|
|
415
|
+
headerParameters: { [key: string]: any },
|
|
416
|
+
collectionFormats?: { [key: string]: 'multi' | 'csv' },
|
|
417
|
+
): [string, string][] => {
|
|
418
|
+
return Object.entries(headerParameters).flatMap(([key, value]) => {
|
|
419
|
+
if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
|
|
420
|
+
return value.map((v) => [key, String(v)]) as [string, string][];
|
|
421
|
+
}
|
|
422
|
+
return [[key, String(value)]];
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
private $fetch: typeof fetch = (...args) =>
|
|
427
|
+
(this.$config.fetch ?? fetch)(...args);
|
|
428
|
+
|
|
429
|
+
public async getSecret(input: GetSecretRequest): Promise<string> {
|
|
430
|
+
const pathParameters: { [key: string]: any } = {};
|
|
431
|
+
const queryParameters: { [key: string]: any } = {};
|
|
432
|
+
const headerParameters: { [key: string]: any } = {};
|
|
433
|
+
const cookieParameters: { [key: string]: any } =
|
|
434
|
+
$IO.GetSecretRequestCookieParameters.toJson(input);
|
|
435
|
+
const cookiePairs = Object.entries(cookieParameters)
|
|
436
|
+
.filter(([, v]) => v !== undefined && v !== null)
|
|
437
|
+
.map(
|
|
438
|
+
([k, v]) => \`\${encodeURIComponent(k)}=\${encodeURIComponent(String(v))}\`,
|
|
439
|
+
);
|
|
440
|
+
if (cookiePairs.length > 0) {
|
|
441
|
+
headerParameters['Cookie'] = cookiePairs.join('; ');
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const body = undefined;
|
|
445
|
+
|
|
446
|
+
const response = await this.$fetch(
|
|
447
|
+
this.$url('/secret', pathParameters, queryParameters),
|
|
448
|
+
{
|
|
449
|
+
headers: this.$headers(headerParameters),
|
|
450
|
+
method: 'GET',
|
|
451
|
+
body,
|
|
452
|
+
},
|
|
453
|
+
);
|
|
454
|
+
|
|
455
|
+
if (response.status === 200) {
|
|
456
|
+
return await response.text();
|
|
457
|
+
}
|
|
458
|
+
throw new Error(
|
|
459
|
+
\`Unknown response status \${response.status} returned by API\`,
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
"
|
|
464
|
+
`;
|
|
465
|
+
|
|
466
|
+
exports[`openApiTsClientGenerator - content type header > should serialise cookie parameters into a Cookie request header > types.gen.ts 1`] = `
|
|
467
|
+
"export type GetSecretRequestCookieParameters = {
|
|
468
|
+
session?: string;
|
|
469
|
+
preference?: string;
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
export type GetSecretRequest = GetSecretRequestCookieParameters;
|
|
473
|
+
export type GetSecretError = never;
|
|
474
|
+
"
|
|
475
|
+
`;
|