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