@endora-commerce/contracts 0.100.0

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 (327) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/dist/actor.d.ts +79 -0
  4. package/dist/actor.d.ts.map +1 -0
  5. package/dist/actor.js +41 -0
  6. package/dist/actor.js.map +1 -0
  7. package/dist/addresses.d.ts +134 -0
  8. package/dist/addresses.d.ts.map +1 -0
  9. package/dist/addresses.js +16 -0
  10. package/dist/addresses.js.map +1 -0
  11. package/dist/admin-actions.d.ts +367 -0
  12. package/dist/admin-actions.d.ts.map +1 -0
  13. package/dist/admin-actions.js +287 -0
  14. package/dist/admin-actions.js.map +1 -0
  15. package/dist/admin-contributions.d.ts +518 -0
  16. package/dist/admin-contributions.d.ts.map +1 -0
  17. package/dist/admin-contributions.js +495 -0
  18. package/dist/admin-contributions.js.map +1 -0
  19. package/dist/admin-i18n.d.ts +135 -0
  20. package/dist/admin-i18n.d.ts.map +1 -0
  21. package/dist/admin-i18n.js +72 -0
  22. package/dist/admin-i18n.js.map +1 -0
  23. package/dist/admin-notifications.d.ts +55 -0
  24. package/dist/admin-notifications.d.ts.map +1 -0
  25. package/dist/admin-notifications.js +16 -0
  26. package/dist/admin-notifications.js.map +1 -0
  27. package/dist/admin-roles.d.ts +125 -0
  28. package/dist/admin-roles.d.ts.map +1 -0
  29. package/dist/admin-roles.js +2 -0
  30. package/dist/admin-roles.js.map +1 -0
  31. package/dist/admin-users.d.ts +178 -0
  32. package/dist/admin-users.d.ts.map +1 -0
  33. package/dist/admin-users.js +14 -0
  34. package/dist/admin-users.js.map +1 -0
  35. package/dist/admin.d.ts +243 -0
  36. package/dist/admin.d.ts.map +1 -0
  37. package/dist/admin.js +246 -0
  38. package/dist/admin.js.map +1 -0
  39. package/dist/analytics.d.ts +123 -0
  40. package/dist/analytics.d.ts.map +1 -0
  41. package/dist/analytics.js +68 -0
  42. package/dist/analytics.js.map +1 -0
  43. package/dist/api-keys.d.ts +97 -0
  44. package/dist/api-keys.d.ts.map +1 -0
  45. package/dist/api-keys.js +64 -0
  46. package/dist/api-keys.js.map +1 -0
  47. package/dist/assets-library.d.ts +684 -0
  48. package/dist/assets-library.d.ts.map +1 -0
  49. package/dist/assets-library.js +181 -0
  50. package/dist/assets-library.js.map +1 -0
  51. package/dist/audit-logs.d.ts +141 -0
  52. package/dist/audit-logs.d.ts.map +1 -0
  53. package/dist/audit-logs.js +31 -0
  54. package/dist/audit-logs.js.map +1 -0
  55. package/dist/auth.d.ts +174 -0
  56. package/dist/auth.d.ts.map +1 -0
  57. package/dist/auth.js +27 -0
  58. package/dist/auth.js.map +1 -0
  59. package/dist/blog.d.ts +669 -0
  60. package/dist/blog.d.ts.map +1 -0
  61. package/dist/blog.js +360 -0
  62. package/dist/blog.js.map +1 -0
  63. package/dist/capabilities.d.ts +40 -0
  64. package/dist/capabilities.d.ts.map +1 -0
  65. package/dist/capabilities.js +38 -0
  66. package/dist/capabilities.js.map +1 -0
  67. package/dist/carts.d.ts +1367 -0
  68. package/dist/carts.d.ts.map +1 -0
  69. package/dist/carts.js +405 -0
  70. package/dist/carts.js.map +1 -0
  71. package/dist/catalog.d.ts +2855 -0
  72. package/dist/catalog.d.ts.map +1 -0
  73. package/dist/catalog.js +1543 -0
  74. package/dist/catalog.js.map +1 -0
  75. package/dist/cms.d.ts +872 -0
  76. package/dist/cms.d.ts.map +1 -0
  77. package/dist/cms.js +468 -0
  78. package/dist/cms.js.map +1 -0
  79. package/dist/common.d.ts +82 -0
  80. package/dist/common.d.ts.map +1 -0
  81. package/dist/common.js +72 -0
  82. package/dist/common.js.map +1 -0
  83. package/dist/comparisons.d.ts +487 -0
  84. package/dist/comparisons.d.ts.map +1 -0
  85. package/dist/comparisons.js +221 -0
  86. package/dist/comparisons.js.map +1 -0
  87. package/dist/credentials.d.ts +292 -0
  88. package/dist/credentials.d.ts.map +1 -0
  89. package/dist/credentials.js +142 -0
  90. package/dist/credentials.js.map +1 -0
  91. package/dist/credit-limits.d.ts +111 -0
  92. package/dist/credit-limits.d.ts.map +1 -0
  93. package/dist/credit-limits.js +35 -0
  94. package/dist/credit-limits.js.map +1 -0
  95. package/dist/currencies.d.ts +127 -0
  96. package/dist/currencies.d.ts.map +1 -0
  97. package/dist/currencies.js +20 -0
  98. package/dist/currencies.js.map +1 -0
  99. package/dist/custom-fields.d.ts +345 -0
  100. package/dist/custom-fields.d.ts.map +1 -0
  101. package/dist/custom-fields.js +185 -0
  102. package/dist/custom-fields.js.map +1 -0
  103. package/dist/customer-accounts.d.ts +690 -0
  104. package/dist/customer-accounts.d.ts.map +1 -0
  105. package/dist/customer-accounts.js +41 -0
  106. package/dist/customer-accounts.js.map +1 -0
  107. package/dist/customers.d.ts +305 -0
  108. package/dist/customers.d.ts.map +1 -0
  109. package/dist/customers.js +158 -0
  110. package/dist/customers.js.map +1 -0
  111. package/dist/dictionary.d.ts +580 -0
  112. package/dist/dictionary.d.ts.map +1 -0
  113. package/dist/dictionary.js +297 -0
  114. package/dist/dictionary.js.map +1 -0
  115. package/dist/email-address.d.ts +62 -0
  116. package/dist/email-address.d.ts.map +1 -0
  117. package/dist/email-address.js +64 -0
  118. package/dist/email-address.js.map +1 -0
  119. package/dist/email.d.ts +175 -0
  120. package/dist/email.d.ts.map +1 -0
  121. package/dist/email.js +45 -0
  122. package/dist/email.js.map +1 -0
  123. package/dist/envelopes.d.ts +15 -0
  124. package/dist/envelopes.d.ts.map +1 -0
  125. package/dist/envelopes.js +16 -0
  126. package/dist/envelopes.js.map +1 -0
  127. package/dist/environment-inputs.d.ts +306 -0
  128. package/dist/environment-inputs.d.ts.map +1 -0
  129. package/dist/environment-inputs.js +277 -0
  130. package/dist/environment-inputs.js.map +1 -0
  131. package/dist/erp-connector.d.ts +52 -0
  132. package/dist/erp-connector.d.ts.map +1 -0
  133. package/dist/erp-connector.js +34 -0
  134. package/dist/erp-connector.js.map +1 -0
  135. package/dist/errors.d.ts +455 -0
  136. package/dist/errors.d.ts.map +1 -0
  137. package/dist/errors.js +532 -0
  138. package/dist/errors.js.map +1 -0
  139. package/dist/google-analytics.d.ts +181 -0
  140. package/dist/google-analytics.d.ts.map +1 -0
  141. package/dist/google-analytics.js +176 -0
  142. package/dist/google-analytics.js.map +1 -0
  143. package/dist/google-tag-manager.d.ts +111 -0
  144. package/dist/google-tag-manager.d.ts.map +1 -0
  145. package/dist/google-tag-manager.js +129 -0
  146. package/dist/google-tag-manager.js.map +1 -0
  147. package/dist/i18n.d.ts +69 -0
  148. package/dist/i18n.d.ts.map +1 -0
  149. package/dist/i18n.js +59 -0
  150. package/dist/i18n.js.map +1 -0
  151. package/dist/import-export.d.ts +63 -0
  152. package/dist/import-export.d.ts.map +1 -0
  153. package/dist/import-export.js +37 -0
  154. package/dist/import-export.js.map +1 -0
  155. package/dist/index.d.ts +82 -0
  156. package/dist/index.d.ts.map +1 -0
  157. package/dist/index.js +126 -0
  158. package/dist/index.js.map +1 -0
  159. package/dist/inventory.d.ts +673 -0
  160. package/dist/inventory.d.ts.map +1 -0
  161. package/dist/inventory.js +412 -0
  162. package/dist/inventory.js.map +1 -0
  163. package/dist/invoice-ledger.d.ts +366 -0
  164. package/dist/invoice-ledger.d.ts.map +1 -0
  165. package/dist/invoice-ledger.js +114 -0
  166. package/dist/invoice-ledger.js.map +1 -0
  167. package/dist/invoices.d.ts +845 -0
  168. package/dist/invoices.d.ts.map +1 -0
  169. package/dist/invoices.js +314 -0
  170. package/dist/invoices.js.map +1 -0
  171. package/dist/kernel.d.ts +49 -0
  172. package/dist/kernel.d.ts.map +1 -0
  173. package/dist/kernel.js +19 -0
  174. package/dist/kernel.js.map +1 -0
  175. package/dist/languages.d.ts +122 -0
  176. package/dist/languages.d.ts.map +1 -0
  177. package/dist/languages.js +24 -0
  178. package/dist/languages.js.map +1 -0
  179. package/dist/linkedin-ads.d.ts +167 -0
  180. package/dist/linkedin-ads.d.ts.map +1 -0
  181. package/dist/linkedin-ads.js +156 -0
  182. package/dist/linkedin-ads.js.map +1 -0
  183. package/dist/megamenu.d.ts +556 -0
  184. package/dist/megamenu.d.ts.map +1 -0
  185. package/dist/megamenu.js +186 -0
  186. package/dist/megamenu.js.map +1 -0
  187. package/dist/meta-ads.d.ts +126 -0
  188. package/dist/meta-ads.d.ts.map +1 -0
  189. package/dist/meta-ads.js +112 -0
  190. package/dist/meta-ads.js.map +1 -0
  191. package/dist/mfa.d.ts +274 -0
  192. package/dist/mfa.d.ts.map +1 -0
  193. package/dist/mfa.js +187 -0
  194. package/dist/mfa.js.map +1 -0
  195. package/dist/modules.d.ts +1706 -0
  196. package/dist/modules.d.ts.map +1 -0
  197. package/dist/modules.js +1390 -0
  198. package/dist/modules.js.map +1 -0
  199. package/dist/newsletter.d.ts +611 -0
  200. package/dist/newsletter.d.ts.map +1 -0
  201. package/dist/newsletter.js +345 -0
  202. package/dist/newsletter.js.map +1 -0
  203. package/dist/orders.d.ts +1175 -0
  204. package/dist/orders.d.ts.map +1 -0
  205. package/dist/orders.js +630 -0
  206. package/dist/orders.js.map +1 -0
  207. package/dist/organizations.d.ts +938 -0
  208. package/dist/organizations.d.ts.map +1 -0
  209. package/dist/organizations.js +418 -0
  210. package/dist/organizations.js.map +1 -0
  211. package/dist/pagination.d.ts +21 -0
  212. package/dist/pagination.d.ts.map +1 -0
  213. package/dist/pagination.js +22 -0
  214. package/dist/pagination.js.map +1 -0
  215. package/dist/payment-methods.d.ts +472 -0
  216. package/dist/payment-methods.d.ts.map +1 -0
  217. package/dist/payment-methods.js +175 -0
  218. package/dist/payment-methods.js.map +1 -0
  219. package/dist/payment-return-url.d.ts +53 -0
  220. package/dist/payment-return-url.d.ts.map +1 -0
  221. package/dist/payment-return-url.js +35 -0
  222. package/dist/payment-return-url.js.map +1 -0
  223. package/dist/payments.d.ts +386 -0
  224. package/dist/payments.d.ts.map +1 -0
  225. package/dist/payments.js +84 -0
  226. package/dist/payments.js.map +1 -0
  227. package/dist/pim-connector.d.ts +60 -0
  228. package/dist/pim-connector.d.ts.map +1 -0
  229. package/dist/pim-connector.js +43 -0
  230. package/dist/pim-connector.js.map +1 -0
  231. package/dist/pim-field-path.d.ts +6 -0
  232. package/dist/pim-field-path.d.ts.map +1 -0
  233. package/dist/pim-field-path.js +101 -0
  234. package/dist/pim-field-path.js.map +1 -0
  235. package/dist/platform-language.d.ts +20 -0
  236. package/dist/platform-language.d.ts.map +1 -0
  237. package/dist/platform-language.js +22 -0
  238. package/dist/platform-language.js.map +1 -0
  239. package/dist/price-lists.d.ts +685 -0
  240. package/dist/price-lists.d.ts.map +1 -0
  241. package/dist/price-lists.js +330 -0
  242. package/dist/price-lists.js.map +1 -0
  243. package/dist/product-feeds.d.ts +2837 -0
  244. package/dist/product-feeds.d.ts.map +1 -0
  245. package/dist/product-feeds.js +1504 -0
  246. package/dist/product-feeds.js.map +1 -0
  247. package/dist/product-scope-overrides.d.ts +134 -0
  248. package/dist/product-scope-overrides.d.ts.map +1 -0
  249. package/dist/product-scope-overrides.js +82 -0
  250. package/dist/product-scope-overrides.js.map +1 -0
  251. package/dist/product-value-resolver.d.ts +88 -0
  252. package/dist/product-value-resolver.d.ts.map +1 -0
  253. package/dist/product-value-resolver.js +128 -0
  254. package/dist/product-value-resolver.js.map +1 -0
  255. package/dist/promotions.d.ts +678 -0
  256. package/dist/promotions.d.ts.map +1 -0
  257. package/dist/promotions.js +479 -0
  258. package/dist/promotions.js.map +1 -0
  259. package/dist/prompt-actions.d.ts +582 -0
  260. package/dist/prompt-actions.d.ts.map +1 -0
  261. package/dist/prompt-actions.js +221 -0
  262. package/dist/prompt-actions.js.map +1 -0
  263. package/dist/pwa.d.ts +293 -0
  264. package/dist/pwa.d.ts.map +1 -0
  265. package/dist/pwa.js +204 -0
  266. package/dist/pwa.js.map +1 -0
  267. package/dist/quick-order.d.ts +340 -0
  268. package/dist/quick-order.d.ts.map +1 -0
  269. package/dist/quick-order.js +177 -0
  270. package/dist/quick-order.js.map +1 -0
  271. package/dist/quote-requests.d.ts +538 -0
  272. package/dist/quote-requests.d.ts.map +1 -0
  273. package/dist/quote-requests.js +308 -0
  274. package/dist/quote-requests.js.map +1 -0
  275. package/dist/returns.d.ts +774 -0
  276. package/dist/returns.d.ts.map +1 -0
  277. package/dist/returns.js +389 -0
  278. package/dist/returns.js.map +1 -0
  279. package/dist/sales-channels.d.ts +392 -0
  280. package/dist/sales-channels.d.ts.map +1 -0
  281. package/dist/sales-channels.js +285 -0
  282. package/dist/sales-channels.js.map +1 -0
  283. package/dist/scope-notice.d.ts +60 -0
  284. package/dist/scope-notice.d.ts.map +1 -0
  285. package/dist/scope-notice.js +56 -0
  286. package/dist/scope-notice.js.map +1 -0
  287. package/dist/search.d.ts +321 -0
  288. package/dist/search.d.ts.map +1 -0
  289. package/dist/search.js +160 -0
  290. package/dist/search.js.map +1 -0
  291. package/dist/seo.d.ts +113 -0
  292. package/dist/seo.d.ts.map +1 -0
  293. package/dist/seo.js +63 -0
  294. package/dist/seo.js.map +1 -0
  295. package/dist/settings.d.ts +453 -0
  296. package/dist/settings.d.ts.map +1 -0
  297. package/dist/settings.js +337 -0
  298. package/dist/settings.js.map +1 -0
  299. package/dist/shipments.d.ts +140 -0
  300. package/dist/shipments.d.ts.map +1 -0
  301. package/dist/shipments.js +14 -0
  302. package/dist/shipments.js.map +1 -0
  303. package/dist/shipping-methods.d.ts +350 -0
  304. package/dist/shipping-methods.d.ts.map +1 -0
  305. package/dist/shipping-methods.js +99 -0
  306. package/dist/shipping-methods.js.map +1 -0
  307. package/dist/shopping-lists.d.ts +122 -0
  308. package/dist/shopping-lists.d.ts.map +1 -0
  309. package/dist/shopping-lists.js +92 -0
  310. package/dist/shopping-lists.js.map +1 -0
  311. package/dist/taxes.d.ts +106 -0
  312. package/dist/taxes.d.ts.map +1 -0
  313. package/dist/taxes.js +80 -0
  314. package/dist/taxes.js.map +1 -0
  315. package/dist/text-normalization.d.ts +199 -0
  316. package/dist/text-normalization.d.ts.map +1 -0
  317. package/dist/text-normalization.js +205 -0
  318. package/dist/text-normalization.js.map +1 -0
  319. package/dist/transactional-emails.d.ts +459 -0
  320. package/dist/transactional-emails.d.ts.map +1 -0
  321. package/dist/transactional-emails.js +212 -0
  322. package/dist/transactional-emails.js.map +1 -0
  323. package/dist/webhooks.d.ts +69 -0
  324. package/dist/webhooks.d.ts.map +1 -0
  325. package/dist/webhooks.js +53 -0
  326. package/dist/webhooks.js.map +1 -0
  327. package/package.json +46 -0
package/dist/mfa.d.ts ADDED
@@ -0,0 +1,274 @@
1
+ import { z } from 'zod';
2
+ /** Identity surface a subject belongs to. */
3
+ export declare const mfaSubjectTypeSchema: z.ZodEnum<{
4
+ customer: "customer";
5
+ admin: "admin";
6
+ }>;
7
+ export type MfaSubjectType = z.infer<typeof mfaSubjectTypeSchema>;
8
+ /** Supported federated identity providers. */
9
+ export declare const mfaSocialProviderSchema: z.ZodEnum<{
10
+ google: "google";
11
+ microsoft: "microsoft";
12
+ }>;
13
+ export type MfaSocialProvider = z.infer<typeof mfaSocialProviderSchema>;
14
+ /**
15
+ * `GET /api/v1/auth/{customer|admin}/oauth/providers` — public, unauthenticated.
16
+ *
17
+ * The providers a sign-in surface can actually complete a hand-off with. A
18
+ * provider is listed only when **both** halves hold: client credentials are
19
+ * configured for it (backend env, never Settings) *and* the surface's
20
+ * `mfa.*.<provider>_enabled` setting is on for the request's sales channel.
21
+ *
22
+ * A provider missing either half is **absent from the array**, not present with
23
+ * a `false` flag. That asymmetry is the contract's job: a frontend deciding
24
+ * "render this button or not" must not be handed a reason to render a control
25
+ * whose click leads back to the login screen with an error. Both settings
26
+ * default to `false`, so the honest answer on a fresh deployment is `[]`.
27
+ *
28
+ * The route belongs to `mfa` and is gated at its registration seam, so a
29
+ * switched-off module answers 503 `MODULE_DISABLED`. Frontends still project
30
+ * absence from `/module-presence` first and treat the 503 as defence in depth —
31
+ * absence is projected, never inferred from a status code.
32
+ */
33
+ export declare const federatedSignInOptionsResponseSchema: z.ZodObject<{
34
+ providers: z.ZodArray<z.ZodEnum<{
35
+ google: "google";
36
+ microsoft: "microsoft";
37
+ }>>;
38
+ }, z.core.$strip>;
39
+ export type FederatedSignInOptionsResponse = z.infer<typeof federatedSignInOptionsResponseSchema>;
40
+ /**
41
+ * Discriminated result returned by the first login step (email+password) and
42
+ * by the OAuth callback. Only `authenticated` carries/sets a session cookie;
43
+ * the other two hand the client an opaque ticket for the second step.
44
+ */
45
+ export declare const mfaLoginResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
46
+ status: z.ZodLiteral<"authenticated">;
47
+ }, z.core.$strip>, z.ZodObject<{
48
+ status: z.ZodLiteral<"mfaRequired">;
49
+ challengeId: z.ZodString;
50
+ }, z.core.$strip>, z.ZodObject<{
51
+ status: z.ZodLiteral<"mfaSetupRequired">;
52
+ setupTicket: z.ZodString;
53
+ }, z.core.$strip>], "status">;
54
+ export type MfaLoginResult = z.infer<typeof mfaLoginResultSchema>;
55
+ /** Second-step verification — a 6-digit TOTP code or a recovery code. */
56
+ export declare const mfaVerifyRequestSchema: z.ZodObject<{
57
+ challengeId: z.ZodString;
58
+ code: z.ZodString;
59
+ }, z.core.$strip>;
60
+ export type MfaVerifyRequest = z.infer<typeof mfaVerifyRequestSchema>;
61
+ /** Optional setup ticket for the enforced-but-unenrolled flow (no session yet). */
62
+ export declare const mfaSetupTicketBodySchema: z.ZodObject<{
63
+ setupTicket: z.ZodOptional<z.ZodString>;
64
+ }, z.core.$strip>;
65
+ export declare const mfaSetupResponseSchema: z.ZodObject<{
66
+ secret: z.ZodString;
67
+ otpauthUri: z.ZodString;
68
+ }, z.core.$strip>;
69
+ export type MfaSetupResponse = z.infer<typeof mfaSetupResponseSchema>;
70
+ export declare const mfaActivateRequestSchema: z.ZodObject<{
71
+ code: z.ZodString;
72
+ setupTicket: z.ZodOptional<z.ZodString>;
73
+ }, z.core.$strip>;
74
+ export type MfaActivateRequest = z.infer<typeof mfaActivateRequestSchema>;
75
+ export declare const mfaActivateResponseSchema: z.ZodObject<{
76
+ recoveryCodes: z.ZodArray<z.ZodString>;
77
+ }, z.core.$strip>;
78
+ export type MfaActivateResponse = z.infer<typeof mfaActivateResponseSchema>;
79
+ /**
80
+ * Enforced-but-unenrolled flow (feature 042, US3). The setup ticket replaces a
81
+ * session for the forced-enrolment screen: `begin` returns the secret, and
82
+ * `complete` activates + upgrades the ticket to a full session.
83
+ */
84
+ export declare const mfaSetupTicketBeginSchema: z.ZodObject<{
85
+ setupTicket: z.ZodString;
86
+ }, z.core.$strip>;
87
+ export type MfaSetupTicketBegin = z.infer<typeof mfaSetupTicketBeginSchema>;
88
+ export declare const mfaSetupTicketCompleteSchema: z.ZodObject<{
89
+ setupTicket: z.ZodString;
90
+ code: z.ZodString;
91
+ }, z.core.$strip>;
92
+ export type MfaSetupTicketComplete = z.infer<typeof mfaSetupTicketCompleteSchema>;
93
+ /** Re-auth for self-disable: current password, or a current TOTP/recovery code. */
94
+ export declare const mfaDisableRequestSchema: z.ZodObject<{
95
+ password: z.ZodOptional<z.ZodString>;
96
+ code: z.ZodOptional<z.ZodString>;
97
+ }, z.core.$strip>;
98
+ export type MfaDisableRequest = z.infer<typeof mfaDisableRequestSchema>;
99
+ export declare const mfaRegenerateRequestSchema: z.ZodObject<{
100
+ code: z.ZodString;
101
+ }, z.core.$strip>;
102
+ export type MfaRegenerateRequest = z.infer<typeof mfaRegenerateRequestSchema>;
103
+ /**
104
+ * Why an account may not sever a federated identity (issue #194).
105
+ *
106
+ * `last_credential` — it is the account's only link, and the platform cannot
107
+ * tell whether its holder has ever chosen a password: an account created by a
108
+ * social sign-in is given a random one at signup. Removing the link could
109
+ * therefore remove the only credential its holder can use, so it is refused
110
+ * until another credential is in place.
111
+ */
112
+ export declare const mfaSocialUnlinkBlockedReasonSchema: z.ZodEnum<{
113
+ last_credential: "last_credential";
114
+ }>;
115
+ export type MfaSocialUnlinkBlockedReason = z.infer<typeof mfaSocialUnlinkBlockedReasonSchema>;
116
+ export declare const mfaSocialLinkSummarySchema: z.ZodObject<{
117
+ provider: z.ZodEnum<{
118
+ google: "google";
119
+ microsoft: "microsoft";
120
+ }>;
121
+ email: z.ZodString;
122
+ linkedAt: z.ZodString;
123
+ canUnlink: z.ZodBoolean;
124
+ unlinkBlockedReason: z.ZodNullable<z.ZodEnum<{
125
+ last_credential: "last_credential";
126
+ }>>;
127
+ }, z.core.$strip>;
128
+ export type MfaSocialLinkSummary = z.infer<typeof mfaSocialLinkSummarySchema>;
129
+ /** `DELETE {prefix}/social-links/:provider` — one link per provider per account. */
130
+ export declare const mfaSocialUnlinkParamsSchema: z.ZodObject<{
131
+ provider: z.ZodEnum<{
132
+ google: "google";
133
+ microsoft: "microsoft";
134
+ }>;
135
+ }, z.core.$strip>;
136
+ export type MfaSocialUnlinkParams = z.infer<typeof mfaSocialUnlinkParamsSchema>;
137
+ export declare const mfaSocialUnlinkResponseSchema: z.ZodObject<{
138
+ status: z.ZodLiteral<"unlinked">;
139
+ provider: z.ZodEnum<{
140
+ google: "google";
141
+ microsoft: "microsoft";
142
+ }>;
143
+ }, z.core.$strip>;
144
+ export type MfaSocialUnlinkResponse = z.infer<typeof mfaSocialUnlinkResponseSchema>;
145
+ export declare const mfaStatusResponseSchema: z.ZodObject<{
146
+ totpActive: z.ZodBoolean;
147
+ recoveryCodesRemaining: z.ZodNumber;
148
+ totpEnabledForScope: z.ZodBoolean;
149
+ totpEnforcedForScope: z.ZodBoolean;
150
+ socialLinks: z.ZodArray<z.ZodObject<{
151
+ provider: z.ZodEnum<{
152
+ google: "google";
153
+ microsoft: "microsoft";
154
+ }>;
155
+ email: z.ZodString;
156
+ linkedAt: z.ZodString;
157
+ canUnlink: z.ZodBoolean;
158
+ unlinkBlockedReason: z.ZodNullable<z.ZodEnum<{
159
+ last_credential: "last_credential";
160
+ }>>;
161
+ }, z.core.$strip>>;
162
+ }, z.core.$strip>;
163
+ export type MfaStatusResponse = z.infer<typeof mfaStatusResponseSchema>;
164
+ export declare const mfaOrgPolicyRequestSchema: z.ZodObject<{
165
+ enforceTotp: z.ZodBoolean;
166
+ }, z.core.$strip>;
167
+ export type MfaOrgPolicyRequest = z.infer<typeof mfaOrgPolicyRequestSchema>;
168
+ export declare const mfaOrgPolicyResponseSchema: z.ZodObject<{
169
+ enforceTotp: z.ZodBoolean;
170
+ }, z.core.$strip>;
171
+ export type MfaOrgPolicyResponse = z.infer<typeof mfaOrgPolicyResponseSchema>;
172
+ export declare const mfaResetBulkRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
173
+ customerIds: z.ZodArray<z.ZodString>;
174
+ }, z.core.$strip>, z.ZodObject<{
175
+ organizationId: z.ZodString;
176
+ }, z.core.$strip>]>;
177
+ export type MfaResetBulkRequest = z.infer<typeof mfaResetBulkRequestSchema>;
178
+ export declare const mfaResetResultSchema: z.ZodObject<{
179
+ affected: z.ZodBoolean;
180
+ }, z.core.$strip>;
181
+ export type MfaResetResult = z.infer<typeof mfaResetResultSchema>;
182
+ export declare const mfaResetBulkResultSchema: z.ZodObject<{
183
+ requested: z.ZodNumber;
184
+ affected: z.ZodNumber;
185
+ skipped: z.ZodNumber;
186
+ }, z.core.$strip>;
187
+ export type MfaResetBulkResult = z.infer<typeof mfaResetBulkResultSchema>;
188
+ export declare const MFA_SETTING_CODES: {
189
+ /**
190
+ * Feature 074 — the operator-activation control (Constitution XVII). It sits
191
+ * above the eight policy switches below rather than beside them: those decide
192
+ * *which* second factor a surface offers, this decides whether the module is
193
+ * present at all.
194
+ */
195
+ readonly ACTIVATION: "mfa.enabled";
196
+ readonly ADMIN_TOTP_ENABLED: "mfa.admin.totp_enabled";
197
+ readonly ADMIN_TOTP_ENFORCED: "mfa.admin.totp_enforced";
198
+ readonly STOREFRONT_TOTP_ENABLED: "mfa.storefront.totp_enabled";
199
+ readonly STOREFRONT_TOTP_ENFORCED: "mfa.storefront.totp_enforced";
200
+ readonly ADMIN_GOOGLE_ENABLED: "mfa.admin.google_enabled";
201
+ readonly ADMIN_MICROSOFT_ENABLED: "mfa.admin.microsoft_enabled";
202
+ readonly STOREFRONT_GOOGLE_ENABLED: "mfa.storefront.google_enabled";
203
+ readonly STOREFRONT_MICROSOFT_ENABLED: "mfa.storefront.microsoft_enabled";
204
+ };
205
+ /** How many subjects hold an active second factor, split by identity store. */
206
+ export declare const mfaActiveEnrolmentCountsSchema: z.ZodObject<{
207
+ admins: z.ZodNumber;
208
+ customers: z.ZodNumber;
209
+ }, z.core.$strip>;
210
+ export type MfaActiveEnrolmentCounts = z.infer<typeof mfaActiveEnrolmentCountsSchema>;
211
+ /**
212
+ * Container name: `mfaEnrolmentCountPort`. Owner: `mfa`.
213
+ *
214
+ * How many people would lose their second factor. Read by `/platform/modules`
215
+ * before an operator switches this module off, so the confirmation dialog can
216
+ * say "14 administrators and 320 customers currently use a second factor"
217
+ * instead of only naming the capability.
218
+ *
219
+ * **It is read while `mfa` is still on**, which is the whole reason it can be a
220
+ * port at all: the dialog renders before the flip, so the gate on this
221
+ * registration is open at exactly the moment the question is asked. A count
222
+ * taken *after* deactivation would be a read of `mfa_enrolments` through a
223
+ * closed gate, which is why "refuse the login of an enrolled subject while the
224
+ * module is off" was ruled unimplementable (D-96.7).
225
+ *
226
+ * The caller therefore decides presence before it resolves this, and treats a
227
+ * failed read as "count unavailable" — a number that cannot be fetched must
228
+ * never stop an operator switching a module off.
229
+ */
230
+ export interface MfaEnrolmentCountPort {
231
+ /** Subjects with an `active` (confirmed) TOTP enrolment, right now. */
232
+ countActiveEnrolments(): Promise<MfaActiveEnrolmentCounts>;
233
+ }
234
+ /**
235
+ * Container name: `mfaEnrolmentStatePort`. Owner: `mfa`.
236
+ *
237
+ * Which of these subjects hold an **active** (confirmed) second factor, right
238
+ * now. It is the source `twoFactorEnabled` is derived from on every response
239
+ * that carries it — the admin user list and `/api/v1/admin/me`, the admin
240
+ * customer detail, the organisation member panels, and the buyer's own
241
+ * `GET /api/v1/me/customer`.
242
+ *
243
+ * Both identity stores hold a `two_factor_confirmed_at` column and **neither
244
+ * has ever had a writer**, so the field derived from it was a provably
245
+ * constant `false`: an operator, and a buyer reading their own account page,
246
+ * were told "no second factor" about someone who had enrolled an hour earlier.
247
+ * The live state is `mfa_enrolments`, which is this module's table, so this is
248
+ * the only honest source.
249
+ *
250
+ * **Batched, not per row.** The callers are list surfaces; a per-row port would
251
+ * put one query per admin user behind `/admin-users`. `subjectIds` is answered
252
+ * as a subset, so a caller builds a `Set` and asks it per row.
253
+ *
254
+ * The record is `string[]` and never an entity: `MfaEnrolment` carries the
255
+ * encrypted TOTP secret, its IV and its auth tag, and no consumer of this port
256
+ * has any business holding those.
257
+ *
258
+ * **When `mfa` is absent this port is not resolved at all.** The gate on the
259
+ * registration would refuse, and a 503 is the wrong answer for an admin list —
260
+ * so both consumers decide presence with `effectiveState.isPresent('mfa')`
261
+ * first and report `false`, which is not a fallback but the truth: with the
262
+ * module off, no sign-in asks for a second factor, so no account is protected
263
+ * by one. See the `degrades-without` entries in `admin_users`' and
264
+ * `customer_accounts`' manifests for the sentence an operator is shown.
265
+ */
266
+ export interface MfaEnrolmentStatePort {
267
+ /**
268
+ * The subset of `subjectIds` with an `active` enrolment of `subjectType`.
269
+ * Order is not significant and an empty input answers an empty array without
270
+ * touching the database.
271
+ */
272
+ activeSubjectIds(subjectType: MfaSubjectType, subjectIds: readonly string[]): Promise<string[]>;
273
+ }
274
+ //# sourceMappingURL=mfa.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mfa.d.ts","sourceRoot":"","sources":["../src/mfa.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,6CAA6C;AAC7C,eAAO,MAAM,oBAAoB;;;EAAgC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,8CAA8C;AAC9C,eAAO,MAAM,uBAAuB;;;EAAkC,CAAC;AACvE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CA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mB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,oBAAoB;;iBAAsC,CAAC;AACxE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,wBAAwB;;;;iBAInC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAM1E,eAAO,MAAM,iBAAiB;IAC5B;;;;;OAKG;;;;;;;;;;CAUK,CAAC;AAMX,+EAA+E;AAC/E,eAAO,MAAM,8BAA8B;;;iBAGzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,qBAAqB;IACpC,uEAAuE;IACvE,qBAAqB,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC5D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,gBAAgB,CACd,WAAW,EAAE,cAAc,EAC3B,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CACtB"}
package/dist/mfa.js ADDED
@@ -0,0 +1,187 @@
1
+ // @endora-commerce/contracts — MFA module (feature 042).
2
+ //
3
+ // Source-of-truth Zod schemas for the MFA boundary: TOTP enrolment/verification,
4
+ // the two-step login result, federated sign-in, and admin reset/enforcement.
5
+ // Provider client secrets are NOT modelled here — they are backend config/env.
6
+ import { z } from 'zod';
7
+ // ---------------------------------------------------------------------------
8
+ // Shared enums
9
+ // ---------------------------------------------------------------------------
10
+ /** Identity surface a subject belongs to. */
11
+ export const mfaSubjectTypeSchema = z.enum(['customer', 'admin']);
12
+ /** Supported federated identity providers. */
13
+ export const mfaSocialProviderSchema = z.enum(['google', 'microsoft']);
14
+ // ---------------------------------------------------------------------------
15
+ // Federated sign-in availability (issue #193)
16
+ // ---------------------------------------------------------------------------
17
+ /**
18
+ * `GET /api/v1/auth/{customer|admin}/oauth/providers` — public, unauthenticated.
19
+ *
20
+ * The providers a sign-in surface can actually complete a hand-off with. A
21
+ * provider is listed only when **both** halves hold: client credentials are
22
+ * configured for it (backend env, never Settings) *and* the surface's
23
+ * `mfa.*.<provider>_enabled` setting is on for the request's sales channel.
24
+ *
25
+ * A provider missing either half is **absent from the array**, not present with
26
+ * a `false` flag. That asymmetry is the contract's job: a frontend deciding
27
+ * "render this button or not" must not be handed a reason to render a control
28
+ * whose click leads back to the login screen with an error. Both settings
29
+ * default to `false`, so the honest answer on a fresh deployment is `[]`.
30
+ *
31
+ * The route belongs to `mfa` and is gated at its registration seam, so a
32
+ * switched-off module answers 503 `MODULE_DISABLED`. Frontends still project
33
+ * absence from `/module-presence` first and treat the 503 as defence in depth —
34
+ * absence is projected, never inferred from a status code.
35
+ */
36
+ export const federatedSignInOptionsResponseSchema = z.object({
37
+ providers: z.array(mfaSocialProviderSchema),
38
+ });
39
+ // ---------------------------------------------------------------------------
40
+ // Two-step login result (replaces the inline `twoFactorCode` shape)
41
+ // ---------------------------------------------------------------------------
42
+ /**
43
+ * Discriminated result returned by the first login step (email+password) and
44
+ * by the OAuth callback. Only `authenticated` carries/sets a session cookie;
45
+ * the other two hand the client an opaque ticket for the second step.
46
+ */
47
+ export const mfaLoginResultSchema = z.discriminatedUnion('status', [
48
+ z.object({ status: z.literal('authenticated') }),
49
+ z.object({ status: z.literal('mfaRequired'), challengeId: z.string().min(1) }),
50
+ z.object({
51
+ status: z.literal('mfaSetupRequired'),
52
+ setupTicket: z.string().min(1),
53
+ }),
54
+ ]);
55
+ /** Second-step verification — a 6-digit TOTP code or a recovery code. */
56
+ export const mfaVerifyRequestSchema = z.object({
57
+ challengeId: z.string().min(1),
58
+ code: z.string().min(6).max(20),
59
+ });
60
+ // ---------------------------------------------------------------------------
61
+ // Self-service enrolment
62
+ // ---------------------------------------------------------------------------
63
+ /** Optional setup ticket for the enforced-but-unenrolled flow (no session yet). */
64
+ export const mfaSetupTicketBodySchema = z.object({
65
+ setupTicket: z.string().min(1).optional(),
66
+ });
67
+ export const mfaSetupResponseSchema = z.object({
68
+ /** base32 secret for manual entry. */
69
+ secret: z.string().min(1),
70
+ /** otpauth:// URI for QR rendering on the client. */
71
+ otpauthUri: z.string().min(1),
72
+ });
73
+ export const mfaActivateRequestSchema = z.object({
74
+ code: z.string().length(6),
75
+ setupTicket: z.string().min(1).optional(),
76
+ });
77
+ export const mfaActivateResponseSchema = z.object({
78
+ recoveryCodes: z.array(z.string()).length(10),
79
+ });
80
+ /**
81
+ * Enforced-but-unenrolled flow (feature 042, US3). The setup ticket replaces a
82
+ * session for the forced-enrolment screen: `begin` returns the secret, and
83
+ * `complete` activates + upgrades the ticket to a full session.
84
+ */
85
+ export const mfaSetupTicketBeginSchema = z.object({
86
+ setupTicket: z.string().min(1),
87
+ });
88
+ export const mfaSetupTicketCompleteSchema = z.object({
89
+ setupTicket: z.string().min(1),
90
+ code: z.string().length(6),
91
+ });
92
+ /** Re-auth for self-disable: current password, or a current TOTP/recovery code. */
93
+ export const mfaDisableRequestSchema = z
94
+ .object({
95
+ password: z.string().min(1).optional(),
96
+ code: z.string().min(6).max(20).optional(),
97
+ })
98
+ .refine((v) => Boolean(v.password) || Boolean(v.code), {
99
+ message: 'Either password or code is required to disable 2FA.',
100
+ });
101
+ export const mfaRegenerateRequestSchema = z.object({
102
+ code: z.string().length(6),
103
+ });
104
+ /**
105
+ * Why an account may not sever a federated identity (issue #194).
106
+ *
107
+ * `last_credential` — it is the account's only link, and the platform cannot
108
+ * tell whether its holder has ever chosen a password: an account created by a
109
+ * social sign-in is given a random one at signup. Removing the link could
110
+ * therefore remove the only credential its holder can use, so it is refused
111
+ * until another credential is in place.
112
+ */
113
+ export const mfaSocialUnlinkBlockedReasonSchema = z.enum(['last_credential']);
114
+ export const mfaSocialLinkSummarySchema = z.object({
115
+ provider: mfaSocialProviderSchema,
116
+ email: z.string(),
117
+ linkedAt: z.string(),
118
+ /** The surface renders the unlink control from this, never from its own guess. */
119
+ canUnlink: z.boolean(),
120
+ unlinkBlockedReason: mfaSocialUnlinkBlockedReasonSchema.nullable(),
121
+ });
122
+ /** `DELETE {prefix}/social-links/:provider` — one link per provider per account. */
123
+ export const mfaSocialUnlinkParamsSchema = z.object({
124
+ provider: mfaSocialProviderSchema,
125
+ });
126
+ export const mfaSocialUnlinkResponseSchema = z.object({
127
+ status: z.literal('unlinked'),
128
+ provider: mfaSocialProviderSchema,
129
+ });
130
+ export const mfaStatusResponseSchema = z.object({
131
+ totpActive: z.boolean(),
132
+ recoveryCodesRemaining: z.number().int().nonnegative(),
133
+ totpEnabledForScope: z.boolean(),
134
+ totpEnforcedForScope: z.boolean(),
135
+ socialLinks: z.array(mfaSocialLinkSummarySchema),
136
+ });
137
+ // ---------------------------------------------------------------------------
138
+ // Organization enforcement policy
139
+ // ---------------------------------------------------------------------------
140
+ export const mfaOrgPolicyRequestSchema = z.object({
141
+ enforceTotp: z.boolean(),
142
+ });
143
+ export const mfaOrgPolicyResponseSchema = z.object({
144
+ enforceTotp: z.boolean(),
145
+ });
146
+ // ---------------------------------------------------------------------------
147
+ // Admin reset
148
+ // ---------------------------------------------------------------------------
149
+ export const mfaResetBulkRequestSchema = z.union([
150
+ z.object({ customerIds: z.array(z.string().uuid()).min(1).max(1000) }),
151
+ z.object({ organizationId: z.string().uuid() }),
152
+ ]);
153
+ export const mfaResetResultSchema = z.object({ affected: z.boolean() });
154
+ export const mfaResetBulkResultSchema = z.object({
155
+ requested: z.number().int().nonnegative(),
156
+ affected: z.number().int().nonnegative(),
157
+ skipped: z.number().int().nonnegative(),
158
+ });
159
+ // ---------------------------------------------------------------------------
160
+ // Setting codes (single source for both manifest and resolver)
161
+ // ---------------------------------------------------------------------------
162
+ export const MFA_SETTING_CODES = {
163
+ /**
164
+ * Feature 074 — the operator-activation control (Constitution XVII). It sits
165
+ * above the eight policy switches below rather than beside them: those decide
166
+ * *which* second factor a surface offers, this decides whether the module is
167
+ * present at all.
168
+ */
169
+ ACTIVATION: 'mfa.enabled',
170
+ ADMIN_TOTP_ENABLED: 'mfa.admin.totp_enabled',
171
+ ADMIN_TOTP_ENFORCED: 'mfa.admin.totp_enforced',
172
+ STOREFRONT_TOTP_ENABLED: 'mfa.storefront.totp_enabled',
173
+ STOREFRONT_TOTP_ENFORCED: 'mfa.storefront.totp_enforced',
174
+ ADMIN_GOOGLE_ENABLED: 'mfa.admin.google_enabled',
175
+ ADMIN_MICROSOFT_ENABLED: 'mfa.admin.microsoft_enabled',
176
+ STOREFRONT_GOOGLE_ENABLED: 'mfa.storefront.google_enabled',
177
+ STOREFRONT_MICROSOFT_ENABLED: 'mfa.storefront.microsoft_enabled',
178
+ };
179
+ // ---------------------------------------------------------------------------
180
+ // Ports
181
+ // ---------------------------------------------------------------------------
182
+ /** How many subjects hold an active second factor, split by identity store. */
183
+ export const mfaActiveEnrolmentCountsSchema = z.object({
184
+ admins: z.number().int().nonnegative(),
185
+ customers: z.number().int().nonnegative(),
186
+ });
187
+ //# sourceMappingURL=mfa.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mfa.js","sourceRoot":"","sources":["../src/mfa.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,iFAAiF;AACjF,6EAA6E;AAC7E,+EAA+E;AAE/E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;AAGlE,8CAA8C;AAC9C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,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