@wildo-ai/platform-config-lib 1.0.1 → 1.1.0

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 (414) hide show
  1. package/LICENSE +34 -0
  2. package/dist/esm/.builder.pid +9 -0
  3. package/dist/esm/_unimplemented/index.d.ts +3 -0
  4. package/dist/esm/_unimplemented/index.d.ts.map +1 -0
  5. package/dist/esm/_unimplemented/index.js +3 -0
  6. package/dist/esm/_unimplemented/index.js.map +1 -0
  7. package/dist/esm/_unimplemented/soft-warn.d.ts +124 -0
  8. package/dist/esm/_unimplemented/soft-warn.d.ts.map +1 -0
  9. package/dist/esm/_unimplemented/soft-warn.js +170 -0
  10. package/dist/esm/_unimplemented/soft-warn.js.map +1 -0
  11. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts +137 -0
  12. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts.map +1 -0
  13. package/dist/esm/_unimplemented/unimplemented-field-warning.js +153 -0
  14. package/dist/esm/_unimplemented/unimplemented-field-warning.js.map +1 -0
  15. package/dist/esm/bootstrap/application-backend-env.contracts.d.ts.map +1 -1
  16. package/dist/esm/bootstrap/application-backend-env.contracts.js +1 -1
  17. package/dist/esm/bootstrap/application-backend-env.contracts.js.map +1 -1
  18. package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts +13 -0
  19. package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts.map +1 -0
  20. package/dist/esm/bootstrap/application-creation-verification-env.contracts.js +14 -0
  21. package/dist/esm/bootstrap/application-creation-verification-env.contracts.js.map +1 -0
  22. package/dist/esm/bootstrap/bootstrap-planner.d.ts +1 -1
  23. package/dist/esm/bootstrap/bootstrap-planner.d.ts.map +1 -1
  24. package/dist/esm/bootstrap/bootstrap-planner.js +1 -1
  25. package/dist/esm/bootstrap/bootstrap-planner.js.map +1 -1
  26. package/dist/esm/bootstrap/bootstrap.contracts.d.ts +141 -37
  27. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  28. package/dist/esm/bootstrap/bootstrap.contracts.js +104 -18
  29. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  30. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +430 -421
  31. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  32. package/dist/esm/bootstrap/bootstrap.schemas.js +383 -21
  33. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  34. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +213 -8
  35. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  36. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +230 -5
  37. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  38. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts +79 -0
  39. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -0
  40. package/dist/esm/bootstrap/runtime-backing-service-access.js +83 -0
  41. package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -0
  42. package/dist/esm/bootstrap/runtime-network-policy.d.ts +63 -0
  43. package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -0
  44. package/dist/esm/bootstrap/runtime-network-policy.js +104 -0
  45. package/dist/esm/bootstrap/runtime-network-policy.js.map +1 -0
  46. package/dist/esm/bootstrap/runtime-network-topology.d.ts +78 -0
  47. package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -0
  48. package/dist/esm/bootstrap/runtime-network-topology.js +134 -0
  49. package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -0
  50. package/dist/esm/bootstrap/runtime-platform-access.d.ts +67 -0
  51. package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -0
  52. package/dist/esm/bootstrap/runtime-platform-access.js +57 -0
  53. package/dist/esm/bootstrap/runtime-platform-access.js.map +1 -0
  54. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts +173 -0
  55. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -0
  56. package/dist/esm/bootstrap/runtime-principal.contracts.js +218 -0
  57. package/dist/esm/bootstrap/runtime-principal.contracts.js.map +1 -0
  58. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts +112 -1
  59. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
  60. package/dist/esm/bootstrap/runtime-topology.contracts.js +141 -8
  61. package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
  62. package/dist/esm/config-authoring.entry.d.ts +3 -0
  63. package/dist/esm/config-authoring.entry.d.ts.map +1 -0
  64. package/dist/esm/config-authoring.entry.js +5 -0
  65. package/dist/esm/config-authoring.entry.js.map +1 -0
  66. package/dist/esm/credentials/credential-generator.service.d.ts.map +1 -1
  67. package/dist/esm/credentials/credential-generator.service.js +1 -1
  68. package/dist/esm/credentials/credential-generator.service.js.map +1 -1
  69. package/dist/esm/index.d.ts +30 -15
  70. package/dist/esm/index.d.ts.map +1 -1
  71. package/dist/esm/index.js +16 -1
  72. package/dist/esm/index.js.map +1 -1
  73. package/dist/esm/lockfile/canonical-json.d.ts +41 -0
  74. package/dist/esm/lockfile/canonical-json.d.ts.map +1 -0
  75. package/dist/esm/lockfile/canonical-json.js +56 -0
  76. package/dist/esm/lockfile/canonical-json.js.map +1 -0
  77. package/dist/esm/lockfile/lockfile-io.d.ts +231 -0
  78. package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -0
  79. package/dist/esm/lockfile/lockfile-io.js +303 -0
  80. package/dist/esm/lockfile/lockfile-io.js.map +1 -0
  81. package/dist/esm/lockfile/materialize-infra-section.d.ts +99 -0
  82. package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -0
  83. package/dist/esm/lockfile/materialize-infra-section.js +153 -0
  84. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -0
  85. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +522 -0
  86. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -0
  87. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +116 -0
  88. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -0
  89. package/dist/esm/project-config/define-framework-config.d.ts +36 -10
  90. package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
  91. package/dist/esm/project-config/define-framework-config.js +67 -3
  92. package/dist/esm/project-config/define-framework-config.js.map +1 -1
  93. package/dist/esm/project-config/define-infra-env-config.d.ts +570 -0
  94. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -0
  95. package/dist/esm/project-config/define-infra-env-config.js +726 -0
  96. package/dist/esm/project-config/define-infra-env-config.js.map +1 -0
  97. package/dist/esm/project-config/define-minion-config.d.ts +221 -23
  98. package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
  99. package/dist/esm/project-config/define-minion-config.js +228 -11
  100. package/dist/esm/project-config/define-minion-config.js.map +1 -1
  101. package/dist/esm/project-config/define-saas-config.d.ts +427 -218
  102. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  103. package/dist/esm/project-config/define-saas-config.js +704 -75
  104. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  105. package/dist/esm/project-config/define-worker-config.d.ts +106 -10
  106. package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
  107. package/dist/esm/project-config/define-worker-config.js +99 -9
  108. package/dist/esm/project-config/define-worker-config.js.map +1 -1
  109. package/dist/esm/project-config/index.d.ts +28 -21
  110. package/dist/esm/project-config/index.d.ts.map +1 -1
  111. package/dist/esm/project-config/index.js +14 -7
  112. package/dist/esm/project-config/index.js.map +1 -1
  113. package/dist/esm/project-config/loader.d.ts +120 -10
  114. package/dist/esm/project-config/loader.d.ts.map +1 -1
  115. package/dist/esm/project-config/loader.js +290 -38
  116. package/dist/esm/project-config/loader.js.map +1 -1
  117. package/dist/esm/project-config/minion-local-provider-registration.d.ts +69 -0
  118. package/dist/esm/project-config/minion-local-provider-registration.d.ts.map +1 -0
  119. package/dist/esm/project-config/minion-local-provider-registration.js +72 -0
  120. package/dist/esm/project-config/minion-local-provider-registration.js.map +1 -0
  121. package/dist/esm/project-config/provider-catalog-types.d.ts +12 -0
  122. package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -0
  123. package/dist/esm/project-config/provider-catalog-types.js +49 -0
  124. package/dist/esm/project-config/provider-catalog-types.js.map +1 -0
  125. package/dist/esm/project-config/provider-companion-discovery.d.ts +24 -0
  126. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -0
  127. package/dist/esm/project-config/provider-companion-discovery.js +244 -0
  128. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -0
  129. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +297 -0
  130. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -0
  131. package/dist/esm/project-config/provider-runtime-artifacts.js +860 -0
  132. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -0
  133. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts +18 -0
  134. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -0
  135. package/dist/esm/project-config/shared/application-creation-verification.schemas.js +25 -0
  136. package/dist/esm/project-config/shared/application-creation-verification.schemas.js.map +1 -0
  137. package/dist/esm/project-config/shared/application-modules.schemas.d.ts +10 -2
  138. package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
  139. package/dist/esm/project-config/shared/application-modules.schemas.js +12 -1
  140. package/dist/esm/project-config/shared/application-modules.schemas.js.map +1 -1
  141. package/dist/esm/project-config/shared/application-modules.utils.d.ts +2 -1
  142. package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
  143. package/dist/esm/project-config/shared/application-modules.utils.js +6 -1
  144. package/dist/esm/project-config/shared/application-modules.utils.js.map +1 -1
  145. package/dist/esm/project-config/shared/auth.schemas.d.ts +102 -0
  146. package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -0
  147. package/dist/esm/project-config/shared/auth.schemas.js +100 -0
  148. package/dist/esm/project-config/shared/auth.schemas.js.map +1 -0
  149. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +316 -39
  150. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  151. package/dist/esm/project-config/shared/backing-services.schemas.js +359 -24
  152. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  153. package/dist/esm/project-config/shared/cdn.example.d.ts +14 -0
  154. package/dist/esm/project-config/shared/cdn.example.d.ts.map +1 -0
  155. package/dist/esm/project-config/shared/cdn.example.js +38 -0
  156. package/dist/esm/project-config/shared/cdn.example.js.map +1 -0
  157. package/dist/esm/project-config/shared/cdn.schemas.d.ts +182 -0
  158. package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -0
  159. package/dist/esm/project-config/shared/cdn.schemas.js +151 -0
  160. package/dist/esm/project-config/shared/cdn.schemas.js.map +1 -0
  161. package/dist/esm/project-config/shared/csp-defaults.d.ts +92 -0
  162. package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -0
  163. package/dist/esm/project-config/shared/csp-defaults.js +195 -0
  164. package/dist/esm/project-config/shared/csp-defaults.js.map +1 -0
  165. package/dist/esm/project-config/shared/csp-emit.d.ts +106 -0
  166. package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -0
  167. package/dist/esm/project-config/shared/csp-emit.js +305 -0
  168. package/dist/esm/project-config/shared/csp-emit.js.map +1 -0
  169. package/dist/esm/project-config/shared/csp.schemas.d.ts +266 -0
  170. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -0
  171. package/dist/esm/project-config/shared/csp.schemas.js +281 -0
  172. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -0
  173. package/dist/esm/project-config/shared/data-services.schemas.d.ts +45 -9
  174. package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
  175. package/dist/esm/project-config/shared/data-services.schemas.js +45 -9
  176. package/dist/esm/project-config/shared/data-services.schemas.js.map +1 -1
  177. package/dist/esm/project-config/shared/env-example-defaults.d.ts +0 -1
  178. package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
  179. package/dist/esm/project-config/shared/env-example-defaults.js +1 -2
  180. package/dist/esm/project-config/shared/env-example-defaults.js.map +1 -1
  181. package/dist/esm/project-config/shared/environment.schemas.d.ts +134 -8
  182. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  183. package/dist/esm/project-config/shared/environment.schemas.js +185 -2
  184. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  185. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +779 -0
  186. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -0
  187. package/dist/esm/project-config/shared/infra-providers.schemas.js +210 -0
  188. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -0
  189. package/dist/esm/project-config/shared/infra-service.schemas.d.ts +18 -0
  190. package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -0
  191. package/dist/esm/project-config/shared/infra-service.schemas.js +16 -0
  192. package/dist/esm/project-config/shared/infra-service.schemas.js.map +1 -0
  193. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts +83 -1
  194. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
  195. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js +99 -2
  196. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
  197. package/dist/esm/project-config/shared/k8s-utils.d.ts +51 -7
  198. package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
  199. package/dist/esm/project-config/shared/k8s-utils.js +59 -12
  200. package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
  201. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts +31 -0
  202. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -0
  203. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js +32 -0
  204. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -0
  205. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +142 -0
  206. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -0
  207. package/dist/esm/project-config/shared/minion-resource-access.validation.js +159 -0
  208. package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -0
  209. package/dist/esm/project-config/shared/object-storage-session-policy.d.ts +100 -0
  210. package/dist/esm/project-config/shared/object-storage-session-policy.d.ts.map +1 -0
  211. package/dist/esm/project-config/shared/object-storage-session-policy.js +130 -0
  212. package/dist/esm/project-config/shared/object-storage-session-policy.js.map +1 -0
  213. package/dist/esm/project-config/shared/platform-services.schemas.d.ts +9 -14
  214. package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
  215. package/dist/esm/project-config/shared/platform-services.schemas.js +13 -9
  216. package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
  217. package/dist/esm/project-config/shared/schema-version.schemas.d.ts +15 -0
  218. package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +1 -0
  219. package/dist/esm/project-config/shared/schema-version.schemas.js +40 -0
  220. package/dist/esm/project-config/shared/schema-version.schemas.js.map +1 -0
  221. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts +283 -8
  222. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
  223. package/dist/esm/project-config/shared/service-definitions.schemas.js +325 -8
  224. package/dist/esm/project-config/shared/service-definitions.schemas.js.map +1 -1
  225. package/dist/esm/registry/artifact-domain.schemas.d.ts +54 -0
  226. package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -0
  227. package/dist/esm/registry/artifact-domain.schemas.js +40 -0
  228. package/dist/esm/registry/artifact-domain.schemas.js.map +1 -0
  229. package/dist/esm/registry/companion-api.schemas.d.ts +176 -0
  230. package/dist/esm/registry/companion-api.schemas.d.ts.map +1 -0
  231. package/dist/esm/registry/companion-api.schemas.js +165 -0
  232. package/dist/esm/registry/companion-api.schemas.js.map +1 -0
  233. package/dist/esm/registry/digest.schemas.d.ts +20 -0
  234. package/dist/esm/registry/digest.schemas.d.ts.map +1 -0
  235. package/dist/esm/registry/digest.schemas.js +21 -0
  236. package/dist/esm/registry/digest.schemas.js.map +1 -0
  237. package/dist/esm/registry/index.d.ts +33 -0
  238. package/dist/esm/registry/index.d.ts.map +1 -0
  239. package/dist/esm/registry/index.js +33 -0
  240. package/dist/esm/registry/index.js.map +1 -0
  241. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +107 -0
  242. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -0
  243. package/dist/esm/registry/lockfile-modules-section.schemas.js +67 -0
  244. package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -0
  245. package/dist/esm/registry/module-artifact.schemas.d.ts +94 -0
  246. package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -0
  247. package/dist/esm/registry/module-artifact.schemas.js +69 -0
  248. package/dist/esm/registry/module-artifact.schemas.js.map +1 -0
  249. package/dist/esm/registry/module-manifest.schemas.d.ts +134 -0
  250. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -0
  251. package/dist/esm/registry/module-manifest.schemas.js +155 -0
  252. package/dist/esm/registry/module-manifest.schemas.js.map +1 -0
  253. package/dist/esm/registry/registry-config.schemas.d.ts +31 -0
  254. package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -0
  255. package/dist/esm/registry/registry-config.schemas.js +24 -0
  256. package/dist/esm/registry/registry-config.schemas.js.map +1 -0
  257. package/dist/esm/registry/registry-defaults.constants.d.ts +37 -0
  258. package/dist/esm/registry/registry-defaults.constants.d.ts.map +1 -0
  259. package/dist/esm/registry/registry-defaults.constants.js +37 -0
  260. package/dist/esm/registry/registry-defaults.constants.js.map +1 -0
  261. package/dist/esm/registry/registry-errors.d.ts +109 -0
  262. package/dist/esm/registry/registry-errors.d.ts.map +1 -0
  263. package/dist/esm/registry/registry-errors.js +185 -0
  264. package/dist/esm/registry/registry-errors.js.map +1 -0
  265. package/dist/esm/registry/registry-section-schemas.constants.d.ts +39 -0
  266. package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -0
  267. package/dist/esm/registry/registry-section-schemas.constants.js +22 -0
  268. package/dist/esm/registry/registry-section-schemas.constants.js.map +1 -0
  269. package/dist/esm/release/framework-release.constants.d.ts +26 -1
  270. package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
  271. package/dist/esm/release/framework-release.constants.js +27 -2
  272. package/dist/esm/release/framework-release.constants.js.map +1 -1
  273. package/dist/esm/schemas/framework-info.schemas.d.ts +1 -1
  274. package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
  275. package/dist/esm/schemas/framework-info.schemas.js +1 -1
  276. package/dist/esm/schemas/framework-info.schemas.js.map +1 -1
  277. package/dist/esm/schemas/framework-secrets.schemas.d.ts +5 -5
  278. package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
  279. package/dist/esm/schemas/framework-secrets.schemas.js +1 -1
  280. package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
  281. package/dist/esm/schemas/platform-application-config.schemas.d.ts +1 -1
  282. package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
  283. package/dist/esm/schemas/platform-application-config.schemas.js +11 -2
  284. package/dist/esm/schemas/platform-application-config.schemas.js.map +1 -1
  285. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts +7 -7
  286. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
  287. package/dist/esm/schemas/platform-application-secrets.schemas.js +17 -2
  288. package/dist/esm/schemas/platform-application-secrets.schemas.js.map +1 -1
  289. package/dist/esm/schemas/platform-config.schemas.d.ts +12 -13
  290. package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
  291. package/dist/esm/schemas/platform-config.schemas.js +15 -3
  292. package/dist/esm/schemas/platform-config.schemas.js.map +1 -1
  293. package/dist/esm/workspace-scope/application-subject-manifest.d.ts +26 -0
  294. package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -0
  295. package/dist/esm/workspace-scope/application-subject-manifest.js +43 -0
  296. package/dist/esm/workspace-scope/application-subject-manifest.js.map +1 -0
  297. package/dist/esm/workspace-scope/index.d.ts +5 -2
  298. package/dist/esm/workspace-scope/index.d.ts.map +1 -1
  299. package/dist/esm/workspace-scope/index.js +4 -1
  300. package/dist/esm/workspace-scope/index.js.map +1 -1
  301. package/dist/esm/workspace-scope/resolve-homes.d.ts +20 -0
  302. package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -0
  303. package/dist/esm/workspace-scope/resolve-homes.js +62 -0
  304. package/dist/esm/workspace-scope/resolve-homes.js.map +1 -0
  305. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts +211 -0
  306. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -0
  307. package/dist/esm/workspace-scope/workspace-homes.schemas.js +113 -0
  308. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -0
  309. package/dist/esm/workspace-scope/workspace-scope-detector.d.ts +10 -5
  310. package/dist/esm/workspace-scope/workspace-scope-detector.d.ts.map +1 -1
  311. package/dist/esm/workspace-scope/workspace-scope-detector.js +22 -36
  312. package/dist/esm/workspace-scope/workspace-scope-detector.js.map +1 -1
  313. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts +147 -58
  314. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
  315. package/dist/esm/workspace-scope/workspace-scope.schemas.js +174 -78
  316. package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
  317. package/dist/tsconfig.build.tsbuildinfo +1 -1
  318. package/package.json +31 -17
  319. package/dist/esm/credentials/credentials-provisioner.service.d.ts +0 -190
  320. package/dist/esm/credentials/credentials-provisioner.service.d.ts.map +0 -1
  321. package/dist/esm/credentials/credentials-provisioner.service.js +0 -278
  322. package/dist/esm/credentials/credentials-provisioner.service.js.map +0 -1
  323. package/dist/esm/infra-managers/infra-manager.models.d.ts +0 -146
  324. package/dist/esm/infra-managers/infra-manager.models.d.ts.map +0 -1
  325. package/dist/esm/infra-managers/infra-manager.models.js +0 -2
  326. package/dist/esm/infra-managers/infra-manager.models.js.map +0 -1
  327. package/dist/esm/infra-managers/mongo-atlas-manager.service.d.ts +0 -64
  328. package/dist/esm/infra-managers/mongo-atlas-manager.service.d.ts.map +0 -1
  329. package/dist/esm/infra-managers/mongo-atlas-manager.service.js +0 -307
  330. package/dist/esm/infra-managers/mongo-atlas-manager.service.js.map +0 -1
  331. package/dist/esm/infra-managers/postgresql-manager.service.d.ts +0 -115
  332. package/dist/esm/infra-managers/postgresql-manager.service.d.ts.map +0 -1
  333. package/dist/esm/infra-managers/postgresql-manager.service.js +0 -403
  334. package/dist/esm/infra-managers/postgresql-manager.service.js.map +0 -1
  335. package/dist/esm/infra-managers/rabbitmq-manager.service.d.ts +0 -64
  336. package/dist/esm/infra-managers/rabbitmq-manager.service.d.ts.map +0 -1
  337. package/dist/esm/infra-managers/rabbitmq-manager.service.js +0 -288
  338. package/dist/esm/infra-managers/rabbitmq-manager.service.js.map +0 -1
  339. package/dist/esm/infra-managers/redis-manager.service.d.ts +0 -78
  340. package/dist/esm/infra-managers/redis-manager.service.d.ts.map +0 -1
  341. package/dist/esm/infra-managers/redis-manager.service.js +0 -326
  342. package/dist/esm/infra-managers/redis-manager.service.js.map +0 -1
  343. package/dist/esm/project-config/define-infra-config.d.ts +0 -128
  344. package/dist/esm/project-config/define-infra-config.d.ts.map +0 -1
  345. package/dist/esm/project-config/define-infra-config.js +0 -87
  346. package/dist/esm/project-config/define-infra-config.js.map +0 -1
  347. package/dist/esm/project-config/define-platform-config.d.ts +0 -65
  348. package/dist/esm/project-config/define-platform-config.d.ts.map +0 -1
  349. package/dist/esm/project-config/define-platform-config.js +0 -22
  350. package/dist/esm/project-config/define-platform-config.js.map +0 -1
  351. package/dist/esm/project-config/define-platform-env-config.d.ts +0 -41
  352. package/dist/esm/project-config/define-platform-env-config.d.ts.map +0 -1
  353. package/dist/esm/project-config/define-platform-env-config.js +0 -45
  354. package/dist/esm/project-config/define-platform-env-config.js.map +0 -1
  355. package/dist/esm/project-config/define-project-config.d.ts +0 -38
  356. package/dist/esm/project-config/define-project-config.d.ts.map +0 -1
  357. package/dist/esm/project-config/define-project-config.js +0 -57
  358. package/dist/esm/project-config/define-project-config.js.map +0 -1
  359. package/dist/esm/project-config/define-sharing-policy.d.ts +0 -35
  360. package/dist/esm/project-config/define-sharing-policy.d.ts.map +0 -1
  361. package/dist/esm/project-config/define-sharing-policy.js +0 -30
  362. package/dist/esm/project-config/define-sharing-policy.js.map +0 -1
  363. package/dist/esm/project-config/sharing-policy-validation.d.ts +0 -40
  364. package/dist/esm/project-config/sharing-policy-validation.d.ts.map +0 -1
  365. package/dist/esm/project-config/sharing-policy-validation.js +0 -143
  366. package/dist/esm/project-config/sharing-policy-validation.js.map +0 -1
  367. package/dist/esm/runtime-bridge/platform-runtime-bridge.contracts.d.ts +0 -23
  368. package/dist/esm/runtime-bridge/platform-runtime-bridge.contracts.d.ts.map +0 -1
  369. package/dist/esm/runtime-bridge/platform-runtime-bridge.contracts.js +0 -13
  370. package/dist/esm/runtime-bridge/platform-runtime-bridge.contracts.js.map +0 -1
  371. package/src/bootstrap/application-backend-env.contracts.ts +0 -17
  372. package/src/bootstrap/bootstrap-planner.ts +0 -46
  373. package/src/bootstrap/bootstrap.contracts.ts +0 -251
  374. package/src/bootstrap/bootstrap.schemas.ts +0 -164
  375. package/src/bootstrap/platform-runtime-env.contracts.ts +0 -99
  376. package/src/bootstrap/runtime-topology.contracts.ts +0 -102
  377. package/src/credentials/credential-generator.service.ts +0 -39
  378. package/src/index.ts +0 -16
  379. package/src/project-config/__tests__/application-modules.utils.test.ts +0 -53
  380. package/src/project-config/__tests__/define-framework-config.test.ts +0 -43
  381. package/src/project-config/__tests__/define-saas-config.test.ts +0 -210
  382. package/src/project-config/__tests__/loader.test.ts +0 -100
  383. package/src/project-config/define-framework-config.ts +0 -44
  384. package/src/project-config/define-infra-config.ts +0 -168
  385. package/src/project-config/define-minion-config.ts +0 -27
  386. package/src/project-config/define-platform-config.ts +0 -28
  387. package/src/project-config/define-platform-env-config.ts +0 -59
  388. package/src/project-config/define-project-config.ts +0 -63
  389. package/src/project-config/define-saas-config.ts +0 -171
  390. package/src/project-config/define-sharing-policy.ts +0 -36
  391. package/src/project-config/define-worker-config.ts +0 -27
  392. package/src/project-config/index.ts +0 -23
  393. package/src/project-config/loader.ts +0 -220
  394. package/src/project-config/shared/application-modules.schemas.ts +0 -12
  395. package/src/project-config/shared/application-modules.utils.ts +0 -65
  396. package/src/project-config/shared/backing-services.schemas.ts +0 -59
  397. package/src/project-config/shared/data-services.schemas.ts +0 -58
  398. package/src/project-config/shared/env-example-defaults.ts +0 -50
  399. package/src/project-config/shared/environment.schemas.ts +0 -136
  400. package/src/project-config/shared/infrastructure-defaults.schemas.ts +0 -47
  401. package/src/project-config/shared/k8s-utils.ts +0 -56
  402. package/src/project-config/shared/platform-services.schemas.ts +0 -33
  403. package/src/project-config/shared/service-definitions.schemas.ts +0 -38
  404. package/src/project-config/sharing-policy-validation.ts +0 -159
  405. package/src/release/framework-release.constants.ts +0 -2
  406. package/src/schemas/__tests__/platform-config.schemas.test.ts +0 -90
  407. package/src/schemas/framework-info.schemas.ts +0 -13
  408. package/src/schemas/framework-secrets.schemas.ts +0 -19
  409. package/src/schemas/platform-application-config.schemas.ts +0 -25
  410. package/src/schemas/platform-application-secrets.schemas.ts +0 -78
  411. package/src/schemas/platform-config.schemas.ts +0 -45
  412. package/src/workspace-scope/index.ts +0 -2
  413. package/src/workspace-scope/workspace-scope-detector.ts +0 -98
  414. package/src/workspace-scope/workspace-scope.schemas.ts +0 -224
@@ -0,0 +1,266 @@
1
+ /**
2
+ * Content-Security-Policy authoring schema for per-frontend opt-in.
3
+ *
4
+ * # Where this fits in the three-layer CSP cake
5
+ *
6
+ * 1. Platform default — `./csp-defaults.ts` ships per-`AppFrontendType`
7
+ * baselines (`SAAS_APP`, `STATIC_WEBSITE`, `TECH_DOC`). The baseline
8
+ * is opinionated but conservative: `default-src 'self'` plus the
9
+ * narrowest set of relaxations each frontend kind genuinely needs
10
+ * to render (e.g., Docusaurus 3.x's `'unsafe-inline'` script /
11
+ * style requirement for `TECH_DOC`).
12
+ * 2. App-static — this `WildoCspConfigSchema`, authored on each
13
+ * service-definition's `csp?` field. `SAAS_APP` authors this on
14
+ * `wildo.saas.config.ts > services.<key>.csp`; `STATIC_WEBSITE` authors
15
+ * it on `wildo.website.config.ts`; `TECH_DOC` authors it on
16
+ * `wildo.tech-doc.config.ts`.
17
+ * 3. Env-specific — `EnvCspOverrideSchema` below, authored under
18
+ * `wildo.infra.<env>.config.ts.csp?[serviceKey]`. Slice B Step 2
19
+ * wires this layer into `WildoInfraEnvConfigSchema` itself. The first
20
+ * build-time consumer is `wildo dev sync-csp`, which reads
21
+ * `parsed.csp[serviceKey]` when emitting generated frontend CSP artifacts.
22
+ *
23
+ * # Resolution semantics (consumed by `platform-config-lib/src/project-config/shared/csp-emit.ts`)
24
+ *
25
+ * - `enabled: false` (default) => no policy emitted; the resolver
26
+ * returns `null` and both nginx + meta channels stay silent. The
27
+ * opt-in shape (vs opt-out) is deliberate — frontends that have not
28
+ * audited their third-party surface should not ship a half-baked
29
+ * CSP that breaks features without protecting anything.
30
+ * - `enabled: true` with no `directives` override => baseline emitted
31
+ * verbatim (see `./csp-defaults.ts`).
32
+ * - `enabled: true` with `directives` AND `mergeStrategy: 'extend-baseline'`
33
+ * (default) => per-directive ADDITIVE merge: each authored source
34
+ * list is concatenated to the baseline's source list for that
35
+ * directive (de-duplicated, baseline order preserved, app sources
36
+ * appended in author order). Directives the baseline doesn't ship
37
+ * are added wholesale.
38
+ * - `enabled: true` with `mergeStrategy: 'replace-baseline'` =>
39
+ * authored `directives` map REPLACES the baseline entirely; missing
40
+ * directives are simply absent from the policy. Use only when the
41
+ * baseline is fundamentally wrong for the surface (e.g., a
42
+ * `STATIC_WEBSITE` that actually serves an embedded SaaS app and
43
+ * wants the tighter `SAAS_APP`-style policy from scratch). The
44
+ * escape hatch exists; the merge default exists for the common
45
+ * case (additive tightening / loosening).
46
+ * - `reportOnly: true` => header name flips to
47
+ * `Content-Security-Policy-Report-Only` AND the `<meta http-equiv>`
48
+ * channel goes silent (browsers reject the report-only header via
49
+ * meta — W3C CSP3 §4.2.1). `reportOnly: false` (default once the
50
+ * pilot triages clean) emits the enforcing header AND the meta
51
+ * tag (with header-only directives stripped from the meta tag —
52
+ * see `META_INVALID_DIRECTIVES` in `csp-emit.ts`).
53
+ * - `reportUri` => header-only directive value (the meta tag would
54
+ * ignore it). The resolver feeds it to the nginx channel only.
55
+ *
56
+ * # Why the `directives` keys are an explicit closed set vs a free-form `Record<string, ...>`
57
+ *
58
+ * CSP grew organically over a decade and a half. The closed set below
59
+ * (`default-src` / `script-src` / `style-src` / `img-src` / `connect-src`
60
+ * / `font-src` / `frame-src` / `frame-ancestors` / `object-src` /
61
+ * `form-action` / `base-uri` / `manifest-src` / `media-src` / `worker-src`)
62
+ * covers every directive the platform's three frontend kinds genuinely
63
+ * use today. Forcing authors to spell directive names through the schema
64
+ * surface (vs `Record<string, string[]>`) catches typos at parse time
65
+ * (`script-source` !== `script-src`) and gives IDE autocompletion. Adding
66
+ * a new directive is a one-line schema edit when a real consumer asks
67
+ * for it; meanwhile the default-deny stance prevents authors from
68
+ * accidentally shipping a directive name the browser silently ignores.
69
+ *
70
+ * # Author-friendly source lists
71
+ *
72
+ * Each directive's value is `string[]`. The resolver does NOT validate
73
+ * the contents of the source list (that would require importing a CSP
74
+ * grammar — out of scope for this commit). Common shapes:
75
+ *
76
+ * - `"'self'"` — single-quoted keyword, MUST keep the quotes.
77
+ * - `'data:'`, `'blob:'` — scheme sources.
78
+ * - `'https://api.example.com'` — origin source.
79
+ * - `"'unsafe-inline'"`, `"'unsafe-eval'"` — single-quoted keywords.
80
+ * - `"'nonce-<base64>'"` — nonce keyword (rendered per-request).
81
+ * - `"'sha256-<hash>'"` — hash keyword.
82
+ *
83
+ * The `csp-emit.ts` serializer joins source lists with single spaces
84
+ * and separates directives with `; ` (no leading/trailing semicolon —
85
+ * matches Mozilla / OWASP recommended whitespace).
86
+ */
87
+ import { z } from 'zod';
88
+ /**
89
+ * Closed set of directive names we accept on the `csp.directives`
90
+ * authoring map. Adding a new directive name requires:
91
+ *
92
+ * 1. Adding the literal here.
93
+ * 2. Updating any per-`AppFrontendType` baseline that should ship the
94
+ * directive by default in `./csp-defaults.ts`.
95
+ * 3. Verifying the `csp-emit.ts` serializer handles the directive
96
+ * (it does — the serializer is generic over directive names — so
97
+ * step 3 is usually a no-op).
98
+ *
99
+ * The `META_INVALID_DIRECTIVES` set in `csp-emit.ts` lists the
100
+ * directives the browser ignores when emitted via `<meta http-equiv>`
101
+ * (`frame-ancestors`, `report-uri`, `report-to`, `sandbox`); they're
102
+ * stripped from the meta-channel output but remain on the nginx
103
+ * channel. Keep that set in sync if a new header-only directive lands
104
+ * here.
105
+ */
106
+ export declare const CSP_DIRECTIVE_NAMES: readonly ["default-src", "script-src", "style-src", "img-src", "connect-src", "font-src", "frame-src", "frame-ancestors", "object-src", "form-action", "base-uri", "manifest-src", "media-src", "worker-src"];
107
+ export type CspDirectiveName = (typeof CSP_DIRECTIVE_NAMES)[number];
108
+ /**
109
+ * Author-side merge strategy for the app-static layer over the baseline.
110
+ *
111
+ * - `'extend-baseline'` (default) — per-directive ADDITIVE merge:
112
+ * each authored source list is APPENDED to the baseline source
113
+ * list for that directive. Directives the baseline doesn't ship
114
+ * are added wholesale. Common case: an app needs to add ONE extra
115
+ * `connect-src` origin without re-authoring the rest of the policy.
116
+ * - `'replace-baseline'` — authored `directives` map REPLACES the
117
+ * baseline entirely. Use when the baseline is fundamentally wrong
118
+ * for the surface (e.g., a tighter or fundamentally different
119
+ * posture). Escape hatch — the merge default is the right answer
120
+ * in 95% of cases.
121
+ */
122
+ export declare enum CspMergeStrategy {
123
+ EXTEND_BASELINE = "extend-baseline",
124
+ REPLACE_BASELINE = "replace-baseline"
125
+ }
126
+ /**
127
+ * Author-side directive overrides — partial map keyed by the closed
128
+ * directive-name set above. Each value is a source list of strings
129
+ * (joined with single spaces by the serializer).
130
+ *
131
+ * Authoring `directives: { 'connect-src': ['https://api.example.com'] }`
132
+ * with the default `'extend-baseline'` strategy APPENDS that origin to
133
+ * the baseline `connect-src` source list (which already contains
134
+ * `'self'` for every baseline) — it does NOT replace the baseline's
135
+ * `connect-src`. Use `mergeStrategy: 'replace-baseline'` to opt out of
136
+ * additive merging.
137
+ */
138
+ export declare const CspDirectivesOverrideSchema: z.ZodObject<Record<"default-src" | "script-src" | "style-src" | "img-src" | "connect-src" | "font-src" | "frame-src" | "frame-ancestors" | "object-src" | "form-action" | "base-uri" | "manifest-src" | "media-src" | "worker-src", z.ZodOptional<z.ZodArray<z.ZodString>>>, z.core.$strict>;
139
+ export type CspDirectivesOverride = z.infer<typeof CspDirectivesOverrideSchema>;
140
+ /**
141
+ * Per-frontend CSP block. Authored on each service-definition's `csp?`
142
+ * field (today: `wildo.tech-doc.config.ts.csp?`; the `SAAS_APP` and
143
+ * `STATIC_WEBSITE` surfaces wire the same shape under Slice B B-Step 4 + 5).
144
+ *
145
+ * Opt-in by default: `enabled: false` (or omitting the block entirely)
146
+ * emits NO policy on either channel. Frontends that have not audited
147
+ * their third-party JS / fetch surface should not ship a half-baked
148
+ * CSP that breaks features without protecting anything.
149
+ *
150
+ * `z.strictObject` (Zod 4) is intentional — typos like `enable: true`
151
+ * (no `d`) or `directive: { … }` (no plural) MUST surface as parse
152
+ * errors, not silently strip to `enabled: false` (i.e. CSP off, the
153
+ * worst possible default). Same framework-mindset enforcement as
154
+ * `WildoAuthConfigSchema`.
155
+ */
156
+ export declare const WildoCspConfigSchema: z.ZodObject<{
157
+ /**
158
+ * Opt-in switch. `false` (default) => no policy emitted; the
159
+ * resolver returns `null`. `true` => baseline (+ overrides) emitted
160
+ * on both channels per `reportOnly`.
161
+ */
162
+ enabled: z.ZodDefault<z.ZodBoolean>;
163
+ /**
164
+ * `true` => header name flips to `Content-Security-Policy-Report-Only`
165
+ * AND the `<meta http-equiv>` channel goes silent (browsers reject the
166
+ * report-only header via meta — W3C CSP3 §4.2.1). Use during the
167
+ * pilot to triage console-surfaced violations without breaking real
168
+ * traffic. Flip to `false` once the directive overrides settle.
169
+ *
170
+ * Default: `false` (enforcing). Authors opting into CSP for the first
171
+ * time SHOULD set `reportOnly: true` for the first PR; the schema
172
+ * default is intentionally enforcing so the steady state (post-pilot)
173
+ * doesn't require a per-app authored `reportOnly: false`.
174
+ */
175
+ reportOnly: z.ZodDefault<z.ZodBoolean>;
176
+ /**
177
+ * Merge strategy for authored `directives` over the baseline. Default:
178
+ * `'extend-baseline'` (per-directive additive merge — see
179
+ * `CspMergeStrategy`).
180
+ */
181
+ mergeStrategy: z.ZodDefault<z.ZodEnum<typeof CspMergeStrategy>>;
182
+ /**
183
+ * Per-directive overrides, keyed by directive name. Default: empty
184
+ * map (baseline emitted verbatim).
185
+ */
186
+ directives: z.ZodDefault<z.ZodObject<Record<"default-src" | "script-src" | "style-src" | "img-src" | "connect-src" | "font-src" | "frame-src" | "frame-ancestors" | "object-src" | "form-action" | "base-uri" | "manifest-src" | "media-src" | "worker-src", z.ZodOptional<z.ZodArray<z.ZodString>>>, z.core.$strict>>;
187
+ /**
188
+ * Optional `report-uri` directive value (header-only — meta tag
189
+ * ignores it; the resolver feeds it to the nginx channel only).
190
+ * No `report-to` field today — `report-to` requires the parallel
191
+ * Reporting API endpoint config which the platform doesn't ship; add
192
+ * when the violation-collector lands (`auth-hardening.md` "Cheap
193
+ * Bonuses — CSP violation monitoring endpoint").
194
+ */
195
+ reportUri: z.ZodOptional<z.ZodString>;
196
+ }, z.core.$strict>;
197
+ export type WildoCspConfig = z.infer<typeof WildoCspConfigSchema>;
198
+ export type WildoCspConfigInput = z.input<typeof WildoCspConfigSchema>;
199
+ /**
200
+ * Env-specific overrides — authored under
201
+ * `wildo.infra.<env>.config.ts.csp?[serviceKey]`. The loader merges
202
+ * these on top of the app-static layer (which itself is on top of the
203
+ * baseline).
204
+ *
205
+ * Slice B Step 2 wires this layer into `WildoInfraEnvConfigSchema`
206
+ * (out-of-scope for this commit — the schema is shipped here so the
207
+ * resolver in `csp-emit.ts` already accepts the shape it will consume).
208
+ *
209
+ * `extraDirectives` is ADDITIVE only — env-layer entries are APPENDED
210
+ * to whatever the app-static layer produced for that directive. There
211
+ * is no `'replace-baseline'`-equivalent at the env layer because env
212
+ * config exists to LOOSEN policies for specific deployments (Sentry
213
+ * origin in staging, dev hot-reload `'unsafe-eval'`), not to replace
214
+ * an app's chosen posture. If an env genuinely needs a different
215
+ * posture the right answer is to fix the app-static layer.
216
+ */
217
+ export declare const EnvCspOverrideSchema: z.ZodObject<{
218
+ /**
219
+ * Per-directive ADDITIVE merge. Each entry's source list is
220
+ * APPENDED to the app-static layer's source list for that directive
221
+ * (de-duplicated, app order preserved, env sources appended in
222
+ * author order). No replace semantics at this layer.
223
+ */
224
+ extraDirectives: z.ZodDefault<z.ZodObject<Record<"default-src" | "script-src" | "style-src" | "img-src" | "connect-src" | "font-src" | "frame-src" | "frame-ancestors" | "object-src" | "form-action" | "base-uri" | "manifest-src" | "media-src" | "worker-src", z.ZodOptional<z.ZodArray<z.ZodString>>>, z.core.$strict>>;
225
+ /**
226
+ * Vite dev-mode CSP loosening: adds BOTH `'unsafe-inline'` and
227
+ * `'unsafe-eval'` to `script-src`. Vite's dev server injects an
228
+ * inline `<script>` for the HMR client bootstrap AND uses `eval()`
229
+ * for lazy module / sourcemap transforms — both block under a strict
230
+ * `script-src 'self'` policy and produce ~120+ CSP violations per
231
+ * page load. Production Vite builds emit `<script type="module">`
232
+ * only and use no `eval()`, so this loosening is dev-only by design.
233
+ *
234
+ * AUTO-DEFAULT: `true` when the resolved env id is `'local'` AND the
235
+ * frontend type is `SAAS_APP` (the only Vite-bundled frontend kind in
236
+ * the framework). The framework applies the loosening automatically so
237
+ * every Wildo app gets a clean dev console without per-app
238
+ * configuration; opting in app-by-app would scatter the same
239
+ * framework-shipped Vite knowledge across N infrastructure files.
240
+ *
241
+ * EXPLICIT OPT-OUT: set to `false` to keep tight `script-src` in
242
+ * local dev. Useful only when actively debugging a real CSP issue
243
+ * and willing to accept Vite-induced noise. Production envs ignore
244
+ * this flag's auto-default and require explicit opt-in (extremely
245
+ * unusual — a production app that needs `'unsafe-inline'` /
246
+ * `'unsafe-eval'` is almost always a sign of a misconfigured asset
247
+ * pipeline).
248
+ */
249
+ viteDevLoosening: z.ZodOptional<z.ZodBoolean>;
250
+ /**
251
+ * Env-layer override of the app-static `reportOnly` flag. When
252
+ * present (not `undefined`), takes precedence over the app-static
253
+ * value. Common shape: app-static ships `reportOnly: false`
254
+ * (enforcing in prod), env-layer flips to `reportOnly: true` for
255
+ * staging while the violation collector ramps up.
256
+ */
257
+ reportOnly: z.ZodOptional<z.ZodBoolean>;
258
+ /**
259
+ * Env-layer override of the app-static `reportUri` (e.g., per-env
260
+ * collector endpoint).
261
+ */
262
+ reportUri: z.ZodOptional<z.ZodString>;
263
+ }, z.core.$strict>;
264
+ export type EnvCspOverride = z.infer<typeof EnvCspOverrideSchema>;
265
+ export type EnvCspOverrideInput = z.input<typeof EnvCspOverrideSchema>;
266
+ //# sourceMappingURL=csp.schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csp.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/csp.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mBAAmB,+MAetB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE;;;;;;;;;;;;;GAaG;AACH,oBAAY,gBAAgB;IAC1B,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;CACtC;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,8RAOvC,CAAC;AACF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;OAIG;;IAEH;;;;;;;;;;;OAWG;;IAEH;;;;OAIG;;IAIH;;;OAGG;;IAEH;;;;;;;OAOG;;kBAEH,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEvE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;;OAKG;;IAEH;;;;;;;;;;;;;;;;;;;;;;;OAuBG;;IAEH;;;;;;OAMG;;IAEH;;;OAGG;;kBAEH,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,281 @@
1
+ /**
2
+ * Content-Security-Policy authoring schema for per-frontend opt-in.
3
+ *
4
+ * # Where this fits in the three-layer CSP cake
5
+ *
6
+ * 1. Platform default — `./csp-defaults.ts` ships per-`AppFrontendType`
7
+ * baselines (`SAAS_APP`, `STATIC_WEBSITE`, `TECH_DOC`). The baseline
8
+ * is opinionated but conservative: `default-src 'self'` plus the
9
+ * narrowest set of relaxations each frontend kind genuinely needs
10
+ * to render (e.g., Docusaurus 3.x's `'unsafe-inline'` script /
11
+ * style requirement for `TECH_DOC`).
12
+ * 2. App-static — this `WildoCspConfigSchema`, authored on each
13
+ * service-definition's `csp?` field. `SAAS_APP` authors this on
14
+ * `wildo.saas.config.ts > services.<key>.csp`; `STATIC_WEBSITE` authors
15
+ * it on `wildo.website.config.ts`; `TECH_DOC` authors it on
16
+ * `wildo.tech-doc.config.ts`.
17
+ * 3. Env-specific — `EnvCspOverrideSchema` below, authored under
18
+ * `wildo.infra.<env>.config.ts.csp?[serviceKey]`. Slice B Step 2
19
+ * wires this layer into `WildoInfraEnvConfigSchema` itself. The first
20
+ * build-time consumer is `wildo dev sync-csp`, which reads
21
+ * `parsed.csp[serviceKey]` when emitting generated frontend CSP artifacts.
22
+ *
23
+ * # Resolution semantics (consumed by `platform-config-lib/src/project-config/shared/csp-emit.ts`)
24
+ *
25
+ * - `enabled: false` (default) => no policy emitted; the resolver
26
+ * returns `null` and both nginx + meta channels stay silent. The
27
+ * opt-in shape (vs opt-out) is deliberate — frontends that have not
28
+ * audited their third-party surface should not ship a half-baked
29
+ * CSP that breaks features without protecting anything.
30
+ * - `enabled: true` with no `directives` override => baseline emitted
31
+ * verbatim (see `./csp-defaults.ts`).
32
+ * - `enabled: true` with `directives` AND `mergeStrategy: 'extend-baseline'`
33
+ * (default) => per-directive ADDITIVE merge: each authored source
34
+ * list is concatenated to the baseline's source list for that
35
+ * directive (de-duplicated, baseline order preserved, app sources
36
+ * appended in author order). Directives the baseline doesn't ship
37
+ * are added wholesale.
38
+ * - `enabled: true` with `mergeStrategy: 'replace-baseline'` =>
39
+ * authored `directives` map REPLACES the baseline entirely; missing
40
+ * directives are simply absent from the policy. Use only when the
41
+ * baseline is fundamentally wrong for the surface (e.g., a
42
+ * `STATIC_WEBSITE` that actually serves an embedded SaaS app and
43
+ * wants the tighter `SAAS_APP`-style policy from scratch). The
44
+ * escape hatch exists; the merge default exists for the common
45
+ * case (additive tightening / loosening).
46
+ * - `reportOnly: true` => header name flips to
47
+ * `Content-Security-Policy-Report-Only` AND the `<meta http-equiv>`
48
+ * channel goes silent (browsers reject the report-only header via
49
+ * meta — W3C CSP3 §4.2.1). `reportOnly: false` (default once the
50
+ * pilot triages clean) emits the enforcing header AND the meta
51
+ * tag (with header-only directives stripped from the meta tag —
52
+ * see `META_INVALID_DIRECTIVES` in `csp-emit.ts`).
53
+ * - `reportUri` => header-only directive value (the meta tag would
54
+ * ignore it). The resolver feeds it to the nginx channel only.
55
+ *
56
+ * # Why the `directives` keys are an explicit closed set vs a free-form `Record<string, ...>`
57
+ *
58
+ * CSP grew organically over a decade and a half. The closed set below
59
+ * (`default-src` / `script-src` / `style-src` / `img-src` / `connect-src`
60
+ * / `font-src` / `frame-src` / `frame-ancestors` / `object-src` /
61
+ * `form-action` / `base-uri` / `manifest-src` / `media-src` / `worker-src`)
62
+ * covers every directive the platform's three frontend kinds genuinely
63
+ * use today. Forcing authors to spell directive names through the schema
64
+ * surface (vs `Record<string, string[]>`) catches typos at parse time
65
+ * (`script-source` !== `script-src`) and gives IDE autocompletion. Adding
66
+ * a new directive is a one-line schema edit when a real consumer asks
67
+ * for it; meanwhile the default-deny stance prevents authors from
68
+ * accidentally shipping a directive name the browser silently ignores.
69
+ *
70
+ * # Author-friendly source lists
71
+ *
72
+ * Each directive's value is `string[]`. The resolver does NOT validate
73
+ * the contents of the source list (that would require importing a CSP
74
+ * grammar — out of scope for this commit). Common shapes:
75
+ *
76
+ * - `"'self'"` — single-quoted keyword, MUST keep the quotes.
77
+ * - `'data:'`, `'blob:'` — scheme sources.
78
+ * - `'https://api.example.com'` — origin source.
79
+ * - `"'unsafe-inline'"`, `"'unsafe-eval'"` — single-quoted keywords.
80
+ * - `"'nonce-<base64>'"` — nonce keyword (rendered per-request).
81
+ * - `"'sha256-<hash>'"` — hash keyword.
82
+ *
83
+ * The `csp-emit.ts` serializer joins source lists with single spaces
84
+ * and separates directives with `; ` (no leading/trailing semicolon —
85
+ * matches Mozilla / OWASP recommended whitespace).
86
+ */
87
+ import { z } from 'zod';
88
+ /**
89
+ * Closed set of directive names we accept on the `csp.directives`
90
+ * authoring map. Adding a new directive name requires:
91
+ *
92
+ * 1. Adding the literal here.
93
+ * 2. Updating any per-`AppFrontendType` baseline that should ship the
94
+ * directive by default in `./csp-defaults.ts`.
95
+ * 3. Verifying the `csp-emit.ts` serializer handles the directive
96
+ * (it does — the serializer is generic over directive names — so
97
+ * step 3 is usually a no-op).
98
+ *
99
+ * The `META_INVALID_DIRECTIVES` set in `csp-emit.ts` lists the
100
+ * directives the browser ignores when emitted via `<meta http-equiv>`
101
+ * (`frame-ancestors`, `report-uri`, `report-to`, `sandbox`); they're
102
+ * stripped from the meta-channel output but remain on the nginx
103
+ * channel. Keep that set in sync if a new header-only directive lands
104
+ * here.
105
+ */
106
+ export const CSP_DIRECTIVE_NAMES = [
107
+ 'default-src',
108
+ 'script-src',
109
+ 'style-src',
110
+ 'img-src',
111
+ 'connect-src',
112
+ 'font-src',
113
+ 'frame-src',
114
+ 'frame-ancestors',
115
+ 'object-src',
116
+ 'form-action',
117
+ 'base-uri',
118
+ 'manifest-src',
119
+ 'media-src',
120
+ 'worker-src',
121
+ ];
122
+ /**
123
+ * Author-side merge strategy for the app-static layer over the baseline.
124
+ *
125
+ * - `'extend-baseline'` (default) — per-directive ADDITIVE merge:
126
+ * each authored source list is APPENDED to the baseline source
127
+ * list for that directive. Directives the baseline doesn't ship
128
+ * are added wholesale. Common case: an app needs to add ONE extra
129
+ * `connect-src` origin without re-authoring the rest of the policy.
130
+ * - `'replace-baseline'` — authored `directives` map REPLACES the
131
+ * baseline entirely. Use when the baseline is fundamentally wrong
132
+ * for the surface (e.g., a tighter or fundamentally different
133
+ * posture). Escape hatch — the merge default is the right answer
134
+ * in 95% of cases.
135
+ */
136
+ export var CspMergeStrategy;
137
+ (function (CspMergeStrategy) {
138
+ CspMergeStrategy["EXTEND_BASELINE"] = "extend-baseline";
139
+ CspMergeStrategy["REPLACE_BASELINE"] = "replace-baseline";
140
+ })(CspMergeStrategy || (CspMergeStrategy = {}));
141
+ /**
142
+ * Author-side directive overrides — partial map keyed by the closed
143
+ * directive-name set above. Each value is a source list of strings
144
+ * (joined with single spaces by the serializer).
145
+ *
146
+ * Authoring `directives: { 'connect-src': ['https://api.example.com'] }`
147
+ * with the default `'extend-baseline'` strategy APPENDS that origin to
148
+ * the baseline `connect-src` source list (which already contains
149
+ * `'self'` for every baseline) — it does NOT replace the baseline's
150
+ * `connect-src`. Use `mergeStrategy: 'replace-baseline'` to opt out of
151
+ * additive merging.
152
+ */
153
+ export const CspDirectivesOverrideSchema = z.strictObject(Object.fromEntries(CSP_DIRECTIVE_NAMES.map((name) => [
154
+ name,
155
+ z.array(z.string().min(1)).optional(),
156
+ ])));
157
+ /**
158
+ * Per-frontend CSP block. Authored on each service-definition's `csp?`
159
+ * field (today: `wildo.tech-doc.config.ts.csp?`; the `SAAS_APP` and
160
+ * `STATIC_WEBSITE` surfaces wire the same shape under Slice B B-Step 4 + 5).
161
+ *
162
+ * Opt-in by default: `enabled: false` (or omitting the block entirely)
163
+ * emits NO policy on either channel. Frontends that have not audited
164
+ * their third-party JS / fetch surface should not ship a half-baked
165
+ * CSP that breaks features without protecting anything.
166
+ *
167
+ * `z.strictObject` (Zod 4) is intentional — typos like `enable: true`
168
+ * (no `d`) or `directive: { … }` (no plural) MUST surface as parse
169
+ * errors, not silently strip to `enabled: false` (i.e. CSP off, the
170
+ * worst possible default). Same framework-mindset enforcement as
171
+ * `WildoAuthConfigSchema`.
172
+ */
173
+ export const WildoCspConfigSchema = z.strictObject({
174
+ /**
175
+ * Opt-in switch. `false` (default) => no policy emitted; the
176
+ * resolver returns `null`. `true` => baseline (+ overrides) emitted
177
+ * on both channels per `reportOnly`.
178
+ */
179
+ enabled: z.boolean().default(false),
180
+ /**
181
+ * `true` => header name flips to `Content-Security-Policy-Report-Only`
182
+ * AND the `<meta http-equiv>` channel goes silent (browsers reject the
183
+ * report-only header via meta — W3C CSP3 §4.2.1). Use during the
184
+ * pilot to triage console-surfaced violations without breaking real
185
+ * traffic. Flip to `false` once the directive overrides settle.
186
+ *
187
+ * Default: `false` (enforcing). Authors opting into CSP for the first
188
+ * time SHOULD set `reportOnly: true` for the first PR; the schema
189
+ * default is intentionally enforcing so the steady state (post-pilot)
190
+ * doesn't require a per-app authored `reportOnly: false`.
191
+ */
192
+ reportOnly: z.boolean().default(false),
193
+ /**
194
+ * Merge strategy for authored `directives` over the baseline. Default:
195
+ * `'extend-baseline'` (per-directive additive merge — see
196
+ * `CspMergeStrategy`).
197
+ */
198
+ mergeStrategy: z
199
+ .enum(CspMergeStrategy)
200
+ .default(CspMergeStrategy.EXTEND_BASELINE),
201
+ /**
202
+ * Per-directive overrides, keyed by directive name. Default: empty
203
+ * map (baseline emitted verbatim).
204
+ */
205
+ directives: CspDirectivesOverrideSchema.default({}),
206
+ /**
207
+ * Optional `report-uri` directive value (header-only — meta tag
208
+ * ignores it; the resolver feeds it to the nginx channel only).
209
+ * No `report-to` field today — `report-to` requires the parallel
210
+ * Reporting API endpoint config which the platform doesn't ship; add
211
+ * when the violation-collector lands (`auth-hardening.md` "Cheap
212
+ * Bonuses — CSP violation monitoring endpoint").
213
+ */
214
+ reportUri: z.string().min(1).optional(),
215
+ });
216
+ /**
217
+ * Env-specific overrides — authored under
218
+ * `wildo.infra.<env>.config.ts.csp?[serviceKey]`. The loader merges
219
+ * these on top of the app-static layer (which itself is on top of the
220
+ * baseline).
221
+ *
222
+ * Slice B Step 2 wires this layer into `WildoInfraEnvConfigSchema`
223
+ * (out-of-scope for this commit — the schema is shipped here so the
224
+ * resolver in `csp-emit.ts` already accepts the shape it will consume).
225
+ *
226
+ * `extraDirectives` is ADDITIVE only — env-layer entries are APPENDED
227
+ * to whatever the app-static layer produced for that directive. There
228
+ * is no `'replace-baseline'`-equivalent at the env layer because env
229
+ * config exists to LOOSEN policies for specific deployments (Sentry
230
+ * origin in staging, dev hot-reload `'unsafe-eval'`), not to replace
231
+ * an app's chosen posture. If an env genuinely needs a different
232
+ * posture the right answer is to fix the app-static layer.
233
+ */
234
+ export const EnvCspOverrideSchema = z.strictObject({
235
+ /**
236
+ * Per-directive ADDITIVE merge. Each entry's source list is
237
+ * APPENDED to the app-static layer's source list for that directive
238
+ * (de-duplicated, app order preserved, env sources appended in
239
+ * author order). No replace semantics at this layer.
240
+ */
241
+ extraDirectives: CspDirectivesOverrideSchema.default({}),
242
+ /**
243
+ * Vite dev-mode CSP loosening: adds BOTH `'unsafe-inline'` and
244
+ * `'unsafe-eval'` to `script-src`. Vite's dev server injects an
245
+ * inline `<script>` for the HMR client bootstrap AND uses `eval()`
246
+ * for lazy module / sourcemap transforms — both block under a strict
247
+ * `script-src 'self'` policy and produce ~120+ CSP violations per
248
+ * page load. Production Vite builds emit `<script type="module">`
249
+ * only and use no `eval()`, so this loosening is dev-only by design.
250
+ *
251
+ * AUTO-DEFAULT: `true` when the resolved env id is `'local'` AND the
252
+ * frontend type is `SAAS_APP` (the only Vite-bundled frontend kind in
253
+ * the framework). The framework applies the loosening automatically so
254
+ * every Wildo app gets a clean dev console without per-app
255
+ * configuration; opting in app-by-app would scatter the same
256
+ * framework-shipped Vite knowledge across N infrastructure files.
257
+ *
258
+ * EXPLICIT OPT-OUT: set to `false` to keep tight `script-src` in
259
+ * local dev. Useful only when actively debugging a real CSP issue
260
+ * and willing to accept Vite-induced noise. Production envs ignore
261
+ * this flag's auto-default and require explicit opt-in (extremely
262
+ * unusual — a production app that needs `'unsafe-inline'` /
263
+ * `'unsafe-eval'` is almost always a sign of a misconfigured asset
264
+ * pipeline).
265
+ */
266
+ viteDevLoosening: z.boolean().optional(),
267
+ /**
268
+ * Env-layer override of the app-static `reportOnly` flag. When
269
+ * present (not `undefined`), takes precedence over the app-static
270
+ * value. Common shape: app-static ships `reportOnly: false`
271
+ * (enforcing in prod), env-layer flips to `reportOnly: true` for
272
+ * staging while the violation collector ramps up.
273
+ */
274
+ reportOnly: z.boolean().optional(),
275
+ /**
276
+ * Env-layer override of the app-static `reportUri` (e.g., per-env
277
+ * collector endpoint).
278
+ */
279
+ reportUri: z.string().min(1).optional(),
280
+ });
281
+ //# sourceMappingURL=csp.schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csp.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/csp.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,aAAa;IACb,YAAY;IACZ,WAAW;IACX,SAAS;IACT,aAAa;IACb,UAAU;IACV,WAAW;IACX,iBAAiB;IACjB,YAAY;IACZ,aAAa;IACb,UAAU;IACV,cAAc;IACd,WAAW;IACX,YAAY;CACJ,CAAC;AAIX;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,uDAAmC,CAAA;IACnC,yDAAqC,CAAA;AACvC,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,YAAY,CACvD,MAAM,CAAC,WAAW,CAChB,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;IAChC,IAAI;IACJ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACtC,CAAC,CACiE,CACtE,CAAC;AAGF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,YAAY,CAAC;IACjD;;;;OAIG;IACH,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACnC;;;;;;;;;;;OAWG;IACH,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACtC;;;;OAIG;IACH,aAAa,EAAE,CAAC;SACb,IAAI,CAAC,gBAAgB,CAAC;SACtB,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC;IAC5C;;;OAGG;IACH,UAAU,EAAE,2BAA2B,CAAC,OAAO,CAAC,EAAE,CAAC;IACnD;;;;;;;OAOG;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAIH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,YAAY,CAAC;IACjD;;;;;OAKG;IACH,eAAe,EAAE,2BAA2B,CAAC,OAAO,CAAC,EAAE,CAAC;IACxD;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACxC;;;;;;OAMG;IACH,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAClC;;;OAGG;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC","sourcesContent":["/**\n * Content-Security-Policy authoring schema for per-frontend opt-in.\n *\n * # Where this fits in the three-layer CSP cake\n *\n * 1. Platform default — `./csp-defaults.ts` ships per-`AppFrontendType`\n * baselines (`SAAS_APP`, `STATIC_WEBSITE`, `TECH_DOC`). The baseline\n * is opinionated but conservative: `default-src 'self'` plus the\n * narrowest set of relaxations each frontend kind genuinely needs\n * to render (e.g., Docusaurus 3.x's `'unsafe-inline'` script /\n * style requirement for `TECH_DOC`).\n * 2. App-static — this `WildoCspConfigSchema`, authored on each\n * service-definition's `csp?` field. `SAAS_APP` authors this on\n * `wildo.saas.config.ts > services.<key>.csp`; `STATIC_WEBSITE` authors\n * it on `wildo.website.config.ts`; `TECH_DOC` authors it on\n * `wildo.tech-doc.config.ts`.\n * 3. Env-specific — `EnvCspOverrideSchema` below, authored under\n * `wildo.infra.<env>.config.ts.csp?[serviceKey]`. Slice B Step 2\n * wires this layer into `WildoInfraEnvConfigSchema` itself. The first\n * build-time consumer is `wildo dev sync-csp`, which reads\n * `parsed.csp[serviceKey]` when emitting generated frontend CSP artifacts.\n *\n * # Resolution semantics (consumed by `platform-config-lib/src/project-config/shared/csp-emit.ts`)\n *\n * - `enabled: false` (default) => no policy emitted; the resolver\n * returns `null` and both nginx + meta channels stay silent. The\n * opt-in shape (vs opt-out) is deliberate — frontends that have not\n * audited their third-party surface should not ship a half-baked\n * CSP that breaks features without protecting anything.\n * - `enabled: true` with no `directives` override => baseline emitted\n * verbatim (see `./csp-defaults.ts`).\n * - `enabled: true` with `directives` AND `mergeStrategy: 'extend-baseline'`\n * (default) => per-directive ADDITIVE merge: each authored source\n * list is concatenated to the baseline's source list for that\n * directive (de-duplicated, baseline order preserved, app sources\n * appended in author order). Directives the baseline doesn't ship\n * are added wholesale.\n * - `enabled: true` with `mergeStrategy: 'replace-baseline'` =>\n * authored `directives` map REPLACES the baseline entirely; missing\n * directives are simply absent from the policy. Use only when the\n * baseline is fundamentally wrong for the surface (e.g., a\n * `STATIC_WEBSITE` that actually serves an embedded SaaS app and\n * wants the tighter `SAAS_APP`-style policy from scratch). The\n * escape hatch exists; the merge default exists for the common\n * case (additive tightening / loosening).\n * - `reportOnly: true` => header name flips to\n * `Content-Security-Policy-Report-Only` AND the `<meta http-equiv>`\n * channel goes silent (browsers reject the report-only header via\n * meta — W3C CSP3 §4.2.1). `reportOnly: false` (default once the\n * pilot triages clean) emits the enforcing header AND the meta\n * tag (with header-only directives stripped from the meta tag —\n * see `META_INVALID_DIRECTIVES` in `csp-emit.ts`).\n * - `reportUri` => header-only directive value (the meta tag would\n * ignore it). The resolver feeds it to the nginx channel only.\n *\n * # Why the `directives` keys are an explicit closed set vs a free-form `Record<string, ...>`\n *\n * CSP grew organically over a decade and a half. The closed set below\n * (`default-src` / `script-src` / `style-src` / `img-src` / `connect-src`\n * / `font-src` / `frame-src` / `frame-ancestors` / `object-src` /\n * `form-action` / `base-uri` / `manifest-src` / `media-src` / `worker-src`)\n * covers every directive the platform's three frontend kinds genuinely\n * use today. Forcing authors to spell directive names through the schema\n * surface (vs `Record<string, string[]>`) catches typos at parse time\n * (`script-source` !== `script-src`) and gives IDE autocompletion. Adding\n * a new directive is a one-line schema edit when a real consumer asks\n * for it; meanwhile the default-deny stance prevents authors from\n * accidentally shipping a directive name the browser silently ignores.\n *\n * # Author-friendly source lists\n *\n * Each directive's value is `string[]`. The resolver does NOT validate\n * the contents of the source list (that would require importing a CSP\n * grammar — out of scope for this commit). Common shapes:\n *\n * - `\"'self'\"` — single-quoted keyword, MUST keep the quotes.\n * - `'data:'`, `'blob:'` — scheme sources.\n * - `'https://api.example.com'` — origin source.\n * - `\"'unsafe-inline'\"`, `\"'unsafe-eval'\"` — single-quoted keywords.\n * - `\"'nonce-<base64>'\"` — nonce keyword (rendered per-request).\n * - `\"'sha256-<hash>'\"` — hash keyword.\n *\n * The `csp-emit.ts` serializer joins source lists with single spaces\n * and separates directives with `; ` (no leading/trailing semicolon —\n * matches Mozilla / OWASP recommended whitespace).\n */\n\nimport { z } from 'zod';\n\n/**\n * Closed set of directive names we accept on the `csp.directives`\n * authoring map. Adding a new directive name requires:\n *\n * 1. Adding the literal here.\n * 2. Updating any per-`AppFrontendType` baseline that should ship the\n * directive by default in `./csp-defaults.ts`.\n * 3. Verifying the `csp-emit.ts` serializer handles the directive\n * (it does — the serializer is generic over directive names — so\n * step 3 is usually a no-op).\n *\n * The `META_INVALID_DIRECTIVES` set in `csp-emit.ts` lists the\n * directives the browser ignores when emitted via `<meta http-equiv>`\n * (`frame-ancestors`, `report-uri`, `report-to`, `sandbox`); they're\n * stripped from the meta-channel output but remain on the nginx\n * channel. Keep that set in sync if a new header-only directive lands\n * here.\n */\nexport const CSP_DIRECTIVE_NAMES = [\n 'default-src',\n 'script-src',\n 'style-src',\n 'img-src',\n 'connect-src',\n 'font-src',\n 'frame-src',\n 'frame-ancestors',\n 'object-src',\n 'form-action',\n 'base-uri',\n 'manifest-src',\n 'media-src',\n 'worker-src',\n] as const;\n\nexport type CspDirectiveName = (typeof CSP_DIRECTIVE_NAMES)[number];\n\n/**\n * Author-side merge strategy for the app-static layer over the baseline.\n *\n * - `'extend-baseline'` (default) — per-directive ADDITIVE merge:\n * each authored source list is APPENDED to the baseline source\n * list for that directive. Directives the baseline doesn't ship\n * are added wholesale. Common case: an app needs to add ONE extra\n * `connect-src` origin without re-authoring the rest of the policy.\n * - `'replace-baseline'` — authored `directives` map REPLACES the\n * baseline entirely. Use when the baseline is fundamentally wrong\n * for the surface (e.g., a tighter or fundamentally different\n * posture). Escape hatch — the merge default is the right answer\n * in 95% of cases.\n */\nexport enum CspMergeStrategy {\n EXTEND_BASELINE = 'extend-baseline',\n REPLACE_BASELINE = 'replace-baseline',\n}\n\n/**\n * Author-side directive overrides — partial map keyed by the closed\n * directive-name set above. Each value is a source list of strings\n * (joined with single spaces by the serializer).\n *\n * Authoring `directives: { 'connect-src': ['https://api.example.com'] }`\n * with the default `'extend-baseline'` strategy APPENDS that origin to\n * the baseline `connect-src` source list (which already contains\n * `'self'` for every baseline) — it does NOT replace the baseline's\n * `connect-src`. Use `mergeStrategy: 'replace-baseline'` to opt out of\n * additive merging.\n */\nexport const CspDirectivesOverrideSchema = z.strictObject(\n Object.fromEntries(\n CSP_DIRECTIVE_NAMES.map((name) => [\n name,\n z.array(z.string().min(1)).optional(),\n ]),\n ) as Record<CspDirectiveName, z.ZodOptional<z.ZodArray<z.ZodString>>>,\n);\nexport type CspDirectivesOverride = z.infer<typeof CspDirectivesOverrideSchema>;\n\n/**\n * Per-frontend CSP block. Authored on each service-definition's `csp?`\n * field (today: `wildo.tech-doc.config.ts.csp?`; the `SAAS_APP` and\n * `STATIC_WEBSITE` surfaces wire the same shape under Slice B B-Step 4 + 5).\n *\n * Opt-in by default: `enabled: false` (or omitting the block entirely)\n * emits NO policy on either channel. Frontends that have not audited\n * their third-party JS / fetch surface should not ship a half-baked\n * CSP that breaks features without protecting anything.\n *\n * `z.strictObject` (Zod 4) is intentional — typos like `enable: true`\n * (no `d`) or `directive: { … }` (no plural) MUST surface as parse\n * errors, not silently strip to `enabled: false` (i.e. CSP off, the\n * worst possible default). Same framework-mindset enforcement as\n * `WildoAuthConfigSchema`.\n */\nexport const WildoCspConfigSchema = z.strictObject({\n /**\n * Opt-in switch. `false` (default) => no policy emitted; the\n * resolver returns `null`. `true` => baseline (+ overrides) emitted\n * on both channels per `reportOnly`.\n */\n enabled: z.boolean().default(false),\n /**\n * `true` => header name flips to `Content-Security-Policy-Report-Only`\n * AND the `<meta http-equiv>` channel goes silent (browsers reject the\n * report-only header via meta — W3C CSP3 §4.2.1). Use during the\n * pilot to triage console-surfaced violations without breaking real\n * traffic. Flip to `false` once the directive overrides settle.\n *\n * Default: `false` (enforcing). Authors opting into CSP for the first\n * time SHOULD set `reportOnly: true` for the first PR; the schema\n * default is intentionally enforcing so the steady state (post-pilot)\n * doesn't require a per-app authored `reportOnly: false`.\n */\n reportOnly: z.boolean().default(false),\n /**\n * Merge strategy for authored `directives` over the baseline. Default:\n * `'extend-baseline'` (per-directive additive merge — see\n * `CspMergeStrategy`).\n */\n mergeStrategy: z\n .enum(CspMergeStrategy)\n .default(CspMergeStrategy.EXTEND_BASELINE),\n /**\n * Per-directive overrides, keyed by directive name. Default: empty\n * map (baseline emitted verbatim).\n */\n directives: CspDirectivesOverrideSchema.default({}),\n /**\n * Optional `report-uri` directive value (header-only — meta tag\n * ignores it; the resolver feeds it to the nginx channel only).\n * No `report-to` field today — `report-to` requires the parallel\n * Reporting API endpoint config which the platform doesn't ship; add\n * when the violation-collector lands (`auth-hardening.md` \"Cheap\n * Bonuses — CSP violation monitoring endpoint\").\n */\n reportUri: z.string().min(1).optional(),\n});\nexport type WildoCspConfig = z.infer<typeof WildoCspConfigSchema>;\nexport type WildoCspConfigInput = z.input<typeof WildoCspConfigSchema>;\n\n/**\n * Env-specific overrides — authored under\n * `wildo.infra.<env>.config.ts.csp?[serviceKey]`. The loader merges\n * these on top of the app-static layer (which itself is on top of the\n * baseline).\n *\n * Slice B Step 2 wires this layer into `WildoInfraEnvConfigSchema`\n * (out-of-scope for this commit — the schema is shipped here so the\n * resolver in `csp-emit.ts` already accepts the shape it will consume).\n *\n * `extraDirectives` is ADDITIVE only — env-layer entries are APPENDED\n * to whatever the app-static layer produced for that directive. There\n * is no `'replace-baseline'`-equivalent at the env layer because env\n * config exists to LOOSEN policies for specific deployments (Sentry\n * origin in staging, dev hot-reload `'unsafe-eval'`), not to replace\n * an app's chosen posture. If an env genuinely needs a different\n * posture the right answer is to fix the app-static layer.\n */\nexport const EnvCspOverrideSchema = z.strictObject({\n /**\n * Per-directive ADDITIVE merge. Each entry's source list is\n * APPENDED to the app-static layer's source list for that directive\n * (de-duplicated, app order preserved, env sources appended in\n * author order). No replace semantics at this layer.\n */\n extraDirectives: CspDirectivesOverrideSchema.default({}),\n /**\n * Vite dev-mode CSP loosening: adds BOTH `'unsafe-inline'` and\n * `'unsafe-eval'` to `script-src`. Vite's dev server injects an\n * inline `<script>` for the HMR client bootstrap AND uses `eval()`\n * for lazy module / sourcemap transforms — both block under a strict\n * `script-src 'self'` policy and produce ~120+ CSP violations per\n * page load. Production Vite builds emit `<script type=\"module\">`\n * only and use no `eval()`, so this loosening is dev-only by design.\n *\n * AUTO-DEFAULT: `true` when the resolved env id is `'local'` AND the\n * frontend type is `SAAS_APP` (the only Vite-bundled frontend kind in\n * the framework). The framework applies the loosening automatically so\n * every Wildo app gets a clean dev console without per-app\n * configuration; opting in app-by-app would scatter the same\n * framework-shipped Vite knowledge across N infrastructure files.\n *\n * EXPLICIT OPT-OUT: set to `false` to keep tight `script-src` in\n * local dev. Useful only when actively debugging a real CSP issue\n * and willing to accept Vite-induced noise. Production envs ignore\n * this flag's auto-default and require explicit opt-in (extremely\n * unusual — a production app that needs `'unsafe-inline'` /\n * `'unsafe-eval'` is almost always a sign of a misconfigured asset\n * pipeline).\n */\n viteDevLoosening: z.boolean().optional(),\n /**\n * Env-layer override of the app-static `reportOnly` flag. When\n * present (not `undefined`), takes precedence over the app-static\n * value. Common shape: app-static ships `reportOnly: false`\n * (enforcing in prod), env-layer flips to `reportOnly: true` for\n * staging while the violation collector ramps up.\n */\n reportOnly: z.boolean().optional(),\n /**\n * Env-layer override of the app-static `reportUri` (e.g., per-env\n * collector endpoint).\n */\n reportUri: z.string().min(1).optional(),\n});\nexport type EnvCspOverride = z.infer<typeof EnvCspOverrideSchema>;\nexport type EnvCspOverrideInput = z.input<typeof EnvCspOverrideSchema>;\n"]}