@unchainedshop/api 3.1.12 → 3.1.13

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 (252) hide show
  1. package/lib/errors.d.ts +1 -0
  2. package/lib/errors.d.ts.map +1 -1
  3. package/lib/errors.js +1 -0
  4. package/lib/errors.js.map +1 -1
  5. package/lib/express/chatRouter.d.ts +3 -0
  6. package/lib/express/chatRouter.d.ts.map +1 -0
  7. package/lib/express/chatRouter.js +86 -0
  8. package/lib/express/chatRouter.js.map +1 -0
  9. package/lib/express/createApolloMiddleware.d.ts +4 -0
  10. package/lib/express/createApolloMiddleware.d.ts.map +1 -0
  11. package/lib/express/createApolloMiddleware.js +36 -0
  12. package/lib/express/createApolloMiddleware.js.map +1 -0
  13. package/lib/express/createSingleSignOnMiddleware.d.ts +5 -0
  14. package/lib/express/createSingleSignOnMiddleware.d.ts.map +1 -0
  15. package/lib/express/createSingleSignOnMiddleware.js +71 -0
  16. package/lib/express/createSingleSignOnMiddleware.js.map +1 -0
  17. package/lib/hashPassword.d.ts +2 -0
  18. package/lib/hashPassword.d.ts.map +1 -0
  19. package/lib/hashPassword.js +5 -0
  20. package/lib/hashPassword.js.map +1 -0
  21. package/lib/loaders/assortmentMediaTextLoader.js +1 -1
  22. package/lib/loaders/assortmentMediaTextLoader.js.map +1 -1
  23. package/lib/loaders/assortmentTextLoader.js +1 -1
  24. package/lib/loaders/assortmentTextLoader.js.map +1 -1
  25. package/lib/loaders/filterTextLoader.js +1 -1
  26. package/lib/loaders/filterTextLoader.js.map +1 -1
  27. package/lib/loaders/index.d.ts.map +1 -1
  28. package/lib/loaders/index.js.map +1 -1
  29. package/lib/loaders/productMediaTextLoader.d.ts.map +1 -1
  30. package/lib/loaders/productMediaTextLoader.js +1 -1
  31. package/lib/loaders/productMediaTextLoader.js.map +1 -1
  32. package/lib/loaders/productTextLoader.d.ts.map +1 -1
  33. package/lib/loaders/productTextLoader.js +1 -1
  34. package/lib/loaders/productTextLoader.js.map +1 -1
  35. package/lib/mcp/index.d.ts.map +1 -1
  36. package/lib/mcp/index.js +1 -1
  37. package/lib/mcp/index.js.map +1 -1
  38. package/lib/mcp/tools/addProductAssignmentHandler.d.ts +52 -0
  39. package/lib/mcp/tools/addProductAssignmentHandler.d.ts.map +1 -0
  40. package/lib/mcp/tools/addProductAssignmentHandler.js +97 -0
  41. package/lib/mcp/tools/addProductAssignmentHandler.js.map +1 -0
  42. package/lib/mcp/tools/countriesHandler.d.ts +60 -0
  43. package/lib/mcp/tools/countriesHandler.d.ts.map +1 -0
  44. package/lib/mcp/tools/countriesHandler.js +48 -0
  45. package/lib/mcp/tools/countriesHandler.js.map +1 -0
  46. package/lib/mcp/tools/countryHandler.d.ts +20 -0
  47. package/lib/mcp/tools/countryHandler.d.ts.map +1 -0
  48. package/lib/mcp/tools/countryHandler.js +34 -0
  49. package/lib/mcp/tools/countryHandler.js.map +1 -0
  50. package/lib/mcp/tools/createProduct.d.ts +138 -0
  51. package/lib/mcp/tools/createProduct.d.ts.map +1 -0
  52. package/lib/mcp/tools/createProduct.js +60 -0
  53. package/lib/mcp/tools/createProduct.js.map +1 -0
  54. package/lib/mcp/tools/createProductVariationHandler.d.ts +84 -0
  55. package/lib/mcp/tools/createProductVariationHandler.d.ts.map +1 -0
  56. package/lib/mcp/tools/createProductVariationHandler.js +67 -0
  57. package/lib/mcp/tools/createProductVariationHandler.js.map +1 -0
  58. package/lib/mcp/tools/currenciesHandler.d.ts +60 -0
  59. package/lib/mcp/tools/currenciesHandler.d.ts.map +1 -0
  60. package/lib/mcp/tools/currenciesHandler.js +50 -0
  61. package/lib/mcp/tools/currenciesHandler.js.map +1 -0
  62. package/lib/mcp/tools/currencyHandler.d.ts +20 -0
  63. package/lib/mcp/tools/currencyHandler.d.ts.map +1 -0
  64. package/lib/mcp/tools/currencyHandler.js +34 -0
  65. package/lib/mcp/tools/currencyHandler.js.map +1 -0
  66. package/lib/mcp/tools/getProduct.d.ts +0 -3
  67. package/lib/mcp/tools/getProduct.d.ts.map +1 -1
  68. package/lib/mcp/tools/getProduct.js +0 -324
  69. package/lib/mcp/tools/getProduct.js.map +1 -1
  70. package/lib/mcp/tools/languageHandler.d.ts +20 -0
  71. package/lib/mcp/tools/languageHandler.d.ts.map +1 -0
  72. package/lib/mcp/tools/languageHandler.js +31 -0
  73. package/lib/mcp/tools/languageHandler.js.map +1 -0
  74. package/lib/mcp/tools/languagesHandler.d.ts +60 -0
  75. package/lib/mcp/tools/languagesHandler.d.ts.map +1 -0
  76. package/lib/mcp/tools/languagesHandler.js +42 -0
  77. package/lib/mcp/tools/languagesHandler.js.map +1 -0
  78. package/lib/mcp/tools/listProducts.d.ts.map +1 -1
  79. package/lib/mcp/tools/listProducts.js +0 -13
  80. package/lib/mcp/tools/listProducts.js.map +1 -1
  81. package/lib/mcp/tools/normalizeMediaUrl.d.ts +3 -0
  82. package/lib/mcp/tools/normalizeMediaUrl.d.ts.map +1 -0
  83. package/lib/mcp/tools/normalizeMediaUrl.js +21 -0
  84. package/lib/mcp/tools/normalizeMediaUrl.js.map +1 -0
  85. package/lib/mcp/tools/productsCountHandler.d.ts +32 -0
  86. package/lib/mcp/tools/productsCountHandler.d.ts.map +1 -0
  87. package/lib/mcp/tools/productsCountHandler.js +33 -0
  88. package/lib/mcp/tools/productsCountHandler.js.map +1 -0
  89. package/lib/mcp/tools/publishProduct.d.ts +20 -0
  90. package/lib/mcp/tools/publishProduct.d.ts.map +1 -0
  91. package/lib/mcp/tools/publishProduct.js +40 -0
  92. package/lib/mcp/tools/publishProduct.js.map +1 -0
  93. package/lib/mcp/tools/removeProduct.d.ts +20 -0
  94. package/lib/mcp/tools/removeProduct.d.ts.map +1 -0
  95. package/lib/mcp/tools/removeProduct.js +34 -0
  96. package/lib/mcp/tools/removeProduct.js.map +1 -0
  97. package/lib/mcp/tools/removeProductVariationHandler.d.ts +20 -0
  98. package/lib/mcp/tools/removeProductVariationHandler.d.ts.map +1 -0
  99. package/lib/mcp/tools/removeProductVariationHandler.js +43 -0
  100. package/lib/mcp/tools/removeProductVariationHandler.js.map +1 -0
  101. package/lib/mcp/tools/unPublishProduct.d.ts +20 -0
  102. package/lib/mcp/tools/unPublishProduct.d.ts.map +1 -0
  103. package/lib/mcp/tools/unPublishProduct.js +40 -0
  104. package/lib/mcp/tools/unPublishProduct.js.map +1 -0
  105. package/lib/mcp/tools/updateProduct.d.ts +56 -0
  106. package/lib/mcp/tools/updateProduct.d.ts.map +1 -0
  107. package/lib/mcp/tools/updateProduct.js +44 -0
  108. package/lib/mcp/tools/updateProduct.js.map +1 -0
  109. package/lib/mcp/tools/updateProductCommerceHandler.d.ts +166 -0
  110. package/lib/mcp/tools/updateProductCommerceHandler.d.ts.map +1 -0
  111. package/lib/mcp/tools/updateProductCommerceHandler.js +64 -0
  112. package/lib/mcp/tools/updateProductCommerceHandler.js.map +1 -0
  113. package/lib/mcp/tools/updateProductPlanHandler.d.ts +72 -0
  114. package/lib/mcp/tools/updateProductPlanHandler.d.ts.map +1 -0
  115. package/lib/mcp/tools/updateProductPlanHandler.js +51 -0
  116. package/lib/mcp/tools/updateProductPlanHandler.js.map +1 -0
  117. package/lib/mcp/tools/updateProductSupplyHandler.d.ts +64 -0
  118. package/lib/mcp/tools/updateProductSupplyHandler.d.ts.map +1 -0
  119. package/lib/mcp/tools/updateProductSupplyHandler.js +52 -0
  120. package/lib/mcp/tools/updateProductSupplyHandler.js.map +1 -0
  121. package/lib/mcp/tools/updateProductTextsHandler.d.ts +114 -0
  122. package/lib/mcp/tools/updateProductTextsHandler.d.ts.map +1 -0
  123. package/lib/mcp/tools/updateProductTextsHandler.js +50 -0
  124. package/lib/mcp/tools/updateProductTextsHandler.js.map +1 -0
  125. package/lib/mcp/tools/updateProductTokenizationHandler.d.ts +72 -0
  126. package/lib/mcp/tools/updateProductTokenizationHandler.d.ts.map +1 -0
  127. package/lib/mcp/tools/updateProductTokenizationHandler.js +49 -0
  128. package/lib/mcp/tools/updateProductTokenizationHandler.js.map +1 -0
  129. package/lib/mcp/tools/updateProductWarehousingHandler.d.ts +48 -0
  130. package/lib/mcp/tools/updateProductWarehousingHandler.d.ts.map +1 -0
  131. package/lib/mcp/tools/updateProductWarehousingHandler.js +45 -0
  132. package/lib/mcp/tools/updateProductWarehousingHandler.js.map +1 -0
  133. package/lib/mcp/utils/getNormalizedProductDetails.d.ts +26 -0
  134. package/lib/mcp/utils/getNormalizedProductDetails.d.ts.map +1 -0
  135. package/lib/mcp/utils/getNormalizedProductDetails.js +36 -0
  136. package/lib/mcp/utils/getNormalizedProductDetails.js.map +1 -0
  137. package/lib/mcp/utils/normalizeMediaUrl.d.ts +3 -0
  138. package/lib/mcp/utils/normalizeMediaUrl.d.ts.map +1 -0
  139. package/lib/mcp/utils/normalizeMediaUrl.js +21 -0
  140. package/lib/mcp/utils/normalizeMediaUrl.js.map +1 -0
  141. package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.d.ts +3 -0
  142. package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.d.ts.map +1 -0
  143. package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.js +6 -0
  144. package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.js.map +1 -0
  145. package/lib/resolvers/mutations/accounts/disableTOTP.d.ts +6 -0
  146. package/lib/resolvers/mutations/accounts/disableTOTP.d.ts.map +1 -0
  147. package/lib/resolvers/mutations/accounts/disableTOTP.js +27 -0
  148. package/lib/resolvers/mutations/accounts/disableTOTP.js.map +1 -0
  149. package/lib/resolvers/mutations/accounts/enableTOTP.d.ts +6 -0
  150. package/lib/resolvers/mutations/accounts/enableTOTP.d.ts.map +1 -0
  151. package/lib/resolvers/mutations/accounts/enableTOTP.js +20 -0
  152. package/lib/resolvers/mutations/accounts/enableTOTP.js.map +1 -0
  153. package/lib/resolvers/mutations/accounts/linkOAuthAccount.d.ts +7 -0
  154. package/lib/resolvers/mutations/accounts/linkOAuthAccount.d.ts.map +1 -0
  155. package/lib/resolvers/mutations/accounts/linkOAuthAccount.js +30 -0
  156. package/lib/resolvers/mutations/accounts/linkOAuthAccount.js.map +1 -0
  157. package/lib/resolvers/mutations/accounts/loginWithOAuth.d.ts +8 -0
  158. package/lib/resolvers/mutations/accounts/loginWithOAuth.d.ts.map +1 -0
  159. package/lib/resolvers/mutations/accounts/loginWithOAuth.js +25 -0
  160. package/lib/resolvers/mutations/accounts/loginWithOAuth.js.map +1 -0
  161. package/lib/resolvers/mutations/accounts/logoutAllSessions.d.ts +5 -0
  162. package/lib/resolvers/mutations/accounts/logoutAllSessions.d.ts.map +1 -0
  163. package/lib/resolvers/mutations/accounts/logoutAllSessions.js +20 -0
  164. package/lib/resolvers/mutations/accounts/logoutAllSessions.js.map +1 -0
  165. package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.d.ts +6 -0
  166. package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.d.ts.map +1 -0
  167. package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.js +13 -0
  168. package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.js.map +1 -0
  169. package/lib/resolvers/mutations/assortments/addAssortmentMedia.d.ts +6 -0
  170. package/lib/resolvers/mutations/assortments/addAssortmentMedia.d.ts.map +1 -0
  171. package/lib/resolvers/mutations/assortments/addAssortmentMedia.js +18 -0
  172. package/lib/resolvers/mutations/assortments/addAssortmentMedia.js.map +1 -0
  173. package/lib/resolvers/mutations/products/addProductAssignment.d.ts.map +1 -1
  174. package/lib/resolvers/mutations/products/addProductAssignment.js +3 -1
  175. package/lib/resolvers/mutations/products/addProductAssignment.js.map +1 -1
  176. package/lib/resolvers/mutations/products/addProductMedia.d.ts +6 -0
  177. package/lib/resolvers/mutations/products/addProductMedia.d.ts.map +1 -0
  178. package/lib/resolvers/mutations/products/addProductMedia.js +18 -0
  179. package/lib/resolvers/mutations/products/addProductMedia.js.map +1 -0
  180. package/lib/resolvers/mutations/users/updateUserAvatar.d.ts +6 -0
  181. package/lib/resolvers/mutations/users/updateUserAvatar.d.ts.map +1 -0
  182. package/lib/resolvers/mutations/users/updateUserAvatar.js +22 -0
  183. package/lib/resolvers/mutations/users/updateUserAvatar.js.map +1 -0
  184. package/lib/resolvers/mutations/utils/getOrderCart.d.ts +7 -0
  185. package/lib/resolvers/mutations/utils/getOrderCart.d.ts.map +1 -0
  186. package/lib/resolvers/mutations/utils/getOrderCart.js +13 -0
  187. package/lib/resolvers/mutations/utils/getOrderCart.js.map +1 -0
  188. package/lib/resolvers/type/dispatch-types.d.ts +15 -0
  189. package/lib/resolvers/type/dispatch-types.d.ts.map +1 -0
  190. package/lib/resolvers/type/dispatch-types.js +16 -0
  191. package/lib/resolvers/type/dispatch-types.js.map +1 -0
  192. package/lib/resolvers/type/oauth-account.d.ts +6 -0
  193. package/lib/resolvers/type/oauth-account.d.ts.map +1 -0
  194. package/lib/resolvers/type/oauth-account.js +7 -0
  195. package/lib/resolvers/type/oauth-account.js.map +1 -0
  196. package/lib/resolvers/type/oauth-provider.d.ts +6 -0
  197. package/lib/resolvers/type/oauth-provider.d.ts.map +1 -0
  198. package/lib/resolvers/type/oauth-provider.js +6 -0
  199. package/lib/resolvers/type/oauth-provider.js.map +1 -0
  200. package/lib/resolvers/type/stock-types.d.ts +14 -0
  201. package/lib/resolvers/type/stock-types.d.ts.map +1 -0
  202. package/lib/resolvers/type/stock-types.js +15 -0
  203. package/lib/resolvers/type/stock-types.js.map +1 -0
  204. package/lib/user-context.d.ts +7 -0
  205. package/lib/user-context.d.ts.map +1 -0
  206. package/lib/user-context.js +76 -0
  207. package/lib/user-context.js.map +1 -0
  208. package/package.json +13 -13
  209. package/src/errors.ts +5 -0
  210. package/src/loaders/buildLocaleMap.test.ts +14 -25
  211. package/src/loaders/buildLocaleMap.ts +1 -1
  212. package/src/loaders/buildTextMap.test.ts +9 -10
  213. package/src/loaders/index.ts +0 -1
  214. package/src/resolvers/mutations/products/addProductAssignment.ts +8 -1
  215. package/lib/express/mcpHandler.d.ts.map +0 -1
  216. package/lib/express/mcpHandler.js +0 -68
  217. package/lib/express/mcpHandler.js.map +0 -1
  218. package/lib/fastify/createMCPMiddleware.d.ts +0 -2
  219. package/lib/fastify/createMCPMiddleware.d.ts.map +0 -1
  220. package/lib/fastify/createMCPMiddleware.js +0 -2
  221. package/lib/fastify/createMCPMiddleware.js.map +0 -1
  222. package/lib/fastify/index copy.d.ts.map +0 -1
  223. package/lib/fastify/index copy.js +0 -157
  224. package/lib/fastify/index copy.js.map +0 -1
  225. package/lib/fastify/mcpHandler.d.ts +0 -8
  226. package/lib/fastify/mcpHandler.d.ts.map +0 -1
  227. package/lib/fastify/mcpHandler.js +0 -46
  228. package/lib/fastify/mcpHandler.js.map +0 -1
  229. package/lib/mcp/server.d.ts +0 -4
  230. package/lib/mcp/server.d.ts.map +0 -1
  231. package/lib/mcp/server.js +0 -60
  232. package/lib/mcp/server.js.map +0 -1
  233. package/lib/mcp/types.d.ts +0 -27
  234. package/lib/mcp/types.d.ts.map +0 -1
  235. package/lib/mcp/types.js +0 -5
  236. package/lib/mcp/types.js.map +0 -1
  237. package/lib/mcp/utils/html.d.ts +0 -16
  238. package/lib/mcp/utils/html.d.ts.map +0 -1
  239. package/lib/mcp/utils/html.js +0 -102
  240. package/lib/mcp/utils/html.js.map +0 -1
  241. package/lib/middleware/accountLockout.d.ts.map +0 -1
  242. package/lib/middleware/accountLockout.js +0 -84
  243. package/lib/middleware/accountLockout.js.map +0 -1
  244. package/lib/middleware/rateLimiter.d.ts.map +0 -1
  245. package/lib/middleware/rateLimiter.js +0 -91
  246. package/lib/middleware/rateLimiter.js.map +0 -1
  247. package/lib/plugins/inputValidation.d.ts.map +0 -1
  248. package/lib/plugins/inputValidation.js +0 -95
  249. package/lib/plugins/inputValidation.js.map +0 -1
  250. package/lib/utils/inputValidation.d.ts.map +0 -1
  251. package/lib/utils/inputValidation.js +0 -51
  252. package/lib/utils/inputValidation.js.map +0 -1
@@ -0,0 +1,44 @@
1
+ import { z } from 'zod';
2
+ import { ProductNotFoundError } from '../../errors.js';
3
+ import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
4
+ export const UpdateProductSchema = {
5
+ productId: z.string().min(1).describe('ID of the product to update'),
6
+ product: z
7
+ .object({
8
+ tags: z.array(z.string().min(1).toLowerCase()).optional().describe('List of lowercase tags'),
9
+ sequence: z.number().int().optional().describe('Sorting sequence'),
10
+ meta: z.record(z.unknown()).optional().describe('Custom metadata as key-value pairs'),
11
+ })
12
+ .describe('Fields to update on the product'),
13
+ };
14
+ export const UpdateProductZodSchema = z.object(UpdateProductSchema);
15
+ export async function updateProductHandler(context, params) {
16
+ const { productId, product } = params;
17
+ const { modules } = context;
18
+ try {
19
+ if (!(await modules.products.productExists({ productId })))
20
+ throw new ProductNotFoundError({ productId });
21
+ await modules.products.update(productId, product);
22
+ return {
23
+ content: [
24
+ {
25
+ type: 'text',
26
+ text: JSON.stringify({
27
+ product: await getNormalizedProductDetails(productId, context),
28
+ }),
29
+ },
30
+ ],
31
+ };
32
+ }
33
+ catch (error) {
34
+ return {
35
+ content: [
36
+ {
37
+ type: 'text',
38
+ text: `Error updating product: ${error.message}`,
39
+ },
40
+ ],
41
+ };
42
+ }
43
+ }
44
+ //# sourceMappingURL=updateProduct.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateProduct.js","sourceRoot":"","sources":["../../../src/mcp/tools/updateProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,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;IACpE,OAAO,EAAE,CAAC;SACP,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAC5F,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAClE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;KACtF,CAAC;SACD,QAAQ,CAAC,iCAAiC,CAAC;CAC/C,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,OAAO,EAAE,GAAG,MAAM,CAAC;IACtC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,CAAC;QACH,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;YACxD,MAAM,IAAI,oBAAoB,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QAEhD,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAElD,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,166 @@
1
+ import { z } from 'zod';
2
+ import { Context } from '../../context.js';
3
+ export declare const UpdateProductCommerceSchema: {
4
+ productId: z.ZodString;
5
+ commerce: z.ZodObject<{
6
+ pricing: z.ZodArray<z.ZodObject<{
7
+ amount: z.ZodNumber;
8
+ maxQuantity: z.ZodOptional<z.ZodNumber>;
9
+ isTaxable: z.ZodOptional<z.ZodBoolean>;
10
+ isNetPrice: z.ZodOptional<z.ZodBoolean>;
11
+ currencyCode: z.ZodString;
12
+ countryCode: z.ZodString;
13
+ }, "strip", z.ZodTypeAny, {
14
+ countryCode?: string;
15
+ currencyCode?: string;
16
+ isNetPrice?: boolean;
17
+ isTaxable?: boolean;
18
+ amount?: number;
19
+ maxQuantity?: number;
20
+ }, {
21
+ countryCode?: string;
22
+ currencyCode?: string;
23
+ isNetPrice?: boolean;
24
+ isTaxable?: boolean;
25
+ amount?: number;
26
+ maxQuantity?: number;
27
+ }>, "atleastone">;
28
+ }, "strip", z.ZodTypeAny, {
29
+ pricing?: [{
30
+ countryCode?: string;
31
+ currencyCode?: string;
32
+ isNetPrice?: boolean;
33
+ isTaxable?: boolean;
34
+ amount?: number;
35
+ maxQuantity?: number;
36
+ }, ...{
37
+ countryCode?: string;
38
+ currencyCode?: string;
39
+ isNetPrice?: boolean;
40
+ isTaxable?: boolean;
41
+ amount?: number;
42
+ maxQuantity?: number;
43
+ }[]];
44
+ }, {
45
+ pricing?: [{
46
+ countryCode?: string;
47
+ currencyCode?: string;
48
+ isNetPrice?: boolean;
49
+ isTaxable?: boolean;
50
+ amount?: number;
51
+ maxQuantity?: number;
52
+ }, ...{
53
+ countryCode?: string;
54
+ currencyCode?: string;
55
+ isNetPrice?: boolean;
56
+ isTaxable?: boolean;
57
+ amount?: number;
58
+ maxQuantity?: number;
59
+ }[]];
60
+ }>;
61
+ };
62
+ export declare const UpdateProductCommerceZodSchema: z.ZodObject<{
63
+ productId: z.ZodString;
64
+ commerce: z.ZodObject<{
65
+ pricing: z.ZodArray<z.ZodObject<{
66
+ amount: z.ZodNumber;
67
+ maxQuantity: z.ZodOptional<z.ZodNumber>;
68
+ isTaxable: z.ZodOptional<z.ZodBoolean>;
69
+ isNetPrice: z.ZodOptional<z.ZodBoolean>;
70
+ currencyCode: z.ZodString;
71
+ countryCode: z.ZodString;
72
+ }, "strip", z.ZodTypeAny, {
73
+ countryCode?: string;
74
+ currencyCode?: string;
75
+ isNetPrice?: boolean;
76
+ isTaxable?: boolean;
77
+ amount?: number;
78
+ maxQuantity?: number;
79
+ }, {
80
+ countryCode?: string;
81
+ currencyCode?: string;
82
+ isNetPrice?: boolean;
83
+ isTaxable?: boolean;
84
+ amount?: number;
85
+ maxQuantity?: number;
86
+ }>, "atleastone">;
87
+ }, "strip", z.ZodTypeAny, {
88
+ pricing?: [{
89
+ countryCode?: string;
90
+ currencyCode?: string;
91
+ isNetPrice?: boolean;
92
+ isTaxable?: boolean;
93
+ amount?: number;
94
+ maxQuantity?: number;
95
+ }, ...{
96
+ countryCode?: string;
97
+ currencyCode?: string;
98
+ isNetPrice?: boolean;
99
+ isTaxable?: boolean;
100
+ amount?: number;
101
+ maxQuantity?: number;
102
+ }[]];
103
+ }, {
104
+ pricing?: [{
105
+ countryCode?: string;
106
+ currencyCode?: string;
107
+ isNetPrice?: boolean;
108
+ isTaxable?: boolean;
109
+ amount?: number;
110
+ maxQuantity?: number;
111
+ }, ...{
112
+ countryCode?: string;
113
+ currencyCode?: string;
114
+ isNetPrice?: boolean;
115
+ isTaxable?: boolean;
116
+ amount?: number;
117
+ maxQuantity?: number;
118
+ }[]];
119
+ }>;
120
+ }, "strip", z.ZodTypeAny, {
121
+ productId?: string;
122
+ commerce?: {
123
+ pricing?: [{
124
+ countryCode?: string;
125
+ currencyCode?: string;
126
+ isNetPrice?: boolean;
127
+ isTaxable?: boolean;
128
+ amount?: number;
129
+ maxQuantity?: number;
130
+ }, ...{
131
+ countryCode?: string;
132
+ currencyCode?: string;
133
+ isNetPrice?: boolean;
134
+ isTaxable?: boolean;
135
+ amount?: number;
136
+ maxQuantity?: number;
137
+ }[]];
138
+ };
139
+ }, {
140
+ productId?: string;
141
+ commerce?: {
142
+ pricing?: [{
143
+ countryCode?: string;
144
+ currencyCode?: string;
145
+ isNetPrice?: boolean;
146
+ isTaxable?: boolean;
147
+ amount?: number;
148
+ maxQuantity?: number;
149
+ }, ...{
150
+ countryCode?: string;
151
+ currencyCode?: string;
152
+ isNetPrice?: boolean;
153
+ isTaxable?: boolean;
154
+ amount?: number;
155
+ maxQuantity?: number;
156
+ }[]];
157
+ };
158
+ }>;
159
+ export type UpdateProductCommerceParams = z.infer<typeof UpdateProductCommerceZodSchema>;
160
+ export declare function updateProductCommerceHandler(context: Context, params: UpdateProductCommerceParams): Promise<{
161
+ content: {
162
+ type: "text";
163
+ text: string;
164
+ }[];
165
+ }>;
166
+ //# sourceMappingURL=updateProductCommerceHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateProductCommerceHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductCommerceHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCvC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAwC,CAAC;AAEpF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEzF,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,2BAA2B;;;;;GA4BpC"}
@@ -0,0 +1,64 @@
1
+ import { z } from 'zod';
2
+ import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
3
+ export const UpdateProductCommerceSchema = {
4
+ productId: z
5
+ .string()
6
+ .min(1)
7
+ .describe('ID of the product of all type except for CONFIGURABLE_PRODUCT to update commerce info'),
8
+ commerce: z
9
+ .object({
10
+ pricing: z
11
+ .array(z.object({
12
+ amount: z.number().int().describe('Price amount in smallest currency unit (e.g., cents)'),
13
+ maxQuantity: z
14
+ .number()
15
+ .int()
16
+ .optional()
17
+ .describe('Optional maximum quantity for this price tier'),
18
+ isTaxable: z.boolean().optional().describe('Whether tax applies to this price'),
19
+ isNetPrice: z.boolean().optional().describe('Whether this is a net price (without tax)'),
20
+ currencyCode: z
21
+ .string()
22
+ .min(3)
23
+ .max(3)
24
+ .describe('ISO currency code (e.g., USD, EUR) always use values registered in the system and if explicitly provided check if it exists'),
25
+ countryCode: z
26
+ .string()
27
+ .min(2)
28
+ .max(2)
29
+ .describe('ISO country code (e.g., US, DE) always use values registered in the system and if explicitly provided check if it exists'),
30
+ }))
31
+ .nonempty()
32
+ .describe('List of price configurations'),
33
+ })
34
+ .describe('Commerce info to update'),
35
+ };
36
+ export const UpdateProductCommerceZodSchema = z.object(UpdateProductCommerceSchema);
37
+ export async function updateProductCommerceHandler(context, params) {
38
+ const { productId, commerce } = params;
39
+ const { modules } = context;
40
+ try {
41
+ await modules.products.update(productId, { commerce });
42
+ return {
43
+ content: [
44
+ {
45
+ type: 'text',
46
+ text: JSON.stringify({
47
+ product: await getNormalizedProductDetails(productId, context),
48
+ }),
49
+ },
50
+ ],
51
+ };
52
+ }
53
+ catch (error) {
54
+ return {
55
+ content: [
56
+ {
57
+ type: 'text',
58
+ text: `Error updating product commerce info: ${error.message}`,
59
+ },
60
+ ],
61
+ };
62
+ }
63
+ }
64
+ //# sourceMappingURL=updateProductCommerceHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateProductCommerceHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductCommerceHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,uFAAuF,CAAC;IACpG,QAAQ,EAAE,CAAC;SACR,MAAM,CAAC;QACN,OAAO,EAAE,CAAC;aACP,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;YACP,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;YACzF,WAAW,EAAE,CAAC;iBACX,MAAM,EAAE;iBACR,GAAG,EAAE;iBACL,QAAQ,EAAE;iBACV,QAAQ,CAAC,+CAA+C,CAAC;YAC5D,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;YAC/E,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;YACxF,YAAY,EAAE,CAAC;iBACZ,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CACP,6HAA6H,CAC9H;YACH,WAAW,EAAE,CAAC;iBACX,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CACP,0HAA0H,CAC3H;SACJ,CAAC,CACH;aACA,QAAQ,EAAE;aACV,QAAQ,CAAC,8BAA8B,CAAC;KAC5C,CAAC;SACD,QAAQ,CAAC,yBAAyB,CAAC;CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAIpF,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,OAAgB,EAChB,MAAmC;IAEnC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IACvC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEvD,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,yCAA0C,KAAe,CAAC,OAAO,EAAE;iBAC1E;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { z } from 'zod';
2
+ import { Context } from '../../context.js';
3
+ export declare const UpdateProductPlanSchema: {
4
+ productId: z.ZodString;
5
+ plan: z.ZodObject<{
6
+ usageCalculationType: z.ZodString;
7
+ billingInterval: z.ZodString;
8
+ billingIntervalCount: z.ZodOptional<z.ZodNumber>;
9
+ trialInterval: z.ZodOptional<z.ZodString>;
10
+ trialIntervalCount: z.ZodOptional<z.ZodNumber>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ usageCalculationType?: string;
13
+ billingInterval?: string;
14
+ billingIntervalCount?: number;
15
+ trialInterval?: string;
16
+ trialIntervalCount?: number;
17
+ }, {
18
+ usageCalculationType?: string;
19
+ billingInterval?: string;
20
+ billingIntervalCount?: number;
21
+ trialInterval?: string;
22
+ trialIntervalCount?: number;
23
+ }>;
24
+ };
25
+ export declare const UpdateProductPlanZodSchema: z.ZodObject<{
26
+ productId: z.ZodString;
27
+ plan: z.ZodObject<{
28
+ usageCalculationType: z.ZodString;
29
+ billingInterval: z.ZodString;
30
+ billingIntervalCount: z.ZodOptional<z.ZodNumber>;
31
+ trialInterval: z.ZodOptional<z.ZodString>;
32
+ trialIntervalCount: z.ZodOptional<z.ZodNumber>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ usageCalculationType?: string;
35
+ billingInterval?: string;
36
+ billingIntervalCount?: number;
37
+ trialInterval?: string;
38
+ trialIntervalCount?: number;
39
+ }, {
40
+ usageCalculationType?: string;
41
+ billingInterval?: string;
42
+ billingIntervalCount?: number;
43
+ trialInterval?: string;
44
+ trialIntervalCount?: number;
45
+ }>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ productId?: string;
48
+ plan?: {
49
+ usageCalculationType?: string;
50
+ billingInterval?: string;
51
+ billingIntervalCount?: number;
52
+ trialInterval?: string;
53
+ trialIntervalCount?: number;
54
+ };
55
+ }, {
56
+ productId?: string;
57
+ plan?: {
58
+ usageCalculationType?: string;
59
+ billingInterval?: string;
60
+ billingIntervalCount?: number;
61
+ trialInterval?: string;
62
+ trialIntervalCount?: number;
63
+ };
64
+ }>;
65
+ export type UpdateProductPlanParams = z.infer<typeof UpdateProductPlanZodSchema>;
66
+ export declare function updateProductPlanHandler(context: Context, params: UpdateProductPlanParams): Promise<{
67
+ content: {
68
+ type: "text";
69
+ text: string;
70
+ }[];
71
+ }>;
72
+ //# sourceMappingURL=updateProductPlanHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateProductPlanHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductPlanHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAK3C,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;CASnC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAoC,CAAC;AAE5E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEjF,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,uBAAuB;;;;;GAoC/F"}
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+ import { ProductNotFoundError, ProductWrongStatusError } from '../../errors.js';
3
+ import { ProductTypes } from '@unchainedshop/core-products';
4
+ import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
5
+ export const UpdateProductPlanSchema = {
6
+ productId: z.string().min(1).describe('ID of the product of type PLAN_PRODUCT to update only'),
7
+ plan: z.object({
8
+ usageCalculationType: z.string(),
9
+ billingInterval: z.string(),
10
+ billingIntervalCount: z.number().int().positive().optional(),
11
+ trialInterval: z.string().optional(),
12
+ trialIntervalCount: z.number().int().positive().optional(),
13
+ }),
14
+ };
15
+ export const UpdateProductPlanZodSchema = z.object(UpdateProductPlanSchema);
16
+ export async function updateProductPlanHandler(context, params) {
17
+ const { productId, plan } = params;
18
+ const { modules } = context;
19
+ try {
20
+ const product = await modules.products.findProduct({ productId });
21
+ if (!product)
22
+ throw new ProductNotFoundError({ productId });
23
+ if (product?.type !== ProductTypes.PlanProduct)
24
+ throw new ProductWrongStatusError({
25
+ received: product?.type,
26
+ required: ProductTypes.PlanProduct,
27
+ });
28
+ await modules.products.update(productId, { plan });
29
+ return {
30
+ content: [
31
+ {
32
+ type: 'text',
33
+ text: JSON.stringify({
34
+ product: await getNormalizedProductDetails(productId, context),
35
+ }),
36
+ },
37
+ ],
38
+ };
39
+ }
40
+ catch (error) {
41
+ return {
42
+ content: [
43
+ {
44
+ type: 'text',
45
+ text: `Error updating product plan: ${error.message}`,
46
+ },
47
+ ],
48
+ };
49
+ }
50
+ }
51
+ //# sourceMappingURL=updateProductPlanHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateProductPlanHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductPlanHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uDAAuD,CAAC;IAC9F,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE;QAChC,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;QAC3B,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC5D,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACpC,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;KAC3D,CAAC;CACH,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAI5E,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,OAAgB,EAAE,MAA+B;IAC9F,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACnC,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,OAAO,EAAE,IAAI,KAAK,YAAY,CAAC,WAAW;YAC5C,MAAM,IAAI,uBAAuB,CAAC;gBAChC,QAAQ,EAAE,OAAO,EAAE,IAAI;gBACvB,QAAQ,EAAE,YAAY,CAAC,WAAW;aACnC,CAAC,CAAC;QAEL,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAEnD,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,gCAAiC,KAAe,CAAC,OAAO,EAAE;iBACjE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { z } from 'zod';
2
+ import { Context } from '../../context.js';
3
+ export declare const UpdateProductSupplySchema: {
4
+ productId: z.ZodString;
5
+ supply: z.ZodObject<{
6
+ weightInGram: z.ZodOptional<z.ZodNumber>;
7
+ heightInMillimeters: z.ZodOptional<z.ZodNumber>;
8
+ lengthInMillimeters: z.ZodOptional<z.ZodNumber>;
9
+ widthInMillimeters: z.ZodOptional<z.ZodNumber>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ weightInGram?: number;
12
+ lengthInMillimeters?: number;
13
+ widthInMillimeters?: number;
14
+ heightInMillimeters?: number;
15
+ }, {
16
+ weightInGram?: number;
17
+ lengthInMillimeters?: number;
18
+ widthInMillimeters?: number;
19
+ heightInMillimeters?: number;
20
+ }>;
21
+ };
22
+ export declare const UpdateProductSupplyZodSchema: z.ZodObject<{
23
+ productId: z.ZodString;
24
+ supply: z.ZodObject<{
25
+ weightInGram: z.ZodOptional<z.ZodNumber>;
26
+ heightInMillimeters: z.ZodOptional<z.ZodNumber>;
27
+ lengthInMillimeters: z.ZodOptional<z.ZodNumber>;
28
+ widthInMillimeters: z.ZodOptional<z.ZodNumber>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ weightInGram?: number;
31
+ lengthInMillimeters?: number;
32
+ widthInMillimeters?: number;
33
+ heightInMillimeters?: number;
34
+ }, {
35
+ weightInGram?: number;
36
+ lengthInMillimeters?: number;
37
+ widthInMillimeters?: number;
38
+ heightInMillimeters?: number;
39
+ }>;
40
+ }, "strip", z.ZodTypeAny, {
41
+ productId?: string;
42
+ supply?: {
43
+ weightInGram?: number;
44
+ lengthInMillimeters?: number;
45
+ widthInMillimeters?: number;
46
+ heightInMillimeters?: number;
47
+ };
48
+ }, {
49
+ productId?: string;
50
+ supply?: {
51
+ weightInGram?: number;
52
+ lengthInMillimeters?: number;
53
+ widthInMillimeters?: number;
54
+ heightInMillimeters?: number;
55
+ };
56
+ }>;
57
+ export type UpdateProductSupplyParams = z.infer<typeof UpdateProductSupplyZodSchema>;
58
+ export declare function updateProductSupplyHandler(context: Context, params: UpdateProductSupplyParams): Promise<{
59
+ content: {
60
+ type: "text";
61
+ text: string;
62
+ }[];
63
+ }>;
64
+ //# sourceMappingURL=updateProductSupplyHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateProductSupplyHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductSupplyHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAK3C,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;CAarC,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;;;;;GAiCnG"}
@@ -0,0 +1,52 @@
1
+ import { z } from 'zod';
2
+ import { ProductWrongTypeError } from '../../errors.js';
3
+ import { ProductTypes } from '@unchainedshop/core-products';
4
+ import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
5
+ export const UpdateProductSupplySchema = {
6
+ productId: z
7
+ .string()
8
+ .min(1)
9
+ .describe('Product ID of a SIMPLE_PRODUCT only to update supply details for'),
10
+ supply: z
11
+ .object({
12
+ weightInGram: z.number().int().positive().optional(),
13
+ heightInMillimeters: z.number().int().positive().optional(),
14
+ lengthInMillimeters: z.number().int().positive().optional(),
15
+ widthInMillimeters: z.number().int().positive().optional(),
16
+ })
17
+ .describe('Supply (delivery) attributes of the product'),
18
+ };
19
+ export const UpdateProductSupplyZodSchema = z.object(UpdateProductSupplySchema);
20
+ export async function updateProductSupplyHandler(context, params) {
21
+ const { productId, supply } = params;
22
+ const { modules } = context;
23
+ try {
24
+ const product = await modules.products.findProduct({ productId });
25
+ if (product?.type !== ProductTypes.SimpleProduct)
26
+ throw new ProductWrongTypeError({
27
+ productId,
28
+ received: product?.type,
29
+ required: ProductTypes.SimpleProduct,
30
+ });
31
+ await modules.products.update(productId, { supply });
32
+ return {
33
+ content: [
34
+ {
35
+ type: 'text',
36
+ text: JSON.stringify({ product: await getNormalizedProductDetails(productId, context) }),
37
+ },
38
+ ],
39
+ };
40
+ }
41
+ catch (error) {
42
+ return {
43
+ content: [
44
+ {
45
+ type: 'text',
46
+ text: `Error updating product supply: ${error.message}`,
47
+ },
48
+ ],
49
+ };
50
+ }
51
+ }
52
+ //# sourceMappingURL=updateProductSupplyHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateProductSupplyHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductSupplyHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,kEAAkE,CAAC;IAC/E,MAAM,EAAE,CAAC;SACN,MAAM,CAAC;QACN,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QACpD,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC3D,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC3D,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;KAC3D,CAAC;SACD,QAAQ,CAAC,6CAA6C,CAAC;CAC3D,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,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IACrC,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,OAAO,EAAE,IAAI,KAAK,YAAY,CAAC,aAAa;YAC9C,MAAM,IAAI,qBAAqB,CAAC;gBAC9B,SAAS;gBACT,QAAQ,EAAE,OAAO,EAAE,IAAI;gBACvB,QAAQ,EAAE,YAAY,CAAC,aAAa;aACrC,CAAC,CAAC;QAEL,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAErD,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC;iBACzF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,kCAAmC,KAAe,CAAC,OAAO,EAAE;iBACnE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,114 @@
1
+ import { z } from 'zod';
2
+ import { Context } from '../../context.js';
3
+ export declare const UpdateProductTextsSchema: {
4
+ productId: z.ZodString;
5
+ texts: z.ZodArray<z.ZodObject<{
6
+ locale: z.ZodString;
7
+ slug: z.ZodOptional<z.ZodString>;
8
+ title: z.ZodOptional<z.ZodString>;
9
+ subtitle: z.ZodOptional<z.ZodString>;
10
+ description: z.ZodOptional<z.ZodString>;
11
+ vendor: z.ZodOptional<z.ZodString>;
12
+ brand: z.ZodOptional<z.ZodString>;
13
+ labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
14
+ }, "strip", z.ZodTypeAny, {
15
+ description?: string;
16
+ locale?: string;
17
+ title?: string;
18
+ subtitle?: string;
19
+ slug?: string;
20
+ brand?: string;
21
+ vendor?: string;
22
+ labels?: string[];
23
+ }, {
24
+ description?: string;
25
+ locale?: string;
26
+ title?: string;
27
+ subtitle?: string;
28
+ slug?: string;
29
+ brand?: string;
30
+ vendor?: string;
31
+ labels?: string[];
32
+ }>, "atleastone">;
33
+ };
34
+ export declare const UpdateProductTextsZodSchema: z.ZodObject<{
35
+ productId: z.ZodString;
36
+ texts: z.ZodArray<z.ZodObject<{
37
+ locale: z.ZodString;
38
+ slug: z.ZodOptional<z.ZodString>;
39
+ title: z.ZodOptional<z.ZodString>;
40
+ subtitle: z.ZodOptional<z.ZodString>;
41
+ description: z.ZodOptional<z.ZodString>;
42
+ vendor: z.ZodOptional<z.ZodString>;
43
+ brand: z.ZodOptional<z.ZodString>;
44
+ labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
45
+ }, "strip", z.ZodTypeAny, {
46
+ description?: string;
47
+ locale?: string;
48
+ title?: string;
49
+ subtitle?: string;
50
+ slug?: string;
51
+ brand?: string;
52
+ vendor?: string;
53
+ labels?: string[];
54
+ }, {
55
+ description?: string;
56
+ locale?: string;
57
+ title?: string;
58
+ subtitle?: string;
59
+ slug?: string;
60
+ brand?: string;
61
+ vendor?: string;
62
+ labels?: string[];
63
+ }>, "atleastone">;
64
+ }, "strip", z.ZodTypeAny, {
65
+ productId?: string;
66
+ texts?: [{
67
+ description?: string;
68
+ locale?: string;
69
+ title?: string;
70
+ subtitle?: string;
71
+ slug?: string;
72
+ brand?: string;
73
+ vendor?: string;
74
+ labels?: string[];
75
+ }, ...{
76
+ description?: string;
77
+ locale?: string;
78
+ title?: string;
79
+ subtitle?: string;
80
+ slug?: string;
81
+ brand?: string;
82
+ vendor?: string;
83
+ labels?: string[];
84
+ }[]];
85
+ }, {
86
+ productId?: string;
87
+ texts?: [{
88
+ description?: string;
89
+ locale?: string;
90
+ title?: string;
91
+ subtitle?: string;
92
+ slug?: string;
93
+ brand?: string;
94
+ vendor?: string;
95
+ labels?: string[];
96
+ }, ...{
97
+ description?: string;
98
+ locale?: string;
99
+ title?: string;
100
+ subtitle?: string;
101
+ slug?: string;
102
+ brand?: string;
103
+ vendor?: string;
104
+ labels?: string[];
105
+ }[]];
106
+ }>;
107
+ export type UpdateProductTextsParams = z.infer<typeof UpdateProductTextsZodSchema>;
108
+ export declare function updateProductTextsHandler(context: Context, params: UpdateProductTextsParams): Promise<{
109
+ content: {
110
+ type: "text";
111
+ text: string;
112
+ }[];
113
+ }>;
114
+ //# sourceMappingURL=updateProductTextsHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateProductTextsHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductTextsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsBpC,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;;;;;GA0BjG"}