@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,132 @@
|
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.McpShopSessionService = void 0;
|
|
24
|
+
const common_1 = require("@nestjs/common");
|
|
25
|
+
const core_1 = require("@vendure/core");
|
|
26
|
+
const REFUSAL = {
|
|
27
|
+
signedInUser: 'This session token belongs to a signed-in user and cannot be used for anonymous shop access.',
|
|
28
|
+
unknownToken: 'This sessionToken is not valid or has expired. Retry the call without sessionToken; ' +
|
|
29
|
+
'a tool that writes to the cart will start a new cart and return a new sessionToken.',
|
|
30
|
+
authenticatedCall: 'This call is authenticated, so it already acts on the signed-in customer. ' +
|
|
31
|
+
'sessionToken is only for anonymous shop access, omit it.',
|
|
32
|
+
};
|
|
33
|
+
// Decides which Vendure session an anonymous shop call acts on, whether the token arrives as a tool argument or a header.
|
|
34
|
+
let McpShopSessionService = class McpShopSessionService {
|
|
35
|
+
constructor(sessionService) {
|
|
36
|
+
this.sessionService = sessionService;
|
|
37
|
+
}
|
|
38
|
+
async prepareToolCall(call) {
|
|
39
|
+
const _a = call.input, { sessionToken } = _a, input = __rest(_a, ["sessionToken"]);
|
|
40
|
+
const outcome = await this.resolveForToolCall({
|
|
41
|
+
ctx: call.ctx,
|
|
42
|
+
sessionToken: typeof sessionToken === 'string' ? sessionToken : undefined,
|
|
43
|
+
isOAuthCall: call.isOAuthCall,
|
|
44
|
+
toolWritesToCart: call.toolWritesToCart,
|
|
45
|
+
});
|
|
46
|
+
if (outcome.kind === 'refused') {
|
|
47
|
+
return outcome;
|
|
48
|
+
}
|
|
49
|
+
if (outcome.kind === 'unchanged') {
|
|
50
|
+
return { kind: 'prepared', ctx: call.ctx, input };
|
|
51
|
+
}
|
|
52
|
+
return { kind: 'prepared', ctx: outcome.ctx, input, sessionToken: outcome.sessionToken };
|
|
53
|
+
}
|
|
54
|
+
/** Adds the resolved token without losing handler results that are not plain objects. */
|
|
55
|
+
addSessionTokenToResult(output, sessionToken) {
|
|
56
|
+
if (sessionToken === undefined) {
|
|
57
|
+
return output;
|
|
58
|
+
}
|
|
59
|
+
if (typeof output !== 'object' || output === null || Array.isArray(output)) {
|
|
60
|
+
return { result: output, sessionToken };
|
|
61
|
+
}
|
|
62
|
+
return Object.assign(Object.assign({}, output), { sessionToken });
|
|
63
|
+
}
|
|
64
|
+
/** An explicit `sessionToken` argument wins over the session already on the context. */
|
|
65
|
+
async resolveForToolCall(call) {
|
|
66
|
+
var _a;
|
|
67
|
+
const sessionToken = trimmed(call.sessionToken);
|
|
68
|
+
// An OAuth call already acts on the customer behind the grant; a token argument is a mistake.
|
|
69
|
+
if (call.isOAuthCall) {
|
|
70
|
+
return sessionToken ? refused(REFUSAL.authenticatedCall) : { kind: 'unchanged' };
|
|
71
|
+
}
|
|
72
|
+
// A signed-in customer's context must not be swapped to an anonymous cart by a stale token.
|
|
73
|
+
if (sessionToken && call.ctx.activeUserId != null) {
|
|
74
|
+
return refused(REFUSAL.authenticatedCall);
|
|
75
|
+
}
|
|
76
|
+
// An explicit token must name a live anonymous session.
|
|
77
|
+
if (sessionToken) {
|
|
78
|
+
const session = await this.sessionService.getSessionFromToken(sessionToken);
|
|
79
|
+
if (!session) {
|
|
80
|
+
return refused(REFUSAL.unknownToken);
|
|
81
|
+
}
|
|
82
|
+
if (session.user) {
|
|
83
|
+
return refused(REFUSAL.signedInUser);
|
|
84
|
+
}
|
|
85
|
+
return this.resolved(call.ctx, session);
|
|
86
|
+
}
|
|
87
|
+
// Re-read through the session cache, since an earlier call in the same request may have set the active order.
|
|
88
|
+
const contextToken = (_a = call.ctx.session) === null || _a === void 0 ? void 0 : _a.token;
|
|
89
|
+
if (contextToken) {
|
|
90
|
+
const session = await this.sessionService.getSessionFromToken(contextToken);
|
|
91
|
+
return session ? this.resolved(call.ctx, session) : { kind: 'unchanged' };
|
|
92
|
+
}
|
|
93
|
+
// No session anywhere. Only a cart-writing tool gets one; a readonly tool has nothing to read.
|
|
94
|
+
if (call.toolWritesToCart) {
|
|
95
|
+
return this.resolved(call.ctx, await this.sessionService.createAnonymousSession());
|
|
96
|
+
}
|
|
97
|
+
return { kind: 'unchanged' };
|
|
98
|
+
}
|
|
99
|
+
async resolveHeaderToken(header) {
|
|
100
|
+
const token = trimmed(header);
|
|
101
|
+
const session = token ? await this.sessionService.getSessionFromToken(token) : undefined;
|
|
102
|
+
return (session === null || session === void 0 ? void 0 : session.user)
|
|
103
|
+
? { kind: 'refused', message: REFUSAL.signedInUser }
|
|
104
|
+
: { kind: 'resolved', session };
|
|
105
|
+
}
|
|
106
|
+
resolved(ctx, session) {
|
|
107
|
+
return {
|
|
108
|
+
kind: 'resolved',
|
|
109
|
+
ctx: withSession(ctx, session),
|
|
110
|
+
sessionToken: session.user ? undefined : session.token,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
exports.McpShopSessionService = McpShopSessionService;
|
|
115
|
+
exports.McpShopSessionService = McpShopSessionService = __decorate([
|
|
116
|
+
(0, common_1.Injectable)(),
|
|
117
|
+
__metadata("design:paramtypes", [core_1.SessionService])
|
|
118
|
+
], McpShopSessionService);
|
|
119
|
+
function refused(message) {
|
|
120
|
+
return { kind: 'refused', message };
|
|
121
|
+
}
|
|
122
|
+
/** Agents sometimes pass padding or an empty string; both count as "no token". */
|
|
123
|
+
function trimmed(token) {
|
|
124
|
+
return (token === null || token === void 0 ? void 0 : token.trim()) || undefined;
|
|
125
|
+
}
|
|
126
|
+
// Core swaps a private field the same way (see `_currencyCode` in order.service.ts).
|
|
127
|
+
function withSession(ctx, session) {
|
|
128
|
+
const copy = ctx.copy();
|
|
129
|
+
copy._session = session;
|
|
130
|
+
return copy;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=mcp-shop-session.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-shop-session.service.js","sourceRoot":"","sources":["../../src/shop-session/mcp-shop-session.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,wCAA8E;AAE9E,MAAM,OAAO,GAAG;IACZ,YAAY,EACR,8FAA8F;IAClG,YAAY,EACR,sFAAsF;QACtF,qFAAqF;IACzF,iBAAiB,EACb,4EAA4E;QAC5E,0DAA0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C,OAAe;IAC5B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AACxC,CAAC;AAED,kFAAkF;AAClF,SAAS,OAAO,CAAC,KAAyB;IACtC,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,EAAE,KAAI,SAAS,CAAC;AACtC,CAAC;AAED,qFAAqF;AACrF,SAAS,WAAW,CAAC,GAAmB,EAAE,OAAsB;IAC5D,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACvB,IAAY,CAAC,QAAQ,GAAG,OAAO,CAAC;IACjC,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ScheduledTask } from '@vendure/core';
|
|
2
|
+
/**
|
|
3
|
+
* @description
|
|
4
|
+
* A {@link ScheduledTask} that deletes MCP OAuth records which can no longer be used: the Vendure
|
|
5
|
+
* session for each expired grant, expired authorization requests and codes, grants dead longer
|
|
6
|
+
* than `oauth.grantRetentionDays`, and clients created but never used with no grant referencing
|
|
7
|
+
* them. Defaults to running daily at 03:30AM.
|
|
8
|
+
*/
|
|
9
|
+
export declare const mcpOauthRetentionTask: ScheduledTask<Record<string, any>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mcpOauthRetentionTask = void 0;
|
|
4
|
+
const core_1 = require("@vendure/core");
|
|
5
|
+
const oauth_retention_service_1 = require("../oauth/oauth-retention.service");
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
* A {@link ScheduledTask} that deletes MCP OAuth records which can no longer be used: the Vendure
|
|
9
|
+
* session for each expired grant, expired authorization requests and codes, grants dead longer
|
|
10
|
+
* than `oauth.grantRetentionDays`, and clients created but never used with no grant referencing
|
|
11
|
+
* them. Defaults to running daily at 03:30AM.
|
|
12
|
+
*/
|
|
13
|
+
exports.mcpOauthRetentionTask = new core_1.ScheduledTask({
|
|
14
|
+
id: 'mcp-oauth-retention',
|
|
15
|
+
description: 'Deletes expired MCP OAuth records',
|
|
16
|
+
schedule: cron => cron.everyDayAt(3, 30),
|
|
17
|
+
async execute({ injector, scheduledContext }) {
|
|
18
|
+
return injector.get(oauth_retention_service_1.McpOauthRetentionService).deleteExpiredOauthRecords(scheduledContext);
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=mcp-oauth-retention.task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-oauth-retention.task.js","sourceRoot":"","sources":["../../src/tasks/mcp-oauth-retention.task.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;AAE9C,8EAA4E;AAE5E;;;;;;GAMG;AACU,QAAA,qBAAqB,GAAG,IAAI,oBAAa,CAAC;IACnD,EAAE,EAAE,qBAAqB;IACzB,WAAW,EAAE,mCAAmC;IAChD,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC;IACxC,KAAK,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE;QACxC,OAAO,QAAQ,CAAC,GAAG,CAAC,kDAAwB,CAAC,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,CAAC;IAC9F,CAAC;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ScheduledTask } from '@vendure/core';
|
|
2
|
+
/**
|
|
3
|
+
* @description
|
|
4
|
+
* A {@link ScheduledTask} that deletes expired MCP tool-call logs — rows older than the configured
|
|
5
|
+
* `logging.ttlDays` retention window. The schedule defaults to daily at 02:30AM.
|
|
6
|
+
*/
|
|
7
|
+
export declare const mcpToolCallLogRetentionTask: ScheduledTask<Record<string, any>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mcpToolCallLogRetentionTask = void 0;
|
|
4
|
+
const core_1 = require("@vendure/core");
|
|
5
|
+
const mcp_tool_call_log_retention_service_1 = require("../logging/mcp-tool-call-log-retention.service");
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
* A {@link ScheduledTask} that deletes expired MCP tool-call logs — rows older than the configured
|
|
9
|
+
* `logging.ttlDays` retention window. The schedule defaults to daily at 02:30AM.
|
|
10
|
+
*/
|
|
11
|
+
exports.mcpToolCallLogRetentionTask = new core_1.ScheduledTask({
|
|
12
|
+
id: 'mcp-tool-call-log-retention',
|
|
13
|
+
description: 'Deletes expired MCP tool call logs',
|
|
14
|
+
schedule: cron => cron.everyDayAt(2, 30),
|
|
15
|
+
async execute({ injector, scheduledContext }) {
|
|
16
|
+
const deletedCount = await injector
|
|
17
|
+
.get(mcp_tool_call_log_retention_service_1.McpToolCallLogRetentionService)
|
|
18
|
+
.deleteExpiredToolCallLogs(scheduledContext);
|
|
19
|
+
return { deletedCount };
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=mcp-tool-call-log-retention.task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tool-call-log-retention.task.js","sourceRoot":"","sources":["../../src/tasks/mcp-tool-call-log-retention.task.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;AAE9C,wGAAgG;AAEhG;;;;GAIG;AACU,QAAA,2BAA2B,GAAG,IAAI,oBAAa,CAAC;IACzD,EAAE,EAAE,6BAA6B;IACjC,WAAW,EAAE,oCAAoC;IACjD,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC;IACxC,KAAK,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE;QACxC,MAAM,YAAY,GAAG,MAAM,QAAQ;aAC9B,GAAG,CAAC,oEAA8B,CAAC;aACnC,yBAAyB,CAAC,gBAAgB,CAAC,CAAC;QACjD,OAAO,EAAE,YAAY,EAAE,CAAC;IAC5B,CAAC;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CurrencyCode } from '@vendure/common/lib/generated-types';
|
|
2
|
+
import { ActiveOrderService, ID, Order, OrderModificationError, OrderService, RequestContext, TransactionalConnection } from '@vendure/core';
|
|
3
|
+
interface ActiveOrderRef {
|
|
4
|
+
id: ID;
|
|
5
|
+
currencyCode: CurrencyCode;
|
|
6
|
+
state: Order['state'];
|
|
7
|
+
ctx: RequestContext;
|
|
8
|
+
}
|
|
9
|
+
export declare const NO_CART_MESSAGE: string;
|
|
10
|
+
export declare class McpActiveOrderService {
|
|
11
|
+
private readonly activeOrderService;
|
|
12
|
+
private readonly orderService;
|
|
13
|
+
private readonly connection;
|
|
14
|
+
constructor(activeOrderService: ActiveOrderService, orderService: OrderService, connection: TransactionalConnection);
|
|
15
|
+
/** The shopper's current cart, or undefined when they have none. Order lines are not loaded. */
|
|
16
|
+
find(ctx: RequestContext): Promise<ActiveOrderRef | undefined>;
|
|
17
|
+
/** The cart reference the tools act on, with a context in the cart's currency. */
|
|
18
|
+
private bindToCart;
|
|
19
|
+
findOrCreate(ctx: RequestContext): Promise<ActiveOrderRef>;
|
|
20
|
+
private lockSessionRow;
|
|
21
|
+
findOrThrow(ctx: RequestContext): Promise<ActiveOrderRef>;
|
|
22
|
+
findEditable(ctx: RequestContext): Promise<ActiveOrderRef | OrderModificationError>;
|
|
23
|
+
findOrderWithLines(ctx: RequestContext): Promise<Order | undefined>;
|
|
24
|
+
private activeOrder;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
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.McpActiveOrderService = exports.NO_CART_MESSAGE = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const core_1 = require("@vendure/core");
|
|
15
|
+
const typeorm_1 = require("typeorm");
|
|
16
|
+
exports.NO_CART_MESSAGE = 'There is no cart for this session. Call add_to_cart first; it returns the sessionToken to ' +
|
|
17
|
+
'use on later calls.';
|
|
18
|
+
const EDITABLE_ORDER_STATES = new Set(['AddingItems', 'Draft']);
|
|
19
|
+
// Mirrors how core itself swaps the currency, by setting the same private field on a copy.
|
|
20
|
+
function withCurrency(ctx, currencyCode) {
|
|
21
|
+
const copy = ctx.copy();
|
|
22
|
+
copy._currencyCode = currencyCode;
|
|
23
|
+
return copy;
|
|
24
|
+
}
|
|
25
|
+
let McpActiveOrderService = class McpActiveOrderService {
|
|
26
|
+
constructor(activeOrderService, orderService, connection) {
|
|
27
|
+
this.activeOrderService = activeOrderService;
|
|
28
|
+
this.orderService = orderService;
|
|
29
|
+
this.connection = connection;
|
|
30
|
+
}
|
|
31
|
+
/** The shopper's current cart, or undefined when they have none. Order lines are not loaded. */
|
|
32
|
+
async find(ctx) {
|
|
33
|
+
const order = await this.activeOrder(ctx);
|
|
34
|
+
return order ? this.bindToCart(ctx, order) : undefined;
|
|
35
|
+
}
|
|
36
|
+
/** The cart reference the tools act on, with a context in the cart's currency. */
|
|
37
|
+
bindToCart(ctx, order) {
|
|
38
|
+
return {
|
|
39
|
+
id: order.id,
|
|
40
|
+
currencyCode: order.currencyCode,
|
|
41
|
+
state: order.state,
|
|
42
|
+
ctx: ctx.currencyCode === order.currencyCode ? ctx : withCurrency(ctx, order.currencyCode),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
// Only add_to_cart may start a cart; every other mutation uses findOrThrow instead.
|
|
46
|
+
async findOrCreate(ctx) {
|
|
47
|
+
const session = ctx.session;
|
|
48
|
+
if (!session) {
|
|
49
|
+
throw new core_1.IllegalOperationError('add_to_cart requires a Vendure session and this call has none. In-process callers on the Shop API ' +
|
|
50
|
+
'must give the mutation that calls the tool the Owner permission, so that Vendure creates a session.');
|
|
51
|
+
}
|
|
52
|
+
const order = await this.connection.withTransaction(ctx, async (txCtx) => {
|
|
53
|
+
await this.lockSessionRow(txCtx, session);
|
|
54
|
+
// Never undefined: core throws a UserInputError when it can neither find nor create one.
|
|
55
|
+
return this.activeOrderService.getActiveOrder(txCtx, undefined, true);
|
|
56
|
+
});
|
|
57
|
+
return this.bindToCart(ctx, order);
|
|
58
|
+
}
|
|
59
|
+
// SQLite skips the lock because it only ever allows one writer at a time anyway.
|
|
60
|
+
async lockSessionRow(txCtx, session) {
|
|
61
|
+
var _a;
|
|
62
|
+
let row;
|
|
63
|
+
try {
|
|
64
|
+
row = await this.connection
|
|
65
|
+
.getRepository(txCtx, core_1.Session)
|
|
66
|
+
.createQueryBuilder('session')
|
|
67
|
+
.setLock('pessimistic_write')
|
|
68
|
+
.where('session.id = :id', { id: session.id })
|
|
69
|
+
.getOne();
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
if (e instanceof typeorm_1.LockNotSupportedOnGivenDriverError) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
throw e;
|
|
76
|
+
}
|
|
77
|
+
if (row) {
|
|
78
|
+
session.activeOrderId = (_a = row.activeOrderId) !== null && _a !== void 0 ? _a : undefined;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Without this check, acting on a cart that doesn't exist would silently create an empty one.
|
|
82
|
+
async findOrThrow(ctx) {
|
|
83
|
+
const order = await this.find(ctx);
|
|
84
|
+
if (!order) {
|
|
85
|
+
throw new core_1.UserInputError('There is no active cart. Add an item with add_to_cart first.');
|
|
86
|
+
}
|
|
87
|
+
return order;
|
|
88
|
+
}
|
|
89
|
+
// Coupon and address changes don't check the cart's state themselves, unlike line and
|
|
90
|
+
// shipping-method changes, so those tools call this instead of findOrThrow.
|
|
91
|
+
async findEditable(ctx) {
|
|
92
|
+
const cart = await this.findOrThrow(ctx);
|
|
93
|
+
return EDITABLE_ORDER_STATES.has(cart.state) ? cart : new core_1.OrderModificationError();
|
|
94
|
+
}
|
|
95
|
+
async findOrderWithLines(ctx) {
|
|
96
|
+
var _a;
|
|
97
|
+
const order = await this.activeOrder(ctx);
|
|
98
|
+
if (!order) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
return ((_a = (await this.orderService.findOne(ctx, order.id, [
|
|
102
|
+
'lines',
|
|
103
|
+
'lines.productVariant',
|
|
104
|
+
'payments',
|
|
105
|
+
'payments.refunds',
|
|
106
|
+
'shippingLines',
|
|
107
|
+
'customer',
|
|
108
|
+
]))) !== null && _a !== void 0 ? _a : order);
|
|
109
|
+
}
|
|
110
|
+
// Checked here because core's active-order strategy throws on a missing session instead of
|
|
111
|
+
// just reporting no cart.
|
|
112
|
+
async activeOrder(ctx) {
|
|
113
|
+
if (!ctx.session)
|
|
114
|
+
return undefined;
|
|
115
|
+
return this.activeOrderService.getActiveOrder(ctx, undefined);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
exports.McpActiveOrderService = McpActiveOrderService;
|
|
119
|
+
exports.McpActiveOrderService = McpActiveOrderService = __decorate([
|
|
120
|
+
(0, common_1.Injectable)(),
|
|
121
|
+
__metadata("design:paramtypes", [core_1.ActiveOrderService,
|
|
122
|
+
core_1.OrderService,
|
|
123
|
+
core_1.TransactionalConnection])
|
|
124
|
+
], McpActiveOrderService);
|
|
125
|
+
//# sourceMappingURL=active-order.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"active-order.service.js","sourceRoot":"","sources":["../../../src/tools/built-in/active-order.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,wCAauB;AACvB,qCAA6D;AAShD,QAAA,eAAe,GACxB,4FAA4F;IAC5F,qBAAqB,CAAC;AAE1B,MAAM,qBAAqB,GAAgC,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;AAE7F,2FAA2F;AAC3F,SAAS,YAAY,CAAC,GAAmB,EAAE,YAA0B;IACjE,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACvB,IAAY,CAAC,aAAa,GAAG,YAAY,CAAC;IAC3C,OAAO,IAAI,CAAC;AAChB,CAAC;AAGM,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAC9B,YACqB,kBAAsC,EACtC,YAA0B,EAC1B,UAAmC;QAFnC,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,eAAU,GAAV,UAAU,CAAyB;IACrD,CAAC;IAEJ,gGAAgG;IAChG,KAAK,CAAC,IAAI,CAAC,GAAmB;QAC1B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC1C,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3D,CAAC;IAED,kFAAkF;IAC1E,UAAU,CAAC,GAAmB,EAAE,KAAY;QAChD,OAAO;YACH,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,KA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B;QACzC,IAAI,CAAC,GAAG,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAEnC,OAAO,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC;CACJ,CAAA;AAxGY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAGgC,yBAAkB;QACxB,mBAAY;QACd,8BAAuB;GAJ/C,qBAAqB,CAwGjC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CustomerGroupService, CustomerService, RequestContext } from '@vendure/core';
|
|
2
|
+
import { McpToolHandler } from '@vendure/mcp-sdk';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { McpToolSerializerService } from '../serializer.service';
|
|
5
|
+
declare const addCustomerToGroupInput: z.ZodObject<{
|
|
6
|
+
customerId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
7
|
+
groupId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
type AddCustomerToGroupInput = z.infer<typeof addCustomerToGroupInput>;
|
|
10
|
+
export declare class AddCustomerToGroupTool implements McpToolHandler<AddCustomerToGroupInput> {
|
|
11
|
+
private readonly customerGroupService;
|
|
12
|
+
private readonly customerService;
|
|
13
|
+
private readonly serializer;
|
|
14
|
+
constructor(customerGroupService: CustomerGroupService, customerService: CustomerService, serializer: McpToolSerializerService);
|
|
15
|
+
execute(ctx: RequestContext, input: AddCustomerToGroupInput): Promise<{
|
|
16
|
+
customerId: import("@vendure/core").ID;
|
|
17
|
+
groups: {
|
|
18
|
+
id: import("@vendure/core").ID;
|
|
19
|
+
name: string;
|
|
20
|
+
}[];
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
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.AddCustomerToGroupTool = 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 id_schema_1 = require("../id-schema");
|
|
18
|
+
const serializer_service_1 = require("../serializer.service");
|
|
19
|
+
const addCustomerToGroupInput = zod_1.z.strictObject({
|
|
20
|
+
customerId: id_schema_1.idSchema.describe('Customer ID.'),
|
|
21
|
+
groupId: id_schema_1.idSchema.describe('Customer group ID.'),
|
|
22
|
+
});
|
|
23
|
+
let AddCustomerToGroupTool = class AddCustomerToGroupTool {
|
|
24
|
+
constructor(customerGroupService, customerService, serializer) {
|
|
25
|
+
this.customerGroupService = customerGroupService;
|
|
26
|
+
this.customerService = customerService;
|
|
27
|
+
this.serializer = serializer;
|
|
28
|
+
}
|
|
29
|
+
async execute(ctx, input) {
|
|
30
|
+
const customer = await this.customerService.findOne(ctx, input.customerId);
|
|
31
|
+
if (!customer) {
|
|
32
|
+
throw new core_1.EntityNotFoundError('Customer', input.customerId);
|
|
33
|
+
}
|
|
34
|
+
await this.customerGroupService.addCustomersToGroup(ctx, {
|
|
35
|
+
customerGroupId: input.groupId,
|
|
36
|
+
customerIds: [input.customerId],
|
|
37
|
+
});
|
|
38
|
+
const groups = await this.customerService.getCustomerGroups(ctx, customer.id);
|
|
39
|
+
return {
|
|
40
|
+
customerId: customer.id,
|
|
41
|
+
groups: groups.map(group => this.serializer.customerGroup(group)),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
exports.AddCustomerToGroupTool = AddCustomerToGroupTool;
|
|
46
|
+
exports.AddCustomerToGroupTool = AddCustomerToGroupTool = __decorate([
|
|
47
|
+
(0, mcp_sdk_1.McpTool)({
|
|
48
|
+
name: 'add_customer_to_group',
|
|
49
|
+
toolset: 'admin',
|
|
50
|
+
description: 'Add a customer to a customer group.',
|
|
51
|
+
keywords: [
|
|
52
|
+
'assign a customer to a segment',
|
|
53
|
+
'put a buyer in a group',
|
|
54
|
+
'tag this customer',
|
|
55
|
+
'add customer to a list',
|
|
56
|
+
'categorize a client',
|
|
57
|
+
'give customer group membership',
|
|
58
|
+
],
|
|
59
|
+
permissions: [core_1.Permission.UpdateCustomerGroup],
|
|
60
|
+
behavior: 'mutating',
|
|
61
|
+
inputSchema: addCustomerToGroupInput,
|
|
62
|
+
}),
|
|
63
|
+
(0, common_1.Injectable)(),
|
|
64
|
+
__metadata("design:paramtypes", [core_1.CustomerGroupService,
|
|
65
|
+
core_1.CustomerService,
|
|
66
|
+
serializer_service_1.McpToolSerializerService])
|
|
67
|
+
], AddCustomerToGroupTool);
|
|
68
|
+
//# sourceMappingURL=add-customer-to-group.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-customer-to-group.tool.js","sourceRoot":"","sources":["../../../../src/tools/built-in/admin/add-customer-to-group.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,wCAMuB;AACvB,8CAA2D;AAC3D,6BAAwB;AAExB,4CAAwC;AACxC,8DAAiE;AAEjE,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EAAE,uBAAuB;QAC7B,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,qCAAqC;QAClD,QAAQ,EAAE;YACN,gCAAgC;YAChC,wBAAwB;YACxB,mBAAmB;YACnB,wBAAwB;YACxB,qBAAqB;YACrB,gCAAgC;SACnC;QACD,WAAW,EAAE,CAAC,iBAAU,CAAC,mBAAmB,CAAC;QAC7C,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,uBAAuB;KACvC,CAAC;IACD,IAAA,mBAAU,GAAE;qCAGkC,2BAAoB;QACzB,sBAAe;QACpB,6CAAwB;GAJhD,sBAAsB,CAwBlC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { HistoryService, OrderService, RequestContext } from '@vendure/core';
|
|
2
|
+
import { McpToolHandler } from '@vendure/mcp-sdk';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { McpToolSerializerService } from '../serializer.service';
|
|
5
|
+
declare const addNoteToOrderInput: z.ZodObject<{
|
|
6
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
7
|
+
note: z.ZodString;
|
|
8
|
+
isPublic: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
type AddNoteToOrderToolInput = z.infer<typeof addNoteToOrderInput>;
|
|
11
|
+
export declare class AddNoteToOrderTool implements McpToolHandler<AddNoteToOrderToolInput> {
|
|
12
|
+
private readonly orderService;
|
|
13
|
+
private readonly historyService;
|
|
14
|
+
private readonly serializer;
|
|
15
|
+
constructor(orderService: OrderService, historyService: HistoryService, serializer: McpToolSerializerService);
|
|
16
|
+
execute(ctx: RequestContext, input: AddNoteToOrderToolInput): Promise<{
|
|
17
|
+
order: {
|
|
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
|
+
note: {
|
|
97
|
+
id: import("@vendure/core").ID;
|
|
98
|
+
text: string;
|
|
99
|
+
isPublic: boolean;
|
|
100
|
+
createdAt: string | null;
|
|
101
|
+
};
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
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.AddNoteToOrderTool = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const generated_types_1 = require("@vendure/common/lib/generated-types");
|
|
15
|
+
const core_1 = require("@vendure/core");
|
|
16
|
+
const mcp_sdk_1 = require("@vendure/mcp-sdk");
|
|
17
|
+
const zod_1 = require("zod");
|
|
18
|
+
const id_schema_1 = require("../id-schema");
|
|
19
|
+
const order_list_helpers_1 = require("../order-list-helpers");
|
|
20
|
+
const serializer_service_1 = require("../serializer.service");
|
|
21
|
+
const string_schemas_1 = require("../string-schemas");
|
|
22
|
+
const addNoteToOrderInput = zod_1.z.strictObject({
|
|
23
|
+
id: id_schema_1.idSchema.describe('Order ID.'),
|
|
24
|
+
note: string_schemas_1.longText.describe('Note text.'),
|
|
25
|
+
isPublic: zod_1.z
|
|
26
|
+
.boolean()
|
|
27
|
+
.describe('Whether the note is visible to the customer. Defaults to false.')
|
|
28
|
+
.optional(),
|
|
29
|
+
});
|
|
30
|
+
let AddNoteToOrderTool = class AddNoteToOrderTool {
|
|
31
|
+
constructor(orderService, historyService, serializer) {
|
|
32
|
+
this.orderService = orderService;
|
|
33
|
+
this.historyService = historyService;
|
|
34
|
+
this.serializer = serializer;
|
|
35
|
+
}
|
|
36
|
+
async execute(ctx, input) {
|
|
37
|
+
var _a;
|
|
38
|
+
const order = await (0, order_list_helpers_1.findOrderOrThrow)(this.orderService, ctx, input.id, order_list_helpers_1.ORDER_DETAIL_RELATIONS);
|
|
39
|
+
const note = await this.historyService.createHistoryEntryForOrder({ ctx, orderId: order.id, type: generated_types_1.HistoryEntryType.ORDER_NOTE, data: { note: input.note } }, (_a = input.isPublic) !== null && _a !== void 0 ? _a : false);
|
|
40
|
+
return { order: this.serializer.order(order), note: this.serializer.orderNote(note) };
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
exports.AddNoteToOrderTool = AddNoteToOrderTool;
|
|
44
|
+
exports.AddNoteToOrderTool = AddNoteToOrderTool = __decorate([
|
|
45
|
+
(0, mcp_sdk_1.McpTool)({
|
|
46
|
+
name: 'add_note_to_order',
|
|
47
|
+
toolset: 'admin',
|
|
48
|
+
description: 'Add an internal or public note to an order timeline.',
|
|
49
|
+
keywords: [
|
|
50
|
+
'leave a comment on an order',
|
|
51
|
+
'add a remark to the order timeline',
|
|
52
|
+
'annotate this order',
|
|
53
|
+
'log an internal message on the order',
|
|
54
|
+
'write a note customers can see',
|
|
55
|
+
'record a memo on the order',
|
|
56
|
+
],
|
|
57
|
+
permissions: [core_1.Permission.UpdateOrder],
|
|
58
|
+
behavior: 'mutating',
|
|
59
|
+
inputSchema: addNoteToOrderInput,
|
|
60
|
+
}),
|
|
61
|
+
(0, common_1.Injectable)(),
|
|
62
|
+
__metadata("design:paramtypes", [core_1.OrderService,
|
|
63
|
+
core_1.HistoryService,
|
|
64
|
+
serializer_service_1.McpToolSerializerService])
|
|
65
|
+
], AddNoteToOrderTool);
|
|
66
|
+
//# sourceMappingURL=add-note-to-order.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-note-to-order.tool.js","sourceRoot":"","sources":["../../../../src/tools/built-in/admin/add-note-to-order.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yEAAuE;AACvE,wCAAyF;AACzF,8CAA2D;AAC3D,6BAAwB;AAExB,4CAAwC;AACxC,8DAAiF;AACjF,8DAAiE;AACjE,sDAA6C;AAE7C,MAAM,mBAAmB,GAAG,OAAC,CAAC,YAAY,CAAC;IACvC,EAAE,EAAE,oBAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC;IAClC,IAAI,EAAE,yBAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;IACrC,QAAQ,EAAE,OAAC;SACN,OAAO,EAAE;SACT,QAAQ,CAAC,iEAAiE,CAAC;SAC3E,QAAQ,EAAE;CAClB,CAAC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