@endora-commerce/mod-inventory 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 (223) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +61 -0
  3. package/dist/admin/api/warehouses-client.d.ts +22 -0
  4. package/dist/admin/api/warehouses-client.d.ts.map +1 -0
  5. package/dist/admin/api/warehouses-client.js +32 -0
  6. package/dist/admin/api/warehouses-client.js.map +1 -0
  7. package/dist/admin/index.d.ts +43 -0
  8. package/dist/admin/index.d.ts.map +1 -0
  9. package/dist/admin/index.js +190 -0
  10. package/dist/admin/index.js.map +1 -0
  11. package/dist/admin/pages/AvailabilityNotificationsPage.d.ts +15 -0
  12. package/dist/admin/pages/AvailabilityNotificationsPage.d.ts.map +1 -0
  13. package/dist/admin/pages/AvailabilityNotificationsPage.js +111 -0
  14. package/dist/admin/pages/AvailabilityNotificationsPage.js.map +1 -0
  15. package/dist/admin/pages/InventoryPage.d.ts +17 -0
  16. package/dist/admin/pages/InventoryPage.d.ts.map +1 -0
  17. package/dist/admin/pages/InventoryPage.js +135 -0
  18. package/dist/admin/pages/InventoryPage.js.map +1 -0
  19. package/dist/admin/pages/LowStockPage.d.ts +16 -0
  20. package/dist/admin/pages/LowStockPage.d.ts.map +1 -0
  21. package/dist/admin/pages/LowStockPage.js +61 -0
  22. package/dist/admin/pages/LowStockPage.js.map +1 -0
  23. package/dist/admin/pages/StockImportWizard.d.ts +17 -0
  24. package/dist/admin/pages/StockImportWizard.d.ts.map +1 -0
  25. package/dist/admin/pages/StockImportWizard.js +111 -0
  26. package/dist/admin/pages/StockImportWizard.js.map +1 -0
  27. package/dist/admin/pages/WarehouseEditor.d.ts +12 -0
  28. package/dist/admin/pages/WarehouseEditor.d.ts.map +1 -0
  29. package/dist/admin/pages/WarehouseEditor.js +194 -0
  30. package/dist/admin/pages/WarehouseEditor.js.map +1 -0
  31. package/dist/admin/pages/WarehousesList.d.ts +12 -0
  32. package/dist/admin/pages/WarehousesList.d.ts.map +1 -0
  33. package/dist/admin/pages/WarehousesList.js +69 -0
  34. package/dist/admin/pages/WarehousesList.js.map +1 -0
  35. package/dist/admin/zones/ChannelWarehouses.d.ts +49 -0
  36. package/dist/admin/zones/ChannelWarehouses.d.ts.map +1 -0
  37. package/dist/admin/zones/ChannelWarehouses.js +109 -0
  38. package/dist/admin/zones/ChannelWarehouses.js.map +1 -0
  39. package/dist/backend/demo/reset.d.ts +18 -0
  40. package/dist/backend/demo/reset.d.ts.map +1 -0
  41. package/dist/backend/demo/reset.js +20 -0
  42. package/dist/backend/demo/reset.js.map +1 -0
  43. package/dist/backend/demo/rows.d.ts +38 -0
  44. package/dist/backend/demo/rows.d.ts.map +1 -0
  45. package/dist/backend/demo/rows.js +38 -0
  46. package/dist/backend/demo/rows.js.map +1 -0
  47. package/dist/backend/demo/seed.d.ts +26 -0
  48. package/dist/backend/demo/seed.d.ts.map +1 -0
  49. package/dist/backend/demo/seed.js +65 -0
  50. package/dist/backend/demo/seed.js.map +1 -0
  51. package/dist/backend/email-templates/transactional-defaults.d.ts +11 -0
  52. package/dist/backend/email-templates/transactional-defaults.d.ts.map +1 -0
  53. package/dist/backend/email-templates/transactional-defaults.js +49 -0
  54. package/dist/backend/email-templates/transactional-defaults.js.map +1 -0
  55. package/dist/backend/entities/availability-notification.entity.d.ts +49 -0
  56. package/dist/backend/entities/availability-notification.entity.d.ts.map +1 -0
  57. package/dist/backend/entities/availability-notification.entity.js +93 -0
  58. package/dist/backend/entities/availability-notification.entity.js.map +1 -0
  59. package/dist/backend/entities/inventory-threshold.entity.d.ts +24 -0
  60. package/dist/backend/entities/inventory-threshold.entity.d.ts.map +1 -0
  61. package/dist/backend/entities/inventory-threshold.entity.js +61 -0
  62. package/dist/backend/entities/inventory-threshold.entity.js.map +1 -0
  63. package/dist/backend/entities/product-warehouse-low-stock-threshold.entity.d.ts +15 -0
  64. package/dist/backend/entities/product-warehouse-low-stock-threshold.entity.d.ts.map +1 -0
  65. package/dist/backend/entities/product-warehouse-low-stock-threshold.entity.js +51 -0
  66. package/dist/backend/entities/product-warehouse-low-stock-threshold.entity.js.map +1 -0
  67. package/dist/backend/entities/stock-allocation.entity.d.ts +22 -0
  68. package/dist/backend/entities/stock-allocation.entity.d.ts.map +1 -0
  69. package/dist/backend/entities/stock-allocation.entity.js +69 -0
  70. package/dist/backend/entities/stock-allocation.entity.js.map +1 -0
  71. package/dist/backend/entities/stock-level.entity.d.ts +24 -0
  72. package/dist/backend/entities/stock-level.entity.d.ts.map +1 -0
  73. package/dist/backend/entities/stock-level.entity.js +74 -0
  74. package/dist/backend/entities/stock-level.entity.js.map +1 -0
  75. package/dist/backend/entities/warehouse-channel-assignment.entity.d.ts +17 -0
  76. package/dist/backend/entities/warehouse-channel-assignment.entity.d.ts.map +1 -0
  77. package/dist/backend/entities/warehouse-channel-assignment.entity.js +60 -0
  78. package/dist/backend/entities/warehouse-channel-assignment.entity.js.map +1 -0
  79. package/dist/backend/entities/warehouse.entity.d.ts +37 -0
  80. package/dist/backend/entities/warehouse.entity.d.ts.map +1 -0
  81. package/dist/backend/entities/warehouse.entity.js +90 -0
  82. package/dist/backend/entities/warehouse.entity.js.map +1 -0
  83. package/dist/backend/index.d.ts +139 -0
  84. package/dist/backend/index.d.ts.map +1 -0
  85. package/dist/backend/index.js +351 -0
  86. package/dist/backend/index.js.map +1 -0
  87. package/dist/backend/plugin.d.ts +113 -0
  88. package/dist/backend/plugin.d.ts.map +1 -0
  89. package/dist/backend/plugin.js +75 -0
  90. package/dist/backend/plugin.js.map +1 -0
  91. package/dist/backend/prompt-tools.d.ts +23 -0
  92. package/dist/backend/prompt-tools.d.ts.map +1 -0
  93. package/dist/backend/prompt-tools.js +77 -0
  94. package/dist/backend/prompt-tools.js.map +1 -0
  95. package/dist/backend/routes.admin.d.ts +62 -0
  96. package/dist/backend/routes.admin.d.ts.map +1 -0
  97. package/dist/backend/routes.admin.js +383 -0
  98. package/dist/backend/routes.admin.js.map +1 -0
  99. package/dist/backend/routes.d.ts +40 -0
  100. package/dist/backend/routes.d.ts.map +1 -0
  101. package/dist/backend/routes.js +263 -0
  102. package/dist/backend/routes.js.map +1 -0
  103. package/dist/backend/services/audit-references.d.ts +15 -0
  104. package/dist/backend/services/audit-references.d.ts.map +1 -0
  105. package/dist/backend/services/audit-references.js +27 -0
  106. package/dist/backend/services/audit-references.js.map +1 -0
  107. package/dist/backend/services/availability-notification-service.d.ts +155 -0
  108. package/dist/backend/services/availability-notification-service.d.ts.map +1 -0
  109. package/dist/backend/services/availability-notification-service.js +363 -0
  110. package/dist/backend/services/availability-notification-service.js.map +1 -0
  111. package/dist/backend/services/availability-worker.d.ts +57 -0
  112. package/dist/backend/services/availability-worker.d.ts.map +1 -0
  113. package/dist/backend/services/availability-worker.js +135 -0
  114. package/dist/backend/services/availability-worker.js.map +1 -0
  115. package/dist/backend/services/csv-stock-importer.d.ts +52 -0
  116. package/dist/backend/services/csv-stock-importer.d.ts.map +1 -0
  117. package/dist/backend/services/csv-stock-importer.js +154 -0
  118. package/dist/backend/services/csv-stock-importer.js.map +1 -0
  119. package/dist/backend/services/display-band-resolver.d.ts +19 -0
  120. package/dist/backend/services/display-band-resolver.d.ts.map +1 -0
  121. package/dist/backend/services/display-band-resolver.js +21 -0
  122. package/dist/backend/services/display-band-resolver.js.map +1 -0
  123. package/dist/backend/services/effective-fulfilment-strategy.d.ts +16 -0
  124. package/dist/backend/services/effective-fulfilment-strategy.d.ts.map +1 -0
  125. package/dist/backend/services/effective-fulfilment-strategy.js +16 -0
  126. package/dist/backend/services/effective-fulfilment-strategy.js.map +1 -0
  127. package/dist/backend/services/fulfilment-strategy-resolver.d.ts +13 -0
  128. package/dist/backend/services/fulfilment-strategy-resolver.d.ts.map +1 -0
  129. package/dist/backend/services/fulfilment-strategy-resolver.js +13 -0
  130. package/dist/backend/services/fulfilment-strategy-resolver.js.map +1 -0
  131. package/dist/backend/services/inventory-read-port.d.ts +65 -0
  132. package/dist/backend/services/inventory-read-port.d.ts.map +1 -0
  133. package/dist/backend/services/inventory-read-port.js +168 -0
  134. package/dist/backend/services/inventory-read-port.js.map +1 -0
  135. package/dist/backend/services/inventory-reservation-apply-port.d.ts +62 -0
  136. package/dist/backend/services/inventory-reservation-apply-port.d.ts.map +1 -0
  137. package/dist/backend/services/inventory-reservation-apply-port.js +134 -0
  138. package/dist/backend/services/inventory-reservation-apply-port.js.map +1 -0
  139. package/dist/backend/services/low-stock-alert-service.d.ts +87 -0
  140. package/dist/backend/services/low-stock-alert-service.d.ts.map +1 -0
  141. package/dist/backend/services/low-stock-alert-service.js +164 -0
  142. package/dist/backend/services/low-stock-alert-service.js.map +1 -0
  143. package/dist/backend/services/product-threshold-write.service.d.ts +38 -0
  144. package/dist/backend/services/product-threshold-write.service.d.ts.map +1 -0
  145. package/dist/backend/services/product-threshold-write.service.js +80 -0
  146. package/dist/backend/services/product-threshold-write.service.js.map +1 -0
  147. package/dist/backend/services/stock-import.service.d.ts +43 -0
  148. package/dist/backend/services/stock-import.service.d.ts.map +1 -0
  149. package/dist/backend/services/stock-import.service.js +124 -0
  150. package/dist/backend/services/stock-import.service.js.map +1 -0
  151. package/dist/backend/services/stock-level-service.d.ts +146 -0
  152. package/dist/backend/services/stock-level-service.d.ts.map +1 -0
  153. package/dist/backend/services/stock-level-service.js +489 -0
  154. package/dist/backend/services/stock-level-service.js.map +1 -0
  155. package/dist/backend/services/threshold-admin-service.d.ts +73 -0
  156. package/dist/backend/services/threshold-admin-service.d.ts.map +1 -0
  157. package/dist/backend/services/threshold-admin-service.js +167 -0
  158. package/dist/backend/services/threshold-admin-service.js.map +1 -0
  159. package/dist/backend/services/threshold-resolver.d.ts +23 -0
  160. package/dist/backend/services/threshold-resolver.d.ts.map +1 -0
  161. package/dist/backend/services/threshold-resolver.js +29 -0
  162. package/dist/backend/services/threshold-resolver.js.map +1 -0
  163. package/dist/backend/services/threshold-settings-mirror.d.ts +55 -0
  164. package/dist/backend/services/threshold-settings-mirror.d.ts.map +1 -0
  165. package/dist/backend/services/threshold-settings-mirror.js +84 -0
  166. package/dist/backend/services/threshold-settings-mirror.js.map +1 -0
  167. package/dist/backend/services/warehouse-channel-reconciler.d.ts +19 -0
  168. package/dist/backend/services/warehouse-channel-reconciler.d.ts.map +1 -0
  169. package/dist/backend/services/warehouse-channel-reconciler.js +65 -0
  170. package/dist/backend/services/warehouse-channel-reconciler.js.map +1 -0
  171. package/dist/backend/services/warehouse-channel-service.d.ts +57 -0
  172. package/dist/backend/services/warehouse-channel-service.d.ts.map +1 -0
  173. package/dist/backend/services/warehouse-channel-service.js +205 -0
  174. package/dist/backend/services/warehouse-channel-service.js.map +1 -0
  175. package/dist/backend/services/warehouse-country-reference.d.ts +14 -0
  176. package/dist/backend/services/warehouse-country-reference.d.ts.map +1 -0
  177. package/dist/backend/services/warehouse-country-reference.js +27 -0
  178. package/dist/backend/services/warehouse-country-reference.js.map +1 -0
  179. package/dist/backend/services/warehouse-service.d.ts +86 -0
  180. package/dist/backend/services/warehouse-service.d.ts.map +1 -0
  181. package/dist/backend/services/warehouse-service.js +267 -0
  182. package/dist/backend/services/warehouse-service.js.map +1 -0
  183. package/dist/manifest.d.ts +219 -0
  184. package/dist/manifest.d.ts.map +1 -0
  185. package/dist/manifest.js +377 -0
  186. package/dist/manifest.js.map +1 -0
  187. package/dist/migrations/20260503T182812_inventory_workflow.d.ts +39 -0
  188. package/dist/migrations/20260503T182812_inventory_workflow.d.ts.map +1 -0
  189. package/dist/migrations/20260503T182812_inventory_workflow.js +205 -0
  190. package/dist/migrations/20260503T182812_inventory_workflow.js.map +1 -0
  191. package/dist/migrations/20260611T140347_inventory_warehouse_default_low_stock_threshold.d.ts +14 -0
  192. package/dist/migrations/20260611T140347_inventory_warehouse_default_low_stock_threshold.d.ts.map +1 -0
  193. package/dist/migrations/20260611T140347_inventory_warehouse_default_low_stock_threshold.js +18 -0
  194. package/dist/migrations/20260611T140347_inventory_warehouse_default_low_stock_threshold.js.map +1 -0
  195. package/dist/migrations/20260611T140348_inventory_per_warehouse_low_stock_thresholds.d.ts +28 -0
  196. package/dist/migrations/20260611T140348_inventory_per_warehouse_low_stock_thresholds.d.ts.map +1 -0
  197. package/dist/migrations/20260611T140348_inventory_per_warehouse_low_stock_thresholds.js +48 -0
  198. package/dist/migrations/20260611T140348_inventory_per_warehouse_low_stock_thresholds.js.map +1 -0
  199. package/dist/migrations/20260818T081243_inventory_stock_allocation_order_item_fk.d.ts +44 -0
  200. package/dist/migrations/20260818T081243_inventory_stock_allocation_order_item_fk.d.ts.map +1 -0
  201. package/dist/migrations/20260818T081243_inventory_stock_allocation_order_item_fk.js +81 -0
  202. package/dist/migrations/20260818T081243_inventory_stock_allocation_order_item_fk.js.map +1 -0
  203. package/dist/migrations/20260830T182139_inventory_organization_attribution.d.ts +109 -0
  204. package/dist/migrations/20260830T182139_inventory_organization_attribution.d.ts.map +1 -0
  205. package/dist/migrations/20260830T182139_inventory_organization_attribution.js +178 -0
  206. package/dist/migrations/20260830T182139_inventory_organization_attribution.js.map +1 -0
  207. package/dist/migrations/20260912T125716_inventory_organization_warehouses.d.ts +34 -0
  208. package/dist/migrations/20260912T125716_inventory_organization_warehouses.d.ts.map +1 -0
  209. package/dist/migrations/20260912T125716_inventory_organization_warehouses.js +50 -0
  210. package/dist/migrations/20260912T125716_inventory_organization_warehouses.js.map +1 -0
  211. package/dist/migrations/index.d.ts +32 -0
  212. package/dist/migrations/index.d.ts.map +1 -0
  213. package/dist/migrations/index.js +39 -0
  214. package/dist/migrations/index.js.map +1 -0
  215. package/dist/ports/index.d.ts +183 -0
  216. package/dist/ports/index.d.ts.map +1 -0
  217. package/dist/ports/index.js +2 -0
  218. package/dist/ports/index.js.map +1 -0
  219. package/docs/inventory.md +177 -0
  220. package/i18n/en.json +32 -0
  221. package/i18n/pl.json +32 -0
  222. package/package.json +105 -0
  223. package/tailwind.css +14 -0
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The warehouse this module's demo data creates (feature 113, T223).
3
+ *
4
+ * One place holding the data, imported by both bodies: `seed.ts` creates the
5
+ * warehouse and its channel assignments and `reset.ts` withdraws exactly them,
6
+ * by the fixed id `seed` assigns (contract §2.5).
7
+ *
8
+ * **The id is fixed rather than minted**, and it always has been: the demo's
9
+ * second warehouse is referenced by code from the instance composition's stock
10
+ * spread, and a re-seed that minted a new id would leave the previous one
11
+ * behind with stock on it.
12
+ *
13
+ * ## §2.6, and why this row has no per-language map
14
+ *
15
+ * `Warehouse.name` and `Warehouse.description` are scalar columns — a
16
+ * `varchar(160)` and a `text` — so the per-language shape §2.6 asks for has
17
+ * nowhere to go, and putting it there would be a migration this feature does
18
+ * not take (contract §8). What that leaves is a choice about the value itself,
19
+ * and it is decided the way the rest of the platform decides it: a warehouse
20
+ * name is **operator content**, the sort of string a shop writes for itself, and
21
+ * the default language for anything a developer writes is English (the owner's
22
+ * ruling of 2026-09-01). The demo used to write `Magazyn Kraków`, which is a
23
+ * Polish sentence in a module's own sources with no per-language structure
24
+ * around it — `check:default-language-prose`'s subject exactly, invisible only
25
+ * because `backend/src/seeds/` is in no module walk root. So the label is
26
+ * English and the place name stays a place name.
27
+ */
28
+ /** The demo's second warehouse, in `Warehouse`'s own field names. */
29
+ export const DEMO_WAREHOUSE = {
30
+ id: '00000000-0000-4000-8000-00000000d0c0',
31
+ code: 'pl-krk',
32
+ name: 'Krakow warehouse',
33
+ active: true,
34
+ description: 'Demo secondary warehouse — Krakow, PL',
35
+ };
36
+ /** Where the demo's assignments sort, behind the system warehouse's default. */
37
+ export const DEMO_ASSIGNMENT_SORT_ORDER = 1;
38
+ //# sourceMappingURL=rows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rows.js","sourceRoot":"","sources":["../../../src/backend/demo/rows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,qEAAqE;AACrE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,EAAE,EAAE,sCAAsC;IAC1C,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,kBAAkB;IACxB,MAAM,EAAE,IAAI;IACZ,WAAW,EAAE,uCAAuC;CAC5C,CAAC;AAEX,gFAAgF;AAChF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `inventory`'s demo data (feature 113, T223 — contract §2).
3
+ *
4
+ * A second warehouse and its assignment to every sales channel, so the
5
+ * inventory landing, the per-product roster and the channel-binding panels have
6
+ * something to render. It writes `warehouses` and
7
+ * `warehouse_channel_assignments`, both this module's own (§2.1).
8
+ *
9
+ * **The sales channels it reads are the kernel's, not another module's** (§2.2).
10
+ * `sales_channels` moved to the kernel with the resolution machinery in feature
11
+ * 072, and a module relating into the kernel by ORM is the sanctioned access
12
+ * (D-87) — `WarehouseChannelReconciler`, three files away, reads it the same way
13
+ * and says so in its own comment.
14
+ *
15
+ * **The stock spread is not here.** Quantities per product across two
16
+ * warehouses are `catalog`'s rows and this module's rows in one statement, so
17
+ * they are a composition step (§5.1) and live in the instance composition. This
18
+ * body creates the warehouse that step spreads *into*, which is why the step is
19
+ * written to degrade to a single-warehouse spread when it is absent.
20
+ *
21
+ * Idempotent by an existence probe on the fixed id (§2.4).
22
+ */
23
+ import type { DemoSeedResult, ModuleDemoContext } from '@endora-commerce/contracts';
24
+ import type { ModuleContext } from '@endora-commerce/platform/kernel';
25
+ export declare function seedDemo(context: ModuleDemoContext<ModuleContext>): Promise<DemoSeedResult>;
26
+ //# sourceMappingURL=seed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../../../src/backend/demo/seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAYtE,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,GACxC,OAAO,CAAC,cAAc,CAAC,CAgEzB"}
@@ -0,0 +1,65 @@
1
+ import { SalesChannel } from '@endora-commerce/platform/kernel';
2
+ import { Warehouse } from '../entities/warehouse.entity.js';
3
+ import { WarehouseChannelAssignment } from '../entities/warehouse-channel-assignment.entity.js';
4
+ import { WarehouseChannelReconciler } from '../services/warehouse-channel-reconciler.js';
5
+ import { DEMO_ASSIGNMENT_SORT_ORDER, DEMO_WAREHOUSE } from './rows.js';
6
+ export async function seedDemo(context) {
7
+ // command-coverage-ignore: demo data, reached only by `endora demo seed`,
8
+ // whose entry point calls `mustBeNonProduction()` as its first statement and
9
+ // outside every `try` (contract §2.7, §3.3). The guard is the enforcement:
10
+ // this write has no operator, no tenant and no audit reader.
11
+ const em = context.ctx.cradle().emFactory();
12
+ let warehouse = await em.findOne(Warehouse, { id: DEMO_WAREHOUSE.id });
13
+ if (!warehouse) {
14
+ warehouse = em.create(Warehouse, {
15
+ id: DEMO_WAREHOUSE.id,
16
+ name: DEMO_WAREHOUSE.name,
17
+ code: DEMO_WAREHOUSE.code,
18
+ active: DEMO_WAREHOUSE.active,
19
+ description: DEMO_WAREHOUSE.description,
20
+ });
21
+ em.persist(warehouse);
22
+ await em.flush();
23
+ }
24
+ // The demo seed runs before the process that will serve requests boots, so
25
+ // the boot-time reconciler has not yet paired the channels the demo created
26
+ // with the system warehouse. Running it inline leaves the database fully
27
+ // wired without a server bounce — this is the module's own reconciler over
28
+ // its own tables, and it is idempotent by construction.
29
+ const reconciled = await new WarehouseChannelReconciler(em.fork()).run();
30
+ const channels = await em.find(SalesChannel, {});
31
+ let assignments = 0;
32
+ for (const channel of channels) {
33
+ const existing = await em.findOne(WarehouseChannelAssignment, {
34
+ warehouseId: DEMO_WAREHOUSE.id,
35
+ salesChannelId: channel.id,
36
+ });
37
+ if (existing) {
38
+ assignments += 1;
39
+ continue;
40
+ }
41
+ em.persist(em.create(WarehouseChannelAssignment, {
42
+ warehouseId: DEMO_WAREHOUSE.id,
43
+ salesChannelId: channel.id,
44
+ isDefault: false,
45
+ sortOrder: DEMO_ASSIGNMENT_SORT_ORDER,
46
+ }));
47
+ assignments += 1;
48
+ }
49
+ await em.flush();
50
+ return {
51
+ created: [
52
+ { entity: 'Warehouse', count: 1 },
53
+ { entity: 'WarehouseChannelAssignment', count: assignments },
54
+ ],
55
+ ...(reconciled.assignmentsCreated === 0
56
+ ? {}
57
+ : {
58
+ notes: [
59
+ `paired ${reconciled.assignmentsCreated} sales channel(s) with the system ` +
60
+ 'warehouse, which the boot reconciler had not seen yet',
61
+ ],
62
+ }),
63
+ };
64
+ }
65
+ //# sourceMappingURL=seed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed.js","sourceRoot":"","sources":["../../../src/backend/demo/seed.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oDAAoD,CAAC;AAChG,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAMvE,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,OAAyC;IAEzC,0EAA0E;IAC1E,6EAA6E;IAC7E,2EAA2E;IAC3E,6DAA6D;IAC7D,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAuB,CAAC,SAAS,EAAE,CAAC;IAEjE,IAAI,SAAS,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,EAAE,CAAC,CAAC;IACvE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,SAAS,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE;YAC/B,EAAE,EAAE,cAAc,CAAC,EAAE;YACrB,IAAI,EAAE,cAAc,CAAC,IAAI;YACzB,IAAI,EAAE,cAAc,CAAC,IAAI;YACzB,MAAM,EAAE,cAAc,CAAC,MAAM;YAC7B,WAAW,EAAE,cAAc,CAAC,WAAW;SACxC,CAAC,CAAC;QACH,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACtB,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;IAED,2EAA2E;IAC3E,4EAA4E;IAC5E,yEAAyE;IACzE,2EAA2E;IAC3E,wDAAwD;IACxD,MAAM,UAAU,GAAG,MAAM,IAAI,0BAA0B,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;IAEzE,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IACjD,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,0BAA0B,EAAE;YAC5D,WAAW,EAAE,cAAc,CAAC,EAAE;YAC9B,cAAc,EAAE,OAAO,CAAC,EAAE;SAC3B,CAAC,CAAC;QACH,IAAI,QAAQ,EAAE,CAAC;YACb,WAAW,IAAI,CAAC,CAAC;YACjB,SAAS;QACX,CAAC;QACD,EAAE,CAAC,OAAO,CACR,EAAE,CAAC,MAAM,CAAC,0BAA0B,EAAE;YACpC,WAAW,EAAE,cAAc,CAAC,EAAE;YAC9B,cAAc,EAAE,OAAO,CAAC,EAAE;YAC1B,SAAS,EAAE,KAAK;YAChB,SAAS,EAAE,0BAA0B;SACtC,CAAC,CACH,CAAC;QACF,WAAW,IAAI,CAAC,CAAC;IACnB,CAAC;IACD,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;IAEjB,OAAO;QACL,OAAO,EAAE;YACP,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE;YACjC,EAAE,MAAM,EAAE,4BAA4B,EAAE,KAAK,EAAE,WAAW,EAAE;SAC7D;QACD,GAAG,CAAC,UAAU,CAAC,kBAAkB,KAAK,CAAC;YACrC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,KAAK,EAAE;oBACL,UAAU,UAAU,CAAC,kBAAkB,oCAAoC;wBACzE,uDAAuD;iBAC1D;aACF,CAAC;KACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const LOW_STOCK_ALERT_DEFAULT: {
2
+ defaultSubject: Record<string, string>;
3
+ defaultContent: Record<string, unknown>;
4
+ languages: string[];
5
+ };
6
+ export declare const AVAILABILITY_BACK_IN_STOCK_DEFAULT: {
7
+ defaultSubject: Record<string, string>;
8
+ defaultContent: Record<string, unknown>;
9
+ languages: string[];
10
+ };
11
+ //# sourceMappingURL=transactional-defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactional-defaults.d.ts","sourceRoot":"","sources":["../../../src/backend/email-templates/transactional-defaults.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,uBAAuB;oBAI7B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;oBAetB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;CAE7B,CAAC;AAEF,eAAO,MAAM,kCAAkC;oBAIxC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;oBAetB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;CAE7B,CAAC"}
@@ -0,0 +1,49 @@
1
+ // Default subject + content for inventory transactional emails (feature 047):
2
+ // low_stock_alert (ops) + availability_back_in_stock (customer).
3
+ import { simpleEmailBodyTree } from '@endora-commerce/email-components/defaults/simple-email-body';
4
+ const LANGS = ['en-US', 'pl-PL'];
5
+ export const LOW_STOCK_ALERT_DEFAULT = {
6
+ defaultSubject: {
7
+ 'en-US': 'Low stock: {{var product.name}}',
8
+ 'pl-PL': 'Niski stan magazynowy: {{var product.name}}',
9
+ },
10
+ defaultContent: {
11
+ schema_version: 1,
12
+ languages: {
13
+ 'en-US': simpleEmailBodyTree({
14
+ idPrefix: 'low-stock',
15
+ heading: 'Low stock alert',
16
+ text: 'Cumulative on-hand for "{{var product.name}}" (SKU {{var product.sku}}) has crossed the low-stock threshold.\n\n Current cumulative on-hand: {{var cumulativeOnHand}}\n Threshold: {{var threshold}}',
17
+ }),
18
+ 'pl-PL': simpleEmailBodyTree({
19
+ idPrefix: 'low-stock',
20
+ heading: 'Alert niskiego stanu',
21
+ text: 'Łączny stan magazynowy dla "{{var product.name}}" (SKU {{var product.sku}}) spadł poniżej progu niskiego stanu.\n\n Bieżący łączny stan: {{var cumulativeOnHand}}\n Próg: {{var threshold}}',
22
+ }),
23
+ },
24
+ },
25
+ languages: LANGS,
26
+ };
27
+ export const AVAILABILITY_BACK_IN_STOCK_DEFAULT = {
28
+ defaultSubject: {
29
+ 'en-US': 'Back in stock: {{var product.name}}',
30
+ 'pl-PL': 'Ponownie dostępny: {{var product.name}}',
31
+ },
32
+ defaultContent: {
33
+ schema_version: 1,
34
+ languages: {
35
+ 'en-US': simpleEmailBodyTree({
36
+ idPrefix: 'back-in-stock',
37
+ heading: 'Back in stock',
38
+ text: 'Good news — "{{var product.name}}" is available again.',
39
+ }),
40
+ 'pl-PL': simpleEmailBodyTree({
41
+ idPrefix: 'back-in-stock',
42
+ heading: 'Ponownie dostępny',
43
+ text: 'Dobra wiadomość — "{{var product.name}}" jest ponownie dostępny.',
44
+ }),
45
+ },
46
+ },
47
+ languages: LANGS,
48
+ };
49
+ //# sourceMappingURL=transactional-defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactional-defaults.js","sourceRoot":"","sources":["../../../src/backend/email-templates/transactional-defaults.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,iEAAiE;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8DAA8D,CAAC;AAEnG,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,cAAc,EAAE;QACd,OAAO,EAAE,iCAAiC;QAC1C,OAAO,EAAE,6CAA6C;KAC7B;IAC3B,cAAc,EAAE;QACd,cAAc,EAAE,CAAC;QACjB,SAAS,EAAE;YACT,OAAO,EAAE,mBAAmB,CAAC;gBAC3B,QAAQ,EAAE,WAAW;gBACrB,OAAO,EAAE,iBAAiB;gBAC1B,IAAI,EAAE,wMAAwM;aAC/M,CAAC;YACF,OAAO,EAAE,mBAAmB,CAAC;gBAC3B,QAAQ,EAAE,WAAW;gBACrB,OAAO,EAAE,sBAAsB;gBAC/B,IAAI,EAAE,+LAA+L;aACtM,CAAC;SACH;KACyB;IAC5B,SAAS,EAAE,KAAK;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,cAAc,EAAE;QACd,OAAO,EAAE,qCAAqC;QAC9C,OAAO,EAAE,yCAAyC;KACzB;IAC3B,cAAc,EAAE;QACd,cAAc,EAAE,CAAC;QACjB,SAAS,EAAE;YACT,OAAO,EAAE,mBAAmB,CAAC;gBAC3B,QAAQ,EAAE,eAAe;gBACzB,OAAO,EAAE,eAAe;gBACxB,IAAI,EAAE,wDAAwD;aAC/D,CAAC;YACF,OAAO,EAAE,mBAAmB,CAAC;gBAC3B,QAAQ,EAAE,eAAe;gBACzB,OAAO,EAAE,mBAAmB;gBAC5B,IAAI,EAAE,kEAAkE;aACzE,CAAC;SACH;KACyB;IAC5B,SAAS,EAAE,KAAK;CACjB,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { OptionalProps } from '@mikro-orm/core';
2
+ /**
3
+ * Availability "notify me when in stock" subscription (feature 010).
4
+ *
5
+ * Foundation 001 created this entity with `customerAccountId NOT NULL`;
6
+ * feature 010 relaxes that to nullable + adds `email` + `status`
7
+ * columns so anonymous customers can subscribe through the storefront
8
+ * `Powiadom o dostępności` dialog. The DB-level CHECK constraint
9
+ * (`an_recipient_check`) guarantees at least one of the two recipient
10
+ * columns is populated.
11
+ */
12
+ export type AvailabilityNotificationStatus = 'queued' | 'notified' | 'cancelled';
13
+ export declare class AvailabilityNotification {
14
+ [OptionalProps]?: 'id' | 'requestedAt' | 'notifiedAt' | 'variantId' | 'customerAccountId' | 'organizationId' | 'email' | 'status';
15
+ id: string;
16
+ customerAccountId?: string | null;
17
+ /**
18
+ * The organisation that owns this subscription — feature 087 Group B, ruling
19
+ * D-187.
20
+ *
21
+ * Derived from {@link customerAccountId}'s account and stamped at the write,
22
+ * never resolved on read: `customerOrganizationColumn` asks the ORM's own
23
+ * metadata whether this property exists, so its presence is what makes
24
+ * `customerFilterCond`'s `allowed-set` arm **grant** on this table rather
25
+ * than refuse it whole. A sales representative assigned to the buyer's
26
+ * organisation sees this subscription because this column is here.
27
+ *
28
+ * Nullable, and the constraint is an implication rather than an equivalence:
29
+ * `availability_notifications_organization_attribution_chk` requires an
30
+ * organisation of a row that names an account, and says nothing about a row
31
+ * that names none. An **anonymous** subscription is a representable state
32
+ * (FR-011) — `an_recipient_check` admits a row whose only recipient is an
33
+ * e-mail address, which is the storefront's "notify me" dialog with nobody
34
+ * signed in — and who such a row belongs to is R-6's open question, which a
35
+ * constraint must not answer.
36
+ *
37
+ * There is no association path to keep in step: nothing in this module ever
38
+ * assigns {@link customerAccountId} on an existing row, so unlike
39
+ * `comparisons` and `pwa` this column moves exactly once, at the insert.
40
+ */
41
+ organizationId?: string | null;
42
+ productId: string;
43
+ variantId?: string | null;
44
+ email?: string | null;
45
+ status: AvailabilityNotificationStatus;
46
+ requestedAt: Date;
47
+ notifiedAt?: Date | null;
48
+ }
49
+ //# sourceMappingURL=availability-notification.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"availability-notification.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/availability-notification.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAwB,MAAM,iBAAiB,CAAC;AAIrF;;;;;;;;;GASG;AACH,MAAM,MAAM,8BAA8B,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AAEjF,qBAEa,wBAAwB;IACnC,CAAC,aAAa,CAAC,CAAC,EACZ,IAAI,GACJ,aAAa,GACb,YAAY,GACZ,WAAW,GACX,mBAAmB,GACnB,gBAAgB,GAChB,OAAO,GACP,QAAQ,CAAC;IAGb,EAAE,EAAE,MAAM,CAAgB;IAI1B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAElC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IAGH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAI/B,SAAS,EAAG,MAAM,CAAC;IAGnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtB,MAAM,EAAE,8BAA8B,CAAY;IAGlD,WAAW,EAAE,IAAI,CAAc;IAG/B,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC1B"}
@@ -0,0 +1,93 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Entity, Index, OptionalProps, PrimaryKey, Property } from '@mikro-orm/core';
11
+ import { CustomerScoped } from '@endora-commerce/platform/tenancy';
12
+ import { randomUUID } from 'crypto';
13
+ let AvailabilityNotification = class AvailabilityNotification {
14
+ [OptionalProps];
15
+ id = randomUUID();
16
+ customerAccountId;
17
+ /**
18
+ * The organisation that owns this subscription — feature 087 Group B, ruling
19
+ * D-187.
20
+ *
21
+ * Derived from {@link customerAccountId}'s account and stamped at the write,
22
+ * never resolved on read: `customerOrganizationColumn` asks the ORM's own
23
+ * metadata whether this property exists, so its presence is what makes
24
+ * `customerFilterCond`'s `allowed-set` arm **grant** on this table rather
25
+ * than refuse it whole. A sales representative assigned to the buyer's
26
+ * organisation sees this subscription because this column is here.
27
+ *
28
+ * Nullable, and the constraint is an implication rather than an equivalence:
29
+ * `availability_notifications_organization_attribution_chk` requires an
30
+ * organisation of a row that names an account, and says nothing about a row
31
+ * that names none. An **anonymous** subscription is a representable state
32
+ * (FR-011) — `an_recipient_check` admits a row whose only recipient is an
33
+ * e-mail address, which is the storefront's "notify me" dialog with nobody
34
+ * signed in — and who such a row belongs to is R-6's open question, which a
35
+ * constraint must not answer.
36
+ *
37
+ * There is no association path to keep in step: nothing in this module ever
38
+ * assigns {@link customerAccountId} on an existing row, so unlike
39
+ * `comparisons` and `pwa` this column moves exactly once, at the insert.
40
+ */
41
+ organizationId;
42
+ productId;
43
+ variantId;
44
+ email;
45
+ status = 'queued';
46
+ requestedAt = new Date();
47
+ notifiedAt;
48
+ };
49
+ __decorate([
50
+ PrimaryKey({ type: 'uuid' }),
51
+ __metadata("design:type", String)
52
+ ], AvailabilityNotification.prototype, "id", void 0);
53
+ __decorate([
54
+ Property({ type: 'uuid', nullable: true }),
55
+ Index(),
56
+ __metadata("design:type", Object)
57
+ ], AvailabilityNotification.prototype, "customerAccountId", void 0);
58
+ __decorate([
59
+ Property({ type: 'uuid', nullable: true }),
60
+ Index(),
61
+ __metadata("design:type", Object)
62
+ ], AvailabilityNotification.prototype, "organizationId", void 0);
63
+ __decorate([
64
+ Property({ type: 'uuid' }),
65
+ Index(),
66
+ __metadata("design:type", String)
67
+ ], AvailabilityNotification.prototype, "productId", void 0);
68
+ __decorate([
69
+ Property({ type: 'uuid', nullable: true }),
70
+ __metadata("design:type", Object)
71
+ ], AvailabilityNotification.prototype, "variantId", void 0);
72
+ __decorate([
73
+ Property({ type: 'string', length: 320, nullable: true }),
74
+ __metadata("design:type", Object)
75
+ ], AvailabilityNotification.prototype, "email", void 0);
76
+ __decorate([
77
+ Property({ type: 'string', length: 16 }),
78
+ __metadata("design:type", String)
79
+ ], AvailabilityNotification.prototype, "status", void 0);
80
+ __decorate([
81
+ Property({ type: 'datetime', onCreate: () => new Date() }),
82
+ __metadata("design:type", Date)
83
+ ], AvailabilityNotification.prototype, "requestedAt", void 0);
84
+ __decorate([
85
+ Property({ type: 'datetime', nullable: true }),
86
+ __metadata("design:type", Object)
87
+ ], AvailabilityNotification.prototype, "notifiedAt", void 0);
88
+ AvailabilityNotification = __decorate([
89
+ CustomerScoped(),
90
+ Entity({ tableName: 'availability_notifications' })
91
+ ], AvailabilityNotification);
92
+ export { AvailabilityNotification };
93
+ //# sourceMappingURL=availability-notification.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"availability-notification.entity.js","sourceRoot":"","sources":["../../../src/backend/entities/availability-notification.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAgB7B,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACnC,CAAC,aAAa,CAAC,CAQF;IAGb,EAAE,GAAW,UAAU,EAAE,CAAC;IAI1B,iBAAiB,CAAiB;IAElC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IAGH,cAAc,CAAiB;IAI/B,SAAS,CAAU;IAGnB,SAAS,CAAiB;IAG1B,KAAK,CAAiB;IAGtB,MAAM,GAAmC,QAAQ,CAAC;IAGlD,WAAW,GAAS,IAAI,IAAI,EAAE,CAAC;IAG/B,UAAU,CAAe;CAC1B,CAAA;AApDC;IADC,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACH;AAI1B;IAFC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1C,KAAK,EAAE;;mEAC0B;AA4BlC;IAFC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1C,KAAK,EAAE;;gEACuB;AAI/B;IAFC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE;;2DACW;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2DACjB;AAG1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACpC;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;wDACS;AAGlD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BAC9C,IAAI;6DAAc;AAG/B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4DACtB;AA/Dd,wBAAwB;IAFpC,cAAc,EAAE;IAChB,MAAM,CAAC,EAAE,SAAS,EAAE,4BAA4B,EAAE,CAAC;GACvC,wBAAwB,CAgEpC"}
@@ -0,0 +1,24 @@
1
+ import { OptionalProps } from '@mikro-orm/core';
2
+ /**
3
+ * InventoryThreshold — display-band thresholds (high / medium / low)
4
+ * scoped at one of three levels: global (one row), category (one row
5
+ * per category), product (one row per product).
6
+ *
7
+ * Category and product thresholds also live directly on the respective
8
+ * entities for read-path performance; this table holds the global
9
+ * row as the canonical source and is mirrored from the settings
10
+ * module via `threshold-settings-mirror.ts`.
11
+ */
12
+ export type InventoryThresholdScopeKind = 'global' | 'category' | 'product';
13
+ export declare class InventoryThreshold {
14
+ [OptionalProps]?: 'id' | 'createdAt' | 'updatedAt' | 'scopeId' | 'thresholdHigh' | 'thresholdMedium' | 'thresholdLow';
15
+ id: string;
16
+ scopeKind: InventoryThresholdScopeKind;
17
+ scopeId?: string | null;
18
+ thresholdHigh?: number | null;
19
+ thresholdMedium?: number | null;
20
+ thresholdLow?: number | null;
21
+ createdAt: Date;
22
+ updatedAt: Date;
23
+ }
24
+ //# sourceMappingURL=inventory-threshold.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inventory-threshold.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/inventory-threshold.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,aAAa,EAAwB,MAAM,iBAAiB,CAAC;AAI9E;;;;;;;;;GASG;AACH,MAAM,MAAM,2BAA2B,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAE5E,qBAEa,kBAAkB;IAC7B,CAAC,aAAa,CAAC,CAAC,EACZ,IAAI,GACJ,WAAW,GACX,WAAW,GACX,SAAS,GACT,eAAe,GACf,iBAAiB,GACjB,cAAc,CAAC;IAGnB,EAAE,EAAE,MAAM,CAAgB;IAG1B,SAAS,EAAG,2BAA2B,CAAC;IAGxC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGxB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGhC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG7B,SAAS,EAAE,IAAI,CAAc;IAG7B,SAAS,EAAE,IAAI,CAAc;CAC9B"}
@@ -0,0 +1,61 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Entity, OptionalProps, PrimaryKey, Property } from '@mikro-orm/core';
11
+ import { GlobalEntity } from '@endora-commerce/platform/tenancy';
12
+ import { randomUUID } from 'crypto';
13
+ let InventoryThreshold = class InventoryThreshold {
14
+ [OptionalProps];
15
+ id = randomUUID();
16
+ scopeKind;
17
+ scopeId;
18
+ thresholdHigh;
19
+ thresholdMedium;
20
+ thresholdLow;
21
+ createdAt = new Date();
22
+ updatedAt = new Date();
23
+ };
24
+ __decorate([
25
+ PrimaryKey({ type: 'uuid' }),
26
+ __metadata("design:type", String)
27
+ ], InventoryThreshold.prototype, "id", void 0);
28
+ __decorate([
29
+ Property({ type: 'string', length: 16 }),
30
+ __metadata("design:type", String)
31
+ ], InventoryThreshold.prototype, "scopeKind", void 0);
32
+ __decorate([
33
+ Property({ type: 'uuid', nullable: true }),
34
+ __metadata("design:type", Object)
35
+ ], InventoryThreshold.prototype, "scopeId", void 0);
36
+ __decorate([
37
+ Property({ type: 'integer', nullable: true }),
38
+ __metadata("design:type", Object)
39
+ ], InventoryThreshold.prototype, "thresholdHigh", void 0);
40
+ __decorate([
41
+ Property({ type: 'integer', nullable: true }),
42
+ __metadata("design:type", Object)
43
+ ], InventoryThreshold.prototype, "thresholdMedium", void 0);
44
+ __decorate([
45
+ Property({ type: 'integer', nullable: true }),
46
+ __metadata("design:type", Object)
47
+ ], InventoryThreshold.prototype, "thresholdLow", void 0);
48
+ __decorate([
49
+ Property({ type: 'datetime', onCreate: () => new Date() }),
50
+ __metadata("design:type", Date)
51
+ ], InventoryThreshold.prototype, "createdAt", void 0);
52
+ __decorate([
53
+ Property({ type: 'datetime', onUpdate: () => new Date() }),
54
+ __metadata("design:type", Date)
55
+ ], InventoryThreshold.prototype, "updatedAt", void 0);
56
+ InventoryThreshold = __decorate([
57
+ GlobalEntity(),
58
+ Entity({ tableName: 'inventory_thresholds' })
59
+ ], InventoryThreshold);
60
+ export { InventoryThreshold };
61
+ //# sourceMappingURL=inventory-threshold.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inventory-threshold.entity.js","sourceRoot":"","sources":["../../../src/backend/entities/inventory-threshold.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAgB7B,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,CAAC,aAAa,CAAC,CAOI;IAGnB,EAAE,GAAW,UAAU,EAAE,CAAC;IAG1B,SAAS,CAA+B;IAGxC,OAAO,CAAiB;IAGxB,aAAa,CAAiB;IAG9B,eAAe,CAAiB;IAGhC,YAAY,CAAiB;IAG7B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAG7B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;CAC9B,CAAA;AAtBC;IADC,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CACH;AAG1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;qDACD;AAGxC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACnB;AAGxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yDAChB;AAG9B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2DACd;AAGhC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wDACjB;AAG7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BAChD,IAAI;qDAAc;AAG7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BAChD,IAAI;qDAAc;AAhClB,kBAAkB;IAF9B,YAAY,EAAE;IACd,MAAM,CAAC,EAAE,SAAS,EAAE,sBAAsB,EAAE,CAAC;GACjC,kBAAkB,CAiC9B"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Per-(product, warehouse) low-stock threshold. Consulted only when the
3
+ * referenced Product is in `low_stock_threshold_mode = 'per_warehouse'`.
4
+ *
5
+ * Composite primary key `(product_id, warehouse_id)` ensures one row per
6
+ * pair. Both FKs cascade-delete with their parent.
7
+ */
8
+ export declare class ProductWarehouseLowStockThreshold {
9
+ productId: string;
10
+ warehouseId: string;
11
+ threshold: number;
12
+ createdAt: Date;
13
+ updatedAt: Date;
14
+ }
15
+ //# sourceMappingURL=product-warehouse-low-stock-threshold.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-warehouse-low-stock-threshold.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/product-warehouse-low-stock-threshold.entity.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,qBAEa,iCAAiC;IAE5C,SAAS,EAAG,MAAM,CAAC;IAGnB,WAAW,EAAG,MAAM,CAAC;IAGrB,SAAS,EAAG,MAAM,CAAC;IAGnB,SAAS,EAAE,IAAI,CAAc;IAG7B,SAAS,EAAE,IAAI,CAAc;CAC9B"}
@@ -0,0 +1,51 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Entity, PrimaryKey, Property } from '@mikro-orm/core';
11
+ import { GlobalEntity } from '@endora-commerce/platform/tenancy';
12
+ /**
13
+ * Per-(product, warehouse) low-stock threshold. Consulted only when the
14
+ * referenced Product is in `low_stock_threshold_mode = 'per_warehouse'`.
15
+ *
16
+ * Composite primary key `(product_id, warehouse_id)` ensures one row per
17
+ * pair. Both FKs cascade-delete with their parent.
18
+ */
19
+ let ProductWarehouseLowStockThreshold = class ProductWarehouseLowStockThreshold {
20
+ productId;
21
+ warehouseId;
22
+ threshold;
23
+ createdAt = new Date();
24
+ updatedAt = new Date();
25
+ };
26
+ __decorate([
27
+ PrimaryKey({ type: 'uuid' }),
28
+ __metadata("design:type", String)
29
+ ], ProductWarehouseLowStockThreshold.prototype, "productId", void 0);
30
+ __decorate([
31
+ PrimaryKey({ type: 'uuid' }),
32
+ __metadata("design:type", String)
33
+ ], ProductWarehouseLowStockThreshold.prototype, "warehouseId", void 0);
34
+ __decorate([
35
+ Property({ type: 'integer' }),
36
+ __metadata("design:type", Number)
37
+ ], ProductWarehouseLowStockThreshold.prototype, "threshold", void 0);
38
+ __decorate([
39
+ Property({ type: 'datetime', onCreate: () => new Date() }),
40
+ __metadata("design:type", Date)
41
+ ], ProductWarehouseLowStockThreshold.prototype, "createdAt", void 0);
42
+ __decorate([
43
+ Property({ type: 'datetime', onUpdate: () => new Date() }),
44
+ __metadata("design:type", Date)
45
+ ], ProductWarehouseLowStockThreshold.prototype, "updatedAt", void 0);
46
+ ProductWarehouseLowStockThreshold = __decorate([
47
+ GlobalEntity(),
48
+ Entity({ tableName: 'product_warehouse_low_stock_thresholds' })
49
+ ], ProductWarehouseLowStockThreshold);
50
+ export { ProductWarehouseLowStockThreshold };
51
+ //# sourceMappingURL=product-warehouse-low-stock-threshold.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-warehouse-low-stock-threshold.entity.js","sourceRoot":"","sources":["../../../src/backend/entities/product-warehouse-low-stock-threshold.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE;;;;;;GAMG;AAGI,IAAM,iCAAiC,GAAvC,MAAM,iCAAiC;IAE5C,SAAS,CAAU;IAGnB,WAAW,CAAU;IAGrB,SAAS,CAAU;IAGnB,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAG7B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;CAC9B,CAAA;AAbC;IADC,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oEACV;AAGnB;IADC,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sEACR;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;oEACX;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BAChD,IAAI;oEAAc;AAG7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BAChD,IAAI;oEAAc;AAdlB,iCAAiC;IAF7C,YAAY,EAAE;IACd,MAAM,CAAC,EAAE,SAAS,EAAE,wCAAwC,EAAE,CAAC;GACnD,iCAAiC,CAe7C"}
@@ -0,0 +1,22 @@
1
+ import { OptionalProps } from '@mikro-orm/core';
2
+ /**
3
+ * StockAllocation — one row per `(orderItemId, warehouseId)` pair
4
+ * persisted at order placement so admins can see fulfilment
5
+ * provenance per line and so cancellation can release reservations
6
+ * cleanly (released_at is non-null after release).
7
+ *
8
+ * `is_backorder = true` when the allocation was made against a
9
+ * product with `backorder_enabled = true` and the chosen warehouse
10
+ * could not satisfy the full quantity at order time.
11
+ */
12
+ export declare class StockAllocation {
13
+ [OptionalProps]?: 'id' | 'createdAt' | 'releasedAt' | 'isBackorder';
14
+ id: string;
15
+ orderItemId: string;
16
+ warehouseId: string;
17
+ quantity: number;
18
+ isBackorder: boolean;
19
+ createdAt: Date;
20
+ releasedAt?: Date | null;
21
+ }
22
+ //# sourceMappingURL=stock-allocation.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stock-allocation.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/stock-allocation.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAgC,MAAM,iBAAiB,CAAC;AAI7F;;;;;;;;;GASG;AACH,qBAGa,eAAe;IAC1B,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,GAAG,WAAW,GAAG,YAAY,GAAG,aAAa,CAAC;IAGpE,EAAE,EAAE,MAAM,CAAgB;IAI1B,WAAW,EAAG,MAAM,CAAC;IAIrB,WAAW,EAAG,MAAM,CAAC;IAGrB,QAAQ,EAAG,MAAM,CAAC;IAGlB,WAAW,EAAE,OAAO,CAAS;IAG7B,SAAS,EAAE,IAAI,CAAc;IAG7B,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC1B"}
@@ -0,0 +1,69 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Entity, Index, OptionalProps, PrimaryKey, Property, Unique } from '@mikro-orm/core';
11
+ import { GlobalEntity } from '@endora-commerce/platform/tenancy';
12
+ import { randomUUID } from 'crypto';
13
+ /**
14
+ * StockAllocation — one row per `(orderItemId, warehouseId)` pair
15
+ * persisted at order placement so admins can see fulfilment
16
+ * provenance per line and so cancellation can release reservations
17
+ * cleanly (released_at is non-null after release).
18
+ *
19
+ * `is_backorder = true` when the allocation was made against a
20
+ * product with `backorder_enabled = true` and the chosen warehouse
21
+ * could not satisfy the full quantity at order time.
22
+ */
23
+ let StockAllocation = class StockAllocation {
24
+ [OptionalProps];
25
+ id = randomUUID();
26
+ orderItemId;
27
+ warehouseId;
28
+ quantity;
29
+ isBackorder = false;
30
+ createdAt = new Date();
31
+ releasedAt;
32
+ };
33
+ __decorate([
34
+ PrimaryKey({ type: 'uuid' }),
35
+ __metadata("design:type", String)
36
+ ], StockAllocation.prototype, "id", void 0);
37
+ __decorate([
38
+ Property({ type: 'uuid' }),
39
+ Index(),
40
+ __metadata("design:type", String)
41
+ ], StockAllocation.prototype, "orderItemId", void 0);
42
+ __decorate([
43
+ Property({ type: 'uuid' }),
44
+ Index(),
45
+ __metadata("design:type", String)
46
+ ], StockAllocation.prototype, "warehouseId", void 0);
47
+ __decorate([
48
+ Property({ type: 'integer' }),
49
+ __metadata("design:type", Number)
50
+ ], StockAllocation.prototype, "quantity", void 0);
51
+ __decorate([
52
+ Property({ type: 'boolean' }),
53
+ __metadata("design:type", Boolean)
54
+ ], StockAllocation.prototype, "isBackorder", void 0);
55
+ __decorate([
56
+ Property({ type: 'datetime', onCreate: () => new Date() }),
57
+ __metadata("design:type", Date)
58
+ ], StockAllocation.prototype, "createdAt", void 0);
59
+ __decorate([
60
+ Property({ type: 'datetime', nullable: true }),
61
+ __metadata("design:type", Object)
62
+ ], StockAllocation.prototype, "releasedAt", void 0);
63
+ StockAllocation = __decorate([
64
+ GlobalEntity(),
65
+ Entity({ tableName: 'stock_allocations' }),
66
+ Unique({ properties: ['orderItemId', 'warehouseId'] })
67
+ ], StockAllocation);
68
+ export { StockAllocation };
69
+ //# sourceMappingURL=stock-allocation.entity.js.map