ebay-mcp-remote-edition 1.0.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/LICENSE +21 -0
- package/README.md +755 -0
- package/build/api/account-management/account.js +301 -0
- package/build/api/analytics-and-report/analytics.js +102 -0
- package/build/api/client-trading.js +96 -0
- package/build/api/client.js +173 -0
- package/build/api/communication/feedback.js +119 -0
- package/build/api/communication/message.js +131 -0
- package/build/api/communication/negotiation.js +97 -0
- package/build/api/communication/notification.js +373 -0
- package/build/api/developer/developer.js +81 -0
- package/build/api/index.js +109 -0
- package/build/api/listing-management/inventory.js +640 -0
- package/build/api/listing-metadata/metadata.js +485 -0
- package/build/api/listing-metadata/taxonomy.js +58 -0
- package/build/api/marketing-and-promotions/marketing.js +768 -0
- package/build/api/marketing-and-promotions/recommendation.js +32 -0
- package/build/api/order-management/dispute.js +69 -0
- package/build/api/order-management/fulfillment.js +89 -0
- package/build/api/other/compliance.js +47 -0
- package/build/api/other/edelivery.js +219 -0
- package/build/api/other/identity.js +24 -0
- package/build/api/other/translation.js +22 -0
- package/build/api/other/vero.js +48 -0
- package/build/api/trading/trading.js +78 -0
- package/build/auth/kv-store.js +40 -0
- package/build/auth/multi-user-store.js +120 -0
- package/build/auth/oauth-metadata.js +59 -0
- package/build/auth/oauth-middleware.js +99 -0
- package/build/auth/oauth-types.js +4 -0
- package/build/auth/oauth.js +235 -0
- package/build/auth/scope-utils.js +304 -0
- package/build/auth/token-store.js +46 -0
- package/build/auth/token-verifier.js +172 -0
- package/build/config/environment.js +297 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +129 -0
- package/build/schemas/account-management/account.js +375 -0
- package/build/schemas/analytics/analytics.js +191 -0
- package/build/schemas/communication/messages.js +345 -0
- package/build/schemas/fulfillment/orders.js +338 -0
- package/build/schemas/index.js +68 -0
- package/build/schemas/inventory-management/inventory.js +471 -0
- package/build/schemas/marketing/marketing.js +1103 -0
- package/build/schemas/metadata/metadata.js +618 -0
- package/build/schemas/other/other-apis.js +390 -0
- package/build/schemas/taxonomy/taxonomy.js +575 -0
- package/build/scripts/auto-setup.js +364 -0
- package/build/scripts/dev-sync.js +512 -0
- package/build/scripts/diagnostics.js +301 -0
- package/build/scripts/download-specs.js +116 -0
- package/build/scripts/interactive-setup.js +757 -0
- package/build/scripts/setup.js +1515 -0
- package/build/scripts/update-api-status-doc.js +44 -0
- package/build/server-http.d.ts +1 -0
- package/build/server-http.js +581 -0
- package/build/tools/definitions/account-with-schemas.js +170 -0
- package/build/tools/definitions/account.js +428 -0
- package/build/tools/definitions/analytics.js +66 -0
- package/build/tools/definitions/communication.js +394 -0
- package/build/tools/definitions/developer.js +195 -0
- package/build/tools/definitions/fulfillment.js +326 -0
- package/build/tools/definitions/index.js +41 -0
- package/build/tools/definitions/inventory.js +464 -0
- package/build/tools/definitions/marketing.js +1486 -0
- package/build/tools/definitions/metadata.js +188 -0
- package/build/tools/definitions/other.js +309 -0
- package/build/tools/definitions/taxonomy.js +64 -0
- package/build/tools/definitions/token-management.js +148 -0
- package/build/tools/definitions/trading.js +71 -0
- package/build/tools/index.js +1200 -0
- package/build/tools/schemas.js +667 -0
- package/build/tools/tool-definitions.js +3534 -0
- package/build/types/application-settings/developerAnalyticsV1BetaOas3.js +5 -0
- package/build/types/application-settings/developerClientRegistrationV1Oas3.js +5 -0
- package/build/types/application-settings/developerKeyManagementV1Oas3.js +5 -0
- package/build/types/ebay-enums.js +1330 -0
- package/build/types/ebay.js +123 -0
- package/build/types/index.js +10 -0
- package/build/types/sell-apps/account-management/sellAccountV1Oas3.js +5 -0
- package/build/types/sell-apps/analytics-and-report/sellAnalyticsV1Oas3.js +5 -0
- package/build/types/sell-apps/communication/commerceFeedbackV1BetaOas3.js +5 -0
- package/build/types/sell-apps/communication/commerceMessageV1Oas3.js +5 -0
- package/build/types/sell-apps/communication/commerceNotificationV1Oas3.js +5 -0
- package/build/types/sell-apps/communication/sellNegotiationV1Oas3.js +5 -0
- package/build/types/sell-apps/listing-management/sellInventoryV1Oas3.js +5 -0
- package/build/types/sell-apps/listing-metadata/sellMetadataV1Oas3.js +5 -0
- package/build/types/sell-apps/markeitng-and-promotions/sellMarketingV1Oas3.js +5 -0
- package/build/types/sell-apps/markeitng-and-promotions/sellRecommendationV1Oas3.js +5 -0
- package/build/types/sell-apps/order-management/sellFulfillmentV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/commerceIdentityV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/commerceTranslationV1BetaOas3.js +5 -0
- package/build/types/sell-apps/other-apis/commerceVeroV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellComplianceV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellEdeliveryInternationalShippingOas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellMarketingV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellRecommendationV1Oas3.js +5 -0
- package/build/utils/account-management/account.js +831 -0
- package/build/utils/api-status-feed.js +83 -0
- package/build/utils/communication/feedback.js +216 -0
- package/build/utils/communication/message.js +242 -0
- package/build/utils/communication/negotiation.js +150 -0
- package/build/utils/communication/notification.js +369 -0
- package/build/utils/date-converter.js +160 -0
- package/build/utils/llm-client-detector.js +758 -0
- package/build/utils/logger.js +198 -0
- package/build/utils/oauth-helper.js +315 -0
- package/build/utils/order-management/dispute.js +369 -0
- package/build/utils/order-management/fulfillment.js +205 -0
- package/build/utils/other/compliance.js +76 -0
- package/build/utils/other/edelivery.js +241 -0
- package/build/utils/other/identity.js +13 -0
- package/build/utils/other/translation.js +41 -0
- package/build/utils/other/vero.js +90 -0
- package/build/utils/scope-helper.js +207 -0
- package/build/utils/security-checker.js +248 -0
- package/build/utils/setup-validator.js +305 -0
- package/build/utils/token-utils.js +40 -0
- package/build/utils/version.js +56 -0
- package/docs/auth/production_scopes.json +111 -0
- package/docs/auth/sandbox_scopes.json +142 -0
- package/package.json +122 -0
- package/public/icons/1024x1024.png +0 -0
- package/public/icons/128x128.png +0 -0
- package/public/icons/16x16.png +0 -0
- package/public/icons/256x256.png +0 -0
- package/public/icons/32x32.png +0 -0
- package/public/icons/48x48.png +0 -0
- package/public/icons/512x512.png +0 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schemas for eDelivery API input validation
|
|
4
|
+
* Based on: src/api/other/edelivery.ts
|
|
5
|
+
* OpenAPI spec: docs/sell-apps/other-apis/sell_edelivery_international_shipping_oas3.json
|
|
6
|
+
* Types from: src/types/sell_edelivery_international_shipping_oas3.ts
|
|
7
|
+
*
|
|
8
|
+
* Note: The eDelivery API is only available for Greater-China based sellers with an active eDIS account.
|
|
9
|
+
*/
|
|
10
|
+
// Reusable schema for ID parameters
|
|
11
|
+
const idSchema = (name, description) => z.string({
|
|
12
|
+
message: `${name} is required`,
|
|
13
|
+
required_error: `${name.toLowerCase().replace(/\s+/g, '_')} is required`,
|
|
14
|
+
invalid_type_error: `${name.toLowerCase().replace(/\s+/g, '_')} must be a string`,
|
|
15
|
+
description,
|
|
16
|
+
});
|
|
17
|
+
// Reusable schema for query parameters
|
|
18
|
+
const paramsSchema = z
|
|
19
|
+
.record(z.string(), {
|
|
20
|
+
description: 'Query parameters for the request',
|
|
21
|
+
})
|
|
22
|
+
.optional();
|
|
23
|
+
// Reusable schema for request body objects
|
|
24
|
+
const requestBodySchema = (name) => z.record(z.unknown(), {
|
|
25
|
+
message: `${name} is required`,
|
|
26
|
+
required_error: `${name.toLowerCase().replace(/\s+/g, '_')} is required`,
|
|
27
|
+
invalid_type_error: `${name.toLowerCase().replace(/\s+/g, '_')} must be an object`,
|
|
28
|
+
description: `The ${name.toLowerCase()} containing required details`,
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Schema for createShippingQuote method
|
|
32
|
+
* Endpoint: POST /shipping_quote
|
|
33
|
+
* Body: ShippingQuoteRequest - complex object with shipping details
|
|
34
|
+
*/
|
|
35
|
+
export const createShippingQuoteSchema = z.object({
|
|
36
|
+
shipping_quote_request: requestBodySchema('Shipping quote request'),
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Schema for getShippingQuote method
|
|
40
|
+
* Endpoint: GET /shipping_quote/{shipping_quote_id}
|
|
41
|
+
* Path: shipping_quote_id (required)
|
|
42
|
+
*/
|
|
43
|
+
export const getShippingQuoteSchema = z.object({
|
|
44
|
+
shipping_quote_id: idSchema('Shipping quote ID', 'The unique identifier for the shipping quote'),
|
|
45
|
+
});
|
|
46
|
+
// ==================== Cost & Preferences ====================
|
|
47
|
+
/**
|
|
48
|
+
* Schema for getActualCosts method
|
|
49
|
+
* Endpoint: GET /actual_costs
|
|
50
|
+
*/
|
|
51
|
+
export const getActualCostsSchema = z.object({
|
|
52
|
+
params: paramsSchema,
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Schema for getAddressPreferences method
|
|
56
|
+
* Endpoint: GET /address_preference
|
|
57
|
+
*/
|
|
58
|
+
export const getAddressPreferencesSchema = z.object({});
|
|
59
|
+
/**
|
|
60
|
+
* Schema for createAddressPreference method
|
|
61
|
+
* Endpoint: POST /address_preference
|
|
62
|
+
*/
|
|
63
|
+
export const createAddressPreferenceSchema = z.object({
|
|
64
|
+
address_preference: requestBodySchema('Address preference'),
|
|
65
|
+
});
|
|
66
|
+
/**
|
|
67
|
+
* Schema for getConsignPreferences method
|
|
68
|
+
* Endpoint: GET /consign_preference
|
|
69
|
+
*/
|
|
70
|
+
export const getConsignPreferencesSchema = z.object({});
|
|
71
|
+
/**
|
|
72
|
+
* Schema for createConsignPreference method
|
|
73
|
+
* Endpoint: POST /consign_preference
|
|
74
|
+
*/
|
|
75
|
+
export const createConsignPreferenceSchema = z.object({
|
|
76
|
+
consign_preference: requestBodySchema('Consign preference'),
|
|
77
|
+
});
|
|
78
|
+
// ==================== Agents & Services ====================
|
|
79
|
+
/**
|
|
80
|
+
* Schema for getAgents method
|
|
81
|
+
* Endpoint: GET /agents
|
|
82
|
+
*/
|
|
83
|
+
export const getAgentsSchema = z.object({
|
|
84
|
+
params: paramsSchema,
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* Schema for getBatteryQualifications method
|
|
88
|
+
* Endpoint: GET /battery_qualifications
|
|
89
|
+
*/
|
|
90
|
+
export const getBatteryQualificationsSchema = z.object({
|
|
91
|
+
params: paramsSchema,
|
|
92
|
+
});
|
|
93
|
+
/**
|
|
94
|
+
* Schema for getDropoffSites method
|
|
95
|
+
* Endpoint: GET /dropoff_sites
|
|
96
|
+
*/
|
|
97
|
+
export const getDropoffSitesSchema = z.object({
|
|
98
|
+
params: z.record(z.string(), {
|
|
99
|
+
description: 'Query parameters (postal_code, country, etc.)',
|
|
100
|
+
}),
|
|
101
|
+
});
|
|
102
|
+
/**
|
|
103
|
+
* Schema for getShippingServices method
|
|
104
|
+
* Endpoint: GET /services
|
|
105
|
+
*/
|
|
106
|
+
export const getShippingServicesSchema = z.object({
|
|
107
|
+
params: paramsSchema,
|
|
108
|
+
});
|
|
109
|
+
// ==================== Bundles ====================
|
|
110
|
+
/**
|
|
111
|
+
* Schema for createBundle method
|
|
112
|
+
* Endpoint: POST /bundle
|
|
113
|
+
*/
|
|
114
|
+
export const createBundleSchema = z.object({
|
|
115
|
+
bundle_request: requestBodySchema('Bundle request'),
|
|
116
|
+
});
|
|
117
|
+
/**
|
|
118
|
+
* Schema for getBundle method
|
|
119
|
+
* Endpoint: GET /bundle/{bundle_id}
|
|
120
|
+
*/
|
|
121
|
+
export const getBundleSchema = z.object({
|
|
122
|
+
bundle_id: idSchema('Bundle ID', 'The unique identifier for the bundle'),
|
|
123
|
+
});
|
|
124
|
+
/**
|
|
125
|
+
* Schema for cancelBundle method
|
|
126
|
+
* Endpoint: POST /bundle/{bundle_id}/cancel
|
|
127
|
+
*/
|
|
128
|
+
export const cancelBundleSchema = z.object({
|
|
129
|
+
bundle_id: idSchema('Bundle ID', 'The unique identifier for the bundle to cancel'),
|
|
130
|
+
});
|
|
131
|
+
/**
|
|
132
|
+
* Schema for getBundleLabel method
|
|
133
|
+
* Endpoint: GET /bundle/{bundle_id}/label
|
|
134
|
+
*/
|
|
135
|
+
export const getBundleLabelSchema = z.object({
|
|
136
|
+
bundle_id: idSchema('Bundle ID', 'The unique identifier for the bundle'),
|
|
137
|
+
});
|
|
138
|
+
// ==================== Packages (Single) ====================
|
|
139
|
+
/**
|
|
140
|
+
* Schema for createPackage method
|
|
141
|
+
* Endpoint: POST /package
|
|
142
|
+
*/
|
|
143
|
+
export const createPackageSchema = z.object({
|
|
144
|
+
package_request: requestBodySchema('Package request'),
|
|
145
|
+
});
|
|
146
|
+
/**
|
|
147
|
+
* Schema for getPackage method
|
|
148
|
+
* Endpoint: GET /package/{package_id}
|
|
149
|
+
*/
|
|
150
|
+
export const getPackageSchema = z.object({
|
|
151
|
+
package_id: idSchema('Package ID', 'The unique identifier for the package'),
|
|
152
|
+
});
|
|
153
|
+
/**
|
|
154
|
+
* Schema for deletePackage method
|
|
155
|
+
* Endpoint: DELETE /package/{package_id}
|
|
156
|
+
*/
|
|
157
|
+
export const deletePackageSchema = z.object({
|
|
158
|
+
package_id: idSchema('Package ID', 'The unique identifier for the package to delete'),
|
|
159
|
+
});
|
|
160
|
+
/**
|
|
161
|
+
* Schema for getPackageByOrderLineItem method
|
|
162
|
+
* Endpoint: GET /package/{order_line_item_id}/item
|
|
163
|
+
*/
|
|
164
|
+
export const getPackageByOrderLineItemSchema = z.object({
|
|
165
|
+
order_line_item_id: idSchema('Order line item ID', 'The order line item identifier'),
|
|
166
|
+
});
|
|
167
|
+
/**
|
|
168
|
+
* Schema for cancelPackage method
|
|
169
|
+
* Endpoint: POST /package/{package_id}/cancel
|
|
170
|
+
*/
|
|
171
|
+
export const cancelPackageSchema = z.object({
|
|
172
|
+
package_id: idSchema('Package ID', 'The unique identifier for the package to cancel'),
|
|
173
|
+
});
|
|
174
|
+
/**
|
|
175
|
+
* Schema for clonePackage method
|
|
176
|
+
* Endpoint: POST /package/{package_id}/clone
|
|
177
|
+
*/
|
|
178
|
+
export const clonePackageSchema = z.object({
|
|
179
|
+
package_id: idSchema('Package ID', 'The unique identifier for the package to clone'),
|
|
180
|
+
});
|
|
181
|
+
/**
|
|
182
|
+
* Schema for confirmPackage method
|
|
183
|
+
* Endpoint: POST /package/{package_id}/confirm
|
|
184
|
+
*/
|
|
185
|
+
export const confirmPackageSchema = z.object({
|
|
186
|
+
package_id: idSchema('Package ID', 'The unique identifier for the package to confirm'),
|
|
187
|
+
});
|
|
188
|
+
// ==================== Packages (Bulk) ====================
|
|
189
|
+
/**
|
|
190
|
+
* Schema for bulkCancelPackages method
|
|
191
|
+
* Endpoint: POST /package/bulk_cancel_packages
|
|
192
|
+
*/
|
|
193
|
+
export const bulkCancelPackagesSchema = z.object({
|
|
194
|
+
bulk_cancel_request: requestBodySchema('Bulk cancel request'),
|
|
195
|
+
});
|
|
196
|
+
/**
|
|
197
|
+
* Schema for bulkConfirmPackages method
|
|
198
|
+
* Endpoint: POST /package/bulk_confirm_packages
|
|
199
|
+
*/
|
|
200
|
+
export const bulkConfirmPackagesSchema = z.object({
|
|
201
|
+
bulk_confirm_request: requestBodySchema('Bulk confirm request'),
|
|
202
|
+
});
|
|
203
|
+
/**
|
|
204
|
+
* Schema for bulkDeletePackages method
|
|
205
|
+
* Endpoint: POST /package/bulk_delete_packages
|
|
206
|
+
*/
|
|
207
|
+
export const bulkDeletePackagesSchema = z.object({
|
|
208
|
+
bulk_delete_request: requestBodySchema('Bulk delete request'),
|
|
209
|
+
});
|
|
210
|
+
// ==================== Labels & Tracking ====================
|
|
211
|
+
/**
|
|
212
|
+
* Schema for getLabels method
|
|
213
|
+
* Endpoint: GET /labels
|
|
214
|
+
*/
|
|
215
|
+
export const getLabelsSchema = z.object({
|
|
216
|
+
params: paramsSchema,
|
|
217
|
+
});
|
|
218
|
+
/**
|
|
219
|
+
* Schema for getHandoverSheet method
|
|
220
|
+
* Endpoint: GET /handover_sheet
|
|
221
|
+
*/
|
|
222
|
+
export const getHandoverSheetSchema = z.object({
|
|
223
|
+
params: paramsSchema,
|
|
224
|
+
});
|
|
225
|
+
/**
|
|
226
|
+
* Schema for getTracking method
|
|
227
|
+
* Endpoint: GET /tracking
|
|
228
|
+
*/
|
|
229
|
+
export const getTrackingSchema = z.object({
|
|
230
|
+
params: z.record(z.string(), {
|
|
231
|
+
description: 'Query parameters (tracking_number required)',
|
|
232
|
+
}),
|
|
233
|
+
});
|
|
234
|
+
// ==================== Other ====================
|
|
235
|
+
/**
|
|
236
|
+
* Schema for createComplaint method
|
|
237
|
+
* Endpoint: POST /complaint
|
|
238
|
+
*/
|
|
239
|
+
export const createComplaintSchema = z.object({
|
|
240
|
+
complaint_request: requestBodySchema('Complaint request'),
|
|
241
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schemas for Identity API input validation
|
|
4
|
+
* Based on: src/api/other/identity.ts
|
|
5
|
+
* OpenAPI spec: docs/sell-apps/other-apis/commerce_identity_v1_oas3.json
|
|
6
|
+
* Types from: src/types/commerce_identity_v1_oas3.ts
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Schema for getUser method
|
|
10
|
+
* Endpoint: GET /user
|
|
11
|
+
* No parameters required - retrieves the authenticated user's account profile
|
|
12
|
+
*/
|
|
13
|
+
export const getUserSchema = z.object({});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schemas for Translation API input validation
|
|
4
|
+
* Based on: src/api/other/translation.ts
|
|
5
|
+
* OpenAPI spec: docs/sell-apps/other-apis/commerce_translation_v1_beta_oas3.json
|
|
6
|
+
* Types from: src/types/commerce_translation_v1_beta_oas3.ts
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Schema for translate method
|
|
10
|
+
* Endpoint: POST /translate
|
|
11
|
+
* Body: TranslateRequest - from, to, translationContext, text
|
|
12
|
+
*/
|
|
13
|
+
export const translateSchema = z.object({
|
|
14
|
+
from: z
|
|
15
|
+
.string({
|
|
16
|
+
invalid_type_error: 'from must be a string',
|
|
17
|
+
description: 'The language of the input text to be translated (e.g., en_US, fr_FR, de_DE)',
|
|
18
|
+
})
|
|
19
|
+
.optional(),
|
|
20
|
+
to: z
|
|
21
|
+
.string({
|
|
22
|
+
invalid_type_error: 'to must be a string',
|
|
23
|
+
description: 'The target language for translation (e.g., en_US, fr_FR, de_DE)',
|
|
24
|
+
})
|
|
25
|
+
.optional(),
|
|
26
|
+
translation_context: z
|
|
27
|
+
.string({
|
|
28
|
+
invalid_type_error: 'translation_context must be a string',
|
|
29
|
+
description: 'The listing entity to translate (ITEM_TITLE or ITEM_DESCRIPTION)',
|
|
30
|
+
})
|
|
31
|
+
.optional(),
|
|
32
|
+
text: z
|
|
33
|
+
.array(z.string({
|
|
34
|
+
invalid_type_error: 'text array items must be strings',
|
|
35
|
+
description: 'Text string to translate',
|
|
36
|
+
}), {
|
|
37
|
+
invalid_type_error: 'text must be an array',
|
|
38
|
+
description: 'Array of text to translate (max 1000 chars for ITEM_TITLE, 20,000 for ITEM_DESCRIPTION)',
|
|
39
|
+
})
|
|
40
|
+
.optional(),
|
|
41
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schemas for VERO API input validation
|
|
4
|
+
* Based on: src/api/other/vero.ts
|
|
5
|
+
* OpenAPI spec: docs/sell-apps/other-apis/commerce_vero_v1_oas3.json
|
|
6
|
+
* Types from: src/types/commerce_vero_v1_oas3.ts
|
|
7
|
+
*
|
|
8
|
+
* Note: The VERO API is only available for members of the Verified Rights Owner (VeRO) Program
|
|
9
|
+
*/
|
|
10
|
+
// Reusable schema for filter parameter
|
|
11
|
+
const filterSchema = z
|
|
12
|
+
.string({
|
|
13
|
+
message: 'Filter must be a string',
|
|
14
|
+
invalid_type_error: 'filter must be a string',
|
|
15
|
+
description: 'Filter criteria for the query (e.g., date range)',
|
|
16
|
+
})
|
|
17
|
+
.optional();
|
|
18
|
+
// Reusable schema for limit parameter (string in API)
|
|
19
|
+
const limitSchema = z
|
|
20
|
+
.string({
|
|
21
|
+
invalid_type_error: 'limit must be a string',
|
|
22
|
+
description: 'Maximum number of items to return',
|
|
23
|
+
})
|
|
24
|
+
.optional();
|
|
25
|
+
// Reusable schema for offset parameter (string in API)
|
|
26
|
+
const offsetSchema = z
|
|
27
|
+
.string({
|
|
28
|
+
invalid_type_error: 'offset must be a string',
|
|
29
|
+
description: 'Number of items to skip',
|
|
30
|
+
})
|
|
31
|
+
.optional();
|
|
32
|
+
/**
|
|
33
|
+
* Schema for createVeroReport method
|
|
34
|
+
* Endpoint: POST /vero_report
|
|
35
|
+
* Body: VeroReportItemsRequest - report data
|
|
36
|
+
*/
|
|
37
|
+
export const createVeroReportSchema = z.object({
|
|
38
|
+
report_data: z.record(z.unknown(), {
|
|
39
|
+
message: 'Report data is required',
|
|
40
|
+
required_error: 'report_data is required',
|
|
41
|
+
invalid_type_error: 'report_data must be an object',
|
|
42
|
+
description: 'The VeRO report data containing item details and intellectual property violation information',
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Schema for getVeroReport method
|
|
47
|
+
* Endpoint: GET /vero_report/{vero_report_id}
|
|
48
|
+
* Path: vero_report_id
|
|
49
|
+
*/
|
|
50
|
+
export const getVeroReportSchema = z.object({
|
|
51
|
+
vero_report_id: z
|
|
52
|
+
.string({
|
|
53
|
+
message: 'VERO report ID is required',
|
|
54
|
+
required_error: 'vero_report_id is required',
|
|
55
|
+
invalid_type_error: 'vero_report_id must be a string',
|
|
56
|
+
description: 'The unique identifier of the VERO report',
|
|
57
|
+
})
|
|
58
|
+
.min(1, 'VERO report ID cannot be empty'),
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* Schema for getVeroReportItems method
|
|
62
|
+
* Endpoint: GET /vero_report_items
|
|
63
|
+
* Query: filter, limit, offset
|
|
64
|
+
*/
|
|
65
|
+
export const getVeroReportItemsSchema = z.object({
|
|
66
|
+
filter: filterSchema,
|
|
67
|
+
limit: limitSchema,
|
|
68
|
+
offset: offsetSchema,
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Schema for getVeroReasonCode method
|
|
72
|
+
* Endpoint: GET /vero_reason_code/{vero_reason_code_id}
|
|
73
|
+
* Path: vero_reason_code_id
|
|
74
|
+
*/
|
|
75
|
+
export const getVeroReasonCodeSchema = z.object({
|
|
76
|
+
vero_reason_code_id: z
|
|
77
|
+
.string({
|
|
78
|
+
message: 'VERO reason code ID is required',
|
|
79
|
+
required_error: 'vero_reason_code_id is required',
|
|
80
|
+
invalid_type_error: 'vero_reason_code_id must be a string',
|
|
81
|
+
description: 'The unique identifier of the VERO reason code',
|
|
82
|
+
})
|
|
83
|
+
.min(1, 'VERO reason code ID cannot be empty'),
|
|
84
|
+
});
|
|
85
|
+
/**
|
|
86
|
+
* Schema for getVeroReasonCodes method
|
|
87
|
+
* Endpoint: GET /vero_reason_code
|
|
88
|
+
* No parameters required
|
|
89
|
+
*/
|
|
90
|
+
export const getVeroReasonCodesSchema = z.object({});
|
|
@@ -0,0 +1,207 @@
|
|
|
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
|
|
162
|
+
*/
|
|
163
|
+
export function getScopeDescription(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
|
+
}
|