@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":"invoices.d.ts","sourceRoot":"","sources":["../src/invoices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;GAOG;AAEH,eAAO,MAAM,iBAAiB;;;;;EAAsD,CAAC;AACrF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,kFAAkF;AAClF,eAAO,MAAM,mBAAmB;;;EAAqC,CAAC;AACtE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,2EAA2E;AAC3E,eAAO,MAAM,yBAAyB;;;EAA4B,CAAC;AACnE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;iBAKpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,mBAAmB;;;;EAA4C,CAAC;AAC7E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB;;;EAAiC,CAAC;AACxE,MAAM,MAAM,mBAAmB,GAAG,C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,2BAA2B,CAAC,CAAC;IAChG,wBAAwB,CAAC,KAAK,EAAE;QAC9B,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,gCAAgC,GAAG,IAAI,CAAC,CAAC;IACrD,wFAAwF;IACxF,mBAAmB,CAAC,KAAK,EAAE;QACzB,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC7B,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtB;AAOD,eAAO,MAAM,iCAAiC,EAAG,gCAAyC,CAAC;AAE3F;;;;;;;;GAQG;AACH,MAAM,WAAW,0BAA0B;IACzC,qBAAqB,CAAC,KAAK,EAAE;QAC3B,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;CACzC;AAED,2EAA2E;AAC3E,MAAM,WAAW,kCAAkC;IACjD,oFAAoF;IACpF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,CAAC;CAC/C;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,YAAY,EAAE,kCAAkC,GAAG,IAAI,CAAC;CAClE"}
@@ -0,0 +1,314 @@
1
+ import { z } from 'zod';
2
+ import { isoDateTimeSchema, uuidSchema } from './common.js';
3
+ /**
4
+ * Invoices (FR-080 + feature 047-invoices-module). Produces proforma, VAT
5
+ * invoice, and corrective (credit-note) PDFs against orders. The binary
6
+ * download happens at `GET /orders/:id/invoices/:invoiceId/pdf` (customer) and
7
+ * `GET /admin/invoices/:id/pdf` (admin); this file defines the JSON metadata,
8
+ * the seller/company settings shape, the line/VAT-summary snapshots, and the
9
+ * WYSIWYG template metadata.
10
+ */
11
+ export const invoiceKindSchema = z.enum(['proforma', 'invoice', 'correction', 'wz']);
12
+ /** Whether a row was issued by the platform or imported from an ERP connector. */
13
+ export const invoiceOriginSchema = z.enum(['platform', 'erp_import']);
14
+ /** Sale-document kind carried inside {@link externalDocumentRefSchema}. */
15
+ export const erpSaleDocumentKindSchema = z.enum(['invoice', 'wz']);
16
+ /**
17
+ * Stable identity for an ERP-imported sale document (feature 119, FR-087/FR-088).
18
+ *
19
+ * An imported document is identified by the pair `(system, externalId)`: the
20
+ * source system it was imported from, and its id in that system. Ids from two
21
+ * source systems come from unrelated id spaces, so the same `externalId` from
22
+ * another `system` is another document (feature 134, T135; `research.md` D21).
23
+ *
24
+ * `system` is also the key an attachment fetch provider registers under
25
+ * ({@link InvoiceAttachmentFetchRegistryPort}). It is open rather than a literal
26
+ * since feature 134 (T065): a free contract that enumerates its connectors has
27
+ * to be edited for every connector that is added, which is the coupling the
28
+ * seam removes. `externalNumber` is the document number the source system
29
+ * shows, when it has one.
30
+ */
31
+ export const externalDocumentRefSchema = z.object({
32
+ system: z.string().min(1).max(64),
33
+ externalId: z.string().min(1).max(128),
34
+ externalNumber: z.string().max(64).optional(),
35
+ documentKind: erpSaleDocumentKindSchema,
36
+ });
37
+ export const invoiceStatusSchema = z.enum(['pending', 'ready', 'cancelled']);
38
+ /** Whether the invoice email carries the PDF or a storefront download link. */
39
+ export const invoiceDeliveryModeSchema = z.enum(['attachment', 'link']);
40
+ /**
41
+ * Seller (own company) data printed on every invoice. Stored as a JSON setting
42
+ * (`invoices.seller.company_data`); the VAT/NIP lives in a separate
43
+ * `invoices.seller.tax_id` setting but is surfaced together here at render time.
44
+ */
45
+ export const sellerCompanyDataSchema = z.object({
46
+ legalName: z.string().max(255),
47
+ addressLine1: z.string().max(255),
48
+ addressLine2: z.string().max(255).optional().default(''),
49
+ postalCode: z.string().max(20),
50
+ city: z.string().max(120),
51
+ country: z.string().max(2).describe('ISO-3166-1 alpha-2 country code'),
52
+ taxId: z.string().max(32).optional().default(''),
53
+ bankName: z.string().max(160).optional().default(''),
54
+ bankAccount: z.string().max(64).optional().default(''),
55
+ swift: z.string().max(32).optional().default(''),
56
+ email: z.string().max(320).optional().default(''),
57
+ phone: z.string().max(32).optional().default(''),
58
+ });
59
+ /** Buyer (recipient) snapshot captured at issuance. */
60
+ export const invoiceBuyerSchema = z.object({
61
+ name: z.string().max(255),
62
+ taxId: z.string().max(32).optional().default(''),
63
+ addressLine1: z.string().max(255).optional().default(''),
64
+ addressLine2: z.string().max(255).optional().default(''),
65
+ postalCode: z.string().max(20).optional().default(''),
66
+ city: z.string().max(120).optional().default(''),
67
+ country: z.string().max(2).optional().default(''),
68
+ });
69
+ /** One immutable invoice line, snapshotted from the order at issuance. */
70
+ export const invoiceLineSchema = z.object({
71
+ ordinal: z.number().int().positive(),
72
+ name: z.string().max(512),
73
+ unit: z.string().max(32),
74
+ quantity: z.number().finite(),
75
+ unitNetPrice: z.number().finite(),
76
+ taxRate: z.number().finite().describe('Fractional VAT rate, e.g. 0.23 for 23%'),
77
+ netValue: z.number().finite(),
78
+ grossValue: z.number().finite(),
79
+ });
80
+ /** Aggregation per VAT rate; reconciles with the invoice totals. */
81
+ export const vatSummaryRowSchema = z.object({
82
+ taxRate: z.number().finite(),
83
+ netTotal: z.number().finite(),
84
+ vatAmount: z.number().finite(),
85
+ grossTotal: z.number().finite(),
86
+ });
87
+ export const invoiceSchema = z.object({
88
+ id: uuidSchema,
89
+ orderId: uuidSchema.nullable(),
90
+ salesChannelId: uuidSchema.nullable(),
91
+ kind: invoiceKindSchema,
92
+ number: z.string(),
93
+ status: invoiceStatusSchema,
94
+ currency: z.string().length(3),
95
+ issuedAt: isoDateTimeSchema,
96
+ saleDate: z.string().nullable(),
97
+ paymentDueDate: z.string().nullable(),
98
+ paymentMethod: z.string().nullable(),
99
+ netTotal: z.number().finite(),
100
+ taxTotal: z.number().finite(),
101
+ grossTotal: z.number().finite(),
102
+ paidTotal: z.number().finite(),
103
+ amountDue: z.number().finite(),
104
+ /** Legacy alias of grossTotal kept for back-compat with the original schema. */
105
+ total: z.number().finite(),
106
+ originalInvoiceId: uuidSchema.nullable(),
107
+ templateId: uuidSchema.nullable(),
108
+ pdfAssetId: uuidSchema.nullable(),
109
+ ksefReferenceNumber: z.string().nullable(),
110
+ ksefProcessedAt: isoDateTimeSchema.nullable(),
111
+ });
112
+ export const invoiceDetailSchema = invoiceSchema.extend({
113
+ /** Human-readable order business id (e.g. `ORD-…`); null if the order is gone. */
114
+ orderBusinessId: z.string().nullable(),
115
+ lines: z.array(invoiceLineSchema),
116
+ vatSummary: z.array(vatSummaryRowSchema),
117
+ seller: sellerCompanyDataSchema,
118
+ buyer: invoiceBuyerSchema,
119
+ });
120
+ /** WYSIWYG (Puck) invoice PDF template metadata. */
121
+ export const invoiceTemplateSchema = z.object({
122
+ id: uuidSchema,
123
+ code: z.string().max(180),
124
+ name: z.string().max(200),
125
+ salesChannelId: uuidSchema.nullable(),
126
+ languages: z.array(z.string()),
127
+ active: z.boolean(),
128
+ isSystem: z.boolean(),
129
+ version: z.number().int(),
130
+ });
131
+ /** Body for issuing an invoice/proforma against an order. */
132
+ export const issueInvoiceRequestSchema = z.object({
133
+ kind: z.enum(['invoice', 'proforma']).default('invoice'),
134
+ saleDate: z.string().optional(),
135
+ paymentDueDate: z.string().optional(),
136
+ });
137
+ /** Body for (re)sending the invoice email. */
138
+ export const sendInvoiceEmailRequestSchema = z.object({
139
+ mode: invoiceDeliveryModeSchema.optional(),
140
+ });
141
+ /**
142
+ * Why the invoice e-mail did not go out (issue #103).
143
+ *
144
+ * The dispatcher has answered these seven since #103; they only ever reached a
145
+ * log. They are part of the API shape now because the operator who clicked
146
+ * "issue" is the one person who can act on them (issue #149).
147
+ */
148
+ export const invoiceEmailNotSentReasonSchema = z.enum([
149
+ /** No transactional sender is wired in this composition. */
150
+ 'no_sender',
151
+ /** The invoice, or the order behind it, could not be loaded. */
152
+ 'invoice_not_found',
153
+ /** No recipient address could be resolved for the order. */
154
+ 'no_recipient',
155
+ /** The operator switched the `invoice_issued` e-mail off. */
156
+ 'deactivated',
157
+ /** No mailer is wired behind the sender. */
158
+ 'no_transport',
159
+ /** No `invoice_issued` template exists yet. */
160
+ 'no_definition',
161
+ /** The send raised, and the issuance was kept (FR-029). */
162
+ 'failed',
163
+ ]);
164
+ /**
165
+ * `POST /admin/invoices/:id/send-email` — the answer to an explicitly requested
166
+ * re-send. The route has carried it since issue #103; it is written down here
167
+ * because both admin surfaces used to announce "sent" over it (issue #149).
168
+ */
169
+ export const sendInvoiceEmailResultSchema = z.discriminatedUnion('ok', [
170
+ z.object({ ok: z.literal(true) }),
171
+ z.object({ ok: z.literal(false), reason: invoiceEmailNotSentReasonSchema }),
172
+ ]);
173
+ /**
174
+ * What became of the send-on-issue e-mail an issuance triggered (issue #149).
175
+ *
176
+ * Three answers, and the middle one is the point: `not_requested` means the
177
+ * operator switched send-on-issue off for this channel, which is a configured
178
+ * choice and not a delivery that failed. Reading "no e-mail" out of a missing
179
+ * field cannot tell those apart, which is how an issuance whose notification was
180
+ * suppressed came back as a bare 201 saying "issued".
181
+ *
182
+ * A suppressed or failed e-mail never invalidates the issuance (FR-029): the
183
+ * invoice is a legal document that was drawn, numbered and stored, so this
184
+ * rides **alongside** a 201 rather than turning it into an error.
185
+ */
186
+ export const issueInvoiceEmailOutcomeSchema = z.discriminatedUnion('status', [
187
+ z.object({ status: z.literal('sent') }),
188
+ z.object({ status: z.literal('not_requested') }),
189
+ z.object({ status: z.literal('not_sent'), reason: invoiceEmailNotSentReasonSchema }),
190
+ ]);
191
+ /**
192
+ * `POST /admin/orders/:orderId/invoices` — the issued document plus what became
193
+ * of its notification. `email` is a sibling of `data`, the way `pagination` is
194
+ * on a collection: it describes the action, not the invoice, and the invoice
195
+ * detail shape stays identical on every surface that reads one.
196
+ */
197
+ export const issueInvoiceResponseSchema = z.object({
198
+ data: invoiceDetailSchema,
199
+ email: issueInvoiceEmailOutcomeSchema,
200
+ });
201
+ export const INVOICE_NUMBERING_HOST_PORT = 'invoiceNumberingHostPort';
202
+ export const INVOICE_PAID_HOST_PORT = 'invoicePaidHostPort';
203
+ export const INVOICE_COPY_HOST_PORT = 'invoiceCopyHostPort';
204
+ export const INVOICE_KSEF_ASSIGNMENT_PORT = 'invoiceKsefAssignmentPort';
205
+ // ---------------------------------------------------------------------------
206
+ // Domain events — `invoice.issued.v1`, `invoice.corrected.v1`
207
+ // ---------------------------------------------------------------------------
208
+ //
209
+ // Raised by this module and read by whoever subscribes: `invoice_ledger`
210
+ // routes them to an accounting vendor, and `ksef` submits them to the national
211
+ // clearing system. They were declared in the KSeF vendor file until feature
212
+ // 134's T062 (`specs/134-paid-module-extraction/research.md` §C.4): the payload
213
+ // of an event is the contract of the module that raises it, so a subscriber
214
+ // never has to read another subscriber's contract to understand it.
215
+ //
216
+ // Both describe the fields a subscriber reads. The emitter also sends the
217
+ // `eventId` / `occurredAt` envelope every in-process event carries, which a
218
+ // subscriber's parse ignores.
219
+ /** `invoice.issued.v1` payload, emitted when `invoices` issues a VAT invoice or a proforma. */
220
+ export const invoiceIssuedEventSchema = z.object({
221
+ invoiceId: z.string().uuid(),
222
+ orderId: z.string().uuid(),
223
+ kind: z.enum(['invoice', 'proforma']),
224
+ salesChannelId: z.string().uuid().nullable(),
225
+ });
226
+ /** `invoice.corrected.v1` payload, emitted when `invoices` issues a corrective invoice. */
227
+ export const invoiceCorrectedEventSchema = z.object({
228
+ invoiceId: z.string().uuid(),
229
+ originalInvoiceId: z.string().uuid().nullable(),
230
+ orderId: z.string().uuid(),
231
+ salesChannelId: z.string().uuid().nullable(),
232
+ });
233
+ // ---------------------------------------------------------------------------
234
+ // Numbering — the pattern vocabulary and the collision shapes (feature 078, D-95)
235
+ // ---------------------------------------------------------------------------
236
+ /**
237
+ * The tokens an invoice numbering pattern may contain. Everything else in a
238
+ * pattern is literal text.
239
+ *
240
+ * `{channel}` renders the sales channel's `code`, uppercased and otherwise
241
+ * verbatim. The code charset is `/^[a-z][a-z0-9_-]*$/`
242
+ * (`salesChannelCreateBodySchema`), so uppercasing is injective and no two
243
+ * channels can produce the same discriminator; the code is also immutable
244
+ * (the update schema accepts it only when it repeats the current value), so a
245
+ * number already rendered through `{channel}` can never be retroactively
246
+ * invalidated by a rename.
247
+ */
248
+ export const INVOICE_NUMBER_TOKENS = [
249
+ 'seq',
250
+ 'seq:N',
251
+ 'channel',
252
+ 'YYYY',
253
+ 'YY',
254
+ 'MM',
255
+ ];
256
+ // ---------------------------------------------------------------------------
257
+ // ERP-imported sale documents (feature 119, FR-086–FR-088)
258
+ // ---------------------------------------------------------------------------
259
+ export const ERP_SALE_DOCUMENT_WRITE_PORT = 'erpSaleDocumentWritePort';
260
+ /**
261
+ * Metadata for a source-system attachment registered on import; bytes arrive on
262
+ * first download (FR-086). `externalAttachmentId` is the attachment's id in the
263
+ * source system, unique within its document.
264
+ */
265
+ export const erpSaleDocumentAttachmentInputSchema = z.object({
266
+ externalAttachmentId: z.string().max(128),
267
+ fileName: z.string().max(256),
268
+ contentType: z.string().max(128).nullable().optional(),
269
+ });
270
+ export const erpSaleDocumentUpsertInputSchema = z.object({
271
+ organizationId: uuidSchema,
272
+ orderId: uuidSchema.nullable().optional(),
273
+ externalDocumentRef: externalDocumentRefSchema,
274
+ kind: invoiceKindSchema,
275
+ number: z.string().max(64),
276
+ currency: z.string().length(3),
277
+ issuedAt: isoDateTimeSchema,
278
+ saleDate: z.string().nullable().optional(),
279
+ paymentDueDate: z.string().nullable().optional(),
280
+ paymentMethod: z.string().max(64).nullable().optional(),
281
+ netTotal: z.string().nullable().optional(),
282
+ taxTotal: z.string().nullable().optional(),
283
+ grossTotal: z.string(),
284
+ paidTotal: z.string().optional(),
285
+ buyerSnapshot: invoiceBuyerSchema.nullable().optional(),
286
+ attachments: z.array(erpSaleDocumentAttachmentInputSchema).optional(),
287
+ });
288
+ export const erpSaleDocumentUpsertResultSchema = z.object({
289
+ invoiceId: uuidSchema,
290
+ created: z.boolean(),
291
+ });
292
+ export const erpSaleDocumentAttachmentListItemSchema = z.object({
293
+ id: uuidSchema,
294
+ fileName: z.string(),
295
+ contentType: z.string().nullable(),
296
+ downloadHref: z.string(),
297
+ });
298
+ export const erpSaleDocumentListItemSchema = z.object({
299
+ id: uuidSchema,
300
+ kind: invoiceKindSchema,
301
+ number: z.string(),
302
+ documentKind: erpSaleDocumentKindSchema,
303
+ issuedAt: isoDateTimeSchema,
304
+ currency: z.string(),
305
+ total: z.number().finite(),
306
+ orderId: uuidSchema.nullable(),
307
+ attachments: z.array(erpSaleDocumentAttachmentListItemSchema),
308
+ });
309
+ // ---------------------------------------------------------------------------
310
+ // ERP attachment fetch — the seam an importing connector contributes to
311
+ // (feature 134, T061; `specs/134-paid-module-extraction/research.md` D12)
312
+ // ---------------------------------------------------------------------------
313
+ export const INVOICE_ATTACHMENT_FETCH_REGISTRY = 'invoiceAttachmentFetchRegistry';
314
+ //# sourceMappingURL=invoices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoices.js","sourceRoot":"","sources":["../src/invoices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;AAGrF,kFAAkF;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,YAAY,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AAC,CAAC;AAKH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,iBAAiB;IACvB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,YAAY,EAAE,yBAAyB;IACvC,QAAQ,EAAE,iBAAiB;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE;IAC1B,OAAO,EAAE,UAAU,CAAC,QAAQ,EAAE;IAC9B,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,uCAAuC,CAAC;CAC9D,CAAC,CAAC;AA0CH,8EAA8E;AAC9E,wEAAwE;AACxE,0EAA0E;AAC1E,8EAA8E;AAE9E,MAAM,CAAC,MAAM,iCAAiC,GAAG,gCAAyC,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Kernel composition contracts (feature 072).
3
+ *
4
+ * **Scope note — a correction to `tasks.md` T003/T004.** Those tasks ask for
5
+ * `ModuleContext`, `Registration`, `RegistrationBuilder` and `PlatformScope` to
6
+ * live here. They cannot: this package declares exactly one dependency (`zod`)
7
+ * and is consumed by the admin app and the storefront, whereas those four types
8
+ * reference `FastifyInstance`, `bullmq`'s `Worker`, MikroORM's `EntityManager`,
9
+ * `TenantContext` and awilix's resolver types. Putting them here would drag the
10
+ * backend's entire framework surface into every browser bundle, and would need
11
+ * new dependencies on a feature whose budget is one (`awilix`).
12
+ *
13
+ * So the split is: **framework-agnostic data shapes and vocabulary here**, the
14
+ * framework-coupled composition types in `backend/src/kernel/`. That is also
15
+ * what `plan.md`'s "Source Code" tree and `contracts/module-context.md`'s own
16
+ * example import (`from '../../kernel/index.js'`) already assume.
17
+ */
18
+ /**
19
+ * How long the container keeps an instance of a registration.
20
+ *
21
+ * `transient` is not a fallback — it is what `emFactory` uses, so every
22
+ * resolution hands out a fresh `EntityManager` fork exactly as the pre-kernel
23
+ * composition root did (research R-1b).
24
+ */
25
+ export type RegistrationLifetime = 'singleton' | 'scoped' | 'transient';
26
+ /**
27
+ * The classes of entry point that establish a scoped execution. Every one of
28
+ * them goes through `enterPlatformScope`; before feature 072 only the HTTP path
29
+ * and (most of) the worker path established a tenant context at all.
30
+ *
31
+ * `'message'` is a Redis pub/sub callback (issue #235). It is its own label
32
+ * rather than a `'worker'`, because it is neither a BullMQ job nor a timer: it
33
+ * is delivered from a socket the composition opened, so it inherits no context
34
+ * from whatever asked for the work, and its own label is what says so at the
35
+ * call site.
36
+ */
37
+ export type ScopeEntryPointKind = 'http' | 'worker' | 'cli' | 'boot' | 'interval' | 'message';
38
+ /**
39
+ * Per-execution metadata carried by a scope. Field names match the Command
40
+ * Bus's `CommandRequestMeta` deliberately, so the audit row a Command writes can
41
+ * be fed from the scope without a translation step.
42
+ */
43
+ export interface RequestMeta {
44
+ /** Correlation id — the inbound `X-Request-Id`, or one generated at the edge. */
45
+ readonly requestId?: string | null;
46
+ readonly ipAddress?: string | null;
47
+ readonly userAgent?: string | null;
48
+ }
49
+ //# sourceMappingURL=kernel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../src/kernel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAExE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,QAAQ,GACR,KAAK,GACL,MAAM,GACN,UAAU,GACV,SAAS,CAAC;AAEd;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC"}
package/dist/kernel.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Kernel composition contracts (feature 072).
3
+ *
4
+ * **Scope note — a correction to `tasks.md` T003/T004.** Those tasks ask for
5
+ * `ModuleContext`, `Registration`, `RegistrationBuilder` and `PlatformScope` to
6
+ * live here. They cannot: this package declares exactly one dependency (`zod`)
7
+ * and is consumed by the admin app and the storefront, whereas those four types
8
+ * reference `FastifyInstance`, `bullmq`'s `Worker`, MikroORM's `EntityManager`,
9
+ * `TenantContext` and awilix's resolver types. Putting them here would drag the
10
+ * backend's entire framework surface into every browser bundle, and would need
11
+ * new dependencies on a feature whose budget is one (`awilix`).
12
+ *
13
+ * So the split is: **framework-agnostic data shapes and vocabulary here**, the
14
+ * framework-coupled composition types in `backend/src/kernel/`. That is also
15
+ * what `plan.md`'s "Source Code" tree and `contracts/module-context.md`'s own
16
+ * example import (`from '../../kernel/index.js'`) already assume.
17
+ */
18
+ export {};
19
+ //# sourceMappingURL=kernel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernel.js","sourceRoot":"","sources":["../src/kernel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * `languages` module contracts — the in-process port surface (feature 075,
3
+ * Phase P).
4
+ *
5
+ * The module's own HTTP shapes are `dictionary.ts`' business: `dictionaries`
6
+ * serves the admin screen over both this table and `currencies`'. What belongs
7
+ * here is what the other four modules ask of it — sixteen import sites, ten of
8
+ * them `dictionaries` reading the `Language` entity directly to resolve a
9
+ * label, validate a code or walk a fallback chain.
10
+ *
11
+ * Plain TypeScript rather than Zod: these describe in-process calls.
12
+ *
13
+ * Nothing here imports from `backend/src/` (FR-034).
14
+ */
15
+ /**
16
+ * The EventBus name `languages` announces on after any write.
17
+ *
18
+ * Published as a **constant, not a port** (FR-013): it is a string, and
19
+ * whoever caches language data subscribes to it. The direction is deliberate
20
+ * and stays — `languages` announces, and it must not know who listens, so
21
+ * there is no manifest dependency in either direction over this name.
22
+ */
23
+ export declare const LANGUAGE_CHANGED_EVENT = "languages.changed";
24
+ /**
25
+ * A language as it crosses a module boundary — a plain shape, never the ORM
26
+ * entity (FR-011). The primary key is `code`, not a uuid; that is the table's
27
+ * own design and consumers key on it.
28
+ */
29
+ export interface LanguageRecord {
30
+ /** BCP-47-ish code. The primary key. */
31
+ code: string;
32
+ label: string;
33
+ nativeLabel: string;
34
+ isRtl: boolean;
35
+ /** The language a missing translation falls back to, or `null` for none. */
36
+ fallbackCode: string | null;
37
+ isDefault: boolean;
38
+ isActive: boolean;
39
+ sortOrder: number;
40
+ createdAt: Date;
41
+ updatedAt: Date;
42
+ }
43
+ /**
44
+ * Container name: `languageReadPort`. Owner: `languages`.
45
+ *
46
+ * `listActive` is six of the sixteen inbound sites on its own — `catalog`
47
+ * resolving a product's locale chain, `product_feeds` deciding which
48
+ * translations to emit, `pim_ergonode` mapping an import's locales,
49
+ * `dictionaries` rendering its admin screen.
50
+ *
51
+ * When `languages` is off every method fails closed. There is no sensible
52
+ * degrade: a storefront that cannot list its languages would have to invent
53
+ * one, and inventing `'en'` is how a Polish shop renders in English.
54
+ *
55
+ * Whether `languages` has an off state at all is its manifest's `activation` to
56
+ * say, not this line's: a module declaring `nonDeactivatable` never enters one.
57
+ */
58
+ export interface LanguageReadPort {
59
+ list(): Promise<LanguageRecord[]>;
60
+ /** Only `isActive`, ordered by sort order then code. */
61
+ listActive(): Promise<LanguageRecord[]>;
62
+ /** Exactly one language is the default; `null` only before the first seed. */
63
+ getDefault(): Promise<LanguageRecord | null>;
64
+ findByCode(code: string): Promise<LanguageRecord | null>;
65
+ }
66
+ export interface CreateLanguageInput {
67
+ code: string;
68
+ label: string;
69
+ nativeLabel: string;
70
+ isRtl?: boolean;
71
+ fallbackCode?: string | null;
72
+ isActive?: boolean;
73
+ sortOrder?: number;
74
+ }
75
+ export interface UpdateLanguageInput {
76
+ label?: string;
77
+ nativeLabel?: string;
78
+ isRtl?: boolean;
79
+ fallbackCode?: string | null;
80
+ isActive?: boolean;
81
+ sortOrder?: number;
82
+ }
83
+ /**
84
+ * Container name: `languageAdminPort`. Owner: `languages`.
85
+ *
86
+ * `dictionaries` hosts the admin screen for this table — the module that owns
87
+ * the rows does not own the surface — so the write side crosses a boundary as
88
+ * a matter of design rather than of accident.
89
+ *
90
+ * The invariants stay on this side: exactly one default, a default may not be
91
+ * deactivated, and a fallback chain may not cycle. A caller cannot be trusted
92
+ * with them, and two of the three were already enforced here.
93
+ */
94
+ export interface LanguageAdminPort {
95
+ create(input: CreateLanguageInput): Promise<LanguageRecord>;
96
+ update(code: string, input: UpdateLanguageInput): Promise<LanguageRecord>;
97
+ setDefault(code: string): Promise<LanguageRecord>;
98
+ remove(code: string): Promise<void>;
99
+ }
100
+ /**
101
+ * Container name: `languageSeedPort`. Owner: `languages`.
102
+ *
103
+ * The seam `dictionaries`' boot reconciler used to be a raw
104
+ * `update "languages" set "native_label" = …` — this module's table, written by
105
+ * another module (D-87).
106
+ *
107
+ * Narrow on purpose: the only seeding `dictionaries` does against this table is
108
+ * filling the empty `native_label` that migration 038 left behind, and the fill
109
+ * happens **once**. A row whose label an operator has since set is never
110
+ * overwritten, so a re-run is a no-op rather than a revert.
111
+ */
112
+ export interface LanguageSeedPort {
113
+ /**
114
+ * Sets `nativeLabel` on every listed code that still holds the empty string.
115
+ * Returns how many rows it filled.
116
+ */
117
+ backfillNativeLabels(rows: readonly {
118
+ code: string;
119
+ nativeLabel: string;
120
+ }[]): Promise<number>;
121
+ }
122
+ //# sourceMappingURL=languages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../src/languages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAA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C;CACpB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5D,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1E,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAClD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,oBAAoB,CAClB,IAAI,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,GACrD,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * `languages` module contracts — the in-process port surface (feature 075,
3
+ * Phase P).
4
+ *
5
+ * The module's own HTTP shapes are `dictionary.ts`' business: `dictionaries`
6
+ * serves the admin screen over both this table and `currencies`'. What belongs
7
+ * here is what the other four modules ask of it — sixteen import sites, ten of
8
+ * them `dictionaries` reading the `Language` entity directly to resolve a
9
+ * label, validate a code or walk a fallback chain.
10
+ *
11
+ * Plain TypeScript rather than Zod: these describe in-process calls.
12
+ *
13
+ * Nothing here imports from `backend/src/` (FR-034).
14
+ */
15
+ /**
16
+ * The EventBus name `languages` announces on after any write.
17
+ *
18
+ * Published as a **constant, not a port** (FR-013): it is a string, and
19
+ * whoever caches language data subscribes to it. The direction is deliberate
20
+ * and stays — `languages` announces, and it must not know who listens, so
21
+ * there is no manifest dependency in either direction over this name.
22
+ */
23
+ export const LANGUAGE_CHANGED_EVENT = 'languages.changed';
24
+ //# sourceMappingURL=languages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.js","sourceRoot":"","sources":["../src/languages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC"}