@unchainedshop/core 3.0.0-alpha7 → 3.0.0-rc2
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/core-index.d.ts +8 -61
- package/lib/core-index.d.ts.map +1 -1
- package/lib/core-index.js +9 -140
- package/lib/core-index.js.map +1 -1
- package/lib/core-index_BACKUP_57582.d.ts +26 -0
- package/lib/core-index_BACKUP_57582.d.ts.map +1 -0
- package/lib/core-index_BACKUP_57582.js +30 -0
- package/lib/core-index_BACKUP_57582.js.map +1 -0
- package/lib/core-index_BASE_57582.d.ts +74 -0
- package/lib/core-index_BASE_57582.d.ts.map +1 -0
- package/lib/core-index_BASE_57582.js +145 -0
- package/lib/core-index_BASE_57582.js.map +1 -0
- package/lib/core-index_LOCAL_57582.d.ts +26 -0
- package/lib/core-index_LOCAL_57582.d.ts.map +1 -0
- package/lib/core-index_LOCAL_57582.js +31 -0
- package/lib/core-index_LOCAL_57582.js.map +1 -0
- package/lib/core-index_REMOTE_57582.d.ts +74 -0
- package/lib/core-index_REMOTE_57582.d.ts.map +1 -0
- package/lib/core-index_REMOTE_57582.js +146 -0
- package/lib/core-index_REMOTE_57582.js.map +1 -0
- package/lib/directors/BaseDiscountAdapter.d.ts +38 -0
- package/lib/directors/BaseDiscountAdapter.d.ts.map +1 -0
- package/lib/directors/BaseDiscountAdapter.js +48 -0
- package/lib/directors/BaseDiscountAdapter.js.map +1 -0
- package/lib/directors/BaseDiscountDirector.d.ts +12 -0
- package/lib/directors/BaseDiscountDirector.d.ts.map +1 -0
- package/lib/directors/BaseDiscountDirector.js +45 -0
- package/lib/directors/BaseDiscountDirector.js.map +1 -0
- package/lib/directors/BasePricingAdapter.d.ts +39 -0
- package/lib/directors/BasePricingAdapter.d.ts.map +1 -0
- package/lib/directors/BasePricingAdapter.js +25 -0
- package/lib/directors/BasePricingAdapter.js.map +1 -0
- package/lib/directors/BasePricingDirector.d.ts +17 -0
- package/lib/directors/BasePricingDirector.d.ts.map +1 -0
- package/lib/directors/BasePricingDirector.js +70 -0
- package/lib/directors/BasePricingDirector.js.map +1 -0
- package/lib/directors/BasePricingSheet.d.ts +46 -0
- package/lib/directors/BasePricingSheet.d.ts.map +1 -0
- package/lib/directors/BasePricingSheet.js +74 -0
- package/lib/directors/BasePricingSheet.js.map +1 -0
- package/lib/directors/DeliveryAdapter.d.ts +46 -0
- package/lib/directors/DeliveryAdapter.d.ts.map +1 -0
- package/lib/directors/DeliveryAdapter.js +50 -0
- package/lib/directors/DeliveryAdapter.js.map +1 -0
- package/lib/directors/DeliveryDirector.d.ts +15 -0
- package/lib/directors/DeliveryDirector.d.ts.map +1 -0
- package/lib/directors/DeliveryDirector.js +96 -0
- package/lib/directors/DeliveryDirector.js.map +1 -0
- package/lib/directors/DeliveryPricingAdapter.d.ts +49 -0
- package/lib/directors/DeliveryPricingAdapter.d.ts.map +1 -0
- package/lib/directors/DeliveryPricingAdapter.js +25 -0
- package/lib/directors/DeliveryPricingAdapter.js.map +1 -0
- package/lib/directors/DeliveryPricingDirector.d.ts +20 -0
- package/lib/directors/DeliveryPricingDirector.d.ts.map +1 -0
- package/lib/directors/DeliveryPricingDirector.js +50 -0
- package/lib/directors/DeliveryPricingDirector.js.map +1 -0
- package/lib/directors/DeliveryPricingSheet.d.ts +10 -0
- package/lib/directors/DeliveryPricingSheet.d.ts.map +1 -0
- package/lib/directors/DeliveryPricingSheet.js +75 -0
- package/lib/directors/DeliveryPricingSheet.js.map +1 -0
- package/lib/directors/EnrollmentAdapter.d.ts +27 -0
- package/lib/directors/EnrollmentAdapter.d.ts.map +1 -0
- package/lib/directors/EnrollmentAdapter.js +73 -0
- package/lib/directors/EnrollmentAdapter.js.map +1 -0
- package/lib/directors/EnrollmentDirector.d.ts +14 -0
- package/lib/directors/EnrollmentDirector.d.ts.map +1 -0
- package/lib/directors/EnrollmentDirector.js +44 -0
- package/lib/directors/EnrollmentDirector.js.map +1 -0
- package/lib/directors/FilterAdapter.d.ts +54 -0
- package/lib/directors/FilterAdapter.d.ts.map +1 -0
- package/lib/directors/FilterAdapter.js +38 -0
- package/lib/directors/FilterAdapter.js.map +1 -0
- package/lib/directors/FilterDirector.d.ts +40 -0
- package/lib/directors/FilterDirector.d.ts.map +1 -0
- package/lib/directors/FilterDirector.js +173 -0
- package/lib/directors/FilterDirector.js.map +1 -0
- package/lib/directors/MessagingDirector.d.ts +46 -0
- package/lib/directors/MessagingDirector.d.ts.map +1 -0
- package/lib/directors/MessagingDirector.js +10 -0
- package/lib/directors/MessagingDirector.js.map +1 -0
- package/lib/directors/OrderDiscountAdapter.d.ts +3 -0
- package/lib/directors/OrderDiscountAdapter.d.ts.map +1 -0
- package/lib/directors/OrderDiscountAdapter.js +3 -0
- package/lib/directors/OrderDiscountAdapter.js.map +1 -0
- package/lib/directors/OrderDiscountConfiguration.d.ts +6 -0
- package/lib/directors/OrderDiscountConfiguration.d.ts.map +1 -0
- package/lib/directors/OrderDiscountConfiguration.js +2 -0
- package/lib/directors/OrderDiscountConfiguration.js.map +1 -0
- package/lib/directors/OrderDiscountDirector.d.ts +3 -0
- package/lib/directors/OrderDiscountDirector.d.ts.map +1 -0
- package/lib/directors/OrderDiscountDirector.js +3 -0
- package/lib/directors/OrderDiscountDirector.js.map +1 -0
- package/lib/directors/OrderPricingAdapter.d.ts +18 -0
- package/lib/directors/OrderPricingAdapter.d.ts.map +1 -0
- package/lib/directors/OrderPricingAdapter.js +24 -0
- package/lib/directors/OrderPricingAdapter.js.map +1 -0
- package/lib/directors/OrderPricingDirector.d.ts +18 -0
- package/lib/directors/OrderPricingDirector.d.ts.map +1 -0
- package/lib/directors/OrderPricingDirector.js +31 -0
- package/lib/directors/OrderPricingDirector.js.map +1 -0
- package/lib/directors/OrderPricingSheet.d.ts +37 -0
- package/lib/directors/OrderPricingSheet.d.ts.map +1 -0
- package/lib/directors/OrderPricingSheet.js +108 -0
- package/lib/directors/OrderPricingSheet.js.map +1 -0
- package/lib/directors/PaymentAdapter.d.ts +50 -0
- package/lib/directors/PaymentAdapter.d.ts.map +1 -0
- package/lib/directors/PaymentAdapter.js +55 -0
- package/lib/directors/PaymentAdapter.js.map +1 -0
- package/lib/directors/PaymentDirector.d.ts +21 -0
- package/lib/directors/PaymentDirector.d.ts.map +1 -0
- package/lib/directors/PaymentDirector.js +172 -0
- package/lib/directors/PaymentDirector.js.map +1 -0
- package/lib/directors/PaymentPricingAdapter.d.ts +48 -0
- package/lib/directors/PaymentPricingAdapter.d.ts.map +1 -0
- package/lib/directors/PaymentPricingAdapter.js +25 -0
- package/lib/directors/PaymentPricingAdapter.js.map +1 -0
- package/lib/directors/PaymentPricingDirector.d.ts +18 -0
- package/lib/directors/PaymentPricingDirector.d.ts.map +1 -0
- package/lib/directors/PaymentPricingDirector.js +51 -0
- package/lib/directors/PaymentPricingDirector.js.map +1 -0
- package/lib/directors/PaymentPricingSheet.d.ts +9 -0
- package/lib/directors/PaymentPricingSheet.d.ts.map +1 -0
- package/lib/directors/PaymentPricingSheet.js +75 -0
- package/lib/directors/PaymentPricingSheet.js.map +1 -0
- package/lib/directors/ProductDiscountAdapter.d.ts +3 -0
- package/lib/directors/ProductDiscountAdapter.d.ts.map +1 -0
- package/lib/directors/ProductDiscountAdapter.js +3 -0
- package/lib/directors/ProductDiscountAdapter.js.map +1 -0
- package/lib/directors/ProductDiscountConfiguration.d.ts +13 -0
- package/lib/directors/ProductDiscountConfiguration.d.ts.map +1 -0
- package/lib/directors/ProductDiscountConfiguration.js +2 -0
- package/lib/directors/ProductDiscountConfiguration.js.map +1 -0
- package/lib/directors/ProductDiscountDirector.d.ts +3 -0
- package/lib/directors/ProductDiscountDirector.d.ts.map +1 -0
- package/lib/directors/ProductDiscountDirector.js +3 -0
- package/lib/directors/ProductDiscountDirector.js.map +1 -0
- package/lib/directors/ProductPricingAdapter.d.ts +17 -0
- package/lib/directors/ProductPricingAdapter.d.ts.map +1 -0
- package/lib/directors/ProductPricingAdapter.js +24 -0
- package/lib/directors/ProductPricingAdapter.js.map +1 -0
- package/lib/directors/ProductPricingDirector.d.ts +21 -0
- package/lib/directors/ProductPricingDirector.d.ts.map +1 -0
- package/lib/directors/ProductPricingDirector.js +52 -0
- package/lib/directors/ProductPricingDirector.js.map +1 -0
- package/lib/directors/ProductPricingSheet.d.ts +38 -0
- package/lib/directors/ProductPricingSheet.d.ts.map +1 -0
- package/lib/directors/ProductPricingSheet.js +83 -0
- package/lib/directors/ProductPricingSheet.js.map +1 -0
- package/lib/directors/QuotationAdapter.d.ts +28 -0
- package/lib/directors/QuotationAdapter.d.ts.map +1 -0
- package/lib/directors/QuotationAdapter.js +46 -0
- package/lib/directors/QuotationAdapter.js.map +1 -0
- package/lib/directors/QuotationDirector.d.ts +7 -0
- package/lib/directors/QuotationDirector.d.ts.map +1 -0
- package/lib/directors/QuotationDirector.js +84 -0
- package/lib/directors/QuotationDirector.js.map +1 -0
- package/lib/directors/WarehousingAdapter.d.ts +40 -0
- package/lib/directors/WarehousingAdapter.d.ts.map +1 -0
- package/lib/directors/WarehousingAdapter.js +32 -0
- package/lib/directors/WarehousingAdapter.js.map +1 -0
- package/lib/directors/WarehousingDirector.d.ts +38 -0
- package/lib/directors/WarehousingDirector.d.ts.map +1 -0
- package/lib/directors/WarehousingDirector.js +169 -0
- package/lib/directors/WarehousingDirector.js.map +1 -0
- package/lib/directors/WorkerAdapter.d.ts +17 -0
- package/lib/directors/WorkerAdapter.d.ts.map +1 -0
- package/lib/directors/WorkerAdapter.js +11 -0
- package/lib/directors/WorkerAdapter.js.map +1 -0
- package/lib/directors/WorkerDirector.d.ts +26 -0
- package/lib/directors/WorkerDirector.d.ts.map +1 -0
- package/lib/directors/WorkerDirector.js +102 -0
- package/lib/directors/WorkerDirector.js.map +1 -0
- package/lib/directors/index.d.ts +39 -0
- package/lib/directors/index.d.ts.map +1 -0
- package/lib/directors/index.js +39 -0
- package/lib/directors/index.js.map +1 -0
- package/lib/modules.d.ts +61 -0
- package/lib/modules.d.ts.map +1 -0
- package/lib/modules.js +132 -0
- package/lib/modules.js.map +1 -0
- package/lib/services/activateEnrollment.d.ts +4 -0
- package/lib/services/activateEnrollment.d.ts.map +1 -0
- package/lib/services/activateEnrollment.js +25 -0
- package/lib/services/activateEnrollment.js.map +1 -0
- package/lib/services/calculateDiscountTotal.d.ts +7 -0
- package/lib/services/calculateDiscountTotal.d.ts.map +1 -0
- package/lib/services/calculateDiscountTotal.js +49 -0
- package/lib/services/calculateDiscountTotal.js.map +1 -0
- package/lib/services/checkoutOrder.d.ts +9 -0
- package/lib/services/checkoutOrder.d.ts.map +1 -0
- package/lib/services/checkoutOrder.js +28 -0
- package/lib/services/checkoutOrder.js.map +1 -0
- package/lib/services/confirmOrder.d.ts +9 -0
- package/lib/services/confirmOrder.d.ts.map +1 -0
- package/lib/services/confirmOrder.js +17 -0
- package/lib/services/confirmOrder.js.map +1 -0
- package/lib/services/createDownloadStream.d.ts +5 -0
- package/lib/services/createDownloadStream.d.ts.map +1 -0
- package/lib/services/createDownloadStream.js +8 -0
- package/lib/services/createDownloadStream.js.map +1 -0
- package/lib/services/createDownloadStreamService.d.ts +11 -0
- package/lib/services/createDownloadStreamService.d.ts.map +1 -0
- package/lib/services/createDownloadStreamService.js +9 -0
- package/lib/services/createDownloadStreamService.js.map +1 -0
- package/lib/services/createEnrollmentFromCheckout.d.ts +15 -0
- package/lib/services/createEnrollmentFromCheckout.d.ts.map +1 -0
- package/lib/services/createEnrollmentFromCheckout.js +40 -0
- package/lib/services/createEnrollmentFromCheckout.js.map +1 -0
- package/lib/services/createManualOrderDiscount.d.ts +7 -0
- package/lib/services/createManualOrderDiscount.d.ts.map +1 -0
- package/lib/services/createManualOrderDiscount.js +47 -0
- package/lib/services/createManualOrderDiscount.js.map +1 -0
- package/lib/services/createSignedURL.d.ts +8 -0
- package/lib/services/createSignedURL.d.ts.map +1 -0
- package/lib/services/createSignedURL.js +15 -0
- package/lib/services/createSignedURL.js.map +1 -0
- package/lib/services/createSignedURLService.d.ts +13 -0
- package/lib/services/createSignedURLService.d.ts.map +1 -0
- package/lib/services/createSignedURLService.js +14 -0
- package/lib/services/createSignedURLService.js.map +1 -0
- package/lib/services/deleteUser.d.ts +5 -0
- package/lib/services/deleteUser.d.ts.map +1 -0
- package/lib/services/deleteUser.js +26 -0
- package/lib/services/deleteUser.js.map +1 -0
- package/lib/services/deleteUserCartService.d.ts +6 -0
- package/lib/services/deleteUserCartService.d.ts.map +1 -0
- package/lib/services/deleteUserCartService.js +20 -0
- package/lib/services/deleteUserCartService.js.map +1 -0
- package/lib/services/deleteUserCarts.d.ts +5 -0
- package/lib/services/deleteUserCarts.d.ts.map +1 -0
- package/lib/services/deleteUserCarts.js +18 -0
- package/lib/services/deleteUserCarts.js.map +1 -0
- package/lib/services/deleteUserCartsService.d.ts +5 -0
- package/lib/services/deleteUserCartsService.d.ts.map +1 -0
- package/lib/services/deleteUserCartsService.js +18 -0
- package/lib/services/deleteUserCartsService.js.map +1 -0
- package/lib/services/discountedEntities.d.ts +5 -0
- package/lib/services/discountedEntities.d.ts.map +1 -0
- package/lib/services/discountedEntities.js +61 -0
- package/lib/services/discountedEntities.js.map +1 -0
- package/lib/services/ercMetadata.d.ts +7 -0
- package/lib/services/ercMetadata.d.ts.map +1 -0
- package/lib/services/ercMetadata.js +22 -0
- package/lib/services/ercMetadata.js.map +1 -0
- package/lib/services/fullfillQuotation.d.ts +4 -0
- package/lib/services/fullfillQuotation.d.ts.map +1 -0
- package/lib/services/fullfillQuotation.js +12 -0
- package/lib/services/fullfillQuotation.js.map +1 -0
- package/lib/services/index.d.ts +110 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +124 -0
- package/lib/services/index.js.map +1 -0
- package/lib/services/index_BACKUP_58089.d.ts +246 -0
- package/lib/services/index_BACKUP_58089.d.ts.map +1 -0
- package/lib/services/index_BACKUP_58089.js +103 -0
- package/lib/services/index_BACKUP_58089.js.map +1 -0
- package/lib/services/index_BASE_58089.d.ts +31 -0
- package/lib/services/index_BASE_58089.d.ts.map +1 -0
- package/lib/services/index_BASE_58089.js +42 -0
- package/lib/services/index_BASE_58089.js.map +1 -0
- package/lib/services/index_LOCAL_58089.d.ts +246 -0
- package/lib/services/index_LOCAL_58089.d.ts.map +1 -0
- package/lib/services/index_LOCAL_58089.js +103 -0
- package/lib/services/index_LOCAL_58089.js.map +1 -0
- package/lib/services/index_REMOTE_58089.d.ts +34 -0
- package/lib/services/index_REMOTE_58089.d.ts.map +1 -0
- package/lib/services/index_REMOTE_58089.js +44 -0
- package/lib/services/index_REMOTE_58089.js.map +1 -0
- package/lib/services/initCartProviders.d.ts +4 -0
- package/lib/services/initCartProviders.d.ts.map +1 -0
- package/lib/services/initCartProviders.js +55 -0
- package/lib/services/initCartProviders.js.map +1 -0
- package/lib/services/initializeEnrollment.d.ts +7 -0
- package/lib/services/initializeEnrollment.d.ts.map +1 -0
- package/lib/services/initializeEnrollment.js +28 -0
- package/lib/services/initializeEnrollment.js.map +1 -0
- package/lib/services/invalidateFilterCache.d.ts +3 -0
- package/lib/services/invalidateFilterCache.d.ts.map +1 -0
- package/lib/services/invalidateFilterCache.js +12 -0
- package/lib/services/invalidateFilterCache.js.map +1 -0
- package/lib/services/linkFileService.d.ts +7 -0
- package/lib/services/linkFileService.d.ts.map +1 -0
- package/lib/services/linkFileService.js +18 -0
- package/lib/services/linkFileService.js.map +1 -0
- package/lib/services/loadFilterOptions.d.ts +14 -0
- package/lib/services/loadFilterOptions.d.ts.map +1 -0
- package/lib/services/loadFilterOptions.js +30 -0
- package/lib/services/loadFilterOptions.js.map +1 -0
- package/lib/services/loadFilters.d.ts +14 -0
- package/lib/services/loadFilters.d.ts.map +1 -0
- package/lib/services/loadFilters.js +36 -0
- package/lib/services/loadFilters.js.map +1 -0
- package/lib/services/migrateBookmarks.d.ts +8 -0
- package/lib/services/migrateBookmarks.d.ts.map +1 -0
- package/lib/services/migrateBookmarks.js +26 -0
- package/lib/services/migrateBookmarks.js.map +1 -0
- package/lib/services/migrateBookmarksService.d.ts +13 -0
- package/lib/services/migrateBookmarksService.d.ts.map +1 -0
- package/lib/services/migrateBookmarksService.js +26 -0
- package/lib/services/migrateBookmarksService.js.map +1 -0
- package/lib/services/migrateOrderCart.d.ts +8 -0
- package/lib/services/migrateOrderCart.d.ts.map +1 -0
- package/lib/services/migrateOrderCart.js +32 -0
- package/lib/services/migrateOrderCart.js.map +1 -0
- package/lib/services/migrateOrderCartService.d.ts +23 -0
- package/lib/services/migrateOrderCartService.d.ts.map +1 -0
- package/lib/services/migrateOrderCartService.js +32 -0
- package/lib/services/migrateOrderCartService.js.map +1 -0
- package/lib/services/migrateUserData.d.ts +2 -0
- package/lib/services/migrateUserData.d.ts.map +1 -0
- package/lib/services/migrateUserData.js +20 -0
- package/lib/services/migrateUserData.js.map +1 -0
- package/lib/services/migrateUserDataService.d.ts +19 -0
- package/lib/services/migrateUserDataService.d.ts.map +1 -0
- package/lib/services/migrateUserDataService.js +18 -0
- package/lib/services/migrateUserDataService.js.map +1 -0
- package/lib/services/nextUserCart.d.ts +9 -0
- package/lib/services/nextUserCart.d.ts.map +1 -0
- package/lib/services/nextUserCart.js +34 -0
- package/lib/services/nextUserCart.js.map +1 -0
- package/lib/services/nextUserCartService.d.ts +22 -0
- package/lib/services/nextUserCartService.d.ts.map +1 -0
- package/lib/services/nextUserCartService.js +35 -0
- package/lib/services/nextUserCartService.js.map +1 -0
- package/lib/services/processEnrollment.d.ts +4 -0
- package/lib/services/processEnrollment.d.ts.map +1 -0
- package/lib/services/processEnrollment.js +33 -0
- package/lib/services/processEnrollment.js.map +1 -0
- package/lib/services/processOrder.d.ts +9 -0
- package/lib/services/processOrder.d.ts.map +1 -0
- package/lib/services/processOrder.js +161 -0
- package/lib/services/processOrder.js.map +1 -0
- package/lib/services/processQuotation.d.ts +6 -0
- package/lib/services/processQuotation.d.ts.map +1 -0
- package/lib/services/processQuotation.js +60 -0
- package/lib/services/processQuotation.js.map +1 -0
- package/lib/services/proposeQuotation.d.ts +6 -0
- package/lib/services/proposeQuotation.d.ts.map +1 -0
- package/lib/services/proposeQuotation.js +12 -0
- package/lib/services/proposeQuotation.js.map +1 -0
- package/lib/services/registerPaymentCredentials.d.ts +5 -0
- package/lib/services/registerPaymentCredentials.d.ts.map +1 -0
- package/lib/services/registerPaymentCredentials.js +21 -0
- package/lib/services/registerPaymentCredentials.js.map +1 -0
- package/lib/services/rejectOrder.d.ts +9 -0
- package/lib/services/rejectOrder.d.ts.map +1 -0
- package/lib/services/rejectOrder.js +17 -0
- package/lib/services/rejectOrder.js.map +1 -0
- package/lib/services/rejectQuotation.d.ts +6 -0
- package/lib/services/rejectQuotation.d.ts.map +1 -0
- package/lib/services/rejectQuotation.js +12 -0
- package/lib/services/rejectQuotation.js.map +1 -0
- package/lib/services/removeFiles.d.ts +5 -0
- package/lib/services/removeFiles.d.ts.map +1 -0
- package/lib/services/removeFiles.js +19 -0
- package/lib/services/removeFiles.js.map +1 -0
- package/lib/services/removeFilesService.d.ts +10 -0
- package/lib/services/removeFilesService.d.ts.map +1 -0
- package/lib/services/removeFilesService.js +20 -0
- package/lib/services/removeFilesService.js.map +1 -0
- package/lib/services/removeProduct.d.ts +5 -0
- package/lib/services/removeProduct.d.ts.map +1 -0
- package/lib/services/removeProduct.js +26 -0
- package/lib/services/removeProduct.js.map +1 -0
- package/lib/services/removeProductService.d.ts +20 -0
- package/lib/services/removeProductService.d.ts.map +1 -0
- package/lib/services/removeProductService.js +27 -0
- package/lib/services/removeProductService.js.map +1 -0
- package/lib/services/searchAssortments.d.ts +19 -0
- package/lib/services/searchAssortments.d.ts.map +1 -0
- package/lib/services/searchAssortments.js +33 -0
- package/lib/services/searchAssortments.js.map +1 -0
- package/lib/services/searchProducts.d.ts +16 -0
- package/lib/services/searchProducts.d.ts.map +1 -0
- package/lib/services/searchProducts.js +41 -0
- package/lib/services/searchProducts.js.map +1 -0
- package/lib/services/supportedDeliveryProviders.d.ts +5 -0
- package/lib/services/supportedDeliveryProviders.d.ts.map +1 -0
- package/lib/services/supportedDeliveryProviders.js +14 -0
- package/lib/services/supportedDeliveryProviders.js.map +1 -0
- package/lib/services/supportedPaymentProviders.d.ts +5 -0
- package/lib/services/supportedPaymentProviders.d.ts.map +1 -0
- package/lib/services/supportedPaymentProviders.js +14 -0
- package/lib/services/supportedPaymentProviders.js.map +1 -0
- package/lib/services/supportedWarehousingProviders.d.ts +5 -0
- package/lib/services/supportedWarehousingProviders.d.ts.map +1 -0
- package/lib/services/supportedWarehousingProviders.js +10 -0
- package/lib/services/supportedWarehousingProviders.js.map +1 -0
- package/lib/services/terminateEnrollment.d.ts +3 -0
- package/lib/services/terminateEnrollment.d.ts.map +1 -0
- package/lib/services/terminateEnrollment.js +25 -0
- package/lib/services/terminateEnrollment.js.map +1 -0
- package/lib/services/updateCalculation.d.ts +3 -0
- package/lib/services/updateCalculation.d.ts.map +1 -0
- package/lib/services/updateCalculation.js +101 -0
- package/lib/services/updateCalculation.js.map +1 -0
- package/lib/services/updateCalculationService.d.ts +17 -0
- package/lib/services/updateCalculationService.d.ts.map +1 -0
- package/lib/services/updateCalculationService.js +68 -0
- package/lib/services/updateCalculationService.js.map +1 -0
- package/lib/services/updateScheduling.d.ts +8 -0
- package/lib/services/updateScheduling.d.ts.map +1 -0
- package/lib/services/updateScheduling.js +42 -0
- package/lib/services/updateScheduling.js.map +1 -0
- package/lib/services/updateUserAvatarAfterUpload.d.ts +6 -0
- package/lib/services/updateUserAvatarAfterUpload.d.ts.map +1 -0
- package/lib/services/updateUserAvatarAfterUpload.js +25 -0
- package/lib/services/updateUserAvatarAfterUpload.js.map +1 -0
- package/lib/services/updateUserAvatarAfterUploadService.d.ts +18 -0
- package/lib/services/updateUserAvatarAfterUploadService.d.ts.map +1 -0
- package/lib/services/updateUserAvatarAfterUploadService.js +25 -0
- package/lib/services/updateUserAvatarAfterUploadService.js.map +1 -0
- package/lib/services/uploadFileFromStream.d.ts +8 -0
- package/lib/services/uploadFileFromStream.d.ts.map +1 -0
- package/lib/services/uploadFileFromStream.js +11 -0
- package/lib/services/uploadFileFromStream.js.map +1 -0
- package/lib/services/uploadFileFromStreamService.d.ts +12 -0
- package/lib/services/uploadFileFromStreamService.d.ts.map +1 -0
- package/lib/services/uploadFileFromStreamService.js +10 -0
- package/lib/services/uploadFileFromStreamService.js.map +1 -0
- package/lib/services/uploadFileFromURL.d.ts +13 -0
- package/lib/services/uploadFileFromURL.d.ts.map +1 -0
- package/lib/services/uploadFileFromURL.js +11 -0
- package/lib/services/uploadFileFromURL.js.map +1 -0
- package/lib/services/uploadFileFromURLService.d.ts +17 -0
- package/lib/services/uploadFileFromURLService.d.ts.map +1 -0
- package/lib/services/uploadFileFromURLService.js +10 -0
- package/lib/services/uploadFileFromURLService.js.map +1 -0
- package/lib/services/validateOrder.d.ts +4 -0
- package/lib/services/validateOrder.d.ts.map +1 -0
- package/lib/services/validateOrder.js +45 -0
- package/lib/services/validateOrder.js.map +1 -0
- package/lib/services/verifyQuotation.d.ts +6 -0
- package/lib/services/verifyQuotation.d.ts.map +1 -0
- package/lib/services/verifyQuotation.js +12 -0
- package/lib/services/verifyQuotation.js.map +1 -0
- package/package.json +28 -28
- package/src/core-index.ts +14 -241
- package/src/directors/BaseDiscountAdapter.test.ts +49 -0
- package/src/directors/BaseDiscountAdapter.ts +91 -0
- package/src/directors/BaseDiscountDirector.ts +72 -0
- package/src/directors/BasePricingAdapter.ts +82 -0
- package/src/directors/BasePricingDirector.ts +136 -0
- package/src/directors/BasePricingSheet.test.ts +43 -0
- package/src/directors/BasePricingSheet.ts +140 -0
- package/src/directors/DeliveryAdapter.ts +110 -0
- package/src/directors/DeliveryDirector.ts +135 -0
- package/src/directors/DeliveryPricingAdapter.ts +87 -0
- package/src/directors/DeliveryPricingDirector.ts +92 -0
- package/src/directors/DeliveryPricingSheet.ts +86 -0
- package/src/directors/EnrollmentAdapter.ts +109 -0
- package/src/directors/EnrollmentDirector.ts +70 -0
- package/src/directors/FilterAdapter.ts +103 -0
- package/src/directors/FilterDirector.ts +309 -0
- package/src/directors/MessagingDirector.test.ts +5 -0
- package/src/directors/MessagingDirector.ts +59 -0
- package/src/directors/OrderDiscountAdapter.ts +10 -0
- package/src/directors/OrderDiscountConfiguration.ts +5 -0
- package/src/directors/OrderDiscountDirector.ts +6 -0
- package/src/directors/OrderPricingAdapter.ts +63 -0
- package/src/directors/OrderPricingDirector.ts +74 -0
- package/src/directors/OrderPricingSheet.ts +147 -0
- package/src/directors/PaymentAdapter.ts +118 -0
- package/src/directors/PaymentDirector.ts +275 -0
- package/src/directors/PaymentPricingAdapter.ts +86 -0
- package/src/directors/PaymentPricingDirector.ts +94 -0
- package/src/directors/PaymentPricingSheet.ts +91 -0
- package/src/directors/ProductDiscountAdapter.ts +10 -0
- package/src/directors/ProductDiscountConfiguration.ts +18 -0
- package/src/directors/ProductDiscountDirector.ts +5 -0
- package/src/directors/ProductPricingAdapter.ts +56 -0
- package/src/directors/ProductPricingDirector.ts +100 -0
- package/src/directors/ProductPricingSheet.test.ts +129 -0
- package/src/directors/ProductPricingSheet.ts +127 -0
- package/src/directors/QuotationAdapter.ts +86 -0
- package/src/directors/QuotationDirector.ts +105 -0
- package/src/directors/WarehousingAdapter.ts +83 -0
- package/src/directors/WarehousingDirector.ts +235 -0
- package/src/directors/WorkerAdapter.ts +30 -0
- package/src/directors/WorkerDirector.ts +154 -0
- package/src/directors/index.ts +49 -0
- package/src/directors/periodForReferenceDate.test.ts +23 -0
- package/src/modules.ts +215 -0
- package/src/services/activateEnrollment.ts +30 -0
- package/src/services/calculateDiscountTotal.ts +71 -0
- package/src/services/checkoutOrder.ts +43 -0
- package/src/services/confirmOrder.ts +26 -0
- package/src/services/createDownloadStream.ts +16 -0
- package/src/services/createEnrollmentFromCheckout.ts +66 -0
- package/src/services/createManualOrderDiscount.ts +56 -0
- package/src/services/createSignedURL.ts +20 -0
- package/src/services/deleteUser.ts +33 -0
- package/src/services/discountedEntities.ts +81 -0
- package/src/services/ercMetadata.ts +33 -0
- package/src/services/fullfillQuotation.ts +14 -0
- package/src/services/index.ts +154 -0
- package/src/services/initCartProviders.ts +86 -0
- package/src/services/initializeEnrollment.ts +38 -0
- package/src/services/invalidateFilterCache.ts +16 -0
- package/src/services/linkFileService.ts +22 -0
- package/src/services/loadFilterOptions.ts +50 -0
- package/src/services/loadFilters.ts +52 -0
- package/src/services/migrateBookmarks.ts +39 -0
- package/src/services/migrateOrderCart.ts +52 -0
- package/src/services/migrateUserData.ts +22 -0
- package/src/services/nextUserCart.ts +52 -0
- package/src/services/processEnrollment.ts +37 -0
- package/src/services/processOrder.ts +241 -0
- package/src/services/processQuotation.ts +75 -0
- package/src/services/proposeQuotation.ts +18 -0
- package/src/services/registerPaymentCredentials.ts +30 -0
- package/src/services/rejectOrder.ts +26 -0
- package/src/services/rejectQuotation.ts +18 -0
- package/src/services/removeFiles.ts +25 -0
- package/src/services/removeProduct.ts +34 -0
- package/src/services/searchAssortments.ts +58 -0
- package/src/services/searchProducts.ts +73 -0
- package/src/services/supportedDeliveryProviders.ts +24 -0
- package/src/services/supportedPaymentProviders.ts +25 -0
- package/src/services/supportedWarehousingProviders.ts +18 -0
- package/src/services/terminateEnrollment.ts +29 -0
- package/src/services/updateCalculation.ts +143 -0
- package/src/services/updateScheduling.ts +64 -0
- package/src/services/updateUserAvatarAfterUpload.ts +30 -0
- package/src/services/uploadFileFromStream.ts +15 -0
- package/src/services/uploadFileFromURL.ts +29 -0
- package/src/services/validateOrder.ts +53 -0
- package/src/services/verifyQuotation.ts +18 -0
- package/tsconfig.json +5 -7
- package/src/types.ts +0 -7
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { IBaseDirector, BaseDirector } from '@unchainedshop/utils';
|
|
2
|
+
import { WarehousingProvider, TokenSurrogate } from '@unchainedshop/core-warehousing';
|
|
3
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
4
|
+
|
|
5
|
+
const logger = createLogger('unchained:core');
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
DeliveryDirector,
|
|
9
|
+
IWarehousingAdapter,
|
|
10
|
+
WarehousingContext,
|
|
11
|
+
WarehousingError,
|
|
12
|
+
} from '../directors/index.js';
|
|
13
|
+
|
|
14
|
+
export type EstimatedDispatch = {
|
|
15
|
+
shipping?: Date;
|
|
16
|
+
earliestDelivery?: Date;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type EstimatedStock = { quantity: number } | null;
|
|
20
|
+
|
|
21
|
+
export interface WarehousingInterface {
|
|
22
|
+
_id: string;
|
|
23
|
+
label: string;
|
|
24
|
+
version: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type IWarehousingDirector = IBaseDirector<IWarehousingAdapter> & {
|
|
28
|
+
tokenMetadata: (
|
|
29
|
+
virtualProviders: WarehousingProvider[],
|
|
30
|
+
warehousingContext: WarehousingContext & { token: { chainTokenId: string } },
|
|
31
|
+
unchainedAPI,
|
|
32
|
+
) => Promise<any>;
|
|
33
|
+
|
|
34
|
+
isInvalidateable: (
|
|
35
|
+
virtualProviders: WarehousingProvider[],
|
|
36
|
+
warehousingContext: WarehousingContext & { token: { chainTokenId: string } },
|
|
37
|
+
unchainedAPI,
|
|
38
|
+
) => Promise<any>;
|
|
39
|
+
|
|
40
|
+
actions: (
|
|
41
|
+
warehousingProvider: WarehousingProvider,
|
|
42
|
+
warehousingContext: WarehousingContext,
|
|
43
|
+
unchainedAPI,
|
|
44
|
+
) => Promise<{
|
|
45
|
+
configurationError: () => WarehousingError;
|
|
46
|
+
isActive: () => boolean;
|
|
47
|
+
estimatedStock: () => Promise<EstimatedStock>;
|
|
48
|
+
estimatedDispatch: () => Promise<EstimatedDispatch>;
|
|
49
|
+
tokenize: () => Promise<Array<TokenSurrogate>>;
|
|
50
|
+
tokenMetadata: (chainTokenId: string) => Promise<any>;
|
|
51
|
+
isInvalidateable: (chainTokenId: string) => Promise<boolean>;
|
|
52
|
+
}>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const getReferenceDate = (context: WarehousingContext) => {
|
|
56
|
+
return context && context.referenceDate ? context.referenceDate : new Date();
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const baseDirector = BaseDirector<IWarehousingAdapter>('WarehousingDirector', {
|
|
60
|
+
adapterSortKey: 'orderIndex',
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export const WarehousingDirector: IWarehousingDirector = {
|
|
64
|
+
...baseDirector,
|
|
65
|
+
|
|
66
|
+
actions: async (warehousingProvider, warehousingContext, unchainedAPI) => {
|
|
67
|
+
const Adapter = baseDirector.getAdapter(warehousingProvider.adapterKey);
|
|
68
|
+
|
|
69
|
+
if (!Adapter) {
|
|
70
|
+
throw new Error(`Warehousing Plugin ${warehousingProvider.adapterKey} not available`);
|
|
71
|
+
}
|
|
72
|
+
const context = {
|
|
73
|
+
warehousingProviderId: warehousingProvider._id,
|
|
74
|
+
...warehousingContext,
|
|
75
|
+
...unchainedAPI,
|
|
76
|
+
};
|
|
77
|
+
const adapter = Adapter.actions(warehousingProvider.configuration, context);
|
|
78
|
+
|
|
79
|
+
const throughputTime = async (referenceDate) => {
|
|
80
|
+
try {
|
|
81
|
+
const { quantity } = context;
|
|
82
|
+
const stock = await adapter.stock(referenceDate);
|
|
83
|
+
const notInStockQuantity = Math.max(quantity - stock, 0);
|
|
84
|
+
const productionTime = await adapter.productionTime(notInStockQuantity);
|
|
85
|
+
const commissioningTime = await adapter.commissioningTime(quantity);
|
|
86
|
+
return Math.max(commissioningTime + productionTime, 0);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
logger.error(error);
|
|
89
|
+
return NaN;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
configurationError: () => {
|
|
95
|
+
try {
|
|
96
|
+
const error = adapter.configurationError();
|
|
97
|
+
return error;
|
|
98
|
+
} catch {
|
|
99
|
+
return WarehousingError.ADAPTER_NOT_FOUND;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
isActive: () => {
|
|
104
|
+
try {
|
|
105
|
+
return adapter.isActive();
|
|
106
|
+
} catch (error) {
|
|
107
|
+
logger.error(error);
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
estimatedStock: async () => {
|
|
113
|
+
try {
|
|
114
|
+
const referenceDate = getReferenceDate(context);
|
|
115
|
+
const quantity = await adapter.stock(referenceDate);
|
|
116
|
+
return {
|
|
117
|
+
quantity,
|
|
118
|
+
};
|
|
119
|
+
} catch (error) {
|
|
120
|
+
logger.error(error);
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
estimatedDispatch: async () => {
|
|
126
|
+
try {
|
|
127
|
+
const { deliveryProvider } = context;
|
|
128
|
+
const referenceDate = getReferenceDate(context);
|
|
129
|
+
|
|
130
|
+
const warehousingThroughputTime = await throughputTime(referenceDate);
|
|
131
|
+
if (!Number.isFinite(warehousingThroughputTime)) {
|
|
132
|
+
return {
|
|
133
|
+
shipping: null,
|
|
134
|
+
earliestDelivery: null,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Calculate shipping date
|
|
139
|
+
const shippingTimestamp = referenceDate.getTime() + warehousingThroughputTime;
|
|
140
|
+
const shipping = new Date(shippingTimestamp);
|
|
141
|
+
|
|
142
|
+
// Calculate earliest delivery date
|
|
143
|
+
const actions = await DeliveryDirector.actions(deliveryProvider, context, unchainedAPI);
|
|
144
|
+
const deliveryThroughputTime =
|
|
145
|
+
await actions.estimatedDeliveryThroughput(warehousingThroughputTime);
|
|
146
|
+
const earliestDelivery = Number.isFinite(deliveryThroughputTime)
|
|
147
|
+
? new Date(shippingTimestamp + deliveryThroughputTime)
|
|
148
|
+
: null;
|
|
149
|
+
|
|
150
|
+
return {
|
|
151
|
+
shipping,
|
|
152
|
+
earliestDelivery,
|
|
153
|
+
};
|
|
154
|
+
} catch (error) {
|
|
155
|
+
logger.error(error);
|
|
156
|
+
return {};
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
tokenMetadata: async (chainTokenId) => {
|
|
161
|
+
try {
|
|
162
|
+
const referenceDate = getReferenceDate(context);
|
|
163
|
+
const tokenMetadata = await adapter.tokenMetadata(chainTokenId, referenceDate);
|
|
164
|
+
return tokenMetadata;
|
|
165
|
+
} catch (error) {
|
|
166
|
+
logger.error(error);
|
|
167
|
+
return {};
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
isInvalidateable: async (chainTokenId) => {
|
|
172
|
+
try {
|
|
173
|
+
const referenceDate = getReferenceDate(context);
|
|
174
|
+
const isInvalidateable = await adapter.isInvalidateable(chainTokenId, referenceDate);
|
|
175
|
+
return isInvalidateable;
|
|
176
|
+
} catch (error) {
|
|
177
|
+
logger.error(error);
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
tokenize: async () => {
|
|
183
|
+
try {
|
|
184
|
+
const tokens = await adapter.tokenize();
|
|
185
|
+
const { order, orderPosition } = warehousingContext;
|
|
186
|
+
return tokens.map((token) => {
|
|
187
|
+
return {
|
|
188
|
+
...token,
|
|
189
|
+
userId: order.userId,
|
|
190
|
+
productId: orderPosition.productId,
|
|
191
|
+
orderPositionId: orderPosition._id,
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
} catch (error) {
|
|
195
|
+
logger.error(error);
|
|
196
|
+
return [];
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
async tokenMetadata(virtualProviders, warehousingContext, unchainedAPI) {
|
|
203
|
+
return virtualProviders.reduce(async (lastPromise, provider) => {
|
|
204
|
+
const last = await lastPromise;
|
|
205
|
+
if (last) return last;
|
|
206
|
+
const currentDirector = await WarehousingDirector.actions(
|
|
207
|
+
provider,
|
|
208
|
+
warehousingContext,
|
|
209
|
+
unchainedAPI,
|
|
210
|
+
);
|
|
211
|
+
const isActive = await currentDirector.isActive();
|
|
212
|
+
if (isActive) {
|
|
213
|
+
return currentDirector.tokenMetadata(warehousingContext.token.chainTokenId);
|
|
214
|
+
}
|
|
215
|
+
return null;
|
|
216
|
+
}, Promise.resolve(null));
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
async isInvalidateable(virtualProviders, warehousingContext, unchainedAPI) {
|
|
220
|
+
return virtualProviders.reduce(async (lastPromise, provider) => {
|
|
221
|
+
const last = await lastPromise;
|
|
222
|
+
if (last) return last;
|
|
223
|
+
const currentDirector = await WarehousingDirector.actions(
|
|
224
|
+
provider,
|
|
225
|
+
warehousingContext,
|
|
226
|
+
unchainedAPI,
|
|
227
|
+
);
|
|
228
|
+
const isActive = await currentDirector.isActive();
|
|
229
|
+
if (isActive) {
|
|
230
|
+
return currentDirector.isInvalidateable(warehousingContext.token.chainTokenId);
|
|
231
|
+
}
|
|
232
|
+
return null;
|
|
233
|
+
}, Promise.resolve(null));
|
|
234
|
+
},
|
|
235
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { log, LogLevel } from '@unchainedshop/logger';
|
|
2
|
+
import { IBaseAdapter } from '@unchainedshop/utils';
|
|
3
|
+
import { WorkResult } from '@unchainedshop/core-worker';
|
|
4
|
+
import { Modules } from '../modules.js';
|
|
5
|
+
import { Services } from '../services/index.js';
|
|
6
|
+
import { BulkImporter } from '../core-index.js';
|
|
7
|
+
|
|
8
|
+
export type IWorkerAdapter<Input, Output> = IBaseAdapter & {
|
|
9
|
+
type: string;
|
|
10
|
+
external: boolean;
|
|
11
|
+
maxParallelAllocations?: number;
|
|
12
|
+
|
|
13
|
+
doWork: (
|
|
14
|
+
input: Input,
|
|
15
|
+
unchainedAPI: { modules: Modules; services: Services; bulkImporter: BulkImporter },
|
|
16
|
+
workId: string,
|
|
17
|
+
) => Promise<WorkResult<Output>>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const WorkerAdapter: Omit<IWorkerAdapter<any, void>, 'key' | 'label' | 'type' | 'version'> = {
|
|
21
|
+
external: false,
|
|
22
|
+
|
|
23
|
+
async doWork() {
|
|
24
|
+
return { success: false, result: null };
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
log(message: string, { level = LogLevel.Debug, ...options } = {}) {
|
|
28
|
+
return log(message, { level, ...options });
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Work, WorkData, WorkResult } from '@unchainedshop/core-worker';
|
|
2
|
+
import { BaseDirector, IBaseDirector } from '@unchainedshop/utils';
|
|
3
|
+
import { ScheduleData } from '@breejs/later';
|
|
4
|
+
import { IWorkerAdapter } from './WorkerAdapter.js';
|
|
5
|
+
import { Modules } from '../modules.js';
|
|
6
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
7
|
+
|
|
8
|
+
const logger = createLogger('unchained:core');
|
|
9
|
+
|
|
10
|
+
export type WorkScheduleConfiguration = Pick<
|
|
11
|
+
WorkData,
|
|
12
|
+
'timeout' | 'retries' | 'priority' | 'worker' | 'scheduleId'
|
|
13
|
+
> & {
|
|
14
|
+
type: string;
|
|
15
|
+
input?: (workData: Omit<WorkData, 'input'>) => Promise<Record<string, any> | null>;
|
|
16
|
+
schedule: ScheduleData;
|
|
17
|
+
scheduleId?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type IWorkerDirector = IBaseDirector<IWorkerAdapter<any, any>> & {
|
|
21
|
+
getActivePluginTypes: (options?: { external?: boolean }) => Array<string>;
|
|
22
|
+
getAdapterByType: (type: string) => IWorkerAdapter<any, any>;
|
|
23
|
+
disableAutoscheduling: (scheduleId: string) => void;
|
|
24
|
+
configureAutoscheduling: (workScheduleConfiguration: WorkScheduleConfiguration) => void;
|
|
25
|
+
getAutoSchedules: () => Array<[string, WorkScheduleConfiguration]>;
|
|
26
|
+
doWork: (work: Work, unchainedAPI) => Promise<WorkResult>;
|
|
27
|
+
processNextWork: (unchainedAPI: { modules: Modules }, workerId?: string) => Promise<Work>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const AutoScheduleMap = new Map<string, WorkScheduleConfiguration>();
|
|
31
|
+
|
|
32
|
+
const baseDirector = BaseDirector<IWorkerAdapter<any, any>>('WorkerDirector', {
|
|
33
|
+
adapterKeyField: 'key',
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const WorkerDirector: IWorkerDirector = {
|
|
37
|
+
...baseDirector,
|
|
38
|
+
|
|
39
|
+
getActivePluginTypes: ({ external } = { external: null }) => {
|
|
40
|
+
return WorkerDirector.getAdapters()
|
|
41
|
+
.filter((adapter) => {
|
|
42
|
+
if (external === null || external === undefined) return true;
|
|
43
|
+
return Boolean(adapter.external) === external;
|
|
44
|
+
})
|
|
45
|
+
.map((adapter) => adapter.type);
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
registerAdapter: (Adapter) => {
|
|
49
|
+
if (WorkerDirector.getAdapterByType(Adapter.type))
|
|
50
|
+
throw new Error(
|
|
51
|
+
`WorkerDirector: There is already a adapter registered with type: ${Adapter.type}`,
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
baseDirector.registerAdapter(Adapter);
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
disableAutoscheduling: (type) => {
|
|
58
|
+
const config = AutoScheduleMap.get(type);
|
|
59
|
+
AutoScheduleMap.set(type, { ...config, schedule: null });
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
unregisterAdapter: (key) => {
|
|
63
|
+
const adapter = WorkerDirector.getAdapter(key);
|
|
64
|
+
const result = baseDirector.unregisterAdapter(key);
|
|
65
|
+
if (adapter) {
|
|
66
|
+
AutoScheduleMap.forEach((workItemConfiguration, scheduleId) => {
|
|
67
|
+
if (workItemConfiguration.type === adapter.type) {
|
|
68
|
+
AutoScheduleMap.delete(scheduleId);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return result;
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
configureAutoscheduling: (workItemConfiguration) => {
|
|
76
|
+
const adapter = WorkerDirector.getAdapterByType(workItemConfiguration.type);
|
|
77
|
+
AutoScheduleMap.set(
|
|
78
|
+
workItemConfiguration.scheduleId || workItemConfiguration.type,
|
|
79
|
+
workItemConfiguration,
|
|
80
|
+
);
|
|
81
|
+
logger.info(
|
|
82
|
+
`WorkerDirector -> Configured ${adapter.type} ${adapter.key}@${adapter.version} (${adapter.label}) for Autorun at ${JSON.stringify(workItemConfiguration.schedule?.schedules)}`,
|
|
83
|
+
);
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
getAutoSchedules: () => Array.from(AutoScheduleMap),
|
|
87
|
+
|
|
88
|
+
getAdapterByType: (type: string) => {
|
|
89
|
+
const adapters = WorkerDirector.getAdapters({
|
|
90
|
+
adapterFilter: (Adapter) => {
|
|
91
|
+
return type === Adapter.type;
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
return adapters?.[0];
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
doWork: async ({ type, input, _id: workId }, unchainedAPI) => {
|
|
98
|
+
const adapter = WorkerDirector.getAdapterByType(type);
|
|
99
|
+
|
|
100
|
+
if (!adapter) {
|
|
101
|
+
logger.info(`WorkerDirector: No registered adapter for type: ${type}`);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
try {
|
|
105
|
+
const output = await adapter.doWork(input, unchainedAPI, workId);
|
|
106
|
+
return output;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
// DO not use this as flow control. The adapter should catch expected errors and return status: FAILED
|
|
109
|
+
logger.debug('DO not use this as flow control.');
|
|
110
|
+
logger.info(`WorkerDirector -> Error doing work ${type}: ${error.message}`);
|
|
111
|
+
|
|
112
|
+
const errorOutput = { error, success: false };
|
|
113
|
+
return errorOutput;
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
processNextWork: async (unchainedAPI: { modules: Modules }, workerId?: string): Promise<Work> => {
|
|
118
|
+
const adapters = WorkerDirector.getAdapters();
|
|
119
|
+
|
|
120
|
+
const allocationMap = await unchainedAPI.modules.worker.allocationMap();
|
|
121
|
+
|
|
122
|
+
const types = adapters
|
|
123
|
+
.filter((adapter) => {
|
|
124
|
+
// Filter out the external
|
|
125
|
+
if (adapter.external) return false;
|
|
126
|
+
if (
|
|
127
|
+
adapter.maxParallelAllocations &&
|
|
128
|
+
adapter.maxParallelAllocations <= allocationMap[adapter.type]
|
|
129
|
+
)
|
|
130
|
+
return false;
|
|
131
|
+
return true;
|
|
132
|
+
})
|
|
133
|
+
.map((adapter) => adapter.type);
|
|
134
|
+
|
|
135
|
+
const worker = workerId ?? unchainedAPI.modules.worker.workerId;
|
|
136
|
+
const work = await unchainedAPI.modules.worker.allocateWork({
|
|
137
|
+
types,
|
|
138
|
+
worker,
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
if (work) {
|
|
142
|
+
const output = await WorkerDirector.doWork(work, unchainedAPI);
|
|
143
|
+
|
|
144
|
+
return await unchainedAPI.modules.worker.finishWork(work._id, {
|
|
145
|
+
...output,
|
|
146
|
+
finished: work.finished || new Date(),
|
|
147
|
+
started: work.started,
|
|
148
|
+
worker,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return null;
|
|
153
|
+
},
|
|
154
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export * from './BasePricingAdapter.js';
|
|
2
|
+
export * from './BasePricingDirector.js';
|
|
3
|
+
export * from './BasePricingSheet.js';
|
|
4
|
+
|
|
5
|
+
export * from './BaseDiscountAdapter.js';
|
|
6
|
+
export * from './BaseDiscountDirector.js';
|
|
7
|
+
|
|
8
|
+
export * from './DeliveryAdapter.js';
|
|
9
|
+
export * from './DeliveryDirector.js';
|
|
10
|
+
export * from './DeliveryPricingAdapter.js';
|
|
11
|
+
export * from './DeliveryPricingDirector.js';
|
|
12
|
+
export * from './DeliveryPricingSheet.js';
|
|
13
|
+
|
|
14
|
+
export * from './PaymentAdapter.js';
|
|
15
|
+
export * from './PaymentDirector.js';
|
|
16
|
+
export * from './PaymentPricingAdapter.js';
|
|
17
|
+
export * from './PaymentPricingDirector.js';
|
|
18
|
+
export * from './PaymentPricingSheet.js';
|
|
19
|
+
|
|
20
|
+
export * from './EnrollmentAdapter.js';
|
|
21
|
+
export * from './EnrollmentDirector.js';
|
|
22
|
+
|
|
23
|
+
export * from './FilterAdapter.js';
|
|
24
|
+
export * from './FilterDirector.js';
|
|
25
|
+
|
|
26
|
+
export * from './ProductDiscountAdapter.js';
|
|
27
|
+
export * from './ProductDiscountDirector.js';
|
|
28
|
+
export * from './ProductDiscountConfiguration.js';
|
|
29
|
+
export * from './ProductPricingAdapter.js';
|
|
30
|
+
export * from './ProductPricingDirector.js';
|
|
31
|
+
export * from './ProductPricingSheet.js';
|
|
32
|
+
|
|
33
|
+
export * from './OrderDiscountConfiguration.js';
|
|
34
|
+
export * from './OrderDiscountAdapter.js';
|
|
35
|
+
export * from './OrderDiscountDirector.js';
|
|
36
|
+
export * from './OrderPricingAdapter.js';
|
|
37
|
+
export * from './OrderPricingDirector.js';
|
|
38
|
+
export * from './OrderPricingSheet.js';
|
|
39
|
+
|
|
40
|
+
export * from './WarehousingDirector.js';
|
|
41
|
+
export * from './WarehousingAdapter.js';
|
|
42
|
+
|
|
43
|
+
export * from './WorkerAdapter.js';
|
|
44
|
+
export * from './WorkerDirector.js';
|
|
45
|
+
|
|
46
|
+
export * from './QuotationAdapter.js';
|
|
47
|
+
export * from './QuotationDirector.js';
|
|
48
|
+
|
|
49
|
+
export * from './MessagingDirector.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { periodForReferenceDate } from './EnrollmentAdapter.js';
|
|
2
|
+
|
|
3
|
+
describe('periodForReferenceDate', () => {
|
|
4
|
+
it('Should return 1 week interval from When passed a given date', () => {
|
|
5
|
+
expect(periodForReferenceDate(new Date('2022-12-03T17:00:00.000Z'))).toEqual({
|
|
6
|
+
start: new Date('2022-12-03T17:00:00.000Z'),
|
|
7
|
+
end: new Date('2022-12-10T17:00:00.000Z'),
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
it('Should return 2 week interval from When passed 2 as interval', () => {
|
|
11
|
+
expect(periodForReferenceDate(new Date('2022-12-03T17:00:00.000Z'), 2)).toEqual({
|
|
12
|
+
start: new Date('2022-12-03T17:00:00.000Z'),
|
|
13
|
+
end: new Date('2022-12-17T17:00:00.000Z'),
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('Should return 2 HOURS when interval is set to HOURS', () => {
|
|
18
|
+
expect(periodForReferenceDate(new Date('2022-12-03T17:00:00.000Z'), 2, 'HOURS')).toEqual({
|
|
19
|
+
start: new Date('2022-12-03T17:00:00.000Z'),
|
|
20
|
+
end: new Date('2022-12-03T19:00:00.000Z'),
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
package/src/modules.ts
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AssortmentsModule,
|
|
3
|
+
AssortmentsSettingsOptions,
|
|
4
|
+
configureAssortmentsModule,
|
|
5
|
+
} from '@unchainedshop/core-assortments';
|
|
6
|
+
import { BookmarksModule, configureBookmarksModule } from '@unchainedshop/core-bookmarks';
|
|
7
|
+
import { configureCountriesModule, CountriesModule } from '@unchainedshop/core-countries';
|
|
8
|
+
import { configureCurrenciesModule, CurrenciesModule } from '@unchainedshop/core-currencies';
|
|
9
|
+
import {
|
|
10
|
+
configureDeliveryModule,
|
|
11
|
+
DeliveryModule,
|
|
12
|
+
DeliverySettingsOptions,
|
|
13
|
+
} from '@unchainedshop/core-delivery';
|
|
14
|
+
import {
|
|
15
|
+
configureEnrollmentsModule,
|
|
16
|
+
EnrollmentsModule,
|
|
17
|
+
EnrollmentsSettingsOptions,
|
|
18
|
+
} from '@unchainedshop/core-enrollments';
|
|
19
|
+
import { configureEventsModule, EventsModule } from '@unchainedshop/core-events';
|
|
20
|
+
import { configureFilesModule, FilesModule, FilesSettingsOptions } from '@unchainedshop/core-files';
|
|
21
|
+
import {
|
|
22
|
+
configureFiltersModule,
|
|
23
|
+
FiltersModule,
|
|
24
|
+
FiltersSettingsOptions,
|
|
25
|
+
} from '@unchainedshop/core-filters';
|
|
26
|
+
import { configureLanguagesModule, LanguagesModule } from '@unchainedshop/core-languages';
|
|
27
|
+
import { configureMessagingModule, MessagingModule } from '@unchainedshop/core-messaging';
|
|
28
|
+
import { configureOrdersModule, OrdersModule, OrdersSettingsOptions } from '@unchainedshop/core-orders';
|
|
29
|
+
import {
|
|
30
|
+
configurePaymentModule,
|
|
31
|
+
PaymentModule,
|
|
32
|
+
PaymentSettingsOptions,
|
|
33
|
+
} from '@unchainedshop/core-payment';
|
|
34
|
+
import {
|
|
35
|
+
configureProductsModule,
|
|
36
|
+
ProductsModule,
|
|
37
|
+
ProductsSettingsOptions,
|
|
38
|
+
} from '@unchainedshop/core-products';
|
|
39
|
+
import {
|
|
40
|
+
configureQuotationsModule,
|
|
41
|
+
QuotationsModule,
|
|
42
|
+
QuotationsSettingsOptions,
|
|
43
|
+
} from '@unchainedshop/core-quotations';
|
|
44
|
+
import { configureUsersModule, UserSettingsOptions, UsersModule } from '@unchainedshop/core-users';
|
|
45
|
+
import { configureWarehousingModule, WarehousingModule } from '@unchainedshop/core-warehousing';
|
|
46
|
+
import { configureWorkerModule, WorkerModule, WorkerSettingsOptions } from '@unchainedshop/core-worker';
|
|
47
|
+
import { MigrationRepository, ModuleInput, mongodb } from '@unchainedshop/mongodb';
|
|
48
|
+
|
|
49
|
+
export interface Modules {
|
|
50
|
+
assortments: AssortmentsModule;
|
|
51
|
+
bookmarks: BookmarksModule;
|
|
52
|
+
countries: CountriesModule;
|
|
53
|
+
currencies: CurrenciesModule;
|
|
54
|
+
delivery: DeliveryModule;
|
|
55
|
+
enrollments: EnrollmentsModule;
|
|
56
|
+
events: EventsModule;
|
|
57
|
+
files: FilesModule;
|
|
58
|
+
filters: FiltersModule;
|
|
59
|
+
languages: LanguagesModule;
|
|
60
|
+
messaging: MessagingModule;
|
|
61
|
+
orders: OrdersModule;
|
|
62
|
+
payment: PaymentModule;
|
|
63
|
+
products: ProductsModule;
|
|
64
|
+
quotations: QuotationsModule;
|
|
65
|
+
users: UsersModule;
|
|
66
|
+
warehousing: WarehousingModule;
|
|
67
|
+
worker: WorkerModule;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface ModuleOptions {
|
|
71
|
+
assortments?: AssortmentsSettingsOptions;
|
|
72
|
+
products?: ProductsSettingsOptions;
|
|
73
|
+
delivery?: DeliverySettingsOptions;
|
|
74
|
+
filters?: FiltersSettingsOptions;
|
|
75
|
+
enrollments?: EnrollmentsSettingsOptions;
|
|
76
|
+
orders?: OrdersSettingsOptions;
|
|
77
|
+
quotations?: QuotationsSettingsOptions;
|
|
78
|
+
files?: FilesSettingsOptions;
|
|
79
|
+
payment?: PaymentSettingsOptions;
|
|
80
|
+
worker?: WorkerSettingsOptions;
|
|
81
|
+
users?: UserSettingsOptions;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const initModules = async (
|
|
85
|
+
{
|
|
86
|
+
db,
|
|
87
|
+
migrationRepository,
|
|
88
|
+
options,
|
|
89
|
+
}: {
|
|
90
|
+
db: mongodb.Db;
|
|
91
|
+
migrationRepository: MigrationRepository<unknown>;
|
|
92
|
+
options?: ModuleOptions;
|
|
93
|
+
},
|
|
94
|
+
customModules: Record<
|
|
95
|
+
string,
|
|
96
|
+
{
|
|
97
|
+
configure: (params: ModuleInput<any>) => any;
|
|
98
|
+
}
|
|
99
|
+
>,
|
|
100
|
+
): Promise<Modules> => {
|
|
101
|
+
const assortments = await configureAssortmentsModule({
|
|
102
|
+
db,
|
|
103
|
+
options: options.assortments,
|
|
104
|
+
migrationRepository,
|
|
105
|
+
});
|
|
106
|
+
const bookmarks = await configureBookmarksModule({
|
|
107
|
+
db,
|
|
108
|
+
migrationRepository,
|
|
109
|
+
});
|
|
110
|
+
const countries = await configureCountriesModule({
|
|
111
|
+
db,
|
|
112
|
+
migrationRepository,
|
|
113
|
+
});
|
|
114
|
+
const currencies = await configureCurrenciesModule({
|
|
115
|
+
db,
|
|
116
|
+
migrationRepository,
|
|
117
|
+
});
|
|
118
|
+
const delivery = await configureDeliveryModule({
|
|
119
|
+
db,
|
|
120
|
+
options: options.delivery,
|
|
121
|
+
migrationRepository,
|
|
122
|
+
});
|
|
123
|
+
const enrollments = await configureEnrollmentsModule({
|
|
124
|
+
db,
|
|
125
|
+
options: options.enrollments,
|
|
126
|
+
migrationRepository,
|
|
127
|
+
});
|
|
128
|
+
const events = await configureEventsModule({
|
|
129
|
+
db,
|
|
130
|
+
migrationRepository,
|
|
131
|
+
});
|
|
132
|
+
const files = await configureFilesModule({
|
|
133
|
+
db,
|
|
134
|
+
options: options.files,
|
|
135
|
+
migrationRepository,
|
|
136
|
+
});
|
|
137
|
+
const filters = await configureFiltersModule({
|
|
138
|
+
db,
|
|
139
|
+
options: options.filters,
|
|
140
|
+
migrationRepository,
|
|
141
|
+
});
|
|
142
|
+
const languages = await configureLanguagesModule({
|
|
143
|
+
db,
|
|
144
|
+
migrationRepository,
|
|
145
|
+
});
|
|
146
|
+
const messaging = await configureMessagingModule({
|
|
147
|
+
db,
|
|
148
|
+
migrationRepository,
|
|
149
|
+
});
|
|
150
|
+
const orders = await configureOrdersModule({
|
|
151
|
+
db,
|
|
152
|
+
options: options.orders,
|
|
153
|
+
migrationRepository,
|
|
154
|
+
});
|
|
155
|
+
const payment = await configurePaymentModule({
|
|
156
|
+
db,
|
|
157
|
+
options: options.payment,
|
|
158
|
+
migrationRepository,
|
|
159
|
+
});
|
|
160
|
+
const products = await configureProductsModule({
|
|
161
|
+
db,
|
|
162
|
+
migrationRepository,
|
|
163
|
+
});
|
|
164
|
+
const quotations = await configureQuotationsModule({
|
|
165
|
+
db,
|
|
166
|
+
options: options.quotations,
|
|
167
|
+
migrationRepository,
|
|
168
|
+
});
|
|
169
|
+
const users = await configureUsersModule({
|
|
170
|
+
db,
|
|
171
|
+
options: options.users,
|
|
172
|
+
migrationRepository,
|
|
173
|
+
});
|
|
174
|
+
const warehousing = await configureWarehousingModule({
|
|
175
|
+
db,
|
|
176
|
+
migrationRepository,
|
|
177
|
+
});
|
|
178
|
+
const worker = await configureWorkerModule({
|
|
179
|
+
db,
|
|
180
|
+
options: options.worker,
|
|
181
|
+
migrationRepository,
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
const modules = {
|
|
185
|
+
assortments,
|
|
186
|
+
bookmarks,
|
|
187
|
+
countries,
|
|
188
|
+
currencies,
|
|
189
|
+
delivery,
|
|
190
|
+
enrollments,
|
|
191
|
+
events,
|
|
192
|
+
files,
|
|
193
|
+
filters,
|
|
194
|
+
languages,
|
|
195
|
+
messaging,
|
|
196
|
+
orders,
|
|
197
|
+
payment,
|
|
198
|
+
products,
|
|
199
|
+
quotations,
|
|
200
|
+
users,
|
|
201
|
+
warehousing,
|
|
202
|
+
worker,
|
|
203
|
+
};
|
|
204
|
+
for (const [key, customModule] of Object.entries(customModules)) {
|
|
205
|
+
modules[key] = await customModule.configure({
|
|
206
|
+
db,
|
|
207
|
+
options: options[key],
|
|
208
|
+
migrationRepository,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return modules;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export default initModules;
|