@empire-builder-kit/nx 1.0.0-rc.38 → 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.
Files changed (637) hide show
  1. package/README.md +18 -0
  2. package/executors.json +5 -0
  3. package/generators.json +10 -0
  4. package/package.json +20 -3
  5. package/src/aws-authority/index.d.ts +1 -0
  6. package/src/aws-authority/index.js +1 -0
  7. package/src/aws-authority/lambda-policy-ordering.d.ts +38 -0
  8. package/src/aws-authority/lambda-policy-ordering.js +56 -0
  9. package/src/aws-authority/stage-authority.d.ts +11 -3
  10. package/src/aws-authority/stage-authority.js +615 -29
  11. package/src/blueprints/external-sandbox.js +21 -9
  12. package/src/blueprints/manifest.d.ts +1 -1
  13. package/src/blueprints/resolver.js +28 -15
  14. package/src/cli/bootstrap.d.ts +1 -1
  15. package/src/cli/deploy-runtime.d.ts +6 -0
  16. package/src/cli/deploy-runtime.js +58 -0
  17. package/src/cli/dev-command.d.ts +16 -4
  18. package/src/cli/dev-command.js +63 -0
  19. package/src/cli/main.d.ts +7 -1
  20. package/src/cli/main.js +128 -20
  21. package/src/cli/output.d.ts +1 -1
  22. package/src/developer-agent/context.js +41 -9
  23. package/src/developer-agent/generator-planning.js +16 -2
  24. package/src/developer-agent/git-inspection.d.ts +6 -2
  25. package/src/developer-agent/git-inspection.js +78 -6
  26. package/src/developer-agent/model.d.ts +4 -2
  27. package/src/developer-agent/operation-registry.d.ts +5 -0
  28. package/src/developer-agent/operation-registry.js +179 -23
  29. package/src/developer-agent/preview-changes.d.ts +2 -0
  30. package/src/developer-agent/preview-changes.js +14 -2
  31. package/src/developer-agent/preview-source.js +3 -0
  32. package/src/developer-agent/validation.js +20 -8
  33. package/src/developer-agent/workspace-inspection.js +37 -3
  34. package/src/executors/deployment-plan/deployment-plan.d.ts +2 -0
  35. package/src/executors/deployment-plan/deployment-plan.js +51 -4
  36. package/src/executors/dev-doctor/dev-doctor.js +13 -6
  37. package/src/executors/dev-task-cleanup/dev-task-cleanup.d.ts +23 -0
  38. package/src/executors/dev-task-cleanup/dev-task-cleanup.js +145 -0
  39. package/src/executors/dev-task-cleanup/schema.json +9 -0
  40. package/src/executors/dev-task-cleanup/task-stack-absence.d.ts +27 -0
  41. package/src/executors/dev-task-cleanup/task-stack-absence.js +281 -0
  42. package/src/executors/dev-task-cleanup/task-stack-checkpoint.d.ts +12 -0
  43. package/src/executors/dev-task-cleanup/task-stack-checkpoint.js +92 -0
  44. package/src/executors/fleet/fleet.js +1 -1
  45. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +28 -1
  46. package/src/executors/local-deploy/local-deploy.d.ts +8 -1
  47. package/src/executors/local-deploy/local-deploy.js +97 -24
  48. package/src/executors/local-deploy/schema.json +8 -0
  49. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js +30 -18
  50. package/src/executors/sst-lifecycle/governed-native-operation.d.ts +2 -0
  51. package/src/executors/sst-lifecycle/governed-native-operation.js +9 -0
  52. package/src/executors/sst-lifecycle/run-sst-command.d.ts +5 -0
  53. package/src/executors/sst-lifecycle/run-sst-command.js +220 -32
  54. package/src/executors/sst-lifecycle/sst-environment-source.d.ts +8 -0
  55. package/src/executors/sst-lifecycle/sst-environment-source.js +54 -0
  56. package/src/executors/sst-lifecycle/task-unlock.d.ts +15 -0
  57. package/src/executors/sst-lifecycle/task-unlock.js +126 -0
  58. package/src/foundation/capability-plan.d.ts +43 -0
  59. package/src/foundation/capability-plan.js +168 -0
  60. package/src/foundation/discovery.d.ts +14 -11
  61. package/src/foundation/discovery.js +32 -6
  62. package/src/foundation/index.d.ts +1 -0
  63. package/src/foundation/index.js +1 -0
  64. package/src/foundation/local-database-contract.d.ts +20 -0
  65. package/src/foundation/local-database-contract.js +262 -13
  66. package/src/foundation/local-private-smoke-access.d.ts +20 -0
  67. package/src/foundation/local-private-smoke-access.js +197 -0
  68. package/src/foundation/preflight.js +37 -18
  69. package/src/foundation/private-smoke-access.js +10 -2
  70. package/src/foundation/private-smoke-admission.d.ts +3 -1
  71. package/src/foundation/private-smoke-admission.js +29 -8
  72. package/src/foundation/private-smoke-control-plane.js +17 -6
  73. package/src/foundation/provision-database-bindings.d.ts +5 -0
  74. package/src/foundation/provision-database-bindings.js +41 -8
  75. package/src/foundation/provision-logical-database.js +13 -8
  76. package/src/foundation/requirements.d.ts +3 -3
  77. package/src/foundation/requirements.js +24 -12
  78. package/src/foundation/router-waf.d.ts +1 -0
  79. package/src/foundation/router-waf.js +14 -1
  80. package/src/generators/blueprint/blueprint.d.ts +5 -0
  81. package/src/generators/blueprint/blueprint.js +102 -0
  82. package/src/generators/blueprint/files.d.ts +6 -0
  83. package/src/generators/blueprint/files.js +217 -0
  84. package/src/generators/blueprint/schema.d.ts +4 -0
  85. package/src/generators/blueprint/schema.json +18 -0
  86. package/src/generators/formatting.js +24 -1
  87. package/src/generators/logging-registry.d.ts +2 -0
  88. package/src/generators/logging-registry.js +22 -0
  89. package/src/generators/preset/workspace-files-adopter-skills.d.ts +7 -0
  90. package/src/generators/preset/workspace-files-adopter-skills.js +301 -0
  91. package/src/generators/preset/workspace-files-ci-install.d.ts +2 -0
  92. package/src/generators/preset/workspace-files-ci-install.js +196 -0
  93. package/src/generators/preset/workspace-files-developer-agent.js +40 -13
  94. package/src/generators/preset/workspace-files-performance-load.js +8 -0
  95. package/src/generators/preset/workspace-files-stage-authority.js +40 -1
  96. package/src/generators/preset/workspace-files-thin-deploy.js +66 -34
  97. package/src/generators/preset/workspace-files-thin-docs.js +64 -18
  98. package/src/generators/preset/workspace-files.d.ts +4 -0
  99. package/src/generators/preset/workspace-files.js +159 -91
  100. package/src/generators/repository-policy/repository-policy.js +37 -0
  101. package/src/generators/slice/built-in-plan-api-contract-files.js +42 -7
  102. package/src/generators/slice/built-in-plan-api-files.d.ts +1 -1
  103. package/src/generators/slice/built-in-plan-api-files.js +47 -389
  104. package/src/generators/slice/built-in-plan-async-work-files.js +19 -1912
  105. package/src/generators/slice/built-in-plan-authorization-files.js +92 -329
  106. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +36 -2
  107. package/src/generators/slice/built-in-plan-authorization-storage.d.ts +3 -0
  108. package/src/generators/slice/built-in-plan-authorization-storage.js +119 -0
  109. package/src/generators/slice/built-in-plan-background-work-files.d.ts +1 -1
  110. package/src/generators/slice/built-in-plan-background-work-files.js +15 -5
  111. package/src/generators/slice/built-in-plan-data-deletion-files.js +2 -830
  112. package/src/generators/slice/built-in-plan-data-files.d.ts +1 -1
  113. package/src/generators/slice/built-in-plan-data-files.js +61 -1164
  114. package/src/generators/slice/built-in-plan-data-lifecycle-files.js +53 -28
  115. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +18 -2
  116. package/src/generators/slice/built-in-plan-data-retention-job-files.js +7 -2446
  117. package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +30 -6
  118. package/src/generators/slice/built-in-plan-data-rights-files.js +6 -4482
  119. package/src/generators/slice/built-in-plan-database-lifecycle-files.js +4 -15
  120. package/src/generators/slice/built-in-plan-foundation-files.d.ts +2 -1
  121. package/src/generators/slice/built-in-plan-foundation-files.js +34 -10
  122. package/src/generators/slice/built-in-plan-frontend-files.js +2 -2
  123. package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +1 -1
  124. package/src/generators/slice/built-in-plan-infrastructure-files.js +180 -522
  125. package/src/generators/slice/built-in-plan-key-value-cleanup.d.ts +4 -0
  126. package/src/generators/slice/built-in-plan-key-value-cleanup.js +100 -0
  127. package/src/generators/slice/built-in-plan-key-value-consumer.d.ts +4 -0
  128. package/src/generators/slice/built-in-plan-key-value-consumer.js +151 -0
  129. package/src/generators/slice/built-in-plan-key-value-deletion.d.ts +2 -0
  130. package/src/generators/slice/built-in-plan-key-value-deletion.js +377 -0
  131. package/src/generators/slice/built-in-plan-key-value-delivery.d.ts +2 -0
  132. package/src/generators/slice/built-in-plan-key-value-delivery.js +120 -0
  133. package/src/generators/slice/built-in-plan-key-value-export.d.ts +2 -0
  134. package/src/generators/slice/built-in-plan-key-value-export.js +595 -0
  135. package/src/generators/slice/built-in-plan-key-value-files.d.ts +2 -0
  136. package/src/generators/slice/built-in-plan-key-value-files.js +31 -0
  137. package/src/generators/slice/built-in-plan-key-value-holds.d.ts +2 -0
  138. package/src/generators/slice/built-in-plan-key-value-holds.js +189 -0
  139. package/src/generators/slice/built-in-plan-key-value-infrastructure.d.ts +2 -0
  140. package/src/generators/slice/built-in-plan-key-value-infrastructure.js +102 -0
  141. package/src/generators/slice/built-in-plan-key-value-performance.d.ts +5 -0
  142. package/src/generators/slice/built-in-plan-key-value-performance.js +530 -0
  143. package/src/generators/slice/built-in-plan-key-value-provider.d.ts +4 -0
  144. package/src/generators/slice/built-in-plan-key-value-provider.js +366 -0
  145. package/src/generators/slice/built-in-plan-key-value-records.d.ts +3 -0
  146. package/src/generators/slice/built-in-plan-key-value-records.js +232 -0
  147. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.d.ts +2 -0
  148. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.js +103 -0
  149. package/src/generators/slice/built-in-plan-key-value-retention-job-files.d.ts +2 -0
  150. package/src/generators/slice/built-in-plan-key-value-retention-job-files.js +160 -0
  151. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.d.ts +2 -0
  152. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.js +329 -0
  153. package/src/generators/slice/built-in-plan-key-value-retention-worker.d.ts +2 -0
  154. package/src/generators/slice/built-in-plan-key-value-retention-worker.js +477 -0
  155. package/src/generators/slice/built-in-plan-key-value-retention.d.ts +2 -0
  156. package/src/generators/slice/built-in-plan-key-value-retention.js +184 -0
  157. package/src/generators/slice/built-in-plan-metadata-files.d.ts +1 -1
  158. package/src/generators/slice/built-in-plan-metadata-files.js +140 -28
  159. package/src/generators/slice/built-in-plan-native-runtime-authority-files.d.ts +1 -1
  160. package/src/generators/slice/built-in-plan-native-runtime-authority-files.js +36 -19
  161. package/src/generators/slice/built-in-plan-operations-files.d.ts +1 -1
  162. package/src/generators/slice/built-in-plan-operations-files.js +89 -50
  163. package/src/generators/slice/built-in-plan-performance-files.js +84 -1010
  164. package/src/generators/slice/built-in-plan-project-files.js +116 -67
  165. package/src/generators/slice/built-in-plan-release-files.d.ts +1 -1
  166. package/src/generators/slice/built-in-plan-release-files.js +64 -15
  167. package/src/generators/slice/built-in-plan-reliability-files.js +54 -28
  168. package/src/generators/slice/built-in-plan-shared.d.ts +3 -1
  169. package/src/generators/slice/built-in-plan-shared.js +40 -18
  170. package/src/generators/slice/built-in-plan-sql-events.d.ts +2 -0
  171. package/src/generators/slice/built-in-plan-sql-events.js +257 -0
  172. package/src/generators/slice/built-in-plan-testing-files.d.ts +1 -1
  173. package/src/generators/slice/built-in-plan-testing-files.js +184 -132
  174. package/src/generators/slice/built-in-plan-testing-persistence-files.d.ts +2 -0
  175. package/src/generators/slice/built-in-plan-testing-persistence-files.js +178 -0
  176. package/src/generators/slice/built-in-plan-thin-release-files.d.ts +1 -1
  177. package/src/generators/slice/built-in-plan-thin-release-files.js +35 -2
  178. package/src/generators/slice/built-in-plan-verification-files.js +70 -0
  179. package/src/generators/slice/built-in-plan-web-files.d.ts +1 -1
  180. package/src/generators/slice/built-in-plan-web-files.js +191 -14
  181. package/src/generators/slice/built-in-plan-workload-role-files.d.ts +1 -1
  182. package/src/generators/slice/built-in-plan-workload-role-files.js +113 -274
  183. package/src/generators/slice/built-in-plan.d.ts +9 -1
  184. package/src/generators/slice/built-in-plan.js +49 -21
  185. package/src/generators/slice/data-policy-review-seed.d.ts +2 -0
  186. package/src/generators/slice/data-policy-review-seed.js +22 -0
  187. package/src/generators/slice/deployed-smoke-readiness.d.ts +2 -0
  188. package/src/generators/slice/deployed-smoke-readiness.js +214 -0
  189. package/src/generators/slice/local-source-identity.d.ts +2 -0
  190. package/src/generators/slice/local-source-identity.js +31 -0
  191. package/src/generators/slice/persistence-contract.d.ts +14 -0
  192. package/src/generators/slice/persistence-contract.js +32 -0
  193. package/src/generators/slice/slice.js +29 -24
  194. package/src/generators/sql/schema.d.ts +7 -0
  195. package/src/generators/sql/schema.json +38 -0
  196. package/src/generators/sql/sql.d.ts +6 -0
  197. package/src/generators/sql/sql.js +53 -0
  198. package/src/generators/upgrade/sql-seeded-reconciliation.d.ts +2 -0
  199. package/src/generators/upgrade/sql-seeded-reconciliation.js +170 -0
  200. package/src/generators/upgrade/upgrade.d.ts +2 -0
  201. package/src/generators/upgrade/upgrade.js +136 -9
  202. package/src/generators/workload/workload.js +51 -2
  203. package/src/local-dev/browser-verification.d.ts +37 -0
  204. package/src/local-dev/browser-verification.js +281 -0
  205. package/src/local-dev/contracts.d.ts +10 -1
  206. package/src/local-dev/contracts.js +114 -13
  207. package/src/local-dev/dev-command-core.js +24 -5
  208. package/src/local-dev/docker-credential-health.d.ts +14 -0
  209. package/src/local-dev/docker-credential-health.js +94 -0
  210. package/src/local-dev/environment-inspector.d.ts +7 -0
  211. package/src/local-dev/environment-inspector.js +42 -15
  212. package/src/local-dev/environment-state.js +2 -2
  213. package/src/local-dev/errors.d.ts +1 -1
  214. package/src/local-dev/errors.js +2 -0
  215. package/src/local-dev/fleet-client.js +2 -2
  216. package/src/local-dev/fleet-configuration.js +57 -25
  217. package/src/local-dev/fleet-inventory.js +46 -18
  218. package/src/local-dev/fleet-ipc.d.ts +7 -0
  219. package/src/local-dev/fleet-ipc.js +14 -2
  220. package/src/local-dev/fleet-launcher.d.ts +6 -0
  221. package/src/local-dev/fleet-launcher.js +14 -2
  222. package/src/local-dev/fleet-logs.js +50 -22
  223. package/src/local-dev/fleet-process.d.ts +20 -1
  224. package/src/local-dev/fleet-process.js +197 -41
  225. package/src/local-dev/fleet-runner-evidence.d.ts +5 -0
  226. package/src/local-dev/fleet-runner-evidence.js +56 -0
  227. package/src/local-dev/fleet-runtime.js +268 -229
  228. package/src/local-dev/fleet-session.d.ts +2 -0
  229. package/src/local-dev/fleet-session.js +28 -11
  230. package/src/local-dev/fleet-slice-runner-daemon.js +4 -0
  231. package/src/local-dev/fleet-state.d.ts +5 -2
  232. package/src/local-dev/fleet-state.js +25 -4
  233. package/src/local-dev/fleet-supervisor.d.ts +3 -0
  234. package/src/local-dev/fleet-supervisor.js +66 -11
  235. package/src/local-dev/fleet-web-start.d.ts +12 -0
  236. package/src/local-dev/fleet-web-start.js +48 -0
  237. package/src/local-dev/identity.js +3 -14
  238. package/src/local-dev/index.d.ts +1 -0
  239. package/src/local-dev/index.js +1 -0
  240. package/src/local-dev/native-completion.d.ts +9 -0
  241. package/src/local-dev/native-completion.js +130 -0
  242. package/src/local-dev/nx-workspace.d.ts +4 -2
  243. package/src/local-dev/nx-workspace.js +11 -6
  244. package/src/local-dev/personal-stage.d.ts +4 -5
  245. package/src/local-dev/personal-stage.js +6 -54
  246. package/src/local-dev/port-claims.d.ts +13 -0
  247. package/src/local-dev/port-claims.js +46 -0
  248. package/src/local-dev/ports.d.ts +14 -2
  249. package/src/local-dev/ports.js +78 -3
  250. package/src/local-dev/private-state.d.ts +6 -0
  251. package/src/local-dev/private-state.js +126 -34
  252. package/src/local-dev/process-group.d.ts +4 -0
  253. package/src/local-dev/process-group.js +29 -0
  254. package/src/local-dev/process-identity.d.ts +8 -0
  255. package/src/local-dev/process-identity.js +31 -1
  256. package/src/local-dev/proxy.js +11 -12
  257. package/src/local-dev/runtime-paths.js +1 -1
  258. package/src/local-dev/slice-claim.js +1 -1
  259. package/src/local-dev/slice-runner.d.ts +15 -6
  260. package/src/local-dev/slice-runner.js +189 -54
  261. package/src/local-dev/task-attachment.d.ts +17 -0
  262. package/src/local-dev/task-attachment.js +73 -0
  263. package/src/local-dev/task-authority.d.ts +10 -0
  264. package/src/local-dev/task-authority.js +27 -0
  265. package/src/local-dev/task-identity.d.ts +33 -0
  266. package/src/local-dev/task-identity.js +418 -0
  267. package/src/local-dev/task-native-writer.d.ts +18 -0
  268. package/src/local-dev/task-native-writer.js +329 -0
  269. package/src/local-dev/tls.js +3 -1
  270. package/src/local-dev/web-launch.d.ts +9 -0
  271. package/src/local-dev/web-launch.js +130 -0
  272. package/src/ownership/composition.d.ts +2 -1
  273. package/src/ownership/composition.js +1 -0
  274. package/src/performance/scenario.d.ts +22 -0
  275. package/src/performance/scenario.js +100 -92
  276. package/src/repository-policy/deployment-plan.d.ts +2 -2
  277. package/src/repository-policy/deployment-plan.js +2 -1
  278. package/src/repository-policy/policy.js +38 -3
  279. package/src/schemas/blueprint-v1.json +5 -4
  280. package/src/schemas/foundation-requirement-v1.json +5 -4
  281. package/src/schemas/testing-evidence-result-v1.json +1 -1
  282. package/src/secrets/operator.d.ts +3 -1
  283. package/src/secrets/operator.js +22 -3
  284. package/src/sst-environment-source-format.d.ts +3 -0
  285. package/src/sst-environment-source-format.js +20 -0
  286. package/src/supply-chain/blueprint-trust-git.js +13 -3
  287. package/src/supply-chain/build-output.js +15 -0
  288. package/src/supply-chain/generated-blueprint-trust-command.js +18 -1
  289. package/src/testing-evidence/fixture-scope.d.ts +2 -1
  290. package/src/testing-evidence/fixture-scope.js +4 -2
  291. package/src/testing-evidence/result.d.ts +2 -1
  292. package/src/testing-evidence/result.js +18 -4
  293. package/src/workload-roles/standard-slice.js +2 -3
  294. package/src/api-contract/baseline-update.js.map +0 -1
  295. package/src/api-contract/compatibility.js.map +0 -1
  296. package/src/api-contract/contract-graph.js.map +0 -1
  297. package/src/api-contract/evidence.js.map +0 -1
  298. package/src/api-contract/index.js.map +0 -1
  299. package/src/api-contract/model.fixtures.d.ts +0 -2
  300. package/src/api-contract/model.fixtures.js +0 -81
  301. package/src/api-contract/model.fixtures.js.map +0 -1
  302. package/src/api-contract/model.js.map +0 -1
  303. package/src/api-contract/rollout.js.map +0 -1
  304. package/src/authorization/compatibility.js.map +0 -1
  305. package/src/authorization/index.js.map +0 -1
  306. package/src/aws/child-environment.js.map +0 -1
  307. package/src/aws/identity.js.map +0 -1
  308. package/src/aws-authority/index.js.map +0 -1
  309. package/src/aws-authority/stage-authority.js.map +0 -1
  310. package/src/blueprints/execution.js.map +0 -1
  311. package/src/blueprints/external-sandbox.js.map +0 -1
  312. package/src/blueprints/index.js.map +0 -1
  313. package/src/blueprints/inputs.js.map +0 -1
  314. package/src/blueprints/manifest.js.map +0 -1
  315. package/src/blueprints/resolver.js.map +0 -1
  316. package/src/blueprints/transitions.js.map +0 -1
  317. package/src/cli/agent-command.js.map +0 -1
  318. package/src/cli/agent-runtime.js.map +0 -1
  319. package/src/cli/blueprint-authority.js.map +0 -1
  320. package/src/cli/blueprint-command.js.map +0 -1
  321. package/src/cli/bootstrap.js.map +0 -1
  322. package/src/cli/dev-command.js.map +0 -1
  323. package/src/cli/main.js.map +0 -1
  324. package/src/cli/output.js.map +0 -1
  325. package/src/cli/personal-secret-runtime.js.map +0 -1
  326. package/src/cli/secret-terminal.js.map +0 -1
  327. package/src/container-images.js.map +0 -1
  328. package/src/data-lifecycle/index.js.map +0 -1
  329. package/src/data-lifecycle/model.fixtures.d.ts +0 -2
  330. package/src/data-lifecycle/model.fixtures.js +0 -244
  331. package/src/data-lifecycle/model.fixtures.js.map +0 -1
  332. package/src/data-lifecycle/model.js.map +0 -1
  333. package/src/data-lifecycle/sensitive-artifacts.js.map +0 -1
  334. package/src/data-lifecycle/validation.js.map +0 -1
  335. package/src/database-retirement/contract.js.map +0 -1
  336. package/src/database-retirement/index.js.map +0 -1
  337. package/src/deterministic-order.js.map +0 -1
  338. package/src/developer-agent/context.js.map +0 -1
  339. package/src/developer-agent/generator-planning.js.map +0 -1
  340. package/src/developer-agent/generator-preview.js.map +0 -1
  341. package/src/developer-agent/git-inspection.js.map +0 -1
  342. package/src/developer-agent/handoff.js.map +0 -1
  343. package/src/developer-agent/index.js.map +0 -1
  344. package/src/developer-agent/model.js.map +0 -1
  345. package/src/developer-agent/operation-registry.js.map +0 -1
  346. package/src/developer-agent/ordering.js.map +0 -1
  347. package/src/developer-agent/planning.js.map +0 -1
  348. package/src/developer-agent/preview-changes.js.map +0 -1
  349. package/src/developer-agent/preview-source.js.map +0 -1
  350. package/src/developer-agent/validation.js.map +0 -1
  351. package/src/developer-agent/workspace-inspection.js.map +0 -1
  352. package/src/developer-agent/workspace-path.js.map +0 -1
  353. package/src/executors/blueprint-trust/blueprint-trust.js.map +0 -1
  354. package/src/executors/blueprint-verification/blueprint-verification.js.map +0 -1
  355. package/src/executors/deploy/deploy.js.map +0 -1
  356. package/src/executors/deployment-plan/deployment-plan.js.map +0 -1
  357. package/src/executors/dev/dev.js.map +0 -1
  358. package/src/executors/dev-doctor/dev-doctor.js.map +0 -1
  359. package/src/executors/dev-setup/dev-setup.js.map +0 -1
  360. package/src/executors/developer-context/developer-context.js.map +0 -1
  361. package/src/executors/fleet/fleet.js.map +0 -1
  362. package/src/executors/foundation-preflight/foundation-preflight.js.map +0 -1
  363. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js.map +0 -1
  364. package/src/executors/foundation-profile-preflight/production-database-safeguard.js.map +0 -1
  365. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js.map +0 -1
  366. package/src/executors/github-bootstrap/github-bootstrap.js.map +0 -1
  367. package/src/executors/infrastructure-plan/infrastructure-plan.js.map +0 -1
  368. package/src/executors/local-deploy/federated-credential-transport.js.map +0 -1
  369. package/src/executors/local-deploy/fixtures/local-deploy-state-machine.mjs +0 -53
  370. package/src/executors/local-deploy/local-approval.js.map +0 -1
  371. package/src/executors/local-deploy/local-deploy.js.map +0 -1
  372. package/src/executors/refresh/refresh.js.map +0 -1
  373. package/src/executors/remove/remove.js.map +0 -1
  374. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js.map +0 -1
  375. package/src/executors/secret-guardrails/secret-guardrails.js.map +0 -1
  376. package/src/executors/secret-initialize/secret-initialize.js.map +0 -1
  377. package/src/executors/secret-metadata/secret-metadata.js.map +0 -1
  378. package/src/executors/sst-lifecycle/generated-secret-retirement.js.map +0 -1
  379. package/src/executors/sst-lifecycle/governed-native-operation.js.map +0 -1
  380. package/src/executors/sst-lifecycle/logging-preflight.js.map +0 -1
  381. package/src/executors/sst-lifecycle/run-sst-command.js.map +0 -1
  382. package/src/executors/sst-lifecycle/secret-preflight.js.map +0 -1
  383. package/src/executors/sst-lifecycle/sst-environment-source.js.map +0 -1
  384. package/src/executors/unlock/unlock.js.map +0 -1
  385. package/src/executors/work-markers/work-markers.js.map +0 -1
  386. package/src/foundation/discovery.js.map +0 -1
  387. package/src/foundation/index.js.map +0 -1
  388. package/src/foundation/local-database-contract.js.map +0 -1
  389. package/src/foundation/logging-preflight.js.map +0 -1
  390. package/src/foundation/logging.js.map +0 -1
  391. package/src/foundation/partial-state.js.map +0 -1
  392. package/src/foundation/preflight.js.map +0 -1
  393. package/src/foundation/private-smoke-access.js.map +0 -1
  394. package/src/foundation/private-smoke-admission.js.map +0 -1
  395. package/src/foundation/private-smoke-control-plane.js.map +0 -1
  396. package/src/foundation/provision-database-bindings.js.map +0 -1
  397. package/src/foundation/provision-logical-database.js.map +0 -1
  398. package/src/foundation/requirements.js.map +0 -1
  399. package/src/foundation/router-origin-proof.js.map +0 -1
  400. package/src/foundation/router-waf-rate-rehearsal.js.map +0 -1
  401. package/src/foundation/router-waf.js.map +0 -1
  402. package/src/foundation/stages.js.map +0 -1
  403. package/src/frontend-security/index.js.map +0 -1
  404. package/src/frontend-security/security-headers.js.map +0 -1
  405. package/src/generators/feature-registry.js.map +0 -1
  406. package/src/generators/formatting.js.map +0 -1
  407. package/src/generators/function/function.js.map +0 -1
  408. package/src/generators/job/job.js.map +0 -1
  409. package/src/generators/logging-registry.js.map +0 -1
  410. package/src/generators/post-generation-install.js.map +0 -1
  411. package/src/generators/preset/dependency-overrides.js.map +0 -1
  412. package/src/generators/preset/generator.js.map +0 -1
  413. package/src/generators/preset/tool-versions.js.map +0 -1
  414. package/src/generators/preset/workspace-files-ci-acceptance.js.map +0 -1
  415. package/src/generators/preset/workspace-files-developer-agent.js.map +0 -1
  416. package/src/generators/preset/workspace-files-ecr-inspector.js.map +0 -1
  417. package/src/generators/preset/workspace-files-foundation-workload-roles.js.map +0 -1
  418. package/src/generators/preset/workspace-files-performance-cost.js.map +0 -1
  419. package/src/generators/preset/workspace-files-performance-load.js.map +0 -1
  420. package/src/generators/preset/workspace-files-stage-authority.js.map +0 -1
  421. package/src/generators/preset/workspace-files-thin-deploy.js.map +0 -1
  422. package/src/generators/preset/workspace-files-thin-docs.js.map +0 -1
  423. package/src/generators/preset/workspace-files-thin-release.js.map +0 -1
  424. package/src/generators/preset/workspace-files-workload-role-baseline.js.map +0 -1
  425. package/src/generators/preset/workspace-files.js.map +0 -1
  426. package/src/generators/repository-policy/repository-policy.js.map +0 -1
  427. package/src/generators/repository-policy/tree-policy.js.map +0 -1
  428. package/src/generators/service/service.js.map +0 -1
  429. package/src/generators/slice/built-in-plan-api-contract-files.js.map +0 -1
  430. package/src/generators/slice/built-in-plan-api-files.js.map +0 -1
  431. package/src/generators/slice/built-in-plan-async-work-files.js.map +0 -1
  432. package/src/generators/slice/built-in-plan-authorization-files.js.map +0 -1
  433. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js.map +0 -1
  434. package/src/generators/slice/built-in-plan-background-work-files.js.map +0 -1
  435. package/src/generators/slice/built-in-plan-data-deletion-files.js.map +0 -1
  436. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js.map +0 -1
  437. package/src/generators/slice/built-in-plan-data-files.js.map +0 -1
  438. package/src/generators/slice/built-in-plan-data-lifecycle-files.js.map +0 -1
  439. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js.map +0 -1
  440. package/src/generators/slice/built-in-plan-data-retention-job-files.js.map +0 -1
  441. package/src/generators/slice/built-in-plan-data-retention-launcher-files.js.map +0 -1
  442. package/src/generators/slice/built-in-plan-data-rights-files.js.map +0 -1
  443. package/src/generators/slice/built-in-plan-database-lifecycle-files.js.map +0 -1
  444. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js.map +0 -1
  445. package/src/generators/slice/built-in-plan-foundation-files.js.map +0 -1
  446. package/src/generators/slice/built-in-plan-frontend-files.js.map +0 -1
  447. package/src/generators/slice/built-in-plan-infrastructure-files.js.map +0 -1
  448. package/src/generators/slice/built-in-plan-infrastructure-safety-files.js.map +0 -1
  449. package/src/generators/slice/built-in-plan-metadata-files.js.map +0 -1
  450. package/src/generators/slice/built-in-plan-native-runtime-authority-files.js.map +0 -1
  451. package/src/generators/slice/built-in-plan-operations-files.js.map +0 -1
  452. package/src/generators/slice/built-in-plan-performance-files.js.map +0 -1
  453. package/src/generators/slice/built-in-plan-project-files.js.map +0 -1
  454. package/src/generators/slice/built-in-plan-release-files.js.map +0 -1
  455. package/src/generators/slice/built-in-plan-reliability-files.js.map +0 -1
  456. package/src/generators/slice/built-in-plan-secret-runtime-files.js.map +0 -1
  457. package/src/generators/slice/built-in-plan-shared.js.map +0 -1
  458. package/src/generators/slice/built-in-plan-testing-files.js.map +0 -1
  459. package/src/generators/slice/built-in-plan-thin-release-files.js.map +0 -1
  460. package/src/generators/slice/built-in-plan-verification-files.js.map +0 -1
  461. package/src/generators/slice/built-in-plan-web-files.js.map +0 -1
  462. package/src/generators/slice/built-in-plan-workload-role-files.js.map +0 -1
  463. package/src/generators/slice/built-in-plan.js.map +0 -1
  464. package/src/generators/slice/slice.js.map +0 -1
  465. package/src/generators/upgrade/upgrade.js.map +0 -1
  466. package/src/generators/workload/frozen-container.js.map +0 -1
  467. package/src/generators/workload/performance-registration.js.map +0 -1
  468. package/src/generators/workload/reliability-registration.js.map +0 -1
  469. package/src/generators/workload/service-performance-files.js.map +0 -1
  470. package/src/generators/workload/workload.js.map +0 -1
  471. package/src/git-policy/action-pins.js.map +0 -1
  472. package/src/git-policy/github-bootstrap.js.map +0 -1
  473. package/src/git-policy/index.js.map +0 -1
  474. package/src/git-policy/routing.js.map +0 -1
  475. package/src/index.js.map +0 -1
  476. package/src/infrastructure-change/convergence.js.map +0 -1
  477. package/src/infrastructure-change/drift.js.map +0 -1
  478. package/src/infrastructure-change/index.js.map +0 -1
  479. package/src/infrastructure-change/local-capability.js.map +0 -1
  480. package/src/infrastructure-change/model.js.map +0 -1
  481. package/src/infrastructure-change/normalize.js.map +0 -1
  482. package/src/infrastructure-change/plan.js.map +0 -1
  483. package/src/infrastructure-change/risk.js.map +0 -1
  484. package/src/infrastructure-change/summary.js.map +0 -1
  485. package/src/local-dev/context-discovery.js.map +0 -1
  486. package/src/local-dev/contract-validation.js.map +0 -1
  487. package/src/local-dev/contracts.js.map +0 -1
  488. package/src/local-dev/control-contract.js.map +0 -1
  489. package/src/local-dev/dev-command-core.js.map +0 -1
  490. package/src/local-dev/effects.js.map +0 -1
  491. package/src/local-dev/environment-inspector.js.map +0 -1
  492. package/src/local-dev/environment-state.js.map +0 -1
  493. package/src/local-dev/errors.js.map +0 -1
  494. package/src/local-dev/fleet-client.js.map +0 -1
  495. package/src/local-dev/fleet-configuration.js.map +0 -1
  496. package/src/local-dev/fleet-inventory.js.map +0 -1
  497. package/src/local-dev/fleet-ipc.js.map +0 -1
  498. package/src/local-dev/fleet-launcher.js.map +0 -1
  499. package/src/local-dev/fleet-lock.js.map +0 -1
  500. package/src/local-dev/fleet-logs.js.map +0 -1
  501. package/src/local-dev/fleet-process.js.map +0 -1
  502. package/src/local-dev/fleet-runtime.js.map +0 -1
  503. package/src/local-dev/fleet-session.js.map +0 -1
  504. package/src/local-dev/fleet-slice-runner-daemon.js.map +0 -1
  505. package/src/local-dev/fleet-startup.js.map +0 -1
  506. package/src/local-dev/fleet-state.js.map +0 -1
  507. package/src/local-dev/fleet-supervisor-daemon.js.map +0 -1
  508. package/src/local-dev/fleet-supervisor.js.map +0 -1
  509. package/src/local-dev/gateway-daemon.js.map +0 -1
  510. package/src/local-dev/gateway.js.map +0 -1
  511. package/src/local-dev/identity.js.map +0 -1
  512. package/src/local-dev/index.js.map +0 -1
  513. package/src/local-dev/local-context.js.map +0 -1
  514. package/src/local-dev/nx-workspace.js.map +0 -1
  515. package/src/local-dev/personal-secret-ledger.js.map +0 -1
  516. package/src/local-dev/personal-stage.js.map +0 -1
  517. package/src/local-dev/portless.js.map +0 -1
  518. package/src/local-dev/ports.js.map +0 -1
  519. package/src/local-dev/private-state.js.map +0 -1
  520. package/src/local-dev/process-identity.js.map +0 -1
  521. package/src/local-dev/proxy.js.map +0 -1
  522. package/src/local-dev/runtime-paths.js.map +0 -1
  523. package/src/local-dev/secret-slice-claim.js.map +0 -1
  524. package/src/local-dev/slice-claim.js.map +0 -1
  525. package/src/local-dev/slice-runner.js.map +0 -1
  526. package/src/local-dev/tls.js.map +0 -1
  527. package/src/ownership/composition.js.map +0 -1
  528. package/src/ownership/foundation-record.js.map +0 -1
  529. package/src/ownership/hash.js.map +0 -1
  530. package/src/ownership/index.js.map +0 -1
  531. package/src/ownership/json-ownership.js.map +0 -1
  532. package/src/ownership/record.js.map +0 -1
  533. package/src/ownership/workspace-record.js.map +0 -1
  534. package/src/performance/cost-collection.js.map +0 -1
  535. package/src/performance/cost-controls.js.map +0 -1
  536. package/src/performance/evidence.js.map +0 -1
  537. package/src/performance/index.js.map +0 -1
  538. package/src/performance/load-safety.js.map +0 -1
  539. package/src/performance/model.js.map +0 -1
  540. package/src/performance/pr-artifact-budget.js.map +0 -1
  541. package/src/performance/runner.js.map +0 -1
  542. package/src/performance/scenario-endpoint.js.map +0 -1
  543. package/src/performance/scenario.js.map +0 -1
  544. package/src/performance/test-fixtures.d.ts +0 -7
  545. package/src/performance/test-fixtures.js +0 -167
  546. package/src/performance/test-fixtures.js.map +0 -1
  547. package/src/performance/unit-cost.js.map +0 -1
  548. package/src/release/index.js.map +0 -1
  549. package/src/release/lifecycle.js.map +0 -1
  550. package/src/release/manifest.js.map +0 -1
  551. package/src/release/rollout.js.map +0 -1
  552. package/src/release/source-authority.js.map +0 -1
  553. package/src/repository-policy/aurora-preflight.js.map +0 -1
  554. package/src/repository-policy/capacity-migration.js.map +0 -1
  555. package/src/repository-policy/deployment-plan.js.map +0 -1
  556. package/src/repository-policy/foundation-profile.js.map +0 -1
  557. package/src/repository-policy/index.js.map +0 -1
  558. package/src/repository-policy/policy.js.map +0 -1
  559. package/src/secrets/adapters.js.map +0 -1
  560. package/src/secrets/aws-control-plane.js.map +0 -1
  561. package/src/secrets/declaration-verification.js.map +0 -1
  562. package/src/secrets/generated-aws-control-plane.js.map +0 -1
  563. package/src/secrets/guardrails.js.map +0 -1
  564. package/src/secrets/index.js.map +0 -1
  565. package/src/secrets/metadata.js.map +0 -1
  566. package/src/secrets/model.js.map +0 -1
  567. package/src/secrets/operator.js.map +0 -1
  568. package/src/secrets/permissions.js.map +0 -1
  569. package/src/secrets/personal-command.js.map +0 -1
  570. package/src/secrets/personal-ledger.js.map +0 -1
  571. package/src/secrets/registry.js.map +0 -1
  572. package/src/secrets/verification.js.map +0 -1
  573. package/src/secrets/workload-access.js.map +0 -1
  574. package/src/sst-environment-source-format.js.map +0 -1
  575. package/src/supply-chain/action-pins.js.map +0 -1
  576. package/src/supply-chain/blueprint-trust-git.js.map +0 -1
  577. package/src/supply-chain/blueprint-trust-process.js.map +0 -1
  578. package/src/supply-chain/blueprint-trust.js.map +0 -1
  579. package/src/supply-chain/blueprint-verification-authority.js.map +0 -1
  580. package/src/supply-chain/blueprint-verification-execution.js.map +0 -1
  581. package/src/supply-chain/build-output-bounds.js.map +0 -1
  582. package/src/supply-chain/build-output.js.map +0 -1
  583. package/src/supply-chain/common.js.map +0 -1
  584. package/src/supply-chain/container-artifact-contract.js.map +0 -1
  585. package/src/supply-chain/container-release.js.map +0 -1
  586. package/src/supply-chain/ecr-applicability.js.map +0 -1
  587. package/src/supply-chain/ecr-scanning.js.map +0 -1
  588. package/src/supply-chain/ecs-deployed-image.js.map +0 -1
  589. package/src/supply-chain/errors.js.map +0 -1
  590. package/src/supply-chain/generated-blueprint-trust-command.js.map +0 -1
  591. package/src/supply-chain/generated-command.js.map +0 -1
  592. package/src/supply-chain/generated-container-release-command.js.map +0 -1
  593. package/src/supply-chain/generated-ecr-collector-command.js.map +0 -1
  594. package/src/supply-chain/generated-files.js.map +0 -1
  595. package/src/supply-chain/generated-scanner-command.js.map +0 -1
  596. package/src/supply-chain/index.js.map +0 -1
  597. package/src/supply-chain/inventory.js.map +0 -1
  598. package/src/supply-chain/license-expression.js.map +0 -1
  599. package/src/supply-chain/pnpm-toolchain-authority.js.map +0 -1
  600. package/src/supply-chain/policy.js.map +0 -1
  601. package/src/supply-chain/publication.js.map +0 -1
  602. package/src/supply-chain/sbom.js.map +0 -1
  603. package/src/supply-chain/scanner.js.map +0 -1
  604. package/src/supply-chain/vendored-source.js.map +0 -1
  605. package/src/testing-evidence/fixture-scope.js.map +0 -1
  606. package/src/testing-evidence/index.js.map +0 -1
  607. package/src/testing-evidence/quarantine.js.map +0 -1
  608. package/src/testing-evidence/result.js.map +0 -1
  609. package/src/testing-evidence/runner-adapter.js.map +0 -1
  610. package/src/testing-evidence/sensitive-artifacts.js.map +0 -1
  611. package/src/validation.js.map +0 -1
  612. package/src/work-markers/index.js.map +0 -1
  613. package/src/work-markers/work-markers.js.map +0 -1
  614. package/src/workload-roles/account-baseline.js.map +0 -1
  615. package/src/workload-roles/authority.js.map +0 -1
  616. package/src/workload-roles/aws-adapter.js.map +0 -1
  617. package/src/workload-roles/aws-internal-handler.js.map +0 -1
  618. package/src/workload-roles/aws-s3-state.js.map +0 -1
  619. package/src/workload-roles/aws-sdk-control-plane.js.map +0 -1
  620. package/src/workload-roles/boundary.js.map +0 -1
  621. package/src/workload-roles/convergence.js.map +0 -1
  622. package/src/workload-roles/effective-policy.js.map +0 -1
  623. package/src/workload-roles/handler.js.map +0 -1
  624. package/src/workload-roles/history.js.map +0 -1
  625. package/src/workload-roles/index.js.map +0 -1
  626. package/src/workload-roles/injection.js.map +0 -1
  627. package/src/workload-roles/manifest.js.map +0 -1
  628. package/src/workload-roles/provisioner.js.map +0 -1
  629. package/src/workload-roles/registration.js.map +0 -1
  630. package/src/workload-roles/stage-boundary.js.map +0 -1
  631. package/src/workload-roles/standard-slice.js.map +0 -1
  632. package/src/workspace-deployment/affected-lifecycle.js.map +0 -1
  633. package/src/workspace-deployment/identity.js.map +0 -1
  634. package/src/workspace-deployment/index.js.map +0 -1
  635. package/src/workspace-deployment/migration-evidence.js.map +0 -1
  636. package/src/workspace-deployment/migration.js.map +0 -1
  637. package/src/workspace-deployment/ownership.js.map +0 -1
@@ -25,24 +25,12 @@ function snapshotTable(name, columns, uniqueConstraints = {}, compositePrimaryKe
25
25
  isRLSEnabled: false,
26
26
  };
27
27
  }
28
- function snapshotIndex(name, columns) {
29
- return {
30
- columns: columns.map(({ expression }) => ({
31
- asc: true,
32
- expression,
33
- isExpression: false,
34
- nulls: 'last',
35
- })),
36
- concurrently: false,
37
- isUnique: false,
38
- method: 'btree',
39
- name,
40
- with: {},
41
- };
42
- }
43
28
  /** @internal */
44
- function renderProductDataFiles(name, pascalName, protectedRuntimeStages = ['staging', 'production']) {
45
- return {
29
+ function renderProductDataFiles(name, pascalName, protectedRuntimeStages = ['staging', 'production'], sql = true) {
30
+ const databaseStages = [
31
+ ...new Set(['development', ...protectedRuntimeStages]),
32
+ ];
33
+ const files = {
46
34
  'contracts/events.ts': `import type { DataLifecycleChangeEventV1 } from '@empire-builder-kit/runtime/data-lifecycle';
47
35
 
48
36
  export interface ${pascalName}CreatedData {
@@ -95,219 +83,13 @@ export const EventContractSchema = {
95
83
  slice: '${name}',
96
84
  } as const;
97
85
  `,
98
- 'database/schema.ts': `import { boolean, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uuid } from 'drizzle-orm/pg-core';
99
-
100
- export const records = pgTable(
101
- 'records',
102
- {
103
- createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
104
- id: uuid('id').defaultRandom().primaryKey(),
105
- lastActivityAt: timestamp('last_activity_at', { withTimezone: true }).defaultNow().notNull(),
106
- name: text('name').notNull(),
107
- ownerId: text('owner_id').notNull(),
108
- runScope: text('run_scope').notNull(),
109
- testExpiresAt: timestamp('test_expires_at', { withTimezone: true }),
110
- },
111
- (table) => [
112
- index('records_performance_expiry_idx').on(
113
- table.ownerId,
114
- table.name,
115
- table.testExpiresAt,
116
- ),
117
- index('records_performance_run_scope_idx').on(
118
- table.ownerId,
119
- table.name,
120
- table.runScope,
121
- ),
122
- ],
123
- );
124
-
125
- export const authorizationAudit = pgTable('authorization_audit', {
126
- action: text('action').notNull(),
127
- approvalReference: text('approval_reference'),
128
- authorityMode: text('authority_mode').notNull(),
129
- correlationId: text('correlation_id').notNull(),
130
- createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
131
- decision: text('decision').notNull(),
132
- id: uuid('id').defaultRandom().primaryKey(),
133
- policyVersion: text('policy_version').notNull(),
134
- principalKind: text('principal_kind').notNull(),
135
- pseudonymousSubjectId: text('pseudonymous_subject_id').notNull(),
136
- reasonCategory: text('reason_category').notNull(),
137
- delegationReference: text('delegation_reference'),
138
- resourceReference: text('resource_reference'),
139
- resourceType: text('resource_type').notNull(),
140
- slice: text('slice').notNull(),
141
- stage: text('stage').notNull(),
142
- subjectType: text('subject_type').notNull(),
143
- });
144
-
145
- export const delegationGrants = pgTable('delegation_grants', {
146
- capabilityDigest: text('capability_digest').notNull(),
147
- createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
148
- expiresAt: timestamp('expires_at', { withTimezone: true }).notNull(),
149
- grantJson: jsonb('grant_json').notNull(),
150
- id: uuid('id').primaryKey(),
151
- issuedAt: timestamp('issued_at', { withTimezone: true }).notNull(),
152
- policyVersion: text('policy_version').notNull(),
153
- revision: integer('revision').notNull(),
154
- status: text('status').notNull(),
155
- });
156
-
157
- export const approvalRequests = pgTable('approval_requests', {
158
- authorReference: text('author_reference').notNull(),
159
- createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
160
- expiresAt: timestamp('expires_at', { withTimezone: true }).notNull(),
161
- id: uuid('id').primaryKey(),
162
- policyVersion: text('policy_version').notNull(),
163
- requestJson: jsonb('request_json').notNull(),
164
- requestDigest: text('request_digest').notNull(),
165
- revision: integer('revision').notNull(),
166
- status: text('status').notNull(),
167
- });
168
-
169
- export const dataLifecycleAudit = pgTable(
170
- 'data_lifecycle_audit',
171
- {
172
- action: text('action').notNull(),
173
- actorRef: text('actor_ref').notNull(),
174
- approvalReference: text('approval_reference'),
175
- auditJson: jsonb('audit_json').notNull(),
176
- authorityCode: text('authority_code').notNull(),
177
- correlationRef: text('correlation_ref').notNull(),
178
- expiresAt: timestamp('expires_at', { withTimezone: true }).notNull(),
179
- id: uuid('id').defaultRandom().primaryKey(),
180
- occurredAt: timestamp('occurred_at', { withTimezone: true }).notNull(),
181
- outcome: text('outcome').notNull(),
182
- policyVersion: text('policy_version').notNull(),
183
- principalKind: text('principal_kind').notNull(),
184
- purposeCode: text('purpose_code').notNull(),
185
- resourceReference: text('resource_reference'),
186
- slice: text('slice').notNull(),
187
- stage: text('stage').notNull(),
188
- subjectType: text('subject_type').notNull(),
189
- targetCategoryId: text('target_category_id').notNull(),
190
- },
191
- (table) => [
192
- index('data_lifecycle_audit_expires_at_idx').on(table.expiresAt),
193
- ],
194
- );
195
-
196
- export const dataLifecycleExportArtifacts = pgTable(
197
- 'data_lifecycle_export_artifacts',
198
- {
199
- approvalRequestId: uuid('approval_request_id')
200
- .primaryKey()
201
- .references(() => approvalRequests.id, { onDelete: 'cascade' }),
202
- artifactRef: text('artifact_ref'),
203
- cleanupDeadlineAt: timestamp('cleanup_deadline_at', {
204
- withTimezone: true,
205
- }),
206
- cleanupState: text('cleanup_state').notNull(),
207
- createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
208
- currentVersionId: text('current_version_id'),
209
- expiresAt: timestamp('expires_at', { withTimezone: true }),
210
- lastErrorCode: text('last_error_code'),
211
- objectKey: text('object_key').notNull(),
212
- recordRef: text('record_ref').notNull(),
213
- subjectRef: text('subject_ref').notNull(),
214
- updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
215
- uploadStartedAt: timestamp('upload_started_at', { withTimezone: true }),
216
- },
217
- (table) => [
218
- index('data_lifecycle_export_artifacts_subject_created_idx').on(
219
- table.subjectRef,
220
- table.createdAt,
221
- ),
222
- index('data_lifecycle_export_artifacts_cleanup_expiry_idx').on(
223
- table.cleanupState,
224
- table.expiresAt,
225
- ),
226
- index('data_lifecycle_export_artifacts_cleanup_deadline_idx').on(
227
- table.cleanupState,
228
- table.cleanupDeadlineAt,
229
- ),
230
- ],
231
- );
232
-
233
- export const dataLifecycleExportVersions = pgTable(
234
- 'data_lifecycle_export_versions',
235
- {
236
- approvalRequestId: uuid('approval_request_id')
237
- .notNull()
238
- .references(() => approvalRequests.id, { onDelete: 'cascade' }),
239
- deletedAt: timestamp('deleted_at', { withTimezone: true }),
240
- isDeleteMarker: boolean('is_delete_marker').notNull(),
241
- objectKey: text('object_key').notNull(),
242
- status: text('status').notNull(),
243
- versionId: text('version_id').notNull(),
244
- },
245
- (table) => [
246
- primaryKey({
247
- columns: [table.approvalRequestId, table.versionId],
248
- }),
249
- index('data_lifecycle_export_versions_status_idx').on(table.status),
250
- ],
251
- );
252
-
253
- export const cleanupDeadlineReportCapacity = pgTable(
254
- 'cleanup_deadline_report_capacity',
255
- {
256
- feature: text('feature').primaryKey(),
257
- maximumPending: integer('maximum_pending').notNull(),
258
- },
259
- );
260
-
261
- export const cleanupDeadlineReports = pgTable(
262
- 'cleanup_deadline_reports',
263
- {
264
- deadlineAt: timestamp('deadline_at', { withTimezone: true }).notNull(),
265
- feature: text('feature').notNull(),
266
- observedAt: timestamp('observed_at', { withTimezone: true })
267
- .defaultNow()
268
- .notNull(),
269
- resourceRef: text('resource_ref').notNull(),
270
- },
271
- (table) => [
272
- primaryKey({ columns: [table.feature, table.resourceRef] }),
273
- index('cleanup_deadline_reports_feature_observed_idx').on(
274
- table.feature,
275
- table.observedAt,
276
- ),
277
- ],
278
- );
279
-
280
- export const dataLifecycleLedger = pgTable('data_lifecycle_ledger', {
281
- action: text('action').notNull(),
282
- categoryId: text('category_id').notNull(),
283
- createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
284
- effectiveAt: timestamp('effective_at', { withTimezone: true }).notNull(),
285
- entryId: text('entry_id').primaryKey(),
286
- expiresAt: timestamp('expires_at', { withTimezone: true }).notNull(),
287
- idempotencyKey: text('idempotency_key').notNull().unique(),
288
- policyVersion: text('policy_version').notNull(),
289
- pseudonymousKey: text('pseudonymous_key').notNull(),
290
- });
291
-
292
- export const dataLifecycleRequests = pgTable('data_lifecycle_requests', {
293
- approvalRequestId: uuid('approval_request_id').notNull().unique(),
294
- id: uuid('id').primaryKey(),
295
- requestJson: jsonb('request_json').notNull(),
296
- revision: integer('revision').notNull(),
297
- status: text('status').notNull(),
298
- updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
299
- });
300
-
301
- export const dataLifecycleHolds = pgTable('data_lifecycle_holds', {
302
- categoryId: text('category_id').notNull(),
303
- expiresAt: timestamp('expires_at', { withTimezone: true }).notNull(),
304
- holdId: text('hold_id').primaryKey(),
305
- holdJson: jsonb('hold_json').notNull(),
306
- reviewAt: timestamp('review_at', { withTimezone: true }).notNull(),
307
- scopeRef: text('scope_ref').notNull(),
308
- status: text('status').notNull(),
309
- });
86
+ 'database/schema.ts': `import { integer, jsonb, pgTable, text, timestamp } from 'drizzle-orm/pg-core';
310
87
 
88
+ /**
89
+ * Add user-owned relational feature tables here. Standard records, authorization,
90
+ * inbox, retention and ordinary event intents remain in DynamoDB.
91
+ * This table is only for events committed atomically with an optional SQL feature.
92
+ */
311
93
  export const dataLifecycleOutbox = pgTable('data_lifecycle_outbox', {
312
94
  attempts: integer('attempts').default(0).notNull(),
313
95
  createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
@@ -317,162 +99,8 @@ export const dataLifecycleOutbox = pgTable('data_lifecycle_outbox', {
317
99
  lastErrorCode: text('last_error_code'),
318
100
  publishedAt: timestamp('published_at', { withTimezone: true }),
319
101
  });
320
-
321
- export const performanceLoadRuns = pgTable(
322
- 'performance_load_runs',
323
- {
324
- adapterId: text('adapter_id').notNull(),
325
- cleanupStartedAt: timestamp('cleanup_started_at', {
326
- withTimezone: true,
327
- }),
328
- createdAt: timestamp('created_at', { withTimezone: true }).notNull(),
329
- expiresAt: timestamp('expires_at', { withTimezone: true }).notNull(),
330
- maximumRequests: integer('maximum_requests').notNull(),
331
- planDigest: text('plan_digest').primaryKey(),
332
- releaseMaterialDigest: text('release_material_digest').notNull(),
333
- runId: text('run_id').notNull(),
334
- scenarioId: text('scenario_id').notNull(),
335
- sourceCommit: text('source_commit').notNull(),
336
- stage: text('stage').notNull(),
337
- },
338
- (table) => [
339
- index('performance_load_runs_expires_at_idx').on(table.expiresAt),
340
- ],
341
- );
342
-
343
- export const performanceLoadRequests = pgTable(
344
- 'performance_load_requests',
345
- {
346
- claimedAt: timestamp('claimed_at', { withTimezone: true })
347
- .defaultNow()
348
- .notNull(),
349
- effectId: text('effect_id'),
350
- planDigest: text('plan_digest').notNull(),
351
- requestOrdinal: integer('request_ordinal').notNull(),
352
- },
353
- (table) => [
354
- primaryKey({ columns: [table.planDigest, table.requestOrdinal] }),
355
- ],
356
- );
357
-
358
- export const performanceLoadAsyncEffects = pgTable(
359
- 'performance_load_async_effects',
360
- {
361
- createdAt: timestamp('created_at', { withTimezone: true })
362
- .defaultNow()
363
- .notNull(),
364
- effectId: text('effect_id').primaryKey(),
365
- expiresAt: timestamp('expires_at', { withTimezone: true }).notNull(),
366
- planDigest: text('plan_digest').notNull(),
367
- processedAt: timestamp('processed_at', { withTimezone: true }),
368
- runId: text('run_id').notNull(),
369
- },
370
- (table) => [
371
- index('performance_load_async_effects_expires_at_idx').on(
372
- table.expiresAt,
373
- ),
374
- index('performance_load_async_effects_pending_idx').on(
375
- table.processedAt,
376
- table.expiresAt,
377
- ),
378
- index('performance_load_async_effects_run_idx').on(
379
- table.planDigest,
380
- table.runId,
381
- ),
382
- ],
383
- );
384
-
385
- export const ebkInbox = pgTable(
386
- 'ebk_inbox',
387
- {
388
- attempts: integer('attempts').default(0).notNull(),
389
- completedAt: timestamp('completed_at', { withTimezone: true }),
390
- expiresAt: timestamp('expires_at', { withTimezone: true }).notNull(),
391
- firstSeenAt: timestamp('first_seen_at', { withTimezone: true }).defaultNow().notNull(),
392
- handlerId: text('handler_id').notNull(),
393
- handlerVersion: text('handler_version').notNull(),
394
- lastAttemptAt: timestamp('last_attempt_at', { withTimezone: true }).notNull(),
395
- messageId: text('message_id').notNull(),
396
- payloadDigest: text('payload_digest').notNull(),
397
- resultReference: text('result_reference'),
398
- status: text('status').notNull(),
399
- },
400
- (table) => [
401
- primaryKey({ columns: [table.handlerId, table.messageId] }),
402
- index('ebk_inbox_expires_at_idx').on(table.expiresAt),
403
- ],
404
- );
405
-
406
- export const dataLifecycleRetentionCandidates = pgTable(
407
- 'data_lifecycle_retention_candidates',
408
- {
409
- candidateOrder: text('candidate_order').notNull(),
410
- dueAt: timestamp('due_at', { withTimezone: true }).notNull(),
411
- recordId: uuid('record_id').notNull(),
412
- recordRef: text('record_ref').notNull(),
413
- runId: uuid('run_id').notNull(),
414
- },
415
- (table) => [
416
- primaryKey({ columns: [table.runId, table.candidateOrder] }),
417
- ],
418
- );
419
-
420
- export const dataLifecycleRetentionRuns = pgTable('data_lifecycle_retention_runs', {
421
- approvalRequestId: uuid('approval_request_id').unique(),
422
- asOf: timestamp('as_of', { withTimezone: true }).notNull(),
423
- checkpointJson: jsonb('checkpoint_json').notNull(),
424
- completedAt: timestamp('completed_at', { withTimezone: true }),
425
- countsJson: jsonb('counts_json').notNull(),
426
- expiresAt: timestamp('expires_at', { withTimezone: true }).notNull(),
427
- id: uuid('id').primaryKey(),
428
- planJson: jsonb('plan_json').notNull(),
429
- policyVersion: text('policy_version').notNull(),
430
- revision: integer('revision').notNull(),
431
- status: text('status').notNull(),
432
- updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
433
- });
434
-
435
- export const dataLifecycleReceipts = pgTable('data_lifecycle_receipts', {
436
- action: text('action').notNull(),
437
- occurredAt: timestamp('occurred_at', { withTimezone: true }).notNull(),
438
- policyVersion: text('policy_version').notNull(),
439
- pseudonymousKey: text('pseudonymous_key').notNull(),
440
- receivedAt: timestamp('received_at', { withTimezone: true }).defaultNow().notNull(),
441
- requestRef: text('request_ref').notNull(),
442
- sourceSlice: text('source_slice').notNull(),
443
- }, (table) => [
444
- primaryKey({
445
- columns: [
446
- table.sourceSlice,
447
- table.pseudonymousKey,
448
- table.action,
449
- table.requestRef,
450
- ],
451
- }),
452
- ]);
453
-
454
- export const dataLifecycleDownstreamCopies = pgTable(
455
- 'data_lifecycle_downstream_copies',
456
- {
457
- action: text('action').notNull(),
458
- copyId: text('copy_id').notNull(),
459
- expiresAt: timestamp('expires_at', { withTimezone: true }).notNull(),
460
- holdRefs: jsonb('hold_refs').notNull(),
461
- pseudonymousKey: text('pseudonymous_key').notNull(),
462
- purpose: text('purpose').notNull(),
463
- recipient: text('recipient').notNull(),
464
- sourceSlice: text('source_slice').notNull(),
465
- status: text('status').notNull(),
466
- updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
467
- },
468
- (table) => [
469
- primaryKey({
470
- columns: [table.sourceSlice, table.pseudonymousKey, table.copyId],
471
- }),
472
- ],
473
- );
474
102
  `,
475
- 'secrets/declarations.ts': `import { databaseCredentialSecretSchema } from '@empire-builder-kit/runtime/database';
103
+ 'secrets/declarations.ts': `${sql ? "import { databaseCredentialSecretSchema } from '@empire-builder-kit/runtime/database';\n" : ''}\
476
104
  import {
477
105
  defineSecrets,
478
106
  secret,
@@ -542,9 +170,10 @@ const SecretDefinitions = {
542
170
  source: 'generated',
543
171
  value: performanceLoadHmacKeys,
544
172
  },
545
- ${pascalName}PrimaryDatabaseCredential: {
173
+ ${sql
174
+ ? ` ${pascalName}PrimaryDatabaseCredential: {
546
175
  owner: '${name}',
547
- requiredStages: ['development', 'staging', 'production'],
176
+ requiredStages: ${JSON.stringify(databaseStages)},
548
177
  retention: { mode: 'retain' },
549
178
  rotation: {
550
179
  mode: 'manual',
@@ -553,6 +182,8 @@ const SecretDefinitions = {
553
182
  source: 'database-bootstrap',
554
183
  value: databaseCredentialSecretSchema,
555
184
  },
185
+ `
186
+ : ''}\
556
187
  } as const;
557
188
 
558
189
  export const Secrets: DefinedSecrets<typeof SecretDefinitions> =
@@ -569,14 +200,18 @@ export const Secrets: DefinedSecrets<typeof SecretDefinitions> =
569
200
  source: 'generated',
570
201
  valueKind: 'json',
571
202
  },
572
- {
573
- logicalName: `${pascalName}PrimaryDatabaseCredential`,
574
- owner: name,
575
- requiredStages: ['development', 'staging', 'production'],
576
- rotation: { mode: 'manual' },
577
- source: 'database-bootstrap',
578
- valueKind: 'json',
579
- },
203
+ ...(sql
204
+ ? [
205
+ {
206
+ logicalName: `${pascalName}PrimaryDatabaseCredential`,
207
+ owner: name,
208
+ requiredStages: databaseStages,
209
+ rotation: { mode: 'manual' },
210
+ source: 'database-bootstrap',
211
+ valueKind: 'json',
212
+ },
213
+ ]
214
+ : []),
580
215
  ],
581
216
  schemaVersion: 2,
582
217
  }),
@@ -734,243 +369,7 @@ metadata preflight and refuses before SST mutation when a required container,
734
369
  \`AWSCURRENT\`, ownership tag, or rotation policy is invalid. Remove, unlock,
735
370
  retirement, and recovery do not depend on this preflight.
736
371
  `,
737
- 'database/migrations/0000_initial.sql': `CREATE TABLE IF NOT EXISTS "records" (
738
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
739
- "name" text NOT NULL,
740
- "owner_id" text NOT NULL,
741
- "run_scope" text NOT NULL,
742
- "created_at" timestamptz NOT NULL DEFAULT now(),
743
- "last_activity_at" timestamptz NOT NULL DEFAULT now(),
744
- "test_expires_at" timestamptz
745
- );
746
- CREATE INDEX IF NOT EXISTS "records_performance_expiry_idx"
747
- ON "records" ("owner_id", "name", "test_expires_at");
748
- CREATE INDEX IF NOT EXISTS "records_performance_run_scope_idx"
749
- ON "records" ("owner_id", "name", "run_scope");
750
-
751
- CREATE TABLE IF NOT EXISTS "authorization_audit" (
752
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
753
- "action" text NOT NULL,
754
- "approval_reference" text,
755
- "authority_mode" text NOT NULL,
756
- "correlation_id" text NOT NULL,
757
- "decision" text NOT NULL,
758
- "policy_version" text NOT NULL,
759
- "principal_kind" text NOT NULL,
760
- "pseudonymous_subject_id" text NOT NULL,
761
- "reason_category" text NOT NULL,
762
- "delegation_reference" text,
763
- "resource_reference" text,
764
- "resource_type" text NOT NULL,
765
- "slice" text NOT NULL,
766
- "stage" text NOT NULL,
767
- "subject_type" text NOT NULL,
768
- "created_at" timestamptz NOT NULL DEFAULT now()
769
- );
770
-
771
- CREATE TABLE IF NOT EXISTS "delegation_grants" (
772
- "id" uuid PRIMARY KEY,
773
- "capability_digest" text NOT NULL,
774
- "created_at" timestamptz NOT NULL DEFAULT now(),
775
- "expires_at" timestamptz NOT NULL,
776
- "grant_json" jsonb NOT NULL,
777
- "issued_at" timestamptz NOT NULL,
778
- "policy_version" text NOT NULL,
779
- "revision" integer NOT NULL,
780
- "status" text NOT NULL
781
- );
782
-
783
- CREATE TABLE IF NOT EXISTS "approval_requests" (
784
- "id" uuid PRIMARY KEY,
785
- "author_reference" text NOT NULL,
786
- "created_at" timestamptz NOT NULL DEFAULT now(),
787
- "expires_at" timestamptz NOT NULL,
788
- "policy_version" text NOT NULL,
789
- "request_json" jsonb NOT NULL,
790
- "request_digest" text NOT NULL,
791
- "revision" integer NOT NULL,
792
- "status" text NOT NULL
793
- );
794
-
795
- CREATE TABLE IF NOT EXISTS "data_lifecycle_audit" (
796
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
797
- "action" text NOT NULL,
798
- "actor_ref" text NOT NULL,
799
- "approval_reference" text,
800
- "audit_json" jsonb NOT NULL,
801
- "authority_code" text NOT NULL,
802
- "correlation_ref" text NOT NULL,
803
- "expires_at" timestamptz NOT NULL,
804
- "outcome" text NOT NULL,
805
- "policy_version" text NOT NULL,
806
- "principal_kind" text NOT NULL,
807
- "purpose_code" text NOT NULL,
808
- "resource_reference" text,
809
- "slice" text NOT NULL,
810
- "stage" text NOT NULL,
811
- "subject_type" text NOT NULL,
812
- "target_category_id" text NOT NULL,
813
- "occurred_at" timestamptz NOT NULL
814
- );
815
-
816
- CREATE INDEX IF NOT EXISTS "data_lifecycle_audit_expires_at_idx"
817
- ON "data_lifecycle_audit" ("expires_at");
818
-
819
- CREATE OR REPLACE FUNCTION "ebk_prune_data_lifecycle_audit"(
820
- "cutoff" timestamptz,
821
- "batch_limit" integer
822
- ) RETURNS integer
823
- LANGUAGE plpgsql
824
- SECURITY DEFINER
825
- SET search_path = pg_catalog, public
826
- AS $$
827
- DECLARE
828
- deleted_count integer;
829
- effective_cutoff timestamptz;
830
- BEGIN
831
- IF batch_limit < 1 OR batch_limit > 1000 THEN
832
- RAISE EXCEPTION 'audit prune batch is outside the reviewed bound';
833
- END IF;
834
- effective_cutoff := LEAST(cutoff, clock_timestamp());
835
- WITH expired AS (
836
- SELECT ctid FROM public.data_lifecycle_audit
837
- WHERE expires_at <= effective_cutoff
838
- ORDER BY expires_at, id
839
- LIMIT batch_limit
840
- FOR UPDATE SKIP LOCKED
841
- )
842
- DELETE FROM public.data_lifecycle_audit
843
- WHERE ctid IN (SELECT ctid FROM expired);
844
- GET DIAGNOSTICS deleted_count = ROW_COUNT;
845
- RETURN deleted_count;
846
- END;
847
- $$;
848
-
849
- CREATE OR REPLACE FUNCTION "ebk_prune_authorization_audit"(
850
- "cutoff" timestamptz,
851
- "batch_limit" integer
852
- ) RETURNS integer
853
- LANGUAGE plpgsql
854
- SECURITY DEFINER
855
- SET search_path = pg_catalog, public
856
- AS $$
857
- DECLARE
858
- deleted_count integer;
859
- effective_cutoff timestamptz;
860
- BEGIN
861
- IF batch_limit < 1 OR batch_limit > 1000 THEN
862
- RAISE EXCEPTION 'audit prune batch is outside the reviewed bound';
863
- END IF;
864
- effective_cutoff := LEAST(cutoff, clock_timestamp());
865
- WITH expired AS (
866
- SELECT ctid FROM public.authorization_audit
867
- WHERE created_at <= effective_cutoff - INTERVAL '400 days'
868
- ORDER BY created_at, id
869
- LIMIT batch_limit
870
- FOR UPDATE SKIP LOCKED
871
- )
872
- DELETE FROM public.authorization_audit
873
- WHERE ctid IN (SELECT ctid FROM expired);
874
- GET DIAGNOSTICS deleted_count = ROW_COUNT;
875
- RETURN deleted_count;
876
- END;
877
- $$;
878
-
879
- REVOKE ALL ON FUNCTION "ebk_prune_data_lifecycle_audit"(
880
- timestamptz, integer
881
- ) FROM PUBLIC;
882
- REVOKE ALL ON FUNCTION "ebk_prune_authorization_audit"(
883
- timestamptz, integer
884
- ) FROM PUBLIC;
885
-
886
- CREATE TABLE IF NOT EXISTS "data_lifecycle_export_artifacts" (
887
- "approval_request_id" uuid PRIMARY KEY
888
- REFERENCES "approval_requests" ("id") ON DELETE CASCADE,
889
- "artifact_ref" text,
890
- "cleanup_deadline_at" timestamptz,
891
- "cleanup_state" text NOT NULL,
892
- "current_version_id" text,
893
- "expires_at" timestamptz,
894
- "last_error_code" text,
895
- "object_key" text NOT NULL,
896
- "record_ref" text NOT NULL,
897
- "subject_ref" text NOT NULL,
898
- "upload_started_at" timestamptz,
899
- "created_at" timestamptz NOT NULL DEFAULT now(),
900
- "updated_at" timestamptz NOT NULL DEFAULT now()
901
- );
902
-
903
- CREATE INDEX IF NOT EXISTS "data_lifecycle_export_artifacts_subject_created_idx"
904
- ON "data_lifecycle_export_artifacts" ("subject_ref", "created_at");
905
- CREATE INDEX IF NOT EXISTS "data_lifecycle_export_artifacts_cleanup_expiry_idx"
906
- ON "data_lifecycle_export_artifacts" ("cleanup_state", "expires_at");
907
- CREATE INDEX IF NOT EXISTS "data_lifecycle_export_artifacts_cleanup_deadline_idx"
908
- ON "data_lifecycle_export_artifacts" ("cleanup_state", "cleanup_deadline_at");
909
-
910
- CREATE TABLE IF NOT EXISTS "data_lifecycle_export_versions" (
911
- "approval_request_id" uuid NOT NULL
912
- REFERENCES "approval_requests" ("id") ON DELETE CASCADE,
913
- "version_id" text NOT NULL,
914
- "object_key" text NOT NULL,
915
- "is_delete_marker" boolean NOT NULL,
916
- "status" text NOT NULL,
917
- "deleted_at" timestamptz,
918
- PRIMARY KEY ("approval_request_id", "version_id")
919
- );
920
-
921
- CREATE TABLE IF NOT EXISTS "cleanup_deadline_reports" (
922
- "feature" text NOT NULL,
923
- "resource_ref" text NOT NULL,
924
- "deadline_at" timestamptz NOT NULL,
925
- "observed_at" timestamptz NOT NULL DEFAULT now(),
926
- PRIMARY KEY ("feature", "resource_ref")
927
- );
928
- CREATE INDEX IF NOT EXISTS "cleanup_deadline_reports_feature_observed_idx"
929
- ON "cleanup_deadline_reports" ("feature", "observed_at");
930
-
931
- CREATE TABLE IF NOT EXISTS "cleanup_deadline_report_capacity" (
932
- "feature" text PRIMARY KEY,
933
- "maximum_pending" integer NOT NULL
934
- );
935
- INSERT INTO "cleanup_deadline_report_capacity" ("feature", "maximum_pending")
936
- VALUES ('confidential-export', 1000)
937
- ON CONFLICT ("feature") DO NOTHING;
938
-
939
- CREATE INDEX IF NOT EXISTS "data_lifecycle_export_versions_status_idx"
940
- ON "data_lifecycle_export_versions" ("status");
941
-
942
- CREATE TABLE IF NOT EXISTS "data_lifecycle_ledger" (
943
- "entry_id" text PRIMARY KEY,
944
- "action" text NOT NULL,
945
- "category_id" text NOT NULL,
946
- "effective_at" timestamptz NOT NULL,
947
- "expires_at" timestamptz NOT NULL,
948
- "idempotency_key" text NOT NULL UNIQUE,
949
- "policy_version" text NOT NULL,
950
- "pseudonymous_key" text NOT NULL,
951
- "created_at" timestamptz NOT NULL DEFAULT now()
952
- );
953
-
954
- CREATE TABLE IF NOT EXISTS "data_lifecycle_requests" (
955
- "id" uuid PRIMARY KEY,
956
- "approval_request_id" uuid NOT NULL UNIQUE,
957
- "request_json" jsonb NOT NULL,
958
- "revision" integer NOT NULL,
959
- "status" text NOT NULL,
960
- "updated_at" timestamptz NOT NULL DEFAULT now()
961
- );
962
-
963
- CREATE TABLE IF NOT EXISTS "data_lifecycle_holds" (
964
- "hold_id" text PRIMARY KEY,
965
- "scope_ref" text NOT NULL,
966
- "category_id" text NOT NULL,
967
- "hold_json" jsonb NOT NULL,
968
- "status" text NOT NULL,
969
- "expires_at" timestamptz NOT NULL,
970
- "review_at" timestamptz NOT NULL
971
- );
972
-
973
- CREATE TABLE IF NOT EXISTS "data_lifecycle_outbox" (
372
+ 'database/migrations/0000_initial.sql': `CREATE TABLE IF NOT EXISTS "data_lifecycle_outbox" (
974
373
  "idempotency_key" text PRIMARY KEY,
975
374
  "event_json" jsonb NOT NULL,
976
375
  "published_at" timestamptz,
@@ -979,113 +378,6 @@ CREATE TABLE IF NOT EXISTS "data_lifecycle_outbox" (
979
378
  "expires_at" timestamptz NOT NULL,
980
379
  "created_at" timestamptz NOT NULL DEFAULT now()
981
380
  );
982
-
983
- CREATE TABLE IF NOT EXISTS "performance_load_runs" (
984
- "plan_digest" text PRIMARY KEY,
985
- "run_id" text NOT NULL,
986
- "adapter_id" text NOT NULL,
987
- "cleanup_started_at" timestamptz,
988
- "scenario_id" text NOT NULL,
989
- "stage" text NOT NULL,
990
- "source_commit" text NOT NULL,
991
- "release_material_digest" text NOT NULL,
992
- "maximum_requests" integer NOT NULL,
993
- "created_at" timestamptz NOT NULL,
994
- "expires_at" timestamptz NOT NULL
995
- );
996
- CREATE INDEX IF NOT EXISTS "performance_load_runs_expires_at_idx"
997
- ON "performance_load_runs" ("expires_at");
998
-
999
- CREATE TABLE IF NOT EXISTS "performance_load_requests" (
1000
- "plan_digest" text NOT NULL,
1001
- "request_ordinal" integer NOT NULL,
1002
- "effect_id" text,
1003
- "claimed_at" timestamptz NOT NULL DEFAULT now(),
1004
- PRIMARY KEY ("plan_digest", "request_ordinal")
1005
- );
1006
-
1007
- CREATE TABLE IF NOT EXISTS "performance_load_async_effects" (
1008
- "effect_id" text PRIMARY KEY,
1009
- "plan_digest" text NOT NULL,
1010
- "run_id" text NOT NULL,
1011
- "processed_at" timestamptz,
1012
- "expires_at" timestamptz NOT NULL,
1013
- "created_at" timestamptz NOT NULL DEFAULT now()
1014
- );
1015
- CREATE INDEX IF NOT EXISTS "performance_load_async_effects_expires_at_idx"
1016
- ON "performance_load_async_effects" USING btree ("expires_at");
1017
- CREATE INDEX "performance_load_async_effects_pending_idx"
1018
- ON "performance_load_async_effects" USING btree
1019
- ("processed_at", "expires_at");
1020
- CREATE INDEX IF NOT EXISTS "performance_load_async_effects_run_idx"
1021
- ON "performance_load_async_effects" USING btree
1022
- ("plan_digest", "run_id");
1023
-
1024
- CREATE TABLE IF NOT EXISTS "ebk_inbox" (
1025
- "handler_id" text NOT NULL,
1026
- "handler_version" text NOT NULL,
1027
- "message_id" text NOT NULL,
1028
- "payload_digest" text NOT NULL,
1029
- "status" text NOT NULL,
1030
- "attempts" integer NOT NULL DEFAULT 0,
1031
- "result_reference" text,
1032
- "first_seen_at" timestamptz NOT NULL DEFAULT now(),
1033
- "last_attempt_at" timestamptz NOT NULL,
1034
- "completed_at" timestamptz,
1035
- "expires_at" timestamptz NOT NULL,
1036
- PRIMARY KEY ("handler_id", "message_id")
1037
- );
1038
- CREATE INDEX "ebk_inbox_expires_at_idx"
1039
- ON "ebk_inbox" USING btree ("expires_at");
1040
-
1041
- CREATE TABLE IF NOT EXISTS "data_lifecycle_retention_runs" (
1042
- "id" uuid PRIMARY KEY,
1043
- "approval_request_id" uuid UNIQUE,
1044
- "as_of" timestamptz NOT NULL,
1045
- "checkpoint_json" jsonb NOT NULL,
1046
- "completed_at" timestamptz,
1047
- "counts_json" jsonb NOT NULL,
1048
- "expires_at" timestamptz NOT NULL,
1049
- "plan_json" jsonb NOT NULL,
1050
- "policy_version" text NOT NULL,
1051
- "revision" integer NOT NULL,
1052
- "status" text NOT NULL,
1053
- "updated_at" timestamptz NOT NULL DEFAULT now()
1054
- );
1055
-
1056
- CREATE TABLE IF NOT EXISTS "data_lifecycle_retention_candidates" (
1057
- "run_id" uuid NOT NULL,
1058
- "candidate_order" text NOT NULL,
1059
- "record_id" uuid NOT NULL,
1060
- "record_ref" text NOT NULL,
1061
- "due_at" timestamptz NOT NULL,
1062
- PRIMARY KEY ("run_id", "candidate_order")
1063
- );
1064
-
1065
- CREATE TABLE IF NOT EXISTS "data_lifecycle_receipts" (
1066
- "source_slice" text NOT NULL,
1067
- "pseudonymous_key" text NOT NULL,
1068
- "action" text NOT NULL,
1069
- "request_ref" text NOT NULL,
1070
- "policy_version" text NOT NULL,
1071
- "occurred_at" timestamptz NOT NULL,
1072
- "received_at" timestamptz NOT NULL DEFAULT now(),
1073
- PRIMARY KEY ("source_slice", "pseudonymous_key", "action", "request_ref")
1074
- );
1075
-
1076
- CREATE TABLE IF NOT EXISTS "data_lifecycle_downstream_copies" (
1077
- "source_slice" text NOT NULL,
1078
- "pseudonymous_key" text NOT NULL,
1079
- "copy_id" text NOT NULL,
1080
- "recipient" text NOT NULL,
1081
- "purpose" text NOT NULL,
1082
- "expires_at" timestamptz NOT NULL,
1083
- "action" text NOT NULL,
1084
- "hold_refs" jsonb NOT NULL,
1085
- "status" text NOT NULL,
1086
- "updated_at" timestamptz NOT NULL DEFAULT now(),
1087
- PRIMARY KEY ("source_slice", "pseudonymous_key", "copy_id")
1088
- );
1089
381
  `,
1090
382
  'database/migrations/meta/_journal.json': (0, built_in_plan_shared_js_1.json)({
1091
383
  dialect: 'postgresql',
@@ -1106,220 +398,6 @@ CREATE TABLE IF NOT EXISTS "data_lifecycle_downstream_copies" (
1106
398
  version: '7',
1107
399
  dialect: 'postgresql',
1108
400
  tables: {
1109
- 'public.approval_requests': snapshotTable('approval_requests', {
1110
- author_reference: snapshotColumn('author_reference', 'text'),
1111
- created_at: snapshotColumn('created_at', 'timestamp with time zone', {
1112
- default: 'now()',
1113
- }),
1114
- expires_at: snapshotColumn('expires_at', 'timestamp with time zone'),
1115
- id: snapshotColumn('id', 'uuid', { primaryKey: true }),
1116
- policy_version: snapshotColumn('policy_version', 'text'),
1117
- request_digest: snapshotColumn('request_digest', 'text'),
1118
- request_json: snapshotColumn('request_json', 'jsonb'),
1119
- revision: snapshotColumn('revision', 'integer'),
1120
- status: snapshotColumn('status', 'text'),
1121
- }),
1122
- 'public.authorization_audit': snapshotTable('authorization_audit', {
1123
- action: snapshotColumn('action', 'text'),
1124
- approval_reference: snapshotColumn('approval_reference', 'text', {
1125
- notNull: false,
1126
- }),
1127
- authority_mode: snapshotColumn('authority_mode', 'text'),
1128
- correlation_id: snapshotColumn('correlation_id', 'text'),
1129
- created_at: snapshotColumn('created_at', 'timestamp with time zone', {
1130
- default: 'now()',
1131
- }),
1132
- decision: snapshotColumn('decision', 'text'),
1133
- id: snapshotColumn('id', 'uuid', {
1134
- default: 'gen_random_uuid()',
1135
- primaryKey: true,
1136
- }),
1137
- policy_version: snapshotColumn('policy_version', 'text'),
1138
- principal_kind: snapshotColumn('principal_kind', 'text'),
1139
- pseudonymous_subject_id: snapshotColumn('pseudonymous_subject_id', 'text'),
1140
- reason_category: snapshotColumn('reason_category', 'text'),
1141
- delegation_reference: snapshotColumn('delegation_reference', 'text', {
1142
- notNull: false,
1143
- }),
1144
- resource_reference: snapshotColumn('resource_reference', 'text', {
1145
- notNull: false,
1146
- }),
1147
- resource_type: snapshotColumn('resource_type', 'text'),
1148
- slice: snapshotColumn('slice', 'text'),
1149
- stage: snapshotColumn('stage', 'text'),
1150
- subject_type: snapshotColumn('subject_type', 'text'),
1151
- }),
1152
- 'public.data_lifecycle_audit': snapshotTable('data_lifecycle_audit', {
1153
- action: snapshotColumn('action', 'text'),
1154
- actor_ref: snapshotColumn('actor_ref', 'text'),
1155
- approval_reference: snapshotColumn('approval_reference', 'text', {
1156
- notNull: false,
1157
- }),
1158
- audit_json: snapshotColumn('audit_json', 'jsonb'),
1159
- authority_code: snapshotColumn('authority_code', 'text'),
1160
- correlation_ref: snapshotColumn('correlation_ref', 'text'),
1161
- expires_at: snapshotColumn('expires_at', 'timestamp with time zone'),
1162
- id: snapshotColumn('id', 'uuid', {
1163
- default: 'gen_random_uuid()',
1164
- primaryKey: true,
1165
- }),
1166
- occurred_at: snapshotColumn('occurred_at', 'timestamp with time zone'),
1167
- outcome: snapshotColumn('outcome', 'text'),
1168
- policy_version: snapshotColumn('policy_version', 'text'),
1169
- principal_kind: snapshotColumn('principal_kind', 'text'),
1170
- purpose_code: snapshotColumn('purpose_code', 'text'),
1171
- resource_reference: snapshotColumn('resource_reference', 'text', {
1172
- notNull: false,
1173
- }),
1174
- slice: snapshotColumn('slice', 'text'),
1175
- stage: snapshotColumn('stage', 'text'),
1176
- subject_type: snapshotColumn('subject_type', 'text'),
1177
- target_category_id: snapshotColumn('target_category_id', 'text'),
1178
- }, {}, {}, {
1179
- data_lifecycle_audit_expires_at_idx: snapshotIndex('data_lifecycle_audit_expires_at_idx', [{ expression: 'expires_at', opclass: 'timestamptz_ops' }]),
1180
- }),
1181
- 'public.data_lifecycle_export_artifacts': snapshotTable('data_lifecycle_export_artifacts', {
1182
- approval_request_id: snapshotColumn('approval_request_id', 'uuid', {
1183
- primaryKey: true,
1184
- }),
1185
- artifact_ref: snapshotColumn('artifact_ref', 'text', {
1186
- notNull: false,
1187
- }),
1188
- cleanup_deadline_at: snapshotColumn('cleanup_deadline_at', 'timestamp with time zone', { notNull: false }),
1189
- cleanup_state: snapshotColumn('cleanup_state', 'text'),
1190
- created_at: snapshotColumn('created_at', 'timestamp with time zone', { default: 'now()' }),
1191
- current_version_id: snapshotColumn('current_version_id', 'text', {
1192
- notNull: false,
1193
- }),
1194
- expires_at: snapshotColumn('expires_at', 'timestamp with time zone', { notNull: false }),
1195
- last_error_code: snapshotColumn('last_error_code', 'text', {
1196
- notNull: false,
1197
- }),
1198
- object_key: snapshotColumn('object_key', 'text'),
1199
- record_ref: snapshotColumn('record_ref', 'text'),
1200
- subject_ref: snapshotColumn('subject_ref', 'text'),
1201
- updated_at: snapshotColumn('updated_at', 'timestamp with time zone', { default: 'now()' }),
1202
- upload_started_at: snapshotColumn('upload_started_at', 'timestamp with time zone', { notNull: false }),
1203
- }, {}, {}, {
1204
- data_lifecycle_export_artifacts_cleanup_deadline_idx: snapshotIndex('data_lifecycle_export_artifacts_cleanup_deadline_idx', [
1205
- { expression: 'cleanup_state', opclass: 'text_ops' },
1206
- {
1207
- expression: 'cleanup_deadline_at',
1208
- opclass: 'timestamptz_ops',
1209
- },
1210
- ]),
1211
- data_lifecycle_export_artifacts_cleanup_expiry_idx: snapshotIndex('data_lifecycle_export_artifacts_cleanup_expiry_idx', [
1212
- { expression: 'cleanup_state', opclass: 'text_ops' },
1213
- { expression: 'expires_at', opclass: 'timestamptz_ops' },
1214
- ]),
1215
- data_lifecycle_export_artifacts_subject_created_idx: snapshotIndex('data_lifecycle_export_artifacts_subject_created_idx', [
1216
- { expression: 'subject_ref', opclass: 'text_ops' },
1217
- { expression: 'created_at', opclass: 'timestamptz_ops' },
1218
- ]),
1219
- }, {
1220
- data_lifecycle_export_artifacts_approval_request_id_approval_requests_id_fk: {
1221
- columnsFrom: ['approval_request_id'],
1222
- columnsTo: ['id'],
1223
- name: 'data_lifecycle_export_artifacts_approval_request_id_approval_requests_id_fk',
1224
- onDelete: 'cascade',
1225
- onUpdate: 'no action',
1226
- tableFrom: 'data_lifecycle_export_artifacts',
1227
- tableTo: 'approval_requests',
1228
- },
1229
- }),
1230
- 'public.cleanup_deadline_report_capacity': snapshotTable('cleanup_deadline_report_capacity', {
1231
- feature: snapshotColumn('feature', 'text', { primaryKey: true }),
1232
- maximum_pending: snapshotColumn('maximum_pending', 'integer'),
1233
- }),
1234
- 'public.cleanup_deadline_reports': snapshotTable('cleanup_deadline_reports', {
1235
- deadline_at: snapshotColumn('deadline_at', 'timestamp with time zone'),
1236
- feature: snapshotColumn('feature', 'text'),
1237
- observed_at: snapshotColumn('observed_at', 'timestamp with time zone', { default: 'now()' }),
1238
- resource_ref: snapshotColumn('resource_ref', 'text'),
1239
- }, {}, {
1240
- cleanup_deadline_reports_feature_resource_ref_pk: {
1241
- columns: ['feature', 'resource_ref'],
1242
- name: 'cleanup_deadline_reports_feature_resource_ref_pk',
1243
- },
1244
- }, {
1245
- cleanup_deadline_reports_feature_observed_idx: snapshotIndex('cleanup_deadline_reports_feature_observed_idx', [
1246
- { expression: 'feature', opclass: 'text_ops' },
1247
- {
1248
- expression: 'observed_at',
1249
- opclass: 'timestamptz_ops',
1250
- },
1251
- ]),
1252
- }),
1253
- 'public.data_lifecycle_export_versions': snapshotTable('data_lifecycle_export_versions', {
1254
- approval_request_id: snapshotColumn('approval_request_id', 'uuid'),
1255
- deleted_at: snapshotColumn('deleted_at', 'timestamp with time zone', { notNull: false }),
1256
- is_delete_marker: snapshotColumn('is_delete_marker', 'boolean'),
1257
- object_key: snapshotColumn('object_key', 'text'),
1258
- status: snapshotColumn('status', 'text'),
1259
- version_id: snapshotColumn('version_id', 'text'),
1260
- }, {}, {
1261
- data_lifecycle_export_versions_approval_request_id_version_id_pk: {
1262
- columns: ['approval_request_id', 'version_id'],
1263
- name: 'data_lifecycle_export_versions_approval_request_id_version_id_pk',
1264
- },
1265
- }, {
1266
- data_lifecycle_export_versions_status_idx: snapshotIndex('data_lifecycle_export_versions_status_idx', [{ expression: 'status', opclass: 'text_ops' }]),
1267
- }, {
1268
- data_lifecycle_export_versions_approval_request_id_approval_requests_id_fk: {
1269
- columnsFrom: ['approval_request_id'],
1270
- columnsTo: ['id'],
1271
- name: 'data_lifecycle_export_versions_approval_request_id_approval_requests_id_fk',
1272
- onDelete: 'cascade',
1273
- onUpdate: 'no action',
1274
- tableFrom: 'data_lifecycle_export_versions',
1275
- tableTo: 'approval_requests',
1276
- },
1277
- }),
1278
- 'public.data_lifecycle_ledger': snapshotTable('data_lifecycle_ledger', {
1279
- action: snapshotColumn('action', 'text'),
1280
- category_id: snapshotColumn('category_id', 'text'),
1281
- created_at: snapshotColumn('created_at', 'timestamp with time zone', { default: 'now()' }),
1282
- effective_at: snapshotColumn('effective_at', 'timestamp with time zone'),
1283
- entry_id: snapshotColumn('entry_id', 'text', {
1284
- primaryKey: true,
1285
- }),
1286
- expires_at: snapshotColumn('expires_at', 'timestamp with time zone'),
1287
- idempotency_key: snapshotColumn('idempotency_key', 'text'),
1288
- policy_version: snapshotColumn('policy_version', 'text'),
1289
- pseudonymous_key: snapshotColumn('pseudonymous_key', 'text'),
1290
- }, {
1291
- data_lifecycle_ledger_idempotency_key_unique: {
1292
- columns: ['idempotency_key'],
1293
- name: 'data_lifecycle_ledger_idempotency_key_unique',
1294
- nullsNotDistinct: false,
1295
- },
1296
- }),
1297
- 'public.data_lifecycle_downstream_copies': snapshotTable('data_lifecycle_downstream_copies', {
1298
- action: snapshotColumn('action', 'text'),
1299
- copy_id: snapshotColumn('copy_id', 'text'),
1300
- expires_at: snapshotColumn('expires_at', 'timestamp with time zone'),
1301
- hold_refs: snapshotColumn('hold_refs', 'jsonb'),
1302
- pseudonymous_key: snapshotColumn('pseudonymous_key', 'text'),
1303
- purpose: snapshotColumn('purpose', 'text'),
1304
- recipient: snapshotColumn('recipient', 'text'),
1305
- source_slice: snapshotColumn('source_slice', 'text'),
1306
- status: snapshotColumn('status', 'text'),
1307
- updated_at: snapshotColumn('updated_at', 'timestamp with time zone', { default: 'now()' }),
1308
- }, {}, {
1309
- data_lifecycle_downstream_copies_source_slice_pseudonymous_key_copy_id_pk: {
1310
- columns: ['source_slice', 'pseudonymous_key', 'copy_id'],
1311
- name: 'data_lifecycle_downstream_copies_source_slice_pseudonymous_key_copy_id_pk',
1312
- },
1313
- }),
1314
- 'public.data_lifecycle_holds': snapshotTable('data_lifecycle_holds', {
1315
- category_id: snapshotColumn('category_id', 'text'),
1316
- expires_at: snapshotColumn('expires_at', 'timestamp with time zone'),
1317
- hold_id: snapshotColumn('hold_id', 'text', { primaryKey: true }),
1318
- hold_json: snapshotColumn('hold_json', 'jsonb'),
1319
- review_at: snapshotColumn('review_at', 'timestamp with time zone'),
1320
- scope_ref: snapshotColumn('scope_ref', 'text'),
1321
- status: snapshotColumn('status', 'text'),
1322
- }),
1323
401
  'public.data_lifecycle_outbox': snapshotTable('data_lifecycle_outbox', {
1324
402
  attempts: snapshotColumn('attempts', 'integer', { default: 0 }),
1325
403
  created_at: snapshotColumn('created_at', 'timestamp with time zone', {
@@ -1335,213 +413,6 @@ CREATE TABLE IF NOT EXISTS "data_lifecycle_downstream_copies" (
1335
413
  }),
1336
414
  published_at: snapshotColumn('published_at', 'timestamp with time zone', { notNull: false }),
1337
415
  }),
1338
- 'public.performance_load_runs': snapshotTable('performance_load_runs', {
1339
- adapter_id: snapshotColumn('adapter_id', 'text'),
1340
- cleanup_started_at: snapshotColumn('cleanup_started_at', 'timestamp with time zone', { notNull: false }),
1341
- created_at: snapshotColumn('created_at', 'timestamp with time zone'),
1342
- expires_at: snapshotColumn('expires_at', 'timestamp with time zone'),
1343
- maximum_requests: snapshotColumn('maximum_requests', 'integer'),
1344
- plan_digest: snapshotColumn('plan_digest', 'text', {
1345
- primaryKey: true,
1346
- }),
1347
- release_material_digest: snapshotColumn('release_material_digest', 'text'),
1348
- run_id: snapshotColumn('run_id', 'text'),
1349
- scenario_id: snapshotColumn('scenario_id', 'text'),
1350
- source_commit: snapshotColumn('source_commit', 'text'),
1351
- stage: snapshotColumn('stage', 'text'),
1352
- }, {}, {}, {
1353
- performance_load_runs_expires_at_idx: snapshotIndex('performance_load_runs_expires_at_idx', [
1354
- {
1355
- expression: 'expires_at',
1356
- opclass: 'timestamptz_ops',
1357
- },
1358
- ]),
1359
- }),
1360
- 'public.performance_load_requests': snapshotTable('performance_load_requests', {
1361
- claimed_at: snapshotColumn('claimed_at', 'timestamp with time zone', { default: 'now()' }),
1362
- effect_id: snapshotColumn('effect_id', 'text', {
1363
- notNull: false,
1364
- }),
1365
- plan_digest: snapshotColumn('plan_digest', 'text'),
1366
- request_ordinal: snapshotColumn('request_ordinal', 'integer'),
1367
- }, {}, {
1368
- performance_load_requests_plan_digest_request_ordinal_pk: {
1369
- columns: ['plan_digest', 'request_ordinal'],
1370
- name: 'performance_load_requests_plan_digest_request_ordinal_pk',
1371
- },
1372
- }),
1373
- 'public.performance_load_async_effects': snapshotTable('performance_load_async_effects', {
1374
- created_at: snapshotColumn('created_at', 'timestamp with time zone', { default: 'now()' }),
1375
- effect_id: snapshotColumn('effect_id', 'text', {
1376
- primaryKey: true,
1377
- }),
1378
- expires_at: snapshotColumn('expires_at', 'timestamp with time zone'),
1379
- plan_digest: snapshotColumn('plan_digest', 'text'),
1380
- processed_at: snapshotColumn('processed_at', 'timestamp with time zone', { notNull: false }),
1381
- run_id: snapshotColumn('run_id', 'text'),
1382
- }, {}, {}, {
1383
- performance_load_async_effects_expires_at_idx: snapshotIndex('performance_load_async_effects_expires_at_idx', [
1384
- {
1385
- expression: 'expires_at',
1386
- opclass: 'timestamptz_ops',
1387
- },
1388
- ]),
1389
- performance_load_async_effects_pending_idx: snapshotIndex('performance_load_async_effects_pending_idx', [
1390
- {
1391
- expression: 'processed_at',
1392
- opclass: 'timestamptz_ops',
1393
- },
1394
- {
1395
- expression: 'expires_at',
1396
- opclass: 'timestamptz_ops',
1397
- },
1398
- ]),
1399
- performance_load_async_effects_run_idx: snapshotIndex('performance_load_async_effects_run_idx', [
1400
- {
1401
- expression: 'plan_digest',
1402
- opclass: 'text_ops',
1403
- },
1404
- {
1405
- expression: 'run_id',
1406
- opclass: 'text_ops',
1407
- },
1408
- ]),
1409
- }),
1410
- 'public.ebk_inbox': snapshotTable('ebk_inbox', {
1411
- attempts: snapshotColumn('attempts', 'integer', { default: 0 }),
1412
- completed_at: snapshotColumn('completed_at', 'timestamp with time zone', { notNull: false }),
1413
- expires_at: snapshotColumn('expires_at', 'timestamp with time zone'),
1414
- first_seen_at: snapshotColumn('first_seen_at', 'timestamp with time zone', { default: 'now()' }),
1415
- handler_id: snapshotColumn('handler_id', 'text'),
1416
- handler_version: snapshotColumn('handler_version', 'text'),
1417
- last_attempt_at: snapshotColumn('last_attempt_at', 'timestamp with time zone'),
1418
- message_id: snapshotColumn('message_id', 'text'),
1419
- payload_digest: snapshotColumn('payload_digest', 'text'),
1420
- result_reference: snapshotColumn('result_reference', 'text', {
1421
- notNull: false,
1422
- }),
1423
- status: snapshotColumn('status', 'text'),
1424
- }, {}, {
1425
- ebk_inbox_handler_id_message_id_pk: {
1426
- columns: ['handler_id', 'message_id'],
1427
- name: 'ebk_inbox_handler_id_message_id_pk',
1428
- },
1429
- }, {
1430
- ebk_inbox_expires_at_idx: snapshotIndex('ebk_inbox_expires_at_idx', [
1431
- {
1432
- expression: 'expires_at',
1433
- opclass: 'timestamptz_ops',
1434
- },
1435
- ]),
1436
- }),
1437
- 'public.data_lifecycle_requests': snapshotTable('data_lifecycle_requests', {
1438
- approval_request_id: snapshotColumn('approval_request_id', 'uuid'),
1439
- id: snapshotColumn('id', 'uuid', { primaryKey: true }),
1440
- request_json: snapshotColumn('request_json', 'jsonb'),
1441
- revision: snapshotColumn('revision', 'integer'),
1442
- status: snapshotColumn('status', 'text'),
1443
- updated_at: snapshotColumn('updated_at', 'timestamp with time zone', { default: 'now()' }),
1444
- }, {
1445
- data_lifecycle_requests_approval_request_id_unique: {
1446
- columns: ['approval_request_id'],
1447
- name: 'data_lifecycle_requests_approval_request_id_unique',
1448
- nullsNotDistinct: false,
1449
- },
1450
- }),
1451
- 'public.data_lifecycle_receipts': snapshotTable('data_lifecycle_receipts', {
1452
- action: snapshotColumn('action', 'text'),
1453
- occurred_at: snapshotColumn('occurred_at', 'timestamp with time zone'),
1454
- policy_version: snapshotColumn('policy_version', 'text'),
1455
- pseudonymous_key: snapshotColumn('pseudonymous_key', 'text'),
1456
- received_at: snapshotColumn('received_at', 'timestamp with time zone', { default: 'now()' }),
1457
- request_ref: snapshotColumn('request_ref', 'text'),
1458
- source_slice: snapshotColumn('source_slice', 'text'),
1459
- }, {}, {
1460
- data_lifecycle_receipts_source_slice_pseudonymous_key_action_request_ref_pk: {
1461
- columns: [
1462
- 'source_slice',
1463
- 'pseudonymous_key',
1464
- 'action',
1465
- 'request_ref',
1466
- ],
1467
- name: 'data_lifecycle_receipts_source_slice_pseudonymous_key_action_request_ref_pk',
1468
- },
1469
- }),
1470
- 'public.data_lifecycle_retention_runs': snapshotTable('data_lifecycle_retention_runs', {
1471
- approval_request_id: snapshotColumn('approval_request_id', 'uuid', {
1472
- notNull: false,
1473
- }),
1474
- as_of: snapshotColumn('as_of', 'timestamp with time zone'),
1475
- checkpoint_json: snapshotColumn('checkpoint_json', 'jsonb'),
1476
- completed_at: snapshotColumn('completed_at', 'timestamp with time zone', { notNull: false }),
1477
- counts_json: snapshotColumn('counts_json', 'jsonb'),
1478
- expires_at: snapshotColumn('expires_at', 'timestamp with time zone'),
1479
- id: snapshotColumn('id', 'uuid', { primaryKey: true }),
1480
- plan_json: snapshotColumn('plan_json', 'jsonb'),
1481
- policy_version: snapshotColumn('policy_version', 'text'),
1482
- revision: snapshotColumn('revision', 'integer'),
1483
- status: snapshotColumn('status', 'text'),
1484
- updated_at: snapshotColumn('updated_at', 'timestamp with time zone', { default: 'now()' }),
1485
- }, {
1486
- data_lifecycle_retention_runs_approval_request_id_unique: {
1487
- columns: ['approval_request_id'],
1488
- name: 'data_lifecycle_retention_runs_approval_request_id_unique',
1489
- nullsNotDistinct: false,
1490
- },
1491
- }),
1492
- 'public.data_lifecycle_retention_candidates': snapshotTable('data_lifecycle_retention_candidates', {
1493
- candidate_order: snapshotColumn('candidate_order', 'text'),
1494
- due_at: snapshotColumn('due_at', 'timestamp with time zone'),
1495
- record_id: snapshotColumn('record_id', 'uuid'),
1496
- record_ref: snapshotColumn('record_ref', 'text'),
1497
- run_id: snapshotColumn('run_id', 'uuid'),
1498
- }, {}, {
1499
- data_lifecycle_retention_candidates_run_id_candidate_order_pk: {
1500
- columns: ['run_id', 'candidate_order'],
1501
- name: 'data_lifecycle_retention_candidates_run_id_candidate_order_pk',
1502
- },
1503
- }),
1504
- 'public.delegation_grants': snapshotTable('delegation_grants', {
1505
- capability_digest: snapshotColumn('capability_digest', 'text'),
1506
- created_at: snapshotColumn('created_at', 'timestamp with time zone', {
1507
- default: 'now()',
1508
- }),
1509
- expires_at: snapshotColumn('expires_at', 'timestamp with time zone'),
1510
- grant_json: snapshotColumn('grant_json', 'jsonb'),
1511
- id: snapshotColumn('id', 'uuid', { primaryKey: true }),
1512
- issued_at: snapshotColumn('issued_at', 'timestamp with time zone'),
1513
- policy_version: snapshotColumn('policy_version', 'text'),
1514
- revision: snapshotColumn('revision', 'integer'),
1515
- status: snapshotColumn('status', 'text'),
1516
- }),
1517
- 'public.records': snapshotTable('records', {
1518
- created_at: snapshotColumn('created_at', 'timestamp with time zone', {
1519
- default: 'now()',
1520
- }),
1521
- id: snapshotColumn('id', 'uuid', {
1522
- default: 'gen_random_uuid()',
1523
- primaryKey: true,
1524
- }),
1525
- last_activity_at: snapshotColumn('last_activity_at', 'timestamp with time zone', { default: 'now()' }),
1526
- name: snapshotColumn('name', 'text'),
1527
- owner_id: snapshotColumn('owner_id', 'text'),
1528
- run_scope: snapshotColumn('run_scope', 'text'),
1529
- test_expires_at: snapshotColumn('test_expires_at', 'timestamp with time zone', { notNull: false }),
1530
- }, {}, {}, {
1531
- records_performance_expiry_idx: snapshotIndex('records_performance_expiry_idx', [
1532
- { expression: 'owner_id', opclass: 'text_ops' },
1533
- { expression: 'name', opclass: 'text_ops' },
1534
- {
1535
- expression: 'test_expires_at',
1536
- opclass: 'timestamptz_ops',
1537
- },
1538
- ]),
1539
- records_performance_run_scope_idx: snapshotIndex('records_performance_run_scope_idx', [
1540
- { expression: 'owner_id', opclass: 'text_ops' },
1541
- { expression: 'name', opclass: 'text_ops' },
1542
- { expression: 'run_scope', opclass: 'text_ops' },
1543
- ]),
1544
- }),
1545
416
  },
1546
417
  enums: {},
1547
418
  schemas: {},
@@ -1561,15 +432,20 @@ const plan = createDatabaseBindingPlan(databaseBindings, {
1561
432
  });
1562
433
  const activeDatabase = plan.active.primary;
1563
434
  if (!activeDatabase) throw new Error('Database binding "primary" is required.');
1564
- const localDatabase = resolveLocalDatabaseContract({
435
+ // Schema-only commands stay offline; connection commands require the owned allocation.
436
+ const schemaOnly = process.argv[2] === 'generate' || process.argv[2] === 'check';
437
+ const localDatabase = schemaOnly || process.env.DATABASE_URL ? undefined : resolveLocalDatabaseContract({
1565
438
  database: activeDatabase,
1566
439
  slice: '${name}',
1567
440
  });
441
+ const databaseUrl = process.env.DATABASE_URL ?? (localDatabase
442
+ ? \`postgresql://\${encodeURIComponent(localDatabase.username)}:\${encodeURIComponent(localDatabase.password)}@\${localDatabase.host}:\${localDatabase.port}/\${localDatabase.database}\`
443
+ : undefined);
1568
444
 
1569
445
  export default defineConfig({
1570
- dbCredentials: {
1571
- url: process.env.DATABASE_URL ?? \`postgresql://\${localDatabase.username}:\${localDatabase.password}@\${localDatabase.host}:\${localDatabase.port}/\${localDatabase.database}\`,
1572
- },
446
+ ...(!schemaOnly && databaseUrl ? {
447
+ dbCredentials: { url: databaseUrl },
448
+ } : {}),
1573
449
  dialect: 'postgresql',
1574
450
  out: './database/migrations',
1575
451
  schema: './database/schema.ts',
@@ -1578,6 +454,11 @@ export default defineConfig({
1578
454
  'database/docker-compose.yml': `services:
1579
455
  database:
1580
456
  image: postgres:17-alpine
457
+ container_name: \${EBK_LOCAL_DATABASE_PROJECT}-database
458
+ labels:
459
+ dev.ebk.task: \${EBK_LOCAL_DATABASE_TASK}
460
+ dev.ebk.slice: \${EBK_LOCAL_DATABASE_SLICE}
461
+ dev.ebk.database: \${EBK_LOCAL_DATABASE_LOGICAL}
1581
462
  environment:
1582
463
  POSTGRES_DB: \${EBK_LOCAL_DATABASE}
1583
464
  POSTGRES_PASSWORD: \${EBK_LOCAL_DATABASE_PASSWORD}
@@ -1588,13 +469,29 @@ export default defineConfig({
1588
469
  timeout: 3s
1589
470
  retries: 15
1590
471
  ports:
1591
- - '\${EBK_LOCAL_DATABASE_PORT}:5432'
472
+ - '127.0.0.1:\${EBK_LOCAL_DATABASE_PORT}:5432'
1592
473
  volumes:
1593
474
  - database-data:/var/lib/postgresql/data
1594
475
 
1595
476
  volumes:
1596
477
  database-data:
478
+ name: \${EBK_LOCAL_DATABASE_PROJECT}-data
479
+ labels:
480
+ dev.ebk.task: \${EBK_LOCAL_DATABASE_TASK}
481
+ dev.ebk.slice: \${EBK_LOCAL_DATABASE_SLICE}
482
+ dev.ebk.database: \${EBK_LOCAL_DATABASE_LOGICAL}
483
+
484
+ networks:
485
+ default:
486
+ name: \${EBK_LOCAL_DATABASE_PROJECT}-network
487
+ labels:
488
+ dev.ebk.task: \${EBK_LOCAL_DATABASE_TASK}
489
+ dev.ebk.slice: \${EBK_LOCAL_DATABASE_SLICE}
490
+ dev.ebk.database: \${EBK_LOCAL_DATABASE_LOGICAL}
1597
491
  `,
1598
492
  };
493
+ return Object.fromEntries(Object.entries(files).filter(([path]) => sql ||
494
+ (!path.startsWith('database/') &&
495
+ path !== 'docs/runbooks/database-credential-rotation.md')));
1599
496
  }
1600
497
  //# sourceMappingURL=built-in-plan-data-files.js.map