@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
@@ -11,7 +11,7 @@ exports[`openApiTsClientGenerator - tags > should allow duplicate operation ids
11
11
  * Utility for serialisation and deserialisation of API types.
12
12
  */
13
13
  export class $IO {
14
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
14
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
15
15
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
16
16
  }
17
17
 
@@ -54,11 +54,31 @@ export class TestApi {
54
54
  this._usersPeopleList = this._usersPeopleList.bind(this);
55
55
  }
56
56
 
57
+ private $collectionDelimiters: { [format: string]: string } = {
58
+ csv: ',',
59
+ ssv: ' ',
60
+ pipes: '|',
61
+ };
62
+
63
+ private $deepObject = (key: string, value: any): string[] => {
64
+ if (value === undefined || value === null) {
65
+ return [];
66
+ }
67
+ if (typeof value !== 'object') {
68
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
69
+ }
70
+ return Object.entries(value).flatMap(([prop, v]) =>
71
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
72
+ );
73
+ };
74
+
57
75
  private $url = (
58
76
  path: string,
59
77
  pathParameters: { [key: string]: any },
60
78
  queryParameters: { [key: string]: any },
61
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
79
+ collectionFormats?: {
80
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
81
+ },
62
82
  ): string => {
63
83
  const baseUrl = this.$config.url.endsWith('/')
64
84
  ? this.$config.url.slice(0, -1)
@@ -69,15 +89,24 @@ export class TestApi {
69
89
  path,
70
90
  );
71
91
  const queryString = Object.entries(queryParameters)
72
- .map(([key, value]) => {
92
+ .flatMap(([key, value]) => {
73
93
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
74
- return value
75
- .map(
76
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
77
- )
78
- .join('&');
94
+ return value.map(
95
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
96
+ );
97
+ }
98
+ if (
99
+ collectionFormats?.[key] === 'deepObject' &&
100
+ value !== null &&
101
+ typeof value === 'object'
102
+ ) {
103
+ return this.$deepObject(encodeURIComponent(key), value);
79
104
  }
80
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
105
+ const delimiter =
106
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
107
+ return [
108
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
109
+ ];
81
110
  })
82
111
  .join('&');
83
112
  return (
@@ -87,13 +116,22 @@ export class TestApi {
87
116
 
88
117
  private $headers = (
89
118
  headerParameters: { [key: string]: any },
90
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
119
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
91
120
  ): [string, string][] => {
92
121
  return Object.entries(headerParameters).flatMap(([key, value]) => {
93
122
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
94
123
  return value.map((v) => [key, String(v)]) as [string, string][];
95
124
  }
96
- return [[key, String(value)]];
125
+ const delimiter =
126
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
127
+ return [
128
+ [
129
+ key,
130
+ Array.isArray(value)
131
+ ? value.map(String).join(delimiter)
132
+ : String(value),
133
+ ],
134
+ ];
97
135
  });
98
136
  };
99
137
 
@@ -190,7 +228,7 @@ exports[`openApiTsClientGenerator - tags > should allow duplicate operation ids
190
228
  * Utility for serialisation and deserialisation of API types.
191
229
  */
192
230
  export class $IO {
193
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
231
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
194
232
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
195
233
  }
196
234
 
@@ -233,11 +271,31 @@ export class TestApi {
233
271
  this._usersList = this._usersList.bind(this);
234
272
  }
235
273
 
274
+ private $collectionDelimiters: { [format: string]: string } = {
275
+ csv: ',',
276
+ ssv: ' ',
277
+ pipes: '|',
278
+ };
279
+
280
+ private $deepObject = (key: string, value: any): string[] => {
281
+ if (value === undefined || value === null) {
282
+ return [];
283
+ }
284
+ if (typeof value !== 'object') {
285
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
286
+ }
287
+ return Object.entries(value).flatMap(([prop, v]) =>
288
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
289
+ );
290
+ };
291
+
236
292
  private $url = (
237
293
  path: string,
238
294
  pathParameters: { [key: string]: any },
239
295
  queryParameters: { [key: string]: any },
240
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
296
+ collectionFormats?: {
297
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
298
+ },
241
299
  ): string => {
242
300
  const baseUrl = this.$config.url.endsWith('/')
243
301
  ? this.$config.url.slice(0, -1)
@@ -248,15 +306,24 @@ export class TestApi {
248
306
  path,
249
307
  );
250
308
  const queryString = Object.entries(queryParameters)
251
- .map(([key, value]) => {
309
+ .flatMap(([key, value]) => {
252
310
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
253
- return value
254
- .map(
255
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
256
- )
257
- .join('&');
311
+ return value.map(
312
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
313
+ );
314
+ }
315
+ if (
316
+ collectionFormats?.[key] === 'deepObject' &&
317
+ value !== null &&
318
+ typeof value === 'object'
319
+ ) {
320
+ return this.$deepObject(encodeURIComponent(key), value);
258
321
  }
259
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
322
+ const delimiter =
323
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
324
+ return [
325
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
326
+ ];
260
327
  })
261
328
  .join('&');
262
329
  return (
@@ -266,13 +333,22 @@ export class TestApi {
266
333
 
267
334
  private $headers = (
268
335
  headerParameters: { [key: string]: any },
269
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
336
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
270
337
  ): [string, string][] => {
271
338
  return Object.entries(headerParameters).flatMap(([key, value]) => {
272
339
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
273
340
  return value.map((v) => [key, String(v)]) as [string, string][];
274
341
  }
275
- return [[key, String(value)]];
342
+ const delimiter =
343
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
344
+ return [
345
+ [
346
+ key,
347
+ Array.isArray(value)
348
+ ? value.map(String).join(delimiter)
349
+ : String(value),
350
+ ],
351
+ ];
276
352
  });
277
353
  };
278
354
 
@@ -357,7 +433,7 @@ exports[`openApiTsClientGenerator - tags > should handle operation tags and mult
357
433
  * Utility for serialisation and deserialisation of API types.
358
434
  */
359
435
  export class $IO {
360
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
436
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
361
437
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
362
438
  }
363
439
 
@@ -402,11 +478,31 @@ export class TestApi {
402
478
  this._getUsers = this._getUsers.bind(this);
403
479
  }
404
480
 
481
+ private $collectionDelimiters: { [format: string]: string } = {
482
+ csv: ',',
483
+ ssv: ' ',
484
+ pipes: '|',
485
+ };
486
+
487
+ private $deepObject = (key: string, value: any): string[] => {
488
+ if (value === undefined || value === null) {
489
+ return [];
490
+ }
491
+ if (typeof value !== 'object') {
492
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
493
+ }
494
+ return Object.entries(value).flatMap(([prop, v]) =>
495
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
496
+ );
497
+ };
498
+
405
499
  private $url = (
406
500
  path: string,
407
501
  pathParameters: { [key: string]: any },
408
502
  queryParameters: { [key: string]: any },
409
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
503
+ collectionFormats?: {
504
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
505
+ },
410
506
  ): string => {
411
507
  const baseUrl = this.$config.url.endsWith('/')
412
508
  ? this.$config.url.slice(0, -1)
@@ -417,15 +513,24 @@ export class TestApi {
417
513
  path,
418
514
  );
419
515
  const queryString = Object.entries(queryParameters)
420
- .map(([key, value]) => {
516
+ .flatMap(([key, value]) => {
421
517
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
422
- return value
423
- .map(
424
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
425
- )
426
- .join('&');
518
+ return value.map(
519
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
520
+ );
521
+ }
522
+ if (
523
+ collectionFormats?.[key] === 'deepObject' &&
524
+ value !== null &&
525
+ typeof value === 'object'
526
+ ) {
527
+ return this.$deepObject(encodeURIComponent(key), value);
427
528
  }
428
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
529
+ const delimiter =
530
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
531
+ return [
532
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
533
+ ];
429
534
  })
430
535
  .join('&');
431
536
  return (
@@ -435,13 +540,22 @@ export class TestApi {
435
540
 
436
541
  private $headers = (
437
542
  headerParameters: { [key: string]: any },
438
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
543
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
439
544
  ): [string, string][] => {
440
545
  return Object.entries(headerParameters).flatMap(([key, value]) => {
441
546
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
442
547
  return value.map((v) => [key, String(v)]) as [string, string][];
443
548
  }
444
- return [[key, String(value)]];
549
+ const delimiter =
550
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
551
+ return [
552
+ [
553
+ key,
554
+ Array.isArray(value)
555
+ ? value.map(String).join(delimiter)
556
+ : String(value),
557
+ ],
558
+ ];
445
559
  });
446
560
  };
447
561
 
@@ -579,7 +693,7 @@ exports[`openApiTsClientGenerator - tags > should handle operations with multipl
579
693
  * Utility for serialisation and deserialisation of API types.
580
694
  */
581
695
  export class $IO {
582
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
696
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
583
697
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
584
698
  }
585
699
 
@@ -622,11 +736,31 @@ export class TestApi {
622
736
  this._postMultiTagged = this._postMultiTagged.bind(this);
623
737
  }
624
738
 
739
+ private $collectionDelimiters: { [format: string]: string } = {
740
+ csv: ',',
741
+ ssv: ' ',
742
+ pipes: '|',
743
+ };
744
+
745
+ private $deepObject = (key: string, value: any): string[] => {
746
+ if (value === undefined || value === null) {
747
+ return [];
748
+ }
749
+ if (typeof value !== 'object') {
750
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
751
+ }
752
+ return Object.entries(value).flatMap(([prop, v]) =>
753
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
754
+ );
755
+ };
756
+
625
757
  private $url = (
626
758
  path: string,
627
759
  pathParameters: { [key: string]: any },
628
760
  queryParameters: { [key: string]: any },
629
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
761
+ collectionFormats?: {
762
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
763
+ },
630
764
  ): string => {
631
765
  const baseUrl = this.$config.url.endsWith('/')
632
766
  ? this.$config.url.slice(0, -1)
@@ -637,15 +771,24 @@ export class TestApi {
637
771
  path,
638
772
  );
639
773
  const queryString = Object.entries(queryParameters)
640
- .map(([key, value]) => {
774
+ .flatMap(([key, value]) => {
641
775
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
642
- return value
643
- .map(
644
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
645
- )
646
- .join('&');
776
+ return value.map(
777
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
778
+ );
779
+ }
780
+ if (
781
+ collectionFormats?.[key] === 'deepObject' &&
782
+ value !== null &&
783
+ typeof value === 'object'
784
+ ) {
785
+ return this.$deepObject(encodeURIComponent(key), value);
647
786
  }
648
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
787
+ const delimiter =
788
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
789
+ return [
790
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
791
+ ];
649
792
  })
650
793
  .join('&');
651
794
  return (
@@ -655,13 +798,22 @@ export class TestApi {
655
798
 
656
799
  private $headers = (
657
800
  headerParameters: { [key: string]: any },
658
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
801
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
659
802
  ): [string, string][] => {
660
803
  return Object.entries(headerParameters).flatMap(([key, value]) => {
661
804
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
662
805
  return value.map((v) => [key, String(v)]) as [string, string][];
663
806
  }
664
- return [[key, String(value)]];
807
+ const delimiter =
808
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
809
+ return [
810
+ [
811
+ key,
812
+ Array.isArray(value)
813
+ ? value.map(String).join(delimiter)
814
+ : String(value),
815
+ ],
816
+ ];
665
817
  });
666
818
  };
667
819