idosell 0.4.30 → 0.4.34
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 +14 -1
- package/dist/enums.d.ts +426 -404
- package/dist/enums.js +9 -1
- package/dist/gates.js +1 -1
- package/dist/gateways.d.ts +8 -6
- package/dist/helpers.js +1 -1
- package/dist/methods/getProductsBrands.js +1 -1
- package/dist/methods/getProductsCategories.js +1 -1
- package/dist/methods/getRegulationsHistory.js +5 -0
- package/dist/methods/getReturns.js +1 -1
- package/dist/methods/getWarranties.js +1 -1
- package/dist/methods/getWmsStocksdocumentsProducts.js +1 -1
- package/dist/methods/searchClientsNewsletterEmail.js +1 -1
- package/dist/methods/searchClientsNewsletterSms.js +1 -1
- package/dist/reqparams.d.ts +1 -1
- package/dist/request.js +12 -13
- package/dist/responses.d.ts +316 -28
- package/dist/utils.d.ts +34 -41
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/tests/utilMapAllProductCodes.test.js +0 -3
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
|
-
|
|
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;
|
package/dist/gates.js
CHANGED
package/dist/gateways.d.ts
CHANGED
|
@@ -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
|
|
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:
|
|
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.
|
|
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.
|
|
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
|
|
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
|
@@ -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"];
|
package/dist/reqparams.d.ts
CHANGED
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,
|
|
56
|
-
|
|
57
|
-
|
|
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,
|
|
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,
|
|
70
|
+
handlePagination(response.results_page, response.results_number_page, response.results_limit, request);
|
|
68
71
|
}
|
|
69
72
|
else if (response.pagination) {
|
|
70
|
-
|
|
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
|
-
|
|
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
|
};
|
|
@@ -118,7 +117,7 @@ const isMissingRequirement = (obj, required) => {
|
|
|
118
117
|
return false;
|
|
119
118
|
}
|
|
120
119
|
for (const field of required.any) {
|
|
121
|
-
if (obj[field])
|
|
120
|
+
if (obj[field] === undefined || obj[field] === null)
|
|
122
121
|
return false;
|
|
123
122
|
}
|
|
124
123
|
return required.any.join(' | ');
|