idosell 0.2.2 → 0.2.4

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.
Files changed (45) hide show
  1. package/changelog.md +13 -0
  2. package/dist/gates.def.js +60 -44
  3. package/dist/index.js +3 -1
  4. package/dist/methods/getCpa.js +4 -0
  5. package/dist/methods/getCpaCampaign.js +4 -0
  6. package/dist/methods/getPackagesLabels.js +5 -0
  7. package/dist/methods/getResponsibilityEntities.js +4 -0
  8. package/dist/methods/getSnippets.js +4 -0
  9. package/dist/methods/getSnippetsCampaign.js +4 -0
  10. package/dist/methods/getSnippetsCookies.js +4 -0
  11. package/dist/methods/putProductsStrikethroughPrices.js +5 -0
  12. package/dist/params.js +8 -8
  13. package/dist/request.js +10 -1
  14. package/package.json +1 -1
  15. package/tests/getCpa.test.js +12 -0
  16. package/tests/getCpaCampaign.test.js +12 -0
  17. package/tests/getPackagesLabels.test.js +7 -0
  18. package/tests/getReturns.test.js +1 -1
  19. package/tests/putReturns.test.js +7 -0
  20. package/tests/searchClientsCrm.test.js +8 -8
  21. package/tests/searchClientsGiftcards.test.js +2 -2
  22. package/tests/searchClientsNewsletterEmail.test.js +4 -4
  23. package/tests/searchClientsNewsletterSms.test.js +6 -6
  24. package/tests/searchOrders.test.js +24 -24
  25. package/tests/searchOrdersUnfinished.test.js +12 -12
  26. package/tests/searchPackages.test.js +6 -6
  27. package/tests/searchProducts.test.js +32 -32
  28. package/tests/searchProductsCategoriesIdosell.test.js +2 -2
  29. package/tests/searchProductsDeliveryTime.test.js +6 -6
  30. package/tests/searchProductsParameters.test.js +6 -6
  31. package/tests/url.test.js +6 -0
  32. package/tests/getClientsCrm.test.js +0 -22
  33. package/tests/getClientsGiftcards.test.js +0 -7
  34. package/tests/getClientsNewsletterEmailSMS.test.js +0 -17
  35. package/tests/getClientsNewsletterEmailShops.test.js +0 -12
  36. package/tests/getOrdersOpinions.test.js +0 -32
  37. package/tests/getPackages.test.js +0 -17
  38. package/tests/getProductsCategoriesIdosell.test.js +0 -7
  39. package/tests/getProductsDeliveryTime.test.js +0 -17
  40. package/tests/getProductsParameters.test.js +0 -17
  41. package/tests/listOrders.test.js +0 -62
  42. package/tests/listOrdersUnfinished.test.js +0 -32
  43. package/tests/listProducts.test.js +0 -82
  44. package/tests/postResponsibilityEntities.test.js +0 -8
  45. package/tests/putResponsibilityEntities.test.js +0 -8
package/changelog.md CHANGED
@@ -5,6 +5,19 @@ 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.2.4] - 2025-03-27
9
+ ### Changed
10
+ - Fixed several gates definitions
11
+ - Added clone method
12
+ - Hidden custom atttributes from console.log
13
+ - Fixed params method for arrays of objects
14
+
15
+
16
+ ## [0.2.3] - 2025-03-26
17
+ ### Changed
18
+ - Changed definitions and tests according to new gates
19
+ - Added readable missing access error
20
+
8
21
 
9
22
  ## [0.2.2] - 2025-03-20
10
23
  ### Fixed
package/dist/gates.def.js CHANGED
@@ -22,8 +22,8 @@
22
22
  * @property {(currency: String) => PostClientsBalanceRequest} currency Currency of operation.
23
23
  * @property {(note: String) => PostClientsBalanceRequest} note Note.
24
24
  * @property {(prepaidId: Integer) => PostClientsBalanceRequest} prepaidId Order payment identifier.
25
- * @property {(balance: Number, currency: String) => PostClientsBalanceRequest} add Adds value to client balance
26
- * @property {(balance: Number, currency: String) => PostClientsBalanceRequest} remove Subtracts value to client balance
25
+ * @property {(balance: Number, currency: String) => postClientsBalanceRequest} add Adds value to client balance
26
+ * @property {(balance: Number, currency: String) => postClientsBalanceRequest} remove Subtracts value to client balance
27
27
  * @property {function} exec Excecute request
28
28
  */
29
29
 
@@ -280,9 +280,9 @@
280
280
  * @property {(shops: Array<Integer>) => PutClientsGiftcardsRequest} shops List of shops the card is active in
281
281
  * @property {(note: String) => PutClientsGiftcardsRequest} note
282
282
  * @property {function} append Append current data to array and start modifying next row
283
- * @property {(amount: Float, currency: String) => PutClientsGiftcardsRequest} add Adds balance to current gift card
284
- * @property {(amount: Float, currency: String) => PutClientsGiftcardsRequest} subtract Subtract from balance to current gift card
285
- * @property {(amount: Float, currency: String) => PutClientsGiftcardsRequest} set Set balance to current gift card
283
+ * @property {(amount: Float, currency: String) => putClientsGiftcardsRequest} add Adds balance to current gift card
284
+ * @property {(amount: Float, currency: String) => putClientsGiftcardsRequest} subtract Subtract from balance to current gift card
285
+ * @property {(amount: Float, currency: String) => putClientsGiftcardsRequest} set Set balance to current gift card
286
286
  * @property {function} exec Excecute request
287
287
  */
288
288
 
@@ -718,6 +718,8 @@
718
718
  * @property {(id: Array<Integer>) => GetCpaCampaignRequest} id List of identifiers
719
719
  * @property {(resultsPage: Integer) => GetCpaCampaignRequest} resultsPage Page with results number. Numeration starts from 0
720
720
  * @property {(resultsLimit: Integer) => GetCpaCampaignRequest} resultsLimit Number of results on page. Value from 1 to 100
721
+ * @property {(page: Integer, limit: Integer) => GetCpaCampaignRequest} page Define page number and maximum results per page
722
+ * @property {() => Integer} count Returns total numer of results
721
723
  * @property {function} exec Excecute request
722
724
  */
723
725
 
@@ -745,6 +747,8 @@
745
747
  * @property {(id: Array<Integer>) => GetCpaRequest} id List of identifiers
746
748
  * @property {(resultsPage: Integer) => GetCpaRequest} resultsPage Page with results number. Numeration starts from 0
747
749
  * @property {(resultsLimit: Integer) => GetCpaRequest} resultsLimit Number of results on page. Value from 1 to 100
750
+ * @property {(page: Integer, limit: Integer) => GetCpaRequest} page Define page number and maximum results per page
751
+ * @property {() => Integer} count Returns total numer of results
748
752
  * @property {function} exec Excecute request
749
753
  */
750
754
 
@@ -1359,11 +1363,11 @@
1359
1363
  * @property {(stockIds: Array<Integer>) => SearchOrdersRequest} stockIds Define stocks by passing array of values
1360
1364
  * @property {(campaignIds: Array<Integer>) => SearchOrdersRequest} campaignIds Define campaign by passing array of values
1361
1365
  * @property {(discountCodes: Array<String>) => SearchOrdersRequest} discountCodes Define campaign by passing array of values
1362
- * @property {(productId: Integer, sizeId: String|null) => searchProductsRequest} hasProduct Filter by product ID and optionally product size
1363
- * @property {(orderHasPackage: Boolean) => searchProductsRequest} hasPackage Filter by orders that have any package number
1364
- * @property {(accountName: String) => searchProductsRequest} fromAllegro Filter by orders from auction service Allegro
1365
- * @property {(accountName: String) => searchProductsRequest} fromEbay Filter by orders from action service EBay
1366
- * @property {(accountName: String) => searchProductsRequest} fromAmazon Filter by orders from action service Amazon
1366
+ * @property {(productId: Integer, sizeId: String|null) => searchOrdersRequest} hasProduct Filter by product ID and optionally product size
1367
+ * @property {(orderHasPackage: Boolean) => searchOrdersRequest} hasPackage Filter by orders that have any package number
1368
+ * @property {(accountName: String) => searchOrdersRequest} fromAllegro Filter by orders from auction service Allegro
1369
+ * @property {(accountName: String) => searchOrdersRequest} fromEbay Filter by orders from action service EBay
1370
+ * @property {(accountName: String) => searchOrdersRequest} fromAmazon Filter by orders from action service Amazon
1367
1371
  * @property {(page: Integer, limit: Integer) => SearchOrdersRequest} page Define page number and maximum results per page
1368
1372
  * @property {() => Integer} count Returns total numer of results
1369
1373
  * @property {function} exec Excecute request
@@ -1487,11 +1491,11 @@
1487
1491
  * @property {(stockIds: Array<Integer>) => SearchOrdersUnfinishedRequest} stockIds Define stocks by passing array of values
1488
1492
  * @property {(campaignIds: Array<Integer>) => SearchOrdersUnfinishedRequest} campaignIds Define campaign by passing array of values
1489
1493
  * @property {(discountCodes: Array<String>) => SearchOrdersUnfinishedRequest} discountCodes Define campaign by passing array of values
1490
- * @property {(productId: Integer, sizeId: String|null) => searchProductsRequest} hasProduct Filter by product ID and optionally product size
1491
- * @property {(orderHasPackage: Boolean) => searchProductsRequest} hasPackage Filter by orders that have any package number
1492
- * @property {(accountName: String) => searchProductsRequest} fromAllegro Filter by orders from auction service Allegro
1493
- * @property {(accountName: String) => searchProductsRequest} fromEbay Filter by orders from action service EBay
1494
- * @property {(accountName: String) => searchProductsRequest} fromAmazon Filter by orders from action service Amazon
1494
+ * @property {(productId: Integer, sizeId: String|null) => searchOrdersUnfinishedRequest} hasProduct Filter by product ID and optionally product size
1495
+ * @property {(orderHasPackage: Boolean) => searchOrdersUnfinishedRequest} hasPackage Filter by orders that have any package number
1496
+ * @property {(accountName: String) => searchOrdersUnfinishedRequest} fromAllegro Filter by orders from auction service Allegro
1497
+ * @property {(accountName: String) => searchOrdersUnfinishedRequest} fromEbay Filter by orders from action service EBay
1498
+ * @property {(accountName: String) => searchOrdersUnfinishedRequest} fromAmazon Filter by orders from action service Amazon
1495
1499
  * @property {(page: Integer, limit: Integer) => SearchOrdersUnfinishedRequest} page Define page number and maximum results per page
1496
1500
  * @property {() => Integer} count Returns total numer of results
1497
1501
  * @property {function} exec Excecute request
@@ -1516,6 +1520,9 @@
1516
1520
  * @typedef {Object} GetPackagesLabelsRequest
1517
1521
  * @property {(eventId: Integer) => GetPackagesLabelsRequest} eventId Id.
1518
1522
  * @property {(eventType: 'order'|'rma'|'return') => GetPackagesLabelsRequest} eventType Event type
1523
+ * @property {(orderSerialNumber: Integer) => getPackagesLabelsRequest} order Set type to orders with given order serial numbers
1524
+ * @property {(rmaId: Integer) => getPackagesLabelsRequest} rma Set type to rma with given rma Ids
1525
+ * @property {(returnId: Integer) => getPackagesLabelsRequest} return Set type to returns with given return Ids
1519
1526
  * @property {function} exec Excecute request
1520
1527
  */
1521
1528
 
@@ -1559,9 +1566,9 @@
1559
1566
  * @property {(eventType: 'order'|'rma'|'return') => SearchPackagesRequest} eventType Type.
1560
1567
  * @property {(eventsIds: Array<Integer>) => SearchPackagesRequest} eventsIds IDs.
1561
1568
  * @property {function} append Append current data to array and start modifying next row
1562
- * @property {(orderSerialNumbers: Array<Integer>) => GetPackagesRequest} orders Set type to orders with given order serial numbers
1563
- * @property {(rmaIds: Array<Integer>) => GetPackagesRequest} rma Set type to rma with given rma Ids
1564
- * @property {(returnIds: Array<Integer>) => GetPackagesRequest} returns Set type to returns with given return Ids
1569
+ * @property {(orderSerialNumbers: Array<Integer>) => searchPackagesRequest} orders Set type to orders with given order serial numbers
1570
+ * @property {(rmaIds: Array<Integer>) => searchPackagesRequest} rma Set type to rma with given rma Ids
1571
+ * @property {(returnIds: Array<Integer>) => searchPackagesRequest} returns Set type to returns with given return Ids
1565
1572
  * @property {function} exec Excecute request
1566
1573
  */
1567
1574
 
@@ -1678,7 +1685,7 @@
1678
1685
  * @property {(resultsPage: Integer) => GetProductsAuctionsRequest} resultsPage Page with results number. Numeration starts from 0
1679
1686
  * @property {(resultsLimit: Integer) => GetProductsAuctionsRequest} resultsLimit Number of results on page. Value from 1 to 100
1680
1687
  * @property {(ids: Array<Integer>) => GetProductsAuctionsRequest} ids Define products by passing array of values
1681
- * @property {() => GetProductsAuctionsRequest} fromAllegro Get auction data on products
1688
+ * @property {() => getProductsAuctionsRequest} fromAllegro Get auction data on products
1682
1689
  * @property {(page: Integer, limit: Integer) => GetProductsAuctionsRequest} page Define page number and maximum results per page
1683
1690
  * @property {() => Integer} count Returns total numer of results
1684
1691
  * @property {function} exec Excecute request
@@ -1832,7 +1839,7 @@
1832
1839
  * @property {(identType: 'id'|'index'|'codeExtern'|'codeProducer'|'codeDeliverer') => GetProductsCodeExistenceRequest} identType
1833
1840
  * @property {(products: Array<String>) => GetProductsCodeExistenceRequest} products Products list.
1834
1841
  * @property {(delivererId: String) => GetProductsCodeExistenceRequest} delivererId
1835
- * @property {(productId: Integer|Array<Integer> type: 'id'|'index'|'codeExtern'|'codeProducer') => GetProductsStrikethroughPricesRequest} productId Set product identifiers
1842
+ * @property {(productId: Integer|Array<Integer> type: 'id'|'index'|'codeExtern'|'codeProducer') => getProductsCodeExistenceRequest} productId Set product identifiers
1836
1843
  * @property {function} exec Excecute request
1837
1844
  */
1838
1845
 
@@ -1891,11 +1898,6 @@
1891
1898
  * @property {(productIndex: String) => SearchProductsDeliveryTimeRequest} productIndex Product IAI code
1892
1899
  * @property {(productSizeQuantity: Number) => SearchProductsDeliveryTimeRequest} productSizeQuantity Product quantity.
1893
1900
  * @property {function} append Append current data to array and start modifying next row
1894
- * @property {(productId: Integer) => GetProductsDeliveryTimeRequest} productId Product Id
1895
- * @property {(sizeId: Integer) => GetProductsDeliveryTimeRequest} sizeId Size identifier
1896
- * @property {(sizePanelName: String) => GetProductsDeliveryTimeRequest} sizePanelName Size name
1897
- * @property {(productIndex: String) => GetProductsDeliveryTimeRequest} productIndex Product IAI code
1898
- * @property {(productSizeQuantity: Integer) => GetProductsDeliveryTimeRequest} productSizeQuantity Product quantity.
1899
1901
  * @property {function} exec Excecute request
1900
1902
  */
1901
1903
 
@@ -1931,7 +1933,7 @@
1931
1933
  * @property {(groups: Array<Object>) => PutProductsGroupsOrderRequest} groups
1932
1934
  * @property {(productsInOrder: Array<Object>) => PutProductsGroupsOrderRequest} productsInOrder
1933
1935
  * @property {function} append Append current data to array and start modifying next row
1934
- * @property {(Array<Integer>) => PutProductsGroupsOrderRequest} productIdsInOrder Defines order of products within group by automatically setting proprities in order of appearance
1936
+ * @property {(Array<Integer>) => putProductsGroupsOrderRequest} productIdsInOrder Defines order of products within group by automatically setting proprities in order of appearance
1935
1937
  * @property {function} exec Excecute request
1936
1938
  */
1937
1939
 
@@ -1979,8 +1981,8 @@
1979
1981
  * @property {(shopIcon: String) => PutProductsImagesRequest} shopIcon Append productIconSource value into nested array inside productIcons
1980
1982
  * @property {(auctionIcon: String) => PutProductsImagesRequest} auctionIcon Append productIconSource value into nested array inside productIcons
1981
1983
  * @property {(groupIcon: String) => PutProductsImagesRequest} groupIcon Append productIconSource value into nested array inside productIcons
1982
- * @property {(source: String, priority: Integer) => PutProductsImagesRequest} addImage Adds image source with selected priority
1983
- * @property {() => PutProductsImagesRequest} base64 Set global image source to base64
1984
+ * @property {(source: String, priority: Integer) => putProductsImagesRequest} addImage Adds image source with selected priority
1985
+ * @property {() => putProductsImagesRequest} base64 Set global image source to base64
1984
1986
  * @property {function} exec Excecute request
1985
1987
  */
1986
1988
 
@@ -2043,7 +2045,7 @@
2043
2045
  * @typedef {Object} GetProductsMarketingZonesRequest
2044
2046
  * @property {(identType: 'id'|'index'|'codeExtern'|'codeProducer') => GetProductsMarketingZonesRequest} identType
2045
2047
  * @property {(products: Array<String>) => GetProductsMarketingZonesRequest} products Products list.
2046
- * @property {(productId: Integer|Array<Integer> type: 'id'|'index'|'codeExtern'|'codeProducer') => GetProductsStrikethroughPricesRequest} productId Set product identifiers
2048
+ * @property {(productId: Integer|Array<Integer> type: 'id'|'index'|'codeExtern'|'codeProducer') => getProductsMarketingZonesRequest} productId Set product identifiers
2047
2049
  * @property {function} exec Excecute request
2048
2050
  */
2049
2051
 
@@ -2065,7 +2067,7 @@
2065
2067
  * @typedef {Object} GetProductsOmnibusPricesRequest
2066
2068
  * @property {(identType: 'id'|'index'|'codeExtern'|'codeProducer') => GetProductsOmnibusPricesRequest} identType
2067
2069
  * @property {(products: Array<String>) => GetProductsOmnibusPricesRequest} products Products list.
2068
- * @property {(productId: Integer|Array<Integer> type: 'id'|'index'|'codeExtern'|'codeProducer') => GetProductsStrikethroughPricesRequest} productId Set product identifiers
2070
+ * @property {(productId: Integer|Array<Integer> type: 'id'|'index'|'codeExtern'|'codeProducer') => getProductsOmnibusPricesRequest} productId Set product identifiers
2069
2071
  * @property {function} exec Excecute request
2070
2072
  */
2071
2073
 
@@ -2279,9 +2281,9 @@
2279
2281
  * @property {(responsibleProducerCode: String) => PostProductsRequest} responsibleProducerCode Responsible producer code
2280
2282
  * @property {(responsiblePersonCode: String) => PostProductsRequest} responsiblePersonCode Responsible person code
2281
2283
  * @property {function} append Append current data to array and start modifying next row
2282
- * @property {(text: String, type: "name"|"short"|"long"|"metatitle"|"metadescription"|"metakeywords"|"acutionname"|"auctiondescription", language: String, shopId: Integer) => PostProductsRequest} setText Set various types of names or descriptions to the product
2283
- * @property {(value: Float, type: 'retail'|'wholesale'|'pos'|'minimal'|'strikethroughRetail'|'strikethroughWholesale'|'suggested'|'automaticCalculation') => PostProductsRequest} addPrice Increases product price by amount
2284
- * @property {(value: Float, type: 'retail'|'wholesale'|'pos'|'minimal'|'strikethroughRetail'|'strikethroughWholesale'|'suggested'|'automaticCalculation') => PostProductsRequest} setPrice Sets product price by amount
2284
+ * @property {(text: String, type: "name"|"short"|"long"|"metatitle"|"metadescription"|"metakeywords"|"acutionname"|"auctiondescription", language: String, shopId: Integer) => postProductsRequest} setText Set various types of names or descriptions to the product
2285
+ * @property {(value: Float, type: 'retail'|'wholesale'|'pos'|'minimal'|'strikethroughRetail'|'strikethroughWholesale'|'suggested'|'automaticCalculation') => postProductsRequest} addPrice Increases product price by amount
2286
+ * @property {(value: Float, type: 'retail'|'wholesale'|'pos'|'minimal'|'strikethroughRetail'|'strikethroughWholesale'|'suggested'|'automaticCalculation') => postProductsRequest} setPrice Sets product price by amount
2285
2287
  * @property {function} exec Excecute request
2286
2288
  */
2287
2289
 
@@ -2422,13 +2424,13 @@
2422
2424
  * @property {(responsibleProducerCode: String) => PutProductsRequest} responsibleProducerCode Responsible producer code
2423
2425
  * @property {(responsiblePersonCode: String) => PutProductsRequest} responsiblePersonCode Responsible person code
2424
2426
  * @property {function} append Append current data to array and start modifying next row
2425
- * @property {(text: String, type: "name"|"short"|"long"|"metatitle"|"metadescription"|"metakeywords"|"acutionname"|"auctiondescription", language: String, shopId: Integer) => PutProductsRequest} setText Set various types of names or descriptions to the product
2426
- * @property {() => PutProductsRequest} editMode Set edit mode - disables adding new product
2427
- * @property {() => PutProductsRequest} addMode Set add mode - Api is allowed to create new products
2428
- * @property {(value: Float, type: 'retail'|'wholesale'|'pos'|'minimal'|'strikethroughRetail'|'strikethroughWholesale'|'suggested'|'automaticCalculation') => PutProductsRequest} addPrice Increases product price by amount
2429
- * @property {(value: Float, type: 'retail'|'wholesale'|'pos'|'minimal'|'strikethroughRetail'|'strikethroughWholesale'|'suggested'|'automaticCalculation') => PutProductsRequest} setPrice Sets product price by amount
2430
- * @property {(shopId: Integer, menuIds: Integer) => PutProductsRequest} setMenu Sets product selected IDs
2431
- * @property {(picturesArray: Array<String>) => PutProductsRequest} pictures Sets list of pictures attached to product
2427
+ * @property {(text: String, type: "name"|"short"|"long"|"metatitle"|"metadescription"|"metakeywords"|"acutionname"|"auctiondescription", language: String, shopId: Integer) => putProductsRequest} setText Set various types of names or descriptions to the product
2428
+ * @property {() => putProductsRequest} editMode Set edit mode - disables adding new product
2429
+ * @property {() => putProductsRequest} addMode Set add mode - Api is allowed to create new products
2430
+ * @property {(value: Float, type: 'retail'|'wholesale'|'pos'|'minimal'|'strikethroughRetail'|'strikethroughWholesale'|'suggested'|'automaticCalculation') => putProductsRequest} addPrice Increases product price by amount
2431
+ * @property {(value: Float, type: 'retail'|'wholesale'|'pos'|'minimal'|'strikethroughRetail'|'strikethroughWholesale'|'suggested'|'automaticCalculation') => putProductsRequest} setPrice Sets product price by amount
2432
+ * @property {(shopId: Integer, menuIds: Integer) => putProductsRequest} setMenu Sets product selected IDs
2433
+ * @property {(picturesArray: Array<String>) => putProductsRequest} pictures Sets list of pictures attached to product
2432
2434
  * @property {function} exec Excecute request
2433
2435
  */
2434
2436
 
@@ -2582,7 +2584,7 @@
2582
2584
  * @typedef {Object} GetProductsReservationsRequest
2583
2585
  * @property {(identType: 'id'|'index'|'codeExtern'|'codeProducer') => GetProductsReservationsRequest} identType
2584
2586
  * @property {(products: Array<String>) => GetProductsReservationsRequest} products Products list.
2585
- * @property {(productId: Integer|Array<Integer> type: 'id'|'index'|'codeExtern'|'codeProducer') => GetProductsStrikethroughPricesRequest} productId Set product identifiers
2587
+ * @property {(productId: Integer|Array<Integer> type: 'id'|'index'|'codeExtern'|'codeProducer') => getProductsReservationsRequest} productId Set product identifiers
2586
2588
  * @property {function} exec Excecute request
2587
2589
  */
2588
2590
 
@@ -2691,7 +2693,7 @@
2691
2693
  * @typedef {Object} GetProductsStocksRequest
2692
2694
  * @property {(identType: 'id'|'index'|'codeExtern'|'codeProducer') => GetProductsStocksRequest} identType
2693
2695
  * @property {(products: Array<String>) => GetProductsStocksRequest} products Products list.
2694
- * @property {(productId: Integer|Array<Integer> type: 'id'|'index'|'codeExtern'|'codeProducer') => GetProductsStrikethroughPricesRequest} productId Set product identifiers
2696
+ * @property {(productId: Integer|Array<Integer> type: 'id'|'index'|'codeExtern'|'codeProducer') => getProductsStocksRequest} productId Set product identifiers
2695
2697
  * @property {function} exec Excecute request
2696
2698
  */
2697
2699
 
@@ -2710,13 +2712,18 @@
2710
2712
  * @typedef {Object} GetProductsStrikethroughPricesRequest
2711
2713
  * @property {(identType: 'id'|'index'|'codeExtern'|'codeProducer') => GetProductsStrikethroughPricesRequest} identType
2712
2714
  * @property {(products: Array<String>) => GetProductsStrikethroughPricesRequest} products Products list.
2713
- * @property {(productId: Integer|Array<Integer> type: 'id'|'index'|'codeExtern'|'codeProducer') => GetProductsStrikethroughPricesRequest} productId Set product identifiers
2715
+ * @property {(productId: Integer|Array<Integer> type: 'id'|'index'|'codeExtern'|'codeProducer') => getProductsStrikethroughPricesRequest} productId Set product identifiers
2714
2716
  * @property {function} exec Excecute request
2715
2717
  */
2716
2718
 
2717
2719
  /**
2718
2720
  * @typedef {Object} PutProductsStrikethroughPricesRequest
2719
2721
  * @property {(products: Array<Object>) => PutProductsStrikethroughPricesRequest} products Products list.
2722
+ * @property {(ident: Object) => PutProductsStrikethroughPricesRequest} ident Identifier type.
2723
+ * @property {(sizes: Array<Object>) => PutProductsStrikethroughPricesRequest} sizes List of sizes
2724
+ * @property {(stp_settings: Object) => PutProductsStrikethroughPricesRequest} stp_settings
2725
+ * @property {(shops: Array<Object>) => PutProductsStrikethroughPricesRequest} shops Strikethrough price settings for the page.
2726
+ * @property {function} append Append current data to array and start modifying next row
2720
2727
  * @property {function} exec Excecute request
2721
2728
  */
2722
2729
 
@@ -2841,6 +2848,8 @@
2841
2848
  * @property {(type: String) => GetResponsibilityEntitiesRequest} type Type of entity
2842
2849
  * @property {(resultsPage: Integer) => GetResponsibilityEntitiesRequest} resultsPage Page with results number. Numeration starts from 0
2843
2850
  * @property {(resultsLimit: Integer) => GetResponsibilityEntitiesRequest} resultsLimit Number of results on page. Value from 1 to 100
2851
+ * @property {(page: Integer, limit: Integer) => GetResponsibilityEntitiesRequest} page Define page number and maximum results per page
2852
+ * @property {() => Integer} count Returns total numer of results
2844
2853
  * @property {function} exec Excecute request
2845
2854
  */
2846
2855
 
@@ -3064,6 +3073,8 @@
3064
3073
  * @property {(omitDeleted: 'y'|'n') => GetSnippetsCampaignRequest} omitDeleted Whether to skip the return of deleted campaigns.
3065
3074
  * @property {(resultsPage: Integer) => GetSnippetsCampaignRequest} resultsPage Page with results number. Numeration starts from 0
3066
3075
  * @property {(resultsLimit: Integer) => GetSnippetsCampaignRequest} resultsLimit Number of results on page. Value from 1 to 100
3076
+ * @property {(page: Integer, limit: Integer) => GetSnippetsCampaignRequest} page Define page number and maximum results per page
3077
+ * @property {() => Integer} count Returns total numer of results
3067
3078
  * @property {function} exec Excecute request
3068
3079
  */
3069
3080
 
@@ -3090,6 +3101,8 @@
3090
3101
  * @property {(id: Array<Integer>) => GetSnippetsCookiesRequest} id List of identifiers for specific cookies
3091
3102
  * @property {(resultsPage: Integer) => GetSnippetsCookiesRequest} resultsPage Page with results number. Numeration starts from 0
3092
3103
  * @property {(resultsLimit: Integer) => GetSnippetsCookiesRequest} resultsLimit Number of results on page. Value from 1 to 100
3104
+ * @property {(page: Integer, limit: Integer) => GetSnippetsCookiesRequest} page Define page number and maximum results per page
3105
+ * @property {() => Integer} count Returns total numer of results
3093
3106
  * @property {function} exec Excecute request
3094
3107
  */
3095
3108
 
@@ -3118,6 +3131,8 @@
3118
3131
  * @property {(omitDeleted: 'y'|'n') => GetSnippetsRequest} omitDeleted Whether to skip the return of deleted campaigns.
3119
3132
  * @property {(resultsPage: Integer) => GetSnippetsRequest} resultsPage Page with results number. Numeration starts from 0
3120
3133
  * @property {(resultsLimit: Integer) => GetSnippetsRequest} resultsLimit Number of results on page. Value from 1 to 100
3134
+ * @property {(page: Integer, limit: Integer) => GetSnippetsRequest} page Define page number and maximum results per page
3135
+ * @property {() => Integer} count Returns total numer of results
3121
3136
  * @property {function} exec Excecute request
3122
3137
  */
3123
3138
 
@@ -3576,6 +3591,7 @@
3576
3591
  *//**
3577
3592
  * Idosell Gateways.
3578
3593
  * @typedef {Object} Gateways
3594
+ * @property {Gateways} clone Clones request credentials
3579
3595
  * @property {GetClientsBalanceRequest} getClientsBalance Method that enables extracting customer balance information from existing customer accounts.
3580
3596
  * @property {PostClientsBalanceRequest} postClientsBalance Method that allows for customer account balance operations.
3581
3597
  * @property {GetClientsRequest} getClients Method that enables extracting customer account details.
@@ -3884,4 +3900,4 @@
3884
3900
  * @property {PutWmsSuppliersRequest} putWmsSuppliers The method allows information about suppliers to be updated, including address details, description, order preparation time or supplier working hours..
3885
3901
  */
3886
3902
 
3887
- export const DEFAULT_VERSION = 1;
3903
+ export const DEFAULT_VERSION = 5;
package/dist/index.js CHANGED
@@ -10,7 +10,9 @@ const DEFAULT_VERSION = 5;
10
10
  * @returns {import('./gates.def.js').Gateways} Gateways Idosell connector - pick gate
11
11
  */
12
12
  const idosell = (url, apiKey, version = DEFAULT_VERSION) => {
13
- const element = { auth: { url, apiKey, version }, params: {}};
13
+ const auth = { url, apiKey, version, apikey: apiKey.slice(0,6) + '*'.repeat(20) };
14
+ Object.defineProperty(auth, 'apiKey', { enumerable: false });
15
+ const element = { auth, params: {}};
14
16
  return new Proxy(element, gateProxy);
15
17
  }
16
18
 
@@ -1,6 +1,10 @@
1
1
  import { paramsProxy } from "../params.js";
2
+ import { page } from "../helpers.js";
2
3
 
3
4
  export default (object) => {
4
5
  object.gate = { method: 'get', node: '/cpa/cpa' };
6
+ object.custom = {
7
+ page
8
+ };
5
9
  return new Proxy(object, paramsProxy);
6
10
  }
@@ -1,6 +1,10 @@
1
1
  import { paramsProxy } from "../params.js";
2
+ import { page } from "../helpers.js";
2
3
 
3
4
  export default (object) => {
4
5
  object.gate = { method: 'get', node: '/cpa/campaign' };
6
+ object.custom = {
7
+ page
8
+ };
5
9
  return new Proxy(object, paramsProxy);
6
10
  }
@@ -2,5 +2,10 @@ import { paramsProxy } from "../params.js";
2
2
 
3
3
  export default (object) => {
4
4
  object.gate = { method: 'get', node: '/packages/labels' };
5
+ object.custom = {
6
+ order: (orderSerialNumber) => ({ eventType: "order", eventId: orderSerialNumber }),
7
+ rm: (rmaId) => ({ eventType: "rma", eventId: rmaId }),
8
+ return: (returnId) => ({ eventType: "return", eventId: returnId })
9
+ };
5
10
  return new Proxy(object, paramsProxy);
6
11
  }
@@ -1,6 +1,10 @@
1
1
  import { paramsProxy } from "../params.js";
2
+ import { page } from "../helpers.js";
2
3
 
3
4
  export default (object) => {
4
5
  object.gate = { method: 'get', node: '/responsibility/entities' };
6
+ object.custom = {
7
+ page
8
+ };
5
9
  return new Proxy(object, paramsProxy);
6
10
  }
@@ -1,6 +1,10 @@
1
1
  import { paramsProxy } from "../params.js";
2
+ import { page } from "../helpers.js";
2
3
 
3
4
  export default (object) => {
4
5
  object.gate = { method: 'get', node: '/snippets/snippets' };
6
+ object.custom = {
7
+ page
8
+ };
5
9
  return new Proxy(object, paramsProxy);
6
10
  }
@@ -1,6 +1,10 @@
1
1
  import { paramsProxy } from "../params.js";
2
+ import { page } from "../helpers.js";
2
3
 
3
4
  export default (object) => {
4
5
  object.gate = { method: 'get', node: '/snippets/campaign' };
6
+ object.custom = {
7
+ page
8
+ };
5
9
  return new Proxy(object, paramsProxy);
6
10
  }
@@ -1,6 +1,10 @@
1
1
  import { paramsProxy } from "../params.js";
2
+ import { page } from "../helpers.js";
2
3
 
3
4
  export default (object) => {
4
5
  object.gate = { method: 'get', node: '/snippets/cookies' };
6
+ object.custom = {
7
+ page
8
+ };
5
9
  return new Proxy(object, paramsProxy);
6
10
  }
@@ -2,5 +2,10 @@ import { paramsProxy } from "../params.js";
2
2
 
3
3
  export default (object) => {
4
4
  object.gate = { method: 'put', node: '/products/strikethroughPrices' };
5
+ object.appendable = {
6
+ except: [],
7
+ arrayNode: "products",
8
+ index: 0
9
+ }
5
10
  return new Proxy(object, paramsProxy);
6
11
  }
package/dist/params.js CHANGED
@@ -8,7 +8,11 @@ const requests = {
8
8
  getParams,
9
9
  hasNext,
10
10
  toString,
11
- getAttributes
11
+ getAttributes,
12
+ params: (object, value) => {
13
+ object.params = value;
14
+ return new Proxy(object, paramsProxy);
15
+ }
12
16
  }
13
17
 
14
18
  export const paramsProxy = {
@@ -16,8 +20,7 @@ export const paramsProxy = {
16
20
  return (...values) => {
17
21
  if (requests[property]) {
18
22
  return requests[property](object, values[0]);
19
- }
20
- else if (object.appendable && object.appendable.arrayNode !== property && !object.appendable.except.includes(property)) {
23
+ } else if (object.appendable && object.appendable.arrayNode !== property && !object.appendable.except.includes(property)) {
21
24
  if (!object.params[object.appendable.arrayNode]) object.params[object.appendable.arrayNode] = [{}];
22
25
  const item = object.params[object.appendable.arrayNode][object.appendable.index];
23
26
  if (property === 'append') {
@@ -29,15 +32,12 @@ export const paramsProxy = {
29
32
  } else {
30
33
  item[property] = values[0];
31
34
  }
32
- }
33
- else if (object.custom && typeof object.custom[property] === 'function') {
35
+ } else if (object.custom && typeof object.custom[property] === 'function') {
34
36
  if (property === 'page') values.push(Boolean(object.snakeCase));
35
37
  const param = object.custom[property](...values);
36
38
  Object.assign(object.params, param);
37
39
  }
38
- else if (property === 'params') {
39
- object.params = values[0];
40
- } else object.params[property] = values[0];
40
+ else object.params[property] = values[0];
41
41
  return new Proxy(object, paramsProxy);
42
42
  }
43
43
  }
package/dist/request.js CHANGED
@@ -12,10 +12,19 @@ const catchIdosellError = (err) => {
12
12
  for (const [ search, replace ] of DECODE_TABLE) {
13
13
  message = message.replaceAll(search, replace);
14
14
  }
15
- throw new Error(`${err.response.status}: ${message}`)
15
+ if (err.response.status === 403) {
16
+ const match = message.match(/Scope: ([a-z]+), level: ([rw]{1,2})/)
17
+ if (match) {
18
+ const access = match[2] === 'rw' ? 'Odczyt i zapis' : 'Odczyt';
19
+ const mod = match[1].toUpperCase();
20
+ message = `Brak dostępu do modułu ${mod} (${access})`;
21
+ }
22
+ }
23
+ throw new Error(`${err.response.status}: ${message}`, { cause: err.response.status })
16
24
  }
17
25
 
18
26
  const checkNext = (request, response) => {
27
+ if (!response) return;
19
28
  if (response.resultsNumberPage) {
20
29
  request.next = response.resultsPage + 1 < response.resultsNumberPage;
21
30
  request.params.resultsPage = request.params.resultsPage ? request.params.resultsPage + 1 : 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idosell",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Idosell 3 REST connector",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -0,0 +1,12 @@
1
+ import idosell from "./dist/index.js"
2
+ import { expect, test } from "vitest"
3
+
4
+ test("getCpaId", () => {
5
+ const params = idosell().getCpa.id(2).getParams();
6
+ expect(params).toEqual({"id":2});
7
+ })
8
+
9
+ test("getCpaPage", () => {
10
+ const params = idosell().getCpa.page(1,2).getParams();
11
+ expect(params).toEqual({"resultsPage":1,"resultsLimit":2});
12
+ })
@@ -0,0 +1,12 @@
1
+ import idosell from "./dist/index.js"
2
+ import { expect, test } from "vitest"
3
+
4
+ test("getCpaCampaignId", () => {
5
+ const params = idosell().getCpaCampaign.campaign(2).getParams();
6
+ expect(params).toEqual({"campaign":2});
7
+ })
8
+
9
+ test("getCpaCampaignPage", () => {
10
+ const params = idosell().getCpaCampaign.page(1,2).getParams();
11
+ expect(params).toEqual({"resultsPage":1,"resultsLimit":2});
12
+ })
@@ -0,0 +1,7 @@
1
+ import idosell from "./dist/index.js"
2
+ import { expect, test } from "vitest"
3
+
4
+ test("getPackagesLabels", () => {
5
+ const params = idosell().getPackagesLabels.order(21).getParams();
6
+ expect(params).toEqual({"eventType":"order","eventId":21});
7
+ })
@@ -18,7 +18,7 @@ test("getReturnsStatus", () => {
18
18
 
19
19
  test("getReturnsDates", () => {
20
20
  const params = idosell().getReturns.dates("2023-12-01", "2023-12-10", "date_add").getParams();
21
- expect(params).toEqual({"range":{"date":{"date_begin":"2023-12-01","date_end":"2023-12-10","dates_type":"date_add"}}});
21
+ expect(params).toEqual({"range":{"date][date_begin": "2023-12-01","date][date_end": "2023-12-10","date][dates_type": "date_add",}});
22
22
  })
23
23
 
24
24
  test("getReturnsPage", () => {
@@ -0,0 +1,7 @@
1
+ import idosell from "./dist/index.js"
2
+ import { expect, test } from "vitest"
3
+
4
+ test("putReturnsStatus", () => {
5
+ const params = idosell().putReturns.id(2).status(14).getParams();
6
+ expect(params).toEqual({"returns":[{"id":2,"status":14}]});
7
+ })
@@ -1,22 +1,22 @@
1
1
  import idosell from "./dist/index.js"
2
2
  import { expect, test } from "vitest"
3
3
 
4
- test("getClientsCrmClientLogin", () => {
5
- const params = idosell().getClientsCrm.clientLogin("abcdefg").getParams();
4
+ test("searchClientsCrmClientLogin", () => {
5
+ const params = idosell().searchClientsCrm.clientLogin("abcdefg").getParams();
6
6
  expect(params).toEqual({"clientLogin":"abcdefg"});
7
7
  })
8
8
 
9
- test("getClientsCrmClientIsWholesaler", () => {
10
- const params = idosell().getClientsCrm.clientIsWholesaler("yes").getParams();
9
+ test("searchClientsCrmClientIsWholesaler", () => {
10
+ const params = idosell().searchClientsCrm.clientIsWholesaler("yes").getParams();
11
11
  expect(params).toEqual({"clientIsWholesaler":"yes"});
12
12
  })
13
13
 
14
- test("getClientsCrmRegistered", () => {
15
- const params = idosell().getClientsCrm.registered("2023-01-01", 1672704000000).getParams();
14
+ test("searchClientsCrmRegistered", () => {
15
+ const params = idosell().searchClientsCrm.registered("2023-01-01", 1672704000000).getParams();
16
16
  expect(params).toEqual({"clientRegistrationDate":{"clientRegistrationDateBegin":"2023-01-01","clientRegistrationDateEnd":"2023-01-03"}});
17
17
  })
18
18
 
19
- test("getClientsCrmPage", () => {
20
- const params = idosell().getClientsCrm.page(2,10).getParams();
19
+ test("searchClientsCrmPage", () => {
20
+ const params = idosell().searchClientsCrm.page(2,10).getParams();
21
21
  expect(params).toEqual({"resultsPage":2,"resultsLimit":10});
22
22
  })
@@ -1,7 +1,7 @@
1
1
  import idosell from "./dist/index.js"
2
2
  import { expect, test } from "vitest"
3
3
 
4
- test("getClientsGiftcardsNumber", () => {
5
- const params = idosell().getClientsGiftcards.number([123,456,789]).getParams();
4
+ test("searchClientsGiftcardsNumber", () => {
5
+ const params = idosell().searchClientsGiftcards.number([123,456,789]).getParams();
6
6
  expect(params).toEqual({"giftCards":[{"number":123},{"number":456},{"number":789}]});
7
7
  })
@@ -1,12 +1,12 @@
1
1
  import idosell from "./dist/index.js"
2
2
  import { expect, test } from "vitest"
3
3
 
4
- test("getClientsNewsletterEmailShopsLanguage", () => {
5
- const params = idosell().getClientsNewsletterEmailShops.language("pol").getParams();
4
+ test("searchClientsNewsletterEmailLanguage", () => {
5
+ const params = idosell().searchClientsNewsletterEmail.language("pol").getParams();
6
6
  expect(params).toEqual({"language":"pol"});
7
7
  })
8
8
 
9
- test("getClientsNewsletterEmailShopsPage", () => {
10
- const params = idosell().getClientsNewsletterEmailShops.page(2,10).getParams();
9
+ test("searchClientsNewsletterEmailPage", () => {
10
+ const params = idosell().searchClientsNewsletterEmail.page(2,10).getParams();
11
11
  expect(params).toEqual({"results_page":2,"results_limit":10});
12
12
  })