@aws/nx-plugin 1.0.1 → 1.0.3

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 (60) hide show
  1. package/LICENSE-THIRD-PARTY +25 -9
  2. package/migrations.json +20 -10
  3. package/package.json +6 -6
  4. package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +3 -3
  5. package/src/agentcore-gateway/agent-connection/generator.js +6 -0
  6. package/src/agentcore-gateway/agent-connection/generator.js.map +1 -1
  7. package/src/connection/scaffold-catalog.d.ts +17 -0
  8. package/src/connection/scaffold-catalog.js +11 -0
  9. package/src/connection/scaffold-catalog.js.map +1 -1
  10. package/src/infra/app/__snapshots__/generator.spec.ts.snap +3 -3
  11. package/src/migrations/latest/terraform-init-target/metadata.json +3 -0
  12. package/src/migrations/latest/terraform-init-target/migration.js +153 -0
  13. package/src/migrations/latest/terraform-init-target/migration.js.map +1 -0
  14. package/src/migrations/v1.0.0-rc.98/0001-sandbox-pattern-nested-stacks/migration.js.map +1 -0
  15. package/src/migrations/v1.0.0-rc.98/0002-shadcn-cn-package/migration.d.ts +6 -0
  16. package/src/migrations/v1.0.0-rc.98/0002-shadcn-cn-package/migration.js.map +1 -0
  17. package/src/migrations/v1.0.2/0001-terraform-harness-environment-variables/metadata.json +3 -0
  18. package/src/migrations/v1.0.2/0001-terraform-harness-environment-variables/migration.d.ts +6 -0
  19. package/src/migrations/v1.0.2/0001-terraform-harness-environment-variables/migration.js +54 -0
  20. package/src/migrations/v1.0.2/0001-terraform-harness-environment-variables/migration.js.map +1 -0
  21. package/src/preset/__snapshots__/generator.spec.ts.snap +2 -2
  22. package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +7 -7
  23. package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +9 -9
  24. package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +8 -8
  25. package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +3 -3
  26. package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +27 -27
  27. package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +6 -6
  28. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +8 -8
  29. package/src/py/rdb/__snapshots__/generator.spec.ts.snap +9 -9
  30. package/src/sdk/open-api.d.ts +2 -2
  31. package/src/sdk/open-api.js +1 -1
  32. package/src/sdk/open-api.js.map +1 -1
  33. package/src/smithy/project/__snapshots__/generator.spec.ts.snap +5 -5
  34. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +19 -19
  35. package/src/terraform/project/generator.js +52 -44
  36. package/src/terraform/project/generator.js.map +1 -1
  37. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +27 -27
  38. package/src/ts/agent/__snapshots__/generator.spec.ts.snap +7 -7
  39. package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +3 -3
  40. package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +3 -3
  41. package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +6 -6
  42. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +4 -4
  43. package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +17 -17
  44. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +28 -28
  45. package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +3 -3
  46. package/src/utils/agent-core-constructs/files/terraform/app/agentcore-harness/__nameKebabCase__/__nameKebabCase__.tf.template +1 -1
  47. package/src/utils/test-migration.d.ts +20 -0
  48. package/src/utils/test-migration.js +32 -0
  49. package/src/utils/test-migration.js.map +1 -0
  50. package/src/utils/versions.d.ts +86 -86
  51. package/src/utils/versions.js +79 -79
  52. package/src/utils/versions.js.map +1 -1
  53. package/src/migrations/latest/sandbox-pattern-nested-stacks/migration.js.map +0 -1
  54. package/src/migrations/latest/shadcn-cn-package/migration.js.map +0 -1
  55. /package/src/migrations/latest/{sandbox-pattern-nested-stacks → terraform-init-target}/migration.d.ts +0 -0
  56. /package/src/migrations/{latest/sandbox-pattern-nested-stacks → v1.0.0-rc.98/0001-sandbox-pattern-nested-stacks}/metadata.json +0 -0
  57. /package/src/migrations/{latest/shadcn-cn-package → v1.0.0-rc.98/0001-sandbox-pattern-nested-stacks}/migration.d.ts +0 -0
  58. /package/src/migrations/{latest/sandbox-pattern-nested-stacks → v1.0.0-rc.98/0001-sandbox-pattern-nested-stacks}/migration.js +0 -0
  59. /package/src/migrations/{latest/shadcn-cn-package → v1.0.0-rc.98/0002-shadcn-cn-package}/metadata.json +0 -0
  60. /package/src/migrations/{latest/shadcn-cn-package → v1.0.0-rc.98/0002-shadcn-cn-package}/migration.js +0 -0
@@ -71,15 +71,15 @@ exports[`lambda-handler project generator > terraform iac > should generate terr
71
71
  required_providers {
72
72
  aws = {
73
73
  source = "hashicorp/aws"
74
- version = "6.63.0"
74
+ version = "6.66.0"
75
75
  }
76
76
  archive = {
77
77
  source = "hashicorp/archive"
78
- version = "2.8.0"
78
+ version = "2.8.1"
79
79
  }
80
80
  random = {
81
81
  source = "hashicorp/random"
82
- version = "3.9.0"
82
+ version = "3.9.1"
83
83
  }
84
84
  }
85
85
  }
@@ -256,15 +256,15 @@ exports[`lambda-handler project generator > terraform iac > should match snapsho
256
256
  required_providers {
257
257
  aws = {
258
258
  source = "hashicorp/aws"
259
- version = "6.63.0"
259
+ version = "6.66.0"
260
260
  }
261
261
  archive = {
262
262
  source = "hashicorp/archive"
263
- version = "2.8.0"
263
+ version = "2.8.1"
264
264
  }
265
265
  random = {
266
266
  source = "hashicorp/random"
267
- version = "3.9.0"
267
+ version = "3.9.1"
268
268
  }
269
269
  }
270
270
  }
@@ -155,15 +155,15 @@ exports[`py#mcp-server generator > should match snapshot for Terraform generated
155
155
  required_providers {
156
156
  aws = {
157
157
  source = "hashicorp/aws"
158
- version = "6.63.0"
158
+ version = "6.66.0"
159
159
  }
160
160
  null = {
161
161
  source = "hashicorp/null"
162
- version = "3.3.1"
162
+ version = "3.3.2"
163
163
  }
164
164
  random = {
165
165
  source = "hashicorp/random"
166
- version = "3.9.0"
166
+ version = "3.9.1"
167
167
  }
168
168
  }
169
169
  }
@@ -514,7 +514,7 @@ resource "null_resource" "runtime_ready" {
514
514
 
515
515
  provisioner "local-exec" {
516
516
  command = <<-EOT
517
- uv run --with boto3==1.43.89 python -c "
517
+ uv run --with boto3==1.43.98 python -c "
518
518
  import boto3
519
519
  import json
520
520
  import os
@@ -801,11 +801,11 @@ exports[`py#mcp-server generator > should match snapshot for generated files > u
801
801
  name = "proj.test_project"
802
802
  version = "0.1.0"
803
803
  dependencies = [
804
- "aws-lambda-powertools==3.34.0",
804
+ "aws-lambda-powertools==3.35.0",
805
805
  "mcp==1.28.1",
806
- "uvicorn==0.52.4",
807
- "boto3==1.43.89",
808
- "aws-opentelemetry-distro==0.19.0"
806
+ "uvicorn==0.53.0",
807
+ "boto3==1.43.98",
808
+ "aws-opentelemetry-distro==0.20.0"
809
809
  ]
810
810
 
811
811
  [dependency-groups]
@@ -218,23 +218,23 @@ exports[`py#rdb generator > should generate Terraform modules 1`] = `
218
218
  required_providers {
219
219
  archive = {
220
220
  source = "hashicorp/archive"
221
- version = "2.8.0"
221
+ version = "2.8.1"
222
222
  }
223
223
  aws = {
224
224
  source = "hashicorp/aws"
225
- version = "6.63.0"
225
+ version = "6.66.0"
226
226
  }
227
227
  external = {
228
228
  source = "hashicorp/external"
229
- version = "2.4.1"
229
+ version = "2.4.2"
230
230
  }
231
231
  null = {
232
232
  source = "hashicorp/null"
233
- version = "3.3.1"
233
+ version = "3.3.2"
234
234
  }
235
235
  random = {
236
236
  source = "hashicorp/random"
237
- version = "3.9.0"
237
+ version = "3.9.1"
238
238
  }
239
239
  }
240
240
  }
@@ -1492,11 +1492,11 @@ requires-python = ">=3.14"
1492
1492
  readme = "README.md"
1493
1493
  dependencies = [
1494
1494
  "sqlmodel==0.0.42",
1495
- "alembic==1.19.2",
1496
- "greenlet==3.5.5",
1495
+ "alembic==1.20.0",
1496
+ "greenlet==3.5.6",
1497
1497
  "asyncpg==0.31.0",
1498
- "boto3==1.43.89",
1499
- "aws-lambda-powertools==3.34.0"
1498
+ "boto3==1.43.98",
1499
+ "aws-lambda-powertools==3.35.0"
1500
1500
  ]
1501
1501
 
1502
1502
  [build-system]
@@ -4,10 +4,10 @@
4
4
  */
5
5
  export { openApiJsonMetadataGenerator } from '../open-api/json-metadata/generator.js';
6
6
  export type { OpenApiJsonMetadataGeneratorSchema } from '../open-api/json-metadata/schema';
7
- export { buildOpenApiCodeGenerationData, openApiTsClientGenerator, } from '../open-api/ts-client/generator.js';
8
- export type { OpenApiTsClientGeneratorSchema } from '../open-api/ts-client/schema';
9
7
  export { openApiPyClientGenerator } from '../open-api/py-client/generator.js';
10
8
  export type { OpenApiPyClientGeneratorSchema } from '../open-api/py-client/schema';
9
+ export { buildOpenApiCodeGenerationData, openApiTsClientGenerator, } from '../open-api/ts-client/generator.js';
10
+ export type { OpenApiTsClientGeneratorSchema } from '../open-api/ts-client/schema';
11
11
  export { openApiTsHooksGenerator } from '../open-api/ts-hooks/generator.js';
12
12
  export type { OpenApiTsHooksGeneratorSchema } from '../open-api/ts-hooks/schema';
13
13
  export { openApiTsMetadataGenerator } from '../open-api/ts-metadata/generator.js';
@@ -2,8 +2,8 @@
2
2
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */ export { openApiJsonMetadataGenerator } from "../open-api/json-metadata/generator.js";
5
- export { buildOpenApiCodeGenerationData, openApiTsClientGenerator } from "../open-api/ts-client/generator.js";
6
5
  export { openApiPyClientGenerator } from "../open-api/py-client/generator.js";
6
+ export { buildOpenApiCodeGenerationData, openApiTsClientGenerator } from "../open-api/ts-client/generator.js";
7
7
  export { openApiTsHooksGenerator } from "../open-api/ts-hooks/generator.js";
8
8
  export { openApiTsMetadataGenerator } from "../open-api/ts-metadata/generator.js";
9
9
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/sdk/open-api.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { openApiJsonMetadataGenerator } from '../open-api/json-metadata/generator.js';\nexport type { OpenApiJsonMetadataGeneratorSchema } from '../open-api/json-metadata/schema';\nexport {\n buildOpenApiCodeGenerationData,\n openApiTsClientGenerator,\n} from '../open-api/ts-client/generator.js';\nexport type { OpenApiTsClientGeneratorSchema } from '../open-api/ts-client/schema';\n\nexport { openApiPyClientGenerator } from '../open-api/py-client/generator.js';\nexport type { OpenApiPyClientGeneratorSchema } from '../open-api/py-client/schema';\n\nexport { openApiTsHooksGenerator } from '../open-api/ts-hooks/generator.js';\nexport type { OpenApiTsHooksGeneratorSchema } from '../open-api/ts-hooks/schema';\n\nexport { openApiTsMetadataGenerator } from '../open-api/ts-metadata/generator.js';\nexport type { OpenApiTsMetadataGeneratorSchema } from '../open-api/ts-metadata/schema';\n"],"names":["openApiJsonMetadataGenerator","buildOpenApiCodeGenerationData","openApiTsClientGenerator","openApiPyClientGenerator","openApiTsHooksGenerator","openApiTsMetadataGenerator"],"mappings":"AAAA;;;CAGC,GAED,SAASA,4BAA4B,QAAQ,yCAAyC;AAEtF,SACEC,8BAA8B,EAC9BC,wBAAwB,QACnB,qCAAqC;AAG5C,SAASC,wBAAwB,QAAQ,qCAAqC;AAG9E,SAASC,uBAAuB,QAAQ,oCAAoC;AAG5E,SAASC,0BAA0B,QAAQ,uCAAuC"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/sdk/open-api.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { openApiJsonMetadataGenerator } from '../open-api/json-metadata/generator.js';\nexport type { OpenApiJsonMetadataGeneratorSchema } from '../open-api/json-metadata/schema';\nexport { openApiPyClientGenerator } from '../open-api/py-client/generator.js';\nexport type { OpenApiPyClientGeneratorSchema } from '../open-api/py-client/schema';\nexport {\n buildOpenApiCodeGenerationData,\n openApiTsClientGenerator,\n} from '../open-api/ts-client/generator.js';\nexport type { OpenApiTsClientGeneratorSchema } from '../open-api/ts-client/schema';\n\nexport { openApiTsHooksGenerator } from '../open-api/ts-hooks/generator.js';\nexport type { OpenApiTsHooksGeneratorSchema } from '../open-api/ts-hooks/schema';\n\nexport { openApiTsMetadataGenerator } from '../open-api/ts-metadata/generator.js';\nexport type { OpenApiTsMetadataGeneratorSchema } from '../open-api/ts-metadata/schema';\n"],"names":["openApiJsonMetadataGenerator","openApiPyClientGenerator","buildOpenApiCodeGenerationData","openApiTsClientGenerator","openApiTsHooksGenerator","openApiTsMetadataGenerator"],"mappings":"AAAA;;;CAGC,GAED,SAASA,4BAA4B,QAAQ,yCAAyC;AAEtF,SAASC,wBAAwB,QAAQ,qCAAqC;AAE9E,SACEC,8BAA8B,EAC9BC,wBAAwB,QACnB,qCAAqC;AAG5C,SAASC,uBAAuB,QAAQ,oCAAoC;AAG5E,SAASC,0BAA0B,QAAQ,uCAAuC"}
@@ -45,7 +45,7 @@ exports[`smithyProjectGenerator > shape libraries > should generate a shape libr
45
45
  "shx rm -rf dist/{projectRoot}/build",
46
46
  "shx rm -rf dist/{projectRoot}/smithy",
47
47
  "shx mkdir -p dist/{projectRoot}/build",
48
- "npx -y mise@2026.9.1 exec smithy@1.73.0 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
48
+ "npx -y mise@2026.9.12 exec smithy@1.73.0 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
49
49
  "shx cp dist/{projectRoot}/smithy/source/model/model.json dist/{projectRoot}/build/model.json"
50
50
  ],
51
51
  "parallel": false,
@@ -122,7 +122,7 @@ exports[`smithyProjectGenerator > should generate smithy project with all custom
122
122
  "shx rm -rf dist/{projectRoot}/build",
123
123
  "shx rm -rf dist/{projectRoot}/smithy",
124
124
  "shx mkdir -p dist/{projectRoot}/build",
125
- "npx -y mise@2026.9.1 exec smithy@1.73.0 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
125
+ "npx -y mise@2026.9.12 exec smithy@1.73.0 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
126
126
  "shx mkdir -p dist/{projectRoot}/build/openapi",
127
127
  "shx cp \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi/openapi.json"
128
128
  ],
@@ -180,7 +180,7 @@ exports[`smithyProjectGenerator > should generate smithy project with custom dir
180
180
  "shx rm -rf dist/{projectRoot}/build",
181
181
  "shx rm -rf dist/{projectRoot}/smithy",
182
182
  "shx mkdir -p dist/{projectRoot}/build",
183
- "npx -y mise@2026.9.1 exec smithy@1.73.0 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
183
+ "npx -y mise@2026.9.12 exec smithy@1.73.0 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
184
184
  "shx mkdir -p dist/{projectRoot}/build/openapi",
185
185
  "shx cp \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi/openapi.json"
186
186
  ],
@@ -330,7 +330,7 @@ exports[`smithyProjectGenerator > should generate smithy project with default op
330
330
  "shx rm -rf dist/{projectRoot}/build",
331
331
  "shx rm -rf dist/{projectRoot}/smithy",
332
332
  "shx mkdir -p dist/{projectRoot}/build",
333
- "npx -y mise@2026.9.1 exec smithy@1.73.0 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
333
+ "npx -y mise@2026.9.12 exec smithy@1.73.0 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
334
334
  "shx mkdir -p dist/{projectRoot}/build/openapi",
335
335
  "shx cp \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi/openapi.json"
336
336
  ],
@@ -474,7 +474,7 @@ exports[`smithyProjectGenerator > should generate smithy project with subdirecto
474
474
  "shx rm -rf dist/{projectRoot}/build",
475
475
  "shx rm -rf dist/{projectRoot}/smithy",
476
476
  "shx mkdir -p dist/{projectRoot}/build",
477
- "npx -y mise@2026.9.1 exec smithy@1.73.0 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
477
+ "npx -y mise@2026.9.12 exec smithy@1.73.0 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
478
478
  "shx mkdir -p dist/{projectRoot}/build/openapi",
479
479
  "shx cp \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi/openapi.json"
480
480
  ],
@@ -416,11 +416,11 @@ terraform {
416
416
  required_providers {
417
417
  aws = {
418
418
  source = "hashicorp/aws"
419
- version = "6.63.0"
419
+ version = "6.66.0"
420
420
  }
421
421
  random = {
422
422
  source = "hashicorp/random"
423
- version = "3.9.0"
423
+ version = "3.9.1"
424
424
  }
425
425
  }
426
426
  }
@@ -728,15 +728,15 @@ exports[`tsSmithyApiGenerator > should generate smithy ts api with Terraform pro
728
728
  required_providers {
729
729
  archive = {
730
730
  source = "hashicorp/archive"
731
- version = "2.8.0"
731
+ version = "2.8.1"
732
732
  }
733
733
  aws = {
734
734
  source = "hashicorp/aws"
735
- version = "6.63.0"
735
+ version = "6.66.0"
736
736
  }
737
737
  random = {
738
738
  source = "hashicorp/random"
739
- version = "3.9.0"
739
+ version = "3.9.1"
740
740
  }
741
741
  }
742
742
  }
@@ -2113,7 +2113,7 @@ exports[`tsSmithyApiGenerator > should generate smithy ts api with default optio
2113
2113
  "shx rm -rf dist/{projectRoot}/build",
2114
2114
  "shx rm -rf dist/{projectRoot}/smithy",
2115
2115
  "shx mkdir -p dist/{projectRoot}/build",
2116
- "npx -y mise@2026.9.1 exec smithy@1.73.0 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
2116
+ "npx -y mise@2026.9.12 exec smithy@1.73.0 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
2117
2117
  "shx mkdir -p dist/{projectRoot}/build/openapi",
2118
2118
  "shx cp \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi/openapi.json"
2119
2119
  ],
@@ -2253,11 +2253,11 @@ terraform {
2253
2253
  required_providers {
2254
2254
  aws = {
2255
2255
  source = "hashicorp/aws"
2256
- version = "6.63.0"
2256
+ version = "6.66.0"
2257
2257
  }
2258
2258
  random = {
2259
2259
  source = "hashicorp/random"
2260
- version = "3.9.0"
2260
+ version = "3.9.1"
2261
2261
  }
2262
2262
  }
2263
2263
  }
@@ -2562,15 +2562,15 @@ output "waf_web_acl_arn" {
2562
2562
  required_providers {
2563
2563
  archive = {
2564
2564
  source = "hashicorp/archive"
2565
- version = "2.8.0"
2565
+ version = "2.8.1"
2566
2566
  }
2567
2567
  aws = {
2568
2568
  source = "hashicorp/aws"
2569
- version = "6.63.0"
2569
+ version = "6.66.0"
2570
2570
  }
2571
2571
  random = {
2572
2572
  source = "hashicorp/random"
2573
- version = "3.9.0"
2573
+ version = "3.9.1"
2574
2574
  }
2575
2575
  }
2576
2576
  }
@@ -3566,11 +3566,11 @@ terraform {
3566
3566
  required_providers {
3567
3567
  aws = {
3568
3568
  source = "hashicorp/aws"
3569
- version = "6.63.0"
3569
+ version = "6.66.0"
3570
3570
  }
3571
3571
  random = {
3572
3572
  source = "hashicorp/random"
3573
- version = "3.9.0"
3573
+ version = "3.9.1"
3574
3574
  }
3575
3575
  }
3576
3576
  }
@@ -3875,15 +3875,15 @@ output "waf_web_acl_arn" {
3875
3875
  required_providers {
3876
3876
  archive = {
3877
3877
  source = "hashicorp/archive"
3878
- version = "2.8.0"
3878
+ version = "2.8.1"
3879
3879
  }
3880
3880
  aws = {
3881
3881
  source = "hashicorp/aws"
3882
- version = "6.63.0"
3882
+ version = "6.66.0"
3883
3883
  }
3884
3884
  random = {
3885
3885
  source = "hashicorp/random"
3886
- version = "3.9.0"
3886
+ version = "3.9.1"
3887
3887
  }
3888
3888
  }
3889
3889
  }
@@ -4864,15 +4864,15 @@ exports[`tsSmithyApiGenerator > terraform iac > should generate terraform with c
4864
4864
  required_providers {
4865
4865
  archive = {
4866
4866
  source = "hashicorp/archive"
4867
- version = "2.8.0"
4867
+ version = "2.8.1"
4868
4868
  }
4869
4869
  aws = {
4870
4870
  source = "hashicorp/aws"
4871
- version = "6.63.0"
4871
+ version = "6.66.0"
4872
4872
  }
4873
4873
  random = {
4874
4874
  source = "hashicorp/random"
4875
- version = "3.9.0"
4875
+ version = "3.9.1"
4876
4876
  }
4877
4877
  }
4878
4878
  }
@@ -112,11 +112,10 @@ export async function terraformProjectGenerator(tree, schema) {
112
112
  const distDir = joinPathFragments(outDirToRootRelativePath, 'dist', '{projectRoot}');
113
113
  const tfDistDir = joinPathFragments(distDir, 'terraform');
114
114
  const checkovReportJsonPath = joinPathFragments(distDir, 'checkov', 'checkov_report.json');
115
- // `test` and `validate` each keep their `.terraform` here rather than in
116
- // `src`, so initialising one never races the backend-configured targets, or
117
- // the other, over the shared one.
118
- const testDataDir = joinPathFragments(distDir, 'terraform-test');
119
- const validateDataDir = joinPathFragments(distDir, 'terraform-validate');
115
+ // `terraform-init` keeps its `.terraform` here rather than in `src`, so it
116
+ // never races the backend-configured targets over the shared one. `test` and
117
+ // `validate` read this same directory rather than initialising their own.
118
+ const initDataDir = joinPathFragments(distDir, 'terraform-init');
120
119
  // Provider downloads persist here, so a target whose `.terraform` was cleaned
121
120
  // links the providers it already has rather than re-downloading them. Nx does
122
121
  // not interpolate `{workspaceRoot}` inside `env`, so this is relative to the
@@ -128,7 +127,8 @@ export async function terraformProjectGenerator(tree, schema) {
128
127
  // init` runs filling a shared cache concurrently each compute a different hash
129
128
  // for the same provider, because the hash covers a directory the other is
130
129
  // still writing, and terraform then rejects the mismatch against the lock
131
- // file. Per project, no two writers ever meet, so the targets stay parallel.
130
+ // file. `terraform-init` is the only target that fills it, and the targets that
131
+ // need the providers depend on that one, so no two writers ever meet.
132
132
  const pluginCacheDir = joinPathFragments(outDirToRootRelativePath, '.terraform', 'plugin-cache', '{projectRoot}');
133
133
  // Calculate relative path from current project to common/terraform/metrics
134
134
  // Use forward slashes for terraform module source paths (even on Windows)
@@ -227,6 +227,7 @@ export async function terraformProjectGenerator(tree, schema) {
227
227
  cwd: '{workspaceRoot}'
228
228
  },
229
229
  dependsOn: [
230
+ 'terraform-init',
230
231
  '^init'
231
232
  ]
232
233
  },
@@ -310,6 +311,32 @@ export async function terraformProjectGenerator(tree, schema) {
310
311
  env: {
311
312
  TF_PLUGIN_CACHE_DIR: pluginCacheDir
312
313
  }
314
+ },
315
+ dependsOn: [
316
+ 'terraform-init'
317
+ ]
318
+ },
319
+ // `-backend=false` installs the modules and providers without configuring
320
+ // the S3 backend, so this needs no credentials and runs on a fresh
321
+ // workspace before `bootstrap`. Uncached: a cache hit on another machine
322
+ // would report success over an empty `TF_DATA_DIR` and plugin cache.
323
+ 'terraform-init': {
324
+ executor: 'nx:run-commands',
325
+ options: {
326
+ commands: [
327
+ {
328
+ command: `shx mkdir -p ${pluginCacheDir}`,
329
+ forwardAllArgs: false
330
+ },
331
+ 'terraform init -backend=false'
332
+ ],
333
+ forwardAllArgs: true,
334
+ cwd: '{projectRoot}/src',
335
+ parallel: false,
336
+ env: {
337
+ TF_DATA_DIR: initDataDir,
338
+ TF_PLUGIN_CACHE_DIR: pluginCacheDir
339
+ }
313
340
  }
314
341
  },
315
342
  // `^production` mirrors `test`: checkov resolves the relative modules a
@@ -331,14 +358,11 @@ export async function terraformProjectGenerator(tree, schema) {
331
358
  }
332
359
  },
333
360
  // Terraform's native test framework, which runs any `.tftest.hcl` files.
334
- // A project with none is a no-op success.
335
- //
336
- // `-backend=false` installs the modules and providers the tests need
337
- // without configuring the S3 backend, so this runs before `bootstrap` and
338
- // needs no credentials. `TF_DATA_DIR` keeps that `.terraform` out of `src`,
339
- // so it never races the backend-configured targets over the shared one.
340
- // `^production` is what invalidates the cache when a consumed module
341
- // changes; `{projectRoot}/**/*` alone would serve a stale pass.
361
+ // A project with none is a no-op success. Runs against the `TF_DATA_DIR`
362
+ // `terraform-init` prepared, so it needs no credentials and works on a fresh
363
+ // workspace before `bootstrap`. `^production` is what invalidates the cache
364
+ // when a consumed module changes; `{projectRoot}/**/*` alone would serve a
365
+ // stale pass.
342
366
  //
343
367
  // `TF_DATA_DIR` is terraform's working directory, not an artifact: its
344
368
  // provider entries are symlinks into the shared plugin cache, so restoring
@@ -354,29 +378,19 @@ export async function terraformProjectGenerator(tree, schema) {
354
378
  ],
355
379
  outputs: [],
356
380
  options: {
357
- commands: [
358
- {
359
- command: `shx mkdir -p ${pluginCacheDir}`,
360
- forwardAllArgs: false
361
- },
362
- 'terraform init -backend=false',
363
- 'terraform test'
364
- ],
381
+ command: 'terraform test',
365
382
  forwardAllArgs: true,
366
383
  cwd: '{projectRoot}/src',
367
- parallel: false,
368
384
  env: {
369
- TF_DATA_DIR: testDataDir,
370
- TF_PLUGIN_CACHE_DIR: pluginCacheDir
385
+ TF_DATA_DIR: initDataDir
371
386
  }
372
- }
387
+ },
388
+ dependsOn: [
389
+ 'terraform-init'
390
+ ]
373
391
  },
374
- // Mirrors `test`: `-backend=false` installs the modules and providers
375
- // validation needs without configuring the S3 backend, so this runs on a
376
- // fresh workspace before `bootstrap` and needs no credentials. `TF_DATA_DIR`
377
- // keeps that `.terraform` out of `src`, so it never races the
378
- // backend-configured targets over the shared one, and declaring no outputs
379
- // keeps a cache hit to what it asserts (see `test` above).
392
+ // Mirrors `test`: validates against the `TF_DATA_DIR` `terraform-init`
393
+ // prepared, and declares no outputs for the same reason (see `test` above).
380
394
  validate: {
381
395
  executor: 'nx:run-commands',
382
396
  cache: true,
@@ -386,22 +400,16 @@ export async function terraformProjectGenerator(tree, schema) {
386
400
  ],
387
401
  outputs: [],
388
402
  options: {
389
- commands: [
390
- {
391
- command: `shx mkdir -p ${pluginCacheDir}`,
392
- forwardAllArgs: false
393
- },
394
- 'terraform init -backend=false',
395
- 'terraform validate'
396
- ],
403
+ command: 'terraform validate',
397
404
  forwardAllArgs: true,
398
405
  cwd: '{projectRoot}/src',
399
- parallel: false,
400
406
  env: {
401
- TF_DATA_DIR: validateDataDir,
402
- TF_PLUGIN_CACHE_DIR: pluginCacheDir
407
+ TF_DATA_DIR: initDataDir
403
408
  }
404
- }
409
+ },
410
+ dependsOn: [
411
+ 'terraform-init'
412
+ ]
405
413
  }
406
414
  };
407
415
  const projectConfiguration = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/terraform/project/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addProjectConfiguration,\n detectPackageManager,\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n readNxJson,\n type TargetConfiguration,\n type Tree,\n updateJson,\n updateNxJson,\n} from '@nx/devkit';\nimport { join, relative } from 'path';\nimport { addLicenseCheckToLintTarget } from '../../license/config.js';\nimport { getTsLibDetails } from '../../ts/lib/generator.js';\nimport { addTsDependencies } from '../../utils/add-dependencies.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { updateGitIgnore } from '../../utils/git.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { kebabCase } from '../../utils/names.js';\nimport {\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { uvxCommand } from '../../utils/py.js';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs.js';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n SHARED_TERRAFORM_DIR,\n SHARED_TERRAFORM_NAME,\n} from '../../utils/shared-constructs-constants.js';\nimport {\n terraformProviderVersions,\n withVersions,\n} from '../../utils/versions.js';\nimport type { TerraformProjectGeneratorSchema } from './schema';\n\n// Terraform projects carry no package.json, so their build tooling and the AWS\n// SDK the vended deploy scripts import are declared at the workspace root. This\n// generator records no metadata, so nothing a predicate could read.\nexport const DEPENDENCIES = declareDependencies()({\n ts: [\n { name: '@nx-extend/terraform', dev: true, root: true },\n { name: 'shx', dev: true, root: true },\n { name: 'tsx', dev: true, root: true },\n { name: '@aws-sdk/client-s3', dev: true, root: true },\n { name: '@aws-sdk/client-sts', dev: true, root: true },\n { name: '@aws-sdk/credential-providers', dev: true, root: true },\n { name: '@smithy/config-resolver', dev: true, root: true },\n { name: '@smithy/node-config-provider', dev: true, root: true },\n // Declared for its pinned version, which goes into npm's `overrides` below.\n { name: '@nx/devkit', versionOnly: true },\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ],\n});\n\nconst NX_EXTEND_PLUGIN = '@nx-extend/terraform';\nexport const TERRAFORM_PROJECT_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\n/**\n * Checks formatting, mirroring the TypeScript and Python `format` targets: the\n * base target fails on an unformatted file and the `fix` configuration rewrites\n * it. Writing from the base target would rewrite the `default` input the hash is\n * computed over, so the target could never cache-hit.\n *\n * Scoped to the project's own `src` rather than `-recursive`, so it checks the\n * files the vended templates cover. `-diff` names what to fix when it fails.\n */\nexport const TERRAFORM_FORMAT_TARGET: TargetConfiguration = {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default'],\n options: {\n command: 'terraform fmt -check -diff',\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n configurations: {\n fix: {\n command: 'terraform fmt',\n },\n 'skip-lint': {\n // Cross-platform no-op (`true` is not available on Windows cmd).\n command: 'node -e \"\"',\n },\n },\n};\n\nexport async function terraformProjectGenerator(\n tree: Tree,\n schema: TerraformProjectGeneratorSchema,\n): Promise<GeneratorCallback> {\n // Just use getTsLibDetails as it isn't specific to TS\n const lib = getTsLibDetails(tree, schema);\n const { fullyQualifiedName: sharedTfProjectName } = getTsLibDetails(tree, {\n name: SHARED_TERRAFORM_NAME,\n });\n\n const outDirToRootRelativePath = relative(\n join(tree.root, lib.dir, 'src'),\n tree.root,\n ).replace(/\\\\/g, '/');\n const distDir = joinPathFragments(\n outDirToRootRelativePath,\n 'dist',\n '{projectRoot}',\n );\n const tfDistDir = joinPathFragments(distDir, 'terraform');\n const checkovReportJsonPath = joinPathFragments(\n distDir,\n 'checkov',\n 'checkov_report.json',\n );\n // `test` and `validate` each keep their `.terraform` here rather than in\n // `src`, so initialising one never races the backend-configured targets, or\n // the other, over the shared one.\n const testDataDir = joinPathFragments(distDir, 'terraform-test');\n const validateDataDir = joinPathFragments(distDir, 'terraform-validate');\n\n // Provider downloads persist here, so a target whose `.terraform` was cleaned\n // links the providers it already has rather than re-downloading them. Nx does\n // not interpolate `{workspaceRoot}` inside `env`, so this is relative to the\n // target's `cwd`. It sits under `.terraform`, which this generator gitignores\n // — that is also what keeps the providers out of Nx's file walk — and unlike\n // `.nx/cache` it survives `nx reset`.\n //\n // One cache per project rather than one for the workspace: two `terraform\n // init` runs filling a shared cache concurrently each compute a different hash\n // for the same provider, because the hash covers a directory the other is\n // still writing, and terraform then rejects the mismatch against the lock\n // file. Per project, no two writers ever meet, so the targets stay parallel.\n const pluginCacheDir = joinPathFragments(\n outDirToRootRelativePath,\n '.terraform',\n 'plugin-cache',\n '{projectRoot}',\n );\n\n // Calculate relative path from current project to common/terraform/metrics\n // Use forward slashes for terraform module source paths (even on Windows)\n const metricsModulePath = relative(\n join(tree.root, lib.dir, 'src'),\n join(tree.root, 'packages', SHARED_TERRAFORM_DIR, 'src', 'metrics'),\n ).replace(/\\\\/g, '/');\n\n updateGitIgnore(tree, '.', (patterns) => [...patterns, '.terraform']);\n\n const applicationTargets: {\n [targetName: string]: TargetConfiguration;\n } = {\n apply: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n command: `terraform apply ${tfDistDir}/dev.tfplan`,\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n dependsOn: ['plan'],\n },\n bootstrap: {\n executor: 'nx:run-commands',\n options: {\n forwardAllArgs: true,\n commands: ['tsx {projectRoot}/scripts/bootstrap.ts {projectRoot}'],\n cwd: '{workspaceRoot}',\n },\n },\n 'bootstrap-destroy': {\n executor: 'nx:run-commands',\n options: {\n forwardAllArgs: true,\n commands: [\n 'tsx {projectRoot}/scripts/bootstrap-destroy.ts {projectRoot}',\n ],\n cwd: '{workspaceRoot}',\n },\n },\n build: {\n dependsOn: ['format', 'checkov', 'test', `${sharedTfProjectName}:build`],\n },\n deploy: {\n dependsOn: ['apply'],\n },\n // The artifact-only sibling of build, which `plan` depends on.\n assemble: {\n dependsOn: [`${sharedTfProjectName}:assemble`],\n },\n destroy: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n command: 'terraform destroy -var-file=env/dev.tfvars',\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n dependsOn: ['init'],\n },\n init: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n env: { TF_ENV: 'dev' },\n },\n },\n options: {\n forwardAllArgs: true,\n commands: ['tsx {projectRoot}/scripts/init.ts {projectRoot}'],\n cwd: '{workspaceRoot}',\n },\n dependsOn: ['^init'],\n },\n output: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default'],\n options: {\n command: 'terraform output -json',\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n },\n plan: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n commands: [\n `shx mkdir -p ${tfDistDir}`,\n `terraform plan -var-file=env/dev.tfvars -out=${tfDistDir}/dev.tfplan`,\n ],\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n parallel: false,\n },\n dependsOn: ['init', 'validate', '^validate', 'assemble'],\n },\n };\n\n const libTargets: {\n [targetName: string]: TargetConfiguration;\n } = {\n build: {\n dependsOn: ['format', 'checkov', 'test'],\n },\n // A Terraform library vends modules rather than a deployable artifact, so\n // its `assemble` carries only whatever the consuming projects register on it.\n assemble: {\n executor: 'nx:noop',\n },\n format: TERRAFORM_FORMAT_TARGET,\n // Terraform has no linter of its own, so `lint` orchestrates the format\n // check. It exists so `nx run-many --target lint` reaches terraform\n // projects, and so `--configuration=fix` and `--configuration=skip-lint`\n // propagate to `format` the way they do for TypeScript and Python projects.\n lint: {\n dependsOn: ['format'],\n },\n init: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n commands: [\n {\n command: `shx mkdir -p ${pluginCacheDir}`,\n forwardAllArgs: false,\n },\n 'terraform init',\n ],\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n parallel: false,\n env: { TF_PLUGIN_CACHE_DIR: pluginCacheDir },\n },\n },\n // `^production` mirrors `test`: checkov resolves the relative modules a\n // project consumes, so a change in one must invalidate the scan.\n checkov: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default', '^production'],\n outputs: ['{workspaceRoot}/dist/{projectRoot}/checkov'],\n options: {\n command: uvxCommand(\n 'checkov',\n `--config-file ../checkov.yml --directory . -o cli -o json --output-file-path console,${checkovReportJsonPath}`,\n ),\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n },\n // Terraform's native test framework, which runs any `.tftest.hcl` files.\n // A project with none is a no-op success.\n //\n // `-backend=false` installs the modules and providers the tests need\n // without configuring the S3 backend, so this runs before `bootstrap` and\n // needs no credentials. `TF_DATA_DIR` keeps that `.terraform` out of `src`,\n // so it never races the backend-configured targets over the shared one.\n // `^production` is what invalidates the cache when a consumed module\n // changes; `{projectRoot}/**/*` alone would serve a stale pass.\n //\n // `TF_DATA_DIR` is terraform's working directory, not an artifact: its\n // provider entries are symlinks into the shared plugin cache, so restoring\n // it on another machine would yield dangling links while the commands that\n // repopulate them are skipped. Declaring no outputs keeps a cache hit to\n // what it actually asserts — that the tests passed for these inputs.\n test: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default', '^production'],\n outputs: [],\n options: {\n commands: [\n { command: `shx mkdir -p ${pluginCacheDir}`, forwardAllArgs: false },\n 'terraform init -backend=false',\n 'terraform test',\n ],\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n parallel: false,\n env: { TF_DATA_DIR: testDataDir, TF_PLUGIN_CACHE_DIR: pluginCacheDir },\n },\n },\n // Mirrors `test`: `-backend=false` installs the modules and providers\n // validation needs without configuring the S3 backend, so this runs on a\n // fresh workspace before `bootstrap` and needs no credentials. `TF_DATA_DIR`\n // keeps that `.terraform` out of `src`, so it never races the\n // backend-configured targets over the shared one, and declaring no outputs\n // keeps a cache hit to what it asserts (see `test` above).\n validate: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default', '^production'],\n outputs: [],\n options: {\n commands: [\n { command: `shx mkdir -p ${pluginCacheDir}`, forwardAllArgs: false },\n 'terraform init -backend=false',\n 'terraform validate',\n ],\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n parallel: false,\n env: {\n TF_DATA_DIR: validateDataDir,\n TF_PLUGIN_CACHE_DIR: pluginCacheDir,\n },\n },\n },\n };\n\n const projectConfiguration = {\n root: lib.dir,\n projectType: schema.type,\n sourceRoot: joinPathFragments(lib.dir, 'src'),\n targets: sortObjectKeys({\n ...libTargets,\n ...(schema.type === 'application' ? applicationTargets : {}),\n }),\n };\n\n // Only create the project configuration on first run; skip it on re-run so\n // existing project.json customisations are preserved.\n if (!projectExists(tree, lib.fullyQualifiedName)) {\n addProjectConfiguration(tree, lib.fullyQualifiedName, projectConfiguration);\n }\n\n // The `lint` target checks licenses alongside formatting, as it does for\n // TypeScript and Python projects.\n addLicenseCheckToLintTarget(tree, lib.fullyQualifiedName);\n\n // This generator IS the Terraform project, so the provider is fixed.\n addGeneratorMetadata(\n tree,\n lib.fullyQualifiedName,\n TERRAFORM_PROJECT_GENERATOR_INFO,\n { iac: 'terraform' },\n );\n\n // The guides tell the reader to declare resources in `main.tf`, add variables\n // and outputs, and configure environments in `env/*.tfvars`, so everything\n // here is scaffolded once and then left alone. Provider version bumps reach\n // `providers.tf` through the vended version sync, which rewrites the pin in\n // place rather than the whole file.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, `./files/${schema.type}`),\n lib.dir,\n {\n metricsModulePath,\n stateKeyPrefix: kebabCase(lib.fullyQualifiedName),\n ...terraformProviderVersions(),\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // Checkov skips are the user's to curate, so preserve any they have added.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, './files/checkov'),\n lib.dir,\n {},\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n const nxJson = readNxJson(tree);\n\n if (\n !nxJson.plugins?.find((p) =>\n typeof p === 'string'\n ? p === NX_EXTEND_PLUGIN\n : p.plugin === NX_EXTEND_PLUGIN,\n )\n ) {\n nxJson.plugins = [...(nxJson.plugins ?? []), NX_EXTEND_PLUGIN];\n updateNxJson(tree, nxJson);\n }\n\n // Ensure shared constructs for Terraform are created\n await sharedConstructsGenerator(tree, { iac: 'terraform' }, DEPENDENCIES);\n\n // Add Terraform metrics\n await addGeneratorMetricsIfApplicable(tree, [\n TERRAFORM_PROJECT_GENERATOR_INFO,\n ]);\n\n addTsDependencies(tree, DEPENDENCIES);\n\n // @nx-extend/terraform has a peer dependency on @nx/devkit ^21.0.0 which causes\n // npm install to fail, so for NPM we add a resolution\n // Can remove when https://github.com/TriPSs/nx-extend/issues/407 is addressed\n if (detectPackageManager() === 'npm') {\n updateJson(tree, 'package.json', (packageJson) => {\n packageJson.overrides = {\n ...packageJson.overrides,\n ...withVersions(DEPENDENCIES, ['@nx/devkit']),\n };\n return packageJson;\n });\n }\n\n // `updateProjectConfiguration` re-serialises project.json with every inline\n // array expanded, which the vended `format` target rejects.\n await formatFilesInSubtree(tree);\n\n // `@nx-extend/terraform` is registered as an Nx plugin in nx.json, so Nx\n // loads it when computing the project graph — it must resolve even if the\n // caller would otherwise prefer to defer installing.\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript'],\n ensureResolvable: [NX_EXTEND_PLUGIN],\n });\n}\nexport default terraformProjectGenerator;\n"],"names":["addProjectConfiguration","detectPackageManager","generateFiles","joinPathFragments","OverwriteStrategy","readNxJson","updateJson","updateNxJson","join","relative","addLicenseCheckToLintTarget","getTsLibDetails","addTsDependencies","declareDependencies","ownedElsewhere","formatFilesInSubtree","updateGitIgnore","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","addGeneratorMetadata","getGeneratorInfo","projectExists","sortObjectKeys","uvxCommand","sharedConstructsGenerator","SHARED_CONSTRUCTS_DEPENDENCIES","SHARED_TERRAFORM_DIR","SHARED_TERRAFORM_NAME","terraformProviderVersions","withVersions","DEPENDENCIES","ts","name","dev","root","versionOnly","NX_EXTEND_PLUGIN","TERRAFORM_PROJECT_GENERATOR_INFO","filename","TERRAFORM_FORMAT_TARGET","executor","cache","inputs","options","command","forwardAllArgs","cwd","configurations","fix","terraformProjectGenerator","tree","schema","lib","fullyQualifiedName","sharedTfProjectName","outDirToRootRelativePath","dir","replace","distDir","tfDistDir","checkovReportJsonPath","testDataDir","validateDataDir","pluginCacheDir","metricsModulePath","patterns","applicationTargets","apply","defaultConfiguration","dependsOn","bootstrap","commands","build","deploy","assemble","destroy","init","env","TF_ENV","output","plan","parallel","libTargets","format","lint","TF_PLUGIN_CACHE_DIR","checkov","outputs","test","TF_DATA_DIR","validate","projectConfiguration","projectType","type","sourceRoot","targets","iac","dirname","stateKeyPrefix","overwriteStrategy","KeepExisting","nxJson","plugins","find","p","plugin","packageJson","overrides","preferIn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C,MAAMmD;IACrB;IAEA,qDAAqD;IACrD,MAAM7E,0BAA0B0B,MAAM;QAAE8C,KAAK;IAAY,GAAGlE;IAE5D,wBAAwB;IACxB,MAAMb,gCAAgCiC,MAAM;QAC1Cb;KACD;IAED1B,kBAAkBuC,MAAMpB;IAExB,gFAAgF;IAChF,sDAAsD;IACtD,8EAA8E;IAC9E,IAAI9B,2BAA2B,OAAO;QACpCK,WAAW6C,MAAM,gBAAgB,CAACwD;YAChCA,YAAYC,SAAS,GAAG;gBACtB,GAAGD,YAAYC,SAAS;gBACxB,GAAG9E,aAAaC,cAAc;oBAAC;iBAAa,CAAC;YAC/C;YACA,OAAO4E;QACT;IACF;IAEA,4EAA4E;IAC5E,4DAA4D;IAC5D,MAAM5F,qBAAqBoC;IAE3B,yEAAyE;IACzE,0EAA0E;IAC1E,qDAAqD;IACrD,OAAO,IACLlC,oBAAoBkC,MAAMC,OAAOyD,yBAAyB,EAAE;YAC1DC,WAAW;gBAAC;aAAa;YACzBC,kBAAkB;gBAAC1E;aAAiB;QACtC;AACJ;AACA,eAAea,0BAA0B"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/terraform/project/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addProjectConfiguration,\n detectPackageManager,\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n readNxJson,\n type TargetConfiguration,\n type Tree,\n updateJson,\n updateNxJson,\n} from '@nx/devkit';\nimport { join, relative } from 'path';\nimport { addLicenseCheckToLintTarget } from '../../license/config.js';\nimport { getTsLibDetails } from '../../ts/lib/generator.js';\nimport { addTsDependencies } from '../../utils/add-dependencies.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { updateGitIgnore } from '../../utils/git.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { kebabCase } from '../../utils/names.js';\nimport {\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { uvxCommand } from '../../utils/py.js';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs.js';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n SHARED_TERRAFORM_DIR,\n SHARED_TERRAFORM_NAME,\n} from '../../utils/shared-constructs-constants.js';\nimport {\n terraformProviderVersions,\n withVersions,\n} from '../../utils/versions.js';\nimport type { TerraformProjectGeneratorSchema } from './schema';\n\n// Terraform projects carry no package.json, so their build tooling and the AWS\n// SDK the vended deploy scripts import are declared at the workspace root. This\n// generator records no metadata, so nothing a predicate could read.\nexport const DEPENDENCIES = declareDependencies()({\n ts: [\n { name: '@nx-extend/terraform', dev: true, root: true },\n { name: 'shx', dev: true, root: true },\n { name: 'tsx', dev: true, root: true },\n { name: '@aws-sdk/client-s3', dev: true, root: true },\n { name: '@aws-sdk/client-sts', dev: true, root: true },\n { name: '@aws-sdk/credential-providers', dev: true, root: true },\n { name: '@smithy/config-resolver', dev: true, root: true },\n { name: '@smithy/node-config-provider', dev: true, root: true },\n // Declared for its pinned version, which goes into npm's `overrides` below.\n { name: '@nx/devkit', versionOnly: true },\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ],\n});\n\nconst NX_EXTEND_PLUGIN = '@nx-extend/terraform';\nexport const TERRAFORM_PROJECT_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\n/**\n * Checks formatting, mirroring the TypeScript and Python `format` targets: the\n * base target fails on an unformatted file and the `fix` configuration rewrites\n * it. Writing from the base target would rewrite the `default` input the hash is\n * computed over, so the target could never cache-hit.\n *\n * Scoped to the project's own `src` rather than `-recursive`, so it checks the\n * files the vended templates cover. `-diff` names what to fix when it fails.\n */\nexport const TERRAFORM_FORMAT_TARGET: TargetConfiguration = {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default'],\n options: {\n command: 'terraform fmt -check -diff',\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n configurations: {\n fix: {\n command: 'terraform fmt',\n },\n 'skip-lint': {\n // Cross-platform no-op (`true` is not available on Windows cmd).\n command: 'node -e \"\"',\n },\n },\n};\n\nexport async function terraformProjectGenerator(\n tree: Tree,\n schema: TerraformProjectGeneratorSchema,\n): Promise<GeneratorCallback> {\n // Just use getTsLibDetails as it isn't specific to TS\n const lib = getTsLibDetails(tree, schema);\n const { fullyQualifiedName: sharedTfProjectName } = getTsLibDetails(tree, {\n name: SHARED_TERRAFORM_NAME,\n });\n\n const outDirToRootRelativePath = relative(\n join(tree.root, lib.dir, 'src'),\n tree.root,\n ).replace(/\\\\/g, '/');\n const distDir = joinPathFragments(\n outDirToRootRelativePath,\n 'dist',\n '{projectRoot}',\n );\n const tfDistDir = joinPathFragments(distDir, 'terraform');\n const checkovReportJsonPath = joinPathFragments(\n distDir,\n 'checkov',\n 'checkov_report.json',\n );\n // `terraform-init` keeps its `.terraform` here rather than in `src`, so it\n // never races the backend-configured targets over the shared one. `test` and\n // `validate` read this same directory rather than initialising their own.\n const initDataDir = joinPathFragments(distDir, 'terraform-init');\n\n // Provider downloads persist here, so a target whose `.terraform` was cleaned\n // links the providers it already has rather than re-downloading them. Nx does\n // not interpolate `{workspaceRoot}` inside `env`, so this is relative to the\n // target's `cwd`. It sits under `.terraform`, which this generator gitignores\n // — that is also what keeps the providers out of Nx's file walk — and unlike\n // `.nx/cache` it survives `nx reset`.\n //\n // One cache per project rather than one for the workspace: two `terraform\n // init` runs filling a shared cache concurrently each compute a different hash\n // for the same provider, because the hash covers a directory the other is\n // still writing, and terraform then rejects the mismatch against the lock\n // file. `terraform-init` is the only target that fills it, and the targets that\n // need the providers depend on that one, so no two writers ever meet.\n const pluginCacheDir = joinPathFragments(\n outDirToRootRelativePath,\n '.terraform',\n 'plugin-cache',\n '{projectRoot}',\n );\n\n // Calculate relative path from current project to common/terraform/metrics\n // Use forward slashes for terraform module source paths (even on Windows)\n const metricsModulePath = relative(\n join(tree.root, lib.dir, 'src'),\n join(tree.root, 'packages', SHARED_TERRAFORM_DIR, 'src', 'metrics'),\n ).replace(/\\\\/g, '/');\n\n updateGitIgnore(tree, '.', (patterns) => [...patterns, '.terraform']);\n\n const applicationTargets: {\n [targetName: string]: TargetConfiguration;\n } = {\n apply: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n command: `terraform apply ${tfDistDir}/dev.tfplan`,\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n dependsOn: ['plan'],\n },\n bootstrap: {\n executor: 'nx:run-commands',\n options: {\n forwardAllArgs: true,\n commands: ['tsx {projectRoot}/scripts/bootstrap.ts {projectRoot}'],\n cwd: '{workspaceRoot}',\n },\n },\n 'bootstrap-destroy': {\n executor: 'nx:run-commands',\n options: {\n forwardAllArgs: true,\n commands: [\n 'tsx {projectRoot}/scripts/bootstrap-destroy.ts {projectRoot}',\n ],\n cwd: '{workspaceRoot}',\n },\n },\n build: {\n dependsOn: ['format', 'checkov', 'test', `${sharedTfProjectName}:build`],\n },\n deploy: {\n dependsOn: ['apply'],\n },\n // The artifact-only sibling of build, which `plan` depends on.\n assemble: {\n dependsOn: [`${sharedTfProjectName}:assemble`],\n },\n destroy: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n command: 'terraform destroy -var-file=env/dev.tfvars',\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n dependsOn: ['init'],\n },\n init: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n env: { TF_ENV: 'dev' },\n },\n },\n options: {\n forwardAllArgs: true,\n commands: ['tsx {projectRoot}/scripts/init.ts {projectRoot}'],\n cwd: '{workspaceRoot}',\n },\n dependsOn: ['terraform-init', '^init'],\n },\n output: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default'],\n options: {\n command: 'terraform output -json',\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n },\n plan: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n commands: [\n `shx mkdir -p ${tfDistDir}`,\n `terraform plan -var-file=env/dev.tfvars -out=${tfDistDir}/dev.tfplan`,\n ],\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n parallel: false,\n },\n dependsOn: ['init', 'validate', '^validate', 'assemble'],\n },\n };\n\n const libTargets: {\n [targetName: string]: TargetConfiguration;\n } = {\n build: {\n dependsOn: ['format', 'checkov', 'test'],\n },\n // A Terraform library vends modules rather than a deployable artifact, so\n // its `assemble` carries only whatever the consuming projects register on it.\n assemble: {\n executor: 'nx:noop',\n },\n format: TERRAFORM_FORMAT_TARGET,\n // Terraform has no linter of its own, so `lint` orchestrates the format\n // check. It exists so `nx run-many --target lint` reaches terraform\n // projects, and so `--configuration=fix` and `--configuration=skip-lint`\n // propagate to `format` the way they do for TypeScript and Python projects.\n lint: {\n dependsOn: ['format'],\n },\n init: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n commands: [\n {\n command: `shx mkdir -p ${pluginCacheDir}`,\n forwardAllArgs: false,\n },\n 'terraform init',\n ],\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n parallel: false,\n env: { TF_PLUGIN_CACHE_DIR: pluginCacheDir },\n },\n dependsOn: ['terraform-init'],\n },\n // `-backend=false` installs the modules and providers without configuring\n // the S3 backend, so this needs no credentials and runs on a fresh\n // workspace before `bootstrap`. Uncached: a cache hit on another machine\n // would report success over an empty `TF_DATA_DIR` and plugin cache.\n 'terraform-init': {\n executor: 'nx:run-commands',\n options: {\n commands: [\n { command: `shx mkdir -p ${pluginCacheDir}`, forwardAllArgs: false },\n 'terraform init -backend=false',\n ],\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n parallel: false,\n env: {\n TF_DATA_DIR: initDataDir,\n TF_PLUGIN_CACHE_DIR: pluginCacheDir,\n },\n },\n },\n // `^production` mirrors `test`: checkov resolves the relative modules a\n // project consumes, so a change in one must invalidate the scan.\n checkov: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default', '^production'],\n outputs: ['{workspaceRoot}/dist/{projectRoot}/checkov'],\n options: {\n command: uvxCommand(\n 'checkov',\n `--config-file ../checkov.yml --directory . -o cli -o json --output-file-path console,${checkovReportJsonPath}`,\n ),\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n },\n // Terraform's native test framework, which runs any `.tftest.hcl` files.\n // A project with none is a no-op success. Runs against the `TF_DATA_DIR`\n // `terraform-init` prepared, so it needs no credentials and works on a fresh\n // workspace before `bootstrap`. `^production` is what invalidates the cache\n // when a consumed module changes; `{projectRoot}/**/*` alone would serve a\n // stale pass.\n //\n // `TF_DATA_DIR` is terraform's working directory, not an artifact: its\n // provider entries are symlinks into the shared plugin cache, so restoring\n // it on another machine would yield dangling links while the commands that\n // repopulate them are skipped. Declaring no outputs keeps a cache hit to\n // what it actually asserts — that the tests passed for these inputs.\n test: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default', '^production'],\n outputs: [],\n options: {\n command: 'terraform test',\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n env: { TF_DATA_DIR: initDataDir },\n },\n dependsOn: ['terraform-init'],\n },\n // Mirrors `test`: validates against the `TF_DATA_DIR` `terraform-init`\n // prepared, and declares no outputs for the same reason (see `test` above).\n validate: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default', '^production'],\n outputs: [],\n options: {\n command: 'terraform validate',\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n env: { TF_DATA_DIR: initDataDir },\n },\n dependsOn: ['terraform-init'],\n },\n };\n\n const projectConfiguration = {\n root: lib.dir,\n projectType: schema.type,\n sourceRoot: joinPathFragments(lib.dir, 'src'),\n targets: sortObjectKeys({\n ...libTargets,\n ...(schema.type === 'application' ? applicationTargets : {}),\n }),\n };\n\n // Only create the project configuration on first run; skip it on re-run so\n // existing project.json customisations are preserved.\n if (!projectExists(tree, lib.fullyQualifiedName)) {\n addProjectConfiguration(tree, lib.fullyQualifiedName, projectConfiguration);\n }\n\n // The `lint` target checks licenses alongside formatting, as it does for\n // TypeScript and Python projects.\n addLicenseCheckToLintTarget(tree, lib.fullyQualifiedName);\n\n // This generator IS the Terraform project, so the provider is fixed.\n addGeneratorMetadata(\n tree,\n lib.fullyQualifiedName,\n TERRAFORM_PROJECT_GENERATOR_INFO,\n { iac: 'terraform' },\n );\n\n // The guides tell the reader to declare resources in `main.tf`, add variables\n // and outputs, and configure environments in `env/*.tfvars`, so everything\n // here is scaffolded once and then left alone. Provider version bumps reach\n // `providers.tf` through the vended version sync, which rewrites the pin in\n // place rather than the whole file.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, `./files/${schema.type}`),\n lib.dir,\n {\n metricsModulePath,\n stateKeyPrefix: kebabCase(lib.fullyQualifiedName),\n ...terraformProviderVersions(),\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // Checkov skips are the user's to curate, so preserve any they have added.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, './files/checkov'),\n lib.dir,\n {},\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n const nxJson = readNxJson(tree);\n\n if (\n !nxJson.plugins?.find((p) =>\n typeof p === 'string'\n ? p === NX_EXTEND_PLUGIN\n : p.plugin === NX_EXTEND_PLUGIN,\n )\n ) {\n nxJson.plugins = [...(nxJson.plugins ?? []), NX_EXTEND_PLUGIN];\n updateNxJson(tree, nxJson);\n }\n\n // Ensure shared constructs for Terraform are created\n await sharedConstructsGenerator(tree, { iac: 'terraform' }, DEPENDENCIES);\n\n // Add Terraform metrics\n await addGeneratorMetricsIfApplicable(tree, [\n TERRAFORM_PROJECT_GENERATOR_INFO,\n ]);\n\n addTsDependencies(tree, DEPENDENCIES);\n\n // @nx-extend/terraform has a peer dependency on @nx/devkit ^21.0.0 which causes\n // npm install to fail, so for NPM we add a resolution\n // Can remove when https://github.com/TriPSs/nx-extend/issues/407 is addressed\n if (detectPackageManager() === 'npm') {\n updateJson(tree, 'package.json', (packageJson) => {\n packageJson.overrides = {\n ...packageJson.overrides,\n ...withVersions(DEPENDENCIES, ['@nx/devkit']),\n };\n return packageJson;\n });\n }\n\n // `updateProjectConfiguration` re-serialises project.json with every inline\n // array expanded, which the vended `format` target rejects.\n await formatFilesInSubtree(tree);\n\n // `@nx-extend/terraform` is registered as an Nx plugin in nx.json, so Nx\n // loads it when computing the project graph — it must resolve even if the\n // caller would otherwise prefer to defer installing.\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript'],\n ensureResolvable: [NX_EXTEND_PLUGIN],\n });\n}\nexport default terraformProjectGenerator;\n"],"names":["addProjectConfiguration","detectPackageManager","generateFiles","joinPathFragments","OverwriteStrategy","readNxJson","updateJson","updateNxJson","join","relative","addLicenseCheckToLintTarget","getTsLibDetails","addTsDependencies","declareDependencies","ownedElsewhere","formatFilesInSubtree","updateGitIgnore","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","addGeneratorMetadata","getGeneratorInfo","projectExists","sortObjectKeys","uvxCommand","sharedConstructsGenerator","SHARED_CONSTRUCTS_DEPENDENCIES","SHARED_TERRAFORM_DIR","SHARED_TERRAFORM_NAME","terraformProviderVersions","withVersions","DEPENDENCIES","ts","name","dev","root","versionOnly","NX_EXTEND_PLUGIN","TERRAFORM_PROJECT_GENERATOR_INFO","filename","TERRAFORM_FORMAT_TARGET","executor","cache","inputs","options","command","forwardAllArgs","cwd","configurations","fix","terraformProjectGenerator","tree","schema","lib","fullyQualifiedName","sharedTfProjectName","outDirToRootRelativePath","dir","replace","distDir","tfDistDir","checkovReportJsonPath","initDataDir","pluginCacheDir","metricsModulePath","patterns","applicationTargets","apply","defaultConfiguration","dependsOn","bootstrap","commands","build","deploy","assemble","destroy","init","env","TF_ENV","output","plan","parallel","libTargets","format","lint","TF_PLUGIN_CACHE_DIR","TF_DATA_DIR","checkov","outputs","test","validate","projectConfiguration","projectType","type","sourceRoot","targets","iac","dirname","stateKeyPrefix","overwriteStrategy","KeepExisting","nxJson","plugins","find","p","plugin","packageJson","overrides","preferInstallDependencies","languages","ensureResolvable"],"mappings":"AAAA;;;CAGC,GACD,SACEA,uBAAuB,EACvBC,oBAAoB,EAEpBC,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EACjBC,UAAU,EAGVC,UAAU,EACVC,YAAY,QACP,aAAa;AACpB,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AACtC,SAASC,2BAA2B,QAAQ,0BAA0B;AACtE,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,SACEC,mBAAmB,EACnBC,cAAc,QACT,uCAAuC;AAC9C,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SACEC,oBAAoB,EACpBC,gBAAgB,EAEhBC,aAAa,QACR,oBAAoB;AAC3B,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,yBAAyB,QAAQ,mCAAmC;AAC7E,SACEC,8BAA8B,EAC9BC,oBAAoB,EACpBC,qBAAqB,QAChB,6CAA6C;AACpD,SACEC,yBAAyB,EACzBC,YAAY,QACP,0BAA0B;AAGjC,+EAA+E;AAC/E,gFAAgF;AAChF,oEAAoE;AACpE,OAAO,MAAMC,eAAelB,sBAAsB;IAChDmB,IAAI;QACF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