idosell 0.4.45 → 0.4.49
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/changelog.md +26 -11
- package/dist/app.d.ts +10 -2
- package/dist/gates.js +2 -0
- package/dist/gateways.d.ts +19 -8
- package/dist/index.js +6 -1
- package/dist/methods/deletePackages.js +6 -0
- package/dist/methods/getProductsSizes.js +0 -3
- package/dist/methods/searchPromotionsArchive.js +0 -1
- package/dist/methods/searchPromotionsElements.js +0 -1
- package/dist/methods/searchPromotionsHistory.js +0 -1
- package/dist/methods/searchPromotionsListView.js +0 -1
- package/dist/reqparams.d.ts +48 -1
- package/dist/request.js +60 -26
- package/dist/responses.d.ts +52 -2
- package/dist/utils.d.ts +11 -0
- package/dist/utils.js +40 -0
- package/package.json +1 -1
- package/tests/deletePackages.test.js +7 -0
package/changelog.md
CHANGED
|
@@ -5,33 +5,48 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [0.4.
|
|
8
|
+
## [0.4.49] - 2026-07-02
|
|
9
|
+
### Fixed
|
|
10
|
+
- Fixed looping / pagination errors
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Added utils.getPaginnation and utils.hasNext function for pagination
|
|
14
|
+
- Added infinite loop detection
|
|
15
|
+
- Updated types
|
|
16
|
+
|
|
17
|
+
## [0.4.47] - 2026-06-24
|
|
18
|
+
### Added
|
|
19
|
+
- Added optional OAuth2 authentication instead of API key authentication
|
|
20
|
+
- Updated to latest v8.7
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [0.4.45] - 2026-06-07
|
|
9
24
|
### Added
|
|
10
25
|
- Added handleRaw to pass raw data instead of request
|
|
11
26
|
- Added test to webhooks
|
|
12
27
|
|
|
13
28
|
|
|
14
|
-
## [0.4.43] -
|
|
29
|
+
## [0.4.43] - 2026-06-07
|
|
15
30
|
### Changed
|
|
16
31
|
- Webhook now supports HMAC checking and groups of webhooks
|
|
17
32
|
- Added raw data to webhook headers and handlers
|
|
18
33
|
|
|
19
34
|
|
|
20
|
-
## [0.4.41] -
|
|
35
|
+
## [0.4.41] - 2026-06-07
|
|
21
36
|
### Added
|
|
22
37
|
- Added webook support
|
|
23
38
|
- Added LANG_ID enumerator
|
|
24
39
|
- Added mapProductParameters utils helper
|
|
25
40
|
|
|
26
41
|
|
|
27
|
-
## [0.4.38] -
|
|
42
|
+
## [0.4.38] - 2026-06-03
|
|
28
43
|
### Changed
|
|
29
44
|
- Added enum types from description
|
|
30
45
|
- Updated types to latest versions
|
|
31
46
|
- Updated axios version to latest
|
|
32
47
|
- Added mapping parameters to utils
|
|
33
48
|
|
|
34
|
-
## [0.4.34] -
|
|
49
|
+
## [0.4.34] - 2026-05-27
|
|
35
50
|
### Fixed
|
|
36
51
|
- Reusing idosell object unintentionally copied some fields
|
|
37
52
|
- Requiremens check failed on falsy (0 or empty string), not only fails when undefined or null
|
|
@@ -39,33 +54,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
39
54
|
### Changed
|
|
40
55
|
- Fixed missing types
|
|
41
56
|
|
|
42
|
-
## [0.4.32] -
|
|
57
|
+
## [0.4.32] - 2026-05-19
|
|
43
58
|
### Changed
|
|
44
59
|
- Fixed some latest types
|
|
45
60
|
- Fxied paging
|
|
46
61
|
|
|
47
|
-
## [0.4.30] -
|
|
62
|
+
## [0.4.30] - 2026-05-07
|
|
48
63
|
### Changed
|
|
49
64
|
- Updated to Idosell Rest API v8.1
|
|
50
65
|
- Some methods removed from api v8.1, still availible through v7 enpoints - version is enforced for those enpoints
|
|
51
66
|
|
|
52
|
-
## [0.4.27] -
|
|
67
|
+
## [0.4.27] - 2026-04-06
|
|
53
68
|
### Changed
|
|
54
69
|
- Addded missing promotions types
|
|
55
70
|
- Fixed paging for promotions
|
|
56
71
|
|
|
57
|
-
## [0.4.25] -
|
|
72
|
+
## [0.4.25] - 2026-04-04
|
|
58
73
|
### Changed
|
|
59
74
|
- Updated to v7.19
|
|
60
75
|
- Added promotion routes
|
|
61
76
|
- Changed routes that have ProductsProducts to Products like getProductsToFacebookCatalog (before: getProductsProductsToFacebookCatalog)
|
|
62
77
|
|
|
63
|
-
## [0.4.24] -
|
|
78
|
+
## [0.4.24] - 2026-03-21
|
|
64
79
|
### Changed
|
|
65
80
|
- Updated to v7.13
|
|
66
81
|
- Fixed url format
|
|
67
82
|
|
|
68
|
-
## [0.4.23] -
|
|
83
|
+
## [0.4.23] - 2026-03-11
|
|
69
84
|
### Changed
|
|
70
85
|
- Added custom error class
|
|
71
86
|
- Fixed types for ids that can be integer instead of string
|
package/dist/app.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export type JSObject = Record<string, any>;
|
|
|
26
26
|
export type RequestProxyObject = {
|
|
27
27
|
auth: {
|
|
28
28
|
url: string,
|
|
29
|
-
apiKey:
|
|
29
|
+
apiKey: ApyKeyOrOauthCredentials,
|
|
30
30
|
version: number | string
|
|
31
31
|
},
|
|
32
32
|
params: Record<string, any>,
|
|
@@ -48,8 +48,9 @@ export type GatewayRequestProxyObject = {
|
|
|
48
48
|
},
|
|
49
49
|
custom?: Record<string, (..._: any) => false | Record<string, any>>,
|
|
50
50
|
snakeCase?: boolean,
|
|
51
|
-
paginationObject?: boolean,
|
|
51
|
+
// paginationObject?: boolean,
|
|
52
52
|
next?: boolean,
|
|
53
|
+
prev?: Record<string,any>,
|
|
53
54
|
rootparams?: string | boolean,
|
|
54
55
|
arrays?: string[],
|
|
55
56
|
req?: RequirementType[],
|
|
@@ -267,4 +268,11 @@ export type Webhooks = {
|
|
|
267
268
|
on<O extends WebhookObjectType>(objectType: O, handler: WebhookObjectHandler<O>): WebhookChain;
|
|
268
269
|
};
|
|
269
270
|
|
|
271
|
+
export type ApyKeyOrOauthCredentials = string | {
|
|
272
|
+
login: string;
|
|
273
|
+
password: string;
|
|
274
|
+
scope?: ('admin')[];
|
|
275
|
+
token?: string;
|
|
276
|
+
}
|
|
277
|
+
|
|
270
278
|
export { };
|
package/dist/gates.js
CHANGED
|
@@ -135,6 +135,7 @@ import getPackagesLabels from "./methods/getPackagesLabels.js";
|
|
|
135
135
|
import postPackagesLabels from "./methods/postPackagesLabels.js";
|
|
136
136
|
import postPackages from "./methods/postPackages.js";
|
|
137
137
|
import putPackages from "./methods/putPackages.js";
|
|
138
|
+
import deletePackages from "./methods/deletePackages.js";
|
|
138
139
|
import searchPackages from "./methods/searchPackages.js";
|
|
139
140
|
import postPaymentsCancel from "./methods/postPaymentsCancel.js";
|
|
140
141
|
import postPaymentsCashback from "./methods/postPaymentsCashback.js";
|
|
@@ -473,6 +474,7 @@ const gates = {
|
|
|
473
474
|
postPackagesLabels,
|
|
474
475
|
postPackages,
|
|
475
476
|
putPackages,
|
|
477
|
+
deletePackages,
|
|
476
478
|
searchPackages,
|
|
477
479
|
postPaymentsCancel,
|
|
478
480
|
postPaymentsCashback,
|
package/dist/gateways.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
2
|
-
import type { PagableGateway, AppendableGateway, Gateway, DateLike, JSObject, IdosellErrorFaultStructure, Webhooks, IaiWebhookHeaders } from "./app.d.ts"
|
|
2
|
+
import type { PagableGateway, AppendableGateway, Gateway, DateLike, JSObject, IdosellErrorFaultStructure, Webhooks, IaiWebhookHeaders, ApyKeyOrOauthCredentials } from "./app.d.ts"
|
|
3
3
|
import type { GetClientsBalanceResponse, BooleanStatusResponse, GetClientsResponse, PostClientsResponse, PutClientsResponse, SearchClientsCrmResponse, GetClientsDeliveryAddressResponse, PostClientsDeliveryAddressResponse, PutClientsDeliveryAddressResponse, VouchersResponse, PutVouchersResponse, SearchClientsGiftcardsResponse, GetClientsGiftcardsTypesResponse, GetClientsMembershipCardsResponse, PutClientsMembershipCardsResponse, SearchClientsNewsletterEmailResponse, SearchClientsNewsletterSmsResponse, GetClientsPayerAddressResponse, PostClientsPayerAddressResponse, PutClientsPayerAddressResponse, GetClientsPricelistsClientsResponse, PutClientsPricelistsClientsResponse, GetClientsPricelistsResponse, PostClientsPricelistsResponse, GetClientsPricelistsProductsResponse, PutClientsPricelistsProductsResponse, GetClientsPricesActiveCardResponse, GetClientsPricesDiscountGroupsResponse, GetClientsPricesDiscountsResponse, PutClientsPricesDiscountsResponse, GetClientsProfitPointsResponse, GetClientsProvinceListResponse, GetClientsTagsResponse, PostClientsTagsResponse, PutClientsTagsResponse, GetConfigVariablesResponse, PutConfigVariablesResponse, GetCouriersAssignedToShippingProfilesResponse, GetCouriersResponse, GetCouriersPickupPointsResponse, PutCouriersPickupPointsResponse, GetCpaCampaignResponse, CmsCampaignResponse, CmsResponse, GetCpaResponse, GetDeliveriesProfilesResponse, GetDeliveriesRegionsResponse, PostDeliveriesRegionsResponse, GetDiscountsGroupsClientsResponse, GetDiscountsGroupsResponse, PostDiscountsGroupsResponse, GetEntriesResponse, PostEntriesResponse, GetEntriesPagesToDisplayResponse, GetEntriesSourcesResponse, GetMenuResponse, PostMenuResponse, PutMenuResponse, PutMenuSortResponse, GetOrdersAnalyticsResponse, GetOrdersAuctionDetailsResponse, PutOrdersCourierResponse, PostOrdersDocumentsCreateResponse, GetOrdersDocumentsResponse, PostOrdersDocumentsResponse, GetOrdersHandlerResponse, GetOrdersHistoryResponse, GetOrdersImagesResponse, PostOrdersImagesResponse, GetOrdersLabelsResponse, SearchOrdersOpinionsResponse, GetOrdersOpinionsRateResponse, SearchOrdersResponse, PostOrdersResponse, PutOrdersResponse, GetOrdersPackagesResponse, PutOrdersPackagesResponse, PutOrdersProductsSerialNumbersResponse, PutOrdersProfitMarginResponse, GetOrdersProfitabilityResponse, GetOrdersStatusesResponse, GetOrdersWarehouseResponse, PostPackagesLabelsResponse, PutPackagesResponse, SearchPackagesResponse, GetPaymentsFormsResponse, GetPaymentsResponse, PostPaymentsResponse, GetPaymentsProfilesResponse, PostPaymentsRepaymentResponse, GetProductsSKUbyBarcodeResponse, GetProductsAttachmentsGetContentResponse, PutProductsAttachmentsResponse, GetProductsAuctionsResponse, GetProductsBrandsResponse, PutProductsBrandsResponse, GetProductsCategoriesResponse, PutProductsCategoriesResponse, SearchProductsCategoriesIdosellResponse, GetProductsCodeExistenceResponse, SearchProductsDeliveryTimeResponse, GetProductsDescriptionsResponse, ProductIdentResponse, PutProductsGroupsSettingsResponse, GetProductsIdBySizecodeResponse, PutProductsImagesResponse, GetProductsMarketingZonesResponse, PutProductsMarketingZonesResponse, GetProductsOmnibusPricesResponse, GetProductsOpinionsResponse, PostProductsOpinionsResponse, GetProductsOpinionsRateResponse, PutProductsParametersResponse, SearchProductsParametersResponse, SearchProductsResponse, PostProductsResponse, PutProductsResponse, PutProductsMarketingPromotionResponse, GetProductsQuestionsResponse, GetProductsReservationsResponse, GetProductsSeriesResponse, PutProductsSeriesResponse, GetProductsSizesResponse, PutProductsSizesResponse, PutProductsStockQuantityResponse, GetProductsStocksResponse, PutProductsStocksResponse, GetProductsStrikethroughPricesResponse, PutProductsSupplierCodeResponse, PutProductsSupplierProductDataResponse, PromotionBoolResponse, SearchPromotionsElementsResponse, SearchPromotionsHistoryResponse, PromotionIdResponse, GetPromotionsResponse, SearchPromotionsListViewResponse, GetPromotionsArchiveResponse, SearchPromotionsArchiveResponse, GetPromotionsSettingsResponse, GetRegulationsHistoryResponse, GetResponsibilityEntitiesResponse, PutResponsibilityEntitiesResponse, GetReturnsResponse, PostReturnsResponse, PutReturnsResponse, PutReturnsSerialNumberResponse, GetRmaResponse, PutRmaResponse, GetRmaStatusesResponse, GetShopsCurrenciesResponse, GetShopsLanguagesResponse, GetSizechartsResponse, PutSizechartsResponse, GetSizesResponse, PutSizesResponse, GetSnippetsCampaignResponse, GetSnippetsCookiesResponse, GetSnippetsResponse, GetSystemConfigResponse, GetSystemCurrenciesResponse, PutSystemCurrenciesResponse, GetSystemProcessesAutomationResponse, GetSystemServerLoadResponse, GetSystemServerTimeResponse, GetSystemShopsDataResponse, GetSystemUnitsResponse, PutSystemUnitsResponse, GetSystemUsersResponse, GetVouchersTypesResponse, GetVouchersResponse, GetWarrantiesCountTotalResponse, PutWarrantiesLanguageDataResponse, GetWarrantiesResponse, PutWarrantiesResponse, GetWmsLocationsResponse, GetWmsStocksdocumentsDocumentsResponse, PostWmsStocksdocumentsDocumentsResponse, PutWmsStocksdocumentsDocumentsResponse, GetWmsStocksdocumentsOpenedDocumentsResponse, GetWmsStocksdocumentsProductsResponse, PutWmsStocksdocumentsProductsResponse, GetWmsSuppliersResponse, PutWmsSuppliersResponse, GetProductsMarketingPromotionResponse, PostProductsMarketingPromotionResponse } from "./responses.d.ts"
|
|
4
4
|
import type * as RequestParams from "./reqparams.d.ts";
|
|
5
5
|
import { ENUMS } from "./enums";
|
|
@@ -1209,6 +1209,12 @@ export interface PostEntriesRequest extends AppendableGateway<PostEntriesRequest
|
|
|
1209
1209
|
blogUrl: (blogUrl: string) => this
|
|
1210
1210
|
/** News item URL */
|
|
1211
1211
|
newsUrl: (newsUrl: string) => this
|
|
1212
|
+
/** Meta title of the entry */
|
|
1213
|
+
metaTitle: (metaTitle: string) => this
|
|
1214
|
+
/** Meta description of the entry */
|
|
1215
|
+
metaDescription: (metaDescription: string) => this
|
|
1216
|
+
/** Meta keywords of the entry */
|
|
1217
|
+
metaKeywords: (metaKeywords: string) => this
|
|
1212
1218
|
/** Add Post to blog entries */
|
|
1213
1219
|
blog: () => this;
|
|
1214
1220
|
/** Add Post to news entries */
|
|
@@ -2048,6 +2054,11 @@ export interface PutPackagesRequest extends AppendableGateway<PutPackagesRequest
|
|
|
2048
2054
|
packages: (packages: RequestParams.PutPackagesParams["orderPackages"][number]["packages"]) => this
|
|
2049
2055
|
}
|
|
2050
2056
|
|
|
2057
|
+
export interface DeletePackagesRequest extends Gateway {
|
|
2058
|
+
/** Parcels's ID */
|
|
2059
|
+
packageId: (value: number|string) => this;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2051
2062
|
export interface SearchPackagesRequest extends AppendableGateway<SearchPackagesRequest, SearchPackagesResponse, RequestParams.SearchPackagesParams> {
|
|
2052
2063
|
/** Consignments numbers. */
|
|
2053
2064
|
deliveryPackageNumbers: (value: string|string[]) => this;
|
|
@@ -2672,7 +2683,7 @@ export interface PutProductsParametersRequest extends AppendableGateway<PutProdu
|
|
|
2672
2683
|
card_icons: (card_icons: RequestParams.PutProductsParametersParams["items"][number]["card_icons"]) => this
|
|
2673
2684
|
/** Icons of section, parameter or value to display on the list of products. */
|
|
2674
2685
|
link_icons: (link_icons: RequestParams.PutProductsParametersParams["items"][number]["link_icons"]) => this
|
|
2675
|
-
/** Parameter's additional feature. 1. Status: context_id = "CONTEXT_STATE" Takes values context_value_id: - CONTEXT_STATE_NEW - New, - CONTEXT_STATE_USED - Used, - CONTEXT_STATE_USED_EXCELLENT - Used - excellent condition - CONTEXT_STATE_USED_VERYGOOD - Used - very good condition - CONTEXT_STATE_USED_CORRECT - Used - good condition - CONTEXT_STATE_USED_ACCEPTABLE - Used - acceptable condition - CONTEXT_STATE_REFURBISHED_EXCELLENT - Refurbished - excellent condition - CONTEXT_STATE_REFURBISHED_VERYGOOD - Refurbished - very good condition - CONTEXT_STATE_REFURBISHED_CORRECT - Refurbished - good condition - CONTEXT_STATE_NEW_OTHERS - New other (see details) - CONTEXT_STATE_NEW_WITH_DEFECTS - New with defects - CONTEXT_STATE_NEW_OEM - New - OEM - CONTEXT_STATE_NEW_OPEN_BOX - New - open box - CONTEXT_STATE_REFURBISHED_BY_PRODUCER - Renewed by a manufacturer, - CONTEXT_STATE_REFURBISHED_BY_SELLER - Renewed by a seller, - CONTEXT_STATE_FOR_PARTS_OR_BROKEN - In parts or damaged. 2. Product weight in grams: context_id = "CONTEXT_STD_UNIT_WEIGHT" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 3. A product's value in milliliters: context_id = "CONTEXT_STD_UNIT_VOLUME" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 4. Sex: context_id = "CONTEXT_SEX" Takes values context_value_id: - CONTEXT_SEX_MAN - Man, - CONTEXT_SEX_WOMAN - Woman, - CONTEXT_SEX_UNISEX - Unisex. 5. Age group: context_id = "CONTEXT_AGE_GROUP" Takes values context_value_id: - CONTEXT_AGE_GROUP_ADULT - Adults, - CONTEXT_AGE_GROUP_MINOR - Children. 6. Maximum number of products in an order: context_id = "CONTEXT_MAX_QUANTITY_PER_RETAIL_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 7. Maximum number of products in a wholesale order: context_id = "CONTEXT_MAX_QUANTITY_PER_WHOLESALE_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 8. Minimal number of products in an order: context_id = "CONTEXT_MIN_QUANTITY_PER_RETAIL_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 9. Minimum number of products in a wholesale order: context_id = "CONTEXT_MIN_QUANTITY_PER_WHOLESALE_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 10. Maximal number of a single size in an order: context_id = "CONTEXT_MAX_SIZE_QUANTITY_PER_RETAIL_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 11. Maximal number of a single size in a wholesale order: context_id = "CONTEXT_MAX_SIZE_QUANTITY_PER_WHOLESALE_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 12. Minimal number of a single size in an order: context_id = "CONTEXT_MIN_SIZE_QUANTITY_PER_RETAIL_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 13. Minimal number of a single size in a wholesale order: context_id = "CONTEXT_MIN_SIZE_QUANTITY_PER_WHOLESALE_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 14. Net weight: context_id = "CONTEXT_WEIGHT_NET" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 15. Color: context_id = "CONTEXT_COLOR" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 16. #!TylkoDlaDoroslych!#: context_id = "CONTEXT_ONLY_ADULTS" Takes values context_value_id: - CONTEXT_ONLY_ADULTS_YES - yes, - CONTEXT_ONLY_ADULTS_NO - no. 17. Prescription drug: context_id = "CONTEXT_PRESCRIPTION_MEDICINE" Takes values context_value_id: - CONTEXT_PRESCRIPTION_MEDICINE_YES - yes, - CONTEXT_PRESCRIPTION_MEDICINE_NO - no. 18. Season Rate: context_id = "CONTEXT_SEASON" Takes values context_value_id: - CONTEXT_SEASON_SPRING - Spring, - CONTEXT_SEASON_SUMMER - Summer, - CONTEXT_SEASON_FALL - Autumn, - CONTEXT_SEASON_WINTER - Winter, - CONTEXT_SEASON_SPRING_SUMMER - Spring/Summer, - CONTEXT_SEASON_FALL_WINTER - Autumn/Winter 19. Risk - signal word: context_id = \"CONTEXT_HAZMAT_SIGNAL\" Takes values context_value_id: - CONTEXT_HAZMAT_SIGNAL_DANGER - danger, - CONTEXT_HAZMAT_SIGNAL_WARNING - warnging, - CONTEXT_HAZMAT_SIGNAL_CAUTION - caution, - CONTEXT_HAZMAT_SIGNAL_NOTICE - notice, 20. Risk - warning pictogram context_id = \"CONTEXT_HAZMAT_PICTOGRAM\" Takes values context_value_id: - GHS01, GHS02, GHS03, GHS04, GHS05, GHS06, GHS07, GHS08, GHS09 21. Risk - type of hazard: context_id = \"CONTEXT_HAZMAT_STATEMENT\" Takes values context_value_id: - H200, H201, H202, H203, H204, H205, H220, H221, H222, H223, H224, H225, H226, H228, H240, H241, H242, H250, H251, H252, H260, H261, H270, H271, H272, H280, H281, H290, H300, H301, H302, H304, H310, H311, H312, H314, H315, H317, H318, H319, H330, H331, H332, H334, H335, H336, H340, H341, H350, H351, H360, H361, H362, H370, H371, H372, H373, H400, H410, H411, H412, H413, EUH 001, EUH 014, EUH 018, EUH 019, EUH 044, EUH 029, EUH 031, EUH 032, EUH 066, EUH 070, EUH 071, EUH 201, EUH 201A, EUH 202, EUH 203, EUH 204, EUH 205, EUH 206, EUH 207, EUH 208, EUH 209, EUH 209A, EUH 210, EUH 401 22. Repair score: context_id = \"CONTEXT_REPAIR_SCORE\" Takes values context_value_id: - The value of the additional feature is set automatically based on the parameter's value 23. Safety - information pictogram: context_id = \"CONTEXT_SAFETY_PICTOGRAM\" Takes values context_value_id: - 1 (Not suitable for small children) - 2 (CE mark) 24. Safety - type of warning: context_id = \"CONTEXT_SAFETY_STATEMENT\" Takes values context_value_id: - 1 (Not suitable for children under 3 years) - 2 (Keep out of the reach of children) - 3 (Product contains a button cell or coin battery) - 4 (Use under the direct supervision of adults) - 5 (Required protective gear. Do not use in public traffic) - 6 (Contains toy. Adult supervision recommended) - 7 (To prevent possible injury from entanglement, remove this toy as soon as the child begins to crawl) - 8 (Use only in shallow water under adult supervision) - 9 (Only use under adult supervision) - 10 (This toy does not provide protection) - 11 (Contains fragrances that may cause allergies) - 12 (For household use only). */
|
|
2686
|
+
/** Parameter's additional feature. 1. Status: context_id = "CONTEXT_STATE" Takes values context_value_id: - CONTEXT_STATE_NEW - New, - CONTEXT_STATE_USED - Used, - CONTEXT_STATE_USED_EXCELLENT - Used - excellent condition - CONTEXT_STATE_USED_VERYGOOD - Used - very good condition - CONTEXT_STATE_USED_CORRECT - Used - good condition - CONTEXT_STATE_USED_ACCEPTABLE - Used - acceptable condition - CONTEXT_STATE_REFURBISHED_EXCELLENT - Refurbished - excellent condition - CONTEXT_STATE_REFURBISHED_VERYGOOD - Refurbished - very good condition - CONTEXT_STATE_REFURBISHED_CORRECT - Refurbished - good condition - CONTEXT_STATE_REFURBISHED_ACCEPTABLE - Refurbished - acceptable - CONTEXT_STATE_NEW_OTHERS - New other (see details) - CONTEXT_STATE_NEW_WITH_DEFECTS - New with defects - CONTEXT_STATE_NEW_OEM - New - OEM - CONTEXT_STATE_NEW_OPEN_BOX - New - open box - CONTEXT_STATE_REFURBISHED_BY_PRODUCER - Renewed by a manufacturer, - CONTEXT_STATE_REFURBISHED_BY_SELLER - Renewed by a seller, - CONTEXT_STATE_FOR_PARTS_OR_BROKEN - In parts or damaged. 2. Product weight in grams: context_id = "CONTEXT_STD_UNIT_WEIGHT" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 3. A product's value in milliliters: context_id = "CONTEXT_STD_UNIT_VOLUME" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 4. Sex: context_id = "CONTEXT_SEX" Takes values context_value_id: - CONTEXT_SEX_MAN - Man, - CONTEXT_SEX_WOMAN - Woman, - CONTEXT_SEX_UNISEX - Unisex. 5. Age group: context_id = "CONTEXT_AGE_GROUP" Takes values context_value_id: - CONTEXT_AGE_GROUP_ADULT - Adults, - CONTEXT_AGE_GROUP_MINOR - Children. 6. Maximum number of products in an order: context_id = "CONTEXT_MAX_QUANTITY_PER_RETAIL_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 7. Maximum number of products in a wholesale order: context_id = "CONTEXT_MAX_QUANTITY_PER_WHOLESALE_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 8. Minimal number of products in an order: context_id = "CONTEXT_MIN_QUANTITY_PER_RETAIL_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 9. Minimum number of products in a wholesale order: context_id = "CONTEXT_MIN_QUANTITY_PER_WHOLESALE_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 10. Maximal number of a single size in an order: context_id = "CONTEXT_MAX_SIZE_QUANTITY_PER_RETAIL_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 11. Maximal number of a single size in a wholesale order: context_id = "CONTEXT_MAX_SIZE_QUANTITY_PER_WHOLESALE_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 12. Minimal number of a single size in an order: context_id = "CONTEXT_MIN_SIZE_QUANTITY_PER_RETAIL_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 13. Minimal number of a single size in a wholesale order: context_id = "CONTEXT_MIN_SIZE_QUANTITY_PER_WHOLESALE_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 14. Net weight: context_id = "CONTEXT_WEIGHT_NET" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 15. Color: context_id = "CONTEXT_COLOR" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 16. #!TylkoDlaDoroslych!#: context_id = "CONTEXT_ONLY_ADULTS" Takes values context_value_id: - CONTEXT_ONLY_ADULTS_YES - yes, - CONTEXT_ONLY_ADULTS_NO - no. 17. Prescription drug: context_id = "CONTEXT_PRESCRIPTION_MEDICINE" Takes values context_value_id: - CONTEXT_PRESCRIPTION_MEDICINE_YES - yes, - CONTEXT_PRESCRIPTION_MEDICINE_NO - no. 18. Season Rate: context_id = "CONTEXT_SEASON" Takes values context_value_id: - CONTEXT_SEASON_SPRING - Spring, - CONTEXT_SEASON_SUMMER - Summer, - CONTEXT_SEASON_FALL - Autumn, - CONTEXT_SEASON_WINTER - Winter, - CONTEXT_SEASON_SPRING_SUMMER - Spring/Summer, - CONTEXT_SEASON_FALL_WINTER - Autumn/Winter 19. Risk - signal word: context_id = \"CONTEXT_HAZMAT_SIGNAL\" Takes values context_value_id: - CONTEXT_HAZMAT_SIGNAL_DANGER - danger, - CONTEXT_HAZMAT_SIGNAL_WARNING - warnging, - CONTEXT_HAZMAT_SIGNAL_CAUTION - caution, - CONTEXT_HAZMAT_SIGNAL_NOTICE - notice, 20. Risk - warning pictogram context_id = \"CONTEXT_HAZMAT_PICTOGRAM\" Takes values context_value_id: - GHS01, GHS02, GHS03, GHS04, GHS05, GHS06, GHS07, GHS08, GHS09 21. Risk - type of hazard: context_id = \"CONTEXT_HAZMAT_STATEMENT\" Takes values context_value_id: - H200, H201, H202, H203, H204, H205, H220, H221, H222, H223, H224, H225, H226, H228, H240, H241, H242, H250, H251, H252, H260, H261, H270, H271, H272, H280, H281, H290, H300, H301, H302, H304, H310, H311, H312, H314, H315, H317, H318, H319, H330, H331, H332, H334, H335, H336, H340, H341, H350, H351, H360, H361, H362, H370, H371, H372, H373, H400, H410, H411, H412, H413, EUH 001, EUH 014, EUH 018, EUH 019, EUH 044, EUH 029, EUH 031, EUH 032, EUH 066, EUH 070, EUH 071, EUH 201, EUH 201A, EUH 202, EUH 203, EUH 204, EUH 205, EUH 206, EUH 207, EUH 208, EUH 209, EUH 209A, EUH 210, EUH 401 22. Repair score: context_id = \"CONTEXT_REPAIR_SCORE\" Takes values context_value_id: - The value of the additional feature is set automatically based on the parameter's value 23. Safety - information pictogram: context_id = \"CONTEXT_SAFETY_PICTOGRAM\" Takes values context_value_id: - 1 (Not suitable for small children) - 2 (CE mark) 24. Safety - type of warning: context_id = \"CONTEXT_SAFETY_STATEMENT\" Takes values context_value_id: - 1 (Not suitable for children under 3 years) - 2 (Keep out of the reach of children) - 3 (Product contains a button cell or coin battery) - 4 (Use under the direct supervision of adults) - 5 (Required protective gear. Do not use in public traffic) - 6 (Contains toy. Adult supervision recommended) - 7 (To prevent possible injury from entanglement, remove this toy as soon as the child begins to crawl) - 8 (Use only in shallow water under adult supervision) - 9 (Only use under adult supervision) - 10 (This toy does not provide protection) - 11 (Contains fragrances that may cause allergies) - 12 (For household use only). */
|
|
2676
2687
|
context_id: (context_id: number|string) => this
|
|
2677
2688
|
/** value of additional feature - Values described in context_id. */
|
|
2678
2689
|
context_value_id: (context_value_id: number|string) => this
|
|
@@ -3473,10 +3484,7 @@ export interface DeleteProductsSizesRequest extends AppendableGateway<DeleteProd
|
|
|
3473
3484
|
sizes: (sizes: Array<JSObject>) => this
|
|
3474
3485
|
}
|
|
3475
3486
|
|
|
3476
|
-
export interface GetProductsSizesRequest extends Gateway<GetProductsSizesResponse> {
|
|
3477
|
-
/** Allows to change offset and number of records returned */
|
|
3478
|
-
page: (pagenumber: number, pageSize?: number) => this;
|
|
3479
|
-
}
|
|
3487
|
+
export interface GetProductsSizesRequest extends Gateway<GetProductsSizesResponse> {}
|
|
3480
3488
|
|
|
3481
3489
|
export interface PutProductsSizesRequest extends AppendableGateway<PutProductsSizesRequest, PutProductsSizesResponse, RequestParams.PutProductsSizesParams> {
|
|
3482
3490
|
/** Edition mode */
|
|
@@ -3935,7 +3943,7 @@ export interface GetResponsibilityEntitiesRequest extends PagableGateway<GetResp
|
|
|
3935
3943
|
/** List of codes */
|
|
3936
3944
|
code: (value: string|string[]) => this;
|
|
3937
3945
|
/** Type of entity */
|
|
3938
|
-
type: (value:
|
|
3946
|
+
type: (value: "producer" | "person") => this;
|
|
3939
3947
|
/** Page with results number. Numeration starts from 0 */
|
|
3940
3948
|
resultsPage: (value: number|string) => this;
|
|
3941
3949
|
/** Number of results on page. Value from 1 to 100 */
|
|
@@ -4034,6 +4042,8 @@ export interface GetReturnsRequest extends PagableGateway<GetReturnsRequest, Get
|
|
|
4034
4042
|
stock_id: (value: number|string) => this;
|
|
4035
4043
|
/** Return a set as its constituent products */
|
|
4036
4044
|
bundleAsProducts: (value: boolean) => this;
|
|
4045
|
+
/** Search by ID of a shop to which a return is sent. */
|
|
4046
|
+
shop_ids: (value: number|string|number[]|string[]) => this;
|
|
4037
4047
|
/** Define range of dates and their type */
|
|
4038
4048
|
dates: (dateFrom: DateLike, dateTo: DateLike, type?: "date_add"|"date_end") => this;
|
|
4039
4049
|
}
|
|
@@ -5182,6 +5192,7 @@ export interface Gateways {
|
|
|
5182
5192
|
postPackagesLabels: PostPackagesLabelsRequest,
|
|
5183
5193
|
postPackages: PostPackagesRequest,
|
|
5184
5194
|
putPackages: PutPackagesRequest,
|
|
5195
|
+
deletePackages: DeletePackagesRequest,
|
|
5185
5196
|
searchPackages: SearchPackagesRequest,
|
|
5186
5197
|
postPaymentsCancel: PostPaymentsCancelRequest,
|
|
5187
5198
|
postPaymentsCashback: PostPaymentsCashbackRequest,
|
|
@@ -5420,6 +5431,6 @@ export interface Gateways {
|
|
|
5420
5431
|
}
|
|
5421
5432
|
|
|
5422
5433
|
declare const webhooks: Webhooks;
|
|
5423
|
-
declare const defaultExport: (url: string, apiKey:
|
|
5434
|
+
declare const defaultExport: (url: string, apiKey: ApyKeyOrOauthCredentials, version?: number | string) => Gateways;
|
|
5424
5435
|
export default defaultExport;
|
|
5425
5436
|
export { ENUMS, RequestParams, utils, webhooks, IaiWebhookHeaders }
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,12 @@ function normalizeUrl(input = "") {
|
|
|
22
22
|
return parsed.origin;
|
|
23
23
|
}
|
|
24
24
|
const idosell = (url, apiKey, version = DEFAULT_VERSION) => {
|
|
25
|
-
|
|
25
|
+
let hiddenKey = '*'.repeat(10);
|
|
26
|
+
if (typeof apiKey === 'string')
|
|
27
|
+
hiddenKey = apiKey.slice(0, 6) + '*'.repeat(20);
|
|
28
|
+
else
|
|
29
|
+
hiddenKey = `${apiKey.login}:${apiKey.password.slice(0, 4)}${'*'.repeat(6)}`;
|
|
30
|
+
const auth = { url: normalizeUrl(url), apiKey, version, apikey: hiddenKey };
|
|
26
31
|
Object.defineProperty(auth, 'apiKey', { enumerable: false });
|
|
27
32
|
const element = { auth, params: {} };
|
|
28
33
|
return new Proxy(element, gateProxy);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
2
|
export default (object) => {
|
|
3
3
|
object.gate = { method: 'get', node: '/products/sizes' };
|
|
4
|
-
object.custom = {
|
|
5
|
-
page: (page = 0, limit = null) => ({ "result::page": page, "result::pageNumber": limit ?? 100 })
|
|
6
|
-
};
|
|
7
4
|
return new Proxy(object, paramsProxy);
|
|
8
5
|
};
|
package/dist/reqparams.d.ts
CHANGED
|
@@ -2691,7 +2691,7 @@ export type PutProductsAttachmentsParams = {
|
|
|
2691
2691
|
/** @description Attachment document types list. */
|
|
2692
2692
|
documentTypes?: {
|
|
2693
2693
|
/** @description Document type. */
|
|
2694
|
-
documentType?: "energy_label" | "instruction_with_safety_information" | "user_manual" | "installation_instructions" | "product_card" | "guide" | "software_data_processing" | "hardware_data_processing" | "others";
|
|
2694
|
+
documentType?: "energy_label" | "instruction_with_safety_information" | "user_manual" | "installation_instructions" | "product_card" | "guide" | "software_data_processing" | "hardware_data_processing" | "image_of_packaging" | "label_of_packaging" | "declaration_of_conformity" | "image_of_ukca_ce_mark" | "others";
|
|
2695
2695
|
/** @description Additional description. */
|
|
2696
2696
|
description?: string;
|
|
2697
2697
|
}[];
|
|
@@ -7260,4 +7260,51 @@ export type GetWmsLocationsParams = {
|
|
|
7260
7260
|
resultsLimit?: number;
|
|
7261
7261
|
};
|
|
7262
7262
|
|
|
7263
|
+
export type GetReturnsParams = {
|
|
7264
|
+
/** @description Search by the order serial number to which a return was added. */
|
|
7265
|
+
order_sn?: number;
|
|
7266
|
+
/** @description Search by return ID. */
|
|
7267
|
+
return_id?: number;
|
|
7268
|
+
/** @description Search by a return shipment number from a customer to the shop . */
|
|
7269
|
+
return_shipping_number?: string;
|
|
7270
|
+
/** @description Date range. */
|
|
7271
|
+
range?: {
|
|
7272
|
+
/** @description Data for date range. */
|
|
7273
|
+
date?: {
|
|
7274
|
+
/** @description Beginning date in YYYY-MM-DD format. */
|
|
7275
|
+
date_begin?: string;
|
|
7276
|
+
/** @description Ending date in YYYY-MM-DD format. */
|
|
7277
|
+
date_end?: string;
|
|
7278
|
+
/** */
|
|
7279
|
+
dates_type?: "date_add" | "date_end";
|
|
7280
|
+
};
|
|
7281
|
+
};
|
|
7282
|
+
/** @description Number of results on page. */
|
|
7283
|
+
results_limit?: number;
|
|
7284
|
+
/** @description Result page number. */
|
|
7285
|
+
results_page?: number;
|
|
7286
|
+
/** @description 1 - Return not handled, 2 - Return accepted, 3 - Return not accepted, 13 - Return canceled by the customer, 14 - Return canceled, 15 - Resend the order, 16 - Abort resending order, 17 - A customer generated a return - it will be delivered personally, 18 - A customer generated a return - it will be sent by the customer. */
|
|
7287
|
+
status?: number;
|
|
7288
|
+
/** @description Search by return ID. */
|
|
7289
|
+
return_ids?: number[];
|
|
7290
|
+
/** @description Search by ID of a stock to which a return is sent. */
|
|
7291
|
+
stock_id?: number;
|
|
7292
|
+
/** @description Return a set as its constituent products */
|
|
7293
|
+
bundleAsProducts?: boolean;
|
|
7294
|
+
/** @description Search by ID of a shop to which a return is sent. */
|
|
7295
|
+
shop_ids?: number[];
|
|
7296
|
+
};
|
|
7297
|
+
|
|
7298
|
+
export type DeletePackagesParams = {
|
|
7299
|
+
/** @description Parcels's ID */
|
|
7300
|
+
packageId: number;
|
|
7301
|
+
};
|
|
7302
|
+
|
|
7303
|
+
export type GetEntriesParams = {
|
|
7304
|
+
/** @description Entry ID */
|
|
7305
|
+
entryId: number;
|
|
7306
|
+
/** @description Language ID */
|
|
7307
|
+
langId: LangId;
|
|
7308
|
+
};
|
|
7309
|
+
|
|
7263
7310
|
export { };
|
package/dist/request.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import { page } from "./helpers.js";
|
|
3
2
|
import { IdosellFaultStringError } from "./errors.js";
|
|
3
|
+
import utils from "./utils.js";
|
|
4
4
|
const DECODE_TABLE = [
|
|
5
5
|
['Å\x82', "ł"],
|
|
6
6
|
['Ä\x99', 'ę']
|
|
@@ -40,6 +40,26 @@ const catchIdosellError = (err) => {
|
|
|
40
40
|
}
|
|
41
41
|
throw new Error(`${err.response.status}: ${message}`, { cause: err.response.status });
|
|
42
42
|
};
|
|
43
|
+
function deepEqual(obj1, obj2) {
|
|
44
|
+
if (obj1 === obj2)
|
|
45
|
+
return true;
|
|
46
|
+
if (obj1 && obj2 && typeof obj1 === 'object' && typeof obj2 === 'object') {
|
|
47
|
+
const keys1 = Object.keys(obj1);
|
|
48
|
+
const keys2 = Object.keys(obj2);
|
|
49
|
+
if (keys1.length !== keys2.length)
|
|
50
|
+
return false;
|
|
51
|
+
for (let i = 0; i < keys1.length; i++) {
|
|
52
|
+
const key = keys1[i];
|
|
53
|
+
// If B doesn't have the key, or the values aren't deeply equal, fail early
|
|
54
|
+
if (!Object.prototype.hasOwnProperty.call(obj2, key) || !deepEqual(obj1[key], obj2[key])) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
// Handles cases where one is an object and the other is a primitive
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
43
63
|
const checkNext = (request, response, logPage) => {
|
|
44
64
|
if (logPage === true)
|
|
45
65
|
logPage = DEFAULT_LOG_FUNCTION;
|
|
@@ -52,29 +72,24 @@ const checkNext = (request, response, logPage) => {
|
|
|
52
72
|
};
|
|
53
73
|
throw new IdosellFaultStringError(response.errors.faultString, faultStructure);
|
|
54
74
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
75
|
+
const pagination = utils.getPagination(response);
|
|
76
|
+
if (pagination) {
|
|
77
|
+
const nextPage = pagination.currentPage + 1;
|
|
78
|
+
request.next = nextPage < pagination.totalPages;
|
|
79
|
+
if (request.prev) {
|
|
80
|
+
const deq = deepEqual(request.prev, request.params);
|
|
81
|
+
if (deq)
|
|
82
|
+
throw new Error("Infinite loop detected - reevaluate your request");
|
|
83
|
+
}
|
|
84
|
+
request.prev = { ...request.params };
|
|
58
85
|
if (typeof logPage === 'function') {
|
|
59
|
-
logPage('Page: ' + currentPage + ' / ' + totalPages);
|
|
86
|
+
logPage('Page: ' + pagination.currentPage + ' / ' + pagination.totalPages);
|
|
60
87
|
}
|
|
61
88
|
if (request.custom && request.custom.page) {
|
|
62
|
-
const pageObj = request.custom.page(nextPage, limit);
|
|
89
|
+
const pageObj = request.custom.page(nextPage, pagination.limit);
|
|
63
90
|
Object.assign(request.params, pageObj);
|
|
64
91
|
}
|
|
65
92
|
}
|
|
66
|
-
if (response.resultsNumberPage) {
|
|
67
|
-
handlePagination(response.resultsPage, response.resultsNumberPage, response.resultsLimit, request);
|
|
68
|
-
}
|
|
69
|
-
else if (response.results_number_page) {
|
|
70
|
-
handlePagination(response.results_page, response.results_number_page, response.results_limit, request);
|
|
71
|
-
}
|
|
72
|
-
else if (response.pagination) {
|
|
73
|
-
handlePagination(response.pagination.resultsPage, response.pagination.resultsNumberPage, response.pagination.resultsLimit, request);
|
|
74
|
-
}
|
|
75
|
-
else if (response.data?.pagination) {
|
|
76
|
-
handlePagination(response.data.pagination.resultsPage, response.data.pagination.resultsNumberPage, response.data.pagination.resultsLimit, request);
|
|
77
|
-
}
|
|
78
93
|
return response;
|
|
79
94
|
};
|
|
80
95
|
export const queryfy = (params) => {
|
|
@@ -165,9 +180,28 @@ export const sendRequest = async (request, options = {}) => {
|
|
|
165
180
|
if (!options.skipCheck)
|
|
166
181
|
processRequired(request);
|
|
167
182
|
const headers = {
|
|
168
|
-
'X-API-KEY': request.auth.apiKey,
|
|
169
183
|
Accept: 'application/json'
|
|
170
184
|
};
|
|
185
|
+
if (typeof request.auth.apiKey === 'string') {
|
|
186
|
+
headers['X-API-KEY'] = request.auth.apiKey;
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
const { login, password, scope } = request.auth.apiKey;
|
|
190
|
+
let token = request.auth.apiKey.token;
|
|
191
|
+
if (!token) {
|
|
192
|
+
const base64 = Buffer.from(`${login}:${password}`).toString('base64');
|
|
193
|
+
const response = await axios.post(`${request.auth.url}/api/authorize/1/authorize/accessToken`, { scope: scope ?? ['admin'] }, {
|
|
194
|
+
headers: {
|
|
195
|
+
authorization: `Basic ${base64}`,
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
if (response.data.access_token) {
|
|
199
|
+
token = response.data.access_token;
|
|
200
|
+
request.auth.apiKey.token = response.data.access_token;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
headers.authorization = `Bearer ${token}`;
|
|
204
|
+
}
|
|
171
205
|
request.next = false;
|
|
172
206
|
const { method, node } = request.gate;
|
|
173
207
|
let url = `${request.auth.url}/api/admin/v${request.auth.version}${node}`;
|
|
@@ -205,17 +239,17 @@ export const sendRequest = async (request, options = {}) => {
|
|
|
205
239
|
}
|
|
206
240
|
};
|
|
207
241
|
export const countResults = async (request, options) => {
|
|
208
|
-
|
|
242
|
+
if (!request.custom?.page)
|
|
243
|
+
throw new Error("This request is not countable");
|
|
244
|
+
const pageData = request.custom.page(0, 1);
|
|
209
245
|
Object.assign(request.params, pageData);
|
|
210
246
|
const response = await sendRequest(request, options);
|
|
211
247
|
if (!response)
|
|
212
248
|
return 0;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
else
|
|
218
|
-
return response.resultsNumberAll;
|
|
249
|
+
const pagination = utils.getPagination(response);
|
|
250
|
+
if (pagination)
|
|
251
|
+
return pagination.totalPages;
|
|
252
|
+
return 0;
|
|
219
253
|
};
|
|
220
254
|
export const getParams = (request) => JSON.parse(JSON.stringify(request.params));
|
|
221
255
|
export const checkParams = (request) => {
|
package/dist/responses.d.ts
CHANGED
|
@@ -1436,6 +1436,12 @@ export type GetEntriesResponse = {
|
|
|
1436
1436
|
titleLinkType: string;
|
|
1437
1437
|
/** @description Provided URL (for link to specified URL option) */
|
|
1438
1438
|
link: string;
|
|
1439
|
+
/** @description Meta title of the entry */
|
|
1440
|
+
metaTitle: string;
|
|
1441
|
+
/** @description Meta description of the entry */
|
|
1442
|
+
metaDescription: string;
|
|
1443
|
+
/** @description Meta keywords of the entry */
|
|
1444
|
+
metaKeywords: string;
|
|
1439
1445
|
};
|
|
1440
1446
|
};
|
|
1441
1447
|
};
|
|
@@ -2002,7 +2008,7 @@ export type GetOrdersPackagesResponse = {
|
|
|
2002
2008
|
/** @description Type */
|
|
2003
2009
|
type: "radio" | "text" | "select" | "checkbox";
|
|
2004
2010
|
/** @description Default value for option */
|
|
2005
|
-
defaultValue: string;
|
|
2011
|
+
defaultValue: string | string[];
|
|
2006
2012
|
/** @description Available values for the options */
|
|
2007
2013
|
options?: {
|
|
2008
2014
|
/** @description Id */
|
|
@@ -2910,7 +2916,7 @@ export type PutProductsAttachmentsResponse = {
|
|
|
2910
2916
|
/** @description Attachment document types list. */
|
|
2911
2917
|
documentTypes?: {
|
|
2912
2918
|
/** @description Document type. */
|
|
2913
|
-
documentType?: "energy_label" | "instruction_with_safety_information" | "user_manual" | "installation_instructions" | "product_card" | "guide" | "others";
|
|
2919
|
+
documentType?: "energy_label" | "instruction_with_safety_information" | "user_manual" | "installation_instructions" | "product_card" | "guide" | "software_data_processing" | "hardware_data_processing" | "image_of_packaging" | "label_of_packaging" | "declaration_of_conformity" | "image_of_ukca_ce_mark" | "others";
|
|
2914
2920
|
/** @description Additional description. */
|
|
2915
2921
|
description?: string;
|
|
2916
2922
|
}[];
|
|
@@ -7190,6 +7196,45 @@ export type GetSystemShopsDataResponse = {
|
|
|
7190
7196
|
}[];
|
|
7191
7197
|
/** @description Monitoring address protocol from the main Printer window. */
|
|
7192
7198
|
typeOfPrinterProtocolAdress: string;
|
|
7199
|
+
/** @description List of inherited settings. */
|
|
7200
|
+
shop_inherit_settings: {
|
|
7201
|
+
/** @description Shop ID */
|
|
7202
|
+
shop_id: number;
|
|
7203
|
+
/** @description Determines whether inheritance is active. */
|
|
7204
|
+
shop_inherit_on: "y" | "n" | null;
|
|
7205
|
+
/** @description Shop ID from which the settings are inherited. */
|
|
7206
|
+
shop_inherit_from?: number;
|
|
7207
|
+
/** @description Determines whether inheritance in enabled for offers. */
|
|
7208
|
+
shop_inherit_offer?: "y" | "n";
|
|
7209
|
+
/** @description Determines whether inheritance in enabled for navigation descriptions. */
|
|
7210
|
+
shop_inherit_navdescs?: "y" | "n";
|
|
7211
|
+
/** @description Determines whether inheritance in enabled for configuration. */
|
|
7212
|
+
shop_inherit_config?: "y" | "n";
|
|
7213
|
+
/** @description Determines whether inheritance in enabled for country and locale settings. */
|
|
7214
|
+
shop_inherit_country?: "y" | "n";
|
|
7215
|
+
/** @description Determines whether inheritance in enabled for banners. */
|
|
7216
|
+
shop_inherit_banners?: "y" | "n";
|
|
7217
|
+
/** @description Determines whether inheritance in enabled for HTML and JS snippets. */
|
|
7218
|
+
shop_inherit_snippets?: "y" | "n";
|
|
7219
|
+
/** @description Determines whether inheritance in enabled for toplayer settings. */
|
|
7220
|
+
shop_inherit_toplayers?: "y" | "n";
|
|
7221
|
+
/** @description Determines whether inheritance in enabled for site masks. */
|
|
7222
|
+
shop_inherit_masks?: "y" | "n";
|
|
7223
|
+
/** @description Determines whether inheritance in enabled for CMS pages. */
|
|
7224
|
+
shop_inherit_cms?: "y" | "n";
|
|
7225
|
+
/** @description Determines whether inheritance in enabled for CPA programs. */
|
|
7226
|
+
shop_inherit_cpa?: "y" | "n";
|
|
7227
|
+
/** @description Determines whether inheritance in enabled for affiliate programs. */
|
|
7228
|
+
shop_inherit_affiliate?: "y" | "n";
|
|
7229
|
+
/** @description Determines whether inheritance in enabled for rebate programs. */
|
|
7230
|
+
shop_inherit_rebates?: "y" | "n";
|
|
7231
|
+
/** @description Determines whether inheritance in enabled for prices. */
|
|
7232
|
+
shop_inherit_prices?: "y" | "n";
|
|
7233
|
+
/** @description Determines whether inheritance in enabled for sale and shipment documents. */
|
|
7234
|
+
shop_inherit_invoices?: "y" | "n";
|
|
7235
|
+
/** @description Determines whether inheritance in enabled for process automation. */
|
|
7236
|
+
shop_inherit_automats?: "y" | "n";
|
|
7237
|
+
}[];
|
|
7193
7238
|
};
|
|
7194
7239
|
|
|
7195
7240
|
export type GetSystemUnitsResponse = {
|
|
@@ -9610,4 +9655,9 @@ export type GetProductsAttachmentsGetContentResponse = {
|
|
|
9610
9655
|
}[];
|
|
9611
9656
|
};
|
|
9612
9657
|
|
|
9658
|
+
export type DeletePackagesResponse = {
|
|
9659
|
+
/** @description request status */
|
|
9660
|
+
result: string;
|
|
9661
|
+
};
|
|
9662
|
+
|
|
9613
9663
|
export { };
|
package/dist/utils.d.ts
CHANGED
|
@@ -21,6 +21,13 @@ type MappedParameter = {
|
|
|
21
21
|
values: MappedParameterValue[];
|
|
22
22
|
};
|
|
23
23
|
type MapProductParametersFunction = (_product: IdosellProduct, _langId?: string) => MappedParameter[];
|
|
24
|
+
interface PaginationInfo {
|
|
25
|
+
currentPage: number;
|
|
26
|
+
totalPages: number;
|
|
27
|
+
totalRecords: number;
|
|
28
|
+
limit: number;
|
|
29
|
+
}
|
|
30
|
+
type GetPaginationFunction = (_response: any) => PaginationInfo | null;
|
|
24
31
|
declare const _default: {
|
|
25
32
|
/** @description The method allows you to build an IAI code from the product ID and size ID. */
|
|
26
33
|
getIaiCode: GetIaICodeFunction;
|
|
@@ -42,5 +49,9 @@ declare const _default: {
|
|
|
42
49
|
removeRmaAttachments: (rmaResponse: GetRmaResponse) => GetRmaResponse;
|
|
43
50
|
/** @description Maps product parameters to a simplified structure for a given language. Skips parameters with no values. */
|
|
44
51
|
mapProductParameters: MapProductParametersFunction;
|
|
52
|
+
/** @description ormalizes pagination data from inconsistent API response shapes (top-level vs. nested, camelCase vs. snake_case) into a single type */
|
|
53
|
+
getPagination: GetPaginationFunction;
|
|
54
|
+
/** @description Check if request has next page based on raw response */
|
|
55
|
+
hasNext: (response: any) => boolean | null;
|
|
45
56
|
};
|
|
46
57
|
export default _default;
|
package/dist/utils.js
CHANGED
|
@@ -286,6 +286,42 @@ const mapProductParameters = (product, langId = 'pol') => {
|
|
|
286
286
|
return acc;
|
|
287
287
|
}, []);
|
|
288
288
|
};
|
|
289
|
+
const getPagination = (response) => {
|
|
290
|
+
// 1. Check snake_case on the top-level response before checking candidates
|
|
291
|
+
if (response?.results_number_page !== undefined) {
|
|
292
|
+
return {
|
|
293
|
+
currentPage: response.results_page,
|
|
294
|
+
totalPages: response.results_number_page,
|
|
295
|
+
totalRecords: response.results_number_all,
|
|
296
|
+
limit: response.results_limit,
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
// 2. Define candidates including response.results
|
|
300
|
+
const candidates = [
|
|
301
|
+
response,
|
|
302
|
+
response?.pagination,
|
|
303
|
+
response?.data?.pagination,
|
|
304
|
+
response?.results,
|
|
305
|
+
];
|
|
306
|
+
// 3. Loop through candidates for camelCase options
|
|
307
|
+
for (const c of candidates) {
|
|
308
|
+
if (!c)
|
|
309
|
+
continue;
|
|
310
|
+
if (c.resultsNumberPage !== undefined) {
|
|
311
|
+
return {
|
|
312
|
+
currentPage: c.resultsPage,
|
|
313
|
+
totalPages: c.resultsNumberPage,
|
|
314
|
+
totalRecords: c.resultsNumberAll,
|
|
315
|
+
limit: c.resultsLimit,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return null;
|
|
320
|
+
};
|
|
321
|
+
const hasNext = (response) => {
|
|
322
|
+
const pagination = getPagination(response);
|
|
323
|
+
return pagination && (pagination.currentPage + 1 < pagination.totalPages);
|
|
324
|
+
};
|
|
289
325
|
export default {
|
|
290
326
|
/** @description The method allows you to build an IAI code from the product ID and size ID. */
|
|
291
327
|
getIaiCode,
|
|
@@ -307,4 +343,8 @@ export default {
|
|
|
307
343
|
removeRmaAttachments,
|
|
308
344
|
/** @description Maps product parameters to a simplified structure for a given language. Skips parameters with no values. */
|
|
309
345
|
mapProductParameters,
|
|
346
|
+
/** @description ormalizes pagination data from inconsistent API response shapes (top-level vs. nested, camelCase vs. snake_case) into a single type */
|
|
347
|
+
getPagination,
|
|
348
|
+
/** @description Check if request has next page based on raw response */
|
|
349
|
+
hasNext
|
|
310
350
|
};
|
package/package.json
CHANGED