ebay-mcp 1.13.2 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/README.de.md +3 -3
  2. package/README.es.md +3 -3
  3. package/README.fr.md +3 -3
  4. package/README.ja.md +3 -3
  5. package/README.ko.md +3 -3
  6. package/README.md +163 -41
  7. package/README.pt-BR.md +3 -3
  8. package/README.ru.md +3 -3
  9. package/README.zh-CN.md +3 -3
  10. package/build/api/account-management/account.js +633 -297
  11. package/build/api/analytics-and-report/analytics.js +111 -65
  12. package/build/api/client.js +199 -140
  13. package/build/api/clientRequestError.js +23 -0
  14. package/build/api/clientTrading.js +213 -0
  15. package/build/api/clientTradingError.js +4 -0
  16. package/build/api/communication/feedback.js +147 -59
  17. package/build/api/communication/message.js +134 -81
  18. package/build/api/communication/negotiation.js +65 -53
  19. package/build/api/communication/notification.js +458 -164
  20. package/build/api/developer/developer.js +99 -45
  21. package/build/api/index.js +23 -8
  22. package/build/api/listing-management/inventory.js +884 -338
  23. package/build/api/listing-metadata/metadata.js +416 -170
  24. package/build/api/listing-metadata/taxonomy.js +187 -42
  25. package/build/api/marketing-and-promotions/marketing.js +1392 -598
  26. package/build/api/marketing-and-promotions/recommendation.js +49 -24
  27. package/build/api/order-management/dispute.js +226 -45
  28. package/build/api/order-management/fulfillment.js +144 -71
  29. package/build/api/order-management/orderIssueHelpers.js +61 -0
  30. package/build/api/other/compliance.js +50 -38
  31. package/build/api/other/edelivery.js +603 -159
  32. package/build/api/other/finding.js +280 -0
  33. package/build/api/other/identity.js +30 -15
  34. package/build/api/other/translation.js +29 -14
  35. package/build/api/other/vero.js +113 -27
  36. package/build/api/rateLimitTracker.js +55 -0
  37. package/build/api/shared/request.js +189 -98
  38. package/build/api/trading/trading.js +154 -87
  39. package/build/auth/credentialSession.js +250 -0
  40. package/build/auth/oauth.js +298 -171
  41. package/build/auth/{oauth-metadata.js → oauthMetadata.js} +22 -6
  42. package/build/auth/oauthMiddleware.js +104 -0
  43. package/build/auth/{scope-utils.js → scopeUtils.js} +101 -28
  44. package/build/auth/tokenVerifier.js +243 -0
  45. package/build/auth/tokenVerifierError.js +21 -0
  46. package/build/config/environment.js +148 -113
  47. package/build/config/{tool-families.js → toolFamilies.js} +30 -14
  48. package/build/index.js +25 -19
  49. package/build/mcp/{http-transport.js → httpTransport.js} +102 -52
  50. package/build/mcp/readOnlyFilter.js +67 -0
  51. package/build/mcp/runtime.js +31 -13
  52. package/build/mcp/{tool-gating.js → toolGating.js} +77 -49
  53. package/build/mcp/{ui-bridge.js → uiBridge.js} +80 -23
  54. package/build/schemas/account-management/account.js +144 -6
  55. package/build/schemas/analytics/analytics.js +33 -19
  56. package/build/schemas/communication/messages.js +12 -42
  57. package/build/schemas/developer/developer.js +135 -0
  58. package/build/schemas/fulfillment/orders.js +183 -21
  59. package/build/schemas/index.js +27 -19
  60. package/build/schemas/inventory-management/inventory.js +17 -9
  61. package/build/schemas/marketing/marketing.js +480 -25
  62. package/build/schemas/metadata/metadata.js +11 -6
  63. package/build/schemas/other/finding.js +27 -0
  64. package/build/schemas/other/otherApis.js +424 -0
  65. package/build/schemas/taxonomy/taxonomy.js +11 -5
  66. package/build/scripts/{auto-setup.js → autoSetup.js} +87 -74
  67. package/build/scripts/{build-ui.js → buildUi.js} +6 -1
  68. package/build/scripts/{dev-sync.js → devSync.js} +169 -110
  69. package/build/scripts/diagnostics.js +52 -44
  70. package/build/scripts/{download-specs.js → downloadSpecs.js} +29 -21
  71. package/build/scripts/{interactive-setup.js → interactiveSetup.js} +84 -78
  72. package/build/scripts/setup.js +241 -178
  73. package/build/scripts/{setup-shared.js → setupShared.js} +29 -7
  74. package/build/scripts/skills.js +35 -27
  75. package/build/scripts/updateApiStatusDoc.js +71 -0
  76. package/build/serverHttp.js +90 -0
  77. package/build/skills/content.js +124 -118
  78. package/build/skills/index.js +22 -10
  79. package/build/skills/install.js +21 -10
  80. package/build/skills/markers.js +50 -15
  81. package/build/skills/{registry-snapshot.js → registrySnapshot.js} +8 -2
  82. package/build/skills/render.js +41 -14
  83. package/build/skills/targets.js +49 -17
  84. package/build/tools/categories/account.js +166 -264
  85. package/build/tools/categories/analytics.js +11 -22
  86. package/build/tools/categories/browse.js +17 -0
  87. package/build/tools/categories/communication.js +124 -399
  88. package/build/tools/categories/connector.js +23 -20
  89. package/build/tools/categories/developer.js +46 -159
  90. package/build/tools/categories/fulfillment.js +84 -215
  91. package/build/tools/categories/index.js +6 -14
  92. package/build/tools/categories/inventory.js +238 -293
  93. package/build/tools/categories/marketing.js +677 -39
  94. package/build/tools/categories/metadata.js +190 -117
  95. package/build/tools/categories/other.js +81 -208
  96. package/build/tools/categories/taxonomy.js +29 -20
  97. package/build/tools/categories/{token-management.js → tokenManagement.js} +187 -192
  98. package/build/tools/categories/trading.js +16 -47
  99. package/build/tools/contracts.js +34 -24
  100. package/build/tools/{define-tool.js → defineTool.js} +44 -29
  101. package/build/tools/registry.js +87 -29
  102. package/build/tools/schemas.js +3 -57
  103. package/build/tools/ui/archetypes.js +1 -0
  104. package/build/tools/ui/{map-helpers.js → mapHelpers.js} +69 -19
  105. package/build/tools/ui/maps.js +294 -80
  106. package/build/types/index.js +1 -1
  107. package/build/ui/card.html +14 -14
  108. package/build/ui/chart.html +14 -14
  109. package/build/ui/stat.html +87 -0
  110. package/build/ui/table.html +14 -14
  111. package/build/utils/apiStatusFeed.js +95 -0
  112. package/build/utils/cliOutput.js +15 -0
  113. package/build/utils/cliUi.js +108 -0
  114. package/build/utils/communication/feedback.js +57 -77
  115. package/build/utils/communication/message.js +69 -98
  116. package/build/utils/communication/negotiation.js +30 -57
  117. package/build/utils/communication/notification.js +112 -252
  118. package/build/utils/{date-converter.js → dateConverter.js} +62 -30
  119. package/build/utils/effectSchema.js +203 -0
  120. package/build/utils/effectSchemaAdapter.js +121 -0
  121. package/build/utils/effectSchemaChainMethods.js +146 -0
  122. package/build/utils/effectSchemaRefinements.js +104 -0
  123. package/build/utils/effectSchemaStringMethods.js +63 -0
  124. package/build/utils/effectSchemaTypes.js +47 -0
  125. package/build/utils/{env-parser.js → envParser.js} +10 -2
  126. package/build/utils/errors.js +7 -3
  127. package/build/utils/http.js +148 -89
  128. package/build/utils/{llm-client-detector.js → llmClientDetector.js} +295 -274
  129. package/build/utils/logger.js +127 -51
  130. package/build/utils/{oauth-helper.js → oauthHelper.js} +127 -90
  131. package/build/utils/other/compliance.js +18 -38
  132. package/build/utils/other/identity.js +2 -2
  133. package/build/utils/other/translation.js +4 -4
  134. package/build/utils/other/vero.js +36 -20
  135. package/build/utils/schemaHelpers.js +22 -0
  136. package/build/utils/scopeHelper.js +270 -0
  137. package/build/utils/securityChecker.js +316 -0
  138. package/build/utils/{setup-validator.js → setupValidator.js} +113 -94
  139. package/build/utils/{setup-wizard.js → setupWizard.js} +57 -46
  140. package/build/utils/{token-utils.js → tokenUtils.js} +2 -2
  141. package/build/utils/trading/trading.js +35 -0
  142. package/build/utils/typeGuards.js +12 -0
  143. package/build/utils/version.js +65 -29
  144. package/package.json +10 -8
  145. package/build/api/client-trading.js +0 -124
  146. package/build/api/communication/shared.js +0 -59
  147. package/build/api/shared/query-params.js +0 -16
  148. package/build/auth/credential-session.js +0 -166
  149. package/build/auth/oauth-middleware.js +0 -100
  150. package/build/auth/token-verifier.js +0 -186
  151. package/build/schemas/other/other-apis.js +0 -390
  152. package/build/scripts/update-api-status-doc.js +0 -44
  153. package/build/server-http.js +0 -85
  154. package/build/tools/definitions/marketing.js +0 -1381
  155. package/build/tools/tool-handlers/marketing.js +0 -312
  156. package/build/utils/account-management/account.js +0 -818
  157. package/build/utils/api-status-feed.js +0 -84
  158. package/build/utils/cli-ui.js +0 -47
  159. package/build/utils/order-management/dispute.js +0 -369
  160. package/build/utils/order-management/fulfillment.js +0 -205
  161. package/build/utils/other/edelivery.js +0 -235
  162. package/build/utils/schema-helpers.js +0 -13
  163. package/build/utils/scope-helper.js +0 -207
  164. package/build/utils/security-checker.js +0 -248
  165. package/build/utils/type-guards.js +0 -6
  166. /package/build/auth/{oauth-types.js → oauthTypes.js} +0 -0
  167. /package/build/{server-http.d.ts → serverHttp.d.ts} +0 -0
  168. /package/build/tools/ui/{view-models.js → viewModels.js} +0 -0
  169. /package/build/types/{ebay-enums.js → ebayEnums.js} +0 -0
@@ -1,235 +0,0 @@
1
- import { z } from 'zod';
2
- import { idSchema } from '../schema-helpers.js';
3
- /**
4
- * Zod schemas for eDelivery API input validation
5
- * Based on: src/api/other/edelivery.ts
6
- * OpenAPI spec: docs/sell-apps/other-apis/sell_edelivery_international_shipping_oas3.json
7
- * Types from: src/types/sell_edelivery_international_shipping_oas3.ts
8
- *
9
- * Note: The eDelivery API is only available for Greater-China based sellers with an active eDIS account.
10
- */
11
- // Reusable schema for query parameters
12
- const paramsSchema = z
13
- .record(z.string(), {
14
- description: 'Query parameters for the request',
15
- })
16
- .optional();
17
- // Reusable schema for request body objects
18
- const requestBodySchema = (name) => z.record(z.unknown(), {
19
- message: `${name} is required`,
20
- required_error: `${name.toLowerCase().replace(/\s+/g, '_')} is required`,
21
- invalid_type_error: `${name.toLowerCase().replace(/\s+/g, '_')} must be an object`,
22
- description: `The ${name.toLowerCase()} containing required details`,
23
- });
24
- /**
25
- * Schema for createShippingQuote method
26
- * Endpoint: POST /shipping_quote
27
- * Body: ShippingQuoteRequest - complex object with shipping details
28
- */
29
- export const createShippingQuoteSchema = z.object({
30
- shipping_quote_request: requestBodySchema('Shipping quote request'),
31
- });
32
- /**
33
- * Schema for getShippingQuote method
34
- * Endpoint: GET /shipping_quote/{shipping_quote_id}
35
- * Path: shipping_quote_id (required)
36
- */
37
- export const getShippingQuoteSchema = z.object({
38
- shipping_quote_id: idSchema('Shipping quote ID', 'The unique identifier for the shipping quote'),
39
- });
40
- // ==================== Cost & Preferences ====================
41
- /**
42
- * Schema for getActualCosts method
43
- * Endpoint: GET /actual_costs
44
- */
45
- export const getActualCostsSchema = z.object({
46
- params: paramsSchema,
47
- });
48
- /**
49
- * Schema for getAddressPreferences method
50
- * Endpoint: GET /address_preference
51
- */
52
- export const getAddressPreferencesSchema = z.object({});
53
- /**
54
- * Schema for createAddressPreference method
55
- * Endpoint: POST /address_preference
56
- */
57
- export const createAddressPreferenceSchema = z.object({
58
- address_preference: requestBodySchema('Address preference'),
59
- });
60
- /**
61
- * Schema for getConsignPreferences method
62
- * Endpoint: GET /consign_preference
63
- */
64
- export const getConsignPreferencesSchema = z.object({});
65
- /**
66
- * Schema for createConsignPreference method
67
- * Endpoint: POST /consign_preference
68
- */
69
- export const createConsignPreferenceSchema = z.object({
70
- consign_preference: requestBodySchema('Consign preference'),
71
- });
72
- // ==================== Agents & Services ====================
73
- /**
74
- * Schema for getAgents method
75
- * Endpoint: GET /agents
76
- */
77
- export const getAgentsSchema = z.object({
78
- params: paramsSchema,
79
- });
80
- /**
81
- * Schema for getBatteryQualifications method
82
- * Endpoint: GET /battery_qualifications
83
- */
84
- export const getBatteryQualificationsSchema = z.object({
85
- params: paramsSchema,
86
- });
87
- /**
88
- * Schema for getDropoffSites method
89
- * Endpoint: GET /dropoff_sites
90
- */
91
- export const getDropoffSitesSchema = z.object({
92
- params: z.record(z.string(), {
93
- description: 'Query parameters (postal_code, country, etc.)',
94
- }),
95
- });
96
- /**
97
- * Schema for getShippingServices method
98
- * Endpoint: GET /services
99
- */
100
- export const getShippingServicesSchema = z.object({
101
- params: paramsSchema,
102
- });
103
- // ==================== Bundles ====================
104
- /**
105
- * Schema for createBundle method
106
- * Endpoint: POST /bundle
107
- */
108
- export const createBundleSchema = z.object({
109
- bundle_request: requestBodySchema('Bundle request'),
110
- });
111
- /**
112
- * Schema for getBundle method
113
- * Endpoint: GET /bundle/{bundle_id}
114
- */
115
- export const getBundleSchema = z.object({
116
- bundle_id: idSchema('Bundle ID', 'The unique identifier for the bundle'),
117
- });
118
- /**
119
- * Schema for cancelBundle method
120
- * Endpoint: POST /bundle/{bundle_id}/cancel
121
- */
122
- export const cancelBundleSchema = z.object({
123
- bundle_id: idSchema('Bundle ID', 'The unique identifier for the bundle to cancel'),
124
- });
125
- /**
126
- * Schema for getBundleLabel method
127
- * Endpoint: GET /bundle/{bundle_id}/label
128
- */
129
- export const getBundleLabelSchema = z.object({
130
- bundle_id: idSchema('Bundle ID', 'The unique identifier for the bundle'),
131
- });
132
- // ==================== Packages (Single) ====================
133
- /**
134
- * Schema for createPackage method
135
- * Endpoint: POST /package
136
- */
137
- export const createPackageSchema = z.object({
138
- package_request: requestBodySchema('Package request'),
139
- });
140
- /**
141
- * Schema for getPackage method
142
- * Endpoint: GET /package/{package_id}
143
- */
144
- export const getPackageSchema = z.object({
145
- package_id: idSchema('Package ID', 'The unique identifier for the package'),
146
- });
147
- /**
148
- * Schema for deletePackage method
149
- * Endpoint: DELETE /package/{package_id}
150
- */
151
- export const deletePackageSchema = z.object({
152
- package_id: idSchema('Package ID', 'The unique identifier for the package to delete'),
153
- });
154
- /**
155
- * Schema for getPackageByOrderLineItem method
156
- * Endpoint: GET /package/{order_line_item_id}/item
157
- */
158
- export const getPackageByOrderLineItemSchema = z.object({
159
- order_line_item_id: idSchema('Order line item ID', 'The order line item identifier'),
160
- });
161
- /**
162
- * Schema for cancelPackage method
163
- * Endpoint: POST /package/{package_id}/cancel
164
- */
165
- export const cancelPackageSchema = z.object({
166
- package_id: idSchema('Package ID', 'The unique identifier for the package to cancel'),
167
- });
168
- /**
169
- * Schema for clonePackage method
170
- * Endpoint: POST /package/{package_id}/clone
171
- */
172
- export const clonePackageSchema = z.object({
173
- package_id: idSchema('Package ID', 'The unique identifier for the package to clone'),
174
- });
175
- /**
176
- * Schema for confirmPackage method
177
- * Endpoint: POST /package/{package_id}/confirm
178
- */
179
- export const confirmPackageSchema = z.object({
180
- package_id: idSchema('Package ID', 'The unique identifier for the package to confirm'),
181
- });
182
- // ==================== Packages (Bulk) ====================
183
- /**
184
- * Schema for bulkCancelPackages method
185
- * Endpoint: POST /package/bulk_cancel_packages
186
- */
187
- export const bulkCancelPackagesSchema = z.object({
188
- bulk_cancel_request: requestBodySchema('Bulk cancel request'),
189
- });
190
- /**
191
- * Schema for bulkConfirmPackages method
192
- * Endpoint: POST /package/bulk_confirm_packages
193
- */
194
- export const bulkConfirmPackagesSchema = z.object({
195
- bulk_confirm_request: requestBodySchema('Bulk confirm request'),
196
- });
197
- /**
198
- * Schema for bulkDeletePackages method
199
- * Endpoint: POST /package/bulk_delete_packages
200
- */
201
- export const bulkDeletePackagesSchema = z.object({
202
- bulk_delete_request: requestBodySchema('Bulk delete request'),
203
- });
204
- // ==================== Labels & Tracking ====================
205
- /**
206
- * Schema for getLabels method
207
- * Endpoint: GET /labels
208
- */
209
- export const getLabelsSchema = z.object({
210
- params: paramsSchema,
211
- });
212
- /**
213
- * Schema for getHandoverSheet method
214
- * Endpoint: GET /handover_sheet
215
- */
216
- export const getHandoverSheetSchema = z.object({
217
- params: paramsSchema,
218
- });
219
- /**
220
- * Schema for getTracking method
221
- * Endpoint: GET /tracking
222
- */
223
- export const getTrackingSchema = z.object({
224
- params: z.record(z.string(), {
225
- description: 'Query parameters (tracking_number required)',
226
- }),
227
- });
228
- // ==================== Other ====================
229
- /**
230
- * Schema for createComplaint method
231
- * Endpoint: POST /complaint
232
- */
233
- export const createComplaintSchema = z.object({
234
- complaint_request: requestBodySchema('Complaint request'),
235
- });
@@ -1,13 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Reusable schema builder for required string ID parameters.
4
- */
5
- export function idSchema(name, description) {
6
- const normalized = name.toLowerCase().replace(/\s+/g, '_');
7
- return z.string({
8
- message: `${name} is required`,
9
- required_error: `${normalized} is required`,
10
- invalid_type_error: `${normalized} must be a string`,
11
- description,
12
- });
13
- }
@@ -1,207 +0,0 @@
1
- /**
2
- * Scope Helper - Manages eBay OAuth scopes
3
- */
4
- import chalk from 'chalk';
5
- import { getDefaultScopes } from '../config/environment.js';
6
- /**
7
- * Get all available scope categories
8
- */
9
- export function getScopeCategories() {
10
- return [
11
- {
12
- name: 'Inventory Management',
13
- description: 'Create, read, update, and delete inventory items',
14
- scopes: ['https://api.ebay.com/oauth/api_scope/sell.inventory'],
15
- required: true,
16
- },
17
- {
18
- name: 'Order Fulfillment',
19
- description: 'View and manage orders, shipping, and fulfillment',
20
- scopes: [
21
- 'https://api.ebay.com/oauth/api_scope/sell.fulfillment',
22
- 'https://api.ebay.com/oauth/api_scope/sell.fulfillment.readonly',
23
- ],
24
- required: true,
25
- },
26
- {
27
- name: 'Account Management',
28
- description: 'Manage account settings, policies, and preferences',
29
- scopes: [
30
- 'https://api.ebay.com/oauth/api_scope/sell.account',
31
- 'https://api.ebay.com/oauth/api_scope/sell.account.readonly',
32
- ],
33
- required: true,
34
- },
35
- {
36
- name: 'Analytics & Reports',
37
- description: 'Access sales analytics and performance reports',
38
- scopes: [
39
- 'https://api.ebay.com/oauth/api_scope/sell.analytics.readonly',
40
- 'https://api.ebay.com/oauth/api_scope/sell.marketplace.insights.readonly',
41
- ],
42
- required: false,
43
- },
44
- {
45
- name: 'Marketing & Promotions',
46
- description: 'Create and manage marketing campaigns and promotions',
47
- scopes: [
48
- 'https://api.ebay.com/oauth/api_scope/sell.marketing',
49
- 'https://api.ebay.com/oauth/api_scope/sell.marketing.readonly',
50
- ],
51
- required: false,
52
- },
53
- {
54
- name: 'Finance & Payments',
55
- description: 'Access financial data and payment information',
56
- scopes: ['https://api.ebay.com/oauth/api_scope/sell.finances'],
57
- required: false,
58
- },
59
- {
60
- name: 'Reputation & Feedback',
61
- description: 'Manage seller reputation and customer feedback',
62
- scopes: ['https://api.ebay.com/oauth/api_scope/sell.reputation'],
63
- required: false,
64
- },
65
- {
66
- name: 'Commerce Services',
67
- description: 'Identity verification, notifications, and messaging',
68
- scopes: [
69
- 'https://api.ebay.com/oauth/api_scope/commerce.identity.readonly',
70
- 'https://api.ebay.com/oauth/api_scope/commerce.notification.subscription',
71
- 'https://api.ebay.com/oauth/api_scope/sell.stores',
72
- ],
73
- required: false,
74
- },
75
- ];
76
- }
77
- /**
78
- * Get recommended scopes for the environment
79
- */
80
- export function getRecommendedScopes(environment) {
81
- return getDefaultScopes(environment);
82
- }
83
- /**
84
- * Display scope selection interface
85
- */
86
- export function displayScopeCategories() {
87
- console.log(chalk.bold.cyan('\n📋 Available OAuth Scopes\n'));
88
- const categories = getScopeCategories();
89
- for (const category of categories) {
90
- const badge = category.required ? chalk.green('[Required]') : chalk.gray('[Optional]');
91
- console.log(`${badge} ${chalk.bold.white(category.name)}`);
92
- console.log(` ${chalk.gray(category.description)}`);
93
- console.log(chalk.gray(` Scopes: ${category.scopes.length}`));
94
- console.log('');
95
- }
96
- }
97
- /**
98
- * Verify if token has required scopes
99
- */
100
- export function verifyScopesCoverage(tokenScopes, requiredScopes) {
101
- const tokenScopeSet = new Set(tokenScopes);
102
- const requiredScopeSet = new Set(requiredScopes);
103
- const missingScopes = requiredScopes.filter((scope) => !tokenScopeSet.has(scope));
104
- const extraScopes = tokenScopes.filter((scope) => !requiredScopeSet.has(scope));
105
- return {
106
- hasAllRequired: missingScopes.length === 0,
107
- missingScopes,
108
- extraScopes,
109
- };
110
- }
111
- /**
112
- * Display scope verification results
113
- */
114
- export function displayScopeVerification(tokenScopes, environment) {
115
- console.log(chalk.bold.cyan('\n🔍 Scope Verification\n'));
116
- const recommendedScopes = getRecommendedScopes(environment);
117
- const verification = verifyScopesCoverage(tokenScopes, recommendedScopes);
118
- console.log(chalk.bold.white('Token Scopes:'));
119
- console.log(chalk.gray(` Total: ${tokenScopes.length}\n`));
120
- if (verification.hasAllRequired) {
121
- console.log(chalk.green('✓ Token has all recommended scopes\n'));
122
- }
123
- else {
124
- console.log(chalk.yellow('⚠️ Token is missing some recommended scopes\n'));
125
- console.log(chalk.bold.white('Missing Scopes:'));
126
- for (const scope of verification.missingScopes) {
127
- console.log(chalk.yellow(` • ${scope}`));
128
- }
129
- console.log('');
130
- }
131
- if (verification.extraScopes.length > 0) {
132
- console.log(chalk.gray('Additional Scopes (not in recommended list):'));
133
- for (const scope of verification.extraScopes) {
134
- console.log(chalk.gray(` • ${scope}`));
135
- }
136
- console.log('');
137
- }
138
- // Display scope categories and their status
139
- const categories = getScopeCategories();
140
- const tokenScopeSet = new Set(tokenScopes);
141
- console.log(chalk.bold.white('Coverage by Category:\n'));
142
- for (const category of categories) {
143
- const hasAllCategoryScopes = category.scopes.every((scope) => tokenScopeSet.has(scope));
144
- const hasSomeCategoryScopes = category.scopes.some((scope) => tokenScopeSet.has(scope));
145
- let status;
146
- if (hasAllCategoryScopes) {
147
- status = chalk.green('✓ Full');
148
- }
149
- else if (hasSomeCategoryScopes) {
150
- status = chalk.yellow('◐ Partial');
151
- }
152
- else {
153
- status = chalk.red('✗ None');
154
- }
155
- const badge = category.required ? chalk.red('[Required]') : chalk.gray('[Optional]');
156
- console.log(`${status} ${badge} ${category.name}`);
157
- }
158
- console.log('');
159
- }
160
- /**
161
- * Get scope description for a full OAuth scope URL.
162
- */
163
- export function describeScopeFromOAuthUrl(scope) {
164
- const descriptions = {
165
- 'https://api.ebay.com/oauth/api_scope/sell.inventory': 'Manage inventory items and offers',
166
- 'https://api.ebay.com/oauth/api_scope/sell.fulfillment': 'Manage orders and shipping',
167
- 'https://api.ebay.com/oauth/api_scope/sell.fulfillment.readonly': 'View orders and shipping',
168
- 'https://api.ebay.com/oauth/api_scope/sell.account': 'Manage account settings',
169
- 'https://api.ebay.com/oauth/api_scope/sell.account.readonly': 'View account settings',
170
- 'https://api.ebay.com/oauth/api_scope/sell.analytics.readonly': 'View analytics and reports',
171
- 'https://api.ebay.com/oauth/api_scope/sell.marketing': 'Manage marketing campaigns',
172
- 'https://api.ebay.com/oauth/api_scope/sell.marketing.readonly': 'View marketing campaigns',
173
- 'https://api.ebay.com/oauth/api_scope/sell.finances': 'View financial data',
174
- 'https://api.ebay.com/oauth/api_scope/sell.reputation': 'Manage seller reputation',
175
- 'https://api.ebay.com/oauth/api_scope/commerce.identity.readonly': 'View user identity',
176
- 'https://api.ebay.com/oauth/api_scope/sell.stores': 'Manage eBay Stores',
177
- 'https://api.ebay.com/oauth/api_scope/commerce.notification.subscription': 'Manage notification subscriptions',
178
- 'https://api.ebay.com/oauth/api_scope/sell.marketplace.insights.readonly': 'View marketplace insights',
179
- };
180
- return descriptions[scope] || 'No description available';
181
- }
182
- /**
183
- * Format scopes for display
184
- */
185
- export function formatScopesForDisplay(scopes) {
186
- return scopes
187
- .map((scope) => {
188
- const shortName = scope.split('/').pop() || scope;
189
- return ` • ${shortName}`;
190
- })
191
- .join('\n');
192
- }
193
- /**
194
- * Get all scopes as a space-separated string
195
- */
196
- export function getAllScopesString(environment) {
197
- return getRecommendedScopes(environment).join(' ');
198
- }
199
- /**
200
- * Parse scope string to array
201
- */
202
- export function parseScopeString(scopeString) {
203
- return scopeString
204
- .split(/\s+/)
205
- .map((s) => s.trim())
206
- .filter((s) => s.length > 0);
207
- }