@aws/nx-plugin 0.77.0 → 0.78.0

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 (26) hide show
  1. package/LICENSE-THIRD-PARTY +36 -8
  2. package/package.json +1 -1
  3. package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +16 -13
  4. package/src/py/fast-api/react/__snapshots__/generator.spec.ts.snap +1 -1
  5. package/src/smithy/react-connection/__snapshots__/generator.spec.ts.snap +2 -2
  6. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +23 -17
  7. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +60 -34
  8. package/src/trpc/backend/files/src/handler.ts.template +48 -0
  9. package/src/trpc/backend/files/src/index.ts.template +1 -1
  10. package/src/trpc/backend/files/src/router.ts.template +0 -38
  11. package/src/trpc/backend/files/src/schema/z-async-iterable.ts.template +115 -0
  12. package/src/trpc/backend/generator.js +6 -2
  13. package/src/trpc/backend/generator.js.map +1 -1
  14. package/src/trpc/react/__snapshots__/generator.spec.ts.snap +274 -27
  15. package/src/trpc/react/files/src/components/__apiNameClassName__ClientProvider.tsx.template +57 -1
  16. package/src/trpc/react/generator.js +11 -1
  17. package/src/trpc/react/generator.js.map +1 -1
  18. package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +13 -1
  19. package/src/utils/api-constructs/files/cdk/core/api/trpc/trpc-utils.ts.template +3 -3
  20. package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +8 -3
  21. package/src/utils/api-constructs/files/terraform/core/api/rest/rest-api/rest-api.tf.template +1 -1
  22. package/src/utils/connection/open-api/files/components/__apiNameClassName__Provider.tsx.template +1 -1
  23. package/src/utils/files/website/hooks/sigv4/useSigV4.tsx.template +81 -33
  24. package/src/utils/versions.d.ts +3 -1
  25. package/src/utils/versions.js +2 -0
  26. package/src/utils/versions.js.map +1 -1
@@ -3352,12 +3352,12 @@ SOFTWARE.
3352
3352
 
3353
3353
  ---
3354
3354
 
3355
- The following software may be included in this product: @esbuild/linux-x64 (0.27.2)
3355
+ The following software may be included in this product: @esbuild/darwin-arm64 (0.27.2)
3356
3356
  This software contains the following license and notice below:
3357
3357
 
3358
3358
  MIT License
3359
3359
 
3360
- Copyright (c) The maintainers of @esbuild/linux-x64 <https://github.com/evanw/esbuild#readme>
3360
+ Copyright (c) The maintainers of @esbuild/darwin-arm64 <https://github.com/evanw/esbuild#readme>
3361
3361
 
3362
3362
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
3363
3363
  associated documentation files (the "Software"), to deal in the Software without restriction, including
@@ -3376,12 +3376,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
3376
3376
 
3377
3377
  ---
3378
3378
 
3379
- The following software may be included in this product: @esbuild/linux-x64 (0.27.3)
3379
+ The following software may be included in this product: @esbuild/darwin-arm64 (0.27.3)
3380
3380
  This software contains the following license and notice below:
3381
3381
 
3382
3382
  MIT License
3383
3383
 
3384
- Copyright (c) The maintainers of @esbuild/linux-x64 <https://github.com/evanw/esbuild#readme>
3384
+ Copyright (c) The maintainers of @esbuild/darwin-arm64 <https://github.com/evanw/esbuild#readme>
3385
3385
 
3386
3386
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
3387
3387
  associated documentation files (the "Software"), to deal in the Software without restriction, including
@@ -4631,7 +4631,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4631
4631
 
4632
4632
  ---
4633
4633
 
4634
- The following software may be included in this product: @nx/nx-linux-x64-gnu (22.5.1)
4634
+ The following software may be included in this product: @nx/nx-darwin-arm64 (22.5.1)
4635
4635
  This software contains the following license and notice below:
4636
4636
 
4637
4637
  (The MIT License)
@@ -5349,7 +5349,7 @@ THE SOFTWARE.
5349
5349
 
5350
5350
  ---
5351
5351
 
5352
- The following software may be included in this product: @rollup/rollup-linux-x64-gnu (4.50.1)
5352
+ The following software may be included in this product: @rollup/rollup-darwin-arm64 (4.50.1)
5353
5353
  This software contains the following license and notice below:
5354
5354
 
5355
5355
  MIT License
@@ -5401,7 +5401,7 @@ SOFTWARE.
5401
5401
 
5402
5402
  ---
5403
5403
 
5404
- The following software may be included in this product: @rspack/binding-linux-x64-gnu (1.6.8)
5404
+ The following software may be included in this product: @rspack/binding-darwin-arm64 (1.6.8)
5405
5405
  This software contains the following license and notice below:
5406
5406
 
5407
5407
  MIT License
@@ -13165,6 +13165,34 @@ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHE
13165
13165
 
13166
13166
  ---
13167
13167
 
13168
+ The following software may be included in this product: fsevents (2.3.3)
13169
+ This software contains the following license and notice below:
13170
+
13171
+ MIT License
13172
+ -----------
13173
+
13174
+ Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller
13175
+
13176
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13177
+ of this software and associated documentation files (the "Software"), to deal
13178
+ in the Software without restriction, including without limitation the rights
13179
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13180
+ copies of the Software, and to permit persons to whom the Software is
13181
+ furnished to do so, subject to the following conditions:
13182
+
13183
+ The above copyright notice and this permission notice shall be included in
13184
+ all copies or substantial portions of the Software.
13185
+
13186
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13187
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13188
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13189
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13190
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13191
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
13192
+ THE SOFTWARE.
13193
+
13194
+ ---
13195
+
13168
13196
  The following software may be included in this product: function-bind (1.1.2)
13169
13197
  This software contains the following license and notice below:
13170
13198
 
@@ -39931,7 +39959,7 @@ defined by the Mozilla Public License, v. 2.0.
39931
39959
 
39932
39960
  ---
39933
39961
 
39934
- The following software may be included in this product: lightningcss-linux-x64-gnu (1.30.2)
39962
+ The following software may be included in this product: lightningcss-darwin-arm64 (1.30.2)
39935
39963
  This software contains the following license and notice below:
39936
39964
 
39937
39965
  Mozilla Public License Version 2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin",
3
- "version": "0.77.0",
3
+ "version": "0.78.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",
@@ -942,7 +942,10 @@ export class TestApi<
942
942
  } satisfies FunctionProps,
943
943
  buildDefaultIntegration: (op, props: FunctionProps) => {
944
944
  const handler = new Function(scope, \`TestApi\${op}Handler\`, props);
945
- return { handler, integration: new LambdaIntegration(handler) };
945
+ return {
946
+ handler,
947
+ integration: new LambdaIntegration(handler),
948
+ };
946
949
  },
947
950
  });
948
951
  };
@@ -3123,7 +3126,7 @@ terraform {
3123
3126
  required_providers {
3124
3127
  aws = {
3125
3128
  source = "hashicorp/aws"
3126
- version = "~> 6.0"
3129
+ version = "~> 6.33"
3127
3130
  }
3128
3131
  }
3129
3132
  }
@@ -3270,7 +3273,7 @@ output "api_root_resource_id" {
3270
3273
  required_providers {
3271
3274
  aws = {
3272
3275
  source = "hashicorp/aws"
3273
- version = "~> 6.0"
3276
+ version = "~> 6.33"
3274
3277
  }
3275
3278
  }
3276
3279
  }
@@ -3467,8 +3470,8 @@ resource "aws_api_gateway_integration" "lambda_integration" {
3467
3470
  http_method = aws_api_gateway_method.proxy_method.http_method
3468
3471
 
3469
3472
  integration_http_method = "POST"
3470
- type = "AWS_PROXY"
3471
- uri = aws_lambda_function.api_lambda.invoke_arn
3473
+ type = "AWS_PROXY"
3474
+ uri = aws_lambda_function.api_lambda.invoke_arn
3472
3475
 
3473
3476
  depends_on = [aws_lambda_function.api_lambda]
3474
3477
  }
@@ -3759,7 +3762,7 @@ terraform {
3759
3762
  required_providers {
3760
3763
  aws = {
3761
3764
  source = "hashicorp/aws"
3762
- version = "~> 6.0"
3765
+ version = "~> 6.33"
3763
3766
  }
3764
3767
  }
3765
3768
  }
@@ -3906,7 +3909,7 @@ output "api_root_resource_id" {
3906
3909
  required_providers {
3907
3910
  aws = {
3908
3911
  source = "hashicorp/aws"
3909
- version = "~> 6.0"
3912
+ version = "~> 6.33"
3910
3913
  }
3911
3914
  }
3912
3915
  }
@@ -4085,8 +4088,8 @@ resource "aws_api_gateway_integration" "lambda_integration" {
4085
4088
  http_method = aws_api_gateway_method.proxy_method.http_method
4086
4089
 
4087
4090
  integration_http_method = "POST"
4088
- type = "AWS_PROXY"
4089
- uri = aws_lambda_function.api_lambda.invoke_arn
4091
+ type = "AWS_PROXY"
4092
+ uri = aws_lambda_function.api_lambda.invoke_arn
4090
4093
 
4091
4094
  depends_on = [aws_lambda_function.api_lambda]
4092
4095
  }
@@ -4387,7 +4390,7 @@ terraform {
4387
4390
  required_providers {
4388
4391
  aws = {
4389
4392
  source = "hashicorp/aws"
4390
- version = "~> 6.0"
4393
+ version = "~> 6.33"
4391
4394
  }
4392
4395
  }
4393
4396
  }
@@ -4534,7 +4537,7 @@ output "api_root_resource_id" {
4534
4537
  required_providers {
4535
4538
  aws = {
4536
4539
  source = "hashicorp/aws"
4537
- version = "~> 6.0"
4540
+ version = "~> 6.33"
4538
4541
  }
4539
4542
  }
4540
4543
  }
@@ -4713,8 +4716,8 @@ resource "aws_api_gateway_integration" "lambda_integration" {
4713
4716
  http_method = aws_api_gateway_method.proxy_method.http_method
4714
4717
 
4715
4718
  integration_http_method = "POST"
4716
- type = "AWS_PROXY"
4717
- uri = aws_lambda_function.api_lambda.invoke_arn
4719
+ type = "AWS_PROXY"
4720
+ uri = aws_lambda_function.api_lambda.invoke_arn
4718
4721
 
4719
4722
  depends_on = [aws_lambda_function.api_lambda]
4720
4723
  }
@@ -182,7 +182,7 @@ const useCreateTestApiClient = (): TestApi => {
182
182
  () =>
183
183
  new TestApi({
184
184
  url: apiUrl,
185
- fetch: sigv4Client,
185
+ fetch: sigv4Client.fetch,
186
186
  }),
187
187
  [apiUrl, sigv4Client],
188
188
  );
@@ -57,7 +57,7 @@ const useCreateTestApiClient = (): TestApi => {
57
57
  () =>
58
58
  new TestApi({
59
59
  url: apiUrl,
60
- fetch: sigv4Client,
60
+ fetch: sigv4Client.fetch,
61
61
  }),
62
62
  [apiUrl, sigv4Client],
63
63
  );
@@ -175,7 +175,7 @@ const useCreateTestApiClient = (): TestApi => {
175
175
  () =>
176
176
  new TestApi({
177
177
  url: apiUrl,
178
- fetch: sigv4Client,
178
+ fetch: sigv4Client.fetch,
179
179
  }),
180
180
  [apiUrl, sigv4Client],
181
181
  );
@@ -123,7 +123,10 @@ export class TestApi<
123
123
  } satisfies FunctionProps,
124
124
  buildDefaultIntegration: (op, props: FunctionProps) => {
125
125
  const handler = new Function(scope, \`TestApi\${op}Handler\`, props);
126
- return { handler, integration: new LambdaIntegration(handler) };
126
+ return {
127
+ handler,
128
+ integration: new LambdaIntegration(handler),
129
+ };
127
130
  },
128
131
  });
129
132
  };
@@ -281,7 +284,10 @@ export class TestApi<
281
284
  } satisfies FunctionProps,
282
285
  buildDefaultIntegration: (op, props: FunctionProps) => {
283
286
  const handler = new Function(scope, \`TestApi\${op}Handler\`, props);
284
- return { handler, integration: new LambdaIntegration(handler) };
287
+ return {
288
+ handler,
289
+ integration: new LambdaIntegration(handler),
290
+ };
285
291
  },
286
292
  });
287
293
  };
@@ -385,7 +391,7 @@ terraform {
385
391
  required_providers {
386
392
  aws = {
387
393
  source = "hashicorp/aws"
388
- version = "~> 6.0"
394
+ version = "~> 6.33"
389
395
  }
390
396
  }
391
397
  }
@@ -535,7 +541,7 @@ exports[`tsSmithyApiGenerator > should generate smithy ts api with Terraform pro
535
541
  required_providers {
536
542
  aws = {
537
543
  source = "hashicorp/aws"
538
- version = "~> 6.0"
544
+ version = "~> 6.33"
539
545
  }
540
546
  }
541
547
  }
@@ -714,8 +720,8 @@ resource "aws_api_gateway_integration" "lambda_integration" {
714
720
  http_method = aws_api_gateway_method.proxy_method.http_method
715
721
 
716
722
  integration_http_method = "POST"
717
- type = "AWS_PROXY"
718
- uri = aws_lambda_function.api_lambda.invoke_arn
723
+ type = "AWS_PROXY"
724
+ uri = aws_lambda_function.api_lambda.invoke_arn
719
725
 
720
726
  depends_on = [aws_lambda_function.api_lambda]
721
727
  }
@@ -1391,7 +1397,7 @@ terraform {
1391
1397
  required_providers {
1392
1398
  aws = {
1393
1399
  source = "hashicorp/aws"
1394
- version = "~> 6.0"
1400
+ version = "~> 6.33"
1395
1401
  }
1396
1402
  }
1397
1403
  }
@@ -1538,7 +1544,7 @@ output "api_root_resource_id" {
1538
1544
  required_providers {
1539
1545
  aws = {
1540
1546
  source = "hashicorp/aws"
1541
- version = "~> 6.0"
1547
+ version = "~> 6.33"
1542
1548
  }
1543
1549
  }
1544
1550
  }
@@ -1735,8 +1741,8 @@ resource "aws_api_gateway_integration" "lambda_integration" {
1735
1741
  http_method = aws_api_gateway_method.proxy_method.http_method
1736
1742
 
1737
1743
  integration_http_method = "POST"
1738
- type = "AWS_PROXY"
1739
- uri = aws_lambda_function.api_lambda.invoke_arn
1744
+ type = "AWS_PROXY"
1745
+ uri = aws_lambda_function.api_lambda.invoke_arn
1740
1746
 
1741
1747
  depends_on = [aws_lambda_function.api_lambda]
1742
1748
  }
@@ -2027,7 +2033,7 @@ terraform {
2027
2033
  required_providers {
2028
2034
  aws = {
2029
2035
  source = "hashicorp/aws"
2030
- version = "~> 6.0"
2036
+ version = "~> 6.33"
2031
2037
  }
2032
2038
  }
2033
2039
  }
@@ -2174,7 +2180,7 @@ output "api_root_resource_id" {
2174
2180
  required_providers {
2175
2181
  aws = {
2176
2182
  source = "hashicorp/aws"
2177
- version = "~> 6.0"
2183
+ version = "~> 6.33"
2178
2184
  }
2179
2185
  }
2180
2186
  }
@@ -2353,8 +2359,8 @@ resource "aws_api_gateway_integration" "lambda_integration" {
2353
2359
  http_method = aws_api_gateway_method.proxy_method.http_method
2354
2360
 
2355
2361
  integration_http_method = "POST"
2356
- type = "AWS_PROXY"
2357
- uri = aws_lambda_function.api_lambda.invoke_arn
2362
+ type = "AWS_PROXY"
2363
+ uri = aws_lambda_function.api_lambda.invoke_arn
2358
2364
 
2359
2365
  depends_on = [aws_lambda_function.api_lambda]
2360
2366
  }
@@ -2651,7 +2657,7 @@ exports[`tsSmithyApiGenerator > terraform iacProvider > should generate terrafor
2651
2657
  required_providers {
2652
2658
  aws = {
2653
2659
  source = "hashicorp/aws"
2654
- version = "~> 6.0"
2660
+ version = "~> 6.33"
2655
2661
  }
2656
2662
  }
2657
2663
  }
@@ -2830,8 +2836,8 @@ resource "aws_api_gateway_integration" "lambda_integration" {
2830
2836
  http_method = aws_api_gateway_method.proxy_method.http_method
2831
2837
 
2832
2838
  integration_http_method = "POST"
2833
- type = "AWS_PROXY"
2834
- uri = aws_lambda_function.api_lambda.invoke_arn
2839
+ type = "AWS_PROXY"
2840
+ uri = aws_lambda_function.api_lambda.invoke_arn
2835
2841
 
2836
2842
  depends_on = [aws_lambda_function.api_lambda]
2837
2843
  }
@@ -29,6 +29,23 @@ export const createTestApiClient = (config: TestApiClientConfig) => {
29
29
  "
30
30
  `;
31
31
 
32
+ exports[`trpc backend generator > should generate the project > apps/test-api/src/handler.ts 1`] = `
33
+ "import {
34
+ CreateAWSLambdaContextOptions,
35
+ awsLambdaRequestHandler,
36
+ } from '@trpc/server/adapters/aws-lambda';
37
+ import type { APIGatewayProxyEventV2WithIAMAuthorizer } from 'aws-lambda';
38
+ import { appRouter } from './router.js';
39
+
40
+ export const handler = awsLambdaRequestHandler({
41
+ router: appRouter,
42
+ createContext: (
43
+ ctx: CreateAWSLambdaContextOptions<APIGatewayProxyEventV2WithIAMAuthorizer>,
44
+ ) => ctx,
45
+ });
46
+ "
47
+ `;
48
+
32
49
  exports[`trpc backend generator > should generate the project > apps/test-api/src/index.ts 1`] = `
33
50
  "export type { AppRouter } from './router.js';
34
51
  export { appRouter } from './router.js';
@@ -269,13 +286,8 @@ export const echo = publicProcedure
269
286
  `;
270
287
 
271
288
  exports[`trpc backend generator > should generate the project > apps/test-api/src/router.ts 1`] = `
272
- "import {
273
- awsLambdaRequestHandler,
274
- CreateAWSLambdaContextOptions,
275
- } from '@trpc/server/adapters/aws-lambda';
276
- import { echo } from './procedures/echo.js';
289
+ "import { echo } from './procedures/echo.js';
277
290
  import { t } from './init.js';
278
- import type { APIGatewayProxyEventV2WithIAMAuthorizer } from 'aws-lambda';
279
291
 
280
292
  export const router = t.router;
281
293
 
@@ -283,13 +295,6 @@ export const appRouter = router({
283
295
  echo,
284
296
  });
285
297
 
286
- export const handler = awsLambdaRequestHandler({
287
- router: appRouter,
288
- createContext: (
289
- ctx: CreateAWSLambdaContextOptions<APIGatewayProxyEventV2WithIAMAuthorizer>,
290
- ) => ctx,
291
- });
292
-
293
298
  export type AppRouter = typeof appRouter;
294
299
  "
295
300
  `;
@@ -359,6 +364,7 @@ import {
359
364
  AuthorizationType,
360
365
  Cors,
361
366
  LambdaIntegration,
367
+ ResponseTransferMode,
362
368
  CognitoUserPoolsAuthorizer,
363
369
  } from 'aws-cdk-lib/aws-apigateway';
364
370
  import { Duration } from 'aws-cdk-lib';
@@ -437,7 +443,12 @@ export class TestApi<
437
443
  } satisfies FunctionProps,
438
444
  buildDefaultIntegration: (op, props: FunctionProps) => {
439
445
  const handler = new Function(scope, \`TestApi\${op}Handler\`, props);
440
- return { handler, integration: new LambdaIntegration(handler) };
446
+ return {
447
+ handler,
448
+ integration: new LambdaIntegration(handler, {
449
+ responseTransferMode: ResponseTransferMode.STREAM,
450
+ }),
451
+ };
441
452
  },
442
453
  });
443
454
  };
@@ -747,6 +758,7 @@ import {
747
758
  AuthorizationType,
748
759
  Cors,
749
760
  LambdaIntegration,
761
+ ResponseTransferMode,
750
762
  } from 'aws-cdk-lib/aws-apigateway';
751
763
  import { Duration } from 'aws-cdk-lib';
752
764
  import {
@@ -817,7 +829,12 @@ export class TestApi<
817
829
  } satisfies FunctionProps,
818
830
  buildDefaultIntegration: (op, props: FunctionProps) => {
819
831
  const handler = new Function(scope, \`TestApi\${op}Handler\`, props);
820
- return { handler, integration: new LambdaIntegration(handler) };
832
+ return {
833
+ handler,
834
+ integration: new LambdaIntegration(handler, {
835
+ responseTransferMode: ResponseTransferMode.STREAM,
836
+ }),
837
+ };
821
838
  },
822
839
  });
823
840
  };
@@ -1436,9 +1453,9 @@ export const routerToOperations = <TRouter extends AnyTRPCRouter>(
1436
1453
  {
1437
1454
  path: fullPath,
1438
1455
  method:
1439
- procedureOrRouter._def.type === 'query'
1440
- ? HttpMethod.GET
1441
- : HttpMethod.POST,
1456
+ procedureOrRouter._def.type === 'mutation'
1457
+ ? HttpMethod.POST
1458
+ : HttpMethod.GET,
1442
1459
  },
1443
1460
  ],
1444
1461
  ];
@@ -1827,6 +1844,7 @@ import {
1827
1844
  AuthorizationType,
1828
1845
  Cors,
1829
1846
  LambdaIntegration,
1847
+ ResponseTransferMode,
1830
1848
  } from 'aws-cdk-lib/aws-apigateway';
1831
1849
  import { Duration } from 'aws-cdk-lib';
1832
1850
  import {
@@ -1899,7 +1917,12 @@ export class TestApi<
1899
1917
  } satisfies FunctionProps,
1900
1918
  buildDefaultIntegration: (op, props: FunctionProps) => {
1901
1919
  const handler = new Function(scope, \`TestApi\${op}Handler\`, props);
1902
- return { handler, integration: new LambdaIntegration(handler) };
1920
+ return {
1921
+ handler,
1922
+ integration: new LambdaIntegration(handler, {
1923
+ responseTransferMode: ResponseTransferMode.STREAM,
1924
+ }),
1925
+ };
1903
1926
  },
1904
1927
  });
1905
1928
  };
@@ -2051,9 +2074,9 @@ export const routerToOperations = <TRouter extends AnyTRPCRouter>(
2051
2074
  {
2052
2075
  path: fullPath,
2053
2076
  method:
2054
- procedureOrRouter._def.type === 'query'
2055
- ? HttpMethod.GET
2056
- : HttpMethod.POST,
2077
+ procedureOrRouter._def.type === 'mutation'
2078
+ ? HttpMethod.POST
2079
+ : HttpMethod.GET,
2057
2080
  },
2058
2081
  ],
2059
2082
  ];
@@ -4151,7 +4174,7 @@ terraform {
4151
4174
  required_providers {
4152
4175
  aws = {
4153
4176
  source = "hashicorp/aws"
4154
- version = "~> 6.0"
4177
+ version = "~> 6.33"
4155
4178
  }
4156
4179
  }
4157
4180
  }
@@ -4298,7 +4321,7 @@ output "api_root_resource_id" {
4298
4321
  required_providers {
4299
4322
  aws = {
4300
4323
  source = "hashicorp/aws"
4301
- version = "~> 6.0"
4324
+ version = "~> 6.33"
4302
4325
  }
4303
4326
  }
4304
4327
  }
@@ -4495,8 +4518,9 @@ resource "aws_api_gateway_integration" "lambda_integration" {
4495
4518
  http_method = aws_api_gateway_method.proxy_method.http_method
4496
4519
 
4497
4520
  integration_http_method = "POST"
4498
- type = "AWS_PROXY"
4499
- uri = aws_lambda_function.api_lambda.invoke_arn
4521
+ type = "AWS_PROXY"
4522
+ uri = aws_lambda_function.api_lambda.response_streaming_invoke_arn
4523
+ response_transfer_mode = "STREAM"
4500
4524
 
4501
4525
  depends_on = [aws_lambda_function.api_lambda]
4502
4526
  }
@@ -4787,7 +4811,7 @@ terraform {
4787
4811
  required_providers {
4788
4812
  aws = {
4789
4813
  source = "hashicorp/aws"
4790
- version = "~> 6.0"
4814
+ version = "~> 6.33"
4791
4815
  }
4792
4816
  }
4793
4817
  }
@@ -4934,7 +4958,7 @@ output "api_root_resource_id" {
4934
4958
  required_providers {
4935
4959
  aws = {
4936
4960
  source = "hashicorp/aws"
4937
- version = "~> 6.0"
4961
+ version = "~> 6.33"
4938
4962
  }
4939
4963
  }
4940
4964
  }
@@ -5113,8 +5137,9 @@ resource "aws_api_gateway_integration" "lambda_integration" {
5113
5137
  http_method = aws_api_gateway_method.proxy_method.http_method
5114
5138
 
5115
5139
  integration_http_method = "POST"
5116
- type = "AWS_PROXY"
5117
- uri = aws_lambda_function.api_lambda.invoke_arn
5140
+ type = "AWS_PROXY"
5141
+ uri = aws_lambda_function.api_lambda.response_streaming_invoke_arn
5142
+ response_transfer_mode = "STREAM"
5118
5143
 
5119
5144
  depends_on = [aws_lambda_function.api_lambda]
5120
5145
  }
@@ -5415,7 +5440,7 @@ terraform {
5415
5440
  required_providers {
5416
5441
  aws = {
5417
5442
  source = "hashicorp/aws"
5418
- version = "~> 6.0"
5443
+ version = "~> 6.33"
5419
5444
  }
5420
5445
  }
5421
5446
  }
@@ -5562,7 +5587,7 @@ output "api_root_resource_id" {
5562
5587
  required_providers {
5563
5588
  aws = {
5564
5589
  source = "hashicorp/aws"
5565
- version = "~> 6.0"
5590
+ version = "~> 6.33"
5566
5591
  }
5567
5592
  }
5568
5593
  }
@@ -5741,8 +5766,9 @@ resource "aws_api_gateway_integration" "lambda_integration" {
5741
5766
  http_method = aws_api_gateway_method.proxy_method.http_method
5742
5767
 
5743
5768
  integration_http_method = "POST"
5744
- type = "AWS_PROXY"
5745
- uri = aws_lambda_function.api_lambda.invoke_arn
5769
+ type = "AWS_PROXY"
5770
+ uri = aws_lambda_function.api_lambda.response_streaming_invoke_arn
5771
+ response_transfer_mode = "STREAM"
5746
5772
 
5747
5773
  depends_on = [aws_lambda_function.api_lambda]
5748
5774
  }
@@ -0,0 +1,48 @@
1
+ import {
2
+ CreateAWSLambdaContextOptions,
3
+ <%_ if (computeType === 'ServerlessApiGatewayRestApi') { _%>
4
+ awsLambdaStreamingRequestHandler,
5
+ <%_ } else { _%>
6
+ awsLambdaRequestHandler,
7
+ <%_ } _%>
8
+ } from '@trpc/server/adapters/aws-lambda';
9
+ import type { <%- apiGatewayEventType %> } from 'aws-lambda';
10
+ import { appRouter } from './router.js';
11
+
12
+ <%_ if (computeType === 'ServerlessApiGatewayRestApi') { _%>
13
+ export const handler = awslambda.streamifyResponse(
14
+ awsLambdaStreamingRequestHandler({
15
+ router: appRouter,
16
+ createContext: (ctx: CreateAWSLambdaContextOptions<<%- apiGatewayEventType %>>) => ctx,
17
+ responseMeta: ({ ctx }) => ({
18
+ headers: {
19
+ 'Access-Control-Allow-Origin': getAllowedOrigin(ctx?.event),
20
+ 'Access-Control-Allow-Methods': '*',
21
+ },
22
+ }),
23
+ }),
24
+ );
25
+
26
+ /**
27
+ * Restricts CORS origins to localhost and the domains specified in
28
+ * the ALLOWED_ORIGINS environment variable if set, or * otherwise.
29
+ * Customise using `restrictCorsTo` in your API CDK construct
30
+ */
31
+ const getAllowedOrigin = (event: <%- apiGatewayEventType %> | undefined) => {
32
+ const origin = event?.headers?.origin ?? event?.headers?.Origin;
33
+ const allowedOrigins = process.env.ALLOWED_ORIGINS?.split(',') ?? [];
34
+ const isLocalHost =
35
+ origin && new Set(['localhost', '127.0.0.1']).has(new URL(origin).hostname);
36
+ const isAllowedOrigin = origin && allowedOrigins.includes(origin);
37
+ let corsOrigin = '*';
38
+ if (allowedOrigins.length > 0 && !isLocalHost) {
39
+ corsOrigin = isAllowedOrigin ? origin : allowedOrigins[0];
40
+ }
41
+ return corsOrigin;
42
+ };
43
+ <%_ } else { _%>
44
+ export const handler = awsLambdaRequestHandler({
45
+ router: appRouter,
46
+ createContext: (ctx: CreateAWSLambdaContextOptions<<%- apiGatewayEventType %>>) => ctx,
47
+ });
48
+ <%_ } _%>
@@ -2,4 +2,4 @@ export type { AppRouter } from './router.js';
2
2
  export { appRouter } from './router.js';
3
3
  export type { Context } from './init.js';
4
4
  export * from './client/index.js';
5
- export * from './schema/index.js';
5
+ export * from './schema/index.js';