@open-mercato/core 0.6.7-develop.6669.1.40b669666b → 0.6.7-develop.6671.1.4b925c5096
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.
- package/.turbo/turbo-build.log +2 -2
- package/dist/generated/entities/inventory_balance/index.js +21 -0
- package/dist/generated/entities/inventory_balance/index.js.map +7 -0
- package/dist/generated/entities/inventory_lot/index.js +19 -0
- package/dist/generated/entities/inventory_lot/index.js.map +7 -0
- package/dist/generated/entities/inventory_movement/index.js +35 -0
- package/dist/generated/entities/inventory_movement/index.js.map +7 -0
- package/dist/generated/entities/inventory_reservation/index.js +23 -0
- package/dist/generated/entities/inventory_reservation/index.js.map +7 -0
- package/dist/generated/entities/product_inventory_profile/index.js +21 -0
- package/dist/generated/entities/product_inventory_profile/index.js.map +7 -0
- package/dist/generated/entities/sales_order_warehouse_assignment/index.js +11 -0
- package/dist/generated/entities/sales_order_warehouse_assignment/index.js.map +7 -0
- package/dist/generated/entities/warehouse/index.js +25 -0
- package/dist/generated/entities/warehouse/index.js.map +7 -0
- package/dist/generated/entities/warehouse_location/index.js +21 -0
- package/dist/generated/entities/warehouse_location/index.js.map +7 -0
- package/dist/generated/entities/warehouse_zone/index.js +11 -0
- package/dist/generated/entities/warehouse_zone/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +12 -0
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +98 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/modules/auth/backend/roles/page.js +12 -4
- package/dist/modules/auth/backend/roles/page.js.map +2 -2
- package/dist/modules/auth/lib/backendChrome.js +1 -0
- package/dist/modules/auth/lib/backendChrome.js.map +2 -2
- package/dist/modules/auth/services/rbacService.js +16 -17
- package/dist/modules/auth/services/rbacService.js.map +2 -2
- package/dist/modules/catalog/api/products/route.js +3 -0
- package/dist/modules/catalog/api/products/route.js.map +2 -2
- package/dist/modules/catalog/api/variants/route.js +3 -0
- package/dist/modules/catalog/api/variants/route.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +6 -6
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/sales/api/documents/factory.js +1 -0
- package/dist/modules/sales/api/documents/factory.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +53 -0
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/components/documents/ItemsSection.js +51 -2
- package/dist/modules/sales/components/documents/ItemsSection.js.map +2 -2
- package/dist/modules/sales/events.js +2 -0
- package/dist/modules/sales/events.js.map +2 -2
- package/dist/modules/sales/widgets/injection/order-items-context.js +11 -0
- package/dist/modules/sales/widgets/injection/order-items-context.js.map +7 -0
- package/dist/modules/wms/acl.js +18 -0
- package/dist/modules/wms/acl.js.map +7 -0
- package/dist/modules/wms/analytics.js +11 -0
- package/dist/modules/wms/analytics.js.map +7 -0
- package/dist/modules/wms/api/dashboard/operational/route.js +80 -0
- package/dist/modules/wms/api/dashboard/operational/route.js.map +7 -0
- package/dist/modules/wms/api/interceptors.js +90 -0
- package/dist/modules/wms/api/interceptors.js.map +7 -0
- package/dist/modules/wms/api/inventory/adjust/route.js +51 -0
- package/dist/modules/wms/api/inventory/adjust/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/allocate/route.js +51 -0
- package/dist/modules/wms/api/inventory/allocate/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/balances/route.js +172 -0
- package/dist/modules/wms/api/inventory/balances/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/cycle-count/route.js +52 -0
- package/dist/modules/wms/api/inventory/cycle-count/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/helpers.js +113 -0
- package/dist/modules/wms/api/inventory/helpers.js.map +7 -0
- package/dist/modules/wms/api/inventory/import/apply/route.js +46 -0
- package/dist/modules/wms/api/inventory/import/apply/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/import/helpers.js +195 -0
- package/dist/modules/wms/api/inventory/import/helpers.js.map +7 -0
- package/dist/modules/wms/api/inventory/import/template/route.js +32 -0
- package/dist/modules/wms/api/inventory/import/template/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/import/validate/route.js +54 -0
- package/dist/modules/wms/api/inventory/import/validate/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/move/route.js +51 -0
- package/dist/modules/wms/api/inventory/move/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/movements/route.js +164 -0
- package/dist/modules/wms/api/inventory/movements/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/receive/route.js +50 -0
- package/dist/modules/wms/api/inventory/receive/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/release/route.js +44 -0
- package/dist/modules/wms/api/inventory/release/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/reservations/route.js +128 -0
- package/dist/modules/wms/api/inventory/reservations/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/reserve/route.js +59 -0
- package/dist/modules/wms/api/inventory/reserve/route.js.map +7 -0
- package/dist/modules/wms/api/inventory-profiles/route.js +178 -0
- package/dist/modules/wms/api/inventory-profiles/route.js.map +7 -0
- package/dist/modules/wms/api/listEnrichers.js +181 -0
- package/dist/modules/wms/api/listEnrichers.js.map +7 -0
- package/dist/modules/wms/api/listSearch.js +77 -0
- package/dist/modules/wms/api/listSearch.js.map +7 -0
- package/dist/modules/wms/api/locations/route.js +172 -0
- package/dist/modules/wms/api/locations/route.js.map +7 -0
- package/dist/modules/wms/api/lots/route.js +204 -0
- package/dist/modules/wms/api/lots/route.js.map +7 -0
- package/dist/modules/wms/api/openapi.js +27 -0
- package/dist/modules/wms/api/openapi.js.map +7 -0
- package/dist/modules/wms/api/sales-orders/[salesOrderId]/re-run-reservation/route.js +54 -0
- package/dist/modules/wms/api/sales-orders/[salesOrderId]/re-run-reservation/route.js.map +7 -0
- package/dist/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.js +279 -0
- package/dist/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.js.map +7 -0
- package/dist/modules/wms/api/sales-orders/assign-warehouse/route.js +56 -0
- package/dist/modules/wms/api/sales-orders/assign-warehouse/route.js.map +7 -0
- package/dist/modules/wms/api/sales-orders/unassign-warehouse/route.js +43 -0
- package/dist/modules/wms/api/sales-orders/unassign-warehouse/route.js.map +7 -0
- package/dist/modules/wms/api/warehouses/route.js +181 -0
- package/dist/modules/wms/api/warehouses/route.js.map +7 -0
- package/dist/modules/wms/api/zones/route.js +159 -0
- package/dist/modules/wms/api/zones/route.js.map +7 -0
- package/dist/modules/wms/backend/config/wms/page.js +9 -0
- package/dist/modules/wms/backend/config/wms/page.js.map +7 -0
- package/dist/modules/wms/backend/config/wms/page.meta.js +18 -0
- package/dist/modules/wms/backend/config/wms/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/page.js +9 -0
- package/dist/modules/wms/backend/page.js.map +7 -0
- package/dist/modules/wms/backend/page.meta.js +16 -0
- package/dist/modules/wms/backend/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/inventory/page.js +9 -0
- package/dist/modules/wms/backend/wms/inventory/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/inventory/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/inventory/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/location/[id]/page.js +9 -0
- package/dist/modules/wms/backend/wms/location/[id]/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/location/[id]/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/location/[id]/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/locations/page.js +10 -0
- package/dist/modules/wms/backend/wms/locations/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/locations/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/locations/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/lot/[id]/page.js +9 -0
- package/dist/modules/wms/backend/wms/lot/[id]/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/lot/[id]/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/lot/[id]/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/lots/page.js +9 -0
- package/dist/modules/wms/backend/wms/lots/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/lots/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/lots/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/movements/page.js +22 -0
- package/dist/modules/wms/backend/wms/movements/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/movements/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/movements/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/reservations/page.js +23 -0
- package/dist/modules/wms/backend/wms/reservations/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/reservations/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/reservations/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/sku/[id]/page.js +9 -0
- package/dist/modules/wms/backend/wms/sku/[id]/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/sku/[id]/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/sku/[id]/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/warehouses/page.js +10 -0
- package/dist/modules/wms/backend/wms/warehouses/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/warehouses/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/warehouses/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/zones/page.js +10 -0
- package/dist/modules/wms/backend/wms/zones/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/zones/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/zones/page.meta.js.map +7 -0
- package/dist/modules/wms/ce.js +80 -0
- package/dist/modules/wms/ce.js.map +7 -0
- package/dist/modules/wms/cli.js +83 -0
- package/dist/modules/wms/cli.js.map +7 -0
- package/dist/modules/wms/commands/configuration.js +1519 -0
- package/dist/modules/wms/commands/configuration.js.map +7 -0
- package/dist/modules/wms/commands/index.js +4 -0
- package/dist/modules/wms/commands/index.js.map +7 -0
- package/dist/modules/wms/commands/inventory-actions.js +1539 -0
- package/dist/modules/wms/commands/inventory-actions.js.map +7 -0
- package/dist/modules/wms/commands/sales-order-assignment.js +277 -0
- package/dist/modules/wms/commands/sales-order-assignment.js.map +7 -0
- package/dist/modules/wms/commands/shared.js +82 -0
- package/dist/modules/wms/commands/shared.js.map +7 -0
- package/dist/modules/wms/components/backend/AdjustInventoryDialog.js +755 -0
- package/dist/modules/wms/components/backend/AdjustInventoryDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/ChangeLotStatusDialog.js +269 -0
- package/dist/modules/wms/components/backend/ChangeLotStatusDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/CycleCountWizardDialog.js +1783 -0
- package/dist/modules/wms/components/backend/CycleCountWizardDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/ImportInventoryDialog.js +766 -0
- package/dist/modules/wms/components/backend/ImportInventoryDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/InventoryOperationsSection.js +119 -0
- package/dist/modules/wms/components/backend/InventoryOperationsSection.js.map +7 -0
- package/dist/modules/wms/components/backend/LocationEditDialog.js +140 -0
- package/dist/modules/wms/components/backend/LocationEditDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/MoveInventoryDialog.js +791 -0
- package/dist/modules/wms/components/backend/MoveInventoryDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/ReceiveInventoryDialog.js +656 -0
- package/dist/modules/wms/components/backend/ReceiveInventoryDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/ReleaseReservationDialog.js +344 -0
- package/dist/modules/wms/components/backend/ReleaseReservationDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/ReserveInventoryDialog.js +475 -0
- package/dist/modules/wms/components/backend/ReserveInventoryDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsConfigurationPage.js +1112 -0
- package/dist/modules/wms/components/backend/WmsConfigurationPage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js +908 -0
- package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsLocationDetailPage.js +1015 -0
- package/dist/modules/wms/components/backend/WmsLocationDetailPage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsLotDetailPage.js +1049 -0
- package/dist/modules/wms/components/backend/WmsLotDetailPage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsLotsListPage.js +297 -0
- package/dist/modules/wms/components/backend/WmsLotsListPage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsOperationalDashboardPage.js +757 -0
- package/dist/modules/wms/components/backend/WmsOperationalDashboardPage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsSkuDetailPage.js +975 -0
- package/dist/modules/wms/components/backend/WmsSkuDetailPage.js.map +7 -0
- package/dist/modules/wms/components/backend/inventoryMutationLoaders.js +710 -0
- package/dist/modules/wms/components/backend/inventoryMutationLoaders.js.map +7 -0
- package/dist/modules/wms/components/backend/useWmsInventoryMutationAccess.js +79 -0
- package/dist/modules/wms/components/backend/useWmsInventoryMutationAccess.js.map +7 -0
- package/dist/modules/wms/components/backend/useWmsInventoryScopeFromSearchParams.js +24 -0
- package/dist/modules/wms/components/backend/useWmsInventoryScopeFromSearchParams.js.map +7 -0
- package/dist/modules/wms/components/backend/wmsLookupLoaders.js +55 -0
- package/dist/modules/wms/components/backend/wmsLookupLoaders.js.map +7 -0
- package/dist/modules/wms/data/enrichers.js +501 -0
- package/dist/modules/wms/data/enrichers.js.map +7 -0
- package/dist/modules/wms/data/entities.js +467 -0
- package/dist/modules/wms/data/entities.js.map +7 -0
- package/dist/modules/wms/data/validators.js +399 -0
- package/dist/modules/wms/data/validators.js.map +7 -0
- package/dist/modules/wms/di.js +27 -0
- package/dist/modules/wms/di.js.map +7 -0
- package/dist/modules/wms/events.js +42 -0
- package/dist/modules/wms/events.js.map +7 -0
- package/dist/modules/wms/index.js +17 -0
- package/dist/modules/wms/index.js.map +7 -0
- package/dist/modules/wms/lib/catalogInventoryProfileIntent.js +54 -0
- package/dist/modules/wms/lib/catalogInventoryProfileIntent.js.map +7 -0
- package/dist/modules/wms/lib/catalogInventoryProfileSync.js +144 -0
- package/dist/modules/wms/lib/catalogInventoryProfileSync.js.map +7 -0
- package/dist/modules/wms/lib/expiry.js +29 -0
- package/dist/modules/wms/lib/expiry.js.map +7 -0
- package/dist/modules/wms/lib/flashMutationError.js +51 -0
- package/dist/modules/wms/lib/flashMutationError.js.map +7 -0
- package/dist/modules/wms/lib/inventoryDisplayUi.js +188 -0
- package/dist/modules/wms/lib/inventoryDisplayUi.js.map +7 -0
- package/dist/modules/wms/lib/inventoryIdempotency.js +37 -0
- package/dist/modules/wms/lib/inventoryIdempotency.js.map +7 -0
- package/dist/modules/wms/lib/inventoryImportCsv.js +173 -0
- package/dist/modules/wms/lib/inventoryImportCsv.js.map +7 -0
- package/dist/modules/wms/lib/inventoryImportService.js +468 -0
- package/dist/modules/wms/lib/inventoryImportService.js.map +7 -0
- package/dist/modules/wms/lib/inventoryMutationUi.js +25 -0
- package/dist/modules/wms/lib/inventoryMutationUi.js.map +7 -0
- package/dist/modules/wms/lib/inventoryPolicy.js +61 -0
- package/dist/modules/wms/lib/inventoryPolicy.js.map +7 -0
- package/dist/modules/wms/lib/inventoryReconciliation.js +193 -0
- package/dist/modules/wms/lib/inventoryReconciliation.js.map +7 -0
- package/dist/modules/wms/lib/inventoryTrackingValidation.js +13 -0
- package/dist/modules/wms/lib/inventoryTrackingValidation.js.map +7 -0
- package/dist/modules/wms/lib/loadOperationalDashboard.js +580 -0
- package/dist/modules/wms/lib/loadOperationalDashboard.js.map +7 -0
- package/dist/modules/wms/lib/lowStockBalanceFilter.js +49 -0
- package/dist/modules/wms/lib/lowStockBalanceFilter.js.map +7 -0
- package/dist/modules/wms/lib/primaryWarehousePolicy.js +32 -0
- package/dist/modules/wms/lib/primaryWarehousePolicy.js.map +7 -0
- package/dist/modules/wms/lib/roleFeatures.js +30 -0
- package/dist/modules/wms/lib/roleFeatures.js.map +7 -0
- package/dist/modules/wms/lib/salesOrderInventoryAutomation.js +291 -0
- package/dist/modules/wms/lib/salesOrderInventoryAutomation.js.map +7 -0
- package/dist/modules/wms/lib/salesOrderWarehouseAssignment.js +54 -0
- package/dist/modules/wms/lib/salesOrderWarehouseAssignment.js.map +7 -0
- package/dist/modules/wms/lib/wmsIntegrationToggles.js +71 -0
- package/dist/modules/wms/lib/wmsIntegrationToggles.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260428110546.js +78 -0
- package/dist/modules/wms/migrations/Migration20260428110546.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260527120000.js +15 -0
- package/dist/modules/wms/migrations/Migration20260527120000.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260527140000.js +37 -0
- package/dist/modules/wms/migrations/Migration20260527140000.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260613120000.js +23 -0
- package/dist/modules/wms/migrations/Migration20260613120000.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260616090000.js +13 -0
- package/dist/modules/wms/migrations/Migration20260616090000.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260707180000.js +15 -0
- package/dist/modules/wms/migrations/Migration20260707180000.js.map +7 -0
- package/dist/modules/wms/notifications.client.js +18 -0
- package/dist/modules/wms/notifications.client.js.map +7 -0
- package/dist/modules/wms/notifications.js +53 -0
- package/dist/modules/wms/notifications.js.map +7 -0
- package/dist/modules/wms/search.js +196 -0
- package/dist/modules/wms/search.js.map +7 -0
- package/dist/modules/wms/setup.js +30 -0
- package/dist/modules/wms/setup.js.map +7 -0
- package/dist/modules/wms/subscribers/low-stock-notification.js +40 -0
- package/dist/modules/wms/subscribers/low-stock-notification.js.map +7 -0
- package/dist/modules/wms/subscribers/reservation-shortfall-notification.js +69 -0
- package/dist/modules/wms/subscribers/reservation-shortfall-notification.js.map +7 -0
- package/dist/modules/wms/subscribers/sales-order-cancelled-release.js +14 -0
- package/dist/modules/wms/subscribers/sales-order-cancelled-release.js.map +7 -0
- package/dist/modules/wms/subscribers/sales-order-confirmed-reserve.js +14 -0
- package/dist/modules/wms/subscribers/sales-order-confirmed-reserve.js.map +7 -0
- package/dist/modules/wms/translations.js +10 -0
- package/dist/modules/wms/translations.js.map +7 -0
- package/dist/modules/wms/vector.js +9 -0
- package/dist/modules/wms/vector.js.map +7 -0
- package/dist/modules/wms/widgets/injection/catalog-inventory-profile/widget.js +200 -0
- package/dist/modules/wms/widgets/injection/catalog-inventory-profile/widget.js.map +7 -0
- package/dist/modules/wms/widgets/injection/order-items-stock-column/widget.js +104 -0
- package/dist/modules/wms/widgets/injection/order-items-stock-column/widget.js.map +7 -0
- package/dist/modules/wms/widgets/injection/sales-order-stock-context/widget.client.js +389 -0
- package/dist/modules/wms/widgets/injection/sales-order-stock-context/widget.client.js.map +7 -0
- package/dist/modules/wms/widgets/injection/sales-order-stock-context/widget.js +16 -0
- package/dist/modules/wms/widgets/injection/sales-order-stock-context/widget.js.map +7 -0
- package/dist/modules/wms/widgets/injection-table.js +36 -0
- package/dist/modules/wms/widgets/injection-table.js.map +7 -0
- package/dist/modules/wms/widgets/notifications/WmsLowStockRenderer.js +150 -0
- package/dist/modules/wms/widgets/notifications/WmsLowStockRenderer.js.map +7 -0
- package/dist/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.js +186 -0
- package/dist/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.js.map +7 -0
- package/dist/modules/wms/widgets/notifications/index.js +7 -0
- package/dist/modules/wms/widgets/notifications/index.js.map +7 -0
- package/generated/entities/inventory_balance/index.ts +9 -0
- package/generated/entities/inventory_lot/index.ts +8 -0
- package/generated/entities/inventory_movement/index.ts +16 -0
- package/generated/entities/inventory_reservation/index.ts +10 -0
- package/generated/entities/product_inventory_profile/index.ts +9 -0
- package/generated/entities/sales_order_warehouse_assignment/index.ts +4 -0
- package/generated/entities/warehouse/index.ts +11 -0
- package/generated/entities/warehouse_location/index.ts +9 -0
- package/generated/entities/warehouse_zone/index.ts +4 -0
- package/generated/entities.ids.generated.ts +12 -0
- package/generated/entity-fields-registry.ts +98 -0
- package/package.json +7 -7
- package/src/modules/auth/backend/roles/page.tsx +13 -4
- package/src/modules/auth/i18n/de.json +2 -0
- package/src/modules/auth/i18n/en.json +2 -0
- package/src/modules/auth/i18n/es.json +2 -0
- package/src/modules/auth/i18n/pl.json +2 -0
- package/src/modules/auth/lib/backendChrome.tsx +1 -0
- package/src/modules/auth/services/rbacService.ts +25 -21
- package/src/modules/catalog/api/products/route.ts +3 -0
- package/src/modules/catalog/api/variants/route.ts +3 -0
- package/src/modules/query_index/lib/engine.ts +18 -6
- package/src/modules/sales/api/documents/factory.ts +1 -0
- package/src/modules/sales/commands/documents.ts +71 -0
- package/src/modules/sales/components/documents/ItemsSection.tsx +58 -0
- package/src/modules/sales/events.ts +2 -0
- package/src/modules/sales/widgets/injection/order-items-context.ts +15 -0
- package/src/modules/wms/acl.ts +14 -0
- package/src/modules/wms/analytics.ts +9 -0
- package/src/modules/wms/api/dashboard/operational/route.ts +83 -0
- package/src/modules/wms/api/interceptors.ts +108 -0
- package/src/modules/wms/api/inventory/adjust/route.ts +50 -0
- package/src/modules/wms/api/inventory/allocate/route.ts +50 -0
- package/src/modules/wms/api/inventory/balances/route.ts +178 -0
- package/src/modules/wms/api/inventory/cycle-count/route.ts +51 -0
- package/src/modules/wms/api/inventory/helpers.ts +128 -0
- package/src/modules/wms/api/inventory/import/apply/route.ts +47 -0
- package/src/modules/wms/api/inventory/import/helpers.ts +223 -0
- package/src/modules/wms/api/inventory/import/template/route.ts +31 -0
- package/src/modules/wms/api/inventory/import/validate/route.ts +56 -0
- package/src/modules/wms/api/inventory/move/route.ts +50 -0
- package/src/modules/wms/api/inventory/movements/route.ts +164 -0
- package/src/modules/wms/api/inventory/receive/route.ts +49 -0
- package/src/modules/wms/api/inventory/release/route.ts +43 -0
- package/src/modules/wms/api/inventory/reservations/route.ts +128 -0
- package/src/modules/wms/api/inventory/reserve/route.ts +59 -0
- package/src/modules/wms/api/inventory-profiles/route.ts +177 -0
- package/src/modules/wms/api/listEnrichers.ts +312 -0
- package/src/modules/wms/api/listSearch.ts +121 -0
- package/src/modules/wms/api/locations/route.ts +171 -0
- package/src/modules/wms/api/lots/route.ts +205 -0
- package/src/modules/wms/api/openapi.ts +28 -0
- package/src/modules/wms/api/sales-orders/[salesOrderId]/re-run-reservation/route.ts +58 -0
- package/src/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.ts +306 -0
- package/src/modules/wms/api/sales-orders/assign-warehouse/route.ts +57 -0
- package/src/modules/wms/api/sales-orders/unassign-warehouse/route.ts +43 -0
- package/src/modules/wms/api/warehouses/route.ts +181 -0
- package/src/modules/wms/api/zones/route.ts +158 -0
- package/src/modules/wms/backend/config/wms/page.meta.ts +14 -0
- package/src/modules/wms/backend/config/wms/page.tsx +5 -0
- package/src/modules/wms/backend/page.meta.ts +12 -0
- package/src/modules/wms/backend/page.tsx +5 -0
- package/src/modules/wms/backend/wms/inventory/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/inventory/page.tsx +5 -0
- package/src/modules/wms/backend/wms/location/[id]/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/location/[id]/page.tsx +5 -0
- package/src/modules/wms/backend/wms/locations/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/locations/page.tsx +12 -0
- package/src/modules/wms/backend/wms/lot/[id]/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/lot/[id]/page.tsx +5 -0
- package/src/modules/wms/backend/wms/lots/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/lots/page.tsx +5 -0
- package/src/modules/wms/backend/wms/movements/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/movements/page.tsx +23 -0
- package/src/modules/wms/backend/wms/reservations/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/reservations/page.tsx +24 -0
- package/src/modules/wms/backend/wms/sku/[id]/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/sku/[id]/page.tsx +5 -0
- package/src/modules/wms/backend/wms/warehouses/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/warehouses/page.tsx +12 -0
- package/src/modules/wms/backend/wms/zones/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/zones/page.tsx +12 -0
- package/src/modules/wms/ce.ts +76 -0
- package/src/modules/wms/cli.ts +96 -0
- package/src/modules/wms/commands/configuration.ts +1844 -0
- package/src/modules/wms/commands/index.ts +3 -0
- package/src/modules/wms/commands/inventory-actions.ts +1866 -0
- package/src/modules/wms/commands/sales-order-assignment.ts +346 -0
- package/src/modules/wms/commands/shared.ts +90 -0
- package/src/modules/wms/components/backend/AdjustInventoryDialog.tsx +820 -0
- package/src/modules/wms/components/backend/ChangeLotStatusDialog.tsx +312 -0
- package/src/modules/wms/components/backend/CycleCountWizardDialog.tsx +2007 -0
- package/src/modules/wms/components/backend/ImportInventoryDialog.tsx +1018 -0
- package/src/modules/wms/components/backend/InventoryOperationsSection.tsx +159 -0
- package/src/modules/wms/components/backend/LocationEditDialog.tsx +185 -0
- package/src/modules/wms/components/backend/MoveInventoryDialog.tsx +907 -0
- package/src/modules/wms/components/backend/ReceiveInventoryDialog.tsx +695 -0
- package/src/modules/wms/components/backend/ReleaseReservationDialog.tsx +424 -0
- package/src/modules/wms/components/backend/ReserveInventoryDialog.tsx +511 -0
- package/src/modules/wms/components/backend/WmsConfigurationPage.tsx +1340 -0
- package/src/modules/wms/components/backend/WmsInventoryConsolePage.tsx +1132 -0
- package/src/modules/wms/components/backend/WmsLocationDetailPage.tsx +1310 -0
- package/src/modules/wms/components/backend/WmsLotDetailPage.tsx +1355 -0
- package/src/modules/wms/components/backend/WmsLotsListPage.tsx +359 -0
- package/src/modules/wms/components/backend/WmsOperationalDashboardPage.tsx +958 -0
- package/src/modules/wms/components/backend/WmsSkuDetailPage.tsx +1245 -0
- package/src/modules/wms/components/backend/inventoryMutationLoaders.ts +960 -0
- package/src/modules/wms/components/backend/useWmsInventoryMutationAccess.ts +89 -0
- package/src/modules/wms/components/backend/useWmsInventoryScopeFromSearchParams.ts +32 -0
- package/src/modules/wms/components/backend/wmsLookupLoaders.ts +78 -0
- package/src/modules/wms/data/enrichers.ts +718 -0
- package/src/modules/wms/data/entities.ts +436 -0
- package/src/modules/wms/data/validators.ts +463 -0
- package/src/modules/wms/di.ts +25 -0
- package/src/modules/wms/events.ts +41 -0
- package/src/modules/wms/i18n/de.json +1051 -0
- package/src/modules/wms/i18n/en.json +1051 -0
- package/src/modules/wms/i18n/es.json +1051 -0
- package/src/modules/wms/i18n/pl.json +1051 -0
- package/src/modules/wms/index.ts +15 -0
- package/src/modules/wms/lib/catalogInventoryProfileIntent.ts +65 -0
- package/src/modules/wms/lib/catalogInventoryProfileSync.ts +199 -0
- package/src/modules/wms/lib/expiry.ts +30 -0
- package/src/modules/wms/lib/flashMutationError.ts +74 -0
- package/src/modules/wms/lib/inventoryDisplayUi.ts +249 -0
- package/src/modules/wms/lib/inventoryIdempotency.ts +54 -0
- package/src/modules/wms/lib/inventoryImportCsv.ts +212 -0
- package/src/modules/wms/lib/inventoryImportService.ts +629 -0
- package/src/modules/wms/lib/inventoryMutationUi.ts +21 -0
- package/src/modules/wms/lib/inventoryPolicy.ts +111 -0
- package/src/modules/wms/lib/inventoryReconciliation.ts +263 -0
- package/src/modules/wms/lib/inventoryTrackingValidation.ts +23 -0
- package/src/modules/wms/lib/loadOperationalDashboard.ts +776 -0
- package/src/modules/wms/lib/lowStockBalanceFilter.ts +74 -0
- package/src/modules/wms/lib/primaryWarehousePolicy.ts +46 -0
- package/src/modules/wms/lib/roleFeatures.ts +32 -0
- package/src/modules/wms/lib/salesOrderInventoryAutomation.ts +390 -0
- package/src/modules/wms/lib/salesOrderWarehouseAssignment.ts +78 -0
- package/src/modules/wms/lib/wmsIntegrationToggles.ts +81 -0
- package/src/modules/wms/migrations/.snapshot-open-mercato.json +2880 -0
- package/src/modules/wms/migrations/Migration20260428110546.ts +91 -0
- package/src/modules/wms/migrations/Migration20260527120000.ts +15 -0
- package/src/modules/wms/migrations/Migration20260527140000.ts +35 -0
- package/src/modules/wms/migrations/Migration20260613120000.ts +21 -0
- package/src/modules/wms/migrations/Migration20260616090000.ts +11 -0
- package/src/modules/wms/migrations/Migration20260707180000.ts +13 -0
- package/src/modules/wms/notifications.client.ts +18 -0
- package/src/modules/wms/notifications.ts +51 -0
- package/src/modules/wms/search.ts +230 -0
- package/src/modules/wms/setup.ts +29 -0
- package/src/modules/wms/subscribers/low-stock-notification.ts +54 -0
- package/src/modules/wms/subscribers/reservation-shortfall-notification.ts +98 -0
- package/src/modules/wms/subscribers/sales-order-cancelled-release.ts +21 -0
- package/src/modules/wms/subscribers/sales-order-confirmed-reserve.ts +21 -0
- package/src/modules/wms/translations.ts +6 -0
- package/src/modules/wms/vector.ts +7 -0
- package/src/modules/wms/widgets/injection/catalog-inventory-profile/widget.ts +238 -0
- package/src/modules/wms/widgets/injection/order-items-stock-column/widget.tsx +153 -0
- package/src/modules/wms/widgets/injection/sales-order-stock-context/widget.client.tsx +476 -0
- package/src/modules/wms/widgets/injection/sales-order-stock-context/widget.ts +15 -0
- package/src/modules/wms/widgets/injection-table.ts +34 -0
- package/src/modules/wms/widgets/notifications/WmsLowStockRenderer.tsx +153 -0
- package/src/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.tsx +194 -0
- package/src/modules/wms/widgets/notifications/index.ts +2 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/wms/commands/configuration.ts"],
|
|
4
|
+
"sourcesContent": ["// =============================================================================\n// WMS Configuration Commands \u2014 Undo Policy\n// =============================================================================\n//\n// All warehouse / zone / location / inventory-profile / lot CRUD commands in\n// this file follow the standard Open Mercato undoable pattern: each handler\n// declares `prepare` (snapshot before), `captureAfter` (snapshot after) and\n// `undo` (restore from snapshot) so the generic command-bus undo flow works\n// out of the box, mirroring `catalog/commands/categories.ts`.\n//\n// Undo semantics per kind:\n// - create \u2014 undo soft-deletes the created record (`deletedAt = now`).\n// - update \u2014 undo restores all scalar/FK fields from the `before` snapshot;\n// re-creates the record with the original id if it was hard-deleted.\n// - delete \u2014 undo clears `deletedAt` and restores all fields from snapshot.\n//\n// Notes for downstream consistency:\n// - Inventory balances / reservations / movements reference these records\n// by FK. Undo does NOT replay those ledger rows; if a warehouse / zone /\n// location was deleted while ledger rows still pointed at it, undoing the\n// delete simply makes those references resolvable again. Live ledger state\n// itself is not rewound \u2014 that is the responsibility of the inventory\n// mutation commands' counter-actions documented in `inventory-actions.ts`.\n// - Cascading children (zones inside a warehouse, child locations inside a\n// parent location) are NOT auto-undone; each affected record needs its own\n// undo entry. The audit log preserves enough data per-entity for that.\n// - Primary reassignment demotes sibling warehouses via `nativeUpdate`. Create\n// and update undo payloads capture `demotedPrimariesBefore` so undo restores\n// the previous primary flag on affected siblings.\n// =============================================================================\nimport type { CommandHandler } from '@open-mercato/shared/lib/commands'\nimport { registerCommand } from '@open-mercato/shared/lib/commands'\nimport type { CommandRuntimeContext } from '@open-mercato/shared/lib/commands'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { withAtomicFlush } from '@open-mercato/shared/lib/commands/flush'\nimport { CrudHttpError, isUniqueViolation } from '@open-mercato/shared/lib/crud/errors'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\nimport { findOneWithDecryption, findWithDecryption } from '@open-mercato/shared/lib/encryption/find'\nimport { extractUndoPayload } from '@open-mercato/shared/lib/commands/undo'\nimport type { JsonValue } from '@open-mercato/shared/lib/json'\nimport {\n InventoryLot,\n type InventoryLotStatus,\n ProductInventoryProfile,\n type InventoryStrategy,\n Warehouse,\n WarehouseLocation,\n type WarehouseLocationType,\n WarehouseZone,\n} from '../data/entities'\nimport {\n inventoryLotCreateSchema,\n inventoryLotUpdateSchema,\n productInventoryProfileCreateSchema,\n productInventoryProfileUpdateSchema,\n warehouseCreateSchema,\n warehouseLocationCreateSchema,\n warehouseLocationUpdateSchema,\n warehouseUpdateSchema,\n warehouseZoneCreateSchema,\n warehouseZoneUpdateSchema,\n type InventoryLotCreateInput,\n type InventoryLotUpdateInput,\n type ProductInventoryProfileCreateInput,\n type ProductInventoryProfileUpdateInput,\n type WarehouseCreateInput,\n type WarehouseLocationCreateInput,\n type WarehouseLocationUpdateInput,\n type WarehouseUpdateInput,\n type WarehouseZoneCreateInput,\n type WarehouseZoneUpdateInput,\n} from '../data/validators'\nimport {\n ensureOrganizationScope,\n ensureTenantScope,\n normalizeOptionalString,\n requireId,\n toNumericString,\n} from './shared'\nimport { emitWmsEvent } from '../events'\n\nfunction resolveScope(ctx: CommandRuntimeContext, fallback?: { tenantId?: string | null; organizationId?: string | null }) {\n return {\n tenantId: fallback?.tenantId ?? ctx.auth?.tenantId ?? null,\n organizationId: fallback?.organizationId ?? ctx.selectedOrganizationId ?? ctx.auth?.orgId ?? null,\n }\n}\n\nfunction resolveEm(ctx: CommandRuntimeContext): EntityManager {\n return (ctx.container.resolve('em') as EntityManager).fork()\n}\n\nfunction toJsonValue(value: Record<string, unknown> | null | undefined): JsonValue | null | undefined {\n if (value === undefined) return undefined\n return (value ?? null) as JsonValue | null\n}\n\nasync function buildCrudLog(\n ctx: CommandRuntimeContext,\n input: { tenantId?: string | null; organizationId?: string | null; id?: string | null } | undefined,\n resultId: string | null,\n actionKey: string,\n fallbackLabel: string,\n resourceKind: string,\n) {\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate(actionKey, fallbackLabel),\n resourceKind,\n resourceId: resultId ?? input?.id ?? null,\n tenantId: input?.tenantId ?? ctx.auth?.tenantId ?? null,\n organizationId: input?.organizationId ?? ctx.selectedOrganizationId ?? ctx.auth?.orgId ?? null,\n }\n}\n\nasync function loadWarehouse(em: EntityManager, ctx: CommandRuntimeContext, id: string) {\n const warehouse = await findOneWithDecryption(em, Warehouse, { id, deletedAt: null }, undefined, resolveScope(ctx))\n if (!warehouse) throw new CrudHttpError(404, { error: 'Warehouse not found.' })\n ensureTenantScope(ctx, warehouse.tenantId)\n ensureOrganizationScope(ctx, warehouse.organizationId)\n return warehouse\n}\n\nasync function loadZone(em: EntityManager, ctx: CommandRuntimeContext, id: string) {\n const zone = await findOneWithDecryption(em, WarehouseZone, { id, deletedAt: null }, undefined, resolveScope(ctx))\n if (!zone) throw new CrudHttpError(404, { error: 'Warehouse zone not found.' })\n ensureTenantScope(ctx, zone.tenantId)\n ensureOrganizationScope(ctx, zone.organizationId)\n return zone\n}\n\nasync function loadLocation(em: EntityManager, ctx: CommandRuntimeContext, id: string) {\n const location = await findOneWithDecryption(em, WarehouseLocation, { id, deletedAt: null }, undefined, resolveScope(ctx))\n if (!location) throw new CrudHttpError(404, { error: 'Warehouse location not found.' })\n ensureTenantScope(ctx, location.tenantId)\n ensureOrganizationScope(ctx, location.organizationId)\n return location\n}\n\nasync function loadProfile(em: EntityManager, ctx: CommandRuntimeContext, id: string) {\n const profile = await findOneWithDecryption(em, ProductInventoryProfile, { id, deletedAt: null }, undefined, resolveScope(ctx))\n if (!profile) throw new CrudHttpError(404, { error: 'Inventory profile not found.' })\n ensureTenantScope(ctx, profile.tenantId)\n ensureOrganizationScope(ctx, profile.organizationId)\n return profile\n}\n\nasync function loadLot(em: EntityManager, ctx: CommandRuntimeContext, id: string) {\n const lot = await findOneWithDecryption(em, InventoryLot, { id, deletedAt: null }, undefined, resolveScope(ctx))\n if (!lot) throw new CrudHttpError(404, { error: 'Inventory lot not found.' })\n ensureTenantScope(ctx, lot.tenantId)\n ensureOrganizationScope(ctx, lot.organizationId)\n return lot\n}\n\n// ---------------------------------------------------------------------------\n// Snapshot types \u2014 used by `prepare` / `captureAfter` / `undo` to round-trip\n// the full record through the audit log payload.\n// ---------------------------------------------------------------------------\n\ntype WarehouseSnapshot = {\n id: string\n organizationId: string\n tenantId: string\n name: string\n code: string\n isActive: boolean\n isPrimary: boolean\n addressLine1: string | null\n city: string | null\n postalCode: string | null\n country: string | null\n timezone: string | null\n metadata: JsonValue | null\n createdAt: string\n updatedAt: string\n}\n\ntype PrimaryDemotionSnapshot = {\n id: string\n isPrimary: boolean\n}\n\ntype WarehouseUndoPayload = {\n before?: WarehouseSnapshot | null\n after?: WarehouseSnapshot | null\n demotedPrimariesBefore?: PrimaryDemotionSnapshot[]\n}\n\ntype WarehouseZoneSnapshot = {\n id: string\n organizationId: string\n tenantId: string\n warehouseId: string\n code: string\n name: string\n priority: number\n metadata: JsonValue | null\n createdAt: string\n updatedAt: string\n}\n\ntype WarehouseZoneUndoPayload = { before?: WarehouseZoneSnapshot | null; after?: WarehouseZoneSnapshot | null }\n\ntype WarehouseLocationSnapshot = {\n id: string\n organizationId: string\n tenantId: string\n warehouseId: string\n parentId: string | null\n code: string\n type: WarehouseLocationType\n isActive: boolean\n capacityUnits: string | null\n capacityWeight: string | null\n constraints: JsonValue | null\n metadata: JsonValue | null\n createdAt: string\n updatedAt: string\n}\n\ntype WarehouseLocationUndoPayload = {\n before?: WarehouseLocationSnapshot | null\n after?: WarehouseLocationSnapshot | null\n}\n\ntype ProductInventoryProfileSnapshot = {\n id: string\n organizationId: string\n tenantId: string\n catalogProductId: string\n catalogVariantId: string | null\n defaultUom: string\n trackLot: boolean\n trackSerial: boolean\n trackExpiration: boolean\n defaultStrategy: InventoryStrategy\n reorderPoint: string\n safetyStock: string\n metadata: JsonValue | null\n createdAt: string\n updatedAt: string\n}\n\ntype ProductInventoryProfileUndoPayload = {\n before?: ProductInventoryProfileSnapshot | null\n after?: ProductInventoryProfileSnapshot | null\n}\n\ntype InventoryLotSnapshot = {\n id: string\n organizationId: string\n tenantId: string\n catalogVariantId: string\n sku: string\n lotNumber: string\n batchNumber: string | null\n manufacturedAt: string | null\n bestBeforeAt: string | null\n expiresAt: string | null\n status: InventoryLotStatus\n metadata: JsonValue | null\n createdAt: string\n updatedAt: string\n}\n\ntype InventoryLotUndoPayload = { before?: InventoryLotSnapshot | null; after?: InventoryLotSnapshot | null }\n\nfunction isoOrNull(value: Date | string | null | undefined): string | null {\n if (!value) return null\n if (value instanceof Date) return value.toISOString()\n if (typeof value === 'string') return value\n return null\n}\n\nfunction dateOrNull(value: string | Date | null | undefined): Date | null {\n if (!value) return null\n if (value instanceof Date) return value\n if (typeof value === 'string') return new Date(value)\n return null\n}\n\nfunction snapshotWarehouse(record: Warehouse): WarehouseSnapshot {\n return {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n name: record.name,\n code: record.code,\n isActive: !!record.isActive,\n isPrimary: !!record.isPrimary,\n addressLine1: record.addressLine1 ?? null,\n city: record.city ?? null,\n postalCode: record.postalCode ?? null,\n country: record.country ?? null,\n timezone: record.timezone ?? null,\n metadata: (record.metadata ?? null) as JsonValue | null,\n createdAt: record.createdAt.toISOString(),\n updatedAt: record.updatedAt.toISOString(),\n }\n}\n\nasync function loadWarehouseSnapshot(\n em: EntityManager,\n ctx: CommandRuntimeContext,\n id: string,\n): Promise<WarehouseSnapshot | null> {\n const record = await findOneWithDecryption(em, Warehouse, { id }, undefined, resolveScope(ctx))\n return record ? snapshotWarehouse(record) : null\n}\n\nfunction snapshotWarehouseZone(record: WarehouseZone): WarehouseZoneSnapshot {\n const warehouseId = typeof record.warehouse === 'string' ? record.warehouse : record.warehouse.id\n return {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n warehouseId,\n code: record.code,\n name: record.name,\n priority: record.priority ?? 0,\n metadata: (record.metadata ?? null) as JsonValue | null,\n createdAt: record.createdAt.toISOString(),\n updatedAt: record.updatedAt.toISOString(),\n }\n}\n\nasync function loadWarehouseZoneSnapshot(\n em: EntityManager,\n ctx: CommandRuntimeContext,\n id: string,\n): Promise<WarehouseZoneSnapshot | null> {\n const record = await findOneWithDecryption(em, WarehouseZone, { id }, undefined, resolveScope(ctx))\n return record ? snapshotWarehouseZone(record) : null\n}\n\nfunction snapshotWarehouseLocation(record: WarehouseLocation): WarehouseLocationSnapshot {\n const warehouseId = typeof record.warehouse === 'string' ? record.warehouse : record.warehouse.id\n let parentId: string | null = null\n if (record.parent) {\n parentId = typeof record.parent === 'string' ? record.parent : record.parent.id\n }\n return {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n warehouseId,\n parentId,\n code: record.code,\n type: record.type,\n isActive: !!record.isActive,\n capacityUnits: record.capacityUnits ?? null,\n capacityWeight: record.capacityWeight ?? null,\n constraints: (record.constraints ?? null) as JsonValue | null,\n metadata: (record.metadata ?? null) as JsonValue | null,\n createdAt: record.createdAt.toISOString(),\n updatedAt: record.updatedAt.toISOString(),\n }\n}\n\nasync function loadWarehouseLocationSnapshot(\n em: EntityManager,\n ctx: CommandRuntimeContext,\n id: string,\n): Promise<WarehouseLocationSnapshot | null> {\n const record = await findOneWithDecryption(em, WarehouseLocation, { id }, undefined, resolveScope(ctx))\n return record ? snapshotWarehouseLocation(record) : null\n}\n\nfunction snapshotInventoryProfile(record: ProductInventoryProfile): ProductInventoryProfileSnapshot {\n return {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n catalogProductId: record.catalogProductId,\n catalogVariantId: record.catalogVariantId ?? null,\n defaultUom: record.defaultUom,\n trackLot: !!record.trackLot,\n trackSerial: !!record.trackSerial,\n trackExpiration: !!record.trackExpiration,\n defaultStrategy: record.defaultStrategy,\n reorderPoint: record.reorderPoint,\n safetyStock: record.safetyStock,\n metadata: (record.metadata ?? null) as JsonValue | null,\n createdAt: record.createdAt.toISOString(),\n updatedAt: record.updatedAt.toISOString(),\n }\n}\n\nasync function loadInventoryProfileSnapshot(\n em: EntityManager,\n ctx: CommandRuntimeContext,\n id: string,\n): Promise<ProductInventoryProfileSnapshot | null> {\n const record = await findOneWithDecryption(em, ProductInventoryProfile, { id }, undefined, resolveScope(ctx))\n return record ? snapshotInventoryProfile(record) : null\n}\n\nfunction snapshotInventoryLot(record: InventoryLot): InventoryLotSnapshot {\n return {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n catalogVariantId: record.catalogVariantId,\n sku: record.sku,\n lotNumber: record.lotNumber,\n batchNumber: record.batchNumber ?? null,\n manufacturedAt: isoOrNull(record.manufacturedAt ?? null),\n bestBeforeAt: isoOrNull(record.bestBeforeAt ?? null),\n expiresAt: isoOrNull(record.expiresAt ?? null),\n status: record.status,\n metadata: (record.metadata ?? null) as JsonValue | null,\n createdAt: record.createdAt.toISOString(),\n updatedAt: record.updatedAt.toISOString(),\n }\n}\n\nasync function loadInventoryLotSnapshot(\n em: EntityManager,\n ctx: CommandRuntimeContext,\n id: string,\n): Promise<InventoryLotSnapshot | null> {\n const record = await findOneWithDecryption(em, InventoryLot, { id }, undefined, resolveScope(ctx))\n return record ? snapshotInventoryLot(record) : null\n}\n\nasync function ensureWarehouseCodeUnique(\n em: EntityManager,\n tenantId: string,\n organizationId: string,\n code: string,\n excludeId?: string,\n) {\n const existing = await findOneWithDecryption(\n em,\n Warehouse,\n { tenantId, organizationId, code, deletedAt: null },\n undefined,\n { tenantId, organizationId }\n )\n if (existing && existing.id !== excludeId) {\n throw new CrudHttpError(409, { error: 'Warehouse code already exists in this organization.' })\n }\n}\n\nasync function loadDemotedPrimarySnapshots(\n em: EntityManager,\n organizationId: string,\n tenantId: string,\n warehouseId: string,\n): Promise<PrimaryDemotionSnapshot[]> {\n const siblings = await findWithDecryption(\n em,\n Warehouse,\n {\n organizationId,\n id: { $ne: warehouseId },\n isPrimary: true,\n deletedAt: null,\n },\n undefined,\n { tenantId, organizationId },\n )\n return siblings.map((record) => ({ id: record.id, isPrimary: true }))\n}\n\nasync function enforcePrimaryWarehouse(\n em: EntityManager,\n organizationId: string,\n tenantId: string,\n warehouseId: string,\n): Promise<PrimaryDemotionSnapshot[]> {\n const demotedPrimariesBefore = await loadDemotedPrimarySnapshots(em, organizationId, tenantId, warehouseId)\n if (demotedPrimariesBefore.length === 0) return []\n await em.nativeUpdate(\n Warehouse,\n {\n organizationId,\n id: { $ne: warehouseId },\n isPrimary: true,\n deletedAt: null,\n },\n { isPrimary: false },\n )\n return demotedPrimariesBefore\n}\n\nasync function rejectInactivePrimaryWarehouse(ctx: CommandRuntimeContext): Promise<never> {\n const { translate } = await resolveTranslations()\n const message = translate(\n 'wms.validation.warehouse.inactivePrimary',\n 'Inactive warehouses cannot be marked as primary.',\n )\n throw new CrudHttpError(422, { error: message, fieldErrors: { isPrimary: message } })\n}\n\nconst WMS_WAREHOUSE_PRIMARY_UNIQUE_CONSTRAINT = 'wms_warehouses_org_primary_unique_idx'\n\n/**\n * Defense in depth: a concurrent request can still win the race against the\n * `wms_warehouses_org_primary_unique_idx` partial unique index between this\n * request's demotion step and its own promote-to-primary flush. Translate\n * that residual DB-level conflict into an actionable 409 instead of letting a\n * raw Postgres unique-violation surface as a generic 500 (#4096).\n */\nasync function rejectPrimaryWarehouseConflict(): Promise<never> {\n const { translate } = await resolveTranslations()\n const message = translate(\n 'wms.validation.warehouse.primaryConflict',\n 'Another warehouse was just set as primary for this organization. Please retry.',\n )\n throw new CrudHttpError(409, { error: message, fieldErrors: { isPrimary: message } })\n}\n\nasync function restoreDemotedPrimaryWarehouses(\n em: EntityManager,\n ctx: CommandRuntimeContext,\n demotedPrimariesBefore: PrimaryDemotionSnapshot[] | undefined | null,\n): Promise<void> {\n if (!demotedPrimariesBefore?.length) return\n for (const snapshot of demotedPrimariesBefore) {\n const record = await findOneWithDecryption(em, Warehouse, { id: snapshot.id }, undefined, resolveScope(ctx))\n if (!record) continue\n ensureTenantScope(ctx, record.tenantId)\n ensureOrganizationScope(ctx, record.organizationId)\n record.isPrimary = snapshot.isPrimary\n }\n}\n\nasync function ensureZoneCodeUnique(\n em: EntityManager,\n warehouseId: string,\n tenantId: string,\n organizationId: string,\n code: string,\n excludeId?: string,\n) {\n const existing = await findOneWithDecryption(\n em,\n WarehouseZone,\n { warehouse: warehouseId, tenantId, organizationId, code, deletedAt: null },\n undefined,\n { tenantId, organizationId }\n )\n if (existing && existing.id !== excludeId) {\n throw new CrudHttpError(409, { error: 'Zone code already exists in this warehouse.' })\n }\n}\n\nasync function ensureLocationCodeUnique(\n em: EntityManager,\n warehouseId: string,\n tenantId: string,\n organizationId: string,\n code: string,\n excludeId?: string,\n) {\n const existing = await findOneWithDecryption(\n em,\n WarehouseLocation,\n { warehouse: warehouseId, tenantId, organizationId, code, deletedAt: null },\n undefined,\n { tenantId, organizationId }\n )\n if (existing && existing.id !== excludeId) {\n throw new CrudHttpError(409, { error: 'Location code already exists in this warehouse.' })\n }\n}\n\nasync function ensureProfileUniqueness(\n em: EntityManager,\n input: {\n tenantId: string\n organizationId: string\n catalogProductId: string\n catalogVariantId?: string | null\n },\n excludeId?: string,\n) {\n const where = input.catalogVariantId\n ? {\n tenantId: input.tenantId,\n organizationId: input.organizationId,\n catalogVariantId: input.catalogVariantId,\n deletedAt: null,\n }\n : {\n tenantId: input.tenantId,\n organizationId: input.organizationId,\n catalogProductId: input.catalogProductId,\n catalogVariantId: null,\n deletedAt: null,\n }\n const existing = await findOneWithDecryption(\n em,\n ProductInventoryProfile,\n where,\n undefined,\n { tenantId: input.tenantId, organizationId: input.organizationId }\n )\n if (existing && existing.id !== excludeId) {\n throw new CrudHttpError(409, { error: 'Inventory profile already exists for this product scope.' })\n }\n}\n\nasync function ensureLotUniqueness(\n em: EntityManager,\n input: { tenantId: string; organizationId: string; catalogVariantId: string; lotNumber: string },\n excludeId?: string,\n) {\n const existing = await findOneWithDecryption(\n em,\n InventoryLot,\n {\n tenantId: input.tenantId,\n organizationId: input.organizationId,\n catalogVariantId: input.catalogVariantId,\n lotNumber: input.lotNumber,\n deletedAt: null,\n },\n undefined,\n { tenantId: input.tenantId, organizationId: input.organizationId }\n )\n if (existing && existing.id !== excludeId) {\n throw new CrudHttpError(409, { error: 'Lot number already exists for this variant.' })\n }\n}\n\nasync function resolveParentLocation(\n em: EntityManager,\n ctx: CommandRuntimeContext,\n warehouseId: string,\n parentId: string | null | undefined,\n) {\n if (!parentId) return null\n const parent = await loadLocation(em, ctx, parentId)\n const parentWarehouseId = typeof parent.warehouse === 'string' ? parent.warehouse : parent.warehouse.id\n if (parentWarehouseId !== warehouseId) {\n throw new CrudHttpError(422, { error: 'Parent location must belong to the same warehouse.' })\n }\n return parent\n}\n\nconst createWarehouseCommand: CommandHandler<\n WarehouseCreateInput,\n { warehouseId: string; demotedPrimariesBefore?: PrimaryDemotionSnapshot[] }\n> = {\n id: 'wms.warehouses.create',\n async execute(rawInput, ctx) {\n const parsed = warehouseCreateSchema.parse(rawInput ?? {})\n ensureTenantScope(ctx, parsed.tenantId)\n ensureOrganizationScope(ctx, parsed.organizationId)\n const em = resolveEm(ctx)\n await ensureWarehouseCodeUnique(em, parsed.tenantId, parsed.organizationId, parsed.code)\n const isActive = parsed.isActive ?? true\n const isPrimary = parsed.isPrimary ?? false\n if (isPrimary && !isActive) {\n await rejectInactivePrimaryWarehouse(ctx)\n }\n const warehouse = em.create(Warehouse, {\n organizationId: parsed.organizationId,\n tenantId: parsed.tenantId,\n name: parsed.name,\n code: parsed.code,\n isActive,\n // Always insert as non-primary first: inserting with isPrimary=true would\n // race the `wms_warehouses_org_primary_unique_idx` partial unique index\n // against an existing sibling primary before that sibling gets demoted\n // below (Postgres checks partial unique indexes per-statement, not at\n // commit time).\n isPrimary: false,\n addressLine1: normalizeOptionalString(parsed.addressLine1),\n city: normalizeOptionalString(parsed.city),\n postalCode: normalizeOptionalString(parsed.postalCode),\n country: normalizeOptionalString(parsed.country),\n timezone: normalizeOptionalString(parsed.timezone),\n metadata: toJsonValue(parsed.metadata),\n })\n let demotedPrimariesBefore: PrimaryDemotionSnapshot[] = []\n try {\n await withAtomicFlush(\n em,\n [\n () => {\n em.persist(warehouse)\n },\n async () => {\n if (!isPrimary) return\n demotedPrimariesBefore = await enforcePrimaryWarehouse(\n em,\n warehouse.organizationId,\n warehouse.tenantId,\n warehouse.id,\n )\n },\n () => {\n if (isPrimary) warehouse.isPrimary = true\n },\n ],\n { transaction: true, label: 'wms.warehouses.create' },\n )\n } catch (err) {\n if (isUniqueViolation(err, WMS_WAREHOUSE_PRIMARY_UNIQUE_CONSTRAINT)) {\n await rejectPrimaryWarehouseConflict()\n }\n throw err\n }\n void emitWmsEvent('wms.warehouse.created', {\n id: warehouse.id,\n warehouseId: warehouse.id,\n tenantId: warehouse.tenantId,\n organizationId: warehouse.organizationId,\n }).catch(() => undefined)\n return {\n warehouseId: warehouse.id,\n ...(demotedPrimariesBefore.length > 0 ? { demotedPrimariesBefore } : {}),\n }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = resolveEm(ctx)\n return loadWarehouseSnapshot(em, ctx, result.warehouseId)\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.warehouseId ?? null, 'wms.audit.warehouse.create', 'Create warehouse', 'wms.warehouse')\n const after = snapshots?.after as WarehouseSnapshot | undefined\n const demotedPrimariesBefore = result?.demotedPrimariesBefore\n return {\n ...base,\n snapshotAfter: after,\n payload: {\n undo: {\n after,\n ...(demotedPrimariesBefore?.length ? { demotedPrimariesBefore } : {}),\n } satisfies WarehouseUndoPayload,\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<WarehouseUndoPayload>(logEntry)\n const after = payload?.after\n if (!after) return\n const em = resolveEm(ctx)\n const record = await findOneWithDecryption(\n em,\n Warehouse,\n { id: after.id },\n undefined,\n resolveScope(ctx, { tenantId: after.tenantId, organizationId: after.organizationId }),\n )\n if (!record) return\n ensureTenantScope(ctx, record.tenantId)\n ensureOrganizationScope(ctx, record.organizationId)\n record.deletedAt = new Date()\n await em.flush()\n if (payload.demotedPrimariesBefore?.length) {\n await restoreDemotedPrimaryWarehouses(em, ctx, payload.demotedPrimariesBefore)\n await em.flush()\n }\n },\n}\n\nconst updateWarehouseCommand: CommandHandler<\n WarehouseUpdateInput,\n { warehouseId: string; demotedPrimariesBefore?: PrimaryDemotionSnapshot[] }\n> = {\n id: 'wms.warehouses.update',\n prepare: async (input, ctx) => {\n const id = requireId(input?.id, 'Warehouse')\n const em = resolveEm(ctx)\n const before = await loadWarehouseSnapshot(em, ctx, id)\n return before ? { before } : {}\n },\n async execute(rawInput, ctx) {\n const parsed = warehouseUpdateSchema.parse(rawInput ?? {})\n const em = resolveEm(ctx)\n const warehouse = await loadWarehouse(em, ctx, parsed.id)\n if (parsed.code !== undefined && parsed.code !== warehouse.code) {\n await ensureWarehouseCodeUnique(em, warehouse.tenantId, warehouse.organizationId, parsed.code, warehouse.id)\n }\n // Resolve the intended isActive/isPrimary state before mutating anything so\n // validation can run before any write. Deactivating (isActive explicitly\n // false in this request) silently auto-clears isPrimary; otherwise ending up\n // primary while inactive is rejected.\n let nextIsActive = warehouse.isActive\n let nextIsPrimary = warehouse.isPrimary\n if (parsed.isActive !== undefined) nextIsActive = parsed.isActive\n if (parsed.isPrimary !== undefined) nextIsPrimary = parsed.isPrimary\n if (parsed.isActive === false && nextIsPrimary) {\n nextIsPrimary = false\n } else if (nextIsPrimary && !nextIsActive) {\n await rejectInactivePrimaryWarehouse(ctx)\n }\n let demotedPrimariesBefore: PrimaryDemotionSnapshot[] = []\n try {\n await withAtomicFlush(\n em,\n [\n () => {\n if (parsed.code !== undefined) warehouse.code = parsed.code\n if (parsed.name !== undefined) warehouse.name = parsed.name\n if (parsed.addressLine1 !== undefined) warehouse.addressLine1 = normalizeOptionalString(parsed.addressLine1)\n if (parsed.city !== undefined) warehouse.city = normalizeOptionalString(parsed.city)\n if (parsed.postalCode !== undefined) warehouse.postalCode = normalizeOptionalString(parsed.postalCode)\n if (parsed.country !== undefined) warehouse.country = normalizeOptionalString(parsed.country)\n if (parsed.timezone !== undefined) warehouse.timezone = normalizeOptionalString(parsed.timezone)\n if (parsed.metadata !== undefined) warehouse.metadata = toJsonValue(parsed.metadata)\n warehouse.isActive = nextIsActive\n // Hold this row's own primary flag at false until siblings are demoted\n // (next phase) so the at-most-one-primary partial unique index never\n // sees two primary rows for the org within the same SQL statement.\n warehouse.isPrimary = false\n },\n async () => {\n if (!nextIsPrimary) return\n demotedPrimariesBefore = await enforcePrimaryWarehouse(\n em,\n warehouse.organizationId,\n warehouse.tenantId,\n warehouse.id,\n )\n },\n () => {\n warehouse.isPrimary = nextIsPrimary\n },\n ],\n { transaction: true, label: 'wms.warehouses.update' },\n )\n } catch (err) {\n if (isUniqueViolation(err, WMS_WAREHOUSE_PRIMARY_UNIQUE_CONSTRAINT)) {\n await rejectPrimaryWarehouseConflict()\n }\n throw err\n }\n void emitWmsEvent('wms.warehouse.updated', {\n id: warehouse.id,\n warehouseId: warehouse.id,\n tenantId: warehouse.tenantId,\n organizationId: warehouse.organizationId,\n }).catch(() => undefined)\n return {\n warehouseId: warehouse.id,\n ...(demotedPrimariesBefore.length > 0 ? { demotedPrimariesBefore } : {}),\n }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = resolveEm(ctx)\n return loadWarehouseSnapshot(em, ctx, result.warehouseId)\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.warehouseId ?? null, 'wms.audit.warehouse.update', 'Update warehouse', 'wms.warehouse')\n const before = snapshots?.before as WarehouseSnapshot | undefined\n const after = snapshots?.after as WarehouseSnapshot | undefined\n const demotedPrimariesBefore = result?.demotedPrimariesBefore\n return {\n ...base,\n snapshotBefore: before,\n snapshotAfter: after,\n payload: {\n undo: {\n before,\n after,\n ...(demotedPrimariesBefore?.length ? { demotedPrimariesBefore } : {}),\n } satisfies WarehouseUndoPayload,\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<WarehouseUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const em = resolveEm(ctx)\n let record = await findOneWithDecryption(\n em,\n Warehouse,\n { id: before.id },\n undefined,\n resolveScope(ctx, { tenantId: before.tenantId, organizationId: before.organizationId }),\n )\n if (!record) {\n record = em.create(Warehouse, {\n id: before.id,\n organizationId: before.organizationId,\n tenantId: before.tenantId,\n name: before.name,\n code: before.code,\n isActive: before.isActive,\n isPrimary: before.isPrimary,\n addressLine1: before.addressLine1,\n city: before.city,\n postalCode: before.postalCode,\n country: before.country,\n timezone: before.timezone,\n metadata: before.metadata,\n createdAt: new Date(before.createdAt),\n updatedAt: new Date(before.updatedAt),\n })\n em.persist(record)\n } else {\n ensureTenantScope(ctx, before.tenantId)\n ensureOrganizationScope(ctx, before.organizationId)\n record.name = before.name\n record.code = before.code\n record.isActive = before.isActive\n record.isPrimary = before.isPrimary\n record.addressLine1 = before.addressLine1\n record.city = before.city\n record.postalCode = before.postalCode\n record.country = before.country\n record.timezone = before.timezone\n record.metadata = before.metadata\n record.deletedAt = null\n }\n await em.flush()\n if (payload.demotedPrimariesBefore?.length) {\n await restoreDemotedPrimaryWarehouses(em, ctx, payload.demotedPrimariesBefore)\n await em.flush()\n }\n },\n}\n\nconst deleteWarehouseCommand: CommandHandler<{ id?: string }, { warehouseId: string }> = {\n id: 'wms.warehouses.delete',\n prepare: async (input, ctx) => {\n const id = requireId(input?.id, 'Warehouse')\n const em = resolveEm(ctx)\n const before = await loadWarehouseSnapshot(em, ctx, id)\n return before ? { before } : {}\n },\n async execute(input, ctx) {\n const warehouseId = requireId(input?.id, 'Warehouse')\n const em = resolveEm(ctx)\n const warehouse = await loadWarehouse(em, ctx, warehouseId)\n warehouse.deletedAt = new Date()\n await em.flush()\n return { warehouseId: warehouse.id }\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.warehouseId ?? null, 'wms.audit.warehouse.delete', 'Delete warehouse', 'wms.warehouse')\n const before = snapshots?.before as WarehouseSnapshot | undefined\n return { ...base, snapshotBefore: before, payload: { undo: { before } satisfies WarehouseUndoPayload } }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<WarehouseUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const em = resolveEm(ctx)\n let record = await findOneWithDecryption(\n em,\n Warehouse,\n { id: before.id },\n undefined,\n resolveScope(ctx, { tenantId: before.tenantId, organizationId: before.organizationId }),\n )\n if (!record) {\n record = em.create(Warehouse, {\n id: before.id,\n organizationId: before.organizationId,\n tenantId: before.tenantId,\n name: before.name,\n code: before.code,\n isActive: before.isActive,\n isPrimary: before.isPrimary,\n addressLine1: before.addressLine1,\n city: before.city,\n postalCode: before.postalCode,\n country: before.country,\n timezone: before.timezone,\n metadata: before.metadata,\n createdAt: new Date(before.createdAt),\n updatedAt: new Date(before.updatedAt),\n })\n em.persist(record)\n } else {\n ensureTenantScope(ctx, before.tenantId)\n ensureOrganizationScope(ctx, before.organizationId)\n record.deletedAt = null\n record.name = before.name\n record.code = before.code\n record.isActive = before.isActive\n record.isPrimary = before.isPrimary\n record.addressLine1 = before.addressLine1\n record.city = before.city\n record.postalCode = before.postalCode\n record.country = before.country\n record.timezone = before.timezone\n record.metadata = before.metadata\n }\n await em.flush()\n },\n}\n\nasync function restoreZoneFromSnapshot(em: EntityManager, before: WarehouseZoneSnapshot): Promise<void> {\n const scope = { tenantId: before.tenantId, organizationId: before.organizationId }\n const warehouseRef = await findOneWithDecryption(em, Warehouse, { id: before.warehouseId }, undefined, scope)\n if (!warehouseRef) {\n throw new CrudHttpError(409, { error: 'Cannot undo zone: parent warehouse no longer exists.' })\n }\n let record = await findOneWithDecryption(em, WarehouseZone, { id: before.id }, undefined, scope)\n if (!record) {\n record = em.create(WarehouseZone, {\n id: before.id,\n organizationId: before.organizationId,\n tenantId: before.tenantId,\n warehouse: warehouseRef,\n code: before.code,\n name: before.name,\n priority: before.priority,\n metadata: before.metadata,\n createdAt: new Date(before.createdAt),\n updatedAt: new Date(before.updatedAt),\n })\n em.persist(record)\n } else {\n record.warehouse = warehouseRef\n record.code = before.code\n record.name = before.name\n record.priority = before.priority\n record.metadata = before.metadata\n record.deletedAt = null\n }\n}\n\nconst createWarehouseZoneCommand: CommandHandler<WarehouseZoneCreateInput, { zoneId: string }> = {\n id: 'wms.zones.create',\n async execute(rawInput, ctx) {\n const parsed = warehouseZoneCreateSchema.parse(rawInput ?? {})\n ensureTenantScope(ctx, parsed.tenantId)\n ensureOrganizationScope(ctx, parsed.organizationId)\n const em = resolveEm(ctx)\n const warehouse = await loadWarehouse(em, ctx, parsed.warehouseId)\n await ensureZoneCodeUnique(em, warehouse.id, warehouse.tenantId, warehouse.organizationId, parsed.code)\n const zone = em.create(WarehouseZone, {\n organizationId: parsed.organizationId,\n tenantId: parsed.tenantId,\n warehouse,\n code: parsed.code,\n name: parsed.name,\n priority: parsed.priority ?? 0,\n metadata: toJsonValue(parsed.metadata),\n })\n await em.persist(zone).flush()\n void emitWmsEvent('wms.zone.created', {\n id: zone.id,\n zoneId: zone.id,\n warehouseId: typeof zone.warehouse === 'string' ? zone.warehouse : zone.warehouse.id,\n tenantId: zone.tenantId,\n organizationId: zone.organizationId,\n }).catch(() => undefined)\n return { zoneId: zone.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = resolveEm(ctx)\n return loadWarehouseZoneSnapshot(em, ctx, result.zoneId)\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.zoneId ?? null, 'wms.audit.zone.create', 'Create warehouse zone', 'wms.zone')\n const after = snapshots?.after as WarehouseZoneSnapshot | undefined\n return { ...base, snapshotAfter: after, payload: { undo: { after } satisfies WarehouseZoneUndoPayload } }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<WarehouseZoneUndoPayload>(logEntry)\n const after = payload?.after\n if (!after) return\n const em = resolveEm(ctx)\n const record = await findOneWithDecryption(\n em,\n WarehouseZone,\n { id: after.id },\n undefined,\n resolveScope(ctx, { tenantId: after.tenantId, organizationId: after.organizationId }),\n )\n if (!record) return\n ensureTenantScope(ctx, record.tenantId)\n ensureOrganizationScope(ctx, record.organizationId)\n record.deletedAt = new Date()\n await em.flush()\n },\n}\n\nconst updateWarehouseZoneCommand: CommandHandler<WarehouseZoneUpdateInput, { zoneId: string }> = {\n id: 'wms.zones.update',\n prepare: async (input, ctx) => {\n const id = requireId(input?.id, 'Zone')\n const em = resolveEm(ctx)\n const before = await loadWarehouseZoneSnapshot(em, ctx, id)\n return before ? { before } : {}\n },\n async execute(rawInput, ctx) {\n const parsed = warehouseZoneUpdateSchema.parse(rawInput ?? {})\n const em = resolveEm(ctx)\n const zone = await loadZone(em, ctx, parsed.id)\n if (parsed.warehouseId !== undefined) {\n const warehouse = await loadWarehouse(em, ctx, parsed.warehouseId)\n zone.warehouse = warehouse\n }\n const warehouseId = typeof zone.warehouse === 'string' ? zone.warehouse : zone.warehouse.id\n if (parsed.code !== undefined && parsed.code !== zone.code) {\n await ensureZoneCodeUnique(em, warehouseId, zone.tenantId, zone.organizationId, parsed.code, zone.id)\n zone.code = parsed.code\n }\n if (parsed.name !== undefined) zone.name = parsed.name\n if (parsed.priority !== undefined) zone.priority = parsed.priority\n if (parsed.metadata !== undefined) zone.metadata = toJsonValue(parsed.metadata)\n await em.flush()\n void emitWmsEvent('wms.zone.updated', {\n id: zone.id,\n zoneId: zone.id,\n warehouseId: typeof zone.warehouse === 'string' ? zone.warehouse : zone.warehouse.id,\n tenantId: zone.tenantId,\n organizationId: zone.organizationId,\n }).catch(() => undefined)\n return { zoneId: zone.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = resolveEm(ctx)\n return loadWarehouseZoneSnapshot(em, ctx, result.zoneId)\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.zoneId ?? null, 'wms.audit.zone.update', 'Update warehouse zone', 'wms.zone')\n const before = snapshots?.before as WarehouseZoneSnapshot | undefined\n const after = snapshots?.after as WarehouseZoneSnapshot | undefined\n return { ...base, snapshotBefore: before, snapshotAfter: after, payload: { undo: { before, after } satisfies WarehouseZoneUndoPayload } }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<WarehouseZoneUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const em = resolveEm(ctx)\n ensureTenantScope(ctx, before.tenantId)\n ensureOrganizationScope(ctx, before.organizationId)\n await restoreZoneFromSnapshot(em, before)\n await em.flush()\n },\n}\n\nconst deleteWarehouseZoneCommand: CommandHandler<{ id?: string }, { zoneId: string }> = {\n id: 'wms.zones.delete',\n prepare: async (input, ctx) => {\n const id = requireId(input?.id, 'Zone')\n const em = resolveEm(ctx)\n const before = await loadWarehouseZoneSnapshot(em, ctx, id)\n return before ? { before } : {}\n },\n async execute(input, ctx) {\n const zoneId = requireId(input?.id, 'Zone')\n const em = resolveEm(ctx)\n const zone = await loadZone(em, ctx, zoneId)\n zone.deletedAt = new Date()\n await em.flush()\n return { zoneId: zone.id }\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.zoneId ?? null, 'wms.audit.zone.delete', 'Delete warehouse zone', 'wms.zone')\n const before = snapshots?.before as WarehouseZoneSnapshot | undefined\n return { ...base, snapshotBefore: before, payload: { undo: { before } satisfies WarehouseZoneUndoPayload } }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<WarehouseZoneUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const em = resolveEm(ctx)\n ensureTenantScope(ctx, before.tenantId)\n ensureOrganizationScope(ctx, before.organizationId)\n await restoreZoneFromSnapshot(em, before)\n await em.flush()\n },\n}\n\nasync function restoreLocationFromSnapshot(em: EntityManager, before: WarehouseLocationSnapshot): Promise<void> {\n const scope = { tenantId: before.tenantId, organizationId: before.organizationId }\n const warehouseRef = await findOneWithDecryption(em, Warehouse, { id: before.warehouseId }, undefined, scope)\n if (!warehouseRef) {\n throw new CrudHttpError(409, { error: 'Cannot undo location: parent warehouse no longer exists.' })\n }\n let parentRef: WarehouseLocation | null = null\n if (before.parentId) {\n parentRef = await findOneWithDecryption(em, WarehouseLocation, { id: before.parentId }, undefined, scope)\n // Parent may have been deleted independently \u2014 fall back to root level\n // rather than blocking the undo (the audit log still records the original\n // parent id for manual reconciliation).\n }\n let record = await findOneWithDecryption(em, WarehouseLocation, { id: before.id }, undefined, scope)\n if (!record) {\n record = em.create(WarehouseLocation, {\n id: before.id,\n organizationId: before.organizationId,\n tenantId: before.tenantId,\n warehouse: warehouseRef,\n parent: parentRef,\n code: before.code,\n type: before.type,\n isActive: before.isActive,\n capacityUnits: before.capacityUnits,\n capacityWeight: before.capacityWeight,\n constraints: before.constraints,\n metadata: before.metadata,\n createdAt: new Date(before.createdAt),\n updatedAt: new Date(before.updatedAt),\n })\n em.persist(record)\n } else {\n record.warehouse = warehouseRef\n record.parent = parentRef\n record.code = before.code\n record.type = before.type\n record.isActive = before.isActive\n record.capacityUnits = before.capacityUnits\n record.capacityWeight = before.capacityWeight\n record.constraints = before.constraints\n record.metadata = before.metadata\n record.deletedAt = null\n }\n}\n\nconst createWarehouseLocationCommand: CommandHandler<WarehouseLocationCreateInput, { locationId: string }> = {\n id: 'wms.locations.create',\n async execute(rawInput, ctx) {\n const parsed = warehouseLocationCreateSchema.parse(rawInput ?? {})\n ensureTenantScope(ctx, parsed.tenantId)\n ensureOrganizationScope(ctx, parsed.organizationId)\n const em = resolveEm(ctx)\n const warehouse = await loadWarehouse(em, ctx, parsed.warehouseId)\n await ensureLocationCodeUnique(em, warehouse.id, warehouse.tenantId, warehouse.organizationId, parsed.code)\n const parent = await resolveParentLocation(em, ctx, warehouse.id, parsed.parentId ?? null)\n const location = em.create(WarehouseLocation, {\n organizationId: parsed.organizationId,\n tenantId: parsed.tenantId,\n warehouse,\n code: parsed.code,\n type: parsed.type,\n parent,\n isActive: parsed.isActive ?? true,\n capacityUnits: parsed.capacityUnits !== undefined ? toNumericString(parsed.capacityUnits) : null,\n capacityWeight: parsed.capacityWeight !== undefined ? toNumericString(parsed.capacityWeight) : null,\n constraints: toJsonValue(parsed.constraints),\n metadata: toJsonValue(parsed.metadata),\n })\n await em.persist(location).flush()\n void emitWmsEvent('wms.location.created', {\n id: location.id,\n locationId: location.id,\n warehouseId: typeof location.warehouse === 'string' ? location.warehouse : location.warehouse.id,\n tenantId: location.tenantId,\n organizationId: location.organizationId,\n }).catch(() => undefined)\n return { locationId: location.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = resolveEm(ctx)\n return loadWarehouseLocationSnapshot(em, ctx, result.locationId)\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.locationId ?? null, 'wms.audit.location.create', 'Create warehouse location', 'wms.location')\n const after = snapshots?.after as WarehouseLocationSnapshot | undefined\n return { ...base, snapshotAfter: after, payload: { undo: { after } satisfies WarehouseLocationUndoPayload } }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<WarehouseLocationUndoPayload>(logEntry)\n const after = payload?.after\n if (!after) return\n const em = resolveEm(ctx)\n const record = await findOneWithDecryption(\n em,\n WarehouseLocation,\n { id: after.id },\n undefined,\n resolveScope(ctx, { tenantId: after.tenantId, organizationId: after.organizationId }),\n )\n if (!record) return\n ensureTenantScope(ctx, record.tenantId)\n ensureOrganizationScope(ctx, record.organizationId)\n record.deletedAt = new Date()\n await em.flush()\n },\n}\n\nconst updateWarehouseLocationCommand: CommandHandler<WarehouseLocationUpdateInput, { locationId: string }> = {\n id: 'wms.locations.update',\n prepare: async (input, ctx) => {\n const id = requireId(input?.id, 'Location')\n const em = resolveEm(ctx)\n const before = await loadWarehouseLocationSnapshot(em, ctx, id)\n return before ? { before } : {}\n },\n async execute(rawInput, ctx) {\n const parsed = warehouseLocationUpdateSchema.parse(rawInput ?? {})\n const em = resolveEm(ctx)\n const location = await loadLocation(em, ctx, parsed.id)\n if (parsed.warehouseId !== undefined) {\n const warehouse = await loadWarehouse(em, ctx, parsed.warehouseId)\n location.warehouse = warehouse\n }\n const warehouseId = typeof location.warehouse === 'string' ? location.warehouse : location.warehouse.id\n if (parsed.parentId !== undefined) {\n location.parent = await resolveParentLocation(em, ctx, warehouseId, parsed.parentId)\n }\n if (parsed.code !== undefined && parsed.code !== location.code) {\n await ensureLocationCodeUnique(em, warehouseId, location.tenantId, location.organizationId, parsed.code, location.id)\n location.code = parsed.code\n }\n if (parsed.type !== undefined) location.type = parsed.type\n if (parsed.isActive !== undefined) location.isActive = parsed.isActive\n if (parsed.capacityUnits !== undefined) location.capacityUnits = toNumericString(parsed.capacityUnits)\n if (parsed.capacityWeight !== undefined) location.capacityWeight = toNumericString(parsed.capacityWeight)\n if (parsed.constraints !== undefined) location.constraints = toJsonValue(parsed.constraints)\n if (parsed.metadata !== undefined) location.metadata = toJsonValue(parsed.metadata)\n await em.flush()\n void emitWmsEvent('wms.location.updated', {\n id: location.id,\n locationId: location.id,\n warehouseId: typeof location.warehouse === 'string' ? location.warehouse : location.warehouse.id,\n tenantId: location.tenantId,\n organizationId: location.organizationId,\n }).catch(() => undefined)\n return { locationId: location.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = resolveEm(ctx)\n return loadWarehouseLocationSnapshot(em, ctx, result.locationId)\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.locationId ?? null, 'wms.audit.location.update', 'Update warehouse location', 'wms.location')\n const before = snapshots?.before as WarehouseLocationSnapshot | undefined\n const after = snapshots?.after as WarehouseLocationSnapshot | undefined\n return { ...base, snapshotBefore: before, snapshotAfter: after, payload: { undo: { before, after } satisfies WarehouseLocationUndoPayload } }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<WarehouseLocationUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const em = resolveEm(ctx)\n ensureTenantScope(ctx, before.tenantId)\n ensureOrganizationScope(ctx, before.organizationId)\n await restoreLocationFromSnapshot(em, before)\n await em.flush()\n },\n}\n\nconst deleteWarehouseLocationCommand: CommandHandler<{ id?: string }, { locationId: string }> = {\n id: 'wms.locations.delete',\n prepare: async (input, ctx) => {\n const id = requireId(input?.id, 'Location')\n const em = resolveEm(ctx)\n const before = await loadWarehouseLocationSnapshot(em, ctx, id)\n return before ? { before } : {}\n },\n async execute(input, ctx) {\n const locationId = requireId(input?.id, 'Location')\n const em = resolveEm(ctx)\n const location = await loadLocation(em, ctx, locationId)\n location.deletedAt = new Date()\n await em.flush()\n return { locationId: location.id }\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.locationId ?? null, 'wms.audit.location.delete', 'Delete warehouse location', 'wms.location')\n const before = snapshots?.before as WarehouseLocationSnapshot | undefined\n return { ...base, snapshotBefore: before, payload: { undo: { before } satisfies WarehouseLocationUndoPayload } }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<WarehouseLocationUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const em = resolveEm(ctx)\n ensureTenantScope(ctx, before.tenantId)\n ensureOrganizationScope(ctx, before.organizationId)\n await restoreLocationFromSnapshot(em, before)\n await em.flush()\n },\n}\n\nfunction restoreInventoryProfileFromSnapshot(em: EntityManager, before: ProductInventoryProfileSnapshot, record: ProductInventoryProfile): void {\n record.catalogProductId = before.catalogProductId\n record.catalogVariantId = before.catalogVariantId\n record.defaultUom = before.defaultUom\n record.trackLot = before.trackLot\n record.trackSerial = before.trackSerial\n record.trackExpiration = before.trackExpiration\n record.defaultStrategy = before.defaultStrategy\n record.reorderPoint = before.reorderPoint\n record.safetyStock = before.safetyStock\n record.metadata = before.metadata\n record.deletedAt = null\n}\n\nconst createProductInventoryProfileCommand: CommandHandler<ProductInventoryProfileCreateInput, { profileId: string }> = {\n id: 'wms.inventoryProfiles.create',\n async execute(rawInput, ctx) {\n const parsed = productInventoryProfileCreateSchema.parse(rawInput ?? {})\n ensureTenantScope(ctx, parsed.tenantId)\n ensureOrganizationScope(ctx, parsed.organizationId)\n const em = resolveEm(ctx)\n await ensureProfileUniqueness(em, parsed)\n const profile = em.create(ProductInventoryProfile, {\n organizationId: parsed.organizationId,\n tenantId: parsed.tenantId,\n catalogProductId: parsed.catalogProductId,\n catalogVariantId: parsed.catalogVariantId ?? null,\n defaultUom: parsed.defaultUom,\n trackLot: parsed.trackLot ?? false,\n trackSerial: parsed.trackSerial ?? false,\n trackExpiration: parsed.trackExpiration ?? false,\n defaultStrategy: parsed.defaultStrategy,\n reorderPoint: toNumericString(parsed.reorderPoint),\n safetyStock: toNumericString(parsed.safetyStock),\n metadata: toJsonValue(parsed.metadata),\n })\n await em.persist(profile).flush()\n void emitWmsEvent('wms.inventory_profile.created', {\n id: profile.id,\n profileId: profile.id,\n catalogProductId: profile.catalogProductId,\n catalogVariantId: profile.catalogVariantId ?? null,\n tenantId: profile.tenantId,\n organizationId: profile.organizationId,\n }).catch(() => undefined)\n return { profileId: profile.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = resolveEm(ctx)\n return loadInventoryProfileSnapshot(em, ctx, result.profileId)\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.profileId ?? null, 'wms.audit.inventoryProfile.create', 'Create inventory profile', 'wms.inventoryProfile')\n const after = snapshots?.after as ProductInventoryProfileSnapshot | undefined\n return { ...base, snapshotAfter: after, payload: { undo: { after } satisfies ProductInventoryProfileUndoPayload } }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ProductInventoryProfileUndoPayload>(logEntry)\n const after = payload?.after\n if (!after) return\n const em = resolveEm(ctx)\n const record = await findOneWithDecryption(\n em,\n ProductInventoryProfile,\n { id: after.id },\n undefined,\n resolveScope(ctx, { tenantId: after.tenantId, organizationId: after.organizationId }),\n )\n if (!record) return\n ensureTenantScope(ctx, record.tenantId)\n ensureOrganizationScope(ctx, record.organizationId)\n record.deletedAt = new Date()\n await em.flush()\n },\n}\n\nconst updateProductInventoryProfileCommand: CommandHandler<ProductInventoryProfileUpdateInput, { profileId: string }> = {\n id: 'wms.inventoryProfiles.update',\n prepare: async (input, ctx) => {\n const id = requireId(input?.id, 'Inventory profile')\n const em = resolveEm(ctx)\n const before = await loadInventoryProfileSnapshot(em, ctx, id)\n return before ? { before } : {}\n },\n async execute(rawInput, ctx) {\n const parsed = productInventoryProfileUpdateSchema.parse(rawInput ?? {})\n const em = resolveEm(ctx)\n const profile = await loadProfile(em, ctx, parsed.id)\n const next = {\n tenantId: profile.tenantId,\n organizationId: profile.organizationId,\n catalogProductId: parsed.catalogProductId ?? profile.catalogProductId,\n catalogVariantId: parsed.catalogVariantId !== undefined ? parsed.catalogVariantId ?? null : profile.catalogVariantId ?? null,\n }\n if (\n parsed.catalogProductId !== undefined ||\n parsed.catalogVariantId !== undefined\n ) {\n await ensureProfileUniqueness(em, next, profile.id)\n }\n if (parsed.catalogProductId !== undefined) profile.catalogProductId = parsed.catalogProductId\n if (parsed.catalogVariantId !== undefined) profile.catalogVariantId = parsed.catalogVariantId ?? null\n if (parsed.defaultUom !== undefined) profile.defaultUom = parsed.defaultUom\n if (parsed.trackLot !== undefined) profile.trackLot = parsed.trackLot\n if (parsed.trackSerial !== undefined) profile.trackSerial = parsed.trackSerial\n if (parsed.trackExpiration !== undefined) profile.trackExpiration = parsed.trackExpiration\n if (parsed.defaultStrategy !== undefined) profile.defaultStrategy = parsed.defaultStrategy\n if (parsed.reorderPoint !== undefined) profile.reorderPoint = toNumericString(parsed.reorderPoint)\n if (parsed.safetyStock !== undefined) profile.safetyStock = toNumericString(parsed.safetyStock)\n if (parsed.metadata !== undefined) profile.metadata = toJsonValue(parsed.metadata)\n await em.flush()\n void emitWmsEvent('wms.inventory_profile.updated', {\n id: profile.id,\n profileId: profile.id,\n catalogProductId: profile.catalogProductId,\n catalogVariantId: profile.catalogVariantId ?? null,\n tenantId: profile.tenantId,\n organizationId: profile.organizationId,\n }).catch(() => undefined)\n return { profileId: profile.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = resolveEm(ctx)\n return loadInventoryProfileSnapshot(em, ctx, result.profileId)\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.profileId ?? null, 'wms.audit.inventoryProfile.update', 'Update inventory profile', 'wms.inventoryProfile')\n const before = snapshots?.before as ProductInventoryProfileSnapshot | undefined\n const after = snapshots?.after as ProductInventoryProfileSnapshot | undefined\n return { ...base, snapshotBefore: before, snapshotAfter: after, payload: { undo: { before, after } satisfies ProductInventoryProfileUndoPayload } }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ProductInventoryProfileUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const em = resolveEm(ctx)\n let record = await findOneWithDecryption(\n em,\n ProductInventoryProfile,\n { id: before.id },\n undefined,\n resolveScope(ctx, { tenantId: before.tenantId, organizationId: before.organizationId }),\n )\n if (!record) {\n record = em.create(ProductInventoryProfile, {\n id: before.id,\n organizationId: before.organizationId,\n tenantId: before.tenantId,\n catalogProductId: before.catalogProductId,\n catalogVariantId: before.catalogVariantId,\n defaultUom: before.defaultUom,\n trackLot: before.trackLot,\n trackSerial: before.trackSerial,\n trackExpiration: before.trackExpiration,\n defaultStrategy: before.defaultStrategy,\n reorderPoint: before.reorderPoint,\n safetyStock: before.safetyStock,\n metadata: before.metadata,\n createdAt: new Date(before.createdAt),\n updatedAt: new Date(before.updatedAt),\n })\n em.persist(record)\n } else {\n ensureTenantScope(ctx, before.tenantId)\n ensureOrganizationScope(ctx, before.organizationId)\n restoreInventoryProfileFromSnapshot(em, before, record)\n }\n await em.flush()\n },\n}\n\nconst deleteProductInventoryProfileCommand: CommandHandler<{ id?: string }, { profileId: string }> = {\n id: 'wms.inventoryProfiles.delete',\n prepare: async (input, ctx) => {\n const id = requireId(input?.id, 'Inventory profile')\n const em = resolveEm(ctx)\n const before = await loadInventoryProfileSnapshot(em, ctx, id)\n return before ? { before } : {}\n },\n async execute(input, ctx) {\n const profileId = requireId(input?.id, 'Inventory profile')\n const em = resolveEm(ctx)\n const profile = await loadProfile(em, ctx, profileId)\n profile.deletedAt = new Date()\n await em.flush()\n return { profileId: profile.id }\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.profileId ?? null, 'wms.audit.inventoryProfile.delete', 'Delete inventory profile', 'wms.inventoryProfile')\n const before = snapshots?.before as ProductInventoryProfileSnapshot | undefined\n return { ...base, snapshotBefore: before, payload: { undo: { before } satisfies ProductInventoryProfileUndoPayload } }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ProductInventoryProfileUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const em = resolveEm(ctx)\n let record = await findOneWithDecryption(\n em,\n ProductInventoryProfile,\n { id: before.id },\n undefined,\n resolveScope(ctx, { tenantId: before.tenantId, organizationId: before.organizationId }),\n )\n if (!record) {\n record = em.create(ProductInventoryProfile, {\n id: before.id,\n organizationId: before.organizationId,\n tenantId: before.tenantId,\n catalogProductId: before.catalogProductId,\n catalogVariantId: before.catalogVariantId,\n defaultUom: before.defaultUom,\n trackLot: before.trackLot,\n trackSerial: before.trackSerial,\n trackExpiration: before.trackExpiration,\n defaultStrategy: before.defaultStrategy,\n reorderPoint: before.reorderPoint,\n safetyStock: before.safetyStock,\n metadata: before.metadata,\n createdAt: new Date(before.createdAt),\n updatedAt: new Date(before.updatedAt),\n })\n em.persist(record)\n } else {\n ensureTenantScope(ctx, before.tenantId)\n ensureOrganizationScope(ctx, before.organizationId)\n restoreInventoryProfileFromSnapshot(em, before, record)\n }\n await em.flush()\n },\n}\n\nfunction restoreInventoryLotFromSnapshot(_em: EntityManager, before: InventoryLotSnapshot, record: InventoryLot): void {\n record.catalogVariantId = before.catalogVariantId\n record.sku = before.sku\n record.lotNumber = before.lotNumber\n record.batchNumber = before.batchNumber\n record.manufacturedAt = dateOrNull(before.manufacturedAt)\n record.bestBeforeAt = dateOrNull(before.bestBeforeAt)\n record.expiresAt = dateOrNull(before.expiresAt)\n record.status = before.status\n record.metadata = before.metadata\n record.deletedAt = null\n}\n\nconst createInventoryLotCommand: CommandHandler<InventoryLotCreateInput, { lotId: string }> = {\n id: 'wms.lots.create',\n async execute(rawInput, ctx) {\n const parsed = inventoryLotCreateSchema.parse(rawInput ?? {})\n ensureTenantScope(ctx, parsed.tenantId)\n ensureOrganizationScope(ctx, parsed.organizationId)\n const em = resolveEm(ctx)\n await ensureLotUniqueness(em, parsed)\n const lot = em.create(InventoryLot, {\n organizationId: parsed.organizationId,\n tenantId: parsed.tenantId,\n catalogVariantId: parsed.catalogVariantId,\n sku: parsed.sku,\n lotNumber: parsed.lotNumber,\n batchNumber: normalizeOptionalString(parsed.batchNumber),\n manufacturedAt: parsed.manufacturedAt ?? null,\n bestBeforeAt: parsed.bestBeforeAt ?? null,\n expiresAt: parsed.expiresAt ?? null,\n status: parsed.status ?? 'available',\n metadata: toJsonValue(parsed.metadata),\n })\n await em.persist(lot).flush()\n return { lotId: lot.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = resolveEm(ctx)\n return loadInventoryLotSnapshot(em, ctx, result.lotId)\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.lotId ?? null, 'wms.audit.lot.create', 'Create inventory lot', 'wms.inventoryLot')\n const after = snapshots?.after as InventoryLotSnapshot | undefined\n return { ...base, snapshotAfter: after, payload: { undo: { after } satisfies InventoryLotUndoPayload } }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<InventoryLotUndoPayload>(logEntry)\n const after = payload?.after\n if (!after) return\n const em = resolveEm(ctx)\n const record = await findOneWithDecryption(\n em,\n InventoryLot,\n { id: after.id },\n undefined,\n resolveScope(ctx, { tenantId: after.tenantId, organizationId: after.organizationId }),\n )\n if (!record) return\n ensureTenantScope(ctx, record.tenantId)\n ensureOrganizationScope(ctx, record.organizationId)\n record.deletedAt = new Date()\n await em.flush()\n },\n}\n\nconst updateInventoryLotCommand: CommandHandler<InventoryLotUpdateInput, { lotId: string }> = {\n id: 'wms.lots.update',\n prepare: async (input, ctx) => {\n const id = requireId(input?.id, 'Inventory lot')\n const em = resolveEm(ctx)\n const before = await loadInventoryLotSnapshot(em, ctx, id)\n return before ? { before } : {}\n },\n async execute(rawInput, ctx) {\n const parsed = inventoryLotUpdateSchema.parse(rawInput ?? {})\n const em = resolveEm(ctx)\n const lot = await loadLot(em, ctx, parsed.id)\n const nextVariantId = parsed.catalogVariantId ?? lot.catalogVariantId\n const nextLotNumber = parsed.lotNumber ?? lot.lotNumber\n if (\n parsed.catalogVariantId !== undefined ||\n parsed.lotNumber !== undefined\n ) {\n await ensureLotUniqueness(\n em,\n {\n tenantId: lot.tenantId,\n organizationId: lot.organizationId,\n catalogVariantId: nextVariantId,\n lotNumber: nextLotNumber,\n },\n lot.id,\n )\n }\n if (parsed.catalogVariantId !== undefined) lot.catalogVariantId = parsed.catalogVariantId\n if (parsed.sku !== undefined) lot.sku = parsed.sku\n if (parsed.lotNumber !== undefined) lot.lotNumber = parsed.lotNumber\n if (parsed.batchNumber !== undefined) lot.batchNumber = normalizeOptionalString(parsed.batchNumber)\n if (parsed.manufacturedAt !== undefined) lot.manufacturedAt = parsed.manufacturedAt ?? null\n if (parsed.bestBeforeAt !== undefined) lot.bestBeforeAt = parsed.bestBeforeAt ?? null\n if (parsed.expiresAt !== undefined) lot.expiresAt = parsed.expiresAt ?? null\n if (parsed.status !== undefined) lot.status = parsed.status\n if (parsed.metadata !== undefined) lot.metadata = toJsonValue(parsed.metadata)\n if (parsed.notes !== undefined) {\n const existing =\n lot.metadata && typeof lot.metadata === 'object' && !Array.isArray(lot.metadata)\n ? { ...(lot.metadata as Record<string, unknown>) }\n : {}\n const trimmedNotes = parsed.notes.trim()\n if (trimmedNotes) existing.notes = trimmedNotes\n else delete existing.notes\n lot.metadata = toJsonValue(existing)\n }\n await em.flush()\n return { lotId: lot.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = resolveEm(ctx)\n return loadInventoryLotSnapshot(em, ctx, result.lotId)\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.lotId ?? null, 'wms.audit.lot.update', 'Update inventory lot', 'wms.inventoryLot')\n const before = snapshots?.before as InventoryLotSnapshot | undefined\n const after = snapshots?.after as InventoryLotSnapshot | undefined\n return { ...base, snapshotBefore: before, snapshotAfter: after, payload: { undo: { before, after } satisfies InventoryLotUndoPayload } }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<InventoryLotUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const em = resolveEm(ctx)\n let record = await findOneWithDecryption(\n em,\n InventoryLot,\n { id: before.id },\n undefined,\n resolveScope(ctx, { tenantId: before.tenantId, organizationId: before.organizationId }),\n )\n if (!record) {\n record = em.create(InventoryLot, {\n id: before.id,\n organizationId: before.organizationId,\n tenantId: before.tenantId,\n catalogVariantId: before.catalogVariantId,\n sku: before.sku,\n lotNumber: before.lotNumber,\n batchNumber: before.batchNumber,\n manufacturedAt: dateOrNull(before.manufacturedAt),\n bestBeforeAt: dateOrNull(before.bestBeforeAt),\n expiresAt: dateOrNull(before.expiresAt),\n status: before.status,\n metadata: before.metadata,\n createdAt: new Date(before.createdAt),\n updatedAt: new Date(before.updatedAt),\n })\n em.persist(record)\n } else {\n ensureTenantScope(ctx, before.tenantId)\n ensureOrganizationScope(ctx, before.organizationId)\n restoreInventoryLotFromSnapshot(em, before, record)\n }\n await em.flush()\n },\n}\n\nconst deleteInventoryLotCommand: CommandHandler<{ id?: string }, { lotId: string }> = {\n id: 'wms.lots.delete',\n prepare: async (input, ctx) => {\n const id = requireId(input?.id, 'Inventory lot')\n const em = resolveEm(ctx)\n const before = await loadInventoryLotSnapshot(em, ctx, id)\n return before ? { before } : {}\n },\n async execute(input, ctx) {\n const lotId = requireId(input?.id, 'Inventory lot')\n const em = resolveEm(ctx)\n const lot = await loadLot(em, ctx, lotId)\n lot.deletedAt = new Date()\n await em.flush()\n return { lotId: lot.id }\n },\n buildLog: async ({ input, result, ctx, snapshots }) => {\n const base = await buildCrudLog(ctx, input, result?.lotId ?? null, 'wms.audit.lot.delete', 'Delete inventory lot', 'wms.inventoryLot')\n const before = snapshots?.before as InventoryLotSnapshot | undefined\n return { ...base, snapshotBefore: before, payload: { undo: { before } satisfies InventoryLotUndoPayload } }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<InventoryLotUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const em = resolveEm(ctx)\n let record = await findOneWithDecryption(\n em,\n InventoryLot,\n { id: before.id },\n undefined,\n resolveScope(ctx, { tenantId: before.tenantId, organizationId: before.organizationId }),\n )\n if (!record) {\n record = em.create(InventoryLot, {\n id: before.id,\n organizationId: before.organizationId,\n tenantId: before.tenantId,\n catalogVariantId: before.catalogVariantId,\n sku: before.sku,\n lotNumber: before.lotNumber,\n batchNumber: before.batchNumber,\n manufacturedAt: dateOrNull(before.manufacturedAt),\n bestBeforeAt: dateOrNull(before.bestBeforeAt),\n expiresAt: dateOrNull(before.expiresAt),\n status: before.status,\n metadata: before.metadata,\n createdAt: new Date(before.createdAt),\n updatedAt: new Date(before.updatedAt),\n })\n em.persist(record)\n } else {\n ensureTenantScope(ctx, before.tenantId)\n ensureOrganizationScope(ctx, before.organizationId)\n restoreInventoryLotFromSnapshot(em, before, record)\n }\n await em.flush()\n },\n}\n\nregisterCommand(createWarehouseCommand)\nregisterCommand(updateWarehouseCommand)\nregisterCommand(deleteWarehouseCommand)\nregisterCommand(createWarehouseZoneCommand)\nregisterCommand(updateWarehouseZoneCommand)\nregisterCommand(deleteWarehouseZoneCommand)\nregisterCommand(createWarehouseLocationCommand)\nregisterCommand(updateWarehouseLocationCommand)\nregisterCommand(deleteWarehouseLocationCommand)\nregisterCommand(createProductInventoryProfileCommand)\nregisterCommand(updateProductInventoryProfileCommand)\nregisterCommand(deleteProductInventoryProfileCommand)\nregisterCommand(createInventoryLotCommand)\nregisterCommand(updateInventoryLotCommand)\nregisterCommand(deleteInventoryLotCommand)\n"],
|
|
5
|
+
"mappings": "AA+BA,SAAS,uBAAuB;AAGhC,SAAS,uBAAuB;AAChC,SAAS,eAAe,yBAAyB;AACjD,SAAS,2BAA2B;AACpC,SAAS,uBAAuB,0BAA0B;AAC1D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