@wildo-ai/saas-specifications 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. package/dist/esm/_core/brand/brand-asset.schemas.d.ts +4 -6
  2. package/dist/esm/_core/brand/brand-asset.schemas.d.ts.map +1 -1
  3. package/dist/esm/_core/brand/brand-asset.schemas.js +4 -12
  4. package/dist/esm/_core/brand/brand-asset.schemas.js.map +1 -1
  5. package/dist/esm/_core/brand/brand-generation.schemas.d.ts +5 -3
  6. package/dist/esm/_core/brand/brand-generation.schemas.d.ts.map +1 -1
  7. package/dist/esm/_core/brand/brand-generation.schemas.js +5 -2
  8. package/dist/esm/_core/brand/brand-generation.schemas.js.map +1 -1
  9. package/dist/esm/_core/brand/brand-snapshot.schemas.d.ts +10 -3
  10. package/dist/esm/_core/brand/brand-snapshot.schemas.d.ts.map +1 -1
  11. package/dist/esm/_core/brand/brand-snapshot.schemas.js +10 -2
  12. package/dist/esm/_core/brand/brand-snapshot.schemas.js.map +1 -1
  13. package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.d.ts.map +1 -1
  14. package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.js +15 -5
  15. package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.js.map +1 -1
  16. package/dist/esm/_core/build-plan/build-plan-task-graph-validation.d.ts +40 -3
  17. package/dist/esm/_core/build-plan/build-plan-task-graph-validation.d.ts.map +1 -1
  18. package/dist/esm/_core/build-plan/build-plan-task-graph-validation.js +85 -6
  19. package/dist/esm/_core/build-plan/build-plan-task-graph-validation.js.map +1 -1
  20. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.d.ts.map +1 -1
  21. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.js +10 -4
  22. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.js.map +1 -1
  23. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.d.ts +15 -0
  24. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.d.ts.map +1 -1
  25. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.js.map +1 -1
  26. package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.d.ts +10 -0
  27. package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.d.ts.map +1 -1
  28. package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.js +17 -0
  29. package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.js.map +1 -1
  30. package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.d.ts +6 -7
  31. package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.d.ts.map +1 -1
  32. package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.js +6 -13
  33. package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.js.map +1 -1
  34. package/dist/esm/_core/expert-personas/expert-persona-validation.d.ts +0 -11
  35. package/dist/esm/_core/expert-personas/expert-persona-validation.d.ts.map +1 -1
  36. package/dist/esm/_core/expert-personas/expert-persona-validation.js +0 -19
  37. package/dist/esm/_core/expert-personas/expert-persona-validation.js.map +1 -1
  38. package/dist/esm/_core/expert-personas/expert-role-template.schemas.d.ts +1 -2
  39. package/dist/esm/_core/expert-personas/expert-role-template.schemas.d.ts.map +1 -1
  40. package/dist/esm/_core/expert-personas/expert-role-template.schemas.js +1 -2
  41. package/dist/esm/_core/expert-personas/expert-role-template.schemas.js.map +1 -1
  42. package/dist/esm/_core/feature-drafts/feature-specification-drafts-generation.schemas.d.ts.map +1 -1
  43. package/dist/esm/_core/feature-drafts/feature-specification-drafts-generation.schemas.js +17 -4
  44. package/dist/esm/_core/feature-drafts/feature-specification-drafts-generation.schemas.js.map +1 -1
  45. package/dist/esm/_core/index.d.ts +1 -0
  46. package/dist/esm/_core/index.d.ts.map +1 -1
  47. package/dist/esm/_core/index.js +1 -0
  48. package/dist/esm/_core/index.js.map +1 -1
  49. package/dist/esm/_core/market/market-snapshot-generation.schemas.d.ts.map +1 -1
  50. package/dist/esm/_core/market/market-snapshot-generation.schemas.js +5 -40
  51. package/dist/esm/_core/market/market-snapshot-generation.schemas.js.map +1 -1
  52. package/dist/esm/_core/market/market-snapshot-validation.d.ts +15 -0
  53. package/dist/esm/_core/market/market-snapshot-validation.d.ts.map +1 -1
  54. package/dist/esm/_core/market/market-snapshot-validation.js.map +1 -1
  55. package/dist/esm/_core/placement-plan/placement-plan-generation.schemas.d.ts.map +1 -1
  56. package/dist/esm/_core/placement-plan/placement-plan-generation.schemas.js +11 -5
  57. package/dist/esm/_core/placement-plan/placement-plan-generation.schemas.js.map +1 -1
  58. package/dist/esm/_core/placement-plan/placement-plan-validation.d.ts +66 -9
  59. package/dist/esm/_core/placement-plan/placement-plan-validation.d.ts.map +1 -1
  60. package/dist/esm/_core/placement-plan/placement-plan-validation.js +62 -20
  61. package/dist/esm/_core/placement-plan/placement-plan-validation.js.map +1 -1
  62. package/dist/esm/_core/placement-plan/placement-plan.schemas.d.ts +4 -1
  63. package/dist/esm/_core/placement-plan/placement-plan.schemas.d.ts.map +1 -1
  64. package/dist/esm/_core/placement-plan/placement-plan.schemas.js +4 -1
  65. package/dist/esm/_core/placement-plan/placement-plan.schemas.js.map +1 -1
  66. package/dist/esm/_core/provider-specification.schemas.d.ts +82 -0
  67. package/dist/esm/_core/provider-specification.schemas.d.ts.map +1 -0
  68. package/dist/esm/_core/provider-specification.schemas.js +144 -0
  69. package/dist/esm/_core/provider-specification.schemas.js.map +1 -0
  70. package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.d.ts.map +1 -1
  71. package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.js +13 -8
  72. package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.js.map +1 -1
  73. package/dist/esm/_core/requirements/requirements-snapshot-validation.d.ts +15 -0
  74. package/dist/esm/_core/requirements/requirements-snapshot-validation.d.ts.map +1 -1
  75. package/dist/esm/_core/requirements/requirements-snapshot-validation.js.map +1 -1
  76. package/dist/esm/_core/roadmap/roadmap-snapshot-generation.schemas.d.ts.map +1 -1
  77. package/dist/esm/_core/roadmap/roadmap-snapshot-generation.schemas.js +7 -2
  78. package/dist/esm/_core/roadmap/roadmap-snapshot-generation.schemas.js.map +1 -1
  79. package/dist/esm/_core/roadmap/roadmap-snapshot-validation.d.ts +15 -0
  80. package/dist/esm/_core/roadmap/roadmap-snapshot-validation.d.ts.map +1 -1
  81. package/dist/esm/_core/roadmap/roadmap-snapshot-validation.js.map +1 -1
  82. package/dist/esm/_core/utils/family-ref-stamping.d.ts +64 -0
  83. package/dist/esm/_core/utils/family-ref-stamping.d.ts.map +1 -0
  84. package/dist/esm/_core/utils/family-ref-stamping.js +73 -0
  85. package/dist/esm/_core/utils/family-ref-stamping.js.map +1 -0
  86. package/dist/esm/_core/vision/vision-snapshot-generation.schemas.d.ts.map +1 -1
  87. package/dist/esm/_core/vision/vision-snapshot-generation.schemas.js +23 -9
  88. package/dist/esm/_core/vision/vision-snapshot-generation.schemas.js.map +1 -1
  89. package/dist/esm/application-creation/application-coding-tasks.application-creation.schemas.d.ts +0 -4
  90. package/dist/esm/application-creation/application-coding-tasks.application-creation.schemas.d.ts.map +1 -1
  91. package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.d.ts +7 -7
  92. package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.d.ts.map +1 -1
  93. package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.js +6 -7
  94. package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.js.map +1 -1
  95. package/dist/esm/application-creation/application-document-release-policy-specification.application-creation.schemas.d.ts +3 -3
  96. package/dist/esm/application-creation/application-document-release-policy-specification.application-creation.schemas.js +3 -3
  97. package/dist/esm/application-creation/application-document-release-policy-specification.application-creation.schemas.js.map +1 -1
  98. package/dist/esm/application-creation/application-specification-family-identity.application-creation.schemas.d.ts +2 -2
  99. package/dist/esm/application-creation/application-specification-family-identity.application-creation.schemas.js +2 -2
  100. package/dist/esm/application-creation/application-specification-family-identity.application-creation.schemas.js.map +1 -1
  101. package/dist/esm/application-creation/journey.application-creation.schemas.d.ts +18 -6
  102. package/dist/esm/application-creation/journey.application-creation.schemas.d.ts.map +1 -1
  103. package/dist/esm/application-creation/journey.application-creation.schemas.js +18 -6
  104. package/dist/esm/application-creation/journey.application-creation.schemas.js.map +1 -1
  105. package/dist/esm/application-creation/playbooks.application-creation.schemas.d.ts +8 -23
  106. package/dist/esm/application-creation/playbooks.application-creation.schemas.d.ts.map +1 -1
  107. package/dist/esm/application-creation/playbooks.application-creation.schemas.js +57 -27
  108. package/dist/esm/application-creation/playbooks.application-creation.schemas.js.map +1 -1
  109. package/dist/esm/assurance/application-document-publication.schemas.d.ts +20 -6
  110. package/dist/esm/assurance/application-document-publication.schemas.d.ts.map +1 -1
  111. package/dist/esm/assurance/application-document-publication.schemas.js +26 -10
  112. package/dist/esm/assurance/application-document-publication.schemas.js.map +1 -1
  113. package/dist/esm/assurance/assurance-authority-basis.definitions.d.ts +72 -49
  114. package/dist/esm/assurance/assurance-authority-basis.definitions.d.ts.map +1 -1
  115. package/dist/esm/assurance/assurance-authority-basis.definitions.js +161 -60
  116. package/dist/esm/assurance/assurance-authority-basis.definitions.js.map +1 -1
  117. package/dist/esm/assurance/assurance-authority-basis.schemas.d.ts +25 -0
  118. package/dist/esm/assurance/assurance-authority-basis.schemas.d.ts.map +1 -1
  119. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.d.ts +36 -0
  120. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.d.ts.map +1 -0
  121. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.js +859 -0
  122. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.js.map +1 -0
  123. package/dist/esm/assurance/assurance-foundation.schemas.d.ts +43 -0
  124. package/dist/esm/assurance/assurance-foundation.schemas.d.ts.map +1 -1
  125. package/dist/esm/assurance/assurance-foundation.schemas.js +56 -0
  126. package/dist/esm/assurance/assurance-foundation.schemas.js.map +1 -1
  127. package/dist/esm/assurance/assurance-objective-catalog.definitions.d.ts +14 -7
  128. package/dist/esm/assurance/assurance-objective-catalog.definitions.d.ts.map +1 -1
  129. package/dist/esm/assurance/assurance-objective-catalog.definitions.js +24 -7
  130. package/dist/esm/assurance/assurance-objective-catalog.definitions.js.map +1 -1
  131. package/dist/esm/assurance/assurance-program-generation.schemas.d.ts +8 -1
  132. package/dist/esm/assurance/assurance-program-generation.schemas.d.ts.map +1 -1
  133. package/dist/esm/assurance/assurance-program-generation.schemas.js +10 -2
  134. package/dist/esm/assurance/assurance-program-generation.schemas.js.map +1 -1
  135. package/dist/esm/assurance/assurance-program.schemas.d.ts +447 -11
  136. package/dist/esm/assurance/assurance-program.schemas.d.ts.map +1 -1
  137. package/dist/esm/assurance/assurance-program.schemas.js +293 -5
  138. package/dist/esm/assurance/assurance-program.schemas.js.map +1 -1
  139. package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.d.ts +35 -0
  140. package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.d.ts.map +1 -0
  141. package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.js +999 -0
  142. package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.js.map +1 -0
  143. package/dist/esm/companion-exports.d.ts +7 -6
  144. package/dist/esm/companion-exports.d.ts.map +1 -1
  145. package/dist/esm/companion-exports.js.map +1 -1
  146. package/dist/esm/engine/_bootstrap.js +3 -1
  147. package/dist/esm/engine/_bootstrap.js.map +1 -1
  148. package/dist/esm/engine/applications/resources/application-api-keys.resource.specification.d.ts.map +1 -1
  149. package/dist/esm/engine/applications/resources/application-api-keys.resource.specification.js +13 -1
  150. package/dist/esm/engine/applications/resources/application-api-keys.resource.specification.js.map +1 -1
  151. package/dist/esm/engine/applications/resources/application-metadata.resource.specification.js +1 -1
  152. package/dist/esm/engine/applications/resources/application-metadata.resource.specification.js.map +1 -1
  153. package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.d.ts +2 -0
  154. package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.d.ts.map +1 -1
  155. package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.js +14 -2
  156. package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.js.map +1 -1
  157. package/dist/esm/engine/applications/resources/application-versions.resource.specification.js +9 -9
  158. package/dist/esm/engine/applications/resources/application-versions.resource.specification.js.map +1 -1
  159. package/dist/esm/engine/applications/resources/applications.resource.specification.js +1 -1
  160. package/dist/esm/engine/applications/resources/applications.resource.specification.js.map +1 -1
  161. package/dist/esm/engine/auth/resources/consumable-tokens.resource.specification.js +3 -3
  162. package/dist/esm/engine/auth/resources/consumable-tokens.resource.specification.js.map +1 -1
  163. package/dist/esm/engine/auth/resources/oauth-consent-grants.resource.specification.js +1 -1
  164. package/dist/esm/engine/auth/resources/oauth-consent-grants.resource.specification.js.map +1 -1
  165. package/dist/esm/engine/auth/resources/organization-api-keys.resource.specification.d.ts.map +1 -1
  166. package/dist/esm/engine/auth/resources/organization-api-keys.resource.specification.js +13 -1
  167. package/dist/esm/engine/auth/resources/organization-api-keys.resource.specification.js.map +1 -1
  168. package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.d.ts +2 -0
  169. package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.d.ts.map +1 -1
  170. package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.js +14 -2
  171. package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.js.map +1 -1
  172. package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.d.ts +32 -0
  173. package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.d.ts.map +1 -0
  174. package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.js +308 -0
  175. package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.js.map +1 -0
  176. package/dist/esm/engine/auth/resources/platform-access-grants.resource.specification.js +4 -4
  177. package/dist/esm/engine/auth/resources/platform-access-grants.resource.specification.js.map +1 -1
  178. package/dist/esm/engine/auth/resources/scim-provisioning-config.resource.specification.js +2 -2
  179. package/dist/esm/engine/auth/resources/scim-provisioning-config.resource.specification.js.map +1 -1
  180. package/dist/esm/engine/auth/resources/scim-tokens.resource.specification.js +6 -6
  181. package/dist/esm/engine/auth/resources/scim-tokens.resource.specification.js.map +1 -1
  182. package/dist/esm/engine/auth/resources/siem-delivery-dlq.resource.specification.js +9 -9
  183. package/dist/esm/engine/auth/resources/siem-delivery-dlq.resource.specification.js.map +1 -1
  184. package/dist/esm/engine/auth/resources/siem-export-config.resource.specification.js +2 -2
  185. package/dist/esm/engine/auth/resources/siem-export-config.resource.specification.js.map +1 -1
  186. package/dist/esm/engine/auth/resources/sso-config.resource.specification.d.ts +9 -25
  187. package/dist/esm/engine/auth/resources/sso-config.resource.specification.d.ts.map +1 -1
  188. package/dist/esm/engine/auth/resources/sso-config.resource.specification.js +104 -10
  189. package/dist/esm/engine/auth/resources/sso-config.resource.specification.js.map +1 -1
  190. package/dist/esm/engine/auth/resources/sso-connections.resource.specification.d.ts +0 -6
  191. package/dist/esm/engine/auth/resources/sso-connections.resource.specification.d.ts.map +1 -1
  192. package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.d.ts +32 -0
  193. package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.d.ts.map +1 -0
  194. package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.js +297 -0
  195. package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.js.map +1 -0
  196. package/dist/esm/engine/billing/resources/billing-accounts.resource.specification.d.ts.map +1 -1
  197. package/dist/esm/engine/billing/resources/billing-accounts.resource.specification.js +4 -3
  198. package/dist/esm/engine/billing/resources/billing-accounts.resource.specification.js.map +1 -1
  199. package/dist/esm/engine/billing/resources/credit-pools.resource.specification.js +2 -2
  200. package/dist/esm/engine/billing/resources/credit-pools.resource.specification.js.map +1 -1
  201. package/dist/esm/engine/billing/resources/invoice-refs.resource.specification.js +3 -3
  202. package/dist/esm/engine/billing/resources/invoice-refs.resource.specification.js.map +1 -1
  203. package/dist/esm/engine/billing/resources/prices.resource.specification.js +7 -7
  204. package/dist/esm/engine/billing/resources/prices.resource.specification.js.map +1 -1
  205. package/dist/esm/engine/billing/resources/products.resource.specification.js +7 -7
  206. package/dist/esm/engine/billing/resources/products.resource.specification.js.map +1 -1
  207. package/dist/esm/engine/billing/resources/promotions.resource.specification.d.ts.map +1 -1
  208. package/dist/esm/engine/billing/resources/promotions.resource.specification.js +14 -12
  209. package/dist/esm/engine/billing/resources/promotions.resource.specification.js.map +1 -1
  210. package/dist/esm/engine/billing/resources/referrals.resource.specification.js +7 -7
  211. package/dist/esm/engine/billing/resources/referrals.resource.specification.js.map +1 -1
  212. package/dist/esm/engine/billing/resources/subscriptions.resource.specification.d.ts.map +1 -1
  213. package/dist/esm/engine/billing/resources/subscriptions.resource.specification.js +6 -3
  214. package/dist/esm/engine/billing/resources/subscriptions.resource.specification.js.map +1 -1
  215. package/dist/esm/engine/billing/resources/usage-records.resource.specification.d.ts +7 -3
  216. package/dist/esm/engine/billing/resources/usage-records.resource.specification.d.ts.map +1 -1
  217. package/dist/esm/engine/billing/resources/usage-records.resource.specification.js +28 -11
  218. package/dist/esm/engine/billing/resources/usage-records.resource.specification.js.map +1 -1
  219. package/dist/esm/engine/compliance/resources/audit-logs.resource.specification.js +8 -8
  220. package/dist/esm/engine/compliance/resources/audit-logs.resource.specification.js.map +1 -1
  221. package/dist/esm/engine/engine-resource-specifications.registry.d.ts +2 -2
  222. package/dist/esm/engine/engine-resource-specifications.registry.d.ts.map +1 -1
  223. package/dist/esm/engine/engine-resource-specifications.registry.js +6 -2
  224. package/dist/esm/engine/engine-resource-specifications.registry.js.map +1 -1
  225. package/dist/esm/engine/engine-resource-sub-domain.d.ts +20 -0
  226. package/dist/esm/engine/engine-resource-sub-domain.d.ts.map +1 -1
  227. package/dist/esm/engine/engine-resource-sub-domain.js +66 -0
  228. package/dist/esm/engine/engine-resource-sub-domain.js.map +1 -1
  229. package/dist/esm/engine/errors/error-messages.specification.d.ts.map +1 -1
  230. package/dist/esm/engine/errors/error-messages.specification.js +14 -0
  231. package/dist/esm/engine/errors/error-messages.specification.js.map +1 -1
  232. package/dist/esm/engine/features/audit-logs.feature.specification.js +4 -4
  233. package/dist/esm/engine/features/audit-logs.feature.specification.js.map +1 -1
  234. package/dist/esm/engine/features/core-limits.feature.specifications.js +7 -7
  235. package/dist/esm/engine/features/core-limits.feature.specifications.js.map +1 -1
  236. package/dist/esm/engine/features/resources/application-features.resource.specification.js +3 -3
  237. package/dist/esm/engine/features/resources/application-features.resource.specification.js.map +1 -1
  238. package/dist/esm/engine/features/resources/organization-features.resource.specification.js +3 -3
  239. package/dist/esm/engine/features/resources/organization-features.resource.specification.js.map +1 -1
  240. package/dist/esm/engine/features/resources/user-features.resource.specification.js +3 -3
  241. package/dist/esm/engine/features/resources/user-features.resource.specification.js.map +1 -1
  242. package/dist/esm/engine/files/resources/files.resource.specification.js +10 -10
  243. package/dist/esm/engine/files/resources/files.resource.specification.js.map +1 -1
  244. package/dist/esm/engine/flows-actors/resources/a2a-push-delivery-log.resource.specification.js +11 -11
  245. package/dist/esm/engine/flows-actors/resources/a2a-push-delivery-log.resource.specification.js.map +1 -1
  246. package/dist/esm/engine/flows-actors/resources/a2a-token-budget-state.resource.specification.js +4 -4
  247. package/dist/esm/engine/flows-actors/resources/a2a-token-budget-state.resource.specification.js.map +1 -1
  248. package/dist/esm/engine/flows-actors/resources/flow-actor-executions.resource.specification.js +2 -2
  249. package/dist/esm/engine/flows-actors/resources/flow-actor-executions.resource.specification.js.map +1 -1
  250. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.d.ts +5 -0
  251. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.d.ts.map +1 -0
  252. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.js +81 -0
  253. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.js.map +1 -0
  254. package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.d.ts +4 -0
  255. package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.d.ts.map +1 -0
  256. package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.js +22 -0
  257. package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.js.map +1 -0
  258. package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.d.ts +0 -4
  259. package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.d.ts.map +0 -1
  260. package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.js +0 -21
  261. package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.js.map +0 -1
  262. package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.d.ts +0 -4
  263. package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.d.ts.map +0 -1
  264. package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.js +0 -21
  265. package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.js.map +0 -1
  266. package/dist/esm/engine/frontend-components/index.d.ts +0 -2
  267. package/dist/esm/engine/frontend-components/index.d.ts.map +1 -1
  268. package/dist/esm/engine/frontend-components/index.js +4 -6
  269. package/dist/esm/engine/frontend-components/index.js.map +1 -1
  270. package/dist/esm/engine/guidance/resources/guidance-state.resource.specification.js +12 -12
  271. package/dist/esm/engine/guidance/resources/guidance-state.resource.specification.js.map +1 -1
  272. package/dist/esm/engine/guidance/resources/lifecycle-state.resource.specification.js +9 -9
  273. package/dist/esm/engine/guidance/resources/lifecycle-state.resource.specification.js.map +1 -1
  274. package/dist/esm/engine/guidance/resources/progression-state.resource.specification.d.ts +8 -0
  275. package/dist/esm/engine/guidance/resources/progression-state.resource.specification.d.ts.map +1 -1
  276. package/dist/esm/engine/guidance/resources/progression-state.resource.specification.js +6 -6
  277. package/dist/esm/engine/guidance/resources/progression-state.resource.specification.js.map +1 -1
  278. package/dist/esm/engine/index.d.ts +1 -0
  279. package/dist/esm/engine/index.d.ts.map +1 -1
  280. package/dist/esm/engine/index.js +1 -0
  281. package/dist/esm/engine/index.js.map +1 -1
  282. package/dist/esm/engine/infrastructure/resources/data-seed-runs.resource.specification.js +17 -17
  283. package/dist/esm/engine/infrastructure/resources/data-seed-runs.resource.specification.js.map +1 -1
  284. package/dist/esm/engine/infrastructure/resources/external-data-pipeline-states.resource.specification.js +7 -7
  285. package/dist/esm/engine/infrastructure/resources/external-data-pipeline-states.resource.specification.js.map +1 -1
  286. package/dist/esm/engine/infrastructure/resources/job-executions.resource.specification.js +8 -8
  287. package/dist/esm/engine/infrastructure/resources/job-executions.resource.specification.js.map +1 -1
  288. package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.d.ts +7 -2
  289. package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.d.ts.map +1 -1
  290. package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.js +10 -5
  291. package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.js.map +1 -1
  292. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.d.ts.map +1 -1
  293. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.js +20 -15
  294. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.js.map +1 -1
  295. package/dist/esm/engine/notifications/resources/notification-badges.resource.specification.d.ts.map +1 -1
  296. package/dist/esm/engine/notifications/resources/notification-badges.resource.specification.js +11 -10
  297. package/dist/esm/engine/notifications/resources/notification-badges.resource.specification.js.map +1 -1
  298. package/dist/esm/engine/notifications/resources/webhook-config.resource.specification.d.ts.map +1 -1
  299. package/dist/esm/engine/notifications/resources/webhook-config.resource.specification.js +29 -6
  300. package/dist/esm/engine/notifications/resources/webhook-config.resource.specification.js.map +1 -1
  301. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js +9 -9
  302. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js.map +1 -1
  303. package/dist/esm/engine/organizations/resources/organization-notifications.resource.specification.js +3 -3
  304. package/dist/esm/engine/organizations/resources/organization-notifications.resource.specification.js.map +1 -1
  305. package/dist/esm/engine/organizations/resources/organization-preferences.resource.specification.js +4 -4
  306. package/dist/esm/engine/organizations/resources/organization-preferences.resource.specification.js.map +1 -1
  307. package/dist/esm/engine/organizations/resources/organization-profiles.resource.specification.js +2 -2
  308. package/dist/esm/engine/organizations/resources/organization-profiles.resource.specification.js.map +1 -1
  309. package/dist/esm/engine/organizations/resources/organization-unit-members.resource.specification.js +1 -1
  310. package/dist/esm/engine/organizations/resources/organization-unit-members.resource.specification.js.map +1 -1
  311. package/dist/esm/engine/organizations/resources/organizations.resource.specification.js +7 -7
  312. package/dist/esm/engine/organizations/resources/organizations.resource.specification.js.map +1 -1
  313. package/dist/esm/engine/providers/_engine-provider-shared.d.ts +9 -0
  314. package/dist/esm/engine/providers/_engine-provider-shared.d.ts.map +1 -0
  315. package/dist/esm/engine/providers/_engine-provider-shared.js +19 -0
  316. package/dist/esm/engine/providers/_engine-provider-shared.js.map +1 -0
  317. package/dist/esm/engine/providers/anthropic.provider.specification.d.ts +7 -0
  318. package/dist/esm/engine/providers/anthropic.provider.specification.d.ts.map +1 -0
  319. package/dist/esm/engine/providers/anthropic.provider.specification.js +33 -0
  320. package/dist/esm/engine/providers/anthropic.provider.specification.js.map +1 -0
  321. package/dist/esm/engine/providers/apple.provider.specification.d.ts +7 -0
  322. package/dist/esm/engine/providers/apple.provider.specification.d.ts.map +1 -0
  323. package/dist/esm/engine/providers/apple.provider.specification.js +35 -0
  324. package/dist/esm/engine/providers/apple.provider.specification.js.map +1 -0
  325. package/dist/esm/engine/providers/email-preview.provider.specification.d.ts +7 -0
  326. package/dist/esm/engine/providers/email-preview.provider.specification.d.ts.map +1 -0
  327. package/dist/esm/engine/providers/email-preview.provider.specification.js +31 -0
  328. package/dist/esm/engine/providers/email-preview.provider.specification.js.map +1 -0
  329. package/dist/esm/engine/providers/github.provider.specification.d.ts +7 -0
  330. package/dist/esm/engine/providers/github.provider.specification.d.ts.map +1 -0
  331. package/dist/esm/engine/providers/github.provider.specification.js +30 -0
  332. package/dist/esm/engine/providers/github.provider.specification.js.map +1 -0
  333. package/dist/esm/engine/providers/google.provider.specification.d.ts +7 -0
  334. package/dist/esm/engine/providers/google.provider.specification.d.ts.map +1 -0
  335. package/dist/esm/engine/providers/google.provider.specification.js +34 -0
  336. package/dist/esm/engine/providers/google.provider.specification.js.map +1 -0
  337. package/dist/esm/engine/providers/grok.provider.specification.d.ts +7 -0
  338. package/dist/esm/engine/providers/grok.provider.specification.d.ts.map +1 -0
  339. package/dist/esm/engine/providers/grok.provider.specification.js +30 -0
  340. package/dist/esm/engine/providers/grok.provider.specification.js.map +1 -0
  341. package/dist/esm/engine/providers/index.d.ts +23 -0
  342. package/dist/esm/engine/providers/index.d.ts.map +1 -0
  343. package/dist/esm/engine/providers/index.js +37 -0
  344. package/dist/esm/engine/providers/index.js.map +1 -0
  345. package/dist/esm/engine/providers/microsoft.provider.specification.d.ts +7 -0
  346. package/dist/esm/engine/providers/microsoft.provider.specification.d.ts.map +1 -0
  347. package/dist/esm/engine/providers/microsoft.provider.specification.js +30 -0
  348. package/dist/esm/engine/providers/microsoft.provider.specification.js.map +1 -0
  349. package/dist/esm/engine/providers/mistral.provider.specification.d.ts +7 -0
  350. package/dist/esm/engine/providers/mistral.provider.specification.d.ts.map +1 -0
  351. package/dist/esm/engine/providers/mistral.provider.specification.js +33 -0
  352. package/dist/esm/engine/providers/mistral.provider.specification.js.map +1 -0
  353. package/dist/esm/engine/providers/openai.provider.specification.d.ts +7 -0
  354. package/dist/esm/engine/providers/openai.provider.specification.d.ts.map +1 -0
  355. package/dist/esm/engine/providers/openai.provider.specification.js +43 -0
  356. package/dist/esm/engine/providers/openai.provider.specification.js.map +1 -0
  357. package/dist/esm/engine/providers/opencode.provider.specification.d.ts +7 -0
  358. package/dist/esm/engine/providers/opencode.provider.specification.d.ts.map +1 -0
  359. package/dist/esm/engine/providers/opencode.provider.specification.js +50 -0
  360. package/dist/esm/engine/providers/opencode.provider.specification.js.map +1 -0
  361. package/dist/esm/engine/providers/perplexity.provider.specification.d.ts +7 -0
  362. package/dist/esm/engine/providers/perplexity.provider.specification.d.ts.map +1 -0
  363. package/dist/esm/engine/providers/perplexity.provider.specification.js +30 -0
  364. package/dist/esm/engine/providers/perplexity.provider.specification.js.map +1 -0
  365. package/dist/esm/engine/providers/resend.provider.specification.d.ts +7 -0
  366. package/dist/esm/engine/providers/resend.provider.specification.d.ts.map +1 -0
  367. package/dist/esm/engine/providers/resend.provider.specification.js +33 -0
  368. package/dist/esm/engine/providers/resend.provider.specification.js.map +1 -0
  369. package/dist/esm/engine/providers/stripe.provider.specification.d.ts +7 -0
  370. package/dist/esm/engine/providers/stripe.provider.specification.d.ts.map +1 -0
  371. package/dist/esm/engine/providers/stripe.provider.specification.js +35 -0
  372. package/dist/esm/engine/providers/stripe.provider.specification.js.map +1 -0
  373. package/dist/esm/engine/providers/twilio.provider.specification.d.ts +7 -0
  374. package/dist/esm/engine/providers/twilio.provider.specification.d.ts.map +1 -0
  375. package/dist/esm/engine/providers/twilio.provider.specification.js +33 -0
  376. package/dist/esm/engine/providers/twilio.provider.specification.js.map +1 -0
  377. package/dist/esm/engine/users/resources/anonymous-users.resource.specification.js +7 -7
  378. package/dist/esm/engine/users/resources/anonymous-users.resource.specification.js.map +1 -1
  379. package/dist/esm/engine/users/resources/inbound-contacts.resource.specification.js +9 -9
  380. package/dist/esm/engine/users/resources/inbound-contacts.resource.specification.js.map +1 -1
  381. package/dist/esm/engine/users/resources/user-credentials.resource.specification.js +2 -2
  382. package/dist/esm/engine/users/resources/user-credentials.resource.specification.js.map +1 -1
  383. package/dist/esm/engine/users/resources/user-identity-links.resource.specification.js +8 -8
  384. package/dist/esm/engine/users/resources/user-identity-links.resource.specification.js.map +1 -1
  385. package/dist/esm/engine/users/resources/user-preferences.resource.specification.d.ts +4 -4
  386. package/dist/esm/engine/users/resources/user-preferences.resource.specification.js +4 -4
  387. package/dist/esm/engine/users/resources/user-preferences.resource.specification.js.map +1 -1
  388. package/dist/esm/engine/users/resources/user-profiles.resource.specification.js +2 -2
  389. package/dist/esm/engine/users/resources/user-profiles.resource.specification.js.map +1 -1
  390. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.d.ts +4 -4
  391. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.d.ts.map +1 -1
  392. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.js +13 -11
  393. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.js.map +1 -1
  394. package/dist/esm/engine/users/resources/user-self-profiles.resource.specification.js +1 -1
  395. package/dist/esm/engine/users/resources/user-self-profiles.resource.specification.js.map +1 -1
  396. package/dist/esm/engine/users/resources/user-self.resource.specification.js +8 -8
  397. package/dist/esm/engine/users/resources/user-self.resource.specification.js.map +1 -1
  398. package/dist/esm/engine/users/resources/users.resource.specification.d.ts.map +1 -1
  399. package/dist/esm/engine/users/resources/users.resource.specification.js +93 -0
  400. package/dist/esm/engine/users/resources/users.resource.specification.js.map +1 -1
  401. package/dist/esm/technical-documentation/engine-documentation-specification-catalog.companion.d.ts.map +1 -1
  402. package/dist/esm/technical-documentation/engine-documentation-specification-catalog.companion.js +95 -45
  403. package/dist/esm/technical-documentation/engine-documentation-specification-catalog.companion.js.map +1 -1
  404. package/dist/esm/technical-documentation/technical-documentation-units.schemas.d.ts +37 -1
  405. package/dist/esm/technical-documentation/technical-documentation-units.schemas.d.ts.map +1 -1
  406. package/dist/esm/technical-documentation/technical-documentation-units.schemas.js +36 -0
  407. package/dist/esm/technical-documentation/technical-documentation-units.schemas.js.map +1 -1
  408. package/dist/tsconfig.build.tsbuildinfo +1 -1
  409. package/package.json +8 -8
  410. package/dist/assurance/external-framework-mapping.json +0 -980
@@ -1 +1 @@
1
- {"version":3,"file":"subscriptions.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/subscriptions.resource.specification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxG,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,IAAI,EAAE,EAC3B,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,wCAAwC,GACzC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,sBAAsB,EACtB,mCAAmC,EACnC,6BAA6B,EAC7B,qBAAqB,EACrB,8CAA8C,GAC/C,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kCAAkC,EAClC,uBAAuB,EACvB,qCAAqC,GAEtC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAK3E,MAAM,qCAAqC,GAA6D;IACtG,CAAC,gBAAgB,CAAC,0BAA0B,CAAC,EAAE,oBAAoB,CAAC,aAAa;IACjF,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,EAAE,oBAAoB,CAAC,SAAS;CACtE,CAAC;AAQF,SAAS,YAAY,CAAC,MAAwC,EAAE,YAA6B,EAAE,UAAkB;IAC/G,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAA4B,CAAC;IACnE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,YAAY,YAAY,oBAAoB,UAAU,GAAG,CAAC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;YAClK,CAAC,8BAA8B,CAAC,YAAY,CAAC,EAAE,EAAE,OAAO,EAAE,6BAA6B,EAAE,SAAS,EAAE,yEAAyE,EAAE;SAChL;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,8CAA8C,GAAG,qBAAqB,CACjF,gBAAgB,CAAC,0BAA0B,EAC3C,4BAA4B,CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,sCAAsC,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { billingAdminPresets, billingMainPresets } from '@wildo-ai/presets-components';\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport type { ResourceUIBehaviorConfig } from '@wildo-ai/saas-frontend-lib/companion';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n BillingSubscriptionBaseSchema,\n BillingSubscription_Operations,\n CoreResourceOperation as Op,\n CoreResourceType,\n ResourcePrimaryScope,\n SubscriptionStatus,\n billingSubscriptionsPolymorphicFactories,\n} from '@wildo-ai/saas-models';\nimport {\n HttpResponseStatusCode,\n mergeResourceFrontendConfigurations,\n resourceFrontendConfiguration,\n resourceSpecification,\n resourceSpecificationFromFrontendConfiguration,\n} from '~wildo-specifications/_core';\nimport {\n BILLING_API_REFERENCE_PAGE_REQUEST,\n billingApiReferencePage,\n createBillingApiReferenceScopeExample,\n type BillingApiReferenceExampleScope,\n} from './billing-api-reference-examples';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\ntype SubResourceType = CoreResourceType.ORGANIZATION_SUBSCRIPTIONS | CoreResourceType.USER_SUBSCRIPTIONS;\ntype SubResourceTypeMember = 'ORGANIZATION_SUBSCRIPTIONS' | 'USER_SUBSCRIPTIONS';\n\nconst subResourcePrimaryScopeByResourceType: Record<SubResourceType, BillingApiReferenceExampleScope> = {\n [CoreResourceType.ORGANIZATION_SUBSCRIPTIONS]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.USER_SUBSCRIPTIONS]: ResourcePrimaryScope.USER_SELF,\n};\n\ntype Cfg = ReturnType<(typeof billingSubscriptionsPolymorphicFactories)[CoreResourceType.ORGANIZATION_SUBSCRIPTIONS]>;\ntype Custom = NonNullable<Cfg['customOperation']>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = typeof BillingSubscriptionBaseSchema;\ntype SubFrontend = ResourceUIBehaviorConfig<Custom, Core, Main>;\n\nfunction resolveSubUI(source: Partial<Record<string, unknown>>, resourceType: SubResourceType, sourceName: string): SubFrontend {\n const uiBehavior = source[resourceType] as SubFrontend | undefined;\n if (!uiBehavior) {\n throw new Error(`Missing \"${resourceType}\" UI behavior in ${sourceName}.`);\n }\n return uiBehavior;\n}\n\nfunction buildSubscriptionBase(resourceType: SubResourceType, memberName: SubResourceTypeMember) {\n const exampleScope = createBillingApiReferenceScopeExample(\n subResourcePrimaryScopeByResourceType[resourceType],\n );\n const baseItem = {\n _id: 'subscription_item_base_01HX2EXAMPLE',\n productId: 'product_team_plan',\n priceId: 'price_team_monthly',\n quantity: 25,\n };\n const subscriptionExample = {\n _id: 'subscription_01HX2EXAMPLE',\n ...exampleScope.billingAccountIdentity,\n status: SubscriptionStatus.ACTIVE,\n items: [baseItem],\n currentPeriodStart: '2026-06-01T00:00:00.000Z',\n currentPeriodEnd: '2026-07-01T00:00:00.000Z',\n cancelAtPeriodEnd: false,\n metadata: { contract: 'annual-commitment' },\n createdAt: '2026-05-10T09:00:00.000Z',\n updatedAt: '2026-06-01T00:05:00.000Z',\n ...exampleScope.scopeIdentity,\n };\n const subscriptionSummaryExample = {\n _id: subscriptionExample._id,\n ...exampleScope.billingAccountIdentity,\n status: subscriptionExample.status,\n currentPeriodEnd: subscriptionExample.currentPeriodEnd,\n cancelAtPeriodEnd: subscriptionExample.cancelAtPeriodEnd,\n };\n\n return resourceSpecification<Custom, Core, Main>(\n billingSubscriptionsPolymorphicFactories[resourceType],\n BillingSubscriptionBaseSchema,\n ({ schemaShape }) => ({\n purpose:\n 'Subscription for a billing account: exposes the selected plan and add-ons, lifecycle status, billing-period bounds, trial state, and cancellation state.',\n businessRole: 'Entitlement driver for seats and renewals — the object billing emails and plan changes refer to.',\n lifecycleRole:\n 'Created after a successful checkout and updated after subscription changes or billing-provider events. A cancelled subscription is retained as billing history rather than cascade-deleted with its account, and subject erasure terminates active billing.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.BILLING,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'BillingSubscriptionBaseSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactoryCollectionEntry: {\n collectionSymbol: { packageName: '@wildo-ai/saas-models', exportName: 'billingSubscriptionsPolymorphicFactories', symbolKind: CodeSymbolKind.FACTORY },\n identifierField: 'collectionKey',\n identifierValue: resourceType,\n },\n resourceType: { enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM }, memberName },\n operationVocabulary: {\n coreEnum: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceOperation', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n customEnum: { packageName: '@wildo-ai/saas-models', exportName: 'BillingSubscription_Operations', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n },\n frontendConfigurationSourceEntries: [\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingMainPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingAdminPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n ],\n notes: ['Renewal and payment-failed emails may fan out from subscription state changes — confirm `userNotifications[]` on the factory when documenting communications.'],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Mongo id for this subscription document.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n billingAccountId: schemaShape.billingAccountId.stringSpec({ meaning: 'Polymorphic FK to the parent billing account (`organizationBillingAccountId` or `userBillingAccountId` on concrete schema).', importance: FieldSemanticImportance.PRIMARY }),\n status: schemaShape.status.enumSpec({\n meaning: 'Provider subscription lifecycle state mirrored for gating and UI badges.',\n importance: FieldSemanticImportance.PRIMARY,\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'SubscriptionStatus', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [SubscriptionStatus.ACTIVE]: { meaning: 'Currently billable and entitled per provider.' },\n [SubscriptionStatus.TRIALING]: { meaning: 'In trial window if applicable.' },\n [SubscriptionStatus.PAST_DUE]: { meaning: 'Payment failed; access may be degraded per product policy.' },\n [SubscriptionStatus.UNPAID]: { meaning: 'Severe payment failure state from provider semantics.' },\n [SubscriptionStatus.CANCELLED]: { meaning: 'Terminated; may still be visible for history.' },\n [SubscriptionStatus.INCOMPLETE]: { meaning: 'Checkout or first payment not completed.' },\n [SubscriptionStatus.INCOMPLETE_EXPIRED]: { meaning: 'Incomplete checkout expired at provider.' },\n [SubscriptionStatus.PAUSED]: { meaning: 'Paused per provider rules (if used).' },\n },\n }),\n items: schemaShape.items.arraySpec({\n meaning: 'Line items (product + price + quantity) that make up the commercial subscription.',\n elementMeaning: 'One `SubscriptionItemSchema` with `productId`, `priceId`, `quantity`, and optional provider item id.',\n }),\n currentPeriodStart: schemaShape.currentPeriodStart.dateSpec({ meaning: 'Start of the current invoice period.', temporalRole: 'scheduled' }),\n currentPeriodEnd: schemaShape.currentPeriodEnd.dateSpec({ meaning: 'End of the current invoice period / next renewal anchor.', importance: FieldSemanticImportance.PRIMARY }),\n trialEnd: schemaShape.trialEnd.dateSpec({ meaning: 'When trial pricing ends if trialing.', temporalRole: 'deadline' }),\n cancelAtPeriodEnd: schemaShape.cancelAtPeriodEnd.booleanSpec({ meaning: 'User/org requested cancel at end of current period.' }),\n cancellationReason: schemaShape.cancellationReason.stringSpec({ meaning: 'Free-text reason captured when cancelling, if any.' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Inspect one subscription for settings, entitlements, and support.',\n outcome: 'Current items, status, and period fields for UI.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The subscription was found and its items, status, and period bounds are returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to read the subscription (the read path is an org-owner/org-admin-scoped API operation).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Inspect the active team subscription',\n response: subscriptionExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Inspect the subscription with available relationship context',\n response: subscriptionExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Inspect the compact subscription summary',\n response: subscriptionSummaryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.LIST]: {\n purpose: 'Enumerate subscriptions for a billing account or scope.',\n outcome: 'Table data for admin and self-serve subscription pickers.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of subscriptions for the billing account or scope.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to enumerate subscriptions in this scope.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Browse subscriptions for one billing account',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([subscriptionExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Browse subscriptions with relationship context',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([subscriptionExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Browse compact subscription summaries',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([subscriptionSummaryExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.CREATE]: {\n purpose: 'Repository path when server creates a subscription document from provider sync before first API read.',\n outcome: 'New row aligned to provider id in implementation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A subscription document was materialised from provider sync and aligned to the provider subscription id.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The synced subscription payload fails schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not the trusted system/webhook identity authorised to materialise subscription rows (this is an internal service-pipeline write, not a public create endpoint).' },\n ],\n idempotent: false,\n },\n [Op.UPDATE]: {\n purpose: 'Internal updates from webhooks or migration; user-facing changes often use custom ops.',\n outcome: 'Patched fields per DTO rules in factory.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The subscription fields were patched (typically reconciling provider webhook state) and the updated row is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The patched fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner / system role required to reconcile subscription state (internal service-pipeline path, not HTTP-exposed).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n ],\n idempotent: true,\n },\n [BillingSubscription_Operations.CANCEL]: {\n operationId: BillingSubscription_Operations.CANCEL,\n purpose: 'Cancel at period end or immediately per request DTO.',\n outcome: 'Provider and row updated; emails may fire per runtime config.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The cancellation was accepted at the provider and mirrored locally — either `cancelAtPeriodEnd` is set or the subscription is now `CANCELLED` per the `cancelImmediately` flag.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to cancel the subscription (a CRITICAL-risk lifecycle action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The subscription is in a state the provider will not cancel (e.g. already terminated, or `INCOMPLETE_EXPIRED`).' },\n ],\n // Convergent lifecycle set: cancelling drives the subscription toward a fixed\n // cancelled / cancel-at-period-end state, so a repeat request lands the same\n // outcome (the provider treats re-cancelling an already-cancelling sub as a no-op).\n idempotent: true,\n examples: [{\n title: 'Schedule cancellation at the current period end',\n request: { cancelImmediately: false, reason: 'Consolidating tools at renewal' },\n response: {\n ...subscriptionExample,\n cancelAtPeriodEnd: true,\n cancellationReason: 'Consolidating tools at renewal',\n updatedAt: '2026-06-20T15:15:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.RESUME]: {\n operationId: BillingSubscription_Operations.RESUME,\n purpose: 'Undo a pending cancel before period end when provider allows.',\n outcome: 'Status returns toward active trialing/active.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The pending cancellation was cleared at the provider; the subscription returns toward `ACTIVE` / `TRIALING`.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to resume the subscription.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'There is no pending cancellation to undo, or the current period already ended so the provider cannot resume it.' },\n ],\n // Convergent set toward the un-cancelled state: re-resuming an already-active\n // subscription is a no-op at the provider, so the operation is idempotent.\n idempotent: true,\n examples: [{\n title: 'Resume a subscription before renewal',\n request: {},\n response: {\n ...subscriptionExample,\n cancelAtPeriodEnd: false,\n updatedAt: '2026-06-21T10:00:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.CHANGE_PLAN]: {\n operationId: BillingSubscription_Operations.CHANGE_PLAN,\n purpose: 'Swap product/price with proration rules in the billing service.',\n outcome: 'Items and period fields updated after provider confirmation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The plan swap (with proration) was confirmed by the provider; the subscription’s items and period fields are updated.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The target `newProductKey` / `newPriceId` is missing or fails request-DTO validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: '`newPriceId` names a price whose `productId` is not `newProductKey`’s product. The two are caller-supplied independently, and the provider is billed the PRICE while entitlements derive from the PRODUCT recorded on the item — so an unmatched pair would grant one plan’s entitlements at another plan’s price.', errorCode: 'BILLING_PRICE_PRODUCT_MISMATCH' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to change the plan (a HIGH-risk commercial action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id, or the target product/price is not in the catalog.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The requested price is incompatible with the current subscription, or the provider rejects the proration in the subscription’s current state.' },\n ],\n // Non-convergent: each plan swap is a distinct commercial change with its own\n // proration at the provider, so repeating the request is not side-effect-free.\n idempotent: false,\n examples: [{\n title: 'Upgrade from Team to Business',\n request: { newProductKey: 'business_plan', newPriceId: 'price_business_monthly' },\n response: {\n ...subscriptionExample,\n items: [{\n _id: 'subscription_item_business_01HX2EXAMPLE',\n productId: 'product_business_plan',\n priceId: 'price_business_monthly',\n quantity: 25,\n }],\n updatedAt: '2026-06-22T11:00:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.ADD_ADDON]: {\n operationId: BillingSubscription_Operations.ADD_ADDON,\n purpose: 'Attach an add-on line item to the subscription.',\n outcome: 'Items array gains a new entry after provider confirmation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The add-on line item was confirmed by the provider and appended to the subscription’s items array.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The `addonProductKey` / `priceId` is missing or fails request-DTO validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: '`priceId` names a price whose `productId` is not the add-on product’s. Same split as CHANGE_PLAN: the provider bills the price, the item records the product, and entitlements follow the product.', errorCode: 'BILLING_PRICE_PRODUCT_MISMATCH' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to add an add-on (a HIGH-risk commercial action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id, or the add-on product is not in the catalog.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The add-on is already attached, or is incompatible with the current plan per provider rules.' },\n ],\n // Non-convergent: adding an add-on is an incremental commercial change; a repeat\n // call would attempt to attach the same add-on again (and trips the 409 above).\n idempotent: false,\n examples: [{\n title: 'Add the audit-retention add-on',\n request: { addonProductKey: 'audit_retention', priceId: 'price_audit_retention_monthly' },\n response: {\n ...subscriptionExample,\n items: [\n baseItem,\n {\n _id: 'subscription_item_audit_01HX2EXAMPLE',\n productId: 'product_audit_retention',\n priceId: 'price_audit_retention_monthly',\n quantity: 1,\n },\n ],\n updatedAt: '2026-06-23T08:30:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.REMOVE_ADDON]: {\n operationId: BillingSubscription_Operations.REMOVE_ADDON,\n purpose: 'Remove an add-on line item before next period where allowed.',\n outcome: 'Items array shrinks after provider confirmation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The add-on line item was removed at the provider and dropped from the subscription’s items array.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The `addonProductKey` is missing or fails request-DTO validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to remove an add-on (a HIGH-risk commercial action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id, or the named add-on is not present on the subscription.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The add-on cannot be removed mid-cycle under the current plan/provider policy.' },\n ],\n // Non-convergent: removal is a commercial change confirmed per-call at the\n // provider; the second identical call no longer finds the add-on (404) rather\n // than being a safe no-op, so it is not modelled as idempotent.\n idempotent: false,\n examples: [{\n title: 'Remove the audit-retention add-on',\n request: { addonProductKey: 'audit_retention' },\n response: {\n ...subscriptionExample,\n items: [baseItem],\n updatedAt: '2026-06-24T08:30:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n businessConstraints: [\n 'Nested `discount` blocks are provider-populated on READ; clients should not treat them as editable catalog data.',\n ],\n }),\n { resourcePrimaryScope: subResourcePrimaryScopeByResourceType[resourceType] },\n );\n}\n\nfunction buildSubscriptionSpec(resourceType: SubResourceType, memberName: SubResourceTypeMember) {\n const base = buildSubscriptionBase(resourceType, memberName);\n const main = resolveSubUI(billingMainPresets as Partial<Record<string, unknown>>, resourceType, 'billingMainPresets');\n const admin = resolveSubUI(billingAdminPresets as Partial<Record<string, unknown>>, resourceType, 'billingAdminPresets');\n return resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(main), resourceFrontendConfiguration(admin)),\n base,\n () => ({\n label: { purpose: 'Preset uses `status` string for a compact row label in subscription lists.' },\n layout: {\n purpose: 'Inline summary template in billing presets (no `refs.sections`) shows status, cancel-at-period-end, period end, trial end, and billing-account id — child resources appear in parent billing-account tabs via `variantOverrides`.',\n displayPurpose: 'Self-serve “current plan” and org admin subscription management.',\n },\n views: {\n [BillingSubscription_Operations.CANCEL]: { purpose: 'Custom op host; entries are not addressable routes in merged `billing` presets but operations exist for action buttons.', whenToUse: 'Cancel plan flow in product UI.' },\n [BillingSubscription_Operations.RESUME]: { purpose: 'Resume before period end when user changes mind.', whenToUse: 'Reverse a scheduled cancel.' },\n [BillingSubscription_Operations.CHANGE_PLAN]: { purpose: 'Plan migration host for upgrade/downgrade UX.', whenToUse: 'When catalog offers multiple prices for the same product line.' },\n [BillingSubscription_Operations.ADD_ADDON]: { purpose: 'Attach add-on SKUs to the active subscription.', whenToUse: 'When add-on products exist in the catalog.' },\n [BillingSubscription_Operations.REMOVE_ADDON]: { purpose: 'Detach an add-on line item.', whenToUse: 'When seat-based or feature add-ons can be removed mid-cycle per policy.' },\n },\n }),\n );\n}\n\nexport const organizationSubscriptionsResourceSpecification = buildSubscriptionSpec(\n CoreResourceType.ORGANIZATION_SUBSCRIPTIONS,\n 'ORGANIZATION_SUBSCRIPTIONS',\n);\n\nexport const userSubscriptionsResourceSpecification = buildSubscriptionSpec(CoreResourceType.USER_SUBSCRIPTIONS, 'USER_SUBSCRIPTIONS');\n"]}
1
+ {"version":3,"file":"subscriptions.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/subscriptions.resource.specification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxG,OAAO,EACL,6BAA6B,EAC7B,8BAA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qBAAqB,CACjF,gBAAgB,CAAC,0BAA0B,EAC3C,4BAA4B,CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,sCAAsC,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { billingAdminPresets, billingMainPresets } from '@wildo-ai/presets-components';\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport type { ResourceUIBehaviorConfig } from '@wildo-ai/saas-frontend-lib/companion';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n BillingSubscriptionBaseSchema,\n BillingSubscription_Operations,\n CoreResourceOperation as Op,\n CoreResourceType,\n ResourcePrimaryScope,\n SubscriptionStatus,\n billingSubscriptionsPolymorphicFactories,\n} from '@wildo-ai/saas-models';\nimport {\n HttpResponseStatusCode,\n mergeResourceFrontendConfigurations,\n resourceFrontendConfiguration,\n resourceSpecification,\n resourceSpecificationFromFrontendConfiguration,\n} from '~wildo-specifications/_core';\nimport {\n BILLING_API_REFERENCE_PAGE_REQUEST,\n billingApiReferencePage,\n createBillingApiReferenceScopeExample,\n type BillingApiReferenceExampleScope,\n} from './billing-api-reference-examples';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\ntype SubResourceType = CoreResourceType.ORGANIZATION_SUBSCRIPTIONS | CoreResourceType.USER_SUBSCRIPTIONS;\ntype SubResourceTypeMember = 'ORGANIZATION_SUBSCRIPTIONS' | 'USER_SUBSCRIPTIONS';\n\nconst subResourcePrimaryScopeByResourceType: Record<SubResourceType, BillingApiReferenceExampleScope> = {\n [CoreResourceType.ORGANIZATION_SUBSCRIPTIONS]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.USER_SUBSCRIPTIONS]: ResourcePrimaryScope.USER_SELF,\n};\n\ntype Cfg = ReturnType<(typeof billingSubscriptionsPolymorphicFactories)[CoreResourceType.ORGANIZATION_SUBSCRIPTIONS]>;\ntype Custom = NonNullable<Cfg['customOperation']>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = typeof BillingSubscriptionBaseSchema;\ntype SubFrontend = ResourceUIBehaviorConfig<Custom, Core, Main>;\n\nfunction resolveSubUI(source: Partial<Record<string, unknown>>, resourceType: SubResourceType, sourceName: string): SubFrontend {\n const uiBehavior = source[resourceType] as SubFrontend | undefined;\n if (!uiBehavior) {\n throw new Error(`Missing \"${resourceType}\" UI behavior in ${sourceName}.`);\n }\n return uiBehavior;\n}\n\nfunction buildSubscriptionBase(resourceType: SubResourceType, memberName: SubResourceTypeMember) {\n const exampleScope = createBillingApiReferenceScopeExample(\n subResourcePrimaryScopeByResourceType[resourceType],\n );\n const baseItem = {\n _id: 'subscription_item_base_01HX2EXAMPLE',\n productId: 'product_team_plan',\n priceId: 'price_team_monthly',\n quantity: 25,\n };\n const subscriptionExample = {\n _id: 'subscription_01HX2EXAMPLE',\n ...exampleScope.billingAccountIdentity,\n status: SubscriptionStatus.ACTIVE,\n items: [baseItem],\n currentPeriodStart: '2026-06-01T00:00:00.000Z',\n currentPeriodEnd: '2026-07-01T00:00:00.000Z',\n cancelAtPeriodEnd: false,\n metadata: { contract: 'annual-commitment' },\n createdAt: '2026-05-10T09:00:00.000Z',\n updatedAt: '2026-06-01T00:05:00.000Z',\n ...exampleScope.scopeIdentity,\n };\n const subscriptionSummaryExample = {\n _id: subscriptionExample._id,\n ...exampleScope.billingAccountIdentity,\n status: subscriptionExample.status,\n currentPeriodEnd: subscriptionExample.currentPeriodEnd,\n cancelAtPeriodEnd: subscriptionExample.cancelAtPeriodEnd,\n };\n\n return resourceSpecification<Custom, Core, Main>(\n billingSubscriptionsPolymorphicFactories[resourceType],\n BillingSubscriptionBaseSchema,\n ({ schemaShape }) => ({\n purpose:\n 'Subscription for a billing account: exposes the selected plan and add-ons, lifecycle status, billing-period bounds, trial state, and cancellation state.',\n businessRole: 'Entitlement driver for seats and renewals — the object billing emails and plan changes refer to.',\n lifecycleRole:\n 'Created after a successful checkout and updated after subscription changes or billing-provider events. A cancelled subscription is retained as billing history rather than cascade-deleted with its account, and subject erasure terminates active billing.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.BILLING,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'BillingSubscriptionBaseSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactoryCollectionEntry: {\n collectionSymbol: { packageName: '@wildo-ai/saas-models', exportName: 'billingSubscriptionsPolymorphicFactories', symbolKind: CodeSymbolKind.FACTORY },\n identifierField: 'collectionKey',\n identifierValue: resourceType,\n },\n resourceType: { enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM }, memberName },\n operationVocabulary: {\n coreEnum: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceOperation', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n customEnum: { packageName: '@wildo-ai/saas-models', exportName: 'BillingSubscription_Operations', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n },\n frontendConfigurationSourceEntries: [\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingMainPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingAdminPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n ],\n notes: ['Renewal and payment-failed emails may fan out from subscription state changes — confirm `userNotifications[]` on the factory when documenting communications.'],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Mongo id for this subscription document.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n billingAccountId: schemaShape.billingAccountId.stringSpec({ meaning: 'Polymorphic FK to the parent billing account (`organizationBillingAccountId` or `userBillingAccountId` on concrete schema).', importance: FieldSemanticImportance.PRIMARY }),\n status: schemaShape.status.enumSpec({\n meaning: 'Provider subscription lifecycle state mirrored for gating and UI badges.',\n importance: FieldSemanticImportance.PRIMARY,\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'SubscriptionStatus', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [SubscriptionStatus.ACTIVE]: { meaning: 'Currently billable and entitled per provider.' },\n [SubscriptionStatus.TRIALING]: { meaning: 'In trial window if applicable.' },\n [SubscriptionStatus.PAST_DUE]: { meaning: 'Payment failed; access may be degraded per product policy.' },\n [SubscriptionStatus.UNPAID]: { meaning: 'Severe payment failure state from provider semantics.' },\n [SubscriptionStatus.CANCELLED]: { meaning: 'Terminated; may still be visible for history.' },\n [SubscriptionStatus.INCOMPLETE]: { meaning: 'Checkout or first payment not completed.' },\n [SubscriptionStatus.INCOMPLETE_EXPIRED]: { meaning: 'Incomplete checkout expired at provider.' },\n [SubscriptionStatus.PAUSED]: { meaning: 'Paused per provider rules (if used).' },\n },\n }),\n items: schemaShape.items.arraySpec({\n meaning: 'Line items (product + price + quantity) that make up the commercial subscription.',\n elementMeaning: 'One `SubscriptionItemSchema` with `productId`, `priceId`, `quantity`, and optional provider item id.',\n }),\n currentPeriodStart: schemaShape.currentPeriodStart.dateSpec({ meaning: 'Start of the current invoice period.', temporalRole: 'scheduled' }),\n currentPeriodEnd: schemaShape.currentPeriodEnd.dateSpec({ meaning: 'End of the current invoice period / next renewal anchor.', importance: FieldSemanticImportance.PRIMARY }),\n trialEnd: schemaShape.trialEnd.dateSpec({ meaning: 'When trial pricing ends if trialing.', temporalRole: 'deadline' }),\n cancelAtPeriodEnd: schemaShape.cancelAtPeriodEnd.booleanSpec({ meaning: 'User/org requested cancel at end of current period.' }),\n cancellationReason: schemaShape.cancellationReason.stringSpec({ meaning: 'Free-text reason captured when cancelling, if any.' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Inspect one subscription for settings, entitlements, and support.',\n outcome: 'Current items, status, and period fields for UI.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The subscription was found and its items, status, and period bounds are returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to read the subscription (the read path is an org-owner/org-admin-scoped API operation).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Inspect the active team subscription',\n response: subscriptionExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Inspect the subscription with available relationship context',\n response: subscriptionExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Inspect the compact subscription summary',\n response: subscriptionSummaryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.LIST]: {\n purpose: 'Enumerate subscriptions for a billing account or scope.',\n outcome: 'Table data for admin and self-serve subscription pickers.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of subscriptions for the billing account or scope.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to enumerate subscriptions in this scope.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Browse subscriptions for one billing account',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([subscriptionExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Browse subscriptions with relationship context',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([subscriptionExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Browse compact subscription summaries',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([subscriptionSummaryExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.CREATE]: {\n purpose: 'Repository path when server creates a subscription document from provider sync before first API read.',\n outcome: 'New row aligned to provider id in implementation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A subscription document was materialised from provider sync and aligned to the provider subscription id.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The synced subscription payload fails schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not the trusted system/webhook identity authorised to materialise subscription rows (this is an internal service-pipeline write, not a public create endpoint).' },\n ],\n idempotent: false,\n },\n [Op.UPDATE]: {\n purpose: 'Internal updates from webhooks or migration; user-facing changes often use custom ops.',\n outcome: 'Patched fields per DTO rules in factory.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The subscription fields were patched (typically reconciling provider webhook state) and the updated record is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The patched fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner / system role required to reconcile subscription state (internal service-pipeline path, not HTTP-exposed).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n ],\n idempotent: true,\n },\n [BillingSubscription_Operations.CANCEL]: {\n operationId: BillingSubscription_Operations.CANCEL,\n purpose: 'Cancel at the end of the current period or immediately, within what the plan permits.',\n outcome: 'Provider and row updated; emails may fire per runtime config. Timing is decided in this order: the request’s `cancelImmediately` when it names one, then the plan product’s authored default, then the end of the current period. A plan may FORBID immediate cancellation, in which case a request for one is refused rather than quietly downgraded — a caller told their subscription ended when it has not is worse served than one told no.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The cancellation was accepted at the provider and mirrored locally — either `cancelAtPeriodEnd` is set or the subscription is now `CANCELLED` per the `cancelImmediately` flag.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to cancel the subscription (a CRITICAL-risk lifecycle action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The subscription is in a state the provider will not cancel (e.g. already terminated, or `INCOMPLETE_EXPIRED`).' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'Immediate cancellation was requested for a plan whose product forbids it. The subscription can still be cancelled at the end of the current period.' },\n ],\n // Convergent lifecycle set: cancelling drives the subscription toward a fixed\n // cancelled / cancel-at-period-end state, so a repeat request lands the same\n // outcome (the provider treats re-cancelling an already-cancelling sub as a no-op).\n idempotent: true,\n examples: [{\n title: 'Schedule cancellation at the current period end',\n request: { cancelImmediately: false, reason: 'Consolidating tools at renewal' },\n response: {\n ...subscriptionExample,\n cancelAtPeriodEnd: true,\n cancellationReason: 'Consolidating tools at renewal',\n updatedAt: '2026-06-20T15:15:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.RESUME]: {\n operationId: BillingSubscription_Operations.RESUME,\n purpose: 'Undo a pending cancel before period end when provider allows.',\n outcome: 'Status returns toward active trialing/active.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The pending cancellation was cleared at the provider; the subscription returns toward `ACTIVE` / `TRIALING`.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to resume the subscription.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'There is no pending cancellation to undo, or the current period already ended so the provider cannot resume it.' },\n ],\n // Convergent set toward the un-cancelled state: re-resuming an already-active\n // subscription is a no-op at the provider, so the operation is idempotent.\n idempotent: true,\n examples: [{\n title: 'Resume a subscription before renewal',\n request: {},\n response: {\n ...subscriptionExample,\n cancelAtPeriodEnd: false,\n updatedAt: '2026-06-21T10:00:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.CHANGE_PLAN]: {\n operationId: BillingSubscription_Operations.CHANGE_PLAN,\n purpose: 'Swap product/price with proration rules in the billing service.',\n outcome: 'Items and period fields updated after provider confirmation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The plan swap (with proration) was confirmed by the provider; the subscription’s items and period fields are updated.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The target `newProductKey` / `newPriceId` is missing or fails request-DTO validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: '`newPriceId` names a price whose `productId` is not `newProductKey`’s product. The two are caller-supplied independently, and the provider is billed the PRICE while entitlements derive from the PRODUCT recorded on the item — so an unmatched pair would grant one plan’s entitlements at another plan’s price.', errorCode: 'BILLING_PRICE_PRODUCT_MISMATCH' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to change the plan (a HIGH-risk commercial action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id, or the target product/price is not in the catalog.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The requested price is incompatible with the current subscription, or the provider rejects the proration in the subscription’s current state.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: '`newProductKey` (or the price named by `newPriceId`) has been RETIRED from the code catalogue. A subscription may not be MOVED ONTO a retired product; a subscription already on one keeps running, and REMOVE_ADDON deliberately still works so a customer is never trapped on a withdrawn add-on.', errorCode: 'BILLING_PRODUCT_RETIRED' },\n ],\n // Non-convergent: each plan swap is a distinct commercial change with its own\n // proration at the provider, so repeating the request is not side-effect-free.\n idempotent: false,\n examples: [{\n title: 'Upgrade from Team to Business',\n request: { newProductKey: 'business_plan', newPriceId: 'price_business_monthly' },\n response: {\n ...subscriptionExample,\n items: [{\n _id: 'subscription_item_business_01HX2EXAMPLE',\n productId: 'product_business_plan',\n priceId: 'price_business_monthly',\n quantity: 25,\n }],\n updatedAt: '2026-06-22T11:00:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.ADD_ADDON]: {\n operationId: BillingSubscription_Operations.ADD_ADDON,\n purpose: 'Attach an add-on line item to the subscription.',\n outcome: 'Items array gains a new entry after provider confirmation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The add-on line item was confirmed by the provider and appended to the subscription’s items array.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The `addonProductKey` / `priceId` is missing or fails request-DTO validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: '`priceId` names a price whose `productId` is not the add-on product’s. Same split as CHANGE_PLAN: the provider bills the price, the item records the product, and entitlements follow the product.', errorCode: 'BILLING_PRICE_PRODUCT_MISMATCH' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to add an add-on (a HIGH-risk commercial action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id, or the add-on product is not in the catalog.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The add-on is already attached, or is incompatible with the current plan per provider rules.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: '`addonProductKey` (or the price named by `priceId`) has been RETIRED from the code catalogue and may no longer be bought.', errorCode: 'BILLING_PRODUCT_RETIRED' },\n ],\n // Non-convergent: adding an add-on is an incremental commercial change; a repeat\n // call would attempt to attach the same add-on again (and trips the 409 above).\n idempotent: false,\n examples: [{\n title: 'Add the audit-retention add-on',\n request: { addonProductKey: 'audit_retention', priceId: 'price_audit_retention_monthly' },\n response: {\n ...subscriptionExample,\n items: [\n baseItem,\n {\n _id: 'subscription_item_audit_01HX2EXAMPLE',\n productId: 'product_audit_retention',\n priceId: 'price_audit_retention_monthly',\n quantity: 1,\n },\n ],\n updatedAt: '2026-06-23T08:30:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.REMOVE_ADDON]: {\n operationId: BillingSubscription_Operations.REMOVE_ADDON,\n purpose: 'Remove an add-on line item before next period where allowed.',\n outcome: 'Items array shrinks after provider confirmation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The add-on line item was removed at the provider and dropped from the subscription’s items array.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The `addonProductKey` is missing or fails request-DTO validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to remove an add-on (a HIGH-risk commercial action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id, or the named add-on is not present on the subscription.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The add-on cannot be removed mid-cycle under the current plan/provider policy.' },\n ],\n // Non-convergent: removal is a commercial change confirmed per-call at the\n // provider; the second identical call no longer finds the add-on (404) rather\n // than being a safe no-op, so it is not modelled as idempotent.\n idempotent: false,\n examples: [{\n title: 'Remove the audit-retention add-on',\n request: { addonProductKey: 'audit_retention' },\n response: {\n ...subscriptionExample,\n items: [baseItem],\n updatedAt: '2026-06-24T08:30:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n businessConstraints: [\n 'Nested `discount` blocks are provider-populated on READ; clients should not treat them as editable catalog data.',\n ],\n }),\n { resourcePrimaryScope: subResourcePrimaryScopeByResourceType[resourceType] },\n );\n}\n\nfunction buildSubscriptionSpec(resourceType: SubResourceType, memberName: SubResourceTypeMember) {\n const base = buildSubscriptionBase(resourceType, memberName);\n const main = resolveSubUI(billingMainPresets as Partial<Record<string, unknown>>, resourceType, 'billingMainPresets');\n const admin = resolveSubUI(billingAdminPresets as Partial<Record<string, unknown>>, resourceType, 'billingAdminPresets');\n return resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(main), resourceFrontendConfiguration(admin)),\n base,\n () => ({\n label: { purpose: 'Preset uses `status` string for a compact row label in subscription lists.' },\n layout: {\n purpose: 'Inline summary template in billing presets (no `refs.sections`) shows status, cancel-at-period-end, period end, trial end, and billing-account id — child resources appear in parent billing-account tabs via `variantOverrides`.',\n displayPurpose: 'Self-serve “current plan” and org admin subscription management.',\n },\n views: {\n [BillingSubscription_Operations.CANCEL]: { purpose: 'Custom op host; entries are not addressable routes in merged `billing` presets but operations exist for action buttons.', whenToUse: 'Cancel plan flow in product UI.' },\n [BillingSubscription_Operations.RESUME]: { purpose: 'Resume before period end when user changes mind.', whenToUse: 'Reverse a scheduled cancel.' },\n [BillingSubscription_Operations.CHANGE_PLAN]: { purpose: 'Plan migration host for upgrade/downgrade UX.', whenToUse: 'When catalog offers multiple prices for the same product line.' },\n [BillingSubscription_Operations.ADD_ADDON]: { purpose: 'Attach add-on SKUs to the active subscription.', whenToUse: 'When add-on products exist in the catalog.' },\n [BillingSubscription_Operations.REMOVE_ADDON]: { purpose: 'Detach an add-on line item.', whenToUse: 'When seat-based or feature add-ons can be removed mid-cycle per policy.' },\n },\n }),\n );\n}\n\nexport const organizationSubscriptionsResourceSpecification = buildSubscriptionSpec(\n CoreResourceType.ORGANIZATION_SUBSCRIPTIONS,\n 'ORGANIZATION_SUBSCRIPTIONS',\n);\n\nexport const userSubscriptionsResourceSpecification = buildSubscriptionSpec(CoreResourceType.USER_SUBSCRIPTIONS, 'USER_SUBSCRIPTIONS');\n"]}
@@ -1,4 +1,4 @@
1
- import { CoreResourceOperation as Op, UsageSourceType } from '@wildo-ai/saas-models';
1
+ import { CoreResourceOperation as Op, UsageRecordFlushState, UsageRecordUnreportableReason, UsageSourceType } from '@wildo-ai/saas-models';
2
2
  export declare const organizationUsageRecordsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<undefined, Op.READ | Op.UPDATE | Op.UPDATE_MANY | Op.CREATE | Op.LIST, import("zod").ZodObject<{
3
3
  _id: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>;
4
4
  billingAccountId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>>;
@@ -11,8 +11,10 @@ export declare const organizationUsageRecordsResourceSpecification: import("../.
11
11
  operationIdentifier: import("zod").ZodOptional<import("zod").ZodString>;
12
12
  description: import("zod").ZodOptional<import("zod").ZodString>;
13
13
  }, import("zod/v4/core").$strip>>>;
14
- reportedToProvider: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodBoolean>>>;
14
+ flushState: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodEnum<typeof UsageRecordFlushState>>>>>;
15
15
  reportedAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodOptional<import("zod").ZodDate>>;
16
+ unreportableReason: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodOptional<import("zod").ZodEnum<typeof UsageRecordUnreportableReason>>>>;
17
+ unreportableAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodOptional<import("zod").ZodDate>>;
16
18
  metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
17
19
  createdAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodDate>>>;
18
20
  }, import("zod/v4/core").$strip>>;
@@ -28,8 +30,10 @@ export declare const userUsageRecordsResourceSpecification: import("../../../_co
28
30
  operationIdentifier: import("zod").ZodOptional<import("zod").ZodString>;
29
31
  description: import("zod").ZodOptional<import("zod").ZodString>;
30
32
  }, import("zod/v4/core").$strip>>>;
31
- reportedToProvider: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodBoolean>>>;
33
+ flushState: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodEnum<typeof UsageRecordFlushState>>>>>;
32
34
  reportedAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodOptional<import("zod").ZodDate>>;
35
+ unreportableReason: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodOptional<import("zod").ZodEnum<typeof UsageRecordUnreportableReason>>>>;
36
+ unreportableAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodOptional<import("zod").ZodDate>>;
33
37
  metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
34
38
  createdAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodDate>>>;
35
39
  }, import("zod/v4/core").$strip>>;
@@ -1 +1 @@
1
- {"version":3,"file":"usage-records.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/usage-records.resource.specification.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,qBAAqB,IAAI,EAAE,EAI3B,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAiQ/B,eAAO,MAAM,6CAA6C;;;;;;;;;;;;;;;;iCAGzD,CAAC;AAEF,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;iCAGjD,CAAC"}
1
+ {"version":3,"file":"usage-records.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/usage-records.resource.specification.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,qBAAqB,IAAI,EAAE,EAI3B,qBAAqB,EACrB,6BAA6B,EAC7B,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAkR/B,eAAO,MAAM,6CAA6C;;;;;;;;;;;;;;;;;;iCAGzD,CAAC;AAEF,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;iCAGjD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { billingAdminPresets, billingMainPresets } from '@wildo-ai/presets-components';
2
2
  import { LabelAudience } from '@wildo-ai/presets-components-models';
3
3
  import { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';
4
- import { CoreResourceOperation as Op, CoreResourceType, ResourcePrimaryScope, UsageRecordSchema, UsageSourceType, usageRecordsPolymorphicFactories, } from '@wildo-ai/saas-models';
4
+ import { CoreResourceOperation as Op, CoreResourceType, ResourcePrimaryScope, UsageRecordSchema, UsageRecordFlushState, UsageRecordUnreportableReason, UsageSourceType, usageRecordsPolymorphicFactories, } from '@wildo-ai/saas-models';
5
5
  import { HttpResponseStatusCode, mergeResourceFrontendConfigurations, resourceFrontendConfiguration, resourceSpecification, resourceSpecificationFromFrontendConfiguration, } from '../../../_core/index.js';
6
6
  import { BILLING_API_REFERENCE_PAGE_REQUEST, billingApiReferencePage, createBillingApiReferenceScopeExample, } from './billing-api-reference-examples.js';
7
7
  import { EngineResourceSubDomain } from '../../engine-resource-sub-domain.js';
@@ -29,7 +29,7 @@ function buildUsageRecordBase(resourceType, memberName) {
29
29
  resourceType: 'documents',
30
30
  operationIdentifier: 'create',
31
31
  },
32
- reportedToProvider: true,
32
+ flushState: UsageRecordFlushState.REPORTED,
33
33
  reportedAt: '2026-06-15T12:05:00.000Z',
34
34
  metadata: { region: 'eu-west' },
35
35
  createdAt: '2026-06-15T12:00:01.000Z',
@@ -45,7 +45,7 @@ function buildUsageRecordBase(resourceType, memberName) {
45
45
  return resourceSpecification(usageRecordsPolymorphicFactories[resourceType], UsageRecordSchema, ({ schemaShape }) => ({
46
46
  purpose: 'Metered-usage record for a product key: exposes the measured quantity, event timestamp, reporting state, and the API or workflow source that produced it.',
47
47
  businessRole: 'Feeds METERED pricing and entitlements; aggregated in analytics and in `BillingState` responses.',
48
- lifecycleRole: 'Created by application metering and exposed as a read-only record. `reportedToProvider` becomes true after the billing provider acknowledges the measured usage.',
48
+ lifecycleRole: 'Created by application metering and exposed as a read-only record. `flushState` moves from `pending` to `reported` once the billing provider acknowledges the measured usage, or to `unreportable` when the flush determines it never can — a billing account that no longer exists, for instance, since these rows are retained after their account is gone.',
49
49
  audience: LabelAudience.ADMIN,
50
50
  subDomain: EngineResourceSubDomain.BILLING,
51
51
  codeHandling: {
@@ -65,21 +65,38 @@ function buildUsageRecordBase(resourceType, memberName) {
65
65
  fields: {
66
66
  _id: schemaShape._id.stringSpec({ meaning: 'Usage document id.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),
67
67
  billingAccountId: schemaShape.billingAccountId.stringSpec({ meaning: 'Polymorphic parent billing account FK.', importance: FieldSemanticImportance.PRIMARY }),
68
- productKey: schemaShape.productKey.stringSpec({ meaning: 'Catalog product key the usage row charges against (matches product definition).', importance: FieldSemanticImportance.PRIMARY }),
68
+ productKey: schemaShape.productKey.stringSpec({ meaning: 'Catalog product key the usage record charges against (matches product definition).', importance: FieldSemanticImportance.PRIMARY }),
69
69
  quantity: schemaShape.quantity.numberSpec({ meaning: 'Non-negative usage amount for the metering window captured in this record.' }),
70
70
  timestamp: schemaShape.timestamp.dateSpec({ meaning: 'When the usage event occurred in product time.', temporalRole: 'occurred' }),
71
71
  source: schemaShape.source.objectSpec({ meaning: 'Optional origin metadata (type, resourceType, operation id) for support and audits.' }),
72
- reportedToProvider: schemaShape.reportedToProvider.booleanSpec({ meaning: 'Whether a flush job has pushed this row to the billing provider.' }),
72
+ flushState: schemaShape.flushState.enumSpec({
73
+ meaning: 'Where the row stands with the provider flush. The flush selects exactly `pending`, so this field alone decides whether the row is still work.',
74
+ importance: FieldSemanticImportance.PRIMARY,
75
+ enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'UsageRecordFlushState', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },
76
+ values: {
77
+ [UsageRecordFlushState.PENDING]: { meaning: 'Awaiting a flush. Every newly recorded row starts here.' },
78
+ [UsageRecordFlushState.REPORTED]: { meaning: 'The provider acknowledged the quantity; `reportedAt` says when. Terminal, and money moved.' },
79
+ [UsageRecordFlushState.UNREPORTABLE]: { meaning: 'The flush determined the row can never be reported; `unreportableReason` says why. Terminal, and no money moved.' },
80
+ },
81
+ }),
73
82
  reportedAt: schemaShape.reportedAt.dateSpec({ meaning: 'When provider acknowledgement happened.', temporalRole: 'modified' }),
83
+ unreportableReason: schemaShape.unreportableReason.enumSpec({
84
+ meaning: 'Why the row can never be reported. Present only when the flush state is unreportable.',
85
+ enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'UsageRecordUnreportableReason', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },
86
+ values: {
87
+ [UsageRecordUnreportableReason.BILLING_ACCOUNT_DELETED]: { meaning: 'The billing account row no longer exists, so there is no provider customer to report the usage to. Reachable by design: these rows are retained after their account is gone.' },
88
+ },
89
+ }),
90
+ unreportableAt: schemaShape.unreportableAt.dateSpec({ meaning: 'When the flush determined the row unreportable.', temporalRole: 'modified' }),
74
91
  metadata: schemaShape.metadata.objectSpec({ meaning: 'Extra string tags for product-specific accounting.' }),
75
- createdAt: schemaShape.createdAt.dateSpec({ meaning: 'Row insert time.', temporalRole: 'creation' }),
92
+ createdAt: schemaShape.createdAt.dateSpec({ meaning: 'Record insert time.', temporalRole: 'creation' }),
76
93
  },
77
94
  operations: {
78
95
  [Op.READ]: {
79
96
  purpose: 'Inspect a single usage row in admin or support tools.',
80
97
  outcome: 'Full quantity, timestamp, and source block.',
81
98
  responseStatuses: [
82
- { code: HttpResponseStatusCode.OK_200, meaning: 'The usage row was found and its quantity, timestamp, and source block are returned.' },
99
+ { code: HttpResponseStatusCode.OK_200, meaning: 'The usage record was found and its quantity, timestamp, and source block are returned.' },
83
100
  ],
84
101
  errorScenarios: [
85
102
  { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to read metered-usage rows (reads are org-owner/org-admin-scoped API operations; writes stay system-scoped internal service-pipeline ops, not HTTP-exposed).' },
@@ -112,7 +129,7 @@ function buildUsageRecordBase(resourceType, memberName) {
112
129
  purpose: 'Paginated usage history for a billing account (metering explorer).',
113
130
  outcome: 'Chronological rows for charts and export.',
114
131
  responseStatuses: [
115
- { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) chronological page of usage rows for the billing account.' },
132
+ { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) chronological page of usage records for the billing account.' },
116
133
  ],
117
134
  errorScenarios: [
118
135
  { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to enumerate metered-usage history.' },
@@ -183,7 +200,7 @@ function buildUsageRecordBase(resourceType, memberName) {
183
200
  resourceType: 'documents',
184
201
  operationIdentifier: 'create',
185
202
  },
186
- reportedToProvider: false,
203
+ flushState: UsageRecordFlushState.PENDING,
187
204
  createdAt: '2026-06-15T12:00:01.000Z',
188
205
  ...exampleScope.scopeIdentity,
189
206
  },
@@ -193,9 +210,9 @@ function buildUsageRecordBase(resourceType, memberName) {
193
210
  },
194
211
  [Op.UPDATE]: {
195
212
  purpose: 'Rare correction or provider sync patch paths when policy allows; many fields are not editable in zod for safety.',
196
- outcome: 'Patched metadata or report flags in implementation.',
213
+ outcome: 'Patched metadata or flush state in implementation.',
197
214
  responseStatuses: [
198
- { code: HttpResponseStatusCode.OK_200, meaning: 'The editable subset (metadata / report flags) was patched and the updated usage row is returned.' },
215
+ { code: HttpResponseStatusCode.OK_200, meaning: 'The editable subset (metadata / report flags) was patched and the updated usage record is returned.' },
199
216
  ],
200
217
  errorScenarios: [
201
218
  { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'A non-editable usage field (`quantity`, `productKey`, `timestamp`) was supplied, or the patch otherwise fails schema validation.', errorCode: 'VALIDATION_FAILED' },
@@ -1 +1 @@
1
- {"version":3,"file":"usage-records.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/usage-records.resource.specification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxG,OAAO,EACL,qBAAqB,IAAI,EAAE,EAC3B,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,gCAAgC,GACjC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,sBAAsB,EACtB,mCAAmC,EACnC,6BAA6B,EAC7B,qBAAqB,EACrB,8CAA8C,GAC/C,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kCAAkC,EAClC,uBAAuB,E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,GAAG,oBAAoB,CACvE,gBAAgB,CAAC,kBAAkB,EACnC,oBAAoB,CACrB,CAAC","sourcesContent":["import { billingAdminPresets, billingMainPresets } from '@wildo-ai/presets-components';\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport type { ResourceUIBehaviorConfig } from '@wildo-ai/saas-frontend-lib/companion';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n CoreResourceOperation as Op,\n CoreResourceType,\n ResourcePrimaryScope,\n UsageRecordSchema,\n UsageSourceType,\n usageRecordsPolymorphicFactories,\n} from '@wildo-ai/saas-models';\nimport {\n HttpResponseStatusCode,\n mergeResourceFrontendConfigurations,\n resourceFrontendConfiguration,\n resourceSpecification,\n resourceSpecificationFromFrontendConfiguration,\n} from '~wildo-specifications/_core';\nimport {\n BILLING_API_REFERENCE_PAGE_REQUEST,\n billingApiReferencePage,\n createBillingApiReferenceScopeExample,\n type BillingApiReferenceExampleScope,\n} from './billing-api-reference-examples';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\ntype UsageResourceType = CoreResourceType.ORGANIZATION_USAGE_RECORDS | CoreResourceType.USER_USAGE_RECORDS;\ntype UsageResourceTypeMember = 'ORGANIZATION_USAGE_RECORDS' | 'USER_USAGE_RECORDS';\n\nconst usageResourcePrimaryScopeByResourceType: Record<UsageResourceType, BillingApiReferenceExampleScope> = {\n [CoreResourceType.ORGANIZATION_USAGE_RECORDS]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.USER_USAGE_RECORDS]: ResourcePrimaryScope.USER_SELF,\n};\n\ntype Cfg = ReturnType<(typeof usageRecordsPolymorphicFactories)[CoreResourceType.ORGANIZATION_USAGE_RECORDS]>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = typeof UsageRecordSchema;\ntype UsageFrontend = ResourceUIBehaviorConfig<undefined, Core, Main>;\n\nfunction resolveUsageUI(source: Partial<Record<string, unknown>>, resourceType: UsageResourceType, sourceName: string): UsageFrontend {\n const uiBehavior = source[resourceType] as UsageFrontend | undefined;\n if (!uiBehavior) {\n throw new Error(`Missing \"${resourceType}\" UI behavior in ${sourceName}.`);\n }\n return uiBehavior;\n}\n\nfunction buildUsageRecordBase(resourceType: UsageResourceType, memberName: UsageResourceTypeMember) {\n const exampleScope = createBillingApiReferenceScopeExample(\n usageResourcePrimaryScopeByResourceType[resourceType],\n );\n const usageRecordExample = {\n _id: 'usage_record_01HX2EXAMPLE',\n ...exampleScope.billingAccountIdentity,\n productKey: 'api_calls',\n quantity: 1250,\n timestamp: '2026-06-15T12:00:00.000Z',\n source: {\n type: UsageSourceType.OPERATION,\n resourceType: 'documents',\n operationIdentifier: 'create',\n },\n reportedToProvider: true,\n reportedAt: '2026-06-15T12:05:00.000Z',\n metadata: { region: 'eu-west' },\n createdAt: '2026-06-15T12:00:01.000Z',\n ...exampleScope.scopeIdentity,\n };\n const usageRecordSummaryExample = {\n _id: usageRecordExample._id,\n ...exampleScope.billingAccountIdentity,\n productKey: usageRecordExample.productKey,\n quantity: usageRecordExample.quantity,\n timestamp: usageRecordExample.timestamp,\n };\n\n return resourceSpecification<undefined, Core, Main>(\n usageRecordsPolymorphicFactories[resourceType],\n UsageRecordSchema,\n ({ schemaShape }) => ({\n purpose:\n 'Metered-usage record for a product key: exposes the measured quantity, event timestamp, reporting state, and the API or workflow source that produced it.',\n businessRole: 'Feeds METERED pricing and entitlements; aggregated in analytics and in `BillingState` responses.',\n lifecycleRole:\n 'Created by application metering and exposed as a read-only record. `reportedToProvider` becomes true after the billing provider acknowledges the measured usage.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.BILLING,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'UsageRecordSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactoryCollectionEntry: {\n collectionSymbol: { packageName: '@wildo-ai/saas-models', exportName: 'usageRecordsPolymorphicFactories', symbolKind: CodeSymbolKind.FACTORY },\n identifierField: 'collectionKey',\n identifierValue: resourceType,\n },\n resourceType: { enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM }, memberName },\n operationVocabulary: { coreEnum: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceOperation', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM } },\n frontendConfigurationSourceEntries: [\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingMainPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingAdminPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n ],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Usage document id.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n billingAccountId: schemaShape.billingAccountId.stringSpec({ meaning: 'Polymorphic parent billing account FK.', importance: FieldSemanticImportance.PRIMARY }),\n productKey: schemaShape.productKey.stringSpec({ meaning: 'Catalog product key the usage row charges against (matches product definition).', importance: FieldSemanticImportance.PRIMARY }),\n quantity: schemaShape.quantity.numberSpec({ meaning: 'Non-negative usage amount for the metering window captured in this record.' }),\n timestamp: schemaShape.timestamp.dateSpec({ meaning: 'When the usage event occurred in product time.', temporalRole: 'occurred' }),\n source: schemaShape.source.objectSpec({ meaning: 'Optional origin metadata (type, resourceType, operation id) for support and audits.' }),\n reportedToProvider: schemaShape.reportedToProvider.booleanSpec({ meaning: 'Whether a flush job has pushed this row to the billing provider.' }),\n reportedAt: schemaShape.reportedAt.dateSpec({ meaning: 'When provider acknowledgement happened.', temporalRole: 'modified' }),\n metadata: schemaShape.metadata.objectSpec({ meaning: 'Extra string tags for product-specific accounting.' }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'Row insert time.', temporalRole: 'creation' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Inspect a single usage row in admin or support tools.',\n outcome: 'Full quantity, timestamp, and source block.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The usage row was found and its quantity, timestamp, and source block are returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to read metered-usage rows (reads are org-owner/org-admin-scoped API operations; writes stay system-scoped internal service-pipeline ops, not HTTP-exposed).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No usage record exists for the supplied id in the caller’s billing scope.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Inspect one reported API-usage record',\n response: usageRecordExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Inspect a usage record with available relationship context',\n response: usageRecordExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Inspect the compact usage summary',\n response: usageRecordSummaryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.LIST]: {\n purpose: 'Paginated usage history for a billing account (metering explorer).',\n outcome: 'Chronological rows for charts and export.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) chronological page of usage rows for the billing account.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to enumerate metered-usage history.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Browse metered usage chronologically',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([usageRecordExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Browse usage records with relationship context',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([usageRecordExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Browse compact metered-usage summaries',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([usageRecordSummaryExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.CREATE]: {\n purpose: 'Record an occurrence of metered consumption from application code or workers.',\n outcome: 'New immutable-ish line with not-editable fields enforced in schema.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A metered-usage line was appended for the product key and is returned with its server-assigned id and creation time.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The usage payload is malformed — negative `quantity`, unknown `productKey`, or a non-editable field supplied by the caller.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not the trusted system/metering identity authorised to append usage (the op is an internal service-pipeline op, not exposed over HTTP for arbitrary client writes).' },\n ],\n // Append-only event write: each call records a distinct metered occurrence, so\n // repeating it inserts another row. The runtime does not key these on an\n // idempotency token, so two identical requests double-count by design.\n idempotent: false,\n rateLimitNote: 'High-volume ingestion path — metering hooks and workers should batch and back off; bursty per-event writes may be throttled by the platform.',\n examples: [\n {\n title: 'Record one metered consumption event',\n request: {\n ...exampleScope.billingAccountIdentity,\n productKey: 'api_calls',\n quantity: 1,\n timestamp: '2026-06-15T12:00:00.000Z',\n source: {\n type: UsageSourceType.OPERATION,\n resourceType: 'documents',\n operationIdentifier: 'create',\n },\n },\n response: {\n _id: 'usage_record_unreported_01HX2EXAMPLE',\n ...exampleScope.billingAccountIdentity,\n productKey: 'api_calls',\n quantity: 1,\n timestamp: '2026-06-15T12:00:00.000Z',\n source: {\n type: UsageSourceType.OPERATION,\n resourceType: 'documents',\n operationIdentifier: 'create',\n },\n reportedToProvider: false,\n createdAt: '2026-06-15T12:00:01.000Z',\n ...exampleScope.scopeIdentity,\n },\n forStatus: HttpResponseStatusCode.CREATED_201,\n },\n ],\n },\n [Op.UPDATE]: {\n purpose: 'Rare correction or provider sync patch paths when policy allows; many fields are not editable in zod for safety.',\n outcome: 'Patched metadata or report flags in implementation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The editable subset (metadata / report flags) was patched and the updated usage row is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'A non-editable usage field (`quantity`, `productKey`, `timestamp`) was supplied, or the patch otherwise fails schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner / system role required to correct or re-sync usage rows.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No usage record exists for the supplied id in the caller’s billing scope.' },\n ],\n idempotent: true,\n },\n },\n businessConstraints: ['High-volume append-only usage — UI should not imply arbitrary user edits to historical quantities without a dedicated op.'],\n }),\n { resourcePrimaryScope: usageResourcePrimaryScopeByResourceType[resourceType] },\n );\n}\n\nfunction buildUsageRecordSpec(resourceType: UsageResourceType, memberName: UsageResourceTypeMember) {\n const base = buildUsageRecordBase(resourceType, memberName);\n const main = resolveUsageUI(billingMainPresets as Partial<Record<string, unknown>>, resourceType, 'billingMainPresets');\n const admin = resolveUsageUI(billingAdminPresets as Partial<Record<string, unknown>>, resourceType, 'billingAdminPresets');\n return resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(main), resourceFrontendConfiguration(admin)),\n base,\n () => ({\n label: { purpose: 'Preset stringifies `productKey · quantity` for dense tables.' },\n views: {\n [Op.LIST]: { purpose: 'List op in merged `views` as non-addressable; keep spec aligned with merged preset op map.', whenToUse: 'Embedded list under billing account.' },\n [Op.READ]: { purpose: 'Read op in merged `views` as non-addressable.', whenToUse: 'Row detail in inspector when wired.' },\n },\n }),\n );\n}\n\nexport const organizationUsageRecordsResourceSpecification = buildUsageRecordSpec(\n CoreResourceType.ORGANIZATION_USAGE_RECORDS,\n 'ORGANIZATION_USAGE_RECORDS',\n);\n\nexport const userUsageRecordsResourceSpecification = buildUsageRecordSpec(\n CoreResourceType.USER_USAGE_RECORDS,\n 'USER_USAGE_RECORDS',\n);\n"]}
1
+ {"version":3,"file":"usage-records.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/usage-records.resource.specification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxG,OAAO,EACL,qBAAqB,IAAI,EAAE,EAC3B,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,6BAA6B,EAC7B,eAAe,EACf,gCAAgC,GACjC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,sBAAsB,EACtB,mCAAmC,EACnC,6BAA6B,EAC7B,qBAAqB,EACrB,8CAA8C,GAC/C,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kCAAkC,EAClC,uBAAuB,EACvB,qCAAqC,GAEtC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAK3E,MAAM,uCAAuC,GAA+D;IAC1G,CAAC,gBAAgB,CAAC,0BAA0B,CAAC,EAAE,oBAAoB,CAAC,aAAa;IACjF,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,EAAE,oBAAoB,CAAC,SAAS;CACtE,CAAC;AAOF,SAAS,cAAc,CAAC,MAAwC,EAAE,YAA+B,EAAE,UAAkB;IACnH,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAA8B,CAAC;IACrE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC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,KAAK,CAAC,CAAC,EAC9G,IAAI,EACJ,GAAG,EAAE,CAAC,CAAC;QACL,KAAK,EAAE,EAAE,OAAO,EAAE,8DAA8D,EAAE;QAClF,KAAK,EAAE;YACL,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,4FAA4F,EAAE,SAAS,EAAE,sCAAsC,EAAE;YACvK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,+CAA+C,EAAE,SAAS,EAAE,qCAAqC,EAAE;SAC1H;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,6CAA6C,GAAG,oBAAoB,CAC/E,gBAAgB,CAAC,0BAA0B,EAC3C,4BAA4B,CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,qCAAqC,GAAG,oBAAoB,CACvE,gBAAgB,CAAC,kBAAkB,EACnC,oBAAoB,CACrB,CAAC","sourcesContent":["import { billingAdminPresets, billingMainPresets } from '@wildo-ai/presets-components';\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport type { ResourceUIBehaviorConfig } from '@wildo-ai/saas-frontend-lib/companion';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n CoreResourceOperation as Op,\n CoreResourceType,\n ResourcePrimaryScope,\n UsageRecordSchema,\n UsageRecordFlushState,\n UsageRecordUnreportableReason,\n UsageSourceType,\n usageRecordsPolymorphicFactories,\n} from '@wildo-ai/saas-models';\nimport {\n HttpResponseStatusCode,\n mergeResourceFrontendConfigurations,\n resourceFrontendConfiguration,\n resourceSpecification,\n resourceSpecificationFromFrontendConfiguration,\n} from '~wildo-specifications/_core';\nimport {\n BILLING_API_REFERENCE_PAGE_REQUEST,\n billingApiReferencePage,\n createBillingApiReferenceScopeExample,\n type BillingApiReferenceExampleScope,\n} from './billing-api-reference-examples';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\ntype UsageResourceType = CoreResourceType.ORGANIZATION_USAGE_RECORDS | CoreResourceType.USER_USAGE_RECORDS;\ntype UsageResourceTypeMember = 'ORGANIZATION_USAGE_RECORDS' | 'USER_USAGE_RECORDS';\n\nconst usageResourcePrimaryScopeByResourceType: Record<UsageResourceType, BillingApiReferenceExampleScope> = {\n [CoreResourceType.ORGANIZATION_USAGE_RECORDS]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.USER_USAGE_RECORDS]: ResourcePrimaryScope.USER_SELF,\n};\n\ntype Cfg = ReturnType<(typeof usageRecordsPolymorphicFactories)[CoreResourceType.ORGANIZATION_USAGE_RECORDS]>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = typeof UsageRecordSchema;\ntype UsageFrontend = ResourceUIBehaviorConfig<undefined, Core, Main>;\n\nfunction resolveUsageUI(source: Partial<Record<string, unknown>>, resourceType: UsageResourceType, sourceName: string): UsageFrontend {\n const uiBehavior = source[resourceType] as UsageFrontend | undefined;\n if (!uiBehavior) {\n throw new Error(`Missing \"${resourceType}\" UI behavior in ${sourceName}.`);\n }\n return uiBehavior;\n}\n\nfunction buildUsageRecordBase(resourceType: UsageResourceType, memberName: UsageResourceTypeMember) {\n const exampleScope = createBillingApiReferenceScopeExample(\n usageResourcePrimaryScopeByResourceType[resourceType],\n );\n const usageRecordExample = {\n _id: 'usage_record_01HX2EXAMPLE',\n ...exampleScope.billingAccountIdentity,\n productKey: 'api_calls',\n quantity: 1250,\n timestamp: '2026-06-15T12:00:00.000Z',\n source: {\n type: UsageSourceType.OPERATION,\n resourceType: 'documents',\n operationIdentifier: 'create',\n },\n flushState: UsageRecordFlushState.REPORTED,\n reportedAt: '2026-06-15T12:05:00.000Z',\n metadata: { region: 'eu-west' },\n createdAt: '2026-06-15T12:00:01.000Z',\n ...exampleScope.scopeIdentity,\n };\n const usageRecordSummaryExample = {\n _id: usageRecordExample._id,\n ...exampleScope.billingAccountIdentity,\n productKey: usageRecordExample.productKey,\n quantity: usageRecordExample.quantity,\n timestamp: usageRecordExample.timestamp,\n };\n\n return resourceSpecification<undefined, Core, Main>(\n usageRecordsPolymorphicFactories[resourceType],\n UsageRecordSchema,\n ({ schemaShape }) => ({\n purpose:\n 'Metered-usage record for a product key: exposes the measured quantity, event timestamp, reporting state, and the API or workflow source that produced it.',\n businessRole: 'Feeds METERED pricing and entitlements; aggregated in analytics and in `BillingState` responses.',\n lifecycleRole:\n 'Created by application metering and exposed as a read-only record. `flushState` moves from `pending` to `reported` once the billing provider acknowledges the measured usage, or to `unreportable` when the flush determines it never can — a billing account that no longer exists, for instance, since these rows are retained after their account is gone.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.BILLING,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'UsageRecordSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactoryCollectionEntry: {\n collectionSymbol: { packageName: '@wildo-ai/saas-models', exportName: 'usageRecordsPolymorphicFactories', symbolKind: CodeSymbolKind.FACTORY },\n identifierField: 'collectionKey',\n identifierValue: resourceType,\n },\n resourceType: { enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM }, memberName },\n operationVocabulary: { coreEnum: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceOperation', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM } },\n frontendConfigurationSourceEntries: [\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingMainPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingAdminPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n ],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Usage document id.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n billingAccountId: schemaShape.billingAccountId.stringSpec({ meaning: 'Polymorphic parent billing account FK.', importance: FieldSemanticImportance.PRIMARY }),\n productKey: schemaShape.productKey.stringSpec({ meaning: 'Catalog product key the usage record charges against (matches product definition).', importance: FieldSemanticImportance.PRIMARY }),\n quantity: schemaShape.quantity.numberSpec({ meaning: 'Non-negative usage amount for the metering window captured in this record.' }),\n timestamp: schemaShape.timestamp.dateSpec({ meaning: 'When the usage event occurred in product time.', temporalRole: 'occurred' }),\n source: schemaShape.source.objectSpec({ meaning: 'Optional origin metadata (type, resourceType, operation id) for support and audits.' }),\n flushState: schemaShape.flushState.enumSpec({\n meaning: 'Where the row stands with the provider flush. The flush selects exactly `pending`, so this field alone decides whether the row is still work.',\n importance: FieldSemanticImportance.PRIMARY,\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'UsageRecordFlushState', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [UsageRecordFlushState.PENDING]: { meaning: 'Awaiting a flush. Every newly recorded row starts here.' },\n [UsageRecordFlushState.REPORTED]: { meaning: 'The provider acknowledged the quantity; `reportedAt` says when. Terminal, and money moved.' },\n [UsageRecordFlushState.UNREPORTABLE]: { meaning: 'The flush determined the row can never be reported; `unreportableReason` says why. Terminal, and no money moved.' },\n },\n }),\n reportedAt: schemaShape.reportedAt.dateSpec({ meaning: 'When provider acknowledgement happened.', temporalRole: 'modified' }),\n unreportableReason: schemaShape.unreportableReason.enumSpec({\n meaning: 'Why the row can never be reported. Present only when the flush state is unreportable.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'UsageRecordUnreportableReason', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [UsageRecordUnreportableReason.BILLING_ACCOUNT_DELETED]: { meaning: 'The billing account row no longer exists, so there is no provider customer to report the usage to. Reachable by design: these rows are retained after their account is gone.' },\n },\n }),\n unreportableAt: schemaShape.unreportableAt.dateSpec({ meaning: 'When the flush determined the row unreportable.', temporalRole: 'modified' }),\n metadata: schemaShape.metadata.objectSpec({ meaning: 'Extra string tags for product-specific accounting.' }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'Record insert time.', temporalRole: 'creation' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Inspect a single usage row in admin or support tools.',\n outcome: 'Full quantity, timestamp, and source block.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The usage record was found and its quantity, timestamp, and source block are returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to read metered-usage rows (reads are org-owner/org-admin-scoped API operations; writes stay system-scoped internal service-pipeline ops, not HTTP-exposed).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No usage record exists for the supplied id in the caller’s billing scope.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Inspect one reported API-usage record',\n response: usageRecordExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Inspect a usage record with available relationship context',\n response: usageRecordExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Inspect the compact usage summary',\n response: usageRecordSummaryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.LIST]: {\n purpose: 'Paginated usage history for a billing account (metering explorer).',\n outcome: 'Chronological rows for charts and export.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) chronological page of usage records for the billing account.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to enumerate metered-usage history.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Browse metered usage chronologically',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([usageRecordExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Browse usage records with relationship context',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([usageRecordExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Browse compact metered-usage summaries',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([usageRecordSummaryExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.CREATE]: {\n purpose: 'Record an occurrence of metered consumption from application code or workers.',\n outcome: 'New immutable-ish line with not-editable fields enforced in schema.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A metered-usage line was appended for the product key and is returned with its server-assigned id and creation time.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The usage payload is malformed — negative `quantity`, unknown `productKey`, or a non-editable field supplied by the caller.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not the trusted system/metering identity authorised to append usage (the op is an internal service-pipeline op, not exposed over HTTP for arbitrary client writes).' },\n ],\n // Append-only event write: each call records a distinct metered occurrence, so\n // repeating it inserts another row. The runtime does not key these on an\n // idempotency token, so two identical requests double-count by design.\n idempotent: false,\n rateLimitNote: 'High-volume ingestion path — metering hooks and workers should batch and back off; bursty per-event writes may be throttled by the platform.',\n examples: [\n {\n title: 'Record one metered consumption event',\n request: {\n ...exampleScope.billingAccountIdentity,\n productKey: 'api_calls',\n quantity: 1,\n timestamp: '2026-06-15T12:00:00.000Z',\n source: {\n type: UsageSourceType.OPERATION,\n resourceType: 'documents',\n operationIdentifier: 'create',\n },\n },\n response: {\n _id: 'usage_record_unreported_01HX2EXAMPLE',\n ...exampleScope.billingAccountIdentity,\n productKey: 'api_calls',\n quantity: 1,\n timestamp: '2026-06-15T12:00:00.000Z',\n source: {\n type: UsageSourceType.OPERATION,\n resourceType: 'documents',\n operationIdentifier: 'create',\n },\n flushState: UsageRecordFlushState.PENDING,\n createdAt: '2026-06-15T12:00:01.000Z',\n ...exampleScope.scopeIdentity,\n },\n forStatus: HttpResponseStatusCode.CREATED_201,\n },\n ],\n },\n [Op.UPDATE]: {\n purpose: 'Rare correction or provider sync patch paths when policy allows; many fields are not editable in zod for safety.',\n outcome: 'Patched metadata or flush state in implementation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The editable subset (metadata / report flags) was patched and the updated usage record is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'A non-editable usage field (`quantity`, `productKey`, `timestamp`) was supplied, or the patch otherwise fails schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner / system role required to correct or re-sync usage rows.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No usage record exists for the supplied id in the caller’s billing scope.' },\n ],\n idempotent: true,\n },\n },\n businessConstraints: ['High-volume append-only usage — UI should not imply arbitrary user edits to historical quantities without a dedicated op.'],\n }),\n { resourcePrimaryScope: usageResourcePrimaryScopeByResourceType[resourceType] },\n );\n}\n\nfunction buildUsageRecordSpec(resourceType: UsageResourceType, memberName: UsageResourceTypeMember) {\n const base = buildUsageRecordBase(resourceType, memberName);\n const main = resolveUsageUI(billingMainPresets as Partial<Record<string, unknown>>, resourceType, 'billingMainPresets');\n const admin = resolveUsageUI(billingAdminPresets as Partial<Record<string, unknown>>, resourceType, 'billingAdminPresets');\n return resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(main), resourceFrontendConfiguration(admin)),\n base,\n () => ({\n label: { purpose: 'Preset stringifies `productKey · quantity` for dense tables.' },\n views: {\n [Op.LIST]: { purpose: 'List op in merged `views` as non-addressable; keep spec aligned with merged preset op map.', whenToUse: 'Embedded list under billing account.' },\n [Op.READ]: { purpose: 'Read op in merged `views` as non-addressable.', whenToUse: 'Row detail in inspector when wired.' },\n },\n }),\n );\n}\n\nexport const organizationUsageRecordsResourceSpecification = buildUsageRecordSpec(\n CoreResourceType.ORGANIZATION_USAGE_RECORDS,\n 'ORGANIZATION_USAGE_RECORDS',\n);\n\nexport const userUsageRecordsResourceSpecification = buildUsageRecordSpec(\n CoreResourceType.USER_USAGE_RECORDS,\n 'USER_USAGE_RECORDS',\n);\n"]}
@@ -155,7 +155,7 @@ export const auditLogsResourceSpecification = resourceSpecificationFromFrontendC
155
155
  },
156
156
  }),
157
157
  severity: schemaShape.severity.enumSpec({
158
- meaning: 'UI and export triage level for a row (populated with `eventCategory` by the service classifier on CREATE).',
158
+ meaning: 'UI and export triage level for a record (populated with `eventCategory` by the service classifier on CREATE).',
159
159
  importance: FieldSemanticImportance.PRIMARY,
160
160
  enumDeclaration: {
161
161
  packageName: '@wildo-ai/saas-models',
@@ -171,10 +171,10 @@ export const auditLogsResourceSpecification = resourceSpecificationFromFrontendC
171
171
  }),
172
172
  userId: schemaShape.userId.stringSpec({ meaning: 'Acting user when known; may be empty for system-only events.' }),
173
173
  organizationId: schemaShape.organizationId.foreignKeySpec({
174
- meaning: 'The `organizations` row that owns the tenant context of this event; used to scope and filter the trail per tenant. Optional in cross-tenant or user-only events where no single org owns the row.',
174
+ meaning: 'The `organizations` record that owns the tenant context of this event; used to scope and filter the trail per tenant. Optional in cross-tenant or user-only events where no single org owns the record.',
175
175
  }),
176
176
  applicationId: schemaShape.applicationId.foreignKeySpec({
177
- meaning: 'The `applications` row that owns an application-scoped event. Kept distinct from organization tenancy so application SSO and machine-auth trails never synthesize an organization.',
177
+ meaning: 'The `applications` record that owns an application-scoped event. Kept distinct from organization tenancy so application SSO and machine-auth trails never synthesize an organization.',
178
178
  }),
179
179
  frontendServiceName: schemaShape.frontendServiceName.stringSpec({
180
180
  meaning: 'Frontend surface from which the action originated, when the event came from an interactive request. It can be absent for background or internal activity.',
@@ -186,7 +186,7 @@ export const auditLogsResourceSpecification = resourceSpecificationFromFrontendC
186
186
  meaning: 'Event-specific JSON details. Its keys depend on `eventType`; clients must not assume one payload shape across all event types.',
187
187
  }),
188
188
  riskLevel: schemaShape.riskLevel.enumSpec({
189
- meaning: 'Resource-operation risk tier for the action that generated this log row, when the classifier can map it.',
189
+ meaning: 'Resource-operation risk tier for the action that generated this log record, when the classifier can map it.',
190
190
  enumDeclaration: {
191
191
  packageName: '@wildo-ai/saas-models',
192
192
  exportName: 'ResourceOperationRiskLevel',
@@ -207,7 +207,7 @@ export const auditLogsResourceSpecification = resourceSpecificationFromFrontendC
207
207
  purpose: 'Read one immutable audit event in the addressed organization.',
208
208
  outcome: 'The event’s classification, actor and origin identifiers, timestamp, risk level, and event-specific details are returned.',
209
209
  responseStatuses: [
210
- { code: HttpResponseStatusCode.OK_200, meaning: 'The immutable audit event row for the supplied id was found and its classification, actor, risk tier, and payload are returned.' },
210
+ { code: HttpResponseStatusCode.OK_200, meaning: 'The immutable audit event record for the supplied id was found and its classification, actor, risk tier, and payload are returned.' },
211
211
  ],
212
212
  errorScenarios: [
213
213
  { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No audit event row exists for the supplied id in the caller’s scope.' },
@@ -243,7 +243,7 @@ export const auditLogsResourceSpecification = resourceSpecificationFromFrontendC
243
243
  purpose: 'List immutable audit events in the addressed organization, optionally filtering by classification, actor, application, correlation, client instance, or time window.',
244
244
  outcome: 'A newest-first paginated page of matching events is returned, up to 100 records per page.',
245
245
  responseStatuses: [
246
- { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) paginated page of audit event rows in the caller’s scope.' },
246
+ { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) paginated page of audit event records in the caller’s scope.' },
247
247
  ],
248
248
  errorScenarios: [
249
249
  { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is neither an organization member or administrator nor an application super administrator for the addressed scope.' },
@@ -278,7 +278,7 @@ export const auditLogsResourceSpecification = resourceSpecificationFromFrontendC
278
278
  purpose: 'Filter the organization audit trail by structured fields. This operation does not perform free-text search.',
279
279
  outcome: 'A paginated page of events matching every supplied filter is returned.',
280
280
  responseStatuses: [
281
- { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of audit rows matching the category / severity / time-window / actor filters.' },
281
+ { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of audit records matching the category / severity / time-window / actor filters.' },
282
282
  ],
283
283
  errorScenarios: [
284
284
  { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is neither an organization member or administrator nor an application super administrator for the addressed scope.' },
@@ -303,7 +303,7 @@ export const auditLogsResourceSpecification = resourceSpecificationFromFrontendC
303
303
  purpose: 'Internal write path for new audit rows; repository-only in factory for ingesters.',
304
304
  outcome: 'Immutable append to the log collection under service controls.',
305
305
  responseStatuses: [
306
- { code: HttpResponseStatusCode.CREATED_201, meaning: 'An immutable audit row was appended to the log collection. Internal/service write path — the classifier/ingester appends rows; this is never a self-serve API create, and rows are never updated or deleted afterward.' },
306
+ { code: HttpResponseStatusCode.CREATED_201, meaning: 'An immutable audit record was appended to the log collection. Internal/service write path — the classifier/ingester appends records; this is never a self-serve API create, and records are never updated or deleted afterward.' },
307
307
  ],
308
308
  errorScenarios: [
309
309
  { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The event fails schema validation (e.g. missing the service-classified `eventCategory` / `severity`, or an unknown `eventType`).', errorCode: 'VALIDATION_FAILED' },