@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 @@
1
+ {"version":3,"file":"stock-allocation.entity.js","sourceRoot":"","s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SAAS,EAAE,mBAAmB,EAAE,CAAC;IAC1C,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC,EAAE,CAAC;GAC1C,eAAe,CAyB3B"}
@@ -0,0 +1,24 @@
1
+ import { OptionalProps } from '@mikro-orm/core';
2
+ /**
3
+ * StockLevel — onHand + reserved counters per
4
+ * `(productId, variantId?, warehouseId)` triplet (feature 010).
5
+ *
6
+ * The unique-key shape changed in migration 030: previously the index
7
+ * was on `(product_id, variant_id_bucket)`, now it includes
8
+ * `warehouse_id` so multiple warehouses can hold the same product.
9
+ * The partial-unique index lives in migration 030 (Postgres `coalesce`
10
+ * trick on the variant column); this entity does not declare a
11
+ * database-level unique constraint.
12
+ */
13
+ export declare class StockLevel {
14
+ [OptionalProps]?: 'id' | 'createdAt' | 'updatedAt' | 'variantId' | 'reserved';
15
+ id: string;
16
+ productId: string;
17
+ variantId?: string | null;
18
+ warehouseId: string;
19
+ onHand: number;
20
+ reserved: number;
21
+ createdAt: Date;
22
+ updatedAt: Date;
23
+ }
24
+ //# sourceMappingURL=stock-level.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stock-level.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/stock-level.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAwB,MAAM,iBAAiB,CAAC;AAIrF;;;;;;;;;;GAUG;AACH,qBAEa,UAAU;IACrB,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,UAAU,CAAC;IAG9E,EAAE,EAAE,MAAM,CAAgB;IAI1B,SAAS,EAAG,MAAM,CAAC;IAGnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAI1B,WAAW,EAAG,MAAM,CAAC;IAGrB,MAAM,EAAG,MAAM,CAAC;IAGhB,QAAQ,EAAE,MAAM,CAAK;IAGrB,SAAS,EAAE,IAAI,CAAc;IAG7B,SAAS,EAAE,IAAI,CAAc;CAC9B"}
@@ -0,0 +1,74 @@
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 { GlobalEntity } from '@endora-commerce/platform/tenancy';
12
+ import { randomUUID } from 'crypto';
13
+ /**
14
+ * StockLevel — onHand + reserved counters per
15
+ * `(productId, variantId?, warehouseId)` triplet (feature 010).
16
+ *
17
+ * The unique-key shape changed in migration 030: previously the index
18
+ * was on `(product_id, variant_id_bucket)`, now it includes
19
+ * `warehouse_id` so multiple warehouses can hold the same product.
20
+ * The partial-unique index lives in migration 030 (Postgres `coalesce`
21
+ * trick on the variant column); this entity does not declare a
22
+ * database-level unique constraint.
23
+ */
24
+ let StockLevel = class StockLevel {
25
+ [OptionalProps];
26
+ id = randomUUID();
27
+ productId;
28
+ variantId;
29
+ warehouseId;
30
+ onHand;
31
+ reserved = 0;
32
+ createdAt = new Date();
33
+ updatedAt = new Date();
34
+ };
35
+ __decorate([
36
+ PrimaryKey({ type: 'uuid' }),
37
+ __metadata("design:type", String)
38
+ ], StockLevel.prototype, "id", void 0);
39
+ __decorate([
40
+ Property({ type: 'uuid' }),
41
+ Index(),
42
+ __metadata("design:type", String)
43
+ ], StockLevel.prototype, "productId", void 0);
44
+ __decorate([
45
+ Property({ type: 'uuid', nullable: true }),
46
+ __metadata("design:type", Object)
47
+ ], StockLevel.prototype, "variantId", void 0);
48
+ __decorate([
49
+ Property({ type: 'uuid' }),
50
+ Index(),
51
+ __metadata("design:type", String)
52
+ ], StockLevel.prototype, "warehouseId", void 0);
53
+ __decorate([
54
+ Property({ type: 'integer' }),
55
+ __metadata("design:type", Number)
56
+ ], StockLevel.prototype, "onHand", void 0);
57
+ __decorate([
58
+ Property({ type: 'integer' }),
59
+ __metadata("design:type", Number)
60
+ ], StockLevel.prototype, "reserved", void 0);
61
+ __decorate([
62
+ Property({ type: 'datetime', onCreate: () => new Date() }),
63
+ __metadata("design:type", Date)
64
+ ], StockLevel.prototype, "createdAt", void 0);
65
+ __decorate([
66
+ Property({ type: 'datetime', onUpdate: () => new Date() }),
67
+ __metadata("design:type", Date)
68
+ ], StockLevel.prototype, "updatedAt", void 0);
69
+ StockLevel = __decorate([
70
+ GlobalEntity(),
71
+ Entity({ tableName: 'stock_levels' })
72
+ ], StockLevel);
73
+ export { StockLevel };
74
+ //# sourceMappingURL=stock-level.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stock-level.entity.js","sourceRoot":"","sources":["../../../src/backend/entities/stock-level.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC;;;;;;;;;;GAUG;AAGI,IAAM,UAAU,GAAhB,MAAM,UAAU;IACrB,CAAC,aAAa,CAAC,CAA+D;IAG9E,EAAE,GAAW,UAAU,EAAE,CAAC;IAI1B,SAAS,CAAU;IAGnB,SAAS,CAAiB;IAI1B,WAAW,CAAU;IAGrB,MAAM,CAAU;IAGhB,QAAQ,GAAW,CAAC,CAAC;IAGrB,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAG7B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;CAC9B,CAAA;AAxBC;IADC,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACH;AAI1B;IAFC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE;;6CACW;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACjB;AAI1B;IAFC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE;;+CACa;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;0CACd;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;4CACT;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BAChD,IAAI;6CAAc;AAG7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BAChD,IAAI;6CAAc;AA3BlB,UAAU;IAFtB,YAAY,EAAE;IACd,MAAM,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;GACzB,UAAU,CA4BtB"}
@@ -0,0 +1,17 @@
1
+ import { OptionalProps } from '@mikro-orm/core';
2
+ /**
3
+ * WarehouseChannelAssignment — m:n binding between warehouses and
4
+ * sales channels with at most one default per channel (enforced by a
5
+ * partial unique index on `(sales_channel_id) WHERE is_default = true`
6
+ * in migration 030).
7
+ */
8
+ export declare class WarehouseChannelAssignment {
9
+ [OptionalProps]?: 'id' | 'createdAt' | 'isDefault' | 'sortOrder';
10
+ id: string;
11
+ warehouseId: string;
12
+ salesChannelId: string;
13
+ isDefault: boolean;
14
+ sortOrder: number;
15
+ createdAt: Date;
16
+ }
17
+ //# sourceMappingURL=warehouse-channel-assignment.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warehouse-channel-assignment.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/warehouse-channel-assignment.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAgC,MAAM,iBAAiB,CAAC;AAI7F;;;;;GAKG;AACH,qBAGa,0BAA0B;IACrC,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;IAGjE,EAAE,EAAE,MAAM,CAAgB;IAI1B,WAAW,EAAG,MAAM,CAAC;IAIrB,cAAc,EAAG,MAAM,CAAC;IAGxB,SAAS,EAAE,OAAO,CAAS;IAG3B,SAAS,EAAE,MAAM,CAAK;IAGtB,SAAS,EAAE,IAAI,CAAc;CAC9B"}
@@ -0,0 +1,60 @@
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
+ * WarehouseChannelAssignment — m:n binding between warehouses and
15
+ * sales channels with at most one default per channel (enforced by a
16
+ * partial unique index on `(sales_channel_id) WHERE is_default = true`
17
+ * in migration 030).
18
+ */
19
+ let WarehouseChannelAssignment = class WarehouseChannelAssignment {
20
+ [OptionalProps];
21
+ id = randomUUID();
22
+ warehouseId;
23
+ salesChannelId;
24
+ isDefault = false;
25
+ sortOrder = 0;
26
+ createdAt = new Date();
27
+ };
28
+ __decorate([
29
+ PrimaryKey({ type: 'uuid' }),
30
+ __metadata("design:type", String)
31
+ ], WarehouseChannelAssignment.prototype, "id", void 0);
32
+ __decorate([
33
+ Property({ type: 'uuid' }),
34
+ Index(),
35
+ __metadata("design:type", String)
36
+ ], WarehouseChannelAssignment.prototype, "warehouseId", void 0);
37
+ __decorate([
38
+ Property({ type: 'uuid' }),
39
+ Index(),
40
+ __metadata("design:type", String)
41
+ ], WarehouseChannelAssignment.prototype, "salesChannelId", void 0);
42
+ __decorate([
43
+ Property({ type: 'boolean' }),
44
+ __metadata("design:type", Boolean)
45
+ ], WarehouseChannelAssignment.prototype, "isDefault", void 0);
46
+ __decorate([
47
+ Property({ type: 'integer' }),
48
+ __metadata("design:type", Number)
49
+ ], WarehouseChannelAssignment.prototype, "sortOrder", void 0);
50
+ __decorate([
51
+ Property({ type: 'datetime', onCreate: () => new Date() }),
52
+ __metadata("design:type", Date)
53
+ ], WarehouseChannelAssignment.prototype, "createdAt", void 0);
54
+ WarehouseChannelAssignment = __decorate([
55
+ GlobalEntity(),
56
+ Entity({ tableName: 'warehouse_channel_assignments' }),
57
+ Unique({ properties: ['warehouseId', 'salesChannelId'] })
58
+ ], WarehouseChannelAssignment);
59
+ export { WarehouseChannelAssignment };
60
+ //# sourceMappingURL=warehouse-channel-assignment.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warehouse-channel-assignment.entity.js","sourceRoot":"","sources":["../../../src/backend/entities/warehouse-channel-assignment.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,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/core';
2
+ /**
3
+ * Warehouse — a physical or logical stocking location (feature 010).
4
+ *
5
+ * The seeded `Default` warehouse uses the deterministic UUID
6
+ * `00000000-0000-4000-8000-00000000d017` so retried migrations stay
7
+ * idempotent and other modules can reference it from fixtures.
8
+ */
9
+ export interface WarehouseAddress {
10
+ street?: string | null | undefined;
11
+ city?: string | null | undefined;
12
+ postalCode?: string | null | undefined;
13
+ countryCode?: string | null | undefined;
14
+ }
15
+ export declare const DEFAULT_WAREHOUSE_ID = "00000000-0000-4000-8000-00000000d017";
16
+ export declare const DEFAULT_WAREHOUSE_CODE = "default";
17
+ export declare class Warehouse {
18
+ [OptionalProps]?: 'id' | 'createdAt' | 'updatedAt' | 'active' | 'description' | 'address' | 'contactName' | 'contactEmail' | 'contactPhone' | 'defaultLowStockThreshold';
19
+ id: string;
20
+ name: string;
21
+ code: string;
22
+ active: boolean;
23
+ description?: string | null;
24
+ address?: WarehouseAddress | null;
25
+ contactName?: string | null;
26
+ contactEmail?: string | null;
27
+ contactPhone?: string | null;
28
+ /**
29
+ * Per-warehouse fallback low-stock threshold. Used when a Product has
30
+ * no `lowStockThreshold` of its own; the StockLevelService picks the
31
+ * MAX value across warehouses holding stock for the product.
32
+ */
33
+ defaultLowStockThreshold?: number | null;
34
+ createdAt: Date;
35
+ updatedAt: Date;
36
+ }
37
+ //# sourceMappingURL=warehouse.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warehouse.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/warehouse.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAgC,MAAM,iBAAiB,CAAC;AAI7F;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACvC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACzC;AAED,eAAO,MAAM,oBAAoB,yCAAyC,CAAC;AAC3E,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD,qBAEa,SAAS;IACpB,CAAC,aAAa,CAAC,CAAC,EACZ,IAAI,GACJ,WAAW,GACX,WAAW,GACX,QAAQ,GACR,aAAa,GACb,SAAS,GACT,aAAa,GACb,cAAc,GACd,cAAc,GACd,0BAA0B,CAAC;IAG/B,EAAE,EAAE,MAAM,CAAgB;IAG1B,IAAI,EAAG,MAAM,CAAC;IAId,IAAI,EAAG,MAAM,CAAC;IAId,MAAM,EAAE,OAAO,CAAQ;IAGvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG5B,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAGlC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG5B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG7B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;;;OAIG;IAEH,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGzC,SAAS,EAAE,IAAI,CAAc;IAG7B,SAAS,EAAE,IAAI,CAAc;CAC9B"}
@@ -0,0 +1,90 @@
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
+ export const DEFAULT_WAREHOUSE_ID = '00000000-0000-4000-8000-00000000d017';
14
+ export const DEFAULT_WAREHOUSE_CODE = 'default';
15
+ let Warehouse = class Warehouse {
16
+ [OptionalProps];
17
+ id = randomUUID();
18
+ name;
19
+ code;
20
+ active = true;
21
+ description;
22
+ address;
23
+ contactName;
24
+ contactEmail;
25
+ contactPhone;
26
+ /**
27
+ * Per-warehouse fallback low-stock threshold. Used when a Product has
28
+ * no `lowStockThreshold` of its own; the StockLevelService picks the
29
+ * MAX value across warehouses holding stock for the product.
30
+ */
31
+ defaultLowStockThreshold;
32
+ createdAt = new Date();
33
+ updatedAt = new Date();
34
+ };
35
+ __decorate([
36
+ PrimaryKey({ type: 'uuid' }),
37
+ __metadata("design:type", String)
38
+ ], Warehouse.prototype, "id", void 0);
39
+ __decorate([
40
+ Property({ type: 'string', length: 160 }),
41
+ __metadata("design:type", String)
42
+ ], Warehouse.prototype, "name", void 0);
43
+ __decorate([
44
+ Property({ type: 'string', length: 64 }),
45
+ Unique(),
46
+ __metadata("design:type", String)
47
+ ], Warehouse.prototype, "code", void 0);
48
+ __decorate([
49
+ Property({ type: 'boolean' }),
50
+ Index(),
51
+ __metadata("design:type", Boolean)
52
+ ], Warehouse.prototype, "active", void 0);
53
+ __decorate([
54
+ Property({ type: 'text', nullable: true }),
55
+ __metadata("design:type", Object)
56
+ ], Warehouse.prototype, "description", void 0);
57
+ __decorate([
58
+ Property({ type: 'json', nullable: true }),
59
+ __metadata("design:type", Object)
60
+ ], Warehouse.prototype, "address", void 0);
61
+ __decorate([
62
+ Property({ type: 'string', length: 160, nullable: true }),
63
+ __metadata("design:type", Object)
64
+ ], Warehouse.prototype, "contactName", void 0);
65
+ __decorate([
66
+ Property({ type: 'string', length: 320, nullable: true }),
67
+ __metadata("design:type", Object)
68
+ ], Warehouse.prototype, "contactEmail", void 0);
69
+ __decorate([
70
+ Property({ type: 'string', length: 64, nullable: true }),
71
+ __metadata("design:type", Object)
72
+ ], Warehouse.prototype, "contactPhone", void 0);
73
+ __decorate([
74
+ Property({ type: 'integer', nullable: true }),
75
+ __metadata("design:type", Object)
76
+ ], Warehouse.prototype, "defaultLowStockThreshold", void 0);
77
+ __decorate([
78
+ Property({ type: 'datetime', onCreate: () => new Date() }),
79
+ __metadata("design:type", Date)
80
+ ], Warehouse.prototype, "createdAt", void 0);
81
+ __decorate([
82
+ Property({ type: 'datetime', onUpdate: () => new Date() }),
83
+ __metadata("design:type", Date)
84
+ ], Warehouse.prototype, "updatedAt", void 0);
85
+ Warehouse = __decorate([
86
+ GlobalEntity(),
87
+ Entity({ tableName: 'warehouses' })
88
+ ], Warehouse);
89
+ export { Warehouse };
90
+ //# sourceMappingURL=warehouse.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warehouse.entity.js","sourceRoot":"","sources":["../../../src/backend/entities/warehouse.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAgBpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,sCAAsC,CAAC;AAC3E,MAAM,CAAC,MAAM,sBAAsB,GAAG,SAAS,CAAC;AAIzC,IAAM,SAAS,GAAf,MAAM,SAAS;IACpB,CAAC,aAAa,CAAC,CAUgB;IAG/B,EAAE,GAAW,UAAU,EAAE,CAAC;IAG1B,IAAI,CAAU;IAId,IAAI,CAAU;IAId,MAAM,GAAY,IAAI,CAAC;IAGv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AAC;;2DACL;AAGzC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BAChD,IAAI;4CAAc;AAG7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BAChD,IAAI;4CAAc;AAtDlB,SAAS;IAFrB,YAAY,EAAE;IACd,MAAM,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;GACvB,SAAS,CAuDrB"}
@@ -0,0 +1,139 @@
1
+ import type { EntityManager } from '@mikro-orm/postgresql';
2
+ import type { FastifyRequest } from 'fastify';
3
+ import type { DictionaryValidator } from '@endora-commerce/contracts';
4
+ import type { AuditPort } from '@endora-commerce/platform/kernel';
5
+ import type { CommandBus } from '@endora-commerce/platform/commands';
6
+ import type { EventBus } from '@endora-commerce/platform/events';
7
+ import type { InventoryAvailabilityPort, PromptActionToolRegistryPort } from '@endora-commerce/contracts';
8
+ import type { ModuleContext } from '@endora-commerce/platform/kernel';
9
+ import type { RequireAdminFactory } from '@endora-commerce/platform/kernel';
10
+ import type { SalesChannelResolutionPort } from '@endora-commerce/platform/kernel';
11
+ import type { SettingsReadPort } from '@endora-commerce/platform/kernel';
12
+ import { inventoryModule, type InventoryModuleOptions } from './plugin.js';
13
+ import { AvailabilityNotification } from './entities/availability-notification.entity.js';
14
+ import { InventoryThreshold } from './entities/inventory-threshold.entity.js';
15
+ import { ProductWarehouseLowStockThreshold } from './entities/product-warehouse-low-stock-threshold.entity.js';
16
+ import { StockAllocation } from './entities/stock-allocation.entity.js';
17
+ import { StockLevel } from './entities/stock-level.entity.js';
18
+ import { WarehouseChannelAssignment } from './entities/warehouse-channel-assignment.entity.js';
19
+ import { Warehouse } from './entities/warehouse.entity.js';
20
+ /**
21
+ * `inventory` — three capabilities the test harness never had (feature 072,
22
+ * wave 3, T129).
23
+ *
24
+ * Production passed `eventBus`, `channelResolver` and `settingsService`; the
25
+ * harness passed none of the three, and each is guarded by an `if` inside the
26
+ * factory. So in every test run the availability worker never attached, the
27
+ * threshold-settings mirror never ran, and a storefront stock read never scoped
28
+ * its candidate warehouses to the caller's channel binding. Three behaviours
29
+ * this module exists to have, exercised by nothing — and no test could have
30
+ * noticed, because the shape that omits them is the shape the tests compose.
31
+ *
32
+ * All three are unconditional now, which is the point of the conversion rather
33
+ * than a side effect of it: a module that reads the event bus reads it in every
34
+ * composition, and the subscription goes through `ctx.subscribe` so it stops
35
+ * when the module does.
36
+ *
37
+ * `dictionaryValidator` was optional and **passed by neither root**, so
38
+ * warehouse country codes have never been validated against the dictionary
39
+ * registry. It is a declared dependency now — the same finding `sales_channels`
40
+ * produced in T110, in a second module.
41
+ *
42
+ * `templateEmail` and `resolveOrganizationWarehouseAllowList` stay contributed.
43
+ * The first is built over `transactional_emails`' late-announced sender, the
44
+ * second over `organizations`' warehouse assignment — both are adapters a root
45
+ * builds across a boundary this module must not reach through.
46
+ */
47
+ /** What `inventory` resolves from the container, and the names it owns. */
48
+ export interface InventoryCradle {
49
+ readonly emFactory: () => EntityManager;
50
+ readonly eventBus: EventBus;
51
+ readonly auditLogService: AuditPort;
52
+ /** D-74 — the bulk stock import is one Command and one audit row per run. */
53
+ readonly commandBus: CommandBus;
54
+ readonly requireAdmin: RequireAdminFactory;
55
+ readonly requireCustomer: InventoryModuleOptions['requireCustomer'];
56
+ readonly customerContextResolver: InventoryModuleOptions['resolveCustomerContext'];
57
+ readonly settingsReadPort: SettingsReadPort;
58
+ readonly salesChannelResolutionPort: SalesChannelResolutionPort;
59
+ readonly settingsChannelResolver: () => Promise<string | null>;
60
+ readonly dictionaryValidator: DictionaryValidator;
61
+ /** Root-shaped: the two compositions name a non-admin caller differently. */
62
+ readonly inventoryAdminAuditContext: NonNullable<InventoryModuleOptions['resolveAdminAuditContext']>;
63
+ /**
64
+ * `transactional_emails`' shared template adapter (T120). It used to be
65
+ * `inventoryTemplateEmail`, built by each root from a helper `organizations`
66
+ * owned and passed down — one converted module's helper reaching another
67
+ * through the composition root.
68
+ */
69
+ readonly templateEmailPort: NonNullable<InventoryModuleOptions['templateEmail']>;
70
+ /** The two halves the warehouse allow-list is composed from (T138). */
71
+ readonly customerOrganizationIdResolver: (req: FastifyRequest) => string | null;
72
+ readonly organizationRestrictionPort: {
73
+ allowedIdsFor(organizationId: string, kind: 'paymentMethodIds' | 'deliveryMethodIds' | 'warehouseIds'): Promise<string[] | null>;
74
+ };
75
+ readonly inventory: ReturnType<typeof inventoryModule>;
76
+ /**
77
+ * Owned by `prompt_actions`: the assistant's tool catalogue. An ungated
78
+ * registration this module pushes into once, from a boot hook — declared as a
79
+ * `contributes-to` edge rather than a dependency (D-44).
80
+ */
81
+ readonly promptActionToolRegistry: PromptActionToolRegistryPort;
82
+ /**
83
+ * Availability bands for a set of products, scoped to the warehouses the
84
+ * caller's sales channel is bound to (T143a).
85
+ *
86
+ * `catalog`'s external namespace and `product_feeds` both need exactly this,
87
+ * and both got it from a root that built a **second** `StockLevelService` and
88
+ * `WarehouseChannelService` — while this module built its own pair inside its
89
+ * plugin — then spelled the same two-step lookup twice. The two-step is the
90
+ * port: a caller has a channel, not a warehouse list.
91
+ *
92
+ * The root's copies were also ungated. They kept answering with `inventory`
93
+ * switched off, because only a module's own registration goes through
94
+ * `providePort`.
95
+ *
96
+ * The shape was written out inline here and again in each root's local type,
97
+ * and the `providePort` call carried **no type argument**, so nothing
98
+ * compared the registration to anything and a consumer had no name to import.
99
+ * `specs/110-instance-repository/` T118c published it as
100
+ * {@link InventoryAvailabilityPort}, when `product_feeds` stopped reaching it
101
+ * through a composition root and `check:port-shape`'s third signal — a module
102
+ * resolving a container name no contract publishes — became what stood in the
103
+ * way.
104
+ */
105
+ readonly inventoryAvailabilityPort: InventoryAvailabilityPort;
106
+ }
107
+ export declare function registerModule(ctx: ModuleContext): void;
108
+ /**
109
+ * The module's persisted entity classes, on the `./backend` subpath, as one
110
+ * array and **no named class export** (D-168).
111
+ *
112
+ * This is the shape the platform reads when the package is *installed*: the
113
+ * boot-time loader (`src/packages/package-runtime.ts`, `exported['entities']`)
114
+ * and the static declaration reader (`scripts/lib/package-declarations.ts`),
115
+ * which is the third source of `check:module-boundary`'s `table->owner` map and
116
+ * the package pass of `check-entity-tenant-classification`. A missing array is
117
+ * answered with `[]` — zero entities registered, no error anywhere.
118
+ *
119
+ * The order is the one `db/entities-registry.generated.ts` declared before this
120
+ * module became a package, so the registered set is the same list in the same
121
+ * sequence.
122
+ */
123
+ export declare const entities: (typeof Warehouse | typeof WarehouseChannelAssignment | typeof AvailabilityNotification | typeof StockLevel | typeof InventoryThreshold | typeof StockAllocation | typeof ProductWarehouseLowStockThreshold)[];
124
+ /**
125
+ * The warehouse↔channel reconciler and this module's system warehouse id,
126
+ * published **by name** on `./backend`.
127
+ *
128
+ * The host's demo composition runs the reconciler, and a host program is
129
+ * composed against this package's `dist` while the ORM is registered from the
130
+ * same `entities` array above — so a filesystem path into this file's source
131
+ * would evaluate `warehouse.entity.ts` a second time and the reconciler would
132
+ * `em.create` a `WarehouseChannelAssignment` class the ORM has never heard of
133
+ * (D-160.6.1). D-168 bars an entity class from leaving by this door; a service
134
+ * and a constant are not entities, and `price_lists`' `DefaultPriceListMigrator`
135
+ * / `DEFAULT_PRICE_LIST_ID` pair is the precedent for exactly this shape.
136
+ */
137
+ export { WarehouseChannelReconciler } from './services/warehouse-channel-reconciler.js';
138
+ export { DEFAULT_WAREHOUSE_ID } from './entities/warehouse.entity.js';
139
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/backend/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK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