@unchainedshop/api 3.1.11 → 4.0.0-rc.2
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/context.d.ts +2 -2
- package/lib/context.d.ts.map +1 -1
- package/lib/context.js +1 -1
- package/lib/context.js.map +1 -1
- package/lib/createGraphQLServer.d.ts +2 -2
- package/lib/createGraphQLServer.d.ts.map +1 -1
- package/lib/errors.d.ts +2 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +2 -0
- package/lib/errors.js.map +1 -1
- package/lib/express/createERCMetadataMiddleware.d.ts.map +1 -1
- package/lib/express/createERCMetadataMiddleware.js +9 -5
- package/lib/express/createERCMetadataMiddleware.js.map +1 -1
- package/lib/express/createMCPMiddleware.d.ts +8 -0
- package/lib/express/createMCPMiddleware.d.ts.map +1 -0
- package/lib/express/createMCPMiddleware.js +46 -0
- package/lib/express/createMCPMiddleware.js.map +1 -0
- package/lib/express/index.d.ts.map +1 -1
- package/lib/express/index.js +0 -2
- package/lib/express/index.js.map +1 -1
- package/lib/express/mcpHandler.d.ts.map +1 -0
- package/lib/express/mcpHandler.js +68 -0
- package/lib/express/mcpHandler.js.map +1 -0
- package/lib/fastify/ercMetadataHandler.d.ts.map +1 -1
- package/lib/fastify/ercMetadataHandler.js +9 -5
- package/lib/fastify/ercMetadataHandler.js.map +1 -1
- package/lib/fastify/index copy.d.ts.map +1 -0
- package/lib/fastify/index copy.js +157 -0
- package/lib/fastify/index copy.js.map +1 -0
- package/lib/fastify/index.d.ts.map +1 -1
- package/lib/fastify/index.js +0 -3
- package/lib/fastify/index.js.map +1 -1
- package/lib/fastify/mcpHandler.d.ts +8 -0
- package/lib/fastify/mcpHandler.d.ts.map +1 -0
- package/lib/fastify/mcpHandler.js +46 -0
- package/lib/fastify/mcpHandler.js.map +1 -0
- package/lib/loaders/assortmentLinkLoader.d.ts +12 -0
- package/lib/loaders/assortmentLinkLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentLinkLoader.js +23 -0
- package/lib/loaders/assortmentLinkLoader.js.map +1 -0
- package/lib/loaders/assortmentLinksLoader.d.ts +14 -0
- package/lib/loaders/assortmentLinksLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentLinksLoader.js +38 -0
- package/lib/loaders/assortmentLinksLoader.js.map +1 -0
- package/lib/loaders/assortmentLoader.d.ts +10 -0
- package/lib/loaders/assortmentLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentLoader.js +15 -0
- package/lib/loaders/assortmentLoader.js.map +1 -0
- package/lib/loaders/assortmentMediaTextLoader.d.ts +12 -0
- package/lib/loaders/assortmentMediaTextLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentMediaTextLoader.js +15 -0
- package/lib/loaders/assortmentMediaTextLoader.js.map +1 -0
- package/lib/loaders/assortmentMediasLoader.d.ts +10 -0
- package/lib/loaders/assortmentMediasLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentMediasLoader.js +18 -0
- package/lib/loaders/assortmentMediasLoader.js.map +1 -0
- package/lib/loaders/assortmentProductLoader.d.ts +12 -0
- package/lib/loaders/assortmentProductLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentProductLoader.js +14 -0
- package/lib/loaders/assortmentProductLoader.js.map +1 -0
- package/lib/loaders/assortmentProductsLoader.d.ts +10 -0
- package/lib/loaders/assortmentProductsLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentProductsLoader.js +18 -0
- package/lib/loaders/assortmentProductsLoader.js.map +1 -0
- package/lib/loaders/assortmentTextLoader.d.ts +12 -0
- package/lib/loaders/assortmentTextLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentTextLoader.js +15 -0
- package/lib/loaders/assortmentTextLoader.js.map +1 -0
- package/lib/loaders/buildTextMap.d.ts +2 -2
- package/lib/loaders/buildTextMap.d.ts.map +1 -1
- package/lib/loaders/countryLoader.d.ts +10 -0
- package/lib/loaders/countryLoader.d.ts.map +1 -0
- package/lib/loaders/countryLoader.js +14 -0
- package/lib/loaders/countryLoader.js.map +1 -0
- package/lib/loaders/currencyLoader.d.ts +10 -0
- package/lib/loaders/currencyLoader.d.ts.map +1 -0
- package/lib/loaders/currencyLoader.js +14 -0
- package/lib/loaders/currencyLoader.js.map +1 -0
- package/lib/loaders/deliveryProviderLoader.d.ts +10 -0
- package/lib/loaders/deliveryProviderLoader.d.ts.map +1 -0
- package/lib/loaders/deliveryProviderLoader.js +13 -0
- package/lib/loaders/deliveryProviderLoader.js.map +1 -0
- package/lib/loaders/fileLoader.d.ts +10 -0
- package/lib/loaders/fileLoader.d.ts.map +1 -0
- package/lib/loaders/fileLoader.js +13 -0
- package/lib/loaders/fileLoader.js.map +1 -0
- package/lib/loaders/filterLoader.d.ts +10 -0
- package/lib/loaders/filterLoader.d.ts.map +1 -0
- package/lib/loaders/filterLoader.js +14 -0
- package/lib/loaders/filterLoader.js.map +1 -0
- package/lib/loaders/filterTextLoader.d.ts +14 -0
- package/lib/loaders/filterTextLoader.d.ts.map +1 -0
- package/lib/loaders/filterTextLoader.js +15 -0
- package/lib/loaders/filterTextLoader.js.map +1 -0
- package/lib/loaders/index.d.ts +79 -49
- package/lib/loaders/index.d.ts.map +1 -1
- package/lib/loaders/index.js +47 -268
- package/lib/loaders/index.js.map +1 -1
- package/lib/loaders/languageLoader.d.ts +10 -0
- package/lib/loaders/languageLoader.d.ts.map +1 -0
- package/lib/loaders/languageLoader.js +14 -0
- package/lib/loaders/languageLoader.js.map +1 -0
- package/lib/loaders/orderLoader.d.ts +10 -0
- package/lib/loaders/orderLoader.d.ts.map +1 -0
- package/lib/loaders/orderLoader.js +16 -0
- package/lib/loaders/orderLoader.js.map +1 -0
- package/lib/loaders/paymentProviderLoader.d.ts +10 -0
- package/lib/loaders/paymentProviderLoader.d.ts.map +1 -0
- package/lib/loaders/paymentProviderLoader.js +13 -0
- package/lib/loaders/paymentProviderLoader.js.map +1 -0
- package/lib/loaders/productLoader.d.ts +10 -0
- package/lib/loaders/productLoader.d.ts.map +1 -0
- package/lib/loaders/productLoader.js +16 -0
- package/lib/loaders/productLoader.js.map +1 -0
- package/lib/loaders/productLoaderBySKU.d.ts +10 -0
- package/lib/loaders/productLoaderBySKU.d.ts.map +1 -0
- package/lib/loaders/productLoaderBySKU.js +16 -0
- package/lib/loaders/productLoaderBySKU.js.map +1 -0
- package/lib/loaders/productMediaTextLoader.d.ts +12 -0
- package/lib/loaders/productMediaTextLoader.d.ts.map +1 -0
- package/lib/loaders/productMediaTextLoader.js +15 -0
- package/lib/loaders/productMediaTextLoader.js.map +1 -0
- package/lib/loaders/productMediasLoader.d.ts +10 -0
- package/lib/loaders/productMediasLoader.d.ts.map +1 -0
- package/lib/loaders/productMediasLoader.js +18 -0
- package/lib/loaders/productMediasLoader.js.map +1 -0
- package/lib/loaders/productTextLoader.d.ts +12 -0
- package/lib/loaders/productTextLoader.d.ts.map +1 -0
- package/lib/loaders/productTextLoader.js +15 -0
- package/lib/loaders/productTextLoader.js.map +1 -0
- package/lib/loaders/userLoader.d.ts +10 -0
- package/lib/loaders/userLoader.d.ts.map +1 -0
- package/lib/loaders/userLoader.js +17 -0
- package/lib/loaders/userLoader.js.map +1 -0
- package/lib/loaders/utils.d.ts +7 -0
- package/lib/loaders/utils.d.ts.map +1 -0
- package/lib/loaders/utils.js +29 -0
- package/lib/loaders/utils.js.map +1 -0
- package/lib/locale-context.d.ts +3 -3
- package/lib/locale-context.d.ts.map +1 -1
- package/lib/locale-context.js +9 -10
- package/lib/locale-context.js.map +1 -1
- package/lib/mcp/index.d.ts +95 -0
- package/lib/mcp/index.d.ts.map +1 -0
- package/lib/mcp/index.js +138 -0
- package/lib/mcp/index.js.map +1 -0
- package/lib/mcp/server.d.ts +4 -0
- package/lib/mcp/server.d.ts.map +1 -0
- package/lib/mcp/server.js +60 -0
- package/lib/mcp/server.js.map +1 -0
- package/lib/mcp/types.d.ts +28 -0
- package/lib/mcp/types.d.ts.map +1 -0
- package/lib/mcp/types.js +2 -0
- package/lib/mcp/types.js.map +1 -0
- package/lib/middleware/accountLockout.d.ts.map +1 -0
- package/lib/middleware/accountLockout.js +84 -0
- package/lib/middleware/accountLockout.js.map +1 -0
- package/lib/middleware/rateLimiter.d.ts.map +1 -0
- package/lib/middleware/rateLimiter.js +91 -0
- package/lib/middleware/rateLimiter.js.map +1 -0
- package/lib/plugins/inputValidation.d.ts.map +1 -0
- package/lib/plugins/inputValidation.js +95 -0
- package/lib/plugins/inputValidation.js.map +1 -0
- package/lib/resolvers/mutations/accounts/createUser.d.ts.map +1 -1
- package/lib/resolvers/mutations/accounts/createUser.js +4 -5
- package/lib/resolvers/mutations/accounts/createUser.js.map +1 -1
- package/lib/resolvers/mutations/accounts/impersonate.js +1 -1
- package/lib/resolvers/mutations/accounts/impersonate.js.map +1 -1
- package/lib/resolvers/mutations/accounts/loginAsGuest.d.ts.map +1 -1
- package/lib/resolvers/mutations/accounts/loginAsGuest.js +4 -5
- package/lib/resolvers/mutations/accounts/loginAsGuest.js.map +1 -1
- package/lib/resolvers/mutations/accounts/loginWithPassword.js +3 -3
- package/lib/resolvers/mutations/accounts/loginWithPassword.js.map +1 -1
- package/lib/resolvers/mutations/accounts/loginWithWebAuthn.js +3 -3
- package/lib/resolvers/mutations/accounts/loginWithWebAuthn.js.map +1 -1
- package/lib/resolvers/mutations/accounts/resetPassword.js +3 -3
- package/lib/resolvers/mutations/accounts/resetPassword.js.map +1 -1
- package/lib/resolvers/mutations/accounts/stopImpersonation.js +1 -1
- package/lib/resolvers/mutations/accounts/stopImpersonation.js.map +1 -1
- package/lib/resolvers/mutations/accounts/verifyEmail.js +3 -3
- package/lib/resolvers/mutations/accounts/verifyEmail.js.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentFilters.d.ts +2 -2
- package/lib/resolvers/mutations/assortments/reorderAssortmentFilters.d.ts.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentFilters.js.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentLinks.d.ts +2 -2
- package/lib/resolvers/mutations/assortments/reorderAssortmentLinks.d.ts.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentLinks.js.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentMedia.d.ts +2 -2
- package/lib/resolvers/mutations/assortments/reorderAssortmentMedia.d.ts.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentMedia.js.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentProducts.d.ts +2 -2
- package/lib/resolvers/mutations/assortments/reorderAssortmentProducts.d.ts.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentProducts.js.map +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentMediaTexts.d.ts +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentMediaTexts.d.ts.map +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentMediaTexts.js.map +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentTexts.d.ts +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentTexts.d.ts.map +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentTexts.js.map +1 -1
- package/lib/resolvers/mutations/enrollments/createEnrollment.js +3 -3
- package/lib/resolvers/mutations/enrollments/createEnrollment.js.map +1 -1
- package/lib/resolvers/mutations/enrollments/updateEnrollment.d.ts +2 -2
- package/lib/resolvers/mutations/enrollments/updateEnrollment.d.ts.map +1 -1
- package/lib/resolvers/mutations/filters/createFilter.d.ts.map +1 -1
- package/lib/resolvers/mutations/filters/createFilter.js +2 -6
- package/lib/resolvers/mutations/filters/createFilter.js.map +1 -1
- package/lib/resolvers/mutations/filters/updateFilterTexts.d.ts +2 -2
- package/lib/resolvers/mutations/filters/updateFilterTexts.d.ts.map +1 -1
- package/lib/resolvers/mutations/orders/addCartDiscount.js +1 -1
- package/lib/resolvers/mutations/orders/addCartDiscount.js.map +1 -1
- package/lib/resolvers/mutations/orders/addCartProduct.js +1 -1
- package/lib/resolvers/mutations/orders/addCartProduct.js.map +1 -1
- package/lib/resolvers/mutations/orders/addCartQuotation.d.ts +2 -2
- package/lib/resolvers/mutations/orders/addCartQuotation.d.ts.map +1 -1
- package/lib/resolvers/mutations/orders/addCartQuotation.js +1 -1
- package/lib/resolvers/mutations/orders/addCartQuotation.js.map +1 -1
- package/lib/resolvers/mutations/orders/addMultipleCartProducts.d.ts +4 -4
- package/lib/resolvers/mutations/orders/addMultipleCartProducts.d.ts.map +1 -1
- package/lib/resolvers/mutations/orders/addMultipleCartProducts.js +1 -1
- package/lib/resolvers/mutations/orders/addMultipleCartProducts.js.map +1 -1
- package/lib/resolvers/mutations/orders/checkoutCart.js +1 -1
- package/lib/resolvers/mutations/orders/checkoutCart.js.map +1 -1
- package/lib/resolvers/mutations/orders/createCart.js +1 -1
- package/lib/resolvers/mutations/orders/createCart.js.map +1 -1
- package/lib/resolvers/mutations/orders/emptyCart.js +1 -1
- package/lib/resolvers/mutations/orders/emptyCart.js.map +1 -1
- package/lib/resolvers/mutations/orders/signPaymentProviderForCheckout.js +1 -1
- package/lib/resolvers/mutations/orders/signPaymentProviderForCheckout.js.map +1 -1
- package/lib/resolvers/mutations/orders/updateCart.js +1 -1
- package/lib/resolvers/mutations/orders/updateCart.js.map +1 -1
- package/lib/resolvers/mutations/orders/updateCartItem.d.ts +2 -2
- package/lib/resolvers/mutations/orders/updateCartItem.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/addProductAssignment.d.ts +1 -1
- package/lib/resolvers/mutations/products/addProductAssignment.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/addProductAssignment.js +35 -2
- package/lib/resolvers/mutations/products/addProductAssignment.js.map +1 -1
- package/lib/resolvers/mutations/products/createProductVariation.d.ts +2 -2
- package/lib/resolvers/mutations/products/createProductVariation.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/createProductVariation.js.map +1 -1
- package/lib/resolvers/mutations/products/removeProductAssignment.d.ts +1 -1
- package/lib/resolvers/mutations/products/removeProductAssignment.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/removeProductAssignment.js.map +1 -1
- package/lib/resolvers/mutations/products/reorderProductMedia.d.ts +2 -2
- package/lib/resolvers/mutations/products/reorderProductMedia.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/reorderProductMedia.js.map +1 -1
- package/lib/resolvers/mutations/products/updateProductMediaTexts.d.ts +1 -1
- package/lib/resolvers/mutations/products/updateProductMediaTexts.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/updateProductMediaTexts.js.map +1 -1
- package/lib/resolvers/mutations/products/updateProductVariationTexts.d.ts +1 -1
- package/lib/resolvers/mutations/products/updateProductVariationTexts.d.ts.map +1 -1
- package/lib/resolvers/mutations/quotations/requestQuotation.d.ts +2 -2
- package/lib/resolvers/mutations/quotations/requestQuotation.d.ts.map +1 -1
- package/lib/resolvers/mutations/quotations/requestQuotation.js +3 -3
- package/lib/resolvers/mutations/quotations/requestQuotation.js.map +1 -1
- package/lib/resolvers/mutations/users/heartbeat.d.ts +1 -1
- package/lib/resolvers/mutations/users/heartbeat.d.ts.map +1 -1
- package/lib/resolvers/mutations/users/heartbeat.js +3 -3
- package/lib/resolvers/mutations/users/heartbeat.js.map +1 -1
- package/lib/resolvers/mutations/users/setRoles.d.ts +1 -1
- package/lib/resolvers/mutations/users/setRoles.d.ts.map +1 -1
- package/lib/resolvers/mutations/users/setRoles.js.map +1 -1
- package/lib/resolvers/mutations/users/setUserTags.d.ts +1 -1
- package/lib/resolvers/mutations/users/setUserTags.d.ts.map +1 -1
- package/lib/resolvers/mutations/users/setUserTags.js.map +1 -1
- package/lib/resolvers/mutations/warehousing/invalidateToken.js +1 -3
- package/lib/resolvers/mutations/warehousing/invalidateToken.js.map +1 -1
- package/lib/resolvers/mutations/worker/allocateWork.d.ts +1 -1
- package/lib/resolvers/mutations/worker/allocateWork.d.ts.map +1 -1
- package/lib/resolvers/mutations/worker/allocateWork.js.map +1 -1
- package/lib/resolvers/queries/assortments/assortments.d.ts +1 -1
- package/lib/resolvers/queries/assortments/assortments.d.ts.map +1 -1
- package/lib/resolvers/queries/countries/countries.d.ts +1 -1
- package/lib/resolvers/queries/countries/countries.d.ts.map +1 -1
- package/lib/resolvers/queries/countries/countries.js.map +1 -1
- package/lib/resolvers/queries/currencies/currencies.d.ts +1 -1
- package/lib/resolvers/queries/currencies/currencies.d.ts.map +1 -1
- package/lib/resolvers/queries/currencies/currencies.js.map +1 -1
- package/lib/resolvers/queries/enrollments/enrollments.d.ts +1 -1
- package/lib/resolvers/queries/enrollments/enrollments.d.ts.map +1 -1
- package/lib/resolvers/queries/filters/filters.d.ts +1 -1
- package/lib/resolvers/queries/filters/filters.d.ts.map +1 -1
- package/lib/resolvers/queries/filters/searchAssortments.js +2 -2
- package/lib/resolvers/queries/filters/searchAssortments.js.map +1 -1
- package/lib/resolvers/queries/filters/searchProducts.js +3 -3
- package/lib/resolvers/queries/filters/searchProducts.js.map +1 -1
- package/lib/resolvers/queries/languages/languages.d.ts +1 -1
- package/lib/resolvers/queries/languages/languages.d.ts.map +1 -1
- package/lib/resolvers/queries/languages/languages.js.map +1 -1
- package/lib/resolvers/queries/orders/orders.d.ts +1 -1
- package/lib/resolvers/queries/orders/orders.d.ts.map +1 -1
- package/lib/resolvers/queries/orders/orders.js.map +1 -1
- package/lib/resolvers/queries/products/productReviews.d.ts +1 -1
- package/lib/resolvers/queries/products/productReviews.d.ts.map +1 -1
- package/lib/resolvers/queries/products/products.d.ts +1 -1
- package/lib/resolvers/queries/products/products.d.ts.map +1 -1
- package/lib/resolvers/queries/quotations/quotations.d.ts +1 -1
- package/lib/resolvers/queries/quotations/quotations.d.ts.map +1 -1
- package/lib/resolvers/queries/quotations/quotations.js.map +1 -1
- package/lib/resolvers/queries/users/impersonator.d.ts.map +1 -1
- package/lib/resolvers/queries/users/impersonator.js +1 -1
- package/lib/resolvers/queries/users/impersonator.js.map +1 -1
- package/lib/resolvers/queries/users/user.d.ts.map +1 -1
- package/lib/resolvers/queries/users/user.js.map +1 -1
- package/lib/resolvers/queries/users/users.d.ts +1 -1
- package/lib/resolvers/queries/users/users.d.ts.map +1 -1
- package/lib/resolvers/queries/worker/workQueue.d.ts +3 -3
- package/lib/resolvers/queries/worker/workQueue.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-filter-types.d.ts +4 -8
- package/lib/resolvers/type/assortment/assortment-filter-types.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-filter-types.js +4 -6
- package/lib/resolvers/type/assortment/assortment-filter-types.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-link-types.d.ts +2 -2
- package/lib/resolvers/type/assortment/assortment-link-types.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-media-types.js +2 -2
- package/lib/resolvers/type/assortment/assortment-media-types.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-path-link-types.d.ts +2 -2
- package/lib/resolvers/type/assortment/assortment-path-link-types.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-path-link-types.js +2 -2
- package/lib/resolvers/type/assortment/assortment-path-link-types.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-product-types.d.ts +2 -2
- package/lib/resolvers/type/assortment/assortment-product-types.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-types.d.ts +2 -2
- package/lib/resolvers/type/assortment/assortment-types.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-types.js +5 -5
- package/lib/resolvers/type/assortment/assortment-types.js.map +1 -1
- package/lib/resolvers/type/bookmark-types.d.ts.map +1 -1
- package/lib/resolvers/type/bookmark-types.js +2 -3
- package/lib/resolvers/type/bookmark-types.js.map +1 -1
- package/lib/resolvers/type/country-types.d.ts +1 -1
- package/lib/resolvers/type/country-types.d.ts.map +1 -1
- package/lib/resolvers/type/country-types.js +4 -7
- package/lib/resolvers/type/country-types.js.map +1 -1
- package/lib/resolvers/type/delivery-provider-types.d.ts +10 -13
- package/lib/resolvers/type/delivery-provider-types.d.ts.map +1 -1
- package/lib/resolvers/type/delivery-provider-types.js +8 -9
- package/lib/resolvers/type/delivery-provider-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.d.ts +2 -6
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.js +4 -3
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-payment-types.d.ts +2 -6
- package/lib/resolvers/type/enrollment/enrollment-payment-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-payment-types.js +2 -3
- package/lib/resolvers/type/enrollment/enrollment-payment-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-period-types.d.ts +2 -6
- package/lib/resolvers/type/enrollment/enrollment-period-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-period-types.js +2 -3
- package/lib/resolvers/type/enrollment/enrollment-period-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-plan-tyes.d.ts +2 -6
- package/lib/resolvers/type/enrollment/enrollment-plan-tyes.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-plan-tyes.js +2 -3
- package/lib/resolvers/type/enrollment/enrollment-plan-tyes.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-types.d.ts +15 -14
- package/lib/resolvers/type/enrollment/enrollment-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-types.js +3 -6
- package/lib/resolvers/type/enrollment/enrollment-types.js.map +1 -1
- package/lib/resolvers/type/filter/filter-option-types.d.ts +6 -9
- package/lib/resolvers/type/filter/filter-option-types.d.ts.map +1 -1
- package/lib/resolvers/type/filter/filter-option-types.js +2 -3
- package/lib/resolvers/type/filter/filter-option-types.js.map +1 -1
- package/lib/resolvers/type/filter/filter-types.d.ts +16 -8
- package/lib/resolvers/type/filter/filter-types.d.ts.map +1 -1
- package/lib/resolvers/type/filter/filter-types.js +2 -3
- package/lib/resolvers/type/filter/filter-types.js.map +1 -1
- package/lib/resolvers/type/filter/loaded-filter-types.d.ts +2 -3
- package/lib/resolvers/type/filter/loaded-filter-types.d.ts.map +1 -1
- package/lib/resolvers/type/index.d.ts +273 -261
- package/lib/resolvers/type/index.d.ts.map +1 -1
- package/lib/resolvers/type/login-method-response-types.js +1 -1
- package/lib/resolvers/type/login-method-response-types.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-discount-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-delivery-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-discount-types.js +1 -2
- package/lib/resolvers/type/order/order-delivery-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts +13 -12
- package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.js +10 -14
- package/lib/resolvers/type/order/order-delivery-pickup-types.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-shipping-types.d.ts +12 -12
- package/lib/resolvers/type/order/order-delivery-shipping-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-shipping-types.js +7 -10
- package/lib/resolvers/type/order/order-delivery-shipping-types.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-delivery-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-types.js +2 -3
- package/lib/resolvers/type/order/order-delivery-types.js.map +1 -1
- package/lib/resolvers/type/order/order-discount-types.d.ts +11 -13
- package/lib/resolvers/type/order/order-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-discount-types.js +9 -16
- package/lib/resolvers/type/order/order-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-global-discount-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-global-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-global-discount-types.js +1 -2
- package/lib/resolvers/type/order/order-global-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-item-discount-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-item-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-item-discount-types.js +1 -2
- package/lib/resolvers/type/order/order-item-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-item-types.d.ts +5 -5
- package/lib/resolvers/type/order/order-item-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-item-types.js +14 -17
- package/lib/resolvers/type/order/order-item-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-card-types.d.ts +11 -10
- package/lib/resolvers/type/order/order-payment-card-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-card-types.js +6 -9
- package/lib/resolvers/type/order/order-payment-card-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-discount-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-payment-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-discount-types.js +2 -4
- package/lib/resolvers/type/order/order-payment-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-generic-types.d.ts +11 -10
- package/lib/resolvers/type/order/order-payment-generic-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-generic-types.js +6 -9
- package/lib/resolvers/type/order/order-payment-generic-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-invoice-types.d.ts +11 -10
- package/lib/resolvers/type/order/order-payment-invoice-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-invoice-types.js +6 -9
- package/lib/resolvers/type/order/order-payment-invoice-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-payment-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-types.js +2 -3
- package/lib/resolvers/type/order/order-payment-types.js.map +1 -1
- package/lib/resolvers/type/order/order-types.d.ts +6 -6
- package/lib/resolvers/type/order/order-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-types.js +7 -15
- package/lib/resolvers/type/order/order-types.js.map +1 -1
- package/lib/resolvers/type/payment/payment-credentials-types.d.ts.map +1 -1
- package/lib/resolvers/type/payment/payment-credentials-types.js +6 -9
- package/lib/resolvers/type/payment/payment-credentials-types.js.map +1 -1
- package/lib/resolvers/type/payment/payment-provider-types.d.ts +2 -2
- package/lib/resolvers/type/payment/payment-provider-types.d.ts.map +1 -1
- package/lib/resolvers/type/payment/payment-provider-types.js +8 -9
- package/lib/resolvers/type/payment/payment-provider-types.js.map +1 -1
- package/lib/resolvers/type/price-types.d.ts +3 -4
- package/lib/resolvers/type/price-types.d.ts.map +1 -1
- package/lib/resolvers/type/price-types.js +2 -2
- package/lib/resolvers/type/price-types.js.map +1 -1
- package/lib/resolvers/type/product/product-assortment-path-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-assortment-path-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-bundle-types.d.ts +10 -10
- package/lib/resolvers/type/product/product-bundle-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-catalog-price-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-catalog-price-types.js +4 -6
- package/lib/resolvers/type/product/product-catalog-price-types.js.map +1 -1
- package/lib/resolvers/type/product/product-configurable-types.d.ts +20 -20
- package/lib/resolvers/type/product/product-configurable-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-configurable-types.js +10 -12
- package/lib/resolvers/type/product/product-configurable-types.js.map +1 -1
- package/lib/resolvers/type/product/product-discount.d.ts +1 -1
- package/lib/resolvers/type/product/product-discount.js +1 -1
- package/lib/resolvers/type/product/product-discount.js.map +1 -1
- package/lib/resolvers/type/product/product-media-types.js +2 -2
- package/lib/resolvers/type/product/product-media-types.js.map +1 -1
- package/lib/resolvers/type/product/product-plan-types.d.ts +18 -18
- package/lib/resolvers/type/product/product-plan-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-plan-types.js +16 -16
- package/lib/resolvers/type/product/product-plan-types.js.map +1 -1
- package/lib/resolvers/type/product/product-review-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-review-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-review-types.js +2 -3
- package/lib/resolvers/type/product/product-review-types.js.map +1 -1
- package/lib/resolvers/type/product/product-simple-types.d.ts +22 -22
- package/lib/resolvers/type/product/product-simple-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-simple-types.js +3 -11
- package/lib/resolvers/type/product/product-simple-types.js.map +1 -1
- package/lib/resolvers/type/product/product-tokenized-types.d.ts +20 -20
- package/lib/resolvers/type/product/product-tokenized-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-tokenized-types.js +1 -5
- package/lib/resolvers/type/product/product-tokenized-types.js.map +1 -1
- package/lib/resolvers/type/product/product-types.d.ts +9 -9
- package/lib/resolvers/type/product/product-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-types.js +2 -5
- package/lib/resolvers/type/product/product-types.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-types.d.ts +2 -2
- package/lib/resolvers/type/product/product-variation-assignment-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-types.js +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-types.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-vector.js +2 -2
- package/lib/resolvers/type/product/product-variation-assignment-vector.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-option-types.js +3 -3
- package/lib/resolvers/type/product/product-variation-option-types.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-types.d.ts +2 -2
- package/lib/resolvers/type/product/product-variation-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-variation-types.js +3 -3
- package/lib/resolvers/type/product/product-variation-types.js.map +1 -1
- package/lib/resolvers/type/product-search-result-types.d.ts +5 -6
- package/lib/resolvers/type/product-search-result-types.d.ts.map +1 -1
- package/lib/resolvers/type/quotation-types.d.ts +8 -15
- package/lib/resolvers/type/quotation-types.d.ts.map +1 -1
- package/lib/resolvers/type/quotation-types.js +3 -6
- package/lib/resolvers/type/quotation-types.js.map +1 -1
- package/lib/resolvers/type/shop-types.d.ts +1 -1
- package/lib/resolvers/type/shop-types.d.ts.map +1 -1
- package/lib/resolvers/type/shop-types.js +4 -6
- package/lib/resolvers/type/shop-types.js.map +1 -1
- package/lib/resolvers/type/token-types.d.ts +2 -2
- package/lib/resolvers/type/token-types.d.ts.map +1 -1
- package/lib/resolvers/type/token-types.js +12 -26
- package/lib/resolvers/type/token-types.js.map +1 -1
- package/lib/resolvers/type/user-types.d.ts +22 -22
- package/lib/resolvers/type/user-types.d.ts.map +1 -1
- package/lib/resolvers/type/user-types.js +5 -16
- package/lib/resolvers/type/user-types.js.map +1 -1
- package/lib/resolvers/type/work-types.d.ts.map +1 -1
- package/lib/resolvers/type/work-types.js +0 -1
- package/lib/resolvers/type/work-types.js.map +1 -1
- package/lib/roles/all.d.ts.map +1 -1
- package/lib/roles/all.js +0 -1
- package/lib/roles/all.js.map +1 -1
- package/lib/schema/types/assortment.js +5 -5
- package/lib/schema/types/country.js +1 -1
- package/lib/schema/types/delivery.d.ts.map +1 -1
- package/lib/schema/types/delivery.js +6 -2
- package/lib/schema/types/delivery.js.map +1 -1
- package/lib/schema/types/filter.js +3 -3
- package/lib/schema/types/payment.d.ts.map +1 -1
- package/lib/schema/types/payment.js +6 -2
- package/lib/schema/types/payment.js.map +1 -1
- package/lib/schema/types/price.js +1 -1
- package/lib/schema/types/product/bundle-product.js +1 -1
- package/lib/schema/types/product/configurable-product.js +6 -6
- package/lib/schema/types/product/plan-product.js +5 -5
- package/lib/schema/types/product/product.js +4 -4
- package/lib/schema/types/product/simple-product.js +4 -4
- package/lib/schema/types/product/tokenized-product.js +5 -5
- package/lib/schema/types/warehousing.js +1 -1
- package/lib/utils/inputValidation.d.ts.map +1 -0
- package/lib/utils/inputValidation.js +51 -0
- package/lib/utils/inputValidation.js.map +1 -0
- package/package.json +12 -12
- package/src/context.ts +3 -3
- package/src/createGraphQLServer.ts +2 -2
- package/src/errors.ts +10 -0
- package/src/express/createERCMetadataMiddleware.ts +11 -5
- package/src/express/index.ts +2 -3
- package/src/fastify/ercMetadataHandler.ts +11 -5
- package/src/fastify/index.ts +2 -3
- package/src/loaders/assortmentLinkLoader.ts +32 -0
- package/src/loaders/assortmentLinksLoader.ts +46 -0
- package/src/loaders/assortmentLoader.ts +20 -0
- package/src/loaders/assortmentMediaTextLoader.ts +26 -0
- package/src/loaders/assortmentMediasLoader.ts +21 -0
- package/src/loaders/assortmentProductLoader.ts +19 -0
- package/src/loaders/assortmentProductsLoader.ts +22 -0
- package/src/loaders/assortmentTextLoader.ts +24 -0
- package/src/loaders/buildTextMap.ts +1 -1
- package/src/loaders/countryLoader.ts +20 -0
- package/src/loaders/currencyLoader.ts +20 -0
- package/src/loaders/deliveryProviderLoader.ts +19 -0
- package/src/loaders/fileLoader.ts +19 -0
- package/src/loaders/filterLoader.ts +20 -0
- package/src/loaders/filterTextLoader.ts +26 -0
- package/src/loaders/index.ts +48 -360
- package/src/loaders/languageLoader.ts +20 -0
- package/src/loaders/orderLoader.ts +22 -0
- package/src/loaders/paymentProviderLoader.ts +19 -0
- package/src/loaders/productLoader.ts +22 -0
- package/src/loaders/productLoaderBySKU.ts +22 -0
- package/src/loaders/productMediaTextLoader.ts +24 -0
- package/src/loaders/productMediasLoader.ts +21 -0
- package/src/loaders/productTextLoader.ts +22 -0
- package/src/loaders/userLoader.ts +23 -0
- package/src/loaders/utils.ts +35 -0
- package/src/locale-context.ts +16 -22
- package/src/resolvers/mutations/accounts/createUser.ts +4 -6
- package/src/resolvers/mutations/accounts/impersonate.ts +1 -1
- package/src/resolvers/mutations/accounts/loginAsGuest.ts +4 -6
- package/src/resolvers/mutations/accounts/loginWithPassword.ts +3 -3
- package/src/resolvers/mutations/accounts/loginWithWebAuthn.ts +3 -3
- package/src/resolvers/mutations/accounts/resetPassword.ts +3 -3
- package/src/resolvers/mutations/accounts/stopImpersonation.ts +1 -1
- package/src/resolvers/mutations/accounts/verifyEmail.ts +3 -3
- package/src/resolvers/mutations/assortments/reorderAssortmentFilters.ts +1 -1
- package/src/resolvers/mutations/assortments/reorderAssortmentLinks.ts +1 -1
- package/src/resolvers/mutations/assortments/reorderAssortmentMedia.ts +1 -1
- package/src/resolvers/mutations/assortments/reorderAssortmentProducts.ts +1 -1
- package/src/resolvers/mutations/assortments/updateAssortmentMediaTexts.ts +1 -1
- package/src/resolvers/mutations/assortments/updateAssortmentTexts.ts +1 -1
- package/src/resolvers/mutations/enrollments/createEnrollment.ts +3 -3
- package/src/resolvers/mutations/enrollments/updateEnrollment.ts +2 -2
- package/src/resolvers/mutations/filters/createFilter.ts +2 -6
- package/src/resolvers/mutations/filters/updateFilterTexts.ts +1 -1
- package/src/resolvers/mutations/orders/addCartDiscount.ts +1 -1
- package/src/resolvers/mutations/orders/addCartProduct.ts +1 -1
- package/src/resolvers/mutations/orders/addCartQuotation.ts +2 -2
- package/src/resolvers/mutations/orders/addMultipleCartProducts.ts +4 -4
- package/src/resolvers/mutations/orders/checkoutCart.ts +1 -1
- package/src/resolvers/mutations/orders/createCart.ts +1 -1
- package/src/resolvers/mutations/orders/emptyCart.ts +1 -1
- package/src/resolvers/mutations/orders/signPaymentProviderForCheckout.ts +1 -1
- package/src/resolvers/mutations/orders/updateCart.ts +1 -1
- package/src/resolvers/mutations/orders/updateCartItem.ts +1 -1
- package/src/resolvers/mutations/products/addProductAssignment.ts +50 -3
- package/src/resolvers/mutations/products/createProductVariation.ts +5 -1
- package/src/resolvers/mutations/products/removeProductAssignment.ts +1 -1
- package/src/resolvers/mutations/products/reorderProductMedia.ts +1 -1
- package/src/resolvers/mutations/products/updateProductMediaTexts.ts +1 -1
- package/src/resolvers/mutations/products/updateProductVariationTexts.ts +1 -1
- package/src/resolvers/mutations/quotations/requestQuotation.ts +4 -4
- package/src/resolvers/mutations/users/heartbeat.ts +3 -3
- package/src/resolvers/mutations/users/setRoles.ts +1 -1
- package/src/resolvers/mutations/users/setUserTags.ts +1 -1
- package/src/resolvers/mutations/warehousing/invalidateToken.ts +3 -3
- package/src/resolvers/mutations/worker/allocateWork.ts +1 -1
- package/src/resolvers/queries/assortments/assortments.ts +1 -1
- package/src/resolvers/queries/countries/countries.ts +1 -1
- package/src/resolvers/queries/currencies/currencies.ts +1 -1
- package/src/resolvers/queries/enrollments/enrollments.ts +1 -1
- package/src/resolvers/queries/filters/filters.ts +1 -1
- package/src/resolvers/queries/filters/searchAssortments.ts +2 -2
- package/src/resolvers/queries/filters/searchProducts.ts +3 -3
- package/src/resolvers/queries/languages/languages.ts +1 -1
- package/src/resolvers/queries/orders/orders.ts +1 -1
- package/src/resolvers/queries/products/productReviews.ts +1 -1
- package/src/resolvers/queries/products/products.ts +1 -1
- package/src/resolvers/queries/quotations/quotations.ts +1 -1
- package/src/resolvers/queries/users/impersonator.ts +2 -1
- package/src/resolvers/queries/users/user.ts +1 -0
- package/src/resolvers/queries/users/users.ts +1 -1
- package/src/resolvers/queries/worker/workQueue.ts +3 -3
- package/src/resolvers/type/assortment/assortment-filter-types.ts +6 -16
- package/src/resolvers/type/assortment/assortment-link-types.ts +2 -2
- package/src/resolvers/type/assortment/assortment-media-types.ts +2 -2
- package/src/resolvers/type/assortment/assortment-path-link-types.ts +3 -3
- package/src/resolvers/type/assortment/assortment-product-types.ts +2 -2
- package/src/resolvers/type/assortment/assortment-types.ts +6 -6
- package/src/resolvers/type/bookmark-types.ts +2 -3
- package/src/resolvers/type/country-types.ts +5 -8
- package/src/resolvers/type/delivery-provider-types.ts +26 -47
- package/src/resolvers/type/enrollment/enrollment-delivery-types.ts +5 -11
- package/src/resolvers/type/enrollment/enrollment-payment-types.ts +3 -11
- package/src/resolvers/type/enrollment/enrollment-period-types.ts +3 -11
- package/src/resolvers/type/enrollment/enrollment-plan-tyes.ts +3 -11
- package/src/resolvers/type/enrollment/enrollment-types.ts +10 -25
- package/src/resolvers/type/filter/filter-option-types.ts +10 -15
- package/src/resolvers/type/filter/filter-types.ts +5 -13
- package/src/resolvers/type/filter/loaded-filter-types.ts +2 -2
- package/src/resolvers/type/login-method-response-types.ts +1 -1
- package/src/resolvers/type/order/order-delivery-discount-types.ts +1 -2
- package/src/resolvers/type/order/order-delivery-pickup-types.ts +12 -28
- package/src/resolvers/type/order/order-delivery-shipping-types.ts +9 -23
- package/src/resolvers/type/order/order-delivery-types.ts +2 -3
- package/src/resolvers/type/order/order-discount-types.ts +12 -39
- package/src/resolvers/type/order/order-global-discount-types.ts +1 -2
- package/src/resolvers/type/order/order-item-discount-types.ts +1 -2
- package/src/resolvers/type/order/order-item-types.ts +19 -27
- package/src/resolvers/type/order/order-payment-card-types.ts +8 -21
- package/src/resolvers/type/order/order-payment-discount-types.ts +1 -2
- package/src/resolvers/type/order/order-payment-generic-types.ts +8 -20
- package/src/resolvers/type/order/order-payment-invoice-types.ts +8 -20
- package/src/resolvers/type/order/order-payment-types.ts +2 -3
- package/src/resolvers/type/order/order-types.ts +10 -22
- package/src/resolvers/type/payment/payment-credentials-types.ts +6 -10
- package/src/resolvers/type/payment/payment-provider-types.ts +9 -10
- package/src/resolvers/type/price-types.ts +4 -4
- package/src/resolvers/type/product/product-assortment-path-types.ts +1 -1
- package/src/resolvers/type/product/product-bundle-types.ts +1 -1
- package/src/resolvers/type/product/product-catalog-price-types.ts +4 -6
- package/src/resolvers/type/product/product-configurable-types.ts +20 -21
- package/src/resolvers/type/product/product-discount.ts +1 -1
- package/src/resolvers/type/product/product-media-types.ts +2 -2
- package/src/resolvers/type/product/product-plan-types.ts +22 -22
- package/src/resolvers/type/product/product-review-types.ts +3 -4
- package/src/resolvers/type/product/product-simple-types.ts +7 -19
- package/src/resolvers/type/product/product-tokenized-types.ts +3 -10
- package/src/resolvers/type/product/product-types.ts +10 -13
- package/src/resolvers/type/product/product-variation-assignment-types.ts +2 -2
- package/src/resolvers/type/product/product-variation-assignment-vector.ts +2 -2
- package/src/resolvers/type/product/product-variation-option-types.ts +3 -3
- package/src/resolvers/type/product/product-variation-types.ts +5 -5
- package/src/resolvers/type/product-search-result-types.ts +5 -5
- package/src/resolvers/type/quotation-types.ts +11 -25
- package/src/resolvers/type/shop-types.ts +5 -7
- package/src/resolvers/type/token-types.ts +15 -32
- package/src/resolvers/type/user-types.ts +27 -39
- package/src/resolvers/type/work-types.ts +0 -2
- package/src/roles/all.ts +0 -1
- package/src/schema/types/assortment.ts +5 -5
- package/src/schema/types/country.ts +1 -1
- package/src/schema/types/delivery.ts +6 -2
- package/src/schema/types/filter.ts +3 -3
- package/src/schema/types/payment.ts +6 -2
- package/src/schema/types/price.ts +1 -1
- package/src/schema/types/product/bundle-product.ts +1 -1
- package/src/schema/types/product/configurable-product.ts +6 -6
- package/src/schema/types/product/plan-product.ts +5 -5
- package/src/schema/types/product/product.ts +4 -4
- package/src/schema/types/product/simple-product.ts +4 -4
- package/src/schema/types/product/tokenized-product.ts +5 -5
- package/src/schema/types/warehousing.ts +1 -1
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { Context } from '../../../context.js';
|
|
2
2
|
import { EnrollmentPlan as EnrollmentPlanType } from '@unchainedshop/core-enrollments';
|
|
3
|
-
import { Product } from '@unchainedshop/core-products';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
product: HelperType<Promise<Product>>;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const EnrollmentPlan: EnrollmentPlanHelperTypes = {
|
|
12
|
-
product: async (plan, _, { loaders }) => {
|
|
13
|
-
const product = await loaders.productLoader.load({
|
|
4
|
+
export const EnrollmentPlan = {
|
|
5
|
+
async product(plan: EnrollmentPlanType, _: never, { loaders }: Context) {
|
|
6
|
+
return loaders.productLoader.load({
|
|
14
7
|
productId: plan.productId,
|
|
15
8
|
});
|
|
16
|
-
return product;
|
|
17
9
|
},
|
|
18
10
|
};
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
import { Context } from '../../../context.js';
|
|
2
|
-
import {
|
|
3
|
-
import { Currency } from '@unchainedshop/core-currencies';
|
|
4
|
-
import { Enrollment as EnrollmentType, EnrollmentPlan } from '@unchainedshop/core-enrollments';
|
|
5
|
-
import { User } from '@unchainedshop/core-users';
|
|
2
|
+
import { Enrollment as EnrollmentType } from '@unchainedshop/core-enrollments';
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type EnrollmentHelperTypes = {
|
|
10
|
-
isExpired: HelperType<{ referenceDate?: Date }, boolean>;
|
|
11
|
-
plan: HelperType<never, EnrollmentPlan>;
|
|
12
|
-
user: HelperType<never, Promise<User>>;
|
|
13
|
-
country: HelperType<never, Promise<Country>>;
|
|
14
|
-
currency: HelperType<never, Promise<Currency>>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const Enrollment: EnrollmentHelperTypes = {
|
|
18
|
-
isExpired: (obj, params, { modules }) => {
|
|
4
|
+
export const Enrollment = {
|
|
5
|
+
isExpired: (obj: EnrollmentType, params: { referenceDate?: Date }, { modules }: Context) => {
|
|
19
6
|
return modules.enrollments.isExpired(obj, params);
|
|
20
7
|
},
|
|
21
8
|
|
|
22
|
-
plan: ({ quantity, productId, configuration }) => {
|
|
9
|
+
plan: ({ quantity, productId, configuration }: EnrollmentType) => {
|
|
23
10
|
return {
|
|
24
11
|
quantity,
|
|
25
12
|
productId,
|
|
@@ -27,12 +14,10 @@ export const Enrollment: EnrollmentHelperTypes = {
|
|
|
27
14
|
};
|
|
28
15
|
},
|
|
29
16
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// TODO: use loader
|
|
37
|
-
user: (obj, _, { modules }) => modules.users.findUserById(obj.userId),
|
|
17
|
+
country: async (obj: EnrollmentType, _: never, { loaders }: Context) =>
|
|
18
|
+
loaders.currencyLoader.load({ isoCode: obj.countryCode }),
|
|
19
|
+
currency: async (obj: EnrollmentType, _: never, { loaders }: Context) =>
|
|
20
|
+
loaders.currencyLoader.load({ isoCode: obj.currencyCode }),
|
|
21
|
+
user: async (obj: EnrollmentType, _: never, { loaders }: Context) =>
|
|
22
|
+
loaders.userLoader.load({ userId: obj.userId }),
|
|
38
23
|
};
|
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
import { Context } from '../../../context.js';
|
|
2
|
-
import { FilterOption as FilterOptionType
|
|
2
|
+
import { FilterOption as FilterOptionType } from '@unchainedshop/core-filters';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type FilterOptionHelperTypes = {
|
|
7
|
-
_id: HelperType<never, string>;
|
|
8
|
-
texts: HelperType<{ forceLocale?: string }, Promise<FilterText>>;
|
|
9
|
-
value: HelperType<never, string>;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const FilterOption: FilterOptionHelperTypes = {
|
|
13
|
-
_id(obj) {
|
|
4
|
+
export const FilterOption = {
|
|
5
|
+
_id(obj: FilterOptionType) {
|
|
14
6
|
return `${obj._id}:${obj.filterOption}`;
|
|
15
7
|
},
|
|
16
8
|
|
|
17
|
-
value(obj) {
|
|
9
|
+
value(obj: FilterOptionType) {
|
|
18
10
|
return obj.filterOption;
|
|
19
11
|
},
|
|
20
12
|
|
|
21
|
-
async texts(
|
|
22
|
-
|
|
13
|
+
async texts(
|
|
14
|
+
obj: FilterOptionType,
|
|
15
|
+
{ forceLocale }: { forceLocale?: string },
|
|
16
|
+
{ locale, loaders }: Context,
|
|
17
|
+
) {
|
|
23
18
|
return loaders.filterTextLoader.load({
|
|
24
19
|
filterId: obj._id,
|
|
25
20
|
filterOptionValue: obj.filterOption,
|
|
26
|
-
locale: forceLocale
|
|
21
|
+
locale: forceLocale ? new Intl.Locale(forceLocale) : locale,
|
|
27
22
|
});
|
|
28
23
|
},
|
|
29
24
|
};
|
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
import { Context } from '../../../context.js';
|
|
2
|
-
import { Filter as FilterType
|
|
2
|
+
import { Filter as FilterType } from '@unchainedshop/core-filters';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type FilterHelperTypes = {
|
|
7
|
-
options: HelperType<never, Array<FilterOption>>;
|
|
8
|
-
texts: HelperType<{ forceLocale?: string }, Promise<FilterText>>;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const Filter: FilterHelperTypes = {
|
|
12
|
-
options: (obj) => {
|
|
4
|
+
export const Filter = {
|
|
5
|
+
options: (obj: FilterType) => {
|
|
13
6
|
return (obj.options || []).map((filterOption) => ({
|
|
14
7
|
...obj,
|
|
15
8
|
filterOption,
|
|
16
9
|
}));
|
|
17
10
|
},
|
|
18
11
|
|
|
19
|
-
async texts(obj, { forceLocale },
|
|
20
|
-
const { localeContext, loaders } = requestContext;
|
|
12
|
+
async texts(obj: FilterType, { forceLocale }: { forceLocale?: string }, { locale, loaders }: Context) {
|
|
21
13
|
return loaders.filterTextLoader.load({
|
|
22
14
|
filterId: obj._id,
|
|
23
15
|
filterOptionValue: null,
|
|
24
|
-
locale: forceLocale
|
|
16
|
+
locale: forceLocale ? new Intl.Locale(forceLocale) : locale,
|
|
25
17
|
});
|
|
26
18
|
},
|
|
27
19
|
};
|
|
@@ -2,14 +2,14 @@ import { Context } from '../../../context.js';
|
|
|
2
2
|
import { Filter, SearchQuery } from '@unchainedshop/core-filters';
|
|
3
3
|
import { FilterDirector } from '@unchainedshop/core';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export interface LoadedFilterData {
|
|
6
6
|
forceLiveCollection: boolean;
|
|
7
7
|
searchQuery: SearchQuery;
|
|
8
8
|
filter: Filter;
|
|
9
9
|
examinedProductIdSet: Set<string>;
|
|
10
10
|
filteredByOtherFiltersSet: Set<string>;
|
|
11
11
|
filteredByThisFilterSet: Set<string>;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
13
|
|
|
14
14
|
export const LoadedFilter = {
|
|
15
15
|
definition: ({ filter }: LoadedFilterData) => {
|
|
@@ -7,7 +7,6 @@ export const OrderDeliveryDiscount = {
|
|
|
7
7
|
},
|
|
8
8
|
|
|
9
9
|
orderDiscount: async (obj: OrderDeliveryDiscountType, _, { modules }: Context) => {
|
|
10
|
-
// TODO: use loader
|
|
11
10
|
return modules.orders.discounts.findOrderDiscount({
|
|
12
11
|
discountId: obj.discountId,
|
|
13
12
|
});
|
|
@@ -16,7 +15,7 @@ export const OrderDeliveryDiscount = {
|
|
|
16
15
|
total(obj: OrderDeliveryDiscountType) {
|
|
17
16
|
return {
|
|
18
17
|
amount: obj.amount,
|
|
19
|
-
|
|
18
|
+
currencyCode: obj.currencyCode,
|
|
20
19
|
};
|
|
21
20
|
},
|
|
22
21
|
};
|
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
import { DeliveryDirector, DeliveryPricingSheet } from '@unchainedshop/core';
|
|
2
2
|
import { Context } from '../../../context.js';
|
|
3
|
-
import {
|
|
4
|
-
import { OrderDelivery, OrderDeliveryDiscount } from '@unchainedshop/core-orders';
|
|
3
|
+
import { OrderDelivery } from '@unchainedshop/core-orders';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export interface OrderDeliveryPickupHelperTypes {
|
|
9
|
-
activePickUpLocation: HelperType<Promise<DeliveryLocation>>;
|
|
10
|
-
discounts: HelperType<Promise<Array<OrderDeliveryDiscount>>>;
|
|
11
|
-
pickUpLocations: HelperType<Promise<Array<DeliveryLocation>>>;
|
|
12
|
-
provider: HelperType<Promise<DeliveryProvider>>;
|
|
13
|
-
status: HelperType<string>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const OrderDeliveryPickUp: OrderDeliveryPickupHelperTypes = {
|
|
17
|
-
activePickUpLocation: async (orderDelivery, _, requestContext) => {
|
|
5
|
+
export const OrderDeliveryPickUp = {
|
|
6
|
+
async activePickUpLocation(orderDelivery: OrderDelivery, _: never, requestContext: Context) {
|
|
18
7
|
const { orderPickUpLocationId } = orderDelivery.context || {};
|
|
19
8
|
|
|
20
|
-
|
|
21
|
-
const provider = await requestContext.modules.delivery.findProvider({
|
|
9
|
+
const provider = await requestContext.loaders.deliveryProviderLoader.load({
|
|
22
10
|
deliveryProviderId: orderDelivery.deliveryProviderId,
|
|
23
11
|
});
|
|
24
12
|
const director = await DeliveryDirector.actions(
|
|
@@ -30,9 +18,8 @@ export const OrderDeliveryPickUp: OrderDeliveryPickupHelperTypes = {
|
|
|
30
18
|
return director.pickUpLocationById(orderPickUpLocationId);
|
|
31
19
|
},
|
|
32
20
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const provider = await context.modules.delivery.findProvider({
|
|
21
|
+
async pickUpLocations(obj: OrderDelivery, _: never, context: Context) {
|
|
22
|
+
const provider = await context.loaders.deliveryProviderLoader.load({
|
|
36
23
|
deliveryProviderId: obj.deliveryProviderId,
|
|
37
24
|
});
|
|
38
25
|
const director = await DeliveryDirector.actions(provider, { orderDelivery: obj }, context);
|
|
@@ -40,24 +27,21 @@ export const OrderDeliveryPickUp: OrderDeliveryPickupHelperTypes = {
|
|
|
40
27
|
return director.pickUpLocations();
|
|
41
28
|
},
|
|
42
29
|
|
|
43
|
-
|
|
44
|
-
return
|
|
30
|
+
async provider(obj: OrderDelivery, _: never, { loaders }: Context) {
|
|
31
|
+
return loaders.deliveryProviderLoader.load({
|
|
45
32
|
deliveryProviderId: obj.deliveryProviderId,
|
|
46
33
|
});
|
|
47
34
|
},
|
|
48
35
|
|
|
49
|
-
status:
|
|
36
|
+
status(obj: OrderDelivery, _: never, { modules }: Context) {
|
|
50
37
|
return modules.orders.deliveries.normalizedStatus(obj);
|
|
51
38
|
},
|
|
52
39
|
|
|
53
|
-
|
|
54
|
-
const {
|
|
55
|
-
// TODO: use loader
|
|
56
|
-
const order = await modules.orders.findOrder({ orderId: obj.orderId });
|
|
57
|
-
|
|
40
|
+
async discounts(obj: OrderDelivery, _: never, { loaders }: Context) {
|
|
41
|
+
const order = await loaders.orderLoader.load({ orderId: obj.orderId });
|
|
58
42
|
const pricing = DeliveryPricingSheet({
|
|
59
43
|
calculation: obj.calculation,
|
|
60
|
-
|
|
44
|
+
currencyCode: order.currencyCode,
|
|
61
45
|
});
|
|
62
46
|
|
|
63
47
|
if (pricing.isValid()) {
|
|
@@ -1,41 +1,27 @@
|
|
|
1
1
|
import { DeliveryPricingSheet } from '@unchainedshop/core';
|
|
2
2
|
import { Context } from '../../../context.js';
|
|
3
|
-
import {
|
|
4
|
-
import { OrderDelivery, OrderDeliveryDiscount } from '@unchainedshop/core-orders';
|
|
5
|
-
import { Address } from '@unchainedshop/mongodb';
|
|
3
|
+
import { OrderDelivery } from '@unchainedshop/core-orders';
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export interface OrderDeliveryShippingHelperTypes {
|
|
10
|
-
address: HelperType<Address>;
|
|
11
|
-
discounts: HelperType<Promise<Array<OrderDeliveryDiscount>>>;
|
|
12
|
-
provider: HelperType<Promise<DeliveryProvider>>;
|
|
13
|
-
status: HelperType<string>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const OrderDeliveryShipping: OrderDeliveryShippingHelperTypes = {
|
|
17
|
-
address: (obj) => {
|
|
5
|
+
export const OrderDeliveryShipping = {
|
|
6
|
+
address(obj: OrderDelivery) {
|
|
18
7
|
return obj.context?.address;
|
|
19
8
|
},
|
|
20
9
|
|
|
21
|
-
status:
|
|
10
|
+
status(obj: OrderDelivery, _: never, { modules }: Context) {
|
|
22
11
|
return modules.orders.deliveries.normalizedStatus(obj);
|
|
23
12
|
},
|
|
24
13
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return modules.delivery.findProvider({
|
|
14
|
+
async provider(obj: OrderDelivery, _: never, { loaders }: Context) {
|
|
15
|
+
return loaders.deliveryProviderLoader.load({
|
|
28
16
|
deliveryProviderId: obj.deliveryProviderId,
|
|
29
17
|
});
|
|
30
18
|
},
|
|
31
19
|
|
|
32
|
-
|
|
33
|
-
const {
|
|
34
|
-
// TODO: use loader
|
|
35
|
-
const order = await modules.orders.findOrder({ orderId: obj.orderId });
|
|
20
|
+
async discounts(obj: OrderDelivery, _: never, { loaders }: Context) {
|
|
21
|
+
const order = await loaders.orderLoader.load({ orderId: obj.orderId });
|
|
36
22
|
const pricing = DeliveryPricingSheet({
|
|
37
23
|
calculation: obj.calculation,
|
|
38
|
-
|
|
24
|
+
currencyCode: order.currencyCode,
|
|
39
25
|
});
|
|
40
26
|
if (pricing.isValid()) {
|
|
41
27
|
// IMPORTANT: Do not send any parameter to obj.discounts!
|
|
@@ -9,9 +9,8 @@ const OrderDeliveryMap = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export const OrderDelivery = {
|
|
12
|
-
__resolveType: async (obj: OrderDeliveryType, {
|
|
13
|
-
|
|
14
|
-
const provider = await modules.delivery.findProvider({
|
|
12
|
+
__resolveType: async (obj: OrderDeliveryType, { loaders }: Context) => {
|
|
13
|
+
const provider = await loaders.deliveryProviderLoader.load({
|
|
15
14
|
deliveryProviderId: obj.deliveryProviderId,
|
|
16
15
|
});
|
|
17
16
|
|
|
@@ -1,29 +1,9 @@
|
|
|
1
|
-
import { Price } from '@unchainedshop/utils';
|
|
2
1
|
import { Context } from '../../../context.js';
|
|
3
|
-
import {
|
|
4
|
-
import { OrderDiscountDirector
|
|
2
|
+
import { OrderDiscount as OrderDiscountType } from '@unchainedshop/core-orders';
|
|
3
|
+
import { OrderDiscountDirector } from '@unchainedshop/core';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export interface OrderDiscountHelperTypes {
|
|
9
|
-
interface: HelperType<
|
|
10
|
-
never,
|
|
11
|
-
Promise<{
|
|
12
|
-
_id: string;
|
|
13
|
-
label: string;
|
|
14
|
-
version: string;
|
|
15
|
-
isManualAdditionAllowed: boolean;
|
|
16
|
-
isManualRemovalAllowed: boolean;
|
|
17
|
-
}>
|
|
18
|
-
>;
|
|
19
|
-
|
|
20
|
-
discounted: HelperType<never, Promise<Array<OrderPricingDiscount>>>;
|
|
21
|
-
order: HelperType<never, Promise<Order>>;
|
|
22
|
-
total: HelperType<never, Promise<Price>>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const OrderDiscount: OrderDiscountHelperTypes = {
|
|
26
|
-
interface: async (obj) => {
|
|
5
|
+
export const OrderDiscount = {
|
|
6
|
+
async interface(obj: OrderDiscountType) {
|
|
27
7
|
const Interface = OrderDiscountDirector.getAdapter(obj.discountKey);
|
|
28
8
|
if (!Interface) return null;
|
|
29
9
|
|
|
@@ -36,24 +16,17 @@ export const OrderDiscount: OrderDiscountHelperTypes = {
|
|
|
36
16
|
};
|
|
37
17
|
},
|
|
38
18
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return modules.orders.findOrder({ orderId: obj.orderId });
|
|
19
|
+
async order(obj: OrderDiscountType, _: never, { loaders }: Context) {
|
|
20
|
+
return loaders.orderLoader.load({ orderId: obj.orderId });
|
|
42
21
|
},
|
|
43
22
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
orderId: obj.orderId,
|
|
48
|
-
});
|
|
49
|
-
return context.services.orders.calculateDiscountTotal(order, obj);
|
|
23
|
+
async total(obj: OrderDiscountType, _: never, { loaders, services }: Context) {
|
|
24
|
+
const order = await loaders.orderLoader.load({ orderId: obj.orderId });
|
|
25
|
+
return services.orders.calculateDiscountTotal(order, obj);
|
|
50
26
|
},
|
|
51
27
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
orderId: obj.orderId,
|
|
56
|
-
});
|
|
57
|
-
return context.services.orders.discountedEntities(order, obj);
|
|
28
|
+
async discounted(obj: OrderDiscountType, _: never, { loaders, services }: Context) {
|
|
29
|
+
const order = await loaders.orderLoader.load({ orderId: obj.orderId });
|
|
30
|
+
return services.orders.discountedEntities(order, obj);
|
|
58
31
|
},
|
|
59
32
|
};
|
|
@@ -20,7 +20,6 @@ export const OrderGlobalDiscount = {
|
|
|
20
20
|
_,
|
|
21
21
|
{ modules }: Context,
|
|
22
22
|
) => {
|
|
23
|
-
// TODO: use loader
|
|
24
23
|
return modules.orders.discounts.findOrderDiscount({
|
|
25
24
|
discountId: obj.discountId,
|
|
26
25
|
});
|
|
@@ -34,7 +33,7 @@ export const OrderGlobalDiscount = {
|
|
|
34
33
|
) {
|
|
35
34
|
return {
|
|
36
35
|
amount: obj.amount,
|
|
37
|
-
|
|
36
|
+
currencyCode: obj.currencyCode,
|
|
38
37
|
};
|
|
39
38
|
},
|
|
40
39
|
};
|
|
@@ -7,7 +7,6 @@ export const OrderItemDiscount = {
|
|
|
7
7
|
},
|
|
8
8
|
|
|
9
9
|
orderDiscount: async (obj: OrderPositionDiscount, _, { modules }: Context) => {
|
|
10
|
-
// TODO: use loader
|
|
11
10
|
return modules.orders.discounts.findOrderDiscount({
|
|
12
11
|
discountId: obj.discountId,
|
|
13
12
|
});
|
|
@@ -16,7 +15,7 @@ export const OrderItemDiscount = {
|
|
|
16
15
|
total(obj: OrderPositionDiscount) {
|
|
17
16
|
return {
|
|
18
17
|
amount: obj.amount,
|
|
19
|
-
|
|
18
|
+
currencyCode: obj.currencyCode,
|
|
20
19
|
};
|
|
21
20
|
},
|
|
22
21
|
};
|
|
@@ -8,26 +8,19 @@ import { TokenSurrogate, WarehousingProvider } from '@unchainedshop/core-warehou
|
|
|
8
8
|
import { Price } from '@unchainedshop/utils';
|
|
9
9
|
import { ProductPricingSheet } from '@unchainedshop/core';
|
|
10
10
|
|
|
11
|
-
const getPricingSheet = async (orderPosition: OrderPosition,
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
// TODO: use loader
|
|
15
|
-
const order = await modules.orders.findOrder({
|
|
11
|
+
const getPricingSheet = async (orderPosition: OrderPosition, { loaders }: Context) => {
|
|
12
|
+
const order = await loaders.orderLoader.load({
|
|
16
13
|
orderId: orderPosition.orderId,
|
|
17
14
|
});
|
|
18
15
|
return ProductPricingSheet({
|
|
19
16
|
calculation: orderPosition.calculation,
|
|
20
|
-
|
|
17
|
+
currencyCode: order.currencyCode,
|
|
21
18
|
quantity: orderPosition.quantity,
|
|
22
19
|
});
|
|
23
20
|
};
|
|
24
21
|
|
|
25
22
|
export const OrderItem = {
|
|
26
|
-
async discounts(
|
|
27
|
-
orderPosition: OrderPosition,
|
|
28
|
-
_,
|
|
29
|
-
context: Context,
|
|
30
|
-
): Promise<Array<OrderPositionDiscount>> {
|
|
23
|
+
async discounts(orderPosition: OrderPosition, _, context: Context): Promise<OrderPositionDiscount[]> {
|
|
31
24
|
const pricing = await getPricingSheet(orderPosition, context);
|
|
32
25
|
|
|
33
26
|
if (pricing.isValid()) {
|
|
@@ -42,29 +35,28 @@ export const OrderItem = {
|
|
|
42
35
|
|
|
43
36
|
async dispatches(
|
|
44
37
|
orderPosition: OrderPosition,
|
|
45
|
-
_,
|
|
38
|
+
_: never,
|
|
46
39
|
{ modules, loaders }: Context,
|
|
47
40
|
): Promise<
|
|
48
|
-
|
|
41
|
+
{
|
|
49
42
|
_id: string;
|
|
50
43
|
deliveryProvider: DeliveryProvider;
|
|
51
44
|
warehousingProvider: WarehousingProvider;
|
|
52
45
|
shipping: Date;
|
|
53
46
|
earliestDelivery: Date;
|
|
54
|
-
}
|
|
47
|
+
}[]
|
|
55
48
|
> {
|
|
56
49
|
const scheduling = orderPosition.scheduling || [];
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
const order = await loaders.orderLoader.load({
|
|
51
|
+
orderId: orderPosition.orderId,
|
|
52
|
+
});
|
|
59
53
|
const { countryCode, userId } = order;
|
|
60
54
|
|
|
61
|
-
// TODO: use loader
|
|
62
55
|
const orderDelivery = await modules.orders.deliveries.findDelivery({
|
|
63
56
|
orderDeliveryId: order.deliveryId,
|
|
64
57
|
});
|
|
65
58
|
|
|
66
|
-
|
|
67
|
-
const deliveryProvider = await modules.delivery.findProvider({
|
|
59
|
+
const deliveryProvider = await loaders.deliveryProviderLoader.load({
|
|
68
60
|
deliveryProviderId: orderDelivery.deliveryProviderId,
|
|
69
61
|
});
|
|
70
62
|
const product = await loaders.productLoader.load({
|
|
@@ -73,7 +65,7 @@ export const OrderItem = {
|
|
|
73
65
|
|
|
74
66
|
return Promise.all(
|
|
75
67
|
scheduling.map(async (schedule) => {
|
|
76
|
-
// TODO: use loader
|
|
68
|
+
// TODO: use warehousing provider loader
|
|
77
69
|
const warehousingProvider = await modules.warehousing.findProvider({
|
|
78
70
|
warehousingProviderId: schedule.warehousingProviderId,
|
|
79
71
|
});
|
|
@@ -83,7 +75,7 @@ export const OrderItem = {
|
|
|
83
75
|
deliveryProvider,
|
|
84
76
|
product,
|
|
85
77
|
quantity: orderPosition.quantity,
|
|
86
|
-
|
|
78
|
+
countryCode,
|
|
87
79
|
userId,
|
|
88
80
|
// referenceDate,
|
|
89
81
|
};
|
|
@@ -95,9 +87,10 @@ export const OrderItem = {
|
|
|
95
87
|
);
|
|
96
88
|
},
|
|
97
89
|
|
|
98
|
-
async order(orderPosition: OrderPosition, _, {
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
async order(orderPosition: OrderPosition, _, { loaders }: Context): Promise<Order> {
|
|
91
|
+
return loaders.orderLoader.load({
|
|
92
|
+
orderId: orderPosition.orderId,
|
|
93
|
+
});
|
|
101
94
|
},
|
|
102
95
|
|
|
103
96
|
async originalProduct(orderPosition: OrderPosition, _, { loaders }: Context): Promise<Product> {
|
|
@@ -116,7 +109,7 @@ export const OrderItem = {
|
|
|
116
109
|
|
|
117
110
|
async quotation(orderPosition: OrderPosition, _, { modules }: Context): Promise<Quotation> {
|
|
118
111
|
if (!orderPosition.quotationId) return null;
|
|
119
|
-
// TODO: use loader
|
|
112
|
+
// TODO: use quotation loader
|
|
120
113
|
return modules.quotations.findQuotation({ quotationId: orderPosition.quotationId });
|
|
121
114
|
},
|
|
122
115
|
|
|
@@ -150,8 +143,7 @@ export const OrderItem = {
|
|
|
150
143
|
orderPosition: OrderPosition,
|
|
151
144
|
params: never,
|
|
152
145
|
{ modules }: Context,
|
|
153
|
-
): Promise<
|
|
154
|
-
// TODO: use loader?
|
|
146
|
+
): Promise<TokenSurrogate[]> {
|
|
155
147
|
return modules.warehousing.findTokens({
|
|
156
148
|
orderPositionId: orderPosition._id,
|
|
157
149
|
});
|
|
@@ -1,36 +1,23 @@
|
|
|
1
1
|
import { PaymentPricingSheet } from '@unchainedshop/core';
|
|
2
2
|
import { Context } from '../../../context.js';
|
|
3
|
-
import { OrderPayment
|
|
4
|
-
import { PaymentProvider } from '@unchainedshop/core-payment';
|
|
3
|
+
import { OrderPayment } from '@unchainedshop/core-orders';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export interface OrderPaymentCardHelperTypes {
|
|
9
|
-
discounts: HelperType<Promise<Array<OrderPaymentDiscount>>>;
|
|
10
|
-
provider: HelperType<Promise<PaymentProvider>>;
|
|
11
|
-
status: HelperType<string>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const OrderPaymentCard: OrderPaymentCardHelperTypes = {
|
|
15
|
-
status: (obj, _, { modules }) => {
|
|
5
|
+
export const OrderPaymentCard = {
|
|
6
|
+
status(obj: OrderPayment, _: never, { modules }: Context) {
|
|
16
7
|
return modules.orders.payments.normalizedStatus(obj);
|
|
17
8
|
},
|
|
18
9
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return modules.payment.paymentProviders.findProvider({
|
|
10
|
+
async provider(obj: OrderPayment, _: never, { loaders }: Context) {
|
|
11
|
+
return loaders.paymentProviderLoader.load({
|
|
22
12
|
paymentProviderId: obj.paymentProviderId,
|
|
23
13
|
});
|
|
24
14
|
},
|
|
25
15
|
|
|
26
|
-
|
|
27
|
-
const {
|
|
28
|
-
|
|
29
|
-
// TODO: use loader
|
|
30
|
-
const order = await modules.orders.findOrder({ orderId: obj.orderId });
|
|
16
|
+
async discounts(obj: OrderPayment, _: never, { loaders }: Context) {
|
|
17
|
+
const order = await loaders.orderLoader.load({ orderId: obj.orderId });
|
|
31
18
|
const pricing = PaymentPricingSheet({
|
|
32
19
|
calculation: obj.calculation,
|
|
33
|
-
|
|
20
|
+
currencyCode: order.currencyCode,
|
|
34
21
|
});
|
|
35
22
|
if (pricing.isValid()) {
|
|
36
23
|
// IMPORTANT: Do not send any parameter to obj.discounts!
|
|
@@ -11,7 +11,6 @@ export const OrderPaymentDiscount = {
|
|
|
11
11
|
_,
|
|
12
12
|
{ modules }: Context,
|
|
13
13
|
) =>
|
|
14
|
-
// TODO: use loader
|
|
15
14
|
modules.orders.discounts.findOrderDiscount({
|
|
16
15
|
discountId: orderDelivery.discountId,
|
|
17
16
|
}),
|
|
@@ -19,7 +18,7 @@ export const OrderPaymentDiscount = {
|
|
|
19
18
|
total(orderDelivery: Price & { discountId: string; item: OrderPayment }) {
|
|
20
19
|
return {
|
|
21
20
|
amount: orderDelivery.amount,
|
|
22
|
-
|
|
21
|
+
currencyCode: orderDelivery.currencyCode,
|
|
23
22
|
};
|
|
24
23
|
},
|
|
25
24
|
};
|
|
@@ -1,35 +1,23 @@
|
|
|
1
1
|
import { PaymentPricingSheet } from '@unchainedshop/core';
|
|
2
|
+
import { OrderPayment } from '@unchainedshop/core-orders';
|
|
2
3
|
import { Context } from '../../../context.js';
|
|
3
|
-
import { OrderPayment, OrderPaymentDiscount } from '@unchainedshop/core-orders';
|
|
4
|
-
import { PaymentProvider } from '@unchainedshop/core-payment';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export interface OrderPaymentGenericHelperTypes {
|
|
9
|
-
discounts: HelperType<never, Promise<Array<OrderPaymentDiscount>>>;
|
|
10
|
-
provider: HelperType<never, Promise<PaymentProvider>>;
|
|
11
|
-
status: HelperType<never, string>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const OrderPaymentGeneric: OrderPaymentGenericHelperTypes = {
|
|
15
|
-
status: (obj, _, { modules }) => {
|
|
5
|
+
export const OrderPaymentGeneric = {
|
|
6
|
+
status(obj: OrderPayment, _: never, { modules }: Context) {
|
|
16
7
|
return modules.orders.payments.normalizedStatus(obj);
|
|
17
8
|
},
|
|
18
9
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return modules.payment.paymentProviders.findProvider({
|
|
10
|
+
async provider(obj: OrderPayment, _: never, { loaders }: Context) {
|
|
11
|
+
return loaders.paymentProviderLoader.load({
|
|
22
12
|
paymentProviderId: obj.paymentProviderId,
|
|
23
13
|
});
|
|
24
14
|
},
|
|
25
15
|
|
|
26
|
-
|
|
27
|
-
const {
|
|
28
|
-
// TODO: use loader
|
|
29
|
-
const order = await modules.orders.findOrder({ orderId: obj.orderId });
|
|
16
|
+
async discounts(obj: OrderPayment, _: never, { loaders }: Context) {
|
|
17
|
+
const order = await loaders.orderLoader.load({ orderId: obj.orderId });
|
|
30
18
|
const pricing = PaymentPricingSheet({
|
|
31
19
|
calculation: obj.calculation,
|
|
32
|
-
|
|
20
|
+
currencyCode: order.currencyCode,
|
|
33
21
|
});
|
|
34
22
|
if (pricing.isValid()) {
|
|
35
23
|
// IMPORTANT: Do not send any parameter to obj.discounts!
|