@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
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS = void 0;
|
|
3
|
+
exports.SERVICE_WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS = exports.WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS = void 0;
|
|
4
4
|
exports.createWorkloadFilePlan = createWorkloadFilePlan;
|
|
5
5
|
exports.workloadGenerator = workloadGenerator;
|
|
6
|
+
const deterministic_order_js_1 = require("../../deterministic-order.js");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
8
|
const node_path_1 = require("node:path");
|
|
8
9
|
const index_js_1 = require("../../ownership/index.js");
|
|
10
|
+
const feature_registry_js_1 = require("../feature-registry.js");
|
|
11
|
+
const logging_registry_js_1 = require("../logging-registry.js");
|
|
12
|
+
const post_generation_install_js_1 = require("../post-generation-install.js");
|
|
13
|
+
const tool_versions_js_1 = require("../preset/tool-versions.js");
|
|
14
|
+
const built_in_plan_shared_js_1 = require("../slice/built-in-plan-shared.js");
|
|
15
|
+
const frozen_container_js_1 = require("./frozen-container.js");
|
|
16
|
+
const performance_registration_js_1 = require("./performance-registration.js");
|
|
17
|
+
const reliability_registration_js_1 = require("./reliability-registration.js");
|
|
18
|
+
const service_performance_files_js_1 = require("./service-performance-files.js");
|
|
19
|
+
const RELEASE_REGISTRY_PATH = 'operations/release.json';
|
|
9
20
|
function name(value, label) {
|
|
10
21
|
const normalized = value.trim();
|
|
11
22
|
if (!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(normalized)) {
|
|
@@ -26,9 +37,77 @@ function replaceMarker(tree, path, marker, line) {
|
|
|
26
37
|
}
|
|
27
38
|
tree.write(path, source.replace(marker, `${line}\n${marker}`));
|
|
28
39
|
}
|
|
40
|
+
function requireCompositionMarker(tree, path, marker) {
|
|
41
|
+
const source = tree.read(path, 'utf8');
|
|
42
|
+
if (source === null || !source.includes(marker)) {
|
|
43
|
+
throw new Error(`Product Slice composition marker ${marker} is missing from ${path}.`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
29
46
|
function json(value) {
|
|
30
47
|
return `${JSON.stringify(value, null, 2)}\n`;
|
|
31
48
|
}
|
|
49
|
+
function registerReleaseArtifact(tree, sliceRoot, slice, workload, kind) {
|
|
50
|
+
const path = node_path_1.posix.join(sliceRoot, RELEASE_REGISTRY_PATH);
|
|
51
|
+
const source = tree.read(path, 'utf8');
|
|
52
|
+
if (source === null) {
|
|
53
|
+
throw new Error(`Product Slice release registry is missing from ${path}.`);
|
|
54
|
+
}
|
|
55
|
+
let release;
|
|
56
|
+
try {
|
|
57
|
+
release = JSON.parse(source);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
throw new Error(`Product Slice release registry is invalid at ${path}.`);
|
|
61
|
+
}
|
|
62
|
+
if (release.schemaVersion !== 1 ||
|
|
63
|
+
!Array.isArray(release.artifactInventory)) {
|
|
64
|
+
throw new Error(`Product Slice release registry lacks a v1 artifact inventory at ${path}.`);
|
|
65
|
+
}
|
|
66
|
+
const id = `${slice}.${kind}.${workload}`;
|
|
67
|
+
const name = `${slice}-${kind}-${workload}`;
|
|
68
|
+
if (release.artifactInventory.some((entry) => entry.id === id || entry.name === name)) {
|
|
69
|
+
throw new Error(`Release artifact ${id} is already registered.`);
|
|
70
|
+
}
|
|
71
|
+
release.artifactInventory.push({
|
|
72
|
+
candidate: {
|
|
73
|
+
materialPaths: [
|
|
74
|
+
`packages/${slice}/${kind === 'service' ? 'services' : 'jobs'}/${workload}/dist`,
|
|
75
|
+
],
|
|
76
|
+
recipePaths: [
|
|
77
|
+
'pnpm-lock.yaml',
|
|
78
|
+
`packages/${slice}/${kind === 'service' ? 'services' : 'jobs'}/${workload}/Dockerfile`,
|
|
79
|
+
`packages/${slice}/${kind === 'service' ? 'services' : 'jobs'}/${workload}/package.json`,
|
|
80
|
+
`packages/${slice}/sst.config.ts`,
|
|
81
|
+
],
|
|
82
|
+
sourceInputPaths: [
|
|
83
|
+
`packages/${slice}/${kind === 'service' ? 'services' : 'jobs'}/${workload}/src`,
|
|
84
|
+
`packages/${slice}/${kind === 'service' ? 'services' : 'jobs'}/${workload}/tsconfig.json`,
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
classification: 'stage-neutral',
|
|
88
|
+
finalArtifact: {
|
|
89
|
+
container: {
|
|
90
|
+
context: '.',
|
|
91
|
+
dockerfile: `packages/${slice}/${kind === 'service' ? 'services' : 'jobs'}/${workload}/Dockerfile`,
|
|
92
|
+
nativeLifecycleProof: kind === 'service' ? 'service-default-health' : 'job-default-success',
|
|
93
|
+
proofEntrypoints: [kind === 'service' ? 'dist/main.js' : 'dist/run.js'],
|
|
94
|
+
proofImports: [
|
|
95
|
+
'@aws-sdk/client-appconfigdata',
|
|
96
|
+
'@empire-builder-kit/runtime/logging',
|
|
97
|
+
],
|
|
98
|
+
role: kind,
|
|
99
|
+
},
|
|
100
|
+
family: 'oci-image',
|
|
101
|
+
imageConsumption: 'digest-qualified',
|
|
102
|
+
support: 'supported',
|
|
103
|
+
},
|
|
104
|
+
id,
|
|
105
|
+
name,
|
|
106
|
+
workload: kind,
|
|
107
|
+
});
|
|
108
|
+
release.artifactInventory.sort((left, right) => (0, deterministic_order_js_1.compareUtf16)(String(left.id), String(right.id)));
|
|
109
|
+
tree.write(path, json(release));
|
|
110
|
+
}
|
|
32
111
|
exports.WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS = [
|
|
33
112
|
'/name',
|
|
34
113
|
'/private',
|
|
@@ -41,11 +120,18 @@ exports.WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS = [
|
|
|
41
120
|
'/scripts/test',
|
|
42
121
|
'/scripts/typecheck',
|
|
43
122
|
'/scripts/verify',
|
|
123
|
+
'/dependencies/@empire-builder-kit~1runtime',
|
|
124
|
+
'/dependencies/@aws-sdk~1client-appconfigdata',
|
|
44
125
|
'/devDependencies/@types~1node',
|
|
45
126
|
'/devDependencies/typescript',
|
|
46
127
|
'/devDependencies/vitest',
|
|
47
128
|
];
|
|
48
|
-
|
|
129
|
+
exports.SERVICE_WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS = [
|
|
130
|
+
...exports.WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS,
|
|
131
|
+
'/dependencies/@aws-sdk~1client-dynamodb',
|
|
132
|
+
'/dependencies/sst',
|
|
133
|
+
];
|
|
134
|
+
function createWorkloadFilePlan(workspace, slice, workload, kind, runtimeVersion, feature, ownsProtectedLoadAdapter) {
|
|
49
135
|
const plural = kind === 'service' ? 'services' : 'jobs';
|
|
50
136
|
const relativeRoot = node_path_1.posix.join(plural, workload);
|
|
51
137
|
const className = `${pascal(slice)}${pascal(workload)}${pascal(kind)}`;
|
|
@@ -53,25 +139,42 @@ function createWorkloadFilePlan(slice, workload, kind) {
|
|
|
53
139
|
const resource = kind === 'service' ? 'Service' : 'Task';
|
|
54
140
|
const entry = kind === 'service' ? 'dist/main.js' : 'dist/run.js';
|
|
55
141
|
const sourceName = kind === 'service' ? 'main.ts' : 'run.ts';
|
|
142
|
+
const packageName = `@${slice}/${kind}-${workload}`;
|
|
56
143
|
const files = {
|
|
144
|
+
...(kind === 'service'
|
|
145
|
+
? {
|
|
146
|
+
[`${relativeRoot}/src/service-runtime.ts`]: 'export const DEFAULT_SERVICE_PORT = 3000 as const;\n',
|
|
147
|
+
}
|
|
148
|
+
: {}),
|
|
57
149
|
[`${relativeRoot}/package.json`]: json({
|
|
58
|
-
name:
|
|
150
|
+
name: packageName,
|
|
59
151
|
private: true,
|
|
60
152
|
type: 'module',
|
|
61
153
|
version: '0.0.0',
|
|
62
154
|
scripts: {
|
|
63
155
|
build: 'tsc -p tsconfig.json',
|
|
64
|
-
'docker-build': `docker build -
|
|
156
|
+
'docker-build': `docker build -f packages/${slice}/${relativeRoot}/Dockerfile ` +
|
|
157
|
+
`-t ${slice}-${kind}-${workload}:local ../../../..`,
|
|
65
158
|
dev: `node --experimental-strip-types ${kind === 'service' ? 'src/main.ts' : 'src/run.ts'}`,
|
|
66
159
|
lint: 'eslint .',
|
|
67
160
|
test: 'vitest run',
|
|
68
161
|
typecheck: 'tsc --noEmit -p tsconfig.json',
|
|
69
162
|
verify: 'pnpm run lint && pnpm run typecheck && pnpm test && pnpm run build',
|
|
70
163
|
},
|
|
164
|
+
dependencies: {
|
|
165
|
+
'@aws-sdk/client-appconfigdata': built_in_plan_shared_js_1.PRODUCT_VERSIONS.awsAppConfigData,
|
|
166
|
+
...(kind === 'service' && ownsProtectedLoadAdapter
|
|
167
|
+
? {
|
|
168
|
+
'@aws-sdk/client-dynamodb': built_in_plan_shared_js_1.PRODUCT_VERSIONS.awsDynamoDb,
|
|
169
|
+
sst: tool_versions_js_1.WORKSPACE_SST_VERSION,
|
|
170
|
+
}
|
|
171
|
+
: {}),
|
|
172
|
+
'@empire-builder-kit/runtime': runtimeVersion,
|
|
173
|
+
},
|
|
71
174
|
devDependencies: {
|
|
72
175
|
'@types/node': '25.5.0',
|
|
73
176
|
typescript: '~5.9.2',
|
|
74
|
-
vitest:
|
|
177
|
+
vitest: tool_versions_js_1.WORKSPACE_VITEST_VERSION,
|
|
75
178
|
},
|
|
76
179
|
}),
|
|
77
180
|
[`${relativeRoot}/tsconfig.json`]: json({
|
|
@@ -89,29 +192,817 @@ function createWorkloadFilePlan(slice, workload, kind) {
|
|
|
89
192
|
include: ['src/**/*.ts'],
|
|
90
193
|
}),
|
|
91
194
|
[`${relativeRoot}/vitest.config.ts`]: `import { configDefaults, defineConfig } from 'vitest/config';\n\nexport default defineConfig({\n test: {\n environment: 'node',\n exclude: [...configDefaults.exclude, '**/dist/**'],\n },\n});\n`,
|
|
92
|
-
[`${relativeRoot}/Dockerfile`]:
|
|
195
|
+
[`${relativeRoot}/Dockerfile`]: (0, frozen_container_js_1.renderFrozenWorkloadDockerfile)({
|
|
196
|
+
entry,
|
|
197
|
+
packageName,
|
|
198
|
+
workspacePath: `packages/${slice}/${relativeRoot}`,
|
|
199
|
+
}),
|
|
93
200
|
[`${relativeRoot}/README.md`]: `# ${workload} ${kind}\n\nOwned by the ${slice} Product Slice. Run build, test, typecheck, verify, dev, and docker-build through this package's inferred Nx targets. Add runtime dependencies with \`pnpm --filter @${slice}/${kind}-${workload} add <package>\`; EBK upgrades preserve adopter-owned manifest keys and the production image retains installed runtime dependencies. Document ${kind === 'service' ? 'health, scaling, and rollback' : 'invocation, retry, idempotency, and failure recovery'} before production use.\n`,
|
|
94
201
|
[`${relativeRoot}/src/${sourceName}`]: kind === 'service'
|
|
95
|
-
? `import { createServer } from 'node:http';\n\nexport function healthResponse(path: string | undefined) {\n const healthy = path === '/health';\n return { body: { service: '${workload}', status: healthy ? 'ok' : 'not_found' }, status: healthy ? 200 : 404 };\n}\n\nexport function start() {\n const port = Number(process.env.PORT ?? 3000);\n
|
|
96
|
-
: `
|
|
202
|
+
? `import { createLogger, type Logger } from '@empire-builder-kit/runtime/logging';\nimport { createServer } from 'node:http';\nimport { hostProviderDeliveryAssignment } from './provider-delivery.js';\n\nexport function healthResponse(path: string | undefined) {\n const healthy = path === '/health';\n return { body: { service: '${workload}', status: healthy ? 'ok' : 'not_found' }, status: healthy ? 200 : 404 };\n}\n\nfunction serviceLogger(): Logger {\n return createLogger({\n component: 'service-${workload}',\n feature: '${feature}',\n operation: 'serve',\n slice: '${slice}',\n stage: process.env.EBK_STAGE ?? 'development',\n workspace: '${workspace}',\n });\n}\n\nexport async function start(logger = serviceLogger()) {\n const port = Number(process.env.PORT ?? 3000);\n const assignment = await hostProviderDeliveryAssignment(\n 'service-${slice}-${workload}-host-v1',\n );\n logger.info('${workload} service starting', {\n attributes: { port, providerDeliveryAssigned: assignment.assigned },\n });\n const server = createServer((request, response) => {\n const result = healthResponse(request.url);\n logger.info('${workload} service health request completed', {\n attributes: { httpStatus: result.status },\n outcome: result.status === 200 ? 'success' : 'failure',\n });\n response.writeHead(result.status, { 'content-type': 'application/json' });\n response.end(JSON.stringify(result.body));\n });\n server.on('error', (error) => {\n logger.error('${workload} service failed', { error, outcome: 'failure' });\n });\n return server.listen(port, () => {\n logger.info('${workload} service started', { outcome: 'success' });\n });\n}\n\nif (import.meta.url === new URL(process.argv[1] ?? '', 'file:').href) {\n await start();\n}\n`
|
|
203
|
+
: `import { createLogger, type Logger } from '@empire-builder-kit/runtime/logging';\nimport { hostProviderDeliveryAssignment } from './provider-delivery.js';\n\nfunction jobLogger(): Logger {\n return createLogger({\n component: 'job-${workload}',\n feature: '${feature}',\n operation: 'run',\n slice: '${slice}',\n stage: process.env.EBK_STAGE ?? 'development',\n workspace: '${workspace}',\n });\n}\n\nexport async function run(logger = jobLogger()) {\n logger.info('${workload} job started', {\n attributes: { trigger: process.env.JOB_TRIGGER ?? 'manual' },\n });\n try {\n const assignment = await hostProviderDeliveryAssignment(\n 'job-${slice}-${workload}-host-v1',\n );\n const result = { ok: true, providerDeliveryAssigned: assignment.assigned };\n logger.info('${workload} job completed', { outcome: 'success' });\n return result;\n } catch (error) {\n logger.error('${workload} job failed', { error, outcome: 'failure' });\n throw error;\n }\n}\n\nif (import.meta.url === new URL(process.argv[1] ?? '', 'file:').href) {\n await run();\n}\n`,
|
|
97
204
|
[`${relativeRoot}/src/workload.spec.ts`]: kind === 'service'
|
|
98
205
|
? `import { describe, expect, it } from 'vitest';\nimport { healthResponse } from './main.js';\n\ndescribe('${workload} service', () => {\n it('reports healthy only on the health endpoint', () => {\n expect(healthResponse('/health')).toEqual({ body: { service: '${workload}', status: 'ok' }, status: 200 });\n expect(healthResponse('/missing').status).toBe(404);\n });\n});\n`
|
|
99
|
-
: `import { describe, expect, it
|
|
100
|
-
[`${relativeRoot}/infra.ts`]: `
|
|
206
|
+
: `import { createLogger, type LogEntry } from '@empire-builder-kit/runtime/logging';\nimport { describe, expect, it } from 'vitest';\nimport { run } from './run.js';\n\ndescribe('${workload} job', () => {\n it('emits canonical start and completion records', async () => {\n const entries: LogEntry[] = [];\n const logger = createLogger({\n component: 'job-${workload}', feature: '${feature}', operation: 'run',\n slice: '${slice}', stage: 'test', workspace: '${workspace}',\n sink: (entry) => entries.push(entry as LogEntry),\n });\n await expect(run(logger)).resolves.toEqual({\n ok: true,\n providerDeliveryAssigned: false,\n });\n expect(entries.map(({ message, outcome }) => ({ message, outcome }))).toEqual([\n { message: '${workload} job started', outcome: undefined },\n { message: '${workload} job completed', outcome: 'success' },\n ]);\n });\n});\n`,
|
|
207
|
+
[`${relativeRoot}/infra.ts`]: `import { createManagedLogGroupContract } from '@empire-builder-kit/nx/foundation';\nimport { standardSliceExtensionTaskFamily } from '../../infra/workload-roles/effective-intent.js';\n\nexport function ${factoryName}(\n cluster: any,\n alertTopicArn: any,\n roles?: { executionRole: string; taskRole: string },\n links: any[] = [],\n configuration?: {\n applicationId: any;\n deployment: any;\n environmentId: any;\n profileId: any;\n },\n) {\n const contract = createManagedLogGroupContract({\n component: '${kind}-${workload}',\n slice: '${slice}',\n stage: $app.stage,\n workspace: '${workspace}',\n });\n const workload = new sst.aws.${resource}('${className}', {\n ...(roles ?? {}),\n cluster,\n environment: {\n EBK_STAGE: $app.stage,\n ...(configuration\n ? {\n EBK_APPCONFIG_APPLICATION_ID: configuration.applicationId,\n EBK_APPCONFIG_ENVIRONMENT_ID: configuration.environmentId,\n EBK_APPCONFIG_PROFILE_ID: configuration.profileId,\n }\n : {}),\n },\n link: links,\n ${kind === 'service' ? "image: { context: './services/" + workload + "', dockerfile: 'Dockerfile' },\n health: { command: ['CMD-SHELL', 'wget -qO- http://localhost:3000/health || exit 1'] },\n logging: { name: contract.name, retention: '1 month' },\n serviceRegistry: { port: 3000 }," : "image: { context: './jobs/" + workload + "', dockerfile: 'Dockerfile' },\n logging: { name: contract.name, retention: '1 month' },"}\n transform: {\n logGroup: {\n logGroupClass: contract.logGroupClass,\n tags: contract.tags,\n },\n taskDefinition: {\n family: standardSliceExtensionTaskFamily(\n $app.stage,\n '${workload}',\n '${kind}',\n ),\n },\n },\n }, configuration?.deployment\n ? { dependsOn: [configuration.deployment] }\n : {});\n const dataProtection = new aws.cloudwatch.LogDataProtectionPolicy(\n '${className}LogDataProtection',\n {\n logGroupName: contract.name,\n policyDocument: JSON.stringify(contract.dataProtectionPolicy),\n },\n { dependsOn: [workload.nodes.taskDefinition] },\n );\n const dataProtectionAlarm = new aws.cloudwatch.MetricAlarm(\n '${className}LogDataProtectionFindings',\n {\n alarmActions: [alertTopicArn],\n comparisonOperator: 'GreaterThanOrEqualToThreshold',\n dimensions: { LogGroupName: contract.name },\n evaluationPeriods: 1,\n metricName: 'LogEventsWithFindings',\n namespace: 'AWS/Logs',\n period: 300,\n statistic: 'Sum',\n threshold: 1,\n treatMissingData: 'notBreaching',\n },\n { dependsOn: [dataProtection] },\n );\n void dataProtectionAlarm;\n return workload;\n}\n`,
|
|
208
|
+
};
|
|
209
|
+
if (kind === 'service') {
|
|
210
|
+
const serviceMainPath = `${relativeRoot}/src/main.ts`;
|
|
211
|
+
const serviceInfrastructurePath = `${relativeRoot}/infra.ts`;
|
|
212
|
+
const mainSource = files[serviceMainPath] ?? '';
|
|
213
|
+
const infrastructureSource = files[serviceInfrastructurePath] ?? '';
|
|
214
|
+
if (!mainSource.includes("import { hostProviderDeliveryAssignment } from './provider-delivery.js';\n") ||
|
|
215
|
+
!mainSource.includes('process.env.PORT ?? 3000') ||
|
|
216
|
+
!infrastructureSource.includes("import { standardSliceExtensionTaskFamily } from '../../infra/workload-roles/effective-intent.js';\n") ||
|
|
217
|
+
!infrastructureSource.includes("health: { command: ['CMD-SHELL', 'wget -qO- http://localhost:3000/health || exit 1'] },") ||
|
|
218
|
+
!infrastructureSource.includes('serviceRegistry: { port: 3000 },')) {
|
|
219
|
+
throw new Error('Built-in Service runtime is missing its shared port integration point.');
|
|
220
|
+
}
|
|
221
|
+
files[serviceMainPath] = mainSource
|
|
222
|
+
.replace("import { hostProviderDeliveryAssignment } from './provider-delivery.js';\n", "import { hostProviderDeliveryAssignment } from './provider-delivery.js';\nimport { DEFAULT_SERVICE_PORT } from './service-runtime.js';\n")
|
|
223
|
+
.replace('process.env.PORT ?? 3000', 'process.env.PORT ?? DEFAULT_SERVICE_PORT');
|
|
224
|
+
files[serviceInfrastructurePath] = infrastructureSource
|
|
225
|
+
.replace("import { standardSliceExtensionTaskFamily } from '../../infra/workload-roles/effective-intent.js';\n", "import { standardSliceExtensionTaskFamily } from '../../infra/workload-roles/effective-intent.js';\nimport { DEFAULT_SERVICE_PORT } from './src/service-runtime.js';\n")
|
|
226
|
+
.replace("health: { command: ['CMD-SHELL', 'wget -qO- http://localhost:3000/health || exit 1'] },", "health: { command: ['CMD-SHELL', 'wget -qO- http://localhost:' + DEFAULT_SERVICE_PORT + '/health || exit 1'] },")
|
|
227
|
+
.replace('serviceRegistry: { port: 3000 },', 'serviceRegistry: { port: DEFAULT_SERVICE_PORT },');
|
|
228
|
+
}
|
|
229
|
+
if (kind === 'service' && ownsProtectedLoadAdapter) {
|
|
230
|
+
const mainPath = `${relativeRoot}/src/main.ts`;
|
|
231
|
+
let mainSource = files[mainPath] ?? '';
|
|
232
|
+
const replaceMainFragment = (expected, replacement) => {
|
|
233
|
+
if (!mainSource.includes(expected)) {
|
|
234
|
+
throw new Error('Built-in Service runtime is missing its protected performance integration point.');
|
|
235
|
+
}
|
|
236
|
+
mainSource = mainSource.replace(expected, replacement);
|
|
237
|
+
};
|
|
238
|
+
replaceMainFragment(`import { hostProviderDeliveryAssignment } from './provider-delivery.js';\n`, `import { hostProviderDeliveryAssignment } from './provider-delivery.js';\nimport { serveProtectedServicePerformanceRequest } from './performance.js';\n`);
|
|
239
|
+
replaceMainFragment('export async function start(logger = serviceLogger()) {', `export async function start(\n logger = serviceLogger(),\n performanceHandler = serveProtectedServicePerformanceRequest,\n) {`);
|
|
240
|
+
replaceMainFragment(` const server = createServer((request, response) => {\n const result = healthResponse(request.url);`, ` const server = createServer(async (request, response) => {\n const path = request.url?.split('?')[0];\n if (\n path === '/${slice}/__ebk/performance/service' ||\n path === '/${slice}/__ebk/performance/service/cleanup'\n ) {\n try {\n await performanceHandler(request, response);\n } catch (error) {\n logger.error('${workload} protected performance request failed', {\n error,\n outcome: 'failure',\n });\n if (!response.headersSent) {\n response.writeHead(404, { 'content-type': 'application/json' });\n response.end(JSON.stringify({\n kind: 'ebk-protected-load-endpoint-refusal',\n status: 'not-found',\n }));\n } else {\n response.destroy();\n }\n }\n return;\n }\n const result = healthResponse(request.url);`);
|
|
241
|
+
replaceMainFragment(`response.writeHead(404, { 'content-type': 'application/json' });`, `response.writeHead(404, {
|
|
242
|
+
'cache-control': 'no-store',
|
|
243
|
+
'content-type': 'application/json',
|
|
244
|
+
});`);
|
|
245
|
+
files[mainPath] = mainSource;
|
|
246
|
+
Object.assign(files, (0, service_performance_files_js_1.renderServicePerformanceFiles)({ slice, workload }));
|
|
247
|
+
}
|
|
248
|
+
const infrastructurePath = `${relativeRoot}/infra.ts`;
|
|
249
|
+
const packageLocalImage = `image: { context: './${plural}/${workload}', dockerfile: 'Dockerfile' }`;
|
|
250
|
+
const protectedReleaseImage = 'image: container.image';
|
|
251
|
+
let infrastructureSource = files[infrastructurePath] ?? '';
|
|
252
|
+
const replaceInfrastructureFragment = (expected, replacement) => {
|
|
253
|
+
if (!infrastructureSource.includes(expected)) {
|
|
254
|
+
throw new Error(`Built-in ${kind} infrastructure is missing its performance integration point.`);
|
|
255
|
+
}
|
|
256
|
+
infrastructureSource = infrastructureSource.replace(expected, replacement);
|
|
257
|
+
};
|
|
258
|
+
replaceInfrastructureFragment(`import { createManagedLogGroupContract } from '@empire-builder-kit/nx/foundation';
|
|
259
|
+
`, `import { createManagedLogGroupContract } from '@empire-builder-kit/nx/foundation';
|
|
260
|
+
import { createStandardResourceTags } from '@empire-builder-kit/nx/performance';
|
|
261
|
+
import { resolveStandardContainerImage } from '../../infra/container-images.js';
|
|
262
|
+
`);
|
|
263
|
+
replaceInfrastructureFragment(` alertTopicArn: any,
|
|
264
|
+
roles?: { executionRole: string; taskRole: string },
|
|
265
|
+
`, ` alertTopicArn: any,
|
|
266
|
+
performance: {
|
|
267
|
+
frameworkVersion: string;
|
|
268
|
+
owner: string;
|
|
269
|
+
productionProfile: 'cost-optimized' | 'standard';
|
|
270
|
+
repository: string;
|
|
271
|
+
},
|
|
272
|
+
${kind !== 'service' || ownsProtectedLoadAdapter
|
|
273
|
+
? ` performanceDeploymentBinding: {
|
|
274
|
+
candidateDigest: string;
|
|
275
|
+
releaseId: string;
|
|
276
|
+
releaseMaterialDigest: string;
|
|
277
|
+
target: {
|
|
278
|
+
accountFingerprint: string;
|
|
279
|
+
origin: any;
|
|
280
|
+
region: string;
|
|
281
|
+
slice: string;
|
|
282
|
+
};
|
|
283
|
+
} | undefined,
|
|
284
|
+
`
|
|
285
|
+
: ''}${kind === 'service' && ownsProtectedLoadAdapter
|
|
286
|
+
? ` performanceIngress: {
|
|
287
|
+
api: any;
|
|
288
|
+
originProof: any;
|
|
289
|
+
router: any;
|
|
290
|
+
} | undefined,
|
|
291
|
+
`
|
|
292
|
+
: ''} roles?: { executionRole: string; taskRole: string },
|
|
293
|
+
`);
|
|
294
|
+
replaceInfrastructureFragment(` workspace: '${workspace}',
|
|
295
|
+
});
|
|
296
|
+
const workload = new sst.aws.${resource}`, ` workspace: '${workspace}',
|
|
297
|
+
});
|
|
298
|
+
const standardTags = createStandardResourceTags({
|
|
299
|
+
...performance,
|
|
300
|
+
slice: '${slice}',
|
|
301
|
+
stage: $app.stage,
|
|
302
|
+
workspace: '${workspace}',
|
|
303
|
+
});
|
|
304
|
+
const container = resolveStandardContainerImage({
|
|
305
|
+
artifactId: '${slice}.${kind}.${workload}',
|
|
306
|
+
local: {
|
|
307
|
+
context: '../..',
|
|
308
|
+
dockerfile: 'packages/${slice}/${relativeRoot}/Dockerfile',
|
|
309
|
+
},
|
|
310
|
+
sourceCommit: process.env.EBK_RELEASE_SOURCE_COMMIT ??
|
|
311
|
+
process.env.EBK_SOURCE_COMMIT ?? '',
|
|
312
|
+
stage: $app.stage,
|
|
313
|
+
});
|
|
314
|
+
const workload = new sst.aws.${resource}`);
|
|
315
|
+
replaceInfrastructureFragment(` environment: {
|
|
316
|
+
EBK_STAGE: $app.stage,
|
|
317
|
+
`, ` environment: {
|
|
318
|
+
...container.environment,
|
|
319
|
+
EBK_STAGE: $app.stage,
|
|
320
|
+
`);
|
|
321
|
+
replaceInfrastructureFragment(` tags: contract.tags,
|
|
322
|
+
`, ` tags: { ...contract.tags, ...standardTags },
|
|
323
|
+
`);
|
|
324
|
+
replaceInfrastructureFragment(` taskDefinition: {
|
|
325
|
+
`, `${kind === 'service' ? ' service: { tags: standardTags },\n' : ''} taskDefinition: {
|
|
326
|
+
`);
|
|
327
|
+
replaceInfrastructureFragment(` '${kind}',
|
|
328
|
+
),
|
|
329
|
+
},
|
|
330
|
+
`, ` '${kind}',
|
|
331
|
+
),
|
|
332
|
+
tags: standardTags,
|
|
333
|
+
},
|
|
334
|
+
`);
|
|
335
|
+
replaceInfrastructureFragment(` treatMissingData: 'notBreaching',
|
|
336
|
+
`, ` tags: standardTags,
|
|
337
|
+
treatMissingData: 'notBreaching',
|
|
338
|
+
`);
|
|
339
|
+
replaceInfrastructureFragment(` alarmActions: [alertTopicArn],
|
|
340
|
+
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
341
|
+
`, ` alarmActions: [alertTopicArn],
|
|
342
|
+
alarmDescription: JSON.stringify({
|
|
343
|
+
businessSymptom:
|
|
344
|
+
'${kind} ${workload} emitted a protected-data log finding.',
|
|
345
|
+
id: 'data-protection-findings',
|
|
346
|
+
owner: '${slice}-product',
|
|
347
|
+
route: '${slice}-on-call',
|
|
348
|
+
runbook: 'docs/runbooks/log-investigation.md',
|
|
349
|
+
schemaVersion: 1,
|
|
350
|
+
slice: '${slice}',
|
|
351
|
+
}),
|
|
352
|
+
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
353
|
+
`);
|
|
354
|
+
replaceInfrastructureFragment(` void dataProtectionAlarm;
|
|
355
|
+
return workload;
|
|
356
|
+
`, ` void dataProtectionAlarm;
|
|
357
|
+
${kind === 'job'
|
|
358
|
+
? `const reliabilityTaskStopped = new aws.cloudwatch.EventRule(
|
|
359
|
+
'${className}EssentialContainerStopped',
|
|
360
|
+
{
|
|
361
|
+
description:
|
|
362
|
+
'AWS-native hard-crash signal for the exact ${workload} Job task family.',
|
|
363
|
+
eventPattern: $jsonStringify({
|
|
364
|
+
'detail-type': ['ECS Task State Change'],
|
|
365
|
+
detail: {
|
|
366
|
+
lastStatus: ['STOPPED'],
|
|
367
|
+
stopCode: ['EssentialContainerExited'],
|
|
368
|
+
taskDefinitionArn: [
|
|
369
|
+
{
|
|
370
|
+
wildcard: $interpolate\`*task-definition/\${standardSliceExtensionTaskFamily(
|
|
371
|
+
$app.stage,
|
|
372
|
+
'${workload}',
|
|
373
|
+
'job',
|
|
374
|
+
)}:*\`,
|
|
375
|
+
},
|
|
376
|
+
],
|
|
377
|
+
},
|
|
378
|
+
source: ['aws.ecs'],
|
|
379
|
+
}),
|
|
380
|
+
},
|
|
381
|
+
);`
|
|
382
|
+
: ''}
|
|
383
|
+
const reliabilityAlarm = new aws.cloudwatch.MetricAlarm(
|
|
384
|
+
'${className}Reliability',
|
|
385
|
+
{
|
|
386
|
+
alarmActions: [alertTopicArn],
|
|
387
|
+
alarmDescription: JSON.stringify({
|
|
388
|
+
businessSymptom:
|
|
389
|
+
'${kind === 'service'
|
|
390
|
+
? `${workload} Service has no running task.`
|
|
391
|
+
: `${workload} Job essential container exited.`}',
|
|
392
|
+
id: '${kind === 'service'
|
|
393
|
+
? `service-${workload}-health`
|
|
394
|
+
: `job-${workload}-failure`}',
|
|
395
|
+
owner: '${slice}-product',
|
|
396
|
+
route: '${slice}-on-call',
|
|
397
|
+
runbook: '${relativeRoot}/RUNBOOK.md',
|
|
398
|
+
schemaVersion: 1,
|
|
399
|
+
slice: '${slice}',
|
|
400
|
+
}),
|
|
401
|
+
comparisonOperator: '${kind === 'service'
|
|
402
|
+
? 'LessThanThreshold'
|
|
403
|
+
: 'GreaterThanOrEqualToThreshold'}',
|
|
404
|
+
dimensions: ${kind === 'service'
|
|
405
|
+
? `{ ClusterName: cluster.name, ServiceName: workload.name }`
|
|
406
|
+
: `{ RuleName: reliabilityTaskStopped.name }`},
|
|
407
|
+
evaluationPeriods: 1,
|
|
408
|
+
metricName: '${kind === 'service' ? 'RunningTaskCount' : 'MatchedEvents'}',
|
|
409
|
+
name: '${slice}-' + $app.stage + '-${kind}-${workload}-${kind === 'service' ? 'running' : 'hard-crash'}',
|
|
410
|
+
namespace: '${kind === 'service' ? 'ECS/ContainerInsights' : 'AWS/Events'}',
|
|
411
|
+
period: 60,
|
|
412
|
+
statistic: 'Sum',
|
|
413
|
+
tags: standardTags,
|
|
414
|
+
threshold: 1,
|
|
415
|
+
treatMissingData: '${kind === 'service' ? 'breaching' : 'notBreaching'}',
|
|
416
|
+
},
|
|
417
|
+
);
|
|
418
|
+
void reliabilityAlarm;
|
|
419
|
+
return workload;
|
|
420
|
+
`);
|
|
421
|
+
if (!infrastructureSource.includes(packageLocalImage)) {
|
|
422
|
+
throw new Error(`Built-in ${kind} infrastructure is missing its image context.`);
|
|
423
|
+
}
|
|
424
|
+
infrastructureSource = infrastructureSource.replace(packageLocalImage, protectedReleaseImage);
|
|
425
|
+
if (kind === 'service' && ownsProtectedLoadAdapter) {
|
|
426
|
+
replaceInfrastructureFragment(`import { standardSliceExtensionTaskFamily } from '../../infra/workload-roles/effective-intent.js';`, `import {
|
|
427
|
+
standardSliceExtensionTaskFamily,
|
|
428
|
+
standardSliceServicePerformanceReservationTableName,
|
|
429
|
+
} from '../../infra/workload-roles/effective-intent.js';`);
|
|
430
|
+
replaceInfrastructureFragment(` const workload = new sst.aws.Service`, ` const performanceReservations = performanceDeploymentBinding
|
|
431
|
+
? new aws.dynamodb.Table(
|
|
432
|
+
'${className}PerformanceReservationsTable',
|
|
433
|
+
{
|
|
434
|
+
attributes: [
|
|
435
|
+
{ name: 'pk', type: 'S' },
|
|
436
|
+
{ name: 'sk', type: 'S' },
|
|
437
|
+
],
|
|
438
|
+
billingMode: 'PAY_PER_REQUEST',
|
|
439
|
+
hashKey: 'pk',
|
|
440
|
+
name: standardSliceServicePerformanceReservationTableName(
|
|
441
|
+
$app.stage,
|
|
442
|
+
'${workload}',
|
|
443
|
+
),
|
|
444
|
+
pointInTimeRecovery: { enabled: true },
|
|
445
|
+
rangeKey: 'sk',
|
|
446
|
+
tags: standardTags,
|
|
447
|
+
ttl: {
|
|
448
|
+
attributeName: 'expires_at_epoch_seconds',
|
|
449
|
+
enabled: true,
|
|
450
|
+
},
|
|
451
|
+
},
|
|
452
|
+
)
|
|
453
|
+
: undefined;
|
|
454
|
+
const performanceReservationsLink = performanceReservations
|
|
455
|
+
? new sst.Linkable(
|
|
456
|
+
'${className}PerformanceReservations',
|
|
457
|
+
{
|
|
458
|
+
properties: { tableName: performanceReservations.name },
|
|
459
|
+
},
|
|
460
|
+
)
|
|
461
|
+
: undefined;
|
|
462
|
+
const workload = new sst.aws.Service`);
|
|
463
|
+
replaceInfrastructureFragment(` link: links,`, ` link: [
|
|
464
|
+
...links,
|
|
465
|
+
...(performanceReservationsLink ? [performanceReservationsLink] : []),
|
|
466
|
+
],`);
|
|
467
|
+
replaceInfrastructureFragment(` EBK_STAGE: $app.stage,`, ` EBK_PERFORMANCE_ACCOUNT_FINGERPRINT:
|
|
468
|
+
performanceDeploymentBinding?.target.accountFingerprint ?? '',
|
|
469
|
+
EBK_PERFORMANCE_CANDIDATE_DIGEST:
|
|
470
|
+
performanceDeploymentBinding?.candidateDigest ?? '',
|
|
471
|
+
EBK_PERFORMANCE_LOAD_ENABLED:
|
|
472
|
+
performanceDeploymentBinding ? 'true' : 'false',
|
|
473
|
+
EBK_PERFORMANCE_INGRESS_PROOF:
|
|
474
|
+
performanceIngress?.originProof ?? '',
|
|
475
|
+
EBK_PERFORMANCE_ORIGIN:
|
|
476
|
+
performanceDeploymentBinding?.target.origin ?? '',
|
|
477
|
+
EBK_PERFORMANCE_REGION:
|
|
478
|
+
performanceDeploymentBinding?.target.region ?? '',
|
|
479
|
+
EBK_PERFORMANCE_RELEASE_ID:
|
|
480
|
+
performanceDeploymentBinding?.releaseId ?? '',
|
|
481
|
+
EBK_PERFORMANCE_RELEASE_MATERIAL_DIGEST:
|
|
482
|
+
performanceDeploymentBinding?.releaseMaterialDigest ?? '',
|
|
483
|
+
EBK_PERFORMANCE_SLICE:
|
|
484
|
+
performanceDeploymentBinding?.target.slice ?? '',
|
|
485
|
+
EBK_STAGE: $app.stage,`);
|
|
486
|
+
replaceInfrastructureFragment(` const dataProtection = new aws.cloudwatch.LogDataProtectionPolicy(`, ` if (performanceIngress) {
|
|
487
|
+
performanceIngress.api.routePrivate(
|
|
488
|
+
'GET /${slice}/__ebk/performance/service',
|
|
489
|
+
workload.nodes.cloudmapService.arn,
|
|
490
|
+
{ name: '${className}PerformanceExecute' },
|
|
491
|
+
);
|
|
492
|
+
performanceIngress.api.routePrivate(
|
|
493
|
+
'POST /${slice}/__ebk/performance/service/cleanup',
|
|
494
|
+
workload.nodes.cloudmapService.arn,
|
|
495
|
+
{ name: '${className}PerformanceCleanup' },
|
|
496
|
+
);
|
|
497
|
+
performanceIngress.router.route(
|
|
498
|
+
'/${slice}/__ebk/performance/service',
|
|
499
|
+
performanceIngress.api.url,
|
|
500
|
+
{
|
|
501
|
+
connectionAttempts: 1,
|
|
502
|
+
connectionTimeout: '3 seconds',
|
|
503
|
+
readTimeout: '30 seconds',
|
|
504
|
+
},
|
|
505
|
+
);
|
|
506
|
+
performanceIngress.router.route(
|
|
507
|
+
'/${slice}/__ebk/performance/service/cleanup',
|
|
508
|
+
performanceIngress.api.url,
|
|
509
|
+
{
|
|
510
|
+
connectionAttempts: 1,
|
|
511
|
+
connectionTimeout: '3 seconds',
|
|
512
|
+
readTimeout: '30 seconds',
|
|
513
|
+
},
|
|
514
|
+
);
|
|
515
|
+
}
|
|
516
|
+
const dataProtection = new aws.cloudwatch.LogDataProtectionPolicy(`);
|
|
517
|
+
}
|
|
518
|
+
files[infrastructurePath] = infrastructureSource;
|
|
519
|
+
files[`${relativeRoot}/RUNBOOK.md`] = `# ${workload} ${kind} recovery
|
|
520
|
+
|
|
521
|
+
Confirm the exact Slice, stage, release, configuration, alarm, and workload
|
|
522
|
+
identity before acting. Inspect health or completion signals and sanitized logs
|
|
523
|
+
through the read-only diagnostic path. Do not restart, scale, retry, or replace
|
|
524
|
+
protected resources without the named approval.
|
|
525
|
+
|
|
526
|
+
${kind === 'service'
|
|
527
|
+
? 'Prefer a verified roll-forward; verify readiness, dependency protection, and the critical Service journey after recovery.'
|
|
528
|
+
: 'Preserve idempotency and checkpoint state; verify the business deadline and postconditions before retrying or declaring recovery.'}
|
|
529
|
+
`;
|
|
530
|
+
files[`${relativeRoot}/src/reliability.ts`] = `import {
|
|
531
|
+
createMetricEmitter,
|
|
532
|
+
type MetricEmitter,
|
|
533
|
+
} from '@empire-builder-kit/runtime/observability';
|
|
534
|
+
|
|
535
|
+
export function recordWorkloadReliability(
|
|
536
|
+
failed: boolean,
|
|
537
|
+
metrics: MetricEmitter = createMetricEmitter(),
|
|
538
|
+
) {
|
|
539
|
+
return metrics.emit({
|
|
540
|
+
dimensions: {
|
|
541
|
+
component: '${kind}-${workload}',
|
|
542
|
+
feature: '${feature}',
|
|
543
|
+
slice: '${slice}',
|
|
544
|
+
stage: process.env.EBK_STAGE ?? 'development',
|
|
545
|
+
},
|
|
546
|
+
metricName: '${kind === 'service' ? 'ServiceHealthFailures' : 'JobFailures'}',
|
|
547
|
+
unit: 'Count',
|
|
548
|
+
value: failed ? 1 : 0,
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
`;
|
|
552
|
+
files[`${relativeRoot}/src/reliability.spec.ts`] =
|
|
553
|
+
`import { describe, expect, it } from 'vitest';
|
|
554
|
+
import { recordWorkloadReliability } from './reliability.js';
|
|
555
|
+
|
|
556
|
+
describe('${workload} ${kind} reliability signal', () => {
|
|
557
|
+
it('emits the exact generated alarm metric and dimensions', () => {
|
|
558
|
+
const records: unknown[] = [];
|
|
559
|
+
recordWorkloadReliability(true, {
|
|
560
|
+
emit(input) {
|
|
561
|
+
records.push(input);
|
|
562
|
+
return undefined;
|
|
563
|
+
},
|
|
564
|
+
});
|
|
565
|
+
expect(records).toEqual([
|
|
566
|
+
expect.objectContaining({
|
|
567
|
+
dimensions: {
|
|
568
|
+
component: '${kind}-${workload}',
|
|
569
|
+
feature: '${feature}',
|
|
570
|
+
slice: '${slice}',
|
|
571
|
+
stage: 'development',
|
|
572
|
+
},
|
|
573
|
+
metricName: '${kind === 'service' ? 'ServiceHealthFailures' : 'JobFailures'}',
|
|
574
|
+
value: 1,
|
|
575
|
+
}),
|
|
576
|
+
]);
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
`;
|
|
580
|
+
const sourcePath = `${relativeRoot}/src/${sourceName}`;
|
|
581
|
+
let source = files[sourcePath] ?? '';
|
|
582
|
+
source = source.replace(`import { hostProviderDeliveryAssignment } from './provider-delivery.js';`, `import { hostProviderDeliveryAssignment } from './provider-delivery.js';
|
|
583
|
+
import { recordWorkloadReliability } from './reliability.js';`);
|
|
584
|
+
if (kind === 'service') {
|
|
585
|
+
source = source
|
|
586
|
+
.replace(` const result = healthResponse(request.url);
|
|
587
|
+
`, ` const result = healthResponse(request.url);
|
|
588
|
+
recordWorkloadReliability(result.status !== 200);
|
|
589
|
+
`)
|
|
590
|
+
.replace(` server.on('error', (error) => {
|
|
591
|
+
logger.error('${workload} service failed', { error, outcome: 'failure' });
|
|
592
|
+
`, ` server.on('error', (error) => {
|
|
593
|
+
recordWorkloadReliability(true);
|
|
594
|
+
logger.error('${workload} service failed', { error, outcome: 'failure' });
|
|
595
|
+
`);
|
|
596
|
+
}
|
|
597
|
+
else {
|
|
598
|
+
source = source
|
|
599
|
+
.replace(` const result = { ok: true, providerDeliveryAssigned: assignment.assigned };
|
|
600
|
+
logger.info('${workload} job completed', { outcome: 'success' });
|
|
601
|
+
`, ` const result = { ok: true, providerDeliveryAssigned: assignment.assigned };
|
|
602
|
+
recordWorkloadReliability(false);
|
|
603
|
+
logger.info('${workload} job completed', { outcome: 'success' });
|
|
604
|
+
`)
|
|
605
|
+
.replace(` } catch (error) {
|
|
606
|
+
logger.error('${workload} job failed', { error, outcome: 'failure' });
|
|
607
|
+
`, ` } catch (error) {
|
|
608
|
+
recordWorkloadReliability(true);
|
|
609
|
+
logger.error('${workload} job failed', { error, outcome: 'failure' });
|
|
610
|
+
`);
|
|
611
|
+
}
|
|
612
|
+
files[sourcePath] = source;
|
|
613
|
+
files[`${relativeRoot}/src/provider-delivery.ts`] = `import {
|
|
614
|
+
AppConfigDataClient,
|
|
615
|
+
GetLatestConfigurationCommand,
|
|
616
|
+
StartConfigurationSessionCommand,
|
|
617
|
+
} from '@aws-sdk/client-appconfigdata';
|
|
618
|
+
import {
|
|
619
|
+
deriveOperationalRolloutStableKey,
|
|
620
|
+
evaluatePercentageRollout,
|
|
621
|
+
type OperationalRolloutStableKey,
|
|
622
|
+
} from '@empire-builder-kit/runtime/configuration';
|
|
623
|
+
|
|
624
|
+
type EvaluationReason = 'CACHED' | 'ERROR' | 'STALE' | 'STATIC';
|
|
625
|
+
interface Evaluation<Value extends boolean | number> {
|
|
626
|
+
errorCategory?: 'PROVIDER_UNAVAILABLE';
|
|
627
|
+
flagKey: string;
|
|
628
|
+
providerName: string;
|
|
629
|
+
providerVersion?: string;
|
|
630
|
+
reason: EvaluationReason;
|
|
631
|
+
value: Value;
|
|
632
|
+
}
|
|
633
|
+
export interface HostConfigurationProvider {
|
|
634
|
+
resolveBooleanEvaluation(
|
|
635
|
+
key: string,
|
|
636
|
+
defaultValue: boolean,
|
|
637
|
+
): Promise<Evaluation<boolean>>;
|
|
638
|
+
resolveNumberEvaluation(
|
|
639
|
+
key: string,
|
|
640
|
+
defaultValue: number,
|
|
641
|
+
): Promise<Evaluation<number>>;
|
|
642
|
+
}
|
|
643
|
+
interface Snapshot {
|
|
644
|
+
loadedAt: number;
|
|
645
|
+
values: Record<string, unknown>;
|
|
646
|
+
version: string;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
const REFRESH_AFTER_MS = 45_000;
|
|
650
|
+
const MAX_STALE_MS = 5 * 60_000;
|
|
651
|
+
|
|
652
|
+
function required(name: string): string {
|
|
653
|
+
const value = process.env[name]?.trim();
|
|
654
|
+
if (!value) throw new Error(name + ' is required in a protected stage.');
|
|
655
|
+
return value;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
function createHostConfigurationProvider(): HostConfigurationProvider {
|
|
659
|
+
const protectedStage = ['staging', 'production'].includes(
|
|
660
|
+
process.env.EBK_STAGE ?? '',
|
|
661
|
+
);
|
|
662
|
+
if (!protectedStage) {
|
|
663
|
+
return {
|
|
664
|
+
async resolveBooleanEvaluation(flagKey, defaultValue) {
|
|
665
|
+
return {
|
|
666
|
+
flagKey,
|
|
667
|
+
providerName: 'ebk-local',
|
|
668
|
+
providerVersion: 'local-v1',
|
|
669
|
+
reason: 'STATIC',
|
|
670
|
+
value: defaultValue,
|
|
671
|
+
};
|
|
672
|
+
},
|
|
673
|
+
async resolveNumberEvaluation(flagKey, defaultValue) {
|
|
674
|
+
return {
|
|
675
|
+
flagKey,
|
|
676
|
+
providerName: 'ebk-local',
|
|
677
|
+
providerVersion: 'local-v1',
|
|
678
|
+
reason: 'STATIC',
|
|
679
|
+
value: defaultValue,
|
|
680
|
+
};
|
|
681
|
+
},
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
const client = new AppConfigDataClient({});
|
|
686
|
+
let cached: Snapshot | undefined;
|
|
687
|
+
let inFlight: Promise<Snapshot> | undefined;
|
|
688
|
+
let token: string | undefined;
|
|
689
|
+
const refresh = async (): Promise<Snapshot> => {
|
|
690
|
+
if (!token) {
|
|
691
|
+
const session = await client.send(
|
|
692
|
+
new StartConfigurationSessionCommand({
|
|
693
|
+
ApplicationIdentifier: required('EBK_APPCONFIG_APPLICATION_ID'),
|
|
694
|
+
ConfigurationProfileIdentifier: required(
|
|
695
|
+
'EBK_APPCONFIG_PROFILE_ID',
|
|
696
|
+
),
|
|
697
|
+
EnvironmentIdentifier: required('EBK_APPCONFIG_ENVIRONMENT_ID'),
|
|
698
|
+
}),
|
|
699
|
+
);
|
|
700
|
+
token = session.InitialConfigurationToken;
|
|
701
|
+
}
|
|
702
|
+
if (!token) throw new Error('AppConfig did not return a session token.');
|
|
703
|
+
const latest = await client.send(
|
|
704
|
+
new GetLatestConfigurationCommand({ ConfigurationToken: token }),
|
|
705
|
+
);
|
|
706
|
+
token = latest.NextPollConfigurationToken;
|
|
707
|
+
if (!token) throw new Error('AppConfig did not return the next poll token.');
|
|
708
|
+
if (!latest.Configuration?.byteLength) {
|
|
709
|
+
if (!cached) {
|
|
710
|
+
throw new Error('AppConfig returned no initial configuration.');
|
|
711
|
+
}
|
|
712
|
+
cached = { ...cached, loadedAt: Date.now() };
|
|
713
|
+
return cached;
|
|
714
|
+
}
|
|
715
|
+
if (!latest.VersionLabel) {
|
|
716
|
+
throw new Error('AppConfig did not return a versioned document.');
|
|
717
|
+
}
|
|
718
|
+
const document = JSON.parse(
|
|
719
|
+
new TextDecoder().decode(latest.Configuration),
|
|
720
|
+
) as { schemaVersion?: unknown; values?: unknown };
|
|
721
|
+
const values = document.values as Record<string, unknown> | undefined;
|
|
722
|
+
if (
|
|
723
|
+
document.schemaVersion !== 1 ||
|
|
724
|
+
!values ||
|
|
725
|
+
typeof values !== 'object' ||
|
|
726
|
+
Array.isArray(values) ||
|
|
727
|
+
typeof values['${slice}.provider-delivery-v1'] !== 'boolean' ||
|
|
728
|
+
!Number.isInteger(
|
|
729
|
+
values['${slice}.provider-delivery-percentage'],
|
|
730
|
+
)
|
|
731
|
+
) {
|
|
732
|
+
throw new Error('AppConfig document is invalid.');
|
|
733
|
+
}
|
|
734
|
+
cached = {
|
|
735
|
+
loadedAt: Date.now(),
|
|
736
|
+
values,
|
|
737
|
+
version: latest.VersionLabel,
|
|
738
|
+
};
|
|
739
|
+
return cached;
|
|
740
|
+
};
|
|
741
|
+
const load = async (): Promise<{
|
|
742
|
+
snapshot?: Snapshot;
|
|
743
|
+
stale: boolean;
|
|
744
|
+
}> => {
|
|
745
|
+
const age = cached ? Date.now() - cached.loadedAt : Infinity;
|
|
746
|
+
if (cached && age < REFRESH_AFTER_MS) {
|
|
747
|
+
return { snapshot: cached, stale: false };
|
|
748
|
+
}
|
|
749
|
+
inFlight ??= refresh().finally(() => {
|
|
750
|
+
inFlight = undefined;
|
|
751
|
+
});
|
|
752
|
+
try {
|
|
753
|
+
return { snapshot: await inFlight, stale: false };
|
|
754
|
+
} catch {
|
|
755
|
+
token = undefined;
|
|
756
|
+
const staleAge = cached ? Date.now() - cached.loadedAt : Infinity;
|
|
757
|
+
return {
|
|
758
|
+
...(cached && staleAge <= MAX_STALE_MS ? { snapshot: cached } : {}),
|
|
759
|
+
stale: true,
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
const resolve = async <Value extends boolean | number>(
|
|
764
|
+
flagKey: string,
|
|
765
|
+
defaultValue: Value,
|
|
766
|
+
valid: (value: unknown) => value is Value,
|
|
767
|
+
): Promise<Evaluation<Value>> => {
|
|
768
|
+
const loaded = await load();
|
|
769
|
+
const value = loaded.snapshot?.values[flagKey];
|
|
770
|
+
if (!loaded.snapshot || !valid(value)) {
|
|
771
|
+
return {
|
|
772
|
+
errorCategory: 'PROVIDER_UNAVAILABLE',
|
|
773
|
+
flagKey,
|
|
774
|
+
providerName: 'aws-appconfig',
|
|
775
|
+
reason: 'ERROR',
|
|
776
|
+
value: defaultValue,
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
return {
|
|
780
|
+
...(loaded.stale
|
|
781
|
+
? { errorCategory: 'PROVIDER_UNAVAILABLE' as const }
|
|
782
|
+
: {}),
|
|
783
|
+
flagKey,
|
|
784
|
+
providerName: 'aws-appconfig',
|
|
785
|
+
providerVersion: loaded.snapshot.version,
|
|
786
|
+
reason: loaded.stale ? 'STALE' : 'CACHED',
|
|
787
|
+
value,
|
|
788
|
+
};
|
|
789
|
+
};
|
|
790
|
+
return {
|
|
791
|
+
resolveBooleanEvaluation: (flagKey, defaultValue) =>
|
|
792
|
+
resolve(
|
|
793
|
+
flagKey,
|
|
794
|
+
defaultValue,
|
|
795
|
+
(value): value is boolean => typeof value === 'boolean',
|
|
796
|
+
),
|
|
797
|
+
resolveNumberEvaluation: (flagKey, defaultValue) =>
|
|
798
|
+
resolve(
|
|
799
|
+
flagKey,
|
|
800
|
+
defaultValue,
|
|
801
|
+
(value): value is number => Number.isInteger(value),
|
|
802
|
+
),
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
export async function providerDeliveryAssignment(
|
|
807
|
+
provider: HostConfigurationProvider,
|
|
808
|
+
operationalIdentity:
|
|
809
|
+
| OperationalRolloutStableKey
|
|
810
|
+
| typeof workloadOperationalIdentity,
|
|
811
|
+
) {
|
|
812
|
+
const [enabled, percentage] = await Promise.all([
|
|
813
|
+
provider.resolveBooleanEvaluation('${slice}.provider-delivery-v1', false),
|
|
814
|
+
provider.resolveNumberEvaluation(
|
|
815
|
+
'${slice}.provider-delivery-percentage',
|
|
816
|
+
0,
|
|
817
|
+
),
|
|
818
|
+
]);
|
|
819
|
+
const safeDefault =
|
|
820
|
+
enabled.value === false &&
|
|
821
|
+
percentage.value === 0 &&
|
|
822
|
+
enabled.errorCategory !== undefined &&
|
|
823
|
+
percentage.errorCategory !== undefined;
|
|
824
|
+
const staleLastKnownValid =
|
|
825
|
+
enabled.reason === 'STALE' &&
|
|
826
|
+
percentage.reason === 'STALE' &&
|
|
827
|
+
enabled.providerVersion !== undefined &&
|
|
828
|
+
enabled.providerVersion === percentage.providerVersion;
|
|
829
|
+
if (
|
|
830
|
+
((!safeDefault && !staleLastKnownValid) &&
|
|
831
|
+
(enabled.errorCategory || percentage.errorCategory)) ||
|
|
832
|
+
(!safeDefault &&
|
|
833
|
+
(
|
|
834
|
+
!enabled.providerVersion ||
|
|
835
|
+
enabled.providerVersion !== percentage.providerVersion
|
|
836
|
+
)) ||
|
|
837
|
+
!Number.isInteger(percentage.value) ||
|
|
838
|
+
percentage.value < 0 ||
|
|
839
|
+
percentage.value > 100
|
|
840
|
+
) {
|
|
841
|
+
throw new Error('Provider-delivery configuration is unavailable.');
|
|
842
|
+
}
|
|
843
|
+
const providerVersion =
|
|
844
|
+
enabled.providerVersion ?? 'safe-default-v1';
|
|
845
|
+
const operationalStableKey =
|
|
846
|
+
operationalIdentity === workloadOperationalIdentity
|
|
847
|
+
? workloadOperationalStableKey
|
|
848
|
+
: operationalIdentity;
|
|
849
|
+
return {
|
|
850
|
+
...evaluatePercentageRollout({
|
|
851
|
+
enabled: enabled.value,
|
|
852
|
+
percentage: percentage.value,
|
|
853
|
+
rolloutId: '${slice}-provider-delivery',
|
|
854
|
+
stableKey: operationalStableKey,
|
|
855
|
+
version: providerVersion,
|
|
856
|
+
}),
|
|
857
|
+
host: '${kind}' as const,
|
|
858
|
+
providerVersion,
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
let hostProvider: HostConfigurationProvider | undefined;
|
|
863
|
+
export const workloadOperationalIdentity =
|
|
864
|
+
'${kind}-${slice}-${workload}-host-v1' as const;
|
|
865
|
+
export const workloadOperationalStableKey =
|
|
866
|
+
deriveOperationalRolloutStableKey({
|
|
867
|
+
kind: '${kind}',
|
|
868
|
+
slice: '${slice}',
|
|
869
|
+
workload: '${workload}',
|
|
870
|
+
});
|
|
871
|
+
export function hostProviderDeliveryAssignment(
|
|
872
|
+
operationalIdentity:
|
|
873
|
+
| OperationalRolloutStableKey
|
|
874
|
+
| typeof workloadOperationalIdentity,
|
|
875
|
+
) {
|
|
876
|
+
hostProvider ??= createHostConfigurationProvider();
|
|
877
|
+
return providerDeliveryAssignment(
|
|
878
|
+
hostProvider,
|
|
879
|
+
operationalIdentity,
|
|
880
|
+
);
|
|
881
|
+
}
|
|
882
|
+
`;
|
|
883
|
+
files[`${relativeRoot}/src/provider-delivery.spec.ts`] =
|
|
884
|
+
`import { describe, expect, it } from 'vitest';
|
|
885
|
+
import {
|
|
886
|
+
providerDeliveryAssignment,
|
|
887
|
+
workloadOperationalIdentity,
|
|
888
|
+
workloadOperationalStableKey,
|
|
889
|
+
} from './provider-delivery.js';
|
|
890
|
+
|
|
891
|
+
const provider = {
|
|
892
|
+
async resolveBooleanEvaluation(flagKey: string) {
|
|
893
|
+
return {
|
|
894
|
+
flagKey,
|
|
895
|
+
providerName: 'aws-appconfig',
|
|
896
|
+
providerVersion: 'release-018f8d',
|
|
897
|
+
reason: 'STATIC' as const,
|
|
898
|
+
value: true,
|
|
899
|
+
};
|
|
900
|
+
},
|
|
901
|
+
async resolveNumberEvaluation(flagKey: string) {
|
|
902
|
+
return {
|
|
903
|
+
flagKey,
|
|
904
|
+
providerName: 'aws-appconfig',
|
|
905
|
+
providerVersion: 'release-018f8d',
|
|
906
|
+
reason: 'STATIC' as const,
|
|
907
|
+
value: 25,
|
|
908
|
+
};
|
|
909
|
+
},
|
|
910
|
+
};
|
|
911
|
+
|
|
912
|
+
describe('${workload} ${kind} rollout binding', () => {
|
|
913
|
+
it('imports and uses the declared operational workload identity', async () => {
|
|
914
|
+
expect(workloadOperationalStableKey).toMatch(/^opk_v1_[a-f0-9]{64}$/);
|
|
915
|
+
await expect(
|
|
916
|
+
providerDeliveryAssignment(
|
|
917
|
+
provider,
|
|
918
|
+
workloadOperationalIdentity,
|
|
919
|
+
),
|
|
920
|
+
).resolves.toEqual(
|
|
921
|
+
expect.objectContaining({
|
|
922
|
+
host: '${kind}',
|
|
923
|
+
providerVersion: 'release-018f8d',
|
|
924
|
+
}),
|
|
925
|
+
);
|
|
926
|
+
});
|
|
927
|
+
});
|
|
928
|
+
|
|
929
|
+
describe('${workload} ${kind} outage behavior', () => {
|
|
930
|
+
it('uses a safe disabled assignment before a valid snapshot exists', async () => {
|
|
931
|
+
const unavailable = {
|
|
932
|
+
async resolveBooleanEvaluation(flagKey: string) {
|
|
933
|
+
return {
|
|
934
|
+
errorCategory: 'PROVIDER_UNAVAILABLE' as const,
|
|
935
|
+
flagKey,
|
|
936
|
+
providerName: 'aws-appconfig',
|
|
937
|
+
reason: 'ERROR' as const,
|
|
938
|
+
value: false,
|
|
939
|
+
};
|
|
940
|
+
},
|
|
941
|
+
async resolveNumberEvaluation(flagKey: string) {
|
|
942
|
+
return {
|
|
943
|
+
errorCategory: 'PROVIDER_UNAVAILABLE' as const,
|
|
944
|
+
flagKey,
|
|
945
|
+
providerName: 'aws-appconfig',
|
|
946
|
+
reason: 'ERROR' as const,
|
|
947
|
+
value: 0,
|
|
948
|
+
};
|
|
949
|
+
},
|
|
101
950
|
};
|
|
102
|
-
|
|
951
|
+
|
|
952
|
+
await expect(
|
|
953
|
+
providerDeliveryAssignment(
|
|
954
|
+
unavailable,
|
|
955
|
+
workloadOperationalIdentity,
|
|
956
|
+
),
|
|
957
|
+
).resolves.toEqual(
|
|
958
|
+
expect.objectContaining({
|
|
959
|
+
assigned: false,
|
|
960
|
+
providerVersion: 'safe-default-v1',
|
|
961
|
+
}),
|
|
962
|
+
);
|
|
963
|
+
});
|
|
964
|
+
});
|
|
965
|
+
`;
|
|
966
|
+
(0, index_js_1.assertManagedJsonPointersExist)(files[`${relativeRoot}/package.json`] ?? '', kind === 'service' && ownsProtectedLoadAdapter
|
|
967
|
+
? exports.SERVICE_WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS
|
|
968
|
+
: exports.WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS, `Built-in ${kind} package.json`);
|
|
103
969
|
return {
|
|
104
970
|
factoryName,
|
|
105
971
|
files,
|
|
106
972
|
paths: [
|
|
107
973
|
{ mode: 'seeded', path: `${relativeRoot}/README.md` },
|
|
974
|
+
{ mode: 'seeded', path: `${relativeRoot}/RUNBOOK.md` },
|
|
108
975
|
{ path: `${relativeRoot}/Dockerfile` },
|
|
109
976
|
{ path: `${relativeRoot}/infra.ts` },
|
|
110
977
|
{
|
|
111
|
-
managedJsonPointers: [
|
|
978
|
+
managedJsonPointers: [
|
|
979
|
+
...(kind === 'service' && ownsProtectedLoadAdapter
|
|
980
|
+
? exports.SERVICE_WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS
|
|
981
|
+
: exports.WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS),
|
|
982
|
+
],
|
|
112
983
|
path: `${relativeRoot}/package.json`,
|
|
113
984
|
},
|
|
114
985
|
{ mode: 'seeded', path: `${relativeRoot}/src/${sourceName}` },
|
|
986
|
+
...(kind === 'service'
|
|
987
|
+
? [{ path: `${relativeRoot}/src/service-runtime.ts` }]
|
|
988
|
+
: []),
|
|
989
|
+
...(kind === 'service' && ownsProtectedLoadAdapter
|
|
990
|
+
? [
|
|
991
|
+
{ path: `${relativeRoot}/PERFORMANCE.md` },
|
|
992
|
+
{ path: `${relativeRoot}/src/performance.spec.ts` },
|
|
993
|
+
{ path: `${relativeRoot}/src/performance.ts` },
|
|
994
|
+
]
|
|
995
|
+
: []),
|
|
996
|
+
{ path: `${relativeRoot}/src/reliability.spec.ts` },
|
|
997
|
+
{ path: `${relativeRoot}/src/reliability.ts` },
|
|
998
|
+
{
|
|
999
|
+
mode: 'seeded',
|
|
1000
|
+
path: `${relativeRoot}/src/provider-delivery.spec.ts`,
|
|
1001
|
+
},
|
|
1002
|
+
{
|
|
1003
|
+
mode: 'seeded',
|
|
1004
|
+
path: `${relativeRoot}/src/provider-delivery.ts`,
|
|
1005
|
+
},
|
|
115
1006
|
{ mode: 'seeded', path: `${relativeRoot}/src/workload.spec.ts` },
|
|
116
1007
|
{ path: `${relativeRoot}/tsconfig.json` },
|
|
117
1008
|
{ path: `${relativeRoot}/vitest.config.ts` },
|
|
@@ -122,36 +1013,210 @@ function createWorkloadFilePlan(slice, workload, kind) {
|
|
|
122
1013
|
async function workloadGenerator(tree, options, kind) {
|
|
123
1014
|
const slice = name(options.slice, 'Product Slice name');
|
|
124
1015
|
const workload = name(options.name, kind === 'service' ? 'Service name' : 'Job name');
|
|
1016
|
+
const requestedFeature = name(options.feature, 'Feature');
|
|
125
1017
|
const plural = kind === 'service' ? 'services' : 'jobs';
|
|
126
1018
|
const sliceRoot = node_path_1.posix.join('packages', slice);
|
|
127
1019
|
const root = node_path_1.posix.join(sliceRoot, plural, workload);
|
|
128
1020
|
const productPath = node_path_1.posix.join(sliceRoot, 'infra/product.ts');
|
|
1021
|
+
const candidatePath = node_path_1.posix.join(sliceRoot, 'infra/workload-roles/candidate.ts');
|
|
1022
|
+
const intentPath = node_path_1.posix.join(sliceRoot, 'infra/workload-roles/effective-intent.ts');
|
|
1023
|
+
const installOperation = {
|
|
1024
|
+
generator: 'workload',
|
|
1025
|
+
id: `generator:workload:${slice}:${kind}:${workload}`,
|
|
1026
|
+
key: `workload-${slice}-${kind}-${workload}`,
|
|
1027
|
+
request: {
|
|
1028
|
+
feature: requestedFeature,
|
|
1029
|
+
kind,
|
|
1030
|
+
name: workload,
|
|
1031
|
+
skipFormat: options.skipFormat ?? false,
|
|
1032
|
+
slice,
|
|
1033
|
+
},
|
|
1034
|
+
resumeArguments: [
|
|
1035
|
+
'pnpm',
|
|
1036
|
+
'nx',
|
|
1037
|
+
'generate',
|
|
1038
|
+
`@empire-builder-kit/nx:${kind}`,
|
|
1039
|
+
`--name=${workload}`,
|
|
1040
|
+
`--slice=${slice}`,
|
|
1041
|
+
`--feature=${requestedFeature}`,
|
|
1042
|
+
`--skipFormat=${String(options.skipFormat ?? false)}`,
|
|
1043
|
+
'--skipInstall=false',
|
|
1044
|
+
'--interactive=false',
|
|
1045
|
+
],
|
|
1046
|
+
semanticPrerequisites: [
|
|
1047
|
+
(0, post_generation_install_js_1.postGenerationInstallFeaturePrerequisite)(node_path_1.posix.join(sliceRoot, feature_registry_js_1.SLICE_FEATURE_REGISTRY_PATH), requestedFeature),
|
|
1048
|
+
],
|
|
1049
|
+
sourceRoot: root,
|
|
1050
|
+
};
|
|
1051
|
+
const pendingInstall = (0, post_generation_install_js_1.resumePendingPostGenerationInstall)(tree, installOperation, options.skipInstall);
|
|
1052
|
+
if (pendingInstall)
|
|
1053
|
+
return pendingInstall;
|
|
1054
|
+
const packageSource = tree.read('package.json', 'utf8');
|
|
1055
|
+
if (packageSource === null) {
|
|
1056
|
+
throw new Error('Workspace package.json is required.');
|
|
1057
|
+
}
|
|
1058
|
+
let packageJson;
|
|
1059
|
+
try {
|
|
1060
|
+
packageJson = JSON.parse(packageSource);
|
|
1061
|
+
}
|
|
1062
|
+
catch {
|
|
1063
|
+
throw new Error('Workspace package.json must be valid JSON.');
|
|
1064
|
+
}
|
|
1065
|
+
const workspace = name(typeof packageJson.name === 'string' ? packageJson.name : '', 'Workspace name');
|
|
1066
|
+
const runtimeVersion = packageJson.dependencies?.['@empire-builder-kit/runtime'];
|
|
1067
|
+
if (typeof runtimeVersion !== 'string' || runtimeVersion.trim() === '') {
|
|
1068
|
+
throw new Error('Workspace package.json must declare @empire-builder-kit/runtime before generating a workload.');
|
|
1069
|
+
}
|
|
129
1070
|
if (!tree.exists(productPath)) {
|
|
130
1071
|
throw new Error(`${slice} is not an EBK v1 Product Slice.`);
|
|
131
1072
|
}
|
|
1073
|
+
requireCompositionMarker(tree, candidatePath, '// <ebk:workload-role-extensions:end>');
|
|
1074
|
+
requireCompositionMarker(tree, intentPath, '// <ebk:workload-role-intent-contributions:end>');
|
|
1075
|
+
for (const marker of [
|
|
1076
|
+
'// <ebk:composition-imports:end>',
|
|
1077
|
+
'// <ebk:workload-registrations:end>',
|
|
1078
|
+
'// <ebk:composition-outputs:end>',
|
|
1079
|
+
]) {
|
|
1080
|
+
requireCompositionMarker(tree, productPath, marker);
|
|
1081
|
+
}
|
|
1082
|
+
const feature = (0, feature_registry_js_1.requireRegisteredSliceFeature)(tree, sliceRoot, requestedFeature);
|
|
132
1083
|
if (tree.exists(root)) {
|
|
133
1084
|
throw new Error(`${kind} ${workload} already exists at ${root}.`);
|
|
134
1085
|
}
|
|
135
|
-
const
|
|
1086
|
+
const loggingRegistration = (0, logging_registry_js_1.planSliceLoggingComponentRegistration)(tree, sliceRoot, `${kind}-${workload}`);
|
|
1087
|
+
const performanceRegistration = (0, performance_registration_js_1.planWorkloadPerformanceRegistration)(tree, {
|
|
1088
|
+
kind,
|
|
1089
|
+
name: workload,
|
|
1090
|
+
runtimeVersion,
|
|
1091
|
+
slice,
|
|
1092
|
+
sliceRoot,
|
|
1093
|
+
workspace,
|
|
1094
|
+
});
|
|
1095
|
+
const reliabilityRegistration = (0, reliability_registration_js_1.planWorkloadReliabilityRegistration)(tree, {
|
|
1096
|
+
feature,
|
|
1097
|
+
kind,
|
|
1098
|
+
name: workload,
|
|
1099
|
+
slice,
|
|
1100
|
+
sliceRoot,
|
|
1101
|
+
});
|
|
1102
|
+
const plan = createWorkloadFilePlan(workspace, slice, workload, kind, runtimeVersion, feature, performanceRegistration.ownsProtectedLoadAdapter);
|
|
1103
|
+
const additionalPerformancePaths = performanceRegistration.additionalFiles.map(({ path }) => path);
|
|
1104
|
+
const installScope = {
|
|
1105
|
+
exactPaths: [
|
|
1106
|
+
productPath,
|
|
1107
|
+
candidatePath,
|
|
1108
|
+
intentPath,
|
|
1109
|
+
node_path_1.posix.join(sliceRoot, logging_registry_js_1.SLICE_LOGGING_REGISTRY_PATH),
|
|
1110
|
+
node_path_1.posix.join(sliceRoot, performance_registration_js_1.WORKLOAD_PERFORMANCE_POLICY_PATH),
|
|
1111
|
+
...additionalPerformancePaths,
|
|
1112
|
+
node_path_1.posix.join(sliceRoot, reliability_registration_js_1.WORKLOAD_RELIABILITY_REGISTRY_PATH),
|
|
1113
|
+
node_path_1.posix.join(sliceRoot, RELEASE_REGISTRY_PATH),
|
|
1114
|
+
node_path_1.posix.join(sliceRoot, '.ebk/ownership.json'),
|
|
1115
|
+
],
|
|
1116
|
+
requiredPaths: [
|
|
1117
|
+
node_path_1.posix.join(root, 'package.json'),
|
|
1118
|
+
productPath,
|
|
1119
|
+
candidatePath,
|
|
1120
|
+
intentPath,
|
|
1121
|
+
node_path_1.posix.join(sliceRoot, logging_registry_js_1.SLICE_LOGGING_REGISTRY_PATH),
|
|
1122
|
+
node_path_1.posix.join(sliceRoot, performance_registration_js_1.WORKLOAD_PERFORMANCE_POLICY_PATH),
|
|
1123
|
+
...additionalPerformancePaths,
|
|
1124
|
+
node_path_1.posix.join(sliceRoot, reliability_registration_js_1.WORKLOAD_RELIABILITY_REGISTRY_PATH),
|
|
1125
|
+
node_path_1.posix.join(sliceRoot, RELEASE_REGISTRY_PATH),
|
|
1126
|
+
node_path_1.posix.join(sliceRoot, '.ebk/ownership.json'),
|
|
1127
|
+
],
|
|
1128
|
+
roots: [root],
|
|
1129
|
+
};
|
|
1130
|
+
const installState = options.skipInstall
|
|
1131
|
+
? undefined
|
|
1132
|
+
: (0, post_generation_install_js_1.capturePostGenerationInstallState)(tree, installScope, installOperation);
|
|
136
1133
|
const { factoryName } = plan;
|
|
137
1134
|
const infraRelative = `../${plural}/${workload}/infra.js`;
|
|
138
1135
|
for (const [path, contents] of Object.entries(plan.files)) {
|
|
139
1136
|
tree.write(node_path_1.posix.join(sliceRoot, path), contents);
|
|
140
1137
|
}
|
|
1138
|
+
tree.write(loggingRegistration.path, loggingRegistration.contents);
|
|
1139
|
+
tree.write(performanceRegistration.path, performanceRegistration.contents);
|
|
1140
|
+
for (const file of performanceRegistration.additionalFiles) {
|
|
1141
|
+
tree.write(file.path, file.contents);
|
|
1142
|
+
}
|
|
1143
|
+
tree.write(reliabilityRegistration.path, reliabilityRegistration.contents);
|
|
1144
|
+
registerReleaseArtifact(tree, sliceRoot, slice, workload, kind);
|
|
141
1145
|
replaceMarker(tree, productPath, '// <ebk:composition-imports:end>', `import { ${factoryName} } from '${infraRelative}';`);
|
|
142
|
-
replaceMarker(tree, productPath, '// <ebk:workload-registrations:end>', ` const ${kind}${pascal(workload)} = ${factoryName}(
|
|
1146
|
+
replaceMarker(tree, productPath, '// <ebk:workload-registrations:end>', ` const ${kind}${pascal(workload)} = ${factoryName}(
|
|
1147
|
+
foundation.cluster,
|
|
1148
|
+
foundation.discovery.alertTopicArn,
|
|
1149
|
+
{
|
|
1150
|
+
frameworkVersion: ${JSON.stringify(performanceRegistration.tagContext.frameworkVersion)},
|
|
1151
|
+
owner: ${JSON.stringify(performanceRegistration.tagContext.owner)},
|
|
1152
|
+
productionProfile: ${JSON.stringify(performanceRegistration.tagContext.productionProfile)},
|
|
1153
|
+
repository: ${JSON.stringify(performanceRegistration.tagContext.repository)},
|
|
1154
|
+
},
|
|
1155
|
+
${kind !== 'service' || performanceRegistration.ownsProtectedLoadAdapter
|
|
1156
|
+
? ` performanceDeploymentBinding,
|
|
1157
|
+
`
|
|
1158
|
+
: ''}
|
|
1159
|
+
${kind === 'service' && performanceRegistration.ownsProtectedLoadAdapter
|
|
1160
|
+
? ` performanceIngress,
|
|
1161
|
+
performanceDeploymentBinding
|
|
1162
|
+
? workloadRoleBindings?.extension.servicePerformance('${workload}')
|
|
1163
|
+
: workloadRoleBindings?.extension.service('${workload}'),
|
|
1164
|
+
`
|
|
1165
|
+
: kind === 'service'
|
|
1166
|
+
? ` workloadRoleBindings?.extension.service('${workload}'),
|
|
1167
|
+
`
|
|
1168
|
+
: ` workloadRoleBindings?.extension.job('${workload}'),
|
|
1169
|
+
`}
|
|
1170
|
+
${kind === 'service' && performanceRegistration.ownsProtectedLoadAdapter
|
|
1171
|
+
? ` performanceDeploymentBinding
|
|
1172
|
+
? secretLinksForWorkloads(
|
|
1173
|
+
'${workload}-service-task',
|
|
1174
|
+
'${workload}-service-performance-task',
|
|
1175
|
+
)
|
|
1176
|
+
: secretLinksFor('${workload}-service-task'),`
|
|
1177
|
+
: kind === 'service'
|
|
1178
|
+
? ` secretLinksFor('${workload}-service-task'),`
|
|
1179
|
+
: ` secretLinksFor('${workload}-job-task'),`}
|
|
1180
|
+
runtimeConfiguration
|
|
1181
|
+
? {
|
|
1182
|
+
applicationId: runtimeConfiguration.application.id,
|
|
1183
|
+
deployment: runtimeConfiguration.deployment,
|
|
1184
|
+
environmentId: runtimeConfiguration.environment.environmentId,
|
|
1185
|
+
profileId: runtimeConfiguration.profile.configurationProfileId,
|
|
1186
|
+
}
|
|
1187
|
+
: undefined,
|
|
1188
|
+
);`);
|
|
143
1189
|
replaceMarker(tree, productPath, '// <ebk:composition-outputs:end>', ` ${kind}${pascal(workload)},`);
|
|
1190
|
+
replaceMarker(tree, candidatePath, '// <ebk:workload-role-extensions:end>', ` { id: '${workload}', kind: '${kind}' },`);
|
|
1191
|
+
replaceMarker(tree, intentPath, '// <ebk:workload-role-intent-contributions:end>', ` ...extensionWorkloadRoleIntentContributions(context, topology, '${workload}', '${kind}'),`);
|
|
144
1192
|
if (!options.skipFormat)
|
|
145
1193
|
await (0, devkit_1.formatFiles)(tree);
|
|
146
1194
|
(0, index_js_1.recordCompositionOwnership)(tree, {
|
|
147
|
-
|
|
1195
|
+
compositions: [{ feature, kind, name: workload }],
|
|
1196
|
+
paths: [
|
|
1197
|
+
...plan.paths,
|
|
1198
|
+
{ path: 'infra/product.ts' },
|
|
1199
|
+
{ path: 'infra/workload-roles/candidate.ts' },
|
|
1200
|
+
{ path: 'infra/workload-roles/effective-intent.ts' },
|
|
1201
|
+
{ path: logging_registry_js_1.SLICE_LOGGING_REGISTRY_PATH },
|
|
1202
|
+
{ mode: 'seeded', path: performance_registration_js_1.WORKLOAD_PERFORMANCE_POLICY_PATH },
|
|
1203
|
+
...performanceRegistration.additionalFiles.map(({ mode, path }) => ({
|
|
1204
|
+
mode,
|
|
1205
|
+
path: node_path_1.posix.relative(sliceRoot, path),
|
|
1206
|
+
})),
|
|
1207
|
+
{ mode: 'seeded', path: reliability_registration_js_1.WORKLOAD_RELIABILITY_REGISTRY_PATH },
|
|
1208
|
+
{ mode: 'seeded', path: RELEASE_REGISTRY_PATH },
|
|
1209
|
+
],
|
|
148
1210
|
projects: [plan.project],
|
|
149
1211
|
slice,
|
|
150
1212
|
});
|
|
151
1213
|
if (!options.skipFormat)
|
|
152
1214
|
await (0, devkit_1.formatFiles)(tree);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
1215
|
+
if (options.skipInstall)
|
|
1216
|
+
return undefined;
|
|
1217
|
+
if (!installState) {
|
|
1218
|
+
throw new Error('Post-generation install state was not prepared.');
|
|
1219
|
+
}
|
|
1220
|
+
return (0, post_generation_install_js_1.createPostGenerationInstallCallback)(tree, installState, installScope, installOperation);
|
|
156
1221
|
}
|
|
157
1222
|
//# sourceMappingURL=workload.js.map
|