@empire-builder-kit/nx 1.0.0-rc.47 → 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 (764) hide show
  1. package/README.md +14 -169
  2. package/executors.json +24 -79
  3. package/generators.json +8 -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 -272
  29. package/src/aws-authority/stage-authority.js +109 -3609
  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 +3 -68
  42. package/src/executors/dev-doctor/dev-doctor.js +2 -2
  43. package/src/executors/local-deploy/deployed-smoke.d.ts +12 -0
  44. package/src/executors/local-deploy/deployed-smoke.js +115 -0
  45. package/src/executors/local-deploy/deployment-authority.d.ts +24 -0
  46. package/src/executors/local-deploy/deployment-authority.js +81 -0
  47. package/src/executors/local-deploy/deployment-child.d.ts +18 -0
  48. package/src/executors/local-deploy/deployment-child.js +77 -0
  49. package/src/executors/local-deploy/deployment-contracts.d.ts +96 -0
  50. package/src/executors/local-deploy/deployment-contracts.js +3 -0
  51. package/src/executors/local-deploy/deployment-projects.d.ts +4 -0
  52. package/src/executors/local-deploy/deployment-projects.js +16 -0
  53. package/src/executors/local-deploy/deployment-receipt.d.ts +4 -0
  54. package/src/executors/local-deploy/deployment-receipt.js +55 -0
  55. package/src/executors/local-deploy/deployment-scope.d.ts +17 -0
  56. package/src/executors/local-deploy/deployment-scope.js +239 -0
  57. package/src/executors/local-deploy/deployment-source.d.ts +13 -0
  58. package/src/executors/local-deploy/deployment-source.js +86 -0
  59. package/src/executors/local-deploy/local-deploy.d.ts +5 -121
  60. package/src/executors/local-deploy/local-deploy.js +55 -936
  61. package/src/executors/sst-lifecycle/governed-child-process.d.ts +27 -0
  62. package/src/executors/sst-lifecycle/governed-child-process.js +277 -0
  63. package/src/executors/sst-lifecycle/governed-native-operation.js +4 -10
  64. package/src/executors/sst-lifecycle/run-sst-command.d.ts +4 -85
  65. package/src/executors/sst-lifecycle/run-sst-command.js +28 -834
  66. package/src/executors/sst-lifecycle/sst-contracts.d.ts +44 -0
  67. package/src/executors/sst-lifecycle/sst-contracts.js +3 -0
  68. package/src/executors/sst-lifecycle/sst-invocation.d.ts +17 -0
  69. package/src/executors/sst-lifecycle/sst-invocation.js +502 -0
  70. package/src/executors/sst-lifecycle/task-unlock.js +3 -3
  71. package/src/foundation/discovery.d.ts +1 -5
  72. package/src/foundation/discovery.js +0 -2
  73. package/src/foundation/index.d.ts +0 -2
  74. package/src/foundation/index.js +0 -9
  75. package/src/foundation/local-private-smoke-access.d.ts +6 -15
  76. package/src/foundation/local-private-smoke-access.js +8 -192
  77. package/src/foundation/observability.d.ts +16 -26
  78. package/src/foundation/observability.js +34 -135
  79. package/src/foundation/preflight.js +0 -14
  80. package/src/foundation/private-smoke-access.d.ts +7 -14
  81. package/src/foundation/private-smoke-access.js +4 -126
  82. package/src/foundation/root-site-workspace.d.ts +35 -0
  83. package/src/foundation/root-site-workspace.js +80 -0
  84. package/src/foundation/root-site.d.ts +8 -7
  85. package/src/foundation/root-site.js +17 -9
  86. package/src/generators/formatting.js +5 -4
  87. package/src/generators/function/function.d.ts +9 -5
  88. package/src/generators/function/function.js +106 -136
  89. package/src/generators/function/schema.json +2 -2
  90. package/src/generators/function-access/function-access.d.ts +0 -6
  91. package/src/generators/function-access/function-access.js +41 -109
  92. package/src/generators/observability-policy.js +1 -2
  93. package/src/{supply-chain → generators}/pnpm-toolchain-authority.d.ts +3 -3
  94. package/src/{supply-chain → generators}/pnpm-toolchain-authority.js +12 -12
  95. package/src/generators/post-generation-install.d.ts +1 -8
  96. package/src/generators/post-generation-install.js +11 -139
  97. package/src/generators/preset/dependency-overrides.d.ts +13 -19
  98. package/src/generators/preset/dependency-overrides.js +12 -56
  99. package/src/generators/preset/generator.js +0 -3
  100. package/src/generators/preset/workspace-files-foundation-infra.d.ts +6 -0
  101. package/src/generators/preset/workspace-files-foundation-infra.js +586 -0
  102. package/src/generators/preset/workspace-files-foundation-readme.d.ts +5 -0
  103. package/src/generators/preset/workspace-files-foundation-readme.js +90 -0
  104. package/src/generators/preset/workspace-files-foundation.d.ts +3 -0
  105. package/src/generators/preset/workspace-files-foundation.js +170 -0
  106. package/src/generators/preset/workspace-files-ownership.d.ts +9 -0
  107. package/src/generators/preset/workspace-files-ownership.js +124 -0
  108. package/src/generators/preset/workspace-files-root-config.d.ts +32 -0
  109. package/src/generators/preset/workspace-files-root-config.js +356 -0
  110. package/src/generators/preset/workspace-files-root-docs.d.ts +5 -0
  111. package/src/generators/preset/workspace-files-root-docs.js +109 -0
  112. package/src/generators/preset/workspace-files-shared.d.ts +18 -0
  113. package/src/generators/preset/workspace-files-shared.js +7 -0
  114. package/src/generators/preset/workspace-files-workflows.d.ts +39 -0
  115. package/src/generators/preset/workspace-files-workflows.js +306 -0
  116. package/src/generators/preset/workspace-files-workspace-health.d.ts +6 -0
  117. package/src/generators/preset/workspace-files-workspace-health.js +148 -0
  118. package/src/generators/preset/workspace-files.d.ts +10 -24
  119. package/src/generators/preset/workspace-files.js +48 -10705
  120. package/src/generators/site/built-in-site-documentation-files.d.ts +2 -1
  121. package/src/generators/site/built-in-site-documentation-files.js +15 -56
  122. package/src/generators/site/built-in-site-files.d.ts +4 -1
  123. package/src/generators/site/built-in-site-files.js +12 -11
  124. package/src/generators/site/built-in-site-infrastructure-files.d.ts +2 -1
  125. package/src/generators/site/built-in-site-infrastructure-files.js +46 -206
  126. package/src/generators/site/built-in-site-plan.d.ts +5 -1
  127. package/src/generators/site/built-in-site-plan.js +7 -5
  128. package/src/generators/site/built-in-site-project-files.d.ts +10 -2
  129. package/src/generators/site/built-in-site-project-files.js +131 -177
  130. package/src/generators/site/built-in-site-script-files.d.ts +2 -0
  131. package/src/generators/site/built-in-site-script-files.js +76 -280
  132. package/src/generators/site/built-in-site-shared.d.ts +64 -4
  133. package/src/generators/site/built-in-site-shared.js +307 -14
  134. package/src/generators/site/built-in-site-sst-config-files.d.ts +2 -1
  135. package/src/generators/site/built-in-site-sst-config-files.js +90 -22
  136. package/src/generators/site/built-in-site-web-files.d.ts +2 -1
  137. package/src/generators/site/built-in-site-web-files.js +19 -225
  138. package/src/generators/site/schema.d.ts +5 -0
  139. package/src/generators/site/schema.json +6 -0
  140. package/src/generators/site/site.d.ts +0 -8
  141. package/src/generators/site/site.js +17 -85
  142. package/src/generators/slice/built-in-plan-api-files.d.ts +1 -2
  143. package/src/generators/slice/built-in-plan-api-files.js +30 -890
  144. package/src/generators/slice/built-in-plan-database-lifecycle-files.js +57 -1851
  145. package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +5 -2
  146. package/src/generators/slice/built-in-plan-infrastructure-files.js +80 -3272
  147. package/src/generators/slice/built-in-plan-key-value-files.d.ts +3 -2
  148. package/src/generators/slice/built-in-plan-key-value-files.js +3 -21
  149. package/src/generators/slice/built-in-plan-project-files.d.ts +5 -3
  150. package/src/generators/slice/built-in-plan-project-files.js +79 -897
  151. package/src/generators/slice/built-in-plan-shared.d.ts +3 -18
  152. package/src/generators/slice/built-in-plan-shared.js +4 -57
  153. package/src/generators/slice/built-in-plan-web-files.d.ts +1 -1
  154. package/src/generators/slice/built-in-plan-web-files.js +14 -540
  155. package/src/generators/slice/built-in-plan.d.ts +2 -3
  156. package/src/generators/slice/built-in-plan.js +79 -277
  157. package/src/{developer-agent/preview-changes.d.ts → generators/slice/generation-tree.d.ts} +1 -5
  158. package/src/generators/slice/generation-tree.js +161 -0
  159. package/src/generators/slice/schema.json +12 -4
  160. package/src/generators/slice/slice-config.d.ts +7 -0
  161. package/src/generators/slice/slice-config.js +125 -0
  162. package/src/generators/slice/slice.js +29 -261
  163. package/src/generators/slice/sql-bootstrap.d.ts +1 -0
  164. package/src/generators/slice/sql-bootstrap.js +505 -0
  165. package/src/generators/slice/sql-client.d.ts +1 -0
  166. package/src/generators/slice/sql-client.js +107 -0
  167. package/src/generators/slice/sql-infrastructure.d.ts +1 -0
  168. package/src/generators/slice/sql-infrastructure.js +225 -0
  169. package/src/generators/slice/sql-logging.d.ts +1 -0
  170. package/src/generators/slice/sql-logging.js +266 -0
  171. package/src/generators/slice/sql-migration.d.ts +2 -0
  172. package/src/generators/slice/sql-migration.js +202 -0
  173. package/src/generators/slice/standard-slice-contract.d.ts +25 -0
  174. package/src/generators/slice/standard-slice-contract.js +64 -0
  175. package/src/generators/sql/schema.json +1 -1
  176. package/src/generators/sql/sql.d.ts +1 -1
  177. package/src/generators/sql/sql.js +13 -7
  178. package/src/generators/upgrade/framework-package-upgrade.d.ts +4 -27
  179. package/src/generators/upgrade/framework-package-upgrade.js +16 -39
  180. package/src/generators/upgrade/framework-packages.d.ts +25 -0
  181. package/src/generators/upgrade/framework-packages.js +138 -0
  182. package/src/generators/upgrade/function-authentication-notice.d.ts +10 -18
  183. package/src/generators/upgrade/function-authentication-notice.js +24 -44
  184. package/src/generators/upgrade/schema.d.ts +0 -3
  185. package/src/generators/upgrade/schema.json +6 -16
  186. package/src/generators/upgrade/slice-compositions.d.ts +20 -0
  187. package/src/generators/upgrade/slice-compositions.js +100 -0
  188. package/src/generators/upgrade/slice-upgrade-guidance.d.ts +19 -0
  189. package/src/generators/upgrade/slice-upgrade-guidance.js +50 -0
  190. package/src/generators/upgrade/slice-upgrade.d.ts +4 -0
  191. package/src/generators/upgrade/slice-upgrade.js +231 -0
  192. package/src/generators/upgrade/upgrade-plan.d.ts +10 -13
  193. package/src/generators/upgrade/upgrade-plan.js +33 -197
  194. package/src/generators/upgrade/upgrade-preflight.d.ts +20 -0
  195. package/src/generators/upgrade/upgrade-preflight.js +64 -0
  196. package/src/generators/upgrade/upgrade.d.ts +8 -53
  197. package/src/generators/upgrade/upgrade.js +23 -1571
  198. package/src/generators/workload/schema.json +2 -2
  199. package/src/generators/workload/workload.d.ts +11 -11
  200. package/src/generators/workload/workload.js +166 -1255
  201. package/src/index.d.ts +0 -5
  202. package/src/index.js +0 -5
  203. package/src/local-dev/browser-verification.d.ts +0 -7
  204. package/src/local-dev/browser-verification.js +0 -136
  205. package/src/local-dev/contracts.d.ts +6 -0
  206. package/src/local-dev/contracts.js +17 -9
  207. package/src/local-dev/environment-checks.d.ts +126 -0
  208. package/src/local-dev/environment-checks.js +81 -0
  209. package/src/local-dev/environment-inspector.d.ts +3 -124
  210. package/src/local-dev/environment-inspector.js +9 -148
  211. package/src/local-dev/private-state.d.ts +1 -0
  212. package/src/local-dev/private-state.js +19 -23
  213. package/src/local-dev/process-identity.js +4 -2
  214. package/src/local-dev/slice-runner-child.d.ts +37 -0
  215. package/src/local-dev/slice-runner-child.js +127 -0
  216. package/src/local-dev/slice-runner-recovery.d.ts +32 -0
  217. package/src/local-dev/slice-runner-recovery.js +216 -0
  218. package/src/local-dev/slice-runner-state.d.ts +82 -0
  219. package/src/local-dev/slice-runner-state.js +265 -0
  220. package/src/local-dev/slice-runner.d.ts +4 -117
  221. package/src/local-dev/slice-runner.js +59 -594
  222. package/src/local-dev/tls.js +8 -97
  223. package/src/ownership/index.d.ts +1 -0
  224. package/src/ownership/index.js +6 -0
  225. package/src/ownership/pnpm-workspace.d.ts +77 -0
  226. package/src/ownership/pnpm-workspace.js +225 -0
  227. package/src/ownership/site-record.d.ts +8 -0
  228. package/src/ownership/site-record.js +17 -2
  229. package/src/repository-policy/capacity-migration.d.ts +1 -1
  230. package/src/repository-policy/capacity-migration.js +1 -1
  231. package/src/repository-policy/foundation-router.d.ts +17 -0
  232. package/src/repository-policy/foundation-router.js +44 -0
  233. package/src/repository-policy/index.d.ts +2 -0
  234. package/src/repository-policy/index.js +2 -0
  235. package/src/repository-policy/policy-accounts.d.ts +22 -0
  236. package/src/repository-policy/policy-accounts.js +134 -0
  237. package/src/repository-policy/policy-files.d.ts +8 -0
  238. package/src/repository-policy/policy-files.js +201 -0
  239. package/src/repository-policy/policy-internal.d.ts +2 -0
  240. package/src/repository-policy/policy-internal.js +11 -0
  241. package/src/repository-policy/policy-model.d.ts +95 -0
  242. package/src/repository-policy/policy-model.js +42 -0
  243. package/src/repository-policy/policy-validation.d.ts +4 -0
  244. package/src/repository-policy/policy-validation.js +308 -0
  245. package/src/repository-policy/policy.d.ts +5 -120
  246. package/src/repository-policy/policy.js +34 -662
  247. package/src/repository-policy/public-dns.d.ts +4 -0
  248. package/src/repository-policy/public-dns.js +102 -5
  249. package/src/{generators/repository-policy → repository-policy}/tree-policy.d.ts +1 -1
  250. package/src/{generators/repository-policy → repository-policy}/tree-policy.js +5 -5
  251. package/src/schemas/repository-policy-v1.json +40 -3
  252. package/src/secrets/index.d.ts +0 -5
  253. package/src/secrets/index.js +0 -5
  254. package/src/slice-infra/index.d.ts +57 -0
  255. package/src/slice-infra/index.js +117 -0
  256. package/src/slice-scripts/build.d.ts +27 -0
  257. package/src/slice-scripts/build.js +120 -0
  258. package/src/slice-scripts/database.d.ts +87 -0
  259. package/src/slice-scripts/database.js +328 -0
  260. package/src/slice-scripts/index.d.ts +11 -0
  261. package/src/slice-scripts/index.js +23 -0
  262. package/src/slice-scripts/root-site-routes.d.ts +11 -0
  263. package/src/slice-scripts/root-site-routes.js +83 -0
  264. package/src/slice-scripts/sql-migration-engine.mjs +180 -0
  265. package/src/workload-roles/effective-policy.d.ts +0 -37
  266. package/src/workload-roles/effective-policy.js +1 -174
  267. package/src/workload-roles/standard-slice.d.ts +2 -19
  268. package/src/workload-roles/standard-slice.js +3 -129
  269. package/src/api-contract/baseline-update.d.ts +0 -82
  270. package/src/api-contract/baseline-update.js +0 -225
  271. package/src/api-contract/compatibility.d.ts +0 -30
  272. package/src/api-contract/compatibility.js +0 -643
  273. package/src/api-contract/contract-graph.d.ts +0 -35
  274. package/src/api-contract/contract-graph.js +0 -141
  275. package/src/api-contract/evidence.d.ts +0 -23
  276. package/src/api-contract/evidence.js +0 -87
  277. package/src/api-contract/index.d.ts +0 -6
  278. package/src/api-contract/index.js +0 -10
  279. package/src/api-contract/model.d.ts +0 -144
  280. package/src/api-contract/model.js +0 -993
  281. package/src/api-contract/rollout.d.ts +0 -32
  282. package/src/api-contract/rollout.js +0 -88
  283. package/src/authorization/compatibility.d.ts +0 -62
  284. package/src/authorization/compatibility.js +0 -175
  285. package/src/authorization/index.d.ts +0 -1
  286. package/src/authorization/index.js +0 -5
  287. package/src/blueprints/execution.d.ts +0 -55
  288. package/src/blueprints/execution.js +0 -329
  289. package/src/blueprints/external-sandbox.d.ts +0 -53
  290. package/src/blueprints/external-sandbox.js +0 -1194
  291. package/src/blueprints/index.d.ts +0 -5
  292. package/src/blueprints/index.js +0 -9
  293. package/src/blueprints/inputs.d.ts +0 -43
  294. package/src/blueprints/inputs.js +0 -103
  295. package/src/blueprints/manifest.d.ts +0 -281
  296. package/src/blueprints/manifest.js +0 -424
  297. package/src/blueprints/resolver.d.ts +0 -37
  298. package/src/blueprints/resolver.js +0 -387
  299. package/src/blueprints/transitions.d.ts +0 -20
  300. package/src/blueprints/transitions.js +0 -61
  301. package/src/cli/agent-command.d.ts +0 -30
  302. package/src/cli/agent-command.js +0 -204
  303. package/src/cli/agent-runtime.d.ts +0 -25
  304. package/src/cli/agent-runtime.js +0 -498
  305. package/src/cli/blueprint-authority.d.ts +0 -9
  306. package/src/cli/blueprint-authority.js +0 -43
  307. package/src/cli/blueprint-command.d.ts +0 -24
  308. package/src/cli/blueprint-command.js +0 -63
  309. package/src/data-lifecycle/index.d.ts +0 -3
  310. package/src/data-lifecycle/index.js +0 -7
  311. package/src/data-lifecycle/model.d.ts +0 -172
  312. package/src/data-lifecycle/model.js +0 -95
  313. package/src/data-lifecycle/sensitive-artifacts.d.ts +0 -28
  314. package/src/data-lifecycle/sensitive-artifacts.js +0 -146
  315. package/src/data-lifecycle/validation.d.ts +0 -32
  316. package/src/data-lifecycle/validation.js +0 -837
  317. package/src/database-retirement/contract.d.ts +0 -68
  318. package/src/database-retirement/contract.js +0 -166
  319. package/src/database-retirement/index.d.ts +0 -1
  320. package/src/database-retirement/index.js +0 -5
  321. package/src/developer-agent/context.d.ts +0 -57
  322. package/src/developer-agent/context.js +0 -662
  323. package/src/developer-agent/generator-planning.d.ts +0 -34
  324. package/src/developer-agent/generator-planning.js +0 -759
  325. package/src/developer-agent/generator-preview.d.ts +0 -8
  326. package/src/developer-agent/generator-preview.js +0 -650
  327. package/src/developer-agent/git-inspection.d.ts +0 -112
  328. package/src/developer-agent/git-inspection.js +0 -887
  329. package/src/developer-agent/handoff.d.ts +0 -43
  330. package/src/developer-agent/handoff.js +0 -713
  331. package/src/developer-agent/index.d.ts +0 -10
  332. package/src/developer-agent/index.js +0 -14
  333. package/src/developer-agent/model.d.ts +0 -497
  334. package/src/developer-agent/model.js +0 -144
  335. package/src/developer-agent/operation-registry.d.ts +0 -61
  336. package/src/developer-agent/operation-registry.js +0 -1591
  337. package/src/developer-agent/ordering.d.ts +0 -9
  338. package/src/developer-agent/ordering.js +0 -15
  339. package/src/developer-agent/planning.d.ts +0 -25
  340. package/src/developer-agent/planning.js +0 -481
  341. package/src/developer-agent/preview-changes.js +0 -225
  342. package/src/developer-agent/preview-source.d.ts +0 -2
  343. package/src/developer-agent/preview-source.js +0 -19
  344. package/src/developer-agent/validation.d.ts +0 -30
  345. package/src/developer-agent/validation.js +0 -2729
  346. package/src/developer-agent/workspace-inspection.d.ts +0 -20
  347. package/src/developer-agent/workspace-inspection.js +0 -1236
  348. package/src/developer-agent/workspace-path.d.ts +0 -6
  349. package/src/developer-agent/workspace-path.js +0 -22
  350. package/src/executors/blueprint-trust/blueprint-trust.d.ts +0 -29
  351. package/src/executors/blueprint-trust/blueprint-trust.js +0 -121
  352. package/src/executors/blueprint-trust/schema.json +0 -27
  353. package/src/executors/blueprint-verification/blueprint-verification.d.ts +0 -13
  354. package/src/executors/blueprint-verification/blueprint-verification.js +0 -110
  355. package/src/executors/blueprint-verification/schema.json +0 -44
  356. package/src/executors/developer-context/developer-context.d.ts +0 -38
  357. package/src/executors/developer-context/developer-context.js +0 -78
  358. package/src/executors/developer-context/schema.json +0 -87
  359. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.d.ts +0 -19
  360. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js +0 -105
  361. package/src/executors/foundation-profile-preflight/schema.json +0 -32
  362. package/src/executors/github-bootstrap/github-bootstrap.d.ts +0 -13
  363. package/src/executors/github-bootstrap/github-bootstrap.js +0 -62
  364. package/src/executors/github-bootstrap/schema.json +0 -50
  365. package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +0 -37
  366. package/src/executors/infrastructure-plan/infrastructure-plan.js +0 -275
  367. package/src/executors/infrastructure-plan/schema.json +0 -38
  368. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.d.ts +0 -42
  369. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js +0 -1229
  370. package/src/executors/router-waf-rehearsal/schema.json +0 -29
  371. package/src/executors/secret-guardrails/schema.json +0 -6
  372. package/src/executors/secret-guardrails/secret-guardrails.d.ts +0 -3
  373. package/src/executors/secret-guardrails/secret-guardrails.js +0 -44
  374. package/src/executors/secret-initialize/schema.json +0 -42
  375. package/src/executors/secret-initialize/secret-initialize.d.ts +0 -34
  376. package/src/executors/secret-initialize/secret-initialize.js +0 -297
  377. package/src/executors/secret-metadata/schema.json +0 -36
  378. package/src/executors/secret-metadata/secret-metadata.d.ts +0 -46
  379. package/src/executors/secret-metadata/secret-metadata.js +0 -230
  380. package/src/executors/sst-lifecycle/generated-secret-retirement.d.ts +0 -53
  381. package/src/executors/sst-lifecycle/generated-secret-retirement.js +0 -192
  382. package/src/executors/sst-lifecycle/logging-preflight.d.ts +0 -22
  383. package/src/executors/sst-lifecycle/logging-preflight.js +0 -217
  384. package/src/executors/sst-lifecycle/secret-preflight.d.ts +0 -27
  385. package/src/executors/sst-lifecycle/secret-preflight.js +0 -125
  386. package/src/executors/work-markers/schema.json +0 -14
  387. package/src/executors/work-markers/work-markers.d.ts +0 -6
  388. package/src/executors/work-markers/work-markers.js +0 -20
  389. package/src/foundation/cost-estimate.d.ts +0 -175
  390. package/src/foundation/cost-estimate.js +0 -706
  391. package/src/foundation/private-smoke-admission.d.ts +0 -45
  392. package/src/foundation/private-smoke-admission.js +0 -180
  393. package/src/foundation/private-smoke-control-plane.d.ts +0 -18
  394. package/src/foundation/private-smoke-control-plane.js +0 -184
  395. package/src/foundation/root-site-readiness.d.ts +0 -27
  396. package/src/foundation/root-site-readiness.js +0 -78
  397. package/src/foundation/router-waf-rate-rehearsal.d.ts +0 -97
  398. package/src/foundation/router-waf-rate-rehearsal.js +0 -210
  399. package/src/foundation/router-waf.d.ts +0 -149
  400. package/src/foundation/router-waf.js +0 -809
  401. package/src/frontend-security/index.d.ts +0 -1
  402. package/src/frontend-security/index.js +0 -5
  403. package/src/frontend-security/security-headers.d.ts +0 -50
  404. package/src/frontend-security/security-headers.js +0 -418
  405. package/src/generators/blueprint/blueprint.d.ts +0 -5
  406. package/src/generators/blueprint/blueprint.js +0 -102
  407. package/src/generators/blueprint/files.d.ts +0 -6
  408. package/src/generators/blueprint/files.js +0 -217
  409. package/src/generators/blueprint/schema.d.ts +0 -4
  410. package/src/generators/blueprint/schema.json +0 -18
  411. package/src/generators/feature-registry.d.ts +0 -13
  412. package/src/generators/feature-registry.js +0 -73
  413. package/src/generators/function/function-registration.d.ts +0 -24
  414. package/src/generators/function/function-registration.js +0 -66
  415. package/src/generators/observability-infrastructure.d.ts +0 -2
  416. package/src/generators/observability-infrastructure.js +0 -31
  417. package/src/generators/preset/workspace-files-adopter-skills.d.ts +0 -7
  418. package/src/generators/preset/workspace-files-adopter-skills.js +0 -359
  419. package/src/generators/preset/workspace-files-agent-development.d.ts +0 -9
  420. package/src/generators/preset/workspace-files-agent-development.js +0 -42
  421. package/src/generators/preset/workspace-files-ci-acceptance.d.ts +0 -1
  422. package/src/generators/preset/workspace-files-ci-acceptance.js +0 -791
  423. package/src/generators/preset/workspace-files-ci-install.d.ts +0 -2
  424. package/src/generators/preset/workspace-files-ci-install.js +0 -196
  425. package/src/generators/preset/workspace-files-developer-agent.d.ts +0 -16
  426. package/src/generators/preset/workspace-files-developer-agent.js +0 -644
  427. package/src/generators/preset/workspace-files-ecr-inspector.d.ts +0 -18
  428. package/src/generators/preset/workspace-files-ecr-inspector.js +0 -298
  429. package/src/generators/preset/workspace-files-foundation-workload-roles.d.ts +0 -6
  430. package/src/generators/preset/workspace-files-foundation-workload-roles.js +0 -409
  431. package/src/generators/preset/workspace-files-performance-cost.d.ts +0 -66
  432. package/src/generators/preset/workspace-files-performance-cost.js +0 -866
  433. package/src/generators/preset/workspace-files-performance-load.d.ts +0 -73
  434. package/src/generators/preset/workspace-files-performance-load.js +0 -815
  435. package/src/generators/preset/workspace-files-shared-operation-claims.d.ts +0 -10
  436. package/src/generators/preset/workspace-files-shared-operation-claims.js +0 -59
  437. package/src/generators/preset/workspace-files-stage-authority.d.ts +0 -6
  438. package/src/generators/preset/workspace-files-stage-authority.js +0 -586
  439. package/src/generators/preset/workspace-files-thin-deploy.d.ts +0 -76
  440. package/src/generators/preset/workspace-files-thin-deploy.js +0 -2563
  441. package/src/generators/preset/workspace-files-thin-docs.d.ts +0 -7
  442. package/src/generators/preset/workspace-files-thin-docs.js +0 -386
  443. package/src/generators/preset/workspace-files-thin-release.d.ts +0 -14
  444. package/src/generators/preset/workspace-files-thin-release.js +0 -26
  445. package/src/generators/preset/workspace-files-workload-role-baseline.d.ts +0 -9
  446. package/src/generators/preset/workspace-files-workload-role-baseline.js +0 -1314
  447. package/src/generators/repository-policy/repository-policy.d.ts +0 -4
  448. package/src/generators/repository-policy/repository-policy.js +0 -294
  449. package/src/generators/repository-policy/schema.d.ts +0 -30
  450. package/src/generators/repository-policy/schema.json +0 -127
  451. package/src/generators/site/built-in-site-smoke-files.d.ts +0 -2
  452. package/src/generators/site/built-in-site-smoke-files.js +0 -37
  453. package/src/generators/slice/built-in-plan-alarm-identity.d.ts +0 -182
  454. package/src/generators/slice/built-in-plan-alarm-identity.js +0 -209
  455. package/src/generators/slice/built-in-plan-api-contract-files.d.ts +0 -2
  456. package/src/generators/slice/built-in-plan-api-contract-files.js +0 -2848
  457. package/src/generators/slice/built-in-plan-async-work-files.d.ts +0 -2
  458. package/src/generators/slice/built-in-plan-async-work-files.js +0 -6118
  459. package/src/generators/slice/built-in-plan-authorization-files.d.ts +0 -2
  460. package/src/generators/slice/built-in-plan-authorization-files.js +0 -2082
  461. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.d.ts +0 -2
  462. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +0 -1301
  463. package/src/generators/slice/built-in-plan-authorization-storage.d.ts +0 -3
  464. package/src/generators/slice/built-in-plan-authorization-storage.js +0 -119
  465. package/src/generators/slice/built-in-plan-background-work-files.d.ts +0 -2
  466. package/src/generators/slice/built-in-plan-background-work-files.js +0 -99
  467. package/src/generators/slice/built-in-plan-data-deletion-files.d.ts +0 -2
  468. package/src/generators/slice/built-in-plan-data-deletion-files.js +0 -273
  469. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.d.ts +0 -2
  470. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js +0 -223
  471. package/src/generators/slice/built-in-plan-data-files.d.ts +0 -2
  472. package/src/generators/slice/built-in-plan-data-files.js +0 -618
  473. package/src/generators/slice/built-in-plan-data-lifecycle-files.d.ts +0 -2
  474. package/src/generators/slice/built-in-plan-data-lifecycle-files.js +0 -775
  475. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.d.ts +0 -2
  476. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +0 -863
  477. package/src/generators/slice/built-in-plan-data-retention-job-files.d.ts +0 -2
  478. package/src/generators/slice/built-in-plan-data-retention-job-files.js +0 -169
  479. package/src/generators/slice/built-in-plan-data-retention-launcher-files.d.ts +0 -2
  480. package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +0 -186
  481. package/src/generators/slice/built-in-plan-data-rights-files.d.ts +0 -2
  482. package/src/generators/slice/built-in-plan-data-rights-files.js +0 -152
  483. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.d.ts +0 -2
  484. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js +0 -508
  485. package/src/generators/slice/built-in-plan-event-contract-literal.d.ts +0 -6
  486. package/src/generators/slice/built-in-plan-event-contract-literal.js +0 -52
  487. package/src/generators/slice/built-in-plan-foundation-files.d.ts +0 -15
  488. package/src/generators/slice/built-in-plan-foundation-files.js +0 -314
  489. package/src/generators/slice/built-in-plan-frontend-files.d.ts +0 -2
  490. package/src/generators/slice/built-in-plan-frontend-files.js +0 -1975
  491. package/src/generators/slice/built-in-plan-frontend-header-proof.d.ts +0 -6
  492. package/src/generators/slice/built-in-plan-frontend-header-proof.js +0 -282
  493. package/src/generators/slice/built-in-plan-infrastructure-safety-files.d.ts +0 -2
  494. package/src/generators/slice/built-in-plan-infrastructure-safety-files.js +0 -373
  495. package/src/generators/slice/built-in-plan-key-value-cleanup.d.ts +0 -4
  496. package/src/generators/slice/built-in-plan-key-value-cleanup.js +0 -101
  497. package/src/generators/slice/built-in-plan-key-value-consumer.d.ts +0 -4
  498. package/src/generators/slice/built-in-plan-key-value-consumer.js +0 -151
  499. package/src/generators/slice/built-in-plan-key-value-deletion.d.ts +0 -2
  500. package/src/generators/slice/built-in-plan-key-value-deletion.js +0 -377
  501. package/src/generators/slice/built-in-plan-key-value-delivery.d.ts +0 -2
  502. package/src/generators/slice/built-in-plan-key-value-delivery.js +0 -137
  503. package/src/generators/slice/built-in-plan-key-value-export.d.ts +0 -2
  504. package/src/generators/slice/built-in-plan-key-value-export.js +0 -595
  505. package/src/generators/slice/built-in-plan-key-value-holds.d.ts +0 -2
  506. package/src/generators/slice/built-in-plan-key-value-holds.js +0 -189
  507. package/src/generators/slice/built-in-plan-key-value-infrastructure.d.ts +0 -2
  508. package/src/generators/slice/built-in-plan-key-value-infrastructure.js +0 -102
  509. package/src/generators/slice/built-in-plan-key-value-performance.d.ts +0 -5
  510. package/src/generators/slice/built-in-plan-key-value-performance.js +0 -530
  511. package/src/generators/slice/built-in-plan-key-value-provider.d.ts +0 -4
  512. package/src/generators/slice/built-in-plan-key-value-provider.js +0 -366
  513. package/src/generators/slice/built-in-plan-key-value-records.d.ts +0 -3
  514. package/src/generators/slice/built-in-plan-key-value-records.js +0 -232
  515. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.d.ts +0 -2
  516. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.js +0 -103
  517. package/src/generators/slice/built-in-plan-key-value-retention-job-files.d.ts +0 -2
  518. package/src/generators/slice/built-in-plan-key-value-retention-job-files.js +0 -160
  519. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.d.ts +0 -2
  520. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.js +0 -329
  521. package/src/generators/slice/built-in-plan-key-value-retention-worker.d.ts +0 -2
  522. package/src/generators/slice/built-in-plan-key-value-retention-worker.js +0 -477
  523. package/src/generators/slice/built-in-plan-key-value-retention.d.ts +0 -2
  524. package/src/generators/slice/built-in-plan-key-value-retention.js +0 -184
  525. package/src/generators/slice/built-in-plan-log-group-helpers.d.ts +0 -29
  526. package/src/generators/slice/built-in-plan-log-group-helpers.js +0 -130
  527. package/src/generators/slice/built-in-plan-metadata-files.d.ts +0 -3
  528. package/src/generators/slice/built-in-plan-metadata-files.js +0 -401
  529. package/src/generators/slice/built-in-plan-native-runtime-authority-files.d.ts +0 -2
  530. package/src/generators/slice/built-in-plan-native-runtime-authority-files.js +0 -324
  531. package/src/generators/slice/built-in-plan-next-build-authority.d.ts +0 -5
  532. package/src/generators/slice/built-in-plan-next-build-authority.js +0 -124
  533. package/src/generators/slice/built-in-plan-operations-files.d.ts +0 -8
  534. package/src/generators/slice/built-in-plan-operations-files.js +0 -1106
  535. package/src/generators/slice/built-in-plan-performance-files.d.ts +0 -4
  536. package/src/generators/slice/built-in-plan-performance-files.js +0 -2444
  537. package/src/generators/slice/built-in-plan-release-files.d.ts +0 -2
  538. package/src/generators/slice/built-in-plan-release-files.js +0 -6585
  539. package/src/generators/slice/built-in-plan-reliability-files.d.ts +0 -2
  540. package/src/generators/slice/built-in-plan-reliability-files.js +0 -4728
  541. package/src/generators/slice/built-in-plan-secret-runtime-files.d.ts +0 -2
  542. package/src/generators/slice/built-in-plan-secret-runtime-files.js +0 -1015
  543. package/src/generators/slice/built-in-plan-sql-events.d.ts +0 -2
  544. package/src/generators/slice/built-in-plan-sql-events.js +0 -276
  545. package/src/generators/slice/built-in-plan-testing-files.d.ts +0 -2
  546. package/src/generators/slice/built-in-plan-testing-files.js +0 -2618
  547. package/src/generators/slice/built-in-plan-testing-persistence-event-files.d.ts +0 -7
  548. package/src/generators/slice/built-in-plan-testing-persistence-event-files.js +0 -487
  549. package/src/generators/slice/built-in-plan-testing-persistence-files.d.ts +0 -2
  550. package/src/generators/slice/built-in-plan-testing-persistence-files.js +0 -180
  551. package/src/generators/slice/built-in-plan-thin-release-files.d.ts +0 -11
  552. package/src/generators/slice/built-in-plan-thin-release-files.js +0 -162
  553. package/src/generators/slice/built-in-plan-verification-files.d.ts +0 -2
  554. package/src/generators/slice/built-in-plan-verification-files.js +0 -442
  555. package/src/generators/slice/built-in-plan-workload-role-files.d.ts +0 -2
  556. package/src/generators/slice/built-in-plan-workload-role-files.js +0 -2220
  557. package/src/generators/slice/data-policy-review-seed.d.ts +0 -2
  558. package/src/generators/slice/data-policy-review-seed.js +0 -22
  559. package/src/generators/slice/deployed-smoke-diagnostics.d.ts +0 -35
  560. package/src/generators/slice/deployed-smoke-diagnostics.js +0 -189
  561. package/src/generators/slice/deployed-smoke-readiness.d.ts +0 -9
  562. package/src/generators/slice/deployed-smoke-readiness.js +0 -309
  563. package/src/generators/slice/local-source-identity.d.ts +0 -2
  564. package/src/generators/slice/local-source-identity.js +0 -31
  565. package/src/generators/slice/pnpm-launch-script.d.ts +0 -13
  566. package/src/generators/slice/pnpm-launch-script.js +0 -28
  567. package/src/generators/upgrade/custom-domain-notice.d.ts +0 -19
  568. package/src/generators/upgrade/custom-domain-notice.js +0 -38
  569. package/src/generators/upgrade/external-blueprint-compositions.d.ts +0 -84
  570. package/src/generators/upgrade/external-blueprint-compositions.js +0 -478
  571. package/src/generators/upgrade/sql-seeded-reconciliation.d.ts +0 -2
  572. package/src/generators/upgrade/sql-seeded-reconciliation.js +0 -170
  573. package/src/generators/workload/performance-registration.d.ts +0 -33
  574. package/src/generators/workload/performance-registration.js +0 -224
  575. package/src/generators/workload/reliability-registration.d.ts +0 -16
  576. package/src/generators/workload/reliability-registration.js +0 -150
  577. package/src/generators/workload/service-performance-files.d.ts +0 -5
  578. package/src/generators/workload/service-performance-files.js +0 -1883
  579. package/src/git-policy/action-pins.d.ts +0 -43
  580. package/src/git-policy/action-pins.js +0 -50
  581. package/src/git-policy/github-bootstrap.d.ts +0 -95
  582. package/src/git-policy/github-bootstrap.js +0 -1250
  583. package/src/git-policy/index.d.ts +0 -3
  584. package/src/git-policy/index.js +0 -7
  585. package/src/git-policy/routing.d.ts +0 -21
  586. package/src/git-policy/routing.js +0 -138
  587. package/src/infrastructure-change/convergence.d.ts +0 -13
  588. package/src/infrastructure-change/convergence.js +0 -85
  589. package/src/infrastructure-change/drift.d.ts +0 -13
  590. package/src/infrastructure-change/drift.js +0 -112
  591. package/src/infrastructure-change/index.d.ts +0 -7
  592. package/src/infrastructure-change/index.js +0 -11
  593. package/src/infrastructure-change/local-capability.d.ts +0 -73
  594. package/src/infrastructure-change/local-capability.js +0 -114
  595. package/src/infrastructure-change/model.d.ts +0 -274
  596. package/src/infrastructure-change/model.js +0 -29
  597. package/src/infrastructure-change/normalize.d.ts +0 -16
  598. package/src/infrastructure-change/normalize.js +0 -285
  599. package/src/infrastructure-change/plan.d.ts +0 -67
  600. package/src/infrastructure-change/plan.js +0 -671
  601. package/src/infrastructure-change/risk.d.ts +0 -9
  602. package/src/infrastructure-change/risk.js +0 -349
  603. package/src/infrastructure-change/summary.d.ts +0 -20
  604. package/src/infrastructure-change/summary.js +0 -130
  605. package/src/performance/cost-collection.d.ts +0 -225
  606. package/src/performance/cost-collection.js +0 -827
  607. package/src/performance/cost-controls.d.ts +0 -135
  608. package/src/performance/cost-controls.js +0 -347
  609. package/src/performance/evidence.d.ts +0 -140
  610. package/src/performance/evidence.js +0 -601
  611. package/src/performance/index.d.ts +0 -10
  612. package/src/performance/index.js +0 -14
  613. package/src/performance/load-safety.d.ts +0 -84
  614. package/src/performance/load-safety.js +0 -348
  615. package/src/performance/model.d.ts +0 -129
  616. package/src/performance/model.js +0 -451
  617. package/src/performance/pr-artifact-budget.d.ts +0 -42
  618. package/src/performance/pr-artifact-budget.js +0 -151
  619. package/src/performance/runner.d.ts +0 -75
  620. package/src/performance/runner.js +0 -227
  621. package/src/performance/scenario-endpoint.d.ts +0 -1
  622. package/src/performance/scenario-endpoint.js +0 -5
  623. package/src/performance/scenario.d.ts +0 -215
  624. package/src/performance/scenario.js +0 -744
  625. package/src/performance/unit-cost.d.ts +0 -105
  626. package/src/performance/unit-cost.js +0 -364
  627. package/src/release/index.d.ts +0 -2
  628. package/src/release/index.js +0 -6
  629. package/src/release/lifecycle.d.ts +0 -132
  630. package/src/release/lifecycle.js +0 -411
  631. package/src/release/manifest.d.ts +0 -148
  632. package/src/release/manifest.js +0 -503
  633. package/src/release/rollout.d.ts +0 -170
  634. package/src/release/rollout.js +0 -578
  635. package/src/release/source-authority.d.ts +0 -19
  636. package/src/release/source-authority.js +0 -212
  637. package/src/schemas/aggregate-count-evidence-v1.json +0 -135
  638. package/src/schemas/api-contract-baseline-v1.json +0 -674
  639. package/src/schemas/api-contract-compatibility-report-v1.json +0 -126
  640. package/src/schemas/aws-billing-actual-evidence-v1.json +0 -407
  641. package/src/schemas/blueprint-input-schema-v1.json +0 -23
  642. package/src/schemas/blueprint-v1.json +0 -188
  643. package/src/schemas/data-lifecycle-policy-v1.json +0 -517
  644. package/src/schemas/performance-policy-v1.json +0 -335
  645. package/src/schemas/testing-evidence-quarantine-v1.json +0 -168
  646. package/src/schemas/testing-evidence-result-v1.json +0 -319
  647. package/src/secrets/aws-control-plane.d.ts +0 -29
  648. package/src/secrets/aws-control-plane.js +0 -322
  649. package/src/secrets/generated-aws-control-plane.d.ts +0 -33
  650. package/src/secrets/generated-aws-control-plane.js +0 -322
  651. package/src/secrets/guardrails.d.ts +0 -26
  652. package/src/secrets/guardrails.js +0 -328
  653. package/src/secrets/metadata.d.ts +0 -48
  654. package/src/secrets/metadata.js +0 -199
  655. package/src/secrets/operator.d.ts +0 -190
  656. package/src/secrets/operator.js +0 -701
  657. package/src/secrets/verification.d.ts +0 -18
  658. package/src/secrets/verification.js +0 -152
  659. package/src/supply-chain/action-pins.d.ts +0 -26
  660. package/src/supply-chain/action-pins.js +0 -262
  661. package/src/supply-chain/blueprint-trust-git.d.ts +0 -130
  662. package/src/supply-chain/blueprint-trust-git.js +0 -1666
  663. package/src/supply-chain/blueprint-trust-process.d.ts +0 -4
  664. package/src/supply-chain/blueprint-trust-process.js +0 -88
  665. package/src/supply-chain/blueprint-trust.d.ts +0 -354
  666. package/src/supply-chain/blueprint-trust.js +0 -1558
  667. package/src/supply-chain/blueprint-verification-authority.d.ts +0 -62
  668. package/src/supply-chain/blueprint-verification-authority.js +0 -679
  669. package/src/supply-chain/blueprint-verification-execution.d.ts +0 -68
  670. package/src/supply-chain/blueprint-verification-execution.js +0 -639
  671. package/src/supply-chain/build-output-bounds.d.ts +0 -2
  672. package/src/supply-chain/build-output-bounds.js +0 -12
  673. package/src/supply-chain/build-output.d.ts +0 -41
  674. package/src/supply-chain/build-output.js +0 -551
  675. package/src/supply-chain/common.d.ts +0 -21
  676. package/src/supply-chain/common.js +0 -107
  677. package/src/supply-chain/container-artifact-contract.d.ts +0 -23
  678. package/src/supply-chain/container-artifact-contract.js +0 -208
  679. package/src/supply-chain/container-release.d.ts +0 -119
  680. package/src/supply-chain/container-release.js +0 -496
  681. package/src/supply-chain/ecr-applicability.d.ts +0 -19
  682. package/src/supply-chain/ecr-applicability.js +0 -103
  683. package/src/supply-chain/ecr-scanning.d.ts +0 -85
  684. package/src/supply-chain/ecr-scanning.js +0 -325
  685. package/src/supply-chain/ecs-deployed-image.d.ts +0 -87
  686. package/src/supply-chain/ecs-deployed-image.js +0 -302
  687. package/src/supply-chain/errors.d.ts +0 -6
  688. package/src/supply-chain/errors.js +0 -15
  689. package/src/supply-chain/generated-blueprint-trust-command.d.ts +0 -4
  690. package/src/supply-chain/generated-blueprint-trust-command.js +0 -1394
  691. package/src/supply-chain/generated-command.d.ts +0 -1
  692. package/src/supply-chain/generated-command.js +0 -775
  693. package/src/supply-chain/generated-container-release-command.d.ts +0 -16
  694. package/src/supply-chain/generated-container-release-command.js +0 -3248
  695. package/src/supply-chain/generated-ecr-collector-command.d.ts +0 -20
  696. package/src/supply-chain/generated-ecr-collector-command.js +0 -1445
  697. package/src/supply-chain/generated-files.d.ts +0 -13
  698. package/src/supply-chain/generated-files.js +0 -421
  699. package/src/supply-chain/generated-scanner-command.d.ts +0 -1
  700. package/src/supply-chain/generated-scanner-command.js +0 -778
  701. package/src/supply-chain/index.d.ts +0 -28
  702. package/src/supply-chain/index.js +0 -36
  703. package/src/supply-chain/inventory.d.ts +0 -96
  704. package/src/supply-chain/inventory.js +0 -828
  705. package/src/supply-chain/license-expression.d.ts +0 -7
  706. package/src/supply-chain/license-expression.js +0 -128
  707. package/src/supply-chain/policy.d.ts +0 -105
  708. package/src/supply-chain/policy.js +0 -304
  709. package/src/supply-chain/publication.d.ts +0 -48
  710. package/src/supply-chain/publication.js +0 -85
  711. package/src/supply-chain/sbom.d.ts +0 -228
  712. package/src/supply-chain/sbom.js +0 -913
  713. package/src/supply-chain/scanner.d.ts +0 -77
  714. package/src/supply-chain/scanner.js +0 -514
  715. package/src/supply-chain/vendored-source.d.ts +0 -95
  716. package/src/supply-chain/vendored-source.js +0 -315
  717. package/src/testing-evidence/fixture-scope.d.ts +0 -53
  718. package/src/testing-evidence/fixture-scope.js +0 -142
  719. package/src/testing-evidence/index.d.ts +0 -5
  720. package/src/testing-evidence/index.js +0 -9
  721. package/src/testing-evidence/quarantine.d.ts +0 -48
  722. package/src/testing-evidence/quarantine.js +0 -253
  723. package/src/testing-evidence/result.d.ts +0 -109
  724. package/src/testing-evidence/result.js +0 -585
  725. package/src/testing-evidence/runner-adapter.d.ts +0 -51
  726. package/src/testing-evidence/runner-adapter.js +0 -288
  727. package/src/testing-evidence/sensitive-artifacts.d.ts +0 -13
  728. package/src/testing-evidence/sensitive-artifacts.js +0 -93
  729. package/src/work-markers/index.d.ts +0 -1
  730. package/src/work-markers/index.js +0 -5
  731. package/src/work-markers/work-markers.d.ts +0 -39
  732. package/src/work-markers/work-markers.js +0 -363
  733. package/src/workload-roles/account-baseline.d.ts +0 -143
  734. package/src/workload-roles/account-baseline.js +0 -980
  735. package/src/workload-roles/authority.d.ts +0 -40
  736. package/src/workload-roles/authority.js +0 -202
  737. package/src/workload-roles/aws-adapter.d.ts +0 -99
  738. package/src/workload-roles/aws-adapter.js +0 -416
  739. package/src/workload-roles/aws-internal-handler.d.ts +0 -27
  740. package/src/workload-roles/aws-internal-handler.js +0 -58
  741. package/src/workload-roles/aws-s3-state.d.ts +0 -52
  742. package/src/workload-roles/aws-s3-state.js +0 -191
  743. package/src/workload-roles/aws-sdk-control-plane.d.ts +0 -12
  744. package/src/workload-roles/aws-sdk-control-plane.js +0 -291
  745. package/src/workload-roles/boundary.d.ts +0 -34
  746. package/src/workload-roles/boundary.js +0 -137
  747. package/src/workload-roles/convergence.d.ts +0 -66
  748. package/src/workload-roles/convergence.js +0 -186
  749. package/src/workload-roles/handler.d.ts +0 -43
  750. package/src/workload-roles/handler.js +0 -158
  751. package/src/workload-roles/history.d.ts +0 -47
  752. package/src/workload-roles/history.js +0 -324
  753. package/src/workload-roles/injection.d.ts +0 -119
  754. package/src/workload-roles/injection.js +0 -495
  755. package/src/workload-roles/manifest.d.ts +0 -54
  756. package/src/workload-roles/manifest.js +0 -343
  757. package/src/workload-roles/provisioner.d.ts +0 -70
  758. package/src/workload-roles/provisioner.js +0 -239
  759. package/src/workload-roles/registration.d.ts +0 -102
  760. package/src/workload-roles/registration.js +0 -462
  761. package/src/workload-roles/stage-boundary.d.ts +0 -31
  762. package/src/workload-roles/stage-boundary.js +0 -208
  763. /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.d.ts +0 -0
  764. /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.js +0 -0
@@ -1,2848 +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
- validateSiteOwnershipRecord,
2054
- } = require('@empire-builder-kit/nx/ownership');
2055
-
2056
- const projectRoot = process.cwd();
2057
- const workspaceRoot = resolve(projectRoot, '../..');
2058
- const action = process.argv[2] ?? 'check';
2059
- if (action !== 'check' && action !== 'sync') {
2060
- throw new Error(
2061
- 'Usage: node scripts/contract-dependencies.mjs <check|sync>',
2062
- );
2063
- }
2064
- const readJson = (path) => {
2065
- const contents = readFileSync(path, 'utf8');
2066
- try {
2067
- return JSON.parse(contents);
2068
- } catch (error) {
2069
- const qualifiedPath = relative(workspaceRoot, path)
2070
- .split(sep)
2071
- .join('/');
2072
- throw new Error(
2073
- qualifiedPath +
2074
- ' contains malformed JSON: ' +
2075
- (error instanceof Error ? error.message : String(error)),
2076
- );
2077
- }
2078
- };
2079
- const declarationPath = join(
2080
- projectRoot,
2081
- 'contracts',
2082
- 'dependencies.json',
2083
- );
2084
- const ownershipPath = join(projectRoot, '.ebk', 'ownership.json');
2085
- const allowedContractExports = new Map([
2086
- ['./api-client', { exact: 'api/generated/client.ts' }],
2087
- ['./api-contract', { surface: 'api/contracts' }],
2088
- ['./contracts', { exact: 'contracts/index.ts' }],
2089
- ]);
2090
-
2091
- function isContained(root, candidate) {
2092
- const pathFromRoot = relative(root, candidate);
2093
- return (
2094
- pathFromRoot !== '..' &&
2095
- !pathFromRoot.startsWith('..' + sep) &&
2096
- !isAbsolute(pathFromRoot)
2097
- );
2098
- }
2099
-
2100
- function declaredExportTargets(declaration, packageName, exportName) {
2101
- if (typeof declaration === 'string') return [declaration];
2102
- if (
2103
- !declaration ||
2104
- typeof declaration !== 'object' ||
2105
- Array.isArray(declaration) ||
2106
- Object.keys(declaration).length === 0 ||
2107
- Object.values(declaration).some((target) => typeof target !== 'string')
2108
- ) {
2109
- throw new Error(
2110
- 'Package ' +
2111
- packageName +
2112
- ' has an invalid conditional export for ' +
2113
- exportName +
2114
- '.',
2115
- );
2116
- }
2117
- return Object.values(declaration);
2118
- }
2119
-
2120
- function validateContractExports(root, packageJson, publications) {
2121
- const exports = packageJson.exports;
2122
- const packagePrefix = packageJson.name + '/';
2123
- const requiredExports = new Set();
2124
- for (const publication of publications) {
2125
- if (publication === packagePrefix + 'api-contract') {
2126
- requiredExports.add('./api-client');
2127
- requiredExports.add('./api-contract');
2128
- } else if (publication === packagePrefix + 'contracts') {
2129
- requiredExports.add('./contracts');
2130
- }
2131
- }
2132
- for (const exportName of [...requiredExports].sort()) {
2133
- const expected = allowedContractExports.get(exportName);
2134
- if (!expected) {
2135
- throw new Error(
2136
- 'Package ' +
2137
- packageJson.name +
2138
- ' requires an unsupported contract export ' +
2139
- exportName +
2140
- '.',
2141
- );
2142
- }
2143
- if (!exports || !Object.hasOwn(exports, exportName)) {
2144
- throw new Error(
2145
- 'Package ' +
2146
- packageJson.name +
2147
- ' is missing contract export ' +
2148
- exportName +
2149
- '.',
2150
- );
2151
- }
2152
- for (const target of declaredExportTargets(
2153
- exports[exportName],
2154
- packageJson.name,
2155
- exportName,
2156
- )) {
2157
- if (!target.startsWith('./')) {
2158
- throw new Error(
2159
- 'Package ' +
2160
- packageJson.name +
2161
- ' contract export ' +
2162
- exportName +
2163
- ' must use a relative package target.',
2164
- );
2165
- }
2166
- const absoluteTarget = resolve(root, target);
2167
- if (
2168
- !isContained(workspaceRoot, absoluteTarget) ||
2169
- !isContained(root, absoluteTarget) ||
2170
- !existsSync(absoluteTarget) ||
2171
- !statSync(absoluteTarget).isFile()
2172
- ) {
2173
- throw new Error(
2174
- 'Package ' +
2175
- packageJson.name +
2176
- ' contract export ' +
2177
- exportName +
2178
- ' points outside its package or to a missing file.',
2179
- );
2180
- }
2181
- const realTarget = realpathSync(absoluteTarget);
2182
- if (
2183
- !isContained(realpathSync(workspaceRoot), realTarget) ||
2184
- !isContained(realpathSync(root), realTarget)
2185
- ) {
2186
- throw new Error(
2187
- 'Package ' +
2188
- packageJson.name +
2189
- ' contract export ' +
2190
- exportName +
2191
- ' escapes the repository through an aliased target.',
2192
- );
2193
- }
2194
- const targetFromPackage = relative(root, absoluteTarget)
2195
- .split(sep)
2196
- .join('/');
2197
- const expectedSurface = expected.exact ?? expected.surface;
2198
- const mapsToSurface =
2199
- expected.exact !== undefined
2200
- ? targetFromPackage === expected.exact
2201
- : targetFromPackage.endsWith('.ts') &&
2202
- isContained(join(root, expectedSurface), absoluteTarget) &&
2203
- absoluteTarget !== join(root, expectedSurface);
2204
- if (!mapsToSurface) {
2205
- throw new Error(
2206
- 'Package ' +
2207
- packageJson.name +
2208
- ' contract export ' +
2209
- exportName +
2210
- ' is remapped outside its corresponding contract surface.',
2211
- );
2212
- }
2213
- }
2214
- }
2215
- }
2216
-
2217
- ${built_in_plan_event_contract_literal_js_1.EVENT_CONTRACT_LITERAL_SOURCE}
2218
- function producerEventContract(producer, slice) {
2219
- const path = join(producer.root, 'contracts', 'events.ts');
2220
- if (!existsSync(path)) {
2221
- throw new Error(
2222
- 'Producer ' + slice + ' publishes no contracts/events.ts EventContractSchema.',
2223
- );
2224
- }
2225
- const file = ts.createSourceFile(
2226
- path,
2227
- readFileSync(path, 'utf8'),
2228
- ts.ScriptTarget.ESNext,
2229
- true,
2230
- ts.ScriptKind.TS,
2231
- );
2232
- let schema;
2233
- for (const statement of file.statements) {
2234
- if (!ts.isVariableStatement(statement)) continue;
2235
- for (const variable of statement.declarationList.declarations) {
2236
- if (
2237
- ts.isIdentifier(variable.name) &&
2238
- variable.name.text === 'EventContractSchema' &&
2239
- variable.initializer
2240
- ) {
2241
- if (schema !== undefined) {
2242
- throw new Error(
2243
- 'Producer ' + slice + ' EventContractSchema export is ambiguous.',
2244
- );
2245
- }
2246
- schema = eventLiteral(variable.initializer);
2247
- }
2248
- }
2249
- }
2250
- if (
2251
- schema?.kind !== 'ebk-event-contract-schema' ||
2252
- schema.schemaVersion !== 1 ||
2253
- schema.slice !== slice ||
2254
- !Array.isArray(schema.events)
2255
- ) {
2256
- throw new Error(
2257
- 'Producer ' +
2258
- slice +
2259
- ' contracts/events.ts must export one canonical v1 EventContractSchema.',
2260
- );
2261
- }
2262
- return schema;
2263
- }
2264
-
2265
- // Bind each declared cross-Slice subscription to the producer's published
2266
- // EventContractSchema, so a removed, renamed or re-versioned event fails here
2267
- // instead of silently stopping delivery.
2268
- async function checkEventSubscriptions(dependencies, projects) {
2269
- const subscriptionPath = join(
2270
- projectRoot,
2271
- 'contracts',
2272
- 'event-subscriptions.json',
2273
- );
2274
- if (!existsSync(subscriptionPath)) {
2275
- throw new Error(
2276
- 'contracts/event-subscriptions.json is missing. Restore the seeded ' +
2277
- 'declaration with schemaVersion 1 and an empty subscriptions list.',
2278
- );
2279
- }
2280
- // The managed infrastructure validator is the one authority for the
2281
- // declaration shape; this check runs it exactly as deployment does.
2282
- const validator = await import(
2283
- 'data:text/javascript;base64,' +
2284
- Buffer.from(
2285
- ts.transpileModule(
2286
- readFileSync(
2287
- join(projectRoot, 'infra', 'event-subscriptions.ts'),
2288
- 'utf8',
2289
- ),
2290
- {
2291
- compilerOptions: {
2292
- module: ts.ModuleKind.ESNext,
2293
- target: ts.ScriptTarget.ES2022,
2294
- },
2295
- },
2296
- ).outputText,
2297
- ).toString('base64')
2298
- );
2299
- const subscriptions = validator.crossSliceEventSubscriptions(
2300
- readJson(subscriptionPath),
2301
- dependencies,
2302
- );
2303
- for (const subscription of subscriptions) {
2304
- const producer = projects.get(subscription.source);
2305
- if (
2306
- !producer ||
2307
- !dependencies.consumes.includes(producer.packageJson.name + '/contracts')
2308
- ) {
2309
- throw new Error(
2310
- 'Subscribed source ' +
2311
- subscription.source +
2312
- ' is not a consumed Product Slice contracts package.',
2313
- );
2314
- }
2315
- const schema = producerEventContract(producer, subscription.source);
2316
- for (const detailType of subscription.detailTypes) {
2317
- const published = schema.events.filter(
2318
- (event) => event?.detailType === detailType,
2319
- );
2320
- if (
2321
- published.length !== 1 ||
2322
- published[0].source !== subscription.source
2323
- ) {
2324
- throw new Error(
2325
- 'Producer ' +
2326
- subscription.source +
2327
- ' does not publish ' +
2328
- detailType +
2329
- ' in its EventContractSchema. Restore the producer event or ' +
2330
- 'remove the subscription from contracts/event-subscriptions.json.',
2331
- );
2332
- }
2333
- if (!subscription.schemaVersions.includes(published[0].schemaVersion)) {
2334
- throw new Error(
2335
- 'Producer ' +
2336
- subscription.source +
2337
- ' publishes ' +
2338
- detailType +
2339
- ' schemaVersion ' +
2340
- published[0].schemaVersion +
2341
- ', which ${name} does not subscribe to. Accept that version ' +
2342
- 'in api/event-consumer.ts, then declare it in ' +
2343
- 'contracts/event-subscriptions.json.',
2344
- );
2345
- }
2346
- }
2347
- }
2348
- }
2349
-
2350
- const declaration = readJson(declarationPath);
2351
- if (
2352
- !declaration ||
2353
- typeof declaration !== 'object' ||
2354
- Array.isArray(declaration) ||
2355
- declaration.schemaVersion !== 1 ||
2356
- !Array.isArray(declaration.consumes) ||
2357
- Object.keys(declaration).some(
2358
- (key) => !['consumes', 'schemaVersion'].includes(key),
2359
- )
2360
- ) {
2361
- throw new Error(
2362
- 'contracts/dependencies.json must be a v1 consumes declaration.',
2363
- );
2364
- }
2365
- const ownership = readJson(ownershipPath);
2366
- const [normalized] = normalizeApiContractProjectDeclarations([
2367
- {
2368
- contracts: {
2369
- consumes: declaration.consumes,
2370
- publishes: ownership.contracts?.publishes ?? [],
2371
- },
2372
- project: '${name}',
2373
- },
2374
- ]);
2375
- if (!normalized) {
2376
- throw new Error('The contract dependency declaration did not normalize.');
2377
- }
2378
-
2379
- const packagesRoot = join(workspaceRoot, 'packages');
2380
- const projects = new Map();
2381
- const packageNames = new Set();
2382
- const declarations = [];
2383
- for (const entry of readdirSync(packagesRoot, { withFileTypes: true })) {
2384
- if (!entry.isDirectory() || entry.name === 'foundation') continue;
2385
- const root = join(packagesRoot, entry.name);
2386
- const candidateOwnershipPath = join(root, '.ebk', 'ownership.json');
2387
- if (!existsSync(candidateOwnershipPath)) continue;
2388
- const candidateOwnership =
2389
- root === projectRoot
2390
- ? {
2391
- ...ownership,
2392
- contracts: {
2393
- ...ownership.contracts,
2394
- consumes: normalized.contracts.consumes,
2395
- },
2396
- }
2397
- : readJson(candidateOwnershipPath);
2398
- // The root site publishes no contracts. packages/site holds only its
2399
- // record, and its record belongs only there.
2400
- if (entry.name === 'site' || candidateOwnership?.kind === 'site') {
2401
- if (
2402
- entry.name === 'site' &&
2403
- validateSiteOwnershipRecord(candidateOwnership).valid
2404
- ) {
2405
- continue;
2406
- }
2407
- throw new Error(
2408
- entry.name === 'site'
2409
- ? 'packages/site is reserved for the workspace root site and must hold valid root site ownership.'
2410
- : 'Root site ownership belongs only in packages/site, not packages/' +
2411
- entry.name +
2412
- '.',
2413
- );
2414
- }
2415
- const validation = validateGeneratedOwnershipRecord(candidateOwnership);
2416
- if (!validation.valid) {
2417
- throw new Error(
2418
- 'Product Slice ' +
2419
- entry.name +
2420
- ' has invalid ownership metadata: ' +
2421
- JSON.stringify(validation.issues),
2422
- );
2423
- }
2424
- const project = validation.value.slice;
2425
- const packageJson = readJson(join(root, 'package.json'));
2426
- if (
2427
- typeof packageJson.name !== 'string' ||
2428
- packageJson.name.length === 0 ||
2429
- projects.has(project) ||
2430
- packageNames.has(packageJson.name)
2431
- ) {
2432
- throw new Error(
2433
- 'Product Slice projects and package names must be unique and explicit.',
2434
- );
2435
- }
2436
- packageNames.add(packageJson.name);
2437
- validateContractExports(
2438
- root,
2439
- packageJson,
2440
- validation.value.contracts.publishes,
2441
- );
2442
- projects.set(project, { packageJson, root });
2443
- declarations.push({
2444
- contracts: validation.value.contracts,
2445
- project,
2446
- });
2447
- }
2448
- if (!projects.has('${name}')) {
2449
- throw new Error(
2450
- 'The current Product Slice is absent from workspace ownership.',
2451
- );
2452
- }
2453
- const resolution = resolveApiContractDependencies(declarations);
2454
- for (const publication of resolution.contracts) {
2455
- const producer = projects.get(publication.producer);
2456
- if (!producer) {
2457
- throw new Error(
2458
- 'Resolved contract producer ' + publication.producer + ' is absent.',
2459
- );
2460
- }
2461
- const prefix = producer.packageJson.name + '/';
2462
- if (!publication.contract.startsWith(prefix)) {
2463
- throw new Error(
2464
- 'Published contract ' +
2465
- publication.contract +
2466
- ' is outside producer package ' +
2467
- producer.packageJson.name +
2468
- '.',
2469
- );
2470
- }
2471
- const exportName = './' + publication.contract.slice(prefix.length);
2472
- if (!allowedContractExports.has(exportName)) {
2473
- throw new Error(
2474
- 'Published contract ' +
2475
- publication.contract +
2476
- ' does not use an allowed package export ' +
2477
- exportName +
2478
- '.',
2479
- );
2480
- }
2481
- for (const consumerName of publication.consumers) {
2482
- const consumer = projects.get(consumerName);
2483
- const version =
2484
- consumer?.packageJson.dependencies?.[producer.packageJson.name];
2485
- if (typeof version !== 'string' || !version.startsWith('workspace:')) {
2486
- throw new Error(
2487
- 'Consumed contract ' +
2488
- publication.contract +
2489
- ' requires ' +
2490
- consumerName +
2491
- ' to declare a workspace dependency on ' +
2492
- producer.packageJson.name +
2493
- '.',
2494
- );
2495
- }
2496
- }
2497
- }
2498
- const current = [...(ownership.contracts?.consumes ?? [])].sort();
2499
- const expected = [...normalized.contracts.consumes];
2500
- if (action === 'check') {
2501
- await checkEventSubscriptions(declaration, projects);
2502
- if (JSON.stringify(current) !== JSON.stringify(expected)) {
2503
- throw new Error(
2504
- 'Contract declarations are out of sync. Run ' +
2505
- 'pnpm nx run ${name}:contract-dependencies-sync.',
2506
- );
2507
- }
2508
- process.stdout.write(
2509
- JSON.stringify({
2510
- action,
2511
- consumes: expected,
2512
- project: '${name}',
2513
- schemaVersion: 1,
2514
- }) + '\\n',
2515
- );
2516
- } else {
2517
- const candidate = {
2518
- ...ownership,
2519
- contracts: {
2520
- ...ownership.contracts,
2521
- consumes: expected,
2522
- },
2523
- };
2524
- const validation = validateGeneratedOwnershipRecord(candidate);
2525
- if (!validation.valid) {
2526
- throw new Error(
2527
- 'Contract dependency sync produced invalid ownership: ' +
2528
- JSON.stringify(validation.issues),
2529
- );
2530
- }
2531
- writeFileSync(
2532
- ownershipPath,
2533
- JSON.stringify(validation.value, null, 2) + '\\n',
2534
- 'utf8',
2535
- );
2536
- process.stdout.write(
2537
- JSON.stringify({
2538
- action,
2539
- consumes: expected,
2540
- project: '${name}',
2541
- schemaVersion: 1,
2542
- }) + '\\n',
2543
- );
2544
- }
2545
- `,
2546
- 'scripts/api-contract.mjs': `import { createHash } from 'node:crypto';
2547
- import { spawnSync } from 'node:child_process';
2548
- import {
2549
- mkdirSync,
2550
- readFileSync,
2551
- rmSync,
2552
- writeFileSync,
2553
- } from 'node:fs';
2554
- import { createRequire } from 'node:module';
2555
- import { join, resolve } from 'node:path';
2556
- import { createApiContractArtifacts } from '@empire-builder-kit/runtime/api-contract';
2557
- import { ${contractIdentifier} } from '../api/contracts/protected.ts';
2558
-
2559
- const require = createRequire(import.meta.url);
2560
- const {
2561
- authorizeApiContractBaselineUpdate,
2562
- compareApiContracts,
2563
- createApiContractCompatibilityEvidence,
2564
- planApiContractBaselineUpdate,
2565
- } = require('@empire-builder-kit/nx/api-contract');
2566
- const {
2567
- createTestingEvidenceFromRunnerAttempts,
2568
- inspectTestingEvidenceArtifact,
2569
- normalizeVitestEvidenceAttempt,
2570
- } = require('@empire-builder-kit/nx/testing-evidence');
2571
- const {
2572
- validateGeneratedOwnershipRecord,
2573
- } = require('@empire-builder-kit/nx/ownership');
2574
-
2575
- const projectRoot = process.cwd();
2576
- const workspaceRoot = resolve(projectRoot, '../..');
2577
- const generatedRoot = join(projectRoot, 'api', 'generated');
2578
- const evidenceRoot = join(projectRoot, '.ebk', 'evidence');
2579
- const ownershipPath = join(projectRoot, '.ebk', 'ownership.json');
2580
- const normalizedPath = join(generatedRoot, 'contract.json');
2581
- const openApiPath = join(generatedRoot, 'openapi.json');
2582
- const baselinePath = join(generatedRoot, 'baseline.json');
2583
- const reportPath = join(evidenceRoot, 'api-contract-compatibility.json');
2584
- const resultPath = join(evidenceRoot, 'api-contract.json');
2585
- const readJson = (path) => JSON.parse(readFileSync(path, 'utf8'));
2586
- const workspacePackage = readJson(join(workspaceRoot, 'package.json'));
2587
- const ownership = readJson(ownershipPath);
2588
- const artifacts = createApiContractArtifacts(${contractIdentifier});
2589
- const action = process.argv[2] ?? 'check';
2590
- const digest = (contents) =>
2591
- 'sha256:' + createHash('sha256').update(contents).digest('hex');
2592
-
2593
- ${local_source_identity_js_1.localSourceCommitFunction}
2594
-
2595
- function sourceIdentity() {
2596
- const commit = localSourceCommit();
2597
- const frameworkCandidate =
2598
- workspacePackage.dependencies?.['@empire-builder-kit/runtime'];
2599
- if (typeof frameworkCandidate !== 'string' || !frameworkCandidate) {
2600
- throw new Error('The workspace runtime candidate is unavailable.');
2601
- }
2602
- return {
2603
- blueprintCandidates: [
2604
- ownership.blueprint.name + '@' + ownership.blueprint.version,
2605
- ],
2606
- commit,
2607
- frameworkCandidate,
2608
- };
2609
- }
2610
-
2611
- function writeManagedArtifacts() {
2612
- mkdirSync(generatedRoot, { recursive: true });
2613
- writeFileSync(normalizedPath, artifacts.normalizedJson, 'utf8');
2614
- writeFileSync(openApiPath, artifacts.openApiJson, 'utf8');
2615
- }
2616
-
2617
- function restampManagedArtifacts() {
2618
- const managedArtifacts = new Map([
2619
- ['api/generated/contract.json', artifacts.normalizedJson],
2620
- ['api/generated/openapi.json', artifacts.openApiJson],
2621
- ]);
2622
- const restamped = new Set();
2623
- const candidate = {
2624
- ...ownership,
2625
- paths: ownership.paths.map((entry) => {
2626
- const contents = managedArtifacts.get(entry.path);
2627
- if (contents === undefined) return entry;
2628
- if (entry.mode !== 'managed' || entry.managedJsonPointers !== undefined) {
2629
- throw new Error(
2630
- 'API contract generation can restamp only whole-file managed artifacts.',
2631
- );
2632
- }
2633
- restamped.add(entry.path);
2634
- return {
2635
- ...entry,
2636
- sha256: createHash('sha256').update(contents).digest('hex'),
2637
- };
2638
- }),
2639
- };
2640
- if (restamped.size !== managedArtifacts.size) {
2641
- throw new Error(
2642
- 'API contract generation could not find every managed artifact in ownership metadata.',
2643
- );
2644
- }
2645
- const validation = validateGeneratedOwnershipRecord(candidate);
2646
- if (!validation.valid) {
2647
- throw new Error(
2648
- 'API contract generation produced invalid ownership metadata: ' +
2649
- JSON.stringify(validation.issues),
2650
- );
2651
- }
2652
- writeFileSync(
2653
- ownershipPath,
2654
- JSON.stringify(validation.value, null, 2) + '\\n',
2655
- 'utf8',
2656
- );
2657
- }
2658
-
2659
- function approvalPath() {
2660
- const inline = process.argv.find((value) => value.startsWith('--approval='));
2661
- if (inline) return inline.slice('--approval='.length);
2662
- const index = process.argv.indexOf('--approval');
2663
- return index >= 0 ? process.argv[index + 1] : undefined;
2664
- }
2665
-
2666
- if (action === 'generate') {
2667
- writeManagedArtifacts();
2668
- restampManagedArtifacts();
2669
- process.stdout.write(
2670
- JSON.stringify({
2671
- action,
2672
- baselineUpdated: false,
2673
- normalizedDigest: digest(artifacts.normalizedJson),
2674
- openApiDigest: digest(artifacts.openApiJson),
2675
- }) + '\\n',
2676
- );
2677
- } else if (action === 'baseline') {
2678
- const currentBaseline = readJson(baselinePath);
2679
- const plan = planApiContractBaselineUpdate(
2680
- currentBaseline,
2681
- artifacts.normalized,
2682
- );
2683
- if (plan.disposition === 'no-change') {
2684
- process.stdout.write(
2685
- JSON.stringify({
2686
- action,
2687
- baselineUpdated: false,
2688
- candidateDigest: plan.candidate.digest,
2689
- disposition: plan.disposition,
2690
- }) + '\\n',
2691
- );
2692
- } else {
2693
- const path = approvalPath();
2694
- if (!path) {
2695
- throw new Error(
2696
- 'A baseline update requires --approval=<reviewed-json-path>.',
2697
- );
2698
- }
2699
- const authorization = authorizeApiContractBaselineUpdate(
2700
- plan,
2701
- readJson(resolve(projectRoot, path)),
2702
- );
2703
- writeFileSync(baselinePath, authorization.candidateJson, 'utf8');
2704
- process.stdout.write(
2705
- JSON.stringify({
2706
- acceptedClassification: authorization.acceptedClassification,
2707
- action,
2708
- baselineDigest: authorization.baselineDigest,
2709
- baselineUpdated: true,
2710
- candidateDigest: authorization.candidateDigest,
2711
- }) + '\\n',
2712
- );
2713
- }
2714
- } else if (action === 'check') {
2715
- const startedAt = new Date().toISOString();
2716
- mkdirSync(evidenceRoot, { recursive: true });
2717
- rmSync(reportPath, { force: true });
2718
- rmSync(resultPath, { force: true });
2719
- try {
2720
- const baseline = readJson(baselinePath);
2721
- const report = compareApiContracts(baseline, artifacts.normalized);
2722
- const reportJson = JSON.stringify(report, null, 2) + '\\n';
2723
- const reportInspection = inspectTestingEvidenceArtifact({
2724
- contents: reportJson,
2725
- });
2726
- const generatedDrift =
2727
- readFileSync(normalizedPath, 'utf8') !== artifacts.normalizedJson ||
2728
- readFileSync(openApiPath, 'utf8') !== artifacts.openApiJson;
2729
- const completedAt = new Date().toISOString();
2730
- const retainedArtifacts = [];
2731
- if (reportInspection.safe) {
2732
- writeFileSync(reportPath, reportJson, 'utf8');
2733
- retainedArtifacts.push({
2734
- digest: digest(reportJson),
2735
- name: '.ebk/evidence/api-contract-compatibility.json',
2736
- retentionClass: 'source-result',
2737
- });
2738
- }
2739
- const evidenceOptions = {
2740
- artifacts: retainedArtifacts,
2741
- commandVersion: '1',
2742
- completedAt,
2743
- project: '${name}',
2744
- report,
2745
- source: sourceIdentity(),
2746
- startedAt,
2747
- target: 'api-contract-check',
2748
- workspace: workspacePackage.name,
2749
- };
2750
- const result =
2751
- generatedDrift || !reportInspection.safe
2752
- ? createTestingEvidenceFromRunnerAttempts({
2753
- artifacts: retainedArtifacts,
2754
- attempts: [
2755
- normalizeVitestEvidenceAttempt({
2756
- attempt: 1,
2757
- completedAt,
2758
- failed: 1,
2759
- findings: [
2760
- {
2761
- classification: generatedDrift
2762
- ? 'environment-drift'
2763
- : 'sensitive-artifact',
2764
- summary: generatedDrift
2765
- ? 'Managed API artifacts differ from the authoritative contract.'
2766
- : 'The API compatibility report matched protected artifact data and was not retained.',
2767
- },
2768
- ],
2769
- passed: 0,
2770
- skipped: 0,
2771
- startedAt,
2772
- }),
2773
- ],
2774
- cleanup: { outcome: 'not-required' },
2775
- environment: { class: 'source', deployed: false },
2776
- operation: {
2777
- commandVersion: '1',
2778
- project: '${name}',
2779
- proofLayer: 'contract-compatibility',
2780
- target: 'api-contract-check',
2781
- },
2782
- proofStarted: true,
2783
- slice: '${name}',
2784
- source: evidenceOptions.source,
2785
- workspace: workspacePackage.name,
2786
- })
2787
- : createApiContractCompatibilityEvidence(evidenceOptions);
2788
- writeFileSync(
2789
- resultPath,
2790
- JSON.stringify(result, null, 2) + '\\n',
2791
- 'utf8',
2792
- );
2793
- process.stdout.write(JSON.stringify(result) + '\\n');
2794
- if (result.outcome !== 'passed') process.exitCode = 1;
2795
- } catch (error) {
2796
- const completedAt = new Date().toISOString();
2797
- const missing =
2798
- error &&
2799
- typeof error === 'object' &&
2800
- 'code' in error &&
2801
- error.code === 'ENOENT';
2802
- const result = createTestingEvidenceFromRunnerAttempts({
2803
- artifacts: [],
2804
- attempts: [],
2805
- cleanup: { outcome: 'not-required' },
2806
- environment: { class: 'source', deployed: false },
2807
- operation: {
2808
- commandVersion: '1',
2809
- project: '${name}',
2810
- proofLayer: 'contract-compatibility',
2811
- target: 'api-contract-check',
2812
- },
2813
- preflight: {
2814
- completedAt,
2815
- findings: [
2816
- {
2817
- classification: missing
2818
- ? 'prerequisite-missing'
2819
- : 'environment-drift',
2820
- summary: missing
2821
- ? 'A required API contract artifact or baseline is missing.'
2822
- : 'A required API contract artifact or baseline is invalid.',
2823
- },
2824
- ],
2825
- startedAt,
2826
- },
2827
- proofStarted: false,
2828
- slice: '${name}',
2829
- source: sourceIdentity(),
2830
- workspace: workspacePackage.name,
2831
- });
2832
- writeFileSync(
2833
- resultPath,
2834
- JSON.stringify(result, null, 2) + '\\n',
2835
- 'utf8',
2836
- );
2837
- process.stdout.write(JSON.stringify(result) + '\\n');
2838
- process.exitCode = 1;
2839
- }
2840
- } else {
2841
- throw new Error(
2842
- 'Usage: node scripts/api-contract.mjs <check|generate|baseline>',
2843
- );
2844
- }
2845
- `,
2846
- };
2847
- }
2848
- //# sourceMappingURL=built-in-plan-api-contract-files.js.map