@wildo-ai/platform-config-lib 1.1.11 → 1.1.13

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 (389) hide show
  1. package/dist/esm/_unimplemented/soft-warn.d.ts +24 -49
  2. package/dist/esm/_unimplemented/soft-warn.d.ts.map +1 -1
  3. package/dist/esm/_unimplemented/soft-warn.js +24 -49
  4. package/dist/esm/_unimplemented/soft-warn.js.map +1 -1
  5. package/dist/esm/blueprint/anchored-region.d.ts.map +1 -1
  6. package/dist/esm/blueprint/anchored-region.js.map +1 -1
  7. package/dist/esm/blueprint/blueprint.schemas.d.ts +0 -89
  8. package/dist/esm/blueprint/blueprint.schemas.d.ts.map +1 -1
  9. package/dist/esm/blueprint/blueprint.schemas.js.map +1 -1
  10. package/dist/esm/bootstrap/application-backend-env.contracts.d.ts.map +1 -1
  11. package/dist/esm/bootstrap/application-backend-env.contracts.js.map +1 -1
  12. package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts.map +1 -1
  13. package/dist/esm/bootstrap/application-creation-verification-env.contracts.js.map +1 -1
  14. package/dist/esm/bootstrap/bootstrap-planner.d.ts.map +1 -1
  15. package/dist/esm/bootstrap/bootstrap-planner.js.map +1 -1
  16. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  17. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  18. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +8 -1
  19. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  20. package/dist/esm/bootstrap/bootstrap.schemas.js +15 -1
  21. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  22. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +10 -2
  23. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  24. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +10 -2
  25. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  26. package/dist/esm/bootstrap/platform-store-preconnect.d.ts +21 -0
  27. package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -1
  28. package/dist/esm/bootstrap/platform-store-preconnect.js +25 -0
  29. package/dist/esm/bootstrap/platform-store-preconnect.js.map +1 -1
  30. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts +80 -0
  31. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts.map +1 -0
  32. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js +81 -0
  33. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js.map +1 -0
  34. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts +41 -9
  35. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
  36. package/dist/esm/bootstrap/runtime-backing-service-access.js +77 -28
  37. package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
  38. package/dist/esm/bootstrap/runtime-network-policy.d.ts +117 -12
  39. package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
  40. package/dist/esm/bootstrap/runtime-network-policy.js +222 -23
  41. package/dist/esm/bootstrap/runtime-network-policy.js.map +1 -1
  42. package/dist/esm/bootstrap/runtime-network-topology.d.ts +31 -4
  43. package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
  44. package/dist/esm/bootstrap/runtime-network-topology.js +43 -2
  45. package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
  46. package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -1
  47. package/dist/esm/bootstrap/runtime-platform-access.js.map +1 -1
  48. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts +40 -2
  49. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
  50. package/dist/esm/bootstrap/runtime-principal.contracts.js +66 -3
  51. package/dist/esm/bootstrap/runtime-principal.contracts.js.map +1 -1
  52. package/dist/esm/bootstrap/runtime-response-integrity.d.ts.map +1 -1
  53. package/dist/esm/bootstrap/runtime-response-integrity.js +3 -3
  54. package/dist/esm/bootstrap/runtime-response-integrity.js.map +1 -1
  55. package/dist/esm/bootstrap/runtime-secret-env.contracts.d.ts.map +1 -1
  56. package/dist/esm/bootstrap/runtime-secret-env.contracts.js.map +1 -1
  57. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
  58. package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
  59. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
  60. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
  61. package/dist/esm/canonical-json/rfc8785-canonical-json.d.ts.map +1 -1
  62. package/dist/esm/canonical-json/rfc8785-canonical-json.js.map +1 -1
  63. package/dist/esm/config-authoring.entry.d.ts.map +1 -1
  64. package/dist/esm/config-authoring.entry.js.map +1 -1
  65. package/dist/esm/credentials/credential-generator.service.d.ts.map +1 -1
  66. package/dist/esm/credentials/credential-generator.service.js.map +1 -1
  67. package/dist/esm/index.d.ts +5 -1
  68. package/dist/esm/index.d.ts.map +1 -1
  69. package/dist/esm/index.js +5 -1
  70. package/dist/esm/index.js.map +1 -1
  71. package/dist/esm/key-management/application-legacy-envelope-key.contracts.d.ts +119 -0
  72. package/dist/esm/key-management/application-legacy-envelope-key.contracts.d.ts.map +1 -0
  73. package/dist/esm/key-management/application-legacy-envelope-key.contracts.js +109 -0
  74. package/dist/esm/key-management/application-legacy-envelope-key.contracts.js.map +1 -0
  75. package/dist/esm/key-management/application-signing-key-rotation.contracts.d.ts +182 -0
  76. package/dist/esm/key-management/application-signing-key-rotation.contracts.d.ts.map +1 -0
  77. package/dist/esm/key-management/application-signing-key-rotation.contracts.js +145 -0
  78. package/dist/esm/key-management/application-signing-key-rotation.contracts.js.map +1 -0
  79. package/dist/esm/key-management/approval-seal-manifested-copy.d.ts +156 -0
  80. package/dist/esm/key-management/approval-seal-manifested-copy.d.ts.map +1 -0
  81. package/dist/esm/key-management/approval-seal-manifested-copy.js +617 -0
  82. package/dist/esm/key-management/approval-seal-manifested-copy.js.map +1 -0
  83. package/dist/esm/key-management/approval-seal-verifier.d.ts +114 -40
  84. package/dist/esm/key-management/approval-seal-verifier.d.ts.map +1 -1
  85. package/dist/esm/key-management/approval-seal-verifier.js +143 -12
  86. package/dist/esm/key-management/approval-seal-verifier.js.map +1 -1
  87. package/dist/esm/key-management/approval-seal.contracts.d.ts +12 -15
  88. package/dist/esm/key-management/approval-seal.contracts.d.ts.map +1 -1
  89. package/dist/esm/key-management/approval-seal.contracts.js +20 -0
  90. package/dist/esm/key-management/approval-seal.contracts.js.map +1 -1
  91. package/dist/esm/key-management/data-key.contracts.d.ts +0 -2
  92. package/dist/esm/key-management/data-key.contracts.d.ts.map +1 -1
  93. package/dist/esm/key-management/data-key.contracts.js.map +1 -1
  94. package/dist/esm/key-management/es256-jws.d.ts.map +1 -1
  95. package/dist/esm/key-management/es256-jws.js.map +1 -1
  96. package/dist/esm/key-management/key-provider.spi.d.ts +8 -1
  97. package/dist/esm/key-management/key-provider.spi.d.ts.map +1 -1
  98. package/dist/esm/key-management/key-provider.spi.js.map +1 -1
  99. package/dist/esm/key-management/keyring-rotation.contracts.d.ts +2 -12
  100. package/dist/esm/key-management/keyring-rotation.contracts.d.ts.map +1 -1
  101. package/dist/esm/key-management/keyring-rotation.contracts.js +3 -3
  102. package/dist/esm/key-management/keyring-rotation.contracts.js.map +1 -1
  103. package/dist/esm/key-management/keyring-status.contracts.d.ts +0 -7
  104. package/dist/esm/key-management/keyring-status.contracts.d.ts.map +1 -1
  105. package/dist/esm/key-management/keyring-status.contracts.js.map +1 -1
  106. package/dist/esm/key-management/pdf-incremental-update.d.ts +158 -0
  107. package/dist/esm/key-management/pdf-incremental-update.d.ts.map +1 -0
  108. package/dist/esm/key-management/pdf-incremental-update.js +730 -0
  109. package/dist/esm/key-management/pdf-incremental-update.js.map +1 -0
  110. package/dist/esm/key-management/pdf-truetype-font.d.ts +35 -0
  111. package/dist/esm/key-management/pdf-truetype-font.d.ts.map +1 -0
  112. package/dist/esm/key-management/pdf-truetype-font.js +152 -0
  113. package/dist/esm/key-management/pdf-truetype-font.js.map +1 -0
  114. package/dist/esm/key-management/qr-code.d.ts +38 -0
  115. package/dist/esm/key-management/qr-code.d.ts.map +1 -0
  116. package/dist/esm/key-management/qr-code.js +325 -0
  117. package/dist/esm/key-management/qr-code.js.map +1 -0
  118. package/dist/esm/key-management/signature-request.contracts.d.ts +0 -4
  119. package/dist/esm/key-management/signature-request.contracts.d.ts.map +1 -1
  120. package/dist/esm/key-management/signature-request.contracts.js.map +1 -1
  121. package/dist/esm/key-management/signing-log-export.contracts.d.ts +0 -1
  122. package/dist/esm/key-management/signing-log-export.contracts.d.ts.map +1 -1
  123. package/dist/esm/key-management/signing-log-export.contracts.js.map +1 -1
  124. package/dist/esm/key-management/vault-custody.contracts.d.ts +43 -0
  125. package/dist/esm/key-management/vault-custody.contracts.d.ts.map +1 -1
  126. package/dist/esm/key-management/vault-custody.contracts.js +66 -0
  127. package/dist/esm/key-management/vault-custody.contracts.js.map +1 -1
  128. package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -1
  129. package/dist/esm/lockfile/build-parallelism.js.map +1 -1
  130. package/dist/esm/lockfile/canonical-json.d.ts +1 -1
  131. package/dist/esm/lockfile/canonical-json.d.ts.map +1 -1
  132. package/dist/esm/lockfile/canonical-json.js +1 -1
  133. package/dist/esm/lockfile/canonical-json.js.map +1 -1
  134. package/dist/esm/lockfile/file-lock-hold.d.ts.map +1 -1
  135. package/dist/esm/lockfile/file-lock-hold.js +2 -1
  136. package/dist/esm/lockfile/file-lock-hold.js.map +1 -1
  137. package/dist/esm/lockfile/lockfile-io.d.ts +6 -8
  138. package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
  139. package/dist/esm/lockfile/lockfile-io.js +6 -8
  140. package/dist/esm/lockfile/lockfile-io.js.map +1 -1
  141. package/dist/esm/lockfile/materialize-infra-section.d.ts +5 -6
  142. package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
  143. package/dist/esm/lockfile/materialize-infra-section.js +4 -5
  144. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
  145. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +1 -247
  146. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
  147. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +1 -1
  148. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
  149. package/dist/esm/pnpm-settings/application-pnpm-settings.d.ts +146 -0
  150. package/dist/esm/pnpm-settings/application-pnpm-settings.d.ts.map +1 -0
  151. package/dist/esm/pnpm-settings/application-pnpm-settings.js +573 -0
  152. package/dist/esm/pnpm-settings/application-pnpm-settings.js.map +1 -0
  153. package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -1
  154. package/dist/esm/project-config/application-public-pricing-catalog.loader.js +15 -3
  155. package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -1
  156. package/dist/esm/project-config/application-served-public-documents.loader.d.ts.map +1 -1
  157. package/dist/esm/project-config/application-served-public-documents.loader.js +16 -8
  158. package/dist/esm/project-config/application-served-public-documents.loader.js.map +1 -1
  159. package/dist/esm/project-config/backend-compliance-section.reader.d.ts +35 -0
  160. package/dist/esm/project-config/backend-compliance-section.reader.d.ts.map +1 -0
  161. package/dist/esm/project-config/backend-compliance-section.reader.js +123 -0
  162. package/dist/esm/project-config/backend-compliance-section.reader.js.map +1 -0
  163. package/dist/esm/project-config/backend-compliance-section.worker.d.ts +20 -0
  164. package/dist/esm/project-config/backend-compliance-section.worker.d.ts.map +1 -0
  165. package/dist/esm/project-config/backend-compliance-section.worker.js +78 -0
  166. package/dist/esm/project-config/backend-compliance-section.worker.js.map +1 -0
  167. package/dist/esm/project-config/config-module-resolution.d.ts +32 -0
  168. package/dist/esm/project-config/config-module-resolution.d.ts.map +1 -0
  169. package/dist/esm/project-config/config-module-resolution.js +33 -0
  170. package/dist/esm/project-config/config-module-resolution.js.map +1 -0
  171. package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
  172. package/dist/esm/project-config/define-framework-config.js.map +1 -1
  173. package/dist/esm/project-config/define-infra-env-config.d.ts +146 -55
  174. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  175. package/dist/esm/project-config/define-infra-env-config.js +124 -71
  176. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  177. package/dist/esm/project-config/define-minion-config.d.ts +26 -36
  178. package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
  179. package/dist/esm/project-config/define-minion-config.js +64 -25
  180. package/dist/esm/project-config/define-minion-config.js.map +1 -1
  181. package/dist/esm/project-config/define-saas-config.d.ts +41 -437
  182. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  183. package/dist/esm/project-config/define-saas-config.js +102 -94
  184. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  185. package/dist/esm/project-config/define-worker-config.d.ts +10 -20
  186. package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
  187. package/dist/esm/project-config/define-worker-config.js +10 -12
  188. package/dist/esm/project-config/define-worker-config.js.map +1 -1
  189. package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -1
  190. package/dist/esm/project-config/hosted-infra-env-config.js +2 -1
  191. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
  192. package/dist/esm/project-config/index.d.ts +2 -0
  193. package/dist/esm/project-config/index.d.ts.map +1 -1
  194. package/dist/esm/project-config/index.js +2 -0
  195. package/dist/esm/project-config/index.js.map +1 -1
  196. package/dist/esm/project-config/loader-instances-zod.d.ts +19 -0
  197. package/dist/esm/project-config/loader-instances-zod.d.ts.map +1 -0
  198. package/dist/esm/project-config/loader-instances-zod.js +40 -0
  199. package/dist/esm/project-config/loader-instances-zod.js.map +1 -0
  200. package/dist/esm/project-config/loader.d.ts +131 -14
  201. package/dist/esm/project-config/loader.d.ts.map +1 -1
  202. package/dist/esm/project-config/loader.js +226 -12
  203. package/dist/esm/project-config/loader.js.map +1 -1
  204. package/dist/esm/project-config/minion-liveness.contracts.d.ts +131 -0
  205. package/dist/esm/project-config/minion-liveness.contracts.d.ts.map +1 -0
  206. package/dist/esm/project-config/minion-liveness.contracts.js +167 -0
  207. package/dist/esm/project-config/minion-liveness.contracts.js.map +1 -0
  208. package/dist/esm/project-config/minion-local-provider-registration.d.ts.map +1 -1
  209. package/dist/esm/project-config/minion-local-provider-registration.js.map +1 -1
  210. package/dist/esm/project-config/npm-version-range.d.ts.map +1 -1
  211. package/dist/esm/project-config/npm-version-range.js.map +1 -1
  212. package/dist/esm/project-config/owning-package-tsconfig.d.ts +7 -7
  213. package/dist/esm/project-config/owning-package-tsconfig.d.ts.map +1 -1
  214. package/dist/esm/project-config/owning-package-tsconfig.js +7 -7
  215. package/dist/esm/project-config/owning-package-tsconfig.js.map +1 -1
  216. package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -1
  217. package/dist/esm/project-config/provider-catalog-types.js.map +1 -1
  218. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  219. package/dist/esm/project-config/provider-companion-discovery.js +3 -1
  220. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  221. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +71 -46
  222. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  223. package/dist/esm/project-config/provider-runtime-artifacts.js +150 -4
  224. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  225. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts +0 -2
  226. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
  227. package/dist/esm/project-config/shared/application-creation-verification.schemas.js.map +1 -1
  228. package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
  229. package/dist/esm/project-config/shared/application-modules.schemas.js.map +1 -1
  230. package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
  231. package/dist/esm/project-config/shared/application-modules.utils.js.map +1 -1
  232. package/dist/esm/project-config/shared/auth.schemas.d.ts +0 -17
  233. package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
  234. package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
  235. package/dist/esm/project-config/shared/backing-service-servability.d.ts.map +1 -1
  236. package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -1
  237. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +9 -10
  238. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  239. package/dist/esm/project-config/shared/backing-services.schemas.js +13 -15
  240. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  241. package/dist/esm/project-config/shared/cdn.schemas.d.ts +0 -51
  242. package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
  243. package/dist/esm/project-config/shared/cdn.schemas.js.map +1 -1
  244. package/dist/esm/project-config/shared/csp-defaults.d.ts +34 -6
  245. package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
  246. package/dist/esm/project-config/shared/csp-defaults.js +52 -8
  247. package/dist/esm/project-config/shared/csp-defaults.js.map +1 -1
  248. package/dist/esm/project-config/shared/csp-emit.d.ts +60 -13
  249. package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
  250. package/dist/esm/project-config/shared/csp-emit.js +77 -24
  251. package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
  252. package/dist/esm/project-config/shared/csp.schemas.d.ts +72 -84
  253. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
  254. package/dist/esm/project-config/shared/csp.schemas.js +40 -12
  255. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
  256. package/dist/esm/project-config/shared/data-services.schemas.d.ts +0 -8
  257. package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
  258. package/dist/esm/project-config/shared/data-services.schemas.js.map +1 -1
  259. package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
  260. package/dist/esm/project-config/shared/env-example-defaults.js.map +1 -1
  261. package/dist/esm/project-config/shared/environment.schemas.d.ts +95 -8
  262. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  263. package/dist/esm/project-config/shared/environment.schemas.js +122 -10
  264. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  265. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +10 -4
  266. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  267. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  268. package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -1
  269. package/dist/esm/project-config/shared/infra-service.schemas.js.map +1 -1
  270. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts +1 -1
  271. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
  272. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js +1 -1
  273. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
  274. package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
  275. package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
  276. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -1
  277. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
  278. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +20 -0
  279. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
  280. package/dist/esm/project-config/shared/minion-resource-access.validation.js +21 -2
  281. package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
  282. package/dist/esm/project-config/shared/object-storage-session-policy.d.ts.map +1 -1
  283. package/dist/esm/project-config/shared/object-storage-session-policy.js.map +1 -1
  284. package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts +67 -38
  285. package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts.map +1 -1
  286. package/dist/esm/project-config/shared/platform-key-management.schemas.js +113 -5
  287. package/dist/esm/project-config/shared/platform-key-management.schemas.js.map +1 -1
  288. package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
  289. package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
  290. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts +2 -2
  291. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -1
  292. package/dist/esm/project-config/shared/platform-storage.schemas.js +16 -2
  293. package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -1
  294. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts +21 -23
  295. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
  296. package/dist/esm/project-config/shared/service-definitions.schemas.js +4 -5
  297. package/dist/esm/project-config/shared/service-definitions.schemas.js.map +1 -1
  298. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts +0 -18
  299. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -1
  300. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -1
  301. package/dist/esm/project-config/static-asset-import-noop.d.ts +20 -3
  302. package/dist/esm/project-config/static-asset-import-noop.d.ts.map +1 -1
  303. package/dist/esm/project-config/static-asset-import-noop.js +36 -20
  304. package/dist/esm/project-config/static-asset-import-noop.js.map +1 -1
  305. package/dist/esm/registry/artifact-domain.schemas.d.ts +0 -5
  306. package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
  307. package/dist/esm/registry/artifact-domain.schemas.js.map +1 -1
  308. package/dist/esm/registry/digest.schemas.d.ts.map +1 -1
  309. package/dist/esm/registry/digest.schemas.js.map +1 -1
  310. package/dist/esm/registry/index.d.ts +2 -3
  311. package/dist/esm/registry/index.d.ts.map +1 -1
  312. package/dist/esm/registry/index.js +2 -3
  313. package/dist/esm/registry/index.js.map +1 -1
  314. package/dist/esm/registry/local-checkout-source.d.ts.map +1 -1
  315. package/dist/esm/registry/local-checkout-source.js.map +1 -1
  316. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +1 -98
  317. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
  318. package/dist/esm/registry/lockfile-modules-section.schemas.js +1 -2
  319. package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -1
  320. package/dist/esm/registry/module-artifact.schemas.d.ts +17 -17
  321. package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
  322. package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
  323. package/dist/esm/registry/module-manifest.schemas.d.ts +151 -219
  324. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
  325. package/dist/esm/registry/module-manifest.schemas.js +145 -13
  326. package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
  327. package/dist/esm/registry/module-search.schemas.d.ts.map +1 -1
  328. package/dist/esm/registry/module-search.schemas.js.map +1 -1
  329. package/dist/esm/registry/registry-config.schemas.d.ts +0 -18
  330. package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
  331. package/dist/esm/registry/registry-config.schemas.js.map +1 -1
  332. package/dist/esm/registry/registry-defaults.constants.d.ts.map +1 -1
  333. package/dist/esm/registry/registry-defaults.constants.js.map +1 -1
  334. package/dist/esm/registry/registry-errors.d.ts +81 -3
  335. package/dist/esm/registry/registry-errors.d.ts.map +1 -1
  336. package/dist/esm/registry/registry-errors.js +185 -4
  337. package/dist/esm/registry/registry-errors.js.map +1 -1
  338. package/dist/esm/registry/registry-keys.schemas.d.ts.map +1 -1
  339. package/dist/esm/registry/registry-keys.schemas.js.map +1 -1
  340. package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
  341. package/dist/esm/registry/registry-section-schemas.constants.js.map +1 -1
  342. package/dist/esm/registry/registry-url-resolution.d.ts.map +1 -1
  343. package/dist/esm/registry/registry-url-resolution.js.map +1 -1
  344. package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
  345. package/dist/esm/release/framework-release.constants.js.map +1 -1
  346. package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
  347. package/dist/esm/schemas/framework-info.schemas.js.map +1 -1
  348. package/dist/esm/schemas/framework-secrets.schemas.d.ts +0 -7
  349. package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
  350. package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
  351. package/dist/esm/schemas/platform-application-config.schemas.d.ts +1 -1
  352. package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
  353. package/dist/esm/schemas/platform-application-config.schemas.js.map +1 -1
  354. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts +1 -1
  355. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
  356. package/dist/esm/schemas/platform-application-secrets.schemas.js.map +1 -1
  357. package/dist/esm/schemas/platform-config.schemas.d.ts +2 -2
  358. package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
  359. package/dist/esm/schemas/platform-config.schemas.js.map +1 -1
  360. package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -1
  361. package/dist/esm/workspace-scope/application-subject-manifest.js.map +1 -1
  362. package/dist/esm/workspace-scope/index.d.ts.map +1 -1
  363. package/dist/esm/workspace-scope/index.js.map +1 -1
  364. package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -1
  365. package/dist/esm/workspace-scope/resolve-homes.js.map +1 -1
  366. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
  367. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
  368. package/dist/esm/workspace-scope/workspace-scope-detector.d.ts.map +1 -1
  369. package/dist/esm/workspace-scope/workspace-scope-detector.js.map +1 -1
  370. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
  371. package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
  372. package/dist/tsconfig.build.tsbuildinfo +1 -1
  373. package/package.json +12 -12
  374. package/dist/esm/_unimplemented/index.d.ts +0 -3
  375. package/dist/esm/_unimplemented/index.d.ts.map +0 -1
  376. package/dist/esm/_unimplemented/index.js +0 -3
  377. package/dist/esm/_unimplemented/index.js.map +0 -1
  378. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts +0 -137
  379. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts.map +0 -1
  380. package/dist/esm/_unimplemented/unimplemented-field-warning.js +0 -153
  381. package/dist/esm/_unimplemented/unimplemented-field-warning.js.map +0 -1
  382. package/dist/esm/project-config/shared/cdn.example.d.ts +0 -14
  383. package/dist/esm/project-config/shared/cdn.example.d.ts.map +0 -1
  384. package/dist/esm/project-config/shared/cdn.example.js +0 -38
  385. package/dist/esm/project-config/shared/cdn.example.js.map +0 -1
  386. package/dist/esm/project-config/shared/schema-version.schemas.d.ts +0 -15
  387. package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +0 -1
  388. package/dist/esm/project-config/shared/schema-version.schemas.js +0 -40
  389. package/dist/esm/project-config/shared/schema-version.schemas.js.map +0 -1
@@ -1,3 +1,4 @@
1
+ import { PlatformInfrastructureEnvKey } from './platform-runtime-env.contracts';
1
2
  /**
2
3
  * The MongoDB URL a platform service must pre-connect at boot, or `undefined` when it must not.
3
4
  *
@@ -34,4 +35,24 @@ export declare function resolvePlatformMongoPreconnectUrl(input: {
34
35
  readonly mongoConnectUrl: string | undefined;
35
36
  readonly declaredDefaultAdapter: string | undefined;
36
37
  }): string | undefined;
38
+ /**
39
+ * The env key of the platform's SELECTED store when its URL is absent, or `undefined` when the selected store has its URL
40
+ * (#1117). ONE decision for every boot door that refuses such an environment: the apps-manager env schema, its NORMAL
41
+ * and INIT pre-connects (both run before that schema is parsed), the module registry, and the dev companion's env schema.
42
+ *
43
+ * Both pairs, because the platform's configuration documents are READ THROUGH its selected store, so the store has to be
44
+ * opened from env before anything else: a PostgreSQL platform without `PG_CONNECT_URL`, and a MongoDB platform (the
45
+ * declaration absent or `mongodb`) without `MONGO_CONNECT_URL`. The MongoDB half was missing. Such a platform skipped
46
+ * the pre-connect (and said its store was PostgreSQL), then died at hydration on a configuration that cannot be
47
+ * satisfied at that phase, or, if it came up, waited on a MongoDB readiness check nothing would ever connect: the shape
48
+ * #1117 recorded, a service up and not ready until someone restarted it.
49
+ *
50
+ * A URL WITHOUT the declaration stays legal (the dual-store transition), and a store other than these two is not a
51
+ * platform store, so it owes no URL here.
52
+ */
53
+ export declare function missingSelectedPlatformStoreUrlKey(input: {
54
+ readonly mongoConnectUrl: string | undefined;
55
+ readonly pgConnectUrl: string | undefined;
56
+ readonly declaredDefaultAdapter: string | undefined;
57
+ }): PlatformInfrastructureEnvKey.MONGO_CONNECT_URL | PlatformInfrastructureEnvKey.PG_CONNECT_URL | undefined;
37
58
  //# sourceMappingURL=platform-store-preconnect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform-store-preconnect.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/platform-store-preconnect.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE;IACvD,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC;CACrD,GAAG,MAAM,GAAG,SAAS,CAOrB"}
1
+ {"version":3,"file":"platform-store-preconnect.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/platform-store-preconnect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE;IACvD,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC;CACrD,GAAG,MAAM,GAAG,SAAS,CAOrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kCAAkC,CAAC,KAAK,EAAE;IACxD,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC;CACrD,GAAG,4BAA4B,CAAC,iBAAiB,GAAG,4BAA4B,CAAC,cAAc,GAAG,SAAS,CAM3G"}
@@ -1,4 +1,5 @@
1
1
  import { parseDeclaredPersistenceAdapter, PersistenceAdapter } from '@wildo-ai/saas-models';
2
+ import { PlatformInfrastructureEnvKey } from './platform-runtime-env.contracts.js';
2
3
  /**
3
4
  * The MongoDB URL a platform service must pre-connect at boot, or `undefined` when it must not.
4
5
  *
@@ -40,4 +41,28 @@ export function resolvePlatformMongoPreconnectUrl(input) {
40
41
  ? undefined
41
42
  : mongoConnectUrl;
42
43
  }
44
+ /**
45
+ * The env key of the platform's SELECTED store when its URL is absent, or `undefined` when the selected store has its URL
46
+ * (#1117). ONE decision for every boot door that refuses such an environment: the apps-manager env schema, its NORMAL
47
+ * and INIT pre-connects (both run before that schema is parsed), the module registry, and the dev companion's env schema.
48
+ *
49
+ * Both pairs, because the platform's configuration documents are READ THROUGH its selected store, so the store has to be
50
+ * opened from env before anything else: a PostgreSQL platform without `PG_CONNECT_URL`, and a MongoDB platform (the
51
+ * declaration absent or `mongodb`) without `MONGO_CONNECT_URL`. The MongoDB half was missing. Such a platform skipped
52
+ * the pre-connect (and said its store was PostgreSQL), then died at hydration on a configuration that cannot be
53
+ * satisfied at that phase, or, if it came up, waited on a MongoDB readiness check nothing would ever connect: the shape
54
+ * #1117 recorded, a service up and not ready until someone restarted it.
55
+ *
56
+ * A URL WITHOUT the declaration stays legal (the dual-store transition), and a store other than these two is not a
57
+ * platform store, so it owes no URL here.
58
+ */
59
+ export function missingSelectedPlatformStoreUrlKey(input) {
60
+ // An absent declaration is the framework default (MongoDB), the reading `resolvePlatformMongoPreconnectUrl` applies too.
61
+ const selected = parseDeclaredPersistenceAdapter(input.declaredDefaultAdapter);
62
+ if (selected === PersistenceAdapter.POSTGRESQL)
63
+ return input.pgConnectUrl ? undefined : PlatformInfrastructureEnvKey.PG_CONNECT_URL;
64
+ if (selected === PersistenceAdapter.MONGODB)
65
+ return input.mongoConnectUrl ? undefined : PlatformInfrastructureEnvKey.MONGO_CONNECT_URL;
66
+ return undefined;
67
+ }
43
68
  //# sourceMappingURL=platform-store-preconnect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform-store-preconnect.js","sourceRoot":"","sources":["../../../../src/bootstrap/platform-store-preconnect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,iCAAiC,CAAC,KAGjD;IACC,+FAA+F;IAC/F,MAAM,eAAe,GAAG,KAAK,CAAC,eAAe,IAAI,SAAS,CAAC;IAC3D,IAAI,eAAe,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACpD,OAAO,+BAA+B,CAAC,KAAK,CAAC,sBAAsB,CAAC,KAAK,kBAAkB,CAAC,UAAU;QACpG,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,eAAe,CAAC;AACtB,CAAC","sourcesContent":["import { parseDeclaredPersistenceAdapter, PersistenceAdapter } from '@wildo-ai/saas-models';\n\n/**\n * The MongoDB URL a platform service must pre-connect at boot, or `undefined` when it must not.\n *\n * ONE decision for every platform process that opens its own store from env before any config\n * document is readable: apps-manager (NORMAL and INIT mode), module-registry and the development\n * companion. Each used to spell it inline, and the spelling drifted: all four connected whenever\n * `MONGO_CONNECT_URL` was PRESENT.\n *\n * ## The gate is the SELECTED store, never the address\n *\n * The CLI emits `MONGO_CONNECT_URL` whenever the ENVIRONMENT hosts a mongod, and on a PostgreSQL\n * platform that mongod exists only for hosted Mongo-backed applications (apps-manager mints their\n * database users over a separate admin connection, which is why the URL is still delivered). So\n * presence says \"a mongod is reachable\", not \"the platform lives there\". Awaiting it anyway made an\n * application-side outage fatal to the platform: on 2026-09-24 mongod segfaulted, left an\n * unrecoverable journal record, crash-looped 243 times, and apps-manager, module-registry and the\n * companion all died on `ECONNRESET` while every platform row sat in PostgreSQL.\n *\n * The application boot connect asks the same question through `mongoDbIsSelectedStore`\n * (saas-backend-lib, 2026-09-19); this is its platform-side twin.\n *\n * ## Absent adapter still means MongoDB\n *\n * `DATABASE_DEFAULT_ADAPTER` absent or empty is the framework default, MongoDB, so a Mongo-engined\n * platform and the mid-flip dual-store state (both URLs, no declaration) keep connecting exactly as\n * before. A present-but-unknown declaration THROWS through the shared parser rather than collapsing\n * into the Mongo lane.\n *\n * Takes the two values rather than reading `process.env`, because the adapter key is owned by\n * `platform-core-shared` (`ApplicationBackendDataEnvKey`), which this package does not depend on;\n * callers read both keys through their own vocabulary.\n */\nexport function resolvePlatformMongoPreconnectUrl(input: {\n readonly mongoConnectUrl: string | undefined;\n readonly declaredDefaultAdapter: string | undefined;\n}): string | undefined {\n // Empty string is absent: the compose interpolation contract every platform env reader shares.\n const mongoConnectUrl = input.mongoConnectUrl || undefined;\n if (mongoConnectUrl === undefined) return undefined;\n return parseDeclaredPersistenceAdapter(input.declaredDefaultAdapter) === PersistenceAdapter.POSTGRESQL\n ? undefined\n : mongoConnectUrl;\n}\n"]}
1
+ {"version":3,"file":"platform-store-preconnect.js","sourceRoot":"","sources":["../../../src/bootstrap/platform-store-preconnect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC5F,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,iCAAiC,CAAC,KAGjD;IACC,+FAA+F;IAC/F,MAAM,eAAe,GAAG,KAAK,CAAC,eAAe,IAAI,SAAS,CAAC;IAC3D,IAAI,eAAe,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACpD,OAAO,+BAA+B,CAAC,KAAK,CAAC,sBAAsB,CAAC,KAAK,kBAAkB,CAAC,UAAU;QACpG,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,eAAe,CAAC;AACtB,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kCAAkC,CAAC,KAIlD;IACC,yHAAyH;IACzH,MAAM,QAAQ,GAAG,+BAA+B,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC/E,IAAI,QAAQ,KAAK,kBAAkB,CAAC,UAAU;QAAE,OAAO,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,4BAA4B,CAAC,cAAc,CAAC;IACpI,IAAI,QAAQ,KAAK,kBAAkB,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,4BAA4B,CAAC,iBAAiB,CAAC;IACvI,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import { parseDeclaredPersistenceAdapter, PersistenceAdapter } from '@wildo-ai/saas-models';\nimport { PlatformInfrastructureEnvKey } from './platform-runtime-env.contracts';\n\n/**\n * The MongoDB URL a platform service must pre-connect at boot, or `undefined` when it must not.\n *\n * ONE decision for every platform process that opens its own store from env before any config\n * document is readable: apps-manager (NORMAL and INIT mode), module-registry and the development\n * companion. Each used to spell it inline, and the spelling drifted: all four connected whenever\n * `MONGO_CONNECT_URL` was PRESENT.\n *\n * ## The gate is the SELECTED store, never the address\n *\n * The CLI emits `MONGO_CONNECT_URL` whenever the ENVIRONMENT hosts a mongod, and on a PostgreSQL\n * platform that mongod exists only for hosted Mongo-backed applications (apps-manager mints their\n * database users over a separate admin connection, which is why the URL is still delivered). So\n * presence says \"a mongod is reachable\", not \"the platform lives there\". Awaiting it anyway made an\n * application-side outage fatal to the platform: on 2026-09-24 mongod segfaulted, left an\n * unrecoverable journal record, crash-looped 243 times, and apps-manager, module-registry and the\n * companion all died on `ECONNRESET` while every platform row sat in PostgreSQL.\n *\n * The application boot connect asks the same question through `mongoDbIsSelectedStore`\n * (saas-backend-lib, 2026-09-19); this is its platform-side twin.\n *\n * ## Absent adapter still means MongoDB\n *\n * `DATABASE_DEFAULT_ADAPTER` absent or empty is the framework default, MongoDB, so a Mongo-engined\n * platform and the mid-flip dual-store state (both URLs, no declaration) keep connecting exactly as\n * before. A present-but-unknown declaration THROWS through the shared parser rather than collapsing\n * into the Mongo lane.\n *\n * Takes the two values rather than reading `process.env`, because the adapter key is owned by\n * `platform-core-shared` (`ApplicationBackendDataEnvKey`), which this package does not depend on;\n * callers read both keys through their own vocabulary.\n */\nexport function resolvePlatformMongoPreconnectUrl(input: {\n readonly mongoConnectUrl: string | undefined;\n readonly declaredDefaultAdapter: string | undefined;\n}): string | undefined {\n // Empty string is absent: the compose interpolation contract every platform env reader shares.\n const mongoConnectUrl = input.mongoConnectUrl || undefined;\n if (mongoConnectUrl === undefined) return undefined;\n return parseDeclaredPersistenceAdapter(input.declaredDefaultAdapter) === PersistenceAdapter.POSTGRESQL\n ? undefined\n : mongoConnectUrl;\n}\n\n/**\n * The env key of the platform's SELECTED store when its URL is absent, or `undefined` when the selected store has its URL\n * (#1117). ONE decision for every boot door that refuses such an environment: the apps-manager env schema, its NORMAL\n * and INIT pre-connects (both run before that schema is parsed), the module registry, and the dev companion's env schema.\n *\n * Both pairs, because the platform's configuration documents are READ THROUGH its selected store, so the store has to be\n * opened from env before anything else: a PostgreSQL platform without `PG_CONNECT_URL`, and a MongoDB platform (the\n * declaration absent or `mongodb`) without `MONGO_CONNECT_URL`. The MongoDB half was missing. Such a platform skipped\n * the pre-connect (and said its store was PostgreSQL), then died at hydration on a configuration that cannot be\n * satisfied at that phase, or, if it came up, waited on a MongoDB readiness check nothing would ever connect: the shape\n * #1117 recorded, a service up and not ready until someone restarted it.\n *\n * A URL WITHOUT the declaration stays legal (the dual-store transition), and a store other than these two is not a\n * platform store, so it owes no URL here.\n */\nexport function missingSelectedPlatformStoreUrlKey(input: {\n readonly mongoConnectUrl: string | undefined;\n readonly pgConnectUrl: string | undefined;\n readonly declaredDefaultAdapter: string | undefined;\n}): PlatformInfrastructureEnvKey.MONGO_CONNECT_URL | PlatformInfrastructureEnvKey.PG_CONNECT_URL | undefined {\n // An absent declaration is the framework default (MongoDB), the reading `resolvePlatformMongoPreconnectUrl` applies too.\n const selected = parseDeclaredPersistenceAdapter(input.declaredDefaultAdapter);\n if (selected === PersistenceAdapter.POSTGRESQL) return input.pgConnectUrl ? undefined : PlatformInfrastructureEnvKey.PG_CONNECT_URL;\n if (selected === PersistenceAdapter.MONGODB) return input.mongoConnectUrl ? undefined : PlatformInfrastructureEnvKey.MONGO_CONNECT_URL;\n return undefined;\n}\n"]}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * The in-database contract by which an application's PostgreSQL migrations grant a named runtime
3
+ * principal (a minion) the tables those migrations create (#3027).
4
+ *
5
+ * ## The gap it closes
6
+ *
7
+ * A minion's role is TABLE-SCOPED, and PostgreSQL can only grant a table that exists. apps-manager
8
+ * provisions the role BEFORE the application backend boots, and the backend's migrations create the
9
+ * tables WHEN it boots, so every table a migration creates was skipped by the grant pass and stayed
10
+ * out of reach until a later provisioning pass that nothing triggered. With #2894 that reached an
11
+ * engine floor table every minion needs (`applicationDataKeys`): a minion could not open the secrets
12
+ * the backend seals, from the moment the backend ran the migration.
13
+ *
14
+ * ## The contract
15
+ *
16
+ * apps-manager stays the ONLY party that decides what a principal may touch. Inside the grant
17
+ * transaction it records every grant it derived, existing table or not, in
18
+ * {@link POSTGRES_OWED_TABLE_GRANTS_SCHEMA}.{@link POSTGRES_OWED_TABLE_GRANTS_TABLE}, and installs
19
+ * {@link POSTGRES_APPLY_OWED_TABLE_GRANTS_FUNCTION}: a `SECURITY DEFINER` function that issues the
20
+ * recorded grants whose table now exists. EXECUTE is granted to the database OWNER (the application
21
+ * backend) and to nobody else. The backend calls it once its migrations are applied. So the grant a
22
+ * migration made possible lands in the same boot, and the backend executes a decision it cannot
23
+ * change: the record and the function belong to the admin role, and the backend holds no privilege
24
+ * on the record.
25
+ *
26
+ * Both sides LOCK the record table (`SHARE ROW EXCLUSIVE`, self-conflicting), so a backend applying the
27
+ * record and apps-manager replacing it never interleave: the backend applies either the old record before
28
+ * apps-manager's authoritative revoke-and-regrant, or the new one after. A table lock rather than an
29
+ * advisory key, because any connected role can take an advisory key and hold it; a table lock needs a
30
+ * privilege on the record, which only the admin holds. Every wait is bounded by
31
+ * {@link POSTGRES_OWED_TABLE_GRANTS_LOCK_TIMEOUT}.
32
+ *
33
+ * The function reads the record after its lock, which is a fresh read under `READ COMMITTED`. A caller
34
+ * running it under `REPEATABLE READ` reads the snapshot its transaction began with and may apply a record
35
+ * apps-manager has just replaced. That caller is the database owner, which can grant its own tables to
36
+ * anyone anyway, so it gains nothing; apps-manager's next pass corrects the grants.
37
+ *
38
+ * ## Rejected
39
+ *
40
+ * - apps-manager re-provisioning on a post-migration signal from the backend: the apps-to-manager
41
+ * channel has no write route by design (#2921), and an application able to trigger platform
42
+ * provisioning is a door it does not need. The signal here travels through the database, and all it
43
+ * can cause is the grants apps-manager already recorded.
44
+ * - The backend deriving the grants itself (`deriveMinionDatabaseGrants` is shared): a second
45
+ * derivation of who may touch what, beside role names and declarations that only apps-manager holds.
46
+ * Two authorities for one grant drift.
47
+ * - `ALTER DEFAULT PRIVILEGES`: schema-wide, so it would grant every future table, which is the
48
+ * over-grant table scoping exists to prevent.
49
+ * - An event trigger on `CREATE TABLE`: event triggers need superuser to create and are not available
50
+ * to every managed provider's admin role, and they fire inside every DDL statement.
51
+ */
52
+ /** The schema holding the owed-grant record and the function. Owned by the platform admin role; not the application's. */
53
+ export declare const POSTGRES_OWED_TABLE_GRANTS_SCHEMA = "wildo_access";
54
+ /** One row per (principal role, schema, table, privilege) apps-manager derived for that principal. */
55
+ export declare const POSTGRES_OWED_TABLE_GRANTS_TABLE = "owed_table_grants";
56
+ /**
57
+ * `wildo_access.apply_owed_table_grants()`: issues every recorded grant whose table and role exist,
58
+ * returns how many it issued. Idempotent (`GRANT` is), so it is safe on every backend boot.
59
+ */
60
+ export declare const POSTGRES_APPLY_OWED_TABLE_GRANTS_FUNCTION = "apply_owed_table_grants";
61
+ /** The name of the record's CHECK constraint on `privilege`, re-created from {@link PostgresOwedTablePrivilege} on every pass. */
62
+ export declare const POSTGRES_OWED_TABLE_GRANTS_PRIVILEGE_CHECK = "owed_table_grants_privilege_check";
63
+ /**
64
+ * How long either side waits for the other's lock on the record before failing (a PostgreSQL interval).
65
+ * A pass that waits longer is stuck, and failing names it; the backend's boot reports FAILED and continues.
66
+ */
67
+ export declare const POSTGRES_OWED_TABLE_GRANTS_LOCK_TIMEOUT = "30s";
68
+ /**
69
+ * The privileges a record row may carry. Closed because the function interpolates it into `GRANT`
70
+ * (a privilege is a keyword, not a bindable value): the function maps a stored value through literals
71
+ * generated from this set, so a value outside it is never spliced into SQL, and the record's CHECK
72
+ * constraint, built from the same set, refuses to store one.
73
+ */
74
+ export declare enum PostgresOwedTablePrivilege {
75
+ SELECT = "SELECT",
76
+ INSERT = "INSERT",
77
+ UPDATE = "UPDATE",
78
+ DELETE = "DELETE"
79
+ }
80
+ //# sourceMappingURL=postgresql-owed-grants.contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgresql-owed-grants.contracts.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/postgresql-owed-grants.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,0HAA0H;AAC1H,eAAO,MAAM,iCAAiC,iBAAiB,CAAC;AAEhE,sGAAsG;AACtG,eAAO,MAAM,gCAAgC,sBAAsB,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,yCAAyC,4BAA4B,CAAC;AAEnF,kIAAkI;AAClI,eAAO,MAAM,0CAA0C,sCAAsC,CAAC;AAE9F;;;GAGG;AACH,eAAO,MAAM,uCAAuC,QAAQ,CAAC;AAE7D;;;;;GAKG;AACH,oBAAY,0BAA0B;IACpC,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * The in-database contract by which an application's PostgreSQL migrations grant a named runtime
3
+ * principal (a minion) the tables those migrations create (#3027).
4
+ *
5
+ * ## The gap it closes
6
+ *
7
+ * A minion's role is TABLE-SCOPED, and PostgreSQL can only grant a table that exists. apps-manager
8
+ * provisions the role BEFORE the application backend boots, and the backend's migrations create the
9
+ * tables WHEN it boots, so every table a migration creates was skipped by the grant pass and stayed
10
+ * out of reach until a later provisioning pass that nothing triggered. With #2894 that reached an
11
+ * engine floor table every minion needs (`applicationDataKeys`): a minion could not open the secrets
12
+ * the backend seals, from the moment the backend ran the migration.
13
+ *
14
+ * ## The contract
15
+ *
16
+ * apps-manager stays the ONLY party that decides what a principal may touch. Inside the grant
17
+ * transaction it records every grant it derived, existing table or not, in
18
+ * {@link POSTGRES_OWED_TABLE_GRANTS_SCHEMA}.{@link POSTGRES_OWED_TABLE_GRANTS_TABLE}, and installs
19
+ * {@link POSTGRES_APPLY_OWED_TABLE_GRANTS_FUNCTION}: a `SECURITY DEFINER` function that issues the
20
+ * recorded grants whose table now exists. EXECUTE is granted to the database OWNER (the application
21
+ * backend) and to nobody else. The backend calls it once its migrations are applied. So the grant a
22
+ * migration made possible lands in the same boot, and the backend executes a decision it cannot
23
+ * change: the record and the function belong to the admin role, and the backend holds no privilege
24
+ * on the record.
25
+ *
26
+ * Both sides LOCK the record table (`SHARE ROW EXCLUSIVE`, self-conflicting), so a backend applying the
27
+ * record and apps-manager replacing it never interleave: the backend applies either the old record before
28
+ * apps-manager's authoritative revoke-and-regrant, or the new one after. A table lock rather than an
29
+ * advisory key, because any connected role can take an advisory key and hold it; a table lock needs a
30
+ * privilege on the record, which only the admin holds. Every wait is bounded by
31
+ * {@link POSTGRES_OWED_TABLE_GRANTS_LOCK_TIMEOUT}.
32
+ *
33
+ * The function reads the record after its lock, which is a fresh read under `READ COMMITTED`. A caller
34
+ * running it under `REPEATABLE READ` reads the snapshot its transaction began with and may apply a record
35
+ * apps-manager has just replaced. That caller is the database owner, which can grant its own tables to
36
+ * anyone anyway, so it gains nothing; apps-manager's next pass corrects the grants.
37
+ *
38
+ * ## Rejected
39
+ *
40
+ * - apps-manager re-provisioning on a post-migration signal from the backend: the apps-to-manager
41
+ * channel has no write route by design (#2921), and an application able to trigger platform
42
+ * provisioning is a door it does not need. The signal here travels through the database, and all it
43
+ * can cause is the grants apps-manager already recorded.
44
+ * - The backend deriving the grants itself (`deriveMinionDatabaseGrants` is shared): a second
45
+ * derivation of who may touch what, beside role names and declarations that only apps-manager holds.
46
+ * Two authorities for one grant drift.
47
+ * - `ALTER DEFAULT PRIVILEGES`: schema-wide, so it would grant every future table, which is the
48
+ * over-grant table scoping exists to prevent.
49
+ * - An event trigger on `CREATE TABLE`: event triggers need superuser to create and are not available
50
+ * to every managed provider's admin role, and they fire inside every DDL statement.
51
+ */
52
+ /** The schema holding the owed-grant record and the function. Owned by the platform admin role; not the application's. */
53
+ export const POSTGRES_OWED_TABLE_GRANTS_SCHEMA = 'wildo_access';
54
+ /** One row per (principal role, schema, table, privilege) apps-manager derived for that principal. */
55
+ export const POSTGRES_OWED_TABLE_GRANTS_TABLE = 'owed_table_grants';
56
+ /**
57
+ * `wildo_access.apply_owed_table_grants()`: issues every recorded grant whose table and role exist,
58
+ * returns how many it issued. Idempotent (`GRANT` is), so it is safe on every backend boot.
59
+ */
60
+ export const POSTGRES_APPLY_OWED_TABLE_GRANTS_FUNCTION = 'apply_owed_table_grants';
61
+ /** The name of the record's CHECK constraint on `privilege`, re-created from {@link PostgresOwedTablePrivilege} on every pass. */
62
+ export const POSTGRES_OWED_TABLE_GRANTS_PRIVILEGE_CHECK = 'owed_table_grants_privilege_check';
63
+ /**
64
+ * How long either side waits for the other's lock on the record before failing (a PostgreSQL interval).
65
+ * A pass that waits longer is stuck, and failing names it; the backend's boot reports FAILED and continues.
66
+ */
67
+ export const POSTGRES_OWED_TABLE_GRANTS_LOCK_TIMEOUT = '30s';
68
+ /**
69
+ * The privileges a record row may carry. Closed because the function interpolates it into `GRANT`
70
+ * (a privilege is a keyword, not a bindable value): the function maps a stored value through literals
71
+ * generated from this set, so a value outside it is never spliced into SQL, and the record's CHECK
72
+ * constraint, built from the same set, refuses to store one.
73
+ */
74
+ export var PostgresOwedTablePrivilege;
75
+ (function (PostgresOwedTablePrivilege) {
76
+ PostgresOwedTablePrivilege["SELECT"] = "SELECT";
77
+ PostgresOwedTablePrivilege["INSERT"] = "INSERT";
78
+ PostgresOwedTablePrivilege["UPDATE"] = "UPDATE";
79
+ PostgresOwedTablePrivilege["DELETE"] = "DELETE";
80
+ })(PostgresOwedTablePrivilege || (PostgresOwedTablePrivilege = {}));
81
+ //# sourceMappingURL=postgresql-owed-grants.contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgresql-owed-grants.contracts.js","sourceRoot":"","sources":["../../../src/bootstrap/postgresql-owed-grants.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,0HAA0H;AAC1H,MAAM,CAAC,MAAM,iCAAiC,GAAG,cAAc,CAAC;AAEhE,sGAAsG;AACtG,MAAM,CAAC,MAAM,gCAAgC,GAAG,mBAAmB,CAAC;AAEpE;;;GAGG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,yBAAyB,CAAC;AAEnF,kIAAkI;AAClI,MAAM,CAAC,MAAM,0CAA0C,GAAG,mCAAmC,CAAC;AAE9F;;;GAGG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,KAAK,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAN,IAAY,0BAKX;AALD,WAAY,0BAA0B;IACpC,+CAAiB,CAAA;IACjB,+CAAiB,CAAA;IACjB,+CAAiB,CAAA;IACjB,+CAAiB,CAAA;AACnB,CAAC,EALW,0BAA0B,KAA1B,0BAA0B,QAKrC","sourcesContent":["/**\n * The in-database contract by which an application's PostgreSQL migrations grant a named runtime\n * principal (a minion) the tables those migrations create (#3027).\n *\n * ## The gap it closes\n *\n * A minion's role is TABLE-SCOPED, and PostgreSQL can only grant a table that exists. apps-manager\n * provisions the role BEFORE the application backend boots, and the backend's migrations create the\n * tables WHEN it boots, so every table a migration creates was skipped by the grant pass and stayed\n * out of reach until a later provisioning pass that nothing triggered. With #2894 that reached an\n * engine floor table every minion needs (`applicationDataKeys`): a minion could not open the secrets\n * the backend seals, from the moment the backend ran the migration.\n *\n * ## The contract\n *\n * apps-manager stays the ONLY party that decides what a principal may touch. Inside the grant\n * transaction it records every grant it derived, existing table or not, in\n * {@link POSTGRES_OWED_TABLE_GRANTS_SCHEMA}.{@link POSTGRES_OWED_TABLE_GRANTS_TABLE}, and installs\n * {@link POSTGRES_APPLY_OWED_TABLE_GRANTS_FUNCTION}: a `SECURITY DEFINER` function that issues the\n * recorded grants whose table now exists. EXECUTE is granted to the database OWNER (the application\n * backend) and to nobody else. The backend calls it once its migrations are applied. So the grant a\n * migration made possible lands in the same boot, and the backend executes a decision it cannot\n * change: the record and the function belong to the admin role, and the backend holds no privilege\n * on the record.\n *\n * Both sides LOCK the record table (`SHARE ROW EXCLUSIVE`, self-conflicting), so a backend applying the\n * record and apps-manager replacing it never interleave: the backend applies either the old record before\n * apps-manager's authoritative revoke-and-regrant, or the new one after. A table lock rather than an\n * advisory key, because any connected role can take an advisory key and hold it; a table lock needs a\n * privilege on the record, which only the admin holds. Every wait is bounded by\n * {@link POSTGRES_OWED_TABLE_GRANTS_LOCK_TIMEOUT}.\n *\n * The function reads the record after its lock, which is a fresh read under `READ COMMITTED`. A caller\n * running it under `REPEATABLE READ` reads the snapshot its transaction began with and may apply a record\n * apps-manager has just replaced. That caller is the database owner, which can grant its own tables to\n * anyone anyway, so it gains nothing; apps-manager's next pass corrects the grants.\n *\n * ## Rejected\n *\n * - apps-manager re-provisioning on a post-migration signal from the backend: the apps-to-manager\n * channel has no write route by design (#2921), and an application able to trigger platform\n * provisioning is a door it does not need. The signal here travels through the database, and all it\n * can cause is the grants apps-manager already recorded.\n * - The backend deriving the grants itself (`deriveMinionDatabaseGrants` is shared): a second\n * derivation of who may touch what, beside role names and declarations that only apps-manager holds.\n * Two authorities for one grant drift.\n * - `ALTER DEFAULT PRIVILEGES`: schema-wide, so it would grant every future table, which is the\n * over-grant table scoping exists to prevent.\n * - An event trigger on `CREATE TABLE`: event triggers need superuser to create and are not available\n * to every managed provider's admin role, and they fire inside every DDL statement.\n */\n\n/** The schema holding the owed-grant record and the function. Owned by the platform admin role; not the application's. */\nexport const POSTGRES_OWED_TABLE_GRANTS_SCHEMA = 'wildo_access';\n\n/** One row per (principal role, schema, table, privilege) apps-manager derived for that principal. */\nexport const POSTGRES_OWED_TABLE_GRANTS_TABLE = 'owed_table_grants';\n\n/**\n * `wildo_access.apply_owed_table_grants()`: issues every recorded grant whose table and role exist,\n * returns how many it issued. Idempotent (`GRANT` is), so it is safe on every backend boot.\n */\nexport const POSTGRES_APPLY_OWED_TABLE_GRANTS_FUNCTION = 'apply_owed_table_grants';\n\n/** The name of the record's CHECK constraint on `privilege`, re-created from {@link PostgresOwedTablePrivilege} on every pass. */\nexport const POSTGRES_OWED_TABLE_GRANTS_PRIVILEGE_CHECK = 'owed_table_grants_privilege_check';\n\n/**\n * How long either side waits for the other's lock on the record before failing (a PostgreSQL interval).\n * A pass that waits longer is stuck, and failing names it; the backend's boot reports FAILED and continues.\n */\nexport const POSTGRES_OWED_TABLE_GRANTS_LOCK_TIMEOUT = '30s';\n\n/**\n * The privileges a record row may carry. Closed because the function interpolates it into `GRANT`\n * (a privilege is a keyword, not a bindable value): the function maps a stored value through literals\n * generated from this set, so a value outside it is never spliced into SQL, and the record's CHECK\n * constraint, built from the same set, refuses to store one.\n */\nexport enum PostgresOwedTablePrivilege {\n SELECT = 'SELECT',\n INSERT = 'INSERT',\n UPDATE = 'UPDATE',\n DELETE = 'DELETE',\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { InfraCapability } from '../project-config/shared/infra-providers.schemas';
2
+ import { DatabaseEngine } from '../project-config/shared/environment.schemas';
2
3
  import { type ApplicationRuntimePrincipal } from './runtime-principal.contracts';
3
4
  /**
4
5
  * WHICH backing services a runtime may reach, derived from what it DECLARED.
@@ -21,9 +22,13 @@ import { type ApplicationRuntimePrincipal } from './runtime-principal.contracts'
21
22
  * distinguish.
22
23
  *
23
24
  * So this is deliberately NOT a helper each consumer may reimplement "for its own
24
- * needs". Consumers call it; none re-derives. That is the whole anti-bypass
25
- * strategy, and the enumeration of who must call it lives in
26
- * `.claude/plans/minion-nature-and-authority.md` (Step 5-egress).
25
+ * needs". Consumers call it; none re-derives. Two of the three enforcement points
26
+ * call it directly: the network membership (both deployment lanes) and the
27
+ * connection topology (the env builders). The third, the apps-manager mint, does
28
+ * not: it reaches the same database store through
29
+ * `AppInitializationService.derivePersistenceSelection` over the same resolved
30
+ * engine, and `runtime-network-follows-credentials.test.ts` (apps-manager) holds
31
+ * membership equal to the minted credentials for every principal (#3367).
27
32
  *
28
33
  * ## The vocabulary is `InfraCapability`, not a new enum
29
34
  *
@@ -34,7 +39,7 @@ import { type ApplicationRuntimePrincipal } from './runtime-principal.contracts'
34
39
  export interface RuntimeBackingServiceAccess {
35
40
  /**
36
41
  * Capabilities this runtime may reach. Empty is a legitimate, meaningful answer
37
- * — see the WORKER case — and must never be read as "unspecified, allow all".
42
+ * — see the static website, which is no runtime principal — and must never be read as "unspecified, allow all".
38
43
  */
39
44
  readonly capabilities: ReadonlySet<InfraCapability>;
40
45
  /**
@@ -58,9 +63,11 @@ export interface RuntimeAccessDeclaration {
58
63
  * The minion's authored `resourceAccess`, or `undefined` when it declared none.
59
64
  *
60
65
  * The distinction is load-bearing and mirrors `deriveMinionResourceGrants`:
61
- * ABSENT means application-data access was never requested (D11/R3), so no
62
- * database credential is minted AND no database network is joined. An empty but
63
- * PRESENT declaration is a different statement and is not this.
66
+ * ABSENT means application-data access was never requested, so no business
67
+ * table is granted and no object-storage route is joined. It does NOT mean "no
68
+ * database": every minion holds the engine-floor database role and the route to
69
+ * it (#1771, see {@link MINION_UNCONDITIONAL_CAPABILITIES}). An empty but PRESENT
70
+ * declaration is a different statement and is not this.
64
71
  */
65
72
  readonly resourceAccess?: {
66
73
  read?: readonly string[];
@@ -70,10 +77,35 @@ export interface RuntimeAccessDeclaration {
70
77
  readonly requiresInternetEgress?: boolean | undefined;
71
78
  }
72
79
  /**
73
- * Derive a runtime's backing-service access from its principal and declaration.
80
+ * The application facts that bound what ANY of its runtimes may reach, whatever the runtime declared.
81
+ *
82
+ * REQUIRED at every call, so a caller cannot forget it and silently keep both database stores.
83
+ */
84
+ export interface RuntimeApplicationStores {
85
+ /**
86
+ * The application's own database engine, `resolveApplicationDatabaseEngine(applicationDatabase)`.
87
+ *
88
+ * It is the ONE store database credentials are minted on: apps-manager registers an application with
89
+ * `useMongoDB` / `usePostgreSQL` derived from this same resolved engine (`AppInitializationService`), and writes a
90
+ * per-principal role only in that store. A runtime given a route to the OTHER store would hold a route with no
91
+ * credential behind it (#3367), the inverse of #1771.
92
+ *
93
+ * One engine, not a set, by decision: an application uses exactly one transactional store (#3328), and the registry
94
+ * refuses a resource declaring the other, so no runtime needs a route, topology or credential for a second store.
95
+ */
96
+ readonly applicationDatabaseEngine: DatabaseEngine;
97
+ }
98
+ /**
99
+ * Derive a runtime's backing-service access from its principal, its declaration and its application's store.
74
100
  *
75
101
  * Fails CLOSED on every axis: an unknown principal kind, an absent declaration and
76
102
  * an absent `resourceAccess` all narrow rather than widen.
103
+ *
104
+ * The database capabilities are then narrowed to the application's own store (#3367), for EVERY principal, the backend
105
+ * included: that is the only store any of them holds a credential for. The env topology and the network membership of
106
+ * both deployment lanes read this answer. The apps-manager mint does not call it: it reaches the same store through
107
+ * `AppInitializationService.derivePersistenceSelection` over the same resolved engine, and
108
+ * `runtime-network-follows-credentials.test.ts` (apps-manager) holds the two to each other for every principal.
77
109
  */
78
- export declare function resolveRuntimeBackingServiceAccess(principal: ApplicationRuntimePrincipal | undefined, declaration?: RuntimeAccessDeclaration | undefined): RuntimeBackingServiceAccess;
110
+ export declare function resolveRuntimeBackingServiceAccess(principal: ApplicationRuntimePrincipal | undefined, declaration: RuntimeAccessDeclaration | undefined, applicationStores: RuntimeApplicationStores): RuntimeBackingServiceAccess;
79
111
  //# sourceMappingURL=runtime-backing-service-access.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-backing-service-access.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-backing-service-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAmC,KAAK,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAElH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IACpD;;;;;;;OAOG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;CAC1C;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;;OAOG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CAAC;IAC9F,uFAAuF;IACvF,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACvD;AAqCD;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAChD,SAAS,EAAE,2BAA2B,GAAG,SAAS,EAClD,WAAW,CAAC,EAAE,wBAAwB,GAAG,SAAS,GACjD,2BAA2B,CA+C7B"}
1
+ {"version":3,"file":"runtime-backing-service-access.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/runtime-backing-service-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAC9E,OAAO,EAAmC,KAAK,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAElH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IACpD;;;;;;;OAOG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;CAC1C;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;OASG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CAAC;IAC9F,uFAAuF;IACvF,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACvD;AAuDD;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,yBAAyB,EAAE,cAAc,CAAC;CACpD;AAWD;;;;;;;;;;;GAWG;AACH,wBAAgB,kCAAkC,CAChD,SAAS,EAAE,2BAA2B,GAAG,SAAS,EAClD,WAAW,EAAE,wBAAwB,GAAG,SAAS,EACjD,iBAAiB,EAAE,wBAAwB,GAC1C,2BAA2B,CAgB7B"}
@@ -1,4 +1,5 @@
1
1
  import { InfraCapability } from '../project-config/shared/infra-providers.schemas.js';
2
+ import { DatabaseEngine } from '../project-config/shared/environment.schemas.js';
2
3
  import { ApplicationRuntimePrincipalKind } from './runtime-principal.contracts.js';
3
4
  /**
4
5
  * Capabilities every MINION reaches regardless of what it declared.
@@ -13,6 +14,26 @@ import { ApplicationRuntimePrincipalKind } from './runtime-principal.contracts.j
13
14
  const MINION_UNCONDITIONAL_CAPABILITIES = [
14
15
  InfraCapability.QUEUING_SYSTEM,
15
16
  InfraCapability.CACHE_MANAGER,
17
+ // The DATABASE is unconditional too (#1771), decided by what a minion does at startup rather than by what
18
+ // it declared. `StartMinionApplicationBackendService.initialize` runs the full backend startup, which
19
+ // connects the application's selected store and fails the boot if it cannot; and every minion installs the
20
+ // tick consumer, whose durable coordinator and recovery scanner read and maintain `jobexecutions` and
21
+ // `jobpayloadstorage` and append `auditlogs`. A minion with no route to its database therefore cannot boot.
22
+ //
23
+ // So the credential side mints every minion the engine FLOOR role (`deriveMinionDatabaseGrants` over an
24
+ // empty authored grant: the framework's own tables and no business table), and this side gives it the route
25
+ // to use that role. Least privilege lives in the ROLE, which grants nothing `resourceAccess` did not ask for;
26
+ // withholding the route only produced a credential nobody could use and a minion that could not start.
27
+ //
28
+ // Rejected: "absent `resourceAccess` means no database at all" (the reading this file had until #1771, D11/R3).
29
+ // It cannot be honoured without a second minion runtime that skips the application lifecycle, and the mint
30
+ // had already stopped honouring it in 5c8936f86 because the tick consumer needs the floor.
31
+ //
32
+ // Both kinds are listed because an application is backed by one or the other and this layer does not know
33
+ // which here. `resolveRuntimeBackingServiceAccess` then keeps only the application's own store (#3367), the one
34
+ // every database credential is minted on.
35
+ InfraCapability.DOCUMENT_DATABASE,
36
+ InfraCapability.RELATIONAL_DATABASE,
16
37
  // Telemetry is unconditional for the same reason the platform segment is: every
17
38
  // runtime emits it, it carries no application data, and withholding it breaks
18
39
  // observability with NO signal — the collector appears in no readiness check, so
@@ -22,46 +43,68 @@ const MINION_UNCONDITIONAL_CAPABILITIES = [
22
43
  /**
23
44
  * Capabilities a minion reaches ONLY when it declared application-data access.
24
45
  *
25
- * Both database kinds are listed because an application is backed by one or the
26
- * other and this layer does not know which; the consumer intersects with the
27
- * capabilities the application actually provisions. Listing only the provisioned
28
- * one here would make this function depend on infrastructure configuration to
29
- * answer a question about a DECLARATION.
46
+ * Object storage alone: the engine floor is a property of holding a DATABASE role, and the object-storage
47
+ * credential is confined to the declared resources' key prefixes. The route follows the DECLARATION, not the
48
+ * size of that prefix set: an absent declaration gets no route (apps-manager derives no grant, so an empty
49
+ * prefix set), while a present one gets the route even when it names no resource, the absent/empty
50
+ * distinction kept everywhere else (an empty declaration's credential is still confined to no prefix).
30
51
  */
31
52
  const MINION_DATA_CAPABILITIES = [
32
- InfraCapability.DOCUMENT_DATABASE,
33
- InfraCapability.RELATIONAL_DATABASE,
34
53
  InfraCapability.OBJECT_STORAGE,
35
54
  ];
36
55
  /**
37
- * Derive a runtime's backing-service access from its principal and declaration.
56
+ * The database capability of each engine. Total, so an engine added to {@link DatabaseEngine} is a compile error here
57
+ * rather than a store no runtime can reach.
58
+ */
59
+ const DATABASE_CAPABILITY_OF_ENGINE = {
60
+ [DatabaseEngine.MONGODB]: InfraCapability.DOCUMENT_DATABASE,
61
+ [DatabaseEngine.POSTGRESQL]: InfraCapability.RELATIONAL_DATABASE,
62
+ };
63
+ /**
64
+ * Derive a runtime's backing-service access from its principal, its declaration and its application's store.
38
65
  *
39
66
  * Fails CLOSED on every axis: an unknown principal kind, an absent declaration and
40
67
  * an absent `resourceAccess` all narrow rather than widen.
68
+ *
69
+ * The database capabilities are then narrowed to the application's own store (#3367), for EVERY principal, the backend
70
+ * included: that is the only store any of them holds a credential for. The env topology and the network membership of
71
+ * both deployment lanes read this answer. The apps-manager mint does not call it: it reaches the same store through
72
+ * `AppInitializationService.derivePersistenceSelection` over the same resolved engine, and
73
+ * `runtime-network-follows-credentials.test.ts` (apps-manager) holds the two to each other for every principal.
41
74
  */
42
- export function resolveRuntimeBackingServiceAccess(principal, declaration) {
75
+ export function resolveRuntimeBackingServiceAccess(principal, declaration, applicationStores) {
76
+ const declared = resolveDeclaredBackingServiceAccess(principal, declaration);
77
+ const applicationStore = DATABASE_CAPABILITY_OF_ENGINE[applicationStores?.applicationDatabaseEngine];
78
+ if (!applicationStore) {
79
+ // A caller that reached here without the engine (an untyped path, a cast) would otherwise lose BOTH stores
80
+ // silently, or, written the other way, keep both. Neither is a reachability decision; refuse.
81
+ throw new Error(`resolveRuntimeBackingServiceAccess needs the application's database engine, got `
82
+ + `${JSON.stringify(applicationStores?.applicationDatabaseEngine)}. Pass resolveApplicationDatabaseEngine(applicationDatabase).`);
83
+ }
84
+ const otherStores = new Set(Object.values(DATABASE_CAPABILITY_OF_ENGINE).filter((capability) => capability !== applicationStore));
85
+ return {
86
+ capabilities: new Set([...declared.capabilities].filter((capability) => !otherStores.has(capability))),
87
+ requiresInternetEgress: declared.requiresInternetEgress,
88
+ };
89
+ }
90
+ /** What the principal and its declaration allow, before the application's store bounds it. */
91
+ function resolveDeclaredBackingServiceAccess(principal, declaration) {
43
92
  const requiresInternetEgress = declaration?.requiresInternetEgress === true;
44
93
  switch (principal?.kind) {
45
94
  case ApplicationRuntimePrincipalKind.APPLICATION_BACKEND:
46
95
  // The general runtime: it serves every request the application exposes, so
47
- // its access is the application's own provisioned set rather than anything
48
- // narrowed here. Returning the full vocabulary and letting the consumer
49
- // intersect with what the app provisions keeps THIS function about
50
- // declarations and the consumer about infrastructure.
96
+ // its access is the full vocabulary, bounded by the application's store in
97
+ // `resolveRuntimeBackingServiceAccess` and by what the environment provisions
98
+ // at each consumer.
51
99
  return {
52
100
  capabilities: new Set(Object.values(InfraCapability)),
53
101
  requiresInternetEgress,
54
102
  };
55
103
  case ApplicationRuntimePrincipalKind.MINION: {
56
104
  const capabilities = new Set(MINION_UNCONDITIONAL_CAPABILITIES);
57
- // ABSENT resourceAccess ⇒ no data capability at all: a minion that never
58
- // asked for application data must not have a route to it.
59
- //
60
- // ⚠️ This is NO LONGER the same gate as the credential minting. Since
61
- // 5c8936f86 the PostgreSQL mint gives such a minion a role carrying the
62
- // infrastructure floor (observed live 2026-09-26), so a credential is
63
- // issued that this layer gives no route to use. One rule has to be chosen
64
- // and derived for both layers — #1771.
105
+ // ABSENT resourceAccess ⇒ the database route (unconditional, for the floor role every minion is minted)
106
+ // and no object-storage route. The same gate as the credential side: the mint grants the floor to every
107
+ // minion and business tables and storage prefixes only from a declaration (#1771).
65
108
  if (declaration?.resourceAccess) {
66
109
  for (const capability of MINION_DATA_CAPABILITIES)
67
110
  capabilities.add(capability);
@@ -69,13 +112,19 @@ export function resolveRuntimeBackingServiceAccess(principal, declaration) {
69
112
  return { capabilities, requiresInternetEgress };
70
113
  }
71
114
  case ApplicationRuntimePrincipalKind.WORKER:
72
- // EMPTY, and this is a measured fact rather than a conservative guess: a
73
- // worker never boots the application lifecycle — it is standalone by design
74
- // with no backing-service access, which is why it has no member in
75
- // `ApplicationRuntimeProfile` at all. D22/KD-3 says the same thing from the
76
- // credential side. Segmentation turns that policy into a reachability fact
77
- // instead of a promise about what nobody remembered to inject.
78
- return { capabilities: new Set(), requiresInternetEgress };
115
+ // TELEMETRY ONLY, and both halves are measured rather than guessed (#3368).
116
+ //
117
+ // No backing service: a worker never boots the application lifecycle — it is standalone by design, which is
118
+ // why it has no member in `ApplicationRuntimeProfile` at all — and D22/KD-3 mints it no credential (the
119
+ // apps-manager mint loop skips it). Its environment (`buildApplicationWorkerEnv`) carries no database, cache,
120
+ // broker or storage topology.
121
+ //
122
+ // Telemetry: it DOES emit, like every runtime. `buildApplicationWorkerEnv` emits the `OTEL_*` posture
123
+ // ("workers emit OTEL_* like backends", audit A-2) and a Node worker runs under
124
+ // `--import @wildo-ai/saas-backend-lib/otel-preload`. Withholding the collector segment dropped its spans with no
125
+ // readiness signal, the failure `MINION_UNCONDITIONAL_CAPABILITIES` records for minions. The collector carries no
126
+ // application data and no credential.
127
+ return { capabilities: new Set([InfraCapability.METRICS_TELEMETRY]), requiresInternetEgress };
79
128
  default:
80
129
  // An unrecognised or absent principal gets NOTHING. Every caller uses this
81
130
  // to decide how narrowly a runtime is confined, so a permissive default
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-backing-service-access.js","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-backing-service-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,+BAA+B,EAAoC,MAAM,+BAA+B,CAAC;AAsElH;;;;;;;;;GASG;AACH,MAAM,iCAAiC,GAA+B;IACpE,eAAe,CAAC,cAAc;IAC9B,eAAe,CAAC,aAAa;IAC7B,gFAAgF;IAChF,8EAA8E;IAC9E,iFAAiF;IACjF,gFAAgF;IAChF,eAAe,CAAC,iBAAiB;CAClC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,wBAAwB,GAA+B;IAC3D,eAAe,CAAC,iBAAiB;IACjC,eAAe,CAAC,mBAAmB;IACnC,eAAe,CAAC,cAAc;CAC/B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,kCAAkC,CAChD,SAAkD,EAClD,WAAkD;IAElD,MAAM,sBAAsB,GAAG,WAAW,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAE5E,QAAQ,SAAS,EAAE,IAAI,EAAE,CAAC;QACxB,KAAK,+BAA+B,CAAC,mBAAmB;YACtD,2EAA2E;YAC3E,2EAA2E;YAC3E,wEAAwE;YACxE,mEAAmE;YACnE,sDAAsD;YACtD,OAAO;gBACL,YAAY,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;gBACrD,sBAAsB;aACvB,CAAC;QAEJ,KAAK,+BAA+B,CAAC,MAAM,CAAC,CAAC,CAAC;YAC5C,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,iCAAiC,CAAC,CAAC;YAChE,yEAAyE;YACzE,0DAA0D;YAC1D,EAAE;YACF,sEAAsE;YACtE,wEAAwE;YACxE,sEAAsE;YACtE,0EAA0E;YAC1E,uCAAuC;YACvC,IAAI,WAAW,EAAE,cAAc,EAAE,CAAC;gBAChC,KAAK,MAAM,UAAU,IAAI,wBAAwB;oBAAE,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAClF,CAAC;YACD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,CAAC;QAClD,CAAC;QAED,KAAK,+BAA+B,CAAC,MAAM;YACzC,yEAAyE;YACzE,4EAA4E;YAC5E,mEAAmE;YACnE,4EAA4E;YAC5E,2EAA2E;YAC3E,+DAA+D;YAC/D,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,EAAE,EAAE,sBAAsB,EAAE,CAAC;QAE7D;YACE,2EAA2E;YAC3E,wEAAwE;YACxE,sEAAsE;YACtE,mCAAmC;YACnC,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,EAAE,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAAC;IACtE,CAAC;AACH,CAAC","sourcesContent":["import { InfraCapability } from '../project-config/shared/infra-providers.schemas';\nimport { ApplicationRuntimePrincipalKind, type ApplicationRuntimePrincipal } from './runtime-principal.contracts';\n\n/**\n * WHICH backing services a runtime may reach, derived from what it DECLARED.\n *\n * ## Why this exists as one function\n *\n * Three enforcement points must agree about a runtime's backing-service access:\n * the CREDENTIALS apps-manager mints for it, the network MEMBERSHIP its container\n * gets, and the connection TOPOLOGY written into its environment. Each is\n * independently sufficient to deny, which is the point — but only while they\n * describe the same set.\n *\n * They are also each capable of silently disagreeing. A runtime kept off a\n * service's network while still receiving that service's connect URL is the worst\n * of the three combinations: `isConfigured()` reports true, a health probe or a\n * first use runs, and an unroutable host fails as a timeout for a runtime that was\n * never supposed to have the service at all. The fix is not a compensating branch\n * in a health check — it is that the two derive from HERE, so a non-declaring\n * runtime is never configured in the first place and there is nothing to\n * distinguish.\n *\n * So this is deliberately NOT a helper each consumer may reimplement \"for its own\n * needs\". Consumers call it; none re-derives. That is the whole anti-bypass\n * strategy, and the enumeration of who must call it lives in\n * `.claude/plans/minion-nature-and-authority.md` (Step 5-egress).\n *\n * ## The vocabulary is `InfraCapability`, not a new enum\n *\n * That is already what an infra provider module declares it supplies, so a\n * capability named here and a provider that serves it cannot drift into two\n * spellings of one concept.\n */\nexport interface RuntimeBackingServiceAccess {\n /**\n * Capabilities this runtime may reach. Empty is a legitimate, meaningful answer\n * — see the WORKER case — and must never be read as \"unspecified, allow all\".\n */\n readonly capabilities: ReadonlySet<InfraCapability>;\n /**\n * Whether this runtime needs a route off the host at all.\n *\n * Authored, never inferred: a scraper minion legitimately reaches the public\n * internet, and the point of the flag is not to refuse that but to stop egress\n * being universal and unstated. Default false, so the safe answer is the one you\n * get by not thinking about it.\n */\n readonly requiresInternetEgress: boolean;\n}\n\n/**\n * What a minion declares about its access to the application's data.\n *\n * Structural rather than importing the app-declaration type, so this contract does\n * not acquire the whole configuration graph for two fields.\n */\nexport interface RuntimeAccessDeclaration {\n /**\n * The minion's authored `resourceAccess`, or `undefined` when it declared none.\n *\n * The distinction is load-bearing and mirrors `deriveMinionResourceGrants`:\n * ABSENT means application-data access was never requested (D11/R3), so no\n * database credential is minted AND no database network is joined. An empty but\n * PRESENT declaration is a different statement and is not this.\n */\n readonly resourceAccess?: { read?: readonly string[]; write?: readonly string[] } | undefined;\n /** Authored opt-in; see {@link RuntimeBackingServiceAccess.requiresInternetEgress}. */\n readonly requiresInternetEgress?: boolean | undefined;\n}\n\n/**\n * Capabilities every MINION reaches regardless of what it declared.\n *\n * A minion is tick-driven and single-flighted: it consumes its tick queue and its\n * own RPC reply queue (QUEUING_SYSTEM) and holds a per-principal Redis namespace\n * (CACHE_MANAGER) used for its single-flight lease. Both credentials are minted\n * unconditionally for every minion today, so withholding either network would\n * strand a credential the platform issued — the incoherence this module exists to\n * prevent, arriving from the other direction.\n */\nconst MINION_UNCONDITIONAL_CAPABILITIES: readonly InfraCapability[] = [\n InfraCapability.QUEUING_SYSTEM,\n InfraCapability.CACHE_MANAGER,\n // Telemetry is unconditional for the same reason the platform segment is: every\n // runtime emits it, it carries no application data, and withholding it breaks\n // observability with NO signal — the collector appears in no readiness check, so\n // the failure surfaces as \"spans stopped\" long after the change that caused it.\n InfraCapability.METRICS_TELEMETRY,\n];\n\n/**\n * Capabilities a minion reaches ONLY when it declared application-data access.\n *\n * Both database kinds are listed because an application is backed by one or the\n * other and this layer does not know which; the consumer intersects with the\n * capabilities the application actually provisions. Listing only the provisioned\n * one here would make this function depend on infrastructure configuration to\n * answer a question about a DECLARATION.\n */\nconst MINION_DATA_CAPABILITIES: readonly InfraCapability[] = [\n InfraCapability.DOCUMENT_DATABASE,\n InfraCapability.RELATIONAL_DATABASE,\n InfraCapability.OBJECT_STORAGE,\n];\n\n/**\n * Derive a runtime's backing-service access from its principal and declaration.\n *\n * Fails CLOSED on every axis: an unknown principal kind, an absent declaration and\n * an absent `resourceAccess` all narrow rather than widen.\n */\nexport function resolveRuntimeBackingServiceAccess(\n principal: ApplicationRuntimePrincipal | undefined,\n declaration?: RuntimeAccessDeclaration | undefined,\n): RuntimeBackingServiceAccess {\n const requiresInternetEgress = declaration?.requiresInternetEgress === true;\n\n switch (principal?.kind) {\n case ApplicationRuntimePrincipalKind.APPLICATION_BACKEND:\n // The general runtime: it serves every request the application exposes, so\n // its access is the application's own provisioned set rather than anything\n // narrowed here. Returning the full vocabulary and letting the consumer\n // intersect with what the app provisions keeps THIS function about\n // declarations and the consumer about infrastructure.\n return {\n capabilities: new Set(Object.values(InfraCapability)),\n requiresInternetEgress,\n };\n\n case ApplicationRuntimePrincipalKind.MINION: {\n const capabilities = new Set(MINION_UNCONDITIONAL_CAPABILITIES);\n // ABSENT resourceAccess ⇒ no data capability at all: a minion that never\n // asked for application data must not have a route to it.\n //\n // ⚠️ This is NO LONGER the same gate as the credential minting. Since\n // 5c8936f86 the PostgreSQL mint gives such a minion a role carrying the\n // infrastructure floor (observed live 2026-09-26), so a credential is\n // issued that this layer gives no route to use. One rule has to be chosen\n // and derived for both layers — #1771.\n if (declaration?.resourceAccess) {\n for (const capability of MINION_DATA_CAPABILITIES) capabilities.add(capability);\n }\n return { capabilities, requiresInternetEgress };\n }\n\n case ApplicationRuntimePrincipalKind.WORKER:\n // EMPTY, and this is a measured fact rather than a conservative guess: a\n // worker never boots the application lifecycle — it is standalone by design\n // with no backing-service access, which is why it has no member in\n // `ApplicationRuntimeProfile` at all. D22/KD-3 says the same thing from the\n // credential side. Segmentation turns that policy into a reachability fact\n // instead of a promise about what nobody remembered to inject.\n return { capabilities: new Set(), requiresInternetEgress };\n\n default:\n // An unrecognised or absent principal gets NOTHING. Every caller uses this\n // to decide how narrowly a runtime is confined, so a permissive default\n // would widen confinement silently — the one direction that cannot be\n // detected by anything downstream.\n return { capabilities: new Set(), requiresInternetEgress: false };\n }\n}\n"]}
1
+ {"version":3,"file":"runtime-backing-service-access.js","sourceRoot":"","sources":["../../../src/bootstrap/runtime-backing-service-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAoC,MAAM,+BAA+B,CAAC;AA4ElH;;;;;;;;;GASG;AACH,MAAM,iCAAiC,GAA+B;IACpE,eAAe,CAAC,cAAc;IAC9B,eAAe,CAAC,aAAa;IAC7B,0GAA0G;IAC1G,sGAAsG;IACtG,2GAA2G;IAC3G,sGAAsG;IACtG,4GAA4G;IAC5G,EAAE;IACF,wGAAwG;IACxG,4GAA4G;IAC5G,8GAA8G;IAC9G,uGAAuG;IACvG,EAAE;IACF,gHAAgH;IAChH,2GAA2G;IAC3G,2FAA2F;IAC3F,EAAE;IACF,0GAA0G;IAC1G,gHAAgH;IAChH,0CAA0C;IAC1C,eAAe,CAAC,iBAAiB;IACjC,eAAe,CAAC,mBAAmB;IACnC,gFAAgF;IAChF,8EAA8E;IAC9E,iFAAiF;IACjF,gFAAgF;IAChF,eAAe,CAAC,iBAAiB;CAClC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,wBAAwB,GAA+B;IAC3D,eAAe,CAAC,cAAc;CAC/B,CAAC;AAsBF;;;GAGG;AACH,MAAM,6BAA6B,GAA4C;IAC7E,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,iBAAiB;IAC3D,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,eAAe,CAAC,mBAAmB;CACjE,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kCAAkC,CAChD,SAAkD,EAClD,WAAiD,EACjD,iBAA2C;IAE3C,MAAM,QAAQ,GAAG,mCAAmC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC7E,MAAM,gBAAgB,GAAG,6BAA6B,CAAC,iBAAiB,EAAE,yBAAyB,CAAC,CAAC;IACrG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,2GAA2G;QAC3G,8FAA8F;QAC9F,MAAM,IAAI,KAAK,CACb,kFAAkF;cAChF,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,yBAAyB,CAAC,+DAA+D,CACjI,CAAC;IACJ,CAAC;IACD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,KAAK,gBAAgB,CAAC,CAAC,CAAC;IAClI,OAAO;QACL,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;QACtG,sBAAsB,EAAE,QAAQ,CAAC,sBAAsB;KACxD,CAAC;AACJ,CAAC;AAED,8FAA8F;AAC9F,SAAS,mCAAmC,CAC1C,SAAkD,EAClD,WAAiD;IAEjD,MAAM,sBAAsB,GAAG,WAAW,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAE5E,QAAQ,SAAS,EAAE,IAAI,EAAE,CAAC;QACxB,KAAK,+BAA+B,CAAC,mBAAmB;YACtD,2EAA2E;YAC3E,2EAA2E;YAC3E,8EAA8E;YAC9E,oBAAoB;YACpB,OAAO;gBACL,YAAY,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;gBACrD,sBAAsB;aACvB,CAAC;QAEJ,KAAK,+BAA+B,CAAC,MAAM,CAAC,CAAC,CAAC;YAC5C,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,iCAAiC,CAAC,CAAC;YAChE,wGAAwG;YACxG,wGAAwG;YACxG,mFAAmF;YACnF,IAAI,WAAW,EAAE,cAAc,EAAE,CAAC;gBAChC,KAAK,MAAM,UAAU,IAAI,wBAAwB;oBAAE,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAClF,CAAC;YACD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,CAAC;QAClD,CAAC;QAED,KAAK,+BAA+B,CAAC,MAAM;YACzC,4EAA4E;YAC5E,EAAE;YACF,4GAA4G;YAC5G,wGAAwG;YACxG,8GAA8G;YAC9G,8BAA8B;YAC9B,EAAE;YACF,sGAAsG;YACtG,gFAAgF;YAChF,kHAAkH;YAClH,kHAAkH;YAClH,sCAAsC;YACtC,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC,EAAE,sBAAsB,EAAE,CAAC;QAEhG;YACE,2EAA2E;YAC3E,wEAAwE;YACxE,sEAAsE;YACtE,mCAAmC;YACnC,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,EAAE,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAAC;IACtE,CAAC;AACH,CAAC","sourcesContent":["import { InfraCapability } from '../project-config/shared/infra-providers.schemas';\nimport { DatabaseEngine } from '../project-config/shared/environment.schemas';\nimport { ApplicationRuntimePrincipalKind, type ApplicationRuntimePrincipal } from './runtime-principal.contracts';\n\n/**\n * WHICH backing services a runtime may reach, derived from what it DECLARED.\n *\n * ## Why this exists as one function\n *\n * Three enforcement points must agree about a runtime's backing-service access:\n * the CREDENTIALS apps-manager mints for it, the network MEMBERSHIP its container\n * gets, and the connection TOPOLOGY written into its environment. Each is\n * independently sufficient to deny, which is the point — but only while they\n * describe the same set.\n *\n * They are also each capable of silently disagreeing. A runtime kept off a\n * service's network while still receiving that service's connect URL is the worst\n * of the three combinations: `isConfigured()` reports true, a health probe or a\n * first use runs, and an unroutable host fails as a timeout for a runtime that was\n * never supposed to have the service at all. The fix is not a compensating branch\n * in a health check — it is that the two derive from HERE, so a non-declaring\n * runtime is never configured in the first place and there is nothing to\n * distinguish.\n *\n * So this is deliberately NOT a helper each consumer may reimplement \"for its own\n * needs\". Consumers call it; none re-derives. Two of the three enforcement points\n * call it directly: the network membership (both deployment lanes) and the\n * connection topology (the env builders). The third, the apps-manager mint, does\n * not: it reaches the same database store through\n * `AppInitializationService.derivePersistenceSelection` over the same resolved\n * engine, and `runtime-network-follows-credentials.test.ts` (apps-manager) holds\n * membership equal to the minted credentials for every principal (#3367).\n *\n * ## The vocabulary is `InfraCapability`, not a new enum\n *\n * That is already what an infra provider module declares it supplies, so a\n * capability named here and a provider that serves it cannot drift into two\n * spellings of one concept.\n */\nexport interface RuntimeBackingServiceAccess {\n /**\n * Capabilities this runtime may reach. Empty is a legitimate, meaningful answer\n * — see the static website, which is no runtime principal — and must never be read as \"unspecified, allow all\".\n */\n readonly capabilities: ReadonlySet<InfraCapability>;\n /**\n * Whether this runtime needs a route off the host at all.\n *\n * Authored, never inferred: a scraper minion legitimately reaches the public\n * internet, and the point of the flag is not to refuse that but to stop egress\n * being universal and unstated. Default false, so the safe answer is the one you\n * get by not thinking about it.\n */\n readonly requiresInternetEgress: boolean;\n}\n\n/**\n * What a minion declares about its access to the application's data.\n *\n * Structural rather than importing the app-declaration type, so this contract does\n * not acquire the whole configuration graph for two fields.\n */\nexport interface RuntimeAccessDeclaration {\n /**\n * The minion's authored `resourceAccess`, or `undefined` when it declared none.\n *\n * The distinction is load-bearing and mirrors `deriveMinionResourceGrants`:\n * ABSENT means application-data access was never requested, so no business\n * table is granted and no object-storage route is joined. It does NOT mean \"no\n * database\": every minion holds the engine-floor database role and the route to\n * it (#1771, see {@link MINION_UNCONDITIONAL_CAPABILITIES}). An empty but PRESENT\n * declaration is a different statement and is not this.\n */\n readonly resourceAccess?: { read?: readonly string[]; write?: readonly string[] } | undefined;\n /** Authored opt-in; see {@link RuntimeBackingServiceAccess.requiresInternetEgress}. */\n readonly requiresInternetEgress?: boolean | undefined;\n}\n\n/**\n * Capabilities every MINION reaches regardless of what it declared.\n *\n * A minion is tick-driven and single-flighted: it consumes its tick queue and its\n * own RPC reply queue (QUEUING_SYSTEM) and holds a per-principal Redis namespace\n * (CACHE_MANAGER) used for its single-flight lease. Both credentials are minted\n * unconditionally for every minion today, so withholding either network would\n * strand a credential the platform issued — the incoherence this module exists to\n * prevent, arriving from the other direction.\n */\nconst MINION_UNCONDITIONAL_CAPABILITIES: readonly InfraCapability[] = [\n InfraCapability.QUEUING_SYSTEM,\n InfraCapability.CACHE_MANAGER,\n // The DATABASE is unconditional too (#1771), decided by what a minion does at startup rather than by what\n // it declared. `StartMinionApplicationBackendService.initialize` runs the full backend startup, which\n // connects the application's selected store and fails the boot if it cannot; and every minion installs the\n // tick consumer, whose durable coordinator and recovery scanner read and maintain `jobexecutions` and\n // `jobpayloadstorage` and append `auditlogs`. A minion with no route to its database therefore cannot boot.\n //\n // So the credential side mints every minion the engine FLOOR role (`deriveMinionDatabaseGrants` over an\n // empty authored grant: the framework's own tables and no business table), and this side gives it the route\n // to use that role. Least privilege lives in the ROLE, which grants nothing `resourceAccess` did not ask for;\n // withholding the route only produced a credential nobody could use and a minion that could not start.\n //\n // Rejected: \"absent `resourceAccess` means no database at all\" (the reading this file had until #1771, D11/R3).\n // It cannot be honoured without a second minion runtime that skips the application lifecycle, and the mint\n // had already stopped honouring it in 5c8936f86 because the tick consumer needs the floor.\n //\n // Both kinds are listed because an application is backed by one or the other and this layer does not know\n // which here. `resolveRuntimeBackingServiceAccess` then keeps only the application's own store (#3367), the one\n // every database credential is minted on.\n InfraCapability.DOCUMENT_DATABASE,\n InfraCapability.RELATIONAL_DATABASE,\n // Telemetry is unconditional for the same reason the platform segment is: every\n // runtime emits it, it carries no application data, and withholding it breaks\n // observability with NO signal — the collector appears in no readiness check, so\n // the failure surfaces as \"spans stopped\" long after the change that caused it.\n InfraCapability.METRICS_TELEMETRY,\n];\n\n/**\n * Capabilities a minion reaches ONLY when it declared application-data access.\n *\n * Object storage alone: the engine floor is a property of holding a DATABASE role, and the object-storage\n * credential is confined to the declared resources' key prefixes. The route follows the DECLARATION, not the\n * size of that prefix set: an absent declaration gets no route (apps-manager derives no grant, so an empty\n * prefix set), while a present one gets the route even when it names no resource, the absent/empty\n * distinction kept everywhere else (an empty declaration's credential is still confined to no prefix).\n */\nconst MINION_DATA_CAPABILITIES: readonly InfraCapability[] = [\n InfraCapability.OBJECT_STORAGE,\n];\n\n/**\n * The application facts that bound what ANY of its runtimes may reach, whatever the runtime declared.\n *\n * REQUIRED at every call, so a caller cannot forget it and silently keep both database stores.\n */\nexport interface RuntimeApplicationStores {\n /**\n * The application's own database engine, `resolveApplicationDatabaseEngine(applicationDatabase)`.\n *\n * It is the ONE store database credentials are minted on: apps-manager registers an application with\n * `useMongoDB` / `usePostgreSQL` derived from this same resolved engine (`AppInitializationService`), and writes a\n * per-principal role only in that store. A runtime given a route to the OTHER store would hold a route with no\n * credential behind it (#3367), the inverse of #1771.\n *\n * One engine, not a set, by decision: an application uses exactly one transactional store (#3328), and the registry\n * refuses a resource declaring the other, so no runtime needs a route, topology or credential for a second store.\n */\n readonly applicationDatabaseEngine: DatabaseEngine;\n}\n\n/**\n * The database capability of each engine. Total, so an engine added to {@link DatabaseEngine} is a compile error here\n * rather than a store no runtime can reach.\n */\nconst DATABASE_CAPABILITY_OF_ENGINE: Record<DatabaseEngine, InfraCapability> = {\n [DatabaseEngine.MONGODB]: InfraCapability.DOCUMENT_DATABASE,\n [DatabaseEngine.POSTGRESQL]: InfraCapability.RELATIONAL_DATABASE,\n};\n\n/**\n * Derive a runtime's backing-service access from its principal, its declaration and its application's store.\n *\n * Fails CLOSED on every axis: an unknown principal kind, an absent declaration and\n * an absent `resourceAccess` all narrow rather than widen.\n *\n * The database capabilities are then narrowed to the application's own store (#3367), for EVERY principal, the backend\n * included: that is the only store any of them holds a credential for. The env topology and the network membership of\n * both deployment lanes read this answer. The apps-manager mint does not call it: it reaches the same store through\n * `AppInitializationService.derivePersistenceSelection` over the same resolved engine, and\n * `runtime-network-follows-credentials.test.ts` (apps-manager) holds the two to each other for every principal.\n */\nexport function resolveRuntimeBackingServiceAccess(\n principal: ApplicationRuntimePrincipal | undefined,\n declaration: RuntimeAccessDeclaration | undefined,\n applicationStores: RuntimeApplicationStores,\n): RuntimeBackingServiceAccess {\n const declared = resolveDeclaredBackingServiceAccess(principal, declaration);\n const applicationStore = DATABASE_CAPABILITY_OF_ENGINE[applicationStores?.applicationDatabaseEngine];\n if (!applicationStore) {\n // A caller that reached here without the engine (an untyped path, a cast) would otherwise lose BOTH stores\n // silently, or, written the other way, keep both. Neither is a reachability decision; refuse.\n throw new Error(\n `resolveRuntimeBackingServiceAccess needs the application's database engine, got `\n + `${JSON.stringify(applicationStores?.applicationDatabaseEngine)}. Pass resolveApplicationDatabaseEngine(applicationDatabase).`,\n );\n }\n const otherStores = new Set(Object.values(DATABASE_CAPABILITY_OF_ENGINE).filter((capability) => capability !== applicationStore));\n return {\n capabilities: new Set([...declared.capabilities].filter((capability) => !otherStores.has(capability))),\n requiresInternetEgress: declared.requiresInternetEgress,\n };\n}\n\n/** What the principal and its declaration allow, before the application's store bounds it. */\nfunction resolveDeclaredBackingServiceAccess(\n principal: ApplicationRuntimePrincipal | undefined,\n declaration: RuntimeAccessDeclaration | undefined,\n): RuntimeBackingServiceAccess {\n const requiresInternetEgress = declaration?.requiresInternetEgress === true;\n\n switch (principal?.kind) {\n case ApplicationRuntimePrincipalKind.APPLICATION_BACKEND:\n // The general runtime: it serves every request the application exposes, so\n // its access is the full vocabulary, bounded by the application's store in\n // `resolveRuntimeBackingServiceAccess` and by what the environment provisions\n // at each consumer.\n return {\n capabilities: new Set(Object.values(InfraCapability)),\n requiresInternetEgress,\n };\n\n case ApplicationRuntimePrincipalKind.MINION: {\n const capabilities = new Set(MINION_UNCONDITIONAL_CAPABILITIES);\n // ABSENT resourceAccess ⇒ the database route (unconditional, for the floor role every minion is minted)\n // and no object-storage route. The same gate as the credential side: the mint grants the floor to every\n // minion and business tables and storage prefixes only from a declaration (#1771).\n if (declaration?.resourceAccess) {\n for (const capability of MINION_DATA_CAPABILITIES) capabilities.add(capability);\n }\n return { capabilities, requiresInternetEgress };\n }\n\n case ApplicationRuntimePrincipalKind.WORKER:\n // TELEMETRY ONLY, and both halves are measured rather than guessed (#3368).\n //\n // No backing service: a worker never boots the application lifecycle — it is standalone by design, which is\n // why it has no member in `ApplicationRuntimeProfile` at all — and D22/KD-3 mints it no credential (the\n // apps-manager mint loop skips it). Its environment (`buildApplicationWorkerEnv`) carries no database, cache,\n // broker or storage topology.\n //\n // Telemetry: it DOES emit, like every runtime. `buildApplicationWorkerEnv` emits the `OTEL_*` posture\n // (\"workers emit OTEL_* like backends\", audit A-2) and a Node worker runs under\n // `--import @wildo-ai/saas-backend-lib/otel-preload`. Withholding the collector segment dropped its spans with no\n // readiness signal, the failure `MINION_UNCONDITIONAL_CAPABILITIES` records for minions. The collector carries no\n // application data and no credential.\n return { capabilities: new Set([InfraCapability.METRICS_TELEMETRY]), requiresInternetEgress };\n\n default:\n // An unrecognised or absent principal gets NOTHING. Every caller uses this\n // to decide how narrowly a runtime is confined, so a permissive default\n // would widen confinement silently — the one direction that cannot be\n // detected by anything downstream.\n return { capabilities: new Set(), requiresInternetEgress: false };\n }\n}\n"]}