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

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 (47) 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 +147 -33
  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.primitive-types.spec.ts.snap +351 -80
  15. package/src/open-api/ts-client/__snapshots__/generator.request.spec.ts.snap +170 -49
  16. package/src/open-api/ts-client/__snapshots__/generator.reserved-keywords.spec.ts.snap +98 -22
  17. package/src/open-api/ts-client/__snapshots__/generator.response.spec.ts.snap +147 -33
  18. package/src/open-api/ts-client/__snapshots__/generator.streaming.spec.ts.snap +392 -88
  19. package/src/open-api/ts-client/__snapshots__/generator.tags.spec.ts.snap +196 -44
  20. package/src/open-api/ts-client/files/client.gen.ts.template +130 -18
  21. package/src/open-api/ts-client/files/types.gen.ts.template +4 -4
  22. package/src/open-api/ts-client/generator.js +1 -1
  23. package/src/open-api/ts-client/generator.js.map +1 -1
  24. package/src/open-api/ts-hooks/files/options-proxy.gen.ts.template +5 -0
  25. package/src/open-api/ts-hooks/generator.spec.tsx +70 -0
  26. package/src/open-api/utils/codegen-data/languages.d.ts +0 -6
  27. package/src/open-api/utils/codegen-data/languages.js +23 -18
  28. package/src/open-api/utils/codegen-data/languages.js.map +1 -1
  29. package/src/open-api/utils/codegen-data/types.d.ts +240 -10
  30. package/src/open-api/utils/codegen-data/types.js +24 -1
  31. package/src/open-api/utils/codegen-data/types.js.map +1 -1
  32. package/src/open-api/utils/codegen-data.d.ts +2 -2
  33. package/src/open-api/utils/codegen-data.js +357 -617
  34. package/src/open-api/utils/codegen-data.js.map +1 -1
  35. package/src/open-api/utils/normalise.js +157 -19
  36. package/src/open-api/utils/normalise.js.map +1 -1
  37. package/src/open-api/utils/parser.d.ts +55 -0
  38. package/src/open-api/utils/parser.js +743 -0
  39. package/src/open-api/utils/parser.js.map +1 -0
  40. package/src/open-api/utils/types.d.ts +15 -0
  41. package/src/open-api/utils/types.js.map +1 -1
  42. package/src/preset/__snapshots__/generator.spec.ts.snap +6 -6
  43. package/src/utils/mcp.js +1 -1
  44. package/src/utils/mcp.js.map +1 -1
  45. package/src/utils/names.d.ts +6 -0
  46. package/src/utils/names.js +6 -1
  47. package/src/utils/names.js.map +1 -1
@@ -20,7 +20,7 @@ exports[`openApiTsClientGenerator - primitive types > should generate valid Type
20
20
  * Utility for serialisation and deserialisation of API types.
21
21
  */
22
22
  export class $IO {
23
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
23
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
24
24
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
25
25
 
26
26
  public static GetTest200Response = {
@@ -126,11 +126,31 @@ export class TestApi {
126
126
  this.getTest = this.getTest.bind(this);
127
127
  }
128
128
 
129
+ private $collectionDelimiters: { [format: string]: string } = {
130
+ csv: ',',
131
+ ssv: ' ',
132
+ pipes: '|',
133
+ };
134
+
135
+ private $deepObject = (key: string, value: any): string[] => {
136
+ if (value === undefined || value === null) {
137
+ return [];
138
+ }
139
+ if (typeof value !== 'object') {
140
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
141
+ }
142
+ return Object.entries(value).flatMap(([prop, v]) =>
143
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
144
+ );
145
+ };
146
+
129
147
  private $url = (
130
148
  path: string,
131
149
  pathParameters: { [key: string]: any },
132
150
  queryParameters: { [key: string]: any },
133
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
151
+ collectionFormats?: {
152
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
153
+ },
134
154
  ): string => {
135
155
  const baseUrl = this.$config.url.endsWith('/')
136
156
  ? this.$config.url.slice(0, -1)
@@ -141,15 +161,24 @@ export class TestApi {
141
161
  path,
142
162
  );
143
163
  const queryString = Object.entries(queryParameters)
144
- .map(([key, value]) => {
164
+ .flatMap(([key, value]) => {
145
165
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
146
- return value
147
- .map(
148
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
149
- )
150
- .join('&');
166
+ return value.map(
167
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
168
+ );
151
169
  }
152
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
170
+ if (
171
+ collectionFormats?.[key] === 'deepObject' &&
172
+ value !== null &&
173
+ typeof value === 'object'
174
+ ) {
175
+ return this.$deepObject(encodeURIComponent(key), value);
176
+ }
177
+ const delimiter =
178
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
179
+ return [
180
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
181
+ ];
153
182
  })
154
183
  .join('&');
155
184
  return (
@@ -159,13 +188,22 @@ export class TestApi {
159
188
 
160
189
  private $headers = (
161
190
  headerParameters: { [key: string]: any },
162
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
191
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
163
192
  ): [string, string][] => {
164
193
  return Object.entries(headerParameters).flatMap(([key, value]) => {
165
194
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
166
195
  return value.map((v) => [key, String(v)]) as [string, string][];
167
196
  }
168
- return [[key, String(value)]];
197
+ const delimiter =
198
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
199
+ return [
200
+ [
201
+ key,
202
+ Array.isArray(value)
203
+ ? value.map(String).join(delimiter)
204
+ : String(value),
205
+ ],
206
+ ];
169
207
  });
170
208
  };
171
209
 
@@ -231,7 +269,7 @@ exports[`openApiTsClientGenerator - primitive types > should generate valid type
231
269
  * Utility for serialisation and deserialisation of API types.
232
270
  */
233
271
  export class $IO {
234
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
272
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
235
273
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
236
274
 
237
275
  public static PostTest200Response = {
@@ -397,11 +435,31 @@ export class TestApi {
397
435
  this.postTest = this.postTest.bind(this);
398
436
  }
399
437
 
438
+ private $collectionDelimiters: { [format: string]: string } = {
439
+ csv: ',',
440
+ ssv: ' ',
441
+ pipes: '|',
442
+ };
443
+
444
+ private $deepObject = (key: string, value: any): string[] => {
445
+ if (value === undefined || value === null) {
446
+ return [];
447
+ }
448
+ if (typeof value !== 'object') {
449
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
450
+ }
451
+ return Object.entries(value).flatMap(([prop, v]) =>
452
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
453
+ );
454
+ };
455
+
400
456
  private $url = (
401
457
  path: string,
402
458
  pathParameters: { [key: string]: any },
403
459
  queryParameters: { [key: string]: any },
404
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
460
+ collectionFormats?: {
461
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
462
+ },
405
463
  ): string => {
406
464
  const baseUrl = this.$config.url.endsWith('/')
407
465
  ? this.$config.url.slice(0, -1)
@@ -412,15 +470,24 @@ export class TestApi {
412
470
  path,
413
471
  );
414
472
  const queryString = Object.entries(queryParameters)
415
- .map(([key, value]) => {
473
+ .flatMap(([key, value]) => {
416
474
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
417
- return value
418
- .map(
419
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
420
- )
421
- .join('&');
475
+ return value.map(
476
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
477
+ );
478
+ }
479
+ if (
480
+ collectionFormats?.[key] === 'deepObject' &&
481
+ value !== null &&
482
+ typeof value === 'object'
483
+ ) {
484
+ return this.$deepObject(encodeURIComponent(key), value);
422
485
  }
423
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
486
+ const delimiter =
487
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
488
+ return [
489
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
490
+ ];
424
491
  })
425
492
  .join('&');
426
493
  return (
@@ -430,13 +497,22 @@ export class TestApi {
430
497
 
431
498
  private $headers = (
432
499
  headerParameters: { [key: string]: any },
433
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
500
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
434
501
  ): [string, string][] => {
435
502
  return Object.entries(headerParameters).flatMap(([key, value]) => {
436
503
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
437
504
  return value.map((v) => [key, String(v)]) as [string, string][];
438
505
  }
439
- return [[key, String(value)]];
506
+ const delimiter =
507
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
508
+ return [
509
+ [
510
+ key,
511
+ Array.isArray(value)
512
+ ? value.map(String).join(delimiter)
513
+ : String(value),
514
+ ],
515
+ ];
440
516
  });
441
517
  };
442
518
 
@@ -507,7 +583,7 @@ exports[`openApiTsClientGenerator - primitive types > should handle date and dat
507
583
  * Utility for serialisation and deserialisation of API types.
508
584
  */
509
585
  export class $IO {
510
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
586
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
511
587
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
512
588
 
513
589
  public static PostDates200Response = {
@@ -644,11 +720,31 @@ export class TestApi {
644
720
  this.postSingleDate = this.postSingleDate.bind(this);
645
721
  }
646
722
 
723
+ private $collectionDelimiters: { [format: string]: string } = {
724
+ csv: ',',
725
+ ssv: ' ',
726
+ pipes: '|',
727
+ };
728
+
729
+ private $deepObject = (key: string, value: any): string[] => {
730
+ if (value === undefined || value === null) {
731
+ return [];
732
+ }
733
+ if (typeof value !== 'object') {
734
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
735
+ }
736
+ return Object.entries(value).flatMap(([prop, v]) =>
737
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
738
+ );
739
+ };
740
+
647
741
  private $url = (
648
742
  path: string,
649
743
  pathParameters: { [key: string]: any },
650
744
  queryParameters: { [key: string]: any },
651
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
745
+ collectionFormats?: {
746
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
747
+ },
652
748
  ): string => {
653
749
  const baseUrl = this.$config.url.endsWith('/')
654
750
  ? this.$config.url.slice(0, -1)
@@ -659,15 +755,24 @@ export class TestApi {
659
755
  path,
660
756
  );
661
757
  const queryString = Object.entries(queryParameters)
662
- .map(([key, value]) => {
758
+ .flatMap(([key, value]) => {
663
759
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
664
- return value
665
- .map(
666
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
667
- )
668
- .join('&');
760
+ return value.map(
761
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
762
+ );
669
763
  }
670
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
764
+ if (
765
+ collectionFormats?.[key] === 'deepObject' &&
766
+ value !== null &&
767
+ typeof value === 'object'
768
+ ) {
769
+ return this.$deepObject(encodeURIComponent(key), value);
770
+ }
771
+ const delimiter =
772
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
773
+ return [
774
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
775
+ ];
671
776
  })
672
777
  .join('&');
673
778
  return (
@@ -677,13 +782,22 @@ export class TestApi {
677
782
 
678
783
  private $headers = (
679
784
  headerParameters: { [key: string]: any },
680
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
785
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
681
786
  ): [string, string][] => {
682
787
  return Object.entries(headerParameters).flatMap(([key, value]) => {
683
788
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
684
789
  return value.map((v) => [key, String(v)]) as [string, string][];
685
790
  }
686
- return [[key, String(value)]];
791
+ const delimiter =
792
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
793
+ return [
794
+ [
795
+ key,
796
+ Array.isArray(value)
797
+ ? value.map(String).join(delimiter)
798
+ : String(value),
799
+ ],
800
+ ];
687
801
  });
688
802
  };
689
803
 
@@ -777,7 +891,7 @@ exports[`openApiTsClientGenerator - primitive types > should handle enum referen
777
891
  * Utility for serialisation and deserialisation of API types.
778
892
  */
779
893
  export class $IO {
780
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
894
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
781
895
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
782
896
 
783
897
  public static UpdateStatus200Response = {
@@ -873,11 +987,31 @@ export class TestApi {
873
987
  this.updateStatus = this.updateStatus.bind(this);
874
988
  }
875
989
 
990
+ private $collectionDelimiters: { [format: string]: string } = {
991
+ csv: ',',
992
+ ssv: ' ',
993
+ pipes: '|',
994
+ };
995
+
996
+ private $deepObject = (key: string, value: any): string[] => {
997
+ if (value === undefined || value === null) {
998
+ return [];
999
+ }
1000
+ if (typeof value !== 'object') {
1001
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
1002
+ }
1003
+ return Object.entries(value).flatMap(([prop, v]) =>
1004
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
1005
+ );
1006
+ };
1007
+
876
1008
  private $url = (
877
1009
  path: string,
878
1010
  pathParameters: { [key: string]: any },
879
1011
  queryParameters: { [key: string]: any },
880
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
1012
+ collectionFormats?: {
1013
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
1014
+ },
881
1015
  ): string => {
882
1016
  const baseUrl = this.$config.url.endsWith('/')
883
1017
  ? this.$config.url.slice(0, -1)
@@ -888,15 +1022,24 @@ export class TestApi {
888
1022
  path,
889
1023
  );
890
1024
  const queryString = Object.entries(queryParameters)
891
- .map(([key, value]) => {
1025
+ .flatMap(([key, value]) => {
892
1026
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
893
- return value
894
- .map(
895
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
896
- )
897
- .join('&');
1027
+ return value.map(
1028
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
1029
+ );
1030
+ }
1031
+ if (
1032
+ collectionFormats?.[key] === 'deepObject' &&
1033
+ value !== null &&
1034
+ typeof value === 'object'
1035
+ ) {
1036
+ return this.$deepObject(encodeURIComponent(key), value);
898
1037
  }
899
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
1038
+ const delimiter =
1039
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
1040
+ return [
1041
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
1042
+ ];
900
1043
  })
901
1044
  .join('&');
902
1045
  return (
@@ -906,13 +1049,22 @@ export class TestApi {
906
1049
 
907
1050
  private $headers = (
908
1051
  headerParameters: { [key: string]: any },
909
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
1052
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
910
1053
  ): [string, string][] => {
911
1054
  return Object.entries(headerParameters).flatMap(([key, value]) => {
912
1055
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
913
1056
  return value.map((v) => [key, String(v)]) as [string, string][];
914
1057
  }
915
- return [[key, String(value)]];
1058
+ const delimiter =
1059
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
1060
+ return [
1061
+ [
1062
+ key,
1063
+ Array.isArray(value)
1064
+ ? value.map(String).join(delimiter)
1065
+ : String(value),
1066
+ ],
1067
+ ];
916
1068
  });
917
1069
  };
918
1070
 
@@ -976,7 +1128,7 @@ exports[`openApiTsClientGenerator - primitive types > should handle enum request
976
1128
  * Utility for serialisation and deserialisation of API types.
977
1129
  */
978
1130
  export class $IO {
979
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
1131
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
980
1132
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
981
1133
  }
982
1134
 
@@ -1018,11 +1170,31 @@ export class TestApi {
1018
1170
  this.updateStatus = this.updateStatus.bind(this);
1019
1171
  }
1020
1172
 
1173
+ private $collectionDelimiters: { [format: string]: string } = {
1174
+ csv: ',',
1175
+ ssv: ' ',
1176
+ pipes: '|',
1177
+ };
1178
+
1179
+ private $deepObject = (key: string, value: any): string[] => {
1180
+ if (value === undefined || value === null) {
1181
+ return [];
1182
+ }
1183
+ if (typeof value !== 'object') {
1184
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
1185
+ }
1186
+ return Object.entries(value).flatMap(([prop, v]) =>
1187
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
1188
+ );
1189
+ };
1190
+
1021
1191
  private $url = (
1022
1192
  path: string,
1023
1193
  pathParameters: { [key: string]: any },
1024
1194
  queryParameters: { [key: string]: any },
1025
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
1195
+ collectionFormats?: {
1196
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
1197
+ },
1026
1198
  ): string => {
1027
1199
  const baseUrl = this.$config.url.endsWith('/')
1028
1200
  ? this.$config.url.slice(0, -1)
@@ -1033,15 +1205,24 @@ export class TestApi {
1033
1205
  path,
1034
1206
  );
1035
1207
  const queryString = Object.entries(queryParameters)
1036
- .map(([key, value]) => {
1208
+ .flatMap(([key, value]) => {
1037
1209
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
1038
- return value
1039
- .map(
1040
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
1041
- )
1042
- .join('&');
1210
+ return value.map(
1211
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
1212
+ );
1043
1213
  }
1044
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
1214
+ if (
1215
+ collectionFormats?.[key] === 'deepObject' &&
1216
+ value !== null &&
1217
+ typeof value === 'object'
1218
+ ) {
1219
+ return this.$deepObject(encodeURIComponent(key), value);
1220
+ }
1221
+ const delimiter =
1222
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
1223
+ return [
1224
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
1225
+ ];
1045
1226
  })
1046
1227
  .join('&');
1047
1228
  return (
@@ -1051,13 +1232,22 @@ export class TestApi {
1051
1232
 
1052
1233
  private $headers = (
1053
1234
  headerParameters: { [key: string]: any },
1054
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
1235
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
1055
1236
  ): [string, string][] => {
1056
1237
  return Object.entries(headerParameters).flatMap(([key, value]) => {
1057
1238
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
1058
1239
  return value.map((v) => [key, String(v)]) as [string, string][];
1059
1240
  }
1060
- return [[key, String(value)]];
1241
+ const delimiter =
1242
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
1243
+ return [
1244
+ [
1245
+ key,
1246
+ Array.isArray(value)
1247
+ ? value.map(String).join(delimiter)
1248
+ : String(value),
1249
+ ],
1250
+ ];
1061
1251
  });
1062
1252
  };
1063
1253
 
@@ -1124,7 +1314,7 @@ exports[`openApiTsClientGenerator - primitive types > should handle number and s
1124
1314
  * Utility for serialisation and deserialisation of API types.
1125
1315
  */
1126
1316
  export class $IO {
1127
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
1317
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
1128
1318
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
1129
1319
 
1130
1320
  public static TestConstraints200Response = {
@@ -1262,11 +1452,31 @@ export class TestApi {
1262
1452
  this.testConstraints = this.testConstraints.bind(this);
1263
1453
  }
1264
1454
 
1455
+ private $collectionDelimiters: { [format: string]: string } = {
1456
+ csv: ',',
1457
+ ssv: ' ',
1458
+ pipes: '|',
1459
+ };
1460
+
1461
+ private $deepObject = (key: string, value: any): string[] => {
1462
+ if (value === undefined || value === null) {
1463
+ return [];
1464
+ }
1465
+ if (typeof value !== 'object') {
1466
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
1467
+ }
1468
+ return Object.entries(value).flatMap(([prop, v]) =>
1469
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
1470
+ );
1471
+ };
1472
+
1265
1473
  private $url = (
1266
1474
  path: string,
1267
1475
  pathParameters: { [key: string]: any },
1268
1476
  queryParameters: { [key: string]: any },
1269
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
1477
+ collectionFormats?: {
1478
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
1479
+ },
1270
1480
  ): string => {
1271
1481
  const baseUrl = this.$config.url.endsWith('/')
1272
1482
  ? this.$config.url.slice(0, -1)
@@ -1277,15 +1487,24 @@ export class TestApi {
1277
1487
  path,
1278
1488
  );
1279
1489
  const queryString = Object.entries(queryParameters)
1280
- .map(([key, value]) => {
1490
+ .flatMap(([key, value]) => {
1281
1491
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
1282
- return value
1283
- .map(
1284
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
1285
- )
1286
- .join('&');
1492
+ return value.map(
1493
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
1494
+ );
1495
+ }
1496
+ if (
1497
+ collectionFormats?.[key] === 'deepObject' &&
1498
+ value !== null &&
1499
+ typeof value === 'object'
1500
+ ) {
1501
+ return this.$deepObject(encodeURIComponent(key), value);
1287
1502
  }
1288
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
1503
+ const delimiter =
1504
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
1505
+ return [
1506
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
1507
+ ];
1289
1508
  })
1290
1509
  .join('&');
1291
1510
  return (
@@ -1295,13 +1514,22 @@ export class TestApi {
1295
1514
 
1296
1515
  private $headers = (
1297
1516
  headerParameters: { [key: string]: any },
1298
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
1517
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
1299
1518
  ): [string, string][] => {
1300
1519
  return Object.entries(headerParameters).flatMap(([key, value]) => {
1301
1520
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
1302
1521
  return value.map((v) => [key, String(v)]) as [string, string][];
1303
1522
  }
1304
- return [[key, String(value)]];
1523
+ const delimiter =
1524
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
1525
+ return [
1526
+ [
1527
+ key,
1528
+ Array.isArray(value)
1529
+ ? value.map(String).join(delimiter)
1530
+ : String(value),
1531
+ ],
1532
+ ];
1305
1533
  });
1306
1534
  };
1307
1535
 
@@ -1381,7 +1609,7 @@ exports[`openApiTsClientGenerator - primitive types > should handle special form
1381
1609
  * Utility for serialisation and deserialisation of API types.
1382
1610
  */
1383
1611
  export class $IO {
1384
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
1612
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
1385
1613
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
1386
1614
 
1387
1615
  public static PostTest200Response = {
@@ -1584,11 +1812,31 @@ export class TestApi {
1584
1812
  this.postTest = this.postTest.bind(this);
1585
1813
  }
1586
1814
 
1815
+ private $collectionDelimiters: { [format: string]: string } = {
1816
+ csv: ',',
1817
+ ssv: ' ',
1818
+ pipes: '|',
1819
+ };
1820
+
1821
+ private $deepObject = (key: string, value: any): string[] => {
1822
+ if (value === undefined || value === null) {
1823
+ return [];
1824
+ }
1825
+ if (typeof value !== 'object') {
1826
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
1827
+ }
1828
+ return Object.entries(value).flatMap(([prop, v]) =>
1829
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
1830
+ );
1831
+ };
1832
+
1587
1833
  private $url = (
1588
1834
  path: string,
1589
1835
  pathParameters: { [key: string]: any },
1590
1836
  queryParameters: { [key: string]: any },
1591
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
1837
+ collectionFormats?: {
1838
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
1839
+ },
1592
1840
  ): string => {
1593
1841
  const baseUrl = this.$config.url.endsWith('/')
1594
1842
  ? this.$config.url.slice(0, -1)
@@ -1599,15 +1847,24 @@ export class TestApi {
1599
1847
  path,
1600
1848
  );
1601
1849
  const queryString = Object.entries(queryParameters)
1602
- .map(([key, value]) => {
1850
+ .flatMap(([key, value]) => {
1603
1851
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
1604
- return value
1605
- .map(
1606
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
1607
- )
1608
- .join('&');
1852
+ return value.map(
1853
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
1854
+ );
1609
1855
  }
1610
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
1856
+ if (
1857
+ collectionFormats?.[key] === 'deepObject' &&
1858
+ value !== null &&
1859
+ typeof value === 'object'
1860
+ ) {
1861
+ return this.$deepObject(encodeURIComponent(key), value);
1862
+ }
1863
+ const delimiter =
1864
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
1865
+ return [
1866
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
1867
+ ];
1611
1868
  })
1612
1869
  .join('&');
1613
1870
  return (
@@ -1617,13 +1874,22 @@ export class TestApi {
1617
1874
 
1618
1875
  private $headers = (
1619
1876
  headerParameters: { [key: string]: any },
1620
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
1877
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
1621
1878
  ): [string, string][] => {
1622
1879
  return Object.entries(headerParameters).flatMap(([key, value]) => {
1623
1880
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
1624
1881
  return value.map((v) => [key, String(v)]) as [string, string][];
1625
1882
  }
1626
- return [[key, String(value)]];
1883
+ const delimiter =
1884
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
1885
+ return [
1886
+ [
1887
+ key,
1888
+ Array.isArray(value)
1889
+ ? value.map(String).join(delimiter)
1890
+ : String(value),
1891
+ ],
1892
+ ];
1627
1893
  });
1628
1894
  };
1629
1895
 
@@ -1638,7 +1904,7 @@ export class TestApi {
1638
1904
  if (!this.$config.options?.omitContentTypeHeader) {
1639
1905
  headerParameters['Content-Type'] = 'application/json';
1640
1906
  }
1641
- const collectionFormats = {
1907
+ const queryCollectionFormats = {
1642
1908
  date: 'multi',
1643
1909
  timestamp: 'multi',
1644
1910
  } as const;
@@ -1650,9 +1916,14 @@ export class TestApi {
1650
1916
  : String($IO.PostTestRequestContent.toJson(input));
1651
1917
 
1652
1918
  const response = await this.$fetch(
1653
- this.$url('/test', pathParameters, queryParameters, collectionFormats),
1919
+ this.$url(
1920
+ '/test',
1921
+ pathParameters,
1922
+ queryParameters,
1923
+ queryCollectionFormats,
1924
+ ),
1654
1925
  {
1655
- headers: this.$headers(headerParameters, collectionFormats),
1926
+ headers: this.$headers(headerParameters),
1656
1927
  method: 'POST',
1657
1928
  body,
1658
1929
  },