@hahnpro/flow-sdk 5.0.0-0 → 5.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 +1 -1
  2. package/README.md +1 -1
  3. package/dist/FlowApplication.d.ts +53 -14
  4. package/dist/FlowApplication.js +266 -85
  5. package/dist/FlowElement.d.ts +12 -4
  6. package/dist/FlowElement.js +47 -48
  7. package/dist/FlowEvent.d.ts +7 -1
  8. package/dist/FlowEvent.js +5 -5
  9. package/dist/FlowLogger.d.ts +9 -6
  10. package/dist/FlowLogger.js +17 -18
  11. package/dist/FlowModule.d.ts +1 -1
  12. package/dist/FlowModule.js +3 -3
  13. package/dist/RpcClient.d.ts +5 -3
  14. package/dist/RpcClient.js +23 -9
  15. package/dist/TestModule.js +6 -6
  16. package/dist/amqp.d.ts +14 -0
  17. package/dist/amqp.js +13 -0
  18. package/dist/extra-validators.js +15 -8
  19. package/dist/flow.interface.d.ts +7 -1
  20. package/dist/flow.interface.js +7 -0
  21. package/dist/index.d.ts +2 -1
  22. package/dist/index.js +2 -1
  23. package/dist/rpc_server.py +89 -77
  24. package/dist/unit-decorators.d.ts +39 -0
  25. package/dist/unit-decorators.js +157 -0
  26. package/dist/unit-utils.d.ts +8 -0
  27. package/dist/unit-utils.js +144 -0
  28. package/dist/units.d.ts +31 -0
  29. package/dist/units.js +570 -0
  30. package/dist/utils.d.ts +5 -1
  31. package/dist/utils.js +40 -7
  32. package/package.json +35 -33
  33. package/dist/api/Queue.d.ts +0 -15
  34. package/dist/api/Queue.js +0 -25
  35. package/dist/api/api.d.ts +0 -22
  36. package/dist/api/api.interface.d.ts +0 -14
  37. package/dist/api/api.interface.js +0 -2
  38. package/dist/api/api.js +0 -38
  39. package/dist/api/asset.interface.d.ts +0 -45
  40. package/dist/api/asset.interface.js +0 -2
  41. package/dist/api/asset.service.d.ts +0 -8
  42. package/dist/api/asset.service.js +0 -18
  43. package/dist/api/content.interface.d.ts +0 -33
  44. package/dist/api/content.interface.js +0 -2
  45. package/dist/api/content.service.d.ts +0 -9
  46. package/dist/api/content.service.js +0 -22
  47. package/dist/api/data.interface.d.ts +0 -29
  48. package/dist/api/data.interface.js +0 -2
  49. package/dist/api/data.service.d.ts +0 -15
  50. package/dist/api/data.service.js +0 -50
  51. package/dist/api/endpoint.interface.d.ts +0 -18
  52. package/dist/api/endpoint.interface.js +0 -2
  53. package/dist/api/endpoint.service.d.ts +0 -7
  54. package/dist/api/endpoint.service.js +0 -14
  55. package/dist/api/http.service.d.ts +0 -29
  56. package/dist/api/http.service.js +0 -96
  57. package/dist/api/index.d.ts +0 -11
  58. package/dist/api/index.js +0 -15
  59. package/dist/api/mock/api.mock.d.ts +0 -102
  60. package/dist/api/mock/api.mock.js +0 -81
  61. package/dist/api/mock/asset.mock.service.d.ts +0 -9
  62. package/dist/api/mock/asset.mock.service.js +0 -18
  63. package/dist/api/mock/content.mock.service.d.ts +0 -9
  64. package/dist/api/mock/content.mock.service.js +0 -21
  65. package/dist/api/mock/data.mock.service.d.ts +0 -11
  66. package/dist/api/mock/data.mock.service.js +0 -53
  67. package/dist/api/mock/endpoint.mock.service.d.ts +0 -10
  68. package/dist/api/mock/endpoint.mock.service.js +0 -15
  69. package/dist/api/mock/index.d.ts +0 -7
  70. package/dist/api/mock/index.js +0 -10
  71. package/dist/api/mock/secret.mock.service.d.ts +0 -5
  72. package/dist/api/mock/secret.mock.service.js +0 -11
  73. package/dist/api/mock/task.mock.service.d.ts +0 -8
  74. package/dist/api/mock/task.mock.service.js +0 -16
  75. package/dist/api/mock/timeseries.mock.service.d.ts +0 -18
  76. package/dist/api/mock/timeseries.mock.service.js +0 -70
  77. package/dist/api/mock/user.mock.service.d.ts +0 -7
  78. package/dist/api/mock/user.mock.service.js +0 -12
  79. package/dist/api/secret.interface.d.ts +0 -9
  80. package/dist/api/secret.interface.js +0 -2
  81. package/dist/api/secret.service.d.ts +0 -6
  82. package/dist/api/secret.service.js +0 -10
  83. package/dist/api/sidriveiq.interface.d.ts +0 -104
  84. package/dist/api/sidriveiq.interface.js +0 -2
  85. package/dist/api/sidriveiq.service.d.ts +0 -31
  86. package/dist/api/sidriveiq.service.js +0 -97
  87. package/dist/api/task.interface.d.ts +0 -26
  88. package/dist/api/task.interface.js +0 -2
  89. package/dist/api/task.service.d.ts +0 -7
  90. package/dist/api/task.service.js +0 -13
  91. package/dist/api/timeseries.interface.d.ts +0 -51
  92. package/dist/api/timeseries.interface.js +0 -2
  93. package/dist/api/timeseries.service.d.ts +0 -17
  94. package/dist/api/timeseries.service.js +0 -38
  95. package/dist/api/user.interface.d.ts +0 -3
  96. package/dist/api/user.interface.js +0 -2
  97. package/dist/api/user.service.d.ts +0 -7
  98. package/dist/api/user.service.js +0 -21
package/dist/units.js ADDED
@@ -0,0 +1,570 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.units = exports.dimensionToUnitMap = void 0;
4
+ exports.dimensionToUnitMap = {
5
+ T: 'time',
6
+ L: 'length',
7
+ M: 'mass',
8
+ I: 'electricCurrent',
9
+ Θ: 'thermodynamicTemperature',
10
+ N: 'amountOfSubstance',
11
+ J: 'luminousIntensity',
12
+ U: 'voltage',
13
+ F: 'force',
14
+ E: 'energy',
15
+ W: 'power',
16
+ P: 'pressure',
17
+ A: 'angle',
18
+ V: 'volume',
19
+ f: 'frequency',
20
+ };
21
+ exports.units = {
22
+ time: {
23
+ units: [
24
+ {
25
+ unit: 's',
26
+ conversionFactor: 1,
27
+ SIPrefixes: false,
28
+ },
29
+ {
30
+ unit: 'min',
31
+ conversionFactor: 60,
32
+ SIPrefixes: false,
33
+ },
34
+ {
35
+ unit: 'h',
36
+ conversionFactor: 60 * 60,
37
+ SIPrefixes: false,
38
+ },
39
+ {
40
+ unit: 'd',
41
+ conversionFactor: 60 * 60 * 24,
42
+ SIPrefixes: false,
43
+ },
44
+ {
45
+ unit: 'w',
46
+ conversionFactor: 60 * 60 * 24 * 7,
47
+ SIPrefixes: false,
48
+ },
49
+ {
50
+ unit: 'j',
51
+ conversionFactor: 60 * 60 * 24 * 365,
52
+ SIPrefixes: false,
53
+ },
54
+ ],
55
+ baseUnit: 's',
56
+ dimensions: ['T'],
57
+ },
58
+ length: {
59
+ units: [
60
+ {
61
+ unit: 'm',
62
+ conversionFactor: 1,
63
+ SIPrefixes: true,
64
+ },
65
+ {
66
+ unit: 'in',
67
+ conversionFactor: 1 / 39.3701,
68
+ SIPrefixes: false,
69
+ },
70
+ {
71
+ unit: 'ft',
72
+ conversionFactor: 1 / 3.28084,
73
+ SIPrefixes: false,
74
+ },
75
+ {
76
+ unit: 'yd',
77
+ conversionFactor: 1 / 0.9144,
78
+ SIPrefixes: false,
79
+ },
80
+ {
81
+ unit: 'mi',
82
+ conversionFactor: 1 / 1609.34,
83
+ SIPrefixes: false,
84
+ },
85
+ ],
86
+ baseUnit: 'm',
87
+ dimensions: ['L'],
88
+ },
89
+ mass: {
90
+ units: [
91
+ {
92
+ unit: 'g',
93
+ conversionFactor: 0.001,
94
+ SIPrefixes: true,
95
+ },
96
+ {
97
+ unit: 'lbs',
98
+ conversionFactor: 0.45359237,
99
+ SIPrefixes: false,
100
+ },
101
+ ],
102
+ baseUnit: 'kg',
103
+ dimensions: ['M'],
104
+ },
105
+ electricCurrent: {
106
+ units: [
107
+ {
108
+ unit: 'A',
109
+ conversionFactor: 1,
110
+ SIPrefixes: true,
111
+ },
112
+ ],
113
+ baseUnit: 'A',
114
+ dimensions: ['I'],
115
+ },
116
+ thermodynamicTemperature: {
117
+ units: [
118
+ {
119
+ unit: 'K',
120
+ conversionFactor: 1,
121
+ SIPrefixes: true,
122
+ offset: 0,
123
+ },
124
+ {
125
+ unit: 'C',
126
+ conversionFactor: 1,
127
+ SIPrefixes: false,
128
+ offset: 273.15,
129
+ },
130
+ {
131
+ unit: 'F',
132
+ conversionFactor: 5 / 9,
133
+ SIPrefixes: false,
134
+ offset: 255.372,
135
+ },
136
+ ],
137
+ baseUnit: 'K',
138
+ dimensions: ['Θ'],
139
+ },
140
+ amountOfSubstance: {
141
+ units: [
142
+ {
143
+ unit: 'mol',
144
+ conversionFactor: 1,
145
+ SIPrefixes: false,
146
+ },
147
+ ],
148
+ baseUnit: 'mol',
149
+ dimensions: ['N'],
150
+ },
151
+ luminousIntensity: {
152
+ units: [
153
+ {
154
+ unit: 'cd',
155
+ conversionFactor: 1,
156
+ SIPrefixes: true,
157
+ },
158
+ ],
159
+ baseUnit: 'cd',
160
+ dimensions: ['J'],
161
+ },
162
+ voltage: {
163
+ units: [
164
+ {
165
+ unit: 'V',
166
+ conversionFactor: 1,
167
+ SIPrefixes: true,
168
+ },
169
+ ],
170
+ baseUnit: 'V',
171
+ dimensions: ['U', 'M*L2*I−1*T−3'],
172
+ },
173
+ force: {
174
+ units: [
175
+ {
176
+ unit: 'N',
177
+ conversionFactor: 1,
178
+ SIPrefixes: true,
179
+ },
180
+ {
181
+ unit: 'lbf',
182
+ conversionFactor: 4.4482,
183
+ SIPrefixes: false,
184
+ },
185
+ {
186
+ unit: 'gf',
187
+ conversionFactor: 0.00980665,
188
+ SIPrefixes: false,
189
+ },
190
+ {
191
+ unit: 'kgf',
192
+ conversionFactor: 9.80665,
193
+ SIPrefixes: false,
194
+ },
195
+ ],
196
+ baseUnit: 'N',
197
+ dimensions: ['F', 'L*M*T-2'],
198
+ },
199
+ energy: {
200
+ units: [
201
+ {
202
+ unit: 'J',
203
+ conversionFactor: 1,
204
+ SIPrefixes: true,
205
+ },
206
+ {
207
+ unit: 'Btu',
208
+ conversionFactor: 1055,
209
+ SIPrefixes: true,
210
+ },
211
+ ],
212
+ baseUnit: 'J',
213
+ dimensions: ['E', 'M*L2*T-2'],
214
+ },
215
+ power: {
216
+ units: [
217
+ {
218
+ unit: 'W',
219
+ conversionFactor: 1,
220
+ SIPrefixes: true,
221
+ },
222
+ {
223
+ unit: 'PS',
224
+ conversionFactor: 735.49875,
225
+ SIPrefixes: false,
226
+ },
227
+ {
228
+ unit: 'hp',
229
+ conversionFactor: 745.7,
230
+ SIPrefixes: false,
231
+ },
232
+ ],
233
+ baseUnit: 'W',
234
+ dimensions: ['W', 'E*T-1', 'M*L2*T-3'],
235
+ },
236
+ pressure: {
237
+ units: [
238
+ {
239
+ unit: 'Pa',
240
+ conversionFactor: 1,
241
+ SIPrefixes: true,
242
+ },
243
+ {
244
+ unit: 'bar',
245
+ conversionFactor: 100000,
246
+ SIPrefixes: true,
247
+ },
248
+ {
249
+ unit: 'at',
250
+ conversionFactor: 98066.5,
251
+ SIPrefixes: false,
252
+ },
253
+ {
254
+ unit: 'atm',
255
+ conversionFactor: 101325,
256
+ SIPrefixes: false,
257
+ },
258
+ {
259
+ unit: 'Torr',
260
+ conversionFactor: 133.322368421,
261
+ SIPrefixes: true,
262
+ },
263
+ ],
264
+ baseUnit: 'Pa',
265
+ dimensions: ['P', 'F*L-2', 'E*L-3', 'M*L-1*T-2'],
266
+ },
267
+ frequency: {
268
+ units: [
269
+ {
270
+ unit: 'Hz',
271
+ conversionFactor: 1,
272
+ SIPrefixes: true,
273
+ },
274
+ ],
275
+ baseUnit: 'Hz',
276
+ dimensions: ['f', 'T-1'],
277
+ },
278
+ area: {
279
+ units: [
280
+ {
281
+ unit: 'm^2',
282
+ conversionFactor: 1,
283
+ SIPrefixes: false,
284
+ },
285
+ {
286
+ unit: 'are',
287
+ conversionFactor: 100,
288
+ SIPrefixes: false,
289
+ },
290
+ {
291
+ unit: 'hectare',
292
+ conversionFactor: 10000,
293
+ SIPrefixes: false,
294
+ },
295
+ {
296
+ unit: 'acre',
297
+ conversionFactor: 4046.86,
298
+ SIPrefixes: false,
299
+ },
300
+ ],
301
+ baseUnit: 'm^2',
302
+ dimensions: ['L2'],
303
+ },
304
+ volume: {
305
+ units: [
306
+ {
307
+ unit: 'm^3',
308
+ conversionFactor: 1,
309
+ SIPrefixes: false,
310
+ },
311
+ {
312
+ unit: 'barrel',
313
+ conversionFactor: 0.158987294928,
314
+ SIPrefixes: false,
315
+ },
316
+ {
317
+ unit: 'litre',
318
+ conversionFactor: 0.001,
319
+ SIPrefixes: false,
320
+ },
321
+ {
322
+ unit: 'gallon',
323
+ conversionFactor: 0.003785411784,
324
+ SIPrefixes: false,
325
+ },
326
+ {
327
+ unit: 'pint',
328
+ conversionFactor: 0.000473176473,
329
+ SIPrefixes: false,
330
+ },
331
+ ],
332
+ baseUnit: 'm^3',
333
+ dimensions: ['L3', 'V'],
334
+ },
335
+ angle: {
336
+ units: [
337
+ {
338
+ unit: 'rad',
339
+ conversionFactor: 1,
340
+ SIPrefixes: true,
341
+ },
342
+ {
343
+ unit: 'deg',
344
+ conversionFactor: 57.2958,
345
+ SIPrefixes: true,
346
+ },
347
+ {
348
+ unit: 'turn',
349
+ conversionFactor: 1 / (2 * Math.PI),
350
+ SIPrefixes: true,
351
+ },
352
+ {
353
+ unit: 'gon',
354
+ conversionFactor: 63.662,
355
+ SIPrefixes: true,
356
+ },
357
+ ],
358
+ baseUnit: 'rad',
359
+ dimensions: ['A', 'L*L-1'],
360
+ },
361
+ translationalAcceleration: {
362
+ units: [
363
+ {
364
+ unit: 'm/s^2',
365
+ conversionFactor: 1,
366
+ SIPrefixes: false,
367
+ },
368
+ {
369
+ unit: 'Gal',
370
+ conversionFactor: 0.01,
371
+ SIPrefixes: false,
372
+ },
373
+ {
374
+ unit: 'g0',
375
+ conversionFactor: 9.80665,
376
+ SIPrefixes: false,
377
+ },
378
+ ],
379
+ baseUnit: 'm/s^2',
380
+ dimensions: ['L*T-2'],
381
+ },
382
+ translationalVelocity: {
383
+ units: [
384
+ {
385
+ unit: 'm/s',
386
+ conversionFactor: 1,
387
+ SIPrefixes: false,
388
+ },
389
+ ],
390
+ baseUnit: 'm/s',
391
+ dimensions: ['L*T-1'],
392
+ },
393
+ get translationalDisplacement() {
394
+ return this.length;
395
+ },
396
+ springConstant: {
397
+ units: [
398
+ {
399
+ unit: 'N/m',
400
+ conversionFactor: 1,
401
+ SIPrefixes: false,
402
+ },
403
+ ],
404
+ baseUnit: 'N/m',
405
+ dimensions: ['F*L-1', 'M*T-2'],
406
+ },
407
+ rotationalAcceleration: {
408
+ units: [
409
+ {
410
+ unit: 'rad/s^2',
411
+ conversionFactor: 1,
412
+ SIPrefixes: false,
413
+ },
414
+ ],
415
+ baseUnit: 'rad/s^2',
416
+ dimensions: ['A*T-2', 'L*L-1*T-2', 'T-2'],
417
+ },
418
+ rotationalVelocity: {
419
+ units: [
420
+ {
421
+ unit: 'rad/s',
422
+ conversionFactor: 1,
423
+ SIPrefixes: true,
424
+ },
425
+ ],
426
+ baseUnit: 'rad/s',
427
+ dimensions: ['A*T-1', 'L*L-1*T-1', 'T-1'],
428
+ },
429
+ get rotationalDisplacement() {
430
+ return this.angle;
431
+ },
432
+ torque: {
433
+ units: [
434
+ {
435
+ unit: 'Nm',
436
+ conversionFactor: 1,
437
+ SIPrefixes: false,
438
+ },
439
+ ],
440
+ baseUnit: 'Nm',
441
+ dimensions: ['F*L', 'M*L2*T−2'],
442
+ },
443
+ momentOfInertia: {
444
+ units: [
445
+ {
446
+ unit: 'kgm^2',
447
+ conversionFactor: 1,
448
+ SIPrefixes: false,
449
+ },
450
+ ],
451
+ baseUnit: 'kgm^2',
452
+ dimensions: ['M*L2', 'F*L*T2'],
453
+ },
454
+ rotatingUnbalance: {
455
+ units: [
456
+ {
457
+ unit: 'kgm',
458
+ conversionFactor: 1,
459
+ SIPrefixes: false,
460
+ },
461
+ ],
462
+ baseUnit: 'kgm',
463
+ dimensions: ['L*M'],
464
+ },
465
+ get mechanicalPower() {
466
+ return this.power;
467
+ },
468
+ get mechanicalEnergy() {
469
+ return this.energy;
470
+ },
471
+ dynamicViscosity: {
472
+ units: [
473
+ {
474
+ unit: 'Pas',
475
+ conversionFactor: 1,
476
+ SIPrefixes: false,
477
+ },
478
+ {
479
+ unit: 'poise',
480
+ conversionFactor: 0.1,
481
+ SIPrefixes: true,
482
+ },
483
+ ],
484
+ baseUnit: 'Pas',
485
+ dimensions: ['P*T', 'F*T*L-2', 'M*L-1*T-1'],
486
+ },
487
+ kinematicViscosity: {
488
+ units: [
489
+ {
490
+ unit: 'm^2/s',
491
+ conversionFactor: 1,
492
+ SIPrefixes: false,
493
+ },
494
+ {
495
+ unit: 'St',
496
+ conversionFactor: 0.0001,
497
+ SIPrefixes: true,
498
+ },
499
+ ],
500
+ baseUnit: 'm^2/s',
501
+ dimensions: ['L2*T-1'],
502
+ },
503
+ volumeFlow: {
504
+ units: [
505
+ {
506
+ unit: 'm^3/s',
507
+ conversionFactor: 1,
508
+ SIPrefixes: false,
509
+ },
510
+ ],
511
+ baseUnit: 'm^3/s',
512
+ dimensions: ['V*T-1', 'L3*T-1'],
513
+ },
514
+ massFlow: {
515
+ units: [
516
+ {
517
+ unit: 'kg/s',
518
+ conversionFactor: 1,
519
+ SIPrefixes: false,
520
+ },
521
+ ],
522
+ baseUnit: 'kg/s',
523
+ dimensions: ['M*L-1'],
524
+ },
525
+ heatFlux: {
526
+ units: [
527
+ {
528
+ unit: 'W/m^2',
529
+ conversionFactor: 1,
530
+ SIPrefixes: false,
531
+ },
532
+ ],
533
+ baseUnit: 'W/m^2',
534
+ dimensions: ['W*L-2', 'E*T-1*L-2', 'M*T-3'],
535
+ },
536
+ get thermalEnergy() {
537
+ return this.energy;
538
+ },
539
+ specificHeatCapacity: {
540
+ units: [
541
+ {
542
+ unit: 'J/kgK',
543
+ conversionFactor: 1,
544
+ SIPrefixes: false,
545
+ },
546
+ ],
547
+ baseUnit: 'J/kgK',
548
+ dimensions: ['E*M-1*Θ−1', 'L2*Θ−1*T−2'],
549
+ },
550
+ thermalTransmittance: {
551
+ units: [
552
+ {
553
+ unit: 'W/m^2K',
554
+ conversionFactor: 1,
555
+ SIPrefixes: false,
556
+ },
557
+ ],
558
+ baseUnit: 'W/m^2K',
559
+ dimensions: ['W*L-2*Θ-1', 'E*T-1*L-2*Θ-1'],
560
+ },
561
+ get electricalPower() {
562
+ return this.power;
563
+ },
564
+ get electricalEnergy() {
565
+ return this.energy;
566
+ },
567
+ get electricalFrequency() {
568
+ return this.frequency;
569
+ },
570
+ };
package/dist/utils.d.ts CHANGED
@@ -1,8 +1,12 @@
1
1
  import { FlowLogger } from './FlowLogger';
2
- export declare function fillTemplate(templateString: string, templateVariables: any): string;
2
+ export declare function fillTemplate(value: any, ...templateVariables: any): any;
3
3
  export declare function getCircularReplacer(): (key: any, value: any) => any;
4
4
  export declare function toArray(value?: string | string[]): string[];
5
5
  export declare function delay(ms: number): Promise<void>;
6
6
  export declare function deleteFiles(dir: string, ...filenames: string[]): Promise<void>;
7
7
  export declare function handleApiError(error: any, logger: FlowLogger): void;
8
8
  export declare function runPyScript(scriptPath: string, data: any): Promise<any>;
9
+ /**
10
+ * Truncates an object or string to the specified max length and depth
11
+ */
12
+ export declare function truncate(msg: any, depth?: number, maxStringLength?: number): string;
package/dist/utils.js CHANGED
@@ -1,17 +1,41 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runPyScript = exports.handleApiError = exports.deleteFiles = exports.delay = exports.toArray = exports.getCircularReplacer = exports.fillTemplate = void 0;
3
+ exports.truncate = exports.runPyScript = exports.handleApiError = exports.deleteFiles = exports.delay = exports.toArray = exports.getCircularReplacer = exports.fillTemplate = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const fs_1 = require("fs");
6
+ const isPlainObject_1 = tslib_1.__importDefault(require("lodash/isPlainObject"));
6
7
  const path_1 = require("path");
7
8
  const python_shell_1 = require("python-shell");
8
9
  const string_interp_1 = tslib_1.__importDefault(require("string-interp"));
9
- function fillTemplate(templateString, templateVariables) {
10
- var _a;
11
- if (!((_a = templateString === null || templateString === void 0 ? void 0 : templateString.includes) === null || _a === void 0 ? void 0 : _a.call(templateString, '${'))) {
12
- return templateString;
10
+ const util_1 = require("util");
11
+ function fillTemplate(value, ...templateVariables) {
12
+ if ((0, isPlainObject_1.default)(value)) {
13
+ for (const key of Object.keys(value)) {
14
+ value[key] = fillTemplate(value[key], ...templateVariables);
15
+ }
16
+ return value;
17
+ }
18
+ else if (Array.isArray(value) && value.length > 0) {
19
+ value.forEach(function (v, index) {
20
+ this[index] = fillTemplate(v, ...templateVariables);
21
+ }, value);
22
+ return value;
23
+ }
24
+ else if (value != null && typeof value === 'string' && value.includes('${')) {
25
+ for (const variables of templateVariables) {
26
+ try {
27
+ const result = (0, string_interp_1.default)(value, variables || {});
28
+ if (result) {
29
+ return result;
30
+ }
31
+ }
32
+ catch (err) {
33
+ }
34
+ }
35
+ }
36
+ else {
37
+ return value;
13
38
  }
14
- return string_interp_1.default(templateString, templateVariables || {});
15
39
  }
16
40
  exports.fillTemplate = fillTemplate;
17
41
  function getCircularReplacer() {
@@ -37,7 +61,8 @@ function delay(ms) {
37
61
  exports.delay = delay;
38
62
  async function deleteFiles(dir, ...filenames) {
39
63
  for (const filename of filenames) {
40
- await fs_1.promises.unlink(path_1.join(dir, filename)).catch((err) => { });
64
+ await fs_1.promises.unlink((0, path_1.join)(dir, filename)).catch((err) => {
65
+ });
41
66
  }
42
67
  }
43
68
  exports.deleteFiles = deleteFiles;
@@ -81,3 +106,11 @@ function runPyScript(scriptPath, data) {
81
106
  });
82
107
  }
83
108
  exports.runPyScript = runPyScript;
109
+ function truncate(msg, depth = 4, maxStringLength = 1000) {
110
+ let truncated = (0, util_1.inspect)(msg, { depth, maxStringLength });
111
+ if (truncated.startsWith("'") && truncated.endsWith("'")) {
112
+ truncated = truncated.substring(1, truncated.length - 1);
113
+ }
114
+ return truncated;
115
+ }
116
+ exports.truncate = truncate;