@wildo-ai/saas-models 1.1.1 → 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 (588) hide show
  1. package/dist/esm/applications/applications-context.schemas.d.ts +16 -10
  2. package/dist/esm/applications/applications-context.schemas.d.ts.map +1 -1
  3. package/dist/esm/applications/applications.shared.resources-config.schemas.d.ts.map +1 -1
  4. package/dist/esm/applications/applications.shared.resources-config.schemas.js +4 -3
  5. package/dist/esm/applications/applications.shared.resources-config.schemas.js.map +1 -1
  6. package/dist/esm/billing/billing-account.shared.resources-config.schemas.d.ts +1 -1
  7. package/dist/esm/billing/billing-account.shared.resources-config.schemas.d.ts.map +1 -1
  8. package/dist/esm/billing/billing-account.shared.resources-config.schemas.js +36 -0
  9. package/dist/esm/billing/billing-account.shared.resources-config.schemas.js.map +1 -1
  10. package/dist/esm/billing/billing-account.shared.schemas.d.ts.map +1 -1
  11. package/dist/esm/billing/billing-account.shared.schemas.js +8 -1
  12. package/dist/esm/billing/billing-account.shared.schemas.js.map +1 -1
  13. package/dist/esm/billing/billing-configuration.shared.schemas.d.ts +0 -4
  14. package/dist/esm/billing/billing-configuration.shared.schemas.d.ts.map +1 -1
  15. package/dist/esm/billing/billing-configuration.shared.schemas.js +59 -17
  16. package/dist/esm/billing/billing-configuration.shared.schemas.js.map +1 -1
  17. package/dist/esm/billing/billing-enums.shared.schemas.d.ts +77 -21
  18. package/dist/esm/billing/billing-enums.shared.schemas.d.ts.map +1 -1
  19. package/dist/esm/billing/billing-enums.shared.schemas.js +85 -23
  20. package/dist/esm/billing/billing-enums.shared.schemas.js.map +1 -1
  21. package/dist/esm/billing/billing-types.shared.schemas.d.ts +5 -5
  22. package/dist/esm/billing/credit-pool.shared.resources-config.schemas.d.ts +1 -1
  23. package/dist/esm/billing/credit-pool.shared.resources-config.schemas.d.ts.map +1 -1
  24. package/dist/esm/billing/credit-pool.shared.resources-config.schemas.js +39 -0
  25. package/dist/esm/billing/credit-pool.shared.resources-config.schemas.js.map +1 -1
  26. package/dist/esm/billing/credit-pool.shared.schemas.d.ts +6 -6
  27. package/dist/esm/billing/credit-pool.shared.schemas.d.ts.map +1 -1
  28. package/dist/esm/billing/credit-pool.shared.schemas.js +8 -4
  29. package/dist/esm/billing/credit-pool.shared.schemas.js.map +1 -1
  30. package/dist/esm/billing/invoice-ref.shared.resources-config.schemas.d.ts +1 -1
  31. package/dist/esm/billing/invoice-ref.shared.resources-config.schemas.d.ts.map +1 -1
  32. package/dist/esm/billing/invoice-ref.shared.resources-config.schemas.js +35 -0
  33. package/dist/esm/billing/invoice-ref.shared.resources-config.schemas.js.map +1 -1
  34. package/dist/esm/billing/invoice-ref.shared.schemas.d.ts.map +1 -1
  35. package/dist/esm/billing/invoice-ref.shared.schemas.js +8 -3
  36. package/dist/esm/billing/invoice-ref.shared.schemas.js.map +1 -1
  37. package/dist/esm/billing/price.shared.schemas.d.ts.map +1 -1
  38. package/dist/esm/billing/price.shared.schemas.js +7 -1
  39. package/dist/esm/billing/price.shared.schemas.js.map +1 -1
  40. package/dist/esm/billing/product-behavior-policy.shared.schemas.d.ts.map +1 -1
  41. package/dist/esm/billing/product-behavior-policy.shared.schemas.js +52 -11
  42. package/dist/esm/billing/product-behavior-policy.shared.schemas.js.map +1 -1
  43. package/dist/esm/billing/product-definition.shared.schemas.d.ts +2 -2
  44. package/dist/esm/billing/product.shared.resources-config.schemas.d.ts +2 -2
  45. package/dist/esm/billing/product.shared.schemas.d.ts +2 -2
  46. package/dist/esm/billing/product.shared.schemas.d.ts.map +1 -1
  47. package/dist/esm/billing/product.shared.schemas.js +7 -3
  48. package/dist/esm/billing/product.shared.schemas.js.map +1 -1
  49. package/dist/esm/billing/subscription.shared.resources-config.schemas.d.ts +2 -2
  50. package/dist/esm/billing/subscription.shared.resources-config.schemas.d.ts.map +1 -1
  51. package/dist/esm/billing/subscription.shared.resources-config.schemas.js +54 -1
  52. package/dist/esm/billing/subscription.shared.resources-config.schemas.js.map +1 -1
  53. package/dist/esm/billing/subscription.shared.schemas.d.ts +4 -4
  54. package/dist/esm/billing/subscription.shared.schemas.d.ts.map +1 -1
  55. package/dist/esm/billing/subscription.shared.schemas.js +6 -2
  56. package/dist/esm/billing/subscription.shared.schemas.js.map +1 -1
  57. package/dist/esm/billing/usage-record.shared.resources-config.schemas.d.ts +1 -1
  58. package/dist/esm/billing/usage-record.shared.resources-config.schemas.d.ts.map +1 -1
  59. package/dist/esm/billing/usage-record.shared.resources-config.schemas.js +39 -0
  60. package/dist/esm/billing/usage-record.shared.resources-config.schemas.js.map +1 -1
  61. package/dist/esm/billing/usage-record.shared.schemas.d.ts +11 -7
  62. package/dist/esm/billing/usage-record.shared.schemas.d.ts.map +1 -1
  63. package/dist/esm/billing/usage-record.shared.schemas.js +29 -6
  64. package/dist/esm/billing/usage-record.shared.schemas.js.map +1 -1
  65. package/dist/esm/companion/provider-discovery.shared.schemas.d.ts +69 -2
  66. package/dist/esm/companion/provider-discovery.shared.schemas.d.ts.map +1 -1
  67. package/dist/esm/companion/provider-discovery.shared.schemas.js +20 -1
  68. package/dist/esm/companion/provider-discovery.shared.schemas.js.map +1 -1
  69. package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.d.ts +85 -0
  70. package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.d.ts.map +1 -0
  71. package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.js +157 -0
  72. package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.js.map +1 -0
  73. package/dist/esm/compliance/audit-trails/audit-logs.shared.resources-config.schemas.d.ts.map +1 -1
  74. package/dist/esm/compliance/audit-trails/audit-logs.shared.resources-config.schemas.js +35 -2
  75. package/dist/esm/compliance/audit-trails/audit-logs.shared.resources-config.schemas.js.map +1 -1
  76. package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.d.ts +23 -0
  77. package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.d.ts.map +1 -1
  78. package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.js +56 -0
  79. package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.js.map +1 -1
  80. package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.d.ts +541 -20
  81. package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.d.ts.map +1 -1
  82. package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.js +605 -23
  83. package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.js.map +1 -1
  84. package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.d.ts.map +1 -1
  85. package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.js +96 -3
  86. package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.js.map +1 -1
  87. package/dist/esm/compliance/privacy/impersonalization-scrub.shared.utils.d.ts +49 -0
  88. package/dist/esm/compliance/privacy/impersonalization-scrub.shared.utils.d.ts.map +1 -1
  89. package/dist/esm/compliance/privacy/impersonalization-scrub.shared.utils.js +124 -1
  90. package/dist/esm/compliance/privacy/impersonalization-scrub.shared.utils.js.map +1 -1
  91. package/dist/esm/compliance/privacy/impersonalization.shared.schemas.d.ts +11 -3
  92. package/dist/esm/compliance/privacy/impersonalization.shared.schemas.d.ts.map +1 -1
  93. package/dist/esm/compliance/privacy/impersonalization.shared.schemas.js +11 -3
  94. package/dist/esm/compliance/privacy/impersonalization.shared.schemas.js.map +1 -1
  95. package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.d.ts +94 -0
  96. package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.d.ts.map +1 -0
  97. package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.js +211 -0
  98. package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.js.map +1 -0
  99. package/dist/esm/compliance/privacy/operator-compliance-identity.shared.schemas.d.ts +67 -12
  100. package/dist/esm/compliance/privacy/operator-compliance-identity.shared.schemas.d.ts.map +1 -1
  101. package/dist/esm/compliance/privacy/operator-compliance-identity.shared.schemas.js +95 -8
  102. package/dist/esm/compliance/privacy/operator-compliance-identity.shared.schemas.js.map +1 -1
  103. package/dist/esm/compliance/privacy/privacy.shared.schemas.d.ts +17 -0
  104. package/dist/esm/compliance/privacy/privacy.shared.schemas.d.ts.map +1 -1
  105. package/dist/esm/compliance/privacy/privacy.shared.schemas.js +27 -4
  106. package/dist/esm/compliance/privacy/privacy.shared.schemas.js.map +1 -1
  107. package/dist/esm/compliance/privacy/redaction.shared.schemas.d.ts +89 -16
  108. package/dist/esm/compliance/privacy/redaction.shared.schemas.d.ts.map +1 -1
  109. package/dist/esm/compliance/privacy/redaction.shared.schemas.js +101 -15
  110. package/dist/esm/compliance/privacy/redaction.shared.schemas.js.map +1 -1
  111. package/dist/esm/compliance/privacy/subject-export.shared.schemas.d.ts.map +1 -1
  112. package/dist/esm/compliance/privacy/subject-export.shared.schemas.js +12 -5
  113. package/dist/esm/compliance/privacy/subject-export.shared.schemas.js.map +1 -1
  114. package/dist/esm/config/analytics-value-moments.shared.schemas.d.ts +21 -0
  115. package/dist/esm/config/analytics-value-moments.shared.schemas.d.ts.map +1 -1
  116. package/dist/esm/config/analytics-value-moments.shared.schemas.js +20 -0
  117. package/dist/esm/config/analytics-value-moments.shared.schemas.js.map +1 -1
  118. package/dist/esm/config/app-configuration-shared.shared.schemas.d.ts +9 -5
  119. package/dist/esm/config/app-configuration-shared.shared.schemas.d.ts.map +1 -1
  120. package/dist/esm/config/app-configuration-shared.shared.schemas.js +29 -0
  121. package/dist/esm/config/app-configuration-shared.shared.schemas.js.map +1 -1
  122. package/dist/esm/config/auth-config-resolution.shared.utils.d.ts +8 -1
  123. package/dist/esm/config/auth-config-resolution.shared.utils.d.ts.map +1 -1
  124. package/dist/esm/config/auth-config-resolution.shared.utils.js +29 -0
  125. package/dist/esm/config/auth-config-resolution.shared.utils.js.map +1 -1
  126. package/dist/esm/config/entity-identity-config.shared.schemas.d.ts +95 -17
  127. package/dist/esm/config/entity-identity-config.shared.schemas.d.ts.map +1 -1
  128. package/dist/esm/config/entity-identity-config.shared.schemas.js +86 -8
  129. package/dist/esm/config/entity-identity-config.shared.schemas.js.map +1 -1
  130. package/dist/esm/config/frontend/chart-definition.shared.schemas.d.ts +12 -12
  131. package/dist/esm/config/frontend/navigation.shared.schemas.d.ts +33 -0
  132. package/dist/esm/config/frontend/navigation.shared.schemas.d.ts.map +1 -1
  133. package/dist/esm/config/frontend/navigation.shared.schemas.js +32 -0
  134. package/dist/esm/config/frontend/navigation.shared.schemas.js.map +1 -1
  135. package/dist/esm/errors/errors.custom-message-ref.shared.definitions.d.ts +40 -1
  136. package/dist/esm/errors/errors.custom-message-ref.shared.definitions.d.ts.map +1 -1
  137. package/dist/esm/errors/errors.custom-message-ref.shared.definitions.js +40 -1
  138. package/dist/esm/errors/errors.custom-message-ref.shared.definitions.js.map +1 -1
  139. package/dist/esm/external-data/external-data-pipeline.shared.schemas.d.ts +57 -11
  140. package/dist/esm/external-data/external-data-pipeline.shared.schemas.d.ts.map +1 -1
  141. package/dist/esm/external-data/external-data-pipeline.shared.schemas.js.map +1 -1
  142. package/dist/esm/external-providers/engine-capabilities.shared.schemas.d.ts +109 -64
  143. package/dist/esm/external-providers/engine-capabilities.shared.schemas.d.ts.map +1 -1
  144. package/dist/esm/external-providers/engine-capabilities.shared.schemas.js +200 -19
  145. package/dist/esm/external-providers/engine-capabilities.shared.schemas.js.map +1 -1
  146. package/dist/esm/external-providers/engine-capability-resolution-mode.shared.d.ts +15 -3
  147. package/dist/esm/external-providers/engine-capability-resolution-mode.shared.d.ts.map +1 -1
  148. package/dist/esm/external-providers/engine-capability-resolution-mode.shared.js +32 -7
  149. package/dist/esm/external-providers/engine-capability-resolution-mode.shared.js.map +1 -1
  150. package/dist/esm/external-providers/frontend-bootstrap.shared.schemas.d.ts +84 -7
  151. package/dist/esm/external-providers/frontend-bootstrap.shared.schemas.d.ts.map +1 -1
  152. package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.d.ts +59 -0
  153. package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.d.ts.map +1 -0
  154. package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.js +61 -0
  155. package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.js.map +1 -0
  156. package/dist/esm/external-providers/frontend-capability-runtime.shared.types.d.ts +97 -0
  157. package/dist/esm/external-providers/frontend-capability-runtime.shared.types.d.ts.map +1 -0
  158. package/dist/esm/external-providers/frontend-capability-runtime.shared.types.js +41 -0
  159. package/dist/esm/external-providers/frontend-capability-runtime.shared.types.js.map +1 -0
  160. package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.d.ts +148 -2
  161. package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.d.ts.map +1 -1
  162. package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.js +56 -1
  163. package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.js.map +1 -1
  164. package/dist/esm/external-providers/provider-capability.shared.schemas.d.ts +9 -31
  165. package/dist/esm/external-providers/provider-capability.shared.schemas.d.ts.map +1 -1
  166. package/dist/esm/external-providers/provider-capability.shared.schemas.js +8 -5
  167. package/dist/esm/external-providers/provider-capability.shared.schemas.js.map +1 -1
  168. package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.d.ts +18 -8
  169. package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.d.ts.map +1 -1
  170. package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.js +9 -4
  171. package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.js.map +1 -1
  172. package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.d.ts +338 -0
  173. package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.d.ts.map +1 -0
  174. package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.js +332 -0
  175. package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.js.map +1 -0
  176. package/dist/esm/external-providers/provider-metadata.shared.schemas.d.ts +178 -9
  177. package/dist/esm/external-providers/provider-metadata.shared.schemas.d.ts.map +1 -1
  178. package/dist/esm/external-providers/provider-metadata.shared.schemas.js +181 -9
  179. package/dist/esm/external-providers/provider-metadata.shared.schemas.js.map +1 -1
  180. package/dist/esm/external-providers/provider-protocol.shared.schemas.d.ts +7 -5
  181. package/dist/esm/external-providers/provider-protocol.shared.schemas.d.ts.map +1 -1
  182. package/dist/esm/external-providers/provider-protocol.shared.schemas.js +7 -5
  183. package/dist/esm/external-providers/provider-protocol.shared.schemas.js.map +1 -1
  184. package/dist/esm/external-providers/provider-tier-rule.shared.utils.d.ts +40 -0
  185. package/dist/esm/external-providers/provider-tier-rule.shared.utils.d.ts.map +1 -0
  186. package/dist/esm/external-providers/provider-tier-rule.shared.utils.js +80 -0
  187. package/dist/esm/external-providers/provider-tier-rule.shared.utils.js.map +1 -0
  188. package/dist/esm/features/core-feature-definitions.shared.d.ts.map +1 -1
  189. package/dist/esm/features/core-feature-definitions.shared.js +7 -1
  190. package/dist/esm/features/core-feature-definitions.shared.js.map +1 -1
  191. package/dist/esm/features/feature-builders.shared.d.ts +32 -0
  192. package/dist/esm/features/feature-builders.shared.d.ts.map +1 -1
  193. package/dist/esm/features/feature-builders.shared.js +32 -0
  194. package/dist/esm/features/feature-builders.shared.js.map +1 -1
  195. package/dist/esm/features/user-features.shared.resources-config.schemas.d.ts +1 -1
  196. package/dist/esm/features/user-features.shared.resources-config.schemas.d.ts.map +1 -1
  197. package/dist/esm/features/user-features.shared.resources-config.schemas.js +48 -0
  198. package/dist/esm/features/user-features.shared.resources-config.schemas.js.map +1 -1
  199. package/dist/esm/files/file-upload-grant.shared.schemas.d.ts +156 -0
  200. package/dist/esm/files/file-upload-grant.shared.schemas.d.ts.map +1 -0
  201. package/dist/esm/files/file-upload-grant.shared.schemas.js +175 -0
  202. package/dist/esm/files/file-upload-grant.shared.schemas.js.map +1 -0
  203. package/dist/esm/files/files.shared.schemas.d.ts +52 -4
  204. package/dist/esm/files/files.shared.schemas.d.ts.map +1 -1
  205. package/dist/esm/files/files.shared.schemas.js +55 -4
  206. package/dist/esm/files/files.shared.schemas.js.map +1 -1
  207. package/dist/esm/flows-actors/a2a-push-delivery-log.shared.resources-config.schemas.d.ts +1 -1
  208. package/dist/esm/flows-actors/a2a-push-delivery-log.shared.resources-config.schemas.d.ts.map +1 -1
  209. package/dist/esm/flows-actors/a2a-push-delivery-log.shared.resources-config.schemas.js +33 -0
  210. package/dist/esm/flows-actors/a2a-push-delivery-log.shared.resources-config.schemas.js.map +1 -1
  211. package/dist/esm/flows-actors/a2a-push-delivery-log.shared.schemas.d.ts.map +1 -1
  212. package/dist/esm/flows-actors/a2a-push-delivery-log.shared.schemas.js +6 -2
  213. package/dist/esm/flows-actors/a2a-push-delivery-log.shared.schemas.js.map +1 -1
  214. package/dist/esm/flows-actors/a2a-token-budget-state.shared.resources-config.schemas.d.ts +1 -1
  215. package/dist/esm/flows-actors/a2a-token-budget-state.shared.resources-config.schemas.d.ts.map +1 -1
  216. package/dist/esm/flows-actors/a2a-token-budget-state.shared.resources-config.schemas.js +53 -0
  217. package/dist/esm/flows-actors/a2a-token-budget-state.shared.resources-config.schemas.js.map +1 -1
  218. package/dist/esm/flows-actors/actors.shared.schemas.d.ts.map +1 -1
  219. package/dist/esm/flows-actors/actors.shared.schemas.js +3 -2
  220. package/dist/esm/flows-actors/actors.shared.schemas.js.map +1 -1
  221. package/dist/esm/flows-actors/agents.shared.schemas.d.ts +54 -5
  222. package/dist/esm/flows-actors/agents.shared.schemas.d.ts.map +1 -1
  223. package/dist/esm/flows-actors/agents.shared.schemas.js.map +1 -1
  224. package/dist/esm/flows-actors/apps-blueprint/apps-blueprint.shared.schemas.d.ts +6 -6
  225. package/dist/esm/flows-actors/deliberation.shared.schemas.d.ts +0 -3
  226. package/dist/esm/flows-actors/deliberation.shared.schemas.d.ts.map +1 -1
  227. package/dist/esm/flows-actors/deliberation.shared.schemas.js +0 -5
  228. package/dist/esm/flows-actors/deliberation.shared.schemas.js.map +1 -1
  229. package/dist/esm/flows-actors/flows-actors-execution.shared.resources-config.schemas.d.ts +1 -1
  230. package/dist/esm/flows-actors/flows-actors-execution.shared.resources-config.schemas.d.ts.map +1 -1
  231. package/dist/esm/flows-actors/flows-actors-execution.shared.resources-config.schemas.js +43 -0
  232. package/dist/esm/flows-actors/flows-actors-execution.shared.resources-config.schemas.js.map +1 -1
  233. package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.d.ts +14 -0
  234. package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.d.ts.map +1 -1
  235. package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.js +48 -6
  236. package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.js.map +1 -1
  237. package/dist/esm/flows-actors/flows-actors-task.shared.resources-config.schemas.d.ts +1 -1
  238. package/dist/esm/flows-actors/flows-actors-task.shared.resources-config.schemas.d.ts.map +1 -1
  239. package/dist/esm/flows-actors/flows-actors-task.shared.resources-config.schemas.js +41 -0
  240. package/dist/esm/flows-actors/flows-actors-task.shared.resources-config.schemas.js.map +1 -1
  241. package/dist/esm/flows-actors/flows-actors-task.shared.schemas.d.ts +0 -7
  242. package/dist/esm/flows-actors/flows-actors-task.shared.schemas.d.ts.map +1 -1
  243. package/dist/esm/flows-actors/flows-actors-task.shared.schemas.js +23 -13
  244. package/dist/esm/flows-actors/flows-actors-task.shared.schemas.js.map +1 -1
  245. package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.d.ts +19 -0
  246. package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.d.ts.map +1 -1
  247. package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.js +33 -0
  248. package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.js.map +1 -1
  249. package/dist/esm/flows-actors/flows-actors.io.shared.schemas.d.ts +14 -9
  250. package/dist/esm/flows-actors/flows-actors.io.shared.schemas.d.ts.map +1 -1
  251. package/dist/esm/flows-actors/flows-actors.io.shared.schemas.js +14 -9
  252. package/dist/esm/flows-actors/flows-actors.io.shared.schemas.js.map +1 -1
  253. package/dist/esm/flows-actors/flows-actors.system.shared.schemas.d.ts.map +1 -1
  254. package/dist/esm/flows-actors/flows-actors.system.shared.schemas.js +3 -2
  255. package/dist/esm/flows-actors/flows-actors.system.shared.schemas.js.map +1 -1
  256. package/dist/esm/flows-actors/flows.shared.schemas.d.ts.map +1 -1
  257. package/dist/esm/flows-actors/flows.shared.schemas.js +3 -2
  258. package/dist/esm/flows-actors/flows.shared.schemas.js.map +1 -1
  259. package/dist/esm/flows-actors/mcp-servers.shared.schemas.d.ts +128 -0
  260. package/dist/esm/flows-actors/mcp-servers.shared.schemas.d.ts.map +1 -0
  261. package/dist/esm/flows-actors/mcp-servers.shared.schemas.js +142 -0
  262. package/dist/esm/flows-actors/mcp-servers.shared.schemas.js.map +1 -0
  263. package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.d.ts +0 -3
  264. package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.d.ts.map +1 -1
  265. package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.js +1 -4
  266. package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.js.map +1 -1
  267. package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.d.ts +0 -16
  268. package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.d.ts.map +1 -1
  269. package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.js +1 -17
  270. package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.js.map +1 -1
  271. package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.d.ts +3 -3
  272. package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.js +3 -3
  273. package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.js.map +1 -1
  274. package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.d.ts +2 -8
  275. package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.d.ts.map +1 -1
  276. package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.js +4 -15
  277. package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.js.map +1 -1
  278. package/dist/esm/guidance/guidance-state.shared.resources-config.schemas.d.ts +1 -1
  279. package/dist/esm/guidance/guidance-state.shared.resources-config.schemas.d.ts.map +1 -1
  280. package/dist/esm/guidance/guidance-state.shared.resources-config.schemas.js +51 -0
  281. package/dist/esm/guidance/guidance-state.shared.resources-config.schemas.js.map +1 -1
  282. package/dist/esm/guidance/guidance-state.shared.schemas.d.ts.map +1 -1
  283. package/dist/esm/guidance/guidance-state.shared.schemas.js +8 -2
  284. package/dist/esm/guidance/guidance-state.shared.schemas.js.map +1 -1
  285. package/dist/esm/guidance/guidance-state.shared.utils.d.ts.map +1 -1
  286. package/dist/esm/guidance/guidance-state.shared.utils.js +1 -0
  287. package/dist/esm/guidance/guidance-state.shared.utils.js.map +1 -1
  288. package/dist/esm/guidance/lifecycle-state.shared.resources-config.schemas.d.ts +1 -1
  289. package/dist/esm/guidance/lifecycle-state.shared.resources-config.schemas.d.ts.map +1 -1
  290. package/dist/esm/guidance/lifecycle-state.shared.resources-config.schemas.js +51 -0
  291. package/dist/esm/guidance/lifecycle-state.shared.resources-config.schemas.js.map +1 -1
  292. package/dist/esm/guidance/lifecycle-state.shared.schemas.d.ts.map +1 -1
  293. package/dist/esm/guidance/lifecycle-state.shared.schemas.js +28 -3
  294. package/dist/esm/guidance/lifecycle-state.shared.schemas.js.map +1 -1
  295. package/dist/esm/guidance/progression-state.shared.resources-config.schemas.d.ts +9 -1
  296. package/dist/esm/guidance/progression-state.shared.resources-config.schemas.d.ts.map +1 -1
  297. package/dist/esm/guidance/progression-state.shared.resources-config.schemas.js +51 -0
  298. package/dist/esm/guidance/progression-state.shared.resources-config.schemas.js.map +1 -1
  299. package/dist/esm/guidance/progression-state.shared.schemas.d.ts +46 -0
  300. package/dist/esm/guidance/progression-state.shared.schemas.d.ts.map +1 -1
  301. package/dist/esm/guidance/progression-state.shared.schemas.js +67 -4
  302. package/dist/esm/guidance/progression-state.shared.schemas.js.map +1 -1
  303. package/dist/esm/http-api-binding/http-api-binding.shared.schemas.d.ts +356 -52
  304. package/dist/esm/http-api-binding/http-api-binding.shared.schemas.d.ts.map +1 -1
  305. package/dist/esm/http-api-binding/http-api-binding.shared.schemas.js +166 -39
  306. package/dist/esm/http-api-binding/http-api-binding.shared.schemas.js.map +1 -1
  307. package/dist/esm/index.d.ts +15 -0
  308. package/dist/esm/index.d.ts.map +1 -1
  309. package/dist/esm/index.js +15 -0
  310. package/dist/esm/index.js.map +1 -1
  311. package/dist/esm/notifications/email/email-template-registry.shared.schemas.d.ts +11 -2
  312. package/dist/esm/notifications/email/email-template-registry.shared.schemas.d.ts.map +1 -1
  313. package/dist/esm/notifications/email/email-template-registry.shared.schemas.js.map +1 -1
  314. package/dist/esm/notifications/email/email-template.shared.enums.d.ts +15 -0
  315. package/dist/esm/notifications/email/email-template.shared.enums.d.ts.map +1 -1
  316. package/dist/esm/notifications/email/email-template.shared.enums.js +15 -0
  317. package/dist/esm/notifications/email/email-template.shared.enums.js.map +1 -1
  318. package/dist/esm/notifications/m2m/m2m-webhook-delivery-contract.shared.d.ts +70 -0
  319. package/dist/esm/notifications/m2m/m2m-webhook-delivery-contract.shared.d.ts.map +1 -0
  320. package/dist/esm/notifications/m2m/m2m-webhook-delivery-contract.shared.js +71 -0
  321. package/dist/esm/notifications/m2m/m2m-webhook-delivery-contract.shared.js.map +1 -0
  322. package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.d.ts +1 -0
  323. package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.d.ts.map +1 -1
  324. package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.js +19 -0
  325. package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.js.map +1 -1
  326. package/dist/esm/notifications/m2m/webhook-config.shared.schemas.d.ts +30 -0
  327. package/dist/esm/notifications/m2m/webhook-config.shared.schemas.d.ts.map +1 -1
  328. package/dist/esm/notifications/m2m/webhook-config.shared.schemas.js +65 -1
  329. package/dist/esm/notifications/m2m/webhook-config.shared.schemas.js.map +1 -1
  330. package/dist/esm/notifications/notification-badges.core.definitions.d.ts +6 -4
  331. package/dist/esm/notifications/notification-badges.core.definitions.d.ts.map +1 -1
  332. package/dist/esm/notifications/notification-badges.core.definitions.js +6 -4
  333. package/dist/esm/notifications/notification-badges.core.definitions.js.map +1 -1
  334. package/dist/esm/notifications/notification-badges.schemas.d.ts +167 -5
  335. package/dist/esm/notifications/notification-badges.schemas.d.ts.map +1 -1
  336. package/dist/esm/notifications/notification-badges.schemas.js +191 -6
  337. package/dist/esm/notifications/notification-badges.schemas.js.map +1 -1
  338. package/dist/esm/notifications/notification-badges.shared.resources-config.schemas.d.ts +1 -1
  339. package/dist/esm/notifications/notification-badges.shared.resources-config.schemas.d.ts.map +1 -1
  340. package/dist/esm/notifications/notification-badges.shared.resources-config.schemas.js +36 -0
  341. package/dist/esm/notifications/notification-badges.shared.resources-config.schemas.js.map +1 -1
  342. package/dist/esm/notifications/notifications.shared.schemas.d.ts +107 -0
  343. package/dist/esm/notifications/notifications.shared.schemas.d.ts.map +1 -1
  344. package/dist/esm/notifications/notifications.shared.schemas.js +149 -1
  345. package/dist/esm/notifications/notifications.shared.schemas.js.map +1 -1
  346. package/dist/esm/organizations/organization-members.shared.resources-config.schemas.d.ts +1 -1
  347. package/dist/esm/organizations/organization-members.shared.resources-config.schemas.d.ts.map +1 -1
  348. package/dist/esm/organizations/organization-members.shared.resources-config.schemas.js +44 -0
  349. package/dist/esm/organizations/organization-members.shared.resources-config.schemas.js.map +1 -1
  350. package/dist/esm/organizations/organization-members.shared.schemas.d.ts.map +1 -1
  351. package/dist/esm/organizations/organization-members.shared.schemas.js +15 -4
  352. package/dist/esm/organizations/organization-members.shared.schemas.js.map +1 -1
  353. package/dist/esm/organizations/organization-notifications.shared.schemas.d.ts.map +1 -1
  354. package/dist/esm/organizations/organization-notifications.shared.schemas.js +22 -1
  355. package/dist/esm/organizations/organization-notifications.shared.schemas.js.map +1 -1
  356. package/dist/esm/organizations/organization-preferences.shared.schemas.d.ts +26 -0
  357. package/dist/esm/organizations/organization-preferences.shared.schemas.d.ts.map +1 -1
  358. package/dist/esm/organizations/organization-preferences.shared.schemas.js +25 -0
  359. package/dist/esm/organizations/organization-preferences.shared.schemas.js.map +1 -1
  360. package/dist/esm/organizations/organization-profile.shared.schemas.d.ts +25 -0
  361. package/dist/esm/organizations/organization-profile.shared.schemas.d.ts.map +1 -1
  362. package/dist/esm/organizations/organization-profile.shared.schemas.js +42 -17
  363. package/dist/esm/organizations/organization-profile.shared.schemas.js.map +1 -1
  364. package/dist/esm/organizations/organization-unit-narrowing.shared.d.ts +3 -2
  365. package/dist/esm/organizations/organization-unit-narrowing.shared.d.ts.map +1 -1
  366. package/dist/esm/organizations/organization-unit-narrowing.shared.js +9 -2
  367. package/dist/esm/organizations/organization-unit-narrowing.shared.js.map +1 -1
  368. package/dist/esm/organizations/organizations.shared.resources-config.schemas.d.ts.map +1 -1
  369. package/dist/esm/organizations/organizations.shared.resources-config.schemas.js +35 -12
  370. package/dist/esm/organizations/organizations.shared.resources-config.schemas.js.map +1 -1
  371. package/dist/esm/public-runtime/index.d.ts +49 -2
  372. package/dist/esm/public-runtime/index.d.ts.map +1 -1
  373. package/dist/esm/public-runtime/index.js +48 -1
  374. package/dist/esm/public-runtime/index.js.map +1 -1
  375. package/dist/esm/queue/jobs.shared.resources-config.schemas.d.ts +6 -5
  376. package/dist/esm/queue/jobs.shared.resources-config.schemas.d.ts.map +1 -1
  377. package/dist/esm/queue/jobs.shared.resources-config.schemas.js +23 -5
  378. package/dist/esm/queue/jobs.shared.resources-config.schemas.js.map +1 -1
  379. package/dist/esm/queue/jobs.shared.schemas.d.ts +16 -3
  380. package/dist/esm/queue/jobs.shared.schemas.d.ts.map +1 -1
  381. package/dist/esm/queue/jobs.shared.schemas.js +16 -3
  382. package/dist/esm/queue/jobs.shared.schemas.js.map +1 -1
  383. package/dist/esm/requests/manual-controllers-routes-documentation.d.ts +137 -0
  384. package/dist/esm/requests/manual-controllers-routes-documentation.d.ts.map +1 -0
  385. package/dist/esm/requests/manual-controllers-routes-documentation.js +1201 -0
  386. package/dist/esm/requests/manual-controllers-routes-documentation.js.map +1 -0
  387. package/dist/esm/requests/manual-controllers-routes-urls.d.ts +67 -0
  388. package/dist/esm/requests/manual-controllers-routes-urls.d.ts.map +1 -1
  389. package/dist/esm/requests/manual-controllers-routes-urls.js +78 -0
  390. package/dist/esm/requests/manual-controllers-routes-urls.js.map +1 -1
  391. package/dist/esm/requests/rate-limits.shared.schemas.d.ts +11 -1
  392. package/dist/esm/requests/rate-limits.shared.schemas.d.ts.map +1 -1
  393. package/dist/esm/requests/rate-limits.shared.schemas.js +11 -1
  394. package/dist/esm/requests/rate-limits.shared.schemas.js.map +1 -1
  395. package/dist/esm/requests/websocket.shared.schemas.d.ts +86 -4
  396. package/dist/esm/requests/websocket.shared.schemas.d.ts.map +1 -1
  397. package/dist/esm/requests/websocket.shared.schemas.js +138 -0
  398. package/dist/esm/requests/websocket.shared.schemas.js.map +1 -1
  399. package/dist/esm/resources/collection-query-parameters.shared.d.ts +22 -0
  400. package/dist/esm/resources/collection-query-parameters.shared.d.ts.map +1 -0
  401. package/dist/esm/resources/collection-query-parameters.shared.js +22 -0
  402. package/dist/esm/resources/collection-query-parameters.shared.js.map +1 -0
  403. package/dist/esm/resources/resources-config.shared.factory.d.ts +1 -0
  404. package/dist/esm/resources/resources-config.shared.factory.d.ts.map +1 -1
  405. package/dist/esm/resources/resources-config.shared.factory.js +189 -31
  406. package/dist/esm/resources/resources-config.shared.factory.js.map +1 -1
  407. package/dist/esm/resources/resources-config.shared.schemas.d.ts +395 -92
  408. package/dist/esm/resources/resources-config.shared.schemas.d.ts.map +1 -1
  409. package/dist/esm/resources/resources-config.shared.schemas.js +109 -20
  410. package/dist/esm/resources/resources-config.shared.schemas.js.map +1 -1
  411. package/dist/esm/resources/resources-registry.shared.core.definitions.d.ts.map +1 -1
  412. package/dist/esm/resources/resources-registry.shared.core.definitions.js +97 -5
  413. package/dist/esm/resources/resources-registry.shared.core.definitions.js.map +1 -1
  414. package/dist/esm/resources/resources-relationships.shared.factory.d.ts.map +1 -1
  415. package/dist/esm/resources/resources-relationships.shared.factory.js +15 -0
  416. package/dist/esm/resources/resources-relationships.shared.factory.js.map +1 -1
  417. package/dist/esm/resources/resources.shared.core.definitions.d.ts +37 -0
  418. package/dist/esm/resources/resources.shared.core.definitions.d.ts.map +1 -1
  419. package/dist/esm/resources/resources.shared.core.definitions.js +51 -0
  420. package/dist/esm/resources/resources.shared.core.definitions.js.map +1 -1
  421. package/dist/esm/resources/resources.shared.schemas.d.ts +11 -2
  422. package/dist/esm/resources/resources.shared.schemas.d.ts.map +1 -1
  423. package/dist/esm/resources/resources.shared.schemas.js +34 -3
  424. package/dist/esm/resources/resources.shared.schemas.js.map +1 -1
  425. package/dist/esm/resources/utils/field-value-disclosure.utils.d.ts +51 -0
  426. package/dist/esm/resources/utils/field-value-disclosure.utils.d.ts.map +1 -0
  427. package/dist/esm/resources/utils/field-value-disclosure.utils.js +53 -0
  428. package/dist/esm/resources/utils/field-value-disclosure.utils.js.map +1 -0
  429. package/dist/esm/resources/utils/resources-config-operations.dtos-builder.utils.d.ts.map +1 -1
  430. package/dist/esm/resources/utils/resources-config-operations.dtos-builder.utils.js +21 -6
  431. package/dist/esm/resources/utils/resources-config-operations.dtos-builder.utils.js.map +1 -1
  432. package/dist/esm/resources/utils/resources-summary.utils.d.ts +16 -2
  433. package/dist/esm/resources/utils/resources-summary.utils.d.ts.map +1 -1
  434. package/dist/esm/resources/utils/resources-summary.utils.js +19 -5
  435. package/dist/esm/resources/utils/resources-summary.utils.js.map +1 -1
  436. package/dist/esm/resources/utils/shared-persistence-collection.utils.d.ts.map +1 -1
  437. package/dist/esm/resources/utils/shared-persistence-collection.utils.js +11 -0
  438. package/dist/esm/resources/utils/shared-persistence-collection.utils.js.map +1 -1
  439. package/dist/esm/runtime/domain-module.shared.definitions.d.ts +25 -0
  440. package/dist/esm/runtime/domain-module.shared.definitions.d.ts.map +1 -1
  441. package/dist/esm/runtime/domain-module.shared.definitions.js.map +1 -1
  442. package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.d.ts +1 -0
  443. package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.d.ts.map +1 -1
  444. package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.js +38 -0
  445. package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.js.map +1 -1
  446. package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.d.ts +1 -0
  447. package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.d.ts.map +1 -1
  448. package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.js +38 -0
  449. package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.js.map +1 -1
  450. package/dist/esm/security/authentications/authentication.shared.dto.schemas.d.ts +4 -11
  451. package/dist/esm/security/authentications/authentication.shared.dto.schemas.d.ts.map +1 -1
  452. package/dist/esm/security/authentications/authentication.shared.dto.schemas.js +0 -1
  453. package/dist/esm/security/authentications/authentication.shared.dto.schemas.js.map +1 -1
  454. package/dist/esm/security/authentications/authentication.shared.schemas.d.ts +141 -5
  455. package/dist/esm/security/authentications/authentication.shared.schemas.d.ts.map +1 -1
  456. package/dist/esm/security/authentications/authentication.shared.schemas.js +147 -3
  457. package/dist/esm/security/authentications/authentication.shared.schemas.js.map +1 -1
  458. package/dist/esm/security/authentications/consumable-token.shared.schemas.d.ts +17 -1
  459. package/dist/esm/security/authentications/consumable-token.shared.schemas.d.ts.map +1 -1
  460. package/dist/esm/security/authentications/consumable-token.shared.schemas.js +16 -0
  461. package/dist/esm/security/authentications/consumable-token.shared.schemas.js.map +1 -1
  462. package/dist/esm/security/authentications/mfa-backup-code-contract.shared.d.ts +28 -0
  463. package/dist/esm/security/authentications/mfa-backup-code-contract.shared.d.ts.map +1 -0
  464. package/dist/esm/security/authentications/mfa-backup-code-contract.shared.js +28 -0
  465. package/dist/esm/security/authentications/mfa-backup-code-contract.shared.js.map +1 -0
  466. package/dist/esm/security/authentications/registration.shared.dto.schemas.d.ts +1 -0
  467. package/dist/esm/security/authentications/registration.shared.dto.schemas.d.ts.map +1 -1
  468. package/dist/esm/security/authentications/registration.shared.dto.schemas.js +11 -0
  469. package/dist/esm/security/authentications/registration.shared.dto.schemas.js.map +1 -1
  470. package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.d.ts +15 -0
  471. package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.d.ts.map +1 -1
  472. package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.js +21 -4
  473. package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.js.map +1 -1
  474. package/dist/esm/security/authentications/siem/siem-delivery-reliability-contract.shared.d.ts +21 -0
  475. package/dist/esm/security/authentications/siem/siem-delivery-reliability-contract.shared.d.ts.map +1 -0
  476. package/dist/esm/security/authentications/siem/siem-delivery-reliability-contract.shared.js +21 -0
  477. package/dist/esm/security/authentications/siem/siem-delivery-reliability-contract.shared.js.map +1 -0
  478. package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.d.ts +61 -1
  479. package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.d.ts.map +1 -1
  480. package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.js +208 -6
  481. package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.js.map +1 -1
  482. package/dist/esm/security/authentications/sso/sso-config.shared.schemas.d.ts +37 -27
  483. package/dist/esm/security/authentications/sso/sso-config.shared.schemas.d.ts.map +1 -1
  484. package/dist/esm/security/authentications/sso/sso-config.shared.schemas.js +134 -12
  485. package/dist/esm/security/authentications/sso/sso-config.shared.schemas.js.map +1 -1
  486. package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.d.ts +0 -6
  487. package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.d.ts.map +1 -1
  488. package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.js +17 -8
  489. package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.js.map +1 -1
  490. package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.d.ts +1 -1
  491. package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.d.ts.map +1 -1
  492. package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.js +70 -0
  493. package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.js.map +1 -1
  494. package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.d.ts +45 -8
  495. package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.d.ts.map +1 -1
  496. package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.js +56 -10
  497. package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.js.map +1 -1
  498. package/dist/esm/security/authorizations/roles.shared.schemas.d.ts +16 -1
  499. package/dist/esm/security/authorizations/roles.shared.schemas.d.ts.map +1 -1
  500. package/dist/esm/security/authorizations/roles.shared.schemas.js +16 -1
  501. package/dist/esm/security/authorizations/roles.shared.schemas.js.map +1 -1
  502. package/dist/esm/security/authorizations/roles.shared.utils.d.ts +54 -0
  503. package/dist/esm/security/authorizations/roles.shared.utils.d.ts.map +1 -1
  504. package/dist/esm/security/authorizations/roles.shared.utils.js +59 -0
  505. package/dist/esm/security/authorizations/roles.shared.utils.js.map +1 -1
  506. package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.d.ts +31 -0
  507. package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.d.ts.map +1 -0
  508. package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.js +198 -0
  509. package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.js.map +1 -0
  510. package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.d.ts +31 -0
  511. package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.d.ts.map +1 -0
  512. package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.js +191 -0
  513. package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.js.map +1 -0
  514. package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.d.ts +250 -0
  515. package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.d.ts.map +1 -0
  516. package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.js +486 -0
  517. package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.js.map +1 -0
  518. package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.d.ts +4 -1
  519. package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.d.ts.map +1 -1
  520. package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.js +29 -0
  521. package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.js.map +1 -1
  522. package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.d.ts +4 -1
  523. package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.d.ts.map +1 -1
  524. package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.js +29 -0
  525. package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.js.map +1 -1
  526. package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.d.ts +67 -0
  527. package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.d.ts.map +1 -1
  528. package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.js +44 -1
  529. package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.js.map +1 -1
  530. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.resources-config.schemas.d.ts +1 -1
  531. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.resources-config.schemas.d.ts.map +1 -1
  532. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.resources-config.schemas.js +35 -0
  533. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.resources-config.schemas.js.map +1 -1
  534. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.d.ts +13 -0
  535. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.d.ts.map +1 -1
  536. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.js +31 -4
  537. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.js.map +1 -1
  538. package/dist/esm/users/inbound-contacts.shared.resources-config.schemas.d.ts +1 -1
  539. package/dist/esm/users/inbound-contacts.shared.resources-config.schemas.d.ts.map +1 -1
  540. package/dist/esm/users/inbound-contacts.shared.resources-config.schemas.js +34 -0
  541. package/dist/esm/users/inbound-contacts.shared.resources-config.schemas.js.map +1 -1
  542. package/dist/esm/users/inbound-contacts.shared.schemas.d.ts.map +1 -1
  543. package/dist/esm/users/inbound-contacts.shared.schemas.js +7 -4
  544. package/dist/esm/users/inbound-contacts.shared.schemas.js.map +1 -1
  545. package/dist/esm/users/user-credentials.shared.resources-config.schemas.d.ts +1 -1
  546. package/dist/esm/users/user-credentials.shared.resources-config.schemas.d.ts.map +1 -1
  547. package/dist/esm/users/user-credentials.shared.resources-config.schemas.js +37 -0
  548. package/dist/esm/users/user-credentials.shared.resources-config.schemas.js.map +1 -1
  549. package/dist/esm/users/user-credentials.shared.schemas.d.ts.map +1 -1
  550. package/dist/esm/users/user-credentials.shared.schemas.js +17 -2
  551. package/dist/esm/users/user-credentials.shared.schemas.js.map +1 -1
  552. package/dist/esm/users/user-identity-links.shared.resources-config.schemas.d.ts +1 -1
  553. package/dist/esm/users/user-identity-links.shared.resources-config.schemas.d.ts.map +1 -1
  554. package/dist/esm/users/user-identity-links.shared.resources-config.schemas.js +36 -0
  555. package/dist/esm/users/user-identity-links.shared.resources-config.schemas.js.map +1 -1
  556. package/dist/esm/users/user-identity-links.shared.schemas.d.ts.map +1 -1
  557. package/dist/esm/users/user-identity-links.shared.schemas.js +15 -5
  558. package/dist/esm/users/user-identity-links.shared.schemas.js.map +1 -1
  559. package/dist/esm/users/user-preferences.shared.resources-config.schemas.d.ts +5 -5
  560. package/dist/esm/users/user-preferences.shared.resources-config.schemas.d.ts.map +1 -1
  561. package/dist/esm/users/user-preferences.shared.resources-config.schemas.js +53 -0
  562. package/dist/esm/users/user-preferences.shared.resources-config.schemas.js.map +1 -1
  563. package/dist/esm/users/user-profiles.shared.resources-config.schemas.d.ts +1 -1
  564. package/dist/esm/users/user-profiles.shared.resources-config.schemas.d.ts.map +1 -1
  565. package/dist/esm/users/user-profiles.shared.resources-config.schemas.js +62 -0
  566. package/dist/esm/users/user-profiles.shared.resources-config.schemas.js.map +1 -1
  567. package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.d.ts +5 -5
  568. package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.d.ts.map +1 -1
  569. package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.js +53 -0
  570. package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.js.map +1 -1
  571. package/dist/esm/users/user-self-profiles.shared.resources-config.schemas.d.ts +1 -1
  572. package/dist/esm/users/user-self-profiles.shared.resources-config.schemas.d.ts.map +1 -1
  573. package/dist/esm/users/user-self-profiles.shared.resources-config.schemas.js +62 -0
  574. package/dist/esm/users/user-self-profiles.shared.resources-config.schemas.js.map +1 -1
  575. package/dist/esm/users/user-self.shared.resources-config.schemas.d.ts.map +1 -1
  576. package/dist/esm/users/user-self.shared.resources-config.schemas.js +33 -3
  577. package/dist/esm/users/user-self.shared.resources-config.schemas.js.map +1 -1
  578. package/dist/esm/users/users.shared.resources-config.schemas.d.ts +17 -1
  579. package/dist/esm/users/users.shared.resources-config.schemas.d.ts.map +1 -1
  580. package/dist/esm/users/users.shared.resources-config.schemas.js +136 -5
  581. package/dist/esm/users/users.shared.resources-config.schemas.js.map +1 -1
  582. package/dist/esm/users/users.shared.schemas.d.ts +62 -12
  583. package/dist/esm/users/users.shared.schemas.d.ts.map +1 -1
  584. package/dist/esm/users/users.shared.schemas.js +79 -23
  585. package/dist/esm/users/users.shared.schemas.js.map +1 -1
  586. package/dist/tsconfig.build.tsbuildinfo +1 -1
  587. package/package.json +5 -6
  588. package/dist/esm/.builder.pid +0 -9
@@ -13,6 +13,7 @@ import { CORE_APP_ROLES, CORE_ORG_ROLES } from '../security/authorizations/roles
13
13
  import { creditPoolsPolymorphicDeclaration } from './credit-pool.shared.schemas.js';
14
14
  import { ResourceSystemAccessMode } from '../resources/resources-config.shared.schemas.js';
15
15
  import { DataPortabilityProvenance } from '../compliance/privacy/subject-export.shared.schemas.js';
16
+ import { ErasureRetentionMode, ResourceDataSubjectKind } from '../compliance/privacy/impersonalization.shared.schemas.js';
16
17
  // ── Custom Operations ────────────────────────────────────────────────
17
18
  export var CreditPool_Operations;
18
19
  (function (CreditPool_Operations) {
@@ -36,13 +37,51 @@ export const creditPoolsPolymorphicFactories = createPolymorphicResourceConfigur
36
37
  /** Subject-export disclosure. The subject's own credit balances. Secrets and backend-only values are withheld by the export's security floor regardless of this grant. On a polymorphic resource this grant applies to EVERY generated variant, which is the documented intent of the shared config. */
37
38
  systemAccessPolicy: { exportSubject: ResourceSystemAccessMode.ALLOWED },
38
39
  portabilityPolicy: { defaultProvenance: DataPortabilityProvenance.DERIVED },
40
+ /**
41
+ * Subject erasure RETAINS this row and scrubs nothing, because there is nothing here to scrub.
42
+ *
43
+ * `RETAIN_ONLY` is a positive ASSERTION that this resource holds no personal data of its own. The row is
44
+ * credit balances — available, purchased and consumed amounts — amounts and contract terms about the ACCOUNT. They
45
+ * describe nobody once the linked USER row is scrubbed, and they must survive erasure for the tax/audit
46
+ * obligation this family exists to serve, so they can be neither scrubbed nor honestly declared as
47
+ * personal data the row holds. The person is the scope foreign key, which the never-scrub floor protects.
48
+ *
49
+ * The assertion is CHECKED in both directions: the factory refuses `RETAIN_ONLY` if any field declares an
50
+ * impersonalize treatment, and (since 2026-08-31) if any non-floor field declares `.dataCategories()`.
51
+ */
52
+ retentionPolicy: {
53
+ mode: ErasureRetentionMode.RETAIN_ONLY,
54
+ },
55
+ /**
56
+ * Erasing one of these rows revokes NO session. The row is not a person — its owner FK names the ACTOR the
57
+ * record belongs to — and the enum prescribes `NO_PRINCIPAL` for exactly that shape. The subject's own
58
+ * session ends through the `USERS` row, which is `SELF_PRINCIPAL`.
59
+ */
60
+ dataSubjectPolicy: { kind: ResourceDataSubjectKind.NO_PRINCIPAL },
39
61
  coreOperations: [
40
62
  CoreResourceOperation.READ,
41
63
  CoreResourceOperation.LIST,
42
64
  CoreResourceOperation.CREATE,
43
65
  CoreResourceOperation.UPDATE,
66
+ // Route-less; `retentionPolicy` requires READ + LIST + UPDATE_MANY.
67
+ CoreResourceOperation.UPDATE_MANY,
44
68
  ],
45
69
  operationsConfiguration: {
70
+ /*
71
+ * Route-less retention plumbing — INTERNAL_CALL registers no route, so no API surface is added, and it
72
+ * must not be REPOSITORY_ONLY: the retention primitives resolve through `getServiceOperationPathDefault`,
73
+ * which matches only INTERNAL_CALL / API_CALL. LIST is LOW (a read-shaped op may not claim the
74
+ * HIGH/CRITICAL band, which carries an audit-emission obligation); UPDATE_MANY is CRITICAL — it is the
75
+ * verb the impersonalize writer uses to stamp the retention markers.
76
+ */
77
+ [CoreResourceOperation.UPDATE_MANY]: {
78
+ variants: [{
79
+ variantType: ResourceOperationVariantType.INTERNAL_CALL,
80
+ isDefault: true,
81
+ roles: [CORE_APP_ROLES.APP_ADMIN_SUPER_ADMIN],
82
+ riskLevel: ResourceOperationRiskLevel.CRITICAL,
83
+ }],
84
+ },
46
85
  [CoreResourceOperation.READ]: {
47
86
  variants: [{
48
87
  variantType: ResourceOperationVariantType.INTERNAL_CALL,
@@ -1 +1 @@
1
- {"version":3,"file":"credit-pool.shared.resources-config.schemas.js","sourceRoot":"","sources":["../../../../src/billing/credit-pool.shared.resources-config.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AACzG,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,uCAAuC,EAAE,MAAM,kDAAkD,CAAC;AAC3G,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACjG,OAAO,EAAE,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,yBAAyB,EAAE,MAAM,qDAAqD,CAAC;AAEhG,wEAAwE;AAExE,MAAM,CAAN,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAC/B;gEAC4D;IAC5D,4CAAmB,CAAA;IACnB;8GAC0G;IAC1G,0CAAiB,CAAA;AACnB,CAAC,EAPW,qBAAqB,KAArB,qBAAqB,QAOhC;AAED,wEAAwE;AAExE,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,+BAA+B,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C;SACH;QACD,8FAA8F;QAC9F,8DAA8D;QAC9D,EAAE;QACF,yFAAyF;QACzF,2FAA2F;QAC3F,wFAAwF;QACxF,iGAAiG;QACjG,yFAAyF;QACzF,wFAAwF;QACxF,8FAA8F;QAC9F,4FAA4F;QAC5F,+FAA+F;QAC/F,+FAA+F;QAC/F,8FAA8F;QAC9F,iDAAiD;QACjD,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE;YAC9B,QAAQ,EAAE,CAAC;oBACT,WAAW,EAAE,4BAA4B,CAAC,aAAa;oBACvD,SAAS,EAAE,IAAI;oBACf,eAAe,EAAE;wBACf,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC;wBAC5D,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC;qBACpD;oBACD,SAAS,EAAE,0BAA0B,CAAC,MAAM;oBAC5C,qBAAqB,EAAE,qBAAqB,CAAC,MAAM;oBACnD,UAAU,EAAE,0BAA0B;iBACvC,CAAC;SACH;KACF;CACF,CACF,CAAC","sourcesContent":["/**\n * Credit Pool Resource Configuration — Polymorphic\n *\n * Produces 3 factory functions (one per scope variant) via the polymorphic factory.\n * Spread into the registry factory map:\n * ...creditPoolsPolymorphicFactories\n */\n\nimport { z } from 'zod';\nimport { CoreResourceOperation, CoreResourceType } from '../resources/resources.shared.core.definitions';\nimport {\n ResourceOperationRiskLevel,\n ResourceOperationVariantType,\n} from '../resources/resources.shared.schemas';\nimport { createPolymorphicResourceConfigurations } from '../resources/utils/resource-polymorphism.factory';\nimport { CORE_APP_ROLES, CORE_ORG_ROLES } from '../security/authorizations/roles.shared.schemas';\nimport { creditPoolsPolymorphicDeclaration } from './credit-pool.shared.schemas';\nimport { ResourceSystemAccessMode } from '../resources/resources-config.shared.schemas';\nimport { DataPortabilityProvenance } from '../compliance/privacy/subject-export.shared.schemas';\n\n// ── Custom Operations ────────────────────────────────────────────────\n\nexport enum CreditPool_Operations {\n /** Consume credits from the pool. System-only (INTERNAL_CALL) — called by custom service code that\n * meters a paid capability, never directly by a client. */\n CONSUME = 'consume',\n /** Top up credits. System-only (INTERNAL_CALL) — invoked by the billing webhook router after a\n * verified CREDIT_PACK purchase, never by a client. The client \"buy credits\" action is OPEN_CHECKOUT. */\n TOP_UP = 'top_up',\n}\n\n// ── Request DTOs ─────────────────────────────────────────────────────\n\nexport const CreditPool_ConsumeRequestDto = z.object({\n credits: z.number().min(1),\n});\n\nexport const CreditPool_TopUpRequestDto = z.object({\n credits: z.number().min(1),\n});\n\nexport const creditPoolsPolymorphicFactories = createPolymorphicResourceConfigurations(\n creditPoolsPolymorphicDeclaration,\n {\n isSystemResource: true,\n customOperation: CreditPool_Operations,\n /** Subject-export disclosure. The subject's own credit balances. Secrets and backend-only values are withheld by the export's security floor regardless of this grant. On a polymorphic resource this grant applies to EVERY generated variant, which is the documented intent of the shared config. */\n systemAccessPolicy: { exportSubject: ResourceSystemAccessMode.ALLOWED },\n portabilityPolicy: { defaultProvenance: DataPortabilityProvenance.DERIVED },\n\n coreOperations: [\n CoreResourceOperation.READ,\n CoreResourceOperation.LIST,\n CoreResourceOperation.CREATE,\n CoreResourceOperation.UPDATE,\n ],\n operationsConfiguration: {\n [CoreResourceOperation.READ]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n [CoreResourceOperation.LIST]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n [CoreResourceOperation.CREATE]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n [CoreResourceOperation.UPDATE]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n // assurance-control: WILDO.BILLING.CREDIT_GRANT_INTEGRITY — a credit-balance mutation is\n // system-only; it is never client-initiated.\n //\n // CONSUME is INTERNAL_CALL (no HTTP route), matching TOP_UP and the CRUD siblings. It is invoked\n // by service code that meters a paid feature (its enum doc: \"called by custom service code\"), not\n // by a client — the balance decrement happens as a side effect of using a metered capability, not\n // as a direct client action. Leaving it API_CALL let a client spend its own credits arbitrarily\n // (self-harm, not a grant) and, more importantly, made a system-automated op part of the client\n // attack surface. The `polymorphicRole` is retained for internal-authorization parity and no\n // longer confers client reachability.\n [CreditPool_Operations.CONSUME]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_MEMBER],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.MEDIUM,\n resourceOperationLike: CoreResourceOperation.UPDATE,\n requestDto: CreditPool_ConsumeRequestDto,\n }],\n },\n // assurance-control: WILDO.BILLING.CREDIT_GRANT_INTEGRITY — a credit GRANT (balance increase)\n // is system/payment-gated only; it is never client-initiated.\n //\n // TOP_UP is INTERNAL_CALL (no HTTP route), matching its CREATE/UPDATE siblings above. It\n // increments the spendable balance, so it must be reachable ONLY from server code that has\n // already verified payment: the billing webhook router computes `credits` from the PAID\n // product/quantity and invokes it via `executeCustomOperation` (which resolves the INTERNAL_CALL\n // default through `getServiceOperationPathDefault`). It was previously API_CALL gated to\n // ORG_OWNER, which let a tenant owner `PUT …/credit-pools/{id}/top-up {credits: N}` and\n // self-grant unlimited paid credits — the client \"buy credits\" action is OPEN_CHECKOUT, not a\n // direct balance write, so this route had no legitimate client caller. (The spec previously\n // hinted at a manual admin grant here; a support-initiated grant, if ever needed, belongs on a\n // separate platform-super-admin op with a mandatory audit event, NOT on a tenant-owner route.)\n // The `polymorphicRole` below is retained for internal-authorization parity with the CRUD ops\n // and no longer confers any client reachability.\n [CreditPool_Operations.TOP_UP]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.MEDIUM,\n resourceOperationLike: CoreResourceOperation.UPDATE,\n requestDto: CreditPool_TopUpRequestDto,\n }],\n },\n },\n },\n);\n"]}
1
+ {"version":3,"file":"credit-pool.shared.resources-config.schemas.js","sourceRoot":"","sources":["../../../../src/billing/credit-pool.shared.resources-config.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AACzG,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,uCAAuC,EAAE,MAAM,kDAAkD,CAAC;AAC3G,OAAO,EAAE,cAAc,EAAE,cAAc,E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U,EAAE,4BAA4B;iBACzC,CAAC;SACH;QACD,8FAA8F;QAC9F,8DAA8D;QAC9D,EAAE;QACF,yFAAyF;QACzF,2FAA2F;QAC3F,wFAAwF;QACxF,iGAAiG;QACjG,yFAAyF;QACzF,wFAAwF;QACxF,8FAA8F;QAC9F,4FAA4F;QAC5F,+FAA+F;QAC/F,+FAA+F;QAC/F,8FAA8F;QAC9F,iDAAiD;QACjD,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE;YAC9B,QAAQ,EAAE,CAAC;oBACT,WAAW,EAAE,4BAA4B,CAAC,aAAa;oBACvD,SAAS,EAAE,IAAI;oBACf,eAAe,EAAE;wBACf,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC;wBAC5D,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC;qBACpD;oBACD,SAAS,EAAE,0BAA0B,CAAC,MAAM;oBAC5C,qBAAqB,EAAE,qBAAqB,CAAC,MAAM;oBACnD,UAAU,EAAE,0BAA0B;iBACvC,CAAC;SACH;KACF;CACF,CACF,CAAC","sourcesContent":["/**\n * Credit Pool Resource Configuration — Polymorphic\n *\n * Produces 3 factory functions (one per scope variant) via the polymorphic factory.\n * Spread into the registry factory map:\n * ...creditPoolsPolymorphicFactories\n */\n\nimport { z } from 'zod';\nimport { CoreResourceOperation, CoreResourceType } from '../resources/resources.shared.core.definitions';\nimport {\n ResourceOperationRiskLevel,\n ResourceOperationVariantType,\n} from '../resources/resources.shared.schemas';\nimport { createPolymorphicResourceConfigurations } from '../resources/utils/resource-polymorphism.factory';\nimport { CORE_APP_ROLES, CORE_ORG_ROLES } from '../security/authorizations/roles.shared.schemas';\nimport { creditPoolsPolymorphicDeclaration } from './credit-pool.shared.schemas';\nimport { ResourceSystemAccessMode } from '../resources/resources-config.shared.schemas';\nimport { DataPortabilityProvenance } from '../compliance/privacy/subject-export.shared.schemas';\nimport { ErasureRetentionMode, ResourceDataSubjectKind } from '../compliance/privacy/impersonalization.shared.schemas';\n\n// ── Custom Operations ────────────────────────────────────────────────\n\nexport enum CreditPool_Operations {\n /** Consume credits from the pool. System-only (INTERNAL_CALL) — called by custom service code that\n * meters a paid capability, never directly by a client. */\n CONSUME = 'consume',\n /** Top up credits. System-only (INTERNAL_CALL) — invoked by the billing webhook router after a\n * verified CREDIT_PACK purchase, never by a client. The client \"buy credits\" action is OPEN_CHECKOUT. */\n TOP_UP = 'top_up',\n}\n\n// ── Request DTOs ─────────────────────────────────────────────────────\n\nexport const CreditPool_ConsumeRequestDto = z.object({\n credits: z.number().min(1),\n});\n\nexport const CreditPool_TopUpRequestDto = z.object({\n credits: z.number().min(1),\n});\n\nexport const creditPoolsPolymorphicFactories = createPolymorphicResourceConfigurations(\n creditPoolsPolymorphicDeclaration,\n {\n isSystemResource: true,\n customOperation: CreditPool_Operations,\n /** Subject-export disclosure. The subject's own credit balances. Secrets and backend-only values are withheld by the export's security floor regardless of this grant. On a polymorphic resource this grant applies to EVERY generated variant, which is the documented intent of the shared config. */\n systemAccessPolicy: { exportSubject: ResourceSystemAccessMode.ALLOWED },\n portabilityPolicy: { defaultProvenance: DataPortabilityProvenance.DERIVED },\n\n /**\n * Subject erasure RETAINS this row and scrubs nothing, because there is nothing here to scrub.\n *\n * `RETAIN_ONLY` is a positive ASSERTION that this resource holds no personal data of its own. The row is\n * credit balances — available, purchased and consumed amounts — amounts and contract terms about the ACCOUNT. They\n * describe nobody once the linked USER row is scrubbed, and they must survive erasure for the tax/audit\n * obligation this family exists to serve, so they can be neither scrubbed nor honestly declared as\n * personal data the row holds. The person is the scope foreign key, which the never-scrub floor protects.\n *\n * The assertion is CHECKED in both directions: the factory refuses `RETAIN_ONLY` if any field declares an\n * impersonalize treatment, and (since 2026-08-31) if any non-floor field declares `.dataCategories()`.\n */\n retentionPolicy: {\n mode: ErasureRetentionMode.RETAIN_ONLY,\n },\n\n /**\n * Erasing one of these rows revokes NO session. The row is not a person — its owner FK names the ACTOR the\n * record belongs to — and the enum prescribes `NO_PRINCIPAL` for exactly that shape. The subject's own\n * session ends through the `USERS` row, which is `SELF_PRINCIPAL`.\n */\n dataSubjectPolicy: { kind: ResourceDataSubjectKind.NO_PRINCIPAL },\n\n coreOperations: [\n CoreResourceOperation.READ,\n CoreResourceOperation.LIST,\n CoreResourceOperation.CREATE,\n CoreResourceOperation.UPDATE,\n // Route-less; `retentionPolicy` requires READ + LIST + UPDATE_MANY.\n CoreResourceOperation.UPDATE_MANY,\n ],\n operationsConfiguration: {\n /*\n * Route-less retention plumbing — INTERNAL_CALL registers no route, so no API surface is added, and it\n * must not be REPOSITORY_ONLY: the retention primitives resolve through `getServiceOperationPathDefault`,\n * which matches only INTERNAL_CALL / API_CALL. LIST is LOW (a read-shaped op may not claim the\n * HIGH/CRITICAL band, which carries an audit-emission obligation); UPDATE_MANY is CRITICAL — it is the\n * verb the impersonalize writer uses to stamp the retention markers.\n */\n [CoreResourceOperation.UPDATE_MANY]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n roles: [CORE_APP_ROLES.APP_ADMIN_SUPER_ADMIN],\n riskLevel: ResourceOperationRiskLevel.CRITICAL,\n }],\n },\n\n [CoreResourceOperation.READ]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n [CoreResourceOperation.LIST]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n [CoreResourceOperation.CREATE]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n [CoreResourceOperation.UPDATE]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n // assurance-control: WILDO.BILLING.CREDIT_GRANT_INTEGRITY — a credit-balance mutation is\n // system-only; it is never client-initiated.\n //\n // CONSUME is INTERNAL_CALL (no HTTP route), matching TOP_UP and the CRUD siblings. It is invoked\n // by service code that meters a paid feature (its enum doc: \"called by custom service code\"), not\n // by a client — the balance decrement happens as a side effect of using a metered capability, not\n // as a direct client action. Leaving it API_CALL let a client spend its own credits arbitrarily\n // (self-harm, not a grant) and, more importantly, made a system-automated op part of the client\n // attack surface. The `polymorphicRole` is retained for internal-authorization parity and no\n // longer confers client reachability.\n [CreditPool_Operations.CONSUME]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_MEMBER],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.MEDIUM,\n resourceOperationLike: CoreResourceOperation.UPDATE,\n requestDto: CreditPool_ConsumeRequestDto,\n }],\n },\n // assurance-control: WILDO.BILLING.CREDIT_GRANT_INTEGRITY — a credit GRANT (balance increase)\n // is system/payment-gated only; it is never client-initiated.\n //\n // TOP_UP is INTERNAL_CALL (no HTTP route), matching its CREATE/UPDATE siblings above. It\n // increments the spendable balance, so it must be reachable ONLY from server code that has\n // already verified payment: the billing webhook router computes `credits` from the PAID\n // product/quantity and invokes it via `executeCustomOperation` (which resolves the INTERNAL_CALL\n // default through `getServiceOperationPathDefault`). It was previously API_CALL gated to\n // ORG_OWNER, which let a tenant owner `PUT …/credit-pools/{id}/top-up {credits: N}` and\n // self-grant unlimited paid credits — the client \"buy credits\" action is OPEN_CHECKOUT, not a\n // direct balance write, so this route had no legitimate client caller. (The spec previously\n // hinted at a manual admin grant here; a support-initiated grant, if ever needed, belongs on a\n // separate platform-super-admin op with a mandatory audit event, NOT on a tenant-owner route.)\n // The `polymorphicRole` below is retained for internal-authorization parity with the CRUD ops\n // and no longer confers any client reachability.\n [CreditPool_Operations.TOP_UP]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.MEDIUM,\n resourceOperationLike: CoreResourceOperation.UPDATE,\n requestDto: CreditPool_TopUpRequestDto,\n }],\n },\n },\n },\n);\n"]}
@@ -28,9 +28,9 @@ export declare const CreditPoolSchema: z.ZodObject<{
28
28
  _id: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodString>;
29
29
  billingAccountId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodString>>>;
30
30
  poolKey: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodString>>>>;
31
- available: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodNumber>>>>;
32
- totalPurchased: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodNumber>>>>;
33
- totalConsumed: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodNumber>>>>;
31
+ available: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodNumber>>>;
32
+ totalPurchased: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodNumber>>>;
33
+ totalConsumed: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodNumber>>>;
34
34
  createdAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodDate>>>;
35
35
  updatedAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodDate>>>;
36
36
  }, z.core.$strip>;
@@ -39,9 +39,9 @@ export declare const creditPoolsPolymorphicDeclaration: import("..").Polymorphic
39
39
  _id: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodString>;
40
40
  billingAccountId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodString>>>;
41
41
  poolKey: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodString>>>>;
42
- available: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodNumber>>>>;
43
- totalPurchased: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodNumber>>>>;
44
- totalConsumed: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodNumber>>>>;
42
+ available: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodNumber>>>;
43
+ totalPurchased: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodNumber>>>;
44
+ totalConsumed: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodNumber>>>;
45
45
  createdAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodDate>>>;
46
46
  updatedAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodDate>>>;
47
47
  }, z.core.$strip>>;
@@ -1 +1 @@
1
- {"version":3,"file":"credit-pool.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/credit-pool.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,gBAAgB;;;;;;;;;iBAmB3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D,eAAO,MAAM,iCAAiC;;;;;;;;;kBAU5C,CAAC"}
1
+ {"version":3,"file":"credit-pool.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/credit-pool.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,gBAAgB;;;;;;;;;iBAwB3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D,eAAO,MAAM,iCAAiC;;;;;;;;;kBAU5C,CAAC"}
@@ -24,7 +24,6 @@
24
24
  * @see billing-and-features-system.md §9 (Credit Pool)
25
25
  */
26
26
  import { z } from 'zod';
27
- import { PersonalDataCategory } from '../compliance/privacy/personal-data-category.shared.schemas.js';
28
27
  import { declarePolymorphicSchemas, optOutPolymorphicAutoBusinessKey } from '../resources/utils/resource-polymorphism.schemas.js';
29
28
  import { BILLING_SCOPE_VARIANTS, BILLING_SCOPE_FK_VARIANTS } from './billing-account.shared.schemas.js';
30
29
  export const CreditPoolSchema = z.object({
@@ -36,11 +35,16 @@ export const CreditPoolSchema = z.object({
36
35
  /** Current available balance */
37
36
  // FINANCIAL — see the note on `billing-account.shared.schemas.ts`. A balance is a financial fact
38
37
  // about the account holder, not a usage metric.
39
- available: z.number().min(0).default(0).isSummaryField().isNotEditable().dataCategories(PersonalDataCategory.FINANCIAL),
38
+ // No `.dataCategories()`: this is an amount/term about the ACCOUNT, not a description of a person.
39
+ // The person is the scope foreign key, which the never-scrub floor preserves in every mode, and the
40
+ // value must survive erasure for the tax/audit obligation this family exists to serve — so it can be
41
+ // neither scrubbed nor honestly declared as personal data the row holds. See `retentionPolicy` on the
42
+ // resource config (#138).
43
+ available: z.number().min(0).default(0).isSummaryField().isNotEditable(),
40
44
  /** Total credits ever purchased (for audit/display) */
41
- totalPurchased: z.number().min(0).default(0).isSummaryField().isNotEditable().dataCategories(PersonalDataCategory.FINANCIAL),
45
+ totalPurchased: z.number().min(0).default(0).isSummaryField().isNotEditable(),
42
46
  /** Total credits consumed (for audit/display) */
43
- totalConsumed: z.number().min(0).default(0).isSummaryField().isNotEditable().dataCategories(PersonalDataCategory.FINANCIAL),
47
+ totalConsumed: z.number().min(0).default(0).isSummaryField().isNotEditable(),
44
48
  createdAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),
45
49
  updatedAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),
46
50
  });
@@ -1 +1 @@
1
- {"version":3,"file":"credit-pool.shared.schemas.js","sourceRoot":"","sources":["../../../../src/billing/credit-pool.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AACnG,OAAO,EAAE,yBAAyB,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AAC/H,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAErG,MAAM,CAAC,MAAM,gBAAgB,GAAG,C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AC,iBAAiB,EAAE;IACrF,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,EAAE;CACtF,CAAC,CAAC;AAGH,sEAAsE;AAEtE,MAAM,CAAC,MAAM,iCAAiC,GAAG,yBAAyB,CAAC;IACzE,gBAAgB,EAAE,aAAa;IAC/B,mBAAmB,EAAE,cAAc;IACnC,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,gBAAgB;IAC5B,4EAA4E;IAC5E,sEAAsE;IACtE,uEAAuE;IACvE,yEAAyE;IACzE,QAAQ,EAAE,sBAAsB,CAAC,GAAG,CAAC,gCAAgC,CAAC;CACvE,CAAC,CAAC","sourcesContent":["/**\n * Credit Pool Schema (Shared) — Polymorphic\n *\n * Tracks credit balances for CREDIT_PACK products.\n * Created/topped-up when a CREDIT_PACK purchase completes.\n * Decremented when credits are consumed (via custom service code).\n *\n * One pool per creditPoolKey per billing account.\n * Database index: `{ billingAccountId: 1, poolKey: 1 }` compound unique.\n *\n * POLYMORPHIC EXPANSION: Like subscriptions, credit pools are scope-expanded.\n * The `billingAccountId` FK is renamed per variant via polymorphic FK transformation:\n * - organizationCreditPools (with organizationId + organizationBillingAccountId)\n * - userCreditPools (with userId + userBillingAccountId)\n *\n *\n * Credit flow:\n * 1. User purchases CREDIT_PACK → Checkout completes → webhook\n * 2. Webhook router: creates/updates CreditPool (available += creditsPerUnit * quantity)\n * 3. CreditPool CONSUME custom op: validates balance and decrements available\n * 4. CreditPool TOP_UP custom op: increments available after purchase\n * 5. Frontend shows balance via BillingStateResponse.creditPools\n *\n * @see billing-and-features-system.md §9 (Credit Pool)\n */\n\nimport { z } from 'zod';\nimport { PersonalDataCategory } from '../compliance/privacy/personal-data-category.shared.schemas';\nimport { declarePolymorphicSchemas, optOutPolymorphicAutoBusinessKey } from '../resources/utils/resource-polymorphism.schemas';\nimport { BILLING_SCOPE_VARIANTS, BILLING_SCOPE_FK_VARIANTS } from './billing-account.shared.schemas';\n\nexport const CreditPoolSchema = z.object({\n _id: z.string().min(1).isPrimaryKey(),\n billingAccountId: z.string().min(1).isForeignKey({ polymorphicVariants: BILLING_SCOPE_FK_VARIANTS }).isDBIndexed().isSummaryField(),\n\n /** Pool identifier (matches ProductDefinition.purchaseConfig.creditPoolKey, e.g., 'ai_tokens') */\n poolKey: z.string().min(1).isDBIndexed().isSummaryField().isNotEditable()\n .isUnique({ compoundWith: 'billingAccountId' }),\n\n /** Current available balance */\n // FINANCIAL — see the note on `billing-account.shared.schemas.ts`. A balance is a financial fact\n // about the account holder, not a usage metric.\n available: z.number().min(0).default(0).isSummaryField().isNotEditable().dataCategories(PersonalDataCategory.FINANCIAL),\n /** Total credits ever purchased (for audit/display) */\n totalPurchased: z.number().min(0).default(0).isSummaryField().isNotEditable().dataCategories(PersonalDataCategory.FINANCIAL),\n /** Total credits consumed (for audit/display) */\n totalConsumed: z.number().min(0).default(0).isSummaryField().isNotEditable().dataCategories(PersonalDataCategory.FINANCIAL),\n\n createdAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n updatedAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n});\nexport type CreditPool = z.infer<typeof CreditPoolSchema>;\n\n// ── Polymorphic Declaration ────────────────────────────────────────\n\nexport const creditPoolsPolymorphicDeclaration = declarePolymorphicSchemas({\n baseResourceType: 'creditPools',\n baseFieldIdentifier: 'creditPoolId',\n baseEnumKey: 'CREDIT_POOLS',\n baseSchema: CreditPoolSchema,\n // Many pools per billing-account / scope (composite key: billingAccountId +\n // poolKey) — opt out of the polymorphism engine's singleton-per-scope\n // business-key auto-default. If pools ever become seedable, declare an\n // explicit `businessKeyFields: ['billingAccountId', 'poolKey']` instead.\n variants: BILLING_SCOPE_VARIANTS.map(optOutPolymorphicAutoBusinessKey),\n});\n"]}
1
+ {"version":3,"file":"credit-pool.shared.schemas.js","s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ACjD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,aAAa,EAAE;IAE5E,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,EAAE;IACrF,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,EAAE;CACtF,CAAC,CAAC;AAGH,sEAAsE;AAEtE,MAAM,CAAC,MAAM,iCAAiC,GAAG,yBAAyB,CAAC;IACzE,gBAAgB,EAAE,aAAa;IAC/B,mBAAmB,EAAE,cAAc;IACnC,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,gBAAgB;IAC5B,4EAA4E;IAC5E,sEAAsE;IACtE,uEAAuE;IACvE,yEAAyE;IACzE,QAAQ,EAAE,sBAAsB,CAAC,GAAG,CAAC,gCAAgC,CAAC;CACvE,CAAC,CAAC","sourcesContent":["/**\n * Credit Pool Schema (Shared) — Polymorphic\n *\n * Tracks credit balances for CREDIT_PACK products.\n * Created/topped-up when a CREDIT_PACK purchase completes.\n * Decremented when credits are consumed (via custom service code).\n *\n * One pool per creditPoolKey per billing account.\n * Database index: `{ billingAccountId: 1, poolKey: 1 }` compound unique.\n *\n * POLYMORPHIC EXPANSION: Like subscriptions, credit pools are scope-expanded.\n * The `billingAccountId` FK is renamed per variant via polymorphic FK transformation:\n * - organizationCreditPools (with organizationId + organizationBillingAccountId)\n * - userCreditPools (with userId + userBillingAccountId)\n *\n *\n * Credit flow:\n * 1. User purchases CREDIT_PACK → Checkout completes → webhook\n * 2. Webhook router: creates/updates CreditPool (available += creditsPerUnit * quantity)\n * 3. CreditPool CONSUME custom op: validates balance and decrements available\n * 4. CreditPool TOP_UP custom op: increments available after purchase\n * 5. Frontend shows balance via BillingStateResponse.creditPools\n *\n * @see billing-and-features-system.md §9 (Credit Pool)\n */\n\nimport { z } from 'zod';\nimport { declarePolymorphicSchemas, optOutPolymorphicAutoBusinessKey } from '../resources/utils/resource-polymorphism.schemas';\nimport { BILLING_SCOPE_VARIANTS, BILLING_SCOPE_FK_VARIANTS } from './billing-account.shared.schemas';\n\nexport const CreditPoolSchema = z.object({\n _id: z.string().min(1).isPrimaryKey(),\n billingAccountId: z.string().min(1).isForeignKey({ polymorphicVariants: BILLING_SCOPE_FK_VARIANTS }).isDBIndexed().isSummaryField(),\n\n /** Pool identifier (matches ProductDefinition.purchaseConfig.creditPoolKey, e.g., 'ai_tokens') */\n poolKey: z.string().min(1).isDBIndexed().isSummaryField().isNotEditable()\n .isUnique({ compoundWith: 'billingAccountId' }),\n\n /** Current available balance */\n // FINANCIAL — see the note on `billing-account.shared.schemas.ts`. A balance is a financial fact\n // about the account holder, not a usage metric.\n // No `.dataCategories()`: this is an amount/term about the ACCOUNT, not a description of a person.\n // The person is the scope foreign key, which the never-scrub floor preserves in every mode, and the\n // value must survive erasure for the tax/audit obligation this family exists to serve — so it can be\n // neither scrubbed nor honestly declared as personal data the row holds. See `retentionPolicy` on the\n // resource config (#138).\n available: z.number().min(0).default(0).isSummaryField().isNotEditable(),\n /** Total credits ever purchased (for audit/display) */\n totalPurchased: z.number().min(0).default(0).isSummaryField().isNotEditable(),\n /** Total credits consumed (for audit/display) */\n totalConsumed: z.number().min(0).default(0).isSummaryField().isNotEditable(),\n\n createdAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n updatedAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n});\nexport type CreditPool = z.infer<typeof CreditPoolSchema>;\n\n// ── Polymorphic Declaration ────────────────────────────────────────\n\nexport const creditPoolsPolymorphicDeclaration = declarePolymorphicSchemas({\n baseResourceType: 'creditPools',\n baseFieldIdentifier: 'creditPoolId',\n baseEnumKey: 'CREDIT_POOLS',\n baseSchema: CreditPoolSchema,\n // Many pools per billing-account / scope (composite key: billingAccountId +\n // poolKey) — opt out of the polymorphism engine's singleton-per-scope\n // business-key auto-default. If pools ever become seedable, declare an\n // explicit `businessKeyFields: ['billingAccountId', 'poolKey']` instead.\n variants: BILLING_SCOPE_VARIANTS.map(optOutPolymorphicAutoBusinessKey),\n});\n"]}
@@ -6,5 +6,5 @@
6
6
  * ...invoiceRefsPolymorphicFactories
7
7
  */
8
8
  import { CoreResourceOperation } from '../resources/resources.shared.core.definitions';
9
- export declare const invoiceRefsPolymorphicFactories: Record<string, import("..").ResourceConfiguration_InitializationFactory<undefined, CoreResourceOperation.READ | CoreResourceOperation.UPDATE | CoreResourceOperation.CREATE | CoreResourceOperation.LIST | CoreResourceOperation.SEARCH, any>>;
9
+ export declare const invoiceRefsPolymorphicFactories: Record<string, import("..").ResourceConfiguration_InitializationFactory<undefined, CoreResourceOperation.READ | CoreResourceOperation.UPDATE | CoreResourceOperation.UPDATE_MANY | CoreResourceOperation.CREATE | CoreResourceOperation.LIST | CoreResourceOperation.SEARCH, any>>;
10
10
  //# sourceMappingURL=invoice-ref.shared.resources-config.schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"invoice-ref.shared.resources-config.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/invoice-ref.shared.resources-config.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,qBAAqB,EAAoB,MAAM,gDAAgD,CAAC;AAWzG,eAAO,MAAM,+BAA+B,gPAmF3C,CAAC"}
1
+ {"version":3,"file":"invoice-ref.shared.resources-config.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/invoice-ref.shared.resources-config.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,qBAAqB,EAAoB,MAAM,gDAAgD,CAAC;AAYzG,eAAO,MAAM,+BAA+B,oRAwH3C,CAAC"}
@@ -12,19 +12,54 @@ import { CORE_APP_ROLES, CORE_ORG_ROLES } from '../security/authorizations/roles
12
12
  import { invoiceRefsPolymorphicDeclaration } from './invoice-ref.shared.schemas.js';
13
13
  import { ResourceSystemAccessMode } from '../resources/resources-config.shared.schemas.js';
14
14
  import { DataPortabilityProvenance } from '../compliance/privacy/subject-export.shared.schemas.js';
15
+ import { ErasureRetentionMode, ResourceDataSubjectKind } from '../compliance/privacy/impersonalization.shared.schemas.js';
15
16
  export const invoiceRefsPolymorphicFactories = createPolymorphicResourceConfigurations(invoiceRefsPolymorphicDeclaration, {
16
17
  isSystemResource: true,
17
18
  /** Subject-export disclosure. The subject's own invoice references — also legally retained records they are entitled to. Secrets and backend-only values are withheld by the export's security floor regardless of this grant. On a polymorphic resource this grant applies to EVERY generated variant, which is the documented intent of the shared config. */
18
19
  systemAccessPolicy: { exportSubject: ResourceSystemAccessMode.ALLOWED },
19
20
  portabilityPolicy: { defaultProvenance: DataPortabilityProvenance.OBSERVED },
21
+ /**
22
+ * Subject erasure RETAINS this row and scrubs the provider-hosted document URLs.
23
+ *
24
+ * `hostedInvoiceUrl` and `invoicePdfUrl` address documents that carry the person's name and billing
25
+ * address, so they are personal data this row holds and take `REMOVE`. `total` deliberately keeps its
26
+ * FINANCIAL category and takes NO treatment: it is retained under the same tax obligation, and the mode
27
+ * permits a categorized field to survive when the law requires it.
28
+ */
29
+ retentionPolicy: {
30
+ mode: ErasureRetentionMode.RETAIN_AND_IMPERSONALIZE,
31
+ },
32
+ /**
33
+ * Erasing one of these rows revokes NO session. The row is not a person — its owner FK names the ACTOR the
34
+ * record belongs to — and the enum prescribes `NO_PRINCIPAL` for exactly that shape. The subject's own
35
+ * session ends through the `USERS` row, which is `SELF_PRINCIPAL`.
36
+ */
37
+ dataSubjectPolicy: { kind: ResourceDataSubjectKind.NO_PRINCIPAL },
20
38
  coreOperations: [
21
39
  CoreResourceOperation.READ,
22
40
  CoreResourceOperation.LIST,
23
41
  CoreResourceOperation.SEARCH,
24
42
  CoreResourceOperation.CREATE,
25
43
  CoreResourceOperation.UPDATE,
44
+ // Route-less; `retentionPolicy` requires READ + LIST + UPDATE_MANY.
45
+ CoreResourceOperation.UPDATE_MANY,
26
46
  ],
27
47
  operationsConfiguration: {
48
+ /*
49
+ * Route-less retention plumbing — INTERNAL_CALL registers no route, so no API surface is added, and it
50
+ * must not be REPOSITORY_ONLY: the retention primitives resolve through `getServiceOperationPathDefault`,
51
+ * which matches only INTERNAL_CALL / API_CALL. LIST is LOW (a read-shaped op may not claim the
52
+ * HIGH/CRITICAL band, which carries an audit-emission obligation); UPDATE_MANY is CRITICAL — it is the
53
+ * verb the impersonalize writer uses to stamp the retention markers.
54
+ */
55
+ [CoreResourceOperation.UPDATE_MANY]: {
56
+ variants: [{
57
+ variantType: ResourceOperationVariantType.INTERNAL_CALL,
58
+ isDefault: true,
59
+ roles: [CORE_APP_ROLES.APP_ADMIN_SUPER_ADMIN],
60
+ riskLevel: ResourceOperationRiskLevel.CRITICAL,
61
+ }],
62
+ },
28
63
  [CoreResourceOperation.READ]: {
29
64
  variants: [{
30
65
  // API_CALL: invoices are a user-facing collection (Settings Hub → Billing →
@@ -1 +1 @@
1
- {"version":3,"file":"invoice-ref.shared.resources-config.schemas.js","sourceRoot":"","sources":["../../../../src/billing/invoice-ref.shared.resources-config.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AACzG,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,uCAAuC,EAAE,MAAM,kDAAkD,CAAC;AAC3G,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACjG,OAAO,EAAE,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8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AAS,EAAE,IAAI;oBACf,eAAe,EAAE;wBACf,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,SAAS,CAAC;wBACtF,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC;qBACpD;oBACD,SAAS,EAAE,0BAA0B,CAAC,GAAG;iBAC1C,CAAC;SACH;KACF;CACF,CACF,CAAC","sourcesContent":["/**\n * Invoice Reference Resource Configuration — Polymorphic\n *\n * Produces 3 factory functions (one per scope variant) via the polymorphic factory.\n * Spread into the registry factory map:\n * ...invoiceRefsPolymorphicFactories\n */\n\nimport { CoreResourceOperation, CoreResourceType } from '../resources/resources.shared.core.definitions';\nimport {\n ResourceOperationRiskLevel,\n ResourceOperationVariantType,\n} from '../resources/resources.shared.schemas';\nimport { createPolymorphicResourceConfigurations } from '../resources/utils/resource-polymorphism.factory';\nimport { CORE_APP_ROLES, CORE_ORG_ROLES } from '../security/authorizations/roles.shared.schemas';\nimport { invoiceRefsPolymorphicDeclaration } from './invoice-ref.shared.schemas';\nimport { ResourceSystemAccessMode } from '../resources/resources-config.shared.schemas';\nimport { DataPortabilityProvenance } from '../compliance/privacy/subject-export.shared.schemas';\n\nexport const invoiceRefsPolymorphicFactories = createPolymorphicResourceConfigurations(\n invoiceRefsPolymorphicDeclaration,\n {\n isSystemResource: true,\n /** Subject-export disclosure. The subject's own invoice references — also legally retained records they are entitled to. Secrets and backend-only values are withheld by the export's security floor regardless of this grant. On a polymorphic resource this grant applies to EVERY generated variant, which is the documented intent of the shared config. */\n systemAccessPolicy: { exportSubject: ResourceSystemAccessMode.ALLOWED },\n portabilityPolicy: { defaultProvenance: DataPortabilityProvenance.OBSERVED },\n\n coreOperations: [\n CoreResourceOperation.READ,\n CoreResourceOperation.LIST,\n CoreResourceOperation.SEARCH,\n CoreResourceOperation.CREATE,\n CoreResourceOperation.UPDATE,\n ],\n operationsConfiguration: {\n [CoreResourceOperation.READ]: {\n variants: [{\n // API_CALL: invoices are a user-facing collection (Settings Hub → Billing →\n // Invoices, and the resource presets' LIST/READ views). REPOSITORY_ONLY would\n // strip the op from the frontend registry and register no HTTP route.\n // Writes are INTERNAL_CALL (service-pipeline, no HTTP; created by Stripe webhooks, not users).\n variantType: ResourceOperationVariantType.API_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_ADMIN],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n [CoreResourceOperation.LIST]: {\n variants: [{\n variantType: ResourceOperationVariantType.API_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_ADMIN],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n [CoreResourceOperation.SEARCH]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_ADMIN],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n isSearchable: true,\n searchableFields: ['status'],\n searchableOptions: { caseSensitive: false, fullMatchOnly: false },\n filterFields: {},\n sortFields: [],\n maxPaginatedResultPerPageLimit: 50,\n }],\n },\n [CoreResourceOperation.CREATE]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_ADMIN],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n [CoreResourceOperation.UPDATE]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_ADMIN],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n },\n },\n);\n"]}
1
+ {"version":3,"file":"invoice-ref.shared.resources-config.schemas.js","sourceRoot":"","sources":["../../../../src/billing/invoice-ref.shared.resources-config.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AACzG,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,uCAAuC,EAAE,MAAM,kDAAkD,CAAC;AAC3G,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACjG,OAAO,EAAE,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,yBAAyB,EAAE,MAAM,qDAAqD,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,wDAAwD,CAAC;AAEvH,MAAM,CAAC,MAAM,+BAA+B,GAAG,uCAAuC,CACpF,iCAAiC,EACjC;IACE,gBAAgB,EAAE,IAAI;IACtB,gWAAgW;IAChW,kBAAkB,EAAE,EAAE,aAAa,EAAE,wBAAwB,CAAC,OAAO,EAAE;IACvE,iBAAiB,EAAE,EAAE,iBAAiB,EAAE,yBAAyB,CAAC,QAAQ,EAAE;IAE5E;;;;;;;OAOG;IACH,eAAe,EA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SACH;QACD,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE;YAC9B,QAAQ,EAAE,CAAC;oBACT,WAAW,EAAE,4BAA4B,CAAC,aAAa;oBACvD,SAAS,EAAE,IAAI;oBACf,eAAe,EAAE;wBACf,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,SAAS,CAAC;wBACtF,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC;qBACpD;oBACD,SAAS,EAAE,0BAA0B,CAAC,GAAG;iBAC1C,CAAC;SACH;KACF;CACF,CACF,CAAC","sourcesContent":["/**\n * Invoice Reference Resource Configuration — Polymorphic\n *\n * Produces 3 factory functions (one per scope variant) via the polymorphic factory.\n * Spread into the registry factory map:\n * ...invoiceRefsPolymorphicFactories\n */\n\nimport { CoreResourceOperation, CoreResourceType } from '../resources/resources.shared.core.definitions';\nimport {\n ResourceOperationRiskLevel,\n ResourceOperationVariantType,\n} from '../resources/resources.shared.schemas';\nimport { createPolymorphicResourceConfigurations } from '../resources/utils/resource-polymorphism.factory';\nimport { CORE_APP_ROLES, CORE_ORG_ROLES } from '../security/authorizations/roles.shared.schemas';\nimport { invoiceRefsPolymorphicDeclaration } from './invoice-ref.shared.schemas';\nimport { ResourceSystemAccessMode } from '../resources/resources-config.shared.schemas';\nimport { DataPortabilityProvenance } from '../compliance/privacy/subject-export.shared.schemas';\nimport { ErasureRetentionMode, ResourceDataSubjectKind } from '../compliance/privacy/impersonalization.shared.schemas';\n\nexport const invoiceRefsPolymorphicFactories = createPolymorphicResourceConfigurations(\n invoiceRefsPolymorphicDeclaration,\n {\n isSystemResource: true,\n /** Subject-export disclosure. The subject's own invoice references — also legally retained records they are entitled to. Secrets and backend-only values are withheld by the export's security floor regardless of this grant. On a polymorphic resource this grant applies to EVERY generated variant, which is the documented intent of the shared config. */\n systemAccessPolicy: { exportSubject: ResourceSystemAccessMode.ALLOWED },\n portabilityPolicy: { defaultProvenance: DataPortabilityProvenance.OBSERVED },\n\n /**\n * Subject erasure RETAINS this row and scrubs the provider-hosted document URLs.\n *\n * `hostedInvoiceUrl` and `invoicePdfUrl` address documents that carry the person's name and billing\n * address, so they are personal data this row holds and take `REMOVE`. `total` deliberately keeps its\n * FINANCIAL category and takes NO treatment: it is retained under the same tax obligation, and the mode\n * permits a categorized field to survive when the law requires it.\n */\n retentionPolicy: {\n mode: ErasureRetentionMode.RETAIN_AND_IMPERSONALIZE,\n },\n\n /**\n * Erasing one of these rows revokes NO session. The row is not a person — its owner FK names the ACTOR the\n * record belongs to — and the enum prescribes `NO_PRINCIPAL` for exactly that shape. The subject's own\n * session ends through the `USERS` row, which is `SELF_PRINCIPAL`.\n */\n dataSubjectPolicy: { kind: ResourceDataSubjectKind.NO_PRINCIPAL },\n\n coreOperations: [\n CoreResourceOperation.READ,\n CoreResourceOperation.LIST,\n CoreResourceOperation.SEARCH,\n CoreResourceOperation.CREATE,\n CoreResourceOperation.UPDATE,\n // Route-less; `retentionPolicy` requires READ + LIST + UPDATE_MANY.\n CoreResourceOperation.UPDATE_MANY,\n ],\n operationsConfiguration: {\n /*\n * Route-less retention plumbing — INTERNAL_CALL registers no route, so no API surface is added, and it\n * must not be REPOSITORY_ONLY: the retention primitives resolve through `getServiceOperationPathDefault`,\n * which matches only INTERNAL_CALL / API_CALL. LIST is LOW (a read-shaped op may not claim the\n * HIGH/CRITICAL band, which carries an audit-emission obligation); UPDATE_MANY is CRITICAL — it is the\n * verb the impersonalize writer uses to stamp the retention markers.\n */\n [CoreResourceOperation.UPDATE_MANY]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n roles: [CORE_APP_ROLES.APP_ADMIN_SUPER_ADMIN],\n riskLevel: ResourceOperationRiskLevel.CRITICAL,\n }],\n },\n\n [CoreResourceOperation.READ]: {\n variants: [{\n // API_CALL: invoices are a user-facing collection (Settings Hub → Billing →\n // Invoices, and the resource presets' LIST/READ views). REPOSITORY_ONLY would\n // strip the op from the frontend registry and register no HTTP route.\n // Writes are INTERNAL_CALL (service-pipeline, no HTTP; created by Stripe webhooks, not users).\n variantType: ResourceOperationVariantType.API_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_ADMIN],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n [CoreResourceOperation.LIST]: {\n variants: [{\n variantType: ResourceOperationVariantType.API_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_ADMIN],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n [CoreResourceOperation.SEARCH]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_ADMIN],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n isSearchable: true,\n searchableFields: ['status'],\n searchableOptions: { caseSensitive: false, fullMatchOnly: false },\n filterFields: {},\n sortFields: [],\n maxPaginatedResultPerPageLimit: 50,\n }],\n },\n [CoreResourceOperation.CREATE]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_ADMIN],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n [CoreResourceOperation.UPDATE]: {\n variants: [{\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isDefault: true,\n polymorphicRole: {\n [CoreResourceType.ORGANIZATIONS]: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_ADMIN],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER],\n },\n riskLevel: ResourceOperationRiskLevel.LOW,\n }],\n },\n },\n },\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"invoice-ref.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/invoice-ref.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,eAAO,MAAM,gBAAgB;;;;;;;;;;iBAyC3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D,eAAO,MAAM,iCAAiC;;;;;;;;;;kBAQ5C,CAAC"}
1
+ {"version":3,"file":"invoice-ref.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/invoice-ref.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,eAAO,MAAM,gBAAgB;;;;;;;;;;iBAmD3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D,eAAO,MAAM,iCAAiC;;;;;;;;;;kBAQ5C,CAAC"}
@@ -14,10 +14,11 @@
14
14
  */
15
15
  import { z } from 'zod';
16
16
  import { PersonalDataCategory } from '../compliance/privacy/personal-data-category.shared.schemas.js';
17
- import { z_money, CurrencyAllowed } from '@wildo-ai/zod-decorators';
17
+ import { z_money, CurrencyAllowed, addImpersonalizeWith } from '@wildo-ai/zod-decorators';
18
18
  import { declarePolymorphicSchemas, optOutPolymorphicAutoBusinessKey } from '../resources/utils/resource-polymorphism.schemas.js';
19
19
  import { BILLING_SCOPE_VARIANTS, BILLING_SCOPE_FK_VARIANTS } from './billing-account.shared.schemas.js';
20
20
  import { InvoiceStatus } from './billing-enums.shared.schemas.js';
21
+ import { RedactionType } from '../compliance/privacy/redaction.shared.schemas.js';
21
22
  export const InvoiceRefSchema = z.object({
22
23
  _id: z.string().min(1).isPrimaryKey().isSummaryField(),
23
24
  billingAccountId: z.string().min(1).isForeignKey({ polymorphicVariants: BILLING_SCOPE_FK_VARIANTS }).isDBIndexed(),
@@ -48,8 +49,12 @@ export const InvoiceRefSchema = z.object({
48
49
  * SaaS shape. Backend code reads these fields normally — they are present on `internalDto`.
49
50
  */
50
51
  // The URL IS the invoice: anyone holding it reads the line items. A category, not mere metadata.
51
- hostedInvoiceUrl: z.string().optional().isBackendOnly().dataCategories(PersonalDataCategory.FINANCIAL),
52
- invoicePdfUrl: z.string().optional().isBackendOnly().dataCategories(PersonalDataCategory.FINANCIAL),
52
+ // REMOVE both URLs on erasure. They address provider-hosted documents that CARRY the person's name and
53
+ // billing address — content about them, not an amount about the invoice. `total` deliberately keeps its
54
+ // category and takes NO treatment: it is retained under the tax/audit obligation this family exists to
55
+ // serve, and the mode permits a categorized field to survive when the law requires it.
56
+ hostedInvoiceUrl: addImpersonalizeWith(z.string().optional().isBackendOnly().dataCategories(PersonalDataCategory.FINANCIAL), RedactionType.REMOVE),
57
+ invoicePdfUrl: addImpersonalizeWith(z.string().optional().isBackendOnly().dataCategories(PersonalDataCategory.FINANCIAL), RedactionType.REMOVE),
53
58
  /** Provider reference */
54
59
  providerInvoiceId: z.string().isBackendOnly(),
55
60
  createdAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),
@@ -1 +1 @@
1
- {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aAAa,EAAE,CAAC,cAAc,CAAC,oBAAoB,CAAC,SAAS,CAAC;IACtG,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,aAAa,EAAE,CAAC,cAAc,CAAC,oBAAoB,CAAC,SAAS,CAAC;IAEnG,yBAAyB;IACzB,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,aAAa,EAAE;IAE7C,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,EAAE;IACrF,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,EAAE;CACtF,CAAC,CAAC;AAGH,sEAAsE;AAEtE,MAAM,CAAC,MAAM,iCAAiC,GAAG,yBAAyB,CAAC;IACzE,gBAAgB,EAAE,aAAa;IAC/B,mBAAmB,EAAE,cAAc;IACnC,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,gBAAgB;IAC5B,uEAAuE;IACvE,uEAAuE;IACvE,QAAQ,EAAE,sBAAsB,CAAC,GAAG,CAAC,gCAAgC,CAAC;CACvE,CAAC,CAAC","sourcesContent":["/**\n * Invoice Reference Schema (Shared) — Polymorphic\n *\n * Thin reference synced FROM provider (webhook-driven), NOT created by Wildo.\n * Only stores what's needed for: billing status checks, quick display, and provider links.\n *\n * POLYMORPHIC EXPANSION: Like subscriptions, invoice refs are scope-expanded.\n * The `billingAccountId` FK is renamed per variant via polymorphic FK transformation:\n * - organizationInvoiceRefs (with organizationId + organizationBillingAccountId)\n * - userInvoiceRefs (with userId + userBillingAccountId)\n *\n *\n * @see billing-and-features-system.md §6.4 (Invoice References)\n */\n\nimport { z } from 'zod';\nimport { PersonalDataCategory } from '../compliance/privacy/personal-data-category.shared.schemas';\nimport { z_money, CurrencyAllowed } from '@wildo-ai/zod-decorators';\nimport { declarePolymorphicSchemas, optOutPolymorphicAutoBusinessKey } from '../resources/utils/resource-polymorphism.schemas';\nimport { BILLING_SCOPE_VARIANTS, BILLING_SCOPE_FK_VARIANTS } from './billing-account.shared.schemas';\nimport { InvoiceStatus } from './billing-enums.shared.schemas';\n\nexport const InvoiceRefSchema = z.object({\n _id: z.string().min(1).isPrimaryKey().isSummaryField(),\n billingAccountId: z.string().min(1).isForeignKey({ polymorphicVariants: BILLING_SCOPE_FK_VARIANTS }).isDBIndexed(),\n\n /** Status - needed for billing status checks (past_due detection, etc.) */\n status: z.enum(InvoiceStatus).isDBIndexed().isSummaryField().systemEnum('InvoiceStatus'),\n\n /** Total amount - needed for quick display in subscription overview */\n // FINANCIAL — see the note on `billing-account.shared.schemas.ts` for why this rides the shared base.\n total: z_money({ currenciesAllowed: [CurrencyAllowed.FIAT] }).isSummaryField().dataCategories(PersonalDataCategory.FINANCIAL),\n\n /**\n * Provider-hosted invoice URLs — **backend-only, deliberately not exposed to clients.**\n *\n * These are CAPABILITY-STYLE links: whoever holds one can open the document, with no\n * authentication. And the document is a tax invoice, which is legally required to carry the\n * customer's full name and billing address (EU VAT Directive 2006/112/EC Art. 226(5), and\n * equivalents elsewhere) — so the invoice PDF is personal data even though this row is not.\n *\n * That combination is why the URLs cannot sit in the response DTO. After a subject erasure the\n * row is deliberately RETAINED and stays visible for accounting, and an ordinarily-readable link\n * to a document rendering the erased person's name and address would defeat the erasure.\n *\n * The document itself is NEVER scrubbed or unlinked: mutilating it would void it as a tax\n * record, which is precisely what the retention obligation exists to preserve (GDPR Art. 17(3)(b)\n * exempts processing required by a legal obligation). Access is what is controlled, not content.\n *\n * The user-facing door is the provider's own customer portal\n * (`StandardBilling_Interface.createCustomerPortalSession`, surfaced as the billing account's\n * `open_portal` operation), which authenticates the viewer provider-side and is the conventional\n * SaaS shape. Backend code reads these fields normally — they are present on `internalDto`.\n */\n // The URL IS the invoice: anyone holding it reads the line items. A category, not mere metadata.\n hostedInvoiceUrl: z.string().optional().isBackendOnly().dataCategories(PersonalDataCategory.FINANCIAL),\n invoicePdfUrl: z.string().optional().isBackendOnly().dataCategories(PersonalDataCategory.FINANCIAL),\n\n /** Provider reference */\n providerInvoiceId: z.string().isBackendOnly(),\n\n createdAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n updatedAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n});\nexport type InvoiceRef = z.infer<typeof InvoiceRefSchema>;\n\n// ── Polymorphic Declaration ────────────────────────────────────────\n\nexport const invoiceRefsPolymorphicDeclaration = declarePolymorphicSchemas({\n baseResourceType: 'invoiceRefs',\n baseFieldIdentifier: 'invoiceRefId',\n baseEnumKey: 'INVOICE_REFS',\n baseSchema: InvoiceRefSchema,\n // Many invoices per scope (LIST/SEARCH/CREATE/UPDATE) — opt out of the\n // polymorphism engine's singleton-per-scope business-key auto-default.\n variants: BILLING_SCOPE_VARIANTS.map(optOutPolymorphicAutoBusinessKey),\n});\n"]}
1
+ {"version":3,"file":"invoice-ref.shared.schemas.js","sourceRoot":"","sources":["../../../../src/billing/invoice-ref.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AACnG,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,yBAAyB,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AAC/H,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AACrG,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAE/E,MAAM,CAAC,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IAAI,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,EAAE;IACrF,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,EAAE;CACtF,CAAC,CAAC;AAGH,sEAAsE;AAEtE,MAAM,CAAC,MAAM,iCAAiC,GAAG,yBAAyB,CAAC;IACzE,gBAAgB,EAAE,aAAa;IAC/B,mBAAmB,EAAE,cAAc;IACnC,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,gBAAgB;IAC5B,uEAAuE;IACvE,uEAAuE;IACvE,QAAQ,EAAE,sBAAsB,CAAC,GAAG,CAAC,gCAAgC,CAAC;CACvE,CAAC,CAAC","sourcesContent":["/**\n * Invoice Reference Schema (Shared) — Polymorphic\n *\n * Thin reference synced FROM provider (webhook-driven), NOT created by Wildo.\n * Only stores what's needed for: billing status checks, quick display, and provider links.\n *\n * POLYMORPHIC EXPANSION: Like subscriptions, invoice refs are scope-expanded.\n * The `billingAccountId` FK is renamed per variant via polymorphic FK transformation:\n * - organizationInvoiceRefs (with organizationId + organizationBillingAccountId)\n * - userInvoiceRefs (with userId + userBillingAccountId)\n *\n *\n * @see billing-and-features-system.md §6.4 (Invoice References)\n */\n\nimport { z } from 'zod';\nimport { PersonalDataCategory } from '../compliance/privacy/personal-data-category.shared.schemas';\nimport { z_money, CurrencyAllowed, addImpersonalizeWith } from '@wildo-ai/zod-decorators';\nimport { declarePolymorphicSchemas, optOutPolymorphicAutoBusinessKey } from '../resources/utils/resource-polymorphism.schemas';\nimport { BILLING_SCOPE_VARIANTS, BILLING_SCOPE_FK_VARIANTS } from './billing-account.shared.schemas';\nimport { InvoiceStatus } from './billing-enums.shared.schemas';\nimport { RedactionType } from '../compliance/privacy/redaction.shared.schemas';\n\nexport const InvoiceRefSchema = z.object({\n _id: z.string().min(1).isPrimaryKey().isSummaryField(),\n billingAccountId: z.string().min(1).isForeignKey({ polymorphicVariants: BILLING_SCOPE_FK_VARIANTS }).isDBIndexed(),\n\n /** Status - needed for billing status checks (past_due detection, etc.) */\n status: z.enum(InvoiceStatus).isDBIndexed().isSummaryField().systemEnum('InvoiceStatus'),\n\n /** Total amount - needed for quick display in subscription overview */\n // FINANCIAL — see the note on `billing-account.shared.schemas.ts` for why this rides the shared base.\n total: z_money({ currenciesAllowed: [CurrencyAllowed.FIAT] }).isSummaryField().dataCategories(PersonalDataCategory.FINANCIAL),\n\n /**\n * Provider-hosted invoice URLs — **backend-only, deliberately not exposed to clients.**\n *\n * These are CAPABILITY-STYLE links: whoever holds one can open the document, with no\n * authentication. And the document is a tax invoice, which is legally required to carry the\n * customer's full name and billing address (EU VAT Directive 2006/112/EC Art. 226(5), and\n * equivalents elsewhere) — so the invoice PDF is personal data even though this row is not.\n *\n * That combination is why the URLs cannot sit in the response DTO. After a subject erasure the\n * row is deliberately RETAINED and stays visible for accounting, and an ordinarily-readable link\n * to a document rendering the erased person's name and address would defeat the erasure.\n *\n * The document itself is NEVER scrubbed or unlinked: mutilating it would void it as a tax\n * record, which is precisely what the retention obligation exists to preserve (GDPR Art. 17(3)(b)\n * exempts processing required by a legal obligation). Access is what is controlled, not content.\n *\n * The user-facing door is the provider's own customer portal\n * (`StandardBilling_Interface.createCustomerPortalSession`, surfaced as the billing account's\n * `open_portal` operation), which authenticates the viewer provider-side and is the conventional\n * SaaS shape. Backend code reads these fields normally — they are present on `internalDto`.\n */\n // The URL IS the invoice: anyone holding it reads the line items. A category, not mere metadata.\n // REMOVE both URLs on erasure. They address provider-hosted documents that CARRY the person's name and\n // billing address — content about them, not an amount about the invoice. `total` deliberately keeps its\n // category and takes NO treatment: it is retained under the tax/audit obligation this family exists to\n // serve, and the mode permits a categorized field to survive when the law requires it.\n hostedInvoiceUrl: addImpersonalizeWith(\n z.string().optional().isBackendOnly().dataCategories(PersonalDataCategory.FINANCIAL),\n RedactionType.REMOVE,\n ),\n invoicePdfUrl: addImpersonalizeWith(\n z.string().optional().isBackendOnly().dataCategories(PersonalDataCategory.FINANCIAL),\n RedactionType.REMOVE,\n ),\n\n /** Provider reference */\n providerInvoiceId: z.string().isBackendOnly(),\n\n createdAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n updatedAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n});\nexport type InvoiceRef = z.infer<typeof InvoiceRefSchema>;\n\n// ── Polymorphic Declaration ────────────────────────────────────────\n\nexport const invoiceRefsPolymorphicDeclaration = declarePolymorphicSchemas({\n baseResourceType: 'invoiceRefs',\n baseFieldIdentifier: 'invoiceRefId',\n baseEnumKey: 'INVOICE_REFS',\n baseSchema: InvoiceRefSchema,\n // Many invoices per scope (LIST/SEARCH/CREATE/UPDATE) — opt out of the\n // polymorphism engine's singleton-per-scope business-key auto-default.\n variants: BILLING_SCOPE_VARIANTS.map(optOutPolymorphicAutoBusinessKey),\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"price.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/price.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,cAAc,EACf,MAAM,gCAAgC,CAAC;AAIxC;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;;;;iBAO1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAIxD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;iBA4CtB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
1
+ {"version":3,"file":"price.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/price.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,cAAc,EACf,MAAM,gCAAgC,CAAC;AAIxC;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;;;;iBAO1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAIxD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;iBAkDtB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -55,7 +55,13 @@ export const PriceSchema = z.object({
55
55
  usageAggregation: z.enum(UsageAggregationType).optional(),
56
56
  /**
57
57
  * Tax behavior for this price (maps to Stripe's price.tax_behavior).
58
- * Resolved from: price-level override > product.taxDisplayMode > BillingConfiguration.tax.defaultDisplayMode.
58
+ *
59
+ * There is NO resolution chain: this value alone reaches the provider. The catalog sync passes
60
+ * `taxBehavior` straight through on both the price upsert and the provider price creation, so
61
+ * leaving it unset does not fall back to `product.taxDisplayMode` or to
62
+ * `BillingConfiguration.tax.defaultDisplayMode`. The provider call simply omits `tax_behavior`
63
+ * and the billing account's own default decides. Declare it here on every price whose tax
64
+ * presentation matters.
59
65
  * - 'exclusive': amount is HT, tax added on top
60
66
  * - 'inclusive': amount is TTC, tax embedded
61
67
  * When absent: inherits from product, then from global config.
@@ -1 +1 @@
1
- {"version":3,"file":"price.shared.schemas.js","sourceRoot":"","sources":["../../../../src/billing/price.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACL,YAAY,EACZ,eAAe,EACf,oBAAoB,EAC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C,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3C,gDAAgD;IAChD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE;IAC1C,iEAAiE;IACjE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACzC,gDAAgD;IAChD,gBAAgB,EAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE;IAEzD;;;;;;OAMG;IACH,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;IAE9C,mEAAmE;IACnE,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,aAAa,EAAE;IACtD,4EAA4E;IAC5E,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACpC,mDAAmD;IACnD,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE;IAEjD,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,EAAE;CACtF,CAAC,CAAC","sourcesContent":["/**\n * Price & Price Tier Schemas (Shared)\n *\n * Prices define how much a product costs. A product can have multiple prices\n * (e.g., monthly vs. yearly, different currencies).\n *\n * Prices are APPLICATION-scoped, linked to a Product via productId.\n * Like products, they are populated lazily from the code-defined catalog.\n *\n * @see billing-and-features-system.md §6.2 (Product & Price Catalog)\n */\n\nimport { z } from 'zod';\nimport { z_money, CurrencyAllowed } from '@wildo-ai/zod-decorators';\nimport {\n PricingModel,\n BillingInterval,\n UsageAggregationType,\n TaxDisplayMode,\n} from './billing-enums.shared.schemas';\n\n// ── Price Tier ─────────────────────────────────────────────────────\n\n/**\n * A single tier in a tiered/graduated pricing model.\n * `upTo: null` means \"infinity\" (the final open-ended tier).\n *\n * Tier amounts carry their own currency via z_money for:\n * - Self-describing data (no implicit dependency on parent Price's currency)\n * - Proper money input rendering in forms\n * - Bigint precision for all monetary values\n */\nexport const PriceTierSchema = z.object({\n /** Upper bound for this tier (null = infinity, i.e. the last tier) */\n upTo: z.number().nullable(),\n /** Per-unit price for this tier */\n unitPrice: z_money({ currenciesAllowed: [CurrencyAllowed.FIAT], minAmount: 0n }),\n /** Flat price added to this tier (on top of unit pricing) */\n flatPrice: z_money({ currenciesAllowed: [CurrencyAllowed.FIAT], minAmount: 0n }),\n});\nexport type PriceTier = z.infer<typeof PriceTierSchema>;\n\n// ── Price ──────────────────────────────────────────────────────────\n\nexport const PriceSchema = z.object({\n\n _id: z.string().min(1).isPrimaryKey().isSummaryField(),\n /** Reference to the parent product */\n productId: z.string().min(1).isForeignKey().isDBIndexed(),\n\n /** Pricing model (flat, per_unit, tiered, graduated, package) */\n model: z.enum(PricingModel).isSummaryField().systemEnum('PricingModel'),\n /**\n * Unit price for FLAT/PER_UNIT models.\n * Uses z_money for bigint precision, self-contained currency, and proper form rendering.\n * Undefined for TIERED/GRADUATED models (use `tiers` instead).\n */\n unitPrice: z_money({ currenciesAllowed: [CurrencyAllowed.FIAT], minAmount: 0n }).isSummaryField(),\n\n /** Billing interval (undefined for one-time prices) */\n interval: z.enum(BillingInterval).optional().isSummaryField(),\n /** Interval count (e.g., 3 for quarterly = interval:'month', intervalCount:3) */\n intervalCount: z.number().min(1).default(1),\n\n /** Tiers for TIERED/GRADUATED pricing models */\n tiers: z.array(PriceTierSchema).optional(),\n /** Package size for PACKAGE pricing model (price per N units) */\n packageSize: z.number().min(1).optional(),\n /** Usage aggregation type for metered prices */\n usageAggregation: z.enum(UsageAggregationType).optional(),\n\n /**\n * Tax behavior for this price (maps to Stripe's price.tax_behavior).\n * Resolved from: price-level override > product.taxDisplayMode > BillingConfiguration.tax.defaultDisplayMode.\n * - 'exclusive': amount is HT, tax added on top\n * - 'inclusive': amount is TTC, tax embedded\n * When absent: inherits from product, then from global config.\n */\n taxBehavior: z.enum(TaxDisplayMode).optional(),\n\n /** Provider sync (lazy: populated on first use, not at startup) */\n providerPriceId: z.string().optional().isBackendOnly(),\n /** Whether this is the default price for the product (shown first in UI) */\n isDefault: z.boolean().default(true),\n /** Whether this price is available for purchase */\n isActive: z.boolean().default(true).isDBIndexed(),\n\n createdAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n});\nexport type Price = z.infer<typeof PriceSchema>;\n"]}
1
+ {"version":3,"file":"price.shared.schemas.js","sourceRoot":"","sources":["../../../../src/billing/price.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACL,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,cAAc,GACf,MAAM,gCAAgC,CAAC;AAExC,sEAAsE;AAEtE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,sEAAsE;IACtE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,mCAAmC;IACnC,SAAS,EAAE,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IAChF,6DAA6D;IAC7D,SAAS,EAAE,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;CACjF,CAAC,CAAC;AAGH,sEAAsE;AAEtE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,C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,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACpC,mDAAmD;IACnD,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE;IAEjD,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,EAAE;CACtF,CAAC,CAAC","sourcesContent":["/**\n * Price & Price Tier Schemas (Shared)\n *\n * Prices define how much a product costs. A product can have multiple prices\n * (e.g., monthly vs. yearly, different currencies).\n *\n * Prices are APPLICATION-scoped, linked to a Product via productId.\n * Like products, they are populated lazily from the code-defined catalog.\n *\n * @see billing-and-features-system.md §6.2 (Product & Price Catalog)\n */\n\nimport { z } from 'zod';\nimport { z_money, CurrencyAllowed } from '@wildo-ai/zod-decorators';\nimport {\n PricingModel,\n BillingInterval,\n UsageAggregationType,\n TaxDisplayMode,\n} from './billing-enums.shared.schemas';\n\n// ── Price Tier ─────────────────────────────────────────────────────\n\n/**\n * A single tier in a tiered/graduated pricing model.\n * `upTo: null` means \"infinity\" (the final open-ended tier).\n *\n * Tier amounts carry their own currency via z_money for:\n * - Self-describing data (no implicit dependency on parent Price's currency)\n * - Proper money input rendering in forms\n * - Bigint precision for all monetary values\n */\nexport const PriceTierSchema = z.object({\n /** Upper bound for this tier (null = infinity, i.e. the last tier) */\n upTo: z.number().nullable(),\n /** Per-unit price for this tier */\n unitPrice: z_money({ currenciesAllowed: [CurrencyAllowed.FIAT], minAmount: 0n }),\n /** Flat price added to this tier (on top of unit pricing) */\n flatPrice: z_money({ currenciesAllowed: [CurrencyAllowed.FIAT], minAmount: 0n }),\n});\nexport type PriceTier = z.infer<typeof PriceTierSchema>;\n\n// ── Price ──────────────────────────────────────────────────────────\n\nexport const PriceSchema = z.object({\n\n _id: z.string().min(1).isPrimaryKey().isSummaryField(),\n /** Reference to the parent product */\n productId: z.string().min(1).isForeignKey().isDBIndexed(),\n\n /** Pricing model (flat, per_unit, tiered, graduated, package) */\n model: z.enum(PricingModel).isSummaryField().systemEnum('PricingModel'),\n /**\n * Unit price for FLAT/PER_UNIT models.\n * Uses z_money for bigint precision, self-contained currency, and proper form rendering.\n * Undefined for TIERED/GRADUATED models (use `tiers` instead).\n */\n unitPrice: z_money({ currenciesAllowed: [CurrencyAllowed.FIAT], minAmount: 0n }).isSummaryField(),\n\n /** Billing interval (undefined for one-time prices) */\n interval: z.enum(BillingInterval).optional().isSummaryField(),\n /** Interval count (e.g., 3 for quarterly = interval:'month', intervalCount:3) */\n intervalCount: z.number().min(1).default(1),\n\n /** Tiers for TIERED/GRADUATED pricing models */\n tiers: z.array(PriceTierSchema).optional(),\n /** Package size for PACKAGE pricing model (price per N units) */\n packageSize: z.number().min(1).optional(),\n /** Usage aggregation type for metered prices */\n usageAggregation: z.enum(UsageAggregationType).optional(),\n\n /**\n * Tax behavior for this price (maps to Stripe's price.tax_behavior).\n *\n * There is NO resolution chain: this value alone reaches the provider. The catalog sync passes\n * `taxBehavior` straight through on both the price upsert and the provider price creation, so\n * leaving it unset does not fall back to `product.taxDisplayMode` or to\n * `BillingConfiguration.tax.defaultDisplayMode`. The provider call simply omits `tax_behavior`\n * and the billing account's own default decides. Declare it here on every price whose tax\n * presentation matters.\n * - 'exclusive': amount is HT, tax added on top\n * - 'inclusive': amount is TTC, tax embedded\n * When absent: inherits from product, then from global config.\n */\n taxBehavior: z.enum(TaxDisplayMode).optional(),\n\n /** Provider sync (lazy: populated on first use, not at startup) */\n providerPriceId: z.string().optional().isBackendOnly(),\n /** Whether this is the default price for the product (shown first in UI) */\n isDefault: z.boolean().default(true),\n /** Whether this price is available for purchase */\n isActive: z.boolean().default(true).isDBIndexed(),\n\n createdAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n});\nexport type Price = z.infer<typeof PriceSchema>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"product-behavior-policy.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/product-behavior-policy.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,yBAAyB,EAC1B,MAAM,gCAAgC,CAAC;AAIxC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB;;;iBAK3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqDtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
1
+ {"version":3,"file":"product-behavior-policy.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/product-behavior-policy.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,yBAAyB,EAC1B,MAAM,gCAAgC,CAAC;AAIxC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB;;;iBAK3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8FtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -44,7 +44,17 @@ export const ProductBehaviorPolicySchema = z.object({
44
44
  trial: z.object({
45
45
  /** Number of trial days (0 = no trial) */
46
46
  days: z.number().min(0).default(0),
47
- /** Whether to require a payment method before trial starts */
47
+ /**
48
+ * Require a payment method before the trial starts. READ since 2026-09-08 (#408).
49
+ *
50
+ * It reached no provider call before that, so a trial declared as requiring a card behaved
51
+ * identically to one that did not — Wonder Todos' enterprise plan (`true`) and professional
52
+ * plan (`false`) were indistinguishable at the provider.
53
+ *
54
+ * Only meaningful WITH a trial: a product declaring it alongside `days: 0` demands nothing,
55
+ * because asking for a card up front on a purchase with no trial is a different decision and
56
+ * nobody authored it.
57
+ */
48
58
  requirePaymentMethod: z.boolean().default(false),
49
59
  }).optional(),
50
60
  /** Upgrade behavior (when switching TO this plan from a lower tier) */
@@ -67,22 +77,53 @@ export const ProductBehaviorPolicySchema = z.object({
67
77
  defaultBehavior: z.enum(BillingTiming).default(BillingTiming.AT_PERIOD_END),
68
78
  }).optional(),
69
79
  /**
70
- * Authored metering policy (for METERED products only).
80
+ * Authored metering policy (for METERED products only), READ by
81
+ * `UsageMeteringBackendService` since 2026-09-08 (#415).
71
82
  *
72
- * The current `UsageMeteringBackendService` does not yet consume these
73
- * scheduling, aggregation-window or retry values: it groups every pending row
74
- * by billing account and product whenever the externally scheduled flush runs.
75
- * Keep this distinction visible so configuration documentation does not turn
76
- * an accepted policy shape into a false runtime guarantee.
83
+ * Every field here was declared, defaulted, documented and read by NOTHING until then: the flush
84
+ * merged every pending row by billing account and product whatever the product said, so
85
+ * `preFlushAggregation: false` was unrepresentable and `aggregationWindow`'s two members selected
86
+ * between behaviours that were the same behaviour. The note that stood here said exactly that and
87
+ * asked that the gap stay visible rather than become "a false runtime guarantee"; this replaces it
88
+ * because the guarantee is now real, and says which reader makes each field true.
77
89
  */
78
90
  metering: z.object({
79
- /** How often to flush aggregated usage to billing provider (minutes) */
91
+ /**
92
+ * How often to flush aggregated usage to the billing provider (minutes).
93
+ *
94
+ * Read by the engine's usage-flush batch, which picks the SHORTEST interval any metered product
95
+ * authors — a schedule is one thing and the products sharing it are many, so the fastest promise
96
+ * is the one that has to be kept. A product asking for less frequent reporting than its neighbour
97
+ * still gets reported at the neighbour's cadence, which costs nothing: reporting sooner than
98
+ * authored is never wrong, reporting later than authored is.
99
+ */
80
100
  flushIntervalMinutes: z.number().min(1).default(60),
81
- /** Aggregation window for usage records before flush */
101
+ /**
102
+ * Whether one meter event may span a billing-period boundary.
103
+ *
104
+ * This is not a preference, it is a correctness choice about MONEY. A merged group carries ONE
105
+ * timestamp and the provider assigns the event to the period that timestamp falls in, so
106
+ * `PER_FLUSH` merging across a boundary bills the earlier period's usage into the later one.
107
+ * `PER_BILLING_PERIOD` splits at the boundary, derived from the subscription's own
108
+ * `currentPeriodStart` / `currentPeriodEnd`. Leave it `PER_FLUSH` when the product's periods do
109
+ * not change what it costs.
110
+ */
82
111
  aggregationWindow: z.enum(MeteringAggregationWindow).default(MeteringAggregationWindow.PER_FLUSH),
83
- /** Aggregate locally before sending (sum up same-key records) */
112
+ /**
113
+ * Aggregate locally before sending (sum same-key records into one meter event).
114
+ *
115
+ * `false` sends one event per recorded row, each with its own instant. Choose it when the provider
116
+ * must see every event — because its aggregation is not a sum, or because the individual instants
117
+ * matter. Local merging destroys both irreversibly, before the provider ever sees them.
118
+ */
84
119
  preFlushAggregation: z.boolean().default(true),
85
- /** Retry policy when provider flush fails */
120
+ /**
121
+ * Retry policy when a provider report fails.
122
+ *
123
+ * Safe only because every meter event carries a derived idempotency identifier: a retry after a
124
+ * response lost in transit re-sends the same identifier and the provider discards it. Retrying
125
+ * without that is how a timeout becomes a double charge, which is why the two shipped together.
126
+ */
86
127
  retryPolicy: z.object({
87
128
  maxRetries: z.number().default(3),
88
129
  backoffMultiplier: z.number().default(2),