@unchainedshop/core 4.3.6 → 4.5.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/README.md +614 -2
- package/lib/bulk-importer/createBulkImporter.d.ts +5 -6
- package/lib/bulk-importer/createBulkImporter.js +6 -5
- package/lib/bulk-importer/handlers/assortment/create.d.ts +2 -3
- package/lib/bulk-importer/handlers/assortment/create.js +6 -8
- package/lib/bulk-importer/handlers/assortment/index.d.ts +3 -4
- package/lib/bulk-importer/handlers/assortment/index.js +3 -4
- package/lib/bulk-importer/handlers/assortment/remove.d.ts +1 -2
- package/lib/bulk-importer/handlers/assortment/remove.js +0 -1
- package/lib/bulk-importer/handlers/assortment/update.d.ts +2 -3
- package/lib/bulk-importer/handlers/assortment/update.js +7 -9
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts +1 -2
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js +1 -2
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts +1 -2
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js +1 -2
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts +1 -2
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js +1 -2
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts +2 -3
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js +2 -4
- package/lib/bulk-importer/handlers/filter/create.d.ts +7 -3
- package/lib/bulk-importer/handlers/filter/create.js +3 -4
- package/lib/bulk-importer/handlers/filter/index.d.ts +3 -4
- package/lib/bulk-importer/handlers/filter/index.js +3 -4
- package/lib/bulk-importer/handlers/filter/remove.d.ts +1 -2
- package/lib/bulk-importer/handlers/filter/remove.js +0 -1
- package/lib/bulk-importer/handlers/filter/update.d.ts +1 -2
- package/lib/bulk-importer/handlers/filter/update.js +2 -4
- package/lib/bulk-importer/handlers/product/create.d.ts +23 -6
- package/lib/bulk-importer/handlers/product/create.js +10 -12
- package/lib/bulk-importer/handlers/product/index.d.ts +3 -4
- package/lib/bulk-importer/handlers/product/index.js +3 -4
- package/lib/bulk-importer/handlers/product/remove.d.ts +2 -3
- package/lib/bulk-importer/handlers/product/remove.js +0 -1
- package/lib/bulk-importer/handlers/product/update.d.ts +2 -3
- package/lib/bulk-importer/handlers/product/update.js +8 -11
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts +2 -3
- package/lib/bulk-importer/handlers/product/upsertMedia.js +3 -5
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts +1 -2
- package/lib/bulk-importer/handlers/product/upsertVariations.js +2 -5
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.d.ts +0 -1
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.js +0 -1
- package/lib/bulk-importer/index.d.ts +2 -3
- package/lib/bulk-importer/index.js +2 -3
- package/lib/bulk-importer/upsertAsset.d.ts +3 -4
- package/lib/bulk-importer/upsertAsset.js +1 -3
- package/lib/core-index.d.ts +10 -10
- package/lib/core-index.js +10 -10
- package/lib/directors/BaseDiscountAdapter.d.ts +5 -6
- package/lib/directors/BaseDiscountAdapter.js +0 -17
- package/lib/directors/BaseDiscountDirector.d.ts +3 -4
- package/lib/directors/BaseDiscountDirector.js +0 -1
- package/lib/directors/BasePricingAdapter.d.ts +4 -5
- package/lib/directors/BasePricingAdapter.js +1 -2
- package/lib/directors/BasePricingDirector.d.ts +4 -5
- package/lib/directors/BasePricingDirector.js +1 -6
- package/lib/directors/BasePricingSheet.d.ts +1 -2
- package/lib/directors/BasePricingSheet.js +0 -4
- package/lib/directors/BaseWorker.d.ts +1 -2
- package/lib/directors/BaseWorker.js +4 -7
- package/lib/directors/DeliveryAdapter.d.ts +8 -8
- package/lib/directors/DeliveryAdapter.js +6 -15
- package/lib/directors/DeliveryDirector.d.ts +5 -6
- package/lib/directors/DeliveryDirector.js +1 -2
- package/lib/directors/DeliveryPricingAdapter.d.ts +7 -8
- package/lib/directors/DeliveryPricingAdapter.js +2 -3
- package/lib/directors/DeliveryPricingDirector.d.ts +4 -5
- package/lib/directors/DeliveryPricingDirector.js +2 -2
- package/lib/directors/DeliveryPricingSheet.d.ts +9 -9
- package/lib/directors/DeliveryPricingSheet.js +7 -9
- package/lib/directors/EnrollmentAdapter.d.ts +2 -3
- package/lib/directors/EnrollmentAdapter.js +0 -1
- package/lib/directors/EnrollmentDirector.d.ts +3 -4
- package/lib/directors/EnrollmentDirector.js +0 -1
- package/lib/directors/EventListenerWorker.d.ts +1 -2
- package/lib/directors/EventListenerWorker.js +2 -11
- package/lib/directors/FailedRescheduler.d.ts +1 -2
- package/lib/directors/FailedRescheduler.js +0 -3
- package/lib/directors/FilterAdapter.d.ts +5 -6
- package/lib/directors/FilterAdapter.js +1 -5
- package/lib/directors/FilterDirector.d.ts +4 -5
- package/lib/directors/FilterDirector.js +1 -10
- package/lib/directors/IntervalWorker.d.ts +3 -4
- package/lib/directors/IntervalWorker.js +6 -8
- package/lib/directors/MessagingDirector.d.ts +0 -1
- package/lib/directors/MessagingDirector.js +0 -1
- package/lib/directors/OrderDiscountAdapter.d.ts +1 -2
- package/lib/directors/OrderDiscountAdapter.js +1 -2
- package/lib/directors/OrderDiscountConfiguration.d.ts +0 -1
- package/lib/directors/OrderDiscountConfiguration.js +0 -1
- package/lib/directors/OrderDiscountDirector.d.ts +2 -3
- package/lib/directors/OrderDiscountDirector.js +1 -2
- package/lib/directors/OrderPricingAdapter.d.ts +4 -5
- package/lib/directors/OrderPricingAdapter.js +1 -2
- package/lib/directors/OrderPricingDirector.d.ts +2 -3
- package/lib/directors/OrderPricingDirector.js +1 -2
- package/lib/directors/OrderPricingSheet.d.ts +10 -10
- package/lib/directors/OrderPricingSheet.js +8 -12
- package/lib/directors/PaymentAdapter.d.ts +8 -8
- package/lib/directors/PaymentAdapter.js +6 -12
- package/lib/directors/PaymentDirector.d.ts +4 -5
- package/lib/directors/PaymentDirector.js +1 -2
- package/lib/directors/PaymentPricingAdapter.d.ts +8 -9
- package/lib/directors/PaymentPricingAdapter.js +3 -4
- package/lib/directors/PaymentPricingDirector.d.ts +5 -6
- package/lib/directors/PaymentPricingDirector.js +2 -3
- package/lib/directors/PaymentPricingSheet.d.ts +8 -8
- package/lib/directors/PaymentPricingSheet.js +7 -9
- package/lib/directors/ProductDiscountAdapter.d.ts +1 -2
- package/lib/directors/ProductDiscountAdapter.js +1 -2
- package/lib/directors/ProductDiscountConfiguration.d.ts +1 -2
- package/lib/directors/ProductDiscountConfiguration.js +0 -1
- package/lib/directors/ProductDiscountDirector.d.ts +2 -3
- package/lib/directors/ProductDiscountDirector.js +1 -2
- package/lib/directors/ProductPricingAdapter.d.ts +5 -6
- package/lib/directors/ProductPricingAdapter.js +1 -2
- package/lib/directors/ProductPricingDirector.d.ts +4 -5
- package/lib/directors/ProductPricingDirector.js +1 -2
- package/lib/directors/ProductPricingSheet.d.ts +8 -8
- package/lib/directors/ProductPricingSheet.js +6 -8
- package/lib/directors/QuotationAdapter.d.ts +9 -9
- package/lib/directors/QuotationAdapter.js +6 -8
- package/lib/directors/QuotationDirector.d.ts +2 -3
- package/lib/directors/QuotationDirector.js +1 -2
- package/lib/directors/WarehousingAdapter.d.ts +12 -12
- package/lib/directors/WarehousingAdapter.js +6 -8
- package/lib/directors/WarehousingDirector.d.ts +4 -5
- package/lib/directors/WarehousingDirector.js +1 -4
- package/lib/directors/WorkerAdapter.d.ts +5 -6
- package/lib/directors/WorkerAdapter.js +0 -1
- package/lib/directors/WorkerDirector.d.ts +5 -6
- package/lib/directors/WorkerDirector.js +0 -3
- package/lib/directors/index.d.ts +42 -43
- package/lib/directors/index.js +42 -43
- package/lib/factory/index.d.ts +9 -10
- package/lib/factory/index.js +9 -10
- package/lib/factory/registerAssortmentSearchFilter.d.ts +1 -2
- package/lib/factory/registerAssortmentSearchFilter.js +1 -2
- package/lib/factory/registerInvoicePayment.d.ts +2 -3
- package/lib/factory/registerInvoicePayment.js +1 -2
- package/lib/factory/registerPhysicalWarehousing.d.ts +2 -3
- package/lib/factory/registerPhysicalWarehousing.js +1 -2
- package/lib/factory/registerPickUpDelivery.d.ts +3 -4
- package/lib/factory/registerPickUpDelivery.js +1 -2
- package/lib/factory/registerProductDiscoverabilityFilter.d.ts +0 -1
- package/lib/factory/registerProductDiscoverabilityFilter.js +1 -2
- package/lib/factory/registerProductSearchFilter.d.ts +1 -2
- package/lib/factory/registerProductSearchFilter.js +1 -2
- package/lib/factory/registerShippingDelivery.d.ts +3 -4
- package/lib/factory/registerShippingDelivery.js +1 -2
- package/lib/factory/registerVirtualWarehousing.d.ts +2 -3
- package/lib/factory/registerVirtualWarehousing.js +1 -2
- package/lib/factory/registerWorker.d.ts +0 -1
- package/lib/factory/registerWorker.js +1 -2
- package/lib/modules.d.ts +18 -19
- package/lib/modules.js +5 -5
- package/lib/services/activateEnrollment.d.ts +2 -3
- package/lib/services/activateEnrollment.js +2 -3
- package/lib/services/addMessage.d.ts +2 -3
- package/lib/services/addMessage.js +2 -3
- package/lib/services/addMultipleCartProducts.d.ts +18 -0
- package/lib/services/addMultipleCartProducts.js +25 -0
- package/lib/services/calculateDiscountTotal.d.ts +2 -3
- package/lib/services/calculateDiscountTotal.js +1 -6
- package/lib/services/checkoutOrder.d.ts +1 -2
- package/lib/services/checkoutOrder.js +4 -6
- package/lib/services/confirmOrder.d.ts +2 -3
- package/lib/services/confirmOrder.js +1 -2
- package/lib/services/createDownloadStream.d.ts +2 -3
- package/lib/services/createDownloadStream.js +0 -1
- package/lib/services/createEnrollmentFromCheckout.d.ts +4 -5
- package/lib/services/createEnrollmentFromCheckout.js +2 -3
- package/lib/services/createFileDownloadURL.d.ts +7 -0
- package/lib/services/createFileDownloadURL.js +10 -0
- package/lib/services/createManualOrderDiscount.d.ts +2 -3
- package/lib/services/createManualOrderDiscount.js +1 -3
- package/lib/services/createSignedURL.d.ts +2 -3
- package/lib/services/createSignedURL.js +0 -1
- package/lib/services/deleteUser.d.ts +1 -2
- package/lib/services/deleteUser.js +0 -1
- package/lib/services/discountedEntities.d.ts +3 -4
- package/lib/services/discountedEntities.js +1 -7
- package/lib/services/ercMetadata.d.ts +3 -4
- package/lib/services/ercMetadata.js +1 -2
- package/lib/services/findOrInitCart.d.ts +2 -3
- package/lib/services/findOrInitCart.js +1 -2
- package/lib/services/findProductSiblings.d.ts +9 -0
- package/lib/services/findProductSiblings.js +18 -0
- package/lib/services/fullfillQuotation.d.ts +2 -3
- package/lib/services/fullfillQuotation.js +1 -2
- package/lib/services/generateOrderFromEnrollment.d.ts +2 -3
- package/lib/services/generateOrderFromEnrollment.js +2 -3
- package/lib/services/index.d.ts +74 -49
- package/lib/services/index.js +73 -51
- package/lib/services/initCartProviders.d.ts +2 -3
- package/lib/services/initCartProviders.js +2 -5
- package/lib/services/initializeEnrollment.d.ts +2 -3
- package/lib/services/initializeEnrollment.js +3 -4
- package/lib/services/invalidateFilterCache.d.ts +1 -2
- package/lib/services/invalidateFilterCache.js +1 -2
- package/lib/services/isTokenInvalidateable.d.ts +5 -0
- package/lib/services/isTokenInvalidateable.js +15 -0
- package/lib/services/linkFileService.d.ts +1 -2
- package/lib/services/linkFileService.js +0 -1
- package/lib/services/loadFilterOptions.d.ts +2 -3
- package/lib/services/loadFilterOptions.js +1 -2
- package/lib/services/loadFilters.d.ts +2 -3
- package/lib/services/loadFilters.js +1 -2
- package/lib/services/migrateBookmarks.d.ts +1 -2
- package/lib/services/migrateBookmarks.js +0 -2
- package/lib/services/migrateOrderCart.d.ts +1 -2
- package/lib/services/migrateOrderCart.js +1 -7
- package/lib/services/migrateUserData.d.ts +0 -1
- package/lib/services/migrateUserData.js +2 -3
- package/lib/services/nextUserCart.d.ts +2 -3
- package/lib/services/nextUserCart.js +1 -2
- package/lib/services/processEnrollment.d.ts +2 -3
- package/lib/services/processEnrollment.js +1 -5
- package/lib/services/processOrder.d.ts +2 -3
- package/lib/services/processOrder.js +7 -27
- package/lib/services/processQuotation.d.ts +2 -3
- package/lib/services/processQuotation.js +2 -3
- package/lib/services/proposeQuotation.d.ts +2 -3
- package/lib/services/proposeQuotation.js +1 -2
- package/lib/services/registerPaymentCredentials.d.ts +2 -3
- package/lib/services/registerPaymentCredentials.js +1 -2
- package/lib/services/rejectOrder.d.ts +2 -3
- package/lib/services/rejectOrder.js +1 -2
- package/lib/services/rejectQuotation.d.ts +2 -3
- package/lib/services/rejectQuotation.js +1 -2
- package/lib/services/removeCartDiscount.d.ts +10 -0
- package/lib/services/removeCartDiscount.js +14 -0
- package/lib/services/removeFiles.d.ts +1 -2
- package/lib/services/removeFiles.js +1 -3
- package/lib/services/removeFilter.d.ts +5 -0
- package/lib/services/removeFilter.js +5 -0
- package/lib/services/removeProduct.d.ts +1 -2
- package/lib/services/removeProduct.js +1 -4
- package/lib/services/resolveOrderItemDispatches.d.ts +19 -0
- package/lib/services/resolveOrderItemDispatches.js +38 -0
- package/lib/services/resolveTokenStatus.d.ts +5 -0
- package/lib/services/resolveTokenStatus.js +15 -0
- package/lib/services/searchAssortments.d.ts +3 -4
- package/lib/services/searchAssortments.js +1 -2
- package/lib/services/searchProducts.d.ts +3 -4
- package/lib/services/searchProducts.js +1 -4
- package/lib/services/simulateConfigurablePriceRange.d.ts +13 -0
- package/lib/services/simulateConfigurablePriceRange.js +39 -0
- package/lib/services/simulateDeliveryPricing.d.ts +21 -0
- package/lib/services/simulateDeliveryPricing.js +23 -0
- package/lib/services/simulatePaymentPricing.d.ts +21 -0
- package/lib/services/simulatePaymentPricing.js +23 -0
- package/lib/services/simulateProductDispatching.d.ts +5 -6
- package/lib/services/simulateProductDispatching.js +2 -3
- package/lib/services/simulateProductInventory.d.ts +4 -5
- package/lib/services/simulateProductInventory.js +2 -3
- package/lib/services/simulateProductPricing.d.ts +5 -6
- package/lib/services/simulateProductPricing.js +1 -2
- package/lib/services/supportedDeliveryProviders.d.ts +3 -4
- package/lib/services/supportedDeliveryProviders.js +1 -2
- package/lib/services/supportedPaymentProviders.d.ts +3 -4
- package/lib/services/supportedPaymentProviders.js +1 -2
- package/lib/services/supportedWarehousingProviders.d.ts +3 -4
- package/lib/services/supportedWarehousingProviders.js +1 -2
- package/lib/services/terminateEnrollment.d.ts +1 -2
- package/lib/services/terminateEnrollment.js +2 -3
- package/lib/services/updateCalculation.d.ts +2 -3
- package/lib/services/updateCalculation.js +3 -20
- package/lib/services/updateScheduling.d.ts +2 -3
- package/lib/services/updateScheduling.js +2 -4
- package/lib/services/updateUserAvatarAfterUpload.d.ts +2 -3
- package/lib/services/updateUserAvatarAfterUpload.js +3 -5
- package/lib/services/uploadFileFromStream.d.ts +2 -3
- package/lib/services/uploadFileFromStream.js +0 -1
- package/lib/services/uploadFileFromURL.d.ts +1 -2
- package/lib/services/uploadFileFromURL.js +0 -1
- package/lib/services/validateOrder.d.ts +2 -3
- package/lib/services/validateOrder.js +0 -1
- package/lib/services/verifyQuotation.d.ts +2 -3
- package/lib/services/verifyQuotation.js +1 -2
- package/lib/utils/schedule.d.ts +22 -0
- package/lib/utils/schedule.js +148 -0
- package/package.json +28 -28
- package/lib/bulk-importer/createBulkImporter.d.ts.map +0 -1
- package/lib/bulk-importer/createBulkImporter.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/create.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/create.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/index.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/index.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/remove.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/remove.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/update.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/update.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js.map +0 -1
- package/lib/bulk-importer/handlers/filter/create.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/filter/create.js.map +0 -1
- package/lib/bulk-importer/handlers/filter/index.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/filter/index.js.map +0 -1
- package/lib/bulk-importer/handlers/filter/remove.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/filter/remove.js.map +0 -1
- package/lib/bulk-importer/handlers/filter/update.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/filter/update.js.map +0 -1
- package/lib/bulk-importer/handlers/product/create.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/create.js.map +0 -1
- package/lib/bulk-importer/handlers/product/index.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/index.js.map +0 -1
- package/lib/bulk-importer/handlers/product/remove.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/remove.js.map +0 -1
- package/lib/bulk-importer/handlers/product/update.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/update.js.map +0 -1
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/upsertMedia.js.map +0 -1
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/upsertVariations.js.map +0 -1
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.js.map +0 -1
- package/lib/bulk-importer/index.d.ts.map +0 -1
- package/lib/bulk-importer/index.js.map +0 -1
- package/lib/bulk-importer/upsertAsset.d.ts.map +0 -1
- package/lib/bulk-importer/upsertAsset.js.map +0 -1
- package/lib/core-index.d.ts.map +0 -1
- package/lib/core-index.js.map +0 -1
- package/lib/directors/BaseDiscountAdapter.d.ts.map +0 -1
- package/lib/directors/BaseDiscountAdapter.js.map +0 -1
- package/lib/directors/BaseDiscountDirector.d.ts.map +0 -1
- package/lib/directors/BaseDiscountDirector.js.map +0 -1
- package/lib/directors/BasePricingAdapter.d.ts.map +0 -1
- package/lib/directors/BasePricingAdapter.js.map +0 -1
- package/lib/directors/BasePricingDirector.d.ts.map +0 -1
- package/lib/directors/BasePricingDirector.js.map +0 -1
- package/lib/directors/BasePricingSheet.d.ts.map +0 -1
- package/lib/directors/BasePricingSheet.js.map +0 -1
- package/lib/directors/BaseWorker.d.ts.map +0 -1
- package/lib/directors/BaseWorker.js.map +0 -1
- package/lib/directors/DeliveryAdapter.d.ts.map +0 -1
- package/lib/directors/DeliveryAdapter.js.map +0 -1
- package/lib/directors/DeliveryDirector.d.ts.map +0 -1
- package/lib/directors/DeliveryDirector.js.map +0 -1
- package/lib/directors/DeliveryPricingAdapter.d.ts.map +0 -1
- package/lib/directors/DeliveryPricingAdapter.js.map +0 -1
- package/lib/directors/DeliveryPricingDirector.d.ts.map +0 -1
- package/lib/directors/DeliveryPricingDirector.js.map +0 -1
- package/lib/directors/DeliveryPricingSheet.d.ts.map +0 -1
- package/lib/directors/DeliveryPricingSheet.js.map +0 -1
- package/lib/directors/EnrollmentAdapter.d.ts.map +0 -1
- package/lib/directors/EnrollmentAdapter.js.map +0 -1
- package/lib/directors/EnrollmentDirector.d.ts.map +0 -1
- package/lib/directors/EnrollmentDirector.js.map +0 -1
- package/lib/directors/EventListenerWorker.d.ts.map +0 -1
- package/lib/directors/EventListenerWorker.js.map +0 -1
- package/lib/directors/FailedRescheduler.d.ts.map +0 -1
- package/lib/directors/FailedRescheduler.js.map +0 -1
- package/lib/directors/FilterAdapter.d.ts.map +0 -1
- package/lib/directors/FilterAdapter.js.map +0 -1
- package/lib/directors/FilterDirector.d.ts.map +0 -1
- package/lib/directors/FilterDirector.js.map +0 -1
- package/lib/directors/IntervalWorker.d.ts.map +0 -1
- package/lib/directors/IntervalWorker.js.map +0 -1
- package/lib/directors/MessagingDirector.d.ts.map +0 -1
- package/lib/directors/MessagingDirector.js.map +0 -1
- package/lib/directors/OrderDiscountAdapter.d.ts.map +0 -1
- package/lib/directors/OrderDiscountAdapter.js.map +0 -1
- package/lib/directors/OrderDiscountConfiguration.d.ts.map +0 -1
- package/lib/directors/OrderDiscountConfiguration.js.map +0 -1
- package/lib/directors/OrderDiscountDirector.d.ts.map +0 -1
- package/lib/directors/OrderDiscountDirector.js.map +0 -1
- package/lib/directors/OrderPricingAdapter.d.ts.map +0 -1
- package/lib/directors/OrderPricingAdapter.js.map +0 -1
- package/lib/directors/OrderPricingDirector.d.ts.map +0 -1
- package/lib/directors/OrderPricingDirector.js.map +0 -1
- package/lib/directors/OrderPricingSheet.d.ts.map +0 -1
- package/lib/directors/OrderPricingSheet.js.map +0 -1
- package/lib/directors/PaymentAdapter.d.ts.map +0 -1
- package/lib/directors/PaymentAdapter.js.map +0 -1
- package/lib/directors/PaymentDirector.d.ts.map +0 -1
- package/lib/directors/PaymentDirector.js.map +0 -1
- package/lib/directors/PaymentPricingAdapter.d.ts.map +0 -1
- package/lib/directors/PaymentPricingAdapter.js.map +0 -1
- package/lib/directors/PaymentPricingDirector.d.ts.map +0 -1
- package/lib/directors/PaymentPricingDirector.js.map +0 -1
- package/lib/directors/PaymentPricingSheet.d.ts.map +0 -1
- package/lib/directors/PaymentPricingSheet.js.map +0 -1
- package/lib/directors/ProductDiscountAdapter.d.ts.map +0 -1
- package/lib/directors/ProductDiscountAdapter.js.map +0 -1
- package/lib/directors/ProductDiscountConfiguration.d.ts.map +0 -1
- package/lib/directors/ProductDiscountConfiguration.js.map +0 -1
- package/lib/directors/ProductDiscountDirector.d.ts.map +0 -1
- package/lib/directors/ProductDiscountDirector.js.map +0 -1
- package/lib/directors/ProductPricingAdapter.d.ts.map +0 -1
- package/lib/directors/ProductPricingAdapter.js.map +0 -1
- package/lib/directors/ProductPricingDirector.d.ts.map +0 -1
- package/lib/directors/ProductPricingDirector.js.map +0 -1
- package/lib/directors/ProductPricingSheet.d.ts.map +0 -1
- package/lib/directors/ProductPricingSheet.js.map +0 -1
- package/lib/directors/QuotationAdapter.d.ts.map +0 -1
- package/lib/directors/QuotationAdapter.js.map +0 -1
- package/lib/directors/QuotationDirector.d.ts.map +0 -1
- package/lib/directors/QuotationDirector.js.map +0 -1
- package/lib/directors/WarehousingAdapter.d.ts.map +0 -1
- package/lib/directors/WarehousingAdapter.js.map +0 -1
- package/lib/directors/WarehousingDirector.d.ts.map +0 -1
- package/lib/directors/WarehousingDirector.js.map +0 -1
- package/lib/directors/WorkerAdapter.d.ts.map +0 -1
- package/lib/directors/WorkerAdapter.js.map +0 -1
- package/lib/directors/WorkerDirector.d.ts.map +0 -1
- package/lib/directors/WorkerDirector.js.map +0 -1
- package/lib/directors/index.d.ts.map +0 -1
- package/lib/directors/index.js.map +0 -1
- package/lib/factory/index.d.ts.map +0 -1
- package/lib/factory/index.js.map +0 -1
- package/lib/factory/registerAssortmentSearchFilter.d.ts.map +0 -1
- package/lib/factory/registerAssortmentSearchFilter.js.map +0 -1
- package/lib/factory/registerInvoicePayment.d.ts.map +0 -1
- package/lib/factory/registerInvoicePayment.js.map +0 -1
- package/lib/factory/registerPhysicalWarehousing.d.ts.map +0 -1
- package/lib/factory/registerPhysicalWarehousing.js.map +0 -1
- package/lib/factory/registerPickUpDelivery.d.ts.map +0 -1
- package/lib/factory/registerPickUpDelivery.js.map +0 -1
- package/lib/factory/registerProductDiscoverabilityFilter.d.ts.map +0 -1
- package/lib/factory/registerProductDiscoverabilityFilter.js.map +0 -1
- package/lib/factory/registerProductSearchFilter.d.ts.map +0 -1
- package/lib/factory/registerProductSearchFilter.js.map +0 -1
- package/lib/factory/registerShippingDelivery.d.ts.map +0 -1
- package/lib/factory/registerShippingDelivery.js.map +0 -1
- package/lib/factory/registerVirtualWarehousing.d.ts.map +0 -1
- package/lib/factory/registerVirtualWarehousing.js.map +0 -1
- package/lib/factory/registerWorker.d.ts.map +0 -1
- package/lib/factory/registerWorker.js.map +0 -1
- package/lib/modules.d.ts.map +0 -1
- package/lib/modules.js.map +0 -1
- package/lib/services/activateEnrollment.d.ts.map +0 -1
- package/lib/services/activateEnrollment.js.map +0 -1
- package/lib/services/addMessage.d.ts.map +0 -1
- package/lib/services/addMessage.js.map +0 -1
- package/lib/services/calculateDiscountTotal.d.ts.map +0 -1
- package/lib/services/calculateDiscountTotal.js.map +0 -1
- package/lib/services/checkoutOrder.d.ts.map +0 -1
- package/lib/services/checkoutOrder.js.map +0 -1
- package/lib/services/confirmOrder.d.ts.map +0 -1
- package/lib/services/confirmOrder.js.map +0 -1
- package/lib/services/createDownloadStream.d.ts.map +0 -1
- package/lib/services/createDownloadStream.js.map +0 -1
- package/lib/services/createEnrollmentFromCheckout.d.ts.map +0 -1
- package/lib/services/createEnrollmentFromCheckout.js.map +0 -1
- package/lib/services/createManualOrderDiscount.d.ts.map +0 -1
- package/lib/services/createManualOrderDiscount.js.map +0 -1
- package/lib/services/createSignedURL.d.ts.map +0 -1
- package/lib/services/createSignedURL.js.map +0 -1
- package/lib/services/deleteUser.d.ts.map +0 -1
- package/lib/services/deleteUser.js.map +0 -1
- package/lib/services/discountedEntities.d.ts.map +0 -1
- package/lib/services/discountedEntities.js.map +0 -1
- package/lib/services/ercMetadata.d.ts.map +0 -1
- package/lib/services/ercMetadata.js.map +0 -1
- package/lib/services/findOrInitCart.d.ts.map +0 -1
- package/lib/services/findOrInitCart.js.map +0 -1
- package/lib/services/fullfillQuotation.d.ts.map +0 -1
- package/lib/services/fullfillQuotation.js.map +0 -1
- package/lib/services/generateOrderFromEnrollment.d.ts.map +0 -1
- package/lib/services/generateOrderFromEnrollment.js.map +0 -1
- package/lib/services/index.d.ts.map +0 -1
- package/lib/services/index.js.map +0 -1
- package/lib/services/initCartProviders.d.ts.map +0 -1
- package/lib/services/initCartProviders.js.map +0 -1
- package/lib/services/initializeEnrollment.d.ts.map +0 -1
- package/lib/services/initializeEnrollment.js.map +0 -1
- package/lib/services/invalidateFilterCache.d.ts.map +0 -1
- package/lib/services/invalidateFilterCache.js.map +0 -1
- package/lib/services/linkFileService.d.ts.map +0 -1
- package/lib/services/linkFileService.js.map +0 -1
- package/lib/services/loadFilterOptions.d.ts.map +0 -1
- package/lib/services/loadFilterOptions.js.map +0 -1
- package/lib/services/loadFilters.d.ts.map +0 -1
- package/lib/services/loadFilters.js.map +0 -1
- package/lib/services/migrateBookmarks.d.ts.map +0 -1
- package/lib/services/migrateBookmarks.js.map +0 -1
- package/lib/services/migrateOrderCart.d.ts.map +0 -1
- package/lib/services/migrateOrderCart.js.map +0 -1
- package/lib/services/migrateUserData.d.ts.map +0 -1
- package/lib/services/migrateUserData.js.map +0 -1
- package/lib/services/nextUserCart.d.ts.map +0 -1
- package/lib/services/nextUserCart.js.map +0 -1
- package/lib/services/processEnrollment.d.ts.map +0 -1
- package/lib/services/processEnrollment.js.map +0 -1
- package/lib/services/processOrder.d.ts.map +0 -1
- package/lib/services/processOrder.js.map +0 -1
- package/lib/services/processQuotation.d.ts.map +0 -1
- package/lib/services/processQuotation.js.map +0 -1
- package/lib/services/proposeQuotation.d.ts.map +0 -1
- package/lib/services/proposeQuotation.js.map +0 -1
- package/lib/services/registerPaymentCredentials.d.ts.map +0 -1
- package/lib/services/registerPaymentCredentials.js.map +0 -1
- package/lib/services/rejectOrder.d.ts.map +0 -1
- package/lib/services/rejectOrder.js.map +0 -1
- package/lib/services/rejectQuotation.d.ts.map +0 -1
- package/lib/services/rejectQuotation.js.map +0 -1
- package/lib/services/removeFiles.d.ts.map +0 -1
- package/lib/services/removeFiles.js.map +0 -1
- package/lib/services/removeProduct.d.ts.map +0 -1
- package/lib/services/removeProduct.js.map +0 -1
- package/lib/services/searchAssortments.d.ts.map +0 -1
- package/lib/services/searchAssortments.js.map +0 -1
- package/lib/services/searchProducts.d.ts.map +0 -1
- package/lib/services/searchProducts.js.map +0 -1
- package/lib/services/simulateProductDispatching.d.ts.map +0 -1
- package/lib/services/simulateProductDispatching.js.map +0 -1
- package/lib/services/simulateProductInventory.d.ts.map +0 -1
- package/lib/services/simulateProductInventory.js.map +0 -1
- package/lib/services/simulateProductPricing.d.ts.map +0 -1
- package/lib/services/simulateProductPricing.js.map +0 -1
- package/lib/services/supportedDeliveryProviders.d.ts.map +0 -1
- package/lib/services/supportedDeliveryProviders.js.map +0 -1
- package/lib/services/supportedPaymentProviders.d.ts.map +0 -1
- package/lib/services/supportedPaymentProviders.js.map +0 -1
- package/lib/services/supportedWarehousingProviders.d.ts.map +0 -1
- package/lib/services/supportedWarehousingProviders.js.map +0 -1
- package/lib/services/terminateEnrollment.d.ts.map +0 -1
- package/lib/services/terminateEnrollment.js.map +0 -1
- package/lib/services/updateCalculation.d.ts.map +0 -1
- package/lib/services/updateCalculation.js.map +0 -1
- package/lib/services/updateScheduling.d.ts.map +0 -1
- package/lib/services/updateScheduling.js.map +0 -1
- package/lib/services/updateUserAvatarAfterUpload.d.ts.map +0 -1
- package/lib/services/updateUserAvatarAfterUpload.js.map +0 -1
- package/lib/services/uploadFileFromStream.d.ts.map +0 -1
- package/lib/services/uploadFileFromStream.js.map +0 -1
- package/lib/services/uploadFileFromURL.d.ts.map +0 -1
- package/lib/services/uploadFileFromURL.js.map +0 -1
- package/lib/services/validateOrder.d.ts.map +0 -1
- package/lib/services/validateOrder.js.map +0 -1
- package/lib/services/verifyQuotation.d.ts.map +0 -1
- package/lib/services/verifyQuotation.js.map +0 -1
- package/src/bulk-importer/createBulkImporter.ts +0 -205
- package/src/bulk-importer/handlers/assortment/create.ts +0 -118
- package/src/bulk-importer/handlers/assortment/index.ts +0 -3
- package/src/bulk-importer/handlers/assortment/remove.ts +0 -26
- package/src/bulk-importer/handlers/assortment/update.ts +0 -133
- package/src/bulk-importer/handlers/assortment/upsertAssortmentChildren.ts +0 -77
- package/src/bulk-importer/handlers/assortment/upsertAssortmentFilters.ts +0 -70
- package/src/bulk-importer/handlers/assortment/upsertAssortmentProducts.ts +0 -76
- package/src/bulk-importer/handlers/assortment/upsertMedia.ts +0 -76
- package/src/bulk-importer/handlers/filter/create.ts +0 -104
- package/src/bulk-importer/handlers/filter/index.ts +0 -3
- package/src/bulk-importer/handlers/filter/remove.ts +0 -25
- package/src/bulk-importer/handlers/filter/update.ts +0 -94
- package/src/bulk-importer/handlers/product/create.ts +0 -170
- package/src/bulk-importer/handlers/product/index.ts +0 -3
- package/src/bulk-importer/handlers/product/remove.ts +0 -27
- package/src/bulk-importer/handlers/product/update.ts +0 -175
- package/src/bulk-importer/handlers/product/upsertMedia.ts +0 -81
- package/src/bulk-importer/handlers/product/upsertVariations.ts +0 -110
- package/src/bulk-importer/handlers/utils/convertTagsToLowerCase.ts +0 -4
- package/src/bulk-importer/index.ts +0 -3
- package/src/bulk-importer/upsertAsset.ts +0 -53
- package/src/core-index.ts +0 -103
- package/src/directors/BaseDiscountAdapter.test.ts +0 -52
- package/src/directors/BaseDiscountAdapter.ts +0 -86
- package/src/directors/BaseDiscountDirector.ts +0 -73
- package/src/directors/BasePricingAdapter.ts +0 -74
- package/src/directors/BasePricingDirector.ts +0 -136
- package/src/directors/BasePricingSheet.test.ts +0 -45
- package/src/directors/BasePricingSheet.ts +0 -141
- package/src/directors/BaseWorker.ts +0 -117
- package/src/directors/DeliveryAdapter.ts +0 -106
- package/src/directors/DeliveryDirector.ts +0 -143
- package/src/directors/DeliveryPricingAdapter.ts +0 -87
- package/src/directors/DeliveryPricingDirector.ts +0 -91
- package/src/directors/DeliveryPricingSheet.ts +0 -87
- package/src/directors/EnrollmentAdapter.ts +0 -108
- package/src/directors/EnrollmentDirector.ts +0 -71
- package/src/directors/EventListenerWorker.ts +0 -101
- package/src/directors/FailedRescheduler.ts +0 -73
- package/src/directors/FilterAdapter.ts +0 -106
- package/src/directors/FilterDirector.ts +0 -314
- package/src/directors/IntervalWorker.ts +0 -75
- package/src/directors/MessagingDirector.test.ts +0 -8
- package/src/directors/MessagingDirector.ts +0 -52
- package/src/directors/OrderDiscountAdapter.ts +0 -10
- package/src/directors/OrderDiscountConfiguration.ts +0 -5
- package/src/directors/OrderDiscountDirector.ts +0 -5
- package/src/directors/OrderPricingAdapter.ts +0 -63
- package/src/directors/OrderPricingDirector.ts +0 -74
- package/src/directors/OrderPricingSheet.ts +0 -148
- package/src/directors/PaymentAdapter.ts +0 -118
- package/src/directors/PaymentDirector.ts +0 -297
- package/src/directors/PaymentPricingAdapter.ts +0 -86
- package/src/directors/PaymentPricingDirector.ts +0 -92
- package/src/directors/PaymentPricingSheet.ts +0 -92
- package/src/directors/ProductDiscountAdapter.ts +0 -10
- package/src/directors/ProductDiscountConfiguration.ts +0 -18
- package/src/directors/ProductDiscountDirector.ts +0 -4
- package/src/directors/ProductPricingAdapter.ts +0 -58
- package/src/directors/ProductPricingDirector.ts +0 -100
- package/src/directors/ProductPricingSheet.test.ts +0 -140
- package/src/directors/ProductPricingSheet.ts +0 -125
- package/src/directors/QuotationAdapter.ts +0 -82
- package/src/directors/QuotationDirector.ts +0 -105
- package/src/directors/WarehousingAdapter.ts +0 -77
- package/src/directors/WarehousingDirector.ts +0 -233
- package/src/directors/WorkerAdapter.ts +0 -31
- package/src/directors/WorkerDirector.ts +0 -149
- package/src/directors/index.ts +0 -53
- package/src/directors/periodForReferenceDate.test.ts +0 -25
- package/src/factory/index.ts +0 -21
- package/src/factory/registerAssortmentSearchFilter.ts +0 -36
- package/src/factory/registerInvoicePayment.ts +0 -61
- package/src/factory/registerPhysicalWarehousing.ts +0 -92
- package/src/factory/registerPickUpDelivery.ts +0 -81
- package/src/factory/registerProductDiscoverabilityFilter.ts +0 -36
- package/src/factory/registerProductSearchFilter.ts +0 -36
- package/src/factory/registerShippingDelivery.ts +0 -65
- package/src/factory/registerVirtualWarehousing.ts +0 -100
- package/src/factory/registerWorker.ts +0 -46
- package/src/modules.ts +0 -207
- package/src/services/activateEnrollment.ts +0 -26
- package/src/services/addMessage.ts +0 -20
- package/src/services/calculateDiscountTotal.ts +0 -71
- package/src/services/checkoutOrder.ts +0 -48
- package/src/services/confirmOrder.ts +0 -26
- package/src/services/createDownloadStream.ts +0 -17
- package/src/services/createEnrollmentFromCheckout.ts +0 -68
- package/src/services/createManualOrderDiscount.ts +0 -56
- package/src/services/createSignedURL.ts +0 -21
- package/src/services/deleteUser.ts +0 -48
- package/src/services/discountedEntities.ts +0 -81
- package/src/services/ercMetadata.ts +0 -25
- package/src/services/findOrInitCart.ts +0 -28
- package/src/services/fullfillQuotation.ts +0 -14
- package/src/services/generateOrderFromEnrollment.ts +0 -54
- package/src/services/index.ts +0 -173
- package/src/services/initCartProviders.ts +0 -84
- package/src/services/initializeEnrollment.ts +0 -41
- package/src/services/invalidateFilterCache.ts +0 -16
- package/src/services/linkFileService.ts +0 -24
- package/src/services/loadFilterOptions.ts +0 -49
- package/src/services/loadFilters.ts +0 -62
- package/src/services/migrateBookmarks.ts +0 -39
- package/src/services/migrateOrderCart.ts +0 -52
- package/src/services/migrateUserData.ts +0 -22
- package/src/services/nextUserCart.ts +0 -52
- package/src/services/processEnrollment.ts +0 -49
- package/src/services/processOrder.ts +0 -243
- package/src/services/processQuotation.ts +0 -71
- package/src/services/proposeQuotation.ts +0 -18
- package/src/services/registerPaymentCredentials.ts +0 -28
- package/src/services/rejectOrder.ts +0 -26
- package/src/services/rejectQuotation.ts +0 -18
- package/src/services/removeFiles.ts +0 -25
- package/src/services/removeProduct.ts +0 -39
- package/src/services/searchAssortments.ts +0 -57
- package/src/services/searchProducts.ts +0 -71
- package/src/services/simulateProductDispatching.ts +0 -58
- package/src/services/simulateProductInventory.ts +0 -59
- package/src/services/simulateProductPricing.ts +0 -23
- package/src/services/supportedDeliveryProviders.ts +0 -24
- package/src/services/supportedPaymentProviders.ts +0 -25
- package/src/services/supportedWarehousingProviders.ts +0 -18
- package/src/services/terminateEnrollment.ts +0 -25
- package/src/services/updateCalculation.ts +0 -159
- package/src/services/updateScheduling.ts +0 -63
- package/src/services/updateUserAvatarAfterUpload.ts +0 -33
- package/src/services/uploadFileFromStream.ts +0 -27
- package/src/services/uploadFileFromURL.ts +0 -29
- package/src/services/validateOrder.ts +0 -49
- package/src/services/verifyQuotation.ts +0 -18
- package/tsconfig.json +0 -9
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { AssortmentProduct } from '@unchainedshop/core-assortments';
|
|
3
|
-
import convertTagsToLowerCase from '../utils/convertTagsToLowerCase.js';
|
|
4
|
-
import { Modules } from '../../../modules.js';
|
|
5
|
-
|
|
6
|
-
export const AssortmentProductSchema = z.object({
|
|
7
|
-
_id: z.string().optional(),
|
|
8
|
-
productId: z.string(),
|
|
9
|
-
tags: z.array(z.string()).optional(),
|
|
10
|
-
sortKey: z.number().optional(),
|
|
11
|
-
meta: z.record(z.any(), z.any()).optional(),
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const upsert = async (
|
|
15
|
-
assortmentProduct: {
|
|
16
|
-
_id?: string;
|
|
17
|
-
productId: string;
|
|
18
|
-
tags: string[];
|
|
19
|
-
assortmentId: string;
|
|
20
|
-
sortKey: number;
|
|
21
|
-
},
|
|
22
|
-
unchainedAPI: { modules: Modules },
|
|
23
|
-
) => {
|
|
24
|
-
const { modules } = unchainedAPI;
|
|
25
|
-
if (
|
|
26
|
-
!(await modules.products.productExists({
|
|
27
|
-
productId: assortmentProduct.productId,
|
|
28
|
-
}))
|
|
29
|
-
) {
|
|
30
|
-
throw new Error(`Can't link non-existing product ${assortmentProduct.productId}`);
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
const newAssortmentProduct = (await modules.assortments.products.create(assortmentProduct, {
|
|
34
|
-
skipInvalidation: true,
|
|
35
|
-
})) as AssortmentProduct;
|
|
36
|
-
return newAssortmentProduct;
|
|
37
|
-
} catch {
|
|
38
|
-
return (await modules.assortments.products.update(assortmentProduct._id!, assortmentProduct, {
|
|
39
|
-
skipInvalidation: true,
|
|
40
|
-
})) as AssortmentProduct;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export default async (
|
|
45
|
-
{
|
|
46
|
-
products,
|
|
47
|
-
assortmentId,
|
|
48
|
-
}: { products: z.infer<typeof AssortmentProductSchema>[]; assortmentId: string },
|
|
49
|
-
unchainedAPI: { modules: Modules },
|
|
50
|
-
) => {
|
|
51
|
-
const { modules } = unchainedAPI;
|
|
52
|
-
const assortmentProductIds = await Promise.all(
|
|
53
|
-
products.map(async ({ tags: tagsMixedCase, sortKey, ...rest }, forcedSortKey) => {
|
|
54
|
-
const tags = tagsMixedCase ? convertTagsToLowerCase(tagsMixedCase)! : [];
|
|
55
|
-
|
|
56
|
-
const assortmentProduct = await upsert(
|
|
57
|
-
{
|
|
58
|
-
...rest,
|
|
59
|
-
tags,
|
|
60
|
-
sortKey: sortKey ?? forcedSortKey,
|
|
61
|
-
assortmentId,
|
|
62
|
-
},
|
|
63
|
-
unchainedAPI,
|
|
64
|
-
);
|
|
65
|
-
return assortmentProduct._id;
|
|
66
|
-
}),
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
await modules.assortments.products.deleteMany(
|
|
70
|
-
{
|
|
71
|
-
_id: { $nin: assortmentProductIds },
|
|
72
|
-
assortmentId,
|
|
73
|
-
},
|
|
74
|
-
{ skipInvalidation: true },
|
|
75
|
-
);
|
|
76
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Services } from '../../../services/index.js';
|
|
3
|
-
import { Modules } from '../../../modules.js';
|
|
4
|
-
import upsertAsset, { AssetSchema } from '../../upsertAsset.js';
|
|
5
|
-
import { AssortmentMediaType } from '@unchainedshop/core-assortments';
|
|
6
|
-
|
|
7
|
-
export const MediaSchema = z.object({
|
|
8
|
-
_id: z.string().optional(),
|
|
9
|
-
asset: AssetSchema,
|
|
10
|
-
content: z
|
|
11
|
-
.record(
|
|
12
|
-
z.string(), // locale
|
|
13
|
-
z.object({
|
|
14
|
-
title: z.string().optional(),
|
|
15
|
-
subtitle: z.string().optional(),
|
|
16
|
-
}),
|
|
17
|
-
)
|
|
18
|
-
.optional(),
|
|
19
|
-
tags: z.array(z.string()).optional(),
|
|
20
|
-
sortKey: z.number().optional(),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const upsertMediaObject = async (media, unchainedAPI: { modules: Modules; services: Services }) => {
|
|
24
|
-
const { modules } = unchainedAPI;
|
|
25
|
-
try {
|
|
26
|
-
const assortmentMedia = (await modules.assortments.media.create(media)) as AssortmentMediaType;
|
|
27
|
-
return assortmentMedia;
|
|
28
|
-
} catch {
|
|
29
|
-
const { _id, ...mediaData } = media;
|
|
30
|
-
return (await modules.assortments.media.update(_id, mediaData)) as AssortmentMediaType;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default async (
|
|
35
|
-
{ media, assortmentId }: { media: z.infer<typeof MediaSchema>[]; assortmentId: string },
|
|
36
|
-
unchainedAPI: { modules: Modules; services: Services },
|
|
37
|
-
) => {
|
|
38
|
-
const { modules } = unchainedAPI;
|
|
39
|
-
const mediaObjects = await Promise.all(
|
|
40
|
-
media.map(async ({ asset, content, ...mediaData }) => {
|
|
41
|
-
const file = await upsertAsset(
|
|
42
|
-
'assortment-media',
|
|
43
|
-
{ meta: { ...(asset.meta || {}), assortmentId }, ...asset },
|
|
44
|
-
unchainedAPI,
|
|
45
|
-
);
|
|
46
|
-
if (!file) throw new Error(`Unable to create binary ${asset._id}`);
|
|
47
|
-
|
|
48
|
-
const mediaObject = await upsertMediaObject(
|
|
49
|
-
{
|
|
50
|
-
...mediaData,
|
|
51
|
-
assortmentId,
|
|
52
|
-
mediaId: file._id,
|
|
53
|
-
},
|
|
54
|
-
unchainedAPI,
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
if (!mediaObject) throw new Error(`Unable to create media object ${mediaData._id}`);
|
|
58
|
-
|
|
59
|
-
if (content) {
|
|
60
|
-
await modules.assortments.media.texts.updateMediaTexts(
|
|
61
|
-
mediaObject._id,
|
|
62
|
-
Object.entries(content).map(([locale, localizedData]: [string, any]) => ({
|
|
63
|
-
locale,
|
|
64
|
-
...localizedData,
|
|
65
|
-
})),
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
return mediaObject;
|
|
69
|
-
}),
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
await modules.assortments.media.deleteMediaFiles({
|
|
73
|
-
assortmentId,
|
|
74
|
-
excludedAssortmentMediaIds: mediaObjects.map((obj) => obj._id),
|
|
75
|
-
});
|
|
76
|
-
};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Modules } from '../../../modules.js';
|
|
3
|
-
|
|
4
|
-
export const LocalizedContentSchema = z.record(
|
|
5
|
-
z.string(), // locale
|
|
6
|
-
z.object({
|
|
7
|
-
title: z.string().optional(),
|
|
8
|
-
subtitle: z.string().optional(),
|
|
9
|
-
}),
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
export const FilterCreatePayloadSchema = z.object({
|
|
13
|
-
_id: z.string(),
|
|
14
|
-
specification: z.object({
|
|
15
|
-
type: z.string(),
|
|
16
|
-
key: z.string(),
|
|
17
|
-
isActive: z.boolean().optional(),
|
|
18
|
-
options: z
|
|
19
|
-
.array(
|
|
20
|
-
z.object({
|
|
21
|
-
value: z.string(),
|
|
22
|
-
content: LocalizedContentSchema.optional(),
|
|
23
|
-
}),
|
|
24
|
-
)
|
|
25
|
-
.optional(),
|
|
26
|
-
meta: z.record(z.any(), z.any()).optional(),
|
|
27
|
-
content: LocalizedContentSchema,
|
|
28
|
-
}),
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export default async function createFilter(
|
|
32
|
-
payload: any,
|
|
33
|
-
{ logger, createShouldUpsertIfIDExists },
|
|
34
|
-
unchainedAPI: { modules: Modules },
|
|
35
|
-
) {
|
|
36
|
-
const { modules } = unchainedAPI;
|
|
37
|
-
const { specification, _id } = payload;
|
|
38
|
-
|
|
39
|
-
if (!specification) throw new Error(`Specification is required when creating new filter ${_id}`);
|
|
40
|
-
|
|
41
|
-
const { content, options, ...filterData } = specification;
|
|
42
|
-
|
|
43
|
-
if (!content) throw new Error(`Localizable content is required when creating new filter${_id}`);
|
|
44
|
-
|
|
45
|
-
logger.debug('create filter object', specification);
|
|
46
|
-
try {
|
|
47
|
-
await unchainedAPI.modules.filters.create({
|
|
48
|
-
...filterData,
|
|
49
|
-
_id,
|
|
50
|
-
options: options?.map((option) => option.value) || [],
|
|
51
|
-
});
|
|
52
|
-
} catch (e) {
|
|
53
|
-
if (!createShouldUpsertIfIDExists) throw e;
|
|
54
|
-
|
|
55
|
-
logger.debug('entity already exists, falling back to update', specification);
|
|
56
|
-
await modules.filters.update(_id, {
|
|
57
|
-
...filterData,
|
|
58
|
-
options: options?.map((option) => option.value) || [],
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (!(await modules.filters.filterExists({ filterId: _id }))) {
|
|
63
|
-
throw new Error(`Can't upsert filter ${_id}`);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (content) {
|
|
67
|
-
logger.debug('create localized content for filter', content);
|
|
68
|
-
await modules.filters.texts.updateTexts(
|
|
69
|
-
{ filterId: _id },
|
|
70
|
-
Object.entries(content).map(([locale, localizedData]: [string, any]) => {
|
|
71
|
-
return {
|
|
72
|
-
locale,
|
|
73
|
-
...localizedData,
|
|
74
|
-
};
|
|
75
|
-
}),
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (options) {
|
|
80
|
-
logger.debug('create localized content for filter options', content);
|
|
81
|
-
await Promise.all(
|
|
82
|
-
options.map(async ({ content: optionContent, value: optionValue }) => {
|
|
83
|
-
if (optionContent) {
|
|
84
|
-
await modules.filters.texts.updateTexts(
|
|
85
|
-
{ filterId: _id, filterOptionValue: optionValue },
|
|
86
|
-
Object.entries(optionContent).map(([locale, localizedData]: [string, any]) => {
|
|
87
|
-
return {
|
|
88
|
-
locale,
|
|
89
|
-
...localizedData,
|
|
90
|
-
};
|
|
91
|
-
}),
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
}),
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return {
|
|
99
|
-
entity: 'FILTER',
|
|
100
|
-
operation: 'create',
|
|
101
|
-
_id,
|
|
102
|
-
success: true,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Modules } from '../../../modules.js';
|
|
3
|
-
|
|
4
|
-
export const FilterRemovePayloadSchema = z.object({
|
|
5
|
-
_id: z.string(),
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
export default async function removeFilter(
|
|
9
|
-
payload: z.infer<typeof FilterRemovePayloadSchema>,
|
|
10
|
-
{ logger },
|
|
11
|
-
unchainedAPI: { modules: Modules },
|
|
12
|
-
) {
|
|
13
|
-
const { modules } = unchainedAPI;
|
|
14
|
-
const { _id } = payload;
|
|
15
|
-
logger.debug('remove filter');
|
|
16
|
-
await modules.assortments.filters.deleteMany({ filterId: _id });
|
|
17
|
-
await modules.filters.delete(_id);
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
entity: 'FILTER',
|
|
21
|
-
operation: 'remove',
|
|
22
|
-
_id,
|
|
23
|
-
success: true,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import createFilter from './create.js';
|
|
3
|
-
import { Modules } from '../../../modules.js';
|
|
4
|
-
|
|
5
|
-
export const LocalizedContentSchema = z.record(
|
|
6
|
-
z.string(), // locale
|
|
7
|
-
z.object({
|
|
8
|
-
title: z.string().optional(),
|
|
9
|
-
subtitle: z.string().optional(),
|
|
10
|
-
}),
|
|
11
|
-
);
|
|
12
|
-
export const FilterUpdatePayloadSchema = z.object({
|
|
13
|
-
_id: z.string(),
|
|
14
|
-
specification: z.object({
|
|
15
|
-
type: z.string(),
|
|
16
|
-
key: z.string(),
|
|
17
|
-
isActive: z.boolean().optional(),
|
|
18
|
-
options: z
|
|
19
|
-
.array(
|
|
20
|
-
z.object({
|
|
21
|
-
value: z.string(),
|
|
22
|
-
content: LocalizedContentSchema.optional(),
|
|
23
|
-
}),
|
|
24
|
-
)
|
|
25
|
-
.optional(),
|
|
26
|
-
meta: z.record(z.any(), z.any()).optional(),
|
|
27
|
-
content: LocalizedContentSchema,
|
|
28
|
-
}),
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export default async function updateFilter(
|
|
32
|
-
payload: any,
|
|
33
|
-
{ logger, updateShouldUpsertIfIDNotExists }: { logger: any; updateShouldUpsertIfIDNotExists: boolean },
|
|
34
|
-
unchainedAPI: { modules: Modules },
|
|
35
|
-
) {
|
|
36
|
-
const { modules } = unchainedAPI;
|
|
37
|
-
const { specification, _id } = payload;
|
|
38
|
-
|
|
39
|
-
if (!(await modules.filters.filterExists({ filterId: _id }))) {
|
|
40
|
-
if (updateShouldUpsertIfIDNotExists) {
|
|
41
|
-
return createFilter(payload, { logger, createShouldUpsertIfIDExists: false }, unchainedAPI);
|
|
42
|
-
}
|
|
43
|
-
throw new Error(`Can't update non-existing filter ${_id}`);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const { content, options, ...filterData } = specification;
|
|
47
|
-
|
|
48
|
-
if (specification) {
|
|
49
|
-
logger.debug('update filter object', specification);
|
|
50
|
-
await modules.filters.update(_id, {
|
|
51
|
-
...filterData,
|
|
52
|
-
options: options?.map((option) => option.value) || [],
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (content) {
|
|
57
|
-
logger.debug('replace localized content for filter', content);
|
|
58
|
-
await modules.filters.texts.updateTexts(
|
|
59
|
-
{ filterId: _id },
|
|
60
|
-
Object.entries(content).map(([locale, localizedData]: [string, any]) => {
|
|
61
|
-
return {
|
|
62
|
-
locale,
|
|
63
|
-
...localizedData,
|
|
64
|
-
};
|
|
65
|
-
}),
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (options) {
|
|
70
|
-
logger.debug('replace localized content for filter options', content);
|
|
71
|
-
await Promise.all(
|
|
72
|
-
options.map(async ({ content: optionContent, value: optionValue }) => {
|
|
73
|
-
if (optionContent) {
|
|
74
|
-
await modules.filters.texts.updateTexts(
|
|
75
|
-
{ filterId: _id, filterOptionValue: optionValue },
|
|
76
|
-
Object.entries(optionContent).map(([locale, localizedData]: [string, any]) => {
|
|
77
|
-
return {
|
|
78
|
-
locale,
|
|
79
|
-
...localizedData,
|
|
80
|
-
};
|
|
81
|
-
}),
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
}),
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return {
|
|
89
|
-
entity: 'FILTER',
|
|
90
|
-
operation: 'update',
|
|
91
|
-
_id,
|
|
92
|
-
success: true,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Modules } from '../../../modules.js';
|
|
3
|
-
import { Services } from '../../../services/index.js';
|
|
4
|
-
import upsertVariations, { ProductVariationSchema } from './upsertVariations.js';
|
|
5
|
-
import upsertMedia from './upsertMedia.js';
|
|
6
|
-
import { MediaSchema } from '../assortment/upsertMedia.js';
|
|
7
|
-
import convertTagsToLowerCase from '../utils/convertTagsToLowerCase.js';
|
|
8
|
-
|
|
9
|
-
export const ProductCreateSpecificationSchema = z.object({
|
|
10
|
-
type: z.string(),
|
|
11
|
-
sequence: z.number(),
|
|
12
|
-
status: z.string().optional().nullable(), // or null!
|
|
13
|
-
published: z.string().datetime().optional().nullable(), // or null!
|
|
14
|
-
tags: z.array(z.string()).optional(),
|
|
15
|
-
commerce: z
|
|
16
|
-
.object({
|
|
17
|
-
pricing: z.array(
|
|
18
|
-
z.object({
|
|
19
|
-
amount: z.number(),
|
|
20
|
-
maxQuantity: z.number().optional(),
|
|
21
|
-
isTaxable: z.boolean().optional(),
|
|
22
|
-
isNetPrice: z.boolean().optional(),
|
|
23
|
-
currencyCode: z.string(),
|
|
24
|
-
countryCode: z.string(),
|
|
25
|
-
}),
|
|
26
|
-
),
|
|
27
|
-
})
|
|
28
|
-
.optional(),
|
|
29
|
-
warehousing: z
|
|
30
|
-
.object({
|
|
31
|
-
sku: z.string().optional(),
|
|
32
|
-
baseUnit: z.string().optional(),
|
|
33
|
-
})
|
|
34
|
-
.optional(),
|
|
35
|
-
supply: z
|
|
36
|
-
.object({
|
|
37
|
-
weightInGram: z.number().optional(),
|
|
38
|
-
heightInMillimeters: z.number().optional(),
|
|
39
|
-
lengthInMillimeters: z.number().optional(),
|
|
40
|
-
widthInMillimeters: z.number().optional(),
|
|
41
|
-
})
|
|
42
|
-
.optional(),
|
|
43
|
-
bundleItems: z
|
|
44
|
-
.array(
|
|
45
|
-
z.object({
|
|
46
|
-
productId: z.string(),
|
|
47
|
-
quantity: z.number(),
|
|
48
|
-
configuration: z.array(
|
|
49
|
-
z.object({
|
|
50
|
-
key: z.string(),
|
|
51
|
-
value: z.string(),
|
|
52
|
-
}),
|
|
53
|
-
),
|
|
54
|
-
}),
|
|
55
|
-
)
|
|
56
|
-
.optional(),
|
|
57
|
-
meta: z.record(z.any(), z.any()).optional(),
|
|
58
|
-
content: z.record(
|
|
59
|
-
z.string(), // locale
|
|
60
|
-
z.object({
|
|
61
|
-
title: z.string().optional(),
|
|
62
|
-
subtitle: z.string().optional(),
|
|
63
|
-
slug: z.string().optional(),
|
|
64
|
-
description: z.string().optional(),
|
|
65
|
-
brand: z.string().optional(),
|
|
66
|
-
vendor: z.string().optional(),
|
|
67
|
-
labels: z.array(z.string()).optional(),
|
|
68
|
-
}),
|
|
69
|
-
),
|
|
70
|
-
variationResolvers: z
|
|
71
|
-
.array(
|
|
72
|
-
z.object({
|
|
73
|
-
vector: z.record(z.string(), z.any()),
|
|
74
|
-
productId: z.string(),
|
|
75
|
-
}),
|
|
76
|
-
)
|
|
77
|
-
.optional(),
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
export const ProductCreatePayloadSchema = z.object({
|
|
81
|
-
_id: z.string(),
|
|
82
|
-
specification: ProductCreateSpecificationSchema,
|
|
83
|
-
media: z.array(MediaSchema).optional(),
|
|
84
|
-
variations: z.array(ProductVariationSchema).optional(),
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
const transformSpecification = (specification: z.infer<typeof ProductCreateSpecificationSchema>) => {
|
|
88
|
-
const {
|
|
89
|
-
variationResolvers: assignments,
|
|
90
|
-
content, // eslint-disable-line
|
|
91
|
-
supply,
|
|
92
|
-
warehousing,
|
|
93
|
-
...productData
|
|
94
|
-
} = specification;
|
|
95
|
-
|
|
96
|
-
const tags = productData?.tags ? convertTagsToLowerCase(productData.tags!)! : [];
|
|
97
|
-
const proxy = assignments ? { assignments } : undefined;
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
...productData,
|
|
101
|
-
published: productData.published ? new Date(productData.published) : undefined,
|
|
102
|
-
tags,
|
|
103
|
-
warehousing,
|
|
104
|
-
supply,
|
|
105
|
-
proxy,
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export default async function createProduct(
|
|
110
|
-
payload: z.infer<typeof ProductCreatePayloadSchema>,
|
|
111
|
-
{ logger, createShouldUpsertIfIDExists },
|
|
112
|
-
unchainedAPI: { modules: Modules; services: Services },
|
|
113
|
-
) {
|
|
114
|
-
const { modules } = unchainedAPI;
|
|
115
|
-
const { specification, media, variations, _id } = payload;
|
|
116
|
-
|
|
117
|
-
const productData = transformSpecification(specification);
|
|
118
|
-
logger.debug('create product object', productData);
|
|
119
|
-
try {
|
|
120
|
-
await modules.products.create({
|
|
121
|
-
...productData,
|
|
122
|
-
_id,
|
|
123
|
-
});
|
|
124
|
-
} catch (e) {
|
|
125
|
-
if (!createShouldUpsertIfIDExists) throw e;
|
|
126
|
-
|
|
127
|
-
logger.debug('entity already exists, falling back to update', specification);
|
|
128
|
-
await modules.products.update(_id, {
|
|
129
|
-
...productData,
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (!(await modules.products.productExists({ productId: _id }))) {
|
|
134
|
-
throw new Error(`Can't create product ${_id}`);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (specification.content) {
|
|
138
|
-
logger.debug('create localized content for product', specification.content);
|
|
139
|
-
await modules.products.texts.updateTexts(
|
|
140
|
-
_id,
|
|
141
|
-
Object.entries(specification.content).map(([locale, localizedData]: [string, any]) => {
|
|
142
|
-
return {
|
|
143
|
-
locale,
|
|
144
|
-
...localizedData,
|
|
145
|
-
};
|
|
146
|
-
}),
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
logger.debug('create product variations', variations);
|
|
151
|
-
await upsertVariations(
|
|
152
|
-
{
|
|
153
|
-
variations: variations || [],
|
|
154
|
-
productId: _id,
|
|
155
|
-
},
|
|
156
|
-
unchainedAPI,
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
logger.debug('create product media', media);
|
|
160
|
-
await upsertMedia({ media: media || [], productId: _id }, unchainedAPI);
|
|
161
|
-
|
|
162
|
-
return {
|
|
163
|
-
entity: 'PRODUCT',
|
|
164
|
-
operation: 'create',
|
|
165
|
-
_id,
|
|
166
|
-
success: true,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
createProduct.payloadSchema = ProductCreatePayloadSchema;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Modules } from '../../../modules.js';
|
|
3
|
-
import { Services } from '../../../services/index.js';
|
|
4
|
-
|
|
5
|
-
export const ProductRemovePayloadSchema = z.object({
|
|
6
|
-
_id: z.string(),
|
|
7
|
-
});
|
|
8
|
-
export default async function removeProduct(
|
|
9
|
-
payload: z.infer<typeof ProductRemovePayloadSchema>,
|
|
10
|
-
{ logger },
|
|
11
|
-
unchainedAPI: { modules: Modules; services: Services },
|
|
12
|
-
) {
|
|
13
|
-
const { services } = unchainedAPI;
|
|
14
|
-
const { _id } = payload;
|
|
15
|
-
logger.debug(`remove product ${_id}`);
|
|
16
|
-
|
|
17
|
-
await services.products.removeProduct({ productId: _id });
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
entity: 'PRODUCT',
|
|
21
|
-
operation: 'remove',
|
|
22
|
-
_id,
|
|
23
|
-
success: true,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
removeProduct.payloadSchema = ProductRemovePayloadSchema;
|