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,84 +0,0 @@
1
- /**
2
- * Fetches and parses the eBay API Status RSS feed (public, no auth).
3
- * Used by the ebay_get_api_status MCP tool and optionally by the docs sync script.
4
- */
5
- import { XMLParser } from 'fast-xml-parser';
6
- import { httpRequest, isHttpError } from './http.js';
7
- const RSS_URL = 'https://developer.ebay.com/rss/api-status';
8
- function stripHtml(html) {
9
- return html
10
- .replace(/<[^>]+>/g, ' ')
11
- .replace(/\s+/g, ' ')
12
- .trim();
13
- }
14
- function normalizeString(value) {
15
- if (value == null)
16
- return '';
17
- if (typeof value === 'string')
18
- return value.trim();
19
- if (typeof value === 'number' || typeof value === 'boolean')
20
- return String(value).trim();
21
- return '';
22
- }
23
- function parseItem(raw) {
24
- const summary = normalizeString(raw.summary) || stripHtml(normalizeString(raw.description)).slice(0, 300) || '';
25
- return {
26
- title: normalizeString(raw.title) || 'Untitled',
27
- summary: summary || normalizeString(raw.title),
28
- link: normalizeString(raw.link) || '',
29
- api: normalizeString(raw.api) || '',
30
- site: normalizeString(raw.site) || '',
31
- status: normalizeString(raw.status) || '',
32
- lastUpdated: normalizeString(raw.lastUpdated) || '',
33
- };
34
- }
35
- function ensureArray(value) {
36
- if (value == null)
37
- return [];
38
- return Array.isArray(value) ? value : [value];
39
- }
40
- /**
41
- * Fetches the eBay API Status RSS feed, parses it, and returns items
42
- * optionally filtered by status and API name, limited to `limit` items.
43
- */
44
- export async function getApiStatusFeed(options = {}) {
45
- const { limit = 20, status: statusFilter, api: apiFilter } = options;
46
- try {
47
- const response = await httpRequest({
48
- url: RSS_URL,
49
- timeoutMs: 15_000,
50
- responseType: 'text',
51
- headers: { Accept: 'application/rss+xml, application/xml, text/xml' },
52
- });
53
- const xml = response.data;
54
- const parser = new XMLParser({
55
- ignoreAttributes: true,
56
- trimValues: true,
57
- parseTagValue: false,
58
- });
59
- const parsed = parser.parse(xml);
60
- const channel = parsed?.rss?.channel;
61
- if (!channel) {
62
- return { items: [], error: 'RSS feed missing channel' };
63
- }
64
- const rawItems = ensureArray(channel.item);
65
- let items = rawItems.map(parseItem);
66
- if (statusFilter) {
67
- items = items.filter((i) => i.status.toLowerCase() === statusFilter.toLowerCase());
68
- }
69
- if (apiFilter?.trim()) {
70
- const needle = apiFilter.trim().toLowerCase();
71
- items = items.filter((i) => i.api.toLowerCase().includes(needle));
72
- }
73
- items = items.slice(0, Math.min(limit, 50));
74
- return { items };
75
- }
76
- catch (err) {
77
- const message = isHttpError(err) && err.status
78
- ? `Feed unavailable (HTTP ${err.status})`
79
- : err instanceof Error
80
- ? err.message
81
- : 'Failed to fetch API status feed';
82
- return { items: [], error: message };
83
- }
84
- }
@@ -1,47 +0,0 @@
1
- import chalk from 'chalk';
2
- /**
3
- * Shared terminal styling for the project's interactive CLIs.
4
- *
5
- * These helpers print to stdout, which is correct for the setup/skills wizards
6
- * (the stdout-is-reserved rule applies to the MCP *server* runtime, not CLI
7
- * tooling). The eBay brand palette matches the setup wizard.
8
- */
9
- export const ebayPalette = {
10
- red: chalk.hex('#E53238'),
11
- blue: chalk.hex('#0064D2'),
12
- yellow: chalk.hex('#F5AF02'),
13
- green: chalk.hex('#86B817'),
14
- };
15
- /** Semantic text styles used across CLI output. */
16
- export const ui = {
17
- dim: chalk.dim,
18
- bold: chalk.bold,
19
- success: chalk.green,
20
- warning: chalk.yellow,
21
- error: chalk.red,
22
- info: chalk.cyan,
23
- };
24
- /** Prints a green success line. */
25
- export function printSuccess(message) {
26
- console.log(` ${ui.success('✓')} ${message}`);
27
- }
28
- /** Prints a yellow warning line. */
29
- export function printWarning(message) {
30
- console.log(` ${ui.warning('⚠')} ${message}`);
31
- }
32
- /** Prints a red error line. */
33
- export function printError(message) {
34
- console.log(` ${ui.error('✗')} ${message}`);
35
- }
36
- /** Prints a cyan info line. */
37
- export function printInfo(message) {
38
- console.log(` ${ui.info('ℹ')} ${message}`);
39
- }
40
- /** Prints a bold section heading preceded by a blank line. */
41
- export function printHeading(title) {
42
- console.log(`\n ${ui.bold(title)}`);
43
- }
44
- /** Prints a dim horizontal rule. */
45
- export function printRule(width = 56) {
46
- console.log(' ' + ui.dim('─'.repeat(width)));
47
- }
@@ -1,369 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Zod schemas for Dispute API input validation
4
- * Based on: src/api/order-management/dispute.ts
5
- * OpenAPI spec: docs/sell-apps/order-management/sell_fulfillment_v1_oas3.json
6
- * Types from: src/types/sell_fulfillment_v1_oas3.ts
7
- */
8
- // Reusable schema for payment dispute ID
9
- const paymentDisputeIdSchema = z.string({
10
- message: 'Payment dispute ID is required',
11
- required_error: 'payment_dispute_id is required',
12
- invalid_type_error: 'payment_dispute_id must be a string',
13
- description: 'The unique identifier of the payment dispute',
14
- });
15
- // Reusable schema for evidence ID
16
- const evidenceIdSchema = z.string({
17
- message: 'Evidence ID is required',
18
- required_error: 'evidence_id is required',
19
- invalid_type_error: 'evidence_id must be a string',
20
- description: 'The unique identifier of the evidence file set',
21
- });
22
- // Reusable schema for file ID
23
- const fileIdSchema = z.string({
24
- message: 'File ID is required',
25
- required_error: 'file_id is required',
26
- invalid_type_error: 'file_id must be a string',
27
- description: 'The unique identifier of an evidential file',
28
- });
29
- // Reusable schema for limit parameter (number in API)
30
- const limitSchema = z
31
- .number({
32
- invalid_type_error: 'limit must be a number',
33
- description: 'Maximum number of payment disputes to return (default: 200, max: 200)',
34
- })
35
- .optional();
36
- // Reusable schema for offset parameter (number in API)
37
- const offsetSchema = z
38
- .number({
39
- invalid_type_error: 'offset must be a number',
40
- description: 'Number of payment disputes to skip (zero-based index)',
41
- })
42
- .optional();
43
- /**
44
- * Schema for getPaymentDispute method
45
- * Endpoint: GET /payment_dispute/{payment_dispute_id}
46
- * Path: payment_dispute_id (required)
47
- */
48
- export const getPaymentDisputeSchema = z.object({
49
- payment_dispute_id: paymentDisputeIdSchema,
50
- });
51
- /**
52
- * Schema for fetchEvidenceContent method
53
- * Endpoint: GET /payment_dispute/{payment_dispute_id}/fetch_evidence_content
54
- * Path: payment_dispute_id (required)
55
- * Query: evidence_id (required), file_id (required)
56
- */
57
- export const fetchEvidenceContentSchema = z.object({
58
- payment_dispute_id: paymentDisputeIdSchema,
59
- evidence_id: evidenceIdSchema,
60
- file_id: fileIdSchema,
61
- });
62
- /**
63
- * Schema for getActivities method
64
- * Endpoint: GET /payment_dispute/{payment_dispute_id}/activity
65
- * Path: payment_dispute_id (required)
66
- */
67
- export const getActivitiesSchema = z.object({
68
- payment_dispute_id: paymentDisputeIdSchema,
69
- });
70
- /**
71
- * Schema for getPaymentDisputeSummaries method
72
- * Endpoint: GET /payment_dispute_summary
73
- * Query: order_id, buyer_username, open_date_from, open_date_to, payment_dispute_status, limit, offset
74
- */
75
- export const getPaymentDisputeSummariesSchema = z.object({
76
- order_id: z
77
- .string({
78
- invalid_type_error: 'order_id must be a string',
79
- description: 'Filter by a specific order ID',
80
- })
81
- .optional(),
82
- buyer_username: z
83
- .string({
84
- invalid_type_error: 'buyer_username must be a string',
85
- description: "Filter by buyer's eBay username",
86
- })
87
- .optional(),
88
- open_date_from: z
89
- .string({
90
- invalid_type_error: 'open_date_from must be a string',
91
- description: 'Filter disputes opened on or after this date (ISO 8601 format)',
92
- })
93
- .optional(),
94
- open_date_to: z
95
- .string({
96
- invalid_type_error: 'open_date_to must be a string',
97
- description: 'Filter disputes opened on or before this date (ISO 8601 format)',
98
- })
99
- .optional(),
100
- payment_dispute_status: z
101
- .string({
102
- invalid_type_error: 'payment_dispute_status must be a string',
103
- description: 'Filter by dispute status (e.g., OPEN, ACTION_NEEDED, CLOSED)',
104
- })
105
- .optional(),
106
- limit: limitSchema,
107
- offset: offsetSchema,
108
- });
109
- /**
110
- * Schema for contestPaymentDispute method
111
- * Endpoint: POST /payment_dispute/{payment_dispute_id}/contest
112
- * Path: payment_dispute_id (required)
113
- * Body: ContestPaymentDisputeRequest (optional) - note, returnAddress, revision
114
- */
115
- export const contestPaymentDisputeSchema = z.object({
116
- payment_dispute_id: paymentDisputeIdSchema,
117
- note: z
118
- .string({
119
- invalid_type_error: 'note must be a string',
120
- description: 'Information about the dispute (max 1000 characters)',
121
- })
122
- .max(1000, 'Note must not exceed 1000 characters')
123
- .optional(),
124
- return_address: z
125
- .object({
126
- full_name: z
127
- .string({
128
- invalid_type_error: 'full_name must be a string',
129
- description: 'Full name of the person at the return address',
130
- })
131
- .optional(),
132
- primary_phone: z
133
- .object({
134
- phone_number: z
135
- .string({
136
- invalid_type_error: 'phone_number must be a string',
137
- description: 'Primary phone number',
138
- })
139
- .optional(),
140
- })
141
- .optional(),
142
- address_line1: z
143
- .string({
144
- invalid_type_error: 'address_line1 must be a string',
145
- description: 'First line of the street address',
146
- })
147
- .optional(),
148
- address_line2: z
149
- .string({
150
- invalid_type_error: 'address_line2 must be a string',
151
- description: 'Second line of the street address',
152
- })
153
- .optional(),
154
- city: z
155
- .string({
156
- invalid_type_error: 'city must be a string',
157
- description: 'City',
158
- })
159
- .optional(),
160
- state_or_province: z
161
- .string({
162
- invalid_type_error: 'state_or_province must be a string',
163
- description: 'State or province',
164
- })
165
- .optional(),
166
- postal_code: z
167
- .string({
168
- invalid_type_error: 'postal_code must be a string',
169
- description: 'Postal code',
170
- })
171
- .optional(),
172
- country_code: z
173
- .string({
174
- invalid_type_error: 'country_code must be a string',
175
- description: 'Two-letter ISO 3166-1 alpha-2 country code',
176
- })
177
- .optional(),
178
- })
179
- .optional(),
180
- revision: z
181
- .number({
182
- invalid_type_error: 'revision must be a number',
183
- description: 'Revision number of the payment dispute (required)',
184
- })
185
- .optional(),
186
- });
187
- /**
188
- * Schema for acceptPaymentDispute method
189
- * Endpoint: POST /payment_dispute/{payment_dispute_id}/accept
190
- * Path: payment_dispute_id (required)
191
- * Body: AcceptPaymentDisputeRequest (optional) - returnAddress, revision
192
- */
193
- export const acceptPaymentDisputeSchema = z.object({
194
- payment_dispute_id: paymentDisputeIdSchema,
195
- return_address: z
196
- .object({
197
- full_name: z
198
- .string({
199
- invalid_type_error: 'full_name must be a string',
200
- description: 'Full name of the person at the return address',
201
- })
202
- .optional(),
203
- primary_phone: z
204
- .object({
205
- phone_number: z
206
- .string({
207
- invalid_type_error: 'phone_number must be a string',
208
- description: 'Primary phone number',
209
- })
210
- .optional(),
211
- })
212
- .optional(),
213
- address_line1: z
214
- .string({
215
- invalid_type_error: 'address_line1 must be a string',
216
- description: 'First line of the street address',
217
- })
218
- .optional(),
219
- address_line2: z
220
- .string({
221
- invalid_type_error: 'address_line2 must be a string',
222
- description: 'Second line of the street address',
223
- })
224
- .optional(),
225
- city: z
226
- .string({
227
- invalid_type_error: 'city must be a string',
228
- description: 'City',
229
- })
230
- .optional(),
231
- state_or_province: z
232
- .string({
233
- invalid_type_error: 'state_or_province must be a string',
234
- description: 'State or province',
235
- })
236
- .optional(),
237
- postal_code: z
238
- .string({
239
- invalid_type_error: 'postal_code must be a string',
240
- description: 'Postal code',
241
- })
242
- .optional(),
243
- country_code: z
244
- .string({
245
- invalid_type_error: 'country_code must be a string',
246
- description: 'Two-letter ISO 3166-1 alpha-2 country code',
247
- })
248
- .optional(),
249
- })
250
- .optional(),
251
- revision: z
252
- .number({
253
- invalid_type_error: 'revision must be a number',
254
- description: 'Revision number of the payment dispute (required)',
255
- })
256
- .optional(),
257
- });
258
- /**
259
- * Schema for uploadEvidenceFile method
260
- * Endpoint: POST /payment_dispute/{payment_dispute_id}/upload_evidence_file
261
- * Path: payment_dispute_id (required)
262
- * Body: ArrayBuffer (binary file data)
263
- */
264
- export const uploadEvidenceFileSchema = z.object({
265
- payment_dispute_id: paymentDisputeIdSchema,
266
- file_data: z.instanceof(ArrayBuffer, {
267
- message: 'File data must be an ArrayBuffer',
268
- }),
269
- });
270
- /**
271
- * Schema for addEvidence method
272
- * Endpoint: POST /payment_dispute/{payment_dispute_id}/add_evidence
273
- * Path: payment_dispute_id (required)
274
- * Body: AddEvidencePaymentDisputeRequest - evidenceType, files, lineItems
275
- */
276
- export const addEvidenceSchema = z.object({
277
- payment_dispute_id: paymentDisputeIdSchema,
278
- evidence_type: z
279
- .string({
280
- invalid_type_error: 'evidence_type must be a string',
281
- description: 'Type of evidence (e.g., PROOF_OF_DELIVERY, PROOF_OF_AUTHENTICATION)',
282
- })
283
- .optional(),
284
- files: z
285
- .array(z.object({
286
- file_id: z
287
- .string({
288
- invalid_type_error: 'file_id must be a string',
289
- description: 'Unique identifier of the evidence file',
290
- })
291
- .optional(),
292
- }), {
293
- invalid_type_error: 'files must be an array',
294
- description: 'Array of evidence files',
295
- })
296
- .optional(),
297
- line_items: z
298
- .array(z.object({
299
- item_id: z
300
- .string({
301
- invalid_type_error: 'item_id must be a string',
302
- description: 'eBay listing ID',
303
- })
304
- .optional(),
305
- line_item_id: z
306
- .string({
307
- invalid_type_error: 'line_item_id must be a string',
308
- description: 'Unique identifier of the line item',
309
- })
310
- .optional(),
311
- }), {
312
- invalid_type_error: 'line_items must be an array',
313
- description: 'Array of order line items',
314
- })
315
- .optional(),
316
- });
317
- /**
318
- * Schema for updateEvidence method
319
- * Endpoint: POST /payment_dispute/{payment_dispute_id}/update_evidence
320
- * Path: payment_dispute_id (required)
321
- * Body: UpdateEvidencePaymentDisputeRequest - evidenceId, evidenceType, files, lineItems
322
- */
323
- export const updateEvidenceSchema = z.object({
324
- payment_dispute_id: paymentDisputeIdSchema,
325
- evidence_id: z
326
- .string({
327
- invalid_type_error: 'evidence_id must be a string',
328
- description: 'Unique identifier of the evidence set to update',
329
- })
330
- .optional(),
331
- evidence_type: z
332
- .string({
333
- invalid_type_error: 'evidence_type must be a string',
334
- description: 'Type of evidence (e.g., PROOF_OF_DELIVERY, PROOF_OF_AUTHENTICATION)',
335
- })
336
- .optional(),
337
- files: z
338
- .array(z.object({
339
- file_id: z
340
- .string({
341
- invalid_type_error: 'file_id must be a string',
342
- description: 'Unique identifier of the evidence file',
343
- })
344
- .optional(),
345
- }), {
346
- invalid_type_error: 'files must be an array',
347
- description: 'Array of evidence files',
348
- })
349
- .optional(),
350
- line_items: z
351
- .array(z.object({
352
- item_id: z
353
- .string({
354
- invalid_type_error: 'item_id must be a string',
355
- description: 'eBay listing ID',
356
- })
357
- .optional(),
358
- line_item_id: z
359
- .string({
360
- invalid_type_error: 'line_item_id must be a string',
361
- description: 'Unique identifier of the line item',
362
- })
363
- .optional(),
364
- }), {
365
- invalid_type_error: 'line_items must be an array',
366
- description: 'Array of order line items',
367
- })
368
- .optional(),
369
- });
@@ -1,205 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Zod schemas for Fulfillment API input validation
4
- * Based on: src/api/order-management/fulfillment.ts
5
- * OpenAPI spec: docs/sell-apps/order-management/sell_fulfillment_v1_oas3.json
6
- * Types from: src/types/sell_fulfillment_v1_oas3.ts
7
- */
8
- // Reusable schema for order ID
9
- const orderIdSchema = z.string({
10
- message: 'Order ID is required',
11
- required_error: 'order_id is required',
12
- invalid_type_error: 'order_id must be a string',
13
- description: 'The unique identifier of the order',
14
- });
15
- // Reusable schema for fulfillment ID
16
- const fulfillmentIdSchema = z.string({
17
- message: 'Fulfillment ID is required',
18
- required_error: 'fulfillment_id is required',
19
- invalid_type_error: 'fulfillment_id must be a string',
20
- description: 'The unique identifier of the shipping fulfillment',
21
- });
22
- // Reusable schema for filter parameter
23
- const filterSchema = z
24
- .string({
25
- invalid_type_error: 'filter must be a string',
26
- description: 'Filter criteria for orders (e.g., orderfulfillmentstatus:{NOT_STARTED|IN_PROGRESS}, creationdate:[2020-01-01T00:00:00.000Z..2020-12-31T23:59:59.999Z])',
27
- })
28
- .optional();
29
- // Reusable schema for limit parameter (number in API)
30
- const limitSchema = z
31
- .number({
32
- invalid_type_error: 'limit must be a number',
33
- description: 'Maximum number of orders to return (default: 50)',
34
- })
35
- .optional();
36
- // Reusable schema for offset parameter (number in API)
37
- const offsetSchema = z
38
- .number({
39
- invalid_type_error: 'offset must be a number',
40
- description: 'Number of orders to skip (zero-based index)',
41
- })
42
- .optional();
43
- /**
44
- * Schema for getOrders method
45
- * Endpoint: GET /order
46
- * Query: filter, limit, offset
47
- */
48
- export const getOrdersSchema = z.object({
49
- filter: filterSchema,
50
- limit: limitSchema,
51
- offset: offsetSchema,
52
- });
53
- /**
54
- * Schema for getOrder method
55
- * Endpoint: GET /order/{orderId}
56
- * Path: orderId (required)
57
- */
58
- export const getOrderSchema = z.object({
59
- order_id: orderIdSchema,
60
- });
61
- /**
62
- * Schema for createShippingFulfillment method
63
- * Endpoint: POST /order/{orderId}/shipping_fulfillment
64
- * Path: orderId (required)
65
- * Body: ShippingFulfillmentDetails - lineItems, shippedDate, shippingCarrierCode, trackingNumber
66
- */
67
- export const createShippingFulfillmentSchema = z.object({
68
- order_id: orderIdSchema,
69
- line_items: z
70
- .array(z.object({
71
- line_item_id: z
72
- .string({
73
- invalid_type_error: 'line_item_id must be a string',
74
- description: 'Unique identifier of the line item',
75
- })
76
- .optional(),
77
- quantity: z
78
- .number({
79
- invalid_type_error: 'quantity must be a number',
80
- description: 'Number of units being fulfilled',
81
- })
82
- .optional(),
83
- }), {
84
- invalid_type_error: 'line_items must be an array',
85
- description: 'Array of line items to fulfill (required)',
86
- })
87
- .optional(),
88
- shipped_date: z
89
- .string({
90
- invalid_type_error: 'shipped_date must be a string',
91
- description: 'Date/time the order was shipped (ISO 8601 format, defaults to current time)',
92
- })
93
- .optional(),
94
- shipping_carrier_code: z
95
- .string({
96
- invalid_type_error: 'shipping_carrier_code must be a string',
97
- description: 'Shipping carrier code (e.g., USPS, UPS, FEDEX)',
98
- })
99
- .optional(),
100
- tracking_number: z
101
- .string({
102
- invalid_type_error: 'tracking_number must be a string',
103
- description: 'Shipment tracking number',
104
- })
105
- .optional(),
106
- });
107
- /**
108
- * Schema for getShippingFulfillments method
109
- * Endpoint: GET /order/{orderId}/shipping_fulfillment
110
- * Path: orderId (required)
111
- */
112
- export const getShippingFulfillmentsSchema = z.object({
113
- order_id: orderIdSchema,
114
- });
115
- /**
116
- * Schema for getShippingFulfillment method
117
- * Endpoint: GET /order/{orderId}/shipping_fulfillment/{fulfillmentId}
118
- * Path: orderId (required), fulfillmentId (required)
119
- */
120
- export const getShippingFulfillmentSchema = z.object({
121
- order_id: orderIdSchema,
122
- fulfillment_id: fulfillmentIdSchema,
123
- });
124
- /**
125
- * Schema for issueRefund method
126
- * Endpoint: POST /order/{orderId}/issue_refund
127
- * Path: orderId (required)
128
- * Body: IssueRefundRequest - reasonForRefund, comment, refundItems, orderLevelRefundAmount
129
- */
130
- export const issueRefundSchema = z.object({
131
- order_id: orderIdSchema,
132
- reason_for_refund: z
133
- .string({
134
- invalid_type_error: 'reason_for_refund must be a string',
135
- description: 'Reason for issuing the refund (e.g., BUYER_CANCEL, OUT_OF_STOCK)',
136
- })
137
- .optional(),
138
- comment: z
139
- .string({
140
- invalid_type_error: 'comment must be a string',
141
- description: 'Optional comment about the refund',
142
- })
143
- .optional(),
144
- refund_items: z
145
- .array(z.object({
146
- line_item_id: z
147
- .string({
148
- invalid_type_error: 'line_item_id must be a string',
149
- description: 'Unique identifier of the line item to refund',
150
- })
151
- .optional(),
152
- refund_amount: z
153
- .object({
154
- value: z
155
- .string({
156
- invalid_type_error: 'value must be a string',
157
- description: 'Monetary amount',
158
- })
159
- .optional(),
160
- currency: z
161
- .string({
162
- invalid_type_error: 'currency must be a string',
163
- description: 'Three-letter ISO 4217 currency code',
164
- })
165
- .optional(),
166
- })
167
- .optional(),
168
- legacy_reference: z
169
- .object({
170
- legacy_item_id: z
171
- .string({
172
- invalid_type_error: 'legacy_item_id must be a string',
173
- description: 'Legacy eBay item ID',
174
- })
175
- .optional(),
176
- legacy_transaction_id: z
177
- .string({
178
- invalid_type_error: 'legacy_transaction_id must be a string',
179
- description: 'Legacy transaction ID',
180
- })
181
- .optional(),
182
- })
183
- .optional(),
184
- }), {
185
- invalid_type_error: 'refund_items must be an array',
186
- description: 'Array of line items to refund',
187
- })
188
- .optional(),
189
- order_level_refund_amount: z
190
- .object({
191
- value: z
192
- .string({
193
- invalid_type_error: 'value must be a string',
194
- description: 'Monetary amount',
195
- })
196
- .optional(),
197
- currency: z
198
- .string({
199
- invalid_type_error: 'currency must be a string',
200
- description: 'Three-letter ISO 4217 currency code',
201
- })
202
- .optional(),
203
- })
204
- .optional(),
205
- });