@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
@@ -25,7 +25,7 @@ exports[`openApiTsClientGenerator - responses > should handle default responses
25
25
  * Utility for serialisation and deserialisation of API types.
26
26
  */
27
27
  export class $IO {
28
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
28
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
29
29
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
30
30
 
31
31
  public static GetTest200Response = {
@@ -113,11 +113,31 @@ export class TestApi {
113
113
  this.getTest = this.getTest.bind(this);
114
114
  }
115
115
 
116
+ private $collectionDelimiters: { [format: string]: string } = {
117
+ csv: ',',
118
+ ssv: ' ',
119
+ pipes: '|',
120
+ };
121
+
122
+ private $deepObject = (key: string, value: any): string[] => {
123
+ if (value === undefined || value === null) {
124
+ return [];
125
+ }
126
+ if (typeof value !== 'object') {
127
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
128
+ }
129
+ return Object.entries(value).flatMap(([prop, v]) =>
130
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
131
+ );
132
+ };
133
+
116
134
  private $url = (
117
135
  path: string,
118
136
  pathParameters: { [key: string]: any },
119
137
  queryParameters: { [key: string]: any },
120
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
138
+ collectionFormats?: {
139
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
140
+ },
121
141
  ): string => {
122
142
  const baseUrl = this.$config.url.endsWith('/')
123
143
  ? this.$config.url.slice(0, -1)
@@ -128,15 +148,24 @@ export class TestApi {
128
148
  path,
129
149
  );
130
150
  const queryString = Object.entries(queryParameters)
131
- .map(([key, value]) => {
151
+ .flatMap(([key, value]) => {
132
152
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
133
- return value
134
- .map(
135
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
136
- )
137
- .join('&');
153
+ return value.map(
154
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
155
+ );
156
+ }
157
+ if (
158
+ collectionFormats?.[key] === 'deepObject' &&
159
+ value !== null &&
160
+ typeof value === 'object'
161
+ ) {
162
+ return this.$deepObject(encodeURIComponent(key), value);
138
163
  }
139
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
164
+ const delimiter =
165
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
166
+ return [
167
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
168
+ ];
140
169
  })
141
170
  .join('&');
142
171
  return (
@@ -146,13 +175,22 @@ export class TestApi {
146
175
 
147
176
  private $headers = (
148
177
  headerParameters: { [key: string]: any },
149
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
178
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
150
179
  ): [string, string][] => {
151
180
  return Object.entries(headerParameters).flatMap(([key, value]) => {
152
181
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
153
182
  return value.map((v) => [key, String(v)]) as [string, string][];
154
183
  }
155
- return [[key, String(value)]];
184
+ const delimiter =
185
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
186
+ return [
187
+ [
188
+ key,
189
+ Array.isArray(value)
190
+ ? value.map(String).join(delimiter)
191
+ : String(value),
192
+ ],
193
+ ];
156
194
  });
157
195
  };
158
196
 
@@ -329,7 +367,7 @@ exports[`openApiTsClientGenerator - responses > should handle multiple response
329
367
  * Utility for serialisation and deserialisation of API types.
330
368
  */
331
369
  export class $IO {
332
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
370
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
333
371
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
334
372
 
335
373
  public static TestResponses2XXResponse = {
@@ -489,11 +527,31 @@ export class TestApi {
489
527
  this.testResponses = this.testResponses.bind(this);
490
528
  }
491
529
 
530
+ private $collectionDelimiters: { [format: string]: string } = {
531
+ csv: ',',
532
+ ssv: ' ',
533
+ pipes: '|',
534
+ };
535
+
536
+ private $deepObject = (key: string, value: any): string[] => {
537
+ if (value === undefined || value === null) {
538
+ return [];
539
+ }
540
+ if (typeof value !== 'object') {
541
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
542
+ }
543
+ return Object.entries(value).flatMap(([prop, v]) =>
544
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
545
+ );
546
+ };
547
+
492
548
  private $url = (
493
549
  path: string,
494
550
  pathParameters: { [key: string]: any },
495
551
  queryParameters: { [key: string]: any },
496
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
552
+ collectionFormats?: {
553
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
554
+ },
497
555
  ): string => {
498
556
  const baseUrl = this.$config.url.endsWith('/')
499
557
  ? this.$config.url.slice(0, -1)
@@ -504,15 +562,24 @@ export class TestApi {
504
562
  path,
505
563
  );
506
564
  const queryString = Object.entries(queryParameters)
507
- .map(([key, value]) => {
565
+ .flatMap(([key, value]) => {
508
566
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
509
- return value
510
- .map(
511
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
512
- )
513
- .join('&');
567
+ return value.map(
568
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
569
+ );
570
+ }
571
+ if (
572
+ collectionFormats?.[key] === 'deepObject' &&
573
+ value !== null &&
574
+ typeof value === 'object'
575
+ ) {
576
+ return this.$deepObject(encodeURIComponent(key), value);
514
577
  }
515
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
578
+ const delimiter =
579
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
580
+ return [
581
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
582
+ ];
516
583
  })
517
584
  .join('&');
518
585
  return (
@@ -522,13 +589,22 @@ export class TestApi {
522
589
 
523
590
  private $headers = (
524
591
  headerParameters: { [key: string]: any },
525
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
592
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
526
593
  ): [string, string][] => {
527
594
  return Object.entries(headerParameters).flatMap(([key, value]) => {
528
595
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
529
596
  return value.map((v) => [key, String(v)]) as [string, string][];
530
597
  }
531
- return [[key, String(value)]];
598
+ const delimiter =
599
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
600
+ return [
601
+ [
602
+ key,
603
+ Array.isArray(value)
604
+ ? value.map(String).join(delimiter)
605
+ : String(value),
606
+ ],
607
+ ];
532
608
  });
533
609
  };
534
610
 
@@ -598,7 +674,7 @@ exports[`openApiTsClientGenerator - responses > should handle only default respo
598
674
  * Utility for serialisation and deserialisation of API types.
599
675
  */
600
676
  export class $IO {
601
- protected static $mapValues = (data: any, fn: (item: any) => any) =>
677
+ public static $mapValues = (data: any, fn: (item: any) => any) =>
602
678
  Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
603
679
 
604
680
  public static GetTestdefaultResponse = {
@@ -663,11 +739,31 @@ export class TestApi {
663
739
  this.getTest = this.getTest.bind(this);
664
740
  }
665
741
 
742
+ private $collectionDelimiters: { [format: string]: string } = {
743
+ csv: ',',
744
+ ssv: ' ',
745
+ pipes: '|',
746
+ };
747
+
748
+ private $deepObject = (key: string, value: any): string[] => {
749
+ if (value === undefined || value === null) {
750
+ return [];
751
+ }
752
+ if (typeof value !== 'object') {
753
+ return [\`\${key}=\${encodeURIComponent(String(value))}\`];
754
+ }
755
+ return Object.entries(value).flatMap(([prop, v]) =>
756
+ this.$deepObject(\`\${key}[\${encodeURIComponent(prop)}]\`, v),
757
+ );
758
+ };
759
+
666
760
  private $url = (
667
761
  path: string,
668
762
  pathParameters: { [key: string]: any },
669
763
  queryParameters: { [key: string]: any },
670
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
764
+ collectionFormats?: {
765
+ [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';
766
+ },
671
767
  ): string => {
672
768
  const baseUrl = this.$config.url.endsWith('/')
673
769
  ? this.$config.url.slice(0, -1)
@@ -678,15 +774,24 @@ export class TestApi {
678
774
  path,
679
775
  );
680
776
  const queryString = Object.entries(queryParameters)
681
- .map(([key, value]) => {
777
+ .flatMap(([key, value]) => {
682
778
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
683
- return value
684
- .map(
685
- (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
686
- )
687
- .join('&');
779
+ return value.map(
780
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
781
+ );
782
+ }
783
+ if (
784
+ collectionFormats?.[key] === 'deepObject' &&
785
+ value !== null &&
786
+ typeof value === 'object'
787
+ ) {
788
+ return this.$deepObject(encodeURIComponent(key), value);
688
789
  }
689
- return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
790
+ const delimiter =
791
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
792
+ return [
793
+ \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(delimiter) : String(value))}\`,
794
+ ];
690
795
  })
691
796
  .join('&');
692
797
  return (
@@ -696,13 +801,22 @@ export class TestApi {
696
801
 
697
802
  private $headers = (
698
803
  headerParameters: { [key: string]: any },
699
- collectionFormats?: { [key: string]: 'multi' | 'csv' },
804
+ collectionFormats?: { [key: string]: 'multi' | 'csv' | 'ssv' | 'pipes' },
700
805
  ): [string, string][] => {
701
806
  return Object.entries(headerParameters).flatMap(([key, value]) => {
702
807
  if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
703
808
  return value.map((v) => [key, String(v)]) as [string, string][];
704
809
  }
705
- return [[key, String(value)]];
810
+ const delimiter =
811
+ this.$collectionDelimiters[collectionFormats?.[key] ?? 'csv'] ?? ',';
812
+ return [
813
+ [
814
+ key,
815
+ Array.isArray(value)
816
+ ? value.map(String).join(delimiter)
817
+ : String(value),
818
+ ],
819
+ ];
706
820
  });
707
821
  };
708
822