@hotmeshio/hotmesh 0.14.1 → 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 (31) 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/virtual/index.js +6 -0
  29. package/build/services/virtual/schemas/factory.js +1 -1
  30. package/build/types/virtual.d.ts +21 -0
  31. package/package.json +1 -1
@@ -1,25 +1,346 @@
1
+ /**
2
+ * Provides functional transformations for JavaScript objects within
3
+ * HotMesh mapping rules. Although inspired by JavaScript, these methods
4
+ * have been adapted to follow a functional approach. Each transformation
5
+ * is a function that expects one or more input parameters from the prior
6
+ * row in the `@pipe` structure.
7
+ *
8
+ * @remarks Invoked via `{@object.<method>}` in YAML mapping rules.
9
+ */
1
10
  declare class ObjectHandler {
11
+ /**
12
+ * Retrieves a property value from an object by its property name.
13
+ *
14
+ * @param {object} obj - The object from which to retrieve the property value
15
+ * @param {string | symbol} prop - The name of the property to retrieve
16
+ * @returns {any} The value of the specified property, or undefined if the object is nullish
17
+ * @example
18
+ * ```yaml
19
+ * second_color:
20
+ * "@pipe":
21
+ * - ["{a.output.data.colors}", "second"]
22
+ * - ["{@object.get}"]
23
+ * ```
24
+ */
2
25
  get(obj: object, prop: string | symbol): any;
26
+ /**
27
+ * Sets a property on an object with a specified value and returns the
28
+ * object. If the input object is `undefined` or `null`, a new object
29
+ * will be created.
30
+ *
31
+ * @param {object} obj - The object to set the property on
32
+ * @param {string | symbol} prop - The name of the property to set
33
+ * @param {any} value - The value to assign to the property
34
+ * @returns {any} The modified object with the new property value
35
+ * @example
36
+ * ```yaml
37
+ * output:
38
+ * "@pipe":
39
+ * - ["{a.output.data.colors}", "third", "blue"]
40
+ * - ["{@object.set}"]
41
+ * ```
42
+ */
3
43
  set(obj: object, prop: string | symbol, value: any): any;
44
+ /**
45
+ * Creates a new object with specified key-value pairs. Arguments are
46
+ * provided as alternating key-value pairs. If no arguments are provided,
47
+ * an empty object will be created.
48
+ *
49
+ * @param {...any[]} args - Alternating key-value pairs (key1, value1, key2, value2, ...)
50
+ * @returns {object} A new object constructed from the provided key-value pairs
51
+ * @example
52
+ * ```yaml
53
+ * person:
54
+ * "@pipe":
55
+ * - ["name", "John", "age", 30, "city", "New York"]
56
+ * - ["{@object.create}"]
57
+ * ```
58
+ */
4
59
  create(...args: any[]): object;
60
+ /**
61
+ * Retrieves an array of a given object's own enumerable property names.
62
+ *
63
+ * @param {object} obj - The object whose property names are to be retrieved
64
+ * @returns {string[]} An array of the object's own enumerable property names
65
+ * @example
66
+ * ```yaml
67
+ * property_names:
68
+ * "@pipe":
69
+ * - ["{a.output.data}"]
70
+ * - ["{@object.keys}"]
71
+ * ```
72
+ */
5
73
  keys(obj: object): string[];
74
+ /**
75
+ * Retrieves an array of a given object's own enumerable property values.
76
+ *
77
+ * @param {object} obj - The object from which to extract the values
78
+ * @returns {any[]} An array of the object's own enumerable property values
79
+ * @example
80
+ * ```yaml
81
+ * color_values:
82
+ * "@pipe":
83
+ * - ["{a.output.data.colors}"]
84
+ * - ["{@object.values}"]
85
+ * ```
86
+ */
6
87
  values(obj: object): any[];
88
+ /**
89
+ * Retrieves an array of the object's own enumerable key-value pairs.
90
+ *
91
+ * @param {object} obj - The object from which to extract the entries
92
+ * @returns {[string, any][]} An array of [key, value] pairs
93
+ * @example
94
+ * ```yaml
95
+ * color_entries:
96
+ * "@pipe":
97
+ * - ["{a.output.data.colors}"]
98
+ * - ["{@object.entries}"]
99
+ * ```
100
+ */
7
101
  entries(obj: object): [string, any][];
102
+ /**
103
+ * Transforms an array of key-value pairs into an object.
104
+ *
105
+ * @param {Iterable<[string, any]>} iterable - An iterable of key-value pairs (e.g., an array of [key, value] arrays)
106
+ * @returns {object} A new object constructed from the key-value pairs
107
+ * @example
108
+ * ```yaml
109
+ * color_object:
110
+ * "@pipe":
111
+ * - ["{a.output.data.pairs}"]
112
+ * - ["{@object.fromEntries}"]
113
+ * ```
114
+ */
8
115
  fromEntries(iterable: Iterable<[string, any]>): object;
116
+ /**
117
+ * Merges one or more source objects into a target object. Properties
118
+ * in later sources overwrite earlier ones.
119
+ *
120
+ * @param {object} target - The target object to merge into
121
+ * @param {...object[]} sources - One or more source objects to merge from
122
+ * @returns {object} The target object with all source properties merged in
123
+ * @example
124
+ * ```yaml
125
+ * combined_colors:
126
+ * "@pipe":
127
+ * - ["{@symbol.object}", "{a.output.data.colors}", "{b.output.data.colors}"]
128
+ * - ["{@object.assign}"]
129
+ * ```
130
+ */
9
131
  assign(target: object, ...sources: object[]): object;
132
+ /**
133
+ * Returns an array of all property names (including non-enumerable) of
134
+ * an object.
135
+ *
136
+ * @param {object} obj - The object to retrieve property names from
137
+ * @returns {string[]} An array of all own property names
138
+ * @example
139
+ * ```yaml
140
+ * propertyNames:
141
+ * "@pipe":
142
+ * - ["{a.person}"]
143
+ * - ["{@object.getOwnPropertyNames}"]
144
+ * ```
145
+ */
10
146
  getOwnPropertyNames(obj: object): string[];
147
+ /**
148
+ * Returns an array of all symbol properties of an object.
149
+ *
150
+ * @param {object} obj - The object to retrieve symbol properties from
151
+ * @returns {symbol[]} An array of all own symbol properties
152
+ * @example
153
+ * ```yaml
154
+ * symbolProperties:
155
+ * "@pipe":
156
+ * - ["{a.person}"]
157
+ * - ["{@object.getOwnPropertySymbols}"]
158
+ * ```
159
+ */
11
160
  getOwnPropertySymbols(obj: object): symbol[];
161
+ /**
162
+ * Returns a property descriptor for an own property of an object.
163
+ *
164
+ * @param {object} obj - The object to retrieve the property descriptor from
165
+ * @param {string | symbol} prop - The name of the property
166
+ * @returns {PropertyDescriptor | undefined} The property descriptor, or undefined if the property does not exist
167
+ * @example
168
+ * ```yaml
169
+ * ageDescriptor:
170
+ * "@pipe":
171
+ * - ["{a.person}", "age"]
172
+ * - ["{@object.getOwnPropertyDescriptor}"]
173
+ * ```
174
+ */
12
175
  getOwnPropertyDescriptor(obj: object, prop: string | symbol): PropertyDescriptor | undefined;
176
+ /**
177
+ * Defines a new property or modifies an existing property on an object
178
+ * and returns the object.
179
+ *
180
+ * @param {object} obj - The object to define the property on
181
+ * @param {string | symbol} prop - The name of the property to define or modify
182
+ * @param {PropertyDescriptor} descriptor - The descriptor for the property being defined or modified
183
+ * @returns {object} The object with the defined property
184
+ * @example
185
+ * ```yaml
186
+ * person:
187
+ * "@pipe":
188
+ * - ["{a.person}", "city", {"value": "New York", "writable": false}]
189
+ * - ["{@object.defineProperty}"]
190
+ * ```
191
+ */
13
192
  defineProperty(obj: object, prop: string | symbol, descriptor: PropertyDescriptor): object;
193
+ /**
194
+ * Defines new properties or modifies existing properties on an object
195
+ * and returns the object.
196
+ *
197
+ * @param {object} obj - The object to define properties on
198
+ * @param {PropertyDescriptorMap} props - An object whose keys represent property names and whose values are property descriptors
199
+ * @returns {object} The object with the defined properties
200
+ * @example
201
+ * ```yaml
202
+ * person:
203
+ * "@pipe":
204
+ * - ["{a.person}", {"age": {"value": 30}, "city": {"value": "New York", "writable": false}}]
205
+ * - ["{@object.defineProperties}"]
206
+ * ```
207
+ */
14
208
  defineProperties(obj: object, props: PropertyDescriptorMap): object;
209
+ /**
210
+ * Freezes an object, making it immutable. Prevents new properties from
211
+ * being added, existing properties from being removed, and values of
212
+ * existing properties from being modified.
213
+ *
214
+ * @param {object} obj - The object to freeze
215
+ * @returns {object} The frozen object
216
+ * @example
217
+ * ```yaml
218
+ * person:
219
+ * "@pipe":
220
+ * - ["{a.person}"]
221
+ * - ["{@object.freeze}"]
222
+ * ```
223
+ */
15
224
  freeze(obj: object): object;
225
+ /**
226
+ * Determines if an object is frozen.
227
+ *
228
+ * @param {object} obj - The object to check
229
+ * @returns {boolean} True if the object is frozen, otherwise false
230
+ * @example
231
+ * ```yaml
232
+ * isFrozen:
233
+ * "@pipe":
234
+ * - ["{a.person}"]
235
+ * - ["{@object.isFrozen}"]
236
+ * ```
237
+ */
16
238
  isFrozen(obj: object): boolean;
239
+ /**
240
+ * Seals an object, preventing new properties from being added and
241
+ * marking all existing properties as non-configurable. Values of
242
+ * existing properties can still be modified.
243
+ *
244
+ * @param {object} obj - The object to seal
245
+ * @returns {object} The sealed object
246
+ * @example
247
+ * ```yaml
248
+ * person:
249
+ * "@pipe":
250
+ * - ["{a.person}"]
251
+ * - ["{@object.seal}"]
252
+ * ```
253
+ */
17
254
  seal(obj: object): object;
255
+ /**
256
+ * Determines if an object is sealed.
257
+ *
258
+ * @param {object} obj - The object to check
259
+ * @returns {boolean} True if the object is sealed, otherwise false
260
+ * @example
261
+ * ```yaml
262
+ * isSealed:
263
+ * "@pipe":
264
+ * - ["{a.person}"]
265
+ * - ["{@object.isSealed}"]
266
+ * ```
267
+ */
18
268
  isSealed(obj: object): boolean;
269
+ /**
270
+ * Prevents new properties from being added to an object. Existing
271
+ * properties can still be modified or deleted.
272
+ *
273
+ * @param {object} obj - The object to make non-extensible
274
+ * @returns {object} The non-extensible object
275
+ * @example
276
+ * ```yaml
277
+ * person:
278
+ * "@pipe":
279
+ * - ["{a.person}"]
280
+ * - ["{@object.preventExtensions}"]
281
+ * ```
282
+ */
19
283
  preventExtensions(obj: object): object;
284
+ /**
285
+ * Determines if an object is extensible (i.e., whether new properties
286
+ * can be added to it).
287
+ *
288
+ * @param {object} obj - The object to check
289
+ * @returns {boolean} True if the object is extensible, otherwise false
290
+ * @example
291
+ * ```yaml
292
+ * isExtensible:
293
+ * "@pipe":
294
+ * - ["{a.person}"]
295
+ * - ["{@object.isExtensible}"]
296
+ * ```
297
+ */
20
298
  isExtensible(obj: object): boolean;
299
+ /**
300
+ * Determines if an object has a specified property as its own property
301
+ * (as opposed to inheriting it from the prototype chain).
302
+ *
303
+ * @param {object} obj - The object to check
304
+ * @param {string | symbol} prop - The name of the property to test
305
+ * @returns {boolean} True if the object has the specified own property, otherwise false
306
+ * @example
307
+ * ```yaml
308
+ * hasAge:
309
+ * "@pipe":
310
+ * - ["{a.person}", "age"]
311
+ * - ["{@object.hasOwnProperty}"]
312
+ * ```
313
+ */
21
314
  hasOwnProperty(obj: object, prop: string | symbol): boolean;
315
+ /**
316
+ * Determines if an object exists in another object's prototype chain.
317
+ *
318
+ * @param {object} obj - The object whose prototype chain is to be checked
319
+ * @param {object} prototypeObj - The prototype object to search for
320
+ * @returns {boolean} True if the prototype object is found in the object's prototype chain, otherwise false
321
+ * @example
322
+ * ```yaml
323
+ * isPersonPrototypeOfEmployee:
324
+ * "@pipe":
325
+ * - ["{a.person}", "{a.employee}"]
326
+ * - ["{@object.isPrototypeOf}"]
327
+ * ```
328
+ */
22
329
  isPrototypeOf(obj: object, prototypeObj: object): boolean;
330
+ /**
331
+ * Determines if a specified property on an object is enumerable.
332
+ *
333
+ * @param {object} obj - The object to check
334
+ * @param {string | symbol} prop - The name of the property to test
335
+ * @returns {boolean} True if the specified property is enumerable, otherwise false
336
+ * @example
337
+ * ```yaml
338
+ * isAgeEnumerable:
339
+ * "@pipe":
340
+ * - ["{a.person}", "age"]
341
+ * - ["{@object.propertyIsEnumerable}"]
342
+ * ```
343
+ */
23
344
  propertyIsEnumerable(obj: object, prop: string | symbol): boolean;
24
345
  }
25
346
  export { ObjectHandler };