idosell 0.4.9 → 0.4.12
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 +2 -0
- package/changelog.md +11 -0
- package/dist/gateways.d.ts +14 -1
- package/dist/index.js +3 -2
- package/dist/reqparams.d.ts +14 -0
- package/dist/request.js +4 -1
- package/dist/responses.d.ts +1245 -21
- package/dist/utils.d.ts +29 -0
- package/dist/utils.js +96 -0
- package/package.json +1 -1
- package/tests/postPackagesLabels.test.js +10 -0
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This package wraps around the Idosell REST Api to make it easier to use by implementing chainable options, more intuitive methods and helpers to format requests more easily. [Official Idosell documentation](https://idosell.readme.io/docs) is still applicable for the most part.
|
|
4
4
|
|
|
5
|
+
Visit [This page](https://idosell-converter.vercel.app/) for more detailed usage and examples.
|
|
6
|
+
|
|
5
7
|
## Basic use
|
|
6
8
|
|
|
7
9
|
Package translates awkward gate names into more readable method names using REST verbs and gateways. Most of the possible methods are kept as is, only changed to camel case. For example:
|
package/changelog.md
CHANGED
|
@@ -5,6 +5,17 @@ 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.12] - 2025-10-15
|
|
9
|
+
### Changed
|
|
10
|
+
- Updated to v7.2
|
|
11
|
+
- Added utils
|
|
12
|
+
|
|
13
|
+
## [0.4.11] - 2025-09-26
|
|
14
|
+
### Changed
|
|
15
|
+
- Updated to v7
|
|
16
|
+
- Fixed few gates
|
|
17
|
+
- Improved typings
|
|
18
|
+
|
|
8
19
|
## [0.4.3] - 2025-08-28
|
|
9
20
|
### Changed
|
|
10
21
|
- Added type RequestParams for typescript support
|
package/dist/gateways.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { PagableGateway, AppendableGateway, Gateway, DateLike, JSObject } f
|
|
|
2
2
|
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, PutProductsAttachmentsResponse, GetProductsAuctionsResponse, GetProductsBrandsResponse, PutProductsBrandsResponse, GetProductsCategoriesResponse, PutProductsCategoriesResponse, SearchProductsCategoriesIdosellResponse, GetProductsCodeExistenceResponse, SearchProductsDeliveryTimeResponse, GetProductsDescriptionsResponse, ProductIdentResponse, PutProductsGroupsSettingsResponse, GetProductsIdBySizecodeResponse, PutProductsImagesResponse, GetProductsMarketingPromotionResponse, PostProductsMarketingPromotionResponse, PutProductsMarketingPromotionResponse, GetProductsMarketingZonesResponse, PutProductsMarketingZonesResponse, GetProductsOmnibusPricesResponse, GetProductsOpinionsResponse, PostProductsOpinionsResponse, GetProductsOpinionsRateResponse, PutProductsParametersResponse, SearchProductsParametersResponse, SearchProductsResponse, PostProductsResponse, PutProductsResponse, GetProductsQuestionsResponse, GetProductsReservationsResponse, GetProductsSeriesResponse, PutProductsSeriesResponse, GetProductsSizesResponse, PutProductsSizesResponse, PutProductsStockQuantityResponse, GetProductsStocksResponse, PutProductsStocksResponse, GetProductsStrikethroughPricesResponse, PutProductsSupplierCodeResponse, PutProductsSupplierProductDataResponse, 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 } from "./responses.d.ts"
|
|
3
3
|
import type * as RequestParams from "./reqparams.d.ts";
|
|
4
4
|
import * as ENUMS from "./enums";
|
|
5
|
+
import utils from "./utils";
|
|
5
6
|
|
|
6
7
|
export interface GetClientsBalanceRequest extends PagableGateway<GetClientsBalanceRequest, GetClientsBalanceResponse> {
|
|
7
8
|
/** Customer Id */
|
|
@@ -2945,6 +2946,12 @@ export interface PostProductsRequest extends AppendableGateway<PostProductsReque
|
|
|
2945
2946
|
responsibleProducerCode: (responsibleProducerCode: string) => this
|
|
2946
2947
|
/** Responsible person code */
|
|
2947
2948
|
responsiblePersonCode: (responsiblePersonCode: string) => this
|
|
2949
|
+
/** Deposit type */
|
|
2950
|
+
depositType: (depositType: number|string) => this
|
|
2951
|
+
/** Product deposit id */
|
|
2952
|
+
depositProductId: (depositProductId: number|string) => this
|
|
2953
|
+
/** Product deposit count */
|
|
2954
|
+
depositCount: (depositCount: number|string) => this
|
|
2948
2955
|
/** Set various types of names or descriptions to the product */
|
|
2949
2956
|
setText: (text: string, type?: "productName"|"productParamDescriptions"|"productLongDescription"|"productMetaTitle"|"productMetaDescription"|"productMetaKeyword"|"productAuctionName"|"productAuctionDescription"|"productAuctionAdditionalName"|"productNameInPriceComparer", language?: string, shopId?: number|string) => this;
|
|
2950
2957
|
/** Sets product price by amount */
|
|
@@ -3222,6 +3229,12 @@ export interface PutProductsRequest extends AppendableGateway<PutProductsRequest
|
|
|
3222
3229
|
responsibleProducerCode: (responsibleProducerCode: string) => this
|
|
3223
3230
|
/** Responsible person code */
|
|
3224
3231
|
responsiblePersonCode: (responsiblePersonCode: string) => this
|
|
3232
|
+
/** Deposit type */
|
|
3233
|
+
depositType: (depositType: number|string) => this
|
|
3234
|
+
/** Product deposit id */
|
|
3235
|
+
depositProductId: (depositProductId: number|string) => this
|
|
3236
|
+
/** Product deposit count */
|
|
3237
|
+
depositCount: (depositCount: number|string) => this
|
|
3225
3238
|
/** Set various types of names or descriptions to the product */
|
|
3226
3239
|
setText: (text: string, type?: "productName"|"productParamDescriptions"|"productLongDescription"|"productMetaTitle"|"productMetaDescription"|"productMetaKeyword"|"productAuctionName"|"productAuctionDescription"|"productAuctionAdditionalName"|"productNameInPriceComparer", language?: string, shopId?: number|string) => this;
|
|
3227
3240
|
/** Set edit mode - disables adding new product */
|
|
@@ -5190,4 +5203,4 @@ export interface Gateways {
|
|
|
5190
5203
|
|
|
5191
5204
|
declare const defaultExport: (url: string, apiKey: string, version?: number | string) => Gateways;
|
|
5192
5205
|
export default defaultExport;
|
|
5193
|
-
export { ENUMS, RequestParams }
|
|
5206
|
+
export { ENUMS, RequestParams, utils }
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ENUMS from "./enums.js";
|
|
2
|
+
import utils from "./utils.js";
|
|
2
3
|
import { gateProxy } from "./gates.js";
|
|
3
|
-
export const DEFAULT_VERSION =
|
|
4
|
+
export const DEFAULT_VERSION = 7;
|
|
4
5
|
const idosell = (url, apiKey, version = DEFAULT_VERSION) => {
|
|
5
6
|
const auth = { url, apiKey, version, apikey: apiKey ? apiKey.slice(0, 6) + '*'.repeat(20) : "" };
|
|
6
7
|
Object.defineProperty(auth, 'apiKey', { enumerable: false });
|
|
@@ -8,4 +9,4 @@ const idosell = (url, apiKey, version = DEFAULT_VERSION) => {
|
|
|
8
9
|
return new Proxy(element, gateProxy);
|
|
9
10
|
};
|
|
10
11
|
export default idosell;
|
|
11
|
-
export { ENUMS };
|
|
12
|
+
export { ENUMS, utils };
|
package/dist/reqparams.d.ts
CHANGED
|
@@ -758,6 +758,12 @@ export type PostProductsParams = {
|
|
|
758
758
|
responsibleProducerCode?: string;
|
|
759
759
|
/** @description Responsible person code */
|
|
760
760
|
responsiblePersonCode?: string;
|
|
761
|
+
/** @description Deposit type */
|
|
762
|
+
depositType?: number;
|
|
763
|
+
/** @description Product deposit id */
|
|
764
|
+
depositProductId?: number;
|
|
765
|
+
/** @description Product deposit count */
|
|
766
|
+
depositCount?: number;
|
|
761
767
|
}[];
|
|
762
768
|
};
|
|
763
769
|
|
|
@@ -2004,6 +2010,12 @@ export type PutProductsParams = {
|
|
|
2004
2010
|
responsibleProducerCode?: string;
|
|
2005
2011
|
/** @description Responsible person code */
|
|
2006
2012
|
responsiblePersonCode?: string;
|
|
2013
|
+
/** @description Deposit type */
|
|
2014
|
+
depositType?: number;
|
|
2015
|
+
/** @description Product deposit id */
|
|
2016
|
+
depositProductId?: number;
|
|
2017
|
+
/** @description Product deposit count */
|
|
2018
|
+
depositCount?: number;
|
|
2007
2019
|
}[];
|
|
2008
2020
|
};
|
|
2009
2021
|
|
|
@@ -2139,6 +2151,8 @@ export type PostCouriersPickupPointsParams = {
|
|
|
2139
2151
|
city?: string;
|
|
2140
2152
|
/** @description Administrative region (code in ISO 3166-2). */
|
|
2141
2153
|
provinceCode?: string;
|
|
2154
|
+
/** @description Country code (ISO 3166-1 alpha-2). */
|
|
2155
|
+
countryCode?: string;
|
|
2142
2156
|
};
|
|
2143
2157
|
/** @description Geographic coordinates. */
|
|
2144
2158
|
coordinates: {
|
package/dist/request.js
CHANGED
|
@@ -180,7 +180,10 @@ export const checkParams = (request) => {
|
|
|
180
180
|
const array = request.params[request.appendable.arrayNode];
|
|
181
181
|
const last = array[array.length - 1];
|
|
182
182
|
if (typeof last === 'object' && Object.keys(last).length === 0) {
|
|
183
|
-
array.
|
|
183
|
+
if (array.length === 1)
|
|
184
|
+
delete request.params[request.appendable.arrayNode];
|
|
185
|
+
else
|
|
186
|
+
array.pop();
|
|
184
187
|
}
|
|
185
188
|
}
|
|
186
189
|
processRequired(request);
|