@unchainedshop/api 3.1.10 → 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/mutation.js +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/mutation.ts +1 -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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import DataLoader from 'dataloader';
|
|
3
|
+
import { buildLocaleMap } from './utils.js';
|
|
4
|
+
import { ProductText } from '@unchainedshop/core-products';
|
|
5
|
+
import buildTextMap from './buildTextMap.js';
|
|
6
|
+
|
|
7
|
+
export default (unchainedAPI: UnchainedCore) =>
|
|
8
|
+
new DataLoader<{ productId: string; locale: Intl.Locale }, ProductText>(async (queries) => {
|
|
9
|
+
const productIds = [...new Set(queries.map((q) => q.productId))].filter(Boolean);
|
|
10
|
+
const texts = await unchainedAPI.modules.products.texts.findTexts(
|
|
11
|
+
{ productId: { $in: productIds } },
|
|
12
|
+
{
|
|
13
|
+
sort: {
|
|
14
|
+
productId: 1,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
);
|
|
18
|
+
const localeMap = buildLocaleMap(queries, texts);
|
|
19
|
+
const textsMap = buildTextMap(localeMap, texts, (text) => text.productId);
|
|
20
|
+
|
|
21
|
+
return queries.map((q) => textsMap[q.locale + q.productId]);
|
|
22
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { User } from '@unchainedshop/core-users';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
|
|
5
|
+
export default (unchainedAPI: UnchainedCore) =>
|
|
6
|
+
new DataLoader<{ userId: string }, User>(async (queries) => {
|
|
7
|
+
const userIds = [...new Set(queries.map((q) => q.userId).filter(Boolean))];
|
|
8
|
+
|
|
9
|
+
// It's important to also fetch deleted with the loader,
|
|
10
|
+
// because the loader fetches entities by id.
|
|
11
|
+
const users = await unchainedAPI.modules.users.findUsers({
|
|
12
|
+
includeGuests: true,
|
|
13
|
+
includeDeleted: true,
|
|
14
|
+
_id: { $in: userIds },
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const userMap = {};
|
|
18
|
+
for (const user of users) {
|
|
19
|
+
userMap[user._id] = user;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return queries.map((q) => userMap[q.userId]);
|
|
23
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { systemLocale } from '@unchainedshop/utils';
|
|
2
|
+
|
|
3
|
+
export function getLocaleStrings(locale: Intl.Locale) {
|
|
4
|
+
try {
|
|
5
|
+
return [
|
|
6
|
+
...new Set([locale.baseName, locale.language, systemLocale.baseName, systemLocale.language]),
|
|
7
|
+
];
|
|
8
|
+
} catch {
|
|
9
|
+
return [...new Set([systemLocale.baseName, systemLocale.language])];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function buildLocaleMap(
|
|
14
|
+
queries: readonly { locale: Intl.Locale }[],
|
|
15
|
+
texts: readonly { locale?: string }[],
|
|
16
|
+
): Record<string, string[]> {
|
|
17
|
+
// key = texts.locale
|
|
18
|
+
// value = input query locale
|
|
19
|
+
|
|
20
|
+
const queryLocales = Object.values(
|
|
21
|
+
Object.fromEntries(queries.map((q) => [q.locale.baseName, q.locale])),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const textLocales: string[] = [...new Set(texts.map((t) => t.locale))];
|
|
25
|
+
const localeMap = {};
|
|
26
|
+
for (const queryLocale of queryLocales) {
|
|
27
|
+
const potentialMatches = getLocaleStrings(queryLocale);
|
|
28
|
+
const matches = potentialMatches.filter((l) => textLocales.includes(l));
|
|
29
|
+
for (const match of matches) {
|
|
30
|
+
if (!localeMap[match]) localeMap[match] = [];
|
|
31
|
+
localeMap[match].push(queryLocale);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return localeMap;
|
|
35
|
+
}
|
package/src/locale-context.ts
CHANGED
|
@@ -12,15 +12,13 @@ import { createLogger } from '@unchainedshop/logger';
|
|
|
12
12
|
const logger = createLogger('unchained:api');
|
|
13
13
|
|
|
14
14
|
export interface UnchainedLocaleContext {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
countryCode: string;
|
|
16
|
+
locale: Intl.Locale;
|
|
17
|
+
currencyCode: string;
|
|
18
18
|
}
|
|
19
|
-
const { NODE_ENV } = process.env;
|
|
20
|
-
|
|
21
19
|
export type GetHeaderFn = (key: string) => string | string[];
|
|
22
20
|
|
|
23
|
-
const memoizeCache = new ExpiryMap(NODE_ENV === 'production' ? 1000 * 60 :
|
|
21
|
+
const memoizeCache = new ExpiryMap(process.env.NODE_ENV === 'production' ? 1000 * 60 : 1); // Cached values expire after 10 seconds
|
|
24
22
|
|
|
25
23
|
export const resolveDefaultContext = pMemoize(
|
|
26
24
|
async ({ acceptLang, acceptCountry }, unchainedAPI) => {
|
|
@@ -36,31 +34,27 @@ export const resolveDefaultContext = pMemoize(
|
|
|
36
34
|
|
|
37
35
|
const currencies = await unchainedAPI.modules.currencies.findCurrencies({ includeInactive: false });
|
|
38
36
|
|
|
39
|
-
const
|
|
37
|
+
const defaultCurrencyCodes = Object.fromEntries(
|
|
38
|
+
countries.map((c) => [c.isoCode, c.defaultCurrencyCode]),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const supportedLocaleStrings: string[] = languages.reduce((accumulator, language) => {
|
|
40
42
|
const added = countries.map((country) => {
|
|
41
43
|
return `${language.isoCode}-${country.isoCode}`;
|
|
42
44
|
});
|
|
43
45
|
return accumulator.concat(added);
|
|
44
46
|
}, []);
|
|
45
47
|
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
systemLocale.baseName,
|
|
50
|
-
);
|
|
51
|
-
const countryContext = resolveBestCountry(localeContext.region, acceptCountry, countries);
|
|
52
|
-
|
|
53
|
-
const countryObject = countries.find((country) => country.isoCode === countryContext);
|
|
54
|
-
const currencyContext = resolveBestCurrency(countryObject.defaultCurrencyCode, currencies);
|
|
48
|
+
const locale = resolveBestSupported(acceptLang, supportedLocaleStrings, systemLocale.baseName);
|
|
49
|
+
const countryCode = resolveBestCountry(locale.region, acceptCountry, countries);
|
|
50
|
+
const currencyCode = resolveBestCurrency(defaultCurrencyCodes[countryCode], currencies);
|
|
55
51
|
|
|
56
|
-
logger.debug(
|
|
57
|
-
`Locale Context: Resolved ${localeContext.baseName} ${countryContext} ${currencyContext}`,
|
|
58
|
-
);
|
|
52
|
+
logger.debug(`Locale Context: Resolved ${locale.baseName} ${countryCode} ${currencyCode}`);
|
|
59
53
|
|
|
60
54
|
const newContext: UnchainedLocaleContext = {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
locale,
|
|
56
|
+
countryCode,
|
|
57
|
+
currencyCode,
|
|
64
58
|
};
|
|
65
59
|
|
|
66
60
|
return newContext;
|
|
@@ -32,17 +32,15 @@ export default async function createUser(root: never, params: UserRegistrationDa
|
|
|
32
32
|
{},
|
|
33
33
|
);
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
user = await context.modules.users.updateHeartbeat(user._id, {
|
|
35
|
+
const user = await context.modules.users.updateHeartbeat(newUserId, {
|
|
38
36
|
remoteAddress: context.remoteAddress,
|
|
39
37
|
remotePort: context.remotePort,
|
|
40
38
|
userAgent: context.getHeader('user-agent'),
|
|
41
|
-
locale: context.
|
|
42
|
-
countryCode: context.
|
|
39
|
+
locale: context.locale.baseName,
|
|
40
|
+
countryCode: context.countryCode,
|
|
43
41
|
});
|
|
44
42
|
|
|
45
|
-
await context.services.orders.nextUserCart({ user, countryCode: context.
|
|
43
|
+
await context.services.orders.nextUserCart({ user, countryCode: context.countryCode });
|
|
46
44
|
|
|
47
45
|
return context.login(user);
|
|
48
46
|
} catch (e) {
|
|
@@ -17,7 +17,7 @@ const impersonate = async (root, { userId }, context: Context) => {
|
|
|
17
17
|
|
|
18
18
|
await context.services.orders.nextUserCart({
|
|
19
19
|
user: userToImpersonate,
|
|
20
|
-
countryCode: context.
|
|
20
|
+
countryCode: context.countryCode,
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
return context.login(userToImpersonate, {
|
|
@@ -17,17 +17,15 @@ export default async function loginAsGuest(root: never, _: any, context: Context
|
|
|
17
17
|
{ skipMessaging: true },
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
user = await context.modules.users.updateHeartbeat(user._id, {
|
|
20
|
+
const user = await context.modules.users.updateHeartbeat(guestUserId, {
|
|
23
21
|
remoteAddress: context.remoteAddress,
|
|
24
22
|
remotePort: context.remotePort,
|
|
25
23
|
userAgent: context.getHeader('user-agent'),
|
|
26
|
-
locale: context.
|
|
27
|
-
countryCode: context.
|
|
24
|
+
locale: context.locale.baseName,
|
|
25
|
+
countryCode: context.countryCode,
|
|
28
26
|
});
|
|
29
27
|
|
|
30
|
-
await context.services.orders.nextUserCart({ user, countryCode: context.
|
|
28
|
+
await context.services.orders.nextUserCart({ user, countryCode: context.countryCode });
|
|
31
29
|
|
|
32
30
|
return context.login(user);
|
|
33
31
|
}
|
|
@@ -36,15 +36,15 @@ export default async function loginWithPassword(
|
|
|
36
36
|
remoteAddress: context.remoteAddress,
|
|
37
37
|
remotePort: context.remotePort,
|
|
38
38
|
userAgent: context.getHeader('user-agent'),
|
|
39
|
-
locale: context.
|
|
40
|
-
countryCode: context.
|
|
39
|
+
locale: context.locale.baseName,
|
|
40
|
+
countryCode: context.countryCode,
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
if (context.userId) {
|
|
44
44
|
await context.services.users.migrateUserData(context.userId, user._id);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
await context.services.orders.nextUserCart({ user, countryCode: context.
|
|
47
|
+
await context.services.orders.nextUserCart({ user, countryCode: context.countryCode });
|
|
48
48
|
|
|
49
49
|
return context.login(user);
|
|
50
50
|
}
|
|
@@ -29,15 +29,15 @@ export default async function loginWithWebAuthn(
|
|
|
29
29
|
remoteAddress: context.remoteAddress,
|
|
30
30
|
remotePort: context.remotePort,
|
|
31
31
|
userAgent: context.getHeader('user-agent'),
|
|
32
|
-
locale: context.
|
|
33
|
-
countryCode: context.
|
|
32
|
+
locale: context.locale.baseName,
|
|
33
|
+
countryCode: context.countryCode,
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
if (context.userId) {
|
|
37
37
|
await context.services.users.migrateUserData(context.userId, user._id);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
await context.services.orders.nextUserCart({ user, countryCode: context.
|
|
40
|
+
await context.services.orders.nextUserCart({ user, countryCode: context.countryCode });
|
|
41
41
|
|
|
42
42
|
return context.login(user);
|
|
43
43
|
}
|
|
@@ -19,15 +19,15 @@ export default async function resetPassword(
|
|
|
19
19
|
remoteAddress: context.remoteAddress,
|
|
20
20
|
remotePort: context.remotePort,
|
|
21
21
|
userAgent: context.getHeader('user-agent'),
|
|
22
|
-
locale: context.
|
|
23
|
-
countryCode: context.
|
|
22
|
+
locale: context.locale.baseName,
|
|
23
|
+
countryCode: context.countryCode,
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
if (context.userId) {
|
|
27
27
|
await context.services.users.migrateUserData(context.userId, user._id);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
await context.services.orders.nextUserCart({ user, countryCode: context.
|
|
30
|
+
await context.services.orders.nextUserCart({ user, countryCode: context.countryCode });
|
|
31
31
|
|
|
32
32
|
return context.login(user);
|
|
33
33
|
} catch (e) {
|
|
@@ -17,7 +17,7 @@ export default async function stopImpersonation(root: never, _, context: Context
|
|
|
17
17
|
|
|
18
18
|
await context.services.orders.nextUserCart({
|
|
19
19
|
user: impersonator,
|
|
20
|
-
countryCode: context.
|
|
20
|
+
countryCode: context.countryCode,
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
return context.login(impersonator);
|
|
@@ -19,15 +19,15 @@ export default async function verifyEmail(root: never, { token }: { token: any }
|
|
|
19
19
|
remoteAddress: context.remoteAddress,
|
|
20
20
|
remotePort: context.remotePort,
|
|
21
21
|
userAgent: context.getHeader('user-agent'),
|
|
22
|
-
locale: context.
|
|
23
|
-
countryCode: context.
|
|
22
|
+
locale: context.locale.baseName,
|
|
23
|
+
countryCode: context.countryCode,
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
if (context.userId) {
|
|
27
27
|
await context.services.users.migrateUserData(context.userId, user._id);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
await context.services.orders.nextUserCart({ user, countryCode: context.
|
|
30
|
+
await context.services.orders.nextUserCart({ user, countryCode: context.countryCode });
|
|
31
31
|
|
|
32
32
|
return context.login(user);
|
|
33
33
|
}
|
|
@@ -3,7 +3,7 @@ import { Context } from '../../../context.js';
|
|
|
3
3
|
|
|
4
4
|
export default async function reorderAssortmentFilters(
|
|
5
5
|
root: never,
|
|
6
|
-
params: { sortKeys:
|
|
6
|
+
params: { sortKeys: { assortmentFilterId: string; sortKey: number }[] },
|
|
7
7
|
{ modules, userId }: Context,
|
|
8
8
|
) {
|
|
9
9
|
log('mutation reorderAssortmentFilters', { userId });
|
|
@@ -3,7 +3,7 @@ import { Context } from '../../../context.js';
|
|
|
3
3
|
|
|
4
4
|
export default async function reorderAssortmentLinks(
|
|
5
5
|
root: never,
|
|
6
|
-
params: { sortKeys:
|
|
6
|
+
params: { sortKeys: { assortmentLinkId: string; sortKey: number }[] },
|
|
7
7
|
{ modules, userId }: Context,
|
|
8
8
|
) {
|
|
9
9
|
log('mutation reorderAssortmentLinks', { userId });
|
|
@@ -3,7 +3,7 @@ import { Context } from '../../../context.js';
|
|
|
3
3
|
|
|
4
4
|
export default async function reorderAssortmentMedia(
|
|
5
5
|
root: never,
|
|
6
|
-
params: { sortKeys:
|
|
6
|
+
params: { sortKeys: { assortmentMediaId: string; sortKey: number }[] },
|
|
7
7
|
{ modules, userId }: Context,
|
|
8
8
|
) {
|
|
9
9
|
log('mutation reorderAssortmentMedia', { userId });
|
|
@@ -3,7 +3,7 @@ import { Context } from '../../../context.js';
|
|
|
3
3
|
|
|
4
4
|
export default async function reorderAssortmentProducts(
|
|
5
5
|
root: never,
|
|
6
|
-
params: { sortKeys:
|
|
6
|
+
params: { sortKeys: { assortmentProductId: string; sortKey: number }[] },
|
|
7
7
|
{ modules, userId }: Context,
|
|
8
8
|
) {
|
|
9
9
|
log('mutation reorderAssortmentProducts', { userId });
|
|
@@ -5,7 +5,7 @@ import { Context } from '../../../context.js';
|
|
|
5
5
|
|
|
6
6
|
export default async function updateAssortmentMediaTexts(
|
|
7
7
|
root: never,
|
|
8
|
-
{ texts, assortmentMediaId }: { texts:
|
|
8
|
+
{ texts, assortmentMediaId }: { texts: AssortmentMediaText[]; assortmentMediaId: string },
|
|
9
9
|
{ modules, userId }: Context,
|
|
10
10
|
) {
|
|
11
11
|
log(`mutation updateAssortmentMediaTexts ${assortmentMediaId}`, {
|
|
@@ -5,7 +5,7 @@ import { Context } from '../../../context.js';
|
|
|
5
5
|
|
|
6
6
|
export default async function updateAssortmentTexts(
|
|
7
7
|
root: never,
|
|
8
|
-
{ texts, assortmentId }: { texts:
|
|
8
|
+
{ texts, assortmentId }: { texts: AssortmentText[]; assortmentId: string },
|
|
9
9
|
{ modules, userId }: Context,
|
|
10
10
|
) {
|
|
11
11
|
log(`mutation updateAssortmentTexts ${assortmentId}`, { userId });
|
|
@@ -13,7 +13,7 @@ export default async function createEnrollment(
|
|
|
13
13
|
{ contact, plan, billingAddress, payment, delivery, meta },
|
|
14
14
|
context: Context,
|
|
15
15
|
) {
|
|
16
|
-
const {
|
|
16
|
+
const { countryCode, currencyCode, modules, services, userId } = context;
|
|
17
17
|
|
|
18
18
|
log('mutation createEnrollment', { userId });
|
|
19
19
|
|
|
@@ -38,8 +38,8 @@ export default async function createEnrollment(
|
|
|
38
38
|
billingAddress,
|
|
39
39
|
configuration,
|
|
40
40
|
contact,
|
|
41
|
-
countryCode
|
|
42
|
-
currencyCode
|
|
41
|
+
countryCode,
|
|
42
|
+
currencyCode,
|
|
43
43
|
delivery,
|
|
44
44
|
meta,
|
|
45
45
|
payment,
|
|
@@ -5,7 +5,7 @@ import { EnrollmentPlan, Enrollment } from '@unchainedshop/core-enrollments';
|
|
|
5
5
|
import { EnrollmentNotFoundError, EnrollmentWrongStatusError, InvalidIdError } from '../../../errors.js';
|
|
6
6
|
import { Address, Contact } from '@unchainedshop/mongodb';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
interface UpdateEnrollmentParams {
|
|
9
9
|
enrollmentId: string;
|
|
10
10
|
contact?: Contact;
|
|
11
11
|
plan: EnrollmentPlan;
|
|
@@ -13,7 +13,7 @@ type UpdateEnrollmentParams = {
|
|
|
13
13
|
payment?: Enrollment['payment'];
|
|
14
14
|
delivery?: Enrollment['delivery'];
|
|
15
15
|
meta?: any;
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
17
|
export default async function updateEnrollment(
|
|
18
18
|
root: never,
|
|
19
19
|
params: UpdateEnrollmentParams,
|
|
@@ -8,14 +8,10 @@ export default async function createFilter(
|
|
|
8
8
|
{ filter, texts }: { filter: Filter; texts: FilterInputText[] },
|
|
9
9
|
context: Context,
|
|
10
10
|
) {
|
|
11
|
-
const { modules,
|
|
11
|
+
const { modules, userId } = context;
|
|
12
12
|
log('mutation createFilter', { userId });
|
|
13
13
|
|
|
14
|
-
const newFilter = await modules.filters.create(
|
|
15
|
-
...filter,
|
|
16
|
-
title: '',
|
|
17
|
-
locale: localeContext.language,
|
|
18
|
-
});
|
|
14
|
+
const newFilter = await modules.filters.create(filter);
|
|
19
15
|
|
|
20
16
|
await FilterDirector.invalidateProductIdCache(newFilter, context);
|
|
21
17
|
|
|
@@ -5,7 +5,7 @@ import { Context } from '../../../context.js';
|
|
|
5
5
|
export default async function updateFilterTexts(
|
|
6
6
|
root: never,
|
|
7
7
|
params: {
|
|
8
|
-
texts:
|
|
8
|
+
texts: { locale: string; title?: string; subtitle?: string }[];
|
|
9
9
|
filterId: string;
|
|
10
10
|
filterOptionValue?: string;
|
|
11
11
|
},
|
|
@@ -19,7 +19,7 @@ export default async function addCartDiscount(
|
|
|
19
19
|
const order = await services.orders.findOrInitCart({
|
|
20
20
|
orderId,
|
|
21
21
|
user,
|
|
22
|
-
countryCode: context.
|
|
22
|
+
countryCode: context.countryCode,
|
|
23
23
|
});
|
|
24
24
|
if (!order) throw new OrderNotFoundError({ orderId });
|
|
25
25
|
|
|
@@ -32,7 +32,7 @@ export default async function addCartProduct(
|
|
|
32
32
|
const order = await services.orders.findOrInitCart({
|
|
33
33
|
orderId,
|
|
34
34
|
user,
|
|
35
|
-
countryCode: context.
|
|
35
|
+
countryCode: context.countryCode,
|
|
36
36
|
});
|
|
37
37
|
if (!order) throw new OrderNotFoundError({ orderId });
|
|
38
38
|
|
|
@@ -18,7 +18,7 @@ export default async function addCartQuotation(
|
|
|
18
18
|
orderId?: string;
|
|
19
19
|
quotationId: string;
|
|
20
20
|
quantity: number;
|
|
21
|
-
configuration:
|
|
21
|
+
configuration: { key: string; value: string }[];
|
|
22
22
|
},
|
|
23
23
|
context: Context,
|
|
24
24
|
) {
|
|
@@ -46,7 +46,7 @@ export default async function addCartQuotation(
|
|
|
46
46
|
const order = await services.orders.findOrInitCart({
|
|
47
47
|
orderId,
|
|
48
48
|
user,
|
|
49
|
-
countryCode: context.
|
|
49
|
+
countryCode: context.countryCode,
|
|
50
50
|
});
|
|
51
51
|
if (!order) throw new OrderNotFoundError({ orderId });
|
|
52
52
|
if (!modules.orders.isCart(order)) throw new OrderWrongStatusError({ status: order.status });
|
|
@@ -12,11 +12,11 @@ export default async function addMultipleCartProducts(
|
|
|
12
12
|
root: never,
|
|
13
13
|
params: {
|
|
14
14
|
orderId: string;
|
|
15
|
-
items:
|
|
15
|
+
items: {
|
|
16
16
|
productId: string;
|
|
17
17
|
quantity: number;
|
|
18
|
-
configuration?:
|
|
19
|
-
}
|
|
18
|
+
configuration?: { key: string; value: string }[];
|
|
19
|
+
}[];
|
|
20
20
|
},
|
|
21
21
|
context: Context,
|
|
22
22
|
) {
|
|
@@ -44,7 +44,7 @@ export default async function addMultipleCartProducts(
|
|
|
44
44
|
const order = await services.orders.findOrInitCart({
|
|
45
45
|
orderId,
|
|
46
46
|
user,
|
|
47
|
-
countryCode: context.
|
|
47
|
+
countryCode: context.countryCode,
|
|
48
48
|
});
|
|
49
49
|
if (!order) throw new OrderNotFoundError({ orderId });
|
|
50
50
|
if (!modules.orders.isCart(order)) throw new OrderWrongStatusError({ status: order.status });
|
|
@@ -22,7 +22,7 @@ export default async function checkoutCart(
|
|
|
22
22
|
const order = await services.orders.findOrInitCart({
|
|
23
23
|
orderId: forceOrderId,
|
|
24
24
|
user,
|
|
25
|
-
countryCode: context.
|
|
25
|
+
countryCode: context.countryCode,
|
|
26
26
|
});
|
|
27
27
|
if (!order) throw new OrderNotFoundError({ orderId: forceOrderId });
|
|
28
28
|
|
|
@@ -14,7 +14,7 @@ export default async function emptyCart(
|
|
|
14
14
|
const order = await services.orders.findOrInitCart({
|
|
15
15
|
orderId,
|
|
16
16
|
user,
|
|
17
|
-
countryCode: context.
|
|
17
|
+
countryCode: context.countryCode,
|
|
18
18
|
});
|
|
19
19
|
if (!order) throw new OrderNotFoundError({ orderId });
|
|
20
20
|
if (!modules.orders.isCart(order)) throw new OrderWrongStatusError({ status: order.status });
|
|
@@ -32,7 +32,7 @@ export default async function signPaymentProviderForCheckout(
|
|
|
32
32
|
if (!orderPayment) throw new OrderPaymentNotFoundError({ orderPaymentId });
|
|
33
33
|
} else {
|
|
34
34
|
const order = await modules.orders.cart({
|
|
35
|
-
countryCode: context.
|
|
35
|
+
countryCode: context.countryCode,
|
|
36
36
|
userId,
|
|
37
37
|
});
|
|
38
38
|
if (!order) throw new UserNoCartError({ userId });
|
|
@@ -22,7 +22,7 @@ export default async function updateCart(root: never, params: UpdateCartParams,
|
|
|
22
22
|
let order = await services.orders.findOrInitCart({
|
|
23
23
|
orderId,
|
|
24
24
|
user,
|
|
25
|
-
countryCode: context.
|
|
25
|
+
countryCode: context.countryCode,
|
|
26
26
|
});
|
|
27
27
|
if (!order) throw new OrderNotFoundError({ orderId });
|
|
28
28
|
if (!modules.orders.isCart(order)) throw new OrderWrongStatusError({ status: order.status });
|
|
@@ -3,14 +3,46 @@ import { ProductTypes } from '@unchainedshop/core-products';
|
|
|
3
3
|
|
|
4
4
|
import { Context } from '../../../context.js';
|
|
5
5
|
import { ProductConfiguration } from '@unchainedshop/core-products';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
ProductNotFoundError,
|
|
8
|
+
InvalidIdError,
|
|
9
|
+
ProductWrongTypeError,
|
|
10
|
+
ProductVariationVectorInvalid,
|
|
11
|
+
ProductVariationVectorAlreadySet,
|
|
12
|
+
} from '../../../errors.js';
|
|
13
|
+
const extractVariationMatrix = (variations = []) => {
|
|
14
|
+
const cartesianProduct = (arrays) => {
|
|
15
|
+
return arrays.reduce(
|
|
16
|
+
(acc, array) => acc.flatMap((item) => array.map((value) => [...item, value])),
|
|
17
|
+
[[]],
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
const keys = variations.map((item) => item.key);
|
|
21
|
+
const options = variations.map((item) => item.options);
|
|
22
|
+
const combinations = cartesianProduct(options);
|
|
23
|
+
return combinations.map((combination) =>
|
|
24
|
+
combination.reduce((acc, value, index) => {
|
|
25
|
+
acc[keys[index]] = value;
|
|
26
|
+
return acc;
|
|
27
|
+
}, {}),
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const combinationExists = (matrix, combination) => {
|
|
32
|
+
return matrix.some((variation) => {
|
|
33
|
+
return (
|
|
34
|
+
Object.keys(variation).length === Object.keys(combination).length && // Ensure both have the same number of keys
|
|
35
|
+
Object.entries(combination).every(([key, value]) => variation[key] === value)
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
7
39
|
|
|
8
40
|
export default async function addProductAssignment(
|
|
9
41
|
root: never,
|
|
10
42
|
params: {
|
|
11
43
|
proxyId: string;
|
|
12
44
|
productId: string;
|
|
13
|
-
vectors:
|
|
45
|
+
vectors: ProductConfiguration[];
|
|
14
46
|
},
|
|
15
47
|
{ modules, userId }: Context,
|
|
16
48
|
) {
|
|
@@ -35,11 +67,26 @@ export default async function addProductAssignment(
|
|
|
35
67
|
received: proxyProduct.type,
|
|
36
68
|
required: ProductTypes.ConfigurableProduct,
|
|
37
69
|
});
|
|
70
|
+
const variations = await modules.products.variations.findProductVariations({
|
|
71
|
+
productId: proxyId,
|
|
72
|
+
});
|
|
73
|
+
const variationMatrix = extractVariationMatrix(variations);
|
|
74
|
+
const normalizedVectors = vectors?.reduce((prev, { key, value }) => {
|
|
75
|
+
return {
|
|
76
|
+
...prev,
|
|
77
|
+
[key]: value,
|
|
78
|
+
};
|
|
79
|
+
}, {});
|
|
80
|
+
if (!combinationExists(variationMatrix, normalizedVectors))
|
|
81
|
+
throw new ProductVariationVectorInvalid({ proxyId, vectors });
|
|
38
82
|
|
|
39
|
-
await modules.products.assignments.addProxyAssignment(
|
|
83
|
+
const added = await modules.products.assignments.addProxyAssignment({
|
|
84
|
+
productId,
|
|
40
85
|
proxyId,
|
|
41
86
|
vectors,
|
|
42
87
|
});
|
|
43
88
|
|
|
89
|
+
if (!added) throw new ProductVariationVectorAlreadySet({ proxyId, vectors });
|
|
90
|
+
|
|
44
91
|
return modules.products.findProduct({ productId: proxyId });
|
|
45
92
|
}
|
|
@@ -4,7 +4,11 @@ import { log } from '@unchainedshop/logger';
|
|
|
4
4
|
import { InvalidIdError, ProductNotFoundError, ProductWrongTypeError } from '../../../errors.js';
|
|
5
5
|
import { ProductVariationType } from '@unchainedshop/core-products';
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export interface VariationInputText {
|
|
8
|
+
locale: string;
|
|
9
|
+
title: string;
|
|
10
|
+
subtitle?: string;
|
|
11
|
+
}
|
|
8
12
|
|
|
9
13
|
export default async function F(
|
|
10
14
|
root: never,
|
|
@@ -6,7 +6,7 @@ import { InvalidIdError, ProductNotFoundError, ProductWrongTypeError } from '../
|
|
|
6
6
|
|
|
7
7
|
export default async function removeProductAssignment(
|
|
8
8
|
root: never,
|
|
9
|
-
params: { proxyId: string; vectors:
|
|
9
|
+
params: { proxyId: string; vectors: ProductConfiguration[] },
|
|
10
10
|
{ modules, userId }: Context,
|
|
11
11
|
) {
|
|
12
12
|
const { proxyId, vectors } = params;
|