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
@@ -1,202 +1,300 @@
1
1
  import Repzo from "repzo";
2
2
  import DataSet from "data-set-query";
3
- import { _create, update_bench_time, set_error, } from "../util.js";
3
+ import { _create, update_bench_time, set_error } from "../util.js";
4
4
  export const sync_measureunit = async (commandEvent) => {
5
- var _a, _b, _c, _d, _e, _f, _g;
6
- const repzo = new Repzo((_a = commandEvent.app.formData) === null || _a === void 0 ? void 0 : _a.repzoApiKey, {
7
- env: commandEvent.env,
5
+ var _a, _b, _c, _d, _e, _f, _g;
6
+ const repzo = new Repzo(
7
+ (_a = commandEvent.app.formData) === null || _a === void 0
8
+ ? void 0
9
+ : _a.repzoApiKey,
10
+ {
11
+ env: commandEvent.env,
12
+ }
13
+ );
14
+ const commandLog = new Repzo.CommandLog(
15
+ repzo,
16
+ commandEvent.app,
17
+ commandEvent.command
18
+ );
19
+ try {
20
+ // console.log("sync_measureunit");
21
+ const new_bench_time = new Date().toISOString();
22
+ const bench_time_key = "bench_time_measureunit";
23
+ await commandLog.load(commandEvent.sync_id);
24
+ await commandLog
25
+ .addDetail("Repzo SAP: Started Syncing Measure units")
26
+ .commit();
27
+ const nameSpace = commandEvent.nameSpace.join("_");
28
+ const result = {
29
+ sap_total: 0,
30
+ repzo_total: 0,
31
+ created: 0,
32
+ updated: 0,
33
+ failed: 0,
34
+ };
35
+ const failed_docs_report = [];
36
+ const sap_UoMs = await get_sap_UoMs(
37
+ commandEvent.app.formData.sapHostUrl,
38
+ {}
39
+ );
40
+ result.sap_total =
41
+ sap_UoMs === null || sap_UoMs === void 0 ? void 0 : sap_UoMs.length;
42
+ await commandLog
43
+ .addDetail(`${result.sap_total} Unit of Measures in SAP`)
44
+ .commit();
45
+ // Get Repzo default measureunit
46
+ const repzo_UoM_parent = await repzo.measureunit.find({
47
+ parent: "nil",
48
+ disabled: false,
8
49
  });
9
- const commandLog = new Repzo.CommandLog(repzo, commandEvent.app, commandEvent.command);
10
- try {
11
- // console.log("sync_measureunit");
12
- const new_bench_time = new Date().toISOString();
13
- const bench_time_key = "bench_time_measureunit";
14
- await commandLog.load(commandEvent.sync_id);
15
- await commandLog
16
- .addDetail("Repzo SAP: Started Syncing Measure units")
17
- .commit();
18
- const nameSpace = commandEvent.nameSpace.join("_");
19
- const result = {
20
- sap_total: 0,
21
- repzo_total: 0,
22
- created: 0,
23
- updated: 0,
24
- failed: 0,
25
- };
26
- const failed_docs_report = [];
27
- const sap_UoMs = await get_sap_UoMs(commandEvent.app.formData.sapHostUrl, {});
28
- result.sap_total = sap_UoMs === null || sap_UoMs === void 0 ? void 0 : sap_UoMs.length;
29
- await commandLog
30
- .addDetail(`${result.sap_total} Unit of Measures in SAP`)
31
- .commit();
32
- // Get Repzo default measureunit
33
- const repzo_UoM_parent = await repzo.measureunit.find({
34
- parent: "nil",
35
- disabled: false,
36
- });
37
- if (!(repzo_UoM_parent === null || repzo_UoM_parent === void 0 ? void 0 : repzo_UoM_parent.data) || ((_b = repzo_UoM_parent === null || repzo_UoM_parent === void 0 ? void 0 : repzo_UoM_parent.data) === null || _b === void 0 ? void 0 : _b.length) != 1)
38
- throw "the parent of measure unit is not found or the nameSpace has more than one";
39
- const repzo_parent_id = repzo_UoM_parent.data[0]._id;
40
- const repzo_UoMs = await repzo.measureunit.find({ per_page: 50000 });
41
- result.repzo_total = (_c = repzo_UoMs === null || repzo_UoMs === void 0 ? void 0 : repzo_UoMs.data) === null || _c === void 0 ? void 0 : _c.length;
42
- await commandLog
43
- .addDetail(`${(_d = repzo_UoMs === null || repzo_UoMs === void 0 ? void 0 : repzo_UoMs.data) === null || _d === void 0 ? void 0 : _d.length} Measure Units in Repzo`)
44
- .commit();
45
- const byProduct = {};
46
- sap_UoMs.forEach((unit) => {
47
- if (!byProduct[unit.ITEMCODE])
48
- byProduct[unit.ITEMCODE] = [];
49
- byProduct[unit.ITEMCODE].push(unit);
50
- });
51
- Object.values(byProduct).forEach((units) => {
52
- var _a, _b, _c;
53
- const max_unit = {
54
- sap_product_UoMs: [],
55
- value: null,
56
- default_unit: null,
57
- };
58
- units.forEach((unit) => {
59
- if (max_unit.value == null || unit.BASEQTY > max_unit.value) {
60
- max_unit.value = unit.BASEQTY;
61
- max_unit.sap_product_UoMs.push(unit);
62
- }
63
- else if (unit.BASEQTY == max_unit.value) {
64
- max_unit.sap_product_UoMs.push(unit);
65
- }
66
- });
67
- if (max_unit.sap_product_UoMs.length > 1) {
68
- max_unit.default_unit = max_unit.sap_product_UoMs.find((u) => u.ALTUOMCODE == "PC");
69
- if (!max_unit.default_unit) {
70
- // console.log(
71
- // "Create/Update Measure Unit Failed >> ",
72
- // `${max_unit?.sap_product_UoMs[0]?.ITEMCODE} Could not found the base_unit`,
73
- // units
74
- // );
75
- failed_docs_report.push({
76
- method: "create",
77
- doc_id: ((_a = max_unit === null || max_unit === void 0 ? void 0 : max_unit.sap_product_UoMs[0]) === null || _a === void 0 ? void 0 : _a.ITEMCODE) || ((_b = units[0]) === null || _b === void 0 ? void 0 : _b.ITEMCODE),
78
- doc: units,
79
- error_message: set_error(`Create/Update Measure Unit Failed >> ${(_c = max_unit === null || max_unit === void 0 ? void 0 : max_unit.sap_product_UoMs[0]) === null || _c === void 0 ? void 0 : _c.ITEMCODE} Could not found the base_unit`),
80
- });
81
- result.failed++;
82
- return;
83
- }
84
- }
85
- else {
86
- max_unit.default_unit = max_unit.sap_product_UoMs[0];
87
- }
88
- units.forEach((unit) => {
89
- var _a;
90
- if (max_unit === null || max_unit === void 0 ? void 0 : max_unit.default_unit)
91
- unit.repzo_factor =
92
- (unit.ALTQTY / unit.BASEQTY) * ((_a = max_unit === null || max_unit === void 0 ? void 0 : max_unit.default_unit) === null || _a === void 0 ? void 0 : _a.BASEQTY);
93
- });
94
- });
95
- let unique_UoMs = {};
96
- for (let i = 0; i < (sap_UoMs === null || sap_UoMs === void 0 ? void 0 : sap_UoMs.length); i++) {
97
- const Uom = sap_UoMs[i];
98
- const key = `${Uom.UOMGROUPENTRY}_${Uom.ALTUOMID}`;
99
- if (!unique_UoMs[key])
100
- unique_UoMs[key] = Uom;
50
+ if (
51
+ !(repzo_UoM_parent === null || repzo_UoM_parent === void 0
52
+ ? void 0
53
+ : repzo_UoM_parent.data) ||
54
+ ((_b =
55
+ repzo_UoM_parent === null || repzo_UoM_parent === void 0
56
+ ? void 0
57
+ : repzo_UoM_parent.data) === null || _b === void 0
58
+ ? void 0
59
+ : _b.length) != 1
60
+ )
61
+ throw "the parent of measure unit is not found or the nameSpace has more than one";
62
+ const repzo_parent_id = repzo_UoM_parent.data[0]._id;
63
+ const repzo_UoMs = await repzo.measureunit.find({ per_page: 50000 });
64
+ result.repzo_total =
65
+ (_c =
66
+ repzo_UoMs === null || repzo_UoMs === void 0
67
+ ? void 0
68
+ : repzo_UoMs.data) === null || _c === void 0
69
+ ? void 0
70
+ : _c.length;
71
+ await commandLog
72
+ .addDetail(
73
+ `${
74
+ (_d =
75
+ repzo_UoMs === null || repzo_UoMs === void 0
76
+ ? void 0
77
+ : repzo_UoMs.data) === null || _d === void 0
78
+ ? void 0
79
+ : _d.length
80
+ } Measure Units in Repzo`
81
+ )
82
+ .commit();
83
+ const byProduct = {};
84
+ sap_UoMs.forEach((unit) => {
85
+ if (!byProduct[unit.ITEMCODE]) byProduct[unit.ITEMCODE] = [];
86
+ byProduct[unit.ITEMCODE].push(unit);
87
+ });
88
+ Object.values(byProduct).forEach((units) => {
89
+ var _a, _b, _c;
90
+ const max_unit = {
91
+ sap_product_UoMs: [],
92
+ value: null,
93
+ default_unit: null,
94
+ };
95
+ units.forEach((unit) => {
96
+ if (max_unit.value == null || unit.BASEQTY > max_unit.value) {
97
+ max_unit.value = unit.BASEQTY;
98
+ max_unit.sap_product_UoMs.push(unit);
99
+ } else if (unit.BASEQTY == max_unit.value) {
100
+ max_unit.sap_product_UoMs.push(unit);
101
101
  }
102
- unique_UoMs = Object.values(unique_UoMs);
103
- const db = new DataSet([], { autoIndex: false });
104
- db.createIndex({
105
- ALTUOMCODE: true,
106
- repzo_factor: true,
107
- UOMGROUPENTRY: true,
108
- ALTUOMID: true,
109
- });
110
- db.load(unique_UoMs);
111
- for (let i = 0; i < (unique_UoMs === null || unique_UoMs === void 0 ? void 0 : unique_UoMs.length); i++) {
112
- const sap_UoM = unique_UoMs[i];
113
- const repzo_UoM = repzo_UoMs.data.find((r_UoM) => {
114
- var _a;
115
- return ((_a = r_UoM.integration_meta) === null || _a === void 0 ? void 0 : _a.id) ==
116
- `${nameSpace}_${sap_UoM.UOMGROUPENTRY}_${sap_UoM.ALTUOMID}`;
117
- });
118
- const body = {
119
- parent: repzo_parent_id,
120
- name: sap_UoM.ALTUOMCODE,
121
- factor: sap_UoM.repzo_factor || 0,
122
- disabled: false,
123
- integration_meta: {
124
- id: `${nameSpace}_${sap_UoM.UOMGROUPENTRY}_${sap_UoM.ALTUOMID}`,
125
- UOMGROUPENTRY: sap_UoM.UOMGROUPENTRY,
126
- ALTUOMID: sap_UoM.ALTUOMID,
127
- },
128
- company_namespace: [nameSpace],
129
- };
130
- if (!repzo_UoM) {
131
- // Create
132
- try {
133
- const created_UoM = await repzo.measureunit.create(body);
134
- result.created++;
135
- }
136
- catch (e) {
137
- // console.log("Create Measure Unit Failed >> ", e?.response, body);
138
- failed_docs_report.push({
139
- method: "create",
140
- doc: body,
141
- error_message: set_error(e),
142
- });
143
- result.failed++;
144
- }
145
- }
146
- else {
147
- const found_identical_docs = db.search({
148
- ALTUOMCODE: repzo_UoM.name,
149
- repzo_factor: repzo_UoM.factor,
150
- UOMGROUPENTRY: (_e = repzo_UoM.integration_meta) === null || _e === void 0 ? void 0 : _e.UOMGROUPENTRY,
151
- ALTUOMID: (_f = repzo_UoM.integration_meta) === null || _f === void 0 ? void 0 : _f.ALTUOMID,
152
- });
153
- if (found_identical_docs.length)
154
- continue;
155
- // Update
156
- try {
157
- const updated_UoM = await repzo.measureunit.update(repzo_UoM._id, body);
158
- result.updated++;
159
- }
160
- catch (e) {
161
- // console.log(
162
- // "Update Measure Unit Failed >> ",
163
- // e?.response?.data,
164
- // body
165
- // );
166
- failed_docs_report.push({
167
- method: "update",
168
- doc_id: repzo_UoM === null || repzo_UoM === void 0 ? void 0 : repzo_UoM._id,
169
- doc: body,
170
- error_message: set_error(e),
171
- });
172
- result.failed++;
173
- }
174
- }
102
+ });
103
+ if (max_unit.sap_product_UoMs.length > 1) {
104
+ max_unit.default_unit = max_unit.sap_product_UoMs.find(
105
+ (u) => u.ALTUOMCODE == "PC"
106
+ );
107
+ if (!max_unit.default_unit) {
108
+ // console.log(
109
+ // "Create/Update Measure Unit Failed >> ",
110
+ // `${max_unit?.sap_product_UoMs[0]?.ITEMCODE} Could not found the base_unit`,
111
+ // units
112
+ // );
113
+ failed_docs_report.push({
114
+ method: "create",
115
+ doc_id:
116
+ ((_a =
117
+ max_unit === null || max_unit === void 0
118
+ ? void 0
119
+ : max_unit.sap_product_UoMs[0]) === null || _a === void 0
120
+ ? void 0
121
+ : _a.ITEMCODE) ||
122
+ ((_b = units[0]) === null || _b === void 0
123
+ ? void 0
124
+ : _b.ITEMCODE),
125
+ doc: units,
126
+ error_message: set_error(
127
+ `Create/Update Measure Unit Failed >> ${
128
+ (_c =
129
+ max_unit === null || max_unit === void 0
130
+ ? void 0
131
+ : max_unit.sap_product_UoMs[0]) === null || _c === void 0
132
+ ? void 0
133
+ : _c.ITEMCODE
134
+ } Could not found the base_unit`
135
+ ),
136
+ });
137
+ result.failed++;
138
+ return;
175
139
  }
176
- // console.log(result);
177
- await update_bench_time(repzo, commandEvent.app._id, bench_time_key, new_bench_time);
178
- await commandLog
179
- .setStatus("success", failed_docs_report.length ? failed_docs_report : null)
180
- .setBody(result)
181
- .commit();
182
- return result;
140
+ } else {
141
+ max_unit.default_unit = max_unit.sap_product_UoMs[0];
142
+ }
143
+ units.forEach((unit) => {
144
+ var _a;
145
+ if (
146
+ max_unit === null || max_unit === void 0
147
+ ? void 0
148
+ : max_unit.default_unit
149
+ )
150
+ unit.repzo_factor =
151
+ (unit.ALTQTY / unit.BASEQTY) *
152
+ ((_a =
153
+ max_unit === null || max_unit === void 0
154
+ ? void 0
155
+ : max_unit.default_unit) === null || _a === void 0
156
+ ? void 0
157
+ : _a.BASEQTY);
158
+ });
159
+ });
160
+ let unique_UoMs = {};
161
+ for (
162
+ let i = 0;
163
+ i < (sap_UoMs === null || sap_UoMs === void 0 ? void 0 : sap_UoMs.length);
164
+ i++
165
+ ) {
166
+ const Uom = sap_UoMs[i];
167
+ const key = `${Uom.UOMGROUPENTRY}_${Uom.ALTUOMID}`;
168
+ if (!unique_UoMs[key]) unique_UoMs[key] = Uom;
183
169
  }
184
- catch (e) {
185
- //@ts-ignore
186
- console.error(((_g = e === null || e === void 0 ? void 0 : e.response) === null || _g === void 0 ? void 0 : _g.data) || e);
187
- await commandLog.setStatus("fail", e).commit();
188
- throw e;
170
+ unique_UoMs = Object.values(unique_UoMs);
171
+ const db = new DataSet([], { autoIndex: false });
172
+ db.createIndex({
173
+ ALTUOMCODE: true,
174
+ repzo_factor: true,
175
+ UOMGROUPENTRY: true,
176
+ ALTUOMID: true,
177
+ });
178
+ db.load(unique_UoMs);
179
+ for (
180
+ let i = 0;
181
+ i <
182
+ (unique_UoMs === null || unique_UoMs === void 0
183
+ ? void 0
184
+ : unique_UoMs.length);
185
+ i++
186
+ ) {
187
+ const sap_UoM = unique_UoMs[i];
188
+ const repzo_UoM = repzo_UoMs.data.find((r_UoM) => {
189
+ var _a;
190
+ return (
191
+ ((_a = r_UoM.integration_meta) === null || _a === void 0
192
+ ? void 0
193
+ : _a.id) ==
194
+ `${nameSpace}_${sap_UoM.UOMGROUPENTRY}_${sap_UoM.ALTUOMID}`
195
+ );
196
+ });
197
+ const body = {
198
+ parent: repzo_parent_id,
199
+ name: sap_UoM.ALTUOMCODE,
200
+ factor: sap_UoM.repzo_factor || 0, // ??????
201
+ disabled: false,
202
+ integration_meta: {
203
+ id: `${nameSpace}_${sap_UoM.UOMGROUPENTRY}_${sap_UoM.ALTUOMID}`,
204
+ UOMGROUPENTRY: sap_UoM.UOMGROUPENTRY,
205
+ ALTUOMID: sap_UoM.ALTUOMID,
206
+ },
207
+ company_namespace: [nameSpace],
208
+ };
209
+ if (!repzo_UoM) {
210
+ // Create
211
+ try {
212
+ const created_UoM = await repzo.measureunit.create(body);
213
+ result.created++;
214
+ } catch (e) {
215
+ // console.log("Create Measure Unit Failed >> ", e?.response, body);
216
+ failed_docs_report.push({
217
+ method: "create",
218
+ doc: body,
219
+ error_message: set_error(e),
220
+ });
221
+ result.failed++;
222
+ }
223
+ } else {
224
+ const found_identical_docs = db.search({
225
+ ALTUOMCODE: repzo_UoM.name,
226
+ repzo_factor: repzo_UoM.factor,
227
+ UOMGROUPENTRY:
228
+ (_e = repzo_UoM.integration_meta) === null || _e === void 0
229
+ ? void 0
230
+ : _e.UOMGROUPENTRY,
231
+ ALTUOMID:
232
+ (_f = repzo_UoM.integration_meta) === null || _f === void 0
233
+ ? void 0
234
+ : _f.ALTUOMID,
235
+ });
236
+ if (found_identical_docs.length) continue;
237
+ // Update
238
+ try {
239
+ const updated_UoM = await repzo.measureunit.update(
240
+ repzo_UoM._id,
241
+ body
242
+ );
243
+ result.updated++;
244
+ } catch (e) {
245
+ // console.log(
246
+ // "Update Measure Unit Failed >> ",
247
+ // e?.response?.data,
248
+ // body
249
+ // );
250
+ failed_docs_report.push({
251
+ method: "update",
252
+ doc_id:
253
+ repzo_UoM === null || repzo_UoM === void 0
254
+ ? void 0
255
+ : repzo_UoM._id,
256
+ doc: body,
257
+ error_message: set_error(e),
258
+ });
259
+ result.failed++;
260
+ }
261
+ }
189
262
  }
263
+ // console.log(result);
264
+ await update_bench_time(
265
+ repzo,
266
+ commandEvent.app._id,
267
+ bench_time_key,
268
+ new_bench_time
269
+ );
270
+ await commandLog
271
+ .setStatus(
272
+ "success",
273
+ failed_docs_report.length ? failed_docs_report : null
274
+ )
275
+ .setBody(result)
276
+ .commit();
277
+ return result;
278
+ } catch (e) {
279
+ //@ts-ignore
280
+ console.error(
281
+ ((_g = e === null || e === void 0 ? void 0 : e.response) === null ||
282
+ _g === void 0
283
+ ? void 0
284
+ : _g.data) || e
285
+ );
286
+ await commandLog.setStatus("fail", e).commit();
287
+ throw e;
288
+ }
190
289
  };
191
290
  export const get_sap_UoMs = async (serviceEndPoint, query) => {
192
- try {
193
- const sap_UoMs = await _create(serviceEndPoint, "/Uom", {
194
- Inactive: "N",
195
- Locked: "N",
196
- });
197
- return sap_UoMs === null || sap_UoMs === void 0 ? void 0 : sap_UoMs.UoM;
198
- }
199
- catch (e) {
200
- throw e;
201
- }
291
+ try {
292
+ const sap_UoMs = await _create(serviceEndPoint, "/Uom", {
293
+ Inactive: "N",
294
+ Locked: "N",
295
+ });
296
+ return sap_UoMs === null || sap_UoMs === void 0 ? void 0 : sap_UoMs.UoM;
297
+ } catch (e) {
298
+ throw e;
299
+ }
202
300
  };
@@ -1,10 +1,12 @@
1
1
  import { CommandEvent } from "../types";
2
- export declare const sync_measureunit_family: (commandEvent: CommandEvent) => Promise<{
3
- sap_total: number;
4
- repzo_total: number;
5
- sap_UoM_total: number;
6
- repzo_UoM_total: number;
7
- created: number;
8
- updated: number;
9
- failed: number;
2
+ export declare const sync_measureunit_family: (
3
+ commandEvent: CommandEvent
4
+ ) => Promise<{
5
+ sap_total: number;
6
+ repzo_total: number;
7
+ sap_UoM_total: number;
8
+ repzo_UoM_total: number;
9
+ created: number;
10
+ updated: number;
11
+ failed: number;
10
12
  }>;