@unchainedshop/api 4.0.0-rc.2 → 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/errors.d.ts +1 -1
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -1
- package/lib/errors.js.map +1 -1
- package/lib/express/chatRouter.d.ts +3 -0
- package/lib/express/chatRouter.d.ts.map +1 -0
- package/lib/express/chatRouter.js +86 -0
- package/lib/express/chatRouter.js.map +1 -0
- package/lib/express/createApolloMiddleware.d.ts +4 -0
- package/lib/express/createApolloMiddleware.d.ts.map +1 -0
- package/lib/express/createApolloMiddleware.js +36 -0
- package/lib/express/createApolloMiddleware.js.map +1 -0
- 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/createMCPMiddleware.d.ts +2 -6
- package/lib/express/createMCPMiddleware.d.ts.map +1 -1
- package/lib/express/createMCPMiddleware.js +73 -42
- package/lib/express/createMCPMiddleware.js.map +1 -1
- package/lib/express/createSingleSignOnMiddleware.d.ts +5 -0
- package/lib/express/createSingleSignOnMiddleware.d.ts.map +1 -0
- package/lib/express/createSingleSignOnMiddleware.js +71 -0
- package/lib/express/createSingleSignOnMiddleware.js.map +1 -0
- 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 -4
- 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/index.d.ts.map +1 -1
- package/lib/fastify/index.js +24 -2
- 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 +3 -7
- package/lib/fastify/mcpHandler.d.ts.map +1 -1
- package/lib/fastify/mcpHandler.js +71 -39
- package/lib/fastify/mcpHandler.js.map +1 -1
- 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/hashPassword.d.ts +2 -0
- package/lib/hashPassword.d.ts.map +1 -0
- package/lib/hashPassword.js +5 -0
- package/lib/hashPassword.js.map +1 -0
- package/lib/loaders/assortmentMediaTextLoader.js +1 -1
- package/lib/loaders/assortmentMediaTextLoader.js.map +1 -1
- package/lib/loaders/assortmentTextLoader.js +1 -1
- package/lib/loaders/assortmentTextLoader.js.map +1 -1
- package/lib/loaders/buildLocaleMap.d.ts +6 -0
- package/lib/loaders/buildLocaleMap.d.ts.map +1 -0
- package/lib/loaders/buildLocaleMap.js +67 -0
- package/lib/loaders/buildLocaleMap.js.map +1 -0
- package/lib/loaders/buildTextMap.d.ts +1 -1
- package/lib/loaders/buildTextMap.d.ts.map +1 -1
- package/lib/loaders/buildTextMap.js +19 -6
- package/lib/loaders/buildTextMap.js.map +1 -1
- package/lib/loaders/filterTextLoader.js +1 -1
- package/lib/loaders/filterTextLoader.js.map +1 -1
- package/lib/loaders/productMediaTextLoader.d.ts.map +1 -1
- package/lib/loaders/productMediaTextLoader.js +1 -1
- package/lib/loaders/productMediaTextLoader.js.map +1 -1
- package/lib/loaders/productTextLoader.d.ts.map +1 -1
- package/lib/loaders/productTextLoader.js +1 -1
- package/lib/loaders/productTextLoader.js.map +1 -1
- package/lib/mcp/index.d.ts +3 -94
- package/lib/mcp/index.d.ts.map +1 -1
- package/lib/mcp/index.js +45 -135
- package/lib/mcp/index.js.map +1 -1
- package/lib/mcp/tools/addProductAssignmentHandler.d.ts +52 -0
- package/lib/mcp/tools/addProductAssignmentHandler.d.ts.map +1 -0
- package/lib/mcp/tools/addProductAssignmentHandler.js +97 -0
- package/lib/mcp/tools/addProductAssignmentHandler.js.map +1 -0
- 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/countriesHandler.d.ts +60 -0
- package/lib/mcp/tools/countriesHandler.d.ts.map +1 -0
- package/lib/mcp/tools/countriesHandler.js +48 -0
- package/lib/mcp/tools/countriesHandler.js.map +1 -0
- package/lib/mcp/tools/countryHandler.d.ts +20 -0
- package/lib/mcp/tools/countryHandler.d.ts.map +1 -0
- package/lib/mcp/tools/countryHandler.js +34 -0
- package/lib/mcp/tools/countryHandler.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/createProduct.d.ts +138 -0
- package/lib/mcp/tools/createProduct.d.ts.map +1 -0
- package/lib/mcp/tools/createProduct.js +60 -0
- package/lib/mcp/tools/createProduct.js.map +1 -0
- package/lib/mcp/tools/createProductVariationHandler.d.ts +84 -0
- package/lib/mcp/tools/createProductVariationHandler.d.ts.map +1 -0
- package/lib/mcp/tools/createProductVariationHandler.js +73 -0
- package/lib/mcp/tools/createProductVariationHandler.js.map +1 -0
- 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/currenciesHandler.d.ts +60 -0
- package/lib/mcp/tools/currenciesHandler.d.ts.map +1 -0
- package/lib/mcp/tools/currenciesHandler.js +50 -0
- package/lib/mcp/tools/currenciesHandler.js.map +1 -0
- package/lib/mcp/tools/currencyHandler.d.ts +20 -0
- package/lib/mcp/tools/currencyHandler.d.ts.map +1 -0
- package/lib/mcp/tools/currencyHandler.js +34 -0
- package/lib/mcp/tools/currencyHandler.js.map +1 -0
- package/lib/mcp/tools/getProduct.d.ts +48 -0
- package/lib/mcp/tools/getProduct.d.ts.map +1 -0
- package/lib/mcp/tools/getProduct.js +61 -0
- package/lib/mcp/tools/getProduct.js.map +1 -0
- package/lib/mcp/tools/index.d.ts +39 -0
- package/lib/mcp/tools/index.d.ts.map +1 -0
- package/lib/mcp/tools/index.js +39 -0
- package/lib/mcp/tools/index.js.map +1 -0
- package/lib/mcp/tools/languageHandler.d.ts +20 -0
- package/lib/mcp/tools/languageHandler.d.ts.map +1 -0
- package/lib/mcp/tools/languageHandler.js +31 -0
- package/lib/mcp/tools/languageHandler.js.map +1 -0
- package/lib/mcp/tools/languagesHandler.d.ts +60 -0
- package/lib/mcp/tools/languagesHandler.d.ts.map +1 -0
- package/lib/mcp/tools/languagesHandler.js +42 -0
- package/lib/mcp/tools/languagesHandler.js.map +1 -0
- package/lib/mcp/tools/listProducts.d.ts +112 -0
- package/lib/mcp/tools/listProducts.d.ts.map +1 -0
- package/lib/mcp/tools/listProducts.js +110 -0
- package/lib/mcp/tools/listProducts.js.map +1 -0
- package/lib/mcp/tools/normalizeMediaUrl.d.ts +3 -0
- package/lib/mcp/tools/normalizeMediaUrl.d.ts.map +1 -0
- package/lib/mcp/tools/normalizeMediaUrl.js +21 -0
- package/lib/mcp/tools/normalizeMediaUrl.js.map +1 -0
- 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/productsCountHandler.d.ts +32 -0
- package/lib/mcp/tools/productsCountHandler.d.ts.map +1 -0
- package/lib/mcp/tools/productsCountHandler.js +33 -0
- package/lib/mcp/tools/productsCountHandler.js.map +1 -0
- package/lib/mcp/tools/publishProduct.d.ts +20 -0
- package/lib/mcp/tools/publishProduct.d.ts.map +1 -0
- package/lib/mcp/tools/publishProduct.js +40 -0
- package/lib/mcp/tools/publishProduct.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/removeProduct.d.ts +20 -0
- package/lib/mcp/tools/removeProduct.d.ts.map +1 -0
- package/lib/mcp/tools/removeProduct.js +34 -0
- package/lib/mcp/tools/removeProduct.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/removeProductVariationHandler.d.ts +20 -0
- package/lib/mcp/tools/removeProductVariationHandler.d.ts.map +1 -0
- package/lib/mcp/tools/removeProductVariationHandler.js +43 -0
- package/lib/mcp/tools/removeProductVariationHandler.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/unPublishProduct.d.ts +20 -0
- package/lib/mcp/tools/unPublishProduct.d.ts.map +1 -0
- package/lib/mcp/tools/unPublishProduct.js +40 -0
- package/lib/mcp/tools/unPublishProduct.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/updateProduct.d.ts +56 -0
- package/lib/mcp/tools/updateProduct.d.ts.map +1 -0
- package/lib/mcp/tools/updateProduct.js +44 -0
- package/lib/mcp/tools/updateProduct.js.map +1 -0
- package/lib/mcp/tools/updateProductCommerceHandler.d.ts +166 -0
- package/lib/mcp/tools/updateProductCommerceHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductCommerceHandler.js +64 -0
- package/lib/mcp/tools/updateProductCommerceHandler.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/tools/updateProductPlanHandler.d.ts +72 -0
- package/lib/mcp/tools/updateProductPlanHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductPlanHandler.js +51 -0
- package/lib/mcp/tools/updateProductPlanHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductSupplyHandler.d.ts +64 -0
- package/lib/mcp/tools/updateProductSupplyHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductSupplyHandler.js +52 -0
- package/lib/mcp/tools/updateProductSupplyHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductTextsHandler.d.ts +114 -0
- package/lib/mcp/tools/updateProductTextsHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductTextsHandler.js +50 -0
- package/lib/mcp/tools/updateProductTextsHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductTokenizationHandler.d.ts +72 -0
- package/lib/mcp/tools/updateProductTokenizationHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductTokenizationHandler.js +49 -0
- package/lib/mcp/tools/updateProductTokenizationHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductWarehousingHandler.d.ts +48 -0
- package/lib/mcp/tools/updateProductWarehousingHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductWarehousingHandler.js +45 -0
- package/lib/mcp/tools/updateProductWarehousingHandler.js.map +1 -0
- package/lib/mcp/utils/getNormalizedProductDetails.d.ts +26 -0
- package/lib/mcp/utils/getNormalizedProductDetails.d.ts.map +1 -0
- package/lib/mcp/utils/getNormalizedProductDetails.js +38 -0
- package/lib/mcp/utils/getNormalizedProductDetails.js.map +1 -0
- package/lib/mcp/utils/normalizeMediaUrl.d.ts +3 -0
- package/lib/mcp/utils/normalizeMediaUrl.d.ts.map +1 -0
- package/lib/mcp/utils/normalizeMediaUrl.js +21 -0
- package/lib/mcp/utils/normalizeMediaUrl.js.map +1 -0
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.d.ts +3 -0
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.js +6 -0
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.js.map +1 -0
- package/lib/resolvers/mutations/accounts/disableTOTP.d.ts +6 -0
- package/lib/resolvers/mutations/accounts/disableTOTP.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/disableTOTP.js +27 -0
- package/lib/resolvers/mutations/accounts/disableTOTP.js.map +1 -0
- package/lib/resolvers/mutations/accounts/enableTOTP.d.ts +6 -0
- package/lib/resolvers/mutations/accounts/enableTOTP.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/enableTOTP.js +20 -0
- package/lib/resolvers/mutations/accounts/enableTOTP.js.map +1 -0
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.d.ts +7 -0
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.js +30 -0
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.js.map +1 -0
- package/lib/resolvers/mutations/accounts/loginWithOAuth.d.ts +8 -0
- package/lib/resolvers/mutations/accounts/loginWithOAuth.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/loginWithOAuth.js +25 -0
- package/lib/resolvers/mutations/accounts/loginWithOAuth.js.map +1 -0
- package/lib/resolvers/mutations/accounts/logoutAllSessions.d.ts +5 -0
- package/lib/resolvers/mutations/accounts/logoutAllSessions.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/logoutAllSessions.js +20 -0
- package/lib/resolvers/mutations/accounts/logoutAllSessions.js.map +1 -0
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.d.ts +6 -0
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.js +13 -0
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.js.map +1 -0
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.d.ts +6 -0
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.d.ts.map +1 -0
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.js +18 -0
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.js.map +1 -0
- package/lib/resolvers/mutations/products/addProductAssignment.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/addProductAssignment.js +3 -1
- package/lib/resolvers/mutations/products/addProductAssignment.js.map +1 -1
- package/lib/resolvers/mutations/products/addProductMedia.d.ts +6 -0
- package/lib/resolvers/mutations/products/addProductMedia.d.ts.map +1 -0
- package/lib/resolvers/mutations/products/addProductMedia.js +18 -0
- package/lib/resolvers/mutations/products/addProductMedia.js.map +1 -0
- package/lib/resolvers/mutations/users/updateUserAvatar.d.ts +6 -0
- package/lib/resolvers/mutations/users/updateUserAvatar.d.ts.map +1 -0
- package/lib/resolvers/mutations/users/updateUserAvatar.js +22 -0
- package/lib/resolvers/mutations/users/updateUserAvatar.js.map +1 -0
- package/lib/resolvers/mutations/utils/getOrderCart.d.ts +7 -0
- package/lib/resolvers/mutations/utils/getOrderCart.d.ts.map +1 -0
- package/lib/resolvers/mutations/utils/getOrderCart.js +13 -0
- package/lib/resolvers/mutations/utils/getOrderCart.js.map +1 -0
- package/lib/resolvers/queries/filters/searchAssortments.d.ts.map +1 -1
- package/lib/resolvers/queries/filters/searchAssortments.js +0 -5
- 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 +2 -7
- package/lib/resolvers/queries/filters/searchProducts.js.map +1 -1
- package/lib/resolvers/type/dispatch-types.d.ts +15 -0
- package/lib/resolvers/type/dispatch-types.d.ts.map +1 -0
- package/lib/resolvers/type/dispatch-types.js +16 -0
- package/lib/resolvers/type/dispatch-types.js.map +1 -0
- package/lib/resolvers/type/oauth-account.d.ts +6 -0
- package/lib/resolvers/type/oauth-account.d.ts.map +1 -0
- package/lib/resolvers/type/oauth-account.js +7 -0
- package/lib/resolvers/type/oauth-account.js.map +1 -0
- package/lib/resolvers/type/oauth-provider.d.ts +6 -0
- package/lib/resolvers/type/oauth-provider.d.ts.map +1 -0
- package/lib/resolvers/type/oauth-provider.js +6 -0
- package/lib/resolvers/type/oauth-provider.js.map +1 -0
- package/lib/resolvers/type/stock-types.d.ts +14 -0
- package/lib/resolvers/type/stock-types.d.ts.map +1 -0
- package/lib/resolvers/type/stock-types.js +15 -0
- package/lib/resolvers/type/stock-types.js.map +1 -0
- package/lib/roles/all.d.ts.map +1 -1
- package/lib/roles/all.js +1 -0
- 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/user-context.d.ts +7 -0
- package/lib/user-context.d.ts.map +1 -0
- package/lib/user-context.js +76 -0
- package/lib/user-context.js.map +1 -0
- package/package.json +34 -18
- package/src/api-index.ts +4 -1
- package/src/errors.ts +5 -4
- package/src/express/createMCPMiddleware.ts +91 -0
- package/src/express/createTempUploadMiddleware.ts +60 -0
- package/src/express/index.ts +35 -6
- package/src/fastify/index.ts +32 -2
- package/src/fastify/mcpHandler.ts +97 -0
- package/src/fastify/tempUploadHandler.ts +52 -0
- package/src/loaders/assortmentMediaTextLoader.ts +1 -1
- package/src/loaders/assortmentTextLoader.ts +1 -1
- package/src/loaders/buildLocaleMap.test.ts +65 -0
- package/src/loaders/buildLocaleMap.ts +73 -0
- package/src/loaders/buildTextMap.test.ts +54 -0
- package/src/loaders/buildTextMap.ts +25 -6
- package/src/loaders/filterTextLoader.ts +1 -1
- package/src/loaders/productMediaTextLoader.ts +1 -1
- package/src/loaders/productTextLoader.ts +1 -1
- 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/products/addProductAssignment.ts +3 -0
- package/src/resolvers/queries/filters/searchAssortments.ts +0 -5
- package/src/resolvers/queries/filters/searchProducts.ts +2 -7
- package/src/roles/all.ts +1 -0
- package/src/roles/index.ts +1 -0
- package/src/roles/loggedIn.ts +1 -0
- package/lib/express/mcpHandler.d.ts.map +0 -1
- package/lib/express/mcpHandler.js +0 -68
- package/lib/express/mcpHandler.js.map +0 -1
- package/lib/fastify/index copy.d.ts.map +0 -1
- package/lib/fastify/index copy.js +0 -157
- package/lib/fastify/index copy.js.map +0 -1
- package/lib/mcp/server.d.ts +0 -4
- package/lib/mcp/server.d.ts.map +0 -1
- package/lib/mcp/server.js +0 -60
- package/lib/mcp/server.js.map +0 -1
- package/lib/mcp/types.d.ts +0 -28
- package/lib/mcp/types.d.ts.map +0 -1
- package/lib/mcp/types.js +0 -2
- package/lib/mcp/types.js.map +0 -1
- package/lib/middleware/accountLockout.d.ts.map +0 -1
- package/lib/middleware/accountLockout.js +0 -84
- package/lib/middleware/accountLockout.js.map +0 -1
- package/lib/middleware/rateLimiter.d.ts.map +0 -1
- package/lib/middleware/rateLimiter.js +0 -91
- package/lib/middleware/rateLimiter.js.map +0 -1
- package/lib/plugins/inputValidation.d.ts.map +0 -1
- package/lib/plugins/inputValidation.js +0 -95
- package/lib/plugins/inputValidation.js.map +0 -1
- package/lib/utils/inputValidation.d.ts.map +0 -1
- package/lib/utils/inputValidation.js +0 -51
- package/lib/utils/inputValidation.js.map +0 -1
package/lib/mcp/index.js
CHANGED
|
@@ -1,138 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}, { forceLiveCollection: false, locale: new Intl.Locale('en') });
|
|
11
|
-
// Get products from the filtered product IDs
|
|
12
|
-
const productIds = searchResult.aggregatedFilteredProductIds.slice(offset, offset + limit);
|
|
13
|
-
const products = await Promise.all(productIds.map(async (productId) => {
|
|
14
|
-
const product = await unchainedAPI.modules.products.findProduct({ productId });
|
|
15
|
-
if (!product)
|
|
16
|
-
return null;
|
|
17
|
-
const texts = await unchainedAPI.modules.products.texts.findTexts({ productId }, { limit: 1 });
|
|
18
|
-
const media = await unchainedAPI.modules.products.media.findProductMedia({ productId });
|
|
19
|
-
// Simulate pricing to get the price
|
|
20
|
-
let price = null;
|
|
21
|
-
try {
|
|
22
|
-
const pricing = await unchainedAPI.services.products.simulateProductPricing({
|
|
23
|
-
product,
|
|
24
|
-
user: undefined, // Anonymous user
|
|
25
|
-
countryCode: 'CH',
|
|
26
|
-
currencyCode: 'CHF',
|
|
27
|
-
quantity: 1,
|
|
28
|
-
});
|
|
29
|
-
price = pricing?.total;
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
// Price simulation failed, continue without price
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
id: productId,
|
|
36
|
-
title: texts[0]?.title || 'Untitled Product',
|
|
37
|
-
image: media[0]?.file?.url || null,
|
|
38
|
-
price: price ? `${price.amount / 100} ${price.currency}` : 'Price not available',
|
|
39
|
-
breadcrumb: searchArgs.assortmentId ? `Assortment: ${searchArgs.assortmentId}` : null,
|
|
40
|
-
};
|
|
41
|
-
}));
|
|
42
|
-
// Load filters and options
|
|
43
|
-
const filters = await unchainedAPI.services.filters.loadFilters(searchResult.searchConfiguration.searchQuery, { productIds: searchResult.aggregatedFilteredProductIds, forceLiveCollection: false });
|
|
44
|
-
return {
|
|
45
|
-
summary: {
|
|
46
|
-
totalProducts: searchResult.aggregatedTotalProductIds.length,
|
|
47
|
-
filteredProducts: searchResult.aggregatedFilteredProductIds.length,
|
|
48
|
-
},
|
|
49
|
-
products: products.filter(Boolean),
|
|
50
|
-
filters,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
export function renderProductList(results) {
|
|
54
|
-
let output = `# Product Search Results\n\n`;
|
|
55
|
-
output += `Found ${results.summary.filteredProducts} products (${results.summary.totalProducts} total)\n\n`;
|
|
56
|
-
if (results.products.length > 0) {
|
|
57
|
-
output += `## Products\n\n`;
|
|
58
|
-
results.products.forEach((product, index) => {
|
|
59
|
-
output += `### ${index + 1}. ${product.title}\n`;
|
|
60
|
-
output += `- **ID**: ${product.id}\n`;
|
|
61
|
-
output += `- **Price**: ${product.price}\n`;
|
|
62
|
-
if (product.image) {
|
|
63
|
-
output += `- **Image**: \n`;
|
|
64
|
-
}
|
|
65
|
-
if (product.breadcrumb) {
|
|
66
|
-
output += `- **Location**: ${product.breadcrumb}\n`;
|
|
67
|
-
}
|
|
68
|
-
output += `\n`;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
if (results.filters && results.filters.length > 0) {
|
|
72
|
-
output += `## Available Filters\n\n`;
|
|
73
|
-
results.filters.forEach((filter) => {
|
|
74
|
-
output += `### ${filter.title} (${filter.key})\n`;
|
|
75
|
-
filter.options.forEach((option) => {
|
|
76
|
-
const selected = option.isSelected ? ' ✓' : '';
|
|
77
|
-
output += `- ${option.title} (${option.productsCount} products)${selected}\n`;
|
|
78
|
-
});
|
|
79
|
-
output += `\n`;
|
|
80
|
-
});
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { listProductsHandler, ListProductsSchema, getProductHandler, GetProductSchema, createProductHandler, CreateProductSchema, RemoveProductSchema, removeProductHandler, PublishProductSchema, publishProductHandler, UnpublishProductSchema, unpublishProductHandler, UpdateProductSchema, updateProductHandler, UpdateProductTextsSchema, updateProductTextsHandler, UpdateProductCommerceSchema, updateProductCommerceHandler, ListCurrenciesSchema, currenciesHandler, CurrencySchema, currencyHandler, ListCountriesSchema, countriesHandler, CountrySchema, countryHandler, ListLanguagesSchema, languagesHandler, LanguageSchema, languageHandler, UpdateProductSupplySchema, updateProductSupplyHandler, UpdateProductPlanSchema, updateProductPlanHandler, UpdateProductTokenizationSchema, updateProductTokenizationHandler, ProductsCountSchema, productsCountHandler, CreateProductVariationSchema, createProductVariationHandler, RemoveProductVariationSchema, removeProductVariationHandler, AssignProductVariationSchema, addProductAssignmentHandler, CreateProductVariationOptionSchema, createProductVariationOptionHandler, removeProductAssignmentHandler, RemoveProductVariationOptionSchema, removeProductVariationOptionHandler, RemoveProductAssignmentSchema, CreateLanguageSchema, createLanguageHandler, UpdateLanguageSchema, updateLanguageHandler, RemoveLanguageSchema, removeLanguageHandler, AddProductMediaUploadSchema, addProductMediaUploadHandler, RemoveProductMediaSchema, removeProductMediaHandler, UpdateProductMediaTextsSchema, updateProductMediaTextsHandler, ReorderProductMediaSchema, reorderProductMediaHandler, ProductReviewsCountSchema, productReviewsCountHandler, ProductReviewsSchema, productReviewsHandler, } from './tools/index.js';
|
|
3
|
+
export default function createMcpServer(context, roles) {
|
|
4
|
+
const server = new McpServer({
|
|
5
|
+
name: 'Unchained MCP Server',
|
|
6
|
+
version: '1.0.0',
|
|
7
|
+
});
|
|
8
|
+
if (!roles?.includes('admin')) {
|
|
9
|
+
return server;
|
|
81
10
|
}
|
|
82
|
-
|
|
11
|
+
server.tool('list_products', 'Search and list products with comprehensive filtering and pagination support', ListProductsSchema, async (params) => listProductsHandler(context, params));
|
|
12
|
+
server.tool('products_count', 'Search and returns total number of products registered in the system with comprehensive filtering if provided', ProductsCountSchema, async (params) => productsCountHandler(context, params));
|
|
13
|
+
server.tool('get_product', 'Get detailed product information', GetProductSchema, async (params) => getProductHandler(context, params));
|
|
14
|
+
server.tool('create_product', 'Adds or create new product the product will be in DRAFT/unpublish status', CreateProductSchema, async (params) => createProductHandler(context, params));
|
|
15
|
+
server.tool('remove_product', 'Removed or deletes a product by its id changing its status to DELETED and removing it from sale', RemoveProductSchema, async (params) => removeProductHandler(context, params));
|
|
16
|
+
server.tool('publish_product', 'Publish a product by its id changing it to active and available for sale', PublishProductSchema, async (params) => publishProductHandler(context, params));
|
|
17
|
+
server.tool('unpublish_product', 'Deactivates or Unpublishes product by its id changing it to DRAFT and not available for sale', UnpublishProductSchema, async (params) => unpublishProductHandler(context, params));
|
|
18
|
+
server.tool('update_product', 'Modify/Update generic infos of a product (tags for ex.)', UpdateProductSchema, async (params) => updateProductHandler(context, params));
|
|
19
|
+
server.tool('update_product_texts', 'Modify/update localized texts of a product', UpdateProductTextsSchema, async (params) => updateProductTextsHandler(context, params));
|
|
20
|
+
server.tool('update_product_commerce', 'Modify/update products commerce info like prices, taxes, etc. for all product types except CONFIGURABLE_PRODUCT. for currency value always use registered currency in the system and not a custom one, it should not be called for CONFIGURABLE_PRODUCT type products', UpdateProductCommerceSchema, async (params) => updateProductCommerceHandler(context, params));
|
|
21
|
+
server.tool('update_product_warehousing', 'Modify/update products commerce info like prices, taxes, etc. for SIMPLE_PRODUCT product type only. it is only available for SIMPLE_PRODUCT type products', UpdateProductCommerceSchema, async (params) => updateProductCommerceHandler(context, params));
|
|
22
|
+
server.tool('update_product_supply', 'Modify/update products supply of SIMPLE_PRODUCT type info like prices, taxes, etc. it is only available for SIMPLE_PRODUCT type products', UpdateProductSupplySchema, async (params) => updateProductSupplyHandler(context, params));
|
|
23
|
+
server.tool('update_tokenized_product', 'Modify/update products supply of TOKENIZED_PRODUCT type info like contractAddress, contractStandard, tokenId, supply, ercMetadataProperties etc. it is only available for TOKENIZED_PRODUCT type products', UpdateProductTokenizationSchema, async (params) => updateProductTokenizationHandler(context, params));
|
|
24
|
+
server.tool('update_product_plan', 'Modify/update products subscription/plan information of PLAN_PRODUCT type info like billing period, trial period and usage calculation, etc. it is only available for PLAN_PRODUCT type products', UpdateProductPlanSchema, async (params) => updateProductPlanHandler(context, params));
|
|
25
|
+
server.tool('list_currencies', 'List all available currencies in the system, when currency is required and not implicitly provided use this tool to get the list of available currencies also if non existing currency is provided to you by a user inform them it does not exist and to create it first before they can use it', ListCurrenciesSchema, async (params) => currenciesHandler(context, params));
|
|
26
|
+
server.tool('get_currency', 'Gets a single currency registered in the system', CurrencySchema, async (params) => currencyHandler(context, params));
|
|
27
|
+
server.tool('list_countries', 'List all available countries in the system, when country is required and not implicitly provided use this tool to get the list of available countries also if non existing country is provided to you by a user inform them it does not exist and to create it first before they can use it', ListCountriesSchema, async (params) => countriesHandler(context, params));
|
|
28
|
+
server.tool('get_country', 'Gets a single country registered in the system', CountrySchema, async (params) => countryHandler(context, params));
|
|
29
|
+
server.tool('list_languages', 'List all available languages in the system, when language is required and not implicitly provided use this tool to get the list of available languages also if non existing language is provided to you by a user inform them it does not exist and to create it first before they can use it', ListLanguagesSchema, async (params) => languagesHandler(context, params));
|
|
30
|
+
server.tool('get_language', 'Gets a single language registered in the system', LanguageSchema, async (params) => languageHandler(context, params));
|
|
31
|
+
server.tool('create_product_variation', 'Adds/create a variation of a product, it is only available for CONFIGURABLE_PRODUCT type products', CreateProductVariationSchema, async (params) => createProductVariationHandler(context, params));
|
|
32
|
+
server.tool('remove_product_variation', 'removes a variation of a product', RemoveProductVariationSchema, async (params) => removeProductVariationHandler(context, params));
|
|
33
|
+
server.tool('assign_product_variation', 'Link a product to a ConfigurableProduct variation option by providing a vector combination that uniquely identifies the variation option', AssignProductVariationSchema, async (params) => addProductAssignmentHandler(context, params));
|
|
34
|
+
server.tool('add_variation_options', 'Adds variation option to an existing product variations', CreateProductVariationOptionSchema, async (params) => createProductVariationOptionHandler(context, params));
|
|
35
|
+
server.tool('remove_variation_options', 'Removes product option value for product variation with the provided variation option value', RemoveProductVariationOptionSchema, async (params) => removeProductVariationOptionHandler(context, params));
|
|
36
|
+
server.tool('remove_product_variation_assignment', 'Unlinks a product from a ConfigurableProduct by providing a configuration combination that uniquely identifies a row in the assignment matrix', RemoveProductAssignmentSchema, async (params) => removeProductAssignmentHandler(context, params));
|
|
37
|
+
server.tool('add_language', 'Adds new language', CreateLanguageSchema, async (params) => createLanguageHandler(context, params));
|
|
38
|
+
server.tool('update_language', 'Updates language', UpdateLanguageSchema, async (params) => updateLanguageHandler(context, params));
|
|
39
|
+
server.tool('remove_language', 'Deletes a language', RemoveLanguageSchema, async (params) => removeLanguageHandler(context, params));
|
|
40
|
+
server.tool('add_product_media', 'Adds media to a product', AddProductMediaUploadSchema, async (params) => addProductMediaUploadHandler(context, params));
|
|
41
|
+
server.tool('remove_product_media', "Remove a media asset from a product's visualization", RemoveProductMediaSchema, async (params) => removeProductMediaHandler(context, params));
|
|
42
|
+
server.tool('update_product_media_texts', "Modify localized texts part of a product's media asset", UpdateProductMediaTextsSchema, async (params) => updateProductMediaTextsHandler(context, params));
|
|
43
|
+
server.tool('reorder_product_media', 'Reorder a media asset (first is primary)', ReorderProductMediaSchema, async (params) => reorderProductMediaHandler(context, params));
|
|
44
|
+
server.tool('product_review_count', 'Returns total number of product reviews', ProductReviewsCountSchema, async (params) => productReviewsCountHandler(context, params));
|
|
45
|
+
server.tool('product_reviews', ' Get all product reviews, by default sorted by creation date (descending)', ProductReviewsSchema, async (params) => productReviewsHandler(context, params));
|
|
46
|
+
return server;
|
|
83
47
|
}
|
|
84
|
-
export const searchProductsTool = {
|
|
85
|
-
name: 'searchProducts',
|
|
86
|
-
description: 'Search for products in the Unchained E-Commerce system',
|
|
87
|
-
inputSchema: {
|
|
88
|
-
type: 'object',
|
|
89
|
-
properties: {
|
|
90
|
-
queryString: {
|
|
91
|
-
type: 'string',
|
|
92
|
-
description: 'Free text search query',
|
|
93
|
-
},
|
|
94
|
-
filterQuery: {
|
|
95
|
-
type: 'array',
|
|
96
|
-
items: {
|
|
97
|
-
type: 'object',
|
|
98
|
-
properties: {
|
|
99
|
-
key: { type: 'string' },
|
|
100
|
-
value: { type: 'string' },
|
|
101
|
-
},
|
|
102
|
-
required: ['key'],
|
|
103
|
-
},
|
|
104
|
-
description: 'Array of filter criteria',
|
|
105
|
-
},
|
|
106
|
-
assortmentId: {
|
|
107
|
-
type: 'string',
|
|
108
|
-
description: 'Restrict search to products within a specific assortment',
|
|
109
|
-
},
|
|
110
|
-
orderBy: {
|
|
111
|
-
type: 'string',
|
|
112
|
-
enum: ['default'],
|
|
113
|
-
description: 'Sort order for results',
|
|
114
|
-
},
|
|
115
|
-
includeInactive: {
|
|
116
|
-
type: 'boolean',
|
|
117
|
-
default: false,
|
|
118
|
-
description: 'Whether to include inactive products',
|
|
119
|
-
},
|
|
120
|
-
ignoreChildAssortments: {
|
|
121
|
-
type: 'boolean',
|
|
122
|
-
default: false,
|
|
123
|
-
description: 'When assortmentId is provided, whether to ignore child assortments',
|
|
124
|
-
},
|
|
125
|
-
limit: {
|
|
126
|
-
type: 'integer',
|
|
127
|
-
default: 10,
|
|
128
|
-
description: 'Number of products to return',
|
|
129
|
-
},
|
|
130
|
-
offset: {
|
|
131
|
-
type: 'integer',
|
|
132
|
-
default: 0,
|
|
133
|
-
description: 'Number of products to skip for pagination',
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
48
|
//# sourceMappingURL=index.js.map
|
package/lib/mcp/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/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AAI,CACT,sBAAsB,EACtB,qDAAqD,EACrD,wBAAwB,EACxB,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,yBAAyB,CAAC,OAAO,EAAE,MAAM,CAAC,CAC7D,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,4BAA4B,EAC5B,wDAAwD,EACxD,6BAA6B,EAC7B,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,8BAA8B,CAAC,OAAO,EAAE,MAAM,CAAC,CAClE,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,uBAAuB,EACvB,0CAA0C,EAC1C,yBAAyB,EACzB,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,0BAA0B,CAAC,OAAO,EAAE,MAAM,CAAC,CAC9D,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,sBAAsB,EACtB,yCAAyC,EACzC,yBAAyB,EACzB,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,0BAA0B,CAAC,OAAO,EAAE,MAAM,CAAC,CAC9D,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,2EAA2E,EAC3E,oBAAoB,EACpB,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAC,OAAO,EAAE,MAAM,CAAC,CACzD,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
export declare const AssignProductVariationSchema: {
|
|
4
|
+
proxyId: z.ZodString;
|
|
5
|
+
productId: z.ZodString;
|
|
6
|
+
vectors: z.ZodArray<z.ZodObject<{
|
|
7
|
+
key: z.ZodString;
|
|
8
|
+
value: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
key?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
}, {
|
|
13
|
+
key?: string;
|
|
14
|
+
value?: string;
|
|
15
|
+
}>, "many">;
|
|
16
|
+
};
|
|
17
|
+
export declare const AddProductAssignmentZodSchema: z.ZodObject<{
|
|
18
|
+
proxyId: z.ZodString;
|
|
19
|
+
productId: z.ZodString;
|
|
20
|
+
vectors: z.ZodArray<z.ZodObject<{
|
|
21
|
+
key: z.ZodString;
|
|
22
|
+
value: z.ZodString;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
key?: string;
|
|
25
|
+
value?: string;
|
|
26
|
+
}, {
|
|
27
|
+
key?: string;
|
|
28
|
+
value?: string;
|
|
29
|
+
}>, "many">;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
productId?: string;
|
|
32
|
+
proxyId?: string;
|
|
33
|
+
vectors?: {
|
|
34
|
+
key?: string;
|
|
35
|
+
value?: string;
|
|
36
|
+
}[];
|
|
37
|
+
}, {
|
|
38
|
+
productId?: string;
|
|
39
|
+
proxyId?: string;
|
|
40
|
+
vectors?: {
|
|
41
|
+
key?: string;
|
|
42
|
+
value?: string;
|
|
43
|
+
}[];
|
|
44
|
+
}>;
|
|
45
|
+
export type AddProductAssignmentParams = z.infer<typeof AddProductAssignmentZodSchema>;
|
|
46
|
+
export declare function addProductAssignmentHandler(context: Context, params: AddProductAssignmentParams): Promise<{
|
|
47
|
+
content: {
|
|
48
|
+
type: "text";
|
|
49
|
+
text: string;
|
|
50
|
+
}[];
|
|
51
|
+
}>;
|
|
52
|
+
//# sourceMappingURL=addProductAssignmentHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addProductAssignmentHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/addProductAssignmentHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AA2C3C,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;CAUxC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAyC,CAAC;AAEpF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEvF,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,0BAA0B;;;;;GAyDrG"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
|
|
3
|
+
import { ProductNotFoundError, ProductVariationVectorAlreadySet, ProductVariationVectorInvalid, ProductWrongTypeError, } from '../../errors.js';
|
|
4
|
+
import { ProductTypes } from '@unchainedshop/core-products';
|
|
5
|
+
const extractVariationMatrix = (variations = []) => {
|
|
6
|
+
const cartesianProduct = (arrays) => {
|
|
7
|
+
return arrays.reduce((acc, array) => acc.flatMap((item) => array.map((value) => [...item, value])), [[]]);
|
|
8
|
+
};
|
|
9
|
+
const keys = variations.map((item) => item.key);
|
|
10
|
+
const options = variations.map((item) => item.options);
|
|
11
|
+
const combinations = cartesianProduct(options);
|
|
12
|
+
return combinations.map((combination) => combination.reduce((acc, value, index) => {
|
|
13
|
+
acc[keys[index]] = value;
|
|
14
|
+
return acc;
|
|
15
|
+
}, {}));
|
|
16
|
+
};
|
|
17
|
+
const combinationExists = (matrix, combination) => {
|
|
18
|
+
return matrix.some((variation) => {
|
|
19
|
+
return (Object.keys(variation).length === Object.keys(combination).length && // Ensure both have the same number of keys
|
|
20
|
+
Object.entries(combination).every(([key, value]) => variation[key] === value));
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
// Zod schema for ProductAssignmentVectorInput
|
|
24
|
+
const ProductAssignmentVectorSchema = z.object({
|
|
25
|
+
key: z.string().min(1).describe('Attribute key (e.g., "Color", "Size")'),
|
|
26
|
+
value: z.string().min(1).describe('Attribute value (e.g., "Red", "M")'),
|
|
27
|
+
});
|
|
28
|
+
export const AssignProductVariationSchema = {
|
|
29
|
+
proxyId: z.string().min(1).describe('should be ID of the CONFIGURABLE_PRODUCT (parent) only'),
|
|
30
|
+
productId: z
|
|
31
|
+
.string()
|
|
32
|
+
.min(1)
|
|
33
|
+
.describe('ID of the product being assigned. can not be a CONFIGURABLE_PRODUCT product'),
|
|
34
|
+
vectors: z
|
|
35
|
+
.array(ProductAssignmentVectorSchema)
|
|
36
|
+
.min(1)
|
|
37
|
+
.describe('Combination of attributes uniquely identifying the variant'),
|
|
38
|
+
};
|
|
39
|
+
// Full schema for the mutation
|
|
40
|
+
export const AddProductAssignmentZodSchema = z.object(AssignProductVariationSchema);
|
|
41
|
+
export async function addProductAssignmentHandler(context, params) {
|
|
42
|
+
const { proxyId, productId, vectors } = params;
|
|
43
|
+
const { modules } = context;
|
|
44
|
+
try {
|
|
45
|
+
const proxyProduct = await modules.products.findProduct({
|
|
46
|
+
productId: proxyId,
|
|
47
|
+
});
|
|
48
|
+
if (!proxyProduct)
|
|
49
|
+
throw new ProductNotFoundError({ proxyId });
|
|
50
|
+
if (proxyProduct.type !== ProductTypes.ConfigurableProduct)
|
|
51
|
+
throw new ProductWrongTypeError({
|
|
52
|
+
proxyId,
|
|
53
|
+
received: proxyProduct.type,
|
|
54
|
+
required: ProductTypes.ConfigurableProduct,
|
|
55
|
+
});
|
|
56
|
+
const variations = await modules.products.variations.findProductVariations({
|
|
57
|
+
productId: proxyId,
|
|
58
|
+
});
|
|
59
|
+
const variationMatrix = extractVariationMatrix(variations);
|
|
60
|
+
const normalizedVectors = vectors?.reduce((prev, { key, value }) => {
|
|
61
|
+
return {
|
|
62
|
+
...prev,
|
|
63
|
+
[key]: value,
|
|
64
|
+
};
|
|
65
|
+
}, {});
|
|
66
|
+
if (!combinationExists(variationMatrix, normalizedVectors))
|
|
67
|
+
throw new ProductVariationVectorInvalid({ proxyId, vectors });
|
|
68
|
+
const added = await modules.products.assignments.addProxyAssignment({
|
|
69
|
+
productId,
|
|
70
|
+
proxyId,
|
|
71
|
+
vectors: vectors,
|
|
72
|
+
});
|
|
73
|
+
if (!added)
|
|
74
|
+
throw new ProductVariationVectorAlreadySet({ proxyId, vectors });
|
|
75
|
+
return {
|
|
76
|
+
content: [
|
|
77
|
+
{
|
|
78
|
+
type: 'text',
|
|
79
|
+
text: JSON.stringify({
|
|
80
|
+
product: await getNormalizedProductDetails(proxyId, context),
|
|
81
|
+
}),
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
return {
|
|
88
|
+
content: [
|
|
89
|
+
{
|
|
90
|
+
type: 'text',
|
|
91
|
+
text: `Error assigning product: ${error.message}`,
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=addProductAssignmentHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addProductAssignmentHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/addProductAssignmentHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EACL,oBAAoB,EACpB,gCAAgC,EAChC,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAwB,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAElF,MAAM,sBAAsB,GAAG,CAAC,UAAU,GAAG,EAAE,EAAE,EAAE;IACjD,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,EAAE;QAClC,OAAO,MAAM,CAAC,MAAM,CAClB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,EAA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@@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
export declare const AddProductMediaUploadSchema: {
|
|
4
|
+
mediaName: z.ZodString;
|
|
5
|
+
productId: z.ZodString;
|
|
6
|
+
url: z.ZodString;
|
|
7
|
+
};
|
|
8
|
+
export declare const AddProductMediaUploadZodSchema: z.ZodObject<{
|
|
9
|
+
mediaName: z.ZodString;
|
|
10
|
+
productId: z.ZodString;
|
|
11
|
+
url: z.ZodString;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
productId?: string;
|
|
14
|
+
url?: string;
|
|
15
|
+
mediaName?: string;
|
|
16
|
+
}, {
|
|
17
|
+
productId?: string;
|
|
18
|
+
url?: string;
|
|
19
|
+
mediaName?: string;
|
|
20
|
+
}>;
|
|
21
|
+
export type AddProductMediaUploadParams = z.infer<typeof AddProductMediaUploadZodSchema>;
|
|
22
|
+
export declare function addProductMediaUploadHandler(context: Context, params: AddProductMediaUploadParams): Promise<{
|
|
23
|
+
content: {
|
|
24
|
+
type: "text";
|
|
25
|
+
text: string;
|
|
26
|
+
}[];
|
|
27
|
+
}>;
|
|
28
|
+
//# sourceMappingURL=addProductMediaUploadHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addProductMediaUploadHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/addProductMediaUploadHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,eAAO,MAAM,2BAA2B;;;;CAOvC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;EAAwC,CAAC;AAEpF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEzF,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,2BAA2B;;;;;GA0DpC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { log } from '@unchainedshop/logger';
|
|
3
|
+
import { FileNotFoundError, FileUploadExpiredError } from '../../errors.js';
|
|
4
|
+
export const AddProductMediaUploadSchema = {
|
|
5
|
+
mediaName: z
|
|
6
|
+
.string()
|
|
7
|
+
.min(1)
|
|
8
|
+
.describe('Name of the media file (e.g. "image.png") use random name if not provided'),
|
|
9
|
+
productId: z.string().min(1).describe('ID of the product to link media to'),
|
|
10
|
+
url: z.string().describe('Anonymously fetchable URL of the source media, can be a data URL too'),
|
|
11
|
+
};
|
|
12
|
+
export const AddProductMediaUploadZodSchema = z.object(AddProductMediaUploadSchema);
|
|
13
|
+
export async function addProductMediaUploadHandler(context, params) {
|
|
14
|
+
const { mediaName, productId, url } = params;
|
|
15
|
+
const { modules, services, userId } = context;
|
|
16
|
+
try {
|
|
17
|
+
log('addProductMediaUploadHandler', { mediaName, productId, userId, url });
|
|
18
|
+
const { _id: fileId, putURL, type, size, } = await services.files.createSignedURL({
|
|
19
|
+
directoryName: 'product-media',
|
|
20
|
+
fileName: mediaName,
|
|
21
|
+
meta: { productId },
|
|
22
|
+
});
|
|
23
|
+
const sourceResponse = await fetch(url);
|
|
24
|
+
const uploadUrl = new URL(putURL, process.env.ROOT_URL || 'http://localhost:4010');
|
|
25
|
+
const uploadResponse = await fetch(uploadUrl, {
|
|
26
|
+
method: 'PUT',
|
|
27
|
+
body: sourceResponse.body,
|
|
28
|
+
duplex: 'half',
|
|
29
|
+
});
|
|
30
|
+
if (!uploadResponse.ok) {
|
|
31
|
+
throw new Error(`Upload failed: ${uploadResponse.status} ${uploadResponse.statusText}`);
|
|
32
|
+
}
|
|
33
|
+
const file = await modules.files.findFile({ fileId });
|
|
34
|
+
if (!file)
|
|
35
|
+
throw new FileNotFoundError({ fileId });
|
|
36
|
+
if (file.expires && new Date(file.expires).getTime() < Date.now()) {
|
|
37
|
+
throw new FileUploadExpiredError({ fileId });
|
|
38
|
+
}
|
|
39
|
+
const linked = await services.files.linkFile({ fileId, size, type });
|
|
40
|
+
return {
|
|
41
|
+
content: [
|
|
42
|
+
{
|
|
43
|
+
type: 'text',
|
|
44
|
+
text: JSON.stringify({
|
|
45
|
+
file: linked,
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
return {
|
|
53
|
+
content: [
|
|
54
|
+
{
|
|
55
|
+
type: 'text',
|
|
56
|
+
text: `Error uploading product media: ${error.message}`,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=addProductMediaUploadHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addProductMediaUploadHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/addProductMediaUploadHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,2EAA2E,CAAC;IACxF,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IAC3E,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sEAAsE,CAAC;CACjG,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC,2BAA2B,C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AC,CAAC;QAEnD,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;YAClE,MAAM,IAAI,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAC/C,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAErE,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,IAAI,EAAE,MAAM;qBACb,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,kCAAmC,KAAe,CAAC,OAAO,EAAE;iBACnE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
export declare const ListCountriesSchema: {
|
|
4
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
includeInactive: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
+
queryString: z.ZodOptional<z.ZodString>;
|
|
8
|
+
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
9
|
+
key: z.ZodString;
|
|
10
|
+
value: z.ZodEnum<["ASC" | "DESC", ...("ASC" | "DESC")[]]>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
key?: string;
|
|
13
|
+
value?: "ASC" | "DESC";
|
|
14
|
+
}, {
|
|
15
|
+
key?: string;
|
|
16
|
+
value?: "ASC" | "DESC";
|
|
17
|
+
}>, "many">>;
|
|
18
|
+
};
|
|
19
|
+
export declare const ListCountriesZodSchema: z.ZodObject<{
|
|
20
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
21
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
22
|
+
includeInactive: z.ZodDefault<z.ZodBoolean>;
|
|
23
|
+
queryString: z.ZodOptional<z.ZodString>;
|
|
24
|
+
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
25
|
+
key: z.ZodString;
|
|
26
|
+
value: z.ZodEnum<["ASC" | "DESC", ...("ASC" | "DESC")[]]>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
key?: string;
|
|
29
|
+
value?: "ASC" | "DESC";
|
|
30
|
+
}, {
|
|
31
|
+
key?: string;
|
|
32
|
+
value?: "ASC" | "DESC";
|
|
33
|
+
}>, "many">>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
sort?: {
|
|
36
|
+
key?: string;
|
|
37
|
+
value?: "ASC" | "DESC";
|
|
38
|
+
}[];
|
|
39
|
+
includeInactive?: boolean;
|
|
40
|
+
queryString?: string;
|
|
41
|
+
limit?: number;
|
|
42
|
+
offset?: number;
|
|
43
|
+
}, {
|
|
44
|
+
sort?: {
|
|
45
|
+
key?: string;
|
|
46
|
+
value?: "ASC" | "DESC";
|
|
47
|
+
}[];
|
|
48
|
+
includeInactive?: boolean;
|
|
49
|
+
queryString?: string;
|
|
50
|
+
limit?: number;
|
|
51
|
+
offset?: number;
|
|
52
|
+
}>;
|
|
53
|
+
export type ListCountriesParams = z.infer<typeof ListCountriesZodSchema>;
|
|
54
|
+
export declare function countriesHandler(context: Context, params: ListCountriesParams): Promise<{
|
|
55
|
+
content: {
|
|
56
|
+
type: "text";
|
|
57
|
+
text: string;
|
|
58
|
+
}[];
|
|
59
|
+
}>;
|
|
60
|
+
//# sourceMappingURL=countriesHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countriesHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/countriesHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAQ3C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;CAa/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAgC,CAAC;AAEpE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEzE,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB;;;;;GA+BnF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SortDirection } from '@unchainedshop/utils';
|
|
3
|
+
const sortDirectionKeys = Object.keys(SortDirection);
|
|
4
|
+
export const ListCountriesSchema = {
|
|
5
|
+
limit: z.number().int().min(1).max(100).default(50),
|
|
6
|
+
offset: z.number().int().min(0).default(0),
|
|
7
|
+
includeInactive: z.boolean().default(false),
|
|
8
|
+
queryString: z.string().min(1).optional(),
|
|
9
|
+
sort: z
|
|
10
|
+
.array(z.object({
|
|
11
|
+
key: z.string().min(1),
|
|
12
|
+
value: z.enum(sortDirectionKeys).describe("Sort direction, e.g., 'ASC' or 'DESC'"),
|
|
13
|
+
}))
|
|
14
|
+
.optional(),
|
|
15
|
+
};
|
|
16
|
+
export const ListCountriesZodSchema = z.object(ListCountriesSchema);
|
|
17
|
+
export async function countriesHandler(context, params) {
|
|
18
|
+
const { limit, offset, includeInactive, queryString, sort } = params;
|
|
19
|
+
const { modules } = context;
|
|
20
|
+
try {
|
|
21
|
+
const countries = await modules.countries.findCountries({
|
|
22
|
+
limit,
|
|
23
|
+
offset,
|
|
24
|
+
includeInactive,
|
|
25
|
+
queryString,
|
|
26
|
+
sort: sort,
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
content: [
|
|
30
|
+
{
|
|
31
|
+
type: 'text',
|
|
32
|
+
text: JSON.stringify({ countries }),
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
return {
|
|
39
|
+
content: [
|
|
40
|
+
{
|
|
41
|
+
type: 'text',
|
|
42
|
+
text: `Error retrieving countries: ${error.message}`,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=countriesHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countriesHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/countriesHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAGlD,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACnD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1C,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAC3C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACz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