repzo-sap-absjo 1.0.20 → 1.0.22

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 (90) hide show
  1. package/changelog.md +1 -0
  2. package/lib/actions/create_invoice.d.ts +19 -13
  3. package/lib/actions/create_invoice.js +359 -210
  4. package/lib/actions/create_payment.d.ts +4 -1
  5. package/lib/actions/create_payment.js +195 -107
  6. package/lib/actions/create_proforma.d.ts +4 -1
  7. package/lib/actions/create_proforma.js +288 -147
  8. package/lib/actions/create_return_invoice.d.ts +4 -1
  9. package/lib/actions/create_return_invoice.js +312 -158
  10. package/lib/actions/create_transfer.d.ts +4 -1
  11. package/lib/actions/create_transfer.js +223 -126
  12. package/lib/actions/index.js +23 -15
  13. package/lib/commands/adjust_inventory.d.ts +4 -2
  14. package/lib/commands/adjust_inventory.js +290 -160
  15. package/lib/commands/bank.d.ts +4 -2
  16. package/lib/commands/bank.js +279 -157
  17. package/lib/commands/basic.js +68 -48
  18. package/lib/commands/brand.d.ts +3 -1
  19. package/lib/commands/brand.js +174 -100
  20. package/lib/commands/category.d.ts +3 -1
  21. package/lib/commands/category.js +178 -104
  22. package/lib/commands/channel.d.ts +3 -1
  23. package/lib/commands/channel.js +198 -117
  24. package/lib/commands/client.d.ts +34 -32
  25. package/lib/commands/client.js +404 -244
  26. package/lib/commands/client_disabled.d.ts +3 -1
  27. package/lib/commands/client_disabled.js +163 -94
  28. package/lib/commands/index.d.ts +24 -11
  29. package/lib/commands/index.js +65 -62
  30. package/lib/commands/join.js +192 -66
  31. package/lib/commands/measureunit.d.ts +19 -14
  32. package/lib/commands/measureunit.js +289 -191
  33. package/lib/commands/measureunit_family.d.ts +10 -8
  34. package/lib/commands/measureunit_family.js +250 -138
  35. package/lib/commands/payment_term.d.ts +3 -1
  36. package/lib/commands/payment_term.js +202 -123
  37. package/lib/commands/price_list.d.ts +15 -15
  38. package/lib/commands/price_list.js +617 -326
  39. package/lib/commands/price_list_disabled.d.ts +12 -0
  40. package/lib/commands/price_list_disabled.js +216 -0
  41. package/lib/commands/product.d.ts +32 -30
  42. package/lib/commands/product.js +485 -263
  43. package/lib/commands/product_disabled.d.ts +3 -1
  44. package/lib/commands/product_disabled.js +160 -94
  45. package/lib/commands/rep.js +221 -141
  46. package/lib/commands/tag.js +174 -109
  47. package/lib/commands/tax.js +177 -112
  48. package/lib/commands/warehouse.d.ts +3 -1
  49. package/lib/commands/warehouse.js +207 -119
  50. package/lib/index.d.ts +30 -12
  51. package/lib/test/actions/create_invoice.js +193 -188
  52. package/lib/test/actions/create_payment.js +112 -107
  53. package/lib/test/actions/create_proforma.js +220 -216
  54. package/lib/test/actions/create_return_invoice.js +205 -200
  55. package/lib/test/actions/create_transfer.js +120 -115
  56. package/lib/test/commands/adjust_inventory.js +90 -90
  57. package/lib/test/commands/bank.js +90 -90
  58. package/lib/test/commands/basic.js +335 -327
  59. package/lib/test/commands/brand.js +90 -90
  60. package/lib/test/commands/category.js +90 -90
  61. package/lib/test/commands/channel.js +90 -90
  62. package/lib/test/commands/client.js +355 -353
  63. package/lib/test/commands/client_disabled.js +90 -90
  64. package/lib/test/commands/join.js +328 -327
  65. package/lib/test/commands/measureunit.js +90 -90
  66. package/lib/test/commands/measureunit_family.js +90 -90
  67. package/lib/test/commands/payment_term.js +90 -90
  68. package/lib/test/commands/price_list.js +337 -334
  69. package/lib/test/commands/price_list_disabled.d.ts +1 -0
  70. package/lib/test/commands/price_list_disabled.js +359 -0
  71. package/lib/test/commands/product.js +90 -90
  72. package/lib/test/commands/product_disabled.js +90 -90
  73. package/lib/test/commands/rep.js +346 -344
  74. package/lib/test/commands/tag.js +90 -90
  75. package/lib/test/commands/tax.js +90 -90
  76. package/lib/test/commands/warehouse.js +90 -90
  77. package/lib/types.d.ts +78 -53
  78. package/lib/util.d.ts +76 -19
  79. package/lib/util.js +179 -144
  80. package/package.json +1 -1
  81. package/src/actions/create_invoice.ts +7 -18
  82. package/src/actions/create_proforma.ts +11 -1
  83. package/src/commands/basic.ts +1 -0
  84. package/src/commands/index.ts +3 -0
  85. package/src/commands/price_list.ts +7 -2
  86. package/src/commands/price_list_disabled.ts +194 -0
  87. package/src/test/commands/basic.ts +7 -0
  88. package/src/test/commands/price_list_disabled.ts +362 -0
  89. package/src/types.ts +1 -0
  90. package/src/util.ts +18 -1
package/src/util.ts CHANGED
@@ -2,7 +2,7 @@ import axios from "axios";
2
2
  import Repzo from "repzo";
3
3
  import moment from "moment-timezone";
4
4
  import { CommandType } from "./types";
5
-
5
+ import { Service } from "repzo/src/types";
6
6
  interface Params {
7
7
  [key: string]: any;
8
8
  }
@@ -241,3 +241,20 @@ export const send_command_to_marketplace = async ({
241
241
  throw e;
242
242
  }
243
243
  };
244
+
245
+ export const getUniqueConcatenatedValues = function (
246
+ item: Service.Item.Schema,
247
+ key: "name" | "ref",
248
+ delimiter: string
249
+ ): string {
250
+ item.general_promotions = item.general_promotions || [];
251
+ item.used_promotions = item.used_promotions || [];
252
+ const allPromotions: { name: string; ref?: string; [key: string]: any }[] = [
253
+ ...item.general_promotions,
254
+ ...item.used_promotions,
255
+ ];
256
+ const uniqueValues = new Set(
257
+ allPromotions.map((promotion) => promotion[key]).filter((value) => value)
258
+ );
259
+ return [...uniqueValues].join(delimiter);
260
+ };