@accon/connect 0.0.1

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 (98) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +60 -0
  3. package/coverage/clover.xml +232 -0
  4. package/coverage/coverage-final.json +21 -0
  5. package/coverage/lcov-report/base.css +224 -0
  6. package/coverage/lcov-report/block-navigation.js +87 -0
  7. package/coverage/lcov-report/favicon.png +0 -0
  8. package/coverage/lcov-report/index.html +236 -0
  9. package/coverage/lcov-report/prettify.css +1 -0
  10. package/coverage/lcov-report/prettify.js +2 -0
  11. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  12. package/coverage/lcov-report/sorter.js +196 -0
  13. package/coverage/lcov.info +387 -0
  14. package/dist/core/connect.module.d.ts +2 -0
  15. package/dist/core/connect.module.js +25 -0
  16. package/dist/core/connect.module.js.map +1 -0
  17. package/dist/core/connect.service.d.ts +16 -0
  18. package/dist/core/connect.service.js +60 -0
  19. package/dist/core/connect.service.js.map +1 -0
  20. package/dist/core/decorators/index.d.ts +1 -0
  21. package/dist/core/decorators/index.js +18 -0
  22. package/dist/core/decorators/index.js.map +1 -0
  23. package/dist/core/decorators/registry-integration.decorator.d.ts +3 -0
  24. package/dist/core/decorators/registry-integration.decorator.js +12 -0
  25. package/dist/core/decorators/registry-integration.decorator.js.map +1 -0
  26. package/dist/core/events/events.module.d.ts +2 -0
  27. package/dist/core/events/events.module.js +23 -0
  28. package/dist/core/events/events.module.js.map +1 -0
  29. package/dist/core/events/events.service.d.ts +9 -0
  30. package/dist/core/events/events.service.js +44 -0
  31. package/dist/core/events/events.service.js.map +1 -0
  32. package/dist/core/events/index.d.ts +2 -0
  33. package/dist/core/events/index.js +19 -0
  34. package/dist/core/events/index.js.map +1 -0
  35. package/dist/core/exceptions/index.d.ts +1 -0
  36. package/dist/core/exceptions/index.js +18 -0
  37. package/dist/core/exceptions/index.js.map +1 -0
  38. package/dist/core/exceptions/invalid-order.exception.d.ts +5 -0
  39. package/dist/core/exceptions/invalid-order.exception.js +12 -0
  40. package/dist/core/exceptions/invalid-order.exception.js.map +1 -0
  41. package/dist/core/index.d.ts +7 -0
  42. package/dist/core/index.js +24 -0
  43. package/dist/core/index.js.map +1 -0
  44. package/dist/core/integration-loader.d.ts +1 -0
  45. package/dist/core/integration-loader.js +14 -0
  46. package/dist/core/integration-loader.js.map +1 -0
  47. package/dist/core/integration-registry.service.d.ts +9 -0
  48. package/dist/core/integration-registry.service.js +31 -0
  49. package/dist/core/integration-registry.service.js.map +1 -0
  50. package/dist/core/interfaces/index.d.ts +2 -0
  51. package/dist/core/interfaces/index.js +19 -0
  52. package/dist/core/interfaces/index.js.map +1 -0
  53. package/dist/core/interfaces/integration-meta.interface.d.ts +13 -0
  54. package/dist/core/interfaces/integration-meta.interface.js +3 -0
  55. package/dist/core/interfaces/integration-meta.interface.js.map +1 -0
  56. package/dist/core/interfaces/order-output-integration.interface.d.ts +4 -0
  57. package/dist/core/interfaces/order-output-integration.interface.js +3 -0
  58. package/dist/core/interfaces/order-output-integration.interface.js.map +1 -0
  59. package/dist/core/types/index.d.ts +4 -0
  60. package/dist/core/types/index.js +21 -0
  61. package/dist/core/types/index.js.map +1 -0
  62. package/dist/core/types/integration-category.type.d.ts +1 -0
  63. package/dist/core/types/integration-category.type.js +3 -0
  64. package/dist/core/types/integration-category.type.js.map +1 -0
  65. package/dist/core/types/integration-event-dispatcher.type.d.ts +2 -0
  66. package/dist/core/types/integration-event-dispatcher.type.js +3 -0
  67. package/dist/core/types/integration-event-dispatcher.type.js.map +1 -0
  68. package/dist/core/types/integration-event.type.d.ts +13 -0
  69. package/dist/core/types/integration-event.type.js +13 -0
  70. package/dist/core/types/integration-event.type.js.map +1 -0
  71. package/dist/core/types/integration-type.type.d.ts +1 -0
  72. package/dist/core/types/integration-type.type.js +3 -0
  73. package/dist/core/types/integration-type.type.js.map +1 -0
  74. package/dist/core/types/order.type.d.ts +155 -0
  75. package/dist/core/types/order.type.js +3 -0
  76. package/dist/core/types/order.type.js.map +1 -0
  77. package/dist/index.d.ts +2 -0
  78. package/dist/index.js +19 -0
  79. package/dist/index.js.map +1 -0
  80. package/dist/logistics/foody/dto/create-foody-order-response.dto.d.ts +4 -0
  81. package/dist/logistics/foody/dto/create-foody-order-response.dto.js +9 -0
  82. package/dist/logistics/foody/dto/create-foody-order-response.dto.js.map +1 -0
  83. package/dist/logistics/foody/dto/create-foody-order.dto.d.ts +31 -0
  84. package/dist/logistics/foody/dto/create-foody-order.dto.js +19 -0
  85. package/dist/logistics/foody/dto/create-foody-order.dto.js.map +1 -0
  86. package/dist/logistics/foody/foody.config.d.ts +15 -0
  87. package/dist/logistics/foody/foody.config.js +17 -0
  88. package/dist/logistics/foody/foody.config.js.map +1 -0
  89. package/dist/logistics/foody/foody.order-output.d.ts +15 -0
  90. package/dist/logistics/foody/foody.order-output.js +148 -0
  91. package/dist/logistics/foody/foody.order-output.js.map +1 -0
  92. package/dist/tsconfig.build.tsbuildinfo +1 -0
  93. package/eslint.config.mjs +35 -0
  94. package/index.js +6 -0
  95. package/nest-cli.json +8 -0
  96. package/package.json +76 -0
  97. package/test/jest-e2e.json +9 -0
  98. package/tsconfig.build.json +4 -0
@@ -0,0 +1,196 @@
1
+ /* eslint-disable */
2
+ var addSorting = (function() {
3
+ 'use strict';
4
+ var cols,
5
+ currentSort = {
6
+ index: 0,
7
+ desc: false
8
+ };
9
+
10
+ // returns the summary table element
11
+ function getTable() {
12
+ return document.querySelector('.coverage-summary');
13
+ }
14
+ // returns the thead element of the summary table
15
+ function getTableHeader() {
16
+ return getTable().querySelector('thead tr');
17
+ }
18
+ // returns the tbody element of the summary table
19
+ function getTableBody() {
20
+ return getTable().querySelector('tbody');
21
+ }
22
+ // returns the th element for nth column
23
+ function getNthColumn(n) {
24
+ return getTableHeader().querySelectorAll('th')[n];
25
+ }
26
+
27
+ function onFilterInput() {
28
+ const searchValue = document.getElementById('fileSearch').value;
29
+ const rows = document.getElementsByTagName('tbody')[0].children;
30
+ for (let i = 0; i < rows.length; i++) {
31
+ const row = rows[i];
32
+ if (
33
+ row.textContent
34
+ .toLowerCase()
35
+ .includes(searchValue.toLowerCase())
36
+ ) {
37
+ row.style.display = '';
38
+ } else {
39
+ row.style.display = 'none';
40
+ }
41
+ }
42
+ }
43
+
44
+ // loads the search box
45
+ function addSearchBox() {
46
+ var template = document.getElementById('filterTemplate');
47
+ var templateClone = template.content.cloneNode(true);
48
+ templateClone.getElementById('fileSearch').oninput = onFilterInput;
49
+ template.parentElement.appendChild(templateClone);
50
+ }
51
+
52
+ // loads all columns
53
+ function loadColumns() {
54
+ var colNodes = getTableHeader().querySelectorAll('th'),
55
+ colNode,
56
+ cols = [],
57
+ col,
58
+ i;
59
+
60
+ for (i = 0; i < colNodes.length; i += 1) {
61
+ colNode = colNodes[i];
62
+ col = {
63
+ key: colNode.getAttribute('data-col'),
64
+ sortable: !colNode.getAttribute('data-nosort'),
65
+ type: colNode.getAttribute('data-type') || 'string'
66
+ };
67
+ cols.push(col);
68
+ if (col.sortable) {
69
+ col.defaultDescSort = col.type === 'number';
70
+ colNode.innerHTML =
71
+ colNode.innerHTML + '<span class="sorter"></span>';
72
+ }
73
+ }
74
+ return cols;
75
+ }
76
+ // attaches a data attribute to every tr element with an object
77
+ // of data values keyed by column name
78
+ function loadRowData(tableRow) {
79
+ var tableCols = tableRow.querySelectorAll('td'),
80
+ colNode,
81
+ col,
82
+ data = {},
83
+ i,
84
+ val;
85
+ for (i = 0; i < tableCols.length; i += 1) {
86
+ colNode = tableCols[i];
87
+ col = cols[i];
88
+ val = colNode.getAttribute('data-value');
89
+ if (col.type === 'number') {
90
+ val = Number(val);
91
+ }
92
+ data[col.key] = val;
93
+ }
94
+ return data;
95
+ }
96
+ // loads all row data
97
+ function loadData() {
98
+ var rows = getTableBody().querySelectorAll('tr'),
99
+ i;
100
+
101
+ for (i = 0; i < rows.length; i += 1) {
102
+ rows[i].data = loadRowData(rows[i]);
103
+ }
104
+ }
105
+ // sorts the table using the data for the ith column
106
+ function sortByIndex(index, desc) {
107
+ var key = cols[index].key,
108
+ sorter = function(a, b) {
109
+ a = a.data[key];
110
+ b = b.data[key];
111
+ return a < b ? -1 : a > b ? 1 : 0;
112
+ },
113
+ finalSorter = sorter,
114
+ tableBody = document.querySelector('.coverage-summary tbody'),
115
+ rowNodes = tableBody.querySelectorAll('tr'),
116
+ rows = [],
117
+ i;
118
+
119
+ if (desc) {
120
+ finalSorter = function(a, b) {
121
+ return -1 * sorter(a, b);
122
+ };
123
+ }
124
+
125
+ for (i = 0; i < rowNodes.length; i += 1) {
126
+ rows.push(rowNodes[i]);
127
+ tableBody.removeChild(rowNodes[i]);
128
+ }
129
+
130
+ rows.sort(finalSorter);
131
+
132
+ for (i = 0; i < rows.length; i += 1) {
133
+ tableBody.appendChild(rows[i]);
134
+ }
135
+ }
136
+ // removes sort indicators for current column being sorted
137
+ function removeSortIndicators() {
138
+ var col = getNthColumn(currentSort.index),
139
+ cls = col.className;
140
+
141
+ cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
142
+ col.className = cls;
143
+ }
144
+ // adds sort indicators for current column being sorted
145
+ function addSortIndicators() {
146
+ getNthColumn(currentSort.index).className += currentSort.desc
147
+ ? ' sorted-desc'
148
+ : ' sorted';
149
+ }
150
+ // adds event listeners for all sorter widgets
151
+ function enableUI() {
152
+ var i,
153
+ el,
154
+ ithSorter = function ithSorter(i) {
155
+ var col = cols[i];
156
+
157
+ return function() {
158
+ var desc = col.defaultDescSort;
159
+
160
+ if (currentSort.index === i) {
161
+ desc = !currentSort.desc;
162
+ }
163
+ sortByIndex(i, desc);
164
+ removeSortIndicators();
165
+ currentSort.index = i;
166
+ currentSort.desc = desc;
167
+ addSortIndicators();
168
+ };
169
+ };
170
+ for (i = 0; i < cols.length; i += 1) {
171
+ if (cols[i].sortable) {
172
+ // add the click event handler on the th so users
173
+ // dont have to click on those tiny arrows
174
+ el = getNthColumn(i).querySelector('.sorter').parentElement;
175
+ if (el.addEventListener) {
176
+ el.addEventListener('click', ithSorter(i));
177
+ } else {
178
+ el.attachEvent('onclick', ithSorter(i));
179
+ }
180
+ }
181
+ }
182
+ }
183
+ // adds sorting functionality to the UI
184
+ return function() {
185
+ if (!getTable()) {
186
+ return;
187
+ }
188
+ cols = loadColumns();
189
+ loadData();
190
+ addSearchBox();
191
+ addSortIndicators();
192
+ enableUI();
193
+ };
194
+ })();
195
+
196
+ window.addEventListener('load', addSorting);
@@ -0,0 +1,387 @@
1
+ TN:
2
+ SF:lib/index.ts
3
+ FNF:0
4
+ FNH:0
5
+ DA:1,0
6
+ DA:2,0
7
+ LF:2
8
+ LH:0
9
+ BRF:0
10
+ BRH:0
11
+ end_of_record
12
+ TN:
13
+ SF:lib/core/connect.module.ts
14
+ FNF:0
15
+ FNH:0
16
+ DA:1,1
17
+ DA:2,1
18
+ DA:3,1
19
+ DA:4,1
20
+ DA:5,1
21
+ DA:12,1
22
+ LF:6
23
+ LH:6
24
+ BRF:0
25
+ BRH:0
26
+ end_of_record
27
+ TN:
28
+ SF:lib/core/connect.service.ts
29
+ FN:12,(anonymous_2)
30
+ FN:14,(anonymous_3)
31
+ FN:18,(anonymous_4)
32
+ FN:22,(anonymous_5)
33
+ FN:30,(anonymous_6)
34
+ FNF:5
35
+ FNH:5
36
+ FNDA:6,(anonymous_2)
37
+ FNDA:1,(anonymous_3)
38
+ FNDA:5,(anonymous_4)
39
+ FNDA:5,(anonymous_5)
40
+ FNDA:10,(anonymous_6)
41
+ DA:1,2
42
+ DA:2,2
43
+ DA:3,2
44
+ DA:5,2
45
+ DA:6,2
46
+ DA:9,2
47
+ DA:10,6
48
+ DA:12,6
49
+ DA:15,1
50
+ DA:19,5
51
+ DA:26,5
52
+ DA:28,5
53
+ DA:29,5
54
+ DA:30,10
55
+ DA:33,5
56
+ DA:34,1
57
+ DA:35,1
58
+ DA:38,4
59
+ DA:40,4
60
+ DA:41,4
61
+ DA:44,4
62
+ DA:45,1
63
+ DA:48,1
64
+ DA:51,3
65
+ DA:52,1
66
+ DA:56,2
67
+ LF:26
68
+ LH:26
69
+ BRDA:33,0,0,1
70
+ BRDA:44,1,0,1
71
+ BRF:2
72
+ BRH:2
73
+ end_of_record
74
+ TN:
75
+ SF:lib/core/index.ts
76
+ FNF:0
77
+ FNH:0
78
+ DA:1,1
79
+ DA:2,1
80
+ DA:3,1
81
+ DA:4,1
82
+ DA:5,1
83
+ DA:6,1
84
+ DA:7,1
85
+ LF:7
86
+ LH:7
87
+ BRF:0
88
+ BRH:0
89
+ end_of_record
90
+ TN:
91
+ SF:lib/core/integration-loader.ts
92
+ FN:3,loadIntegrationFiles
93
+ FNF:1
94
+ FNH:1
95
+ FNDA:2,loadIntegrationFiles
96
+ DA:1,2
97
+ DA:3,2
98
+ DA:7,2
99
+ DA:11,2
100
+ DA:12,2
101
+ LF:5
102
+ LH:5
103
+ BRDA:5,0,0,0
104
+ BRF:1
105
+ BRH:0
106
+ end_of_record
107
+ TN:
108
+ SF:lib/core/integration-registry.service.ts
109
+ FN:11,(anonymous_1)
110
+ FN:12,(anonymous_2)
111
+ FN:24,(anonymous_3)
112
+ FNF:3
113
+ FNH:3
114
+ FNDA:10,(anonymous_1)
115
+ FNDA:8,(anonymous_2)
116
+ FNDA:8,(anonymous_3)
117
+ DA:1,3
118
+ DA:5,3
119
+ DA:9,3
120
+ DA:12,10
121
+ DA:13,10
122
+ DA:14,1
123
+ DA:18,1
124
+ DA:21,9
125
+ DA:25,8
126
+ LF:9
127
+ LH:9
128
+ BRDA:13,0,0,1
129
+ BRF:1
130
+ BRH:1
131
+ end_of_record
132
+ TN:
133
+ SF:lib/core/decorators/index.ts
134
+ FNF:0
135
+ FNH:0
136
+ DA:1,1
137
+ LF:1
138
+ LH:1
139
+ BRF:0
140
+ BRH:0
141
+ end_of_record
142
+ TN:
143
+ SF:lib/core/decorators/registry-integration.decorator.ts
144
+ FN:5,RegistryIntegration
145
+ FN:6,(anonymous_1)
146
+ FNF:2
147
+ FNH:2
148
+ FNDA:1,RegistryIntegration
149
+ FNDA:1,(anonymous_1)
150
+ DA:1,1
151
+ DA:2,1
152
+ DA:5,1
153
+ DA:6,1
154
+ DA:7,1
155
+ DA:8,1
156
+ LF:6
157
+ LH:6
158
+ BRF:0
159
+ BRH:0
160
+ end_of_record
161
+ TN:
162
+ SF:lib/core/events/events.module.ts
163
+ FNF:0
164
+ FNH:0
165
+ DA:1,1
166
+ DA:2,1
167
+ DA:3,1
168
+ DA:10,1
169
+ LF:4
170
+ LH:4
171
+ BRF:0
172
+ BRH:0
173
+ end_of_record
174
+ TN:
175
+ SF:lib/core/events/events.service.ts
176
+ FN:11,(anonymous_2)
177
+ FN:13,(anonymous_3)
178
+ FN:20,(anonymous_4)
179
+ FN:24,(anonymous_5)
180
+ FNF:4
181
+ FNH:4
182
+ FNDA:1,(anonymous_2)
183
+ FNDA:1,(anonymous_3)
184
+ FNDA:1,(anonymous_4)
185
+ FNDA:1,(anonymous_5)
186
+ DA:1,2
187
+ DA:2,2
188
+ DA:6,2
189
+ DA:10,2
190
+ DA:11,1
191
+ DA:14,1
192
+ DA:24,1
193
+ DA:30,1
194
+ LF:8
195
+ LH:8
196
+ BRF:0
197
+ BRH:0
198
+ end_of_record
199
+ TN:
200
+ SF:lib/core/events/index.ts
201
+ FNF:0
202
+ FNH:0
203
+ DA:1,1
204
+ DA:2,1
205
+ LF:2
206
+ LH:2
207
+ BRF:0
208
+ BRH:0
209
+ end_of_record
210
+ TN:
211
+ SF:lib/core/exceptions/index.ts
212
+ FNF:0
213
+ FNH:0
214
+ DA:1,1
215
+ LF:1
216
+ LH:1
217
+ BRF:0
218
+ BRH:0
219
+ end_of_record
220
+ TN:
221
+ SF:lib/core/exceptions/invalid-order.exception.ts
222
+ FN:4,(anonymous_0)
223
+ FNF:1
224
+ FNH:1
225
+ FNDA:3,(anonymous_0)
226
+ DA:3,1
227
+ DA:6,3
228
+ DA:8,3
229
+ LF:3
230
+ LH:3
231
+ BRF:0
232
+ BRH:0
233
+ end_of_record
234
+ TN:
235
+ SF:lib/core/interfaces/index.ts
236
+ FNF:0
237
+ FNH:0
238
+ DA:1,1
239
+ DA:2,1
240
+ LF:2
241
+ LH:2
242
+ BRF:0
243
+ BRH:0
244
+ end_of_record
245
+ TN:
246
+ SF:lib/core/types/index.ts
247
+ FNF:0
248
+ FNH:0
249
+ DA:1,1
250
+ DA:2,1
251
+ DA:3,1
252
+ DA:4,1
253
+ LF:4
254
+ LH:4
255
+ BRF:0
256
+ BRH:0
257
+ end_of_record
258
+ TN:
259
+ SF:lib/core/types/integration-event.type.ts
260
+ FNF:0
261
+ FNH:0
262
+ DA:23,2
263
+ LF:1
264
+ LH:1
265
+ BRF:0
266
+ BRH:0
267
+ end_of_record
268
+ TN:
269
+ SF:lib/logistics/foody/foody.config.ts
270
+ FNF:0
271
+ FNH:0
272
+ DA:3,1
273
+ LF:1
274
+ LH:1
275
+ BRF:0
276
+ BRH:0
277
+ end_of_record
278
+ TN:
279
+ SF:lib/logistics/foody/foody.order-output.ts
280
+ FN:35,(anonymous_2)
281
+ FN:45,(anonymous_3)
282
+ FN:102,(anonymous_4)
283
+ FN:139,(anonymous_5)
284
+ FN:148,(anonymous_6)
285
+ FNF:5
286
+ FNH:5
287
+ FNDA:13,(anonymous_2)
288
+ FNDA:5,(anonymous_3)
289
+ FNDA:19,(anonymous_4)
290
+ FNDA:7,(anonymous_5)
291
+ FNDA:1,(anonymous_6)
292
+ DA:1,1
293
+ DA:2,1
294
+ DA:10,1
295
+ DA:12,1
296
+ DA:13,1
297
+ DA:15,1
298
+ DA:30,1
299
+ DA:31,13
300
+ DA:32,13
301
+ DA:36,13
302
+ DA:37,13
303
+ DA:39,13
304
+ DA:46,5
305
+ DA:47,5
306
+ DA:48,1
307
+ DA:49,1
308
+ DA:52,4
309
+ DA:53,4
310
+ DA:54,4
311
+ DA:57,4
312
+ DA:58,4
313
+ DA:59,3
314
+ DA:61,3
315
+ DA:62,3
316
+ DA:74,2
317
+ DA:75,2
318
+ DA:80,2
319
+ DA:81,1
320
+ DA:85,1
321
+ DA:90,1
322
+ DA:94,1
323
+ DA:105,19
324
+ DA:106,5
325
+ DA:109,14
326
+ DA:110,13
327
+ DA:111,13
328
+ DA:113,1
329
+ DA:123,9
330
+ DA:125,1
331
+ DA:127,1
332
+ DA:131,2
333
+ DA:136,2
334
+ DA:140,7
335
+ DA:141,7
336
+ DA:142,3
337
+ DA:147,4
338
+ DA:148,1
339
+ DA:151,4
340
+ LF:48
341
+ LH:48
342
+ BRDA:47,0,0,1
343
+ BRDA:80,1,0,1
344
+ BRDA:80,1,1,1
345
+ BRDA:105,2,0,5
346
+ BRDA:105,3,0,19
347
+ BRDA:105,3,1,5
348
+ BRDA:109,4,0,13
349
+ BRDA:111,5,0,1
350
+ BRDA:111,5,1,1
351
+ BRDA:111,5,2,2
352
+ BRDA:111,5,3,3
353
+ BRDA:111,5,4,4
354
+ BRDA:111,5,5,5
355
+ BRDA:111,5,6,6
356
+ BRDA:111,5,7,7
357
+ BRDA:111,5,8,8
358
+ BRDA:111,5,9,9
359
+ BRDA:111,5,10,1
360
+ BRDA:111,5,11,1
361
+ BRDA:141,6,0,3
362
+ BRDA:141,7,0,7
363
+ BRDA:141,7,1,5
364
+ BRF:22
365
+ BRH:22
366
+ end_of_record
367
+ TN:
368
+ SF:lib/logistics/foody/dto/create-foody-order-response.dto.ts
369
+ FNF:0
370
+ FNH:0
371
+ DA:1,0
372
+ DA:3,0
373
+ LF:2
374
+ LH:0
375
+ BRF:0
376
+ BRH:0
377
+ end_of_record
378
+ TN:
379
+ SF:lib/logistics/foody/dto/create-foody-order.dto.ts
380
+ FNF:0
381
+ FNH:0
382
+ DA:1,0
383
+ LF:1
384
+ LH:0
385
+ BRF:0
386
+ BRH:0
387
+ end_of_record
@@ -0,0 +1,2 @@
1
+ export declare class AcconConnectModule {
2
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AcconConnectModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const integration_registry_service_1 = require("./integration-registry.service");
12
+ const connect_service_1 = require("./connect.service");
13
+ const events_1 = require("./events");
14
+ const axios_1 = require("@nestjs/axios");
15
+ let AcconConnectModule = class AcconConnectModule {
16
+ };
17
+ exports.AcconConnectModule = AcconConnectModule;
18
+ exports.AcconConnectModule = AcconConnectModule = __decorate([
19
+ (0, common_1.Module)({
20
+ imports: [events_1.EventsModule, axios_1.HttpModule],
21
+ providers: [connect_service_1.ConnectService, integration_registry_service_1.IntegrationRegistryService],
22
+ exports: [connect_service_1.ConnectService],
23
+ })
24
+ ], AcconConnectModule);
25
+ //# sourceMappingURL=connect.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect.module.js","sourceRoot":"","sources":["../../lib/core/connect.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,iFAA4E;AAC5E,uDAAmD;AACnD,qCAAwC;AACxC,yCAA2C;AAOpC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAAG,CAAA;AAArB,gDAAkB;6BAAlB,kBAAkB;IAL9B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,qBAAY,EAAE,kBAAU,CAAC;QACnC,SAAS,EAAE,CAAC,gCAAc,EAAE,yDAA0B,CAAC;QACvD,OAAO,EAAE,CAAC,gCAAc,CAAC;KAC1B,CAAC;GACW,kBAAkB,CAAG"}
@@ -0,0 +1,16 @@
1
+ import { OnModuleInit } from '@nestjs/common';
2
+ import { ModuleRef } from '@nestjs/core';
3
+ import { IntegrationMeta, Order } from '.';
4
+ export declare class ConnectService implements OnModuleInit {
5
+ private moduleRef;
6
+ private readonly logger;
7
+ constructor(moduleRef: ModuleRef);
8
+ onModuleInit(): Promise<void>;
9
+ findAll(): {
10
+ meta: IntegrationMeta;
11
+ integrationClass: Function;
12
+ }[];
13
+ onOrderCreated(integrations: Record<string, unknown>, payload: {
14
+ order: Order;
15
+ }): Promise<void>;
16
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var ConnectService_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.ConnectService = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const core_1 = require("@nestjs/core");
16
+ const integration_registry_service_1 = require("./integration-registry.service");
17
+ const integration_loader_1 = require("./integration-loader");
18
+ const path = require("node:path");
19
+ let ConnectService = ConnectService_1 = class ConnectService {
20
+ moduleRef;
21
+ logger = new common_1.Logger(ConnectService_1.name);
22
+ constructor(moduleRef) {
23
+ this.moduleRef = moduleRef;
24
+ }
25
+ async onModuleInit() {
26
+ await (0, integration_loader_1.loadIntegrationFiles)(path.join(__dirname, '..'));
27
+ }
28
+ findAll() {
29
+ return integration_registry_service_1.IntegrationRegistryService.getIntegrations();
30
+ }
31
+ async onOrderCreated(integrations, payload) {
32
+ const allIntegrations = this.findAll();
33
+ for (const [integrationId, config] of Object.entries(integrations)) {
34
+ const integrationEntry = allIntegrations.find(({ meta }) => meta.id === integrationId);
35
+ if (!integrationEntry) {
36
+ this.logger.warn(`Integration ${integrationId} not found`);
37
+ continue;
38
+ }
39
+ const { integrationClass } = integrationEntry;
40
+ try {
41
+ const instance = await this.moduleRef.create(integrationClass);
42
+ if (typeof instance.onOrderCreated !== 'function') {
43
+ this.logger.warn(`Integration ${integrationId} does not implement onOrderCreated`);
44
+ continue;
45
+ }
46
+ await instance.onOrderCreated(payload.order, config);
47
+ this.logger.log(`Integration ${integrationId} processed order ${payload.order.id}`);
48
+ }
49
+ catch (err) {
50
+ this.logger.error(`Failed to run integration ${integrationId} for order ${payload.order.id}`, err.stack);
51
+ }
52
+ }
53
+ }
54
+ };
55
+ exports.ConnectService = ConnectService;
56
+ exports.ConnectService = ConnectService = ConnectService_1 = __decorate([
57
+ (0, common_1.Injectable)(),
58
+ __metadata("design:paramtypes", [core_1.ModuleRef])
59
+ ], ConnectService);
60
+ //# sourceMappingURL=connect.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect.service.js","sourceRoot":"","sources":["../../lib/core/connect.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAwE;AACxE,uCAAyC;AACzC,iFAA4E;AAE5E,6DAA4D;AAC5D,kCAAkC;AAG3B,IAAM,cAAc,sBAApB,MAAM,cAAc;IAGL;IAFH,MAAM,GAAG,IAAI,eAAM,CAAC,gBAAc,CAAC,IAAI,CAAC,CAAC;IAE1D,YAAoB,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAE5C,KAAK,CAAC,YAAY;QAChB,MAAM,IAAA,yCAAoB,EAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IACzD,CAAC;IAED,OAAO;QACL,OAAO,yDAA0B,CAAC,eAAe,EAAE,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,YAAqC,EACrC,OAAyB;QAEzB,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAEvC,KAAK,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YACnE,MAAM,gBAAgB,GAAG,eAAe,CAAC,IAAI,CAC3C,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,aAAa,CACxC,CAAC;YAEF,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,aAAa,YAAY,CAAC,CAAC;gBAC3D,SAAS;YACX,CAAC;YAED,MAAM,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,CAAC;YAE9C,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAC1C,gBAA6B,CAC9B,CAAC;gBACF,IAAI,OAAO,QAAQ,CAAC,cAAc,KAAK,UAAU,EAAE,CAAC;oBAClD,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,eAAe,aAAa,oCAAoC,CACjE,CAAC;oBACF,SAAS;gBACX,CAAC;gBAED,MAAM,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBACrD,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,eAAe,aAAa,oBAAoB,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,CACnE,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,6BAA6B,aAAa,cAAc,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAC1E,GAAG,CAAC,KAAK,CACV,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAtDY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;qCAIoB,gBAAS;GAH7B,cAAc,CAsD1B"}
@@ -0,0 +1 @@
1
+ export * from './registry-integration.decorator';