@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
|
@@ -1,129 +1,121 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pyFastApiProjectGenerator = exports.FAST_API_GENERATOR_INFO = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
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
|
-
|
|
25
|
-
const
|
|
26
|
-
exports.FAST_API_GENERATOR_INFO = (0, nx_1.getGeneratorInfo)(__filename);
|
|
4
|
+
*/ import { generateFiles, installPackagesTask, joinPathFragments, OverwriteStrategy, readProjectConfiguration, updateProjectConfiguration } from "@nx/devkit";
|
|
5
|
+
import { addApiGatewayInfra } from "../../utils/api-constructs/api-constructs.js";
|
|
6
|
+
import { addSharedConstructsOpenApiMetadataGenerateTarget } from "../../utils/api-constructs/open-api-metadata.js";
|
|
7
|
+
import { addPythonBundleTarget } from "../../utils/bundle/bundle.js";
|
|
8
|
+
import { formatFilesInSubtree } from "../../utils/format.js";
|
|
9
|
+
import { FsCommands } from "../../utils/fs.js";
|
|
10
|
+
import { resolveIac } from "../../utils/iac.js";
|
|
11
|
+
import { addGeneratorMetricsIfApplicable } from "../../utils/metrics.js";
|
|
12
|
+
import { toClassName, toKebabCase } from "../../utils/names.js";
|
|
13
|
+
import { addGeneratorMetadata, getGeneratorInfo } from "../../utils/nx.js";
|
|
14
|
+
import { Logger, UVProvider } from "../../utils/nxlv-python.js";
|
|
15
|
+
import { sortObjectKeys } from "../../utils/object.js";
|
|
16
|
+
import { assignPort } from "../../utils/port.js";
|
|
17
|
+
import { addDependenciesToDependencyGroupInPyProjectToml, addDependenciesToPyProjectToml } from "../../utils/py.js";
|
|
18
|
+
import { sharedConstructsGenerator } from "../../utils/shared-constructs.js";
|
|
19
|
+
import pyProjectGenerator, { getPyProjectDetails } from "../project/generator.js";
|
|
20
|
+
import { addOpenApiGeneration } from "./react/open-api.js";
|
|
21
|
+
export const FAST_API_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
|
|
27
22
|
/**
|
|
28
23
|
* Generates a Python FastAPI project
|
|
29
|
-
*/
|
|
30
|
-
const pyFastApiProjectGenerator = async (tree, schema) => {
|
|
24
|
+
*/ export const pyFastApiProjectGenerator = async (tree, schema)=>{
|
|
31
25
|
const integrationPattern = getIntegrationPattern(schema);
|
|
32
|
-
const { dir, normalizedModuleName, fullyQualifiedName } =
|
|
26
|
+
const { dir, normalizedModuleName, fullyQualifiedName } = getPyProjectDetails(tree, {
|
|
33
27
|
name: schema.name,
|
|
34
28
|
directory: schema.directory,
|
|
35
29
|
subDirectory: schema.subDirectory,
|
|
36
|
-
moduleName: schema.moduleName
|
|
30
|
+
moduleName: schema.moduleName
|
|
37
31
|
});
|
|
38
|
-
const apiNameKebabCase =
|
|
39
|
-
const apiNameClassName =
|
|
32
|
+
const apiNameKebabCase = toKebabCase(schema.name);
|
|
33
|
+
const apiNameClassName = toClassName(schema.name);
|
|
40
34
|
let projectExists;
|
|
41
35
|
try {
|
|
42
|
-
|
|
36
|
+
readProjectConfiguration(tree, fullyQualifiedName);
|
|
43
37
|
projectExists = true;
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
38
|
+
} catch {
|
|
46
39
|
projectExists = false;
|
|
47
40
|
}
|
|
48
41
|
if (!projectExists) {
|
|
49
|
-
await (
|
|
42
|
+
await pyProjectGenerator(tree, {
|
|
50
43
|
name: schema.name,
|
|
51
44
|
directory: schema.directory,
|
|
52
45
|
subDirectory: schema.subDirectory,
|
|
53
46
|
moduleName: normalizedModuleName,
|
|
54
|
-
type: 'application'
|
|
47
|
+
type: 'application'
|
|
55
48
|
});
|
|
56
49
|
}
|
|
57
|
-
const projectConfig =
|
|
58
|
-
const port =
|
|
59
|
-
const { bundleOutputDir, bundleTargetName } =
|
|
50
|
+
const projectConfig = readProjectConfiguration(tree, fullyQualifiedName);
|
|
51
|
+
const port = assignPort(tree, projectConfig, 8000);
|
|
52
|
+
const { bundleOutputDir, bundleTargetName } = addPythonBundleTarget(projectConfig);
|
|
60
53
|
// Add a command to copy run.sh to the bundle output for Lambda Web Adapter
|
|
61
|
-
const fs = new
|
|
54
|
+
const fs = new FsCommands(tree);
|
|
62
55
|
const bundleTarget = projectConfig.targets[bundleTargetName];
|
|
63
56
|
const copyRunShCommand = fs.cp(`{projectRoot}/run.sh`, `dist/{projectRoot}/${bundleTargetName}/run.sh`);
|
|
64
57
|
if (!bundleTarget.options.commands.includes(copyRunShCommand)) {
|
|
65
58
|
bundleTarget.options.commands = [
|
|
66
59
|
...bundleTarget.options.commands,
|
|
67
|
-
copyRunShCommand
|
|
60
|
+
copyRunShCommand
|
|
68
61
|
];
|
|
69
62
|
}
|
|
70
63
|
projectConfig.targets.serve = {
|
|
71
64
|
executor: '@nxlv/python:run-commands',
|
|
65
|
+
continuous: true,
|
|
72
66
|
options: {
|
|
73
67
|
command: `uv run fastapi dev ${normalizedModuleName}/main.py --port ${port}`,
|
|
74
|
-
cwd: '{projectRoot}'
|
|
75
|
-
}
|
|
76
|
-
continuous: true,
|
|
68
|
+
cwd: '{projectRoot}'
|
|
69
|
+
}
|
|
77
70
|
};
|
|
78
|
-
projectConfig.targets['
|
|
79
|
-
...projectConfig.targets['
|
|
71
|
+
projectConfig.targets['dev'] = {
|
|
72
|
+
...projectConfig.targets['dev'],
|
|
80
73
|
...projectConfig.targets.serve,
|
|
81
74
|
options: {
|
|
82
75
|
...projectConfig.targets.serve.options,
|
|
83
76
|
env: {
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
}
|
|
77
|
+
LOCAL_DEV: 'true'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
87
80
|
};
|
|
88
81
|
projectConfig.metadata = {
|
|
89
82
|
...projectConfig.metadata,
|
|
90
83
|
apiName: schema.name,
|
|
91
84
|
apiType: 'fast-api',
|
|
92
|
-
auth: schema.auth
|
|
85
|
+
auth: schema.auth
|
|
93
86
|
};
|
|
94
|
-
projectConfig.targets =
|
|
95
|
-
|
|
87
|
+
projectConfig.targets = sortObjectKeys(projectConfig.targets);
|
|
88
|
+
updateProjectConfiguration(tree, fullyQualifiedName, projectConfig);
|
|
96
89
|
// Add OpenAPI spec generation to the project, run as part of build
|
|
97
|
-
const { specPath } =
|
|
90
|
+
const { specPath } = addOpenApiGeneration(tree, {
|
|
91
|
+
project: projectConfig
|
|
92
|
+
});
|
|
98
93
|
[
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
].forEach((f)
|
|
94
|
+
joinPathFragments(dir, normalizedModuleName, 'hello.py'),
|
|
95
|
+
joinPathFragments(dir, 'tests', 'test_hello.py')
|
|
96
|
+
].forEach((f)=>tree.delete(f));
|
|
102
97
|
// User-owned source files: preserve any existing copies so re-running does
|
|
103
98
|
// not clobber user edits (and does not reformat them nondeterministically).
|
|
104
|
-
(
|
|
105
|
-
(0, devkit_1.joinPathFragments)(__dirname, 'files', 'app'), // path to the file templates
|
|
106
|
-
dir, // destination path of the files
|
|
107
|
-
{
|
|
99
|
+
generateFiles(tree, joinPathFragments(import.meta.dirname, 'files', 'app'), dir, {
|
|
108
100
|
name: normalizedModuleName,
|
|
109
101
|
apiNameClassName,
|
|
110
|
-
infra: schema.infra
|
|
102
|
+
infra: schema.infra
|
|
111
103
|
}, {
|
|
112
|
-
overwriteStrategy:
|
|
104
|
+
overwriteStrategy: OverwriteStrategy.KeepExisting
|
|
113
105
|
});
|
|
114
106
|
if (schema.infra !== 'none') {
|
|
115
|
-
const iac = await
|
|
116
|
-
await
|
|
117
|
-
iac
|
|
107
|
+
const iac = await resolveIac(tree, schema.iac);
|
|
108
|
+
await sharedConstructsGenerator(tree, {
|
|
109
|
+
iac
|
|
118
110
|
});
|
|
119
111
|
if (schema.auth === 'custom') {
|
|
120
112
|
const authorizerType = schema.infra === 'http-lambda' ? 'http' : 'rest';
|
|
121
|
-
|
|
122
|
-
overwriteStrategy:
|
|
113
|
+
generateFiles(tree, joinPathFragments(import.meta.dirname, '..', '..', 'utils', 'api-constructs', 'files', 'py-authorizer', authorizerType), joinPathFragments(dir, normalizedModuleName), {}, {
|
|
114
|
+
overwriteStrategy: OverwriteStrategy.KeepExisting
|
|
123
115
|
});
|
|
124
116
|
}
|
|
125
117
|
// Add the CDK construct to deploy the FastAPI to shared constructs
|
|
126
|
-
await
|
|
118
|
+
await addApiGatewayInfra(tree, {
|
|
127
119
|
apiProjectName: projectConfig.name,
|
|
128
120
|
apiNameClassName,
|
|
129
121
|
apiNameKebabCase,
|
|
@@ -132,39 +124,41 @@ const pyFastApiProjectGenerator = async (tree, schema) => {
|
|
|
132
124
|
type: 'fastapi',
|
|
133
125
|
moduleName: normalizedModuleName,
|
|
134
126
|
bundleOutputDir,
|
|
135
|
-
integrationPattern
|
|
127
|
+
integrationPattern
|
|
136
128
|
},
|
|
137
129
|
auth: schema.auth,
|
|
138
|
-
iac
|
|
130
|
+
iac
|
|
139
131
|
});
|
|
140
|
-
|
|
132
|
+
addSharedConstructsOpenApiMetadataGenerateTarget(tree, {
|
|
141
133
|
iac,
|
|
142
134
|
apiNameKebabCase,
|
|
143
135
|
specPath,
|
|
144
|
-
specBuildTargetName: `${projectConfig.name}:openapi
|
|
136
|
+
specBuildTargetName: `${projectConfig.name}:openapi`
|
|
145
137
|
});
|
|
146
138
|
}
|
|
147
|
-
|
|
139
|
+
addDependenciesToPyProjectToml(tree, dir, [
|
|
148
140
|
'fastapi',
|
|
149
141
|
'uvicorn',
|
|
150
142
|
'aws-lambda-powertools',
|
|
151
143
|
'aws-lambda-powertools[tracer]',
|
|
152
|
-
...
|
|
153
|
-
|
|
154
|
-
|
|
144
|
+
...schema.auth === 'custom' ? [
|
|
145
|
+
'aws-lambda-powertools[parser]'
|
|
146
|
+
] : []
|
|
147
|
+
]);
|
|
148
|
+
addDependenciesToDependencyGroupInPyProjectToml(tree, dir, 'dev', [
|
|
149
|
+
'fastapi[standard]'
|
|
155
150
|
]);
|
|
156
|
-
(
|
|
157
|
-
|
|
151
|
+
addGeneratorMetadata(tree, fullyQualifiedName, FAST_API_GENERATOR_INFO);
|
|
152
|
+
await addGeneratorMetricsIfApplicable(tree, [
|
|
153
|
+
FAST_API_GENERATOR_INFO
|
|
158
154
|
]);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
await new nxlv_python_1.UVProvider(tree.root, new nxlv_python_1.Logger(), tree).install();
|
|
164
|
-
(0, devkit_1.installPackagesTask)(tree);
|
|
155
|
+
await formatFilesInSubtree(tree);
|
|
156
|
+
return async ()=>{
|
|
157
|
+
await new UVProvider(tree.root, new Logger(), tree).install();
|
|
158
|
+
installPackagesTask(tree);
|
|
165
159
|
};
|
|
166
160
|
};
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
161
|
+
const getIntegrationPattern = (schema)=>schema.integrationPattern ?? 'isolated';
|
|
162
|
+
export default pyFastApiProjectGenerator;
|
|
163
|
+
|
|
170
164
|
//# sourceMappingURL=generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/py/fast-api/generator.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,uCAUoB;AACpB,8EAA+E;AAC/E,oFAAgH;AAChH,sDAAkE;AAClE,+CAA0D;AAC1D,uCAA4C;AAC5C,yCAA6C;AAC7C,iDAAsE;AACtE,6CAA6D;AAC7D,uCAIwB;AACxB,yDAA6D;AAC7D,+CAAoD;AACpD,2CAA8C;AAC9C,uCAGwB;AACxB,qEAA0E;AAC1E,0EAA+E;AAC/E,+CAAwD;AAG3C,QAAA,uBAAuB,GAClC,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAE/B;;GAEG;AACI,MAAM,yBAAyB,GAAG,KAAK,EAC5C,IAAU,EACV,MAAuC,EACX,EAAE;IAC9B,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEzD,MAAM,EAAE,GAAG,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,GAAG,IAAA,+BAAmB,EAC3E,IAAI,EACJ;QACE,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,CACF,CAAC;IACF,MAAM,gBAAgB,GAAG,IAAA,mBAAW,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,gBAAgB,GAAG,IAAA,mBAAW,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAElD,IAAI,aAAsB,CAAC;IAC3B,IAAI,CAAC;QACH,IAAA,iCAAwB,EAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;QACnD,aAAa,GAAG,IAAI,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,aAAa,GAAG,KAAK,CAAC;IACxB,CAAC;IAED,I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AAC;IAED,IAAA,mCAA8B,EAAC,IAAI,EAAE,GAAG,EAAE;QACxC,SAAS;QACT,SAAS;QACT,uBAAuB;QACvB,+BAA+B;QAC/B,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ;YAC1B,CAAC,CAAE,CAAC,+BAA+B,CAAW;YAC9C,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC;IACH,IAAA,oDAA+C,EAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE;QAChE,mBAAmB;KACpB,CAAC,CAAC;IAEH,IAAA,yBAAoB,EAAC,IAAI,EAAE,kBAAkB,EAAE,+BAAuB,CAAC,CAAC;IAExE,MAAM,IAAA,yCAA+B,EAAC,IAAI,EAAE,CAAC,+BAAuB,CAAC,CAAC,CAAC;IAEvE,MAAM,IAAA,6BAAoB,EAAC,IAAI,CAAC,CAAC;IAEjC,OAAO,KAAK,IAAI,EAAE;QAChB,MAAM,IAAI,wBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,oBAAM,EAAE,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;QAC9D,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC,CAAC;AA1LW,QAAA,yBAAyB,6BA0LpC;AAEF,MAAM,qBAAqB,GAAG,CAC5B,MAAuC,EAChB,EAAE,CAAC,MAAM,CAAC,kBAAkB,IAAI,UAAU,CAAC;AAEpE,kBAAe,iCAAyB,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/fast-api/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n installPackagesTask,\n joinPathFragments,\n OverwriteStrategy,\n type ProjectConfiguration,\n readProjectConfiguration,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { addApiGatewayInfra } from '../../utils/api-constructs/api-constructs';\nimport { addSharedConstructsOpenApiMetadataGenerateTarget } from '../../utils/api-constructs/open-api-metadata';\nimport { addPythonBundleTarget } from '../../utils/bundle/bundle';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { FsCommands } from '../../utils/fs';\nimport { resolveIac } from '../../utils/iac';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { toClassName, toKebabCase } from '../../utils/names';\nimport {\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n} from '../../utils/nx';\nimport { Logger, UVProvider } from '../../utils/nxlv-python';\nimport { sortObjectKeys } from '../../utils/object';\nimport { assignPort } from '../../utils/port';\nimport {\n addDependenciesToDependencyGroupInPyProjectToml,\n addDependenciesToPyProjectToml,\n} from '../../utils/py';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs';\nimport pyProjectGenerator, { getPyProjectDetails } from '../project/generator';\nimport { addOpenApiGeneration } from './react/open-api';\nimport type { PyFastApiProjectGeneratorSchema } from './schema';\n\nexport const FAST_API_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\n/**\n * Generates a Python FastAPI project\n */\nexport const pyFastApiProjectGenerator = async (\n tree: Tree,\n schema: PyFastApiProjectGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const integrationPattern = getIntegrationPattern(schema);\n\n const { dir, normalizedModuleName, fullyQualifiedName } = getPyProjectDetails(\n tree,\n {\n name: schema.name,\n directory: schema.directory,\n subDirectory: schema.subDirectory,\n moduleName: schema.moduleName,\n },\n );\n const apiNameKebabCase = toKebabCase(schema.name);\n const apiNameClassName = toClassName(schema.name);\n\n let projectExists: boolean;\n try {\n readProjectConfiguration(tree, fullyQualifiedName);\n projectExists = true;\n } catch {\n projectExists = false;\n }\n\n if (!projectExists) {\n await pyProjectGenerator(tree, {\n name: schema.name,\n directory: schema.directory,\n subDirectory: schema.subDirectory,\n moduleName: normalizedModuleName,\n type: 'application',\n });\n }\n\n const projectConfig = readProjectConfiguration(tree, fullyQualifiedName);\n const port = assignPort(tree, projectConfig, 8000);\n\n const { bundleOutputDir, bundleTargetName } =\n addPythonBundleTarget(projectConfig);\n\n // Add a command to copy run.sh to the bundle output for Lambda Web Adapter\n const fs = new FsCommands(tree);\n const bundleTarget = projectConfig.targets[bundleTargetName];\n const copyRunShCommand = fs.cp(\n `{projectRoot}/run.sh`,\n `dist/{projectRoot}/${bundleTargetName}/run.sh`,\n );\n if (!bundleTarget.options.commands.includes(copyRunShCommand)) {\n bundleTarget.options.commands = [\n ...bundleTarget.options.commands,\n copyRunShCommand,\n ];\n }\n\n projectConfig.targets.serve = {\n executor: '@nxlv/python:run-commands',\n continuous: true,\n options: {\n command: `uv run fastapi dev ${normalizedModuleName}/main.py --port ${port}`,\n cwd: '{projectRoot}',\n },\n };\n\n projectConfig.targets['dev'] = {\n ...projectConfig.targets['dev'],\n ...projectConfig.targets.serve,\n options: {\n ...projectConfig.targets.serve.options,\n env: {\n LOCAL_DEV: 'true',\n },\n },\n };\n\n projectConfig.metadata = {\n ...projectConfig.metadata,\n apiName: schema.name,\n apiType: 'fast-api',\n auth: schema.auth,\n } as any;\n\n projectConfig.targets = sortObjectKeys(projectConfig.targets);\n updateProjectConfiguration(tree, fullyQualifiedName, projectConfig);\n\n // Add OpenAPI spec generation to the project, run as part of build\n const { specPath } = addOpenApiGeneration(tree, { project: projectConfig });\n\n [\n joinPathFragments(dir, normalizedModuleName, 'hello.py'),\n joinPathFragments(dir, 'tests', 'test_hello.py'),\n ].forEach((f) => tree.delete(f));\n\n // User-owned source files: preserve any existing copies so re-running does\n // not clobber user edits (and does not reformat them nondeterministically).\n generateFiles(\n tree, // the virtual file system\n joinPathFragments(import.meta.dirname, 'files', 'app'), // path to the file templates\n dir, // destination path of the files\n {\n name: normalizedModuleName,\n apiNameClassName,\n infra: schema.infra,\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n if (schema.infra !== 'none') {\n const iac = await resolveIac(tree, schema.iac);\n\n await sharedConstructsGenerator(tree, {\n iac,\n });\n\n if (schema.auth === 'custom') {\n const authorizerType = schema.infra === 'http-lambda' ? 'http' : 'rest';\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n '..',\n '..',\n 'utils',\n 'api-constructs',\n 'files',\n 'py-authorizer',\n authorizerType,\n ),\n joinPathFragments(dir, normalizedModuleName),\n {},\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n }\n\n // Add the CDK construct to deploy the FastAPI to shared constructs\n await addApiGatewayInfra(tree, {\n apiProjectName: projectConfig.name,\n apiNameClassName,\n apiNameKebabCase,\n constructType: schema.infra === 'http-lambda' ? 'http' : 'rest',\n backend: {\n type: 'fastapi',\n moduleName: normalizedModuleName,\n bundleOutputDir,\n integrationPattern,\n },\n auth: schema.auth,\n iac,\n });\n\n addSharedConstructsOpenApiMetadataGenerateTarget(tree, {\n iac,\n apiNameKebabCase,\n specPath,\n specBuildTargetName: `${projectConfig.name}:openapi`,\n });\n }\n\n addDependenciesToPyProjectToml(tree, dir, [\n 'fastapi',\n 'uvicorn',\n 'aws-lambda-powertools',\n 'aws-lambda-powertools[tracer]',\n ...(schema.auth === 'custom'\n ? (['aws-lambda-powertools[parser]'] as const)\n : []),\n ]);\n addDependenciesToDependencyGroupInPyProjectToml(tree, dir, 'dev', [\n 'fastapi[standard]',\n ]);\n\n addGeneratorMetadata(tree, fullyQualifiedName, FAST_API_GENERATOR_INFO);\n\n await addGeneratorMetricsIfApplicable(tree, [FAST_API_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n\n return async () => {\n await new UVProvider(tree.root, new Logger(), tree).install();\n installPackagesTask(tree);\n };\n};\n\nconst getIntegrationPattern = (\n schema: PyFastApiProjectGeneratorSchema,\n): 'isolated' | 'shared' => schema.integrationPattern ?? 'isolated';\n\nexport default pyFastApiProjectGenerator;\n"],"names":["generateFiles","installPackagesTask","joinPathFragments","OverwriteStrategy","readProjectConfiguration","updateProjectConfiguration","addApiGatewayInfra","addSharedConstructsOpenApiMetadataGenerateTarget","addPythonBundleTarget","formatFilesInSubtree","FsCommands","resolveIac","addGeneratorMetricsIfApplicable","toClassName","toKebabCase","addGeneratorMetadata","getGeneratorInfo","Logger","UVProvider","sortObjectKeys","assignPort","addDependenciesToDependencyGroupInPyProjectToml","addDependenciesToPyProjectToml","sharedConstructsGenerator","pyProjectGenerator","getPyProjectDetails","addOpenApiGeneration","FAST_API_GENERATOR_INFO","filename","pyFastApiProjectGenerator","tree","schema","integrationPattern","getIntegrationPattern","dir","normalizedModuleName","fullyQualifiedName","name","directory","subDirectory","moduleName","apiNameKebabCase","apiNameClassName","projectExists","type","projectConfig","port","bundleOutputDir","bundleTargetName","fs","bundleTarget","targets","copyRunShCommand","cp","options","commands","includes","serve","executor","continuous","command","cwd","env","LOCAL_DEV","metadata","apiName","apiType","auth","specPath","project","forEach","f","delete","dirname","infra","overwriteStrategy","KeepExisting","iac","authorizerType","apiProjectName","constructType","backend","specBuildTargetName","root","install"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,mBAAmB,EACnBC,iBAAiB,EACjBC,iBAAiB,EAEjBC,wBAAwB,EAExBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,kBAAkB,QAAQ,+CAA4C;AAC/E,SAASC,gDAAgD,QAAQ,kDAA+C;AAChH,SAASC,qBAAqB,QAAQ,+BAA4B;AAClE,SAASC,oBAAoB,QAAQ,wBAAqB;AAC1D,SAASC,UAAU,QAAQ,oBAAiB;AAC5C,SAASC,UAAU,QAAQ,qBAAkB;AAC7C,SAASC,+BAA+B,QAAQ,yBAAsB;AACtE,SAASC,WAAW,EAAEC,WAAW,QAAQ,uBAAoB;AAC7D,SACEC,oBAAoB,EACpBC,gBAAgB,QAEX,oBAAiB;AACxB,SAASC,MAAM,EAAEC,UAAU,QAAQ,6BAA0B;AAC7D,SAASC,cAAc,QAAQ,wBAAqB;AACpD,SAASC,UA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C5BF,SAC0BA,OAAOC,kBAAkB,IAAI;AAEzD,eAAeH,0BAA0B"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
3
|
exports[`fastapi react generator > should generate OpenAPI spec script > generate_open_api.py 1`] = `
|
|
4
|
-
"
|
|
5
|
-
import json
|
|
4
|
+
"import json
|
|
6
5
|
import os
|
|
7
6
|
import sys
|
|
8
7
|
|
|
8
|
+
from src.main import app
|
|
9
|
+
|
|
9
10
|
os.makedirs(os.path.dirname(sys.argv[1]), exist_ok=True)
|
|
10
11
|
with open(sys.argv[1], "w") as f:
|
|
11
12
|
json.dump(app.openapi(), f)
|
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fastApiReactGenerator = exports.FAST_API_REACT_GENERATOR_INFO = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const fastApiProjectConfig = (0, nx_1.readProjectConfigurationUnqualified)(tree, options.fastApiProjectName);
|
|
4
|
+
*/ import { installPackagesTask } from "@nx/devkit";
|
|
5
|
+
import { addOpenApiReactClient } from "../../../utils/connection/open-api/react.js";
|
|
6
|
+
import { formatFilesInSubtree } from "../../../utils/format.js";
|
|
7
|
+
import { addGeneratorMetricsIfApplicable } from "../../../utils/metrics.js";
|
|
8
|
+
import { getGeneratorInfo, readProjectConfigurationUnqualified } from "../../../utils/nx.js";
|
|
9
|
+
import { addOpenApiGeneration } from "./open-api.js";
|
|
10
|
+
export const FAST_API_REACT_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
|
|
11
|
+
export const fastApiReactGenerator = async (tree, options)=>{
|
|
12
|
+
const frontendProjectConfig = readProjectConfigurationUnqualified(tree, options.frontendProjectName);
|
|
13
|
+
const fastApiProjectConfig = readProjectConfigurationUnqualified(tree, options.fastApiProjectName);
|
|
18
14
|
// Add OpenAPI spec generation to the project, run as part of build
|
|
19
|
-
const { specPath } =
|
|
20
|
-
project: fastApiProjectConfig
|
|
15
|
+
const { specPath } = addOpenApiGeneration(tree, {
|
|
16
|
+
project: fastApiProjectConfig
|
|
21
17
|
});
|
|
22
18
|
const metadata = fastApiProjectConfig.metadata;
|
|
23
19
|
const apiName = metadata?.apiName;
|
|
24
20
|
const auth = (metadata?.auth ?? 'iam').toLowerCase();
|
|
25
21
|
const port = metadata?.port ?? metadata?.ports?.[0] ?? 8000;
|
|
26
|
-
await
|
|
22
|
+
await addOpenApiReactClient(tree, {
|
|
27
23
|
apiName,
|
|
28
24
|
frontendProjectConfig,
|
|
29
25
|
backendProjectConfig: fastApiProjectConfig,
|
|
@@ -31,14 +27,16 @@ const fastApiReactGenerator = async (tree, options) => {
|
|
|
31
27
|
specPath,
|
|
32
28
|
specBuildTargetName: `${fastApiProjectConfig.name}:openapi`,
|
|
33
29
|
auth,
|
|
34
|
-
port
|
|
30
|
+
port
|
|
35
31
|
});
|
|
36
|
-
await
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
await addGeneratorMetricsIfApplicable(tree, [
|
|
33
|
+
FAST_API_REACT_GENERATOR_INFO
|
|
34
|
+
]);
|
|
35
|
+
await formatFilesInSubtree(tree);
|
|
36
|
+
return ()=>{
|
|
37
|
+
installPackagesTask(tree);
|
|
40
38
|
};
|
|
41
39
|
};
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
export default fastApiReactGenerator;
|
|
41
|
+
|
|
44
42
|
//# sourceMappingURL=generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/py/fast-api/react/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { installPackagesTask, type Tree } from '@nx/devkit';\nimport { addOpenApiReactClient } from '../../../utils/connection/open-api/react';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics';\nimport {\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx';\nimport { addOpenApiGeneration } from './open-api';\nimport type { FastApiReactGeneratorSchema } from './schema';\n\nexport const FAST_API_REACT_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const fastApiReactGenerator = async (\n tree: Tree,\n options: FastApiReactGeneratorSchema,\n) => {\n const frontendProjectConfig = readProjectConfigurationUnqualified(\n tree,\n options.frontendProjectName,\n );\n const fastApiProjectConfig = readProjectConfigurationUnqualified(\n tree,\n options.fastApiProjectName,\n );\n\n // Add OpenAPI spec generation to the project, run as part of build\n const { specPath } = addOpenApiGeneration(tree, {\n project: fastApiProjectConfig,\n });\n\n const metadata = fastApiProjectConfig.metadata as any;\n const apiName = metadata?.apiName;\n const auth = (metadata?.auth ?? 'iam').toLowerCase();\n const port = metadata?.port ?? metadata?.ports?.[0] ?? 8000;\n\n await addOpenApiReactClient(tree, {\n apiName,\n frontendProjectConfig,\n backendProjectConfig: fastApiProjectConfig,\n specBuildProject: fastApiProjectConfig,\n specPath,\n specBuildTargetName: `${fastApiProjectConfig.name}:openapi`,\n auth,\n port,\n });\n\n await addGeneratorMetricsIfApplicable(tree, [FAST_API_REACT_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () => {\n installPackagesTask(tree);\n };\n};\n\nexport default fastApiReactGenerator;\n"],"names":["installPackagesTask","addOpenApiReactClient","formatFilesInSubtree","addGeneratorMetricsIfApplicable","getGeneratorInfo","readProjectConfigurationUnqualified","addOpenApiGeneration","FAST_API_REACT_GENERATOR_INFO","filename","fastApiReactGenerator","tree","options","frontendProjectConfig","frontendProjectName","fastApiProjectConfig","fastApiProjectName","specPath","project","metadata","apiName","auth","toLowerCase","port","ports","backendProjectConfig","specBuildProject","specBuildTargetName","name"],"mappings":"AAAA;;;CAGC,GACD,SAASA,mBAAmB,QAAmB,aAAa;AAC5D,SAASC,qBAAqB,QAAQ,8CAA2C;AACjF,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,+BAA+B,QAAQ,4BAAyB;AACzE,SACEC,gBAAgB,EAEhBC,mCAAmC,QAC9B,uBAAoB;AAC3B,SAASC,oBAAoB,QAAQ,gBAAa;AAGlD,OAAO,MAAMC,gCAAiDH,iBAC5D,YAAYI,QAAQ,EACpB;AAEF,OAAO,MAAMC,wBAAwB,OACnCC,MACAC;IAEA,MAAMC,wBAAwBP,oCAC5BK,MACAC,QAAQE,mBAAmB;IAE7B,MAAMC,uBAAuBT,oCAC3BK,MACAC,QAAQI,kBAAkB;IAG5B,mEAAmE;IACnE,MAAM,EAAEC,QAAQ,EAAE,GAAGV,qBAAqBI,MAAM;QAC9CO,SAASH;IACX;IAEA,MAAMI,WAAWJ,qBAAqBI,QAAQ;IAC9C,MAAMC,UAAUD,UAAUC;IAC1B,MAAMC,OAAO,AAACF,CAAAA,UAAUE,QAAQ,KAAI,EAAGC,WAAW;IAClD,MAAMC,OAAOJ,UAAUI,QAAQJ,UAAUK,OAAO,CAAC,EAAE,IAAI;IAEvD,MAAMtB,sBAAsBS,MAAM;QAChCS;QACAP;QACAY,sBAAsBV;QACtBW,kBAAkBX;QAClBE;QACAU,qBAAqB,GAAGZ,qBAAqBa,IAAI,CAAC,QAAQ,CAAC;QAC3DP;QACAE;IACF;IAEA,MAAMnB,gCAAgCO,MAAM;QAACH;KAA8B;IAE3E,MAAML,qBAAqBQ;IAC3B,OAAO;QACLV,oBAAoBU;IACtB;AACF,EAAE;AAEF,eAAeD,sBAAsB"}
|
|
@@ -1,63 +1,62 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addOpenApiGeneration = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const object_1 = require("../../../utils/object");
|
|
4
|
+
*/ import { generateFiles, joinPathFragments, OverwriteStrategy, updateProjectConfiguration } from "@nx/devkit";
|
|
5
|
+
import { snakeCase } from "../../../utils/names.js";
|
|
6
|
+
import { sortObjectKeys } from "../../../utils/object.js";
|
|
11
7
|
/**
|
|
12
8
|
* Adds FastAPI -> OpenApi spec generation as part of the FastAPI project build
|
|
13
|
-
*/
|
|
14
|
-
const addOpenApiGeneration = (tree, { project }) => {
|
|
9
|
+
*/ export const addOpenApiGeneration = (tree, { project })=>{
|
|
15
10
|
const moduleName = getFastApiModuleName(project);
|
|
16
11
|
// Add OpenAPI spec generation script to FastAPI spec, preserving an existing
|
|
17
12
|
// copy so re-running does not reformat it nondeterministically
|
|
18
|
-
|
|
19
|
-
moduleName
|
|
13
|
+
generateFiles(tree, joinPathFragments(import.meta.dirname, 'files/fast-api'), project.root, {
|
|
14
|
+
moduleName
|
|
20
15
|
}, {
|
|
21
|
-
overwriteStrategy:
|
|
16
|
+
overwriteStrategy: OverwriteStrategy.KeepExisting
|
|
22
17
|
});
|
|
23
18
|
// Instrument the script as part of the fastapi project build
|
|
24
|
-
const fastApiOpenApiDist =
|
|
25
|
-
const specPath =
|
|
26
|
-
|
|
19
|
+
const fastApiOpenApiDist = joinPathFragments('dist', project.root, 'openapi');
|
|
20
|
+
const specPath = joinPathFragments(fastApiOpenApiDist, 'openapi.json');
|
|
21
|
+
updateProjectConfiguration(tree, project.name, {
|
|
27
22
|
...project,
|
|
28
|
-
targets:
|
|
23
|
+
targets: sortObjectKeys({
|
|
29
24
|
...project.targets,
|
|
30
25
|
build: {
|
|
31
26
|
...project.targets?.build,
|
|
32
27
|
dependsOn: [
|
|
33
|
-
...(project.targets?.build?.dependsOn ?? []).filter((t)
|
|
34
|
-
'openapi'
|
|
35
|
-
]
|
|
28
|
+
...(project.targets?.build?.dependsOn ?? []).filter((t)=>t !== 'openapi'),
|
|
29
|
+
'openapi'
|
|
30
|
+
]
|
|
36
31
|
},
|
|
37
32
|
openapi: {
|
|
38
33
|
cache: true,
|
|
39
34
|
executor: 'nx:run-commands',
|
|
40
|
-
outputs: [
|
|
35
|
+
outputs: [
|
|
36
|
+
'{workspaceRoot}/dist/{projectRoot}/openapi'
|
|
37
|
+
],
|
|
41
38
|
options: {
|
|
42
39
|
commands: [
|
|
43
|
-
'uv run python {projectRoot}/scripts/generate_open_api.py "dist/{projectRoot}/openapi/openapi.json"'
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
})
|
|
40
|
+
'uv run python {projectRoot}/scripts/generate_open_api.py "dist/{projectRoot}/openapi/openapi.json"'
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
})
|
|
48
45
|
});
|
|
49
|
-
return {
|
|
46
|
+
return {
|
|
47
|
+
specPath
|
|
48
|
+
};
|
|
50
49
|
};
|
|
51
|
-
|
|
52
|
-
const getFastApiModuleName = (projectConfig) => {
|
|
50
|
+
const getFastApiModuleName = (projectConfig)=>{
|
|
53
51
|
if (projectConfig.sourceRoot) {
|
|
54
52
|
const sourceRootParts = projectConfig.sourceRoot.split('/');
|
|
55
53
|
return sourceRootParts[sourceRootParts.length - 1];
|
|
56
54
|
}
|
|
57
55
|
const apiName = projectConfig.metadata?.apiName;
|
|
58
56
|
if (apiName) {
|
|
59
|
-
return
|
|
57
|
+
return snakeCase(apiName);
|
|
60
58
|
}
|
|
61
59
|
new Error(`Could not determine sourceRoot for project ${projectConfig.name}`);
|
|
62
60
|
};
|
|
61
|
+
|
|
63
62
|
//# sourceMappingURL=open-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/py/fast-api/react/open-api.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type ProjectConfiguration,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { snakeCase } from '../../../utils/names';\nimport { sortObjectKeys } from '../../../utils/object';\n\nexport interface AddOpenApiGenerationOptions {\n project: ProjectConfiguration;\n}\n\n/**\n * Adds FastAPI -> OpenApi spec generation as part of the FastAPI project build\n */\nexport const addOpenApiGeneration = (\n tree: Tree,\n { project }: AddOpenApiGenerationOptions,\n): { specPath: string } => {\n const moduleName = getFastApiModuleName(project);\n\n // Add OpenAPI spec generation script to FastAPI spec, preserving an existing\n // copy so re-running does not reformat it nondeterministically\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files/fast-api'),\n project.root,\n {\n moduleName,\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // Instrument the script as part of the fastapi project build\n const fastApiOpenApiDist = joinPathFragments('dist', project.root, 'openapi');\n const specPath = joinPathFragments(fastApiOpenApiDist, 'openapi.json');\n updateProjectConfiguration(tree, project.name, {\n ...project,\n targets: sortObjectKeys({\n ...project.targets,\n build: {\n ...project.targets?.build,\n dependsOn: [\n ...(project.targets?.build?.dependsOn ?? []).filter(\n (t) => t !== 'openapi',\n ),\n 'openapi',\n ],\n },\n openapi: {\n cache: true,\n executor: 'nx:run-commands',\n outputs: ['{workspaceRoot}/dist/{projectRoot}/openapi'],\n options: {\n commands: [\n 'uv run python {projectRoot}/scripts/generate_open_api.py \"dist/{projectRoot}/openapi/openapi.json\"',\n ],\n },\n },\n }),\n });\n\n return { specPath };\n};\n\nconst getFastApiModuleName = (projectConfig: ProjectConfiguration): string => {\n if (projectConfig.sourceRoot) {\n const sourceRootParts = projectConfig.sourceRoot.split('/');\n return sourceRootParts[sourceRootParts.length - 1];\n }\n const apiName = (projectConfig.metadata as any)?.apiName;\n if (apiName) {\n return snakeCase(apiName);\n }\n new Error(`Could not determine sourceRoot for project ${projectConfig.name}`);\n};\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","snakeCase","sortObjectKeys","addOpenApiGeneration","tree","project","moduleName","getFastApiModuleName","dirname","root","overwriteStrategy","KeepExisting","fastApiOpenApiDist","specPath","name","targets","build","dependsOn","filter","t","openapi","cache","executor","outputs","options","commands","projectConfig","sourceRoot","sourceRootParts","split","length","apiName","metadata","Error"],"mappings":"AAAA;;;CAGC,GACD,SACEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAGjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,SAAS,QAAQ,0BAAuB;AACjD,SAASC,cAAc,QAAQ,2BAAwB;AAMvD;;CAEC,GACD,OAAO,MAAMC,uBAAuB,CAClCC,MACA,EAAEC,OAAO,EAA+B;IAExC,MAAMC,aAAaC,qBAAqBF;IAExC,6EAA6E;IAC7E,+DAA+D;IAC/DR,cACEO,MACAN,kBAAkB,YAAYU,OAAO,EAAE,mBACvCH,QAAQI,IAAI,EACZ;QACEH;IACF,GACA;QACEI,mBAAmBX,kBAAkBY,YAAY;IACnD;IAGF,6DAA6D;IAC7D,MAAMC,qBAAqBd,kBAAkB,QAAQO,QAAQI,IAAI,EAAE;IACnE,MAAMI,WAAWf,kBAAkBc,oBAAoB;IACvDZ,2BAA2BI,MAAMC,QAAQS,IAAI,EAAE;QAC7C,GAAGT,OAAO;QACVU,SAASb,eAAe;YACtB,GAAGG,QAAQU,OAAO;YAClBC,OAAO;gBACL,GAAGX,QAAQU,OAAO,EAAEC,KAAK;gBACzBC,WAAW;uBACN,AAACZ,CAAAA,QAAQU,OAAO,EAAEC,OAAOC,aAAa,EAAE,AAAD,EAAGC,MAAM,CACjD,CAACC,IAAMA,MAAM;oBAEf;iBACD;YACH;YACAC,SAAS;gBACPC,OAAO;gBACPC,UAAU;gBACVC,SAAS;oBAAC;iBAA6C;gBACvDC,SAAS;oBACPC,UAAU;wBACR;qBACD;gBACH;YACF;QACF;IACF;IAEA,OAAO;QAAEZ;IAAS;AACpB,EAAE;AAEF,MAAMN,uBAAuB,CAACmB;IAC5B,IAAIA,cAAcC,UAAU,EAAE;QAC5B,MAAMC,kBAAkBF,cAAcC,UAAU,CAACE,KAAK,CAAC;QACvD,OAAOD,eAAe,CAACA,gBAAgBE,MAAM,GAAG,EAAE;IACpD;IACA,MAAMC,UAAWL,cAAcM,QAAQ,EAAUD;IACjD,IAAIA,SAAS;QACX,OAAO9B,UAAU8B;IACnB;IACA,IAAIE,MAAM,CAAC,2CAA2C,EAAEP,cAAcZ,IAAI,EAAE;AAC9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/py/fast-api/react/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nexport interface FastApiReactGeneratorSchema {\n frontendProjectName: string;\n fastApiProjectName: string;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GACD,WAGC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/fast-api/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 PyFastApiProjectGeneratorSchema {\n readonly name: string;\n readonly infra: 'rest-lambda' | 'http-lambda' | 'none';\n readonly integrationPattern?: 'isolated' | 'shared';\n readonly auth: 'iam' | 'cognito' | 'custom';\n readonly directory?: string;\n readonly subDirectory?: string;\n readonly moduleName?: string;\n readonly iac: IacOption;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAID,WASC"}
|
|
@@ -70,11 +70,11 @@ exports[`lambda-handler project generator > terraform iac > should generate terr
|
|
|
70
70
|
required_providers {
|
|
71
71
|
aws = {
|
|
72
72
|
source = "hashicorp/aws"
|
|
73
|
-
version = "
|
|
73
|
+
version = "6.52.0"
|
|
74
74
|
}
|
|
75
75
|
archive = {
|
|
76
76
|
source = "hashicorp/archive"
|
|
77
|
-
version = "
|
|
77
|
+
version = "2.8.0"
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -251,11 +251,11 @@ exports[`lambda-handler project generator > terraform iac > should match snapsho
|
|
|
251
251
|
required_providers {
|
|
252
252
|
aws = {
|
|
253
253
|
source = "hashicorp/aws"
|
|
254
|
-
version = "
|
|
254
|
+
version = "6.52.0"
|
|
255
255
|
}
|
|
256
256
|
archive = {
|
|
257
257
|
source = "hashicorp/archive"
|
|
258
|
-
version = "
|
|
258
|
+
version = "2.8.0"
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
}
|