@unchainedshop/api 3.1.13 → 4.0.0-rc.3
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/api-index.d.ts.map +1 -1
- package/lib/api-index.js +4 -1
- package/lib/api-index.js.map +1 -1
- 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 -1
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +2 -1
- package/lib/errors.js.map +1 -1
- package/lib/express/createBulkImportMiddleware copy.d.ts +6 -0
- package/lib/express/createBulkImportMiddleware copy.d.ts.map +1 -0
- package/lib/express/createBulkImportMiddleware copy.js +49 -0
- package/lib/express/createBulkImportMiddleware copy.js.map +1 -0
- 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.map +1 -1
- package/lib/express/createMCPMiddleware.js +12 -3
- package/lib/express/createMCPMiddleware.js.map +1 -1
- package/lib/express/createTempUploadMiddleware.d.ts +7 -0
- package/lib/express/createTempUploadMiddleware.d.ts.map +1 -0
- package/lib/express/createTempUploadMiddleware.js +48 -0
- package/lib/express/createTempUploadMiddleware.js.map +1 -0
- package/lib/express/index.d.ts.map +1 -1
- package/lib/express/index.js +17 -6
- package/lib/express/index.js.map +1 -1
- package/lib/express/setupMCPChatHandler.d.ts +3 -0
- package/lib/express/setupMCPChatHandler.d.ts.map +1 -0
- package/lib/express/setupMCPChatHandler.js +57 -0
- package/lib/express/setupMCPChatHandler.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.d.ts.map +1 -1
- package/lib/fastify/index.js +24 -5
- package/lib/fastify/index.js.map +1 -1
- package/lib/fastify/mcpChatHandler.d.ts +3 -0
- package/lib/fastify/mcpChatHandler.d.ts.map +1 -0
- package/lib/fastify/mcpChatHandler.js +60 -0
- package/lib/fastify/mcpChatHandler.js.map +1 -0
- package/lib/fastify/mcpHandler copy.d.ts +4 -0
- package/lib/fastify/mcpHandler copy.d.ts.map +1 -0
- package/lib/fastify/mcpHandler copy.js +72 -0
- package/lib/fastify/mcpHandler copy.js.map +1 -0
- package/lib/fastify/mcpHandler.d.ts +4 -0
- package/lib/fastify/mcpHandler.d.ts.map +1 -0
- package/lib/fastify/mcpHandler.js +78 -0
- package/lib/fastify/mcpHandler.js.map +1 -0
- package/lib/fastify/tempUploadHandler.d.ts +4 -0
- package/lib/fastify/tempUploadHandler.d.ts.map +1 -0
- package/lib/fastify/tempUploadHandler.js +41 -0
- package/lib/fastify/tempUploadHandler.js.map +1 -0
- package/lib/loaders/buildLocaleMap.d.ts +4 -4
- package/lib/loaders/buildLocaleMap.d.ts.map +1 -1
- package/lib/loaders/buildLocaleMap.js +34 -5
- package/lib/loaders/buildLocaleMap.js.map +1 -1
- package/lib/loaders/buildTextMap.d.ts +2 -2
- package/lib/loaders/buildTextMap.d.ts.map +1 -1
- package/lib/loaders/buildTextMap.js +3 -0
- package/lib/loaders/buildTextMap.js.map +1 -1
- package/lib/loaders/index.d.ts +79 -49
- package/lib/loaders/index.d.ts.map +1 -1
- package/lib/loaders/index.js +47 -240
- package/lib/loaders/index.js.map +1 -1
- 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 +1 -1
- package/lib/mcp/index.d.ts.map +1 -1
- package/lib/mcp/index.js +38 -2
- package/lib/mcp/index.js.map +1 -1
- package/lib/mcp/tools/addProductAssignmentHandler.js.map +1 -1
- package/lib/mcp/tools/addProductMediaUploadHandler.d.ts +28 -0
- package/lib/mcp/tools/addProductMediaUploadHandler.d.ts.map +1 -0
- package/lib/mcp/tools/addProductMediaUploadHandler.js +62 -0
- package/lib/mcp/tools/addProductMediaUploadHandler.js.map +1 -0
- package/lib/mcp/tools/createLanguageHandler.d.ts +36 -0
- package/lib/mcp/tools/createLanguageHandler.d.ts.map +1 -0
- package/lib/mcp/tools/createLanguageHandler.js +39 -0
- package/lib/mcp/tools/createLanguageHandler.js.map +1 -0
- package/lib/mcp/tools/createProductVariationHandler.d.ts +2 -2
- package/lib/mcp/tools/createProductVariationHandler.d.ts.map +1 -1
- package/lib/mcp/tools/createProductVariationHandler.js +10 -4
- package/lib/mcp/tools/createProductVariationHandler.js.map +1 -1
- package/lib/mcp/tools/createProductVariationOptionHandler.d.ts +60 -0
- package/lib/mcp/tools/createProductVariationOptionHandler.d.ts.map +1 -0
- package/lib/mcp/tools/createProductVariationOptionHandler.js +59 -0
- package/lib/mcp/tools/createProductVariationOptionHandler.js.map +1 -0
- package/lib/mcp/tools/getProduct.d.ts.map +1 -1
- package/lib/mcp/tools/getProduct.js +2 -45
- package/lib/mcp/tools/getProduct.js.map +1 -1
- package/lib/mcp/tools/index.d.ts +33 -0
- package/lib/mcp/tools/index.d.ts.map +1 -1
- package/lib/mcp/tools/index.js +33 -0
- package/lib/mcp/tools/index.js.map +1 -1
- package/lib/mcp/tools/listProducts.d.ts.map +1 -1
- package/lib/mcp/tools/listProducts.js +29 -17
- package/lib/mcp/tools/listProducts.js.map +1 -1
- package/lib/mcp/tools/productReviewsCountHandler.d.ts +20 -0
- package/lib/mcp/tools/productReviewsCountHandler.d.ts.map +1 -0
- package/lib/mcp/tools/productReviewsCountHandler.js +30 -0
- package/lib/mcp/tools/productReviewsCountHandler.js.map +1 -0
- package/lib/mcp/tools/productReviewsHandler.d.ts +56 -0
- package/lib/mcp/tools/productReviewsHandler.d.ts.map +1 -0
- package/lib/mcp/tools/productReviewsHandler.js +45 -0
- package/lib/mcp/tools/productReviewsHandler.js.map +1 -0
- package/lib/mcp/tools/removeLanguageHandler.d.ts +20 -0
- package/lib/mcp/tools/removeLanguageHandler.d.ts.map +1 -0
- package/lib/mcp/tools/removeLanguageHandler.js +35 -0
- package/lib/mcp/tools/removeLanguageHandler.js.map +1 -0
- package/lib/mcp/tools/removeProductAssignmentHandler.d.ts +48 -0
- package/lib/mcp/tools/removeProductAssignmentHandler.d.ts.map +1 -0
- package/lib/mcp/tools/removeProductAssignmentHandler.js +51 -0
- package/lib/mcp/tools/removeProductAssignmentHandler.js.map +1 -0
- package/lib/mcp/tools/removeProductHandler.d.ts +20 -0
- package/lib/mcp/tools/removeProductHandler.d.ts.map +1 -0
- package/lib/mcp/tools/removeProductHandler.js +34 -0
- package/lib/mcp/tools/removeProductHandler.js.map +1 -0
- package/lib/mcp/tools/removeProductMediaHandler.d.ts +20 -0
- package/lib/mcp/tools/removeProductMediaHandler.d.ts.map +1 -0
- package/lib/mcp/tools/removeProductMediaHandler.js +42 -0
- package/lib/mcp/tools/removeProductMediaHandler.js.map +1 -0
- package/lib/mcp/tools/removeProductVariationOptionHandler.d.ts +24 -0
- package/lib/mcp/tools/removeProductVariationOptionHandler.d.ts.map +1 -0
- package/lib/mcp/tools/removeProductVariationOptionHandler.js +47 -0
- package/lib/mcp/tools/removeProductVariationOptionHandler.js.map +1 -0
- package/lib/mcp/tools/reorderProductMediaHandler.d.ts +44 -0
- package/lib/mcp/tools/reorderProductMediaHandler.d.ts.map +1 -0
- package/lib/mcp/tools/reorderProductMediaHandler.js +39 -0
- package/lib/mcp/tools/reorderProductMediaHandler.js.map +1 -0
- package/lib/mcp/tools/updateLanguageHandler.d.ts +48 -0
- package/lib/mcp/tools/updateLanguageHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateLanguageHandler.js +40 -0
- package/lib/mcp/tools/updateLanguageHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductMediaTextsHandler.d.ts +56 -0
- package/lib/mcp/tools/updateProductMediaTextsHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductMediaTextsHandler.js +45 -0
- package/lib/mcp/tools/updateProductMediaTextsHandler.js.map +1 -0
- package/lib/mcp/utils/getNormalizedProductDetails.d.ts.map +1 -1
- package/lib/mcp/utils/getNormalizedProductDetails.js +2 -0
- package/lib/mcp/utils/getNormalizedProductDetails.js.map +1 -1
- 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.d.ts.map +1 -1
- package/lib/resolvers/queries/filters/searchAssortments.js +2 -7
- package/lib/resolvers/queries/filters/searchAssortments.js.map +1 -1
- package/lib/resolvers/queries/filters/searchProducts.d.ts.map +1 -1
- package/lib/resolvers/queries/filters/searchProducts.js +3 -8
- 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.js +1 -1
- package/lib/roles/all.js.map +1 -1
- package/lib/roles/index.d.ts.map +1 -1
- package/lib/roles/index.js +1 -0
- package/lib/roles/index.js.map +1 -1
- package/lib/roles/loggedIn.d.ts.map +1 -1
- package/lib/roles/loggedIn.js +1 -0
- package/lib/roles/loggedIn.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/package.json +32 -16
- package/src/api-index.ts +4 -1
- package/src/context.ts +3 -3
- package/src/createGraphQLServer.ts +2 -2
- package/src/errors.ts +10 -4
- package/src/express/createERCMetadataMiddleware.ts +11 -5
- package/src/express/createMCPMiddleware.ts +91 -0
- package/src/express/createTempUploadMiddleware.ts +60 -0
- package/src/express/index.ts +37 -9
- package/src/fastify/ercMetadataHandler.ts +11 -5
- package/src/fastify/index.ts +34 -5
- package/src/fastify/mcpHandler.ts +97 -0
- package/src/fastify/tempUploadHandler.ts +52 -0
- 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/buildLocaleMap.test.ts +9 -5
- package/src/loaders/buildLocaleMap.ts +43 -9
- package/src/loaders/buildTextMap.ts +4 -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 -329
- 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/mcp/README.md +25 -0
- package/src/mcp/index.ts +313 -0
- package/src/mcp/tools/addProductAssignmentHandler.ts +118 -0
- package/src/mcp/tools/addProductMediaUploadHandler.ts +79 -0
- package/src/mcp/tools/countriesHandler.ts +60 -0
- package/src/mcp/tools/countryHandler.ts +40 -0
- package/src/mcp/tools/createLanguageHandler.ts +46 -0
- package/src/mcp/tools/createProduct.ts +75 -0
- package/src/mcp/tools/createProductVariationHandler.ts +93 -0
- package/src/mcp/tools/createProductVariationOptionHandler.ts +73 -0
- package/src/mcp/tools/currenciesHandler.ts +63 -0
- package/src/mcp/tools/currencyHandler.ts +40 -0
- package/src/mcp/tools/getProduct.ts +74 -0
- package/src/mcp/tools/index.ts +39 -0
- package/src/mcp/tools/languageHandler.ts +37 -0
- package/src/mcp/tools/languagesHandler.ts +54 -0
- package/src/mcp/tools/listProducts.ts +148 -0
- package/src/mcp/tools/productReviewsCountHandler.ts +36 -0
- package/src/mcp/tools/productReviewsHandler.ts +54 -0
- package/src/mcp/tools/productsCountHandler.ts +38 -0
- package/src/mcp/tools/publishProduct.ts +45 -0
- package/src/mcp/tools/removeLanguageHandler.ts +42 -0
- package/src/mcp/tools/removeProductAssignmentHandler.ts +61 -0
- package/src/mcp/tools/removeProductHandler.ts +40 -0
- package/src/mcp/tools/removeProductMediaHandler.ts +49 -0
- package/src/mcp/tools/removeProductVariationHandler.ts +51 -0
- package/src/mcp/tools/removeProductVariationOptionHandler.ts +58 -0
- package/src/mcp/tools/reorderProductMediaHandler.ts +48 -0
- package/src/mcp/tools/unPublishProduct.ts +46 -0
- package/src/mcp/tools/updateLanguageHandler.ts +47 -0
- package/src/mcp/tools/updateProduct.ts +51 -0
- package/src/mcp/tools/updateProductCommerceHandler.ts +79 -0
- package/src/mcp/tools/updateProductMediaTextsHandler.ts +56 -0
- package/src/mcp/tools/updateProductPlanHandler.ts +58 -0
- package/src/mcp/tools/updateProductSupplyHandler.ts +59 -0
- package/src/mcp/tools/updateProductTextsHandler.ts +59 -0
- package/src/mcp/tools/updateProductTokenizationHandler.ts +58 -0
- package/src/mcp/tools/updateProductWarehousingHandler.ts +54 -0
- package/src/mcp/utils/getNormalizedProductDetails.ts +42 -0
- package/src/mcp/utils/normalizeMediaUrl.ts +26 -0
- 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 +45 -2
- 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 -7
- package/src/resolvers/queries/filters/searchProducts.ts +3 -8
- 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 +1 -1
- package/src/roles/index.ts +1 -0
- package/src/roles/loggedIn.ts +1 -0
- 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
|
@@ -15,11 +15,7 @@ import { Price } from '@unchainedshop/utils';
|
|
|
15
15
|
import { OrderPricingSheet } from '@unchainedshop/core';
|
|
16
16
|
|
|
17
17
|
export const Order = {
|
|
18
|
-
async supportedDeliveryProviders(
|
|
19
|
-
order: OrderType,
|
|
20
|
-
_,
|
|
21
|
-
context: Context,
|
|
22
|
-
): Promise<Array<DeliveryProvider>> {
|
|
18
|
+
async supportedDeliveryProviders(order: OrderType, _, context: Context): Promise<DeliveryProvider[]> {
|
|
23
19
|
return context.services.orders.supportedDeliveryProviders({
|
|
24
20
|
order,
|
|
25
21
|
});
|
|
@@ -31,44 +27,37 @@ export const Order = {
|
|
|
31
27
|
});
|
|
32
28
|
},
|
|
33
29
|
|
|
34
|
-
async currency(order: OrderType, _, {
|
|
35
|
-
|
|
36
|
-
return modules.currencies.findCurrency({ isoCode: order.currency });
|
|
30
|
+
async currency(order: OrderType, _, { loaders }: Context): Promise<Currency> {
|
|
31
|
+
return loaders.currencyLoader.load({ isoCode: order.currencyCode });
|
|
37
32
|
},
|
|
38
33
|
|
|
39
|
-
async country(order: OrderType, _, {
|
|
40
|
-
|
|
41
|
-
return modules.countries.findCountry({ isoCode: order.countryCode });
|
|
34
|
+
async country(order: OrderType, _, { loaders }: Context): Promise<Country> {
|
|
35
|
+
return loaders.countryLoader.load({ isoCode: order.countryCode });
|
|
42
36
|
},
|
|
43
37
|
|
|
44
|
-
async discounts(order: OrderType, _, { modules }: Context): Promise<
|
|
45
|
-
// TODO: use loader?
|
|
38
|
+
async discounts(order: OrderType, _, { modules }: Context): Promise<OrderDiscount[]> {
|
|
46
39
|
return modules.orders.discounts.findOrderDiscounts({ orderId: order._id });
|
|
47
40
|
},
|
|
48
41
|
|
|
49
42
|
async delivery(order: OrderType, _, { modules }: Context): Promise<OrderDelivery> {
|
|
50
|
-
// TODO: use loader
|
|
51
43
|
return modules.orders.deliveries.findDelivery({
|
|
52
44
|
orderDeliveryId: order.deliveryId,
|
|
53
45
|
});
|
|
54
46
|
},
|
|
55
47
|
|
|
56
48
|
async enrollment(order: OrderType, _, { modules }: Context): Promise<Enrollment> {
|
|
57
|
-
// TODO: use loader
|
|
58
49
|
return modules.enrollments.findEnrollment({
|
|
59
50
|
orderId: order._id,
|
|
60
51
|
});
|
|
61
52
|
},
|
|
62
53
|
|
|
63
|
-
async items(order: OrderType, _, { modules }: Context): Promise<
|
|
64
|
-
// TODO: use loader?
|
|
54
|
+
async items(order: OrderType, _, { modules }: Context): Promise<OrderPosition[]> {
|
|
65
55
|
return modules.orders.positions.findOrderPositions({
|
|
66
56
|
orderId: order._id,
|
|
67
57
|
});
|
|
68
58
|
},
|
|
69
59
|
|
|
70
60
|
async payment(order: OrderType, _, { modules }: Context): Promise<OrderPayment> {
|
|
71
|
-
// TODO: use loader
|
|
72
61
|
return modules.orders.payments.findOrderPayment({
|
|
73
62
|
orderPaymentId: order.paymentId,
|
|
74
63
|
});
|
|
@@ -84,7 +73,7 @@ export const Order = {
|
|
|
84
73
|
total(order: OrderType, params: { category: string; useNetPrice: boolean }): Price {
|
|
85
74
|
const pricing = OrderPricingSheet({
|
|
86
75
|
calculation: order.calculation,
|
|
87
|
-
|
|
76
|
+
currencyCode: order.currencyCode,
|
|
88
77
|
});
|
|
89
78
|
|
|
90
79
|
if (pricing.isValid()) {
|
|
@@ -93,8 +82,7 @@ export const Order = {
|
|
|
93
82
|
return null;
|
|
94
83
|
},
|
|
95
84
|
|
|
96
|
-
async user(order: OrderType, _, {
|
|
97
|
-
|
|
98
|
-
return modules.users.findUserById(order.userId);
|
|
85
|
+
async user(order: OrderType, _, { loaders }: Context): Promise<User> {
|
|
86
|
+
return loaders.userLoader.load({ userId: order.userId });
|
|
99
87
|
},
|
|
100
88
|
};
|
|
@@ -14,23 +14,19 @@ export interface PaymentCredentialsHelperTypes {
|
|
|
14
14
|
isValid: HelperType<never, Promise<boolean>>;
|
|
15
15
|
}
|
|
16
16
|
export const PaymentCredentials: PaymentCredentialsHelperTypes = {
|
|
17
|
-
async user(obj, _, {
|
|
18
|
-
|
|
19
|
-
return modules.users.findUserById(obj.userId);
|
|
17
|
+
async user(obj, _, { loaders }) {
|
|
18
|
+
return loaders.userLoader.load({ userId: obj.userId });
|
|
20
19
|
},
|
|
21
20
|
|
|
22
|
-
async paymentProvider(obj, _, {
|
|
23
|
-
|
|
24
|
-
return modules.payment.paymentProviders.findProvider({
|
|
21
|
+
async paymentProvider(obj, _, { loaders }) {
|
|
22
|
+
return loaders.paymentProviderLoader.load({
|
|
25
23
|
paymentProviderId: obj.paymentProviderId,
|
|
26
24
|
});
|
|
27
25
|
},
|
|
28
26
|
|
|
29
27
|
async isValid(obj, _, requestContext) {
|
|
30
|
-
const {
|
|
31
|
-
|
|
32
|
-
// TODO: use loader
|
|
33
|
-
const paymentProvider = await modules.payment.paymentProviders.findProvider({
|
|
28
|
+
const { loaders, userId } = requestContext;
|
|
29
|
+
const paymentProvider = await loaders.paymentProviderLoader.load({
|
|
34
30
|
paymentProviderId: obj.paymentProviderId,
|
|
35
31
|
});
|
|
36
32
|
const actions = await PaymentDirector.actions(
|
|
@@ -25,17 +25,16 @@ export const PaymentProvider = {
|
|
|
25
25
|
|
|
26
26
|
async simulatedPrice(
|
|
27
27
|
paymentProvider: PaymentProviderType,
|
|
28
|
-
{
|
|
28
|
+
{ currencyCode: forcedCurrencyCode, orderId, useNetPrice, context: providerContext },
|
|
29
29
|
requestContext: Context,
|
|
30
30
|
) {
|
|
31
|
-
const {
|
|
31
|
+
const { loaders, countryCode, user } = requestContext;
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
const currency = currencyCode || order?.currency || requestContext.currencyContext;
|
|
33
|
+
const order = await loaders.orderLoader.load({ orderId });
|
|
34
|
+
const currencyCode = forcedCurrencyCode || order?.currencyCode || requestContext.currencyCode;
|
|
36
35
|
const pricingContext = {
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
countryCode,
|
|
37
|
+
currencyCode,
|
|
39
38
|
provider: paymentProvider,
|
|
40
39
|
order,
|
|
41
40
|
providerContext,
|
|
@@ -50,13 +49,13 @@ export const PaymentProvider = {
|
|
|
50
49
|
|
|
51
50
|
const orderPrice = pricing.total({ useNetPrice }) as {
|
|
52
51
|
amount: number;
|
|
53
|
-
|
|
52
|
+
currencyCode: string;
|
|
54
53
|
};
|
|
55
54
|
|
|
56
55
|
return {
|
|
57
56
|
amount: orderPrice.amount,
|
|
58
|
-
currencyCode: orderPrice.
|
|
59
|
-
countryCode
|
|
57
|
+
currencyCode: orderPrice.currencyCode,
|
|
58
|
+
countryCode,
|
|
60
59
|
isTaxable: pricing.taxSum() > 0,
|
|
61
60
|
isNetPrice: useNetPrice,
|
|
62
61
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import accounting from 'accounting';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export interface PriceType {
|
|
4
4
|
isTaxable?: boolean;
|
|
5
5
|
isNetPrice?: boolean;
|
|
6
6
|
countryCode?: string;
|
|
7
7
|
currencyCode?: string;
|
|
8
8
|
currency?: string;
|
|
9
9
|
amount: number;
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
11
|
|
|
12
12
|
export const Price = {
|
|
13
13
|
isTaxable({ isTaxable }: PriceType) {
|
|
@@ -16,8 +16,8 @@ export const Price = {
|
|
|
16
16
|
isNetPrice({ isNetPrice }: PriceType) {
|
|
17
17
|
return isNetPrice || false;
|
|
18
18
|
},
|
|
19
|
-
|
|
20
|
-
return obj?.currencyCode
|
|
19
|
+
currencyCode(obj: PriceType) {
|
|
20
|
+
return obj?.currencyCode;
|
|
21
21
|
},
|
|
22
22
|
amount(obj: PriceType) {
|
|
23
23
|
if (obj.amount) {
|
|
@@ -5,7 +5,7 @@ import { AssortmentPathLink, AssortmentProduct } from '@unchainedshop/core-assor
|
|
|
5
5
|
export type HelperType<P, T> = (product: Product, params: P, context: Context) => T;
|
|
6
6
|
export interface ProductAssortmentPathHelperTypes {
|
|
7
7
|
assortmentProduct: (
|
|
8
|
-
data: { assortmentId: string; productId: string; links:
|
|
8
|
+
data: { assortmentId: string; productId: string; links: AssortmentPathLink[] },
|
|
9
9
|
_: never,
|
|
10
10
|
context: Context,
|
|
11
11
|
) => Promise<AssortmentProduct>;
|
|
@@ -25,12 +25,10 @@ export const ProductCatalogPrice: ProductCatalogPriceHelperTypes = {
|
|
|
25
25
|
isNetPrice: ({ isNetPrice }) => {
|
|
26
26
|
return isNetPrice || false;
|
|
27
27
|
},
|
|
28
|
-
country: async ({ countryCode }, _, {
|
|
29
|
-
|
|
30
|
-
return modules.countries.findCountry({ isoCode: countryCode });
|
|
28
|
+
country: async ({ countryCode }, _, { loaders }) => {
|
|
29
|
+
return loaders.countryLoader.load({ isoCode: countryCode });
|
|
31
30
|
},
|
|
32
|
-
currency: async ({ currencyCode }, _, {
|
|
33
|
-
|
|
34
|
-
return modules.currencies.findCurrency({ isoCode: currencyCode });
|
|
31
|
+
currency: async ({ currencyCode }, _, { loaders }) => {
|
|
32
|
+
return loaders.currencyLoader.load({ isoCode: currencyCode });
|
|
35
33
|
},
|
|
36
34
|
};
|
|
@@ -18,10 +18,10 @@ export const ConfigurableProduct = {
|
|
|
18
18
|
},
|
|
19
19
|
{ modules }: Context,
|
|
20
20
|
): Promise<
|
|
21
|
-
|
|
21
|
+
{
|
|
22
22
|
assignment: ProductAssignment;
|
|
23
23
|
product: typeof product;
|
|
24
|
-
}
|
|
24
|
+
}[]
|
|
25
25
|
> {
|
|
26
26
|
return modules.products.proxyAssignments(product, params);
|
|
27
27
|
},
|
|
@@ -32,11 +32,11 @@ export const ConfigurableProduct = {
|
|
|
32
32
|
vectors,
|
|
33
33
|
includeInactive,
|
|
34
34
|
}: {
|
|
35
|
-
vectors:
|
|
35
|
+
vectors: ProductConfiguration[];
|
|
36
36
|
includeInactive: boolean;
|
|
37
37
|
},
|
|
38
38
|
{ modules }: Context,
|
|
39
|
-
): Promise<
|
|
39
|
+
): Promise<(typeof product)[]> {
|
|
40
40
|
return modules.products.proxyProducts(product, vectors, {
|
|
41
41
|
includeInactive,
|
|
42
42
|
});
|
|
@@ -47,24 +47,23 @@ export const ConfigurableProduct = {
|
|
|
47
47
|
{
|
|
48
48
|
quantity,
|
|
49
49
|
vectors,
|
|
50
|
-
|
|
50
|
+
currencyCode,
|
|
51
51
|
includeInactive,
|
|
52
52
|
}: {
|
|
53
|
-
|
|
53
|
+
currencyCode?: string;
|
|
54
54
|
includeInactive: boolean;
|
|
55
55
|
quantity: number;
|
|
56
|
-
vectors:
|
|
56
|
+
vectors: ProductConfiguration[];
|
|
57
57
|
},
|
|
58
58
|
requestContext: Context,
|
|
59
59
|
): Promise<ProductPriceRange> {
|
|
60
|
-
const {
|
|
61
|
-
const currencyCode = forcedCurrencyCode || requestContext.currencyContext;
|
|
60
|
+
const { countryCode, modules } = requestContext;
|
|
62
61
|
return modules.products.prices.catalogPriceRange(product, {
|
|
63
62
|
quantity,
|
|
64
63
|
vectors,
|
|
65
64
|
includeInactive,
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
countryCode,
|
|
66
|
+
currencyCode,
|
|
68
67
|
});
|
|
69
68
|
},
|
|
70
69
|
|
|
@@ -78,8 +77,7 @@ export const ConfigurableProduct = {
|
|
|
78
77
|
offset: number;
|
|
79
78
|
},
|
|
80
79
|
{ modules }: Context,
|
|
81
|
-
): Promise<
|
|
82
|
-
// TODO: use loader?
|
|
80
|
+
): Promise<ProductVariation[]> {
|
|
83
81
|
return modules.products.variations.findProductVariations({
|
|
84
82
|
productId: product._id,
|
|
85
83
|
limit,
|
|
@@ -90,22 +88,23 @@ export const ConfigurableProduct = {
|
|
|
90
88
|
async simulatedPriceRange(
|
|
91
89
|
product: ProductType,
|
|
92
90
|
{
|
|
93
|
-
|
|
91
|
+
currencyCode: forcedCurrencyCode,
|
|
94
92
|
quantity,
|
|
95
93
|
useNetPrice,
|
|
96
94
|
vectors,
|
|
97
95
|
includeInactive,
|
|
98
96
|
}: {
|
|
99
|
-
|
|
97
|
+
currencyCode?: string;
|
|
100
98
|
includeInactive: boolean;
|
|
101
99
|
quantity?: number;
|
|
102
|
-
vectors:
|
|
100
|
+
vectors: ProductConfiguration[];
|
|
103
101
|
useNetPrice: boolean;
|
|
104
102
|
},
|
|
105
103
|
requestContext: Context,
|
|
106
104
|
): Promise<ProductPriceRange> {
|
|
107
|
-
const {
|
|
108
|
-
|
|
105
|
+
const { countryCode, modules, services } = requestContext;
|
|
106
|
+
|
|
107
|
+
const currencyCode = forcedCurrencyCode || requestContext.currencyCode;
|
|
109
108
|
|
|
110
109
|
const products = await modules.products.proxyProducts(product, vectors, {
|
|
111
110
|
includeInactive,
|
|
@@ -117,8 +116,8 @@ export const ConfigurableProduct = {
|
|
|
117
116
|
const pricingContext = {
|
|
118
117
|
product: proxyProduct,
|
|
119
118
|
user: requestContext.user,
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
countryCode,
|
|
120
|
+
currencyCode,
|
|
122
121
|
quantity,
|
|
123
122
|
};
|
|
124
123
|
|
|
@@ -130,7 +129,7 @@ export const ConfigurableProduct = {
|
|
|
130
129
|
...unitPrice,
|
|
131
130
|
isNetPrice: useNetPrice,
|
|
132
131
|
isTaxable: pricing.taxSum() > 0,
|
|
133
|
-
currencyCode: pricing.
|
|
132
|
+
currencyCode: pricing.currencyCode,
|
|
134
133
|
};
|
|
135
134
|
}),
|
|
136
135
|
)
|
|
@@ -11,10 +11,10 @@ export interface ProductMediaHelperTypes {
|
|
|
11
11
|
|
|
12
12
|
export const ProductMedia: ProductMediaHelperTypes = {
|
|
13
13
|
async texts(obj, { forceLocale }, requestContext) {
|
|
14
|
-
const {
|
|
14
|
+
const { locale, loaders } = requestContext;
|
|
15
15
|
return loaders.productMediaTextLoader.load({
|
|
16
16
|
productMediaId: obj._id,
|
|
17
|
-
locale: forceLocale
|
|
17
|
+
locale: forceLocale ? new Intl.Locale(forceLocale) : locale,
|
|
18
18
|
});
|
|
19
19
|
},
|
|
20
20
|
|
|
@@ -11,41 +11,41 @@ export const PlanProduct = {
|
|
|
11
11
|
|
|
12
12
|
async catalogPrice(
|
|
13
13
|
product: ProductType,
|
|
14
|
-
{ quantity,
|
|
14
|
+
{ quantity, currencyCode: forcedCurrencyCode }: { quantity?: number; currencyCode?: string },
|
|
15
15
|
requestContext: Context,
|
|
16
16
|
): Promise<ProductPrice> {
|
|
17
|
-
const { modules,
|
|
18
|
-
const
|
|
17
|
+
const { modules, countryCode } = requestContext;
|
|
18
|
+
const currencyCode = forcedCurrencyCode || requestContext.currencyCode;
|
|
19
19
|
return modules.products.prices.price(product, {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
countryCode,
|
|
21
|
+
currencyCode,
|
|
22
22
|
quantity,
|
|
23
23
|
});
|
|
24
24
|
},
|
|
25
25
|
|
|
26
26
|
async simulatedPrice(
|
|
27
|
-
|
|
27
|
+
product: ProductType,
|
|
28
28
|
{
|
|
29
|
-
|
|
29
|
+
currencyCode: forcedCurrencyCode,
|
|
30
30
|
quantity,
|
|
31
31
|
useNetPrice,
|
|
32
32
|
configuration,
|
|
33
33
|
}: {
|
|
34
34
|
quantity?: number;
|
|
35
|
-
|
|
35
|
+
currencyCode?: string;
|
|
36
36
|
useNetPrice?: boolean;
|
|
37
|
-
configuration?:
|
|
37
|
+
configuration?: ProductConfiguration[];
|
|
38
38
|
},
|
|
39
39
|
requestContext: Context,
|
|
40
40
|
): Promise<ProductPrice> {
|
|
41
|
-
const {
|
|
42
|
-
const
|
|
41
|
+
const { countryCode, user, services } = requestContext;
|
|
42
|
+
const currencyCode = forcedCurrencyCode || requestContext.currencyCode;
|
|
43
43
|
|
|
44
44
|
const pricingContext = {
|
|
45
|
-
product
|
|
45
|
+
product,
|
|
46
46
|
user,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
countryCode,
|
|
48
|
+
currencyCode,
|
|
49
49
|
quantity,
|
|
50
50
|
configuration,
|
|
51
51
|
};
|
|
@@ -58,24 +58,24 @@ export const PlanProduct = {
|
|
|
58
58
|
...unitPrice,
|
|
59
59
|
isNetPrice: useNetPrice,
|
|
60
60
|
isTaxable: pricing.taxSum() > 0,
|
|
61
|
-
currencyCode: pricing.
|
|
61
|
+
currencyCode: pricing.currencyCode,
|
|
62
62
|
};
|
|
63
63
|
},
|
|
64
64
|
|
|
65
65
|
async leveledCatalogPrices(
|
|
66
|
-
|
|
67
|
-
{
|
|
66
|
+
product: ProductType,
|
|
67
|
+
{ currencyCode: forcedCurrencyCode }: { currencyCode?: string },
|
|
68
68
|
requestContext: Context,
|
|
69
69
|
): Promise<
|
|
70
|
-
|
|
70
|
+
{
|
|
71
71
|
minQuantity: number;
|
|
72
72
|
maxQuantity: number;
|
|
73
73
|
price: ProductPrice;
|
|
74
|
-
}
|
|
74
|
+
}[]
|
|
75
75
|
> {
|
|
76
|
-
const {
|
|
77
|
-
const
|
|
78
|
-
return modules.products.prices.catalogPricesLeveled(
|
|
76
|
+
const { countryCode, modules } = requestContext;
|
|
77
|
+
const currencyCode = forcedCurrencyCode || requestContext.currencyCode;
|
|
78
|
+
return modules.products.prices.catalogPricesLeveled(product, { currencyCode, countryCode });
|
|
79
79
|
},
|
|
80
80
|
|
|
81
81
|
salesUnit({ commerce }: ProductType): string {
|
|
@@ -13,12 +13,11 @@ export interface ProductReviewHelperTypes {
|
|
|
13
13
|
author: HelperType<never, Promise<User>>;
|
|
14
14
|
product: HelperType<never, Promise<Product>>;
|
|
15
15
|
voteCount: HelperType<{ type: ProductReviewVoteType }, number>;
|
|
16
|
-
ownVotes: HelperType<never, Promise<
|
|
16
|
+
ownVotes: HelperType<never, Promise<ProductVote[]>>;
|
|
17
17
|
}
|
|
18
18
|
export const ProductReview: ProductReviewHelperTypes = {
|
|
19
|
-
author: async (obj, _, {
|
|
20
|
-
|
|
21
|
-
return modules.users.findUserById(obj.authorId);
|
|
19
|
+
author: async (obj, _, { loaders }) => {
|
|
20
|
+
return loaders.userLoader.load({ userId: obj.authorId });
|
|
22
21
|
},
|
|
23
22
|
|
|
24
23
|
product: async (review, _, { loaders }) => {
|
|
@@ -13,21 +13,16 @@ export const SimpleProduct = {
|
|
|
13
13
|
params: { referenceDate: Date; quantity: number; deliveryProviderType: DeliveryProviderType },
|
|
14
14
|
requestContext: Context,
|
|
15
15
|
): Promise<
|
|
16
|
-
|
|
16
|
+
{
|
|
17
17
|
deliveryProvider?: DeliveryProvider;
|
|
18
18
|
warehousingProvider?: WarehousingProvider;
|
|
19
19
|
shipping?: Date;
|
|
20
20
|
earliestDelivery?: Date;
|
|
21
|
-
}
|
|
21
|
+
}[]
|
|
22
22
|
> {
|
|
23
23
|
const { referenceDate, quantity } = params;
|
|
24
|
-
const { services
|
|
25
|
-
|
|
26
|
-
// TODO: use loader?
|
|
27
|
-
const deliveryProviders = await modules.delivery.findProviders({});
|
|
28
|
-
|
|
24
|
+
const { services } = requestContext;
|
|
29
25
|
return services.products.simulateProductDispatching({
|
|
30
|
-
deliveryProviders,
|
|
31
26
|
product: obj,
|
|
32
27
|
quantity,
|
|
33
28
|
referenceDate,
|
|
@@ -42,22 +37,15 @@ export const SimpleProduct = {
|
|
|
42
37
|
},
|
|
43
38
|
requestContext: Context,
|
|
44
39
|
): Promise<
|
|
45
|
-
|
|
40
|
+
{
|
|
46
41
|
deliveryProvider?: DeliveryProvider;
|
|
47
42
|
warehousingProvider?: WarehousingProvider;
|
|
48
43
|
quantity?: number;
|
|
49
|
-
}
|
|
44
|
+
}[]
|
|
50
45
|
> {
|
|
51
|
-
const {
|
|
52
|
-
const { referenceDate
|
|
53
|
-
|
|
54
|
-
// TODO: use loader?
|
|
55
|
-
const deliveryProviders = await modules.delivery.findProviders({
|
|
56
|
-
type: deliveryProviderType,
|
|
57
|
-
});
|
|
58
|
-
|
|
46
|
+
const { services } = requestContext;
|
|
47
|
+
const { referenceDate } = params;
|
|
59
48
|
return services.products.simulateProductInventory({
|
|
60
|
-
deliveryProviders,
|
|
61
49
|
product: obj,
|
|
62
50
|
referenceDate,
|
|
63
51
|
});
|
|
@@ -38,20 +38,15 @@ export const TokenizedProduct = {
|
|
|
38
38
|
},
|
|
39
39
|
requestContext: Context,
|
|
40
40
|
): Promise<
|
|
41
|
-
|
|
41
|
+
{
|
|
42
42
|
deliveryProvider?: DeliveryProvider;
|
|
43
43
|
warehousingProvider?: WarehousingProvider;
|
|
44
44
|
quantity?: number;
|
|
45
|
-
}
|
|
45
|
+
}[]
|
|
46
46
|
> {
|
|
47
|
-
const {
|
|
47
|
+
const { services } = requestContext;
|
|
48
48
|
const { referenceDate } = params;
|
|
49
|
-
|
|
50
|
-
// TODO: use loader?
|
|
51
|
-
const deliveryProviders = await modules.delivery.findProviders({});
|
|
52
|
-
|
|
53
49
|
return services.products.simulateProductInventory({
|
|
54
|
-
deliveryProviders,
|
|
55
50
|
product: obj,
|
|
56
51
|
referenceDate,
|
|
57
52
|
});
|
|
@@ -59,8 +54,6 @@ export const TokenizedProduct = {
|
|
|
59
54
|
|
|
60
55
|
async tokens(product: Product, params: never, requestContext: Context) {
|
|
61
56
|
await checkAction(requestContext, actions.viewTokens, [undefined, params]);
|
|
62
|
-
|
|
63
|
-
// TODO: use loader?
|
|
64
57
|
const tokens = await requestContext.modules.warehousing.findTokens({
|
|
65
58
|
productId: product._id,
|
|
66
59
|
});
|
|
@@ -20,9 +20,9 @@ export const Product = {
|
|
|
20
20
|
},
|
|
21
21
|
{ modules, loaders }: Context,
|
|
22
22
|
): Promise<
|
|
23
|
-
|
|
24
|
-
links:
|
|
25
|
-
}
|
|
23
|
+
{
|
|
24
|
+
links: AssortmentPathLink[];
|
|
25
|
+
}[]
|
|
26
26
|
> {
|
|
27
27
|
return modules.assortments.breadcrumbs(
|
|
28
28
|
{
|
|
@@ -41,16 +41,15 @@ export const Product = {
|
|
|
41
41
|
);
|
|
42
42
|
},
|
|
43
43
|
|
|
44
|
-
// TODO: Use a loader!
|
|
45
44
|
async media(
|
|
46
45
|
product: ProductType,
|
|
47
46
|
params: {
|
|
48
47
|
limit: number;
|
|
49
48
|
offset: number;
|
|
50
|
-
tags?:
|
|
49
|
+
tags?: string[];
|
|
51
50
|
},
|
|
52
51
|
{ loaders, modules }: Context,
|
|
53
|
-
): Promise<
|
|
52
|
+
): Promise<ProductMedia[]> {
|
|
54
53
|
if (params.offset || params.tags) {
|
|
55
54
|
return modules.products.media.findProductMedias({
|
|
56
55
|
productId: product._id,
|
|
@@ -74,11 +73,10 @@ export const Product = {
|
|
|
74
73
|
queryString?: string;
|
|
75
74
|
limit?: number;
|
|
76
75
|
offset?: number;
|
|
77
|
-
sort?:
|
|
76
|
+
sort?: SortOption[];
|
|
78
77
|
},
|
|
79
78
|
{ modules }: Context,
|
|
80
|
-
): Promise<
|
|
81
|
-
// TODO: use loader?
|
|
79
|
+
): Promise<ProductReview[]> {
|
|
82
80
|
return modules.products.reviews.findProductReviews({
|
|
83
81
|
productId: product._id,
|
|
84
82
|
limit,
|
|
@@ -107,7 +105,7 @@ export const Product = {
|
|
|
107
105
|
includeInactive: boolean;
|
|
108
106
|
},
|
|
109
107
|
{ modules }: Context,
|
|
110
|
-
): Promise<
|
|
108
|
+
): Promise<(typeof product)[]> {
|
|
111
109
|
const { assortmentId, limit, offset, includeInactive = false } = params;
|
|
112
110
|
|
|
113
111
|
const productId = product._id;
|
|
@@ -141,12 +139,11 @@ export const Product = {
|
|
|
141
139
|
}: {
|
|
142
140
|
forceLocale?: string;
|
|
143
141
|
},
|
|
144
|
-
|
|
142
|
+
{ locale, loaders }: Context,
|
|
145
143
|
): Promise<ProductText> {
|
|
146
|
-
const { localeContext, loaders } = requestContext;
|
|
147
144
|
return loaders.productTextLoader.load({
|
|
148
145
|
productId: product._id,
|
|
149
|
-
locale: forceLocale
|
|
146
|
+
locale: forceLocale ? new Intl.Locale(forceLocale) : locale,
|
|
150
147
|
});
|
|
151
148
|
},
|
|
152
149
|
};
|
|
@@ -9,13 +9,13 @@ export type AssignmentHelperType<T> = (
|
|
|
9
9
|
|
|
10
10
|
export interface ProductVariationAssignmentHelperTypes {
|
|
11
11
|
_id: AssignmentHelperType<string>;
|
|
12
|
-
vectors: AssignmentHelperType<
|
|
12
|
+
vectors: AssignmentHelperType<({ product: Product } & ProductConfiguration)[]>;
|
|
13
13
|
product: AssignmentHelperType<Promise<Product>>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export const ProductVariationAssignment: ProductVariationAssignmentHelperTypes = {
|
|
17
17
|
_id: ({ product, assignment }) => {
|
|
18
|
-
return `${product
|
|
18
|
+
return `${product?._id}:${Object.values(assignment.vector).join('-')}`;
|
|
19
19
|
},
|
|
20
20
|
vectors: ({ assignment, product }) => {
|
|
21
21
|
return Object.keys(assignment.vector || {}).map((key) => ({
|
|
@@ -18,7 +18,7 @@ export const ProductVariationAssignmentVector: ProductVariationAssignmentVectorH
|
|
|
18
18
|
_id: ({ product, key, value }) => `${product._id}:${key}=${value}`,
|
|
19
19
|
|
|
20
20
|
option: async (obj, _, { modules }) => {
|
|
21
|
-
// TODO: use loader
|
|
21
|
+
// TODO: use product variation loader
|
|
22
22
|
const productVariation = await modules.products.variations.findProductVariationByKey({
|
|
23
23
|
key: obj.key,
|
|
24
24
|
productId: obj.product._id,
|
|
@@ -30,7 +30,7 @@ export const ProductVariationAssignmentVector: ProductVariationAssignmentVectorH
|
|
|
30
30
|
},
|
|
31
31
|
|
|
32
32
|
variation: (obj, _, { modules }) => {
|
|
33
|
-
// TODO: use loader
|
|
33
|
+
// TODO: use product variation loader
|
|
34
34
|
return modules.products.variations.findProductVariationByKey({
|
|
35
35
|
productId: obj?.product?._id,
|
|
36
36
|
key: obj?.key,
|