@empire-builder-kit/nx 1.0.0-rc.37 → 1.0.0-rc.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/executors.json +5 -0
- package/generators.json +10 -0
- package/package.json +20 -3
- package/src/aws-authority/index.d.ts +1 -0
- package/src/aws-authority/index.js +1 -0
- package/src/aws-authority/lambda-policy-ordering.d.ts +38 -0
- package/src/aws-authority/lambda-policy-ordering.js +56 -0
- package/src/aws-authority/stage-authority.d.ts +11 -3
- package/src/aws-authority/stage-authority.js +615 -29
- package/src/blueprints/external-sandbox.js +21 -9
- package/src/blueprints/manifest.d.ts +1 -1
- package/src/blueprints/resolver.js +28 -15
- package/src/cli/bootstrap.d.ts +1 -1
- package/src/cli/deploy-runtime.d.ts +6 -0
- package/src/cli/deploy-runtime.js +58 -0
- package/src/cli/dev-command.d.ts +16 -4
- package/src/cli/dev-command.js +63 -0
- package/src/cli/main.d.ts +7 -1
- package/src/cli/main.js +128 -20
- package/src/cli/output.d.ts +1 -1
- package/src/developer-agent/context.js +41 -9
- package/src/developer-agent/generator-planning.js +16 -2
- package/src/developer-agent/git-inspection.d.ts +6 -2
- package/src/developer-agent/git-inspection.js +78 -6
- package/src/developer-agent/model.d.ts +4 -2
- package/src/developer-agent/operation-registry.d.ts +5 -0
- package/src/developer-agent/operation-registry.js +179 -23
- package/src/developer-agent/preview-changes.d.ts +2 -0
- package/src/developer-agent/preview-changes.js +14 -2
- package/src/developer-agent/preview-source.js +3 -0
- package/src/developer-agent/validation.js +20 -8
- package/src/developer-agent/workspace-inspection.js +37 -3
- package/src/executors/deployment-plan/deployment-plan.d.ts +2 -0
- package/src/executors/deployment-plan/deployment-plan.js +51 -4
- package/src/executors/dev-doctor/dev-doctor.js +13 -6
- package/src/executors/dev-task-cleanup/dev-task-cleanup.d.ts +23 -0
- package/src/executors/dev-task-cleanup/dev-task-cleanup.js +145 -0
- package/src/executors/dev-task-cleanup/schema.json +9 -0
- package/src/executors/dev-task-cleanup/task-stack-absence.d.ts +27 -0
- package/src/executors/dev-task-cleanup/task-stack-absence.js +281 -0
- package/src/executors/dev-task-cleanup/task-stack-checkpoint.d.ts +12 -0
- package/src/executors/dev-task-cleanup/task-stack-checkpoint.js +92 -0
- package/src/executors/fleet/fleet.js +1 -1
- package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +28 -1
- package/src/executors/local-deploy/local-deploy.d.ts +8 -1
- package/src/executors/local-deploy/local-deploy.js +97 -24
- package/src/executors/local-deploy/schema.json +8 -0
- package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js +30 -18
- package/src/executors/sst-lifecycle/governed-native-operation.d.ts +2 -0
- package/src/executors/sst-lifecycle/governed-native-operation.js +9 -0
- package/src/executors/sst-lifecycle/run-sst-command.d.ts +5 -0
- package/src/executors/sst-lifecycle/run-sst-command.js +220 -32
- package/src/executors/sst-lifecycle/sst-environment-source.d.ts +8 -0
- package/src/executors/sst-lifecycle/sst-environment-source.js +54 -0
- package/src/executors/sst-lifecycle/task-unlock.d.ts +15 -0
- package/src/executors/sst-lifecycle/task-unlock.js +126 -0
- package/src/foundation/capability-plan.d.ts +43 -0
- package/src/foundation/capability-plan.js +168 -0
- package/src/foundation/discovery.d.ts +14 -11
- package/src/foundation/discovery.js +32 -6
- package/src/foundation/index.d.ts +1 -0
- package/src/foundation/index.js +1 -0
- package/src/foundation/local-database-contract.d.ts +20 -0
- package/src/foundation/local-database-contract.js +262 -13
- package/src/foundation/local-private-smoke-access.d.ts +20 -0
- package/src/foundation/local-private-smoke-access.js +197 -0
- package/src/foundation/preflight.js +37 -18
- package/src/foundation/private-smoke-access.js +10 -2
- package/src/foundation/private-smoke-admission.d.ts +3 -1
- package/src/foundation/private-smoke-admission.js +29 -8
- package/src/foundation/private-smoke-control-plane.js +17 -6
- package/src/foundation/provision-database-bindings.d.ts +5 -0
- package/src/foundation/provision-database-bindings.js +41 -8
- package/src/foundation/provision-logical-database.js +13 -8
- package/src/foundation/requirements.d.ts +3 -3
- package/src/foundation/requirements.js +24 -12
- package/src/foundation/router-waf.d.ts +1 -0
- package/src/foundation/router-waf.js +14 -1
- package/src/generators/blueprint/blueprint.d.ts +5 -0
- package/src/generators/blueprint/blueprint.js +102 -0
- package/src/generators/blueprint/files.d.ts +6 -0
- package/src/generators/blueprint/files.js +217 -0
- package/src/generators/blueprint/schema.d.ts +4 -0
- package/src/generators/blueprint/schema.json +18 -0
- package/src/generators/formatting.js +24 -1
- package/src/generators/logging-registry.d.ts +2 -0
- package/src/generators/logging-registry.js +22 -0
- package/src/generators/preset/workspace-files-adopter-skills.d.ts +7 -0
- package/src/generators/preset/workspace-files-adopter-skills.js +301 -0
- package/src/generators/preset/workspace-files-ci-install.d.ts +2 -0
- package/src/generators/preset/workspace-files-ci-install.js +196 -0
- package/src/generators/preset/workspace-files-developer-agent.js +40 -13
- package/src/generators/preset/workspace-files-performance-load.js +8 -0
- package/src/generators/preset/workspace-files-stage-authority.js +40 -1
- package/src/generators/preset/workspace-files-thin-deploy.js +66 -34
- package/src/generators/preset/workspace-files-thin-docs.js +64 -18
- package/src/generators/preset/workspace-files.d.ts +4 -0
- package/src/generators/preset/workspace-files.js +159 -91
- package/src/generators/repository-policy/repository-policy.js +37 -0
- package/src/generators/slice/built-in-plan-api-contract-files.js +42 -7
- package/src/generators/slice/built-in-plan-api-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-api-files.js +47 -389
- package/src/generators/slice/built-in-plan-async-work-files.js +19 -1912
- package/src/generators/slice/built-in-plan-authorization-files.js +92 -329
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +36 -2
- package/src/generators/slice/built-in-plan-authorization-storage.d.ts +3 -0
- package/src/generators/slice/built-in-plan-authorization-storage.js +119 -0
- package/src/generators/slice/built-in-plan-background-work-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-background-work-files.js +15 -5
- package/src/generators/slice/built-in-plan-data-deletion-files.js +2 -830
- package/src/generators/slice/built-in-plan-data-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-data-files.js +61 -1164
- package/src/generators/slice/built-in-plan-data-lifecycle-files.js +53 -28
- package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +18 -2
- package/src/generators/slice/built-in-plan-data-retention-job-files.js +7 -2446
- package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +30 -6
- package/src/generators/slice/built-in-plan-data-rights-files.js +6 -4482
- package/src/generators/slice/built-in-plan-database-lifecycle-files.js +4 -15
- package/src/generators/slice/built-in-plan-foundation-files.d.ts +2 -1
- package/src/generators/slice/built-in-plan-foundation-files.js +34 -10
- package/src/generators/slice/built-in-plan-frontend-files.js +2 -2
- package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-infrastructure-files.js +180 -522
- package/src/generators/slice/built-in-plan-key-value-cleanup.d.ts +4 -0
- package/src/generators/slice/built-in-plan-key-value-cleanup.js +100 -0
- package/src/generators/slice/built-in-plan-key-value-consumer.d.ts +4 -0
- package/src/generators/slice/built-in-plan-key-value-consumer.js +151 -0
- package/src/generators/slice/built-in-plan-key-value-deletion.d.ts +2 -0
- package/src/generators/slice/built-in-plan-key-value-deletion.js +377 -0
- package/src/generators/slice/built-in-plan-key-value-delivery.d.ts +2 -0
- package/src/generators/slice/built-in-plan-key-value-delivery.js +120 -0
- package/src/generators/slice/built-in-plan-key-value-export.d.ts +2 -0
- package/src/generators/slice/built-in-plan-key-value-export.js +595 -0
- package/src/generators/slice/built-in-plan-key-value-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-key-value-files.js +31 -0
- package/src/generators/slice/built-in-plan-key-value-holds.d.ts +2 -0
- package/src/generators/slice/built-in-plan-key-value-holds.js +189 -0
- package/src/generators/slice/built-in-plan-key-value-infrastructure.d.ts +2 -0
- package/src/generators/slice/built-in-plan-key-value-infrastructure.js +102 -0
- package/src/generators/slice/built-in-plan-key-value-performance.d.ts +5 -0
- package/src/generators/slice/built-in-plan-key-value-performance.js +530 -0
- package/src/generators/slice/built-in-plan-key-value-provider.d.ts +4 -0
- package/src/generators/slice/built-in-plan-key-value-provider.js +366 -0
- package/src/generators/slice/built-in-plan-key-value-records.d.ts +3 -0
- package/src/generators/slice/built-in-plan-key-value-records.js +232 -0
- package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.d.ts +2 -0
- package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.js +103 -0
- package/src/generators/slice/built-in-plan-key-value-retention-job-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-key-value-retention-job-files.js +160 -0
- package/src/generators/slice/built-in-plan-key-value-retention-maintenance.d.ts +2 -0
- package/src/generators/slice/built-in-plan-key-value-retention-maintenance.js +329 -0
- package/src/generators/slice/built-in-plan-key-value-retention-worker.d.ts +2 -0
- package/src/generators/slice/built-in-plan-key-value-retention-worker.js +477 -0
- package/src/generators/slice/built-in-plan-key-value-retention.d.ts +2 -0
- package/src/generators/slice/built-in-plan-key-value-retention.js +184 -0
- package/src/generators/slice/built-in-plan-metadata-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-metadata-files.js +140 -28
- package/src/generators/slice/built-in-plan-native-runtime-authority-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-native-runtime-authority-files.js +36 -19
- package/src/generators/slice/built-in-plan-operations-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-operations-files.js +89 -50
- package/src/generators/slice/built-in-plan-performance-files.js +84 -1010
- package/src/generators/slice/built-in-plan-project-files.js +116 -67
- package/src/generators/slice/built-in-plan-release-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-release-files.js +64 -15
- package/src/generators/slice/built-in-plan-reliability-files.js +54 -28
- package/src/generators/slice/built-in-plan-shared.d.ts +4 -2
- package/src/generators/slice/built-in-plan-shared.js +41 -19
- package/src/generators/slice/built-in-plan-sql-events.d.ts +2 -0
- package/src/generators/slice/built-in-plan-sql-events.js +257 -0
- package/src/generators/slice/built-in-plan-testing-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-testing-files.js +184 -132
- package/src/generators/slice/built-in-plan-testing-persistence-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-testing-persistence-files.js +178 -0
- package/src/generators/slice/built-in-plan-thin-release-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-thin-release-files.js +35 -2
- package/src/generators/slice/built-in-plan-verification-files.js +70 -0
- package/src/generators/slice/built-in-plan-web-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-web-files.js +206 -14
- package/src/generators/slice/built-in-plan-workload-role-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-workload-role-files.js +113 -274
- package/src/generators/slice/built-in-plan.d.ts +9 -1
- package/src/generators/slice/built-in-plan.js +49 -21
- package/src/generators/slice/data-policy-review-seed.d.ts +2 -0
- package/src/generators/slice/data-policy-review-seed.js +22 -0
- package/src/generators/slice/deployed-smoke-readiness.d.ts +2 -0
- package/src/generators/slice/deployed-smoke-readiness.js +214 -0
- package/src/generators/slice/local-source-identity.d.ts +2 -0
- package/src/generators/slice/local-source-identity.js +31 -0
- package/src/generators/slice/persistence-contract.d.ts +14 -0
- package/src/generators/slice/persistence-contract.js +32 -0
- package/src/generators/slice/slice.js +29 -24
- package/src/generators/sql/schema.d.ts +7 -0
- package/src/generators/sql/schema.json +38 -0
- package/src/generators/sql/sql.d.ts +6 -0
- package/src/generators/sql/sql.js +53 -0
- package/src/generators/upgrade/sql-seeded-reconciliation.d.ts +2 -0
- package/src/generators/upgrade/sql-seeded-reconciliation.js +170 -0
- package/src/generators/upgrade/upgrade.d.ts +2 -0
- package/src/generators/upgrade/upgrade.js +136 -9
- package/src/generators/workload/workload.js +51 -2
- package/src/local-dev/browser-verification.d.ts +37 -0
- package/src/local-dev/browser-verification.js +281 -0
- package/src/local-dev/contracts.d.ts +10 -1
- package/src/local-dev/contracts.js +114 -13
- package/src/local-dev/dev-command-core.js +24 -5
- package/src/local-dev/docker-credential-health.d.ts +14 -0
- package/src/local-dev/docker-credential-health.js +94 -0
- package/src/local-dev/environment-inspector.d.ts +7 -0
- package/src/local-dev/environment-inspector.js +42 -15
- package/src/local-dev/environment-state.js +2 -2
- package/src/local-dev/errors.d.ts +1 -1
- package/src/local-dev/errors.js +2 -0
- package/src/local-dev/fleet-client.js +2 -2
- package/src/local-dev/fleet-configuration.js +57 -25
- package/src/local-dev/fleet-inventory.js +46 -18
- package/src/local-dev/fleet-ipc.d.ts +7 -0
- package/src/local-dev/fleet-ipc.js +14 -2
- package/src/local-dev/fleet-launcher.d.ts +6 -0
- package/src/local-dev/fleet-launcher.js +14 -2
- package/src/local-dev/fleet-logs.js +50 -22
- package/src/local-dev/fleet-process.d.ts +20 -1
- package/src/local-dev/fleet-process.js +197 -41
- package/src/local-dev/fleet-runner-evidence.d.ts +5 -0
- package/src/local-dev/fleet-runner-evidence.js +56 -0
- package/src/local-dev/fleet-runtime.js +268 -229
- package/src/local-dev/fleet-session.d.ts +2 -0
- package/src/local-dev/fleet-session.js +28 -11
- package/src/local-dev/fleet-slice-runner-daemon.js +4 -0
- package/src/local-dev/fleet-state.d.ts +5 -2
- package/src/local-dev/fleet-state.js +25 -4
- package/src/local-dev/fleet-supervisor.d.ts +3 -0
- package/src/local-dev/fleet-supervisor.js +66 -11
- package/src/local-dev/fleet-web-start.d.ts +12 -0
- package/src/local-dev/fleet-web-start.js +48 -0
- package/src/local-dev/identity.js +3 -14
- package/src/local-dev/index.d.ts +1 -0
- package/src/local-dev/index.js +1 -0
- package/src/local-dev/native-completion.d.ts +9 -0
- package/src/local-dev/native-completion.js +130 -0
- package/src/local-dev/nx-workspace.d.ts +4 -2
- package/src/local-dev/nx-workspace.js +11 -6
- package/src/local-dev/personal-stage.d.ts +4 -5
- package/src/local-dev/personal-stage.js +6 -54
- package/src/local-dev/port-claims.d.ts +13 -0
- package/src/local-dev/port-claims.js +46 -0
- package/src/local-dev/ports.d.ts +14 -2
- package/src/local-dev/ports.js +78 -3
- package/src/local-dev/private-state.d.ts +6 -0
- package/src/local-dev/private-state.js +126 -34
- package/src/local-dev/process-group.d.ts +4 -0
- package/src/local-dev/process-group.js +29 -0
- package/src/local-dev/process-identity.d.ts +8 -0
- package/src/local-dev/process-identity.js +31 -1
- package/src/local-dev/proxy.js +11 -12
- package/src/local-dev/runtime-paths.js +1 -1
- package/src/local-dev/slice-claim.js +1 -1
- package/src/local-dev/slice-runner.d.ts +15 -6
- package/src/local-dev/slice-runner.js +189 -54
- package/src/local-dev/task-attachment.d.ts +17 -0
- package/src/local-dev/task-attachment.js +73 -0
- package/src/local-dev/task-authority.d.ts +10 -0
- package/src/local-dev/task-authority.js +27 -0
- package/src/local-dev/task-identity.d.ts +33 -0
- package/src/local-dev/task-identity.js +418 -0
- package/src/local-dev/task-native-writer.d.ts +18 -0
- package/src/local-dev/task-native-writer.js +329 -0
- package/src/local-dev/tls.js +3 -1
- package/src/local-dev/web-launch.d.ts +9 -0
- package/src/local-dev/web-launch.js +130 -0
- package/src/ownership/composition.d.ts +2 -1
- package/src/ownership/composition.js +1 -0
- package/src/performance/scenario.d.ts +22 -0
- package/src/performance/scenario.js +100 -92
- package/src/repository-policy/deployment-plan.d.ts +2 -2
- package/src/repository-policy/deployment-plan.js +2 -1
- package/src/repository-policy/policy.js +38 -3
- package/src/schemas/blueprint-v1.json +5 -4
- package/src/schemas/foundation-requirement-v1.json +5 -4
- package/src/schemas/testing-evidence-result-v1.json +1 -1
- package/src/secrets/operator.d.ts +3 -1
- package/src/secrets/operator.js +22 -3
- package/src/sst-environment-source-format.d.ts +3 -0
- package/src/sst-environment-source-format.js +20 -0
- package/src/supply-chain/blueprint-trust-git.js +13 -3
- package/src/supply-chain/build-output.js +15 -0
- package/src/supply-chain/generated-blueprint-trust-command.js +18 -1
- package/src/testing-evidence/fixture-scope.d.ts +2 -1
- package/src/testing-evidence/fixture-scope.js +4 -2
- package/src/testing-evidence/result.d.ts +2 -1
- package/src/testing-evidence/result.js +18 -4
- package/src/workload-roles/standard-slice.js +2 -3
- package/src/api-contract/baseline-update.js.map +0 -1
- package/src/api-contract/compatibility.js.map +0 -1
- package/src/api-contract/contract-graph.js.map +0 -1
- package/src/api-contract/evidence.js.map +0 -1
- package/src/api-contract/index.js.map +0 -1
- package/src/api-contract/model.fixtures.d.ts +0 -2
- package/src/api-contract/model.fixtures.js +0 -81
- package/src/api-contract/model.fixtures.js.map +0 -1
- package/src/api-contract/model.js.map +0 -1
- package/src/api-contract/rollout.js.map +0 -1
- package/src/authorization/compatibility.js.map +0 -1
- package/src/authorization/index.js.map +0 -1
- package/src/aws/child-environment.js.map +0 -1
- package/src/aws/identity.js.map +0 -1
- package/src/aws-authority/index.js.map +0 -1
- package/src/aws-authority/stage-authority.js.map +0 -1
- package/src/blueprints/execution.js.map +0 -1
- package/src/blueprints/external-sandbox.js.map +0 -1
- package/src/blueprints/index.js.map +0 -1
- package/src/blueprints/inputs.js.map +0 -1
- package/src/blueprints/manifest.js.map +0 -1
- package/src/blueprints/resolver.js.map +0 -1
- package/src/blueprints/transitions.js.map +0 -1
- package/src/cli/agent-command.js.map +0 -1
- package/src/cli/agent-runtime.js.map +0 -1
- package/src/cli/blueprint-authority.js.map +0 -1
- package/src/cli/blueprint-command.js.map +0 -1
- package/src/cli/bootstrap.js.map +0 -1
- package/src/cli/dev-command.js.map +0 -1
- package/src/cli/main.js.map +0 -1
- package/src/cli/output.js.map +0 -1
- package/src/cli/personal-secret-runtime.js.map +0 -1
- package/src/cli/secret-terminal.js.map +0 -1
- package/src/container-images.js.map +0 -1
- package/src/data-lifecycle/index.js.map +0 -1
- package/src/data-lifecycle/model.fixtures.d.ts +0 -2
- package/src/data-lifecycle/model.fixtures.js +0 -244
- package/src/data-lifecycle/model.fixtures.js.map +0 -1
- package/src/data-lifecycle/model.js.map +0 -1
- package/src/data-lifecycle/sensitive-artifacts.js.map +0 -1
- package/src/data-lifecycle/validation.js.map +0 -1
- package/src/database-retirement/contract.js.map +0 -1
- package/src/database-retirement/index.js.map +0 -1
- package/src/deterministic-order.js.map +0 -1
- package/src/developer-agent/context.js.map +0 -1
- package/src/developer-agent/generator-planning.js.map +0 -1
- package/src/developer-agent/generator-preview.js.map +0 -1
- package/src/developer-agent/git-inspection.js.map +0 -1
- package/src/developer-agent/handoff.js.map +0 -1
- package/src/developer-agent/index.js.map +0 -1
- package/src/developer-agent/model.js.map +0 -1
- package/src/developer-agent/operation-registry.js.map +0 -1
- package/src/developer-agent/ordering.js.map +0 -1
- package/src/developer-agent/planning.js.map +0 -1
- package/src/developer-agent/preview-changes.js.map +0 -1
- package/src/developer-agent/preview-source.js.map +0 -1
- package/src/developer-agent/validation.js.map +0 -1
- package/src/developer-agent/workspace-inspection.js.map +0 -1
- package/src/developer-agent/workspace-path.js.map +0 -1
- package/src/executors/blueprint-trust/blueprint-trust.js.map +0 -1
- package/src/executors/blueprint-verification/blueprint-verification.js.map +0 -1
- package/src/executors/deploy/deploy.js.map +0 -1
- package/src/executors/deployment-plan/deployment-plan.js.map +0 -1
- package/src/executors/dev/dev.js.map +0 -1
- package/src/executors/dev-doctor/dev-doctor.js.map +0 -1
- package/src/executors/dev-setup/dev-setup.js.map +0 -1
- package/src/executors/developer-context/developer-context.js.map +0 -1
- package/src/executors/fleet/fleet.js.map +0 -1
- package/src/executors/foundation-preflight/foundation-preflight.js.map +0 -1
- package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js.map +0 -1
- package/src/executors/foundation-profile-preflight/production-database-safeguard.js.map +0 -1
- package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js.map +0 -1
- package/src/executors/github-bootstrap/github-bootstrap.js.map +0 -1
- package/src/executors/infrastructure-plan/infrastructure-plan.js.map +0 -1
- package/src/executors/local-deploy/federated-credential-transport.js.map +0 -1
- package/src/executors/local-deploy/fixtures/local-deploy-state-machine.mjs +0 -53
- package/src/executors/local-deploy/local-approval.js.map +0 -1
- package/src/executors/local-deploy/local-deploy.js.map +0 -1
- package/src/executors/refresh/refresh.js.map +0 -1
- package/src/executors/remove/remove.js.map +0 -1
- package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js.map +0 -1
- package/src/executors/secret-guardrails/secret-guardrails.js.map +0 -1
- package/src/executors/secret-initialize/secret-initialize.js.map +0 -1
- package/src/executors/secret-metadata/secret-metadata.js.map +0 -1
- package/src/executors/sst-lifecycle/generated-secret-retirement.js.map +0 -1
- package/src/executors/sst-lifecycle/governed-native-operation.js.map +0 -1
- package/src/executors/sst-lifecycle/logging-preflight.js.map +0 -1
- package/src/executors/sst-lifecycle/run-sst-command.js.map +0 -1
- package/src/executors/sst-lifecycle/secret-preflight.js.map +0 -1
- package/src/executors/sst-lifecycle/sst-environment-source.js.map +0 -1
- package/src/executors/unlock/unlock.js.map +0 -1
- package/src/executors/work-markers/work-markers.js.map +0 -1
- package/src/foundation/discovery.js.map +0 -1
- package/src/foundation/index.js.map +0 -1
- package/src/foundation/local-database-contract.js.map +0 -1
- package/src/foundation/logging-preflight.js.map +0 -1
- package/src/foundation/logging.js.map +0 -1
- package/src/foundation/partial-state.js.map +0 -1
- package/src/foundation/preflight.js.map +0 -1
- package/src/foundation/private-smoke-access.js.map +0 -1
- package/src/foundation/private-smoke-admission.js.map +0 -1
- package/src/foundation/private-smoke-control-plane.js.map +0 -1
- package/src/foundation/provision-database-bindings.js.map +0 -1
- package/src/foundation/provision-logical-database.js.map +0 -1
- package/src/foundation/requirements.js.map +0 -1
- package/src/foundation/router-origin-proof.js.map +0 -1
- package/src/foundation/router-waf-rate-rehearsal.js.map +0 -1
- package/src/foundation/router-waf.js.map +0 -1
- package/src/foundation/stages.js.map +0 -1
- package/src/frontend-security/index.js.map +0 -1
- package/src/frontend-security/security-headers.js.map +0 -1
- package/src/generators/feature-registry.js.map +0 -1
- package/src/generators/formatting.js.map +0 -1
- package/src/generators/function/function.js.map +0 -1
- package/src/generators/job/job.js.map +0 -1
- package/src/generators/logging-registry.js.map +0 -1
- package/src/generators/post-generation-install.js.map +0 -1
- package/src/generators/preset/dependency-overrides.js.map +0 -1
- package/src/generators/preset/generator.js.map +0 -1
- package/src/generators/preset/tool-versions.js.map +0 -1
- package/src/generators/preset/workspace-files-ci-acceptance.js.map +0 -1
- package/src/generators/preset/workspace-files-developer-agent.js.map +0 -1
- package/src/generators/preset/workspace-files-ecr-inspector.js.map +0 -1
- package/src/generators/preset/workspace-files-foundation-workload-roles.js.map +0 -1
- package/src/generators/preset/workspace-files-performance-cost.js.map +0 -1
- package/src/generators/preset/workspace-files-performance-load.js.map +0 -1
- package/src/generators/preset/workspace-files-stage-authority.js.map +0 -1
- package/src/generators/preset/workspace-files-thin-deploy.js.map +0 -1
- package/src/generators/preset/workspace-files-thin-docs.js.map +0 -1
- package/src/generators/preset/workspace-files-thin-release.js.map +0 -1
- package/src/generators/preset/workspace-files-workload-role-baseline.js.map +0 -1
- package/src/generators/preset/workspace-files.js.map +0 -1
- package/src/generators/repository-policy/repository-policy.js.map +0 -1
- package/src/generators/repository-policy/tree-policy.js.map +0 -1
- package/src/generators/service/service.js.map +0 -1
- package/src/generators/slice/built-in-plan-api-contract-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-api-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-async-work-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-authorization-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-background-work-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-data-deletion-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-data-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-data-lifecycle-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-data-retention-job-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-data-retention-launcher-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-data-rights-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-database-lifecycle-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-foundation-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-frontend-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-infrastructure-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-infrastructure-safety-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-metadata-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-native-runtime-authority-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-operations-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-performance-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-project-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-release-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-reliability-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-secret-runtime-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-shared.js.map +0 -1
- package/src/generators/slice/built-in-plan-testing-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-thin-release-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-verification-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-web-files.js.map +0 -1
- package/src/generators/slice/built-in-plan-workload-role-files.js.map +0 -1
- package/src/generators/slice/built-in-plan.js.map +0 -1
- package/src/generators/slice/slice.js.map +0 -1
- package/src/generators/upgrade/upgrade.js.map +0 -1
- package/src/generators/workload/frozen-container.js.map +0 -1
- package/src/generators/workload/performance-registration.js.map +0 -1
- package/src/generators/workload/reliability-registration.js.map +0 -1
- package/src/generators/workload/service-performance-files.js.map +0 -1
- package/src/generators/workload/workload.js.map +0 -1
- package/src/git-policy/action-pins.js.map +0 -1
- package/src/git-policy/github-bootstrap.js.map +0 -1
- package/src/git-policy/index.js.map +0 -1
- package/src/git-policy/routing.js.map +0 -1
- package/src/index.js.map +0 -1
- package/src/infrastructure-change/convergence.js.map +0 -1
- package/src/infrastructure-change/drift.js.map +0 -1
- package/src/infrastructure-change/index.js.map +0 -1
- package/src/infrastructure-change/local-capability.js.map +0 -1
- package/src/infrastructure-change/model.js.map +0 -1
- package/src/infrastructure-change/normalize.js.map +0 -1
- package/src/infrastructure-change/plan.js.map +0 -1
- package/src/infrastructure-change/risk.js.map +0 -1
- package/src/infrastructure-change/summary.js.map +0 -1
- package/src/local-dev/context-discovery.js.map +0 -1
- package/src/local-dev/contract-validation.js.map +0 -1
- package/src/local-dev/contracts.js.map +0 -1
- package/src/local-dev/control-contract.js.map +0 -1
- package/src/local-dev/dev-command-core.js.map +0 -1
- package/src/local-dev/effects.js.map +0 -1
- package/src/local-dev/environment-inspector.js.map +0 -1
- package/src/local-dev/environment-state.js.map +0 -1
- package/src/local-dev/errors.js.map +0 -1
- package/src/local-dev/fleet-client.js.map +0 -1
- package/src/local-dev/fleet-configuration.js.map +0 -1
- package/src/local-dev/fleet-inventory.js.map +0 -1
- package/src/local-dev/fleet-ipc.js.map +0 -1
- package/src/local-dev/fleet-launcher.js.map +0 -1
- package/src/local-dev/fleet-lock.js.map +0 -1
- package/src/local-dev/fleet-logs.js.map +0 -1
- package/src/local-dev/fleet-process.js.map +0 -1
- package/src/local-dev/fleet-runtime.js.map +0 -1
- package/src/local-dev/fleet-session.js.map +0 -1
- package/src/local-dev/fleet-slice-runner-daemon.js.map +0 -1
- package/src/local-dev/fleet-startup.js.map +0 -1
- package/src/local-dev/fleet-state.js.map +0 -1
- package/src/local-dev/fleet-supervisor-daemon.js.map +0 -1
- package/src/local-dev/fleet-supervisor.js.map +0 -1
- package/src/local-dev/gateway-daemon.js.map +0 -1
- package/src/local-dev/gateway.js.map +0 -1
- package/src/local-dev/identity.js.map +0 -1
- package/src/local-dev/index.js.map +0 -1
- package/src/local-dev/local-context.js.map +0 -1
- package/src/local-dev/nx-workspace.js.map +0 -1
- package/src/local-dev/personal-secret-ledger.js.map +0 -1
- package/src/local-dev/personal-stage.js.map +0 -1
- package/src/local-dev/portless.js.map +0 -1
- package/src/local-dev/ports.js.map +0 -1
- package/src/local-dev/private-state.js.map +0 -1
- package/src/local-dev/process-identity.js.map +0 -1
- package/src/local-dev/proxy.js.map +0 -1
- package/src/local-dev/runtime-paths.js.map +0 -1
- package/src/local-dev/secret-slice-claim.js.map +0 -1
- package/src/local-dev/slice-claim.js.map +0 -1
- package/src/local-dev/slice-runner.js.map +0 -1
- package/src/local-dev/tls.js.map +0 -1
- package/src/ownership/composition.js.map +0 -1
- package/src/ownership/foundation-record.js.map +0 -1
- package/src/ownership/hash.js.map +0 -1
- package/src/ownership/index.js.map +0 -1
- package/src/ownership/json-ownership.js.map +0 -1
- package/src/ownership/record.js.map +0 -1
- package/src/ownership/workspace-record.js.map +0 -1
- package/src/performance/cost-collection.js.map +0 -1
- package/src/performance/cost-controls.js.map +0 -1
- package/src/performance/evidence.js.map +0 -1
- package/src/performance/index.js.map +0 -1
- package/src/performance/load-safety.js.map +0 -1
- package/src/performance/model.js.map +0 -1
- package/src/performance/pr-artifact-budget.js.map +0 -1
- package/src/performance/runner.js.map +0 -1
- package/src/performance/scenario-endpoint.js.map +0 -1
- package/src/performance/scenario.js.map +0 -1
- package/src/performance/test-fixtures.d.ts +0 -7
- package/src/performance/test-fixtures.js +0 -167
- package/src/performance/test-fixtures.js.map +0 -1
- package/src/performance/unit-cost.js.map +0 -1
- package/src/release/index.js.map +0 -1
- package/src/release/lifecycle.js.map +0 -1
- package/src/release/manifest.js.map +0 -1
- package/src/release/rollout.js.map +0 -1
- package/src/release/source-authority.js.map +0 -1
- package/src/repository-policy/aurora-preflight.js.map +0 -1
- package/src/repository-policy/capacity-migration.js.map +0 -1
- package/src/repository-policy/deployment-plan.js.map +0 -1
- package/src/repository-policy/foundation-profile.js.map +0 -1
- package/src/repository-policy/index.js.map +0 -1
- package/src/repository-policy/policy.js.map +0 -1
- package/src/secrets/adapters.js.map +0 -1
- package/src/secrets/aws-control-plane.js.map +0 -1
- package/src/secrets/declaration-verification.js.map +0 -1
- package/src/secrets/generated-aws-control-plane.js.map +0 -1
- package/src/secrets/guardrails.js.map +0 -1
- package/src/secrets/index.js.map +0 -1
- package/src/secrets/metadata.js.map +0 -1
- package/src/secrets/model.js.map +0 -1
- package/src/secrets/operator.js.map +0 -1
- package/src/secrets/permissions.js.map +0 -1
- package/src/secrets/personal-command.js.map +0 -1
- package/src/secrets/personal-ledger.js.map +0 -1
- package/src/secrets/registry.js.map +0 -1
- package/src/secrets/verification.js.map +0 -1
- package/src/secrets/workload-access.js.map +0 -1
- package/src/sst-environment-source-format.js.map +0 -1
- package/src/supply-chain/action-pins.js.map +0 -1
- package/src/supply-chain/blueprint-trust-git.js.map +0 -1
- package/src/supply-chain/blueprint-trust-process.js.map +0 -1
- package/src/supply-chain/blueprint-trust.js.map +0 -1
- package/src/supply-chain/blueprint-verification-authority.js.map +0 -1
- package/src/supply-chain/blueprint-verification-execution.js.map +0 -1
- package/src/supply-chain/build-output-bounds.js.map +0 -1
- package/src/supply-chain/build-output.js.map +0 -1
- package/src/supply-chain/common.js.map +0 -1
- package/src/supply-chain/container-artifact-contract.js.map +0 -1
- package/src/supply-chain/container-release.js.map +0 -1
- package/src/supply-chain/ecr-applicability.js.map +0 -1
- package/src/supply-chain/ecr-scanning.js.map +0 -1
- package/src/supply-chain/ecs-deployed-image.js.map +0 -1
- package/src/supply-chain/errors.js.map +0 -1
- package/src/supply-chain/generated-blueprint-trust-command.js.map +0 -1
- package/src/supply-chain/generated-command.js.map +0 -1
- package/src/supply-chain/generated-container-release-command.js.map +0 -1
- package/src/supply-chain/generated-ecr-collector-command.js.map +0 -1
- package/src/supply-chain/generated-files.js.map +0 -1
- package/src/supply-chain/generated-scanner-command.js.map +0 -1
- package/src/supply-chain/index.js.map +0 -1
- package/src/supply-chain/inventory.js.map +0 -1
- package/src/supply-chain/license-expression.js.map +0 -1
- package/src/supply-chain/pnpm-toolchain-authority.js.map +0 -1
- package/src/supply-chain/policy.js.map +0 -1
- package/src/supply-chain/publication.js.map +0 -1
- package/src/supply-chain/sbom.js.map +0 -1
- package/src/supply-chain/scanner.js.map +0 -1
- package/src/supply-chain/vendored-source.js.map +0 -1
- package/src/testing-evidence/fixture-scope.js.map +0 -1
- package/src/testing-evidence/index.js.map +0 -1
- package/src/testing-evidence/quarantine.js.map +0 -1
- package/src/testing-evidence/result.js.map +0 -1
- package/src/testing-evidence/runner-adapter.js.map +0 -1
- package/src/testing-evidence/sensitive-artifacts.js.map +0 -1
- package/src/validation.js.map +0 -1
- package/src/work-markers/index.js.map +0 -1
- package/src/work-markers/work-markers.js.map +0 -1
- package/src/workload-roles/account-baseline.js.map +0 -1
- package/src/workload-roles/authority.js.map +0 -1
- package/src/workload-roles/aws-adapter.js.map +0 -1
- package/src/workload-roles/aws-internal-handler.js.map +0 -1
- package/src/workload-roles/aws-s3-state.js.map +0 -1
- package/src/workload-roles/aws-sdk-control-plane.js.map +0 -1
- package/src/workload-roles/boundary.js.map +0 -1
- package/src/workload-roles/convergence.js.map +0 -1
- package/src/workload-roles/effective-policy.js.map +0 -1
- package/src/workload-roles/handler.js.map +0 -1
- package/src/workload-roles/history.js.map +0 -1
- package/src/workload-roles/index.js.map +0 -1
- package/src/workload-roles/injection.js.map +0 -1
- package/src/workload-roles/manifest.js.map +0 -1
- package/src/workload-roles/provisioner.js.map +0 -1
- package/src/workload-roles/registration.js.map +0 -1
- package/src/workload-roles/stage-boundary.js.map +0 -1
- package/src/workload-roles/standard-slice.js.map +0 -1
- package/src/workspace-deployment/affected-lifecycle.js.map +0 -1
- package/src/workspace-deployment/identity.js.map +0 -1
- package/src/workspace-deployment/index.js.map +0 -1
- package/src/workspace-deployment/migration-evidence.js.map +0 -1
- package/src/workspace-deployment/migration.js.map +0 -1
- package/src/workspace-deployment/ownership.js.map +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Native expiry housekeeping; cadence and pause remain owned by background policy. */
|
|
2
|
+
export declare function renderKeyValueCleanupFiles(name: string): Readonly<Record<string, string>>;
|
|
3
|
+
/** Lightweight adopter orchestration tests; real-child repository proof is separate. */
|
|
4
|
+
export declare function renderKeyValueCleanupTests(): string;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderKeyValueCleanupFiles = renderKeyValueCleanupFiles;
|
|
4
|
+
exports.renderKeyValueCleanupTests = renderKeyValueCleanupTests;
|
|
5
|
+
/** Native expiry housekeeping; cadence and pause remain owned by background policy. */
|
|
6
|
+
function renderKeyValueCleanupFiles(name) {
|
|
7
|
+
return {
|
|
8
|
+
'async/inbox-cleanup.ts': `import { randomUUID } from 'node:crypto';
|
|
9
|
+
import { createLogger, type Logger } from '@empire-builder-kit/runtime/logging';
|
|
10
|
+
import { createMetricEmitter, type MetricEmitter } from '@empire-builder-kit/runtime/observability';
|
|
11
|
+
import { dataStore } from '../data/key-value.js';
|
|
12
|
+
import { cleanupProviderInbox } from './provider-inbox.js';
|
|
13
|
+
import { createPerformancePersistence } from '../performance/persistence.js';
|
|
14
|
+
|
|
15
|
+
interface Dependencies {
|
|
16
|
+
logger: Logger; metrics: MetricEmitter; now(): number;
|
|
17
|
+
store: typeof dataStore;
|
|
18
|
+
}
|
|
19
|
+
export function createInboxCleanupHandler(dependencies: Dependencies) {
|
|
20
|
+
return async (event: { id?: string } = {}) => {
|
|
21
|
+
const correlationId = event.id ?? randomUUID();
|
|
22
|
+
const deadline = dependencies.now() + 4 * 60_000;
|
|
23
|
+
const store = dependencies.store();
|
|
24
|
+
const performance = createPerformancePersistence(store, dependencies.now);
|
|
25
|
+
let reported = 0, pendingReports = false;
|
|
26
|
+
let reportFailure: unknown;
|
|
27
|
+
const emit = (metricName: string, namespace: string, value: number) => {
|
|
28
|
+
if (dependencies.metrics.emit({ namespace, metricName, unit: 'Count', value,
|
|
29
|
+
dimensions: { component: namespace === 'EBK/Performance' ? 'performance-load-cleanup' : 'inbox-cleanup',
|
|
30
|
+
feature: namespace === 'EBK/Performance' ? 'performance' : 'async-work',
|
|
31
|
+
operation: namespace === 'EBK/Performance' ? 'expiry-cleanup' : 'inbox-cleanup',
|
|
32
|
+
slice: '${name}', stage: process.env.EBK_STAGE ?? 'local' } }) === undefined)
|
|
33
|
+
throw new Error('cleanup-metric-delivery-failed');
|
|
34
|
+
};
|
|
35
|
+
const report = async () => {
|
|
36
|
+
try {
|
|
37
|
+
const result = await performance.reportDeadlines(count => emit(
|
|
38
|
+
'PerformanceLoadCleanupDeadlineBreaches', 'EBK/Performance', count));
|
|
39
|
+
reported += result.reported; pendingReports ||= result.continuationRequired;
|
|
40
|
+
} catch (error) { reportFailure ??= error; }
|
|
41
|
+
};
|
|
42
|
+
try {
|
|
43
|
+
// Telemetry failure retains reports but does not prevent physical expiry.
|
|
44
|
+
await report();
|
|
45
|
+
const inbox = await cleanupProviderInbox(store, new Date(dependencies.now()).toISOString(), dependencies.now, deadline);
|
|
46
|
+
const expired = await performance.expire({ deadline });
|
|
47
|
+
await report();
|
|
48
|
+
emit('InboxCleanupContinuationRequired', 'EBK/Async', inbox.continuationRequired ? 1 : 0);
|
|
49
|
+
emit('PerformanceLoadCleanupContinuationRequired', 'EBK/Performance', expired.continuationRequired ? 1 : 0);
|
|
50
|
+
// A page is not a global count. Emit zero only after a complete inventory;
|
|
51
|
+
// otherwise retain explicit continuation and inspected-page evidence.
|
|
52
|
+
if (inbox.completeScan) emit('InboxCleanupBacklog', 'EBK/Async', 0);
|
|
53
|
+
if (expired.completeScan) emit('PerformanceLoadCleanupBacklog', 'EBK/Performance', 0);
|
|
54
|
+
if (reportFailure !== undefined) throw reportFailure;
|
|
55
|
+
if (reported > 0 || pendingReports) throw new Error('performance-load-cleanup-deadline-breached');
|
|
56
|
+
const result = { inbox, performance: expired, reportedPerformanceDeadlineBreaches: reported,
|
|
57
|
+
outcome: inbox.completeScan && expired.completeScan ? 'converged' : 'continuation-required' };
|
|
58
|
+
dependencies.logger.info('Native inbox cleanup completed', { context: { correlationId },
|
|
59
|
+
attributes: result, outcome: result.outcome === 'converged' ? 'success' : 'unknown' });
|
|
60
|
+
return result;
|
|
61
|
+
} catch (error) {
|
|
62
|
+
dependencies.logger.error('Native inbox cleanup failed', { context: { correlationId }, error, outcome: 'failure' });
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export const handler = createInboxCleanupHandler({ store: dataStore, now: Date.now,
|
|
68
|
+
metrics: createMetricEmitter({}),
|
|
69
|
+
logger: createLogger({ component: 'inbox-cleanup', feature: 'async-work', operation: 'inbox-cleanup',
|
|
70
|
+
slice: '${name}', stage: process.env.EBK_STAGE ?? 'local', workspace: process.env.EBK_WORKSPACE ?? '${name}' }),
|
|
71
|
+
});
|
|
72
|
+
`,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** Lightweight adopter orchestration tests; real-child repository proof is separate. */
|
|
76
|
+
function renderKeyValueCleanupTests() {
|
|
77
|
+
return ` it('cleans an empty native inbox without SQL and preserves deadline telemetry', async () => {
|
|
78
|
+
const store = {
|
|
79
|
+
get: vi.fn().mockResolvedValue(null),
|
|
80
|
+
list: vi.fn().mockResolvedValue({ records: [] }),
|
|
81
|
+
commit: vi.fn().mockResolvedValue(undefined),
|
|
82
|
+
};
|
|
83
|
+
const metrics = { emit: vi.fn(() => ({})) };
|
|
84
|
+
const handler = createInboxCleanupHandler({ logger: logger as never, metrics: metrics as never,
|
|
85
|
+
now: () => Date.parse('2026-01-01T00:00:00.000Z'), store: (() => store) as never });
|
|
86
|
+
await expect(handler()).resolves.toMatchObject({ outcome: 'converged', reportedPerformanceDeadlineBreaches: 0 });
|
|
87
|
+
expect(store.commit).toHaveBeenCalledTimes(2);
|
|
88
|
+
expect(metrics.emit).toHaveBeenCalledWith(expect.objectContaining({ metricName: 'PerformanceLoadCleanupBacklog', value: 0 }));
|
|
89
|
+
});
|
|
90
|
+
it('never accepts cleanup after native transport or metric failure', async () => {
|
|
91
|
+
const store = { get: vi.fn().mockRejectedValue(new Error('native unavailable')),
|
|
92
|
+
list: vi.fn().mockResolvedValue({ records: [] }), commit: vi.fn() };
|
|
93
|
+
const handler = createInboxCleanupHandler({ logger: logger as never, metrics: { emit: vi.fn() } as never,
|
|
94
|
+
now: () => Date.parse('2026-01-01T00:00:00.000Z'), store: (() => store) as never });
|
|
95
|
+
await expect(handler()).rejects.toThrow('native unavailable');
|
|
96
|
+
expect(store.commit).not.toHaveBeenCalled();
|
|
97
|
+
});
|
|
98
|
+
`;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=built-in-plan-key-value-cleanup.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Default event consumption uses native transactional inboxes, never SQL or TTL timing as authority. */
|
|
2
|
+
export declare function renderKeyValueEventConsumer(name: string, pascalName: string, workspace: string): string;
|
|
3
|
+
/** The public example publisher uses the same durable intents as domain writes. */
|
|
4
|
+
export declare function renderKeyValueCreatedPublisher(pascalName: string, workspace: string): string;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderKeyValueEventConsumer = renderKeyValueEventConsumer;
|
|
4
|
+
exports.renderKeyValueCreatedPublisher = renderKeyValueCreatedPublisher;
|
|
5
|
+
const built_in_plan_shared_js_1 = require("./built-in-plan-shared.js");
|
|
6
|
+
/** Default event consumption uses native transactional inboxes, never SQL or TTL timing as authority. */
|
|
7
|
+
function renderKeyValueEventConsumer(name, pascalName, workspace) {
|
|
8
|
+
const prefix = (0, built_in_plan_shared_js_1.lowerCamelIdentifier)(pascalName);
|
|
9
|
+
return `import { lifecycleIdempotencyKey, parseDataLifecycleChangeEvent } from '@empire-builder-kit/runtime/data-lifecycle';
|
|
10
|
+
import { parseSqsEventBridgeRecords, toEventLogContext } from '@empire-builder-kit/runtime/events';
|
|
11
|
+
import type { KeyValueChange } from '@empire-builder-kit/runtime/key-value';
|
|
12
|
+
import { createLogger } from '@empire-builder-kit/runtime/logging';
|
|
13
|
+
import { ${prefix}AuthorizationActions } from '../authorization/policy.js';
|
|
14
|
+
import { authorize${pascalName}InternalOperation } from '../authorization/runtime.js';
|
|
15
|
+
import lifecycleConsumers from '../data/lifecycle-consumers.json' with { type: 'json' };
|
|
16
|
+
import workContract from '../async/work-contract.json' with { type: 'json' };
|
|
17
|
+
import { dataStore } from '../data/key-value.js';
|
|
18
|
+
|
|
19
|
+
interface QueueRecord { body: string; messageId: string }
|
|
20
|
+
interface QueueEvent { Records: QueueRecord[] }
|
|
21
|
+
interface DownstreamCopy {
|
|
22
|
+
sourceSlice: string; pseudonymousKey: string; copyId: string; recipient: string;
|
|
23
|
+
purpose: 'lifecycle-reconciliation'; expiresAt: string; action: 'correction' | 'deletion';
|
|
24
|
+
holdRefs: string[]; status: 'reconciled' | 'deleted'; updatedAt: string;
|
|
25
|
+
}
|
|
26
|
+
const sources = lifecycleConsumers.acceptedSources;
|
|
27
|
+
if (lifecycleConsumers.schemaVersion !== 1 || !Array.isArray(sources) || !sources.length || sources.length > 32 ||
|
|
28
|
+
new Set(sources).size !== sources.length || sources.some(source => !/^[a-z][a-z0-9-]{0,62}$/.test(source)))
|
|
29
|
+
throw new Error('Lifecycle consumer configuration must contain unique bounded Slice sources.');
|
|
30
|
+
const lifecycleSources = new Set(sources);
|
|
31
|
+
const replaySeconds = workContract.queue.idempotencyWindowSeconds;
|
|
32
|
+
if (replaySeconds !== 2_592_000 || workContract.queue.conflictPolicy !== 'same-id-different-payload-fails')
|
|
33
|
+
throw new Error('Event consumer requires the declared Standard 30-day replay and conflict policy.');
|
|
34
|
+
const plusSeconds = (value: string, seconds: number) => new Date(Date.parse(value) + seconds * 1_000).toISOString();
|
|
35
|
+
|
|
36
|
+
function validDownstream(value: unknown, sourceSlice: string, pseudonymousKey: string): DownstreamCopy {
|
|
37
|
+
const copy = value as DownstreamCopy;
|
|
38
|
+
if (!copy || copy.sourceSlice !== sourceSlice || copy.pseudonymousKey !== pseudonymousKey ||
|
|
39
|
+
copy.copyId !== '${name}-lifecycle-consumer' || copy.recipient !== '${name}' ||
|
|
40
|
+
copy.purpose !== 'lifecycle-reconciliation' || !Number.isFinite(Date.parse(copy.updatedAt)) ||
|
|
41
|
+
new Date(copy.updatedAt).toISOString() !== copy.updatedAt ||
|
|
42
|
+
!['correction', 'deletion'].includes(copy.action) ||
|
|
43
|
+
copy.status !== (copy.action === 'deletion' ? 'deleted' : 'reconciled') ||
|
|
44
|
+
!Array.isArray(copy.holdRefs) || copy.holdRefs.length !== 0)
|
|
45
|
+
throw new Error('Stored lifecycle copy is malformed or has a different scope.');
|
|
46
|
+
return copy;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function handler(event: QueueEvent) {
|
|
50
|
+
const workloadIdentity = process.env.EBK_WORKLOAD_IDENTITY;
|
|
51
|
+
if (workloadIdentity !== '${name}:event-consumer') throw new Error('Event consumer workload identity is invalid.');
|
|
52
|
+
const stage = process.env.EBK_STAGE;
|
|
53
|
+
if (!stage || !/^[a-z][a-z0-9-]{0,62}$/.test(stage))
|
|
54
|
+
throw new Error('Event consumer stage is required and must be exact.');
|
|
55
|
+
// A malformed envelope without a real SQS identity cannot be partially acknowledged.
|
|
56
|
+
if (!Array.isArray(event?.Records) || event.Records.length > 100 ||
|
|
57
|
+
new Set(event.Records.map(record => record.messageId)).size !== event.Records.length || event.Records.some(record =>
|
|
58
|
+
typeof record.messageId !== 'string' || !/^[A-Za-z0-9_-]{1,128}$/.test(record.messageId) ||
|
|
59
|
+
typeof record.body !== 'string' || Buffer.byteLength(record.body) > 256 * 1024))
|
|
60
|
+
throw new Error('Event consumer requires a bounded batch with exact SQS message identities.');
|
|
61
|
+
const logger = createLogger({ component: 'event-consumer', feature: 'events', operation: 'consume-created',
|
|
62
|
+
slice: '${name}', stage, workspace: '${workspace}' });
|
|
63
|
+
const batch = parseSqsEventBridgeRecords(event.Records);
|
|
64
|
+
const failures = batch.failures.map(({ messageId }) => ({ itemIdentifier: messageId as string }));
|
|
65
|
+
for (const { detailType, envelope, messageId, source } of batch.events) {
|
|
66
|
+
try {
|
|
67
|
+
// Unspecified tenant metadata is the existing Standard application scope,
|
|
68
|
+
// not permission to select a different tenant. Multi-tenant features own
|
|
69
|
+
// their explicit consumer/persistence binding.
|
|
70
|
+
if (envelope.meta.stage !== stage || (envelope.meta.tenantId !== undefined && envelope.meta.tenantId !== 'application') ||
|
|
71
|
+
envelope.meta.schemaVersion !== 1 || Date.parse(envelope.meta.occurredAt) > Date.now() + 5 * 60 * 1_000)
|
|
72
|
+
throw new Error('Event scope, schema or time does not match the consumer.');
|
|
73
|
+
const changes: KeyValueChange[] = [];
|
|
74
|
+
const eventId = lifecycleIdempotencyKey('event-consumer', [source, envelope.meta.eventId]);
|
|
75
|
+
const replayWindowEndsAt = plusSeconds(envelope.meta.occurredAt, replaySeconds);
|
|
76
|
+
if (Date.parse(replayWindowEndsAt) < Date.now()) throw new Error('Event replay window has closed.');
|
|
77
|
+
const store = dataStore();
|
|
78
|
+
if (detailType === 'DataLifecycleChanged') {
|
|
79
|
+
const lifecycle = parseDataLifecycleChangeEvent(envelope.data);
|
|
80
|
+
if (lifecycle.sourceSlice !== source || !lifecycleSources.has(source) ||
|
|
81
|
+
lifecycle.categoryId !== 'product-record' || lifecycle.occurredAt !== envelope.meta.occurredAt)
|
|
82
|
+
throw new Error('Lifecycle event source, category or time is not declared by this consumer.');
|
|
83
|
+
await authorize${pascalName}InternalOperation({ action: ${prefix}AuthorizationActions.lifecycleConsume,
|
|
84
|
+
correlationId: envelope.meta.correlationId, operationId: messageId as string, workloadIdentity });
|
|
85
|
+
const copyId = lifecycleIdempotencyKey('lifecycle-copy', [source, lifecycle.pseudonymousKey, '${name}-lifecycle-consumer']);
|
|
86
|
+
const retained = await store.get('application', 'data-lifecycle-downstream-copies', copyId);
|
|
87
|
+
const previous = retained ? validDownstream(retained.value, source, lifecycle.pseudonymousKey) : null;
|
|
88
|
+
const expiresAt = plusSeconds(lifecycle.occurredAt, 400 * 24 * 60 * 60);
|
|
89
|
+
const newer = !previous || Date.parse(previous.updatedAt) < Date.parse(lifecycle.occurredAt) ||
|
|
90
|
+
(previous.updatedAt === lifecycle.occurredAt && previous.action !== 'deletion');
|
|
91
|
+
if (newer) changes.push({ action: 'put', collection: 'data-lifecycle-downstream-copies', id: copyId,
|
|
92
|
+
expectedVersion: retained?.version ?? 0, value: {
|
|
93
|
+
sourceSlice: source, pseudonymousKey: lifecycle.pseudonymousKey, copyId: '${name}-lifecycle-consumer',
|
|
94
|
+
recipient: '${name}', purpose: 'lifecycle-reconciliation', expiresAt,
|
|
95
|
+
action: lifecycle.action, holdRefs: [], status: lifecycle.action === 'deletion' ? 'deleted' : 'reconciled',
|
|
96
|
+
updatedAt: lifecycle.occurredAt,
|
|
97
|
+
} satisfies DownstreamCopy });
|
|
98
|
+
changes.push({ action: 'put', collection: 'data-lifecycle-receipts', id: eventId, expectedVersion: 0,
|
|
99
|
+
value: { ...lifecycle, expiresAt } });
|
|
100
|
+
} else {
|
|
101
|
+
const data = envelope.data as { id?: unknown; occurredBy?: unknown };
|
|
102
|
+
if (source !== '${name}' || detailType !== '${pascalName}Created' || !data || typeof data !== 'object' ||
|
|
103
|
+
Object.keys(data).sort().join(',') !== 'id,occurredBy' || typeof data.id !== 'string' ||
|
|
104
|
+
!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(data.id) ||
|
|
105
|
+
typeof data.occurredBy !== 'string' || !data.occurredBy || data.occurredBy.length > 128)
|
|
106
|
+
throw new Error('Event type, source or payload is not declared by this consumer.');
|
|
107
|
+
}
|
|
108
|
+
const result = await store.consume({ tenantId: 'application', consumer: 'event-consumer-v1', eventId,
|
|
109
|
+
payload: { source, detailType, envelope }, replayWindowEndsAt,
|
|
110
|
+
// Retain beyond the whole replay window; DynamoDB TTL is only physical cleanup.
|
|
111
|
+
expiresAt: plusSeconds(replayWindowEndsAt, 24 * 60 * 60), changes });
|
|
112
|
+
logger.info('${name} event consumed', { context: toEventLogContext(envelope.meta, detailType),
|
|
113
|
+
attributes: { result }, outcome: 'success' });
|
|
114
|
+
} catch {
|
|
115
|
+
failures.push({ itemIdentifier: messageId as string });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
logger.info('${name} event batch completed', { attributes: { eventCount: batch.events.length, failureCount: failures.length },
|
|
119
|
+
outcome: failures.length ? 'failure' : 'success' });
|
|
120
|
+
return { batchItemFailures: failures };
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
/** The public example publisher uses the same durable intents as domain writes. */
|
|
125
|
+
function renderKeyValueCreatedPublisher(pascalName, workspace) {
|
|
126
|
+
const prefix = (0, built_in_plan_shared_js_1.lowerCamelIdentifier)(pascalName);
|
|
127
|
+
return `import { randomUUID } from 'node:crypto';
|
|
128
|
+
import type { RuntimeHttpEvent } from '@empire-builder-kit/runtime';
|
|
129
|
+
import type { Principal } from '@empire-builder-kit/runtime/auth';
|
|
130
|
+
import { createContractHttpJsonHandler } from '@empire-builder-kit/runtime/api-server';
|
|
131
|
+
import { buildEventEntry } from '@empire-builder-kit/runtime/events';
|
|
132
|
+
import { authorize${pascalName}Operation } from '../authorization/runtime.js';
|
|
133
|
+
import { ${prefix}PublishCreated } from './contracts/protected.js';
|
|
134
|
+
import { ${pascalName}Created } from '../contracts/events.js';
|
|
135
|
+
import { dataStore } from '../data/key-value.js';
|
|
136
|
+
|
|
137
|
+
export const handler = createContractHttpJsonHandler<typeof ${prefix}PublishCreated, RuntimeHttpEvent, Principal>({
|
|
138
|
+
component: 'event-publisher', operation: ${prefix}PublishCreated, workspace: '${workspace}',
|
|
139
|
+
authorize: authorize${pascalName}Operation,
|
|
140
|
+
async handle({ context, principal }) {
|
|
141
|
+
const built = buildEventEntry(${pascalName}Created, { id: randomUUID(), occurredBy: principal.id }, {
|
|
142
|
+
busName: process.env.EVENT_BUS_NAME ?? '', stage: process.env.EBK_STAGE ?? '',
|
|
143
|
+
context: { ...context, tenantId: 'application' },
|
|
144
|
+
});
|
|
145
|
+
await dataStore().commit({ tenantId: 'application', changes: [], events: [built.entry] });
|
|
146
|
+
return { eventId: built.envelope.meta.eventId };
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
`;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=built-in-plan-key-value-consumer.js.map
|