@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpHandler.js","sourceRoot":"","sources":["../../src/fastify/mcpHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcpHandler.js","sourceRoot":"","sources":["../../src/fastify/mcpHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,eAAe,MAAM,iBAAiB,CAAC;AAE9C,MAAM,MAAM,GAAG,YAAY,CAAC,uBAAuB,CAAC,CAAC;AAErD,MAAM,UAAU,GAAkD,EAAE,CAAC;AAErE,MAAM,UAAU,GAAuB,KAAK,EAC1C,GAAmD,EACnD,GAAG,EACH,EAAE;IACF,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;QAC/B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChB,GAAG,CAAC,MAAM,CACR,kBAAkB,EAClB,kEAAkE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,uBAAuB,IAAI,CACtH,CAAC;QACF,OAAO,GAAG,CAAC,IAAI,CACb,IAAI,CAAC,SAAS,CAAC;YACb,KAAK,EAAE,eAAe;YACtB,iBAAiB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,uBAAuB,uCAAuC;SAC7G,CAAC,CACH,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,IAAI,GAAG,CAAC,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AAC;AACH,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tempUploadHandler.d.ts","sourceRoot":"","sources":["../../src/fastify/tempUploadHandler.ts"],"names":[],"mappings":"AAKA,OAAO,EAAkB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAI7D,QAAA,MAAM,iBAAiB,EAAE,kBAwCxB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
+
import { getFileAdapter } from '@unchainedshop/core-files';
|
|
3
|
+
import { checkAction } from '../acl.js';
|
|
4
|
+
import { actions } from '../roles/index.js';
|
|
5
|
+
const logger = createLogger('unchained:temp-upload');
|
|
6
|
+
const tempUploadHandler = async (req, res) => {
|
|
7
|
+
try {
|
|
8
|
+
const context = req.unchainedContext;
|
|
9
|
+
await checkAction(context, actions.uploadTempFile);
|
|
10
|
+
const data = await req.file();
|
|
11
|
+
const file = await context.services.files.uploadFileFromStream({
|
|
12
|
+
directoryName: 'temp-uploads',
|
|
13
|
+
rawFile: Promise.resolve({
|
|
14
|
+
filename: data.filename,
|
|
15
|
+
createReadStream: () => data.file,
|
|
16
|
+
mimetype: data.mimetype,
|
|
17
|
+
}),
|
|
18
|
+
meta: { fieldname: data.fieldname, encoding: data.encoding },
|
|
19
|
+
});
|
|
20
|
+
// Add an expiration date to this file manually!
|
|
21
|
+
const expires = new Date(Date.now() + 24 * 60 * 60 * 1000);
|
|
22
|
+
await context.modules.files.update(file._id, {
|
|
23
|
+
expires, // Default to 1 hour
|
|
24
|
+
});
|
|
25
|
+
const fileUploadAdapter = getFileAdapter();
|
|
26
|
+
const rawUrl = await fileUploadAdapter.createDownloadURL(file);
|
|
27
|
+
const url = context.modules.files.normalizeUrl(rawUrl, {});
|
|
28
|
+
const body = JSON.stringify({ fileId: file._id, url, expires: expires.toISOString() });
|
|
29
|
+
res.status(200);
|
|
30
|
+
res.header('Content-Length', Buffer.byteLength(body));
|
|
31
|
+
res.header('Content-Type', 'application/json');
|
|
32
|
+
return res.send(body);
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
logger.error(e.message);
|
|
36
|
+
res.status(503);
|
|
37
|
+
return res.send(JSON.stringify({ name: e.name, code: e.code, message: e.message }));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export default tempUploadHandler;
|
|
41
|
+
//# sourceMappingURL=tempUploadHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tempUploadHandler.js","sourceRoot":"","sources":["../../src/fastify/tempUploadHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAI5C,MAAM,MAAM,GAAG,YAAY,CAAC,uBAAuB,CAAC,CAAC;AAErD,MAAM,iBAAiB,GAAuB,KAAK,EACjD,GAA8D,EAC9D,GAAG,EACH,EAAE;IACF,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,GAAG,CAAC,gBAAgB,CAAC;QAErC,MAAM,WAAW,CAAC,OAAO,EAAG,OAAe,CAAC,cAAc,CAAC,CAAC;QAE5D,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAE9B,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,oBAAoB,CAAC;YAC7D,aAAa,EAAE,cAAc;YAC7B,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;gBACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI;gBACjC,QAA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O,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACtF,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashPassword.d.ts","sourceRoot":"","sources":["../src/hashPassword.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,aAAc,MAAM,KAAG,MAE/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashPassword.js","sourceRoot":"","sources":["../src/hashPassword.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAAgB,EAAU,EAAE;IACvD,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpE,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import DataLoader from 'dataloader';
|
|
2
|
-
import { buildLocaleMap } from './utils.js';
|
|
3
2
|
import buildTextMap from './buildTextMap.js';
|
|
3
|
+
import buildLocaleMap from './buildLocaleMap.js';
|
|
4
4
|
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
5
5
|
const assortmentMediaIds = [...new Set(queries.map((q) => q.assortmentMediaId).filter(Boolean))];
|
|
6
6
|
const texts = await unchainedAPI.modules.assortments.media.texts.findMediaTexts({ assortmentMediaId: { $in: assortmentMediaIds } }, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assortmentMediaTextLoader.js","sourceRoot":"","sources":["../../src/loaders/assortmentMediaTextLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"assortmentMediaTextLoader.js","sourceRoot":"","sources":["../../src/loaders/assortmentMediaTextLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CACZ,KAAK,EAAE,OAAO,EAAE,EAAE;IAChB,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEjG,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAC7E,EAAE,iBAAiB,EAAE,EAAE,GAAG,EAAE,kBAAkB,EAAE,EAAE,EAClD;QACE,IAAI,EAAE;YACJ,iBAAiB,EAAE,CAAC;SACrB;KACF,CACF,CAAC;IAEF,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAElF,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACtE,CAAC,CACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import DataLoader from 'dataloader';
|
|
2
|
-
import { buildLocaleMap } from './utils.js';
|
|
3
2
|
import buildTextMap from './buildTextMap.js';
|
|
3
|
+
import buildLocaleMap from './buildLocaleMap.js';
|
|
4
4
|
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
5
5
|
const assortmentIds = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
|
|
6
6
|
const texts = await unchainedAPI.modules.assortments.texts.findTexts({ assortmentId: { $in: assortmentIds } }, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assortmentTextLoader.js","sourceRoot":"","sources":["../../src/loaders/assortmentTextLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"assortmentTextLoader.js","sourceRoot":"","sources":["../../src/loaders/assortmentTextLoader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAAgE,KAAK,EAAE,OAAO,EAAE,EAAE;IAC9F,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEvF,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAClE,EAAE,YAAY,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,EAAE,EACxC;QACE,IAAI,EAAE;YACJ,YAAY,EAAE,CAAC;SAChB;KACF,CACF,CAAC;IAEF,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAE7E,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildLocaleMap.d.ts","sourceRoot":"","sources":["../../src/loaders/buildLocaleMap.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAO,EAAE,SAAS;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE,EAAE,EAC3C,KAAK,EAAE,SAAS;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,GACpC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAe1B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { systemLocale } from '@unchainedshop/utils';
|
|
2
|
+
function getLocaleStrings(locale) {
|
|
3
|
+
try {
|
|
4
|
+
const locales = new Set();
|
|
5
|
+
locales.add(locale.baseName);
|
|
6
|
+
locales.add(locale.language);
|
|
7
|
+
locales.add(systemLocale.baseName);
|
|
8
|
+
locales.add(systemLocale.language);
|
|
9
|
+
return Array.from(locales);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
// Optimized Set creation and spread
|
|
13
|
+
const locales = new Set();
|
|
14
|
+
locales.add(systemLocale.baseName);
|
|
15
|
+
locales.add(systemLocale.language);
|
|
16
|
+
return Array.from(locales);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export default function buildLocaleMap(queries, texts) {
|
|
20
|
+
// key = texts.locale
|
|
21
|
+
// value = input query locale
|
|
22
|
+
const queryLocales = new Set(queries.map((q) => q.locale));
|
|
23
|
+
const textLocales = new Set(texts.map((t) => t.locale));
|
|
24
|
+
const localeMap = {};
|
|
25
|
+
for (const queryLocale of queryLocales) {
|
|
26
|
+
const potentialMatches = getLocaleStrings(queryLocale);
|
|
27
|
+
const matches = potentialMatches.filter((l) => textLocales.has(l));
|
|
28
|
+
for (const match of matches) {
|
|
29
|
+
if (!localeMap[match])
|
|
30
|
+
localeMap[match] = [];
|
|
31
|
+
localeMap[match].push(queryLocale.toString());
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return localeMap;
|
|
35
|
+
}
|
|
36
|
+
// import { systemLocale } from '@unchainedshop/utils';
|
|
37
|
+
// export function getLocaleStrings(locale: Intl.Locale) {
|
|
38
|
+
// try {
|
|
39
|
+
// return [
|
|
40
|
+
// ...new Set([locale.baseName, locale.language, systemLocale.baseName, systemLocale.language]),
|
|
41
|
+
// ];
|
|
42
|
+
// } catch {
|
|
43
|
+
// return [...new Set([systemLocale.baseName, systemLocale.language])];
|
|
44
|
+
// }
|
|
45
|
+
// }
|
|
46
|
+
// export function buildLocaleMap(
|
|
47
|
+
// queries: readonly { locale: Intl.Locale }[],
|
|
48
|
+
// texts: readonly { locale?: string }[],
|
|
49
|
+
// ): Record<string, string[]> {
|
|
50
|
+
// // key = texts.locale
|
|
51
|
+
// // value = input query locale
|
|
52
|
+
// const queryLocales = Object.values(
|
|
53
|
+
// Object.fromEntries(queries.map((q) => [q.locale.baseName, q.locale])),
|
|
54
|
+
// );
|
|
55
|
+
// const textLocales: string[] = [...new Set(texts.map((t) => t.locale))];
|
|
56
|
+
// const localeMap = {};
|
|
57
|
+
// for (const queryLocale of queryLocales) {
|
|
58
|
+
// const potentialMatches = getLocaleStrings(queryLocale);
|
|
59
|
+
// const matches = potentialMatches.filter((l) => textLocales.includes(l));
|
|
60
|
+
// for (const match of matches) {
|
|
61
|
+
// if (!localeMap[match]) localeMap[match] = [];
|
|
62
|
+
// localeMap[match].push(queryLocale);
|
|
63
|
+
// }
|
|
64
|
+
// }
|
|
65
|
+
// return localeMap;
|
|
66
|
+
// }
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CAAC,MAAM,CAAC,CAAC,CAAC;IACxD,MAAM,SAAS,GAA6B,EAAE,CAAC;IAC/C,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;QACvD,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACnE,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBAAE,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YAC7C,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,uDAAuD;AAEvD,0DAA0D;AAC1D,UAAU;AACV,eAAe;AACf,sGAAsG;AACtG,SAAS;AACT,cAAc;AACd,2EAA2E;AAC3E,MAAM;AACN,IAAI;AAEJ,kCAAkC;AAClC,iDAAiD;AACjD,2CAA2C;AAC3C,gCAAgC;AAChC,0BAA0B;AAC1B,kCAAkC;AAElC,wCAAwC;AACxC,6EAA6E;AAC7E,OAAO;AAEP,4EAA4E;AAC5E,0BAA0B;AAC1B,8CAA8C;AAC9C,8DAA8D;AAC9D,+EAA+E;AAC/E,qCAAqC;AACrC,sDAAsD;AACtD,4CAA4C;AAC5C,QAAQ;AACR,MAAM;AACN,sBAAsB;AACtB,IAAI"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type ArrayElement<T> = T extends (infer U)[] ? U : never;
|
|
2
2
|
export default function buildTextMap<T extends {
|
|
3
3
|
locale?: string;
|
|
4
|
-
}[]>(localeMap: Record<string, string[]>, texts: Readonly<T>, buildId: (item: ArrayElement<T>) => string):
|
|
4
|
+
}[]>(localeMap: Record<string, string[]>, texts: Readonly<T>, buildId: (item: ArrayElement<T>) => string): Record<string, ArrayElement<T>>;
|
|
5
5
|
export {};
|
|
6
6
|
//# sourceMappingURL=buildTextMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildTextMap.d.ts","sourceRoot":"","sources":["../../src/loaders/buildTextMap.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"buildTextMap.d.ts","sourceRoot":"","sources":["../../src/loaders/buildTextMap.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC;AAIzD,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,SAAS;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,EAClE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EACnC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,MAAM,mCA8B3C"}
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
+
/* This file has been optimized for performance to the last drop. Don't refactor! */
|
|
1
2
|
export default function buildTextMap(localeMap, texts, buildId) {
|
|
2
|
-
const textsMap = {};
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const textsMap = {}; // Added type for textsMap
|
|
4
|
+
const localeMapKeys = Object.keys(localeMap);
|
|
5
|
+
// eslint-disable-next-line
|
|
6
|
+
for (let i = 0; i < localeMapKeys.length; i++) {
|
|
7
|
+
const originLocale = localeMapKeys[i];
|
|
8
|
+
const localesForText = localeMap[originLocale];
|
|
9
|
+
// eslint-disable-next-line
|
|
10
|
+
for (let j = 0; j < texts.length; j++) {
|
|
11
|
+
const text = texts[j];
|
|
5
12
|
if (originLocale !== text.locale)
|
|
6
13
|
continue;
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
const idPart = buildId(text); // Ensured correct type for buildId argument
|
|
15
|
+
// eslint-disable-next-line
|
|
16
|
+
for (let k = 0; k < localesForText.length; k++) {
|
|
17
|
+
const locale = localesForText[k];
|
|
18
|
+
const key = locale + idPart;
|
|
19
|
+
if (textsMap[key] && locale !== text.locale) {
|
|
20
|
+
// If the key already exists and the locale is a fallback, skip this text
|
|
9
21
|
continue;
|
|
10
|
-
|
|
22
|
+
}
|
|
23
|
+
textsMap[key] = text; // Ensured correct type for assignment
|
|
11
24
|
}
|
|
12
25
|
}
|
|
13
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildTextMap.js","sourceRoot":"","sources":["../../src/loaders/buildTextMap.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,SAAmC,EACnC,KAAkB,EAClB,OAA0C;IAE1C,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"buildTextMap.js","sourceRoot":"","sources":["../../src/loaders/buildTextMap.ts"],"names":[],"mappings":"AAEA,oFAAoF;AAEpF,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,SAAmC,EACnC,KAAkB,EAClB,OAA0C;IAE1C,MAAM,QAAQ,GAAoC,EAAE,CAAC,CAAC,0BAA0B;IAChF,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAE7C,2BAA2B;IAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,MAAM,YAAY,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QACtC,MAAM,cAAc,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;QAE/C,2BAA2B;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,YAAY,KAAK,IAAI,CAAC,MAAM;gBAAE,SAAS;YAE3C,MAAM,MAAM,GAAG,OAAO,CAAC,IAAuB,CAAC,CAAC,CAAC,4CAA4C;YAE7F,2BAA2B;YAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/C,MAAM,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;gBACjC,MAAM,GAAG,GAAG,MAAM,GAAG,MAAM,CAAC;gBAC5B,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;oBAC5C,yEAAyE;oBACzE,SAAS;gBACX,CAAC;gBACD,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAuB,CAAC,CAAC,sCAAsC;YACjF,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import DataLoader from 'dataloader';
|
|
2
|
-
import
|
|
2
|
+
import buildLocaleMap from './buildLocaleMap.js';
|
|
3
3
|
import buildTextMap from './buildTextMap.js';
|
|
4
4
|
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
5
5
|
const filterIds = [...new Set(queries.map((q) => q.filterId).filter(Boolean))];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterTextLoader.js","sourceRoot":"","sources":["../../src/loaders/filterTextLoader.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"filterTextLoader.js","sourceRoot":"","sources":["../../src/loaders/filterTextLoader.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CACZ,KAAK,EAAE,OAAO,EAAE,EAAE;IAChB,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAE/E,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAC9D,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAChC;QACE,IAAI,EAAE;YACJ,QAAQ,EAAE,CAAC;SACZ;KACF,CACF,CAAC;IAEF,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAElG,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACnF,CAAC,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"productMediaTextLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/productMediaTextLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,UAAU,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"productMediaTextLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/productMediaTextLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;yBAIhD,cAAc,aAAa;oBACR,MAAM;YAAU,IAAI,CAAC,MAAM;;oBAA3B,MAAM;YAAU,IAAI,CAAC,MAAM;;AAD9D,wBAiBK"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import DataLoader from 'dataloader';
|
|
2
|
-
import
|
|
2
|
+
import buildLocaleMap from './buildLocaleMap.js';
|
|
3
3
|
import buildTextMap from './buildTextMap.js';
|
|
4
4
|
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
5
5
|
const productMediaIds = [...new Set(queries.map((q) => q.productMediaId).filter(Boolean))];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"productMediaTextLoader.js","sourceRoot":"","sources":["../../src/loaders/productMediaTextLoader.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"productMediaTextLoader.js","sourceRoot":"","sources":["../../src/loaders/productMediaTextLoader.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAAoE,KAAK,EAAE,OAAO,EAAE,EAAE;IAClG,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAE3F,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAC1E,EAAE,cAAc,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,EAAE,EAC5C;QACE,IAAI,EAAE;YACJ,cAAc,EAAE,CAAC;SAClB;KACF,CACF,CAAC;IAEF,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAE/E,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC;AACnE,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"productTextLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/productTextLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,UAAU,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"productTextLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/productTextLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;yBAI3C,cAAc,aAAa;eACb,MAAM;YAAU,IAAI,CAAC,MAAM;;eAA3B,MAAM;YAAU,IAAI,CAAC,MAAM;;AADzD,wBAeK"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import DataLoader from 'dataloader';
|
|
2
|
-
import { buildLocaleMap } from './utils.js';
|
|
3
2
|
import buildTextMap from './buildTextMap.js';
|
|
3
|
+
import buildLocaleMap from './buildLocaleMap.js';
|
|
4
4
|
export default (unchainedAPI) => new DataLoader(async (queries) => {
|
|
5
5
|
const productIds = [...new Set(queries.map((q) => q.productId))].filter(Boolean);
|
|
6
6
|
const texts = await unchainedAPI.modules.products.texts.findTexts({ productId: { $in: productIds } }, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"productTextLoader.js","sourceRoot":"","sources":["../../src/loaders/productTextLoader.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"productTextLoader.js","sourceRoot":"","sources":["../../src/loaders/productTextLoader.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,eAAe,CAAC,YAA2B,EAAE,EAAE,CAC7C,IAAI,UAAU,CAA0D,KAAK,EAAE,OAAO,EAAE,EAAE;IACxF,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjF,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAC/D,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,EAClC;QACE,IAAI,EAAE;YACJ,SAAS,EAAE,CAAC;SACb;KACF,CACF,CAAC;IACF,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAE1E,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC,CAAC"}
|
package/lib/mcp/index.d.ts
CHANGED
|
@@ -1,95 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
filterQuery?: {
|
|
5
|
-
key: string;
|
|
6
|
-
value?: string;
|
|
7
|
-
}[];
|
|
8
|
-
assortmentId?: string;
|
|
9
|
-
orderBy?: 'default';
|
|
10
|
-
includeInactive?: boolean;
|
|
11
|
-
ignoreChildAssortments?: boolean;
|
|
12
|
-
limit?: number;
|
|
13
|
-
offset?: number;
|
|
14
|
-
}
|
|
15
|
-
export declare function searchProductsWithCore(unchainedAPI: UnchainedCore, args: SearchProductsArgs): Promise<{
|
|
16
|
-
summary: {
|
|
17
|
-
totalProducts: number;
|
|
18
|
-
filteredProducts: number;
|
|
19
|
-
};
|
|
20
|
-
products: {
|
|
21
|
-
id: string;
|
|
22
|
-
title: string;
|
|
23
|
-
image: any;
|
|
24
|
-
price: string;
|
|
25
|
-
breadcrumb: string;
|
|
26
|
-
}[];
|
|
27
|
-
filters: {
|
|
28
|
-
forceLiveCollection: boolean;
|
|
29
|
-
searchQuery: import("@unchainedshop/core-filters").SearchQuery;
|
|
30
|
-
filter: import("@unchainedshop/core-filters").Filter;
|
|
31
|
-
examinedProductIdSet: Set<string>;
|
|
32
|
-
filteredByOtherFiltersSet: Set<string>;
|
|
33
|
-
filteredByThisFilterSet: Set<string>;
|
|
34
|
-
}[];
|
|
35
|
-
}>;
|
|
36
|
-
export declare function renderProductList(results: any): string;
|
|
37
|
-
export declare const searchProductsTool: {
|
|
38
|
-
name: string;
|
|
39
|
-
description: string;
|
|
40
|
-
inputSchema: {
|
|
41
|
-
type: string;
|
|
42
|
-
properties: {
|
|
43
|
-
queryString: {
|
|
44
|
-
type: string;
|
|
45
|
-
description: string;
|
|
46
|
-
};
|
|
47
|
-
filterQuery: {
|
|
48
|
-
type: string;
|
|
49
|
-
items: {
|
|
50
|
-
type: string;
|
|
51
|
-
properties: {
|
|
52
|
-
key: {
|
|
53
|
-
type: string;
|
|
54
|
-
};
|
|
55
|
-
value: {
|
|
56
|
-
type: string;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
required: string[];
|
|
60
|
-
};
|
|
61
|
-
description: string;
|
|
62
|
-
};
|
|
63
|
-
assortmentId: {
|
|
64
|
-
type: string;
|
|
65
|
-
description: string;
|
|
66
|
-
};
|
|
67
|
-
orderBy: {
|
|
68
|
-
type: string;
|
|
69
|
-
enum: string[];
|
|
70
|
-
description: string;
|
|
71
|
-
};
|
|
72
|
-
includeInactive: {
|
|
73
|
-
type: string;
|
|
74
|
-
default: boolean;
|
|
75
|
-
description: string;
|
|
76
|
-
};
|
|
77
|
-
ignoreChildAssortments: {
|
|
78
|
-
type: string;
|
|
79
|
-
default: boolean;
|
|
80
|
-
description: string;
|
|
81
|
-
};
|
|
82
|
-
limit: {
|
|
83
|
-
type: string;
|
|
84
|
-
default: number;
|
|
85
|
-
description: string;
|
|
86
|
-
};
|
|
87
|
-
offset: {
|
|
88
|
-
type: string;
|
|
89
|
-
default: number;
|
|
90
|
-
description: string;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
};
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { Context } from '../context.js';
|
|
3
|
+
export default function createMcpServer(context: Context, roles: any): McpServer;
|
|
95
4
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/mcp/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAwExC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,KAAA,aA+O9D"}
|