@lonca/trendyol 1.0.1 → 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-CnDyop_o.d.cts → client-BhSJFkFo.d.cts} +76 -14
- package/dist/{client-CnDyop_o.d.ts → client-BhSJFkFo.d.ts} +76 -14
- package/dist/index.cjs +56 -27
- 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 +56 -27
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +54 -26
- 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 +54 -26
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { aZ as ShipmentPackage, a7 as KnownShipmentPackageStatus } from './client-
|
|
2
|
-
export { A as AnswerQuestionResult, a as ApproveClaimLineItemsInput, b as ApprovedProductStatus, B as BarcodeCategoryLookup, c as BatchAcceptedResponse, d as BatchPollOptions, e as BatchRequestItemResult, f as BatchRequestResult, g as BatchRequestStatus, h as Brand, i as BrandsResource, j as BuyboxInfo, C as CancelPackageItemInput, k as CareInstruction, l as CargoInvoiceItem, m as CategoriesResource, n as Category, o as CategoryAttribute, p as CategoryAttributeValue, q as City, r as Claim, s as ClaimIssueReason, t as ClaimItemAudit, u as ClaimItemStatus, v as ClaimsResource, w as CommonLabel, x as CommonLabelEntry, y as CompensationItemDetail, z as CompensationTicket, D as CompensationTicketState, E as Country, F as CreateClaimInput, G as CreateClaimIssueInput, H as CreateClaimItemInput, I as CreateClientOptions, J as CreateCommonLabelInput, K as CreateProductV2Input, L as CreateTestOrderInput, M as CreateTestOrderResult, N as CreateVideoInput, O as CreateVideoResult, P as CreateWebhookResult, Q as DeleteInvoiceLinkInput, R as DeliveryOptionInput, S as District, T as ExportBatchAcceptedResponse, U as ExportBatchStatus, V as ExportCategoryAttribute, W as ExportCenterResource, X as ExportPackage, Y as ExportPackageItem, Z as ExportPackageStatus, _ as ExportPriceUpdateInput, $ as ExportProduct, a0 as ExportProductInput, a1 as ExportStockUpdateInput, a2 as FinanceResource, a3 as FinancialTransaction, a4 as GetExportPackageItemsParams, a5 as InventoryResource, a6 as InvoicesResource, a8 as LabelsResource, a9 as LaborCostInput, aa as ListCategoryAttributeValuesParams, ab as ListClaimsParams, ac as ListCompensationTicketsParams, ad as ListExportPackagesV2Params, ae as ListExportPackagesV3Params, af as ListExportProductsParams, ag as ListFinanceParams, ah as ListInventoryAndPriceParams, ai as ListOrdersParams, aj as ListOrdersStreamParams, ak as ListProductsParams, al as ListQuestionsParams, am as ListUnapprovedProductsParams, an as ListVideosParams, ao as LocationsResource, ap as NamedRef, aq as Neighborhood, ar as OrderAddress, as as OrderAddressLines, at as OrderCustomer, au as OrderLine, av as OrderLineDiscountDetail, aw as OrdersResource, ax as OtherFinancialRow, ay as PackageDetail, az as PackageHistoryEntry, aA as PackageLineUpdate, aB as PriceInventoryUpdate, aC as ProcessAlternativeDeliveryInput, aD as Product, aE as ProductAttribute, aF as ProductAttributeV2Input, aG as ProductBase, aH as ProductComposition, aI as ProductContentBase, aJ as ProductImageInput, aK as ProductOrigin, aL as ProductStockPrice, aM as ProductStockPriceVariant, aN as ProductVariant, aO as ProductsResource, aP as QuantitySplit, aQ as Question, aR as QuestionAnswer, aS as QuestionStatus, aT as QuestionsResource, aU as SellerIntegrationStatus, aV as SellerVideo, aW as SendInvoiceLinkInput, aX as SetClaimsWaitingInActionInput, aY as SettlementRow, a_ as ShipmentPackageStatus, a$ as SplitGroup, b0 as SplitPackagePlan, b1 as SupplierAddress, b2 as SupplierAddressType, b3 as SuppliersResource, b4 as SuppliersResourceOptions, b5 as TestOrderStatus, b6 as TestOrderStatusLine, b7 as TestOrdersResource, b8 as TrendyolCapabilities, b9 as TrendyolCargoProvider, ba as TrendyolClient, bb as TrendyolEnvironment, bc as UnapprovedDateQueryType, bd as UnapprovedProduct, be as UnapprovedProductRejectReason, bf as UnapprovedProductStatus, bg as UpdateBoxInfoInput, bh as UpdateContentInput, bi as UpdateDeliveryInfoInput, bj as UpdatePackageStatusInput, bk as UpdatePriceInventoryResponse, bl as UpdateTestOrderStatusOptions, bm as UpdateUnapprovedInput, bn as UpdateVariantInput, bo as UploadInvoiceFileInput, bp as VideoContentType, bq as VideosResource, br as Webhook, bs as WebhookAuthenticationType, bt as WebhookInput, bu as WebhooksResource, bv as createTrendyolClient, bw as normalizeShipmentPackage, bx as pollBatchStatus, by as trendyolCapabilities } from './client-
|
|
1
|
+
import { aZ as ShipmentPackage, a7 as KnownShipmentPackageStatus } from './client-BhSJFkFo.cjs';
|
|
2
|
+
export { A as AnswerQuestionResult, a as ApproveClaimLineItemsInput, b as ApprovedProductStatus, B as BarcodeCategoryLookup, c as BatchAcceptedResponse, d as BatchPollOptions, e as BatchRequestItemResult, f as BatchRequestResult, g as BatchRequestStatus, h as Brand, i as BrandsResource, j as BuyboxInfo, C as CancelPackageItemInput, k as CareInstruction, l as CargoInvoiceItem, m as CategoriesResource, n as Category, o as CategoryAttribute, p as CategoryAttributeValue, q as City, r as Claim, s as ClaimIssueReason, t as ClaimItemAudit, u as ClaimItemStatus, v as ClaimsResource, w as CommonLabel, x as CommonLabelEntry, y as CompensationItemDetail, z as CompensationTicket, D as CompensationTicketState, E as Country, F as CreateClaimInput, G as CreateClaimIssueInput, H as CreateClaimItemInput, I as CreateClientOptions, J as CreateCommonLabelInput, K as CreateProductV2Input, L as CreateTestOrderInput, M as CreateTestOrderResult, N as CreateVideoInput, O as CreateVideoResult, P as CreateWebhookResult, Q as DeleteInvoiceLinkInput, R as DeliveryOptionInput, S as District, T as ExportBatchAcceptedResponse, U as ExportBatchStatus, V as ExportCategoryAttribute, W as ExportCenterResource, X as ExportPackage, Y as ExportPackageItem, Z as ExportPackageStatus, _ as ExportPriceUpdateInput, $ as ExportProduct, a0 as ExportProductInput, a1 as ExportStockUpdateInput, a2 as FinanceResource, a3 as FinancialTransaction, a4 as GetExportPackageItemsParams, a5 as InventoryResource, a6 as InvoicesResource, a8 as LabelsResource, a9 as LaborCostInput, aa as ListCategoryAttributeValuesParams, ab as ListClaimsParams, ac as ListCompensationTicketsParams, ad as ListExportPackagesV2Params, ae as ListExportPackagesV3Params, af as ListExportProductsParams, ag as ListFinanceParams, ah as ListInventoryAndPriceParams, ai as ListOrdersParams, aj as ListOrdersStreamParams, ak as ListProductsParams, al as ListQuestionsParams, am as ListUnapprovedProductsParams, an as ListVideosParams, ao as LocationsResource, ap as NamedRef, aq as Neighborhood, ar as OrderAddress, as as OrderAddressLines, at as OrderCustomer, au as OrderLine, av as OrderLineDiscountDetail, aw as OrdersResource, ax as OtherFinancialRow, ay as PackageDetail, az as PackageHistoryEntry, aA as PackageLineUpdate, aB as PriceInventoryUpdate, aC as ProcessAlternativeDeliveryInput, aD as Product, aE as ProductAttribute, aF as ProductAttributeV2Input, aG as ProductBase, aH as ProductComposition, aI as ProductContentBase, aJ as ProductImageInput, aK as ProductOrigin, aL as ProductStockPrice, aM as ProductStockPriceVariant, aN as ProductVariant, aO as ProductsResource, aP as QuantitySplit, aQ as Question, aR as QuestionAnswer, aS as QuestionStatus, aT as QuestionsResource, aU as SellerIntegrationStatus, aV as SellerVideo, aW as SendInvoiceLinkInput, aX as SetClaimsWaitingInActionInput, aY as SettlementRow, a_ as ShipmentPackageStatus, a$ as SplitGroup, b0 as SplitPackagePlan, b1 as SupplierAddress, b2 as SupplierAddressType, b3 as SuppliersResource, b4 as SuppliersResourceOptions, b5 as TestOrderStatus, b6 as TestOrderStatusLine, b7 as TestOrdersResource, b8 as TrendyolCapabilities, b9 as TrendyolCargoProvider, ba as TrendyolClient, bb as TrendyolEnvironment, bc as UnapprovedDateQueryType, bd as UnapprovedProduct, be as UnapprovedProductRejectReason, bf as UnapprovedProductStatus, bg as UpdateBoxInfoInput, bh as UpdateContentInput, bi as UpdateDeliveryInfoInput, bj as UpdatePackageStatusInput, bk as UpdatePriceInventoryResponse, bl as UpdateTestOrderStatusOptions, bm as UpdateUnapprovedInput, bn as UpdateVariantInput, bo as UploadInvoiceFileInput, bp as VideoContentType, bq as VideosResource, br as Webhook, bs as WebhookAuthenticationType, bt as WebhookInput, bu as WebhooksResource, bv as createTrendyolClient, bw as normalizeShipmentPackage, bx as pollBatchStatus, by as trendyolCapabilities } from './client-BhSJFkFo.cjs';
|
|
3
3
|
import * as _lonca_core from '@lonca/core';
|
|
4
4
|
import { NormalizedOrderStatus } from '@lonca/core';
|
|
5
5
|
export { CursorPage, CursorPaginationParams, MutationResult, OffsetPage, OffsetPaginationParams, paginate, paginateOffset } from '@lonca/core';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { aZ as ShipmentPackage, a7 as KnownShipmentPackageStatus } from './client-
|
|
2
|
-
export { A as AnswerQuestionResult, a as ApproveClaimLineItemsInput, b as ApprovedProductStatus, B as BarcodeCategoryLookup, c as BatchAcceptedResponse, d as BatchPollOptions, e as BatchRequestItemResult, f as BatchRequestResult, g as BatchRequestStatus, h as Brand, i as BrandsResource, j as BuyboxInfo, C as CancelPackageItemInput, k as CareInstruction, l as CargoInvoiceItem, m as CategoriesResource, n as Category, o as CategoryAttribute, p as CategoryAttributeValue, q as City, r as Claim, s as ClaimIssueReason, t as ClaimItemAudit, u as ClaimItemStatus, v as ClaimsResource, w as CommonLabel, x as CommonLabelEntry, y as CompensationItemDetail, z as CompensationTicket, D as CompensationTicketState, E as Country, F as CreateClaimInput, G as CreateClaimIssueInput, H as CreateClaimItemInput, I as CreateClientOptions, J as CreateCommonLabelInput, K as CreateProductV2Input, L as CreateTestOrderInput, M as CreateTestOrderResult, N as CreateVideoInput, O as CreateVideoResult, P as CreateWebhookResult, Q as DeleteInvoiceLinkInput, R as DeliveryOptionInput, S as District, T as ExportBatchAcceptedResponse, U as ExportBatchStatus, V as ExportCategoryAttribute, W as ExportCenterResource, X as ExportPackage, Y as ExportPackageItem, Z as ExportPackageStatus, _ as ExportPriceUpdateInput, $ as ExportProduct, a0 as ExportProductInput, a1 as ExportStockUpdateInput, a2 as FinanceResource, a3 as FinancialTransaction, a4 as GetExportPackageItemsParams, a5 as InventoryResource, a6 as InvoicesResource, a8 as LabelsResource, a9 as LaborCostInput, aa as ListCategoryAttributeValuesParams, ab as ListClaimsParams, ac as ListCompensationTicketsParams, ad as ListExportPackagesV2Params, ae as ListExportPackagesV3Params, af as ListExportProductsParams, ag as ListFinanceParams, ah as ListInventoryAndPriceParams, ai as ListOrdersParams, aj as ListOrdersStreamParams, ak as ListProductsParams, al as ListQuestionsParams, am as ListUnapprovedProductsParams, an as ListVideosParams, ao as LocationsResource, ap as NamedRef, aq as Neighborhood, ar as OrderAddress, as as OrderAddressLines, at as OrderCustomer, au as OrderLine, av as OrderLineDiscountDetail, aw as OrdersResource, ax as OtherFinancialRow, ay as PackageDetail, az as PackageHistoryEntry, aA as PackageLineUpdate, aB as PriceInventoryUpdate, aC as ProcessAlternativeDeliveryInput, aD as Product, aE as ProductAttribute, aF as ProductAttributeV2Input, aG as ProductBase, aH as ProductComposition, aI as ProductContentBase, aJ as ProductImageInput, aK as ProductOrigin, aL as ProductStockPrice, aM as ProductStockPriceVariant, aN as ProductVariant, aO as ProductsResource, aP as QuantitySplit, aQ as Question, aR as QuestionAnswer, aS as QuestionStatus, aT as QuestionsResource, aU as SellerIntegrationStatus, aV as SellerVideo, aW as SendInvoiceLinkInput, aX as SetClaimsWaitingInActionInput, aY as SettlementRow, a_ as ShipmentPackageStatus, a$ as SplitGroup, b0 as SplitPackagePlan, b1 as SupplierAddress, b2 as SupplierAddressType, b3 as SuppliersResource, b4 as SuppliersResourceOptions, b5 as TestOrderStatus, b6 as TestOrderStatusLine, b7 as TestOrdersResource, b8 as TrendyolCapabilities, b9 as TrendyolCargoProvider, ba as TrendyolClient, bb as TrendyolEnvironment, bc as UnapprovedDateQueryType, bd as UnapprovedProduct, be as UnapprovedProductRejectReason, bf as UnapprovedProductStatus, bg as UpdateBoxInfoInput, bh as UpdateContentInput, bi as UpdateDeliveryInfoInput, bj as UpdatePackageStatusInput, bk as UpdatePriceInventoryResponse, bl as UpdateTestOrderStatusOptions, bm as UpdateUnapprovedInput, bn as UpdateVariantInput, bo as UploadInvoiceFileInput, bp as VideoContentType, bq as VideosResource, br as Webhook, bs as WebhookAuthenticationType, bt as WebhookInput, bu as WebhooksResource, bv as createTrendyolClient, bw as normalizeShipmentPackage, bx as pollBatchStatus, by as trendyolCapabilities } from './client-
|
|
1
|
+
import { aZ as ShipmentPackage, a7 as KnownShipmentPackageStatus } from './client-BhSJFkFo.js';
|
|
2
|
+
export { A as AnswerQuestionResult, a as ApproveClaimLineItemsInput, b as ApprovedProductStatus, B as BarcodeCategoryLookup, c as BatchAcceptedResponse, d as BatchPollOptions, e as BatchRequestItemResult, f as BatchRequestResult, g as BatchRequestStatus, h as Brand, i as BrandsResource, j as BuyboxInfo, C as CancelPackageItemInput, k as CareInstruction, l as CargoInvoiceItem, m as CategoriesResource, n as Category, o as CategoryAttribute, p as CategoryAttributeValue, q as City, r as Claim, s as ClaimIssueReason, t as ClaimItemAudit, u as ClaimItemStatus, v as ClaimsResource, w as CommonLabel, x as CommonLabelEntry, y as CompensationItemDetail, z as CompensationTicket, D as CompensationTicketState, E as Country, F as CreateClaimInput, G as CreateClaimIssueInput, H as CreateClaimItemInput, I as CreateClientOptions, J as CreateCommonLabelInput, K as CreateProductV2Input, L as CreateTestOrderInput, M as CreateTestOrderResult, N as CreateVideoInput, O as CreateVideoResult, P as CreateWebhookResult, Q as DeleteInvoiceLinkInput, R as DeliveryOptionInput, S as District, T as ExportBatchAcceptedResponse, U as ExportBatchStatus, V as ExportCategoryAttribute, W as ExportCenterResource, X as ExportPackage, Y as ExportPackageItem, Z as ExportPackageStatus, _ as ExportPriceUpdateInput, $ as ExportProduct, a0 as ExportProductInput, a1 as ExportStockUpdateInput, a2 as FinanceResource, a3 as FinancialTransaction, a4 as GetExportPackageItemsParams, a5 as InventoryResource, a6 as InvoicesResource, a8 as LabelsResource, a9 as LaborCostInput, aa as ListCategoryAttributeValuesParams, ab as ListClaimsParams, ac as ListCompensationTicketsParams, ad as ListExportPackagesV2Params, ae as ListExportPackagesV3Params, af as ListExportProductsParams, ag as ListFinanceParams, ah as ListInventoryAndPriceParams, ai as ListOrdersParams, aj as ListOrdersStreamParams, ak as ListProductsParams, al as ListQuestionsParams, am as ListUnapprovedProductsParams, an as ListVideosParams, ao as LocationsResource, ap as NamedRef, aq as Neighborhood, ar as OrderAddress, as as OrderAddressLines, at as OrderCustomer, au as OrderLine, av as OrderLineDiscountDetail, aw as OrdersResource, ax as OtherFinancialRow, ay as PackageDetail, az as PackageHistoryEntry, aA as PackageLineUpdate, aB as PriceInventoryUpdate, aC as ProcessAlternativeDeliveryInput, aD as Product, aE as ProductAttribute, aF as ProductAttributeV2Input, aG as ProductBase, aH as ProductComposition, aI as ProductContentBase, aJ as ProductImageInput, aK as ProductOrigin, aL as ProductStockPrice, aM as ProductStockPriceVariant, aN as ProductVariant, aO as ProductsResource, aP as QuantitySplit, aQ as Question, aR as QuestionAnswer, aS as QuestionStatus, aT as QuestionsResource, aU as SellerIntegrationStatus, aV as SellerVideo, aW as SendInvoiceLinkInput, aX as SetClaimsWaitingInActionInput, aY as SettlementRow, a_ as ShipmentPackageStatus, a$ as SplitGroup, b0 as SplitPackagePlan, b1 as SupplierAddress, b2 as SupplierAddressType, b3 as SuppliersResource, b4 as SuppliersResourceOptions, b5 as TestOrderStatus, b6 as TestOrderStatusLine, b7 as TestOrdersResource, b8 as TrendyolCapabilities, b9 as TrendyolCargoProvider, ba as TrendyolClient, bb as TrendyolEnvironment, bc as UnapprovedDateQueryType, bd as UnapprovedProduct, be as UnapprovedProductRejectReason, bf as UnapprovedProductStatus, bg as UpdateBoxInfoInput, bh as UpdateContentInput, bi as UpdateDeliveryInfoInput, bj as UpdatePackageStatusInput, bk as UpdatePriceInventoryResponse, bl as UpdateTestOrderStatusOptions, bm as UpdateUnapprovedInput, bn as UpdateVariantInput, bo as UploadInvoiceFileInput, bp as VideoContentType, bq as VideosResource, br as Webhook, bs as WebhookAuthenticationType, bt as WebhookInput, bu as WebhooksResource, bv as createTrendyolClient, bw as normalizeShipmentPackage, bx as pollBatchStatus, by as trendyolCapabilities } from './client-BhSJFkFo.js';
|
|
3
3
|
import * as _lonca_core from '@lonca/core';
|
|
4
4
|
import { NormalizedOrderStatus } from '@lonca/core';
|
|
5
5
|
export { CursorPage, CursorPaginationParams, MutationResult, OffsetPage, OffsetPaginationParams, paginate, paginateOffset } from '@lonca/core';
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,11 @@ export { paginate, paginateOffset } from '@lonca/core';
|
|
|
3
3
|
|
|
4
4
|
// src/resources/brands.ts
|
|
5
5
|
var DEFAULT_PAGE_SIZE = 1e3;
|
|
6
|
+
function toBrand(node) {
|
|
7
|
+
const brand = { id: String(node.id), name: node.name };
|
|
8
|
+
if (typeof node.luxe === "boolean") brand.luxe = node.luxe;
|
|
9
|
+
return brand;
|
|
10
|
+
}
|
|
6
11
|
var BrandsResource = class {
|
|
7
12
|
constructor(transport, limiter) {
|
|
8
13
|
this.transport = transport;
|
|
@@ -13,6 +18,14 @@ var BrandsResource = class {
|
|
|
13
18
|
/**
|
|
14
19
|
* List Trendyol brands, one page at a time.
|
|
15
20
|
*
|
|
21
|
+
* **Next-page heuristic.** Trendyol's brand list carries no page count (neither the docs
|
|
22
|
+
* nor the prod wire have `totalPages` / `totalElements` — the response is just
|
|
23
|
+
* `{ brands: [...] }`). So when `totalPages` is absent, a **full page** (at least `limit`
|
|
24
|
+
* brands — Trendyol may send ~1000 even for a smaller `limit`) means "there may be more"
|
|
25
|
+
* and sets `nextCursor`; a short page is the last one. When the
|
|
26
|
+
* total is an exact multiple of the page size, `paginate()` makes one extra request that
|
|
27
|
+
* comes back empty and stops there. If Trendyol ever sends `totalPages`, it wins.
|
|
28
|
+
*
|
|
16
29
|
* @example
|
|
17
30
|
* ```ts
|
|
18
31
|
* import { paginate } from '@lonca/core';
|
|
@@ -30,8 +43,10 @@ var BrandsResource = class {
|
|
|
30
43
|
query: { page, size },
|
|
31
44
|
rateLimiter: this.limiter
|
|
32
45
|
});
|
|
33
|
-
const
|
|
34
|
-
const
|
|
46
|
+
const brands = data?.brands ?? [];
|
|
47
|
+
const items = brands.map(toBrand);
|
|
48
|
+
const hasMore = typeof data?.totalPages === "number" ? page + 1 < data.totalPages : size > 0 && brands.length >= size;
|
|
49
|
+
const nextCursor = hasMore ? String(page + 1) : void 0;
|
|
35
50
|
return nextCursor !== void 0 ? { items, nextCursor } : { items };
|
|
36
51
|
}
|
|
37
52
|
/**
|
|
@@ -55,7 +70,7 @@ var BrandsResource = class {
|
|
|
55
70
|
query: { name },
|
|
56
71
|
rateLimiter: this.limiter
|
|
57
72
|
});
|
|
58
|
-
return (data ?? []).map(
|
|
73
|
+
return (data ?? []).map(toBrand);
|
|
59
74
|
}
|
|
60
75
|
};
|
|
61
76
|
function normalizeCategory(node) {
|
|
@@ -68,7 +83,6 @@ function normalizeCategory(node) {
|
|
|
68
83
|
}
|
|
69
84
|
function normalizeAttribute(node) {
|
|
70
85
|
const attr = node.attribute ?? { id: 0, name: "" };
|
|
71
|
-
const rawValues = node.attributeValues ?? [];
|
|
72
86
|
const out = {
|
|
73
87
|
id: String(attr.id),
|
|
74
88
|
name: attr.name,
|
|
@@ -76,7 +90,8 @@ function normalizeAttribute(node) {
|
|
|
76
90
|
allowCustom: !!node.allowCustom,
|
|
77
91
|
varianter: !!node.varianter,
|
|
78
92
|
slicer: !!node.slicer,
|
|
79
|
-
|
|
93
|
+
// Deprecated: normally empty — see `attributeValues` on the node above.
|
|
94
|
+
values: (node.attributeValues ?? []).map((v) => ({ id: String(v.id), name: v.name }))
|
|
80
95
|
};
|
|
81
96
|
if (node.categoryId !== void 0) {
|
|
82
97
|
out.categoryId = String(node.categoryId);
|
|
@@ -138,8 +153,8 @@ var CategoriesResource = class {
|
|
|
138
153
|
/**
|
|
139
154
|
* Fetch the allowed values for a single category attribute (paginated).
|
|
140
155
|
*
|
|
141
|
-
* `getCategoryAttributes` returns attribute metadata + flags
|
|
142
|
-
*
|
|
156
|
+
* `getCategoryAttributes` returns attribute metadata + flags only, never the
|
|
157
|
+
* value catalog (docs and prod wire agree). Use this method to fetch the catalog for an
|
|
143
158
|
* attribute when `allowCustom` is `false` and you need to map your data
|
|
144
159
|
* onto Trendyol's accepted values.
|
|
145
160
|
*
|
|
@@ -1020,7 +1035,7 @@ var LocationsResource = class {
|
|
|
1020
1035
|
}
|
|
1021
1036
|
// ─── Domestic (TR / AZ) ───────────────────────────────────────────────
|
|
1022
1037
|
async getTurkeyCities() {
|
|
1023
|
-
return this.cities(`/integration/member/countries/domestic/TR/cities
|
|
1038
|
+
return this.cities(`/integration/member/countries/domestic/TR/cities`, "TR");
|
|
1024
1039
|
}
|
|
1025
1040
|
/**
|
|
1026
1041
|
* List districts for a Turkish city. **Pass the city `id`** (`City.id`) — the
|
|
@@ -1042,7 +1057,7 @@ var LocationsResource = class {
|
|
|
1042
1057
|
);
|
|
1043
1058
|
}
|
|
1044
1059
|
async getAzerbaijanCities() {
|
|
1045
|
-
return this.cities(`/integration/member/countries/domestic/AZ/cities
|
|
1060
|
+
return this.cities(`/integration/member/countries/domestic/AZ/cities`, "AZ");
|
|
1046
1061
|
}
|
|
1047
1062
|
/** List districts for an Azerbaijani city. **Pass the city `id`** (`City.id`), not `code`. */
|
|
1048
1063
|
async getAzerbaijanDistricts(cityId) {
|
|
@@ -1052,7 +1067,10 @@ var LocationsResource = class {
|
|
|
1052
1067
|
}
|
|
1053
1068
|
// ─── International (GULF / CEE) ───────────────────────────────────────
|
|
1054
1069
|
async getCitiesByCountry(countryCode) {
|
|
1055
|
-
return this.cities(
|
|
1070
|
+
return this.cities(
|
|
1071
|
+
`/integration/member/countries/${encodeURIComponent(countryCode)}/cities`,
|
|
1072
|
+
countryCode
|
|
1073
|
+
);
|
|
1056
1074
|
}
|
|
1057
1075
|
async getDistrictsByCity(countryCode, cityId) {
|
|
1058
1076
|
return this.districts(
|
|
@@ -1060,7 +1078,8 @@ var LocationsResource = class {
|
|
|
1060
1078
|
);
|
|
1061
1079
|
}
|
|
1062
1080
|
// ─── Shared paginators ────────────────────────────────────────────────
|
|
1063
|
-
|
|
1081
|
+
/** `countryCode` is the lookup's country — city rows do not carry one on the wire. */
|
|
1082
|
+
async cities(path, countryCode) {
|
|
1064
1083
|
const data = await this.transport.request({
|
|
1065
1084
|
method: "GET",
|
|
1066
1085
|
path,
|
|
@@ -1070,7 +1089,7 @@ var LocationsResource = class {
|
|
|
1070
1089
|
id: node.id !== void 0 ? String(node.id) : void 0,
|
|
1071
1090
|
code: String(node.code ?? node.id ?? ""),
|
|
1072
1091
|
name: node.name,
|
|
1073
|
-
countryCode
|
|
1092
|
+
countryCode
|
|
1074
1093
|
}));
|
|
1075
1094
|
}
|
|
1076
1095
|
async districts(path) {
|
|
@@ -1082,8 +1101,7 @@ var LocationsResource = class {
|
|
|
1082
1101
|
return n(data, (node) => ({
|
|
1083
1102
|
id: node.id !== void 0 ? String(node.id) : void 0,
|
|
1084
1103
|
code: String(node.code ?? node.id ?? ""),
|
|
1085
|
-
name: node.name
|
|
1086
|
-
cityCode: node.cityCode !== void 0 ? String(node.cityCode) : void 0
|
|
1104
|
+
name: node.name
|
|
1087
1105
|
}));
|
|
1088
1106
|
}
|
|
1089
1107
|
async neighborhoods(path) {
|
|
@@ -1092,12 +1110,16 @@ var LocationsResource = class {
|
|
|
1092
1110
|
path,
|
|
1093
1111
|
rateLimiter: this.limiter
|
|
1094
1112
|
});
|
|
1095
|
-
return n(data, (node) =>
|
|
1096
|
-
id
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1113
|
+
return n(data, (node) => {
|
|
1114
|
+
const id = node.id !== void 0 ? String(node.id) : void 0;
|
|
1115
|
+
return {
|
|
1116
|
+
id,
|
|
1117
|
+
// Neighborhood rows have no code; `code` mirrors the id (as it always did in practice).
|
|
1118
|
+
code: id ?? "",
|
|
1119
|
+
name: node.name,
|
|
1120
|
+
postCode: typeof node.postCode === "string" ? node.postCode : void 0
|
|
1121
|
+
};
|
|
1122
|
+
});
|
|
1101
1123
|
}
|
|
1102
1124
|
};
|
|
1103
1125
|
var MAX_PAGE_SIZE = 200;
|
|
@@ -2453,29 +2475,35 @@ var VALID_TYPES = /* @__PURE__ */ new Set([
|
|
|
2453
2475
|
"WAREHOUSE"
|
|
2454
2476
|
]);
|
|
2455
2477
|
function normalizeAddressType(raw) {
|
|
2456
|
-
|
|
2457
|
-
|
|
2478
|
+
const upper = typeof raw === "string" ? raw.toUpperCase() : void 0;
|
|
2479
|
+
if (upper && VALID_TYPES.has(upper)) {
|
|
2480
|
+
return upper;
|
|
2458
2481
|
}
|
|
2459
|
-
const stripped =
|
|
2482
|
+
const stripped = upper?.replace(/_ADDRESS$/, "");
|
|
2460
2483
|
if (stripped && VALID_TYPES.has(stripped)) {
|
|
2461
2484
|
return stripped;
|
|
2462
2485
|
}
|
|
2463
2486
|
return "SHIPMENT";
|
|
2464
2487
|
}
|
|
2488
|
+
function optionalString(value) {
|
|
2489
|
+
return typeof value === "number" || typeof value === "string" ? String(value) : void 0;
|
|
2490
|
+
}
|
|
2465
2491
|
function normalizeAddress2(node) {
|
|
2466
2492
|
return {
|
|
2467
2493
|
id: String(node.id),
|
|
2468
|
-
name: node.name,
|
|
2469
2494
|
addressType: normalizeAddressType(node.addressType),
|
|
2470
2495
|
isShipmentAddress: node.isShipmentAddress ?? false,
|
|
2471
2496
|
isReturningAddress: node.isReturningAddress ?? false,
|
|
2472
2497
|
isInvoiceAddress: node.isInvoiceAddress ?? false,
|
|
2473
2498
|
isDefault: node.isDefault ?? false,
|
|
2474
2499
|
address: node.address,
|
|
2500
|
+
fullAddress: node.fullAddress,
|
|
2501
|
+
country: node.country,
|
|
2475
2502
|
city: node.city,
|
|
2503
|
+
cityCode: optionalString(node.cityCode),
|
|
2476
2504
|
district: node.district,
|
|
2477
|
-
|
|
2478
|
-
|
|
2505
|
+
districtId: optionalString(node.districtId),
|
|
2506
|
+
postCode: node.postCode
|
|
2479
2507
|
};
|
|
2480
2508
|
}
|
|
2481
2509
|
var DEFAULT_CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -2942,7 +2970,8 @@ function createTrendyolClient(opts) {
|
|
|
2942
2970
|
integratorName: opts.integratorName,
|
|
2943
2971
|
clientIp: opts.clientIp,
|
|
2944
2972
|
logger: opts.logger,
|
|
2945
|
-
timeoutMs: opts.timeoutMs
|
|
2973
|
+
timeoutMs: opts.timeoutMs,
|
|
2974
|
+
fetch: opts.fetch
|
|
2946
2975
|
});
|
|
2947
2976
|
return buildClient(transport);
|
|
2948
2977
|
}
|