@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
|
@@ -12,7 +12,7 @@ export default [
|
|
|
12
12
|
updated: DateTime
|
|
13
13
|
published: DateTime
|
|
14
14
|
media(limit: Int = 10, offset: Int = 0, tags: [LowerCaseString!]): [ProductMedia!]!
|
|
15
|
-
texts(forceLocale:
|
|
15
|
+
texts(forceLocale: Locale): ProductTexts
|
|
16
16
|
bundleItems: [ProductBundleItem!]
|
|
17
17
|
reviews(
|
|
18
18
|
limit: Int = 10
|
|
@@ -14,20 +14,20 @@ export default [
|
|
|
14
14
|
|
|
15
15
|
type ProductVariationTexts @cacheControl(maxAge: 180) {
|
|
16
16
|
_id: ID!
|
|
17
|
-
locale: Locale
|
|
17
|
+
locale: Locale!
|
|
18
18
|
title: String
|
|
19
19
|
subtitle: String
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
type ProductVariationOption @cacheControl(maxAge: 180) {
|
|
23
23
|
_id: ID!
|
|
24
|
-
texts(forceLocale:
|
|
24
|
+
texts(forceLocale: Locale): ProductVariationTexts
|
|
25
25
|
value: String
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
type ProductVariation @cacheControl(maxAge: 180) {
|
|
29
29
|
_id: ID!
|
|
30
|
-
texts(forceLocale:
|
|
30
|
+
texts(forceLocale: Locale): ProductVariationTexts
|
|
31
31
|
type: ProductVariationType
|
|
32
32
|
key: String
|
|
33
33
|
options: [ProductVariationOption!]
|
|
@@ -71,7 +71,7 @@ export default [
|
|
|
71
71
|
updated: DateTime
|
|
72
72
|
published: DateTime
|
|
73
73
|
media(limit: Int = 10, offset: Int = 0, tags: [LowerCaseString!]): [ProductMedia!]!
|
|
74
|
-
texts(forceLocale:
|
|
74
|
+
texts(forceLocale: Locale): ProductTexts
|
|
75
75
|
assortmentPaths: [ProductAssortmentPath!]!
|
|
76
76
|
siblings(
|
|
77
77
|
assortmentId: ID
|
|
@@ -90,13 +90,13 @@ export default [
|
|
|
90
90
|
quantity: Int = 0
|
|
91
91
|
vectors: [ProductAssignmentVectorInput!]
|
|
92
92
|
includeInactive: Boolean = false
|
|
93
|
-
|
|
93
|
+
currencyCode: String
|
|
94
94
|
): PriceRange
|
|
95
95
|
simulatedPriceRange(
|
|
96
96
|
quantity: Int
|
|
97
97
|
vectors: [ProductAssignmentVectorInput!]
|
|
98
98
|
includeInactive: Boolean = false
|
|
99
|
-
|
|
99
|
+
currencyCode: String
|
|
100
100
|
useNetPrice: Boolean = false
|
|
101
101
|
): PriceRange @cacheControl(scope: PRIVATE)
|
|
102
102
|
|
|
@@ -41,16 +41,16 @@ export default [
|
|
|
41
41
|
updated: DateTime
|
|
42
42
|
published: DateTime
|
|
43
43
|
media(limit: Int = 10, offset: Int = 0, tags: [LowerCaseString!]): [ProductMedia!]!
|
|
44
|
-
texts(forceLocale:
|
|
45
|
-
catalogPrice(quantity: Int = 1,
|
|
46
|
-
leveledCatalogPrices(
|
|
44
|
+
texts(forceLocale: Locale): ProductTexts
|
|
45
|
+
catalogPrice(quantity: Int = 1, currencyCode: String): Price
|
|
46
|
+
leveledCatalogPrices(currencyCode: String): [PriceLevel!]!
|
|
47
47
|
simulatedPrice(
|
|
48
|
-
|
|
48
|
+
currencyCode: String
|
|
49
49
|
useNetPrice: Boolean = false
|
|
50
50
|
quantity: Int = 1
|
|
51
51
|
configuration: [ProductConfigurationParameterInput!]
|
|
52
52
|
): Price @cacheControl(scope: PRIVATE)
|
|
53
|
-
assortmentPaths(forceLocale:
|
|
53
|
+
assortmentPaths(forceLocale: Locale): [ProductAssortmentPath!]!
|
|
54
54
|
siblings(
|
|
55
55
|
assortmentId: ID
|
|
56
56
|
limit: Int = 10
|
|
@@ -25,7 +25,7 @@ export default [
|
|
|
25
25
|
|
|
26
26
|
type ProductMediaTexts @cacheControl(maxAge: 180) {
|
|
27
27
|
_id: ID!
|
|
28
|
-
locale: Locale
|
|
28
|
+
locale: Locale!
|
|
29
29
|
title: String
|
|
30
30
|
subtitle: String
|
|
31
31
|
}
|
|
@@ -35,12 +35,12 @@ export default [
|
|
|
35
35
|
tags: [LowerCaseString!]
|
|
36
36
|
file: Media
|
|
37
37
|
sortKey: Int!
|
|
38
|
-
texts(forceLocale:
|
|
38
|
+
texts(forceLocale: Locale): ProductMediaTexts
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
type ProductTexts @cacheControl(maxAge: 180) {
|
|
42
42
|
_id: ID!
|
|
43
|
-
locale: Locale
|
|
43
|
+
locale: Locale!
|
|
44
44
|
slug: String
|
|
45
45
|
title: String
|
|
46
46
|
subtitle: String
|
|
@@ -61,7 +61,7 @@ export default [
|
|
|
61
61
|
created: DateTime
|
|
62
62
|
updated: DateTime
|
|
63
63
|
published: DateTime
|
|
64
|
-
texts(forceLocale:
|
|
64
|
+
texts(forceLocale: Locale): ProductTexts
|
|
65
65
|
media(limit: Int = 10, offset: Int = 0, tags: [LowerCaseString!]): [ProductMedia!]!
|
|
66
66
|
reviews(
|
|
67
67
|
limit: Int = 10
|
|
@@ -12,11 +12,11 @@ export default [
|
|
|
12
12
|
updated: DateTime
|
|
13
13
|
published: DateTime
|
|
14
14
|
media(limit: Int = 10, offset: Int = 0, tags: [LowerCaseString!]): [ProductMedia!]!
|
|
15
|
-
texts(forceLocale:
|
|
16
|
-
catalogPrice(quantity: Int = 1,
|
|
17
|
-
leveledCatalogPrices(
|
|
15
|
+
texts(forceLocale: Locale): ProductTexts
|
|
16
|
+
catalogPrice(quantity: Int = 1, currencyCode: String): Price
|
|
17
|
+
leveledCatalogPrices(currencyCode: String): [PriceLevel!]!
|
|
18
18
|
simulatedPrice(
|
|
19
|
-
|
|
19
|
+
currencyCode: String
|
|
20
20
|
useNetPrice: Boolean = false
|
|
21
21
|
quantity: Int = 1
|
|
22
22
|
configuration: [ProductConfigurationParameterInput!]
|
|
@@ -31,17 +31,17 @@ export default [
|
|
|
31
31
|
updated: DateTime
|
|
32
32
|
published: DateTime
|
|
33
33
|
media(limit: Int = 10, offset: Int = 0, tags: [LowerCaseString!]): [ProductMedia!]!
|
|
34
|
-
texts(forceLocale:
|
|
35
|
-
catalogPrice(quantity: Int = 1,
|
|
36
|
-
leveledCatalogPrices(
|
|
34
|
+
texts(forceLocale: Locale): ProductTexts
|
|
35
|
+
catalogPrice(quantity: Int = 1, currencyCode: String): Price
|
|
36
|
+
leveledCatalogPrices(currencyCode: String): [PriceLevel!]!
|
|
37
37
|
simulatedPrice(
|
|
38
|
-
|
|
38
|
+
currencyCode: String
|
|
39
39
|
useNetPrice: Boolean = false
|
|
40
40
|
quantity: Int = 1
|
|
41
41
|
configuration: [ProductConfigurationParameterInput!]
|
|
42
42
|
): Price @cacheControl(scope: PRIVATE, maxAge: 10)
|
|
43
43
|
simulatedStocks(referenceDate: Timestamp): [Stock!] @cacheControl(scope: PRIVATE, maxAge: 10)
|
|
44
|
-
assortmentPaths(forceLocale:
|
|
44
|
+
assortmentPaths(forceLocale: Locale): [ProductAssortmentPath!]!
|
|
45
45
|
siblings(
|
|
46
46
|
assortmentId: ID
|
|
47
47
|
limit: Int = 10
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-rc.3",
|
|
4
4
|
"main": "lib/api-index.js",
|
|
5
5
|
"types": "lib/api-index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -31,17 +31,23 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@ethereumjs/util": ">=
|
|
35
|
-
"@fastify/cookie": ">= 11.0 < 12",
|
|
36
|
-
"@fastify/session": ">= 11.0 < 12",
|
|
37
|
-
"connect-mongo": ">= 5.1.0 < 6",
|
|
38
|
-
"express": ">= 5.0 < 6",
|
|
39
|
-
"express-session": ">= 1.18 < 2",
|
|
34
|
+
"@ethereumjs/util": ">= 10 < 11",
|
|
40
35
|
"fastify": ">= 5.2 < 6",
|
|
41
|
-
"
|
|
36
|
+
"@fastify/cookie": ">= 11 < 12",
|
|
37
|
+
"@fastify/session": ">= 11 < 12",
|
|
38
|
+
"@fastify/multipart": ">= 9 < 10",
|
|
39
|
+
"connect-mongo": ">= 5.1 < 6",
|
|
40
|
+
"@modelcontextprotocol/sdk": ">= 1 < 2",
|
|
41
|
+
"express": ">= 5 < 6",
|
|
42
|
+
"express-session": ">= 1.18 < 2",
|
|
43
|
+
"multer": ">= 2 < 3",
|
|
44
|
+
"graphql-yoga": ">= 5.9 < 6",
|
|
42
45
|
"passport": ">= 0.7 < 1"
|
|
43
46
|
},
|
|
44
47
|
"peerDependenciesMeta": {
|
|
48
|
+
"@modelcontextprotocol/sdk": {
|
|
49
|
+
"optional": false
|
|
50
|
+
},
|
|
45
51
|
"graphql-yoga": {
|
|
46
52
|
"optional": false
|
|
47
53
|
},
|
|
@@ -51,9 +57,15 @@
|
|
|
51
57
|
"@ethereumjs/util": {
|
|
52
58
|
"optional": true
|
|
53
59
|
},
|
|
60
|
+
"fastify": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
54
63
|
"@fastify/cookie": {
|
|
55
64
|
"optional": true
|
|
56
65
|
},
|
|
66
|
+
"@fastify/multipart": {
|
|
67
|
+
"optional": true
|
|
68
|
+
},
|
|
57
69
|
"@fastify/session": {
|
|
58
70
|
"optional": true
|
|
59
71
|
},
|
|
@@ -63,7 +75,7 @@
|
|
|
63
75
|
"express-session": {
|
|
64
76
|
"optional": true
|
|
65
77
|
},
|
|
66
|
-
"
|
|
78
|
+
"multer": {
|
|
67
79
|
"optional": true
|
|
68
80
|
},
|
|
69
81
|
"passport": {
|
|
@@ -71,27 +83,31 @@
|
|
|
71
83
|
}
|
|
72
84
|
},
|
|
73
85
|
"dependencies": {
|
|
74
|
-
"@unchainedshop/core": "^
|
|
75
|
-
"@unchainedshop/events": "^
|
|
76
|
-
"@unchainedshop/logger": "^
|
|
77
|
-
"@unchainedshop/roles": "^
|
|
78
|
-
"@unchainedshop/utils": "^
|
|
86
|
+
"@unchainedshop/core": "^4.0.0-rc.3",
|
|
87
|
+
"@unchainedshop/events": "^4.0.0-rc.3",
|
|
88
|
+
"@unchainedshop/logger": "^4.0.0-rc.3",
|
|
89
|
+
"@unchainedshop/roles": "^4.0.0-rc.3",
|
|
90
|
+
"@unchainedshop/utils": "^4.0.0-rc.3",
|
|
79
91
|
"accounting": "0.4.1",
|
|
80
92
|
"dataloader": "^2.2.3",
|
|
81
93
|
"expiry-map": "^2.0.0",
|
|
82
94
|
"graphql-scalars": "^1.24.2",
|
|
83
95
|
"moniker": "0.1.2",
|
|
84
|
-
"p-memoize": "^7.1.1"
|
|
96
|
+
"p-memoize": "^7.1.1",
|
|
97
|
+
"zod": "^3.25.67"
|
|
85
98
|
},
|
|
86
99
|
"devDependencies": {
|
|
87
100
|
"@ethereumjs/util": "^10.0.0",
|
|
101
|
+
"fastify": "^5.4.0",
|
|
88
102
|
"@fastify/cookie": "^11.0.2",
|
|
89
103
|
"@fastify/session": "^11.1.0",
|
|
104
|
+
"@fastify/multipart": "^9.0.3",
|
|
105
|
+
"@modelcontextprotocol/sdk": "^1.13.1",
|
|
90
106
|
"@types/express": "^5.0.3",
|
|
91
107
|
"@types/node": "^24.0.4",
|
|
92
108
|
"express": "^5.1.0",
|
|
93
109
|
"express-session": "^1.18.1",
|
|
94
|
-
"
|
|
110
|
+
"multer": "^2.0.1",
|
|
95
111
|
"passport": "^0.7.0",
|
|
96
112
|
"tsx": "^4.20.3",
|
|
97
113
|
"typescript": "^5.8.3"
|
package/src/api-index.ts
CHANGED
|
@@ -38,7 +38,10 @@ export const startAPIServer = async (options: UnchainedServerOptions) => {
|
|
|
38
38
|
...serverOptions
|
|
39
39
|
} = options || {};
|
|
40
40
|
|
|
41
|
-
const contextResolver = createContextResolver(unchainedAPI, {
|
|
41
|
+
const contextResolver = createContextResolver(unchainedAPI, {
|
|
42
|
+
roles,
|
|
43
|
+
adminUiConfig,
|
|
44
|
+
});
|
|
42
45
|
|
|
43
46
|
setCurrentContextResolver(
|
|
44
47
|
customContext
|
package/src/context.ts
CHANGED
|
@@ -31,12 +31,12 @@ export interface AdminUiConfig {
|
|
|
31
31
|
singleSignOnURL?: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export
|
|
34
|
+
export interface UnchainedHTTPServerContext {
|
|
35
35
|
setHeader: (key: string, value: string) => void;
|
|
36
36
|
getHeader: (key: string) => string;
|
|
37
37
|
remoteAddress?: string;
|
|
38
38
|
remotePort?: number;
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
40
|
|
|
41
41
|
export type Context = UnchainedCore & {
|
|
42
42
|
version?: string;
|
|
@@ -83,7 +83,7 @@ export const createContextResolver =
|
|
|
83
83
|
logout,
|
|
84
84
|
}) => {
|
|
85
85
|
const abstractHttpServerContext = { remoteAddress, remotePort, getHeader, setHeader };
|
|
86
|
-
const loaders =
|
|
86
|
+
const loaders = instantiateLoaders(unchainedAPI);
|
|
87
87
|
const localeContext = await getLocaleContext(abstractHttpServerContext, unchainedAPI);
|
|
88
88
|
const userContext: UnchainedUserContext = { login, logout, impersonatorId };
|
|
89
89
|
|
|
@@ -4,8 +4,8 @@ import { createYoga, createSchema, YogaServerOptions } from 'graphql-yoga';
|
|
|
4
4
|
const logger = createLogger('unchained:api');
|
|
5
5
|
|
|
6
6
|
export type GraphQLServerOptions = YogaServerOptions<any, any> & {
|
|
7
|
-
typeDefs?:
|
|
8
|
-
resolvers?:
|
|
7
|
+
typeDefs?: string[];
|
|
8
|
+
resolvers?: Record<string, any>[];
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export default async (options: GraphQLServerOptions) => {
|
package/src/errors.ts
CHANGED
|
@@ -183,10 +183,6 @@ export const MultipleBookmarksFound = createError(
|
|
|
183
183
|
'The convenience bookmark mutation cannot be used because multiple bookmarks were explicitly created with different metadata',
|
|
184
184
|
);
|
|
185
185
|
|
|
186
|
-
export const QueryStringRequiredError = createError(
|
|
187
|
-
'QueryStringRequiredError',
|
|
188
|
-
'Query string is required when no assortments are in scope',
|
|
189
|
-
);
|
|
190
186
|
export const PaymentProviderNotFoundError = createError(
|
|
191
187
|
'PaymentProviderNotFoundError',
|
|
192
188
|
'Payment provider not found',
|
|
@@ -305,6 +301,16 @@ export const ProductLinkedToQuotationError = createError(
|
|
|
305
301
|
'Product is part of a requested/proposed quotations item, remove it from any requested/proposed quotations item before deleting',
|
|
306
302
|
);
|
|
307
303
|
|
|
304
|
+
export const ProductVariationVectorAlreadySet = createError(
|
|
305
|
+
'ProductVariationVectorAlreadySet',
|
|
306
|
+
'Product variation vector is already set, remove the existing one before setting a new one',
|
|
307
|
+
);
|
|
308
|
+
|
|
309
|
+
export const ProductVariationVectorInvalid = createError(
|
|
310
|
+
'ProductVariationVectorInvalid',
|
|
311
|
+
'Product variation vector is invalid/incomplete',
|
|
312
|
+
);
|
|
313
|
+
|
|
308
314
|
export const FileNotFoundError = createError('FileNotFoundError', 'File not found');
|
|
309
315
|
|
|
310
316
|
export const FileUploadExpiredError = createError('FileUploadExpired', 'File upload has expired');
|
|
@@ -23,19 +23,25 @@ const ercMetadataMiddleware: RequestHandler = async (
|
|
|
23
23
|
return methodWrongHandler(res);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const { services,
|
|
26
|
+
const { services, modules, loaders, locale } = req.unchainedContext;
|
|
27
27
|
const url = new URL(req.url, ROOT_URL);
|
|
28
28
|
const parsedPath = path.parse(url.pathname);
|
|
29
29
|
|
|
30
30
|
if (parsedPath.ext !== '.json') throw new Error('Invalid ERC Metadata URI');
|
|
31
31
|
|
|
32
32
|
const [, productId, localeOrTokenFilename, tokenFileName] = url.pathname.split('/');
|
|
33
|
-
const locale = tokenFileName ? new Intl.Locale(localeOrTokenFilename) : localeContext;
|
|
34
33
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const product = await loaders.productLoader.load({ productId });
|
|
35
|
+
|
|
36
|
+
const [token] = await modules.warehousing.findTokens({
|
|
38
37
|
chainTokenId: parsedPath.name,
|
|
38
|
+
contractAddress: product?.tokenization?.contractAddress,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const ercMetadata = await services.warehousing.ercMetadata({
|
|
42
|
+
product,
|
|
43
|
+
token,
|
|
44
|
+
locale: tokenFileName ? new Intl.Locale(localeOrTokenFilename) : locale,
|
|
39
45
|
});
|
|
40
46
|
|
|
41
47
|
if (!ercMetadata) {
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
2
|
+
import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import createMcpServer from '../mcp/index.js';
|
|
4
|
+
import { Request, RequestHandler } from 'express';
|
|
5
|
+
import { Context } from '../context.js';
|
|
6
|
+
|
|
7
|
+
// Map to store transports by session ID
|
|
8
|
+
const transports: Record<string, StreamableHTTPServerTransport> = {};
|
|
9
|
+
|
|
10
|
+
const handlePostRequest: RequestHandler = async (req: Request & { unchainedContext: Context }, res) => {
|
|
11
|
+
// Check for existing session ID
|
|
12
|
+
|
|
13
|
+
const sessionId = req.headers['mcp-session-id'] as string | undefined;
|
|
14
|
+
|
|
15
|
+
let transport: StreamableHTTPServerTransport;
|
|
16
|
+
|
|
17
|
+
if (sessionId && transports[sessionId]) {
|
|
18
|
+
// Reuse existing transport
|
|
19
|
+
transport = transports[sessionId];
|
|
20
|
+
} else if (!sessionId && isInitializeRequest(req.body)) {
|
|
21
|
+
// New initialization request
|
|
22
|
+
transport = new StreamableHTTPServerTransport({
|
|
23
|
+
sessionIdGenerator: () => crypto.randomUUID(),
|
|
24
|
+
onsessioninitialized: (sessionId) => {
|
|
25
|
+
// Store the transport by session ID
|
|
26
|
+
transports[sessionId] = transport;
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Clean up transport when closed
|
|
31
|
+
transport.onclose = () => {
|
|
32
|
+
if (transport.sessionId) {
|
|
33
|
+
delete transports[transport.sessionId];
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const roles = req.unchainedContext.user.roles || [];
|
|
38
|
+
const server = createMcpServer(req.unchainedContext, roles);
|
|
39
|
+
await server.connect(transport);
|
|
40
|
+
} else {
|
|
41
|
+
// Invalid request
|
|
42
|
+
res.status(400).json({
|
|
43
|
+
jsonrpc: '2.0',
|
|
44
|
+
error: {
|
|
45
|
+
code: -32000,
|
|
46
|
+
message: 'Bad Request: No valid session ID provided',
|
|
47
|
+
},
|
|
48
|
+
id: null,
|
|
49
|
+
});
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Handle the request
|
|
54
|
+
await transport.handleRequest(req, res, req.body);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// Reusable handler for GET and DELETE requests
|
|
58
|
+
const handleSessionRequest: RequestHandler = async (req, res) => {
|
|
59
|
+
const sessionId = req.headers['mcp-session-id'] as string | undefined;
|
|
60
|
+
if (!sessionId || !transports[sessionId]) {
|
|
61
|
+
res.status(400).send('Invalid or missing session ID');
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const transport = transports[sessionId];
|
|
66
|
+
await transport.handleRequest(req, res);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const createMCPMiddleware: RequestHandler = (req, res, next) => {
|
|
70
|
+
if (!(req as any).unchainedContext.user) {
|
|
71
|
+
res.status(401);
|
|
72
|
+
res.header(
|
|
73
|
+
'WWW-Authenticate',
|
|
74
|
+
`Bearer realm="Unchained MCP", error="invalid_token", resource="${process.env.ROOT_URL || 'http://localhost:4010'}",`,
|
|
75
|
+
);
|
|
76
|
+
res.json({
|
|
77
|
+
error: 'invalid_token',
|
|
78
|
+
resource_metadata: `${process.env.ROOT_URL || 'http://localhost:4010'}/.well-known/oauth-protected-resource`,
|
|
79
|
+
});
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (req.method === 'POST') {
|
|
84
|
+
return handlePostRequest(req, res, next);
|
|
85
|
+
} else if (req.method === 'GET' || req.method === 'DELETE') {
|
|
86
|
+
return handleSessionRequest(req, res, next);
|
|
87
|
+
}
|
|
88
|
+
res.status(405).send('Method Not Allowed');
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export default createMCPMiddleware;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
+
import { checkAction } from '../acl.js';
|
|
3
|
+
import { actions } from '../roles/index.js';
|
|
4
|
+
import { Context } from '../context.js';
|
|
5
|
+
import { getFileAdapter } from '@unchainedshop/core-files';
|
|
6
|
+
|
|
7
|
+
const logger = createLogger('unchained:temp-upload');
|
|
8
|
+
|
|
9
|
+
const methodWrongHandler = (res) => {
|
|
10
|
+
logger.error('Method not supported, return 404');
|
|
11
|
+
res.writeHead(404);
|
|
12
|
+
res.end();
|
|
13
|
+
return;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default async function tempUploadMiddleware(
|
|
17
|
+
req: Request & { query?: any; files: any; unchainedContext: Context },
|
|
18
|
+
res,
|
|
19
|
+
) {
|
|
20
|
+
try {
|
|
21
|
+
const context = req.unchainedContext;
|
|
22
|
+
|
|
23
|
+
if (req.method !== 'POST') {
|
|
24
|
+
return methodWrongHandler(res);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
await checkAction(context, (actions as any).uploadTempFile);
|
|
28
|
+
|
|
29
|
+
const [data] = req.files || [];
|
|
30
|
+
|
|
31
|
+
const file = await context.services.files.uploadFileFromStream({
|
|
32
|
+
directoryName: 'temp-uploads',
|
|
33
|
+
rawFile: {
|
|
34
|
+
filename: data.originalname,
|
|
35
|
+
buffer: data.buffer,
|
|
36
|
+
mimetype: data.mimetype,
|
|
37
|
+
},
|
|
38
|
+
meta: { fieldname: data.fieldname, encoding: data.encoding },
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Add an expiration date to this file manually!
|
|
42
|
+
const expires = new Date(Date.now() + 24 * 60 * 60 * 1000);
|
|
43
|
+
await context.modules.files.update(file._id, {
|
|
44
|
+
expires, // Default to 1 hour
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const fileUploadAdapter = getFileAdapter();
|
|
48
|
+
const rawUrl = await fileUploadAdapter.createDownloadURL(file);
|
|
49
|
+
const url = context.modules.files.normalizeUrl(rawUrl, {});
|
|
50
|
+
const body = JSON.stringify({ fileId: file._id, url, expires: expires.toISOString() });
|
|
51
|
+
|
|
52
|
+
res.writeHead(200);
|
|
53
|
+
res.end(body);
|
|
54
|
+
} catch (e) {
|
|
55
|
+
logger.error(e.message);
|
|
56
|
+
res.writeHead(503);
|
|
57
|
+
res.end(JSON.stringify({ name: e.name, code: e.code, message: e.message }));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}
|
package/src/express/index.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import e from 'express';
|
|
2
|
-
import { getCurrentContextResolver, LoginFn, LogoutFn } from '../context.js';
|
|
3
|
-
import createBulkImportMiddleware from './createBulkImportMiddleware.js';
|
|
4
|
-
import createERCMetadataMiddleware from './createERCMetadataMiddleware.js';
|
|
5
2
|
import session from 'express-session';
|
|
3
|
+
import multer from 'multer';
|
|
6
4
|
import MongoStore from 'connect-mongo';
|
|
7
5
|
import { Passport } from 'passport';
|
|
8
6
|
import { YogaServerInstance } from 'graphql-yoga';
|
|
9
7
|
import { mongodb } from '@unchainedshop/mongodb';
|
|
10
8
|
import { UnchainedCore } from '@unchainedshop/core';
|
|
11
9
|
import { emit } from '@unchainedshop/events';
|
|
12
|
-
import { API_EVENTS } from '../events.js';
|
|
13
10
|
import { User } from '@unchainedshop/core-users';
|
|
14
11
|
|
|
12
|
+
import { getCurrentContextResolver, LoginFn, LogoutFn } from '../context.js';
|
|
13
|
+
import createBulkImportMiddleware from './createBulkImportMiddleware.js';
|
|
14
|
+
import createERCMetadataMiddleware from './createERCMetadataMiddleware.js';
|
|
15
|
+
import createTempUploadMiddleware from './createTempUploadMiddleware.js';
|
|
16
|
+
import createMCPMiddleware from './createMCPMiddleware.js';
|
|
17
|
+
import { API_EVENTS } from '../events.js';
|
|
18
|
+
|
|
15
19
|
const resolveUserRemoteAddress = (req: e.Request) => {
|
|
16
20
|
const remoteAddress =
|
|
17
21
|
(req.headers['x-real-ip'] as string) ||
|
|
@@ -23,9 +27,14 @@ const resolveUserRemoteAddress = (req: e.Request) => {
|
|
|
23
27
|
return { remoteAddress, remotePort };
|
|
24
28
|
};
|
|
25
29
|
|
|
30
|
+
const storage = multer.memoryStorage();
|
|
31
|
+
const upload = multer({ storage: storage });
|
|
32
|
+
|
|
26
33
|
const {
|
|
27
34
|
BULK_IMPORT_API_PATH = '/bulk-import',
|
|
28
35
|
ERC_METADATA_API_PATH = '/erc-metadata',
|
|
36
|
+
TEMP_UPLOAD_API_PATH = '/temp-upload',
|
|
37
|
+
MCP_API_PATH = '/mcp',
|
|
29
38
|
GRAPHQL_API_PATH = '/graphql',
|
|
30
39
|
UNCHAINED_COOKIE_NAME = 'unchained_token',
|
|
31
40
|
UNCHAINED_COOKIE_PATH = '/',
|
|
@@ -62,18 +71,17 @@ const addContext = async function middlewareWithContext(
|
|
|
62
71
|
const tokenObject = {
|
|
63
72
|
_id: (req as any).sessionID,
|
|
64
73
|
userId: user._id,
|
|
65
|
-
|
|
74
|
+
|
|
66
75
|
tokenExpires: new Date((req as any).session?.cookie._expires),
|
|
67
76
|
};
|
|
68
77
|
|
|
69
78
|
await emit(API_EVENTS.API_LOGIN_TOKEN_CREATED, tokenObject);
|
|
70
79
|
|
|
71
|
-
/* eslint-disable-next-line */
|
|
72
80
|
(user as any)._inLoginMethodResponse = true;
|
|
73
81
|
return { user, ...tokenObject };
|
|
74
82
|
};
|
|
75
83
|
|
|
76
|
-
const logout: LogoutFn = async (sessionId) => {
|
|
84
|
+
const logout: LogoutFn = async (sessionId) => {
|
|
77
85
|
// TODO: this should only logout an explicitly provided session if sessionID
|
|
78
86
|
// has been provided
|
|
79
87
|
// express-session destroy
|
|
@@ -127,10 +135,16 @@ export const connect = (
|
|
|
127
135
|
{
|
|
128
136
|
graphqlHandler,
|
|
129
137
|
db,
|
|
130
|
-
}: {
|
|
138
|
+
}: {
|
|
139
|
+
graphqlHandler: YogaServerInstance<any, any>;
|
|
140
|
+
db: mongodb.Db;
|
|
141
|
+
unchainedAPI: UnchainedCore;
|
|
142
|
+
},
|
|
131
143
|
{
|
|
132
144
|
allowRemoteToLocalhostSecureCookies = false,
|
|
133
|
-
}: {
|
|
145
|
+
}: {
|
|
146
|
+
allowRemoteToLocalhostSecureCookies?: boolean;
|
|
147
|
+
} = {},
|
|
134
148
|
) => {
|
|
135
149
|
if (allowRemoteToLocalhostSecureCookies) {
|
|
136
150
|
// Workaround: Allow to use sandbox with localhost
|
|
@@ -138,6 +152,16 @@ export const connect = (
|
|
|
138
152
|
expressApp.use((req, res, next) => {
|
|
139
153
|
req.headers['x-forwarded-proto'] = 'https';
|
|
140
154
|
res.setHeader('Access-Control-Allow-Private-Network', 'true');
|
|
155
|
+
res.setHeader('Access-Control-Allow-Origin', req.headers.origin || '*');
|
|
156
|
+
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
|
157
|
+
res.setHeader(
|
|
158
|
+
'Access-Control-Allow-Methods',
|
|
159
|
+
['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'].join(', '),
|
|
160
|
+
);
|
|
161
|
+
res.setHeader(
|
|
162
|
+
'Access-Control-Allow-Headers',
|
|
163
|
+
req.headers['access-control-request-headers'] || '*',
|
|
164
|
+
);
|
|
141
165
|
next();
|
|
142
166
|
});
|
|
143
167
|
}
|
|
@@ -190,4 +214,8 @@ export const connect = (
|
|
|
190
214
|
expressApp.use(GRAPHQL_API_PATH, graphqlHandler.handle);
|
|
191
215
|
expressApp.use(ERC_METADATA_API_PATH, createERCMetadataMiddleware);
|
|
192
216
|
expressApp.use(BULK_IMPORT_API_PATH, createBulkImportMiddleware);
|
|
217
|
+
expressApp.use(TEMP_UPLOAD_API_PATH, upload.any(), createTempUploadMiddleware);
|
|
218
|
+
|
|
219
|
+
expressApp.use(MCP_API_PATH, e.json({ limit: '10mb' }));
|
|
220
|
+
expressApp.use(MCP_API_PATH, createMCPMiddleware);
|
|
193
221
|
};
|