@wildo-ai/saas-specifications 1.1.2 → 1.1.3

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 (410) hide show
  1. package/dist/esm/_core/brand/brand-asset.schemas.d.ts +4 -6
  2. package/dist/esm/_core/brand/brand-asset.schemas.d.ts.map +1 -1
  3. package/dist/esm/_core/brand/brand-asset.schemas.js +4 -12
  4. package/dist/esm/_core/brand/brand-asset.schemas.js.map +1 -1
  5. package/dist/esm/_core/brand/brand-generation.schemas.d.ts +5 -3
  6. package/dist/esm/_core/brand/brand-generation.schemas.d.ts.map +1 -1
  7. package/dist/esm/_core/brand/brand-generation.schemas.js +5 -2
  8. package/dist/esm/_core/brand/brand-generation.schemas.js.map +1 -1
  9. package/dist/esm/_core/brand/brand-snapshot.schemas.d.ts +10 -3
  10. package/dist/esm/_core/brand/brand-snapshot.schemas.d.ts.map +1 -1
  11. package/dist/esm/_core/brand/brand-snapshot.schemas.js +10 -2
  12. package/dist/esm/_core/brand/brand-snapshot.schemas.js.map +1 -1
  13. package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.d.ts.map +1 -1
  14. package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.js +15 -5
  15. package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.js.map +1 -1
  16. package/dist/esm/_core/build-plan/build-plan-task-graph-validation.d.ts +40 -3
  17. package/dist/esm/_core/build-plan/build-plan-task-graph-validation.d.ts.map +1 -1
  18. package/dist/esm/_core/build-plan/build-plan-task-graph-validation.js +85 -6
  19. package/dist/esm/_core/build-plan/build-plan-task-graph-validation.js.map +1 -1
  20. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.d.ts.map +1 -1
  21. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.js +10 -4
  22. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.js.map +1 -1
  23. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.d.ts +15 -0
  24. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.d.ts.map +1 -1
  25. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.js.map +1 -1
  26. package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.d.ts +10 -0
  27. package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.d.ts.map +1 -1
  28. package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.js +17 -0
  29. package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.js.map +1 -1
  30. package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.d.ts +6 -7
  31. package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.d.ts.map +1 -1
  32. package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.js +6 -13
  33. package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.js.map +1 -1
  34. package/dist/esm/_core/expert-personas/expert-persona-validation.d.ts +0 -11
  35. package/dist/esm/_core/expert-personas/expert-persona-validation.d.ts.map +1 -1
  36. package/dist/esm/_core/expert-personas/expert-persona-validation.js +0 -19
  37. package/dist/esm/_core/expert-personas/expert-persona-validation.js.map +1 -1
  38. package/dist/esm/_core/expert-personas/expert-role-template.schemas.d.ts +1 -2
  39. package/dist/esm/_core/expert-personas/expert-role-template.schemas.d.ts.map +1 -1
  40. package/dist/esm/_core/expert-personas/expert-role-template.schemas.js +1 -2
  41. package/dist/esm/_core/expert-personas/expert-role-template.schemas.js.map +1 -1
  42. package/dist/esm/_core/feature-drafts/feature-specification-drafts-generation.schemas.d.ts.map +1 -1
  43. package/dist/esm/_core/feature-drafts/feature-specification-drafts-generation.schemas.js +17 -4
  44. package/dist/esm/_core/feature-drafts/feature-specification-drafts-generation.schemas.js.map +1 -1
  45. package/dist/esm/_core/index.d.ts +1 -0
  46. package/dist/esm/_core/index.d.ts.map +1 -1
  47. package/dist/esm/_core/index.js +1 -0
  48. package/dist/esm/_core/index.js.map +1 -1
  49. package/dist/esm/_core/market/market-snapshot-generation.schemas.d.ts.map +1 -1
  50. package/dist/esm/_core/market/market-snapshot-generation.schemas.js +5 -40
  51. package/dist/esm/_core/market/market-snapshot-generation.schemas.js.map +1 -1
  52. package/dist/esm/_core/market/market-snapshot-validation.d.ts +15 -0
  53. package/dist/esm/_core/market/market-snapshot-validation.d.ts.map +1 -1
  54. package/dist/esm/_core/market/market-snapshot-validation.js.map +1 -1
  55. package/dist/esm/_core/placement-plan/placement-plan-generation.schemas.d.ts.map +1 -1
  56. package/dist/esm/_core/placement-plan/placement-plan-generation.schemas.js +11 -5
  57. package/dist/esm/_core/placement-plan/placement-plan-generation.schemas.js.map +1 -1
  58. package/dist/esm/_core/placement-plan/placement-plan-validation.d.ts +66 -9
  59. package/dist/esm/_core/placement-plan/placement-plan-validation.d.ts.map +1 -1
  60. package/dist/esm/_core/placement-plan/placement-plan-validation.js +62 -20
  61. package/dist/esm/_core/placement-plan/placement-plan-validation.js.map +1 -1
  62. package/dist/esm/_core/placement-plan/placement-plan.schemas.d.ts +4 -1
  63. package/dist/esm/_core/placement-plan/placement-plan.schemas.d.ts.map +1 -1
  64. package/dist/esm/_core/placement-plan/placement-plan.schemas.js +4 -1
  65. package/dist/esm/_core/placement-plan/placement-plan.schemas.js.map +1 -1
  66. package/dist/esm/_core/provider-specification.schemas.d.ts +82 -0
  67. package/dist/esm/_core/provider-specification.schemas.d.ts.map +1 -0
  68. package/dist/esm/_core/provider-specification.schemas.js +144 -0
  69. package/dist/esm/_core/provider-specification.schemas.js.map +1 -0
  70. package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.d.ts.map +1 -1
  71. package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.js +13 -8
  72. package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.js.map +1 -1
  73. package/dist/esm/_core/requirements/requirements-snapshot-validation.d.ts +15 -0
  74. package/dist/esm/_core/requirements/requirements-snapshot-validation.d.ts.map +1 -1
  75. package/dist/esm/_core/requirements/requirements-snapshot-validation.js.map +1 -1
  76. package/dist/esm/_core/roadmap/roadmap-snapshot-generation.schemas.d.ts.map +1 -1
  77. package/dist/esm/_core/roadmap/roadmap-snapshot-generation.schemas.js +7 -2
  78. package/dist/esm/_core/roadmap/roadmap-snapshot-generation.schemas.js.map +1 -1
  79. package/dist/esm/_core/roadmap/roadmap-snapshot-validation.d.ts +15 -0
  80. package/dist/esm/_core/roadmap/roadmap-snapshot-validation.d.ts.map +1 -1
  81. package/dist/esm/_core/roadmap/roadmap-snapshot-validation.js.map +1 -1
  82. package/dist/esm/_core/utils/family-ref-stamping.d.ts +64 -0
  83. package/dist/esm/_core/utils/family-ref-stamping.d.ts.map +1 -0
  84. package/dist/esm/_core/utils/family-ref-stamping.js +73 -0
  85. package/dist/esm/_core/utils/family-ref-stamping.js.map +1 -0
  86. package/dist/esm/_core/vision/vision-snapshot-generation.schemas.d.ts.map +1 -1
  87. package/dist/esm/_core/vision/vision-snapshot-generation.schemas.js +23 -9
  88. package/dist/esm/_core/vision/vision-snapshot-generation.schemas.js.map +1 -1
  89. package/dist/esm/application-creation/application-coding-tasks.application-creation.schemas.d.ts +0 -4
  90. package/dist/esm/application-creation/application-coding-tasks.application-creation.schemas.d.ts.map +1 -1
  91. package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.d.ts +7 -7
  92. package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.d.ts.map +1 -1
  93. package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.js +6 -7
  94. package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.js.map +1 -1
  95. package/dist/esm/application-creation/application-document-release-policy-specification.application-creation.schemas.d.ts +3 -3
  96. package/dist/esm/application-creation/application-document-release-policy-specification.application-creation.schemas.js +3 -3
  97. package/dist/esm/application-creation/application-document-release-policy-specification.application-creation.schemas.js.map +1 -1
  98. package/dist/esm/application-creation/application-specification-family-identity.application-creation.schemas.d.ts +2 -2
  99. package/dist/esm/application-creation/application-specification-family-identity.application-creation.schemas.js +2 -2
  100. package/dist/esm/application-creation/application-specification-family-identity.application-creation.schemas.js.map +1 -1
  101. package/dist/esm/application-creation/journey.application-creation.schemas.d.ts +18 -6
  102. package/dist/esm/application-creation/journey.application-creation.schemas.d.ts.map +1 -1
  103. package/dist/esm/application-creation/journey.application-creation.schemas.js +18 -6
  104. package/dist/esm/application-creation/journey.application-creation.schemas.js.map +1 -1
  105. package/dist/esm/application-creation/playbooks.application-creation.schemas.d.ts +8 -23
  106. package/dist/esm/application-creation/playbooks.application-creation.schemas.d.ts.map +1 -1
  107. package/dist/esm/application-creation/playbooks.application-creation.schemas.js +57 -27
  108. package/dist/esm/application-creation/playbooks.application-creation.schemas.js.map +1 -1
  109. package/dist/esm/assurance/application-document-publication.schemas.d.ts +20 -6
  110. package/dist/esm/assurance/application-document-publication.schemas.d.ts.map +1 -1
  111. package/dist/esm/assurance/application-document-publication.schemas.js +26 -10
  112. package/dist/esm/assurance/application-document-publication.schemas.js.map +1 -1
  113. package/dist/esm/assurance/assurance-authority-basis.definitions.d.ts +72 -49
  114. package/dist/esm/assurance/assurance-authority-basis.definitions.d.ts.map +1 -1
  115. package/dist/esm/assurance/assurance-authority-basis.definitions.js +161 -60
  116. package/dist/esm/assurance/assurance-authority-basis.definitions.js.map +1 -1
  117. package/dist/esm/assurance/assurance-authority-basis.schemas.d.ts +25 -0
  118. package/dist/esm/assurance/assurance-authority-basis.schemas.d.ts.map +1 -1
  119. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.d.ts +36 -0
  120. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.d.ts.map +1 -0
  121. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.js +859 -0
  122. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.js.map +1 -0
  123. package/dist/esm/assurance/assurance-foundation.schemas.d.ts +43 -0
  124. package/dist/esm/assurance/assurance-foundation.schemas.d.ts.map +1 -1
  125. package/dist/esm/assurance/assurance-foundation.schemas.js +56 -0
  126. package/dist/esm/assurance/assurance-foundation.schemas.js.map +1 -1
  127. package/dist/esm/assurance/assurance-objective-catalog.definitions.d.ts +14 -7
  128. package/dist/esm/assurance/assurance-objective-catalog.definitions.d.ts.map +1 -1
  129. package/dist/esm/assurance/assurance-objective-catalog.definitions.js +24 -7
  130. package/dist/esm/assurance/assurance-objective-catalog.definitions.js.map +1 -1
  131. package/dist/esm/assurance/assurance-program-generation.schemas.d.ts +8 -1
  132. package/dist/esm/assurance/assurance-program-generation.schemas.d.ts.map +1 -1
  133. package/dist/esm/assurance/assurance-program-generation.schemas.js +10 -2
  134. package/dist/esm/assurance/assurance-program-generation.schemas.js.map +1 -1
  135. package/dist/esm/assurance/assurance-program.schemas.d.ts +447 -11
  136. package/dist/esm/assurance/assurance-program.schemas.d.ts.map +1 -1
  137. package/dist/esm/assurance/assurance-program.schemas.js +293 -5
  138. package/dist/esm/assurance/assurance-program.schemas.js.map +1 -1
  139. package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.d.ts +35 -0
  140. package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.d.ts.map +1 -0
  141. package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.js +999 -0
  142. package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.js.map +1 -0
  143. package/dist/esm/companion-exports.d.ts +7 -6
  144. package/dist/esm/companion-exports.d.ts.map +1 -1
  145. package/dist/esm/companion-exports.js.map +1 -1
  146. package/dist/esm/engine/_bootstrap.js +3 -1
  147. package/dist/esm/engine/_bootstrap.js.map +1 -1
  148. package/dist/esm/engine/applications/resources/application-api-keys.resource.specification.d.ts.map +1 -1
  149. package/dist/esm/engine/applications/resources/application-api-keys.resource.specification.js +13 -1
  150. package/dist/esm/engine/applications/resources/application-api-keys.resource.specification.js.map +1 -1
  151. package/dist/esm/engine/applications/resources/application-metadata.resource.specification.js +1 -1
  152. package/dist/esm/engine/applications/resources/application-metadata.resource.specification.js.map +1 -1
  153. package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.d.ts +2 -0
  154. package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.d.ts.map +1 -1
  155. package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.js +14 -2
  156. package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.js.map +1 -1
  157. package/dist/esm/engine/applications/resources/application-versions.resource.specification.js +9 -9
  158. package/dist/esm/engine/applications/resources/application-versions.resource.specification.js.map +1 -1
  159. package/dist/esm/engine/applications/resources/applications.resource.specification.js +1 -1
  160. package/dist/esm/engine/applications/resources/applications.resource.specification.js.map +1 -1
  161. package/dist/esm/engine/auth/resources/consumable-tokens.resource.specification.js +3 -3
  162. package/dist/esm/engine/auth/resources/consumable-tokens.resource.specification.js.map +1 -1
  163. package/dist/esm/engine/auth/resources/oauth-consent-grants.resource.specification.js +1 -1
  164. package/dist/esm/engine/auth/resources/oauth-consent-grants.resource.specification.js.map +1 -1
  165. package/dist/esm/engine/auth/resources/organization-api-keys.resource.specification.d.ts.map +1 -1
  166. package/dist/esm/engine/auth/resources/organization-api-keys.resource.specification.js +13 -1
  167. package/dist/esm/engine/auth/resources/organization-api-keys.resource.specification.js.map +1 -1
  168. package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.d.ts +2 -0
  169. package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.d.ts.map +1 -1
  170. package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.js +14 -2
  171. package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.js.map +1 -1
  172. package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.d.ts +32 -0
  173. package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.d.ts.map +1 -0
  174. package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.js +308 -0
  175. package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.js.map +1 -0
  176. package/dist/esm/engine/auth/resources/platform-access-grants.resource.specification.js +4 -4
  177. package/dist/esm/engine/auth/resources/platform-access-grants.resource.specification.js.map +1 -1
  178. package/dist/esm/engine/auth/resources/scim-provisioning-config.resource.specification.js +2 -2
  179. package/dist/esm/engine/auth/resources/scim-provisioning-config.resource.specification.js.map +1 -1
  180. package/dist/esm/engine/auth/resources/scim-tokens.resource.specification.js +6 -6
  181. package/dist/esm/engine/auth/resources/scim-tokens.resource.specification.js.map +1 -1
  182. package/dist/esm/engine/auth/resources/siem-delivery-dlq.resource.specification.js +9 -9
  183. package/dist/esm/engine/auth/resources/siem-delivery-dlq.resource.specification.js.map +1 -1
  184. package/dist/esm/engine/auth/resources/siem-export-config.resource.specification.js +2 -2
  185. package/dist/esm/engine/auth/resources/siem-export-config.resource.specification.js.map +1 -1
  186. package/dist/esm/engine/auth/resources/sso-config.resource.specification.d.ts +9 -25
  187. package/dist/esm/engine/auth/resources/sso-config.resource.specification.d.ts.map +1 -1
  188. package/dist/esm/engine/auth/resources/sso-config.resource.specification.js +104 -10
  189. package/dist/esm/engine/auth/resources/sso-config.resource.specification.js.map +1 -1
  190. package/dist/esm/engine/auth/resources/sso-connections.resource.specification.d.ts +0 -6
  191. package/dist/esm/engine/auth/resources/sso-connections.resource.specification.d.ts.map +1 -1
  192. package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.d.ts +32 -0
  193. package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.d.ts.map +1 -0
  194. package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.js +297 -0
  195. package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.js.map +1 -0
  196. package/dist/esm/engine/billing/resources/billing-accounts.resource.specification.d.ts.map +1 -1
  197. package/dist/esm/engine/billing/resources/billing-accounts.resource.specification.js +4 -3
  198. package/dist/esm/engine/billing/resources/billing-accounts.resource.specification.js.map +1 -1
  199. package/dist/esm/engine/billing/resources/credit-pools.resource.specification.js +2 -2
  200. package/dist/esm/engine/billing/resources/credit-pools.resource.specification.js.map +1 -1
  201. package/dist/esm/engine/billing/resources/invoice-refs.resource.specification.js +3 -3
  202. package/dist/esm/engine/billing/resources/invoice-refs.resource.specification.js.map +1 -1
  203. package/dist/esm/engine/billing/resources/prices.resource.specification.js +7 -7
  204. package/dist/esm/engine/billing/resources/prices.resource.specification.js.map +1 -1
  205. package/dist/esm/engine/billing/resources/products.resource.specification.js +7 -7
  206. package/dist/esm/engine/billing/resources/products.resource.specification.js.map +1 -1
  207. package/dist/esm/engine/billing/resources/promotions.resource.specification.d.ts.map +1 -1
  208. package/dist/esm/engine/billing/resources/promotions.resource.specification.js +14 -12
  209. package/dist/esm/engine/billing/resources/promotions.resource.specification.js.map +1 -1
  210. package/dist/esm/engine/billing/resources/referrals.resource.specification.js +7 -7
  211. package/dist/esm/engine/billing/resources/referrals.resource.specification.js.map +1 -1
  212. package/dist/esm/engine/billing/resources/subscriptions.resource.specification.d.ts.map +1 -1
  213. package/dist/esm/engine/billing/resources/subscriptions.resource.specification.js +6 -3
  214. package/dist/esm/engine/billing/resources/subscriptions.resource.specification.js.map +1 -1
  215. package/dist/esm/engine/billing/resources/usage-records.resource.specification.d.ts +7 -3
  216. package/dist/esm/engine/billing/resources/usage-records.resource.specification.d.ts.map +1 -1
  217. package/dist/esm/engine/billing/resources/usage-records.resource.specification.js +28 -11
  218. package/dist/esm/engine/billing/resources/usage-records.resource.specification.js.map +1 -1
  219. package/dist/esm/engine/compliance/resources/audit-logs.resource.specification.js +8 -8
  220. package/dist/esm/engine/compliance/resources/audit-logs.resource.specification.js.map +1 -1
  221. package/dist/esm/engine/engine-resource-specifications.registry.d.ts +2 -2
  222. package/dist/esm/engine/engine-resource-specifications.registry.d.ts.map +1 -1
  223. package/dist/esm/engine/engine-resource-specifications.registry.js +6 -2
  224. package/dist/esm/engine/engine-resource-specifications.registry.js.map +1 -1
  225. package/dist/esm/engine/engine-resource-sub-domain.d.ts +20 -0
  226. package/dist/esm/engine/engine-resource-sub-domain.d.ts.map +1 -1
  227. package/dist/esm/engine/engine-resource-sub-domain.js +66 -0
  228. package/dist/esm/engine/engine-resource-sub-domain.js.map +1 -1
  229. package/dist/esm/engine/errors/error-messages.specification.d.ts.map +1 -1
  230. package/dist/esm/engine/errors/error-messages.specification.js +14 -0
  231. package/dist/esm/engine/errors/error-messages.specification.js.map +1 -1
  232. package/dist/esm/engine/features/audit-logs.feature.specification.js +4 -4
  233. package/dist/esm/engine/features/audit-logs.feature.specification.js.map +1 -1
  234. package/dist/esm/engine/features/core-limits.feature.specifications.js +7 -7
  235. package/dist/esm/engine/features/core-limits.feature.specifications.js.map +1 -1
  236. package/dist/esm/engine/features/resources/application-features.resource.specification.js +3 -3
  237. package/dist/esm/engine/features/resources/application-features.resource.specification.js.map +1 -1
  238. package/dist/esm/engine/features/resources/organization-features.resource.specification.js +3 -3
  239. package/dist/esm/engine/features/resources/organization-features.resource.specification.js.map +1 -1
  240. package/dist/esm/engine/features/resources/user-features.resource.specification.js +3 -3
  241. package/dist/esm/engine/features/resources/user-features.resource.specification.js.map +1 -1
  242. package/dist/esm/engine/files/resources/files.resource.specification.js +10 -10
  243. package/dist/esm/engine/files/resources/files.resource.specification.js.map +1 -1
  244. package/dist/esm/engine/flows-actors/resources/a2a-push-delivery-log.resource.specification.js +11 -11
  245. package/dist/esm/engine/flows-actors/resources/a2a-push-delivery-log.resource.specification.js.map +1 -1
  246. package/dist/esm/engine/flows-actors/resources/a2a-token-budget-state.resource.specification.js +4 -4
  247. package/dist/esm/engine/flows-actors/resources/a2a-token-budget-state.resource.specification.js.map +1 -1
  248. package/dist/esm/engine/flows-actors/resources/flow-actor-executions.resource.specification.js +2 -2
  249. package/dist/esm/engine/flows-actors/resources/flow-actor-executions.resource.specification.js.map +1 -1
  250. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.d.ts +5 -0
  251. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.d.ts.map +1 -0
  252. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.js +81 -0
  253. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.js.map +1 -0
  254. package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.d.ts +4 -0
  255. package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.d.ts.map +1 -0
  256. package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.js +22 -0
  257. package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.js.map +1 -0
  258. package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.d.ts +0 -4
  259. package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.d.ts.map +0 -1
  260. package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.js +0 -21
  261. package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.js.map +0 -1
  262. package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.d.ts +0 -4
  263. package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.d.ts.map +0 -1
  264. package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.js +0 -21
  265. package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.js.map +0 -1
  266. package/dist/esm/engine/frontend-components/index.d.ts +0 -2
  267. package/dist/esm/engine/frontend-components/index.d.ts.map +1 -1
  268. package/dist/esm/engine/frontend-components/index.js +4 -6
  269. package/dist/esm/engine/frontend-components/index.js.map +1 -1
  270. package/dist/esm/engine/guidance/resources/guidance-state.resource.specification.js +12 -12
  271. package/dist/esm/engine/guidance/resources/guidance-state.resource.specification.js.map +1 -1
  272. package/dist/esm/engine/guidance/resources/lifecycle-state.resource.specification.js +9 -9
  273. package/dist/esm/engine/guidance/resources/lifecycle-state.resource.specification.js.map +1 -1
  274. package/dist/esm/engine/guidance/resources/progression-state.resource.specification.d.ts +8 -0
  275. package/dist/esm/engine/guidance/resources/progression-state.resource.specification.d.ts.map +1 -1
  276. package/dist/esm/engine/guidance/resources/progression-state.resource.specification.js +6 -6
  277. package/dist/esm/engine/guidance/resources/progression-state.resource.specification.js.map +1 -1
  278. package/dist/esm/engine/index.d.ts +1 -0
  279. package/dist/esm/engine/index.d.ts.map +1 -1
  280. package/dist/esm/engine/index.js +1 -0
  281. package/dist/esm/engine/index.js.map +1 -1
  282. package/dist/esm/engine/infrastructure/resources/data-seed-runs.resource.specification.js +17 -17
  283. package/dist/esm/engine/infrastructure/resources/data-seed-runs.resource.specification.js.map +1 -1
  284. package/dist/esm/engine/infrastructure/resources/external-data-pipeline-states.resource.specification.js +7 -7
  285. package/dist/esm/engine/infrastructure/resources/external-data-pipeline-states.resource.specification.js.map +1 -1
  286. package/dist/esm/engine/infrastructure/resources/job-executions.resource.specification.js +8 -8
  287. package/dist/esm/engine/infrastructure/resources/job-executions.resource.specification.js.map +1 -1
  288. package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.d.ts +7 -2
  289. package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.d.ts.map +1 -1
  290. package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.js +10 -5
  291. package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.js.map +1 -1
  292. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.d.ts.map +1 -1
  293. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.js +20 -15
  294. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.js.map +1 -1
  295. package/dist/esm/engine/notifications/resources/notification-badges.resource.specification.d.ts.map +1 -1
  296. package/dist/esm/engine/notifications/resources/notification-badges.resource.specification.js +11 -10
  297. package/dist/esm/engine/notifications/resources/notification-badges.resource.specification.js.map +1 -1
  298. package/dist/esm/engine/notifications/resources/webhook-config.resource.specification.d.ts.map +1 -1
  299. package/dist/esm/engine/notifications/resources/webhook-config.resource.specification.js +29 -6
  300. package/dist/esm/engine/notifications/resources/webhook-config.resource.specification.js.map +1 -1
  301. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js +9 -9
  302. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js.map +1 -1
  303. package/dist/esm/engine/organizations/resources/organization-notifications.resource.specification.js +3 -3
  304. package/dist/esm/engine/organizations/resources/organization-notifications.resource.specification.js.map +1 -1
  305. package/dist/esm/engine/organizations/resources/organization-preferences.resource.specification.js +4 -4
  306. package/dist/esm/engine/organizations/resources/organization-preferences.resource.specification.js.map +1 -1
  307. package/dist/esm/engine/organizations/resources/organization-profiles.resource.specification.js +2 -2
  308. package/dist/esm/engine/organizations/resources/organization-profiles.resource.specification.js.map +1 -1
  309. package/dist/esm/engine/organizations/resources/organization-unit-members.resource.specification.js +1 -1
  310. package/dist/esm/engine/organizations/resources/organization-unit-members.resource.specification.js.map +1 -1
  311. package/dist/esm/engine/organizations/resources/organizations.resource.specification.js +7 -7
  312. package/dist/esm/engine/organizations/resources/organizations.resource.specification.js.map +1 -1
  313. package/dist/esm/engine/providers/_engine-provider-shared.d.ts +9 -0
  314. package/dist/esm/engine/providers/_engine-provider-shared.d.ts.map +1 -0
  315. package/dist/esm/engine/providers/_engine-provider-shared.js +19 -0
  316. package/dist/esm/engine/providers/_engine-provider-shared.js.map +1 -0
  317. package/dist/esm/engine/providers/anthropic.provider.specification.d.ts +7 -0
  318. package/dist/esm/engine/providers/anthropic.provider.specification.d.ts.map +1 -0
  319. package/dist/esm/engine/providers/anthropic.provider.specification.js +33 -0
  320. package/dist/esm/engine/providers/anthropic.provider.specification.js.map +1 -0
  321. package/dist/esm/engine/providers/apple.provider.specification.d.ts +7 -0
  322. package/dist/esm/engine/providers/apple.provider.specification.d.ts.map +1 -0
  323. package/dist/esm/engine/providers/apple.provider.specification.js +35 -0
  324. package/dist/esm/engine/providers/apple.provider.specification.js.map +1 -0
  325. package/dist/esm/engine/providers/email-preview.provider.specification.d.ts +7 -0
  326. package/dist/esm/engine/providers/email-preview.provider.specification.d.ts.map +1 -0
  327. package/dist/esm/engine/providers/email-preview.provider.specification.js +31 -0
  328. package/dist/esm/engine/providers/email-preview.provider.specification.js.map +1 -0
  329. package/dist/esm/engine/providers/github.provider.specification.d.ts +7 -0
  330. package/dist/esm/engine/providers/github.provider.specification.d.ts.map +1 -0
  331. package/dist/esm/engine/providers/github.provider.specification.js +30 -0
  332. package/dist/esm/engine/providers/github.provider.specification.js.map +1 -0
  333. package/dist/esm/engine/providers/google.provider.specification.d.ts +7 -0
  334. package/dist/esm/engine/providers/google.provider.specification.d.ts.map +1 -0
  335. package/dist/esm/engine/providers/google.provider.specification.js +34 -0
  336. package/dist/esm/engine/providers/google.provider.specification.js.map +1 -0
  337. package/dist/esm/engine/providers/grok.provider.specification.d.ts +7 -0
  338. package/dist/esm/engine/providers/grok.provider.specification.d.ts.map +1 -0
  339. package/dist/esm/engine/providers/grok.provider.specification.js +30 -0
  340. package/dist/esm/engine/providers/grok.provider.specification.js.map +1 -0
  341. package/dist/esm/engine/providers/index.d.ts +23 -0
  342. package/dist/esm/engine/providers/index.d.ts.map +1 -0
  343. package/dist/esm/engine/providers/index.js +37 -0
  344. package/dist/esm/engine/providers/index.js.map +1 -0
  345. package/dist/esm/engine/providers/microsoft.provider.specification.d.ts +7 -0
  346. package/dist/esm/engine/providers/microsoft.provider.specification.d.ts.map +1 -0
  347. package/dist/esm/engine/providers/microsoft.provider.specification.js +30 -0
  348. package/dist/esm/engine/providers/microsoft.provider.specification.js.map +1 -0
  349. package/dist/esm/engine/providers/mistral.provider.specification.d.ts +7 -0
  350. package/dist/esm/engine/providers/mistral.provider.specification.d.ts.map +1 -0
  351. package/dist/esm/engine/providers/mistral.provider.specification.js +33 -0
  352. package/dist/esm/engine/providers/mistral.provider.specification.js.map +1 -0
  353. package/dist/esm/engine/providers/openai.provider.specification.d.ts +7 -0
  354. package/dist/esm/engine/providers/openai.provider.specification.d.ts.map +1 -0
  355. package/dist/esm/engine/providers/openai.provider.specification.js +43 -0
  356. package/dist/esm/engine/providers/openai.provider.specification.js.map +1 -0
  357. package/dist/esm/engine/providers/opencode.provider.specification.d.ts +7 -0
  358. package/dist/esm/engine/providers/opencode.provider.specification.d.ts.map +1 -0
  359. package/dist/esm/engine/providers/opencode.provider.specification.js +50 -0
  360. package/dist/esm/engine/providers/opencode.provider.specification.js.map +1 -0
  361. package/dist/esm/engine/providers/perplexity.provider.specification.d.ts +7 -0
  362. package/dist/esm/engine/providers/perplexity.provider.specification.d.ts.map +1 -0
  363. package/dist/esm/engine/providers/perplexity.provider.specification.js +30 -0
  364. package/dist/esm/engine/providers/perplexity.provider.specification.js.map +1 -0
  365. package/dist/esm/engine/providers/resend.provider.specification.d.ts +7 -0
  366. package/dist/esm/engine/providers/resend.provider.specification.d.ts.map +1 -0
  367. package/dist/esm/engine/providers/resend.provider.specification.js +33 -0
  368. package/dist/esm/engine/providers/resend.provider.specification.js.map +1 -0
  369. package/dist/esm/engine/providers/stripe.provider.specification.d.ts +7 -0
  370. package/dist/esm/engine/providers/stripe.provider.specification.d.ts.map +1 -0
  371. package/dist/esm/engine/providers/stripe.provider.specification.js +35 -0
  372. package/dist/esm/engine/providers/stripe.provider.specification.js.map +1 -0
  373. package/dist/esm/engine/providers/twilio.provider.specification.d.ts +7 -0
  374. package/dist/esm/engine/providers/twilio.provider.specification.d.ts.map +1 -0
  375. package/dist/esm/engine/providers/twilio.provider.specification.js +33 -0
  376. package/dist/esm/engine/providers/twilio.provider.specification.js.map +1 -0
  377. package/dist/esm/engine/users/resources/anonymous-users.resource.specification.js +7 -7
  378. package/dist/esm/engine/users/resources/anonymous-users.resource.specification.js.map +1 -1
  379. package/dist/esm/engine/users/resources/inbound-contacts.resource.specification.js +9 -9
  380. package/dist/esm/engine/users/resources/inbound-contacts.resource.specification.js.map +1 -1
  381. package/dist/esm/engine/users/resources/user-credentials.resource.specification.js +2 -2
  382. package/dist/esm/engine/users/resources/user-credentials.resource.specification.js.map +1 -1
  383. package/dist/esm/engine/users/resources/user-identity-links.resource.specification.js +8 -8
  384. package/dist/esm/engine/users/resources/user-identity-links.resource.specification.js.map +1 -1
  385. package/dist/esm/engine/users/resources/user-preferences.resource.specification.d.ts +4 -4
  386. package/dist/esm/engine/users/resources/user-preferences.resource.specification.js +4 -4
  387. package/dist/esm/engine/users/resources/user-preferences.resource.specification.js.map +1 -1
  388. package/dist/esm/engine/users/resources/user-profiles.resource.specification.js +2 -2
  389. package/dist/esm/engine/users/resources/user-profiles.resource.specification.js.map +1 -1
  390. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.d.ts +4 -4
  391. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.d.ts.map +1 -1
  392. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.js +13 -11
  393. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.js.map +1 -1
  394. package/dist/esm/engine/users/resources/user-self-profiles.resource.specification.js +1 -1
  395. package/dist/esm/engine/users/resources/user-self-profiles.resource.specification.js.map +1 -1
  396. package/dist/esm/engine/users/resources/user-self.resource.specification.js +8 -8
  397. package/dist/esm/engine/users/resources/user-self.resource.specification.js.map +1 -1
  398. package/dist/esm/engine/users/resources/users.resource.specification.d.ts.map +1 -1
  399. package/dist/esm/engine/users/resources/users.resource.specification.js +93 -0
  400. package/dist/esm/engine/users/resources/users.resource.specification.js.map +1 -1
  401. package/dist/esm/technical-documentation/engine-documentation-specification-catalog.companion.d.ts.map +1 -1
  402. package/dist/esm/technical-documentation/engine-documentation-specification-catalog.companion.js +95 -45
  403. package/dist/esm/technical-documentation/engine-documentation-specification-catalog.companion.js.map +1 -1
  404. package/dist/esm/technical-documentation/technical-documentation-units.schemas.d.ts +37 -1
  405. package/dist/esm/technical-documentation/technical-documentation-units.schemas.d.ts.map +1 -1
  406. package/dist/esm/technical-documentation/technical-documentation-units.schemas.js +36 -0
  407. package/dist/esm/technical-documentation/technical-documentation-units.schemas.js.map +1 -1
  408. package/dist/tsconfig.build.tsbuildinfo +1 -1
  409. package/package.json +8 -8
  410. package/dist/assurance/external-framework-mapping.json +0 -980
@@ -0,0 +1,297 @@
1
+ /**
2
+ * Resource: `userProviderCredentials` — Wildo SaaS engine specification
3
+ * (user-self-scoped, backend-managed secret).
4
+ *
5
+ * Inputs:
6
+ * - Schema: engine/saas-models/src/security/connected-accounts/provider-credentials.shared.schemas.ts
7
+ * → `UserProviderCredentialSchema`
8
+ * - Factory: engine/saas-models/src/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.ts
9
+ * → `userProviderCredentialsResourceConfiguration_InitializationFactory`
10
+ * - Custom operations: none
11
+ * - UI presets: `engine/presets-components/src/config/resources/security.resource-presets.tsx`
12
+ * → `USER_PROVIDER_CREDENTIALS`, reached through the `my-provider-credentials` settings destination.
13
+ */
14
+ import { LabelAudience } from '@wildo-ai/presets-components-models';
15
+ import { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance, } from '@wildo-ai/zod-decorators';
16
+ import { CoreResourceOperation as Op, ProviderCredentialValidationState, ResourcePrimaryScope, UserProviderCredentialSchema, userProviderCredentialsResourceConfiguration_InitializationFactory, } from '@wildo-ai/saas-models';
17
+ import { HttpResponseStatusCode, resourceSpecification } from '../../../_core/index.js';
18
+ import { EngineResourceSubDomain } from '../../engine-resource-sub-domain.js';
19
+ const CREDENTIAL_EXAMPLE_ID = 'usrprovcred_01J7K2M4N6P8Q0R2S4T6V8W0XY';
20
+ const CREDENTIAL_EXAMPLE_USER_ID = 'user_01J4M1Z2X3C4V5B6N7M8Q9R0ST';
21
+ /**
22
+ * The record as a client sees it — with the value MASKED.
23
+ *
24
+ * That mask is not decoration in an example: `secretValue` is `.isWriteOnlySecret()`, so the
25
+ * framework redacts it at the client boundary on every read. Showing a plausible token here would
26
+ * teach an integrator that a credential can be read back, which is the one thing this resource
27
+ * guarantees it cannot.
28
+ */
29
+ const CREDENTIAL_RECORD_EXAMPLE = {
30
+ _id: CREDENTIAL_EXAMPLE_ID,
31
+ userId: CREDENTIAL_EXAMPLE_USER_ID,
32
+ providerRef: 'openai',
33
+ secretSlug: 'OPENAI_API_KEY',
34
+ secretValue: '••••••••',
35
+ enabled: true,
36
+ validationState: ProviderCredentialValidationState.VALID,
37
+ lastValidatedAt: '2026-09-02T11:14:00.000Z',
38
+ lastUsedAt: '2026-09-02T11:14:00.000Z',
39
+ secretSetAt: '2026-08-30T09:00:00.000Z',
40
+ description: 'My personal key, so my drafts are billed to me.',
41
+ createdAt: '2026-08-30T09:00:00.000Z',
42
+ updatedAt: '2026-09-02T11:14:00.000Z',
43
+ };
44
+ const CREDENTIAL_PAGE_EXAMPLE = {
45
+ data: [CREDENTIAL_RECORD_EXAMPLE],
46
+ pagination: { page: 1, limit: 20, total: 1, totalPages: 1 },
47
+ };
48
+ export const userProviderCredentialsResourceSpecification = resourceSpecification(userProviderCredentialsResourceConfiguration_InitializationFactory, UserProviderCredentialSchema, ({ schemaShape }) => ({
49
+ purpose: "One PERSON's OWN credential toward a third-party provider — their personal API key, the account they connected themselves.",
50
+ businessRole: "The record that lets an application act as an individual toward a third party rather than as the tenant or as itself. It is what makes a personal integration possible — work attributed to the person at the vendor, billed to their account, and carrying only the permissions they granted.",
51
+ lifecycleRole: 'Created by the holder when they connect a provider, rotated in place when they reissue the credential at the vendor, disabled to stop the application acting as them without discarding the credential, and removed when they disconnect the provider or their own account is erased.',
52
+ audience: LabelAudience.DEVELOPER,
53
+ subDomain: EngineResourceSubDomain.AUTH,
54
+ codeHandling: {
55
+ mainSchema: {
56
+ packageName: '@wildo-ai/saas-models',
57
+ exportName: 'UserProviderCredentialSchema',
58
+ symbolKind: CodeSymbolKind.SCHEMA,
59
+ declarationKind: CodeDeclarationKind.ZOD_SCHEMA,
60
+ },
61
+ resourceFactory: {
62
+ packageName: '@wildo-ai/saas-models',
63
+ exportName: 'userProviderCredentialsResourceConfiguration_InitializationFactory',
64
+ symbolKind: CodeSymbolKind.FACTORY,
65
+ declarationKind: CodeDeclarationKind.FUNCTION,
66
+ },
67
+ resourceType: {
68
+ enumDeclaration: {
69
+ packageName: '@wildo-ai/saas-models',
70
+ exportName: 'CoreResourceType',
71
+ symbolKind: CodeSymbolKind.ENUM,
72
+ declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,
73
+ },
74
+ memberName: 'USER_PROVIDER_CREDENTIALS',
75
+ },
76
+ operationVocabulary: {
77
+ coreEnum: {
78
+ packageName: '@wildo-ai/saas-models',
79
+ exportName: 'CoreResourceOperation',
80
+ symbolKind: CodeSymbolKind.ENUM,
81
+ declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,
82
+ },
83
+ },
84
+ notes: [
85
+ 'The stored value is SEALED, never the plaintext the holder typed: an AES-256-GCM envelope whose key is derived from the application\'s own `secrets.security.session.encryptionKey`. The USER scope selects a DIFFERENT key domain from the organization-owned sibling, so a person\'s envelope cannot be opened as a tenant\'s even with a matching owner id — and the associated data binds it to (userId, providerRef, secretSlug), so a ciphertext copied into another person\'s row fails to open rather than silently working.',
86
+ 'Every door is APP_USER and there is deliberately NO administrative variant — not an organization administrator\'s, not a platform operator\'s. Consenting to STORE a personal credential is not consenting for somebody else to spend it, and the vendor records the resulting act as the holder\'s, which no later audit event makes reversible.',
87
+ 'There is NO resolution fallback. A person who has connected nothing gets a refusal naming what to connect — never the deployment\'s shared principal and never their organization\'s credential. Substituting either would attribute the act to a party that granted no permission for it.',
88
+ 'A row appears in TWO ways, and only one of them is an HTTP write. A credential you PASTE arrives through `CREATE` below. A credential a vendor MINTS arrives through the authorization exchange: you authorize on the vendor\'s own consent screen, come back through one shared callback, and the application records the grant — you never see or type the token. The second path is why this resource permits a system-tier create at all.',
89
+ 'Set, rotate, use and delete are audited as `USER_PROVIDER_CREDENTIAL_*`, annotated `WILDO.IDENTITY.DELEGATED_AUTHORIZATION`. None of the four payload schemas has a field the value could occupy, and none carries an organization — a person\'s connections must not reach their tenant\'s SIEM stream.',
90
+ ],
91
+ },
92
+ fields: {
93
+ _id: schemaShape._id.stringSpec({
94
+ meaning: 'Identifier for one stored credential.',
95
+ whyItMatters: 'The address for a rotation or a revocation, and the id every audit event carries.',
96
+ semanticRole: 'identifier',
97
+ importance: FieldSemanticImportance.PRIMARY,
98
+ }),
99
+ userId: schemaShape.userId.foreignKeySpec({
100
+ meaning: 'The person who owns this credential.',
101
+ whyItMatters: 'The isolation axis, and here it is also the SUBJECT. Injected by the framework from the authenticated scope rather than read from the payload, it scopes every read, and it is bound into the encryption envelope — so a credential cannot be read, spent or moved outside the person who set it. It is what makes "another user\'s key" unreachable rather than merely filtered.',
102
+ importance: FieldSemanticImportance.PRIMARY,
103
+ }),
104
+ providerRef: schemaShape.providerRef.stringSpec({
105
+ meaning: 'The provider this credential authenticates toward — `openai`, `slack`, a generated provider package\'s ref.',
106
+ whyItMatters: 'Half of the credential\'s identity for its holder, and what tells them which third parties they have granted the application authority toward.',
107
+ semanticRole: 'identifier',
108
+ importance: FieldSemanticImportance.PRIMARY,
109
+ }),
110
+ secretSlug: schemaShape.secretSlug.stringSpec({
111
+ meaning: "The slug in the provider's `secretsContract` that this value satisfies.",
112
+ whyItMatters: 'A provider declaring several secrets (an API key and a signing secret) gets one row per slug, so the holder can rotate one without disturbing the other.',
113
+ semanticRole: 'identifier',
114
+ importance: FieldSemanticImportance.PRIMARY,
115
+ }),
116
+ secretValue: schemaShape.secretValue.stringSpec({
117
+ meaning: 'The credential itself. Supplied in plaintext on write, stored SEALED, and never returned — a read renders a fixed mask.',
118
+ whyItMatters: 'Echoing the mask back on an update means "keep the stored secret", which is how the holder edits a note without retyping the credential. Sending a real value replaces it and is recorded as a rotation.',
119
+ semanticRole: 'identifier',
120
+ importance: FieldSemanticImportance.PRIMARY,
121
+ }),
122
+ enabled: schemaShape.enabled.booleanSpec({
123
+ meaning: 'Whether this credential may be spent.',
124
+ whyItMatters: 'Disabling stops the application acting as this person without discarding the credential. Unlike the tenant-owned sibling, a disabled credential does NOT degrade to a shared principal — the call refuses, which is the intended outcome: somebody switching their own connection off is asking the application to stop acting as them.',
125
+ }),
126
+ validationState: schemaShape.validationState.enumSpec({
127
+ meaning: 'Whether the provider has accepted this credential on its last use.',
128
+ whyItMatters: 'Separates "never tried" from "tried and rejected", which a boolean would merge into the same falsy answer. For a personal credential this badge is the only notice the holder will get that their integration has stopped working — nobody else can rotate it for them.',
129
+ values: {
130
+ [ProviderCredentialValidationState.UNVALIDATED]: {
131
+ meaning: 'Stored, never exercised against the provider. Every credential starts here — storing one proves only that somebody typed it.',
132
+ },
133
+ [ProviderCredentialValidationState.VALID]: {
134
+ meaning: 'The provider accepted it on its last use.',
135
+ },
136
+ [ProviderCredentialValidationState.INVALID]: {
137
+ meaning: 'The provider rejected it on its last use; the integration is down until the holder rotates it.',
138
+ },
139
+ },
140
+ enumDeclaration: {
141
+ packageName: '@wildo-ai/saas-models',
142
+ exportName: 'ProviderCredentialValidationState',
143
+ symbolKind: CodeSymbolKind.ENUM,
144
+ declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,
145
+ },
146
+ }),
147
+ validationError: schemaShape.validationError.stringSpec({
148
+ meaning: "The provider's own message about why the last use failed.",
149
+ whyItMatters: 'Turns "it stopped working" into a vendor-attributed reason the holder can act on. Server-owned: it describes the credential\'s status and is never derived from the credential.',
150
+ }),
151
+ lastValidatedAt: schemaShape.lastValidatedAt.dateSpec({
152
+ meaning: 'When the provider last accepted or rejected this credential.',
153
+ whyItMatters: 'How current the validation state is — a `VALID` from three months ago says less than one from this morning.',
154
+ temporalRole: 'modified',
155
+ }),
156
+ lastUsedAt: schemaShape.lastUsedAt.dateSpec({
157
+ meaning: 'When this credential was last resolved for an outbound call.',
158
+ whyItMatters: 'Shows the holder what the application is actually doing as them. A credential nothing has spent in months is the one safest to disconnect, and the one riskiest to leave live.',
159
+ temporalRole: 'modified',
160
+ }),
161
+ secretSetAt: schemaShape.secretSetAt.dateSpec({
162
+ meaning: 'When the stored VALUE last changed.',
163
+ whyItMatters: 'Distinct from `updatedAt`, which any field write moves. This is the one that answers "did I rotate this after the vendor warned me?".',
164
+ temporalRole: 'modified',
165
+ }),
166
+ description: schemaShape.description.stringSpec({
167
+ meaning: "The holder's own note — which account, which environment, why this credential exists.",
168
+ whyItMatters: 'Somebody may hold several credentials for one provider across slugs; the note is what tells them apart in a list.',
169
+ }),
170
+ createdAt: schemaShape.createdAt.dateSpec({
171
+ meaning: 'When the credential was first stored.',
172
+ whyItMatters: 'When this person first granted the application authority toward this provider.',
173
+ temporalRole: 'creation',
174
+ }),
175
+ updatedAt: schemaShape.updatedAt.dateSpec({
176
+ meaning: 'When any field last changed.',
177
+ whyItMatters: 'Ordering for the credential list.',
178
+ temporalRole: 'modified',
179
+ }),
180
+ },
181
+ operations: {
182
+ [Op.READ]: {
183
+ purpose: 'Inspect one of your own stored provider credentials.',
184
+ outcome: 'The holder sees which provider and slug the credential covers, whether it is enabled, and whether the provider last accepted it — with the value masked.',
185
+ importance: FieldSemanticImportance.PRIMARY,
186
+ responseStatuses: [
187
+ { code: HttpResponseStatusCode.OK_200, meaning: "The credential was found in the caller's own scope and returned with `secretValue` masked." },
188
+ ],
189
+ errorScenarios: [
190
+ { code: HttpResponseStatusCode.NOT_FOUND_404, when: "No credential with that id belongs to the caller. Another person's credential is indistinguishable from one that does not exist — there is no variant, for any role, that can address somebody else's." },
191
+ ],
192
+ idempotent: true,
193
+ examples: [{
194
+ title: 'Inspect the personal OpenAI key',
195
+ request: { userProviderCredentialId: CREDENTIAL_EXAMPLE_ID },
196
+ response: CREDENTIAL_RECORD_EXAMPLE,
197
+ forStatus: HttpResponseStatusCode.OK_200,
198
+ }],
199
+ },
200
+ [Op.LIST]: {
201
+ purpose: 'List your own provider credentials — which third parties you have connected.',
202
+ outcome: 'The holder sees every provider they have connected and the health of each.',
203
+ responseStatuses: [
204
+ { code: HttpResponseStatusCode.OK_200, meaning: "A (possibly empty) page of the caller's OWN credentials, values masked." },
205
+ ],
206
+ errorScenarios: [],
207
+ idempotent: true,
208
+ examples: [{
209
+ title: 'List my connected accounts',
210
+ request: { page: 1, limit: 20, sort: 'createdAt:desc' },
211
+ response: CREDENTIAL_PAGE_EXAMPLE,
212
+ forStatus: HttpResponseStatusCode.OK_200,
213
+ }],
214
+ },
215
+ [Op.CREATE]: {
216
+ purpose: 'Store your own credential for a provider, so the application acts as YOU toward that third party.',
217
+ outcome: "Outbound calls this application makes on your behalf to that provider use your own credential, so the vendor attributes the work to your account and applies the permissions you granted.",
218
+ whenToUse: 'When you connect a provider with a credential you obtained yourself — a personal API key, an account you authorized.',
219
+ importance: FieldSemanticImportance.PRIMARY,
220
+ responseStatuses: [
221
+ { code: HttpResponseStatusCode.CREATED_201, meaning: 'The credential was sealed and stored. The response masks the value; it is never readable again.' },
222
+ ],
223
+ errorScenarios: [
224
+ { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The payload fails validation, or `secretValue` is empty.', errorCode: 'VALIDATION_FAILED' },
225
+ { code: HttpResponseStatusCode.CONFLICT_409, when: 'You already hold a credential for this provider and slug — rotate that one instead of creating a second.' },
226
+ ],
227
+ idempotent: false,
228
+ examples: [{
229
+ title: 'Connect my own OpenAI account',
230
+ request: {
231
+ providerRef: 'openai',
232
+ secretSlug: 'OPENAI_API_KEY',
233
+ secretValue: 'sk-my-own-personal-key',
234
+ description: 'My personal key, so my drafts are billed to me.',
235
+ },
236
+ response: CREDENTIAL_RECORD_EXAMPLE,
237
+ forStatus: HttpResponseStatusCode.CREATED_201,
238
+ }],
239
+ },
240
+ [Op.UPDATE]: {
241
+ purpose: 'Rotate your stored credential, or edit its note and enabled flag.',
242
+ outcome: 'A new value replaces the old one immediately — there is no overlap window, because the vendor is the authority on which credential is live and only one of them is.',
243
+ whenToUse: 'After reissuing the credential at the vendor, or to stop the application acting as you without disconnecting.',
244
+ importance: FieldSemanticImportance.PRIMARY,
245
+ responseStatuses: [
246
+ { code: HttpResponseStatusCode.OK_200, meaning: 'The credential was updated. A payload carrying a new `secretValue` re-seals it and is recorded as a rotation; one echoing the mask leaves the stored secret untouched.' },
247
+ ],
248
+ errorScenarios: [
249
+ { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The payload fails validation.', errorCode: 'VALIDATION_FAILED' },
250
+ { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No credential with that id belongs to the caller.' },
251
+ ],
252
+ idempotent: true,
253
+ examples: [{
254
+ title: 'Rotate the key after reissuing it at the vendor',
255
+ request: { userProviderCredentialId: CREDENTIAL_EXAMPLE_ID, secretValue: 'sk-my-newly-issued-key' },
256
+ response: CREDENTIAL_RECORD_EXAMPLE,
257
+ forStatus: HttpResponseStatusCode.OK_200,
258
+ }],
259
+ },
260
+ [Op.DELETE]: {
261
+ purpose: 'Disconnect your account at a provider.',
262
+ outcome: 'The application stops acting as you toward that provider. Calls that named you as the connection are REFUSED by name — there is no fallback to the deployment\'s or your organization\'s credential, because either would act as a party you did not authorize.',
263
+ whenToUse: 'When you disconnect the provider, or when you believe the credential is compromised and rotation is not enough.',
264
+ importance: FieldSemanticImportance.PRIMARY,
265
+ responseStatuses: [
266
+ { code: HttpResponseStatusCode.NO_CONTENT_204, meaning: 'The credential was removed. No body.' },
267
+ ],
268
+ errorScenarios: [
269
+ { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No credential with that id belongs to the caller, including one already removed.' },
270
+ ],
271
+ idempotent: true,
272
+ examples: [{
273
+ title: 'Disconnect my OpenAI account',
274
+ request: { userProviderCredentialId: CREDENTIAL_EXAMPLE_ID },
275
+ forStatus: HttpResponseStatusCode.NO_CONTENT_204,
276
+ }],
277
+ },
278
+ [Op.UPDATE_MANY]: {
279
+ purpose: 'Route-less retention plumbing.',
280
+ outcome: 'Nothing is scrubbed in practice: this resource declares `RETAIN_ONLY`, because a secret is not pseudonymised — it is destroyed. The operation exists because the retention contract requires READ + LIST + UPDATE_MANY to resolve, and a declared-but-unresolvable operation fails when an erasure actually runs.',
281
+ responseStatuses: [
282
+ { code: HttpResponseStatusCode.OK_200, meaning: 'The matching records were processed. INTERNAL_CALL — it registers no HTTP route.' },
283
+ ],
284
+ errorScenarios: [
285
+ { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The filter fails validation.', errorCode: 'VALIDATION_FAILED' },
286
+ ],
287
+ },
288
+ },
289
+ businessConstraints: [
290
+ 'The uniqueness grain is `(userId, providerRef, secretSlug)`, enforced by a compound unique index rather than a read-then-write. Saving a rotation twice in the same minute would otherwise leave two rows, and the resolver would pick between them arbitrarily — so half the holder\'s outbound calls would carry the retired credential with nothing to say which half.',
291
+ 'A person\'s credential has NO fallback, in either direction. Their organization\'s credential is not a next-best owner and neither is the deployment\'s: a call that named this person and could not resolve them is REFUSED, because the vendor records the act under whichever identity was actually spent and that record outlives us.',
292
+ 'Nobody but the holder may read, spend, rotate or remove one. There is no administrative variant at any tier — consent to STORE a personal credential is not consent for somebody else to use it.',
293
+ 'A subject erasure DOES reach this resource, and destroying the row is the correct treatment. `retentionPolicy` is RETAIN_ONLY rather than retain-and-impersonalize because a secret cannot be pseudonymised: an impersonalized row would keep key material that still opens against a person who asked to be forgotten. The `USERS` composition cascade removes these rows when the subject is erased.',
294
+ '`exportSubject` is FORBIDDEN, and it matters more here than on the organization-owned sibling. That row is unreachable on the subject-export graph by construction; this one is reachable BY construction, because it hangs off the subject. The refusal is what stands between a subject-access request and a working credential in the response.',
295
+ ],
296
+ }), { resourcePrimaryScope: ResourcePrimaryScope.USER_SELF });
297
+ //# sourceMappingURL=user-provider-credentials.resource.specification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-provider-credentials.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/auth/resources/user-provider-credentials.resource.specification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;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Ac,EAAE;gBACd,EAAE,IAAI,EAAE,sBAAsB,CAAC,aAAa,EAAE,IAAI,EAAE,kFAAkF,EAAE;aACzI;YACD,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,CAAC;oBACT,KAAK,EAAE,8BAA8B;oBACrC,OAAO,EAAE,EAAE,wBAAwB,EAAE,qBAAqB,EAAE;oBAC5D,SAAS,EAAE,sBAAsB,CAAC,cAAc;iBACjD,CAAC;SACH;QACD,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE;YAChB,OAAO,EAAE,gCAAgC;YACzC,OAAO,EACL,mTAAmT;YACrT,gBAAgB,EAAE;gBAChB,EAAE,IAAI,EAAE,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,kFAAkF,EAAE;aACrI;YACD,cAAc,EAAE;gBACd,EAAE,IAAI,EAAE,sBAAsB,CAAC,eAAe,EAAE,IAAI,EAAE,8BAA8B,EAAE,SAAS,EAAE,mBAAmB,EAAE;aACvH;SACF;KACF;IAED,mBAAmB,EAAE;QACnB,2WAA2W;QAC3W,2UAA2U;QAC3U,kMAAkM;QAClM,wYAAwY;QACxY,oVAAoV;KACrV;CACF,CAAC,EACF,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,SAAS,EAAE,CACzD,CAAC","sourcesContent":["/**\n * Resource: `userProviderCredentials` — Wildo SaaS engine specification\n * (user-self-scoped, backend-managed secret).\n *\n * Inputs:\n * - Schema: engine/saas-models/src/security/connected-accounts/provider-credentials.shared.schemas.ts\n * → `UserProviderCredentialSchema`\n * - Factory: engine/saas-models/src/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.ts\n * → `userProviderCredentialsResourceConfiguration_InitializationFactory`\n * - Custom operations: none\n * - UI presets: `engine/presets-components/src/config/resources/security.resource-presets.tsx`\n * → `USER_PROVIDER_CREDENTIALS`, reached through the `my-provider-credentials` settings destination.\n */\n\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport {\n CodeDeclarationKind,\n CodeSymbolKind,\n FieldSemanticImportance,\n} from '@wildo-ai/zod-decorators';\nimport {\n CoreResourceOperation as Op,\n ProviderCredentialValidationState,\n ResourcePrimaryScope,\n UserProviderCredentialSchema,\n userProviderCredentialsResourceConfiguration_InitializationFactory,\n} from '@wildo-ai/saas-models';\nimport { HttpResponseStatusCode, resourceSpecification } from '~wildo-specifications/_core';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\nconst CREDENTIAL_EXAMPLE_ID = 'usrprovcred_01J7K2M4N6P8Q0R2S4T6V8W0XY';\nconst CREDENTIAL_EXAMPLE_USER_ID = 'user_01J4M1Z2X3C4V5B6N7M8Q9R0ST';\n\n/**\n * The record as a client sees it — with the value MASKED.\n *\n * That mask is not decoration in an example: `secretValue` is `.isWriteOnlySecret()`, so the\n * framework redacts it at the client boundary on every read. Showing a plausible token here would\n * teach an integrator that a credential can be read back, which is the one thing this resource\n * guarantees it cannot.\n */\nconst CREDENTIAL_RECORD_EXAMPLE = {\n _id: CREDENTIAL_EXAMPLE_ID,\n userId: CREDENTIAL_EXAMPLE_USER_ID,\n providerRef: 'openai',\n secretSlug: 'OPENAI_API_KEY',\n secretValue: '••••••••',\n enabled: true,\n validationState: ProviderCredentialValidationState.VALID,\n lastValidatedAt: '2026-09-02T11:14:00.000Z',\n lastUsedAt: '2026-09-02T11:14:00.000Z',\n secretSetAt: '2026-08-30T09:00:00.000Z',\n description: 'My personal key, so my drafts are billed to me.',\n createdAt: '2026-08-30T09:00:00.000Z',\n updatedAt: '2026-09-02T11:14:00.000Z',\n} as const;\n\nconst CREDENTIAL_PAGE_EXAMPLE = {\n data: [CREDENTIAL_RECORD_EXAMPLE],\n pagination: { page: 1, limit: 20, total: 1, totalPages: 1 },\n} as const;\n\nexport const userProviderCredentialsResourceSpecification = resourceSpecification(\n userProviderCredentialsResourceConfiguration_InitializationFactory,\n UserProviderCredentialSchema,\n ({ schemaShape }) => ({\n purpose:\n \"One PERSON's OWN credential toward a third-party provider — their personal API key, the account they connected themselves.\",\n businessRole:\n \"The record that lets an application act as an individual toward a third party rather than as the tenant or as itself. It is what makes a personal integration possible — work attributed to the person at the vendor, billed to their account, and carrying only the permissions they granted.\",\n lifecycleRole:\n 'Created by the holder when they connect a provider, rotated in place when they reissue the credential at the vendor, disabled to stop the application acting as them without discarding the credential, and removed when they disconnect the provider or their own account is erased.',\n audience: LabelAudience.DEVELOPER,\n subDomain: EngineResourceSubDomain.AUTH,\n codeHandling: {\n mainSchema: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'UserProviderCredentialSchema',\n symbolKind: CodeSymbolKind.SCHEMA,\n declarationKind: CodeDeclarationKind.ZOD_SCHEMA,\n },\n resourceFactory: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'userProviderCredentialsResourceConfiguration_InitializationFactory',\n symbolKind: CodeSymbolKind.FACTORY,\n declarationKind: CodeDeclarationKind.FUNCTION,\n },\n resourceType: {\n enumDeclaration: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'CoreResourceType',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n },\n memberName: 'USER_PROVIDER_CREDENTIALS',\n },\n operationVocabulary: {\n coreEnum: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'CoreResourceOperation',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n },\n },\n notes: [\n 'The stored value is SEALED, never the plaintext the holder typed: an AES-256-GCM envelope whose key is derived from the application\\'s own `secrets.security.session.encryptionKey`. The USER scope selects a DIFFERENT key domain from the organization-owned sibling, so a person\\'s envelope cannot be opened as a tenant\\'s even with a matching owner id — and the associated data binds it to (userId, providerRef, secretSlug), so a ciphertext copied into another person\\'s row fails to open rather than silently working.',\n 'Every door is APP_USER and there is deliberately NO administrative variant — not an organization administrator\\'s, not a platform operator\\'s. Consenting to STORE a personal credential is not consenting for somebody else to spend it, and the vendor records the resulting act as the holder\\'s, which no later audit event makes reversible.',\n 'There is NO resolution fallback. A person who has connected nothing gets a refusal naming what to connect — never the deployment\\'s shared principal and never their organization\\'s credential. Substituting either would attribute the act to a party that granted no permission for it.',\n 'A row appears in TWO ways, and only one of them is an HTTP write. A credential you PASTE arrives through `CREATE` below. A credential a vendor MINTS arrives through the authorization exchange: you authorize on the vendor\\'s own consent screen, come back through one shared callback, and the application records the grant — you never see or type the token. The second path is why this resource permits a system-tier create at all.',\n 'Set, rotate, use and delete are audited as `USER_PROVIDER_CREDENTIAL_*`, annotated `WILDO.IDENTITY.DELEGATED_AUTHORIZATION`. None of the four payload schemas has a field the value could occupy, and none carries an organization — a person\\'s connections must not reach their tenant\\'s SIEM stream.',\n ],\n },\n\n fields: {\n _id: schemaShape._id.stringSpec({\n meaning: 'Identifier for one stored credential.',\n whyItMatters: 'The address for a rotation or a revocation, and the id every audit event carries.',\n semanticRole: 'identifier',\n importance: FieldSemanticImportance.PRIMARY,\n }),\n userId: schemaShape.userId.foreignKeySpec({\n meaning: 'The person who owns this credential.',\n whyItMatters:\n 'The isolation axis, and here it is also the SUBJECT. Injected by the framework from the authenticated scope rather than read from the payload, it scopes every read, and it is bound into the encryption envelope — so a credential cannot be read, spent or moved outside the person who set it. It is what makes \"another user\\'s key\" unreachable rather than merely filtered.',\n importance: FieldSemanticImportance.PRIMARY,\n }),\n providerRef: schemaShape.providerRef.stringSpec({\n meaning: 'The provider this credential authenticates toward — `openai`, `slack`, a generated provider package\\'s ref.',\n whyItMatters: 'Half of the credential\\'s identity for its holder, and what tells them which third parties they have granted the application authority toward.',\n semanticRole: 'identifier',\n importance: FieldSemanticImportance.PRIMARY,\n }),\n secretSlug: schemaShape.secretSlug.stringSpec({\n meaning: \"The slug in the provider's `secretsContract` that this value satisfies.\",\n whyItMatters:\n 'A provider declaring several secrets (an API key and a signing secret) gets one row per slug, so the holder can rotate one without disturbing the other.',\n semanticRole: 'identifier',\n importance: FieldSemanticImportance.PRIMARY,\n }),\n secretValue: schemaShape.secretValue.stringSpec({\n meaning: 'The credential itself. Supplied in plaintext on write, stored SEALED, and never returned — a read renders a fixed mask.',\n whyItMatters:\n 'Echoing the mask back on an update means \"keep the stored secret\", which is how the holder edits a note without retyping the credential. Sending a real value replaces it and is recorded as a rotation.',\n semanticRole: 'identifier',\n importance: FieldSemanticImportance.PRIMARY,\n }),\n enabled: schemaShape.enabled.booleanSpec({\n meaning: 'Whether this credential may be spent.',\n whyItMatters:\n 'Disabling stops the application acting as this person without discarding the credential. Unlike the tenant-owned sibling, a disabled credential does NOT degrade to a shared principal — the call refuses, which is the intended outcome: somebody switching their own connection off is asking the application to stop acting as them.',\n }),\n validationState: schemaShape.validationState.enumSpec({\n meaning: 'Whether the provider has accepted this credential on its last use.',\n whyItMatters:\n 'Separates \"never tried\" from \"tried and rejected\", which a boolean would merge into the same falsy answer. For a personal credential this badge is the only notice the holder will get that their integration has stopped working — nobody else can rotate it for them.',\n values: {\n [ProviderCredentialValidationState.UNVALIDATED]: {\n meaning: 'Stored, never exercised against the provider. Every credential starts here — storing one proves only that somebody typed it.',\n },\n [ProviderCredentialValidationState.VALID]: {\n meaning: 'The provider accepted it on its last use.',\n },\n [ProviderCredentialValidationState.INVALID]: {\n meaning: 'The provider rejected it on its last use; the integration is down until the holder rotates it.',\n },\n },\n enumDeclaration: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'ProviderCredentialValidationState',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n },\n }),\n validationError: schemaShape.validationError.stringSpec({\n meaning: \"The provider's own message about why the last use failed.\",\n whyItMatters:\n 'Turns \"it stopped working\" into a vendor-attributed reason the holder can act on. Server-owned: it describes the credential\\'s status and is never derived from the credential.',\n }),\n lastValidatedAt: schemaShape.lastValidatedAt.dateSpec({\n meaning: 'When the provider last accepted or rejected this credential.',\n whyItMatters: 'How current the validation state is — a `VALID` from three months ago says less than one from this morning.',\n temporalRole: 'modified',\n }),\n lastUsedAt: schemaShape.lastUsedAt.dateSpec({\n meaning: 'When this credential was last resolved for an outbound call.',\n whyItMatters:\n 'Shows the holder what the application is actually doing as them. A credential nothing has spent in months is the one safest to disconnect, and the one riskiest to leave live.',\n temporalRole: 'modified',\n }),\n secretSetAt: schemaShape.secretSetAt.dateSpec({\n meaning: 'When the stored VALUE last changed.',\n whyItMatters: 'Distinct from `updatedAt`, which any field write moves. This is the one that answers \"did I rotate this after the vendor warned me?\".',\n temporalRole: 'modified',\n }),\n description: schemaShape.description.stringSpec({\n meaning: \"The holder's own note — which account, which environment, why this credential exists.\",\n whyItMatters: 'Somebody may hold several credentials for one provider across slugs; the note is what tells them apart in a list.',\n }),\n createdAt: schemaShape.createdAt.dateSpec({\n meaning: 'When the credential was first stored.',\n whyItMatters: 'When this person first granted the application authority toward this provider.',\n temporalRole: 'creation',\n }),\n updatedAt: schemaShape.updatedAt.dateSpec({\n meaning: 'When any field last changed.',\n whyItMatters: 'Ordering for the credential list.',\n temporalRole: 'modified',\n }),\n },\n\n operations: {\n [Op.READ]: {\n purpose: 'Inspect one of your own stored provider credentials.',\n outcome: 'The holder sees which provider and slug the credential covers, whether it is enabled, and whether the provider last accepted it — with the value masked.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: \"The credential was found in the caller's own scope and returned with `secretValue` masked.\" },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: \"No credential with that id belongs to the caller. Another person's credential is indistinguishable from one that does not exist — there is no variant, for any role, that can address somebody else's.\" },\n ],\n idempotent: true,\n examples: [{\n title: 'Inspect the personal OpenAI key',\n request: { userProviderCredentialId: CREDENTIAL_EXAMPLE_ID },\n response: CREDENTIAL_RECORD_EXAMPLE,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [Op.LIST]: {\n purpose: 'List your own provider credentials — which third parties you have connected.',\n outcome: 'The holder sees every provider they have connected and the health of each.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: \"A (possibly empty) page of the caller's OWN credentials, values masked.\" },\n ],\n errorScenarios: [],\n idempotent: true,\n examples: [{\n title: 'List my connected accounts',\n request: { page: 1, limit: 20, sort: 'createdAt:desc' },\n response: CREDENTIAL_PAGE_EXAMPLE,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [Op.CREATE]: {\n purpose: 'Store your own credential for a provider, so the application acts as YOU toward that third party.',\n outcome: \"Outbound calls this application makes on your behalf to that provider use your own credential, so the vendor attributes the work to your account and applies the permissions you granted.\",\n whenToUse: 'When you connect a provider with a credential you obtained yourself — a personal API key, an account you authorized.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'The credential was sealed and stored. The response masks the value; it is never readable again.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The payload fails validation, or `secretValue` is empty.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'You already hold a credential for this provider and slug — rotate that one instead of creating a second.' },\n ],\n idempotent: false,\n examples: [{\n title: 'Connect my own OpenAI account',\n request: {\n providerRef: 'openai',\n secretSlug: 'OPENAI_API_KEY',\n secretValue: 'sk-my-own-personal-key',\n description: 'My personal key, so my drafts are billed to me.',\n },\n response: CREDENTIAL_RECORD_EXAMPLE,\n forStatus: HttpResponseStatusCode.CREATED_201,\n }],\n },\n [Op.UPDATE]: {\n purpose: 'Rotate your stored credential, or edit its note and enabled flag.',\n outcome: 'A new value replaces the old one immediately — there is no overlap window, because the vendor is the authority on which credential is live and only one of them is.',\n whenToUse: 'After reissuing the credential at the vendor, or to stop the application acting as you without disconnecting.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The credential was updated. A payload carrying a new `secretValue` re-seals it and is recorded as a rotation; one echoing the mask leaves the stored secret untouched.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The payload fails validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No credential with that id belongs to the caller.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Rotate the key after reissuing it at the vendor',\n request: { userProviderCredentialId: CREDENTIAL_EXAMPLE_ID, secretValue: 'sk-my-newly-issued-key' },\n response: CREDENTIAL_RECORD_EXAMPLE,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [Op.DELETE]: {\n purpose: 'Disconnect your account at a provider.',\n outcome:\n 'The application stops acting as you toward that provider. Calls that named you as the connection are REFUSED by name — there is no fallback to the deployment\\'s or your organization\\'s credential, because either would act as a party you did not authorize.',\n whenToUse: 'When you disconnect the provider, or when you believe the credential is compromised and rotation is not enough.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [\n { code: HttpResponseStatusCode.NO_CONTENT_204, meaning: 'The credential was removed. No body.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No credential with that id belongs to the caller, including one already removed.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Disconnect my OpenAI account',\n request: { userProviderCredentialId: CREDENTIAL_EXAMPLE_ID },\n forStatus: HttpResponseStatusCode.NO_CONTENT_204,\n }],\n },\n [Op.UPDATE_MANY]: {\n purpose: 'Route-less retention plumbing.',\n outcome:\n 'Nothing is scrubbed in practice: this resource declares `RETAIN_ONLY`, because a secret is not pseudonymised — it is destroyed. The operation exists because the retention contract requires READ + LIST + UPDATE_MANY to resolve, and a declared-but-unresolvable operation fails when an erasure actually runs.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The matching records were processed. INTERNAL_CALL — it registers no HTTP route.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The filter fails validation.', errorCode: 'VALIDATION_FAILED' },\n ],\n },\n },\n\n businessConstraints: [\n 'The uniqueness grain is `(userId, providerRef, secretSlug)`, enforced by a compound unique index rather than a read-then-write. Saving a rotation twice in the same minute would otherwise leave two rows, and the resolver would pick between them arbitrarily — so half the holder\\'s outbound calls would carry the retired credential with nothing to say which half.',\n 'A person\\'s credential has NO fallback, in either direction. Their organization\\'s credential is not a next-best owner and neither is the deployment\\'s: a call that named this person and could not resolve them is REFUSED, because the vendor records the act under whichever identity was actually spent and that record outlives us.',\n 'Nobody but the holder may read, spend, rotate or remove one. There is no administrative variant at any tier — consent to STORE a personal credential is not consent for somebody else to use it.',\n 'A subject erasure DOES reach this resource, and destroying the row is the correct treatment. `retentionPolicy` is RETAIN_ONLY rather than retain-and-impersonalize because a secret cannot be pseudonymised: an impersonalized row would keep key material that still opens against a person who asked to be forgotten. The `USERS` composition cascade removes these rows when the subject is erased.',\n '`exportSubject` is FORBIDDEN, and it matters more here than on the organization-owned sibling. That row is unreachable on the subject-export graph by construction; this one is reachable BY construction, because it hangs off the subject. The refusal is what stands between a subject-access request and a working credential in the response.',\n ],\n }),\n { resourcePrimaryScope: ResourcePrimaryScope.USER_SELF },\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"billing-accounts.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/billing-accounts.resource.specification.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,yBAAyB,EAEzB,qBAAqB,IAAI,EAAE,EAI5B,MAAM,uBAAuB,CAAC;AAmW/B,eAAO,MAAM,gDAAgD;;;;;;;;iCAG5D,CAAC;AAEF,eAAO,MAAM,wCAAwC;;;;;;;;iCAGpD,CAAC"}
1
+ {"version":3,"file":"billing-accounts.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/billing-accounts.resource.specification.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,yBAAyB,EAEzB,qBAAqB,IAAI,EAAE,EAI5B,MAAM,uBAAuB,CAAC;AAoW/B,eAAO,MAAM,gDAAgD;;;;;;;;iCAG5D,CAAC;AAEF,eAAO,MAAM,wCAAwC;;;;;;;;iCAGpD,CAAC"}
@@ -63,12 +63,12 @@ function buildBillingAccountBase(resourceType, resourceTypeMemberName) {
63
63
  notes: ['Two variants under `BILLING_SCOPE_VARIANTS` — org primary catalog scope is `ORGANIZATIONS`; user row is `USER_SELF`.'],
64
64
  },
65
65
  fields: {
66
- _id: schemaShape._id.stringSpec({ meaning: 'Document id in Mongo for this billing account row.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),
66
+ _id: schemaShape._id.stringSpec({ meaning: 'Document id in Mongo for this billing account record.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),
67
67
  isActive: schemaShape.isActive.booleanSpec({ meaning: 'Whether the account should participate in new purchases and portal sessions.', importance: FieldSemanticImportance.PRIMARY }),
68
68
  providerRef: schemaShape.providerRef.stringSpec({ meaning: 'Which billing adapter integration backs this account (e.g. stripe) — backend-only in typical responses.', whyItMatters: 'Drives which SDK and webhook namespace hydrate the row.' }),
69
69
  providerCustomerId: schemaShape.providerCustomerId.stringSpec({ meaning: 'Provider-side customer id; master link for subscription and invoice fetch.', whyItMatters: 'Without it the row cannot call provider APIs for portal or state.', importance: FieldSemanticImportance.PRIMARY }),
70
70
  metadata: schemaShape.metadata.objectSpec({ meaning: 'Key/value tags mirrored to the provider for analytics or tax hints — not the full address book.' }),
71
- createdAt: schemaShape.createdAt.dateSpec({ meaning: 'When the row was first created.', temporalRole: 'creation' }),
71
+ createdAt: schemaShape.createdAt.dateSpec({ meaning: 'When the record was first created.', temporalRole: 'creation' }),
72
72
  updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'Last backend sync with provider or local patch.', temporalRole: 'modified' }),
73
73
  },
74
74
  operations: {
@@ -171,7 +171,7 @@ function buildBillingAccountBase(resourceType, resourceTypeMemberName) {
171
171
  purpose: 'Metadata or activation toggles; heavy provider writes often go through webhooks or custom ops instead.',
172
172
  outcome: 'Patched `metadata` or `isActive` per DTO in factory config.',
173
173
  responseStatuses: [
174
- { code: HttpResponseStatusCode.OK_200, meaning: 'The account’s `metadata` / `isActive` fields were patched and the updated row is returned.' },
174
+ { code: HttpResponseStatusCode.OK_200, meaning: 'The account’s `metadata` / `isActive` fields were patched and the updated record is returned.' },
175
175
  ],
176
176
  errorScenarios: [
177
177
  { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The edited fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },
@@ -207,6 +207,7 @@ function buildBillingAccountBase(resourceType, resourceTypeMemberName) {
207
207
  { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller does not own this billing account and may not open checkout for it.' },
208
208
  { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id, or the referenced price is not in the catalog.' },
209
209
  { code: HttpResponseStatusCode.CONFLICT_409, when: 'The account is inactive or has no linked provider customer, so a checkout session cannot be opened.' },
210
+ { code: HttpResponseStatusCode.CONFLICT_409, when: '`productKey` (or the price named by `priceId`) has been RETIRED — the product left the code catalogue and the catalogue sync soft-retired it. It still exists, and existing subscribers keep it, but it may no longer be bought: its entitlements are frozen at whatever the last sync wrote and nobody maintains them.', errorCode: 'BILLING_PRODUCT_RETIRED' },
210
211
  ],
211
212
  idempotent: false,
212
213
  examples: [{
@@ -1 +1 @@
1
- {"version":3,"file":"billing-accounts.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/billing-accounts.resource.specification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxG,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,IAAI,EAAE,EAC3B,gBAAgB,EAChB,oBAAoB,EACpB,mCAAmC,GACpC,MAAM,uBAAuB,CAAC;AAC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C,CAAC;IACjI,MAAM,KAAK,GAAG,uBAAuB,CAAC,mBAAuD,EAAE,YAAY,EAAE,qBAAqB,CAAC,CAAC;IACpI,OAAO,8CAA8C,CACnD,mCAAmC,CAAC,6BAA6B,CAAC,IAAI,CAAC,EAAE,6BAA6B,CAAC,KAAK,CAAC,CAAC,EAC9G,IAAI,EACJ,GAAG,EAAE,CAAC,CAAC;QACL,KAAK,EAAE,EAAE,OAAO,EAAE,+GAA+G,EAAE;QACnI,MAAM,EAAE;YACN,OAAO,EAAE,6OAA6O;YACtP,cAAc,EAAE,2OAA2O;SAC5P;QACD,KAAK,EAAE;YACL,CAAC,yBAAyB,CAAC,aAAa,CAAC,EAAE,EAAE,OAAO,EAAE,8EAA8E,EAAE,SAAS,EAAE,0EAA0E,EAAE;YAC7N,CAAC,yBAAyB,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,yHAAyH,EAAE,SAAS,EAAE,iDAAiD,EAAE;YAC7O,CAAC,yBAAyB,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,2EAA2E,EAAE,SAAS,EAAE,4DAA4D,EAAE;SACzM;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,gDAAgD,GAAG,wCAAwC,CACtG,gBAAgB,CAAC,6BAA6B,EAC9C,+BAA+B,CAChC,CAAC;AAEF,MAAM,CAAC,MAAM,wCAAwC,GAAG,wCAAwC,CAC9F,gBAAgB,CAAC,qBAAqB,EACtC,uBAAuB,CACxB,CAAC","sourcesContent":["import { billingAdminPresets, billingMainPresets } from '@wildo-ai/presets-components';\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport type { ResourceUIBehaviorConfig } from '@wildo-ai/saas-frontend-lib/companion';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n BillingAccount_Operations,\n BillingAccountBaseSchema,\n CoreResourceOperation as Op,\n CoreResourceType,\n ResourcePrimaryScope,\n billingAccountsPolymorphicFactories,\n} from '@wildo-ai/saas-models';\nimport {\n HttpResponseStatusCode,\n mergeResourceFrontendConfigurations,\n resourceFrontendConfiguration,\n resourceSpecification,\n resourceSpecificationFromFrontendConfiguration,\n} from '~wildo-specifications/_core';\nimport {\n BILLING_API_REFERENCE_PAGE_REQUEST,\n billingApiReferencePage,\n createBillingApiReferenceScopeExample,\n type BillingApiReferenceExampleScope,\n} from './billing-api-reference-examples';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\ntype BillingAccountResourceType = CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS | CoreResourceType.USER_BILLING_ACCOUNTS;\ntype BillingAccountResourceTypeMember = 'ORGANIZATION_BILLING_ACCOUNTS' | 'USER_BILLING_ACCOUNTS';\n\nconst billingAccountResourcePrimaryScopeByResourceType: Record<BillingAccountResourceType, BillingApiReferenceExampleScope> = {\n [CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.USER_BILLING_ACCOUNTS]: ResourcePrimaryScope.USER_SELF,\n};\n\ntype Cfg = ReturnType<(typeof billingAccountsPolymorphicFactories)[CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS]>;\ntype Custom = NonNullable<Cfg['customOperation']>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = typeof BillingAccountBaseSchema;\ntype BillAcctFrontend = ResourceUIBehaviorConfig<Custom, Core, Main>;\n\nfunction resolveBillingAccountUI(\n source: Partial<Record<string, unknown>>,\n resourceType: BillingAccountResourceType,\n sourceName: string,\n): BillAcctFrontend {\n const uiBehavior = source[resourceType] as BillAcctFrontend | undefined;\n if (!uiBehavior) {\n throw new Error(`Missing \"${resourceType}\" UI behavior in ${sourceName}.`);\n }\n return uiBehavior;\n}\n\nfunction buildBillingAccountBase(\n resourceType: BillingAccountResourceType,\n resourceTypeMemberName: BillingAccountResourceTypeMember,\n) {\n const exampleScope = createBillingApiReferenceScopeExample(\n billingAccountResourcePrimaryScopeByResourceType[resourceType],\n );\n const billingAccountExample = {\n _id: exampleScope.billingAccountId,\n isActive: true,\n metadata: { costCentre: 'customer-success' },\n createdAt: '2026-06-01T09:00:00.000Z',\n updatedAt: '2026-06-18T14:30:00.000Z',\n ...exampleScope.scopeIdentity,\n };\n const billingAccountSummaryExample = {\n _id: billingAccountExample._id,\n isActive: billingAccountExample.isActive,\n };\n\n return resourceSpecification<Custom, Core, Main>(\n billingAccountsPolymorphicFactories[resourceType],\n BillingAccountBaseSchema,\n ({ schemaShape }) => ({\n purpose:\n `Billing account for ${exampleScope.scopeLabel === 'organization' ? 'an organization' : 'a user'}: exposes activation state and safe metadata, and provides the entry point for checkout, the billing portal, and aggregated billing state.`,\n businessRole: 'Anchor row for subscriptions, invoices, credit pools, and self-serve `OPEN_CHECKOUT` / `OPEN_PORTAL` flows in user/org billing settings.',\n lifecycleRole:\n 'Created automatically the first time billing state is requested, then synchronized from billing-provider events. An inactive account remains readable for billing history but cannot start a new checkout or portal session. There is no client-facing create operation.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.BILLING,\n codeHandling: {\n mainSchema: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'BillingAccountBaseSchema',\n symbolKind: CodeSymbolKind.SCHEMA,\n declarationKind: CodeDeclarationKind.ZOD_SCHEMA,\n },\n resourceFactoryCollectionEntry: {\n collectionSymbol: { packageName: '@wildo-ai/saas-models', exportName: 'billingAccountsPolymorphicFactories', symbolKind: CodeSymbolKind.FACTORY },\n identifierField: 'collectionKey',\n identifierValue: resourceType,\n },\n resourceType: {\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n memberName: resourceTypeMemberName,\n },\n operationVocabulary: {\n coreEnum: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceOperation', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n customEnum: { packageName: '@wildo-ai/saas-models', exportName: 'BillingAccount_Operations', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n },\n frontendConfigurationSourceEntries: [\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingMainPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingAdminPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n ],\n notes: ['Two variants under `BILLING_SCOPE_VARIANTS` — org primary catalog scope is `ORGANIZATIONS`; user row is `USER_SELF`.'],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Document id in Mongo for this billing account row.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n isActive: schemaShape.isActive.booleanSpec({ meaning: 'Whether the account should participate in new purchases and portal sessions.', importance: FieldSemanticImportance.PRIMARY }),\n providerRef: schemaShape.providerRef.stringSpec({ meaning: 'Which billing adapter integration backs this account (e.g. stripe) — backend-only in typical responses.', whyItMatters: 'Drives which SDK and webhook namespace hydrate the row.' }),\n providerCustomerId: schemaShape.providerCustomerId.stringSpec({ meaning: 'Provider-side customer id; master link for subscription and invoice fetch.', whyItMatters: 'Without it the row cannot call provider APIs for portal or state.', importance: FieldSemanticImportance.PRIMARY }),\n metadata: schemaShape.metadata.objectSpec({ meaning: 'Key/value tags mirrored to the provider for analytics or tax hints — not the full address book.' }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'When the row was first created.', temporalRole: 'creation' }),\n updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'Last backend sync with provider or local patch.', temporalRole: 'modified' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Load the account row and derived UI flags for settings surfaces.',\n outcome: 'Owner sees the account id, activation state, and non-sensitive metadata needed for support correlation. Provider customer identifiers remain backend-only.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The billing account was found and its public id, activation state, and metadata are returned. Backend-only provider identifiers are omitted.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n examples: [{\n title: `Inspect an active ${exampleScope.scopeLabel} billing account`,\n response: billingAccountExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Inspect the billing account with available relationship context',\n response: billingAccountExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Inspect the compact billing-account summary',\n response: billingAccountSummaryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.LIST]: {\n purpose: 'List billing account rows in org or user scope (often singleton).',\n outcome: 'Picker or table for rare multi-account orgs in admin.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty, often singleton) page of billing accounts for the scope.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Browse billing accounts for the current scope',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([billingAccountExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Browse billing accounts with relationship context',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([billingAccountExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Browse compact billing-account summaries',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([billingAccountSummaryExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.CREATE]: {\n purpose: 'System-context bootstrap when a scope first needs a billing account: auto-created in-process by the billing service (INTERNAL_CALL, no HTTP surface) through the `systemAccessPolicy.create` opt-in, which injects the scope FK via the execution context map.',\n outcome: 'New row for the scope after provider customer linkage in implementation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A billing account was provisioned for the scope (with its provider customer linked) and is returned with its server-assigned id.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The account payload fails schema validation (e.g. missing `providerRef`).', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the entitlement to provision a billing account in this scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'A billing account already links this scope to the provider customer (the scope→customer link is unique).', errorCode: 'BILLING_ACCOUNT_EXISTS' },\n ],\n idempotent: false,\n examples: [\n {\n title: 'Provision a Stripe-backed billing account for a scope',\n request: {\n providerRef: 'stripe',\n providerCustomerId: 'cus_01HX2…',\n isActive: true,\n metadata: { tier: 'pro' },\n },\n response: {\n _id: 'billacct_01HX2…',\n providerRef: 'stripe',\n providerCustomerId: 'cus_01HX2…',\n isActive: true,\n },\n forStatus: HttpResponseStatusCode.CREATED_201,\n },\n ],\n },\n [Op.UPDATE]: {\n purpose: 'Metadata or activation toggles; heavy provider writes often go through webhooks or custom ops instead.',\n outcome: 'Patched `metadata` or `isActive` per DTO in factory config.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The account’s `metadata` / `isActive` fields were patched and the updated row is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The edited fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the entitlement to mutate this billing account.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n },\n [Op.DELETE]: {\n purpose: 'Dangerous off-boarding: in-process hard removal of the account row (INTERNAL_CALL, no HTTP surface). The product off-boarding path is the soft retire (`isActive: false`), not this.',\n outcome: 'Row removed — but only once the account has no retained financial children left. The dependents check is enforced by the engine before the delete, not left to the caller.',\n responseStatuses: [\n { code: HttpResponseStatusCode.NO_CONTENT_204, meaning: 'The billing account had no retained financial children and was removed; no body is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the elevated entitlement required for billing-account off-boarding.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id (or it was already removed).' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The account still has retained financial children — subscriptions, invoice refs, usage records, or credit pools — that reference it. Those rows survive scope and account deletion by design (billing-retention decision), and this account holds the only local `providerCustomerId` that maps them back to the provider customer, so the delete fails closed. The blocking families are named in the error context.', errorCode: 'BILLING_ACCOUNT_HAS_DEPENDENTS' },\n ],\n idempotent: true,\n },\n [BillingAccount_Operations.OPEN_CHECKOUT]: {\n operationId: BillingAccount_Operations.OPEN_CHECKOUT,\n purpose: 'Start a hosted checkout session (product+price) for the connected customer.',\n outcome: 'Redirect URL or client secret to complete purchase in the provider UI.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A provider checkout session was created; the redirect URL / client secret to complete the purchase is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The requested product/price is missing or malformed in the checkout request.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'A caller-supplied `metadata` key uses the framework-reserved `wildo_` namespace, or `quantity` is not an integer within the supported bound. Reserved keys are refused rather than dropped: that namespace carries the values the completion webhook reads back to decide which account is credited and by how much.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: '`priceId` names a price whose `productId` is not `productKey`’s product. The provider is billed the PRICE while the purchase is recorded against the PRODUCT, so an unmatched pair would deliver one product’s goods at another’s price.', errorCode: 'BILLING_PRICE_PRODUCT_MISMATCH' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller does not own this billing account and may not open checkout for it.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id, or the referenced price is not in the catalog.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The account is inactive or has no linked provider customer, so a checkout session cannot be opened.' },\n ],\n idempotent: false,\n examples: [{\n title: 'Open checkout for the Pro plan',\n request: {\n productKey: 'pro_plan',\n priceId: 'price_pro_monthly',\n successUrl: 'https://app.example.test/settings/billing?checkout=success',\n cancelUrl: 'https://app.example.test/settings/billing?checkout=cancelled',\n quantity: 25,\n promotionCode: 'WELCOME20',\n metadata: { campaign: 'customer-expansion' },\n },\n response: {\n url: 'https://billing.example.test/checkout/cs_01HX2EXAMPLE',\n sessionId: 'cs_01HX2EXAMPLE',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingAccount_Operations.OPEN_PORTAL]: {\n operationId: BillingAccount_Operations.OPEN_PORTAL,\n purpose: 'Open the provider customer portal (payment methods, cancel at period end) with a return URL.',\n outcome: 'Session URL for self-serve management.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A provider customer-portal session was created; its session URL is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller does not own this billing account and may not open its portal.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id in the caller’s scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The account has no linked provider customer, so a portal session cannot be opened.' },\n ],\n idempotent: false,\n examples: [{\n title: 'Open the hosted billing portal',\n request: { returnUrl: 'https://app.example.test/settings/billing' },\n response: { url: 'https://billing.example.test/portal/bps_01HX2EXAMPLE' },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingAccount_Operations.GET_STATE]: {\n operationId: BillingAccount_Operations.GET_STATE,\n purpose: 'Collection-scoped aggregate read of account + subscriptions + catalog slices for billing home widgets. The billing service auto-creates the scope’s account when none exists.',\n outcome: 'Convenience bundle for a single call instead of N reads in the client; the absence of an existing account is a bootstrap condition, not a 404.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The denormalized billing snapshot (account + subscriptions + catalog slices) is returned in one bundle.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The authenticated request context does not contain the scope identifier required to resolve billing state.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The requested scope does not match the caller’s authenticated scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'Billing is not enabled for this scope type.', errorCode: 'BILLING_SCOPE_NOT_ENABLED' },\n ],\n idempotent: true,\n examples: [{\n title: 'Load the billing home state before a subscription exists',\n response: {\n billingAccount: {\n _id: billingAccountExample._id,\n isActive: true,\n createdAt: billingAccountExample.createdAt,\n updatedAt: billingAccountExample.updatedAt,\n },\n subscription: null,\n products: [],\n prices: [],\n invoices: [],\n usage: { byProduct: {} },\n creditPools: {},\n activePromotions: [],\n scopeType: exampleScope.scopeType,\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n businessConstraints: [\n 'Contact, tax, and payment instruments live in the provider — do not expect them duplicated on this document.',\n 'Checkout-session metadata is split by trust: keys prefixed `wildo_` are framework-authoritative (they are what the signed completion webhook reads back to credit an account), and caller-supplied keys in that namespace are refused at the request DTO. A provider signature proves the provider sent the echoed metadata, never that the framework wrote it, so the completion handler re-derives the billing account from the provider CUSTOMER and only cross-checks the echoed value.',\n 'Polymorphic scope FKs (`organizationId` / `userId`) are injected on concrete variant schemas, not on `BillingAccountBaseSchema` itself.',\n 'The account outlives its scope: deleting the owning org or user does NOT cascade to this row, and its financial children (subscriptions, invoice refs, usage records, credit pools) are retained too. Consequently a hard DELETE is refused with 409 while any of those children remain — this row carries the only local `providerCustomerId`, so removing it would leave the retained financial records unreconcilable against the provider.',\n ],\n }),\n { resourcePrimaryScope: billingAccountResourcePrimaryScopeByResourceType[resourceType] },\n );\n}\n\nfunction buildBillingAccountResourceSpecification(\n resourceType: BillingAccountResourceType,\n memberName: BillingAccountResourceTypeMember,\n) {\n const base = buildBillingAccountBase(resourceType, memberName);\n const main = resolveBillingAccountUI(billingMainPresets as Partial<Record<string, unknown>>, resourceType, 'billingMainPresets');\n const admin = resolveBillingAccountUI(billingAdminPresets as Partial<Record<string, unknown>>, resourceType, 'billingAdminPresets');\n return resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(main), resourceFrontendConfiguration(admin)),\n base,\n () => ({\n label: { purpose: 'Preset uses the Mongo id string as a compact label when the row is the anchor for self-serve and admin lists.' },\n layout: {\n purpose: 'Inline summary template (no named `layout.refs.sections` in billing presets) shows `isActive` and `_id`; `variantOverrides` wire subscription/invoice/usage/credit child tabs in org vs user parent views at different `orderIndex` values.',\n displayPurpose: 'Not a public directory — org-owner/org-admin or user self-serve billing surfaces; LIST/READ are org-owner/org-admin-gated API operations, while writes (auto-create + webhook sync) stay internal service-pipeline ops, not HTTP-exposed.',\n },\n views: {\n [BillingAccount_Operations.OPEN_CHECKOUT]: { purpose: 'Custom flow entry that behaves like a purchase wizard linked to the account.', whenToUse: '“Upgrade” or “Buy credits” in product UI when checkout is the next step.' },\n [BillingAccount_Operations.OPEN_PORTAL]: { purpose: 'Custom flow entry for hosted portal; non-addressable `views` entry in merged presets (still documented as surfaced op).', whenToUse: '“Manage payment method / invoices” in settings.' },\n [BillingAccount_Operations.GET_STATE]: { purpose: 'Aggregate “billing snapshot” for dashboards; not a CRUD read replacement.', whenToUse: 'Billing home that needs a denormalized bundle in one call.' },\n },\n }),\n );\n}\n\nexport const organizationBillingAccountsResourceSpecification = buildBillingAccountResourceSpecification(\n CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS,\n 'ORGANIZATION_BILLING_ACCOUNTS',\n);\n\nexport const userBillingAccountsResourceSpecification = buildBillingAccountResourceSpecification(\n CoreResourceType.USER_BILLING_ACCOUNTS,\n 'USER_BILLING_ACCOUNTS',\n);\n"]}
1
+ {"version":3,"file":"billing-accounts.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/billing-accounts.resource.specification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxG,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,IAAI,EAAE,EAC3B,gBAAgB,EAChB,oBAAoB,EACpB,mCAAmC,GACpC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,sBAAsB,EACtB,mCAAmC,EACnC,6BAA6B,EAC7B,qBAAqB,EACrB,8CAA8C,GAC/C,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kCAAkC,EAClC,uBAAuB,EACvB,qCAAqC,GAEtC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAK3E,MAAM,gDAAgD,GAAwE;IAC5H,CAAC,gBAAgB,CAAC,6BAA6B,CAAC,EAAE,oBAAoB,CAAC,aAAa;IACpF,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,EAAE,oBAAoB,CAAC,SAAS;CACzE,CAAC;AAQF,SAAS,uBAAuB,CAC9B,MAAwC,EACxC,YAAwC,EACxC,UAAkB;IAElB,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAiC,CAAC;IACxE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,YAAY,YAAY,oBAAoB,UAAU,GAAG,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,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AC,yBAAyB,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,2EAA2E,EAAE,SAAS,EAAE,4DAA4D,EAAE;SACzM;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,gDAAgD,GAAG,wCAAwC,CACtG,gBAAgB,CAAC,6BAA6B,EAC9C,+BAA+B,CAChC,CAAC;AAEF,MAAM,CAAC,MAAM,wCAAwC,GAAG,wCAAwC,CAC9F,gBAAgB,CAAC,qBAAqB,EACtC,uBAAuB,CACxB,CAAC","sourcesContent":["import { billingAdminPresets, billingMainPresets } from '@wildo-ai/presets-components';\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport type { ResourceUIBehaviorConfig } from '@wildo-ai/saas-frontend-lib/companion';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n BillingAccount_Operations,\n BillingAccountBaseSchema,\n CoreResourceOperation as Op,\n CoreResourceType,\n ResourcePrimaryScope,\n billingAccountsPolymorphicFactories,\n} from '@wildo-ai/saas-models';\nimport {\n HttpResponseStatusCode,\n mergeResourceFrontendConfigurations,\n resourceFrontendConfiguration,\n resourceSpecification,\n resourceSpecificationFromFrontendConfiguration,\n} from '~wildo-specifications/_core';\nimport {\n BILLING_API_REFERENCE_PAGE_REQUEST,\n billingApiReferencePage,\n createBillingApiReferenceScopeExample,\n type BillingApiReferenceExampleScope,\n} from './billing-api-reference-examples';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\ntype BillingAccountResourceType = CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS | CoreResourceType.USER_BILLING_ACCOUNTS;\ntype BillingAccountResourceTypeMember = 'ORGANIZATION_BILLING_ACCOUNTS' | 'USER_BILLING_ACCOUNTS';\n\nconst billingAccountResourcePrimaryScopeByResourceType: Record<BillingAccountResourceType, BillingApiReferenceExampleScope> = {\n [CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.USER_BILLING_ACCOUNTS]: ResourcePrimaryScope.USER_SELF,\n};\n\ntype Cfg = ReturnType<(typeof billingAccountsPolymorphicFactories)[CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS]>;\ntype Custom = NonNullable<Cfg['customOperation']>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = typeof BillingAccountBaseSchema;\ntype BillAcctFrontend = ResourceUIBehaviorConfig<Custom, Core, Main>;\n\nfunction resolveBillingAccountUI(\n source: Partial<Record<string, unknown>>,\n resourceType: BillingAccountResourceType,\n sourceName: string,\n): BillAcctFrontend {\n const uiBehavior = source[resourceType] as BillAcctFrontend | undefined;\n if (!uiBehavior) {\n throw new Error(`Missing \"${resourceType}\" UI behavior in ${sourceName}.`);\n }\n return uiBehavior;\n}\n\nfunction buildBillingAccountBase(\n resourceType: BillingAccountResourceType,\n resourceTypeMemberName: BillingAccountResourceTypeMember,\n) {\n const exampleScope = createBillingApiReferenceScopeExample(\n billingAccountResourcePrimaryScopeByResourceType[resourceType],\n );\n const billingAccountExample = {\n _id: exampleScope.billingAccountId,\n isActive: true,\n metadata: { costCentre: 'customer-success' },\n createdAt: '2026-06-01T09:00:00.000Z',\n updatedAt: '2026-06-18T14:30:00.000Z',\n ...exampleScope.scopeIdentity,\n };\n const billingAccountSummaryExample = {\n _id: billingAccountExample._id,\n isActive: billingAccountExample.isActive,\n };\n\n return resourceSpecification<Custom, Core, Main>(\n billingAccountsPolymorphicFactories[resourceType],\n BillingAccountBaseSchema,\n ({ schemaShape }) => ({\n purpose:\n `Billing account for ${exampleScope.scopeLabel === 'organization' ? 'an organization' : 'a user'}: exposes activation state and safe metadata, and provides the entry point for checkout, the billing portal, and aggregated billing state.`,\n businessRole: 'Anchor row for subscriptions, invoices, credit pools, and self-serve `OPEN_CHECKOUT` / `OPEN_PORTAL` flows in user/org billing settings.',\n lifecycleRole:\n 'Created automatically the first time billing state is requested, then synchronized from billing-provider events. An inactive account remains readable for billing history but cannot start a new checkout or portal session. There is no client-facing create operation.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.BILLING,\n codeHandling: {\n mainSchema: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'BillingAccountBaseSchema',\n symbolKind: CodeSymbolKind.SCHEMA,\n declarationKind: CodeDeclarationKind.ZOD_SCHEMA,\n },\n resourceFactoryCollectionEntry: {\n collectionSymbol: { packageName: '@wildo-ai/saas-models', exportName: 'billingAccountsPolymorphicFactories', symbolKind: CodeSymbolKind.FACTORY },\n identifierField: 'collectionKey',\n identifierValue: resourceType,\n },\n resourceType: {\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n memberName: resourceTypeMemberName,\n },\n operationVocabulary: {\n coreEnum: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceOperation', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n customEnum: { packageName: '@wildo-ai/saas-models', exportName: 'BillingAccount_Operations', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n },\n frontendConfigurationSourceEntries: [\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingMainPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingAdminPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n ],\n notes: ['Two variants under `BILLING_SCOPE_VARIANTS` — org primary catalog scope is `ORGANIZATIONS`; user row is `USER_SELF`.'],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Document id in Mongo for this billing account record.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n isActive: schemaShape.isActive.booleanSpec({ meaning: 'Whether the account should participate in new purchases and portal sessions.', importance: FieldSemanticImportance.PRIMARY }),\n providerRef: schemaShape.providerRef.stringSpec({ meaning: 'Which billing adapter integration backs this account (e.g. stripe) — backend-only in typical responses.', whyItMatters: 'Drives which SDK and webhook namespace hydrate the row.' }),\n providerCustomerId: schemaShape.providerCustomerId.stringSpec({ meaning: 'Provider-side customer id; master link for subscription and invoice fetch.', whyItMatters: 'Without it the row cannot call provider APIs for portal or state.', importance: FieldSemanticImportance.PRIMARY }),\n metadata: schemaShape.metadata.objectSpec({ meaning: 'Key/value tags mirrored to the provider for analytics or tax hints — not the full address book.' }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'When the record was first created.', temporalRole: 'creation' }),\n updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'Last backend sync with provider or local patch.', temporalRole: 'modified' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Load the account row and derived UI flags for settings surfaces.',\n outcome: 'Owner sees the account id, activation state, and non-sensitive metadata needed for support correlation. Provider customer identifiers remain backend-only.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The billing account was found and its public id, activation state, and metadata are returned. Backend-only provider identifiers are omitted.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n examples: [{\n title: `Inspect an active ${exampleScope.scopeLabel} billing account`,\n response: billingAccountExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Inspect the billing account with available relationship context',\n response: billingAccountExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Inspect the compact billing-account summary',\n response: billingAccountSummaryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.LIST]: {\n purpose: 'List billing account rows in org or user scope (often singleton).',\n outcome: 'Picker or table for rare multi-account orgs in admin.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty, often singleton) page of billing accounts for the scope.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Browse billing accounts for the current scope',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([billingAccountExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Browse billing accounts with relationship context',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([billingAccountExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Browse compact billing-account summaries',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([billingAccountSummaryExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.CREATE]: {\n purpose: 'System-context bootstrap when a scope first needs a billing account: auto-created in-process by the billing service (INTERNAL_CALL, no HTTP surface) through the `systemAccessPolicy.create` opt-in, which injects the scope FK via the execution context map.',\n outcome: 'New row for the scope after provider customer linkage in implementation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A billing account was provisioned for the scope (with its provider customer linked) and is returned with its server-assigned id.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The account payload fails schema validation (e.g. missing `providerRef`).', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the entitlement to provision a billing account in this scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'A billing account already links this scope to the provider customer (the scope→customer link is unique).', errorCode: 'BILLING_ACCOUNT_EXISTS' },\n ],\n idempotent: false,\n examples: [\n {\n title: 'Provision a Stripe-backed billing account for a scope',\n request: {\n providerRef: 'stripe',\n providerCustomerId: 'cus_01HX2…',\n isActive: true,\n metadata: { tier: 'pro' },\n },\n response: {\n _id: 'billacct_01HX2…',\n providerRef: 'stripe',\n providerCustomerId: 'cus_01HX2…',\n isActive: true,\n },\n forStatus: HttpResponseStatusCode.CREATED_201,\n },\n ],\n },\n [Op.UPDATE]: {\n purpose: 'Metadata or activation toggles; heavy provider writes often go through webhooks or custom ops instead.',\n outcome: 'Patched `metadata` or `isActive` per DTO in factory config.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The account’s `metadata` / `isActive` fields were patched and the updated record is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The edited fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the entitlement to mutate this billing account.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n },\n [Op.DELETE]: {\n purpose: 'Dangerous off-boarding: in-process hard removal of the account row (INTERNAL_CALL, no HTTP surface). The product off-boarding path is the soft retire (`isActive: false`), not this.',\n outcome: 'Row removed — but only once the account has no retained financial children left. The dependents check is enforced by the engine before the delete, not left to the caller.',\n responseStatuses: [\n { code: HttpResponseStatusCode.NO_CONTENT_204, meaning: 'The billing account had no retained financial children and was removed; no body is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the elevated entitlement required for billing-account off-boarding.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id (or it was already removed).' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The account still has retained financial children — subscriptions, invoice refs, usage records, or credit pools — that reference it. Those rows survive scope and account deletion by design (billing-retention decision), and this account holds the only local `providerCustomerId` that maps them back to the provider customer, so the delete fails closed. The blocking families are named in the error context.', errorCode: 'BILLING_ACCOUNT_HAS_DEPENDENTS' },\n ],\n idempotent: true,\n },\n [BillingAccount_Operations.OPEN_CHECKOUT]: {\n operationId: BillingAccount_Operations.OPEN_CHECKOUT,\n purpose: 'Start a hosted checkout session (product+price) for the connected customer.',\n outcome: 'Redirect URL or client secret to complete purchase in the provider UI.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A provider checkout session was created; the redirect URL / client secret to complete the purchase is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The requested product/price is missing or malformed in the checkout request.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'A caller-supplied `metadata` key uses the framework-reserved `wildo_` namespace, or `quantity` is not an integer within the supported bound. Reserved keys are refused rather than dropped: that namespace carries the values the completion webhook reads back to decide which account is credited and by how much.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: '`priceId` names a price whose `productId` is not `productKey`’s product. The provider is billed the PRICE while the purchase is recorded against the PRODUCT, so an unmatched pair would deliver one product’s goods at another’s price.', errorCode: 'BILLING_PRICE_PRODUCT_MISMATCH' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller does not own this billing account and may not open checkout for it.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id, or the referenced price is not in the catalog.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The account is inactive or has no linked provider customer, so a checkout session cannot be opened.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: '`productKey` (or the price named by `priceId`) has been RETIRED — the product left the code catalogue and the catalogue sync soft-retired it. It still exists, and existing subscribers keep it, but it may no longer be bought: its entitlements are frozen at whatever the last sync wrote and nobody maintains them.', errorCode: 'BILLING_PRODUCT_RETIRED' },\n ],\n idempotent: false,\n examples: [{\n title: 'Open checkout for the Pro plan',\n request: {\n productKey: 'pro_plan',\n priceId: 'price_pro_monthly',\n successUrl: 'https://app.example.test/settings/billing?checkout=success',\n cancelUrl: 'https://app.example.test/settings/billing?checkout=cancelled',\n quantity: 25,\n promotionCode: 'WELCOME20',\n metadata: { campaign: 'customer-expansion' },\n },\n response: {\n url: 'https://billing.example.test/checkout/cs_01HX2EXAMPLE',\n sessionId: 'cs_01HX2EXAMPLE',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingAccount_Operations.OPEN_PORTAL]: {\n operationId: BillingAccount_Operations.OPEN_PORTAL,\n purpose: 'Open the provider customer portal (payment methods, cancel at period end) with a return URL.',\n outcome: 'Session URL for self-serve management.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A provider customer-portal session was created; its session URL is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller does not own this billing account and may not open its portal.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id in the caller’s scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The account has no linked provider customer, so a portal session cannot be opened.' },\n ],\n idempotent: false,\n examples: [{\n title: 'Open the hosted billing portal',\n request: { returnUrl: 'https://app.example.test/settings/billing' },\n response: { url: 'https://billing.example.test/portal/bps_01HX2EXAMPLE' },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingAccount_Operations.GET_STATE]: {\n operationId: BillingAccount_Operations.GET_STATE,\n purpose: 'Collection-scoped aggregate read of account + subscriptions + catalog slices for billing home widgets. The billing service auto-creates the scope’s account when none exists.',\n outcome: 'Convenience bundle for a single call instead of N reads in the client; the absence of an existing account is a bootstrap condition, not a 404.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The denormalized billing snapshot (account + subscriptions + catalog slices) is returned in one bundle.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The authenticated request context does not contain the scope identifier required to resolve billing state.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The requested scope does not match the caller’s authenticated scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'Billing is not enabled for this scope type.', errorCode: 'BILLING_SCOPE_NOT_ENABLED' },\n ],\n idempotent: true,\n examples: [{\n title: 'Load the billing home state before a subscription exists',\n response: {\n billingAccount: {\n _id: billingAccountExample._id,\n isActive: true,\n createdAt: billingAccountExample.createdAt,\n updatedAt: billingAccountExample.updatedAt,\n },\n subscription: null,\n products: [],\n prices: [],\n invoices: [],\n usage: { byProduct: {} },\n creditPools: {},\n activePromotions: [],\n scopeType: exampleScope.scopeType,\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n businessConstraints: [\n 'Contact, tax, and payment instruments live in the provider — do not expect them duplicated on this document.',\n 'Checkout-session metadata is split by trust: keys prefixed `wildo_` are framework-authoritative (they are what the signed completion webhook reads back to credit an account), and caller-supplied keys in that namespace are refused at the request DTO. A provider signature proves the provider sent the echoed metadata, never that the framework wrote it, so the completion handler re-derives the billing account from the provider CUSTOMER and only cross-checks the echoed value.',\n 'Polymorphic scope FKs (`organizationId` / `userId`) are injected on concrete variant schemas, not on `BillingAccountBaseSchema` itself.',\n 'The account outlives its scope: deleting the owning org or user does NOT cascade to this row, and its financial children (subscriptions, invoice refs, usage records, credit pools) are retained too. Consequently a hard DELETE is refused with 409 while any of those children remain — this row carries the only local `providerCustomerId`, so removing it would leave the retained financial records unreconcilable against the provider.',\n ],\n }),\n { resourcePrimaryScope: billingAccountResourcePrimaryScopeByResourceType[resourceType] },\n );\n}\n\nfunction buildBillingAccountResourceSpecification(\n resourceType: BillingAccountResourceType,\n memberName: BillingAccountResourceTypeMember,\n) {\n const base = buildBillingAccountBase(resourceType, memberName);\n const main = resolveBillingAccountUI(billingMainPresets as Partial<Record<string, unknown>>, resourceType, 'billingMainPresets');\n const admin = resolveBillingAccountUI(billingAdminPresets as Partial<Record<string, unknown>>, resourceType, 'billingAdminPresets');\n return resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(main), resourceFrontendConfiguration(admin)),\n base,\n () => ({\n label: { purpose: 'Preset uses the Mongo id string as a compact label when the row is the anchor for self-serve and admin lists.' },\n layout: {\n purpose: 'Inline summary template (no named `layout.refs.sections` in billing presets) shows `isActive` and `_id`; `variantOverrides` wire subscription/invoice/usage/credit child tabs in org vs user parent views at different `orderIndex` values.',\n displayPurpose: 'Not a public directory — org-owner/org-admin or user self-serve billing surfaces; LIST/READ are org-owner/org-admin-gated API operations, while writes (auto-create + webhook sync) stay internal service-pipeline ops, not HTTP-exposed.',\n },\n views: {\n [BillingAccount_Operations.OPEN_CHECKOUT]: { purpose: 'Custom flow entry that behaves like a purchase wizard linked to the account.', whenToUse: '“Upgrade” or “Buy credits” in product UI when checkout is the next step.' },\n [BillingAccount_Operations.OPEN_PORTAL]: { purpose: 'Custom flow entry for hosted portal; non-addressable `views` entry in merged presets (still documented as surfaced op).', whenToUse: '“Manage payment method / invoices” in settings.' },\n [BillingAccount_Operations.GET_STATE]: { purpose: 'Aggregate “billing snapshot” for dashboards; not a CRUD read replacement.', whenToUse: 'Billing home that needs a denormalized bundle in one call.' },\n },\n }),\n );\n}\n\nexport const organizationBillingAccountsResourceSpecification = buildBillingAccountResourceSpecification(\n CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS,\n 'ORGANIZATION_BILLING_ACCOUNTS',\n);\n\nexport const userBillingAccountsResourceSpecification = buildBillingAccountResourceSpecification(\n CoreResourceType.USER_BILLING_ACCOUNTS,\n 'USER_BILLING_ACCOUNTS',\n);\n"]}
@@ -47,7 +47,7 @@ function buildCreditPoolBase(resourceType, memberName) {
47
47
  available: schemaShape.available.numberSpec({ meaning: 'Spendable credits right now — blocks usage when zero under policy.', importance: FieldSemanticImportance.PRIMARY }),
48
48
  totalPurchased: schemaShape.totalPurchased.numberSpec({ meaning: 'Cumulative top-ups for transparency and support.' }),
49
49
  totalConsumed: schemaShape.totalConsumed.numberSpec({ meaning: 'Cumulative `CONSUME` deductions for lifetime reporting.' }),
50
- createdAt: schemaShape.createdAt.dateSpec({ meaning: 'First pool row creation.', temporalRole: 'creation' }),
50
+ createdAt: schemaShape.createdAt.dateSpec({ meaning: 'First pool record creation.', temporalRole: 'creation' }),
51
51
  updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'Last balance change.', temporalRole: 'modified' }),
52
52
  },
53
53
  operations: {
@@ -107,7 +107,7 @@ function buildCreditPoolBase(resourceType, memberName) {
107
107
  purpose: 'System-level adjustments when not using custom ops; prefer `TOP_UP` / `CONSUME` in services.',
108
108
  outcome: 'Patched non-editable fields per factory rules in edge cases.',
109
109
  responseStatuses: [
110
- { code: HttpResponseStatusCode.OK_200, meaning: 'The pool row was patched and the updated balances are returned.' },
110
+ { code: HttpResponseStatusCode.OK_200, meaning: 'The pool record was patched and the updated balances are returned.' },
111
111
  ],
112
112
  errorScenarios: [
113
113
  { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The edited fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },