@r146023/omniturbo 0.1.0

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 (107) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +320 -0
  3. package/dist/Omni.d.ts +82 -0
  4. package/dist/Omni.d.ts.map +1 -0
  5. package/dist/Omni.js +477 -0
  6. package/dist/Omni.js.map +1 -0
  7. package/dist/aliases/AliasRegistry.d.ts +8 -0
  8. package/dist/aliases/AliasRegistry.d.ts.map +1 -0
  9. package/dist/aliases/AliasRegistry.js +29 -0
  10. package/dist/aliases/AliasRegistry.js.map +1 -0
  11. package/dist/batch/batch.d.ts +4 -0
  12. package/dist/batch/batch.d.ts.map +1 -0
  13. package/dist/batch/batch.js +17 -0
  14. package/dist/batch/batch.js.map +1 -0
  15. package/dist/core/equality.d.ts +6 -0
  16. package/dist/core/equality.d.ts.map +1 -0
  17. package/dist/core/equality.js +43 -0
  18. package/dist/core/equality.js.map +1 -0
  19. package/dist/core/ids.d.ts +5 -0
  20. package/dist/core/ids.d.ts.map +1 -0
  21. package/dist/core/ids.js +6 -0
  22. package/dist/core/ids.js.map +1 -0
  23. package/dist/core/object.d.ts +49 -0
  24. package/dist/core/object.d.ts.map +1 -0
  25. package/dist/core/object.js +134 -0
  26. package/dist/core/object.js.map +1 -0
  27. package/dist/core/path.d.ts +9 -0
  28. package/dist/core/path.d.ts.map +1 -0
  29. package/dist/core/path.js +46 -0
  30. package/dist/core/path.js.map +1 -0
  31. package/dist/datatypes/DataTypeRegistry.d.ts +10 -0
  32. package/dist/datatypes/DataTypeRegistry.d.ts.map +1 -0
  33. package/dist/datatypes/DataTypeRegistry.js +27 -0
  34. package/dist/datatypes/DataTypeRegistry.js.map +1 -0
  35. package/dist/datatypes/builtins.d.ts +3 -0
  36. package/dist/datatypes/builtins.d.ts.map +1 -0
  37. package/dist/datatypes/builtins.js +41 -0
  38. package/dist/datatypes/builtins.js.map +1 -0
  39. package/dist/history/history.d.ts +4 -0
  40. package/dist/history/history.d.ts.map +1 -0
  41. package/dist/history/history.js +22 -0
  42. package/dist/history/history.js.map +1 -0
  43. package/dist/history/timeline.d.ts +11 -0
  44. package/dist/history/timeline.d.ts.map +1 -0
  45. package/dist/history/timeline.js +22 -0
  46. package/dist/history/timeline.js.map +1 -0
  47. package/dist/index.d.ts +14 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +14 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/privacy/PrivacyRegistry.d.ts +22 -0
  52. package/dist/privacy/PrivacyRegistry.d.ts.map +1 -0
  53. package/dist/privacy/PrivacyRegistry.js +84 -0
  54. package/dist/privacy/PrivacyRegistry.js.map +1 -0
  55. package/dist/privacy/writeTokens.d.ts +15 -0
  56. package/dist/privacy/writeTokens.d.ts.map +1 -0
  57. package/dist/privacy/writeTokens.js +23 -0
  58. package/dist/privacy/writeTokens.js.map +1 -0
  59. package/dist/result/resultFactories.d.ts +28 -0
  60. package/dist/result/resultFactories.d.ts.map +1 -0
  61. package/dist/result/resultFactories.js +30 -0
  62. package/dist/result/resultFactories.js.map +1 -0
  63. package/dist/schema/SchemaRegistry.d.ts +33 -0
  64. package/dist/schema/SchemaRegistry.d.ts.map +1 -0
  65. package/dist/schema/SchemaRegistry.js +90 -0
  66. package/dist/schema/SchemaRegistry.js.map +1 -0
  67. package/dist/schema/schemaDefaults.d.ts +3 -0
  68. package/dist/schema/schemaDefaults.d.ts.map +1 -0
  69. package/dist/schema/schemaDefaults.js +6 -0
  70. package/dist/schema/schemaDefaults.js.map +1 -0
  71. package/dist/schema/schemaValidation.d.ts +20 -0
  72. package/dist/schema/schemaValidation.d.ts.map +1 -0
  73. package/dist/schema/schemaValidation.js +80 -0
  74. package/dist/schema/schemaValidation.js.map +1 -0
  75. package/dist/subscriptions/subscriptions.d.ts +341 -0
  76. package/dist/subscriptions/subscriptions.d.ts.map +1 -0
  77. package/dist/subscriptions/subscriptions.js +373 -0
  78. package/dist/subscriptions/subscriptions.js.map +1 -0
  79. package/dist/types/datatype_types.d.ts +25 -0
  80. package/dist/types/datatype_types.d.ts.map +1 -0
  81. package/dist/types/datatype_types.js +3 -0
  82. package/dist/types/datatype_types.js.map +1 -0
  83. package/dist/types/issue_types.d.ts +14 -0
  84. package/dist/types/issue_types.d.ts.map +1 -0
  85. package/dist/types/issue_types.js +2 -0
  86. package/dist/types/issue_types.js.map +1 -0
  87. package/dist/types/options_types.d.ts +48 -0
  88. package/dist/types/options_types.d.ts.map +1 -0
  89. package/dist/types/options_types.js +2 -0
  90. package/dist/types/options_types.js.map +1 -0
  91. package/dist/types/privacy_types.d.ts +22 -0
  92. package/dist/types/privacy_types.d.ts.map +1 -0
  93. package/dist/types/privacy_types.js +2 -0
  94. package/dist/types/privacy_types.js.map +1 -0
  95. package/dist/types/result_types.d.ts +20 -0
  96. package/dist/types/result_types.d.ts.map +1 -0
  97. package/dist/types/result_types.js +2 -0
  98. package/dist/types/result_types.js.map +1 -0
  99. package/dist/types/schema_types.d.ts +35 -0
  100. package/dist/types/schema_types.d.ts.map +1 -0
  101. package/dist/types/schema_types.js +2 -0
  102. package/dist/types/schema_types.js.map +1 -0
  103. package/dist/types/store_types.d.ts +37 -0
  104. package/dist/types/store_types.d.ts.map +1 -0
  105. package/dist/types/store_types.js +2 -0
  106. package/dist/types/store_types.js.map +1 -0
  107. package/package.json +41 -0
@@ -0,0 +1,341 @@
1
+ import type { OmniSubscriber, SubscriberTiming } from "../types/options_types";
2
+ /**
3
+ * ### Alert Config
4
+ *
5
+ * - `id`: A unique identifier for the alert, generated when the alert is registered.
6
+ * - `path`: The normalized path for which the alert is registered. Alerts will be triggered when a
7
+ * value is set at this path.
8
+ * - `fn`: The alert function that will be called when the alert is triggered. It should have the
9
+ * signature `(newValue: unknown, oldValue: unknown, path: string) => void`, where `newValue` is
10
+ * the new value being set, `oldValue` is the previous value at that path (if any), and `path` is
11
+ * the normalized path being set.
12
+ * - `condition`: An optional function that determines whether the alert should be triggered based
13
+ * on the new and old values. It should have the signature `(newValue: unknown, oldValue: unknown)
14
+ * => boolean`, where it returns true if the alert should be triggered, or false to skip
15
+ * triggering.
16
+ * - `throttle`: An optional number representing the minimum time in milliseconds between alert
17
+ * triggers. If specified, the alert will only be triggered if at least this amount of time has
18
+ * passed since the last trigger.
19
+ * - `lastTrigger`: A timestamp of the last time the alert was triggered, used in conjunction with
20
+ * throttling to determine if the alert can be triggered again.
21
+ * - `once`: A boolean flag indicating whether the alert should only be triggered once. If true, the
22
+ * alert will be automatically unregistered after being triggered for the first time.
23
+ *
24
+ */
25
+ export interface AlertConfig {
26
+ id: string;
27
+ path: string;
28
+ fn: Function;
29
+ condition?: Function;
30
+ throttle: number;
31
+ lastTrigger: number;
32
+ once: boolean;
33
+ }
34
+ /**
35
+ * ### Coerce Config
36
+ *
37
+ * - `id`: A unique identifier for the coercer, generated when the coercer is registered.
38
+ * - `path`: The normalized path for which the coercer is registered. Coercers will be triggered
39
+ * when a value is set at this path, allowing for transformation of the value before it is set.
40
+ * - `fn`: The coercer function that will be called when the coercer is triggered. It should have
41
+ * the signature `(path: string, value: unknown, oldValue?: unknown) => unknown`, where `path` is
42
+ * the normalized path being set, `value` is the new value being set, and `oldValue` is the
43
+ * previous value at that path (if any). The function should return the coerced value that will
44
+ * actually be set at that path.
45
+ * - `condition`: An optional function that determines whether the coercer should be triggered based
46
+ * on the new and old values. It should have the signature `(value: unknown, oldValue: unknown) =>
47
+ * boolean`, where it returns true if the coercer should be triggered, or false to skip
48
+ * triggering.
49
+ * - `throttle`: An optional number representing the minimum time in milliseconds between coercer
50
+ * triggers. If specified, the coercer will only be triggered if at least this amount of time has
51
+ * passed since the last trigger.
52
+ * - `lastTrigger`: A timestamp of the last time the coercer was triggered, used in conjunction with
53
+ * throttling to determine if the coercer can be triggered again.
54
+ * - `once`: A boolean flag indicating whether the coercer should only be triggered once. If true,
55
+ * the coercer will be automatically unregistered after being triggered for the first time.
56
+ */
57
+ export interface CoerceConfig {
58
+ id: string;
59
+ path: string;
60
+ fn: (path: string, value: unknown, oldValue?: unknown) => unknown;
61
+ condition?: Function;
62
+ throttle: number;
63
+ lastTrigger: number;
64
+ once: boolean;
65
+ }
66
+ /**
67
+ * ### Global Subscriber Config
68
+ * - `id`: A unique identifier for the global subscriber, generated when the subscriber is
69
+ * registered.
70
+ * - `fn`: The subscriber function that will be called for every change at any path. It should have
71
+ * the signature `(path: string, newValue: unknown, oldValue: unknown) => void`, where `path` is
72
+ * the normalized path where the change occurred, `newValue` is the new value at that path, and
73
+ * `oldValue` is the previous value at that path (if any).
74
+ * - `throttle`: An optional number representing the minimum time in milliseconds between subscriber
75
+ * triggers. If specified, the subscriber will only be triggered if at least this amount of time
76
+ * has passed since the last trigger.
77
+ * - `lastTrigger`: A timestamp of the last time the subscriber was triggered, used in conjunction
78
+ * with throttling to determine if the subscriber can be triggered again.
79
+ * - `once`: A boolean flag indicating whether the subscriber should only be triggered once. If
80
+ * true, the subscriber will be automatically unregistered after being triggered for the first
81
+ * time.
82
+ *
83
+ * #### Be Cautious
84
+ * Global subscribers can have a significant performance impact if they perform heavy computations
85
+ * or Listening to every path in the store will trigger damn near constant calls to the subscriber,
86
+ * so it's important to use them judiciously and ensure that the subscriber function is optimized
87
+ * for performance. Consider using throttling or the `once` option to mitigate potential performance
88
+ * issues when using global subscribers.
89
+ *
90
+ */
91
+ export interface GlobalSubscriberConfig {
92
+ id: string;
93
+ fn: (path: string, newValue: unknown, oldValue: unknown) => void;
94
+ throttle?: number;
95
+ lastTrigger?: number;
96
+ once?: boolean;
97
+ }
98
+ /**
99
+ * ## Subscription Registry
100
+ *
101
+ * The SubscriptionRegistry class manages all subscribers, alerts, and coercers for the Omni data
102
+ * store. It allows for registering direct subscribers for specific paths, tree subscribers for path
103
+ * prefixes, and global subscribers that listen to all changes. It also handles alerts that can be
104
+ * triggered during set operations and coercers that can transform values before they are set. The
105
+ * registry provides methods to subscribe, notify changes, trigger alerts, and manage coercers,
106
+ * ensuring that all relevant functions are called appropriately based on the paths and options
107
+ * specified.
108
+ *
109
+ */
110
+ export declare class SubscriptionRegistry {
111
+ private directSubs;
112
+ private treeSubs;
113
+ private globalSubscribers;
114
+ private alerts;
115
+ private coercers;
116
+ /**
117
+ * Registers a direct subscriber function for a specific path. Direct subscribers are functions
118
+ * that will be called only when a change occurs at the exact specified path. The subscriber
119
+ * function will receive the normalized path, new value, and old value as arguments whenever a
120
+ * change occurs at that path. Direct subscribers are useful for reacting to changes at specific
121
+ * paths without being triggered by changes at parent or child paths. The path will be normalized
122
+ * before storing, so it will match the normalized paths used when notifying changes. This method
123
+ * returns a function that can be called to remove the registered subscriber when it is no longer
124
+ * needed.
125
+ *
126
+ * @param path The path for which to register the direct subscriber. This will be normalized
127
+ * before storing, so it should be in a format that can be normalized (e.g., using dot notation).
128
+ * The subscriber will only be triggered for changes at this exact path, and not for changes at
129
+ * parent or child paths. This allows for precise reactions to changes at specific locations in
130
+ * the data store.
131
+ * @param callback The subscriber function that will be called when a change occurs at the
132
+ * specified path. It should have the signature `(path: string, newValue: unknown, oldValue:
133
+ * unknown) => void`, where `path` is the normalized path where the change occurred, `newValue` is
134
+ * the new value at that path, and `oldValue` is the previous value at that path (if any). The
135
+ * subscriber can use these arguments to react to changes at this specific path.
136
+ * @param type Optional timing for the subscriber, either "PRE" or "POST". This determines whether
137
+ * the subscriber is called before or after tree subscribers for parent paths are called. The
138
+ * default is "POST", meaning the direct subscriber will be called after tree subscribers. If set
139
+ * to "PRE", the direct subscriber will be called before tree subscribers. This can be useful for
140
+ * certain use cases where you want to react to changes at this path before other subscribers are
141
+ * notified.
142
+ * @returns A function that can be called to remove the registered direct subscriber. When called,
143
+ * it will unregister the subscriber so it will no longer be triggered for future changes at the
144
+ * specified path.
145
+ *
146
+ */
147
+ subscribe(path: string, callback: Function, type?: SubscriberTiming): () => void;
148
+ /**
149
+ * Retrieves the direct subscriber bucket for a specific path. This method returns the map of
150
+ * direct subscribers that are registered for the exact given path. The path will be normalized
151
+ * before looking up, so it will match the normalized paths used when subscribers are registered.
152
+ * The returned bucket contains subscribers that will be triggered only for changes at this exact
153
+ * path, and it does not include subscribers that are registered for parent paths (tree
154
+ * subscribers) or global subscribers. This method can be used internally when notifying changes
155
+ * at a specific path to access the direct subscribers that need to be triggered. If there are no
156
+ * direct subscribers for the given path, this method will return undefined.
157
+ *
158
+ * @param path The path for which to retrieve the direct subscriber bucket. This will be
159
+ * normalized before looking up. The returned bucket contains subscribers that are registered for
160
+ * this exact path, and it does not include tree subscribers or global subscribers. This can be
161
+ * used internally to access the direct subscribers when notifying changes at a specific path. If
162
+ * there are no direct subscribers for the given path, this method will return undefined.
163
+ * @returns A Map of direct subscribers for the specified path, or undefined if there are no
164
+ * direct subscribers registered for that path. The keys of the Map are subscriber IDs, and the
165
+ * values are OmniSubscriber objects containing the subscriber function and metadata. This bucket
166
+ * will only include subscribers that are registered for this exact path, and it does not include
167
+ * tree subscribers or global subscribers.
168
+ */
169
+ getDirectBucket(path: string): Map<string, OmniSubscriber> | undefined;
170
+ /**
171
+ * Registers a tree subscriber function for a specific path prefix. Tree subscribers are functions
172
+ * that will be called for changes at any path that starts with the specified prefix. This allows for
173
+ * reacting to changes in an entire subtree of the data store without needing to register individual
174
+ * subscribers for each path. The subscriber function will receive the parent path (the prefix), the
175
+ * full path where the change occurred, the new value, and the old value as arguments whenever a change
176
+ * occurs at any path that matches the prefix. Tree subscribers can be useful for monitoring changes in a
177
+ *
178
+ * @param prefix The path prefix for which to register the tree subscriber. This will be normalized before storing.
179
+ * @param callback The tree subscriber function that will be called when a change occurs at any path that starts with the specified prefix. It should have the signature `(parentPath: string, fullPath: string, newValue: unknown, oldValue: unknown) => void`, where `parentPath` is the normalized prefix path, `fullPath` is the normalized path where the change occurred, `newValue` is the new value at that path, and `oldValue` is the previous value at that path (if any). The subscriber can use these arguments to react to changes in the subtree of paths that match the prefix.
180
+ * @param type Optional timing for the subscriber, either "PRE" or "POST". This determines whether the subscriber is called before or after direct subscribers for the exact path are called. The default is "POST", meaning the tree subscriber will be called after direct subscribers. If set to "PRE", the tree subscriber will be called before direct subscribers. This can be useful for certain use cases where you want to react to changes before other subscribers are notified.
181
+ * @returns A function that can be called to remove the registered tree subscriber. When called, it will unregister the subscriber so it will no longer be triggered for future changes at paths that match the specified prefix.
182
+ */
183
+ subscribeTree(prefix: string, callback: Function, type?: SubscriberTiming): () => void;
184
+ /**
185
+ * Registers a global subscriber function that will be called for every change at any path. Global
186
+ * subscribers are useful for logging, debugging, or any functionality that needs to react to all
187
+ * changes in the data store. They can have optional throttling to limit how often they are
188
+ * triggered, and they can also be set to trigger only once. The subscriber function will receive
189
+ * the path, new value, and old value as arguments whenever a change occurs.
190
+ *
191
+ * ## Be Cautious
192
+ * Global subscribers can have a significant performance impact if they perform heavy computations
193
+ * or Listening to every path in the store will trigger damn near constant calls to the
194
+ * subscriber, so it's important to use them judiciously and ensure that the subscriber function
195
+ * is optimized for performance. Consider using throttling or the `once` option to mitigate
196
+ * potential performance issues when using global subscribers.
197
+ *
198
+ *
199
+ * @param fn The subscriber function to register as a global subscriber. It should have the
200
+ * signature
201
+ * @param options Optional settings for the global subscriber:
202
+ * @returns A function that can be called to remove the registered global subscriber. When called,
203
+ * it will
204
+ */
205
+ subscribeGlobal(fn: GlobalSubscriberConfig["fn"], options?: {
206
+ throttle?: number;
207
+ once?: boolean;
208
+ }): () => void;
209
+ /**
210
+ * Notifies subscribers of a change at a specific path. This method is responsible for triggering
211
+ * all relevant subscribers when a value changes at a given path. It will notify direct
212
+ * subscribers for the exact path, tree subscribers for any parent paths, and global subscribers
213
+ * for all changes. The notification includes the new value, old value, and the normalized path.
214
+ * Subscribers with the `once` option will be automatically unregistered after being triggered.
215
+ * Global subscribers can also have throttling to limit how often they are triggered.
216
+ * @param path The path where the change occurred. This will be normalized before looking up
217
+ * subscribers. Subscribers
218
+ * @param value The new value that has been set at the specified path. This is passed to
219
+ * subscriber functions as an argument, along with the old value and path. Subscribers can use
220
+ * this value in their logic to respond to the change.
221
+ * @param oldValue The previous value at the specified path before the change. This is passed to
222
+ * subscriber functions as an argument, along with the new value and path. Subscribers can use
223
+ * this value in their logic to compare against the new value or perform actions based on what
224
+ * changed. It can be undefined if there was no previous value.
225
+ * @param getParentValue A function that can be called to retrieve the current value of a parent
226
+ * path. This is used when notifying tree subscribers and when the `parentNotifications` option is
227
+ * enabled, allowing subscribers to get the current value of parent paths without needing to
228
+ * access the main data store directly. The function takes a parent path as an argument and
229
+ * returns the current value at that path.
230
+ * @param parentNotifications A boolean flag that indicates whether to notify direct subscribers
231
+ * of parent paths about changes to their child paths. If true, then when a change occurs at a
232
+ * path, direct subscribers for all parent paths will also be notified with the current value of
233
+ * the parent path. This allows for more comprehensive notifications but can result in more
234
+ * subscriber calls, so it should be used based on the needs of the application.
235
+ * @returns void
236
+ * @remarks This method is typically called internally by the set operation after a value has been
237
+ * changed, to ensure that all relevant subscribers are notified of the change. It handles the
238
+ * logic for determining which subscribers to notify based on the path and options provided.
239
+ */
240
+ notify(path: string, value: unknown, oldValue: unknown, getParentValue: (parent: string) => unknown, parentNotifications: boolean): void;
241
+ /**
242
+ * Registers an alert function for a specific path. Alerts are functions that can be triggered
243
+ * when a specific path is set to a new value, allowing for critical checks, transformations, or
244
+ * side effects that must happen before subscribers are notified. The alert will be triggered
245
+ * synchronously during the set operation, and it can have optional conditions and throttling to
246
+ * control when it runs.
247
+ * @param path The path for which to register the alert. This will be normalized before storing.
248
+ * Alerts registered
249
+ * @param callback The alert function that will be called when a value is set at the specified
250
+ * path. It should have the signature `(newValue: unknown, oldValue: unknown, path: string) =>
251
+ * void`, where `newValue` is the new value being set, `oldValue` is the previous value at that
252
+ * path (if any), and `path` is the normalized path being set. The alert can perform critical
253
+ * checks or transformations based on these values, and it can throw an error to prevent the set
254
+ * operation from completing if necessary.
255
+ * @param options Optional settings for the alert:
256
+ * @returns A function that can be called to remove the registered alert. When called, it will
257
+ * unregister the alert so it will no longer be triggered for future set operations at the
258
+ * specified path.
259
+ */
260
+ alert(path: string, callback: Function, options?: {
261
+ condition?: Function;
262
+ throttle?: number;
263
+ once?: boolean;
264
+ }): () => void;
265
+ /**
266
+ * Triggers alerts for a given path and value. Alerts are functions that can be registered to run
267
+ * when a specific path is set to a new value. They can have optional conditions that determine
268
+ * whether they should run based on the new and old values, as well as throttling to limit how
269
+ * often they can be triggered. When an alert is triggered, it will be called with the new value,
270
+ * old value, and path as arguments. If an alert has the `once` option set to true, it will be
271
+ * automatically unregistered after being triggered once.
272
+ * @param path The path for which to trigger alerts. This will be normalized before looking up
273
+ * alerts. Alerts registered
274
+ * @param value The new value that is being set at the specified path. This is passed to alert
275
+ * functions as an argument, along with the old value and path. Alerts can use this value in their
276
+ * logic, and conditions can compare it to the old value to decide whether to run the alert or
277
+ * not.
278
+ * @param oldValue The previous value at the specified path before the change. This is passed to
279
+ * alert functions as an argument, along with the new value and path. Alerts can use this value in
280
+ * their logic, and conditions can compare it to the new value to decide whether to run the alert
281
+ * or not. It can be undefined if there was no previous value.
282
+ * @returns void
283
+ * @remarks Alerts are triggered synchronously during the set operation, before any subscribers
284
+ * are notified. This means that if an alert modifies the value or throws an error, it can affect
285
+ * the outcome of the set operation and whether subscribers are notified. Use alerts for critical
286
+ * checks or transformations that must happen before subscribers are involved.
287
+ */
288
+ triggerAlerts(path: string, value: unknown, oldValue: unknown): void;
289
+ /**
290
+ * Registers a coercer function for a specific path. Coercers are functions that can transform a
291
+ * value before it is set, allowing for validation, normalization, or other transformations. The
292
+ * coercer will be triggered whenever a value is set at the specified path, and it can return a
293
+ * new value to replace the original one. Coercers can also have optional conditions and
294
+ * throttling to control when they are applied.
295
+ *
296
+ * @param path The path for which to register the coercer. This will be normalized before storing.
297
+ * Coercers registered for this exact path will be triggered, but not coercers for parent or child
298
+ * paths. Coercers will receive the normalized path as an argument, so they can perform their own
299
+ * checks if needed.
300
+ * @param callback The coercer function that will be called when a value is set at the specified
301
+ * path. It should have the signature `(path: string, value: unknown, oldValue?: unknown) =>
302
+ * unknown`, where `path` is the normalized path being set, `value` is the new value being set,
303
+ * and `oldValue` is the previous value at that path (if any). The coercer should return the new
304
+ * value to use for the set operation, or it can return `"__NO_COERCE__"` to indicate that no
305
+ * coercion should be applied and the original value should be used.
306
+ * @param options Optional settings for the coercer:
307
+ * @returns A function that can be called to remove the registered coercer. When called, it will
308
+ * unregister the coercer so it will no longer be triggered for future set operations at the
309
+ * specified path.
310
+ */
311
+ coercer(path: string, callback: CoerceConfig["fn"], options?: {
312
+ condition?: Function;
313
+ throttle?: number;
314
+ once?: boolean;
315
+ }): () => void;
316
+ /**
317
+ * Triggers coercers for a given path and value, returning the final coerced value. Coercers are
318
+ * applied
319
+ * @param path The path for which to trigger coercers. This will be normalized before looking up
320
+ * coercers. Coercers registered for this exact path will be triggered, but not coercers for
321
+ * parent or child paths. Coercers will receive the normalized path as an argument, so they can
322
+ * perform their own checks if needed. Coercers should return the new value or "__NO_COERCE__" to
323
+ * skip coercion.
324
+ * @param value The value to coerce. This is the value that will be passed to coercers and
325
+ * potentially transformed by them. Coercers will receive the current value as an argument and can
326
+ * return a new value to replace it. The final result after all coercers have been applied will be
327
+ * returned by this function.
328
+ * @param oldValue The previous value before the change. This is provided for coercers that need
329
+ * to compare the new value with the old value to decide whether to coerce or not. Coercers will
330
+ * receive this as an argument and can use it in their logic. It can be undefined if there was no
331
+ * previous value.
332
+ * @returns The final coerced value after all applicable coercers have been triggered. If no
333
+ * coercers were triggered or if all coercers returned "__NO_COERCE__", this will be the original
334
+ * value passed in. Otherwise, it will be the result of applying the coercion functions in
335
+ * sequence, with each coercer potentially transforming the value further.
336
+ */
337
+ triggerCoercers(path: string, value: unknown, oldValue: unknown): unknown;
338
+ private removeAlert;
339
+ private removeCoercer;
340
+ }
341
+ //# sourceMappingURL=subscriptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/subscriptions/subscriptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK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