@empire-builder-kit/nx 1.0.0-beta.9 → 1.0.0-rc.2
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/NOTICE +6 -0
- package/README.md +113 -3
- package/executors.json +30 -0
- package/package.json +84 -6
- package/src/api-contract/baseline-update.d.ts +82 -0
- package/src/api-contract/baseline-update.js +225 -0
- package/src/api-contract/baseline-update.js.map +1 -0
- package/src/api-contract/compatibility.d.ts +30 -0
- package/src/api-contract/compatibility.js +643 -0
- package/src/api-contract/compatibility.js.map +1 -0
- package/src/api-contract/contract-graph.d.ts +35 -0
- package/src/api-contract/contract-graph.js +141 -0
- package/src/api-contract/contract-graph.js.map +1 -0
- package/src/api-contract/evidence.d.ts +23 -0
- package/src/api-contract/evidence.js +87 -0
- package/src/api-contract/evidence.js.map +1 -0
- package/src/api-contract/index.d.ts +6 -0
- package/src/api-contract/index.js +10 -0
- package/src/api-contract/index.js.map +1 -0
- package/src/api-contract/model.d.ts +144 -0
- package/src/api-contract/model.fixtures.d.ts +2 -0
- package/src/api-contract/model.fixtures.js +81 -0
- package/src/api-contract/model.fixtures.js.map +1 -0
- package/src/api-contract/model.js +993 -0
- package/src/api-contract/model.js.map +1 -0
- package/src/api-contract/rollout.d.ts +32 -0
- package/src/api-contract/rollout.js +88 -0
- package/src/api-contract/rollout.js.map +1 -0
- package/src/authorization/compatibility.d.ts +62 -0
- package/src/authorization/compatibility.js +175 -0
- package/src/authorization/compatibility.js.map +1 -0
- package/src/authorization/index.d.ts +1 -0
- package/src/authorization/index.js +5 -0
- package/src/authorization/index.js.map +1 -0
- package/src/blueprints/execution.d.ts +25 -1
- package/src/blueprints/execution.js +246 -83
- package/src/blueprints/execution.js.map +1 -1
- package/src/blueprints/external-sandbox.d.ts +53 -0
- package/src/blueprints/external-sandbox.js +1182 -0
- package/src/blueprints/external-sandbox.js.map +1 -0
- package/src/blueprints/manifest.d.ts +42 -2
- package/src/blueprints/manifest.js +82 -27
- package/src/blueprints/manifest.js.map +1 -1
- package/src/blueprints/resolver.d.ts +14 -5
- package/src/blueprints/resolver.js +228 -68
- package/src/blueprints/resolver.js.map +1 -1
- package/src/cli/agent-command.d.ts +30 -0
- package/src/cli/agent-command.js +204 -0
- package/src/cli/agent-command.js.map +1 -0
- package/src/cli/agent-runtime.d.ts +25 -0
- package/src/cli/agent-runtime.js +488 -0
- package/src/cli/agent-runtime.js.map +1 -0
- package/src/cli/blueprint-authority.d.ts +9 -0
- package/src/cli/blueprint-authority.js +43 -0
- package/src/cli/blueprint-authority.js.map +1 -0
- package/src/cli/blueprint-command.d.ts +24 -0
- package/src/cli/blueprint-command.js +63 -0
- package/src/cli/blueprint-command.js.map +1 -0
- package/src/cli/bootstrap.d.ts +31 -0
- package/src/cli/bootstrap.js +165 -0
- package/src/cli/bootstrap.js.map +1 -0
- package/src/cli/dev-command.d.ts +92 -0
- package/src/cli/dev-command.js +561 -0
- package/src/cli/dev-command.js.map +1 -0
- package/src/cli/main.d.ts +131 -0
- package/src/cli/main.js +1199 -0
- package/src/cli/main.js.map +1 -0
- package/src/cli/output.d.ts +19 -0
- package/src/cli/output.js +51 -0
- package/src/cli/output.js.map +1 -0
- package/src/cli/personal-secret-runtime.d.ts +81 -0
- package/src/cli/personal-secret-runtime.js +567 -0
- package/src/cli/personal-secret-runtime.js.map +1 -0
- package/src/cli/secret-terminal.d.ts +12 -0
- package/src/cli/secret-terminal.js +128 -0
- package/src/cli/secret-terminal.js.map +1 -0
- package/src/container-images.d.ts +1 -0
- package/src/container-images.js +5 -0
- package/src/container-images.js.map +1 -0
- package/src/data-lifecycle/index.d.ts +3 -0
- package/src/data-lifecycle/index.js +7 -0
- package/src/data-lifecycle/index.js.map +1 -0
- package/src/data-lifecycle/model.d.ts +172 -0
- package/src/data-lifecycle/model.fixtures.d.ts +2 -0
- package/src/data-lifecycle/model.fixtures.js +244 -0
- package/src/data-lifecycle/model.fixtures.js.map +1 -0
- package/src/data-lifecycle/model.js +95 -0
- package/src/data-lifecycle/model.js.map +1 -0
- package/src/data-lifecycle/sensitive-artifacts.d.ts +28 -0
- package/src/data-lifecycle/sensitive-artifacts.js +146 -0
- package/src/data-lifecycle/sensitive-artifacts.js.map +1 -0
- package/src/data-lifecycle/validation.d.ts +32 -0
- package/src/data-lifecycle/validation.js +837 -0
- package/src/data-lifecycle/validation.js.map +1 -0
- package/src/database-retirement/contract.d.ts +68 -0
- package/src/database-retirement/contract.js +166 -0
- package/src/database-retirement/contract.js.map +1 -0
- package/src/database-retirement/index.d.ts +1 -0
- package/src/database-retirement/index.js +5 -0
- package/src/database-retirement/index.js.map +1 -0
- package/src/deterministic-order.d.ts +2 -0
- package/src/deterministic-order.js +7 -0
- package/src/deterministic-order.js.map +1 -0
- package/src/developer-agent/context.d.ts +27 -0
- package/src/developer-agent/context.js +497 -0
- package/src/developer-agent/context.js.map +1 -0
- package/src/developer-agent/generator-planning.d.ts +34 -0
- package/src/developer-agent/generator-planning.js +645 -0
- package/src/developer-agent/generator-planning.js.map +1 -0
- package/src/developer-agent/generator-preview.d.ts +8 -0
- package/src/developer-agent/generator-preview.js +650 -0
- package/src/developer-agent/generator-preview.js.map +1 -0
- package/src/developer-agent/git-inspection.d.ts +108 -0
- package/src/developer-agent/git-inspection.js +815 -0
- package/src/developer-agent/git-inspection.js.map +1 -0
- package/src/developer-agent/handoff.d.ts +43 -0
- package/src/developer-agent/handoff.js +698 -0
- package/src/developer-agent/handoff.js.map +1 -0
- package/src/developer-agent/index.d.ts +10 -0
- package/src/developer-agent/index.js +14 -0
- package/src/developer-agent/index.js.map +1 -0
- package/src/developer-agent/model.d.ts +481 -0
- package/src/developer-agent/model.js +143 -0
- package/src/developer-agent/model.js.map +1 -0
- package/src/developer-agent/operation-registry.d.ts +45 -0
- package/src/developer-agent/operation-registry.js +1255 -0
- package/src/developer-agent/operation-registry.js.map +1 -0
- package/src/developer-agent/ordering.d.ts +9 -0
- package/src/developer-agent/ordering.js +15 -0
- package/src/developer-agent/ordering.js.map +1 -0
- package/src/developer-agent/planning.d.ts +18 -0
- package/src/developer-agent/planning.js +447 -0
- package/src/developer-agent/planning.js.map +1 -0
- package/src/developer-agent/preview-changes.d.ts +26 -0
- package/src/developer-agent/preview-changes.js +203 -0
- package/src/developer-agent/preview-changes.js.map +1 -0
- package/src/developer-agent/preview-source.d.ts +2 -0
- package/src/developer-agent/preview-source.js +16 -0
- package/src/developer-agent/preview-source.js.map +1 -0
- package/src/developer-agent/validation.d.ts +18 -0
- package/src/developer-agent/validation.js +2617 -0
- package/src/developer-agent/validation.js.map +1 -0
- package/src/developer-agent/workspace-inspection.d.ts +20 -0
- package/src/developer-agent/workspace-inspection.js +1134 -0
- package/src/developer-agent/workspace-inspection.js.map +1 -0
- package/src/developer-agent/workspace-path.d.ts +6 -0
- package/src/developer-agent/workspace-path.js +22 -0
- package/src/developer-agent/workspace-path.js.map +1 -0
- package/src/executors/blueprint-trust/blueprint-trust.d.ts +29 -0
- package/src/executors/blueprint-trust/blueprint-trust.js +115 -0
- package/src/executors/blueprint-trust/blueprint-trust.js.map +1 -0
- package/src/executors/blueprint-trust/schema.json +27 -0
- package/src/executors/blueprint-verification/blueprint-verification.d.ts +13 -0
- package/src/executors/blueprint-verification/blueprint-verification.js +110 -0
- package/src/executors/blueprint-verification/blueprint-verification.js.map +1 -0
- package/src/executors/blueprint-verification/schema.json +44 -0
- package/src/executors/deployment-plan/deployment-plan.js +1 -0
- package/src/executors/deployment-plan/deployment-plan.js.map +1 -1
- package/src/executors/dev-doctor/dev-doctor.d.ts +19 -5
- package/src/executors/dev-doctor/dev-doctor.js +186 -32
- package/src/executors/dev-doctor/dev-doctor.js.map +1 -1
- package/src/executors/dev-doctor/schema.json +1 -6
- package/src/executors/dev-setup/dev-setup.d.ts +7 -1
- package/src/executors/dev-setup/dev-setup.js +14 -3
- package/src/executors/dev-setup/dev-setup.js.map +1 -1
- package/src/executors/developer-context/developer-context.d.ts +38 -0
- package/src/executors/developer-context/developer-context.js +78 -0
- package/src/executors/developer-context/developer-context.js.map +1 -0
- package/src/executors/developer-context/schema.json +87 -0
- package/src/executors/fleet/fleet.d.ts +12 -43
- package/src/executors/fleet/fleet.js +120 -500
- package/src/executors/fleet/fleet.js.map +1 -1
- package/src/executors/fleet/schema.json +64 -14
- package/src/executors/github-bootstrap/github-bootstrap.d.ts +1 -0
- package/src/executors/github-bootstrap/github-bootstrap.js +1 -0
- package/src/executors/github-bootstrap/github-bootstrap.js.map +1 -1
- package/src/executors/github-bootstrap/schema.json +5 -0
- package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +144 -0
- package/src/executors/infrastructure-plan/infrastructure-plan.js +3320 -0
- package/src/executors/infrastructure-plan/infrastructure-plan.js.map +1 -0
- package/src/executors/infrastructure-plan/schema.json +78 -0
- package/src/executors/secret-guardrails/schema.json +6 -0
- package/src/executors/secret-guardrails/secret-guardrails.d.ts +3 -0
- package/src/executors/secret-guardrails/secret-guardrails.js +44 -0
- package/src/executors/secret-guardrails/secret-guardrails.js.map +1 -0
- package/src/executors/secret-metadata/schema.json +31 -0
- package/src/executors/secret-metadata/secret-metadata.d.ts +32 -0
- package/src/executors/secret-metadata/secret-metadata.js +131 -0
- package/src/executors/secret-metadata/secret-metadata.js.map +1 -0
- package/src/executors/sst-lifecycle/logging-preflight.d.ts +17 -0
- package/src/executors/sst-lifecycle/logging-preflight.js +196 -0
- package/src/executors/sst-lifecycle/logging-preflight.js.map +1 -0
- package/src/executors/sst-lifecycle/run-sst-command.d.ts +23 -3
- package/src/executors/sst-lifecycle/run-sst-command.js +113 -10
- package/src/executors/sst-lifecycle/run-sst-command.js.map +1 -1
- package/src/executors/sst-lifecycle/schema.json +9 -5
- package/src/executors/sst-lifecycle/secret-preflight.d.ts +25 -0
- package/src/executors/sst-lifecycle/secret-preflight.js +119 -0
- package/src/executors/sst-lifecycle/secret-preflight.js.map +1 -0
- package/src/foundation/discovery.d.ts +17 -1
- package/src/foundation/discovery.js +16 -1
- package/src/foundation/discovery.js.map +1 -1
- package/src/foundation/index.d.ts +3 -0
- package/src/foundation/index.js +3 -0
- package/src/foundation/index.js.map +1 -1
- package/src/foundation/local-database-contract.d.ts +1 -0
- package/src/foundation/local-database-contract.js +3 -0
- package/src/foundation/local-database-contract.js.map +1 -1
- package/src/foundation/logging-preflight.d.ts +30 -0
- package/src/foundation/logging-preflight.js +138 -0
- package/src/foundation/logging-preflight.js.map +1 -0
- package/src/foundation/logging.d.ts +70 -0
- package/src/foundation/logging.js +133 -0
- package/src/foundation/logging.js.map +1 -0
- package/src/foundation/preflight.d.ts +9 -0
- package/src/foundation/preflight.js +58 -2
- package/src/foundation/preflight.js.map +1 -1
- package/src/foundation/provision-database-bindings.d.ts +9 -1
- package/src/foundation/provision-database-bindings.js +25 -5
- package/src/foundation/provision-database-bindings.js.map +1 -1
- package/src/foundation/provision-logical-database.d.ts +10 -2
- package/src/foundation/provision-logical-database.js +68 -113
- package/src/foundation/provision-logical-database.js.map +1 -1
- package/src/foundation/router-origin-proof.d.ts +2 -0
- package/src/foundation/router-origin-proof.js +25 -0
- package/src/foundation/router-origin-proof.js.map +1 -0
- package/src/foundation/stages.d.ts +1 -0
- package/src/foundation/stages.js +9 -1
- package/src/foundation/stages.js.map +1 -1
- package/src/frontend-security/index.d.ts +1 -0
- package/src/frontend-security/index.js +5 -0
- package/src/frontend-security/index.js.map +1 -0
- package/src/frontend-security/security-headers.d.ts +50 -0
- package/src/frontend-security/security-headers.js +418 -0
- package/src/frontend-security/security-headers.js.map +1 -0
- package/src/generators/feature-registry.d.ts +13 -0
- package/src/generators/feature-registry.js +73 -0
- package/src/generators/feature-registry.js.map +1 -0
- package/src/generators/function/function.d.ts +1 -1
- package/src/generators/function/function.js +51 -6
- package/src/generators/function/function.js.map +1 -1
- package/src/generators/function/schema.d.ts +1 -0
- package/src/generators/function/schema.json +6 -1
- package/src/generators/logging-registry.d.ts +13 -0
- package/src/generators/logging-registry.js +62 -0
- package/src/generators/logging-registry.js.map +1 -0
- package/src/generators/post-generation-install.d.ts +67 -0
- package/src/generators/post-generation-install.js +3308 -0
- package/src/generators/post-generation-install.js.map +1 -0
- package/src/generators/preset/generator.js +3 -0
- package/src/generators/preset/generator.js.map +1 -1
- package/src/generators/preset/tool-versions.d.ts +18 -0
- package/src/generators/preset/tool-versions.js +22 -0
- package/src/generators/preset/tool-versions.js.map +1 -0
- package/src/generators/preset/workspace-files-developer-agent.d.ts +14 -0
- package/src/generators/preset/workspace-files-developer-agent.js +511 -0
- package/src/generators/preset/workspace-files-developer-agent.js.map +1 -0
- package/src/generators/preset/workspace-files-foundation-workload-roles.d.ts +6 -0
- package/src/generators/preset/workspace-files-foundation-workload-roles.js +406 -0
- package/src/generators/preset/workspace-files-foundation-workload-roles.js.map +1 -0
- package/src/generators/preset/workspace-files-performance-cost.d.ts +66 -0
- package/src/generators/preset/workspace-files-performance-cost.js +866 -0
- package/src/generators/preset/workspace-files-performance-cost.js.map +1 -0
- package/src/generators/preset/workspace-files-performance-load.d.ts +73 -0
- package/src/generators/preset/workspace-files-performance-load.js +801 -0
- package/src/generators/preset/workspace-files-performance-load.js.map +1 -0
- package/src/generators/preset/workspace-files-workload-role-baseline.d.ts +9 -0
- package/src/generators/preset/workspace-files-workload-role-baseline.js +1102 -0
- package/src/generators/preset/workspace-files-workload-role-baseline.js.map +1 -0
- package/src/generators/preset/workspace-files.d.ts +14 -1
- package/src/generators/preset/workspace-files.js +8189 -245
- package/src/generators/preset/workspace-files.js.map +1 -1
- package/src/generators/repository-policy/repository-policy.js +3 -47
- package/src/generators/repository-policy/repository-policy.js.map +1 -1
- package/src/generators/slice/built-in-plan-api-contract-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-api-contract-files.js +2656 -0
- package/src/generators/slice/built-in-plan-api-contract-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-api-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-api-files.js +1186 -0
- package/src/generators/slice/built-in-plan-api-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-async-work-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-async-work-files.js +7903 -0
- package/src/generators/slice/built-in-plan-async-work-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-authorization-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-authorization-files.js +2314 -0
- package/src/generators/slice/built-in-plan-authorization-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +559 -0
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-deletion-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-deletion-files.js +1101 -0
- package/src/generators/slice/built-in-plan-data-deletion-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-export-infrastructure-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js +249 -0
- package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-files.js +1530 -0
- package/src/generators/slice/built-in-plan-data-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-lifecycle-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-lifecycle-files.js +750 -0
- package/src/generators/slice/built-in-plan-data-lifecycle-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +828 -0
- package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-retention-job-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-retention-job-files.js +2604 -0
- package/src/generators/slice/built-in-plan-data-retention-job-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-retention-launcher-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +144 -0
- package/src/generators/slice/built-in-plan-data-retention-launcher-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-rights-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-rights-files.js +4628 -0
- package/src/generators/slice/built-in-plan-data-rights-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-database-lifecycle-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-database-lifecycle-files.js +1901 -0
- package/src/generators/slice/built-in-plan-database-lifecycle-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js +485 -0
- package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-foundation-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-foundation-files.js +184 -0
- package/src/generators/slice/built-in-plan-foundation-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-frontend-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-frontend-files.js +2233 -0
- package/src/generators/slice/built-in-plan-frontend-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-infrastructure-files.js +3038 -0
- package/src/generators/slice/built-in-plan-infrastructure-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-infrastructure-safety-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-infrastructure-safety-files.js +312 -0
- package/src/generators/slice/built-in-plan-infrastructure-safety-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-metadata-files.d.ts +3 -0
- package/src/generators/slice/built-in-plan-metadata-files.js +219 -0
- package/src/generators/slice/built-in-plan-metadata-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-operations-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-operations-files.js +630 -0
- package/src/generators/slice/built-in-plan-operations-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-performance-files.d.ts +3 -0
- package/src/generators/slice/built-in-plan-performance-files.js +3293 -0
- package/src/generators/slice/built-in-plan-performance-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-project-files.d.ts +3 -0
- package/src/generators/slice/built-in-plan-project-files.js +979 -0
- package/src/generators/slice/built-in-plan-project-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-release-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-release-files.js +6387 -0
- package/src/generators/slice/built-in-plan-release-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-reliability-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-reliability-files.js +4499 -0
- package/src/generators/slice/built-in-plan-reliability-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-secret-runtime-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-secret-runtime-files.js +1004 -0
- package/src/generators/slice/built-in-plan-secret-runtime-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-shared.d.ts +53 -0
- package/src/generators/slice/built-in-plan-shared.js +113 -0
- package/src/generators/slice/built-in-plan-shared.js.map +1 -0
- package/src/generators/slice/built-in-plan-testing-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-testing-files.js +2356 -0
- package/src/generators/slice/built-in-plan-testing-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-verification-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-verification-files.js +358 -0
- package/src/generators/slice/built-in-plan-verification-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-web-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-web-files.js +430 -0
- package/src/generators/slice/built-in-plan-web-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-workload-role-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-workload-role-files.js +2356 -0
- package/src/generators/slice/built-in-plan-workload-role-files.js.map +1 -0
- package/src/generators/slice/built-in-plan.d.ts +8 -0
- package/src/generators/slice/built-in-plan.js +264 -0
- package/src/generators/slice/built-in-plan.js.map +1 -0
- package/src/generators/slice/schema.json +1 -1
- package/src/generators/slice/slice.d.ts +1 -22
- package/src/generators/slice/slice.js +185 -1510
- package/src/generators/slice/slice.js.map +1 -1
- package/src/generators/upgrade/schema.d.ts +2 -0
- package/src/generators/upgrade/schema.json +11 -1
- package/src/generators/upgrade/upgrade.d.ts +51 -1
- package/src/generators/upgrade/upgrade.js +820 -82
- package/src/generators/upgrade/upgrade.js.map +1 -1
- package/src/generators/workload/frozen-container.d.ts +8 -0
- package/src/generators/workload/frozen-container.js +36 -0
- package/src/generators/workload/frozen-container.js.map +1 -0
- package/src/generators/workload/performance-registration.d.ts +32 -0
- package/src/generators/workload/performance-registration.js +226 -0
- package/src/generators/workload/performance-registration.js.map +1 -0
- package/src/generators/workload/reliability-registration.d.ts +16 -0
- package/src/generators/workload/reliability-registration.js +150 -0
- package/src/generators/workload/reliability-registration.js.map +1 -0
- package/src/generators/workload/schema.d.ts +1 -0
- package/src/generators/workload/schema.json +6 -1
- package/src/generators/workload/service-performance-files.d.ts +4 -0
- package/src/generators/workload/service-performance-files.js +1846 -0
- package/src/generators/workload/service-performance-files.js.map +1 -0
- package/src/generators/workload/workload.d.ts +3 -2
- package/src/generators/workload/workload.js +1083 -18
- package/src/generators/workload/workload.js.map +1 -1
- package/src/git-policy/action-pins.d.ts +10 -0
- package/src/git-policy/action-pins.js +10 -0
- package/src/git-policy/action-pins.js.map +1 -1
- package/src/git-policy/github-bootstrap.d.ts +14 -1
- package/src/git-policy/github-bootstrap.js +274 -46
- package/src/git-policy/github-bootstrap.js.map +1 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/index.js.map +1 -1
- package/src/infrastructure-change/convergence.d.ts +13 -0
- package/src/infrastructure-change/convergence.js +85 -0
- package/src/infrastructure-change/convergence.js.map +1 -0
- package/src/infrastructure-change/drift.d.ts +13 -0
- package/src/infrastructure-change/drift.js +112 -0
- package/src/infrastructure-change/drift.js.map +1 -0
- package/src/infrastructure-change/index.d.ts +7 -0
- package/src/infrastructure-change/index.js +11 -0
- package/src/infrastructure-change/index.js.map +1 -0
- package/src/infrastructure-change/model.d.ts +253 -0
- package/src/infrastructure-change/model.js +28 -0
- package/src/infrastructure-change/model.js.map +1 -0
- package/src/infrastructure-change/normalize.d.ts +12 -0
- package/src/infrastructure-change/normalize.js +245 -0
- package/src/infrastructure-change/normalize.js.map +1 -0
- package/src/infrastructure-change/plan.d.ts +40 -0
- package/src/infrastructure-change/plan.js +361 -0
- package/src/infrastructure-change/plan.js.map +1 -0
- package/src/infrastructure-change/risk.d.ts +7 -0
- package/src/infrastructure-change/risk.js +269 -0
- package/src/infrastructure-change/risk.js.map +1 -0
- package/src/infrastructure-change/summary.d.ts +20 -0
- package/src/infrastructure-change/summary.js +130 -0
- package/src/infrastructure-change/summary.js.map +1 -0
- package/src/local-dev/context-discovery.d.ts +2 -0
- package/src/local-dev/context-discovery.js +59 -0
- package/src/local-dev/context-discovery.js.map +1 -0
- package/src/local-dev/contract-validation.d.ts +15 -0
- package/src/local-dev/contract-validation.js +84 -0
- package/src/local-dev/contract-validation.js.map +1 -0
- package/src/local-dev/contracts.d.ts +10 -1
- package/src/local-dev/contracts.js +57 -5
- package/src/local-dev/contracts.js.map +1 -1
- package/src/local-dev/control-contract.d.ts +67 -0
- package/src/local-dev/control-contract.js +180 -0
- package/src/local-dev/control-contract.js.map +1 -0
- package/src/local-dev/dev-command-core.d.ts +60 -0
- package/src/local-dev/dev-command-core.js +89 -0
- package/src/local-dev/dev-command-core.js.map +1 -0
- package/src/local-dev/effects.d.ts +16 -0
- package/src/local-dev/effects.js +63 -0
- package/src/local-dev/effects.js.map +1 -0
- package/src/local-dev/environment-inspector.d.ts +125 -0
- package/src/local-dev/environment-inspector.js +687 -0
- package/src/local-dev/environment-inspector.js.map +1 -0
- package/src/local-dev/environment-state.d.ts +113 -0
- package/src/local-dev/environment-state.js +463 -0
- package/src/local-dev/environment-state.js.map +1 -0
- package/src/local-dev/errors.d.ts +6 -0
- package/src/local-dev/errors.js +41 -0
- package/src/local-dev/errors.js.map +1 -0
- package/src/local-dev/fleet-client.d.ts +33 -0
- package/src/local-dev/fleet-client.js +156 -0
- package/src/local-dev/fleet-client.js.map +1 -0
- package/src/local-dev/fleet-configuration.d.ts +13 -0
- package/src/local-dev/fleet-configuration.js +71 -0
- package/src/local-dev/fleet-configuration.js.map +1 -0
- package/src/local-dev/fleet-inventory.d.ts +56 -0
- package/src/local-dev/fleet-inventory.js +469 -0
- package/src/local-dev/fleet-inventory.js.map +1 -0
- package/src/local-dev/fleet-ipc.d.ts +28 -0
- package/src/local-dev/fleet-ipc.js +267 -0
- package/src/local-dev/fleet-ipc.js.map +1 -0
- package/src/local-dev/fleet-launcher.d.ts +53 -0
- package/src/local-dev/fleet-launcher.js +379 -0
- package/src/local-dev/fleet-launcher.js.map +1 -0
- package/src/local-dev/fleet-lock.d.ts +41 -0
- package/src/local-dev/fleet-lock.js +135 -0
- package/src/local-dev/fleet-lock.js.map +1 -0
- package/src/local-dev/fleet-logs.d.ts +66 -0
- package/src/local-dev/fleet-logs.js +542 -0
- package/src/local-dev/fleet-logs.js.map +1 -0
- package/src/local-dev/fleet-process.d.ts +50 -0
- package/src/local-dev/fleet-process.js +289 -0
- package/src/local-dev/fleet-process.js.map +1 -0
- package/src/local-dev/fleet-runtime.d.ts +22 -0
- package/src/local-dev/fleet-runtime.js +368 -0
- package/src/local-dev/fleet-runtime.js.map +1 -0
- package/src/local-dev/fleet-session.d.ts +70 -0
- package/src/local-dev/fleet-session.js +301 -0
- package/src/local-dev/fleet-session.js.map +1 -0
- package/src/local-dev/fleet-slice-runner-daemon.d.ts +1 -0
- package/src/local-dev/fleet-slice-runner-daemon.js +21 -0
- package/src/local-dev/fleet-slice-runner-daemon.js.map +1 -0
- package/src/local-dev/fleet-startup.d.ts +22 -0
- package/src/local-dev/fleet-startup.js +114 -0
- package/src/local-dev/fleet-startup.js.map +1 -0
- package/src/local-dev/fleet-state.d.ts +62 -0
- package/src/local-dev/fleet-state.js +297 -0
- package/src/local-dev/fleet-state.js.map +1 -0
- package/src/local-dev/fleet-supervisor-daemon.d.ts +1 -0
- package/src/local-dev/fleet-supervisor-daemon.js +41 -0
- package/src/local-dev/fleet-supervisor-daemon.js.map +1 -0
- package/src/local-dev/fleet-supervisor.d.ts +52 -0
- package/src/local-dev/fleet-supervisor.js +384 -0
- package/src/local-dev/fleet-supervisor.js.map +1 -0
- package/src/local-dev/gateway.js +1 -1
- package/src/local-dev/gateway.js.map +1 -1
- package/src/local-dev/identity.js +4 -6
- package/src/local-dev/identity.js.map +1 -1
- package/src/local-dev/index.d.ts +1 -0
- package/src/local-dev/index.js +1 -0
- package/src/local-dev/index.js.map +1 -1
- package/src/local-dev/local-context.d.ts +62 -0
- package/src/local-dev/local-context.js +299 -0
- package/src/local-dev/local-context.js.map +1 -0
- package/src/local-dev/nx-workspace.d.ts +45 -0
- package/src/local-dev/nx-workspace.js +228 -0
- package/src/local-dev/nx-workspace.js.map +1 -0
- package/src/local-dev/personal-secret-ledger.d.ts +75 -0
- package/src/local-dev/personal-secret-ledger.js +391 -0
- package/src/local-dev/personal-secret-ledger.js.map +1 -0
- package/src/local-dev/personal-stage.d.ts +18 -0
- package/src/local-dev/personal-stage.js +129 -0
- package/src/local-dev/personal-stage.js.map +1 -0
- package/src/local-dev/private-state.d.ts +17 -0
- package/src/local-dev/private-state.js +254 -0
- package/src/local-dev/private-state.js.map +1 -0
- package/src/local-dev/process-identity.d.ts +9 -0
- package/src/local-dev/process-identity.js +79 -0
- package/src/local-dev/process-identity.js.map +1 -0
- package/src/local-dev/runtime-paths.d.ts +17 -0
- package/src/local-dev/runtime-paths.js +33 -0
- package/src/local-dev/runtime-paths.js.map +1 -0
- package/src/local-dev/secret-slice-claim.d.ts +17 -0
- package/src/local-dev/secret-slice-claim.js +75 -0
- package/src/local-dev/secret-slice-claim.js.map +1 -0
- package/src/local-dev/slice-claim.d.ts +36 -0
- package/src/local-dev/slice-claim.js +199 -0
- package/src/local-dev/slice-claim.js.map +1 -0
- package/src/local-dev/slice-runner.d.ts +121 -0
- package/src/local-dev/slice-runner.js +715 -0
- package/src/local-dev/slice-runner.js.map +1 -0
- package/src/local-dev/tls.js +51 -17
- package/src/local-dev/tls.js.map +1 -1
- package/src/ownership/composition.d.ts +5 -2
- package/src/ownership/composition.js +26 -3
- package/src/ownership/composition.js.map +1 -1
- package/src/ownership/hash.d.ts +1 -1
- package/src/ownership/hash.js +3 -1
- package/src/ownership/hash.js.map +1 -1
- package/src/ownership/record.d.ts +32 -1
- package/src/ownership/record.js +139 -2
- package/src/ownership/record.js.map +1 -1
- package/src/performance/cost-collection.d.ts +225 -0
- package/src/performance/cost-collection.js +825 -0
- package/src/performance/cost-collection.js.map +1 -0
- package/src/performance/cost-controls.d.ts +131 -0
- package/src/performance/cost-controls.js +336 -0
- package/src/performance/cost-controls.js.map +1 -0
- package/src/performance/evidence.d.ts +140 -0
- package/src/performance/evidence.js +599 -0
- package/src/performance/evidence.js.map +1 -0
- package/src/performance/index.d.ts +10 -0
- package/src/performance/index.js +14 -0
- package/src/performance/index.js.map +1 -0
- package/src/performance/load-safety.d.ts +84 -0
- package/src/performance/load-safety.js +346 -0
- package/src/performance/load-safety.js.map +1 -0
- package/src/performance/model.d.ts +129 -0
- package/src/performance/model.js +452 -0
- package/src/performance/model.js.map +1 -0
- package/src/performance/pr-artifact-budget.d.ts +42 -0
- package/src/performance/pr-artifact-budget.js +151 -0
- package/src/performance/pr-artifact-budget.js.map +1 -0
- package/src/performance/runner.d.ts +75 -0
- package/src/performance/runner.js +227 -0
- package/src/performance/runner.js.map +1 -0
- package/src/performance/scenario-endpoint.d.ts +1 -0
- package/src/performance/scenario-endpoint.js +5 -0
- package/src/performance/scenario-endpoint.js.map +1 -0
- package/src/performance/scenario.d.ts +193 -0
- package/src/performance/scenario.js +736 -0
- package/src/performance/scenario.js.map +1 -0
- package/src/performance/test-fixtures.d.ts +7 -0
- package/src/performance/test-fixtures.js +169 -0
- package/src/performance/test-fixtures.js.map +1 -0
- package/src/performance/unit-cost.d.ts +105 -0
- package/src/performance/unit-cost.js +364 -0
- package/src/performance/unit-cost.js.map +1 -0
- package/src/release/index.d.ts +4 -0
- package/src/release/index.js +8 -0
- package/src/release/index.js.map +1 -0
- package/src/release/lifecycle.d.ts +132 -0
- package/src/release/lifecycle.js +411 -0
- package/src/release/lifecycle.js.map +1 -0
- package/src/release/manifest.d.ts +148 -0
- package/src/release/manifest.js +503 -0
- package/src/release/manifest.js.map +1 -0
- package/src/release/rollout.d.ts +170 -0
- package/src/release/rollout.js +578 -0
- package/src/release/rollout.js.map +1 -0
- package/src/release/source-authority.d.ts +19 -0
- package/src/release/source-authority.js +195 -0
- package/src/release/source-authority.js.map +1 -0
- package/src/repository-policy/deployment-plan.d.ts +2 -1
- package/src/repository-policy/deployment-plan.js +2 -0
- package/src/repository-policy/deployment-plan.js.map +1 -1
- package/src/repository-policy/policy.d.ts +1 -1
- package/src/repository-policy/policy.js +29 -25
- package/src/repository-policy/policy.js.map +1 -1
- package/src/schemas/aggregate-count-evidence-v1.json +135 -0
- package/src/schemas/api-contract-baseline-v1.json +674 -0
- package/src/schemas/api-contract-compatibility-report-v1.json +126 -0
- package/src/schemas/aws-billing-actual-evidence-v1.json +407 -0
- package/src/schemas/blueprint-v1.json +18 -1
- package/src/schemas/data-lifecycle-policy-v1.json +517 -0
- package/src/schemas/generated-ownership-v2.json +22 -0
- package/src/schemas/performance-policy-v1.json +335 -0
- package/src/schemas/repository-policy-v1.json +1 -0
- package/src/schemas/testing-evidence-quarantine-v1.json +168 -0
- package/src/schemas/testing-evidence-result-v1.json +319 -0
- package/src/secrets/adapters.d.ts +49 -0
- package/src/secrets/adapters.js +184 -0
- package/src/secrets/adapters.js.map +1 -0
- package/src/secrets/aws-control-plane.d.ts +20 -0
- package/src/secrets/aws-control-plane.js +255 -0
- package/src/secrets/aws-control-plane.js.map +1 -0
- package/src/secrets/declaration-verification.d.ts +11 -0
- package/src/secrets/declaration-verification.js +68 -0
- package/src/secrets/declaration-verification.js.map +1 -0
- package/src/secrets/guardrails.d.ts +26 -0
- package/src/secrets/guardrails.js +328 -0
- package/src/secrets/guardrails.js.map +1 -0
- package/src/secrets/index.d.ts +12 -0
- package/src/secrets/index.js +16 -0
- package/src/secrets/index.js.map +1 -0
- package/src/secrets/metadata.d.ts +48 -0
- package/src/secrets/metadata.js +171 -0
- package/src/secrets/metadata.js.map +1 -0
- package/src/secrets/model.d.ts +49 -0
- package/src/secrets/model.js +125 -0
- package/src/secrets/model.js.map +1 -0
- package/src/secrets/operator.d.ts +101 -0
- package/src/secrets/operator.js +229 -0
- package/src/secrets/operator.js.map +1 -0
- package/src/secrets/permissions.d.ts +34 -0
- package/src/secrets/permissions.js +86 -0
- package/src/secrets/permissions.js.map +1 -0
- package/src/secrets/personal-command.d.ts +83 -0
- package/src/secrets/personal-command.js +197 -0
- package/src/secrets/personal-command.js.map +1 -0
- package/src/secrets/personal-ledger.d.ts +21 -0
- package/src/secrets/personal-ledger.js +135 -0
- package/src/secrets/personal-ledger.js.map +1 -0
- package/src/secrets/registry.d.ts +9 -0
- package/src/secrets/registry.js +86 -0
- package/src/secrets/registry.js.map +1 -0
- package/src/secrets/verification.d.ts +18 -0
- package/src/secrets/verification.js +139 -0
- package/src/secrets/verification.js.map +1 -0
- package/src/secrets/workload-access.d.ts +46 -0
- package/src/secrets/workload-access.js +163 -0
- package/src/secrets/workload-access.js.map +1 -0
- package/src/supply-chain/action-pins.d.ts +26 -0
- package/src/supply-chain/action-pins.js +208 -0
- package/src/supply-chain/action-pins.js.map +1 -0
- package/src/supply-chain/blueprint-trust-git.d.ts +130 -0
- package/src/supply-chain/blueprint-trust-git.js +1581 -0
- package/src/supply-chain/blueprint-trust-git.js.map +1 -0
- package/src/supply-chain/blueprint-trust-process.d.ts +4 -0
- package/src/supply-chain/blueprint-trust-process.js +88 -0
- package/src/supply-chain/blueprint-trust-process.js.map +1 -0
- package/src/supply-chain/blueprint-trust.d.ts +354 -0
- package/src/supply-chain/blueprint-trust.js +1558 -0
- package/src/supply-chain/blueprint-trust.js.map +1 -0
- package/src/supply-chain/blueprint-verification-authority.d.ts +62 -0
- package/src/supply-chain/blueprint-verification-authority.js +588 -0
- package/src/supply-chain/blueprint-verification-authority.js.map +1 -0
- package/src/supply-chain/blueprint-verification-execution.d.ts +68 -0
- package/src/supply-chain/blueprint-verification-execution.js +624 -0
- package/src/supply-chain/blueprint-verification-execution.js.map +1 -0
- package/src/supply-chain/build-output.d.ts +35 -0
- package/src/supply-chain/build-output.js +398 -0
- package/src/supply-chain/build-output.js.map +1 -0
- package/src/supply-chain/common.d.ts +21 -0
- package/src/supply-chain/common.js +107 -0
- package/src/supply-chain/common.js.map +1 -0
- package/src/supply-chain/container-artifact-contract.d.ts +23 -0
- package/src/supply-chain/container-artifact-contract.js +208 -0
- package/src/supply-chain/container-artifact-contract.js.map +1 -0
- package/src/supply-chain/container-release.d.ts +119 -0
- package/src/supply-chain/container-release.js +496 -0
- package/src/supply-chain/container-release.js.map +1 -0
- package/src/supply-chain/ecr-applicability.d.ts +19 -0
- package/src/supply-chain/ecr-applicability.js +103 -0
- package/src/supply-chain/ecr-applicability.js.map +1 -0
- package/src/supply-chain/ecr-scanning.d.ts +83 -0
- package/src/supply-chain/ecr-scanning.js +321 -0
- package/src/supply-chain/ecr-scanning.js.map +1 -0
- package/src/supply-chain/ecs-deployed-image.d.ts +85 -0
- package/src/supply-chain/ecs-deployed-image.js +300 -0
- package/src/supply-chain/ecs-deployed-image.js.map +1 -0
- package/src/supply-chain/errors.d.ts +6 -0
- package/src/supply-chain/errors.js +15 -0
- package/src/supply-chain/errors.js.map +1 -0
- package/src/supply-chain/generated-blueprint-trust-command.d.ts +4 -0
- package/src/supply-chain/generated-blueprint-trust-command.js +1362 -0
- package/src/supply-chain/generated-blueprint-trust-command.js.map +1 -0
- package/src/supply-chain/generated-command.d.ts +1 -0
- package/src/supply-chain/generated-command.js +687 -0
- package/src/supply-chain/generated-command.js.map +1 -0
- package/src/supply-chain/generated-container-release-command.d.ts +16 -0
- package/src/supply-chain/generated-container-release-command.js +2087 -0
- package/src/supply-chain/generated-container-release-command.js.map +1 -0
- package/src/supply-chain/generated-ecr-collector-command.d.ts +21 -0
- package/src/supply-chain/generated-ecr-collector-command.js +1338 -0
- package/src/supply-chain/generated-ecr-collector-command.js.map +1 -0
- package/src/supply-chain/generated-files.d.ts +13 -0
- package/src/supply-chain/generated-files.js +401 -0
- package/src/supply-chain/generated-files.js.map +1 -0
- package/src/supply-chain/generated-scanner-command.d.ts +1 -0
- package/src/supply-chain/generated-scanner-command.js +718 -0
- package/src/supply-chain/generated-scanner-command.js.map +1 -0
- package/src/supply-chain/index.d.ts +28 -0
- package/src/supply-chain/index.js +35 -0
- package/src/supply-chain/index.js.map +1 -0
- package/src/supply-chain/inventory.d.ts +79 -0
- package/src/supply-chain/inventory.js +717 -0
- package/src/supply-chain/inventory.js.map +1 -0
- package/src/supply-chain/license-expression.d.ts +7 -0
- package/src/supply-chain/license-expression.js +128 -0
- package/src/supply-chain/license-expression.js.map +1 -0
- package/src/supply-chain/pnpm-toolchain-authority.d.ts +31 -0
- package/src/supply-chain/pnpm-toolchain-authority.js +316 -0
- package/src/supply-chain/pnpm-toolchain-authority.js.map +1 -0
- package/src/supply-chain/policy.d.ts +105 -0
- package/src/supply-chain/policy.js +301 -0
- package/src/supply-chain/policy.js.map +1 -0
- package/src/supply-chain/publication.d.ts +48 -0
- package/src/supply-chain/publication.js +85 -0
- package/src/supply-chain/publication.js.map +1 -0
- package/src/supply-chain/sbom.d.ts +228 -0
- package/src/supply-chain/sbom.js +826 -0
- package/src/supply-chain/sbom.js.map +1 -0
- package/src/supply-chain/scanner.d.ts +77 -0
- package/src/supply-chain/scanner.js +502 -0
- package/src/supply-chain/scanner.js.map +1 -0
- package/src/supply-chain/vendored-source.d.ts +95 -0
- package/src/supply-chain/vendored-source.js +315 -0
- package/src/supply-chain/vendored-source.js.map +1 -0
- package/src/testing-evidence/fixture-scope.d.ts +52 -0
- package/src/testing-evidence/fixture-scope.js +140 -0
- package/src/testing-evidence/fixture-scope.js.map +1 -0
- package/src/testing-evidence/index.d.ts +5 -0
- package/src/testing-evidence/index.js +9 -0
- package/src/testing-evidence/index.js.map +1 -0
- package/src/testing-evidence/quarantine.d.ts +48 -0
- package/src/testing-evidence/quarantine.js +253 -0
- package/src/testing-evidence/quarantine.js.map +1 -0
- package/src/testing-evidence/result.d.ts +108 -0
- package/src/testing-evidence/result.js +571 -0
- package/src/testing-evidence/result.js.map +1 -0
- package/src/testing-evidence/runner-adapter.d.ts +51 -0
- package/src/testing-evidence/runner-adapter.js +288 -0
- package/src/testing-evidence/runner-adapter.js.map +1 -0
- package/src/testing-evidence/sensitive-artifacts.d.ts +13 -0
- package/src/testing-evidence/sensitive-artifacts.js +93 -0
- package/src/testing-evidence/sensitive-artifacts.js.map +1 -0
- package/src/work-markers/work-markers.js +4 -3
- package/src/work-markers/work-markers.js.map +1 -1
- package/src/workload-roles/account-baseline.d.ts +132 -0
- package/src/workload-roles/account-baseline.js +743 -0
- package/src/workload-roles/account-baseline.js.map +1 -0
- package/src/workload-roles/authority.d.ts +38 -0
- package/src/workload-roles/authority.js +156 -0
- package/src/workload-roles/authority.js.map +1 -0
- package/src/workload-roles/aws-adapter.d.ts +99 -0
- package/src/workload-roles/aws-adapter.js +416 -0
- package/src/workload-roles/aws-adapter.js.map +1 -0
- package/src/workload-roles/aws-internal-handler.d.ts +27 -0
- package/src/workload-roles/aws-internal-handler.js +58 -0
- package/src/workload-roles/aws-internal-handler.js.map +1 -0
- package/src/workload-roles/aws-s3-state.d.ts +52 -0
- package/src/workload-roles/aws-s3-state.js +164 -0
- package/src/workload-roles/aws-s3-state.js.map +1 -0
- package/src/workload-roles/aws-sdk-control-plane.d.ts +12 -0
- package/src/workload-roles/aws-sdk-control-plane.js +291 -0
- package/src/workload-roles/aws-sdk-control-plane.js.map +1 -0
- package/src/workload-roles/boundary.d.ts +33 -0
- package/src/workload-roles/boundary.js +130 -0
- package/src/workload-roles/boundary.js.map +1 -0
- package/src/workload-roles/convergence.d.ts +66 -0
- package/src/workload-roles/convergence.js +186 -0
- package/src/workload-roles/convergence.js.map +1 -0
- package/src/workload-roles/effective-policy.d.ts +51 -0
- package/src/workload-roles/effective-policy.js +183 -0
- package/src/workload-roles/effective-policy.js.map +1 -0
- package/src/workload-roles/handler.d.ts +43 -0
- package/src/workload-roles/handler.js +130 -0
- package/src/workload-roles/handler.js.map +1 -0
- package/src/workload-roles/history.d.ts +47 -0
- package/src/workload-roles/history.js +324 -0
- package/src/workload-roles/history.js.map +1 -0
- package/src/workload-roles/index.d.ts +17 -0
- package/src/workload-roles/index.js +21 -0
- package/src/workload-roles/index.js.map +1 -0
- package/src/workload-roles/injection.d.ts +119 -0
- package/src/workload-roles/injection.js +495 -0
- package/src/workload-roles/injection.js.map +1 -0
- package/src/workload-roles/manifest.d.ts +54 -0
- package/src/workload-roles/manifest.js +343 -0
- package/src/workload-roles/manifest.js.map +1 -0
- package/src/workload-roles/provisioner.d.ts +70 -0
- package/src/workload-roles/provisioner.js +231 -0
- package/src/workload-roles/provisioner.js.map +1 -0
- package/src/workload-roles/registration.d.ts +101 -0
- package/src/workload-roles/registration.js +457 -0
- package/src/workload-roles/registration.js.map +1 -0
- package/src/workload-roles/stage-boundary.d.ts +31 -0
- package/src/workload-roles/stage-boundary.js +208 -0
- package/src/workload-roles/stage-boundary.js.map +1 -0
- package/src/workload-roles/standard-slice.d.ts +54 -0
- package/src/workload-roles/standard-slice.js +252 -0
- package/src/workload-roles/standard-slice.js.map +1 -0
- package/migrations/standard-pre-v1-to-v1.md +0 -11
- package/src/foundation/aurora-logical-database.d.ts +0 -76
- package/src/foundation/aurora-logical-database.js +0 -419
- package/src/foundation/aurora-logical-database.js.map +0 -1
|
@@ -0,0 +1,1186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderProductApiFiles = renderProductApiFiles;
|
|
4
|
+
const built_in_plan_shared_js_1 = require("./built-in-plan-shared.js");
|
|
5
|
+
/** @internal */
|
|
6
|
+
function renderProductApiFiles(name, pascalName, workspace) {
|
|
7
|
+
const identifierPrefix = (0, built_in_plan_shared_js_1.lowerCamelIdentifier)(pascalName);
|
|
8
|
+
return {
|
|
9
|
+
'api/health.ts': `import { createContractHttpJsonHandler } from '@empire-builder-kit/runtime/api-server';
|
|
10
|
+
import { ${identifierPrefix}Health } from './contracts/protected.js';
|
|
11
|
+
|
|
12
|
+
export const handler = createContractHttpJsonHandler({
|
|
13
|
+
component: 'api-health',
|
|
14
|
+
operation: ${identifierPrefix}Health,
|
|
15
|
+
workspace: '${workspace}',
|
|
16
|
+
handle: () => ({
|
|
17
|
+
service: '${name}',
|
|
18
|
+
sourceCommit: process.env.EBK_SOURCE_COMMIT ?? 'unresolved',
|
|
19
|
+
stage: process.env.EBK_STAGE ?? 'development',
|
|
20
|
+
status: 'ok',
|
|
21
|
+
}),
|
|
22
|
+
});
|
|
23
|
+
`,
|
|
24
|
+
'web/src/app/api/health/route.ts': `import 'server-only';
|
|
25
|
+
import { observeNextOperation } from '../../../lib/server-logging';
|
|
26
|
+
|
|
27
|
+
export function GET(request: Request) {
|
|
28
|
+
return observeNextOperation({
|
|
29
|
+
feature: 'operations',
|
|
30
|
+
operation: 'health',
|
|
31
|
+
request,
|
|
32
|
+
handle: () => Response.json({
|
|
33
|
+
service: '${name}-web',
|
|
34
|
+
sourceCommit: process.env.EBK_SOURCE_COMMIT ?? 'unresolved',
|
|
35
|
+
stage: process.env.EBK_STAGE ?? 'development',
|
|
36
|
+
status: 'ok',
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
`,
|
|
41
|
+
'api/protected.ts': `import type { RuntimeHttpEvent } from '@empire-builder-kit/runtime';
|
|
42
|
+
import type { Principal } from '@empire-builder-kit/runtime/auth';
|
|
43
|
+
import { createContractHttpJsonHandler } from '@empire-builder-kit/runtime/api-server';
|
|
44
|
+
import { authorize${pascalName}Operation } from '../authorization/runtime.js';
|
|
45
|
+
import { ${identifierPrefix}ProtectedExample } from './contracts/protected.js';
|
|
46
|
+
|
|
47
|
+
export const handler = createContractHttpJsonHandler<
|
|
48
|
+
typeof ${identifierPrefix}ProtectedExample,
|
|
49
|
+
RuntimeHttpEvent,
|
|
50
|
+
Principal
|
|
51
|
+
>({
|
|
52
|
+
component: 'api-protected',
|
|
53
|
+
operation: ${identifierPrefix}ProtectedExample,
|
|
54
|
+
workspace: '${workspace}',
|
|
55
|
+
authorize: authorize${pascalName}Operation,
|
|
56
|
+
handle: () => ({ message: 'Authenticated request accepted.' }),
|
|
57
|
+
});
|
|
58
|
+
`,
|
|
59
|
+
'api/machine-authorization.ts': `import type { RuntimeHttpEvent } from '@empire-builder-kit/runtime';
|
|
60
|
+
import type { Principal } from '@empire-builder-kit/runtime/auth';
|
|
61
|
+
import { createContractHttpJsonHandler } from '@empire-builder-kit/runtime/api-server';
|
|
62
|
+
import { authorize${pascalName}Operation } from '../authorization/runtime.js';
|
|
63
|
+
import {
|
|
64
|
+
${identifierPrefix}MachineAuthorizationProof,
|
|
65
|
+
} from './contracts/protected.js';
|
|
66
|
+
|
|
67
|
+
export const handler = createContractHttpJsonHandler<
|
|
68
|
+
typeof ${identifierPrefix}MachineAuthorizationProof,
|
|
69
|
+
RuntimeHttpEvent,
|
|
70
|
+
Principal
|
|
71
|
+
>({
|
|
72
|
+
component: 'machine-authorization-proof-target',
|
|
73
|
+
operation: ${identifierPrefix}MachineAuthorizationProof,
|
|
74
|
+
workspace: '${workspace}',
|
|
75
|
+
authorize: authorize${pascalName}Operation,
|
|
76
|
+
handle: () => ({ message: 'Machine authorization accepted.' }),
|
|
77
|
+
});
|
|
78
|
+
`,
|
|
79
|
+
'api/delegations.ts': `import type { RuntimeHttpEvent } from '@empire-builder-kit/runtime';
|
|
80
|
+
import type { Principal } from '@empire-builder-kit/runtime/auth';
|
|
81
|
+
import { createContractHttpJsonHandler } from '@empire-builder-kit/runtime/api-server';
|
|
82
|
+
import {
|
|
83
|
+
issue${pascalName}RecordDelegation,
|
|
84
|
+
revoke${pascalName}RecordDelegation,
|
|
85
|
+
use${pascalName}RecordDelegation,
|
|
86
|
+
} from '../authorization/workflows.js';
|
|
87
|
+
import { authorize${pascalName}Operation } from '../authorization/runtime.js';
|
|
88
|
+
import {
|
|
89
|
+
${identifierPrefix}IssueRecordDelegation,
|
|
90
|
+
${identifierPrefix}RevokeRecordDelegation,
|
|
91
|
+
${identifierPrefix}UseRecordDelegation,
|
|
92
|
+
} from './contracts/protected.js';
|
|
93
|
+
|
|
94
|
+
export const issueHandler = createContractHttpJsonHandler<
|
|
95
|
+
typeof ${identifierPrefix}IssueRecordDelegation,
|
|
96
|
+
RuntimeHttpEvent,
|
|
97
|
+
Principal
|
|
98
|
+
>({
|
|
99
|
+
component: 'authorization-delegations',
|
|
100
|
+
operation: ${identifierPrefix}IssueRecordDelegation,
|
|
101
|
+
workspace: '${workspace}',
|
|
102
|
+
authorize: authorize${pascalName}Operation,
|
|
103
|
+
async handle({ context, principal, request }) {
|
|
104
|
+
const issued = await issue${pascalName}RecordDelegation({
|
|
105
|
+
correlationId: context.correlationId,
|
|
106
|
+
expiresAt: request.body.expiresAt,
|
|
107
|
+
principal,
|
|
108
|
+
purposeReference: request.body.purposeReference,
|
|
109
|
+
recordId: request.path.recordId,
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
capability: issued.capability,
|
|
113
|
+
delegationId: issued.grant.id,
|
|
114
|
+
expiresAt: issued.grant.expiresAt,
|
|
115
|
+
status: 'active' as const,
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
export const useHandler = createContractHttpJsonHandler<
|
|
121
|
+
typeof ${identifierPrefix}UseRecordDelegation,
|
|
122
|
+
RuntimeHttpEvent,
|
|
123
|
+
Principal
|
|
124
|
+
>({
|
|
125
|
+
component: 'authorization-delegations',
|
|
126
|
+
operation: ${identifierPrefix}UseRecordDelegation,
|
|
127
|
+
workspace: '${workspace}',
|
|
128
|
+
authorize: authorize${pascalName}Operation,
|
|
129
|
+
handle: ({ context, principal, request }) =>
|
|
130
|
+
use${pascalName}RecordDelegation({
|
|
131
|
+
capability: request.body.capability,
|
|
132
|
+
correlationId: context.correlationId,
|
|
133
|
+
delegationId: request.path.delegationId,
|
|
134
|
+
principal,
|
|
135
|
+
recordId: request.path.recordId,
|
|
136
|
+
}),
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export const revokeHandler = createContractHttpJsonHandler<
|
|
140
|
+
typeof ${identifierPrefix}RevokeRecordDelegation,
|
|
141
|
+
RuntimeHttpEvent,
|
|
142
|
+
Principal
|
|
143
|
+
>({
|
|
144
|
+
component: 'authorization-delegations',
|
|
145
|
+
operation: ${identifierPrefix}RevokeRecordDelegation,
|
|
146
|
+
workspace: '${workspace}',
|
|
147
|
+
authorize: authorize${pascalName}Operation,
|
|
148
|
+
async handle({ context, principal, request }) {
|
|
149
|
+
const grant = await revoke${pascalName}RecordDelegation({
|
|
150
|
+
correlationId: context.correlationId,
|
|
151
|
+
delegationId: request.path.delegationId,
|
|
152
|
+
principal,
|
|
153
|
+
recordId: request.path.recordId,
|
|
154
|
+
});
|
|
155
|
+
return { delegationId: grant.id, status: 'revoked' as const };
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
`,
|
|
159
|
+
'api/data-retention.ts': `import type { RuntimeHttpEvent } from '@empire-builder-kit/runtime';
|
|
160
|
+
import { createContractHttpJsonHandler } from '@empire-builder-kit/runtime/api-server';
|
|
161
|
+
import type { AuthorizationPrincipal } from '@empire-builder-kit/runtime/authorization';
|
|
162
|
+
import { RuntimeError } from '@empire-builder-kit/runtime/response';
|
|
163
|
+
import {
|
|
164
|
+
authorize${pascalName}DataRightsOperation,
|
|
165
|
+
} from '../authorization/runtime.js';
|
|
166
|
+
import { requireDirectAdmin } from '../data/data-rights-shared.js';
|
|
167
|
+
import {
|
|
168
|
+
decide${pascalName}RetentionApproval,
|
|
169
|
+
request${pascalName}RetentionApproval,
|
|
170
|
+
} from '../data/retention-control.js';
|
|
171
|
+
import {
|
|
172
|
+
${identifierPrefix}DecideRetentionApproval,
|
|
173
|
+
${identifierPrefix}RequestRetentionApproval,
|
|
174
|
+
} from './contracts/protected.js';
|
|
175
|
+
|
|
176
|
+
function mappedError(
|
|
177
|
+
code: string,
|
|
178
|
+
message: string,
|
|
179
|
+
status: number,
|
|
180
|
+
retryable = false,
|
|
181
|
+
): never {
|
|
182
|
+
throw new RuntimeError({ code, message, retryable, status });
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function approvalOutcome(value: string): 'approved' | 'rejected' {
|
|
186
|
+
if (value === 'approved' || value === 'rejected') return value;
|
|
187
|
+
return mappedError(
|
|
188
|
+
'data_retention_input_invalid',
|
|
189
|
+
'The retention review request is invalid.',
|
|
190
|
+
400,
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async function retentionReview<Result>(
|
|
195
|
+
operation: () => Promise<Result>,
|
|
196
|
+
): Promise<Result> {
|
|
197
|
+
try {
|
|
198
|
+
return await operation();
|
|
199
|
+
} catch (error) {
|
|
200
|
+
if (error instanceof RuntimeError) throw error;
|
|
201
|
+
const detail = error instanceof Error ? error.message : '';
|
|
202
|
+
if (/not found/i.test(detail)) {
|
|
203
|
+
mappedError(
|
|
204
|
+
'data_retention_report_not_found',
|
|
205
|
+
'The retention report was not found.',
|
|
206
|
+
404,
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
if (/direct admin/i.test(detail)) {
|
|
210
|
+
mappedError(
|
|
211
|
+
'authorization_denied',
|
|
212
|
+
'Authorization was denied.',
|
|
213
|
+
403,
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
if (/no longer reviewable|already has an approval/i.test(detail)) {
|
|
217
|
+
mappedError(
|
|
218
|
+
'data_retention_not_reviewable',
|
|
219
|
+
'The retention report is no longer reviewable.',
|
|
220
|
+
409,
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
if (/approval|bound to the report|does not match/i.test(detail)) {
|
|
224
|
+
mappedError(
|
|
225
|
+
'data_retention_approval_invalid',
|
|
226
|
+
'The retention approval is invalid for this report.',
|
|
227
|
+
409,
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
if (/invalid|requires/i.test(detail)) {
|
|
231
|
+
mappedError(
|
|
232
|
+
'data_retention_input_invalid',
|
|
233
|
+
'The retention review request is invalid.',
|
|
234
|
+
400,
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
mappedError(
|
|
238
|
+
'data_retention_retry_required',
|
|
239
|
+
'Retention review persistence requires retry.',
|
|
240
|
+
503,
|
|
241
|
+
true,
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export const requestRetentionApprovalHandler =
|
|
247
|
+
createContractHttpJsonHandler<
|
|
248
|
+
typeof ${identifierPrefix}RequestRetentionApproval,
|
|
249
|
+
RuntimeHttpEvent,
|
|
250
|
+
AuthorizationPrincipal
|
|
251
|
+
>({
|
|
252
|
+
component: 'data-retention-review',
|
|
253
|
+
operation: ${identifierPrefix}RequestRetentionApproval,
|
|
254
|
+
workspace: '${workspace}',
|
|
255
|
+
authorize: authorize${pascalName}DataRightsOperation,
|
|
256
|
+
handle: ({ context, principal, request }) =>
|
|
257
|
+
retentionReview(() =>
|
|
258
|
+
request${pascalName}RetentionApproval({
|
|
259
|
+
correlationId: context.correlationId,
|
|
260
|
+
now: new Date().toISOString(),
|
|
261
|
+
principal: requireDirectAdmin(principal),
|
|
262
|
+
runId: request.path.runId,
|
|
263
|
+
}),
|
|
264
|
+
),
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
export const decideRetentionApprovalHandler =
|
|
268
|
+
createContractHttpJsonHandler<
|
|
269
|
+
typeof ${identifierPrefix}DecideRetentionApproval,
|
|
270
|
+
RuntimeHttpEvent,
|
|
271
|
+
AuthorizationPrincipal
|
|
272
|
+
>({
|
|
273
|
+
component: 'data-retention-review',
|
|
274
|
+
operation: ${identifierPrefix}DecideRetentionApproval,
|
|
275
|
+
workspace: '${workspace}',
|
|
276
|
+
authorize: authorize${pascalName}DataRightsOperation,
|
|
277
|
+
handle: ({ context, principal, request }) =>
|
|
278
|
+
retentionReview(() =>
|
|
279
|
+
decide${pascalName}RetentionApproval({
|
|
280
|
+
approvalRequestId: request.path.approvalRequestId,
|
|
281
|
+
correlationId: context.correlationId,
|
|
282
|
+
expectedRequestDigest: request.body.expectedRequestDigest,
|
|
283
|
+
now: new Date().toISOString(),
|
|
284
|
+
outcome: approvalOutcome(request.body.outcome),
|
|
285
|
+
principal: requireDirectAdmin(principal),
|
|
286
|
+
reasonReference: request.body.reasonReference,
|
|
287
|
+
runId: request.path.runId,
|
|
288
|
+
}),
|
|
289
|
+
),
|
|
290
|
+
});
|
|
291
|
+
`,
|
|
292
|
+
'api/data-rights.ts': `import type { RuntimeHttpEvent } from '@empire-builder-kit/runtime';
|
|
293
|
+
import { createContractHttpJsonHandler } from '@empire-builder-kit/runtime/api-server';
|
|
294
|
+
import type { AuthorizationPrincipal } from '@empire-builder-kit/runtime/authorization';
|
|
295
|
+
import { RuntimeError } from '@empire-builder-kit/runtime/response';
|
|
296
|
+
import { authorize${pascalName}DataRightsOperation } from '../authorization/runtime.js';
|
|
297
|
+
import {
|
|
298
|
+
cleanupExpiredRecordExport,
|
|
299
|
+
decideRecordExport,
|
|
300
|
+
deliverReadyRecordExport,
|
|
301
|
+
executeApprovedRecordExport,
|
|
302
|
+
requestAuthorizedRecordExport,
|
|
303
|
+
} from '../data/record-export.js';
|
|
304
|
+
import {
|
|
305
|
+
expireRecordHold,
|
|
306
|
+
issueRecordHold,
|
|
307
|
+
releaseRecordHold,
|
|
308
|
+
reviewRecordHold,
|
|
309
|
+
} from '../data/record-holds.js';
|
|
310
|
+
import {
|
|
311
|
+
${identifierPrefix}CleanupRecordExport,
|
|
312
|
+
${identifierPrefix}DecideRecordExport,
|
|
313
|
+
${identifierPrefix}DeliverRecordExport,
|
|
314
|
+
${identifierPrefix}ExecuteRecordExport,
|
|
315
|
+
${identifierPrefix}ExpireRecordHold,
|
|
316
|
+
${identifierPrefix}IssueRecordHold,
|
|
317
|
+
${identifierPrefix}ReleaseRecordHold,
|
|
318
|
+
${identifierPrefix}RequestRecordExport,
|
|
319
|
+
${identifierPrefix}ReviewRecordHold,
|
|
320
|
+
} from './contracts/protected.js';
|
|
321
|
+
|
|
322
|
+
function mappedError(
|
|
323
|
+
code: string,
|
|
324
|
+
message: string,
|
|
325
|
+
status: number,
|
|
326
|
+
retryable = false,
|
|
327
|
+
): never {
|
|
328
|
+
throw new RuntimeError({ code, message, retryable, status });
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function approvalOutcome(value: string): 'approved' | 'rejected' {
|
|
332
|
+
if (value === 'approved' || value === 'rejected') return value;
|
|
333
|
+
return mappedError(
|
|
334
|
+
'data_rights_input_invalid',
|
|
335
|
+
'The data-rights request is invalid.',
|
|
336
|
+
400,
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function holdEffect(
|
|
341
|
+
value: string,
|
|
342
|
+
): 'block-deletion' | 'block-export' {
|
|
343
|
+
if (value === 'block-deletion' || value === 'block-export') return value;
|
|
344
|
+
return mappedError(
|
|
345
|
+
'data_rights_input_invalid',
|
|
346
|
+
'The data-rights request is invalid.',
|
|
347
|
+
400,
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function holdPurpose(
|
|
352
|
+
value: string,
|
|
353
|
+
): 'fraud' | 'incident' | 'legal' | 'security' | 'support' {
|
|
354
|
+
if (
|
|
355
|
+
value === 'fraud' ||
|
|
356
|
+
value === 'incident' ||
|
|
357
|
+
value === 'legal' ||
|
|
358
|
+
value === 'security' ||
|
|
359
|
+
value === 'support'
|
|
360
|
+
) {
|
|
361
|
+
return value;
|
|
362
|
+
}
|
|
363
|
+
return mappedError(
|
|
364
|
+
'data_rights_input_invalid',
|
|
365
|
+
'The data-rights request is invalid.',
|
|
366
|
+
400,
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
async function dataRights<Result>(
|
|
371
|
+
kind: 'export' | 'hold',
|
|
372
|
+
operation: () => Promise<Result>,
|
|
373
|
+
): Promise<Result> {
|
|
374
|
+
try {
|
|
375
|
+
return await operation();
|
|
376
|
+
} catch (error) {
|
|
377
|
+
if (error instanceof RuntimeError) throw error;
|
|
378
|
+
const detail = error instanceof Error ? error.message : '';
|
|
379
|
+
if (/not found/i.test(detail)) {
|
|
380
|
+
mappedError('record_not_found', 'The record was not found.', 404);
|
|
381
|
+
}
|
|
382
|
+
if (/rate/i.test(detail)) {
|
|
383
|
+
mappedError(
|
|
384
|
+
'data_export_rate_limited',
|
|
385
|
+
'The bounded confidential export rate was exceeded.',
|
|
386
|
+
429,
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
if (/hold.*block|blocked.*hold/i.test(detail)) {
|
|
390
|
+
mappedError(
|
|
391
|
+
'data_export_held',
|
|
392
|
+
'An active hold blocks the confidential export.',
|
|
393
|
+
409,
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
if (kind === 'export' && /expired/i.test(detail)) {
|
|
397
|
+
mappedError(
|
|
398
|
+
'data_export_expired',
|
|
399
|
+
'The confidential export has expired.',
|
|
400
|
+
410,
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
if (
|
|
404
|
+
kind === 'export' &&
|
|
405
|
+
/not ready|not executable|approval|executing export/i.test(detail)
|
|
406
|
+
) {
|
|
407
|
+
mappedError(
|
|
408
|
+
'data_export_not_ready',
|
|
409
|
+
'The confidential export is not ready.',
|
|
410
|
+
409,
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
if (kind === 'hold') {
|
|
414
|
+
mappedError(
|
|
415
|
+
'record_hold_invalid',
|
|
416
|
+
'The record hold cannot make the requested transition.',
|
|
417
|
+
409,
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
if (/invalid|requires|bounded|future/i.test(detail)) {
|
|
421
|
+
mappedError(
|
|
422
|
+
'data_rights_input_invalid',
|
|
423
|
+
'The data-rights request is invalid.',
|
|
424
|
+
400,
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
mappedError(
|
|
428
|
+
'data_export_retry_required',
|
|
429
|
+
'Confidential export processing requires retry.',
|
|
430
|
+
503,
|
|
431
|
+
true,
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function holdResponse(hold: {
|
|
437
|
+
expiresAt: string;
|
|
438
|
+
holdId: string;
|
|
439
|
+
reviewAt: string;
|
|
440
|
+
status: 'active' | 'released';
|
|
441
|
+
}) {
|
|
442
|
+
return {
|
|
443
|
+
expiresAt: hold.expiresAt,
|
|
444
|
+
holdId: hold.holdId,
|
|
445
|
+
reviewAt: hold.reviewAt,
|
|
446
|
+
status: hold.status,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export const requestExportHandler = createContractHttpJsonHandler<
|
|
451
|
+
typeof ${identifierPrefix}RequestRecordExport,
|
|
452
|
+
RuntimeHttpEvent,
|
|
453
|
+
AuthorizationPrincipal
|
|
454
|
+
>({
|
|
455
|
+
component: 'data-rights',
|
|
456
|
+
operation: ${identifierPrefix}RequestRecordExport,
|
|
457
|
+
workspace: '${workspace}',
|
|
458
|
+
authorize: authorize${pascalName}DataRightsOperation,
|
|
459
|
+
handle: ({ context, principal, request }) =>
|
|
460
|
+
dataRights('export', () =>
|
|
461
|
+
requestAuthorizedRecordExport({
|
|
462
|
+
correlationId: context.correlationId,
|
|
463
|
+
principal,
|
|
464
|
+
recordId: request.path.recordId,
|
|
465
|
+
}),
|
|
466
|
+
),
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
export const decideExportHandler = createContractHttpJsonHandler<
|
|
470
|
+
typeof ${identifierPrefix}DecideRecordExport,
|
|
471
|
+
RuntimeHttpEvent,
|
|
472
|
+
AuthorizationPrincipal
|
|
473
|
+
>({
|
|
474
|
+
component: 'data-rights',
|
|
475
|
+
operation: ${identifierPrefix}DecideRecordExport,
|
|
476
|
+
workspace: '${workspace}',
|
|
477
|
+
authorize: authorize${pascalName}DataRightsOperation,
|
|
478
|
+
async handle({ context, principal, request }) {
|
|
479
|
+
const result = await dataRights('export', () =>
|
|
480
|
+
decideRecordExport({
|
|
481
|
+
approvalRequestId: request.path.approvalRequestId,
|
|
482
|
+
correlationId: context.correlationId,
|
|
483
|
+
expectedRequestDigest: request.body.expectedRequestDigest,
|
|
484
|
+
outcome: approvalOutcome(request.body.outcome),
|
|
485
|
+
principal,
|
|
486
|
+
reasonReference: request.body.reasonReference,
|
|
487
|
+
recordId: request.path.recordId,
|
|
488
|
+
}),
|
|
489
|
+
);
|
|
490
|
+
return {
|
|
491
|
+
approvalRequestId: request.path.approvalRequestId,
|
|
492
|
+
status: result.status,
|
|
493
|
+
};
|
|
494
|
+
},
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
export const executeExportHandler = createContractHttpJsonHandler<
|
|
498
|
+
typeof ${identifierPrefix}ExecuteRecordExport,
|
|
499
|
+
RuntimeHttpEvent,
|
|
500
|
+
AuthorizationPrincipal
|
|
501
|
+
>({
|
|
502
|
+
component: 'data-rights',
|
|
503
|
+
operation: ${identifierPrefix}ExecuteRecordExport,
|
|
504
|
+
workspace: '${workspace}',
|
|
505
|
+
authorize: authorize${pascalName}DataRightsOperation,
|
|
506
|
+
handle: ({ context, principal, request }) =>
|
|
507
|
+
dataRights('export', () =>
|
|
508
|
+
executeApprovedRecordExport({
|
|
509
|
+
approvalRequestId: request.path.approvalRequestId,
|
|
510
|
+
correlationId: context.correlationId,
|
|
511
|
+
principal,
|
|
512
|
+
recordId: request.path.recordId,
|
|
513
|
+
}),
|
|
514
|
+
),
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
export const deliverExportHandler = createContractHttpJsonHandler<
|
|
518
|
+
typeof ${identifierPrefix}DeliverRecordExport,
|
|
519
|
+
RuntimeHttpEvent,
|
|
520
|
+
AuthorizationPrincipal
|
|
521
|
+
>({
|
|
522
|
+
component: 'data-rights',
|
|
523
|
+
operation: ${identifierPrefix}DeliverRecordExport,
|
|
524
|
+
workspace: '${workspace}',
|
|
525
|
+
authorize: authorize${pascalName}DataRightsOperation,
|
|
526
|
+
handle: ({ context, principal, request }) =>
|
|
527
|
+
dataRights('export', () =>
|
|
528
|
+
deliverReadyRecordExport({
|
|
529
|
+
approvalRequestId: request.path.approvalRequestId,
|
|
530
|
+
correlationId: context.correlationId,
|
|
531
|
+
principal,
|
|
532
|
+
recordId: request.path.recordId,
|
|
533
|
+
}),
|
|
534
|
+
),
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
export const cleanupExportHandler = createContractHttpJsonHandler<
|
|
538
|
+
typeof ${identifierPrefix}CleanupRecordExport,
|
|
539
|
+
RuntimeHttpEvent,
|
|
540
|
+
AuthorizationPrincipal
|
|
541
|
+
>({
|
|
542
|
+
component: 'data-rights',
|
|
543
|
+
operation: ${identifierPrefix}CleanupRecordExport,
|
|
544
|
+
workspace: '${workspace}',
|
|
545
|
+
authorize: authorize${pascalName}DataRightsOperation,
|
|
546
|
+
handle: ({ context, principal, request }) =>
|
|
547
|
+
dataRights('export', () =>
|
|
548
|
+
cleanupExpiredRecordExport({
|
|
549
|
+
approvalRequestId: request.path.approvalRequestId,
|
|
550
|
+
correlationId: context.correlationId,
|
|
551
|
+
principal,
|
|
552
|
+
recordId: request.path.recordId,
|
|
553
|
+
}),
|
|
554
|
+
),
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
export const issueHoldHandler = createContractHttpJsonHandler<
|
|
558
|
+
typeof ${identifierPrefix}IssueRecordHold,
|
|
559
|
+
RuntimeHttpEvent,
|
|
560
|
+
AuthorizationPrincipal
|
|
561
|
+
>({
|
|
562
|
+
component: 'data-rights',
|
|
563
|
+
operation: ${identifierPrefix}IssueRecordHold,
|
|
564
|
+
workspace: '${workspace}',
|
|
565
|
+
authorize: authorize${pascalName}DataRightsOperation,
|
|
566
|
+
async handle({ context, principal, request }) {
|
|
567
|
+
const hold = await dataRights('hold', () =>
|
|
568
|
+
issueRecordHold({
|
|
569
|
+
correlationId: context.correlationId,
|
|
570
|
+
effects: request.body.effects.map(holdEffect),
|
|
571
|
+
expiresAt: request.body.expiresAt,
|
|
572
|
+
principal,
|
|
573
|
+
purpose: holdPurpose(request.body.purpose),
|
|
574
|
+
recordId: request.path.recordId,
|
|
575
|
+
reviewAt: request.body.reviewAt,
|
|
576
|
+
}),
|
|
577
|
+
);
|
|
578
|
+
return holdResponse(hold);
|
|
579
|
+
},
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
export const reviewHoldHandler = createContractHttpJsonHandler<
|
|
583
|
+
typeof ${identifierPrefix}ReviewRecordHold,
|
|
584
|
+
RuntimeHttpEvent,
|
|
585
|
+
AuthorizationPrincipal
|
|
586
|
+
>({
|
|
587
|
+
component: 'data-rights',
|
|
588
|
+
operation: ${identifierPrefix}ReviewRecordHold,
|
|
589
|
+
workspace: '${workspace}',
|
|
590
|
+
authorize: authorize${pascalName}DataRightsOperation,
|
|
591
|
+
async handle({ context, principal, request }) {
|
|
592
|
+
const hold = await dataRights('hold', () =>
|
|
593
|
+
reviewRecordHold({
|
|
594
|
+
correlationId: context.correlationId,
|
|
595
|
+
expiresAt: request.body.expiresAt,
|
|
596
|
+
holdId: request.path.holdId,
|
|
597
|
+
principal,
|
|
598
|
+
recordId: request.path.recordId,
|
|
599
|
+
reviewAt: request.body.reviewAt,
|
|
600
|
+
}),
|
|
601
|
+
);
|
|
602
|
+
return holdResponse(hold);
|
|
603
|
+
},
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
export const releaseHoldHandler = createContractHttpJsonHandler<
|
|
607
|
+
typeof ${identifierPrefix}ReleaseRecordHold,
|
|
608
|
+
RuntimeHttpEvent,
|
|
609
|
+
AuthorizationPrincipal
|
|
610
|
+
>({
|
|
611
|
+
component: 'data-rights',
|
|
612
|
+
operation: ${identifierPrefix}ReleaseRecordHold,
|
|
613
|
+
workspace: '${workspace}',
|
|
614
|
+
authorize: authorize${pascalName}DataRightsOperation,
|
|
615
|
+
async handle({ context, principal, request }) {
|
|
616
|
+
const hold = await dataRights('hold', () =>
|
|
617
|
+
releaseRecordHold({
|
|
618
|
+
correlationId: context.correlationId,
|
|
619
|
+
holdId: request.path.holdId,
|
|
620
|
+
principal,
|
|
621
|
+
recordId: request.path.recordId,
|
|
622
|
+
}),
|
|
623
|
+
);
|
|
624
|
+
return holdResponse(hold);
|
|
625
|
+
},
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
export const expireHoldHandler = createContractHttpJsonHandler<
|
|
629
|
+
typeof ${identifierPrefix}ExpireRecordHold,
|
|
630
|
+
RuntimeHttpEvent,
|
|
631
|
+
AuthorizationPrincipal
|
|
632
|
+
>({
|
|
633
|
+
component: 'data-rights',
|
|
634
|
+
operation: ${identifierPrefix}ExpireRecordHold,
|
|
635
|
+
workspace: '${workspace}',
|
|
636
|
+
authorize: authorize${pascalName}DataRightsOperation,
|
|
637
|
+
async handle({ context, principal, request }) {
|
|
638
|
+
const hold = await dataRights('hold', () =>
|
|
639
|
+
expireRecordHold({
|
|
640
|
+
correlationId: context.correlationId,
|
|
641
|
+
holdId: request.path.holdId,
|
|
642
|
+
principal,
|
|
643
|
+
recordId: request.path.recordId,
|
|
644
|
+
}),
|
|
645
|
+
);
|
|
646
|
+
return holdResponse(hold);
|
|
647
|
+
},
|
|
648
|
+
});
|
|
649
|
+
`,
|
|
650
|
+
'database/runtime-client.ts': `import {
|
|
651
|
+
databaseTlsOptions,
|
|
652
|
+
runWithDatabaseCredential,
|
|
653
|
+
type LinkedDatabaseResource,
|
|
654
|
+
} from '@empire-builder-kit/runtime/database';
|
|
655
|
+
import { createLogger } from '@empire-builder-kit/runtime/logging';
|
|
656
|
+
import { createMetricEmitter } from '@empire-builder-kit/runtime/observability';
|
|
657
|
+
import {
|
|
658
|
+
bindServerSecretRuntime,
|
|
659
|
+
createAwsSecretsManagerSource,
|
|
660
|
+
createSecretResolverObservability,
|
|
661
|
+
createServerSecretResolver,
|
|
662
|
+
} from '@empire-builder-kit/runtime/secrets';
|
|
663
|
+
import pg, { type Client as PgClient } from 'pg';
|
|
664
|
+
import { Resource } from 'sst/resource';
|
|
665
|
+
import { Secrets } from '../secrets/declarations';
|
|
666
|
+
|
|
667
|
+
const { Client } = pg;
|
|
668
|
+
const secretResolvers = new Map<
|
|
669
|
+
string,
|
|
670
|
+
ReturnType<typeof createServerSecretResolver>
|
|
671
|
+
>();
|
|
672
|
+
|
|
673
|
+
function getSecretResolver(workload: string) {
|
|
674
|
+
const existing = secretResolvers.get(workload);
|
|
675
|
+
if (existing) return existing;
|
|
676
|
+
const stage = process.env.EBK_STAGE ?? '';
|
|
677
|
+
const logger = createLogger({
|
|
678
|
+
component: workload,
|
|
679
|
+
feature: 'secret-management',
|
|
680
|
+
operation: 'secret.resolve',
|
|
681
|
+
slice: '${name}',
|
|
682
|
+
stage,
|
|
683
|
+
workspace: '${workspace}',
|
|
684
|
+
});
|
|
685
|
+
const resolver = createServerSecretResolver({
|
|
686
|
+
binding: bindServerSecretRuntime({
|
|
687
|
+
stage,
|
|
688
|
+
workload: '${name}.' + workload,
|
|
689
|
+
}),
|
|
690
|
+
hooks: createSecretResolverObservability({
|
|
691
|
+
logger,
|
|
692
|
+
metrics: createMetricEmitter(),
|
|
693
|
+
slice: '${name}',
|
|
694
|
+
stage,
|
|
695
|
+
}),
|
|
696
|
+
source: createAwsSecretsManagerSource(),
|
|
697
|
+
});
|
|
698
|
+
secretResolvers.set(workload, resolver);
|
|
699
|
+
return resolver;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
function linkedDatabase(): LinkedDatabaseResource {
|
|
703
|
+
const resource = (Resource as unknown as Record<string, unknown>)
|
|
704
|
+
.${pascalName}PrimaryDatabase;
|
|
705
|
+
if (!resource || typeof resource !== 'object') {
|
|
706
|
+
throw new Error('Primary database resource is not linked.');
|
|
707
|
+
}
|
|
708
|
+
return resource as LinkedDatabaseResource;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
export async function withPrimaryDatabase<Result>(
|
|
712
|
+
context: { correlationId: string },
|
|
713
|
+
workload:
|
|
714
|
+
| 'api-database-health'
|
|
715
|
+
| 'api-database-records'
|
|
716
|
+
| 'async-inbox-cleanup'
|
|
717
|
+
| 'async-outbox-relay'
|
|
718
|
+
| 'async-provider-worker'
|
|
719
|
+
| 'data-export-cleanup'
|
|
720
|
+
| 'data-retention-job'
|
|
721
|
+
| 'event-consumer'
|
|
722
|
+
| 'web-server',
|
|
723
|
+
operation: (client: PgClient) => Promise<Result>,
|
|
724
|
+
): Promise<Result> {
|
|
725
|
+
const resource = linkedDatabase();
|
|
726
|
+
return runWithDatabaseCredential(
|
|
727
|
+
resource,
|
|
728
|
+
resource.provider === 'aws-secrets-manager'
|
|
729
|
+
? {
|
|
730
|
+
context,
|
|
731
|
+
declaration: Secrets.${pascalName}PrimaryDatabaseCredential,
|
|
732
|
+
resolver: getSecretResolver(workload),
|
|
733
|
+
}
|
|
734
|
+
: undefined,
|
|
735
|
+
async (credential) => {
|
|
736
|
+
const client = new Client({
|
|
737
|
+
...credential,
|
|
738
|
+
connectionTimeoutMillis: 10_000,
|
|
739
|
+
ssl: databaseTlsOptions(resource),
|
|
740
|
+
});
|
|
741
|
+
try {
|
|
742
|
+
await client.connect();
|
|
743
|
+
return await operation(client);
|
|
744
|
+
} finally {
|
|
745
|
+
await client.end().catch(() => undefined);
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
(error) =>
|
|
749
|
+
error !== null &&
|
|
750
|
+
typeof error === 'object' &&
|
|
751
|
+
'code' in error &&
|
|
752
|
+
error.code === '28P01',
|
|
753
|
+
);
|
|
754
|
+
}
|
|
755
|
+
`,
|
|
756
|
+
'database/runtime-health.ts': `import type { RuntimeHttpEvent } from '@empire-builder-kit/runtime';
|
|
757
|
+
import type { Principal } from '@empire-builder-kit/runtime/auth';
|
|
758
|
+
import { createContractHttpJsonHandler } from '@empire-builder-kit/runtime/api-server';
|
|
759
|
+
import { ${identifierPrefix}DatabaseHealth } from '../api/contracts/protected.js';
|
|
760
|
+
import { authorize${pascalName}Operation } from '../authorization/runtime.js';
|
|
761
|
+
import { withPrimaryDatabase } from './runtime-client.js';
|
|
762
|
+
|
|
763
|
+
export const handler = createContractHttpJsonHandler<
|
|
764
|
+
typeof ${identifierPrefix}DatabaseHealth,
|
|
765
|
+
RuntimeHttpEvent,
|
|
766
|
+
Principal
|
|
767
|
+
>({
|
|
768
|
+
component: 'database-health',
|
|
769
|
+
operation: ${identifierPrefix}DatabaseHealth,
|
|
770
|
+
workspace: '${workspace}',
|
|
771
|
+
authorize: authorize${pascalName}Operation,
|
|
772
|
+
async handle({ context }) {
|
|
773
|
+
await withPrimaryDatabase(
|
|
774
|
+
context,
|
|
775
|
+
'api-database-health',
|
|
776
|
+
(client) => client.query('SELECT 1'),
|
|
777
|
+
);
|
|
778
|
+
return { service: '${name}', status: 'ok' };
|
|
779
|
+
},
|
|
780
|
+
});
|
|
781
|
+
`,
|
|
782
|
+
'database/records.ts': `import type { RuntimeHttpEvent } from '@empire-builder-kit/runtime';
|
|
783
|
+
import type { Principal } from '@empire-builder-kit/runtime/auth';
|
|
784
|
+
import { createContractHttpJsonHandler } from '@empire-builder-kit/runtime/api-server';
|
|
785
|
+
import type { AuthorizationPrincipal } from '@empire-builder-kit/runtime/authorization';
|
|
786
|
+
import { RuntimeError } from '@empire-builder-kit/runtime/response';
|
|
787
|
+
import {
|
|
788
|
+
${identifierPrefix}GetRecord,
|
|
789
|
+
${identifierPrefix}PutRecord,
|
|
790
|
+
} from '../api/contracts/protected.js';
|
|
791
|
+
import {
|
|
792
|
+
authorize${pascalName}DataRightsOperation,
|
|
793
|
+
authorize${pascalName}Operation,
|
|
794
|
+
} from '../authorization/runtime.js';
|
|
795
|
+
import {
|
|
796
|
+
correctRecordWithLifecycle,
|
|
797
|
+
publishRecordCorrection,
|
|
798
|
+
} from '../data/record-correction.js';
|
|
799
|
+
import { effectiveRecordOwner } from '../data/data-rights-shared.js';
|
|
800
|
+
import { withPrimaryDatabase } from './runtime-client.js';
|
|
801
|
+
|
|
802
|
+
function canonicalTestExpiresAt(value: string | undefined): string | undefined {
|
|
803
|
+
if (value === undefined) return undefined;
|
|
804
|
+
const expiresAt = Date.parse(value);
|
|
805
|
+
const now = Date.now();
|
|
806
|
+
if (
|
|
807
|
+
!Number.isFinite(expiresAt) ||
|
|
808
|
+
new Date(expiresAt).toISOString() !== value ||
|
|
809
|
+
expiresAt <= now ||
|
|
810
|
+
expiresAt - now > 48 * 60 * 60 * 1_000
|
|
811
|
+
) {
|
|
812
|
+
throw new RuntimeError({
|
|
813
|
+
code: 'test_data_expiry_invalid',
|
|
814
|
+
message:
|
|
815
|
+
'Test data expiry must be a canonical future timestamp within 48 hours.',
|
|
816
|
+
retryable: false,
|
|
817
|
+
status: 400,
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
return value;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
function notFound(): never {
|
|
824
|
+
throw new RuntimeError({
|
|
825
|
+
code: 'record_not_found',
|
|
826
|
+
message: 'The record was not found.',
|
|
827
|
+
retryable: false,
|
|
828
|
+
status: 404,
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
export const putHandler = createContractHttpJsonHandler<
|
|
833
|
+
typeof ${identifierPrefix}PutRecord,
|
|
834
|
+
RuntimeHttpEvent,
|
|
835
|
+
AuthorizationPrincipal
|
|
836
|
+
>({
|
|
837
|
+
component: 'database-records',
|
|
838
|
+
operation: ${identifierPrefix}PutRecord,
|
|
839
|
+
workspace: '${workspace}',
|
|
840
|
+
authorize: authorize${pascalName}DataRightsOperation,
|
|
841
|
+
async handle({ context, principal, request }) {
|
|
842
|
+
const testExpiresAt = canonicalTestExpiresAt(request.body.testExpiresAt);
|
|
843
|
+
const ownerId = effectiveRecordOwner(principal);
|
|
844
|
+
const result = await withPrimaryDatabase(context, 'api-database-records', (client) =>
|
|
845
|
+
client.query<{
|
|
846
|
+
id: string;
|
|
847
|
+
name: string;
|
|
848
|
+
runScope: string;
|
|
849
|
+
}>(
|
|
850
|
+
\`INSERT INTO records
|
|
851
|
+
(id, name, owner_id, run_scope, test_expires_at)
|
|
852
|
+
VALUES ($1::uuid, $2, $3, $4, $5::timestamptz)
|
|
853
|
+
ON CONFLICT (id) DO NOTHING
|
|
854
|
+
RETURNING id::text, name, run_scope AS "runScope"\`,
|
|
855
|
+
[
|
|
856
|
+
request.path.recordId,
|
|
857
|
+
request.body.name,
|
|
858
|
+
ownerId,
|
|
859
|
+
request.body.runScope,
|
|
860
|
+
testExpiresAt ?? null,
|
|
861
|
+
],
|
|
862
|
+
),
|
|
863
|
+
);
|
|
864
|
+
const created = result.rows[0];
|
|
865
|
+
if (created) return created;
|
|
866
|
+
const ownership = await withPrimaryDatabase(
|
|
867
|
+
context,
|
|
868
|
+
'api-database-records',
|
|
869
|
+
(client) =>
|
|
870
|
+
client.query<{ ownerId: string }>(
|
|
871
|
+
\`SELECT owner_id AS "ownerId"
|
|
872
|
+
FROM records
|
|
873
|
+
WHERE id = $1::uuid\`,
|
|
874
|
+
[request.path.recordId],
|
|
875
|
+
),
|
|
876
|
+
);
|
|
877
|
+
if (ownership.rows[0]?.ownerId !== ownerId) {
|
|
878
|
+
throw new RuntimeError({
|
|
879
|
+
code: 'record_conflict',
|
|
880
|
+
message: 'The record identifier is owned by another principal.',
|
|
881
|
+
retryable: false,
|
|
882
|
+
status: 409,
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
const corrected = await correctRecordWithLifecycle({
|
|
886
|
+
correlationId: context.correlationId,
|
|
887
|
+
name: request.body.name,
|
|
888
|
+
principal,
|
|
889
|
+
recordId: request.path.recordId,
|
|
890
|
+
runScope: request.body.runScope,
|
|
891
|
+
testExpiresAt,
|
|
892
|
+
});
|
|
893
|
+
const propagation = await publishRecordCorrection(
|
|
894
|
+
context.correlationId,
|
|
895
|
+
corrected.requestRef,
|
|
896
|
+
);
|
|
897
|
+
if (propagation === 'retry-required') {
|
|
898
|
+
throw new RuntimeError({
|
|
899
|
+
code: 'record_correction_retry_required',
|
|
900
|
+
message: 'Record correction propagation requires retry.',
|
|
901
|
+
retryable: true,
|
|
902
|
+
status: 503,
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
return {
|
|
906
|
+
id: corrected.id,
|
|
907
|
+
name: corrected.name,
|
|
908
|
+
runScope: corrected.runScope,
|
|
909
|
+
};
|
|
910
|
+
},
|
|
911
|
+
});
|
|
912
|
+
|
|
913
|
+
export const getHandler = createContractHttpJsonHandler<
|
|
914
|
+
typeof ${identifierPrefix}GetRecord,
|
|
915
|
+
RuntimeHttpEvent,
|
|
916
|
+
Principal
|
|
917
|
+
>({
|
|
918
|
+
component: 'database-records',
|
|
919
|
+
operation: ${identifierPrefix}GetRecord,
|
|
920
|
+
workspace: '${workspace}',
|
|
921
|
+
authorize: authorize${pascalName}Operation,
|
|
922
|
+
async handle({ context, principal, request }) {
|
|
923
|
+
const result = await withPrimaryDatabase(context, 'api-database-records', (client) =>
|
|
924
|
+
client.query<{ id: string; name: string; runScope: string }>(
|
|
925
|
+
\`SELECT id::text, name, run_scope AS "runScope"
|
|
926
|
+
FROM records
|
|
927
|
+
WHERE id = $1::uuid AND owner_id = $2\`,
|
|
928
|
+
[request.path.recordId, principal.id],
|
|
929
|
+
),
|
|
930
|
+
);
|
|
931
|
+
return result.rows[0] ?? notFound();
|
|
932
|
+
},
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
`,
|
|
936
|
+
'api/event-consumer.ts': `import { parseDataLifecycleChangeEvent } from '@empire-builder-kit/runtime/data-lifecycle';
|
|
937
|
+
import { parseSqsEventBridgeRecords, toEventLogContext } from '@empire-builder-kit/runtime/events';
|
|
938
|
+
import { createLogger } from '@empire-builder-kit/runtime/logging';
|
|
939
|
+
import type {
|
|
940
|
+
${pascalName}CreatedData,
|
|
941
|
+
${pascalName}DataLifecycleChangedData,
|
|
942
|
+
} from '../contracts/events.js';
|
|
943
|
+
import {
|
|
944
|
+
${identifierPrefix}AuthorizationActions,
|
|
945
|
+
} from '../authorization/policy.js';
|
|
946
|
+
import {
|
|
947
|
+
authorize${pascalName}InternalOperation,
|
|
948
|
+
} from '../authorization/runtime.js';
|
|
949
|
+
import lifecycleConsumers from '../data/lifecycle-consumers.json';
|
|
950
|
+
import { withPrimaryDatabase } from '../database/runtime-client.js';
|
|
951
|
+
|
|
952
|
+
interface QueueRecord { body: string; messageId: string }
|
|
953
|
+
interface QueueEvent { Records: QueueRecord[] }
|
|
954
|
+
|
|
955
|
+
function acceptedLifecycleSources(): Set<string> {
|
|
956
|
+
const sources = lifecycleConsumers.acceptedSources;
|
|
957
|
+
if (
|
|
958
|
+
lifecycleConsumers.schemaVersion !== 1 ||
|
|
959
|
+
!Array.isArray(sources) ||
|
|
960
|
+
sources.length === 0 ||
|
|
961
|
+
sources.length > 32 ||
|
|
962
|
+
new Set(sources).size !== sources.length ||
|
|
963
|
+
sources.some((source) => !/^[a-z][a-z0-9-]{0,62}$/.test(source))
|
|
964
|
+
) {
|
|
965
|
+
throw new Error(
|
|
966
|
+
'Lifecycle consumer configuration must contain unique bounded Slice sources.',
|
|
967
|
+
);
|
|
968
|
+
}
|
|
969
|
+
return new Set(sources);
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
const lifecycleSources = acceptedLifecycleSources();
|
|
973
|
+
|
|
974
|
+
function requiredEventConsumerWorkloadIdentity(): string {
|
|
975
|
+
const configured = process.env.EBK_WORKLOAD_IDENTITY?.trim();
|
|
976
|
+
if (configured !== '${name}:event-consumer') {
|
|
977
|
+
throw new Error('Event consumer workload identity is invalid.');
|
|
978
|
+
}
|
|
979
|
+
return configured;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
function lifecycleReconciliationExpiresAt(occurredAt: string): string {
|
|
983
|
+
const expiresAt = new Date(occurredAt);
|
|
984
|
+
expiresAt.setUTCDate(expiresAt.getUTCDate() + 400);
|
|
985
|
+
return expiresAt.toISOString();
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
export async function handler(event: QueueEvent) {
|
|
989
|
+
const workloadIdentity = requiredEventConsumerWorkloadIdentity();
|
|
990
|
+
const logger = createLogger({
|
|
991
|
+
component: 'event-consumer',
|
|
992
|
+
feature: 'events',
|
|
993
|
+
operation: 'consume-created',
|
|
994
|
+
slice: '${name}',
|
|
995
|
+
stage: process.env.EBK_STAGE ?? '',
|
|
996
|
+
workspace: '${workspace}',
|
|
997
|
+
});
|
|
998
|
+
const batch = parseSqsEventBridgeRecords<
|
|
999
|
+
${pascalName}CreatedData | ${pascalName}DataLifecycleChangedData
|
|
1000
|
+
>(event.Records);
|
|
1001
|
+
const failures = [...batch.failures];
|
|
1002
|
+
for (const { detailType, envelope, messageId, source } of batch.events) {
|
|
1003
|
+
if (messageId === undefined) {
|
|
1004
|
+
failures.push({
|
|
1005
|
+
error: 'Event processing failed without retaining payload data.',
|
|
1006
|
+
messageId: 'missing-message-id',
|
|
1007
|
+
});
|
|
1008
|
+
continue;
|
|
1009
|
+
}
|
|
1010
|
+
try {
|
|
1011
|
+
if (detailType === 'DataLifecycleChanged') {
|
|
1012
|
+
const lifecycle = parseDataLifecycleChangeEvent(envelope.data);
|
|
1013
|
+
if (
|
|
1014
|
+
source === undefined ||
|
|
1015
|
+
lifecycle.sourceSlice !== source ||
|
|
1016
|
+
!lifecycleSources.has(source)
|
|
1017
|
+
) {
|
|
1018
|
+
throw new Error(
|
|
1019
|
+
'Lifecycle event source is not declared by this consumer.',
|
|
1020
|
+
);
|
|
1021
|
+
}
|
|
1022
|
+
await authorize${pascalName}InternalOperation({
|
|
1023
|
+
action: ${identifierPrefix}AuthorizationActions.lifecycleConsume,
|
|
1024
|
+
correlationId: envelope.meta.correlationId,
|
|
1025
|
+
operationId: messageId,
|
|
1026
|
+
workloadIdentity,
|
|
1027
|
+
});
|
|
1028
|
+
await withPrimaryDatabase(
|
|
1029
|
+
{ correlationId: envelope.meta.correlationId },
|
|
1030
|
+
'event-consumer',
|
|
1031
|
+
async (client) => {
|
|
1032
|
+
await client.query('BEGIN');
|
|
1033
|
+
try {
|
|
1034
|
+
await client.query(
|
|
1035
|
+
\`INSERT INTO data_lifecycle_receipts
|
|
1036
|
+
(source_slice, pseudonymous_key, action, request_ref,
|
|
1037
|
+
policy_version, occurred_at)
|
|
1038
|
+
VALUES ($1, $2, $3, $4, $5, $6)
|
|
1039
|
+
ON CONFLICT
|
|
1040
|
+
(source_slice, pseudonymous_key, action, request_ref)
|
|
1041
|
+
DO NOTHING\`,
|
|
1042
|
+
[
|
|
1043
|
+
lifecycle.sourceSlice,
|
|
1044
|
+
lifecycle.pseudonymousKey,
|
|
1045
|
+
lifecycle.action,
|
|
1046
|
+
lifecycle.requestRef,
|
|
1047
|
+
lifecycle.policyVersion,
|
|
1048
|
+
lifecycle.occurredAt,
|
|
1049
|
+
],
|
|
1050
|
+
);
|
|
1051
|
+
await client.query(
|
|
1052
|
+
\`INSERT INTO data_lifecycle_downstream_copies
|
|
1053
|
+
(source_slice, pseudonymous_key, copy_id, recipient,
|
|
1054
|
+
purpose, expires_at, action, hold_refs, status,
|
|
1055
|
+
updated_at)
|
|
1056
|
+
VALUES ($1, $2, $3, $4, 'lifecycle-reconciliation', $5,
|
|
1057
|
+
$6, '[]'::jsonb, $7, $8)
|
|
1058
|
+
ON CONFLICT (source_slice, pseudonymous_key, copy_id)
|
|
1059
|
+
DO UPDATE SET
|
|
1060
|
+
action = EXCLUDED.action,
|
|
1061
|
+
expires_at = EXCLUDED.expires_at,
|
|
1062
|
+
hold_refs = EXCLUDED.hold_refs,
|
|
1063
|
+
status = EXCLUDED.status,
|
|
1064
|
+
updated_at = EXCLUDED.updated_at
|
|
1065
|
+
WHERE data_lifecycle_downstream_copies.updated_at
|
|
1066
|
+
<= EXCLUDED.updated_at\`,
|
|
1067
|
+
[
|
|
1068
|
+
lifecycle.sourceSlice,
|
|
1069
|
+
lifecycle.pseudonymousKey,
|
|
1070
|
+
'${name}-lifecycle-consumer',
|
|
1071
|
+
'${name}',
|
|
1072
|
+
lifecycleReconciliationExpiresAt(lifecycle.occurredAt),
|
|
1073
|
+
lifecycle.action,
|
|
1074
|
+
lifecycle.action === 'deletion'
|
|
1075
|
+
? 'deleted'
|
|
1076
|
+
: 'reconciled',
|
|
1077
|
+
lifecycle.occurredAt,
|
|
1078
|
+
],
|
|
1079
|
+
);
|
|
1080
|
+
await client.query('COMMIT');
|
|
1081
|
+
} catch (error) {
|
|
1082
|
+
await client.query('ROLLBACK').catch(() => undefined);
|
|
1083
|
+
throw error;
|
|
1084
|
+
}
|
|
1085
|
+
},
|
|
1086
|
+
);
|
|
1087
|
+
}
|
|
1088
|
+
logger.info('${name} event consumed', {
|
|
1089
|
+
context: toEventLogContext(envelope.meta, detailType),
|
|
1090
|
+
outcome: 'success',
|
|
1091
|
+
});
|
|
1092
|
+
} catch {
|
|
1093
|
+
failures.push({
|
|
1094
|
+
error: 'Event processing failed without retaining payload data.',
|
|
1095
|
+
messageId,
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
logger.info('${name} event batch completed', {
|
|
1100
|
+
attributes: {
|
|
1101
|
+
eventCount: batch.events.length,
|
|
1102
|
+
failureCount: failures.length,
|
|
1103
|
+
},
|
|
1104
|
+
outcome: failures.length === 0 ? 'success' : 'failure',
|
|
1105
|
+
});
|
|
1106
|
+
return {
|
|
1107
|
+
batchItemFailures: failures.map(({ messageId }) => ({
|
|
1108
|
+
itemIdentifier: messageId ?? '',
|
|
1109
|
+
})),
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
`,
|
|
1113
|
+
'testing/event-consumer-identity.spec.ts': `import { afterEach, describe, expect, it } from 'vitest';
|
|
1114
|
+
import { handler } from '../api/event-consumer.js';
|
|
1115
|
+
|
|
1116
|
+
afterEach(() => {
|
|
1117
|
+
delete process.env.EBK_WORKLOAD_IDENTITY;
|
|
1118
|
+
});
|
|
1119
|
+
|
|
1120
|
+
describe('${pascalName} event-consumer identity', () => {
|
|
1121
|
+
it('fails closed when workload identity is missing', async () => {
|
|
1122
|
+
await expect(handler({ Records: [] })).rejects.toThrow(
|
|
1123
|
+
'Event consumer workload identity is invalid.',
|
|
1124
|
+
);
|
|
1125
|
+
});
|
|
1126
|
+
|
|
1127
|
+
it('fails closed when workload identity differs', async () => {
|
|
1128
|
+
process.env.EBK_WORKLOAD_IDENTITY = '${name}:ordinary-machine-client';
|
|
1129
|
+
await expect(handler({ Records: [] })).rejects.toThrow(
|
|
1130
|
+
'Event consumer workload identity is invalid.',
|
|
1131
|
+
);
|
|
1132
|
+
});
|
|
1133
|
+
|
|
1134
|
+
it('accepts only the exact generated identity', async () => {
|
|
1135
|
+
process.env.EBK_WORKLOAD_IDENTITY = '${name}:event-consumer';
|
|
1136
|
+
await expect(handler({ Records: [] })).resolves.toEqual({
|
|
1137
|
+
batchItemFailures: [],
|
|
1138
|
+
});
|
|
1139
|
+
});
|
|
1140
|
+
});
|
|
1141
|
+
`,
|
|
1142
|
+
'api/publish-created.ts': `import { EventBridgeClient, PutEventsCommand } from '@aws-sdk/client-eventbridge';
|
|
1143
|
+
import type { RuntimeHttpEvent } from '@empire-builder-kit/runtime';
|
|
1144
|
+
import type { Principal } from '@empire-builder-kit/runtime/auth';
|
|
1145
|
+
import { createContractHttpJsonHandler } from '@empire-builder-kit/runtime/api-server';
|
|
1146
|
+
import { createEventPublisher } from '@empire-builder-kit/runtime/events';
|
|
1147
|
+
import { authorize${pascalName}Operation } from '../authorization/runtime.js';
|
|
1148
|
+
import { ${identifierPrefix}PublishCreated } from './contracts/protected.js';
|
|
1149
|
+
import { ${pascalName}Created } from '../contracts/events.js';
|
|
1150
|
+
|
|
1151
|
+
const client = new EventBridgeClient({});
|
|
1152
|
+
let publish: ReturnType<typeof createEventPublisher> | undefined;
|
|
1153
|
+
function getPublisher() {
|
|
1154
|
+
return publish ??= createEventPublisher({
|
|
1155
|
+
busName: process.env.EVENT_BUS_NAME ?? '',
|
|
1156
|
+
stage: process.env.EBK_STAGE ?? '',
|
|
1157
|
+
send: (entry) => client.send(new PutEventsCommand({ Entries: [{
|
|
1158
|
+
Detail: entry.detail,
|
|
1159
|
+
DetailType: entry.detailType,
|
|
1160
|
+
EventBusName: entry.eventBusName,
|
|
1161
|
+
Source: entry.source,
|
|
1162
|
+
}] })),
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
export const handler = createContractHttpJsonHandler<
|
|
1167
|
+
typeof ${identifierPrefix}PublishCreated,
|
|
1168
|
+
RuntimeHttpEvent,
|
|
1169
|
+
Principal
|
|
1170
|
+
>({
|
|
1171
|
+
component: 'event-publisher',
|
|
1172
|
+
operation: ${identifierPrefix}PublishCreated,
|
|
1173
|
+
workspace: '${workspace}',
|
|
1174
|
+
authorize: authorize${pascalName}Operation,
|
|
1175
|
+
async handle({ context, principal }) {
|
|
1176
|
+
const publishedEvent = await getPublisher()(${pascalName}Created, {
|
|
1177
|
+
id: crypto.randomUUID(),
|
|
1178
|
+
occurredBy: principal.id,
|
|
1179
|
+
}, { context });
|
|
1180
|
+
return { eventId: publishedEvent.meta.eventId };
|
|
1181
|
+
},
|
|
1182
|
+
});
|
|
1183
|
+
`,
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
//# sourceMappingURL=built-in-plan-api-files.js.map
|