@lofder/dsers-mcp-product 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 +210 -0
- package/dist/dsers/account.d.ts +17 -0
- package/dist/dsers/account.d.ts.map +1 -0
- package/dist/dsers/account.js +37 -0
- package/dist/dsers/account.js.map +1 -0
- package/dist/dsers/auth.d.ts +14 -0
- package/dist/dsers/auth.d.ts.map +1 -0
- package/dist/dsers/auth.js +87 -0
- package/dist/dsers/auth.js.map +1 -0
- package/dist/dsers/client.d.ts +21 -0
- package/dist/dsers/client.d.ts.map +1 -0
- package/dist/dsers/client.js +78 -0
- package/dist/dsers/client.js.map +1 -0
- package/dist/dsers/config.d.ts +9 -0
- package/dist/dsers/config.d.ts.map +1 -0
- package/dist/dsers/config.js +28 -0
- package/dist/dsers/config.js.map +1 -0
- package/dist/dsers/product.d.ts +42 -0
- package/dist/dsers/product.d.ts.map +1 -0
- package/dist/dsers/product.js +289 -0
- package/dist/dsers/product.js.map +1 -0
- package/dist/dsers/settings.d.ts +30 -0
- package/dist/dsers/settings.d.ts.map +1 -0
- package/dist/dsers/settings.js +63 -0
- package/dist/dsers/settings.js.map +1 -0
- package/dist/error-map.d.ts +7 -0
- package/dist/error-map.d.ts.map +1 -0
- package/dist/error-map.js +231 -0
- package/dist/error-map.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/job-store-memory.d.ts +8 -0
- package/dist/job-store-memory.d.ts.map +1 -0
- package/dist/job-store-memory.js +60 -0
- package/dist/job-store-memory.js.map +1 -0
- package/dist/job-store.d.ts +14 -0
- package/dist/job-store.d.ts.map +1 -0
- package/dist/job-store.js +31 -0
- package/dist/job-store.js.map +1 -0
- package/dist/provider.d.ts +53 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +1298 -0
- package/dist/provider.js.map +1 -0
- package/dist/push-options.d.ts +7 -0
- package/dist/push-options.d.ts.map +1 -0
- package/dist/push-options.js +158 -0
- package/dist/push-options.js.map +1 -0
- package/dist/resolver.d.ts +8 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/resolver.js +81 -0
- package/dist/resolver.js.map +1 -0
- package/dist/rules.d.ts +14 -0
- package/dist/rules.d.ts.map +1 -0
- package/dist/rules.js +332 -0
- package/dist/rules.js.map +1 -0
- package/dist/service.d.ts +22 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +461 -0
- package/dist/service.js.map +1 -0
- package/dist/tools.d.ts +4 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +402 -0
- package/dist/tools.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
export function cleanNone(value) {
|
|
2
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
3
|
+
const obj = value;
|
|
4
|
+
return Object.fromEntries(Object.entries(obj)
|
|
5
|
+
.filter(([, v]) => v != null)
|
|
6
|
+
.map(([k, v]) => [k, cleanNone(v)]));
|
|
7
|
+
}
|
|
8
|
+
if (Array.isArray(value)) {
|
|
9
|
+
return value.filter((v) => v != null).map((v) => cleanNone(v));
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
export function coerceIntId(value) {
|
|
14
|
+
if (typeof value === "string") {
|
|
15
|
+
const text = value.trim();
|
|
16
|
+
if (/^-?\d+$/.test(text)) {
|
|
17
|
+
const n = parseInt(text, 10);
|
|
18
|
+
if (!Number.isNaN(n) && Number.isSafeInteger(n))
|
|
19
|
+
return n;
|
|
20
|
+
return text;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
export function mergeLegacyPushSettings(target, source) {
|
|
26
|
+
if (source === null || typeof source !== "object" || Array.isArray(source))
|
|
27
|
+
return;
|
|
28
|
+
const src = source;
|
|
29
|
+
const setIfMissing = (key, val) => {
|
|
30
|
+
if (val !== undefined && val !== null && (target[key] === undefined || target[key] === null)) {
|
|
31
|
+
target[key] = val;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const visibleKeys = [
|
|
35
|
+
"visible",
|
|
36
|
+
"publishToOnlineStore",
|
|
37
|
+
"pushOnlineStore",
|
|
38
|
+
"alsoPublishToOnlineStore",
|
|
39
|
+
"publishOnlineStore",
|
|
40
|
+
];
|
|
41
|
+
for (const key of visibleKeys) {
|
|
42
|
+
if (key in src) {
|
|
43
|
+
setIfMissing("visible", Boolean(src[key]));
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const inventoryKeys = ["inventoryPolicy", "outofStockSelling"];
|
|
48
|
+
for (const key of inventoryKeys) {
|
|
49
|
+
if (key in src) {
|
|
50
|
+
setIfMissing("inventoryPolicy", Boolean(src[key]));
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if ("onlyPushSpecifications" in src) {
|
|
55
|
+
setIfMissing("onlyPushSpecifications", Boolean(src.onlyPushSpecifications));
|
|
56
|
+
}
|
|
57
|
+
const imageKeys = ["isPushAllImage", "isPushAllImages", "pushAllImages"];
|
|
58
|
+
for (const key of imageKeys) {
|
|
59
|
+
if (key in src) {
|
|
60
|
+
setIfMissing("isPushAllImage", Boolean(src[key]));
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const priceRuleKeys = [
|
|
65
|
+
"withPriceRule",
|
|
66
|
+
"applyPricingRule",
|
|
67
|
+
"pricing",
|
|
68
|
+
"pricingRuleApplied",
|
|
69
|
+
"usePricingRule",
|
|
70
|
+
];
|
|
71
|
+
for (const key of priceRuleKeys) {
|
|
72
|
+
if (key in src) {
|
|
73
|
+
setIfMissing("withPriceRule", Boolean(src[key]));
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const saleChannelKeys = ["saleChannels", "salesChannels", "publishChannels"];
|
|
78
|
+
for (const key of saleChannelKeys) {
|
|
79
|
+
if (src[key] != null) {
|
|
80
|
+
setIfMissing("saleChannels", src[key]);
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
let pushStatus = src.pushStatus;
|
|
85
|
+
if (pushStatus == null && src.pushAsDraft != null) {
|
|
86
|
+
const pad = String(src.pushAsDraft ?? "").trim().toUpperCase();
|
|
87
|
+
if (pad === "ACTIVE" || pad === "TRUE")
|
|
88
|
+
pushStatus = "ACTIVE";
|
|
89
|
+
else if (pad === "DRAFT" || pad === "FALSE")
|
|
90
|
+
pushStatus = "DRAFT";
|
|
91
|
+
}
|
|
92
|
+
if (typeof pushStatus === "string") {
|
|
93
|
+
const norm = pushStatus.trim().toUpperCase();
|
|
94
|
+
if (norm === "ACTIVE" || norm === "DRAFT")
|
|
95
|
+
setIfMissing("pushStatus", norm);
|
|
96
|
+
}
|
|
97
|
+
let sync = target.myProductSyncSetting;
|
|
98
|
+
if (sync === null || typeof sync !== "object" || Array.isArray(sync))
|
|
99
|
+
sync = {};
|
|
100
|
+
const syncObj = sync;
|
|
101
|
+
let syncChanged = false;
|
|
102
|
+
const syncMappings = [
|
|
103
|
+
["autoUpdateStock", "autoUpdateStock"],
|
|
104
|
+
["autoInventoryUpdate", "autoUpdateStock"],
|
|
105
|
+
["automaticInventoryUpdate", "autoUpdateStock"],
|
|
106
|
+
["autoUpdatePrice", "autoUpdatePrice"],
|
|
107
|
+
["automaticPriceUpdate", "autoUpdatePrice"],
|
|
108
|
+
["handleUpdatePrice", "handleUpdatePrice"],
|
|
109
|
+
];
|
|
110
|
+
for (const [sk, tk] of syncMappings) {
|
|
111
|
+
if (src[sk] != null && (syncObj[tk] === undefined || syncObj[tk] === null)) {
|
|
112
|
+
syncObj[tk] = Boolean(src[sk]);
|
|
113
|
+
syncChanged = true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (syncChanged) {
|
|
117
|
+
target.myProductSyncSetting =
|
|
118
|
+
target.myProductSyncSetting == null ? syncObj : syncObj;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export function normalizePushProductPayload(args) {
|
|
122
|
+
const rawData = args.data;
|
|
123
|
+
let payload;
|
|
124
|
+
if (rawData !== null && typeof rawData === "object" && !Array.isArray(rawData)) {
|
|
125
|
+
payload = Object.fromEntries(Object.entries(rawData).filter(([, v]) => v != null));
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
const exclude = new Set(["data", "storeId", "pushOptions", "storeParams"]);
|
|
129
|
+
payload = Object.fromEntries(Object.entries(args).filter(([k, v]) => v != null && !exclude.has(k)));
|
|
130
|
+
}
|
|
131
|
+
if (payload.storeIds == null && args.storeId != null) {
|
|
132
|
+
payload.storeIds = [args.storeId];
|
|
133
|
+
}
|
|
134
|
+
const storeParams = args.storeParams;
|
|
135
|
+
if (payload.storeIds == null && Array.isArray(storeParams)) {
|
|
136
|
+
const storeIds = storeParams
|
|
137
|
+
.filter((item) => item !== null && typeof item === "object" && !Array.isArray(item))
|
|
138
|
+
.map((item) => item.storeId)
|
|
139
|
+
.filter((id) => id != null);
|
|
140
|
+
if (storeIds.length > 0)
|
|
141
|
+
payload.storeIds = storeIds;
|
|
142
|
+
}
|
|
143
|
+
mergeLegacyPushSettings(payload, args.pushOptions);
|
|
144
|
+
if (Array.isArray(storeParams) && storeParams.length > 0) {
|
|
145
|
+
mergeLegacyPushSettings(payload, storeParams[0]);
|
|
146
|
+
}
|
|
147
|
+
const coerce = (v) => coerceIntId(v);
|
|
148
|
+
if (Array.isArray(payload.importListIds)) {
|
|
149
|
+
payload.importListIds = payload.importListIds.map(coerce);
|
|
150
|
+
}
|
|
151
|
+
if (Array.isArray(payload.storeIds)) {
|
|
152
|
+
payload.storeIds = payload.storeIds.map(coerce);
|
|
153
|
+
}
|
|
154
|
+
if (Array.isArray(payload.pushProducts)) {
|
|
155
|
+
for (const item of payload.pushProducts) {
|
|
156
|
+
if (item !== null &&
|
|
157
|
+
typeof item === "object" &&
|
|
158
|
+
!Array.isArray(item) &&
|
|
159
|
+
item.importListId != null) {
|
|
160
|
+
item.importListId = coerce(item.importListId);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (Array.isArray(payload.stores)) {
|
|
165
|
+
for (const item of payload.stores) {
|
|
166
|
+
if (item !== null &&
|
|
167
|
+
typeof item === "object" &&
|
|
168
|
+
!Array.isArray(item) &&
|
|
169
|
+
item.storeId != null) {
|
|
170
|
+
item.storeId = coerce(item.storeId);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (Array.isArray(payload.pricingRuleImportListIds)) {
|
|
175
|
+
for (const item of payload.pricingRuleImportListIds) {
|
|
176
|
+
if (item !== null && typeof item === "object" && !Array.isArray(item)) {
|
|
177
|
+
const o = item;
|
|
178
|
+
if (o.importListId != null)
|
|
179
|
+
o.importListId = coerce(o.importListId);
|
|
180
|
+
if (o.storeId != null)
|
|
181
|
+
o.storeId = coerce(o.storeId);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (Array.isArray(payload.storeLanguageList)) {
|
|
186
|
+
for (const item of payload.storeLanguageList) {
|
|
187
|
+
if (item !== null &&
|
|
188
|
+
typeof item === "object" &&
|
|
189
|
+
!Array.isArray(item) &&
|
|
190
|
+
item.storeId != null) {
|
|
191
|
+
item.storeId = coerce(item.storeId);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (Array.isArray(payload.logistics)) {
|
|
196
|
+
for (const item of payload.logistics) {
|
|
197
|
+
if (item !== null && typeof item === "object" && !Array.isArray(item)) {
|
|
198
|
+
const o = item;
|
|
199
|
+
if (o.importListId != null)
|
|
200
|
+
o.importListId = coerce(o.importListId);
|
|
201
|
+
if (o.storeId != null)
|
|
202
|
+
o.storeId = coerce(o.storeId);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (Array.isArray(payload.storeShippingProfile)) {
|
|
207
|
+
for (const item of payload.storeShippingProfile) {
|
|
208
|
+
if (item !== null &&
|
|
209
|
+
typeof item === "object" &&
|
|
210
|
+
!Array.isArray(item) &&
|
|
211
|
+
item.storeId != null) {
|
|
212
|
+
item.storeId = coerce(item.storeId);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return cleanNone(payload);
|
|
217
|
+
}
|
|
218
|
+
export async function getImportList(client, params) {
|
|
219
|
+
const p = params ?? {};
|
|
220
|
+
const filtered = Object.fromEntries(Object.entries(p).filter(([, v]) => v != null));
|
|
221
|
+
return client.get("/dsers-product-bff/import-list", filtered);
|
|
222
|
+
}
|
|
223
|
+
export async function getImportListItem(client, id) {
|
|
224
|
+
return client.get(`/dsers-product-bff/import-list/${id}`);
|
|
225
|
+
}
|
|
226
|
+
export async function importByProductId(client, body) {
|
|
227
|
+
return client.post("/dsers-product-bff/import-list/product-id", body);
|
|
228
|
+
}
|
|
229
|
+
export async function importByProductIdBatch(client, body) {
|
|
230
|
+
return client.post("/dsers-product-bff/import-list/product-id-batch", body);
|
|
231
|
+
}
|
|
232
|
+
export async function updateImportListItem(client, id, updates) {
|
|
233
|
+
const existing = await client.get(`/dsers-product-bff/import-list/${id}`);
|
|
234
|
+
const product = existing?.data != null ? existing.data : existing;
|
|
235
|
+
const data = product !== null && typeof product === "object" && !Array.isArray(product)
|
|
236
|
+
? { ...product, ...updates }
|
|
237
|
+
: updates;
|
|
238
|
+
return client.put(`/dsers-product-bff/import-list/${id}`, data);
|
|
239
|
+
}
|
|
240
|
+
export async function deleteImportList(client, ids) {
|
|
241
|
+
return client.delete(`/dsers-product-bff/import-list/${ids}`);
|
|
242
|
+
}
|
|
243
|
+
export async function pushToStore(client, payload) {
|
|
244
|
+
const normalized = normalizePushProductPayload(payload);
|
|
245
|
+
return client.post("/dsers-product-bff/import-list/push", {
|
|
246
|
+
data: normalized,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
export async function pushBeforeCheck(client, body) {
|
|
250
|
+
return client.post("/dsers-product-bff/import-list/push-before/check", body);
|
|
251
|
+
}
|
|
252
|
+
export async function getPushPrice(client, body) {
|
|
253
|
+
return client.post("/dsers-product-bff/import-list/push-price", body);
|
|
254
|
+
}
|
|
255
|
+
export async function getPushLogistics(client, body) {
|
|
256
|
+
return client.post("/dsers-product-bff/import-list/push-logistics", body);
|
|
257
|
+
}
|
|
258
|
+
export async function getPushStatus(client, eventId) {
|
|
259
|
+
return client.get(`/dsers-product-bff/import-list/push/${eventId}`);
|
|
260
|
+
}
|
|
261
|
+
export async function getStoreShippingProfile(client, storeId) {
|
|
262
|
+
const params = storeId != null ? { storeId } : undefined;
|
|
263
|
+
return client.get("/dsers-product-bff/import-list/push/store-shipping-profile", params);
|
|
264
|
+
}
|
|
265
|
+
export async function getShopifyShippingProfiles(client) {
|
|
266
|
+
return client.get("/dsers-product-bff/import-list/shopify/shipping-profile/get");
|
|
267
|
+
}
|
|
268
|
+
export async function listImportTags(client) {
|
|
269
|
+
return client.get("/dsers-product-bff/import-list/all/tags");
|
|
270
|
+
}
|
|
271
|
+
export async function getMyProducts(client, params) {
|
|
272
|
+
return client.get("/dsers-product-bff/my-product", params);
|
|
273
|
+
}
|
|
274
|
+
export async function getMapping(client, dsersProductId) {
|
|
275
|
+
return client.get(`/dsers-product-bff/mapping/${dsersProductId}`);
|
|
276
|
+
}
|
|
277
|
+
export async function findSuppliers(client, params) {
|
|
278
|
+
return client.get("/dsers-product-bff/find-suppliers/products", params);
|
|
279
|
+
}
|
|
280
|
+
export async function parseProductUrl(client, url, appId) {
|
|
281
|
+
return client.post("/dsers-product-bff/supplier/parse-product-url", {
|
|
282
|
+
url,
|
|
283
|
+
appId,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
export async function getPoolProductDetail(client, params) {
|
|
287
|
+
return client.get("/dsers-product-bff/product-pool/product/detail", params);
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=product.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.js","sourceRoot":"","sources":["../../src/dsers/product.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzE,MAAM,GAAG,GAAG,KAAgC,CAAC;QAC7C,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;aAChB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC;aAC5B,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CACtC,CAAC;IACJ,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAC1B,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC7B,IAAI,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CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAmB,EACnB,GAAW,EACX,KAAsB;IAEtB,OAAO,MAAM,CAAC,IAAI,CAAC,+CAA+C,EAAE;QAClE,GAAG;QACH,KAAK;KACN,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAmB,EACnB,MAA4D;IAE5D,OAAO,MAAM,CAAC,GAAG,CACf,gDAAgD,EAChD,MAAiC,CAClC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DSers Settings API – BFF wrappers for pricing, shipping, billing, and plan settings.
|
|
3
|
+
*/
|
|
4
|
+
import type { DSersClient } from "./client.js";
|
|
5
|
+
export declare function getGlobalSettings(client: DSersClient): Promise<Record<string, any>>;
|
|
6
|
+
export declare function getPricingRules(client: DSersClient, storeId: string): Promise<Record<string, any>>;
|
|
7
|
+
export declare function updatePricingRule(client: DSersClient, rule: Record<string, any>): Promise<Record<string, any>>;
|
|
8
|
+
export declare function getAutoSyncPrice(client: DSersClient): Promise<Record<string, any>>;
|
|
9
|
+
export declare function updateAutoSyncPrice(client: DSersClient, settings: Record<string, any>): Promise<Record<string, any>>;
|
|
10
|
+
export declare function getAutomatedMapping(client: DSersClient): Promise<Record<string, any>>;
|
|
11
|
+
export declare function updateAutomatedMapping(client: DSersClient, settings: Record<string, any>): Promise<Record<string, any>>;
|
|
12
|
+
export declare function getProductShippingInfo(client: DSersClient, supplierAppId: string | number): Promise<Record<string, any>>;
|
|
13
|
+
export declare function updateProductShippingInfo(client: DSersClient, body: {
|
|
14
|
+
shippingInfo: Record<string, any>;
|
|
15
|
+
status?: boolean;
|
|
16
|
+
}): Promise<Record<string, any>>;
|
|
17
|
+
export declare function getProductShipSettings(client: DSersClient, params?: {
|
|
18
|
+
supplierProductId?: string[];
|
|
19
|
+
supplierAppId?: (string | number)[];
|
|
20
|
+
}): Promise<Record<string, any>>;
|
|
21
|
+
export declare function getShippingAddresses(client: DSersClient, page?: number, pageSize?: number): Promise<Record<string, any>>;
|
|
22
|
+
export declare function addShippingAddress(client: DSersClient, address: Record<string, any>): Promise<Record<string, any>>;
|
|
23
|
+
export declare function getPhoneList(client: DSersClient): Promise<Record<string, any>>;
|
|
24
|
+
export declare function getBillList(client: DSersClient, page?: number, pageSize?: number): Promise<Record<string, any>>;
|
|
25
|
+
export declare function getBillDetail(client: DSersClient, billId: string): Promise<Record<string, any>>;
|
|
26
|
+
export declare function getPaymentMethods(client: DSersClient): Promise<Record<string, any>>;
|
|
27
|
+
export declare function getCurrentPlan(client: DSersClient): Promise<Record<string, any>>;
|
|
28
|
+
export declare function getPlanLimits(client: DSersClient): Promise<Record<string, any>>;
|
|
29
|
+
export declare function getAllPlans(client: DSersClient): Promise<Record<string, any>>;
|
|
30
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/dsers/settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAE9B;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAE9B;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACxB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAE9B;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,MAAM,E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,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAK9B;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC3B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAE9B;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAE9B;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,WAAW,EACnB,IAAI,CAAC,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAE9B;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAE9B;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAE9B;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAE9B;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAE9B;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAE9B"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export async function getGlobalSettings(client) {
|
|
2
|
+
return client.get("/infra-setting-bff/setting/list");
|
|
3
|
+
}
|
|
4
|
+
export async function getPricingRules(client, storeId) {
|
|
5
|
+
return client.get("/dsers-settings-bff/product/pricing-rule", { storeId });
|
|
6
|
+
}
|
|
7
|
+
export async function updatePricingRule(client, rule) {
|
|
8
|
+
return client.put("/dsers-settings-bff/product/pricing-rule", rule);
|
|
9
|
+
}
|
|
10
|
+
export async function getAutoSyncPrice(client) {
|
|
11
|
+
return client.get("/dsers-settings-bff/product/auto-sync-price");
|
|
12
|
+
}
|
|
13
|
+
export async function updateAutoSyncPrice(client, settings) {
|
|
14
|
+
return client.put("/dsers-settings-bff/product/auto-sync-price", settings);
|
|
15
|
+
}
|
|
16
|
+
export async function getAutomatedMapping(client) {
|
|
17
|
+
return client.get("/dsers-settings-bff/product/automated-mapping");
|
|
18
|
+
}
|
|
19
|
+
export async function updateAutomatedMapping(client, settings) {
|
|
20
|
+
return client.put("/dsers-settings-bff/product/automated-mapping", settings);
|
|
21
|
+
}
|
|
22
|
+
export async function getProductShippingInfo(client, supplierAppId) {
|
|
23
|
+
return client.get("/dsers-settings-bff/product/shipping/get", {
|
|
24
|
+
supplierAppId,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export async function updateProductShippingInfo(client, body) {
|
|
28
|
+
return client.put("/dsers-settings-bff/product/shipping/update", body);
|
|
29
|
+
}
|
|
30
|
+
export async function getProductShipSettings(client, params) {
|
|
31
|
+
return client.get("/dsers-settings-bff/product/pro-shipping/get", params);
|
|
32
|
+
}
|
|
33
|
+
export async function getShippingAddresses(client, page, pageSize) {
|
|
34
|
+
return client.get("/dsers-settings-bff/order/shipping-address", {
|
|
35
|
+
page,
|
|
36
|
+
pageSize,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export async function addShippingAddress(client, address) {
|
|
40
|
+
return client.post("/dsers-settings-bff/order/shipping-address", address);
|
|
41
|
+
}
|
|
42
|
+
export async function getPhoneList(client) {
|
|
43
|
+
return client.get("/dsers-settings-bff/order/phone-list");
|
|
44
|
+
}
|
|
45
|
+
export async function getBillList(client, page, pageSize) {
|
|
46
|
+
return client.get("/dsers-pay-bff/v1/bill/list", { page, pageSize });
|
|
47
|
+
}
|
|
48
|
+
export async function getBillDetail(client, billId) {
|
|
49
|
+
return client.get("/dsers-pay-bff/v1/bill/detail", { billId });
|
|
50
|
+
}
|
|
51
|
+
export async function getPaymentMethods(client) {
|
|
52
|
+
return client.get("/dsers-pay-bff/v1/pay/methods");
|
|
53
|
+
}
|
|
54
|
+
export async function getCurrentPlan(client) {
|
|
55
|
+
return client.get("/dsers-plan-bff/plan");
|
|
56
|
+
}
|
|
57
|
+
export async function getPlanLimits(client) {
|
|
58
|
+
return client.get("/dsers-plan-bff/limit");
|
|
59
|
+
}
|
|
60
|
+
export async function getAllPlans(client) {
|
|
61
|
+
return client.get("/dsers-plan-bff/plan/all-type-limit");
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/dsers/settings.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAmB;IAEnB,OAAO,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAmB,EACnB,OAAe;IAEf,OAAO,MAAM,CAAC,GAAG,CAAC,0CAA0C,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAmB,EACnB,IAAyB;IAEzB,OAAO,MAAM,CAAC,GAAG,CAAC,0CAA0C,EAAE,IAAI,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAmB;IAEnB,OAAO,MAAM,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAmB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,sCAAsC,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAmB,EACnB,IAAa,EACb,QAAiB;IAEjB,OAAO,MAAM,CAAC,GAAG,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAmB,EACnB,MAAc;IAEd,OAAO,MAAM,CAAC,GAAG,CAAC,+BAA+B,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAmB;IAEnB,OAAO,MAAM,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAmB;IAEnB,OAAO,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAmB;IAEnB,OAAO,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAmB;IAEnB,OAAO,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-map.d.ts","sourceRoot":"","sources":["../src/error-map.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAyND,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAwCpD"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { DSersAPIError } from "./dsers/client.js";
|
|
2
|
+
const DSERS_REASON_MAP = {
|
|
3
|
+
SELLER_NOT_FOUND: {
|
|
4
|
+
summary: "Store authorization expired or disconnected",
|
|
5
|
+
cause: "The DSers account's connection to the target store (Shopify/Wix) has expired or been revoked.",
|
|
6
|
+
action: "Ask the user to log into DSers, go to Settings > Linked Stores, and re-authorize the store. Then retry the push.",
|
|
7
|
+
},
|
|
8
|
+
TOKEN_EXPIRED: {
|
|
9
|
+
summary: "Session expired during request",
|
|
10
|
+
cause: "The DSers authentication token expired mid-session and automatic refresh failed.",
|
|
11
|
+
action: "Retry the same operation. If it fails again, ask the user to verify their DSers credentials.",
|
|
12
|
+
},
|
|
13
|
+
TOKEN_NOT_FOUND: {
|
|
14
|
+
summary: "Authentication session lost",
|
|
15
|
+
cause: "The server could not establish a valid session with DSers.",
|
|
16
|
+
action: "Retry the operation. If it persists, ask the user to check their DSers email and password.",
|
|
17
|
+
},
|
|
18
|
+
UNAUTHORIZED: {
|
|
19
|
+
summary: "Not authorized",
|
|
20
|
+
cause: "The DSers account credentials are invalid or the session has been invalidated.",
|
|
21
|
+
action: "Ask the user to verify their DSers email and password, then retry.",
|
|
22
|
+
},
|
|
23
|
+
LOGIN_ERROR_TOO_MANY: {
|
|
24
|
+
summary: "Too many failed login attempts",
|
|
25
|
+
cause: "Incorrect password was submitted multiple times and the account is temporarily locked.",
|
|
26
|
+
action: "Ask the user to verify their DSers password is correct. Wait a few minutes before retrying.",
|
|
27
|
+
},
|
|
28
|
+
IMPORT_LIST_PRODUCT_ALREADY_EXISTS: {
|
|
29
|
+
summary: "Product already in import list",
|
|
30
|
+
cause: "This supplier product was previously imported and still exists in the DSers import list.",
|
|
31
|
+
action: "The server will try to locate the existing draft automatically. If it fails, ask the user to check their DSers import list.",
|
|
32
|
+
},
|
|
33
|
+
ALIBABA_NOT_AVAILABLE: {
|
|
34
|
+
summary: "Alibaba product not available",
|
|
35
|
+
cause: "The Alibaba or 1688 product exists but DSers cannot import it (region/permission restriction).",
|
|
36
|
+
action: "Try a different product, or ask the user to check if their DSers plan supports Alibaba imports.",
|
|
37
|
+
},
|
|
38
|
+
PRODUCT_STATUS_NOT_ONSELLING: {
|
|
39
|
+
summary: "Product not currently on sale",
|
|
40
|
+
cause: "The supplier product is recognized but marked as off-shelf, discontinued, or not importable.",
|
|
41
|
+
action: "Inform the user that this product is currently unavailable. Try a different product URL.",
|
|
42
|
+
},
|
|
43
|
+
PERMISSION_DENIED: {
|
|
44
|
+
summary: "Permission denied",
|
|
45
|
+
cause: "The DSers account does not have permission for this operation (plan limitation or role restriction).",
|
|
46
|
+
action: "Ask the user to check their DSers subscription plan or account role.",
|
|
47
|
+
},
|
|
48
|
+
CODEC: {
|
|
49
|
+
summary: "Server data format error",
|
|
50
|
+
cause: "The request payload format was rejected by the DSers API (usually a type mismatch in IDs).",
|
|
51
|
+
action: "This is likely a server-side bug. Report the full error to the MCP server maintainer.",
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
const MESSAGE_PATTERNS = [
|
|
55
|
+
[
|
|
56
|
+
/credentials not found/i,
|
|
57
|
+
{
|
|
58
|
+
summary: "DSers credentials not configured",
|
|
59
|
+
cause: "No DSers email/password was provided for authentication.",
|
|
60
|
+
action: "The user needs to configure DSers credentials. Methods: " +
|
|
61
|
+
"(1) Smithery config form, (2) HTTP headers x-dsers-email + x-dsers-password, " +
|
|
62
|
+
"(3) Environment variables DSERS_EMAIL + DSERS_PASSWORD, " +
|
|
63
|
+
"(4) MCP client config env block.",
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
/Unknown job_id/i,
|
|
68
|
+
{
|
|
69
|
+
summary: "Job session expired (serverless restart)",
|
|
70
|
+
cause: "The import job was created on a different server instance that has since been recycled. " +
|
|
71
|
+
"The job state could not be recovered from the job_id token.",
|
|
72
|
+
action: "Call dsers.product.import again with the same source_url to re-import. " +
|
|
73
|
+
"The product likely already exists in the import list and will be found automatically.",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
/No linked stores found/i,
|
|
78
|
+
{
|
|
79
|
+
summary: "No store connected to DSers",
|
|
80
|
+
cause: "The DSers account has no Shopify, Wix, or other stores linked.",
|
|
81
|
+
action: "Ask the user to log into DSers and connect a store under Settings > Linked Stores before pushing products.",
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
[
|
|
85
|
+
/Multiple stores are available/i,
|
|
86
|
+
{
|
|
87
|
+
summary: "Multiple stores found — target_store required",
|
|
88
|
+
cause: "The DSers account has more than one linked store and no target was specified.",
|
|
89
|
+
action: "Call dsers.store.discover to see available stores, then provide the target_store parameter " +
|
|
90
|
+
"(store_ref or display_name) in dsers.store.push.",
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
[
|
|
94
|
+
/Unknown target_store/i,
|
|
95
|
+
{
|
|
96
|
+
summary: "Store not found",
|
|
97
|
+
cause: "The specified target_store does not match any store linked to this DSers account.",
|
|
98
|
+
action: "Call dsers.store.discover to list available stores and use the exact store_ref or display_name from the response.",
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
/source_url is required/i,
|
|
103
|
+
{
|
|
104
|
+
summary: "Missing product URL",
|
|
105
|
+
cause: "No supplier product URL was provided.",
|
|
106
|
+
action: "Provide source_url with a valid AliExpress, Alibaba, or 1688 product link. " +
|
|
107
|
+
"Example: https://www.aliexpress.com/item/1234567890.html",
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
[
|
|
111
|
+
/job_id is required/i,
|
|
112
|
+
{
|
|
113
|
+
summary: "Missing job_id",
|
|
114
|
+
cause: "The job_id parameter was not provided.",
|
|
115
|
+
action: "Use the job_id returned by dsers.product.import in your previous call.",
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
[
|
|
119
|
+
/Could not resolve the supplier product URL/i,
|
|
120
|
+
{
|
|
121
|
+
summary: "Invalid or unrecognized product URL",
|
|
122
|
+
cause: "The URL does not match a known supplier format or the product page could not be parsed.",
|
|
123
|
+
action: "Verify the URL is a valid product page from AliExpress (.com or .us), Alibaba, or 1688. " +
|
|
124
|
+
"The URL should contain /item/NUMBERS.html for AliExpress.",
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
[
|
|
128
|
+
/Could not locate the imported product draft/i,
|
|
129
|
+
{
|
|
130
|
+
summary: "Import draft not found in DSers",
|
|
131
|
+
cause: "The product was sent to DSers for import but could not be found in the import list. " +
|
|
132
|
+
"This can happen if the product URL uses a regional ID format that differs from the global catalog.",
|
|
133
|
+
action: "Try using the aliexpress.com version of the URL instead of .us, or manually check the DSers import list.",
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
[
|
|
137
|
+
/Could not push the product/i,
|
|
138
|
+
{
|
|
139
|
+
summary: "Push to store failed",
|
|
140
|
+
cause: "DSers rejected the push request. The store connection may be broken or the product data is invalid.",
|
|
141
|
+
action: "Check that the target store is still connected in DSers. " +
|
|
142
|
+
"If the error mentions a specific reason code, address that first. Then retry.",
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
[
|
|
146
|
+
/Cannot recover job/i,
|
|
147
|
+
{
|
|
148
|
+
summary: "Job recovery failed",
|
|
149
|
+
cause: "The job state token is corrupted or missing essential data.",
|
|
150
|
+
action: "Call dsers.product.import again with the original source_url to create a new job.",
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
[
|
|
154
|
+
/504|Gateway Time-out/i,
|
|
155
|
+
{
|
|
156
|
+
summary: "DSers API timed out",
|
|
157
|
+
cause: "The DSers server took too long to respond. This often happens with very large products " +
|
|
158
|
+
"(100+ variants or images). The operation may still be processing in the background.",
|
|
159
|
+
action: "Wait 30-60 seconds and retry the operation. If the product has many variants (>50), " +
|
|
160
|
+
"this is a known DSers API limitation. Try with a simpler product first.",
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
[
|
|
164
|
+
/Login HTTP/i,
|
|
165
|
+
{
|
|
166
|
+
summary: "DSers login failed",
|
|
167
|
+
cause: "The DSers API rejected the login request (wrong email/password or account issue).",
|
|
168
|
+
action: "Ask the user to verify their DSers email and password are correct.",
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
[
|
|
172
|
+
/not currently importable|not importable under/i,
|
|
173
|
+
{
|
|
174
|
+
summary: "Product not importable via DSers",
|
|
175
|
+
cause: "The supplier product is recognized but cannot be imported. Possible reasons: " +
|
|
176
|
+
"the product is off-shelf, the DSers AliExpress authorization expired, " +
|
|
177
|
+
"or the product is region-restricted.",
|
|
178
|
+
action: "Try a different product. If multiple products fail, ask the user to check their " +
|
|
179
|
+
"DSers account's AliExpress authorization under Settings > Linked Platforms.",
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
];
|
|
183
|
+
function extractDsersReason(err) {
|
|
184
|
+
if (err instanceof DSersAPIError) {
|
|
185
|
+
try {
|
|
186
|
+
const body = JSON.parse(err.body);
|
|
187
|
+
return body.reason ?? null;
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const msg = String(err.message ?? err);
|
|
194
|
+
const m = /\"reason\"\s*:\s*\"([A-Z_]+)\"/i.exec(msg);
|
|
195
|
+
return m ? m[1] : null;
|
|
196
|
+
}
|
|
197
|
+
export function formatErrorForAgent(err) {
|
|
198
|
+
const rawMessage = String(err.message ?? err);
|
|
199
|
+
const reason = extractDsersReason(err);
|
|
200
|
+
let mapped;
|
|
201
|
+
if (reason && DSERS_REASON_MAP[reason]) {
|
|
202
|
+
mapped = DSERS_REASON_MAP[reason];
|
|
203
|
+
}
|
|
204
|
+
if (!mapped) {
|
|
205
|
+
for (const [pattern, entry] of MESSAGE_PATTERNS) {
|
|
206
|
+
if (pattern.test(rawMessage)) {
|
|
207
|
+
mapped = entry;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (mapped) {
|
|
213
|
+
const parts = [
|
|
214
|
+
`Error: ${mapped.summary}`,
|
|
215
|
+
`Cause: ${mapped.cause}`,
|
|
216
|
+
`Action: ${mapped.action}`,
|
|
217
|
+
];
|
|
218
|
+
if (reason)
|
|
219
|
+
parts.push(`DSers reason code: ${reason}`);
|
|
220
|
+
return parts.join("\n");
|
|
221
|
+
}
|
|
222
|
+
if (err instanceof DSersAPIError) {
|
|
223
|
+
return (`Error: DSers API returned status ${err.status}\n` +
|
|
224
|
+
`Cause: The DSers backend rejected the request.\n` +
|
|
225
|
+
`Action: Check that the DSers account is active and the operation parameters are valid.\n` +
|
|
226
|
+
`Detail: ${err.body.slice(0, 300)}`);
|
|
227
|
+
}
|
|
228
|
+
return (`Error: ${rawMessage}\n` +
|
|
229
|
+
`Action: If this is unexpected, retry the operation. If it persists, check DSers account status and credentials.`);
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=error-map.js.map
|