@lonca/trendyol 1.1.0 → 1.2.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 +3 -3
- package/dist/{client-Bp0jKEU7.d.cts → client-BhSJFkFo.d.cts} +50 -14
- package/dist/{client-Bp0jKEU7.d.ts → client-BhSJFkFo.d.ts} +50 -14
- package/dist/index.cjs +27 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +27 -18
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +27 -18
- 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 +27 -18
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/testing.cjs
CHANGED
|
@@ -84,7 +84,6 @@ function normalizeCategory(node) {
|
|
|
84
84
|
}
|
|
85
85
|
function normalizeAttribute(node) {
|
|
86
86
|
const attr = node.attribute ?? { id: 0, name: "" };
|
|
87
|
-
const rawValues = node.attributeValues ?? [];
|
|
88
87
|
const out = {
|
|
89
88
|
id: String(attr.id),
|
|
90
89
|
name: attr.name,
|
|
@@ -92,7 +91,8 @@ function normalizeAttribute(node) {
|
|
|
92
91
|
allowCustom: !!node.allowCustom,
|
|
93
92
|
varianter: !!node.varianter,
|
|
94
93
|
slicer: !!node.slicer,
|
|
95
|
-
|
|
94
|
+
// Deprecated: normally empty — see `attributeValues` on the node above.
|
|
95
|
+
values: (node.attributeValues ?? []).map((v) => ({ id: String(v.id), name: v.name }))
|
|
96
96
|
};
|
|
97
97
|
if (node.categoryId !== void 0) {
|
|
98
98
|
out.categoryId = String(node.categoryId);
|
|
@@ -154,8 +154,8 @@ var CategoriesResource = class {
|
|
|
154
154
|
/**
|
|
155
155
|
* Fetch the allowed values for a single category attribute (paginated).
|
|
156
156
|
*
|
|
157
|
-
* `getCategoryAttributes` returns attribute metadata + flags
|
|
158
|
-
*
|
|
157
|
+
* `getCategoryAttributes` returns attribute metadata + flags only, never the
|
|
158
|
+
* value catalog (docs and prod wire agree). Use this method to fetch the catalog for an
|
|
159
159
|
* attribute when `allowCustom` is `false` and you need to map your data
|
|
160
160
|
* onto Trendyol's accepted values.
|
|
161
161
|
*
|
|
@@ -1102,8 +1102,7 @@ var LocationsResource = class {
|
|
|
1102
1102
|
return n(data, (node) => ({
|
|
1103
1103
|
id: node.id !== void 0 ? String(node.id) : void 0,
|
|
1104
1104
|
code: String(node.code ?? node.id ?? ""),
|
|
1105
|
-
name: node.name
|
|
1106
|
-
cityCode: node.cityCode !== void 0 ? String(node.cityCode) : void 0
|
|
1105
|
+
name: node.name
|
|
1107
1106
|
}));
|
|
1108
1107
|
}
|
|
1109
1108
|
async neighborhoods(path) {
|
|
@@ -1112,12 +1111,16 @@ var LocationsResource = class {
|
|
|
1112
1111
|
path,
|
|
1113
1112
|
rateLimiter: this.limiter
|
|
1114
1113
|
});
|
|
1115
|
-
return n(data, (node) =>
|
|
1116
|
-
id
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1114
|
+
return n(data, (node) => {
|
|
1115
|
+
const id = node.id !== void 0 ? String(node.id) : void 0;
|
|
1116
|
+
return {
|
|
1117
|
+
id,
|
|
1118
|
+
// Neighborhood rows have no code; `code` mirrors the id (as it always did in practice).
|
|
1119
|
+
code: id ?? "",
|
|
1120
|
+
name: node.name,
|
|
1121
|
+
postCode: typeof node.postCode === "string" ? node.postCode : void 0
|
|
1122
|
+
};
|
|
1123
|
+
});
|
|
1121
1124
|
}
|
|
1122
1125
|
};
|
|
1123
1126
|
var MAX_PAGE_SIZE = 200;
|
|
@@ -2470,29 +2473,35 @@ var VALID_TYPES = /* @__PURE__ */ new Set([
|
|
|
2470
2473
|
"WAREHOUSE"
|
|
2471
2474
|
]);
|
|
2472
2475
|
function normalizeAddressType(raw) {
|
|
2473
|
-
|
|
2474
|
-
|
|
2476
|
+
const upper = typeof raw === "string" ? raw.toUpperCase() : void 0;
|
|
2477
|
+
if (upper && VALID_TYPES.has(upper)) {
|
|
2478
|
+
return upper;
|
|
2475
2479
|
}
|
|
2476
|
-
const stripped =
|
|
2480
|
+
const stripped = upper?.replace(/_ADDRESS$/, "");
|
|
2477
2481
|
if (stripped && VALID_TYPES.has(stripped)) {
|
|
2478
2482
|
return stripped;
|
|
2479
2483
|
}
|
|
2480
2484
|
return "SHIPMENT";
|
|
2481
2485
|
}
|
|
2486
|
+
function optionalString(value) {
|
|
2487
|
+
return typeof value === "number" || typeof value === "string" ? String(value) : void 0;
|
|
2488
|
+
}
|
|
2482
2489
|
function normalizeAddress2(node) {
|
|
2483
2490
|
return {
|
|
2484
2491
|
id: String(node.id),
|
|
2485
|
-
name: node.name,
|
|
2486
2492
|
addressType: normalizeAddressType(node.addressType),
|
|
2487
2493
|
isShipmentAddress: node.isShipmentAddress ?? false,
|
|
2488
2494
|
isReturningAddress: node.isReturningAddress ?? false,
|
|
2489
2495
|
isInvoiceAddress: node.isInvoiceAddress ?? false,
|
|
2490
2496
|
isDefault: node.isDefault ?? false,
|
|
2491
2497
|
address: node.address,
|
|
2498
|
+
fullAddress: node.fullAddress,
|
|
2499
|
+
country: node.country,
|
|
2492
2500
|
city: node.city,
|
|
2501
|
+
cityCode: optionalString(node.cityCode),
|
|
2493
2502
|
district: node.district,
|
|
2494
|
-
|
|
2495
|
-
|
|
2503
|
+
districtId: optionalString(node.districtId),
|
|
2504
|
+
postCode: node.postCode
|
|
2496
2505
|
};
|
|
2497
2506
|
}
|
|
2498
2507
|
var DEFAULT_CACHE_TTL_MS = 60 * 60 * 1e3;
|