@hotmeshio/hotmesh 0.14.0 → 0.14.2

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 (32) hide show
  1. package/build/package.json +1 -1
  2. package/build/services/pipe/functions/array.d.ts +219 -0
  3. package/build/services/pipe/functions/array.js +219 -0
  4. package/build/services/pipe/functions/bitwise.d.ts +94 -0
  5. package/build/services/pipe/functions/bitwise.js +94 -0
  6. package/build/services/pipe/functions/conditional.d.ts +161 -0
  7. package/build/services/pipe/functions/conditional.js +161 -0
  8. package/build/services/pipe/functions/cron.d.ts +23 -4
  9. package/build/services/pipe/functions/cron.js +23 -4
  10. package/build/services/pipe/functions/date.d.ts +737 -6
  11. package/build/services/pipe/functions/date.js +742 -5
  12. package/build/services/pipe/functions/json.d.ts +42 -0
  13. package/build/services/pipe/functions/json.js +42 -0
  14. package/build/services/pipe/functions/logical.d.ts +38 -0
  15. package/build/services/pipe/functions/logical.js +38 -0
  16. package/build/services/pipe/functions/math.d.ts +533 -0
  17. package/build/services/pipe/functions/math.js +533 -0
  18. package/build/services/pipe/functions/number.d.ts +258 -0
  19. package/build/services/pipe/functions/number.js +258 -0
  20. package/build/services/pipe/functions/object.d.ts +321 -0
  21. package/build/services/pipe/functions/object.js +321 -0
  22. package/build/services/pipe/functions/string.d.ts +306 -0
  23. package/build/services/pipe/functions/string.js +306 -0
  24. package/build/services/pipe/functions/symbol.d.ts +112 -0
  25. package/build/services/pipe/functions/symbol.js +112 -0
  26. package/build/services/pipe/functions/unary.d.ts +65 -0
  27. package/build/services/pipe/functions/unary.js +65 -0
  28. package/build/services/router/error-handling/index.js +7 -1
  29. package/build/services/virtual/index.js +6 -0
  30. package/build/services/virtual/schemas/factory.js +1 -1
  31. package/build/types/virtual.d.ts +21 -0
  32. package/package.json +1 -1
@@ -1,42 +1,575 @@
1
+ /**
2
+ * Provides mathematical operations and transformations for use in HotMesh
3
+ * mapping rules. The functions facilitate a wide range of mathematical
4
+ * operations during the mapping process, all of which can be utilised
5
+ * through the `@pipe` system for a functional approach.
6
+ *
7
+ * @remarks Methods are invoked with the syntax `{@math.<method>}`, e.g., `{@math.add}` or `{@math.sqrt}`.
8
+ */
1
9
  declare class MathHandler {
10
+ /**
11
+ * Sums all the numbers passed as arguments. Accepts any number of
12
+ * arguments, including nested arrays, and returns their total.
13
+ *
14
+ * @param {...(number | number[])[]} operands - Numbers or arrays of numbers to sum.
15
+ * @returns {number} The sum of all operands.
16
+ * @example
17
+ * ```yaml
18
+ * sum:
19
+ * "@pipe":
20
+ * - ["{a.output.data.values}"]
21
+ * - ["{@math.add}"]
22
+ * ```
23
+ */
2
24
  add(...operands: (number | number[])[]): number;
25
+ /**
26
+ * Subtracts all the numbers passed as arguments in the order they are
27
+ * given. Accepts any number of arguments, and all arguments should be
28
+ * numbers. The first number is the starting value; subsequent numbers are
29
+ * subtracted from it.
30
+ *
31
+ * @param {...(number | number[])[]} operands - Numbers or arrays of numbers to subtract sequentially.
32
+ * @returns {number} The result of sequential subtraction.
33
+ * @example
34
+ * ```yaml
35
+ * difference:
36
+ * "@pipe":
37
+ * - ["{a.output.data.values}"]
38
+ * - ["{@math.subtract}"]
39
+ * ```
40
+ */
3
41
  subtract(...operands: (number | number[])[]): number;
42
+ /**
43
+ * Multiplies all the numbers passed as arguments. Accepts any number of
44
+ * arguments, including nested arrays, and returns their product.
45
+ *
46
+ * @param {...(number | number[])[]} operands - Numbers or arrays of numbers to multiply.
47
+ * @returns {number} The product of all operands.
48
+ * @example
49
+ * ```yaml
50
+ * product:
51
+ * "@pipe":
52
+ * - ["{a.output.data.values}", 5]
53
+ * - ["{@math.multiply}"]
54
+ * ```
55
+ */
4
56
  multiply(...operands: (number | number[])[]): number;
57
+ /**
58
+ * Divides all the numbers passed as arguments in the order they are given.
59
+ * The first number is the dividend; subsequent numbers are divisors.
60
+ * Division by zero returns `NaN`.
61
+ *
62
+ * @param {...(number | number[])[]} operands - Numbers or arrays of numbers to divide sequentially.
63
+ * @returns {number} The result of sequential division, or `NaN` on division by zero.
64
+ * @example
65
+ * ```yaml
66
+ * quotient:
67
+ * "@pipe":
68
+ * - ["{a.output.data.values}"]
69
+ * - ["{@math.divide}"]
70
+ * ```
71
+ */
5
72
  divide(...operands: (number | number[])[]): number;
73
+ /**
74
+ * Returns the absolute value of a number.
75
+ *
76
+ * @param {number} x - The number to find the absolute value of.
77
+ * @returns {number} The absolute value.
78
+ * @example
79
+ * ```yaml
80
+ * absolute_value:
81
+ * "@pipe":
82
+ * - ["{a.output.data.value}"]
83
+ * - ["{@math.abs}"]
84
+ * ```
85
+ */
6
86
  abs(x: number): number;
87
+ /**
88
+ * Returns the arccosine (in radians) of a number.
89
+ *
90
+ * @param {number} x - A number between -1 and 1.
91
+ * @returns {number} The arccosine in radians.
92
+ * @example
93
+ * ```yaml
94
+ * arccosine_value:
95
+ * "@pipe":
96
+ * - ["{a.output.data.value}"]
97
+ * - ["{@math.acos}"]
98
+ * ```
99
+ */
7
100
  acos(x: number): number;
101
+ /**
102
+ * Returns the inverse hyperbolic cosine of a number.
103
+ *
104
+ * @param {number} x - A number greater than or equal to 1.
105
+ * @returns {number} The inverse hyperbolic cosine.
106
+ * @example
107
+ * ```yaml
108
+ * inverse_hyp_cosine:
109
+ * "@pipe":
110
+ * - ["{a.output.data.value}"]
111
+ * - ["{@math.acosh}"]
112
+ * ```
113
+ */
8
114
  acosh(x: number): number;
115
+ /**
116
+ * Returns the arcsine (in radians) of a number.
117
+ *
118
+ * @param {number} x - A number between -1 and 1.
119
+ * @returns {number} The arcsine in radians.
120
+ * @example
121
+ * ```yaml
122
+ * arcsine_value:
123
+ * "@pipe":
124
+ * - ["{a.output.data.value}"]
125
+ * - ["{@math.asin}"]
126
+ * ```
127
+ */
9
128
  asin(x: number): number;
129
+ /**
130
+ * Returns the inverse hyperbolic sine of a number.
131
+ *
132
+ * @param {number} x - The number to compute the inverse hyperbolic sine of.
133
+ * @returns {number} The inverse hyperbolic sine.
134
+ * @example
135
+ * ```yaml
136
+ * inverse_hyp_sine:
137
+ * "@pipe":
138
+ * - ["{a.output.data.value}"]
139
+ * - ["{@math.asinh}"]
140
+ * ```
141
+ */
10
142
  asinh(x: number): number;
143
+ /**
144
+ * Returns the arctangent (in radians) of a number.
145
+ *
146
+ * @param {number} x - The number to compute the arctangent of.
147
+ * @returns {number} The arctangent in radians.
148
+ * @example
149
+ * ```yaml
150
+ * arctangent_value:
151
+ * "@pipe":
152
+ * - ["{a.output.data.value}"]
153
+ * - ["{@math.atan}"]
154
+ * ```
155
+ */
11
156
  atan(x: number): number;
157
+ /**
158
+ * Returns the arctangent (in radians) of the quotient of its arguments
159
+ * (y/x), using the signs of both to determine the quadrant.
160
+ *
161
+ * @param {number} y - The dividend (y-coordinate).
162
+ * @param {number} x - The divisor (x-coordinate).
163
+ * @returns {number} The arctangent of y/x in radians.
164
+ * @example
165
+ * ```yaml
166
+ * arctangent2_value:
167
+ * "@pipe":
168
+ * - ["{a.output.data.y}", "{a.output.data.x}"]
169
+ * - ["{@math.atan2}"]
170
+ * ```
171
+ */
12
172
  atan2(y: number, x: number): number;
173
+ /**
174
+ * Returns the inverse hyperbolic tangent of a number.
175
+ *
176
+ * @param {number} x - A number between -1 and 1 (exclusive).
177
+ * @returns {number} The inverse hyperbolic tangent.
178
+ * @example
179
+ * ```yaml
180
+ * inverse_hyp_tangent:
181
+ * "@pipe":
182
+ * - ["{a.output.data.value}"]
183
+ * - ["{@math.atanh}"]
184
+ * ```
185
+ */
13
186
  atanh(x: number): number;
187
+ /**
188
+ * Returns the cube root of a number.
189
+ *
190
+ * @param {number} x - The number to compute the cube root of.
191
+ * @returns {number} The cube root.
192
+ * @example
193
+ * ```yaml
194
+ * cube_root:
195
+ * "@pipe":
196
+ * - ["{a.output.data.value}"]
197
+ * - ["{@math.cbrt}"]
198
+ * ```
199
+ */
14
200
  cbrt(x: number): number;
201
+ /**
202
+ * Returns the smallest integer greater than or equal to a given number
203
+ * (rounds up).
204
+ *
205
+ * @param {number} x - The number to round up.
206
+ * @returns {number} The ceiling value.
207
+ * @example
208
+ * ```yaml
209
+ * ceiling_value:
210
+ * "@pipe":
211
+ * - ["{a.output.data.value}"]
212
+ * - ["{@math.ceil}"]
213
+ * ```
214
+ */
15
215
  ceil(x: number): number;
216
+ /**
217
+ * Returns the number of leading zero bits in the 32-bit binary
218
+ * representation of a number.
219
+ *
220
+ * @param {number} x - The number to count leading zero bits for.
221
+ * @returns {number} The count of leading zero bits.
222
+ * @example
223
+ * ```yaml
224
+ * leading_zeros:
225
+ * "@pipe":
226
+ * - ["{a.output.data.value}"]
227
+ * - ["{@math.clz32}"]
228
+ * ```
229
+ */
16
230
  clz32(x: number): number;
231
+ /**
232
+ * Returns the cosine of a number (in radians).
233
+ *
234
+ * @param {number} x - The angle in radians.
235
+ * @returns {number} The cosine of the angle.
236
+ * @example
237
+ * ```yaml
238
+ * cosine_value:
239
+ * "@pipe":
240
+ * - ["{a.output.data.angle}"]
241
+ * - ["{@math.cos}"]
242
+ * ```
243
+ */
17
244
  cos(x: number): number;
245
+ /**
246
+ * Returns the hyperbolic cosine of a number.
247
+ *
248
+ * @param {number} x - The number to compute the hyperbolic cosine of.
249
+ * @returns {number} The hyperbolic cosine.
250
+ * @example
251
+ * ```yaml
252
+ * hyperbolic_cosine:
253
+ * "@pipe":
254
+ * - ["{a.output.data.value}"]
255
+ * - ["{@math.cosh}"]
256
+ * ```
257
+ */
18
258
  cosh(x: number): number;
259
+ /**
260
+ * Returns e raised to the power of the given number (e^x).
261
+ *
262
+ * @param {number} x - The exponent to raise e to.
263
+ * @returns {number} The value of e^x.
264
+ * @example
265
+ * ```yaml
266
+ * exponential_value:
267
+ * "@pipe":
268
+ * - ["{a.output.data.exponent}"]
269
+ * - ["{@math.exp}"]
270
+ * ```
271
+ */
19
272
  exp(x: number): number;
273
+ /**
274
+ * Returns e^x minus 1, providing better precision for small values of x
275
+ * than using `exp(x) - 1`.
276
+ *
277
+ * @param {number} x - The exponent to raise e to before subtracting 1.
278
+ * @returns {number} The value of e^x - 1.
279
+ * @example
280
+ * ```yaml
281
+ * exponential_minus_one:
282
+ * "@pipe":
283
+ * - ["{a.output.data.exponent}"]
284
+ * - ["{@math.expm1}"]
285
+ * ```
286
+ */
20
287
  expm1(x: number): number;
288
+ /**
289
+ * Returns the largest integer less than or equal to a given number (rounds
290
+ * down).
291
+ *
292
+ * @param {number} x - The number to round down.
293
+ * @returns {number} The floor value.
294
+ * @example
295
+ * ```yaml
296
+ * floor_value:
297
+ * "@pipe":
298
+ * - ["{a.output.data.value}"]
299
+ * - ["{@math.floor}"]
300
+ * ```
301
+ */
21
302
  floor(x: number): number;
303
+ /**
304
+ * Returns the nearest single-precision float representation of a number.
305
+ *
306
+ * @param {number} x - The number to round to single-precision float.
307
+ * @returns {number} The nearest single-precision float.
308
+ * @example
309
+ * ```yaml
310
+ * fround_value:
311
+ * "@pipe":
312
+ * - ["{a.output.data.value}"]
313
+ * - ["{@math.fround}"]
314
+ * ```
315
+ */
22
316
  fround(x: number): number;
317
+ /**
318
+ * Returns the square root of the sum of the squares of its arguments
319
+ * (Euclidean distance / hypotenuse).
320
+ *
321
+ * @param {...number[]} values - The numbers to compute the hypotenuse from.
322
+ * @returns {number} The square root of the sum of squares.
323
+ * @example
324
+ * ```yaml
325
+ * hypot_value:
326
+ * "@pipe":
327
+ * - ["{a.output.data.a}", "{a.output.data.b}"]
328
+ * - ["{@math.hypot}"]
329
+ * ```
330
+ */
23
331
  hypot(...values: number[]): number;
332
+ /**
333
+ * Returns the result of a 32-bit integer multiplication of two numbers.
334
+ *
335
+ * @param {number} x - The first number to multiply.
336
+ * @param {number} y - The second number to multiply.
337
+ * @returns {number} The 32-bit integer product.
338
+ * @example
339
+ * ```yaml
340
+ * imul_value:
341
+ * "@pipe":
342
+ * - ["{a.output.data.a}", "{a.output.data.b}"]
343
+ * - ["{@math.imul}"]
344
+ * ```
345
+ */
24
346
  imul(x: number, y: number): number;
347
+ /**
348
+ * Returns the natural logarithm (base e) of a number.
349
+ *
350
+ * @param {number} x - The number to compute the natural logarithm of.
351
+ * @returns {number} The natural logarithm.
352
+ * @example
353
+ * ```yaml
354
+ * log_value:
355
+ * "@pipe":
356
+ * - ["{a.output.data.value}"]
357
+ * - ["{@math.log}"]
358
+ * ```
359
+ */
25
360
  log(x: number): number;
361
+ /**
362
+ * Returns the base 10 logarithm of a number.
363
+ *
364
+ * @param {number} x - The number to compute the base 10 logarithm of.
365
+ * @returns {number} The base 10 logarithm.
366
+ * @example
367
+ * ```yaml
368
+ * log10_value:
369
+ * "@pipe":
370
+ * - ["{a.output.data.value}"]
371
+ * - ["{@math.log10}"]
372
+ * ```
373
+ */
26
374
  log10(x: number): number;
375
+ /**
376
+ * Returns the natural logarithm (base e) of 1 plus a given number.
377
+ * Provides better precision for small values of x than `log(1 + x)`.
378
+ *
379
+ * @param {number} x - The number to add to 1 before computing the logarithm.
380
+ * @returns {number} The natural logarithm of 1 + x.
381
+ * @example
382
+ * ```yaml
383
+ * log1p_value:
384
+ * "@pipe":
385
+ * - ["{a.output.data.value}"]
386
+ * - ["{@math.log1p}"]
387
+ * ```
388
+ */
27
389
  log1p(x: number): number;
390
+ /**
391
+ * Returns the base 2 logarithm of a number.
392
+ *
393
+ * @param {number} x - The number to compute the base 2 logarithm of.
394
+ * @returns {number} The base 2 logarithm.
395
+ * @example
396
+ * ```yaml
397
+ * log2_value:
398
+ * "@pipe":
399
+ * - ["{a.output.data.value}"]
400
+ * - ["{@math.log2}"]
401
+ * ```
402
+ */
28
403
  log2(x: number): number;
404
+ /**
405
+ * Returns the largest of the given numbers.
406
+ *
407
+ * @param {...number[]} values - The numbers to compare.
408
+ * @returns {number} The largest value.
409
+ * @example
410
+ * ```yaml
411
+ * max_value:
412
+ * "@pipe":
413
+ * - ["{a.output.data.a}", "{a.output.data.b}", "{a.output.data.c}"]
414
+ * - ["{@math.max}"]
415
+ * ```
416
+ */
29
417
  max(...values: number[]): number;
418
+ /**
419
+ * Returns the smallest of the given numbers.
420
+ *
421
+ * @param {...number[]} values - The numbers to compare.
422
+ * @returns {number} The smallest value.
423
+ * @example
424
+ * ```yaml
425
+ * min_value:
426
+ * "@pipe":
427
+ * - ["{a.output.data.a}", "{a.output.data.b}", "{a.output.data.c}"]
428
+ * - ["{@math.min}"]
429
+ * ```
430
+ */
30
431
  min(...values: number[]): number;
432
+ /**
433
+ * Returns the result of raising the base to the exponent power (base^exp).
434
+ *
435
+ * @param {number} x - The base.
436
+ * @param {number} y - The exponent.
437
+ * @returns {number} The result of x raised to the power y.
438
+ * @example
439
+ * ```yaml
440
+ * pow_value:
441
+ * "@pipe":
442
+ * - ["{a.output.data.base}", "{a.output.data.exponent}"]
443
+ * - ["{@math.pow}"]
444
+ * ```
445
+ */
31
446
  pow(x: number, y: number): number;
447
+ /**
448
+ * Returns a random number between 0 (inclusive) and 1 (exclusive). Takes
449
+ * no parameters.
450
+ *
451
+ * @returns {number} A pseudo-random number in [0, 1).
452
+ * @example
453
+ * ```yaml
454
+ * random_value:
455
+ * "@pipe":
456
+ * - []
457
+ * - ["{@math.random}"]
458
+ * ```
459
+ */
32
460
  random(): number;
461
+ /**
462
+ * Returns the value of a number rounded to the nearest integer.
463
+ *
464
+ * @param {number} x - The number to round.
465
+ * @returns {number} The rounded integer.
466
+ * @example
467
+ * ```yaml
468
+ * rounded_value:
469
+ * "@pipe":
470
+ * - ["{a.output.data.value}"]
471
+ * - ["{@math.round}"]
472
+ * ```
473
+ */
33
474
  round(x: number): number;
475
+ /**
476
+ * Returns the sign of a number, indicating whether the number is positive
477
+ * (1), negative (-1), or zero (0).
478
+ *
479
+ * @param {number} x - The number to determine the sign of.
480
+ * @returns {number} 1, -1, or 0.
481
+ * @example
482
+ * ```yaml
483
+ * sign_value:
484
+ * "@pipe":
485
+ * - ["{a.output.data.value}"]
486
+ * - ["{@math.sign}"]
487
+ * ```
488
+ */
34
489
  sign(x: number): number;
490
+ /**
491
+ * Returns the sine of a number (in radians).
492
+ *
493
+ * @param {number} x - The angle in radians.
494
+ * @returns {number} The sine of the angle.
495
+ * @example
496
+ * ```yaml
497
+ * sin_value:
498
+ * "@pipe":
499
+ * - ["{a.output.data.angle}"]
500
+ * - ["{@math.sin}"]
501
+ * ```
502
+ */
35
503
  sin(x: number): number;
504
+ /**
505
+ * Returns the hyperbolic sine of a number.
506
+ *
507
+ * @param {number} x - The number to compute the hyperbolic sine of.
508
+ * @returns {number} The hyperbolic sine.
509
+ * @example
510
+ * ```yaml
511
+ * sinh_value:
512
+ * "@pipe":
513
+ * - ["{a.output.data.value}"]
514
+ * - ["{@math.sinh}"]
515
+ * ```
516
+ */
36
517
  sinh(x: number): number;
518
+ /**
519
+ * Returns the square root of a number.
520
+ *
521
+ * @param {number} x - The number to compute the square root of.
522
+ * @returns {number} The square root.
523
+ * @example
524
+ * ```yaml
525
+ * sqrt_value:
526
+ * "@pipe":
527
+ * - ["{a.output.data.value}"]
528
+ * - ["{@math.sqrt}"]
529
+ * ```
530
+ */
37
531
  sqrt(x: number): number;
532
+ /**
533
+ * Returns the tangent of a number (in radians).
534
+ *
535
+ * @param {number} x - The angle in radians.
536
+ * @returns {number} The tangent of the angle.
537
+ * @example
538
+ * ```yaml
539
+ * tan_value:
540
+ * "@pipe":
541
+ * - ["{a.output.data.angle}"]
542
+ * - ["{@math.tan}"]
543
+ * ```
544
+ */
38
545
  tan(x: number): number;
546
+ /**
547
+ * Returns the hyperbolic tangent of a number.
548
+ *
549
+ * @param {number} x - The number to compute the hyperbolic tangent of.
550
+ * @returns {number} The hyperbolic tangent.
551
+ * @example
552
+ * ```yaml
553
+ * tanh_value:
554
+ * "@pipe":
555
+ * - ["{a.output.data.value}"]
556
+ * - ["{@math.tanh}"]
557
+ * ```
558
+ */
39
559
  tanh(x: number): number;
560
+ /**
561
+ * Returns the integer part of a number by removing any fractional digits.
562
+ *
563
+ * @param {number} x - The number to truncate.
564
+ * @returns {number} The integer part of the number.
565
+ * @example
566
+ * ```yaml
567
+ * trunc_value:
568
+ * "@pipe":
569
+ * - ["{a.output.data.value}"]
570
+ * - ["{@math.trunc}"]
571
+ * ```
572
+ */
40
573
  trunc(x: number): number;
41
574
  }
42
575
  export { MathHandler };