@aws/nx-plugin 1.0.0-rc.30 → 1.0.0-rc.32

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.
Files changed (59) hide show
  1. package/LICENSE-THIRD-PARTY +235 -1336
  2. package/README.md +1 -1
  3. package/package.json +1 -2
  4. package/src/mcp-server/tools/create-workspace-command.js +2 -2
  5. package/src/mcp-server/tools/create-workspace-command.js.map +1 -1
  6. package/src/open-api/ts-client/__snapshots__/generator.additional-properties.spec.ts.snap +147 -33
  7. package/src/open-api/ts-client/__snapshots__/generator.arrays.spec.ts.snap +308 -75
  8. package/src/open-api/ts-client/__snapshots__/generator.complex-types.spec.ts.snap +286 -62
  9. package/src/open-api/ts-client/__snapshots__/generator.composite-types.spec.ts.snap +674 -93
  10. package/src/open-api/ts-client/__snapshots__/generator.content-type.spec.ts.snap +211 -36
  11. package/src/open-api/ts-client/__snapshots__/generator.duplicate-types.spec.ts.snap +196 -44
  12. package/src/open-api/ts-client/__snapshots__/generator.edge-cases.spec.ts.snap +5507 -0
  13. package/src/open-api/ts-client/__snapshots__/generator.fast-api.spec.ts.snap +219 -60
  14. package/src/open-api/ts-client/__snapshots__/generator.multipart.spec.ts.snap +280 -0
  15. package/src/open-api/ts-client/__snapshots__/generator.primitive-types.spec.ts.snap +351 -80
  16. package/src/open-api/ts-client/__snapshots__/generator.request.spec.ts.snap +170 -49
  17. package/src/open-api/ts-client/__snapshots__/generator.reserved-keywords.spec.ts.snap +98 -22
  18. package/src/open-api/ts-client/__snapshots__/generator.response.spec.ts.snap +147 -33
  19. package/src/open-api/ts-client/__snapshots__/generator.streaming.spec.ts.snap +392 -88
  20. package/src/open-api/ts-client/__snapshots__/generator.tags.spec.ts.snap +196 -44
  21. package/src/open-api/ts-client/files/client.gen.ts.template +166 -19
  22. package/src/open-api/ts-client/files/types.gen.ts.template +4 -4
  23. package/src/open-api/ts-client/generator.js +1 -1
  24. package/src/open-api/ts-client/generator.js.map +1 -1
  25. package/src/open-api/ts-hooks/files/options-proxy.gen.ts.template +5 -0
  26. package/src/open-api/ts-hooks/generator.spec.tsx +70 -0
  27. package/src/open-api/utils/codegen-data/languages.d.ts +0 -6
  28. package/src/open-api/utils/codegen-data/languages.js +23 -18
  29. package/src/open-api/utils/codegen-data/languages.js.map +1 -1
  30. package/src/open-api/utils/codegen-data/types.d.ts +240 -10
  31. package/src/open-api/utils/codegen-data/types.js +24 -1
  32. package/src/open-api/utils/codegen-data/types.js.map +1 -1
  33. package/src/open-api/utils/codegen-data.d.ts +2 -2
  34. package/src/open-api/utils/codegen-data.js +357 -617
  35. package/src/open-api/utils/codegen-data.js.map +1 -1
  36. package/src/open-api/utils/normalise.js +167 -22
  37. package/src/open-api/utils/normalise.js.map +1 -1
  38. package/src/open-api/utils/parser.d.ts +55 -0
  39. package/src/open-api/utils/parser.js +754 -0
  40. package/src/open-api/utils/parser.js.map +1 -0
  41. package/src/open-api/utils/types.d.ts +18 -0
  42. package/src/open-api/utils/types.js.map +1 -1
  43. package/src/preset/__snapshots__/generator.spec.ts.snap +6 -6
  44. package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +414 -6
  45. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +276 -4
  46. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +414 -6
  47. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +0 -23
  48. package/src/ts/mcp-server/generator.js +10 -22
  49. package/src/ts/mcp-server/generator.js.map +1 -1
  50. package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +69 -1
  51. package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +69 -1
  52. package/src/utils/mcp.js +1 -1
  53. package/src/utils/mcp.js.map +1 -1
  54. package/src/utils/names.d.ts +6 -0
  55. package/src/utils/names.js +6 -1
  56. package/src/utils/names.js.map +1 -1
  57. package/src/utils/versions.d.ts +5 -5
  58. package/src/utils/versions.js +4 -4
  59. package/src/utils/versions.js.map +1 -1
@@ -24,7 +24,7 @@ exports[`openApiTsClientGenerator - streaming > OpenAPI 3.2 JSONL streaming (app
24
24
  * Utility for serialisation and deserialisation of API types.
25
25
  */
26
26
  export class $IO {
27
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
27
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
28
28
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
29
29
 
30
30
  public static StreamChunk = {
@@ -112,11 +112,31 @@ export class TestApi {
112
112
  this.streamData = this.streamData.bind(this);
113
113
  }
114
114
 
115
+ private $collectionDelimiters: { [format: string]: string } = {
116
+ csv: ',',
117
+ ssv: ' ',
118
+ pipes: '|',
119
+ };
120
+
121
+ private $deepObject = (key: string, value: any): string[] => {
122
+ if (value === undefined || value === null) {
123
+ return [];
124
+ }
125
+ if (typeof value !== 'object') {
126
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
127
+ }
128
+ return Object.entries(value).flatMap(([prop, v]) =>
129
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
130
+ );
131
+ };
132
+
115
133
  private $url = (
116
134
  path: string,
117
135
  pathParameters: { [key: string]: any },
118
136
  queryParameters: { [key: string]: any },
119
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
137
+ collectionFormats?: {
138
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
139
+ },
120
140
  ): string => {
121
141
  const baseUrl = this.$config.url.endsWith('/')
122
142
  ? this.$config.url.slice(0, -1)
@@ -127,15 +147,24 @@ export class TestApi {
127
147
  path,
128
148
  );
129
149
  const queryString = Object.entries(queryParameters)
130
- .map(([key, value]) => {
150
+ .flatMap(([key, value]) => {
131
151
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
132
- return value
133
- .map(
134
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
135
- )
136
- .join('&');
152
+ return value.map(
153
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
154
+ );
155
+ }
156
+ if (
157
+ collectionFormats?.[key] === 'deepObject' &&
158
+ value !== null &&
159
+ typeof value === 'object'
160
+ ) {
161
+ return this.$deepObject(encodeURIComponent(key), value);
137
162
  }
138
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
163
+ const delimiter =
164
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
165
+ return [
166
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
167
+ ];
139
168
  })
140
169
  .join('&');
141
170
  return (
@@ -145,13 +174,22 @@ export class TestApi {
145
174
 
146
175
  private $headers = (
147
176
  headerParameters: { [key: string]: any },
148
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
177
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
149
178
  ): [string, string][] => {
150
179
  return Object.entries(headerParameters).flatMap(([key, value]) => {
151
180
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
152
181
  return value.map((v) => [key, String(v)]) as [string, string][];
153
182
  }
154
- return [[key, String(value)]];
183
+ const delimiter =
184
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
185
+ return [
186
+ [
187
+ key,
188
+ Array.isArray(value)
189
+ ? value.map(String).join(delimiter)
190
+ : String(value),
191
+ ],
192
+ ];
155
193
  });
156
194
  };
157
195
 
@@ -224,7 +262,7 @@ exports[`openApiTsClientGenerator - streaming > OpenAPI 3.2 JSONL streaming (app
224
262
  * Utility for serialisation and deserialisation of API types.
225
263
  */
226
264
  export class $IO {
227
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
265
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
228
266
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
229
267
 
230
268
  public static Event = {
@@ -305,11 +343,31 @@ export class TestApi {
305
343
  this.getEvents = this.getEvents.bind(this);
306
344
  }
307
345
 
346
+ private $collectionDelimiters: { [format: string]: string } = {
347
+ csv: ',',
348
+ ssv: ' ',
349
+ pipes: '|',
350
+ };
351
+
352
+ private $deepObject = (key: string, value: any): string[] => {
353
+ if (value === undefined || value === null) {
354
+ return [];
355
+ }
356
+ if (typeof value !== 'object') {
357
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
358
+ }
359
+ return Object.entries(value).flatMap(([prop, v]) =>
360
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
361
+ );
362
+ };
363
+
308
364
  private $url = (
309
365
  path: string,
310
366
  pathParameters: { [key: string]: any },
311
367
  queryParameters: { [key: string]: any },
312
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
368
+ collectionFormats?: {
369
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
370
+ },
313
371
  ): string => {
314
372
  const baseUrl = this.$config.url.endsWith('/')
315
373
  ? this.$config.url.slice(0, -1)
@@ -320,15 +378,24 @@ export class TestApi {
320
378
  path,
321
379
  );
322
380
  const queryString = Object.entries(queryParameters)
323
- .map(([key, value]) => {
381
+ .flatMap(([key, value]) => {
324
382
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
325
- return value
326
- .map(
327
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
328
- )
329
- .join('&');
383
+ return value.map(
384
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
385
+ );
386
+ }
387
+ if (
388
+ collectionFormats?.[key] === 'deepObject' &&
389
+ value !== null &&
390
+ typeof value === 'object'
391
+ ) {
392
+ return this.$deepObject(encodeURIComponent(key), value);
330
393
  }
331
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
394
+ const delimiter =
395
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
396
+ return [
397
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
398
+ ];
332
399
  })
333
400
  .join('&');
334
401
  return (
@@ -338,13 +405,22 @@ export class TestApi {
338
405
 
339
406
  private $headers = (
340
407
  headerParameters: { [key: string]: any },
341
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
408
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
342
409
  ): [string, string][] => {
343
410
  return Object.entries(headerParameters).flatMap(([key, value]) => {
344
411
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
345
412
  return value.map((v) => [key, String(v)]) as [string, string][];
346
413
  }
347
- return [[key, String(value)]];
414
+ const delimiter =
415
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
416
+ return [
417
+ [
418
+ key,
419
+ Array.isArray(value)
420
+ ? value.map(String).join(delimiter)
421
+ : String(value),
422
+ ],
423
+ ];
348
424
  });
349
425
  };
350
426
 
@@ -432,7 +508,7 @@ exports[`openApiTsClientGenerator - streaming > should handle error responses fo
432
508
  * Utility for serialisation and deserialisation of API types.
433
509
  */
434
510
  export class $IO {
435
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
511
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
436
512
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
437
513
 
438
514
  public static GetStream400Response = {
@@ -536,11 +612,31 @@ export class TestApi {
536
612
  this.getStream = this.getStream.bind(this);
537
613
  }
538
614
 
615
+ private $collectionDelimiters: { [format: string]: string } = {
616
+ csv: ',',
617
+ ssv: ' ',
618
+ pipes: '|',
619
+ };
620
+
621
+ private $deepObject = (key: string, value: any): string[] => {
622
+ if (value === undefined || value === null) {
623
+ return [];
624
+ }
625
+ if (typeof value !== 'object') {
626
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
627
+ }
628
+ return Object.entries(value).flatMap(([prop, v]) =>
629
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
630
+ );
631
+ };
632
+
539
633
  private $url = (
540
634
  path: string,
541
635
  pathParameters: { [key: string]: any },
542
636
  queryParameters: { [key: string]: any },
543
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
637
+ collectionFormats?: {
638
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
639
+ },
544
640
  ): string => {
545
641
  const baseUrl = this.$config.url.endsWith('/')
546
642
  ? this.$config.url.slice(0, -1)
@@ -551,15 +647,24 @@ export class TestApi {
551
647
  path,
552
648
  );
553
649
  const queryString = Object.entries(queryParameters)
554
- .map(([key, value]) => {
650
+ .flatMap(([key, value]) => {
555
651
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
556
- return value
557
- .map(
558
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
559
- )
560
- .join('&');
652
+ return value.map(
653
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
654
+ );
655
+ }
656
+ if (
657
+ collectionFormats?.[key] === 'deepObject' &&
658
+ value !== null &&
659
+ typeof value === 'object'
660
+ ) {
661
+ return this.$deepObject(encodeURIComponent(key), value);
561
662
  }
562
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
663
+ const delimiter =
664
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
665
+ return [
666
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
667
+ ];
563
668
  })
564
669
  .join('&');
565
670
  return (
@@ -569,13 +674,22 @@ export class TestApi {
569
674
 
570
675
  private $headers = (
571
676
  headerParameters: { [key: string]: any },
572
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
677
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
573
678
  ): [string, string][] => {
574
679
  return Object.entries(headerParameters).flatMap(([key, value]) => {
575
680
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
576
681
  return value.map((v) => [key, String(v)]) as [string, string][];
577
682
  }
578
- return [[key, String(value)]];
683
+ const delimiter =
684
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
685
+ return [
686
+ [
687
+ key,
688
+ Array.isArray(value)
689
+ ? value.map(String).join(delimiter)
690
+ : String(value),
691
+ ],
692
+ ];
579
693
  });
580
694
  };
581
695
 
@@ -649,7 +763,7 @@ exports[`openApiTsClientGenerator - streaming > should return an iterator over a
649
763
  * Utility for serialisation and deserialisation of API types.
650
764
  */
651
765
  export class $IO {
652
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
766
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
653
767
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
654
768
 
655
769
  public static GetObjectArrays200ResponseItem = {
@@ -724,11 +838,31 @@ export class TestApi {
724
838
  this.getStringArrays = this.getStringArrays.bind(this);
725
839
  }
726
840
 
841
+ private $collectionDelimiters: { [format: string]: string } = {
842
+ csv: ',',
843
+ ssv: ' ',
844
+ pipes: '|',
845
+ };
846
+
847
+ private $deepObject = (key: string, value: any): string[] => {
848
+ if (value === undefined || value === null) {
849
+ return [];
850
+ }
851
+ if (typeof value !== 'object') {
852
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
853
+ }
854
+ return Object.entries(value).flatMap(([prop, v]) =>
855
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
856
+ );
857
+ };
858
+
727
859
  private $url = (
728
860
  path: string,
729
861
  pathParameters: { [key: string]: any },
730
862
  queryParameters: { [key: string]: any },
731
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
863
+ collectionFormats?: {
864
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
865
+ },
732
866
  ): string => {
733
867
  const baseUrl = this.$config.url.endsWith('/')
734
868
  ? this.$config.url.slice(0, -1)
@@ -739,15 +873,24 @@ export class TestApi {
739
873
  path,
740
874
  );
741
875
  const queryString = Object.entries(queryParameters)
742
- .map(([key, value]) => {
876
+ .flatMap(([key, value]) => {
743
877
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
744
- return value
745
- .map(
746
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
747
- )
748
- .join('&');
878
+ return value.map(
879
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
880
+ );
881
+ }
882
+ if (
883
+ collectionFormats?.[key] === 'deepObject' &&
884
+ value !== null &&
885
+ typeof value === 'object'
886
+ ) {
887
+ return this.$deepObject(encodeURIComponent(key), value);
749
888
  }
750
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
889
+ const delimiter =
890
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
891
+ return [
892
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
893
+ ];
751
894
  })
752
895
  .join('&');
753
896
  return (
@@ -757,13 +900,22 @@ export class TestApi {
757
900
 
758
901
  private $headers = (
759
902
  headerParameters: { [key: string]: any },
760
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
903
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
761
904
  ): [string, string][] => {
762
905
  return Object.entries(headerParameters).flatMap(([key, value]) => {
763
906
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
764
907
  return value.map((v) => [key, String(v)]) as [string, string][];
765
908
  }
766
- return [[key, String(value)]];
909
+ const delimiter =
910
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
911
+ return [
912
+ [
913
+ key,
914
+ Array.isArray(value)
915
+ ? value.map(String).join(delimiter)
916
+ : String(value),
917
+ ],
918
+ ];
767
919
  });
768
920
  };
769
921
 
@@ -1000,7 +1152,7 @@ exports[`openApiTsClientGenerator - streaming > should return an iterator over a
1000
1152
  * Utility for serialisation and deserialisation of API types.
1001
1153
  */
1002
1154
  export class $IO {
1003
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
1155
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
1004
1156
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
1005
1157
 
1006
1158
  public static GetArrayDict200Response = {
@@ -1270,11 +1422,31 @@ export class TestApi {
1270
1422
  this.getStringDict = this.getStringDict.bind(this);
1271
1423
  }
1272
1424
 
1425
+ private $collectionDelimiters: { [format: string]: string } = {
1426
+ csv: ',',
1427
+ ssv: ' ',
1428
+ pipes: '|',
1429
+ };
1430
+
1431
+ private $deepObject = (key: string, value: any): string[] => {
1432
+ if (value === undefined || value === null) {
1433
+ return [];
1434
+ }
1435
+ if (typeof value !== 'object') {
1436
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
1437
+ }
1438
+ return Object.entries(value).flatMap(([prop, v]) =>
1439
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
1440
+ );
1441
+ };
1442
+
1273
1443
  private $url = (
1274
1444
  path: string,
1275
1445
  pathParameters: { [key: string]: any },
1276
1446
  queryParameters: { [key: string]: any },
1277
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
1447
+ collectionFormats?: {
1448
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
1449
+ },
1278
1450
  ): string => {
1279
1451
  const baseUrl = this.$config.url.endsWith('/')
1280
1452
  ? this.$config.url.slice(0, -1)
@@ -1285,15 +1457,24 @@ export class TestApi {
1285
1457
  path,
1286
1458
  );
1287
1459
  const queryString = Object.entries(queryParameters)
1288
- .map(([key, value]) => {
1460
+ .flatMap(([key, value]) => {
1289
1461
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
1290
- return value
1291
- .map(
1292
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
1293
- )
1294
- .join('&');
1462
+ return value.map(
1463
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
1464
+ );
1465
+ }
1466
+ if (
1467
+ collectionFormats?.[key] === 'deepObject' &&
1468
+ value !== null &&
1469
+ typeof value === 'object'
1470
+ ) {
1471
+ return this.$deepObject(encodeURIComponent(key), value);
1295
1472
  }
1296
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
1473
+ const delimiter =
1474
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
1475
+ return [
1476
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
1477
+ ];
1297
1478
  })
1298
1479
  .join('&');
1299
1480
  return (
@@ -1303,13 +1484,22 @@ export class TestApi {
1303
1484
 
1304
1485
  private $headers = (
1305
1486
  headerParameters: { [key: string]: any },
1306
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
1487
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
1307
1488
  ): [string, string][] => {
1308
1489
  return Object.entries(headerParameters).flatMap(([key, value]) => {
1309
1490
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
1310
1491
  return value.map((v) => [key, String(v)]) as [string, string][];
1311
1492
  }
1312
- return [[key, String(value)]];
1493
+ const delimiter =
1494
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
1495
+ return [
1496
+ [
1497
+ key,
1498
+ Array.isArray(value)
1499
+ ? value.map(String).join(delimiter)
1500
+ : String(value),
1501
+ ],
1502
+ ];
1313
1503
  });
1314
1504
  };
1315
1505
 
@@ -1587,7 +1777,7 @@ exports[`openApiTsClientGenerator - streaming > should return an iterator over a
1587
1777
  * Utility for serialisation and deserialisation of API types.
1588
1778
  */
1589
1779
  export class $IO {
1590
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
1780
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
1591
1781
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
1592
1782
  }
1593
1783
 
@@ -1631,11 +1821,31 @@ export class TestApi {
1631
1821
  this.getNumbers = this.getNumbers.bind(this);
1632
1822
  }
1633
1823
 
1824
+ private $collectionDelimiters: { [format: string]: string } = {
1825
+ csv: ',',
1826
+ ssv: ' ',
1827
+ pipes: '|',
1828
+ };
1829
+
1830
+ private $deepObject = (key: string, value: any): string[] => {
1831
+ if (value === undefined || value === null) {
1832
+ return [];
1833
+ }
1834
+ if (typeof value !== 'object') {
1835
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
1836
+ }
1837
+ return Object.entries(value).flatMap(([prop, v]) =>
1838
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
1839
+ );
1840
+ };
1841
+
1634
1842
  private $url = (
1635
1843
  path: string,
1636
1844
  pathParameters: { [key: string]: any },
1637
1845
  queryParameters: { [key: string]: any },
1638
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
1846
+ collectionFormats?: {
1847
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
1848
+ },
1639
1849
  ): string => {
1640
1850
  const baseUrl = this.$config.url.endsWith('/')
1641
1851
  ? this.$config.url.slice(0, -1)
@@ -1646,15 +1856,24 @@ export class TestApi {
1646
1856
  path,
1647
1857
  );
1648
1858
  const queryString = Object.entries(queryParameters)
1649
- .map(([key, value]) => {
1859
+ .flatMap(([key, value]) => {
1650
1860
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
1651
- return value
1652
- .map(
1653
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
1654
- )
1655
- .join('&');
1861
+ return value.map(
1862
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
1863
+ );
1864
+ }
1865
+ if (
1866
+ collectionFormats?.[key] === 'deepObject' &&
1867
+ value !== null &&
1868
+ typeof value === 'object'
1869
+ ) {
1870
+ return this.$deepObject(encodeURIComponent(key), value);
1656
1871
  }
1657
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
1872
+ const delimiter =
1873
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
1874
+ return [
1875
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
1876
+ ];
1658
1877
  })
1659
1878
  .join('&');
1660
1879
  return (
@@ -1664,13 +1883,22 @@ export class TestApi {
1664
1883
 
1665
1884
  private $headers = (
1666
1885
  headerParameters: { [key: string]: any },
1667
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
1886
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
1668
1887
  ): [string, string][] => {
1669
1888
  return Object.entries(headerParameters).flatMap(([key, value]) => {
1670
1889
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
1671
1890
  return value.map((v) => [key, String(v)]) as [string, string][];
1672
1891
  }
1673
- return [[key, String(value)]];
1892
+ const delimiter =
1893
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
1894
+ return [
1895
+ [
1896
+ key,
1897
+ Array.isArray(value)
1898
+ ? value.map(String).join(delimiter)
1899
+ : String(value),
1900
+ ],
1901
+ ];
1674
1902
  });
1675
1903
  };
1676
1904
 
@@ -1792,7 +2020,7 @@ exports[`openApiTsClientGenerator - streaming > should return an iterator over a
1792
2020
  * Utility for serialisation and deserialisation of API types.
1793
2021
  */
1794
2022
  export class $IO {
1795
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
2023
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
1796
2024
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
1797
2025
 
1798
2026
  public static GetTest200Response = {
@@ -1863,11 +2091,31 @@ export class TestApi {
1863
2091
  this.getTest = this.getTest.bind(this);
1864
2092
  }
1865
2093
 
2094
+ private $collectionDelimiters: { [format: string]: string } = {
2095
+ csv: ',',
2096
+ ssv: ' ',
2097
+ pipes: '|',
2098
+ };
2099
+
2100
+ private $deepObject = (key: string, value: any): string[] => {
2101
+ if (value === undefined || value === null) {
2102
+ return [];
2103
+ }
2104
+ if (typeof value !== 'object') {
2105
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
2106
+ }
2107
+ return Object.entries(value).flatMap(([prop, v]) =>
2108
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
2109
+ );
2110
+ };
2111
+
1866
2112
  private $url = (
1867
2113
  path: string,
1868
2114
  pathParameters: { [key: string]: any },
1869
2115
  queryParameters: { [key: string]: any },
1870
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
2116
+ collectionFormats?: {
2117
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
2118
+ },
1871
2119
  ): string => {
1872
2120
  const baseUrl = this.$config.url.endsWith('/')
1873
2121
  ? this.$config.url.slice(0, -1)
@@ -1878,15 +2126,24 @@ export class TestApi {
1878
2126
  path,
1879
2127
  );
1880
2128
  const queryString = Object.entries(queryParameters)
1881
- .map(([key, value]) => {
2129
+ .flatMap(([key, value]) => {
1882
2130
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
1883
- return value
1884
- .map(
1885
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
1886
- )
1887
- .join('&');
2131
+ return value.map(
2132
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
2133
+ );
2134
+ }
2135
+ if (
2136
+ collectionFormats?.[key] === 'deepObject' &&
2137
+ value !== null &&
2138
+ typeof value === 'object'
2139
+ ) {
2140
+ return this.$deepObject(encodeURIComponent(key), value);
1888
2141
  }
1889
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
2142
+ const delimiter =
2143
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
2144
+ return [
2145
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
2146
+ ];
1890
2147
  })
1891
2148
  .join('&');
1892
2149
  return (
@@ -1896,13 +2153,22 @@ export class TestApi {
1896
2153
 
1897
2154
  private $headers = (
1898
2155
  headerParameters: { [key: string]: any },
1899
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
2156
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
1900
2157
  ): [string, string][] => {
1901
2158
  return Object.entries(headerParameters).flatMap(([key, value]) => {
1902
2159
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
1903
2160
  return value.map((v) => [key, String(v)]) as [string, string][];
1904
2161
  }
1905
- return [[key, String(value)]];
2162
+ const delimiter =
2163
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
2164
+ return [
2165
+ [
2166
+ key,
2167
+ Array.isArray(value)
2168
+ ? value.map(String).join(delimiter)
2169
+ : String(value),
2170
+ ],
2171
+ ];
1906
2172
  });
1907
2173
  };
1908
2174
 
@@ -1954,7 +2220,7 @@ exports[`openApiTsClientGenerator - streaming > should return an iterator over a
1954
2220
  * Utility for serialisation and deserialisation of API types.
1955
2221
  */
1956
2222
  export class $IO {
1957
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
2223
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
1958
2224
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
1959
2225
  }
1960
2226
 
@@ -1996,11 +2262,31 @@ export class TestApi {
1996
2262
  this.getTest = this.getTest.bind(this);
1997
2263
  }
1998
2264
 
2265
+ private $collectionDelimiters: { [format: string]: string } = {
2266
+ csv: ',',
2267
+ ssv: ' ',
2268
+ pipes: '|',
2269
+ };
2270
+
2271
+ private $deepObject = (key: string, value: any): string[] => {
2272
+ if (value === undefined || value === null) {
2273
+ return [];
2274
+ }
2275
+ if (typeof value !== 'object') {
2276
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
2277
+ }
2278
+ return Object.entries(value).flatMap(([prop, v]) =>
2279
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
2280
+ );
2281
+ };
2282
+
1999
2283
  private $url = (
2000
2284
  path: string,
2001
2285
  pathParameters: { [key: string]: any },
2002
2286
  queryParameters: { [key: string]: any },
2003
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
2287
+ collectionFormats?: {
2288
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
2289
+ },
2004
2290
  ): string => {
2005
2291
  const baseUrl = this.$config.url.endsWith('/')
2006
2292
  ? this.$config.url.slice(0, -1)
@@ -2011,15 +2297,24 @@ export class TestApi {
2011
2297
  path,
2012
2298
  );
2013
2299
  const queryString = Object.entries(queryParameters)
2014
- .map(([key, value]) => {
2300
+ .flatMap(([key, value]) => {
2015
2301
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
2016
- return value
2017
- .map(
2018
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
2019
- )
2020
- .join('&');
2302
+ return value.map(
2303
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
2304
+ );
2305
+ }
2306
+ if (
2307
+ collectionFormats?.[key] === 'deepObject' &&
2308
+ value !== null &&
2309
+ typeof value === 'object'
2310
+ ) {
2311
+ return this.$deepObject(encodeURIComponent(key), value);
2021
2312
  }
2022
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
2313
+ const delimiter =
2314
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
2315
+ return [
2316
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
2317
+ ];
2023
2318
  })
2024
2319
  .join('&');
2025
2320
  return (
@@ -2029,13 +2324,22 @@ export class TestApi {
2029
2324
 
2030
2325
  private $headers = (
2031
2326
  headerParameters: { [key: string]: any },
2032
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
2327
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
2033
2328
  ): [string, string][] => {
2034
2329
  return Object.entries(headerParameters).flatMap(([key, value]) => {
2035
2330
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
2036
2331
  return value.map((v) => [key, String(v)]) as [string, string][];
2037
2332
  }
2038
- return [[key, String(value)]];
2333
+ const delimiter =
2334
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
2335
+ return [
2336
+ [
2337
+ key,
2338
+ Array.isArray(value)
2339
+ ? value.map(String).join(delimiter)
2340
+ : String(value),
2341
+ ],
2342
+ ];
2039
2343
  });
2040
2344
  };
2041
2345