@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
@@ -21,7 +21,7 @@ exports[`openApiTsClientGenerator - duplicate types > should handle duplicated m
21
21
  * Utility for serialisation and deserialisation of API types.
22
22
  */
23
23
  export class $IO {
24
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
24
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
25
25
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
26
26
 
27
27
  public static Clash = {
@@ -134,11 +134,31 @@ export class TestApi {
134
134
  this.operation = this.operation.bind(this);
135
135
  }
136
136
 
137
+ private $collectionDelimiters: { [format: string]: string } = {
138
+ csv: ',',
139
+ ssv: ' ',
140
+ pipes: '|',
141
+ };
142
+
143
+ private $deepObject = (key: string, value: any): string[] => {
144
+ if (value === undefined || value === null) {
145
+ return [];
146
+ }
147
+ if (typeof value !== 'object') {
148
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
149
+ }
150
+ return Object.entries(value).flatMap(([prop, v]) =>
151
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
152
+ );
153
+ };
154
+
137
155
  private $url = (
138
156
  path: string,
139
157
  pathParameters: { [key: string]: any },
140
158
  queryParameters: { [key: string]: any },
141
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
159
+ collectionFormats?: {
160
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
161
+ },
142
162
  ): string => {
143
163
  const baseUrl = this.$config.url.endsWith('/')
144
164
  ? this.$config.url.slice(0, -1)
@@ -149,15 +169,24 @@ export class TestApi {
149
169
  path,
150
170
  );
151
171
  const queryString = Object.entries(queryParameters)
152
- .map(([key, value]) => {
172
+ .flatMap(([key, value]) => {
153
173
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
154
- return value
155
- .map(
156
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
157
- )
158
- .join('&');
174
+ return value.map(
175
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
176
+ );
177
+ }
178
+ if (
179
+ collectionFormats?.[key] === 'deepObject' &&
180
+ value !== null &&
181
+ typeof value === 'object'
182
+ ) {
183
+ return this.$deepObject(encodeURIComponent(key), value);
159
184
  }
160
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
185
+ const delimiter =
186
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
187
+ return [
188
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
189
+ ];
161
190
  })
162
191
  .join('&');
163
192
  return (
@@ -167,13 +196,22 @@ export class TestApi {
167
196
 
168
197
  private $headers = (
169
198
  headerParameters: { [key: string]: any },
170
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
199
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
171
200
  ): [string, string][] => {
172
201
  return Object.entries(headerParameters).flatMap(([key, value]) => {
173
202
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
174
203
  return value.map((v) => [key, String(v)]) as [string, string][];
175
204
  }
176
- return [[key, String(value)]];
205
+ const delimiter =
206
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
207
+ return [
208
+ [
209
+ key,
210
+ Array.isArray(value)
211
+ ? value.map(String).join(delimiter)
212
+ : String(value),
213
+ ],
214
+ ];
177
215
  });
178
216
  };
179
217
 
@@ -252,7 +290,7 @@ exports[`openApiTsClientGenerator - duplicate types > should handle many duplica
252
290
  * Utility for serialisation and deserialisation of API types.
253
291
  */
254
292
  export class $IO {
255
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
293
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
256
294
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
257
295
 
258
296
  public static AnotherModel = {
@@ -451,11 +489,31 @@ export class TestApi {
451
489
  this.operation = this.operation.bind(this);
452
490
  }
453
491
 
492
+ private $collectionDelimiters: { [format: string]: string } = {
493
+ csv: ',',
494
+ ssv: ' ',
495
+ pipes: '|',
496
+ };
497
+
498
+ private $deepObject = (key: string, value: any): string[] => {
499
+ if (value === undefined || value === null) {
500
+ return [];
501
+ }
502
+ if (typeof value !== 'object') {
503
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
504
+ }
505
+ return Object.entries(value).flatMap(([prop, v]) =>
506
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
507
+ );
508
+ };
509
+
454
510
  private $url = (
455
511
  path: string,
456
512
  pathParameters: { [key: string]: any },
457
513
  queryParameters: { [key: string]: any },
458
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
514
+ collectionFormats?: {
515
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
516
+ },
459
517
  ): string => {
460
518
  const baseUrl = this.$config.url.endsWith('/')
461
519
  ? this.$config.url.slice(0, -1)
@@ -466,15 +524,24 @@ export class TestApi {
466
524
  path,
467
525
  );
468
526
  const queryString = Object.entries(queryParameters)
469
- .map(([key, value]) => {
527
+ .flatMap(([key, value]) => {
470
528
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
471
- return value
472
- .map(
473
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
474
- )
475
- .join('&');
529
+ return value.map(
530
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
531
+ );
532
+ }
533
+ if (
534
+ collectionFormats?.[key] === 'deepObject' &&
535
+ value !== null &&
536
+ typeof value === 'object'
537
+ ) {
538
+ return this.$deepObject(encodeURIComponent(key), value);
476
539
  }
477
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
540
+ const delimiter =
541
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
542
+ return [
543
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
544
+ ];
478
545
  })
479
546
  .join('&');
480
547
  return (
@@ -484,13 +551,22 @@ export class TestApi {
484
551
 
485
552
  private $headers = (
486
553
  headerParameters: { [key: string]: any },
487
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
554
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
488
555
  ): [string, string][] => {
489
556
  return Object.entries(headerParameters).flatMap(([key, value]) => {
490
557
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
491
558
  return value.map((v) => [key, String(v)]) as [string, string][];
492
559
  }
493
- return [[key, String(value)]];
560
+ const delimiter =
561
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
562
+ return [
563
+ [
564
+ key,
565
+ Array.isArray(value)
566
+ ? value.map(String).join(delimiter)
567
+ : String(value),
568
+ ],
569
+ ];
494
570
  });
495
571
  };
496
572
 
@@ -557,7 +633,7 @@ exports[`openApiTsClientGenerator - duplicate types > should handle multiple ope
557
633
  * Utility for serialisation and deserialisation of API types.
558
634
  */
559
635
  export class $IO {
560
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
636
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
561
637
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
562
638
 
563
639
  public static OrderRequest = {
@@ -646,11 +722,31 @@ export class TestApi {
646
722
  this.user = this.user.bind(this);
647
723
  }
648
724
 
725
+ private $collectionDelimiters: { [format: string]: string } = {
726
+ csv: ',',
727
+ ssv: ' ',
728
+ pipes: '|',
729
+ };
730
+
731
+ private $deepObject = (key: string, value: any): string[] => {
732
+ if (value === undefined || value === null) {
733
+ return [];
734
+ }
735
+ if (typeof value !== 'object') {
736
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
737
+ }
738
+ return Object.entries(value).flatMap(([prop, v]) =>
739
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
740
+ );
741
+ };
742
+
649
743
  private $url = (
650
744
  path: string,
651
745
  pathParameters: { [key: string]: any },
652
746
  queryParameters: { [key: string]: any },
653
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
747
+ collectionFormats?: {
748
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
749
+ },
654
750
  ): string => {
655
751
  const baseUrl = this.$config.url.endsWith('/')
656
752
  ? this.$config.url.slice(0, -1)
@@ -661,15 +757,24 @@ export class TestApi {
661
757
  path,
662
758
  );
663
759
  const queryString = Object.entries(queryParameters)
664
- .map(([key, value]) => {
760
+ .flatMap(([key, value]) => {
665
761
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
666
- return value
667
- .map(
668
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
669
- )
670
- .join('&');
762
+ return value.map(
763
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
764
+ );
765
+ }
766
+ if (
767
+ collectionFormats?.[key] === 'deepObject' &&
768
+ value !== null &&
769
+ typeof value === 'object'
770
+ ) {
771
+ return this.$deepObject(encodeURIComponent(key), value);
671
772
  }
672
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
773
+ const delimiter =
774
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
775
+ return [
776
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
777
+ ];
673
778
  })
674
779
  .join('&');
675
780
  return (
@@ -679,13 +784,22 @@ export class TestApi {
679
784
 
680
785
  private $headers = (
681
786
  headerParameters: { [key: string]: any },
682
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
787
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
683
788
  ): [string, string][] => {
684
789
  return Object.entries(headerParameters).flatMap(([key, value]) => {
685
790
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
686
791
  return value.map((v) => [key, String(v)]) as [string, string][];
687
792
  }
688
- return [[key, String(value)]];
793
+ const delimiter =
794
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
795
+ return [
796
+ [
797
+ key,
798
+ Array.isArray(value)
799
+ ? value.map(String).join(delimiter)
800
+ : String(value),
801
+ ],
802
+ ];
689
803
  });
690
804
  };
691
805
 
@@ -770,7 +884,7 @@ exports[`openApiTsClientGenerator - duplicate types > should handle operation ID
770
884
  * Utility for serialisation and deserialisation of API types.
771
885
  */
772
886
  export class $IO {
773
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
887
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
774
888
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
775
889
 
776
890
  public static ChatRequest = {
@@ -835,11 +949,31 @@ export class TestApi {
835
949
  this.chat = this.chat.bind(this);
836
950
  }
837
951
 
952
+ private $collectionDelimiters: { [format: string]: string } = {
953
+ csv: ',',
954
+ ssv: ' ',
955
+ pipes: '|',
956
+ };
957
+
958
+ private $deepObject = (key: string, value: any): string[] => {
959
+ if (value === undefined || value === null) {
960
+ return [];
961
+ }
962
+ if (typeof value !== 'object') {
963
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
964
+ }
965
+ return Object.entries(value).flatMap(([prop, v]) =>
966
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
967
+ );
968
+ };
969
+
838
970
  private $url = (
839
971
  path: string,
840
972
  pathParameters: { [key: string]: any },
841
973
  queryParameters: { [key: string]: any },
842
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
974
+ collectionFormats?: {
975
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
976
+ },
843
977
  ): string => {
844
978
  const baseUrl = this.$config.url.endsWith('/')
845
979
  ? this.$config.url.slice(0, -1)
@@ -850,15 +984,24 @@ export class TestApi {
850
984
  path,
851
985
  );
852
986
  const queryString = Object.entries(queryParameters)
853
- .map(([key, value]) => {
987
+ .flatMap(([key, value]) => {
854
988
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
855
- return value
856
- .map(
857
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
858
- )
859
- .join('&');
989
+ return value.map(
990
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
991
+ );
992
+ }
993
+ if (
994
+ collectionFormats?.[key] === 'deepObject' &&
995
+ value !== null &&
996
+ typeof value === 'object'
997
+ ) {
998
+ return this.$deepObject(encodeURIComponent(key), value);
860
999
  }
861
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
1000
+ const delimiter =
1001
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
1002
+ return [
1003
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
1004
+ ];
862
1005
  })
863
1006
  .join('&');
864
1007
  return (
@@ -868,13 +1011,22 @@ export class TestApi {
868
1011
 
869
1012
  private $headers = (
870
1013
  headerParameters: { [key: string]: any },
871
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
1014
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
872
1015
  ): [string, string][] => {
873
1016
  return Object.entries(headerParameters).flatMap(([key, value]) => {
874
1017
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
875
1018
  return value.map((v) => [key, String(v)]) as [string, string][];
876
1019
  }
877
- return [[key, String(value)]];
1020
+ const delimiter =
1021
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
1022
+ return [
1023
+ [
1024
+ key,
1025
+ Array.isArray(value)
1026
+ ? value.map(String).join(delimiter)
1027
+ : String(value),
1028
+ ],
1029
+ ];
878
1030
  });
879
1031
  };
880
1032