@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
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
/**
|
|
4
|
+
* Zod schema for the list_products tool (as raw object for MCP)
|
|
5
|
+
*/
|
|
6
|
+
export declare const ListProductsSchema: {
|
|
7
|
+
queryString: z.ZodOptional<z.ZodString>;
|
|
8
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
9
|
+
productIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
|
+
filterQuery: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
11
|
+
key: z.ZodString;
|
|
12
|
+
value: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
key?: string;
|
|
15
|
+
value?: string;
|
|
16
|
+
}, {
|
|
17
|
+
key?: string;
|
|
18
|
+
value?: string;
|
|
19
|
+
}>, "many">>;
|
|
20
|
+
assortmentId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
includeInactive: z.ZodDefault<z.ZodBoolean>;
|
|
22
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
23
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
24
|
+
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
25
|
+
key: z.ZodString;
|
|
26
|
+
value: z.ZodEnum<["ASC", "DESC"]>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
key?: string;
|
|
29
|
+
value?: "ASC" | "DESC";
|
|
30
|
+
}, {
|
|
31
|
+
key?: string;
|
|
32
|
+
value?: "ASC" | "DESC";
|
|
33
|
+
}>, "many">>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Zod object schema for type inference
|
|
37
|
+
*/
|
|
38
|
+
export declare const ListProductsZodSchema: z.ZodObject<{
|
|
39
|
+
queryString: z.ZodOptional<z.ZodString>;
|
|
40
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
41
|
+
productIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
42
|
+
filterQuery: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
43
|
+
key: z.ZodString;
|
|
44
|
+
value: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
key?: string;
|
|
47
|
+
value?: string;
|
|
48
|
+
}, {
|
|
49
|
+
key?: string;
|
|
50
|
+
value?: string;
|
|
51
|
+
}>, "many">>;
|
|
52
|
+
assortmentId: z.ZodOptional<z.ZodString>;
|
|
53
|
+
includeInactive: z.ZodDefault<z.ZodBoolean>;
|
|
54
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
55
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
56
|
+
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
57
|
+
key: z.ZodString;
|
|
58
|
+
value: z.ZodEnum<["ASC", "DESC"]>;
|
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
key?: string;
|
|
61
|
+
value?: "ASC" | "DESC";
|
|
62
|
+
}, {
|
|
63
|
+
key?: string;
|
|
64
|
+
value?: "ASC" | "DESC";
|
|
65
|
+
}>, "many">>;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
tags?: string[];
|
|
68
|
+
sort?: {
|
|
69
|
+
key?: string;
|
|
70
|
+
value?: "ASC" | "DESC";
|
|
71
|
+
}[];
|
|
72
|
+
assortmentId?: string;
|
|
73
|
+
includeInactive?: boolean;
|
|
74
|
+
queryString?: string;
|
|
75
|
+
limit?: number;
|
|
76
|
+
offset?: number;
|
|
77
|
+
productIds?: string[];
|
|
78
|
+
filterQuery?: {
|
|
79
|
+
key?: string;
|
|
80
|
+
value?: string;
|
|
81
|
+
}[];
|
|
82
|
+
}, {
|
|
83
|
+
tags?: string[];
|
|
84
|
+
sort?: {
|
|
85
|
+
key?: string;
|
|
86
|
+
value?: "ASC" | "DESC";
|
|
87
|
+
}[];
|
|
88
|
+
assortmentId?: string;
|
|
89
|
+
includeInactive?: boolean;
|
|
90
|
+
queryString?: string;
|
|
91
|
+
limit?: number;
|
|
92
|
+
offset?: number;
|
|
93
|
+
productIds?: string[];
|
|
94
|
+
filterQuery?: {
|
|
95
|
+
key?: string;
|
|
96
|
+
value?: string;
|
|
97
|
+
}[];
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Interface for the list_products tool parameters
|
|
101
|
+
*/
|
|
102
|
+
export type ListProductsParams = z.infer<typeof ListProductsZodSchema>;
|
|
103
|
+
/**
|
|
104
|
+
* Implementation of the list_products tool
|
|
105
|
+
*/
|
|
106
|
+
export declare function listProductsHandler(context: Context, params: ListProductsParams): Promise<{
|
|
107
|
+
content: {
|
|
108
|
+
type: "text";
|
|
109
|
+
text: string;
|
|
110
|
+
}[];
|
|
111
|
+
}>;
|
|
112
|
+
//# sourceMappingURL=listProducts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listProducts.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/listProducts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+B9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA+B,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEvE;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB;;;;;GA4FrF"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import normalizeMediaUrl from '../utils/normalizeMediaUrl.js';
|
|
3
|
+
/**
|
|
4
|
+
* Zod schema for the list_products tool (as raw object for MCP)
|
|
5
|
+
*/
|
|
6
|
+
export const ListProductsSchema = {
|
|
7
|
+
// Search & Filter
|
|
8
|
+
queryString: z.string().optional().describe('Text search across product fields'),
|
|
9
|
+
tags: z.array(z.string()).optional().describe('Filter by product tags'),
|
|
10
|
+
productIds: z.array(z.string()).optional().describe('Filter by specific product IDs'),
|
|
11
|
+
filterQuery: z
|
|
12
|
+
.array(z.object({
|
|
13
|
+
key: z.string().describe('Filter key'),
|
|
14
|
+
value: z.string().optional().describe('Filter value'),
|
|
15
|
+
}))
|
|
16
|
+
.optional()
|
|
17
|
+
.describe('Key-value filter pairs'),
|
|
18
|
+
assortmentId: z.string().optional().describe('Filter by assortment'),
|
|
19
|
+
includeInactive: z.boolean().default(false).describe('Include inactive products'),
|
|
20
|
+
// Pagination
|
|
21
|
+
limit: z.number().min(1).max(100).default(20).describe('Results per page'),
|
|
22
|
+
offset: z.number().min(0).default(0).describe('Skip results for pagination'),
|
|
23
|
+
// Sorting
|
|
24
|
+
sort: z
|
|
25
|
+
.array(z.object({
|
|
26
|
+
key: z.string().describe('Sort field'),
|
|
27
|
+
value: z.enum(['ASC', 'DESC']).describe('Sort direction'),
|
|
28
|
+
}))
|
|
29
|
+
.optional()
|
|
30
|
+
.describe('Sort options'),
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Zod object schema for type inference
|
|
34
|
+
*/
|
|
35
|
+
export const ListProductsZodSchema = z.object(ListProductsSchema);
|
|
36
|
+
/**
|
|
37
|
+
* Implementation of the list_products tool
|
|
38
|
+
*/
|
|
39
|
+
export async function listProductsHandler(context, params) {
|
|
40
|
+
const { queryString, tags, productIds, filterQuery, assortmentId, includeInactive = false, limit = 20, offset = 0, sort, } = params;
|
|
41
|
+
try {
|
|
42
|
+
let filteredProductIds = productIds;
|
|
43
|
+
// If assortmentId is provided, get product IDs from assortment
|
|
44
|
+
if (assortmentId) {
|
|
45
|
+
const assortmentProductIds = await context.modules.assortments.products.findProductIds({
|
|
46
|
+
assortmentId,
|
|
47
|
+
});
|
|
48
|
+
if (filteredProductIds) {
|
|
49
|
+
// Intersection of both sets
|
|
50
|
+
filteredProductIds = filteredProductIds.filter((id) => assortmentProductIds.includes(id));
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
filteredProductIds = assortmentProductIds;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
let searchResult = {};
|
|
57
|
+
if (queryString)
|
|
58
|
+
searchResult = await context.services.filters.searchProducts({
|
|
59
|
+
queryString,
|
|
60
|
+
productIds: filteredProductIds,
|
|
61
|
+
includeInactive,
|
|
62
|
+
filterQuery: filterQuery?.filter((f) => f.key),
|
|
63
|
+
}, {
|
|
64
|
+
locale: context.locale,
|
|
65
|
+
});
|
|
66
|
+
const products = await context.modules.products.findProducts({
|
|
67
|
+
productIds: searchResult?.aggregatedFilteredProductIds,
|
|
68
|
+
tags,
|
|
69
|
+
limit,
|
|
70
|
+
offset,
|
|
71
|
+
includeDrafts: includeInactive,
|
|
72
|
+
sort: sort?.filter((s) => s.key),
|
|
73
|
+
});
|
|
74
|
+
const productTexts = await context.loaders.productTextLoader.loadMany(products.map(({ _id }) => ({
|
|
75
|
+
productId: _id,
|
|
76
|
+
locale: context.locale,
|
|
77
|
+
})));
|
|
78
|
+
// iterate all products and add texts
|
|
79
|
+
const normalizedProducts = await Promise.all(products.map(async (product) => {
|
|
80
|
+
const texts = productTexts.filter((text) => text.productId === product._id);
|
|
81
|
+
const productMedias = await context.modules.products.media.findProductMedias({
|
|
82
|
+
productId: product._id,
|
|
83
|
+
});
|
|
84
|
+
const media = await normalizeMediaUrl(productMedias, context);
|
|
85
|
+
return {
|
|
86
|
+
...product,
|
|
87
|
+
texts,
|
|
88
|
+
media,
|
|
89
|
+
};
|
|
90
|
+
}));
|
|
91
|
+
return {
|
|
92
|
+
content: [
|
|
93
|
+
{
|
|
94
|
+
type: 'text',
|
|
95
|
+
text: JSON.stringify({
|
|
96
|
+
products: normalizedProducts,
|
|
97
|
+
total: searchResult?.aggregatedTotalProductIds?.length,
|
|
98
|
+
filtered: searchResult?.aggregatedFilteredProductIds?.length || products?.length,
|
|
99
|
+
}),
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
return {
|
|
106
|
+
content: [{ type: 'text', text: `Error listing products: ${error.message}` }],
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=listProducts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listProducts.js","sourceRoot":"","sources":["../../../src/mcp/tools/listProducts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,iBAAiB,MAAM,+BAA+B,CAAC;AAE9D;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,kBAAkB;IAClB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAChF,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IACvE,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM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EAAE,MAAM;wBACtD,QAAQ,EAAE,YAAY,EAAE,4BAA4B,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM;qBACjF,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,2BAA4B,KAAe,CAAC,OAAO,EAAE,EAAE,CAAC;SAClG,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeMediaUrl.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/normalizeMediaUrl.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,iBAAiB,GAAU,aAAW,EAAE,YAAO,mBAqBpD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getFileAdapter } from '@unchainedshop/core-files';
|
|
2
|
+
const normalizeMediaUrl = async (medias = [], context) => {
|
|
3
|
+
if (medias?.length) {
|
|
4
|
+
const normalizedMedias = await Promise.all(medias.map(async (media) => {
|
|
5
|
+
const file = await context.loaders.fileLoader.load({
|
|
6
|
+
fileId: media.mediaId,
|
|
7
|
+
});
|
|
8
|
+
const fileUploadAdapter = getFileAdapter();
|
|
9
|
+
const url = await fileUploadAdapter.createDownloadURL(file);
|
|
10
|
+
file.url = context.modules.files.normalizeUrl(url, {});
|
|
11
|
+
return {
|
|
12
|
+
...media,
|
|
13
|
+
file,
|
|
14
|
+
};
|
|
15
|
+
}));
|
|
16
|
+
return normalizedMedias.filter(Boolean);
|
|
17
|
+
}
|
|
18
|
+
return medias;
|
|
19
|
+
};
|
|
20
|
+
export default normalizeMediaUrl;
|
|
21
|
+
//# sourceMappingURL=normalizeMediaUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeMediaUrl.js","sourceRoot":"","sources":["../../../src/mcp/tools/normalizeMediaUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,iBAAiB,GAAG,KAAK,EAAE,MAAM,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE;IACvD,IAAI,MAAM,EAAE,MAAM,EAAE,CAAC;QACnB,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,GAAG,CACxC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YACzB,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;gBACjD,MAAM,EAAE,KAAK,CAAC,OAAO;aACtB,CAAC,CAAC;YACH,MAAM,iBAAiB,GAAG,cAAc,EAAE,CAAC;YAC3C,MAAM,GAAG,GAAG,MAAM,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;YAC5D,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAEvD,OAAO;gBACL,GAAG,KAAK;gBACR,IAAI;aACL,CAAC;QACJ,CAAC,CAAC,CACH,CAAC;QAEF,OAAO,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
export declare const ProductReviewsCountSchema: {
|
|
4
|
+
queryString: z.ZodOptional<z.ZodString>;
|
|
5
|
+
};
|
|
6
|
+
export declare const ProductReviewsCountZodSchema: z.ZodObject<{
|
|
7
|
+
queryString: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
queryString?: string;
|
|
10
|
+
}, {
|
|
11
|
+
queryString?: string;
|
|
12
|
+
}>;
|
|
13
|
+
export type ProductReviewsCountParams = z.infer<typeof ProductReviewsCountZodSchema>;
|
|
14
|
+
export declare function productReviewsCountHandler(context: Context, params: ProductReviewsCountParams): Promise<{
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=productReviewsCountHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"productReviewsCountHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/productReviewsCountHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,eAAO,MAAM,yBAAyB;;CAErC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;EAAsC,CAAC;AAEhF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAErF,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,yBAAyB;;;;;GAwBnG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const ProductReviewsCountSchema = {
|
|
3
|
+
queryString: z.string().optional().describe('Optional query string to filter reviews'),
|
|
4
|
+
};
|
|
5
|
+
export const ProductReviewsCountZodSchema = z.object(ProductReviewsCountSchema);
|
|
6
|
+
export async function productReviewsCountHandler(context, params) {
|
|
7
|
+
const { modules } = context;
|
|
8
|
+
try {
|
|
9
|
+
const count = await modules.products.reviews.count(params);
|
|
10
|
+
return {
|
|
11
|
+
content: [
|
|
12
|
+
{
|
|
13
|
+
type: 'text',
|
|
14
|
+
text: count.toString(),
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return {
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: 'text',
|
|
24
|
+
text: `Error fetching review count: ${error.message}`,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=productReviewsCountHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"productReviewsCountHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/productReviewsCountHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;CACvF,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAIhF,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,OAAgB,EAAE,MAAiC;IAClG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAE3D,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAE;iBACvB;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,gCAAiC,KAAe,CAAC,OAAO,EAAE;iBACjE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
export declare const ProductReviewsSchema: {
|
|
4
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
7
|
+
key: z.ZodString;
|
|
8
|
+
value: z.ZodEnum<["asc", "desc"]>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
key?: string;
|
|
11
|
+
value?: "asc" | "desc";
|
|
12
|
+
}, {
|
|
13
|
+
key?: string;
|
|
14
|
+
value?: "asc" | "desc";
|
|
15
|
+
}>, "many">>;
|
|
16
|
+
queryString: z.ZodOptional<z.ZodString>;
|
|
17
|
+
};
|
|
18
|
+
export declare const ProductReviewsZodSchema: z.ZodObject<{
|
|
19
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
20
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
21
|
+
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
22
|
+
key: z.ZodString;
|
|
23
|
+
value: z.ZodEnum<["asc", "desc"]>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
key?: string;
|
|
26
|
+
value?: "asc" | "desc";
|
|
27
|
+
}, {
|
|
28
|
+
key?: string;
|
|
29
|
+
value?: "asc" | "desc";
|
|
30
|
+
}>, "many">>;
|
|
31
|
+
queryString: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
sort?: {
|
|
34
|
+
key?: string;
|
|
35
|
+
value?: "asc" | "desc";
|
|
36
|
+
}[];
|
|
37
|
+
queryString?: string;
|
|
38
|
+
limit?: number;
|
|
39
|
+
offset?: number;
|
|
40
|
+
}, {
|
|
41
|
+
sort?: {
|
|
42
|
+
key?: string;
|
|
43
|
+
value?: "asc" | "desc";
|
|
44
|
+
}[];
|
|
45
|
+
queryString?: string;
|
|
46
|
+
limit?: number;
|
|
47
|
+
offset?: number;
|
|
48
|
+
}>;
|
|
49
|
+
export type ProductReviewsParams = z.infer<typeof ProductReviewsZodSchema>;
|
|
50
|
+
export declare function productReviewsHandler(context: Context, params: ProductReviewsParams): Promise<{
|
|
51
|
+
content: {
|
|
52
|
+
type: "text";
|
|
53
|
+
text: string;
|
|
54
|
+
}[];
|
|
55
|
+
}>;
|
|
56
|
+
//# sourceMappingURL=productReviewsHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"productReviewsHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/productReviewsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAK3C,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;CAahC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAiC,CAAC;AAEtE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE3E,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB;;;;;GA4BzF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { log } from '@unchainedshop/logger';
|
|
3
|
+
const SortDirectionEnum = z.enum(['asc', 'desc']); // assuming these are your directions
|
|
4
|
+
export const ProductReviewsSchema = {
|
|
5
|
+
limit: z.number().int().min(1).max(100).default(10).describe('Number of reviews to return'),
|
|
6
|
+
offset: z.number().int().min(0).default(0).describe('Number of reviews to skip'),
|
|
7
|
+
sort: z
|
|
8
|
+
.array(z.object({
|
|
9
|
+
key: z.string().min(1).describe('Field to sort by'),
|
|
10
|
+
value: SortDirectionEnum.describe('Sort direction: asc or desc'),
|
|
11
|
+
}))
|
|
12
|
+
.optional()
|
|
13
|
+
.describe('Sort options'),
|
|
14
|
+
queryString: z.string().optional().describe('Optional filter query'),
|
|
15
|
+
};
|
|
16
|
+
export const ProductReviewsZodSchema = z.object(ProductReviewsSchema);
|
|
17
|
+
export async function productReviewsHandler(context, params) {
|
|
18
|
+
const { limit, offset, queryString } = params;
|
|
19
|
+
const { modules, userId } = context;
|
|
20
|
+
try {
|
|
21
|
+
log(`query productReviews: ${limit} ${offset} ${queryString || ''}`, {
|
|
22
|
+
userId,
|
|
23
|
+
});
|
|
24
|
+
const reviews = await modules.products.reviews.findProductReviews(params);
|
|
25
|
+
return {
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
type: 'text',
|
|
29
|
+
text: JSON.stringify({ reviews }),
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
content: [
|
|
37
|
+
{
|
|
38
|
+
type: 'text',
|
|
39
|
+
text: `Error fetching product reviews: ${error.message}`,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=productReviewsHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"productReviewsHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/productReviewsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,qCAAqC;AAExF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAA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ACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC;iBAClC;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,mCAAoC,KAAe,CAAC,OAAO,EAAE;iBACpE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
export declare const ProductsCountSchema: {
|
|
4
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
5
|
+
slugs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
6
|
+
includeDrafts: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
+
queryString: z.ZodOptional<z.ZodString>;
|
|
8
|
+
};
|
|
9
|
+
export declare const ProductsCountZodSchema: z.ZodObject<{
|
|
10
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
11
|
+
slugs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
12
|
+
includeDrafts: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
+
queryString: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
slugs?: string[];
|
|
16
|
+
tags?: string[];
|
|
17
|
+
includeDrafts?: boolean;
|
|
18
|
+
queryString?: string;
|
|
19
|
+
}, {
|
|
20
|
+
slugs?: string[];
|
|
21
|
+
tags?: string[];
|
|
22
|
+
includeDrafts?: boolean;
|
|
23
|
+
queryString?: string;
|
|
24
|
+
}>;
|
|
25
|
+
export type ProductsCountParams = z.infer<typeof ProductsCountZodSchema>;
|
|
26
|
+
export declare function productsCountHandler(context: Context, params: ProductsCountParams): Promise<{
|
|
27
|
+
content: {
|
|
28
|
+
type: "text";
|
|
29
|
+
text: string;
|
|
30
|
+
}[];
|
|
31
|
+
}>;
|
|
32
|
+
//# sourceMappingURL=productsCountHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"productsCountHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/productsCountHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,eAAO,MAAM,mBAAmB;;;;;CAK/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;EAAgC,CAAC;AACpE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEzE,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB;;;;;GAwBvF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const ProductsCountSchema = {
|
|
3
|
+
tags: z.array(z.string().min(1)).optional(),
|
|
4
|
+
slugs: z.array(z.string().min(1)).optional(),
|
|
5
|
+
includeDrafts: z.boolean().default(false),
|
|
6
|
+
queryString: z.string().min(1).optional(),
|
|
7
|
+
};
|
|
8
|
+
export const ProductsCountZodSchema = z.object(ProductsCountSchema);
|
|
9
|
+
export async function productsCountHandler(context, params) {
|
|
10
|
+
const { modules } = context;
|
|
11
|
+
try {
|
|
12
|
+
const count = await modules.products.count(params);
|
|
13
|
+
return {
|
|
14
|
+
content: [
|
|
15
|
+
{
|
|
16
|
+
type: 'text',
|
|
17
|
+
text: count.toString(),
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return {
|
|
24
|
+
content: [
|
|
25
|
+
{
|
|
26
|
+
type: 'text',
|
|
27
|
+
text: `Error counting products: ${error.message}`,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=productsCountHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"productsCountHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/productsCountHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC3C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC5C,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACzC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC1C,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAGpE,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAgB,EAAE,MAA2B;IACtF,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEnD,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAE;iBACvB;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,4BAA6B,KAAe,CAAC,OAAO,EAAE;iBAC7D;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
export declare const PublishProductSchema: {
|
|
4
|
+
productId: z.ZodString;
|
|
5
|
+
};
|
|
6
|
+
export declare const PublishProductZodSchema: z.ZodObject<{
|
|
7
|
+
productId: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
productId?: string;
|
|
10
|
+
}, {
|
|
11
|
+
productId?: string;
|
|
12
|
+
}>;
|
|
13
|
+
export type PublishProductParams = z.infer<typeof PublishProductZodSchema>;
|
|
14
|
+
export declare function publishProductHandler(context: Context, params: PublishProductParams): Promise<{
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=publishProduct.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publishProduct.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/publishProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,eAAO,MAAM,oBAAoB;;CAEhC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;EAAiC,CAAC;AAEtE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE3E,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB;;;;;GA+BzF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ProductNotFoundError, ProductWrongStatusError } from '../../errors.js';
|
|
3
|
+
import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
|
|
4
|
+
export const PublishProductSchema = {
|
|
5
|
+
productId: z.string().min(1).describe('ID of the product to publish'),
|
|
6
|
+
};
|
|
7
|
+
export const PublishProductZodSchema = z.object(PublishProductSchema);
|
|
8
|
+
export async function publishProductHandler(context, params) {
|
|
9
|
+
const { productId } = params;
|
|
10
|
+
const { modules } = context;
|
|
11
|
+
try {
|
|
12
|
+
const product = await modules.products.findProduct({ productId });
|
|
13
|
+
if (!product)
|
|
14
|
+
throw new ProductNotFoundError({ productId });
|
|
15
|
+
if (!(await modules.products.publish(product))) {
|
|
16
|
+
throw new ProductWrongStatusError({ status: product.status });
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
content: [
|
|
20
|
+
{
|
|
21
|
+
type: 'text',
|
|
22
|
+
text: JSON.stringify({
|
|
23
|
+
product: await getNormalizedProductDetails(productId, context),
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: 'text',
|
|
34
|
+
text: `Error publishing product: ${error.message}`,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=publishProduct.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publishProduct.js","sourceRoot":"","sources":["../../../src/mcp/tools/publishProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM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,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
export declare const RemoveLanguageSchema: {
|
|
4
|
+
languageId: z.ZodString;
|
|
5
|
+
};
|
|
6
|
+
export declare const RemoveLanguageZodSchema: z.ZodObject<{
|
|
7
|
+
languageId: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
languageId?: string;
|
|
10
|
+
}, {
|
|
11
|
+
languageId?: string;
|
|
12
|
+
}>;
|
|
13
|
+
export type RemoveLanguageParams = z.infer<typeof RemoveLanguageZodSchema>;
|
|
14
|
+
export declare function removeLanguageHandler(context: Context, params: RemoveLanguageParams): Promise<{
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=removeLanguageHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeLanguageHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/removeLanguageHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,eAAO,MAAM,oBAAoB;;CAEhC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;EAAiC,CAAC;AACtE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE3E,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB;;;;;GA8BzF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { LanguageNotFoundError } from '../../errors.js';
|
|
3
|
+
export const RemoveLanguageSchema = {
|
|
4
|
+
languageId: z.string().min(1).describe('ID of the language to remove'),
|
|
5
|
+
};
|
|
6
|
+
export const RemoveLanguageZodSchema = z.object(RemoveLanguageSchema);
|
|
7
|
+
export async function removeLanguageHandler(context, params) {
|
|
8
|
+
const { languageId } = params;
|
|
9
|
+
const { modules } = context;
|
|
10
|
+
try {
|
|
11
|
+
if (!(await modules.languages.languageExists({ languageId })))
|
|
12
|
+
throw new LanguageNotFoundError({ languageId });
|
|
13
|
+
await modules.languages.delete(languageId);
|
|
14
|
+
const removeLanguage = await modules.languages.findLanguage({ languageId });
|
|
15
|
+
return {
|
|
16
|
+
content: [
|
|
17
|
+
{
|
|
18
|
+
type: 'text',
|
|
19
|
+
text: JSON.stringify({ language: removeLanguage }),
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return {
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
type: 'text',
|
|
29
|
+
text: `Error removing language: ${error.message}`,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=removeLanguageHandler.js.map
|