@empire-builder-kit/nx 1.0.0-rc.47 → 1.0.0-rc.48
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/README.md +14 -169
- package/executors.json +24 -79
- package/generators.json +8 -18
- package/package.json +13 -71
- package/src/aws/identity.d.ts +1 -1
- package/src/aws-authority/boundary-transforms.d.ts +9 -0
- package/src/aws-authority/boundary-transforms.js +78 -0
- package/src/aws-authority/contracts.d.ts +116 -0
- package/src/aws-authority/contracts.js +40 -0
- package/src/aws-authority/deployment-guardrails.d.ts +4 -0
- package/src/aws-authority/deployment-guardrails.js +543 -0
- package/src/aws-authority/deployment-policy-groups.d.ts +3 -0
- package/src/aws-authority/deployment-policy-groups.js +299 -0
- package/src/aws-authority/deployment-resources.d.ts +64 -0
- package/src/aws-authority/deployment-resources.js +265 -0
- package/src/aws-authority/deployment-services.d.ts +3 -0
- package/src/aws-authority/deployment-services.js +717 -0
- package/src/aws-authority/development-authority.d.ts +11 -0
- package/src/aws-authority/development-authority.js +160 -0
- package/src/aws-authority/guardrail-actions.d.ts +87 -0
- package/src/aws-authority/guardrail-actions.js +463 -0
- package/src/aws-authority/policy-document.d.ts +15 -0
- package/src/aws-authority/policy-document.js +264 -0
- package/src/aws-authority/runtime-boundary.d.ts +7 -0
- package/src/aws-authority/runtime-boundary.js +211 -0
- package/src/aws-authority/service-actions.d.ts +96 -0
- package/src/aws-authority/service-actions.js +512 -0
- package/src/aws-authority/stage-authority.d.ts +6 -272
- package/src/aws-authority/stage-authority.js +109 -3609
- package/src/aws-authority/stage-identity.d.ts +6 -0
- package/src/aws-authority/stage-identity.js +134 -0
- package/src/cli/bootstrap.d.ts +0 -20
- package/src/cli/bootstrap.js +2 -153
- package/src/cli/dev-command.d.ts +2 -4
- package/src/cli/dev-command.js +1 -19
- package/src/cli/main.d.ts +0 -4
- package/src/cli/main.js +22 -80
- package/src/cli/output.d.ts +2 -4
- package/src/cli/output.js +2 -8
- package/src/executors/deployment-plan/deployment-plan.d.ts +0 -2
- package/src/executors/deployment-plan/deployment-plan.js +3 -68
- package/src/executors/dev-doctor/dev-doctor.js +2 -2
- package/src/executors/local-deploy/deployed-smoke.d.ts +12 -0
- package/src/executors/local-deploy/deployed-smoke.js +115 -0
- package/src/executors/local-deploy/deployment-authority.d.ts +24 -0
- package/src/executors/local-deploy/deployment-authority.js +81 -0
- package/src/executors/local-deploy/deployment-child.d.ts +18 -0
- package/src/executors/local-deploy/deployment-child.js +77 -0
- package/src/executors/local-deploy/deployment-contracts.d.ts +96 -0
- package/src/executors/local-deploy/deployment-contracts.js +3 -0
- package/src/executors/local-deploy/deployment-projects.d.ts +4 -0
- package/src/executors/local-deploy/deployment-projects.js +16 -0
- package/src/executors/local-deploy/deployment-receipt.d.ts +4 -0
- package/src/executors/local-deploy/deployment-receipt.js +55 -0
- package/src/executors/local-deploy/deployment-scope.d.ts +17 -0
- package/src/executors/local-deploy/deployment-scope.js +239 -0
- package/src/executors/local-deploy/deployment-source.d.ts +13 -0
- package/src/executors/local-deploy/deployment-source.js +86 -0
- package/src/executors/local-deploy/local-deploy.d.ts +5 -121
- package/src/executors/local-deploy/local-deploy.js +55 -936
- package/src/executors/sst-lifecycle/governed-child-process.d.ts +27 -0
- package/src/executors/sst-lifecycle/governed-child-process.js +277 -0
- package/src/executors/sst-lifecycle/governed-native-operation.js +4 -10
- package/src/executors/sst-lifecycle/run-sst-command.d.ts +4 -85
- package/src/executors/sst-lifecycle/run-sst-command.js +28 -834
- package/src/executors/sst-lifecycle/sst-contracts.d.ts +44 -0
- package/src/executors/sst-lifecycle/sst-contracts.js +3 -0
- package/src/executors/sst-lifecycle/sst-invocation.d.ts +17 -0
- package/src/executors/sst-lifecycle/sst-invocation.js +502 -0
- package/src/executors/sst-lifecycle/task-unlock.js +3 -3
- package/src/foundation/discovery.d.ts +1 -5
- package/src/foundation/discovery.js +0 -2
- package/src/foundation/index.d.ts +0 -2
- package/src/foundation/index.js +0 -9
- package/src/foundation/local-private-smoke-access.d.ts +6 -15
- package/src/foundation/local-private-smoke-access.js +8 -192
- package/src/foundation/observability.d.ts +16 -26
- package/src/foundation/observability.js +34 -135
- package/src/foundation/preflight.js +0 -14
- package/src/foundation/private-smoke-access.d.ts +7 -14
- package/src/foundation/private-smoke-access.js +4 -126
- package/src/foundation/root-site-workspace.d.ts +35 -0
- package/src/foundation/root-site-workspace.js +80 -0
- package/src/foundation/root-site.d.ts +8 -7
- package/src/foundation/root-site.js +17 -9
- package/src/generators/formatting.js +5 -4
- package/src/generators/function/function.d.ts +9 -5
- package/src/generators/function/function.js +106 -136
- package/src/generators/function/schema.json +2 -2
- package/src/generators/function-access/function-access.d.ts +0 -6
- package/src/generators/function-access/function-access.js +41 -109
- package/src/generators/observability-policy.js +1 -2
- package/src/{supply-chain → generators}/pnpm-toolchain-authority.d.ts +3 -3
- package/src/{supply-chain → generators}/pnpm-toolchain-authority.js +12 -12
- package/src/generators/post-generation-install.d.ts +1 -8
- package/src/generators/post-generation-install.js +11 -139
- package/src/generators/preset/dependency-overrides.d.ts +13 -19
- package/src/generators/preset/dependency-overrides.js +12 -56
- package/src/generators/preset/generator.js +0 -3
- package/src/generators/preset/workspace-files-foundation-infra.d.ts +6 -0
- package/src/generators/preset/workspace-files-foundation-infra.js +586 -0
- package/src/generators/preset/workspace-files-foundation-readme.d.ts +5 -0
- package/src/generators/preset/workspace-files-foundation-readme.js +90 -0
- package/src/generators/preset/workspace-files-foundation.d.ts +3 -0
- package/src/generators/preset/workspace-files-foundation.js +170 -0
- package/src/generators/preset/workspace-files-ownership.d.ts +9 -0
- package/src/generators/preset/workspace-files-ownership.js +124 -0
- package/src/generators/preset/workspace-files-root-config.d.ts +32 -0
- package/src/generators/preset/workspace-files-root-config.js +356 -0
- package/src/generators/preset/workspace-files-root-docs.d.ts +5 -0
- package/src/generators/preset/workspace-files-root-docs.js +109 -0
- package/src/generators/preset/workspace-files-shared.d.ts +18 -0
- package/src/generators/preset/workspace-files-shared.js +7 -0
- package/src/generators/preset/workspace-files-workflows.d.ts +39 -0
- package/src/generators/preset/workspace-files-workflows.js +306 -0
- package/src/generators/preset/workspace-files-workspace-health.d.ts +6 -0
- package/src/generators/preset/workspace-files-workspace-health.js +148 -0
- package/src/generators/preset/workspace-files.d.ts +10 -24
- package/src/generators/preset/workspace-files.js +48 -10705
- package/src/generators/site/built-in-site-documentation-files.d.ts +2 -1
- package/src/generators/site/built-in-site-documentation-files.js +15 -56
- package/src/generators/site/built-in-site-files.d.ts +4 -1
- package/src/generators/site/built-in-site-files.js +12 -11
- package/src/generators/site/built-in-site-infrastructure-files.d.ts +2 -1
- package/src/generators/site/built-in-site-infrastructure-files.js +46 -206
- package/src/generators/site/built-in-site-plan.d.ts +5 -1
- package/src/generators/site/built-in-site-plan.js +7 -5
- package/src/generators/site/built-in-site-project-files.d.ts +10 -2
- package/src/generators/site/built-in-site-project-files.js +131 -177
- package/src/generators/site/built-in-site-script-files.d.ts +2 -0
- package/src/generators/site/built-in-site-script-files.js +76 -280
- package/src/generators/site/built-in-site-shared.d.ts +64 -4
- package/src/generators/site/built-in-site-shared.js +307 -14
- package/src/generators/site/built-in-site-sst-config-files.d.ts +2 -1
- package/src/generators/site/built-in-site-sst-config-files.js +90 -22
- package/src/generators/site/built-in-site-web-files.d.ts +2 -1
- package/src/generators/site/built-in-site-web-files.js +19 -225
- package/src/generators/site/schema.d.ts +5 -0
- package/src/generators/site/schema.json +6 -0
- package/src/generators/site/site.d.ts +0 -8
- package/src/generators/site/site.js +17 -85
- package/src/generators/slice/built-in-plan-api-files.d.ts +1 -2
- package/src/generators/slice/built-in-plan-api-files.js +30 -890
- package/src/generators/slice/built-in-plan-database-lifecycle-files.js +57 -1851
- package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +5 -2
- package/src/generators/slice/built-in-plan-infrastructure-files.js +80 -3272
- package/src/generators/slice/built-in-plan-key-value-files.d.ts +3 -2
- package/src/generators/slice/built-in-plan-key-value-files.js +3 -21
- package/src/generators/slice/built-in-plan-project-files.d.ts +5 -3
- package/src/generators/slice/built-in-plan-project-files.js +79 -897
- package/src/generators/slice/built-in-plan-shared.d.ts +3 -18
- package/src/generators/slice/built-in-plan-shared.js +4 -57
- package/src/generators/slice/built-in-plan-web-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-web-files.js +14 -540
- package/src/generators/slice/built-in-plan.d.ts +2 -3
- package/src/generators/slice/built-in-plan.js +79 -277
- package/src/{developer-agent/preview-changes.d.ts → generators/slice/generation-tree.d.ts} +1 -5
- package/src/generators/slice/generation-tree.js +161 -0
- package/src/generators/slice/schema.json +12 -4
- package/src/generators/slice/slice-config.d.ts +7 -0
- package/src/generators/slice/slice-config.js +125 -0
- package/src/generators/slice/slice.js +29 -261
- package/src/generators/slice/sql-bootstrap.d.ts +1 -0
- package/src/generators/slice/sql-bootstrap.js +505 -0
- package/src/generators/slice/sql-client.d.ts +1 -0
- package/src/generators/slice/sql-client.js +107 -0
- package/src/generators/slice/sql-infrastructure.d.ts +1 -0
- package/src/generators/slice/sql-infrastructure.js +225 -0
- package/src/generators/slice/sql-logging.d.ts +1 -0
- package/src/generators/slice/sql-logging.js +266 -0
- package/src/generators/slice/sql-migration.d.ts +2 -0
- package/src/generators/slice/sql-migration.js +202 -0
- package/src/generators/slice/standard-slice-contract.d.ts +25 -0
- package/src/generators/slice/standard-slice-contract.js +64 -0
- package/src/generators/sql/schema.json +1 -1
- package/src/generators/sql/sql.d.ts +1 -1
- package/src/generators/sql/sql.js +13 -7
- package/src/generators/upgrade/framework-package-upgrade.d.ts +4 -27
- package/src/generators/upgrade/framework-package-upgrade.js +16 -39
- package/src/generators/upgrade/framework-packages.d.ts +25 -0
- package/src/generators/upgrade/framework-packages.js +138 -0
- package/src/generators/upgrade/function-authentication-notice.d.ts +10 -18
- package/src/generators/upgrade/function-authentication-notice.js +24 -44
- package/src/generators/upgrade/schema.d.ts +0 -3
- package/src/generators/upgrade/schema.json +6 -16
- package/src/generators/upgrade/slice-compositions.d.ts +20 -0
- package/src/generators/upgrade/slice-compositions.js +100 -0
- package/src/generators/upgrade/slice-upgrade-guidance.d.ts +19 -0
- package/src/generators/upgrade/slice-upgrade-guidance.js +50 -0
- package/src/generators/upgrade/slice-upgrade.d.ts +4 -0
- package/src/generators/upgrade/slice-upgrade.js +231 -0
- package/src/generators/upgrade/upgrade-plan.d.ts +10 -13
- package/src/generators/upgrade/upgrade-plan.js +33 -197
- package/src/generators/upgrade/upgrade-preflight.d.ts +20 -0
- package/src/generators/upgrade/upgrade-preflight.js +64 -0
- package/src/generators/upgrade/upgrade.d.ts +8 -53
- package/src/generators/upgrade/upgrade.js +23 -1571
- package/src/generators/workload/schema.json +2 -2
- package/src/generators/workload/workload.d.ts +11 -11
- package/src/generators/workload/workload.js +166 -1255
- package/src/index.d.ts +0 -5
- package/src/index.js +0 -5
- package/src/local-dev/browser-verification.d.ts +0 -7
- package/src/local-dev/browser-verification.js +0 -136
- package/src/local-dev/contracts.d.ts +6 -0
- package/src/local-dev/contracts.js +17 -9
- package/src/local-dev/environment-checks.d.ts +126 -0
- package/src/local-dev/environment-checks.js +81 -0
- package/src/local-dev/environment-inspector.d.ts +3 -124
- package/src/local-dev/environment-inspector.js +9 -148
- package/src/local-dev/private-state.d.ts +1 -0
- package/src/local-dev/private-state.js +19 -23
- package/src/local-dev/process-identity.js +4 -2
- package/src/local-dev/slice-runner-child.d.ts +37 -0
- package/src/local-dev/slice-runner-child.js +127 -0
- package/src/local-dev/slice-runner-recovery.d.ts +32 -0
- package/src/local-dev/slice-runner-recovery.js +216 -0
- package/src/local-dev/slice-runner-state.d.ts +82 -0
- package/src/local-dev/slice-runner-state.js +265 -0
- package/src/local-dev/slice-runner.d.ts +4 -117
- package/src/local-dev/slice-runner.js +59 -594
- package/src/local-dev/tls.js +8 -97
- package/src/ownership/index.d.ts +1 -0
- package/src/ownership/index.js +6 -0
- package/src/ownership/pnpm-workspace.d.ts +77 -0
- package/src/ownership/pnpm-workspace.js +225 -0
- package/src/ownership/site-record.d.ts +8 -0
- package/src/ownership/site-record.js +17 -2
- package/src/repository-policy/capacity-migration.d.ts +1 -1
- package/src/repository-policy/capacity-migration.js +1 -1
- package/src/repository-policy/foundation-router.d.ts +17 -0
- package/src/repository-policy/foundation-router.js +44 -0
- package/src/repository-policy/index.d.ts +2 -0
- package/src/repository-policy/index.js +2 -0
- package/src/repository-policy/policy-accounts.d.ts +22 -0
- package/src/repository-policy/policy-accounts.js +134 -0
- package/src/repository-policy/policy-files.d.ts +8 -0
- package/src/repository-policy/policy-files.js +201 -0
- package/src/repository-policy/policy-internal.d.ts +2 -0
- package/src/repository-policy/policy-internal.js +11 -0
- package/src/repository-policy/policy-model.d.ts +95 -0
- package/src/repository-policy/policy-model.js +42 -0
- package/src/repository-policy/policy-validation.d.ts +4 -0
- package/src/repository-policy/policy-validation.js +308 -0
- package/src/repository-policy/policy.d.ts +5 -120
- package/src/repository-policy/policy.js +34 -662
- package/src/repository-policy/public-dns.d.ts +4 -0
- package/src/repository-policy/public-dns.js +102 -5
- package/src/{generators/repository-policy → repository-policy}/tree-policy.d.ts +1 -1
- package/src/{generators/repository-policy → repository-policy}/tree-policy.js +5 -5
- package/src/schemas/repository-policy-v1.json +40 -3
- package/src/secrets/index.d.ts +0 -5
- package/src/secrets/index.js +0 -5
- package/src/slice-infra/index.d.ts +57 -0
- package/src/slice-infra/index.js +117 -0
- package/src/slice-scripts/build.d.ts +27 -0
- package/src/slice-scripts/build.js +120 -0
- package/src/slice-scripts/database.d.ts +87 -0
- package/src/slice-scripts/database.js +328 -0
- package/src/slice-scripts/index.d.ts +11 -0
- package/src/slice-scripts/index.js +23 -0
- package/src/slice-scripts/root-site-routes.d.ts +11 -0
- package/src/slice-scripts/root-site-routes.js +83 -0
- package/src/slice-scripts/sql-migration-engine.mjs +180 -0
- package/src/workload-roles/effective-policy.d.ts +0 -37
- package/src/workload-roles/effective-policy.js +1 -174
- package/src/workload-roles/standard-slice.d.ts +2 -19
- package/src/workload-roles/standard-slice.js +3 -129
- package/src/api-contract/baseline-update.d.ts +0 -82
- package/src/api-contract/baseline-update.js +0 -225
- package/src/api-contract/compatibility.d.ts +0 -30
- package/src/api-contract/compatibility.js +0 -643
- package/src/api-contract/contract-graph.d.ts +0 -35
- package/src/api-contract/contract-graph.js +0 -141
- package/src/api-contract/evidence.d.ts +0 -23
- package/src/api-contract/evidence.js +0 -87
- package/src/api-contract/index.d.ts +0 -6
- package/src/api-contract/index.js +0 -10
- package/src/api-contract/model.d.ts +0 -144
- package/src/api-contract/model.js +0 -993
- package/src/api-contract/rollout.d.ts +0 -32
- package/src/api-contract/rollout.js +0 -88
- package/src/authorization/compatibility.d.ts +0 -62
- package/src/authorization/compatibility.js +0 -175
- package/src/authorization/index.d.ts +0 -1
- package/src/authorization/index.js +0 -5
- package/src/blueprints/execution.d.ts +0 -55
- package/src/blueprints/execution.js +0 -329
- package/src/blueprints/external-sandbox.d.ts +0 -53
- package/src/blueprints/external-sandbox.js +0 -1194
- package/src/blueprints/index.d.ts +0 -5
- package/src/blueprints/index.js +0 -9
- package/src/blueprints/inputs.d.ts +0 -43
- package/src/blueprints/inputs.js +0 -103
- package/src/blueprints/manifest.d.ts +0 -281
- package/src/blueprints/manifest.js +0 -424
- package/src/blueprints/resolver.d.ts +0 -37
- package/src/blueprints/resolver.js +0 -387
- package/src/blueprints/transitions.d.ts +0 -20
- package/src/blueprints/transitions.js +0 -61
- package/src/cli/agent-command.d.ts +0 -30
- package/src/cli/agent-command.js +0 -204
- package/src/cli/agent-runtime.d.ts +0 -25
- package/src/cli/agent-runtime.js +0 -498
- package/src/cli/blueprint-authority.d.ts +0 -9
- package/src/cli/blueprint-authority.js +0 -43
- package/src/cli/blueprint-command.d.ts +0 -24
- package/src/cli/blueprint-command.js +0 -63
- package/src/data-lifecycle/index.d.ts +0 -3
- package/src/data-lifecycle/index.js +0 -7
- package/src/data-lifecycle/model.d.ts +0 -172
- package/src/data-lifecycle/model.js +0 -95
- package/src/data-lifecycle/sensitive-artifacts.d.ts +0 -28
- package/src/data-lifecycle/sensitive-artifacts.js +0 -146
- package/src/data-lifecycle/validation.d.ts +0 -32
- package/src/data-lifecycle/validation.js +0 -837
- package/src/database-retirement/contract.d.ts +0 -68
- package/src/database-retirement/contract.js +0 -166
- package/src/database-retirement/index.d.ts +0 -1
- package/src/database-retirement/index.js +0 -5
- package/src/developer-agent/context.d.ts +0 -57
- package/src/developer-agent/context.js +0 -662
- package/src/developer-agent/generator-planning.d.ts +0 -34
- package/src/developer-agent/generator-planning.js +0 -759
- package/src/developer-agent/generator-preview.d.ts +0 -8
- package/src/developer-agent/generator-preview.js +0 -650
- package/src/developer-agent/git-inspection.d.ts +0 -112
- package/src/developer-agent/git-inspection.js +0 -887
- package/src/developer-agent/handoff.d.ts +0 -43
- package/src/developer-agent/handoff.js +0 -713
- package/src/developer-agent/index.d.ts +0 -10
- package/src/developer-agent/index.js +0 -14
- package/src/developer-agent/model.d.ts +0 -497
- package/src/developer-agent/model.js +0 -144
- package/src/developer-agent/operation-registry.d.ts +0 -61
- package/src/developer-agent/operation-registry.js +0 -1591
- package/src/developer-agent/ordering.d.ts +0 -9
- package/src/developer-agent/ordering.js +0 -15
- package/src/developer-agent/planning.d.ts +0 -25
- package/src/developer-agent/planning.js +0 -481
- package/src/developer-agent/preview-changes.js +0 -225
- package/src/developer-agent/preview-source.d.ts +0 -2
- package/src/developer-agent/preview-source.js +0 -19
- package/src/developer-agent/validation.d.ts +0 -30
- package/src/developer-agent/validation.js +0 -2729
- package/src/developer-agent/workspace-inspection.d.ts +0 -20
- package/src/developer-agent/workspace-inspection.js +0 -1236
- package/src/developer-agent/workspace-path.d.ts +0 -6
- package/src/developer-agent/workspace-path.js +0 -22
- package/src/executors/blueprint-trust/blueprint-trust.d.ts +0 -29
- package/src/executors/blueprint-trust/blueprint-trust.js +0 -121
- package/src/executors/blueprint-trust/schema.json +0 -27
- package/src/executors/blueprint-verification/blueprint-verification.d.ts +0 -13
- package/src/executors/blueprint-verification/blueprint-verification.js +0 -110
- package/src/executors/blueprint-verification/schema.json +0 -44
- package/src/executors/developer-context/developer-context.d.ts +0 -38
- package/src/executors/developer-context/developer-context.js +0 -78
- package/src/executors/developer-context/schema.json +0 -87
- package/src/executors/foundation-profile-preflight/foundation-profile-preflight.d.ts +0 -19
- package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js +0 -105
- package/src/executors/foundation-profile-preflight/schema.json +0 -32
- package/src/executors/github-bootstrap/github-bootstrap.d.ts +0 -13
- package/src/executors/github-bootstrap/github-bootstrap.js +0 -62
- package/src/executors/github-bootstrap/schema.json +0 -50
- package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +0 -37
- package/src/executors/infrastructure-plan/infrastructure-plan.js +0 -275
- package/src/executors/infrastructure-plan/schema.json +0 -38
- package/src/executors/router-waf-rehearsal/router-waf-rehearsal.d.ts +0 -42
- package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js +0 -1229
- package/src/executors/router-waf-rehearsal/schema.json +0 -29
- package/src/executors/secret-guardrails/schema.json +0 -6
- package/src/executors/secret-guardrails/secret-guardrails.d.ts +0 -3
- package/src/executors/secret-guardrails/secret-guardrails.js +0 -44
- package/src/executors/secret-initialize/schema.json +0 -42
- package/src/executors/secret-initialize/secret-initialize.d.ts +0 -34
- package/src/executors/secret-initialize/secret-initialize.js +0 -297
- package/src/executors/secret-metadata/schema.json +0 -36
- package/src/executors/secret-metadata/secret-metadata.d.ts +0 -46
- package/src/executors/secret-metadata/secret-metadata.js +0 -230
- package/src/executors/sst-lifecycle/generated-secret-retirement.d.ts +0 -53
- package/src/executors/sst-lifecycle/generated-secret-retirement.js +0 -192
- package/src/executors/sst-lifecycle/logging-preflight.d.ts +0 -22
- package/src/executors/sst-lifecycle/logging-preflight.js +0 -217
- package/src/executors/sst-lifecycle/secret-preflight.d.ts +0 -27
- package/src/executors/sst-lifecycle/secret-preflight.js +0 -125
- package/src/executors/work-markers/schema.json +0 -14
- package/src/executors/work-markers/work-markers.d.ts +0 -6
- package/src/executors/work-markers/work-markers.js +0 -20
- package/src/foundation/cost-estimate.d.ts +0 -175
- package/src/foundation/cost-estimate.js +0 -706
- package/src/foundation/private-smoke-admission.d.ts +0 -45
- package/src/foundation/private-smoke-admission.js +0 -180
- package/src/foundation/private-smoke-control-plane.d.ts +0 -18
- package/src/foundation/private-smoke-control-plane.js +0 -184
- package/src/foundation/root-site-readiness.d.ts +0 -27
- package/src/foundation/root-site-readiness.js +0 -78
- package/src/foundation/router-waf-rate-rehearsal.d.ts +0 -97
- package/src/foundation/router-waf-rate-rehearsal.js +0 -210
- package/src/foundation/router-waf.d.ts +0 -149
- package/src/foundation/router-waf.js +0 -809
- package/src/frontend-security/index.d.ts +0 -1
- package/src/frontend-security/index.js +0 -5
- package/src/frontend-security/security-headers.d.ts +0 -50
- package/src/frontend-security/security-headers.js +0 -418
- package/src/generators/blueprint/blueprint.d.ts +0 -5
- package/src/generators/blueprint/blueprint.js +0 -102
- package/src/generators/blueprint/files.d.ts +0 -6
- package/src/generators/blueprint/files.js +0 -217
- package/src/generators/blueprint/schema.d.ts +0 -4
- package/src/generators/blueprint/schema.json +0 -18
- package/src/generators/feature-registry.d.ts +0 -13
- package/src/generators/feature-registry.js +0 -73
- package/src/generators/function/function-registration.d.ts +0 -24
- package/src/generators/function/function-registration.js +0 -66
- package/src/generators/observability-infrastructure.d.ts +0 -2
- package/src/generators/observability-infrastructure.js +0 -31
- package/src/generators/preset/workspace-files-adopter-skills.d.ts +0 -7
- package/src/generators/preset/workspace-files-adopter-skills.js +0 -359
- package/src/generators/preset/workspace-files-agent-development.d.ts +0 -9
- package/src/generators/preset/workspace-files-agent-development.js +0 -42
- package/src/generators/preset/workspace-files-ci-acceptance.d.ts +0 -1
- package/src/generators/preset/workspace-files-ci-acceptance.js +0 -791
- package/src/generators/preset/workspace-files-ci-install.d.ts +0 -2
- package/src/generators/preset/workspace-files-ci-install.js +0 -196
- package/src/generators/preset/workspace-files-developer-agent.d.ts +0 -16
- package/src/generators/preset/workspace-files-developer-agent.js +0 -644
- package/src/generators/preset/workspace-files-ecr-inspector.d.ts +0 -18
- package/src/generators/preset/workspace-files-ecr-inspector.js +0 -298
- package/src/generators/preset/workspace-files-foundation-workload-roles.d.ts +0 -6
- package/src/generators/preset/workspace-files-foundation-workload-roles.js +0 -409
- package/src/generators/preset/workspace-files-performance-cost.d.ts +0 -66
- package/src/generators/preset/workspace-files-performance-cost.js +0 -866
- package/src/generators/preset/workspace-files-performance-load.d.ts +0 -73
- package/src/generators/preset/workspace-files-performance-load.js +0 -815
- package/src/generators/preset/workspace-files-shared-operation-claims.d.ts +0 -10
- package/src/generators/preset/workspace-files-shared-operation-claims.js +0 -59
- package/src/generators/preset/workspace-files-stage-authority.d.ts +0 -6
- package/src/generators/preset/workspace-files-stage-authority.js +0 -586
- package/src/generators/preset/workspace-files-thin-deploy.d.ts +0 -76
- package/src/generators/preset/workspace-files-thin-deploy.js +0 -2563
- package/src/generators/preset/workspace-files-thin-docs.d.ts +0 -7
- package/src/generators/preset/workspace-files-thin-docs.js +0 -386
- package/src/generators/preset/workspace-files-thin-release.d.ts +0 -14
- package/src/generators/preset/workspace-files-thin-release.js +0 -26
- package/src/generators/preset/workspace-files-workload-role-baseline.d.ts +0 -9
- package/src/generators/preset/workspace-files-workload-role-baseline.js +0 -1314
- package/src/generators/repository-policy/repository-policy.d.ts +0 -4
- package/src/generators/repository-policy/repository-policy.js +0 -294
- package/src/generators/repository-policy/schema.d.ts +0 -30
- package/src/generators/repository-policy/schema.json +0 -127
- package/src/generators/site/built-in-site-smoke-files.d.ts +0 -2
- package/src/generators/site/built-in-site-smoke-files.js +0 -37
- package/src/generators/slice/built-in-plan-alarm-identity.d.ts +0 -182
- package/src/generators/slice/built-in-plan-alarm-identity.js +0 -209
- package/src/generators/slice/built-in-plan-api-contract-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-api-contract-files.js +0 -2848
- package/src/generators/slice/built-in-plan-async-work-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-async-work-files.js +0 -6118
- package/src/generators/slice/built-in-plan-authorization-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-authorization-files.js +0 -2082
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +0 -1301
- package/src/generators/slice/built-in-plan-authorization-storage.d.ts +0 -3
- package/src/generators/slice/built-in-plan-authorization-storage.js +0 -119
- package/src/generators/slice/built-in-plan-background-work-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-background-work-files.js +0 -99
- package/src/generators/slice/built-in-plan-data-deletion-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-deletion-files.js +0 -273
- package/src/generators/slice/built-in-plan-data-export-infrastructure-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js +0 -223
- package/src/generators/slice/built-in-plan-data-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-files.js +0 -618
- package/src/generators/slice/built-in-plan-data-lifecycle-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-lifecycle-files.js +0 -775
- package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +0 -863
- package/src/generators/slice/built-in-plan-data-retention-job-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-retention-job-files.js +0 -169
- package/src/generators/slice/built-in-plan-data-retention-launcher-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +0 -186
- package/src/generators/slice/built-in-plan-data-rights-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-rights-files.js +0 -152
- package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js +0 -508
- package/src/generators/slice/built-in-plan-event-contract-literal.d.ts +0 -6
- package/src/generators/slice/built-in-plan-event-contract-literal.js +0 -52
- package/src/generators/slice/built-in-plan-foundation-files.d.ts +0 -15
- package/src/generators/slice/built-in-plan-foundation-files.js +0 -314
- package/src/generators/slice/built-in-plan-frontend-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-frontend-files.js +0 -1975
- package/src/generators/slice/built-in-plan-frontend-header-proof.d.ts +0 -6
- package/src/generators/slice/built-in-plan-frontend-header-proof.js +0 -282
- package/src/generators/slice/built-in-plan-infrastructure-safety-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-infrastructure-safety-files.js +0 -373
- package/src/generators/slice/built-in-plan-key-value-cleanup.d.ts +0 -4
- package/src/generators/slice/built-in-plan-key-value-cleanup.js +0 -101
- package/src/generators/slice/built-in-plan-key-value-consumer.d.ts +0 -4
- package/src/generators/slice/built-in-plan-key-value-consumer.js +0 -151
- package/src/generators/slice/built-in-plan-key-value-deletion.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-deletion.js +0 -377
- package/src/generators/slice/built-in-plan-key-value-delivery.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-delivery.js +0 -137
- package/src/generators/slice/built-in-plan-key-value-export.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-export.js +0 -595
- package/src/generators/slice/built-in-plan-key-value-holds.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-holds.js +0 -189
- package/src/generators/slice/built-in-plan-key-value-infrastructure.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-infrastructure.js +0 -102
- package/src/generators/slice/built-in-plan-key-value-performance.d.ts +0 -5
- package/src/generators/slice/built-in-plan-key-value-performance.js +0 -530
- package/src/generators/slice/built-in-plan-key-value-provider.d.ts +0 -4
- package/src/generators/slice/built-in-plan-key-value-provider.js +0 -366
- package/src/generators/slice/built-in-plan-key-value-records.d.ts +0 -3
- package/src/generators/slice/built-in-plan-key-value-records.js +0 -232
- package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.js +0 -103
- package/src/generators/slice/built-in-plan-key-value-retention-job-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-retention-job-files.js +0 -160
- package/src/generators/slice/built-in-plan-key-value-retention-maintenance.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-retention-maintenance.js +0 -329
- package/src/generators/slice/built-in-plan-key-value-retention-worker.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-retention-worker.js +0 -477
- package/src/generators/slice/built-in-plan-key-value-retention.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-retention.js +0 -184
- package/src/generators/slice/built-in-plan-log-group-helpers.d.ts +0 -29
- package/src/generators/slice/built-in-plan-log-group-helpers.js +0 -130
- package/src/generators/slice/built-in-plan-metadata-files.d.ts +0 -3
- package/src/generators/slice/built-in-plan-metadata-files.js +0 -401
- package/src/generators/slice/built-in-plan-native-runtime-authority-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-native-runtime-authority-files.js +0 -324
- package/src/generators/slice/built-in-plan-next-build-authority.d.ts +0 -5
- package/src/generators/slice/built-in-plan-next-build-authority.js +0 -124
- package/src/generators/slice/built-in-plan-operations-files.d.ts +0 -8
- package/src/generators/slice/built-in-plan-operations-files.js +0 -1106
- package/src/generators/slice/built-in-plan-performance-files.d.ts +0 -4
- package/src/generators/slice/built-in-plan-performance-files.js +0 -2444
- package/src/generators/slice/built-in-plan-release-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-release-files.js +0 -6585
- package/src/generators/slice/built-in-plan-reliability-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-reliability-files.js +0 -4728
- package/src/generators/slice/built-in-plan-secret-runtime-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-secret-runtime-files.js +0 -1015
- package/src/generators/slice/built-in-plan-sql-events.d.ts +0 -2
- package/src/generators/slice/built-in-plan-sql-events.js +0 -276
- package/src/generators/slice/built-in-plan-testing-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-testing-files.js +0 -2618
- package/src/generators/slice/built-in-plan-testing-persistence-event-files.d.ts +0 -7
- package/src/generators/slice/built-in-plan-testing-persistence-event-files.js +0 -487
- package/src/generators/slice/built-in-plan-testing-persistence-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-testing-persistence-files.js +0 -180
- package/src/generators/slice/built-in-plan-thin-release-files.d.ts +0 -11
- package/src/generators/slice/built-in-plan-thin-release-files.js +0 -162
- package/src/generators/slice/built-in-plan-verification-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-verification-files.js +0 -442
- package/src/generators/slice/built-in-plan-workload-role-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-workload-role-files.js +0 -2220
- package/src/generators/slice/data-policy-review-seed.d.ts +0 -2
- package/src/generators/slice/data-policy-review-seed.js +0 -22
- package/src/generators/slice/deployed-smoke-diagnostics.d.ts +0 -35
- package/src/generators/slice/deployed-smoke-diagnostics.js +0 -189
- package/src/generators/slice/deployed-smoke-readiness.d.ts +0 -9
- package/src/generators/slice/deployed-smoke-readiness.js +0 -309
- package/src/generators/slice/local-source-identity.d.ts +0 -2
- package/src/generators/slice/local-source-identity.js +0 -31
- package/src/generators/slice/pnpm-launch-script.d.ts +0 -13
- package/src/generators/slice/pnpm-launch-script.js +0 -28
- package/src/generators/upgrade/custom-domain-notice.d.ts +0 -19
- package/src/generators/upgrade/custom-domain-notice.js +0 -38
- package/src/generators/upgrade/external-blueprint-compositions.d.ts +0 -84
- package/src/generators/upgrade/external-blueprint-compositions.js +0 -478
- package/src/generators/upgrade/sql-seeded-reconciliation.d.ts +0 -2
- package/src/generators/upgrade/sql-seeded-reconciliation.js +0 -170
- package/src/generators/workload/performance-registration.d.ts +0 -33
- package/src/generators/workload/performance-registration.js +0 -224
- package/src/generators/workload/reliability-registration.d.ts +0 -16
- package/src/generators/workload/reliability-registration.js +0 -150
- package/src/generators/workload/service-performance-files.d.ts +0 -5
- package/src/generators/workload/service-performance-files.js +0 -1883
- package/src/git-policy/action-pins.d.ts +0 -43
- package/src/git-policy/action-pins.js +0 -50
- package/src/git-policy/github-bootstrap.d.ts +0 -95
- package/src/git-policy/github-bootstrap.js +0 -1250
- package/src/git-policy/index.d.ts +0 -3
- package/src/git-policy/index.js +0 -7
- package/src/git-policy/routing.d.ts +0 -21
- package/src/git-policy/routing.js +0 -138
- package/src/infrastructure-change/convergence.d.ts +0 -13
- package/src/infrastructure-change/convergence.js +0 -85
- package/src/infrastructure-change/drift.d.ts +0 -13
- package/src/infrastructure-change/drift.js +0 -112
- package/src/infrastructure-change/index.d.ts +0 -7
- package/src/infrastructure-change/index.js +0 -11
- package/src/infrastructure-change/local-capability.d.ts +0 -73
- package/src/infrastructure-change/local-capability.js +0 -114
- package/src/infrastructure-change/model.d.ts +0 -274
- package/src/infrastructure-change/model.js +0 -29
- package/src/infrastructure-change/normalize.d.ts +0 -16
- package/src/infrastructure-change/normalize.js +0 -285
- package/src/infrastructure-change/plan.d.ts +0 -67
- package/src/infrastructure-change/plan.js +0 -671
- package/src/infrastructure-change/risk.d.ts +0 -9
- package/src/infrastructure-change/risk.js +0 -349
- package/src/infrastructure-change/summary.d.ts +0 -20
- package/src/infrastructure-change/summary.js +0 -130
- package/src/performance/cost-collection.d.ts +0 -225
- package/src/performance/cost-collection.js +0 -827
- package/src/performance/cost-controls.d.ts +0 -135
- package/src/performance/cost-controls.js +0 -347
- package/src/performance/evidence.d.ts +0 -140
- package/src/performance/evidence.js +0 -601
- package/src/performance/index.d.ts +0 -10
- package/src/performance/index.js +0 -14
- package/src/performance/load-safety.d.ts +0 -84
- package/src/performance/load-safety.js +0 -348
- package/src/performance/model.d.ts +0 -129
- package/src/performance/model.js +0 -451
- package/src/performance/pr-artifact-budget.d.ts +0 -42
- package/src/performance/pr-artifact-budget.js +0 -151
- package/src/performance/runner.d.ts +0 -75
- package/src/performance/runner.js +0 -227
- package/src/performance/scenario-endpoint.d.ts +0 -1
- package/src/performance/scenario-endpoint.js +0 -5
- package/src/performance/scenario.d.ts +0 -215
- package/src/performance/scenario.js +0 -744
- package/src/performance/unit-cost.d.ts +0 -105
- package/src/performance/unit-cost.js +0 -364
- package/src/release/index.d.ts +0 -2
- package/src/release/index.js +0 -6
- package/src/release/lifecycle.d.ts +0 -132
- package/src/release/lifecycle.js +0 -411
- package/src/release/manifest.d.ts +0 -148
- package/src/release/manifest.js +0 -503
- package/src/release/rollout.d.ts +0 -170
- package/src/release/rollout.js +0 -578
- package/src/release/source-authority.d.ts +0 -19
- package/src/release/source-authority.js +0 -212
- package/src/schemas/aggregate-count-evidence-v1.json +0 -135
- package/src/schemas/api-contract-baseline-v1.json +0 -674
- package/src/schemas/api-contract-compatibility-report-v1.json +0 -126
- package/src/schemas/aws-billing-actual-evidence-v1.json +0 -407
- package/src/schemas/blueprint-input-schema-v1.json +0 -23
- package/src/schemas/blueprint-v1.json +0 -188
- package/src/schemas/data-lifecycle-policy-v1.json +0 -517
- package/src/schemas/performance-policy-v1.json +0 -335
- package/src/schemas/testing-evidence-quarantine-v1.json +0 -168
- package/src/schemas/testing-evidence-result-v1.json +0 -319
- package/src/secrets/aws-control-plane.d.ts +0 -29
- package/src/secrets/aws-control-plane.js +0 -322
- package/src/secrets/generated-aws-control-plane.d.ts +0 -33
- package/src/secrets/generated-aws-control-plane.js +0 -322
- package/src/secrets/guardrails.d.ts +0 -26
- package/src/secrets/guardrails.js +0 -328
- package/src/secrets/metadata.d.ts +0 -48
- package/src/secrets/metadata.js +0 -199
- package/src/secrets/operator.d.ts +0 -190
- package/src/secrets/operator.js +0 -701
- package/src/secrets/verification.d.ts +0 -18
- package/src/secrets/verification.js +0 -152
- package/src/supply-chain/action-pins.d.ts +0 -26
- package/src/supply-chain/action-pins.js +0 -262
- package/src/supply-chain/blueprint-trust-git.d.ts +0 -130
- package/src/supply-chain/blueprint-trust-git.js +0 -1666
- package/src/supply-chain/blueprint-trust-process.d.ts +0 -4
- package/src/supply-chain/blueprint-trust-process.js +0 -88
- package/src/supply-chain/blueprint-trust.d.ts +0 -354
- package/src/supply-chain/blueprint-trust.js +0 -1558
- package/src/supply-chain/blueprint-verification-authority.d.ts +0 -62
- package/src/supply-chain/blueprint-verification-authority.js +0 -679
- package/src/supply-chain/blueprint-verification-execution.d.ts +0 -68
- package/src/supply-chain/blueprint-verification-execution.js +0 -639
- package/src/supply-chain/build-output-bounds.d.ts +0 -2
- package/src/supply-chain/build-output-bounds.js +0 -12
- package/src/supply-chain/build-output.d.ts +0 -41
- package/src/supply-chain/build-output.js +0 -551
- package/src/supply-chain/common.d.ts +0 -21
- package/src/supply-chain/common.js +0 -107
- package/src/supply-chain/container-artifact-contract.d.ts +0 -23
- package/src/supply-chain/container-artifact-contract.js +0 -208
- package/src/supply-chain/container-release.d.ts +0 -119
- package/src/supply-chain/container-release.js +0 -496
- package/src/supply-chain/ecr-applicability.d.ts +0 -19
- package/src/supply-chain/ecr-applicability.js +0 -103
- package/src/supply-chain/ecr-scanning.d.ts +0 -85
- package/src/supply-chain/ecr-scanning.js +0 -325
- package/src/supply-chain/ecs-deployed-image.d.ts +0 -87
- package/src/supply-chain/ecs-deployed-image.js +0 -302
- package/src/supply-chain/errors.d.ts +0 -6
- package/src/supply-chain/errors.js +0 -15
- package/src/supply-chain/generated-blueprint-trust-command.d.ts +0 -4
- package/src/supply-chain/generated-blueprint-trust-command.js +0 -1394
- package/src/supply-chain/generated-command.d.ts +0 -1
- package/src/supply-chain/generated-command.js +0 -775
- package/src/supply-chain/generated-container-release-command.d.ts +0 -16
- package/src/supply-chain/generated-container-release-command.js +0 -3248
- package/src/supply-chain/generated-ecr-collector-command.d.ts +0 -20
- package/src/supply-chain/generated-ecr-collector-command.js +0 -1445
- package/src/supply-chain/generated-files.d.ts +0 -13
- package/src/supply-chain/generated-files.js +0 -421
- package/src/supply-chain/generated-scanner-command.d.ts +0 -1
- package/src/supply-chain/generated-scanner-command.js +0 -778
- package/src/supply-chain/index.d.ts +0 -28
- package/src/supply-chain/index.js +0 -36
- package/src/supply-chain/inventory.d.ts +0 -96
- package/src/supply-chain/inventory.js +0 -828
- package/src/supply-chain/license-expression.d.ts +0 -7
- package/src/supply-chain/license-expression.js +0 -128
- package/src/supply-chain/policy.d.ts +0 -105
- package/src/supply-chain/policy.js +0 -304
- package/src/supply-chain/publication.d.ts +0 -48
- package/src/supply-chain/publication.js +0 -85
- package/src/supply-chain/sbom.d.ts +0 -228
- package/src/supply-chain/sbom.js +0 -913
- package/src/supply-chain/scanner.d.ts +0 -77
- package/src/supply-chain/scanner.js +0 -514
- package/src/supply-chain/vendored-source.d.ts +0 -95
- package/src/supply-chain/vendored-source.js +0 -315
- package/src/testing-evidence/fixture-scope.d.ts +0 -53
- package/src/testing-evidence/fixture-scope.js +0 -142
- package/src/testing-evidence/index.d.ts +0 -5
- package/src/testing-evidence/index.js +0 -9
- package/src/testing-evidence/quarantine.d.ts +0 -48
- package/src/testing-evidence/quarantine.js +0 -253
- package/src/testing-evidence/result.d.ts +0 -109
- package/src/testing-evidence/result.js +0 -585
- package/src/testing-evidence/runner-adapter.d.ts +0 -51
- package/src/testing-evidence/runner-adapter.js +0 -288
- package/src/testing-evidence/sensitive-artifacts.d.ts +0 -13
- package/src/testing-evidence/sensitive-artifacts.js +0 -93
- package/src/work-markers/index.d.ts +0 -1
- package/src/work-markers/index.js +0 -5
- package/src/work-markers/work-markers.d.ts +0 -39
- package/src/work-markers/work-markers.js +0 -363
- package/src/workload-roles/account-baseline.d.ts +0 -143
- package/src/workload-roles/account-baseline.js +0 -980
- package/src/workload-roles/authority.d.ts +0 -40
- package/src/workload-roles/authority.js +0 -202
- package/src/workload-roles/aws-adapter.d.ts +0 -99
- package/src/workload-roles/aws-adapter.js +0 -416
- package/src/workload-roles/aws-internal-handler.d.ts +0 -27
- package/src/workload-roles/aws-internal-handler.js +0 -58
- package/src/workload-roles/aws-s3-state.d.ts +0 -52
- package/src/workload-roles/aws-s3-state.js +0 -191
- package/src/workload-roles/aws-sdk-control-plane.d.ts +0 -12
- package/src/workload-roles/aws-sdk-control-plane.js +0 -291
- package/src/workload-roles/boundary.d.ts +0 -34
- package/src/workload-roles/boundary.js +0 -137
- package/src/workload-roles/convergence.d.ts +0 -66
- package/src/workload-roles/convergence.js +0 -186
- package/src/workload-roles/handler.d.ts +0 -43
- package/src/workload-roles/handler.js +0 -158
- package/src/workload-roles/history.d.ts +0 -47
- package/src/workload-roles/history.js +0 -324
- package/src/workload-roles/injection.d.ts +0 -119
- package/src/workload-roles/injection.js +0 -495
- package/src/workload-roles/manifest.d.ts +0 -54
- package/src/workload-roles/manifest.js +0 -343
- package/src/workload-roles/provisioner.d.ts +0 -70
- package/src/workload-roles/provisioner.js +0 -239
- package/src/workload-roles/registration.d.ts +0 -102
- package/src/workload-roles/registration.js +0 -462
- package/src/workload-roles/stage-boundary.d.ts +0 -31
- package/src/workload-roles/stage-boundary.js +0 -208
- /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.d.ts +0 -0
- /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.js +0 -0
|
@@ -1,3315 +1,123 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderProductInfrastructureFiles = renderProductInfrastructureFiles;
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const logHelpers = (0, built_in_plan_log_group_helpers_js_1.renderManagedLogHelpers)({
|
|
14
|
-
dataProtectionAlarm: (0, built_in_plan_alarm_identity_js_1.sliceAlarmIdentity)(name, 'data-protection-findings'),
|
|
15
|
-
name,
|
|
16
|
-
workspace,
|
|
17
|
-
});
|
|
18
|
-
const files = {
|
|
19
|
-
'infra/event-subscriptions.ts': `/**
|
|
20
|
-
* Same-Slice routing reads only the Slice's own seeded EventContractSchema and
|
|
21
|
-
* never broadens its source or stage filter. Foreign Slices are routed only
|
|
22
|
-
* through the seeded contracts/event-subscriptions.json declaration below.
|
|
23
|
-
*/
|
|
24
|
-
export function sameSliceEventDetailTypes(value: unknown): string[] {
|
|
25
|
-
const contract = value as {
|
|
26
|
-
kind?: unknown;
|
|
27
|
-
schemaVersion?: unknown;
|
|
28
|
-
slice?: unknown;
|
|
29
|
-
events?: unknown;
|
|
30
|
-
} | null;
|
|
31
|
-
if (
|
|
32
|
-
!contract || contract.kind !== 'ebk-event-contract-schema' ||
|
|
33
|
-
contract.schemaVersion !== 1 || contract.slice !== '${name}' ||
|
|
34
|
-
!Array.isArray(contract.events) || contract.events.length < 2 ||
|
|
35
|
-
contract.events.length > 32
|
|
36
|
-
) throw new Error('Event subscriptions require the bounded seeded ${name} EventContractSchema.');
|
|
37
|
-
const types = new Set<string>();
|
|
38
|
-
for (const raw of contract.events) {
|
|
39
|
-
const event = raw as {
|
|
40
|
-
detailType?: unknown;
|
|
41
|
-
source?: unknown;
|
|
42
|
-
schemaVersion?: unknown;
|
|
43
|
-
data?: unknown;
|
|
44
|
-
} | null;
|
|
45
|
-
if (
|
|
46
|
-
!event || typeof event.detailType !== 'string' ||
|
|
47
|
-
!/^[A-Za-z][A-Za-z0-9._-]{0,127}$/.test(event.detailType) ||
|
|
48
|
-
event.source !== '${name}' || typeof event.schemaVersion !== 'number' ||
|
|
49
|
-
!Number.isSafeInteger(event.schemaVersion) || event.schemaVersion < 1 ||
|
|
50
|
-
!event.data || typeof event.data !== 'object' || Array.isArray(event.data) ||
|
|
51
|
-
types.has(event.detailType)
|
|
52
|
-
) throw new Error('Event subscriptions require unique literal types, exact Slice sources and valid schemas.');
|
|
53
|
-
types.add(event.detailType);
|
|
54
|
-
}
|
|
55
|
-
if (!types.has('${pascalName}Created') || !types.has('DataLifecycleChanged'))
|
|
56
|
-
throw new Error('The generated event contract must retain its built-in event declarations.');
|
|
57
|
-
// Lifecycle consumers have their own exact source declaration and rule.
|
|
58
|
-
types.delete('DataLifecycleChanged');
|
|
59
|
-
return [...types].sort();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/** One exact queue rule for each foreign Slice that the seeded declaration names. */
|
|
63
|
-
export interface CrossSliceEventSubscription {
|
|
64
|
-
readonly detailTypes: readonly string[];
|
|
65
|
-
readonly ruleName: string;
|
|
66
|
-
readonly schemaVersions: readonly number[];
|
|
67
|
-
readonly source: string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function exactKeys(
|
|
71
|
-
value: unknown,
|
|
72
|
-
keys: readonly string[],
|
|
73
|
-
): value is Record<string, unknown> {
|
|
74
|
-
return !!value && typeof value === 'object' && !Array.isArray(value) &&
|
|
75
|
-
Object.keys(value).length === keys.length &&
|
|
76
|
-
keys.every((key) => Object.hasOwn(value, key));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function subscriptionError(detail: string): Error {
|
|
80
|
-
return new Error('contracts/event-subscriptions.json ' + detail);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Validate the seeded cross-Slice declaration before any rule registers.
|
|
85
|
-
* Source and detail type are delivery filters, not authentication: the
|
|
86
|
-
* consumer authorizes every effect from its own data and policy.
|
|
87
|
-
*/
|
|
88
|
-
export function crossSliceEventSubscriptions(
|
|
89
|
-
declaration: unknown,
|
|
90
|
-
dependencies: unknown,
|
|
91
|
-
): CrossSliceEventSubscription[] {
|
|
92
|
-
if (
|
|
93
|
-
!exactKeys(declaration, ['schemaVersion', 'subscriptions']) ||
|
|
94
|
-
declaration.schemaVersion !== 1 ||
|
|
95
|
-
!Array.isArray(declaration.subscriptions) ||
|
|
96
|
-
declaration.subscriptions.length > 8
|
|
97
|
-
) throw subscriptionError('must be a v1 declaration with at most 8 source subscriptions.');
|
|
98
|
-
if (
|
|
99
|
-
!exactKeys(dependencies, ['consumes', 'schemaVersion']) ||
|
|
100
|
-
dependencies.schemaVersion !== 1 ||
|
|
101
|
-
!Array.isArray(dependencies.consumes)
|
|
102
|
-
) throw subscriptionError('requires the v1 contracts/dependencies.json declaration.');
|
|
103
|
-
const consumes = new Set<unknown>(dependencies.consumes);
|
|
104
|
-
const sources = new Set<string>();
|
|
105
|
-
const ruleNames = new Set<string>();
|
|
106
|
-
const subscriptions: CrossSliceEventSubscription[] = [];
|
|
107
|
-
for (const raw of declaration.subscriptions as unknown[]) {
|
|
108
|
-
if (
|
|
109
|
-
!exactKeys(raw, ['events', 'source']) || typeof raw.source !== 'string' ||
|
|
110
|
-
raw.source.length > 63 || !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(raw.source) ||
|
|
111
|
-
raw.source === '${name}' || sources.has(raw.source)
|
|
112
|
-
) throw subscriptionError('requires unique foreign Slice sources other than ${name}.');
|
|
113
|
-
const source = raw.source;
|
|
114
|
-
sources.add(source);
|
|
115
|
-
const contracts = '@${workspace}/' + source + '/contracts';
|
|
116
|
-
if (!consumes.has(contracts))
|
|
117
|
-
throw subscriptionError('source ' + source + ' requires ' + contracts + ' in contracts/dependencies.json consumes.');
|
|
118
|
-
if (!Array.isArray(raw.events) || raw.events.length < 1 || raw.events.length > 32)
|
|
119
|
-
throw subscriptionError('source ' + source + ' must declare 1 to 32 events.');
|
|
120
|
-
const detailTypes = new Set<string>();
|
|
121
|
-
let schemaVersions: number[] | undefined;
|
|
122
|
-
for (const event of raw.events as unknown[]) {
|
|
123
|
-
if (
|
|
124
|
-
!exactKeys(event, ['detailType', 'schemaVersions']) ||
|
|
125
|
-
typeof event.detailType !== 'string' ||
|
|
126
|
-
!/^[A-Za-z][A-Za-z0-9._-]{0,127}$/.test(event.detailType) ||
|
|
127
|
-
event.detailType === 'DataLifecycleChanged' || detailTypes.has(event.detailType)
|
|
128
|
-
) throw subscriptionError('source ' + source + ' requires unique literal detail types other than DataLifecycleChanged.');
|
|
129
|
-
const declared: unknown = event.schemaVersions;
|
|
130
|
-
if (
|
|
131
|
-
!Array.isArray(declared) || declared.length < 1 || declared.length > 8 ||
|
|
132
|
-
declared.some((version) => typeof version !== 'number' ||
|
|
133
|
-
!Number.isSafeInteger(version) || version < 1) ||
|
|
134
|
-
new Set(declared).size !== declared.length
|
|
135
|
-
) throw subscriptionError('source ' + source + ' requires 1 to 8 unique schemaVersions of at least 1.');
|
|
136
|
-
const versions = (declared as number[]).slice().sort((left, right) => left - right);
|
|
137
|
-
// One rule filters detail type and schema version independently, so
|
|
138
|
-
// every event of one source shares one version set to stay exact.
|
|
139
|
-
if (schemaVersions && schemaVersions.join(',') !== versions.join(','))
|
|
140
|
-
throw subscriptionError('source ' + source + ' must declare the same schemaVersions for every event.');
|
|
141
|
-
schemaVersions = versions;
|
|
142
|
-
detailTypes.add(event.detailType);
|
|
143
|
-
}
|
|
144
|
-
const ruleName = '${pascalName}' + source.split('-').map((part) =>
|
|
145
|
-
part.charAt(0).toUpperCase() + part.slice(1)).join('') + 'SubscribedEventsRule';
|
|
146
|
-
if (!schemaVersions || ruleNames.has(ruleName))
|
|
147
|
-
throw subscriptionError('sources must derive unique rule identities.');
|
|
148
|
-
ruleNames.add(ruleName);
|
|
149
|
-
subscriptions.push({
|
|
150
|
-
detailTypes: [...detailTypes].sort(),
|
|
151
|
-
ruleName,
|
|
152
|
-
schemaVersions,
|
|
153
|
-
source,
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
return subscriptions.sort((left, right) =>
|
|
157
|
-
left.source < right.source ? -1 : left.source > right.source ? 1 : 0);
|
|
158
|
-
}
|
|
159
|
-
`,
|
|
160
|
-
'infra/route-function-materialization.ts': `type RouteFunctionArgs = {
|
|
161
|
-
ebkRouteMaterialization?: unknown;
|
|
162
|
-
handler: string;
|
|
163
|
-
environment?: unknown;
|
|
164
|
-
link?: unknown;
|
|
165
|
-
permissions?: unknown;
|
|
166
|
-
} & Record<string, any>;
|
|
167
|
-
|
|
168
|
-
type OutputFactory = (value: any) => {
|
|
169
|
-
apply(callback: (value: any) => any): unknown;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
type RouteRegistrar<Result> = (
|
|
173
|
-
rawRoute: string,
|
|
174
|
-
handler: string,
|
|
175
|
-
args?: Record<string, any>,
|
|
176
|
-
) => Result;
|
|
177
|
-
|
|
178
|
-
export function createVpcRouteFunctionMaterializer(input: {
|
|
179
|
-
directHandlers: readonly string[];
|
|
180
|
-
foundationVpc?: unknown;
|
|
181
|
-
output: OutputFactory;
|
|
182
|
-
}) {
|
|
183
|
-
const directHandlerLimit = 2;
|
|
184
|
-
const compositionDirectHandlerLimit = 64;
|
|
185
|
-
const routeFunctionLimit = 23;
|
|
186
|
-
if (
|
|
187
|
-
!Array.isArray(input.directHandlers) ||
|
|
188
|
-
input.directHandlers.length !== directHandlerLimit ||
|
|
189
|
-
input.directHandlers.some(
|
|
190
|
-
(handler) =>
|
|
191
|
-
typeof handler !== 'string' ||
|
|
192
|
-
handler.length === 0 ||
|
|
193
|
-
handler.length > 256,
|
|
194
|
-
) ||
|
|
195
|
-
new Set(input.directHandlers).size !== input.directHandlers.length
|
|
196
|
-
) {
|
|
197
|
-
throw new Error(
|
|
198
|
-
'Direct API routes require the exact bounded unique handler inventory.',
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
const directHandlers = new Set(input.directHandlers);
|
|
202
|
-
const compositionDirectHandlers = new Set<string>();
|
|
203
|
-
const routeFunctions = new Map<string, RouteFunctionArgs>();
|
|
204
|
-
const materializedRouteFunctions = new Set<string>();
|
|
205
|
-
|
|
206
|
-
const transform = (args: any): void => {
|
|
207
|
-
if (
|
|
208
|
-
typeof args !== 'object' ||
|
|
209
|
-
args === null ||
|
|
210
|
-
Array.isArray(args) ||
|
|
211
|
-
typeof args.handler !== 'string' ||
|
|
212
|
-
args.handler.length === 0
|
|
213
|
-
) {
|
|
214
|
-
throw new Error(
|
|
215
|
-
'API route handler transforms require one literal handler path.',
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
const routeFunction = routeFunctions.get(args.handler);
|
|
219
|
-
if (!routeFunction) {
|
|
220
|
-
if (directHandlers.has(args.handler)) {
|
|
221
|
-
if (args.ebkRouteMaterialization !== undefined) {
|
|
222
|
-
throw new Error(
|
|
223
|
-
'Built-in direct API route materialization authority is ambiguous.',
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
if (
|
|
229
|
-
args.ebkRouteMaterialization === 'direct' &&
|
|
230
|
-
!compositionDirectHandlers.has(args.handler) &&
|
|
231
|
-
compositionDirectHandlers.size < compositionDirectHandlerLimit
|
|
232
|
-
) {
|
|
233
|
-
delete args.ebkRouteMaterialization;
|
|
234
|
-
compositionDirectHandlers.add(args.handler);
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
throw new Error(
|
|
238
|
-
'API route handler lacks registered materialization authority.',
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
if (
|
|
242
|
-
args.ebkRouteMaterialization !== undefined ||
|
|
243
|
-
routeFunction.handler !== args.handler ||
|
|
244
|
-
materializedRouteFunctions.has(args.handler)
|
|
245
|
-
) {
|
|
246
|
-
throw new Error(
|
|
247
|
-
'VPC API route handler materialization authority is ambiguous.',
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// SST 4.17.1 resolves the complete FunctionArgs definition before it
|
|
252
|
-
// calls this transform. Passing imported Foundation Outputs as that
|
|
253
|
-
// definition can therefore defer the route component itself during
|
|
254
|
-
// refresh. Keep the definition literal until here, then reproduce
|
|
255
|
-
// functionBuilder's route-over-default merge exactly.
|
|
256
|
-
const defaultEnvironment = args.environment;
|
|
257
|
-
const defaultLink = args.link;
|
|
258
|
-
const defaultPermissions = args.permissions;
|
|
259
|
-
Object.assign(args, routeFunction);
|
|
260
|
-
args.environment = input
|
|
261
|
-
.output([defaultEnvironment, routeFunction.environment])
|
|
262
|
-
.apply(([defaults, route]: [any, any]) => ({
|
|
263
|
-
...(defaults ?? {}),
|
|
264
|
-
...(route ?? {}),
|
|
265
|
-
}));
|
|
266
|
-
args.link = input
|
|
267
|
-
.output([defaultLink, routeFunction.link])
|
|
268
|
-
.apply(([defaults, route]: [any, any]) => [
|
|
269
|
-
...(defaults ?? []),
|
|
270
|
-
...(route ?? []),
|
|
271
|
-
]);
|
|
272
|
-
args.permissions = input
|
|
273
|
-
.output([defaultPermissions, routeFunction.permissions])
|
|
274
|
-
.apply(([defaults, route]: [any, any]) => [
|
|
275
|
-
...(defaults ?? []),
|
|
276
|
-
...(route ?? []),
|
|
277
|
-
]);
|
|
278
|
-
materializedRouteFunctions.add(args.handler);
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
const route = <Result>(
|
|
282
|
-
rawRoute: string,
|
|
283
|
-
handler: RouteFunctionArgs,
|
|
284
|
-
args: Record<string, any> | undefined,
|
|
285
|
-
register: RouteRegistrar<Result>,
|
|
286
|
-
): Result => {
|
|
287
|
-
const handlerPath = handler.handler;
|
|
288
|
-
if (
|
|
289
|
-
typeof rawRoute !== 'string' ||
|
|
290
|
-
rawRoute.length === 0 ||
|
|
291
|
-
rawRoute.length > 512 ||
|
|
292
|
-
typeof handlerPath !== 'string' ||
|
|
293
|
-
handlerPath.length === 0 ||
|
|
294
|
-
handlerPath.length > 256 ||
|
|
295
|
-
typeof register !== 'function' ||
|
|
296
|
-
directHandlers.has(handlerPath) ||
|
|
297
|
-
routeFunctions.has(handlerPath) ||
|
|
298
|
-
routeFunctions.size >= routeFunctionLimit
|
|
299
|
-
) {
|
|
300
|
-
throw new Error(
|
|
301
|
-
'VPC API routes require one bounded unique literal handler registration.',
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
routeFunctions.set(handlerPath, {
|
|
305
|
-
...handler,
|
|
306
|
-
handler: handlerPath,
|
|
307
|
-
...(input.foundationVpc === undefined ? {} : { vpc: input.foundationVpc }),
|
|
308
|
-
});
|
|
309
|
-
try {
|
|
310
|
-
return register(rawRoute, handlerPath, args);
|
|
311
|
-
} catch (error) {
|
|
312
|
-
routeFunctions.delete(handlerPath);
|
|
313
|
-
throw error;
|
|
314
|
-
}
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
return Object.freeze({ route, transform });
|
|
318
|
-
}
|
|
319
|
-
`,
|
|
320
|
-
'infra/next-build-authority.ts': (0, built_in_plan_next_build_authority_js_1.renderNextBuildAuthority)(),
|
|
321
|
-
'infra/deployment-receipt.ts': `export interface SuccessfulDeploymentReceiptExpectation {
|
|
322
|
-
account: string;
|
|
323
|
-
project: string;
|
|
324
|
-
region: string;
|
|
325
|
-
sourceCommit: string;
|
|
326
|
-
stage: 'development' | 'staging' | 'production';
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
export function validateSuccessfulDeploymentReceipt(
|
|
330
|
-
value: unknown,
|
|
331
|
-
expected: SuccessfulDeploymentReceiptExpectation,
|
|
332
|
-
) {
|
|
333
|
-
const receipt = value as {
|
|
334
|
-
account?: unknown;
|
|
335
|
-
authority?: unknown;
|
|
336
|
-
children?: Array<{
|
|
337
|
-
outcome?: unknown;
|
|
338
|
-
project?: unknown;
|
|
339
|
-
target?: unknown;
|
|
340
|
-
}>;
|
|
341
|
-
kind?: unknown;
|
|
342
|
-
migrations?: Record<string, unknown>;
|
|
343
|
-
outcome?: unknown;
|
|
344
|
-
profile?: unknown;
|
|
345
|
-
region?: unknown;
|
|
346
|
-
schemaVersion?: unknown;
|
|
347
|
-
smoke?: Record<string, unknown>;
|
|
348
|
-
source?: { clean?: unknown; commit?: unknown };
|
|
349
|
-
stage?: unknown;
|
|
350
|
-
};
|
|
351
|
-
const deploymentChildren = Array.isArray(receipt?.children)
|
|
352
|
-
? receipt.children.filter(
|
|
353
|
-
({ outcome, project, target }) =>
|
|
354
|
-
outcome === 'succeeded' &&
|
|
355
|
-
project === expected.project &&
|
|
356
|
-
target === 'deploy',
|
|
357
|
-
)
|
|
358
|
-
: [];
|
|
359
|
-
if (
|
|
360
|
-
receipt?.kind !== 'ebk-deployment-receipt' ||
|
|
361
|
-
receipt.schemaVersion !== 1 ||
|
|
362
|
-
receipt.outcome !== 'succeeded' ||
|
|
363
|
-
!['local', 'github'].includes(String(receipt.authority)) ||
|
|
364
|
-
!['starter', 'production-isolated', 'fully-isolated'].includes(
|
|
365
|
-
String(receipt.profile),
|
|
366
|
-
) ||
|
|
367
|
-
receipt.account !== expected.account ||
|
|
368
|
-
receipt.region !== expected.region ||
|
|
369
|
-
receipt.stage !== expected.stage ||
|
|
370
|
-
receipt.source?.clean !== true ||
|
|
371
|
-
receipt.source.commit !== expected.sourceCommit ||
|
|
372
|
-
!Array.isArray(receipt.children) ||
|
|
373
|
-
receipt.children.some(({ outcome }) => outcome !== 'succeeded') ||
|
|
374
|
-
deploymentChildren.length !== 1 ||
|
|
375
|
-
receipt.migrations?.[expected.project] !== 'completed-by-deploy-target' ||
|
|
376
|
-
receipt.smoke?.[expected.project] !== 'passed'
|
|
377
|
-
) {
|
|
378
|
-
throw new Error(
|
|
379
|
-
'Protected performance load requires one successful exact-source native deployment receipt.',
|
|
380
|
-
);
|
|
381
|
-
}
|
|
382
|
-
return Object.freeze(receipt);
|
|
383
|
-
}
|
|
384
|
-
`,
|
|
385
|
-
'infra/product.ts': `import {
|
|
386
|
-
createManagedLogGroupContract,
|
|
387
|
-
createRouterOriginProofInjection,
|
|
388
|
-
resolveObservabilityPolicy,
|
|
389
|
-
${sql ? ' provisionDatabaseBindings,\n' : ''}\
|
|
390
|
-
${sql ? ' validateDatabaseBindings,\n' : ''}\
|
|
391
|
-
} from '@empire-builder-kit/nx/foundation';
|
|
392
|
-
import * as random from '@pulumi/random';
|
|
393
|
-
import { createHash } from 'node:crypto';
|
|
394
|
-
import { readFileSync } from 'node:fs';
|
|
395
|
-
import {
|
|
396
|
-
${identifierPrefix}CleanupRecordExport,
|
|
397
|
-
${identifierPrefix}DatabaseHealth,
|
|
398
|
-
${identifierPrefix}DecideRecordExport,
|
|
399
|
-
${identifierPrefix}DecideRecordDeletion,
|
|
400
|
-
${identifierPrefix}DeliverRecordExport,
|
|
401
|
-
${identifierPrefix}DeleteRecord,
|
|
402
|
-
${identifierPrefix}ExecuteRecordExport,
|
|
403
|
-
${identifierPrefix}ExpireRecordHold,
|
|
404
|
-
${identifierPrefix}GetRecord,
|
|
405
|
-
${identifierPrefix}Health,
|
|
406
|
-
${identifierPrefix}IssueRecordDelegation,
|
|
407
|
-
${identifierPrefix}IssueRecordHold,
|
|
408
|
-
${identifierPrefix}MachineAuthorizationProof,
|
|
409
|
-
${identifierPrefix}ProtectedExample,
|
|
410
|
-
${identifierPrefix}PublishCreated,
|
|
411
|
-
${identifierPrefix}PutRecord,
|
|
412
|
-
${identifierPrefix}DecideRetentionApproval,
|
|
413
|
-
${identifierPrefix}ReleaseRecordHold,
|
|
414
|
-
${identifierPrefix}RequestRecordExport,
|
|
415
|
-
${identifierPrefix}RequestRecordDeletion,
|
|
416
|
-
${identifierPrefix}RequestRetentionApproval,
|
|
417
|
-
${identifierPrefix}ReviewRecordHold,
|
|
418
|
-
${identifierPrefix}RevokeRecordDelegation,
|
|
419
|
-
${identifierPrefix}UseRecordDelegation,
|
|
420
|
-
} from '../api/contracts/protected.js';
|
|
421
|
-
import lifecycleConsumers from '../data/lifecycle-consumers.json';
|
|
422
|
-
import observabilityPolicy from '../../../ebk.observability.json';
|
|
423
|
-
import contractDependencies from '../contracts/dependencies.json';
|
|
424
|
-
import eventSubscriptions from '../contracts/event-subscriptions.json';
|
|
425
|
-
import { EventContractSchema } from '../contracts/events.js';
|
|
426
|
-
import {
|
|
427
|
-
crossSliceEventSubscriptions,
|
|
428
|
-
sameSliceEventDetailTypes,
|
|
429
|
-
} from './event-subscriptions.js';
|
|
430
|
-
${sql ? "import databaseBindings from '../database/bindings.json';\n" : ''}\
|
|
431
|
-
${sql ? "import { createSqlOutboxInfrastructure } from './sql-outbox.js';\n" : ''}\
|
|
432
|
-
${"import { createKeyValueInfrastructure } from './key-value.js';\n"}\
|
|
433
|
-
${"import { createKeyValueRetentionInfrastructure } from './key-value-retention.js';\n"}\
|
|
434
|
-
import localConfiguration from '../configuration/local-values.json';
|
|
435
|
-
import backgroundWorkPolicy from '../operations/background-work.json';
|
|
436
|
-
import { backgroundWorkSchedules } from './background-work.js';
|
|
437
|
-
import { ConfigurationDeclarations } from '../configuration/declarations.js';
|
|
438
|
-
import { assertAsyncAdapterDeploymentReady } from '../async/recovery-adapters.js';
|
|
439
|
-
import {
|
|
440
|
-
foundationSliceWebUrl,
|
|
441
|
-
getFoundationInfrastructure,
|
|
442
|
-
${sql ? ' registerProductMigration,\n' : ''}\
|
|
443
|
-
registerProductRetention,
|
|
444
|
-
type SlicePublicDomain,
|
|
445
|
-
} from './foundation.js';
|
|
446
|
-
import { createVpcRouteFunctionMaterializer } from './route-function-materialization.js';
|
|
447
|
-
import { removeFinderMetadataFromBuiltFunction } from './next-build-authority.js';
|
|
448
|
-
import {
|
|
449
|
-
createStandardSliceNativeRuntimeAuthority,
|
|
450
|
-
} from './native-runtime-authority/index.js';
|
|
451
|
-
${sql
|
|
452
|
-
? `import {
|
|
453
|
-
standardSliceDatabaseTaskFamily,
|
|
454
|
-
} from './native-runtime-authority/effective-intent.js';
|
|
455
|
-
`
|
|
456
|
-
: ''}\
|
|
457
|
-
import { createStandardSliceSecretLinks } from './personal-secrets.js';
|
|
458
|
-
import { create${pascalName}PerformanceCostControls } from './performance-cost-controls.js';
|
|
459
|
-
import {
|
|
460
|
-
createStandardSliceMachineAuthorization,
|
|
461
|
-
standardSliceMachineClientProvisionerPermissions,
|
|
462
|
-
type MachineCredentialGeneration,
|
|
463
|
-
} from './authorization.js';
|
|
464
|
-
import { createStandardDataExportStore } from './data-export.js';
|
|
465
|
-
import { create${pascalName}Reliability } from './reliability.js';
|
|
466
|
-
${sql ? "import { resolveStandardContainerImage } from './container-images.js';\n" : ''}\
|
|
467
|
-
import {
|
|
468
|
-
defineEventConsumerAlarms,
|
|
469
|
-
} from '@empire-builder-kit/runtime/observability';
|
|
470
|
-
import { validateSuccessfulDeploymentReceipt } from './deployment-receipt.js';
|
|
471
|
-
// <ebk:composition-imports:start>
|
|
4
|
+
function renderProductInfrastructureFiles(name, pascal, capabilities) {
|
|
5
|
+
const buildCommand = JSON.stringify(`node -e "process.exitCode=require('@empire-builder-kit/nx/slice-scripts').buildSliceWeb()"`);
|
|
6
|
+
const devCommand = JSON.stringify(`node -e "require('@empire-builder-kit/nx/slice-scripts').runNativeWebCommand('${name}').then(code=>process.exitCode=code)"`);
|
|
7
|
+
const sql = capabilities.includes('postgres');
|
|
8
|
+
return {
|
|
9
|
+
'infra/index.ts': `export { product as app } from './product.js';\n`,
|
|
10
|
+
'infra/product.ts': `import { foundationSsmPath, isFoundationStage, productSliceRegistrationPath, resolveFoundationStages } from '@empire-builder-kit/nx/foundation';
|
|
11
|
+
import { sliceDataTable, sliceUserPoolClient, sliceWebAssetsBucket, sliceWebUrl } from '@empire-builder-kit/nx/slice-infra';
|
|
12
|
+
${sql ? "import { sliceDatabase } from './database.js';\n" : ''}// <ebk:composition-imports:start>
|
|
472
13
|
// <ebk:composition-imports:end>
|
|
473
14
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
if (input.enabled === 'false') return undefined;
|
|
492
|
-
if (!${JSON.stringify(protectedRuntimeStages)}.includes(input.stage)) {
|
|
493
|
-
throw new Error(
|
|
494
|
-
'Protected performance load requires one active rehearsal or production stage.',
|
|
495
|
-
);
|
|
496
|
-
}
|
|
497
|
-
const stage = input.stage as 'development' | 'production' | 'staging';
|
|
498
|
-
const accountId = process.env.AWS_EXPECTED_ACCOUNT_ID?.trim() ?? '';
|
|
499
|
-
const region = process.env.AWS_REGION?.trim() ?? '';
|
|
500
|
-
if (
|
|
501
|
-
!/^[0-9]{12}$/.test(accountId) ||
|
|
502
|
-
!/^(?:(?:af|ap|ca|cn|eu|il|me|mx|sa|us)(?:-(?:gov|iso|isob|isoe|isof))?|eusc-[a-z]{2})-[a-z]+-\\d$/.test(
|
|
503
|
-
region,
|
|
504
|
-
)
|
|
505
|
-
) {
|
|
506
|
-
throw new Error(
|
|
507
|
-
'Protected performance load AWS target is absent or malformed.',
|
|
508
|
-
);
|
|
509
|
-
}
|
|
510
|
-
const candidateBytes = readFileSync(
|
|
511
|
-
new URL(
|
|
512
|
-
'../../../.ebk/evidence/release-candidate/packages/${name}/candidate.json',
|
|
513
|
-
import.meta.url,
|
|
514
|
-
),
|
|
515
|
-
);
|
|
516
|
-
const candidate = JSON.parse(candidateBytes.toString('utf8')) as {
|
|
517
|
-
kind?: unknown;
|
|
518
|
-
schemaVersion?: unknown;
|
|
519
|
-
slice?: unknown;
|
|
520
|
-
sourceCommit?: unknown;
|
|
15
|
+
export function product() {
|
|
16
|
+
const stages = resolveFoundationStages({ consumerStage: $app.stage, foundationStage: process.env.EBK_FOUNDATION_STAGE });
|
|
17
|
+
const read = (key: Parameters<typeof foundationSsmPath>[1]) =>
|
|
18
|
+
aws.ssm.getParameterOutput({ name: foundationSsmPath(stages.foundationStage, key) }).value;
|
|
19
|
+
const router = sst.aws.Router.get('FoundationRouter', read('routerDistributionId'));
|
|
20
|
+
const userPool = sst.aws.CognitoUserPool.get('FoundationIdentity', read('identityUserPoolId'));
|
|
21
|
+
const authClient = userPool.addClient('${pascal}WebAuthClient', sliceUserPoolClient());
|
|
22
|
+
const tablePlan = sliceDataTable('${name}', $app.stage);
|
|
23
|
+
const table = new aws.dynamodb.Table('${pascal}KeyValue', tablePlan.args, tablePlan.options);
|
|
24
|
+
const environment = {
|
|
25
|
+
EBK_STAGE: $app.stage,
|
|
26
|
+
AUTH_CLIENT_ID: authClient.id,
|
|
27
|
+
AUTH_USER_POOL_ID: userPool.id,
|
|
28
|
+
EBK_SOURCE_COMMIT: process.env.EBK_SOURCE_COMMIT ?? '',
|
|
29
|
+
EBK_LOCAL_SOURCE_TREE: process.env.EBK_LOCAL_SOURCE_TREE ?? '',
|
|
30
|
+
EBK_KEY_VALUE_TABLE: table.name,
|
|
31
|
+
EVENT_BUS_NAME: read('eventBusName'),
|
|
521
32
|
};
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
candidate.sourceCommit !== input.releaseSourceCommit ||
|
|
527
|
-
!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(input.releaseSourceCommit)
|
|
528
|
-
) {
|
|
529
|
-
throw new Error(
|
|
530
|
-
'Protected performance load requires the exact deployed release candidate.',
|
|
531
|
-
);
|
|
532
|
-
}
|
|
533
|
-
const deploymentReceiptBytes = readFileSync(
|
|
534
|
-
new URL(
|
|
535
|
-
'../../../.ebk/evidence/deployment/latest.json',
|
|
536
|
-
import.meta.url,
|
|
537
|
-
),
|
|
538
|
-
);
|
|
539
|
-
validateSuccessfulDeploymentReceipt(
|
|
540
|
-
JSON.parse(deploymentReceiptBytes.toString('utf8')),
|
|
541
|
-
{
|
|
542
|
-
account: accountId,
|
|
543
|
-
project: '${name}',
|
|
544
|
-
region,
|
|
545
|
-
sourceCommit: input.releaseSourceCommit,
|
|
546
|
-
stage,
|
|
547
|
-
},
|
|
548
|
-
);
|
|
549
|
-
const deploymentReceiptDigest = createHash('sha256')
|
|
550
|
-
.update(deploymentReceiptBytes)
|
|
551
|
-
.digest('hex');
|
|
552
|
-
return Object.freeze({
|
|
553
|
-
candidateDigest: createHash('sha256')
|
|
554
|
-
.update(candidateBytes)
|
|
555
|
-
.digest('hex'),
|
|
556
|
-
releaseId: 'release-' + deploymentReceiptDigest.slice(0, 24),
|
|
557
|
-
releaseMaterialDigest: deploymentReceiptDigest,
|
|
558
|
-
target: Object.freeze({
|
|
559
|
-
accountFingerprint:
|
|
560
|
-
'sha256:' +
|
|
561
|
-
createHash('sha256').update(accountId, 'utf8').digest('hex'),
|
|
562
|
-
region,
|
|
563
|
-
slice: '${name}',
|
|
564
|
-
stage,
|
|
565
|
-
}),
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
${sql
|
|
570
|
-
? `/**
|
|
571
|
-
* The optional EBK_DATABASE_CREDENTIAL_GENERATION names the generated database
|
|
572
|
-
* credential generation for every provisioned identifier of this Slice. Each
|
|
573
|
-
* identifier's next bootstrap rotates both runtime roles once when it differs
|
|
574
|
-
* from the stored generation. Unset or empty keeps the framework default.
|
|
575
|
-
*/
|
|
576
|
-
function databaseCredentialRotationTokens():
|
|
577
|
-
| Readonly<Record<string, string>>
|
|
578
|
-
| undefined {
|
|
579
|
-
const generation =
|
|
580
|
-
process.env.EBK_DATABASE_CREDENTIAL_GENERATION?.trim() ?? '';
|
|
581
|
-
if (generation === '') return undefined;
|
|
582
|
-
if (!/^[a-z0-9][a-z0-9-]{0,62}$/.test(generation)) {
|
|
583
|
-
throw new Error(
|
|
584
|
-
'EBK_DATABASE_CREDENTIAL_GENERATION must be 1 to 63 lowercase letters, digits, or hyphens that start with a letter or digit, or unset.',
|
|
585
|
-
);
|
|
586
|
-
}
|
|
587
|
-
return Object.fromEntries(
|
|
588
|
-
validateDatabaseBindings(databaseBindings, {
|
|
589
|
-
slice: '${name}',
|
|
590
|
-
}).provisioned.map((database) => [database, generation]),
|
|
591
|
-
);
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
`
|
|
595
|
-
: ''}\
|
|
596
|
-
${logHelpers.managedLogGroup}
|
|
597
|
-
${logHelpers.managedLogContract}
|
|
598
|
-
${logHelpers.operationalAlarmDescription}
|
|
599
|
-
// sst.aws.Queue has no name member: QueueName dimensions read the physical
|
|
600
|
-
// aws.sqs.Queue name through nodes (nodes.queue.id is the queue URL).
|
|
601
|
-
function physicalQueueName<Q extends { nodes: { queue: { name: unknown } } }>(
|
|
602
|
-
queue: Q,
|
|
603
|
-
): Q['nodes']['queue']['name'] {
|
|
604
|
-
return queue.nodes.queue.name;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
${logHelpers.managedLogDataProtection}
|
|
608
|
-
${logHelpers.lambdaLogging}
|
|
609
|
-
export function product(publicDomain?: SlicePublicDomain) {
|
|
610
|
-
${sql
|
|
611
|
-
? ` // Refuse a malformed credential generation before any product resource
|
|
612
|
-
// registers.
|
|
613
|
-
const databaseRotationTokens = databaseCredentialRotationTokens();
|
|
614
|
-
`
|
|
615
|
-
: ''}\
|
|
616
|
-
const backgroundSchedules = backgroundWorkSchedules(
|
|
617
|
-
backgroundWorkPolicy,
|
|
618
|
-
$dev ? 'development' : $app.stage,
|
|
619
|
-
);
|
|
620
|
-
const asyncAdaptersConfigured = assertAsyncAdapterDeploymentReady();
|
|
621
|
-
// Declared cross-Slice subscriptions fail closed before any resource registers.
|
|
622
|
-
const crossSliceSubscriptions = crossSliceEventSubscriptions(
|
|
623
|
-
eventSubscriptions,
|
|
624
|
-
contractDependencies,
|
|
625
|
-
);
|
|
626
|
-
const secretLinks = createStandardSliceSecretLinks();
|
|
627
|
-
const performanceHmacLogicalName =
|
|
628
|
-
'GeneratedPerformanceLoadHmacKeys';
|
|
629
|
-
const secretLinksFor = (
|
|
630
|
-
resource: string,
|
|
631
|
-
excludeLogicalNames: readonly string[] = [],
|
|
632
|
-
) =>
|
|
633
|
-
secretLinks.linksForWorkload('${name}.' + resource, {
|
|
634
|
-
excludeLogicalNames,
|
|
635
|
-
});
|
|
636
|
-
const secretLinksForWorkloads = (...resources: readonly string[]) => [
|
|
637
|
-
...new Set(resources.flatMap((resource) => secretLinksFor(resource))),
|
|
638
|
-
];
|
|
639
|
-
// Workload generators compose multi-role secret bindings through this seam.
|
|
640
|
-
void secretLinksForWorkloads;
|
|
641
|
-
const devPortInput = $dev ? (process.env.EBK_DEV_PORT ?? '3000') : '3000';
|
|
642
|
-
if (!/^\\d+$/.test(devPortInput)) {
|
|
643
|
-
throw new Error('EBK_DEV_PORT must be an integer from 1024 through 65535.');
|
|
644
|
-
}
|
|
645
|
-
const devPort = Number(devPortInput);
|
|
646
|
-
if (!Number.isSafeInteger(devPort) || devPort < 1024 || devPort > 65535) {
|
|
647
|
-
throw new Error('EBK_DEV_PORT must be an integer from 1024 through 65535.');
|
|
648
|
-
}
|
|
649
|
-
const protectedStage = ${JSON.stringify(protectedRuntimeStages)}.includes(
|
|
650
|
-
$app.stage,
|
|
651
|
-
);
|
|
652
|
-
const sourceCommit =
|
|
653
|
-
process.env.EBK_SOURCE_COMMIT ?? (protectedStage ? '' : 'unresolved');
|
|
654
|
-
const releaseSourceCommit =
|
|
655
|
-
process.env.EBK_RELEASE_SOURCE_COMMIT ?? sourceCommit;
|
|
656
|
-
${sql
|
|
657
|
-
? ` const exactDevelopmentRetirement =
|
|
658
|
-
$app.stage === 'development' &&
|
|
659
|
-
Object.values(databaseBindings).some((binding) =>
|
|
660
|
-
binding.provisioned.includes('retirement_rehearsal'),
|
|
661
|
-
);
|
|
662
|
-
`
|
|
663
|
-
: ''}\
|
|
664
|
-
if (
|
|
665
|
-
protectedStage &&
|
|
666
|
-
(!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(sourceCommit) ||
|
|
667
|
-
!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(releaseSourceCommit))
|
|
668
|
-
) {
|
|
669
|
-
throw new Error(
|
|
670
|
-
'Protected infrastructure requires exact deployment and release source Git object IDs.',
|
|
671
|
-
);
|
|
672
|
-
}
|
|
673
|
-
$transform(
|
|
674
|
-
aws.lambda.Invocation,
|
|
675
|
-
(args: any, _opts: any, logicalName: string) => {
|
|
676
|
-
if (logicalName !== '${pascalName}WebRevalidationSeed') return;
|
|
677
|
-
const triggers = args.triggers;
|
|
678
|
-
if (
|
|
679
|
-
!triggers ||
|
|
680
|
-
typeof triggers !== 'object' ||
|
|
681
|
-
Array.isArray(triggers) ||
|
|
682
|
-
Object.keys(triggers).length !== 1 ||
|
|
683
|
-
typeof triggers.version !== 'string'
|
|
684
|
-
) {
|
|
685
|
-
throw new Error(
|
|
686
|
-
'Pinned SST Next revalidation seed does not expose one exact version trigger.',
|
|
687
|
-
);
|
|
688
|
-
}
|
|
689
|
-
// SST 4.17.1 uses Date.now() here, which makes every preview propose a
|
|
690
|
-
// replacement even when the immutable application source is unchanged.
|
|
691
|
-
// Re-seed exactly once per released source instead.
|
|
692
|
-
args.triggers = { version: releaseSourceCommit };
|
|
693
|
-
},
|
|
694
|
-
);
|
|
695
|
-
${''}\
|
|
696
|
-
${sql
|
|
697
|
-
? ` const databaseMigrationContainer = resolveStandardContainerImage({
|
|
698
|
-
artifactId: '${name}.job.database-migration',
|
|
699
|
-
local: {
|
|
700
|
-
context: '../..',
|
|
701
|
-
dockerfile: 'packages/${name}/migration/Dockerfile',
|
|
702
|
-
},
|
|
703
|
-
sourceCommit: releaseSourceCommit,
|
|
704
|
-
stage: $app.stage,
|
|
705
|
-
});
|
|
706
|
-
const databaseRetirementContainer = resolveStandardContainerImage({
|
|
707
|
-
artifactId: '${name}.job.database-retirement',
|
|
708
|
-
exactDevelopment: exactDevelopmentRetirement,
|
|
709
|
-
local: {
|
|
710
|
-
context: '../..',
|
|
711
|
-
dockerfile: 'packages/${name}/migration/Dockerfile',
|
|
712
|
-
},
|
|
713
|
-
sourceCommit: releaseSourceCommit,
|
|
714
|
-
stage: $app.stage,
|
|
715
|
-
});
|
|
716
|
-
`
|
|
717
|
-
: ''}\
|
|
718
|
-
const performanceDeploymentAuthority = protectedStage
|
|
719
|
-
? protectedPerformanceDeploymentAuthority({
|
|
720
|
-
enabled: process.env.EBK_PERFORMANCE_LOAD_ENABLED ?? 'false',
|
|
721
|
-
releaseSourceCommit,
|
|
722
|
-
stage: $app.stage,
|
|
723
|
-
})
|
|
724
|
-
: undefined;
|
|
725
|
-
const foundation = getFoundationInfrastructure();
|
|
726
|
-
${` const keyValue = createKeyValueInfrastructure({
|
|
727
|
-
eventBusArn: foundation.discovery.eventBusArn,
|
|
728
|
-
eventBusName: foundation.discovery.eventBusName,
|
|
729
|
-
alertTopicArn: foundation.discovery.alertTopicArn,
|
|
730
|
-
outbox: backgroundSchedules.outbox,
|
|
731
|
-
managedLogGroup,
|
|
732
|
-
lambdaLogging,
|
|
733
|
-
});
|
|
734
|
-
`}\
|
|
735
|
-
// Domain delivery is the key-value stream plus scheduled reconciliation; the
|
|
736
|
-
// async/outbox-relay Function drains only the isolated performance sink.
|
|
737
|
-
// Observation only: alarms never pause, drop, or retry an event intent.
|
|
738
|
-
const keyValueStreamDeliveryErrorAlarm = new aws.cloudwatch.MetricAlarm(
|
|
739
|
-
'${pascalName}KeyValueStreamDeliveryErrors',
|
|
740
|
-
{
|
|
741
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
742
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'key-value-stream-delivery-errors', ' ')}),
|
|
743
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
744
|
-
dimensions: { FunctionName: keyValue.dispatcher.name },
|
|
745
|
-
evaluationPeriods: 1,
|
|
746
|
-
metricName: 'Errors',
|
|
747
|
-
name: '${name}-' + $app.stage + '-key-value-stream-delivery-errors',
|
|
748
|
-
namespace: 'AWS/Lambda',
|
|
749
|
-
period: 300,
|
|
750
|
-
statistic: 'Sum',
|
|
751
|
-
threshold: 1,
|
|
752
|
-
treatMissingData: 'notBreaching',
|
|
753
|
-
},
|
|
754
|
-
);
|
|
755
|
-
const keyValueStreamIteratorAgeAlarm = new aws.cloudwatch.MetricAlarm(
|
|
756
|
-
'${pascalName}KeyValueStreamIteratorAge',
|
|
757
|
-
{
|
|
758
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
759
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'key-value-stream-iterator-age', ' ')}),
|
|
760
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
761
|
-
dimensions: { FunctionName: keyValue.dispatcher.name },
|
|
762
|
-
evaluationPeriods: 1,
|
|
763
|
-
metricName: 'IteratorAge',
|
|
764
|
-
name: '${name}-' + $app.stage + '-key-value-stream-iterator-age',
|
|
765
|
-
namespace: 'AWS/Lambda',
|
|
766
|
-
period: 300,
|
|
767
|
-
statistic: 'Maximum',
|
|
768
|
-
threshold: 600_000,
|
|
769
|
-
treatMissingData: 'notBreaching',
|
|
770
|
-
},
|
|
771
|
-
);
|
|
772
|
-
const keyValueReconciliationErrorAlarm = new aws.cloudwatch.MetricAlarm(
|
|
773
|
-
'${pascalName}KeyValueReconciliationErrors',
|
|
774
|
-
{
|
|
775
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
776
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'key-value-reconciliation-errors', ' ')}),
|
|
777
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
778
|
-
dimensions: { FunctionName: keyValue.reconciler.name },
|
|
779
|
-
evaluationPeriods: 1,
|
|
780
|
-
metricName: 'Errors',
|
|
781
|
-
name: '${name}-' + $app.stage + '-key-value-reconciliation-errors',
|
|
782
|
-
namespace: 'AWS/Lambda',
|
|
783
|
-
period: 300,
|
|
784
|
-
statistic: 'Sum',
|
|
785
|
-
threshold: 1,
|
|
786
|
-
treatMissingData: 'notBreaching',
|
|
787
|
-
},
|
|
788
|
-
);
|
|
789
|
-
// Reconciliation gauges are bounded per-run samples (one page per shard),
|
|
790
|
-
// so hourly periods cover the default and any sub-hourly reconciliation
|
|
791
|
-
// cadence. A slower configured cadence leaves empty periods, so these alarms
|
|
792
|
-
// can miss a backlog (see each registration's expectedFalseNegativeRisk).
|
|
793
|
-
const outboxBacklogAlarm = new aws.cloudwatch.MetricAlarm(
|
|
794
|
-
'${pascalName}OutboxBacklog',
|
|
795
|
-
{
|
|
796
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
797
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'outbox-backlog', ' ')}),
|
|
798
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
799
|
-
dimensions: { Slice: '${name}', Stage: $app.stage },
|
|
800
|
-
evaluationPeriods: 2,
|
|
801
|
-
metricName: 'OutboxBacklog',
|
|
802
|
-
name: '${name}-' + $app.stage + '-outbox-backlog',
|
|
803
|
-
namespace: 'EBK/Async',
|
|
804
|
-
period: 3600,
|
|
805
|
-
statistic: 'Maximum',
|
|
806
|
-
threshold: 1,
|
|
807
|
-
treatMissingData: 'notBreaching',
|
|
808
|
-
},
|
|
809
|
-
);
|
|
810
|
-
const eventIntentRejectedAlarm = new aws.cloudwatch.MetricAlarm(
|
|
811
|
-
'${pascalName}EventIntentRejected',
|
|
812
|
-
{
|
|
813
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
814
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'event-intent-rejected', ' ')}),
|
|
815
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
816
|
-
dimensions: { Slice: '${name}', Stage: $app.stage },
|
|
817
|
-
evaluationPeriods: 1,
|
|
818
|
-
metricName: 'EventReconciliationRejected',
|
|
819
|
-
name: '${name}-' + $app.stage + '-event-intent-rejected',
|
|
820
|
-
namespace: 'EBK/Async',
|
|
821
|
-
period: 3600,
|
|
822
|
-
statistic: 'Maximum',
|
|
823
|
-
threshold: 1,
|
|
824
|
-
treatMissingData: 'notBreaching',
|
|
825
|
-
},
|
|
826
|
-
);
|
|
827
|
-
const eventDeliveryAttemptsAlarm = new aws.cloudwatch.MetricAlarm(
|
|
828
|
-
'${pascalName}EventDeliveryAttempts',
|
|
829
|
-
{
|
|
830
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
831
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'event-delivery-attempts', ' ')}),
|
|
832
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
833
|
-
dimensions: { Slice: '${name}', Stage: $app.stage },
|
|
834
|
-
evaluationPeriods: 1,
|
|
835
|
-
metricName: 'EventDeliveryMaxAttempts',
|
|
836
|
-
name: '${name}-' + $app.stage + '-event-delivery-attempts',
|
|
837
|
-
namespace: 'EBK/Async',
|
|
838
|
-
period: 3600,
|
|
839
|
-
statistic: 'Maximum',
|
|
840
|
-
threshold: 10,
|
|
841
|
-
treatMissingData: 'notBreaching',
|
|
842
|
-
},
|
|
843
|
-
);
|
|
844
|
-
const nativeAuthority = createStandardSliceNativeRuntimeAuthority({
|
|
845
|
-
${sql
|
|
846
|
-
? ` clusterId: foundation.discovery.clusterId,
|
|
847
|
-
clusterResourceId: foundation.database.clusterResourceId,
|
|
848
|
-
masterSecretArn: foundation.database.masterSecretArn,
|
|
849
|
-
`
|
|
850
|
-
: ''}\
|
|
851
|
-
eventBusArn: foundation.discovery.eventBusArn,
|
|
852
|
-
identityUserPoolArn: foundation.discovery.identityUserPoolArn,
|
|
853
|
-
});
|
|
854
|
-
const runtimeResourceNames = nativeAuthority.resourceNames;
|
|
855
|
-
$transform(aws.dynamodb.Table, (args: any, _opts: any, logicalName: string) => {
|
|
856
|
-
if (logicalName === '${pascalName}WebRevalidationTable') {
|
|
857
|
-
args.name = runtimeResourceNames.webRevalidationTable;
|
|
858
|
-
}
|
|
859
|
-
});
|
|
860
|
-
$transform(aws.sqs.Queue, (args: any, _opts: any, logicalName: string) => {
|
|
861
|
-
if (logicalName === '${pascalName}WebRevalidationEventsQueue') {
|
|
862
|
-
args.name = runtimeResourceNames.webRevalidationQueue;
|
|
863
|
-
}
|
|
864
|
-
});
|
|
865
|
-
const performanceCostControls = create${pascalName}PerformanceCostControls({
|
|
866
|
-
accountCostPolicyDigest: foundation.discovery.accountCostPolicyDigest,
|
|
867
|
-
accountMonthlyMaximumUsd:
|
|
868
|
-
foundation.discovery.accountMonthlyMaximumUsd,
|
|
869
|
-
alertTopicArn: foundation.discovery.alertTopicArn,
|
|
870
|
-
workspace: '${workspace}',
|
|
871
|
-
});
|
|
872
|
-
${sql
|
|
873
|
-
? ` const databaseProvisions = provisionDatabaseBindings(foundation, {
|
|
874
|
-
bindings: databaseBindings,
|
|
875
|
-
...(databaseRotationTokens === undefined
|
|
876
|
-
? {}
|
|
877
|
-
: { rotationTokens: databaseRotationTokens }),
|
|
878
|
-
slice: '${name}',
|
|
879
|
-
});
|
|
880
|
-
const databaseProvision = databaseProvisions.bindings.primary;
|
|
881
|
-
const { db: database } = databaseProvision;
|
|
882
|
-
`
|
|
883
|
-
: ''}\
|
|
884
|
-
const authClient = foundation.userPool.addClient('${pascalName}WebAuthClient', {
|
|
885
|
-
transform: {
|
|
886
|
-
client: {
|
|
887
|
-
// Sign-in is server-side password and refresh-token auth only. SST
|
|
888
|
-
// merges this object over its client defaults, which enable the
|
|
889
|
-
// implicit and code flows with a placeholder callback, so all four
|
|
890
|
-
// OAuth fields are set explicitly: the provider leaves an omitted
|
|
891
|
-
// field at its current value on an existing client.
|
|
892
|
-
allowedOauthFlows: [],
|
|
893
|
-
allowedOauthFlowsUserPoolClient: false,
|
|
894
|
-
allowedOauthScopes: [],
|
|
895
|
-
callbackUrls: [],
|
|
896
|
-
explicitAuthFlows: [
|
|
897
|
-
'ALLOW_USER_PASSWORD_AUTH',
|
|
898
|
-
'ALLOW_REFRESH_TOKEN_AUTH',
|
|
899
|
-
],
|
|
900
|
-
preventUserExistenceErrors: 'ENABLED',
|
|
901
|
-
},
|
|
902
|
-
},
|
|
903
|
-
});
|
|
904
|
-
const machineClientProvisionerLogs = managedLogGroup(
|
|
905
|
-
'${pascalName}MachineClientProvisionerLogs',
|
|
906
|
-
'machine-client-provisioner',
|
|
907
|
-
foundation.discovery.alertTopicArn,
|
|
908
|
-
);
|
|
909
|
-
const machineClientProvisioner = new sst.aws.Function(
|
|
910
|
-
'${pascalName}MachineClientProvisioner',
|
|
911
|
-
{
|
|
912
|
-
dev: false,
|
|
913
|
-
permissions: standardSliceMachineClientProvisionerPermissions({
|
|
914
|
-
userPoolArn: foundation.discovery.identityUserPoolArn,
|
|
915
|
-
}),
|
|
916
|
-
environment: {
|
|
917
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
918
|
-
String(observability.routineSuccessSampleRate),
|
|
919
|
-
EBK_SLICE: '${name}',
|
|
920
|
-
EBK_STAGE: $app.stage,
|
|
921
|
-
EBK_WORKSPACE: '${workspace}',
|
|
922
|
-
},
|
|
923
|
-
handler: 'authorization/machine-client-provisioner.handler',
|
|
924
|
-
link: secretLinksFor('machine-client-provisioner'),
|
|
925
|
-
timeout: '2 minutes',
|
|
926
|
-
...lambdaLogging(machineClientProvisionerLogs.logGroup.name),
|
|
927
|
-
},
|
|
928
|
-
);
|
|
929
|
-
const machineAuthorization = createStandardSliceMachineAuthorization({
|
|
930
|
-
credentialGeneration:
|
|
931
|
-
(process.env.EBK_MACHINE_CREDENTIAL_GENERATION ??
|
|
932
|
-
'blue-1') as MachineCredentialGeneration,
|
|
933
|
-
provisionerFunctionArn: machineClientProvisioner.arn,
|
|
934
|
-
retirePreviousGeneration:
|
|
935
|
-
process.env.EBK_MACHINE_RETIRE_PREVIOUS_GENERATION === 'true',
|
|
936
|
-
tokenEndpoint: foundation.discovery.identityTokenEndpoint,
|
|
937
|
-
userPoolId: foundation.userPool.id,
|
|
938
|
-
});
|
|
939
|
-
const dataExportStore = createStandardDataExportStore({
|
|
940
|
-
bucketName: runtimeResourceNames.dataExportBucket,
|
|
941
|
-
keyAliasName: runtimeResourceNames.dataExportKeyAlias,
|
|
942
|
-
});
|
|
943
|
-
|
|
944
|
-
const apiHealthLogs = managedLogGroup(
|
|
945
|
-
'${pascalName}ApiHealthLogs',
|
|
946
|
-
'api-health',
|
|
947
|
-
foundation.discovery.alertTopicArn,
|
|
948
|
-
);
|
|
949
|
-
const protectedApiLogs = managedLogGroup(
|
|
950
|
-
'${pascalName}ProtectedApiLogs',
|
|
951
|
-
'api-protected',
|
|
952
|
-
foundation.discovery.alertTopicArn,
|
|
953
|
-
);
|
|
954
|
-
const machineAuthorizationProofLogs = managedLogGroup(
|
|
955
|
-
'${pascalName}MachineAuthorizationProofLogs',
|
|
956
|
-
'machine-authorization-proof',
|
|
957
|
-
foundation.discovery.alertTopicArn,
|
|
958
|
-
);
|
|
959
|
-
const machineAuthorizationProofTargetLogs = managedLogGroup(
|
|
960
|
-
'${pascalName}MachineAuthorizationProofTargetLogs',
|
|
961
|
-
'machine-authorization-proof-target',
|
|
962
|
-
foundation.discovery.alertTopicArn,
|
|
963
|
-
);
|
|
964
|
-
const delegationLogs = managedLogGroup(
|
|
965
|
-
'${pascalName}DelegationLogs',
|
|
966
|
-
'authorization-delegations',
|
|
967
|
-
foundation.discovery.alertTopicArn,
|
|
968
|
-
);
|
|
969
|
-
const dataRightsLogs = managedLogGroup(
|
|
970
|
-
'${pascalName}DataRightsLogs',
|
|
971
|
-
'data-rights',
|
|
972
|
-
foundation.discovery.alertTopicArn,
|
|
973
|
-
);
|
|
974
|
-
const dataRetentionReviewLogs = managedLogGroup(
|
|
975
|
-
'${pascalName}DataRetentionReviewLogs',
|
|
976
|
-
'data-retention-review',
|
|
977
|
-
foundation.discovery.alertTopicArn,
|
|
978
|
-
);
|
|
979
|
-
const dataExportCleanupLogs = managedLogGroup(
|
|
980
|
-
'${pascalName}DataExportCleanupLogs',
|
|
981
|
-
'job-data-export-cleanup',
|
|
982
|
-
foundation.discovery.alertTopicArn,
|
|
983
|
-
);
|
|
984
|
-
const databaseHealthLogs = managedLogGroup(
|
|
985
|
-
'${pascalName}DatabaseHealthLogs',
|
|
986
|
-
'database-health',
|
|
987
|
-
foundation.discovery.alertTopicArn,
|
|
988
|
-
);
|
|
989
|
-
const databaseRecordsLogs = managedLogGroup(
|
|
990
|
-
'${pascalName}DatabaseRecordsLogs',
|
|
991
|
-
'database-records',
|
|
992
|
-
foundation.discovery.alertTopicArn,
|
|
993
|
-
);
|
|
994
|
-
const eventPublisherLogs = managedLogGroup(
|
|
995
|
-
'${pascalName}EventPublisherLogs',
|
|
996
|
-
'event-publisher',
|
|
997
|
-
foundation.discovery.alertTopicArn,
|
|
998
|
-
);
|
|
999
|
-
const eventConsumerLogs = managedLogGroup(
|
|
1000
|
-
'${pascalName}EventConsumerLogs',
|
|
1001
|
-
'event-consumer',
|
|
1002
|
-
foundation.discovery.alertTopicArn,
|
|
1003
|
-
);
|
|
1004
|
-
const asyncOutboxRelayLogs = managedLogGroup(
|
|
1005
|
-
'${pascalName}AsyncOutboxRelayLogs',
|
|
1006
|
-
'async-outbox-relay',
|
|
1007
|
-
foundation.discovery.alertTopicArn,
|
|
1008
|
-
);
|
|
1009
|
-
const asyncInboxCleanupLogs = managedLogGroup(
|
|
1010
|
-
'${pascalName}AsyncInboxCleanupLogs',
|
|
1011
|
-
'async-inbox-cleanup',
|
|
1012
|
-
foundation.discovery.alertTopicArn,
|
|
1013
|
-
);
|
|
1014
|
-
const asyncProviderWorkerLogs = asyncAdaptersConfigured || observability.retainDormantComponentLogs ? managedLogGroup(
|
|
1015
|
-
'${pascalName}AsyncProviderWorkerLogs',
|
|
1016
|
-
'async-provider-worker',
|
|
1017
|
-
foundation.discovery.alertTopicArn,
|
|
1018
|
-
) : undefined;
|
|
1019
|
-
const asyncScheduleTargetLogs = managedLogGroup(
|
|
1020
|
-
'${pascalName}AsyncScheduleTargetLogs',
|
|
1021
|
-
'async-schedule-target',
|
|
1022
|
-
foundation.discovery.alertTopicArn,
|
|
1023
|
-
);
|
|
1024
|
-
const asyncWebhookIngressLogs = asyncAdaptersConfigured || observability.retainDormantComponentLogs ? managedLogGroup(
|
|
1025
|
-
'${pascalName}AsyncWebhookIngressLogs',
|
|
1026
|
-
'async-webhook-ingress',
|
|
1027
|
-
foundation.discovery.alertTopicArn,
|
|
1028
|
-
) : undefined;
|
|
1029
|
-
const asyncWorkflowTaskLogs = managedLogGroup(
|
|
1030
|
-
'${pascalName}AsyncWorkflowTaskLogs',
|
|
1031
|
-
'async-workflow-task',
|
|
1032
|
-
foundation.discovery.alertTopicArn,
|
|
1033
|
-
);
|
|
1034
|
-
const nextServerLogs = managedLogGroup(
|
|
1035
|
-
'${pascalName}NextServerLogs',
|
|
1036
|
-
'next-server',
|
|
1037
|
-
foundation.discovery.alertTopicArn,
|
|
1038
|
-
);
|
|
1039
|
-
const nextImageOptimizerLogs = managedLogGroup(
|
|
1040
|
-
'${pascalName}NextImageOptimizerLogs',
|
|
1041
|
-
'next-image-optimizer',
|
|
1042
|
-
foundation.discovery.alertTopicArn,
|
|
1043
|
-
);
|
|
1044
|
-
const nextRevalidationSeederLogs = managedLogGroup(
|
|
1045
|
-
'${pascalName}NextRevalidationSeederLogs',
|
|
1046
|
-
'next-revalidation-seeder',
|
|
1047
|
-
foundation.discovery.alertTopicArn,
|
|
1048
|
-
);
|
|
1049
|
-
const nextRevalidationSubscriberLogs = managedLogGroup(
|
|
1050
|
-
'${pascalName}NextRevalidationSubscriberLogs',
|
|
1051
|
-
'next-revalidation-subscriber',
|
|
1052
|
-
foundation.discovery.alertTopicArn,
|
|
1053
|
-
);
|
|
1054
|
-
|
|
1055
|
-
const vpcRouteFunctionMaterializer =
|
|
1056
|
-
createVpcRouteFunctionMaterializer({
|
|
1057
|
-
directHandlers: [
|
|
1058
|
-
'api/health.handler',
|
|
1059
|
-
'async/webhook-ingress.handler',
|
|
1060
|
-
],
|
|
1061
|
-
${''}\
|
|
1062
|
-
output: $output,
|
|
1063
|
-
});
|
|
1064
|
-
const api = new sst.aws.ApiGatewayV2('${pascalName}Api', {
|
|
1065
|
-
${network ? ' ...(performanceDeploymentAuthority ? { vpc: foundation.vpc } : {}),\n' : ''}\
|
|
1066
|
-
// A bound stage maps this API under /${name} on the
|
|
1067
|
-
// Foundation's api.<root> domain, read by name. A later per-Slice API
|
|
1068
|
-
// host is an additive swap of nameId for name on this same input, with
|
|
1069
|
-
// the Slice owning its certificate and records; no consumer reads the
|
|
1070
|
-
// path shape of apiUrl.
|
|
1071
|
-
...(publicDomain
|
|
1072
|
-
? { domain: { nameId: publicDomain.apiDomainName, path: '${name}' } }
|
|
1073
|
-
: {}),
|
|
1074
|
-
transform: {
|
|
1075
|
-
...(publicDomain
|
|
1076
|
-
? {
|
|
1077
|
-
// A custom-domain stage serves its API only on api.<root>.
|
|
1078
|
-
api(args: Record<string, unknown>) {
|
|
1079
|
-
args.disableExecuteApiEndpoint = true;
|
|
1080
|
-
},
|
|
1081
|
-
}
|
|
1082
|
-
: {}),
|
|
1083
|
-
route: {
|
|
1084
|
-
handler: vpcRouteFunctionMaterializer.transform,
|
|
1085
|
-
},
|
|
1086
|
-
},
|
|
33
|
+
const api = new sst.aws.ApiGatewayV2('${pascal}Api');
|
|
34
|
+
const authorizer = api.addAuthorizer({
|
|
35
|
+
name: 'FunctionAccess',
|
|
36
|
+
jwt: { issuer: $interpolate\`https://cognito-idp.\${aws.getRegionOutput({}).name}.amazonaws.com/\${userPool.id}\`, audiences: [authClient.id] },
|
|
1087
37
|
});
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
rawRoute: string,
|
|
1094
|
-
handler: { handler: string } & Record<string, any>,
|
|
1095
|
-
args?: Record<string, any>,
|
|
1096
|
-
) =>
|
|
1097
|
-
vpcRouteFunctionMaterializer.route(
|
|
1098
|
-
rawRoute,
|
|
1099
|
-
handler,
|
|
1100
|
-
args,
|
|
1101
|
-
(registeredRoute, registeredHandler, registeredArgs) =>
|
|
1102
|
-
api.route(registeredRoute, registeredHandler, registeredArgs),
|
|
1103
|
-
);
|
|
1104
|
-
const performanceIngress = performanceDeploymentAuthority
|
|
1105
|
-
? (() => {
|
|
1106
|
-
const originProof = new random.RandomPassword(
|
|
1107
|
-
'${pascalName}PerformanceRouterOriginProof',
|
|
1108
|
-
{
|
|
1109
|
-
keepers: { contract: 'ebk-performance-router-origin-proof-v1' },
|
|
1110
|
-
length: 43,
|
|
1111
|
-
lower: true,
|
|
1112
|
-
numeric: true,
|
|
1113
|
-
special: false,
|
|
1114
|
-
upper: true,
|
|
1115
|
-
},
|
|
1116
|
-
);
|
|
1117
|
-
const router = new sst.aws.Router('${pascalName}PerformanceRouter', {
|
|
1118
|
-
edge: {
|
|
1119
|
-
viewerRequest: {
|
|
1120
|
-
injection: originProof.result.apply(
|
|
1121
|
-
(proof: string) =>
|
|
1122
|
-
createRouterOriginProofInjection('${name}', proof),
|
|
1123
|
-
),
|
|
1124
|
-
},
|
|
1125
|
-
},
|
|
1126
|
-
});
|
|
1127
|
-
return {
|
|
1128
|
-
api,
|
|
1129
|
-
// The service routes keep the API's mapping path, which API
|
|
1130
|
-
// Gateway strips before matching a route.
|
|
1131
|
-
apiPathPrefix: publicDomain ? '/${name}' : '',
|
|
1132
|
-
originProof: originProof.result,
|
|
1133
|
-
router,
|
|
1134
|
-
};
|
|
1135
|
-
})()
|
|
1136
|
-
: undefined;
|
|
1137
|
-
const performanceDeploymentBinding =
|
|
1138
|
-
performanceDeploymentAuthority && performanceIngress
|
|
1139
|
-
? {
|
|
1140
|
-
...performanceDeploymentAuthority,
|
|
1141
|
-
target: {
|
|
1142
|
-
...performanceDeploymentAuthority.target,
|
|
1143
|
-
origin: performanceIngress.router.url,
|
|
1144
|
-
},
|
|
1145
|
-
}
|
|
1146
|
-
: undefined;
|
|
1147
|
-
api.route(${identifierPrefix}Health.method + ' ' + ${identifierPrefix}Health.path, {
|
|
1148
|
-
permissions: nativeAuthority.permissions('api-health'),
|
|
1149
|
-
environment: {
|
|
1150
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
1151
|
-
String(observability.routineSuccessSampleRate),
|
|
1152
|
-
EBK_SOURCE_COMMIT: releaseSourceCommit,
|
|
1153
|
-
EBK_STAGE: $app.stage,
|
|
1154
|
-
},
|
|
38
|
+
const functionAccess = () => {
|
|
39
|
+
return { authorizationType: 'JWT', authorizerId: authorizer.id };
|
|
40
|
+
};
|
|
41
|
+
void functionAccess;
|
|
42
|
+
api.route('GET /health', {
|
|
1155
43
|
handler: 'api/health.handler',
|
|
1156
|
-
link: secretLinksFor('api-health'),
|
|
1157
|
-
...lambdaLogging(apiHealthLogs.logGroup.name),
|
|
1158
|
-
});
|
|
1159
|
-
routeInVpc(
|
|
1160
|
-
${identifierPrefix}MachineAuthorizationProof.method +
|
|
1161
|
-
' ' +
|
|
1162
|
-
${identifierPrefix}MachineAuthorizationProof.path,
|
|
1163
|
-
{
|
|
1164
|
-
permissions: nativeAuthority.permissions('api-machine-authorization-proof'),
|
|
1165
|
-
environment: {
|
|
1166
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
1167
|
-
String(observability.routineSuccessSampleRate),
|
|
1168
|
-
${' ...keyValue.environment,\n'}\
|
|
1169
|
-
AUTH_CLIENT_ID: authClient.id,
|
|
1170
|
-
AUTH_MACHINE_ACCEPTED_CLIENT_IDS:
|
|
1171
|
-
machineAuthorization.acceptedClientIdsJson,
|
|
1172
|
-
AUTH_MACHINE_CLIENT_ID: machineAuthorization.clientId,
|
|
1173
|
-
AUTH_USER_POOL_ID: foundation.userPool.id,
|
|
1174
|
-
EBK_STAGE: $app.stage,
|
|
1175
|
-
},
|
|
1176
|
-
handler: 'api/machine-authorization.handler',
|
|
1177
|
-
link: [
|
|
1178
|
-
${'keyValue.link'},
|
|
1179
|
-
...secretLinksFor('api-machine-authorization-proof'),
|
|
1180
|
-
],
|
|
1181
|
-
...lambdaLogging(machineAuthorizationProofTargetLogs.logGroup.name),
|
|
1182
|
-
},
|
|
1183
|
-
);
|
|
1184
|
-
for (const route of [
|
|
1185
|
-
{
|
|
1186
|
-
handler: 'api/delegations.issueHandler',
|
|
1187
|
-
operation: ${identifierPrefix}IssueRecordDelegation,
|
|
1188
|
-
},
|
|
1189
|
-
{
|
|
1190
|
-
handler: 'api/delegations.useHandler',
|
|
1191
|
-
operation: ${identifierPrefix}UseRecordDelegation,
|
|
1192
|
-
},
|
|
1193
|
-
{
|
|
1194
|
-
handler: 'api/delegations.revokeHandler',
|
|
1195
|
-
operation: ${identifierPrefix}RevokeRecordDelegation,
|
|
1196
|
-
},
|
|
1197
|
-
]) {
|
|
1198
|
-
routeInVpc(route.operation.method + ' ' + route.operation.path, {
|
|
1199
|
-
permissions: nativeAuthority.permissions('api-delegations'),
|
|
1200
|
-
environment: {
|
|
1201
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
1202
|
-
String(observability.routineSuccessSampleRate),
|
|
1203
|
-
${' ...keyValue.environment,\n'}\
|
|
1204
|
-
AUTH_CLIENT_ID: authClient.id,
|
|
1205
|
-
AUTH_MACHINE_ACCEPTED_CLIENT_IDS:
|
|
1206
|
-
machineAuthorization.acceptedClientIdsJson,
|
|
1207
|
-
AUTH_MACHINE_CLIENT_ID: machineAuthorization.clientId,
|
|
1208
|
-
AUTH_USER_POOL_ID: foundation.userPool.id,
|
|
1209
|
-
EBK_STAGE: $app.stage,
|
|
1210
|
-
},
|
|
1211
|
-
handler: route.handler,
|
|
1212
|
-
link: [${'keyValue.link'}, ...secretLinksFor('api-delegations')],
|
|
1213
|
-
...lambdaLogging(delegationLogs.logGroup.name),
|
|
1214
|
-
});
|
|
1215
|
-
}
|
|
1216
|
-
for (const route of [
|
|
1217
|
-
{
|
|
1218
|
-
handler: 'api/data-rights.requestExportHandler',
|
|
1219
|
-
operation: ${identifierPrefix}RequestRecordExport,
|
|
1220
|
-
},
|
|
1221
|
-
{
|
|
1222
|
-
handler: 'api/data-rights.decideExportHandler',
|
|
1223
|
-
operation: ${identifierPrefix}DecideRecordExport,
|
|
1224
|
-
},
|
|
1225
|
-
{
|
|
1226
|
-
handler: 'api/data-rights.executeExportHandler',
|
|
1227
|
-
operation: ${identifierPrefix}ExecuteRecordExport,
|
|
1228
|
-
},
|
|
1229
|
-
{
|
|
1230
|
-
handler: 'api/data-rights.deliverExportHandler',
|
|
1231
|
-
operation: ${identifierPrefix}DeliverRecordExport,
|
|
1232
|
-
},
|
|
1233
|
-
{
|
|
1234
|
-
handler: 'api/data-rights.cleanupExportHandler',
|
|
1235
|
-
operation: ${identifierPrefix}CleanupRecordExport,
|
|
1236
|
-
},
|
|
1237
|
-
{
|
|
1238
|
-
handler: 'api/data-rights.issueHoldHandler',
|
|
1239
|
-
operation: ${identifierPrefix}IssueRecordHold,
|
|
1240
|
-
},
|
|
1241
|
-
{
|
|
1242
|
-
handler: 'api/data-rights.reviewHoldHandler',
|
|
1243
|
-
operation: ${identifierPrefix}ReviewRecordHold,
|
|
1244
|
-
},
|
|
1245
|
-
{
|
|
1246
|
-
handler: 'api/data-rights.releaseHoldHandler',
|
|
1247
|
-
operation: ${identifierPrefix}ReleaseRecordHold,
|
|
1248
|
-
},
|
|
1249
|
-
{
|
|
1250
|
-
handler: 'api/data-rights.expireHoldHandler',
|
|
1251
|
-
operation: ${identifierPrefix}ExpireRecordHold,
|
|
1252
|
-
},
|
|
1253
|
-
]) {
|
|
1254
|
-
routeInVpc(route.operation.method + ' ' + route.operation.path, {
|
|
1255
|
-
permissions: nativeAuthority.permissions('api-data-rights'),
|
|
1256
|
-
environment: {
|
|
1257
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
1258
|
-
String(observability.routineSuccessSampleRate),
|
|
1259
|
-
${' ...keyValue.environment,\n'}\
|
|
1260
|
-
AUTH_CLIENT_ID: authClient.id,
|
|
1261
|
-
AUTH_MACHINE_ACCEPTED_CLIENT_IDS:
|
|
1262
|
-
machineAuthorization.acceptedClientIdsJson,
|
|
1263
|
-
AUTH_MACHINE_CLIENT_ID: machineAuthorization.clientId,
|
|
1264
|
-
AUTH_USER_POOL_ID: foundation.userPool.id,
|
|
1265
|
-
DATA_EXPORT_BUCKET_NAME: dataExportStore.bucket.bucket,
|
|
1266
|
-
DATA_EXPORT_KMS_KEY_ARN: dataExportStore.encryptionKey.arn,
|
|
1267
|
-
EBK_STAGE: $app.stage,
|
|
1268
|
-
EVENT_BUS_NAME: foundation.discovery.eventBusName,
|
|
1269
|
-
},
|
|
1270
|
-
handler: route.handler,
|
|
1271
|
-
link: [
|
|
1272
|
-
${'keyValue.link'},
|
|
1273
|
-
foundation.eventBus,
|
|
1274
|
-
...secretLinksFor('api-data-rights'),
|
|
1275
|
-
],
|
|
1276
|
-
...lambdaLogging(dataRightsLogs.logGroup.name),
|
|
1277
|
-
});
|
|
1278
|
-
}
|
|
1279
|
-
for (const route of [
|
|
1280
|
-
{
|
|
1281
|
-
handler: 'api/data-retention.requestRetentionApprovalHandler',
|
|
1282
|
-
operation: ${identifierPrefix}RequestRetentionApproval,
|
|
1283
|
-
},
|
|
1284
|
-
{
|
|
1285
|
-
handler: 'api/data-retention.decideRetentionApprovalHandler',
|
|
1286
|
-
operation: ${identifierPrefix}DecideRetentionApproval,
|
|
1287
|
-
},
|
|
1288
|
-
]) {
|
|
1289
|
-
routeInVpc(route.operation.method + ' ' + route.operation.path, {
|
|
1290
|
-
permissions: nativeAuthority.permissions('api-database-records'),
|
|
1291
|
-
environment: {
|
|
1292
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
1293
|
-
String(observability.routineSuccessSampleRate),
|
|
1294
|
-
${' ...keyValue.environment,\n'}\
|
|
1295
|
-
AUTH_CLIENT_ID: authClient.id,
|
|
1296
|
-
AUTH_MACHINE_ACCEPTED_CLIENT_IDS:
|
|
1297
|
-
machineAuthorization.acceptedClientIdsJson,
|
|
1298
|
-
AUTH_MACHINE_CLIENT_ID: machineAuthorization.clientId,
|
|
1299
|
-
AUTH_USER_POOL_ID: foundation.userPool.id,
|
|
1300
|
-
EBK_STAGE: $app.stage,
|
|
1301
|
-
},
|
|
1302
|
-
handler: route.handler,
|
|
1303
|
-
link: [${'keyValue.link'}, ...secretLinksFor('api-database-records')],
|
|
1304
|
-
...lambdaLogging(dataRetentionReviewLogs.logGroup.name),
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1307
|
-
routeInVpc(
|
|
1308
|
-
${identifierPrefix}ProtectedExample.method +
|
|
1309
|
-
' ' +
|
|
1310
|
-
${identifierPrefix}ProtectedExample.path,
|
|
1311
|
-
{
|
|
1312
|
-
permissions: nativeAuthority.permissions('api-protected'),
|
|
1313
44
|
environment: {
|
|
1314
|
-
|
|
1315
|
-
String(observability.routineSuccessSampleRate),
|
|
1316
|
-
${' ...keyValue.environment,\n'}\
|
|
1317
|
-
AUTH_CLIENT_ID: authClient.id,
|
|
1318
|
-
AUTH_MACHINE_ACCEPTED_CLIENT_IDS:
|
|
1319
|
-
machineAuthorization.acceptedClientIdsJson,
|
|
1320
|
-
AUTH_MACHINE_CLIENT_ID: machineAuthorization.clientId,
|
|
1321
|
-
AUTH_USER_POOL_ID: foundation.userPool.id,
|
|
45
|
+
EBK_SOURCE_COMMIT: environment.EBK_SOURCE_COMMIT || 'unresolved',
|
|
1322
46
|
EBK_STAGE: $app.stage,
|
|
1323
47
|
},
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
)
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
' ' +
|
|
1332
|
-
${identifierPrefix}DatabaseHealth.path,
|
|
1333
|
-
{
|
|
1334
|
-
permissions: nativeAuthority.permissions('api-database-health'),
|
|
1335
|
-
environment: {
|
|
1336
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
1337
|
-
String(observability.routineSuccessSampleRate),
|
|
1338
|
-
${' ...keyValue.environment,\n'}\
|
|
1339
|
-
AUTH_CLIENT_ID: authClient.id,
|
|
1340
|
-
AUTH_MACHINE_ACCEPTED_CLIENT_IDS:
|
|
1341
|
-
machineAuthorization.acceptedClientIdsJson,
|
|
1342
|
-
AUTH_MACHINE_CLIENT_ID: machineAuthorization.clientId,
|
|
1343
|
-
AUTH_USER_POOL_ID: foundation.userPool.id,
|
|
1344
|
-
EBK_STAGE: $app.stage,
|
|
1345
|
-
},
|
|
1346
|
-
handler: 'database/runtime-health.handler',
|
|
1347
|
-
link: [${'keyValue.link'}, ...secretLinksFor('api-database-health')],
|
|
1348
|
-
...lambdaLogging(databaseHealthLogs.logGroup.name),
|
|
1349
|
-
},
|
|
1350
|
-
);
|
|
1351
|
-
for (const route of [
|
|
1352
|
-
{
|
|
1353
|
-
handler: 'database/deletions.deleteHandler',
|
|
1354
|
-
operation: ${identifierPrefix}DeleteRecord,
|
|
1355
|
-
},
|
|
1356
|
-
{
|
|
1357
|
-
handler: 'database/records.getHandler',
|
|
1358
|
-
operation: ${identifierPrefix}GetRecord,
|
|
1359
|
-
},
|
|
1360
|
-
{
|
|
1361
|
-
handler: 'database/records.putHandler',
|
|
1362
|
-
operation: ${identifierPrefix}PutRecord,
|
|
1363
|
-
},
|
|
1364
|
-
]) {
|
|
1365
|
-
routeInVpc(route.operation.method + ' ' + route.operation.path, {
|
|
1366
|
-
permissions: nativeAuthority.permissions('api-database-records'),
|
|
1367
|
-
environment: {
|
|
1368
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
1369
|
-
String(observability.routineSuccessSampleRate),
|
|
1370
|
-
${' ...keyValue.environment,\n'}\
|
|
1371
|
-
AUTH_CLIENT_ID: authClient.id,
|
|
1372
|
-
AUTH_MACHINE_ACCEPTED_CLIENT_IDS:
|
|
1373
|
-
machineAuthorization.acceptedClientIdsJson,
|
|
1374
|
-
AUTH_MACHINE_CLIENT_ID: machineAuthorization.clientId,
|
|
1375
|
-
AUTH_USER_POOL_ID: foundation.userPool.id,
|
|
1376
|
-
EBK_STAGE: $app.stage,
|
|
1377
|
-
EVENT_BUS_NAME: foundation.discovery.eventBusName,
|
|
1378
|
-
},
|
|
1379
|
-
handler: route.handler,
|
|
1380
|
-
link: [
|
|
1381
|
-
${'keyValue.link'},
|
|
1382
|
-
foundation.eventBus,
|
|
1383
|
-
...secretLinksFor('api-database-records'),
|
|
1384
|
-
],
|
|
1385
|
-
...lambdaLogging(databaseRecordsLogs.logGroup.name),
|
|
48
|
+
});
|
|
49
|
+
api.route('GET /protected', { handler: 'api/protected.handler', environment: {
|
|
50
|
+
EBK_STAGE: $app.stage, EBK_FUNCTION_AUTHENTICATION: 'signed-in',
|
|
51
|
+
} }, { transform: { route: functionAccess() } });
|
|
52
|
+
if (!$dev && isFoundationStage(stages.consumerStage)) {
|
|
53
|
+
router.route('/${name}/api/functions/', api.url, {
|
|
54
|
+
rewrite: { regex: '^/${name}/api/(.*)$', to: '/$1' },
|
|
1386
55
|
});
|
|
1387
56
|
}
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
},
|
|
1393
|
-
{
|
|
1394
|
-
handler: 'database/deletions.decideDeletionHandler',
|
|
1395
|
-
operation: ${identifierPrefix}DecideRecordDeletion,
|
|
1396
|
-
},
|
|
1397
|
-
]) {
|
|
1398
|
-
routeInVpc(route.operation.method + ' ' + route.operation.path, {
|
|
1399
|
-
permissions: nativeAuthority.permissions('api-database-records'),
|
|
1400
|
-
environment: {
|
|
1401
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
1402
|
-
String(observability.routineSuccessSampleRate),
|
|
1403
|
-
${' ...keyValue.environment,\n'}\
|
|
1404
|
-
AUTH_CLIENT_ID: authClient.id,
|
|
1405
|
-
AUTH_MACHINE_ACCEPTED_CLIENT_IDS:
|
|
1406
|
-
machineAuthorization.acceptedClientIdsJson,
|
|
1407
|
-
AUTH_MACHINE_CLIENT_ID: machineAuthorization.clientId,
|
|
1408
|
-
AUTH_USER_POOL_ID: foundation.userPool.id,
|
|
1409
|
-
EBK_STAGE: $app.stage,
|
|
1410
|
-
},
|
|
1411
|
-
handler: route.handler,
|
|
1412
|
-
link: [${'keyValue.link'}, ...secretLinksFor('api-database-records')],
|
|
1413
|
-
...lambdaLogging(databaseRecordsLogs.logGroup.name),
|
|
57
|
+
let cluster: ReturnType<typeof sst.aws.Cluster.get>;
|
|
58
|
+
const workloadCluster = () => {
|
|
59
|
+
return cluster ??= sst.aws.Cluster.get('FoundationCluster', {
|
|
60
|
+
id: read('clusterId'), vpc: sst.aws.Vpc.get('FoundationVpc', read('vpcId')),
|
|
1414
61
|
});
|
|
1415
|
-
}
|
|
1416
|
-
routeInVpc(
|
|
1417
|
-
${identifierPrefix}PublishCreated.method +
|
|
1418
|
-
' ' +
|
|
1419
|
-
${identifierPrefix}PublishCreated.path,
|
|
1420
|
-
{
|
|
1421
|
-
permissions: nativeAuthority.permissions('api-publish-created'),
|
|
1422
|
-
environment: {
|
|
1423
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
1424
|
-
String(observability.routineSuccessSampleRate),
|
|
1425
|
-
${' ...keyValue.environment,\n'}\
|
|
1426
|
-
AUTH_CLIENT_ID: authClient.id,
|
|
1427
|
-
AUTH_MACHINE_ACCEPTED_CLIENT_IDS:
|
|
1428
|
-
machineAuthorization.acceptedClientIdsJson,
|
|
1429
|
-
AUTH_MACHINE_CLIENT_ID: machineAuthorization.clientId,
|
|
1430
|
-
AUTH_USER_POOL_ID: foundation.userPool.id,
|
|
1431
|
-
EBK_STAGE: $app.stage,
|
|
1432
|
-
EVENT_BUS_NAME: foundation.discovery.eventBusName,
|
|
1433
|
-
},
|
|
1434
|
-
handler: 'api/publish-created.handler',
|
|
1435
|
-
link: [
|
|
1436
|
-
${'keyValue.link'},
|
|
1437
|
-
foundation.eventBus,
|
|
1438
|
-
...secretLinksFor('api-publish-created'),
|
|
1439
|
-
],
|
|
1440
|
-
...lambdaLogging(eventPublisherLogs.logGroup.name),
|
|
1441
|
-
},
|
|
1442
|
-
);
|
|
1443
|
-
const machineAuthorizationProof = new sst.aws.Function(
|
|
1444
|
-
'${pascalName}MachineAuthorizationProof',
|
|
1445
|
-
{
|
|
1446
|
-
permissions: machineAuthorization.proof.permissions,
|
|
1447
|
-
environment: {
|
|
1448
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
1449
|
-
String(observability.routineSuccessSampleRate),
|
|
1450
|
-
...machineAuthorization.proof.environment,
|
|
1451
|
-
AUTH_MACHINE_PROBE_URL:
|
|
1452
|
-
$interpolate\`\${apiUrl}\${${identifierPrefix}MachineAuthorizationProof.path}\`,
|
|
1453
|
-
EBK_STAGE: $app.stage,
|
|
1454
|
-
},
|
|
1455
|
-
handler: 'authorization/machine-authorization-proof.handler',
|
|
1456
|
-
link: secretLinksFor('machine-authorization-proof'),
|
|
1457
|
-
...lambdaLogging(machineAuthorizationProofLogs.logGroup.name),
|
|
1458
|
-
},
|
|
1459
|
-
);
|
|
1460
|
-
const dataExportCleanup = new sst.aws.Function(
|
|
1461
|
-
'${pascalName}DataExportCleanup',
|
|
1462
|
-
{
|
|
1463
|
-
permissions: dataExportStore.cleanupPermissions,
|
|
1464
|
-
environment: {
|
|
1465
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
1466
|
-
String(observability.routineSuccessSampleRate),
|
|
1467
|
-
${' ...keyValue.environment,\n'}\
|
|
1468
|
-
DATA_EXPORT_BUCKET_NAME: dataExportStore.bucket.bucket,
|
|
1469
|
-
DATA_EXPORT_KMS_KEY_ARN: dataExportStore.encryptionKey.arn,
|
|
1470
|
-
EBK_STAGE: $app.stage,
|
|
1471
|
-
EBK_WORKLOAD_IDENTITY: '${name}:data-export-cleanup',
|
|
1472
|
-
},
|
|
1473
|
-
handler: 'jobs/data-export-cleanup.handler',
|
|
1474
|
-
link: [
|
|
1475
|
-
${'keyValue.link'},
|
|
1476
|
-
...secretLinksFor('data-export-cleanup'),
|
|
1477
|
-
],
|
|
1478
|
-
...lambdaLogging(dataExportCleanupLogs.logGroup.name),
|
|
1479
|
-
timeout: '5 minutes',
|
|
1480
|
-
${''}\
|
|
1481
|
-
},
|
|
1482
|
-
);
|
|
1483
|
-
const dataExportCleanupRule = new aws.cloudwatch.EventRule(
|
|
1484
|
-
'${pascalName}DataExportCleanupSchedule',
|
|
1485
|
-
{
|
|
1486
|
-
name: runtimeResourceNames.dataExportCleanupRule,
|
|
1487
|
-
description:
|
|
1488
|
-
'Hourly authoritative cleanup of expired confidential export versions.',
|
|
1489
|
-
...backgroundSchedules.exportCleanup,
|
|
1490
|
-
tags: {
|
|
1491
|
-
'ebk:management': 'standard-data-export',
|
|
1492
|
-
'ebk:slice': '${name}',
|
|
1493
|
-
'sst:stage': $app.stage,
|
|
1494
|
-
},
|
|
1495
|
-
},
|
|
1496
|
-
);
|
|
1497
|
-
const dataExportCleanupPermission = new aws.lambda.Permission(
|
|
1498
|
-
'${pascalName}DataExportCleanupPermission',
|
|
1499
|
-
{
|
|
1500
|
-
action: 'lambda:InvokeFunction',
|
|
1501
|
-
function: dataExportCleanup.arn,
|
|
1502
|
-
principal: 'events.amazonaws.com',
|
|
1503
|
-
sourceArn: dataExportCleanupRule.arn,
|
|
1504
|
-
},
|
|
1505
|
-
);
|
|
1506
|
-
const dataExportCleanupTarget = new aws.cloudwatch.EventTarget(
|
|
1507
|
-
'${pascalName}DataExportCleanupTarget',
|
|
1508
|
-
{
|
|
1509
|
-
arn: dataExportCleanup.arn,
|
|
1510
|
-
retryPolicy: {
|
|
1511
|
-
maximumEventAgeInSeconds: 3_600,
|
|
1512
|
-
maximumRetryAttempts: 185,
|
|
1513
|
-
},
|
|
1514
|
-
rule: dataExportCleanupRule.name,
|
|
1515
|
-
targetId: 'DataExportCleanup',
|
|
1516
|
-
},
|
|
1517
|
-
{ dependsOn: [dataExportCleanupPermission] },
|
|
1518
|
-
);
|
|
1519
|
-
const dataExportCleanupInvocation =
|
|
1520
|
-
new aws.lambda.FunctionEventInvokeConfig(
|
|
1521
|
-
'${pascalName}DataExportCleanupInvocation',
|
|
1522
|
-
{
|
|
1523
|
-
functionName: dataExportCleanup.arn,
|
|
1524
|
-
maximumEventAgeInSeconds: 3_600,
|
|
1525
|
-
maximumRetryAttempts: 2,
|
|
1526
|
-
},
|
|
1527
|
-
);
|
|
1528
|
-
// Generated Functions require a signed-in caller unless their composition
|
|
1529
|
-
// records them as anonymous. One JWT authorizer serves every signed-in
|
|
1530
|
-
// Function on this API and exists only once one registers. API Gateway
|
|
1531
|
-
// checks the Cognito issuer, the web or machine client id and the token
|
|
1532
|
-
// lifetime; the Function runtime then requires an access token. Each route
|
|
1533
|
-
// takes it through its Route transform, so a preview keeps the route while
|
|
1534
|
-
// the authorizer id is still unknown.
|
|
1535
|
-
let functionAuthorizer: any;
|
|
1536
|
-
const functionAccess = () => {
|
|
1537
|
-
functionAuthorizer ??= api.addAuthorizer({
|
|
1538
|
-
name: 'FunctionAccess',
|
|
1539
|
-
jwt: {
|
|
1540
|
-
issuer: $interpolate\`https://cognito-idp.\${aws.getRegionOutput({}).name}.amazonaws.com/\${foundation.userPool.id}\`,
|
|
1541
|
-
audiences: $output([
|
|
1542
|
-
authClient.id,
|
|
1543
|
-
machineAuthorization.acceptedClientIdsJson,
|
|
1544
|
-
]).apply((ids: unknown[]): string[] => {
|
|
1545
|
-
const [webClientId, machineClientIds] = ids;
|
|
1546
|
-
const parsed: unknown =
|
|
1547
|
-
typeof machineClientIds === 'string'
|
|
1548
|
-
? JSON.parse(machineClientIds)
|
|
1549
|
-
: undefined;
|
|
1550
|
-
if (
|
|
1551
|
-
ids.length !== 2 ||
|
|
1552
|
-
typeof webClientId !== 'string' ||
|
|
1553
|
-
webClientId.length === 0 ||
|
|
1554
|
-
!Array.isArray(parsed) ||
|
|
1555
|
-
parsed.length < 1 ||
|
|
1556
|
-
parsed.length > 2 ||
|
|
1557
|
-
new Set(parsed).size !== parsed.length ||
|
|
1558
|
-
parsed.some((id) => typeof id !== 'string' || id.length === 0)
|
|
1559
|
-
) {
|
|
1560
|
-
throw new Error(
|
|
1561
|
-
'Function access requires the generated web and machine client ids.',
|
|
1562
|
-
);
|
|
1563
|
-
}
|
|
1564
|
-
return [webClientId, ...(parsed as string[])];
|
|
1565
|
-
}),
|
|
1566
|
-
},
|
|
1567
|
-
});
|
|
1568
|
-
return { authorizationType: 'JWT', authorizerId: functionAuthorizer.id };
|
|
1569
62
|
};
|
|
1570
|
-
void
|
|
63
|
+
void workloadCluster;
|
|
64
|
+
${sql ? ' const database = sliceDatabase(workloadCluster);\n' : ''}
|
|
1571
65
|
// <ebk:function-registrations:start>
|
|
1572
66
|
// <ebk:function-registrations:end>
|
|
1573
|
-
|
|
1574
|
-
const eventDlq = new sst.aws.Queue('${pascalName}EventDlq', {
|
|
1575
|
-
transform: {
|
|
1576
|
-
queue: {
|
|
1577
|
-
name: runtimeResourceNames.eventDlq,
|
|
1578
|
-
messageRetentionSeconds: 14 * 24 * 60 * 60,
|
|
1579
|
-
},
|
|
1580
|
-
},
|
|
1581
|
-
});
|
|
1582
|
-
const eventQueue = new sst.aws.Queue('${pascalName}EventQueue', {
|
|
1583
|
-
dlq: { queue: eventDlq.arn, retry: 5 },
|
|
1584
|
-
transform: {
|
|
1585
|
-
queue: {
|
|
1586
|
-
name: runtimeResourceNames.eventQueue,
|
|
1587
|
-
messageRetentionSeconds: 4 * 24 * 60 * 60,
|
|
1588
|
-
visibilityTimeoutSeconds: 120,
|
|
1589
|
-
},
|
|
1590
|
-
},
|
|
1591
|
-
});
|
|
1592
|
-
const asyncRecoveryLedger = new aws.dynamodb.Table(
|
|
1593
|
-
'${pascalName}AsyncRecoveryLedger',
|
|
1594
|
-
{
|
|
1595
|
-
attributes: [{ name: 'report_digest', type: 'S' }],
|
|
1596
|
-
billingMode: 'PAY_PER_REQUEST',
|
|
1597
|
-
hashKey: 'report_digest',
|
|
1598
|
-
name: runtimeResourceNames.asyncRecoveryLedger,
|
|
1599
|
-
pointInTimeRecovery: { enabled: true },
|
|
1600
|
-
tags: {
|
|
1601
|
-
'ebk:async-recovery-ledger': 'true',
|
|
1602
|
-
'ebk:slice': '${name}',
|
|
1603
|
-
'ebk:stage': $app.stage,
|
|
1604
|
-
},
|
|
1605
|
-
ttl: {
|
|
1606
|
-
attributeName: 'expires_at_epoch_seconds',
|
|
1607
|
-
enabled: true,
|
|
1608
|
-
},
|
|
1609
|
-
},
|
|
1610
|
-
);
|
|
1611
|
-
eventQueue.subscribe({
|
|
1612
|
-
environment: {
|
|
1613
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
1614
|
-
String(observability.routineSuccessSampleRate),
|
|
1615
|
-
${' ...keyValue.environment,\n'}\
|
|
1616
|
-
EBK_STAGE: $app.stage,
|
|
1617
|
-
EBK_WORKLOAD_IDENTITY: '${name}:event-consumer',
|
|
1618
|
-
},
|
|
1619
|
-
handler: 'api/event-consumer.handler',
|
|
1620
|
-
link: [${'keyValue.link'}, ...secretLinksFor('event-consumer')],
|
|
1621
|
-
permissions: nativeAuthority.permissions('event-consumer'),
|
|
1622
|
-
...lambdaLogging(eventConsumerLogs.logGroup.name),
|
|
1623
|
-
timeout: '1 minute',
|
|
1624
|
-
${''}\
|
|
1625
|
-
}, {
|
|
1626
|
-
batch: { partialResponses: true },
|
|
1627
|
-
});
|
|
1628
|
-
foundation.eventBus.subscribeQueue(
|
|
1629
|
-
'${pascalName}CreatedEventRule',
|
|
1630
|
-
eventQueue,
|
|
1631
|
-
{
|
|
1632
|
-
pattern: {
|
|
1633
|
-
detail: { meta: { stage: [$app.stage] } },
|
|
1634
|
-
detailType: sameSliceEventDetailTypes(EventContractSchema),
|
|
1635
|
-
source: ['${name}'],
|
|
1636
|
-
},
|
|
1637
|
-
},
|
|
1638
|
-
);
|
|
1639
|
-
foundation.eventBus.subscribeQueue(
|
|
1640
|
-
'${pascalName}DataLifecycleChangedRule',
|
|
1641
|
-
eventQueue,
|
|
1642
|
-
{
|
|
1643
|
-
pattern: {
|
|
1644
|
-
detail: { meta: { stage: [$app.stage] } },
|
|
1645
|
-
detailType: ['DataLifecycleChanged'],
|
|
1646
|
-
source: [...lifecycleConsumers.acceptedSources],
|
|
1647
|
-
},
|
|
1648
|
-
},
|
|
1649
|
-
);
|
|
1650
|
-
// One rule per declared foreign source: EventBridge ORs values within a
|
|
1651
|
-
// field and ANDs fields, so a merged rule would cross-match sources and types.
|
|
1652
|
-
for (const subscription of crossSliceSubscriptions) {
|
|
1653
|
-
foundation.eventBus.subscribeQueue(
|
|
1654
|
-
subscription.ruleName,
|
|
1655
|
-
eventQueue,
|
|
1656
|
-
{
|
|
1657
|
-
pattern: {
|
|
1658
|
-
detail: {
|
|
1659
|
-
meta: {
|
|
1660
|
-
schemaVersion: [...subscription.schemaVersions],
|
|
1661
|
-
stage: [$app.stage],
|
|
1662
|
-
},
|
|
1663
|
-
},
|
|
1664
|
-
detailType: [...subscription.detailTypes],
|
|
1665
|
-
source: [subscription.source],
|
|
1666
|
-
},
|
|
1667
|
-
},
|
|
1668
|
-
);
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
|
-
const eventConsumerAlarmDefinition = defineEventConsumerAlarms({
|
|
1672
|
-
consumer: '${pascalName}Created',
|
|
1673
|
-
dlqName: 'event-dlq',
|
|
1674
|
-
queueName: 'event-queue',
|
|
1675
|
-
slice: '${name}',
|
|
1676
|
-
stage: $app.stage,
|
|
1677
|
-
}).alarms.find(({ severity }) => severity === 'critical');
|
|
1678
|
-
if (!eventConsumerAlarmDefinition) {
|
|
1679
|
-
throw new Error('Generated event-consumer DLQ alarm definition is missing.');
|
|
1680
|
-
}
|
|
1681
|
-
const dlqAlarm = new aws.cloudwatch.MetricAlarm('${pascalName}EventDlqDepth', {
|
|
1682
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
1683
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'event-dlq-depth', ' ')}),
|
|
1684
|
-
name: '${name}-' + $app.stage + '-event-dlq-depth',
|
|
1685
|
-
comparisonOperator: eventConsumerAlarmDefinition.comparisonOperator,
|
|
1686
|
-
dimensions: { QueueName: physicalQueueName(eventDlq) },
|
|
1687
|
-
evaluationPeriods: eventConsumerAlarmDefinition.evaluationPeriods,
|
|
1688
|
-
metricName: eventConsumerAlarmDefinition.metricName,
|
|
1689
|
-
namespace: eventConsumerAlarmDefinition.namespace,
|
|
1690
|
-
period: 300,
|
|
1691
|
-
statistic: 'Maximum',
|
|
1692
|
-
threshold: eventConsumerAlarmDefinition.threshold,
|
|
1693
|
-
treatMissingData: 'notBreaching',
|
|
1694
|
-
});
|
|
1695
|
-
const asyncTargetDlq = new sst.aws.Queue(
|
|
1696
|
-
'${pascalName}AsyncTargetDlq',
|
|
1697
|
-
{
|
|
1698
|
-
transform: {
|
|
1699
|
-
queue: {
|
|
1700
|
-
name: runtimeResourceNames.asyncTargetDlq,
|
|
1701
|
-
messageRetentionSeconds: 14 * 24 * 60 * 60,
|
|
1702
|
-
tags: {
|
|
1703
|
-
'ebk:async-recovery-source': 'async-target-dlq',
|
|
1704
|
-
'ebk:slice': '${name}',
|
|
1705
|
-
'ebk:stage': $app.stage,
|
|
1706
|
-
},
|
|
1707
|
-
},
|
|
1708
|
-
},
|
|
1709
|
-
},
|
|
1710
|
-
);
|
|
1711
|
-
const providerDlq = new sst.aws.Queue('${pascalName}ProviderDlq', {
|
|
1712
|
-
transform: {
|
|
1713
|
-
queue: {
|
|
1714
|
-
name: runtimeResourceNames.providerDlq,
|
|
1715
|
-
messageRetentionSeconds: 14 * 24 * 60 * 60,
|
|
1716
|
-
tags: {
|
|
1717
|
-
'ebk:async-recovery-source': 'provider-dlq',
|
|
1718
|
-
'ebk:slice': '${name}',
|
|
1719
|
-
'ebk:stage': $app.stage,
|
|
1720
|
-
},
|
|
1721
|
-
},
|
|
1722
|
-
},
|
|
1723
|
-
});
|
|
1724
|
-
const providerQueue = new sst.aws.Queue('${pascalName}ProviderQueue', {
|
|
1725
|
-
dlq: { queue: providerDlq.arn, retry: 5 },
|
|
1726
|
-
transform: {
|
|
1727
|
-
queue: {
|
|
1728
|
-
name: runtimeResourceNames.providerQueue,
|
|
1729
|
-
messageRetentionSeconds: 4 * 24 * 60 * 60,
|
|
1730
|
-
tags: {
|
|
1731
|
-
'ebk:async-recovery-destination': 'provider-queue',
|
|
1732
|
-
'ebk:slice': '${name}',
|
|
1733
|
-
'ebk:stage': $app.stage,
|
|
1734
|
-
},
|
|
1735
|
-
visibilityTimeoutSeconds: 120,
|
|
1736
|
-
},
|
|
1737
|
-
},
|
|
1738
|
-
});
|
|
1739
|
-
const reliability = create${pascalName}Reliability({
|
|
1740
|
-
alertTopicArn: foundation.discovery.alertTopicArn,
|
|
1741
|
-
alertTopicName: foundation.discovery.alertTopicArn.apply(
|
|
1742
|
-
(alertTopicArn: string) => alertTopicArn.split(':').at(-1) ?? '',
|
|
1743
|
-
),
|
|
1744
|
-
apiId: api.nodes.api.id,
|
|
1745
|
-
${' databaseTableName: keyValue.table.name,\n'}\
|
|
1746
|
-
functionName: dataExportCleanup.name,
|
|
1747
|
-
providerQueueName: physicalQueueName(providerQueue),
|
|
1748
|
-
});
|
|
1749
|
-
const providerDlqAlarm = new aws.cloudwatch.MetricAlarm(
|
|
1750
|
-
'${pascalName}ProviderDlqDepth',
|
|
1751
|
-
{
|
|
1752
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
1753
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'provider-dlq-depth', ' ')}),
|
|
1754
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
1755
|
-
dimensions: { QueueName: physicalQueueName(providerDlq) },
|
|
1756
|
-
evaluationPeriods: 1,
|
|
1757
|
-
metricName: 'ApproximateNumberOfMessagesVisible',
|
|
1758
|
-
name: '${name}-' + $app.stage + '-provider-dlq-depth',
|
|
1759
|
-
namespace: 'AWS/SQS',
|
|
1760
|
-
period: 300,
|
|
1761
|
-
statistic: 'Maximum',
|
|
1762
|
-
threshold: 1,
|
|
1763
|
-
treatMissingData: 'notBreaching',
|
|
1764
|
-
},
|
|
1765
|
-
);
|
|
1766
|
-
const asyncTargetDlqAlarm = new aws.cloudwatch.MetricAlarm(
|
|
1767
|
-
'${pascalName}AsyncTargetDlqDepth',
|
|
1768
|
-
{
|
|
1769
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
1770
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'async-target-dlq-depth', ' ')}),
|
|
1771
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
1772
|
-
dimensions: { QueueName: physicalQueueName(asyncTargetDlq) },
|
|
1773
|
-
evaluationPeriods: 1,
|
|
1774
|
-
metricName: 'ApproximateNumberOfMessagesVisible',
|
|
1775
|
-
name: '${name}-' + $app.stage + '-async-target-dlq-depth',
|
|
1776
|
-
namespace: 'AWS/SQS',
|
|
1777
|
-
period: 300,
|
|
1778
|
-
statistic: 'Maximum',
|
|
1779
|
-
threshold: 1,
|
|
1780
|
-
treatMissingData: 'notBreaching',
|
|
1781
|
-
},
|
|
1782
|
-
);
|
|
1783
|
-
const runtimeConfiguration = protectedStage && !$dev
|
|
1784
|
-
? (() => {
|
|
1785
|
-
const monitorRole = nativeAuthority.createAppConfigMonitorRole(
|
|
1786
|
-
'${pascalName}ConfigurationMonitorRole',
|
|
1787
|
-
);
|
|
1788
|
-
const application = new aws.appconfig.Application(
|
|
1789
|
-
'${pascalName}ConfigurationApplication',
|
|
1790
|
-
{
|
|
1791
|
-
description: '${name} Slice-owned runtime configuration.',
|
|
1792
|
-
name: 'ebk-${name}-' + $app.stage,
|
|
1793
|
-
tags: {
|
|
1794
|
-
'ebk:slice': '${name}',
|
|
1795
|
-
'ebk:stage': $app.stage,
|
|
1796
|
-
},
|
|
1797
|
-
},
|
|
1798
|
-
);
|
|
1799
|
-
const environment = new aws.appconfig.Environment(
|
|
1800
|
-
'${pascalName}ConfigurationEnvironment',
|
|
1801
|
-
{
|
|
1802
|
-
applicationId: application.id,
|
|
1803
|
-
description:
|
|
1804
|
-
'${name} ' + $app.stage + ' runtime configuration.',
|
|
1805
|
-
monitors: [
|
|
1806
|
-
reliability.apiFastBurn,
|
|
1807
|
-
asyncTargetDlqAlarm,
|
|
1808
|
-
dlqAlarm,
|
|
1809
|
-
providerDlqAlarm,
|
|
1810
|
-
reliability.providerDeadline,
|
|
1811
|
-
].map((alarm) => ({
|
|
1812
|
-
alarmArn: alarm.arn,
|
|
1813
|
-
alarmRoleArn: monitorRole.arn,
|
|
1814
|
-
})),
|
|
1815
|
-
name: $app.stage,
|
|
1816
|
-
tags: {
|
|
1817
|
-
'ebk:slice': '${name}',
|
|
1818
|
-
'ebk:stage': $app.stage,
|
|
1819
|
-
},
|
|
1820
|
-
},
|
|
1821
|
-
);
|
|
1822
|
-
const profile = new aws.appconfig.ConfigurationProfile(
|
|
1823
|
-
'${pascalName}ConfigurationProfile',
|
|
1824
|
-
{
|
|
1825
|
-
applicationId: application.id,
|
|
1826
|
-
locationUri: 'hosted',
|
|
1827
|
-
name: 'runtime',
|
|
1828
|
-
tags: {
|
|
1829
|
-
'ebk:slice': '${name}',
|
|
1830
|
-
'ebk:stage': $app.stage,
|
|
1831
|
-
},
|
|
1832
|
-
type: 'AWS.Freeform',
|
|
1833
|
-
validators: [{
|
|
1834
|
-
content: JSON.stringify({
|
|
1835
|
-
additionalProperties: false,
|
|
1836
|
-
properties: {
|
|
1837
|
-
schemaVersion: { const: 1 },
|
|
1838
|
-
values: {
|
|
1839
|
-
additionalProperties: false,
|
|
1840
|
-
properties: Object.fromEntries(
|
|
1841
|
-
ConfigurationDeclarations.map((declaration) => [
|
|
1842
|
-
declaration.key,
|
|
1843
|
-
declaration.validation.type === 'number'
|
|
1844
|
-
? {
|
|
1845
|
-
...(declaration.validation.integer
|
|
1846
|
-
? { type: 'integer' }
|
|
1847
|
-
: { type: 'number' }),
|
|
1848
|
-
...(declaration.validation.maximum === undefined
|
|
1849
|
-
? {}
|
|
1850
|
-
: {
|
|
1851
|
-
maximum:
|
|
1852
|
-
declaration.validation.maximum,
|
|
1853
|
-
}),
|
|
1854
|
-
...(declaration.validation.minimum === undefined
|
|
1855
|
-
? {}
|
|
1856
|
-
: {
|
|
1857
|
-
minimum:
|
|
1858
|
-
declaration.validation.minimum,
|
|
1859
|
-
}),
|
|
1860
|
-
}
|
|
1861
|
-
: declaration.validation,
|
|
1862
|
-
]),
|
|
1863
|
-
),
|
|
1864
|
-
required: ConfigurationDeclarations.map(
|
|
1865
|
-
({ key }) => key,
|
|
1866
|
-
),
|
|
1867
|
-
type: 'object',
|
|
1868
|
-
},
|
|
1869
|
-
},
|
|
1870
|
-
required: ['schemaVersion', 'values'],
|
|
1871
|
-
type: 'object',
|
|
1872
|
-
}),
|
|
1873
|
-
type: 'JSON_SCHEMA',
|
|
1874
|
-
}],
|
|
1875
|
-
},
|
|
1876
|
-
);
|
|
1877
|
-
const version = new aws.appconfig.HostedConfigurationVersion(
|
|
1878
|
-
'${pascalName}ConfigurationVersion',
|
|
1879
|
-
{
|
|
1880
|
-
applicationId: application.id,
|
|
1881
|
-
configurationProfileId: profile.configurationProfileId,
|
|
1882
|
-
content: JSON.stringify(localConfiguration),
|
|
1883
|
-
contentType: 'application/json',
|
|
1884
|
-
description:
|
|
1885
|
-
'${name} immutable generated default configuration.',
|
|
1886
|
-
},
|
|
1887
|
-
);
|
|
1888
|
-
const deploymentStrategy =
|
|
1889
|
-
new aws.appconfig.DeploymentStrategy(
|
|
1890
|
-
'${pascalName}ConfigurationDeploymentStrategy',
|
|
1891
|
-
{
|
|
1892
|
-
deploymentDurationInMinutes: 10,
|
|
1893
|
-
description:
|
|
1894
|
-
'${name} bounded linear runtime configuration rollout.',
|
|
1895
|
-
finalBakeTimeInMinutes: 10,
|
|
1896
|
-
growthFactor: 10,
|
|
1897
|
-
growthType: 'LINEAR',
|
|
1898
|
-
name:
|
|
1899
|
-
'ebk-${name}-bounded-linear-' + $app.stage,
|
|
1900
|
-
replicateTo: 'NONE',
|
|
1901
|
-
tags: {
|
|
1902
|
-
'ebk:slice': '${name}',
|
|
1903
|
-
'ebk:stage': $app.stage,
|
|
1904
|
-
},
|
|
1905
|
-
},
|
|
1906
|
-
);
|
|
1907
|
-
const deployment = new aws.appconfig.Deployment(
|
|
1908
|
-
'${pascalName}ConfigurationDeployment',
|
|
1909
|
-
{
|
|
1910
|
-
applicationId: application.id,
|
|
1911
|
-
configurationProfileId: profile.configurationProfileId,
|
|
1912
|
-
configurationVersion: version.versionNumber.apply(String),
|
|
1913
|
-
deploymentStrategyId: deploymentStrategy.id,
|
|
1914
|
-
description:
|
|
1915
|
-
'${name} generated default configuration deployment.',
|
|
1916
|
-
environmentId: environment.environmentId,
|
|
1917
|
-
},
|
|
1918
|
-
);
|
|
1919
|
-
return {
|
|
1920
|
-
application,
|
|
1921
|
-
deployment,
|
|
1922
|
-
deploymentStrategy,
|
|
1923
|
-
environment,
|
|
1924
|
-
profile,
|
|
1925
|
-
version,
|
|
1926
|
-
};
|
|
1927
|
-
})()
|
|
1928
|
-
: undefined;
|
|
1929
|
-
const configurationApplication = runtimeConfiguration?.application;
|
|
1930
|
-
const configurationDeployment = runtimeConfiguration?.deployment;
|
|
1931
|
-
const configurationDeploymentStrategy =
|
|
1932
|
-
runtimeConfiguration?.deploymentStrategy;
|
|
1933
|
-
const configurationEnvironment = runtimeConfiguration?.environment;
|
|
1934
|
-
const configurationProfile = runtimeConfiguration?.profile;
|
|
1935
|
-
const configurationVersion = runtimeConfiguration?.version;
|
|
1936
|
-
const runtimeConfigurationEnvironment = runtimeConfiguration
|
|
1937
|
-
? {
|
|
1938
|
-
EBK_APPCONFIG_APPLICATION_ID:
|
|
1939
|
-
runtimeConfiguration.application.id,
|
|
1940
|
-
EBK_APPCONFIG_ENVIRONMENT_ID:
|
|
1941
|
-
runtimeConfiguration.environment.environmentId,
|
|
1942
|
-
EBK_APPCONFIG_PROFILE_ID:
|
|
1943
|
-
runtimeConfiguration.profile.configurationProfileId,
|
|
1944
|
-
}
|
|
1945
|
-
: {};
|
|
1946
67
|
// <ebk:workload-registrations:start>
|
|
1947
68
|
// <ebk:workload-registrations:end>
|
|
1948
69
|
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
{
|
|
1955
|
-
environment: {
|
|
1956
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
1957
|
-
String(observability.routineSuccessSampleRate),
|
|
1958
|
-
${' ...keyValue.environment,\n'}\
|
|
1959
|
-
EBK_STAGE: $app.stage,
|
|
1960
|
-
EBK_WORKLOAD_IDENTITY: '${name}:async-provider-worker',
|
|
1961
|
-
EBK_WORKSPACE: '${workspace}',
|
|
1962
|
-
...runtimeConfigurationEnvironment,
|
|
1963
|
-
},
|
|
1964
|
-
handler: 'async/provider-worker.handler',
|
|
1965
|
-
link: [
|
|
1966
|
-
${'keyValue.link'},
|
|
1967
|
-
providerQueue,
|
|
1968
|
-
...secretLinksFor('async-provider-worker'),
|
|
1969
|
-
],
|
|
1970
|
-
permissions: nativeAuthority.permissions('async-provider-worker'),
|
|
1971
|
-
...lambdaLogging(asyncProviderWorkerLogs.logGroup.name),
|
|
1972
|
-
timeout: '1 minute',
|
|
1973
|
-
${''}\
|
|
1974
|
-
},
|
|
1975
|
-
{
|
|
1976
|
-
batch: { partialResponses: true },
|
|
1977
|
-
},
|
|
1978
|
-
configurationDeployment
|
|
1979
|
-
? { dependsOn: [configurationDeployment] }
|
|
1980
|
-
: {},
|
|
1981
|
-
);
|
|
1982
|
-
api.route('POST /${name}/webhooks/provider', {
|
|
1983
|
-
permissions: nativeAuthority.permissions('async-webhook-ingress'),
|
|
1984
|
-
environment: {
|
|
1985
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
1986
|
-
String(observability.routineSuccessSampleRate),
|
|
1987
|
-
EBK_ASYNC_LEDGER_TABLE: asyncRecoveryLedger.name,
|
|
1988
|
-
EBK_STAGE: $app.stage,
|
|
1989
|
-
EBK_WORKLOAD_IDENTITY: '${name}:async-webhook-ingress',
|
|
1990
|
-
EBK_WORKSPACE: '${workspace}',
|
|
1991
|
-
},
|
|
1992
|
-
handler: 'async/webhook-ingress.handler',
|
|
1993
|
-
link: [
|
|
1994
|
-
providerQueue,
|
|
1995
|
-
...secretLinksFor('async-webhook-ingress'),
|
|
1996
|
-
],
|
|
1997
|
-
...lambdaLogging(asyncWebhookIngressLogs.logGroup.name),
|
|
1998
|
-
timeout: '10 seconds',
|
|
1999
|
-
});
|
|
2000
|
-
}
|
|
2001
|
-
const asyncOutboxRelay = new sst.aws.Function(
|
|
2002
|
-
'${pascalName}AsyncOutboxRelay',
|
|
2003
|
-
{
|
|
2004
|
-
permissions: nativeAuthority.permissions('async-outbox-relay'),
|
|
2005
|
-
environment: {
|
|
2006
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
2007
|
-
String(observability.routineSuccessSampleRate),
|
|
2008
|
-
${' ...keyValue.environment,\n'}\
|
|
2009
|
-
${''}\
|
|
2010
|
-
EBK_STAGE: $app.stage,
|
|
2011
|
-
EBK_WORKLOAD_IDENTITY: '${name}:async-outbox-relay',
|
|
2012
|
-
EBK_WORKSPACE: '${workspace}',
|
|
2013
|
-
EVENT_BUS_NAME: foundation.discovery.eventBusName,
|
|
2014
|
-
},
|
|
2015
|
-
handler: 'async/outbox-relay.handler',
|
|
2016
|
-
link: [
|
|
2017
|
-
${'keyValue.link'},
|
|
2018
|
-
foundation.eventBus,
|
|
2019
|
-
...secretLinksFor('async-outbox-relay'),
|
|
2020
|
-
],
|
|
2021
|
-
...lambdaLogging(asyncOutboxRelayLogs.logGroup.name),
|
|
2022
|
-
timeout: '1 minute',
|
|
2023
|
-
${''}\
|
|
2024
|
-
},
|
|
2025
|
-
);
|
|
2026
|
-
${sql
|
|
2027
|
-
? ` const sqlOutbox = createSqlOutboxInfrastructure({
|
|
2028
|
-
workspace: '${workspace}',
|
|
2029
|
-
database, eventBus: foundation.eventBus, eventBusName: foundation.discovery.eventBusName,
|
|
2030
|
-
secretLinks: secretLinksFor('async-outbox-relay'),
|
|
2031
|
-
vpc: foundation.vpc, schedule: backgroundSchedules.sqlOutboxRecovery,
|
|
2032
|
-
alertTopicArn: foundation.discovery.alertTopicArn,
|
|
2033
|
-
managedLogGroup, lambdaLogging,
|
|
2034
|
-
${''}\
|
|
2035
|
-
});
|
|
2036
|
-
const sqlOutboxRelayErrorAlarm = new aws.cloudwatch.MetricAlarm(
|
|
2037
|
-
'${pascalName}SqlOutboxRelayErrors',
|
|
2038
|
-
{
|
|
2039
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
2040
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'sql-outbox-relay-errors', ' ')}),
|
|
2041
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
2042
|
-
dimensions: { FunctionName: sqlOutbox.relay.name },
|
|
2043
|
-
evaluationPeriods: 1,
|
|
2044
|
-
metricName: 'Errors',
|
|
2045
|
-
name: '${name}-' + $app.stage + '-sql-outbox-relay-errors',
|
|
2046
|
-
namespace: 'AWS/Lambda',
|
|
2047
|
-
period: 300,
|
|
2048
|
-
statistic: 'Sum',
|
|
2049
|
-
threshold: 1,
|
|
2050
|
-
treatMissingData: 'notBreaching',
|
|
2051
|
-
},
|
|
2052
|
-
);
|
|
2053
|
-
// The relay counts every unpublished intent; Minimum ignores healthy
|
|
2054
|
-
// in-flight batches and alarms only when no run in an hour drained it.
|
|
2055
|
-
const sqlOutboxBacklogAlarm = new aws.cloudwatch.MetricAlarm(
|
|
2056
|
-
'${pascalName}SqlOutboxBacklog',
|
|
2057
|
-
{
|
|
2058
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
2059
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'sql-outbox-backlog', ' ')}),
|
|
2060
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
2061
|
-
dimensions: { Slice: '${name}', Stage: $app.stage },
|
|
2062
|
-
evaluationPeriods: 2,
|
|
2063
|
-
metricName: 'SqlOutboxBacklog',
|
|
2064
|
-
name: '${name}-' + $app.stage + '-sql-outbox-backlog',
|
|
2065
|
-
namespace: 'EBK/Async',
|
|
2066
|
-
period: 3600,
|
|
2067
|
-
statistic: 'Minimum',
|
|
2068
|
-
threshold: 1,
|
|
2069
|
-
treatMissingData: 'notBreaching',
|
|
2070
|
-
},
|
|
2071
|
-
);
|
|
2072
|
-
const sqlOutboxAttemptsAlarm = new aws.cloudwatch.MetricAlarm(
|
|
2073
|
-
'${pascalName}SqlOutboxAttempts',
|
|
2074
|
-
{
|
|
2075
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
2076
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'sql-outbox-attempts', ' ')}),
|
|
2077
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
2078
|
-
dimensions: { Slice: '${name}', Stage: $app.stage },
|
|
2079
|
-
evaluationPeriods: 1,
|
|
2080
|
-
metricName: 'SqlOutboxMaxAttempts',
|
|
2081
|
-
name: '${name}-' + $app.stage + '-sql-outbox-attempts',
|
|
2082
|
-
namespace: 'EBK/Async',
|
|
2083
|
-
period: 3600,
|
|
2084
|
-
statistic: 'Maximum',
|
|
2085
|
-
threshold: 10,
|
|
2086
|
-
treatMissingData: 'notBreaching',
|
|
2087
|
-
},
|
|
2088
|
-
);
|
|
2089
|
-
`
|
|
2090
|
-
: ''}\
|
|
2091
|
-
const asyncInboxCleanup = new sst.aws.Function(
|
|
2092
|
-
'${pascalName}AsyncInboxCleanup',
|
|
2093
|
-
{
|
|
2094
|
-
permissions: nativeAuthority.permissions('async-inbox-cleanup'),
|
|
2095
|
-
environment: {
|
|
2096
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
2097
|
-
String(observability.routineSuccessSampleRate),
|
|
2098
|
-
${' ...keyValue.environment,\n'}\
|
|
2099
|
-
EBK_STAGE: $app.stage,
|
|
2100
|
-
EBK_WORKLOAD_IDENTITY: '${name}:async-inbox-cleanup',
|
|
2101
|
-
EBK_WORKSPACE: '${workspace}',
|
|
2102
|
-
},
|
|
2103
|
-
handler: 'async/inbox-cleanup.handler',
|
|
2104
|
-
link: [
|
|
2105
|
-
${'keyValue.link'},
|
|
2106
|
-
...secretLinksFor('async-inbox-cleanup'),
|
|
2107
|
-
],
|
|
2108
|
-
...lambdaLogging(asyncInboxCleanupLogs.logGroup.name),
|
|
2109
|
-
timeout: '5 minutes',
|
|
2110
|
-
${''}\
|
|
2111
|
-
},
|
|
2112
|
-
);
|
|
2113
|
-
const asyncScheduleTarget = new sst.aws.Function(
|
|
2114
|
-
'${pascalName}AsyncScheduleTarget',
|
|
2115
|
-
{
|
|
2116
|
-
permissions: nativeAuthority.permissions('async-schedule-target'),
|
|
2117
|
-
environment: {
|
|
2118
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
2119
|
-
String(observability.routineSuccessSampleRate),
|
|
2120
|
-
EBK_STAGE: $app.stage,
|
|
2121
|
-
EBK_WORKLOAD_IDENTITY: '${name}:async-schedule-target',
|
|
2122
|
-
EBK_WORKSPACE: '${workspace}',
|
|
2123
|
-
},
|
|
2124
|
-
handler: 'async/schedule-target.handler',
|
|
2125
|
-
link: [providerQueue, ...secretLinksFor('async-schedule-target')],
|
|
2126
|
-
...lambdaLogging(asyncScheduleTargetLogs.logGroup.name),
|
|
2127
|
-
timeout: '30 seconds',
|
|
2128
|
-
},
|
|
2129
|
-
);
|
|
2130
|
-
const asyncWorkflowTask = new sst.aws.Function(
|
|
2131
|
-
'${pascalName}AsyncWorkflowTask',
|
|
2132
|
-
{
|
|
2133
|
-
permissions: nativeAuthority.permissions('async-workflow-task'),
|
|
2134
|
-
environment: {
|
|
2135
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
2136
|
-
String(observability.routineSuccessSampleRate),
|
|
2137
|
-
EBK_ASYNC_LEDGER_TABLE: asyncRecoveryLedger.name,
|
|
2138
|
-
EBK_STAGE: $app.stage,
|
|
2139
|
-
EBK_WORKLOAD_IDENTITY: '${name}:async-workflow-task',
|
|
2140
|
-
EBK_WORKSPACE: '${workspace}',
|
|
2141
|
-
},
|
|
2142
|
-
handler: 'async/workflow-task.handler',
|
|
2143
|
-
link: secretLinksFor('async-workflow-task'),
|
|
2144
|
-
...lambdaLogging(
|
|
2145
|
-
asyncWorkflowTaskLogs.logGroup.name,
|
|
2146
|
-
runtimeResourceNames.workflowTaskFunction,
|
|
2147
|
-
),
|
|
2148
|
-
timeout: '15 minutes',
|
|
2149
|
-
},
|
|
2150
|
-
);
|
|
2151
|
-
const providerReconciliationRule = new aws.cloudwatch.EventRule(
|
|
2152
|
-
'${pascalName}ProviderReconciliationSchedule',
|
|
2153
|
-
{
|
|
2154
|
-
description:
|
|
2155
|
-
'Versioned provider reconciliation schedule activated only with configured adapters.',
|
|
2156
|
-
scheduleExpression: 'rate(15 minutes)',
|
|
2157
|
-
state: asyncAdaptersConfigured ? 'ENABLED' : 'DISABLED',
|
|
2158
|
-
tags: {
|
|
2159
|
-
'ebk:slice': '${name}',
|
|
2160
|
-
'ebk:stage': $app.stage,
|
|
2161
|
-
},
|
|
2162
|
-
},
|
|
2163
|
-
);
|
|
2164
|
-
const outboxRelayRule = new aws.cloudwatch.EventRule(
|
|
2165
|
-
'${pascalName}OutboxRelaySchedule',
|
|
2166
|
-
{
|
|
2167
|
-
description:
|
|
2168
|
-
'Durable DynamoDB outbox relay; cadence and pause are independent of SQL capacity.',
|
|
2169
|
-
...backgroundSchedules.outbox,
|
|
2170
|
-
tags: {
|
|
2171
|
-
'ebk:slice': '${name}',
|
|
2172
|
-
'ebk:stage': $app.stage,
|
|
2173
|
-
},
|
|
2174
|
-
},
|
|
2175
|
-
);
|
|
2176
|
-
const inboxCleanupRule = new aws.cloudwatch.EventRule(
|
|
2177
|
-
'${pascalName}AsyncInboxCleanupSchedule',
|
|
2178
|
-
{
|
|
2179
|
-
description:
|
|
2180
|
-
'Bounded cleanup of expired async inbox idempotency records.',
|
|
2181
|
-
...backgroundSchedules.inboxCleanup,
|
|
2182
|
-
tags: {
|
|
2183
|
-
'ebk:slice': '${name}',
|
|
2184
|
-
'ebk:stage': $app.stage,
|
|
2185
|
-
},
|
|
2186
|
-
},
|
|
2187
|
-
);
|
|
2188
|
-
const providerReconciliationPermission = new aws.lambda.Permission(
|
|
2189
|
-
'${pascalName}ProviderReconciliationPermission',
|
|
2190
|
-
{
|
|
2191
|
-
action: 'lambda:InvokeFunction',
|
|
2192
|
-
function: asyncScheduleTarget.arn,
|
|
2193
|
-
principal: 'events.amazonaws.com',
|
|
2194
|
-
sourceArn: providerReconciliationRule.arn,
|
|
2195
|
-
},
|
|
2196
|
-
);
|
|
2197
|
-
const outboxRelayPermission = new aws.lambda.Permission(
|
|
2198
|
-
'${pascalName}OutboxRelayPermission',
|
|
2199
|
-
{
|
|
2200
|
-
action: 'lambda:InvokeFunction',
|
|
2201
|
-
function: asyncOutboxRelay.arn,
|
|
2202
|
-
principal: 'events.amazonaws.com',
|
|
2203
|
-
sourceArn: outboxRelayRule.arn,
|
|
2204
|
-
},
|
|
2205
|
-
);
|
|
2206
|
-
const inboxCleanupPermission = new aws.lambda.Permission(
|
|
2207
|
-
'${pascalName}AsyncInboxCleanupPermission',
|
|
2208
|
-
{
|
|
2209
|
-
action: 'lambda:InvokeFunction',
|
|
2210
|
-
function: asyncInboxCleanup.arn,
|
|
2211
|
-
principal: 'events.amazonaws.com',
|
|
2212
|
-
sourceArn: inboxCleanupRule.arn,
|
|
2213
|
-
},
|
|
2214
|
-
);
|
|
2215
|
-
const asyncTargetDlqPolicy = new aws.sqs.QueuePolicy(
|
|
2216
|
-
'${pascalName}AsyncTargetDlqPolicy',
|
|
2217
|
-
{
|
|
2218
|
-
policy: aws.iam.getPolicyDocumentOutput({
|
|
2219
|
-
statements: [{
|
|
2220
|
-
actions: ['sqs:SendMessage'],
|
|
2221
|
-
conditions: [{
|
|
2222
|
-
test: 'ArnEquals',
|
|
2223
|
-
values: [
|
|
2224
|
-
inboxCleanupRule.arn,
|
|
2225
|
-
providerReconciliationRule.arn,
|
|
2226
|
-
outboxRelayRule.arn,
|
|
2227
|
-
],
|
|
2228
|
-
variable: 'aws:SourceArn',
|
|
2229
|
-
}],
|
|
2230
|
-
principals: [{
|
|
2231
|
-
identifiers: ['events.amazonaws.com'],
|
|
2232
|
-
type: 'Service',
|
|
2233
|
-
}],
|
|
2234
|
-
resources: [asyncTargetDlq.arn],
|
|
2235
|
-
}],
|
|
2236
|
-
}).json,
|
|
2237
|
-
queueUrl: asyncTargetDlq.url,
|
|
2238
|
-
},
|
|
2239
|
-
);
|
|
2240
|
-
const providerReconciliationTarget = new aws.cloudwatch.EventTarget(
|
|
2241
|
-
'${pascalName}ProviderReconciliationTarget',
|
|
2242
|
-
{
|
|
2243
|
-
arn: asyncScheduleTarget.arn,
|
|
2244
|
-
deadLetterConfig: { arn: asyncTargetDlq.arn },
|
|
2245
|
-
retryPolicy: {
|
|
2246
|
-
maximumEventAgeInSeconds: 900,
|
|
2247
|
-
maximumRetryAttempts: 2,
|
|
2248
|
-
},
|
|
2249
|
-
rule: providerReconciliationRule.name,
|
|
2250
|
-
targetId: 'ProviderReconciliation',
|
|
2251
|
-
},
|
|
2252
|
-
{
|
|
2253
|
-
dependsOn: [
|
|
2254
|
-
asyncTargetDlqPolicy,
|
|
2255
|
-
providerReconciliationPermission,
|
|
2256
|
-
],
|
|
2257
|
-
},
|
|
2258
|
-
);
|
|
2259
|
-
const outboxRelayTarget = new aws.cloudwatch.EventTarget(
|
|
2260
|
-
'${pascalName}OutboxRelayTarget',
|
|
2261
|
-
{
|
|
2262
|
-
arn: asyncOutboxRelay.arn,
|
|
2263
|
-
deadLetterConfig: { arn: asyncTargetDlq.arn },
|
|
2264
|
-
retryPolicy: {
|
|
2265
|
-
maximumEventAgeInSeconds: 300,
|
|
2266
|
-
maximumRetryAttempts: 2,
|
|
2267
|
-
},
|
|
2268
|
-
rule: outboxRelayRule.name,
|
|
2269
|
-
targetId: 'OutboxRelay',
|
|
2270
|
-
},
|
|
2271
|
-
{ dependsOn: [asyncTargetDlqPolicy, outboxRelayPermission] },
|
|
2272
|
-
);
|
|
2273
|
-
const inboxCleanupTarget = new aws.cloudwatch.EventTarget(
|
|
2274
|
-
'${pascalName}AsyncInboxCleanupTarget',
|
|
2275
|
-
{
|
|
2276
|
-
arn: asyncInboxCleanup.arn,
|
|
2277
|
-
deadLetterConfig: { arn: asyncTargetDlq.arn },
|
|
2278
|
-
retryPolicy: {
|
|
2279
|
-
maximumEventAgeInSeconds: 3600,
|
|
2280
|
-
maximumRetryAttempts: 2,
|
|
2281
|
-
},
|
|
2282
|
-
rule: inboxCleanupRule.name,
|
|
2283
|
-
targetId: 'AsyncInboxCleanup',
|
|
2284
|
-
},
|
|
2285
|
-
{ dependsOn: [asyncTargetDlqPolicy, inboxCleanupPermission] },
|
|
2286
|
-
);
|
|
2287
|
-
let recordExportWorkflow: any;
|
|
2288
|
-
if (!$dev && asyncAdaptersConfigured) {
|
|
2289
|
-
const recordExportWorkflowRole = nativeAuthority.createStepFunctionsRole(
|
|
2290
|
-
'${pascalName}RecordExportWorkflowRole',
|
|
2291
|
-
'async-workflow-orchestration',
|
|
2292
|
-
);
|
|
2293
|
-
recordExportWorkflow = new aws.sfn.StateMachine(
|
|
2294
|
-
'${pascalName}RecordExportWorkflow',
|
|
2295
|
-
{
|
|
2296
|
-
definition: $jsonStringify({
|
|
2297
|
-
Comment: 'Versioned record export with cooperative cancellation and compensation.',
|
|
2298
|
-
StartAt: 'RequireVersionOne',
|
|
2299
|
-
TimeoutSeconds: 86_400,
|
|
2300
|
-
States: {
|
|
2301
|
-
RequireVersionOne: {
|
|
2302
|
-
Choices: [{
|
|
2303
|
-
Next: 'CreateExport',
|
|
2304
|
-
NumericEquals: 1,
|
|
2305
|
-
Variable: '$.workflowVersion',
|
|
2306
|
-
}],
|
|
2307
|
-
Default: 'UnsupportedVersion',
|
|
2308
|
-
Type: 'Choice',
|
|
2309
|
-
},
|
|
2310
|
-
CreateExport: {
|
|
2311
|
-
Catch: [
|
|
2312
|
-
{
|
|
2313
|
-
ErrorEquals: ['WorkflowEffectReconciliationRequired'],
|
|
2314
|
-
Next: 'ReconciliationRequired',
|
|
2315
|
-
ResultPath: '$.failure',
|
|
2316
|
-
},
|
|
2317
|
-
{
|
|
2318
|
-
ErrorEquals: ['WorkflowEffectNotStartedError'],
|
|
2319
|
-
Next: 'RetryExhaustedBeforeEffect',
|
|
2320
|
-
ResultPath: '$.failure',
|
|
2321
|
-
},
|
|
2322
|
-
{
|
|
2323
|
-
ErrorEquals: ['States.ALL'],
|
|
2324
|
-
Next: 'CompensateAfterFailure',
|
|
2325
|
-
ResultPath: '$.failure',
|
|
2326
|
-
},
|
|
2327
|
-
],
|
|
2328
|
-
Next: 'PostCreateCancellationBoundary',
|
|
2329
|
-
Parameters: {
|
|
2330
|
-
action: 'execute',
|
|
2331
|
-
'executionId.$': '$$.Execution.Id',
|
|
2332
|
-
'input.$': '$',
|
|
2333
|
-
stepId: 'create-export',
|
|
2334
|
-
workflowVersion: 1,
|
|
2335
|
-
},
|
|
2336
|
-
Resource: asyncWorkflowTask.arn,
|
|
2337
|
-
Retry: [{
|
|
2338
|
-
BackoffRate: 2,
|
|
2339
|
-
ErrorEquals: ['WorkflowEffectNotStartedError'],
|
|
2340
|
-
IntervalSeconds: 2,
|
|
2341
|
-
MaxAttempts: 2,
|
|
2342
|
-
}],
|
|
2343
|
-
ResultPath: '$.createExport',
|
|
2344
|
-
TimeoutSeconds: 900,
|
|
2345
|
-
Type: 'Task',
|
|
2346
|
-
},
|
|
2347
|
-
PostCreateCancellationBoundary: {
|
|
2348
|
-
Choices: [{
|
|
2349
|
-
And: [
|
|
2350
|
-
{
|
|
2351
|
-
BooleanEquals: true,
|
|
2352
|
-
Variable: '$.createExport.cancellationRequested',
|
|
2353
|
-
},
|
|
2354
|
-
{
|
|
2355
|
-
BooleanEquals: true,
|
|
2356
|
-
Variable: '$.createExport.sideEffectCommitted',
|
|
2357
|
-
},
|
|
2358
|
-
],
|
|
2359
|
-
Next: 'CompensateAfterCancellation',
|
|
2360
|
-
}, {
|
|
2361
|
-
BooleanEquals: true,
|
|
2362
|
-
Next: 'Cancelled',
|
|
2363
|
-
Variable: '$.createExport.cancellationRequested',
|
|
2364
|
-
}],
|
|
2365
|
-
Default: 'Completed',
|
|
2366
|
-
Type: 'Choice',
|
|
2367
|
-
},
|
|
2368
|
-
CompensateAfterCancellation: {
|
|
2369
|
-
Parameters: {
|
|
2370
|
-
action: 'compensate',
|
|
2371
|
-
'executionId.$': '$$.Execution.Id',
|
|
2372
|
-
'input.$': '$',
|
|
2373
|
-
stepId: 'remove-export',
|
|
2374
|
-
workflowVersion: 1,
|
|
2375
|
-
},
|
|
2376
|
-
Resource: asyncWorkflowTask.arn,
|
|
2377
|
-
Retry: [{
|
|
2378
|
-
BackoffRate: 2,
|
|
2379
|
-
ErrorEquals: ['States.TaskFailed'],
|
|
2380
|
-
IntervalSeconds: 2,
|
|
2381
|
-
MaxAttempts: 2,
|
|
2382
|
-
}],
|
|
2383
|
-
TimeoutSeconds: 300,
|
|
2384
|
-
Type: 'Task',
|
|
2385
|
-
Next: 'Cancelled',
|
|
2386
|
-
},
|
|
2387
|
-
CompensateAfterFailure: {
|
|
2388
|
-
Parameters: {
|
|
2389
|
-
action: 'compensate',
|
|
2390
|
-
'executionId.$': '$$.Execution.Id',
|
|
2391
|
-
'input.$': '$',
|
|
2392
|
-
stepId: 'remove-export',
|
|
2393
|
-
workflowVersion: 1,
|
|
2394
|
-
},
|
|
2395
|
-
Resource: asyncWorkflowTask.arn,
|
|
2396
|
-
Retry: [{
|
|
2397
|
-
BackoffRate: 2,
|
|
2398
|
-
ErrorEquals: ['States.TaskFailed'],
|
|
2399
|
-
IntervalSeconds: 2,
|
|
2400
|
-
MaxAttempts: 2,
|
|
2401
|
-
}],
|
|
2402
|
-
TimeoutSeconds: 300,
|
|
2403
|
-
Type: 'Task',
|
|
2404
|
-
Next: 'FailedAfterCompensation',
|
|
2405
|
-
},
|
|
2406
|
-
Cancelled: { Type: 'Succeed' },
|
|
2407
|
-
Completed: { Type: 'Succeed' },
|
|
2408
|
-
FailedAfterCompensation: {
|
|
2409
|
-
Cause: 'The record export failed and compensation completed.',
|
|
2410
|
-
Error: 'RecordExportFailed',
|
|
2411
|
-
Type: 'Fail',
|
|
2412
|
-
},
|
|
2413
|
-
ReconciliationRequired: {
|
|
2414
|
-
Cause:
|
|
2415
|
-
'The workflow effect outcome is ambiguous and requires operator reconciliation.',
|
|
2416
|
-
Error: 'WorkflowEffectReconciliationRequired',
|
|
2417
|
-
Type: 'Fail',
|
|
2418
|
-
},
|
|
2419
|
-
RetryExhaustedBeforeEffect: {
|
|
2420
|
-
Cause:
|
|
2421
|
-
'The workflow adapter proved no effect began, but its retry budget was exhausted.',
|
|
2422
|
-
Error: 'WorkflowEffectNotStartedError',
|
|
2423
|
-
Type: 'Fail',
|
|
2424
|
-
},
|
|
2425
|
-
UnsupportedVersion: {
|
|
2426
|
-
Cause: 'No exact deployed workflow definition exists.',
|
|
2427
|
-
Error: 'WorkflowVersionUnsupported',
|
|
2428
|
-
Type: 'Fail',
|
|
2429
|
-
},
|
|
2430
|
-
},
|
|
2431
|
-
}),
|
|
2432
|
-
name:
|
|
2433
|
-
'ebk-${recordExportWorkflowName}-' +
|
|
2434
|
-
$app.stage +
|
|
2435
|
-
'-record-export-v1',
|
|
2436
|
-
roleArn: recordExportWorkflowRole.arn,
|
|
2437
|
-
tags: {
|
|
2438
|
-
'ebk:slice': '${name}',
|
|
2439
|
-
'ebk:stage': $app.stage,
|
|
2440
|
-
'ebk:workflow-version': '1',
|
|
2441
|
-
},
|
|
2442
|
-
type: 'STANDARD',
|
|
2443
|
-
},
|
|
70
|
+
const port = process.env.EBK_DEV_PORT ?? '3000';
|
|
71
|
+
const webAssetsBucket = aws
|
|
72
|
+
.getCallerIdentityOutput({})
|
|
73
|
+
.accountId.apply((accountId: string) =>
|
|
74
|
+
sliceWebAssetsBucket('${name}', $app.stage, accountId),
|
|
2444
75
|
);
|
|
2445
|
-
}
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
buildCommand: 'node ../tools/ebk-next-build-environment.mjs',
|
|
2450
|
-
invalidation: { wait: true },
|
|
76
|
+
const web = new sst.aws.Nextjs('${pascal}Web', {
|
|
77
|
+
path: 'web',
|
|
78
|
+
router: { instance: router, path: '/${name}' },
|
|
79
|
+
buildCommand: ${buildCommand},
|
|
2451
80
|
dev: {
|
|
2452
|
-
command:
|
|
2453
|
-
directory: '.',
|
|
2454
|
-
title: '${pascalName} web',
|
|
2455
|
-
url: \`http://127.0.0.1:\${devPort}/${name}\`,
|
|
2456
|
-
},
|
|
2457
|
-
environment: {
|
|
2458
|
-
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
2459
|
-
String(observability.routineSuccessSampleRate),
|
|
2460
|
-
${' ...keyValue.environment,\n'}\
|
|
2461
|
-
AUTH_CLIENT_ID: authClient.id,
|
|
2462
|
-
AUTH_USER_POOL_ID: foundation.userPool.id,
|
|
2463
|
-
EBK_SOURCE_COMMIT: releaseSourceCommit,
|
|
2464
|
-
EBK_STAGE: $app.stage,
|
|
2465
|
-
EBK_FLEET_ORIGIN: process.env.EBK_FLEET_ORIGIN ?? '',
|
|
2466
|
-
EBK_PERFORMANCE_ACCOUNT_FINGERPRINT:
|
|
2467
|
-
performanceDeploymentBinding?.target.accountFingerprint ?? '',
|
|
2468
|
-
EBK_PERFORMANCE_CANDIDATE_DIGEST:
|
|
2469
|
-
performanceDeploymentBinding?.candidateDigest ?? '',
|
|
2470
|
-
EBK_PERFORMANCE_LOAD_ENABLED:
|
|
2471
|
-
performanceDeploymentBinding ? 'true' : 'false',
|
|
2472
|
-
EBK_PERFORMANCE_ORIGIN:
|
|
2473
|
-
performanceDeploymentBinding?.target.origin ?? '',
|
|
2474
|
-
EBK_PERFORMANCE_REGION:
|
|
2475
|
-
performanceDeploymentBinding?.target.region ?? '',
|
|
2476
|
-
EBK_PERFORMANCE_RELEASE_ID:
|
|
2477
|
-
performanceDeploymentBinding?.releaseId ?? '',
|
|
2478
|
-
EBK_PERFORMANCE_RELEASE_MATERIAL_DIGEST:
|
|
2479
|
-
performanceDeploymentBinding?.releaseMaterialDigest ?? '',
|
|
2480
|
-
EBK_PERFORMANCE_SLICE:
|
|
2481
|
-
performanceDeploymentBinding?.target.slice ?? '',
|
|
2482
|
-
EBK_SECURE_COOKIES: process.env.EBK_SECURE_COOKIES ?? '',
|
|
2483
|
-
EVENT_BUS_NAME: foundation.discovery.eventBusName,
|
|
2484
|
-
...runtimeConfigurationEnvironment,
|
|
2485
|
-
NEXT_PUBLIC_API_URL: apiUrl,
|
|
81
|
+
command: ${devCommand},
|
|
82
|
+
directory: '.', url: 'http://127.0.0.1:' + port + '/${name}',
|
|
2486
83
|
},
|
|
2487
|
-
link: [keyValue.link, ${sql ? 'database, foundation.eventBus, ' : ''}foundation.userPool],
|
|
2488
|
-
path: 'web',
|
|
2489
|
-
router: { instance: foundation.router, path: '/${name}' },
|
|
2490
84
|
transform: {
|
|
2491
85
|
assets: {
|
|
2492
86
|
transform: {
|
|
2493
87
|
bucket: {
|
|
2494
|
-
bucket:
|
|
2495
|
-
},
|
|
2496
|
-
},
|
|
2497
|
-
},
|
|
2498
|
-
imageOptimizer: {
|
|
2499
|
-
permissions: nativeAuthority.permissions('web-image-optimizer'),
|
|
2500
|
-
hook: {
|
|
2501
|
-
async postbuild(directory: string) {
|
|
2502
|
-
removeFinderMetadataFromBuiltFunction(directory);
|
|
2503
|
-
},
|
|
2504
|
-
},
|
|
2505
|
-
link: secretLinksFor('web-image-optimizer'),
|
|
2506
|
-
...lambdaLogging(nextImageOptimizerLogs.logGroup.name),
|
|
2507
|
-
},
|
|
2508
|
-
revalidationEventsSubscriber: {
|
|
2509
|
-
permissions: nativeAuthority.permissions('web-revalidation-subscriber'),
|
|
2510
|
-
link: secretLinksFor('web-revalidation-subscriber'),
|
|
2511
|
-
...lambdaLogging(nextRevalidationSubscriberLogs.logGroup.name),
|
|
2512
|
-
},
|
|
2513
|
-
revalidationSeeder: {
|
|
2514
|
-
permissions: nativeAuthority.permissions('web-revalidation-seeder'),
|
|
2515
|
-
link: secretLinksFor('web-revalidation-seeder'),
|
|
2516
|
-
...lambdaLogging(nextRevalidationSeederLogs.logGroup.name),
|
|
2517
|
-
},
|
|
2518
|
-
server(args: Record<string, unknown>) {
|
|
2519
|
-
args.permissions = $resolve({
|
|
2520
|
-
inherited: args.permissions,
|
|
2521
|
-
additional: nativeAuthority.permissions('web-server'),
|
|
2522
|
-
}).apply(({ inherited, additional }) => [
|
|
2523
|
-
...((inherited ?? []) as unknown[]),
|
|
2524
|
-
...additional,
|
|
2525
|
-
]);
|
|
2526
|
-
args.hook = {
|
|
2527
|
-
async postbuild(directory: string) {
|
|
2528
|
-
removeFinderMetadataFromBuiltFunction(directory);
|
|
88
|
+
bucket: webAssetsBucket,
|
|
2529
89
|
},
|
|
2530
|
-
};
|
|
2531
|
-
// SST applies this transform to both its dev runtime and deployed
|
|
2532
|
-
// server. Preserve native/site links; secret links are additive.
|
|
2533
|
-
args.link = $output(args.link ?? []).apply((links: unknown[]) => [
|
|
2534
|
-
...links,
|
|
2535
|
-
...secretLinksFor(
|
|
2536
|
-
'web-server',
|
|
2537
|
-
performanceDeploymentBinding
|
|
2538
|
-
? []
|
|
2539
|
-
: [performanceHmacLogicalName],
|
|
2540
|
-
),
|
|
2541
|
-
]);
|
|
2542
|
-
Object.assign(args, webServerLogging);
|
|
2543
|
-
args.transform = {
|
|
2544
|
-
...webServerLogging.transform,
|
|
2545
|
-
...($dev ? { role: { tags: { 'ebk:dev-runtime': 'web' } } } : {}),
|
|
2546
|
-
};
|
|
2547
|
-
},
|
|
2548
|
-
},
|
|
2549
|
-
${sql ? ' vpc: foundation.vpc,\n' : ''}\
|
|
2550
|
-
}, configurationDeployment
|
|
2551
|
-
? { dependsOn: [configurationDeployment] }
|
|
2552
|
-
: {});
|
|
2553
|
-
// Under a custom domain SST's web.url names the wildcard alias host (see
|
|
2554
|
-
// foundationSliceWebUrl). sst dev keeps its local development URL.
|
|
2555
|
-
const webUrl = $dev ? web.url : foundationSliceWebUrl(foundation.discovery);
|
|
2556
|
-
if (performanceIngress) {
|
|
2557
|
-
for (const path of [
|
|
2558
|
-
'/${name}/__ebk/performance/api-lambda',
|
|
2559
|
-
'/${name}/__ebk/performance/async-worker',
|
|
2560
|
-
'/${name}/__ebk/performance/async-worker/cleanup',
|
|
2561
|
-
'/${name}/__ebk/performance/database',
|
|
2562
|
-
'/${name}/__ebk/performance/database/cleanup',
|
|
2563
|
-
]) {
|
|
2564
|
-
performanceIngress.router.route(path, webUrl, {
|
|
2565
|
-
connectionAttempts: 1,
|
|
2566
|
-
connectionTimeout: '3 seconds',
|
|
2567
|
-
readTimeout: '30 seconds',
|
|
2568
|
-
});
|
|
2569
|
-
}
|
|
2570
|
-
}
|
|
2571
|
-
|
|
2572
|
-
const migrationControls: Record<string, any> = {};
|
|
2573
|
-
${` Object.assign(migrationControls, createKeyValueRetentionInfrastructure({
|
|
2574
|
-
keyValue, workspace: '${workspace}', eventBusArn: foundation.discovery.eventBusArn,
|
|
2575
|
-
alertTopicArn: foundation.discovery.alertTopicArn, schedule: backgroundSchedules.retention,
|
|
2576
|
-
scheduleName: runtimeResourceNames.dataRetentionMaintenanceRule,
|
|
2577
|
-
managedLogGroup, lambdaLogging, register: registerProductRetention,
|
|
2578
|
-
}));
|
|
2579
|
-
`}\
|
|
2580
|
-
${sql
|
|
2581
|
-
? ` if (!$dev) {
|
|
2582
|
-
const region = aws.getRegionOutput({}).name;
|
|
2583
|
-
const taskArguments = (task: any) => ({
|
|
2584
|
-
Cluster: task.cluster,
|
|
2585
|
-
LaunchType: 'FARGATE',
|
|
2586
|
-
NetworkConfiguration: {
|
|
2587
|
-
AwsvpcConfiguration: {
|
|
2588
|
-
AssignPublicIp: task.assignPublicIp.apply(
|
|
2589
|
-
(value: boolean) => value ? 'ENABLED' : 'DISABLED',
|
|
2590
|
-
),
|
|
2591
|
-
SecurityGroups: task.securityGroups,
|
|
2592
|
-
Subnets: task.subnets,
|
|
2593
90
|
},
|
|
2594
91
|
},
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
task.containers.apply((containers: string[]) => ({
|
|
2599
|
-
ContainerOverrides: containers.map((containerName) => ({
|
|
2600
|
-
Environment: [
|
|
2601
|
-
{
|
|
2602
|
-
Name: 'EBK_DATABASE_LIFECYCLE_CORRELATION_ID',
|
|
2603
|
-
Value:
|
|
2604
|
-
'{% $states.context.Execution.Input.databaseLifecycleCorrelationId %}',
|
|
2605
|
-
},
|
|
2606
|
-
...(callback
|
|
2607
|
-
? [
|
|
2608
|
-
{
|
|
2609
|
-
Name: 'EBK_CANDIDATE_IDENTITY',
|
|
2610
|
-
Value:
|
|
2611
|
-
'{% $states.context.Execution.Input.candidateIdentity %}',
|
|
2612
|
-
},
|
|
2613
|
-
{
|
|
2614
|
-
Name: 'EBK_EXECUTION_DATABASE_IDENTIFIER',
|
|
2615
|
-
Value:
|
|
2616
|
-
'{% $states.context.Execution.Input.databaseIdentifier %}',
|
|
2617
|
-
},
|
|
2618
|
-
{
|
|
2619
|
-
Name: 'EBK_EXECUTION_SLICE',
|
|
2620
|
-
Value: '{% $states.context.Execution.Input.slice %}',
|
|
2621
|
-
},
|
|
2622
|
-
{
|
|
2623
|
-
Name: 'EBK_EXECUTION_STAGE',
|
|
2624
|
-
Value: '{% $states.context.Execution.Input.stage %}',
|
|
2625
|
-
},
|
|
2626
|
-
{
|
|
2627
|
-
Name: 'EBK_REGISTRATION_DIGEST',
|
|
2628
|
-
Value:
|
|
2629
|
-
'{% $states.context.Execution.Input.registrationDigest %}',
|
|
2630
|
-
},
|
|
2631
|
-
{
|
|
2632
|
-
Name: 'EBK_SOURCE_COMMIT',
|
|
2633
|
-
Value:
|
|
2634
|
-
'{% $states.context.Execution.Input.sourceCommit %}',
|
|
2635
|
-
},
|
|
2636
|
-
{
|
|
2637
|
-
Name: 'EBK_STEP_FUNCTIONS_TASK_TOKEN',
|
|
2638
|
-
Value: '{% $states.context.Task.Token %}',
|
|
2639
|
-
},
|
|
2640
|
-
]
|
|
2641
|
-
: []),
|
|
2642
|
-
],
|
|
2643
|
-
Name: containerName,
|
|
2644
|
-
})),
|
|
2645
|
-
}));
|
|
2646
|
-
const createRawStateMachine = (
|
|
2647
|
-
logicalName: string,
|
|
2648
|
-
definition: unknown,
|
|
2649
|
-
logGroup: any,
|
|
2650
|
-
roleResource: string,
|
|
2651
|
-
) => {
|
|
2652
|
-
const role = nativeAuthority.createStepFunctionsRole(
|
|
2653
|
-
logicalName + 'Role',
|
|
2654
|
-
roleResource,
|
|
2655
|
-
);
|
|
2656
|
-
return new aws.sfn.StateMachine(logicalName, {
|
|
2657
|
-
definition: $jsonStringify(definition),
|
|
2658
|
-
loggingConfiguration: {
|
|
2659
|
-
includeExecutionData: false,
|
|
2660
|
-
level: 'ERROR',
|
|
2661
|
-
logDestination: $interpolate\`\${logGroup.arn}:*\`,
|
|
2662
|
-
},
|
|
2663
|
-
roleArn: role.arn,
|
|
2664
|
-
type: 'STANDARD',
|
|
2665
|
-
});
|
|
2666
|
-
};
|
|
2667
|
-
|
|
2668
|
-
${''}\
|
|
2669
|
-
for (const [databaseIdentifier, target] of Object.entries(
|
|
2670
|
-
databaseProvisions.databases,
|
|
2671
|
-
)) {
|
|
2672
|
-
if (!target.readwriteSecretArn || !target.readonlySecretArn) {
|
|
2673
|
-
throw new Error(
|
|
2674
|
-
'Deployed database target ' + databaseIdentifier +
|
|
2675
|
-
' is missing its generated credential references.',
|
|
2676
|
-
);
|
|
2677
|
-
}
|
|
2678
|
-
const bootstrapLogContract = managedLogContract(
|
|
2679
|
-
'database-bootstrap',
|
|
2680
|
-
databaseIdentifier,
|
|
2681
|
-
);
|
|
2682
|
-
const migrationLogContract = managedLogContract(
|
|
2683
|
-
'database-migration',
|
|
2684
|
-
databaseIdentifier,
|
|
2685
|
-
);
|
|
2686
|
-
const retirementLogContract = managedLogContract(
|
|
2687
|
-
'database-retirement',
|
|
2688
|
-
databaseIdentifier,
|
|
2689
|
-
);
|
|
2690
|
-
const bootstrapTask = new sst.aws.Task(
|
|
2691
|
-
target.resourceName + 'BootstrapTask',
|
|
2692
|
-
{
|
|
2693
|
-
permissions: nativeAuthority.permissions(
|
|
2694
|
-
'database-' + databaseIdentifier + '-bootstrap-task',
|
|
2695
|
-
),
|
|
2696
|
-
cluster: foundation.cluster,
|
|
2697
|
-
command: ['node', 'jobs/bootstrap-database.mjs'],
|
|
2698
|
-
environment: {
|
|
2699
|
-
...databaseMigrationContainer.environment,
|
|
2700
|
-
AWS_REGION: region,
|
|
2701
|
-
EBK_BOOTSTRAP_ID:
|
|
2702
|
-
$app.name + ':' + $app.stage + ':' + databaseIdentifier,
|
|
2703
|
-
EBK_DATABASE_HOST: foundation.database.clusterEndpoint,
|
|
2704
|
-
EBK_DATABASE_MIGRATOR_ROLE: target.migratorRole,
|
|
2705
|
-
EBK_DATABASE_NAME: target.databaseName,
|
|
2706
|
-
EBK_DATABASE_PORT:
|
|
2707
|
-
$interpolate\`\${foundation.database.port}\`,
|
|
2708
|
-
EBK_DATABASE_READONLY_ROLE: target.readonlyRole,
|
|
2709
|
-
EBK_DATABASE_READWRITE_ROLE: target.readwriteRole,
|
|
2710
|
-
EBK_DATABASE_ROTATION_TOKEN: target.rotationToken ?? '',
|
|
2711
|
-
EBK_MASTER_SECRET_ARN: foundation.database.masterSecretArn,
|
|
2712
|
-
EBK_READONLY_SECRET_ARN: target.readonlySecretArn,
|
|
2713
|
-
EBK_READWRITE_SECRET_ARN: target.readwriteSecretArn,
|
|
2714
|
-
EBK_RDS_CA_BUNDLE: '/app/rds-global-bundle.pem',
|
|
2715
|
-
EBK_RUNTIME_DATABASE_HOST: foundation.database.host,
|
|
2716
|
-
EBK_STAGE: $app.stage,
|
|
2717
|
-
EBK_WORKSPACE: '${workspace}',
|
|
2718
|
-
},
|
|
2719
|
-
image: databaseMigrationContainer.image,
|
|
2720
|
-
link: secretLinksFor(
|
|
2721
|
-
'database-' + databaseIdentifier + '-bootstrap-task',
|
|
2722
|
-
),
|
|
2723
|
-
logging: {
|
|
2724
|
-
name: bootstrapLogContract.name,
|
|
2725
|
-
retention: '1 month',
|
|
2726
|
-
},
|
|
2727
|
-
transform: {
|
|
2728
|
-
logGroup: {
|
|
2729
|
-
logGroupClass: bootstrapLogContract.logGroupClass,
|
|
2730
|
-
retentionInDays: bootstrapLogContract.retentionInDays,
|
|
2731
|
-
tags: bootstrapLogContract.tags,
|
|
2732
|
-
},
|
|
2733
|
-
taskDefinition: {
|
|
2734
|
-
family: standardSliceDatabaseTaskFamily(
|
|
2735
|
-
$app.stage,
|
|
2736
|
-
databaseIdentifier,
|
|
2737
|
-
'bootstrap',
|
|
2738
|
-
),
|
|
2739
|
-
},
|
|
2740
|
-
},
|
|
2741
|
-
},
|
|
2742
|
-
);
|
|
2743
|
-
const bootstrapLogDataProtection = managedLogDataProtection(
|
|
2744
|
-
target.resourceName + 'BootstrapLog',
|
|
2745
|
-
bootstrapLogContract,
|
|
2746
|
-
bootstrapLogContract.name,
|
|
2747
|
-
[bootstrapTask.nodes.taskDefinition],
|
|
2748
|
-
foundation.discovery.alertTopicArn,
|
|
2749
|
-
);
|
|
2750
|
-
const migrationTask = new sst.aws.Task(
|
|
2751
|
-
target.resourceName + 'MigrationTask',
|
|
2752
|
-
{
|
|
2753
|
-
permissions: nativeAuthority.permissions(
|
|
2754
|
-
'database-' + databaseIdentifier + '-migration-task',
|
|
2755
|
-
),
|
|
2756
|
-
cluster: foundation.cluster,
|
|
2757
|
-
environment: {
|
|
2758
|
-
...databaseMigrationContainer.environment,
|
|
2759
|
-
AWS_REGION: region,
|
|
2760
|
-
EBK_DATABASE_HOST: foundation.database.clusterEndpoint,
|
|
2761
|
-
EBK_DATABASE_NAME: target.databaseName,
|
|
2762
|
-
EBK_DATABASE_PORT:
|
|
2763
|
-
$interpolate\`\${foundation.database.port}\`,
|
|
2764
|
-
EBK_DATABASE_READWRITE_ROLE: target.readwriteRole,
|
|
2765
|
-
EBK_DATABASE_USERNAME: target.migratorRole,
|
|
2766
|
-
EBK_MIGRATION_ID:
|
|
2767
|
-
$app.name + ':' + $app.stage + ':' + databaseIdentifier,
|
|
2768
|
-
EBK_RDS_CA_BUNDLE: '/app/rds-global-bundle.pem',
|
|
2769
|
-
EBK_STAGE: $app.stage,
|
|
2770
|
-
EBK_WORKSPACE: '${workspace}',
|
|
2771
|
-
},
|
|
2772
|
-
image: databaseMigrationContainer.image,
|
|
2773
|
-
link: secretLinksFor(
|
|
2774
|
-
'database-' + databaseIdentifier + '-migration-task',
|
|
2775
|
-
),
|
|
2776
|
-
logging: {
|
|
2777
|
-
name: migrationLogContract.name,
|
|
2778
|
-
retention: '1 month',
|
|
2779
|
-
},
|
|
2780
|
-
transform: {
|
|
2781
|
-
logGroup: {
|
|
2782
|
-
logGroupClass: migrationLogContract.logGroupClass,
|
|
2783
|
-
retentionInDays: migrationLogContract.retentionInDays,
|
|
2784
|
-
tags: migrationLogContract.tags,
|
|
2785
|
-
},
|
|
2786
|
-
taskDefinition: {
|
|
2787
|
-
family: standardSliceDatabaseTaskFamily(
|
|
2788
|
-
$app.stage,
|
|
2789
|
-
databaseIdentifier,
|
|
2790
|
-
'migration',
|
|
2791
|
-
),
|
|
2792
|
-
},
|
|
2793
|
-
},
|
|
2794
|
-
},
|
|
2795
|
-
);
|
|
2796
|
-
const migrationLogDataProtection = managedLogDataProtection(
|
|
2797
|
-
target.resourceName + 'MigrationLog',
|
|
2798
|
-
migrationLogContract,
|
|
2799
|
-
migrationLogContract.name,
|
|
2800
|
-
[migrationTask.nodes.taskDefinition],
|
|
2801
|
-
foundation.discovery.alertTopicArn,
|
|
2802
|
-
);
|
|
2803
|
-
const migrationWorkflowLogs = managedLogGroup(
|
|
2804
|
-
target.resourceName + 'MigrationWorkflowLogs',
|
|
2805
|
-
'database-migration-orchestration',
|
|
2806
|
-
foundation.discovery.alertTopicArn,
|
|
2807
|
-
databaseIdentifier,
|
|
2808
|
-
);
|
|
2809
|
-
const stateMachine = createRawStateMachine(
|
|
2810
|
-
target.resourceName + 'Migration',
|
|
2811
|
-
{
|
|
2812
|
-
StartAt: 'BootstrapDatabase',
|
|
2813
|
-
States: {
|
|
2814
|
-
BootstrapDatabase: {
|
|
2815
|
-
Arguments: {
|
|
2816
|
-
...taskArguments(bootstrapTask),
|
|
2817
|
-
Overrides: lifecycleEnvironment(bootstrapTask, false),
|
|
2818
|
-
},
|
|
2819
|
-
Next: 'RunDatabaseMigration',
|
|
2820
|
-
QueryLanguage: 'JSONata',
|
|
2821
|
-
Resource: 'arn:aws:states:::ecs:runTask.sync',
|
|
2822
|
-
// The first bootstrap of a Slice runs minutes after its execution
|
|
2823
|
-
// role is created; ECR can still answer "not found" to the fresh
|
|
2824
|
-
// role and the task never starts (EBK-INT-2026-072). Bootstrap is
|
|
2825
|
-
// idempotent, so a bounded retry is safe.
|
|
2826
|
-
Retry: [
|
|
2827
|
-
{
|
|
2828
|
-
BackoffRate: 2,
|
|
2829
|
-
ErrorEquals: ['States.TaskFailed'],
|
|
2830
|
-
IntervalSeconds: 30,
|
|
2831
|
-
MaxAttempts: 3,
|
|
2832
|
-
},
|
|
2833
|
-
],
|
|
2834
|
-
TimeoutSeconds: 2700,
|
|
2835
|
-
Type: 'Task',
|
|
2836
|
-
},
|
|
2837
|
-
DatabaseMigrationSucceeded: {
|
|
2838
|
-
QueryLanguage: 'JSONata',
|
|
2839
|
-
Type: 'Succeed',
|
|
2840
|
-
},
|
|
2841
|
-
RunDatabaseMigration: {
|
|
2842
|
-
Arguments: {
|
|
2843
|
-
...taskArguments(migrationTask),
|
|
2844
|
-
Overrides: lifecycleEnvironment(migrationTask, false),
|
|
2845
|
-
},
|
|
2846
|
-
Next: 'DatabaseMigrationSucceeded',
|
|
2847
|
-
QueryLanguage: 'JSONata',
|
|
2848
|
-
Resource: 'arn:aws:states:::ecs:runTask.sync',
|
|
2849
|
-
TimeoutSeconds: 2700,
|
|
2850
|
-
Type: 'Task',
|
|
2851
|
-
},
|
|
2852
|
-
},
|
|
2853
|
-
},
|
|
2854
|
-
migrationWorkflowLogs.logGroup,
|
|
2855
|
-
'database-' + databaseIdentifier + '-migration-orchestration',
|
|
2856
|
-
);
|
|
2857
|
-
const registration = registerProductMigration(
|
|
2858
|
-
target.resourceName + 'MigrationRegistration',
|
|
2859
|
-
databaseIdentifier,
|
|
2860
|
-
stateMachine.arn,
|
|
2861
|
-
);
|
|
2862
|
-
const retirementTask =
|
|
2863
|
-
$app.stage === 'development' &&
|
|
2864
|
-
databaseIdentifier === 'retirement_rehearsal'
|
|
2865
|
-
? new sst.aws.Task(target.resourceName + 'RetirementTask', {
|
|
2866
|
-
permissions: nativeAuthority.permissions(
|
|
2867
|
-
'database-' + databaseIdentifier + '-retirement-task',
|
|
2868
|
-
),
|
|
2869
|
-
cluster: foundation.cluster,
|
|
2870
|
-
command: ['node', 'jobs/retire-database.mjs'],
|
|
2871
|
-
environment: {
|
|
2872
|
-
...databaseRetirementContainer.environment,
|
|
2873
|
-
AWS_REGION: region,
|
|
2874
|
-
EBK_DATABASE_HOST: foundation.database.clusterEndpoint,
|
|
2875
|
-
EBK_DATABASE_IDENTIFIER: databaseIdentifier,
|
|
2876
|
-
EBK_DATABASE_MIGRATOR_ROLE: target.migratorRole,
|
|
2877
|
-
EBK_DATABASE_NAME: target.databaseName,
|
|
2878
|
-
EBK_DATABASE_PORT:
|
|
2879
|
-
$interpolate\`\${foundation.database.port}\`,
|
|
2880
|
-
EBK_DATABASE_READONLY_ROLE: target.readonlyRole,
|
|
2881
|
-
EBK_DATABASE_READWRITE_ROLE: target.readwriteRole,
|
|
2882
|
-
EBK_MASTER_SECRET_ARN: foundation.database.masterSecretArn,
|
|
2883
|
-
EBK_RDS_CA_BUNDLE: '/app/rds-global-bundle.pem',
|
|
2884
|
-
EBK_READONLY_SECRET_ARN: target.readonlySecretArn,
|
|
2885
|
-
EBK_READWRITE_SECRET_ARN: target.readwriteSecretArn,
|
|
2886
|
-
EBK_RETIREMENT_ID:
|
|
2887
|
-
$app.name + ':' + $app.stage + ':' + databaseIdentifier,
|
|
2888
|
-
EBK_RETAINED_SIBLINGS: $jsonStringify(
|
|
2889
|
-
Object.entries(databaseProvisions.databases)
|
|
2890
|
-
.filter(([identifier]) => identifier !== databaseIdentifier)
|
|
2891
|
-
.sort(([left], [right]) =>
|
|
2892
|
-
left < right ? -1 : left > right ? 1 : 0,
|
|
2893
|
-
)
|
|
2894
|
-
.map(([identifier, sibling]) => ({
|
|
2895
|
-
databaseIdentifier: identifier,
|
|
2896
|
-
databaseName: sibling.databaseName,
|
|
2897
|
-
migratorRole: sibling.migratorRole,
|
|
2898
|
-
readonlyRole: sibling.readonlyRole,
|
|
2899
|
-
readonlySecretArn: sibling.readonlySecretArn,
|
|
2900
|
-
readwriteRole: sibling.readwriteRole,
|
|
2901
|
-
readwriteSecretArn: sibling.readwriteSecretArn,
|
|
2902
|
-
})),
|
|
2903
|
-
),
|
|
2904
|
-
EBK_SLICE: '${name}',
|
|
2905
|
-
EBK_STAGE: $app.stage,
|
|
2906
|
-
EBK_WORKSPACE: '${workspace}',
|
|
2907
|
-
},
|
|
2908
|
-
image: databaseRetirementContainer.image,
|
|
2909
|
-
link: secretLinksFor(
|
|
2910
|
-
'database-' + databaseIdentifier + '-retirement-task',
|
|
2911
|
-
),
|
|
2912
|
-
logging: {
|
|
2913
|
-
name: retirementLogContract.name,
|
|
2914
|
-
retention: '1 month',
|
|
2915
|
-
},
|
|
92
|
+
...($dev
|
|
93
|
+
? {
|
|
94
|
+
server: {
|
|
2916
95
|
transform: {
|
|
2917
|
-
|
|
2918
|
-
logGroupClass: retirementLogContract.logGroupClass,
|
|
2919
|
-
retentionInDays: retirementLogContract.retentionInDays,
|
|
2920
|
-
tags: retirementLogContract.tags,
|
|
2921
|
-
},
|
|
2922
|
-
taskDefinition: {
|
|
2923
|
-
family: standardSliceDatabaseTaskFamily(
|
|
2924
|
-
$app.stage,
|
|
2925
|
-
databaseIdentifier,
|
|
2926
|
-
'retirement',
|
|
2927
|
-
),
|
|
2928
|
-
},
|
|
2929
|
-
},
|
|
2930
|
-
})
|
|
2931
|
-
: undefined;
|
|
2932
|
-
const retirementLogDataProtection = retirementTask
|
|
2933
|
-
? managedLogDataProtection(
|
|
2934
|
-
target.resourceName + 'RetirementLog',
|
|
2935
|
-
retirementLogContract,
|
|
2936
|
-
retirementLogContract.name,
|
|
2937
|
-
[retirementTask.nodes.taskDefinition],
|
|
2938
|
-
foundation.discovery.alertTopicArn,
|
|
2939
|
-
)
|
|
2940
|
-
: undefined;
|
|
2941
|
-
let retirementControl;
|
|
2942
|
-
if (retirementTask) {
|
|
2943
|
-
const retirementWorkflowLogs = managedLogGroup(
|
|
2944
|
-
target.resourceName + 'RetirementWorkflowLogs',
|
|
2945
|
-
'database-retirement-orchestration',
|
|
2946
|
-
foundation.discovery.alertTopicArn,
|
|
2947
|
-
databaseIdentifier,
|
|
2948
|
-
);
|
|
2949
|
-
const retirementStateMachine = createRawStateMachine(
|
|
2950
|
-
target.resourceName + 'MigrationRetirement',
|
|
2951
|
-
{
|
|
2952
|
-
StartAt: 'RetireDatabase',
|
|
2953
|
-
States: {
|
|
2954
|
-
DatabaseRetirementSucceeded: {
|
|
2955
|
-
QueryLanguage: 'JSONata',
|
|
2956
|
-
Type: 'Succeed',
|
|
2957
|
-
},
|
|
2958
|
-
RetireDatabase: {
|
|
2959
|
-
Arguments: {
|
|
2960
|
-
...taskArguments(retirementTask),
|
|
2961
|
-
Overrides: lifecycleEnvironment(retirementTask, true),
|
|
2962
|
-
},
|
|
2963
|
-
Next: 'DatabaseRetirementSucceeded',
|
|
2964
|
-
QueryLanguage: 'JSONata',
|
|
2965
|
-
Resource: 'arn:aws:states:::ecs:runTask.waitForTaskToken',
|
|
2966
|
-
Retry: [
|
|
2967
|
-
{
|
|
2968
|
-
BackoffRate: 2,
|
|
2969
|
-
ErrorEquals: [
|
|
2970
|
-
'ECS.AmazonECSException',
|
|
2971
|
-
'ECS.ECSException',
|
|
2972
|
-
],
|
|
2973
|
-
IntervalSeconds: 10,
|
|
2974
|
-
MaxAttempts: 2,
|
|
2975
|
-
},
|
|
2976
|
-
],
|
|
2977
|
-
TimeoutSeconds: 2700,
|
|
2978
|
-
Type: 'Task',
|
|
96
|
+
role: { tags: { 'ebk:dev-runtime': 'web' } },
|
|
2979
97
|
},
|
|
2980
98
|
},
|
|
2981
|
-
}
|
|
2982
|
-
|
|
2983
|
-
'database-' + databaseIdentifier + '-retirement-orchestration',
|
|
2984
|
-
);
|
|
2985
|
-
retirementControl = {
|
|
2986
|
-
retirementWorkflowLogs,
|
|
2987
|
-
retirementStateMachine,
|
|
2988
|
-
retirementTask,
|
|
2989
|
-
};
|
|
2990
|
-
}
|
|
2991
|
-
migrationControls[databaseIdentifier] = {
|
|
2992
|
-
bootstrapLogDataProtection,
|
|
2993
|
-
bootstrapTask,
|
|
2994
|
-
migrationLogDataProtection,
|
|
2995
|
-
migrationTask,
|
|
2996
|
-
migrationWorkflowLogs,
|
|
2997
|
-
registration,
|
|
2998
|
-
retirementLogDataProtection,
|
|
2999
|
-
...(retirementControl ?? {}),
|
|
3000
|
-
stateMachine,
|
|
3001
|
-
};
|
|
3002
|
-
}
|
|
3003
|
-
}
|
|
3004
|
-
|
|
3005
|
-
`
|
|
3006
|
-
: ''}\
|
|
3007
|
-
const outboxRelayAlarm = new aws.cloudwatch.MetricAlarm(
|
|
3008
|
-
'${pascalName}OutboxRelayErrors',
|
|
3009
|
-
{
|
|
3010
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
3011
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'outbox-relay-errors', ' ')}),
|
|
3012
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
3013
|
-
dimensions: { FunctionName: asyncOutboxRelay.name },
|
|
3014
|
-
evaluationPeriods: 1,
|
|
3015
|
-
metricName: 'Errors',
|
|
3016
|
-
name: '${name}-' + $app.stage + '-outbox-relay-errors',
|
|
3017
|
-
namespace: 'AWS/Lambda',
|
|
3018
|
-
period: 300,
|
|
3019
|
-
statistic: 'Sum',
|
|
3020
|
-
threshold: 1,
|
|
3021
|
-
treatMissingData: 'notBreaching',
|
|
3022
|
-
},
|
|
3023
|
-
);
|
|
3024
|
-
const inboxCleanupErrorAlarm = new aws.cloudwatch.MetricAlarm(
|
|
3025
|
-
'${pascalName}InboxCleanupErrors',
|
|
3026
|
-
{
|
|
3027
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
3028
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'inbox-cleanup-errors', ' ')}),
|
|
3029
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
3030
|
-
dimensions: { FunctionName: asyncInboxCleanup.name },
|
|
3031
|
-
evaluationPeriods: 1,
|
|
3032
|
-
metricName: 'Errors',
|
|
3033
|
-
name: '${name}-' + $app.stage + '-inbox-cleanup-errors',
|
|
3034
|
-
namespace: 'AWS/Lambda',
|
|
3035
|
-
period: 300,
|
|
3036
|
-
statistic: 'Sum',
|
|
3037
|
-
threshold: 1,
|
|
3038
|
-
treatMissingData: 'notBreaching',
|
|
3039
|
-
},
|
|
3040
|
-
);
|
|
3041
|
-
const dataExportCleanupErrorAlarm = new aws.cloudwatch.MetricAlarm(
|
|
3042
|
-
'${pascalName}DataExportCleanupErrors',
|
|
3043
|
-
{
|
|
3044
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
3045
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'data-export-cleanup-failure', ' ')}),
|
|
3046
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
3047
|
-
dimensions: { FunctionName: dataExportCleanup.name },
|
|
3048
|
-
evaluationPeriods: 1,
|
|
3049
|
-
metricName: 'Errors',
|
|
3050
|
-
name: '${name}-' + $app.stage + '-data-export-cleanup-failure',
|
|
3051
|
-
namespace: 'AWS/Lambda',
|
|
3052
|
-
period: 300,
|
|
3053
|
-
statistic: 'Sum',
|
|
3054
|
-
threshold: 1,
|
|
3055
|
-
treatMissingData: 'notBreaching',
|
|
3056
|
-
},
|
|
3057
|
-
);
|
|
3058
|
-
const dataExportCleanupInvocationAlarm =
|
|
3059
|
-
new aws.cloudwatch.MetricAlarm(
|
|
3060
|
-
'${pascalName}DataExportCleanupInvocationMissing',
|
|
3061
|
-
{
|
|
3062
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
3063
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'data-export-cleanup-invocation-missing', ' ')}),
|
|
3064
|
-
comparisonOperator: 'LessThanThreshold',
|
|
3065
|
-
dimensions: { FunctionName: dataExportCleanup.name },
|
|
3066
|
-
evaluationPeriods: 2,
|
|
3067
|
-
metricName: 'Invocations',
|
|
3068
|
-
name:
|
|
3069
|
-
'${name}-' +
|
|
3070
|
-
$app.stage +
|
|
3071
|
-
'-data-export-cleanup-invocation-missing',
|
|
3072
|
-
namespace: 'AWS/Lambda',
|
|
3073
|
-
period: 3600,
|
|
3074
|
-
statistic: 'Sum',
|
|
3075
|
-
threshold: 1,
|
|
3076
|
-
treatMissingData: 'breaching',
|
|
3077
|
-
},
|
|
3078
|
-
);
|
|
3079
|
-
// Every cleanup run reports 1 when it could not complete a full inventory.
|
|
3080
|
-
// Minimum alarms only when no run in an hour converged; three hours absorb
|
|
3081
|
-
// the rescan that follows one interrupted run (a resumed scan must still
|
|
3082
|
-
// read the whole collection from the start before it can converge).
|
|
3083
|
-
const inboxCleanupBacklogAlarm = new aws.cloudwatch.MetricAlarm(
|
|
3084
|
-
'${pascalName}InboxCleanupBacklog',
|
|
3085
|
-
{
|
|
3086
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
3087
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'inbox-cleanup-backlog', ' ')}),
|
|
3088
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
3089
|
-
dimensions: {
|
|
3090
|
-
Component: 'inbox-cleanup',
|
|
3091
|
-
Feature: 'async-work',
|
|
3092
|
-
Operation: 'inbox-cleanup',
|
|
3093
|
-
Slice: '${name}',
|
|
3094
|
-
Stage: $app.stage,
|
|
3095
|
-
},
|
|
3096
|
-
evaluationPeriods: 3,
|
|
3097
|
-
metricName: 'InboxCleanupContinuationRequired',
|
|
3098
|
-
name: '${name}-' + $app.stage + '-inbox-cleanup-backlog',
|
|
3099
|
-
namespace: 'EBK/Async',
|
|
3100
|
-
period: 3600,
|
|
3101
|
-
statistic: 'Minimum',
|
|
3102
|
-
threshold: 1,
|
|
3103
|
-
treatMissingData: 'notBreaching',
|
|
99
|
+
}
|
|
100
|
+
: {}),
|
|
3104
101
|
},
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
Feature: 'data-lifecycle',
|
|
3116
|
-
Operation: 'expiry-cleanup',
|
|
3117
|
-
Slice: '${name}',
|
|
3118
|
-
Stage: $app.stage,
|
|
3119
|
-
},
|
|
3120
|
-
evaluationPeriods: 1,
|
|
3121
|
-
metricName: 'DataExportCleanupDeadlineBreaches',
|
|
3122
|
-
name:
|
|
3123
|
-
'${name}-' +
|
|
3124
|
-
$app.stage +
|
|
3125
|
-
'-data-export-cleanup-deadline',
|
|
3126
|
-
namespace: 'EBK/DataLifecycle',
|
|
3127
|
-
period: 3600,
|
|
3128
|
-
statistic: 'Maximum',
|
|
3129
|
-
threshold: 1,
|
|
3130
|
-
treatMissingData: 'notBreaching',
|
|
3131
|
-
},
|
|
3132
|
-
);
|
|
3133
|
-
// Same per-run continuation signal and three-hour Minimum as the inbox
|
|
3134
|
-
// cleanup alarm; expiry shares that run's four-minute budget.
|
|
3135
|
-
const performanceLoadCleanupBacklogAlarm =
|
|
3136
|
-
new aws.cloudwatch.MetricAlarm(
|
|
3137
|
-
'${pascalName}PerformanceLoadCleanupBacklog',
|
|
3138
|
-
{
|
|
3139
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
3140
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'performance-load-cleanup-backlog', ' ')}),
|
|
3141
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
3142
|
-
dimensions: {
|
|
3143
|
-
Component: 'performance-load-cleanup',
|
|
3144
|
-
Feature: 'performance',
|
|
3145
|
-
Operation: 'expiry-cleanup',
|
|
3146
|
-
Slice: '${name}',
|
|
3147
|
-
Stage: $app.stage,
|
|
3148
|
-
},
|
|
3149
|
-
evaluationPeriods: 3,
|
|
3150
|
-
metricName: 'PerformanceLoadCleanupContinuationRequired',
|
|
3151
|
-
name:
|
|
3152
|
-
'${name}-' +
|
|
3153
|
-
$app.stage +
|
|
3154
|
-
'-performance-load-cleanup-backlog',
|
|
3155
|
-
namespace: 'EBK/Performance',
|
|
3156
|
-
period: 3600,
|
|
3157
|
-
statistic: 'Minimum',
|
|
3158
|
-
threshold: 1,
|
|
3159
|
-
treatMissingData: 'notBreaching',
|
|
3160
|
-
},
|
|
3161
|
-
);
|
|
3162
|
-
const performanceLoadCleanupDeadlineAlarm =
|
|
3163
|
-
new aws.cloudwatch.MetricAlarm(
|
|
3164
|
-
'${pascalName}PerformanceLoadCleanupDeadline',
|
|
3165
|
-
{
|
|
3166
|
-
alarmActions: [foundation.discovery.alertTopicArn],
|
|
3167
|
-
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderSliceAlarmDescriptionInput)(name, 'performance-load-cleanup-deadline', ' ')}),
|
|
3168
|
-
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
3169
|
-
dimensions: {
|
|
3170
|
-
Component: 'performance-load-cleanup',
|
|
3171
|
-
Feature: 'performance',
|
|
3172
|
-
Operation: 'expiry-cleanup',
|
|
3173
|
-
Slice: '${name}',
|
|
3174
|
-
Stage: $app.stage,
|
|
3175
|
-
},
|
|
3176
|
-
evaluationPeriods: 1,
|
|
3177
|
-
metricName: 'PerformanceLoadCleanupDeadlineBreaches',
|
|
3178
|
-
name:
|
|
3179
|
-
'${name}-' +
|
|
3180
|
-
$app.stage +
|
|
3181
|
-
'-performance-load-cleanup-deadline',
|
|
3182
|
-
namespace: 'EBK/Performance',
|
|
3183
|
-
period: 3600,
|
|
3184
|
-
statistic: 'Maximum',
|
|
3185
|
-
threshold: 1,
|
|
3186
|
-
treatMissingData: 'notBreaching',
|
|
3187
|
-
},
|
|
3188
|
-
);
|
|
3189
|
-
const dashboard = observability.dashboards === 'slice'
|
|
3190
|
-
? new aws.cloudwatch.Dashboard('${pascalName}Dashboard', {
|
|
3191
|
-
dashboardName: '${name}-' + $app.stage,
|
|
3192
|
-
dashboardBody: $resolve({
|
|
3193
|
-
table: keyValue.table.name,
|
|
3194
|
-
dispatcher: keyValue.dispatcher.name,
|
|
3195
|
-
reconciler: keyValue.reconciler.name,
|
|
3196
|
-
providerQueue: physicalQueueName(providerQueue),
|
|
3197
|
-
providerDlq: physicalQueueName(providerDlq),
|
|
3198
|
-
}).apply(({ table, dispatcher, reconciler, providerQueue, providerDlq }) => JSON.stringify({
|
|
3199
|
-
widgets: [
|
|
3200
|
-
{
|
|
3201
|
-
type: 'metric', x: 0, y: 0, width: 12, height: 6,
|
|
3202
|
-
properties: {
|
|
3203
|
-
title: '${pascalName} delivery errors and throttles',
|
|
3204
|
-
region: process.env.AWS_REGION ?? 'us-east-1',
|
|
3205
|
-
period: 300, stat: 'Sum',
|
|
3206
|
-
metrics: [
|
|
3207
|
-
['AWS/Lambda', 'Errors', 'FunctionName', dispatcher],
|
|
3208
|
-
['.', 'Throttles', '.', '.'],
|
|
3209
|
-
['.', 'Errors', '.', reconciler],
|
|
3210
|
-
['.', 'Throttles', '.', '.'],
|
|
3211
|
-
],
|
|
3212
|
-
},
|
|
3213
|
-
},
|
|
3214
|
-
{
|
|
3215
|
-
type: 'metric', x: 12, y: 0, width: 12, height: 6,
|
|
3216
|
-
properties: {
|
|
3217
|
-
title: '${pascalName} durable storage capacity',
|
|
3218
|
-
region: process.env.AWS_REGION ?? 'us-east-1',
|
|
3219
|
-
period: 300, stat: 'Sum',
|
|
3220
|
-
metrics: [
|
|
3221
|
-
['AWS/DynamoDB', 'ConsumedReadCapacityUnits', 'TableName', table],
|
|
3222
|
-
['.', 'ConsumedWriteCapacityUnits', '.', '.'],
|
|
3223
|
-
['.', 'ThrottledRequests', '.', '.', 'Operation', 'PutItem'],
|
|
3224
|
-
],
|
|
3225
|
-
},
|
|
3226
|
-
},
|
|
3227
|
-
{
|
|
3228
|
-
type: 'metric', x: 0, y: 6, width: 24, height: 6,
|
|
3229
|
-
properties: {
|
|
3230
|
-
title: '${pascalName} provider backlog and dead letters',
|
|
3231
|
-
region: process.env.AWS_REGION ?? 'us-east-1',
|
|
3232
|
-
period: 300, stat: 'Maximum',
|
|
3233
|
-
metrics: [
|
|
3234
|
-
['AWS/SQS', 'ApproximateNumberOfMessagesVisible', 'QueueName', providerQueue],
|
|
3235
|
-
['.', '.', '.', providerDlq],
|
|
3236
|
-
['.', 'ApproximateAgeOfOldestMessage', '.', providerQueue],
|
|
3237
|
-
],
|
|
3238
|
-
},
|
|
3239
|
-
},
|
|
3240
|
-
],
|
|
3241
|
-
})),
|
|
3242
|
-
}) : undefined;
|
|
102
|
+
${sql ? " link: [database], vpc: sst.aws.Vpc.get('WebDatabaseVpc', read('vpcId')),\n" : ''} permissions: [{
|
|
103
|
+
actions: ['dynamodb:GetItem','dynamodb:PutItem','dynamodb:UpdateItem','dynamodb:DeleteItem','dynamodb:ConditionCheckItem','dynamodb:Query'],
|
|
104
|
+
resources: [table.arn],
|
|
105
|
+
}],
|
|
106
|
+
environment: { ...environment, EBK_FLEET_ORIGIN: process.env.EBK_FLEET_ORIGIN ?? '', EBK_SECURE_COOKIES: process.env.EBK_SECURE_COOKIES ?? '', NEXT_PUBLIC_API_URL: api.url },
|
|
107
|
+
});
|
|
108
|
+
const registration = new aws.ssm.Parameter('${pascal}ProductSliceRegistration', {
|
|
109
|
+
name: productSliceRegistrationPath(stages.foundationStage, stages.consumerStage, '${name}'),
|
|
110
|
+
type: 'String', value: JSON.stringify({ consumerStage: stages.consumerStage, foundationStage: stages.foundationStage, name: '${name}', registrationVersion: 1, foundationContract: '^2.0.0' }),
|
|
111
|
+
});
|
|
3243
112
|
return {
|
|
3244
|
-
api,
|
|
3245
|
-
apiUrl,
|
|
3246
|
-
asyncInboxCleanup,
|
|
3247
|
-
dataExportCleanupDeadlineAlarm,
|
|
3248
|
-
dataExportCleanupErrorAlarm,
|
|
3249
|
-
dataExportCleanupInvocationAlarm,
|
|
3250
|
-
inboxCleanupErrorAlarm,
|
|
3251
|
-
inboxCleanupBacklogAlarm,
|
|
3252
|
-
inboxCleanupRule,
|
|
3253
|
-
inboxCleanupTarget,
|
|
3254
|
-
performanceLoadCleanupBacklogAlarm,
|
|
3255
|
-
performanceLoadCleanupDeadlineAlarm,
|
|
3256
|
-
asyncOutboxRelay,
|
|
3257
|
-
${sql ? ' sqlOutbox,\n sqlOutboxAttemptsAlarm,\n sqlOutboxBacklogAlarm,\n sqlOutboxRelayErrorAlarm,\n' : ''}\
|
|
3258
|
-
asyncRecoveryLedger,
|
|
3259
|
-
asyncScheduleTarget,
|
|
3260
|
-
asyncTargetDlq,
|
|
3261
|
-
asyncTargetDlqAlarm,
|
|
3262
|
-
asyncTargetDlqPolicy,
|
|
3263
|
-
asyncWorkflowTask,
|
|
3264
|
-
authClient,
|
|
3265
|
-
configurationApplication,
|
|
3266
|
-
configurationDeployment,
|
|
3267
|
-
configurationDeploymentStrategy,
|
|
3268
|
-
configurationEnvironment,
|
|
3269
|
-
configurationProfile,
|
|
3270
|
-
configurationVersion,
|
|
3271
|
-
dashboard,
|
|
3272
|
-
dataExportCleanup,
|
|
3273
|
-
dataExportCleanupInvocation,
|
|
3274
|
-
dataExportCleanupRule,
|
|
3275
|
-
dataExportCleanupTarget,
|
|
3276
|
-
dataExportStore,
|
|
3277
|
-
${sql ? ' database,\n' : ''}\
|
|
3278
|
-
${' keyValue,\n'}\
|
|
3279
|
-
dlqAlarm,
|
|
3280
|
-
eventDlq,
|
|
3281
|
-
eventQueue,
|
|
3282
|
-
machineClientProvisioner,
|
|
3283
|
-
migrationControls,
|
|
3284
|
-
eventDeliveryAttemptsAlarm,
|
|
3285
|
-
eventIntentRejectedAlarm,
|
|
3286
|
-
keyValueReconciliationErrorAlarm,
|
|
3287
|
-
keyValueStreamDeliveryErrorAlarm,
|
|
3288
|
-
keyValueStreamIteratorAgeAlarm,
|
|
3289
|
-
outboxBacklogAlarm,
|
|
3290
|
-
outboxRelayAlarm,
|
|
3291
|
-
outboxRelayRule,
|
|
3292
|
-
outboxRelayTarget,
|
|
3293
|
-
performanceCostControls,
|
|
3294
|
-
performanceEndpoint: performanceIngress?.router.url,
|
|
3295
|
-
providerDlq,
|
|
3296
|
-
providerDlqAlarm,
|
|
3297
|
-
providerQueue,
|
|
3298
|
-
reliability,
|
|
3299
|
-
providerReconciliationRule,
|
|
3300
|
-
providerReconciliationTarget,
|
|
3301
|
-
recordExportWorkflow,
|
|
3302
|
-
machineAuthorization,
|
|
3303
|
-
machineAuthorizationProof,
|
|
3304
|
-
web,
|
|
3305
|
-
webUrl,
|
|
113
|
+
apiId: api.nodes.api.id, apiUrl: api.url, authClientId: authClient.id, authUserPoolId: userPool.id,
|
|
3306
114
|
// <ebk:composition-outputs:start>
|
|
3307
115
|
// <ebk:composition-outputs:end>
|
|
116
|
+
name: '${name}', stage: $app.stage, registration: registration.name,
|
|
117
|
+
webUrl: $dev ? web.url : read('routerUrl').apply((origin: string) => sliceWebUrl('${name}', origin)),
|
|
3308
118
|
};
|
|
3309
119
|
}
|
|
3310
120
|
`,
|
|
3311
121
|
};
|
|
3312
|
-
Object.assign(files, (0, built_in_plan_key_value_retention_infrastructure_js_1.renderKeyValueRetentionInfrastructureFiles)(name, pascalName));
|
|
3313
|
-
return files;
|
|
3314
122
|
}
|
|
3315
123
|
//# sourceMappingURL=built-in-plan-infrastructure-files.js.map
|