@unchainedshop/api 4.0.0-rc.4 → 4.0.0-rc.5
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/express/createBulkImportMiddleware.d.ts.map +1 -1
- package/lib/express/createBulkImportMiddleware.js +1 -0
- package/lib/express/createBulkImportMiddleware.js.map +1 -1
- package/lib/fastify/bulkImportHandler.d.ts.map +1 -1
- package/lib/fastify/bulkImportHandler.js +1 -0
- package/lib/fastify/bulkImportHandler.js.map +1 -1
- package/lib/mcp/index.d.ts.map +1 -1
- package/lib/mcp/index.js +14 -84
- package/lib/mcp/index.js.map +1 -1
- package/lib/mcp/tools/assortment/addAssortmentFilterHandler.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/addAssortmentFilterHandler.js +4 -4
- package/lib/mcp/tools/assortment/addAssortmentFilterHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/addAssortmentLinkHandler.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/addAssortmentLinkHandler.js +14 -7
- package/lib/mcp/tools/assortment/addAssortmentLinkHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/addAssortmentMediaUploadHandler.js +4 -4
- package/lib/mcp/tools/assortment/addAssortmentMediaUploadHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/addAssortmentProductHandler.js +1 -1
- package/lib/mcp/tools/assortment/addAssortmentProductHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/assortmentChildrenHandler.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/assortmentChildrenHandler.js +7 -3
- package/lib/mcp/tools/assortment/assortmentChildrenHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/assortmentFiltersHandler.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/assortmentFiltersHandler.js +6 -2
- package/lib/mcp/tools/assortment/assortmentFiltersHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/assortmentHandler.js +1 -1
- package/lib/mcp/tools/assortment/assortmentHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/assortmentLinksHandler.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/assortmentLinksHandler.js +6 -2
- package/lib/mcp/tools/assortment/assortmentLinksHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/assortmentProductsHandler.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/assortmentProductsHandler.js +7 -3
- package/lib/mcp/tools/assortment/assortmentProductsHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/assortmentsCountHandler.js +1 -1
- package/lib/mcp/tools/assortment/assortmentsCountHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/assortmentsHandler.d.ts +0 -10
- package/lib/mcp/tools/assortment/assortmentsHandler.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/assortmentsHandler.js +2 -2
- package/lib/mcp/tools/assortment/assortmentsHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/createAssortmentHandler.js +1 -1
- package/lib/mcp/tools/assortment/createAssortmentHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/index.d.ts +4 -0
- package/lib/mcp/tools/assortment/index.d.ts.map +1 -0
- package/lib/mcp/tools/assortment/index.js +59 -0
- package/lib/mcp/tools/assortment/index.js.map +1 -0
- package/lib/mcp/tools/assortment/removeAssortmentFilterHandler.js +1 -1
- package/lib/mcp/tools/assortment/removeAssortmentFilterHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/removeAssortmentHandler.js +1 -1
- package/lib/mcp/tools/assortment/removeAssortmentHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/removeAssortmentLinkHandler.js +1 -1
- package/lib/mcp/tools/assortment/removeAssortmentLinkHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/removeAssortmentMediaHandler.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/removeAssortmentMediaHandler.js +5 -2
- package/lib/mcp/tools/assortment/removeAssortmentMediaHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/removeAssortmentProductHandler.js +1 -1
- package/lib/mcp/tools/assortment/removeAssortmentProductHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/reorderAssortmentFiltersHandler.js +3 -3
- package/lib/mcp/tools/assortment/reorderAssortmentFiltersHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/reorderAssortmentLinksHandler.js +4 -4
- package/lib/mcp/tools/assortment/reorderAssortmentLinksHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/reorderAssortmentMediaHandler.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/reorderAssortmentMediaHandler.js +4 -4
- package/lib/mcp/tools/assortment/reorderAssortmentMediaHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/reorderAssortmentProductsHandler.js +4 -4
- package/lib/mcp/tools/assortment/reorderAssortmentProductsHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/searchAssortmentProductHandler.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/searchAssortmentProductHandler.js +15 -4
- package/lib/mcp/tools/assortment/searchAssortmentProductHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/setBaseAssortmentHandler.js +1 -1
- package/lib/mcp/tools/assortment/setBaseAssortmentHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/translatedAssortmentMediaTextsHandler.js +1 -1
- package/lib/mcp/tools/assortment/translatedAssortmentMediaTextsHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/translatedAssortmentTextsHandler.js +1 -1
- package/lib/mcp/tools/assortment/translatedAssortmentTextsHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/updateAssortmentHandler.js +1 -1
- package/lib/mcp/tools/assortment/updateAssortmentHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/updateAssortmentMediaTextsHandler.js +1 -1
- package/lib/mcp/tools/assortment/updateAssortmentMediaTextsHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/updateAssortmentTextsHandler.d.ts +91 -0
- package/lib/mcp/tools/assortment/updateAssortmentTextsHandler.d.ts.map +1 -0
- package/lib/mcp/tools/assortment/updateAssortmentTextsHandler.js +52 -0
- package/lib/mcp/tools/assortment/updateAssortmentTextsHandler.js.map +1 -0
- package/lib/mcp/tools/country/countriesCountHandler.d.ts.map +1 -1
- package/lib/mcp/tools/country/countriesCountHandler.js +7 -5
- package/lib/mcp/tools/country/countriesCountHandler.js.map +1 -1
- package/lib/mcp/tools/country/countriesHandler.d.ts.map +1 -1
- package/lib/mcp/tools/country/countriesHandler.js +32 -8
- package/lib/mcp/tools/country/countriesHandler.js.map +1 -1
- package/lib/mcp/tools/country/countryHandler.d.ts.map +1 -1
- package/lib/mcp/tools/country/countryHandler.js +7 -2
- package/lib/mcp/tools/country/countryHandler.js.map +1 -1
- package/lib/mcp/tools/country/createCountryHandler.js +1 -1
- package/lib/mcp/tools/country/createCountryHandler.js.map +1 -1
- package/lib/mcp/tools/country/index.d.ts +4 -0
- package/lib/mcp/tools/country/index.d.ts.map +1 -0
- package/lib/mcp/tools/country/index.js +15 -0
- package/lib/mcp/tools/country/index.js.map +1 -0
- package/lib/mcp/tools/country/removeCountryHandler.js +1 -1
- package/lib/mcp/tools/country/removeCountryHandler.js.map +1 -1
- package/lib/mcp/tools/country/updateCountryHandler.js +1 -1
- package/lib/mcp/tools/country/updateCountryHandler.js.map +1 -1
- package/lib/mcp/tools/currency/createCurrencyHandler.d.ts.map +1 -1
- package/lib/mcp/tools/currency/createCurrencyHandler.js +8 -4
- package/lib/mcp/tools/currency/createCurrencyHandler.js.map +1 -1
- package/lib/mcp/tools/currency/currenciesCountHandler.d.ts.map +1 -1
- package/lib/mcp/tools/currency/currenciesCountHandler.js +4 -4
- package/lib/mcp/tools/currency/currenciesCountHandler.js.map +1 -1
- package/lib/mcp/tools/currency/currenciesHandler.d.ts.map +1 -1
- package/lib/mcp/tools/currency/currenciesHandler.js +17 -8
- package/lib/mcp/tools/currency/currenciesHandler.js.map +1 -1
- package/lib/mcp/tools/currency/currencyHandler.d.ts.map +1 -1
- package/lib/mcp/tools/currency/currencyHandler.js +7 -2
- package/lib/mcp/tools/currency/currencyHandler.js.map +1 -1
- package/lib/mcp/tools/currency/index.d.ts +4 -0
- package/lib/mcp/tools/currency/index.d.ts.map +1 -0
- package/lib/mcp/tools/currency/index.js +15 -0
- package/lib/mcp/tools/currency/index.js.map +1 -0
- package/lib/mcp/tools/currency/removeCurrencyHandler.js +1 -1
- package/lib/mcp/tools/currency/removeCurrencyHandler.js.map +1 -1
- package/lib/mcp/tools/currency/updateCurrencyHandler.d.ts.map +1 -1
- package/lib/mcp/tools/currency/updateCurrencyHandler.js +17 -8
- package/lib/mcp/tools/currency/updateCurrencyHandler.js.map +1 -1
- package/lib/mcp/tools/filter/createFilterHandler.js +4 -4
- package/lib/mcp/tools/filter/createFilterHandler.js.map +1 -1
- package/lib/mcp/tools/filter/createFilterOptionHandler.d.ts.map +1 -1
- package/lib/mcp/tools/filter/createFilterOptionHandler.js +12 -6
- package/lib/mcp/tools/filter/createFilterOptionHandler.js.map +1 -1
- package/lib/mcp/tools/filter/getFilterHandler.js +2 -2
- package/lib/mcp/tools/filter/getFilterHandler.js.map +1 -1
- package/lib/mcp/tools/filter/getFiltersHandler.d.ts.map +1 -1
- package/lib/mcp/tools/filter/getFiltersHandler.js +9 -14
- package/lib/mcp/tools/filter/getFiltersHandler.js.map +1 -1
- package/lib/mcp/tools/filter/index.d.ts +4 -0
- package/lib/mcp/tools/filter/index.d.ts.map +1 -0
- package/lib/mcp/tools/filter/index.js +21 -0
- package/lib/mcp/tools/filter/index.js.map +1 -0
- package/lib/mcp/tools/filter/removeFilterHandler.js +2 -2
- package/lib/mcp/tools/filter/removeFilterHandler.js.map +1 -1
- package/lib/mcp/tools/filter/removeFilterOptionHandler.js +3 -3
- package/lib/mcp/tools/filter/removeFilterOptionHandler.js.map +1 -1
- package/lib/mcp/tools/filter/translatedFilterTextsHandler.d.ts.map +1 -1
- package/lib/mcp/tools/filter/translatedFilterTextsHandler.js +9 -3
- package/lib/mcp/tools/filter/translatedFilterTextsHandler.js.map +1 -1
- package/lib/mcp/tools/filter/updateFilterHandler.js +4 -4
- package/lib/mcp/tools/filter/updateFilterHandler.js.map +1 -1
- package/lib/mcp/tools/filter/updateFilterTextsHandler.d.ts.map +1 -1
- package/lib/mcp/tools/filter/updateFilterTextsHandler.js +15 -6
- package/lib/mcp/tools/filter/updateFilterTextsHandler.js.map +1 -1
- package/lib/mcp/tools/index.d.ts +3 -86
- package/lib/mcp/tools/index.d.ts.map +1 -1
- package/lib/mcp/tools/index.js +4 -86
- package/lib/mcp/tools/index.js.map +1 -1
- package/lib/mcp/tools/language/createLanguageHandler.d.ts.map +1 -1
- package/lib/mcp/tools/language/createLanguageHandler.js +4 -2
- package/lib/mcp/tools/language/createLanguageHandler.js.map +1 -1
- package/lib/mcp/tools/language/index.d.ts +4 -0
- package/lib/mcp/tools/language/index.d.ts.map +1 -0
- package/lib/mcp/tools/language/index.js +15 -0
- package/lib/mcp/tools/language/index.js.map +1 -0
- package/lib/mcp/tools/language/languageHandler.d.ts.map +1 -1
- package/lib/mcp/tools/language/languageHandler.js +3 -1
- package/lib/mcp/tools/language/languageHandler.js.map +1 -1
- package/lib/mcp/tools/language/languagesCountHandler.js +2 -2
- package/lib/mcp/tools/language/languagesCountHandler.js.map +1 -1
- package/lib/mcp/tools/language/languagesHandler.d.ts +4 -4
- package/lib/mcp/tools/language/languagesHandler.d.ts.map +1 -1
- package/lib/mcp/tools/language/languagesHandler.js +15 -10
- package/lib/mcp/tools/language/languagesHandler.js.map +1 -1
- package/lib/mcp/tools/language/removeLanguageHandler.d.ts.map +1 -1
- package/lib/mcp/tools/language/removeLanguageHandler.js +6 -1
- package/lib/mcp/tools/language/removeLanguageHandler.js.map +1 -1
- package/lib/mcp/tools/language/updateLanguageHandler.d.ts.map +1 -1
- package/lib/mcp/tools/language/updateLanguageHandler.js +6 -1
- package/lib/mcp/tools/language/updateLanguageHandler.js.map +1 -1
- package/lib/mcp/tools/product/addProductAssignmentHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/addProductAssignmentHandler.js +5 -5
- package/lib/mcp/tools/product/addProductAssignmentHandler.js.map +1 -1
- package/lib/mcp/tools/product/addProductMediaUploadHandler.js +3 -3
- package/lib/mcp/tools/product/addProductMediaUploadHandler.js.map +1 -1
- package/lib/mcp/tools/product/createProductHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/createProductHandler.js +5 -2
- package/lib/mcp/tools/product/createProductHandler.js.map +1 -1
- package/lib/mcp/tools/product/createProductVariationHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/createProductVariationHandler.js +3 -1
- package/lib/mcp/tools/product/createProductVariationHandler.js.map +1 -1
- package/lib/mcp/tools/product/createProductVariationOptionHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/createProductVariationOptionHandler.js +3 -1
- package/lib/mcp/tools/product/createProductVariationOptionHandler.js.map +1 -1
- package/lib/mcp/tools/product/getProduct.d.ts +0 -12
- package/lib/mcp/tools/product/getProduct.d.ts.map +1 -1
- package/lib/mcp/tools/product/getProduct.js +4 -11
- package/lib/mcp/tools/product/getProduct.js.map +1 -1
- package/lib/mcp/tools/product/index.d.ts +4 -0
- package/lib/mcp/tools/product/index.d.ts.map +1 -0
- package/lib/mcp/tools/product/index.js +61 -0
- package/lib/mcp/tools/product/index.js.map +1 -0
- package/lib/mcp/tools/product/listProducts.d.ts +12 -56
- package/lib/mcp/tools/product/listProducts.d.ts.map +1 -1
- package/lib/mcp/tools/product/listProducts.js +26 -90
- package/lib/mcp/tools/product/listProducts.js.map +1 -1
- package/lib/mcp/tools/product/productReviewsCountHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/productReviewsCountHandler.js +3 -1
- package/lib/mcp/tools/product/productReviewsCountHandler.js.map +1 -1
- package/lib/mcp/tools/product/productReviewsHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/productReviewsHandler.js +1 -0
- package/lib/mcp/tools/product/productReviewsHandler.js.map +1 -1
- package/lib/mcp/tools/product/productsCountHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/productsCountHandler.js +7 -5
- package/lib/mcp/tools/product/productsCountHandler.js.map +1 -1
- package/lib/mcp/tools/product/publishProduct.d.ts.map +1 -1
- package/lib/mcp/tools/product/publishProduct.js +3 -1
- package/lib/mcp/tools/product/publishProduct.js.map +1 -1
- package/lib/mcp/tools/product/removeProductAssignmentHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/removeProductAssignmentHandler.js +3 -1
- package/lib/mcp/tools/product/removeProductAssignmentHandler.js.map +1 -1
- package/lib/mcp/tools/product/removeProductHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/removeProductHandler.js +3 -1
- package/lib/mcp/tools/product/removeProductHandler.js.map +1 -1
- package/lib/mcp/tools/product/removeProductMediaHandler.js +1 -1
- package/lib/mcp/tools/product/removeProductMediaHandler.js.map +1 -1
- package/lib/mcp/tools/product/removeProductVariationHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/removeProductVariationHandler.js +3 -1
- package/lib/mcp/tools/product/removeProductVariationHandler.js.map +1 -1
- package/lib/mcp/tools/product/removeProductVariationOptionHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/removeProductVariationOptionHandler.js +3 -1
- package/lib/mcp/tools/product/removeProductVariationOptionHandler.js.map +1 -1
- package/lib/mcp/tools/product/reorderProductMediaHandler.js +1 -1
- package/lib/mcp/tools/product/reorderProductMediaHandler.js.map +1 -1
- package/lib/mcp/tools/product/translatedProductMediaTextsHandler.js +1 -1
- package/lib/mcp/tools/product/translatedProductMediaTextsHandler.js.map +1 -1
- package/lib/mcp/tools/product/translatedProductTextsHandler.js +1 -1
- package/lib/mcp/tools/product/translatedProductTextsHandler.js.map +1 -1
- package/lib/mcp/tools/product/translatedProductVariationTextsHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/translatedProductVariationTextsHandler.js +2 -1
- package/lib/mcp/tools/product/translatedProductVariationTextsHandler.js.map +1 -1
- package/lib/mcp/tools/product/{unPublishProduct.d.ts → unpublishProductHandler.d.ts} +1 -1
- package/lib/mcp/tools/product/unpublishProductHandler.d.ts.map +1 -0
- package/lib/mcp/tools/product/{unPublishProduct.js → unpublishProductHandler.js} +4 -2
- package/lib/mcp/tools/product/unpublishProductHandler.js.map +1 -0
- package/lib/mcp/tools/product/updateProductCommerceHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/updateProductCommerceHandler.js +3 -1
- package/lib/mcp/tools/product/updateProductCommerceHandler.js.map +1 -1
- package/lib/mcp/tools/product/{updateProduct.d.ts → updateProductHandler.d.ts} +1 -1
- package/lib/mcp/tools/product/updateProductHandler.d.ts.map +1 -0
- package/lib/mcp/tools/product/{updateProduct.js → updateProductHandler.js} +4 -2
- package/lib/mcp/tools/product/updateProductHandler.js.map +1 -0
- package/lib/mcp/tools/product/updateProductMediaTextsHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/updateProductMediaTextsHandler.js +3 -1
- package/lib/mcp/tools/product/updateProductMediaTextsHandler.js.map +1 -1
- package/lib/mcp/tools/product/updateProductPlanHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/updateProductPlanHandler.js +8 -6
- package/lib/mcp/tools/product/updateProductPlanHandler.js.map +1 -1
- package/lib/mcp/tools/product/updateProductSupplyHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/updateProductSupplyHandler.js +22 -5
- package/lib/mcp/tools/product/updateProductSupplyHandler.js.map +1 -1
- package/lib/mcp/tools/product/updateProductTextsHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/updateProductTextsHandler.js +3 -1
- package/lib/mcp/tools/product/updateProductTextsHandler.js.map +1 -1
- package/lib/mcp/tools/product/updateProductTokenizationHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/updateProductTokenizationHandler.js +12 -8
- package/lib/mcp/tools/product/updateProductTokenizationHandler.js.map +1 -1
- package/lib/mcp/tools/product/updateProductWarehousingHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/updateProductWarehousingHandler.js +8 -4
- package/lib/mcp/tools/product/updateProductWarehousingHandler.js.map +1 -1
- package/package.json +1 -1
- package/src/express/createBulkImportMiddleware.ts +1 -0
- package/src/fastify/bulkImportHandler.ts +1 -0
- package/src/mcp/index.ts +14 -703
- package/src/mcp/tools/assortment/addAssortmentFilterHandler.ts +8 -4
- package/src/mcp/tools/assortment/addAssortmentLinkHandler.ts +14 -7
- package/src/mcp/tools/assortment/addAssortmentMediaUploadHandler.ts +4 -4
- package/src/mcp/tools/assortment/addAssortmentProductHandler.ts +1 -1
- package/src/mcp/tools/assortment/assortmentChildrenHandler.ts +7 -3
- package/src/mcp/tools/assortment/assortmentFiltersHandler.ts +6 -2
- package/src/mcp/tools/assortment/assortmentHandler.ts +1 -1
- package/src/mcp/tools/assortment/assortmentLinksHandler.ts +6 -2
- package/src/mcp/tools/assortment/assortmentProductsHandler.ts +7 -3
- package/src/mcp/tools/assortment/assortmentsCountHandler.ts +1 -1
- package/src/mcp/tools/assortment/assortmentsHandler.ts +2 -2
- package/src/mcp/tools/assortment/createAssortmentHandler.ts +1 -1
- package/src/mcp/tools/assortment/index.ts +273 -0
- package/src/mcp/tools/assortment/removeAssortmentFilterHandler.ts +1 -1
- package/src/mcp/tools/assortment/removeAssortmentHandler.ts +1 -1
- package/src/mcp/tools/assortment/removeAssortmentLinkHandler.ts +1 -1
- package/src/mcp/tools/assortment/removeAssortmentMediaHandler.ts +5 -2
- package/src/mcp/tools/assortment/removeAssortmentProductHandler.ts +1 -1
- package/src/mcp/tools/assortment/reorderAssortmentFiltersHandler.ts +3 -3
- package/src/mcp/tools/assortment/reorderAssortmentLinksHandler.ts +4 -4
- package/src/mcp/tools/assortment/reorderAssortmentMediaHandler.ts +6 -4
- package/src/mcp/tools/assortment/reorderAssortmentProductsHandler.ts +4 -4
- package/src/mcp/tools/assortment/searchAssortmentProductHandler.ts +17 -4
- package/src/mcp/tools/assortment/setBaseAssortmentHandler.ts +1 -1
- package/src/mcp/tools/assortment/translatedAssortmentMediaTextsHandler.ts +1 -1
- package/src/mcp/tools/assortment/translatedAssortmentTextsHandler.ts +1 -1
- package/src/mcp/tools/assortment/updateAssortmentHandler.ts +1 -1
- package/src/mcp/tools/assortment/updateAssortmentMediaTextsHandler.ts +1 -1
- package/src/mcp/tools/assortment/updateAssortmentTextsHandler.ts +66 -0
- package/src/mcp/tools/country/countriesCountHandler.ts +7 -5
- package/src/mcp/tools/country/countriesHandler.ts +32 -8
- package/src/mcp/tools/country/countryHandler.ts +7 -2
- package/src/mcp/tools/country/createCountryHandler.ts +1 -1
- package/src/mcp/tools/country/index.ts +46 -0
- package/src/mcp/tools/country/removeCountryHandler.ts +1 -1
- package/src/mcp/tools/country/updateCountryHandler.ts +1 -1
- package/src/mcp/tools/currency/createCurrencyHandler.ts +8 -4
- package/src/mcp/tools/currency/currenciesCountHandler.ts +4 -5
- package/src/mcp/tools/currency/currenciesHandler.ts +17 -8
- package/src/mcp/tools/currency/currencyHandler.ts +7 -2
- package/src/mcp/tools/currency/index.ts +48 -0
- package/src/mcp/tools/currency/removeCurrencyHandler.ts +1 -1
- package/src/mcp/tools/currency/updateCurrencyHandler.ts +17 -8
- package/src/mcp/tools/filter/createFilterHandler.ts +4 -4
- package/src/mcp/tools/filter/createFilterOptionHandler.ts +12 -6
- package/src/mcp/tools/filter/getFilterHandler.ts +2 -2
- package/src/mcp/tools/filter/getFiltersHandler.ts +9 -14
- package/src/mcp/tools/filter/index.ts +74 -0
- package/src/mcp/tools/filter/removeFilterHandler.ts +2 -2
- package/src/mcp/tools/filter/removeFilterOptionHandler.ts +3 -3
- package/src/mcp/tools/filter/translatedFilterTextsHandler.ts +9 -3
- package/src/mcp/tools/filter/updateFilterHandler.ts +4 -4
- package/src/mcp/tools/filter/updateFilterTextsHandler.ts +15 -6
- package/src/mcp/tools/index.ts +11 -88
- package/src/mcp/tools/language/createLanguageHandler.ts +6 -2
- package/src/mcp/tools/language/index.ts +42 -0
- package/src/mcp/tools/language/languageHandler.ts +3 -1
- package/src/mcp/tools/language/languagesCountHandler.ts +2 -2
- package/src/mcp/tools/language/languagesHandler.ts +15 -10
- package/src/mcp/tools/language/removeLanguageHandler.ts +6 -1
- package/src/mcp/tools/language/updateLanguageHandler.ts +6 -1
- package/src/mcp/tools/product/addProductAssignmentHandler.ts +6 -5
- package/src/mcp/tools/product/addProductMediaUploadHandler.ts +3 -3
- package/src/mcp/tools/product/createProductHandler.ts +6 -2
- package/src/mcp/tools/product/createProductVariationHandler.ts +3 -1
- package/src/mcp/tools/product/createProductVariationOptionHandler.ts +4 -1
- package/src/mcp/tools/product/getProduct.ts +4 -14
- package/src/mcp/tools/product/index.ts +272 -0
- package/src/mcp/tools/product/listProducts.ts +29 -121
- package/src/mcp/tools/product/productReviewsCountHandler.ts +3 -1
- package/src/mcp/tools/product/productReviewsHandler.ts +1 -0
- package/src/mcp/tools/product/productsCountHandler.ts +7 -5
- package/src/mcp/tools/product/publishProduct.ts +4 -1
- package/src/mcp/tools/product/removeProductAssignmentHandler.ts +3 -1
- package/src/mcp/tools/product/removeProductHandler.ts +3 -1
- package/src/mcp/tools/product/removeProductMediaHandler.ts +1 -1
- package/src/mcp/tools/product/removeProductVariationHandler.ts +3 -1
- package/src/mcp/tools/product/removeProductVariationOptionHandler.ts +3 -1
- package/src/mcp/tools/product/reorderProductMediaHandler.ts +1 -1
- package/src/mcp/tools/product/translatedProductMediaTextsHandler.ts +1 -1
- package/src/mcp/tools/product/translatedProductTextsHandler.ts +1 -1
- package/src/mcp/tools/product/translatedProductVariationTextsHandler.ts +4 -6
- package/src/mcp/tools/product/{unPublishProduct.ts → unpublishProductHandler.ts} +3 -2
- package/src/mcp/tools/product/updateProductCommerceHandler.ts +3 -1
- package/src/mcp/tools/product/{updateProduct.ts → updateProductHandler.ts} +3 -1
- package/src/mcp/tools/product/updateProductMediaTextsHandler.ts +3 -1
- package/src/mcp/tools/product/updateProductPlanHandler.ts +8 -6
- package/src/mcp/tools/product/updateProductSupplyHandler.ts +22 -5
- package/src/mcp/tools/product/updateProductTextsHandler.ts +3 -1
- package/src/mcp/tools/product/updateProductTokenizationHandler.ts +12 -8
- package/src/mcp/tools/product/updateProductWarehousingHandler.ts +10 -6
- package/lib/express/chatRouter.d.ts +0 -3
- package/lib/express/chatRouter.d.ts.map +0 -1
- package/lib/express/chatRouter.js +0 -86
- package/lib/express/chatRouter.js.map +0 -1
- package/lib/express/createApolloMiddleware.d.ts +0 -4
- package/lib/express/createApolloMiddleware.d.ts.map +0 -1
- package/lib/express/createApolloMiddleware.js +0 -36
- package/lib/express/createApolloMiddleware.js.map +0 -1
- package/lib/express/createBulkImportMiddleware copy.d.ts +0 -6
- package/lib/express/createBulkImportMiddleware copy.d.ts.map +0 -1
- package/lib/express/createBulkImportMiddleware copy.js +0 -49
- package/lib/express/createBulkImportMiddleware copy.js.map +0 -1
- package/lib/express/createSingleSignOnMiddleware.d.ts +0 -5
- package/lib/express/createSingleSignOnMiddleware.d.ts.map +0 -1
- package/lib/express/createSingleSignOnMiddleware.js +0 -71
- package/lib/express/createSingleSignOnMiddleware.js.map +0 -1
- package/lib/express/setupMCPChatHandler.d.ts +0 -3
- package/lib/express/setupMCPChatHandler.d.ts.map +0 -1
- package/lib/express/setupMCPChatHandler.js +0 -57
- package/lib/express/setupMCPChatHandler.js.map +0 -1
- package/lib/fastify/mcpChatHandler.d.ts +0 -3
- package/lib/fastify/mcpChatHandler.d.ts.map +0 -1
- package/lib/fastify/mcpChatHandler.js +0 -60
- package/lib/fastify/mcpChatHandler.js.map +0 -1
- package/lib/fastify/mcpHandler copy.d.ts +0 -4
- package/lib/fastify/mcpHandler copy.d.ts.map +0 -1
- package/lib/fastify/mcpHandler copy.js +0 -72
- package/lib/fastify/mcpHandler copy.js.map +0 -1
- package/lib/hashPassword.d.ts +0 -2
- package/lib/hashPassword.d.ts.map +0 -1
- package/lib/hashPassword.js +0 -5
- package/lib/hashPassword.js.map +0 -1
- package/lib/mcp/tools/addProductAssignmentHandler.d.ts +0 -52
- package/lib/mcp/tools/addProductAssignmentHandler.d.ts.map +0 -1
- package/lib/mcp/tools/addProductAssignmentHandler.js +0 -97
- package/lib/mcp/tools/addProductAssignmentHandler.js.map +0 -1
- package/lib/mcp/tools/addProductMediaUploadHandler.d.ts +0 -28
- package/lib/mcp/tools/addProductMediaUploadHandler.d.ts.map +0 -1
- package/lib/mcp/tools/addProductMediaUploadHandler.js +0 -62
- package/lib/mcp/tools/addProductMediaUploadHandler.js.map +0 -1
- package/lib/mcp/tools/countriesHandler.d.ts +0 -60
- package/lib/mcp/tools/countriesHandler.d.ts.map +0 -1
- package/lib/mcp/tools/countriesHandler.js +0 -48
- package/lib/mcp/tools/countriesHandler.js.map +0 -1
- package/lib/mcp/tools/countryHandler.d.ts +0 -20
- package/lib/mcp/tools/countryHandler.d.ts.map +0 -1
- package/lib/mcp/tools/countryHandler.js +0 -34
- package/lib/mcp/tools/countryHandler.js.map +0 -1
- package/lib/mcp/tools/createLanguageHandler.d.ts +0 -36
- package/lib/mcp/tools/createLanguageHandler.d.ts.map +0 -1
- package/lib/mcp/tools/createLanguageHandler.js +0 -39
- package/lib/mcp/tools/createLanguageHandler.js.map +0 -1
- package/lib/mcp/tools/createProduct.d.ts +0 -138
- package/lib/mcp/tools/createProduct.d.ts.map +0 -1
- package/lib/mcp/tools/createProduct.js +0 -60
- package/lib/mcp/tools/createProduct.js.map +0 -1
- package/lib/mcp/tools/createProductVariationHandler.d.ts +0 -84
- package/lib/mcp/tools/createProductVariationHandler.d.ts.map +0 -1
- package/lib/mcp/tools/createProductVariationHandler.js +0 -73
- package/lib/mcp/tools/createProductVariationHandler.js.map +0 -1
- package/lib/mcp/tools/createProductVariationOptionHandler.d.ts +0 -60
- package/lib/mcp/tools/createProductVariationOptionHandler.d.ts.map +0 -1
- package/lib/mcp/tools/createProductVariationOptionHandler.js +0 -59
- package/lib/mcp/tools/createProductVariationOptionHandler.js.map +0 -1
- package/lib/mcp/tools/currenciesHandler.d.ts +0 -60
- package/lib/mcp/tools/currenciesHandler.d.ts.map +0 -1
- package/lib/mcp/tools/currenciesHandler.js +0 -50
- package/lib/mcp/tools/currenciesHandler.js.map +0 -1
- package/lib/mcp/tools/currencyHandler.d.ts +0 -20
- package/lib/mcp/tools/currencyHandler.d.ts.map +0 -1
- package/lib/mcp/tools/currencyHandler.js +0 -34
- package/lib/mcp/tools/currencyHandler.js.map +0 -1
- package/lib/mcp/tools/getProduct.d.ts +0 -48
- package/lib/mcp/tools/getProduct.d.ts.map +0 -1
- package/lib/mcp/tools/getProduct.js +0 -61
- package/lib/mcp/tools/getProduct.js.map +0 -1
- package/lib/mcp/tools/languageHandler.d.ts +0 -20
- package/lib/mcp/tools/languageHandler.d.ts.map +0 -1
- package/lib/mcp/tools/languageHandler.js +0 -31
- package/lib/mcp/tools/languageHandler.js.map +0 -1
- package/lib/mcp/tools/languagesHandler.d.ts +0 -60
- package/lib/mcp/tools/languagesHandler.d.ts.map +0 -1
- package/lib/mcp/tools/languagesHandler.js +0 -42
- package/lib/mcp/tools/languagesHandler.js.map +0 -1
- package/lib/mcp/tools/listProducts.d.ts +0 -112
- package/lib/mcp/tools/listProducts.d.ts.map +0 -1
- package/lib/mcp/tools/listProducts.js +0 -110
- package/lib/mcp/tools/listProducts.js.map +0 -1
- package/lib/mcp/tools/normalizeMediaUrl.d.ts +0 -3
- package/lib/mcp/tools/normalizeMediaUrl.d.ts.map +0 -1
- package/lib/mcp/tools/normalizeMediaUrl.js +0 -21
- package/lib/mcp/tools/normalizeMediaUrl.js.map +0 -1
- package/lib/mcp/tools/product/unPublishProduct.d.ts.map +0 -1
- package/lib/mcp/tools/product/unPublishProduct.js.map +0 -1
- package/lib/mcp/tools/product/updateProduct.d.ts.map +0 -1
- package/lib/mcp/tools/product/updateProduct.js.map +0 -1
- package/lib/mcp/tools/productReviewsCountHandler.d.ts +0 -20
- package/lib/mcp/tools/productReviewsCountHandler.d.ts.map +0 -1
- package/lib/mcp/tools/productReviewsCountHandler.js +0 -30
- package/lib/mcp/tools/productReviewsCountHandler.js.map +0 -1
- package/lib/mcp/tools/productReviewsHandler.d.ts +0 -56
- package/lib/mcp/tools/productReviewsHandler.d.ts.map +0 -1
- package/lib/mcp/tools/productReviewsHandler.js +0 -45
- package/lib/mcp/tools/productReviewsHandler.js.map +0 -1
- package/lib/mcp/tools/productsCountHandler.d.ts +0 -32
- package/lib/mcp/tools/productsCountHandler.d.ts.map +0 -1
- package/lib/mcp/tools/productsCountHandler.js +0 -33
- package/lib/mcp/tools/productsCountHandler.js.map +0 -1
- package/lib/mcp/tools/publishProduct.d.ts +0 -20
- package/lib/mcp/tools/publishProduct.d.ts.map +0 -1
- package/lib/mcp/tools/publishProduct.js +0 -40
- package/lib/mcp/tools/publishProduct.js.map +0 -1
- package/lib/mcp/tools/removeLanguageHandler.d.ts +0 -20
- package/lib/mcp/tools/removeLanguageHandler.d.ts.map +0 -1
- package/lib/mcp/tools/removeLanguageHandler.js +0 -35
- package/lib/mcp/tools/removeLanguageHandler.js.map +0 -1
- package/lib/mcp/tools/removeProduct.d.ts +0 -20
- package/lib/mcp/tools/removeProduct.d.ts.map +0 -1
- package/lib/mcp/tools/removeProduct.js +0 -34
- package/lib/mcp/tools/removeProduct.js.map +0 -1
- package/lib/mcp/tools/removeProductAssignmentHandler.d.ts +0 -48
- package/lib/mcp/tools/removeProductAssignmentHandler.d.ts.map +0 -1
- package/lib/mcp/tools/removeProductAssignmentHandler.js +0 -51
- package/lib/mcp/tools/removeProductAssignmentHandler.js.map +0 -1
- package/lib/mcp/tools/removeProductHandler.d.ts +0 -20
- package/lib/mcp/tools/removeProductHandler.d.ts.map +0 -1
- package/lib/mcp/tools/removeProductHandler.js +0 -34
- package/lib/mcp/tools/removeProductHandler.js.map +0 -1
- package/lib/mcp/tools/removeProductMediaHandler.d.ts +0 -20
- package/lib/mcp/tools/removeProductMediaHandler.d.ts.map +0 -1
- package/lib/mcp/tools/removeProductMediaHandler.js +0 -42
- package/lib/mcp/tools/removeProductMediaHandler.js.map +0 -1
- package/lib/mcp/tools/removeProductVariationHandler.d.ts +0 -20
- package/lib/mcp/tools/removeProductVariationHandler.d.ts.map +0 -1
- package/lib/mcp/tools/removeProductVariationHandler.js +0 -43
- package/lib/mcp/tools/removeProductVariationHandler.js.map +0 -1
- package/lib/mcp/tools/removeProductVariationOptionHandler.d.ts +0 -24
- package/lib/mcp/tools/removeProductVariationOptionHandler.d.ts.map +0 -1
- package/lib/mcp/tools/removeProductVariationOptionHandler.js +0 -47
- package/lib/mcp/tools/removeProductVariationOptionHandler.js.map +0 -1
- package/lib/mcp/tools/reorderProductMediaHandler.d.ts +0 -44
- package/lib/mcp/tools/reorderProductMediaHandler.d.ts.map +0 -1
- package/lib/mcp/tools/reorderProductMediaHandler.js +0 -39
- package/lib/mcp/tools/reorderProductMediaHandler.js.map +0 -1
- package/lib/mcp/tools/unPublishProduct.d.ts +0 -20
- package/lib/mcp/tools/unPublishProduct.d.ts.map +0 -1
- package/lib/mcp/tools/unPublishProduct.js +0 -40
- package/lib/mcp/tools/unPublishProduct.js.map +0 -1
- package/lib/mcp/tools/updateLanguageHandler.d.ts +0 -48
- package/lib/mcp/tools/updateLanguageHandler.d.ts.map +0 -1
- package/lib/mcp/tools/updateLanguageHandler.js +0 -40
- package/lib/mcp/tools/updateLanguageHandler.js.map +0 -1
- package/lib/mcp/tools/updateProduct.d.ts +0 -56
- package/lib/mcp/tools/updateProduct.d.ts.map +0 -1
- package/lib/mcp/tools/updateProduct.js +0 -44
- package/lib/mcp/tools/updateProduct.js.map +0 -1
- package/lib/mcp/tools/updateProductCommerceHandler.d.ts +0 -166
- package/lib/mcp/tools/updateProductCommerceHandler.d.ts.map +0 -1
- package/lib/mcp/tools/updateProductCommerceHandler.js +0 -64
- package/lib/mcp/tools/updateProductCommerceHandler.js.map +0 -1
- package/lib/mcp/tools/updateProductMediaTextsHandler.d.ts +0 -56
- package/lib/mcp/tools/updateProductMediaTextsHandler.d.ts.map +0 -1
- package/lib/mcp/tools/updateProductMediaTextsHandler.js +0 -45
- package/lib/mcp/tools/updateProductMediaTextsHandler.js.map +0 -1
- package/lib/mcp/tools/updateProductPlanHandler.d.ts +0 -72
- package/lib/mcp/tools/updateProductPlanHandler.d.ts.map +0 -1
- package/lib/mcp/tools/updateProductPlanHandler.js +0 -51
- package/lib/mcp/tools/updateProductPlanHandler.js.map +0 -1
- package/lib/mcp/tools/updateProductSupplyHandler.d.ts +0 -64
- package/lib/mcp/tools/updateProductSupplyHandler.d.ts.map +0 -1
- package/lib/mcp/tools/updateProductSupplyHandler.js +0 -52
- package/lib/mcp/tools/updateProductSupplyHandler.js.map +0 -1
- package/lib/mcp/tools/updateProductTextsHandler.d.ts +0 -114
- package/lib/mcp/tools/updateProductTextsHandler.d.ts.map +0 -1
- package/lib/mcp/tools/updateProductTextsHandler.js +0 -50
- package/lib/mcp/tools/updateProductTextsHandler.js.map +0 -1
- package/lib/mcp/tools/updateProductTokenizationHandler.d.ts +0 -72
- package/lib/mcp/tools/updateProductTokenizationHandler.d.ts.map +0 -1
- package/lib/mcp/tools/updateProductTokenizationHandler.js +0 -49
- package/lib/mcp/tools/updateProductTokenizationHandler.js.map +0 -1
- package/lib/mcp/tools/updateProductWarehousingHandler.d.ts +0 -48
- package/lib/mcp/tools/updateProductWarehousingHandler.d.ts.map +0 -1
- package/lib/mcp/tools/updateProductWarehousingHandler.js +0 -45
- package/lib/mcp/tools/updateProductWarehousingHandler.js.map +0 -1
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.d.ts +0 -3
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.d.ts.map +0 -1
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.js +0 -6
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.js.map +0 -1
- package/lib/resolvers/mutations/accounts/disableTOTP.d.ts +0 -6
- package/lib/resolvers/mutations/accounts/disableTOTP.d.ts.map +0 -1
- package/lib/resolvers/mutations/accounts/disableTOTP.js +0 -27
- package/lib/resolvers/mutations/accounts/disableTOTP.js.map +0 -1
- package/lib/resolvers/mutations/accounts/enableTOTP.d.ts +0 -6
- package/lib/resolvers/mutations/accounts/enableTOTP.d.ts.map +0 -1
- package/lib/resolvers/mutations/accounts/enableTOTP.js +0 -20
- package/lib/resolvers/mutations/accounts/enableTOTP.js.map +0 -1
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.d.ts +0 -7
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.d.ts.map +0 -1
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.js +0 -30
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.js.map +0 -1
- package/lib/resolvers/mutations/accounts/loginWithOAuth.d.ts +0 -8
- package/lib/resolvers/mutations/accounts/loginWithOAuth.d.ts.map +0 -1
- package/lib/resolvers/mutations/accounts/loginWithOAuth.js +0 -25
- package/lib/resolvers/mutations/accounts/loginWithOAuth.js.map +0 -1
- package/lib/resolvers/mutations/accounts/logoutAllSessions.d.ts +0 -5
- package/lib/resolvers/mutations/accounts/logoutAllSessions.d.ts.map +0 -1
- package/lib/resolvers/mutations/accounts/logoutAllSessions.js +0 -20
- package/lib/resolvers/mutations/accounts/logoutAllSessions.js.map +0 -1
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.d.ts +0 -6
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.d.ts.map +0 -1
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.js +0 -13
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.js.map +0 -1
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.d.ts +0 -6
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.d.ts.map +0 -1
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.js +0 -18
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.js.map +0 -1
- package/lib/resolvers/mutations/products/addProductMedia.d.ts +0 -6
- package/lib/resolvers/mutations/products/addProductMedia.d.ts.map +0 -1
- package/lib/resolvers/mutations/products/addProductMedia.js +0 -18
- package/lib/resolvers/mutations/products/addProductMedia.js.map +0 -1
- package/lib/resolvers/mutations/users/updateUserAvatar.d.ts +0 -6
- package/lib/resolvers/mutations/users/updateUserAvatar.d.ts.map +0 -1
- package/lib/resolvers/mutations/users/updateUserAvatar.js +0 -22
- package/lib/resolvers/mutations/users/updateUserAvatar.js.map +0 -1
- package/lib/resolvers/mutations/utils/getOrderCart.d.ts +0 -7
- package/lib/resolvers/mutations/utils/getOrderCart.d.ts.map +0 -1
- package/lib/resolvers/mutations/utils/getOrderCart.js +0 -13
- package/lib/resolvers/mutations/utils/getOrderCart.js.map +0 -1
- package/lib/resolvers/type/dispatch-types.d.ts +0 -15
- package/lib/resolvers/type/dispatch-types.d.ts.map +0 -1
- package/lib/resolvers/type/dispatch-types.js +0 -16
- package/lib/resolvers/type/dispatch-types.js.map +0 -1
- package/lib/resolvers/type/oauth-account.d.ts +0 -6
- package/lib/resolvers/type/oauth-account.d.ts.map +0 -1
- package/lib/resolvers/type/oauth-account.js +0 -7
- package/lib/resolvers/type/oauth-account.js.map +0 -1
- package/lib/resolvers/type/oauth-provider.d.ts +0 -6
- package/lib/resolvers/type/oauth-provider.d.ts.map +0 -1
- package/lib/resolvers/type/oauth-provider.js +0 -6
- package/lib/resolvers/type/oauth-provider.js.map +0 -1
- package/lib/resolvers/type/stock-types.d.ts +0 -14
- package/lib/resolvers/type/stock-types.d.ts.map +0 -1
- package/lib/resolvers/type/stock-types.js +0 -15
- package/lib/resolvers/type/stock-types.js.map +0 -1
- package/lib/user-context.d.ts +0 -7
- package/lib/user-context.d.ts.map +0 -1
- package/lib/user-context.js +0 -76
- package/lib/user-context.js.map +0 -1
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
ProductWrongTypeError,
|
|
9
9
|
} from '../../../errors.js';
|
|
10
10
|
import { ProductConfiguration, ProductTypes } from '@unchainedshop/core-products';
|
|
11
|
+
import { log } from '@unchainedshop/logger';
|
|
11
12
|
|
|
12
13
|
const extractVariationMatrix = (variations = []) => {
|
|
13
14
|
const cartesianProduct = (arrays) => {
|
|
@@ -36,33 +37,33 @@ const combinationExists = (matrix, combination) => {
|
|
|
36
37
|
});
|
|
37
38
|
};
|
|
38
39
|
|
|
39
|
-
// Zod schema for ProductAssignmentVectorInput
|
|
40
40
|
const ProductAssignmentVectorSchema = z.object({
|
|
41
41
|
key: z.string().min(1).describe('Attribute key (e.g., "Color", "Size")'),
|
|
42
42
|
value: z.string().min(1).describe('Attribute value (e.g., "Red", "M")'),
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
export const AssignProductVariationSchema = {
|
|
46
|
-
proxyId: z.string().min(1).describe('
|
|
46
|
+
proxyId: z.string().min(1).describe('ID of the CONFIGURABLE_PRODUCT (parent) only'),
|
|
47
47
|
productId: z
|
|
48
48
|
.string()
|
|
49
49
|
.min(1)
|
|
50
|
-
.describe('ID of the product being assigned.
|
|
50
|
+
.describe('ID of the product being assigned. Cannot be a CONFIGURABLE_PRODUCT product'),
|
|
51
51
|
vectors: z
|
|
52
52
|
.array(ProductAssignmentVectorSchema)
|
|
53
53
|
.min(1)
|
|
54
54
|
.describe('Combination of attributes uniquely identifying the variant'),
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
export const AddProductAssignmentZodSchema = z.object(AssignProductVariationSchema);
|
|
58
58
|
|
|
59
59
|
export type AddProductAssignmentParams = z.infer<typeof AddProductAssignmentZodSchema>;
|
|
60
60
|
|
|
61
61
|
export async function addProductAssignmentHandler(context: Context, params: AddProductAssignmentParams) {
|
|
62
62
|
const { proxyId, productId, vectors } = params;
|
|
63
|
-
const { modules } = context;
|
|
63
|
+
const { modules, userId } = context;
|
|
64
64
|
|
|
65
65
|
try {
|
|
66
|
+
log('handler addProductAssignmentHandler', { userId, params });
|
|
66
67
|
const proxyProduct = await modules.products.findProduct({
|
|
67
68
|
productId: proxyId,
|
|
68
69
|
});
|
|
@@ -7,9 +7,9 @@ export const AddProductMediaUploadSchema = {
|
|
|
7
7
|
mediaName: z
|
|
8
8
|
.string()
|
|
9
9
|
.min(1)
|
|
10
|
-
.describe('Name of the media file (e.g. "image.png") use random name if not provided'),
|
|
10
|
+
.describe('Name of the media file (e.g. "image.png"); use random name if not provided'),
|
|
11
11
|
productId: z.string().min(1).describe('ID of the product to link media to'),
|
|
12
|
-
url: z.string().describe('Anonymously fetchable URL of the source media
|
|
12
|
+
url: z.string().describe('Anonymously fetchable URL of the source media'),
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export const AddProductMediaUploadZodSchema = z.object(AddProductMediaUploadSchema);
|
|
@@ -24,7 +24,7 @@ export async function addProductMediaUploadHandler(
|
|
|
24
24
|
const { modules, services, userId } = context;
|
|
25
25
|
|
|
26
26
|
try {
|
|
27
|
-
log('
|
|
27
|
+
log('handler addProductAssignmentHandler', { userId, params });
|
|
28
28
|
const {
|
|
29
29
|
_id: fileId,
|
|
30
30
|
putURL,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Context } from '../../../context.js';
|
|
3
3
|
import { Product, ProductText, ProductTypes } from '@unchainedshop/core-products';
|
|
4
|
+
import { log } from '@unchainedshop/logger';
|
|
4
5
|
const productTypeKeys = Object.keys(ProductTypes) as [
|
|
5
6
|
keyof typeof ProductTypes,
|
|
6
7
|
...(keyof typeof ProductTypes)[],
|
|
@@ -39,11 +40,14 @@ export type CreateProductParams = z.infer<typeof CreateProductZodSchema>;
|
|
|
39
40
|
|
|
40
41
|
export async function createProductHandler(context: Context, params: CreateProductParams) {
|
|
41
42
|
const { product, texts } = params;
|
|
43
|
+
const { modules, userId } = context;
|
|
44
|
+
|
|
42
45
|
try {
|
|
43
|
-
|
|
46
|
+
log('handler createProductHandler', { userId, params });
|
|
47
|
+
const newProduct = await modules.products.create(product as Product);
|
|
44
48
|
let productTexts: any[] = texts;
|
|
45
49
|
if (texts) {
|
|
46
|
-
productTexts = await
|
|
50
|
+
productTexts = await modules.products.texts.updateTexts(
|
|
47
51
|
newProduct._id,
|
|
48
52
|
texts as unknown as ProductText[],
|
|
49
53
|
);
|
|
@@ -3,6 +3,7 @@ import { Context } from '../../../context.js';
|
|
|
3
3
|
import { ProductTypes, ProductVariationType } from '@unchainedshop/core-products';
|
|
4
4
|
import { ProductNotFoundError, ProductWrongTypeError } from '../../../errors.js';
|
|
5
5
|
import { getNormalizedProductDetails } from '../../utils/getNormalizedProductDetails.js';
|
|
6
|
+
import { log } from '@unchainedshop/logger';
|
|
6
7
|
|
|
7
8
|
const productVariationTypeKeys = Object.keys(ProductVariationType) as [
|
|
8
9
|
keyof typeof ProductVariationType,
|
|
@@ -47,9 +48,10 @@ export async function createProductVariationHandler(
|
|
|
47
48
|
params: CreateProductVariationParams,
|
|
48
49
|
) {
|
|
49
50
|
const { productId, variation, texts } = params;
|
|
50
|
-
const { modules } = context;
|
|
51
|
+
const { modules, userId } = context;
|
|
51
52
|
|
|
52
53
|
try {
|
|
54
|
+
log('handler createProductVariationHandler', { userId, params });
|
|
53
55
|
const product = await modules.products.findProduct({ productId });
|
|
54
56
|
if (!product) throw new ProductNotFoundError({ productId });
|
|
55
57
|
|
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { Context } from '../../../context.js';
|
|
3
3
|
import { getNormalizedProductDetails } from '../../utils/getNormalizedProductDetails.js';
|
|
4
4
|
import { ProductVariationNotFoundError } from '../../../errors.js';
|
|
5
|
+
import { log } from '@unchainedshop/logger';
|
|
5
6
|
|
|
6
7
|
const ProductVariationTextInputSchema = z.object({
|
|
7
8
|
locale: z
|
|
@@ -30,8 +31,10 @@ export async function createProductVariationOptionHandler(
|
|
|
30
31
|
params: CreateProductVariationOptionParams,
|
|
31
32
|
) {
|
|
32
33
|
const { productVariationId, option, texts } = params;
|
|
33
|
-
const { modules } = context;
|
|
34
|
+
const { modules, userId } = context;
|
|
35
|
+
|
|
34
36
|
try {
|
|
37
|
+
log('handler createProductVariationOptionHandler', { userId, params });
|
|
35
38
|
const variation = await modules.products.variations.findProductVariation({
|
|
36
39
|
productVariationId,
|
|
37
40
|
});
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Context } from '../../../context.js';
|
|
3
3
|
import { getNormalizedProductDetails } from '../../utils/getNormalizedProductDetails.js';
|
|
4
|
+
import { log } from '@unchainedshop/logger';
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
-
* Zod schema for the get_product tool (as raw object for MCP)
|
|
7
|
-
*/
|
|
8
6
|
export const GetProductSchema = {
|
|
9
7
|
productId: z.string().optional().describe('Product ID for lookup'),
|
|
10
8
|
slug: z.string().optional().describe('Product slug for lookup'),
|
|
11
9
|
sku: z.string().optional().describe('Product SKU for lookup'),
|
|
12
10
|
};
|
|
13
11
|
|
|
14
|
-
/**
|
|
15
|
-
* Zod object schema for type inference and validation
|
|
16
|
-
*/
|
|
17
12
|
export const GetProductZodSchema = z
|
|
18
13
|
.object(GetProductSchema)
|
|
19
14
|
.refine(
|
|
@@ -21,20 +16,15 @@ export const GetProductZodSchema = z
|
|
|
21
16
|
'At least one of productId, slug, or sku must be provided',
|
|
22
17
|
);
|
|
23
18
|
|
|
24
|
-
/**
|
|
25
|
-
* Interface for the get_product tool parameters
|
|
26
|
-
*/
|
|
27
19
|
export type GetProductParams = z.infer<typeof GetProductZodSchema>;
|
|
28
20
|
|
|
29
|
-
/**
|
|
30
|
-
* Implementation of the get_product tool
|
|
31
|
-
*/
|
|
32
21
|
export async function getProductHandler(context: Context, params: GetProductParams) {
|
|
33
22
|
const { productId, slug, sku } = params;
|
|
23
|
+
const { modules, userId } = context;
|
|
34
24
|
|
|
35
25
|
try {
|
|
36
|
-
|
|
37
|
-
const product = await
|
|
26
|
+
log('handler getProductHandler', { userId, params });
|
|
27
|
+
const product = await modules.products.findProduct({
|
|
38
28
|
productId,
|
|
39
29
|
slug,
|
|
40
30
|
sku,
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { Context } from '../../../context.js';
|
|
3
|
+
import { productsListHandler, ProductsListSchema } from './listProducts.js';
|
|
4
|
+
import { productsCountHandler, ProductsCountSchema } from './productsCountHandler.js';
|
|
5
|
+
import { getProductHandler, GetProductSchema } from './getProduct.js';
|
|
6
|
+
import { createProductHandler, CreateProductSchema } from './createProductHandler.js';
|
|
7
|
+
import { removeProductHandler, RemoveProductSchema } from './removeProductHandler.js';
|
|
8
|
+
import { publishProductHandler, PublishProductSchema } from './publishProduct.js';
|
|
9
|
+
import { unpublishProductHandler, UnpublishProductSchema } from './unpublishProductHandler.js';
|
|
10
|
+
import { updateProductHandler, UpdateProductSchema } from './updateProductHandler.js';
|
|
11
|
+
import { updateProductTextsHandler, UpdateProductTextsSchema } from './updateProductTextsHandler.js';
|
|
12
|
+
import {
|
|
13
|
+
updateProductCommerceHandler,
|
|
14
|
+
UpdateProductCommerceSchema,
|
|
15
|
+
} from './updateProductCommerceHandler.js';
|
|
16
|
+
import {
|
|
17
|
+
updateProductWarehousingHandler,
|
|
18
|
+
UpdateProductWarehousingSchema,
|
|
19
|
+
} from './updateProductWarehousingHandler.js';
|
|
20
|
+
import { updateProductSupplyHandler, UpdateProductSupplySchema } from './updateProductSupplyHandler.js';
|
|
21
|
+
import {
|
|
22
|
+
updateProductTokenizationHandler,
|
|
23
|
+
UpdateProductTokenizationSchema,
|
|
24
|
+
} from './updateProductTokenizationHandler.js';
|
|
25
|
+
import { updateProductPlanHandler, UpdateProductPlanSchema } from './updateProductPlanHandler.js';
|
|
26
|
+
import {
|
|
27
|
+
removeProductVariationHandler,
|
|
28
|
+
RemoveProductVariationSchema,
|
|
29
|
+
} from './removeProductVariationHandler.js';
|
|
30
|
+
import {
|
|
31
|
+
createProductVariationHandler,
|
|
32
|
+
CreateProductVariationSchema,
|
|
33
|
+
} from './createProductVariationHandler.js';
|
|
34
|
+
import {
|
|
35
|
+
addProductAssignmentHandler,
|
|
36
|
+
AssignProductVariationSchema,
|
|
37
|
+
} from './addProductAssignmentHandler.js';
|
|
38
|
+
import {
|
|
39
|
+
createProductVariationOptionHandler,
|
|
40
|
+
CreateProductVariationOptionSchema,
|
|
41
|
+
} from './createProductVariationOptionHandler.js';
|
|
42
|
+
import {
|
|
43
|
+
removeProductVariationOptionHandler,
|
|
44
|
+
RemoveProductVariationOptionSchema,
|
|
45
|
+
} from './removeProductVariationOptionHandler.js';
|
|
46
|
+
import {
|
|
47
|
+
removeProductAssignmentHandler,
|
|
48
|
+
RemoveProductAssignmentSchema,
|
|
49
|
+
} from './removeProductAssignmentHandler.js';
|
|
50
|
+
import {
|
|
51
|
+
addProductMediaUploadHandler,
|
|
52
|
+
AddProductMediaUploadSchema,
|
|
53
|
+
} from './addProductMediaUploadHandler.js';
|
|
54
|
+
import { removeProductMediaHandler, RemoveProductMediaSchema } from './removeProductMediaHandler.js';
|
|
55
|
+
import {
|
|
56
|
+
updateProductMediaTextsHandler,
|
|
57
|
+
UpdateProductMediaTextsSchema,
|
|
58
|
+
} from './updateProductMediaTextsHandler.js';
|
|
59
|
+
import { reorderProductMediaHandler, ReorderProductMediaSchema } from './reorderProductMediaHandler.js';
|
|
60
|
+
import { productReviewsCountHandler, ProductReviewsCountSchema } from './productReviewsCountHandler.js';
|
|
61
|
+
import { productReviewsHandler, ProductReviewsSchema } from './productReviewsHandler.js';
|
|
62
|
+
import {
|
|
63
|
+
translatedProductTextsHandler,
|
|
64
|
+
TranslatedProductTextsSchema,
|
|
65
|
+
} from './translatedProductTextsHandler.js';
|
|
66
|
+
import {
|
|
67
|
+
translatedProductMediaTextsHandler,
|
|
68
|
+
TranslatedProductMediaTextsSchema,
|
|
69
|
+
} from './translatedProductMediaTextsHandler.js';
|
|
70
|
+
import {
|
|
71
|
+
translatedProductVariationTextsHandler,
|
|
72
|
+
TranslatedProductVariationTextsSchema,
|
|
73
|
+
} from './translatedProductVariationTextsHandler.js';
|
|
74
|
+
|
|
75
|
+
export const registerProductTools = (server: McpServer, context: Context) => {
|
|
76
|
+
server.tool(
|
|
77
|
+
'product_list',
|
|
78
|
+
'List products filtered by tags, slugs, or query string; supports pagination and sorting.',
|
|
79
|
+
ProductsListSchema,
|
|
80
|
+
async (params) => productsListHandler(context, params),
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
server.tool(
|
|
84
|
+
'product_count',
|
|
85
|
+
'Count products filtered by tags, slugs, draft status, or query string.',
|
|
86
|
+
ProductsCountSchema,
|
|
87
|
+
async (params) => productsCountHandler(context, params),
|
|
88
|
+
);
|
|
89
|
+
server.tool(
|
|
90
|
+
'product_get',
|
|
91
|
+
'Retrieve product details by productId, slug, or SKU.',
|
|
92
|
+
GetProductSchema,
|
|
93
|
+
async (params) => getProductHandler(context, params),
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
server.tool(
|
|
97
|
+
'product_create',
|
|
98
|
+
'Create a new product with localized text information. it will be in DRAFT/unpublish status',
|
|
99
|
+
CreateProductSchema,
|
|
100
|
+
async (params) => createProductHandler(context, params),
|
|
101
|
+
);
|
|
102
|
+
server.tool(
|
|
103
|
+
'product_remove',
|
|
104
|
+
'Remove a product by its ID. Changing its status to DELETED and removing it from sale',
|
|
105
|
+
RemoveProductSchema,
|
|
106
|
+
async (params) => removeProductHandler(context, params),
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
server.tool(
|
|
110
|
+
'product_publish',
|
|
111
|
+
'Publish a product by its id changing it to active and available for sale',
|
|
112
|
+
PublishProductSchema,
|
|
113
|
+
async (params) => publishProductHandler(context, params),
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
server.tool(
|
|
117
|
+
'product_unpublish',
|
|
118
|
+
'Deactivates or Unpublishes product by its id changing it to DRAFT and not available for sale',
|
|
119
|
+
UnpublishProductSchema,
|
|
120
|
+
async (params) => unpublishProductHandler(context, params),
|
|
121
|
+
);
|
|
122
|
+
server.tool(
|
|
123
|
+
'product_update',
|
|
124
|
+
'Update specified fields (such as tags, sequence, and metadata) of an existing product identified by its productId.',
|
|
125
|
+
UpdateProductSchema,
|
|
126
|
+
async (params) => updateProductHandler(context, params),
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
server.tool(
|
|
130
|
+
'product_updateTexts',
|
|
131
|
+
'Update localized texts (title, subtitle, description, slug, vendor, brand, labels) of a product',
|
|
132
|
+
UpdateProductTextsSchema,
|
|
133
|
+
async (params) => updateProductTextsHandler(context, params),
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
server.tool(
|
|
137
|
+
'product_updateCommerce',
|
|
138
|
+
'Update commerce information (pricing) for a product (all types except CONFIGURABLE_PRODUCT)',
|
|
139
|
+
UpdateProductCommerceSchema,
|
|
140
|
+
async (params) => updateProductCommerceHandler(context, params),
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
server.tool(
|
|
144
|
+
'product_updateWarehousing',
|
|
145
|
+
'Update warehousing details (SKU, base unit) for a SIMPLE_PRODUCT type product',
|
|
146
|
+
UpdateProductWarehousingSchema,
|
|
147
|
+
async (params) => updateProductWarehousingHandler(context, params),
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
server.tool(
|
|
151
|
+
'product_updateSupply',
|
|
152
|
+
'Update the supply (delivery) details for a SIMPLE_PRODUCT type product',
|
|
153
|
+
UpdateProductSupplySchema,
|
|
154
|
+
async (params) => updateProductSupplyHandler(context, params),
|
|
155
|
+
);
|
|
156
|
+
server.tool(
|
|
157
|
+
'product_updateTokenization',
|
|
158
|
+
'Update tokenization details for a TOKENIZED_PRODUCT type product',
|
|
159
|
+
UpdateProductTokenizationSchema,
|
|
160
|
+
async (params) => updateProductTokenizationHandler(context, params),
|
|
161
|
+
);
|
|
162
|
+
server.tool(
|
|
163
|
+
'product_updatePlan',
|
|
164
|
+
'Update the plan details for a PLAN_PRODUCT type product',
|
|
165
|
+
UpdateProductPlanSchema,
|
|
166
|
+
async (params) => updateProductPlanHandler(context, params),
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
server.tool(
|
|
170
|
+
'product_createVariation',
|
|
171
|
+
'Create a variation for a CONFIGURABLE_PRODUCT product including localized texts.',
|
|
172
|
+
CreateProductVariationSchema,
|
|
173
|
+
async (params) => createProductVariationHandler(context, params),
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
server.tool(
|
|
177
|
+
'productVariation_remove',
|
|
178
|
+
'Remove a product variation by its ID.',
|
|
179
|
+
RemoveProductVariationSchema,
|
|
180
|
+
async (params) => removeProductVariationHandler(context, params),
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
server.tool(
|
|
184
|
+
'product_assignVariation',
|
|
185
|
+
'Assign a product variant to a configurable product with a unique combination of attribute vectors.',
|
|
186
|
+
AssignProductVariationSchema,
|
|
187
|
+
async (params) => addProductAssignmentHandler(context, params),
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
server.tool(
|
|
191
|
+
'product_createVariationOption',
|
|
192
|
+
'Create a new option for a product variation with localized titles and subtitles.',
|
|
193
|
+
CreateProductVariationOptionSchema,
|
|
194
|
+
async (params) => createProductVariationOptionHandler(context, params),
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
server.tool(
|
|
198
|
+
'productVariationOption_remove',
|
|
199
|
+
'Remove an option from a product variation by its value.',
|
|
200
|
+
RemoveProductVariationOptionSchema,
|
|
201
|
+
async (params) => removeProductVariationOptionHandler(context, params),
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
server.tool(
|
|
205
|
+
'product_removeAssignment',
|
|
206
|
+
'Remove a product variant assignment from a configurable product using attribute vectors.',
|
|
207
|
+
RemoveProductAssignmentSchema,
|
|
208
|
+
async (params) => removeProductAssignmentHandler(context, params),
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
server.tool(
|
|
212
|
+
'product_addMedia',
|
|
213
|
+
'Add a media asset to a product from a publicly accessible URL',
|
|
214
|
+
AddProductMediaUploadSchema,
|
|
215
|
+
async (params) => addProductMediaUploadHandler(context, params),
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
server.tool(
|
|
219
|
+
'productMedia_remove',
|
|
220
|
+
'Remove a product media asset by its ID.',
|
|
221
|
+
RemoveProductMediaSchema,
|
|
222
|
+
async (params) => removeProductMediaHandler(context, params),
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
server.tool(
|
|
226
|
+
'productMedia_updateTexts',
|
|
227
|
+
'Update localized texts (title, subtitle) of a product media asset.',
|
|
228
|
+
UpdateProductMediaTextsSchema,
|
|
229
|
+
async (params) => updateProductMediaTextsHandler(context, params),
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
server.tool(
|
|
233
|
+
'product_media_reorder',
|
|
234
|
+
'Reorder media assets of a product by providing new sort keys.',
|
|
235
|
+
ReorderProductMediaSchema,
|
|
236
|
+
async (params) => reorderProductMediaHandler(context, params),
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
server.tool(
|
|
240
|
+
'productReviews_count',
|
|
241
|
+
'Count product reviews optionally filtered by query string.',
|
|
242
|
+
ProductReviewsCountSchema,
|
|
243
|
+
async (params) => productReviewsCountHandler(context, params),
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
server.tool(
|
|
247
|
+
'productReviews_list',
|
|
248
|
+
'Retrieve a paginated list of product reviews with optional filtering and sorting.',
|
|
249
|
+
ProductReviewsSchema,
|
|
250
|
+
async (params) => productReviewsHandler(context, params),
|
|
251
|
+
);
|
|
252
|
+
server.tool(
|
|
253
|
+
'product_getTexts',
|
|
254
|
+
'Retrieve translated texts associated with a specific product_',
|
|
255
|
+
TranslatedProductTextsSchema,
|
|
256
|
+
async (params) => translatedProductTextsHandler(context, params),
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
server.tool(
|
|
260
|
+
'productMedia_getTexts',
|
|
261
|
+
'Retrieve translated texts associated with a specific product media asset.',
|
|
262
|
+
TranslatedProductMediaTextsSchema,
|
|
263
|
+
async (params) => translatedProductMediaTextsHandler(context, params),
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
server.tool(
|
|
267
|
+
'productVariation_getTexts',
|
|
268
|
+
'Retrieve translated texts for a product variation or optionally a specific variation option.',
|
|
269
|
+
TranslatedProductVariationTextsSchema,
|
|
270
|
+
async (params) => translatedProductVariationTextsHandler(context, params),
|
|
271
|
+
);
|
|
272
|
+
};
|
|
@@ -1,131 +1,36 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { SortDirection } from '@unchainedshop/utils';
|
|
3
2
|
import { Context } from '../../../context.js';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}),
|
|
21
|
-
)
|
|
22
|
-
.optional()
|
|
23
|
-
.describe('Key-value filter pairs'),
|
|
24
|
-
assortmentId: z.string().optional().describe('Filter by assortment'),
|
|
25
|
-
includeInactive: z.boolean().default(false).describe('Include inactive products'),
|
|
26
|
-
|
|
27
|
-
// Pagination
|
|
28
|
-
limit: z.number().min(1).max(100).default(20).describe('Results per page'),
|
|
29
|
-
offset: z.number().min(0).default(0).describe('Skip results for pagination'),
|
|
30
|
-
|
|
31
|
-
// Sorting
|
|
32
|
-
sort: z
|
|
33
|
-
.array(
|
|
34
|
-
z.object({
|
|
35
|
-
key: z.string().describe('Sort field'),
|
|
36
|
-
value: z.enum(['ASC', 'DESC']).describe('Sort direction'),
|
|
37
|
-
}),
|
|
38
|
-
)
|
|
39
|
-
.optional()
|
|
40
|
-
.describe('Sort options'),
|
|
3
|
+
import { log } from '@unchainedshop/logger';
|
|
4
|
+
import { getNormalizedProductDetails } from '../../utils/getNormalizedProductDetails.js';
|
|
5
|
+
|
|
6
|
+
const SortOptionInputSchema = z.object({
|
|
7
|
+
key: z.string().min(1).describe('Field to sort by'),
|
|
8
|
+
value: z.enum(['ASC', 'DESC']).describe('Sort direction'),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const ProductsListSchema = {
|
|
12
|
+
queryString: z.string().optional().describe('Free-text filter for products'),
|
|
13
|
+
tags: z.array(z.string().min(1).toLowerCase()).optional().describe('Filter by lowercase tags'),
|
|
14
|
+
slugs: z.array(z.string().min(1)).optional().describe('Filter by product slugs'),
|
|
15
|
+
limit: z.number().int().min(1).max(100).default(10).describe('Maximum number of products to return'),
|
|
16
|
+
offset: z.number().int().min(0).default(0).describe('Number of products to skip'),
|
|
17
|
+
includeDrafts: z.boolean().default(false).describe('Whether to include draft (unpublished) products'),
|
|
18
|
+
sort: z.array(SortOptionInputSchema).optional().describe('Sorting options'),
|
|
41
19
|
};
|
|
42
20
|
|
|
43
|
-
|
|
44
|
-
* Zod object schema for type inference
|
|
45
|
-
*/
|
|
46
|
-
export const ListProductsZodSchema = z.object(ListProductsSchema);
|
|
21
|
+
export const ProductsListZodSchema = z.object(ProductsListSchema);
|
|
47
22
|
|
|
48
|
-
|
|
49
|
-
* Interface for the list_products tool parameters
|
|
50
|
-
*/
|
|
51
|
-
export type ListProductsParams = z.infer<typeof ListProductsZodSchema>;
|
|
23
|
+
export type ProductsListParams = z.infer<typeof ProductsListZodSchema>;
|
|
52
24
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*/
|
|
56
|
-
export async function listProductsHandler(context: Context, params: ListProductsParams) {
|
|
57
|
-
const {
|
|
58
|
-
queryString,
|
|
59
|
-
tags,
|
|
60
|
-
productIds,
|
|
61
|
-
filterQuery,
|
|
62
|
-
assortmentId,
|
|
63
|
-
includeInactive = false,
|
|
64
|
-
limit = 20,
|
|
65
|
-
offset = 0,
|
|
66
|
-
sort,
|
|
67
|
-
} = params;
|
|
25
|
+
export async function productsListHandler(context: Context, params: ProductsListParams) {
|
|
26
|
+
const { modules, userId } = context;
|
|
68
27
|
|
|
69
28
|
try {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// If assortmentId is provided, get product IDs from assortment
|
|
73
|
-
if (assortmentId) {
|
|
74
|
-
const assortmentProductIds = await context.modules.assortments.products.findProductIds({
|
|
75
|
-
assortmentId,
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
if (filteredProductIds) {
|
|
79
|
-
// Intersection of both sets
|
|
80
|
-
filteredProductIds = filteredProductIds.filter((id) => assortmentProductIds.includes(id));
|
|
81
|
-
} else {
|
|
82
|
-
filteredProductIds = assortmentProductIds;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
29
|
+
log('handler productsListHandler', { userId, params });
|
|
85
30
|
|
|
86
|
-
|
|
87
|
-
if (queryString)
|
|
88
|
-
searchResult = await context.services.filters.searchProducts(
|
|
89
|
-
{
|
|
90
|
-
queryString,
|
|
91
|
-
productIds: filteredProductIds,
|
|
92
|
-
includeInactive,
|
|
93
|
-
filterQuery: filterQuery?.filter((f) => f.key) as { key: string; value?: string }[],
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
locale: context.locale,
|
|
97
|
-
},
|
|
98
|
-
);
|
|
99
|
-
const products = await context.modules.products.findProducts({
|
|
100
|
-
productIds: searchResult?.aggregatedFilteredProductIds,
|
|
101
|
-
tags,
|
|
102
|
-
limit,
|
|
103
|
-
offset,
|
|
104
|
-
includeDrafts: includeInactive,
|
|
105
|
-
sort: sort?.filter((s) => s.key) as { key: string; value: SortDirection }[],
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
const productTexts = await context.loaders.productTextLoader.loadMany(
|
|
109
|
-
products.map(({ _id }) => ({
|
|
110
|
-
productId: _id,
|
|
111
|
-
locale: context.locale,
|
|
112
|
-
})),
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
// iterate all products and add texts
|
|
31
|
+
const products = await modules.products.findProducts(params as any);
|
|
116
32
|
const normalizedProducts = await Promise.all(
|
|
117
|
-
products.map(async (
|
|
118
|
-
const texts = productTexts.filter((text) => (text as ProductText)?.productId === product._id);
|
|
119
|
-
const productMedias = await context.modules.products.media.findProductMedias({
|
|
120
|
-
productId: product._id,
|
|
121
|
-
});
|
|
122
|
-
const media = await normalizeMediaUrl(productMedias, context);
|
|
123
|
-
return {
|
|
124
|
-
...product,
|
|
125
|
-
texts,
|
|
126
|
-
media,
|
|
127
|
-
};
|
|
128
|
-
}),
|
|
33
|
+
products.map(async ({ _id }) => getNormalizedProductDetails(_id, context)),
|
|
129
34
|
);
|
|
130
35
|
|
|
131
36
|
return {
|
|
@@ -134,15 +39,18 @@ export async function listProductsHandler(context: Context, params: ListProducts
|
|
|
134
39
|
type: 'text' as const,
|
|
135
40
|
text: JSON.stringify({
|
|
136
41
|
products: normalizedProducts,
|
|
137
|
-
total: searchResult?.aggregatedTotalProductIds?.length,
|
|
138
|
-
filtered: searchResult?.aggregatedFilteredProductIds?.length || products?.length,
|
|
139
42
|
}),
|
|
140
43
|
},
|
|
141
44
|
],
|
|
142
45
|
};
|
|
143
46
|
} catch (error) {
|
|
144
47
|
return {
|
|
145
|
-
content: [
|
|
48
|
+
content: [
|
|
49
|
+
{
|
|
50
|
+
type: 'text' as const,
|
|
51
|
+
text: `Error fetching products: ${(error as Error).message}`,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
146
54
|
};
|
|
147
55
|
}
|
|
148
56
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Context } from '../../../context.js';
|
|
3
|
+
import { log } from '@unchainedshop/logger';
|
|
3
4
|
|
|
4
5
|
export const ProductReviewsCountSchema = {
|
|
5
6
|
queryString: z.string().optional().describe('Optional query string to filter reviews'),
|
|
@@ -10,9 +11,10 @@ export const ProductReviewsCountZodSchema = z.object(ProductReviewsCountSchema);
|
|
|
10
11
|
export type ProductReviewsCountParams = z.infer<typeof ProductReviewsCountZodSchema>;
|
|
11
12
|
|
|
12
13
|
export async function productReviewsCountHandler(context: Context, params: ProductReviewsCountParams) {
|
|
13
|
-
const { modules } = context;
|
|
14
|
+
const { modules, userId } = context;
|
|
14
15
|
|
|
15
16
|
try {
|
|
17
|
+
log('handler productReviewsCountHandler', { userId, params });
|
|
16
18
|
const count = await modules.products.reviews.count(params);
|
|
17
19
|
|
|
18
20
|
return {
|
|
@@ -30,6 +30,7 @@ export async function productReviewsHandler(context: Context, params: ProductRev
|
|
|
30
30
|
try {
|
|
31
31
|
log(`query productReviews: ${limit} ${offset} ${queryString || ''}`, {
|
|
32
32
|
userId,
|
|
33
|
+
params,
|
|
33
34
|
});
|
|
34
35
|
|
|
35
36
|
const reviews = await modules.products.reviews.findProductReviews(params as any);
|