@vendure/mcp-plugin 3.8.0-minor-bootstrap.0

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 (389) hide show
  1. package/lib/api/api-extensions.d.ts +2 -0
  2. package/lib/api/api-extensions.js +239 -0
  3. package/lib/api/api-extensions.js.map +1 -0
  4. package/lib/api/mcp-actor.service.d.ts +19 -0
  5. package/lib/api/mcp-actor.service.js +52 -0
  6. package/lib/api/mcp-actor.service.js.map +1 -0
  7. package/lib/api/mcp-admin.resolver.d.ts +105 -0
  8. package/lib/api/mcp-admin.resolver.js +463 -0
  9. package/lib/api/mcp-admin.resolver.js.map +1 -0
  10. package/lib/api/mcp-shop.resolver.d.ts +25 -0
  11. package/lib/api/mcp-shop.resolver.js +74 -0
  12. package/lib/api/mcp-shop.resolver.js.map +1 -0
  13. package/lib/check-options.d.ts +7 -0
  14. package/lib/check-options.js +130 -0
  15. package/lib/check-options.js.map +1 -0
  16. package/lib/constants.d.ts +48 -0
  17. package/lib/constants.js +72 -0
  18. package/lib/constants.js.map +1 -0
  19. package/lib/delete-in-batches.d.ts +5 -0
  20. package/lib/delete-in-batches.js +28 -0
  21. package/lib/delete-in-batches.js.map +1 -0
  22. package/lib/entities/index.d.ts +5 -0
  23. package/lib/entities/index.js +22 -0
  24. package/lib/entities/index.js.map +1 -0
  25. package/lib/entities/mcp-authorization-code.entity.d.ts +33 -0
  26. package/lib/entities/mcp-authorization-code.entity.js +77 -0
  27. package/lib/entities/mcp-authorization-code.entity.js.map +1 -0
  28. package/lib/entities/mcp-authorization-request.entity.d.ts +31 -0
  29. package/lib/entities/mcp-authorization-request.entity.js +73 -0
  30. package/lib/entities/mcp-authorization-request.entity.js.map +1 -0
  31. package/lib/entities/mcp-oauth-client.entity.d.ts +56 -0
  32. package/lib/entities/mcp-oauth-client.entity.js +70 -0
  33. package/lib/entities/mcp-oauth-client.entity.js.map +1 -0
  34. package/lib/entities/mcp-oauth-grant.entity.d.ts +77 -0
  35. package/lib/entities/mcp-oauth-grant.entity.js +121 -0
  36. package/lib/entities/mcp-oauth-grant.entity.js.map +1 -0
  37. package/lib/entities/mcp-tool-call-log.entity.d.ts +50 -0
  38. package/lib/entities/mcp-tool-call-log.entity.js +101 -0
  39. package/lib/entities/mcp-tool-call-log.entity.js.map +1 -0
  40. package/lib/events/mcp-tool-call.event.d.ts +17 -0
  41. package/lib/events/mcp-tool-call.event.js +23 -0
  42. package/lib/events/mcp-tool-call.event.js.map +1 -0
  43. package/lib/get-client-ip.d.ts +2 -0
  44. package/lib/get-client-ip.js +10 -0
  45. package/lib/get-client-ip.js.map +1 -0
  46. package/lib/get-language-code.d.ts +3 -0
  47. package/lib/get-language-code.js +12 -0
  48. package/lib/get-language-code.js.map +1 -0
  49. package/lib/index.d.ts +6 -0
  50. package/lib/index.js +26 -0
  51. package/lib/index.js.map +1 -0
  52. package/lib/internal-types.d.ts +27 -0
  53. package/lib/internal-types.js +3 -0
  54. package/lib/internal-types.js.map +1 -0
  55. package/lib/logging/mcp-tool-call-log-retention.service.d.ts +8 -0
  56. package/lib/logging/mcp-tool-call-log-retention.service.js +54 -0
  57. package/lib/logging/mcp-tool-call-log-retention.service.js.map +1 -0
  58. package/lib/logging/mcp-tool-call-log.service.d.ts +24 -0
  59. package/lib/logging/mcp-tool-call-log.service.js +128 -0
  60. package/lib/logging/mcp-tool-call-log.service.js.map +1 -0
  61. package/lib/oauth/cimd/cimd-client-resolver.service.d.ts +18 -0
  62. package/lib/oauth/cimd/cimd-client-resolver.service.js +109 -0
  63. package/lib/oauth/cimd/cimd-client-resolver.service.js.map +1 -0
  64. package/lib/oauth/cimd/cimd-document.d.ts +11 -0
  65. package/lib/oauth/cimd/cimd-document.js +66 -0
  66. package/lib/oauth/cimd/cimd-document.js.map +1 -0
  67. package/lib/oauth/cimd/cimd-fetch.d.ts +14 -0
  68. package/lib/oauth/cimd/cimd-fetch.js +192 -0
  69. package/lib/oauth/cimd/cimd-fetch.js.map +1 -0
  70. package/lib/oauth/cimd/cimd-url.d.ts +5 -0
  71. package/lib/oauth/cimd/cimd-url.js +94 -0
  72. package/lib/oauth/cimd/cimd-url.js.map +1 -0
  73. package/lib/oauth/grant-session.service.d.ts +19 -0
  74. package/lib/oauth/grant-session.service.js +141 -0
  75. package/lib/oauth/grant-session.service.js.map +1 -0
  76. package/lib/oauth/oauth-error.d.ts +18 -0
  77. package/lib/oauth/oauth-error.js +60 -0
  78. package/lib/oauth/oauth-error.js.map +1 -0
  79. package/lib/oauth/oauth-metadata.service.d.ts +34 -0
  80. package/lib/oauth/oauth-metadata.service.js +107 -0
  81. package/lib/oauth/oauth-metadata.service.js.map +1 -0
  82. package/lib/oauth/oauth-retention.service.d.ts +23 -0
  83. package/lib/oauth/oauth-retention.service.js +103 -0
  84. package/lib/oauth/oauth-retention.service.js.map +1 -0
  85. package/lib/oauth/oauth-types.d.ts +61 -0
  86. package/lib/oauth/oauth-types.js +32 -0
  87. package/lib/oauth/oauth-types.js.map +1 -0
  88. package/lib/oauth/oauth-utils.d.ts +20 -0
  89. package/lib/oauth/oauth-utils.js +111 -0
  90. package/lib/oauth/oauth-utils.js.map +1 -0
  91. package/lib/oauth/oauth.controller.d.ts +31 -0
  92. package/lib/oauth/oauth.controller.js +132 -0
  93. package/lib/oauth/oauth.controller.js.map +1 -0
  94. package/lib/oauth/oauth.service.d.ts +69 -0
  95. package/lib/oauth/oauth.service.js +650 -0
  96. package/lib/oauth/oauth.service.js.map +1 -0
  97. package/lib/oauth/token-hash.d.ts +6 -0
  98. package/lib/oauth/token-hash.js +21 -0
  99. package/lib/oauth/token-hash.js.map +1 -0
  100. package/lib/plugin.d.ts +54 -0
  101. package/lib/plugin.js +171 -0
  102. package/lib/plugin.js.map +1 -0
  103. package/lib/rate-limit/ip-bucket-key.d.ts +1 -0
  104. package/lib/rate-limit/ip-bucket-key.js +35 -0
  105. package/lib/rate-limit/ip-bucket-key.js.map +1 -0
  106. package/lib/rate-limit/mcp-oauth-rate-limit.guard.d.ts +20 -0
  107. package/lib/rate-limit/mcp-oauth-rate-limit.guard.js +63 -0
  108. package/lib/rate-limit/mcp-oauth-rate-limit.guard.js.map +1 -0
  109. package/lib/rate-limit/mcp-rate-limiter.service.d.ts +47 -0
  110. package/lib/rate-limit/mcp-rate-limiter.service.js +248 -0
  111. package/lib/rate-limit/mcp-rate-limiter.service.js.map +1 -0
  112. package/lib/registry/bm25.d.ts +12 -0
  113. package/lib/registry/bm25.js +60 -0
  114. package/lib/registry/bm25.js.map +1 -0
  115. package/lib/registry/mcp-tool-execution.service.d.ts +45 -0
  116. package/lib/registry/mcp-tool-execution.service.js +72 -0
  117. package/lib/registry/mcp-tool-execution.service.js.map +1 -0
  118. package/lib/registry/mcp-tool-registry.service.d.ts +89 -0
  119. package/lib/registry/mcp-tool-registry.service.js +668 -0
  120. package/lib/registry/mcp-tool-registry.service.js.map +1 -0
  121. package/lib/registry/mcp-tool-schema.service.d.ts +42 -0
  122. package/lib/registry/mcp-tool-schema.service.js +229 -0
  123. package/lib/registry/mcp-tool-schema.service.js.map +1 -0
  124. package/lib/registry/registry-types.d.ts +32 -0
  125. package/lib/registry/registry-types.js +3 -0
  126. package/lib/registry/registry-types.js.map +1 -0
  127. package/lib/resolve-options.d.ts +7 -0
  128. package/lib/resolve-options.js +85 -0
  129. package/lib/resolve-options.js.map +1 -0
  130. package/lib/shared/endpoint-paths.d.ts +8 -0
  131. package/lib/shared/endpoint-paths.js +12 -0
  132. package/lib/shared/endpoint-paths.js.map +1 -0
  133. package/lib/shared/loopback.d.ts +2 -0
  134. package/lib/shared/loopback.js +9 -0
  135. package/lib/shared/loopback.js.map +1 -0
  136. package/lib/shop-session/mcp-shop-session.service.d.ts +47 -0
  137. package/lib/shop-session/mcp-shop-session.service.js +132 -0
  138. package/lib/shop-session/mcp-shop-session.service.js.map +1 -0
  139. package/lib/tasks/mcp-oauth-retention.task.d.ts +9 -0
  140. package/lib/tasks/mcp-oauth-retention.task.js +21 -0
  141. package/lib/tasks/mcp-oauth-retention.task.js.map +1 -0
  142. package/lib/tasks/mcp-tool-call-log-retention.task.d.ts +7 -0
  143. package/lib/tasks/mcp-tool-call-log-retention.task.js +22 -0
  144. package/lib/tasks/mcp-tool-call-log-retention.task.js.map +1 -0
  145. package/lib/tools/built-in/active-order.service.d.ts +26 -0
  146. package/lib/tools/built-in/active-order.service.js +125 -0
  147. package/lib/tools/built-in/active-order.service.js.map +1 -0
  148. package/lib/tools/built-in/admin/add-customer-to-group.tool.d.ts +23 -0
  149. package/lib/tools/built-in/admin/add-customer-to-group.tool.js +68 -0
  150. package/lib/tools/built-in/admin/add-customer-to-group.tool.js.map +1 -0
  151. package/lib/tools/built-in/admin/add-note-to-order.tool.d.ts +104 -0
  152. package/lib/tools/built-in/admin/add-note-to-order.tool.js +66 -0
  153. package/lib/tools/built-in/admin/add-note-to-order.tool.js.map +1 -0
  154. package/lib/tools/built-in/admin/adjust-stock.tool.d.ts +26 -0
  155. package/lib/tools/built-in/admin/adjust-stock.tool.js +88 -0
  156. package/lib/tools/built-in/admin/adjust-stock.tool.js.map +1 -0
  157. package/lib/tools/built-in/admin/cancel-order.tool.d.ts +17 -0
  158. package/lib/tools/built-in/admin/cancel-order.tool.js +60 -0
  159. package/lib/tools/built-in/admin/cancel-order.tool.js.map +1 -0
  160. package/lib/tools/built-in/admin/channel-access.d.ts +2 -0
  161. package/lib/tools/built-in/admin/channel-access.js +9 -0
  162. package/lib/tools/built-in/admin/channel-access.js.map +1 -0
  163. package/lib/tools/built-in/admin/create-customer.tool.d.ts +41 -0
  164. package/lib/tools/built-in/admin/create-customer.tool.js +57 -0
  165. package/lib/tools/built-in/admin/create-customer.tool.js.map +1 -0
  166. package/lib/tools/built-in/admin/create-fulfillment.tool.d.ts +118 -0
  167. package/lib/tools/built-in/admin/create-fulfillment.tool.js +156 -0
  168. package/lib/tools/built-in/admin/create-fulfillment.tool.js.map +1 -0
  169. package/lib/tools/built-in/admin/create-product.tool.d.ts +52 -0
  170. package/lib/tools/built-in/admin/create-product.tool.js +61 -0
  171. package/lib/tools/built-in/admin/create-product.tool.js.map +1 -0
  172. package/lib/tools/built-in/admin/create-variant.tool.d.ts +48 -0
  173. package/lib/tools/built-in/admin/create-variant.tool.js +79 -0
  174. package/lib/tools/built-in/admin/create-variant.tool.js.map +1 -0
  175. package/lib/tools/built-in/admin/entity-field-schemas.d.ts +36 -0
  176. package/lib/tools/built-in/admin/entity-field-schemas.js +63 -0
  177. package/lib/tools/built-in/admin/entity-field-schemas.js.map +1 -0
  178. package/lib/tools/built-in/admin/get-customer.tool.d.ts +28 -0
  179. package/lib/tools/built-in/admin/get-customer.tool.js +55 -0
  180. package/lib/tools/built-in/admin/get-customer.tool.js.map +1 -0
  181. package/lib/tools/built-in/admin/get-order.tool.d.ts +100 -0
  182. package/lib/tools/built-in/admin/get-order.tool.js +68 -0
  183. package/lib/tools/built-in/admin/get-order.tool.js.map +1 -0
  184. package/lib/tools/built-in/admin/get-product.tool.d.ts +69 -0
  185. package/lib/tools/built-in/admin/get-product.tool.js +77 -0
  186. package/lib/tools/built-in/admin/get-product.tool.js.map +1 -0
  187. package/lib/tools/built-in/admin/get-stock-levels.tool.d.ts +23 -0
  188. package/lib/tools/built-in/admin/get-stock-levels.tool.js +61 -0
  189. package/lib/tools/built-in/admin/get-stock-levels.tool.js.map +1 -0
  190. package/lib/tools/built-in/admin/index.d.ts +25 -0
  191. package/lib/tools/built-in/admin/index.js +54 -0
  192. package/lib/tools/built-in/admin/index.js.map +1 -0
  193. package/lib/tools/built-in/admin/list-channels.tool.d.ts +24 -0
  194. package/lib/tools/built-in/admin/list-channels.tool.js +56 -0
  195. package/lib/tools/built-in/admin/list-channels.tool.js.map +1 -0
  196. package/lib/tools/built-in/admin/list-customer-groups.tool.d.ts +23 -0
  197. package/lib/tools/built-in/admin/list-customer-groups.tool.js +52 -0
  198. package/lib/tools/built-in/admin/list-customer-groups.tool.js.map +1 -0
  199. package/lib/tools/built-in/admin/list-customers.tool.d.ts +62 -0
  200. package/lib/tools/built-in/admin/list-customers.tool.js +66 -0
  201. package/lib/tools/built-in/admin/list-customers.tool.js.map +1 -0
  202. package/lib/tools/built-in/admin/list-orders.tool.d.ts +142 -0
  203. package/lib/tools/built-in/admin/list-orders.tool.js +87 -0
  204. package/lib/tools/built-in/admin/list-orders.tool.js.map +1 -0
  205. package/lib/tools/built-in/admin/list-products.tool.d.ts +63 -0
  206. package/lib/tools/built-in/admin/list-products.tool.js +71 -0
  207. package/lib/tools/built-in/admin/list-products.tool.js.map +1 -0
  208. package/lib/tools/built-in/admin/refund-order.tool.d.ts +38 -0
  209. package/lib/tools/built-in/admin/refund-order.tool.js +115 -0
  210. package/lib/tools/built-in/admin/refund-order.tool.js.map +1 -0
  211. package/lib/tools/built-in/admin/set-active-channel.tool.d.ts +22 -0
  212. package/lib/tools/built-in/admin/set-active-channel.tool.js +84 -0
  213. package/lib/tools/built-in/admin/set-active-channel.tool.js.map +1 -0
  214. package/lib/tools/built-in/admin/translation-schemas.d.ts +12 -0
  215. package/lib/tools/built-in/admin/translation-schemas.js +17 -0
  216. package/lib/tools/built-in/admin/translation-schemas.js.map +1 -0
  217. package/lib/tools/built-in/admin/update-customer.tool.d.ts +42 -0
  218. package/lib/tools/built-in/admin/update-customer.tool.js +59 -0
  219. package/lib/tools/built-in/admin/update-customer.tool.js.map +1 -0
  220. package/lib/tools/built-in/admin/update-order-state.tool.d.ts +16 -0
  221. package/lib/tools/built-in/admin/update-order-state.tool.js +58 -0
  222. package/lib/tools/built-in/admin/update-order-state.tool.js.map +1 -0
  223. package/lib/tools/built-in/admin/update-product.tool.d.ts +53 -0
  224. package/lib/tools/built-in/admin/update-product.tool.js +68 -0
  225. package/lib/tools/built-in/admin/update-product.tool.js.map +1 -0
  226. package/lib/tools/built-in/admin/update-variant.tool.d.ts +46 -0
  227. package/lib/tools/built-in/admin/update-variant.tool.js +77 -0
  228. package/lib/tools/built-in/admin/update-variant.tool.js.map +1 -0
  229. package/lib/tools/built-in/admin/upload-asset.tool.d.ts +32 -0
  230. package/lib/tools/built-in/admin/upload-asset.tool.js +56 -0
  231. package/lib/tools/built-in/admin/upload-asset.tool.js.map +1 -0
  232. package/lib/tools/built-in/catalog-query.service.d.ts +21 -0
  233. package/lib/tools/built-in/catalog-query.service.js +128 -0
  234. package/lib/tools/built-in/catalog-query.service.js.map +1 -0
  235. package/lib/tools/built-in/custom-field-input.service.d.ts +10 -0
  236. package/lib/tools/built-in/custom-field-input.service.js +64 -0
  237. package/lib/tools/built-in/custom-field-input.service.js.map +1 -0
  238. package/lib/tools/built-in/email-schema.d.ts +2 -0
  239. package/lib/tools/built-in/email-schema.js +12 -0
  240. package/lib/tools/built-in/email-schema.js.map +1 -0
  241. package/lib/tools/built-in/id-schema.d.ts +3 -0
  242. package/lib/tools/built-in/id-schema.js +11 -0
  243. package/lib/tools/built-in/id-schema.js.map +1 -0
  244. package/lib/tools/built-in/int32-schema.d.ts +4 -0
  245. package/lib/tools/built-in/int32-schema.js +8 -0
  246. package/lib/tools/built-in/int32-schema.js.map +1 -0
  247. package/lib/tools/built-in/list-helpers.d.ts +48 -0
  248. package/lib/tools/built-in/list-helpers.js +76 -0
  249. package/lib/tools/built-in/list-helpers.js.map +1 -0
  250. package/lib/tools/built-in/order-list-helpers.d.ts +20 -0
  251. package/lib/tools/built-in/order-list-helpers.js +48 -0
  252. package/lib/tools/built-in/order-list-helpers.js.map +1 -0
  253. package/lib/tools/built-in/providers.d.ts +2 -0
  254. package/lib/tools/built-in/providers.js +7 -0
  255. package/lib/tools/built-in/providers.js.map +1 -0
  256. package/lib/tools/built-in/remote-asset.d.ts +4 -0
  257. package/lib/tools/built-in/remote-asset.js +54 -0
  258. package/lib/tools/built-in/remote-asset.js.map +1 -0
  259. package/lib/tools/built-in/serializer.service.d.ts +327 -0
  260. package/lib/tools/built-in/serializer.service.js +413 -0
  261. package/lib/tools/built-in/serializer.service.js.map +1 -0
  262. package/lib/tools/built-in/shop/add-to-cart.tool.d.ts +21 -0
  263. package/lib/tools/built-in/shop/add-to-cart.tool.js +100 -0
  264. package/lib/tools/built-in/shop/add-to-cart.tool.js.map +1 -0
  265. package/lib/tools/built-in/shop/address-schema.d.ts +15 -0
  266. package/lib/tools/built-in/shop/address-schema.js +20 -0
  267. package/lib/tools/built-in/shop/address-schema.js.map +1 -0
  268. package/lib/tools/built-in/shop/apply-coupon-code.tool.d.ts +17 -0
  269. package/lib/tools/built-in/shop/apply-coupon-code.tool.js +62 -0
  270. package/lib/tools/built-in/shop/apply-coupon-code.tool.js.map +1 -0
  271. package/lib/tools/built-in/shop/collection-lookup.d.ts +15 -0
  272. package/lib/tools/built-in/shop/collection-lookup.js +35 -0
  273. package/lib/tools/built-in/shop/collection-lookup.js.map +1 -0
  274. package/lib/tools/built-in/shop/get-cart.tool.d.ts +94 -0
  275. package/lib/tools/built-in/shop/get-cart.tool.js +55 -0
  276. package/lib/tools/built-in/shop/get-cart.tool.js.map +1 -0
  277. package/lib/tools/built-in/shop/get-collection.tool.d.ts +42 -0
  278. package/lib/tools/built-in/shop/get-collection.tool.js +64 -0
  279. package/lib/tools/built-in/shop/get-collection.tool.js.map +1 -0
  280. package/lib/tools/built-in/shop/get-eligible-payment-methods.tool.d.ts +26 -0
  281. package/lib/tools/built-in/shop/get-eligible-payment-methods.tool.js +58 -0
  282. package/lib/tools/built-in/shop/get-eligible-payment-methods.tool.js.map +1 -0
  283. package/lib/tools/built-in/shop/get-eligible-shipping-methods.tool.d.ts +30 -0
  284. package/lib/tools/built-in/shop/get-eligible-shipping-methods.tool.js +59 -0
  285. package/lib/tools/built-in/shop/get-eligible-shipping-methods.tool.js.map +1 -0
  286. package/lib/tools/built-in/shop/get-my-account.tool.d.ts +22 -0
  287. package/lib/tools/built-in/shop/get-my-account.tool.js +57 -0
  288. package/lib/tools/built-in/shop/get-my-account.tool.js.map +1 -0
  289. package/lib/tools/built-in/shop/get-order.tool.d.ts +100 -0
  290. package/lib/tools/built-in/shop/get-order.tool.js +67 -0
  291. package/lib/tools/built-in/shop/get-order.tool.js.map +1 -0
  292. package/lib/tools/built-in/shop/get-product.tool.d.ts +57 -0
  293. package/lib/tools/built-in/shop/get-product.tool.js +81 -0
  294. package/lib/tools/built-in/shop/get-product.tool.js.map +1 -0
  295. package/lib/tools/built-in/shop/index.d.ts +19 -0
  296. package/lib/tools/built-in/shop/index.js +42 -0
  297. package/lib/tools/built-in/shop/index.js.map +1 -0
  298. package/lib/tools/built-in/shop/list-collections.tool.d.ts +42 -0
  299. package/lib/tools/built-in/shop/list-collections.tool.js +75 -0
  300. package/lib/tools/built-in/shop/list-collections.tool.js.map +1 -0
  301. package/lib/tools/built-in/shop/list-my-orders.tool.d.ts +100 -0
  302. package/lib/tools/built-in/shop/list-my-orders.tool.js +63 -0
  303. package/lib/tools/built-in/shop/list-my-orders.tool.js.map +1 -0
  304. package/lib/tools/built-in/shop/place-order.tool.d.ts +188 -0
  305. package/lib/tools/built-in/shop/place-order.tool.js +152 -0
  306. package/lib/tools/built-in/shop/place-order.tool.js.map +1 -0
  307. package/lib/tools/built-in/shop/product-search-query.d.ts +4 -0
  308. package/lib/tools/built-in/shop/product-search-query.js +34 -0
  309. package/lib/tools/built-in/shop/product-search-query.js.map +1 -0
  310. package/lib/tools/built-in/shop/remove-coupon-code.tool.d.ts +17 -0
  311. package/lib/tools/built-in/shop/remove-coupon-code.tool.js +63 -0
  312. package/lib/tools/built-in/shop/remove-coupon-code.tool.js.map +1 -0
  313. package/lib/tools/built-in/shop/remove-from-cart.tool.d.ts +17 -0
  314. package/lib/tools/built-in/shop/remove-from-cart.tool.js +58 -0
  315. package/lib/tools/built-in/shop/remove-from-cart.tool.js.map +1 -0
  316. package/lib/tools/built-in/shop/search-products.tool.d.ts +48 -0
  317. package/lib/tools/built-in/shop/search-products.tool.js +95 -0
  318. package/lib/tools/built-in/shop/search-products.tool.js.map +1 -0
  319. package/lib/tools/built-in/shop/set-checkout-details.tool.d.ts +56 -0
  320. package/lib/tools/built-in/shop/set-checkout-details.tool.js +187 -0
  321. package/lib/tools/built-in/shop/set-checkout-details.tool.js.map +1 -0
  322. package/lib/tools/built-in/shop/set-shipping-method.tool.d.ts +17 -0
  323. package/lib/tools/built-in/shop/set-shipping-method.tool.js +58 -0
  324. package/lib/tools/built-in/shop/set-shipping-method.tool.js.map +1 -0
  325. package/lib/tools/built-in/shop/update-cart-line.tool.d.ts +18 -0
  326. package/lib/tools/built-in/shop/update-cart-line.tool.js +60 -0
  327. package/lib/tools/built-in/shop/update-cart-line.tool.js.map +1 -0
  328. package/lib/tools/built-in/string-schemas.d.ts +4 -0
  329. package/lib/tools/built-in/string-schemas.js +13 -0
  330. package/lib/tools/built-in/string-schemas.js.map +1 -0
  331. package/lib/transport/mcp-server.factory.d.ts +13 -0
  332. package/lib/transport/mcp-server.factory.js +32 -0
  333. package/lib/transport/mcp-server.factory.js.map +1 -0
  334. package/lib/transport/mcp-transport.controller.d.ts +77 -0
  335. package/lib/transport/mcp-transport.controller.js +442 -0
  336. package/lib/transport/mcp-transport.controller.js.map +1 -0
  337. package/lib/types.d.ts +432 -0
  338. package/lib/types.js +3 -0
  339. package/lib/types.js.map +1 -0
  340. package/package.json +42 -0
  341. package/src/dashboard/components/activity-block.tsx +72 -0
  342. package/src/dashboard/components/actor-cell.tsx +31 -0
  343. package/src/dashboard/components/connection-dialog.tsx +106 -0
  344. package/src/dashboard/components/empty-cell.tsx +7 -0
  345. package/src/dashboard/components/grants-block.tsx +218 -0
  346. package/src/dashboard/components/stats-block.tsx +275 -0
  347. package/src/dashboard/components/tools-block.tsx +274 -0
  348. package/src/dashboard/components/tooltip-button.tsx +28 -0
  349. package/src/dashboard/components/use-mcp-table-state.ts +47 -0
  350. package/src/dashboard/i18n/ar.po +311 -0
  351. package/src/dashboard/i18n/bg.po +311 -0
  352. package/src/dashboard/i18n/cs.po +311 -0
  353. package/src/dashboard/i18n/de.po +311 -0
  354. package/src/dashboard/i18n/en.po +311 -0
  355. package/src/dashboard/i18n/es.po +311 -0
  356. package/src/dashboard/i18n/fa.po +311 -0
  357. package/src/dashboard/i18n/fr.po +311 -0
  358. package/src/dashboard/i18n/he.po +311 -0
  359. package/src/dashboard/i18n/hr.po +311 -0
  360. package/src/dashboard/i18n/hu.po +311 -0
  361. package/src/dashboard/i18n/it.po +311 -0
  362. package/src/dashboard/i18n/ja.po +311 -0
  363. package/src/dashboard/i18n/ko.po +311 -0
  364. package/src/dashboard/i18n/nb.po +311 -0
  365. package/src/dashboard/i18n/ne.po +311 -0
  366. package/src/dashboard/i18n/nl.po +311 -0
  367. package/src/dashboard/i18n/pl.po +311 -0
  368. package/src/dashboard/i18n/pt_BR.po +311 -0
  369. package/src/dashboard/i18n/pt_PT.po +311 -0
  370. package/src/dashboard/i18n/ro.po +311 -0
  371. package/src/dashboard/i18n/ru.po +311 -0
  372. package/src/dashboard/i18n/sv.po +311 -0
  373. package/src/dashboard/i18n/tr.po +311 -0
  374. package/src/dashboard/i18n/uk.po +311 -0
  375. package/src/dashboard/i18n/uz.po +311 -0
  376. package/src/dashboard/i18n/zh_Hans.po +311 -0
  377. package/src/dashboard/i18n/zh_Hant.po +311 -0
  378. package/src/dashboard/index.tsx +30 -0
  379. package/src/dashboard/mcp-activity-route.tsx +38 -0
  380. package/src/dashboard/mcp-authorize-route.tsx +369 -0
  381. package/src/dashboard/mcp-grants-route.tsx +38 -0
  382. package/src/dashboard/mcp-overview-route.tsx +46 -0
  383. package/src/dashboard/mcp-server-redirect-route.tsx +15 -0
  384. package/src/dashboard/mcp-tools-route.tsx +38 -0
  385. package/src/dashboard/mcp.graphql.ts +127 -0
  386. package/src/dashboard/published-files.spec.ts +54 -0
  387. package/src/dashboard/tsconfig.json +9 -0
  388. package/src/shared/endpoint-paths.ts +8 -0
  389. package/src/shared/loopback.ts +6 -0
@@ -0,0 +1,100 @@
1
+ import { CustomerService, OrderService, RequestContext, TranslatorService } from '@vendure/core';
2
+ import { McpToolHandler } from '@vendure/mcp-sdk';
3
+ import { z } from 'zod';
4
+ import { McpToolSerializerService } from '../serializer.service';
5
+ declare const listMyOrdersInput: z.ZodObject<{
6
+ limit: z.ZodOptional<z.ZodNumber>;
7
+ offset: z.ZodOptional<z.ZodNumber>;
8
+ }, z.core.$strict>;
9
+ type ListMyOrdersInput = z.infer<typeof listMyOrdersInput>;
10
+ export declare class ListMyOrdersTool implements McpToolHandler<ListMyOrdersInput> {
11
+ private readonly customerService;
12
+ private readonly orderService;
13
+ private readonly translator;
14
+ private readonly serializer;
15
+ constructor(customerService: CustomerService, orderService: OrderService, translator: TranslatorService, serializer: McpToolSerializerService);
16
+ execute(ctx: RequestContext, input: ListMyOrdersInput): Promise<{
17
+ items: ({
18
+ id: import("@vendure/core").ID;
19
+ code: string;
20
+ state: import("@vendure/core").OrderState;
21
+ active: boolean;
22
+ total: number;
23
+ totalDecimal: string;
24
+ totalWithTax: number;
25
+ totalWithTaxDecimal: string;
26
+ currencyCode: import("@vendure/core").CurrencyCode;
27
+ totalQuantity: number;
28
+ createdAt: string | null;
29
+ updatedAt: string | null;
30
+ orderPlacedAt: string | null;
31
+ couponCodes: string[];
32
+ discounts: {
33
+ adjustmentSource: string;
34
+ type: import("@vendure/core").AdjustmentType;
35
+ description: string;
36
+ amount: number;
37
+ amountDecimal: string;
38
+ amountWithTax: number;
39
+ amountWithTaxDecimal: string;
40
+ }[];
41
+ lines: {
42
+ id: import("@vendure/core").ID;
43
+ quantity: number;
44
+ linePriceWithTax: number;
45
+ linePriceWithTaxDecimal: string;
46
+ productVariant: {
47
+ id: import("@vendure/core").ID;
48
+ name: import("@vendure/core").LocaleString;
49
+ sku: string;
50
+ } | null;
51
+ }[];
52
+ payments: {
53
+ id: import("@vendure/core").ID;
54
+ method: string;
55
+ amount: number;
56
+ amountDecimal: string;
57
+ state: import("@vendure/core").PaymentState;
58
+ transactionId: string;
59
+ errorMessage: string | undefined;
60
+ publicMetadata: any;
61
+ refunds: {
62
+ id: import("@vendure/core").ID;
63
+ state: import("@vendure/core").RefundState;
64
+ total: number;
65
+ totalDecimal: string;
66
+ reason: string;
67
+ }[];
68
+ }[] | undefined;
69
+ fulfillments: {
70
+ id: import("@vendure/core").ID;
71
+ state: import("@vendure/core").FulfillmentState;
72
+ method: string;
73
+ trackingCode: string;
74
+ lines: {
75
+ orderLineId: import("@vendure/core").ID;
76
+ quantity: number;
77
+ }[];
78
+ }[] | undefined;
79
+ customer: {
80
+ id: import("@vendure/core").ID;
81
+ emailAddress: string;
82
+ firstName: string;
83
+ lastName: string;
84
+ } | null | undefined;
85
+ shippingAddress: Record<string, string> | null;
86
+ billingAddress: Record<string, string> | null;
87
+ shippingWithTax: number;
88
+ shippingWithTaxDecimal: string;
89
+ shippingLines: {
90
+ id: import("@vendure/core").ID;
91
+ shippingMethodId: import("@vendure/core").ID | null;
92
+ priceWithTax: number;
93
+ priceWithTaxDecimal: string;
94
+ }[] | undefined;
95
+ } | null)[];
96
+ total: number;
97
+ hasMore: boolean;
98
+ }>;
99
+ }
100
+ export {};
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ListMyOrdersTool = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const core_1 = require("@vendure/core");
15
+ const mcp_sdk_1 = require("@vendure/mcp-sdk");
16
+ const zod_1 = require("zod");
17
+ const list_helpers_1 = require("../list-helpers");
18
+ const order_list_helpers_1 = require("../order-list-helpers");
19
+ const serializer_service_1 = require("../serializer.service");
20
+ const listMyOrdersInput = zod_1.z.strictObject(Object.assign({}, (0, list_helpers_1.paginationFields)('orders')));
21
+ let ListMyOrdersTool = class ListMyOrdersTool {
22
+ constructor(customerService, orderService, translator, serializer) {
23
+ this.customerService = customerService;
24
+ this.orderService = orderService;
25
+ this.translator = translator;
26
+ this.serializer = serializer;
27
+ }
28
+ async execute(ctx, input) {
29
+ if (!ctx.activeUserId)
30
+ return (0, list_helpers_1.page)([], 0, input);
31
+ const customer = await this.customerService.findOneByUserId(ctx, ctx.activeUserId);
32
+ if (!customer)
33
+ return (0, list_helpers_1.page)([], 0, input);
34
+ const result = await this.orderService.findByCustomerId(ctx, customer.id, (0, order_list_helpers_1.orderListOptions)(input, 'createdAt'), order_list_helpers_1.ORDER_LIST_RELATIONS);
35
+ (0, order_list_helpers_1.translateLineVariants)(result.items, this.translator, ctx);
36
+ return (0, list_helpers_1.page)(result.items.map(order => this.serializer.order(order)), result.totalItems, input);
37
+ }
38
+ };
39
+ exports.ListMyOrdersTool = ListMyOrdersTool;
40
+ exports.ListMyOrdersTool = ListMyOrdersTool = __decorate([
41
+ (0, mcp_sdk_1.McpTool)({
42
+ name: 'list_my_orders',
43
+ toolset: 'shop',
44
+ description: 'List orders belonging to the authenticated customer, newest first.',
45
+ keywords: [
46
+ 'my order history',
47
+ 'my past purchases',
48
+ "everything I've ordered",
49
+ 'show my previous orders',
50
+ 'what have I bought before',
51
+ 'my buying history',
52
+ ],
53
+ permissions: [core_1.Permission.Authenticated],
54
+ behavior: 'readonly',
55
+ inputSchema: listMyOrdersInput,
56
+ }),
57
+ (0, common_1.Injectable)(),
58
+ __metadata("design:paramtypes", [core_1.CustomerService,
59
+ core_1.OrderService,
60
+ core_1.TranslatorService,
61
+ serializer_service_1.McpToolSerializerService])
62
+ ], ListMyOrdersTool);
63
+ //# sourceMappingURL=list-my-orders.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-my-orders.tool.js","sourceRoot":"","sources":["../../../../src/tools/built-in/shop/list-my-orders.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,wCAA6G;AAC7G,8CAA2D;AAC3D,6BAAwB;AAExB,kDAAyD;AACzD,8DAAsG;AACtG,8DAAiE;AAEjE,MAAM,iBAAiB,GAAG,OAAC,CAAC,YAAY,mBACjC,IAAA,+BAAgB,EAAC,QAAQ,CAAC,EAC/B,CAAC;AAqBI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IACzB,YACqB,eAAgC,EAChC,YAA0B,EAC1B,UAA6B,EAC7B,UAAoC;QAHpC,oBAAe,GAAf,eAAe,CAAiB;QAChC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,eAAU,GAAV,UAAU,CAAmB;QAC7B,eAAU,GAAV,UAAU,CAA0B;IACtD,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,GAAmB,EAAE,KAAwB;QACvD,IAAI,CAAC,GAAG,CAAC,YAAY;YAAE,OAAO,IAAA,mBAAI,EAAC,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QACjD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;QACnF,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAA,mBAAI,EAAC,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,gBAAgB,CACnD,GAAG,EACH,QAAQ,CAAC,EAAE,EACX,IAAA,qCAAgB,EAAC,KAAK,EAAE,WAAW,CAAC,EACpC,yCAAoB,CACvB,CAAC;QACF,IAAA,0CAAqB,EAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAC1D,OAAO,IAAA,mBAAI,EACP,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EACvD,MAAM,CAAC,UAAU,EACjB,KAAK,CACR,CAAC;IACN,CAAC;CACJ,CAAA;AAzBY,4CAAgB;2BAAhB,gBAAgB;IAjB5B,IAAA,iBAAO,EAAC;QACL,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,MAAM;QACf,WAAW,EAAE,oEAAoE;QACjF,QAAQ,EAAE;YACN,kBAAkB;YAClB,mBAAmB;YACnB,yBAAyB;YACzB,yBAAyB;YACzB,2BAA2B;YAC3B,mBAAmB;SACtB;QACD,WAAW,EAAE,CAAC,iBAAU,CAAC,aAAa,CAAC;QACvC,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,iBAAiB;KACjC,CAAC;IACD,IAAA,mBAAU,GAAE;qCAG6B,sBAAe;QAClB,mBAAY;QACd,wBAAiB;QACjB,6CAAwB;GALhD,gBAAgB,CAyB5B"}
@@ -0,0 +1,188 @@
1
+ import { CustomerService, ID, OrderService, RequestContext, SessionService, TransactionalConnection } from '@vendure/core';
2
+ import { McpToolHandler } from '@vendure/mcp-sdk';
3
+ import { z } from 'zod';
4
+ import { McpActiveOrderService } from '../active-order.service';
5
+ import { McpToolSerializerService } from '../serializer.service';
6
+ declare const placeOrderInput: z.ZodObject<{
7
+ paymentMethodCode: z.ZodString;
8
+ paymentMetadata: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
9
+ }, z.core.$strict>;
10
+ type PlaceOrderInput = z.infer<typeof placeOrderInput>;
11
+ export declare class PlaceOrderTool implements McpToolHandler<PlaceOrderInput> {
12
+ private readonly activeOrder;
13
+ private readonly orderService;
14
+ private readonly serializer;
15
+ private readonly connection;
16
+ private readonly customerService;
17
+ private readonly sessionService;
18
+ constructor(activeOrder: McpActiveOrderService, orderService: OrderService, serializer: McpToolSerializerService, connection: TransactionalConnection, customerService: CustomerService, sessionService: SessionService);
19
+ execute(ctx: RequestContext, input: PlaceOrderInput): Promise<Record<string, unknown> | {
20
+ status: "placed";
21
+ order: {
22
+ id: ID;
23
+ code: string;
24
+ state: import("@vendure/core").OrderState;
25
+ active: boolean;
26
+ total: number;
27
+ totalDecimal: string;
28
+ totalWithTax: number;
29
+ totalWithTaxDecimal: string;
30
+ currencyCode: import("@vendure/core").CurrencyCode;
31
+ totalQuantity: number;
32
+ createdAt: string | null;
33
+ updatedAt: string | null;
34
+ orderPlacedAt: string | null;
35
+ couponCodes: string[];
36
+ discounts: {
37
+ adjustmentSource: string;
38
+ type: import("@vendure/core").AdjustmentType;
39
+ description: string;
40
+ amount: number;
41
+ amountDecimal: string;
42
+ amountWithTax: number;
43
+ amountWithTaxDecimal: string;
44
+ }[];
45
+ lines: {
46
+ id: ID;
47
+ quantity: number;
48
+ linePriceWithTax: number;
49
+ linePriceWithTaxDecimal: string;
50
+ productVariant: {
51
+ id: ID;
52
+ name: import("@vendure/core").LocaleString;
53
+ sku: string;
54
+ } | null;
55
+ }[];
56
+ payments: {
57
+ id: ID;
58
+ method: string;
59
+ amount: number;
60
+ amountDecimal: string;
61
+ state: import("@vendure/core").PaymentState;
62
+ transactionId: string;
63
+ errorMessage: string | undefined;
64
+ publicMetadata: any;
65
+ refunds: {
66
+ id: ID;
67
+ state: import("@vendure/core").RefundState;
68
+ total: number;
69
+ totalDecimal: string;
70
+ reason: string;
71
+ }[];
72
+ }[] | undefined;
73
+ fulfillments: {
74
+ id: ID;
75
+ state: import("@vendure/core").FulfillmentState;
76
+ method: string;
77
+ trackingCode: string;
78
+ lines: {
79
+ orderLineId: ID;
80
+ quantity: number;
81
+ }[];
82
+ }[] | undefined;
83
+ customer: {
84
+ id: ID;
85
+ emailAddress: string;
86
+ firstName: string;
87
+ lastName: string;
88
+ } | null | undefined;
89
+ shippingAddress: Record<string, string> | null;
90
+ billingAddress: Record<string, string> | null;
91
+ shippingWithTax: number;
92
+ shippingWithTaxDecimal: string;
93
+ shippingLines: {
94
+ id: ID;
95
+ shippingMethodId: ID | null;
96
+ priceWithTax: number;
97
+ priceWithTaxDecimal: string;
98
+ }[] | undefined;
99
+ } | null;
100
+ message?: undefined;
101
+ } | {
102
+ status: "awaiting_payment";
103
+ order: {
104
+ id: ID;
105
+ code: string;
106
+ state: import("@vendure/core").OrderState;
107
+ active: boolean;
108
+ total: number;
109
+ totalDecimal: string;
110
+ totalWithTax: number;
111
+ totalWithTaxDecimal: string;
112
+ currencyCode: import("@vendure/core").CurrencyCode;
113
+ totalQuantity: number;
114
+ createdAt: string | null;
115
+ updatedAt: string | null;
116
+ orderPlacedAt: string | null;
117
+ couponCodes: string[];
118
+ discounts: {
119
+ adjustmentSource: string;
120
+ type: import("@vendure/core").AdjustmentType;
121
+ description: string;
122
+ amount: number;
123
+ amountDecimal: string;
124
+ amountWithTax: number;
125
+ amountWithTaxDecimal: string;
126
+ }[];
127
+ lines: {
128
+ id: ID;
129
+ quantity: number;
130
+ linePriceWithTax: number;
131
+ linePriceWithTaxDecimal: string;
132
+ productVariant: {
133
+ id: ID;
134
+ name: import("@vendure/core").LocaleString;
135
+ sku: string;
136
+ } | null;
137
+ }[];
138
+ payments: {
139
+ id: ID;
140
+ method: string;
141
+ amount: number;
142
+ amountDecimal: string;
143
+ state: import("@vendure/core").PaymentState;
144
+ transactionId: string;
145
+ errorMessage: string | undefined;
146
+ publicMetadata: any;
147
+ refunds: {
148
+ id: ID;
149
+ state: import("@vendure/core").RefundState;
150
+ total: number;
151
+ totalDecimal: string;
152
+ reason: string;
153
+ }[];
154
+ }[] | undefined;
155
+ fulfillments: {
156
+ id: ID;
157
+ state: import("@vendure/core").FulfillmentState;
158
+ method: string;
159
+ trackingCode: string;
160
+ lines: {
161
+ orderLineId: ID;
162
+ quantity: number;
163
+ }[];
164
+ }[] | undefined;
165
+ customer: {
166
+ id: ID;
167
+ emailAddress: string;
168
+ firstName: string;
169
+ lastName: string;
170
+ } | null | undefined;
171
+ shippingAddress: Record<string, string> | null;
172
+ billingAddress: Record<string, string> | null;
173
+ shippingWithTax: number;
174
+ shippingWithTaxDecimal: string;
175
+ shippingLines: {
176
+ id: ID;
177
+ shippingMethodId: ID | null;
178
+ priceWithTax: number;
179
+ priceWithTaxDecimal: string;
180
+ }[] | undefined;
181
+ } | null;
182
+ message: string;
183
+ }>;
184
+ private startArrangingPayment;
185
+ private takePayment;
186
+ private describeOutcome;
187
+ }
188
+ export {};
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PlaceOrderTool = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const core_1 = require("@vendure/core");
15
+ const mcp_sdk_1 = require("@vendure/mcp-sdk");
16
+ const zod_1 = require("zod");
17
+ const constants_1 = require("../../../constants");
18
+ const active_order_service_1 = require("../active-order.service");
19
+ const serializer_service_1 = require("../serializer.service");
20
+ const string_schemas_1 = require("../string-schemas");
21
+ const placeOrderInput = zod_1.z.strictObject({
22
+ paymentMethodCode: string_schemas_1.shortText.describe('Payment method code.'),
23
+ paymentMetadata: zod_1.z.looseObject({}).describe('Metadata passed to the payment handler.').optional(),
24
+ });
25
+ // These carry a message the caller can act on (e.g. a bad payment method or an expired cart),
26
+ // so they're passed on unchanged instead of being replaced with a generic error.
27
+ // IllegalOperationError is left out because `addPaymentToOrder` only throws it from a state
28
+ // change that runs after the payment provider was called.
29
+ const CALLER_SAFE_ERRORS = [core_1.UserInputError, core_1.EntityNotFoundError, core_1.ForbiddenError, core_1.UnauthorizedError];
30
+ let PlaceOrderTool = class PlaceOrderTool {
31
+ constructor(activeOrder, orderService, serializer, connection, customerService, sessionService) {
32
+ this.activeOrder = activeOrder;
33
+ this.orderService = orderService;
34
+ this.serializer = serializer;
35
+ this.connection = connection;
36
+ this.customerService = customerService;
37
+ this.sessionService = sessionService;
38
+ }
39
+ async execute(ctx, input) {
40
+ const order = await this.activeOrder.findOrThrow(ctx);
41
+ // Taking a payment has to run inside a database transaction: `addPaymentToOrder` refuses to
42
+ // run without one.
43
+ return this.connection.withTransaction(order.ctx, async (txCtx) => {
44
+ const current = await this.orderService.findOne(txCtx, order.id);
45
+ if (!current) {
46
+ // The cart was there a moment ago, so only a concurrent deletion gets here.
47
+ throw new core_1.EntityNotFoundError('Order', order.id);
48
+ }
49
+ const arranging = await this.startArrangingPayment(txCtx, current);
50
+ if (arranging.kind === 'error') {
51
+ return arranging.result;
52
+ }
53
+ const result = await this.takePayment(txCtx, current, input);
54
+ if ((0, core_1.isGraphQlErrorResult)(result)) {
55
+ if (arranging.movedOutOfCart) {
56
+ await this.orderService.transitionToState(txCtx, order.id, 'AddingItems');
57
+ }
58
+ return this.serializer.orderOrError(result);
59
+ }
60
+ result.payments = await this.orderService.getOrderPayments(txCtx, result.id);
61
+ return this.describeOutcome(txCtx, order.id, result);
62
+ });
63
+ }
64
+ async startArrangingPayment(txCtx, current) {
65
+ if (current.state !== 'AddingItems') {
66
+ return { kind: 'ok', movedOutOfCart: false };
67
+ }
68
+ const transition = await this.orderService.transitionToState(txCtx, current.id, 'ArrangingPayment');
69
+ if ((0, core_1.isGraphQlErrorResult)(transition)) {
70
+ if (transition.transitionError ===
71
+ txCtx.translate('message.cannot-transition-to-payment-without-customer', {
72
+ fromState: current.state,
73
+ toState: 'ArrangingPayment',
74
+ })) {
75
+ throw new core_1.UserInputError('This cart has no customer yet. For a guest checkout call ' +
76
+ 'set_checkout_details with customer { emailAddress, firstName, ' +
77
+ 'lastName } first, or sign in as a customer.');
78
+ }
79
+ return { kind: 'error', result: this.serializer.orderOrError(transition) };
80
+ }
81
+ return { kind: 'ok', movedOutOfCart: true };
82
+ }
83
+ async takePayment(txCtx, order, input) {
84
+ var _a;
85
+ const payment = {
86
+ method: input.paymentMethodCode,
87
+ metadata: (_a = input.paymentMetadata) !== null && _a !== void 0 ? _a : {},
88
+ };
89
+ try {
90
+ return await this.orderService.addPaymentToOrder(txCtx, order.id, payment);
91
+ }
92
+ catch (e) {
93
+ if (CALLER_SAFE_ERRORS.some(errorType => e instanceof errorType)) {
94
+ throw e;
95
+ }
96
+ // The rollback removes the Payment row but cannot undo a charge the payment provider
97
+ // already made, so the order code is logged for the store to match against the provider.
98
+ core_1.Logger.error(`place_order payment failed for order ${order.code}: ${e instanceof Error ? e.message : String(e)}`, constants_1.loggerCtx, e instanceof Error ? e.stack : undefined);
99
+ throw new core_1.UserInputError('Taking the payment failed and nothing was saved on the order, but the payment ' +
100
+ 'provider may already have charged the customer. Do not retry. Tell the user to ' +
101
+ `contact the store about order ${order.code}.`);
102
+ }
103
+ }
104
+ async describeOutcome(txCtx, orderId, result) {
105
+ if (result.orderPlacedAt) {
106
+ await this.customerService.createAddressesForNewCustomer(txCtx, result);
107
+ if (txCtx.session && (0, core_1.idsAreEqual)(txCtx.session.activeOrderId, orderId)) {
108
+ await this.sessionService.unsetActiveOrder(txCtx, txCtx.session);
109
+ }
110
+ return { status: 'placed', order: this.serializer.order(result) };
111
+ }
112
+ let message = 'Payment was created, but the order is not placed yet. Look at order.payments for ' +
113
+ "each payment's state and any publicMetadata with the shopper's next step.";
114
+ if (result.state === 'ArrangingPayment') {
115
+ message += ' The cart cannot be edited while the order is in ArrangingPayment.';
116
+ }
117
+ return {
118
+ status: 'awaiting_payment',
119
+ order: this.serializer.order(result),
120
+ message,
121
+ };
122
+ }
123
+ };
124
+ exports.PlaceOrderTool = PlaceOrderTool;
125
+ exports.PlaceOrderTool = PlaceOrderTool = __decorate([
126
+ (0, mcp_sdk_1.McpTool)({
127
+ name: 'place_order',
128
+ toolset: 'shop',
129
+ description: 'Add payment to the active cart and place the order. The store order process decides which ' +
130
+ 'checkout details are required. Returns "placed" or "awaiting_payment" with payment details.',
131
+ keywords: [
132
+ 'check out',
133
+ 'complete my purchase',
134
+ 'pay now',
135
+ 'finalize and submit my order',
136
+ 'buy everything in my basket',
137
+ 'confirm and pay',
138
+ ],
139
+ permissions: [core_1.Permission.Public],
140
+ behavior: 'destructive',
141
+ usesActiveOrder: true,
142
+ inputSchema: placeOrderInput,
143
+ }),
144
+ (0, common_1.Injectable)(),
145
+ __metadata("design:paramtypes", [active_order_service_1.McpActiveOrderService,
146
+ core_1.OrderService,
147
+ serializer_service_1.McpToolSerializerService,
148
+ core_1.TransactionalConnection,
149
+ core_1.CustomerService,
150
+ core_1.SessionService])
151
+ ], PlaceOrderTool);
152
+ //# sourceMappingURL=place-order.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"place-order.tool.js","sourceRoot":"","sources":["../../../../src/tools/built-in/shop/place-order.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,wCAgBuB;AACvB,8CAA2D;AAC3D,6BAAwB;AAExB,kDAA+C;AAC/C,kEAAgE;AAChE,8DAAiE;AACjE,sDAA8C;AAE9C,MAAM,eAAe,GAAG,OAAC,CAAC,YAAY,CAAC;IACnC,iBAAiB,EAAE,0BAAS,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IAC7D,eAAe,EAAE,OAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,yCAAyC,CAAC,CAAC,QAAQ,EAAE;CACpG,CAAC,CAAC;AAIH,8FAA8F;AAC9F,iFAAiF;AACjF,4FA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,0 +1,4 @@
1
+ import { ListQueryOptions, Product } from '@vendure/core';
2
+ import { type ListInput } from '../list-helpers';
3
+ export declare function productSearchWords(query: string | undefined, trimPlurals?: boolean): string[];
4
+ export declare function publicProductListOptions(input: ListInput, words?: string[]): ListQueryOptions<Product>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.productSearchWords = productSearchWords;
4
+ exports.publicProductListOptions = publicProductListOptions;
5
+ const list_helpers_1 = require("../list-helpers");
6
+ // Words under four characters are left alone so short words like "gas" or "bus" aren't mangled.
7
+ function singular(word) {
8
+ if (word.length < 4) {
9
+ return word;
10
+ }
11
+ if (/(?:s|x|z|ch|sh)es$/i.test(word)) {
12
+ return word.slice(0, -2);
13
+ }
14
+ if (/[^s]s$/i.test(word)) {
15
+ return word.slice(0, -1);
16
+ }
17
+ return word;
18
+ }
19
+ // `trimPlurals` is used as a second attempt when the words as typed find nothing.
20
+ function productSearchWords(query, trimPlurals = false) {
21
+ const words = (query !== null && query !== void 0 ? query : '')
22
+ .trim()
23
+ .split(/\s+/)
24
+ .filter(word => word.length > 0);
25
+ return trimPlurals ? words.map(singular) : words;
26
+ }
27
+ function publicProductListOptions(input, words = []) {
28
+ const options = (0, list_helpers_1.listOptions)({ limit: input.limit, offset: input.offset });
29
+ const wordFilters = words.map(word => ({
30
+ _or: [{ name: { contains: word } }, { slug: { contains: word } }],
31
+ }));
32
+ return Object.assign(Object.assign({}, options), { filter: Object.assign({ enabled: { eq: true } }, (wordFilters.length ? { _and: wordFilters } : {})) });
33
+ }
34
+ //# sourceMappingURL=product-search-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-search-query.js","sourceRoot":"","sources":["../../../../src/tools/built-in/shop/product-search-query.ts"],"names":[],"mappings":";;AAmBA,gDAMC;AAED,4DAYC;AArCD,kDAA8D;AAE9D,gGAAgG;AAChG,SAAS,QAAQ,CAAC,IAAY;IAC1B,IAAI,IAAI,CAAC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,uCACO,OAAO,KACV,MAAM,kBACF,OAAO,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAClB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAE1D;AACN,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { OrderService, RequestContext } from '@vendure/core';
2
+ import { McpToolHandler } from '@vendure/mcp-sdk';
3
+ import { z } from 'zod';
4
+ import { McpActiveOrderService } from '../active-order.service';
5
+ import { McpToolSerializerService } from '../serializer.service';
6
+ declare const removeCouponCodeInput: z.ZodObject<{
7
+ code: z.ZodString;
8
+ }, z.core.$strict>;
9
+ type RemoveCouponCodeInput = z.infer<typeof removeCouponCodeInput>;
10
+ export declare class RemoveCouponCodeTool implements McpToolHandler<RemoveCouponCodeInput> {
11
+ private readonly activeOrder;
12
+ private readonly orderService;
13
+ private readonly serializer;
14
+ constructor(activeOrder: McpActiveOrderService, orderService: OrderService, serializer: McpToolSerializerService);
15
+ execute(ctx: RequestContext, input: RemoveCouponCodeInput): Promise<Record<string, unknown>>;
16
+ }
17
+ export {};
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RemoveCouponCodeTool = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const core_1 = require("@vendure/core");
15
+ const mcp_sdk_1 = require("@vendure/mcp-sdk");
16
+ const zod_1 = require("zod");
17
+ const active_order_service_1 = require("../active-order.service");
18
+ const serializer_service_1 = require("../serializer.service");
19
+ const string_schemas_1 = require("../string-schemas");
20
+ const removeCouponCodeInput = zod_1.z.strictObject({
21
+ code: string_schemas_1.shortText.describe('Coupon code.'),
22
+ });
23
+ let RemoveCouponCodeTool = class RemoveCouponCodeTool {
24
+ constructor(activeOrder, orderService, serializer) {
25
+ this.activeOrder = activeOrder;
26
+ this.orderService = orderService;
27
+ this.serializer = serializer;
28
+ }
29
+ async execute(ctx, input) {
30
+ const order = await this.activeOrder.findEditable(ctx);
31
+ if ((0, core_1.isGraphQlErrorResult)(order)) {
32
+ return this.serializer.orderOrError(order);
33
+ }
34
+ return {
35
+ order: this.serializer.order(await this.orderService.removeCouponCode(order.ctx, order.id, input.code)),
36
+ };
37
+ }
38
+ };
39
+ exports.RemoveCouponCodeTool = RemoveCouponCodeTool;
40
+ exports.RemoveCouponCodeTool = RemoveCouponCodeTool = __decorate([
41
+ (0, mcp_sdk_1.McpTool)({
42
+ name: 'remove_coupon_code',
43
+ toolset: 'shop',
44
+ description: 'Remove a coupon code from the active cart.',
45
+ keywords: [
46
+ 'take off the discount',
47
+ 'cancel my promo code',
48
+ 'remove the voucher',
49
+ 'get rid of the coupon',
50
+ 'undo the discount code',
51
+ 'clear the applied promo',
52
+ ],
53
+ permissions: [core_1.Permission.Public],
54
+ behavior: 'mutating',
55
+ usesActiveOrder: true,
56
+ inputSchema: removeCouponCodeInput,
57
+ }),
58
+ (0, common_1.Injectable)(),
59
+ __metadata("design:paramtypes", [active_order_service_1.McpActiveOrderService,
60
+ core_1.OrderService,
61
+ serializer_service_1.McpToolSerializerService])
62
+ ], RemoveCouponCodeTool);
63
+ //# sourceMappingURL=remove-coupon-code.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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