@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.
- package/lib/api/api-extensions.d.ts +2 -0
- package/lib/api/api-extensions.js +239 -0
- package/lib/api/api-extensions.js.map +1 -0
- package/lib/api/mcp-actor.service.d.ts +19 -0
- package/lib/api/mcp-actor.service.js +52 -0
- package/lib/api/mcp-actor.service.js.map +1 -0
- package/lib/api/mcp-admin.resolver.d.ts +105 -0
- package/lib/api/mcp-admin.resolver.js +463 -0
- package/lib/api/mcp-admin.resolver.js.map +1 -0
- package/lib/api/mcp-shop.resolver.d.ts +25 -0
- package/lib/api/mcp-shop.resolver.js +74 -0
- package/lib/api/mcp-shop.resolver.js.map +1 -0
- package/lib/check-options.d.ts +7 -0
- package/lib/check-options.js +130 -0
- package/lib/check-options.js.map +1 -0
- package/lib/constants.d.ts +48 -0
- package/lib/constants.js +72 -0
- package/lib/constants.js.map +1 -0
- package/lib/delete-in-batches.d.ts +5 -0
- package/lib/delete-in-batches.js +28 -0
- package/lib/delete-in-batches.js.map +1 -0
- package/lib/entities/index.d.ts +5 -0
- package/lib/entities/index.js +22 -0
- package/lib/entities/index.js.map +1 -0
- package/lib/entities/mcp-authorization-code.entity.d.ts +33 -0
- package/lib/entities/mcp-authorization-code.entity.js +77 -0
- package/lib/entities/mcp-authorization-code.entity.js.map +1 -0
- package/lib/entities/mcp-authorization-request.entity.d.ts +31 -0
- package/lib/entities/mcp-authorization-request.entity.js +73 -0
- package/lib/entities/mcp-authorization-request.entity.js.map +1 -0
- package/lib/entities/mcp-oauth-client.entity.d.ts +56 -0
- package/lib/entities/mcp-oauth-client.entity.js +70 -0
- package/lib/entities/mcp-oauth-client.entity.js.map +1 -0
- package/lib/entities/mcp-oauth-grant.entity.d.ts +77 -0
- package/lib/entities/mcp-oauth-grant.entity.js +121 -0
- package/lib/entities/mcp-oauth-grant.entity.js.map +1 -0
- package/lib/entities/mcp-tool-call-log.entity.d.ts +50 -0
- package/lib/entities/mcp-tool-call-log.entity.js +101 -0
- package/lib/entities/mcp-tool-call-log.entity.js.map +1 -0
- package/lib/events/mcp-tool-call.event.d.ts +17 -0
- package/lib/events/mcp-tool-call.event.js +23 -0
- package/lib/events/mcp-tool-call.event.js.map +1 -0
- package/lib/get-client-ip.d.ts +2 -0
- package/lib/get-client-ip.js +10 -0
- package/lib/get-client-ip.js.map +1 -0
- package/lib/get-language-code.d.ts +3 -0
- package/lib/get-language-code.js +12 -0
- package/lib/get-language-code.js.map +1 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +26 -0
- package/lib/index.js.map +1 -0
- package/lib/internal-types.d.ts +27 -0
- package/lib/internal-types.js +3 -0
- package/lib/internal-types.js.map +1 -0
- package/lib/logging/mcp-tool-call-log-retention.service.d.ts +8 -0
- package/lib/logging/mcp-tool-call-log-retention.service.js +54 -0
- package/lib/logging/mcp-tool-call-log-retention.service.js.map +1 -0
- package/lib/logging/mcp-tool-call-log.service.d.ts +24 -0
- package/lib/logging/mcp-tool-call-log.service.js +128 -0
- package/lib/logging/mcp-tool-call-log.service.js.map +1 -0
- package/lib/oauth/cimd/cimd-client-resolver.service.d.ts +18 -0
- package/lib/oauth/cimd/cimd-client-resolver.service.js +109 -0
- package/lib/oauth/cimd/cimd-client-resolver.service.js.map +1 -0
- package/lib/oauth/cimd/cimd-document.d.ts +11 -0
- package/lib/oauth/cimd/cimd-document.js +66 -0
- package/lib/oauth/cimd/cimd-document.js.map +1 -0
- package/lib/oauth/cimd/cimd-fetch.d.ts +14 -0
- package/lib/oauth/cimd/cimd-fetch.js +192 -0
- package/lib/oauth/cimd/cimd-fetch.js.map +1 -0
- package/lib/oauth/cimd/cimd-url.d.ts +5 -0
- package/lib/oauth/cimd/cimd-url.js +94 -0
- package/lib/oauth/cimd/cimd-url.js.map +1 -0
- package/lib/oauth/grant-session.service.d.ts +19 -0
- package/lib/oauth/grant-session.service.js +141 -0
- package/lib/oauth/grant-session.service.js.map +1 -0
- package/lib/oauth/oauth-error.d.ts +18 -0
- package/lib/oauth/oauth-error.js +60 -0
- package/lib/oauth/oauth-error.js.map +1 -0
- package/lib/oauth/oauth-metadata.service.d.ts +34 -0
- package/lib/oauth/oauth-metadata.service.js +107 -0
- package/lib/oauth/oauth-metadata.service.js.map +1 -0
- package/lib/oauth/oauth-retention.service.d.ts +23 -0
- package/lib/oauth/oauth-retention.service.js +103 -0
- package/lib/oauth/oauth-retention.service.js.map +1 -0
- package/lib/oauth/oauth-types.d.ts +61 -0
- package/lib/oauth/oauth-types.js +32 -0
- package/lib/oauth/oauth-types.js.map +1 -0
- package/lib/oauth/oauth-utils.d.ts +20 -0
- package/lib/oauth/oauth-utils.js +111 -0
- package/lib/oauth/oauth-utils.js.map +1 -0
- package/lib/oauth/oauth.controller.d.ts +31 -0
- package/lib/oauth/oauth.controller.js +132 -0
- package/lib/oauth/oauth.controller.js.map +1 -0
- package/lib/oauth/oauth.service.d.ts +69 -0
- package/lib/oauth/oauth.service.js +650 -0
- package/lib/oauth/oauth.service.js.map +1 -0
- package/lib/oauth/token-hash.d.ts +6 -0
- package/lib/oauth/token-hash.js +21 -0
- package/lib/oauth/token-hash.js.map +1 -0
- package/lib/plugin.d.ts +54 -0
- package/lib/plugin.js +171 -0
- package/lib/plugin.js.map +1 -0
- package/lib/rate-limit/ip-bucket-key.d.ts +1 -0
- package/lib/rate-limit/ip-bucket-key.js +35 -0
- package/lib/rate-limit/ip-bucket-key.js.map +1 -0
- package/lib/rate-limit/mcp-oauth-rate-limit.guard.d.ts +20 -0
- package/lib/rate-limit/mcp-oauth-rate-limit.guard.js +63 -0
- package/lib/rate-limit/mcp-oauth-rate-limit.guard.js.map +1 -0
- package/lib/rate-limit/mcp-rate-limiter.service.d.ts +47 -0
- package/lib/rate-limit/mcp-rate-limiter.service.js +248 -0
- package/lib/rate-limit/mcp-rate-limiter.service.js.map +1 -0
- package/lib/registry/bm25.d.ts +12 -0
- package/lib/registry/bm25.js +60 -0
- package/lib/registry/bm25.js.map +1 -0
- package/lib/registry/mcp-tool-execution.service.d.ts +45 -0
- package/lib/registry/mcp-tool-execution.service.js +72 -0
- package/lib/registry/mcp-tool-execution.service.js.map +1 -0
- package/lib/registry/mcp-tool-registry.service.d.ts +89 -0
- package/lib/registry/mcp-tool-registry.service.js +668 -0
- package/lib/registry/mcp-tool-registry.service.js.map +1 -0
- package/lib/registry/mcp-tool-schema.service.d.ts +42 -0
- package/lib/registry/mcp-tool-schema.service.js +229 -0
- package/lib/registry/mcp-tool-schema.service.js.map +1 -0
- package/lib/registry/registry-types.d.ts +32 -0
- package/lib/registry/registry-types.js +3 -0
- package/lib/registry/registry-types.js.map +1 -0
- package/lib/resolve-options.d.ts +7 -0
- package/lib/resolve-options.js +85 -0
- package/lib/resolve-options.js.map +1 -0
- package/lib/shared/endpoint-paths.d.ts +8 -0
- package/lib/shared/endpoint-paths.js +12 -0
- package/lib/shared/endpoint-paths.js.map +1 -0
- package/lib/shared/loopback.d.ts +2 -0
- package/lib/shared/loopback.js +9 -0
- package/lib/shared/loopback.js.map +1 -0
- package/lib/shop-session/mcp-shop-session.service.d.ts +47 -0
- package/lib/shop-session/mcp-shop-session.service.js +132 -0
- package/lib/shop-session/mcp-shop-session.service.js.map +1 -0
- package/lib/tasks/mcp-oauth-retention.task.d.ts +9 -0
- package/lib/tasks/mcp-oauth-retention.task.js +21 -0
- package/lib/tasks/mcp-oauth-retention.task.js.map +1 -0
- package/lib/tasks/mcp-tool-call-log-retention.task.d.ts +7 -0
- package/lib/tasks/mcp-tool-call-log-retention.task.js +22 -0
- package/lib/tasks/mcp-tool-call-log-retention.task.js.map +1 -0
- package/lib/tools/built-in/active-order.service.d.ts +26 -0
- package/lib/tools/built-in/active-order.service.js +125 -0
- package/lib/tools/built-in/active-order.service.js.map +1 -0
- package/lib/tools/built-in/admin/add-customer-to-group.tool.d.ts +23 -0
- package/lib/tools/built-in/admin/add-customer-to-group.tool.js +68 -0
- package/lib/tools/built-in/admin/add-customer-to-group.tool.js.map +1 -0
- package/lib/tools/built-in/admin/add-note-to-order.tool.d.ts +104 -0
- package/lib/tools/built-in/admin/add-note-to-order.tool.js +66 -0
- package/lib/tools/built-in/admin/add-note-to-order.tool.js.map +1 -0
- package/lib/tools/built-in/admin/adjust-stock.tool.d.ts +26 -0
- package/lib/tools/built-in/admin/adjust-stock.tool.js +88 -0
- package/lib/tools/built-in/admin/adjust-stock.tool.js.map +1 -0
- package/lib/tools/built-in/admin/cancel-order.tool.d.ts +17 -0
- package/lib/tools/built-in/admin/cancel-order.tool.js +60 -0
- package/lib/tools/built-in/admin/cancel-order.tool.js.map +1 -0
- package/lib/tools/built-in/admin/channel-access.d.ts +2 -0
- package/lib/tools/built-in/admin/channel-access.js +9 -0
- package/lib/tools/built-in/admin/channel-access.js.map +1 -0
- package/lib/tools/built-in/admin/create-customer.tool.d.ts +41 -0
- package/lib/tools/built-in/admin/create-customer.tool.js +57 -0
- package/lib/tools/built-in/admin/create-customer.tool.js.map +1 -0
- package/lib/tools/built-in/admin/create-fulfillment.tool.d.ts +118 -0
- package/lib/tools/built-in/admin/create-fulfillment.tool.js +156 -0
- package/lib/tools/built-in/admin/create-fulfillment.tool.js.map +1 -0
- package/lib/tools/built-in/admin/create-product.tool.d.ts +52 -0
- package/lib/tools/built-in/admin/create-product.tool.js +61 -0
- package/lib/tools/built-in/admin/create-product.tool.js.map +1 -0
- package/lib/tools/built-in/admin/create-variant.tool.d.ts +48 -0
- package/lib/tools/built-in/admin/create-variant.tool.js +79 -0
- package/lib/tools/built-in/admin/create-variant.tool.js.map +1 -0
- package/lib/tools/built-in/admin/entity-field-schemas.d.ts +36 -0
- package/lib/tools/built-in/admin/entity-field-schemas.js +63 -0
- package/lib/tools/built-in/admin/entity-field-schemas.js.map +1 -0
- package/lib/tools/built-in/admin/get-customer.tool.d.ts +28 -0
- package/lib/tools/built-in/admin/get-customer.tool.js +55 -0
- package/lib/tools/built-in/admin/get-customer.tool.js.map +1 -0
- package/lib/tools/built-in/admin/get-order.tool.d.ts +100 -0
- package/lib/tools/built-in/admin/get-order.tool.js +68 -0
- package/lib/tools/built-in/admin/get-order.tool.js.map +1 -0
- package/lib/tools/built-in/admin/get-product.tool.d.ts +69 -0
- package/lib/tools/built-in/admin/get-product.tool.js +77 -0
- package/lib/tools/built-in/admin/get-product.tool.js.map +1 -0
- package/lib/tools/built-in/admin/get-stock-levels.tool.d.ts +23 -0
- package/lib/tools/built-in/admin/get-stock-levels.tool.js +61 -0
- package/lib/tools/built-in/admin/get-stock-levels.tool.js.map +1 -0
- package/lib/tools/built-in/admin/index.d.ts +25 -0
- package/lib/tools/built-in/admin/index.js +54 -0
- package/lib/tools/built-in/admin/index.js.map +1 -0
- package/lib/tools/built-in/admin/list-channels.tool.d.ts +24 -0
- package/lib/tools/built-in/admin/list-channels.tool.js +56 -0
- package/lib/tools/built-in/admin/list-channels.tool.js.map +1 -0
- package/lib/tools/built-in/admin/list-customer-groups.tool.d.ts +23 -0
- package/lib/tools/built-in/admin/list-customer-groups.tool.js +52 -0
- package/lib/tools/built-in/admin/list-customer-groups.tool.js.map +1 -0
- package/lib/tools/built-in/admin/list-customers.tool.d.ts +62 -0
- package/lib/tools/built-in/admin/list-customers.tool.js +66 -0
- package/lib/tools/built-in/admin/list-customers.tool.js.map +1 -0
- package/lib/tools/built-in/admin/list-orders.tool.d.ts +142 -0
- package/lib/tools/built-in/admin/list-orders.tool.js +87 -0
- package/lib/tools/built-in/admin/list-orders.tool.js.map +1 -0
- package/lib/tools/built-in/admin/list-products.tool.d.ts +63 -0
- package/lib/tools/built-in/admin/list-products.tool.js +71 -0
- package/lib/tools/built-in/admin/list-products.tool.js.map +1 -0
- package/lib/tools/built-in/admin/refund-order.tool.d.ts +38 -0
- package/lib/tools/built-in/admin/refund-order.tool.js +115 -0
- package/lib/tools/built-in/admin/refund-order.tool.js.map +1 -0
- package/lib/tools/built-in/admin/set-active-channel.tool.d.ts +22 -0
- package/lib/tools/built-in/admin/set-active-channel.tool.js +84 -0
- package/lib/tools/built-in/admin/set-active-channel.tool.js.map +1 -0
- package/lib/tools/built-in/admin/translation-schemas.d.ts +12 -0
- package/lib/tools/built-in/admin/translation-schemas.js +17 -0
- package/lib/tools/built-in/admin/translation-schemas.js.map +1 -0
- package/lib/tools/built-in/admin/update-customer.tool.d.ts +42 -0
- package/lib/tools/built-in/admin/update-customer.tool.js +59 -0
- package/lib/tools/built-in/admin/update-customer.tool.js.map +1 -0
- package/lib/tools/built-in/admin/update-order-state.tool.d.ts +16 -0
- package/lib/tools/built-in/admin/update-order-state.tool.js +58 -0
- package/lib/tools/built-in/admin/update-order-state.tool.js.map +1 -0
- package/lib/tools/built-in/admin/update-product.tool.d.ts +53 -0
- package/lib/tools/built-in/admin/update-product.tool.js +68 -0
- package/lib/tools/built-in/admin/update-product.tool.js.map +1 -0
- package/lib/tools/built-in/admin/update-variant.tool.d.ts +46 -0
- package/lib/tools/built-in/admin/update-variant.tool.js +77 -0
- package/lib/tools/built-in/admin/update-variant.tool.js.map +1 -0
- package/lib/tools/built-in/admin/upload-asset.tool.d.ts +32 -0
- package/lib/tools/built-in/admin/upload-asset.tool.js +56 -0
- package/lib/tools/built-in/admin/upload-asset.tool.js.map +1 -0
- package/lib/tools/built-in/catalog-query.service.d.ts +21 -0
- package/lib/tools/built-in/catalog-query.service.js +128 -0
- package/lib/tools/built-in/catalog-query.service.js.map +1 -0
- package/lib/tools/built-in/custom-field-input.service.d.ts +10 -0
- package/lib/tools/built-in/custom-field-input.service.js +64 -0
- package/lib/tools/built-in/custom-field-input.service.js.map +1 -0
- package/lib/tools/built-in/email-schema.d.ts +2 -0
- package/lib/tools/built-in/email-schema.js +12 -0
- package/lib/tools/built-in/email-schema.js.map +1 -0
- package/lib/tools/built-in/id-schema.d.ts +3 -0
- package/lib/tools/built-in/id-schema.js +11 -0
- package/lib/tools/built-in/id-schema.js.map +1 -0
- package/lib/tools/built-in/int32-schema.d.ts +4 -0
- package/lib/tools/built-in/int32-schema.js +8 -0
- package/lib/tools/built-in/int32-schema.js.map +1 -0
- package/lib/tools/built-in/list-helpers.d.ts +48 -0
- package/lib/tools/built-in/list-helpers.js +76 -0
- package/lib/tools/built-in/list-helpers.js.map +1 -0
- package/lib/tools/built-in/order-list-helpers.d.ts +20 -0
- package/lib/tools/built-in/order-list-helpers.js +48 -0
- package/lib/tools/built-in/order-list-helpers.js.map +1 -0
- package/lib/tools/built-in/providers.d.ts +2 -0
- package/lib/tools/built-in/providers.js +7 -0
- package/lib/tools/built-in/providers.js.map +1 -0
- package/lib/tools/built-in/remote-asset.d.ts +4 -0
- package/lib/tools/built-in/remote-asset.js +54 -0
- package/lib/tools/built-in/remote-asset.js.map +1 -0
- package/lib/tools/built-in/serializer.service.d.ts +327 -0
- package/lib/tools/built-in/serializer.service.js +413 -0
- package/lib/tools/built-in/serializer.service.js.map +1 -0
- package/lib/tools/built-in/shop/add-to-cart.tool.d.ts +21 -0
- package/lib/tools/built-in/shop/add-to-cart.tool.js +100 -0
- package/lib/tools/built-in/shop/add-to-cart.tool.js.map +1 -0
- package/lib/tools/built-in/shop/address-schema.d.ts +15 -0
- package/lib/tools/built-in/shop/address-schema.js +20 -0
- package/lib/tools/built-in/shop/address-schema.js.map +1 -0
- package/lib/tools/built-in/shop/apply-coupon-code.tool.d.ts +17 -0
- package/lib/tools/built-in/shop/apply-coupon-code.tool.js +62 -0
- package/lib/tools/built-in/shop/apply-coupon-code.tool.js.map +1 -0
- package/lib/tools/built-in/shop/collection-lookup.d.ts +15 -0
- package/lib/tools/built-in/shop/collection-lookup.js +35 -0
- package/lib/tools/built-in/shop/collection-lookup.js.map +1 -0
- package/lib/tools/built-in/shop/get-cart.tool.d.ts +94 -0
- package/lib/tools/built-in/shop/get-cart.tool.js +55 -0
- package/lib/tools/built-in/shop/get-cart.tool.js.map +1 -0
- package/lib/tools/built-in/shop/get-collection.tool.d.ts +42 -0
- package/lib/tools/built-in/shop/get-collection.tool.js +64 -0
- package/lib/tools/built-in/shop/get-collection.tool.js.map +1 -0
- package/lib/tools/built-in/shop/get-eligible-payment-methods.tool.d.ts +26 -0
- package/lib/tools/built-in/shop/get-eligible-payment-methods.tool.js +58 -0
- package/lib/tools/built-in/shop/get-eligible-payment-methods.tool.js.map +1 -0
- package/lib/tools/built-in/shop/get-eligible-shipping-methods.tool.d.ts +30 -0
- package/lib/tools/built-in/shop/get-eligible-shipping-methods.tool.js +59 -0
- package/lib/tools/built-in/shop/get-eligible-shipping-methods.tool.js.map +1 -0
- package/lib/tools/built-in/shop/get-my-account.tool.d.ts +22 -0
- package/lib/tools/built-in/shop/get-my-account.tool.js +57 -0
- package/lib/tools/built-in/shop/get-my-account.tool.js.map +1 -0
- package/lib/tools/built-in/shop/get-order.tool.d.ts +100 -0
- package/lib/tools/built-in/shop/get-order.tool.js +67 -0
- package/lib/tools/built-in/shop/get-order.tool.js.map +1 -0
- package/lib/tools/built-in/shop/get-product.tool.d.ts +57 -0
- package/lib/tools/built-in/shop/get-product.tool.js +81 -0
- package/lib/tools/built-in/shop/get-product.tool.js.map +1 -0
- package/lib/tools/built-in/shop/index.d.ts +19 -0
- package/lib/tools/built-in/shop/index.js +42 -0
- package/lib/tools/built-in/shop/index.js.map +1 -0
- package/lib/tools/built-in/shop/list-collections.tool.d.ts +42 -0
- package/lib/tools/built-in/shop/list-collections.tool.js +75 -0
- package/lib/tools/built-in/shop/list-collections.tool.js.map +1 -0
- package/lib/tools/built-in/shop/list-my-orders.tool.d.ts +100 -0
- package/lib/tools/built-in/shop/list-my-orders.tool.js +63 -0
- package/lib/tools/built-in/shop/list-my-orders.tool.js.map +1 -0
- package/lib/tools/built-in/shop/place-order.tool.d.ts +188 -0
- package/lib/tools/built-in/shop/place-order.tool.js +152 -0
- package/lib/tools/built-in/shop/place-order.tool.js.map +1 -0
- package/lib/tools/built-in/shop/product-search-query.d.ts +4 -0
- package/lib/tools/built-in/shop/product-search-query.js +34 -0
- package/lib/tools/built-in/shop/product-search-query.js.map +1 -0
- package/lib/tools/built-in/shop/remove-coupon-code.tool.d.ts +17 -0
- package/lib/tools/built-in/shop/remove-coupon-code.tool.js +63 -0
- package/lib/tools/built-in/shop/remove-coupon-code.tool.js.map +1 -0
- package/lib/tools/built-in/shop/remove-from-cart.tool.d.ts +17 -0
- package/lib/tools/built-in/shop/remove-from-cart.tool.js +58 -0
- package/lib/tools/built-in/shop/remove-from-cart.tool.js.map +1 -0
- package/lib/tools/built-in/shop/search-products.tool.d.ts +48 -0
- package/lib/tools/built-in/shop/search-products.tool.js +95 -0
- package/lib/tools/built-in/shop/search-products.tool.js.map +1 -0
- package/lib/tools/built-in/shop/set-checkout-details.tool.d.ts +56 -0
- package/lib/tools/built-in/shop/set-checkout-details.tool.js +187 -0
- package/lib/tools/built-in/shop/set-checkout-details.tool.js.map +1 -0
- package/lib/tools/built-in/shop/set-shipping-method.tool.d.ts +17 -0
- package/lib/tools/built-in/shop/set-shipping-method.tool.js +58 -0
- package/lib/tools/built-in/shop/set-shipping-method.tool.js.map +1 -0
- package/lib/tools/built-in/shop/update-cart-line.tool.d.ts +18 -0
- package/lib/tools/built-in/shop/update-cart-line.tool.js +60 -0
- package/lib/tools/built-in/shop/update-cart-line.tool.js.map +1 -0
- package/lib/tools/built-in/string-schemas.d.ts +4 -0
- package/lib/tools/built-in/string-schemas.js +13 -0
- package/lib/tools/built-in/string-schemas.js.map +1 -0
- package/lib/transport/mcp-server.factory.d.ts +13 -0
- package/lib/transport/mcp-server.factory.js +32 -0
- package/lib/transport/mcp-server.factory.js.map +1 -0
- package/lib/transport/mcp-transport.controller.d.ts +77 -0
- package/lib/transport/mcp-transport.controller.js +442 -0
- package/lib/transport/mcp-transport.controller.js.map +1 -0
- package/lib/types.d.ts +432 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/package.json +42 -0
- package/src/dashboard/components/activity-block.tsx +72 -0
- package/src/dashboard/components/actor-cell.tsx +31 -0
- package/src/dashboard/components/connection-dialog.tsx +106 -0
- package/src/dashboard/components/empty-cell.tsx +7 -0
- package/src/dashboard/components/grants-block.tsx +218 -0
- package/src/dashboard/components/stats-block.tsx +275 -0
- package/src/dashboard/components/tools-block.tsx +274 -0
- package/src/dashboard/components/tooltip-button.tsx +28 -0
- package/src/dashboard/components/use-mcp-table-state.ts +47 -0
- package/src/dashboard/i18n/ar.po +311 -0
- package/src/dashboard/i18n/bg.po +311 -0
- package/src/dashboard/i18n/cs.po +311 -0
- package/src/dashboard/i18n/de.po +311 -0
- package/src/dashboard/i18n/en.po +311 -0
- package/src/dashboard/i18n/es.po +311 -0
- package/src/dashboard/i18n/fa.po +311 -0
- package/src/dashboard/i18n/fr.po +311 -0
- package/src/dashboard/i18n/he.po +311 -0
- package/src/dashboard/i18n/hr.po +311 -0
- package/src/dashboard/i18n/hu.po +311 -0
- package/src/dashboard/i18n/it.po +311 -0
- package/src/dashboard/i18n/ja.po +311 -0
- package/src/dashboard/i18n/ko.po +311 -0
- package/src/dashboard/i18n/nb.po +311 -0
- package/src/dashboard/i18n/ne.po +311 -0
- package/src/dashboard/i18n/nl.po +311 -0
- package/src/dashboard/i18n/pl.po +311 -0
- package/src/dashboard/i18n/pt_BR.po +311 -0
- package/src/dashboard/i18n/pt_PT.po +311 -0
- package/src/dashboard/i18n/ro.po +311 -0
- package/src/dashboard/i18n/ru.po +311 -0
- package/src/dashboard/i18n/sv.po +311 -0
- package/src/dashboard/i18n/tr.po +311 -0
- package/src/dashboard/i18n/uk.po +311 -0
- package/src/dashboard/i18n/uz.po +311 -0
- package/src/dashboard/i18n/zh_Hans.po +311 -0
- package/src/dashboard/i18n/zh_Hant.po +311 -0
- package/src/dashboard/index.tsx +30 -0
- package/src/dashboard/mcp-activity-route.tsx +38 -0
- package/src/dashboard/mcp-authorize-route.tsx +369 -0
- package/src/dashboard/mcp-grants-route.tsx +38 -0
- package/src/dashboard/mcp-overview-route.tsx +46 -0
- package/src/dashboard/mcp-server-redirect-route.tsx +15 -0
- package/src/dashboard/mcp-tools-route.tsx +38 -0
- package/src/dashboard/mcp.graphql.ts +127 -0
- package/src/dashboard/published-files.spec.ts +54 -0
- package/src/dashboard/tsconfig.json +9 -0
- package/src/shared/endpoint-paths.ts +8 -0
- package/src/shared/loopback.ts +6 -0
|
@@ -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 removeFromCartInput: z.ZodObject<{
|
|
7
|
+
orderLineId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
type RemoveFromCartInput = z.infer<typeof removeFromCartInput>;
|
|
10
|
+
export declare class RemoveFromCartTool implements McpToolHandler<RemoveFromCartInput> {
|
|
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: RemoveFromCartInput): Promise<Record<string, unknown>>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
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.RemoveFromCartTool = 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 id_schema_1 = require("../id-schema");
|
|
19
|
+
const serializer_service_1 = require("../serializer.service");
|
|
20
|
+
const removeFromCartInput = zod_1.z.strictObject({
|
|
21
|
+
orderLineId: id_schema_1.idSchema.describe('Order line ID.'),
|
|
22
|
+
});
|
|
23
|
+
let RemoveFromCartTool = class RemoveFromCartTool {
|
|
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.findOrThrow(ctx);
|
|
31
|
+
return this.serializer.orderOrError(await this.orderService.removeItemFromOrder(order.ctx, order.id, input.orderLineId));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
exports.RemoveFromCartTool = RemoveFromCartTool;
|
|
35
|
+
exports.RemoveFromCartTool = RemoveFromCartTool = __decorate([
|
|
36
|
+
(0, mcp_sdk_1.McpTool)({
|
|
37
|
+
name: 'remove_from_cart',
|
|
38
|
+
toolset: 'shop',
|
|
39
|
+
description: 'Remove a line from the active cart.',
|
|
40
|
+
keywords: [
|
|
41
|
+
'take this out of my basket',
|
|
42
|
+
'delete an item from my cart',
|
|
43
|
+
'remove this product',
|
|
44
|
+
"I don't want this anymore",
|
|
45
|
+
'drop a line from my order',
|
|
46
|
+
'get rid of a cart item',
|
|
47
|
+
],
|
|
48
|
+
permissions: [core_1.Permission.Public],
|
|
49
|
+
behavior: 'mutating',
|
|
50
|
+
usesActiveOrder: true,
|
|
51
|
+
inputSchema: removeFromCartInput,
|
|
52
|
+
}),
|
|
53
|
+
(0, common_1.Injectable)(),
|
|
54
|
+
__metadata("design:paramtypes", [active_order_service_1.McpActiveOrderService,
|
|
55
|
+
core_1.OrderService,
|
|
56
|
+
serializer_service_1.McpToolSerializerService])
|
|
57
|
+
], RemoveFromCartTool);
|
|
58
|
+
//# sourceMappingURL=remove-from-cart.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-from-cart.tool.js","sourceRoot":"","sources":["../../../../src/tools/built-in/shop/remove-from-cart.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,wCAAyE;AACzE,8CAA2D;AAC3D,6BAAwB;AAExB,kEAAgE;AAChE,4CAAwC;AACxC,8DAAiE;AAEjE,MAAM,mBAAmB,GAAG,OAAC,CAAC,YAAY,CAAC;IACvC,WAAW,EAAE,oBAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC;CACnD,CAAC,CAAC;AAsBI,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC3B,YACqB,WAAkC,EAClC,YAA0B,EAC1B,UAAoC;QAFpC,gBAAW,GAAX,WAAW,CAAuB;QAClC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,eAAU,GAAV,UAAU,CAA0B;IACtD,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,GAAmB,EAAE,KAA0B;QACzD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,CAC/B,MAAM,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,WAAW,CAAC,CACtF,CAAC;IACN,CAAC;CACJ,CAAA;AAbY,gDAAkB;6BAAlB,kBAAkB;IAlB9B,IAAA,iBAAO,EAAC;QACL,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,MAAM;QACf,WAAW,EAAE,qCAAqC;QAClD,QAAQ,EAAE;YACN,4BAA4B;YAC5B,6BAA6B;YAC7B,qBAAqB;YACrB,2BAA2B;YAC3B,2BAA2B;YAC3B,wBAAwB;SAC3B;QACD,WAAW,EAAE,CAAC,iBAAU,CAAC,MAAM,CAAC;QAChC,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,mBAAmB;KACnC,CAAC;IACD,IAAA,mBAAU,GAAE;qCAGyB,4CAAqB;QACpB,mBAAY;QACd,6CAAwB;GAJhD,kBAAkB,CAa9B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { CollectionService, ID, RequestContext } from '@vendure/core';
|
|
2
|
+
import { McpToolHandler } from '@vendure/mcp-sdk';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { McpCatalogQueryService } from '../catalog-query.service';
|
|
5
|
+
import { McpToolSerializerService } from '../serializer.service';
|
|
6
|
+
declare const searchProductsInput: z.ZodObject<{
|
|
7
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
query: z.ZodOptional<z.ZodString>;
|
|
10
|
+
collectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
11
|
+
collectionSlug: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
type SearchProductsInput = z.infer<typeof searchProductsInput>;
|
|
14
|
+
export declare class SearchProductsTool implements McpToolHandler<SearchProductsInput> {
|
|
15
|
+
private readonly collectionService;
|
|
16
|
+
private readonly catalog;
|
|
17
|
+
private readonly serializer;
|
|
18
|
+
constructor(collectionService: CollectionService, catalog: McpCatalogQueryService, serializer: McpToolSerializerService);
|
|
19
|
+
execute(ctx: RequestContext, input: SearchProductsInput): Promise<{
|
|
20
|
+
items: {
|
|
21
|
+
id: ID;
|
|
22
|
+
name: import("@vendure/core").LocaleString;
|
|
23
|
+
slug: import("@vendure/core").LocaleString;
|
|
24
|
+
description: string;
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
featuredAsset: {
|
|
27
|
+
id: ID;
|
|
28
|
+
preview: string;
|
|
29
|
+
} | null;
|
|
30
|
+
priceRange: {
|
|
31
|
+
min: number;
|
|
32
|
+
minDecimal: string;
|
|
33
|
+
max: number;
|
|
34
|
+
maxDecimal: string;
|
|
35
|
+
currencyCode: import("@vendure/core").CurrencyCode;
|
|
36
|
+
} | null;
|
|
37
|
+
}[];
|
|
38
|
+
total: number;
|
|
39
|
+
hasMore: boolean;
|
|
40
|
+
} | {
|
|
41
|
+
message: string;
|
|
42
|
+
items: never[];
|
|
43
|
+
total: number;
|
|
44
|
+
hasMore: boolean;
|
|
45
|
+
}>;
|
|
46
|
+
private findProducts;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
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.SearchProductsTool = 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 catalog_query_service_1 = require("../catalog-query.service");
|
|
18
|
+
const id_schema_1 = require("../id-schema");
|
|
19
|
+
const list_helpers_1 = require("../list-helpers");
|
|
20
|
+
const serializer_service_1 = require("../serializer.service");
|
|
21
|
+
const string_schemas_1 = require("../string-schemas");
|
|
22
|
+
const collection_lookup_1 = require("./collection-lookup");
|
|
23
|
+
const product_search_query_1 = require("./product-search-query");
|
|
24
|
+
// Each word adds two LIKE conditions to the query, and a long query matches nothing anyway.
|
|
25
|
+
const MAX_QUERY_LENGTH = 200;
|
|
26
|
+
const MAX_QUERY_WORDS = 10;
|
|
27
|
+
const searchProductsInput = zod_1.z
|
|
28
|
+
.strictObject(Object.assign({ query: string_schemas_1.shortText
|
|
29
|
+
.max(MAX_QUERY_LENGTH)
|
|
30
|
+
.refine(value => (0, product_search_query_1.productSearchWords)(value).length <= MAX_QUERY_WORDS, `Use at most ${MAX_QUERY_WORDS} words.`)
|
|
31
|
+
.describe('Text to look up in product names and slugs.')
|
|
32
|
+
.optional(), collectionId: id_schema_1.idSchema
|
|
33
|
+
.describe('Only products in this collection. Take the id from list_collections or get_collection.')
|
|
34
|
+
.optional(), collectionSlug: string_schemas_1.shortText
|
|
35
|
+
.describe('Only products in this collection. Take the slug from list_collections or get_collection.')
|
|
36
|
+
.optional() }, (0, list_helpers_1.paginationFields)('products')))
|
|
37
|
+
.refine(input => !(input.collectionId != null && input.collectionSlug != null), {
|
|
38
|
+
message: 'Pass collectionId or collectionSlug, not both.',
|
|
39
|
+
});
|
|
40
|
+
let SearchProductsTool = class SearchProductsTool {
|
|
41
|
+
constructor(collectionService, catalog, serializer) {
|
|
42
|
+
this.collectionService = collectionService;
|
|
43
|
+
this.catalog = catalog;
|
|
44
|
+
this.serializer = serializer;
|
|
45
|
+
}
|
|
46
|
+
async execute(ctx, input) {
|
|
47
|
+
let collectionId;
|
|
48
|
+
const lookup = (0, collection_lookup_1.collectionLookup)(input.collectionId, input.collectionSlug);
|
|
49
|
+
if (lookup) {
|
|
50
|
+
const collection = await (0, collection_lookup_1.findPublicCollection)(this.collectionService, ctx, lookup);
|
|
51
|
+
if (!collection) {
|
|
52
|
+
return Object.assign(Object.assign({}, (0, list_helpers_1.page)([], 0, input)), { message: (0, collection_lookup_1.noCollectionMessage)(lookup) });
|
|
53
|
+
}
|
|
54
|
+
collectionId = collection.id;
|
|
55
|
+
}
|
|
56
|
+
const words = (0, product_search_query_1.productSearchWords)(input.query);
|
|
57
|
+
const singularWords = (0, product_search_query_1.productSearchWords)(input.query, true);
|
|
58
|
+
let result = await this.findProducts(ctx, input, words, collectionId);
|
|
59
|
+
// A plural like "cameras" won't match "Instant Camera", so retry once with plurals trimmed.
|
|
60
|
+
if (result.totalItems === 0 && singularWords.join(' ') !== words.join(' ')) {
|
|
61
|
+
result = await this.findProducts(ctx, input, singularWords, collectionId);
|
|
62
|
+
}
|
|
63
|
+
const variantsByProduct = await this.catalog.variantsByProductId(ctx, result.items.map(product => product.id), { includeDisabled: false });
|
|
64
|
+
return (0, list_helpers_1.page)(result.items.map(product => { var _a; return this.serializer.productListItem(product, (_a = variantsByProduct.get(String(product.id))) !== null && _a !== void 0 ? _a : []); }), result.totalItems, input);
|
|
65
|
+
}
|
|
66
|
+
findProducts(ctx, input, words, collectionId) {
|
|
67
|
+
return this.catalog.findPublicProducts(ctx, (0, product_search_query_1.publicProductListOptions)(input, words), collectionId);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
exports.SearchProductsTool = SearchProductsTool;
|
|
71
|
+
exports.SearchProductsTool = SearchProductsTool = __decorate([
|
|
72
|
+
(0, mcp_sdk_1.McpTool)({
|
|
73
|
+
name: 'search_products',
|
|
74
|
+
toolset: 'shop',
|
|
75
|
+
description: 'Find products by name, optionally within one collection. Every word must appear in the name ' +
|
|
76
|
+
'or slug, and descriptions are not searched. If nothing comes back, try fewer or more general words.',
|
|
77
|
+
keywords: [
|
|
78
|
+
'find a product',
|
|
79
|
+
'search the store',
|
|
80
|
+
'do you sell',
|
|
81
|
+
'look for an item by name',
|
|
82
|
+
'search for something to buy',
|
|
83
|
+
'hunt for a product',
|
|
84
|
+
'products in a category',
|
|
85
|
+
],
|
|
86
|
+
permissions: [core_1.Permission.Public],
|
|
87
|
+
behavior: 'readonly',
|
|
88
|
+
inputSchema: searchProductsInput,
|
|
89
|
+
}),
|
|
90
|
+
(0, common_1.Injectable)(),
|
|
91
|
+
__metadata("design:paramtypes", [core_1.CollectionService,
|
|
92
|
+
catalog_query_service_1.McpCatalogQueryService,
|
|
93
|
+
serializer_service_1.McpToolSerializerService])
|
|
94
|
+
], SearchProductsTool);
|
|
95
|
+
//# sourceMappingURL=search-products.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-products.tool.js","sourceRoot":"","sources":["../../../../src/tools/built-in/shop/search-products.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,wCAAkF;AAClF,8CAA2D;AAC3D,6BAAwB;AAExB,oEAAkE;AAClE,4CAAwC;AACxC,kDAAyD;AACzD,8DAAiE;AACjE,sDAA8C;AAE9C,2DAAkG;AAClG,iEAAsF;AAEtF,4FAA4F;AAC5F,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,MAAM,mBAAmB,GAAG,OAAC;KACxB,YAAY,iBACT,KAAK,EAAE,0BAAS;SACX,GAAG,CAAC,gBAAgB,CAAC;SACrB,MAAM,CACH,KAAK,CAAC,EAAE,CAAC,IAAA,yCAAkB,EAAC,KAAK,CAA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AK,CAAC,EAAE,YAAY,CAAC,CAAC;IACtG,CAAC;CACJ,CAAA;AA/CY,gDAAkB;6BAAlB,kBAAkB;IApB9B,IAAA,iBAAO,EAAC;QACL,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,MAAM;QACf,WAAW,EACP,8FAA8F;YAC9F,qGAAqG;QACzG,QAAQ,EAAE;YACN,gBAAgB;YAChB,kBAAkB;YAClB,aAAa;YACb,0BAA0B;YAC1B,6BAA6B;YAC7B,oBAAoB;YACpB,wBAAwB;SAC3B;QACD,WAAW,EAAE,CAAC,iBAAU,CAAC,MAAM,CAAC;QAChC,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,mBAAmB;KACnC,CAAC;IACD,IAAA,mBAAU,GAAE;qCAG+B,wBAAiB;QAC3B,8CAAsB;QACnB,6CAAwB;GAJhD,kBAAkB,CA+C9B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ConfigService, OrderService, RequestContext, 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 { McpCustomFieldInputService } from '../custom-field-input.service';
|
|
6
|
+
import { McpToolSerializerService } from '../serializer.service';
|
|
7
|
+
declare const setCheckoutDetailsInput: z.ZodObject<{
|
|
8
|
+
shippingAddress: z.ZodOptional<z.ZodObject<{
|
|
9
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
10
|
+
company: z.ZodOptional<z.ZodString>;
|
|
11
|
+
streetLine1: z.ZodString;
|
|
12
|
+
streetLine2: z.ZodOptional<z.ZodString>;
|
|
13
|
+
city: z.ZodOptional<z.ZodString>;
|
|
14
|
+
province: z.ZodOptional<z.ZodString>;
|
|
15
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
16
|
+
countryCode: z.ZodString;
|
|
17
|
+
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
18
|
+
defaultShippingAddress: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
defaultBillingAddress: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
customFields: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
21
|
+
}, z.core.$strict>>;
|
|
22
|
+
billingAddress: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
24
|
+
company: z.ZodOptional<z.ZodString>;
|
|
25
|
+
streetLine1: z.ZodString;
|
|
26
|
+
streetLine2: z.ZodOptional<z.ZodString>;
|
|
27
|
+
city: z.ZodOptional<z.ZodString>;
|
|
28
|
+
province: z.ZodOptional<z.ZodString>;
|
|
29
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
30
|
+
countryCode: z.ZodString;
|
|
31
|
+
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
32
|
+
defaultShippingAddress: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
defaultBillingAddress: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
customFields: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
35
|
+
}, z.core.$strict>>;
|
|
36
|
+
billingSameAsShipping: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
+
customer: z.ZodOptional<z.ZodObject<{
|
|
38
|
+
emailAddress: z.ZodString;
|
|
39
|
+
firstName: z.ZodString;
|
|
40
|
+
lastName: z.ZodString;
|
|
41
|
+
}, z.core.$strict>>;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
type SetCheckoutDetailsInput = z.infer<typeof setCheckoutDetailsInput>;
|
|
44
|
+
export declare class SetCheckoutDetailsTool implements McpToolHandler<SetCheckoutDetailsInput> {
|
|
45
|
+
private readonly activeOrder;
|
|
46
|
+
private readonly orderService;
|
|
47
|
+
private readonly connection;
|
|
48
|
+
private readonly customFieldInput;
|
|
49
|
+
private readonly serializer;
|
|
50
|
+
private readonly configService;
|
|
51
|
+
constructor(activeOrder: McpActiveOrderService, orderService: OrderService, connection: TransactionalConnection, customFieldInput: McpCustomFieldInputService, serializer: McpToolSerializerService, configService: ConfigService);
|
|
52
|
+
execute(ctx: RequestContext, input: SetCheckoutDetailsInput): Promise<Record<string, unknown>>;
|
|
53
|
+
private setGuestCustomer;
|
|
54
|
+
private shippingMethodChange;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,187 @@
|
|
|
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.SetCheckoutDetailsTool = 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 custom_field_input_service_1 = require("../custom-field-input.service");
|
|
19
|
+
const email_schema_1 = require("../email-schema");
|
|
20
|
+
const serializer_service_1 = require("../serializer.service");
|
|
21
|
+
const string_schemas_1 = require("../string-schemas");
|
|
22
|
+
const address_schema_1 = require("./address-schema");
|
|
23
|
+
const setCheckoutDetailsInput = zod_1.z
|
|
24
|
+
.strictObject({
|
|
25
|
+
shippingAddress: address_schema_1.addressInputSchema.describe('Where the order is delivered.').optional(),
|
|
26
|
+
billingAddress: address_schema_1.addressInputSchema.describe('Where the invoice goes.').optional(),
|
|
27
|
+
billingSameAsShipping: zod_1.z
|
|
28
|
+
.boolean()
|
|
29
|
+
.describe('Use the shipping address as the billing address too. Copies shippingAddress from this ' +
|
|
30
|
+
'call, or the shipping address already on the cart. Cannot be combined with billingAddress.')
|
|
31
|
+
.optional(),
|
|
32
|
+
customer: zod_1.z
|
|
33
|
+
.strictObject({
|
|
34
|
+
emailAddress: email_schema_1.emailAddressSchema.describe('Buyer email address.'),
|
|
35
|
+
firstName: string_schemas_1.shortText.describe('Buyer first name.'),
|
|
36
|
+
lastName: string_schemas_1.shortText.describe('Buyer last name.'),
|
|
37
|
+
})
|
|
38
|
+
.describe('Who is buying, for a guest checkout. Not needed when the caller is a signed-in customer.')
|
|
39
|
+
.optional(),
|
|
40
|
+
})
|
|
41
|
+
.refine(input => input.shippingAddress || input.billingAddress || input.billingSameAsShipping || input.customer, {
|
|
42
|
+
message: 'Pass shippingAddress, billingAddress, billingSameAsShipping: true, or customer.',
|
|
43
|
+
})
|
|
44
|
+
.refine(input => !(input.billingAddress && input.billingSameAsShipping), {
|
|
45
|
+
message: 'billingAddress and billingSameAsShipping cannot both be given.',
|
|
46
|
+
});
|
|
47
|
+
let SetCheckoutDetailsTool = class SetCheckoutDetailsTool {
|
|
48
|
+
constructor(activeOrder, orderService, connection, customFieldInput, serializer, configService) {
|
|
49
|
+
this.activeOrder = activeOrder;
|
|
50
|
+
this.orderService = orderService;
|
|
51
|
+
this.connection = connection;
|
|
52
|
+
this.customFieldInput = customFieldInput;
|
|
53
|
+
this.serializer = serializer;
|
|
54
|
+
this.configService = configService;
|
|
55
|
+
}
|
|
56
|
+
async execute(ctx, input) {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
// Core rejects this too, but with a less helpful error; this catches it earlier with a
|
|
59
|
+
// clearer message and before the cart is touched.
|
|
60
|
+
if (input.customer && ctx.activeUserId) {
|
|
61
|
+
throw new core_1.UserInputError('This call is signed in as a customer; omit customer.');
|
|
62
|
+
}
|
|
63
|
+
await this.customFieldInput.assertWritable(ctx, 'Address', (_a = input.shippingAddress) === null || _a === void 0 ? void 0 : _a.customFields);
|
|
64
|
+
await this.customFieldInput.assertWritable(ctx, 'Address', (_b = input.billingAddress) === null || _b === void 0 ? void 0 : _b.customFields);
|
|
65
|
+
const cart = await this.activeOrder.findEditable(ctx);
|
|
66
|
+
if ((0, core_1.isGraphQlErrorResult)(cart)) {
|
|
67
|
+
return this.serializer.orderOrError(cart);
|
|
68
|
+
}
|
|
69
|
+
return this.connection.withTransaction(cart.ctx, async (txCtx) => {
|
|
70
|
+
var _a;
|
|
71
|
+
// The customer relation is loaded so that the answer can show who the cart belongs to.
|
|
72
|
+
const before = await this.orderService.findOne(txCtx, cart.id, ['shippingLines', 'customer']);
|
|
73
|
+
if (!before) {
|
|
74
|
+
// The cart was there a moment ago, so only a concurrent deletion gets here.
|
|
75
|
+
throw new core_1.EntityNotFoundError('Order', cart.id);
|
|
76
|
+
}
|
|
77
|
+
const methodsBefore = shippingMethodIds(before);
|
|
78
|
+
let order = before;
|
|
79
|
+
// Done first: a returned error here doesn't roll back the transaction, so naming the
|
|
80
|
+
// buyer before writing the addresses avoids leaving only the addresses saved on a refusal.
|
|
81
|
+
if (input.customer) {
|
|
82
|
+
const withCustomer = await this.setGuestCustomer(txCtx, before, input.customer);
|
|
83
|
+
if ((0, core_1.isGraphQlErrorResult)(withCustomer)) {
|
|
84
|
+
return this.serializer.orderOrError(withCustomer);
|
|
85
|
+
}
|
|
86
|
+
order = withCustomer;
|
|
87
|
+
}
|
|
88
|
+
if (input.shippingAddress) {
|
|
89
|
+
order = await this.orderService.setShippingAddress(txCtx, cart.id, input.shippingAddress);
|
|
90
|
+
}
|
|
91
|
+
const billingAddress = input.billingSameAsShipping
|
|
92
|
+
? asBillingAddress((_a = input.shippingAddress) !== null && _a !== void 0 ? _a : order === null || order === void 0 ? void 0 : order.shippingAddress)
|
|
93
|
+
: input.billingAddress;
|
|
94
|
+
if (billingAddress) {
|
|
95
|
+
order = await this.orderService.setBillingAddress(txCtx, cart.id, billingAddress);
|
|
96
|
+
}
|
|
97
|
+
return Object.assign({ order: this.serializer.order(order) }, this.shippingMethodChange(methodsBefore, order));
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// Saving the checkout address to the new guest Customer's address book happens in place_order.
|
|
101
|
+
async setGuestCustomer(ctx, order, input) {
|
|
102
|
+
const { guestCheckoutStrategy } = this.configService.orderOptions;
|
|
103
|
+
const customer = await guestCheckoutStrategy.setCustomerForOrder(ctx, order, input);
|
|
104
|
+
if ((0, core_1.isGraphQlErrorResult)(customer)) {
|
|
105
|
+
return customer;
|
|
106
|
+
}
|
|
107
|
+
return this.orderService.addCustomerToOrder(ctx, order.id, customer);
|
|
108
|
+
}
|
|
109
|
+
// Lets the agent tell the shopper when the address change swapped or dropped the shipping method.
|
|
110
|
+
shippingMethodChange(methodsBefore, after) {
|
|
111
|
+
const methodsAfter = shippingMethodIds(after);
|
|
112
|
+
const sameIds = methodsBefore.length === methodsAfter.length &&
|
|
113
|
+
methodsBefore.every((id, index) => id === methodsAfter[index]);
|
|
114
|
+
if (methodsBefore.length === 0 || sameIds) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
const message = methodsAfter.length === 0 ? shippingMethodRemovedMessage : shippingMethodReplacedMessage;
|
|
118
|
+
return { shippingMethodChanged: true, message };
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
exports.SetCheckoutDetailsTool = SetCheckoutDetailsTool;
|
|
122
|
+
exports.SetCheckoutDetailsTool = SetCheckoutDetailsTool = __decorate([
|
|
123
|
+
(0, mcp_sdk_1.McpTool)({
|
|
124
|
+
name: 'set_checkout_details',
|
|
125
|
+
toolset: 'shop',
|
|
126
|
+
description: "Set the cart's shipping address, billing address, or both, and for a guest checkout the " +
|
|
127
|
+
"buyer's email and name, in one call. A guest checkout needs the buyer named here, through " +
|
|
128
|
+
'customer, before place_order will take a payment. Changing the shipping address can make ' +
|
|
129
|
+
'the chosen shipping method ineligible; the response then carries shippingMethodChanged: ' +
|
|
130
|
+
'true and a message saying whether the store swapped the method or dropped it.',
|
|
131
|
+
keywords: [
|
|
132
|
+
'enter my delivery address',
|
|
133
|
+
'where to ship my order',
|
|
134
|
+
'add my shipping details',
|
|
135
|
+
'set where I want it delivered',
|
|
136
|
+
'send it to this address',
|
|
137
|
+
'enter my billing address',
|
|
138
|
+
'where to send the invoice',
|
|
139
|
+
'set the address on my card',
|
|
140
|
+
'billing details for checkout',
|
|
141
|
+
'same address for billing and shipping',
|
|
142
|
+
'check out as a guest',
|
|
143
|
+
'buy without an account',
|
|
144
|
+
],
|
|
145
|
+
permissions: [core_1.Permission.Public],
|
|
146
|
+
behavior: 'mutating',
|
|
147
|
+
usesActiveOrder: true,
|
|
148
|
+
inputSchema: setCheckoutDetailsInput,
|
|
149
|
+
}),
|
|
150
|
+
(0, common_1.Injectable)(),
|
|
151
|
+
__metadata("design:paramtypes", [active_order_service_1.McpActiveOrderService,
|
|
152
|
+
core_1.OrderService,
|
|
153
|
+
core_1.TransactionalConnection,
|
|
154
|
+
custom_field_input_service_1.McpCustomFieldInputService,
|
|
155
|
+
serializer_service_1.McpToolSerializerService,
|
|
156
|
+
core_1.ConfigService])
|
|
157
|
+
], SetCheckoutDetailsTool);
|
|
158
|
+
const shippingMethodReplacedMessage = 'The new shipping address made the chosen shipping method ineligible, so the store replaced it ' +
|
|
159
|
+
'with the cheapest eligible one (see order.shippingLines). Tell the shopper, or call ' +
|
|
160
|
+
'get_eligible_shipping_methods and set_shipping_method to pick another.';
|
|
161
|
+
const shippingMethodRemovedMessage = 'The new shipping address made the chosen shipping method ineligible and no other method is ' +
|
|
162
|
+
'eligible, so the cart has no shipping method. Call get_eligible_shipping_methods and ' +
|
|
163
|
+
'set_shipping_method again before place_order.';
|
|
164
|
+
function shippingMethodIds(order) {
|
|
165
|
+
var _a;
|
|
166
|
+
return ((_a = order === null || order === void 0 ? void 0 : order.shippingLines) !== null && _a !== void 0 ? _a : []).map(line => String(line.shippingMethodId)).sort();
|
|
167
|
+
}
|
|
168
|
+
function asBillingAddress(source) {
|
|
169
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
170
|
+
if (!(source === null || source === void 0 ? void 0 : source.streetLine1) || !source.countryCode) {
|
|
171
|
+
throw new core_1.UserInputError('billingSameAsShipping needs a shipping address: pass shippingAddress in the same call, or ' +
|
|
172
|
+
'set one first.');
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
fullName: (_a = source.fullName) !== null && _a !== void 0 ? _a : undefined,
|
|
176
|
+
company: (_b = source.company) !== null && _b !== void 0 ? _b : undefined,
|
|
177
|
+
streetLine1: source.streetLine1,
|
|
178
|
+
streetLine2: (_c = source.streetLine2) !== null && _c !== void 0 ? _c : undefined,
|
|
179
|
+
city: (_d = source.city) !== null && _d !== void 0 ? _d : undefined,
|
|
180
|
+
province: (_e = source.province) !== null && _e !== void 0 ? _e : undefined,
|
|
181
|
+
postalCode: (_f = source.postalCode) !== null && _f !== void 0 ? _f : undefined,
|
|
182
|
+
countryCode: source.countryCode,
|
|
183
|
+
phoneNumber: (_g = source.phoneNumber) !== null && _g !== void 0 ? _g : undefined,
|
|
184
|
+
customFields: (_h = source.customFields) !== null && _h !== void 0 ? _h : undefined,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=set-checkout-details.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-checkout-details.tool.js","sourceRoot":"","sources":["../../../../src/tools/built-in/shop/set-checkout-details.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,wCAWuB;AACvB,8CAA2D;AAC3D,6BAAwB;AAExB,kEAAg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AAW,EAAE,MAAA,MAAM,CAAC,WAAW,mCAAI,SAAS;QAC5C,IAAI,EAAE,MAAA,MAAM,CAAC,IAAI,mCAAI,SAAS;QAC9B,QAAQ,EAAE,MAAA,MAAM,CAAC,QAAQ,mCAAI,SAAS;QACtC,UAAU,EAAE,MAAA,MAAM,CAAC,UAAU,mCAAI,SAAS;QAC1C,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,WAAW,EAAE,MAAA,MAAM,CAAC,WAAW,mCAAI,SAAS;QAC5C,YAAY,EAAE,MAAA,MAAM,CAAC,YAAY,mCAAI,SAAS;KACjD,CAAC;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 setShippingMethodInput: z.ZodObject<{
|
|
7
|
+
methodId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
type SetShippingMethodInput = z.infer<typeof setShippingMethodInput>;
|
|
10
|
+
export declare class SetShippingMethodTool implements McpToolHandler<SetShippingMethodInput> {
|
|
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: SetShippingMethodInput): Promise<Record<string, unknown>>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
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.SetShippingMethodTool = 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 id_schema_1 = require("../id-schema");
|
|
19
|
+
const serializer_service_1 = require("../serializer.service");
|
|
20
|
+
const setShippingMethodInput = zod_1.z.strictObject({
|
|
21
|
+
methodId: id_schema_1.idSchema.describe('Shipping method ID.'),
|
|
22
|
+
});
|
|
23
|
+
let SetShippingMethodTool = class SetShippingMethodTool {
|
|
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.findOrThrow(ctx);
|
|
31
|
+
return this.serializer.orderOrError(await this.orderService.setShippingMethod(order.ctx, order.id, [input.methodId]));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
exports.SetShippingMethodTool = SetShippingMethodTool;
|
|
35
|
+
exports.SetShippingMethodTool = SetShippingMethodTool = __decorate([
|
|
36
|
+
(0, mcp_sdk_1.McpTool)({
|
|
37
|
+
name: 'set_shipping_method',
|
|
38
|
+
toolset: 'shop',
|
|
39
|
+
description: 'Set the shipping method for the active cart.',
|
|
40
|
+
keywords: [
|
|
41
|
+
'choose a delivery option',
|
|
42
|
+
'pick how it ships',
|
|
43
|
+
'select express or standard',
|
|
44
|
+
'set my postage choice',
|
|
45
|
+
'select a courier',
|
|
46
|
+
'how I want my order delivered',
|
|
47
|
+
],
|
|
48
|
+
permissions: [core_1.Permission.Public],
|
|
49
|
+
behavior: 'mutating',
|
|
50
|
+
usesActiveOrder: true,
|
|
51
|
+
inputSchema: setShippingMethodInput,
|
|
52
|
+
}),
|
|
53
|
+
(0, common_1.Injectable)(),
|
|
54
|
+
__metadata("design:paramtypes", [active_order_service_1.McpActiveOrderService,
|
|
55
|
+
core_1.OrderService,
|
|
56
|
+
serializer_service_1.McpToolSerializerService])
|
|
57
|
+
], SetShippingMethodTool);
|
|
58
|
+
//# sourceMappingURL=set-shipping-method.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-shipping-method.tool.js","sourceRoot":"","sources":["../../../../src/tools/built-in/shop/set-shipping-method.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,wCAAyE;AACzE,8CAA2D;AAC3D,6BAAwB;AAExB,kEAAgE;AAChE,4CAAwC;AACxC,8DAAiE;AAEjE,MAAM,sBAAsB,GAAG,OAAC,CAAC,YAAY,CAAC;IAC1C,QAAQ,EAAE,oBAAQ,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CACrD,CAAC,CAAC;AAsBI,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAC9B,YACqB,WAAkC,EAClC,YAA0B,EAC1B,UAAoC;QAFpC,gBAAW,GAAX,WAAW,CAAuB;QAClC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,eAAU,GAAV,UAAU,CAA0B;IACtD,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,GAAmB,EAAE,KAA6B;QAC5D,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,CAC/B,MAAM,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CACnF,CAAC;IACN,CAAC;CACJ,CAAA;AAbY,sDAAqB;gCAArB,qBAAqB;IAlBjC,IAAA,iBAAO,EAAC;QACL,IAAI,EAAE,qBAAqB;QAC3B,OAAO,EAAE,MAAM;QACf,WAAW,EAAE,8CAA8C;QAC3D,QAAQ,EAAE;YACN,0BAA0B;YAC1B,mBAAmB;YACnB,4BAA4B;YAC5B,uBAAuB;YACvB,kBAAkB;YAClB,+BAA+B;SAClC;QACD,WAAW,EAAE,CAAC,iBAAU,CAAC,MAAM,CAAC;QAChC,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,sBAAsB;KACtC,CAAC;IACD,IAAA,mBAAU,GAAE;qCAGyB,4CAAqB;QACpB,mBAAY;QACd,6CAAwB;GAJhD,qBAAqB,CAajC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 updateCartLineInput: z.ZodObject<{
|
|
7
|
+
orderLineId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
8
|
+
quantity: z.ZodNumber;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
type UpdateCartLineInput = z.infer<typeof updateCartLineInput>;
|
|
11
|
+
export declare class UpdateCartLineTool implements McpToolHandler<UpdateCartLineInput> {
|
|
12
|
+
private readonly activeOrder;
|
|
13
|
+
private readonly orderService;
|
|
14
|
+
private readonly serializer;
|
|
15
|
+
constructor(activeOrder: McpActiveOrderService, orderService: OrderService, serializer: McpToolSerializerService);
|
|
16
|
+
execute(ctx: RequestContext, input: UpdateCartLineInput): Promise<Record<string, unknown>>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|