@wildo-ai/saas-models 1.1.2 → 1.1.4

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 (645) hide show
  1. package/dist/esm/__tests__/setup.d.ts.map +1 -1
  2. package/dist/esm/_inspect.d.ts.map +1 -1
  3. package/dist/esm/applications/application-metadata.shared.resources-config.schemas.d.ts.map +1 -1
  4. package/dist/esm/applications/application-subject.shared.schemas.d.ts.map +1 -1
  5. package/dist/esm/applications/application-versions.shared.resources-config.schemas.d.ts.map +1 -1
  6. package/dist/esm/applications/applications-context.schemas.d.ts +14 -10
  7. package/dist/esm/applications/applications-context.schemas.d.ts.map +1 -1
  8. package/dist/esm/applications/applications.shared.resources-config.schemas.d.ts.map +1 -1
  9. package/dist/esm/applications/applications.shared.resources-config.schemas.js +4 -3
  10. package/dist/esm/applications/applications.shared.resources-config.schemas.js.map +1 -1
  11. package/dist/esm/applications/applications.shared.schemas.d.ts.map +1 -1
  12. package/dist/esm/billing/billing-account.shared.resources-config.schemas.d.ts.map +1 -1
  13. package/dist/esm/billing/billing-account.shared.schemas.d.ts.map +1 -1
  14. package/dist/esm/billing/billing-configuration.shared.schemas.d.ts +0 -4
  15. package/dist/esm/billing/billing-configuration.shared.schemas.d.ts.map +1 -1
  16. package/dist/esm/billing/billing-configuration.shared.schemas.js +59 -17
  17. package/dist/esm/billing/billing-configuration.shared.schemas.js.map +1 -1
  18. package/dist/esm/billing/billing-enums.shared.schemas.d.ts +77 -21
  19. package/dist/esm/billing/billing-enums.shared.schemas.d.ts.map +1 -1
  20. package/dist/esm/billing/billing-enums.shared.schemas.js +85 -23
  21. package/dist/esm/billing/billing-enums.shared.schemas.js.map +1 -1
  22. package/dist/esm/billing/billing-types.shared.schemas.d.ts +4 -3
  23. package/dist/esm/billing/billing-types.shared.schemas.d.ts.map +1 -1
  24. package/dist/esm/billing/billing-types.shared.schemas.js +45 -0
  25. package/dist/esm/billing/billing-types.shared.schemas.js.map +1 -1
  26. package/dist/esm/billing/credit-pool.shared.resources-config.schemas.d.ts.map +1 -1
  27. package/dist/esm/billing/credit-pool.shared.schemas.d.ts.map +1 -1
  28. package/dist/esm/billing/invoice-ref.shared.resources-config.schemas.d.ts.map +1 -1
  29. package/dist/esm/billing/invoice-ref.shared.schemas.d.ts.map +1 -1
  30. package/dist/esm/billing/price.shared.resources-config.schemas.d.ts.map +1 -1
  31. package/dist/esm/billing/price.shared.schemas.d.ts.map +1 -1
  32. package/dist/esm/billing/price.shared.schemas.js +7 -1
  33. package/dist/esm/billing/price.shared.schemas.js.map +1 -1
  34. package/dist/esm/billing/product-behavior-policy.shared.schemas.d.ts.map +1 -1
  35. package/dist/esm/billing/product-behavior-policy.shared.schemas.js +52 -11
  36. package/dist/esm/billing/product-behavior-policy.shared.schemas.js.map +1 -1
  37. package/dist/esm/billing/product-definition.shared.schemas.d.ts +2 -2
  38. package/dist/esm/billing/product-definition.shared.schemas.d.ts.map +1 -1
  39. package/dist/esm/billing/product.shared.resources-config.schemas.d.ts +2 -2
  40. package/dist/esm/billing/product.shared.resources-config.schemas.d.ts.map +1 -1
  41. package/dist/esm/billing/product.shared.schemas.d.ts +2 -2
  42. package/dist/esm/billing/product.shared.schemas.d.ts.map +1 -1
  43. package/dist/esm/billing/product.shared.schemas.js +7 -3
  44. package/dist/esm/billing/product.shared.schemas.js.map +1 -1
  45. package/dist/esm/billing/promotions.shared.resources-config.schemas.d.ts.map +1 -1
  46. package/dist/esm/billing/promotions.shared.schemas.d.ts.map +1 -1
  47. package/dist/esm/billing/referral.shared.resources-config.schemas.d.ts.map +1 -1
  48. package/dist/esm/billing/referral.shared.schemas.d.ts.map +1 -1
  49. package/dist/esm/billing/subscription.shared.resources-config.schemas.d.ts +1 -1
  50. package/dist/esm/billing/subscription.shared.resources-config.schemas.d.ts.map +1 -1
  51. package/dist/esm/billing/subscription.shared.resources-config.schemas.js +15 -1
  52. package/dist/esm/billing/subscription.shared.resources-config.schemas.js.map +1 -1
  53. package/dist/esm/billing/subscription.shared.schemas.d.ts.map +1 -1
  54. package/dist/esm/billing/usage-record.shared.resources-config.schemas.d.ts.map +1 -1
  55. package/dist/esm/billing/usage-record.shared.schemas.d.ts +7 -3
  56. package/dist/esm/billing/usage-record.shared.schemas.d.ts.map +1 -1
  57. package/dist/esm/billing/usage-record.shared.schemas.js +22 -3
  58. package/dist/esm/billing/usage-record.shared.schemas.js.map +1 -1
  59. package/dist/esm/charts/aggregation-query.shared.schemas.d.ts.map +1 -1
  60. package/dist/esm/charts/chart-definition-builder.shared.d.ts.map +1 -1
  61. package/dist/esm/companion/provider-discovery.shared.schemas.d.ts +71 -2
  62. package/dist/esm/companion/provider-discovery.shared.schemas.d.ts.map +1 -1
  63. package/dist/esm/companion/provider-discovery.shared.schemas.js +20 -1
  64. package/dist/esm/companion/provider-discovery.shared.schemas.js.map +1 -1
  65. package/dist/esm/companion/shared-library-companion.shared.definitions.d.ts.map +1 -1
  66. package/dist/esm/companion-exports.d.ts.map +1 -1
  67. package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.d.ts +85 -0
  68. package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.d.ts.map +1 -0
  69. package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.js +157 -0
  70. package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.js.map +1 -0
  71. package/dist/esm/compliance/audit-trails/audit-log-sink.shared.schemas.d.ts.map +1 -1
  72. package/dist/esm/compliance/audit-trails/audit-logs.shared.resources-config.schemas.d.ts.map +1 -1
  73. package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.d.ts +23 -0
  74. package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.d.ts.map +1 -1
  75. package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.js +56 -0
  76. package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.js.map +1 -1
  77. package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.d.ts +658 -26
  78. package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.d.ts.map +1 -1
  79. package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.js +873 -27
  80. package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.js.map +1 -1
  81. package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.d.ts.map +1 -1
  82. package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.js +104 -3
  83. package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.js.map +1 -1
  84. package/dist/esm/compliance/documents/governed-documents.shared.schemas.d.ts.map +1 -1
  85. package/dist/esm/compliance/privacy/ai-use-posture.shared.schemas.d.ts.map +1 -1
  86. package/dist/esm/compliance/privacy/client-storage.shared.schemas.d.ts.map +1 -1
  87. package/dist/esm/compliance/privacy/data-retention.shared.schemas.d.ts.map +1 -1
  88. package/dist/esm/compliance/privacy/impersonalization-scrub.shared.utils.d.ts.map +1 -1
  89. package/dist/esm/compliance/privacy/impersonalization.shared.schemas.d.ts.map +1 -1
  90. package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.d.ts +54 -26
  91. package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.d.ts.map +1 -1
  92. package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.js +132 -3
  93. package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.js.map +1 -1
  94. package/dist/esm/compliance/privacy/operator-compliance-identity.shared.schemas.d.ts.map +1 -1
  95. package/dist/esm/compliance/privacy/personal-data-category.shared.schemas.d.ts.map +1 -1
  96. package/dist/esm/compliance/privacy/personal-data-declaration.shared.utils.d.ts.map +1 -1
  97. package/dist/esm/compliance/privacy/privacy.shared.schemas.d.ts +17 -0
  98. package/dist/esm/compliance/privacy/privacy.shared.schemas.d.ts.map +1 -1
  99. package/dist/esm/compliance/privacy/privacy.shared.schemas.js +27 -4
  100. package/dist/esm/compliance/privacy/privacy.shared.schemas.js.map +1 -1
  101. package/dist/esm/compliance/privacy/redaction.shared.schemas.d.ts +82 -29
  102. package/dist/esm/compliance/privacy/redaction.shared.schemas.d.ts.map +1 -1
  103. package/dist/esm/compliance/privacy/redaction.shared.schemas.js +95 -29
  104. package/dist/esm/compliance/privacy/redaction.shared.schemas.js.map +1 -1
  105. package/dist/esm/compliance/privacy/retention-schedule.shared.schemas.d.ts.map +1 -1
  106. package/dist/esm/compliance/privacy/subject-erasure.shared.schemas.d.ts.map +1 -1
  107. package/dist/esm/compliance/privacy/subject-export-render.shared.utils.d.ts.map +1 -1
  108. package/dist/esm/compliance/privacy/subject-export.shared.schemas.d.ts.map +1 -1
  109. package/dist/esm/compliance/privacy/subject-export.shared.schemas.js +12 -5
  110. package/dist/esm/compliance/privacy/subject-export.shared.schemas.js.map +1 -1
  111. package/dist/esm/config/analytics-value-moments.shared.schemas.d.ts +21 -0
  112. package/dist/esm/config/analytics-value-moments.shared.schemas.d.ts.map +1 -1
  113. package/dist/esm/config/analytics-value-moments.shared.schemas.js +20 -0
  114. package/dist/esm/config/analytics-value-moments.shared.schemas.js.map +1 -1
  115. package/dist/esm/config/app-configuration-shared.shared.schemas.d.ts +7 -5
  116. package/dist/esm/config/app-configuration-shared.shared.schemas.d.ts.map +1 -1
  117. package/dist/esm/config/auth-config-resolution.shared.utils.d.ts +8 -1
  118. package/dist/esm/config/auth-config-resolution.shared.utils.d.ts.map +1 -1
  119. package/dist/esm/config/auth-config-resolution.shared.utils.js +29 -0
  120. package/dist/esm/config/auth-config-resolution.shared.utils.js.map +1 -1
  121. package/dist/esm/config/brand-assets.shared.schemas.d.ts.map +1 -1
  122. package/dist/esm/config/entity-identity-config.shared.schemas.d.ts +95 -17
  123. package/dist/esm/config/entity-identity-config.shared.schemas.d.ts.map +1 -1
  124. package/dist/esm/config/entity-identity-config.shared.schemas.js +86 -8
  125. package/dist/esm/config/entity-identity-config.shared.schemas.js.map +1 -1
  126. package/dist/esm/config/frontend/chart-definition.shared.schemas.d.ts +26 -26
  127. package/dist/esm/config/frontend/chart-definition.shared.schemas.d.ts.map +1 -1
  128. package/dist/esm/config/frontend/chart-registration-alignment.shared.d.ts +139 -3
  129. package/dist/esm/config/frontend/chart-registration-alignment.shared.d.ts.map +1 -1
  130. package/dist/esm/config/frontend/chart-registration-alignment.shared.js +151 -4
  131. package/dist/esm/config/frontend/chart-registration-alignment.shared.js.map +1 -1
  132. package/dist/esm/config/frontend/navigation.shared.schemas.d.ts.map +1 -1
  133. package/dist/esm/config/frontend/onboarding.shared.schemas.d.ts.map +1 -1
  134. package/dist/esm/config/registration-acquisition-policy.shared.utils.d.ts.map +1 -1
  135. package/dist/esm/config-authoring.entry.d.ts.map +1 -1
  136. package/dist/esm/crdt/crdt-merge.shared.utils.d.ts.map +1 -1
  137. package/dist/esm/data-seeding/data-seeding-config.shared.schemas.d.ts.map +1 -1
  138. package/dist/esm/errors/errors.custom-message-ref.shared.definitions.d.ts +34 -0
  139. package/dist/esm/errors/errors.custom-message-ref.shared.definitions.d.ts.map +1 -1
  140. package/dist/esm/errors/errors.custom-message-ref.shared.definitions.js +34 -0
  141. package/dist/esm/errors/errors.custom-message-ref.shared.definitions.js.map +1 -1
  142. package/dist/esm/errors/errors.shared.definitions.d.ts.map +1 -1
  143. package/dist/esm/errors/errors.shared.schemas.d.ts.map +1 -1
  144. package/dist/esm/errors/errors.shared.utils.d.ts.map +1 -1
  145. package/dist/esm/external-data/external-data-pipeline.shared.schemas.d.ts +45 -12
  146. package/dist/esm/external-data/external-data-pipeline.shared.schemas.d.ts.map +1 -1
  147. package/dist/esm/external-data/external-data-pipeline.shared.schemas.js.map +1 -1
  148. package/dist/esm/external-data.exports.d.ts.map +1 -1
  149. package/dist/esm/external-providers/compose-provider-registry.shared.d.ts.map +1 -1
  150. package/dist/esm/external-providers/engine-capabilities.shared.schemas.d.ts +110 -58
  151. package/dist/esm/external-providers/engine-capabilities.shared.schemas.d.ts.map +1 -1
  152. package/dist/esm/external-providers/engine-capabilities.shared.schemas.js +183 -15
  153. package/dist/esm/external-providers/engine-capabilities.shared.schemas.js.map +1 -1
  154. package/dist/esm/external-providers/engine-capability-resolution-mode.shared.d.ts +15 -3
  155. package/dist/esm/external-providers/engine-capability-resolution-mode.shared.d.ts.map +1 -1
  156. package/dist/esm/external-providers/engine-capability-resolution-mode.shared.js +32 -5
  157. package/dist/esm/external-providers/engine-capability-resolution-mode.shared.js.map +1 -1
  158. package/dist/esm/external-providers/external-providers.shared.schemas.d.ts.map +1 -1
  159. package/dist/esm/external-providers/frontend-bootstrap.shared.schemas.d.ts +87 -7
  160. package/dist/esm/external-providers/frontend-bootstrap.shared.schemas.d.ts.map +1 -1
  161. package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.d.ts +59 -0
  162. package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.d.ts.map +1 -0
  163. package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.js +61 -0
  164. package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.js.map +1 -0
  165. package/dist/esm/external-providers/frontend-capability-runtime.shared.types.d.ts +97 -0
  166. package/dist/esm/external-providers/frontend-capability-runtime.shared.types.d.ts.map +1 -0
  167. package/dist/esm/external-providers/frontend-capability-runtime.shared.types.js +41 -0
  168. package/dist/esm/external-providers/frontend-capability-runtime.shared.types.js.map +1 -0
  169. package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.d.ts +205 -2
  170. package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.d.ts.map +1 -1
  171. package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.js +85 -1
  172. package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.js.map +1 -1
  173. package/dist/esm/external-providers/frontend-provider-public-config.shared.d.ts +175 -0
  174. package/dist/esm/external-providers/frontend-provider-public-config.shared.d.ts.map +1 -0
  175. package/dist/esm/external-providers/frontend-provider-public-config.shared.js +207 -0
  176. package/dist/esm/external-providers/frontend-provider-public-config.shared.js.map +1 -0
  177. package/dist/esm/external-providers/provider-capability.shared.schemas.d.ts +5 -28
  178. package/dist/esm/external-providers/provider-capability.shared.schemas.d.ts.map +1 -1
  179. package/dist/esm/external-providers/provider-capability.shared.schemas.js +4 -2
  180. package/dist/esm/external-providers/provider-capability.shared.schemas.js.map +1 -1
  181. package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.d.ts +28 -8
  182. package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.d.ts.map +1 -1
  183. package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.js +15 -4
  184. package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.js.map +1 -1
  185. package/dist/esm/external-providers/provider-frontend-component-contract.shared.types.d.ts +165 -0
  186. package/dist/esm/external-providers/provider-frontend-component-contract.shared.types.d.ts.map +1 -0
  187. package/dist/esm/external-providers/provider-frontend-component-contract.shared.types.js +39 -0
  188. package/dist/esm/external-providers/provider-frontend-component-contract.shared.types.js.map +1 -0
  189. package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.d.ts +338 -0
  190. package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.d.ts.map +1 -0
  191. package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.js +332 -0
  192. package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.js.map +1 -0
  193. package/dist/esm/external-providers/provider-metadata.shared.schemas.d.ts +178 -9
  194. package/dist/esm/external-providers/provider-metadata.shared.schemas.d.ts.map +1 -1
  195. package/dist/esm/external-providers/provider-metadata.shared.schemas.js +181 -9
  196. package/dist/esm/external-providers/provider-metadata.shared.schemas.js.map +1 -1
  197. package/dist/esm/external-providers/provider-protocol.shared.schemas.d.ts +7 -5
  198. package/dist/esm/external-providers/provider-protocol.shared.schemas.d.ts.map +1 -1
  199. package/dist/esm/external-providers/provider-protocol.shared.schemas.js +7 -5
  200. package/dist/esm/external-providers/provider-protocol.shared.schemas.js.map +1 -1
  201. package/dist/esm/external-providers/provider-tier-rule.shared.utils.d.ts +40 -0
  202. package/dist/esm/external-providers/provider-tier-rule.shared.utils.d.ts.map +1 -0
  203. package/dist/esm/external-providers/provider-tier-rule.shared.utils.js +80 -0
  204. package/dist/esm/external-providers/provider-tier-rule.shared.utils.js.map +1 -0
  205. package/dist/esm/external-providers/provider-usage-pricing.shared.schemas.d.ts.map +1 -1
  206. package/dist/esm/features/application-features.shared.resources-config.schemas.d.ts.map +1 -1
  207. package/dist/esm/features/application-features.shared.resources-config.schemas.js +12 -0
  208. package/dist/esm/features/application-features.shared.resources-config.schemas.js.map +1 -1
  209. package/dist/esm/features/core-feature-definitions.shared.d.ts.map +1 -1
  210. package/dist/esm/features/core-feature-definitions.shared.js +7 -1
  211. package/dist/esm/features/core-feature-definitions.shared.js.map +1 -1
  212. package/dist/esm/features/feature-builders.shared.d.ts +32 -0
  213. package/dist/esm/features/feature-builders.shared.d.ts.map +1 -1
  214. package/dist/esm/features/feature-builders.shared.js +32 -0
  215. package/dist/esm/features/feature-builders.shared.js.map +1 -1
  216. package/dist/esm/features/feature-definition.shared.schemas.d.ts.map +1 -1
  217. package/dist/esm/features/feature-registry.shared.d.ts.map +1 -1
  218. package/dist/esm/features/feature-resolution.shared.schemas.d.ts.map +1 -1
  219. package/dist/esm/features/scope-features.shared.schemas.d.ts.map +1 -1
  220. package/dist/esm/features/user-features.shared.resources-config.schemas.d.ts.map +1 -1
  221. package/dist/esm/features/user-features.shared.resources-config.schemas.js +12 -0
  222. package/dist/esm/features/user-features.shared.resources-config.schemas.js.map +1 -1
  223. package/dist/esm/files/file-remote-reference-link.shared.schemas.d.ts +73 -0
  224. package/dist/esm/files/file-remote-reference-link.shared.schemas.d.ts.map +1 -0
  225. package/dist/esm/files/file-remote-reference-link.shared.schemas.js +62 -0
  226. package/dist/esm/files/file-remote-reference-link.shared.schemas.js.map +1 -0
  227. package/dist/esm/files/file-upload-grant.shared.schemas.d.ts +14 -2
  228. package/dist/esm/files/file-upload-grant.shared.schemas.d.ts.map +1 -1
  229. package/dist/esm/files/file-upload-grant.shared.schemas.js +44 -5
  230. package/dist/esm/files/file-upload-grant.shared.schemas.js.map +1 -1
  231. package/dist/esm/files/files.shared.resources-config.schemas.d.ts.map +1 -1
  232. package/dist/esm/files/files.shared.schemas.d.ts +15 -8
  233. package/dist/esm/files/files.shared.schemas.d.ts.map +1 -1
  234. package/dist/esm/files/files.shared.schemas.js +15 -8
  235. package/dist/esm/files/files.shared.schemas.js.map +1 -1
  236. package/dist/esm/files/files.shared.utils.d.ts.map +1 -1
  237. package/dist/esm/flows-actors/a2a-push-delivery-log.shared.resources-config.schemas.d.ts.map +1 -1
  238. package/dist/esm/flows-actors/a2a-push-delivery-log.shared.schemas.d.ts.map +1 -1
  239. package/dist/esm/flows-actors/a2a-token-budget-state.shared.resources-config.schemas.d.ts.map +1 -1
  240. package/dist/esm/flows-actors/a2a-token-budget-state.shared.schemas.d.ts.map +1 -1
  241. package/dist/esm/flows-actors/actors.shared.schemas.d.ts.map +1 -1
  242. package/dist/esm/flows-actors/actors.shared.schemas.js +3 -2
  243. package/dist/esm/flows-actors/actors.shared.schemas.js.map +1 -1
  244. package/dist/esm/flows-actors/agent-traceability.shared.schemas.d.ts.map +1 -1
  245. package/dist/esm/flows-actors/agents.shared.schemas.d.ts +54 -5
  246. package/dist/esm/flows-actors/agents.shared.schemas.d.ts.map +1 -1
  247. package/dist/esm/flows-actors/agents.shared.schemas.js.map +1 -1
  248. package/dist/esm/flows-actors/apps-blueprint/apps-blueprint.shared.schemas.d.ts.map +1 -1
  249. package/dist/esm/flows-actors/apps-blueprint/artifacts.apps-blueprint.shared.schemas.d.ts.map +1 -1
  250. package/dist/esm/flows-actors/deliberation.shared.schemas.d.ts +0 -3
  251. package/dist/esm/flows-actors/deliberation.shared.schemas.d.ts.map +1 -1
  252. package/dist/esm/flows-actors/deliberation.shared.schemas.js +0 -5
  253. package/dist/esm/flows-actors/deliberation.shared.schemas.js.map +1 -1
  254. package/dist/esm/flows-actors/flows-actors-execution.shared.resources-config.schemas.d.ts.map +1 -1
  255. package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.d.ts +14 -0
  256. package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.d.ts.map +1 -1
  257. package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.js +40 -3
  258. package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.js.map +1 -1
  259. package/dist/esm/flows-actors/flows-actors-task.shared.resources-config.schemas.d.ts.map +1 -1
  260. package/dist/esm/flows-actors/flows-actors-task.shared.schemas.d.ts.map +1 -1
  261. package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.d.ts +19 -0
  262. package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.d.ts.map +1 -1
  263. package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.js +33 -0
  264. package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.js.map +1 -1
  265. package/dist/esm/flows-actors/flows-actors.configuration.shared.schemas.d.ts.map +1 -1
  266. package/dist/esm/flows-actors/flows-actors.frontend.shared.schemas.d.ts.map +1 -1
  267. package/dist/esm/flows-actors/flows-actors.io.shared.schemas.d.ts +14 -9
  268. package/dist/esm/flows-actors/flows-actors.io.shared.schemas.d.ts.map +1 -1
  269. package/dist/esm/flows-actors/flows-actors.io.shared.schemas.js +14 -9
  270. package/dist/esm/flows-actors/flows-actors.io.shared.schemas.js.map +1 -1
  271. package/dist/esm/flows-actors/flows-actors.system.shared.definitions.d.ts.map +1 -1
  272. package/dist/esm/flows-actors/flows-actors.system.shared.schemas.d.ts.map +1 -1
  273. package/dist/esm/flows-actors/flows-actors.system.shared.schemas.js +3 -2
  274. package/dist/esm/flows-actors/flows-actors.system.shared.schemas.js.map +1 -1
  275. package/dist/esm/flows-actors/flows.shared.schemas.d.ts.map +1 -1
  276. package/dist/esm/flows-actors/flows.shared.schemas.js +3 -2
  277. package/dist/esm/flows-actors/flows.shared.schemas.js.map +1 -1
  278. package/dist/esm/flows-actors/mcp-servers.shared.schemas.d.ts +130 -0
  279. package/dist/esm/flows-actors/mcp-servers.shared.schemas.d.ts.map +1 -0
  280. package/dist/esm/flows-actors/mcp-servers.shared.schemas.js +153 -0
  281. package/dist/esm/flows-actors/mcp-servers.shared.schemas.js.map +1 -0
  282. package/dist/esm/flows-actors/meta-workflows/actions.meta-workflows.shared.schemas.d.ts.map +1 -1
  283. package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.d.ts +0 -3
  284. package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.d.ts.map +1 -1
  285. package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.js +1 -4
  286. package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.js.map +1 -1
  287. package/dist/esm/flows-actors/meta-workflows/catalog.meta-workflows.shared.schemas.d.ts.map +1 -1
  288. package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.d.ts +0 -16
  289. package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.d.ts.map +1 -1
  290. package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.js +1 -17
  291. package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.js.map +1 -1
  292. package/dist/esm/flows-actors/meta-workflows/continuity-identifiers.meta-workflows.shared.schemas.d.ts.map +1 -1
  293. package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.d.ts +3 -3
  294. package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.d.ts.map +1 -1
  295. package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.js +3 -3
  296. package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.js.map +1 -1
  297. package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.d.ts +2 -8
  298. package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.d.ts.map +1 -1
  299. package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.js +4 -15
  300. package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.js.map +1 -1
  301. package/dist/esm/flows-actors/meta-workflows/portable-primitives.meta-workflows.shared.schemas.d.ts.map +1 -1
  302. package/dist/esm/flows-actors/prompt-ir.shared.schemas.d.ts.map +1 -1
  303. package/dist/esm/flows-actors/task-continuity-binding.actors.shared.schemas.d.ts.map +1 -1
  304. package/dist/esm/flows-actors/tasks.actors.shared.schemas.d.ts.map +1 -1
  305. package/dist/esm/frontend-definitions/settings-destination-ref.definitions.d.ts +112 -0
  306. package/dist/esm/frontend-definitions/settings-destination-ref.definitions.d.ts.map +1 -0
  307. package/dist/esm/frontend-definitions/settings-destination-ref.definitions.js +113 -0
  308. package/dist/esm/frontend-definitions/settings-destination-ref.definitions.js.map +1 -0
  309. package/dist/esm/guidance/guidance-flow.shared.schemas.d.ts.map +1 -1
  310. package/dist/esm/guidance/guidance-state.shared.resources-config.schemas.d.ts.map +1 -1
  311. package/dist/esm/guidance/guidance-state.shared.schemas.d.ts.map +1 -1
  312. package/dist/esm/guidance/guidance-state.shared.utils.d.ts.map +1 -1
  313. package/dist/esm/guidance/guidance-state.shared.utils.js +1 -0
  314. package/dist/esm/guidance/guidance-state.shared.utils.js.map +1 -1
  315. package/dist/esm/guidance/lifecycle-config.shared.schemas.d.ts.map +1 -1
  316. package/dist/esm/guidance/lifecycle-state.shared.resources-config.schemas.d.ts.map +1 -1
  317. package/dist/esm/guidance/lifecycle-state.shared.schemas.d.ts.map +1 -1
  318. package/dist/esm/guidance/milestone-builders.shared.d.ts.map +1 -1
  319. package/dist/esm/guidance/milestone-definition.shared.schemas.d.ts.map +1 -1
  320. package/dist/esm/guidance/progression-state.shared.resources-config.schemas.d.ts +8 -0
  321. package/dist/esm/guidance/progression-state.shared.resources-config.schemas.d.ts.map +1 -1
  322. package/dist/esm/guidance/progression-state.shared.schemas.d.ts +46 -0
  323. package/dist/esm/guidance/progression-state.shared.schemas.d.ts.map +1 -1
  324. package/dist/esm/guidance/progression-state.shared.schemas.js +49 -0
  325. package/dist/esm/guidance/progression-state.shared.schemas.js.map +1 -1
  326. package/dist/esm/http-api-binding/http-api-binding-id.shared.utils.d.ts.map +1 -1
  327. package/dist/esm/http-api-binding/http-api-binding.shared.schemas.d.ts +320 -50
  328. package/dist/esm/http-api-binding/http-api-binding.shared.schemas.d.ts.map +1 -1
  329. package/dist/esm/http-api-binding/http-api-binding.shared.schemas.js +137 -36
  330. package/dist/esm/http-api-binding/http-api-binding.shared.schemas.js.map +1 -1
  331. package/dist/esm/i18n/labelling.dto.shared.schemas.d.ts.map +1 -1
  332. package/dist/esm/index.d.ts +15 -0
  333. package/dist/esm/index.d.ts.map +1 -1
  334. package/dist/esm/index.js +15 -0
  335. package/dist/esm/index.js.map +1 -1
  336. package/dist/esm/meta-workflows.exports.d.ts.map +1 -1
  337. package/dist/esm/monitoring/monitoring.shared.schemas.d.ts.map +1 -1
  338. package/dist/esm/notifications/email/email-context.shared.schemas.d.ts.map +1 -1
  339. package/dist/esm/notifications/email/email-template-registry.shared.schemas.d.ts +11 -2
  340. package/dist/esm/notifications/email/email-template-registry.shared.schemas.d.ts.map +1 -1
  341. package/dist/esm/notifications/email/email-template-registry.shared.schemas.js.map +1 -1
  342. package/dist/esm/notifications/email/email-template.shared.enums.d.ts +15 -0
  343. package/dist/esm/notifications/email/email-template.shared.enums.d.ts.map +1 -1
  344. package/dist/esm/notifications/email/email-template.shared.enums.js +15 -0
  345. package/dist/esm/notifications/email/email-template.shared.enums.js.map +1 -1
  346. package/dist/esm/notifications/m2m/m2m-webhook-delivery-contract.shared.d.ts.map +1 -1
  347. package/dist/esm/notifications/m2m/m2m-webhook-delivery-log.shared.resources-config.schemas.d.ts.map +1 -1
  348. package/dist/esm/notifications/m2m/m2m-webhook-delivery-log.shared.schemas.d.ts.map +1 -1
  349. package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.d.ts +1 -0
  350. package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.d.ts.map +1 -1
  351. package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.js +19 -0
  352. package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.js.map +1 -1
  353. package/dist/esm/notifications/m2m/webhook-config.shared.schemas.d.ts +30 -0
  354. package/dist/esm/notifications/m2m/webhook-config.shared.schemas.d.ts.map +1 -1
  355. package/dist/esm/notifications/m2m/webhook-config.shared.schemas.js +65 -1
  356. package/dist/esm/notifications/m2m/webhook-config.shared.schemas.js.map +1 -1
  357. package/dist/esm/notifications/notification-badges.core.definitions.d.ts +6 -4
  358. package/dist/esm/notifications/notification-badges.core.definitions.d.ts.map +1 -1
  359. package/dist/esm/notifications/notification-badges.core.definitions.js +6 -4
  360. package/dist/esm/notifications/notification-badges.core.definitions.js.map +1 -1
  361. package/dist/esm/notifications/notification-badges.schemas.d.ts +167 -5
  362. package/dist/esm/notifications/notification-badges.schemas.d.ts.map +1 -1
  363. package/dist/esm/notifications/notification-badges.schemas.js +191 -6
  364. package/dist/esm/notifications/notification-badges.schemas.js.map +1 -1
  365. package/dist/esm/notifications/notification-badges.shared.resources-config.schemas.d.ts.map +1 -1
  366. package/dist/esm/notifications/notifications.shared.schemas.d.ts +158 -0
  367. package/dist/esm/notifications/notifications.shared.schemas.d.ts.map +1 -1
  368. package/dist/esm/notifications/notifications.shared.schemas.js +200 -1
  369. package/dist/esm/notifications/notifications.shared.schemas.js.map +1 -1
  370. package/dist/esm/organizations/organization-features.shared.resources-config.schemas.d.ts.map +1 -1
  371. package/dist/esm/organizations/organization-features.shared.resources-config.schemas.js +13 -0
  372. package/dist/esm/organizations/organization-features.shared.resources-config.schemas.js.map +1 -1
  373. package/dist/esm/organizations/organization-members.shared.resources-config.schemas.d.ts.map +1 -1
  374. package/dist/esm/organizations/organization-members.shared.schemas.d.ts.map +1 -1
  375. package/dist/esm/organizations/organization-notifications.shared.resources-config.schemas.d.ts.map +1 -1
  376. package/dist/esm/organizations/organization-notifications.shared.schemas.d.ts.map +1 -1
  377. package/dist/esm/organizations/organization-notifications.shared.schemas.js +22 -1
  378. package/dist/esm/organizations/organization-notifications.shared.schemas.js.map +1 -1
  379. package/dist/esm/organizations/organization-preferences.shared.resources-config.schemas.d.ts.map +1 -1
  380. package/dist/esm/organizations/organization-preferences.shared.schemas.d.ts +26 -0
  381. package/dist/esm/organizations/organization-preferences.shared.schemas.d.ts.map +1 -1
  382. package/dist/esm/organizations/organization-preferences.shared.schemas.js +25 -0
  383. package/dist/esm/organizations/organization-preferences.shared.schemas.js.map +1 -1
  384. package/dist/esm/organizations/organization-profile.shared.resources-config.schemas.d.ts.map +1 -1
  385. package/dist/esm/organizations/organization-profile.shared.schemas.d.ts +25 -0
  386. package/dist/esm/organizations/organization-profile.shared.schemas.d.ts.map +1 -1
  387. package/dist/esm/organizations/organization-profile.shared.schemas.js +42 -17
  388. package/dist/esm/organizations/organization-profile.shared.schemas.js.map +1 -1
  389. package/dist/esm/organizations/organization-unit-inheritance.shared.d.ts.map +1 -1
  390. package/dist/esm/organizations/organization-unit-members.shared.resources-config.schemas.d.ts.map +1 -1
  391. package/dist/esm/organizations/organization-unit-members.shared.schemas.d.ts.map +1 -1
  392. package/dist/esm/organizations/organization-unit-narrowing-decision.shared.d.ts.map +1 -1
  393. package/dist/esm/organizations/organization-unit-narrowing.example.d.ts.map +1 -1
  394. package/dist/esm/organizations/organization-unit-narrowing.shared.d.ts +3 -2
  395. package/dist/esm/organizations/organization-unit-narrowing.shared.d.ts.map +1 -1
  396. package/dist/esm/organizations/organization-unit-narrowing.shared.js +9 -2
  397. package/dist/esm/organizations/organization-unit-narrowing.shared.js.map +1 -1
  398. package/dist/esm/organizations/organization-units.shared.resources-config.schemas.d.ts.map +1 -1
  399. package/dist/esm/organizations/organization-units.shared.schemas.d.ts.map +1 -1
  400. package/dist/esm/organizations/organizations.shared.resources-config.schemas.d.ts.map +1 -1
  401. package/dist/esm/organizations/organizations.shared.resources-config.schemas.js +18 -3
  402. package/dist/esm/organizations/organizations.shared.resources-config.schemas.js.map +1 -1
  403. package/dist/esm/organizations/organizations.shared.schemas.d.ts.map +1 -1
  404. package/dist/esm/organizations/tenant-teardown-config.shared.schemas.d.ts +13 -0
  405. package/dist/esm/organizations/tenant-teardown-config.shared.schemas.d.ts.map +1 -1
  406. package/dist/esm/organizations/tenant-teardown-config.shared.schemas.js +13 -0
  407. package/dist/esm/organizations/tenant-teardown-config.shared.schemas.js.map +1 -1
  408. package/dist/esm/provider-registration-runtime.exports.d.ts.map +1 -1
  409. package/dist/esm/public-runtime/index.d.ts +71 -2
  410. package/dist/esm/public-runtime/index.d.ts.map +1 -1
  411. package/dist/esm/public-runtime/index.js +62 -1
  412. package/dist/esm/public-runtime/index.js.map +1 -1
  413. package/dist/esm/queue/jobs.shared.resources-config.schemas.d.ts +6 -5
  414. package/dist/esm/queue/jobs.shared.resources-config.schemas.d.ts.map +1 -1
  415. package/dist/esm/queue/jobs.shared.resources-config.schemas.js +6 -5
  416. package/dist/esm/queue/jobs.shared.resources-config.schemas.js.map +1 -1
  417. package/dist/esm/queue/jobs.shared.schemas.d.ts +16 -3
  418. package/dist/esm/queue/jobs.shared.schemas.d.ts.map +1 -1
  419. package/dist/esm/queue/jobs.shared.schemas.js +16 -3
  420. package/dist/esm/queue/jobs.shared.schemas.js.map +1 -1
  421. package/dist/esm/queue/jobs.shared.utils.d.ts.map +1 -1
  422. package/dist/esm/queue/queues.shared.schemas.d.ts.map +1 -1
  423. package/dist/esm/queue/queues.shared.utils.d.ts.map +1 -1
  424. package/dist/esm/requests/manual-controllers-routes-documentation.d.ts +137 -0
  425. package/dist/esm/requests/manual-controllers-routes-documentation.d.ts.map +1 -0
  426. package/dist/esm/requests/manual-controllers-routes-documentation.js +1255 -0
  427. package/dist/esm/requests/manual-controllers-routes-documentation.js.map +1 -0
  428. package/dist/esm/requests/manual-controllers-routes-urls.d.ts +114 -0
  429. package/dist/esm/requests/manual-controllers-routes-urls.d.ts.map +1 -1
  430. package/dist/esm/requests/manual-controllers-routes-urls.js +129 -0
  431. package/dist/esm/requests/manual-controllers-routes-urls.js.map +1 -1
  432. package/dist/esm/requests/rate-limits.shared.schemas.d.ts +11 -1
  433. package/dist/esm/requests/rate-limits.shared.schemas.d.ts.map +1 -1
  434. package/dist/esm/requests/rate-limits.shared.schemas.js +11 -1
  435. package/dist/esm/requests/rate-limits.shared.schemas.js.map +1 -1
  436. package/dist/esm/requests/websocket.shared.schemas.d.ts +28 -3
  437. package/dist/esm/requests/websocket.shared.schemas.d.ts.map +1 -1
  438. package/dist/esm/requests/websocket.shared.schemas.js +52 -0
  439. package/dist/esm/requests/websocket.shared.schemas.js.map +1 -1
  440. package/dist/esm/resources/child-operations.shared.schemas.d.ts.map +1 -1
  441. package/dist/esm/resources/context-policy.shared.schemas.d.ts.map +1 -1
  442. package/dist/esm/resources/relationship-display.shared.schemas.d.ts.map +1 -1
  443. package/dist/esm/resources/resources-config.shared.factory.d.ts +1 -0
  444. package/dist/esm/resources/resources-config.shared.factory.d.ts.map +1 -1
  445. package/dist/esm/resources/resources-config.shared.factory.js +203 -25
  446. package/dist/esm/resources/resources-config.shared.factory.js.map +1 -1
  447. package/dist/esm/resources/resources-config.shared.schemas.d.ts +297 -68
  448. package/dist/esm/resources/resources-config.shared.schemas.d.ts.map +1 -1
  449. package/dist/esm/resources/resources-config.shared.schemas.js.map +1 -1
  450. package/dist/esm/resources/resources-registry.shared.core.definitions.d.ts.map +1 -1
  451. package/dist/esm/resources/resources-registry.shared.core.definitions.js +151 -5
  452. package/dist/esm/resources/resources-registry.shared.core.definitions.js.map +1 -1
  453. package/dist/esm/resources/resources-relationships.shared.factory.d.ts.map +1 -1
  454. package/dist/esm/resources/resources-relationships.shared.factory.js +15 -0
  455. package/dist/esm/resources/resources-relationships.shared.factory.js.map +1 -1
  456. package/dist/esm/resources/resources-serialization.shared.schemas.d.ts.map +1 -1
  457. package/dist/esm/resources/resources.shared.core.definitions.d.ts +54 -0
  458. package/dist/esm/resources/resources.shared.core.definitions.d.ts.map +1 -1
  459. package/dist/esm/resources/resources.shared.core.definitions.js +69 -0
  460. package/dist/esm/resources/resources.shared.core.definitions.js.map +1 -1
  461. package/dist/esm/resources/resources.shared.schemas.d.ts +11 -2
  462. package/dist/esm/resources/resources.shared.schemas.d.ts.map +1 -1
  463. package/dist/esm/resources/resources.shared.schemas.js +34 -3
  464. package/dist/esm/resources/resources.shared.schemas.js.map +1 -1
  465. package/dist/esm/resources/resources.shared.utils.d.ts +32 -7
  466. package/dist/esm/resources/resources.shared.utils.d.ts.map +1 -1
  467. package/dist/esm/resources/resources.shared.utils.js +32 -7
  468. package/dist/esm/resources/resources.shared.utils.js.map +1 -1
  469. package/dist/esm/resources/utils/collection-export.shared.utils.d.ts.map +1 -1
  470. package/dist/esm/resources/utils/composition-cascade-deletability.validation.d.ts.map +1 -1
  471. package/dist/esm/resources/utils/composition-seedability.validation.d.ts.map +1 -1
  472. package/dist/esm/resources/utils/context-addressed-composition-singleton.shared.utils.d.ts.map +1 -1
  473. package/dist/esm/resources/utils/duplicate-relationship-registration.validation.d.ts.map +1 -1
  474. package/dist/esm/resources/utils/field-value-disclosure.utils.d.ts +51 -0
  475. package/dist/esm/resources/utils/field-value-disclosure.utils.d.ts.map +1 -0
  476. package/dist/esm/resources/utils/field-value-disclosure.utils.js +53 -0
  477. package/dist/esm/resources/utils/field-value-disclosure.utils.js.map +1 -0
  478. package/dist/esm/resources/utils/persistence-adapter-discrimination.shared.utils.d.ts.map +1 -1
  479. package/dist/esm/resources/utils/repository-dto-builder.utils.d.ts.map +1 -1
  480. package/dist/esm/resources/utils/required-fk-fillability.validation.d.ts.map +1 -1
  481. package/dist/esm/resources/utils/resource-operation-type-guards.utils.d.ts.map +1 -1
  482. package/dist/esm/resources/utils/resource-polymorphism.factory.d.ts.map +1 -1
  483. package/dist/esm/resources/utils/resource-polymorphism.relationships.d.ts.map +1 -1
  484. package/dist/esm/resources/utils/resource-polymorphism.schemas.d.ts.map +1 -1
  485. package/dist/esm/resources/utils/resource-polymorphism.utils.d.ts.map +1 -1
  486. package/dist/esm/resources/utils/resource-subtree.utils.d.ts.map +1 -1
  487. package/dist/esm/resources/utils/resources-config-context-needs.utils.d.ts.map +1 -1
  488. package/dist/esm/resources/utils/resources-config-operations.dtos-builder.utils.d.ts.map +1 -1
  489. package/dist/esm/resources/utils/resources-config-operations.path.utils.d.ts.map +1 -1
  490. package/dist/esm/resources/utils/resources-config-operations.urls-builder.utils.d.ts.map +1 -1
  491. package/dist/esm/resources/utils/resources-config-operations.utils.d.ts.map +1 -1
  492. package/dist/esm/resources/utils/resources-serialization.utils.d.ts.map +1 -1
  493. package/dist/esm/resources/utils/resources-summary.utils.d.ts +16 -2
  494. package/dist/esm/resources/utils/resources-summary.utils.d.ts.map +1 -1
  495. package/dist/esm/resources/utils/resources-summary.utils.js +19 -5
  496. package/dist/esm/resources/utils/resources-summary.utils.js.map +1 -1
  497. package/dist/esm/resources/utils/schema-family-builder.utils.d.ts.map +1 -1
  498. package/dist/esm/resources/utils/schema-type-inference.utils.d.ts.map +1 -1
  499. package/dist/esm/resources/utils/schema-type-utils.d.ts.map +1 -1
  500. package/dist/esm/resources/utils/schema-variant-resolver.utils.d.ts.map +1 -1
  501. package/dist/esm/resources/utils/shared-persistence-collection.utils.d.ts.map +1 -1
  502. package/dist/esm/resources/utils/shared-persistence-collection.utils.js +11 -0
  503. package/dist/esm/resources/utils/shared-persistence-collection.utils.js.map +1 -1
  504. package/dist/esm/resources/utils/templatable-file-fields.shared.utils.d.ts.map +1 -1
  505. package/dist/esm/runtime/domain-module.shared.definitions.d.ts +25 -0
  506. package/dist/esm/runtime/domain-module.shared.definitions.d.ts.map +1 -1
  507. package/dist/esm/runtime/domain-module.shared.definitions.js.map +1 -1
  508. package/dist/esm/runtime/execution-context.shared.schemas.d.ts.map +1 -1
  509. package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.d.ts +1 -0
  510. package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.d.ts.map +1 -1
  511. package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.js +38 -0
  512. package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.js.map +1 -1
  513. package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.d.ts +1 -0
  514. package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.d.ts.map +1 -1
  515. package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.js +38 -0
  516. package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.js.map +1 -1
  517. package/dist/esm/security/api-keys/api-keys.shared.schemas.d.ts.map +1 -1
  518. package/dist/esm/security/authentications/anonymous-session/anonymous-session.shared.contract.d.ts.map +1 -1
  519. package/dist/esm/security/authentications/authentication.shared.dto.schemas.d.ts +5 -12
  520. package/dist/esm/security/authentications/authentication.shared.dto.schemas.d.ts.map +1 -1
  521. package/dist/esm/security/authentications/authentication.shared.dto.schemas.js +0 -1
  522. package/dist/esm/security/authentications/authentication.shared.dto.schemas.js.map +1 -1
  523. package/dist/esm/security/authentications/authentication.shared.schemas.d.ts +84 -5
  524. package/dist/esm/security/authentications/authentication.shared.schemas.d.ts.map +1 -1
  525. package/dist/esm/security/authentications/authentication.shared.schemas.js +83 -3
  526. package/dist/esm/security/authentications/authentication.shared.schemas.js.map +1 -1
  527. package/dist/esm/security/authentications/authentication.shared.utils.d.ts.map +1 -1
  528. package/dist/esm/security/authentications/consumable-token.shared.schemas.d.ts.map +1 -1
  529. package/dist/esm/security/authentications/consumable-token.shared.schemas.js.map +1 -1
  530. package/dist/esm/security/authentications/cross-frontend-handoff.shared.dto.schemas.d.ts.map +1 -1
  531. package/dist/esm/security/authentications/password-reset.shared.dto.schemas.d.ts.map +1 -1
  532. package/dist/esm/security/authentications/registration.shared.dto.schemas.d.ts +1 -0
  533. package/dist/esm/security/authentications/registration.shared.dto.schemas.d.ts.map +1 -1
  534. package/dist/esm/security/authentications/registration.shared.dto.schemas.js +11 -0
  535. package/dist/esm/security/authentications/registration.shared.dto.schemas.js.map +1 -1
  536. package/dist/esm/security/authentications/scim/scim-organization-unit-mapping.shared.d.ts.map +1 -1
  537. package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.resources-config.schemas.d.ts.map +1 -1
  538. package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.d.ts +15 -0
  539. package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.d.ts.map +1 -1
  540. package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.js +21 -4
  541. package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.js.map +1 -1
  542. package/dist/esm/security/authentications/scim/scim-tokens.shared.resources-config.schemas.d.ts.map +1 -1
  543. package/dist/esm/security/authentications/scim/scim-tokens.shared.schemas.d.ts.map +1 -1
  544. package/dist/esm/security/authentications/siem/siem-delivery-dlq.shared.resources-config.schemas.d.ts.map +1 -1
  545. package/dist/esm/security/authentications/siem/siem-delivery-dlq.shared.schemas.d.ts.map +1 -1
  546. package/dist/esm/security/authentications/siem/siem-delivery-reliability-contract.shared.d.ts.map +1 -1
  547. package/dist/esm/security/authentications/siem/siem-delivery-reliability-contract.shared.js.map +1 -1
  548. package/dist/esm/security/authentications/siem/siem-export-config.shared.resources-config.schemas.d.ts.map +1 -1
  549. package/dist/esm/security/authentications/siem/siem-export-config.shared.schemas.d.ts.map +1 -1
  550. package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.d.ts +61 -1
  551. package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.d.ts.map +1 -1
  552. package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.js +238 -6
  553. package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.js.map +1 -1
  554. package/dist/esm/security/authentications/sso/sso-config.shared.schemas.d.ts +37 -27
  555. package/dist/esm/security/authentications/sso/sso-config.shared.schemas.d.ts.map +1 -1
  556. package/dist/esm/security/authentications/sso/sso-config.shared.schemas.js +134 -12
  557. package/dist/esm/security/authentications/sso/sso-config.shared.schemas.js.map +1 -1
  558. package/dist/esm/security/authentications/sso/sso-connection.shared.resources-config.schemas.d.ts.map +1 -1
  559. package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.d.ts +2 -6
  560. package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.d.ts.map +1 -1
  561. package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.js +32 -8
  562. package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.js.map +1 -1
  563. package/dist/esm/security/authorizations/administrative-continuity.shared.schemas.d.ts +45 -2
  564. package/dist/esm/security/authorizations/administrative-continuity.shared.schemas.d.ts.map +1 -1
  565. package/dist/esm/security/authorizations/administrative-continuity.shared.schemas.js +45 -2
  566. package/dist/esm/security/authorizations/administrative-continuity.shared.schemas.js.map +1 -1
  567. package/dist/esm/security/authorizations/application-access-grants.shared.resources-config.schemas.d.ts +35 -0
  568. package/dist/esm/security/authorizations/application-access-grants.shared.resources-config.schemas.d.ts.map +1 -0
  569. package/dist/esm/security/authorizations/application-access-grants.shared.resources-config.schemas.js +257 -0
  570. package/dist/esm/security/authorizations/application-access-grants.shared.resources-config.schemas.js.map +1 -0
  571. package/dist/esm/security/authorizations/application-access-grants.shared.schemas.d.ts +143 -0
  572. package/dist/esm/security/authorizations/application-access-grants.shared.schemas.d.ts.map +1 -0
  573. package/dist/esm/security/authorizations/application-access-grants.shared.schemas.js +219 -0
  574. package/dist/esm/security/authorizations/application-access-grants.shared.schemas.js.map +1 -0
  575. package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.d.ts.map +1 -1
  576. package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.js +27 -0
  577. package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.js.map +1 -1
  578. package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.d.ts +75 -7
  579. package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.d.ts.map +1 -1
  580. package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.js +69 -8
  581. package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.js.map +1 -1
  582. package/dist/esm/security/authorizations/roles.shared.defaults.d.ts.map +1 -1
  583. package/dist/esm/security/authorizations/roles.shared.schemas.d.ts.map +1 -1
  584. package/dist/esm/security/authorizations/roles.shared.utils.d.ts.map +1 -1
  585. package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.d.ts +31 -0
  586. package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.d.ts.map +1 -0
  587. package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.js +198 -0
  588. package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.js.map +1 -0
  589. package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.d.ts +31 -0
  590. package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.d.ts.map +1 -0
  591. package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.js +191 -0
  592. package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.js.map +1 -0
  593. package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.d.ts +307 -0
  594. package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.d.ts.map +1 -0
  595. package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.js +530 -0
  596. package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.js.map +1 -0
  597. package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.d.ts +4 -1
  598. package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.d.ts.map +1 -1
  599. package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.js +29 -0
  600. package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.js.map +1 -1
  601. package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.d.ts +4 -1
  602. package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.d.ts.map +1 -1
  603. package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.js +29 -0
  604. package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.js.map +1 -1
  605. package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.d.ts +6 -0
  606. package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.d.ts.map +1 -1
  607. package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.js +31 -0
  608. package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.js.map +1 -1
  609. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.resources-config.schemas.d.ts.map +1 -1
  610. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.d.ts +13 -0
  611. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.d.ts.map +1 -1
  612. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.js +24 -3
  613. package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.js.map +1 -1
  614. package/dist/esm/security/oauth-clients/oauth-resource-server.shared.schemas.d.ts.map +1 -1
  615. package/dist/esm/testing/resource-config-builders.d.ts.map +1 -1
  616. package/dist/esm/testing.d.ts.map +1 -1
  617. package/dist/esm/users/anonymous-user-marketing-metadata.shared.schemas.d.ts.map +1 -1
  618. package/dist/esm/users/anonymous-users.shared.resources-config.schemas.d.ts.map +1 -1
  619. package/dist/esm/users/anonymous-users.shared.schema.d.ts.map +1 -1
  620. package/dist/esm/users/inbound-contacts.shared.resources-config.schemas.d.ts.map +1 -1
  621. package/dist/esm/users/inbound-contacts.shared.schemas.d.ts.map +1 -1
  622. package/dist/esm/users/user-credentials.shared.resources-config.schemas.d.ts.map +1 -1
  623. package/dist/esm/users/user-credentials.shared.schemas.d.ts.map +1 -1
  624. package/dist/esm/users/user-identity-links.shared.resources-config.schemas.d.ts.map +1 -1
  625. package/dist/esm/users/user-identity-links.shared.schemas.d.ts.map +1 -1
  626. package/dist/esm/users/user-preferences-reset.shared.utils.d.ts.map +1 -1
  627. package/dist/esm/users/user-preferences.shared.resources-config.schemas.d.ts +4 -4
  628. package/dist/esm/users/user-preferences.shared.resources-config.schemas.d.ts.map +1 -1
  629. package/dist/esm/users/user-profiles.shared.resources-config.schemas.d.ts.map +1 -1
  630. package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.d.ts +4 -4
  631. package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.d.ts.map +1 -1
  632. package/dist/esm/users/user-self-profiles.shared.resources-config.schemas.d.ts.map +1 -1
  633. package/dist/esm/users/user-self.shared.resources-config.schemas.d.ts.map +1 -1
  634. package/dist/esm/users/user-self.shared.resources-config.schemas.js +33 -3
  635. package/dist/esm/users/user-self.shared.resources-config.schemas.js.map +1 -1
  636. package/dist/esm/users/users.shared.resources-config.schemas.d.ts +17 -1
  637. package/dist/esm/users/users.shared.resources-config.schemas.d.ts.map +1 -1
  638. package/dist/esm/users/users.shared.resources-config.schemas.js +136 -5
  639. package/dist/esm/users/users.shared.resources-config.schemas.js.map +1 -1
  640. package/dist/esm/users/users.shared.schemas.d.ts +60 -13
  641. package/dist/esm/users/users.shared.schemas.d.ts.map +1 -1
  642. package/dist/esm/users/users.shared.schemas.js +56 -9
  643. package/dist/esm/users/users.shared.schemas.js.map +1 -1
  644. package/dist/tsconfig.build.tsbuildinfo +1 -1
  645. package/package.json +4 -4
@@ -0,0 +1,530 @@
1
+ /**
2
+ * Organization Provider Credentials — shared schemas.
3
+ *
4
+ * ## What this resource is, and what it is NOT
5
+ *
6
+ * It is an ORGANIZATION's OWN credential toward a third party: the Slack workspace token, the CRM
7
+ * API key, the SMTP password that belongs to THAT tenant. The organization is the third-party
8
+ * principal, and the credential is a service credential the tenant's administrator supplies.
9
+ *
10
+ * It is NOT a user's delegated OAuth grant. A delegated grant is a different object with a
11
+ * different lifetime (a refresh loop, a revocation the USER can perform, a consent record) and it
12
+ * lands as `connected accounts` beside this file — see issue #333. Merging the two would give one
13
+ * row two owners and two revocation semantics.
14
+ *
15
+ * ## Why it has to exist
16
+ *
17
+ * Before this resource, every provider secret resolved from `process.env` through the
18
+ * `SecretsContract`, so a credential was per-PROCESS and per-DEPLOYMENT. One application serving
19
+ * many organizations therefore had ONE Slack token for all of them, and the failure was silent in
20
+ * the worst direction: an operator sets one key and every tenant thereafter acts as the SAME
21
+ * third-party principal, with nothing anywhere saying so.
22
+ *
23
+ * ## The value is sealed, and this file is where that is stated
24
+ *
25
+ * `secretValue` holds an AES-256-GCM envelope, never the plaintext an operator typed. The seal is
26
+ * applied on the way in and opened only by the resolver — see
27
+ * `provider-credential-envelope.backend.utils.ts` for the envelope and its key derivation. The
28
+ * schema cannot enforce that (a string is a string), so the write path is what guarantees it and
29
+ * the pins are what keep it guaranteed.
30
+ */
31
+ import { z } from 'zod';
32
+ /**
33
+ * Whether the stored credential has been shown to work against the provider.
34
+ *
35
+ * A closed vocabulary rather than a boolean because "we have never tried" and "we tried and it
36
+ * failed" are different states with different operator actions, and a boolean would merge them
37
+ * into the same falsy answer. `UNVALIDATED` is the honest default: storing a credential proves
38
+ * only that somebody typed one.
39
+ */
40
+ export var ProviderCredentialValidationState;
41
+ (function (ProviderCredentialValidationState) {
42
+ /** Stored, never exercised against the provider. The state every credential starts in. */
43
+ ProviderCredentialValidationState["UNVALIDATED"] = "unvalidated";
44
+ /** The provider accepted it on its last use. */
45
+ ProviderCredentialValidationState["VALID"] = "valid";
46
+ /** The provider rejected it on its last use — the operator must rotate it. */
47
+ ProviderCredentialValidationState["INVALID"] = "invalid";
48
+ })(ProviderCredentialValidationState || (ProviderCredentialValidationState = {}));
49
+ /**
50
+ * The organization's credential for one (provider, secret slug) pair.
51
+ *
52
+ * ## The scope identifier is TOP-LEVEL and stays that way
53
+ *
54
+ * `organizationId` is the only `organizationId`-named path in this schema, and nothing nested may
55
+ * ever be named `organizationId` or `userId`. `buildContextualFilter` injects the scope FK by
56
+ * matching that field name at EVERY schema path, so a nested key of the same name adds a phantom
57
+ * exact-subdocument clause and the scoped read silently matches zero rows — a credential that
58
+ * exists and cannot be resolved, which reads exactly like a credential that was never set.
59
+ * `setByUserId` is deliberately spelled so it cannot be caught by that matcher.
60
+ */
61
+ /**
62
+ * WHERE a resolved provider secret came from.
63
+ *
64
+ * The whole point of this slice is that the answer used to be unanswerable: every secret came from
65
+ * `process.env`, so "which principal did this tenant act as?" had one answer for every tenant and
66
+ * nothing recorded it. Making the source an explicit, closed value means an audit reader can see a
67
+ * tenant falling back to the shared deployment credential — the exact condition the resource exists
68
+ * to make visible — instead of having to infer it from an absence.
69
+ */
70
+ export var ProviderCredentialResolutionSource;
71
+ (function (ProviderCredentialResolutionSource) {
72
+ /** The organization's own credential row. The tenant acted as itself. */
73
+ ProviderCredentialResolutionSource["ORGANIZATION_CREDENTIAL"] = "organization_credential";
74
+ /**
75
+ * The deployment's env-projected `SecretsContract`. Legitimate — a single-tenant deployment, or a
76
+ * provider the operator intends every tenant to share — but never silent.
77
+ */
78
+ ProviderCredentialResolutionSource["DEPLOYMENT_ENVIRONMENT"] = "deployment_environment";
79
+ /**
80
+ * A PERSON's own credential row. The application acted as that individual.
81
+ *
82
+ * This member has no sibling fallback, and that asymmetry is deliberate rather than an omission.
83
+ * An organization with no credential of its own may legitimately fall through to the deployment's
84
+ * — an operator can intend every tenant to share one integration. A person cannot: the vendor
85
+ * attributes the act to whoever's token was spent, so acting for someone under the deployment's
86
+ * principal would put the wrong name on the record that outlives us. A person who has connected
87
+ * nothing gets a refusal, not a substitute.
88
+ */
89
+ ProviderCredentialResolutionSource["USER_CREDENTIAL"] = "user_credential";
90
+ })(ProviderCredentialResolutionSource || (ProviderCredentialResolutionSource = {}));
91
+ /** Why a credential row stopped existing. */
92
+ export var ProviderCredentialDeletionReason;
93
+ (function (ProviderCredentialDeletionReason) {
94
+ /** An administrator of the owning tenant removed it. */
95
+ ProviderCredentialDeletionReason["ADMINISTRATOR_REVOKED"] = "administrator_revoked";
96
+ /** The owning organization was purged and the composition cascade removed it with the tenant. */
97
+ ProviderCredentialDeletionReason["ORGANIZATION_PURGED"] = "organization_purged";
98
+ /** The person whose credential it was removed it themselves. */
99
+ ProviderCredentialDeletionReason["OWNER_REVOKED"] = "owner_revoked";
100
+ /**
101
+ * The owning user was erased and the composition cascade destroyed it with them.
102
+ *
103
+ * Distinct from `ORGANIZATION_PURGED` because this one is EVIDENCE: it is what an operator points
104
+ * at when asked whether a subject-erasure request reached the person's third-party credentials.
105
+ * Collapsing the two into a generic "cascade" would make that question unanswerable from the trail.
106
+ */
107
+ ProviderCredentialDeletionReason["USER_ERASED"] = "user_erased";
108
+ })(ProviderCredentialDeletionReason || (ProviderCredentialDeletionReason = {}));
109
+ /**
110
+ * The fields that IDENTIFY a credential within its tenant.
111
+ *
112
+ * One tenant holds at most one credential per (provider, slug). Exported rather than repeated so
113
+ * the uniqueness contract, the resolver's lookup and the tests cannot drift apart — three copies
114
+ * of a compound key is how two of them come to disagree about what identity means.
115
+ */
116
+ export const ORGANIZATION_PROVIDER_CREDENTIAL_IDENTITY_FIELDS = [
117
+ 'organizationId',
118
+ 'providerRef',
119
+ 'secretSlug',
120
+ ];
121
+ export const OrganizationProviderCredentialSchema = z.object({
122
+ _id: z.string().min(1).isPrimaryKey().isSummaryField(),
123
+ /**
124
+ * The tenant that owns this credential. Injected by the context machinery from the request
125
+ * scope, never from a caller-supplied field — which is what makes the isolation structural
126
+ * rather than a filter somebody has to remember to write.
127
+ */
128
+ organizationId: z.string().min(1).isDBIndexed().isForeignKey().isSummaryField().excludeFromUpdate(),
129
+ /**
130
+ * The provider this credential authenticates toward (`slack`, `stripe`, a generated package's
131
+ * ref). An OPEN string, matching `ProviderRef`'s own openness — the whole point of the provider
132
+ * work is that the set is not closed, so a closed enum here would refuse every generated
133
+ * provider.
134
+ */
135
+ providerRef: z.string().min(1).max(200).isDBIndexed().isSummaryField().excludeFromUpdate(),
136
+ /**
137
+ * The slug in the provider's `secretsContract` that this value satisfies — the same identifier
138
+ * the deployment's env projection carries, so the two resolution places name the same thing.
139
+ * Immutable: re-pointing a stored secret at a different slug would silently hand one vendor
140
+ * credential to a different vendor field.
141
+ */
142
+ secretSlug: z.string().min(1).max(200).isDBIndexed().isSummaryField().excludeFromUpdate(),
143
+ /**
144
+ * The credential, SEALED.
145
+ *
146
+ * `.isWriteOnlySecret()` is the framework's write-then-masked contract and is exactly right
147
+ * here: the operator supplies and rotates the value, so it must stay in the CREATE/UPDATE
148
+ * request DTO; the framework redacts it to a placeholder at the client boundary, so no read
149
+ * ever returns it; and the backend keeps the stored content for its own resolution.
150
+ *
151
+ * `.isBackendOnly()` was rejected — it strips the field from the client DTO, so the operator's
152
+ * typed value is dropped before it is ever stored and the surface silently accepts nothing.
153
+ *
154
+ * What is PERSISTED is the envelope, never the plaintext. The write path seals it; a value that
155
+ * reaches persistence unsealed is a defect, not a tolerated legacy shape.
156
+ */
157
+ secretValue: z.string().min(1).isWriteOnlySecret(),
158
+ /**
159
+ * Whether this credential may be spent. An operator can park a credential without deleting it —
160
+ * which matters during an incident, where deleting is not reversible and disabling is.
161
+ */
162
+ enabled: z.boolean().default(true).isDBIndexed().isSummaryField(),
163
+ validationState: z
164
+ .enum(ProviderCredentialValidationState)
165
+ .default(ProviderCredentialValidationState.UNVALIDATED)
166
+ .isDBIndexed()
167
+ .isSummaryField(),
168
+ /**
169
+ * Why the last use failed, when it did. PROVIDER-supplied text about the CREDENTIAL's status —
170
+ * never the credential. A resolver writing anything derived from `secretValue` here would defeat
171
+ * every other precaution in this file, because this field IS client-readable.
172
+ */
173
+ validationError: z.string().max(500).optional().excludeFromCreate().excludeFromUpdate(),
174
+ lastValidatedAt: z.date().optional().excludeFromCreate().excludeFromUpdate(),
175
+ lastUsedAt: z.date().optional().isDBIndexed().excludeFromCreate().excludeFromUpdate(),
176
+ /**
177
+ * WHO set it — the acting user's id, recorded for the audit trail.
178
+ *
179
+ * Deliberately NOT a registered `USERS` relationship. Declaring that edge would put a CREDENTIAL
180
+ * row on the Art. 15 subject-export graph, and a credential is precisely the class of row that
181
+ * must never reach a data subject. The id is recorded because "who set this" is the first
182
+ * question of any credential incident; the edge is withheld because the answer must not travel
183
+ * with a subject export.
184
+ */
185
+ setByUserId: z.string().min(1).optional().isDBIndexed().excludeFromCreate().excludeFromUpdate(),
186
+ /** When the stored VALUE last changed — distinct from `updatedAt`, which any field write moves. */
187
+ secretSetAt: z.date().optional().excludeFromCreate().excludeFromUpdate(),
188
+ /** Free-text operator note. Never a place for the value; enforced by the write-path pins. */
189
+ /**
190
+ * Answers for the `{placeholder}` holes this provider's OAuth2 endpoints carry — which cloud,
191
+ * which directory, which region.
192
+ *
193
+ * On the ROW rather than only in the connect flow, because a REFRESH needs them again. The
194
+ * authorization record that held them lives ten minutes; the token it produced is renewed for as
195
+ * long as the connection lasts, and a templated token URL is still templated an hour later.
196
+ * Without them here, every one of the 21 vendors whose endpoints carry a placeholder — Microsoft,
197
+ * Azure, and everything regional — would connect successfully and then fail its first renewal with
198
+ * `needs a value for 'cloud'`: the exact failure the placeholder machinery exists to prevent, one
199
+ * layer up.
200
+ *
201
+ * NOT secret, and deliberately client-readable: a tenant id is an identifier a person needs to see
202
+ * to recognise which account they connected. The secret half is the grant, and it is sealed.
203
+ *
204
+ * `.excludeFromUpdate()` — chosen at connect time, and they describe the ACCOUNT the grant is for.
205
+ * Changing them under a live grant would point the refresh at a different directory than the one
206
+ * that issued the token, failing at the vendor with nothing local explaining why. Reconnecting is
207
+ * the honest way to change them.
208
+ */
209
+ connectionParameters: z.record(z.string(), z.string()).optional().excludeFromUpdate(),
210
+ description: z.string().max(500).optional(),
211
+ createdAt: z.date().default(() => new Date()).isDBIndexed().isSummaryField().excludeFromCreate().excludeFromUpdate(),
212
+ updatedAt: z.date().default(() => new Date()).isDBIndexed().excludeFromCreate().excludeFromUpdate(),
213
+ })
214
+ /**
215
+ * One credential per tenant per (provider, slug), enforced by a compound UNIQUE index rather
216
+ * than by a read-then-write.
217
+ *
218
+ * The race it closes is not academic: two administrators saving a rotated Slack token in the
219
+ * same minute would otherwise leave two rows, and the resolver would then pick one of them
220
+ * arbitrarily — so half the tenant's outbound calls would carry the old credential and nobody
221
+ * could tell which half.
222
+ *
223
+ * No `customMessageReference`: that option exists so an integrator can tell WHICH identity a
224
+ * duplicate violated, and this resource declares exactly one. A dedicated reference here would
225
+ * disambiguate nothing.
226
+ */
227
+ .businessKeySet([...ORGANIZATION_PROVIDER_CREDENTIAL_IDENTITY_FIELDS]);
228
+ // =============================================================================
229
+ // USER-OWNED CREDENTIALS
230
+ // =============================================================================
231
+ /**
232
+ * The fields that IDENTIFY a credential within its OWNER.
233
+ *
234
+ * Exported per owner rather than shared, because the compound key differs in its first component and
235
+ * a single constant would have to be assembled by each side — which is how two copies of a key come
236
+ * to disagree about what identity means.
237
+ */
238
+ export const USER_PROVIDER_CREDENTIAL_IDENTITY_FIELDS = [
239
+ 'userId',
240
+ 'providerRef',
241
+ 'secretSlug',
242
+ ];
243
+ /**
244
+ * A PERSON's own credential toward a third party — the key they authored for themselves.
245
+ *
246
+ * ## Why this is a separate resource and not a nullable column beside the organization's
247
+ *
248
+ * Wildo's tenancy is STRUCTURAL: the contextual filter injects the scope FK by matching a field name
249
+ * at every schema path, so a resource belongs to exactly one primary scope. One table holding both a
250
+ * nullable `organizationId` and a nullable `userId` would turn that structural guarantee into a
251
+ * filter somebody has to remember to write, on the one resource where forgetting it discloses a
252
+ * credential. Two resources, each scoped by construction, is the framework working as designed
253
+ * rather than a duplication.
254
+ *
255
+ * ## Not a delegated OAuth grant, and the difference is not subtle
256
+ *
257
+ * This is a key the user PASTED: they hold an account with the vendor and chose to let this
258
+ * application spend it. A delegated grant is the vendor minting a token because the user approved a
259
+ * consent screen, and it carries a refresh loop, an expiry and a revocation the vendor also honours.
260
+ * Merging them would give one row two lifecycles and two revocation semantics — see #333, which owns
261
+ * the second.
262
+ *
263
+ * ## Only the holder may spend it
264
+ *
265
+ * Not an administrator of their organization, and not a platform operator. Consent to STORE a
266
+ * personal key is not consent for somebody else to use it, and the vendor would record the act as
267
+ * the holder's own. The authorization side of that is
268
+ * `InitiatorMembershipConnectionTargetAuthorization`; this schema is what makes the row reachable
269
+ * only through the owner's own scope.
270
+ */
271
+ export const UserProviderCredentialSchema = z.object({
272
+ _id: z.string().min(1).isPrimaryKey().isSummaryField(),
273
+ /**
274
+ * The person who owns this credential. Injected by the context machinery from the authenticated
275
+ * scope, never from a caller-supplied field — the same structural isolation the organization-owned
276
+ * sibling relies on, which is what makes "another user's key" unreachable rather than filtered.
277
+ */
278
+ userId: z.string().min(1).isDBIndexed().isForeignKey().isSummaryField().excludeFromUpdate(),
279
+ /** As the organization-owned sibling: an OPEN string, because the provider set is not closed. */
280
+ providerRef: z.string().min(1).max(200).isDBIndexed().isSummaryField().excludeFromUpdate(),
281
+ /** The slug in the provider's `secretsContract` this value satisfies. Immutable, for the same
282
+ * reason as the sibling: re-pointing a stored secret at a different slug would hand one vendor
283
+ * credential to a different vendor field. */
284
+ secretSlug: z.string().min(1).max(200).isDBIndexed().isSummaryField().excludeFromUpdate(),
285
+ /**
286
+ * The credential, SEALED — an AES-256-GCM envelope bound to this row's identity, never plaintext.
287
+ *
288
+ * `.isWriteOnlySecret()` for the same reason as the sibling: the holder supplies and rotates it, so
289
+ * it must survive into the CREATE/UPDATE request DTO, and the framework masks it at the client
290
+ * boundary so no read ever returns it.
291
+ */
292
+ secretValue: z.string().min(1).isWriteOnlySecret(),
293
+ enabled: z.boolean().default(true).isDBIndexed().isSummaryField(),
294
+ validationState: z
295
+ .enum(ProviderCredentialValidationState)
296
+ .default(ProviderCredentialValidationState.UNVALIDATED)
297
+ .isDBIndexed()
298
+ .isSummaryField(),
299
+ /** Why the last use failed. PROVIDER text about the CREDENTIAL, never anything derived from it —
300
+ * this field IS client-readable. */
301
+ validationError: z.string().max(500).optional().excludeFromCreate().excludeFromUpdate(),
302
+ lastValidatedAt: z.date().optional().excludeFromCreate().excludeFromUpdate(),
303
+ lastUsedAt: z.date().optional().isDBIndexed().excludeFromCreate().excludeFromUpdate(),
304
+ /** When the stored VALUE last changed — distinct from `updatedAt`, which any field write moves. */
305
+ secretSetAt: z.date().optional().excludeFromCreate().excludeFromUpdate(),
306
+ /** The holder's own note. Never a place for the value; enforced by the write-path pins. */
307
+ /**
308
+ * Answers for the `{placeholder}` holes this provider's OAuth2 endpoints carry — which cloud,
309
+ * which directory, which region.
310
+ *
311
+ * On the ROW rather than only in the connect flow, because a REFRESH needs them again. The
312
+ * authorization record that held them lives ten minutes; the token it produced is renewed for as
313
+ * long as the connection lasts, and a templated token URL is still templated an hour later.
314
+ * Without them here, every one of the 21 vendors whose endpoints carry a placeholder — Microsoft,
315
+ * Azure, and everything regional — would connect successfully and then fail its first renewal with
316
+ * `needs a value for 'cloud'`: the exact failure the placeholder machinery exists to prevent, one
317
+ * layer up.
318
+ *
319
+ * NOT secret, and deliberately client-readable: a tenant id is an identifier a person needs to see
320
+ * to recognise which account they connected. The secret half is the grant, and it is sealed.
321
+ *
322
+ * `.excludeFromUpdate()` — chosen at connect time, and they describe the ACCOUNT the grant is for.
323
+ * Changing them under a live grant would point the refresh at a different directory than the one
324
+ * that issued the token, failing at the vendor with nothing local explaining why. Reconnecting is
325
+ * the honest way to change them.
326
+ */
327
+ connectionParameters: z.record(z.string(), z.string()).optional().excludeFromUpdate(),
328
+ description: z.string().max(500).optional(),
329
+ createdAt: z.date().default(() => new Date()).isDBIndexed().isSummaryField().excludeFromCreate().excludeFromUpdate(),
330
+ updatedAt: z.date().default(() => new Date()).isDBIndexed().excludeFromCreate().excludeFromUpdate(),
331
+ })
332
+ /**
333
+ * One credential per person per (provider, slug), enforced by a compound UNIQUE index rather than
334
+ * a read-then-write — the same race the organization-owned sibling closes, and for the same
335
+ * reason: two rows would leave the resolver picking one arbitrarily, so half the holder's outbound
336
+ * calls would carry a rotated-away credential and nothing would say which half.
337
+ */
338
+ .businessKeySet([...USER_PROVIDER_CREDENTIAL_IDENTITY_FIELDS]);
339
+ // ══════════════════════════════════════════════════════════════════════════════════════════════
340
+ // OAUTH2 GRANTS
341
+ //
342
+ // A credential a vendor MINTS rather than one a person pastes. It rides in the same `secretValue`
343
+ // field of the same two resources — sealed, as JSON — and that reuse is deliberate.
344
+ //
345
+ // ## Why the same rows rather than a third resource
346
+ //
347
+ // The identity is the same triple (owner, providerRef, secretSlug), the ownership semantics are the
348
+ // same, the authorization is the same, the erasure is the same, and the resolver already routes by
349
+ // scope. Only the PAYLOAD differs. A separate resource would duplicate every one of those and force
350
+ // each consumer to ask "which store?" before it could ask anything useful.
351
+ //
352
+ // Note this is the OPPOSITE call from the one that split USER from ORGANIZATION, and the difference
353
+ // is what makes both right: there the TENANCY differed, and tenancy in this framework is structural
354
+ // — one table with a nullable owner would turn a structural guarantee into a filter somebody must
355
+ // remember to write. Here nothing about ownership changes; a string becomes an object.
356
+ // ══════════════════════════════════════════════════════════════════════════════════════════════
357
+ /**
358
+ * What an authorization exchange gives back, as it is stored.
359
+ *
360
+ * Sealed as JSON into `secretValue`, so `.isWriteOnlySecret()` keeps masking it at the client
361
+ * boundary and the envelope keeps binding it to its row — both mechanisms work on a string and
362
+ * neither needs to know the string is structured.
363
+ */
364
+ /**
365
+ * What SHAPE a sealed credential holds, once opened.
366
+ *
367
+ * One member today and a named vocabulary anyway, because the day a second sealed payload exists —
368
+ * a service-account key, a signed JWT assertion — the discriminant is what tells them apart, and a
369
+ * bare literal is where per-member explanation cannot live. It is also the value a reader needs to
370
+ * understand `PROVIDER_OAUTH2_GRANT_PREFIX`: the prefix is how the shape is recognised WITHOUT
371
+ * parsing, and this is what it recognises.
372
+ */
373
+ /**
374
+ * Why a provider cannot be connected HERE, even though the vendor is in the catalogue.
375
+ *
376
+ * "Connectable" is a property of the DEPLOYMENT and not of the vendor, and conflating the two put a
377
+ * Connect button on a screen that could only ever fail. Asana supports OAuth2 perfectly well; this
378
+ * application has simply never registered with Asana, and no amount of pressing the button changes
379
+ * that.
380
+ *
381
+ * The two members lead to different actions by different people, which is the whole reason they are
382
+ * distinguished rather than collapsed into a boolean.
383
+ */
384
+ /**
385
+ * HOW a connection to a provider is established — the shape of the act, which decides the screen.
386
+ *
387
+ * A connect surface cannot be one form. Granting consent at a vendor and typing a key are different
388
+ * acts with different inputs and different failure modes, and a screen that offered one button for
389
+ * both would be wrong for whichever it was not built around.
390
+ */
391
+ export var ProviderAuthMethod;
392
+ (function (ProviderAuthMethod) {
393
+ /** The authorization-code round trip: leave, consent at the vendor, come back with a grant. */
394
+ ProviderAuthMethod["OAUTH2_AUTHORIZATION_CODE"] = "oauth2-authorization-code";
395
+ /**
396
+ * A value somebody holds and types — an API key, a personal access token. The fields are DECLARED
397
+ * by the provider's secrets contract, so a screen names them rather than asking for a slug.
398
+ */
399
+ ProviderAuthMethod["DECLARED_SECRET"] = "declared-secret";
400
+ })(ProviderAuthMethod || (ProviderAuthMethod = {}));
401
+ export var ProviderConnectabilityBlocker;
402
+ (function (ProviderConnectabilityBlocker) {
403
+ /**
404
+ * The vendor has no authorization flow in the catalogue: its credential is PASTED, not granted.
405
+ * Nothing is missing and nothing is broken — this provider is authored on the credential screen
406
+ * instead, and an application author is the one who acts.
407
+ */
408
+ ProviderConnectabilityBlocker["NO_AUTHORIZATION_FLOW"] = "no-authorization-flow";
409
+ /**
410
+ * The vendor has a flow and THIS DEPLOYMENT has not registered with it — no client id, or no client
411
+ * secret. An OPERATOR acts: register an application with the vendor and set the two environment
412
+ * variables the provider's contract names. Distinct from the above because the vendor is perfectly
413
+ * connectable and the gap is ours.
414
+ */
415
+ ProviderConnectabilityBlocker["APPLICATION_NOT_REGISTERED"] = "application-not-registered";
416
+ })(ProviderConnectabilityBlocker || (ProviderConnectabilityBlocker = {}));
417
+ export var ProviderStoredCredentialKind;
418
+ (function (ProviderStoredCredentialKind) {
419
+ /** An OAuth2 grant: an access token, and what is needed to renew it. */
420
+ ProviderStoredCredentialKind["OAUTH2_GRANT"] = "oauth2-grant";
421
+ })(ProviderStoredCredentialKind || (ProviderStoredCredentialKind = {}));
422
+ export const ProviderOAuth2GrantSchema = z.object({
423
+ /**
424
+ * A discriminant, so an opened envelope announces which shape it is.
425
+ *
426
+ * Without it the reader would have to guess from whether the plaintext parses as JSON — and a
427
+ * pasted credential that happens to be JSON (a service-account key, which several vendors issue
428
+ * exactly that way) would be misread as a grant. A guess that is right almost always is the worst
429
+ * kind here, because the failure is a malformed Authorization header on somebody else's account.
430
+ */
431
+ kind: z.literal(ProviderStoredCredentialKind.OAUTH2_GRANT),
432
+ /** The token that actually goes on the wire. */
433
+ accessToken: z.string().min(1),
434
+ /**
435
+ * Present when the vendor issues one. Absent is normal and permanent for vendors that do not —
436
+ * Slack's bot tokens do not expire and have no refresh — so its absence must not read as an
437
+ * incomplete grant.
438
+ */
439
+ refreshToken: z.string().min(1).optional(),
440
+ /**
441
+ * When the access token stops being accepted, as an ISO instant.
442
+ *
443
+ * Optional because a non-expiring token genuinely has none. A grant with a refresh token and no
444
+ * expiry is refreshed only after the vendor rejects it, which is correct but slower than
445
+ * refreshing ahead of a known deadline.
446
+ */
447
+ expiresAt: z.iso.datetime().optional(),
448
+ /**
449
+ * What the vendor actually GRANTED, which is not always what was asked for.
450
+ *
451
+ * Recorded because the difference is invisible until a call fails: a vendor may issue a token for
452
+ * a subset of the requested scopes, and the resulting `missing_scope` arrives on an unrelated
453
+ * operation weeks later. Holding the granted set lets that be answered from the row.
454
+ */
455
+ grantedScopes: z.array(z.string()).optional(),
456
+ /**
457
+ * The vendor's own identifier for the account this grant is on — a Slack team id, a Google sub, a
458
+ * Microsoft tenant id.
459
+ *
460
+ * Not used for lookup and deliberately not part of the row's identity. It exists so a person
461
+ * reading their connections can tell WHICH account they connected, which a provider ref cannot
462
+ * answer for anyone who has two.
463
+ */
464
+ accountRef: z.string().optional(),
465
+ });
466
+ /**
467
+ * The marker that opens the sealed plaintext of a grant rather than a pasted credential.
468
+ *
469
+ * A prefix on the JSON rather than a field inside it, so the decision can be made without parsing —
470
+ * the same reason the envelope carries a prefix. Parsing first would mean feeding an arbitrary
471
+ * pasted credential to `JSON.parse` on every resolution.
472
+ */
473
+ export const PROVIDER_OAUTH2_GRANT_PREFIX = 'wildo-oauth2-grant:';
474
+ /** Whether an OPENED credential is a grant. Cheap, and does not parse. */
475
+ export function isProviderOAuth2GrantPlaintext(plaintext) {
476
+ return plaintext.startsWith(PROVIDER_OAUTH2_GRANT_PREFIX);
477
+ }
478
+ /** Render a grant for sealing. The inverse of {@link parseProviderOAuth2Grant}. */
479
+ export function serializeProviderOAuth2Grant(grant) {
480
+ return `${PROVIDER_OAUTH2_GRANT_PREFIX}${JSON.stringify(grant)}`;
481
+ }
482
+ /**
483
+ * Read a grant back, or `undefined` when the plaintext is an ordinary pasted credential.
484
+ *
485
+ * THROWS when the value announces itself as a grant and then does not parse or does not validate.
486
+ * That is the same posture the envelope takes toward a value the write path could not have
487
+ * produced: a credential which claims a shape it does not have is a fault worth failing on, never
488
+ * one worth falling back from — falling back would put a JSON blob on the wire as a bearer token.
489
+ */
490
+ export function parseProviderOAuth2Grant(plaintext) {
491
+ if (!isProviderOAuth2GrantPlaintext(plaintext))
492
+ return undefined;
493
+ const body = plaintext.slice(PROVIDER_OAUTH2_GRANT_PREFIX.length);
494
+ let parsed;
495
+ try {
496
+ parsed = JSON.parse(body);
497
+ }
498
+ catch {
499
+ throw new Error('A stored provider credential announces itself as an OAuth2 grant and is not valid JSON. It was '
500
+ + 'written by something other than the authorization exchange; reconnect the account.');
501
+ }
502
+ const result = ProviderOAuth2GrantSchema.safeParse(parsed);
503
+ if (!result.success) {
504
+ throw new Error('A stored provider credential announces itself as an OAuth2 grant but does not match the grant '
505
+ + 'shape. Reconnect the account rather than editing the row — the value on the wire would '
506
+ + 'otherwise be a fragment of a token.');
507
+ }
508
+ return result.data;
509
+ }
510
+ /**
511
+ * Whether a grant should be refreshed BEFORE it is spent.
512
+ *
513
+ * The skew is what makes this useful rather than decorative: a token that expires in two seconds is
514
+ * still "valid" and will have expired by the time the request reaches the vendor, so refreshing only
515
+ * on expiry guarantees a population of calls that fail for a reason nothing recorded. Sixty seconds
516
+ * is the industry's common floor and comfortably exceeds any plausible clock skew plus flight time.
517
+ *
518
+ * Returns false when there is no expiry — a non-expiring token is refreshed reactively, after the
519
+ * vendor rejects it, because there is no deadline to act ahead of.
520
+ */
521
+ export const PROVIDER_OAUTH2_REFRESH_SKEW_SECONDS = 60;
522
+ export function providerOAuth2GrantNeedsRefresh(grant, now = new Date()) {
523
+ if (grant.expiresAt === undefined)
524
+ return false;
525
+ const expiry = Date.parse(grant.expiresAt);
526
+ if (Number.isNaN(expiry))
527
+ return true;
528
+ return expiry - now.getTime() <= PROVIDER_OAUTH2_REFRESH_SKEW_SECONDS * 1000;
529
+ }
530
+ //# sourceMappingURL=provider-credentials.shared.schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-credentials.shared.schemas.js","sourceRoot":"","sources":["../../../../src/security/connected-accounts/provider-credentials.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,iCAOX;AAPD,WAAY,iCAAiC;IAC3C,0FAA0F;IAC1F,gEAA2B,CAAA;IAC3B,gDAAgD;IAChD,oDAAe,CAAA;IACf,8EAA8E;IAC9E,wDAAmB,CAAA;AACrB,CAAC,EAPW,iCAAiC,KAAjC,iCAAiC,QAO5C;AAED;;;;;;;;;;;GAWG;AACH;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,kCAmBX;AAnBD,WAAY,kCAAkC;IAC5C,yEAAyE;IACzE,yFAAmD,CAAA;IACnD;;;OAGG;IACH,uFAAiD,CAAA;IACjD;;;;;;;;;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AAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,iGAAiG;cAC/F,oFAAoF,CACvF,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,yBAAyB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,gGAAgG;cAC9F,yFAAyF;cACzF,qCAAqC,CACxC,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,EAAE,CAAC;AAEvD,MAAM,UAAU,+BAA+B,CAAC,KAA0B,EAAE,MAAY,IAAI,IAAI,EAAE;IAChG,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAChD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC3C,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,OAAO,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,IAAI,oCAAoC,GAAG,IAAI,CAAC;AAC/E,CAAC","sourcesContent":["/**\n * Organization Provider Credentials — shared schemas.\n *\n * ## What this resource is, and what it is NOT\n *\n * It is an ORGANIZATION's OWN credential toward a third party: the Slack workspace token, the CRM\n * API key, the SMTP password that belongs to THAT tenant. The organization is the third-party\n * principal, and the credential is a service credential the tenant's administrator supplies.\n *\n * It is NOT a user's delegated OAuth grant. A delegated grant is a different object with a\n * different lifetime (a refresh loop, a revocation the USER can perform, a consent record) and it\n * lands as `connected accounts` beside this file — see issue #333. Merging the two would give one\n * row two owners and two revocation semantics.\n *\n * ## Why it has to exist\n *\n * Before this resource, every provider secret resolved from `process.env` through the\n * `SecretsContract`, so a credential was per-PROCESS and per-DEPLOYMENT. One application serving\n * many organizations therefore had ONE Slack token for all of them, and the failure was silent in\n * the worst direction: an operator sets one key and every tenant thereafter acts as the SAME\n * third-party principal, with nothing anywhere saying so.\n *\n * ## The value is sealed, and this file is where that is stated\n *\n * `secretValue` holds an AES-256-GCM envelope, never the plaintext an operator typed. The seal is\n * applied on the way in and opened only by the resolver — see\n * `provider-credential-envelope.backend.utils.ts` for the envelope and its key derivation. The\n * schema cannot enforce that (a string is a string), so the write path is what guarantees it and\n * the pins are what keep it guaranteed.\n */\n\nimport { z } from 'zod';\n\n/**\n * Whether the stored credential has been shown to work against the provider.\n *\n * A closed vocabulary rather than a boolean because \"we have never tried\" and \"we tried and it\n * failed\" are different states with different operator actions, and a boolean would merge them\n * into the same falsy answer. `UNVALIDATED` is the honest default: storing a credential proves\n * only that somebody typed one.\n */\nexport enum ProviderCredentialValidationState {\n /** Stored, never exercised against the provider. The state every credential starts in. */\n UNVALIDATED = 'unvalidated',\n /** The provider accepted it on its last use. */\n VALID = 'valid',\n /** The provider rejected it on its last use — the operator must rotate it. */\n INVALID = 'invalid',\n}\n\n/**\n * The organization's credential for one (provider, secret slug) pair.\n *\n * ## The scope identifier is TOP-LEVEL and stays that way\n *\n * `organizationId` is the only `organizationId`-named path in this schema, and nothing nested may\n * ever be named `organizationId` or `userId`. `buildContextualFilter` injects the scope FK by\n * matching that field name at EVERY schema path, so a nested key of the same name adds a phantom\n * exact-subdocument clause and the scoped read silently matches zero rows — a credential that\n * exists and cannot be resolved, which reads exactly like a credential that was never set.\n * `setByUserId` is deliberately spelled so it cannot be caught by that matcher.\n */\n/**\n * WHERE a resolved provider secret came from.\n *\n * The whole point of this slice is that the answer used to be unanswerable: every secret came from\n * `process.env`, so \"which principal did this tenant act as?\" had one answer for every tenant and\n * nothing recorded it. Making the source an explicit, closed value means an audit reader can see a\n * tenant falling back to the shared deployment credential — the exact condition the resource exists\n * to make visible — instead of having to infer it from an absence.\n */\nexport enum ProviderCredentialResolutionSource {\n /** The organization's own credential row. The tenant acted as itself. */\n ORGANIZATION_CREDENTIAL = 'organization_credential',\n /**\n * The deployment's env-projected `SecretsContract`. Legitimate — a single-tenant deployment, or a\n * provider the operator intends every tenant to share — but never silent.\n */\n DEPLOYMENT_ENVIRONMENT = 'deployment_environment',\n /**\n * A PERSON's own credential row. The application acted as that individual.\n *\n * This member has no sibling fallback, and that asymmetry is deliberate rather than an omission.\n * An organization with no credential of its own may legitimately fall through to the deployment's\n * — an operator can intend every tenant to share one integration. A person cannot: the vendor\n * attributes the act to whoever's token was spent, so acting for someone under the deployment's\n * principal would put the wrong name on the record that outlives us. A person who has connected\n * nothing gets a refusal, not a substitute.\n */\n USER_CREDENTIAL = 'user_credential',\n}\n\n/** Why a credential row stopped existing. */\nexport enum ProviderCredentialDeletionReason {\n /** An administrator of the owning tenant removed it. */\n ADMINISTRATOR_REVOKED = 'administrator_revoked',\n /** The owning organization was purged and the composition cascade removed it with the tenant. */\n ORGANIZATION_PURGED = 'organization_purged',\n /** The person whose credential it was removed it themselves. */\n OWNER_REVOKED = 'owner_revoked',\n /**\n * The owning user was erased and the composition cascade destroyed it with them.\n *\n * Distinct from `ORGANIZATION_PURGED` because this one is EVIDENCE: it is what an operator points\n * at when asked whether a subject-erasure request reached the person's third-party credentials.\n * Collapsing the two into a generic \"cascade\" would make that question unanswerable from the trail.\n */\n USER_ERASED = 'user_erased',\n}\n\n/**\n * The fields that IDENTIFY a credential within its tenant.\n *\n * One tenant holds at most one credential per (provider, slug). Exported rather than repeated so\n * the uniqueness contract, the resolver's lookup and the tests cannot drift apart — three copies\n * of a compound key is how two of them come to disagree about what identity means.\n */\nexport const ORGANIZATION_PROVIDER_CREDENTIAL_IDENTITY_FIELDS = [\n 'organizationId',\n 'providerRef',\n 'secretSlug',\n] as const;\n\nexport const OrganizationProviderCredentialSchema = z.object({\n _id: z.string().min(1).isPrimaryKey().isSummaryField(),\n\n /**\n * The tenant that owns this credential. Injected by the context machinery from the request\n * scope, never from a caller-supplied field — which is what makes the isolation structural\n * rather than a filter somebody has to remember to write.\n */\n organizationId: z.string().min(1).isDBIndexed().isForeignKey().isSummaryField().excludeFromUpdate(),\n\n /**\n * The provider this credential authenticates toward (`slack`, `stripe`, a generated package's\n * ref). An OPEN string, matching `ProviderRef`'s own openness — the whole point of the provider\n * work is that the set is not closed, so a closed enum here would refuse every generated\n * provider.\n */\n providerRef: z.string().min(1).max(200).isDBIndexed().isSummaryField().excludeFromUpdate(),\n\n /**\n * The slug in the provider's `secretsContract` that this value satisfies — the same identifier\n * the deployment's env projection carries, so the two resolution places name the same thing.\n * Immutable: re-pointing a stored secret at a different slug would silently hand one vendor\n * credential to a different vendor field.\n */\n secretSlug: z.string().min(1).max(200).isDBIndexed().isSummaryField().excludeFromUpdate(),\n\n /**\n * The credential, SEALED.\n *\n * `.isWriteOnlySecret()` is the framework's write-then-masked contract and is exactly right\n * here: the operator supplies and rotates the value, so it must stay in the CREATE/UPDATE\n * request DTO; the framework redacts it to a placeholder at the client boundary, so no read\n * ever returns it; and the backend keeps the stored content for its own resolution.\n *\n * `.isBackendOnly()` was rejected — it strips the field from the client DTO, so the operator's\n * typed value is dropped before it is ever stored and the surface silently accepts nothing.\n *\n * What is PERSISTED is the envelope, never the plaintext. The write path seals it; a value that\n * reaches persistence unsealed is a defect, not a tolerated legacy shape.\n */\n secretValue: z.string().min(1).isWriteOnlySecret(),\n\n /**\n * Whether this credential may be spent. An operator can park a credential without deleting it —\n * which matters during an incident, where deleting is not reversible and disabling is.\n */\n enabled: z.boolean().default(true).isDBIndexed().isSummaryField(),\n\n validationState: z\n .enum(ProviderCredentialValidationState)\n .default(ProviderCredentialValidationState.UNVALIDATED)\n .isDBIndexed()\n .isSummaryField(),\n\n /**\n * Why the last use failed, when it did. PROVIDER-supplied text about the CREDENTIAL's status —\n * never the credential. A resolver writing anything derived from `secretValue` here would defeat\n * every other precaution in this file, because this field IS client-readable.\n */\n validationError: z.string().max(500).optional().excludeFromCreate().excludeFromUpdate(),\n\n lastValidatedAt: z.date().optional().excludeFromCreate().excludeFromUpdate(),\n lastUsedAt: z.date().optional().isDBIndexed().excludeFromCreate().excludeFromUpdate(),\n\n /**\n * WHO set it — the acting user's id, recorded for the audit trail.\n *\n * Deliberately NOT a registered `USERS` relationship. Declaring that edge would put a CREDENTIAL\n * row on the Art. 15 subject-export graph, and a credential is precisely the class of row that\n * must never reach a data subject. The id is recorded because \"who set this\" is the first\n * question of any credential incident; the edge is withheld because the answer must not travel\n * with a subject export.\n */\n setByUserId: z.string().min(1).optional().isDBIndexed().excludeFromCreate().excludeFromUpdate(),\n\n /** When the stored VALUE last changed — distinct from `updatedAt`, which any field write moves. */\n secretSetAt: z.date().optional().excludeFromCreate().excludeFromUpdate(),\n\n /** Free-text operator note. Never a place for the value; enforced by the write-path pins. */\n /**\n * Answers for the `{placeholder}` holes this provider's OAuth2 endpoints carry — which cloud,\n * which directory, which region.\n *\n * On the ROW rather than only in the connect flow, because a REFRESH needs them again. The\n * authorization record that held them lives ten minutes; the token it produced is renewed for as\n * long as the connection lasts, and a templated token URL is still templated an hour later.\n * Without them here, every one of the 21 vendors whose endpoints carry a placeholder — Microsoft,\n * Azure, and everything regional — would connect successfully and then fail its first renewal with\n * `needs a value for 'cloud'`: the exact failure the placeholder machinery exists to prevent, one\n * layer up.\n *\n * NOT secret, and deliberately client-readable: a tenant id is an identifier a person needs to see\n * to recognise which account they connected. The secret half is the grant, and it is sealed.\n *\n * `.excludeFromUpdate()` — chosen at connect time, and they describe the ACCOUNT the grant is for.\n * Changing them under a live grant would point the refresh at a different directory than the one\n * that issued the token, failing at the vendor with nothing local explaining why. Reconnecting is\n * the honest way to change them.\n */\n connectionParameters: z.record(z.string(), z.string()).optional().excludeFromUpdate(),\n\n\n description: z.string().max(500).optional(),\n\n createdAt: z.date().default(() => new Date()).isDBIndexed().isSummaryField().excludeFromCreate().excludeFromUpdate(),\n updatedAt: z.date().default(() => new Date()).isDBIndexed().excludeFromCreate().excludeFromUpdate(),\n})\n /**\n * One credential per tenant per (provider, slug), enforced by a compound UNIQUE index rather\n * than by a read-then-write.\n *\n * The race it closes is not academic: two administrators saving a rotated Slack token in the\n * same minute would otherwise leave two rows, and the resolver would then pick one of them\n * arbitrarily — so half the tenant's outbound calls would carry the old credential and nobody\n * could tell which half.\n *\n * No `customMessageReference`: that option exists so an integrator can tell WHICH identity a\n * duplicate violated, and this resource declares exactly one. A dedicated reference here would\n * disambiguate nothing.\n */\n .businessKeySet([...ORGANIZATION_PROVIDER_CREDENTIAL_IDENTITY_FIELDS]);\n\nexport type OrganizationProviderCredential = z.infer<typeof OrganizationProviderCredentialSchema>;\n\n\n\n// =============================================================================\n// USER-OWNED CREDENTIALS\n// =============================================================================\n\n/**\n * The fields that IDENTIFY a credential within its OWNER.\n *\n * Exported per owner rather than shared, because the compound key differs in its first component and\n * a single constant would have to be assembled by each side — which is how two copies of a key come\n * to disagree about what identity means.\n */\nexport const USER_PROVIDER_CREDENTIAL_IDENTITY_FIELDS = [\n 'userId',\n 'providerRef',\n 'secretSlug',\n] as const;\n\n/**\n * A PERSON's own credential toward a third party — the key they authored for themselves.\n *\n * ## Why this is a separate resource and not a nullable column beside the organization's\n *\n * Wildo's tenancy is STRUCTURAL: the contextual filter injects the scope FK by matching a field name\n * at every schema path, so a resource belongs to exactly one primary scope. One table holding both a\n * nullable `organizationId` and a nullable `userId` would turn that structural guarantee into a\n * filter somebody has to remember to write, on the one resource where forgetting it discloses a\n * credential. Two resources, each scoped by construction, is the framework working as designed\n * rather than a duplication.\n *\n * ## Not a delegated OAuth grant, and the difference is not subtle\n *\n * This is a key the user PASTED: they hold an account with the vendor and chose to let this\n * application spend it. A delegated grant is the vendor minting a token because the user approved a\n * consent screen, and it carries a refresh loop, an expiry and a revocation the vendor also honours.\n * Merging them would give one row two lifecycles and two revocation semantics — see #333, which owns\n * the second.\n *\n * ## Only the holder may spend it\n *\n * Not an administrator of their organization, and not a platform operator. Consent to STORE a\n * personal key is not consent for somebody else to use it, and the vendor would record the act as\n * the holder's own. The authorization side of that is\n * `InitiatorMembershipConnectionTargetAuthorization`; this schema is what makes the row reachable\n * only through the owner's own scope.\n */\nexport const UserProviderCredentialSchema = z.object({\n _id: z.string().min(1).isPrimaryKey().isSummaryField(),\n\n /**\n * The person who owns this credential. Injected by the context machinery from the authenticated\n * scope, never from a caller-supplied field — the same structural isolation the organization-owned\n * sibling relies on, which is what makes \"another user's key\" unreachable rather than filtered.\n */\n userId: z.string().min(1).isDBIndexed().isForeignKey().isSummaryField().excludeFromUpdate(),\n\n /** As the organization-owned sibling: an OPEN string, because the provider set is not closed. */\n providerRef: z.string().min(1).max(200).isDBIndexed().isSummaryField().excludeFromUpdate(),\n\n /** The slug in the provider's `secretsContract` this value satisfies. Immutable, for the same\n * reason as the sibling: re-pointing a stored secret at a different slug would hand one vendor\n * credential to a different vendor field. */\n secretSlug: z.string().min(1).max(200).isDBIndexed().isSummaryField().excludeFromUpdate(),\n\n /**\n * The credential, SEALED — an AES-256-GCM envelope bound to this row's identity, never plaintext.\n *\n * `.isWriteOnlySecret()` for the same reason as the sibling: the holder supplies and rotates it, so\n * it must survive into the CREATE/UPDATE request DTO, and the framework masks it at the client\n * boundary so no read ever returns it.\n */\n secretValue: z.string().min(1).isWriteOnlySecret(),\n\n enabled: z.boolean().default(true).isDBIndexed().isSummaryField(),\n\n validationState: z\n .enum(ProviderCredentialValidationState)\n .default(ProviderCredentialValidationState.UNVALIDATED)\n .isDBIndexed()\n .isSummaryField(),\n\n /** Why the last use failed. PROVIDER text about the CREDENTIAL, never anything derived from it —\n * this field IS client-readable. */\n validationError: z.string().max(500).optional().excludeFromCreate().excludeFromUpdate(),\n\n lastValidatedAt: z.date().optional().excludeFromCreate().excludeFromUpdate(),\n lastUsedAt: z.date().optional().isDBIndexed().excludeFromCreate().excludeFromUpdate(),\n\n /** When the stored VALUE last changed — distinct from `updatedAt`, which any field write moves. */\n secretSetAt: z.date().optional().excludeFromCreate().excludeFromUpdate(),\n\n /** The holder's own note. Never a place for the value; enforced by the write-path pins. */\n /**\n * Answers for the `{placeholder}` holes this provider's OAuth2 endpoints carry — which cloud,\n * which directory, which region.\n *\n * On the ROW rather than only in the connect flow, because a REFRESH needs them again. The\n * authorization record that held them lives ten minutes; the token it produced is renewed for as\n * long as the connection lasts, and a templated token URL is still templated an hour later.\n * Without them here, every one of the 21 vendors whose endpoints carry a placeholder — Microsoft,\n * Azure, and everything regional — would connect successfully and then fail its first renewal with\n * `needs a value for 'cloud'`: the exact failure the placeholder machinery exists to prevent, one\n * layer up.\n *\n * NOT secret, and deliberately client-readable: a tenant id is an identifier a person needs to see\n * to recognise which account they connected. The secret half is the grant, and it is sealed.\n *\n * `.excludeFromUpdate()` — chosen at connect time, and they describe the ACCOUNT the grant is for.\n * Changing them under a live grant would point the refresh at a different directory than the one\n * that issued the token, failing at the vendor with nothing local explaining why. Reconnecting is\n * the honest way to change them.\n */\n connectionParameters: z.record(z.string(), z.string()).optional().excludeFromUpdate(),\n\n\n description: z.string().max(500).optional(),\n\n createdAt: z.date().default(() => new Date()).isDBIndexed().isSummaryField().excludeFromCreate().excludeFromUpdate(),\n updatedAt: z.date().default(() => new Date()).isDBIndexed().excludeFromCreate().excludeFromUpdate(),\n})\n /**\n * One credential per person per (provider, slug), enforced by a compound UNIQUE index rather than\n * a read-then-write — the same race the organization-owned sibling closes, and for the same\n * reason: two rows would leave the resolver picking one arbitrarily, so half the holder's outbound\n * calls would carry a rotated-away credential and nothing would say which half.\n */\n .businessKeySet([...USER_PROVIDER_CREDENTIAL_IDENTITY_FIELDS]);\n\nexport type UserProviderCredential = z.infer<typeof UserProviderCredentialSchema>;\n\n\n// ══════════════════════════════════════════════════════════════════════════════════════════════\n// OAUTH2 GRANTS\n//\n// A credential a vendor MINTS rather than one a person pastes. It rides in the same `secretValue`\n// field of the same two resources — sealed, as JSON — and that reuse is deliberate.\n//\n// ## Why the same rows rather than a third resource\n//\n// The identity is the same triple (owner, providerRef, secretSlug), the ownership semantics are the\n// same, the authorization is the same, the erasure is the same, and the resolver already routes by\n// scope. Only the PAYLOAD differs. A separate resource would duplicate every one of those and force\n// each consumer to ask \"which store?\" before it could ask anything useful.\n//\n// Note this is the OPPOSITE call from the one that split USER from ORGANIZATION, and the difference\n// is what makes both right: there the TENANCY differed, and tenancy in this framework is structural\n// — one table with a nullable owner would turn a structural guarantee into a filter somebody must\n// remember to write. Here nothing about ownership changes; a string becomes an object.\n// ══════════════════════════════════════════════════════════════════════════════════════════════\n\n/**\n * What an authorization exchange gives back, as it is stored.\n *\n * Sealed as JSON into `secretValue`, so `.isWriteOnlySecret()` keeps masking it at the client\n * boundary and the envelope keeps binding it to its row — both mechanisms work on a string and\n * neither needs to know the string is structured.\n */\n/**\n * What SHAPE a sealed credential holds, once opened.\n *\n * One member today and a named vocabulary anyway, because the day a second sealed payload exists —\n * a service-account key, a signed JWT assertion — the discriminant is what tells them apart, and a\n * bare literal is where per-member explanation cannot live. It is also the value a reader needs to\n * understand `PROVIDER_OAUTH2_GRANT_PREFIX`: the prefix is how the shape is recognised WITHOUT\n * parsing, and this is what it recognises.\n */\n/**\n * Why a provider cannot be connected HERE, even though the vendor is in the catalogue.\n *\n * \"Connectable\" is a property of the DEPLOYMENT and not of the vendor, and conflating the two put a\n * Connect button on a screen that could only ever fail. Asana supports OAuth2 perfectly well; this\n * application has simply never registered with Asana, and no amount of pressing the button changes\n * that.\n *\n * The two members lead to different actions by different people, which is the whole reason they are\n * distinguished rather than collapsed into a boolean.\n */\n/**\n * HOW a connection to a provider is established — the shape of the act, which decides the screen.\n *\n * A connect surface cannot be one form. Granting consent at a vendor and typing a key are different\n * acts with different inputs and different failure modes, and a screen that offered one button for\n * both would be wrong for whichever it was not built around.\n */\nexport enum ProviderAuthMethod {\n /** The authorization-code round trip: leave, consent at the vendor, come back with a grant. */\n OAUTH2_AUTHORIZATION_CODE = 'oauth2-authorization-code',\n /**\n * A value somebody holds and types — an API key, a personal access token. The fields are DECLARED\n * by the provider's secrets contract, so a screen names them rather than asking for a slug.\n */\n DECLARED_SECRET = 'declared-secret',\n}\n\nexport enum ProviderConnectabilityBlocker {\n /**\n * The vendor has no authorization flow in the catalogue: its credential is PASTED, not granted.\n * Nothing is missing and nothing is broken — this provider is authored on the credential screen\n * instead, and an application author is the one who acts.\n */\n NO_AUTHORIZATION_FLOW = 'no-authorization-flow',\n /**\n * The vendor has a flow and THIS DEPLOYMENT has not registered with it — no client id, or no client\n * secret. An OPERATOR acts: register an application with the vendor and set the two environment\n * variables the provider's contract names. Distinct from the above because the vendor is perfectly\n * connectable and the gap is ours.\n */\n APPLICATION_NOT_REGISTERED = 'application-not-registered',\n}\n\n/**\n * One secret slot a provider declares, as a SCREEN needs it — never the value.\n *\n * Exists so nothing is typed by hand. The slug names the field, the environment variable tells an\n * operator exactly what to set, and `configured` lets a missing one be REPORTED rather than\n * discovered by pressing a button that fails.\n */\nexport interface ProviderSecretSlotView {\n readonly slug: string;\n readonly envVarName: string;\n readonly required: boolean;\n readonly description: string;\n /** Whether the deployment supplies it. There is deliberately no field for the value. */\n readonly configured: boolean;\n}\n\nexport enum ProviderStoredCredentialKind {\n /** An OAuth2 grant: an access token, and what is needed to renew it. */\n OAUTH2_GRANT = 'oauth2-grant',\n}\n\nexport const ProviderOAuth2GrantSchema = z.object({\n /**\n * A discriminant, so an opened envelope announces which shape it is.\n *\n * Without it the reader would have to guess from whether the plaintext parses as JSON — and a\n * pasted credential that happens to be JSON (a service-account key, which several vendors issue\n * exactly that way) would be misread as a grant. A guess that is right almost always is the worst\n * kind here, because the failure is a malformed Authorization header on somebody else's account.\n */\n kind: z.literal(ProviderStoredCredentialKind.OAUTH2_GRANT),\n\n /** The token that actually goes on the wire. */\n accessToken: z.string().min(1),\n\n /**\n * Present when the vendor issues one. Absent is normal and permanent for vendors that do not —\n * Slack's bot tokens do not expire and have no refresh — so its absence must not read as an\n * incomplete grant.\n */\n refreshToken: z.string().min(1).optional(),\n\n /**\n * When the access token stops being accepted, as an ISO instant.\n *\n * Optional because a non-expiring token genuinely has none. A grant with a refresh token and no\n * expiry is refreshed only after the vendor rejects it, which is correct but slower than\n * refreshing ahead of a known deadline.\n */\n expiresAt: z.iso.datetime().optional(),\n\n /**\n * What the vendor actually GRANTED, which is not always what was asked for.\n *\n * Recorded because the difference is invisible until a call fails: a vendor may issue a token for\n * a subset of the requested scopes, and the resulting `missing_scope` arrives on an unrelated\n * operation weeks later. Holding the granted set lets that be answered from the row.\n */\n grantedScopes: z.array(z.string()).optional(),\n\n /**\n * The vendor's own identifier for the account this grant is on — a Slack team id, a Google sub, a\n * Microsoft tenant id.\n *\n * Not used for lookup and deliberately not part of the row's identity. It exists so a person\n * reading their connections can tell WHICH account they connected, which a provider ref cannot\n * answer for anyone who has two.\n */\n accountRef: z.string().optional(),\n});\n\nexport type ProviderOAuth2Grant = z.infer<typeof ProviderOAuth2GrantSchema>;\n\n/**\n * The marker that opens the sealed plaintext of a grant rather than a pasted credential.\n *\n * A prefix on the JSON rather than a field inside it, so the decision can be made without parsing —\n * the same reason the envelope carries a prefix. Parsing first would mean feeding an arbitrary\n * pasted credential to `JSON.parse` on every resolution.\n */\nexport const PROVIDER_OAUTH2_GRANT_PREFIX = 'wildo-oauth2-grant:';\n\n/** Whether an OPENED credential is a grant. Cheap, and does not parse. */\nexport function isProviderOAuth2GrantPlaintext(plaintext: string): boolean {\n return plaintext.startsWith(PROVIDER_OAUTH2_GRANT_PREFIX);\n}\n\n/** Render a grant for sealing. The inverse of {@link parseProviderOAuth2Grant}. */\nexport function serializeProviderOAuth2Grant(grant: ProviderOAuth2Grant): string {\n return `${PROVIDER_OAUTH2_GRANT_PREFIX}${JSON.stringify(grant)}`;\n}\n\n/**\n * Read a grant back, or `undefined` when the plaintext is an ordinary pasted credential.\n *\n * THROWS when the value announces itself as a grant and then does not parse or does not validate.\n * That is the same posture the envelope takes toward a value the write path could not have\n * produced: a credential which claims a shape it does not have is a fault worth failing on, never\n * one worth falling back from — falling back would put a JSON blob on the wire as a bearer token.\n */\nexport function parseProviderOAuth2Grant(plaintext: string): ProviderOAuth2Grant | undefined {\n if (!isProviderOAuth2GrantPlaintext(plaintext)) return undefined;\n const body = plaintext.slice(PROVIDER_OAUTH2_GRANT_PREFIX.length);\n let parsed: unknown;\n try {\n parsed = JSON.parse(body);\n } catch {\n throw new Error(\n 'A stored provider credential announces itself as an OAuth2 grant and is not valid JSON. It was '\n + 'written by something other than the authorization exchange; reconnect the account.',\n );\n }\n const result = ProviderOAuth2GrantSchema.safeParse(parsed);\n if (!result.success) {\n throw new Error(\n 'A stored provider credential announces itself as an OAuth2 grant but does not match the grant '\n + 'shape. Reconnect the account rather than editing the row — the value on the wire would '\n + 'otherwise be a fragment of a token.',\n );\n }\n return result.data;\n}\n\n/**\n * Whether a grant should be refreshed BEFORE it is spent.\n *\n * The skew is what makes this useful rather than decorative: a token that expires in two seconds is\n * still \"valid\" and will have expired by the time the request reaches the vendor, so refreshing only\n * on expiry guarantees a population of calls that fail for a reason nothing recorded. Sixty seconds\n * is the industry's common floor and comfortably exceeds any plausible clock skew plus flight time.\n *\n * Returns false when there is no expiry — a non-expiring token is refreshed reactively, after the\n * vendor rejects it, because there is no deadline to act ahead of.\n */\nexport const PROVIDER_OAUTH2_REFRESH_SKEW_SECONDS = 60;\n\nexport function providerOAuth2GrantNeedsRefresh(grant: ProviderOAuth2Grant, now: Date = new Date()): boolean {\n if (grant.expiresAt === undefined) return false;\n const expiry = Date.parse(grant.expiresAt);\n if (Number.isNaN(expiry)) return true;\n return expiry - now.getTime() <= PROVIDER_OAUTH2_REFRESH_SKEW_SECONDS * 1000;\n}\n"]}
@@ -15,7 +15,8 @@ import { ResourceRelationship } from '../../resources/resources.shared.schemas';
15
15
  import { CORE_APP_ROLES } from '../authorizations/roles.shared.schemas';
16
16
  export declare enum AppOAuthClients_Operations {
17
17
  ROTATE = "rotate",// Generate new secret and invalidate old one
18
- REGENERATE = "regenerate"
18
+ REGENERATE = "regenerate",// Generate new secret without invalidating old one
19
+ EXPIRE = "expire"
19
20
  }
20
21
  type AppOAuthClientsCoreOperations = CoreResourceOperation.READ | CoreResourceOperation.LIST | CoreResourceOperation.SEARCH | CoreResourceOperation.CREATE | CoreResourceOperation.DELETE;
21
22
  export declare const appOAuthClientsResourceConfiguration_InitializationFactory: (resourcesRelationships: ResourceRelationship[]) => import("../..").ResourceConfiguration<typeof AppOAuthClients_Operations, AppOAuthClientsCoreOperations, z.ZodObject<{
@@ -39,6 +40,8 @@ export declare const appOAuthClientsResourceConfiguration_InitializationFactory:
39
40
  previousHashedSecret: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodOptional<z.ZodString>>>>>;
40
41
  previousSecretPrefix: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodOptional<z.ZodString>>>;
41
42
  previousSecretInvalidationDate: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodOptional<z.ZodDate>>>;
43
+ registrationAccessTokenHash: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodOptional<z.ZodString>>>>>;
44
+ registrationAccessTokenPrefix: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodOptional<z.ZodString>>>;
42
45
  registrationOrigin: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodDefault<z.ZodEnum<typeof import("./oauth-clients.shared.schemas").OAuthClientRegistrationOrigin>>>>>>>;
43
46
  scope: z.ZodLiteral<import("../..").ApiKeyScope.APPLICATION>;
44
47
  applicationId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodString>>>>;