@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
|
@@ -17,18 +17,24 @@ const ercMetadataHandler: RouteHandlerMethod = async (
|
|
|
17
17
|
res,
|
|
18
18
|
) => {
|
|
19
19
|
try {
|
|
20
|
-
const { services,
|
|
20
|
+
const { services, modules, locale, loaders } = req.unchainedContext;
|
|
21
21
|
const url = new URL(req.url, ROOT_URL);
|
|
22
22
|
|
|
23
23
|
if (!url.pathname.toLowerCase().endsWith('.json')) throw new Error('Invalid ERC Metadata URI');
|
|
24
24
|
|
|
25
25
|
const { productId, localeOrTokenFilename, tokenFileName } = req.params as any;
|
|
26
|
-
const locale = tokenFileName ? new Intl.Locale(localeOrTokenFilename) : localeContext;
|
|
27
26
|
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
const product = await loaders.productLoader.load({ productId });
|
|
28
|
+
|
|
29
|
+
const [token] = await modules.warehousing.findTokens({
|
|
31
30
|
chainTokenId: (tokenFileName || localeOrTokenFilename).toLowerCase().replace('.json', ''),
|
|
31
|
+
contractAddress: product?.tokenization?.contractAddress,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const ercMetadata = await services.warehousing.ercMetadata({
|
|
35
|
+
product,
|
|
36
|
+
token,
|
|
37
|
+
locale: tokenFileName ? new Intl.Locale(localeOrTokenFilename) : locale,
|
|
32
38
|
});
|
|
33
39
|
|
|
34
40
|
if (!ercMetadata) return notFoundHandler(res);
|
package/src/fastify/index.ts
CHANGED
|
@@ -10,8 +10,11 @@ import { API_EVENTS } from '../events.js';
|
|
|
10
10
|
import { User } from '@unchainedshop/core-users';
|
|
11
11
|
import fastifySession from '@fastify/session';
|
|
12
12
|
import fastifyCookie from '@fastify/cookie';
|
|
13
|
+
import fastifyMultipart from '@fastify/multipart';
|
|
13
14
|
import { FastifyBaseLogger, FastifyInstance, FastifyRequest } from 'fastify';
|
|
14
15
|
import { createLogger } from '@unchainedshop/logger';
|
|
16
|
+
import mcpHandler from './mcpHandler.js';
|
|
17
|
+
import tempUploadHandler from './tempUploadHandler.js';
|
|
15
18
|
|
|
16
19
|
const resolveUserRemoteAddress = (req: FastifyRequest) => {
|
|
17
20
|
const remoteAddress =
|
|
@@ -25,8 +28,10 @@ const resolveUserRemoteAddress = (req: FastifyRequest) => {
|
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
const {
|
|
31
|
+
MCP_API_PATH = '/mcp',
|
|
28
32
|
GRAPHQL_API_PATH = '/graphql',
|
|
29
33
|
BULK_IMPORT_API_PATH = '/bulk-import',
|
|
34
|
+
TEMP_UPLOAD_API_PATH = '/temp-upload',
|
|
30
35
|
ERC_METADATA_API_PATH = '/erc-metadata/:productId/:localeOrTokenFilename/:tokenFileName?',
|
|
31
36
|
UNCHAINED_COOKIE_NAME = 'unchained_token',
|
|
32
37
|
UNCHAINED_COOKIE_PATH = '/',
|
|
@@ -51,17 +56,16 @@ const middlewareHook = async function middlewareHook(req: any, reply: any) {
|
|
|
51
56
|
const tokenObject = {
|
|
52
57
|
_id: req.session.sessionId,
|
|
53
58
|
userId: user._id,
|
|
54
|
-
|
|
59
|
+
|
|
55
60
|
tokenExpires: new Date((req as any).session.cookie._expires),
|
|
56
61
|
};
|
|
57
62
|
await emit(API_EVENTS.API_LOGIN_TOKEN_CREATED, tokenObject);
|
|
58
|
-
|
|
63
|
+
|
|
59
64
|
(user as any)._inLoginMethodResponse = true;
|
|
60
65
|
return { user, ...tokenObject };
|
|
61
66
|
};
|
|
62
67
|
|
|
63
68
|
const logout: LogoutFn = async function logout() {
|
|
64
|
-
/* eslint-disable-line */
|
|
65
69
|
const tokenObject = {
|
|
66
70
|
_id: (req as any).session.sessionId,
|
|
67
71
|
userId: req.session?.userId,
|
|
@@ -113,7 +117,11 @@ export const connect = (
|
|
|
113
117
|
{
|
|
114
118
|
graphqlHandler,
|
|
115
119
|
db,
|
|
116
|
-
}: {
|
|
120
|
+
}: {
|
|
121
|
+
graphqlHandler: YogaServerInstance<any, any>;
|
|
122
|
+
db: mongodb.Db;
|
|
123
|
+
unchainedAPI: UnchainedCore;
|
|
124
|
+
},
|
|
117
125
|
{
|
|
118
126
|
allowRemoteToLocalhostSecureCookies = false,
|
|
119
127
|
}: { allowRemoteToLocalhostSecureCookies?: boolean } = {},
|
|
@@ -124,9 +132,13 @@ export const connect = (
|
|
|
124
132
|
fastify.addHook('preHandler', async function (request) {
|
|
125
133
|
request.headers['x-forwarded-proto'] = 'https';
|
|
126
134
|
});
|
|
127
|
-
fastify.addHook('onSend', async function (
|
|
135
|
+
fastify.addHook('onSend', async function (req, reply) {
|
|
128
136
|
reply.headers({
|
|
129
137
|
'Access-Control-Allow-Private-Network': 'true',
|
|
138
|
+
'Access-Control-Allow-Origin': req.headers.origin || '*',
|
|
139
|
+
'Access-Control-Allow-Credentials': 'true',
|
|
140
|
+
'Access-Control-Allow-Methods': ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'].join(', '),
|
|
141
|
+
'Access-Control-Allow-Headers': req.headers['access-control-request-headers'] || '*',
|
|
130
142
|
});
|
|
131
143
|
});
|
|
132
144
|
}
|
|
@@ -191,6 +203,23 @@ export const connect = (
|
|
|
191
203
|
handler: ercMetadataHandler,
|
|
192
204
|
});
|
|
193
205
|
|
|
206
|
+
fastify.route({
|
|
207
|
+
url: MCP_API_PATH,
|
|
208
|
+
method: ['GET', 'POST', 'DELETE'],
|
|
209
|
+
handler: mcpHandler,
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
fastify.register((s, opts, registered) => {
|
|
213
|
+
s.register(fastifyMultipart);
|
|
214
|
+
s.route({
|
|
215
|
+
url: TEMP_UPLOAD_API_PATH,
|
|
216
|
+
method: ['POST'],
|
|
217
|
+
bodyLimit: 1024 * 1024 * 35, // 35MB
|
|
218
|
+
handler: tempUploadHandler,
|
|
219
|
+
});
|
|
220
|
+
registered();
|
|
221
|
+
});
|
|
222
|
+
|
|
194
223
|
fastify.register((s, opts, registered) => {
|
|
195
224
|
s.removeAllContentTypeParsers();
|
|
196
225
|
s.addContentTypeParser('*', function (req, payload, done) {
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
+
import { Context } from '../context.js';
|
|
3
|
+
import { FastifyRequest, RouteHandlerMethod } from 'fastify';
|
|
4
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
5
|
+
import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
+
import createMcpServer from '../mcp/index.js';
|
|
7
|
+
|
|
8
|
+
const logger = createLogger('unchained:mcp-handler');
|
|
9
|
+
|
|
10
|
+
const transports: Record<string, StreamableHTTPServerTransport> = {};
|
|
11
|
+
|
|
12
|
+
const mcpHandler: RouteHandlerMethod = async (
|
|
13
|
+
req: FastifyRequest & { unchainedContext: Context },
|
|
14
|
+
res,
|
|
15
|
+
) => {
|
|
16
|
+
if (!req.unchainedContext.user) {
|
|
17
|
+
res.status(401);
|
|
18
|
+
res.header(
|
|
19
|
+
'WWW-Authenticate',
|
|
20
|
+
`Bearer realm="Unchained MCP", error="invalid_token", resource="${process.env.ROOT_URL || 'http://localhost:4010'}",`,
|
|
21
|
+
);
|
|
22
|
+
return res.send(
|
|
23
|
+
JSON.stringify({
|
|
24
|
+
error: 'invalid_token',
|
|
25
|
+
resource_metadata: `${process.env.ROOT_URL || 'http://localhost:4010'}/.well-known/oauth-protected-resource`,
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
if (req.method === 'POST') {
|
|
32
|
+
const sessionId = req.headers['mcp-session-id'] as string | undefined;
|
|
33
|
+
|
|
34
|
+
let transport: StreamableHTTPServerTransport;
|
|
35
|
+
|
|
36
|
+
if (sessionId && transports[sessionId]) {
|
|
37
|
+
// Reuse existing transport
|
|
38
|
+
transport = transports[sessionId];
|
|
39
|
+
} else if (!sessionId && isInitializeRequest(req.body)) {
|
|
40
|
+
// New initialization request
|
|
41
|
+
transport = new StreamableHTTPServerTransport({
|
|
42
|
+
sessionIdGenerator: () => crypto.randomUUID(),
|
|
43
|
+
onsessioninitialized: (sessionId) => {
|
|
44
|
+
// Store the transport by session ID
|
|
45
|
+
transports[sessionId] = transport;
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Clean up transport when closed
|
|
50
|
+
transport.onclose = () => {
|
|
51
|
+
if (transport.sessionId) {
|
|
52
|
+
delete transports[transport.sessionId];
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const roles = req.unchainedContext.user.roles || [];
|
|
57
|
+
const server = createMcpServer(req.unchainedContext, roles);
|
|
58
|
+
await server.connect(transport);
|
|
59
|
+
} else {
|
|
60
|
+
// Invalid request
|
|
61
|
+
res.status(400);
|
|
62
|
+
return res.send(
|
|
63
|
+
JSON.stringify({
|
|
64
|
+
jsonrpc: '2.0',
|
|
65
|
+
error: {
|
|
66
|
+
code: -32000,
|
|
67
|
+
message: 'Bad Request: No valid session ID provided',
|
|
68
|
+
},
|
|
69
|
+
id: null,
|
|
70
|
+
}),
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
await transport.handleRequest(req.raw, res.raw, req.body);
|
|
75
|
+
return res;
|
|
76
|
+
} else if (req.method === 'GET' || req.method === 'DELETE') {
|
|
77
|
+
const sessionId = req.headers['mcp-session-id'] as string | undefined;
|
|
78
|
+
if (!sessionId || !transports[sessionId]) {
|
|
79
|
+
res.status(400).send('Invalid or missing session ID');
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const transport = transports[sessionId];
|
|
84
|
+
await transport.handleRequest(req.raw, res.raw);
|
|
85
|
+
return res;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
res.status(405);
|
|
89
|
+
return res.send('Method Not Allowed');
|
|
90
|
+
} catch (e) {
|
|
91
|
+
logger.error(e.message);
|
|
92
|
+
res.status(503);
|
|
93
|
+
return res.send(JSON.stringify({ name: e.name, code: e.code, message: e.message }));
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default mcpHandler;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
+
import { getFileAdapter } from '@unchainedshop/core-files';
|
|
3
|
+
import { checkAction } from '../acl.js';
|
|
4
|
+
import { actions } from '../roles/index.js';
|
|
5
|
+
import { Context } from '../context.js';
|
|
6
|
+
import { FastifyRequest, RouteHandlerMethod } from 'fastify';
|
|
7
|
+
|
|
8
|
+
const logger = createLogger('unchained:temp-upload');
|
|
9
|
+
|
|
10
|
+
const tempUploadHandler: RouteHandlerMethod = async (
|
|
11
|
+
req: FastifyRequest & { file: any; unchainedContext: Context },
|
|
12
|
+
res,
|
|
13
|
+
) => {
|
|
14
|
+
try {
|
|
15
|
+
const context = req.unchainedContext;
|
|
16
|
+
|
|
17
|
+
await checkAction(context, (actions as any).uploadTempFile);
|
|
18
|
+
|
|
19
|
+
const data = await req.file();
|
|
20
|
+
|
|
21
|
+
const file = await context.services.files.uploadFileFromStream({
|
|
22
|
+
directoryName: 'temp-uploads',
|
|
23
|
+
rawFile: Promise.resolve({
|
|
24
|
+
filename: data.filename,
|
|
25
|
+
createReadStream: () => data.file,
|
|
26
|
+
mimetype: data.mimetype,
|
|
27
|
+
}),
|
|
28
|
+
meta: { fieldname: data.fieldname, encoding: data.encoding },
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Add an expiration date to this file manually!
|
|
32
|
+
const expires = new Date(Date.now() + 24 * 60 * 60 * 1000);
|
|
33
|
+
await context.modules.files.update(file._id, {
|
|
34
|
+
expires, // Default to 1 hour
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const fileUploadAdapter = getFileAdapter();
|
|
38
|
+
const rawUrl = await fileUploadAdapter.createDownloadURL(file);
|
|
39
|
+
const url = context.modules.files.normalizeUrl(rawUrl, {});
|
|
40
|
+
const body = JSON.stringify({ fileId: file._id, url, expires: expires.toISOString() });
|
|
41
|
+
res.status(200);
|
|
42
|
+
res.header('Content-Length', Buffer.byteLength(body));
|
|
43
|
+
res.header('Content-Type', 'application/json');
|
|
44
|
+
return res.send(body);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
logger.error(e.message);
|
|
47
|
+
res.status(503);
|
|
48
|
+
return res.send(JSON.stringify({ name: e.name, code: e.code, message: e.message }));
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default tempUploadHandler;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { AssortmentLink } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
|
|
5
|
+
export default (unchainedAPI: UnchainedCore) =>
|
|
6
|
+
new DataLoader<{ parentAssortmentId: string; childAssortmentId: string }, AssortmentLink>(
|
|
7
|
+
async (queries) => {
|
|
8
|
+
const parentAssortmentIds = [...new Set(queries.map((q) => q.parentAssortmentId).filter(Boolean))];
|
|
9
|
+
|
|
10
|
+
const links = await unchainedAPI.modules.assortments.links.findLinks({
|
|
11
|
+
parentAssortmentIds,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const assortmentLinkMap = {};
|
|
15
|
+
for (const link of links) {
|
|
16
|
+
if (!assortmentLinkMap[link.parentAssortmentId]) {
|
|
17
|
+
assortmentLinkMap[link.parentAssortmentId] = [link];
|
|
18
|
+
} else {
|
|
19
|
+
assortmentLinkMap[link.parentAssortmentId].push(link);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return queries.map((q) => {
|
|
24
|
+
if (q.childAssortmentId) {
|
|
25
|
+
return assortmentLinkMap[q.parentAssortmentId].find(
|
|
26
|
+
(link) => link.childAssortmentId === q.childAssortmentId,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return assortmentLinkMap[q.parentAssortmentId][0];
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { AssortmentLink } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
|
|
5
|
+
export default (unchainedAPI: UnchainedCore) =>
|
|
6
|
+
new DataLoader<
|
|
7
|
+
{ parentAssortmentId?: string; childAssortmentId?: string; assortmentId?: string },
|
|
8
|
+
AssortmentLink[]
|
|
9
|
+
>(async (queries) => {
|
|
10
|
+
const parentAssortmentIds = queries.flatMap((q) => q.parentAssortmentId).filter(Boolean);
|
|
11
|
+
const childAssortmentIds = queries.flatMap((q) => q.childAssortmentId).filter(Boolean);
|
|
12
|
+
const assortmentIds = queries.flatMap((q) => q.assortmentId).filter(Boolean);
|
|
13
|
+
|
|
14
|
+
const allLinks = await unchainedAPI.modules.assortments.links.findLinks({
|
|
15
|
+
assortmentIds: [...new Set([...parentAssortmentIds, ...childAssortmentIds, ...assortmentIds])],
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const parentAssortmentLinkMap = {};
|
|
19
|
+
const childAssortmentLinkMap = {};
|
|
20
|
+
|
|
21
|
+
for (const link of allLinks) {
|
|
22
|
+
if (!parentAssortmentLinkMap[link.parentAssortmentId]) {
|
|
23
|
+
parentAssortmentLinkMap[link.parentAssortmentId] = [link];
|
|
24
|
+
} else {
|
|
25
|
+
parentAssortmentLinkMap[link.parentAssortmentId].push(link);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!childAssortmentLinkMap[link.childAssortmentId]) {
|
|
29
|
+
childAssortmentLinkMap[link.childAssortmentId] = [link];
|
|
30
|
+
} else {
|
|
31
|
+
childAssortmentLinkMap[link.childAssortmentId].push(link);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return queries.map((q) => {
|
|
36
|
+
if (q.parentAssortmentId) {
|
|
37
|
+
return parentAssortmentLinkMap[q.parentAssortmentId] || [];
|
|
38
|
+
} else if (q.childAssortmentId) {
|
|
39
|
+
return childAssortmentLinkMap[q.childAssortmentId] || [];
|
|
40
|
+
}
|
|
41
|
+
return [
|
|
42
|
+
...(parentAssortmentLinkMap[q.assortmentId] || []),
|
|
43
|
+
...(childAssortmentLinkMap[q.assortmentId] || []),
|
|
44
|
+
];
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { Assortment } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
|
|
5
|
+
export default (unchainedAPI: UnchainedCore) =>
|
|
6
|
+
new DataLoader<{ assortmentId: string }, Assortment>(async (queries) => {
|
|
7
|
+
const assortmentIds = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
|
|
8
|
+
|
|
9
|
+
const assortments = await unchainedAPI.modules.assortments.findAssortments({
|
|
10
|
+
assortmentIds,
|
|
11
|
+
includeInactive: true,
|
|
12
|
+
includeLeaves: true,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const assortmentMap = {};
|
|
16
|
+
for (const assortment of assortments) {
|
|
17
|
+
assortmentMap[assortment._id] = assortment;
|
|
18
|
+
}
|
|
19
|
+
return queries.map((q) => assortmentMap[q.assortmentId]);
|
|
20
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { AssortmentMediaText } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
import buildTextMap from './buildTextMap.js';
|
|
5
|
+
import buildLocaleMap from './buildLocaleMap.js';
|
|
6
|
+
|
|
7
|
+
export default (unchainedAPI: UnchainedCore) =>
|
|
8
|
+
new DataLoader<{ assortmentMediaId: string; locale: Intl.Locale }, AssortmentMediaText>(
|
|
9
|
+
async (queries) => {
|
|
10
|
+
const assortmentMediaIds = [...new Set(queries.map((q) => q.assortmentMediaId).filter(Boolean))];
|
|
11
|
+
|
|
12
|
+
const texts = await unchainedAPI.modules.assortments.media.texts.findMediaTexts(
|
|
13
|
+
{ assortmentMediaId: { $in: assortmentMediaIds } },
|
|
14
|
+
{
|
|
15
|
+
sort: {
|
|
16
|
+
assortmentMediaId: 1,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const localeMap = buildLocaleMap(queries, texts);
|
|
22
|
+
const textsMap = buildTextMap(localeMap, texts, (text) => text.assortmentMediaId);
|
|
23
|
+
|
|
24
|
+
return queries.map((q) => textsMap[q.locale + q.assortmentMediaId]);
|
|
25
|
+
},
|
|
26
|
+
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { AssortmentMediaType } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
|
|
5
|
+
export default (unchainedAPI: UnchainedCore) =>
|
|
6
|
+
new DataLoader<{ assortmentId?: string }, AssortmentMediaType[]>(async (queries) => {
|
|
7
|
+
const assortmentIds = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
|
|
8
|
+
const assortmentMediaItems = await unchainedAPI.modules.assortments.media.findAssortmentMedias({
|
|
9
|
+
assortmentId: { $in: assortmentIds },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const assortmentMediaMap = {};
|
|
13
|
+
for (const assortmentMedia of assortmentMediaItems) {
|
|
14
|
+
if (!assortmentMediaMap[assortmentMedia.assortmentId]) {
|
|
15
|
+
assortmentMediaMap[assortmentMedia.assortmentId] = [assortmentMedia];
|
|
16
|
+
} else {
|
|
17
|
+
assortmentMediaMap[assortmentMedia.assortmentId].push(assortmentMedia);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return queries.map((q) => assortmentMediaMap[q.assortmentId] || []);
|
|
21
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { AssortmentProduct } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
|
|
5
|
+
export default (unchainedAPI: UnchainedCore) =>
|
|
6
|
+
new DataLoader<{ assortmentId: string; productId: string }, AssortmentProduct>(async (queries) => {
|
|
7
|
+
const assortmentIds = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
|
|
8
|
+
|
|
9
|
+
const assortmentProducts = await unchainedAPI.modules.assortments.products.findAssortmentProducts({
|
|
10
|
+
assortmentIds,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const assortmentProductMap = {};
|
|
14
|
+
for (const assortmentProduct of assortmentProducts) {
|
|
15
|
+
assortmentProductMap[assortmentProduct.assortmentId + assortmentProduct.productId] =
|
|
16
|
+
assortmentProduct;
|
|
17
|
+
}
|
|
18
|
+
return queries.map((q) => assortmentProductMap[q.assortmentId + q.productId]);
|
|
19
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { AssortmentProduct } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
|
|
5
|
+
export default (unchainedAPI: UnchainedCore) =>
|
|
6
|
+
new DataLoader<{ productId: string }, AssortmentProduct[]>(async (queries) => {
|
|
7
|
+
const productIds = [...new Set(queries.map((q) => q.productId).filter(Boolean))];
|
|
8
|
+
|
|
9
|
+
const assortmentProducts = await unchainedAPI.modules.assortments.products.findAssortmentProducts({
|
|
10
|
+
productIds,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const assortmentProductsMap = {};
|
|
14
|
+
for (const assortmentProduct of assortmentProducts) {
|
|
15
|
+
if (!assortmentProductsMap[assortmentProduct.productId]) {
|
|
16
|
+
assortmentProductsMap[assortmentProduct.productId] = [assortmentProduct];
|
|
17
|
+
} else {
|
|
18
|
+
assortmentProductsMap[assortmentProduct.productId].push(assortmentProduct);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return queries.map((q) => assortmentProductsMap[q.productId] || []);
|
|
22
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { AssortmentText } from '@unchainedshop/core-assortments';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
import buildTextMap from './buildTextMap.js';
|
|
5
|
+
import buildLocaleMap from './buildLocaleMap.js';
|
|
6
|
+
|
|
7
|
+
export default (unchainedAPI: UnchainedCore) =>
|
|
8
|
+
new DataLoader<{ assortmentId: string; locale: Intl.Locale }, AssortmentText>(async (queries) => {
|
|
9
|
+
const assortmentIds = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
|
|
10
|
+
|
|
11
|
+
const texts = await unchainedAPI.modules.assortments.texts.findTexts(
|
|
12
|
+
{ assortmentId: { $in: assortmentIds } },
|
|
13
|
+
{
|
|
14
|
+
sort: {
|
|
15
|
+
assortmentId: 1,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const localeMap = buildLocaleMap(queries, texts);
|
|
21
|
+
const textsMap = buildTextMap(localeMap, texts, (text) => text.assortmentId);
|
|
22
|
+
|
|
23
|
+
return queries.map((q) => textsMap[q.locale + q.assortmentId]);
|
|
24
|
+
});
|
|
@@ -19,7 +19,11 @@ const testTexts = [
|
|
|
19
19
|
|
|
20
20
|
describe('buildLocaleMap', () => {
|
|
21
21
|
it('Mixed usage of default locale and forced languages', () => {
|
|
22
|
-
const queries = [
|
|
22
|
+
const queries = [
|
|
23
|
+
{ locale: new Intl.Locale('de-CH') },
|
|
24
|
+
{ locale: new Intl.Locale('fr') },
|
|
25
|
+
{ locale: new Intl.Locale('it') },
|
|
26
|
+
];
|
|
23
27
|
const expected = {
|
|
24
28
|
de: ['de-CH', 'fr', 'it'],
|
|
25
29
|
fr: ['fr'],
|
|
@@ -30,7 +34,7 @@ describe('buildLocaleMap', () => {
|
|
|
30
34
|
});
|
|
31
35
|
|
|
32
36
|
it('Mixed usage of forced languages', () => {
|
|
33
|
-
const queries = [{ locale: 'fr' }, { locale: 'it' }];
|
|
37
|
+
const queries = [{ locale: new Intl.Locale('fr') }, { locale: new Intl.Locale('it') }];
|
|
34
38
|
const expected = {
|
|
35
39
|
de: ['fr', 'it'],
|
|
36
40
|
fr: ['fr'],
|
|
@@ -41,16 +45,16 @@ describe('buildLocaleMap', () => {
|
|
|
41
45
|
});
|
|
42
46
|
|
|
43
47
|
it('Only default locale', () => {
|
|
44
|
-
const queries = [{ locale: '
|
|
48
|
+
const queries = [{ locale: new Intl.Locale('de-CH') }];
|
|
45
49
|
const expected = {
|
|
46
|
-
de: ['
|
|
50
|
+
de: ['de-CH'],
|
|
47
51
|
};
|
|
48
52
|
const result = buildLocaleMap(queries, testTexts);
|
|
49
53
|
assert.deepStrictEqual(result, expected);
|
|
50
54
|
});
|
|
51
55
|
|
|
52
56
|
it('Only one forced language locale', () => {
|
|
53
|
-
const queries = [{ locale: 'fr' }];
|
|
57
|
+
const queries = [{ locale: new Intl.Locale('fr') }];
|
|
54
58
|
const expected = {
|
|
55
59
|
fr: ['fr'],
|
|
56
60
|
de: ['fr'],
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { systemLocale } from '@unchainedshop/utils';
|
|
2
2
|
|
|
3
|
-
function getLocaleStrings(locale:
|
|
3
|
+
function getLocaleStrings(locale: Intl.Locale): string[] {
|
|
4
4
|
try {
|
|
5
|
-
const localeObj = new Intl.Locale(locale);
|
|
6
|
-
// Optimized Set creation and spread
|
|
7
5
|
const locales = new Set<string>();
|
|
8
|
-
locales.add(
|
|
9
|
-
locales.add(
|
|
6
|
+
locales.add(locale.baseName);
|
|
7
|
+
locales.add(locale.language);
|
|
10
8
|
locales.add(systemLocale.baseName);
|
|
11
9
|
locales.add(systemLocale.language);
|
|
12
10
|
return Array.from(locales);
|
|
@@ -19,21 +17,57 @@ function getLocaleStrings(locale: string): string[] {
|
|
|
19
17
|
}
|
|
20
18
|
}
|
|
21
19
|
export default function buildLocaleMap(
|
|
22
|
-
queries:
|
|
23
|
-
texts:
|
|
20
|
+
queries: readonly { locale: Intl.Locale }[],
|
|
21
|
+
texts: readonly { locale?: string }[],
|
|
24
22
|
): Record<string, string[]> {
|
|
25
23
|
// key = texts.locale
|
|
26
24
|
// value = input query locale
|
|
27
25
|
const queryLocales = new Set(queries.map((q) => q.locale));
|
|
28
26
|
const textLocales = new Set(texts.map((t) => t.locale));
|
|
29
|
-
const localeMap = {};
|
|
27
|
+
const localeMap: Record<string, string[]> = {};
|
|
30
28
|
for (const queryLocale of queryLocales) {
|
|
31
29
|
const potentialMatches = getLocaleStrings(queryLocale);
|
|
32
30
|
const matches = potentialMatches.filter((l) => textLocales.has(l));
|
|
33
31
|
for (const match of matches) {
|
|
34
32
|
if (!localeMap[match]) localeMap[match] = [];
|
|
35
|
-
localeMap[match].push(queryLocale);
|
|
33
|
+
localeMap[match].push(queryLocale.toString());
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
return localeMap;
|
|
39
37
|
}
|
|
38
|
+
|
|
39
|
+
// import { systemLocale } from '@unchainedshop/utils';
|
|
40
|
+
|
|
41
|
+
// export function getLocaleStrings(locale: Intl.Locale) {
|
|
42
|
+
// try {
|
|
43
|
+
// return [
|
|
44
|
+
// ...new Set([locale.baseName, locale.language, systemLocale.baseName, systemLocale.language]),
|
|
45
|
+
// ];
|
|
46
|
+
// } catch {
|
|
47
|
+
// return [...new Set([systemLocale.baseName, systemLocale.language])];
|
|
48
|
+
// }
|
|
49
|
+
// }
|
|
50
|
+
|
|
51
|
+
// export function buildLocaleMap(
|
|
52
|
+
// queries: readonly { locale: Intl.Locale }[],
|
|
53
|
+
// texts: readonly { locale?: string }[],
|
|
54
|
+
// ): Record<string, string[]> {
|
|
55
|
+
// // key = texts.locale
|
|
56
|
+
// // value = input query locale
|
|
57
|
+
|
|
58
|
+
// const queryLocales = Object.values(
|
|
59
|
+
// Object.fromEntries(queries.map((q) => [q.locale.baseName, q.locale])),
|
|
60
|
+
// );
|
|
61
|
+
|
|
62
|
+
// const textLocales: string[] = [...new Set(texts.map((t) => t.locale))];
|
|
63
|
+
// const localeMap = {};
|
|
64
|
+
// for (const queryLocale of queryLocales) {
|
|
65
|
+
// const potentialMatches = getLocaleStrings(queryLocale);
|
|
66
|
+
// const matches = potentialMatches.filter((l) => textLocales.includes(l));
|
|
67
|
+
// for (const match of matches) {
|
|
68
|
+
// if (!localeMap[match]) localeMap[match] = [];
|
|
69
|
+
// localeMap[match].push(queryLocale);
|
|
70
|
+
// }
|
|
71
|
+
// }
|
|
72
|
+
// return localeMap;
|
|
73
|
+
// }
|
|
@@ -2,7 +2,7 @@ type ArrayElement<T> = T extends (infer U)[] ? U : never;
|
|
|
2
2
|
|
|
3
3
|
/* This file has been optimized for performance to the last drop. Don't refactor! */
|
|
4
4
|
|
|
5
|
-
export default function buildTextMap<T extends
|
|
5
|
+
export default function buildTextMap<T extends { locale?: string }[]>(
|
|
6
6
|
localeMap: Record<string, string[]>,
|
|
7
7
|
texts: Readonly<T>,
|
|
8
8
|
buildId: (item: ArrayElement<T>) => string,
|
|
@@ -10,16 +10,19 @@ export default function buildTextMap<T extends Array<{ locale?: string }>>(
|
|
|
10
10
|
const textsMap: Record<string, ArrayElement<T>> = {}; // Added type for textsMap
|
|
11
11
|
const localeMapKeys = Object.keys(localeMap);
|
|
12
12
|
|
|
13
|
+
// eslint-disable-next-line
|
|
13
14
|
for (let i = 0; i < localeMapKeys.length; i++) {
|
|
14
15
|
const originLocale = localeMapKeys[i];
|
|
15
16
|
const localesForText = localeMap[originLocale];
|
|
16
17
|
|
|
18
|
+
// eslint-disable-next-line
|
|
17
19
|
for (let j = 0; j < texts.length; j++) {
|
|
18
20
|
const text = texts[j];
|
|
19
21
|
if (originLocale !== text.locale) continue;
|
|
20
22
|
|
|
21
23
|
const idPart = buildId(text as ArrayElement<T>); // Ensured correct type for buildId argument
|
|
22
24
|
|
|
25
|
+
// eslint-disable-next-line
|
|
23
26
|
for (let k = 0; k < localesForText.length; k++) {
|
|
24
27
|
const locale = localesForText[k];
|
|
25
28
|
const key = locale + idPart;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { Country } from '@unchainedshop/core-countries';
|
|
3
|
+
import DataLoader from 'dataloader';
|
|
4
|
+
|
|
5
|
+
export default (unchainedAPI: UnchainedCore) =>
|
|
6
|
+
new DataLoader<{ isoCode: string }, Country>(async (queries) => {
|
|
7
|
+
const isoCodes = [...new Set(queries.map((q) => q.isoCode).filter(Boolean))];
|
|
8
|
+
|
|
9
|
+
const countries = await unchainedAPI.modules.countries.findCountries({
|
|
10
|
+
isoCode: { $in: isoCodes },
|
|
11
|
+
includeInactive: true,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const countryMap = {};
|
|
15
|
+
for (const country of countries) {
|
|
16
|
+
countryMap[country.isoCode] = country;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return queries.map((q) => countryMap[q.isoCode]);
|
|
20
|
+
});
|