@unchainedshop/core 4.0.0-rc.8 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bulk-importer/createBulkImporter.d.ts +84 -0
- package/lib/bulk-importer/createBulkImporter.d.ts.map +1 -0
- package/lib/bulk-importer/createBulkImporter.js +142 -0
- package/lib/bulk-importer/createBulkImporter.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/create.d.ts +565 -0
- package/lib/bulk-importer/handlers/assortment/create.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/create.js +89 -0
- package/lib/bulk-importer/handlers/assortment/create.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/index.d.ts +4 -0
- package/lib/bulk-importer/handlers/assortment/index.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/index.js +4 -0
- package/lib/bulk-importer/handlers/assortment/index.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/remove.d.ts +30 -0
- package/lib/bulk-importer/handlers/assortment/remove.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/remove.js +18 -0
- package/lib/bulk-importer/handlers/assortment/remove.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/update.d.ts +566 -0
- package/lib/bulk-importer/handlers/assortment/update.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/update.js +98 -0
- package/lib/bulk-importer/handlers/assortment/update.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts +29 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js +45 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts +29 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js +41 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts +29 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js +46 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts +76 -0
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js +53 -0
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js.map +1 -0
- package/lib/bulk-importer/handlers/filter/create.d.ts +138 -0
- package/lib/bulk-importer/handlers/filter/create.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/filter/create.js +80 -0
- package/lib/bulk-importer/handlers/filter/create.js.map +1 -0
- package/lib/bulk-importer/handlers/filter/index.d.ts +4 -0
- package/lib/bulk-importer/handlers/filter/index.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/filter/index.js +4 -0
- package/lib/bulk-importer/handlers/filter/index.js.map +1 -0
- package/lib/bulk-importer/handlers/filter/remove.d.ts +20 -0
- package/lib/bulk-importer/handlers/filter/remove.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/filter/remove.js +18 -0
- package/lib/bulk-importer/handlers/filter/remove.js.map +1 -0
- package/lib/bulk-importer/handlers/filter/update.d.ts +138 -0
- package/lib/bulk-importer/handlers/filter/update.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/filter/update.js +70 -0
- package/lib/bulk-importer/handlers/filter/update.js.map +1 -0
- package/lib/bulk-importer/handlers/product/create.d.ts +1330 -0
- package/lib/bulk-importer/handlers/product/create.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/create.js +132 -0
- package/lib/bulk-importer/handlers/product/create.js.map +1 -0
- package/lib/bulk-importer/handlers/product/index.d.ts +4 -0
- package/lib/bulk-importer/handlers/product/index.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/index.js +4 -0
- package/lib/bulk-importer/handlers/product/index.js.map +1 -0
- package/lib/bulk-importer/handlers/product/remove.d.ts +32 -0
- package/lib/bulk-importer/handlers/product/remove.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/remove.js +18 -0
- package/lib/bulk-importer/handlers/product/remove.js.map +1 -0
- package/lib/bulk-importer/handlers/product/update.d.ts +1330 -0
- package/lib/bulk-importer/handlers/product/update.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/update.js +132 -0
- package/lib/bulk-importer/handlers/product/update.js.map +1 -0
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts +75 -0
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/upsertMedia.js +59 -0
- package/lib/bulk-importer/handlers/product/upsertMedia.js.map +1 -0
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts +79 -0
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/upsertVariations.js +72 -0
- package/lib/bulk-importer/handlers/product/upsertVariations.js.map +1 -0
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.d.ts +3 -0
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.js +6 -0
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.js.map +1 -0
- package/lib/bulk-importer/index.d.ts +4 -0
- package/lib/bulk-importer/index.d.ts.map +1 -0
- package/lib/bulk-importer/index.js +4 -0
- package/lib/bulk-importer/index.js.map +1 -0
- package/lib/bulk-importer/upsertAsset.d.ts +28 -0
- package/lib/bulk-importer/upsertAsset.d.ts.map +1 -0
- package/lib/bulk-importer/upsertAsset.js +41 -0
- package/lib/bulk-importer/upsertAsset.js.map +1 -0
- package/lib/core-index.d.ts +9 -6
- package/lib/core-index.d.ts.map +1 -1
- package/lib/core-index.js +5 -1
- package/lib/core-index.js.map +1 -1
- package/lib/directors/BaseDiscountAdapter.d.ts +4 -4
- package/lib/directors/BaseDiscountAdapter.d.ts.map +1 -1
- package/lib/directors/BaseDiscountAdapter.js +1 -1
- package/lib/directors/BaseDiscountAdapter.js.map +1 -1
- package/lib/directors/BaseDiscountDirector.d.ts +1 -1
- package/lib/directors/BaseDiscountDirector.d.ts.map +1 -1
- package/lib/directors/BaseDiscountDirector.js +1 -1
- package/lib/directors/BaseDiscountDirector.js.map +1 -1
- package/lib/directors/BasePricingAdapter.d.ts +2 -2
- package/lib/directors/BasePricingAdapter.d.ts.map +1 -1
- package/lib/directors/BasePricingDirector.d.ts.map +1 -1
- package/lib/directors/BasePricingDirector.js +3 -3
- package/lib/directors/BasePricingDirector.js.map +1 -1
- package/lib/directors/BasePricingSheet.js.map +1 -1
- package/lib/directors/BaseWorker.js +1 -1
- package/lib/directors/BaseWorker.js.map +1 -1
- package/lib/directors/DeliveryAdapter.d.ts +4 -5
- package/lib/directors/DeliveryAdapter.d.ts.map +1 -1
- package/lib/directors/DeliveryAdapter.js.map +1 -1
- package/lib/directors/DeliveryDirector.d.ts +3 -3
- package/lib/directors/DeliveryDirector.d.ts.map +1 -1
- package/lib/directors/DeliveryDirector.js +29 -16
- package/lib/directors/DeliveryDirector.js.map +1 -1
- package/lib/directors/DeliveryPricingAdapter.d.ts +1 -1
- package/lib/directors/DeliveryPricingAdapter.d.ts.map +1 -1
- package/lib/directors/DeliveryPricingDirector.d.ts.map +1 -1
- package/lib/directors/DeliveryPricingDirector.js +3 -4
- package/lib/directors/DeliveryPricingDirector.js.map +1 -1
- package/lib/directors/DeliveryPricingSheet.d.ts.map +1 -1
- package/lib/directors/DeliveryPricingSheet.js +2 -1
- package/lib/directors/DeliveryPricingSheet.js.map +1 -1
- package/lib/directors/EnrollmentAdapter.d.ts +7 -4
- package/lib/directors/EnrollmentAdapter.d.ts.map +1 -1
- package/lib/directors/EnrollmentAdapter.js +1 -4
- package/lib/directors/EnrollmentAdapter.js.map +1 -1
- package/lib/directors/EnrollmentDirector.d.ts +1 -1
- package/lib/directors/EnrollmentDirector.d.ts.map +1 -1
- package/lib/directors/EnrollmentDirector.js +1 -5
- package/lib/directors/EnrollmentDirector.js.map +1 -1
- package/lib/directors/FilterAdapter.d.ts +3 -3
- package/lib/directors/FilterAdapter.d.ts.map +1 -1
- package/lib/directors/FilterDirector.d.ts +1 -1
- package/lib/directors/FilterDirector.d.ts.map +1 -1
- package/lib/directors/FilterDirector.js +7 -8
- package/lib/directors/FilterDirector.js.map +1 -1
- package/lib/directors/MessagingDirector.d.ts +2 -2
- package/lib/directors/MessagingDirector.d.ts.map +1 -1
- package/lib/directors/OrderDiscountAdapter.d.ts +1 -1
- package/lib/directors/OrderDiscountAdapter.d.ts.map +1 -1
- package/lib/directors/OrderDiscountAdapter.js.map +1 -1
- package/lib/directors/OrderPricingAdapter.d.ts +2 -2
- package/lib/directors/OrderPricingAdapter.d.ts.map +1 -1
- package/lib/directors/OrderPricingDirector.d.ts +2 -2
- package/lib/directors/OrderPricingDirector.d.ts.map +1 -1
- package/lib/directors/OrderPricingDirector.js +1 -1
- package/lib/directors/OrderPricingDirector.js.map +1 -1
- package/lib/directors/OrderPricingSheet.d.ts.map +1 -1
- package/lib/directors/OrderPricingSheet.js +2 -1
- package/lib/directors/OrderPricingSheet.js.map +1 -1
- package/lib/directors/PaymentAdapter.d.ts +2 -2
- package/lib/directors/PaymentAdapter.d.ts.map +1 -1
- package/lib/directors/PaymentDirector.d.ts +4 -4
- package/lib/directors/PaymentDirector.d.ts.map +1 -1
- package/lib/directors/PaymentDirector.js +24 -6
- package/lib/directors/PaymentDirector.js.map +1 -1
- package/lib/directors/PaymentPricingAdapter.d.ts +2 -2
- package/lib/directors/PaymentPricingAdapter.d.ts.map +1 -1
- package/lib/directors/PaymentPricingDirector.d.ts +1 -1
- package/lib/directors/PaymentPricingDirector.d.ts.map +1 -1
- package/lib/directors/PaymentPricingDirector.js +3 -5
- package/lib/directors/PaymentPricingDirector.js.map +1 -1
- package/lib/directors/PaymentPricingSheet.d.ts.map +1 -1
- package/lib/directors/PaymentPricingSheet.js +2 -1
- package/lib/directors/PaymentPricingSheet.js.map +1 -1
- package/lib/directors/ProductDiscountAdapter.d.ts +1 -1
- package/lib/directors/ProductDiscountAdapter.d.ts.map +1 -1
- package/lib/directors/ProductDiscountAdapter.js.map +1 -1
- package/lib/directors/ProductDiscountConfiguration.d.ts +1 -1
- package/lib/directors/ProductDiscountConfiguration.d.ts.map +1 -1
- package/lib/directors/ProductPricingAdapter.d.ts +1 -1
- package/lib/directors/ProductPricingAdapter.d.ts.map +1 -1
- package/lib/directors/ProductPricingDirector.d.ts +2 -2
- package/lib/directors/ProductPricingDirector.d.ts.map +1 -1
- package/lib/directors/ProductPricingDirector.js +3 -3
- package/lib/directors/ProductPricingDirector.js.map +1 -1
- package/lib/directors/ProductPricingSheet.d.ts +2 -2
- package/lib/directors/ProductPricingSheet.d.ts.map +1 -1
- package/lib/directors/ProductPricingSheet.js +2 -1
- package/lib/directors/ProductPricingSheet.js.map +1 -1
- package/lib/directors/QuotationAdapter.d.ts +2 -2
- package/lib/directors/QuotationAdapter.d.ts.map +1 -1
- package/lib/directors/QuotationDirector.js +2 -2
- package/lib/directors/WarehousingAdapter.d.ts +3 -4
- package/lib/directors/WarehousingAdapter.d.ts.map +1 -1
- package/lib/directors/WarehousingAdapter.js.map +1 -1
- package/lib/directors/WarehousingDirector.d.ts +5 -5
- package/lib/directors/WarehousingDirector.d.ts.map +1 -1
- package/lib/directors/WarehousingDirector.js +10 -13
- package/lib/directors/WarehousingDirector.js.map +1 -1
- package/lib/directors/WorkerAdapter.d.ts +3 -2
- package/lib/directors/WorkerAdapter.d.ts.map +1 -1
- package/lib/directors/WorkerAdapter.js +1 -1
- package/lib/directors/WorkerAdapter.js.map +1 -1
- package/lib/directors/WorkerDirector.d.ts +2 -2
- package/lib/directors/WorkerDirector.d.ts.map +1 -1
- package/lib/directors/WorkerDirector.js +2 -3
- package/lib/directors/WorkerDirector.js.map +1 -1
- package/lib/factory/index.d.ts +3 -0
- package/lib/factory/index.d.ts.map +1 -0
- package/lib/factory/index.js +3 -0
- package/lib/factory/index.js.map +1 -0
- package/lib/factory/registerProductDiscoverabilityFilter.d.ts +5 -0
- package/lib/factory/registerProductDiscoverabilityFilter.d.ts.map +1 -0
- package/lib/factory/registerProductDiscoverabilityFilter.js +27 -0
- package/lib/factory/registerProductDiscoverabilityFilter.js.map +1 -0
- package/lib/modules.d.ts +4 -5
- package/lib/modules.d.ts.map +1 -1
- package/lib/modules.js +3 -3
- package/lib/modules.js.map +1 -1
- package/lib/services/activateEnrollment.d.ts.map +1 -1
- package/lib/services/activateEnrollment.js +8 -12
- package/lib/services/activateEnrollment.js.map +1 -1
- package/lib/services/addMessage.d.ts +4 -0
- package/lib/services/addMessage.d.ts.map +1 -0
- package/lib/services/addMessage.js +15 -0
- package/lib/services/addMessage.js.map +1 -0
- package/lib/services/calculateDiscountTotal.js +2 -2
- package/lib/services/calculateDiscountTotal.js.map +1 -1
- package/lib/services/checkoutOrder.d.ts +1 -1
- package/lib/services/checkoutOrder.d.ts.map +1 -1
- package/lib/services/checkoutOrder.js +10 -4
- package/lib/services/checkoutOrder.js.map +1 -1
- package/lib/services/confirmOrder.d.ts +1 -1
- package/lib/services/confirmOrder.d.ts.map +1 -1
- package/lib/services/createDownloadStream.d.ts +1 -1
- package/lib/services/createDownloadStream.d.ts.map +1 -1
- package/lib/services/createDownloadStream.js +2 -0
- package/lib/services/createDownloadStream.js.map +1 -1
- package/lib/services/createEnrollmentFromCheckout.d.ts.map +1 -1
- package/lib/services/createEnrollmentFromCheckout.js +2 -2
- package/lib/services/createEnrollmentFromCheckout.js.map +1 -1
- package/lib/services/createManualOrderDiscount.d.ts +2 -2
- package/lib/services/createManualOrderDiscount.d.ts.map +1 -1
- package/lib/services/createSignedURL.d.ts.map +1 -1
- package/lib/services/createSignedURL.js +2 -0
- package/lib/services/createSignedURL.js.map +1 -1
- package/lib/services/deleteUser.d.ts +1 -1
- package/lib/services/deleteUser.d.ts.map +1 -1
- package/lib/services/deleteUser.js +4 -2
- package/lib/services/deleteUser.js.map +1 -1
- package/lib/services/discountedEntities.js.map +1 -1
- package/lib/services/findOrInitCart.d.ts +1 -2
- package/lib/services/findOrInitCart.d.ts.map +1 -1
- package/lib/services/findOrInitCart.js.map +1 -1
- package/lib/services/fullfillQuotation.d.ts +1 -1
- package/lib/services/fullfillQuotation.d.ts.map +1 -1
- package/lib/services/fullfillQuotation.js.map +1 -1
- package/lib/services/generateOrderFromEnrollment.d.ts +7 -0
- package/lib/services/generateOrderFromEnrollment.d.ts.map +1 -0
- package/lib/services/generateOrderFromEnrollment.js +34 -0
- package/lib/services/generateOrderFromEnrollment.js.map +1 -0
- package/lib/services/index.d.ts +6 -0
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/index.js +6 -0
- package/lib/services/index.js.map +1 -1
- package/lib/services/initCartProviders.d.ts.map +1 -1
- package/lib/services/initCartProviders.js +6 -2
- package/lib/services/initCartProviders.js.map +1 -1
- package/lib/services/initializeEnrollment.d.ts +1 -1
- package/lib/services/initializeEnrollment.d.ts.map +1 -1
- package/lib/services/initializeEnrollment.js +11 -12
- package/lib/services/initializeEnrollment.js.map +1 -1
- package/lib/services/linkFileService.d.ts +1 -1
- package/lib/services/linkFileService.d.ts.map +1 -1
- package/lib/services/linkFileService.js +3 -1
- package/lib/services/linkFileService.js.map +1 -1
- package/lib/services/loadFilterOptions.d.ts +2 -2
- package/lib/services/loadFilterOptions.d.ts.map +1 -1
- package/lib/services/migrateOrderCart.d.ts +1 -1
- package/lib/services/migrateOrderCart.d.ts.map +1 -1
- package/lib/services/nextUserCart.d.ts +1 -1
- package/lib/services/nextUserCart.d.ts.map +1 -1
- package/lib/services/nextUserCart.js +1 -1
- package/lib/services/nextUserCart.js.map +1 -1
- package/lib/services/processEnrollment.d.ts.map +1 -1
- package/lib/services/processEnrollment.js +13 -5
- package/lib/services/processEnrollment.js.map +1 -1
- package/lib/services/processOrder.d.ts.map +1 -1
- package/lib/services/processOrder.js +30 -30
- package/lib/services/processOrder.js.map +1 -1
- package/lib/services/processQuotation.d.ts.map +1 -1
- package/lib/services/processQuotation.js +10 -14
- package/lib/services/processQuotation.js.map +1 -1
- package/lib/services/proposeQuotation.d.ts +1 -1
- package/lib/services/proposeQuotation.d.ts.map +1 -1
- package/lib/services/proposeQuotation.js +2 -2
- package/lib/services/proposeQuotation.js.map +1 -1
- package/lib/services/registerPaymentCredentials.d.ts +1 -2
- package/lib/services/registerPaymentCredentials.d.ts.map +1 -1
- package/lib/services/registerPaymentCredentials.js +4 -6
- package/lib/services/registerPaymentCredentials.js.map +1 -1
- package/lib/services/rejectOrder.d.ts +1 -1
- package/lib/services/rejectOrder.d.ts.map +1 -1
- package/lib/services/rejectQuotation.d.ts +1 -1
- package/lib/services/rejectQuotation.d.ts.map +1 -1
- package/lib/services/rejectQuotation.js +2 -2
- package/lib/services/rejectQuotation.js.map +1 -1
- package/lib/services/removeFiles.js +2 -2
- package/lib/services/removeFiles.js.map +1 -1
- package/lib/services/removeProduct.d.ts.map +1 -1
- package/lib/services/removeProduct.js +4 -3
- package/lib/services/removeProduct.js.map +1 -1
- package/lib/services/searchAssortments.d.ts.map +1 -1
- package/lib/services/searchAssortments.js +3 -2
- package/lib/services/searchAssortments.js.map +1 -1
- package/lib/services/searchProducts.d.ts.map +1 -1
- package/lib/services/searchProducts.js +3 -2
- package/lib/services/searchProducts.js.map +1 -1
- package/lib/services/simulateProductDispatching.d.ts +1 -1
- package/lib/services/simulateProductDispatching.d.ts.map +1 -1
- package/lib/services/simulateProductInventory.d.ts +1 -1
- package/lib/services/simulateProductInventory.d.ts.map +1 -1
- package/lib/services/simulateProductInventory.js.map +1 -1
- package/lib/services/simulateProductPricing.d.ts +7 -4
- package/lib/services/simulateProductPricing.d.ts.map +1 -1
- package/lib/services/simulateProductPricing.js.map +1 -1
- package/lib/services/terminateEnrollment.d.ts.map +1 -1
- package/lib/services/terminateEnrollment.js +5 -9
- package/lib/services/terminateEnrollment.js.map +1 -1
- package/lib/services/updateCalculation.d.ts +2 -1
- package/lib/services/updateCalculation.d.ts.map +1 -1
- package/lib/services/updateCalculation.js +20 -12
- package/lib/services/updateCalculation.js.map +1 -1
- package/lib/services/updateScheduling.d.ts +1 -1
- package/lib/services/updateScheduling.d.ts.map +1 -1
- package/lib/services/updateScheduling.js +7 -11
- package/lib/services/updateScheduling.js.map +1 -1
- package/lib/services/updateUserAvatarAfterUpload.d.ts +1 -1
- package/lib/services/updateUserAvatarAfterUpload.d.ts.map +1 -1
- package/lib/services/updateUserAvatarAfterUpload.js.map +1 -1
- package/lib/services/uploadFileFromStream.d.ts.map +1 -1
- package/lib/services/uploadFileFromStream.js +4 -1
- package/lib/services/uploadFileFromStream.js.map +1 -1
- package/lib/services/uploadFileFromURL.d.ts +1 -2
- package/lib/services/uploadFileFromURL.d.ts.map +1 -1
- package/lib/services/uploadFileFromURL.js.map +1 -1
- package/lib/services/validateOrder.d.ts +1 -1
- package/lib/services/validateOrder.d.ts.map +1 -1
- package/lib/services/validateOrder.js +17 -24
- package/lib/services/validateOrder.js.map +1 -1
- package/lib/services/verifyQuotation.d.ts +1 -1
- package/lib/services/verifyQuotation.d.ts.map +1 -1
- package/lib/services/verifyQuotation.js +2 -2
- package/lib/services/verifyQuotation.js.map +1 -1
- package/package.json +21 -20
- package/src/bulk-importer/createBulkImporter.ts +205 -0
- package/src/bulk-importer/handlers/assortment/create.ts +118 -0
- package/src/bulk-importer/handlers/assortment/index.ts +3 -0
- package/src/bulk-importer/handlers/assortment/remove.ts +26 -0
- package/src/bulk-importer/handlers/assortment/update.ts +133 -0
- package/src/bulk-importer/handlers/assortment/upsertAssortmentChildren.ts +77 -0
- package/src/bulk-importer/handlers/assortment/upsertAssortmentFilters.ts +70 -0
- package/src/bulk-importer/handlers/assortment/upsertAssortmentProducts.ts +76 -0
- package/src/bulk-importer/handlers/assortment/upsertMedia.ts +76 -0
- package/src/bulk-importer/handlers/filter/create.ts +104 -0
- package/src/bulk-importer/handlers/filter/index.ts +3 -0
- package/src/bulk-importer/handlers/filter/remove.ts +25 -0
- package/src/bulk-importer/handlers/filter/update.ts +94 -0
- package/src/bulk-importer/handlers/product/create.ts +170 -0
- package/src/bulk-importer/handlers/product/index.ts +3 -0
- package/src/bulk-importer/handlers/product/remove.ts +27 -0
- package/src/bulk-importer/handlers/product/update.ts +175 -0
- package/src/bulk-importer/handlers/product/upsertMedia.ts +81 -0
- package/src/bulk-importer/handlers/product/upsertVariations.ts +110 -0
- package/src/bulk-importer/handlers/utils/convertTagsToLowerCase.ts +4 -0
- package/src/bulk-importer/index.ts +3 -0
- package/src/bulk-importer/upsertAsset.ts +50 -0
- package/src/core-index.ts +10 -7
- package/src/directors/BaseDiscountAdapter.test.ts +1 -1
- package/src/directors/BaseDiscountAdapter.ts +5 -5
- package/src/directors/BaseDiscountDirector.ts +2 -2
- package/src/directors/BasePricingAdapter.ts +2 -2
- package/src/directors/BasePricingDirector.ts +47 -44
- package/src/directors/BasePricingSheet.ts +1 -1
- package/src/directors/BaseWorker.ts +1 -1
- package/src/directors/DeliveryAdapter.ts +3 -5
- package/src/directors/DeliveryDirector.ts +33 -23
- package/src/directors/DeliveryPricingAdapter.ts +1 -1
- package/src/directors/DeliveryPricingDirector.ts +5 -6
- package/src/directors/DeliveryPricingSheet.ts +3 -2
- package/src/directors/EnrollmentAdapter.ts +9 -6
- package/src/directors/EnrollmentDirector.ts +9 -8
- package/src/directors/FilterAdapter.ts +3 -3
- package/src/directors/FilterDirector.ts +11 -12
- package/src/directors/MessagingDirector.ts +1 -1
- package/src/directors/OrderDiscountAdapter.ts +2 -2
- package/src/directors/OrderPricingAdapter.ts +2 -2
- package/src/directors/OrderPricingDirector.ts +3 -3
- package/src/directors/OrderPricingSheet.ts +3 -2
- package/src/directors/PaymentAdapter.ts +2 -2
- package/src/directors/PaymentDirector.ts +34 -10
- package/src/directors/PaymentPricingAdapter.ts +2 -2
- package/src/directors/PaymentPricingDirector.ts +6 -8
- package/src/directors/PaymentPricingSheet.ts +3 -2
- package/src/directors/ProductDiscountAdapter.ts +2 -2
- package/src/directors/ProductDiscountConfiguration.ts +1 -1
- package/src/directors/ProductPricingAdapter.ts +1 -1
- package/src/directors/ProductPricingDirector.ts +7 -7
- package/src/directors/ProductPricingSheet.ts +4 -3
- package/src/directors/QuotationAdapter.ts +2 -2
- package/src/directors/QuotationDirector.ts +2 -2
- package/src/directors/WarehousingAdapter.ts +3 -4
- package/src/directors/WarehousingDirector.ts +20 -23
- package/src/directors/WorkerAdapter.ts +9 -4
- package/src/directors/WorkerDirector.ts +5 -6
- package/src/factory/index.ts +3 -0
- package/src/factory/registerProductDiscoverabilityFilter.ts +36 -0
- package/src/modules.ts +6 -7
- package/src/services/activateEnrollment.ts +9 -13
- package/src/services/addMessage.ts +20 -0
- package/src/services/calculateDiscountTotal.ts +4 -4
- package/src/services/checkoutOrder.ts +10 -5
- package/src/services/createDownloadStream.ts +1 -0
- package/src/services/createEnrollmentFromCheckout.ts +22 -20
- package/src/services/createManualOrderDiscount.ts +2 -2
- package/src/services/createSignedURL.ts +1 -0
- package/src/services/deleteUser.ts +7 -2
- package/src/services/discountedEntities.ts +6 -6
- package/src/services/findOrInitCart.ts +1 -2
- package/src/services/fullfillQuotation.ts +1 -1
- package/src/services/generateOrderFromEnrollment.ts +54 -0
- package/src/services/index.ts +8 -0
- package/src/services/initCartProviders.ts +8 -10
- package/src/services/initializeEnrollment.ts +16 -13
- package/src/services/linkFileService.ts +3 -1
- package/src/services/nextUserCart.ts +1 -1
- package/src/services/processEnrollment.ts +18 -6
- package/src/services/processOrder.ts +37 -36
- package/src/services/processQuotation.ts +10 -14
- package/src/services/proposeQuotation.ts +2 -2
- package/src/services/registerPaymentCredentials.ts +6 -8
- package/src/services/rejectQuotation.ts +2 -2
- package/src/services/removeFiles.ts +2 -2
- package/src/services/removeProduct.ts +5 -3
- package/src/services/searchAssortments.ts +3 -2
- package/src/services/searchProducts.ts +4 -2
- package/src/services/simulateProductDispatching.ts +1 -1
- package/src/services/simulateProductInventory.ts +7 -3
- package/src/services/simulateProductPricing.ts +6 -3
- package/src/services/terminateEnrollment.ts +5 -9
- package/src/services/updateCalculation.ts +37 -20
- package/src/services/updateScheduling.ts +19 -20
- package/src/services/updateUserAvatarAfterUpload.ts +4 -1
- package/src/services/uploadFileFromStream.ts +3 -1
- package/src/services/uploadFileFromURL.ts +2 -2
- package/src/services/validateOrder.ts +34 -38
- package/src/services/verifyQuotation.ts +2 -2
|
@@ -2,7 +2,7 @@ import { BaseDirector, IBaseDirector } from '@unchainedshop/utils';
|
|
|
2
2
|
import { createLogger } from '@unchainedshop/logger';
|
|
3
3
|
import { PaymentError, IPaymentActions, IPaymentAdapter, PaymentContext } from './PaymentAdapter.js';
|
|
4
4
|
import { PaymentProvider } from '@unchainedshop/core-payment';
|
|
5
|
-
import { OrderPayment, OrderPaymentStatus } from '@unchainedshop/core-orders';
|
|
5
|
+
import { Order, OrderPayment, OrderPaymentStatus } from '@unchainedshop/core-orders';
|
|
6
6
|
|
|
7
7
|
const buildPaymentProviderActionsContext = (
|
|
8
8
|
orderPayment: OrderPayment,
|
|
@@ -19,7 +19,7 @@ const buildPaymentProviderActionsContext = (
|
|
|
19
19
|
|
|
20
20
|
export type IPaymentDirector = IBaseDirector<IPaymentAdapter> & {
|
|
21
21
|
confirmOrderPayment: (
|
|
22
|
-
|
|
22
|
+
order: Order,
|
|
23
23
|
paymentContext: {
|
|
24
24
|
transactionContext: any;
|
|
25
25
|
userId: string;
|
|
@@ -28,7 +28,7 @@ export type IPaymentDirector = IBaseDirector<IPaymentAdapter> & {
|
|
|
28
28
|
) => Promise<OrderPayment>;
|
|
29
29
|
|
|
30
30
|
cancelOrderPayment: (
|
|
31
|
-
|
|
31
|
+
order: Order,
|
|
32
32
|
paymentContext: {
|
|
33
33
|
transactionContext: any;
|
|
34
34
|
userId: string;
|
|
@@ -37,7 +37,7 @@ export type IPaymentDirector = IBaseDirector<IPaymentAdapter> & {
|
|
|
37
37
|
) => Promise<OrderPayment>;
|
|
38
38
|
|
|
39
39
|
chargeOrderPayment: (
|
|
40
|
-
|
|
40
|
+
order: Order,
|
|
41
41
|
context: {
|
|
42
42
|
transactionContext: any;
|
|
43
43
|
userId: string;
|
|
@@ -51,7 +51,7 @@ export type IPaymentDirector = IBaseDirector<IPaymentAdapter> & {
|
|
|
51
51
|
unchainedAPI,
|
|
52
52
|
) => Promise<IPaymentActions>;
|
|
53
53
|
};
|
|
54
|
-
const logger = createLogger('unchained:core
|
|
54
|
+
const logger = createLogger('unchained:core:payment');
|
|
55
55
|
const baseDirector = BaseDirector<IPaymentAdapter>('PaymentDirector');
|
|
56
56
|
|
|
57
57
|
export const PaymentDirector: IPaymentDirector = {
|
|
@@ -101,7 +101,7 @@ export const PaymentDirector: IPaymentDirector = {
|
|
|
101
101
|
try {
|
|
102
102
|
return adapter.isActive(paymentContext.transactionContext);
|
|
103
103
|
} catch (error) {
|
|
104
|
-
logger.error(error
|
|
104
|
+
logger.error(error);
|
|
105
105
|
return false;
|
|
106
106
|
}
|
|
107
107
|
},
|
|
@@ -110,7 +110,7 @@ export const PaymentDirector: IPaymentDirector = {
|
|
|
110
110
|
try {
|
|
111
111
|
return adapter.isPayLaterAllowed(paymentContext.transactionContext);
|
|
112
112
|
} catch (error) {
|
|
113
|
-
logger.error(error
|
|
113
|
+
logger.error(error);
|
|
114
114
|
return false;
|
|
115
115
|
}
|
|
116
116
|
},
|
|
@@ -143,7 +143,7 @@ export const PaymentDirector: IPaymentDirector = {
|
|
|
143
143
|
},
|
|
144
144
|
|
|
145
145
|
confirmOrderPayment: async (
|
|
146
|
-
|
|
146
|
+
order: Order,
|
|
147
147
|
paymentContext: {
|
|
148
148
|
transactionContext: any;
|
|
149
149
|
userId: string;
|
|
@@ -152,6 +152,14 @@ export const PaymentDirector: IPaymentDirector = {
|
|
|
152
152
|
): Promise<OrderPayment> => {
|
|
153
153
|
const { modules } = unchainedAPI;
|
|
154
154
|
|
|
155
|
+
const orderPayment =
|
|
156
|
+
order.paymentId &&
|
|
157
|
+
(await modules.orders.payments.findOrderPayment({
|
|
158
|
+
orderPaymentId: order.paymentId,
|
|
159
|
+
}));
|
|
160
|
+
|
|
161
|
+
if (!orderPayment) throw new Error('Order payment not set');
|
|
162
|
+
|
|
155
163
|
if (modules.orders.payments.normalizedStatus(orderPayment) !== OrderPaymentStatus.PAID) {
|
|
156
164
|
return orderPayment;
|
|
157
165
|
}
|
|
@@ -178,7 +186,7 @@ export const PaymentDirector: IPaymentDirector = {
|
|
|
178
186
|
},
|
|
179
187
|
|
|
180
188
|
cancelOrderPayment: async (
|
|
181
|
-
|
|
189
|
+
order: Order,
|
|
182
190
|
paymentContext: {
|
|
183
191
|
transactionContext: any;
|
|
184
192
|
userId: string;
|
|
@@ -187,6 +195,14 @@ export const PaymentDirector: IPaymentDirector = {
|
|
|
187
195
|
): Promise<OrderPayment> => {
|
|
188
196
|
const { modules } = unchainedAPI;
|
|
189
197
|
|
|
198
|
+
const orderPayment =
|
|
199
|
+
order.paymentId &&
|
|
200
|
+
(await modules.orders.payments.findOrderPayment({
|
|
201
|
+
orderPaymentId: order.paymentId,
|
|
202
|
+
}));
|
|
203
|
+
|
|
204
|
+
if (!orderPayment) throw new Error('Order payment not set');
|
|
205
|
+
|
|
190
206
|
if (modules.orders.payments.normalizedStatus(orderPayment) !== OrderPaymentStatus.PAID) {
|
|
191
207
|
return orderPayment;
|
|
192
208
|
}
|
|
@@ -212,7 +228,7 @@ export const PaymentDirector: IPaymentDirector = {
|
|
|
212
228
|
},
|
|
213
229
|
|
|
214
230
|
chargeOrderPayment: async (
|
|
215
|
-
|
|
231
|
+
order: Order,
|
|
216
232
|
context: {
|
|
217
233
|
transactionContext: any;
|
|
218
234
|
userId: string;
|
|
@@ -221,6 +237,14 @@ export const PaymentDirector: IPaymentDirector = {
|
|
|
221
237
|
): Promise<OrderPayment> => {
|
|
222
238
|
const { modules } = unchainedAPI;
|
|
223
239
|
|
|
240
|
+
const orderPayment =
|
|
241
|
+
order.paymentId &&
|
|
242
|
+
(await modules.orders.payments.findOrderPayment({
|
|
243
|
+
orderPaymentId: order.paymentId,
|
|
244
|
+
}));
|
|
245
|
+
|
|
246
|
+
if (!orderPayment) throw new Error('Order payment not set');
|
|
247
|
+
|
|
224
248
|
if (modules.orders.payments.normalizedStatus(orderPayment) !== OrderPaymentStatus.OPEN) {
|
|
225
249
|
return orderPayment;
|
|
226
250
|
}
|
|
@@ -20,8 +20,8 @@ export interface PaymentPricingCalculation extends PricingCalculation {
|
|
|
20
20
|
export interface PaymentPricingAdapterContext extends BasePricingAdapterContext {
|
|
21
21
|
countryCode?: string;
|
|
22
22
|
currency?: string;
|
|
23
|
-
user: User;
|
|
24
|
-
orderPayment
|
|
23
|
+
user: User | null;
|
|
24
|
+
orderPayment?: OrderPayment;
|
|
25
25
|
order: Order;
|
|
26
26
|
provider: PaymentProvider;
|
|
27
27
|
discounts: OrderDiscount[];
|
|
@@ -15,7 +15,7 @@ export type PaymentPricingContext =
|
|
|
15
15
|
| {
|
|
16
16
|
countryCode?: string;
|
|
17
17
|
currencyCode?: string;
|
|
18
|
-
user
|
|
18
|
+
user?: User;
|
|
19
19
|
order: Order;
|
|
20
20
|
provider: PaymentProvider;
|
|
21
21
|
providerContext?: any;
|
|
@@ -54,21 +54,20 @@ export const PaymentPricingDirector: IPaymentPricingDirector<any> = {
|
|
|
54
54
|
const provider = await modules.payment.paymentProviders.findProvider({
|
|
55
55
|
paymentProviderId: item.paymentProviderId,
|
|
56
56
|
});
|
|
57
|
-
const user = await modules.users.findUserById(order
|
|
57
|
+
const user = await modules.users.findUserById(order!.userId);
|
|
58
58
|
const discounts = await modules.orders.discounts.findOrderDiscounts({
|
|
59
59
|
orderId: item.orderId,
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
return {
|
|
63
63
|
...unchainedAPI,
|
|
64
|
-
countryCode: order
|
|
64
|
+
countryCode: order!.countryCode,
|
|
65
65
|
currencyCode,
|
|
66
|
-
order
|
|
67
|
-
provider
|
|
66
|
+
order: order!,
|
|
67
|
+
provider: provider!,
|
|
68
68
|
user,
|
|
69
69
|
discounts,
|
|
70
70
|
orderPayment: item,
|
|
71
|
-
providerContext: null,
|
|
72
71
|
};
|
|
73
72
|
}
|
|
74
73
|
|
|
@@ -78,9 +77,8 @@ export const PaymentPricingDirector: IPaymentPricingDirector<any> = {
|
|
|
78
77
|
currencyCode: context.currencyCode,
|
|
79
78
|
order: context.order,
|
|
80
79
|
provider: context.provider,
|
|
81
|
-
user: context.user,
|
|
80
|
+
user: context.user || null,
|
|
82
81
|
discounts: [],
|
|
83
|
-
orderPayment: null,
|
|
84
82
|
providerContext: context.providerContext,
|
|
85
83
|
};
|
|
86
84
|
},
|
|
@@ -66,7 +66,8 @@ export const PaymentPricingSheet = (
|
|
|
66
66
|
category: PaymentPricingRowCategory.Discount,
|
|
67
67
|
discountId: explicitDiscountId,
|
|
68
68
|
})
|
|
69
|
-
.map(({ discountId }) => discountId)
|
|
69
|
+
.map(({ discountId }) => discountId)
|
|
70
|
+
.filter(Boolean) as string[];
|
|
70
71
|
|
|
71
72
|
return [...new Set(discountIds)]
|
|
72
73
|
.map((discountId) => {
|
|
@@ -83,7 +84,7 @@ export const PaymentPricingSheet = (
|
|
|
83
84
|
currencyCode: basePricingSheet.currencyCode,
|
|
84
85
|
};
|
|
85
86
|
})
|
|
86
|
-
.filter(Boolean);
|
|
87
|
+
.filter(Boolean) as { discountId: string; amount: number; currencyCode: string }[];
|
|
87
88
|
},
|
|
88
89
|
};
|
|
89
90
|
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
ProductDiscountConfiguration,
|
|
5
5
|
} from '../directors/index.js';
|
|
6
6
|
|
|
7
|
-
export const ProductDiscountAdapter
|
|
7
|
+
export const ProductDiscountAdapter = BaseDiscountAdapter as Omit<
|
|
8
8
|
IDiscountAdapter<ProductDiscountConfiguration>,
|
|
9
9
|
'key' | 'label' | 'version'
|
|
10
|
-
|
|
10
|
+
>;
|
|
@@ -10,7 +10,7 @@ type ResolvedConfiguration = {
|
|
|
10
10
|
export type PriceConfigurationResolver = (
|
|
11
11
|
product: Product,
|
|
12
12
|
quantity: number,
|
|
13
|
-
configuration
|
|
13
|
+
configuration?: ProductConfiguration[],
|
|
14
14
|
) => ResolvedConfiguration | null;
|
|
15
15
|
|
|
16
16
|
export interface ProductDiscountConfiguration extends ResolvedConfiguration {
|
|
@@ -16,7 +16,7 @@ export interface ProductPricingAdapterContext extends BasePricingAdapterContext
|
|
|
16
16
|
currencyCode: string;
|
|
17
17
|
product: Product;
|
|
18
18
|
quantity: number;
|
|
19
|
-
configuration
|
|
19
|
+
configuration?: ProductConfiguration[];
|
|
20
20
|
order?: Order;
|
|
21
21
|
user?: User;
|
|
22
22
|
}
|
|
@@ -16,9 +16,9 @@ export type ProductPricingContext =
|
|
|
16
16
|
currencyCode: string;
|
|
17
17
|
countryCode: string;
|
|
18
18
|
quantity: number;
|
|
19
|
-
discounts
|
|
19
|
+
discounts: OrderDiscount[];
|
|
20
20
|
order?: Order;
|
|
21
|
-
product
|
|
21
|
+
product: Product;
|
|
22
22
|
configuration?: ProductConfiguration[];
|
|
23
23
|
user?: User;
|
|
24
24
|
}
|
|
@@ -59,21 +59,21 @@ export const ProductPricingDirector: IProductPricingDirector<any> = {
|
|
|
59
59
|
const order = await modules.orders.findOrder({
|
|
60
60
|
orderId: item.orderId,
|
|
61
61
|
});
|
|
62
|
-
const user = await modules.users.findUserById(order
|
|
62
|
+
const user = await modules.users.findUserById(order!.userId);
|
|
63
63
|
const discounts = await modules.orders.discounts.findOrderDiscounts({
|
|
64
64
|
orderId: item.orderId,
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
return {
|
|
68
68
|
...unchainedAPI,
|
|
69
|
-
countryCode: order
|
|
69
|
+
countryCode: order!.countryCode,
|
|
70
70
|
currencyCode,
|
|
71
71
|
discounts,
|
|
72
|
-
order
|
|
73
|
-
product
|
|
72
|
+
order: order!,
|
|
73
|
+
product: product!,
|
|
74
74
|
quantity,
|
|
75
75
|
configuration: item.configuration,
|
|
76
|
-
user
|
|
76
|
+
user: user!,
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -33,7 +33,7 @@ export interface IProductPricingSheet extends IPricingSheet<ProductPricingCalcul
|
|
|
33
33
|
meta?: any;
|
|
34
34
|
}) => void;
|
|
35
35
|
|
|
36
|
-
unitPrice: (params
|
|
36
|
+
unitPrice: (params: { useNetPrice?: boolean }) => Price;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export const ProductPricingSheet = (
|
|
@@ -99,7 +99,8 @@ export const ProductPricingSheet = (
|
|
|
99
99
|
category: ProductPricingRowCategory.Discount,
|
|
100
100
|
discountId: explicitDiscountId,
|
|
101
101
|
})
|
|
102
|
-
.map(({ discountId }) => discountId)
|
|
102
|
+
.map(({ discountId }) => discountId)
|
|
103
|
+
.filter(Boolean) as string[];
|
|
103
104
|
|
|
104
105
|
return [...new Set(discountIds)]
|
|
105
106
|
.map((discountId) => {
|
|
@@ -116,7 +117,7 @@ export const ProductPricingSheet = (
|
|
|
116
117
|
currencyCode: basePricingSheet.currencyCode,
|
|
117
118
|
};
|
|
118
119
|
})
|
|
119
|
-
.filter(Boolean);
|
|
120
|
+
.filter(Boolean) as { discountId: string; amount: number; currencyCode: string }[];
|
|
120
121
|
},
|
|
121
122
|
};
|
|
122
123
|
|
|
@@ -10,7 +10,7 @@ export interface QuotationContext {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export interface QuotationAdapterActions {
|
|
13
|
-
configurationError: () => QuotationError;
|
|
13
|
+
configurationError: () => QuotationError | null;
|
|
14
14
|
isManualProposalRequired: () => Promise<boolean>;
|
|
15
15
|
isManualRequestVerificationRequired: () => Promise<boolean>;
|
|
16
16
|
quote: () => Promise<QuotationProposal>;
|
|
@@ -20,7 +20,7 @@ export interface QuotationAdapterActions {
|
|
|
20
20
|
|
|
21
21
|
transformItemConfiguration: (
|
|
22
22
|
params: QuotationItemConfiguration,
|
|
23
|
-
) => Promise<QuotationItemConfiguration>;
|
|
23
|
+
) => Promise<QuotationItemConfiguration | null>;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export type IQuotationAdapter = IBaseAdapter & {
|
|
@@ -65,7 +65,7 @@ export const QuotationDirector: IQuotationDirector = {
|
|
|
65
65
|
...error,
|
|
66
66
|
},
|
|
67
67
|
);
|
|
68
|
-
return
|
|
68
|
+
return true;
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
|
|
@@ -77,7 +77,7 @@ export const QuotationDirector: IQuotationDirector = {
|
|
|
77
77
|
logger.error('QuotationDirector -> Error while checking if is manual proposal required', {
|
|
78
78
|
...error,
|
|
79
79
|
});
|
|
80
|
-
return
|
|
80
|
+
return true;
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
|
|
@@ -16,14 +16,14 @@ export enum WarehousingError {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface WarehousingAdapterActions {
|
|
19
|
-
configurationError: () => WarehousingError;
|
|
19
|
+
configurationError: () => WarehousingError | null;
|
|
20
20
|
isActive: () => boolean;
|
|
21
21
|
stock: (referenceDate: Date) => Promise<number>;
|
|
22
22
|
productionTime: (quantityToProduce: number) => Promise<number>;
|
|
23
23
|
commissioningTime: (quantity: number) => Promise<number>;
|
|
24
24
|
tokenize: () => Promise<Omit<TokenSurrogate, 'userId' | 'productId' | 'orderPositionId'>[]>;
|
|
25
|
-
tokenMetadata: (
|
|
26
|
-
isInvalidateable: (
|
|
25
|
+
tokenMetadata: (tokenSerialNumber: string, referenceDate: Date) => Promise<any>;
|
|
26
|
+
isInvalidateable: (tokenSerialNumber: string, referenceDate: Date) => Promise<boolean>;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export interface WarehousingContext {
|
|
@@ -34,7 +34,6 @@ export interface WarehousingContext {
|
|
|
34
34
|
referenceDate?: Date;
|
|
35
35
|
locale?: Intl.Locale;
|
|
36
36
|
order?: Order;
|
|
37
|
-
warehousingProviderId?: string;
|
|
38
37
|
orderPosition?: OrderPosition;
|
|
39
38
|
}
|
|
40
39
|
|
|
@@ -28,13 +28,13 @@ export interface WarehousingInterface {
|
|
|
28
28
|
export type IWarehousingDirector = IBaseDirector<IWarehousingAdapter> & {
|
|
29
29
|
tokenMetadata: (
|
|
30
30
|
virtualProviders: WarehousingProvider[],
|
|
31
|
-
warehousingContext: WarehousingContext & { token: {
|
|
31
|
+
warehousingContext: WarehousingContext & { token: { tokenSerialNumber: string } },
|
|
32
32
|
unchainedAPI,
|
|
33
33
|
) => Promise<any>;
|
|
34
34
|
|
|
35
35
|
isInvalidateable: (
|
|
36
36
|
virtualProviders: WarehousingProvider[],
|
|
37
|
-
warehousingContext: WarehousingContext & { token: {
|
|
37
|
+
warehousingContext: WarehousingContext & { token: { tokenSerialNumber: string } },
|
|
38
38
|
unchainedAPI,
|
|
39
39
|
) => Promise<any>;
|
|
40
40
|
|
|
@@ -43,13 +43,13 @@ export type IWarehousingDirector = IBaseDirector<IWarehousingAdapter> & {
|
|
|
43
43
|
warehousingContext: WarehousingContext,
|
|
44
44
|
unchainedAPI: { modules: Modules },
|
|
45
45
|
) => Promise<{
|
|
46
|
-
configurationError: () => WarehousingError;
|
|
46
|
+
configurationError: () => WarehousingError | null;
|
|
47
47
|
isActive: () => boolean;
|
|
48
48
|
estimatedStock: () => Promise<EstimatedStock>;
|
|
49
49
|
estimatedDispatch: () => Promise<EstimatedDispatch>;
|
|
50
50
|
tokenize: () => Promise<TokenSurrogate[]>;
|
|
51
|
-
tokenMetadata: (
|
|
52
|
-
isInvalidateable: (
|
|
51
|
+
tokenMetadata: (tokenSerialNumber: string) => Promise<any>;
|
|
52
|
+
isInvalidateable: (tokenSerialNumber: string) => Promise<boolean>;
|
|
53
53
|
}>;
|
|
54
54
|
};
|
|
55
55
|
|
|
@@ -81,9 +81,9 @@ export const WarehousingDirector: IWarehousingDirector = {
|
|
|
81
81
|
try {
|
|
82
82
|
const { quantity } = context;
|
|
83
83
|
const stock = await adapter.stock(referenceDate);
|
|
84
|
-
const notInStockQuantity = Math.max(quantity - stock, 0);
|
|
84
|
+
const notInStockQuantity = Math.max((quantity || 1) - stock, 0);
|
|
85
85
|
const productionTime = await adapter.productionTime(notInStockQuantity);
|
|
86
|
-
const commissioningTime = await adapter.commissioningTime(quantity);
|
|
86
|
+
const commissioningTime = await adapter.commissioningTime(quantity || 1);
|
|
87
87
|
return Math.max(commissioningTime + productionTime, 0);
|
|
88
88
|
} catch (error) {
|
|
89
89
|
logger.error(error);
|
|
@@ -130,10 +130,7 @@ export const WarehousingDirector: IWarehousingDirector = {
|
|
|
130
130
|
|
|
131
131
|
const warehousingThroughputTime = await throughputTime(referenceDate);
|
|
132
132
|
if (!Number.isFinite(warehousingThroughputTime)) {
|
|
133
|
-
return {
|
|
134
|
-
shipping: null,
|
|
135
|
-
earliestDelivery: null,
|
|
136
|
-
};
|
|
133
|
+
return {};
|
|
137
134
|
}
|
|
138
135
|
|
|
139
136
|
// Calculate shipping date
|
|
@@ -141,12 +138,12 @@ export const WarehousingDirector: IWarehousingDirector = {
|
|
|
141
138
|
const shipping = new Date(shippingTimestamp);
|
|
142
139
|
|
|
143
140
|
// Calculate earliest delivery date
|
|
144
|
-
const actions = await DeliveryDirector.actions(deliveryProvider
|
|
141
|
+
const actions = await DeliveryDirector.actions(deliveryProvider!, context, unchainedAPI);
|
|
145
142
|
const deliveryThroughputTime =
|
|
146
143
|
await actions.estimatedDeliveryThroughput(warehousingThroughputTime);
|
|
147
144
|
const earliestDelivery = Number.isFinite(deliveryThroughputTime)
|
|
148
|
-
? new Date(shippingTimestamp + deliveryThroughputTime)
|
|
149
|
-
:
|
|
145
|
+
? new Date(shippingTimestamp + deliveryThroughputTime!)
|
|
146
|
+
: undefined;
|
|
150
147
|
|
|
151
148
|
return {
|
|
152
149
|
shipping,
|
|
@@ -158,10 +155,10 @@ export const WarehousingDirector: IWarehousingDirector = {
|
|
|
158
155
|
}
|
|
159
156
|
},
|
|
160
157
|
|
|
161
|
-
tokenMetadata: async (
|
|
158
|
+
tokenMetadata: async (tokenSerialNumber) => {
|
|
162
159
|
try {
|
|
163
160
|
const referenceDate = getReferenceDate(context);
|
|
164
|
-
const tokenMetadata = await adapter.tokenMetadata(
|
|
161
|
+
const tokenMetadata = await adapter.tokenMetadata(tokenSerialNumber, referenceDate);
|
|
165
162
|
return tokenMetadata;
|
|
166
163
|
} catch (error) {
|
|
167
164
|
logger.error(error);
|
|
@@ -169,10 +166,10 @@ export const WarehousingDirector: IWarehousingDirector = {
|
|
|
169
166
|
}
|
|
170
167
|
},
|
|
171
168
|
|
|
172
|
-
isInvalidateable: async (
|
|
169
|
+
isInvalidateable: async (tokenSerialNumber) => {
|
|
173
170
|
try {
|
|
174
171
|
const referenceDate = getReferenceDate(context);
|
|
175
|
-
const isInvalidateable = await adapter.isInvalidateable(
|
|
172
|
+
const isInvalidateable = await adapter.isInvalidateable(tokenSerialNumber, referenceDate);
|
|
176
173
|
return isInvalidateable;
|
|
177
174
|
} catch (error) {
|
|
178
175
|
logger.error(error);
|
|
@@ -187,9 +184,9 @@ export const WarehousingDirector: IWarehousingDirector = {
|
|
|
187
184
|
return tokens.map((token) => {
|
|
188
185
|
return {
|
|
189
186
|
...token,
|
|
190
|
-
userId: order
|
|
191
|
-
productId: orderPosition
|
|
192
|
-
orderPositionId: orderPosition
|
|
187
|
+
userId: order!.userId,
|
|
188
|
+
productId: orderPosition!.productId,
|
|
189
|
+
orderPositionId: orderPosition!._id,
|
|
193
190
|
};
|
|
194
191
|
});
|
|
195
192
|
} catch (error) {
|
|
@@ -211,7 +208,7 @@ export const WarehousingDirector: IWarehousingDirector = {
|
|
|
211
208
|
);
|
|
212
209
|
const isActive = await currentDirector.isActive();
|
|
213
210
|
if (isActive) {
|
|
214
|
-
return currentDirector.tokenMetadata(warehousingContext.token.
|
|
211
|
+
return currentDirector.tokenMetadata(warehousingContext.token.tokenSerialNumber);
|
|
215
212
|
}
|
|
216
213
|
return null;
|
|
217
214
|
}, Promise.resolve(null));
|
|
@@ -228,7 +225,7 @@ export const WarehousingDirector: IWarehousingDirector = {
|
|
|
228
225
|
);
|
|
229
226
|
const isActive = await currentDirector.isActive();
|
|
230
227
|
if (isActive) {
|
|
231
|
-
return currentDirector.isInvalidateable(warehousingContext.token.
|
|
228
|
+
return currentDirector.isInvalidateable(warehousingContext.token.tokenSerialNumber);
|
|
232
229
|
}
|
|
233
230
|
return null;
|
|
234
231
|
}, Promise.resolve(null));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseAdapter, IBaseAdapter } from '@unchainedshop/utils';
|
|
2
2
|
import { WorkResult } from '@unchainedshop/core-worker';
|
|
3
|
-
import { Modules } from '../modules.js';
|
|
3
|
+
import { ModuleOptions, Modules } from '../modules.js';
|
|
4
4
|
import { Services } from '../services/index.js';
|
|
5
|
-
import { BulkImporter } from '../
|
|
5
|
+
import { BulkImporter } from '../bulk-importer/index.js';
|
|
6
6
|
|
|
7
7
|
export type IWorkerAdapter<Input, Output> = IBaseAdapter & {
|
|
8
8
|
type: string;
|
|
@@ -11,7 +11,12 @@ export type IWorkerAdapter<Input, Output> = IBaseAdapter & {
|
|
|
11
11
|
|
|
12
12
|
doWork: (
|
|
13
13
|
input: Input,
|
|
14
|
-
unchainedAPI: {
|
|
14
|
+
unchainedAPI: {
|
|
15
|
+
modules: Modules;
|
|
16
|
+
services: Services;
|
|
17
|
+
bulkImporter: BulkImporter;
|
|
18
|
+
options: ModuleOptions;
|
|
19
|
+
},
|
|
15
20
|
workId: string,
|
|
16
21
|
) => Promise<WorkResult<Output>>;
|
|
17
22
|
};
|
|
@@ -21,6 +26,6 @@ export const WorkerAdapter: Omit<IWorkerAdapter<any, void>, 'key' | 'label' | 't
|
|
|
21
26
|
external: false,
|
|
22
27
|
|
|
23
28
|
async doWork() {
|
|
24
|
-
return { success: false
|
|
29
|
+
return { success: false };
|
|
25
30
|
},
|
|
26
31
|
};
|
|
@@ -13,7 +13,7 @@ export type WorkScheduleConfiguration = Pick<
|
|
|
13
13
|
> & {
|
|
14
14
|
type: string;
|
|
15
15
|
input?: (workData: Omit<WorkData, 'input'>) => Promise<Record<string, any> | null>;
|
|
16
|
-
schedule
|
|
16
|
+
schedule?: ScheduleData;
|
|
17
17
|
scheduleId?: string;
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -24,7 +24,7 @@ export type IWorkerDirector = IBaseDirector<IWorkerAdapter<any, any>> & {
|
|
|
24
24
|
configureAutoscheduling: (workScheduleConfiguration: WorkScheduleConfiguration) => void;
|
|
25
25
|
getAutoSchedules: () => [string, WorkScheduleConfiguration][];
|
|
26
26
|
doWork: (work: Work, unchainedAPI) => Promise<WorkResult>;
|
|
27
|
-
processNextWork: (unchainedAPI: { modules: Modules }, workerId?: string) => Promise<Work>;
|
|
27
|
+
processNextWork: (unchainedAPI: { modules: Modules }, workerId?: string) => Promise<Work | null>;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
const AutoScheduleMap = new Map<string, WorkScheduleConfiguration>();
|
|
@@ -36,7 +36,7 @@ const baseDirector = BaseDirector<IWorkerAdapter<any, any>>('WorkerDirector', {
|
|
|
36
36
|
export const WorkerDirector: IWorkerDirector = {
|
|
37
37
|
...baseDirector,
|
|
38
38
|
|
|
39
|
-
getActivePluginTypes: ({ external } = {
|
|
39
|
+
getActivePluginTypes: ({ external } = {}) => {
|
|
40
40
|
return WorkerDirector.getAdapters()
|
|
41
41
|
.filter((adapter) => {
|
|
42
42
|
if (external === null || external === undefined) return true;
|
|
@@ -55,8 +55,7 @@ export const WorkerDirector: IWorkerDirector = {
|
|
|
55
55
|
},
|
|
56
56
|
|
|
57
57
|
disableAutoscheduling: (type) => {
|
|
58
|
-
|
|
59
|
-
AutoScheduleMap.set(type, { ...config, schedule: null });
|
|
58
|
+
AutoScheduleMap.delete(type);
|
|
60
59
|
},
|
|
61
60
|
|
|
62
61
|
unregisterAdapter: (key) => {
|
|
@@ -110,7 +109,7 @@ export const WorkerDirector: IWorkerDirector = {
|
|
|
110
109
|
}
|
|
111
110
|
},
|
|
112
111
|
|
|
113
|
-
processNextWork: async (unchainedAPI: { modules: Modules }, workerId?: string)
|
|
112
|
+
processNextWork: async (unchainedAPI: { modules: Modules }, workerId?: string) => {
|
|
114
113
|
const adapters = WorkerDirector.getAdapters();
|
|
115
114
|
|
|
116
115
|
const allocationMap = await unchainedAPI.modules.worker.allocationMap();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FilterAdapter, FilterDirector } from '../core-index.js';
|
|
2
|
+
|
|
3
|
+
export default function registerProductDiscoverabilityFilter({
|
|
4
|
+
orderIndex = 0,
|
|
5
|
+
hiddenTagValue = 'hidden',
|
|
6
|
+
}: {
|
|
7
|
+
orderIndex?: number;
|
|
8
|
+
hiddenTagValue?: string;
|
|
9
|
+
}) {
|
|
10
|
+
FilterDirector.registerAdapter({
|
|
11
|
+
...FilterAdapter,
|
|
12
|
+
|
|
13
|
+
key: `shop.unchained.filters.product-discoverability-${crypto.randomUUID()}`,
|
|
14
|
+
label: 'Product Discoverability Filter',
|
|
15
|
+
version: '1.0.0',
|
|
16
|
+
orderIndex,
|
|
17
|
+
|
|
18
|
+
actions: (params) => {
|
|
19
|
+
return {
|
|
20
|
+
...FilterAdapter.actions(params),
|
|
21
|
+
|
|
22
|
+
transformProductSelector: async (lastSelector, options) => {
|
|
23
|
+
const { key } = options || {};
|
|
24
|
+
|
|
25
|
+
if (!key) {
|
|
26
|
+
const newSelector = { ...lastSelector };
|
|
27
|
+
if (!newSelector.$and) newSelector.$and = [];
|
|
28
|
+
newSelector.$and.push({ tags: { $ne: hiddenTagValue } });
|
|
29
|
+
return newSelector;
|
|
30
|
+
}
|
|
31
|
+
return lastSelector;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
package/src/modules.ts
CHANGED
|
@@ -69,17 +69,17 @@ export interface ModuleOptions {
|
|
|
69
69
|
assortments?: AssortmentsSettingsOptions;
|
|
70
70
|
products?: ProductsSettingsOptions;
|
|
71
71
|
delivery?: DeliverySettingsOptions;
|
|
72
|
+
payment?: PaymentSettingsOptions;
|
|
72
73
|
filters?: FiltersSettingsOptions;
|
|
73
74
|
enrollments?: EnrollmentsSettingsOptions;
|
|
74
75
|
orders?: OrdersSettingsOptions;
|
|
75
76
|
quotations?: QuotationsSettingsOptions;
|
|
76
77
|
files?: FilesSettingsOptions;
|
|
77
|
-
payment?: PaymentSettingsOptions;
|
|
78
78
|
worker?: WorkerSettingsOptions;
|
|
79
79
|
users?: UserSettingsOptions;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
export default async function initModules(
|
|
83
83
|
{
|
|
84
84
|
db,
|
|
85
85
|
migrationRepository,
|
|
@@ -87,7 +87,7 @@ const initModules = async (
|
|
|
87
87
|
}: {
|
|
88
88
|
db: mongodb.Db;
|
|
89
89
|
migrationRepository: MigrationRepository<unknown>;
|
|
90
|
-
options
|
|
90
|
+
options: ModuleOptions;
|
|
91
91
|
},
|
|
92
92
|
customModules: Record<
|
|
93
93
|
string,
|
|
@@ -95,7 +95,7 @@ const initModules = async (
|
|
|
95
95
|
configure: (params: ModuleInput<any>) => any;
|
|
96
96
|
}
|
|
97
97
|
>,
|
|
98
|
-
): Promise<Modules>
|
|
98
|
+
): Promise<Modules> {
|
|
99
99
|
const assortments = await configureAssortmentsModule({
|
|
100
100
|
db,
|
|
101
101
|
options: options.assortments,
|
|
@@ -154,6 +154,7 @@ const initModules = async (
|
|
|
154
154
|
const products = await configureProductsModule({
|
|
155
155
|
db,
|
|
156
156
|
migrationRepository,
|
|
157
|
+
options: options.products,
|
|
157
158
|
});
|
|
158
159
|
const quotations = await configureQuotationsModule({
|
|
159
160
|
db,
|
|
@@ -203,6 +204,4 @@ const initModules = async (
|
|
|
203
204
|
}
|
|
204
205
|
|
|
205
206
|
return modules;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export default initModules;
|
|
207
|
+
}
|