@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.
Files changed (417) hide show
  1. package/lib/api-index.d.ts.map +1 -1
  2. package/lib/api-index.js +4 -1
  3. package/lib/api-index.js.map +1 -1
  4. package/lib/errors.d.ts +1 -1
  5. package/lib/errors.d.ts.map +1 -1
  6. package/lib/errors.js +1 -1
  7. package/lib/errors.js.map +1 -1
  8. package/lib/express/chatRouter.d.ts +3 -0
  9. package/lib/express/chatRouter.d.ts.map +1 -0
  10. package/lib/express/chatRouter.js +86 -0
  11. package/lib/express/chatRouter.js.map +1 -0
  12. package/lib/express/createApolloMiddleware.d.ts +4 -0
  13. package/lib/express/createApolloMiddleware.d.ts.map +1 -0
  14. package/lib/express/createApolloMiddleware.js +36 -0
  15. package/lib/express/createApolloMiddleware.js.map +1 -0
  16. package/lib/express/createBulkImportMiddleware copy.d.ts +6 -0
  17. package/lib/express/createBulkImportMiddleware copy.d.ts.map +1 -0
  18. package/lib/express/createBulkImportMiddleware copy.js +49 -0
  19. package/lib/express/createBulkImportMiddleware copy.js.map +1 -0
  20. package/lib/express/createMCPMiddleware.d.ts +2 -6
  21. package/lib/express/createMCPMiddleware.d.ts.map +1 -1
  22. package/lib/express/createMCPMiddleware.js +73 -42
  23. package/lib/express/createMCPMiddleware.js.map +1 -1
  24. package/lib/express/createSingleSignOnMiddleware.d.ts +5 -0
  25. package/lib/express/createSingleSignOnMiddleware.d.ts.map +1 -0
  26. package/lib/express/createSingleSignOnMiddleware.js +71 -0
  27. package/lib/express/createSingleSignOnMiddleware.js.map +1 -0
  28. package/lib/express/createTempUploadMiddleware.d.ts +7 -0
  29. package/lib/express/createTempUploadMiddleware.d.ts.map +1 -0
  30. package/lib/express/createTempUploadMiddleware.js +48 -0
  31. package/lib/express/createTempUploadMiddleware.js.map +1 -0
  32. package/lib/express/index.d.ts.map +1 -1
  33. package/lib/express/index.js +17 -4
  34. package/lib/express/index.js.map +1 -1
  35. package/lib/express/setupMCPChatHandler.d.ts +3 -0
  36. package/lib/express/setupMCPChatHandler.d.ts.map +1 -0
  37. package/lib/express/setupMCPChatHandler.js +57 -0
  38. package/lib/express/setupMCPChatHandler.js.map +1 -0
  39. package/lib/fastify/index.d.ts.map +1 -1
  40. package/lib/fastify/index.js +24 -2
  41. package/lib/fastify/index.js.map +1 -1
  42. package/lib/fastify/mcpChatHandler.d.ts +3 -0
  43. package/lib/fastify/mcpChatHandler.d.ts.map +1 -0
  44. package/lib/fastify/mcpChatHandler.js +60 -0
  45. package/lib/fastify/mcpChatHandler.js.map +1 -0
  46. package/lib/fastify/mcpHandler copy.d.ts +4 -0
  47. package/lib/fastify/mcpHandler copy.d.ts.map +1 -0
  48. package/lib/fastify/mcpHandler copy.js +72 -0
  49. package/lib/fastify/mcpHandler copy.js.map +1 -0
  50. package/lib/fastify/mcpHandler.d.ts +3 -7
  51. package/lib/fastify/mcpHandler.d.ts.map +1 -1
  52. package/lib/fastify/mcpHandler.js +71 -39
  53. package/lib/fastify/mcpHandler.js.map +1 -1
  54. package/lib/fastify/tempUploadHandler.d.ts +4 -0
  55. package/lib/fastify/tempUploadHandler.d.ts.map +1 -0
  56. package/lib/fastify/tempUploadHandler.js +41 -0
  57. package/lib/fastify/tempUploadHandler.js.map +1 -0
  58. package/lib/hashPassword.d.ts +2 -0
  59. package/lib/hashPassword.d.ts.map +1 -0
  60. package/lib/hashPassword.js +5 -0
  61. package/lib/hashPassword.js.map +1 -0
  62. package/lib/loaders/assortmentMediaTextLoader.js +1 -1
  63. package/lib/loaders/assortmentMediaTextLoader.js.map +1 -1
  64. package/lib/loaders/assortmentTextLoader.js +1 -1
  65. package/lib/loaders/assortmentTextLoader.js.map +1 -1
  66. package/lib/loaders/buildLocaleMap.d.ts +6 -0
  67. package/lib/loaders/buildLocaleMap.d.ts.map +1 -0
  68. package/lib/loaders/buildLocaleMap.js +67 -0
  69. package/lib/loaders/buildLocaleMap.js.map +1 -0
  70. package/lib/loaders/buildTextMap.d.ts +1 -1
  71. package/lib/loaders/buildTextMap.d.ts.map +1 -1
  72. package/lib/loaders/buildTextMap.js +19 -6
  73. package/lib/loaders/buildTextMap.js.map +1 -1
  74. package/lib/loaders/filterTextLoader.js +1 -1
  75. package/lib/loaders/filterTextLoader.js.map +1 -1
  76. package/lib/loaders/productMediaTextLoader.d.ts.map +1 -1
  77. package/lib/loaders/productMediaTextLoader.js +1 -1
  78. package/lib/loaders/productMediaTextLoader.js.map +1 -1
  79. package/lib/loaders/productTextLoader.d.ts.map +1 -1
  80. package/lib/loaders/productTextLoader.js +1 -1
  81. package/lib/loaders/productTextLoader.js.map +1 -1
  82. package/lib/mcp/index.d.ts +3 -94
  83. package/lib/mcp/index.d.ts.map +1 -1
  84. package/lib/mcp/index.js +45 -135
  85. package/lib/mcp/index.js.map +1 -1
  86. package/lib/mcp/tools/addProductAssignmentHandler.d.ts +52 -0
  87. package/lib/mcp/tools/addProductAssignmentHandler.d.ts.map +1 -0
  88. package/lib/mcp/tools/addProductAssignmentHandler.js +97 -0
  89. package/lib/mcp/tools/addProductAssignmentHandler.js.map +1 -0
  90. package/lib/mcp/tools/addProductMediaUploadHandler.d.ts +28 -0
  91. package/lib/mcp/tools/addProductMediaUploadHandler.d.ts.map +1 -0
  92. package/lib/mcp/tools/addProductMediaUploadHandler.js +62 -0
  93. package/lib/mcp/tools/addProductMediaUploadHandler.js.map +1 -0
  94. package/lib/mcp/tools/countriesHandler.d.ts +60 -0
  95. package/lib/mcp/tools/countriesHandler.d.ts.map +1 -0
  96. package/lib/mcp/tools/countriesHandler.js +48 -0
  97. package/lib/mcp/tools/countriesHandler.js.map +1 -0
  98. package/lib/mcp/tools/countryHandler.d.ts +20 -0
  99. package/lib/mcp/tools/countryHandler.d.ts.map +1 -0
  100. package/lib/mcp/tools/countryHandler.js +34 -0
  101. package/lib/mcp/tools/countryHandler.js.map +1 -0
  102. package/lib/mcp/tools/createLanguageHandler.d.ts +36 -0
  103. package/lib/mcp/tools/createLanguageHandler.d.ts.map +1 -0
  104. package/lib/mcp/tools/createLanguageHandler.js +39 -0
  105. package/lib/mcp/tools/createLanguageHandler.js.map +1 -0
  106. package/lib/mcp/tools/createProduct.d.ts +138 -0
  107. package/lib/mcp/tools/createProduct.d.ts.map +1 -0
  108. package/lib/mcp/tools/createProduct.js +60 -0
  109. package/lib/mcp/tools/createProduct.js.map +1 -0
  110. package/lib/mcp/tools/createProductVariationHandler.d.ts +84 -0
  111. package/lib/mcp/tools/createProductVariationHandler.d.ts.map +1 -0
  112. package/lib/mcp/tools/createProductVariationHandler.js +73 -0
  113. package/lib/mcp/tools/createProductVariationHandler.js.map +1 -0
  114. package/lib/mcp/tools/createProductVariationOptionHandler.d.ts +60 -0
  115. package/lib/mcp/tools/createProductVariationOptionHandler.d.ts.map +1 -0
  116. package/lib/mcp/tools/createProductVariationOptionHandler.js +59 -0
  117. package/lib/mcp/tools/createProductVariationOptionHandler.js.map +1 -0
  118. package/lib/mcp/tools/currenciesHandler.d.ts +60 -0
  119. package/lib/mcp/tools/currenciesHandler.d.ts.map +1 -0
  120. package/lib/mcp/tools/currenciesHandler.js +50 -0
  121. package/lib/mcp/tools/currenciesHandler.js.map +1 -0
  122. package/lib/mcp/tools/currencyHandler.d.ts +20 -0
  123. package/lib/mcp/tools/currencyHandler.d.ts.map +1 -0
  124. package/lib/mcp/tools/currencyHandler.js +34 -0
  125. package/lib/mcp/tools/currencyHandler.js.map +1 -0
  126. package/lib/mcp/tools/getProduct.d.ts +48 -0
  127. package/lib/mcp/tools/getProduct.d.ts.map +1 -0
  128. package/lib/mcp/tools/getProduct.js +61 -0
  129. package/lib/mcp/tools/getProduct.js.map +1 -0
  130. package/lib/mcp/tools/index.d.ts +39 -0
  131. package/lib/mcp/tools/index.d.ts.map +1 -0
  132. package/lib/mcp/tools/index.js +39 -0
  133. package/lib/mcp/tools/index.js.map +1 -0
  134. package/lib/mcp/tools/languageHandler.d.ts +20 -0
  135. package/lib/mcp/tools/languageHandler.d.ts.map +1 -0
  136. package/lib/mcp/tools/languageHandler.js +31 -0
  137. package/lib/mcp/tools/languageHandler.js.map +1 -0
  138. package/lib/mcp/tools/languagesHandler.d.ts +60 -0
  139. package/lib/mcp/tools/languagesHandler.d.ts.map +1 -0
  140. package/lib/mcp/tools/languagesHandler.js +42 -0
  141. package/lib/mcp/tools/languagesHandler.js.map +1 -0
  142. package/lib/mcp/tools/listProducts.d.ts +112 -0
  143. package/lib/mcp/tools/listProducts.d.ts.map +1 -0
  144. package/lib/mcp/tools/listProducts.js +110 -0
  145. package/lib/mcp/tools/listProducts.js.map +1 -0
  146. package/lib/mcp/tools/normalizeMediaUrl.d.ts +3 -0
  147. package/lib/mcp/tools/normalizeMediaUrl.d.ts.map +1 -0
  148. package/lib/mcp/tools/normalizeMediaUrl.js +21 -0
  149. package/lib/mcp/tools/normalizeMediaUrl.js.map +1 -0
  150. package/lib/mcp/tools/productReviewsCountHandler.d.ts +20 -0
  151. package/lib/mcp/tools/productReviewsCountHandler.d.ts.map +1 -0
  152. package/lib/mcp/tools/productReviewsCountHandler.js +30 -0
  153. package/lib/mcp/tools/productReviewsCountHandler.js.map +1 -0
  154. package/lib/mcp/tools/productReviewsHandler.d.ts +56 -0
  155. package/lib/mcp/tools/productReviewsHandler.d.ts.map +1 -0
  156. package/lib/mcp/tools/productReviewsHandler.js +45 -0
  157. package/lib/mcp/tools/productReviewsHandler.js.map +1 -0
  158. package/lib/mcp/tools/productsCountHandler.d.ts +32 -0
  159. package/lib/mcp/tools/productsCountHandler.d.ts.map +1 -0
  160. package/lib/mcp/tools/productsCountHandler.js +33 -0
  161. package/lib/mcp/tools/productsCountHandler.js.map +1 -0
  162. package/lib/mcp/tools/publishProduct.d.ts +20 -0
  163. package/lib/mcp/tools/publishProduct.d.ts.map +1 -0
  164. package/lib/mcp/tools/publishProduct.js +40 -0
  165. package/lib/mcp/tools/publishProduct.js.map +1 -0
  166. package/lib/mcp/tools/removeLanguageHandler.d.ts +20 -0
  167. package/lib/mcp/tools/removeLanguageHandler.d.ts.map +1 -0
  168. package/lib/mcp/tools/removeLanguageHandler.js +35 -0
  169. package/lib/mcp/tools/removeLanguageHandler.js.map +1 -0
  170. package/lib/mcp/tools/removeProduct.d.ts +20 -0
  171. package/lib/mcp/tools/removeProduct.d.ts.map +1 -0
  172. package/lib/mcp/tools/removeProduct.js +34 -0
  173. package/lib/mcp/tools/removeProduct.js.map +1 -0
  174. package/lib/mcp/tools/removeProductAssignmentHandler.d.ts +48 -0
  175. package/lib/mcp/tools/removeProductAssignmentHandler.d.ts.map +1 -0
  176. package/lib/mcp/tools/removeProductAssignmentHandler.js +51 -0
  177. package/lib/mcp/tools/removeProductAssignmentHandler.js.map +1 -0
  178. package/lib/mcp/tools/removeProductHandler.d.ts +20 -0
  179. package/lib/mcp/tools/removeProductHandler.d.ts.map +1 -0
  180. package/lib/mcp/tools/removeProductHandler.js +34 -0
  181. package/lib/mcp/tools/removeProductHandler.js.map +1 -0
  182. package/lib/mcp/tools/removeProductMediaHandler.d.ts +20 -0
  183. package/lib/mcp/tools/removeProductMediaHandler.d.ts.map +1 -0
  184. package/lib/mcp/tools/removeProductMediaHandler.js +42 -0
  185. package/lib/mcp/tools/removeProductMediaHandler.js.map +1 -0
  186. package/lib/mcp/tools/removeProductVariationHandler.d.ts +20 -0
  187. package/lib/mcp/tools/removeProductVariationHandler.d.ts.map +1 -0
  188. package/lib/mcp/tools/removeProductVariationHandler.js +43 -0
  189. package/lib/mcp/tools/removeProductVariationHandler.js.map +1 -0
  190. package/lib/mcp/tools/removeProductVariationOptionHandler.d.ts +24 -0
  191. package/lib/mcp/tools/removeProductVariationOptionHandler.d.ts.map +1 -0
  192. package/lib/mcp/tools/removeProductVariationOptionHandler.js +47 -0
  193. package/lib/mcp/tools/removeProductVariationOptionHandler.js.map +1 -0
  194. package/lib/mcp/tools/reorderProductMediaHandler.d.ts +44 -0
  195. package/lib/mcp/tools/reorderProductMediaHandler.d.ts.map +1 -0
  196. package/lib/mcp/tools/reorderProductMediaHandler.js +39 -0
  197. package/lib/mcp/tools/reorderProductMediaHandler.js.map +1 -0
  198. package/lib/mcp/tools/unPublishProduct.d.ts +20 -0
  199. package/lib/mcp/tools/unPublishProduct.d.ts.map +1 -0
  200. package/lib/mcp/tools/unPublishProduct.js +40 -0
  201. package/lib/mcp/tools/unPublishProduct.js.map +1 -0
  202. package/lib/mcp/tools/updateLanguageHandler.d.ts +48 -0
  203. package/lib/mcp/tools/updateLanguageHandler.d.ts.map +1 -0
  204. package/lib/mcp/tools/updateLanguageHandler.js +40 -0
  205. package/lib/mcp/tools/updateLanguageHandler.js.map +1 -0
  206. package/lib/mcp/tools/updateProduct.d.ts +56 -0
  207. package/lib/mcp/tools/updateProduct.d.ts.map +1 -0
  208. package/lib/mcp/tools/updateProduct.js +44 -0
  209. package/lib/mcp/tools/updateProduct.js.map +1 -0
  210. package/lib/mcp/tools/updateProductCommerceHandler.d.ts +166 -0
  211. package/lib/mcp/tools/updateProductCommerceHandler.d.ts.map +1 -0
  212. package/lib/mcp/tools/updateProductCommerceHandler.js +64 -0
  213. package/lib/mcp/tools/updateProductCommerceHandler.js.map +1 -0
  214. package/lib/mcp/tools/updateProductMediaTextsHandler.d.ts +56 -0
  215. package/lib/mcp/tools/updateProductMediaTextsHandler.d.ts.map +1 -0
  216. package/lib/mcp/tools/updateProductMediaTextsHandler.js +45 -0
  217. package/lib/mcp/tools/updateProductMediaTextsHandler.js.map +1 -0
  218. package/lib/mcp/tools/updateProductPlanHandler.d.ts +72 -0
  219. package/lib/mcp/tools/updateProductPlanHandler.d.ts.map +1 -0
  220. package/lib/mcp/tools/updateProductPlanHandler.js +51 -0
  221. package/lib/mcp/tools/updateProductPlanHandler.js.map +1 -0
  222. package/lib/mcp/tools/updateProductSupplyHandler.d.ts +64 -0
  223. package/lib/mcp/tools/updateProductSupplyHandler.d.ts.map +1 -0
  224. package/lib/mcp/tools/updateProductSupplyHandler.js +52 -0
  225. package/lib/mcp/tools/updateProductSupplyHandler.js.map +1 -0
  226. package/lib/mcp/tools/updateProductTextsHandler.d.ts +114 -0
  227. package/lib/mcp/tools/updateProductTextsHandler.d.ts.map +1 -0
  228. package/lib/mcp/tools/updateProductTextsHandler.js +50 -0
  229. package/lib/mcp/tools/updateProductTextsHandler.js.map +1 -0
  230. package/lib/mcp/tools/updateProductTokenizationHandler.d.ts +72 -0
  231. package/lib/mcp/tools/updateProductTokenizationHandler.d.ts.map +1 -0
  232. package/lib/mcp/tools/updateProductTokenizationHandler.js +49 -0
  233. package/lib/mcp/tools/updateProductTokenizationHandler.js.map +1 -0
  234. package/lib/mcp/tools/updateProductWarehousingHandler.d.ts +48 -0
  235. package/lib/mcp/tools/updateProductWarehousingHandler.d.ts.map +1 -0
  236. package/lib/mcp/tools/updateProductWarehousingHandler.js +45 -0
  237. package/lib/mcp/tools/updateProductWarehousingHandler.js.map +1 -0
  238. package/lib/mcp/utils/getNormalizedProductDetails.d.ts +26 -0
  239. package/lib/mcp/utils/getNormalizedProductDetails.d.ts.map +1 -0
  240. package/lib/mcp/utils/getNormalizedProductDetails.js +38 -0
  241. package/lib/mcp/utils/getNormalizedProductDetails.js.map +1 -0
  242. package/lib/mcp/utils/normalizeMediaUrl.d.ts +3 -0
  243. package/lib/mcp/utils/normalizeMediaUrl.d.ts.map +1 -0
  244. package/lib/mcp/utils/normalizeMediaUrl.js +21 -0
  245. package/lib/mcp/utils/normalizeMediaUrl.js.map +1 -0
  246. package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.d.ts +3 -0
  247. package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.d.ts.map +1 -0
  248. package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.js +6 -0
  249. package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.js.map +1 -0
  250. package/lib/resolvers/mutations/accounts/disableTOTP.d.ts +6 -0
  251. package/lib/resolvers/mutations/accounts/disableTOTP.d.ts.map +1 -0
  252. package/lib/resolvers/mutations/accounts/disableTOTP.js +27 -0
  253. package/lib/resolvers/mutations/accounts/disableTOTP.js.map +1 -0
  254. package/lib/resolvers/mutations/accounts/enableTOTP.d.ts +6 -0
  255. package/lib/resolvers/mutations/accounts/enableTOTP.d.ts.map +1 -0
  256. package/lib/resolvers/mutations/accounts/enableTOTP.js +20 -0
  257. package/lib/resolvers/mutations/accounts/enableTOTP.js.map +1 -0
  258. package/lib/resolvers/mutations/accounts/linkOAuthAccount.d.ts +7 -0
  259. package/lib/resolvers/mutations/accounts/linkOAuthAccount.d.ts.map +1 -0
  260. package/lib/resolvers/mutations/accounts/linkOAuthAccount.js +30 -0
  261. package/lib/resolvers/mutations/accounts/linkOAuthAccount.js.map +1 -0
  262. package/lib/resolvers/mutations/accounts/loginWithOAuth.d.ts +8 -0
  263. package/lib/resolvers/mutations/accounts/loginWithOAuth.d.ts.map +1 -0
  264. package/lib/resolvers/mutations/accounts/loginWithOAuth.js +25 -0
  265. package/lib/resolvers/mutations/accounts/loginWithOAuth.js.map +1 -0
  266. package/lib/resolvers/mutations/accounts/logoutAllSessions.d.ts +5 -0
  267. package/lib/resolvers/mutations/accounts/logoutAllSessions.d.ts.map +1 -0
  268. package/lib/resolvers/mutations/accounts/logoutAllSessions.js +20 -0
  269. package/lib/resolvers/mutations/accounts/logoutAllSessions.js.map +1 -0
  270. package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.d.ts +6 -0
  271. package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.d.ts.map +1 -0
  272. package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.js +13 -0
  273. package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.js.map +1 -0
  274. package/lib/resolvers/mutations/assortments/addAssortmentMedia.d.ts +6 -0
  275. package/lib/resolvers/mutations/assortments/addAssortmentMedia.d.ts.map +1 -0
  276. package/lib/resolvers/mutations/assortments/addAssortmentMedia.js +18 -0
  277. package/lib/resolvers/mutations/assortments/addAssortmentMedia.js.map +1 -0
  278. package/lib/resolvers/mutations/products/addProductAssignment.d.ts.map +1 -1
  279. package/lib/resolvers/mutations/products/addProductAssignment.js +3 -1
  280. package/lib/resolvers/mutations/products/addProductAssignment.js.map +1 -1
  281. package/lib/resolvers/mutations/products/addProductMedia.d.ts +6 -0
  282. package/lib/resolvers/mutations/products/addProductMedia.d.ts.map +1 -0
  283. package/lib/resolvers/mutations/products/addProductMedia.js +18 -0
  284. package/lib/resolvers/mutations/products/addProductMedia.js.map +1 -0
  285. package/lib/resolvers/mutations/users/updateUserAvatar.d.ts +6 -0
  286. package/lib/resolvers/mutations/users/updateUserAvatar.d.ts.map +1 -0
  287. package/lib/resolvers/mutations/users/updateUserAvatar.js +22 -0
  288. package/lib/resolvers/mutations/users/updateUserAvatar.js.map +1 -0
  289. package/lib/resolvers/mutations/utils/getOrderCart.d.ts +7 -0
  290. package/lib/resolvers/mutations/utils/getOrderCart.d.ts.map +1 -0
  291. package/lib/resolvers/mutations/utils/getOrderCart.js +13 -0
  292. package/lib/resolvers/mutations/utils/getOrderCart.js.map +1 -0
  293. package/lib/resolvers/queries/filters/searchAssortments.d.ts.map +1 -1
  294. package/lib/resolvers/queries/filters/searchAssortments.js +0 -5
  295. package/lib/resolvers/queries/filters/searchAssortments.js.map +1 -1
  296. package/lib/resolvers/queries/filters/searchProducts.d.ts.map +1 -1
  297. package/lib/resolvers/queries/filters/searchProducts.js +2 -7
  298. package/lib/resolvers/queries/filters/searchProducts.js.map +1 -1
  299. package/lib/resolvers/type/dispatch-types.d.ts +15 -0
  300. package/lib/resolvers/type/dispatch-types.d.ts.map +1 -0
  301. package/lib/resolvers/type/dispatch-types.js +16 -0
  302. package/lib/resolvers/type/dispatch-types.js.map +1 -0
  303. package/lib/resolvers/type/oauth-account.d.ts +6 -0
  304. package/lib/resolvers/type/oauth-account.d.ts.map +1 -0
  305. package/lib/resolvers/type/oauth-account.js +7 -0
  306. package/lib/resolvers/type/oauth-account.js.map +1 -0
  307. package/lib/resolvers/type/oauth-provider.d.ts +6 -0
  308. package/lib/resolvers/type/oauth-provider.d.ts.map +1 -0
  309. package/lib/resolvers/type/oauth-provider.js +6 -0
  310. package/lib/resolvers/type/oauth-provider.js.map +1 -0
  311. package/lib/resolvers/type/stock-types.d.ts +14 -0
  312. package/lib/resolvers/type/stock-types.d.ts.map +1 -0
  313. package/lib/resolvers/type/stock-types.js +15 -0
  314. package/lib/resolvers/type/stock-types.js.map +1 -0
  315. package/lib/roles/all.d.ts.map +1 -1
  316. package/lib/roles/all.js +1 -0
  317. package/lib/roles/all.js.map +1 -1
  318. package/lib/roles/index.d.ts.map +1 -1
  319. package/lib/roles/index.js +1 -0
  320. package/lib/roles/index.js.map +1 -1
  321. package/lib/roles/loggedIn.d.ts.map +1 -1
  322. package/lib/roles/loggedIn.js +1 -0
  323. package/lib/roles/loggedIn.js.map +1 -1
  324. package/lib/user-context.d.ts +7 -0
  325. package/lib/user-context.d.ts.map +1 -0
  326. package/lib/user-context.js +76 -0
  327. package/lib/user-context.js.map +1 -0
  328. package/package.json +34 -18
  329. package/src/api-index.ts +4 -1
  330. package/src/errors.ts +5 -4
  331. package/src/express/createMCPMiddleware.ts +91 -0
  332. package/src/express/createTempUploadMiddleware.ts +60 -0
  333. package/src/express/index.ts +35 -6
  334. package/src/fastify/index.ts +32 -2
  335. package/src/fastify/mcpHandler.ts +97 -0
  336. package/src/fastify/tempUploadHandler.ts +52 -0
  337. package/src/loaders/assortmentMediaTextLoader.ts +1 -1
  338. package/src/loaders/assortmentTextLoader.ts +1 -1
  339. package/src/loaders/buildLocaleMap.test.ts +65 -0
  340. package/src/loaders/buildLocaleMap.ts +73 -0
  341. package/src/loaders/buildTextMap.test.ts +54 -0
  342. package/src/loaders/buildTextMap.ts +25 -6
  343. package/src/loaders/filterTextLoader.ts +1 -1
  344. package/src/loaders/productMediaTextLoader.ts +1 -1
  345. package/src/loaders/productTextLoader.ts +1 -1
  346. package/src/mcp/README.md +25 -0
  347. package/src/mcp/index.ts +313 -0
  348. package/src/mcp/tools/addProductAssignmentHandler.ts +118 -0
  349. package/src/mcp/tools/addProductMediaUploadHandler.ts +79 -0
  350. package/src/mcp/tools/countriesHandler.ts +60 -0
  351. package/src/mcp/tools/countryHandler.ts +40 -0
  352. package/src/mcp/tools/createLanguageHandler.ts +46 -0
  353. package/src/mcp/tools/createProduct.ts +75 -0
  354. package/src/mcp/tools/createProductVariationHandler.ts +93 -0
  355. package/src/mcp/tools/createProductVariationOptionHandler.ts +73 -0
  356. package/src/mcp/tools/currenciesHandler.ts +63 -0
  357. package/src/mcp/tools/currencyHandler.ts +40 -0
  358. package/src/mcp/tools/getProduct.ts +74 -0
  359. package/src/mcp/tools/index.ts +39 -0
  360. package/src/mcp/tools/languageHandler.ts +37 -0
  361. package/src/mcp/tools/languagesHandler.ts +54 -0
  362. package/src/mcp/tools/listProducts.ts +148 -0
  363. package/src/mcp/tools/productReviewsCountHandler.ts +36 -0
  364. package/src/mcp/tools/productReviewsHandler.ts +54 -0
  365. package/src/mcp/tools/productsCountHandler.ts +38 -0
  366. package/src/mcp/tools/publishProduct.ts +45 -0
  367. package/src/mcp/tools/removeLanguageHandler.ts +42 -0
  368. package/src/mcp/tools/removeProductAssignmentHandler.ts +61 -0
  369. package/src/mcp/tools/removeProductHandler.ts +40 -0
  370. package/src/mcp/tools/removeProductMediaHandler.ts +49 -0
  371. package/src/mcp/tools/removeProductVariationHandler.ts +51 -0
  372. package/src/mcp/tools/removeProductVariationOptionHandler.ts +58 -0
  373. package/src/mcp/tools/reorderProductMediaHandler.ts +48 -0
  374. package/src/mcp/tools/unPublishProduct.ts +46 -0
  375. package/src/mcp/tools/updateLanguageHandler.ts +47 -0
  376. package/src/mcp/tools/updateProduct.ts +51 -0
  377. package/src/mcp/tools/updateProductCommerceHandler.ts +79 -0
  378. package/src/mcp/tools/updateProductMediaTextsHandler.ts +56 -0
  379. package/src/mcp/tools/updateProductPlanHandler.ts +58 -0
  380. package/src/mcp/tools/updateProductSupplyHandler.ts +59 -0
  381. package/src/mcp/tools/updateProductTextsHandler.ts +59 -0
  382. package/src/mcp/tools/updateProductTokenizationHandler.ts +58 -0
  383. package/src/mcp/tools/updateProductWarehousingHandler.ts +54 -0
  384. package/src/mcp/utils/getNormalizedProductDetails.ts +42 -0
  385. package/src/mcp/utils/normalizeMediaUrl.ts +26 -0
  386. package/src/resolvers/mutations/products/addProductAssignment.ts +3 -0
  387. package/src/resolvers/queries/filters/searchAssortments.ts +0 -5
  388. package/src/resolvers/queries/filters/searchProducts.ts +2 -7
  389. package/src/roles/all.ts +1 -0
  390. package/src/roles/index.ts +1 -0
  391. package/src/roles/loggedIn.ts +1 -0
  392. package/lib/express/mcpHandler.d.ts.map +0 -1
  393. package/lib/express/mcpHandler.js +0 -68
  394. package/lib/express/mcpHandler.js.map +0 -1
  395. package/lib/fastify/index copy.d.ts.map +0 -1
  396. package/lib/fastify/index copy.js +0 -157
  397. package/lib/fastify/index copy.js.map +0 -1
  398. package/lib/mcp/server.d.ts +0 -4
  399. package/lib/mcp/server.d.ts.map +0 -1
  400. package/lib/mcp/server.js +0 -60
  401. package/lib/mcp/server.js.map +0 -1
  402. package/lib/mcp/types.d.ts +0 -28
  403. package/lib/mcp/types.d.ts.map +0 -1
  404. package/lib/mcp/types.js +0 -2
  405. package/lib/mcp/types.js.map +0 -1
  406. package/lib/middleware/accountLockout.d.ts.map +0 -1
  407. package/lib/middleware/accountLockout.js +0 -84
  408. package/lib/middleware/accountLockout.js.map +0 -1
  409. package/lib/middleware/rateLimiter.d.ts.map +0 -1
  410. package/lib/middleware/rateLimiter.js +0 -91
  411. package/lib/middleware/rateLimiter.js.map +0 -1
  412. package/lib/plugins/inputValidation.d.ts.map +0 -1
  413. package/lib/plugins/inputValidation.js +0 -95
  414. package/lib/plugins/inputValidation.js.map +0 -1
  415. package/lib/utils/inputValidation.d.ts.map +0 -1
  416. package/lib/utils/inputValidation.js +0 -51
  417. package/lib/utils/inputValidation.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeLanguageHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/removeLanguageHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,8BAA8B,CAAC;CACvE,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAGtE,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAgB,EAAE,MAA4B;IACxF,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAC9B,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,CAAC;QACH,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;YAC3D,MAAM,IAAI,qBAAqB,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;QAElD,MAAM,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAE3C,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;QAE5E,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;iBACnD;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,4BAA6B,KAAe,CAAC,OAAO,EAAE;iBAC7D;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { Context } from '../../context.js';
3
+ export declare const RemoveProductSchema: {
4
+ productId: z.ZodString;
5
+ };
6
+ export declare const RemoveProductZodSchema: z.ZodObject<{
7
+ productId: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ productId?: string;
10
+ }, {
11
+ productId?: string;
12
+ }>;
13
+ export type RemoveProductParams = z.infer<typeof RemoveProductZodSchema>;
14
+ export declare function removeProductHandler(context: Context, params: RemoveProductParams): Promise<{
15
+ content: {
16
+ type: "text";
17
+ text: string;
18
+ }[];
19
+ }>;
20
+ //# sourceMappingURL=removeProduct.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeProduct.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/removeProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,eAAO,MAAM,mBAAmB;;CAE/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;EAAgC,CAAC;AAEpE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEzE,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB;;;;;GA2BvF"}
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
3
+ export const RemoveProductSchema = {
4
+ productId: z.string().min(1).describe('ID of the product to remove'),
5
+ };
6
+ export const RemoveProductZodSchema = z.object(RemoveProductSchema);
7
+ export async function removeProductHandler(context, params) {
8
+ const { productId } = params;
9
+ const { services } = context;
10
+ try {
11
+ await services.products.removeProduct({ productId });
12
+ return {
13
+ content: [
14
+ {
15
+ type: 'text',
16
+ text: JSON.stringify({
17
+ product: await getNormalizedProductDetails(productId, context),
18
+ }),
19
+ },
20
+ ],
21
+ };
22
+ }
23
+ catch (error) {
24
+ return {
25
+ content: [
26
+ {
27
+ type: 'text',
28
+ text: `Error removing product: ${error.message}`,
29
+ },
30
+ ],
31
+ };
32
+ }
33
+ }
34
+ //# sourceMappingURL=removeProduct.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeProduct.js","sourceRoot":"","sources":["../../../src/mcp/tools/removeProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CACrE,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAIpE,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAgB,EAAE,MAA2B;IACtF,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAC7B,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7B,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QAErD,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,MAAM,2BAA2B,CAAC,SAAS,EAAE,OAAO,CAAC;qBAC/D,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,2BAA4B,KAAe,CAAC,OAAO,EAAE;iBAC5D;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { z } from 'zod';
2
+ import { Context } from '../../context.js';
3
+ export declare const RemoveProductAssignmentSchema: {
4
+ proxyId: z.ZodString;
5
+ vectors: z.ZodArray<z.ZodObject<{
6
+ key: z.ZodString;
7
+ value: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ key?: string;
10
+ value?: string;
11
+ }, {
12
+ key?: string;
13
+ value?: string;
14
+ }>, "many">;
15
+ };
16
+ export declare const RemoveProductAssignmentZodSchema: z.ZodObject<{
17
+ proxyId: z.ZodString;
18
+ vectors: z.ZodArray<z.ZodObject<{
19
+ key: z.ZodString;
20
+ value: z.ZodString;
21
+ }, "strip", z.ZodTypeAny, {
22
+ key?: string;
23
+ value?: string;
24
+ }, {
25
+ key?: string;
26
+ value?: string;
27
+ }>, "many">;
28
+ }, "strip", z.ZodTypeAny, {
29
+ proxyId?: string;
30
+ vectors?: {
31
+ key?: string;
32
+ value?: string;
33
+ }[];
34
+ }, {
35
+ proxyId?: string;
36
+ vectors?: {
37
+ key?: string;
38
+ value?: string;
39
+ }[];
40
+ }>;
41
+ export type RemoveProductAssignmentParams = z.infer<typeof RemoveProductAssignmentZodSchema>;
42
+ export declare function removeProductAssignmentHandler(context: Context, params: RemoveProductAssignmentParams): Promise<{
43
+ content: {
44
+ type: "text";
45
+ text: string;
46
+ }[];
47
+ }>;
48
+ //# sourceMappingURL=removeProductAssignmentHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeProductAssignmentHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/removeProductAssignmentHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAU3C,eAAO,MAAM,6BAA6B;;;;;;;;;;;;CAMzC,CAAC;AACF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;EAA0C,CAAC;AACxF,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE7F,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,6BAA6B;;;;;GAqCtC"}
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+ import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
3
+ import { ProductWrongTypeError } from '../../errors.js';
4
+ import { ProductTypes } from '@unchainedshop/core-products';
5
+ const ProductAssignmentVectorSchema = z.object({
6
+ key: z.string().min(1).describe('Attribute key (e.g., "Color", "Size")'),
7
+ value: z.string().min(1).describe('Attribute value (e.g., "Red", "M")'),
8
+ });
9
+ export const RemoveProductAssignmentSchema = {
10
+ proxyId: z.string().min(1).describe('ID of the configurable_product'),
11
+ vectors: z
12
+ .array(ProductAssignmentVectorSchema)
13
+ .min(1)
14
+ .describe('Combination of attributes uniquely identifying the variant'),
15
+ };
16
+ export const RemoveProductAssignmentZodSchema = z.object(RemoveProductAssignmentSchema);
17
+ export async function removeProductAssignmentHandler(context, params) {
18
+ const { proxyId, vectors } = params;
19
+ const { modules } = context;
20
+ try {
21
+ const product = await modules.products.findProduct({ productId: proxyId });
22
+ if (product.type !== ProductTypes.ConfigurableProduct)
23
+ throw new ProductWrongTypeError({
24
+ productId: proxyId,
25
+ received: product.type,
26
+ required: ProductTypes.ConfigurableProduct,
27
+ });
28
+ await modules.products.assignments.removeAssignment(proxyId, { vectors: vectors });
29
+ return {
30
+ content: [
31
+ {
32
+ type: 'text',
33
+ text: JSON.stringify({
34
+ product: await getNormalizedProductDetails(proxyId, context),
35
+ }),
36
+ },
37
+ ],
38
+ };
39
+ }
40
+ catch (error) {
41
+ return {
42
+ content: [
43
+ {
44
+ type: 'text',
45
+ text: `Error removing product assignment: ${error.message}`,
46
+ },
47
+ ],
48
+ };
49
+ }
50
+ }
51
+ //# sourceMappingURL=removeProductAssignmentHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeProductAssignmentHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/removeProductAssignmentHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IACxE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,oCAAoC,CAAC;CACxE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,gCAAgC,CAAC;IACrE,OAAO,EAAE,CAAC;SACP,KAAK,CAAC,6BAA6B,CAAC;SACpC,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,4DAA4D,CAAC;CAC1E,CAAC;AACF,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC,6BAA6B,CAAC,CAAC;AAGxF,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,OAAgB,EAChB,MAAqC;IAErC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;QAE3E,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,mBAAmB;YACnD,MAAM,IAAI,qBAAqB,CAAC;gBAC9B,SAAS,EAAE,OAAO;gBAClB,QAAQ,EAAE,OAAO,CAAC,IAAI;gBACtB,QAAQ,EAAE,YAAY,CAAC,mBAAmB;aAC3C,CAAC,CAAC;QAEL,MAAM,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,OAAc,EAAE,CAAC,CAAC;QAE1F,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,MAAM,2BAA2B,CAAC,OAAO,EAAE,OAAO,CAAC;qBAC7D,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,sCAAuC,KAAe,CAAC,OAAO,EAAE;iBACvE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { Context } from '../../context.js';
3
+ export declare const RemoveProductSchema: {
4
+ productId: z.ZodString;
5
+ };
6
+ export declare const RemoveProductZodSchema: z.ZodObject<{
7
+ productId: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ productId?: string;
10
+ }, {
11
+ productId?: string;
12
+ }>;
13
+ export type RemoveProductParams = z.infer<typeof RemoveProductZodSchema>;
14
+ export declare function removeProductHandler(context: Context, params: RemoveProductParams): Promise<{
15
+ content: {
16
+ type: "text";
17
+ text: string;
18
+ }[];
19
+ }>;
20
+ //# sourceMappingURL=removeProductHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeProductHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/removeProductHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,eAAO,MAAM,mBAAmB;;CAE/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;EAAgC,CAAC;AAEpE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEzE,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB;;;;;GA2BvF"}
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
3
+ export const RemoveProductSchema = {
4
+ productId: z.string().min(1).describe('ID of the product to remove'),
5
+ };
6
+ export const RemoveProductZodSchema = z.object(RemoveProductSchema);
7
+ export async function removeProductHandler(context, params) {
8
+ const { productId } = params;
9
+ const { services } = context;
10
+ try {
11
+ await services.products.removeProduct({ productId });
12
+ return {
13
+ content: [
14
+ {
15
+ type: 'text',
16
+ text: JSON.stringify({
17
+ product: await getNormalizedProductDetails(productId, context),
18
+ }),
19
+ },
20
+ ],
21
+ };
22
+ }
23
+ catch (error) {
24
+ return {
25
+ content: [
26
+ {
27
+ type: 'text',
28
+ text: `Error removing product: ${error.message}`,
29
+ },
30
+ ],
31
+ };
32
+ }
33
+ }
34
+ //# sourceMappingURL=removeProductHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeProductHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/removeProductHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CACrE,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAIpE,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAgB,EAAE,MAA2B;IACtF,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAC7B,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7B,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QAErD,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,MAAM,2BAA2B,CAAC,SAAS,EAAE,OAAO,CAAC;qBAC/D,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,2BAA4B,KAAe,CAAC,OAAO,EAAE;iBAC5D;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { Context } from '../../context.js';
3
+ export declare const RemoveProductMediaSchema: {
4
+ productMediaId: z.ZodString;
5
+ };
6
+ export declare const RemoveProductMediaZodSchema: z.ZodObject<{
7
+ productMediaId: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ productMediaId?: string;
10
+ }, {
11
+ productMediaId?: string;
12
+ }>;
13
+ export type RemoveProductMediaParams = z.infer<typeof RemoveProductMediaZodSchema>;
14
+ export declare function removeProductMediaHandler(context: Context, params: RemoveProductMediaParams): Promise<{
15
+ content: {
16
+ type: "text";
17
+ text: string;
18
+ }[];
19
+ }>;
20
+ //# sourceMappingURL=removeProductMediaHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeProductMediaHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/removeProductMediaHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,eAAO,MAAM,wBAAwB;;CAEpC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;EAAqC,CAAC;AAE9E,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEnF,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,wBAAwB;;;;;GAmCjG"}
@@ -0,0 +1,42 @@
1
+ import { z } from 'zod';
2
+ import { log } from '@unchainedshop/logger';
3
+ import { ProductMediaNotFoundError } from '../../errors.js';
4
+ export const RemoveProductMediaSchema = {
5
+ productMediaId: z.string().min(1).describe('ID of the product media to be removed'),
6
+ };
7
+ export const RemoveProductMediaZodSchema = z.object(RemoveProductMediaSchema);
8
+ export async function removeProductMediaHandler(context, params) {
9
+ const { productMediaId } = params;
10
+ const { modules, userId } = context;
11
+ try {
12
+ log('removeProductMediaHandler', { userId, productMediaId });
13
+ const productMedia = await modules.products.media.findProductMedia({
14
+ productMediaId,
15
+ });
16
+ if (!productMedia)
17
+ throw new ProductMediaNotFoundError({ productMediaId });
18
+ await modules.files.delete(productMedia.mediaId);
19
+ await modules.products.media.delete(productMediaId);
20
+ return {
21
+ content: [
22
+ {
23
+ type: 'text',
24
+ text: JSON.stringify({
25
+ media: productMedia,
26
+ }),
27
+ },
28
+ ],
29
+ };
30
+ }
31
+ catch (error) {
32
+ return {
33
+ content: [
34
+ {
35
+ type: 'text',
36
+ text: `Error removing product media: ${error.message}`,
37
+ },
38
+ ],
39
+ };
40
+ }
41
+ }
42
+ //# sourceMappingURL=removeProductMediaHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeProductMediaHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/removeProductMediaHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uCAAuC,CAAC;CACpF,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAI9E,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,OAAgB,EAAE,MAAgC;IAChG,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IAClC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEpC,IAAI,CAAC;QACH,GAAG,CAAC,2BAA2B,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;QAE7D,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC;YACjE,cAAc;SACf,CAAC,CAAC;QACH,IAAI,CAAC,YAAY;YAAE,MAAM,IAAI,yBAAyB,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;QAE3E,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACjD,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAEpD,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,KAAK,EAAE,YAAY;qBACpB,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,iCAAkC,KAAe,CAAC,OAAO,EAAE;iBAClE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { Context } from '../../context.js';
3
+ export declare const RemoveProductVariationSchema: {
4
+ productVariationId: z.ZodString;
5
+ };
6
+ export declare const RemoveProductVariationZodSchema: z.ZodObject<{
7
+ productVariationId: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ productVariationId?: string;
10
+ }, {
11
+ productVariationId?: string;
12
+ }>;
13
+ export type RemoveProductVariationParams = z.infer<typeof RemoveProductVariationZodSchema>;
14
+ export declare function removeProductVariationHandler(context: Context, params: RemoveProductVariationParams): Promise<{
15
+ content: {
16
+ type: "text";
17
+ text: string;
18
+ }[];
19
+ }>;
20
+ //# sourceMappingURL=removeProductVariationHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeProductVariationHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/removeProductVariationHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,eAAO,MAAM,4BAA4B;;CAKxC,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;EAAyC,CAAC;AACtF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAE3F,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,4BAA4B;;;;;GAiCrC"}
@@ -0,0 +1,43 @@
1
+ import { z } from 'zod';
2
+ import { ProductVariationNotFoundError } from '../../errors.js';
3
+ import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
4
+ export const RemoveProductVariationSchema = {
5
+ productVariationId: z
6
+ .string()
7
+ .min(1)
8
+ .describe('ID of the product variation to remove. it should be a valid product variation ID'),
9
+ };
10
+ export const RemoveProductVariationZodSchema = z.object(RemoveProductVariationSchema);
11
+ export async function removeProductVariationHandler(context, params) {
12
+ const { productVariationId } = params;
13
+ const { modules } = context;
14
+ try {
15
+ const productVariation = await modules.products.variations.findProductVariation({
16
+ productVariationId,
17
+ });
18
+ if (!productVariation)
19
+ throw new ProductVariationNotFoundError({ productVariationId });
20
+ await modules.products.variations.delete(productVariationId);
21
+ return {
22
+ content: [
23
+ {
24
+ type: 'text',
25
+ text: JSON.stringify({
26
+ product: await getNormalizedProductDetails(productVariationId, context),
27
+ }),
28
+ },
29
+ ],
30
+ };
31
+ }
32
+ catch (error) {
33
+ return {
34
+ content: [
35
+ {
36
+ type: 'text',
37
+ text: `Error removing product variation: ${error.message}`,
38
+ },
39
+ ],
40
+ };
41
+ }
42
+ }
43
+ //# sourceMappingURL=removeProductVariationHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeProductVariationHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/removeProductVariationHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,kBAAkB,EAAE,CAAC;SAClB,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,kFAAkF,CAAC;CAChG,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC;AAGtF,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAAgB,EAChB,MAAoC;IAEpC,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC;IACtC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC;YAC9E,kBAAkB;SACnB,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB;YAAE,MAAM,IAAI,6BAA6B,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAC;QAEvF,MAAM,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAE7D,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,MAAM,2BAA2B,CAAC,kBAAkB,EAAE,OAAO,CAAC;qBACxE,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,qCAAsC,KAAe,CAAC,OAAO,EAAE;iBACtE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ import { Context } from '../../context.js';
3
+ export declare const RemoveProductVariationOptionSchema: {
4
+ productVariationId: z.ZodString;
5
+ productVariationOptionValue: z.ZodString;
6
+ };
7
+ export declare const RemoveProductVariationOptionZodSchema: z.ZodObject<{
8
+ productVariationId: z.ZodString;
9
+ productVariationOptionValue: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ productVariationId?: string;
12
+ productVariationOptionValue?: string;
13
+ }, {
14
+ productVariationId?: string;
15
+ productVariationOptionValue?: string;
16
+ }>;
17
+ export type RemoveProductVariationOptionParams = z.infer<typeof RemoveProductVariationOptionZodSchema>;
18
+ export declare function removeProductVariationOptionHandler(context: Context, params: RemoveProductVariationOptionParams): Promise<{
19
+ content: {
20
+ type: "text";
21
+ text: string;
22
+ }[];
23
+ }>;
24
+ //# sourceMappingURL=removeProductVariationOptionHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeProductVariationOptionHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/removeProductVariationOptionHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,eAAO,MAAM,kCAAkC;;;CAS9C,CAAC;AAEF,eAAO,MAAM,qCAAqC;;;;;;;;;EAA+C,CAAC;AAClG,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAEvG,wBAAsB,mCAAmC,CACvD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,kCAAkC;;;;;GAoC3C"}
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
3
+ import { ProductVariationNotFoundError } from '../../errors.js';
4
+ export const RemoveProductVariationOptionSchema = {
5
+ productVariationId: z
6
+ .string()
7
+ .min(1)
8
+ .describe('ID of the product variation, it should be a CONFIGURABLE_PRODUCT type only'),
9
+ productVariationOptionValue: z
10
+ .string()
11
+ .min(1)
12
+ .describe('existing Option value in the product to remove (e.g., "Red")'),
13
+ };
14
+ export const RemoveProductVariationOptionZodSchema = z.object(RemoveProductVariationOptionSchema);
15
+ export async function removeProductVariationOptionHandler(context, params) {
16
+ const { productVariationId, productVariationOptionValue } = params;
17
+ const { modules } = context;
18
+ try {
19
+ const productVariation = await modules.products.variations.findProductVariation({
20
+ productVariationId,
21
+ });
22
+ if (!productVariation)
23
+ throw new ProductVariationNotFoundError({ productVariationId });
24
+ await modules.products.variations.removeVariationOption(productVariationId, productVariationOptionValue);
25
+ return {
26
+ content: [
27
+ {
28
+ type: 'text',
29
+ text: JSON.stringify({
30
+ product: await getNormalizedProductDetails(productVariation.productId, context),
31
+ }),
32
+ },
33
+ ],
34
+ };
35
+ }
36
+ catch (error) {
37
+ return {
38
+ content: [
39
+ {
40
+ type: 'text',
41
+ text: `Error removing variation option: ${error.message}`,
42
+ },
43
+ ],
44
+ };
45
+ }
46
+ }
47
+ //# sourceMappingURL=removeProductVariationOptionHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeProductVariationOptionHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/removeProductVariationOptionHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,kBAAkB,EAAE,CAAC;SAClB,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,4EAA4E,CAAC;IACzF,2BAA2B,EAAE,CAAC;SAC3B,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,8DAA8D,CAAC;CAC5E,CAAC;AAEF,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,CAAC,MAAM,CAAC,kCAAkC,CAAC,CAAC;AAGlG,MAAM,CAAC,KAAK,UAAU,mCAAmC,CACvD,OAAgB,EAChB,MAA0C;IAE1C,MAAM,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,GAAG,MAAM,CAAC;IACnE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC;YAC9E,kBAAkB;SACnB,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB;YAAE,MAAM,IAAI,6BAA6B,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAC;QAEvF,MAAM,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CACrD,kBAAkB,EAClB,2BAA2B,CAC5B,CAAC;QAEF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,MAAM,2BAA2B,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC;qBAChF,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,oCAAqC,KAAe,CAAC,OAAO,EAAE;iBACrE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { Context } from '../../context.js';
2
+ import { z } from 'zod';
3
+ export declare const ReorderProductMediaSchema: {
4
+ sortKeys: z.ZodArray<z.ZodObject<{
5
+ productMediaId: z.ZodString;
6
+ sortKey: z.ZodNumber;
7
+ }, "strip", z.ZodTypeAny, {
8
+ sortKey?: number;
9
+ productMediaId?: string;
10
+ }, {
11
+ sortKey?: number;
12
+ productMediaId?: string;
13
+ }>, "many">;
14
+ };
15
+ export declare const ReorderProductMediaZodSchema: z.ZodObject<{
16
+ sortKeys: z.ZodArray<z.ZodObject<{
17
+ productMediaId: z.ZodString;
18
+ sortKey: z.ZodNumber;
19
+ }, "strip", z.ZodTypeAny, {
20
+ sortKey?: number;
21
+ productMediaId?: string;
22
+ }, {
23
+ sortKey?: number;
24
+ productMediaId?: string;
25
+ }>, "many">;
26
+ }, "strip", z.ZodTypeAny, {
27
+ sortKeys?: {
28
+ sortKey?: number;
29
+ productMediaId?: string;
30
+ }[];
31
+ }, {
32
+ sortKeys?: {
33
+ sortKey?: number;
34
+ productMediaId?: string;
35
+ }[];
36
+ }>;
37
+ export type ReorderProductMediaParams = z.infer<typeof ReorderProductMediaZodSchema>;
38
+ export declare function reorderProductMediaHandler(context: Context, params: ReorderProductMediaParams): Promise<{
39
+ content: {
40
+ type: "text";
41
+ text: string;
42
+ }[];
43
+ }>;
44
+ //# sourceMappingURL=reorderProductMediaHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reorderProductMediaHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/reorderProductMediaHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,yBAAyB;;;;;;;;;;;CAUrC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;EAAsC,CAAC;AAEhF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAErF,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,yBAAyB;;;;;GA2BnG"}
@@ -0,0 +1,39 @@
1
+ import { log } from '@unchainedshop/logger';
2
+ import { z } from 'zod';
3
+ export const ReorderProductMediaSchema = {
4
+ sortKeys: z
5
+ .array(z.object({
6
+ productMediaId: z.string().min(1).describe('ID of the media asset'),
7
+ sortKey: z.number().int().describe('New sort key for ordering'),
8
+ }))
9
+ .min(1)
10
+ .describe('Array of product media IDs with their sort order'),
11
+ };
12
+ export const ReorderProductMediaZodSchema = z.object(ReorderProductMediaSchema);
13
+ export async function reorderProductMediaHandler(context, params) {
14
+ const { sortKeys } = params;
15
+ const { modules, userId } = context;
16
+ try {
17
+ log('mutation reorderProductMedia', { userId });
18
+ const reorderedMedia = await modules.products.media.updateManualOrder({ sortKeys: sortKeys });
19
+ return {
20
+ content: [
21
+ {
22
+ type: 'text',
23
+ text: JSON.stringify({ reorderedMedia }, null, 2),
24
+ },
25
+ ],
26
+ };
27
+ }
28
+ catch (error) {
29
+ return {
30
+ content: [
31
+ {
32
+ type: 'text',
33
+ text: `Error reordering product media: ${error.message}`,
34
+ },
35
+ ],
36
+ };
37
+ }
38
+ }
39
+ //# sourceMappingURL=reorderProductMediaHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reorderProductMediaHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/reorderProductMediaHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,QAAQ,EAAE,CAAC;SACR,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QACnE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;KAChE,CAAC,CACH;SACA,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,kDAAkD,CAAC;CAChE,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAIhF,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,OAAgB,EAAE,MAAiC;IAClG,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAC5B,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEpC,IAAI,CAAC;QACH,GAAG,CAAC,8BAA8B,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAEhD,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,QAAe,EAAE,CAAC,CAAC;QAErG,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBAClD;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,mCAAoC,KAAe,CAAC,OAAO,EAAE;iBACpE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { Context } from '../../context.js';
3
+ export declare const UnpublishProductSchema: {
4
+ productId: z.ZodString;
5
+ };
6
+ export declare const UnpublishProductZodSchema: z.ZodObject<{
7
+ productId: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ productId?: string;
10
+ }, {
11
+ productId?: string;
12
+ }>;
13
+ export type UnpublishProductParams = z.infer<typeof UnpublishProductZodSchema>;
14
+ export declare function unpublishProductHandler(context: Context, params: UnpublishProductParams): Promise<{
15
+ content: {
16
+ type: "text";
17
+ text: string;
18
+ }[];
19
+ }>;
20
+ //# sourceMappingURL=unPublishProduct.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unPublishProduct.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/unPublishProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,eAAO,MAAM,sBAAsB;;CAElC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;EAAmC,CAAC;AAE1E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE/E,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,sBAAsB;;;;;GAgC7F"}
@@ -0,0 +1,40 @@
1
+ import { z } from 'zod';
2
+ import { ProductNotFoundError, ProductWrongStatusError } from '../../errors.js';
3
+ import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
4
+ export const UnpublishProductSchema = {
5
+ productId: z.string().min(1).describe('ID of the product to unpublish'),
6
+ };
7
+ export const UnpublishProductZodSchema = z.object(UnpublishProductSchema);
8
+ export async function unpublishProductHandler(context, params) {
9
+ const { productId } = params;
10
+ const { modules } = context;
11
+ try {
12
+ const product = await modules.products.findProduct({ productId });
13
+ if (!product)
14
+ throw new ProductNotFoundError({ productId });
15
+ if (!(await modules.products.unpublish(product))) {
16
+ throw new ProductWrongStatusError({ status: product.status });
17
+ }
18
+ return {
19
+ content: [
20
+ {
21
+ type: 'text',
22
+ text: JSON.stringify({
23
+ product: await getNormalizedProductDetails(productId, context),
24
+ }),
25
+ },
26
+ ],
27
+ };
28
+ }
29
+ catch (error) {
30
+ return {
31
+ content: [
32
+ {
33
+ type: 'text',
34
+ text: `Error unPublishing product: ${error.message}`,
35
+ },
36
+ ],
37
+ };
38
+ }
39
+ }
40
+ //# sourceMappingURL=unPublishProduct.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unPublishProduct.js","sourceRoot":"","sources":["../../../src/mcp/tools/unPublishProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,gCAAgC,CAAC;CACxE,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAI1E,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,OAAgB,EAAE,MAA8B;IAC5F,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAC7B,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QAClE,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,oBAAoB,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QAE5D,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;YACjD,MAAM,IAAI,uBAAuB,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAChE,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,MAAM,2BAA2B,CAAC,SAAS,EAAE,OAAO,CAAC;qBAC/D,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,+BAAgC,KAAe,CAAC,OAAO,EAAE;iBAChE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}