@empire-builder-kit/nx 1.0.0-rc.46 → 1.0.0-rc.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (780) hide show
  1. package/README.md +14 -169
  2. package/executors.json +24 -79
  3. package/generators.json +18 -18
  4. package/package.json +13 -71
  5. package/src/aws/identity.d.ts +1 -1
  6. package/src/aws-authority/boundary-transforms.d.ts +9 -0
  7. package/src/aws-authority/boundary-transforms.js +78 -0
  8. package/src/aws-authority/contracts.d.ts +116 -0
  9. package/src/aws-authority/contracts.js +40 -0
  10. package/src/aws-authority/deployment-guardrails.d.ts +4 -0
  11. package/src/aws-authority/deployment-guardrails.js +543 -0
  12. package/src/aws-authority/deployment-policy-groups.d.ts +3 -0
  13. package/src/aws-authority/deployment-policy-groups.js +299 -0
  14. package/src/aws-authority/deployment-resources.d.ts +64 -0
  15. package/src/aws-authority/deployment-resources.js +265 -0
  16. package/src/aws-authority/deployment-services.d.ts +3 -0
  17. package/src/aws-authority/deployment-services.js +717 -0
  18. package/src/aws-authority/development-authority.d.ts +11 -0
  19. package/src/aws-authority/development-authority.js +160 -0
  20. package/src/aws-authority/guardrail-actions.d.ts +87 -0
  21. package/src/aws-authority/guardrail-actions.js +463 -0
  22. package/src/aws-authority/policy-document.d.ts +15 -0
  23. package/src/aws-authority/policy-document.js +264 -0
  24. package/src/aws-authority/runtime-boundary.d.ts +7 -0
  25. package/src/aws-authority/runtime-boundary.js +211 -0
  26. package/src/aws-authority/service-actions.d.ts +96 -0
  27. package/src/aws-authority/service-actions.js +512 -0
  28. package/src/aws-authority/stage-authority.d.ts +6 -244
  29. package/src/aws-authority/stage-authority.js +114 -3419
  30. package/src/aws-authority/stage-identity.d.ts +6 -0
  31. package/src/aws-authority/stage-identity.js +134 -0
  32. package/src/cli/bootstrap.d.ts +0 -20
  33. package/src/cli/bootstrap.js +2 -153
  34. package/src/cli/dev-command.d.ts +2 -4
  35. package/src/cli/dev-command.js +1 -19
  36. package/src/cli/main.d.ts +0 -4
  37. package/src/cli/main.js +22 -80
  38. package/src/cli/output.d.ts +2 -4
  39. package/src/cli/output.js +2 -8
  40. package/src/executors/deployment-plan/deployment-plan.d.ts +0 -2
  41. package/src/executors/deployment-plan/deployment-plan.js +5 -67
  42. package/src/executors/dev-doctor/dev-doctor.d.ts +25 -3
  43. package/src/executors/dev-doctor/dev-doctor.js +137 -50
  44. package/src/executors/dev-setup/dev-setup.d.ts +18 -1
  45. package/src/executors/dev-setup/dev-setup.js +320 -196
  46. package/src/executors/foundation-preflight/foundation-preflight.js +9 -1
  47. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +2 -2
  48. package/src/executors/local-deploy/deployed-smoke.d.ts +12 -0
  49. package/src/executors/local-deploy/deployed-smoke.js +115 -0
  50. package/src/executors/local-deploy/deployment-authority.d.ts +24 -0
  51. package/src/executors/local-deploy/deployment-authority.js +81 -0
  52. package/src/executors/local-deploy/deployment-child.d.ts +18 -0
  53. package/src/executors/local-deploy/deployment-child.js +77 -0
  54. package/src/executors/local-deploy/deployment-contracts.d.ts +96 -0
  55. package/src/executors/local-deploy/deployment-contracts.js +3 -0
  56. package/src/executors/local-deploy/deployment-projects.d.ts +4 -0
  57. package/src/executors/local-deploy/deployment-projects.js +16 -0
  58. package/src/executors/local-deploy/deployment-receipt.d.ts +4 -0
  59. package/src/executors/local-deploy/deployment-receipt.js +55 -0
  60. package/src/executors/local-deploy/deployment-scope.d.ts +17 -0
  61. package/src/executors/local-deploy/deployment-scope.js +239 -0
  62. package/src/executors/local-deploy/deployment-source.d.ts +13 -0
  63. package/src/executors/local-deploy/deployment-source.js +86 -0
  64. package/src/executors/local-deploy/local-deploy.d.ts +5 -106
  65. package/src/executors/local-deploy/local-deploy.js +56 -855
  66. package/src/executors/sst-lifecycle/governed-child-process.d.ts +27 -0
  67. package/src/executors/sst-lifecycle/governed-child-process.js +277 -0
  68. package/src/executors/sst-lifecycle/governed-native-operation.js +4 -10
  69. package/src/executors/sst-lifecycle/run-sst-command.d.ts +4 -85
  70. package/src/executors/sst-lifecycle/run-sst-command.js +28 -788
  71. package/src/executors/sst-lifecycle/sst-contracts.d.ts +44 -0
  72. package/src/executors/sst-lifecycle/sst-contracts.js +3 -0
  73. package/src/executors/sst-lifecycle/sst-invocation.d.ts +17 -0
  74. package/src/executors/sst-lifecycle/sst-invocation.js +502 -0
  75. package/src/executors/sst-lifecycle/task-unlock.js +3 -3
  76. package/src/foundation/discovery.d.ts +1 -5
  77. package/src/foundation/discovery.js +0 -2
  78. package/src/foundation/identity-domain-parent-ready.d.ts +91 -0
  79. package/src/foundation/identity-domain-parent-ready.js +333 -0
  80. package/src/foundation/identity-domain.d.ts +94 -0
  81. package/src/foundation/identity-domain.js +115 -0
  82. package/src/foundation/index.d.ts +2 -2
  83. package/src/foundation/index.js +7 -9
  84. package/src/foundation/local-private-smoke-access.d.ts +6 -15
  85. package/src/foundation/local-private-smoke-access.js +8 -192
  86. package/src/foundation/observability.d.ts +16 -26
  87. package/src/foundation/observability.js +34 -135
  88. package/src/foundation/preflight.js +16 -14
  89. package/src/foundation/private-smoke-access.d.ts +7 -14
  90. package/src/foundation/private-smoke-access.js +4 -126
  91. package/src/foundation/root-site-workspace.d.ts +35 -0
  92. package/src/foundation/root-site-workspace.js +80 -0
  93. package/src/foundation/root-site.d.ts +82 -0
  94. package/src/foundation/root-site.js +276 -0
  95. package/src/generators/formatting.js +5 -4
  96. package/src/generators/framework-prerequisites.d.ts +2 -0
  97. package/src/generators/framework-prerequisites.js +34 -0
  98. package/src/generators/function/function.d.ts +20 -1
  99. package/src/generators/function/function.js +143 -90
  100. package/src/generators/function/schema.d.ts +1 -0
  101. package/src/generators/function/schema.json +8 -2
  102. package/src/generators/function-access/function-access.d.ts +8 -0
  103. package/src/generators/function-access/function-access.js +73 -0
  104. package/src/generators/function-access/schema.d.ts +6 -0
  105. package/src/generators/function-access/schema.json +25 -0
  106. package/src/generators/observability-policy.js +1 -2
  107. package/src/{supply-chain → generators}/pnpm-toolchain-authority.d.ts +3 -3
  108. package/src/{supply-chain → generators}/pnpm-toolchain-authority.js +12 -12
  109. package/src/generators/post-generation-install.d.ts +2 -9
  110. package/src/generators/post-generation-install.js +12 -140
  111. package/src/generators/preset/dependency-overrides.d.ts +14 -20
  112. package/src/generators/preset/dependency-overrides.js +13 -57
  113. package/src/generators/preset/generator.js +0 -3
  114. package/src/generators/preset/workspace-files-foundation-infra.d.ts +6 -0
  115. package/src/generators/preset/workspace-files-foundation-infra.js +586 -0
  116. package/src/generators/preset/workspace-files-foundation-readme.d.ts +5 -0
  117. package/src/generators/preset/workspace-files-foundation-readme.js +90 -0
  118. package/src/generators/preset/workspace-files-foundation.d.ts +3 -0
  119. package/src/generators/preset/workspace-files-foundation.js +170 -0
  120. package/src/generators/preset/workspace-files-ownership.d.ts +9 -0
  121. package/src/generators/preset/workspace-files-ownership.js +124 -0
  122. package/src/generators/preset/workspace-files-root-config.d.ts +32 -0
  123. package/src/generators/preset/workspace-files-root-config.js +356 -0
  124. package/src/generators/preset/workspace-files-root-docs.d.ts +5 -0
  125. package/src/generators/preset/workspace-files-root-docs.js +109 -0
  126. package/src/generators/preset/workspace-files-shared.d.ts +18 -0
  127. package/src/generators/preset/workspace-files-shared.js +7 -0
  128. package/src/generators/preset/workspace-files-workflows.d.ts +39 -0
  129. package/src/generators/preset/workspace-files-workflows.js +306 -0
  130. package/src/generators/preset/workspace-files-workspace-health.d.ts +6 -0
  131. package/src/generators/preset/workspace-files-workspace-health.js +148 -0
  132. package/src/generators/preset/workspace-files.d.ts +10 -24
  133. package/src/generators/preset/workspace-files.js +48 -10511
  134. package/src/generators/site/built-in-site-documentation-files.d.ts +3 -0
  135. package/src/generators/site/built-in-site-documentation-files.js +51 -0
  136. package/src/generators/site/built-in-site-files.d.ts +11 -0
  137. package/src/generators/site/built-in-site-files.js +41 -0
  138. package/src/generators/site/built-in-site-infrastructure-files.d.ts +3 -0
  139. package/src/generators/site/built-in-site-infrastructure-files.js +115 -0
  140. package/src/generators/site/built-in-site-plan.d.ts +23 -0
  141. package/src/generators/site/built-in-site-plan.js +67 -0
  142. package/src/generators/site/built-in-site-project-files.d.ts +11 -0
  143. package/src/generators/site/built-in-site-project-files.js +212 -0
  144. package/src/generators/site/built-in-site-script-files.d.ts +4 -0
  145. package/src/generators/site/built-in-site-script-files.js +102 -0
  146. package/src/generators/site/built-in-site-shared.d.ts +69 -0
  147. package/src/generators/site/built-in-site-shared.js +314 -0
  148. package/src/generators/site/built-in-site-sst-config-files.d.ts +3 -0
  149. package/src/generators/site/built-in-site-sst-config-files.js +107 -0
  150. package/src/generators/site/built-in-site-web-files.d.ts +3 -0
  151. package/src/generators/site/built-in-site-web-files.js +78 -0
  152. package/src/generators/site/schema.d.ts +9 -0
  153. package/src/generators/site/schema.json +26 -0
  154. package/src/generators/site/site.d.ts +5 -0
  155. package/src/generators/site/site.js +153 -0
  156. package/src/generators/slice/built-in-plan-api-files.d.ts +1 -2
  157. package/src/generators/slice/built-in-plan-api-files.js +30 -890
  158. package/src/generators/slice/built-in-plan-database-lifecycle-files.js +57 -1851
  159. package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +5 -2
  160. package/src/generators/slice/built-in-plan-infrastructure-files.js +80 -3358
  161. package/src/generators/slice/built-in-plan-key-value-files.d.ts +3 -2
  162. package/src/generators/slice/built-in-plan-key-value-files.js +3 -21
  163. package/src/generators/slice/built-in-plan-project-files.d.ts +5 -3
  164. package/src/generators/slice/built-in-plan-project-files.js +79 -897
  165. package/src/generators/slice/built-in-plan-shared.d.ts +4 -19
  166. package/src/generators/slice/built-in-plan-shared.js +5 -58
  167. package/src/generators/slice/built-in-plan-sst-config.d.ts +49 -0
  168. package/src/generators/slice/built-in-plan-sst-config.js +160 -0
  169. package/src/generators/slice/built-in-plan-web-files.d.ts +1 -1
  170. package/src/generators/slice/built-in-plan-web-files.js +14 -475
  171. package/src/generators/slice/built-in-plan.d.ts +2 -3
  172. package/src/generators/slice/built-in-plan.js +79 -277
  173. package/src/{developer-agent/preview-changes.d.ts → generators/slice/generation-tree.d.ts} +1 -5
  174. package/src/generators/slice/generation-tree.js +161 -0
  175. package/src/generators/slice/persistence-contract.js +2 -2
  176. package/src/generators/slice/schema.json +12 -4
  177. package/src/generators/slice/slice-config.d.ts +7 -0
  178. package/src/generators/slice/slice-config.js +125 -0
  179. package/src/generators/slice/slice.js +52 -257
  180. package/src/generators/slice/sql-bootstrap.d.ts +1 -0
  181. package/src/generators/slice/sql-bootstrap.js +505 -0
  182. package/src/generators/slice/sql-client.d.ts +1 -0
  183. package/src/generators/slice/sql-client.js +107 -0
  184. package/src/generators/slice/sql-infrastructure.d.ts +1 -0
  185. package/src/generators/slice/sql-infrastructure.js +225 -0
  186. package/src/generators/slice/sql-logging.d.ts +1 -0
  187. package/src/generators/slice/sql-logging.js +266 -0
  188. package/src/generators/slice/sql-migration.d.ts +2 -0
  189. package/src/generators/slice/sql-migration.js +202 -0
  190. package/src/generators/slice/standard-slice-contract.d.ts +25 -0
  191. package/src/generators/slice/standard-slice-contract.js +64 -0
  192. package/src/generators/sql/schema.json +1 -1
  193. package/src/generators/sql/sql.d.ts +1 -1
  194. package/src/generators/sql/sql.js +13 -7
  195. package/src/generators/upgrade/framework-package-upgrade.d.ts +35 -0
  196. package/src/generators/upgrade/framework-package-upgrade.js +55 -0
  197. package/src/generators/upgrade/framework-packages.d.ts +25 -0
  198. package/src/generators/upgrade/framework-packages.js +138 -0
  199. package/src/generators/upgrade/function-authentication-notice.d.ts +21 -0
  200. package/src/generators/upgrade/function-authentication-notice.js +54 -0
  201. package/src/generators/upgrade/schema.d.ts +0 -3
  202. package/src/generators/upgrade/schema.json +7 -17
  203. package/src/generators/upgrade/slice-compositions.d.ts +20 -0
  204. package/src/generators/upgrade/slice-compositions.js +100 -0
  205. package/src/generators/upgrade/slice-upgrade-guidance.d.ts +19 -0
  206. package/src/generators/upgrade/slice-upgrade-guidance.js +50 -0
  207. package/src/generators/upgrade/slice-upgrade.d.ts +4 -0
  208. package/src/generators/upgrade/slice-upgrade.js +231 -0
  209. package/src/generators/upgrade/upgrade-plan.d.ts +49 -0
  210. package/src/generators/upgrade/upgrade-plan.js +242 -0
  211. package/src/generators/upgrade/upgrade-preflight.d.ts +20 -0
  212. package/src/generators/upgrade/upgrade-preflight.js +64 -0
  213. package/src/generators/upgrade/upgrade.d.ts +8 -87
  214. package/src/generators/upgrade/upgrade.js +27 -1909
  215. package/src/generators/workload/schema.json +2 -2
  216. package/src/generators/workload/workload.d.ts +11 -11
  217. package/src/generators/workload/workload.js +167 -1200
  218. package/src/index.d.ts +0 -5
  219. package/src/index.js +0 -5
  220. package/src/local-dev/browser-verification.d.ts +0 -7
  221. package/src/local-dev/browser-verification.js +0 -136
  222. package/src/local-dev/contracts.d.ts +6 -0
  223. package/src/local-dev/contracts.js +17 -9
  224. package/src/local-dev/environment-checks.d.ts +126 -0
  225. package/src/local-dev/environment-checks.js +81 -0
  226. package/src/local-dev/environment-inspector.d.ts +3 -124
  227. package/src/local-dev/environment-inspector.js +9 -148
  228. package/src/local-dev/fleet-process.d.ts +9 -2
  229. package/src/local-dev/fleet-process.js +27 -7
  230. package/src/local-dev/gateway-daemon.d.ts +1 -1
  231. package/src/local-dev/gateway-daemon.js +6 -4
  232. package/src/local-dev/portless.d.ts +5 -0
  233. package/src/local-dev/portless.js +5 -0
  234. package/src/local-dev/private-state.d.ts +1 -0
  235. package/src/local-dev/private-state.js +19 -23
  236. package/src/local-dev/process-group.d.ts +10 -0
  237. package/src/local-dev/process-group.js +33 -0
  238. package/src/local-dev/process-identity.js +4 -2
  239. package/src/local-dev/slice-runner-child.d.ts +37 -0
  240. package/src/local-dev/slice-runner-child.js +127 -0
  241. package/src/local-dev/slice-runner-recovery.d.ts +32 -0
  242. package/src/local-dev/slice-runner-recovery.js +216 -0
  243. package/src/local-dev/slice-runner-state.d.ts +82 -0
  244. package/src/local-dev/slice-runner-state.js +265 -0
  245. package/src/local-dev/slice-runner.d.ts +4 -117
  246. package/src/local-dev/slice-runner.js +59 -594
  247. package/src/local-dev/tls.js +39 -99
  248. package/src/local-dev/trust-store.d.ts +42 -0
  249. package/src/local-dev/trust-store.js +87 -0
  250. package/src/ownership/composition.d.ts +7 -0
  251. package/src/ownership/composition.js +64 -56
  252. package/src/ownership/index.d.ts +2 -0
  253. package/src/ownership/index.js +7 -0
  254. package/src/ownership/pnpm-workspace.d.ts +77 -0
  255. package/src/ownership/pnpm-workspace.js +225 -0
  256. package/src/ownership/record.d.ts +19 -0
  257. package/src/ownership/record.js +26 -2
  258. package/src/ownership/site-record.d.ts +26 -0
  259. package/src/ownership/site-record.js +120 -0
  260. package/src/repository-policy/capacity-migration.d.ts +1 -1
  261. package/src/repository-policy/capacity-migration.js +1 -1
  262. package/src/repository-policy/deployment-plan.d.ts +3 -0
  263. package/src/repository-policy/deployment-plan.js +33 -4
  264. package/src/repository-policy/foundation-router.d.ts +17 -0
  265. package/src/repository-policy/foundation-router.js +44 -0
  266. package/src/repository-policy/index.d.ts +3 -0
  267. package/src/repository-policy/index.js +3 -0
  268. package/src/repository-policy/policy-accounts.d.ts +22 -0
  269. package/src/repository-policy/policy-accounts.js +134 -0
  270. package/src/repository-policy/policy-files.d.ts +8 -0
  271. package/src/repository-policy/policy-files.js +201 -0
  272. package/src/repository-policy/policy-internal.d.ts +2 -0
  273. package/src/repository-policy/policy-internal.js +11 -0
  274. package/src/repository-policy/policy-model.d.ts +95 -0
  275. package/src/repository-policy/policy-model.js +42 -0
  276. package/src/repository-policy/policy-validation.d.ts +4 -0
  277. package/src/repository-policy/policy-validation.js +308 -0
  278. package/src/repository-policy/policy.d.ts +6 -109
  279. package/src/repository-policy/policy.js +52 -626
  280. package/src/repository-policy/public-dns.d.ts +69 -0
  281. package/src/repository-policy/public-dns.js +265 -0
  282. package/src/{generators/repository-policy → repository-policy}/tree-policy.d.ts +1 -1
  283. package/src/{generators/repository-policy → repository-policy}/tree-policy.js +5 -5
  284. package/src/schemas/generated-ownership-v2.json +6 -0
  285. package/src/schemas/repository-policy-v1.json +106 -3
  286. package/src/secrets/index.d.ts +0 -5
  287. package/src/secrets/index.js +0 -5
  288. package/src/slice-infra/index.d.ts +57 -0
  289. package/src/slice-infra/index.js +117 -0
  290. package/src/slice-scripts/build.d.ts +27 -0
  291. package/src/slice-scripts/build.js +120 -0
  292. package/src/slice-scripts/database.d.ts +87 -0
  293. package/src/slice-scripts/database.js +328 -0
  294. package/src/slice-scripts/index.d.ts +11 -0
  295. package/src/slice-scripts/index.js +23 -0
  296. package/src/slice-scripts/root-site-routes.d.ts +11 -0
  297. package/src/slice-scripts/root-site-routes.js +83 -0
  298. package/src/slice-scripts/sql-migration-engine.mjs +180 -0
  299. package/src/workload-roles/effective-policy.d.ts +0 -37
  300. package/src/workload-roles/effective-policy.js +1 -174
  301. package/src/workload-roles/standard-slice.d.ts +2 -19
  302. package/src/workload-roles/standard-slice.js +3 -129
  303. package/src/workspace-deployment/ownership.d.ts +15 -0
  304. package/src/workspace-deployment/ownership.js +19 -3
  305. package/src/api-contract/baseline-update.d.ts +0 -82
  306. package/src/api-contract/baseline-update.js +0 -225
  307. package/src/api-contract/compatibility.d.ts +0 -30
  308. package/src/api-contract/compatibility.js +0 -643
  309. package/src/api-contract/contract-graph.d.ts +0 -35
  310. package/src/api-contract/contract-graph.js +0 -141
  311. package/src/api-contract/evidence.d.ts +0 -23
  312. package/src/api-contract/evidence.js +0 -87
  313. package/src/api-contract/index.d.ts +0 -6
  314. package/src/api-contract/index.js +0 -10
  315. package/src/api-contract/model.d.ts +0 -144
  316. package/src/api-contract/model.js +0 -993
  317. package/src/api-contract/rollout.d.ts +0 -32
  318. package/src/api-contract/rollout.js +0 -88
  319. package/src/authorization/compatibility.d.ts +0 -62
  320. package/src/authorization/compatibility.js +0 -175
  321. package/src/authorization/index.d.ts +0 -1
  322. package/src/authorization/index.js +0 -5
  323. package/src/blueprints/execution.d.ts +0 -55
  324. package/src/blueprints/execution.js +0 -329
  325. package/src/blueprints/external-sandbox.d.ts +0 -53
  326. package/src/blueprints/external-sandbox.js +0 -1194
  327. package/src/blueprints/index.d.ts +0 -5
  328. package/src/blueprints/index.js +0 -9
  329. package/src/blueprints/inputs.d.ts +0 -43
  330. package/src/blueprints/inputs.js +0 -103
  331. package/src/blueprints/manifest.d.ts +0 -281
  332. package/src/blueprints/manifest.js +0 -424
  333. package/src/blueprints/resolver.d.ts +0 -37
  334. package/src/blueprints/resolver.js +0 -387
  335. package/src/blueprints/transitions.d.ts +0 -20
  336. package/src/blueprints/transitions.js +0 -61
  337. package/src/cli/agent-command.d.ts +0 -30
  338. package/src/cli/agent-command.js +0 -204
  339. package/src/cli/agent-runtime.d.ts +0 -25
  340. package/src/cli/agent-runtime.js +0 -498
  341. package/src/cli/blueprint-authority.d.ts +0 -9
  342. package/src/cli/blueprint-authority.js +0 -43
  343. package/src/cli/blueprint-command.d.ts +0 -24
  344. package/src/cli/blueprint-command.js +0 -63
  345. package/src/data-lifecycle/index.d.ts +0 -3
  346. package/src/data-lifecycle/index.js +0 -7
  347. package/src/data-lifecycle/model.d.ts +0 -172
  348. package/src/data-lifecycle/model.js +0 -95
  349. package/src/data-lifecycle/sensitive-artifacts.d.ts +0 -28
  350. package/src/data-lifecycle/sensitive-artifacts.js +0 -146
  351. package/src/data-lifecycle/validation.d.ts +0 -32
  352. package/src/data-lifecycle/validation.js +0 -837
  353. package/src/database-retirement/contract.d.ts +0 -68
  354. package/src/database-retirement/contract.js +0 -166
  355. package/src/database-retirement/index.d.ts +0 -1
  356. package/src/database-retirement/index.js +0 -5
  357. package/src/developer-agent/context.d.ts +0 -57
  358. package/src/developer-agent/context.js +0 -662
  359. package/src/developer-agent/generator-planning.d.ts +0 -34
  360. package/src/developer-agent/generator-planning.js +0 -666
  361. package/src/developer-agent/generator-preview.d.ts +0 -8
  362. package/src/developer-agent/generator-preview.js +0 -650
  363. package/src/developer-agent/git-inspection.d.ts +0 -112
  364. package/src/developer-agent/git-inspection.js +0 -887
  365. package/src/developer-agent/handoff.d.ts +0 -43
  366. package/src/developer-agent/handoff.js +0 -713
  367. package/src/developer-agent/index.d.ts +0 -10
  368. package/src/developer-agent/index.js +0 -14
  369. package/src/developer-agent/model.d.ts +0 -493
  370. package/src/developer-agent/model.js +0 -143
  371. package/src/developer-agent/operation-registry.d.ts +0 -60
  372. package/src/developer-agent/operation-registry.js +0 -1550
  373. package/src/developer-agent/ordering.d.ts +0 -9
  374. package/src/developer-agent/ordering.js +0 -15
  375. package/src/developer-agent/planning.d.ts +0 -25
  376. package/src/developer-agent/planning.js +0 -478
  377. package/src/developer-agent/preview-changes.js +0 -215
  378. package/src/developer-agent/preview-source.d.ts +0 -2
  379. package/src/developer-agent/preview-source.js +0 -19
  380. package/src/developer-agent/validation.d.ts +0 -30
  381. package/src/developer-agent/validation.js +0 -2725
  382. package/src/developer-agent/workspace-inspection.d.ts +0 -20
  383. package/src/developer-agent/workspace-inspection.js +0 -1189
  384. package/src/developer-agent/workspace-path.d.ts +0 -6
  385. package/src/developer-agent/workspace-path.js +0 -22
  386. package/src/executors/blueprint-trust/blueprint-trust.d.ts +0 -29
  387. package/src/executors/blueprint-trust/blueprint-trust.js +0 -121
  388. package/src/executors/blueprint-trust/schema.json +0 -27
  389. package/src/executors/blueprint-verification/blueprint-verification.d.ts +0 -13
  390. package/src/executors/blueprint-verification/blueprint-verification.js +0 -110
  391. package/src/executors/blueprint-verification/schema.json +0 -44
  392. package/src/executors/developer-context/developer-context.d.ts +0 -38
  393. package/src/executors/developer-context/developer-context.js +0 -78
  394. package/src/executors/developer-context/schema.json +0 -87
  395. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.d.ts +0 -19
  396. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js +0 -105
  397. package/src/executors/foundation-profile-preflight/schema.json +0 -32
  398. package/src/executors/github-bootstrap/github-bootstrap.d.ts +0 -13
  399. package/src/executors/github-bootstrap/github-bootstrap.js +0 -62
  400. package/src/executors/github-bootstrap/schema.json +0 -50
  401. package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +0 -37
  402. package/src/executors/infrastructure-plan/infrastructure-plan.js +0 -268
  403. package/src/executors/infrastructure-plan/schema.json +0 -38
  404. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.d.ts +0 -42
  405. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js +0 -1229
  406. package/src/executors/router-waf-rehearsal/schema.json +0 -29
  407. package/src/executors/secret-guardrails/schema.json +0 -6
  408. package/src/executors/secret-guardrails/secret-guardrails.d.ts +0 -3
  409. package/src/executors/secret-guardrails/secret-guardrails.js +0 -44
  410. package/src/executors/secret-initialize/schema.json +0 -42
  411. package/src/executors/secret-initialize/secret-initialize.d.ts +0 -34
  412. package/src/executors/secret-initialize/secret-initialize.js +0 -297
  413. package/src/executors/secret-metadata/schema.json +0 -36
  414. package/src/executors/secret-metadata/secret-metadata.d.ts +0 -46
  415. package/src/executors/secret-metadata/secret-metadata.js +0 -230
  416. package/src/executors/sst-lifecycle/generated-secret-retirement.d.ts +0 -53
  417. package/src/executors/sst-lifecycle/generated-secret-retirement.js +0 -192
  418. package/src/executors/sst-lifecycle/logging-preflight.d.ts +0 -22
  419. package/src/executors/sst-lifecycle/logging-preflight.js +0 -206
  420. package/src/executors/sst-lifecycle/secret-preflight.d.ts +0 -27
  421. package/src/executors/sst-lifecycle/secret-preflight.js +0 -125
  422. package/src/executors/work-markers/schema.json +0 -14
  423. package/src/executors/work-markers/work-markers.d.ts +0 -6
  424. package/src/executors/work-markers/work-markers.js +0 -20
  425. package/src/foundation/cost-estimate.d.ts +0 -175
  426. package/src/foundation/cost-estimate.js +0 -706
  427. package/src/foundation/private-smoke-admission.d.ts +0 -45
  428. package/src/foundation/private-smoke-admission.js +0 -180
  429. package/src/foundation/private-smoke-control-plane.d.ts +0 -18
  430. package/src/foundation/private-smoke-control-plane.js +0 -184
  431. package/src/foundation/router-waf-rate-rehearsal.d.ts +0 -97
  432. package/src/foundation/router-waf-rate-rehearsal.js +0 -210
  433. package/src/foundation/router-waf.d.ts +0 -149
  434. package/src/foundation/router-waf.js +0 -809
  435. package/src/frontend-security/index.d.ts +0 -1
  436. package/src/frontend-security/index.js +0 -5
  437. package/src/frontend-security/security-headers.d.ts +0 -50
  438. package/src/frontend-security/security-headers.js +0 -418
  439. package/src/generators/blueprint/blueprint.d.ts +0 -5
  440. package/src/generators/blueprint/blueprint.js +0 -102
  441. package/src/generators/blueprint/files.d.ts +0 -6
  442. package/src/generators/blueprint/files.js +0 -217
  443. package/src/generators/blueprint/schema.d.ts +0 -4
  444. package/src/generators/blueprint/schema.json +0 -18
  445. package/src/generators/feature-registry.d.ts +0 -13
  446. package/src/generators/feature-registry.js +0 -73
  447. package/src/generators/observability-infrastructure.d.ts +0 -2
  448. package/src/generators/observability-infrastructure.js +0 -31
  449. package/src/generators/preset/workspace-files-adopter-skills.d.ts +0 -7
  450. package/src/generators/preset/workspace-files-adopter-skills.js +0 -345
  451. package/src/generators/preset/workspace-files-agent-development.d.ts +0 -9
  452. package/src/generators/preset/workspace-files-agent-development.js +0 -42
  453. package/src/generators/preset/workspace-files-ci-acceptance.d.ts +0 -1
  454. package/src/generators/preset/workspace-files-ci-acceptance.js +0 -791
  455. package/src/generators/preset/workspace-files-ci-install.d.ts +0 -2
  456. package/src/generators/preset/workspace-files-ci-install.js +0 -196
  457. package/src/generators/preset/workspace-files-developer-agent.d.ts +0 -16
  458. package/src/generators/preset/workspace-files-developer-agent.js +0 -638
  459. package/src/generators/preset/workspace-files-ecr-inspector.d.ts +0 -18
  460. package/src/generators/preset/workspace-files-ecr-inspector.js +0 -298
  461. package/src/generators/preset/workspace-files-foundation-workload-roles.d.ts +0 -6
  462. package/src/generators/preset/workspace-files-foundation-workload-roles.js +0 -409
  463. package/src/generators/preset/workspace-files-performance-cost.d.ts +0 -66
  464. package/src/generators/preset/workspace-files-performance-cost.js +0 -866
  465. package/src/generators/preset/workspace-files-performance-load.d.ts +0 -73
  466. package/src/generators/preset/workspace-files-performance-load.js +0 -815
  467. package/src/generators/preset/workspace-files-shared-operation-claims.d.ts +0 -10
  468. package/src/generators/preset/workspace-files-shared-operation-claims.js +0 -59
  469. package/src/generators/preset/workspace-files-stage-authority.d.ts +0 -6
  470. package/src/generators/preset/workspace-files-stage-authority.js +0 -529
  471. package/src/generators/preset/workspace-files-thin-deploy.d.ts +0 -65
  472. package/src/generators/preset/workspace-files-thin-deploy.js +0 -2520
  473. package/src/generators/preset/workspace-files-thin-docs.d.ts +0 -7
  474. package/src/generators/preset/workspace-files-thin-docs.js +0 -358
  475. package/src/generators/preset/workspace-files-thin-release.d.ts +0 -14
  476. package/src/generators/preset/workspace-files-thin-release.js +0 -26
  477. package/src/generators/preset/workspace-files-workload-role-baseline.d.ts +0 -9
  478. package/src/generators/preset/workspace-files-workload-role-baseline.js +0 -1314
  479. package/src/generators/repository-policy/repository-policy.d.ts +0 -4
  480. package/src/generators/repository-policy/repository-policy.js +0 -293
  481. package/src/generators/repository-policy/schema.d.ts +0 -28
  482. package/src/generators/repository-policy/schema.json +0 -122
  483. package/src/generators/slice/built-in-plan-alarm-identity.d.ts +0 -173
  484. package/src/generators/slice/built-in-plan-alarm-identity.js +0 -202
  485. package/src/generators/slice/built-in-plan-api-contract-files.d.ts +0 -2
  486. package/src/generators/slice/built-in-plan-api-contract-files.js +0 -2830
  487. package/src/generators/slice/built-in-plan-async-work-files.d.ts +0 -2
  488. package/src/generators/slice/built-in-plan-async-work-files.js +0 -6100
  489. package/src/generators/slice/built-in-plan-authorization-files.d.ts +0 -2
  490. package/src/generators/slice/built-in-plan-authorization-files.js +0 -2082
  491. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.d.ts +0 -2
  492. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +0 -1301
  493. package/src/generators/slice/built-in-plan-authorization-storage.d.ts +0 -3
  494. package/src/generators/slice/built-in-plan-authorization-storage.js +0 -119
  495. package/src/generators/slice/built-in-plan-background-work-files.d.ts +0 -2
  496. package/src/generators/slice/built-in-plan-background-work-files.js +0 -99
  497. package/src/generators/slice/built-in-plan-data-deletion-files.d.ts +0 -2
  498. package/src/generators/slice/built-in-plan-data-deletion-files.js +0 -273
  499. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.d.ts +0 -2
  500. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js +0 -223
  501. package/src/generators/slice/built-in-plan-data-files.d.ts +0 -2
  502. package/src/generators/slice/built-in-plan-data-files.js +0 -513
  503. package/src/generators/slice/built-in-plan-data-lifecycle-files.d.ts +0 -2
  504. package/src/generators/slice/built-in-plan-data-lifecycle-files.js +0 -775
  505. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.d.ts +0 -2
  506. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +0 -863
  507. package/src/generators/slice/built-in-plan-data-retention-job-files.d.ts +0 -2
  508. package/src/generators/slice/built-in-plan-data-retention-job-files.js +0 -169
  509. package/src/generators/slice/built-in-plan-data-retention-launcher-files.d.ts +0 -2
  510. package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +0 -186
  511. package/src/generators/slice/built-in-plan-data-rights-files.d.ts +0 -2
  512. package/src/generators/slice/built-in-plan-data-rights-files.js +0 -152
  513. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.d.ts +0 -2
  514. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js +0 -508
  515. package/src/generators/slice/built-in-plan-event-contract-literal.d.ts +0 -6
  516. package/src/generators/slice/built-in-plan-event-contract-literal.js +0 -52
  517. package/src/generators/slice/built-in-plan-foundation-files.d.ts +0 -3
  518. package/src/generators/slice/built-in-plan-foundation-files.js +0 -205
  519. package/src/generators/slice/built-in-plan-frontend-files.d.ts +0 -2
  520. package/src/generators/slice/built-in-plan-frontend-files.js +0 -2244
  521. package/src/generators/slice/built-in-plan-infrastructure-safety-files.d.ts +0 -2
  522. package/src/generators/slice/built-in-plan-infrastructure-safety-files.js +0 -373
  523. package/src/generators/slice/built-in-plan-key-value-cleanup.d.ts +0 -4
  524. package/src/generators/slice/built-in-plan-key-value-cleanup.js +0 -100
  525. package/src/generators/slice/built-in-plan-key-value-consumer.d.ts +0 -4
  526. package/src/generators/slice/built-in-plan-key-value-consumer.js +0 -151
  527. package/src/generators/slice/built-in-plan-key-value-deletion.d.ts +0 -2
  528. package/src/generators/slice/built-in-plan-key-value-deletion.js +0 -377
  529. package/src/generators/slice/built-in-plan-key-value-delivery.d.ts +0 -2
  530. package/src/generators/slice/built-in-plan-key-value-delivery.js +0 -137
  531. package/src/generators/slice/built-in-plan-key-value-export.d.ts +0 -2
  532. package/src/generators/slice/built-in-plan-key-value-export.js +0 -595
  533. package/src/generators/slice/built-in-plan-key-value-holds.d.ts +0 -2
  534. package/src/generators/slice/built-in-plan-key-value-holds.js +0 -189
  535. package/src/generators/slice/built-in-plan-key-value-infrastructure.d.ts +0 -2
  536. package/src/generators/slice/built-in-plan-key-value-infrastructure.js +0 -102
  537. package/src/generators/slice/built-in-plan-key-value-performance.d.ts +0 -5
  538. package/src/generators/slice/built-in-plan-key-value-performance.js +0 -530
  539. package/src/generators/slice/built-in-plan-key-value-provider.d.ts +0 -4
  540. package/src/generators/slice/built-in-plan-key-value-provider.js +0 -366
  541. package/src/generators/slice/built-in-plan-key-value-records.d.ts +0 -3
  542. package/src/generators/slice/built-in-plan-key-value-records.js +0 -232
  543. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.d.ts +0 -2
  544. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.js +0 -103
  545. package/src/generators/slice/built-in-plan-key-value-retention-job-files.d.ts +0 -2
  546. package/src/generators/slice/built-in-plan-key-value-retention-job-files.js +0 -160
  547. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.d.ts +0 -2
  548. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.js +0 -329
  549. package/src/generators/slice/built-in-plan-key-value-retention-worker.d.ts +0 -2
  550. package/src/generators/slice/built-in-plan-key-value-retention-worker.js +0 -477
  551. package/src/generators/slice/built-in-plan-key-value-retention.d.ts +0 -2
  552. package/src/generators/slice/built-in-plan-key-value-retention.js +0 -184
  553. package/src/generators/slice/built-in-plan-metadata-files.d.ts +0 -3
  554. package/src/generators/slice/built-in-plan-metadata-files.js +0 -384
  555. package/src/generators/slice/built-in-plan-native-runtime-authority-files.d.ts +0 -2
  556. package/src/generators/slice/built-in-plan-native-runtime-authority-files.js +0 -324
  557. package/src/generators/slice/built-in-plan-operations-files.d.ts +0 -2
  558. package/src/generators/slice/built-in-plan-operations-files.js +0 -1218
  559. package/src/generators/slice/built-in-plan-performance-files.d.ts +0 -4
  560. package/src/generators/slice/built-in-plan-performance-files.js +0 -2439
  561. package/src/generators/slice/built-in-plan-release-files.d.ts +0 -2
  562. package/src/generators/slice/built-in-plan-release-files.js +0 -6585
  563. package/src/generators/slice/built-in-plan-reliability-files.d.ts +0 -2
  564. package/src/generators/slice/built-in-plan-reliability-files.js +0 -4724
  565. package/src/generators/slice/built-in-plan-secret-runtime-files.d.ts +0 -2
  566. package/src/generators/slice/built-in-plan-secret-runtime-files.js +0 -1015
  567. package/src/generators/slice/built-in-plan-sql-events.d.ts +0 -2
  568. package/src/generators/slice/built-in-plan-sql-events.js +0 -276
  569. package/src/generators/slice/built-in-plan-testing-files.d.ts +0 -2
  570. package/src/generators/slice/built-in-plan-testing-files.js +0 -2575
  571. package/src/generators/slice/built-in-plan-testing-persistence-event-files.d.ts +0 -7
  572. package/src/generators/slice/built-in-plan-testing-persistence-event-files.js +0 -487
  573. package/src/generators/slice/built-in-plan-testing-persistence-files.d.ts +0 -2
  574. package/src/generators/slice/built-in-plan-testing-persistence-files.js +0 -180
  575. package/src/generators/slice/built-in-plan-thin-release-files.d.ts +0 -11
  576. package/src/generators/slice/built-in-plan-thin-release-files.js +0 -162
  577. package/src/generators/slice/built-in-plan-verification-files.d.ts +0 -2
  578. package/src/generators/slice/built-in-plan-verification-files.js +0 -431
  579. package/src/generators/slice/built-in-plan-workload-role-files.d.ts +0 -2
  580. package/src/generators/slice/built-in-plan-workload-role-files.js +0 -2220
  581. package/src/generators/slice/data-policy-review-seed.d.ts +0 -2
  582. package/src/generators/slice/data-policy-review-seed.js +0 -22
  583. package/src/generators/slice/deployed-smoke-readiness.d.ts +0 -2
  584. package/src/generators/slice/deployed-smoke-readiness.js +0 -214
  585. package/src/generators/slice/local-source-identity.d.ts +0 -2
  586. package/src/generators/slice/local-source-identity.js +0 -31
  587. package/src/generators/upgrade/sql-seeded-reconciliation.d.ts +0 -2
  588. package/src/generators/upgrade/sql-seeded-reconciliation.js +0 -170
  589. package/src/generators/workload/performance-registration.d.ts +0 -33
  590. package/src/generators/workload/performance-registration.js +0 -224
  591. package/src/generators/workload/reliability-registration.d.ts +0 -16
  592. package/src/generators/workload/reliability-registration.js +0 -150
  593. package/src/generators/workload/service-performance-files.d.ts +0 -5
  594. package/src/generators/workload/service-performance-files.js +0 -1883
  595. package/src/git-policy/action-pins.d.ts +0 -43
  596. package/src/git-policy/action-pins.js +0 -50
  597. package/src/git-policy/github-bootstrap.d.ts +0 -94
  598. package/src/git-policy/github-bootstrap.js +0 -1248
  599. package/src/git-policy/index.d.ts +0 -3
  600. package/src/git-policy/index.js +0 -7
  601. package/src/git-policy/routing.d.ts +0 -21
  602. package/src/git-policy/routing.js +0 -138
  603. package/src/infrastructure-change/convergence.d.ts +0 -13
  604. package/src/infrastructure-change/convergence.js +0 -85
  605. package/src/infrastructure-change/drift.d.ts +0 -13
  606. package/src/infrastructure-change/drift.js +0 -112
  607. package/src/infrastructure-change/index.d.ts +0 -7
  608. package/src/infrastructure-change/index.js +0 -11
  609. package/src/infrastructure-change/local-capability.d.ts +0 -73
  610. package/src/infrastructure-change/local-capability.js +0 -114
  611. package/src/infrastructure-change/model.d.ts +0 -274
  612. package/src/infrastructure-change/model.js +0 -29
  613. package/src/infrastructure-change/normalize.d.ts +0 -16
  614. package/src/infrastructure-change/normalize.js +0 -285
  615. package/src/infrastructure-change/plan.d.ts +0 -67
  616. package/src/infrastructure-change/plan.js +0 -671
  617. package/src/infrastructure-change/risk.d.ts +0 -9
  618. package/src/infrastructure-change/risk.js +0 -349
  619. package/src/infrastructure-change/summary.d.ts +0 -20
  620. package/src/infrastructure-change/summary.js +0 -130
  621. package/src/performance/cost-collection.d.ts +0 -225
  622. package/src/performance/cost-collection.js +0 -827
  623. package/src/performance/cost-controls.d.ts +0 -135
  624. package/src/performance/cost-controls.js +0 -347
  625. package/src/performance/evidence.d.ts +0 -140
  626. package/src/performance/evidence.js +0 -601
  627. package/src/performance/index.d.ts +0 -10
  628. package/src/performance/index.js +0 -14
  629. package/src/performance/load-safety.d.ts +0 -84
  630. package/src/performance/load-safety.js +0 -348
  631. package/src/performance/model.d.ts +0 -129
  632. package/src/performance/model.js +0 -451
  633. package/src/performance/pr-artifact-budget.d.ts +0 -42
  634. package/src/performance/pr-artifact-budget.js +0 -151
  635. package/src/performance/runner.d.ts +0 -75
  636. package/src/performance/runner.js +0 -227
  637. package/src/performance/scenario-endpoint.d.ts +0 -1
  638. package/src/performance/scenario-endpoint.js +0 -5
  639. package/src/performance/scenario.d.ts +0 -215
  640. package/src/performance/scenario.js +0 -744
  641. package/src/performance/unit-cost.d.ts +0 -105
  642. package/src/performance/unit-cost.js +0 -364
  643. package/src/release/index.d.ts +0 -2
  644. package/src/release/index.js +0 -6
  645. package/src/release/lifecycle.d.ts +0 -132
  646. package/src/release/lifecycle.js +0 -411
  647. package/src/release/manifest.d.ts +0 -148
  648. package/src/release/manifest.js +0 -503
  649. package/src/release/rollout.d.ts +0 -170
  650. package/src/release/rollout.js +0 -578
  651. package/src/release/source-authority.d.ts +0 -19
  652. package/src/release/source-authority.js +0 -212
  653. package/src/schemas/aggregate-count-evidence-v1.json +0 -135
  654. package/src/schemas/api-contract-baseline-v1.json +0 -674
  655. package/src/schemas/api-contract-compatibility-report-v1.json +0 -126
  656. package/src/schemas/aws-billing-actual-evidence-v1.json +0 -407
  657. package/src/schemas/blueprint-input-schema-v1.json +0 -23
  658. package/src/schemas/blueprint-v1.json +0 -188
  659. package/src/schemas/data-lifecycle-policy-v1.json +0 -517
  660. package/src/schemas/performance-policy-v1.json +0 -335
  661. package/src/schemas/testing-evidence-quarantine-v1.json +0 -168
  662. package/src/schemas/testing-evidence-result-v1.json +0 -319
  663. package/src/secrets/aws-control-plane.d.ts +0 -29
  664. package/src/secrets/aws-control-plane.js +0 -322
  665. package/src/secrets/generated-aws-control-plane.d.ts +0 -33
  666. package/src/secrets/generated-aws-control-plane.js +0 -322
  667. package/src/secrets/guardrails.d.ts +0 -26
  668. package/src/secrets/guardrails.js +0 -328
  669. package/src/secrets/metadata.d.ts +0 -48
  670. package/src/secrets/metadata.js +0 -199
  671. package/src/secrets/operator.d.ts +0 -190
  672. package/src/secrets/operator.js +0 -701
  673. package/src/secrets/verification.d.ts +0 -18
  674. package/src/secrets/verification.js +0 -152
  675. package/src/supply-chain/action-pins.d.ts +0 -26
  676. package/src/supply-chain/action-pins.js +0 -262
  677. package/src/supply-chain/blueprint-trust-git.d.ts +0 -130
  678. package/src/supply-chain/blueprint-trust-git.js +0 -1642
  679. package/src/supply-chain/blueprint-trust-process.d.ts +0 -4
  680. package/src/supply-chain/blueprint-trust-process.js +0 -88
  681. package/src/supply-chain/blueprint-trust.d.ts +0 -354
  682. package/src/supply-chain/blueprint-trust.js +0 -1558
  683. package/src/supply-chain/blueprint-verification-authority.d.ts +0 -62
  684. package/src/supply-chain/blueprint-verification-authority.js +0 -661
  685. package/src/supply-chain/blueprint-verification-execution.d.ts +0 -68
  686. package/src/supply-chain/blueprint-verification-execution.js +0 -639
  687. package/src/supply-chain/build-output-bounds.d.ts +0 -2
  688. package/src/supply-chain/build-output-bounds.js +0 -12
  689. package/src/supply-chain/build-output.d.ts +0 -41
  690. package/src/supply-chain/build-output.js +0 -551
  691. package/src/supply-chain/common.d.ts +0 -21
  692. package/src/supply-chain/common.js +0 -107
  693. package/src/supply-chain/container-artifact-contract.d.ts +0 -23
  694. package/src/supply-chain/container-artifact-contract.js +0 -208
  695. package/src/supply-chain/container-release.d.ts +0 -119
  696. package/src/supply-chain/container-release.js +0 -496
  697. package/src/supply-chain/ecr-applicability.d.ts +0 -19
  698. package/src/supply-chain/ecr-applicability.js +0 -103
  699. package/src/supply-chain/ecr-scanning.d.ts +0 -85
  700. package/src/supply-chain/ecr-scanning.js +0 -325
  701. package/src/supply-chain/ecs-deployed-image.d.ts +0 -87
  702. package/src/supply-chain/ecs-deployed-image.js +0 -302
  703. package/src/supply-chain/errors.d.ts +0 -6
  704. package/src/supply-chain/errors.js +0 -15
  705. package/src/supply-chain/generated-blueprint-trust-command.d.ts +0 -4
  706. package/src/supply-chain/generated-blueprint-trust-command.js +0 -1379
  707. package/src/supply-chain/generated-command.d.ts +0 -1
  708. package/src/supply-chain/generated-command.js +0 -775
  709. package/src/supply-chain/generated-container-release-command.d.ts +0 -16
  710. package/src/supply-chain/generated-container-release-command.js +0 -3248
  711. package/src/supply-chain/generated-ecr-collector-command.d.ts +0 -20
  712. package/src/supply-chain/generated-ecr-collector-command.js +0 -1445
  713. package/src/supply-chain/generated-files.d.ts +0 -13
  714. package/src/supply-chain/generated-files.js +0 -421
  715. package/src/supply-chain/generated-scanner-command.d.ts +0 -1
  716. package/src/supply-chain/generated-scanner-command.js +0 -778
  717. package/src/supply-chain/index.d.ts +0 -28
  718. package/src/supply-chain/index.js +0 -36
  719. package/src/supply-chain/inventory.d.ts +0 -96
  720. package/src/supply-chain/inventory.js +0 -828
  721. package/src/supply-chain/license-expression.d.ts +0 -7
  722. package/src/supply-chain/license-expression.js +0 -128
  723. package/src/supply-chain/policy.d.ts +0 -105
  724. package/src/supply-chain/policy.js +0 -304
  725. package/src/supply-chain/publication.d.ts +0 -48
  726. package/src/supply-chain/publication.js +0 -85
  727. package/src/supply-chain/sbom.d.ts +0 -228
  728. package/src/supply-chain/sbom.js +0 -913
  729. package/src/supply-chain/scanner.d.ts +0 -77
  730. package/src/supply-chain/scanner.js +0 -514
  731. package/src/supply-chain/vendored-source.d.ts +0 -95
  732. package/src/supply-chain/vendored-source.js +0 -315
  733. package/src/testing-evidence/fixture-scope.d.ts +0 -53
  734. package/src/testing-evidence/fixture-scope.js +0 -142
  735. package/src/testing-evidence/index.d.ts +0 -5
  736. package/src/testing-evidence/index.js +0 -9
  737. package/src/testing-evidence/quarantine.d.ts +0 -48
  738. package/src/testing-evidence/quarantine.js +0 -253
  739. package/src/testing-evidence/result.d.ts +0 -109
  740. package/src/testing-evidence/result.js +0 -585
  741. package/src/testing-evidence/runner-adapter.d.ts +0 -51
  742. package/src/testing-evidence/runner-adapter.js +0 -288
  743. package/src/testing-evidence/sensitive-artifacts.d.ts +0 -13
  744. package/src/testing-evidence/sensitive-artifacts.js +0 -93
  745. package/src/work-markers/index.d.ts +0 -1
  746. package/src/work-markers/index.js +0 -5
  747. package/src/work-markers/work-markers.d.ts +0 -39
  748. package/src/work-markers/work-markers.js +0 -360
  749. package/src/workload-roles/account-baseline.d.ts +0 -143
  750. package/src/workload-roles/account-baseline.js +0 -980
  751. package/src/workload-roles/authority.d.ts +0 -40
  752. package/src/workload-roles/authority.js +0 -202
  753. package/src/workload-roles/aws-adapter.d.ts +0 -99
  754. package/src/workload-roles/aws-adapter.js +0 -416
  755. package/src/workload-roles/aws-internal-handler.d.ts +0 -27
  756. package/src/workload-roles/aws-internal-handler.js +0 -58
  757. package/src/workload-roles/aws-s3-state.d.ts +0 -52
  758. package/src/workload-roles/aws-s3-state.js +0 -191
  759. package/src/workload-roles/aws-sdk-control-plane.d.ts +0 -12
  760. package/src/workload-roles/aws-sdk-control-plane.js +0 -291
  761. package/src/workload-roles/boundary.d.ts +0 -34
  762. package/src/workload-roles/boundary.js +0 -137
  763. package/src/workload-roles/convergence.d.ts +0 -66
  764. package/src/workload-roles/convergence.js +0 -186
  765. package/src/workload-roles/handler.d.ts +0 -43
  766. package/src/workload-roles/handler.js +0 -158
  767. package/src/workload-roles/history.d.ts +0 -47
  768. package/src/workload-roles/history.js +0 -324
  769. package/src/workload-roles/injection.d.ts +0 -119
  770. package/src/workload-roles/injection.js +0 -495
  771. package/src/workload-roles/manifest.d.ts +0 -54
  772. package/src/workload-roles/manifest.js +0 -343
  773. package/src/workload-roles/provisioner.d.ts +0 -70
  774. package/src/workload-roles/provisioner.js +0 -239
  775. package/src/workload-roles/registration.d.ts +0 -102
  776. package/src/workload-roles/registration.js +0 -462
  777. package/src/workload-roles/stage-boundary.d.ts +0 -31
  778. package/src/workload-roles/stage-boundary.js +0 -208
  779. /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.d.ts +0 -0
  780. /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.js +0 -0
@@ -1,2830 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderProductApiContractFiles = renderProductApiContractFiles;
4
- const api_contract_1 = require("@empire-builder-kit/runtime/api-contract");
5
- const index_js_1 = require("../../api-contract/index.js");
6
- const built_in_plan_event_contract_literal_js_1 = require("./built-in-plan-event-contract-literal.js");
7
- const built_in_plan_shared_js_1 = require("./built-in-plan-shared.js");
8
- const local_source_identity_js_1 = require("./local-source-identity.js");
9
- // Shared by the machine-readable contract and the generated operation source.
10
- const KEY_VALUE_RECORD_PROBLEMS = [
11
- {
12
- code: 'record_input_invalid',
13
- message: 'Record input is invalid.',
14
- retryable: false,
15
- status: 400,
16
- type: 'https://empirebuilderkit.dev/problems/records/input-invalid',
17
- },
18
- {
19
- code: 'record_idempotency_conflict',
20
- message: 'The mutation receipt does not match this exact request.',
21
- retryable: false,
22
- status: 409,
23
- type: 'https://empirebuilderkit.dev/problems/records/idempotency-conflict',
24
- },
25
- {
26
- code: 'record_write_conflict',
27
- message: 'The record changed concurrently; retry the request.',
28
- retryable: true,
29
- status: 409,
30
- type: 'https://empirebuilderkit.dev/problems/records/write-conflict',
31
- },
32
- {
33
- code: 'record_not_found',
34
- message: 'The record was not found.',
35
- retryable: false,
36
- status: 404,
37
- type: 'https://empirebuilderkit.dev/problems/records/not-found',
38
- },
39
- ];
40
- function createStandardApiContract(name, pascalName) {
41
- const authenticationProblems = [
42
- {
43
- code: 'auth_invalid_token',
44
- message: 'The access token is invalid or expired.',
45
- retryable: false,
46
- status: 401,
47
- type: 'https://empirebuilderkit.dev/problems/auth/invalid-token',
48
- },
49
- {
50
- code: 'auth_unauthenticated',
51
- message: 'Authentication is required.',
52
- retryable: false,
53
- status: 401,
54
- type: 'https://empirebuilderkit.dev/problems/auth/unauthenticated',
55
- },
56
- ];
57
- const authorizationProblems = [
58
- ...authenticationProblems,
59
- {
60
- code: 'authorization_admission_required',
61
- message: 'Required operation admission is missing.',
62
- retryable: false,
63
- status: 403,
64
- type: 'https://empirebuilderkit.dev/problems/authorization/admission-required',
65
- },
66
- {
67
- code: 'authorization_approval_required',
68
- message: 'Approval is required.',
69
- retryable: false,
70
- status: 409,
71
- type: 'https://empirebuilderkit.dev/problems/authorization/approval-required',
72
- },
73
- {
74
- code: 'authorization_denied',
75
- message: 'Authorization denied.',
76
- retryable: false,
77
- status: 403,
78
- type: 'https://empirebuilderkit.dev/problems/authorization/denied',
79
- },
80
- {
81
- code: 'authorization_input_invalid',
82
- message: 'Authorization input is invalid.',
83
- retryable: false,
84
- status: 403,
85
- type: 'https://empirebuilderkit.dev/problems/authorization/input-invalid',
86
- },
87
- {
88
- code: 'authorization_policy_stale',
89
- message: 'Authorization policy is not current.',
90
- retryable: true,
91
- status: 503,
92
- type: 'https://empirebuilderkit.dev/problems/authorization/policy-stale',
93
- },
94
- {
95
- code: 'authorization_unavailable',
96
- message: 'Authorization is temporarily unavailable.',
97
- retryable: true,
98
- status: 503,
99
- type: 'https://empirebuilderkit.dev/problems/authorization/unavailable',
100
- },
101
- ];
102
- const recordConflictProblems = [
103
- ...authorizationProblems,
104
- ...KEY_VALUE_RECORD_PROBLEMS,
105
- {
106
- code: 'record_conflict',
107
- message: 'The record identifier is owned by another principal.',
108
- retryable: false,
109
- status: 409,
110
- type: 'https://empirebuilderkit.dev/problems/records/conflict',
111
- },
112
- {
113
- code: 'record_correction_retry_required',
114
- message: 'Record correction propagation requires retry.',
115
- retryable: true,
116
- status: 503,
117
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/correction-retry-required',
118
- },
119
- {
120
- code: 'test_data_expiry_invalid',
121
- message: 'Test data expiry must be a canonical future timestamp within 48 hours.',
122
- retryable: false,
123
- status: 400,
124
- type: 'https://empirebuilderkit.dev/problems/testing/expiry-invalid',
125
- },
126
- ];
127
- const recordNotFoundProblems = [
128
- ...authorizationProblems,
129
- {
130
- code: 'record_not_found',
131
- message: 'The record was not found.',
132
- retryable: false,
133
- status: 404,
134
- type: 'https://empirebuilderkit.dev/problems/records/not-found',
135
- },
136
- ];
137
- const delegationProblems = [
138
- ...authorizationProblems,
139
- {
140
- code: 'authorization_delegation_expired',
141
- message: 'Delegated authority has expired.',
142
- retryable: false,
143
- status: 403,
144
- type: 'https://empirebuilderkit.dev/problems/authorization/delegation-expired',
145
- },
146
- {
147
- code: 'authorization_delegation_out_of_bounds',
148
- message: 'Delegated authority does not cover this request.',
149
- retryable: false,
150
- status: 403,
151
- type: 'https://empirebuilderkit.dev/problems/authorization/delegation-out-of-bounds',
152
- },
153
- {
154
- code: 'authorization_delegation_rate_limited',
155
- message: 'Delegated authority use limit has been reached.',
156
- retryable: false,
157
- status: 429,
158
- type: 'https://empirebuilderkit.dev/problems/authorization/delegation-rate-limited',
159
- },
160
- {
161
- code: 'authorization_delegation_revoked',
162
- message: 'Delegated authority has been revoked.',
163
- retryable: false,
164
- status: 403,
165
- type: 'https://empirebuilderkit.dev/problems/authorization/delegation-revoked',
166
- },
167
- ];
168
- const delegatedRecordProblems = [
169
- ...delegationProblems,
170
- {
171
- code: 'record_not_found',
172
- message: 'The record was not found.',
173
- retryable: false,
174
- status: 404,
175
- type: 'https://empirebuilderkit.dev/problems/records/not-found',
176
- },
177
- ];
178
- const deletionProblems = [
179
- ...recordNotFoundProblems,
180
- {
181
- code: 'authorization_approval_expired',
182
- message: 'Approval has expired.',
183
- retryable: false,
184
- status: 409,
185
- type: 'https://empirebuilderkit.dev/problems/authorization/approval-expired',
186
- },
187
- {
188
- code: 'authorization_approval_invalid',
189
- message: 'Approval is not valid for this request.',
190
- retryable: false,
191
- status: 409,
192
- type: 'https://empirebuilderkit.dev/problems/authorization/approval-invalid',
193
- },
194
- {
195
- code: 'authorization_approval_pending',
196
- message: 'Approval is pending.',
197
- retryable: false,
198
- status: 409,
199
- type: 'https://empirebuilderkit.dev/problems/authorization/approval-pending',
200
- },
201
- {
202
- code: 'data_deletion_held',
203
- message: 'Deletion is blocked by an active hold.',
204
- retryable: false,
205
- status: 409,
206
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/deletion-held',
207
- },
208
- {
209
- code: 'data_deletion_retry_required',
210
- message: 'Deletion propagation requires retry.',
211
- retryable: true,
212
- status: 503,
213
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/deletion-retry-required',
214
- },
215
- ];
216
- const dataRightsProblems = [
217
- ...recordNotFoundProblems,
218
- {
219
- code: 'data_export_expired',
220
- message: 'The confidential export has expired.',
221
- retryable: false,
222
- status: 410,
223
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/export-expired',
224
- },
225
- {
226
- code: 'data_export_held',
227
- message: 'An active hold blocks the confidential export.',
228
- retryable: false,
229
- status: 409,
230
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/export-held',
231
- },
232
- {
233
- code: 'data_export_not_ready',
234
- message: 'The confidential export is not ready.',
235
- retryable: false,
236
- status: 409,
237
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/export-not-ready',
238
- },
239
- {
240
- code: 'data_export_rate_limited',
241
- message: 'The bounded confidential export rate was exceeded.',
242
- retryable: false,
243
- status: 429,
244
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/export-rate-limited',
245
- },
246
- {
247
- code: 'data_export_retry_required',
248
- message: 'Confidential export processing requires retry.',
249
- retryable: true,
250
- status: 503,
251
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/export-retry-required',
252
- },
253
- {
254
- code: 'data_rights_input_invalid',
255
- message: 'The data-rights request is invalid.',
256
- retryable: false,
257
- status: 400,
258
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/input-invalid',
259
- },
260
- {
261
- code: 'record_hold_invalid',
262
- message: 'The record hold cannot make the requested transition.',
263
- retryable: false,
264
- status: 409,
265
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/hold-invalid',
266
- },
267
- ];
268
- const retentionProblems = [
269
- ...authorizationProblems,
270
- {
271
- code: 'data_retention_approval_invalid',
272
- message: 'The retention approval is invalid for this report.',
273
- retryable: false,
274
- status: 409,
275
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/retention-approval-invalid',
276
- },
277
- {
278
- code: 'data_retention_input_invalid',
279
- message: 'The retention review request is invalid.',
280
- retryable: false,
281
- status: 400,
282
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/retention-input-invalid',
283
- },
284
- {
285
- code: 'data_retention_not_reviewable',
286
- message: 'The retention report is no longer reviewable.',
287
- retryable: false,
288
- status: 409,
289
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/retention-not-reviewable',
290
- },
291
- {
292
- code: 'data_retention_report_not_found',
293
- message: 'The retention report was not found.',
294
- retryable: false,
295
- status: 404,
296
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/retention-report-not-found',
297
- },
298
- {
299
- code: 'data_retention_retry_required',
300
- message: 'Retention review persistence requires retry.',
301
- retryable: true,
302
- status: 503,
303
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/retention-retry-required',
304
- },
305
- ];
306
- const recordPath = () => (0, api_contract_1.apiObject)({
307
- recordId: (0, api_contract_1.apiString)({ format: 'uuid' }),
308
- });
309
- const deletionRequestPath = () => (0, api_contract_1.apiObject)({
310
- approvalRequestId: (0, api_contract_1.apiString)({ format: 'uuid' }),
311
- recordId: (0, api_contract_1.apiString)({ format: 'uuid' }),
312
- });
313
- const delegationPath = () => (0, api_contract_1.apiObject)({
314
- delegationId: (0, api_contract_1.apiString)({ format: 'uuid' }),
315
- recordId: (0, api_contract_1.apiString)({ format: 'uuid' }),
316
- });
317
- const exportPath = () => (0, api_contract_1.apiObject)({
318
- approvalRequestId: (0, api_contract_1.apiString)({ format: 'uuid' }),
319
- recordId: (0, api_contract_1.apiString)({ format: 'uuid' }),
320
- });
321
- const holdPath = () => (0, api_contract_1.apiObject)({
322
- holdId: (0, api_contract_1.apiString)({ maxLength: 64, minLength: 1 }),
323
- recordId: (0, api_contract_1.apiString)({ format: 'uuid' }),
324
- });
325
- const retentionApprovalPath = () => (0, api_contract_1.apiObject)({
326
- approvalRequestId: (0, api_contract_1.apiString)({ format: 'uuid' }),
327
- runId: (0, api_contract_1.apiString)({ format: 'uuid' }),
328
- });
329
- const retentionRunPath = () => (0, api_contract_1.apiObject)({
330
- runId: (0, api_contract_1.apiString)({ format: 'uuid' }),
331
- });
332
- const recordResponse = () => (0, api_contract_1.apiObject)({
333
- id: (0, api_contract_1.apiString)({ format: 'uuid' }),
334
- name: (0, api_contract_1.apiString)({ maxLength: 128, minLength: 1 }),
335
- runScope: (0, api_contract_1.apiString)({ maxLength: 128, minLength: 1 }),
336
- });
337
- const holdResponse = () => (0, api_contract_1.apiObject)({
338
- expiresAt: (0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 }),
339
- holdId: (0, api_contract_1.apiString)({ maxLength: 64, minLength: 1 }),
340
- reviewAt: (0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 }),
341
- status: (0, api_contract_1.apiString)({ enum: ['active', 'released'] }),
342
- });
343
- const health = (0, api_contract_1.defineApiOperation)({
344
- authentication: 'anonymous',
345
- authorizationActions: [],
346
- contractVersion: '1.0.0',
347
- feature: 'operations',
348
- lifecycle: { status: 'active' },
349
- method: 'GET',
350
- operationId: `${name}.health`,
351
- path: '/health',
352
- problems: [],
353
- response: {
354
- body: (0, api_contract_1.apiObject)({
355
- service: (0, api_contract_1.apiString)({ enum: [name] }),
356
- sourceCommit: (0, api_contract_1.apiString)({ maxLength: 64, minLength: 1 }),
357
- stage: (0, api_contract_1.apiString)({ maxLength: 64, minLength: 1 }),
358
- status: (0, api_contract_1.apiString)({ enum: ['ok'] }),
359
- }),
360
- status: 200,
361
- },
362
- responseProfile: 'ebk-app-v1',
363
- slice: name,
364
- summary: `Read ${pascalName} API health`,
365
- });
366
- const machineAuthorizationProof = (0, api_contract_1.defineApiOperation)({
367
- authentication: 'customer',
368
- authorizationActions: [`${name}:machine-proof-read`],
369
- contractVersion: '1.0.0',
370
- feature: 'authorization',
371
- lifecycle: { status: 'active' },
372
- method: 'GET',
373
- operationId: `${name}.machine-authorization-proof`,
374
- path: '/authorization/machine-proof',
375
- problems: authorizationProblems,
376
- response: {
377
- body: (0, api_contract_1.apiObject)({
378
- message: (0, api_contract_1.apiString)({
379
- enum: ['Machine authorization accepted.'],
380
- }),
381
- }),
382
- status: 200,
383
- },
384
- responseProfile: 'ebk-app-v1',
385
- slice: name,
386
- summary: `Prove narrow ${pascalName} machine authorization`,
387
- });
388
- const issueRecordDelegation = (0, api_contract_1.defineApiOperation)({
389
- authentication: 'customer',
390
- authorizationActions: [`${name}:record-delegation-issue`],
391
- contractVersion: '1.0.0',
392
- feature: 'authorization',
393
- lifecycle: { status: 'active' },
394
- method: 'POST',
395
- operationId: `${name}.issue-record-delegation`,
396
- path: '/records/{recordId}/delegations',
397
- problems: authorizationProblems,
398
- request: {
399
- body: (0, api_contract_1.apiObject)({
400
- expiresAt: (0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 }),
401
- purposeReference: (0, api_contract_1.apiString)({ maxLength: 256, minLength: 1 }),
402
- }),
403
- maxBodyBytes: 512,
404
- path: recordPath(),
405
- },
406
- response: {
407
- body: (0, api_contract_1.apiObject)({
408
- capability: (0, api_contract_1.apiString)({ maxLength: 43, minLength: 43 }),
409
- delegationId: (0, api_contract_1.apiString)({ format: 'uuid' }),
410
- expiresAt: (0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 }),
411
- status: (0, api_contract_1.apiString)({ enum: ['active'] }),
412
- }),
413
- status: 201,
414
- },
415
- responseProfile: 'ebk-app-v1',
416
- slice: name,
417
- summary: `Issue one attended ${pascalName} record delegation`,
418
- });
419
- const revokeRecordDelegation = (0, api_contract_1.defineApiOperation)({
420
- authentication: 'customer',
421
- authorizationActions: [`${name}:record-delegation-revoke`],
422
- contractVersion: '1.0.0',
423
- feature: 'authorization',
424
- lifecycle: { status: 'active' },
425
- method: 'DELETE',
426
- operationId: `${name}.revoke-record-delegation`,
427
- path: '/records/{recordId}/delegations/{delegationId}',
428
- problems: authorizationProblems,
429
- request: { path: delegationPath() },
430
- response: {
431
- body: (0, api_contract_1.apiObject)({
432
- delegationId: (0, api_contract_1.apiString)({ format: 'uuid' }),
433
- status: (0, api_contract_1.apiString)({ enum: ['revoked'] }),
434
- }),
435
- status: 200,
436
- },
437
- responseProfile: 'ebk-app-v1',
438
- slice: name,
439
- summary: `Revoke one attended ${pascalName} record delegation`,
440
- });
441
- const useRecordDelegation = (0, api_contract_1.defineApiOperation)({
442
- authentication: 'customer',
443
- authorizationActions: [`${name}:record-delegation-use`],
444
- contractVersion: '1.0.0',
445
- feature: 'authorization',
446
- lifecycle: { status: 'active' },
447
- method: 'POST',
448
- operationId: `${name}.use-record-delegation`,
449
- path: '/records/{recordId}/delegations/{delegationId}/use',
450
- problems: delegatedRecordProblems,
451
- request: {
452
- body: (0, api_contract_1.apiObject)({
453
- capability: (0, api_contract_1.apiString)({ maxLength: 43, minLength: 43 }),
454
- }),
455
- maxBodyBytes: 256,
456
- path: delegationPath(),
457
- },
458
- response: { body: recordResponse(), status: 200 },
459
- responseProfile: 'ebk-app-v1',
460
- slice: name,
461
- summary: `Use one attended ${pascalName} record delegation`,
462
- });
463
- const requestRecordExport = (0, api_contract_1.defineApiOperation)({
464
- authentication: 'customer',
465
- authorizationActions: [`${name}:record-export`],
466
- contractVersion: '1.0.0',
467
- feature: 'data-lifecycle',
468
- lifecycle: { status: 'active' },
469
- method: 'POST',
470
- operationId: `${name}.request-record-export`,
471
- path: '/records/{recordId}/exports',
472
- problems: dataRightsProblems,
473
- request: { path: recordPath() },
474
- response: {
475
- body: (0, api_contract_1.apiObject)({
476
- approvalRequestId: (0, api_contract_1.apiString)({ format: 'uuid' }),
477
- expiresAt: (0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 }),
478
- requestDigest: (0, api_contract_1.apiString)({ maxLength: 64, minLength: 64 }),
479
- status: (0, api_contract_1.apiString)({ enum: ['pending'] }),
480
- }),
481
- status: 202,
482
- },
483
- responseProfile: 'ebk-app-v1',
484
- slice: name,
485
- summary: `Request one subject-bound ${pascalName} record export`,
486
- });
487
- const decideRecordExport = (0, api_contract_1.defineApiOperation)({
488
- authentication: 'customer',
489
- authorizationActions: [`${name}:approval-review`],
490
- contractVersion: '1.0.0',
491
- feature: 'data-lifecycle',
492
- lifecycle: { status: 'active' },
493
- method: 'POST',
494
- operationId: `${name}.decide-record-export`,
495
- path: '/records/{recordId}/exports/{approvalRequestId}/decision',
496
- problems: dataRightsProblems,
497
- request: {
498
- body: (0, api_contract_1.apiObject)({
499
- expectedRequestDigest: (0, api_contract_1.apiString)({ maxLength: 64, minLength: 64 }),
500
- outcome: (0, api_contract_1.apiString)({ enum: ['approved', 'rejected'] }),
501
- reasonReference: (0, api_contract_1.apiString)({ maxLength: 128, minLength: 1 }),
502
- }),
503
- maxBodyBytes: 512,
504
- path: exportPath(),
505
- },
506
- response: {
507
- body: (0, api_contract_1.apiObject)({
508
- approvalRequestId: (0, api_contract_1.apiString)({ format: 'uuid' }),
509
- status: (0, api_contract_1.apiString)({ enum: ['approved', 'rejected'] }),
510
- }),
511
- status: 200,
512
- },
513
- responseProfile: 'ebk-app-v1',
514
- slice: name,
515
- summary: `Decide one ${pascalName} record export`,
516
- });
517
- const executeRecordExport = (0, api_contract_1.defineApiOperation)({
518
- authentication: 'customer',
519
- authorizationActions: [`${name}:record-export`],
520
- contractVersion: '1.0.0',
521
- feature: 'data-lifecycle',
522
- lifecycle: { status: 'active' },
523
- method: 'POST',
524
- operationId: `${name}.execute-record-export`,
525
- path: '/records/{recordId}/exports/{approvalRequestId}/execute',
526
- problems: dataRightsProblems,
527
- request: { path: exportPath() },
528
- response: {
529
- body: (0, api_contract_1.apiObject)({
530
- artifactRef: (0, api_contract_1.apiOptional)((0, api_contract_1.apiString)({ maxLength: 128, minLength: 1 })),
531
- expiresAt: (0, api_contract_1.apiOptional)((0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 })),
532
- status: (0, api_contract_1.apiString)({ enum: ['held', 'ready'] }),
533
- }),
534
- status: 200,
535
- },
536
- responseProfile: 'ebk-app-v1',
537
- slice: name,
538
- summary: `Execute one approved ${pascalName} record export`,
539
- });
540
- const deliverRecordExport = (0, api_contract_1.defineApiOperation)({
541
- authentication: 'customer',
542
- authorizationActions: [`${name}:record-export`],
543
- contractVersion: '1.0.0',
544
- feature: 'data-lifecycle',
545
- lifecycle: { status: 'active' },
546
- method: 'GET',
547
- operationId: `${name}.deliver-record-export`,
548
- path: '/records/{recordId}/exports/{approvalRequestId}/delivery',
549
- problems: dataRightsProblems,
550
- request: { path: exportPath() },
551
- response: {
552
- body: (0, api_contract_1.apiObject)({
553
- artifactRef: (0, api_contract_1.apiString)({ maxLength: 128, minLength: 1 }),
554
- deliveredAt: (0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 }),
555
- expiresAt: (0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 }),
556
- record: recordResponse(),
557
- }),
558
- status: 200,
559
- },
560
- responseProfile: 'ebk-app-v1',
561
- slice: name,
562
- summary: `Deliver one unexpired ${pascalName} record export`,
563
- });
564
- const cleanupRecordExport = (0, api_contract_1.defineApiOperation)({
565
- authentication: 'customer',
566
- authorizationActions: [`${name}:record-export-cleanup`],
567
- contractVersion: '1.0.0',
568
- feature: 'data-lifecycle',
569
- lifecycle: { status: 'active' },
570
- method: 'DELETE',
571
- operationId: `${name}.cleanup-record-export`,
572
- path: '/records/{recordId}/exports/{approvalRequestId}',
573
- problems: dataRightsProblems,
574
- request: { path: exportPath() },
575
- response: {
576
- body: (0, api_contract_1.apiObject)({
577
- deletedVersions: (0, api_contract_1.apiNumber)({ integer: true, minimum: 0 }),
578
- status: (0, api_contract_1.apiString)({
579
- enum: ['completed', 'retry-required'],
580
- }),
581
- }),
582
- status: 200,
583
- },
584
- responseProfile: 'ebk-app-v1',
585
- slice: name,
586
- summary: `Clean up one expired ${pascalName} record export`,
587
- });
588
- const requestRetentionApproval = (0, api_contract_1.defineApiOperation)({
589
- authentication: 'customer',
590
- authorizationActions: [`${name}:retention-review`],
591
- contractVersion: '1.0.0',
592
- feature: 'data-lifecycle',
593
- lifecycle: { status: 'active' },
594
- method: 'POST',
595
- operationId: `${name}.request-retention-approval`,
596
- path: '/data-retention/runs/{runId}/approval-requests',
597
- problems: retentionProblems,
598
- request: { path: retentionRunPath() },
599
- response: {
600
- body: (0, api_contract_1.apiObject)({
601
- approvalRequestId: (0, api_contract_1.apiString)({ format: 'uuid' }),
602
- expiresAt: (0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 }),
603
- requestDigest: (0, api_contract_1.apiString)({ maxLength: 64, minLength: 64 }),
604
- status: (0, api_contract_1.apiString)({ enum: ['pending'] }),
605
- }),
606
- status: 202,
607
- },
608
- responseProfile: 'ebk-app-v1',
609
- slice: name,
610
- summary: `Request direct-admin review of one ${pascalName} retention report`,
611
- });
612
- const decideRetentionApproval = (0, api_contract_1.defineApiOperation)({
613
- authentication: 'customer',
614
- authorizationActions: [`${name}:retention-review`],
615
- contractVersion: '1.0.0',
616
- feature: 'data-lifecycle',
617
- lifecycle: { status: 'active' },
618
- method: 'POST',
619
- operationId: `${name}.decide-retention-approval`,
620
- path: '/data-retention/runs/{runId}/approval-requests/{approvalRequestId}/decision',
621
- problems: retentionProblems,
622
- request: {
623
- body: (0, api_contract_1.apiObject)({
624
- expectedRequestDigest: (0, api_contract_1.apiString)({ maxLength: 64, minLength: 64 }),
625
- outcome: (0, api_contract_1.apiString)({ enum: ['approved', 'rejected'] }),
626
- reasonReference: (0, api_contract_1.apiString)({ maxLength: 128, minLength: 1 }),
627
- }),
628
- maxBodyBytes: 512,
629
- path: retentionApprovalPath(),
630
- },
631
- response: {
632
- body: (0, api_contract_1.apiObject)({
633
- approvalRequestId: (0, api_contract_1.apiString)({ format: 'uuid' }),
634
- status: (0, api_contract_1.apiString)({ enum: ['approved', 'rejected'] }),
635
- }),
636
- status: 200,
637
- },
638
- responseProfile: 'ebk-app-v1',
639
- slice: name,
640
- summary: `Decide one ${pascalName} retention approval as a non-author admin`,
641
- });
642
- const issueRecordHold = (0, api_contract_1.defineApiOperation)({
643
- authentication: 'customer',
644
- authorizationActions: [`${name}:record-hold-manage`],
645
- contractVersion: '1.0.0',
646
- feature: 'data-lifecycle',
647
- lifecycle: { status: 'active' },
648
- method: 'POST',
649
- operationId: `${name}.issue-record-hold`,
650
- path: '/records/{recordId}/holds',
651
- problems: dataRightsProblems,
652
- request: {
653
- body: (0, api_contract_1.apiObject)({
654
- effects: (0, api_contract_1.apiArray)((0, api_contract_1.apiString)({
655
- enum: ['block-deletion', 'block-export'],
656
- }), { maxItems: 2, minItems: 1 }),
657
- expiresAt: (0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 }),
658
- purpose: (0, api_contract_1.apiString)({
659
- enum: ['fraud', 'incident', 'legal', 'security', 'support'],
660
- }),
661
- reviewAt: (0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 }),
662
- }),
663
- maxBodyBytes: 512,
664
- path: recordPath(),
665
- },
666
- response: { body: holdResponse(), status: 201 },
667
- responseProfile: 'ebk-app-v1',
668
- slice: name,
669
- summary: `Issue one bounded ${pascalName} record hold`,
670
- });
671
- const reviewRecordHold = (0, api_contract_1.defineApiOperation)({
672
- authentication: 'customer',
673
- authorizationActions: [`${name}:record-hold-manage`],
674
- contractVersion: '1.0.0',
675
- feature: 'data-lifecycle',
676
- lifecycle: { status: 'active' },
677
- method: 'POST',
678
- operationId: `${name}.review-record-hold`,
679
- path: '/records/{recordId}/holds/{holdId}/review',
680
- problems: dataRightsProblems,
681
- request: {
682
- body: (0, api_contract_1.apiObject)({
683
- expiresAt: (0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 }),
684
- reviewAt: (0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 }),
685
- }),
686
- maxBodyBytes: 256,
687
- path: holdPath(),
688
- },
689
- response: { body: holdResponse(), status: 200 },
690
- responseProfile: 'ebk-app-v1',
691
- slice: name,
692
- summary: `Review one bounded ${pascalName} record hold`,
693
- });
694
- const releaseRecordHold = (0, api_contract_1.defineApiOperation)({
695
- authentication: 'customer',
696
- authorizationActions: [`${name}:record-hold-manage`],
697
- contractVersion: '1.0.0',
698
- feature: 'data-lifecycle',
699
- lifecycle: { status: 'active' },
700
- method: 'DELETE',
701
- operationId: `${name}.release-record-hold`,
702
- path: '/records/{recordId}/holds/{holdId}',
703
- problems: dataRightsProblems,
704
- request: { path: holdPath() },
705
- response: { body: holdResponse(), status: 200 },
706
- responseProfile: 'ebk-app-v1',
707
- slice: name,
708
- summary: `Release one bounded ${pascalName} record hold`,
709
- });
710
- const expireRecordHold = (0, api_contract_1.defineApiOperation)({
711
- authentication: 'customer',
712
- authorizationActions: [`${name}:record-hold-manage`],
713
- contractVersion: '1.0.0',
714
- feature: 'data-lifecycle',
715
- lifecycle: { status: 'active' },
716
- method: 'POST',
717
- operationId: `${name}.expire-record-hold`,
718
- path: '/records/{recordId}/holds/{holdId}/expire',
719
- problems: dataRightsProblems,
720
- request: { path: holdPath() },
721
- response: { body: holdResponse(), status: 200 },
722
- responseProfile: 'ebk-app-v1',
723
- slice: name,
724
- summary: `Expire one due ${pascalName} record hold`,
725
- });
726
- const protectedExample = (0, api_contract_1.defineApiOperation)({
727
- authentication: 'customer',
728
- authorizationActions: [`${name}:protected-read`],
729
- contractVersion: '1.0.0',
730
- feature: 'authorization',
731
- lifecycle: { status: 'active' },
732
- method: 'GET',
733
- operationId: `${name}.protected-example`,
734
- path: '/protected',
735
- problems: authorizationProblems,
736
- response: {
737
- body: (0, api_contract_1.apiObject)({
738
- message: (0, api_contract_1.apiString)({
739
- enum: ['Authenticated request accepted.'],
740
- }),
741
- }),
742
- status: 200,
743
- },
744
- responseProfile: 'ebk-app-v1',
745
- slice: name,
746
- summary: `Read the authenticated ${pascalName} example`,
747
- });
748
- const databaseHealth = (0, api_contract_1.defineApiOperation)({
749
- authentication: 'customer',
750
- authorizationActions: [`${name}:database-read`],
751
- contractVersion: '1.0.0',
752
- feature: 'database',
753
- lifecycle: { status: 'active' },
754
- method: 'GET',
755
- operationId: `${name}.database-health`,
756
- path: '/database-health',
757
- problems: authorizationProblems,
758
- response: {
759
- body: (0, api_contract_1.apiObject)({
760
- service: (0, api_contract_1.apiString)({ enum: [name] }),
761
- status: (0, api_contract_1.apiString)({ enum: ['ok'] }),
762
- }),
763
- status: 200,
764
- },
765
- responseProfile: 'ebk-app-v1',
766
- slice: name,
767
- summary: `Read ${pascalName} database health`,
768
- });
769
- const decideRecordDeletion = (0, api_contract_1.defineApiOperation)({
770
- authentication: 'customer',
771
- authorizationActions: [`${name}:approval-review`],
772
- contractVersion: '1.0.0',
773
- feature: 'data-lifecycle',
774
- lifecycle: { status: 'active' },
775
- method: 'POST',
776
- operationId: `${name}.decide-record-deletion`,
777
- path: '/records/{recordId}/deletion-requests/{approvalRequestId}/decision',
778
- problems: deletionProblems,
779
- request: {
780
- body: (0, api_contract_1.apiObject)({
781
- expectedRequestDigest: (0, api_contract_1.apiString)({ maxLength: 64, minLength: 64 }),
782
- outcome: (0, api_contract_1.apiString)({ enum: ['approved', 'rejected'] }),
783
- reasonReference: (0, api_contract_1.apiString)({ maxLength: 128, minLength: 1 }),
784
- }),
785
- maxBodyBytes: 512,
786
- path: deletionRequestPath(),
787
- },
788
- response: {
789
- body: (0, api_contract_1.apiObject)({
790
- approvalRequestId: (0, api_contract_1.apiString)({ format: 'uuid' }),
791
- status: (0, api_contract_1.apiString)({ enum: ['approved', 'rejected'] }),
792
- }),
793
- status: 200,
794
- },
795
- responseProfile: 'ebk-app-v1',
796
- slice: name,
797
- summary: `Decide one pending ${pascalName} record deletion`,
798
- });
799
- const deleteSyntheticRecord = (0, api_contract_1.defineApiOperation)({
800
- authentication: 'customer',
801
- authorizationActions: [`${name}:record-delete`],
802
- contractVersion: '1.0.0',
803
- feature: 'database',
804
- lifecycle: { status: 'active' },
805
- method: 'DELETE',
806
- operationId: `${name}.delete-record`,
807
- path: '/records/{recordId}',
808
- problems: deletionProblems,
809
- request: {
810
- path: recordPath(),
811
- query: (0, api_contract_1.apiObject)({
812
- approvalRequestId: (0, api_contract_1.apiString)({ format: 'uuid' }),
813
- reasonCode: (0, api_contract_1.apiString)({ maxLength: 64, minLength: 1 }),
814
- }),
815
- },
816
- response: {
817
- body: (0, api_contract_1.apiObject)({
818
- deleted: (0, api_contract_1.apiBoolean)(),
819
- id: (0, api_contract_1.apiString)({ format: 'uuid' }),
820
- deliveryPending: (0, api_contract_1.apiOptional)((0, api_contract_1.apiBoolean)()),
821
- }),
822
- status: 200,
823
- },
824
- responseProfile: 'ebk-app-v1',
825
- slice: name,
826
- summary: `Delete one owned ${pascalName} record`,
827
- });
828
- const getSyntheticRecord = (0, api_contract_1.defineApiOperation)({
829
- authentication: 'customer',
830
- authorizationActions: [`${name}:record-read`],
831
- contractVersion: '1.0.0',
832
- feature: 'database',
833
- lifecycle: { status: 'active' },
834
- method: 'GET',
835
- operationId: `${name}.get-record`,
836
- path: '/records/{recordId}',
837
- problems: recordNotFoundProblems,
838
- request: { path: recordPath() },
839
- response: { body: recordResponse(), status: 200 },
840
- responseProfile: 'ebk-app-v1',
841
- slice: name,
842
- summary: `Read one owned ${pascalName} record`,
843
- });
844
- const publishCreated = (0, api_contract_1.defineApiOperation)({
845
- authentication: 'customer',
846
- authorizationActions: [`${name}:event-publish`],
847
- contractVersion: '1.0.0',
848
- feature: 'events',
849
- lifecycle: { status: 'active' },
850
- method: 'POST',
851
- operationId: `${name}.publish-created`,
852
- path: '/events/example',
853
- problems: authorizationProblems,
854
- response: {
855
- body: (0, api_contract_1.apiObject)({
856
- eventId: (0, api_contract_1.apiString)({ format: 'uuid' }),
857
- }),
858
- status: 200,
859
- },
860
- responseProfile: 'ebk-app-v1',
861
- slice: name,
862
- summary: `Publish a ${pascalName} example event`,
863
- });
864
- const putSyntheticRecord = (0, api_contract_1.defineApiOperation)({
865
- authentication: 'customer',
866
- authorizationActions: [`${name}:record-write`],
867
- contractVersion: '1.0.0',
868
- feature: 'database',
869
- lifecycle: { status: 'active' },
870
- method: 'PUT',
871
- operationId: `${name}.put-record`,
872
- path: '/records/{recordId}',
873
- problems: recordConflictProblems,
874
- request: {
875
- body: (0, api_contract_1.apiObject)({
876
- name: (0, api_contract_1.apiString)({ maxLength: 128, minLength: 1 }),
877
- runScope: (0, api_contract_1.apiString)({ maxLength: 128, minLength: 1 }),
878
- testExpiresAt: (0, api_contract_1.apiOptional)((0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 })),
879
- }),
880
- maxBodyBytes: 512,
881
- path: recordPath(),
882
- },
883
- response: { body: recordResponse(), status: 200 },
884
- responseProfile: 'ebk-app-v1',
885
- slice: name,
886
- summary: `Create or replace one owned ${pascalName} record`,
887
- });
888
- const requestRecordDeletion = (0, api_contract_1.defineApiOperation)({
889
- authentication: 'customer',
890
- authorizationActions: [`${name}:record-delete`],
891
- contractVersion: '1.0.0',
892
- feature: 'data-lifecycle',
893
- lifecycle: { status: 'active' },
894
- method: 'POST',
895
- operationId: `${name}.request-record-deletion`,
896
- path: '/records/{recordId}/deletion-requests',
897
- problems: recordNotFoundProblems,
898
- request: {
899
- body: (0, api_contract_1.apiObject)({
900
- reasonCode: (0, api_contract_1.apiString)({ maxLength: 64, minLength: 1 }),
901
- }),
902
- maxBodyBytes: 256,
903
- path: recordPath(),
904
- },
905
- response: {
906
- body: (0, api_contract_1.apiObject)({
907
- approvalRequestId: (0, api_contract_1.apiString)({ format: 'uuid' }),
908
- expiresAt: (0, api_contract_1.apiString)({ maxLength: 40, minLength: 20 }),
909
- requestDigest: (0, api_contract_1.apiString)({ maxLength: 64, minLength: 64 }),
910
- status: (0, api_contract_1.apiString)({ enum: ['pending'] }),
911
- }),
912
- status: 202,
913
- },
914
- responseProfile: 'ebk-app-v1',
915
- slice: name,
916
- summary: `Request approval for one ${pascalName} record deletion`,
917
- });
918
- return (0, api_contract_1.defineApiContract)({
919
- operations: [
920
- cleanupRecordExport,
921
- databaseHealth,
922
- decideRecordExport,
923
- decideRecordDeletion,
924
- decideRetentionApproval,
925
- deliverRecordExport,
926
- deleteSyntheticRecord,
927
- executeRecordExport,
928
- expireRecordHold,
929
- getSyntheticRecord,
930
- health,
931
- issueRecordDelegation,
932
- issueRecordHold,
933
- machineAuthorizationProof,
934
- protectedExample,
935
- publishCreated,
936
- putSyntheticRecord,
937
- requestRecordDeletion,
938
- requestRecordExport,
939
- requestRetentionApproval,
940
- releaseRecordHold,
941
- reviewRecordHold,
942
- revokeRecordDelegation,
943
- useRecordDelegation,
944
- ],
945
- slice: name,
946
- title: `${pascalName} API`,
947
- version: '1.0.0',
948
- });
949
- }
950
- /** @internal */
951
- function renderProductApiContractFiles(name, pascalName) {
952
- const contract = createStandardApiContract(name, pascalName);
953
- const artifacts = (0, api_contract_1.createApiContractArtifacts)(contract);
954
- const baseline = (0, index_js_1.canonicalApiContractBaselineJson)((0, index_js_1.createApiContractBaseline)(artifacts.normalized));
955
- const identifierPrefix = (0, built_in_plan_shared_js_1.lowerCamelIdentifier)(pascalName);
956
- const contractIdentifier = `${identifierPrefix}ApiContract`;
957
- return {
958
- 'api/contracts/protected.ts': `import {
959
- apiArray,
960
- apiBoolean,
961
- apiNumber,
962
- apiObject,
963
- apiOptional,
964
- apiString,
965
- defineApiContract,
966
- defineApiOperation,
967
- } from '@empire-builder-kit/runtime/api-contract';
968
-
969
- const authenticationProblems = [
970
- {
971
- code: 'auth_invalid_token',
972
- message: 'The access token is invalid or expired.',
973
- retryable: false,
974
- status: 401,
975
- type: 'https://empirebuilderkit.dev/problems/auth/invalid-token',
976
- },
977
- {
978
- code: 'auth_unauthenticated',
979
- message: 'Authentication is required.',
980
- retryable: false,
981
- status: 401,
982
- type: 'https://empirebuilderkit.dev/problems/auth/unauthenticated',
983
- },
984
- ] as const;
985
-
986
- const authorizationProblems = [
987
- ...authenticationProblems,
988
- {
989
- code: 'authorization_admission_required',
990
- message: 'Required operation admission is missing.',
991
- retryable: false,
992
- status: 403,
993
- type: 'https://empirebuilderkit.dev/problems/authorization/admission-required',
994
- },
995
- {
996
- code: 'authorization_approval_required',
997
- message: 'Approval is required.',
998
- retryable: false,
999
- status: 409,
1000
- type: 'https://empirebuilderkit.dev/problems/authorization/approval-required',
1001
- },
1002
- {
1003
- code: 'authorization_denied',
1004
- message: 'Authorization denied.',
1005
- retryable: false,
1006
- status: 403,
1007
- type: 'https://empirebuilderkit.dev/problems/authorization/denied',
1008
- },
1009
- {
1010
- code: 'authorization_input_invalid',
1011
- message: 'Authorization input is invalid.',
1012
- retryable: false,
1013
- status: 403,
1014
- type: 'https://empirebuilderkit.dev/problems/authorization/input-invalid',
1015
- },
1016
- {
1017
- code: 'authorization_policy_stale',
1018
- message: 'Authorization policy is not current.',
1019
- retryable: true,
1020
- status: 503,
1021
- type: 'https://empirebuilderkit.dev/problems/authorization/policy-stale',
1022
- },
1023
- {
1024
- code: 'authorization_unavailable',
1025
- message: 'Authorization is temporarily unavailable.',
1026
- retryable: true,
1027
- status: 503,
1028
- type: 'https://empirebuilderkit.dev/problems/authorization/unavailable',
1029
- },
1030
- ] as const;
1031
-
1032
- const recordConflictProblems = [
1033
- ...authorizationProblems,
1034
- ...${JSON.stringify(KEY_VALUE_RECORD_PROBLEMS, null, 2)},
1035
- {
1036
- code: 'record_conflict',
1037
- message: 'The record identifier is owned by another principal.',
1038
- retryable: false,
1039
- status: 409,
1040
- type: 'https://empirebuilderkit.dev/problems/records/conflict',
1041
- },
1042
- {
1043
- code: 'record_correction_retry_required',
1044
- message: 'Record correction propagation requires retry.',
1045
- retryable: true,
1046
- status: 503,
1047
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/correction-retry-required',
1048
- },
1049
- {
1050
- code: 'test_data_expiry_invalid',
1051
- message:
1052
- 'Test data expiry must be a canonical future timestamp within 48 hours.',
1053
- retryable: false,
1054
- status: 400,
1055
- type: 'https://empirebuilderkit.dev/problems/testing/expiry-invalid',
1056
- },
1057
- ] as const;
1058
-
1059
- const recordNotFoundProblems = [
1060
- ...authorizationProblems,
1061
- {
1062
- code: 'record_not_found',
1063
- message: 'The record was not found.',
1064
- retryable: false,
1065
- status: 404,
1066
- type: 'https://empirebuilderkit.dev/problems/records/not-found',
1067
- },
1068
- ] as const;
1069
-
1070
- const delegationProblems = [
1071
- ...authorizationProblems,
1072
- {
1073
- code: 'authorization_delegation_expired',
1074
- message: 'Delegated authority has expired.',
1075
- retryable: false,
1076
- status: 403,
1077
- type: 'https://empirebuilderkit.dev/problems/authorization/delegation-expired',
1078
- },
1079
- {
1080
- code: 'authorization_delegation_out_of_bounds',
1081
- message: 'Delegated authority does not cover this request.',
1082
- retryable: false,
1083
- status: 403,
1084
- type: 'https://empirebuilderkit.dev/problems/authorization/delegation-out-of-bounds',
1085
- },
1086
- {
1087
- code: 'authorization_delegation_rate_limited',
1088
- message: 'Delegated authority use limit has been reached.',
1089
- retryable: false,
1090
- status: 429,
1091
- type: 'https://empirebuilderkit.dev/problems/authorization/delegation-rate-limited',
1092
- },
1093
- {
1094
- code: 'authorization_delegation_revoked',
1095
- message: 'Delegated authority has been revoked.',
1096
- retryable: false,
1097
- status: 403,
1098
- type: 'https://empirebuilderkit.dev/problems/authorization/delegation-revoked',
1099
- },
1100
- ] as const;
1101
-
1102
- const delegatedRecordProblems = [
1103
- ...delegationProblems,
1104
- {
1105
- code: 'record_not_found',
1106
- message: 'The record was not found.',
1107
- retryable: false,
1108
- status: 404,
1109
- type: 'https://empirebuilderkit.dev/problems/records/not-found',
1110
- },
1111
- ] as const;
1112
-
1113
- const deletionProblems = [
1114
- ...recordNotFoundProblems,
1115
- {
1116
- code: 'authorization_approval_expired',
1117
- message: 'Approval has expired.',
1118
- retryable: false,
1119
- status: 409,
1120
- type: 'https://empirebuilderkit.dev/problems/authorization/approval-expired',
1121
- },
1122
- {
1123
- code: 'authorization_approval_invalid',
1124
- message: 'Approval is not valid for this request.',
1125
- retryable: false,
1126
- status: 409,
1127
- type: 'https://empirebuilderkit.dev/problems/authorization/approval-invalid',
1128
- },
1129
- {
1130
- code: 'authorization_approval_pending',
1131
- message: 'Approval is pending.',
1132
- retryable: false,
1133
- status: 409,
1134
- type: 'https://empirebuilderkit.dev/problems/authorization/approval-pending',
1135
- },
1136
- {
1137
- code: 'data_deletion_held',
1138
- message: 'Deletion is blocked by an active hold.',
1139
- retryable: false,
1140
- status: 409,
1141
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/deletion-held',
1142
- },
1143
- {
1144
- code: 'data_deletion_retry_required',
1145
- message: 'Deletion propagation requires retry.',
1146
- retryable: true,
1147
- status: 503,
1148
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/deletion-retry-required',
1149
- },
1150
- ] as const;
1151
-
1152
- const dataRightsProblems = [
1153
- ...recordNotFoundProblems,
1154
- {
1155
- code: 'data_export_expired',
1156
- message: 'The confidential export has expired.',
1157
- retryable: false,
1158
- status: 410,
1159
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/export-expired',
1160
- },
1161
- {
1162
- code: 'data_export_held',
1163
- message: 'An active hold blocks the confidential export.',
1164
- retryable: false,
1165
- status: 409,
1166
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/export-held',
1167
- },
1168
- {
1169
- code: 'data_export_not_ready',
1170
- message: 'The confidential export is not ready.',
1171
- retryable: false,
1172
- status: 409,
1173
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/export-not-ready',
1174
- },
1175
- {
1176
- code: 'data_export_rate_limited',
1177
- message: 'The bounded confidential export rate was exceeded.',
1178
- retryable: false,
1179
- status: 429,
1180
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/export-rate-limited',
1181
- },
1182
- {
1183
- code: 'data_export_retry_required',
1184
- message: 'Confidential export processing requires retry.',
1185
- retryable: true,
1186
- status: 503,
1187
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/export-retry-required',
1188
- },
1189
- {
1190
- code: 'data_rights_input_invalid',
1191
- message: 'The data-rights request is invalid.',
1192
- retryable: false,
1193
- status: 400,
1194
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/input-invalid',
1195
- },
1196
- {
1197
- code: 'record_hold_invalid',
1198
- message: 'The record hold cannot make the requested transition.',
1199
- retryable: false,
1200
- status: 409,
1201
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/hold-invalid',
1202
- },
1203
- ] as const;
1204
-
1205
- const retentionProblems = [
1206
- ...authorizationProblems,
1207
- {
1208
- code: 'data_retention_approval_invalid',
1209
- message: 'The retention approval is invalid for this report.',
1210
- retryable: false,
1211
- status: 409,
1212
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/retention-approval-invalid',
1213
- },
1214
- {
1215
- code: 'data_retention_input_invalid',
1216
- message: 'The retention review request is invalid.',
1217
- retryable: false,
1218
- status: 400,
1219
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/retention-input-invalid',
1220
- },
1221
- {
1222
- code: 'data_retention_not_reviewable',
1223
- message: 'The retention report is no longer reviewable.',
1224
- retryable: false,
1225
- status: 409,
1226
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/retention-not-reviewable',
1227
- },
1228
- {
1229
- code: 'data_retention_report_not_found',
1230
- message: 'The retention report was not found.',
1231
- retryable: false,
1232
- status: 404,
1233
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/retention-report-not-found',
1234
- },
1235
- {
1236
- code: 'data_retention_retry_required',
1237
- message: 'Retention review persistence requires retry.',
1238
- retryable: true,
1239
- status: 503,
1240
- type: 'https://empirebuilderkit.dev/problems/data-lifecycle/retention-retry-required',
1241
- },
1242
- ] as const;
1243
-
1244
- const recordPath = () =>
1245
- apiObject({
1246
- recordId: apiString({ format: 'uuid' }),
1247
- });
1248
-
1249
- const deletionRequestPath = () =>
1250
- apiObject({
1251
- approvalRequestId: apiString({ format: 'uuid' }),
1252
- recordId: apiString({ format: 'uuid' }),
1253
- });
1254
-
1255
- const delegationPath = () =>
1256
- apiObject({
1257
- delegationId: apiString({ format: 'uuid' }),
1258
- recordId: apiString({ format: 'uuid' }),
1259
- });
1260
-
1261
- const exportPath = () =>
1262
- apiObject({
1263
- approvalRequestId: apiString({ format: 'uuid' }),
1264
- recordId: apiString({ format: 'uuid' }),
1265
- });
1266
-
1267
- const holdPath = () =>
1268
- apiObject({
1269
- holdId: apiString({ maxLength: 64, minLength: 1 }),
1270
- recordId: apiString({ format: 'uuid' }),
1271
- });
1272
-
1273
- const retentionApprovalPath = () =>
1274
- apiObject({
1275
- approvalRequestId: apiString({ format: 'uuid' }),
1276
- runId: apiString({ format: 'uuid' }),
1277
- });
1278
-
1279
- const retentionRunPath = () =>
1280
- apiObject({
1281
- runId: apiString({ format: 'uuid' }),
1282
- });
1283
-
1284
- const recordResponse = () =>
1285
- apiObject({
1286
- id: apiString({ format: 'uuid' }),
1287
- name: apiString({ maxLength: 128, minLength: 1 }),
1288
- runScope: apiString({ maxLength: 128, minLength: 1 }),
1289
- });
1290
-
1291
- const holdResponse = () =>
1292
- apiObject({
1293
- expiresAt: apiString({ maxLength: 40, minLength: 20 }),
1294
- holdId: apiString({ maxLength: 64, minLength: 1 }),
1295
- reviewAt: apiString({ maxLength: 40, minLength: 20 }),
1296
- status: apiString({ enum: ['active', 'released'] as const }),
1297
- });
1298
-
1299
- export const ${identifierPrefix}Health = defineApiOperation({
1300
- authentication: 'anonymous',
1301
- authorizationActions: [],
1302
- contractVersion: '1.0.0',
1303
- feature: 'operations',
1304
- lifecycle: { status: 'active' },
1305
- method: 'GET',
1306
- operationId: '${name}.health',
1307
- path: '/health',
1308
- problems: [],
1309
- response: {
1310
- body: apiObject({
1311
- service: apiString({ enum: ['${name}'] as const }),
1312
- sourceCommit: apiString({ maxLength: 64, minLength: 1 }),
1313
- stage: apiString({ maxLength: 64, minLength: 1 }),
1314
- status: apiString({ enum: ['ok'] as const }),
1315
- }),
1316
- status: 200,
1317
- },
1318
- responseProfile: 'ebk-app-v1',
1319
- slice: '${name}',
1320
- summary: 'Read ${pascalName} API health',
1321
- });
1322
-
1323
- export const ${identifierPrefix}MachineAuthorizationProof = defineApiOperation({
1324
- authentication: 'customer',
1325
- authorizationActions: ['${name}:machine-proof-read'],
1326
- contractVersion: '1.0.0',
1327
- feature: 'authorization',
1328
- lifecycle: { status: 'active' },
1329
- method: 'GET',
1330
- operationId: '${name}.machine-authorization-proof',
1331
- path: '/authorization/machine-proof',
1332
- problems: authorizationProblems,
1333
- response: {
1334
- body: apiObject({
1335
- message: apiString({
1336
- enum: ['Machine authorization accepted.'] as const,
1337
- }),
1338
- }),
1339
- status: 200,
1340
- },
1341
- responseProfile: 'ebk-app-v1',
1342
- slice: '${name}',
1343
- summary: 'Prove narrow ${pascalName} machine authorization',
1344
- });
1345
-
1346
- export const ${identifierPrefix}IssueRecordDelegation = defineApiOperation({
1347
- authentication: 'customer',
1348
- authorizationActions: ['${name}:record-delegation-issue'],
1349
- contractVersion: '1.0.0',
1350
- feature: 'authorization',
1351
- lifecycle: { status: 'active' },
1352
- method: 'POST',
1353
- operationId: '${name}.issue-record-delegation',
1354
- path: '/records/{recordId}/delegations',
1355
- problems: authorizationProblems,
1356
- request: {
1357
- body: apiObject({
1358
- expiresAt: apiString({ maxLength: 40, minLength: 20 }),
1359
- purposeReference: apiString({ maxLength: 256, minLength: 1 }),
1360
- }),
1361
- maxBodyBytes: 512,
1362
- path: recordPath(),
1363
- },
1364
- response: {
1365
- body: apiObject({
1366
- capability: apiString({ maxLength: 43, minLength: 43 }),
1367
- delegationId: apiString({ format: 'uuid' }),
1368
- expiresAt: apiString({ maxLength: 40, minLength: 20 }),
1369
- status: apiString({ enum: ['active'] as const }),
1370
- }),
1371
- status: 201,
1372
- },
1373
- responseProfile: 'ebk-app-v1',
1374
- slice: '${name}',
1375
- summary: 'Issue one attended ${pascalName} record delegation',
1376
- });
1377
-
1378
- export const ${identifierPrefix}RevokeRecordDelegation = defineApiOperation({
1379
- authentication: 'customer',
1380
- authorizationActions: ['${name}:record-delegation-revoke'],
1381
- contractVersion: '1.0.0',
1382
- feature: 'authorization',
1383
- lifecycle: { status: 'active' },
1384
- method: 'DELETE',
1385
- operationId: '${name}.revoke-record-delegation',
1386
- path: '/records/{recordId}/delegations/{delegationId}',
1387
- problems: authorizationProblems,
1388
- request: { path: delegationPath() },
1389
- response: {
1390
- body: apiObject({
1391
- delegationId: apiString({ format: 'uuid' }),
1392
- status: apiString({ enum: ['revoked'] as const }),
1393
- }),
1394
- status: 200,
1395
- },
1396
- responseProfile: 'ebk-app-v1',
1397
- slice: '${name}',
1398
- summary: 'Revoke one attended ${pascalName} record delegation',
1399
- });
1400
-
1401
- export const ${identifierPrefix}UseRecordDelegation = defineApiOperation({
1402
- authentication: 'customer',
1403
- authorizationActions: ['${name}:record-delegation-use'],
1404
- contractVersion: '1.0.0',
1405
- feature: 'authorization',
1406
- lifecycle: { status: 'active' },
1407
- method: 'POST',
1408
- operationId: '${name}.use-record-delegation',
1409
- path: '/records/{recordId}/delegations/{delegationId}/use',
1410
- problems: delegatedRecordProblems,
1411
- request: {
1412
- body: apiObject({
1413
- capability: apiString({ maxLength: 43, minLength: 43 }),
1414
- }),
1415
- maxBodyBytes: 256,
1416
- path: delegationPath(),
1417
- },
1418
- response: { body: recordResponse(), status: 200 },
1419
- responseProfile: 'ebk-app-v1',
1420
- slice: '${name}',
1421
- summary: 'Use one attended ${pascalName} record delegation',
1422
- });
1423
-
1424
- export const ${identifierPrefix}RequestRecordExport = defineApiOperation({
1425
- authentication: 'customer',
1426
- authorizationActions: ['${name}:record-export'],
1427
- contractVersion: '1.0.0',
1428
- feature: 'data-lifecycle',
1429
- lifecycle: { status: 'active' },
1430
- method: 'POST',
1431
- operationId: '${name}.request-record-export',
1432
- path: '/records/{recordId}/exports',
1433
- problems: dataRightsProblems,
1434
- request: { path: recordPath() },
1435
- response: {
1436
- body: apiObject({
1437
- approvalRequestId: apiString({ format: 'uuid' }),
1438
- expiresAt: apiString({ maxLength: 40, minLength: 20 }),
1439
- requestDigest: apiString({ maxLength: 64, minLength: 64 }),
1440
- status: apiString({ enum: ['pending'] as const }),
1441
- }),
1442
- status: 202,
1443
- },
1444
- responseProfile: 'ebk-app-v1',
1445
- slice: '${name}',
1446
- summary: 'Request one subject-bound ${pascalName} record export',
1447
- });
1448
-
1449
- export const ${identifierPrefix}DecideRecordExport = defineApiOperation({
1450
- authentication: 'customer',
1451
- authorizationActions: ['${name}:approval-review'],
1452
- contractVersion: '1.0.0',
1453
- feature: 'data-lifecycle',
1454
- lifecycle: { status: 'active' },
1455
- method: 'POST',
1456
- operationId: '${name}.decide-record-export',
1457
- path: '/records/{recordId}/exports/{approvalRequestId}/decision',
1458
- problems: dataRightsProblems,
1459
- request: {
1460
- body: apiObject({
1461
- expectedRequestDigest: apiString({ maxLength: 64, minLength: 64 }),
1462
- outcome: apiString({ enum: ['approved', 'rejected'] as const }),
1463
- reasonReference: apiString({ maxLength: 128, minLength: 1 }),
1464
- }),
1465
- maxBodyBytes: 512,
1466
- path: exportPath(),
1467
- },
1468
- response: {
1469
- body: apiObject({
1470
- approvalRequestId: apiString({ format: 'uuid' }),
1471
- status: apiString({ enum: ['approved', 'rejected'] as const }),
1472
- }),
1473
- status: 200,
1474
- },
1475
- responseProfile: 'ebk-app-v1',
1476
- slice: '${name}',
1477
- summary: 'Decide one ${pascalName} record export',
1478
- });
1479
-
1480
- export const ${identifierPrefix}ExecuteRecordExport = defineApiOperation({
1481
- authentication: 'customer',
1482
- authorizationActions: ['${name}:record-export'],
1483
- contractVersion: '1.0.0',
1484
- feature: 'data-lifecycle',
1485
- lifecycle: { status: 'active' },
1486
- method: 'POST',
1487
- operationId: '${name}.execute-record-export',
1488
- path: '/records/{recordId}/exports/{approvalRequestId}/execute',
1489
- problems: dataRightsProblems,
1490
- request: { path: exportPath() },
1491
- response: {
1492
- body: apiObject({
1493
- artifactRef: apiOptional(
1494
- apiString({ maxLength: 128, minLength: 1 }),
1495
- ),
1496
- expiresAt: apiOptional(
1497
- apiString({ maxLength: 40, minLength: 20 }),
1498
- ),
1499
- status: apiString({ enum: ['held', 'ready'] as const }),
1500
- }),
1501
- status: 200,
1502
- },
1503
- responseProfile: 'ebk-app-v1',
1504
- slice: '${name}',
1505
- summary: 'Execute one approved ${pascalName} record export',
1506
- });
1507
-
1508
- export const ${identifierPrefix}DeliverRecordExport = defineApiOperation({
1509
- authentication: 'customer',
1510
- authorizationActions: ['${name}:record-export'],
1511
- contractVersion: '1.0.0',
1512
- feature: 'data-lifecycle',
1513
- lifecycle: { status: 'active' },
1514
- method: 'GET',
1515
- operationId: '${name}.deliver-record-export',
1516
- path: '/records/{recordId}/exports/{approvalRequestId}/delivery',
1517
- problems: dataRightsProblems,
1518
- request: { path: exportPath() },
1519
- response: {
1520
- body: apiObject({
1521
- artifactRef: apiString({ maxLength: 128, minLength: 1 }),
1522
- deliveredAt: apiString({ maxLength: 40, minLength: 20 }),
1523
- expiresAt: apiString({ maxLength: 40, minLength: 20 }),
1524
- record: recordResponse(),
1525
- }),
1526
- status: 200,
1527
- },
1528
- responseProfile: 'ebk-app-v1',
1529
- slice: '${name}',
1530
- summary: 'Deliver one unexpired ${pascalName} record export',
1531
- });
1532
-
1533
- export const ${identifierPrefix}CleanupRecordExport = defineApiOperation({
1534
- authentication: 'customer',
1535
- authorizationActions: ['${name}:record-export-cleanup'],
1536
- contractVersion: '1.0.0',
1537
- feature: 'data-lifecycle',
1538
- lifecycle: { status: 'active' },
1539
- method: 'DELETE',
1540
- operationId: '${name}.cleanup-record-export',
1541
- path: '/records/{recordId}/exports/{approvalRequestId}',
1542
- problems: dataRightsProblems,
1543
- request: { path: exportPath() },
1544
- response: {
1545
- body: apiObject({
1546
- deletedVersions: apiNumber({ integer: true, minimum: 0 }),
1547
- status: apiString({
1548
- enum: ['completed', 'retry-required'] as const,
1549
- }),
1550
- }),
1551
- status: 200,
1552
- },
1553
- responseProfile: 'ebk-app-v1',
1554
- slice: '${name}',
1555
- summary: 'Clean up one expired ${pascalName} record export',
1556
- });
1557
-
1558
- export const ${identifierPrefix}RequestRetentionApproval =
1559
- defineApiOperation({
1560
- authentication: 'customer',
1561
- authorizationActions: ['${name}:retention-review'],
1562
- contractVersion: '1.0.0',
1563
- feature: 'data-lifecycle',
1564
- lifecycle: { status: 'active' },
1565
- method: 'POST',
1566
- operationId: '${name}.request-retention-approval',
1567
- path: '/data-retention/runs/{runId}/approval-requests',
1568
- problems: retentionProblems,
1569
- request: { path: retentionRunPath() },
1570
- response: {
1571
- body: apiObject({
1572
- approvalRequestId: apiString({ format: 'uuid' }),
1573
- expiresAt: apiString({ maxLength: 40, minLength: 20 }),
1574
- requestDigest: apiString({ maxLength: 64, minLength: 64 }),
1575
- status: apiString({ enum: ['pending'] as const }),
1576
- }),
1577
- status: 202,
1578
- },
1579
- responseProfile: 'ebk-app-v1',
1580
- slice: '${name}',
1581
- summary:
1582
- 'Request direct-admin review of one ${pascalName} retention report',
1583
- });
1584
-
1585
- export const ${identifierPrefix}DecideRetentionApproval =
1586
- defineApiOperation({
1587
- authentication: 'customer',
1588
- authorizationActions: ['${name}:retention-review'],
1589
- contractVersion: '1.0.0',
1590
- feature: 'data-lifecycle',
1591
- lifecycle: { status: 'active' },
1592
- method: 'POST',
1593
- operationId: '${name}.decide-retention-approval',
1594
- path:
1595
- '/data-retention/runs/{runId}/approval-requests/{approvalRequestId}/decision',
1596
- problems: retentionProblems,
1597
- request: {
1598
- body: apiObject({
1599
- expectedRequestDigest: apiString({ maxLength: 64, minLength: 64 }),
1600
- outcome: apiString({ enum: ['approved', 'rejected'] as const }),
1601
- reasonReference: apiString({ maxLength: 128, minLength: 1 }),
1602
- }),
1603
- maxBodyBytes: 512,
1604
- path: retentionApprovalPath(),
1605
- },
1606
- response: {
1607
- body: apiObject({
1608
- approvalRequestId: apiString({ format: 'uuid' }),
1609
- status: apiString({ enum: ['approved', 'rejected'] as const }),
1610
- }),
1611
- status: 200,
1612
- },
1613
- responseProfile: 'ebk-app-v1',
1614
- slice: '${name}',
1615
- summary:
1616
- 'Decide one ${pascalName} retention approval as a non-author admin',
1617
- });
1618
-
1619
- export const ${identifierPrefix}IssueRecordHold = defineApiOperation({
1620
- authentication: 'customer',
1621
- authorizationActions: ['${name}:record-hold-manage'],
1622
- contractVersion: '1.0.0',
1623
- feature: 'data-lifecycle',
1624
- lifecycle: { status: 'active' },
1625
- method: 'POST',
1626
- operationId: '${name}.issue-record-hold',
1627
- path: '/records/{recordId}/holds',
1628
- problems: dataRightsProblems,
1629
- request: {
1630
- body: apiObject({
1631
- effects: apiArray(
1632
- apiString({
1633
- enum: ['block-deletion', 'block-export'] as const,
1634
- }),
1635
- { maxItems: 2, minItems: 1 },
1636
- ),
1637
- expiresAt: apiString({ maxLength: 40, minLength: 20 }),
1638
- purpose: apiString({
1639
- enum: ['fraud', 'incident', 'legal', 'security', 'support'] as const,
1640
- }),
1641
- reviewAt: apiString({ maxLength: 40, minLength: 20 }),
1642
- }),
1643
- maxBodyBytes: 512,
1644
- path: recordPath(),
1645
- },
1646
- response: { body: holdResponse(), status: 201 },
1647
- responseProfile: 'ebk-app-v1',
1648
- slice: '${name}',
1649
- summary: 'Issue one bounded ${pascalName} record hold',
1650
- });
1651
-
1652
- export const ${identifierPrefix}ReviewRecordHold = defineApiOperation({
1653
- authentication: 'customer',
1654
- authorizationActions: ['${name}:record-hold-manage'],
1655
- contractVersion: '1.0.0',
1656
- feature: 'data-lifecycle',
1657
- lifecycle: { status: 'active' },
1658
- method: 'POST',
1659
- operationId: '${name}.review-record-hold',
1660
- path: '/records/{recordId}/holds/{holdId}/review',
1661
- problems: dataRightsProblems,
1662
- request: {
1663
- body: apiObject({
1664
- expiresAt: apiString({ maxLength: 40, minLength: 20 }),
1665
- reviewAt: apiString({ maxLength: 40, minLength: 20 }),
1666
- }),
1667
- maxBodyBytes: 256,
1668
- path: holdPath(),
1669
- },
1670
- response: { body: holdResponse(), status: 200 },
1671
- responseProfile: 'ebk-app-v1',
1672
- slice: '${name}',
1673
- summary: 'Review one bounded ${pascalName} record hold',
1674
- });
1675
-
1676
- export const ${identifierPrefix}ReleaseRecordHold = defineApiOperation({
1677
- authentication: 'customer',
1678
- authorizationActions: ['${name}:record-hold-manage'],
1679
- contractVersion: '1.0.0',
1680
- feature: 'data-lifecycle',
1681
- lifecycle: { status: 'active' },
1682
- method: 'DELETE',
1683
- operationId: '${name}.release-record-hold',
1684
- path: '/records/{recordId}/holds/{holdId}',
1685
- problems: dataRightsProblems,
1686
- request: { path: holdPath() },
1687
- response: { body: holdResponse(), status: 200 },
1688
- responseProfile: 'ebk-app-v1',
1689
- slice: '${name}',
1690
- summary: 'Release one bounded ${pascalName} record hold',
1691
- });
1692
-
1693
- export const ${identifierPrefix}ExpireRecordHold = defineApiOperation({
1694
- authentication: 'customer',
1695
- authorizationActions: ['${name}:record-hold-manage'],
1696
- contractVersion: '1.0.0',
1697
- feature: 'data-lifecycle',
1698
- lifecycle: { status: 'active' },
1699
- method: 'POST',
1700
- operationId: '${name}.expire-record-hold',
1701
- path: '/records/{recordId}/holds/{holdId}/expire',
1702
- problems: dataRightsProblems,
1703
- request: { path: holdPath() },
1704
- response: { body: holdResponse(), status: 200 },
1705
- responseProfile: 'ebk-app-v1',
1706
- slice: '${name}',
1707
- summary: 'Expire one due ${pascalName} record hold',
1708
- });
1709
-
1710
- export const ${identifierPrefix}ProtectedExample = defineApiOperation({
1711
- authentication: 'customer',
1712
- authorizationActions: ['${name}:protected-read'],
1713
- contractVersion: '1.0.0',
1714
- feature: 'authorization',
1715
- lifecycle: { status: 'active' },
1716
- method: 'GET',
1717
- operationId: '${name}.protected-example',
1718
- path: '/protected',
1719
- problems: authorizationProblems,
1720
- response: {
1721
- body: apiObject({
1722
- message: apiString({
1723
- enum: ['Authenticated request accepted.'] as const,
1724
- }),
1725
- }),
1726
- status: 200,
1727
- },
1728
- responseProfile: 'ebk-app-v1',
1729
- slice: '${name}',
1730
- summary: 'Read the authenticated ${pascalName} example',
1731
- });
1732
-
1733
- export const ${identifierPrefix}DatabaseHealth = defineApiOperation({
1734
- authentication: 'customer',
1735
- authorizationActions: ['${name}:database-read'],
1736
- contractVersion: '1.0.0',
1737
- feature: 'database',
1738
- lifecycle: { status: 'active' },
1739
- method: 'GET',
1740
- operationId: '${name}.database-health',
1741
- path: '/database-health',
1742
- problems: authorizationProblems,
1743
- response: {
1744
- body: apiObject({
1745
- service: apiString({ enum: ['${name}'] as const }),
1746
- status: apiString({ enum: ['ok'] as const }),
1747
- }),
1748
- status: 200,
1749
- },
1750
- responseProfile: 'ebk-app-v1',
1751
- slice: '${name}',
1752
- summary: 'Read ${pascalName} database health',
1753
- });
1754
-
1755
- export const ${identifierPrefix}DecideRecordDeletion = defineApiOperation({
1756
- authentication: 'customer',
1757
- authorizationActions: ['${name}:approval-review'],
1758
- contractVersion: '1.0.0',
1759
- feature: 'data-lifecycle',
1760
- lifecycle: { status: 'active' },
1761
- method: 'POST',
1762
- operationId: '${name}.decide-record-deletion',
1763
- path: '/records/{recordId}/deletion-requests/{approvalRequestId}/decision',
1764
- problems: deletionProblems,
1765
- request: {
1766
- body: apiObject({
1767
- expectedRequestDigest: apiString({ maxLength: 64, minLength: 64 }),
1768
- outcome: apiString({ enum: ['approved', 'rejected'] as const }),
1769
- reasonReference: apiString({ maxLength: 128, minLength: 1 }),
1770
- }),
1771
- maxBodyBytes: 512,
1772
- path: deletionRequestPath(),
1773
- },
1774
- response: {
1775
- body: apiObject({
1776
- approvalRequestId: apiString({ format: 'uuid' }),
1777
- status: apiString({ enum: ['approved', 'rejected'] as const }),
1778
- }),
1779
- status: 200,
1780
- },
1781
- responseProfile: 'ebk-app-v1',
1782
- slice: '${name}',
1783
- summary: 'Decide one pending ${pascalName} record deletion',
1784
- });
1785
-
1786
- export const ${identifierPrefix}DeleteRecord = defineApiOperation({
1787
- authentication: 'customer',
1788
- authorizationActions: ['${name}:record-delete'],
1789
- contractVersion: '1.0.0',
1790
- feature: 'database',
1791
- lifecycle: { status: 'active' },
1792
- method: 'DELETE',
1793
- operationId: '${name}.delete-record',
1794
- path: '/records/{recordId}',
1795
- problems: deletionProblems,
1796
- request: {
1797
- path: recordPath(),
1798
- query: apiObject({
1799
- approvalRequestId: apiString({ format: 'uuid' }),
1800
- reasonCode: apiString({ maxLength: 64, minLength: 1 }),
1801
- }),
1802
- },
1803
- response: {
1804
- body: apiObject({
1805
- deleted: apiBoolean(),
1806
- id: apiString({ format: 'uuid' }),
1807
- deliveryPending: apiOptional(apiBoolean()),
1808
- }),
1809
- status: 200,
1810
- },
1811
- responseProfile: 'ebk-app-v1',
1812
- slice: '${name}',
1813
- summary: 'Delete one owned ${pascalName} record',
1814
- });
1815
-
1816
- export const ${identifierPrefix}GetRecord = defineApiOperation({
1817
- authentication: 'customer',
1818
- authorizationActions: ['${name}:record-read'],
1819
- contractVersion: '1.0.0',
1820
- feature: 'database',
1821
- lifecycle: { status: 'active' },
1822
- method: 'GET',
1823
- operationId: '${name}.get-record',
1824
- path: '/records/{recordId}',
1825
- problems: recordNotFoundProblems,
1826
- request: { path: recordPath() },
1827
- response: { body: recordResponse(), status: 200 },
1828
- responseProfile: 'ebk-app-v1',
1829
- slice: '${name}',
1830
- summary: 'Read one owned ${pascalName} record',
1831
- });
1832
-
1833
- export const ${identifierPrefix}PublishCreated = defineApiOperation({
1834
- authentication: 'customer',
1835
- authorizationActions: ['${name}:event-publish'],
1836
- contractVersion: '1.0.0',
1837
- feature: 'events',
1838
- lifecycle: { status: 'active' },
1839
- method: 'POST',
1840
- operationId: '${name}.publish-created',
1841
- path: '/events/example',
1842
- problems: authorizationProblems,
1843
- response: {
1844
- body: apiObject({
1845
- eventId: apiString({ format: 'uuid' }),
1846
- }),
1847
- status: 200,
1848
- },
1849
- responseProfile: 'ebk-app-v1',
1850
- slice: '${name}',
1851
- summary: 'Publish a ${pascalName} example event',
1852
- });
1853
-
1854
- export const ${identifierPrefix}PutRecord = defineApiOperation({
1855
- authentication: 'customer',
1856
- authorizationActions: ['${name}:record-write'],
1857
- contractVersion: '1.0.0',
1858
- feature: 'database',
1859
- lifecycle: { status: 'active' },
1860
- method: 'PUT',
1861
- operationId: '${name}.put-record',
1862
- path: '/records/{recordId}',
1863
- problems: recordConflictProblems,
1864
- request: {
1865
- body: apiObject({
1866
- name: apiString({ maxLength: 128, minLength: 1 }),
1867
- runScope: apiString({ maxLength: 128, minLength: 1 }),
1868
- testExpiresAt: apiOptional(
1869
- apiString({ maxLength: 40, minLength: 20 }),
1870
- ),
1871
- }),
1872
- maxBodyBytes: 512,
1873
- path: recordPath(),
1874
- },
1875
- response: { body: recordResponse(), status: 200 },
1876
- responseProfile: 'ebk-app-v1',
1877
- slice: '${name}',
1878
- summary: 'Create or replace one owned ${pascalName} record',
1879
- });
1880
-
1881
- export const ${identifierPrefix}RequestRecordDeletion = defineApiOperation({
1882
- authentication: 'customer',
1883
- authorizationActions: ['${name}:record-delete'],
1884
- contractVersion: '1.0.0',
1885
- feature: 'data-lifecycle',
1886
- lifecycle: { status: 'active' },
1887
- method: 'POST',
1888
- operationId: '${name}.request-record-deletion',
1889
- path: '/records/{recordId}/deletion-requests',
1890
- problems: recordNotFoundProblems,
1891
- request: {
1892
- body: apiObject({
1893
- reasonCode: apiString({ maxLength: 64, minLength: 1 }),
1894
- }),
1895
- maxBodyBytes: 256,
1896
- path: recordPath(),
1897
- },
1898
- response: {
1899
- body: apiObject({
1900
- approvalRequestId: apiString({ format: 'uuid' }),
1901
- expiresAt: apiString({ maxLength: 40, minLength: 20 }),
1902
- requestDigest: apiString({ maxLength: 64, minLength: 64 }),
1903
- status: apiString({ enum: ['pending'] as const }),
1904
- }),
1905
- status: 202,
1906
- },
1907
- responseProfile: 'ebk-app-v1',
1908
- slice: '${name}',
1909
- summary: 'Request approval for one ${pascalName} record deletion',
1910
- });
1911
-
1912
- export const ${contractIdentifier} = defineApiContract({
1913
- operations: [
1914
- ${identifierPrefix}CleanupRecordExport,
1915
- ${identifierPrefix}DatabaseHealth,
1916
- ${identifierPrefix}DecideRecordExport,
1917
- ${identifierPrefix}DecideRecordDeletion,
1918
- ${identifierPrefix}DecideRetentionApproval,
1919
- ${identifierPrefix}DeliverRecordExport,
1920
- ${identifierPrefix}DeleteRecord,
1921
- ${identifierPrefix}ExecuteRecordExport,
1922
- ${identifierPrefix}ExpireRecordHold,
1923
- ${identifierPrefix}GetRecord,
1924
- ${identifierPrefix}Health,
1925
- ${identifierPrefix}IssueRecordDelegation,
1926
- ${identifierPrefix}IssueRecordHold,
1927
- ${identifierPrefix}MachineAuthorizationProof,
1928
- ${identifierPrefix}ProtectedExample,
1929
- ${identifierPrefix}PublishCreated,
1930
- ${identifierPrefix}PutRecord,
1931
- ${identifierPrefix}RequestRecordDeletion,
1932
- ${identifierPrefix}RequestRecordExport,
1933
- ${identifierPrefix}RequestRetentionApproval,
1934
- ${identifierPrefix}ReleaseRecordHold,
1935
- ${identifierPrefix}ReviewRecordHold,
1936
- ${identifierPrefix}RevokeRecordDelegation,
1937
- ${identifierPrefix}UseRecordDelegation,
1938
- ] as const,
1939
- slice: '${name}',
1940
- title: '${pascalName} API',
1941
- version: '1.0.0',
1942
- });
1943
- `,
1944
- 'api/contracts/index.ts': `export {
1945
- ${contractIdentifier},
1946
- ${identifierPrefix}CleanupRecordExport,
1947
- ${identifierPrefix}DatabaseHealth,
1948
- ${identifierPrefix}DecideRecordExport,
1949
- ${identifierPrefix}DecideRecordDeletion,
1950
- ${identifierPrefix}DecideRetentionApproval,
1951
- ${identifierPrefix}DeliverRecordExport,
1952
- ${identifierPrefix}DeleteRecord,
1953
- ${identifierPrefix}ExecuteRecordExport,
1954
- ${identifierPrefix}ExpireRecordHold,
1955
- ${identifierPrefix}GetRecord,
1956
- ${identifierPrefix}Health,
1957
- ${identifierPrefix}IssueRecordDelegation,
1958
- ${identifierPrefix}IssueRecordHold,
1959
- ${identifierPrefix}MachineAuthorizationProof,
1960
- ${identifierPrefix}ProtectedExample,
1961
- ${identifierPrefix}PublishCreated,
1962
- ${identifierPrefix}PutRecord,
1963
- ${identifierPrefix}RequestRecordDeletion,
1964
- ${identifierPrefix}RequestRecordExport,
1965
- ${identifierPrefix}RequestRetentionApproval,
1966
- ${identifierPrefix}ReleaseRecordHold,
1967
- ${identifierPrefix}ReviewRecordHold,
1968
- ${identifierPrefix}RevokeRecordDelegation,
1969
- ${identifierPrefix}UseRecordDelegation,
1970
- } from './protected.js';
1971
- `,
1972
- 'api/generated/client.ts': `import {
1973
- createApiContractClient,
1974
- type ApiContractClient,
1975
- type CreateApiClientOptions,
1976
- } from '@empire-builder-kit/runtime/api-client';
1977
- import { ${contractIdentifier} } from '../contracts/index.js';
1978
-
1979
- export type ${pascalName}ApiClient = ApiContractClient<
1980
- typeof ${contractIdentifier}
1981
- >;
1982
-
1983
- export function create${pascalName}ApiClient(
1984
- options: CreateApiClientOptions,
1985
- ): ${pascalName}ApiClient {
1986
- return createApiContractClient(${contractIdentifier}, options);
1987
- }
1988
- `,
1989
- 'api/generated/contract.json': artifacts.normalizedJson,
1990
- 'api/generated/openapi.json': artifacts.openApiJson,
1991
- 'api/generated/baseline.json': baseline,
1992
- 'docs/api-contracts.md': `# ${name} synchronous API
1993
-
1994
- Author operation behavior in \`api/contracts/\`. The TypeScript contract is the
1995
- source of truth. The normalized contract, OpenAPI document, and browser-safe
1996
- client under \`api/generated/\` are managed output. The seeded compatibility
1997
- baseline is reviewed product state and is never restamped by regeneration.
1998
-
1999
- Transport declarations must be lossless on the wire. String request headers
2000
- use \`apiString({ format: 'ebk-http-header-value' })\`: visible ASCII only,
2001
- at most 8 KiB, with no empty value, leading or trailing whitespace, controls,
2002
- DEL, or non-ASCII. Path strings must exclude the empty value, and repeated
2003
- query arrays must require at least one item.
2004
-
2005
- Every actionable authentication or authorization failure must be declared by
2006
- the operation contract. An undeclared or inconsistent failure is treated as a
2007
- contract defect and returned as a sanitized 500 response, never improvised as
2008
- a new wire-visible 401 or 403 response.
2009
-
2010
- Run \`pnpm nx run ${name}:api-contract-generate\` after changing an operation,
2011
- then inspect the generated diff and run
2012
- \`pnpm nx run ${name}:api-contract-check\`. The check is report-first and never
2013
- updates the accepted baseline.
2014
-
2015
- An intentional baseline update requires a reviewed JSON approval:
2016
-
2017
- \`\`\`sh
2018
- pnpm nx run ${name}:api-contract-baseline -- --approval=path/to/approval.json
2019
- \`\`\`
2020
-
2021
- An agent may author the approval file. Compatible approvals pin the exact
2022
- candidate digest and reason, and the agent may apply them directly during
2023
- development. Conditional approvals also require semantic-review evidence, and
2024
- breaking approvals require consumer evidence, rollout evidence, and an exact
2025
- rollout-plan identity and digest; a human reviews those two classes before the
2026
- baseline command runs. Baseline updates never occur during generation or
2027
- verification.
2028
-
2029
- Other Slices may import only \`@<workspace>/${name}/api-contract\`,
2030
- \`@<workspace>/${name}/api-client\`, or the transport-neutral
2031
- \`@<workspace>/${name}/contracts\` surface. They may not import handlers,
2032
- database code, or other implementation paths.
2033
- `,
2034
- 'scripts/contract-dependencies.mjs': `import {
2035
- existsSync,
2036
- readFileSync,
2037
- realpathSync,
2038
- readdirSync,
2039
- statSync,
2040
- writeFileSync,
2041
- } from 'node:fs';
2042
- import { createRequire } from 'node:module';
2043
- import { isAbsolute, join, relative, resolve, sep } from 'node:path';
2044
- import ts from 'typescript';
2045
-
2046
- const require = createRequire(import.meta.url);
2047
- const {
2048
- normalizeApiContractProjectDeclarations,
2049
- resolveApiContractDependencies,
2050
- } = require('@empire-builder-kit/nx/api-contract');
2051
- const {
2052
- validateGeneratedOwnershipRecord,
2053
- } = require('@empire-builder-kit/nx/ownership');
2054
-
2055
- const projectRoot = process.cwd();
2056
- const workspaceRoot = resolve(projectRoot, '../..');
2057
- const action = process.argv[2] ?? 'check';
2058
- if (action !== 'check' && action !== 'sync') {
2059
- throw new Error(
2060
- 'Usage: node scripts/contract-dependencies.mjs <check|sync>',
2061
- );
2062
- }
2063
- const readJson = (path) => {
2064
- const contents = readFileSync(path, 'utf8');
2065
- try {
2066
- return JSON.parse(contents);
2067
- } catch (error) {
2068
- const qualifiedPath = relative(workspaceRoot, path)
2069
- .split(sep)
2070
- .join('/');
2071
- throw new Error(
2072
- qualifiedPath +
2073
- ' contains malformed JSON: ' +
2074
- (error instanceof Error ? error.message : String(error)),
2075
- );
2076
- }
2077
- };
2078
- const declarationPath = join(
2079
- projectRoot,
2080
- 'contracts',
2081
- 'dependencies.json',
2082
- );
2083
- const ownershipPath = join(projectRoot, '.ebk', 'ownership.json');
2084
- const allowedContractExports = new Map([
2085
- ['./api-client', { exact: 'api/generated/client.ts' }],
2086
- ['./api-contract', { surface: 'api/contracts' }],
2087
- ['./contracts', { exact: 'contracts/index.ts' }],
2088
- ]);
2089
-
2090
- function isContained(root, candidate) {
2091
- const pathFromRoot = relative(root, candidate);
2092
- return (
2093
- pathFromRoot !== '..' &&
2094
- !pathFromRoot.startsWith('..' + sep) &&
2095
- !isAbsolute(pathFromRoot)
2096
- );
2097
- }
2098
-
2099
- function declaredExportTargets(declaration, packageName, exportName) {
2100
- if (typeof declaration === 'string') return [declaration];
2101
- if (
2102
- !declaration ||
2103
- typeof declaration !== 'object' ||
2104
- Array.isArray(declaration) ||
2105
- Object.keys(declaration).length === 0 ||
2106
- Object.values(declaration).some((target) => typeof target !== 'string')
2107
- ) {
2108
- throw new Error(
2109
- 'Package ' +
2110
- packageName +
2111
- ' has an invalid conditional export for ' +
2112
- exportName +
2113
- '.',
2114
- );
2115
- }
2116
- return Object.values(declaration);
2117
- }
2118
-
2119
- function validateContractExports(root, packageJson, publications) {
2120
- const exports = packageJson.exports;
2121
- const packagePrefix = packageJson.name + '/';
2122
- const requiredExports = new Set();
2123
- for (const publication of publications) {
2124
- if (publication === packagePrefix + 'api-contract') {
2125
- requiredExports.add('./api-client');
2126
- requiredExports.add('./api-contract');
2127
- } else if (publication === packagePrefix + 'contracts') {
2128
- requiredExports.add('./contracts');
2129
- }
2130
- }
2131
- for (const exportName of [...requiredExports].sort()) {
2132
- const expected = allowedContractExports.get(exportName);
2133
- if (!expected) {
2134
- throw new Error(
2135
- 'Package ' +
2136
- packageJson.name +
2137
- ' requires an unsupported contract export ' +
2138
- exportName +
2139
- '.',
2140
- );
2141
- }
2142
- if (!exports || !Object.hasOwn(exports, exportName)) {
2143
- throw new Error(
2144
- 'Package ' +
2145
- packageJson.name +
2146
- ' is missing contract export ' +
2147
- exportName +
2148
- '.',
2149
- );
2150
- }
2151
- for (const target of declaredExportTargets(
2152
- exports[exportName],
2153
- packageJson.name,
2154
- exportName,
2155
- )) {
2156
- if (!target.startsWith('./')) {
2157
- throw new Error(
2158
- 'Package ' +
2159
- packageJson.name +
2160
- ' contract export ' +
2161
- exportName +
2162
- ' must use a relative package target.',
2163
- );
2164
- }
2165
- const absoluteTarget = resolve(root, target);
2166
- if (
2167
- !isContained(workspaceRoot, absoluteTarget) ||
2168
- !isContained(root, absoluteTarget) ||
2169
- !existsSync(absoluteTarget) ||
2170
- !statSync(absoluteTarget).isFile()
2171
- ) {
2172
- throw new Error(
2173
- 'Package ' +
2174
- packageJson.name +
2175
- ' contract export ' +
2176
- exportName +
2177
- ' points outside its package or to a missing file.',
2178
- );
2179
- }
2180
- const realTarget = realpathSync(absoluteTarget);
2181
- if (
2182
- !isContained(realpathSync(workspaceRoot), realTarget) ||
2183
- !isContained(realpathSync(root), realTarget)
2184
- ) {
2185
- throw new Error(
2186
- 'Package ' +
2187
- packageJson.name +
2188
- ' contract export ' +
2189
- exportName +
2190
- ' escapes the repository through an aliased target.',
2191
- );
2192
- }
2193
- const targetFromPackage = relative(root, absoluteTarget)
2194
- .split(sep)
2195
- .join('/');
2196
- const expectedSurface = expected.exact ?? expected.surface;
2197
- const mapsToSurface =
2198
- expected.exact !== undefined
2199
- ? targetFromPackage === expected.exact
2200
- : targetFromPackage.endsWith('.ts') &&
2201
- isContained(join(root, expectedSurface), absoluteTarget) &&
2202
- absoluteTarget !== join(root, expectedSurface);
2203
- if (!mapsToSurface) {
2204
- throw new Error(
2205
- 'Package ' +
2206
- packageJson.name +
2207
- ' contract export ' +
2208
- exportName +
2209
- ' is remapped outside its corresponding contract surface.',
2210
- );
2211
- }
2212
- }
2213
- }
2214
- }
2215
-
2216
- ${built_in_plan_event_contract_literal_js_1.EVENT_CONTRACT_LITERAL_SOURCE}
2217
- function producerEventContract(producer, slice) {
2218
- const path = join(producer.root, 'contracts', 'events.ts');
2219
- if (!existsSync(path)) {
2220
- throw new Error(
2221
- 'Producer ' + slice + ' publishes no contracts/events.ts EventContractSchema.',
2222
- );
2223
- }
2224
- const file = ts.createSourceFile(
2225
- path,
2226
- readFileSync(path, 'utf8'),
2227
- ts.ScriptTarget.ESNext,
2228
- true,
2229
- ts.ScriptKind.TS,
2230
- );
2231
- let schema;
2232
- for (const statement of file.statements) {
2233
- if (!ts.isVariableStatement(statement)) continue;
2234
- for (const variable of statement.declarationList.declarations) {
2235
- if (
2236
- ts.isIdentifier(variable.name) &&
2237
- variable.name.text === 'EventContractSchema' &&
2238
- variable.initializer
2239
- ) {
2240
- if (schema !== undefined) {
2241
- throw new Error(
2242
- 'Producer ' + slice + ' EventContractSchema export is ambiguous.',
2243
- );
2244
- }
2245
- schema = eventLiteral(variable.initializer);
2246
- }
2247
- }
2248
- }
2249
- if (
2250
- schema?.kind !== 'ebk-event-contract-schema' ||
2251
- schema.schemaVersion !== 1 ||
2252
- schema.slice !== slice ||
2253
- !Array.isArray(schema.events)
2254
- ) {
2255
- throw new Error(
2256
- 'Producer ' +
2257
- slice +
2258
- ' contracts/events.ts must export one canonical v1 EventContractSchema.',
2259
- );
2260
- }
2261
- return schema;
2262
- }
2263
-
2264
- // Bind each declared cross-Slice subscription to the producer's published
2265
- // EventContractSchema, so a removed, renamed or re-versioned event fails here
2266
- // instead of silently stopping delivery.
2267
- async function checkEventSubscriptions(dependencies, projects) {
2268
- const subscriptionPath = join(
2269
- projectRoot,
2270
- 'contracts',
2271
- 'event-subscriptions.json',
2272
- );
2273
- if (!existsSync(subscriptionPath)) {
2274
- throw new Error(
2275
- 'contracts/event-subscriptions.json is missing. Restore the seeded ' +
2276
- 'declaration with schemaVersion 1 and an empty subscriptions list.',
2277
- );
2278
- }
2279
- // The managed infrastructure validator is the one authority for the
2280
- // declaration shape; this check runs it exactly as deployment does.
2281
- const validator = await import(
2282
- 'data:text/javascript;base64,' +
2283
- Buffer.from(
2284
- ts.transpileModule(
2285
- readFileSync(
2286
- join(projectRoot, 'infra', 'event-subscriptions.ts'),
2287
- 'utf8',
2288
- ),
2289
- {
2290
- compilerOptions: {
2291
- module: ts.ModuleKind.ESNext,
2292
- target: ts.ScriptTarget.ES2022,
2293
- },
2294
- },
2295
- ).outputText,
2296
- ).toString('base64')
2297
- );
2298
- const subscriptions = validator.crossSliceEventSubscriptions(
2299
- readJson(subscriptionPath),
2300
- dependencies,
2301
- );
2302
- for (const subscription of subscriptions) {
2303
- const producer = projects.get(subscription.source);
2304
- if (
2305
- !producer ||
2306
- !dependencies.consumes.includes(producer.packageJson.name + '/contracts')
2307
- ) {
2308
- throw new Error(
2309
- 'Subscribed source ' +
2310
- subscription.source +
2311
- ' is not a consumed Product Slice contracts package.',
2312
- );
2313
- }
2314
- const schema = producerEventContract(producer, subscription.source);
2315
- for (const detailType of subscription.detailTypes) {
2316
- const published = schema.events.filter(
2317
- (event) => event?.detailType === detailType,
2318
- );
2319
- if (
2320
- published.length !== 1 ||
2321
- published[0].source !== subscription.source
2322
- ) {
2323
- throw new Error(
2324
- 'Producer ' +
2325
- subscription.source +
2326
- ' does not publish ' +
2327
- detailType +
2328
- ' in its EventContractSchema. Restore the producer event or ' +
2329
- 'remove the subscription from contracts/event-subscriptions.json.',
2330
- );
2331
- }
2332
- if (!subscription.schemaVersions.includes(published[0].schemaVersion)) {
2333
- throw new Error(
2334
- 'Producer ' +
2335
- subscription.source +
2336
- ' publishes ' +
2337
- detailType +
2338
- ' schemaVersion ' +
2339
- published[0].schemaVersion +
2340
- ', which ${name} does not subscribe to. Accept that version ' +
2341
- 'in api/event-consumer.ts, then declare it in ' +
2342
- 'contracts/event-subscriptions.json.',
2343
- );
2344
- }
2345
- }
2346
- }
2347
- }
2348
-
2349
- const declaration = readJson(declarationPath);
2350
- if (
2351
- !declaration ||
2352
- typeof declaration !== 'object' ||
2353
- Array.isArray(declaration) ||
2354
- declaration.schemaVersion !== 1 ||
2355
- !Array.isArray(declaration.consumes) ||
2356
- Object.keys(declaration).some(
2357
- (key) => !['consumes', 'schemaVersion'].includes(key),
2358
- )
2359
- ) {
2360
- throw new Error(
2361
- 'contracts/dependencies.json must be a v1 consumes declaration.',
2362
- );
2363
- }
2364
- const ownership = readJson(ownershipPath);
2365
- const [normalized] = normalizeApiContractProjectDeclarations([
2366
- {
2367
- contracts: {
2368
- consumes: declaration.consumes,
2369
- publishes: ownership.contracts?.publishes ?? [],
2370
- },
2371
- project: '${name}',
2372
- },
2373
- ]);
2374
- if (!normalized) {
2375
- throw new Error('The contract dependency declaration did not normalize.');
2376
- }
2377
-
2378
- const packagesRoot = join(workspaceRoot, 'packages');
2379
- const projects = new Map();
2380
- const packageNames = new Set();
2381
- const declarations = [];
2382
- for (const entry of readdirSync(packagesRoot, { withFileTypes: true })) {
2383
- if (!entry.isDirectory() || entry.name === 'foundation') continue;
2384
- const root = join(packagesRoot, entry.name);
2385
- const candidateOwnershipPath = join(root, '.ebk', 'ownership.json');
2386
- if (!existsSync(candidateOwnershipPath)) continue;
2387
- const candidateOwnership =
2388
- root === projectRoot
2389
- ? {
2390
- ...ownership,
2391
- contracts: {
2392
- ...ownership.contracts,
2393
- consumes: normalized.contracts.consumes,
2394
- },
2395
- }
2396
- : readJson(candidateOwnershipPath);
2397
- const validation = validateGeneratedOwnershipRecord(candidateOwnership);
2398
- if (!validation.valid) {
2399
- throw new Error(
2400
- 'Product Slice ' +
2401
- entry.name +
2402
- ' has invalid ownership metadata: ' +
2403
- JSON.stringify(validation.issues),
2404
- );
2405
- }
2406
- const project = validation.value.slice;
2407
- const packageJson = readJson(join(root, 'package.json'));
2408
- if (
2409
- typeof packageJson.name !== 'string' ||
2410
- packageJson.name.length === 0 ||
2411
- projects.has(project) ||
2412
- packageNames.has(packageJson.name)
2413
- ) {
2414
- throw new Error(
2415
- 'Product Slice projects and package names must be unique and explicit.',
2416
- );
2417
- }
2418
- packageNames.add(packageJson.name);
2419
- validateContractExports(
2420
- root,
2421
- packageJson,
2422
- validation.value.contracts.publishes,
2423
- );
2424
- projects.set(project, { packageJson, root });
2425
- declarations.push({
2426
- contracts: validation.value.contracts,
2427
- project,
2428
- });
2429
- }
2430
- if (!projects.has('${name}')) {
2431
- throw new Error(
2432
- 'The current Product Slice is absent from workspace ownership.',
2433
- );
2434
- }
2435
- const resolution = resolveApiContractDependencies(declarations);
2436
- for (const publication of resolution.contracts) {
2437
- const producer = projects.get(publication.producer);
2438
- if (!producer) {
2439
- throw new Error(
2440
- 'Resolved contract producer ' + publication.producer + ' is absent.',
2441
- );
2442
- }
2443
- const prefix = producer.packageJson.name + '/';
2444
- if (!publication.contract.startsWith(prefix)) {
2445
- throw new Error(
2446
- 'Published contract ' +
2447
- publication.contract +
2448
- ' is outside producer package ' +
2449
- producer.packageJson.name +
2450
- '.',
2451
- );
2452
- }
2453
- const exportName = './' + publication.contract.slice(prefix.length);
2454
- if (!allowedContractExports.has(exportName)) {
2455
- throw new Error(
2456
- 'Published contract ' +
2457
- publication.contract +
2458
- ' does not use an allowed package export ' +
2459
- exportName +
2460
- '.',
2461
- );
2462
- }
2463
- for (const consumerName of publication.consumers) {
2464
- const consumer = projects.get(consumerName);
2465
- const version =
2466
- consumer?.packageJson.dependencies?.[producer.packageJson.name];
2467
- if (typeof version !== 'string' || !version.startsWith('workspace:')) {
2468
- throw new Error(
2469
- 'Consumed contract ' +
2470
- publication.contract +
2471
- ' requires ' +
2472
- consumerName +
2473
- ' to declare a workspace dependency on ' +
2474
- producer.packageJson.name +
2475
- '.',
2476
- );
2477
- }
2478
- }
2479
- }
2480
- const current = [...(ownership.contracts?.consumes ?? [])].sort();
2481
- const expected = [...normalized.contracts.consumes];
2482
- if (action === 'check') {
2483
- await checkEventSubscriptions(declaration, projects);
2484
- if (JSON.stringify(current) !== JSON.stringify(expected)) {
2485
- throw new Error(
2486
- 'Contract declarations are out of sync. Run ' +
2487
- 'pnpm nx run ${name}:contract-dependencies-sync.',
2488
- );
2489
- }
2490
- process.stdout.write(
2491
- JSON.stringify({
2492
- action,
2493
- consumes: expected,
2494
- project: '${name}',
2495
- schemaVersion: 1,
2496
- }) + '\\n',
2497
- );
2498
- } else {
2499
- const candidate = {
2500
- ...ownership,
2501
- contracts: {
2502
- ...ownership.contracts,
2503
- consumes: expected,
2504
- },
2505
- };
2506
- const validation = validateGeneratedOwnershipRecord(candidate);
2507
- if (!validation.valid) {
2508
- throw new Error(
2509
- 'Contract dependency sync produced invalid ownership: ' +
2510
- JSON.stringify(validation.issues),
2511
- );
2512
- }
2513
- writeFileSync(
2514
- ownershipPath,
2515
- JSON.stringify(validation.value, null, 2) + '\\n',
2516
- 'utf8',
2517
- );
2518
- process.stdout.write(
2519
- JSON.stringify({
2520
- action,
2521
- consumes: expected,
2522
- project: '${name}',
2523
- schemaVersion: 1,
2524
- }) + '\\n',
2525
- );
2526
- }
2527
- `,
2528
- 'scripts/api-contract.mjs': `import { createHash } from 'node:crypto';
2529
- import { spawnSync } from 'node:child_process';
2530
- import {
2531
- mkdirSync,
2532
- readFileSync,
2533
- rmSync,
2534
- writeFileSync,
2535
- } from 'node:fs';
2536
- import { createRequire } from 'node:module';
2537
- import { join, resolve } from 'node:path';
2538
- import { createApiContractArtifacts } from '@empire-builder-kit/runtime/api-contract';
2539
- import { ${contractIdentifier} } from '../api/contracts/protected.ts';
2540
-
2541
- const require = createRequire(import.meta.url);
2542
- const {
2543
- authorizeApiContractBaselineUpdate,
2544
- compareApiContracts,
2545
- createApiContractCompatibilityEvidence,
2546
- planApiContractBaselineUpdate,
2547
- } = require('@empire-builder-kit/nx/api-contract');
2548
- const {
2549
- createTestingEvidenceFromRunnerAttempts,
2550
- inspectTestingEvidenceArtifact,
2551
- normalizeVitestEvidenceAttempt,
2552
- } = require('@empire-builder-kit/nx/testing-evidence');
2553
- const {
2554
- validateGeneratedOwnershipRecord,
2555
- } = require('@empire-builder-kit/nx/ownership');
2556
-
2557
- const projectRoot = process.cwd();
2558
- const workspaceRoot = resolve(projectRoot, '../..');
2559
- const generatedRoot = join(projectRoot, 'api', 'generated');
2560
- const evidenceRoot = join(projectRoot, '.ebk', 'evidence');
2561
- const ownershipPath = join(projectRoot, '.ebk', 'ownership.json');
2562
- const normalizedPath = join(generatedRoot, 'contract.json');
2563
- const openApiPath = join(generatedRoot, 'openapi.json');
2564
- const baselinePath = join(generatedRoot, 'baseline.json');
2565
- const reportPath = join(evidenceRoot, 'api-contract-compatibility.json');
2566
- const resultPath = join(evidenceRoot, 'api-contract.json');
2567
- const readJson = (path) => JSON.parse(readFileSync(path, 'utf8'));
2568
- const workspacePackage = readJson(join(workspaceRoot, 'package.json'));
2569
- const ownership = readJson(ownershipPath);
2570
- const artifacts = createApiContractArtifacts(${contractIdentifier});
2571
- const action = process.argv[2] ?? 'check';
2572
- const digest = (contents) =>
2573
- 'sha256:' + createHash('sha256').update(contents).digest('hex');
2574
-
2575
- ${local_source_identity_js_1.localSourceCommitFunction}
2576
-
2577
- function sourceIdentity() {
2578
- const commit = localSourceCommit();
2579
- const frameworkCandidate =
2580
- workspacePackage.dependencies?.['@empire-builder-kit/runtime'];
2581
- if (typeof frameworkCandidate !== 'string' || !frameworkCandidate) {
2582
- throw new Error('The workspace runtime candidate is unavailable.');
2583
- }
2584
- return {
2585
- blueprintCandidates: [
2586
- ownership.blueprint.name + '@' + ownership.blueprint.version,
2587
- ],
2588
- commit,
2589
- frameworkCandidate,
2590
- };
2591
- }
2592
-
2593
- function writeManagedArtifacts() {
2594
- mkdirSync(generatedRoot, { recursive: true });
2595
- writeFileSync(normalizedPath, artifacts.normalizedJson, 'utf8');
2596
- writeFileSync(openApiPath, artifacts.openApiJson, 'utf8');
2597
- }
2598
-
2599
- function restampManagedArtifacts() {
2600
- const managedArtifacts = new Map([
2601
- ['api/generated/contract.json', artifacts.normalizedJson],
2602
- ['api/generated/openapi.json', artifacts.openApiJson],
2603
- ]);
2604
- const restamped = new Set();
2605
- const candidate = {
2606
- ...ownership,
2607
- paths: ownership.paths.map((entry) => {
2608
- const contents = managedArtifacts.get(entry.path);
2609
- if (contents === undefined) return entry;
2610
- if (entry.mode !== 'managed' || entry.managedJsonPointers !== undefined) {
2611
- throw new Error(
2612
- 'API contract generation can restamp only whole-file managed artifacts.',
2613
- );
2614
- }
2615
- restamped.add(entry.path);
2616
- return {
2617
- ...entry,
2618
- sha256: createHash('sha256').update(contents).digest('hex'),
2619
- };
2620
- }),
2621
- };
2622
- if (restamped.size !== managedArtifacts.size) {
2623
- throw new Error(
2624
- 'API contract generation could not find every managed artifact in ownership metadata.',
2625
- );
2626
- }
2627
- const validation = validateGeneratedOwnershipRecord(candidate);
2628
- if (!validation.valid) {
2629
- throw new Error(
2630
- 'API contract generation produced invalid ownership metadata: ' +
2631
- JSON.stringify(validation.issues),
2632
- );
2633
- }
2634
- writeFileSync(
2635
- ownershipPath,
2636
- JSON.stringify(validation.value, null, 2) + '\\n',
2637
- 'utf8',
2638
- );
2639
- }
2640
-
2641
- function approvalPath() {
2642
- const inline = process.argv.find((value) => value.startsWith('--approval='));
2643
- if (inline) return inline.slice('--approval='.length);
2644
- const index = process.argv.indexOf('--approval');
2645
- return index >= 0 ? process.argv[index + 1] : undefined;
2646
- }
2647
-
2648
- if (action === 'generate') {
2649
- writeManagedArtifacts();
2650
- restampManagedArtifacts();
2651
- process.stdout.write(
2652
- JSON.stringify({
2653
- action,
2654
- baselineUpdated: false,
2655
- normalizedDigest: digest(artifacts.normalizedJson),
2656
- openApiDigest: digest(artifacts.openApiJson),
2657
- }) + '\\n',
2658
- );
2659
- } else if (action === 'baseline') {
2660
- const currentBaseline = readJson(baselinePath);
2661
- const plan = planApiContractBaselineUpdate(
2662
- currentBaseline,
2663
- artifacts.normalized,
2664
- );
2665
- if (plan.disposition === 'no-change') {
2666
- process.stdout.write(
2667
- JSON.stringify({
2668
- action,
2669
- baselineUpdated: false,
2670
- candidateDigest: plan.candidate.digest,
2671
- disposition: plan.disposition,
2672
- }) + '\\n',
2673
- );
2674
- } else {
2675
- const path = approvalPath();
2676
- if (!path) {
2677
- throw new Error(
2678
- 'A baseline update requires --approval=<reviewed-json-path>.',
2679
- );
2680
- }
2681
- const authorization = authorizeApiContractBaselineUpdate(
2682
- plan,
2683
- readJson(resolve(projectRoot, path)),
2684
- );
2685
- writeFileSync(baselinePath, authorization.candidateJson, 'utf8');
2686
- process.stdout.write(
2687
- JSON.stringify({
2688
- acceptedClassification: authorization.acceptedClassification,
2689
- action,
2690
- baselineDigest: authorization.baselineDigest,
2691
- baselineUpdated: true,
2692
- candidateDigest: authorization.candidateDigest,
2693
- }) + '\\n',
2694
- );
2695
- }
2696
- } else if (action === 'check') {
2697
- const startedAt = new Date().toISOString();
2698
- mkdirSync(evidenceRoot, { recursive: true });
2699
- rmSync(reportPath, { force: true });
2700
- rmSync(resultPath, { force: true });
2701
- try {
2702
- const baseline = readJson(baselinePath);
2703
- const report = compareApiContracts(baseline, artifacts.normalized);
2704
- const reportJson = JSON.stringify(report, null, 2) + '\\n';
2705
- const reportInspection = inspectTestingEvidenceArtifact({
2706
- contents: reportJson,
2707
- });
2708
- const generatedDrift =
2709
- readFileSync(normalizedPath, 'utf8') !== artifacts.normalizedJson ||
2710
- readFileSync(openApiPath, 'utf8') !== artifacts.openApiJson;
2711
- const completedAt = new Date().toISOString();
2712
- const retainedArtifacts = [];
2713
- if (reportInspection.safe) {
2714
- writeFileSync(reportPath, reportJson, 'utf8');
2715
- retainedArtifacts.push({
2716
- digest: digest(reportJson),
2717
- name: '.ebk/evidence/api-contract-compatibility.json',
2718
- retentionClass: 'source-result',
2719
- });
2720
- }
2721
- const evidenceOptions = {
2722
- artifacts: retainedArtifacts,
2723
- commandVersion: '1',
2724
- completedAt,
2725
- project: '${name}',
2726
- report,
2727
- source: sourceIdentity(),
2728
- startedAt,
2729
- target: 'api-contract-check',
2730
- workspace: workspacePackage.name,
2731
- };
2732
- const result =
2733
- generatedDrift || !reportInspection.safe
2734
- ? createTestingEvidenceFromRunnerAttempts({
2735
- artifacts: retainedArtifacts,
2736
- attempts: [
2737
- normalizeVitestEvidenceAttempt({
2738
- attempt: 1,
2739
- completedAt,
2740
- failed: 1,
2741
- findings: [
2742
- {
2743
- classification: generatedDrift
2744
- ? 'environment-drift'
2745
- : 'sensitive-artifact',
2746
- summary: generatedDrift
2747
- ? 'Managed API artifacts differ from the authoritative contract.'
2748
- : 'The API compatibility report matched protected artifact data and was not retained.',
2749
- },
2750
- ],
2751
- passed: 0,
2752
- skipped: 0,
2753
- startedAt,
2754
- }),
2755
- ],
2756
- cleanup: { outcome: 'not-required' },
2757
- environment: { class: 'source', deployed: false },
2758
- operation: {
2759
- commandVersion: '1',
2760
- project: '${name}',
2761
- proofLayer: 'contract-compatibility',
2762
- target: 'api-contract-check',
2763
- },
2764
- proofStarted: true,
2765
- slice: '${name}',
2766
- source: evidenceOptions.source,
2767
- workspace: workspacePackage.name,
2768
- })
2769
- : createApiContractCompatibilityEvidence(evidenceOptions);
2770
- writeFileSync(
2771
- resultPath,
2772
- JSON.stringify(result, null, 2) + '\\n',
2773
- 'utf8',
2774
- );
2775
- process.stdout.write(JSON.stringify(result) + '\\n');
2776
- if (result.outcome !== 'passed') process.exitCode = 1;
2777
- } catch (error) {
2778
- const completedAt = new Date().toISOString();
2779
- const missing =
2780
- error &&
2781
- typeof error === 'object' &&
2782
- 'code' in error &&
2783
- error.code === 'ENOENT';
2784
- const result = createTestingEvidenceFromRunnerAttempts({
2785
- artifacts: [],
2786
- attempts: [],
2787
- cleanup: { outcome: 'not-required' },
2788
- environment: { class: 'source', deployed: false },
2789
- operation: {
2790
- commandVersion: '1',
2791
- project: '${name}',
2792
- proofLayer: 'contract-compatibility',
2793
- target: 'api-contract-check',
2794
- },
2795
- preflight: {
2796
- completedAt,
2797
- findings: [
2798
- {
2799
- classification: missing
2800
- ? 'prerequisite-missing'
2801
- : 'environment-drift',
2802
- summary: missing
2803
- ? 'A required API contract artifact or baseline is missing.'
2804
- : 'A required API contract artifact or baseline is invalid.',
2805
- },
2806
- ],
2807
- startedAt,
2808
- },
2809
- proofStarted: false,
2810
- slice: '${name}',
2811
- source: sourceIdentity(),
2812
- workspace: workspacePackage.name,
2813
- });
2814
- writeFileSync(
2815
- resultPath,
2816
- JSON.stringify(result, null, 2) + '\\n',
2817
- 'utf8',
2818
- );
2819
- process.stdout.write(JSON.stringify(result) + '\\n');
2820
- process.exitCode = 1;
2821
- }
2822
- } else {
2823
- throw new Error(
2824
- 'Usage: node scripts/api-contract.mjs <check|generate|baseline>',
2825
- );
2826
- }
2827
- `,
2828
- };
2829
- }
2830
- //# sourceMappingURL=built-in-plan-api-contract-files.js.map