@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets-library.d.ts","sourceRoot":"","sources":["../src/assets-library.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,qBAAqB;;;EAAgC,CAAC;AACnE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;;;;;EAA2C,CAAC;AACjF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,uFAAuF;AACvF,eAAO,MAAM,wBAAwB;;;;;;;;;;EAUnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;iBAI/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAMlE,eAAO,MAAM,iBAAiB;;;;;;;;iBAQ5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,yBAAyB;;;;;;;;;;iBAEpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBA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AC;CACtE;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AAE7E,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,eAAe,CAAC;IAC5B,6BAA6B;IAC7B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qEAAqE;AACrE,MAAM,WAAW,WAAW;IAC1B,kFAAkF;IAClF,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,GAAG,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,IAAI,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC3D,MAAM,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,WAAW,iBAAiB;IAChC,4CAA4C;IAC5C,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IAClC;;;;;OAKG;IACH,aAAa,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACxE"}
@@ -0,0 +1,181 @@
1
+ // Assets Library — feature 013 contract surface.
2
+ // Replaces the legacy `assets` module's wire surface and adds folders, visibility,
3
+ // labels, and pluggable storage backends. Three logical sections in one file:
4
+ // (1) Domain types — visibility, storage backend code, asset reference kinds.
5
+ // (2) HTTP request/response Zod schemas for /api/v1/admin/assets/** and /assets/file/:id.
6
+ // (3) Cross-module SPI shapes — StorageAdapter, AssetReferenceDescriptor, CMS body embed.
7
+ //
8
+ // See specs/013-assets-library/contracts/ for the per-surface contracts these schemas back.
9
+ import { z } from 'zod';
10
+ import { isoDateTimeSchema, uuidSchema, multilingualStringSchema } from './common.js';
11
+ // ────────────────────────────────────────────────────────────────────────────
12
+ // (1) Domain types
13
+ // ────────────────────────────────────────────────────────────────────────────
14
+ export const assetVisibilitySchema = z.enum(['public', 'private']);
15
+ /**
16
+ * Storage-backend identifier persisted on every Asset row so that switching the
17
+ * platform's *active* adapter does not orphan files uploaded under a previous
18
+ * adapter. `'legacy'` is a runtime-only escape hatch for rows whose pre-013
19
+ * `storage_url` is an absolute URL — see specs/013-assets-library/research.md R11.
20
+ */
21
+ export const storageBackendCodeSchema = z.enum(['local', 's3', 'gcs', 'legacy']);
22
+ /** What kind of consumer pointed at a given Asset (used in delete-blocked dialogs). */
23
+ export const assetReferenceKindSchema = z.enum([
24
+ 'product_gallery',
25
+ 'product_attachment',
26
+ 'product_virtual_download',
27
+ 'category_main_image',
28
+ 'cms_body_embed',
29
+ 'megamenu_item_target',
30
+ 'blog_category_main_image',
31
+ 'blog_post_content',
32
+ 'blog_category_description',
33
+ ]);
34
+ export const assetReferenceSchema = z.object({
35
+ kind: assetReferenceKindSchema,
36
+ entityId: uuidSchema,
37
+ label: z.string(),
38
+ });
39
+ // ────────────────────────────────────────────────────────────────────────────
40
+ // (2) HTTP — folders
41
+ // ────────────────────────────────────────────────────────────────────────────
42
+ export const assetFolderSchema = z.object({
43
+ id: uuidSchema,
44
+ parentId: uuidSchema.nullable(),
45
+ name: z.string().min(1).max(160),
46
+ position: z.number().int().nonnegative(),
47
+ childIds: z.array(uuidSchema),
48
+ createdAt: isoDateTimeSchema,
49
+ updatedAt: isoDateTimeSchema,
50
+ });
51
+ export const listFoldersResponseSchema = z.object({
52
+ data: z.array(assetFolderSchema),
53
+ });
54
+ export const createFolderRequestSchema = z.object({
55
+ parentId: uuidSchema.nullable(),
56
+ name: z.string().min(1).max(160),
57
+ });
58
+ export const patchFolderRequestSchema = z
59
+ .object({
60
+ name: z.string().min(1).max(160).optional(),
61
+ parentId: uuidSchema.nullable().optional(),
62
+ position: z.number().int().nonnegative().optional(),
63
+ })
64
+ .refine((x) => x.name !== undefined || x.parentId !== undefined || x.position !== undefined, {
65
+ message: 'At least one of {name, parentId, position} is required.',
66
+ });
67
+ export const deleteFolderRequestSchema = z.object({
68
+ ifNonEmpty: z.enum(['cancel', 'moveContentsToParent', 'deleteRecursively']).default('cancel'),
69
+ });
70
+ export const deleteFolderResponseSchema = z.object({
71
+ data: z.object({
72
+ deletedFolderId: uuidSchema,
73
+ softDeletedAssetIds: z.array(uuidSchema).optional(),
74
+ }),
75
+ });
76
+ // ────────────────────────────────────────────────────────────────────────────
77
+ // (2) HTTP — assets list / detail
78
+ // ────────────────────────────────────────────────────────────────────────────
79
+ /**
80
+ * Public asset summary — appears in the Library list, the picker, and embedded
81
+ * inside Catalog/CMS storefront responses. `url` is freshly produced by the
82
+ * active adapter on every read; for `private` assets it is a short-lived
83
+ * signed URL whose TTL is governed by the `assets.privateUrlTtlSec` setting.
84
+ */
85
+ export const assetSummarySchema = z.object({
86
+ id: uuidSchema,
87
+ folderId: uuidSchema.nullable(),
88
+ filename: z.string().min(1).max(255),
89
+ label: z.string().nullable(),
90
+ mimeType: z.string().min(1).max(127),
91
+ sizeBytes: z.number().int().nonnegative(),
92
+ visibility: assetVisibilitySchema,
93
+ storageBackend: storageBackendCodeSchema,
94
+ url: z.string(),
95
+ createdAt: isoDateTimeSchema,
96
+ updatedAt: isoDateTimeSchema,
97
+ deletedAt: isoDateTimeSchema.nullable(),
98
+ pendingCleanup: z.boolean(),
99
+ });
100
+ /** Detail extends summary with multilingual alt text + the deletion-protection list. */
101
+ export const assetDetailSchema = assetSummarySchema.extend({
102
+ altText: multilingualStringSchema.nullable(),
103
+ references: z.array(assetReferenceSchema),
104
+ });
105
+ export const listAssetsQuerySchema = z.object({
106
+ folderId: uuidSchema.nullable().optional(),
107
+ q: z.string().optional(),
108
+ mime: z.string().optional(),
109
+ visibility: assetVisibilitySchema.optional(),
110
+ includeDeleted: z.coerce.boolean().default(false),
111
+ cursor: z.string().optional(),
112
+ limit: z.coerce.number().int().min(1).max(100).default(50),
113
+ });
114
+ export const listAssetsResponseSchema = z.object({
115
+ data: z.array(assetSummarySchema),
116
+ nextCursor: z.string().nullable(),
117
+ });
118
+ export const getAssetResponseSchema = z.object({ data: assetDetailSchema });
119
+ export const getAssetUrlResponseSchema = z.object({
120
+ data: z.object({
121
+ url: z.string(),
122
+ expiresAt: isoDateTimeSchema.nullable(),
123
+ }),
124
+ });
125
+ // ────────────────────────────────────────────────────────────────────────────
126
+ // (2) HTTP — asset mutation
127
+ // ────────────────────────────────────────────────────────────────────────────
128
+ export const patchAssetRequestSchema = z
129
+ .object({
130
+ filename: z.string().min(1).max(255).optional(),
131
+ label: z.string().nullable().optional(),
132
+ mimeType: z.string().min(1).max(127).optional(),
133
+ visibility: assetVisibilitySchema.optional(),
134
+ folderId: uuidSchema.nullable().optional(),
135
+ })
136
+ .refine((x) => Object.keys(x).length > 0, { message: 'At least one field is required.' });
137
+ export const moveAssetRequestSchema = z.object({ folderId: uuidSchema.nullable() });
138
+ export const moveManyAssetsRequestSchema = z.object({
139
+ assetIds: z.array(uuidSchema).min(1).max(200),
140
+ folderId: uuidSchema.nullable(),
141
+ });
142
+ export const moveManyAssetsResponseSchema = z.object({
143
+ data: z.object({ movedCount: z.number().int().nonnegative() }),
144
+ });
145
+ // ────────────────────────────────────────────────────────────────────────────
146
+ // (2) HTTP — storage administration
147
+ // ────────────────────────────────────────────────────────────────────────────
148
+ export const storageSelfCheckResponseSchema = z.object({
149
+ data: z.object({
150
+ adapter: storageBackendCodeSchema.exclude(['legacy']),
151
+ ok: z.boolean(),
152
+ reason: z.string().optional(),
153
+ }),
154
+ });
155
+ export const storageStateResponseSchema = z.object({
156
+ data: z.object({
157
+ activeAdapter: storageBackendCodeSchema.exclude(['legacy']),
158
+ selfCheck: z.object({ ok: z.boolean(), reason: z.string().optional() }),
159
+ pendingCleanupCount: z.number().int().nonnegative(),
160
+ softDeletedCount: z.number().int().nonnegative(),
161
+ }),
162
+ });
163
+ // ────────────────────────────────────────────────────────────────────────────
164
+ // (3) CMS body embed (FR-029)
165
+ // ────────────────────────────────────────────────────────────────────────────
166
+ export const assetRefNodeSchema = z
167
+ .object({
168
+ type: z.literal('asset_ref'),
169
+ assetId: uuidSchema,
170
+ rendering: z.enum(['image', 'link', 'embed']).optional(),
171
+ })
172
+ .passthrough();
173
+ /** Resolved view of an embedded asset, returned alongside the body in CMS responses. */
174
+ export const assetEmbedResolutionSchema = z.object({
175
+ url: z.string(),
176
+ mimeType: z.string(),
177
+ filename: z.string(),
178
+ label: z.string().nullable(),
179
+ visibility: assetVisibilitySchema,
180
+ });
181
+ //# sourceMappingURL=assets-library.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets-library.js","sourceRoot":"","sources":["../src/assets-library.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,mFAAmF;AACnF,8EAA8E;AAC9E,gFAAgF;AAChF,4FAA4F;AAC5F,4FAA4F;AAC5F,EAAE;AACF,4FAA4F;AAE5F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEtF,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAGnE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AAGjF,uFAAuF;AACvF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7C,iBAAiB;IACjB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S,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;QACvE,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;QACnD,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;KACjD,CAAC;CACH,CAAC,CAAC;AAGH,+EAA+E;AAC/E,8BAA8B;AAC9B,+EAA+E;AAE/E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAC5B,OAAO,EAAE,UAAU;IACnB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE;CACzD,CAAC;KACD,WAAW,EAAE,CAAC;AAGjB,wFAAwF;AACxF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,UAAU,EAAE,qBAAqB;CAClC,CAAC,CAAC"}
@@ -0,0 +1,141 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Audit-log reference labels — "what is this row about, and where does it live?"
4
+ * (feature 075, D-87 drain).
5
+ *
6
+ * The dashboard's Recent Activity card renders an audit row as a sentence: who
7
+ * acted, on what, and a link to the thing acted on. The audit row itself holds
8
+ * only an `objectType` and an `objectId`, so the label and the link have to come
9
+ * from the module that owns the object — and `audit_logs` used to fetch them by
10
+ * hand-writing SQL against five other modules' tables, invisible to every
11
+ * import-level boundary check because raw SQL names no specifier.
12
+ *
13
+ * The direction is what was wrong, not just the SQL. `audit_logs` is a
14
+ * cross-cutting *reader*: it is declared `nonDeactivatable`, so a `dependencies`
15
+ * entry from it onto `catalog`, `inventory` or `price_lists` would make each of
16
+ * those undeactivatable too — the lifecycle refuses to disable a module a
17
+ * non-deactivatable one depends on. Five read ports would have bought five
18
+ * edges pointing the wrong way and taken an operator's switch away from
19
+ * `inventory` to render a warehouse name. So the question is inverted: each
20
+ * owner pushes a resolver for its own object type, and the reader walks them.
21
+ */
22
+ /** One resolved object: what to call it, and where the admin app shows it. */
23
+ export interface AuditReferenceLabel {
24
+ /** The `objectId` this answers for. */
25
+ readonly id: string;
26
+ /**
27
+ * The owner's display name for the row — a product name, a warehouse name, an
28
+ * organisation name. Never empty: a resolver that has no name for a row omits
29
+ * the row instead, and the reader falls back to the audit snapshot.
30
+ */
31
+ readonly label: string;
32
+ /**
33
+ * Admin deep link for the row, or `null` where the owner has no detail screen
34
+ * for it.
35
+ *
36
+ * It travels on the descriptor because it is the owner's own admin route.
37
+ * `audit_logs` used to spell `/catalog/products/{id}`, `/warehouses/{id}` and
38
+ * `/price-lists/{id}` into its own switch statement, so three modules' route
39
+ * shapes were pinned by a fourth module's dashboard.
40
+ */
41
+ readonly url: string | null;
42
+ }
43
+ /**
44
+ * One contributed "turn these ids into labels" resolver.
45
+ *
46
+ * A module that owns rows an audit entry can point at registers one of these
47
+ * per `referenceType`, from its own `ctx.onBoot`. It queries its **own** tables
48
+ * and nothing else.
49
+ *
50
+ * `resolve` is bulk and is never called with an empty list: the reader buckets
51
+ * a page of audit rows by type first, so a dashboard render costs one round trip
52
+ * per type present rather than one per row. A resolver omits an id it cannot
53
+ * find — the row was deleted, and the reader says so by falling back to the
54
+ * audit snapshot and rendering no link.
55
+ *
56
+ * `ownerModuleId` is required and is the whole mechanism (D-39): without it the
57
+ * registry could not state a policy for an absent owner at all.
58
+ */
59
+ export interface AuditReferenceResolver {
60
+ readonly ownerModuleId: string;
61
+ /**
62
+ * The audit row's `objectType` for a target, or the synthetic key the reader
63
+ * uses for an actor bucket (`customer_account`). One resolver answers for one
64
+ * type; two modules may not claim the same one.
65
+ */
66
+ readonly referenceType: string;
67
+ resolve(ids: readonly string[]): Promise<AuditReferenceLabel[]>;
68
+ }
69
+ /**
70
+ * Container name: `auditReferenceRegistry`. Owner: `audit_logs`.
71
+ *
72
+ * A **contribution seam**: contributors push from a boot hook and read nothing
73
+ * back, so the registration is a plain `ctx.di.register` rather than a
74
+ * `providePort` — a boot hook that resolved a gate would stop the backend from
75
+ * starting whenever the registry's owner was switched off.
76
+ *
77
+ * **Enumeration policy: an absent contributor's resolver is skipped.** That is
78
+ * D-39's default and it is also the right answer here, on two grounds that
79
+ * differ from the dictionary registries' (which honour, for referential
80
+ * integrity). First, this is a *surface*: the descriptor supplies a deep link
81
+ * into an admin screen, and a screen a module that is not present does not
82
+ * contribute is one no link should point at. Second, resolving would mean
83
+ * reading a switched-off module's tables on its behalf, and a module that is off
84
+ * behaves as if never installed (Constitution XVII).
85
+ *
86
+ * Skipping is a degrade, not a refusal, and it is the one this module's manifest
87
+ * already commits to for actor names: the audit row still renders, with the
88
+ * snapshot label the entry carries or the raw id, and no link. The record
89
+ * outlives the directory.
90
+ *
91
+ * `owners()` stays presence-blind, for diagnostics and for the composition
92
+ * tests that assert who contributed.
93
+ */
94
+ export interface AuditReferenceRegistryPort {
95
+ register(resolver: AuditReferenceResolver): void;
96
+ /** The contributing module of every registered resolver, in registration order. */
97
+ owners(): readonly string[];
98
+ /**
99
+ * Labels for these ids of this type, keyed by id. Ids the owner has no row for
100
+ * are absent from the map, and so is every id of a type whose contributor is
101
+ * not effectively present.
102
+ */
103
+ resolve(referenceType: string, ids: readonly string[]): Promise<ReadonlyMap<string, AuditReferenceLabel>>;
104
+ }
105
+ /**
106
+ * One eligible module's row on the visibility surface.
107
+ *
108
+ * `moduleId` is any composed module's id, deliberately **not** an enum: the
109
+ * closed union of four core ids this replaces (`RecentActivityModule`) is
110
+ * exactly why a packaged module's activity was silently absent from the card
111
+ * rather than refused (D-163).
112
+ */
113
+ export declare const RecentActivityModuleVisibilitySchema: z.ZodObject<{
114
+ moduleId: z.ZodString;
115
+ moduleName: z.ZodString;
116
+ visible: z.ZodBoolean;
117
+ }, z.core.$strip>;
118
+ export type RecentActivityModuleVisibility = z.infer<typeof RecentActivityModuleVisibilitySchema>;
119
+ /** `GET /api/v1/admin/audit-log/recent-activity/visibility`. */
120
+ export declare const RecentActivityVisibilityListSchema: z.ZodObject<{
121
+ modules: z.ZodArray<z.ZodObject<{
122
+ moduleId: z.ZodString;
123
+ moduleName: z.ZodString;
124
+ visible: z.ZodBoolean;
125
+ }, z.core.$strip>>;
126
+ }, z.core.$strip>;
127
+ export type RecentActivityVisibilityList = z.infer<typeof RecentActivityVisibilityListSchema>;
128
+ /** `POST /api/v1/admin/audit-log/recent-activity/visibility/:moduleId`. */
129
+ export declare const RecentActivityVisibilityRequestSchema: z.ZodObject<{
130
+ visible: z.ZodBoolean;
131
+ }, z.core.$strip>;
132
+ export type RecentActivityVisibilityRequest = z.infer<typeof RecentActivityVisibilityRequestSchema>;
133
+ export declare const RecentActivityVisibilityResponseSchema: z.ZodObject<{
134
+ module: z.ZodObject<{
135
+ moduleId: z.ZodString;
136
+ moduleName: z.ZodString;
137
+ visible: z.ZodBoolean;
138
+ }, z.core.$strip>;
139
+ }, z.core.$strip>;
140
+ export type RecentActivityVisibilityResponse = z.infer<typeof RecentActivityVisibilityResponseSchema>;
141
+ //# sourceMappingURL=audit-logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-logs.d.ts","sourceRoot":"","sources":["../src/audit-logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,8EAA8E;AAC9E,MAAM,W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CAAC;AAEF,eAAO,MAAM,sCAAsC;;;;;;iBAEjD,CAAC;AACH,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,sCAAsC,CAC9C,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ // ---------------------------------------------------------------------------
3
+ // Recent-activity visibility — the operator axis of D-163.1 (feature 080)
4
+ // ---------------------------------------------------------------------------
5
+ /**
6
+ * One eligible module's row on the visibility surface.
7
+ *
8
+ * `moduleId` is any composed module's id, deliberately **not** an enum: the
9
+ * closed union of four core ids this replaces (`RecentActivityModule`) is
10
+ * exactly why a packaged module's activity was silently absent from the card
11
+ * rather than refused (D-163).
12
+ */
13
+ export const RecentActivityModuleVisibilitySchema = z.object({
14
+ moduleId: z.string().min(1),
15
+ /** The module's manifest `name` — what the operator reads on the control. */
16
+ moduleName: z.string().min(1),
17
+ /** The operator's answer. `true` when they have never chosen (D-163.1). */
18
+ visible: z.boolean(),
19
+ });
20
+ /** `GET /api/v1/admin/audit-log/recent-activity/visibility`. */
21
+ export const RecentActivityVisibilityListSchema = z.object({
22
+ modules: z.array(RecentActivityModuleVisibilitySchema),
23
+ });
24
+ /** `POST /api/v1/admin/audit-log/recent-activity/visibility/:moduleId`. */
25
+ export const RecentActivityVisibilityRequestSchema = z.object({
26
+ visible: z.boolean(),
27
+ });
28
+ export const RecentActivityVisibilityResponseSchema = z.object({
29
+ module: RecentActivityModuleVisibilitySchema,
30
+ });
31
+ //# sourceMappingURL=audit-logs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-logs.js","sourceRoot":"","sources":["../src/audit-logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgHxB,8EAA8E;AAC9E,0EAA0E;AAC1E,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,6EAA6E;IAC7E,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,2EAA2E;IAC3E,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC;AAKH,gEAAgE;AAChE,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,oCAAoC,CAAC;CACvD,CAAC,CAAC;AAKH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5D,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D,MAAM,EAAE,oCAAoC;CAC7C,CAAC,CAAC"}
package/dist/auth.d.ts ADDED
@@ -0,0 +1,174 @@
1
+ /**
2
+ * `auth` module contracts — the in-process port surface (feature 075, Phase P).
3
+ *
4
+ * `auth` publishes no HTTP shape of its own worth a Zod schema: it owns the
5
+ * session table, the session cookie names and the seam the `mfa` module plugs
6
+ * into. What every other module needs from it is behaviour, so this file is
7
+ * plain TypeScript interfaces, following `PaymentAdapter` in
8
+ * `payment-methods.ts` and `DictionaryValidator` in `dictionary.ts`.
9
+ *
10
+ * Nothing here imports from `backend/src/` (FR-034).
11
+ *
12
+ * **Not here on purpose:** `hashPassword` / `verifyPassword`. They are pure
13
+ * functions over their argument, so a gated port answering 503
14
+ * `MODULE_DISABLED` to "hash this string" would be a bug, not a degrade
15
+ * (FR-013, R-09). They relocated to `backend/src/kernel/crypto/password-hasher.ts`.
16
+ */
17
+ /**
18
+ * The storefront session cookie. Published here because it is a **constant**,
19
+ * not behaviour: five modules set or clear it, and switching `auth` off does
20
+ * not change its spelling. `auth/plugin.ts` re-exports these two so its own
21
+ * default-argument reads keep working.
22
+ */
23
+ export declare const SESSION_COOKIE_NAME = "b2b_session";
24
+ /** The admin session cookie. Same reasoning as {@link SESSION_COOKIE_NAME}. */
25
+ export declare const ADMIN_SESSION_COOKIE_NAME = "b2b_admin_session";
26
+ export type AuthSessionKind = 'customer' | 'admin' | 'impersonation';
27
+ /**
28
+ * A session row as it crosses the module boundary — a plain shape, never the
29
+ * `Session` ORM entity (FR-011). `tokenHash` is deliberately absent: no
30
+ * consumer reads it and it is the one field that must not travel.
31
+ */
32
+ export interface AuthSessionRecord {
33
+ id: string;
34
+ kind: AuthSessionKind;
35
+ customerAccountId: string | null;
36
+ adminUserId: string | null;
37
+ impersonatorAdminUserId: string | null;
38
+ expiresAt: Date;
39
+ createdAt: Date;
40
+ updatedAt: Date;
41
+ lastSeenAt: Date | null;
42
+ ipAddress: string | null;
43
+ userAgent: string | null;
44
+ }
45
+ export interface AuthCreateSessionInput {
46
+ kind: AuthSessionKind;
47
+ customerAccountId?: string;
48
+ adminUserId?: string;
49
+ impersonatorAdminUserId?: string;
50
+ ipAddress?: string;
51
+ userAgent?: string;
52
+ }
53
+ /** What a caller needs to set the cookie: the value, its expiry, and the row. */
54
+ export interface AuthSessionCookiePayload {
55
+ cookieValue: string;
56
+ expiresAt: Date;
57
+ session: AuthSessionRecord;
58
+ }
59
+ export interface AuthResolvedSession {
60
+ session: AuthSessionRecord;
61
+ kind: AuthSessionKind;
62
+ }
63
+ /**
64
+ * Container name: `authSessionPort`. Owner: `auth`.
65
+ *
66
+ * When `auth` is off every method throws `ModuleDisabledError` (503
67
+ * `MODULE_DISABLED`) at the resolution seam — which is the correct answer: a
68
+ * platform that cannot mint or validate a session must refuse the login rather
69
+ * than issue one nothing can check.
70
+ *
71
+ * Whether `auth` has an off state at all is its manifest's `activation` to
72
+ * say, not this line's: a module declaring `nonDeactivatable` never enters one.
73
+ */
74
+ export interface AuthSessionPort {
75
+ createSession(input: AuthCreateSessionInput): Promise<AuthSessionCookiePayload>;
76
+ loadSession(cookieValue: string): Promise<AuthResolvedSession | null>;
77
+ destroySession(sessionId: string): Promise<void>;
78
+ destroyAllForCustomer(customerAccountId: string): Promise<void>;
79
+ /**
80
+ * Revoke every session an admin user holds — the ones they signed in with
81
+ * and the impersonations they started. Called when their password is set by
82
+ * somebody other than the current session, so a credential the reset was
83
+ * meant to withdraw cannot outlive it (issue #252).
84
+ */
85
+ destroyAllForAdmin(adminUserId: string): Promise<void>;
86
+ touchLastSeen(sessionId: string): Promise<void>;
87
+ /** Customer-account ids seen inside the window. Feature 040's "online" view. */
88
+ listRecentlyActiveCustomers(windowMinutes: number): Promise<string[]>;
89
+ }
90
+ /** One customer's most recent session activity. */
91
+ export interface AuthCustomerLastSeen {
92
+ customerAccountId: string;
93
+ lastSeenAt: Date;
94
+ }
95
+ /**
96
+ * Container name: `authSessionReadPort`. Owner: `auth`.
97
+ *
98
+ * The read model over the session table for the one module that *reports* on
99
+ * sessions rather than managing them: `customers`' online-customers view reads
100
+ * `Session` directly today to work out when each account was last active.
101
+ *
102
+ * The surface is that single question and nothing more — publishing the table
103
+ * would be publishing nothing (contracts/port-publication.md §1.1).
104
+ *
105
+ * When `auth` is off the call fails closed, which is right: an "online now"
106
+ * view assembled from no session data would be a list of everybody, at an
107
+ * invented timestamp.
108
+ *
109
+ * Whether `auth` has an off state at all is its manifest's `activation` to
110
+ * say, not this line's: a module declaring `nonDeactivatable` never enters one.
111
+ */
112
+ export interface AuthSessionReadPort {
113
+ /**
114
+ * The newest `lastSeenAt` per customer account, restricted to the given
115
+ * accounts and to activity at or after `since`. Accounts with no matching
116
+ * session are absent from the result rather than present with a null.
117
+ */
118
+ lastSeenByCustomerAccount(customerAccountIds: readonly string[], since: Date): Promise<AuthCustomerLastSeen[]>;
119
+ }
120
+ export interface MfaSubjectRef {
121
+ subjectType: 'customer' | 'admin';
122
+ subjectId: string;
123
+ }
124
+ export interface MfaLoginContext {
125
+ /** Resolved storefront channel id, or null for admin / channel-less reads. */
126
+ salesChannelId: string | null;
127
+ /** The customer's organization id (null for admin or org-less customers). */
128
+ organizationId?: string | null;
129
+ }
130
+ /**
131
+ * Decision returned after the first factor (password / provider) succeeds:
132
+ * - `proceed` — no active 2FA and not enforced → issue the session now;
133
+ * - `challenge` — an active enrolment exists → require the second step;
134
+ * - `setup` — 2FA is enforced for this scope but the subject has not
135
+ * enrolled → route into mandatory setup before access.
136
+ */
137
+ export type MfaLoginDecision = {
138
+ kind: 'proceed';
139
+ } | {
140
+ kind: 'challenge';
141
+ challengeId: string;
142
+ } | {
143
+ kind: 'setup';
144
+ setupTicket: string;
145
+ };
146
+ /**
147
+ * Container name: `mfaLoginPort`. Owner: `mfa` (the shape is `auth`'s).
148
+ *
149
+ * One question: *what does the second factor say about this login?* Asked by
150
+ * `admin_users` and `customer_accounts`, each after the password has verified.
151
+ *
152
+ * **The registration is gated and it throws.** `mfa` publishes this name with
153
+ * `ctx.di.providePort`, so resolving it while the module is not effectively
154
+ * present raises `ModuleDisabledError`. This port performs no degrade of its
155
+ * own, and no caller may catch that error.
156
+ *
157
+ * **The consumer answers for absence, by not resolving** (D-96). Both login
158
+ * services probe `effectiveState.isPresent('mfa')` and pass `undefined` into
159
+ * the `if (mfaPort)` branch they already have, which issues the session on the
160
+ * password alone — the password-only fallback of feature 042 FR-033, and what
161
+ * Constitution XVII means by "a module that is off behaves as if never
162
+ * installed". Each consumer declares the edge in its manifest as
163
+ * `nonBindingDependencies: [{ moduleId: 'mfa', kind: 'degrades-without' }]`,
164
+ * whose `whenAbsent` sentence is what the operator reads before flipping the
165
+ * switch and what the off-state test is held to.
166
+ *
167
+ * This doc block used to describe the degrade as something the port would
168
+ * perform. It never could, and the tree did the opposite: every admin and
169
+ * customer login answered 503 while `mfa` was switched off.
170
+ */
171
+ export interface MfaLoginPort {
172
+ beginLogin(subject: MfaSubjectRef, ctx: MfaLoginContext): Promise<MfaLoginDecision>;
173
+ }
174
+ //# sourceMappingURL=auth.d.ts.map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;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACrF"}
package/dist/auth.js ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * `auth` module contracts — the in-process port surface (feature 075, Phase P).
3
+ *
4
+ * `auth` publishes no HTTP shape of its own worth a Zod schema: it owns the
5
+ * session table, the session cookie names and the seam the `mfa` module plugs
6
+ * into. What every other module needs from it is behaviour, so this file is
7
+ * plain TypeScript interfaces, following `PaymentAdapter` in
8
+ * `payment-methods.ts` and `DictionaryValidator` in `dictionary.ts`.
9
+ *
10
+ * Nothing here imports from `backend/src/` (FR-034).
11
+ *
12
+ * **Not here on purpose:** `hashPassword` / `verifyPassword`. They are pure
13
+ * functions over their argument, so a gated port answering 503
14
+ * `MODULE_DISABLED` to "hash this string" would be a bug, not a degrade
15
+ * (FR-013, R-09). They relocated to `backend/src/kernel/crypto/password-hasher.ts`.
16
+ */
17
+ // --- session cookie names ----------------------------------------------------
18
+ /**
19
+ * The storefront session cookie. Published here because it is a **constant**,
20
+ * not behaviour: five modules set or clear it, and switching `auth` off does
21
+ * not change its spelling. `auth/plugin.ts` re-exports these two so its own
22
+ * default-argument reads keep working.
23
+ */
24
+ export const SESSION_COOKIE_NAME = 'b2b_session';
25
+ /** The admin session cookie. Same reasoning as {@link SESSION_COOKIE_NAME}. */
26
+ export const ADMIN_SESSION_COOKIE_NAME = 'b2b_admin_session';
27
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAEjD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,yBAAyB,GAAG,mBAAmB,CAAC"}