@hotmeshio/hotmesh 0.14.1 → 0.14.3

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 (52) hide show
  1. package/build/package.json +2 -1
  2. package/build/services/engine/init.js +1 -1
  3. package/build/services/engine/schema.js +5 -1
  4. package/build/services/pipe/functions/array.d.ts +219 -0
  5. package/build/services/pipe/functions/array.js +219 -0
  6. package/build/services/pipe/functions/bitwise.d.ts +94 -0
  7. package/build/services/pipe/functions/bitwise.js +94 -0
  8. package/build/services/pipe/functions/conditional.d.ts +161 -0
  9. package/build/services/pipe/functions/conditional.js +161 -0
  10. package/build/services/pipe/functions/cron.d.ts +23 -4
  11. package/build/services/pipe/functions/cron.js +23 -4
  12. package/build/services/pipe/functions/date.d.ts +737 -6
  13. package/build/services/pipe/functions/date.js +742 -5
  14. package/build/services/pipe/functions/json.d.ts +42 -0
  15. package/build/services/pipe/functions/json.js +42 -0
  16. package/build/services/pipe/functions/logical.d.ts +38 -0
  17. package/build/services/pipe/functions/logical.js +38 -0
  18. package/build/services/pipe/functions/math.d.ts +533 -0
  19. package/build/services/pipe/functions/math.js +533 -0
  20. package/build/services/pipe/functions/number.d.ts +258 -0
  21. package/build/services/pipe/functions/number.js +258 -0
  22. package/build/services/pipe/functions/object.d.ts +321 -0
  23. package/build/services/pipe/functions/object.js +321 -0
  24. package/build/services/pipe/functions/string.d.ts +306 -0
  25. package/build/services/pipe/functions/string.js +306 -0
  26. package/build/services/pipe/functions/symbol.d.ts +112 -0
  27. package/build/services/pipe/functions/symbol.js +112 -0
  28. package/build/services/pipe/functions/unary.d.ts +65 -0
  29. package/build/services/pipe/functions/unary.js +65 -0
  30. package/build/services/quorum/index.js +1 -1
  31. package/build/services/router/consumption/index.js +20 -2
  32. package/build/services/router/error-handling/index.js +1 -1
  33. package/build/services/store/factory.d.ts +1 -1
  34. package/build/services/store/factory.js +2 -2
  35. package/build/services/store/index.d.ts +1 -1
  36. package/build/services/store/providers/postgres/kvsql.d.ts +11 -1
  37. package/build/services/store/providers/postgres/kvsql.js +22 -12
  38. package/build/services/store/providers/postgres/kvtables.js +39 -6
  39. package/build/services/store/providers/postgres/kvtypes/hash/basic.js +6 -6
  40. package/build/services/store/providers/postgres/kvtypes/hash/scan.js +2 -1
  41. package/build/services/store/providers/postgres/kvtypes/list.js +7 -6
  42. package/build/services/store/providers/postgres/kvtypes/string.js +3 -3
  43. package/build/services/store/providers/postgres/kvtypes/zset.js +7 -7
  44. package/build/services/store/providers/postgres/postgres.d.ts +3 -2
  45. package/build/services/store/providers/postgres/postgres.js +55 -55
  46. package/build/services/store/providers/postgres/time-notify.js +18 -25
  47. package/build/services/store/providers/store-initializable.d.ts +1 -1
  48. package/build/services/virtual/index.js +6 -0
  49. package/build/services/virtual/schemas/factory.js +1 -1
  50. package/build/services/worker/index.js +1 -1
  51. package/build/types/virtual.d.ts +21 -0
  52. package/package.json +2 -1
@@ -1,5 +1,47 @@
1
+ /**
2
+ * Provides JSON serialization and deserialization functions for use
3
+ * in HotMesh mapping rules. Although inspired by JavaScript, they
4
+ * have been adapted to follow a functional approach. Each transformation
5
+ * is a function that expects one or more input parameters from the
6
+ * prior row in the `@pipe` structure.
7
+ *
8
+ * @remarks
9
+ * Invoked in mapping rules using `{@json.<method>}` syntax.
10
+ */
1
11
  declare class JsonHandler {
12
+ /**
13
+ * Converts a JavaScript object or value to a JSON string.
14
+ * Wraps `JSON.stringify` with support for optional replacer
15
+ * and space parameters for pretty-printing.
16
+ *
17
+ * @param {any} value - The value to convert to a JSON string
18
+ * @param {Function | Array | null} [replacer] - A function that alters the behavior of the stringification process, or an array of strings and numbers to filter properties
19
+ * @param {string | number} [space] - A string or number used to insert whitespace for readability
20
+ * @returns {string} The JSON string representation of the value
21
+ * @example
22
+ * ```yaml
23
+ * json_string:
24
+ * "@pipe":
25
+ * - ["{a}", null, 2]
26
+ * - ["{@json.stringify}"]
27
+ * ```
28
+ */
2
29
  stringify(value: any, replacer?: (this: any, key: string, value: any) => any | (number | string)[] | null, space?: string | number): string;
30
+ /**
31
+ * Parses a JSON string and returns the resulting JavaScript object.
32
+ * Wraps `JSON.parse` with support for an optional reviver function.
33
+ *
34
+ * @param {string} text - The JSON string to parse
35
+ * @param {Function} [reviver] - A function that transforms the results, called for each key-value pair
36
+ * @returns {any} The JavaScript value parsed from the JSON string
37
+ * @example
38
+ * ```yaml
39
+ * js_object:
40
+ * "@pipe":
41
+ * - ["{a}"]
42
+ * - ["{@json.parse}"]
43
+ * ```
44
+ */
3
45
  parse(text: string, reviver?: (this: any, key: string, value: any) => any): any;
4
46
  }
5
47
  export { JsonHandler };
@@ -1,10 +1,52 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JsonHandler = void 0;
4
+ /**
5
+ * Provides JSON serialization and deserialization functions for use
6
+ * in HotMesh mapping rules. Although inspired by JavaScript, they
7
+ * have been adapted to follow a functional approach. Each transformation
8
+ * is a function that expects one or more input parameters from the
9
+ * prior row in the `@pipe` structure.
10
+ *
11
+ * @remarks
12
+ * Invoked in mapping rules using `{@json.<method>}` syntax.
13
+ */
4
14
  class JsonHandler {
15
+ /**
16
+ * Converts a JavaScript object or value to a JSON string.
17
+ * Wraps `JSON.stringify` with support for optional replacer
18
+ * and space parameters for pretty-printing.
19
+ *
20
+ * @param {any} value - The value to convert to a JSON string
21
+ * @param {Function | Array | null} [replacer] - A function that alters the behavior of the stringification process, or an array of strings and numbers to filter properties
22
+ * @param {string | number} [space] - A string or number used to insert whitespace for readability
23
+ * @returns {string} The JSON string representation of the value
24
+ * @example
25
+ * ```yaml
26
+ * json_string:
27
+ * "@pipe":
28
+ * - ["{a}", null, 2]
29
+ * - ["{@json.stringify}"]
30
+ * ```
31
+ */
5
32
  stringify(value, replacer, space) {
6
33
  return JSON.stringify(value, replacer, space);
7
34
  }
35
+ /**
36
+ * Parses a JSON string and returns the resulting JavaScript object.
37
+ * Wraps `JSON.parse` with support for an optional reviver function.
38
+ *
39
+ * @param {string} text - The JSON string to parse
40
+ * @param {Function} [reviver] - A function that transforms the results, called for each key-value pair
41
+ * @returns {any} The JavaScript value parsed from the JSON string
42
+ * @example
43
+ * ```yaml
44
+ * js_object:
45
+ * "@pipe":
46
+ * - ["{a}"]
47
+ * - ["{@json.parse}"]
48
+ * ```
49
+ */
8
50
  parse(text, reviver) {
9
51
  return JSON.parse(text, reviver);
10
52
  }
@@ -1,5 +1,43 @@
1
+ /**
2
+ * Provides logical operator functions for combining multiple boolean
3
+ * expressions and returning a single boolean value. These operators
4
+ * are available for use in HotMesh mapping rules.
5
+ *
6
+ * @remarks
7
+ * Invoked in mapping rules using `{@logical.<method>}` syntax.
8
+ */
1
9
  declare class LogicalHandler {
10
+ /**
11
+ * Returns `true` if both boolean expressions evaluate to `true`.
12
+ * Performs a logical AND operation.
13
+ *
14
+ * @param {boolean} firstValue - The first boolean expression
15
+ * @param {boolean} secondValue - The second boolean expression
16
+ * @returns {boolean} `true` if both values are truthy, `false` otherwise
17
+ * @example
18
+ * ```yaml
19
+ * is_active_and_paid:
20
+ * "@pipe":
21
+ * - ["{a.user.isActive}", "{a.user.hasPaid}"]
22
+ * - ["{@logical.and}"]
23
+ * ```
24
+ */
2
25
  and(firstValue: boolean, secondValue: boolean): boolean;
26
+ /**
27
+ * Returns `true` if at least one of the boolean expressions
28
+ * evaluates to `true`. Performs a logical OR operation.
29
+ *
30
+ * @param {boolean} firstValue - The first boolean expression
31
+ * @param {boolean} secondValue - The second boolean expression
32
+ * @returns {boolean} `true` if either value is truthy, `false` otherwise
33
+ * @example
34
+ * ```yaml
35
+ * has_trial_or_subscription:
36
+ * "@pipe":
37
+ * - ["{b.user.hasTrial}", "{b.user.hasSubscription}"]
38
+ * - ["{@logical.or}"]
39
+ * ```
40
+ */
3
41
  or(firstValue: boolean, secondValue: boolean): boolean;
4
42
  }
5
43
  export { LogicalHandler };
@@ -1,10 +1,48 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LogicalHandler = void 0;
4
+ /**
5
+ * Provides logical operator functions for combining multiple boolean
6
+ * expressions and returning a single boolean value. These operators
7
+ * are available for use in HotMesh mapping rules.
8
+ *
9
+ * @remarks
10
+ * Invoked in mapping rules using `{@logical.<method>}` syntax.
11
+ */
4
12
  class LogicalHandler {
13
+ /**
14
+ * Returns `true` if both boolean expressions evaluate to `true`.
15
+ * Performs a logical AND operation.
16
+ *
17
+ * @param {boolean} firstValue - The first boolean expression
18
+ * @param {boolean} secondValue - The second boolean expression
19
+ * @returns {boolean} `true` if both values are truthy, `false` otherwise
20
+ * @example
21
+ * ```yaml
22
+ * is_active_and_paid:
23
+ * "@pipe":
24
+ * - ["{a.user.isActive}", "{a.user.hasPaid}"]
25
+ * - ["{@logical.and}"]
26
+ * ```
27
+ */
5
28
  and(firstValue, secondValue) {
6
29
  return firstValue && secondValue;
7
30
  }
31
+ /**
32
+ * Returns `true` if at least one of the boolean expressions
33
+ * evaluates to `true`. Performs a logical OR operation.
34
+ *
35
+ * @param {boolean} firstValue - The first boolean expression
36
+ * @param {boolean} secondValue - The second boolean expression
37
+ * @returns {boolean} `true` if either value is truthy, `false` otherwise
38
+ * @example
39
+ * ```yaml
40
+ * has_trial_or_subscription:
41
+ * "@pipe":
42
+ * - ["{b.user.hasTrial}", "{b.user.hasSubscription}"]
43
+ * - ["{@logical.or}"]
44
+ * ```
45
+ */
8
46
  or(firstValue, secondValue) {
9
47
  return firstValue || secondValue;
10
48
  }