@open-mercato/core 0.6.7-develop.6661.1.0043ed1d03 → 0.6.7-develop.6670.1.4efa7961c6
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/customer_accounts/migrations/Migration20260724120000_customer_accounts.js +56 -0
- package/dist/modules/customer_accounts/migrations/Migration20260724120000_customer_accounts.js.map +7 -0
- package/dist/modules/directory/api/organizations/route.js +1 -1
- package/dist/modules/directory/api/organizations/route.js.map +1 -1
- package/dist/modules/entities/api/definitions.js +2 -0
- package/dist/modules/entities/api/definitions.js.map +2 -2
- package/dist/modules/entities/lib/helpers.js +1 -0
- package/dist/modules/entities/lib/helpers.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/api/quotes/accept/route.js +7 -2
- package/dist/modules/sales/api/quotes/accept/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/public/[token]/route.js +2 -1
- package/dist/modules/sales/api/quotes/public/[token]/route.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/lib/publicQuoteTenantScope.js +24 -0
- package/dist/modules/sales/lib/publicQuoteTenantScope.js.map +7 -0
- 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/customer_accounts/migrations/Migration20260724120000_customer_accounts.ts +96 -0
- package/src/modules/directory/api/organizations/route.ts +1 -1
- package/src/modules/entities/api/definitions.ts +2 -0
- package/src/modules/entities/lib/helpers.ts +1 -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/api/quotes/accept/route.ts +9 -2
- package/src/modules/sales/api/quotes/public/[token]/route.ts +2 -1
- 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/lib/publicQuoteTenantScope.ts +49 -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,56 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
3
|
+
import { inventoryImportValidateSchema } from '../../../../data/validators'
|
|
4
|
+
import { executeWmsInventoryImportRoute } from '../helpers'
|
|
5
|
+
|
|
6
|
+
export const metadata = {
|
|
7
|
+
POST: { requireAuth: true, requireFeatures: ['wms.import'] },
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function POST(request: Request) {
|
|
11
|
+
return executeWmsInventoryImportRoute({
|
|
12
|
+
request,
|
|
13
|
+
routePath: 'wms/inventory/import/validate',
|
|
14
|
+
mode: 'validate',
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const rowResultSchema = z.object({
|
|
19
|
+
rowNumber: z.number(),
|
|
20
|
+
status: z.enum(['valid', 'error', 'warning', 'skip']),
|
|
21
|
+
errors: z.array(z.string()),
|
|
22
|
+
warnings: z.array(z.string()),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const successSchema = z.object({
|
|
26
|
+
ok: z.boolean(),
|
|
27
|
+
importBatchId: z.string().uuid(),
|
|
28
|
+
summary: z.object({
|
|
29
|
+
totalRows: z.number(),
|
|
30
|
+
validRows: z.number(),
|
|
31
|
+
errorRows: z.number(),
|
|
32
|
+
warningRows: z.number(),
|
|
33
|
+
skipRows: z.number(),
|
|
34
|
+
}),
|
|
35
|
+
rows: z.array(rowResultSchema),
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const errorSchema = z.object({ error: z.string() })
|
|
39
|
+
|
|
40
|
+
export const openApi: OpenApiRouteDoc = {
|
|
41
|
+
tag: 'WMS',
|
|
42
|
+
summary: 'Validate inventory CSV import',
|
|
43
|
+
methods: {
|
|
44
|
+
POST: {
|
|
45
|
+
summary: 'Validate inventory CSV import',
|
|
46
|
+
description:
|
|
47
|
+
'Dry-run validation for inventory import CSV rows. By default (mode "additive"), quantity is added to existing on-hand stock; opt into mode "reconcile" to instead treat quantity as the absolute target balance (overwrites existing stock, including reducing it). Accepts JSON rows, JSON csv text, or multipart file upload.',
|
|
48
|
+
requestBody: { contentType: 'application/json', schema: inventoryImportValidateSchema },
|
|
49
|
+
responses: [{ status: 200, description: 'Validation report', schema: successSchema }],
|
|
50
|
+
errors: [
|
|
51
|
+
{ status: 400, description: 'Validation failed', schema: errorSchema },
|
|
52
|
+
{ status: 401, description: 'Unauthorized', schema: errorSchema },
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
3
|
+
import { inventoryMoveSchema } from '../../../data/validators'
|
|
4
|
+
import { executeWmsCustomPostRoute } from '../helpers'
|
|
5
|
+
|
|
6
|
+
export const metadata = {
|
|
7
|
+
POST: { requireAuth: true, requireFeatures: ['wms.adjust_inventory'] },
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function POST(request: Request) {
|
|
11
|
+
return executeWmsCustomPostRoute({
|
|
12
|
+
request,
|
|
13
|
+
routePath: 'wms/inventory/move',
|
|
14
|
+
inputSchema: inventoryMoveSchema,
|
|
15
|
+
commandId: 'wms.inventory.move',
|
|
16
|
+
describeResource: (input) => ({
|
|
17
|
+
resourceKind: 'wms.inventory',
|
|
18
|
+
resourceId: `${input.warehouseId}:${input.fromLocationId}:${input.catalogVariantId}`,
|
|
19
|
+
}),
|
|
20
|
+
mapSuccess: (result: { movementId: string }) => ({
|
|
21
|
+
ok: true,
|
|
22
|
+
movementId: result.movementId,
|
|
23
|
+
}),
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const successSchema = z.object({
|
|
28
|
+
ok: z.literal(true),
|
|
29
|
+
movementId: z.string().uuid(),
|
|
30
|
+
})
|
|
31
|
+
const errorSchema = z.object({ error: z.string() })
|
|
32
|
+
|
|
33
|
+
export const openApi: OpenApiRouteDoc = {
|
|
34
|
+
tag: 'WMS',
|
|
35
|
+
summary: 'Move inventory',
|
|
36
|
+
methods: {
|
|
37
|
+
POST: {
|
|
38
|
+
summary: 'Move inventory',
|
|
39
|
+
description: 'Moves stock from one location to another within a warehouse and appends a transfer movement.',
|
|
40
|
+
requestBody: { contentType: 'application/json', schema: inventoryMoveSchema },
|
|
41
|
+
responses: [{ status: 200, description: 'Inventory moved', schema: successSchema }],
|
|
42
|
+
errors: [
|
|
43
|
+
{ status: 400, description: 'Validation failed', schema: errorSchema },
|
|
44
|
+
{ status: 401, description: 'Unauthorized', schema: errorSchema },
|
|
45
|
+
{ status: 409, description: 'Insufficient stock', schema: errorSchema },
|
|
46
|
+
{ status: 422, description: 'Invalid location', schema: errorSchema },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { makeCrudRoute } from '@open-mercato/shared/lib/crud/factory'
|
|
3
|
+
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
4
|
+
import { escapeLikePattern } from '@open-mercato/shared/lib/db/escapeLikePattern'
|
|
5
|
+
import { E } from '#generated/entities.ids.generated'
|
|
6
|
+
import { InventoryMovement } from '../../../data/entities'
|
|
7
|
+
import { inventoryMovementListQuerySchema } from '../../../data/validators'
|
|
8
|
+
import { createPagedListResponseSchema } from '../../openapi'
|
|
9
|
+
import {
|
|
10
|
+
attachLocationLabelsToListItems,
|
|
11
|
+
attachVariantLabelsToListItems,
|
|
12
|
+
attachWarehouseLabelsToListItems,
|
|
13
|
+
} from '../../listEnrichers'
|
|
14
|
+
import { buildInventoryListSearchOrFilters } from '../../listSearch'
|
|
15
|
+
|
|
16
|
+
export const metadata = {
|
|
17
|
+
GET: { requireAuth: true, requireFeatures: ['wms.view'] },
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const crud = makeCrudRoute({
|
|
21
|
+
metadata,
|
|
22
|
+
orm: {
|
|
23
|
+
entity: InventoryMovement,
|
|
24
|
+
idField: 'id',
|
|
25
|
+
orgField: 'organizationId',
|
|
26
|
+
tenantField: 'tenantId',
|
|
27
|
+
softDeleteField: 'deletedAt',
|
|
28
|
+
},
|
|
29
|
+
indexer: { entityType: E.wms.inventory_movement },
|
|
30
|
+
list: {
|
|
31
|
+
schema: inventoryMovementListQuerySchema,
|
|
32
|
+
entityId: E.wms.inventory_movement,
|
|
33
|
+
disableListCache: true,
|
|
34
|
+
fields: [
|
|
35
|
+
'id',
|
|
36
|
+
'organization_id',
|
|
37
|
+
'tenant_id',
|
|
38
|
+
'warehouse_id',
|
|
39
|
+
'location_from_id',
|
|
40
|
+
'location_to_id',
|
|
41
|
+
'catalog_variant_id',
|
|
42
|
+
'lot_id',
|
|
43
|
+
'serial_number',
|
|
44
|
+
'quantity',
|
|
45
|
+
'type',
|
|
46
|
+
'reference_type',
|
|
47
|
+
'reference_id',
|
|
48
|
+
'performed_by',
|
|
49
|
+
'performed_at',
|
|
50
|
+
'received_at',
|
|
51
|
+
'reason',
|
|
52
|
+
'reason_code',
|
|
53
|
+
'created_at',
|
|
54
|
+
'updated_at',
|
|
55
|
+
],
|
|
56
|
+
sortFieldMap: {
|
|
57
|
+
catalogVariantId: 'catalog_variant_id',
|
|
58
|
+
warehouseId: 'warehouse_id',
|
|
59
|
+
quantity: 'quantity',
|
|
60
|
+
type: 'type',
|
|
61
|
+
performedAt: 'performed_at',
|
|
62
|
+
receivedAt: 'received_at',
|
|
63
|
+
createdAt: 'created_at',
|
|
64
|
+
updatedAt: 'updated_at',
|
|
65
|
+
},
|
|
66
|
+
buildFilters: async (query, ctx) => {
|
|
67
|
+
const filters: Record<string, unknown> = {}
|
|
68
|
+
if (query.warehouseId) filters.warehouse_id = { $eq: query.warehouseId }
|
|
69
|
+
if (query.catalogVariantId) filters.catalog_variant_id = { $eq: query.catalogVariantId }
|
|
70
|
+
if (query.lotId) filters.lot_id = { $eq: query.lotId }
|
|
71
|
+
if (query.referenceType) filters.reference_type = { $eq: query.referenceType }
|
|
72
|
+
if (query.referenceId) filters.reference_id = { $eq: query.referenceId }
|
|
73
|
+
if (query.type) filters.type = { $eq: query.type }
|
|
74
|
+
const andFilters: Record<string, unknown>[] = []
|
|
75
|
+
if (query.locationId) {
|
|
76
|
+
andFilters.push({
|
|
77
|
+
$or: [
|
|
78
|
+
{ location_from_id: { $eq: query.locationId } },
|
|
79
|
+
{ location_to_id: { $eq: query.locationId } },
|
|
80
|
+
],
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
const term = query.search?.trim()
|
|
84
|
+
if (term) {
|
|
85
|
+
andFilters.push({
|
|
86
|
+
$or: await buildInventoryListSearchOrFilters(ctx, term, escapeLikePattern, {
|
|
87
|
+
extraFieldFilters: (like) => [
|
|
88
|
+
{ reason: { $ilike: like } },
|
|
89
|
+
{ reason_code: { $ilike: like } },
|
|
90
|
+
],
|
|
91
|
+
}),
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
if (andFilters.length === 1) {
|
|
95
|
+
Object.assign(filters, andFilters[0])
|
|
96
|
+
} else if (andFilters.length > 1) {
|
|
97
|
+
filters.$and = andFilters
|
|
98
|
+
}
|
|
99
|
+
return filters
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
hooks: {
|
|
103
|
+
afterList: async (payload, ctx) => {
|
|
104
|
+
await Promise.all([
|
|
105
|
+
attachWarehouseLabelsToListItems(payload, ctx),
|
|
106
|
+
attachLocationLabelsToListItems(payload, ctx),
|
|
107
|
+
attachVariantLabelsToListItems(payload, ctx),
|
|
108
|
+
])
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
export const GET = crud.GET
|
|
114
|
+
|
|
115
|
+
const movementListItemSchema = z.object({
|
|
116
|
+
id: z.string().uuid().nullable().optional(),
|
|
117
|
+
organization_id: z.string().uuid().nullable().optional(),
|
|
118
|
+
tenant_id: z.string().uuid().nullable().optional(),
|
|
119
|
+
warehouse_id: z.string().uuid().nullable().optional(),
|
|
120
|
+
warehouse_name: z.string().nullable().optional(),
|
|
121
|
+
warehouse_code: z.string().nullable().optional(),
|
|
122
|
+
location_from_id: z.string().uuid().nullable().optional(),
|
|
123
|
+
location_from_code: z.string().nullable().optional(),
|
|
124
|
+
location_from_type: z.string().nullable().optional(),
|
|
125
|
+
location_to_id: z.string().uuid().nullable().optional(),
|
|
126
|
+
location_to_code: z.string().nullable().optional(),
|
|
127
|
+
location_to_type: z.string().nullable().optional(),
|
|
128
|
+
catalog_variant_id: z.string().uuid().nullable().optional(),
|
|
129
|
+
catalog_product_id: z.string().uuid().nullable().optional(),
|
|
130
|
+
variant_name: z.string().nullable().optional(),
|
|
131
|
+
variant_sku: z.string().nullable().optional(),
|
|
132
|
+
lot_id: z.string().uuid().nullable().optional(),
|
|
133
|
+
serial_number: z.string().nullable().optional(),
|
|
134
|
+
quantity: z.union([z.string(), z.number()]).nullable().optional(),
|
|
135
|
+
type: z.string().nullable().optional(),
|
|
136
|
+
reference_type: z.string().nullable().optional(),
|
|
137
|
+
reference_id: z.string().uuid().nullable().optional(),
|
|
138
|
+
performed_by: z.string().uuid().nullable().optional(),
|
|
139
|
+
performed_at: z.string().nullable().optional(),
|
|
140
|
+
received_at: z.string().nullable().optional(),
|
|
141
|
+
reason: z.string().nullable().optional(),
|
|
142
|
+
reason_code: z.string().nullable().optional(),
|
|
143
|
+
created_at: z.string().nullable().optional(),
|
|
144
|
+
updated_at: z.string().nullable().optional(),
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
export const openApi: OpenApiRouteDoc = {
|
|
148
|
+
tag: 'WMS',
|
|
149
|
+
summary: 'Inventory movements',
|
|
150
|
+
methods: {
|
|
151
|
+
GET: {
|
|
152
|
+
summary: 'List inventory movements',
|
|
153
|
+
description: 'Returns paginated inventory ledger entries for the authenticated organization.',
|
|
154
|
+
query: inventoryMovementListQuerySchema,
|
|
155
|
+
responses: [
|
|
156
|
+
{
|
|
157
|
+
status: 200,
|
|
158
|
+
description: 'Inventory movements collection',
|
|
159
|
+
schema: createPagedListResponseSchema(movementListItemSchema),
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
3
|
+
import { inventoryReceiveSchema } from '../../../data/validators'
|
|
4
|
+
import { executeWmsCustomPostRoute } from '../helpers'
|
|
5
|
+
|
|
6
|
+
export const metadata = {
|
|
7
|
+
POST: { requireAuth: true, requireFeatures: ['wms.receive_inventory'] },
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function POST(request: Request) {
|
|
11
|
+
return executeWmsCustomPostRoute({
|
|
12
|
+
request,
|
|
13
|
+
routePath: 'wms/inventory/receive',
|
|
14
|
+
inputSchema: inventoryReceiveSchema,
|
|
15
|
+
commandId: 'wms.inventory.receive',
|
|
16
|
+
describeResource: (input) => ({
|
|
17
|
+
resourceKind: 'wms.inventory',
|
|
18
|
+
resourceId: `${input.warehouseId}:${input.locationId}:${input.catalogVariantId}`,
|
|
19
|
+
}),
|
|
20
|
+
mapSuccess: (result: { movementId: string }) => ({
|
|
21
|
+
ok: true,
|
|
22
|
+
movementId: result.movementId,
|
|
23
|
+
}),
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const successSchema = z.object({
|
|
28
|
+
ok: z.literal(true),
|
|
29
|
+
movementId: z.string().uuid(),
|
|
30
|
+
})
|
|
31
|
+
const errorSchema = z.object({ error: z.string() })
|
|
32
|
+
|
|
33
|
+
export const openApi: OpenApiRouteDoc = {
|
|
34
|
+
tag: 'WMS',
|
|
35
|
+
summary: 'Receive inventory',
|
|
36
|
+
methods: {
|
|
37
|
+
POST: {
|
|
38
|
+
summary: 'Receive inventory',
|
|
39
|
+
description: 'Records inbound inventory receipt and appends a receipt movement ledger row.',
|
|
40
|
+
requestBody: { contentType: 'application/json', schema: inventoryReceiveSchema },
|
|
41
|
+
responses: [{ status: 200, description: 'Inventory received', schema: successSchema }],
|
|
42
|
+
errors: [
|
|
43
|
+
{ status: 400, description: 'Validation failed', schema: errorSchema },
|
|
44
|
+
{ status: 401, description: 'Unauthorized', schema: errorSchema },
|
|
45
|
+
{ status: 422, description: 'Invalid location', schema: errorSchema },
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
3
|
+
import { inventoryReservationReleaseSchema } from '../../../data/validators'
|
|
4
|
+
import { executeWmsCustomPostRoute } from '../helpers'
|
|
5
|
+
|
|
6
|
+
export const metadata = {
|
|
7
|
+
POST: { requireAuth: true, requireFeatures: ['wms.manage_reservations'] },
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function POST(request: Request) {
|
|
11
|
+
return executeWmsCustomPostRoute({
|
|
12
|
+
request,
|
|
13
|
+
routePath: 'wms/inventory/release',
|
|
14
|
+
inputSchema: inventoryReservationReleaseSchema,
|
|
15
|
+
commandId: 'wms.inventory.release',
|
|
16
|
+
describeResource: (input) => ({
|
|
17
|
+
resourceKind: 'wms.inventoryReservation',
|
|
18
|
+
resourceId: input.reservationId,
|
|
19
|
+
}),
|
|
20
|
+
mapSuccess: () => ({ ok: true }),
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const successSchema = z.object({ ok: z.literal(true) })
|
|
25
|
+
const errorSchema = z.object({ error: z.string() })
|
|
26
|
+
|
|
27
|
+
export const openApi: OpenApiRouteDoc = {
|
|
28
|
+
tag: 'WMS',
|
|
29
|
+
summary: 'Release reservation',
|
|
30
|
+
methods: {
|
|
31
|
+
POST: {
|
|
32
|
+
summary: 'Release reservation',
|
|
33
|
+
description: 'Releases a previously reserved or allocated inventory reservation.',
|
|
34
|
+
requestBody: { contentType: 'application/json', schema: inventoryReservationReleaseSchema },
|
|
35
|
+
responses: [{ status: 200, description: 'Reservation released', schema: successSchema }],
|
|
36
|
+
errors: [
|
|
37
|
+
{ status: 400, description: 'Validation failed', schema: errorSchema },
|
|
38
|
+
{ status: 401, description: 'Unauthorized', schema: errorSchema },
|
|
39
|
+
{ status: 404, description: 'Reservation not found', schema: errorSchema },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { makeCrudRoute } from '@open-mercato/shared/lib/crud/factory'
|
|
3
|
+
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
4
|
+
import { escapeLikePattern } from '@open-mercato/shared/lib/db/escapeLikePattern'
|
|
5
|
+
import { E } from '#generated/entities.ids.generated'
|
|
6
|
+
import { InventoryReservation } from '../../../data/entities'
|
|
7
|
+
import { inventoryReservationListQuerySchema } from '../../../data/validators'
|
|
8
|
+
import { createPagedListResponseSchema } from '../../openapi'
|
|
9
|
+
import {
|
|
10
|
+
attachReservationSourceLabelsToListItems,
|
|
11
|
+
attachVariantLabelsToListItems,
|
|
12
|
+
attachWarehouseLabelsToListItems,
|
|
13
|
+
} from '../../listEnrichers'
|
|
14
|
+
import { buildReservationSearchOrFilters } from '../../listSearch'
|
|
15
|
+
|
|
16
|
+
export const metadata = {
|
|
17
|
+
GET: { requireAuth: true, requireFeatures: ['wms.view'] },
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const crud = makeCrudRoute({
|
|
21
|
+
metadata,
|
|
22
|
+
orm: {
|
|
23
|
+
entity: InventoryReservation,
|
|
24
|
+
idField: 'id',
|
|
25
|
+
orgField: 'organizationId',
|
|
26
|
+
tenantField: 'tenantId',
|
|
27
|
+
softDeleteField: 'deletedAt',
|
|
28
|
+
},
|
|
29
|
+
indexer: { entityType: E.wms.inventory_reservation },
|
|
30
|
+
list: {
|
|
31
|
+
schema: inventoryReservationListQuerySchema,
|
|
32
|
+
entityId: E.wms.inventory_reservation,
|
|
33
|
+
disableListCache: true,
|
|
34
|
+
fields: [
|
|
35
|
+
'id',
|
|
36
|
+
'organization_id',
|
|
37
|
+
'tenant_id',
|
|
38
|
+
'warehouse_id',
|
|
39
|
+
'catalog_variant_id',
|
|
40
|
+
'lot_id',
|
|
41
|
+
'serial_number',
|
|
42
|
+
'quantity',
|
|
43
|
+
'source_type',
|
|
44
|
+
'source_id',
|
|
45
|
+
'expires_at',
|
|
46
|
+
'status',
|
|
47
|
+
'created_at',
|
|
48
|
+
'updated_at',
|
|
49
|
+
],
|
|
50
|
+
sortFieldMap: {
|
|
51
|
+
catalogVariantId: 'catalog_variant_id',
|
|
52
|
+
warehouseId: 'warehouse_id',
|
|
53
|
+
quantity: 'quantity',
|
|
54
|
+
sourceType: 'source_type',
|
|
55
|
+
status: 'status',
|
|
56
|
+
expiresAt: 'expires_at',
|
|
57
|
+
createdAt: 'created_at',
|
|
58
|
+
updatedAt: 'updated_at',
|
|
59
|
+
},
|
|
60
|
+
buildFilters: async (query, ctx) => {
|
|
61
|
+
const filters: Record<string, unknown> = {}
|
|
62
|
+
if (query.warehouseId) filters.warehouse_id = { $eq: query.warehouseId }
|
|
63
|
+
if (query.catalogVariantId) filters.catalog_variant_id = { $eq: query.catalogVariantId }
|
|
64
|
+
if (query.lotId) filters.lot_id = { $eq: query.lotId }
|
|
65
|
+
if (query.sourceType) filters.source_type = { $eq: query.sourceType }
|
|
66
|
+
if (query.sourceId) filters.source_id = { $eq: query.sourceId }
|
|
67
|
+
if (query.status) filters.status = { $eq: query.status }
|
|
68
|
+
const term = query.search?.trim()
|
|
69
|
+
if (term) {
|
|
70
|
+
filters.$or = await buildReservationSearchOrFilters(ctx, term, escapeLikePattern)
|
|
71
|
+
}
|
|
72
|
+
return filters
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
hooks: {
|
|
76
|
+
afterList: async (payload, ctx) => {
|
|
77
|
+
await Promise.all([
|
|
78
|
+
attachWarehouseLabelsToListItems(payload, ctx),
|
|
79
|
+
attachVariantLabelsToListItems(payload, ctx),
|
|
80
|
+
attachReservationSourceLabelsToListItems(payload, ctx),
|
|
81
|
+
])
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
export const GET = crud.GET
|
|
87
|
+
|
|
88
|
+
const reservationListItemSchema = z.object({
|
|
89
|
+
id: z.string().uuid().nullable().optional(),
|
|
90
|
+
organization_id: z.string().uuid().nullable().optional(),
|
|
91
|
+
tenant_id: z.string().uuid().nullable().optional(),
|
|
92
|
+
warehouse_id: z.string().uuid().nullable().optional(),
|
|
93
|
+
warehouse_name: z.string().nullable().optional(),
|
|
94
|
+
warehouse_code: z.string().nullable().optional(),
|
|
95
|
+
catalog_variant_id: z.string().uuid().nullable().optional(),
|
|
96
|
+
catalog_product_id: z.string().uuid().nullable().optional(),
|
|
97
|
+
variant_name: z.string().nullable().optional(),
|
|
98
|
+
variant_sku: z.string().nullable().optional(),
|
|
99
|
+
lot_id: z.string().uuid().nullable().optional(),
|
|
100
|
+
serial_number: z.string().nullable().optional(),
|
|
101
|
+
quantity: z.union([z.string(), z.number()]).nullable().optional(),
|
|
102
|
+
source_type: z.string().nullable().optional(),
|
|
103
|
+
source_id: z.string().uuid().nullable().optional(),
|
|
104
|
+
source_label: z.string().nullable().optional(),
|
|
105
|
+
expires_at: z.string().nullable().optional(),
|
|
106
|
+
status: z.string().nullable().optional(),
|
|
107
|
+
created_at: z.string().nullable().optional(),
|
|
108
|
+
updated_at: z.string().nullable().optional(),
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
export const openApi: OpenApiRouteDoc = {
|
|
112
|
+
tag: 'WMS',
|
|
113
|
+
summary: 'Inventory reservations',
|
|
114
|
+
methods: {
|
|
115
|
+
GET: {
|
|
116
|
+
summary: 'List inventory reservations',
|
|
117
|
+
description: 'Returns paginated inventory reservations for the authenticated organization.',
|
|
118
|
+
query: inventoryReservationListQuerySchema,
|
|
119
|
+
responses: [
|
|
120
|
+
{
|
|
121
|
+
status: 200,
|
|
122
|
+
description: 'Inventory reservations collection',
|
|
123
|
+
schema: createPagedListResponseSchema(reservationListItemSchema),
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
3
|
+
import { inventoryReservationCreateSchema } from '../../../data/validators'
|
|
4
|
+
import { executeWmsCustomPostRoute } from '../helpers'
|
|
5
|
+
|
|
6
|
+
export const metadata = {
|
|
7
|
+
POST: { requireAuth: true, requireFeatures: ['wms.manage_reservations'] },
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function POST(request: Request) {
|
|
11
|
+
return executeWmsCustomPostRoute({
|
|
12
|
+
request,
|
|
13
|
+
routePath: 'wms/inventory/reserve',
|
|
14
|
+
inputSchema: inventoryReservationCreateSchema,
|
|
15
|
+
commandId: 'wms.inventory.reserve',
|
|
16
|
+
describeResource: (input) => ({
|
|
17
|
+
resourceKind: 'wms.inventory',
|
|
18
|
+
resourceId: `${input.warehouseId}:${input.catalogVariantId}`,
|
|
19
|
+
}),
|
|
20
|
+
mapSuccess: (result: { reservationId: string; allocatedBuckets: Array<{ locationId: string; lotId: string | null; quantity: string }> }) => ({
|
|
21
|
+
ok: true,
|
|
22
|
+
reservationId: result.reservationId,
|
|
23
|
+
allocatedBuckets: result.allocatedBuckets,
|
|
24
|
+
}),
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const successSchema = z.object({
|
|
29
|
+
ok: z.literal(true),
|
|
30
|
+
reservationId: z.string().uuid(),
|
|
31
|
+
allocatedBuckets: z.array(
|
|
32
|
+
z.object({
|
|
33
|
+
locationId: z.string().uuid(),
|
|
34
|
+
lotId: z.string().uuid().nullable(),
|
|
35
|
+
quantity: z.string(),
|
|
36
|
+
}),
|
|
37
|
+
),
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const errorSchema = z.object({ error: z.string() })
|
|
41
|
+
|
|
42
|
+
export const openApi: OpenApiRouteDoc = {
|
|
43
|
+
tag: 'WMS',
|
|
44
|
+
summary: 'Reserve inventory',
|
|
45
|
+
methods: {
|
|
46
|
+
POST: {
|
|
47
|
+
summary: 'Reserve inventory',
|
|
48
|
+
description: 'Creates an inventory reservation and assigns available buckets using the configured stock strategy.',
|
|
49
|
+
requestBody: { contentType: 'application/json', schema: inventoryReservationCreateSchema },
|
|
50
|
+
responses: [{ status: 200, description: 'Inventory reserved', schema: successSchema }],
|
|
51
|
+
errors: [
|
|
52
|
+
{ status: 400, description: 'Validation failed', schema: errorSchema },
|
|
53
|
+
{ status: 401, description: 'Unauthorized', schema: errorSchema },
|
|
54
|
+
{ status: 409, description: 'Insufficient stock', schema: errorSchema },
|
|
55
|
+
{ status: 422, description: 'Invalid tracking state', schema: errorSchema },
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
}
|