@wildo-ai/saas-models 1.1.7 → 1.1.9

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 (882) hide show
  1. package/dist/esm/_inspect.d.ts.map +1 -1
  2. package/dist/esm/_inspect.js.map +1 -1
  3. package/dist/esm/applications/application-metadata.shared.resources-config.schemas.d.ts.map +1 -1
  4. package/dist/esm/applications/application-metadata.shared.resources-config.schemas.js.map +1 -1
  5. package/dist/esm/applications/application-subject.shared.schemas.d.ts.map +1 -1
  6. package/dist/esm/applications/application-subject.shared.schemas.js.map +1 -1
  7. package/dist/esm/applications/application-versions.shared.resources-config.schemas.d.ts.map +1 -1
  8. package/dist/esm/applications/application-versions.shared.resources-config.schemas.js.map +1 -1
  9. package/dist/esm/applications/applications-context.schemas.d.ts.map +1 -1
  10. package/dist/esm/applications/applications-context.schemas.js.map +1 -1
  11. package/dist/esm/applications/applications.shared.resources-config.schemas.d.ts.map +1 -1
  12. package/dist/esm/applications/applications.shared.resources-config.schemas.js.map +1 -1
  13. package/dist/esm/applications/applications.shared.schemas.d.ts.map +1 -1
  14. package/dist/esm/applications/applications.shared.schemas.js.map +1 -1
  15. package/dist/esm/billing/billing-account.shared.resources-config.schemas.d.ts.map +1 -1
  16. package/dist/esm/billing/billing-account.shared.resources-config.schemas.js.map +1 -1
  17. package/dist/esm/billing/billing-account.shared.schemas.d.ts.map +1 -1
  18. package/dist/esm/billing/billing-account.shared.schemas.js.map +1 -1
  19. package/dist/esm/billing/billing-configuration.shared.schemas.d.ts.map +1 -1
  20. package/dist/esm/billing/billing-configuration.shared.schemas.js.map +1 -1
  21. package/dist/esm/billing/billing-enums.shared.schemas.d.ts.map +1 -1
  22. package/dist/esm/billing/billing-enums.shared.schemas.js.map +1 -1
  23. package/dist/esm/billing/billing-types.shared.schemas.d.ts.map +1 -1
  24. package/dist/esm/billing/billing-types.shared.schemas.js.map +1 -1
  25. package/dist/esm/billing/credit-pool.shared.resources-config.schemas.d.ts.map +1 -1
  26. package/dist/esm/billing/credit-pool.shared.resources-config.schemas.js.map +1 -1
  27. package/dist/esm/billing/credit-pool.shared.schemas.d.ts.map +1 -1
  28. package/dist/esm/billing/credit-pool.shared.schemas.js.map +1 -1
  29. package/dist/esm/billing/invoice-ref.shared.resources-config.schemas.d.ts.map +1 -1
  30. package/dist/esm/billing/invoice-ref.shared.resources-config.schemas.js.map +1 -1
  31. package/dist/esm/billing/invoice-ref.shared.schemas.d.ts.map +1 -1
  32. package/dist/esm/billing/invoice-ref.shared.schemas.js.map +1 -1
  33. package/dist/esm/billing/price.shared.resources-config.schemas.d.ts.map +1 -1
  34. package/dist/esm/billing/price.shared.resources-config.schemas.js.map +1 -1
  35. package/dist/esm/billing/price.shared.schemas.d.ts.map +1 -1
  36. package/dist/esm/billing/price.shared.schemas.js.map +1 -1
  37. package/dist/esm/billing/product-behavior-policy.shared.schemas.d.ts.map +1 -1
  38. package/dist/esm/billing/product-behavior-policy.shared.schemas.js.map +1 -1
  39. package/dist/esm/billing/product-definition.shared.schemas.d.ts.map +1 -1
  40. package/dist/esm/billing/product-definition.shared.schemas.js.map +1 -1
  41. package/dist/esm/billing/product.shared.resources-config.schemas.d.ts.map +1 -1
  42. package/dist/esm/billing/product.shared.resources-config.schemas.js.map +1 -1
  43. package/dist/esm/billing/product.shared.schemas.d.ts.map +1 -1
  44. package/dist/esm/billing/product.shared.schemas.js.map +1 -1
  45. package/dist/esm/billing/promotions.shared.resources-config.schemas.d.ts.map +1 -1
  46. package/dist/esm/billing/promotions.shared.resources-config.schemas.js.map +1 -1
  47. package/dist/esm/billing/promotions.shared.schemas.d.ts.map +1 -1
  48. package/dist/esm/billing/promotions.shared.schemas.js.map +1 -1
  49. package/dist/esm/billing/public-pricing-catalog.shared.atoms.d.ts.map +1 -1
  50. package/dist/esm/billing/public-pricing-catalog.shared.atoms.js.map +1 -1
  51. package/dist/esm/billing/public-pricing-catalog.shared.d.ts.map +1 -1
  52. package/dist/esm/billing/public-pricing-catalog.shared.js.map +1 -1
  53. package/dist/esm/billing/referral-reward.shared.schemas.d.ts.map +1 -1
  54. package/dist/esm/billing/referral-reward.shared.schemas.js.map +1 -1
  55. package/dist/esm/billing/referral.shared.resources-config.schemas.d.ts.map +1 -1
  56. package/dist/esm/billing/referral.shared.resources-config.schemas.js.map +1 -1
  57. package/dist/esm/billing/referral.shared.schemas.d.ts.map +1 -1
  58. package/dist/esm/billing/referral.shared.schemas.js.map +1 -1
  59. package/dist/esm/billing/subscription.shared.resources-config.schemas.d.ts.map +1 -1
  60. package/dist/esm/billing/subscription.shared.resources-config.schemas.js.map +1 -1
  61. package/dist/esm/billing/subscription.shared.schemas.d.ts.map +1 -1
  62. package/dist/esm/billing/subscription.shared.schemas.js.map +1 -1
  63. package/dist/esm/billing/usage-flush-evidence.shared.schemas.d.ts.map +1 -1
  64. package/dist/esm/billing/usage-flush-evidence.shared.schemas.js.map +1 -1
  65. package/dist/esm/billing/usage-record.shared.resources-config.schemas.d.ts.map +1 -1
  66. package/dist/esm/billing/usage-record.shared.resources-config.schemas.js.map +1 -1
  67. package/dist/esm/billing/usage-record.shared.schemas.d.ts.map +1 -1
  68. package/dist/esm/billing/usage-record.shared.schemas.js.map +1 -1
  69. package/dist/esm/charts/aggregation-query.shared.schemas.d.ts.map +1 -1
  70. package/dist/esm/charts/aggregation-query.shared.schemas.js.map +1 -1
  71. package/dist/esm/charts/aggregation.shared.definitions.d.ts.map +1 -1
  72. package/dist/esm/charts/aggregation.shared.definitions.js.map +1 -1
  73. package/dist/esm/charts/chart-definition-builder.shared.d.ts.map +1 -1
  74. package/dist/esm/charts/chart-definition-builder.shared.js.map +1 -1
  75. package/dist/esm/companion/artifact-placement.shared.definitions.d.ts.map +1 -1
  76. package/dist/esm/companion/artifact-placement.shared.definitions.js.map +1 -1
  77. package/dist/esm/companion/provider-discovery.shared.schemas.d.ts +13 -0
  78. package/dist/esm/companion/provider-discovery.shared.schemas.d.ts.map +1 -1
  79. package/dist/esm/companion/provider-discovery.shared.schemas.js +13 -0
  80. package/dist/esm/companion/provider-discovery.shared.schemas.js.map +1 -1
  81. package/dist/esm/companion/shared-library-companion.shared.definitions.d.ts.map +1 -1
  82. package/dist/esm/companion/shared-library-companion.shared.definitions.js.map +1 -1
  83. package/dist/esm/companion-exports.d.ts.map +1 -1
  84. package/dist/esm/companion-exports.js.map +1 -1
  85. package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.d.ts.map +1 -1
  86. package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.js.map +1 -1
  87. package/dist/esm/compliance/audit-trails/audit-actor.shared.schemas.d.ts.map +1 -1
  88. package/dist/esm/compliance/audit-trails/audit-actor.shared.schemas.js.map +1 -1
  89. package/dist/esm/compliance/audit-trails/audit-export-projection.shared.schemas.d.ts.map +1 -1
  90. package/dist/esm/compliance/audit-trails/audit-export-projection.shared.schemas.js.map +1 -1
  91. package/dist/esm/compliance/audit-trails/audit-log-sink.shared.schemas.d.ts.map +1 -1
  92. package/dist/esm/compliance/audit-trails/audit-log-sink.shared.schemas.js.map +1 -1
  93. package/dist/esm/compliance/audit-trails/audit-logs.shared.resources-config.schemas.d.ts.map +1 -1
  94. package/dist/esm/compliance/audit-trails/audit-logs.shared.resources-config.schemas.js.map +1 -1
  95. package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.d.ts.map +1 -1
  96. package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.js.map +1 -1
  97. package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.d.ts.map +1 -1
  98. package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.js.map +1 -1
  99. package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.d.ts.map +1 -1
  100. package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.js.map +1 -1
  101. package/dist/esm/compliance/data-classification/data-classification.shared.schemas.d.ts.map +1 -1
  102. package/dist/esm/compliance/data-classification/data-classification.shared.schemas.js.map +1 -1
  103. package/dist/esm/compliance/documents/governed-document-interactions.shared.schemas.d.ts.map +1 -1
  104. package/dist/esm/compliance/documents/governed-document-interactions.shared.schemas.js.map +1 -1
  105. package/dist/esm/compliance/documents/governed-documents.shared.schemas.d.ts.map +1 -1
  106. package/dist/esm/compliance/documents/governed-documents.shared.schemas.js.map +1 -1
  107. package/dist/esm/compliance/documents/user-governed-document-acceptances.shared.resources-config.schemas.d.ts.map +1 -1
  108. package/dist/esm/compliance/documents/user-governed-document-acceptances.shared.resources-config.schemas.js.map +1 -1
  109. package/dist/esm/compliance/documents/user-governed-document-acceptances.shared.schemas.d.ts.map +1 -1
  110. package/dist/esm/compliance/documents/user-governed-document-acceptances.shared.schemas.js.map +1 -1
  111. package/dist/esm/compliance/privacy/ai-use-posture.shared.schemas.d.ts.map +1 -1
  112. package/dist/esm/compliance/privacy/ai-use-posture.shared.schemas.js.map +1 -1
  113. package/dist/esm/compliance/privacy/capability-consent-purposes.shared.utils.d.ts.map +1 -1
  114. package/dist/esm/compliance/privacy/capability-consent-purposes.shared.utils.js.map +1 -1
  115. package/dist/esm/compliance/privacy/client-storage.shared.schemas.d.ts.map +1 -1
  116. package/dist/esm/compliance/privacy/client-storage.shared.schemas.js.map +1 -1
  117. package/dist/esm/compliance/privacy/consent-gate-vocabulary.shared.schemas.d.ts.map +1 -1
  118. package/dist/esm/compliance/privacy/consent-gate-vocabulary.shared.schemas.js.map +1 -1
  119. package/dist/esm/compliance/privacy/consent-purposes.shared.d.ts.map +1 -1
  120. package/dist/esm/compliance/privacy/consent-purposes.shared.js.map +1 -1
  121. package/dist/esm/compliance/privacy/data-subject-rights.shared.schemas.d.ts.map +1 -1
  122. package/dist/esm/compliance/privacy/data-subject-rights.shared.schemas.js.map +1 -1
  123. package/dist/esm/compliance/privacy/impersonalization-scrub.shared.utils.d.ts.map +1 -1
  124. package/dist/esm/compliance/privacy/impersonalization-scrub.shared.utils.js.map +1 -1
  125. package/dist/esm/compliance/privacy/impersonalization.shared.schemas.d.ts.map +1 -1
  126. package/dist/esm/compliance/privacy/impersonalization.shared.schemas.js.map +1 -1
  127. package/dist/esm/compliance/privacy/legal-hold-subject-attribution.shared.utils.d.ts.map +1 -1
  128. package/dist/esm/compliance/privacy/legal-hold-subject-attribution.shared.utils.js.map +1 -1
  129. package/dist/esm/compliance/privacy/legal-holds.shared.resources-config.schemas.d.ts.map +1 -1
  130. package/dist/esm/compliance/privacy/legal-holds.shared.resources-config.schemas.js.map +1 -1
  131. package/dist/esm/compliance/privacy/legal-holds.shared.schemas.d.ts.map +1 -1
  132. package/dist/esm/compliance/privacy/legal-holds.shared.schemas.js.map +1 -1
  133. package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.d.ts.map +1 -1
  134. package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.js.map +1 -1
  135. package/dist/esm/compliance/privacy/operator-compliance-identity.shared.schemas.d.ts +32 -1
  136. package/dist/esm/compliance/privacy/operator-compliance-identity.shared.schemas.d.ts.map +1 -1
  137. package/dist/esm/compliance/privacy/operator-compliance-identity.shared.schemas.js +32 -0
  138. package/dist/esm/compliance/privacy/operator-compliance-identity.shared.schemas.js.map +1 -1
  139. package/dist/esm/compliance/privacy/personal-data-category.shared.schemas.d.ts.map +1 -1
  140. package/dist/esm/compliance/privacy/personal-data-category.shared.schemas.js.map +1 -1
  141. package/dist/esm/compliance/privacy/personal-data-declaration.shared.utils.d.ts.map +1 -1
  142. package/dist/esm/compliance/privacy/personal-data-declaration.shared.utils.js.map +1 -1
  143. package/dist/esm/compliance/privacy/privacy.shared.schemas.d.ts.map +1 -1
  144. package/dist/esm/compliance/privacy/privacy.shared.schemas.js.map +1 -1
  145. package/dist/esm/compliance/privacy/provider-capability-disclosure.shared.schemas.d.ts.map +1 -1
  146. package/dist/esm/compliance/privacy/provider-capability-disclosure.shared.schemas.js.map +1 -1
  147. package/dist/esm/compliance/privacy/purpose-ref.shared.schemas.d.ts.map +1 -1
  148. package/dist/esm/compliance/privacy/purpose-ref.shared.schemas.js.map +1 -1
  149. package/dist/esm/compliance/privacy/redaction.shared.schemas.d.ts.map +1 -1
  150. package/dist/esm/compliance/privacy/redaction.shared.schemas.js.map +1 -1
  151. package/dist/esm/compliance/privacy/retention-binding.shared.utils.d.ts.map +1 -1
  152. package/dist/esm/compliance/privacy/retention-binding.shared.utils.js.map +1 -1
  153. package/dist/esm/compliance/privacy/retention-enforcement-records.shared.resources-config.schemas.d.ts.map +1 -1
  154. package/dist/esm/compliance/privacy/retention-enforcement-records.shared.resources-config.schemas.js.map +1 -1
  155. package/dist/esm/compliance/privacy/retention-enforcement-records.shared.schemas.d.ts.map +1 -1
  156. package/dist/esm/compliance/privacy/retention-enforcement-records.shared.schemas.js.map +1 -1
  157. package/dist/esm/compliance/privacy/retention-schedule.shared.schemas.d.ts.map +1 -1
  158. package/dist/esm/compliance/privacy/retention-schedule.shared.schemas.js.map +1 -1
  159. package/dist/esm/compliance/privacy/retention-scope-deleted.shared.utils.d.ts.map +1 -1
  160. package/dist/esm/compliance/privacy/retention-scope-deleted.shared.utils.js.map +1 -1
  161. package/dist/esm/compliance/privacy/sharing.shared.schemas.d.ts.map +1 -1
  162. package/dist/esm/compliance/privacy/sharing.shared.schemas.js.map +1 -1
  163. package/dist/esm/compliance/privacy/subject-data-recipients.shared.schemas.d.ts.map +1 -1
  164. package/dist/esm/compliance/privacy/subject-data-recipients.shared.schemas.js.map +1 -1
  165. package/dist/esm/compliance/privacy/subject-erasure-lane-evidence.shared.schemas.d.ts.map +1 -1
  166. package/dist/esm/compliance/privacy/subject-erasure-lane-evidence.shared.schemas.js.map +1 -1
  167. package/dist/esm/compliance/privacy/subject-erasure.shared.schemas.d.ts.map +1 -1
  168. package/dist/esm/compliance/privacy/subject-erasure.shared.schemas.js.map +1 -1
  169. package/dist/esm/compliance/privacy/subject-export-render.shared.utils.d.ts.map +1 -1
  170. package/dist/esm/compliance/privacy/subject-export-render.shared.utils.js.map +1 -1
  171. package/dist/esm/compliance/privacy/subject-export.shared.schemas.d.ts.map +1 -1
  172. package/dist/esm/compliance/privacy/subject-export.shared.schemas.js.map +1 -1
  173. package/dist/esm/compliance/review-cadence.shared.schemas.d.ts.map +1 -1
  174. package/dist/esm/compliance/review-cadence.shared.schemas.js.map +1 -1
  175. package/dist/esm/compliance/risk-posture.shared.schemas.d.ts +15 -3
  176. package/dist/esm/compliance/risk-posture.shared.schemas.d.ts.map +1 -1
  177. package/dist/esm/compliance/risk-posture.shared.schemas.js +14 -2
  178. package/dist/esm/compliance/risk-posture.shared.schemas.js.map +1 -1
  179. package/dist/esm/config/analytics-value-moments.shared.schemas.d.ts.map +1 -1
  180. package/dist/esm/config/analytics-value-moments.shared.schemas.js.map +1 -1
  181. package/dist/esm/config/app-configuration-shared.shared.schemas.d.ts.map +1 -1
  182. package/dist/esm/config/app-configuration-shared.shared.schemas.js.map +1 -1
  183. package/dist/esm/config/app-frontend-type.shared.schemas.d.ts.map +1 -1
  184. package/dist/esm/config/app-frontend-type.shared.schemas.js.map +1 -1
  185. package/dist/esm/config/auth-config-resolution.shared.utils.d.ts.map +1 -1
  186. package/dist/esm/config/auth-config-resolution.shared.utils.js.map +1 -1
  187. package/dist/esm/config/brand-assets.shared.schemas.d.ts.map +1 -1
  188. package/dist/esm/config/brand-assets.shared.schemas.js.map +1 -1
  189. package/dist/esm/config/configuration-validation.shared.schemas.d.ts.map +1 -1
  190. package/dist/esm/config/configuration-validation.shared.schemas.js.map +1 -1
  191. package/dist/esm/config/entity-identity-config.shared.schemas.d.ts.map +1 -1
  192. package/dist/esm/config/entity-identity-config.shared.schemas.js.map +1 -1
  193. package/dist/esm/config/frontend/chart-definition.shared.schemas.d.ts.map +1 -1
  194. package/dist/esm/config/frontend/chart-definition.shared.schemas.js.map +1 -1
  195. package/dist/esm/config/frontend/chart-registration-alignment.shared.d.ts.map +1 -1
  196. package/dist/esm/config/frontend/chart-registration-alignment.shared.js.map +1 -1
  197. package/dist/esm/config/frontend/navigation.shared.schemas.d.ts.map +1 -1
  198. package/dist/esm/config/frontend/navigation.shared.schemas.js.map +1 -1
  199. package/dist/esm/config/frontend/onboarding.shared.schemas.d.ts.map +1 -1
  200. package/dist/esm/config/frontend/onboarding.shared.schemas.js.map +1 -1
  201. package/dist/esm/config/postgresql.shared.schemas.d.ts.map +1 -1
  202. package/dist/esm/config/postgresql.shared.schemas.js.map +1 -1
  203. package/dist/esm/config/registration-acquisition-policy.shared.utils.d.ts.map +1 -1
  204. package/dist/esm/config/registration-acquisition-policy.shared.utils.js.map +1 -1
  205. package/dist/esm/config-authoring.entry.d.ts.map +1 -1
  206. package/dist/esm/config-authoring.entry.js.map +1 -1
  207. package/dist/esm/crdt/crdt-merge.shared.utils.d.ts.map +1 -1
  208. package/dist/esm/crdt/crdt-merge.shared.utils.js.map +1 -1
  209. package/dist/esm/data-seeding/data-seeding-config.shared.schemas.d.ts.map +1 -1
  210. package/dist/esm/data-seeding/data-seeding-config.shared.schemas.js.map +1 -1
  211. package/dist/esm/errors/caught-error-description.shared.utils.d.ts.map +1 -1
  212. package/dist/esm/errors/caught-error-description.shared.utils.js.map +1 -1
  213. package/dist/esm/errors/errors.custom-message-ref.shared.definitions.d.ts.map +1 -1
  214. package/dist/esm/errors/errors.custom-message-ref.shared.definitions.js.map +1 -1
  215. package/dist/esm/errors/errors.shared.definitions.d.ts.map +1 -1
  216. package/dist/esm/errors/errors.shared.definitions.js.map +1 -1
  217. package/dist/esm/errors/errors.shared.schemas.d.ts.map +1 -1
  218. package/dist/esm/errors/errors.shared.schemas.js.map +1 -1
  219. package/dist/esm/errors/errors.shared.utils.d.ts.map +1 -1
  220. package/dist/esm/errors/errors.shared.utils.js.map +1 -1
  221. package/dist/esm/errors/resource-access-forbidden.shared.error.d.ts.map +1 -1
  222. package/dist/esm/errors/resource-access-forbidden.shared.error.js.map +1 -1
  223. package/dist/esm/errors/thrown-value-description.shared.utils.d.ts.map +1 -1
  224. package/dist/esm/errors/thrown-value-description.shared.utils.js.map +1 -1
  225. package/dist/esm/errors/zod-issue-formatting.shared.utils.d.ts.map +1 -1
  226. package/dist/esm/errors/zod-issue-formatting.shared.utils.js.map +1 -1
  227. package/dist/esm/exports/tabular-csv.shared.utils.d.ts.map +1 -1
  228. package/dist/esm/exports/tabular-csv.shared.utils.js.map +1 -1
  229. package/dist/esm/external-data/external-data-pipeline-description.shared.d.ts.map +1 -1
  230. package/dist/esm/external-data/external-data-pipeline-description.shared.js.map +1 -1
  231. package/dist/esm/external-data/external-data-pipeline-pass-mode.shared.d.ts.map +1 -1
  232. package/dist/esm/external-data/external-data-pipeline-pass-mode.shared.js.map +1 -1
  233. package/dist/esm/external-data/external-data-pipeline.shared.schemas.d.ts.map +1 -1
  234. package/dist/esm/external-data/external-data-pipeline.shared.schemas.js.map +1 -1
  235. package/dist/esm/external-data/external-data-provenance.shared.d.ts.map +1 -1
  236. package/dist/esm/external-data/external-data-provenance.shared.js.map +1 -1
  237. package/dist/esm/external-data.exports.d.ts.map +1 -1
  238. package/dist/esm/external-data.exports.js.map +1 -1
  239. package/dist/esm/external-providers/compose-provider-registry.shared.d.ts.map +1 -1
  240. package/dist/esm/external-providers/compose-provider-registry.shared.js.map +1 -1
  241. package/dist/esm/external-providers/engine-capabilities.shared.schemas.d.ts.map +1 -1
  242. package/dist/esm/external-providers/engine-capabilities.shared.schemas.js.map +1 -1
  243. package/dist/esm/external-providers/engine-capability-resolution-mode.shared.d.ts.map +1 -1
  244. package/dist/esm/external-providers/engine-capability-resolution-mode.shared.js.map +1 -1
  245. package/dist/esm/external-providers/engine-capability-surface.shared.d.ts.map +1 -1
  246. package/dist/esm/external-providers/engine-capability-surface.shared.js.map +1 -1
  247. package/dist/esm/external-providers/external-providers.shared.schemas.d.ts.map +1 -1
  248. package/dist/esm/external-providers/external-providers.shared.schemas.js.map +1 -1
  249. package/dist/esm/external-providers/frontend-bootstrap.shared.schemas.d.ts.map +1 -1
  250. package/dist/esm/external-providers/frontend-bootstrap.shared.schemas.js.map +1 -1
  251. package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.d.ts.map +1 -1
  252. package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.js.map +1 -1
  253. package/dist/esm/external-providers/frontend-capability-runtime.shared.types.d.ts.map +1 -1
  254. package/dist/esm/external-providers/frontend-capability-runtime.shared.types.js.map +1 -1
  255. package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.d.ts.map +1 -1
  256. package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.js.map +1 -1
  257. package/dist/esm/external-providers/frontend-provider-public-config.shared.d.ts.map +1 -1
  258. package/dist/esm/external-providers/frontend-provider-public-config.shared.js.map +1 -1
  259. package/dist/esm/external-providers/model-cost-accounting-config.shared.schemas.d.ts.map +1 -1
  260. package/dist/esm/external-providers/model-cost-accounting-config.shared.schemas.js.map +1 -1
  261. package/dist/esm/external-providers/provider-address-lookup-contract.shared.types.d.ts.map +1 -1
  262. package/dist/esm/external-providers/provider-address-lookup-contract.shared.types.js.map +1 -1
  263. package/dist/esm/external-providers/provider-augmentation-opt-ins.shared.schemas.d.ts.map +1 -1
  264. package/dist/esm/external-providers/provider-augmentation-opt-ins.shared.schemas.js.map +1 -1
  265. package/dist/esm/external-providers/provider-authentication-assurance.shared.schemas.d.ts.map +1 -1
  266. package/dist/esm/external-providers/provider-authentication-assurance.shared.schemas.js.map +1 -1
  267. package/dist/esm/external-providers/provider-browser-operations.shared.schemas.d.ts.map +1 -1
  268. package/dist/esm/external-providers/provider-browser-operations.shared.schemas.js.map +1 -1
  269. package/dist/esm/external-providers/provider-capability.shared.schemas.d.ts.map +1 -1
  270. package/dist/esm/external-providers/provider-capability.shared.schemas.js.map +1 -1
  271. package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.d.ts.map +1 -1
  272. package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.js.map +1 -1
  273. package/dist/esm/external-providers/provider-frontend-component-contract.shared.types.d.ts.map +1 -1
  274. package/dist/esm/external-providers/provider-frontend-component-contract.shared.types.js.map +1 -1
  275. package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.d.ts.map +1 -1
  276. package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.js.map +1 -1
  277. package/dist/esm/external-providers/provider-metadata.shared.schemas.d.ts.map +1 -1
  278. package/dist/esm/external-providers/provider-metadata.shared.schemas.js.map +1 -1
  279. package/dist/esm/external-providers/provider-package-allow-list.shared.schemas.d.ts.map +1 -1
  280. package/dist/esm/external-providers/provider-package-allow-list.shared.schemas.js.map +1 -1
  281. package/dist/esm/external-providers/provider-protocol.shared.schemas.d.ts.map +1 -1
  282. package/dist/esm/external-providers/provider-protocol.shared.schemas.js.map +1 -1
  283. package/dist/esm/external-providers/provider-scope-reauthorization.shared.schemas.d.ts.map +1 -1
  284. package/dist/esm/external-providers/provider-scope-reauthorization.shared.schemas.js.map +1 -1
  285. package/dist/esm/external-providers/provider-shared-connections.shared.schemas.d.ts.map +1 -1
  286. package/dist/esm/external-providers/provider-shared-connections.shared.schemas.js.map +1 -1
  287. package/dist/esm/external-providers/provider-tier-rule.shared.utils.d.ts.map +1 -1
  288. package/dist/esm/external-providers/provider-tier-rule.shared.utils.js.map +1 -1
  289. package/dist/esm/external-providers/provider-usage-cost.shared.d.ts.map +1 -1
  290. package/dist/esm/external-providers/provider-usage-cost.shared.js.map +1 -1
  291. package/dist/esm/external-providers/provider-usage-pricing.example.d.ts.map +1 -1
  292. package/dist/esm/external-providers/provider-usage-pricing.example.js.map +1 -1
  293. package/dist/esm/external-providers/provider-usage-pricing.shared.schemas.d.ts.map +1 -1
  294. package/dist/esm/external-providers/provider-usage-pricing.shared.schemas.js.map +1 -1
  295. package/dist/esm/features/application-features.shared.resources-config.schemas.d.ts.map +1 -1
  296. package/dist/esm/features/application-features.shared.resources-config.schemas.js.map +1 -1
  297. package/dist/esm/features/connected-feature.example.d.ts.map +1 -1
  298. package/dist/esm/features/connected-feature.example.js.map +1 -1
  299. package/dist/esm/features/core-feature-definitions.shared.d.ts.map +1 -1
  300. package/dist/esm/features/core-feature-definitions.shared.js.map +1 -1
  301. package/dist/esm/features/feature-builders.shared.d.ts.map +1 -1
  302. package/dist/esm/features/feature-builders.shared.js.map +1 -1
  303. package/dist/esm/features/feature-definition.shared.schemas.d.ts.map +1 -1
  304. package/dist/esm/features/feature-definition.shared.schemas.js.map +1 -1
  305. package/dist/esm/features/feature-registry.shared.d.ts.map +1 -1
  306. package/dist/esm/features/feature-registry.shared.js.map +1 -1
  307. package/dist/esm/features/feature-resolution.shared.schemas.d.ts.map +1 -1
  308. package/dist/esm/features/feature-resolution.shared.schemas.js.map +1 -1
  309. package/dist/esm/features/scope-features.shared.schemas.d.ts.map +1 -1
  310. package/dist/esm/features/scope-features.shared.schemas.js.map +1 -1
  311. package/dist/esm/features/user-features.shared.resources-config.schemas.d.ts.map +1 -1
  312. package/dist/esm/features/user-features.shared.resources-config.schemas.js.map +1 -1
  313. package/dist/esm/files/file-remote-reference-link.shared.schemas.d.ts.map +1 -1
  314. package/dist/esm/files/file-remote-reference-link.shared.schemas.js.map +1 -1
  315. package/dist/esm/files/file-upload-grant.shared.schemas.d.ts.map +1 -1
  316. package/dist/esm/files/file-upload-grant.shared.schemas.js.map +1 -1
  317. package/dist/esm/files/files.shared.resources-config.schemas.d.ts.map +1 -1
  318. package/dist/esm/files/files.shared.resources-config.schemas.js.map +1 -1
  319. package/dist/esm/files/files.shared.schemas.d.ts.map +1 -1
  320. package/dist/esm/files/files.shared.schemas.js.map +1 -1
  321. package/dist/esm/files/files.shared.utils.d.ts.map +1 -1
  322. package/dist/esm/files/files.shared.utils.js.map +1 -1
  323. package/dist/esm/flows-actors/a2a-push-delivery-log.shared.resources-config.schemas.d.ts.map +1 -1
  324. package/dist/esm/flows-actors/a2a-push-delivery-log.shared.resources-config.schemas.js.map +1 -1
  325. package/dist/esm/flows-actors/a2a-push-delivery-log.shared.schemas.d.ts.map +1 -1
  326. package/dist/esm/flows-actors/a2a-push-delivery-log.shared.schemas.js.map +1 -1
  327. package/dist/esm/flows-actors/a2a-token-budget-state.shared.resources-config.schemas.d.ts.map +1 -1
  328. package/dist/esm/flows-actors/a2a-token-budget-state.shared.resources-config.schemas.js.map +1 -1
  329. package/dist/esm/flows-actors/a2a-token-budget-state.shared.schemas.d.ts.map +1 -1
  330. package/dist/esm/flows-actors/a2a-token-budget-state.shared.schemas.js.map +1 -1
  331. package/dist/esm/flows-actors/actors.shared.schemas.d.ts.map +1 -1
  332. package/dist/esm/flows-actors/actors.shared.schemas.js.map +1 -1
  333. package/dist/esm/flows-actors/agent-traceability.shared.schemas.d.ts.map +1 -1
  334. package/dist/esm/flows-actors/agent-traceability.shared.schemas.js.map +1 -1
  335. package/dist/esm/flows-actors/agent-work-decisions.shared.resources-config.schemas.d.ts.map +1 -1
  336. package/dist/esm/flows-actors/agent-work-decisions.shared.resources-config.schemas.js.map +1 -1
  337. package/dist/esm/flows-actors/agent-work-decisions.shared.schemas.d.ts.map +1 -1
  338. package/dist/esm/flows-actors/agent-work-decisions.shared.schemas.js.map +1 -1
  339. package/dist/esm/flows-actors/agents.shared.schemas.d.ts.map +1 -1
  340. package/dist/esm/flows-actors/agents.shared.schemas.js.map +1 -1
  341. package/dist/esm/flows-actors/autonomous-agents.shared.schemas.d.ts.map +1 -1
  342. package/dist/esm/flows-actors/autonomous-agents.shared.schemas.js.map +1 -1
  343. package/dist/esm/flows-actors/deliberation.shared.schemas.d.ts.map +1 -1
  344. package/dist/esm/flows-actors/deliberation.shared.schemas.js.map +1 -1
  345. package/dist/esm/flows-actors/execution-plan-readiness.shared.utils.d.ts.map +1 -1
  346. package/dist/esm/flows-actors/execution-plan-readiness.shared.utils.js.map +1 -1
  347. package/dist/esm/flows-actors/flows-actors-execution.shared.resources-config.schemas.d.ts.map +1 -1
  348. package/dist/esm/flows-actors/flows-actors-execution.shared.resources-config.schemas.js.map +1 -1
  349. package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.d.ts.map +1 -1
  350. package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.js.map +1 -1
  351. package/dist/esm/flows-actors/flows-actors-task.shared.resources-config.schemas.d.ts.map +1 -1
  352. package/dist/esm/flows-actors/flows-actors-task.shared.resources-config.schemas.js.map +1 -1
  353. package/dist/esm/flows-actors/flows-actors-task.shared.schemas.d.ts.map +1 -1
  354. package/dist/esm/flows-actors/flows-actors-task.shared.schemas.js.map +1 -1
  355. package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.d.ts.map +1 -1
  356. package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.js.map +1 -1
  357. package/dist/esm/flows-actors/flows-actors.configuration.shared.schemas.d.ts.map +1 -1
  358. package/dist/esm/flows-actors/flows-actors.configuration.shared.schemas.js.map +1 -1
  359. package/dist/esm/flows-actors/flows-actors.frontend.shared.schemas.d.ts.map +1 -1
  360. package/dist/esm/flows-actors/flows-actors.frontend.shared.schemas.js.map +1 -1
  361. package/dist/esm/flows-actors/flows-actors.io.shared.schemas.d.ts.map +1 -1
  362. package/dist/esm/flows-actors/flows-actors.io.shared.schemas.js.map +1 -1
  363. package/dist/esm/flows-actors/flows-actors.system.shared.definitions.d.ts.map +1 -1
  364. package/dist/esm/flows-actors/flows-actors.system.shared.definitions.js.map +1 -1
  365. package/dist/esm/flows-actors/flows-actors.system.shared.schemas.d.ts.map +1 -1
  366. package/dist/esm/flows-actors/flows-actors.system.shared.schemas.js.map +1 -1
  367. package/dist/esm/flows-actors/flows.shared.schemas.d.ts.map +1 -1
  368. package/dist/esm/flows-actors/flows.shared.schemas.js.map +1 -1
  369. package/dist/esm/flows-actors/human-decision.shared.schemas.d.ts.map +1 -1
  370. package/dist/esm/flows-actors/human-decision.shared.schemas.js.map +1 -1
  371. package/dist/esm/flows-actors/mcp-servers.shared.schemas.d.ts.map +1 -1
  372. package/dist/esm/flows-actors/mcp-servers.shared.schemas.js.map +1 -1
  373. package/dist/esm/flows-actors/model-call-attributions.shared.resources-config.schemas.d.ts.map +1 -1
  374. package/dist/esm/flows-actors/model-call-attributions.shared.resources-config.schemas.js.map +1 -1
  375. package/dist/esm/flows-actors/model-call-attributions.shared.schemas.d.ts.map +1 -1
  376. package/dist/esm/flows-actors/model-call-attributions.shared.schemas.js.map +1 -1
  377. package/dist/esm/flows-actors/model-cost-period-aggregates.shared.resources-config.schemas.d.ts.map +1 -1
  378. package/dist/esm/flows-actors/model-cost-period-aggregates.shared.resources-config.schemas.js.map +1 -1
  379. package/dist/esm/flows-actors/model-cost-period-aggregates.shared.schemas.d.ts.map +1 -1
  380. package/dist/esm/flows-actors/model-cost-period-aggregates.shared.schemas.js.map +1 -1
  381. package/dist/esm/flows-actors/model-cost-summary.shared.schemas.d.ts.map +1 -1
  382. package/dist/esm/flows-actors/model-cost-summary.shared.schemas.js.map +1 -1
  383. package/dist/esm/flows-actors/prompt-ir.shared.schemas.d.ts.map +1 -1
  384. package/dist/esm/flows-actors/prompt-ir.shared.schemas.js.map +1 -1
  385. package/dist/esm/flows-actors/provider-call-records.shared.resources-config.schemas.d.ts.map +1 -1
  386. package/dist/esm/flows-actors/provider-call-records.shared.resources-config.schemas.js.map +1 -1
  387. package/dist/esm/flows-actors/provider-call-records.shared.schemas.d.ts.map +1 -1
  388. package/dist/esm/flows-actors/provider-call-records.shared.schemas.js.map +1 -1
  389. package/dist/esm/flows-actors/review-deadlines.shared.schemas.d.ts.map +1 -1
  390. package/dist/esm/flows-actors/review-deadlines.shared.schemas.js.map +1 -1
  391. package/dist/esm/flows-actors/tasks.actors.shared.schemas.d.ts.map +1 -1
  392. package/dist/esm/flows-actors/tasks.actors.shared.schemas.js.map +1 -1
  393. package/dist/esm/flows-actors/work-attribution.shared.schemas.d.ts.map +1 -1
  394. package/dist/esm/flows-actors/work-attribution.shared.schemas.js.map +1 -1
  395. package/dist/esm/frontend-definitions/frontend-notification-custom-message-ref.definitions.d.ts.map +1 -1
  396. package/dist/esm/frontend-definitions/frontend-notification-custom-message-ref.definitions.js.map +1 -1
  397. package/dist/esm/frontend-definitions/settings-destination-ref.definitions.d.ts.map +1 -1
  398. package/dist/esm/frontend-definitions/settings-destination-ref.definitions.js.map +1 -1
  399. package/dist/esm/guidance/guidance-flow.shared.schemas.d.ts.map +1 -1
  400. package/dist/esm/guidance/guidance-flow.shared.schemas.js.map +1 -1
  401. package/dist/esm/guidance/guidance-state.shared.resources-config.schemas.d.ts.map +1 -1
  402. package/dist/esm/guidance/guidance-state.shared.resources-config.schemas.js.map +1 -1
  403. package/dist/esm/guidance/guidance-state.shared.schemas.d.ts.map +1 -1
  404. package/dist/esm/guidance/guidance-state.shared.schemas.js.map +1 -1
  405. package/dist/esm/guidance/guidance-state.shared.utils.d.ts.map +1 -1
  406. package/dist/esm/guidance/guidance-state.shared.utils.js.map +1 -1
  407. package/dist/esm/guidance/lifecycle-config.shared.schemas.d.ts.map +1 -1
  408. package/dist/esm/guidance/lifecycle-config.shared.schemas.js.map +1 -1
  409. package/dist/esm/guidance/lifecycle-state.shared.resources-config.schemas.d.ts.map +1 -1
  410. package/dist/esm/guidance/lifecycle-state.shared.resources-config.schemas.js.map +1 -1
  411. package/dist/esm/guidance/lifecycle-state.shared.schemas.d.ts.map +1 -1
  412. package/dist/esm/guidance/lifecycle-state.shared.schemas.js.map +1 -1
  413. package/dist/esm/guidance/milestone-builders.shared.d.ts.map +1 -1
  414. package/dist/esm/guidance/milestone-builders.shared.js.map +1 -1
  415. package/dist/esm/guidance/milestone-definition.shared.schemas.d.ts.map +1 -1
  416. package/dist/esm/guidance/milestone-definition.shared.schemas.js.map +1 -1
  417. package/dist/esm/guidance/progression-presentation.shared.schemas.d.ts.map +1 -1
  418. package/dist/esm/guidance/progression-presentation.shared.schemas.js.map +1 -1
  419. package/dist/esm/guidance/progression-state.shared.resources-config.schemas.d.ts.map +1 -1
  420. package/dist/esm/guidance/progression-state.shared.resources-config.schemas.js.map +1 -1
  421. package/dist/esm/guidance/progression-state.shared.schemas.d.ts.map +1 -1
  422. package/dist/esm/guidance/progression-state.shared.schemas.js.map +1 -1
  423. package/dist/esm/http-api-binding/http-api-binding-id.shared.utils.d.ts.map +1 -1
  424. package/dist/esm/http-api-binding/http-api-binding-id.shared.utils.js.map +1 -1
  425. package/dist/esm/http-api-binding/http-api-binding.shared.schemas.d.ts.map +1 -1
  426. package/dist/esm/http-api-binding/http-api-binding.shared.schemas.js.map +1 -1
  427. package/dist/esm/http-api-binding/http-api-erasure-stance.shared.d.ts.map +1 -1
  428. package/dist/esm/http-api-binding/http-api-erasure-stance.shared.js.map +1 -1
  429. package/dist/esm/http-api-binding/http-api-rest-write-operations.shared.schemas.d.ts.map +1 -1
  430. package/dist/esm/http-api-binding/http-api-rest-write-operations.shared.schemas.js.map +1 -1
  431. package/dist/esm/http-api-binding/http-api-transport-dialect.shared.d.ts.map +1 -1
  432. package/dist/esm/http-api-binding/http-api-transport-dialect.shared.js.map +1 -1
  433. package/dist/esm/http-api-binding/read-through-engine-anchors.shared.d.ts.map +1 -1
  434. package/dist/esm/http-api-binding/read-through-engine-anchors.shared.js.map +1 -1
  435. package/dist/esm/i18n/application-config-vocabulary.shared.d.ts.map +1 -1
  436. package/dist/esm/i18n/application-config-vocabulary.shared.js.map +1 -1
  437. package/dist/esm/i18n/engine-open-vocabulary-values.shared.d.ts.map +1 -1
  438. package/dist/esm/i18n/engine-open-vocabulary-values.shared.js.map +1 -1
  439. package/dist/esm/i18n/engine-open-vocabulary.shared.d.ts.map +1 -1
  440. package/dist/esm/i18n/engine-open-vocabulary.shared.js.map +1 -1
  441. package/dist/esm/i18n/interpolate-label-params.shared.utils.d.ts.map +1 -1
  442. package/dist/esm/i18n/interpolate-label-params.shared.utils.js.map +1 -1
  443. package/dist/esm/i18n/labelling.dto.shared.schemas.d.ts.map +1 -1
  444. package/dist/esm/i18n/labelling.dto.shared.schemas.js.map +1 -1
  445. package/dist/esm/inbound/conversation-threads.shared.resources-config.schemas.d.ts.map +1 -1
  446. package/dist/esm/inbound/conversation-threads.shared.resources-config.schemas.js.map +1 -1
  447. package/dist/esm/inbound/conversation-threads.shared.schemas.d.ts.map +1 -1
  448. package/dist/esm/inbound/conversation-threads.shared.schemas.js.map +1 -1
  449. package/dist/esm/inbound/inbound-channels.shared.schemas.d.ts.map +1 -1
  450. package/dist/esm/inbound/inbound-channels.shared.schemas.js.map +1 -1
  451. package/dist/esm/inbound/inbound-delivery.shared.resources-config.schemas.d.ts.map +1 -1
  452. package/dist/esm/inbound/inbound-delivery.shared.resources-config.schemas.js.map +1 -1
  453. package/dist/esm/inbound/inbound-delivery.shared.schemas.d.ts.map +1 -1
  454. package/dist/esm/inbound/inbound-delivery.shared.schemas.js.map +1 -1
  455. package/dist/esm/inbound/inbound-endpoint-env.shared.d.ts.map +1 -1
  456. package/dist/esm/inbound/inbound-endpoint-env.shared.js.map +1 -1
  457. package/dist/esm/index.d.ts.map +1 -1
  458. package/dist/esm/index.js.map +1 -1
  459. package/dist/esm/meta-workflows/actions.meta-workflows.shared.schemas.d.ts.map +1 -1
  460. package/dist/esm/meta-workflows/actions.meta-workflows.shared.schemas.js.map +1 -1
  461. package/dist/esm/meta-workflows/catalog.meta-workflows.shared.schemas.d.ts.map +1 -1
  462. package/dist/esm/meta-workflows/catalog.meta-workflows.shared.schemas.js.map +1 -1
  463. package/dist/esm/meta-workflows/coding-tasks.meta-workflows.shared.schemas.d.ts.map +1 -1
  464. package/dist/esm/meta-workflows/coding-tasks.meta-workflows.shared.schemas.js.map +1 -1
  465. package/dist/esm/meta-workflows/context-selection.meta-workflows.shared.schemas.d.ts.map +1 -1
  466. package/dist/esm/meta-workflows/context-selection.meta-workflows.shared.schemas.js.map +1 -1
  467. package/dist/esm/meta-workflows/decisions.meta-workflows.shared.schemas.d.ts.map +1 -1
  468. package/dist/esm/meta-workflows/decisions.meta-workflows.shared.schemas.js.map +1 -1
  469. package/dist/esm/meta-workflows/elicitation-depth.meta-workflows.shared.schemas.d.ts +128 -0
  470. package/dist/esm/meta-workflows/elicitation-depth.meta-workflows.shared.schemas.d.ts.map +1 -0
  471. package/dist/esm/meta-workflows/elicitation-depth.meta-workflows.shared.schemas.js +136 -0
  472. package/dist/esm/meta-workflows/elicitation-depth.meta-workflows.shared.schemas.js.map +1 -0
  473. package/dist/esm/meta-workflows/orchestration.meta-workflows.shared.schemas.d.ts +32 -0
  474. package/dist/esm/meta-workflows/orchestration.meta-workflows.shared.schemas.d.ts.map +1 -1
  475. package/dist/esm/meta-workflows/orchestration.meta-workflows.shared.schemas.js +66 -1
  476. package/dist/esm/meta-workflows/orchestration.meta-workflows.shared.schemas.js.map +1 -1
  477. package/dist/esm/meta-workflows/portable-primitives.meta-workflows.shared.schemas.d.ts.map +1 -1
  478. package/dist/esm/meta-workflows/portable-primitives.meta-workflows.shared.schemas.js.map +1 -1
  479. package/dist/esm/meta-workflows.exports.d.ts +1 -0
  480. package/dist/esm/meta-workflows.exports.d.ts.map +1 -1
  481. package/dist/esm/meta-workflows.exports.js +1 -0
  482. package/dist/esm/meta-workflows.exports.js.map +1 -1
  483. package/dist/esm/monitoring/monitoring.shared.schemas.d.ts.map +1 -1
  484. package/dist/esm/monitoring/monitoring.shared.schemas.js.map +1 -1
  485. package/dist/esm/notifications/email/email-context.shared.schemas.d.ts.map +1 -1
  486. package/dist/esm/notifications/email/email-context.shared.schemas.js.map +1 -1
  487. package/dist/esm/notifications/email/email-submission.shared.enums.d.ts.map +1 -1
  488. package/dist/esm/notifications/email/email-submission.shared.enums.js.map +1 -1
  489. package/dist/esm/notifications/email/email-template-registry.shared.schemas.d.ts.map +1 -1
  490. package/dist/esm/notifications/email/email-template-registry.shared.schemas.js.map +1 -1
  491. package/dist/esm/notifications/email/email-template.shared.enums.d.ts.map +1 -1
  492. package/dist/esm/notifications/email/email-template.shared.enums.js.map +1 -1
  493. package/dist/esm/notifications/inbound-email/inbound-email.shared.resources-config.schemas.d.ts.map +1 -1
  494. package/dist/esm/notifications/inbound-email/inbound-email.shared.resources-config.schemas.js.map +1 -1
  495. package/dist/esm/notifications/inbound-email/inbound-email.shared.schemas.d.ts.map +1 -1
  496. package/dist/esm/notifications/inbound-email/inbound-email.shared.schemas.js.map +1 -1
  497. package/dist/esm/notifications/m2m/m2m-webhook-delivery-contract.shared.d.ts.map +1 -1
  498. package/dist/esm/notifications/m2m/m2m-webhook-delivery-contract.shared.js.map +1 -1
  499. package/dist/esm/notifications/m2m/m2m-webhook-delivery-log.shared.resources-config.schemas.d.ts.map +1 -1
  500. package/dist/esm/notifications/m2m/m2m-webhook-delivery-log.shared.resources-config.schemas.js.map +1 -1
  501. package/dist/esm/notifications/m2m/m2m-webhook-delivery-log.shared.schemas.d.ts.map +1 -1
  502. package/dist/esm/notifications/m2m/m2m-webhook-delivery-log.shared.schemas.js.map +1 -1
  503. package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.d.ts.map +1 -1
  504. package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.js.map +1 -1
  505. package/dist/esm/notifications/m2m/webhook-config.shared.schemas.d.ts.map +1 -1
  506. package/dist/esm/notifications/m2m/webhook-config.shared.schemas.js.map +1 -1
  507. package/dist/esm/notifications/notification-badges.core.definitions.d.ts.map +1 -1
  508. package/dist/esm/notifications/notification-badges.core.definitions.js.map +1 -1
  509. package/dist/esm/notifications/notification-badges.schemas.d.ts.map +1 -1
  510. package/dist/esm/notifications/notification-badges.schemas.js.map +1 -1
  511. package/dist/esm/notifications/notification-badges.shared.resources-config.schemas.d.ts.map +1 -1
  512. package/dist/esm/notifications/notification-badges.shared.resources-config.schemas.js.map +1 -1
  513. package/dist/esm/notifications/notifications.shared.schemas.d.ts.map +1 -1
  514. package/dist/esm/notifications/notifications.shared.schemas.js.map +1 -1
  515. package/dist/esm/organizations/application-owner-organization.shared.schemas.d.ts.map +1 -1
  516. package/dist/esm/organizations/application-owner-organization.shared.schemas.js.map +1 -1
  517. package/dist/esm/organizations/organization-features.shared.resources-config.schemas.d.ts.map +1 -1
  518. package/dist/esm/organizations/organization-features.shared.resources-config.schemas.js.map +1 -1
  519. package/dist/esm/organizations/organization-features.shared.schemas.d.ts.map +1 -1
  520. package/dist/esm/organizations/organization-features.shared.schemas.js.map +1 -1
  521. package/dist/esm/organizations/organization-members.shared.resources-config.schemas.d.ts.map +1 -1
  522. package/dist/esm/organizations/organization-members.shared.resources-config.schemas.js.map +1 -1
  523. package/dist/esm/organizations/organization-members.shared.schemas.d.ts.map +1 -1
  524. package/dist/esm/organizations/organization-members.shared.schemas.js.map +1 -1
  525. package/dist/esm/organizations/organization-notifications.shared.resources-config.schemas.d.ts.map +1 -1
  526. package/dist/esm/organizations/organization-notifications.shared.resources-config.schemas.js.map +1 -1
  527. package/dist/esm/organizations/organization-notifications.shared.schemas.d.ts.map +1 -1
  528. package/dist/esm/organizations/organization-notifications.shared.schemas.js.map +1 -1
  529. package/dist/esm/organizations/organization-preferences.shared.resources-config.schemas.d.ts.map +1 -1
  530. package/dist/esm/organizations/organization-preferences.shared.resources-config.schemas.js.map +1 -1
  531. package/dist/esm/organizations/organization-preferences.shared.schemas.d.ts.map +1 -1
  532. package/dist/esm/organizations/organization-preferences.shared.schemas.js.map +1 -1
  533. package/dist/esm/organizations/organization-profile.shared.resources-config.schemas.d.ts.map +1 -1
  534. package/dist/esm/organizations/organization-profile.shared.resources-config.schemas.js.map +1 -1
  535. package/dist/esm/organizations/organization-profile.shared.schemas.d.ts.map +1 -1
  536. package/dist/esm/organizations/organization-profile.shared.schemas.js.map +1 -1
  537. package/dist/esm/organizations/organization-unit-inheritance.shared.d.ts.map +1 -1
  538. package/dist/esm/organizations/organization-unit-inheritance.shared.js.map +1 -1
  539. package/dist/esm/organizations/organization-unit-members.shared.resources-config.schemas.d.ts.map +1 -1
  540. package/dist/esm/organizations/organization-unit-members.shared.resources-config.schemas.js.map +1 -1
  541. package/dist/esm/organizations/organization-unit-members.shared.schemas.d.ts.map +1 -1
  542. package/dist/esm/organizations/organization-unit-members.shared.schemas.js.map +1 -1
  543. package/dist/esm/organizations/organization-unit-narrowing-decision.shared.d.ts.map +1 -1
  544. package/dist/esm/organizations/organization-unit-narrowing-decision.shared.js.map +1 -1
  545. package/dist/esm/organizations/organization-unit-narrowing.example.d.ts.map +1 -1
  546. package/dist/esm/organizations/organization-unit-narrowing.example.js.map +1 -1
  547. package/dist/esm/organizations/organization-unit-narrowing.shared.d.ts.map +1 -1
  548. package/dist/esm/organizations/organization-unit-narrowing.shared.js.map +1 -1
  549. package/dist/esm/organizations/organization-units.shared.path.d.ts.map +1 -1
  550. package/dist/esm/organizations/organization-units.shared.path.js.map +1 -1
  551. package/dist/esm/organizations/organization-units.shared.resources-config.schemas.d.ts.map +1 -1
  552. package/dist/esm/organizations/organization-units.shared.resources-config.schemas.js.map +1 -1
  553. package/dist/esm/organizations/organization-units.shared.schemas.d.ts.map +1 -1
  554. package/dist/esm/organizations/organization-units.shared.schemas.js.map +1 -1
  555. package/dist/esm/organizations/organizations.shared.resources-config.schemas.d.ts.map +1 -1
  556. package/dist/esm/organizations/organizations.shared.resources-config.schemas.js.map +1 -1
  557. package/dist/esm/organizations/organizations.shared.schemas.d.ts.map +1 -1
  558. package/dist/esm/organizations/organizations.shared.schemas.js.map +1 -1
  559. package/dist/esm/organizations/service-provider-activity-feed.shared.resources-config.schemas.d.ts.map +1 -1
  560. package/dist/esm/organizations/service-provider-activity-feed.shared.resources-config.schemas.js.map +1 -1
  561. package/dist/esm/organizations/service-provider-activity-feed.shared.schemas.d.ts.map +1 -1
  562. package/dist/esm/organizations/service-provider-activity-feed.shared.schemas.js.map +1 -1
  563. package/dist/esm/organizations/service-provider-capability-grants.shared.resources-config.schemas.d.ts.map +1 -1
  564. package/dist/esm/organizations/service-provider-capability-grants.shared.resources-config.schemas.js.map +1 -1
  565. package/dist/esm/organizations/service-provider-capability-grants.shared.schemas.d.ts.map +1 -1
  566. package/dist/esm/organizations/service-provider-capability-grants.shared.schemas.js.map +1 -1
  567. package/dist/esm/organizations/service-provider-client-controls.shared.schemas.d.ts.map +1 -1
  568. package/dist/esm/organizations/service-provider-client-controls.shared.schemas.js.map +1 -1
  569. package/dist/esm/organizations/service-provider-relationships.shared.resources-config.schemas.d.ts.map +1 -1
  570. package/dist/esm/organizations/service-provider-relationships.shared.resources-config.schemas.js.map +1 -1
  571. package/dist/esm/organizations/service-provider-relationships.shared.schemas.d.ts.map +1 -1
  572. package/dist/esm/organizations/service-provider-relationships.shared.schemas.js.map +1 -1
  573. package/dist/esm/organizations/tenant-teardown-config.shared.schemas.d.ts.map +1 -1
  574. package/dist/esm/organizations/tenant-teardown-config.shared.schemas.js.map +1 -1
  575. package/dist/esm/provider-registration-runtime.exports.d.ts.map +1 -1
  576. package/dist/esm/provider-registration-runtime.exports.js.map +1 -1
  577. package/dist/esm/public-runtime/index.d.ts.map +1 -1
  578. package/dist/esm/public-runtime/index.js.map +1 -1
  579. package/dist/esm/queue/jobs.shared.resources-config.schemas.d.ts.map +1 -1
  580. package/dist/esm/queue/jobs.shared.resources-config.schemas.js.map +1 -1
  581. package/dist/esm/queue/jobs.shared.schemas.d.ts +70 -1
  582. package/dist/esm/queue/jobs.shared.schemas.d.ts.map +1 -1
  583. package/dist/esm/queue/jobs.shared.schemas.js +85 -2
  584. package/dist/esm/queue/jobs.shared.schemas.js.map +1 -1
  585. package/dist/esm/queue/jobs.shared.utils.d.ts.map +1 -1
  586. package/dist/esm/queue/jobs.shared.utils.js.map +1 -1
  587. package/dist/esm/queue/queues.shared.schemas.d.ts.map +1 -1
  588. package/dist/esm/queue/queues.shared.schemas.js.map +1 -1
  589. package/dist/esm/queue/queues.shared.utils.d.ts.map +1 -1
  590. package/dist/esm/queue/queues.shared.utils.js.map +1 -1
  591. package/dist/esm/queue/rabbitmq-queue-args.shared.d.ts.map +1 -1
  592. package/dist/esm/queue/rabbitmq-queue-args.shared.js.map +1 -1
  593. package/dist/esm/rag/rag-retrieval-health.shared.d.ts.map +1 -1
  594. package/dist/esm/rag/rag-retrieval-health.shared.js.map +1 -1
  595. package/dist/esm/requests/header-keys.shared.d.ts.map +1 -1
  596. package/dist/esm/requests/header-keys.shared.js.map +1 -1
  597. package/dist/esm/requests/http-requests.shared.d.ts.map +1 -1
  598. package/dist/esm/requests/http-requests.shared.js.map +1 -1
  599. package/dist/esm/requests/idempotency-key.shared.d.ts.map +1 -1
  600. package/dist/esm/requests/idempotency-key.shared.js.map +1 -1
  601. package/dist/esm/requests/manual-controllers-routes-documentation.d.ts.map +1 -1
  602. package/dist/esm/requests/manual-controllers-routes-documentation.js.map +1 -1
  603. package/dist/esm/requests/manual-controllers-routes-urls.d.ts.map +1 -1
  604. package/dist/esm/requests/manual-controllers-routes-urls.js.map +1 -1
  605. package/dist/esm/requests/rate-limits.shared.schemas.d.ts.map +1 -1
  606. package/dist/esm/requests/rate-limits.shared.schemas.js.map +1 -1
  607. package/dist/esm/requests/websocket.shared.schemas.d.ts.map +1 -1
  608. package/dist/esm/requests/websocket.shared.schemas.js.map +1 -1
  609. package/dist/esm/resources/child-operations.shared.schemas.d.ts.map +1 -1
  610. package/dist/esm/resources/child-operations.shared.schemas.js.map +1 -1
  611. package/dist/esm/resources/collection-query-parameters.shared.d.ts.map +1 -1
  612. package/dist/esm/resources/collection-query-parameters.shared.js.map +1 -1
  613. package/dist/esm/resources/context-policy.shared.schemas.d.ts.map +1 -1
  614. package/dist/esm/resources/context-policy.shared.schemas.js.map +1 -1
  615. package/dist/esm/resources/embedded-resource-mark.shared.utils.d.ts.map +1 -1
  616. package/dist/esm/resources/embedded-resource-mark.shared.utils.js.map +1 -1
  617. package/dist/esm/resources/relationship-display.shared.schemas.d.ts.map +1 -1
  618. package/dist/esm/resources/relationship-display.shared.schemas.js.map +1 -1
  619. package/dist/esm/resources/resources-config.shared.factory.d.ts.map +1 -1
  620. package/dist/esm/resources/resources-config.shared.factory.js.map +1 -1
  621. package/dist/esm/resources/resources-config.shared.schemas.d.ts.map +1 -1
  622. package/dist/esm/resources/resources-config.shared.schemas.js.map +1 -1
  623. package/dist/esm/resources/resources-registry.shared.core.definitions.d.ts.map +1 -1
  624. package/dist/esm/resources/resources-registry.shared.core.definitions.js.map +1 -1
  625. package/dist/esm/resources/resources-relationships.shared.factory.d.ts.map +1 -1
  626. package/dist/esm/resources/resources-relationships.shared.factory.js.map +1 -1
  627. package/dist/esm/resources/resources-serialization.shared.schemas.d.ts.map +1 -1
  628. package/dist/esm/resources/resources-serialization.shared.schemas.js.map +1 -1
  629. package/dist/esm/resources/resources.shared.core.definitions.d.ts.map +1 -1
  630. package/dist/esm/resources/resources.shared.core.definitions.js.map +1 -1
  631. package/dist/esm/resources/resources.shared.schemas.d.ts.map +1 -1
  632. package/dist/esm/resources/resources.shared.schemas.js.map +1 -1
  633. package/dist/esm/resources/resources.shared.utils.d.ts.map +1 -1
  634. package/dist/esm/resources/resources.shared.utils.js.map +1 -1
  635. package/dist/esm/resources/utils/collection-export.shared.utils.d.ts.map +1 -1
  636. package/dist/esm/resources/utils/collection-export.shared.utils.js.map +1 -1
  637. package/dist/esm/resources/utils/composition-cascade-deletability.validation.d.ts.map +1 -1
  638. package/dist/esm/resources/utils/composition-cascade-deletability.validation.js.map +1 -1
  639. package/dist/esm/resources/utils/composition-seedability.validation.d.ts.map +1 -1
  640. package/dist/esm/resources/utils/composition-seedability.validation.js.map +1 -1
  641. package/dist/esm/resources/utils/context-addressed-composition-singleton.shared.utils.d.ts.map +1 -1
  642. package/dist/esm/resources/utils/context-addressed-composition-singleton.shared.utils.js.map +1 -1
  643. package/dist/esm/resources/utils/dependent-lifecycle-classification.validation.d.ts.map +1 -1
  644. package/dist/esm/resources/utils/dependent-lifecycle-classification.validation.js.map +1 -1
  645. package/dist/esm/resources/utils/duplicate-relationship-registration.validation.d.ts.map +1 -1
  646. package/dist/esm/resources/utils/duplicate-relationship-registration.validation.js.map +1 -1
  647. package/dist/esm/resources/utils/field-value-disclosure.utils.d.ts.map +1 -1
  648. package/dist/esm/resources/utils/field-value-disclosure.utils.js.map +1 -1
  649. package/dist/esm/resources/utils/http-api-write-declaration.shared.utils.d.ts.map +1 -1
  650. package/dist/esm/resources/utils/http-api-write-declaration.shared.utils.js.map +1 -1
  651. package/dist/esm/resources/utils/initiator-stamped-field-satisfiability.validation.d.ts.map +1 -1
  652. package/dist/esm/resources/utils/initiator-stamped-field-satisfiability.validation.js.map +1 -1
  653. package/dist/esm/resources/utils/no-subject-data-stance-coherence.shared.utils.d.ts.map +1 -1
  654. package/dist/esm/resources/utils/no-subject-data-stance-coherence.shared.utils.js.map +1 -1
  655. package/dist/esm/resources/utils/persistence-adapter-discrimination.shared.utils.d.ts.map +1 -1
  656. package/dist/esm/resources/utils/persistence-adapter-discrimination.shared.utils.js.map +1 -1
  657. package/dist/esm/resources/utils/populated-file-fields.shared.utils.d.ts.map +1 -1
  658. package/dist/esm/resources/utils/populated-file-fields.shared.utils.js.map +1 -1
  659. package/dist/esm/resources/utils/repository-dto-builder.utils.d.ts.map +1 -1
  660. package/dist/esm/resources/utils/repository-dto-builder.utils.js.map +1 -1
  661. package/dist/esm/resources/utils/request-schema-field-carriage.shared.utils.d.ts.map +1 -1
  662. package/dist/esm/resources/utils/request-schema-field-carriage.shared.utils.js.map +1 -1
  663. package/dist/esm/resources/utils/required-fk-fillability.validation.d.ts.map +1 -1
  664. package/dist/esm/resources/utils/required-fk-fillability.validation.js.map +1 -1
  665. package/dist/esm/resources/utils/resource-operation-type-guards.utils.d.ts.map +1 -1
  666. package/dist/esm/resources/utils/resource-operation-type-guards.utils.js.map +1 -1
  667. package/dist/esm/resources/utils/resource-polymorphism.factory.d.ts.map +1 -1
  668. package/dist/esm/resources/utils/resource-polymorphism.factory.js.map +1 -1
  669. package/dist/esm/resources/utils/resource-polymorphism.relationships.d.ts.map +1 -1
  670. package/dist/esm/resources/utils/resource-polymorphism.relationships.js.map +1 -1
  671. package/dist/esm/resources/utils/resource-polymorphism.schemas.d.ts.map +1 -1
  672. package/dist/esm/resources/utils/resource-polymorphism.schemas.js.map +1 -1
  673. package/dist/esm/resources/utils/resource-polymorphism.utils.d.ts.map +1 -1
  674. package/dist/esm/resources/utils/resource-polymorphism.utils.js.map +1 -1
  675. package/dist/esm/resources/utils/resource-subtree.utils.d.ts.map +1 -1
  676. package/dist/esm/resources/utils/resource-subtree.utils.js.map +1 -1
  677. package/dist/esm/resources/utils/resources-config-context-needs.utils.d.ts.map +1 -1
  678. package/dist/esm/resources/utils/resources-config-context-needs.utils.js.map +1 -1
  679. package/dist/esm/resources/utils/resources-config-naming.utils.d.ts.map +1 -1
  680. package/dist/esm/resources/utils/resources-config-naming.utils.js.map +1 -1
  681. package/dist/esm/resources/utils/resources-config-operations.dtos-builder.utils.d.ts +25 -0
  682. package/dist/esm/resources/utils/resources-config-operations.dtos-builder.utils.d.ts.map +1 -1
  683. package/dist/esm/resources/utils/resources-config-operations.dtos-builder.utils.js +47 -19
  684. package/dist/esm/resources/utils/resources-config-operations.dtos-builder.utils.js.map +1 -1
  685. package/dist/esm/resources/utils/resources-config-operations.path.utils.d.ts.map +1 -1
  686. package/dist/esm/resources/utils/resources-config-operations.path.utils.js.map +1 -1
  687. package/dist/esm/resources/utils/resources-config-operations.urls-builder.utils.d.ts.map +1 -1
  688. package/dist/esm/resources/utils/resources-config-operations.urls-builder.utils.js.map +1 -1
  689. package/dist/esm/resources/utils/resources-config-operations.utils.d.ts.map +1 -1
  690. package/dist/esm/resources/utils/resources-config-operations.utils.js.map +1 -1
  691. package/dist/esm/resources/utils/resources-serialization.utils.d.ts.map +1 -1
  692. package/dist/esm/resources/utils/resources-serialization.utils.js.map +1 -1
  693. package/dist/esm/resources/utils/resources-summary.utils.d.ts.map +1 -1
  694. package/dist/esm/resources/utils/resources-summary.utils.js.map +1 -1
  695. package/dist/esm/resources/utils/schema-family-builder.utils.d.ts.map +1 -1
  696. package/dist/esm/resources/utils/schema-family-builder.utils.js.map +1 -1
  697. package/dist/esm/resources/utils/schema-type-inference.utils.d.ts.map +1 -1
  698. package/dist/esm/resources/utils/schema-type-inference.utils.js.map +1 -1
  699. package/dist/esm/resources/utils/schema-type-utils.d.ts.map +1 -1
  700. package/dist/esm/resources/utils/schema-type-utils.js.map +1 -1
  701. package/dist/esm/resources/utils/schema-variant-resolver.utils.d.ts.map +1 -1
  702. package/dist/esm/resources/utils/schema-variant-resolver.utils.js.map +1 -1
  703. package/dist/esm/resources/utils/shared-persistence-collection.utils.d.ts.map +1 -1
  704. package/dist/esm/resources/utils/shared-persistence-collection.utils.js.map +1 -1
  705. package/dist/esm/resources/utils/templatable-file-fields.shared.utils.d.ts.map +1 -1
  706. package/dist/esm/resources/utils/templatable-file-fields.shared.utils.js.map +1 -1
  707. package/dist/esm/resources/work-unit.shared.schemas.d.ts.map +1 -1
  708. package/dist/esm/resources/work-unit.shared.schemas.js.map +1 -1
  709. package/dist/esm/runtime/domain-module.shared.definitions.d.ts.map +1 -1
  710. package/dist/esm/runtime/domain-module.shared.definitions.js.map +1 -1
  711. package/dist/esm/runtime/execution-context.shared.schemas.d.ts.map +1 -1
  712. package/dist/esm/runtime/execution-context.shared.schemas.js.map +1 -1
  713. package/dist/esm/runtime/runtime.shared.schemas.d.ts.map +1 -1
  714. package/dist/esm/runtime/runtime.shared.schemas.js.map +1 -1
  715. package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.d.ts.map +1 -1
  716. package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.js.map +1 -1
  717. package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.d.ts.map +1 -1
  718. package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.js.map +1 -1
  719. package/dist/esm/security/api-keys/api-keys.shared.schemas.d.ts.map +1 -1
  720. package/dist/esm/security/api-keys/api-keys.shared.schemas.js.map +1 -1
  721. package/dist/esm/security/authentications/anonymous-session/anonymous-session.shared.contract.d.ts.map +1 -1
  722. package/dist/esm/security/authentications/anonymous-session/anonymous-session.shared.contract.js.map +1 -1
  723. package/dist/esm/security/authentications/authentication.shared.dto.schemas.d.ts.map +1 -1
  724. package/dist/esm/security/authentications/authentication.shared.dto.schemas.js.map +1 -1
  725. package/dist/esm/security/authentications/authentication.shared.schemas.d.ts.map +1 -1
  726. package/dist/esm/security/authentications/authentication.shared.schemas.js.map +1 -1
  727. package/dist/esm/security/authentications/authentication.shared.utils.d.ts.map +1 -1
  728. package/dist/esm/security/authentications/authentication.shared.utils.js.map +1 -1
  729. package/dist/esm/security/authentications/consumable-token.shared.schemas.d.ts.map +1 -1
  730. package/dist/esm/security/authentications/consumable-token.shared.schemas.js.map +1 -1
  731. package/dist/esm/security/authentications/cross-frontend-handoff.shared.dto.schemas.d.ts.map +1 -1
  732. package/dist/esm/security/authentications/cross-frontend-handoff.shared.dto.schemas.js.map +1 -1
  733. package/dist/esm/security/authentications/mfa-backup-code-contract.shared.d.ts.map +1 -1
  734. package/dist/esm/security/authentications/mfa-backup-code-contract.shared.js.map +1 -1
  735. package/dist/esm/security/authentications/password-blocklist.shared.utils.d.ts.map +1 -1
  736. package/dist/esm/security/authentications/password-blocklist.shared.utils.js.map +1 -1
  737. package/dist/esm/security/authentications/password-reset.shared.dto.schemas.d.ts.map +1 -1
  738. package/dist/esm/security/authentications/password-reset.shared.dto.schemas.js.map +1 -1
  739. package/dist/esm/security/authentications/registration.shared.dto.schemas.d.ts.map +1 -1
  740. package/dist/esm/security/authentications/registration.shared.dto.schemas.js.map +1 -1
  741. package/dist/esm/security/authentications/same-origin-redirect-path.shared.d.ts.map +1 -1
  742. package/dist/esm/security/authentications/same-origin-redirect-path.shared.js.map +1 -1
  743. package/dist/esm/security/authentications/scim/scim-organization-unit-mapping.shared.d.ts.map +1 -1
  744. package/dist/esm/security/authentications/scim/scim-organization-unit-mapping.shared.js.map +1 -1
  745. package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.resources-config.schemas.d.ts.map +1 -1
  746. package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.resources-config.schemas.js.map +1 -1
  747. package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.d.ts.map +1 -1
  748. package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.js.map +1 -1
  749. package/dist/esm/security/authentications/scim/scim-tokens.shared.resources-config.schemas.d.ts.map +1 -1
  750. package/dist/esm/security/authentications/scim/scim-tokens.shared.resources-config.schemas.js.map +1 -1
  751. package/dist/esm/security/authentications/scim/scim-tokens.shared.schemas.d.ts.map +1 -1
  752. package/dist/esm/security/authentications/scim/scim-tokens.shared.schemas.js.map +1 -1
  753. package/dist/esm/security/authentications/service-provider-client-authentication.shared.schemas.d.ts.map +1 -1
  754. package/dist/esm/security/authentications/service-provider-client-authentication.shared.schemas.js.map +1 -1
  755. package/dist/esm/security/authentications/siem/siem-delivery-dlq.shared.resources-config.schemas.d.ts.map +1 -1
  756. package/dist/esm/security/authentications/siem/siem-delivery-dlq.shared.resources-config.schemas.js.map +1 -1
  757. package/dist/esm/security/authentications/siem/siem-delivery-dlq.shared.schemas.d.ts.map +1 -1
  758. package/dist/esm/security/authentications/siem/siem-delivery-dlq.shared.schemas.js.map +1 -1
  759. package/dist/esm/security/authentications/siem/siem-delivery-outbox.shared.resources-config.schemas.d.ts.map +1 -1
  760. package/dist/esm/security/authentications/siem/siem-delivery-outbox.shared.resources-config.schemas.js.map +1 -1
  761. package/dist/esm/security/authentications/siem/siem-delivery-outbox.shared.schemas.d.ts.map +1 -1
  762. package/dist/esm/security/authentications/siem/siem-delivery-outbox.shared.schemas.js.map +1 -1
  763. package/dist/esm/security/authentications/siem/siem-delivery-reliability-contract.shared.d.ts.map +1 -1
  764. package/dist/esm/security/authentications/siem/siem-delivery-reliability-contract.shared.js.map +1 -1
  765. package/dist/esm/security/authentications/siem/siem-export-config.shared.resources-config.schemas.d.ts.map +1 -1
  766. package/dist/esm/security/authentications/siem/siem-export-config.shared.resources-config.schemas.js.map +1 -1
  767. package/dist/esm/security/authentications/siem/siem-export-config.shared.schemas.d.ts.map +1 -1
  768. package/dist/esm/security/authentications/siem/siem-export-config.shared.schemas.js.map +1 -1
  769. package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.d.ts.map +1 -1
  770. package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.js.map +1 -1
  771. package/dist/esm/security/authentications/sso/sso-config.shared.schemas.d.ts.map +1 -1
  772. package/dist/esm/security/authentications/sso/sso-config.shared.schemas.js.map +1 -1
  773. package/dist/esm/security/authentications/sso/sso-connection.shared.resources-config.schemas.d.ts.map +1 -1
  774. package/dist/esm/security/authentications/sso/sso-connection.shared.resources-config.schemas.js.map +1 -1
  775. package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.d.ts.map +1 -1
  776. package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.js.map +1 -1
  777. package/dist/esm/security/authorizations/administrative-continuity.shared.schemas.d.ts.map +1 -1
  778. package/dist/esm/security/authorizations/administrative-continuity.shared.schemas.js.map +1 -1
  779. package/dist/esm/security/authorizations/application-access-grants.shared.resources-config.schemas.d.ts.map +1 -1
  780. package/dist/esm/security/authorizations/application-access-grants.shared.resources-config.schemas.js.map +1 -1
  781. package/dist/esm/security/authorizations/application-access-grants.shared.schemas.d.ts.map +1 -1
  782. package/dist/esm/security/authorizations/application-access-grants.shared.schemas.js.map +1 -1
  783. package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.d.ts.map +1 -1
  784. package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.js.map +1 -1
  785. package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.d.ts.map +1 -1
  786. package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.js.map +1 -1
  787. package/dist/esm/security/authorizations/roles.shared.defaults.d.ts.map +1 -1
  788. package/dist/esm/security/authorizations/roles.shared.defaults.js.map +1 -1
  789. package/dist/esm/security/authorizations/roles.shared.schemas.d.ts.map +1 -1
  790. package/dist/esm/security/authorizations/roles.shared.schemas.js.map +1 -1
  791. package/dist/esm/security/authorizations/roles.shared.utils.d.ts.map +1 -1
  792. package/dist/esm/security/authorizations/roles.shared.utils.js.map +1 -1
  793. package/dist/esm/security/connected-accounts/provider-connection-listing.shared.schemas.d.ts.map +1 -1
  794. package/dist/esm/security/connected-accounts/provider-connection-listing.shared.schemas.js.map +1 -1
  795. package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.d.ts.map +1 -1
  796. package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.js.map +1 -1
  797. package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.d.ts.map +1 -1
  798. package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.js.map +1 -1
  799. package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.d.ts.map +1 -1
  800. package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.js.map +1 -1
  801. package/dist/esm/security/credential-rotation-grace.shared.utils.d.ts.map +1 -1
  802. package/dist/esm/security/credential-rotation-grace.shared.utils.js.map +1 -1
  803. package/dist/esm/security/crypto-keys/crypto-keys.shared.schemas.d.ts.map +1 -1
  804. package/dist/esm/security/crypto-keys/crypto-keys.shared.schemas.js.map +1 -1
  805. package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.d.ts.map +1 -1
  806. package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.js.map +1 -1
  807. package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.d.ts.map +1 -1
  808. package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.js.map +1 -1
  809. package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.d.ts.map +1 -1
  810. package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.js.map +1 -1
  811. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.resources-config.schemas.d.ts.map +1 -1
  812. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.resources-config.schemas.js.map +1 -1
  813. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.d.ts.map +1 -1
  814. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.js.map +1 -1
  815. package/dist/esm/security/oauth-clients/oauth-resource-server.shared.schemas.d.ts.map +1 -1
  816. package/dist/esm/security/oauth-clients/oauth-resource-server.shared.schemas.js.map +1 -1
  817. package/dist/esm/security/outbound-target-control.shared.schemas.d.ts.map +1 -1
  818. package/dist/esm/security/outbound-target-control.shared.schemas.js.map +1 -1
  819. package/dist/esm/security/submission-challenge/submission-challenge.shared.d.ts.map +1 -1
  820. package/dist/esm/security/submission-challenge/submission-challenge.shared.js.map +1 -1
  821. package/dist/esm/systems-of-record/system-of-record-actions.shared.schemas.d.ts.map +1 -1
  822. package/dist/esm/systems-of-record/system-of-record-actions.shared.schemas.js.map +1 -1
  823. package/dist/esm/systems-of-record/system-of-record-credential-kind.shared.d.ts.map +1 -1
  824. package/dist/esm/systems-of-record/system-of-record-credential-kind.shared.js.map +1 -1
  825. package/dist/esm/systems-of-record/system-of-record-declaration.shared.schemas.d.ts.map +1 -1
  826. package/dist/esm/systems-of-record/system-of-record-declaration.shared.schemas.js.map +1 -1
  827. package/dist/esm/systems-of-record/system-of-record-env.shared.d.ts.map +1 -1
  828. package/dist/esm/systems-of-record/system-of-record-env.shared.js.map +1 -1
  829. package/dist/esm/systems-of-record/system-of-record-error-codes.shared.d.ts.map +1 -1
  830. package/dist/esm/systems-of-record/system-of-record-error-codes.shared.js.map +1 -1
  831. package/dist/esm/systems-of-record/system-of-record-facet.shared.schemas.d.ts.map +1 -1
  832. package/dist/esm/systems-of-record/system-of-record-facet.shared.schemas.js.map +1 -1
  833. package/dist/esm/systems-of-record/system-of-record-partition-assignments.shared.resources-config.schemas.d.ts.map +1 -1
  834. package/dist/esm/systems-of-record/system-of-record-partition-assignments.shared.resources-config.schemas.js.map +1 -1
  835. package/dist/esm/systems-of-record/system-of-record-partition-assignments.shared.schemas.d.ts.map +1 -1
  836. package/dist/esm/systems-of-record/system-of-record-partition-assignments.shared.schemas.js.map +1 -1
  837. package/dist/esm/testing/resource-config-builders.d.ts.map +1 -1
  838. package/dist/esm/testing/resource-config-builders.js.map +1 -1
  839. package/dist/esm/testing.d.ts.map +1 -1
  840. package/dist/esm/testing.js.map +1 -1
  841. package/dist/esm/users/anonymous-user-marketing-metadata.shared.schemas.d.ts.map +1 -1
  842. package/dist/esm/users/anonymous-user-marketing-metadata.shared.schemas.js.map +1 -1
  843. package/dist/esm/users/anonymous-users.shared.resources-config.schemas.d.ts.map +1 -1
  844. package/dist/esm/users/anonymous-users.shared.resources-config.schemas.js.map +1 -1
  845. package/dist/esm/users/anonymous-users.shared.schema.d.ts.map +1 -1
  846. package/dist/esm/users/anonymous-users.shared.schema.js.map +1 -1
  847. package/dist/esm/users/inbound-contacts.shared.resources-config.schemas.d.ts.map +1 -1
  848. package/dist/esm/users/inbound-contacts.shared.resources-config.schemas.js.map +1 -1
  849. package/dist/esm/users/inbound-contacts.shared.schemas.d.ts.map +1 -1
  850. package/dist/esm/users/inbound-contacts.shared.schemas.js.map +1 -1
  851. package/dist/esm/users/user-consent-decision.shared.utils.d.ts.map +1 -1
  852. package/dist/esm/users/user-consent-decision.shared.utils.js.map +1 -1
  853. package/dist/esm/users/user-credentials.shared.resources-config.schemas.d.ts.map +1 -1
  854. package/dist/esm/users/user-credentials.shared.resources-config.schemas.js.map +1 -1
  855. package/dist/esm/users/user-credentials.shared.schemas.d.ts.map +1 -1
  856. package/dist/esm/users/user-credentials.shared.schemas.js.map +1 -1
  857. package/dist/esm/users/user-identity-links.shared.resources-config.schemas.d.ts.map +1 -1
  858. package/dist/esm/users/user-identity-links.shared.resources-config.schemas.js.map +1 -1
  859. package/dist/esm/users/user-identity-links.shared.schemas.d.ts.map +1 -1
  860. package/dist/esm/users/user-identity-links.shared.schemas.js.map +1 -1
  861. package/dist/esm/users/user-preferences-reset.shared.utils.d.ts.map +1 -1
  862. package/dist/esm/users/user-preferences-reset.shared.utils.js.map +1 -1
  863. package/dist/esm/users/user-preferences.shared.resources-config.schemas.d.ts.map +1 -1
  864. package/dist/esm/users/user-preferences.shared.resources-config.schemas.js.map +1 -1
  865. package/dist/esm/users/user-profiles.shared.resources-config.schemas.d.ts.map +1 -1
  866. package/dist/esm/users/user-profiles.shared.resources-config.schemas.js.map +1 -1
  867. package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.d.ts.map +1 -1
  868. package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.js.map +1 -1
  869. package/dist/esm/users/user-self-profiles.shared.resources-config.schemas.d.ts.map +1 -1
  870. package/dist/esm/users/user-self-profiles.shared.resources-config.schemas.js.map +1 -1
  871. package/dist/esm/users/user-self.shared.resources-config.schemas.d.ts.map +1 -1
  872. package/dist/esm/users/user-self.shared.resources-config.schemas.js.map +1 -1
  873. package/dist/esm/users/users.shared.resources-config.schemas.d.ts.map +1 -1
  874. package/dist/esm/users/users.shared.resources-config.schemas.js.map +1 -1
  875. package/dist/esm/users/users.shared.schemas.d.ts.map +1 -1
  876. package/dist/esm/users/users.shared.schemas.js.map +1 -1
  877. package/package.json +4 -4
  878. package/dist/esm/__tests__/setup.d.ts +0 -2
  879. package/dist/esm/__tests__/setup.d.ts.map +0 -1
  880. package/dist/esm/__tests__/setup.js +0 -19
  881. package/dist/esm/__tests__/setup.js.map +0 -1
  882. package/dist/tsconfig.build.tsbuildinfo +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"billing-configuration.shared.schemas.js","sourceRoot":"","sources":["../../../src/billing/billing-configuration.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,aAAa,GACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAE9F,MAAM,CAAC,MAAM,0BAA0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;QAC9C;;;;;WAKG;QACH,sBAAsB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QACpD,uDAAuD;QACvD,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/C,uFAAuF;QACvF,gBAAgB,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,iBAAiB,CAAC;QACxF;;;;;;;;WAQG;QACH,mBAAmB,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC;KAChF,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAChB,gBAAgB,EAAE,CAAC;QACnB,sBAAsB,EAAE,CAAC;QACzB,iBAAiB,EAAE,CAAC;QACpB,gBAAgB,EAAE,iBAAiB,CAAC,iBAAiB;QACrD,mBAAmB,EAAE,aAAa,CAAC,aAAa;KACjD,CAAC,CAAC;CACJ,CAAC,CAAC","sourcesContent":["/**\n * Billing Configuration Schema (Shared)\n *\n * Top-level billing configuration that custom apps provide at startup.\n * Controls: provider selection, currency, tax policy, enabled scopes,\n * and default behavior policies.\n *\n * @see billing-and-features-system.md §6.7 (Billing Configuration)\n */\n\nimport { z } from 'zod';\nimport { CurrencySchema } from '@wildo-ai/zod-decorators';\nimport { ResourcePrimaryScope } from '../resources/resources.shared.schemas';\nimport {\n TaxCalculationMode,\n TaxDisplayMode,\n ProrationBehavior,\n BillingTiming,\n} from './billing-enums.shared.schemas';\nimport { ReferredRewardSchema, ReferrerRewardSchema } from './referral-reward.shared.schemas';\n\nexport const BillingConfigurationSchema = z.object({\n /** Master switch: is billing enabled for this app? */\n enabled: z.boolean().default(false),\n /** Which billing provider to use (e.g., 'stripe') */\n providerRef: z.string().optional(),\n\n /*\n * NO `webhooks` block. `path` and `signingSecretRef` were declared here and read by NOTHING —\n * `signingSecretRef` had zero references outside its own declaration — and they were removed on\n * 2026-09-08 (#408) rather than relabelled, because unlike the commercial-intent keys below they\n * were not even an input to anything.\n *\n * The route and the signing secret both come from the provider module's `WEBHOOK_ORIGINATOR`\n * contract: `buildWebhookEndpoints` mounts it at `/api/v1/webhooks/<provider>/billing`. That is\n * the single authority, and `webhook-auto-controller.backend.service.ts` already recorded the\n * same conclusion when endpoint-level path/secret extras were dropped as dead in the 2026-05-06\n * reshape. This block was the copy that survived that sweep.\n */\n\n /**\n * DECLARATION-ONLY (#408, 2026-09-08). Read by the application-creation commercial-model brief and\n * by no runtime billing path: nothing validates a product's currency against these, and what\n * reaches the provider is each price's own `currency`. Authoring them records the commercial\n * intent a reviewer reads; it enforces nothing.\n */\n defaultCurrency: CurrencySchema.default('USD'),\n /** DECLARATION-ONLY — see `defaultCurrency`. */\n supportedCurrencies: z.array(CurrencySchema).default(['USD']),\n\n /**\n * Tax configuration — calculation is ALWAYS delegated to provider (Stripe Tax, etc.).\n * We never calculate tax locally.\n */\n tax: z.object({\n /**\n * Whether the PROVIDER computes tax on a purchase. READ since 2026-09-08 (#408): the checkout\n * path — the only production purchase route — sends `automaticTax` from this value.\n *\n * It reached nothing before that, so `PROVIDER_MANAGED` changed no behaviour and the provider\n * account's own configuration silently decided. Enabling it changes invoice totals and the tax\n * amounts persisted against them, which is why it is a decision an application makes rather\n * than a default the framework picks.\n */\n calculationMode: z.enum(TaxCalculationMode).default(TaxCalculationMode.DISABLED),\n\n /**\n * How prices are DISPLAYED to users (does not affect provider calculation).\n * - 'exclusive': Prices shown excluding tax (HT / ex-VAT). Tax added at checkout.\n * Common for B2B. Shows \"$49/mo\" and tax is added separately.\n * - 'inclusive': Prices shown including tax (TTC / inc-VAT). Tax is embedded.\n * Common for consumer-facing. Shows \"€49/mo TTC\" and tax is extracted at checkout.\n *\n * DECLARATIVE ONLY: nothing reads this value. It is not an application-wide default that\n * `product.taxDisplayMode` and `price.taxBehavior` override, because there is no resolution\n * chain between the three. What reaches the billing provider is each price's own\n * `taxBehavior`, and only that.\n */\n defaultDisplayMode: z.enum(TaxDisplayMode).default(TaxDisplayMode.EXCLUSIVE),\n }).default(() => ({\n calculationMode: TaxCalculationMode.DISABLED,\n defaultDisplayMode: TaxDisplayMode.EXCLUSIVE,\n })),\n\n /**\n * Which scopes can have billing accounts (default: ORGANIZATIONS only).\n * Can be extended to include USER_SELF (personal billing).\n */\n enabledScopes: z.array(z.enum(ResourcePrimaryScope)).default([ResourcePrimaryScope.ORGANIZATIONS]),\n\n /**\n * Promotions configuration.\n * Controls whether the promotions subsystem is active.\n */\n promotions: z.object({\n /**\n * DECLARATION-ONLY (#408, 2026-09-08), and the sharpest of them: the promotions subsystem runs\n * UNCONDITIONALLY. Promotion codes are applied at `billing-account.mutations` and resolved in\n * `billing-state`, neither of which consults this flag — so setting it `false` disables\n * nothing, which is a stronger statement than \"is not read\".\n */\n enabled: z.boolean().default(true),\n }).default(() => ({\n enabled: true,\n })),\n\n /**\n * Credit pool configuration.\n * Controls whether credit pools are enabled and defines default pool behavior.\n */\n creditPools: z.object({\n /**\n * DECLARATION-ONLY (#408, 2026-09-08) — same shape as `promotions.enabled` above, and the same\n * correction: credit pools run unconditionally in `billing-state`, so `false` disables nothing.\n */\n enabled: z.boolean().default(true),\n /** Default initial balance for auto-created pools (default 0) */\n defaultInitialBalance: z.number().min(0).default(0),\n }).default(() => ({\n enabled: true,\n defaultInitialBalance: 0,\n })),\n\n /** @wildo_source:part:start saas.models.billing.referral-program facet:layer:shared facet:audience:app-developer */\n /**\n * The referral program (#1802): whether organizations may issue referral codes, and what each side\n * receives when a referral converts (the referred account's first paid invoice).\n *\n * The rewards are copied onto each referral when its code is issued, so changing them here affects\n * codes issued afterwards and never re-prices a referral already made. A reward's `featureKey` must\n * name a registered boolean feature; startup WARNS about one that does not, like every other feature\n * reference, and a feature nobody registered grants nothing.\n */\n referrals: z.object({\n /** Off by default: issuing codes that promise rewards is a commercial decision the application makes. */\n enabled: z.boolean().default(false).describe('Whether organizations may issue referral codes. Redeeming and converting codes already issued keeps working when this is turned off.'),\n referrerReward: ReferrerRewardSchema.optional().describe('What the referrer receives when a referral converts. Absent means nothing.'),\n referredReward: ReferredRewardSchema.optional().describe('What the referred account receives. Absent means nothing.'),\n codeValidityDays: z.number().int().min(1).default(30).describe('How many days a referral code can be redeemed after it is issued. Defaults to 30.'),\n }).default(() => ({ enabled: false, codeValidityDays: 30 })),\n /** @wildo_source:part:end saas.models.billing.referral-program */\n\n /** Global billing policy defaults (overridden by ProductBehaviorPolicy per product) */\n defaultBehaviorPolicy: z.object({\n /** Default trial days for new subscriptions (0 = no trial) */\n defaultTrialDays: z.number().min(0).default(0),\n /**\n * DECLARATION-ONLY (#408, 2026-09-08). Dunning — how long to wait and how often to retry after a\n * failed payment — is configured at the PROVIDER, on its own schedule, and nothing here reaches\n * it. Binding them would mean writing a provider's retry settings from application config, which\n * is a different feature from reading a policy at a call site.\n */\n paymentGracePeriodDays: z.number().min(0).default(3),\n /** DECLARATION-ONLY — see `paymentGracePeriodDays`. */\n maxPaymentRetries: z.number().min(0).default(3),\n /** Default proration when no product-specific policy. READ by the change-plan path. */\n defaultProration: z.enum(ProrationBehavior).default(ProrationBehavior.CREATE_PRORATIONS),\n /**\n * Default cancellation timing when neither the caller nor the plan product names one.\n *\n * READ since 2026-09-08 (#408). It was dead until then, and it is bound rather than relabelled\n * because — unlike its neighbours above — it needs no provider call at all: cancellation timing\n * is resolved locally, so the only thing standing between this key and meaning something was a\n * reader. The chain is caller → product `behaviorPolicy.cancellation.defaultBehavior` → this →\n * period-end.\n */\n defaultCancellation: z.enum(BillingTiming).default(BillingTiming.AT_PERIOD_END),\n }).default(() => ({\n defaultTrialDays: 0,\n paymentGracePeriodDays: 3,\n maxPaymentRetries: 3,\n defaultProration: ProrationBehavior.CREATE_PRORATIONS,\n defaultCancellation: BillingTiming.AT_PERIOD_END,\n })),\n});\nexport type BillingConfiguration = z.infer<typeof BillingConfigurationSchema>;\n"]}
1
+ {"version":3,"file":"billing-configuration.shared.schemas.js","sourceRoot":"","sources":["../../../../src/billing/billing-configuration.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,aAAa,GACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAE9F,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,sDAAsD;IACtD,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACnC,qDAAqD;IACrD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAElC;;;;;;;;;;;OAWG;IAEH;;;;;OAKG;IACH,eAAe,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC;IAC9C,gDAAgD;IAChD,mBAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC;IAE7D;;;OAGG;IACH,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC;QACZ;;;;;;;;WAQG;QACH,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC;QAEhF;;;;;;;;;;;WAWG;QACH,kBAAkB,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC;KAC7E,CA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;CACJ,CAAC,CAAC","sourcesContent":["/**\n * Billing Configuration Schema (Shared)\n *\n * Top-level billing configuration that custom apps provide at startup.\n * Controls: provider selection, currency, tax policy, enabled scopes,\n * and default behavior policies.\n *\n * @see billing-and-features-system.md §6.7 (Billing Configuration)\n */\n\nimport { z } from 'zod';\nimport { CurrencySchema } from '@wildo-ai/zod-decorators';\nimport { ResourcePrimaryScope } from '../resources/resources.shared.schemas';\nimport {\n TaxCalculationMode,\n TaxDisplayMode,\n ProrationBehavior,\n BillingTiming,\n} from './billing-enums.shared.schemas';\nimport { ReferredRewardSchema, ReferrerRewardSchema } from './referral-reward.shared.schemas';\n\nexport const BillingConfigurationSchema = z.object({\n /** Master switch: is billing enabled for this app? */\n enabled: z.boolean().default(false),\n /** Which billing provider to use (e.g., 'stripe') */\n providerRef: z.string().optional(),\n\n /*\n * NO `webhooks` block. `path` and `signingSecretRef` were declared here and read by NOTHING —\n * `signingSecretRef` had zero references outside its own declaration — and they were removed on\n * 2026-09-08 (#408) rather than relabelled, because unlike the commercial-intent keys below they\n * were not even an input to anything.\n *\n * The route and the signing secret both come from the provider module's `WEBHOOK_ORIGINATOR`\n * contract: `buildWebhookEndpoints` mounts it at `/api/v1/webhooks/<provider>/billing`. That is\n * the single authority, and `webhook-auto-controller.backend.service.ts` already recorded the\n * same conclusion when endpoint-level path/secret extras were dropped as dead in the 2026-05-06\n * reshape. This block was the copy that survived that sweep.\n */\n\n /**\n * DECLARATION-ONLY (#408, 2026-09-08). Read by the application-creation commercial-model brief and\n * by no runtime billing path: nothing validates a product's currency against these, and what\n * reaches the provider is each price's own `currency`. Authoring them records the commercial\n * intent a reviewer reads; it enforces nothing.\n */\n defaultCurrency: CurrencySchema.default('USD'),\n /** DECLARATION-ONLY — see `defaultCurrency`. */\n supportedCurrencies: z.array(CurrencySchema).default(['USD']),\n\n /**\n * Tax configuration — calculation is ALWAYS delegated to provider (Stripe Tax, etc.).\n * We never calculate tax locally.\n */\n tax: z.object({\n /**\n * Whether the PROVIDER computes tax on a purchase. READ since 2026-09-08 (#408): the checkout\n * path — the only production purchase route — sends `automaticTax` from this value.\n *\n * It reached nothing before that, so `PROVIDER_MANAGED` changed no behaviour and the provider\n * account's own configuration silently decided. Enabling it changes invoice totals and the tax\n * amounts persisted against them, which is why it is a decision an application makes rather\n * than a default the framework picks.\n */\n calculationMode: z.enum(TaxCalculationMode).default(TaxCalculationMode.DISABLED),\n\n /**\n * How prices are DISPLAYED to users (does not affect provider calculation).\n * - 'exclusive': Prices shown excluding tax (HT / ex-VAT). Tax added at checkout.\n * Common for B2B. Shows \"$49/mo\" and tax is added separately.\n * - 'inclusive': Prices shown including tax (TTC / inc-VAT). Tax is embedded.\n * Common for consumer-facing. Shows \"€49/mo TTC\" and tax is extracted at checkout.\n *\n * DECLARATIVE ONLY: nothing reads this value. It is not an application-wide default that\n * `product.taxDisplayMode` and `price.taxBehavior` override, because there is no resolution\n * chain between the three. What reaches the billing provider is each price's own\n * `taxBehavior`, and only that.\n */\n defaultDisplayMode: z.enum(TaxDisplayMode).default(TaxDisplayMode.EXCLUSIVE),\n }).default(() => ({\n calculationMode: TaxCalculationMode.DISABLED,\n defaultDisplayMode: TaxDisplayMode.EXCLUSIVE,\n })),\n\n /**\n * Which scopes can have billing accounts (default: ORGANIZATIONS only).\n * Can be extended to include USER_SELF (personal billing).\n */\n enabledScopes: z.array(z.enum(ResourcePrimaryScope)).default([ResourcePrimaryScope.ORGANIZATIONS]),\n\n /**\n * Promotions configuration.\n * Controls whether the promotions subsystem is active.\n */\n promotions: z.object({\n /**\n * DECLARATION-ONLY (#408, 2026-09-08), and the sharpest of them: the promotions subsystem runs\n * UNCONDITIONALLY. Promotion codes are applied at `billing-account.mutations` and resolved in\n * `billing-state`, neither of which consults this flag — so setting it `false` disables\n * nothing, which is a stronger statement than \"is not read\".\n */\n enabled: z.boolean().default(true),\n }).default(() => ({\n enabled: true,\n })),\n\n /**\n * Credit pool configuration.\n * Controls whether credit pools are enabled and defines default pool behavior.\n */\n creditPools: z.object({\n /**\n * DECLARATION-ONLY (#408, 2026-09-08) — same shape as `promotions.enabled` above, and the same\n * correction: credit pools run unconditionally in `billing-state`, so `false` disables nothing.\n */\n enabled: z.boolean().default(true),\n /** Default initial balance for auto-created pools (default 0) */\n defaultInitialBalance: z.number().min(0).default(0),\n }).default(() => ({\n enabled: true,\n defaultInitialBalance: 0,\n })),\n\n /** @wildo_source:part:start saas.models.billing.referral-program facet:layer:shared facet:audience:app-developer */\n /**\n * The referral program (#1802): whether organizations may issue referral codes, and what each side\n * receives when a referral converts (the referred account's first paid invoice).\n *\n * The rewards are copied onto each referral when its code is issued, so changing them here affects\n * codes issued afterwards and never re-prices a referral already made. A reward's `featureKey` must\n * name a registered boolean feature; startup WARNS about one that does not, like every other feature\n * reference, and a feature nobody registered grants nothing.\n */\n referrals: z.object({\n /** Off by default: issuing codes that promise rewards is a commercial decision the application makes. */\n enabled: z.boolean().default(false).describe('Whether organizations may issue referral codes. Redeeming and converting codes already issued keeps working when this is turned off.'),\n referrerReward: ReferrerRewardSchema.optional().describe('What the referrer receives when a referral converts. Absent means nothing.'),\n referredReward: ReferredRewardSchema.optional().describe('What the referred account receives. Absent means nothing.'),\n codeValidityDays: z.number().int().min(1).default(30).describe('How many days a referral code can be redeemed after it is issued. Defaults to 30.'),\n }).default(() => ({ enabled: false, codeValidityDays: 30 })),\n /** @wildo_source:part:end saas.models.billing.referral-program */\n\n /** Global billing policy defaults (overridden by ProductBehaviorPolicy per product) */\n defaultBehaviorPolicy: z.object({\n /** Default trial days for new subscriptions (0 = no trial) */\n defaultTrialDays: z.number().min(0).default(0),\n /**\n * DECLARATION-ONLY (#408, 2026-09-08). Dunning — how long to wait and how often to retry after a\n * failed payment — is configured at the PROVIDER, on its own schedule, and nothing here reaches\n * it. Binding them would mean writing a provider's retry settings from application config, which\n * is a different feature from reading a policy at a call site.\n */\n paymentGracePeriodDays: z.number().min(0).default(3),\n /** DECLARATION-ONLY — see `paymentGracePeriodDays`. */\n maxPaymentRetries: z.number().min(0).default(3),\n /** Default proration when no product-specific policy. READ by the change-plan path. */\n defaultProration: z.enum(ProrationBehavior).default(ProrationBehavior.CREATE_PRORATIONS),\n /**\n * Default cancellation timing when neither the caller nor the plan product names one.\n *\n * READ since 2026-09-08 (#408). It was dead until then, and it is bound rather than relabelled\n * because — unlike its neighbours above — it needs no provider call at all: cancellation timing\n * is resolved locally, so the only thing standing between this key and meaning something was a\n * reader. The chain is caller → product `behaviorPolicy.cancellation.defaultBehavior` → this →\n * period-end.\n */\n defaultCancellation: z.enum(BillingTiming).default(BillingTiming.AT_PERIOD_END),\n }).default(() => ({\n defaultTrialDays: 0,\n paymentGracePeriodDays: 3,\n maxPaymentRetries: 3,\n defaultProration: ProrationBehavior.CREATE_PRORATIONS,\n defaultCancellation: BillingTiming.AT_PERIOD_END,\n })),\n});\nexport type BillingConfiguration = z.infer<typeof BillingConfigurationSchema>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"billing-enums.shared.schemas.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-enums.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAI3J;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,oBAAY,WAAW;IACrB,gEAAgE;IAChE,IAAI,SAAS;IACb,6DAA6D;IAC7D,KAAK,UAAU;IACf,kEAAkE;IAClE,OAAO,YAAY;IACnB,6EAA6E;IAC7E,QAAQ,aAAa;IACrB,sEAAsE;IACtE,WAAW,gBAAgB;IAC3B,0EAA0E;IAC1E,IAAI,SAAS;CACd;AAMD;;;;GAIG;AACH,oBAAY,cAAc;IACxB,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAID;;GAEG;AAKH;;;;GAIG;AACH,oBAAY,aAAa;IACvB,SAAS,c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IACjB,0BAA0B;IAC1B,cAAc,mBAAmB;IACjC,uBAAuB;IACvB,QAAQ,aAAa;IACrB,yBAAyB;IACzB,IAAI,SAAS;CACd;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,UAAU,eAAe;IACzB,YAAY,iBAAiB;CAC9B;AAED;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,SAAS,cAAc;CACxB;AAED;;;;;;;;;;GAUG;AACH,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED;;;;GAIG;AACH,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,eAAe,oBAAoB;CACpC;AAED;;;;GAIG;AACH,oBAAY,qBAAqB;IAC/B,6DAA6D;IAC7D,QAAQ,aAAa;IACrB,mEAAmE;IACnE,KAAK,UAAU;CAChB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,oCAAoC,WAAW,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,oBAAY,0BAA0B;IACpC;;;;;;OAMG;IACH,kBAAkB,2BAA2B;IAC7C,kGAAkG;IAClG,WAAW,qBAAqB;IAChC;;;;;;;;;;;;OAYG;IACH,YAAY,sBAAsB;IAClC;;;OAGG;IACH,QAAQ,mBAAmB;CAC5B;AAED;;;;GAIG;AACH,oBAAY,8BAA8B;IACxC;;;;OAIG;IACH,QAAQ,mBAAmB;CAC5B;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,6BAA6B,SAAU,CAAC"}
1
+ {"version":3,"file":"billing-enums.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/bill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BAAqB;IAC/B,6DAA6D;IAC7D,QAAQ,aAAa;IACrB,mEAAmE;IACnE,KAAK,UAAU;CAChB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,oCAAoC,WAAW,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,oBAAY,0BAA0B;IACpC;;;;;;OAMG;IACH,kBAAkB,2BAA2B;IAC7C,kGAAkG;IAClG,WAAW,qBAAqB;IAChC;;;;;;;;;;;;OAYG;IACH,YAAY,sBAAsB;IAClC;;;OAGG;IACH,QAAQ,mBAAmB;CAC5B;AAED;;;;GAIG;AACH,oBAAY,8BAA8B;IACxC;;;;OAIG;IACH,QAAQ,mBAAmB;CAC5B;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,6BAA6B,SAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"billing-enums.shared.schemas.js","sourceRoot":"","sources":["../../../src/billing/billing-enums.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAE3J,sEAAsE;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAN,IAAY,WAaX;AAbD,WAAY,WAAW;IACrB,gEAAgE;IAChE,4BAAa,CAAA;IACb,6DAA6D;IAC7D,8BAAe,CAAA;IACf,kEAAkE;IAClE,kCAAmB,CAAA;IACnB,6EAA6E;IAC7E,oCAAqB,CAAA;IACrB,sEAAsE;IACtE,0CAA2B,CAAA;IAC3B,0EAA0E;IAC1E,4BAAa,CAAA;AACf,CAAC,EAbW,WAAW,KAAX,WAAW,QAatB;AAED,oGAAoG;AACpG,8EAA8E;AAC9E,mGAAmG;AAEnG;;;;GAIG;AACH,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,6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;GAWG;AACH,MAAM,CAAN,IAAY,0BA8BX;AA9BD,WAAY,0BAA0B;IACpC;;;;;;OAMG;IACH,2EAA6C,CAAA;IAC7C,kGAAkG;IAClG,8DAAgC,CAAA;IAChC;;;;;;;;;;;;OAYG;IACH,gEAAkC,CAAA;IAClC;;;OAGG;IACH,yDAA2B,CAAA;AAC7B,CAAC,EA9BW,0BAA0B,KAA1B,0BAA0B,QA8BrC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,8BAOX;AAPD,WAAY,8BAA8B;IACxC;;;;OAIG;IACH,6DAA2B,CAAA;AAC7B,CAAC,EAPW,8BAA8B,KAA9B,8BAA8B,QAOzC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,OAAO,CAAC","sourcesContent":["/**\n * Billing Enums (Shared)\n *\n * All billing-system enums used across backend, frontend, and shared models.\n * These supersede the legacy enums from billing.shared.schemas.ts.\n *\n * Enums shared with the standard billing interface (PricingModel, BillingInterval,\n * TaxDisplayMode, SubscriptionStatus, InvoiceStatus, ProrationBehavior) are defined in\n * @wildo-ai/external-connectors-models and re-exported here for convenience.\n *\n * @see billing-and-features-system.md §6 (Billing Schemas)\n */\n\nexport { PricingModel, BillingInterval, TaxDisplayMode, SubscriptionStatus, InvoiceStatus, ProrationBehavior } from '@wildo-ai/external-connectors-models';\n\n// ── Product & Pricing ──────────────────────────────────────────────\n\n/**\n * @wildo_source:part:start saas.models.billing.catalog-vocabularies facet:layer:shared facet:audience:app-developer\n *\n * The vocabularies an application types into its own product catalogue — the `ProductDefinition[]`\n * it exports from its shared library and hands to the engine with its module declarations.\n *\n * Imported from `@wildo-ai/saas-models`. `PricingModel`, `BillingInterval` and `ProrationBehavior`\n * are re-exported from the connector models, because their values ARE the provider's wire values.\n *\n * The authored catalogue is the source of truth; provider-dashboard edits are not read back.\n * A complete sync detects active local product keys absent from the array and deactivates those\n * products and their active local prices, retaining the rows and reporting live subscribers.\n * It does not archive provider products/prices or migrate/cancel subscribers. Treat provider\n * retirement and customer migration as separate decisions, and inspect the complete sync result.\n *\n * Product types available in the billing catalog.\n *\n * | Type | Creates subscription? | Repeatable? | Grants features? | Usage tracked? |\n * |-------------|----------------------|-------------|------------------|----------------|\n * | PLAN | Yes (exclusive) | No (switch) | Yes | No |\n * | ADDON | Yes (stackable) | No (toggle) | Yes | No |\n * | METERED | Yes | No | Optional | Yes |\n * | ONE_TIME | No | No (once) | Optional | No |\n * | CREDIT_PACK | No | Yes | No (credits) | Credits-based |\n * | ITEM | No | Yes | Optional | No |\n */\nexport enum ProductType {\n /** Subscription plan, mutually exclusive per billing account */\n PLAN = 'plan',\n /** Optional subscription add-on, stackable on top of plan */\n ADDON = 'addon',\n /** Usage-based subscription (consumption reported to provider) */\n METERED = 'metered',\n /** Single purchase, once per billing account (e.g., setup fee, migration) */\n ONE_TIME = 'one_time',\n /** Buy a pack of credits/tokens (repeatable, consumable over time) */\n CREDIT_PACK = 'credit_pack',\n /** Purchasable item, repeatable (e.g., report generation, data export) */\n ITEM = 'item',\n}\n\n// ProductPriceDisclosure / ProductAvailability: declared in `./public-pricing-catalog.shared.atoms`\n// (#1835) — import-free so the website's browser bundle can name them through\n// `@wildo-ai/saas-models/public-runtime`. Not re-exported here; the package root exports the atom.\n\n/**\n * Limit grant mode: how this product's limits compose with other products.\n * - SET: absolute value (replaces, used for PLAN base limits)\n * - ADD: additive (stacks on top, used for ADDON bonus limits)\n */\nexport enum LimitGrantMode {\n SET = 'set',\n ADD = 'add',\n}\n\n// ── Billing Lifecycle ──────────────────────────────────────────────\n\n/**\n * Proration behavior for plan changes (upgrade/downgrade).\n */\n// ProrationBehavior: re-exported from @wildo-ai/external-connectors-models (see top of file).\n// Moved there 2026-09-08 (#516) because its three values ARE the provider's wire values, so the\n// request contract has to be able to name the type — see TaxDisplayMode for the same reasoning.\n\n/**\n * Billing timing: when a cancellation takes effect (`behaviorPolicy.cancellation.defaultBehavior`), and when a plan\n * change takes effect (`behaviorPolicy.upgrade.timing` / `downgrade.timing`, #1868). A plan change `at_period_end` is\n * carried as the subscription's `pendingPlanChange` and applied at renewal through a provider subscription schedule.\n */\nexport enum BillingTiming {\n IMMEDIATE = 'immediate',\n AT_PERIOD_END = 'at_period_end',\n}\n/** @wildo_source:part:end saas.models.billing.catalog-vocabularies */\n\n// BillingInterval: re-exported from @wildo-ai/external-connectors-models (see top of file)\n\n// ── Metering & Usage ───────────────────────────────────────────────\n\n/**\n * Metering aggregation window for usage records.\n */\nexport enum MeteringAggregationWindow {\n PER_FLUSH = 'per_flush',\n PER_BILLING_PERIOD = 'per_billing_period',\n}\n\n/**\n * Usage aggregation type for metered prices.\n */\nexport enum UsageAggregationType {\n SUM = 'sum',\n MAX = 'max',\n LAST = 'last',\n}\n\n/**\n * Usage record source type.\n */\nexport enum UsageSourceType {\n OPERATION = 'operation',\n RESOURCE_COUNT = 'resource_count',\n CUSTOM = 'custom',\n}\n\n/**\n * Where one metered usage row stands with respect to the provider flush.\n *\n * This was a BOOLEAN (`reportedToProvider`) until 2026-09-09, and the third state is the whole\n * reason it is an enum now (#512). A boolean can say \"not yet reported\" and \"reported\", and the\n * flush selects on the first — so a row that can NEVER be reported has nowhere to go. It stays\n * pending, is re-selected by every run, fails identically, and grows an error backlog that no\n * operator action can drain, on a five-minute schedule.\n *\n * The three states are genuinely distinct and must not be collapsed:\n *\n * - {@link PENDING} — the flush will try again. Every newly recorded row starts here.\n * - {@link REPORTED} — the provider acknowledged the quantity. `reportedAt` says when. Terminal,\n * and money has moved: never move a row back out of this state.\n * - {@link UNREPORTABLE} — the flush determined the row can never be reported, for a reason named\n * in `unreportableReason`. Terminal, and NO money moved. Marking such a row `REPORTED` instead\n * would drain the backlog just as well and would be a lie no later reader could detect, which is\n * exactly why the state exists rather than a shortcut.\n */\nexport enum UsageRecordFlushState {\n PENDING = 'pending',\n REPORTED = 'reported',\n UNREPORTABLE = 'unreportable',\n}\n\n/**\n * Why a usage row was determined to be permanently unreportable.\n *\n * One member today, and it is a closed vocabulary rather than a free string because the operator\n * reading a retained financial record needs to know which permanent condition applies — and because\n * the distinction between a PERMANENT and a TRANSIENT failure is the judgement this whole state\n * turns on. A billing account that merely has no `providerCustomerId` yet is transient: the account\n * exists, provisioning may still complete, and such a row stays {@link UsageRecordFlushState.PENDING}.\n * Only a condition that cannot resolve itself belongs here.\n */\nexport enum UsageRecordUnreportableReason {\n /**\n * The billing account row no longer exists.\n *\n * Reachable by design: usage rows are RETAINED when their subject is erased (the tax/audit\n * obligation on `usage-record.shared.schemas.ts`), so a deleted account legitimately leaves rows\n * behind with no provider customer to report them to. Nothing can restore the mapping, so the\n * quantity will never be billed and saying so on the row is the only honest outcome.\n */\n BILLING_ACCOUNT_DELETED = 'billing_account_deleted',\n}\n\n// ── Provider reconciliation ────────────────────────────────────────\n\n/**\n * What KIND of disagreement a billing reconciliation run found between local billing state and the\n * provider.\n *\n * A closed vocabulary rather than free text on a log line, because each kind has a different\n * treatment and a different meaning when it persists, and a recorded run has to be able to say\n * which one it saw how many times:\n *\n * - the two DRIFT kinds and the MISSING kind are REPAIRED, within the provider-authoritative field\n * set only;\n * - {@link SUBSCRIPTION_PROVIDER_STATE_UNREADABLE} is NEVER repaired — a failed read, including a\n * provider saying the subscription does not exist, is not evidence the subscription ended, so it\n * is reported and nothing is written.\n *\n * A steady non-zero count of any repaired kind means webhook delivery is failing and the sweep is\n * papering over it; that is a different problem from the sweep failing, and only a per-kind count\n * can tell them apart.\n */\nexport enum BillingReconciliationDivergenceKind {\n /** A live, provider-linked subscription disagreed with the provider on at least one provider-authoritative field. */\n SUBSCRIPTION_FIELD_DRIFT = 'subscription_field_drift',\n /** The provider's state for a provider-linked subscription could not be read. Reported only; local state is untouched. */\n SUBSCRIPTION_PROVIDER_STATE_UNREADABLE = 'subscription_provider_state_unreadable',\n /** An invoice the provider holds for a known customer had no local record — its webhook was never delivered. */\n INVOICE_MISSING_LOCALLY = 'invoice_missing_locally',\n /** A locally recorded invoice carried a different status from the provider's. */\n INVOICE_STATUS_DRIFT = 'invoice_status_drift',\n}\n\n/**\n * A population a reconciliation run met and deliberately did NOT compare against the provider.\n *\n * Counted per run, because a sweep that silently skips rows is indistinguishable from one that\n * compared them and found agreement — and \"we reconciled everything\" is only a true sentence when\n * the skipped populations are stated beside it. Each member is a DECISION with a reason, not a gap:\n *\n * Populations that are never compared by design and therefore never met at all — terminal\n * subscriptions, subscriptions known only to the provider, subscription items, invoice totals, and\n * invoices older than the per-customer lookback — are named on `BillingReconciliationBackendService`\n * rather than here, because a run cannot count what it never selects.\n */\nexport enum BillingReconciliationUncomparedPopulation {\n /** A local subscription with no provider link: there is no provider record to compare it against. */\n SUBSCRIPTION_WITHOUT_PROVIDER_LINK = 'subscription_without_provider_link',\n /**\n * A provider-linked subscription whose mutation slot holds a PREPARED admission: one of its mutations is\n * about to call the provider, so the run neither read nor wrote it. Its next run re-reads it.\n */\n SUBSCRIPTION_MUTATION_ADMISSION_PREPARED = 'subscription_mutation_admission_prepared',\n /**\n * A provider-linked subscription the run read and found disagreeing, but whose mutation slot was written after that read, so nothing\n * was written: the difference may already be gone. The writer is not always a mutation or a webhook — recovery moving a held\n * generation behind newer ones advances the same version without settling anything — so this counts a read to REPEAT, never a\n * mutation observed. Counted here rather than as a divergence the run cannot confirm. Its next run re-reads it.\n */\n SUBSCRIPTION_SUPERSEDED_BEFORE_REPAIR = 'subscription_superseded_before_repair',\n /**\n * A provider-linked subscription whose billing account or provider link no longer matches the identity its mutation slot\n * records. A mutation refuses the same condition as `slot_identity_changed`; the run neither compares nor writes it, and it\n * stays held until recovery resolves the slot.\n */\n SUBSCRIPTION_SLOT_IDENTITY_CHANGED = 'subscription_slot_identity_changed',\n /** A billing account with no provider customer: nothing at the provider can hold its invoices. */\n BILLING_ACCOUNT_WITHOUT_PROVIDER_CUSTOMER = 'billing_account_without_provider_customer',\n /**\n * A billing scope whose rows exceeded one run's page ceiling. The remainder is left to the next run:\n * reconciliation is idempotent, so a prefix is safe, but the count says the run did not cover the scope.\n */\n SCOPE_TRUNCATED_AT_PAGE_CEILING = 'scope_truncated_at_page_ceiling',\n}\n\n// ── Tax ────────────────────────────────────────────────────────────\n\n// TaxDisplayMode: re-exported from @wildo-ai/external-connectors-models (see top of file)\n\n/**\n * Tax calculation mode: provider-managed or disabled.\n */\nexport enum TaxCalculationMode {\n PROVIDER_MANAGED = 'provider_managed',\n DISABLED = 'disabled',\n}\n\n// ── Subscription & Invoice Status ──────────────────────────────────\n\n// SubscriptionStatus: re-exported from @wildo-ai/external-connectors-models (see top of file)\n\n// InvoiceStatus: re-exported from @wildo-ai/external-connectors-models (see top of file).\n// It moved there on 2026-09-09 so `StandardBilling_InvoiceData` could name it; the specifier every\n// consumer imports is unchanged.\n\n// ── Billing Scope ──────────────────────────────────────────────────\n\n/**\n * Billing-compatible scope types.\n * Subset of ResourcePrimaryScope — excludes APPLICATION which has no billing variants.\n * Used by scope-agnostic billing resources (e.g., Referrals) that reference\n * billing accounts across different polymorphic collections.\n */\nexport enum BillingScopeType {\n ORGANIZATIONS = 'organizations',\n USER_SELF = 'user_self',\n}\n\n// ── Promotions & Referrals ─────────────────────────────────────────\n\n/**\n * Promotion type.\n */\nexport enum PromotionType {\n /** Direct discount */\n COUPON = 'coupon',\n /** Code-based discount */\n PROMOTION_CODE = 'promotion_code',\n /** Referral program */\n REFERRAL = 'referral',\n /** Special deal/offer */\n DEAL = 'deal',\n}\n\n/**\n * Discount type for promotions.\n */\nexport enum DiscountType {\n PERCENTAGE = 'percentage',\n FIXED_AMOUNT = 'fixed_amount',\n}\n\n/**\n * Promotion duration (how long the discount applies).\n */\nexport enum PromotionDuration {\n ONCE = 'once',\n REPEATING = 'repeating',\n FOREVER = 'forever',\n}\n\n/**\n * Referral status lifecycle.\n */\nexport enum ReferralStatus {\n PENDING = 'pending',\n ACCEPTED = 'accepted',\n CONVERTED = 'converted',\n EXPIRED = 'expired',\n CANCELLED = 'cancelled',\n}\n\n/**\n * What a referrer receives when a referral converts (#1802). Each member names the fields it reads in\n * `ReferrerRewardSchema` and how it is delivered:\n *\n * - `CREDIT` — `credits` added to the `creditPoolKey` credit pool, as a GRANT (not a purchase).\n * - `DISCOUNT` — a `percentOff` coupon on the account's active subscription, for `discountDuration`.\n * - `FEATURE` — the boolean feature `featureKey`, for `durationDays` after conversion or permanently.\n *\n * `COMMISSION` was removed: a commission is a payout to the referrer, and the framework has no payout\n * mechanism, so a declared commission could only ever be recorded and never paid.\n */\nexport enum ReferrerRewardType {\n CREDIT = 'credit',\n DISCOUNT = 'discount',\n FEATURE = 'feature',\n}\n\n/**\n * What a referred account receives (#1802). The first three are delivered like the referrer's, when the\n * referral converts. `TRIAL_EXTENSION` shapes the purchase itself: every subscription checkout the\n * referred account opens while the referral is ACCEPTED gets `trialExtensionDays` more trial.\n */\nexport enum ReferredRewardType {\n CREDIT = 'credit',\n DISCOUNT = 'discount',\n FEATURE = 'feature',\n TRIAL_EXTENSION = 'trial_extension',\n}\n\n/**\n * Where credits added to a pool came from (#1802). A pool counts them separately — `totalPurchased` for\n * credits a customer paid for, `totalGranted` for credits given to them — because the two answer\n * different questions: what was sold, and what was given away.\n */\nexport enum CreditPoolTopUpSource {\n /** Credits from a paid purchase (a credit-pack checkout). */\n PURCHASE = 'purchase',\n /** Credits given without a purchase, such as a referral reward. */\n GRANT = 'grant',\n}\n\n// ── Provider checkout metadata: the framework/caller trust boundary ─────────────\n\n/**\n * Prefix that marks a provider-metadata key as FRAMEWORK-AUTHORITATIVE.\n *\n * ## Why a reserved namespace exists at all\n *\n * A provider checkout session carries ONE flat `metadata` map, and two parties want to write into\n * it: the framework (which needs to recognise the purchase when the provider echoes the session\n * back on `checkout.session.completed`) and the application's own caller (who legitimately wants\n * to tag the purchase for their analytics or reconciliation).\n *\n * Those two writers do not have the same authority. The framework's entries decide WHICH billing\n * account is credited and HOW MUCH — the provider replays them verbatim inside a genuinely SIGNED\n * webhook, so a signature proves the provider sent them, never that the framework wrote them. The\n * caller's entries decide nothing.\n *\n * Sharing one un-partitioned namespace between those two authorities is what turned a caller-supplied\n * map into a credit-minting primitive: the producer spread caller metadata LAST, so `billingAccountId`\n * / `productKey` / `quantity` were simply overwritable, and the webhook consumer read the result back\n * as trusted framework state. Ordering alone is not the fix — swapping the spread leaves an\n * unmarked namespace in which the NEXT authoritative key is one careless line from being overridable\n * again. The prefix makes the trust boundary a property of the KEY, so it survives refactors.\n *\n * The boundary is enforced in three places, deliberately overlapping:\n * 1. the OPEN_CHECKOUT request DTO REFUSES any caller key carrying this prefix (loud, at the edge);\n * 2. the metadata builder writes the reserved entries LAST (structural, cannot be forgotten);\n * 3. the webhook consumer reads ONLY reserved keys, and re-derives the billing account from\n * provider-authoritative data rather than trusting the echoed value.\n *\n * @see BillingCheckoutMetadataKey for the reserved key vocabulary itself.\n */\nexport const BILLING_RESERVED_METADATA_KEY_PREFIX = 'wildo_';\n\n/**\n * The closed vocabulary of framework-authoritative provider-metadata keys.\n *\n * Every member MUST start with {@link BILLING_RESERVED_METADATA_KEY_PREFIX} — that is what makes the\n * DTO's caller-key refusal and the consumer's read-only-reserved rule line up. A member added\n * without the prefix would be silently overridable by a caller, which is the whole defect this\n * vocabulary exists to prevent, so a pinned test asserts the prefix across every member.\n *\n * Named rather than inlined because each member carries a different obligation on the consumer side\n * (one is cross-checked against provider truth, one selects the product, one is bounded and\n * strictly parsed) and a bare string literal has nowhere to record that.\n */\nexport enum BillingCheckoutMetadataKey {\n /**\n * The billing account the checkout was opened FOR.\n *\n * Written for traceability and cross-checking only. The webhook consumer re-derives the account\n * from the provider-authoritative customer id on the event and REFUSES the event if the echoed\n * value disagrees — it is never used as the account to credit.\n */\n BILLING_ACCOUNT_ID = 'wildo_billingAccountId',\n /** The catalog product key purchased — selects the credit pool and credits-per-unit on top-up. */\n PRODUCT_KEY = 'wildo_productKey',\n /**\n * The PROMOTION row whose code the framework validated when it opened this checkout, so the\n * redemption can be counted when the session COMPLETES (#518).\n *\n * Absent when the purchase used no code, which is the common case.\n *\n * Stamped rather than re-derived from the completed session, because the provider reports the\n * DISCOUNT it applied and not the Wildo row that authorised it — and the row is what carries\n * `maxRedemptions`. Like every key here it is written for the framework's own reconciliation and is\n * never trusted as authority on its own: the redemption is counted with a compare-and-swap that\n * refuses past the cap, so a tampered value can at worst count a redemption against a promotion\n * that has room for one.\n */\n PROMOTION_ID = 'wildo_promotionId',\n /**\n * The purchased quantity, as a decimal integer string (provider metadata values are strings).\n * Strictly parsed and bounded by {@link BILLING_CHECKOUT_MAX_QUANTITY} on the way back in.\n */\n QUANTITY = 'wildo_quantity',\n}\n\n/**\n * Framework-authoritative metadata keys the engine writes on a provider SUBSCRIPTION (#535), in the same reserved namespace\n * as {@link BillingCheckoutMetadataKey} and under the same rule: every member starts with\n * {@link BILLING_RESERVED_METADATA_KEY_PREFIX}, so no caller-authored metadata can be mistaken for it.\n */\nexport enum BillingSubscriptionMetadataKey {\n /**\n * `<slotId>:<generation>` of the subscription mutation that sent the update. Written so reconciliation can match a\n * provider object to the durable mutation that caused it — including a change whose response was lost. A reference, never\n * authority on its own: a match is confirmed against the stored mutation's identity.\n */\n MUTATION = 'wildo_mutation',\n}\n\n/**\n * Upper bound on a single checkout's line-item quantity, applied on BOTH sides of the provider\n * round trip: the OPEN_CHECKOUT request DTO refuses more, and the webhook consumer refuses to\n * honour more.\n *\n * One shared constant rather than two, because a consumer bound lower than the producer bound would\n * silently refuse legitimate large purchases the framework itself allowed to be billed — the\n * failure mode where the customer is charged and the credits never arrive.\n *\n * The value is a framework policy ceiling, not a provider-derived one: it is deliberately far above\n * any plausible self-serve purchase and far below the range where an unbounded quantity becomes a\n * credit-minting primitive. An application whose catalog genuinely sells in larger units should\n * raise it here, where both sides read it, rather than at either end.\n */\nexport const BILLING_CHECKOUT_MAX_QUANTITY = 999_999;\n"]}
1
+ {"version":3,"file":"billing-enums.shared.schemas.js","sourceRoot":"","sources":["../../../../src/billing/billing-enums.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAE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AAA;IACrB,yCAAmB,CAAA;AACrB,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,uCAAiB,CAAA;IACjB,2CAAqB,CAAA;IACrB,yCAAmB,CAAA;IACnB,yDAAmC,CAAA;AACrC,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B,6DAA6D;IAC7D,8CAAqB,CAAA;IACrB,mEAAmE;IACnE,wCAAe,CAAA;AACjB,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC;AAED,mFAAmF;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,QAAQ,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,MAAM,CAAN,IAAY,0BA8BX;AA9BD,WAAY,0BAA0B;IACpC;;;;;;OAMG;IACH,2EAA6C,CAAA;IAC7C,kGAAkG;IAClG,8DAAgC,CAAA;IAChC;;;;;;;;;;;;OAYG;IACH,gEAAkC,CAAA;IAClC;;;OAGG;IACH,yDAA2B,CAAA;AAC7B,CAAC,EA9BW,0BAA0B,KAA1B,0BAA0B,QA8BrC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,8BAOX;AAPD,WAAY,8BAA8B;IACxC;;;;OAIG;IACH,6DAA2B,CAAA;AAC7B,CAAC,EAPW,8BAA8B,KAA9B,8BAA8B,QAOzC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,OAAO,CAAC","sourcesContent":["/**\n * Billing Enums (Shared)\n *\n * All billing-system enums used across backend, frontend, and shared models.\n * These supersede the legacy enums from billing.shared.schemas.ts.\n *\n * Enums shared with the standard billing interface (PricingModel, BillingInterval,\n * TaxDisplayMode, SubscriptionStatus, InvoiceStatus, ProrationBehavior) are defined in\n * @wildo-ai/external-connectors-models and re-exported here for convenience.\n *\n * @see billing-and-features-system.md §6 (Billing Schemas)\n */\n\nexport { PricingModel, BillingInterval, TaxDisplayMode, SubscriptionStatus, InvoiceStatus, ProrationBehavior } from '@wildo-ai/external-connectors-models';\n\n// ── Product & Pricing ──────────────────────────────────────────────\n\n/**\n * @wildo_source:part:start saas.models.billing.catalog-vocabularies facet:layer:shared facet:audience:app-developer\n *\n * The vocabularies an application types into its own product catalogue — the `ProductDefinition[]`\n * it exports from its shared library and hands to the engine with its module declarations.\n *\n * Imported from `@wildo-ai/saas-models`. `PricingModel`, `BillingInterval` and `ProrationBehavior`\n * are re-exported from the connector models, because their values ARE the provider's wire values.\n *\n * The authored catalogue is the source of truth; provider-dashboard edits are not read back.\n * A complete sync detects active local product keys absent from the array and deactivates those\n * products and their active local prices, retaining the rows and reporting live subscribers.\n * It does not archive provider products/prices or migrate/cancel subscribers. Treat provider\n * retirement and customer migration as separate decisions, and inspect the complete sync result.\n *\n * Product types available in the billing catalog.\n *\n * | Type | Creates subscription? | Repeatable? | Grants features? | Usage tracked? |\n * |-------------|----------------------|-------------|------------------|----------------|\n * | PLAN | Yes (exclusive) | No (switch) | Yes | No |\n * | ADDON | Yes (stackable) | No (toggle) | Yes | No |\n * | METERED | Yes | No | Optional | Yes |\n * | ONE_TIME | No | No (once) | Optional | No |\n * | CREDIT_PACK | No | Yes | No (credits) | Credits-based |\n * | ITEM | No | Yes | Optional | No |\n */\nexport enum ProductType {\n /** Subscription plan, mutually exclusive per billing account */\n PLAN = 'plan',\n /** Optional subscription add-on, stackable on top of plan */\n ADDON = 'addon',\n /** Usage-based subscription (consumption reported to provider) */\n METERED = 'metered',\n /** Single purchase, once per billing account (e.g., setup fee, migration) */\n ONE_TIME = 'one_time',\n /** Buy a pack of credits/tokens (repeatable, consumable over time) */\n CREDIT_PACK = 'credit_pack',\n /** Purchasable item, repeatable (e.g., report generation, data export) */\n ITEM = 'item',\n}\n\n// ProductPriceDisclosure / ProductAvailability: declared in `./public-pricing-catalog.shared.atoms`\n// (#1835) — import-free so the website's browser bundle can name them through\n// `@wildo-ai/saas-models/public-runtime`. Not re-exported here; the package root exports the atom.\n\n/**\n * Limit grant mode: how this product's limits compose with other products.\n * - SET: absolute value (replaces, used for PLAN base limits)\n * - ADD: additive (stacks on top, used for ADDON bonus limits)\n */\nexport enum LimitGrantMode {\n SET = 'set',\n ADD = 'add',\n}\n\n// ── Billing Lifecycle ──────────────────────────────────────────────\n\n/**\n * Proration behavior for plan changes (upgrade/downgrade).\n */\n// ProrationBehavior: re-exported from @wildo-ai/external-connectors-models (see top of file).\n// Moved there 2026-09-08 (#516) because its three values ARE the provider's wire values, so the\n// request contract has to be able to name the type — see TaxDisplayMode for the same reasoning.\n\n/**\n * Billing timing: when a cancellation takes effect (`behaviorPolicy.cancellation.defaultBehavior`), and when a plan\n * change takes effect (`behaviorPolicy.upgrade.timing` / `downgrade.timing`, #1868). A plan change `at_period_end` is\n * carried as the subscription's `pendingPlanChange` and applied at renewal through a provider subscription schedule.\n */\nexport enum BillingTiming {\n IMMEDIATE = 'immediate',\n AT_PERIOD_END = 'at_period_end',\n}\n/** @wildo_source:part:end saas.models.billing.catalog-vocabularies */\n\n// BillingInterval: re-exported from @wildo-ai/external-connectors-models (see top of file)\n\n// ── Metering & Usage ───────────────────────────────────────────────\n\n/**\n * Metering aggregation window for usage records.\n */\nexport enum MeteringAggregationWindow {\n PER_FLUSH = 'per_flush',\n PER_BILLING_PERIOD = 'per_billing_period',\n}\n\n/**\n * Usage aggregation type for metered prices.\n */\nexport enum UsageAggregationType {\n SUM = 'sum',\n MAX = 'max',\n LAST = 'last',\n}\n\n/**\n * Usage record source type.\n */\nexport enum UsageSourceType {\n OPERATION = 'operation',\n RESOURCE_COUNT = 'resource_count',\n CUSTOM = 'custom',\n}\n\n/**\n * Where one metered usage row stands with respect to the provider flush.\n *\n * This was a BOOLEAN (`reportedToProvider`) until 2026-09-09, and the third state is the whole\n * reason it is an enum now (#512). A boolean can say \"not yet reported\" and \"reported\", and the\n * flush selects on the first — so a row that can NEVER be reported has nowhere to go. It stays\n * pending, is re-selected by every run, fails identically, and grows an error backlog that no\n * operator action can drain, on a five-minute schedule.\n *\n * The three states are genuinely distinct and must not be collapsed:\n *\n * - {@link PENDING} — the flush will try again. Every newly recorded row starts here.\n * - {@link REPORTED} — the provider acknowledged the quantity. `reportedAt` says when. Terminal,\n * and money has moved: never move a row back out of this state.\n * - {@link UNREPORTABLE} — the flush determined the row can never be reported, for a reason named\n * in `unreportableReason`. Terminal, and NO money moved. Marking such a row `REPORTED` instead\n * would drain the backlog just as well and would be a lie no later reader could detect, which is\n * exactly why the state exists rather than a shortcut.\n */\nexport enum UsageRecordFlushState {\n PENDING = 'pending',\n REPORTED = 'reported',\n UNREPORTABLE = 'unreportable',\n}\n\n/**\n * Why a usage row was determined to be permanently unreportable.\n *\n * One member today, and it is a closed vocabulary rather than a free string because the operator\n * reading a retained financial record needs to know which permanent condition applies — and because\n * the distinction between a PERMANENT and a TRANSIENT failure is the judgement this whole state\n * turns on. A billing account that merely has no `providerCustomerId` yet is transient: the account\n * exists, provisioning may still complete, and such a row stays {@link UsageRecordFlushState.PENDING}.\n * Only a condition that cannot resolve itself belongs here.\n */\nexport enum UsageRecordUnreportableReason {\n /**\n * The billing account row no longer exists.\n *\n * Reachable by design: usage rows are RETAINED when their subject is erased (the tax/audit\n * obligation on `usage-record.shared.schemas.ts`), so a deleted account legitimately leaves rows\n * behind with no provider customer to report them to. Nothing can restore the mapping, so the\n * quantity will never be billed and saying so on the row is the only honest outcome.\n */\n BILLING_ACCOUNT_DELETED = 'billing_account_deleted',\n}\n\n// ── Provider reconciliation ────────────────────────────────────────\n\n/**\n * What KIND of disagreement a billing reconciliation run found between local billing state and the\n * provider.\n *\n * A closed vocabulary rather than free text on a log line, because each kind has a different\n * treatment and a different meaning when it persists, and a recorded run has to be able to say\n * which one it saw how many times:\n *\n * - the two DRIFT kinds and the MISSING kind are REPAIRED, within the provider-authoritative field\n * set only;\n * - {@link SUBSCRIPTION_PROVIDER_STATE_UNREADABLE} is NEVER repaired — a failed read, including a\n * provider saying the subscription does not exist, is not evidence the subscription ended, so it\n * is reported and nothing is written.\n *\n * A steady non-zero count of any repaired kind means webhook delivery is failing and the sweep is\n * papering over it; that is a different problem from the sweep failing, and only a per-kind count\n * can tell them apart.\n */\nexport enum BillingReconciliationDivergenceKind {\n /** A live, provider-linked subscription disagreed with the provider on at least one provider-authoritative field. */\n SUBSCRIPTION_FIELD_DRIFT = 'subscription_field_drift',\n /** The provider's state for a provider-linked subscription could not be read. Reported only; local state is untouched. */\n SUBSCRIPTION_PROVIDER_STATE_UNREADABLE = 'subscription_provider_state_unreadable',\n /** An invoice the provider holds for a known customer had no local record — its webhook was never delivered. */\n INVOICE_MISSING_LOCALLY = 'invoice_missing_locally',\n /** A locally recorded invoice carried a different status from the provider's. */\n INVOICE_STATUS_DRIFT = 'invoice_status_drift',\n}\n\n/**\n * A population a reconciliation run met and deliberately did NOT compare against the provider.\n *\n * Counted per run, because a sweep that silently skips rows is indistinguishable from one that\n * compared them and found agreement — and \"we reconciled everything\" is only a true sentence when\n * the skipped populations are stated beside it. Each member is a DECISION with a reason, not a gap:\n *\n * Populations that are never compared by design and therefore never met at all — terminal\n * subscriptions, subscriptions known only to the provider, subscription items, invoice totals, and\n * invoices older than the per-customer lookback — are named on `BillingReconciliationBackendService`\n * rather than here, because a run cannot count what it never selects.\n */\nexport enum BillingReconciliationUncomparedPopulation {\n /** A local subscription with no provider link: there is no provider record to compare it against. */\n SUBSCRIPTION_WITHOUT_PROVIDER_LINK = 'subscription_without_provider_link',\n /**\n * A provider-linked subscription whose mutation slot holds a PREPARED admission: one of its mutations is\n * about to call the provider, so the run neither read nor wrote it. Its next run re-reads it.\n */\n SUBSCRIPTION_MUTATION_ADMISSION_PREPARED = 'subscription_mutation_admission_prepared',\n /**\n * A provider-linked subscription the run read and found disagreeing, but whose mutation slot was written after that read, so nothing\n * was written: the difference may already be gone. The writer is not always a mutation or a webhook — recovery moving a held\n * generation behind newer ones advances the same version without settling anything — so this counts a read to REPEAT, never a\n * mutation observed. Counted here rather than as a divergence the run cannot confirm. Its next run re-reads it.\n */\n SUBSCRIPTION_SUPERSEDED_BEFORE_REPAIR = 'subscription_superseded_before_repair',\n /**\n * A provider-linked subscription whose billing account or provider link no longer matches the identity its mutation slot\n * records. A mutation refuses the same condition as `slot_identity_changed`; the run neither compares nor writes it, and it\n * stays held until recovery resolves the slot.\n */\n SUBSCRIPTION_SLOT_IDENTITY_CHANGED = 'subscription_slot_identity_changed',\n /** A billing account with no provider customer: nothing at the provider can hold its invoices. */\n BILLING_ACCOUNT_WITHOUT_PROVIDER_CUSTOMER = 'billing_account_without_provider_customer',\n /**\n * A billing scope whose rows exceeded one run's page ceiling. The remainder is left to the next run:\n * reconciliation is idempotent, so a prefix is safe, but the count says the run did not cover the scope.\n */\n SCOPE_TRUNCATED_AT_PAGE_CEILING = 'scope_truncated_at_page_ceiling',\n}\n\n// ── Tax ────────────────────────────────────────────────────────────\n\n// TaxDisplayMode: re-exported from @wildo-ai/external-connectors-models (see top of file)\n\n/**\n * Tax calculation mode: provider-managed or disabled.\n */\nexport enum TaxCalculationMode {\n PROVIDER_MANAGED = 'provider_managed',\n DISABLED = 'disabled',\n}\n\n// ── Subscription & Invoice Status ──────────────────────────────────\n\n// SubscriptionStatus: re-exported from @wildo-ai/external-connectors-models (see top of file)\n\n// InvoiceStatus: re-exported from @wildo-ai/external-connectors-models (see top of file).\n// It moved there on 2026-09-09 so `StandardBilling_InvoiceData` could name it; the specifier every\n// consumer imports is unchanged.\n\n// ── Billing Scope ──────────────────────────────────────────────────\n\n/**\n * Billing-compatible scope types.\n * Subset of ResourcePrimaryScope — excludes APPLICATION which has no billing variants.\n * Used by scope-agnostic billing resources (e.g., Referrals) that reference\n * billing accounts across different polymorphic collections.\n */\nexport enum BillingScopeType {\n ORGANIZATIONS = 'organizations',\n USER_SELF = 'user_self',\n}\n\n// ── Promotions & Referrals ─────────────────────────────────────────\n\n/**\n * Promotion type.\n */\nexport enum PromotionType {\n /** Direct discount */\n COUPON = 'coupon',\n /** Code-based discount */\n PROMOTION_CODE = 'promotion_code',\n /** Referral program */\n REFERRAL = 'referral',\n /** Special deal/offer */\n DEAL = 'deal',\n}\n\n/**\n * Discount type for promotions.\n */\nexport enum DiscountType {\n PERCENTAGE = 'percentage',\n FIXED_AMOUNT = 'fixed_amount',\n}\n\n/**\n * Promotion duration (how long the discount applies).\n */\nexport enum PromotionDuration {\n ONCE = 'once',\n REPEATING = 'repeating',\n FOREVER = 'forever',\n}\n\n/**\n * Referral status lifecycle.\n */\nexport enum ReferralStatus {\n PENDING = 'pending',\n ACCEPTED = 'accepted',\n CONVERTED = 'converted',\n EXPIRED = 'expired',\n CANCELLED = 'cancelled',\n}\n\n/**\n * What a referrer receives when a referral converts (#1802). Each member names the fields it reads in\n * `ReferrerRewardSchema` and how it is delivered:\n *\n * - `CREDIT` — `credits` added to the `creditPoolKey` credit pool, as a GRANT (not a purchase).\n * - `DISCOUNT` — a `percentOff` coupon on the account's active subscription, for `discountDuration`.\n * - `FEATURE` — the boolean feature `featureKey`, for `durationDays` after conversion or permanently.\n *\n * `COMMISSION` was removed: a commission is a payout to the referrer, and the framework has no payout\n * mechanism, so a declared commission could only ever be recorded and never paid.\n */\nexport enum ReferrerRewardType {\n CREDIT = 'credit',\n DISCOUNT = 'discount',\n FEATURE = 'feature',\n}\n\n/**\n * What a referred account receives (#1802). The first three are delivered like the referrer's, when the\n * referral converts. `TRIAL_EXTENSION` shapes the purchase itself: every subscription checkout the\n * referred account opens while the referral is ACCEPTED gets `trialExtensionDays` more trial.\n */\nexport enum ReferredRewardType {\n CREDIT = 'credit',\n DISCOUNT = 'discount',\n FEATURE = 'feature',\n TRIAL_EXTENSION = 'trial_extension',\n}\n\n/**\n * Where credits added to a pool came from (#1802). A pool counts them separately — `totalPurchased` for\n * credits a customer paid for, `totalGranted` for credits given to them — because the two answer\n * different questions: what was sold, and what was given away.\n */\nexport enum CreditPoolTopUpSource {\n /** Credits from a paid purchase (a credit-pack checkout). */\n PURCHASE = 'purchase',\n /** Credits given without a purchase, such as a referral reward. */\n GRANT = 'grant',\n}\n\n// ── Provider checkout metadata: the framework/caller trust boundary ─────────────\n\n/**\n * Prefix that marks a provider-metadata key as FRAMEWORK-AUTHORITATIVE.\n *\n * ## Why a reserved namespace exists at all\n *\n * A provider checkout session carries ONE flat `metadata` map, and two parties want to write into\n * it: the framework (which needs to recognise the purchase when the provider echoes the session\n * back on `checkout.session.completed`) and the application's own caller (who legitimately wants\n * to tag the purchase for their analytics or reconciliation).\n *\n * Those two writers do not have the same authority. The framework's entries decide WHICH billing\n * account is credited and HOW MUCH — the provider replays them verbatim inside a genuinely SIGNED\n * webhook, so a signature proves the provider sent them, never that the framework wrote them. The\n * caller's entries decide nothing.\n *\n * Sharing one un-partitioned namespace between those two authorities is what turned a caller-supplied\n * map into a credit-minting primitive: the producer spread caller metadata LAST, so `billingAccountId`\n * / `productKey` / `quantity` were simply overwritable, and the webhook consumer read the result back\n * as trusted framework state. Ordering alone is not the fix — swapping the spread leaves an\n * unmarked namespace in which the NEXT authoritative key is one careless line from being overridable\n * again. The prefix makes the trust boundary a property of the KEY, so it survives refactors.\n *\n * The boundary is enforced in three places, deliberately overlapping:\n * 1. the OPEN_CHECKOUT request DTO REFUSES any caller key carrying this prefix (loud, at the edge);\n * 2. the metadata builder writes the reserved entries LAST (structural, cannot be forgotten);\n * 3. the webhook consumer reads ONLY reserved keys, and re-derives the billing account from\n * provider-authoritative data rather than trusting the echoed value.\n *\n * @see BillingCheckoutMetadataKey for the reserved key vocabulary itself.\n */\nexport const BILLING_RESERVED_METADATA_KEY_PREFIX = 'wildo_';\n\n/**\n * The closed vocabulary of framework-authoritative provider-metadata keys.\n *\n * Every member MUST start with {@link BILLING_RESERVED_METADATA_KEY_PREFIX} — that is what makes the\n * DTO's caller-key refusal and the consumer's read-only-reserved rule line up. A member added\n * without the prefix would be silently overridable by a caller, which is the whole defect this\n * vocabulary exists to prevent, so a pinned test asserts the prefix across every member.\n *\n * Named rather than inlined because each member carries a different obligation on the consumer side\n * (one is cross-checked against provider truth, one selects the product, one is bounded and\n * strictly parsed) and a bare string literal has nowhere to record that.\n */\nexport enum BillingCheckoutMetadataKey {\n /**\n * The billing account the checkout was opened FOR.\n *\n * Written for traceability and cross-checking only. The webhook consumer re-derives the account\n * from the provider-authoritative customer id on the event and REFUSES the event if the echoed\n * value disagrees — it is never used as the account to credit.\n */\n BILLING_ACCOUNT_ID = 'wildo_billingAccountId',\n /** The catalog product key purchased — selects the credit pool and credits-per-unit on top-up. */\n PRODUCT_KEY = 'wildo_productKey',\n /**\n * The PROMOTION row whose code the framework validated when it opened this checkout, so the\n * redemption can be counted when the session COMPLETES (#518).\n *\n * Absent when the purchase used no code, which is the common case.\n *\n * Stamped rather than re-derived from the completed session, because the provider reports the\n * DISCOUNT it applied and not the Wildo row that authorised it — and the row is what carries\n * `maxRedemptions`. Like every key here it is written for the framework's own reconciliation and is\n * never trusted as authority on its own: the redemption is counted with a compare-and-swap that\n * refuses past the cap, so a tampered value can at worst count a redemption against a promotion\n * that has room for one.\n */\n PROMOTION_ID = 'wildo_promotionId',\n /**\n * The purchased quantity, as a decimal integer string (provider metadata values are strings).\n * Strictly parsed and bounded by {@link BILLING_CHECKOUT_MAX_QUANTITY} on the way back in.\n */\n QUANTITY = 'wildo_quantity',\n}\n\n/**\n * Framework-authoritative metadata keys the engine writes on a provider SUBSCRIPTION (#535), in the same reserved namespace\n * as {@link BillingCheckoutMetadataKey} and under the same rule: every member starts with\n * {@link BILLING_RESERVED_METADATA_KEY_PREFIX}, so no caller-authored metadata can be mistaken for it.\n */\nexport enum BillingSubscriptionMetadataKey {\n /**\n * `<slotId>:<generation>` of the subscription mutation that sent the update. Written so reconciliation can match a\n * provider object to the durable mutation that caused it — including a change whose response was lost. A reference, never\n * authority on its own: a match is confirmed against the stored mutation's identity.\n */\n MUTATION = 'wildo_mutation',\n}\n\n/**\n * Upper bound on a single checkout's line-item quantity, applied on BOTH sides of the provider\n * round trip: the OPEN_CHECKOUT request DTO refuses more, and the webhook consumer refuses to\n * honour more.\n *\n * One shared constant rather than two, because a consumer bound lower than the producer bound would\n * silently refuse legitimate large purchases the framework itself allowed to be billed — the\n * failure mode where the customer is charged and the credits never arrive.\n *\n * The value is a framework policy ceiling, not a provider-derived one: it is deliberately far above\n * any plausible self-serve purchase and far below the range where an unbounded quantity becomes a\n * credit-minting primitive. An application whose catalog genuinely sells in larger units should\n * raise it here, where both sides read it, rather than at either end.\n */\nexport const BILLING_CHECKOUT_MAX_QUANTITY = 999_999;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"billing-types.shared.schemas.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-types.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAOpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAQ7E,YAAY,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAI7H;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,iFAAiF;IACjF,MAAM,EAAE,UAAU,CAAC;IACnB,4DAA4D;IAC5D,SAAS,EAAE,KAAK,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,UAAU,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,+DAA+D;IAC/D,WAAW,EAAE,IAAI,CAAC;IAClB,SAAS,EAAE,IAAI,CAAC;IAChB;;;OAGG;IACH,MAAM,EAAE,aAAa,CAAC;IACtB,2EAA2E;IAC3E,WAAW,EAAE,IAAI,CAAC;CACnB;AAID;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;;;;;;iBAc7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;;;;;iBAKlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;;;;;;;;;;GAaG;AACH,gGAAgG;AAChG,oBAAY,iBAAiB;IAC3B,eAAe,mBAAmB;IAClC,YAAY,iBAAiB;IAC7B,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,YAAY,gBAAgB;IAC5B,iBAAiB,qBAAqB;CACvC;AAED,0FAA0F;AAC1F,oBAAY,wBAAwB;IAClC,SAAS,cAAc;IACvB,WAAW,gBAAgB;CAC5B;AAED,eAAO,MAAM,8BAA8B,8FAAwE,CAAC;AACpH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqErC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
1
+ {"version":3,"file":"billing-types.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-types.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;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K,CAAC,gBAAgB,CAAC,MAAM,CAAC;QACxC,MAAM,EAAE,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,mGAAmG,CAAC;QACnJ,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,iEAAiE,CAAC;KAChH,CAAC,CAAC,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IACnD,KAAK,EAAE,kBAAkB,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAClE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,uBAAuB,CAAC,CAAC,QAAQ,CAAC,wCAAwC,CAAC;IAC7G;;;;;;;OAOG;IACH,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,0BAA0B,CAAC,eAAe,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,4LAA4L,CAAC;IAC1S;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,qBAAqB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uQAAuQ,CAAC;IACvU,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC,0CAA0C,CAAC;CAC7F,CAAC,CAAC","sourcesContent":["/**\n * Billing Supporting Types (Shared)\n *\n * Types used by the billing API, frontend hooks, and provider interface.\n * These are NOT DB schemas — they are API response shapes, provider abstractions,\n * and aggregated views.\n *\n * @see billing-and-features-system.md §6.2c (Supporting Types)\n */\n\nimport { z } from 'zod';\nimport type { MoneyValue } from '@wildo-ai/zod-decorators';\nimport type { BillingTiming } from './billing-enums.shared.schemas';\nimport { BillingAccountSchema } from './billing-account.shared.schemas';\nimport { BillingSubscriptionBaseSchema } from './subscription.shared.schemas';\nimport { ProductSchema } from './product.shared.schemas';\nimport { PriceSchema } from './price.shared.schemas';\nimport { InvoiceRefSchema } from './invoice-ref.shared.schemas';\nimport { PromotionSchema } from './promotions.shared.schemas';\nimport { ResourcePrimaryScope } from '../resources/resources.shared.schemas';\nimport { CoreResourceType } from '../resources/resources.shared.core.definitions';\nimport { markEmbeddedResourceSchema } from '../resources/embedded-resource-mark.shared.utils';\n\n// ── Provider Canonical Types ───────────────────────────────────────\n// StandardBilling_SubscriptionData and StandardBilling_InvoicePreview are\n// defined in @wildo-ai/external-connectors-models (standard billing interface)\n// and re-exported here for convenience.\nexport type { StandardBilling_SubscriptionData, StandardBilling_InvoicePreview } from '@wildo-ai/external-connectors-models';\n\n// ── Invoice Preview ────────────────────────────────────────────────\n\n/**\n * Presentation value used by the billing plan-change preview. BillingContext transports the\n * provider DTO; the plan-change flow converts its minor-unit amounts into this money shape.\n * Invoice amount due must not be presented as an immediate charge without the resolved settlement policy.\n *\n * All monetary amounts use MoneyValue for bigint precision and self-contained currency.\n */\nexport interface InvoicePreview {\n /** Previewed invoice amount due; settlement timing must be stated separately. */\n amount: MoneyValue;\n /** Line items breakdown (what changed, prorated amounts) */\n lineItems: Array<{\n description: string;\n amount: MoneyValue;\n quantity: number;\n }>;\n /** Invoice period boundaries, not a guaranteed charge time. */\n periodStart: Date;\n periodEnd: Date;\n /**\n * When the change takes effect (#1868): `immediate`, or `at_period_end` — then the previewed invoice is the renewal invoice on the\n * new plan, and confirming charges nothing now.\n */\n timing: BillingTiming;\n /** When the change takes effect: now, or the end of the current period. */\n effectiveAt: Date;\n}\n\n// ── Usage Summary ──────────────────────────────────────────────────\n\n/**\n * Usage summary: aggregated usage data for the frontend UsageDashboard.\n * Computed from UsageRecords, keyed by metered product key.\n *\n * Authored as a Zod schema (not a bare interface) so it can compose into\n * `BillingStateResponseSchema` — the runtime contract wired as the `GET_STATE`\n * custom operation's `customResponseDto`. `UsageSummary` is derived from it to\n * keep the type and the runtime shape from drifting.\n */\nexport const UsageSummarySchema = z.object({\n /** Usage per metered product, keyed by product key */\n byProduct: z.record(\n z.string(),\n z.object({\n currentPeriodUsage: z.number().describe(\"Usage recorded in the current billing period.\"),\n /** Previous period (for trend display) */\n previousPeriodUsage: z.number().optional().describe(\"Usage recorded in the previous billing period.\"),\n /** Usage limit (from product/subscription, if applicable) */\n limit: z.number().optional().describe(\"The usage limit set by the product or subscription, when one applies.\"),\n /** Last usage recorded at */\n lastRecordedAt: z.date().optional().describe(\"When usage was last recorded.\"),\n }),\n ).describe(\"Usage per metered product, keyed by product key.\"),\n});\nexport type UsageSummary = z.infer<typeof UsageSummarySchema>;\n\n// ── Billing State Response ─────────────────────────────────────────\n\n/**\n * Per-pool credit balance projection embedded in the aggregated billing state.\n *\n * A lean view (NOT the full `CreditPool` resource) built by the billing-state\n * facade purely for the frontend balance display, keyed by pool key.\n */\nexport const CreditPoolBalanceSchema = z.object({\n available: z.number().describe(\"Credits available to spend.\"),\n totalPurchased: z.number().describe(\"Credits purchased in total.\"),\n totalGranted: z.number().describe(\"Credits given without a purchase in total, such as referral rewards.\"),\n totalConsumed: z.number().describe(\"Credits consumed in total.\"),\n});\nexport type CreditPoolBalance = z.infer<typeof CreditPoolBalanceSchema>;\n\n/**\n * Aggregated billing state returned by the lazy facade endpoint.\n * Single source of truth for frontend BillingProvider and backend controller.\n *\n * Authored as a Zod schema (not a bare interface) because the `GET_STATE`\n * custom operation wires it as its `customResponseDto`. That operation borrows\n * the COUNT verb for its route/verb via `resourceOperationLike` but returns\n * THIS aggregated shape — so without a `customResponseDto` the DTO builder would\n * assign it the COUNT default envelope (`{ count }`), and the service output\n * would fail `transformOutput`'s `internalDto.parse` → HTTP 500. The composed\n * schema gives the builder the real runtime contract to validate against and to\n * project the external response. `BillingStateResponse` is derived from it so the\n * type and the runtime contract cannot drift.\n */\n/** Independently loaded portions of the aggregate. Derived catalog projections use PRODUCTS. */\nexport enum BillingStateSlice {\n BILLING_ACCOUNT = 'billingAccount',\n SUBSCRIPTION = 'subscription',\n PRODUCTS = 'products',\n PRICES = 'prices',\n INVOICES = 'invoices',\n USAGE = 'usage',\n CREDIT_POOLS = 'creditPools',\n ACTIVE_PROMOTIONS = 'activePromotions',\n}\n\n/** Empty data is meaningful only when its query (and required dependencies) succeeded. */\nexport enum BillingSliceAvailability {\n AVAILABLE = 'available',\n UNAVAILABLE = 'unavailable',\n}\n\nexport const BillingStateAvailabilitySchema = z.record(z.enum(BillingStateSlice), z.enum(BillingSliceAvailability));\nexport type BillingStateAvailability = z.infer<typeof BillingStateAvailabilitySchema>;\n\nexport const BillingStateResponseSchema = z.object({\n /** Query failures keep their empty transport placeholders but MUST NOT be presented as absence. */\n availability: BillingStateAvailabilitySchema.describe(\"Whether each part of this response loaded. A part marked `unavailable` failed to load: its empty value means nothing, and must not be read as absence.\"),\n billingAccount: BillingAccountSchema.nullable().describe(\"The billing account of the caller's scope, or `null` when the scope has none.\"),\n // The subscription and the invoice refs are not marked as embedded records like the products below: which resource\n // they are depends on the caller's scope. So the few fields no other source describes here are described in place\n // (#1625), rather than on the base schemas, where they would replace each resource's own, richer description.\n subscription: BillingSubscriptionBaseSchema.extend({\n status: BillingSubscriptionBaseSchema.shape.status.describe(\"The subscription's lifecycle state as the billing provider reports it, such as `active`, `trialing` or `past_due`.\"),\n }).nullable().describe(\"The scope's current subscription, or `null` when it has none.\"),\n // Products, prices and promotions are each one resource's records, described by that resource (#1625).\n products: z.array(markEmbeddedResourceSchema(ProductSchema, CoreResourceType.PRODUCTS)).describe(\"Every product visible in this scope, including ones no longer on sale, so a plan someone already holds can still be named. Which of them can be acquired now is `acquirableProductKeys`.\"),\n prices: z.array(markEmbeddedResourceSchema(PriceSchema, CoreResourceType.PRICES)).describe(\"The prices visible in this scope.\"),\n invoices: z.array(InvoiceRefSchema.extend({\n status: InvoiceRefSchema.shape.status.describe(\"The invoice's payment state as the billing provider reports it, such as `open`, `paid` or `void`.\"),\n total: InvoiceRefSchema.shape.total.describe('The invoice total: an amount in minor units, with its currency.'),\n })).describe(\"References to the scope's invoices.\"),\n usage: UsageSummarySchema.describe(\"Metered usage in this scope.\"),\n creditPools: z.record(z.string(), CreditPoolBalanceSchema).describe(\"Credit balances, keyed by credit pool.\"),\n /**\n * Scope/product-visible promotions for the current billing surface.\n *\n * This list intentionally excludes promotions that are inactive, exhausted,\n * unsynced with the billing provider, or targeted only at products outside the\n * current scope. It is not a promise that every entry is redeemable for any\n * arbitrary checkout item the user might pick next.\n */\n activePromotions: z.array(markEmbeddedResourceSchema(PromotionSchema, CoreResourceType.PROMOTIONS)).describe(\"Promotions visible in this scope: active, not exhausted, synced with the billing provider, and targeting a product in scope. Not a promise that each one applies to a particular checkout.\"),\n /**\n * The subset of `products` (by `key`) a caller may ACQUIRE right now — buy, or move a\n * subscription onto.\n *\n * ## Why a sibling key set rather than a filter on `products`\n *\n * One call serves two surfaces that want OPPOSITE things from it. An acquisition surface (a\n * pricing table) must not offer a plan the purchase gate will refuse; a holding surface (the\n * \"your current plan\" panel, the subscription-item → product resolution in the frontend billing\n * context) must still be able to NAME a plan the catalogue has withdrawn, because a customer\n * already on a retired plan is exactly who needs to see what they hold. Filtering `products` by\n * `isActive` would serve the first and break the second — the same trade the `REMOVE_ADDON` call\n * site settles by reading with `REFERENCE` intent rather than `ACQUIRE`.\n *\n * So the response DISTINGUISHES instead of filtering: `products` stays the full scope-visible\n * catalog, and this set states which of them acquisition may offer.\n *\n * ## Why the server answers it at all\n *\n * `Product.isActive` is the declared off-boarding path, and the backend gate that makes\n * retirement TRUE (`readProductByKey` with `ACQUIRE` intent) applies ONE predicate to it. A\n * listing surface holds rows, not keys, so it cannot use that reader — and every listing left to\n * itself re-derives the rule from the raw column. That had already happened twice by 2026-09-09,\n * in a frontend component and in the reader, agreeing only by luck. This set is computed by the\n * gate's own predicate, so a surface that reads it cannot drift from what checkout will accept.\n *\n * NOT a visibility answer: `isPublic` is a per-surface decision the server cannot take for every\n * caller (a back-office catalog shows non-public rows). A customer pricing table composes the\n * two; it must not re-spell either.\n *\n * The aggregate producer sets this field and BillingContext preserves it. Consumers\n * must check PRODUCTS availability before interpreting this projection: an empty set\n * from an unavailable catalog does not prove that nothing can be acquired.\n *\n * Absence therefore means \"the producer did not project acquirability\", never \"nothing is\n * acquirable\" and never \"everything is\". A consumer that receives the set MUST use it in\n * preference to re-deriving the rule; a consumer that does not is on the older, weaker footing\n * this field exists to retire.\n */\n acquirableProductKeys: z.array(z.string()).optional().describe(\"The keys of the products in `products` that may be bought, or moved onto, right now. Absent means this was not computed, not that nothing can be acquired. Check `availability` for products first: from a catalog that failed to load, an empty list proves nothing.\"),\n scopeType: z.enum(ResourcePrimaryScope).describe(\"The scope this billing state belongs to.\"),\n});\nexport type BillingStateResponse = z.infer<typeof BillingStateResponseSchema>;\n"]}
1
+ {"version":3,"file":"billing-types.shared.schemas.js","sourceRoot":"","sources":["../../../../src/billing/billing-types.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAsC9F,sEAAsE;AAEtE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,sDAAsD;IACtD,SAAS,EAAE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AAC,QAAQ,CAAC,mGAAmG,CAAC;QACnJ,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,iEAAiE,CAAC;KAChH,CAAC,CAAC,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IACnD,KAAK,EAAE,kBAAkB,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAClE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,uBAAuB,CAAC,CAAC,QAAQ,CAAC,wCAAwC,CAAC;IAC7G;;;;;;;OAOG;IACH,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,0BAA0B,CAAC,eAAe,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,4LAA4L,CAAC;IAC1S;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,qBAAqB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uQAAuQ,CAAC;IACvU,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC,0CAA0C,CAAC;CAC7F,CAAC,CAAC","sourcesContent":["/**\n * Billing Supporting Types (Shared)\n *\n * Types used by the billing API, frontend hooks, and provider interface.\n * These are NOT DB schemas — they are API response shapes, provider abstractions,\n * and aggregated views.\n *\n * @see billing-and-features-system.md §6.2c (Supporting Types)\n */\n\nimport { z } from 'zod';\nimport type { MoneyValue } from '@wildo-ai/zod-decorators';\nimport type { BillingTiming } from './billing-enums.shared.schemas';\nimport { BillingAccountSchema } from './billing-account.shared.schemas';\nimport { BillingSubscriptionBaseSchema } from './subscription.shared.schemas';\nimport { ProductSchema } from './product.shared.schemas';\nimport { PriceSchema } from './price.shared.schemas';\nimport { InvoiceRefSchema } from './invoice-ref.shared.schemas';\nimport { PromotionSchema } from './promotions.shared.schemas';\nimport { ResourcePrimaryScope } from '../resources/resources.shared.schemas';\nimport { CoreResourceType } from '../resources/resources.shared.core.definitions';\nimport { markEmbeddedResourceSchema } from '../resources/embedded-resource-mark.shared.utils';\n\n// ── Provider Canonical Types ───────────────────────────────────────\n// StandardBilling_SubscriptionData and StandardBilling_InvoicePreview are\n// defined in @wildo-ai/external-connectors-models (standard billing interface)\n// and re-exported here for convenience.\nexport type { StandardBilling_SubscriptionData, StandardBilling_InvoicePreview } from '@wildo-ai/external-connectors-models';\n\n// ── Invoice Preview ────────────────────────────────────────────────\n\n/**\n * Presentation value used by the billing plan-change preview. BillingContext transports the\n * provider DTO; the plan-change flow converts its minor-unit amounts into this money shape.\n * Invoice amount due must not be presented as an immediate charge without the resolved settlement policy.\n *\n * All monetary amounts use MoneyValue for bigint precision and self-contained currency.\n */\nexport interface InvoicePreview {\n /** Previewed invoice amount due; settlement timing must be stated separately. */\n amount: MoneyValue;\n /** Line items breakdown (what changed, prorated amounts) */\n lineItems: Array<{\n description: string;\n amount: MoneyValue;\n quantity: number;\n }>;\n /** Invoice period boundaries, not a guaranteed charge time. */\n periodStart: Date;\n periodEnd: Date;\n /**\n * When the change takes effect (#1868): `immediate`, or `at_period_end` — then the previewed invoice is the renewal invoice on the\n * new plan, and confirming charges nothing now.\n */\n timing: BillingTiming;\n /** When the change takes effect: now, or the end of the current period. */\n effectiveAt: Date;\n}\n\n// ── Usage Summary ──────────────────────────────────────────────────\n\n/**\n * Usage summary: aggregated usage data for the frontend UsageDashboard.\n * Computed from UsageRecords, keyed by metered product key.\n *\n * Authored as a Zod schema (not a bare interface) so it can compose into\n * `BillingStateResponseSchema` — the runtime contract wired as the `GET_STATE`\n * custom operation's `customResponseDto`. `UsageSummary` is derived from it to\n * keep the type and the runtime shape from drifting.\n */\nexport const UsageSummarySchema = z.object({\n /** Usage per metered product, keyed by product key */\n byProduct: z.record(\n z.string(),\n z.object({\n currentPeriodUsage: z.number().describe(\"Usage recorded in the current billing period.\"),\n /** Previous period (for trend display) */\n previousPeriodUsage: z.number().optional().describe(\"Usage recorded in the previous billing period.\"),\n /** Usage limit (from product/subscription, if applicable) */\n limit: z.number().optional().describe(\"The usage limit set by the product or subscription, when one applies.\"),\n /** Last usage recorded at */\n lastRecordedAt: z.date().optional().describe(\"When usage was last recorded.\"),\n }),\n ).describe(\"Usage per metered product, keyed by product key.\"),\n});\nexport type UsageSummary = z.infer<typeof UsageSummarySchema>;\n\n// ── Billing State Response ─────────────────────────────────────────\n\n/**\n * Per-pool credit balance projection embedded in the aggregated billing state.\n *\n * A lean view (NOT the full `CreditPool` resource) built by the billing-state\n * facade purely for the frontend balance display, keyed by pool key.\n */\nexport const CreditPoolBalanceSchema = z.object({\n available: z.number().describe(\"Credits available to spend.\"),\n totalPurchased: z.number().describe(\"Credits purchased in total.\"),\n totalGranted: z.number().describe(\"Credits given without a purchase in total, such as referral rewards.\"),\n totalConsumed: z.number().describe(\"Credits consumed in total.\"),\n});\nexport type CreditPoolBalance = z.infer<typeof CreditPoolBalanceSchema>;\n\n/**\n * Aggregated billing state returned by the lazy facade endpoint.\n * Single source of truth for frontend BillingProvider and backend controller.\n *\n * Authored as a Zod schema (not a bare interface) because the `GET_STATE`\n * custom operation wires it as its `customResponseDto`. That operation borrows\n * the COUNT verb for its route/verb via `resourceOperationLike` but returns\n * THIS aggregated shape — so without a `customResponseDto` the DTO builder would\n * assign it the COUNT default envelope (`{ count }`), and the service output\n * would fail `transformOutput`'s `internalDto.parse` → HTTP 500. The composed\n * schema gives the builder the real runtime contract to validate against and to\n * project the external response. `BillingStateResponse` is derived from it so the\n * type and the runtime contract cannot drift.\n */\n/** Independently loaded portions of the aggregate. Derived catalog projections use PRODUCTS. */\nexport enum BillingStateSlice {\n BILLING_ACCOUNT = 'billingAccount',\n SUBSCRIPTION = 'subscription',\n PRODUCTS = 'products',\n PRICES = 'prices',\n INVOICES = 'invoices',\n USAGE = 'usage',\n CREDIT_POOLS = 'creditPools',\n ACTIVE_PROMOTIONS = 'activePromotions',\n}\n\n/** Empty data is meaningful only when its query (and required dependencies) succeeded. */\nexport enum BillingSliceAvailability {\n AVAILABLE = 'available',\n UNAVAILABLE = 'unavailable',\n}\n\nexport const BillingStateAvailabilitySchema = z.record(z.enum(BillingStateSlice), z.enum(BillingSliceAvailability));\nexport type BillingStateAvailability = z.infer<typeof BillingStateAvailabilitySchema>;\n\nexport const BillingStateResponseSchema = z.object({\n /** Query failures keep their empty transport placeholders but MUST NOT be presented as absence. */\n availability: BillingStateAvailabilitySchema.describe(\"Whether each part of this response loaded. A part marked `unavailable` failed to load: its empty value means nothing, and must not be read as absence.\"),\n billingAccount: BillingAccountSchema.nullable().describe(\"The billing account of the caller's scope, or `null` when the scope has none.\"),\n // The subscription and the invoice refs are not marked as embedded records like the products below: which resource\n // they are depends on the caller's scope. So the few fields no other source describes here are described in place\n // (#1625), rather than on the base schemas, where they would replace each resource's own, richer description.\n subscription: BillingSubscriptionBaseSchema.extend({\n status: BillingSubscriptionBaseSchema.shape.status.describe(\"The subscription's lifecycle state as the billing provider reports it, such as `active`, `trialing` or `past_due`.\"),\n }).nullable().describe(\"The scope's current subscription, or `null` when it has none.\"),\n // Products, prices and promotions are each one resource's records, described by that resource (#1625).\n products: z.array(markEmbeddedResourceSchema(ProductSchema, CoreResourceType.PRODUCTS)).describe(\"Every product visible in this scope, including ones no longer on sale, so a plan someone already holds can still be named. Which of them can be acquired now is `acquirableProductKeys`.\"),\n prices: z.array(markEmbeddedResourceSchema(PriceSchema, CoreResourceType.PRICES)).describe(\"The prices visible in this scope.\"),\n invoices: z.array(InvoiceRefSchema.extend({\n status: InvoiceRefSchema.shape.status.describe(\"The invoice's payment state as the billing provider reports it, such as `open`, `paid` or `void`.\"),\n total: InvoiceRefSchema.shape.total.describe('The invoice total: an amount in minor units, with its currency.'),\n })).describe(\"References to the scope's invoices.\"),\n usage: UsageSummarySchema.describe(\"Metered usage in this scope.\"),\n creditPools: z.record(z.string(), CreditPoolBalanceSchema).describe(\"Credit balances, keyed by credit pool.\"),\n /**\n * Scope/product-visible promotions for the current billing surface.\n *\n * This list intentionally excludes promotions that are inactive, exhausted,\n * unsynced with the billing provider, or targeted only at products outside the\n * current scope. It is not a promise that every entry is redeemable for any\n * arbitrary checkout item the user might pick next.\n */\n activePromotions: z.array(markEmbeddedResourceSchema(PromotionSchema, CoreResourceType.PROMOTIONS)).describe(\"Promotions visible in this scope: active, not exhausted, synced with the billing provider, and targeting a product in scope. Not a promise that each one applies to a particular checkout.\"),\n /**\n * The subset of `products` (by `key`) a caller may ACQUIRE right now — buy, or move a\n * subscription onto.\n *\n * ## Why a sibling key set rather than a filter on `products`\n *\n * One call serves two surfaces that want OPPOSITE things from it. An acquisition surface (a\n * pricing table) must not offer a plan the purchase gate will refuse; a holding surface (the\n * \"your current plan\" panel, the subscription-item → product resolution in the frontend billing\n * context) must still be able to NAME a plan the catalogue has withdrawn, because a customer\n * already on a retired plan is exactly who needs to see what they hold. Filtering `products` by\n * `isActive` would serve the first and break the second — the same trade the `REMOVE_ADDON` call\n * site settles by reading with `REFERENCE` intent rather than `ACQUIRE`.\n *\n * So the response DISTINGUISHES instead of filtering: `products` stays the full scope-visible\n * catalog, and this set states which of them acquisition may offer.\n *\n * ## Why the server answers it at all\n *\n * `Product.isActive` is the declared off-boarding path, and the backend gate that makes\n * retirement TRUE (`readProductByKey` with `ACQUIRE` intent) applies ONE predicate to it. A\n * listing surface holds rows, not keys, so it cannot use that reader — and every listing left to\n * itself re-derives the rule from the raw column. That had already happened twice by 2026-09-09,\n * in a frontend component and in the reader, agreeing only by luck. This set is computed by the\n * gate's own predicate, so a surface that reads it cannot drift from what checkout will accept.\n *\n * NOT a visibility answer: `isPublic` is a per-surface decision the server cannot take for every\n * caller (a back-office catalog shows non-public rows). A customer pricing table composes the\n * two; it must not re-spell either.\n *\n * The aggregate producer sets this field and BillingContext preserves it. Consumers\n * must check PRODUCTS availability before interpreting this projection: an empty set\n * from an unavailable catalog does not prove that nothing can be acquired.\n *\n * Absence therefore means \"the producer did not project acquirability\", never \"nothing is\n * acquirable\" and never \"everything is\". A consumer that receives the set MUST use it in\n * preference to re-deriving the rule; a consumer that does not is on the older, weaker footing\n * this field exists to retire.\n */\n acquirableProductKeys: z.array(z.string()).optional().describe(\"The keys of the products in `products` that may be bought, or moved onto, right now. Absent means this was not computed, not that nothing can be acquired. Check `availability` for products first: from a catalog that failed to load, an empty list proves nothing.\"),\n scopeType: z.enum(ResourcePrimaryScope).describe(\"The scope this billing state belongs to.\"),\n});\nexport type BillingStateResponse = z.infer<typeof BillingStateResponseSchema>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"credit-pool.shared.resources-config.schemas.d.ts","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,EAAoB,MAAM,gDAAgD,CAAC;AAQzG,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,oBAAY,qBAAqB;IAC/B;gEAC4D;IAC5D,OAAO,YAAY;IACnB;8GAC0G;IAC1G,MAAM,WAAW;CAClB;AAID,eAAO,MAAM,4BAA4B;;iBAEvC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;iBAOrC,CAAC;AAEH,eAAO,MAAM,+BAA+B,wQA+J3C,CAAC"}
1
+ {"version":3,"file":"credit-pool.shared.resources-config.schemas.d.ts","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,EAAoB,MAAM,gDAAgD,CAAC;AAQzG,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,oBAAY,qBAAqB;IAC/B;gEAC4D;IAC5D,OAAO,YAAY;IACnB;8GAC0G;IAC1G,MAAM,WAAW;CAClB;AAID,eAAO,MAAM,4BAA4B;;iBAEvC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;iBAOrC,CAAC;AAEH,eAAO,MAAM,+BAA+B,wQA+J3C,CAAC"}
@@ -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,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,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,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,C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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,2BAA2B,CAAC;wBACxG,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,2BAA2B,CAAC;qBAChG;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 { CreditPoolTopUpSource } from './billing-enums.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 * Whether the credits were bought or given (#1802). A purchase counts toward `totalPurchased`, a grant\n * toward `totalGranted`; both add to `available`. Defaults to `purchase`, the credit-pack checkout.\n */\n source: z.enum(CreditPoolTopUpSource).default(CreditPoolTopUpSource.PURCHASE).systemEnum('CreditPoolTopUpSource'),\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: {\n exportSubject: ResourceSystemAccessMode.ALLOWED,\n // A referral credit (#1802) is granted to an account that may never have bought a pack, so its pool is created\n // by the referral program — a trusted in-process write with no request, whose scope FK comes from the account.\n create: ResourceSystemAccessMode.ALLOWED,\n },\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, CORE_ORG_ROLES.ORG_BILLING_PROVIDER_EVENTS],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER, CORE_APP_ROLES.APP_BILLING_PROVIDER_EVENTS],\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, CORE_ORG_ROLES.ORG_BILLING_PROVIDER_EVENTS],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER, CORE_APP_ROLES.APP_BILLING_PROVIDER_EVENTS],\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, CORE_ORG_ROLES.ORG_BILLING_PROVIDER_EVENTS],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER, CORE_APP_ROLES.APP_BILLING_PROVIDER_EVENTS],\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.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,2BAA2B,CAAC;wBACxG,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,2BAA2B,CAAC;qBAChG;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 { CreditPoolTopUpSource } from './billing-enums.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 * Whether the credits were bought or given (#1802). A purchase counts toward `totalPurchased`, a grant\n * toward `totalGranted`; both add to `available`. Defaults to `purchase`, the credit-pack checkout.\n */\n source: z.enum(CreditPoolTopUpSource).default(CreditPoolTopUpSource.PURCHASE).systemEnum('CreditPoolTopUpSource'),\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: {\n exportSubject: ResourceSystemAccessMode.ALLOWED,\n // A referral credit (#1802) is granted to an account that may never have bought a pack, so its pool is created\n // by the referral program — a trusted in-process write with no request, whose scope FK comes from the account.\n create: ResourceSystemAccessMode.ALLOWED,\n },\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, CORE_ORG_ROLES.ORG_BILLING_PROVIDER_EVENTS],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER, CORE_APP_ROLES.APP_BILLING_PROVIDER_EVENTS],\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, CORE_ORG_ROLES.ORG_BILLING_PROVIDER_EVENTS],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER, CORE_APP_ROLES.APP_BILLING_PROVIDER_EVENTS],\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, CORE_ORG_ROLES.ORG_BILLING_PROVIDER_EVENTS],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER, CORE_APP_ROLES.APP_BILLING_PROVIDER_EVENTS],\n },\n riskLevel: ResourceOperationRiskLevel.MEDIUM,\n resourceOperationLike: CoreResourceOperation.UPDATE,\n requestDto: CreditPool_TopUpRequestDto,\n }],\n },\n },\n },\n);\n"]}
@@ -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;AAIxB,eAAO,MAAM,gBAAgB;;;;;;;;;;iBA8B3B,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;;;;;;;;;;iBA8B3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D,eAAO,MAAM,iCAAiC;;;;;;;;;;kBAU5C,CAAC"}
@@ -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,yBAAyB,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AAC/H,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAErG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE;IACrC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;IAEvM,kGAAkG;IAClG,OAAO,EAAE,CAAC,CAAC,MAA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,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().describe(\"The id of the billing account that holds these credits.\"),\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 /**\n * Total credits ever GIVEN rather than bought — a referral reward, for instance (#1802). Kept apart from\n * `totalPurchased` so the pool still answers what was sold: `available` is `totalPurchased + totalGranted\n * - totalConsumed`.\n */\n totalGranted: z.number().min(0).default(0).isSummaryField().isNotEditable().describe('Credits given to the account without a purchase, such as a referral reward. Counted apart from purchased credits.'),\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"]}
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,yBAAyB,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AAC/H,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAErG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE;IACrC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;IAEvM,kGAAkG;IAClG,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,cAAc,EAAE,CAAC,aAAa,EAAE;SACtE,QAAQ,CAAC,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAC;IAEjD,gCAAgC;IAChC,iGAAiG;IACjG,gDAAgD;IAChD,mGAAmG;IACnG,oGAAoG;IACpG,qGAAqG;IACrG,sGAAsG;IACtG,0BAA0B;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,aAAa,EAAE;IACxE,uDAAuD;IACvD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,aAAa,EAAE;IAC7E;;;;OAIG;IACH,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,mHAAmH,CAAC;IACzM,iDAAiD;IACjD,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().describe(\"The id of the billing account that holds these credits.\"),\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 /**\n * Total credits ever GIVEN rather than bought — a referral reward, for instance (#1802). Kept apart from\n * `totalPurchased` so the pool still answers what was sold: `available` is `totalPurchased + totalGranted\n * - totalConsumed`.\n */\n totalGranted: z.number().min(0).default(0).isSummaryField().isNotEditable().describe('Credits given to the account without a purchase, such as a referral reward. Counted apart from purchased credits.'),\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"]}
@@ -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;AAYzG,eAAO,MAAM,+BAA+B,oRAwH3C,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"}
@@ -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,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,EAAE;QACf,IAAI,EAAE,oBAAoB,CAAC,wBAAwB;KACpD;IAED;;;;OAIG;IACH,iBAAiB,EAAE,EAAE,IAAI,EAAE,uBAAuB,CAAC,YAAY,EAAE;IAEjE,cAAc,EAAE;QACd,qBAAqB,CAAC,IAAI;QAC1B,qBAAqB,CAAC,IAAI;QAC1B,qBAAqB,CAAC,MAAM;QAC5B,qBAAqB,CAAC,MAAM;QAC5B,qBAAqB,CAAC,MAAM;QAC5B,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AAa,CAAC,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,2BAA2B,CAAC;wBAClI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,2BAA2B,CAAC;qBAChG;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, CORE_ORG_ROLES.ORG_BILLING_PROVIDER_EVENTS],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER, CORE_APP_ROLES.APP_BILLING_PROVIDER_EVENTS],\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, CORE_ORG_ROLES.ORG_BILLING_PROVIDER_EVENTS],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER, CORE_APP_ROLES.APP_BILLING_PROVIDER_EVENTS],\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, CORE_ORG_ROLES.ORG_BILLING_PROVIDER_EVENTS],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER, CORE_APP_ROLES.APP_BILLING_PROVIDER_EVENTS],\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,EA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,CAAC,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,2BAA2B,CAAC;qBAChG;oBACD,SAAS,EAAE,0BAA0B,CAAC,GAAG;iBAC1C,CAAC;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,EAAE,cAAc,CAAC,2BAA2B,CAAC;wBAClI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,2BAA2B,CAAC;qBAChG;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, CORE_ORG_ROLES.ORG_BILLING_PROVIDER_EVENTS],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER, CORE_APP_ROLES.APP_BILLING_PROVIDER_EVENTS],\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, CORE_ORG_ROLES.ORG_BILLING_PROVIDER_EVENTS],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER, CORE_APP_ROLES.APP_BILLING_PROVIDER_EVENTS],\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, CORE_ORG_ROLES.ORG_BILLING_PROVIDER_EVENTS],\n [CoreResourceType.USERS]: [CORE_APP_ROLES.APP_USER, CORE_APP_ROLES.APP_BILLING_PROVIDER_EVENTS],\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;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"}
1
+ {"version":3,"file":"invoice-ref.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/invoice-ref.shared.schemas.ts"],"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AAgB,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().describe(\"The id of the billing account this invoice was issued to.\"),\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
+ {"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,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,cAAc,EAAE;IACtD,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,2DAA2D,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AgB,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().describe(\"The id of the billing account this invoice was issued to.\"),\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.resources-config.schemas.d.ts","sourceRoot":"","sources":["../../../src/billing/price.shared.resources-config.schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,qBAAqB,EAAwD,MAAM,gDAAgD,CAAC;AAC7I,OAAO,EAGL,oBAAoB,EACrB,MAAM,uCAAuC,CAAC;AAI/C,KAAK,aAAa,GACd,qBAAqB,CAAC,IAAI,GAC1B,qBAAqB,CAAC,IAAI,GAC1B,qBAAqB,CAAC,MAAM,GAC5B,qBAAqB,CAAC,MAAM,GAC5B,qBAAqB,CAAC,MAAM,CAAC;AAEjC,eAAO,MAAM,iDAAiD,GAC5D,wBAAwB,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;iCAoG9C,CAAC"}
1
+ {"version":3,"file":"price.shared.resources-config.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/price.shared.resources-config.schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,qBAAqB,EAAwD,MAAM,gDAAgD,CAAC;AAC7I,OAAO,EAGL,oBAAoB,EACrB,MAAM,uCAAuC,CAAC;AAI/C,KAAK,aAAa,GACd,qBAAqB,CAAC,IAAI,GAC1B,qBAAqB,CAAC,IAAI,GAC1B,qBAAqB,CAAC,MAAM,GAC5B,qBAAqB,CAAC,MAAM,GAC5B,qBAAqB,CAAC,MAAM,CAAC;AAEjC,eAAO,MAAM,iDAAiD,GAC5D,wBAAwB,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;iCAoG9C,CAAC"}