@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,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.14.1",
3
+ "version": "0.14.3",
4
4
  "description": "Durable Workflow",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -85,6 +85,7 @@
85
85
  "test:unit": "vitest run tests/unit"
86
86
  },
87
87
  "keywords": [
88
+ "Invisible Infrastructure",
88
89
  "Headless Orchestration",
89
90
  "Durable Workflows",
90
91
  "Data in Motion",
@@ -30,7 +30,7 @@ async function initSearchChannel(instance, search, store) {
30
30
  }
31
31
  exports.initSearchChannel = initSearchChannel;
32
32
  async function initStoreChannel(instance, store) {
33
- instance.store = await factory_2.StoreServiceFactory.init(store, instance.namespace, instance.appId, instance.logger);
33
+ instance.store = await factory_2.StoreServiceFactory.init(store, instance.namespace, instance.appId, instance.logger, instance.guid, 'engine');
34
34
  }
35
35
  exports.initStoreChannel = initStoreChannel;
36
36
  async function initSubChannel(instance, sub, store) {
@@ -16,7 +16,11 @@ const activities_1 = __importDefault(require("../activities"));
16
16
  async function initActivity(instance, topic, data = {}, context) {
17
17
  const [activityId, schema] = await getSchema(instance, topic);
18
18
  if (!schema) {
19
- throw new Error(`Activity schema not found for "${activityId}" (topic: ${topic}) in app ${instance.appId}`);
19
+ const err = new Error(`Activity schema not found for "${activityId}" (topic: ${topic}) in app ${instance.appId}. ` +
20
+ `This is typically caused by a worker activity whose topic collides with the graph subscribes topic. ` +
21
+ `Redeploy with a distinct worker topic.`);
22
+ err.code = 598;
23
+ throw err;
20
24
  }
21
25
  const ActivityHandler = activities_1.default[schema.type];
22
26
  if (ActivityHandler) {
@@ -1,17 +1,236 @@
1
+ /**
2
+ * Provides functional transformations for arrays within HotMesh mapping
3
+ * rules. Although inspired by JavaScript, these methods have been adapted
4
+ * to follow a functional approach. Each transformation is a function that
5
+ * expects one or more input parameters from the prior row in the `@pipe`
6
+ * structure.
7
+ *
8
+ * @remarks Invoked via `{@array.<method>}` in YAML mapping rules.
9
+ */
1
10
  declare class ArrayHandler {
11
+ /**
12
+ * Retrieves an element from an array by its index.
13
+ *
14
+ * @param {any[]} array - The array from which to retrieve the element
15
+ * @param {number} index - The zero-based index of the element to retrieve
16
+ * @returns {any} The element at the specified index, or undefined if the array is nullish
17
+ * @example
18
+ * ```yaml
19
+ * second_color:
20
+ * "@pipe":
21
+ * - ["{a.output.data.colors}", 1]
22
+ * - ["{@array.get}"]
23
+ * ```
24
+ */
2
25
  get(array: any[], index: number): any;
26
+ /**
27
+ * Returns the number of elements in an array.
28
+ *
29
+ * @param {any[]} array - The array whose length is to be determined
30
+ * @returns {any} The number of elements in the array
31
+ * @example
32
+ * ```yaml
33
+ * num_colors:
34
+ * "@pipe":
35
+ * - ["{a.output.data.colors}"]
36
+ * - ["{@array.length}"]
37
+ * ```
38
+ */
3
39
  length(array: any[]): any;
40
+ /**
41
+ * Concatenates two arrays and returns a new array containing the
42
+ * elements of both.
43
+ *
44
+ * @param {any[]} array1 - The first array
45
+ * @param {any[]} array2 - The second array to concatenate
46
+ * @returns {any[]} A new array containing elements from both input arrays
47
+ * @example
48
+ * ```yaml
49
+ * concatenated_colors:
50
+ * "@pipe":
51
+ * - ["{a.output.data.colors1}", "{a.output.data.colors2}"]
52
+ * - ["{@array.concat}"]
53
+ * ```
54
+ */
4
55
  concat(array1: any[], array2: any[]): any[];
56
+ /**
57
+ * Returns the first index at which a given element can be found in
58
+ * the array, or -1 if the element is not present.
59
+ *
60
+ * @param {any[]} array - The array to search
61
+ * @param {any} searchElement - The element to locate in the array
62
+ * @param {number} [fromIndex] - The index to start the search from
63
+ * @returns {number} The first index of the element, or -1 if not found
64
+ * @example
65
+ * ```yaml
66
+ * green_index:
67
+ * "@pipe":
68
+ * - ["{a.output.data.colors}", "green"]
69
+ * - ["{@array.indexOf}"]
70
+ * ```
71
+ */
5
72
  indexOf(array: any[], searchElement: any, fromIndex?: number): number;
73
+ /**
74
+ * Joins all elements of an array into a string, using a specified
75
+ * delimiter between each element.
76
+ *
77
+ * @param {any[]} array - The array whose elements are to be joined
78
+ * @param {string} separator - The string used to separate each element
79
+ * @returns {string} A string with all array elements joined by the separator
80
+ * @example
81
+ * ```yaml
82
+ * sentence:
83
+ * "@pipe":
84
+ * - ["{a.output.data.words}", " "]
85
+ * - ["{@array.join}"]
86
+ * ```
87
+ */
6
88
  join(array: any[], separator: string): string;
89
+ /**
90
+ * Returns the last index at which a given element can be found in
91
+ * the array, or -1 if it is not present. The array is searched
92
+ * backwards.
93
+ *
94
+ * @param {any[]} array - The array to search
95
+ * @param {any} searchElement - The element to locate in the array
96
+ * @param {number} [fromIndex] - The index at which to start searching backwards
97
+ * @returns {number} The last index of the element, or -1 if not found
98
+ * @example
99
+ * ```yaml
100
+ * last_green_index:
101
+ * "@pipe":
102
+ * - ["{a.output.data.colors}", "green"]
103
+ * - ["{@array.lastIndexOf}"]
104
+ * ```
105
+ */
7
106
  lastIndexOf(array: any[], searchElement: any, fromIndex?: number): number;
107
+ /**
108
+ * Removes the last element from an array and returns that element.
109
+ *
110
+ * @param {any[]} array - The array from which to remove the last element
111
+ * @returns {any} The removed element, or undefined if the array is empty
112
+ * @example
113
+ * ```yaml
114
+ * last_color:
115
+ * "@pipe":
116
+ * - ["{a.output.data.colors}"]
117
+ * - ["{@array.pop}"]
118
+ * ```
119
+ */
8
120
  pop(array: any[]): any;
121
+ /**
122
+ * Adds one or more elements to the end of an array and returns the
123
+ * modified array.
124
+ *
125
+ * @param {any[]} array - The array to add elements to
126
+ * @param {...any[]} items - The elements to add to the end of the array
127
+ * @returns {any[]} The modified array with the new elements appended
128
+ * @example
129
+ * ```yaml
130
+ * updated_colors:
131
+ * "@pipe":
132
+ * - ["{a.output.data.colors}", "yellow"]
133
+ * - ["{@array.push}"]
134
+ * ```
135
+ */
9
136
  push(array: any[], ...items: any[]): any[];
137
+ /**
138
+ * Reverses the order of the elements in an array in place and returns
139
+ * the reversed array.
140
+ *
141
+ * @param {any[]} array - The array to reverse
142
+ * @returns {any[]} The reversed array
143
+ * @example
144
+ * ```yaml
145
+ * reversed_numbers:
146
+ * "@pipe":
147
+ * - ["{a.output.data.numbers}"]
148
+ * - ["{@array.reverse}"]
149
+ * ```
150
+ */
10
151
  reverse(array: any[]): any[];
152
+ /**
153
+ * Removes the first element from an array and returns that element.
154
+ *
155
+ * @param {any[]} array - The array from which to remove the first element
156
+ * @returns {any} The removed element, or undefined if the array is empty
157
+ * @example
158
+ * ```yaml
159
+ * first_color:
160
+ * "@pipe":
161
+ * - ["{a.output.data.colors}"]
162
+ * - ["{@array.shift}"]
163
+ * ```
164
+ */
11
165
  shift(array: any[]): any;
166
+ /**
167
+ * Returns a shallow copy of a portion of an array selected from the
168
+ * start index up to, but not including, the end index.
169
+ *
170
+ * @param {any[]} array - The array to slice
171
+ * @param {number} [start] - The beginning index of the slice (inclusive)
172
+ * @param {number} [end] - The end index of the slice (exclusive); if omitted, slices to the end
173
+ * @returns {any[]} A new array containing the extracted elements
174
+ * @example
175
+ * ```yaml
176
+ * numbers_slice:
177
+ * "@pipe":
178
+ * - ["{a.output.data.numbers}", 1, 3]
179
+ * - ["{@array.slice}"]
180
+ * ```
181
+ */
12
182
  slice(array: any[], start?: number, end?: number): any[];
183
+ /**
184
+ * Sorts the elements of an array in place and returns the sorted array.
185
+ * Supports ascending (default) and descending sort orders. Handles
186
+ * null/undefined values and uses locale-aware comparison for strings.
187
+ *
188
+ * @param {any[]} array - The array to sort
189
+ * @param {'ASCENDING' | 'DESCENDING'} [order='ASCENDING'] - The sort order
190
+ * @returns {any[]} The sorted array
191
+ * @example
192
+ * ```yaml
193
+ * sorted_numbers:
194
+ * "@pipe":
195
+ * - ["{a.output.data.numbers}"]
196
+ * - ["{@array.sort}"]
197
+ * ```
198
+ */
13
199
  sort(array: any[], order?: 'ASCENDING' | 'DESCENDING'): any[];
200
+ /**
201
+ * Changes the contents of an array by removing or replacing existing
202
+ * elements and/or adding new elements in place. Returns the array
203
+ * of removed elements.
204
+ *
205
+ * @param {any[]} array - The array to modify
206
+ * @param {number} start - The index at which to start changing the array
207
+ * @param {number} [deleteCount] - The number of elements to remove
208
+ * @param {...any[]} items - The elements to add at the start position
209
+ * @returns {any[]} An array containing the removed elements
210
+ * @example
211
+ * ```yaml
212
+ * modified_colors:
213
+ * "@pipe":
214
+ * - ["{a.output.data.colors}", 1, 2, "orange"]
215
+ * - ["{@array.splice}"]
216
+ * ```
217
+ */
14
218
  splice(array: any[], start: number, deleteCount?: number, ...items: any[]): any[];
219
+ /**
220
+ * Adds one or more elements to the beginning of an array and returns
221
+ * the new length of the array.
222
+ *
223
+ * @param {any[]} array - The array to add elements to
224
+ * @param {...any[]} items - The elements to add to the front of the array
225
+ * @returns {number} The new length of the array
226
+ * @example
227
+ * ```yaml
228
+ * updated_colors:
229
+ * "@pipe":
230
+ * - ["{a.output.data.colors}", "yellow"]
231
+ * - ["{@array.unshift}"]
232
+ * ```
233
+ */
15
234
  unshift(array: any[], ...items: any[]): number;
16
235
  }
17
236
  export { ArrayHandler };
@@ -1,41 +1,227 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ArrayHandler = void 0;
4
+ /**
5
+ * Provides functional transformations for arrays within HotMesh mapping
6
+ * rules. Although inspired by JavaScript, these methods have been adapted
7
+ * to follow a functional approach. Each transformation is a function that
8
+ * expects one or more input parameters from the prior row in the `@pipe`
9
+ * structure.
10
+ *
11
+ * @remarks Invoked via `{@array.<method>}` in YAML mapping rules.
12
+ */
4
13
  class ArrayHandler {
14
+ /**
15
+ * Retrieves an element from an array by its index.
16
+ *
17
+ * @param {any[]} array - The array from which to retrieve the element
18
+ * @param {number} index - The zero-based index of the element to retrieve
19
+ * @returns {any} The element at the specified index, or undefined if the array is nullish
20
+ * @example
21
+ * ```yaml
22
+ * second_color:
23
+ * "@pipe":
24
+ * - ["{a.output.data.colors}", 1]
25
+ * - ["{@array.get}"]
26
+ * ```
27
+ */
5
28
  get(array, index) {
6
29
  return array?.[index || 0];
7
30
  }
31
+ /**
32
+ * Returns the number of elements in an array.
33
+ *
34
+ * @param {any[]} array - The array whose length is to be determined
35
+ * @returns {any} The number of elements in the array
36
+ * @example
37
+ * ```yaml
38
+ * num_colors:
39
+ * "@pipe":
40
+ * - ["{a.output.data.colors}"]
41
+ * - ["{@array.length}"]
42
+ * ```
43
+ */
8
44
  length(array) {
9
45
  return array?.length;
10
46
  }
47
+ /**
48
+ * Concatenates two arrays and returns a new array containing the
49
+ * elements of both.
50
+ *
51
+ * @param {any[]} array1 - The first array
52
+ * @param {any[]} array2 - The second array to concatenate
53
+ * @returns {any[]} A new array containing elements from both input arrays
54
+ * @example
55
+ * ```yaml
56
+ * concatenated_colors:
57
+ * "@pipe":
58
+ * - ["{a.output.data.colors1}", "{a.output.data.colors2}"]
59
+ * - ["{@array.concat}"]
60
+ * ```
61
+ */
11
62
  concat(array1, array2) {
12
63
  return array1.concat(array2);
13
64
  }
65
+ /**
66
+ * Returns the first index at which a given element can be found in
67
+ * the array, or -1 if the element is not present.
68
+ *
69
+ * @param {any[]} array - The array to search
70
+ * @param {any} searchElement - The element to locate in the array
71
+ * @param {number} [fromIndex] - The index to start the search from
72
+ * @returns {number} The first index of the element, or -1 if not found
73
+ * @example
74
+ * ```yaml
75
+ * green_index:
76
+ * "@pipe":
77
+ * - ["{a.output.data.colors}", "green"]
78
+ * - ["{@array.indexOf}"]
79
+ * ```
80
+ */
14
81
  indexOf(array, searchElement, fromIndex) {
15
82
  return array.indexOf(searchElement, fromIndex);
16
83
  }
84
+ /**
85
+ * Joins all elements of an array into a string, using a specified
86
+ * delimiter between each element.
87
+ *
88
+ * @param {any[]} array - The array whose elements are to be joined
89
+ * @param {string} separator - The string used to separate each element
90
+ * @returns {string} A string with all array elements joined by the separator
91
+ * @example
92
+ * ```yaml
93
+ * sentence:
94
+ * "@pipe":
95
+ * - ["{a.output.data.words}", " "]
96
+ * - ["{@array.join}"]
97
+ * ```
98
+ */
17
99
  join(array, separator) {
18
100
  return array.join(separator);
19
101
  }
102
+ /**
103
+ * Returns the last index at which a given element can be found in
104
+ * the array, or -1 if it is not present. The array is searched
105
+ * backwards.
106
+ *
107
+ * @param {any[]} array - The array to search
108
+ * @param {any} searchElement - The element to locate in the array
109
+ * @param {number} [fromIndex] - The index at which to start searching backwards
110
+ * @returns {number} The last index of the element, or -1 if not found
111
+ * @example
112
+ * ```yaml
113
+ * last_green_index:
114
+ * "@pipe":
115
+ * - ["{a.output.data.colors}", "green"]
116
+ * - ["{@array.lastIndexOf}"]
117
+ * ```
118
+ */
20
119
  lastIndexOf(array, searchElement, fromIndex) {
21
120
  return array.lastIndexOf(searchElement, fromIndex);
22
121
  }
122
+ /**
123
+ * Removes the last element from an array and returns that element.
124
+ *
125
+ * @param {any[]} array - The array from which to remove the last element
126
+ * @returns {any} The removed element, or undefined if the array is empty
127
+ * @example
128
+ * ```yaml
129
+ * last_color:
130
+ * "@pipe":
131
+ * - ["{a.output.data.colors}"]
132
+ * - ["{@array.pop}"]
133
+ * ```
134
+ */
23
135
  pop(array) {
24
136
  return array.pop();
25
137
  }
138
+ /**
139
+ * Adds one or more elements to the end of an array and returns the
140
+ * modified array.
141
+ *
142
+ * @param {any[]} array - The array to add elements to
143
+ * @param {...any[]} items - The elements to add to the end of the array
144
+ * @returns {any[]} The modified array with the new elements appended
145
+ * @example
146
+ * ```yaml
147
+ * updated_colors:
148
+ * "@pipe":
149
+ * - ["{a.output.data.colors}", "yellow"]
150
+ * - ["{@array.push}"]
151
+ * ```
152
+ */
26
153
  push(array, ...items) {
27
154
  array.push(...items);
28
155
  return array;
29
156
  }
157
+ /**
158
+ * Reverses the order of the elements in an array in place and returns
159
+ * the reversed array.
160
+ *
161
+ * @param {any[]} array - The array to reverse
162
+ * @returns {any[]} The reversed array
163
+ * @example
164
+ * ```yaml
165
+ * reversed_numbers:
166
+ * "@pipe":
167
+ * - ["{a.output.data.numbers}"]
168
+ * - ["{@array.reverse}"]
169
+ * ```
170
+ */
30
171
  reverse(array) {
31
172
  return array.reverse();
32
173
  }
174
+ /**
175
+ * Removes the first element from an array and returns that element.
176
+ *
177
+ * @param {any[]} array - The array from which to remove the first element
178
+ * @returns {any} The removed element, or undefined if the array is empty
179
+ * @example
180
+ * ```yaml
181
+ * first_color:
182
+ * "@pipe":
183
+ * - ["{a.output.data.colors}"]
184
+ * - ["{@array.shift}"]
185
+ * ```
186
+ */
33
187
  shift(array) {
34
188
  return array.shift();
35
189
  }
190
+ /**
191
+ * Returns a shallow copy of a portion of an array selected from the
192
+ * start index up to, but not including, the end index.
193
+ *
194
+ * @param {any[]} array - The array to slice
195
+ * @param {number} [start] - The beginning index of the slice (inclusive)
196
+ * @param {number} [end] - The end index of the slice (exclusive); if omitted, slices to the end
197
+ * @returns {any[]} A new array containing the extracted elements
198
+ * @example
199
+ * ```yaml
200
+ * numbers_slice:
201
+ * "@pipe":
202
+ * - ["{a.output.data.numbers}", 1, 3]
203
+ * - ["{@array.slice}"]
204
+ * ```
205
+ */
36
206
  slice(array, start, end) {
37
207
  return array.slice(start, end);
38
208
  }
209
+ /**
210
+ * Sorts the elements of an array in place and returns the sorted array.
211
+ * Supports ascending (default) and descending sort orders. Handles
212
+ * null/undefined values and uses locale-aware comparison for strings.
213
+ *
214
+ * @param {any[]} array - The array to sort
215
+ * @param {'ASCENDING' | 'DESCENDING'} [order='ASCENDING'] - The sort order
216
+ * @returns {any[]} The sorted array
217
+ * @example
218
+ * ```yaml
219
+ * sorted_numbers:
220
+ * "@pipe":
221
+ * - ["{a.output.data.numbers}"]
222
+ * - ["{@array.sort}"]
223
+ * ```
224
+ */
39
225
  sort(array, order = 'ASCENDING') {
40
226
  return array.sort((a, b) => {
41
227
  if (order === 'ASCENDING') {
@@ -64,9 +250,42 @@ class ArrayHandler {
64
250
  }
65
251
  });
66
252
  }
253
+ /**
254
+ * Changes the contents of an array by removing or replacing existing
255
+ * elements and/or adding new elements in place. Returns the array
256
+ * of removed elements.
257
+ *
258
+ * @param {any[]} array - The array to modify
259
+ * @param {number} start - The index at which to start changing the array
260
+ * @param {number} [deleteCount] - The number of elements to remove
261
+ * @param {...any[]} items - The elements to add at the start position
262
+ * @returns {any[]} An array containing the removed elements
263
+ * @example
264
+ * ```yaml
265
+ * modified_colors:
266
+ * "@pipe":
267
+ * - ["{a.output.data.colors}", 1, 2, "orange"]
268
+ * - ["{@array.splice}"]
269
+ * ```
270
+ */
67
271
  splice(array, start, deleteCount, ...items) {
68
272
  return array.splice(start, deleteCount, ...items);
69
273
  }
274
+ /**
275
+ * Adds one or more elements to the beginning of an array and returns
276
+ * the new length of the array.
277
+ *
278
+ * @param {any[]} array - The array to add elements to
279
+ * @param {...any[]} items - The elements to add to the front of the array
280
+ * @returns {number} The new length of the array
281
+ * @example
282
+ * ```yaml
283
+ * updated_colors:
284
+ * "@pipe":
285
+ * - ["{a.output.data.colors}", "yellow"]
286
+ * - ["{@array.unshift}"]
287
+ * ```
288
+ */
70
289
  unshift(array, ...items) {
71
290
  return array.unshift(...items);
72
291
  }
@@ -1,9 +1,103 @@
1
+ /**
2
+ * Provides bitwise operation functions for use in HotMesh mapping rules.
3
+ * Although inspired by JavaScript, they have been adapted to follow a
4
+ * functional approach. Each transformation is a function that expects
5
+ * one or more input parameters from the prior row in the `@pipe` structure.
6
+ *
7
+ * @remarks
8
+ * Invoked in mapping rules using `{@bitwise.<method>}` syntax.
9
+ */
1
10
  declare class BitwiseHandler {
11
+ /**
12
+ * Performs a bitwise AND operation on two numbers.
13
+ *
14
+ * @param {number} a - The first operand
15
+ * @param {number} b - The second operand
16
+ * @returns {number} The result of `a & b`
17
+ * @example
18
+ * ```yaml
19
+ * bitwise_and_result:
20
+ * "@pipe":
21
+ * - ["{a.numbers.a}", "{a.numbers.b}"]
22
+ * - ["{@bitwise.and}"]
23
+ * ```
24
+ */
2
25
  and(a: number, b: number): number;
26
+ /**
27
+ * Performs a bitwise OR operation on two numbers.
28
+ *
29
+ * @param {number} a - The first operand
30
+ * @param {number} b - The second operand
31
+ * @returns {number} The result of `a | b`
32
+ * @example
33
+ * ```yaml
34
+ * bitwise_or_result:
35
+ * "@pipe":
36
+ * - ["{a.numbers.a}", "{a.numbers.b}"]
37
+ * - ["{@bitwise.or}"]
38
+ * ```
39
+ */
3
40
  or(a: number, b: number): number;
41
+ /**
42
+ * Performs a bitwise XOR operation on two numbers.
43
+ *
44
+ * @param {number} a - The first operand
45
+ * @param {number} b - The second operand
46
+ * @returns {number} The result of `a ^ b`
47
+ * @example
48
+ * ```yaml
49
+ * bitwise_xor_result:
50
+ * "@pipe":
51
+ * - ["{a.numbers.a}", "{a.numbers.b}"]
52
+ * - ["{@bitwise.xor}"]
53
+ * ```
54
+ */
4
55
  xor(a: number, b: number): number;
56
+ /**
57
+ * Performs a bitwise left shift operation on a number.
58
+ *
59
+ * @param {number} a - The number to shift
60
+ * @param {number} b - The number of positions to shift left
61
+ * @returns {number} The result of `a << b`
62
+ * @example
63
+ * ```yaml
64
+ * bitwise_left_shift_result:
65
+ * "@pipe":
66
+ * - ["{a.numbers.a}", "{a.numbers.shift}"]
67
+ * - ["{@bitwise.leftShift}"]
68
+ * ```
69
+ */
5
70
  leftShift(a: number, b: number): number;
71
+ /**
72
+ * Performs a bitwise right shift operation on a number,
73
+ * preserving the sign bit.
74
+ *
75
+ * @param {number} a - The number to shift
76
+ * @param {number} b - The number of positions to shift right
77
+ * @returns {number} The result of `a >> b`
78
+ * @example
79
+ * ```yaml
80
+ * bitwise_right_shift_result:
81
+ * "@pipe":
82
+ * - ["{a.numbers.a}", "{a.numbers.shift}"]
83
+ * - ["{@bitwise.rightShift}"]
84
+ * ```
85
+ */
6
86
  rightShift(a: number, b: number): number;
87
+ /**
88
+ * Performs a bitwise unsigned right shift operation on a number.
89
+ *
90
+ * @param {number} a - The number to shift
91
+ * @param {number} b - The number of positions to shift right
92
+ * @returns {number} The result of `a >>> b`
93
+ * @example
94
+ * ```yaml
95
+ * bitwise_unsigned_right_shift_result:
96
+ * "@pipe":
97
+ * - ["{a.numbers.a}", "{a.numbers.shift}"]
98
+ * - ["{@bitwise.unsignedRightShift}"]
99
+ * ```
100
+ */
7
101
  unsignedRightShift(a: number, b: number): number;
8
102
  }
9
103
  export { BitwiseHandler };