idosell 0.4.30 → 0.4.32

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/dist/enums.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-unused-vars */
1
2
  var PRODUCTS_RETURN_ELEMENTS;
2
3
  (function (PRODUCTS_RETURN_ELEMENTS) {
3
4
  PRODUCTS_RETURN_ELEMENTS["LANG_DATA"] = "lang_data";
@@ -101,6 +102,11 @@ var PRODUCTS_RETURN_ELEMENTS;
101
102
  PRODUCTS_RETURN_ELEMENTS["DIMENSIONS"] = "dimensions";
102
103
  PRODUCTS_RETURN_ELEMENTS["RESPONSIBLE_PRODUCER_CODE"] = "responsibleProducerCode";
103
104
  PRODUCTS_RETURN_ELEMENTS["RESPONSIBLE_PERSON_CODE"] = "responsiblePersonCode";
105
+ PRODUCTS_RETURN_ELEMENTS["DEPOSIT_PRODUCT_ID"] = "depositProductId";
106
+ PRODUCTS_RETURN_ELEMENTS["DEPOSIT_TYPE"] = "depositType";
107
+ PRODUCTS_RETURN_ELEMENTS["DEPOSIT_COUNT"] = "depositCount";
108
+ PRODUCTS_RETURN_ELEMENTS["MIN_STOCK_LEVEL"] = "minStockLevel";
109
+ PRODUCTS_RETURN_ELEMENTS["PRODUCT_ATTACHMENTS"] = "productAttachments";
104
110
  })(PRODUCTS_RETURN_ELEMENTS || (PRODUCTS_RETURN_ELEMENTS = {}));
105
111
  var ORDER_STATUS;
106
112
  (function (ORDER_STATUS) {
@@ -403,7 +409,7 @@ var PRODUCE_SIZE_INDEX;
403
409
  PRODUCE_SIZE_INDEX["ID"] = "sizeId";
404
410
  PRODUCE_SIZE_INDEX["IAI_CODE"] = "iaiCode";
405
411
  })(PRODUCE_SIZE_INDEX || (PRODUCE_SIZE_INDEX = {}));
406
- export default {
412
+ const ENUMS = {
407
413
  PRODUCTS_RETURN_ELEMENTS,
408
414
  ORDER_STATUS,
409
415
  STOCK_DOCUMENT_TYPE,
@@ -415,3 +421,5 @@ export default {
415
421
  PRODUCT_SIZE_LOCATIONS,
416
422
  PRODUCE_SIZE_INDEX
417
423
  };
424
+ export { ENUMS };
425
+ export default ENUMS;
@@ -1,10 +1,12 @@
1
1
  /* eslint-disable @typescript-eslint/no-empty-object-type */
2
2
  import type { PagableGateway, AppendableGateway, Gateway, DateLike, JSObject, IdosellErrorFaultStructure } from "./app.d.ts"
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, 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, 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"
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, 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
- import * as ENUMS from "./enums";
5
+ import { ENUMS } from "./enums";
6
6
  import utils from "./utils";
7
7
 
8
+ type ProductReturnElement = `${ENUMS.PRODUCTS_RETURN_ELEMENTS}`;
9
+
8
10
  export class IdosellFaultStringError extends Error {
9
11
  cause: IdosellFaultStringError;
10
12
  constructor(message: string, cause: IdosellErrorFaultStructure);
@@ -3162,7 +3164,7 @@ export interface SearchProductsRequest extends PagableGateway<SearchProductsRequ
3162
3164
  /** Element determines which products should be returned by the gate. Undeleted products are returned by default. Available values: "active" - undeleted products, "deleted" - deleted products. "in_trash" - products in the trash. */
3163
3165
  returnProducts: (value: "active" | "deleted" | "in_trash") => this;
3164
3166
  /** Elements to be returned by the endpoint. By default all elements are returned Available values: * lang_data * adding_time, * deleted, * code, * note, * taxcode, * inwrapper, * sellby_retail, * sellby_wholesale, * producer_id, * producer_name, * iaiCategoryId, * iaiCategoryName, * iaiCategoryPath, * category_id, * category_name, * size_group_id, * modification_time, * currency, * currency_shop, * bestseller, * new_product, * retail_price, * wholesale_price, * minimal_price, * automatic_calculation_price, * pos_price, * strikethrough_retail_price, * strikethrough_wholesale_price, * last_purchase_price, * purchase_price_net_average, * purchase_price_net_last, * purchase_price_gross_average, * purchase_price_gross_last, * vat, * vat_free, * rebate, * hotspots_zones, * profit_points, * points, * weight, * export_to_pricecomparers, * export_to_amazon_marketplace, * enable_in_pos, * complex_notes, * available_profile, * traits, * parameters, * version_data, * advance, * promotion, * discount, * distinguished, * special, * visible, * persistent, * priority, * shops_mask, * icon, * icon_for_auctions, * icon_for_group, * pictures, * unit, * warranty, * series, * products_associated, * shops, * quantities, * sizes_attributes, * shops_attributes, * auction_prices, * price_comparers_prices, * deliverer, * sizes, * size_group_name, * pictures_count, * product_type, * price_changed_time, * quantity_changed_time, * deliverer_name, * available_profile_name, * availability_management_type, * sum_in_basket, * menu, * auction_settings, * bundle, * sizeschart_id, * sizeschart_name, * serialnumbers, * producer_codes_standard, * javaScriptInTheItemCard, * productAuctionDescriptionsData, * priceFormula, * productIndividualDescriptionsData, * productIndividualUrlsData, * productServicesDescriptionsData, * cnTaricCode, * productIsGratis, * dimensions, * responsibleProducerCode, * responsiblePersonCode, * dimensions, * depositProductId, * depositType, * depositCount, * minStockLevel, * productAttachments */
3165
- returnElements: (value: string|string[]) => this;
3167
+ returnElements: (value: ProductReturnElement|ProductReturnElement[]) => this;
3166
3168
  /** Product availability. Available values: "y" - available, "n" - unavailable. */
3167
3169
  productIsAvailable: (value: "y" | "n") => this;
3168
3170
  /** Product visibility in store Available values: "y" - Visible, "n" - Invisible. */
@@ -3770,7 +3772,7 @@ export interface SearchPromotionsListViewRequest extends PagableGateway<SearchPr
3770
3772
  /** Promotion statuses */
3771
3773
  statuses: (value: 'waiting'|'active'|'closed'|Array<'waiting'|'active'|'closed'>) => this;
3772
3774
  /** Date range */
3773
- dateRange: (value: RequestParams.SearchPromotionsListViewParams["dateRange"]) => this;
3775
+ dateRange: (value: RequestParams.DateRangeParam) => this;
3774
3776
  /** Array of products in promotion */
3775
3777
  productsNotInPromotion: (value: number|string|number[]|string[]) => this;
3776
3778
  /** Define ordering of records */
@@ -3799,7 +3801,7 @@ export interface SearchPromotionsArchiveRequest extends PagableGateway<SearchPro
3799
3801
  orderBy: (value: RequestParams.SearchPromotionsArchiveParams["orderBy"]) => this;
3800
3802
  /** Shops IDs */
3801
3803
  shops: (value: number|string|number[]|string[]) => this;
3802
- archivedDate: (value: RequestParams.SearchPromotionsArchiveParams["archivedDate"]) => this;
3804
+ archivedDate: (value: RequestParams.DateRangeParam) => this;
3803
3805
  /** Define ordering of records */
3804
3806
  orderByProperty: (elementName: "id"|"shop_mask"|"archived_date", descending?: boolean) => this;
3805
3807
  }
@@ -3915,7 +3917,7 @@ export interface PutRefundsUpdateRefundRequest extends Gateway {
3915
3917
  refundCurrency: (value: string) => this;
3916
3918
  }
3917
3919
 
3918
- export interface GetRegulationsHistoryRequest extends Gateway {
3920
+ export interface GetRegulationsHistoryRequest extends PagableGateway<GetRegulationsHistoryRequest, GetRegulationsHistoryResponse> {
3919
3921
  /** Type of history */
3920
3922
  type: (value: string) => this;
3921
3923
  /** Shop's ID */
package/dist/helpers.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const getStandardizedDate = (dateValue) => {
2
- if (!dateValue)
2
+ if (typeof dateValue === 'undefined')
3
3
  return new Date();
4
4
  if (typeof dateValue === 'string' && dateValue.length === 10) {
5
5
  dateValue += ' 00:00:00';
@@ -3,7 +3,7 @@ import { page } from "../helpers.js";
3
3
  export default (object) => {
4
4
  object.gate = { method: 'get', node: '/products/brands' };
5
5
  object.custom = {
6
- page
6
+ page: (pageIndex, limit) => page(pageIndex, limit, true)
7
7
  };
8
8
  object.snakeCase = true;
9
9
  return new Proxy(object, paramsProxy);
@@ -3,7 +3,7 @@ import { page } from "../helpers.js";
3
3
  export default (object) => {
4
4
  object.gate = { method: 'get', node: '/products/categories' };
5
5
  object.custom = {
6
- page
6
+ page: (pageIndex, limit) => page(pageIndex, limit, true)
7
7
  };
8
8
  object.snakeCase = true;
9
9
  return new Proxy(object, paramsProxy);
@@ -1,5 +1,10 @@
1
1
  import { paramsProxy } from "../params.js";
2
+ import { page } from "../helpers.js";
2
3
  export default (object) => {
3
4
  object.gate = { method: 'get', node: '/regulations/history' };
5
+ object.custom = {
6
+ page
7
+ };
8
+ object.req = ["langId"];
4
9
  return new Proxy(object, paramsProxy);
5
10
  };
@@ -4,7 +4,7 @@ export default (object) => {
4
4
  object.gate = { method: 'get', node: '/returns/returns' };
5
5
  object.custom = {
6
6
  dates: dateRangeType({ "nodeName": "range", "fromName": "date][date_begin", "toName": "date][date_end", "typeName": "date][dates_type", "defaultType": "date_add" }),
7
- page
7
+ page: (pageIndex, limit) => page(pageIndex, limit, true)
8
8
  };
9
9
  object.snakeCase = true;
10
10
  object.req = [{ "any": true }];
@@ -3,7 +3,7 @@ import { page } from "../helpers.js";
3
3
  export default (object) => {
4
4
  object.gate = { method: 'get', node: '/warranties/warranties' };
5
5
  object.custom = {
6
- page
6
+ page: (pageIndex, limit) => page(pageIndex, limit, true)
7
7
  };
8
8
  object.snakeCase = true;
9
9
  return new Proxy(object, paramsProxy);
@@ -3,7 +3,7 @@ import { page } from "../helpers.js";
3
3
  export default (object) => {
4
4
  object.gate = { method: 'get', node: '/wms/stocksdocuments/products' };
5
5
  object.custom = {
6
- page
6
+ page: (pageIndex, limit) => page(pageIndex, limit, true)
7
7
  };
8
8
  object.snakeCase = true;
9
9
  object.req = ["type", "id"];
@@ -4,7 +4,7 @@ export default (object) => {
4
4
  object.gate = { method: 'post', node: '/clients/newsletter/email/search' };
5
5
  object.custom = {
6
6
  dates: dateRange({ "nodeName": "date", "fromName": "from", "toName": "to" }),
7
- page
7
+ page: (pageIndex, limit) => page(pageIndex, limit, true)
8
8
  };
9
9
  object.snakeCase = true;
10
10
  object.arrays = ["shops", "return_elements"];
@@ -4,7 +4,7 @@ export default (object) => {
4
4
  object.gate = { method: 'post', node: '/clients/newsletter/sms/search' };
5
5
  object.custom = {
6
6
  dates: dateRange({ "nodeName": "date", "fromName": "from", "toName": "to" }),
7
- page
7
+ page: (pageIndex, limit) => page(pageIndex, limit, true)
8
8
  };
9
9
  object.snakeCase = true;
10
10
  object.arrays = ["shops", "return_elements"];
@@ -7067,7 +7067,7 @@ type PaginationParam = {
7067
7067
  perPage?: number;
7068
7068
  };
7069
7069
 
7070
- type DateRangeParam = {
7070
+ export type DateRangeParam = {
7071
7071
  /** Format: date
7072
7072
  * @description Date "from" (RFC) */
7073
7073
  from?: string | null;
package/dist/request.js CHANGED
@@ -52,29 +52,28 @@ const checkNext = (request, response, logPage) => {
52
52
  };
53
53
  throw new IdosellFaultStringError(response.errors.faultString, faultStructure);
54
54
  }
55
- function handlePagination(currentPage, totalPages, request, paramsUpdate) {
56
- request.next = currentPage + 1 < totalPages;
57
- if (paramsUpdate)
58
- Object.assign(request.params, paramsUpdate);
55
+ function handlePagination(currentPage, totalPages, limit, request) {
56
+ const nextPage = currentPage + 1;
57
+ request.next = nextPage < totalPages;
59
58
  if (typeof logPage === 'function') {
60
59
  logPage('Page: ' + currentPage + ' / ' + totalPages);
61
60
  }
61
+ if (request.custom && request.custom.page) {
62
+ const pageObj = request.custom.page(nextPage, limit);
63
+ Object.assign(request.params, pageObj);
64
+ }
62
65
  }
63
66
  if (response.resultsNumberPage) {
64
- handlePagination(response.resultsPage, response.resultsNumberPage, request, { resultsPage: response.resultsPage + 1 });
67
+ handlePagination(response.resultsPage, response.resultsNumberPage, response.resultsLimit, request);
65
68
  }
66
69
  else if (response.results_number_page) {
67
- handlePagination(response.results_page, response.results_number_page, request, { results_page: response.results_page + 1 });
70
+ handlePagination(response.results_page, response.results_number_page, response.results_limit, request);
68
71
  }
69
72
  else if (response.pagination) {
70
- request.params.pagination.page = response.pagination.resultsPage + 1;
71
- handlePagination(response.pagination.resultsPage, response.pagination.resultsNumberPage, request);
73
+ handlePagination(response.pagination.resultsPage, response.pagination.resultsNumberPage, response.pagination.resultsLimit, request);
72
74
  }
73
75
  else if (response.data?.pagination) {
74
- if (!request.params.pagination)
75
- request.params.pagination = {};
76
- request.params.pagination.page = response.data.pagination.resultsPage + 1;
77
- handlePagination(response.data.pagination.resultsPage, response.data.pagination.resultsNumberPage, request);
76
+ handlePagination(response.data.pagination.resultsPage, response.data.pagination.resultsNumberPage, response.data.pagination.resultsLimit, request);
78
77
  }
79
78
  return response;
80
79
  };
@@ -3492,10 +3492,10 @@ export type PutProductsMarketingZonesResponse = {
3492
3492
 
3493
3493
  export type GetProductsOmnibusPricesResponse = {
3494
3494
  /** @description Products list. */
3495
- products: never[] | Record<string, {
3495
+ products: {
3496
3496
  /** @description Product ID */
3497
3497
  productId: number;
3498
- shops: never[] | Record<string, {
3498
+ shops: {
3499
3499
  /** @description Shop Id */
3500
3500
  shop_id: number;
3501
3501
  /** @description Lowest retail price before active promotion (gross). */
@@ -3505,7 +3505,7 @@ export type GetProductsOmnibusPricesResponse = {
3505
3505
  /** @description How to manage the lowest price before promotion. */
3506
3506
  omnibusPriceManagement: "automatic" | "manual";
3507
3507
  /** @description List of sizes */
3508
- sizes: never[] | Record<string, {
3508
+ sizes: {
3509
3509
  /** @description Identifier type. */
3510
3510
  ident: {
3511
3511
  /** */
@@ -3518,9 +3518,12 @@ export type GetProductsOmnibusPricesResponse = {
3518
3518
  /** @description Lowest wholesale price before active promotion (gross). */
3519
3519
  omnibusPriceWholesale: number;
3520
3520
  /** @description How to manage the lowest price before promotion. */
3521
- omnibusPriceManagement: "automatic" | "manual"}>}>;
3521
+ omnibusPriceManagement: "automatic" | "manual";
3522
+ }[];
3523
+ }[];
3522
3524
  /** @description Error information. */
3523
- error?: FaultCodeString}>;
3525
+ error?: FaultCodeString;
3526
+ }[];
3524
3527
  };
3525
3528
 
3526
3529
  export type GetProductsOpinionsRateResponse = {
@@ -9274,7 +9277,7 @@ export type GetRegulationsHistoryResponse = {
9274
9277
  /** @description User. */
9275
9278
  user: string;
9276
9279
  /** @description Change type. */
9277
- changeType: "auto" | "user";
9280
+ changeType: "" | "auto" | "user";
9278
9281
  /** @description Change source (y - auto, m - markdown editor, n - WYSIWYG/HTML editor). */
9279
9282
  isDefault: "y" | "m" | "n";
9280
9283
  /** @description Setting to check if revision was published in shop. */
@@ -9282,17 +9285,7 @@ export type GetRegulationsHistoryResponse = {
9282
9285
  /** @description 2-letter ISO country code. */
9283
9286
  country: string;
9284
9287
  }[];
9285
- pagination: {
9286
- /** @description Pagination settings. */
9287
- appliedFilter: {
9288
- /** @description Page index (starting from 0)
9289
- * @default 0 */
9290
- page: number;
9291
- /** @description Number of records per page.
9292
- * @default 100 */
9293
- perPage: number;
9294
- };
9295
- };
9288
+ pagination: PagedResponse;
9296
9289
  };
9297
9290
 
9298
9291
  export { };
package/dist/utils.d.ts CHANGED
@@ -1,41 +1,34 @@
1
- import type { PRODUCT_SIZE_COUNTABLE, PRODUCT_SIZE_LOCATIONS, PRODUCT_SIZE_CODES, PRODUCE_SIZE_INDEX } from "./enums.d";
2
- import type { SearchProductsResponse } from "./responses.d.ts"
3
-
4
- export type IdosellProduct = SearchProductsResponse['results'][0];
5
-
6
- export type GetIaICodeFunction = (productId: number|string, sizeId: string) => string;
7
-
8
- export type SumProductQuantitiesFunction = (productStocksData: IdosellProduct['productStocksData'], stockType?: PRODUCT_SIZE_COUNTABLE | `${PRODUCT_SIZE_COUNTABLE}`) => number;
9
-
10
- export type MapSizeQuantitesFunction = (product: IdosellProduct, stockType?: `${PRODUCT_SIZE_COUNTABLE}`, indexBy?: `${PRODUCE_SIZE_INDEX}`) => Record<string,number>;
11
-
12
- export type MapProductCodesFunction = (product: IdosellProduct, codeType?: `${PRODUCT_SIZE_CODES}`, indexBy?: `${PRODUCE_SIZE_INDEX}`) => Record<string,string>;
13
-
14
- export type MapProductAllCodesFunction = (product: IdosellProduct, indexBy?: `${PRODUCE_SIZE_INDEX}`) => Record<string,string[]>;
15
-
16
- export type MapProductLocationsFunction = (product: IdosellProduct, stockId?: number, codeType?: `${PRODUCT_SIZE_LOCATIONS}`, indexBy?: `${PRODUCE_SIZE_INDEX}`) => Record<string,string[]>;
17
-
18
- export type GetLangDataFunction = <T extends { langId: string}>(array: T[], langId?: string) => T|undefined;
19
-
20
- export type ClearParametersLangDataFunction = (products: SearchProductsResponse['results'], langId?: string) => SearchProductsResponse['results'];
21
-
22
- declare namespace utils {
23
- /** @description The method allows you to build an IAI code from the product ID and size ID. */
24
- const getIaiCode: GetIaICodeFunction;
25
- /** @description The method allows you to sum up the current stock levels: warehouses, available stocks, etc. */
26
- const sumProductQuantities: SumProductQuantitiesFunction;
27
- /** @description The method allows mapping the sum of the current stock levels (in warehouses, at disposal, etc.) divided into sizes */
28
- const mapSizeQuantites: MapSizeQuantitesFunction;
29
- /** @description The method allows mapping the producers's or external system's codes stored in the system to SKUs */
30
- const mapProductCodes: MapProductCodesFunction;
31
- /** @description The method allows mapping all known codes: IAI code, manufacturer code or external code as an array */
32
- const mapAllProductCodes: MapProductAllCodesFunction;
33
- /** @description This method allows you to map product locations stored in the system, broken down by size. You can select a specific warehouse or list all of them, both primary and secondary. */
34
- const mapProductLocations: MapProductLocationsFunction;
35
- /** @description Get first item (description, series, parameter name or value) with the selected langId */
36
- const getLangData: GetLangDataFunction;
37
- /** @description Modifies product response by removing all parameter names nad values that are not in selected langId */
38
- const clearParametersLangData: ClearParametersLangDataFunction;
39
- }
40
-
41
- export default utils;
1
+ import { ENUMS } from "./enums";
2
+ import type { SearchProductsResponse, GetRmaResponse } from "./responses.d.ts";
3
+ type IdosellProduct = SearchProductsResponse['results'][0];
4
+ type GetIaICodeFunction = (_productId: number | string, _sizeId: string) => string;
5
+ type SumProductQuantitiesFunction = (_productStocksData: IdosellProduct['productStocksData'], _stockType?: ENUMS.PRODUCT_SIZE_COUNTABLE | `${ENUMS.PRODUCT_SIZE_COUNTABLE}`) => number;
6
+ type MapSizeQuantitesFunction = (_product: IdosellProduct, _stockType?: `${ENUMS.PRODUCT_SIZE_COUNTABLE}`, _indexBy?: `${ENUMS.PRODUCE_SIZE_INDEX}`) => Record<string, number>;
7
+ type MapProductCodesFunction = (_product: IdosellProduct, _codeType?: `${ENUMS.PRODUCT_SIZE_CODES}`, _indexBy?: `${ENUMS.PRODUCE_SIZE_INDEX}`) => Record<string, string>;
8
+ type MapProductAllCodesFunction = (_product: IdosellProduct, _indexBy?: `${ENUMS.PRODUCE_SIZE_INDEX}`) => Record<string, string[]>;
9
+ type MapProductLocationsFunction = (_product: IdosellProduct, _stockId?: number, _codeType?: `${ENUMS.PRODUCT_SIZE_LOCATIONS}`, _indexBy?: `${ENUMS.PRODUCE_SIZE_INDEX}`) => Record<string, string[]>;
10
+ type GetLangDataFunction = <T extends {
11
+ langId: string;
12
+ }>(_array: T[], _langId?: string) => T | undefined;
13
+ type ClearParametersLangDataFunction = (_products: SearchProductsResponse['results'], _langId?: string) => SearchProductsResponse['results'];
14
+ declare const _default: {
15
+ /** @description The method allows you to build an IAI code from the product ID and size ID. */
16
+ getIaiCode: GetIaICodeFunction;
17
+ /** @description The method allows you to sum up the current stock levels: warehouses, available stocks, etc. */
18
+ sumProductQuantities: SumProductQuantitiesFunction;
19
+ /** @description The method allows mapping the sum of the current stock levels (in warehouses, at disposal, etc.) divided into sizes */
20
+ mapSizeQuantites: MapSizeQuantitesFunction;
21
+ /** @description The method allows mapping the producers's or external system's codes stored in the system to SKUs */
22
+ mapProductCodes: MapProductCodesFunction;
23
+ /** @description The method allows mapping all known codes: IAI code, manufacturer code or external code as an array */
24
+ mapAllProductCodes: MapProductAllCodesFunction;
25
+ /** @description This method allows you to map product locations stored in the system, broken down by size. You can select a specific warehouse or list all of them, both primary and secondary. */
26
+ mapProductLocations: MapProductLocationsFunction;
27
+ /** @description Get first item (description, series, parameter name or value) with the selected langId */
28
+ getLangData: GetLangDataFunction;
29
+ /** @description Modifies product response by removing all parameter names nad values that are not in selected langId */
30
+ clearParametersLangData: ClearParametersLangDataFunction;
31
+ /** @description Removes attachments to RMA that are returned by default, helps to reduce data if serialized or forwarded */
32
+ removeRmaAttachments: (rmaResponse: GetRmaResponse) => GetRmaResponse;
33
+ };
34
+ export default _default;
package/dist/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import ENUMS from "./enums.js";
1
+ import { ENUMS } from "./enums.js";
2
2
  const getIaiCode = (productId, sizeId) => {
3
3
  if (sizeId === 'uniw')
4
4
  return productId.toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idosell",
3
- "version": "0.4.30",
3
+ "version": "0.4.32",
4
4
  "description": "Idosell 3 REST connector",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/gateways.d.ts",
@@ -7,18 +7,15 @@ const INDEX = ENUMS.PRODUCE_SIZE_INDEX;
7
7
 
8
8
  test('Utils mapAllProductCodes by ID', () => {
9
9
  const codes = utils.mapAllProductCodes(STOCK_PRODUCT, INDEX.ID)
10
- console.log(JSON.stringify(codes));
11
10
  expect(codes).toEqual({"3":["1234-3","1234567890128","PX-ZERO-S"],"4":["1234-4","1234567890135","PX-ZERO-M"],"5":["1234-5","1234567890142","PX-ZERO-L"],"6":["1234-6","1234567890159","PX-ZERO-X"]});
12
11
  })
13
12
 
14
13
  test('Utils mapAllProductCodes by IAI code', () => {
15
14
  const codes = utils.mapAllProductCodes(STOCK_PRODUCT, INDEX.IAI_CODE)
16
- console.log(JSON.stringify(codes));
17
15
  expect(codes).toEqual({"1234-3":["1234-3","1234567890128","PX-ZERO-S"],"1234-4":["1234-4","1234567890135","PX-ZERO-M"],"1234-5":["1234-5","1234567890142","PX-ZERO-L"],"1234-6":["1234-6","1234567890159","PX-ZERO-X"]});
18
16
  })
19
17
 
20
18
  test('Utils mapAllProductCodes by name', () => {
21
19
  const codes = utils.mapAllProductCodes(STOCK_PRODUCT, INDEX.NAME)
22
- console.log(JSON.stringify(codes));
23
20
  expect(codes).toEqual({"S":["1234-3","1234567890128","PX-ZERO-S"],"M":["1234-4","1234567890135","PX-ZERO-M"],"L":["1234-5","1234567890142","PX-ZERO-L"],"XL":["1234-6","1234567890159","PX-ZERO-X"]});
24
21
  })