@aws/nx-plugin 1.0.0-rc.22 → 1.0.0-rc.24
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.
- package/LICENSE-THIRD-PARTY +2088 -971
- package/package.json +25 -10
- package/src/agentcore-gateway/attach-upstream.d.ts +7 -7
- package/src/agentcore-gateway/attach-upstream.js +19 -22
- package/src/agentcore-gateway/attach-upstream.js.map +1 -1
- package/src/agentcore-gateway/gateway-connection/generator.d.ts +3 -3
- package/src/agentcore-gateway/gateway-connection/generator.js +42 -45
- package/src/agentcore-gateway/gateway-connection/generator.js.map +1 -1
- package/src/agentcore-gateway/gateway-connection/schema.d.js +6 -0
- package/src/agentcore-gateway/gateway-connection/schema.d.js.map +1 -0
- package/src/agentcore-gateway/generator.js +89 -72
- package/src/agentcore-gateway/generator.js.map +1 -1
- package/src/agentcore-gateway/mcp-connection/generator.d.ts +2 -2
- package/src/agentcore-gateway/mcp-connection/generator.js +24 -30
- package/src/agentcore-gateway/mcp-connection/generator.js.map +1 -1
- package/src/agentcore-gateway/mcp-connection/schema.d.js +6 -0
- package/src/agentcore-gateway/mcp-connection/schema.d.js.map +1 -0
- package/src/agentcore-gateway/schema.d.js +6 -0
- package/src/agentcore-gateway/schema.d.js.map +1 -0
- package/src/bin/aws-nx-mcp.js +14 -0
- package/src/bin/aws-nx-mcp.js.map +1 -0
- package/src/connection/{agent-serve-local.d.ts → agent-local-dev.d.ts} +5 -5
- package/src/connection/agent-local-dev.js +42 -0
- package/src/connection/agent-local-dev.js.map +1 -0
- package/src/connection/agent-runtime-config.js +9 -14
- package/src/connection/agent-runtime-config.js.map +1 -1
- package/src/connection/generator.js +262 -207
- package/src/connection/generator.js.map +1 -1
- package/src/connection/{serve-local.d.ts → local-dev.d.ts} +3 -3
- package/src/connection/local-dev.js +37 -0
- package/src/connection/local-dev.js.map +1 -0
- package/src/connection/schema.d.js +6 -0
- package/src/connection/schema.d.js.map +1 -0
- package/src/index.js +2 -5
- package/src/index.js.map +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +4 -26
- package/src/infra/app/generator.js +133 -123
- package/src/infra/app/generator.js.map +1 -1
- package/src/infra/app/schema.d.js +6 -0
- package/src/infra/app/schema.d.js.map +1 -0
- package/src/license/config-types.js +5 -3
- package/src/license/config-types.js.map +1 -1
- package/src/license/config.d.ts +1 -1
- package/src/license/config.js +267 -242
- package/src/license/config.js.map +1 -1
- package/src/license/dependency-check/check.js +51 -46
- package/src/license/dependency-check/check.js.map +1 -1
- package/src/license/dependency-check/collectors/collector.js +41 -71
- package/src/license/dependency-check/collectors/collector.js.map +1 -1
- package/src/license/dependency-check/collectors/npm-collector.js +34 -41
- package/src/license/dependency-check/collectors/npm-collector.js.map +1 -1
- package/src/license/dependency-check/collectors/python-collector.js +55 -62
- package/src/license/dependency-check/collectors/python-collector.js.map +1 -1
- package/src/license/dependency-check/evaluator.js +40 -68
- package/src/license/dependency-check/evaluator.js.map +1 -1
- package/src/license/dependency-check/executor.js +30 -22
- package/src/license/dependency-check/executor.js.map +1 -1
- package/src/license/dependency-check/pre-approved.js +949 -336
- package/src/license/dependency-check/pre-approved.js.map +1 -1
- package/src/license/dependency-check/types.js +2 -3
- package/src/license/dependency-check/types.js.map +1 -1
- package/src/license/generator.js +55 -60
- package/src/license/generator.js.map +1 -1
- package/src/license/index.js +3 -9
- package/src/license/index.js.map +1 -1
- package/src/license/known-exceptions.js +14 -13
- package/src/license/known-exceptions.js.map +1 -1
- package/src/license/schema.d.js +6 -0
- package/src/license/schema.d.js.map +1 -0
- package/src/license/sync/generator.js +94 -119
- package/src/license/sync/generator.js.map +1 -1
- package/src/license/sync/project-file-sync.js +28 -35
- package/src/license/sync/project-file-sync.js.map +1 -1
- package/src/mcp-server/generator-info.js +130 -160
- package/src/mcp-server/generator-info.js.map +1 -1
- package/src/mcp-server/guide-pipeline.js +184 -206
- package/src/mcp-server/guide-pipeline.js.map +1 -1
- package/src/mcp-server/guide-render.js +10 -25
- package/src/mcp-server/guide-render.js.map +1 -1
- package/src/mcp-server/index.js +6 -10
- package/src/mcp-server/index.js.map +1 -1
- package/src/mcp-server/mdx-ast.js +39 -57
- package/src/mcp-server/mdx-ast.js.map +1 -1
- package/src/mcp-server/option-filter.js +33 -47
- package/src/mcp-server/option-filter.js.map +1 -1
- package/src/mcp-server/schema-registry.js +27 -40
- package/src/mcp-server/schema-registry.js.map +1 -1
- package/src/mcp-server/schema.js +9 -7
- package/src/mcp-server/schema.js.map +1 -1
- package/src/mcp-server/server.js +20 -24
- package/src/mcp-server/server.js.map +1 -1
- package/src/mcp-server/tools/create-workspace-command.js +23 -24
- package/src/mcp-server/tools/create-workspace-command.js.map +1 -1
- package/src/mcp-server/tools/general-guidance.js +28 -25
- package/src/mcp-server/tools/general-guidance.js.map +1 -1
- package/src/mcp-server/tools/generator-guide.js +29 -37
- package/src/mcp-server/tools/generator-guide.js.map +1 -1
- package/src/mcp-server/tools/list-generators.js +19 -25
- package/src/mcp-server/tools/list-generators.js.map +1 -1
- package/src/open-api/ts-client/generator.js +16 -26
- package/src/open-api/ts-client/generator.js.map +1 -1
- package/src/open-api/ts-client/schema.d.js +6 -0
- package/src/open-api/ts-client/schema.d.js.map +1 -0
- package/src/open-api/ts-hooks/generator.js +13 -21
- package/src/open-api/ts-hooks/generator.js.map +1 -1
- package/src/open-api/ts-hooks/schema.d.js +6 -0
- package/src/open-api/ts-hooks/schema.d.js.map +1 -0
- package/src/open-api/ts-metadata/generator.js +12 -20
- package/src/open-api/ts-metadata/generator.js.map +1 -1
- package/src/open-api/ts-metadata/schema.d.js +6 -0
- package/src/open-api/ts-metadata/schema.d.js.map +1 -0
- package/src/open-api/utils/codegen-data/languages.js +42 -60
- package/src/open-api/utils/codegen-data/languages.js.map +1 -1
- package/src/open-api/utils/codegen-data/types.js +31 -30
- package/src/open-api/utils/codegen-data/types.js.map +1 -1
- package/src/open-api/utils/codegen-data.js +253 -269
- package/src/open-api/utils/codegen-data.js.map +1 -1
- package/src/open-api/utils/normalise.js +242 -241
- package/src/open-api/utils/normalise.js.map +1 -1
- package/src/open-api/utils/parse.js +8 -14
- package/src/open-api/utils/parse.js.map +1 -1
- package/src/open-api/utils/refs.js +12 -22
- package/src/open-api/utils/refs.js.map +1 -1
- package/src/open-api/utils/types.js +5 -2
- package/src/open-api/utils/types.js.map +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +31 -6
- package/src/preset/generator.d.ts +1 -1
- package/src/preset/generator.js +130 -112
- package/src/preset/generator.js.map +1 -1
- package/src/preset/schema.d.js +6 -0
- package/src/preset/schema.d.js.map +1 -0
- package/src/preset/schema.d.ts +0 -1
- package/src/preset/schema.json +0 -5
- package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +304 -0
- package/src/py/agent/__snapshots__/{generator.spec.ts.snap → generator.frameworks.spec.ts.snap} +18 -845
- package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +535 -0
- package/src/py/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +1 -2
- package/src/py/agent/a2a-connection/files/agent-connection/app/__targetAgentSnakeCase___client_strands.py.template +1 -1
- package/src/py/agent/a2a-connection/files/langchain/agent-connection/app/__targetAgentSnakeCase___client_langchain.py.template +1 -1
- package/src/py/agent/a2a-connection/generator.js +70 -75
- package/src/py/agent/a2a-connection/generator.js.map +1 -1
- package/src/py/agent/a2a-connection/schema.d.js +8 -0
- package/src/py/agent/a2a-connection/schema.d.js.map +1 -0
- package/src/py/agent/files/ag-ui-langchain/main.py.template +10 -0
- package/src/py/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +6 -8
- package/src/py/agent/gateway-connection/files/agent-connection/app/__gatewaySnakeCase___client_strands.py.template +3 -3
- package/src/py/agent/gateway-connection/files/langchain/agent-connection/app/__gatewaySnakeCase___client_langchain.py.template +3 -3
- package/src/py/agent/gateway-connection/generator.js +61 -58
- package/src/py/agent/gateway-connection/generator.js.map +1 -1
- package/src/py/agent/gateway-connection/schema.d.js +6 -0
- package/src/py/agent/gateway-connection/schema.d.js.map +1 -0
- package/src/py/agent/generator.js +227 -194
- package/src/py/agent/generator.js.map +1 -1
- package/src/py/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +5 -12
- package/src/py/agent/mcp-connection/files/agent-connection/app/__mcpServerSnakeCase___client_strands.py.template +1 -1
- package/src/py/agent/mcp-connection/files/langchain/agent-connection/app/__mcpServerSnakeCase___client_langchain.py.template +1 -1
- package/src/py/agent/mcp-connection/generator.js +53 -52
- package/src/py/agent/mcp-connection/generator.js.map +1 -1
- package/src/py/agent/mcp-connection/schema.d.js +8 -0
- package/src/py/agent/mcp-connection/schema.d.js.map +1 -0
- package/src/py/agent/react-connection/__snapshots__/generator.spec.ts.snap +3 -2
- package/src/py/agent/react-connection/generator.js +51 -58
- package/src/py/agent/react-connection/generator.js.map +1 -1
- package/src/py/agent/react-connection/{serve-local.d.ts → local-dev.d.ts} +4 -4
- package/src/py/agent/react-connection/local-dev.js +36 -0
- package/src/py/agent/react-connection/local-dev.js.map +1 -0
- package/src/py/agent/react-connection/schema.d.js +8 -0
- package/src/py/agent/react-connection/schema.d.js.map +1 -0
- package/src/py/agent/schema.d.js +6 -0
- package/src/py/agent/schema.d.js.map +1 -0
- package/src/py/api/generator.js +12 -12
- package/src/py/api/generator.js.map +1 -1
- package/src/py/api/schema.d.js +6 -0
- package/src/py/api/schema.d.js.map +1 -0
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +68 -28
- package/src/py/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/py/dynamodb/agent-connection/generator.js +27 -29
- package/src/py/dynamodb/agent-connection/generator.js.map +1 -1
- package/src/py/dynamodb/agent-connection/schema.d.js +8 -0
- package/src/py/dynamodb/agent-connection/schema.d.js.map +1 -0
- package/src/py/dynamodb/fast-api-connection/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/py/dynamodb/fast-api-connection/generator.js +26 -28
- package/src/py/dynamodb/fast-api-connection/generator.js.map +1 -1
- package/src/py/dynamodb/fast-api-connection/schema.d.js +8 -0
- package/src/py/dynamodb/fast-api-connection/schema.d.js.map +1 -0
- package/src/py/dynamodb/files/__name__/client.py.template +5 -5
- package/src/py/dynamodb/files/__name__/entities/base.py.template +2 -2
- package/src/py/dynamodb/files/config.json.template +1 -1
- package/src/py/dynamodb/generator.js +63 -62
- package/src/py/dynamodb/generator.js.map +1 -1
- package/src/py/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/py/dynamodb/mcp-server-connection/generator.js +27 -29
- package/src/py/dynamodb/mcp-server-connection/generator.js.map +1 -1
- package/src/py/dynamodb/mcp-server-connection/schema.d.js +8 -0
- package/src/py/dynamodb/mcp-server-connection/schema.d.js.map +1 -0
- package/src/py/dynamodb/schema.d.js +6 -0
- package/src/py/dynamodb/schema.d.js.map +1 -0
- package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +45 -4632
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +4833 -0
- package/src/py/fast-api/generator.js +79 -85
- package/src/py/fast-api/generator.js.map +1 -1
- package/src/py/fast-api/react/__snapshots__/generator.spec.ts.snap +3 -2
- package/src/py/fast-api/react/generator.js +22 -24
- package/src/py/fast-api/react/generator.js.map +1 -1
- package/src/py/fast-api/react/open-api.js +28 -29
- package/src/py/fast-api/react/open-api.js.map +1 -1
- package/src/py/fast-api/react/schema.d.js +6 -0
- package/src/py/fast-api/react/schema.d.js.map +1 -0
- package/src/py/fast-api/schema.d.js +6 -0
- package/src/py/fast-api/schema.d.js.map +1 -0
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/py/lambda-function/generator.js +57 -58
- package/src/py/lambda-function/generator.js.map +1 -1
- package/src/py/lambda-function/schema.d.js +6 -0
- package/src/py/lambda-function/schema.d.js.map +1 -0
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/py/mcp-server/generator.js +149 -131
- package/src/py/mcp-server/generator.js.map +1 -1
- package/src/py/mcp-server/schema.d.js +6 -0
- package/src/py/mcp-server/schema.d.js.map +1 -0
- package/src/py/project/generator.d.ts +14 -1
- package/src/py/project/generator.js +137 -88
- package/src/py/project/generator.js.map +1 -1
- package/src/py/project/schema.d.js +6 -0
- package/src/py/project/schema.d.js.map +1 -0
- package/src/sdk/agentcore-gateway.d.ts +6 -0
- package/src/sdk/agentcore-gateway.js +7 -0
- package/src/sdk/agentcore-gateway.js.map +1 -0
- package/src/sdk/connection.d.ts +6 -0
- package/src/sdk/connection.js +6 -0
- package/src/sdk/connection.js.map +1 -0
- package/{sdk → src/sdk}/license.d.ts +4 -4
- package/src/sdk/license.js +7 -0
- package/src/sdk/license.js.map +1 -0
- package/src/sdk/open-api.d.ts +10 -0
- package/src/sdk/open-api.js +8 -0
- package/src/sdk/open-api.js.map +1 -0
- package/src/sdk/py.d.ts +14 -0
- package/src/sdk/py.js +10 -0
- package/src/sdk/py.js.map +1 -0
- package/src/sdk/terraform.d.ts +6 -0
- package/src/sdk/terraform.js +7 -0
- package/src/sdk/terraform.js.map +1 -0
- package/src/sdk/ts.d.ts +33 -0
- package/src/sdk/ts.js +35 -0
- package/src/sdk/ts.js.map +1 -0
- package/{sdk → src/sdk}/utils/ast.d.ts +2 -2
- package/src/sdk/utils/ast.js +7 -0
- package/src/sdk/utils/ast.js.map +1 -0
- package/{sdk → src/sdk}/utils/format.d.ts +1 -1
- package/src/sdk/utils/format.js +6 -0
- package/src/sdk/utils/format.js.map +1 -0
- package/{sdk → src/sdk}/utils/test.d.ts +1 -1
- package/src/sdk/utils/test.js +6 -0
- package/src/sdk/utils/test.js.map +1 -0
- package/src/smithy/project/__snapshots__/generator.spec.ts.snap +2 -8
- package/src/smithy/project/files/build.Dockerfile.template +1 -4
- package/src/smithy/project/generator.js +44 -42
- package/src/smithy/project/generator.js.map +1 -1
- package/src/smithy/project/schema.d.js +6 -0
- package/src/smithy/project/schema.d.js.map +1 -0
- package/src/smithy/react-connection/generator.js +35 -46
- package/src/smithy/react-connection/generator.js.map +1 -1
- package/src/smithy/react-connection/schema.d.js +6 -0
- package/src/smithy/react-connection/schema.d.js.map +1 -0
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +395 -72
- package/src/smithy/ts/api/generator.js +121 -111
- package/src/smithy/ts/api/generator.js.map +1 -1
- package/src/smithy/ts/api/schema.d.js +6 -0
- package/src/smithy/ts/api/schema.d.js.map +1 -0
- package/src/terraform/project/files/application/src/providers.tf.template +1 -1
- package/src/terraform/project/generator.js +141 -103
- package/src/terraform/project/generator.js.map +1 -1
- package/src/terraform/project/schema.d.js +9 -0
- package/src/terraform/project/schema.d.js.map +1 -0
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +336 -92
- package/src/trpc/backend/generator.js +93 -86
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/trpc/backend/schema.d.js +6 -0
- package/src/trpc/backend/schema.d.js.map +1 -0
- package/src/trpc/react/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/trpc/react/generator.js +59 -58
- package/src/trpc/react/generator.js.map +1 -1
- package/src/trpc/react/schema.d.js +6 -0
- package/src/trpc/react/schema.d.js.map +1 -0
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +11 -11
- package/src/ts/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/agent/a2a-connection/files/agent-connection/app/__targetAgentKebabCase__-client-strands.ts.template +1 -1
- package/src/ts/agent/a2a-connection/generator.js +58 -54
- package/src/ts/agent/a2a-connection/generator.js.map +1 -1
- package/src/ts/agent/a2a-connection/schema.d.js +8 -0
- package/src/ts/agent/a2a-connection/schema.d.js.map +1 -0
- package/src/ts/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/ts/agent/gateway-connection/files/agent-connection/app/__gatewayKebabCase__-client-strands.ts.template +3 -3
- package/src/ts/agent/gateway-connection/generator.js +57 -52
- package/src/ts/agent/gateway-connection/generator.js.map +1 -1
- package/src/ts/agent/gateway-connection/schema.d.js +6 -0
- package/src/ts/agent/gateway-connection/schema.d.js.map +1 -0
- package/src/ts/agent/generator.js +165 -136
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/agent/mcp-connection/files/agent-connection/app/__mcpServerKebabCase__-client-strands.ts.template +1 -1
- package/src/ts/agent/mcp-connection/generator.js +48 -46
- package/src/ts/agent/mcp-connection/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/schema.d.js +8 -0
- package/src/ts/agent/mcp-connection/schema.d.js.map +1 -0
- package/src/ts/agent/react-connection/generator.js +79 -79
- package/src/ts/agent/react-connection/generator.js.map +1 -1
- package/src/ts/agent/react-connection/{serve-local.d.ts → local-dev.d.ts} +2 -2
- package/src/ts/agent/react-connection/local-dev.js +17 -0
- package/src/ts/agent/react-connection/local-dev.js.map +1 -0
- package/src/ts/agent/react-connection/schema.d.js +8 -0
- package/src/ts/agent/react-connection/schema.d.js.map +1 -0
- package/src/ts/agent/schema.d.js +6 -0
- package/src/ts/agent/schema.d.js.map +1 -0
- package/src/ts/api/generator.js +16 -18
- package/src/ts/api/generator.js.map +1 -1
- package/src/ts/api/schema.d.js +6 -0
- package/src/ts/api/schema.d.js.map +1 -0
- package/src/ts/astro-docs/__snapshots__/generator.spec.ts.snap +8 -8
- package/src/ts/astro-docs/generator.js +59 -48
- package/src/ts/astro-docs/generator.js.map +1 -1
- package/src/ts/astro-docs/schema.d.js +6 -0
- package/src/ts/astro-docs/schema.d.js.map +1 -0
- package/src/ts/docs/generator.js +10 -10
- package/src/ts/docs/generator.js.map +1 -1
- package/src/ts/docs/schema.d.js +6 -0
- package/src/ts/docs/schema.d.js.map +1 -0
- package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +68 -30
- package/src/ts/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/ts/dynamodb/agent-connection/generator.js +21 -23
- package/src/ts/dynamodb/agent-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/agent-connection/schema.d.js +8 -0
- package/src/ts/dynamodb/agent-connection/schema.d.js.map +1 -0
- package/src/ts/dynamodb/files/config.json.template +1 -1
- package/src/ts/dynamodb/files/src/client.ts.template +7 -7
- package/src/ts/dynamodb/generator.js +64 -63
- package/src/ts/dynamodb/generator.js.map +1 -1
- package/src/ts/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/ts/dynamodb/mcp-server-connection/generator.js +21 -23
- package/src/ts/dynamodb/mcp-server-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/mcp-server-connection/schema.d.js +8 -0
- package/src/ts/dynamodb/mcp-server-connection/schema.d.js.map +1 -0
- package/src/ts/dynamodb/schema.d.js +6 -0
- package/src/ts/dynamodb/schema.d.js.map +1 -0
- package/src/ts/dynamodb/smithy-connection/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/ts/dynamodb/smithy-connection/generator.js +20 -22
- package/src/ts/dynamodb/smithy-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/smithy-connection/schema.d.js +8 -0
- package/src/ts/dynamodb/smithy-connection/schema.d.js.map +1 -0
- package/src/ts/dynamodb/trpc-connection/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/ts/dynamodb/trpc-connection/generator.js +20 -22
- package/src/ts/dynamodb/trpc-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/trpc-connection/schema.d.js +8 -0
- package/src/ts/dynamodb/trpc-connection/schema.d.js.map +1 -0
- package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/ts/lambda-function/generator.js +55 -55
- package/src/ts/lambda-function/generator.js.map +1 -1
- package/src/ts/lambda-function/io.js +83 -52
- package/src/ts/lambda-function/io.js.map +1 -1
- package/src/ts/lambda-function/schema.d.js +6 -0
- package/src/ts/lambda-function/schema.d.js.map +1 -0
- package/src/ts/lib/__snapshots__/generator.spec.ts.snap +23 -36
- package/src/ts/lib/biome.js +37 -37
- package/src/ts/lib/biome.js.map +1 -1
- package/src/ts/lib/generator.js +75 -77
- package/src/ts/lib/generator.js.map +1 -1
- package/src/ts/lib/schema.d.js +6 -0
- package/src/ts/lib/schema.d.js.map +1 -0
- package/src/ts/lib/ts-project-utils.js +65 -70
- package/src/ts/lib/ts-project-utils.js.map +1 -1
- package/src/ts/lib/types.js +5 -2
- package/src/ts/lib/types.js.map +1 -1
- package/src/ts/lib/vitest.js +29 -26
- package/src/ts/lib/vitest.js.map +1 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/ts/mcp-server/generator.js +157 -138
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/mcp-server/schema.d.js +6 -0
- package/src/ts/mcp-server/schema.d.js.map +1 -0
- package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +14 -9
- package/src/ts/nx-generator/files/local/generator.ts.template +3 -3
- package/src/ts/nx-generator/files/nx-plugin-for-aws/generator/generator.ts.template +4 -4
- package/src/ts/nx-generator/generator.js +84 -83
- package/src/ts/nx-generator/generator.js.map +1 -1
- package/src/ts/nx-generator/schema.d.js +6 -0
- package/src/ts/nx-generator/schema.d.js.map +1 -0
- package/src/ts/nx-plugin/__snapshots__/generator.spec.ts.snap +30 -18
- package/src/ts/nx-plugin/files/mcp-server/server.ts.template +5 -5
- package/src/ts/nx-plugin/files/mcp-server/tools/create-workspace-command.ts.template +2 -2
- package/src/ts/nx-plugin/files/mcp-server/tools/general-guidance.ts.template +1 -1
- package/src/ts/nx-plugin/files/mcp-server/tools/generator-guide.ts.template +2 -2
- package/src/ts/nx-plugin/files/mcp-server/tools/list-generators.ts.template +2 -2
- package/src/ts/nx-plugin/files/mcp-server/utils.ts.template +3 -3
- package/src/ts/nx-plugin/generator.js +49 -48
- package/src/ts/nx-plugin/generator.js.map +1 -1
- package/src/ts/nx-plugin/schema.d.js +9 -0
- package/src/ts/nx-plugin/schema.d.js.map +1 -0
- package/src/ts/nx-plugin/utils.js +32 -44
- package/src/ts/nx-plugin/utils.js.map +1 -1
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +34 -30
- package/src/ts/rdb/agent-connection/__snapshots__/generator.spec.ts.snap +6 -6
- package/src/ts/rdb/agent-connection/generator.js +38 -39
- package/src/ts/rdb/agent-connection/generator.js.map +1 -1
- package/src/ts/rdb/agent-connection/schema.d.js +8 -0
- package/src/ts/rdb/agent-connection/schema.d.js.map +1 -0
- package/src/ts/rdb/files/config.json.template +1 -1
- package/src/ts/rdb/files/prisma.config.ts.template +2 -2
- package/src/ts/rdb/files/src/prisma.ts.template +7 -7
- package/src/ts/rdb/files/src/utils.ts.template +3 -0
- package/src/ts/rdb/generator.js +130 -117
- package/src/ts/rdb/generator.js.map +1 -1
- package/src/ts/rdb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +6 -6
- package/src/ts/rdb/mcp-server-connection/generator.js +36 -37
- package/src/ts/rdb/mcp-server-connection/generator.js.map +1 -1
- package/src/ts/rdb/mcp-server-connection/schema.d.js +8 -0
- package/src/ts/rdb/mcp-server-connection/schema.d.js.map +1 -0
- package/src/ts/rdb/schema.d.js +6 -0
- package/src/ts/rdb/schema.d.js.map +1 -0
- package/src/ts/rdb/smithy-connection/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/ts/rdb/smithy-connection/generator.js +46 -43
- package/src/ts/rdb/smithy-connection/generator.js.map +1 -1
- package/src/ts/rdb/smithy-connection/schema.d.js +8 -0
- package/src/ts/rdb/smithy-connection/schema.d.js.map +1 -0
- package/src/ts/rdb/trpc-connection/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/ts/rdb/trpc-connection/generator.js +36 -31
- package/src/ts/rdb/trpc-connection/generator.js.map +1 -1
- package/src/ts/rdb/trpc-connection/schema.d.js +8 -0
- package/src/ts/rdb/trpc-connection/schema.d.js.map +1 -0
- package/src/ts/rdb/utils.js +9 -11
- package/src/ts/rdb/utils.js.map +1 -1
- package/src/ts/react-website/agui/generator.js +69 -61
- package/src/ts/react-website/agui/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +179 -332
- package/src/ts/react-website/app/generator.js +197 -188
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/ts/react-website/app/schema.d.js +6 -0
- package/src/ts/react-website/app/schema.d.js.map +1 -0
- package/src/ts/react-website/app/schema.json +6 -6
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.spec.ts.snap +118 -4
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +27 -7
- package/src/ts/react-website/cognito-auth/files/app/components/CognitoAuth/index.tsx.template +2 -2
- package/src/ts/react-website/cognito-auth/generator.js +60 -60
- package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/schema.d.js +6 -0
- package/src/ts/react-website/cognito-auth/schema.d.js.map +1 -0
- package/src/ts/react-website/cognito-auth/utils.js +34 -32
- package/src/ts/react-website/cognito-auth/utils.js.map +1 -1
- package/src/ts/react-website/runtime-config/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/react-website/runtime-config/files/app/components/RuntimeConfig/index.tsx.template +2 -2
- package/src/ts/react-website/runtime-config/generator.js +29 -31
- package/src/ts/react-website/runtime-config/generator.js.map +1 -1
- package/src/ts/react-website/runtime-config/schema.d.js +6 -0
- package/src/ts/react-website/runtime-config/schema.d.js.map +1 -0
- package/src/ts/sync/generator.js +60 -59
- package/src/ts/sync/generator.js.map +1 -1
- package/src/ts/website/app/generator.js +10 -10
- package/src/ts/website/app/generator.js.map +1 -1
- package/src/ts/website/app/schema.d.js +6 -0
- package/src/ts/website/app/schema.d.js.map +1 -0
- package/src/ts/website/app/schema.json +6 -6
- package/src/ts/website/auth/generator.js +11 -11
- package/src/ts/website/auth/generator.js.map +1 -1
- package/src/ts/website/auth/schema.d.js +6 -0
- package/src/ts/website/auth/schema.d.js.map +1 -0
- package/src/utils/agent-chat/agent-chat.d.ts +1 -1
- package/src/utils/agent-chat/agent-chat.js +11 -12
- package/src/utils/agent-chat/agent-chat.js.map +1 -1
- package/src/utils/agent-chat/files/a2a/chat.ts.template +1 -1
- package/src/utils/agent-chat/files/ag-ui/chat.ts.template +1 -1
- package/src/utils/agent-chat/files/http-py/chat.ts.template +1 -1
- package/src/utils/agent-chat/files/http-ts/chat.ts.template +1 -1
- package/src/utils/agent-connection/agent-connection.d.ts +9 -3
- package/src/utils/agent-connection/agent-connection.js +133 -147
- package/src/utils/agent-connection/agent-connection.js.map +1 -1
- package/src/utils/agent-connection/files/core-gateway/agentcore-gateway-mcp-transport.ts.template +1 -1
- package/src/utils/agent-connection/files/core-strands/gateway/agentcore-gateway-mcp-client-strands.ts.template +1 -1
- package/src/utils/agent-connection/files/py-core-gateway/agentcore_gateway_mcp_transport.py.template +1 -1
- package/src/utils/agent-connection/files/py-core-langchain/gateway/agentcore_gateway_mcp_client_langchain.py.template +1 -1
- package/src/utils/agent-connection/files/py-core-strands/gateway/agentcore_gateway_mcp_client_strands.py.template +1 -1
- package/src/utils/agent-core-constructs/agent-core-constructs.js +53 -50
- package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
- package/src/utils/agent-core-constructs/files/terraform/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.tf.template +4 -4
- package/src/utils/agent-core-constructs/files/terraform/core/agent-core/runtime.tf.template +5 -5
- package/src/utils/agent-core-constructs/files/terraform/core/agentcore-gateway/gateway.tf.template +2 -2
- package/src/utils/api-constructs/api-constructs.js +30 -31
- package/src/utils/api-constructs/api-constructs.js.map +1 -1
- package/src/utils/api-constructs/files/cdk/core/api/http/http-api.ts.template +14 -6
- package/src/utils/api-constructs/files/cdk/core/api/rest/api-gateway-account/index.js.template +58 -0
- package/src/utils/api-constructs/files/cdk/core/api/rest/api-gateway-account.ts.template +82 -0
- package/src/utils/api-constructs/files/cdk/core/api/rest/rest-api.ts.template +28 -14
- package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +1 -8
- package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +91 -4
- package/src/utils/api-constructs/files/terraform/core/api/http/http-api/http-api.tf.template +1 -1
- package/src/utils/api-constructs/files/terraform/core/api/rest/api-gateway-account/api-gateway-account.tf.template +83 -0
- package/src/utils/api-constructs/files/terraform/core/api/rest/rest-api/rest-api.tf.template +5 -11
- package/src/utils/api-constructs/open-api-metadata.js +22 -22
- package/src/utils/api-constructs/open-api-metadata.js.map +1 -1
- package/src/utils/ast/website.js +17 -19
- package/src/utils/ast/website.js.map +1 -1
- package/src/utils/ast.js +72 -97
- package/src/utils/ast.js.map +1 -1
- package/src/utils/bundle/bundle.js +50 -47
- package/src/utils/bundle/bundle.js.map +1 -1
- package/src/utils/commands.js +47 -26
- package/src/utils/commands.js.map +1 -1
- package/src/utils/config/index.d.ts +2 -2
- package/src/utils/config/index.js +5 -4
- package/src/utils/config/index.js.map +1 -1
- package/src/utils/config/utils.js +48 -58
- package/src/utils/config/utils.js.map +1 -1
- package/src/utils/connection/open-api/react.d.ts +5 -5
- package/src/utils/connection/open-api/react.js +81 -77
- package/src/utils/connection/open-api/react.js.map +1 -1
- package/src/utils/containers.js +22 -23
- package/src/utils/containers.js.map +1 -1
- package/src/utils/dynamodb-constructs/dynamodb-constructs.js +32 -33
- package/src/utils/dynamodb-constructs/dynamodb-constructs.js.map +1 -1
- package/src/utils/dynamodb-constructs/files/terraform/app/dynamodb/__nameKebabCase__/__nameKebabCase__.tf.template +12 -2
- package/src/utils/dynamodb-constructs/files/terraform/core/dynamodb/dynamodb.tf.template +1 -1
- package/src/utils/files/common/scripts/src/dynamodb/create-local-table.ts.template +2 -2
- package/src/utils/files/common/scripts/src/dynamodb/pull-image.ts.template +1 -1
- package/src/utils/files/common/scripts/src/dynamodb/start-container.ts.template +17 -2
- package/src/utils/files/common/scripts/src/rdb/mysql/wait-for-mysql-db.ts.template +32 -0
- package/src/utils/files/common/scripts/src/rdb/postgres/wait-for-postgres-db.ts.template +32 -0
- package/src/utils/files/common/scripts/src/rdb/{pull-image.ts.template → shared/pull-image.ts.template} +1 -1
- package/src/utils/files/common/scripts/src/rdb/{start-container.ts.template → shared/start-container.ts.template} +16 -1
- package/src/utils/files/terraform/src/core/asset-bucket/asset-bucket.tf.template +2 -2
- package/src/utils/files/terraform/src/core/runtime-config/appconfig/appconfig.tf.template +1 -1
- package/src/utils/files/terraform/src/core/runtime-config/appconfig-deployment/appconfig-deployment.tf.template +3 -3
- package/src/utils/files/terraform/src/core/runtime-config/entry/entry.tf.template +1 -1
- package/src/utils/files/terraform/src/core/runtime-config/read/read.tf.template +2 -2
- package/src/utils/files/website/hooks/sigv4/useSigV4.tsx.template +1 -1
- package/src/utils/format.js +153 -99
- package/src/utils/format.js.map +1 -1
- package/src/utils/fs.js +14 -13
- package/src/utils/fs.js.map +1 -1
- package/src/utils/function-constructs/files/terraform/app/lambda-functions/__nameKebabCase__/__nameKebabCase__.tf.template +2 -2
- package/src/utils/function-constructs/function-constructs.js +21 -26
- package/src/utils/function-constructs/function-constructs.js.map +1 -1
- package/src/utils/generators.js +18 -20
- package/src/utils/generators.js.map +1 -1
- package/src/utils/git.js +19 -34
- package/src/utils/git.js.map +1 -1
- package/src/utils/iac-providers.js +5 -5
- package/src/utils/iac-providers.js.map +1 -1
- package/src/utils/iac.js +12 -14
- package/src/utils/iac.js.map +1 -1
- package/src/utils/identity-constructs/files/cdk/core/user-identity.ts.template +112 -2
- package/src/utils/identity-constructs/files/terraform/core/user-identity/add-callback-url/add-callback-url.tf.template +19 -6
- package/src/utils/identity-constructs/files/terraform/core/user-identity/identity/identity.tf.template +104 -2
- package/src/utils/identity-constructs/files/terraform/core/user-identity/main.tf.template +7 -0
- package/src/utils/identity-constructs/identity-constructs.js +24 -28
- package/src/utils/identity-constructs/identity-constructs.js.map +1 -1
- package/src/utils/js.js +27 -20
- package/src/utils/js.js.map +1 -1
- package/src/utils/mcp.js +34 -41
- package/src/utils/mcp.js.map +1 -1
- package/src/utils/metrics.js +30 -45
- package/src/utils/metrics.js.map +1 -1
- package/src/utils/mock-project-graph.js +8 -12
- package/src/utils/mock-project-graph.js.map +1 -1
- package/src/utils/names.d.ts +16 -0
- package/src/utils/names.js +39 -48
- package/src/utils/names.js.map +1 -1
- package/src/utils/npm-scope.js +9 -17
- package/src/utils/npm-scope.js.map +1 -1
- package/src/utils/nx.d.ts +18 -2
- package/src/utils/nx.js +111 -74
- package/src/utils/nx.js.map +1 -1
- package/src/utils/nxlv-python.js +27 -15
- package/src/utils/nxlv-python.js.map +1 -1
- package/src/utils/object.js +5 -11
- package/src/utils/object.js.map +1 -1
- package/src/utils/paths.js +11 -15
- package/src/utils/paths.js.map +1 -1
- package/src/utils/pkg-manager.js +4 -9
- package/src/utils/pkg-manager.js.map +1 -1
- package/src/utils/pnpm-workspace.js +22 -22
- package/src/utils/pnpm-workspace.js.map +1 -1
- package/src/utils/port.js +26 -36
- package/src/utils/port.js.map +1 -1
- package/src/utils/py.d.ts +14 -1
- package/src/utils/py.js +63 -45
- package/src/utils/py.js.map +1 -1
- package/src/utils/rdb-constructs/files/terraform/app/dbs/__nameKebabCase__/__nameKebabCase__.tf.template +4 -4
- package/src/utils/rdb-constructs/files/terraform/core/rdb/aurora/aurora.tf.template +3 -3
- package/src/utils/rdb-constructs/rdb-constructs.js +31 -33
- package/src/utils/rdb-constructs/rdb-constructs.js.map +1 -1
- package/src/utils/shared-constructs-constants.js +16 -16
- package/src/utils/shared-constructs-constants.js.map +1 -1
- package/src/utils/shared-constructs.js +57 -54
- package/src/utils/shared-constructs.js.map +1 -1
- package/src/utils/shared-dynamodb-scripts.js +16 -14
- package/src/utils/shared-dynamodb-scripts.js.map +1 -1
- package/src/utils/shared-infra-config.js +30 -31
- package/src/utils/shared-infra-config.js.map +1 -1
- package/src/utils/shared-infra-scripts.js +30 -25
- package/src/utils/shared-infra-scripts.js.map +1 -1
- package/src/utils/shared-rdb-scripts.d.ts +8 -3
- package/src/utils/shared-rdb-scripts.js +21 -13
- package/src/utils/shared-rdb-scripts.js.map +1 -1
- package/src/utils/shared-scripts.js +12 -17
- package/src/utils/shared-scripts.js.map +1 -1
- package/src/utils/shared-shadcn.js +64 -60
- package/src/utils/shared-shadcn.js.map +1 -1
- package/src/utils/test.d.ts +8 -0
- package/src/utils/test.js +33 -25
- package/src/utils/test.js.map +1 -1
- package/src/utils/toml.js +7 -15
- package/src/utils/toml.js.map +1 -1
- package/src/utils/versions.d.ts +31 -4
- package/src/utils/versions.js +40 -23
- package/src/utils/versions.js.map +1 -1
- package/src/utils/website-constructs/files/terraform/app/static-websites/__websiteNameKebabCase__/__websiteNameKebabCase__.tf.template +1 -1
- package/src/utils/website-constructs/files/terraform/core/static-website/static-website.tf.template +4 -4
- package/src/utils/website-constructs/website-constructs.js +31 -30
- package/src/utils/website-constructs/website-constructs.js.map +1 -1
- package/bin/aws-nx-mcp.js +0 -17
- package/bin/aws-nx-mcp.js.map +0 -1
- package/sdk/agentcore-gateway.d.ts +0 -6
- package/sdk/agentcore-gateway.js +0 -11
- package/sdk/agentcore-gateway.js.map +0 -1
- package/sdk/connection.d.ts +0 -6
- package/sdk/connection.js +0 -10
- package/sdk/connection.js.map +0 -1
- package/sdk/license.js +0 -14
- package/sdk/license.js.map +0 -1
- package/sdk/open-api.d.ts +0 -10
- package/sdk/open-api.js +0 -15
- package/sdk/open-api.js.map +0 -1
- package/sdk/py.d.ts +0 -14
- package/sdk/py.js +0 -18
- package/sdk/py.js.map +0 -1
- package/sdk/terraform.d.ts +0 -6
- package/sdk/terraform.js +0 -11
- package/sdk/terraform.js.map +0 -1
- package/sdk/ts.d.ts +0 -33
- package/sdk/ts.js +0 -53
- package/sdk/ts.js.map +0 -1
- package/sdk/utils/ast.js +0 -12
- package/sdk/utils/ast.js.map +0 -1
- package/sdk/utils/format.js +0 -10
- package/sdk/utils/format.js.map +0 -1
- package/sdk/utils/test.js +0 -10
- package/sdk/utils/test.js.map +0 -1
- package/src/connection/agent-serve-local.js +0 -48
- package/src/connection/agent-serve-local.js.map +0 -1
- package/src/connection/serve-local.js +0 -41
- package/src/connection/serve-local.js.map +0 -1
- package/src/py/agent/react-connection/serve-local.js +0 -38
- package/src/py/agent/react-connection/serve-local.js.map +0 -1
- package/src/ts/agent/react-connection/serve-local.js +0 -19
- package/src/ts/agent/react-connection/serve-local.js.map +0 -1
- package/src/utils/files/common/scripts/src/rdb/wait-for-db.ts.template +0 -59
- /package/src/agentcore-gateway/files/project/{serve-local.ts.template → local-dev.ts.template} +0 -0
- /package/{bin → src/bin}/aws-nx-mcp.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/react-website/app/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { IacOption } from '../../../utils/iac';\nimport { UxOption } from './generator';\n\nexport type WebsiteInfraOption = 'cloudfront-s3' | 'none';\n\nexport interface TsReactWebsiteGeneratorSchema {\n name: string;\n directory?: string;\n subDirectory?: string;\n skipInstall?: boolean;\n tanstackRouter?: boolean;\n tailwind?: boolean;\n ux?: UxOption;\n infra?: WebsiteInfraOption;\n iac: IacOption;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAMD,WAUC"}
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"description": "The preferred UX provider.",
|
|
41
41
|
"enum": ["none", "cloudscape", "shadcn"],
|
|
42
42
|
"x-priority": "important",
|
|
43
|
-
"default": "
|
|
43
|
+
"default": "shadcn",
|
|
44
44
|
"x-prompt": {
|
|
45
45
|
"message": "Which UX provider should we scaffold for this app?",
|
|
46
46
|
"type": "list",
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
"value": "none",
|
|
50
50
|
"label": "None (plain React/Vite without a UI kit)"
|
|
51
51
|
},
|
|
52
|
-
{
|
|
53
|
-
"value": "cloudscape",
|
|
54
|
-
"label": "Cloudscape (AWS-first components with ready-made layouts)"
|
|
55
|
-
},
|
|
56
52
|
{
|
|
57
53
|
"value": "shadcn",
|
|
58
54
|
"label": "Shadcn (shared UI library under packages/common/shadcn)"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"value": "cloudscape",
|
|
58
|
+
"label": "Cloudscape (AWS-first components with ready-made layouts)"
|
|
59
59
|
}
|
|
60
60
|
],
|
|
61
|
-
"default": "
|
|
61
|
+
"default": "shadcn"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"tailwind": {
|
|
@@ -17,8 +17,8 @@ const CognitoAuth: React.FC<PropsWithChildren> = ({ children }) => {
|
|
|
17
17
|
const { cognitoProps } = useRuntimeConfig();
|
|
18
18
|
|
|
19
19
|
if (!cognitoProps) {
|
|
20
|
-
if (import.meta.env.MODE === '
|
|
21
|
-
// In
|
|
20
|
+
if (import.meta.env.MODE === 'local-dev') {
|
|
21
|
+
// In local-dev mode with no cognitoProps available, we skip login
|
|
22
22
|
return <AuthProvider>{children}</AuthProvider>;
|
|
23
23
|
}
|
|
24
24
|
return (
|
|
@@ -90,7 +90,14 @@ exports[`cognito-auth generator > should generate files > user-identity 1`] = `
|
|
|
90
90
|
IdentityPool,
|
|
91
91
|
UserPoolAuthenticationProvider,
|
|
92
92
|
} from 'aws-cdk-lib/aws-cognito-identitypool';
|
|
93
|
-
import {
|
|
93
|
+
import {
|
|
94
|
+
CfnOutput,
|
|
95
|
+
CfnResource,
|
|
96
|
+
Duration,
|
|
97
|
+
Lazy,
|
|
98
|
+
RemovalPolicy,
|
|
99
|
+
Stack,
|
|
100
|
+
} from 'aws-cdk-lib';
|
|
94
101
|
import {
|
|
95
102
|
AccountRecovery,
|
|
96
103
|
CfnManagedLoginBranding,
|
|
@@ -98,15 +105,34 @@ import {
|
|
|
98
105
|
FeaturePlan,
|
|
99
106
|
Mfa,
|
|
100
107
|
OAuthScope,
|
|
108
|
+
StandardThreatProtectionMode,
|
|
101
109
|
UserPool,
|
|
102
110
|
UserPoolClient,
|
|
103
111
|
} from 'aws-cdk-lib/aws-cognito';
|
|
112
|
+
import {
|
|
113
|
+
CfnLoggingConfiguration,
|
|
114
|
+
CfnWebACL,
|
|
115
|
+
CfnWebACLAssociation,
|
|
116
|
+
} from 'aws-cdk-lib/aws-wafv2';
|
|
117
|
+
import { LogGroup, RetentionDays } from 'aws-cdk-lib/aws-logs';
|
|
104
118
|
import { Construct } from 'constructs';
|
|
105
119
|
import { RuntimeConfig } from './runtime-config.js';
|
|
106
120
|
import { Distribution } from 'aws-cdk-lib/aws-cloudfront';
|
|
107
121
|
import { suppressRules } from './checkov.js';
|
|
108
122
|
|
|
109
123
|
const WEB_CLIENT_ID = 'WebClient';
|
|
124
|
+
|
|
125
|
+
export interface UserIdentityProps {
|
|
126
|
+
/**
|
|
127
|
+
* Whether to enable AWS WAFv2 with the default managed ruleset
|
|
128
|
+
* (AWSManagedRulesCommonRuleSet and AWSManagedRulesKnownBadInputsRuleSet)
|
|
129
|
+
* and associate it with the user pool.
|
|
130
|
+
*
|
|
131
|
+
* @default true
|
|
132
|
+
*/
|
|
133
|
+
readonly enableWaf?: boolean;
|
|
134
|
+
}
|
|
135
|
+
|
|
110
136
|
/**
|
|
111
137
|
* Creates a UserPool and Identity Pool with sane defaults configured intended for usage from a web client.
|
|
112
138
|
*/
|
|
@@ -117,11 +143,22 @@ export class UserIdentity extends Construct {
|
|
|
117
143
|
public readonly userPoolClient: UserPoolClient;
|
|
118
144
|
public readonly userPoolDomain: CfnUserPoolDomain;
|
|
119
145
|
|
|
120
|
-
|
|
146
|
+
/** The WAFv2 Web ACL associated with the user pool, if WAF is enabled */
|
|
147
|
+
public readonly webAcl?: CfnWebACL;
|
|
148
|
+
|
|
149
|
+
constructor(
|
|
150
|
+
scope: Construct,
|
|
151
|
+
id: string,
|
|
152
|
+
{ enableWaf = true }: UserIdentityProps = {},
|
|
153
|
+
) {
|
|
121
154
|
super(scope, id);
|
|
122
155
|
|
|
123
156
|
this.region = Stack.of(this).region;
|
|
124
157
|
this.userPool = this.createUserPool();
|
|
158
|
+
|
|
159
|
+
if (enableWaf) {
|
|
160
|
+
this.webAcl = this.createWebAcl(id, this.userPool);
|
|
161
|
+
}
|
|
125
162
|
this.userPoolDomain = this.createUserPoolDomain(this.userPool);
|
|
126
163
|
this.userPoolClient = this.createUserPoolClient(this.userPool);
|
|
127
164
|
this.identityPool = this.createIdentityPool(
|
|
@@ -174,6 +211,8 @@ export class UserIdentity extends Construct {
|
|
|
174
211
|
},
|
|
175
212
|
mfa: Mfa.REQUIRED,
|
|
176
213
|
featurePlan: FeaturePlan.PLUS,
|
|
214
|
+
// Audit-only logs threat assessments without blocking sign-in. Switch to FULL_FUNCTION to enforce automatic responses.
|
|
215
|
+
standardThreatProtectionMode: StandardThreatProtectionMode.AUDIT_ONLY,
|
|
177
216
|
mfaSecondFactor: { sms: true, otp: true },
|
|
178
217
|
signInCaseSensitive: false,
|
|
179
218
|
signInAliases: { username: true, email: true },
|
|
@@ -206,6 +245,81 @@ export class UserIdentity extends Construct {
|
|
|
206
245
|
return userPool;
|
|
207
246
|
};
|
|
208
247
|
|
|
248
|
+
private createWebAcl = (id: string, userPool: UserPool) => {
|
|
249
|
+
const webAcl = new CfnWebACL(this, 'WebAcl', {
|
|
250
|
+
defaultAction: { allow: {} },
|
|
251
|
+
scope: 'REGIONAL',
|
|
252
|
+
visibilityConfig: {
|
|
253
|
+
cloudWatchMetricsEnabled: true,
|
|
254
|
+
metricName: \`\${id}WebAcl\`,
|
|
255
|
+
sampledRequestsEnabled: true,
|
|
256
|
+
},
|
|
257
|
+
rules: [
|
|
258
|
+
{
|
|
259
|
+
name: 'CRSRule',
|
|
260
|
+
priority: 0,
|
|
261
|
+
statement: {
|
|
262
|
+
managedRuleGroupStatement: {
|
|
263
|
+
name: 'AWSManagedRulesCommonRuleSet',
|
|
264
|
+
vendorName: 'AWS',
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
visibilityConfig: {
|
|
268
|
+
cloudWatchMetricsEnabled: true,
|
|
269
|
+
metricName: \`\${id}WebAcl-CRS\`,
|
|
270
|
+
sampledRequestsEnabled: true,
|
|
271
|
+
},
|
|
272
|
+
overrideAction: {
|
|
273
|
+
none: {},
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: 'KnownBadInputsRule',
|
|
278
|
+
priority: 1,
|
|
279
|
+
statement: {
|
|
280
|
+
managedRuleGroupStatement: {
|
|
281
|
+
name: 'AWSManagedRulesKnownBadInputsRuleSet',
|
|
282
|
+
vendorName: 'AWS',
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
visibilityConfig: {
|
|
286
|
+
cloudWatchMetricsEnabled: true,
|
|
287
|
+
metricName: \`\${id}WebAcl-KnownBadInputs\`,
|
|
288
|
+
sampledRequestsEnabled: true,
|
|
289
|
+
},
|
|
290
|
+
overrideAction: {
|
|
291
|
+
none: {},
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
new CfnWebACLAssociation(this, 'WebAclAssociation', {
|
|
298
|
+
resourceArn: userPool.userPoolArn,
|
|
299
|
+
webAclArn: webAcl.attrArn,
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// Send WAF request logs to CloudWatch. The log group name must start with
|
|
303
|
+
// \`aws-waf-logs-\` to satisfy the WAFv2 logging destination requirement.
|
|
304
|
+
const wafLogGroup = new LogGroup(this, 'WebAclLogs', {
|
|
305
|
+
logGroupName: \`aws-waf-logs-\${id}-\${this.node.addr.slice(-8)}\`,
|
|
306
|
+
retention: RetentionDays.ONE_MONTH,
|
|
307
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
308
|
+
});
|
|
309
|
+
suppressRules(
|
|
310
|
+
wafLogGroup,
|
|
311
|
+
['CKV_AWS_158'],
|
|
312
|
+
'Using default CloudWatch log encryption for WAF logs',
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
new CfnLoggingConfiguration(this, 'WebAclLoggingConfig', {
|
|
316
|
+
resourceArn: webAcl.attrArn,
|
|
317
|
+
logDestinationConfigs: [wafLogGroup.logGroupArn],
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
return webAcl;
|
|
321
|
+
};
|
|
322
|
+
|
|
209
323
|
private createUserPoolDomain = (userPool: UserPool) =>
|
|
210
324
|
new CfnUserPoolDomain(this, 'UserPoolDomain', {
|
|
211
325
|
domain: \`test-\${Stack.of(this).account}\`,
|
|
@@ -6,7 +6,7 @@ exports[`cognito-auth generator terraform iac > should generate terraform files
|
|
|
6
6
|
required_providers {
|
|
7
7
|
aws = {
|
|
8
8
|
source = "hashicorp/aws"
|
|
9
|
-
version = "
|
|
9
|
+
version = "6.52.0"
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -63,10 +63,11 @@ resource "null_resource" "add_callback_url" {
|
|
|
63
63
|
|
|
64
64
|
provisioner "local-exec" {
|
|
65
65
|
command = <<-EOT
|
|
66
|
-
uv run --with boto3 python -c "
|
|
66
|
+
uv run --with boto3==1.43.29 python -c "
|
|
67
67
|
import boto3
|
|
68
68
|
import os
|
|
69
69
|
import sys
|
|
70
|
+
import time
|
|
70
71
|
|
|
71
72
|
# Configuration
|
|
72
73
|
user_pool_id = os.environ['USER_POOL_ID']
|
|
@@ -76,12 +77,24 @@ new_callback_url = os.environ['NEW_CALLBACK_URL']
|
|
|
76
77
|
# Initialize Cognito client
|
|
77
78
|
cognito = boto3.client('cognito-idp')
|
|
78
79
|
|
|
80
|
+
# A freshly created user pool / client can take several minutes to become
|
|
81
|
+
# visible to describe_user_pool_client, so retry on ResourceNotFoundException.
|
|
82
|
+
def describe_with_retry():
|
|
83
|
+
deadline = time.time() + 5 * 60
|
|
84
|
+
while True:
|
|
85
|
+
try:
|
|
86
|
+
return cognito.describe_user_pool_client(
|
|
87
|
+
UserPoolId=user_pool_id,
|
|
88
|
+
ClientId=client_id,
|
|
89
|
+
)
|
|
90
|
+
except cognito.exceptions.ResourceNotFoundException:
|
|
91
|
+
if time.time() >= deadline:
|
|
92
|
+
raise
|
|
93
|
+
time.sleep(5)
|
|
94
|
+
|
|
79
95
|
try:
|
|
80
96
|
# Get current user pool client configuration
|
|
81
|
-
response =
|
|
82
|
-
UserPoolId=user_pool_id,
|
|
83
|
-
ClientId=client_id
|
|
84
|
-
)
|
|
97
|
+
response = describe_with_retry()
|
|
85
98
|
|
|
86
99
|
client_config = response['UserPoolClient']
|
|
87
100
|
current_callback_urls = client_config.get('CallbackURLs', [])
|
|
@@ -134,11 +147,18 @@ except Exception as e:
|
|
|
134
147
|
}
|
|
135
148
|
|
|
136
149
|
",
|
|
137
|
-
"user-identity.tf": "
|
|
150
|
+
"user-identity.tf": "variable "enable_waf" {
|
|
151
|
+
description = "Whether to enable AWS WAFv2 with the default managed ruleset and associate it with the user pool"
|
|
152
|
+
type = bool
|
|
153
|
+
default = true
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
module "identity" {
|
|
138
157
|
source = "./identity"
|
|
139
158
|
|
|
140
159
|
user_pool_domain_prefix = "test"
|
|
141
160
|
allow_signup = true
|
|
161
|
+
enable_waf = var.enable_waf
|
|
142
162
|
}
|
|
143
163
|
|
|
144
164
|
# Outputs
|
package/src/ts/react-website/cognito-auth/files/app/components/CognitoAuth/index.tsx.template
CHANGED
|
@@ -14,8 +14,8 @@ const CognitoAuth: React.FC<PropsWithChildren> = ({ children }) => {
|
|
|
14
14
|
const { cognitoProps } = useRuntimeConfig();
|
|
15
15
|
|
|
16
16
|
if (!cognitoProps) {
|
|
17
|
-
if (import.meta.env.MODE === '
|
|
18
|
-
// In
|
|
17
|
+
if (import.meta.env.MODE === 'local-dev') {
|
|
18
|
+
// In local-dev mode with no cognitoProps available, we skip login
|
|
19
19
|
return <AuthProvider>{children}</AuthProvider>;
|
|
20
20
|
}
|
|
21
21
|
return (
|
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.COGNITO_AUTH_GENERATOR_INFO = void 0;
|
|
4
|
-
exports.tsReactWebsiteAuthGenerator = tsReactWebsiteAuthGenerator;
|
|
5
1
|
/**
|
|
6
2
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const projectConfig = (0, nx_1.readProjectConfigurationUnqualified)(tree, options.project);
|
|
4
|
+
*/ import { addDependenciesToPackageJson, generateFiles, installPackagesTask, joinPathFragments, OverwriteStrategy } from "@nx/devkit";
|
|
5
|
+
import { readFileSync } from "fs";
|
|
6
|
+
import { join } from "path";
|
|
7
|
+
import { addDestructuredImport, addSingleImport, applyGritQL } from "../../../utils/ast.js";
|
|
8
|
+
import { addHookResultToRouterProviderContext } from "../../../utils/ast/website.js";
|
|
9
|
+
import { formatFilesInSubtree } from "../../../utils/format.js";
|
|
10
|
+
import { resolveIac } from "../../../utils/iac.js";
|
|
11
|
+
import { addIdentityInfra } from "../../../utils/identity-constructs/identity-constructs.js";
|
|
12
|
+
import { addGeneratorMetricsIfApplicable } from "../../../utils/metrics.js";
|
|
13
|
+
import { getNpmScope } from "../../../utils/npm-scope.js";
|
|
14
|
+
import { addComponentGeneratorMetadata, getGeneratorInfo, readProjectConfigurationUnqualified } from "../../../utils/nx.js";
|
|
15
|
+
import { toProjectRelativePath } from "../../../utils/paths.js";
|
|
16
|
+
import { sharedConstructsGenerator } from "../../../utils/shared-constructs.js";
|
|
17
|
+
import { withVersions } from "../../../utils/versions.js";
|
|
18
|
+
import { runtimeConfigGenerator } from "../runtime-config/generator.js";
|
|
19
|
+
import { addCloudscapeAuthMenu, addNoneAuthMenu, addShadcnAuthMenu, deriveCognitoDomainPrefix } from "./utils.js";
|
|
20
|
+
const readGritPattern = (name)=>readFileSync(join(import.meta.dirname, 'grit', `${name}.grit`), 'utf-8').trim();
|
|
21
|
+
export const COGNITO_AUTH_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
|
|
22
|
+
export async function tsReactWebsiteAuthGenerator(tree, options) {
|
|
23
|
+
const projectConfig = readProjectConfigurationUnqualified(tree, options.project);
|
|
29
24
|
const srcRoot = projectConfig.sourceRoot;
|
|
30
|
-
const cognitoDomain = options.cognitoDomain && options.cognitoDomain.length > 0
|
|
31
|
-
|
|
32
|
-
:
|
|
33
|
-
await (0, generator_1.runtimeConfigGenerator)(tree, {
|
|
34
|
-
project: options.project,
|
|
25
|
+
const cognitoDomain = options.cognitoDomain && options.cognitoDomain.length > 0 ? options.cognitoDomain : deriveCognitoDomainPrefix(getNpmScope(tree), projectConfig.name);
|
|
26
|
+
await runtimeConfigGenerator(tree, {
|
|
27
|
+
project: options.project
|
|
35
28
|
});
|
|
36
|
-
const iac = await
|
|
37
|
-
await
|
|
38
|
-
iac
|
|
29
|
+
const iac = await resolveIac(tree, options.iac);
|
|
30
|
+
await sharedConstructsGenerator(tree, {
|
|
31
|
+
iac
|
|
39
32
|
});
|
|
40
|
-
await
|
|
33
|
+
await addIdentityInfra(tree, {
|
|
41
34
|
iac,
|
|
42
35
|
allowSignup: options.allowSignup,
|
|
43
|
-
cognitoDomain
|
|
36
|
+
cognitoDomain
|
|
44
37
|
});
|
|
45
|
-
|
|
46
|
-
overwriteStrategy:
|
|
38
|
+
generateFiles(tree, joinPathFragments(import.meta.dirname, 'files', 'app'), srcRoot, options, {
|
|
39
|
+
overwriteStrategy: OverwriteStrategy.KeepExisting
|
|
47
40
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
addDependenciesToPackageJson(tree, withVersions([
|
|
42
|
+
'oidc-client-ts',
|
|
43
|
+
'react-oidc-context'
|
|
44
|
+
]), {});
|
|
45
|
+
const mainTsxPath = joinPathFragments(srcRoot, 'main.tsx');
|
|
46
|
+
await addSingleImport(tree, mainTsxPath, 'CognitoAuth', './components/CognitoAuth');
|
|
47
|
+
await addHookResultToRouterProviderContext(tree, mainTsxPath, {
|
|
52
48
|
hook: 'useAuth',
|
|
53
49
|
module: 'react-oidc-context',
|
|
54
|
-
contextProp: 'auth'
|
|
50
|
+
contextProp: 'auth'
|
|
55
51
|
});
|
|
56
|
-
const projectConfiguration =
|
|
57
|
-
const ux = (projectConfiguration.metadata?.ux ?? '
|
|
58
|
-
await
|
|
52
|
+
const projectConfiguration = readProjectConfigurationUnqualified(tree, options.project);
|
|
53
|
+
const ux = (projectConfiguration.metadata?.ux ?? 'shadcn').toLowerCase();
|
|
54
|
+
await applyGritQL(tree, mainTsxPath, readGritPattern('cognito-auth-wrapper'));
|
|
59
55
|
// Update App Layout
|
|
60
|
-
const appLayoutTsxPath =
|
|
56
|
+
const appLayoutTsxPath = joinPathFragments(srcRoot, 'components', 'AppLayout', 'index.tsx');
|
|
61
57
|
if (tree.exists(appLayoutTsxPath)) {
|
|
62
|
-
await
|
|
63
|
-
|
|
58
|
+
await addDestructuredImport(tree, appLayoutTsxPath, [
|
|
59
|
+
'useAuth'
|
|
60
|
+
], 'react-oidc-context');
|
|
61
|
+
await applyGritQL(tree, appLayoutTsxPath, readGritPattern('app-layout-use-auth'));
|
|
64
62
|
// TODO: update utils if they exist by appending to the array
|
|
65
63
|
// Add a top-level navigation menu that shows the signed-in user's profile and actions
|
|
66
|
-
switch
|
|
64
|
+
switch(ux){
|
|
67
65
|
case 'cloudscape':
|
|
68
|
-
await
|
|
66
|
+
await addCloudscapeAuthMenu(tree, appLayoutTsxPath);
|
|
69
67
|
break;
|
|
70
68
|
case 'shadcn':
|
|
71
|
-
await
|
|
69
|
+
await addShadcnAuthMenu(tree, appLayoutTsxPath);
|
|
72
70
|
break;
|
|
73
71
|
case 'none':
|
|
74
|
-
await
|
|
72
|
+
await addNoneAuthMenu(tree, appLayoutTsxPath);
|
|
75
73
|
break;
|
|
76
74
|
default:
|
|
77
75
|
throw new Error(`Top-level navigation menu to show the signed-in user for ux "${ux}" is not implemented.`);
|
|
78
76
|
}
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
77
|
+
} else {
|
|
81
78
|
console.info(`Skipping update to ${appLayoutTsxPath} as it does not exist.`);
|
|
82
79
|
}
|
|
83
80
|
// End update App Layout
|
|
84
|
-
|
|
85
|
-
await
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
addComponentGeneratorMetadata(tree, options.project, COGNITO_AUTH_GENERATOR_INFO, toProjectRelativePath(projectConfig, joinPathFragments(srcRoot, 'components', 'CognitoAuth')));
|
|
82
|
+
await addGeneratorMetricsIfApplicable(tree, [
|
|
83
|
+
COGNITO_AUTH_GENERATOR_INFO
|
|
84
|
+
]);
|
|
85
|
+
await formatFilesInSubtree(tree);
|
|
86
|
+
return ()=>{
|
|
87
|
+
installPackagesTask(tree);
|
|
89
88
|
};
|
|
90
89
|
}
|
|
91
|
-
|
|
90
|
+
export default tsReactWebsiteAuthGenerator;
|
|
91
|
+
|
|
92
92
|
//# sourceMappingURL=generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/react-website/cognito-auth/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addDependenciesToPackageJson,\n generateFiles,\n installPackagesTask,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n} from '@nx/devkit';\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\nimport {\n addDestructuredImport,\n addSingleImport,\n applyGritQL,\n} from '../../../utils/ast';\nimport { addHookResultToRouterProviderContext } from '../../../utils/ast/website';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { resolveIac } from '../../../utils/iac';\nimport { addIdentityInfra } from '../../../utils/identity-constructs/identity-constructs';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics';\nimport { getNpmScope } from '../../../utils/npm-scope';\nimport {\n addComponentGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx';\nimport { toProjectRelativePath } from '../../../utils/paths';\nimport { sharedConstructsGenerator } from '../../../utils/shared-constructs';\nimport { withVersions } from '../../../utils/versions';\nimport { runtimeConfigGenerator } from '../runtime-config/generator';\nimport type { TsReactWebsiteAuthGeneratorSchema } from './schema';\nimport {\n addCloudscapeAuthMenu,\n addNoneAuthMenu,\n addShadcnAuthMenu,\n deriveCognitoDomainPrefix,\n} from './utils';\n\nconst readGritPattern = (name: string): string =>\n readFileSync(\n join(import.meta.dirname, 'grit', `${name}.grit`),\n 'utf-8',\n ).trim();\n\nexport const COGNITO_AUTH_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport async function tsReactWebsiteAuthGenerator(\n tree: Tree,\n options: TsReactWebsiteAuthGeneratorSchema,\n) {\n const projectConfig = readProjectConfigurationUnqualified(\n tree,\n options.project,\n );\n const srcRoot = projectConfig.sourceRoot;\n\n const cognitoDomain =\n options.cognitoDomain && options.cognitoDomain.length > 0\n ? options.cognitoDomain\n : deriveCognitoDomainPrefix(getNpmScope(tree), projectConfig.name!);\n\n await runtimeConfigGenerator(tree, {\n project: options.project,\n });\n\n const iac = await resolveIac(tree, options.iac);\n\n await sharedConstructsGenerator(tree, {\n iac,\n });\n\n await addIdentityInfra(tree, {\n iac,\n allowSignup: options.allowSignup,\n cognitoDomain,\n });\n\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'app'),\n srcRoot,\n options,\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n addDependenciesToPackageJson(\n tree,\n withVersions(['oidc-client-ts', 'react-oidc-context']),\n {},\n );\n\n const mainTsxPath = joinPathFragments(srcRoot, 'main.tsx');\n\n await addSingleImport(\n tree,\n mainTsxPath,\n 'CognitoAuth',\n './components/CognitoAuth',\n );\n\n await addHookResultToRouterProviderContext(tree, mainTsxPath, {\n hook: 'useAuth',\n module: 'react-oidc-context',\n contextProp: 'auth',\n });\n\n const projectConfiguration = readProjectConfigurationUnqualified(\n tree,\n options.project,\n );\n\n const ux = (\n (projectConfiguration.metadata as any)?.ux ?? 'shadcn'\n ).toLowerCase();\n\n await applyGritQL(tree, mainTsxPath, readGritPattern('cognito-auth-wrapper'));\n // Update App Layout\n const appLayoutTsxPath = joinPathFragments(\n srcRoot,\n 'components',\n 'AppLayout',\n 'index.tsx',\n );\n if (tree.exists(appLayoutTsxPath)) {\n await addDestructuredImport(\n tree,\n appLayoutTsxPath,\n ['useAuth'],\n 'react-oidc-context',\n );\n await applyGritQL(\n tree,\n appLayoutTsxPath,\n readGritPattern('app-layout-use-auth'),\n );\n // TODO: update utils if they exist by appending to the array\n // Add a top-level navigation menu that shows the signed-in user's profile and actions\n switch (ux) {\n case 'cloudscape':\n await addCloudscapeAuthMenu(tree, appLayoutTsxPath);\n break;\n case 'shadcn':\n await addShadcnAuthMenu(tree, appLayoutTsxPath);\n break;\n case 'none':\n await addNoneAuthMenu(tree, appLayoutTsxPath);\n break;\n default:\n throw new Error(\n `Top-level navigation menu to show the signed-in user for ux \"${ux}\" is not implemented.`,\n );\n }\n } else {\n console.info(\n `Skipping update to ${appLayoutTsxPath} as it does not exist.`,\n );\n }\n // End update App Layout\n\n addComponentGeneratorMetadata(\n tree,\n options.project,\n COGNITO_AUTH_GENERATOR_INFO,\n toProjectRelativePath(\n projectConfig,\n joinPathFragments(srcRoot, 'components', 'CognitoAuth'),\n ),\n );\n\n await addGeneratorMetricsIfApplicable(tree, [COGNITO_AUTH_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () => {\n installPackagesTask(tree);\n };\n}\nexport default tsReactWebsiteAuthGenerator;\n"],"names":["addDependenciesToPackageJson","generateFiles","installPackagesTask","joinPathFragments","OverwriteStrategy","readFileSync","join","addDestructuredImport","addSingleImport","applyGritQL","addHookResultToRouterProviderContext","formatFilesInSubtree","resolveIac","addIdentityInfra","addGeneratorMetricsIfApplicable","getNpmScope","addComponentGeneratorMetadata","getGeneratorInfo","readProjectConfigurationUnqualified","toProjectRelativePath","sharedConstructsGenerator","withVersions","runtimeConfigGenerator","addCloudscapeAuthMenu","addNoneAuthMenu","addShadcnAuthMenu","deriveCognitoDomainPrefix","readGritPattern","name","dirname","trim","COGNITO_AUTH_GENERATOR_INFO","filename","tsReactWebsiteAuthGenerator","tree","options","projectConfig","project","srcRoot","sourceRoot","cognitoDomain","length","iac","allowSignup","overwriteStrategy","KeepExisting","mainTsxPath","hook","module","contextProp","projectConfiguration","ux","metadata","toLowerCase","appLayoutTsxPath","exists","Error","console","info"],"mappings":"AAAA;;;CAGC,GACD,SACEA,4BAA4B,EAC5BC,aAAa,EACbC,mBAAmB,EACnBC,iBAAiB,EACjBC,iBAAiB,QAEZ,aAAa;AACpB,SAASC,YAAY,QAAQ,KAAK;AAClC,SAASC,IAAI,QAAQ,OAAO;AAC5B,SACEC,qBAAqB,EACrBC,eAAe,EACfC,WAAW,QACN,wBAAqB;AAC5B,SAASC,oCAAoC,QAAQ,gCAA6B;AAClF,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,UAAU,QAAQ,wBAAqB;AAChD,SAASC,gBAAgB,QAAQ,4DAAyD;AAC1F,SAASC,+BAA+B,QAAQ,4BAAyB;AACzE,SAASC,WAAW,QAAQ,8BAA2B;AACvD,SACEC,6BAA6B,EAC7BC,gBAAgB,EAEhBC,mCAAmC,QAC9B,uBAAoB;AAC3B,SAASC,qBAAqB,QAAQ,0BAAuB;AAC7D,SAASC,yBAAyB,QAAQ,sCAAmC;AAC7E,SAASC,YAAY,QAAQ,6BAA0B;AACvD,SAASC,sBAAsB,QAAQ,iCAA8B;AAErE,SACEC,qBAAqB,EACrBC,eAAe,EACfC,iBAAiB,EACjBC,yBAAyB,QACpB,aAAU;AAEjB,MAAMC,kBAAkB,CAACC,OACvBvB,aACEC,KAAK,YAAYuB,OAAO,EAAE,QAAQ,GAAGD,KAAK,KAAK,CAAC,GAChD,SACAE,IAAI;AAER,OAAO,MAAMC,8BAA+Cd,iBAC1D,YAAYe,QAAQ,EACpB;AAEF,OAAO,eAAeC,4BACpBC,IAAU,EACVC,OAA0C;IAE1C,MAAMC,gBAAgBlB,oCACpBgB,MACAC,QAAQE,OAAO;IAEjB,MAAMC,UAAUF,cAAcG,UAAU;IAExC,MAAMC,gBACJL,QAAQK,aAAa,IAAIL,QAAQK,aAAa,CAACC,MAAM,GAAG,IACpDN,QAAQK,aAAa,GACrBd,0BAA0BX,YAAYmB,OAAOE,cAAcR,IAAI;IAErE,MAAMN,uBAAuBY,MAAM;QACjCG,SAASF,QAAQE,OAAO;IAC1B;IAEA,MAAMK,MAAM,MAAM9B,WAAWsB,MAAMC,QAAQO,GAAG;IAE9C,MAAMtB,0BAA0Bc,MAAM;QACpCQ;IACF;IAEA,MAAM7B,iBAAiBqB,MAAM;QAC3BQ;QACAC,aAAaR,QAAQQ,WAAW;QAChCH;IACF;IAEAvC,cACEiC,MACA/B,kBAAkB,YAAY0B,OAAO,EAAE,SAAS,QAChDS,SACAH,SACA;QACES,mBAAmBxC,kBAAkByC,YAAY;IACnD;IAGF7C,6BACEkC,MACAb,aAAa;QAAC;QAAkB;KAAqB,GACrD,CAAC;IAGH,MAAMyB,cAAc3C,kBAAkBmC,SAAS;IAE/C,MAAM9B,gBACJ0B,MACAY,aACA,eACA;IAGF,MAAMpC,qCAAqCwB,MAAMY,aAAa;QAC5DC,MAAM;QACNC,QAAQ;QACRC,aAAa;IACf;IAEA,MAAMC,uBAAuBhC,oCAC3BgB,MACAC,QAAQE,OAAO;IAGjB,MAAMc,KAAK,AACT,CAAA,AAACD,qBAAqBE,QAAQ,EAAUD,MAAM,QAAO,EACrDE,WAAW;IAEb,MAAM5C,YAAYyB,MAAMY,aAAanB,gBAAgB;IACrD,oBAAoB;IACpB,MAAM2B,mBAAmBnD,kBACvBmC,SACA,cACA,aACA;IAEF,IAAIJ,KAAKqB,MAAM,CAACD,mBAAmB;QACjC,MAAM/C,sBACJ2B,MACAoB,kBACA;YAAC;SAAU,EACX;QAEF,MAAM7C,YACJyB,MACAoB,kBACA3B,gBAAgB;QAElB,6DAA6D;QAC7D,sFAAsF;QACtF,OAAQwB;YACN,KAAK;gBACH,MAAM5B,sBAAsBW,MAAMoB;gBAClC;YACF,KAAK;gBACH,MAAM7B,kBAAkBS,MAAMoB;gBAC9B;YACF,KAAK;gBACH,MAAM9B,gBAAgBU,MAAMoB;gBAC5B;YACF;gBACE,MAAM,IAAIE,MACR,CAAC,6DAA6D,EAAEL,GAAG,qBAAqB,CAAC;QAE/F;IACF,OAAO;QACLM,QAAQC,IAAI,CACV,CAAC,mBAAmB,EAAEJ,iBAAiB,sBAAsB,CAAC;IAElE;IACA,wBAAwB;IAExBtC,8BACEkB,MACAC,QAAQE,OAAO,EACfN,6BACAZ,sBACEiB,eACAjC,kBAAkBmC,SAAS,cAAc;IAI7C,MAAMxB,gCAAgCoB,MAAM;QAACH;KAA4B;IAEzE,MAAMpB,qBAAqBuB;IAC3B,OAAO;QACLhC,oBAAoBgC;IACtB;AACF;AACA,eAAeD,4BAA4B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/react-website/cognito-auth/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IacOption } from '../../../utils/iac';\n\nexport interface TsReactWebsiteAuthGeneratorSchema {\n project: string;\n allowSignup: boolean;\n cognitoDomain?: string;\n iac: IacOption;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAID,WAKC"}
|
|
@@ -1,52 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const ast_1 = require("../../../utils/ast");
|
|
10
|
-
const names_1 = require("../../../utils/names");
|
|
11
|
-
const readGritPattern = (name) => (0, fs_1.readFileSync)((0, path_1.join)(__dirname, 'grit', `${name}.grit`), 'utf-8').trim();
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/ import { readFileSync } from "fs";
|
|
5
|
+
import { join } from "path";
|
|
6
|
+
import { addDestructuredImport, applyGritQL } from "../../../utils/ast.js";
|
|
7
|
+
import { kebabCase } from "../../../utils/names.js";
|
|
8
|
+
const readGritPattern = (name)=>readFileSync(join(import.meta.dirname, 'grit', `${name}.grit`), 'utf-8').trim();
|
|
12
9
|
// Leaves room for the IaC suffix (Terraform: `-<12-digit account>-<8-char hex>` = 22 chars) inside Cognito's 63-char limit.
|
|
13
10
|
const MAX_DERIVED_DOMAIN_PREFIX_LENGTH = 41;
|
|
14
11
|
// Cognito rejects domains containing these substrings ("Domain cannot contain reserved word").
|
|
15
|
-
const COGNITO_DOMAIN_RESERVED_WORDS = [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
const COGNITO_DOMAIN_RESERVED_WORDS = [
|
|
13
|
+
'aws',
|
|
14
|
+
'amazon',
|
|
15
|
+
'cognito'
|
|
16
|
+
];
|
|
17
|
+
export const deriveCognitoDomainPrefix = (npmScope, projectName)=>{
|
|
18
|
+
const projectWithoutScope = projectName.includes('/') ? projectName.split('/').pop() : projectName;
|
|
19
|
+
const kebab = kebabCase([
|
|
20
|
+
npmScope,
|
|
21
|
+
projectWithoutScope
|
|
22
|
+
].filter(Boolean).join('-'));
|
|
23
|
+
const stripped = COGNITO_DOMAIN_RESERVED_WORDS.reduce((s, word)=>s.replaceAll(word, ''), kebab);
|
|
24
|
+
const candidate = stripped.replace(/-+/g, '-').replace(/^-|-$/g, '').slice(0, MAX_DERIVED_DOMAIN_PREFIX_LENGTH).replace(/-$/, '');
|
|
27
25
|
if (!candidate) {
|
|
28
26
|
throw new Error(`Unable to derive a valid Cognito domain prefix from scope "${npmScope ?? ''}" and project "${projectName}". Please specify a cognitoDomain explicitly.`);
|
|
29
27
|
}
|
|
30
28
|
return candidate;
|
|
31
29
|
};
|
|
32
|
-
exports.deriveCognitoDomainPrefix = deriveCognitoDomainPrefix;
|
|
33
30
|
// Adds a user greeting and sign-out button to the default AppLayout header when using the None UX provider.
|
|
34
|
-
async function addNoneAuthMenu(tree, appLayoutTsxPath) {
|
|
35
|
-
await
|
|
31
|
+
export async function addNoneAuthMenu(tree, appLayoutTsxPath) {
|
|
32
|
+
await applyGritQL(tree, appLayoutTsxPath, readGritPattern('none-auth-menu'));
|
|
36
33
|
}
|
|
37
34
|
// Adds a top navigation dropdown with sign-out when using the Cloudscape UX provider.
|
|
38
|
-
async function addCloudscapeAuthMenu(tree, appLayoutTsxPath) {
|
|
39
|
-
await
|
|
35
|
+
export async function addCloudscapeAuthMenu(tree, appLayoutTsxPath) {
|
|
36
|
+
await applyGritQL(tree, appLayoutTsxPath, readGritPattern('cloudscape-auth-menu'));
|
|
40
37
|
}
|
|
41
|
-
async function addShadcnAuthMenu(tree, appLayoutTsxPath) {
|
|
38
|
+
export async function addShadcnAuthMenu(tree, appLayoutTsxPath) {
|
|
42
39
|
if (!tree.exists(appLayoutTsxPath)) {
|
|
43
40
|
throw new Error(`Expected top nav component at ${appLayoutTsxPath}`);
|
|
44
41
|
}
|
|
45
42
|
// Prepend state declarations to the AppLayout component body
|
|
46
|
-
await
|
|
43
|
+
await applyGritQL(tree, appLayoutTsxPath, readGritPattern('shadcn-state-declarations'));
|
|
47
44
|
// Add useEffect, useRef, useState imports from react
|
|
48
|
-
await
|
|
45
|
+
await addDestructuredImport(tree, appLayoutTsxPath, [
|
|
46
|
+
'useEffect',
|
|
47
|
+
'useRef',
|
|
48
|
+
'useState'
|
|
49
|
+
], 'react');
|
|
49
50
|
// Append the auth menu to the header element
|
|
50
|
-
await
|
|
51
|
+
await applyGritQL(tree, appLayoutTsxPath, readGritPattern('shadcn-auth-menu'));
|
|
51
52
|
}
|
|
53
|
+
|
|
52
54
|
//# sourceMappingURL=utils.js.map
|