@unchainedshop/core 4.0.0-rc.9 → 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 +3 -3
- package/lib/directors/DeliveryAdapter.d.ts.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.js +3 -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 -3
- 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 +3 -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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/bulk-importer/handlers/product/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAMtD,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuE3C,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAAb,aAAa"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import upsertVariations, { ProductVariationSchema } from './upsertVariations.js';
|
|
3
|
+
import upsertMedia, { MediaSchema } from './upsertMedia.js';
|
|
4
|
+
import createProduct from './create.js';
|
|
5
|
+
import convertTagsToLowerCase from '../utils/convertTagsToLowerCase.js';
|
|
6
|
+
export const ProductUpdateSpecificationSchema = z.object({
|
|
7
|
+
type: z.string().optional(),
|
|
8
|
+
sequence: z.number().optional(),
|
|
9
|
+
status: z.string().optional().nullable(), // or null!
|
|
10
|
+
published: z.string().datetime().optional().nullable(), // or null!
|
|
11
|
+
tags: z.array(z.string()).optional(),
|
|
12
|
+
commerce: z
|
|
13
|
+
.object({
|
|
14
|
+
pricing: z.array(z.object({
|
|
15
|
+
amount: z.number(),
|
|
16
|
+
maxQuantity: z.number().optional(),
|
|
17
|
+
isTaxable: z.boolean().optional(),
|
|
18
|
+
isNetPrice: z.boolean().optional(),
|
|
19
|
+
currencyCode: z.string(),
|
|
20
|
+
countryCode: z.string(),
|
|
21
|
+
})),
|
|
22
|
+
})
|
|
23
|
+
.optional(),
|
|
24
|
+
warehousing: z
|
|
25
|
+
.object({
|
|
26
|
+
sku: z.string().optional(),
|
|
27
|
+
baseUnit: z.string().optional(),
|
|
28
|
+
})
|
|
29
|
+
.optional(),
|
|
30
|
+
supply: z
|
|
31
|
+
.object({
|
|
32
|
+
weightInGram: z.number().optional(),
|
|
33
|
+
heightInMillimeters: z.number().optional(),
|
|
34
|
+
lengthInMillimeters: z.number().optional(),
|
|
35
|
+
widthInMillimeters: z.number().optional(),
|
|
36
|
+
})
|
|
37
|
+
.optional(),
|
|
38
|
+
bundleItems: z
|
|
39
|
+
.array(z.object({
|
|
40
|
+
productId: z.string(),
|
|
41
|
+
quantity: z.number(),
|
|
42
|
+
configuration: z.array(z.object({
|
|
43
|
+
key: z.string(),
|
|
44
|
+
value: z.string(),
|
|
45
|
+
})),
|
|
46
|
+
}))
|
|
47
|
+
.optional(),
|
|
48
|
+
meta: z.record(z.unknown()).optional(),
|
|
49
|
+
content: z
|
|
50
|
+
.record(z.string(), // locale
|
|
51
|
+
z.object({
|
|
52
|
+
title: z.string().optional(),
|
|
53
|
+
subtitle: z.string().optional(),
|
|
54
|
+
slug: z.string().optional(),
|
|
55
|
+
description: z.string().optional(),
|
|
56
|
+
brand: z.string().optional(),
|
|
57
|
+
vendor: z.string().optional(),
|
|
58
|
+
labels: z.array(z.string()).optional(),
|
|
59
|
+
}))
|
|
60
|
+
.optional(),
|
|
61
|
+
variationResolvers: z
|
|
62
|
+
.array(z.object({
|
|
63
|
+
vector: z.record(z.string()),
|
|
64
|
+
productId: z.string(),
|
|
65
|
+
}))
|
|
66
|
+
.optional(),
|
|
67
|
+
});
|
|
68
|
+
export const ProductUpdatePayloadSchema = z.object({
|
|
69
|
+
_id: z.string(),
|
|
70
|
+
specification: ProductUpdateSpecificationSchema.optional(),
|
|
71
|
+
media: z.array(MediaSchema).optional(),
|
|
72
|
+
variations: z.array(ProductVariationSchema).optional(),
|
|
73
|
+
});
|
|
74
|
+
const transformSpecification = (specification) => {
|
|
75
|
+
const { variationResolvers: assignments, content, // eslint-disable-line
|
|
76
|
+
supply, warehousing, ...productData } = specification;
|
|
77
|
+
const tags = productData?.tags ? convertTagsToLowerCase(productData.tags) : [];
|
|
78
|
+
const proxy = assignments ? { assignments } : undefined;
|
|
79
|
+
return {
|
|
80
|
+
...productData,
|
|
81
|
+
published: productData.published ? new Date(productData.published) : undefined,
|
|
82
|
+
tags,
|
|
83
|
+
warehousing,
|
|
84
|
+
supply,
|
|
85
|
+
proxy,
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export default async function updateProduct(payload, { logger, updateShouldUpsertIfIDNotExists }, unchainedAPI) {
|
|
89
|
+
const { modules } = unchainedAPI;
|
|
90
|
+
const { specification, media, variations, _id } = payload;
|
|
91
|
+
if (!(await modules.products.productExists({ productId: _id }))) {
|
|
92
|
+
if (updateShouldUpsertIfIDNotExists && payload.specification) {
|
|
93
|
+
return createProduct(payload, { logger, createShouldUpsertIfIDExists: false }, unchainedAPI);
|
|
94
|
+
}
|
|
95
|
+
throw new Error(`Can't update non-existing product ${_id}`);
|
|
96
|
+
}
|
|
97
|
+
if (specification) {
|
|
98
|
+
const productData = transformSpecification(specification);
|
|
99
|
+
logger.debug('update product object', productData);
|
|
100
|
+
await modules.products.update(_id, {
|
|
101
|
+
...productData,
|
|
102
|
+
});
|
|
103
|
+
if (specification.content) {
|
|
104
|
+
logger.debug('replace localized content for product', specification.content);
|
|
105
|
+
await modules.products.texts.updateTexts(_id, Object.entries(specification.content).map(([locale, localizedData]) => {
|
|
106
|
+
return {
|
|
107
|
+
locale,
|
|
108
|
+
...localizedData,
|
|
109
|
+
};
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (variations) {
|
|
114
|
+
logger.debug('replace variations', variations);
|
|
115
|
+
await upsertVariations({
|
|
116
|
+
variations: variations || [],
|
|
117
|
+
productId: _id,
|
|
118
|
+
}, unchainedAPI);
|
|
119
|
+
}
|
|
120
|
+
if (media) {
|
|
121
|
+
logger.debug('replace product media', media);
|
|
122
|
+
await upsertMedia({ media, productId: _id }, unchainedAPI);
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
entity: 'PRODUCT',
|
|
126
|
+
operation: 'update',
|
|
127
|
+
_id,
|
|
128
|
+
success: true,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
updateProduct.payloadSchema = ProductUpdatePayloadSchema;
|
|
132
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/bulk-importer/handlers/product/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAA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,CAAC,KAAK,CAAC,WAAW,CACtC,GAAG,EACH,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,aAAa,CAAgB,EAAE,EAAE;gBACnF,OAAO;oBACL,MAAM;oBACN,GAAG,aAAa;iBACjB,CAAC;YACJ,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;QAC/C,MAAM,gBAAgB,CACpB;YACE,UAAU,EAAE,UAAU,IAAI,EAAE;YAC5B,SAAS,EAAE,GAAG;SACf,EACD,YAAY,CACb,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;QAC7C,MAAM,WAAW,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,YAAY,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO;QACL,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,QAAQ;QACnB,GAAG;QACH,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC;AAED,aAAa,CAAC,aAAa,GAAG,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Modules } from '../../../modules.js';
|
|
3
|
+
import { Services } from '../../../services/index.js';
|
|
4
|
+
export declare const MediaSchema: z.ZodObject<{
|
|
5
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
6
|
+
asset: z.ZodObject<{
|
|
7
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
8
|
+
url: z.ZodString;
|
|
9
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
10
|
+
fileName: z.ZodString;
|
|
11
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
url: string;
|
|
14
|
+
fileName: string;
|
|
15
|
+
_id?: string | undefined;
|
|
16
|
+
meta?: Record<string, unknown> | undefined;
|
|
17
|
+
headers?: Record<string, string> | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
url: string;
|
|
20
|
+
fileName: string;
|
|
21
|
+
_id?: string | undefined;
|
|
22
|
+
meta?: Record<string, unknown> | undefined;
|
|
23
|
+
headers?: Record<string, string> | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
26
|
+
title: z.ZodOptional<z.ZodString>;
|
|
27
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
title?: string | undefined;
|
|
30
|
+
subtitle?: string | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
title?: string | undefined;
|
|
33
|
+
subtitle?: string | undefined;
|
|
34
|
+
}>>>;
|
|
35
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
36
|
+
sortKey: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
asset: {
|
|
39
|
+
url: string;
|
|
40
|
+
fileName: string;
|
|
41
|
+
_id?: string | undefined;
|
|
42
|
+
meta?: Record<string, unknown> | undefined;
|
|
43
|
+
headers?: Record<string, string> | undefined;
|
|
44
|
+
};
|
|
45
|
+
_id?: string | undefined;
|
|
46
|
+
tags?: string[] | undefined;
|
|
47
|
+
sortKey?: number | undefined;
|
|
48
|
+
content?: Record<string, {
|
|
49
|
+
title?: string | undefined;
|
|
50
|
+
subtitle?: string | undefined;
|
|
51
|
+
}> | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
asset: {
|
|
54
|
+
url: string;
|
|
55
|
+
fileName: string;
|
|
56
|
+
_id?: string | undefined;
|
|
57
|
+
meta?: Record<string, unknown> | undefined;
|
|
58
|
+
headers?: Record<string, string> | undefined;
|
|
59
|
+
};
|
|
60
|
+
_id?: string | undefined;
|
|
61
|
+
tags?: string[] | undefined;
|
|
62
|
+
sortKey?: number | undefined;
|
|
63
|
+
content?: Record<string, {
|
|
64
|
+
title?: string | undefined;
|
|
65
|
+
subtitle?: string | undefined;
|
|
66
|
+
}> | undefined;
|
|
67
|
+
}>;
|
|
68
|
+
export default function upsertMedia({ media, productId }: {
|
|
69
|
+
media: z.infer<typeof MediaSchema>[];
|
|
70
|
+
productId: string;
|
|
71
|
+
}, unchainedAPI: {
|
|
72
|
+
modules: Modules;
|
|
73
|
+
services: Services;
|
|
74
|
+
}): Promise<void>;
|
|
75
|
+
//# sourceMappingURL=upsertMedia.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsertMedia.d.ts","sourceRoot":"","sources":["../../../../src/bulk-importer/handlers/product/upsertMedia.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAItD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EActB,CAAC;AAaH,wBAA8B,WAAW,CACvC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;IAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EACjF,YAAY,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,iBA4CvD"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import convertTagsToLowerCase from '../utils/convertTagsToLowerCase.js';
|
|
3
|
+
import upsertAsset, { AssetSchema } from '../../upsertAsset.js';
|
|
4
|
+
export const MediaSchema = z.object({
|
|
5
|
+
_id: z.string().optional(),
|
|
6
|
+
asset: AssetSchema,
|
|
7
|
+
content: z
|
|
8
|
+
.record(z.string(), // locale
|
|
9
|
+
z.object({
|
|
10
|
+
title: z.string().optional(),
|
|
11
|
+
subtitle: z.string().optional(),
|
|
12
|
+
}))
|
|
13
|
+
.optional(),
|
|
14
|
+
tags: z.array(z.string()).optional(),
|
|
15
|
+
sortKey: z.number().optional(),
|
|
16
|
+
});
|
|
17
|
+
const upsertProductMedia = async (productMedia, { modules }) => {
|
|
18
|
+
try {
|
|
19
|
+
const productMediaObj = await modules.products.media.create(productMedia);
|
|
20
|
+
return productMediaObj;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
const { _id, ...productMediaData } = productMedia;
|
|
24
|
+
const productMediaId = _id;
|
|
25
|
+
return modules.products.media.update(productMediaId, productMediaData);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export default async function upsertMedia({ media, productId }, unchainedAPI) {
|
|
29
|
+
const { modules } = unchainedAPI;
|
|
30
|
+
const productMediaObjects = await Promise.all(media.map(async ({ asset, content, ...mediaData }) => {
|
|
31
|
+
const tags = mediaData?.tags ? convertTagsToLowerCase(mediaData?.tags) : [];
|
|
32
|
+
const file = await upsertAsset('product-media', { meta: { ...(asset.meta || {}), productId }, ...asset }, unchainedAPI);
|
|
33
|
+
if (!file)
|
|
34
|
+
throw new Error(`Unable to create binary ${asset._id}`);
|
|
35
|
+
const fileId = file._id;
|
|
36
|
+
const productMedia = await upsertProductMedia({
|
|
37
|
+
...mediaData,
|
|
38
|
+
tags,
|
|
39
|
+
productId,
|
|
40
|
+
mediaId: file._id,
|
|
41
|
+
}, unchainedAPI);
|
|
42
|
+
if (!productMedia)
|
|
43
|
+
throw new Error(`Unable to create product media object for file ${fileId}`);
|
|
44
|
+
if (content) {
|
|
45
|
+
await modules.products.media.texts.updateMediaTexts(productMedia._id, Object.entries(content).map(([locale, localizedData]) => {
|
|
46
|
+
return {
|
|
47
|
+
locale,
|
|
48
|
+
...localizedData,
|
|
49
|
+
};
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
return productMedia;
|
|
53
|
+
}));
|
|
54
|
+
await modules.products.media.deleteMediaFiles({
|
|
55
|
+
productId,
|
|
56
|
+
excludedProductMediaIds: productMediaObjects.map((obj) => obj._id),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=upsertMedia.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsertMedia.js","sourceRoot":"","sources":["../../../../src/bulk-importer/handlers/product/upsertMedia.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,sBAAsB,MAAM,oCAAoC,CAAC;AACxE,OAAO,WAAW,EAAE,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,KAAK,EAAE,WAAW;IAClB,OAAO,EAAE,CAAC;SACP,MAAM,CACL,CAAC,CAAC,MAAM,EAAE,EAAE,SAAS;IACrB,CAAC,CAAC,MAAM,CAAC;QACP,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC5B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAChC,CAAC,CACH;SACA,QAAQ,EAAE;IACb,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACpC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAA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AM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC;QACxB,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAC3C;YACE,GAAG,SAAS;YACZ,IAAI;YACJ,SAAS;YACT,OAAO,EAAE,IAAI,CAAC,GAAG;SACF,EACjB,YAAY,CACb,CAAC;QACF,IAAI,CAAC,YAAY;YAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,MAAM,EAAE,CAAC,CAAC;QAE/F,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,CACjD,YAAY,CAAC,GAAG,EAChB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,aAAa,CAAgB,EAAE,EAAE;gBACrE,OAAO;oBACL,MAAM;oBACN,GAAG,aAAa;iBACjB,CAAC;YACJ,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC,CAAC,CACH,CAAC;IAEF,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC;QAC5C,SAAS;QACT,uBAAuB,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC;KACnE,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Modules } from '../../../modules.js';
|
|
3
|
+
export declare const ProductVariationSchema: z.ZodObject<{
|
|
4
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
type: z.ZodString;
|
|
7
|
+
options: z.ZodArray<z.ZodObject<{
|
|
8
|
+
value: z.ZodString;
|
|
9
|
+
content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
10
|
+
title: z.ZodOptional<z.ZodString>;
|
|
11
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
title?: string | undefined;
|
|
14
|
+
subtitle?: string | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
title?: string | undefined;
|
|
17
|
+
subtitle?: string | undefined;
|
|
18
|
+
}>>>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
value: string;
|
|
21
|
+
content?: Record<string, {
|
|
22
|
+
title?: string | undefined;
|
|
23
|
+
subtitle?: string | undefined;
|
|
24
|
+
}> | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
value: string;
|
|
27
|
+
content?: Record<string, {
|
|
28
|
+
title?: string | undefined;
|
|
29
|
+
subtitle?: string | undefined;
|
|
30
|
+
}> | undefined;
|
|
31
|
+
}>, "many">;
|
|
32
|
+
content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
33
|
+
title: z.ZodOptional<z.ZodString>;
|
|
34
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
title?: string | undefined;
|
|
37
|
+
subtitle?: string | undefined;
|
|
38
|
+
}, {
|
|
39
|
+
title?: string | undefined;
|
|
40
|
+
subtitle?: string | undefined;
|
|
41
|
+
}>>>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
key: string;
|
|
44
|
+
type: string;
|
|
45
|
+
options: {
|
|
46
|
+
value: string;
|
|
47
|
+
content?: Record<string, {
|
|
48
|
+
title?: string | undefined;
|
|
49
|
+
subtitle?: string | undefined;
|
|
50
|
+
}> | undefined;
|
|
51
|
+
}[];
|
|
52
|
+
_id?: string | undefined;
|
|
53
|
+
content?: Record<string, {
|
|
54
|
+
title?: string | undefined;
|
|
55
|
+
subtitle?: string | undefined;
|
|
56
|
+
}> | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
key: string;
|
|
59
|
+
type: string;
|
|
60
|
+
options: {
|
|
61
|
+
value: string;
|
|
62
|
+
content?: Record<string, {
|
|
63
|
+
title?: string | undefined;
|
|
64
|
+
subtitle?: string | undefined;
|
|
65
|
+
}> | undefined;
|
|
66
|
+
}[];
|
|
67
|
+
_id?: string | undefined;
|
|
68
|
+
content?: Record<string, {
|
|
69
|
+
title?: string | undefined;
|
|
70
|
+
subtitle?: string | undefined;
|
|
71
|
+
}> | undefined;
|
|
72
|
+
}>;
|
|
73
|
+
export default function upsertVariations({ variations, productId }: {
|
|
74
|
+
variations: z.infer<typeof ProductVariationSchema>[];
|
|
75
|
+
productId: string;
|
|
76
|
+
}, unchainedAPI: {
|
|
77
|
+
modules: Modules;
|
|
78
|
+
}): Promise<void>;
|
|
79
|
+
//# sourceMappingURL=upsertVariations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsertVariations.d.ts","sourceRoot":"","sources":["../../../../src/bulk-importer/handlers/product/upsertVariations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAe9C,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcjC,CAAC;AAqBH,wBAA8B,gBAAgB,CAC5C,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE;IAAE,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EACtG,YAAY,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,iBAuDnC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const ProductVariationOptionSchema = z.object({
|
|
3
|
+
value: z.string(),
|
|
4
|
+
content: z
|
|
5
|
+
.record(z.string(), // locale
|
|
6
|
+
z.object({
|
|
7
|
+
title: z.string().optional(),
|
|
8
|
+
subtitle: z.string().optional(),
|
|
9
|
+
}))
|
|
10
|
+
.optional(),
|
|
11
|
+
});
|
|
12
|
+
export const ProductVariationSchema = z.object({
|
|
13
|
+
_id: z.string().optional(),
|
|
14
|
+
key: z.string(),
|
|
15
|
+
type: z.string(),
|
|
16
|
+
options: z.array(ProductVariationOptionSchema),
|
|
17
|
+
content: z
|
|
18
|
+
.record(z.string(), // locale
|
|
19
|
+
z.object({
|
|
20
|
+
title: z.string().optional(),
|
|
21
|
+
subtitle: z.string().optional(),
|
|
22
|
+
}))
|
|
23
|
+
.optional(),
|
|
24
|
+
});
|
|
25
|
+
const upsert = async (productVariation, unchainedAPI) => {
|
|
26
|
+
const { modules } = unchainedAPI;
|
|
27
|
+
try {
|
|
28
|
+
const newVariation = (await modules.products.variations.create(productVariation));
|
|
29
|
+
return newVariation;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return (await modules.products.variations.update(productVariation._id, productVariation));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
export default async function upsertVariations({ variations, productId }, unchainedAPI) {
|
|
36
|
+
const { modules } = unchainedAPI;
|
|
37
|
+
const upsertedProductVariationIds = await Promise.all(variations.map(async ({ content, options, ...variationsRest }) => {
|
|
38
|
+
const variation = await upsert({
|
|
39
|
+
...variationsRest,
|
|
40
|
+
options: options.map((option) => option.value),
|
|
41
|
+
productId,
|
|
42
|
+
}, unchainedAPI);
|
|
43
|
+
await Promise.all(options.map(async ({ content: optionContent, value: optionValue }) => {
|
|
44
|
+
if (optionContent) {
|
|
45
|
+
await modules.products.variations.texts.updateVariationTexts(variation._id, Object.entries(optionContent).map(([locale, localizedData]) => {
|
|
46
|
+
return {
|
|
47
|
+
locale,
|
|
48
|
+
...localizedData,
|
|
49
|
+
};
|
|
50
|
+
}), optionValue);
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
if (content) {
|
|
54
|
+
await modules.products.variations.texts.updateVariationTexts(variation._id, Object.entries(content).map(([locale, localizedData]) => {
|
|
55
|
+
return {
|
|
56
|
+
locale,
|
|
57
|
+
...localizedData,
|
|
58
|
+
};
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
return variation._id;
|
|
62
|
+
}));
|
|
63
|
+
const allVariations = await modules.products.variations.findProductVariations({
|
|
64
|
+
productId,
|
|
65
|
+
});
|
|
66
|
+
await Promise.all(allVariations.map(async (variation) => {
|
|
67
|
+
if (!upsertedProductVariationIds.includes(variation._id)) {
|
|
68
|
+
await modules.products.variations.delete(variation._id);
|
|
69
|
+
}
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=upsertVariations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsertVariations.js","sourceRoot":"","sources":["../../../../src/bulk-importer/handlers/product/upsertVariations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,OAAO,EAAE,CAAC;SACP,MAAM,CACL,CAAC,CAAC,MAAM,EAAE,EAAE,SAAS;IACrB,CAAC,CAAC,MAAM,CAAC;QACP,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC5B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAChC,CAAC,CACH;SACA,QAAQ,EAAE;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO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E,CAAC;YACzD,MAAM,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertTagsToLowerCase.d.ts","sourceRoot":"","sources":["../../../../src/bulk-importer/handlers/utils/convertTagsToLowerCase.ts"],"names":[],"mappings":"yBAAgB,MAAM,MAAM,EAAE,KAAG,MAAM,EAAE,GAAG,IAAI;AAAhD,wBAGE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertTagsToLowerCase.js","sourceRoot":"","sources":["../../../../src/bulk-importer/handlers/utils/convertTagsToLowerCase.ts"],"names":[],"mappings":"AAAA,eAAe,CAAC,IAAc,EAAmB,EAAE;IACjD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACrE,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bulk-importer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,cAAc,yBAAyB,CAAC;AACxC,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bulk-importer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,cAAc,yBAAyB,CAAC;AACxC,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Modules } from '../modules.js';
|
|
2
|
+
import { Services } from '../services/index.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export declare const AssetSchema: z.ZodObject<{
|
|
5
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
6
|
+
url: z.ZodString;
|
|
7
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
8
|
+
fileName: z.ZodString;
|
|
9
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
url: string;
|
|
12
|
+
fileName: string;
|
|
13
|
+
_id?: string | undefined;
|
|
14
|
+
meta?: Record<string, unknown> | undefined;
|
|
15
|
+
headers?: Record<string, string> | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
url: string;
|
|
18
|
+
fileName: string;
|
|
19
|
+
_id?: string | undefined;
|
|
20
|
+
meta?: Record<string, unknown> | undefined;
|
|
21
|
+
headers?: Record<string, string> | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
declare const upsertAsset: (directoryName: string, asset: z.infer<typeof AssetSchema>, unchainedAPI: {
|
|
24
|
+
modules: Modules;
|
|
25
|
+
services: Services;
|
|
26
|
+
}) => Promise<import("@unchainedshop/core-files").File | null>;
|
|
27
|
+
export default upsertAsset;
|
|
28
|
+
//# sourceMappingURL=upsertAsset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsertAsset.d.ts","sourceRoot":"","sources":["../../src/bulk-importer/upsertAsset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;EAMtB,CAAC;AAEH,QAAA,MAAM,WAAW,GACf,eAAe,MAAM,EACrB,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAClC,cAAc;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,6DAgCvD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const AssetSchema = z.object({
|
|
3
|
+
_id: z.string().optional(),
|
|
4
|
+
url: z.string(),
|
|
5
|
+
meta: z.record(z.unknown()).optional(),
|
|
6
|
+
fileName: z.string(),
|
|
7
|
+
headers: z.record(z.string()).optional(),
|
|
8
|
+
});
|
|
9
|
+
const upsertAsset = async (directoryName, asset, unchainedAPI) => {
|
|
10
|
+
const { modules, services } = unchainedAPI;
|
|
11
|
+
const { _id: fileId, fileName, url, meta, headers, ...assetData } = asset;
|
|
12
|
+
try {
|
|
13
|
+
const existingFile = fileId && (await modules.files.findFile({ fileId }));
|
|
14
|
+
if (existingFile) {
|
|
15
|
+
if (JSON.stringify(meta) === JSON.stringify(existingFile.meta)) {
|
|
16
|
+
return existingFile;
|
|
17
|
+
}
|
|
18
|
+
await modules.files.update(fileId, { meta, ...assetData });
|
|
19
|
+
const updatedFile = await modules.files.findFile({ fileId });
|
|
20
|
+
return updatedFile;
|
|
21
|
+
}
|
|
22
|
+
const assetObject = await services.files.uploadFileFromURL({
|
|
23
|
+
directoryName,
|
|
24
|
+
fileInput: {
|
|
25
|
+
fileLink: url,
|
|
26
|
+
fileName,
|
|
27
|
+
fileId,
|
|
28
|
+
headers,
|
|
29
|
+
},
|
|
30
|
+
meta,
|
|
31
|
+
});
|
|
32
|
+
if (!assetObject)
|
|
33
|
+
throw new Error('Media not created');
|
|
34
|
+
return assetObject;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export default upsertAsset;
|
|
41
|
+
//# sourceMappingURL=upsertAsset.js.map
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AI,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;YAC3D,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;YAC7D,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC;YACzD,aAAa;YACb,SAAS,EAAE;gBACT,QAAQ,EAAE,GAAG;gBACb,QAAQ;gBACR,MAAM;gBACN,OAAO;aACR;YACD,IAAI;SACL,CAAC,CAAC;QAEH,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvD,OAAO,WAAW,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/lib/core-index.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { mongodb, MigrationRepository, ModuleInput } from '@unchainedshop/mongodb';
|
|
2
2
|
import { CustomServices, Services } from './services/index.js';
|
|
3
3
|
import { Modules, ModuleOptions } from './modules.js';
|
|
4
|
+
import { BulkImporter, BulkImportHandler } from './bulk-importer/index.js';
|
|
5
|
+
import { IBaseAdapter } from '@unchainedshop/utils';
|
|
6
|
+
export * from './bulk-importer/index.js';
|
|
4
7
|
export * from './services/index.js';
|
|
5
8
|
export * from './directors/index.js';
|
|
6
|
-
export
|
|
7
|
-
createBulkImporter: (options: any) => any;
|
|
8
|
-
}
|
|
9
|
+
export * from './factory/index.js';
|
|
9
10
|
export interface UnchainedCoreOptions {
|
|
10
11
|
db: mongodb.Db;
|
|
11
12
|
migrationRepository: MigrationRepository<UnchainedCore>;
|
|
12
|
-
bulkImporter
|
|
13
|
+
bulkImporter?: {
|
|
14
|
+
handlers?: Record<string, BulkImportHandler<UnchainedCore>>;
|
|
15
|
+
};
|
|
13
16
|
modules?: Record<string, {
|
|
14
17
|
configure: (params: ModuleInput<any>) => any;
|
|
15
18
|
}>;
|
|
@@ -22,6 +25,6 @@ export interface UnchainedCore {
|
|
|
22
25
|
bulkImporter: BulkImporter;
|
|
23
26
|
options: ModuleOptions;
|
|
24
27
|
}
|
|
25
|
-
export declare const initCore: ({ db, migrationRepository, bulkImporter, modules: customModules, services: customServices, options, }: UnchainedCoreOptions) => Promise<UnchainedCore>;
|
|
26
|
-
export declare const getAllAdapters: () =>
|
|
28
|
+
export declare const initCore: ({ db, migrationRepository, bulkImporter: bulkImporterOptions, modules: customModules, services: customServices, options, }: UnchainedCoreOptions) => Promise<UnchainedCore>;
|
|
29
|
+
export declare const getAllAdapters: () => IBaseAdapter[];
|
|
27
30
|
//# sourceMappingURL=core-index.d.ts.map
|
package/lib/core-index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-index.d.ts","sourceRoot":"","sources":["../src/core-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAqB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAoB,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"core-index.d.ts","sourceRoot":"","sources":["../src/core-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAqB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAoB,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACnE,OAAkC,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAiBtG,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AAEnC,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC;IACf,mBAAmB,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACxD,YAAY,CAAC,EAAE;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC,CAAC;KAC7D,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CACd,MAAM,EACN;QACE,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC;KAC9C,CACF,CAAC;IACF,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,eAAO,MAAM,QAAQ,GAAU,4HAO5B,oBAAoB,KAAG,OAAO,CAAC,aAAa,CAa9C,CAAC;AAEF,eAAO,MAAM,cAAc,sBA8B1B,CAAC"}
|
package/lib/core-index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import initServices from './services/index.js';
|
|
2
2
|
import initModules from './modules.js';
|
|
3
|
+
import createBulkImporterFactory from './bulk-importer/index.js';
|
|
3
4
|
import { WorkerDirector, DeliveryDirector, DeliveryPricingDirector, EnrollmentDirector, FilterDirector, OrderDiscountDirector, OrderPricingDirector, PaymentDirector, PaymentPricingDirector, ProductDiscountDirector, ProductPricingDirector, QuotationDirector, WarehousingDirector, } from './directors/index.js';
|
|
5
|
+
export * from './bulk-importer/index.js';
|
|
4
6
|
export * from './services/index.js';
|
|
5
7
|
export * from './directors/index.js';
|
|
6
|
-
export
|
|
8
|
+
export * from './factory/index.js';
|
|
9
|
+
export const initCore = async ({ db, migrationRepository, bulkImporter: bulkImporterOptions = {}, modules: customModules = {}, services: customServices = {}, options = {}, }) => {
|
|
7
10
|
// Configure custom modules
|
|
11
|
+
const bulkImporter = createBulkImporterFactory(db, bulkImporterOptions);
|
|
8
12
|
const modules = await initModules({ db, migrationRepository, options }, customModules);
|
|
9
13
|
const services = initServices(modules, customServices);
|
|
10
14
|
return {
|