@lonca/trendyol 0.12.0 → 0.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.
- package/README.md +6 -6
- package/dist/{client-BJjLOn4v.d.cts → client-CtygosAW.d.cts} +64 -25
- package/dist/{client-BJjLOn4v.d.ts → client-CtygosAW.d.ts} +64 -25
- package/dist/index.cjs +83 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +83 -45
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +83 -45
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +83 -45
- package/dist/testing.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -265,12 +265,14 @@ var ClaimsResource = class {
|
|
|
265
265
|
if (!Array.isArray(input?.claimItems) || input.claimItems.length === 0) {
|
|
266
266
|
throw new core.ValidationError({ message: "claims.create: claimItems must not be empty" });
|
|
267
267
|
}
|
|
268
|
-
return
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
268
|
+
return {
|
|
269
|
+
raw: await this.transport.request({
|
|
270
|
+
method: "POST",
|
|
271
|
+
path: `/integration/order/sellers/${this.transport.sellerId}/claims/create`,
|
|
272
|
+
body: input,
|
|
273
|
+
rateLimiter: this.limiter
|
|
274
|
+
})
|
|
275
|
+
};
|
|
274
276
|
}
|
|
275
277
|
/**
|
|
276
278
|
* File a seller-side rejection ("ret talebi") against a customer claim.
|
|
@@ -303,12 +305,14 @@ var ClaimsResource = class {
|
|
|
303
305
|
form.append("files", file);
|
|
304
306
|
}
|
|
305
307
|
}
|
|
306
|
-
return
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
return {
|
|
309
|
+
raw: await this.transport.request({
|
|
310
|
+
method: "POST",
|
|
311
|
+
path: `/integration/order/sellers/${this.transport.sellerId}/claims/${encodeURIComponent(claimId)}/issue`,
|
|
312
|
+
body: form,
|
|
313
|
+
rateLimiter: this.limiter
|
|
314
|
+
})
|
|
315
|
+
};
|
|
312
316
|
}
|
|
313
317
|
/**
|
|
314
318
|
* Approve specific claim line items. After approval, Trendyol moves
|
|
@@ -322,12 +326,14 @@ var ClaimsResource = class {
|
|
|
322
326
|
message: "claims.approveLineItems: claimLineItemIdList must not be empty"
|
|
323
327
|
});
|
|
324
328
|
}
|
|
325
|
-
return
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
329
|
+
return {
|
|
330
|
+
raw: await this.transport.request({
|
|
331
|
+
method: "PUT",
|
|
332
|
+
path: `/integration/order/sellers/${this.transport.sellerId}/claims/${encodeURIComponent(claimId)}/items/approve`,
|
|
333
|
+
body: input,
|
|
334
|
+
rateLimiter: this.limiter
|
|
335
|
+
})
|
|
336
|
+
};
|
|
331
337
|
}
|
|
332
338
|
/**
|
|
333
339
|
* List claims (page-based; SDK exposes opaque cursor convention).
|
|
@@ -716,12 +722,20 @@ var FinanceResource = class {
|
|
|
716
722
|
);
|
|
717
723
|
}
|
|
718
724
|
async queryPage(path, params) {
|
|
719
|
-
|
|
725
|
+
if (!params.transactionType) {
|
|
726
|
+
throw new core.ValidationError({
|
|
727
|
+
message: "finance: transactionType is required (Trendyol returns 500 without it) \u2014 pass e.g. { transactionType: 'Sale' }."
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
const size = (params.limit ?? 500) > 500 ? 1e3 : 500;
|
|
720
731
|
const page = params.cursor ? Number.parseInt(params.cursor, 10) : 0;
|
|
721
|
-
const query = {
|
|
732
|
+
const query = {
|
|
733
|
+
page,
|
|
734
|
+
size,
|
|
735
|
+
transactionType: params.transactionType
|
|
736
|
+
};
|
|
722
737
|
if (params.startDate) query.startDate = params.startDate.getTime();
|
|
723
738
|
if (params.endDate) query.endDate = params.endDate.getTime();
|
|
724
|
-
if (params.transactionType) query.transactionType = params.transactionType;
|
|
725
739
|
const data = await this.transport.request({
|
|
726
740
|
method: "GET",
|
|
727
741
|
path,
|
|
@@ -893,33 +907,39 @@ var InvoicesResource = class {
|
|
|
893
907
|
if (input.invoiceNumber !== void 0) {
|
|
894
908
|
form.append("invoiceNumber", input.invoiceNumber);
|
|
895
909
|
}
|
|
896
|
-
return
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
910
|
+
return {
|
|
911
|
+
raw: await this.transport.request({
|
|
912
|
+
method: "POST",
|
|
913
|
+
path: `/integration/sellers/${this.transport.sellerId}/seller-invoice-file`,
|
|
914
|
+
body: form,
|
|
915
|
+
rateLimiter: this.limiter
|
|
916
|
+
})
|
|
917
|
+
};
|
|
902
918
|
}
|
|
903
919
|
/** Register an invoice URL with Trendyol (alternative to uploading the file). */
|
|
904
920
|
async sendLink(input) {
|
|
905
921
|
if (!input?.invoiceLink) {
|
|
906
922
|
throw new core.ValidationError({ message: "invoices.sendLink: invoiceLink is required" });
|
|
907
923
|
}
|
|
908
|
-
return
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
924
|
+
return {
|
|
925
|
+
raw: await this.transport.request({
|
|
926
|
+
method: "POST",
|
|
927
|
+
path: `/integration/sellers/${this.transport.sellerId}/seller-invoice-links`,
|
|
928
|
+
body: input,
|
|
929
|
+
rateLimiter: this.limiter
|
|
930
|
+
})
|
|
931
|
+
};
|
|
914
932
|
}
|
|
915
933
|
/** Remove a previously-registered invoice link. */
|
|
916
934
|
async deleteLink(input) {
|
|
917
|
-
return
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
935
|
+
return {
|
|
936
|
+
raw: await this.transport.request({
|
|
937
|
+
method: "POST",
|
|
938
|
+
path: `/integration/sellers/${this.transport.sellerId}/seller-invoice-links/delete`,
|
|
939
|
+
body: input,
|
|
940
|
+
rateLimiter: this.limiter
|
|
941
|
+
})
|
|
942
|
+
};
|
|
923
943
|
}
|
|
924
944
|
};
|
|
925
945
|
var LabelsResource = class {
|
|
@@ -998,22 +1018,32 @@ var LocationsResource = class {
|
|
|
998
1018
|
async getTurkeyCities() {
|
|
999
1019
|
return this.cities(`/integration/member/countries/domestic/TR/cities`);
|
|
1000
1020
|
}
|
|
1001
|
-
|
|
1021
|
+
/**
|
|
1022
|
+
* List districts for a Turkish city. **Pass the city `id`** (`City.id`) — the
|
|
1023
|
+
* nested endpoint keys off Trendyol's internal id, not the display `code`, and
|
|
1024
|
+
* returns 500 for the code. Verified live.
|
|
1025
|
+
*/
|
|
1026
|
+
async getTurkeyDistricts(cityId) {
|
|
1002
1027
|
return this.districts(
|
|
1003
|
-
`/integration/member/countries/domestic/TR/cities/${encodeURIComponent(String(
|
|
1028
|
+
`/integration/member/countries/domestic/TR/cities/${encodeURIComponent(String(cityId))}/districts`
|
|
1004
1029
|
);
|
|
1005
1030
|
}
|
|
1006
|
-
|
|
1031
|
+
/**
|
|
1032
|
+
* List neighborhoods for a Turkish district. **Pass the ids** (`City.id`,
|
|
1033
|
+
* `District.id`) — not the display codes (those 500).
|
|
1034
|
+
*/
|
|
1035
|
+
async getTurkeyNeighborhoods(cityId, districtId) {
|
|
1007
1036
|
return this.neighborhoods(
|
|
1008
|
-
`/integration/member/countries/domestic/TR/cities/${encodeURIComponent(String(
|
|
1037
|
+
`/integration/member/countries/domestic/TR/cities/${encodeURIComponent(String(cityId))}/districts/${encodeURIComponent(String(districtId))}/neighborhoods`
|
|
1009
1038
|
);
|
|
1010
1039
|
}
|
|
1011
1040
|
async getAzerbaijanCities() {
|
|
1012
1041
|
return this.cities(`/integration/member/countries/domestic/AZ/cities`);
|
|
1013
1042
|
}
|
|
1014
|
-
|
|
1043
|
+
/** List districts for an Azerbaijani city. **Pass the city `id`** (`City.id`), not `code`. */
|
|
1044
|
+
async getAzerbaijanDistricts(cityId) {
|
|
1015
1045
|
return this.districts(
|
|
1016
|
-
`/integration/member/countries/domestic/AZ/cities/${encodeURIComponent(String(
|
|
1046
|
+
`/integration/member/countries/domestic/AZ/cities/${encodeURIComponent(String(cityId))}/districts`
|
|
1017
1047
|
);
|
|
1018
1048
|
}
|
|
1019
1049
|
// ─── International (GULF / CEE) ───────────────────────────────────────
|
|
@@ -1033,6 +1063,7 @@ var LocationsResource = class {
|
|
|
1033
1063
|
rateLimiter: this.limiter
|
|
1034
1064
|
});
|
|
1035
1065
|
return n(data, (node) => ({
|
|
1066
|
+
id: node.id !== void 0 ? String(node.id) : void 0,
|
|
1036
1067
|
code: String(node.code ?? node.id ?? ""),
|
|
1037
1068
|
name: node.name,
|
|
1038
1069
|
countryCode: node.countryCode
|
|
@@ -1045,6 +1076,7 @@ var LocationsResource = class {
|
|
|
1045
1076
|
rateLimiter: this.limiter
|
|
1046
1077
|
});
|
|
1047
1078
|
return n(data, (node) => ({
|
|
1079
|
+
id: node.id !== void 0 ? String(node.id) : void 0,
|
|
1048
1080
|
code: String(node.code ?? node.id ?? ""),
|
|
1049
1081
|
name: node.name,
|
|
1050
1082
|
cityCode: node.cityCode !== void 0 ? String(node.cityCode) : void 0
|
|
@@ -1057,6 +1089,7 @@ var LocationsResource = class {
|
|
|
1057
1089
|
rateLimiter: this.limiter
|
|
1058
1090
|
});
|
|
1059
1091
|
return n(data, (node) => ({
|
|
1092
|
+
id: node.id !== void 0 ? String(node.id) : void 0,
|
|
1060
1093
|
code: String(node.code ?? node.id ?? ""),
|
|
1061
1094
|
name: node.name,
|
|
1062
1095
|
districtCode: node.districtCode !== void 0 ? String(node.districtCode) : void 0
|
|
@@ -1942,6 +1975,11 @@ var ProductsResource = class {
|
|
|
1942
1975
|
* List approved products. Use `paginate()` from `@lonca/core` to iterate
|
|
1943
1976
|
* lazily across pages.
|
|
1944
1977
|
*
|
|
1978
|
+
* **Approved only:** this endpoint silently excludes products still in review
|
|
1979
|
+
* or rejected — use {@link listUnapproved} for those. Date fields on the
|
|
1980
|
+
* returned {@link Product} (`createdAt` / `updatedAt`) are ISO 8601 UTC
|
|
1981
|
+
* **strings**, not `Date` objects.
|
|
1982
|
+
*
|
|
1945
1983
|
* Trendyol exposes both page-based and `nextPageToken`-based pagination
|
|
1946
1984
|
* (the latter required when the dataset exceeds 10,000 items). The SDK
|
|
1947
1985
|
* picks the right strategy automatically — pass our opaque `cursor` from
|