evg_observable 2.14.61 → 2.15.1

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.
@@ -1,164 +1,726 @@
1
1
  import { PipeSwitchCase } from "./Pipe";
2
2
  import { FilterSwitchCase } from "./FilterCollection";
3
+ /**
4
+ * Defines a callback function type that can be invoked with an optional value of type `T`.
5
+ * The function can perform any operation and optionally return a value of any type.
6
+ *
7
+ * @template T - The type of the parameter that the callback function may receive.
8
+ * @param {T} [value] - An optional parameter of type `T` passed to the callback function.
9
+ * @returns {any} - The return type of the callback function is not specified and can be of any type.
10
+ */
3
11
  export type ICallback<T> = (value?: T) => any;
12
+ /**
13
+ * Represents a callback function to handle error scenarios.
14
+ *
15
+ * This type defines a function signature that accepts error-related data
16
+ * and a descriptive error message as parameters and performs an operation.
17
+ *
18
+ * @callback IErrorCallback
19
+ * @param {any} errorData - The data or object representing the error.
20
+ * @param {any} errorMessage - A descriptive message providing details about the error.
21
+ */
4
22
  export type IErrorCallback = (errorData: any, errorMessage: any) => void;
23
+ /**
24
+ * Represents a contract for subscribing to a data stream or event source.
25
+ *
26
+ * @template T The type of data or events being subscribed to.
27
+ *
28
+ * @property subscribe Provides the mechanism to register a listener for handling incoming data or events,
29
+ * and optionally handles errors.
30
+ * - `listener` is the callback that processes the data or events.
31
+ * - `errorHandler` is an optional callback for handling errors during the subscription.
32
+ * - Returns an object implementing `ISubscriptionLike` to manage the subscription, or `undefined` if no subscription is created.
33
+ */
5
34
  export type ISubscribe<T> = {
6
35
  subscribe(listener: ISubscribeGroup<T>, errorHandler?: IErrorCallback): ISubscriptionLike | undefined;
7
36
  };
37
+ /**
38
+ * Represents a listener interface that extends the functionality of `ICallback`.
39
+ * This type is designed to handle events, callbacks, or notifications with a specific type `T`.
40
+ *
41
+ * Generic:
42
+ * @template T - The type of data that the listener will handle.
43
+ */
8
44
  export type IListener<T> = ICallback<T>;
45
+ /**
46
+ * IDestroy represents an interface for objects that can be destroyed to release resources.
47
+ * It provides a method to perform the destroy operation and a property to indicate if the object is already destroyed.
48
+ *
49
+ * Members:
50
+ * - destroy(): A method to perform cleanup and release resources associated with the object.
51
+ * - isDestroyed: A boolean property that reflects whether the object has been destroyed.
52
+ */
9
53
  export type IDestroy = {
10
54
  destroy(): void;
11
55
  isDestroyed: boolean;
12
56
  };
57
+ /**
58
+ * Represents an order with a specific numerical value.
59
+ * Defines a structure to hold the order information as a numeric value.
60
+ */
13
61
  export type IOrder = {
14
62
  order: number;
15
63
  };
64
+ /**
65
+ * Represents a generic switch interface.
66
+ *
67
+ * @template T The type of the value to be used in the switch operation.
68
+ *
69
+ * @property {Function} switch - Defines the method for initiating a switch operation.
70
+ * Returns a `PipeSwitchCase<T>` representing the next step in the switching process.
71
+ */
16
72
  export type ISwitch<T> = {
17
73
  switch(): PipeSwitchCase<T>;
18
74
  };
75
+ /**
76
+ * Represents an interface for an ordered switch mechanism that evaluates
77
+ * conditions in a specific sequence and invokes the corresponding logic.
78
+ *
79
+ * This interface is generic and designed to operate with a specific type `T`.
80
+ *
81
+ * @template T The type of data expected by the implementation.
82
+ * @property switch A method intended to handle the ordered evaluation of cases
83
+ * and return an instance of `PipeSwitchCase<T>`.
84
+ */
19
85
  export type IOrderedSwitch<T> = {
20
86
  switch(): PipeSwitchCase<T>;
21
87
  };
88
+ /**
89
+ * Represents an interface defining a contract for a one-time settable subscription mechanism.
90
+ *
91
+ * @template T - The type of the data or value associated with the subscription.
92
+ *
93
+ * @property setOnce - A method that ensures the associated subscription can only be set or triggered once.
94
+ * @returns {ISubscribe<T>} - An instance of ISubscribe with the generic type T.
95
+ */
22
96
  export type IOnce<T> = {
23
97
  setOnce(): ISubscribe<T>;
24
98
  };
99
+ /**
100
+ * Represents an interface that ensures an ordered item can be set only once.
101
+ *
102
+ * @template T - The type of item to be handled by the implementation.
103
+ */
25
104
  export type IOrderedOnce<T> = {
26
105
  setOnce(): IOrderedSubscribe<T>;
27
106
  };
107
+ /**
108
+ * Interface representing an observable value that can be updated by emitting a new value.
109
+ *
110
+ * ISetObservableValue provides a `next` method that allows sending new values to be observed by subscribers.
111
+ */
28
112
  export type ISetObservableValue = {
29
113
  next(value: any): void;
30
114
  };
115
+ /**
116
+ * Represents a subscription-like object which provides a mechanism to release resources or
117
+ * cancelable operations when they are no longer needed.
118
+ *
119
+ * This type defines a structure that requires an `unsubscribe` method, allowing consumers
120
+ * to implement custom behavior or cleanup logic when the subscription is no longer active.
121
+ */
31
122
  export type ISubscriptionLike = {
32
123
  unsubscribe(): void;
33
124
  };
125
+ /**
126
+ * Represents a composite interface that combines multiple functionalities for handling events, transformations, and subscriptions in a generic way.
127
+ *
128
+ * @template T The type of the data or events processed by the setup.
129
+ * @typedef {object} ISetup<T>
130
+ * @property {IUnsubscribeByPositive<T>} Implements unsubscribe functionality based on positive filters or criteria.
131
+ * @property {IEmitByPositive<T>} Implements emission functionality for events based on positive conditions.
132
+ * @property {IOnce<T>} Provides mechanisms for handling one-time subscriptions.
133
+ * @property {ISwitch<T>} Interface for enabling switch-like behavior for managing state or event streams.
134
+ * @property {ITransform<T>} Allows for the transformation of data or events before they are processed or re-emitted.
135
+ * @property {ISerialisation} Includes methods for serializing and deserializing data structures.
136
+ * @property {ISubscribe<T>} Implements standard subscription management functionalities.
137
+ */
34
138
  export type ISetup<T> = IUnsubscribeByPositive<T> & IEmitByPositive<T> & IOnce<T> & ISwitch<T> & ITransform<T> & ISerialisation & ISubscribe<T>;
139
+ /**
140
+ * Represents an ordered setup configuration that combines multiple ordered operations
141
+ * related to subscribing, emitting, transforming, serializing, and other functionalities.
142
+ * This type extends various ordered operation interfaces to provide a comprehensive
143
+ * structure for managing ordered processing of type T data.
144
+ *
145
+ * It includes the following features:
146
+ * - Unsubscription handling in an ordered manner.
147
+ * - Event emission management with positive ordering.
148
+ * - One-time execution of operations.
149
+ * - Switching between different ordered setups.
150
+ * - Transformation of data in an ordered way.
151
+ * - Serialization and deserialization capabilities.
152
+ * - Subscription management adhering to order.
153
+ *
154
+ * @template T The type of the data to be handled by the ordered setup.
155
+ */
35
156
  export type IOrderedSetup<T> = IOrderedUnsubscribeByPositive<T> & IOrderedEmitByPositive<T> & IOrderedOnce<T> & IOrderedSwitch<T> & IOrderedTransform<T> & IOrderedSerialisation & IOrderedSubscribe<T>;
157
+ /**
158
+ * Represents a composite type that combines several interfaces to define
159
+ * the behavior and properties of a subscription object with extended
160
+ * features.
161
+ *
162
+ * @template T The type of data being interacted with in the subscription object.
163
+ *
164
+ * @extends ISubscriptionLike Represents the basic structure for subscription-like objects.
165
+ * @extends IPause Provides the ability to pause and resume functionality.
166
+ * @extends IOrder Adds capabilities for managing ordered processing or priority.
167
+ * @extends ISend<T> Includes sending data functionality with type T.
168
+ * @extends ISetup<T> Incorporates setup or initialization procedures with type T.
169
+ */
36
170
  export type ISubscribeObject<T> = ISubscriptionLike & IPause & IOrder & ISend<T> & ISetup<T>;
171
+ /**
172
+ * Represents a counter interface for subscriptions.
173
+ * An ISubscribeCounter instance provides methods to query the size
174
+ * of the collection or group being managed.
175
+ */
37
176
  export type ISubscribeCounter = {
38
177
  size(): number;
39
178
  };
179
+ /**
180
+ * Interface representing a subscriber that can hold a value and has a subscription mechanism.
181
+ * Combines the functionalities of value retrieval and subscription handling.
182
+ *
183
+ * @template T - The type of the value that the subscriber holds.
184
+ *
185
+ * @property {boolean} isEnable - Indicates whether the subscriber is currently enabled.
186
+ *
187
+ * @method getValue
188
+ * Retrieves the current value held by the subscriber.
189
+ * @returns {T | undefined} The current value of type T if available, or undefined if not set.
190
+ *
191
+ * @extends ISubscribe
192
+ */
40
193
  export type ISubscriber<T> = {
41
194
  getValue(): T | undefined;
42
195
  isEnable: boolean;
43
196
  } & ISubscribe<T>;
197
+ /**
198
+ * An interface representing an Observer with extended functionalities for managing subscriptions,
199
+ * controlling observability, and interacting with subscriber-related behavior.
200
+ *
201
+ * @template T - The type of the observed value.
202
+ *
203
+ * @extends ISetObservableValue
204
+ * @extends ISubscriber<T>
205
+ * @extends IDestroy
206
+ * @extends ISubscribeCounter
207
+ * @extends IObservablePipe<T>
208
+ *
209
+ * @property {function(ISubscriptionLike): void} unSubscribe - Removes a specific subscriber from the observer.
210
+ * @property {function(): void} unsubscribeAll - Removes all subscribers from the observer.
211
+ * @property {function(): void} disable - Temporarily disables the observer, preventing it from notifying subscribers.
212
+ * @property {function(): void} enable - Re-enables the observer, allowing it to notify subscribers.
213
+ */
44
214
  export type IObserver<T> = ISetObservableValue & ISubscriber<T> & IDestroy & ISubscribeCounter & IObservablePipe<T> & {
45
215
  unSubscribe(subscriber: ISubscriptionLike): void;
46
216
  unsubscribeAll(): void;
47
217
  disable(): void;
48
218
  enable(): void;
49
219
  };
220
+ /**
221
+ * Represents a generic stream interface for processing arrays of type T.
222
+ *
223
+ * This interface defines a method to input and handle data streams.
224
+ *
225
+ * @template T The type of the data elements to be streamed.
226
+ * @typedef {Object} IStream
227
+ * @property {(value: T[]) => void} stream A method to handle an array of elements of type T.
228
+ */
50
229
  export type IStream<T> = {
51
230
  stream(value: T[]): void;
52
231
  };
232
+ /**
233
+ * Represents an interface for pausing and resuming operations.
234
+ *
235
+ * The IPause interface provides methods to pause and resume a process or operation.
236
+ * It can be used as a structure for implementing functionality where halting and continuing an activity is required.
237
+ *
238
+ * Method Summary:
239
+ * - `pause`: Invokes a pause in the operation.
240
+ * - `resume`: Resumes the operation from a paused state.
241
+ */
53
242
  export type IPause = {
54
243
  pause(): void;
55
244
  resume(): void;
56
245
  };
246
+ /**
247
+ * Represents an observable pipe, which provides a mechanism to transform or manipulate a stream of data.
248
+ *
249
+ * This type defines the structure for an object with a `pipe` method. The `pipe` method is intended
250
+ * to configure or sequence certain operations on data of type `T` and return an optional setup structure.
251
+ *
252
+ * @template T - The type of data the observable pipe operates on.
253
+ * @property {Function} pipe - A method that executes the defined setup or transformation process.
254
+ * Returns an `ISetup<T>` instance or `undefined` if no setup is performed.
255
+ */
57
256
  export type IObservablePipe<T> = {
58
257
  pipe(): ISetup<T> | undefined;
59
258
  };
259
+ /**
260
+ * Represents an interface for an ordered observable pipe.
261
+ *
262
+ * @template T - The type of the value being processed through the pipe.
263
+ *
264
+ * @property {Function} pipe - A method that processes the observable stream and returns a setup.
265
+ * The setup may be undefined if no valid output is generated.
266
+ * @returns {ISetup<T> | undefined} - Returns an instance of ISetup of type T if the processing succeeds,
267
+ * otherwise undefined.
268
+ */
60
269
  export type IOrderedObservablePipe<T> = {
61
270
  pipe(): ISetup<T> | undefined;
62
271
  };
272
+ /**
273
+ * Interface ISend represents a contract for sending a value of a generic type.
274
+ *
275
+ * This interface declares a single method, `send`, which is responsible
276
+ * for handling the transmission or processing of the provided value.
277
+ *
278
+ * @template T - The type of the value that can be sent using this interface.
279
+ */
63
280
  export type ISend<T> = {
64
281
  send(value: T): void;
65
282
  };
283
+ /**
284
+ * Represents an interface that provides a method for unsubscribing actions based on a
285
+ * specified negative condition defined by a callback function.
286
+ *
287
+ * @template T - The type parameter that the interface will operate with.
288
+ *
289
+ * @property unsubscribeByNegative - A method to unsubscribe based on the evaluation
290
+ * of a condition provided through a callback.
291
+ *
292
+ * @param condition - A callback function that determines the criteria for unsubscribing.
293
+ * The callback may evaluate a condition on the type `T`.
294
+ * @returns An object of type `ISetup<T>` which represents the setup or state after
295
+ * the unsubscribe operation.
296
+ */
66
297
  export type IUnsubscribeByNegative<T> = {
67
298
  unsubscribeByNegative(condition: ICallback<T>): ISetup<T>;
68
299
  };
300
+ /**
301
+ * Represents an interface that provides a mechanism to unsubscribe using a negative condition.
302
+ *
303
+ * @template T The type of data handled by the callback function.
304
+ *
305
+ * @typedef {Object} IOrderedUnsubscribeByNegative
306
+ * @property {function(condition: ICallback<T>): IOrderedSetup<T>} unsubscribeByNegative
307
+ * A method that allows unsubscribing based on a provided negative condition.
308
+ * The condition is determined through the given callback function.
309
+ */
69
310
  export type IOrderedUnsubscribeByNegative<T> = {
70
311
  unsubscribeByNegative(condition: ICallback<T>): IOrderedSetup<T>;
71
312
  };
313
+ /**
314
+ * Represents a generic type that allows for unsubscribing based on a given condition.
315
+ *
316
+ * This type is designed to provide an interface for managing subscriptions
317
+ * that can be terminated by evaluating a condition specified by the user.
318
+ *
319
+ * @template T - The type of the value being processed or observed in the context
320
+ * of the unsubscribe operation.
321
+ *
322
+ * @property {function} unsubscribeBy - A method to unsubscribe based on a specified condition.
323
+ * This condition is defined as a callback function that determines whether the unsubscribe action
324
+ * should be performed.
325
+ *
326
+ * @param {ICallback<T>} condition - A callback function that evaluates the condition for unsubscribing.
327
+ * The callback should return a value indicating whether the specified condition has been met.
328
+ *
329
+ * @returns {ISetup<T>} - Returns an instance of ISetup to allow further configuration or management
330
+ * following the unsubscribe operation.
331
+ */
72
332
  export type IUnsubscribeByPositive<T> = {
73
333
  unsubscribeBy(condition: ICallback<T>): ISetup<T>;
74
334
  };
335
+ /**
336
+ * Represents an interface for managing ordered unsubscription using a provided condition.
337
+ *
338
+ * @template T - The type parameter representing the data model or entity being handled.
339
+ *
340
+ * @typedef {Object} IOrderedUnsubscribeByPositive
341
+ * @property {(condition: ICallback<T>) => ISetup<T>} unsubscribeBy - Method to unsubscribe items based on a specific condition.
342
+ * Accepts a callback function that determines the criteria for unsubscription and returns the setup object associated with the operation.
343
+ */
75
344
  export type IOrderedUnsubscribeByPositive<T> = {
76
345
  unsubscribeBy(condition: ICallback<T>): ISetup<T>;
77
346
  };
347
+ /**
348
+ * Represents a type for an object that allows emitting events based on a negative condition.
349
+ *
350
+ * @template T The type of the value that will be passed to the callback and setup methods.
351
+ *
352
+ * @property {function(condition: ICallback<T>): ISetup<T>} emitByNegative - A method that triggers a setup process
353
+ * if a specified condition evaluates to a negative result.
354
+ */
78
355
  export type IEmitByNegative<T> = {
79
356
  emitByNegative(condition: ICallback<T>): ISetup<T>;
80
357
  };
358
+ /**
359
+ * Represents an interface for handling ordered emissions based on a negative condition.
360
+ *
361
+ * @template T - The type of the value being processed.
362
+ *
363
+ * @typedef {Object} IOrderedEmitByNegative
364
+ *
365
+ * @property {function(condition: ICallback<T>): IOrderedSetup<T>} emitByNegative -
366
+ * A method that determines ordered emissions of elements based on a provided
367
+ * condition that evaluates to a negative criteria.
368
+ *
369
+ * @callback ICallback<T>
370
+ * A callback function used to define the negative condition for emission.
371
+ *
372
+ * @returns {IOrderedSetup<T>}
373
+ * Returns an instance of IOrderedSetup<T>, facilitating further configuration
374
+ * of the ordered emission process based on the negative condition.
375
+ */
81
376
  export type IOrderedEmitByNegative<T> = {
82
377
  emitByNegative(condition: ICallback<T>): IOrderedSetup<T>;
83
378
  };
379
+ /**
380
+ * Represents a type that facilitates the refinement of conditions or rules and manages setting up these refinements.
381
+ *
382
+ * @template T - The type of data or element that the methods operate on.
383
+ *
384
+ * @typedef {Object} IEmitByPositive
385
+ *
386
+ * @property {function(condition: ICallback<T>): ISetup<T>} refine - Refines a specific condition by taking an input callback and setting it up.
387
+ * @property {function(conditions: ICallback<T>[]): ISetup<T>} pushRefiners - Pushes an array of callback conditions to further refine the setup process.
388
+ */
84
389
  export type IEmitByPositive<T> = {
85
390
  refine(condition: ICallback<T>): ISetup<T>;
86
391
  pushRefiners(conditions: ICallback<T>[]): ISetup<T>;
87
392
  };
393
+ /**
394
+ * Represents a transformation interface that defines a chainable method to apply transformations to a value
395
+ * using a provided callback function and returning a setup structure for further transformations.
396
+ *
397
+ * @template T - The type of the input value that the transformation operates on.
398
+ *
399
+ * @typedef {Object} ITransform
400
+ *
401
+ * @property {function} then - Method that takes a callback function and returns a setup structure for further transformations.
402
+ * @param {ICallback<T>} condition - The transformation logic applied to the input.
403
+ * @returns {ISetup<K>} A setup structure for additional transformations.
404
+ */
88
405
  export type ITransform<T> = {
89
406
  then<K>(condition: ICallback<T>): ISetup<K>;
90
407
  };
408
+ /**
409
+ * ISerialisation interface defines the structure for objects responsible for
410
+ * handling the serialization and deserialization of data.
411
+ *
412
+ * This interface provides methods to serialize data into a specific format
413
+ * and to deserialize data back into a desired type.
414
+ *
415
+ * The generic method `deserialize` allows flexibility in defining the type
416
+ * of data to be returned upon deserialization.
417
+ */
91
418
  export type ISerialisation = {
92
419
  serialize(): ISetup<string>;
93
420
  deserialize<K>(): ISetup<K>;
94
421
  };
422
+ /**
423
+ * A type that represents an ordered operation which processes and refines
424
+ * elements for a positive outcome. This is achieved through the use of
425
+ * conditional callbacks and the ability to chain multiple refinement conditions.
426
+ *
427
+ * @template T - The type of the element being processed.
428
+ *
429
+ * @property {Function} refine - Refines the current state based on a provided condition.
430
+ * This function accepts a single callback condition which determines the refinement logic
431
+ * and returns an updated setup instance.
432
+ *
433
+ * @property {Function} pushRefiners - Allows the addition of multiple refinement conditions
434
+ * to the current state. Accepts an array of callback conditions and returns an updated setup instance.
435
+ */
95
436
  export type IOrderedEmitByPositive<T> = {
96
437
  refine(condition: ICallback<any>): ISetup<T>;
97
438
  pushRefiners(conditions: ICallback<any>[]): ISetup<T>;
98
439
  };
440
+ /**
441
+ * Represents an interface for an ordered transformation sequence applied to a data type `T`.
442
+ *
443
+ * @template T - The type of the data to be transformed.
444
+ */
99
445
  export type IOrderedTransform<T> = {
100
446
  then<K>(condition: ICallback<T>): ISetup<K>;
101
447
  };
448
+ /**
449
+ * Represents an interface for ordered serialization and deserialization operations.
450
+ * Useful for implementing structured serialization mechanisms that maintain a specific order.
451
+ *
452
+ * @interface
453
+ * @typedef {Object} IOrderedSerialisation
454
+ *
455
+ * @property {function(): ISetup<string>} serialize - Serializes an object or value into a string in a structured and ordered format.
456
+ * @property {function(): ISetup<K>} deserialize - Deserializes a structured and ordered string back into an object or value of type `K`.
457
+ */
102
458
  export type IOrderedSerialisation = {
103
459
  serialize(): ISetup<string>;
104
460
  deserialize<K>(): ISetup<K>;
105
461
  };
462
+ /**
463
+ * Defines a structure for an object that provides a mechanism to emit a match based on a given condition.
464
+ *
465
+ * @template T The type parameter representing the expected return type of the setup process.
466
+ */
106
467
  export type IEmitMatchCondition<T> = {
107
468
  emitMatch(condition: ICallback<any>): ISetup<T>;
108
469
  };
470
+ /**
471
+ * Represents a condition for emitting a match in a specific order.
472
+ * The match condition is defined by the provided callback and
473
+ * can be used to set up ordered operations.
474
+ *
475
+ * @template T - The type of data associated with the ordered setup.
476
+ *
477
+ * @property {function(condition: ICallback<any>): IOrderedSetup<T>} emitMatch
478
+ * - A method to define a condition for emitting a match. It accepts a callback and returns an ordered setup configuration.
479
+ */
109
480
  export type IOrderedEmitMatchCondition<T> = {
110
481
  emitMatch(condition: ICallback<any>): IOrderedSetup<T>;
111
482
  };
483
+ /**
484
+ * ICollector is an interface that combines IDestroy and ISubscribeCounter interfaces,
485
+ * providing additional functionality for managing subscriptions.
486
+ * This interface allows for collecting, unsubscribing, and batch unsubscription of subscription-like objects.
487
+ *
488
+ * The primary purpose of ICollector is to manage subscription lifecycles efficiently and ensure
489
+ * that subscriptions are correctly unsubscribed when no longer needed.
490
+ *
491
+ * Methods:
492
+ * - collect(...subscriptionLikeList): Adds one or more subscription-like objects to be managed by the collector.
493
+ * - unsubscribe(subscriptionLike): Unsubscribes a single subscription-like object that the collector is managing.
494
+ * - unsubscribeAll(): Unsubscribes all subscription-like objects managed by the collector.
495
+ */
112
496
  export type ICollector = IDestroy & ISubscribeCounter & {
113
497
  collect(...subscriptionLikeList: ISubscriptionLike[]): void;
114
498
  unsubscribe(subscriptionLike: ISubscriptionLike): void;
115
499
  unsubscribeAll(): void;
116
500
  };
501
+ /**
502
+ * IOrderedObservable is a type definition that represents an object with the ability
503
+ * to determine whether elements are sorted in a specific order.
504
+ *
505
+ * This type contains a single method, `sortByOrder`, which is used to perform a determination
506
+ * or operation associated with the ordering of elements.
507
+ *
508
+ * @typedef {Object} IOrderedObservable
509
+ * @property {Function} sortByOrder - A method that checks or enforces the ordering of elements.
510
+ * Returns a boolean representing whether the ordering is correct or applicable.
511
+ */
117
512
  export type IOrderedObservable = {
118
513
  sortByOrder(): boolean;
119
514
  };
515
+ /**
516
+ * Represents a type that combines the behavior of an observer, an ordered observable, and an ordered observable pipe.
517
+ * This interface is generic and accepts a type parameter `T`, which specifies the data type it operates on.
518
+ *
519
+ * The `IOrdered` interface is composed of:
520
+ * - `IObserver<T>`: Handles observation logic for receiving values of type `T`.
521
+ * - `IOrderedObservable`: Encapsulates logic for ordered observables.
522
+ * - `IOrderedObservablePipe<T>`: Defines transformation and handling of ordered observable data of type `T`.
523
+ *
524
+ * Use this interface when working with structures that need ordered observation and transformation capabilities.
525
+ */
120
526
  export type IOrdered<T> = IObserver<T> & IOrderedObservable & IOrderedObservablePipe<T>;
527
+ /**
528
+ * A type that combines the features of `ISubscriptionLike` and `IOrder`.
529
+ * Represents a subscription-like object that also implements ordering properties or methods.
530
+ *
531
+ * This type is typically used in scenarios where an object needs to maintain
532
+ * subscription behavior alongside ordered data or operations.
533
+ *
534
+ * It inherits all the characteristics and requirements of both `ISubscriptionLike` and `IOrder`.
535
+ */
121
536
  export type IOrderedSubscriptionLike = (ISubscriptionLike & IOrder);
537
+ /**
538
+ * Represents an interface for an ordered subscription mechanism.
539
+ *
540
+ * @template T The type of data that the subscription will handle.
541
+ *
542
+ * @typedef {Object} IOrderedSubscribe
543
+ * @property {function(IListener<T>, IErrorCallback=): IOrderedSubscriptionLike} subscribe
544
+ * Subscribes to the updates with a listener callback and an optional error handler.
545
+ * Returns a subscription-like object for managing the subscription.
546
+ *
547
+ * @callback IListener
548
+ * Defines a listener callback function that is notified with updates of type T.
549
+ *
550
+ * @callback IErrorCallback
551
+ * Defines an optional error handler that is called whenever an error occurs in the subscription mechanism.
552
+ *
553
+ * @typedef {Object} IOrderedSubscriptionLike
554
+ * Represents an object that provides methods to manage the lifecycle of the subscription.
555
+ */
122
556
  export type IOrderedSubscribe<T> = {
123
557
  subscribe(listener: IListener<T>, errorHandler?: IErrorCallback): IOrderedSubscriptionLike;
124
558
  };
559
+ /**
560
+ * Represents a container for a chain of elements.
561
+ *
562
+ * This interface defines a structure that holds an array of elements.
563
+ * It is used to manage and interact with a sequential chain of items.
564
+ *
565
+ * Properties:
566
+ * - chain: An array representing the chain, where each element can be of any type.
567
+ */
125
568
  export type IChainContainer = {
126
569
  chain: any[];
127
570
  };
571
+ /**
572
+ * Represents the payload structure used within a pipe system.
573
+ *
574
+ * This type defines the fields necessary for managing the flow and control
575
+ * within a pipe operation, including breaking, unsubscribing, availability
576
+ * status, and the actual payload to be processed or transmitted.
577
+ *
578
+ * Properties:
579
+ * - isBreak: A boolean indicating if the pipe operation should terminate.
580
+ * - isUnsubscribe: A boolean indicating if the operation should include an unsubscribing action.
581
+ * - isAvailable: A boolean specifying whether the payload is available for processing.
582
+ * - payload: A flexible property designed to hold any data intended to be carried through the pipe.
583
+ */
128
584
  export type IPipePayload = {
129
585
  isBreak: boolean;
130
586
  isUnsubscribe: boolean;
131
587
  isAvailable: boolean;
132
588
  payload: any;
133
589
  };
590
+ /**
591
+ * Represents a callback function interface for handling chain-related operations.
592
+ * This function is typically invoked with a payload to perform specific operations
593
+ * in a chain or pipeline.
594
+ *
595
+ * @callback IChainCallback
596
+ * @param {IPipePayload} data - The payload passed to the callback function
597
+ * containing the necessary data for processing.
598
+ */
134
599
  export type IChainCallback = (data: IPipePayload) => void;
600
+ /**
601
+ * Represents a pipeline case that extends the functionality of subscribing
602
+ * to a stream of data with additional case-checking operations.
603
+ *
604
+ * @template T - The type of data being processed in the pipeline.
605
+ * @extends ISubscribe<T>
606
+ */
135
607
  export type IPipeCase<T> = ISubscribe<T> & {
136
608
  case(condition: ICallback<any>): IPipeCase<T> & ISubscribe<T>;
137
609
  pushCases(conditions: ICallback<any>[]): IPipeCase<T> & ISubscribe<T>;
138
610
  };
611
+ /**
612
+ * Represents a combined subscriber that can either be a listener or a setter for observable values.
613
+ *
614
+ * This type is a union of `IListener<T>` and `ISetObservableValue`, providing flexibility to handle subscriptions
615
+ * with different behaviors. It allows implementing components to react to changes in data or directly set observable values.
616
+ *
617
+ * @template T - The type of the value to be handled by the subscriber.
618
+ */
139
619
  export type ICombinedSubscriber<T> = IListener<T> | ISetObservableValue;
620
+ /**
621
+ * Represents a type definition for a group of subscriptions.
622
+ *
623
+ * This type can be either a single `ICombinedSubscriber` instance or an array of `ICombinedSubscriber` instances.
624
+ *
625
+ * @template T The type of data that the subscriber(s) will handle.
626
+ */
140
627
  export type ISubscribeGroup<T> = ICombinedSubscriber<T> | ICombinedSubscriber<T>[];
628
+ /**
629
+ * Represents an interface for adding a filter to a specific setup or configuration.
630
+ *
631
+ * @template T - The type that the filter setup operates on.
632
+ */
141
633
  export type IAddFilter<T> = {
142
634
  addFilter(): IFilterSetup<T>;
143
635
  };
636
+ /**
637
+ * Represents a setup for filtering that combines the functionality of IFilter and IFilterSwitch interfaces.
638
+ * This type is parameterized with a generic type T, which determines the type of data it operates on.
639
+ *
640
+ * It encompasses the capabilities provided by the IFilter and IFilterSwitch types, allowing for more
641
+ * robust and flexible filter setups. This is particularly useful in scenarios where both filtering
642
+ * logic and the ability to switch between filter states are required.
643
+ *
644
+ * @template T The type of the items to be filtered by the setup.
645
+ */
144
646
  export type IFilterSetup<T> = IFilter<T> & IFilterSwitch<T>;
647
+ /**
648
+ * Represents a generic filtering interface that applies conditions to a data set.
649
+ *
650
+ * @template T The type of data this filter will operate on.
651
+ *
652
+ * @typedef {Object} IFilter
653
+ *
654
+ * @property {function(condition: ICallback<any>): IFilterSetup<T>} filter
655
+ * Applies a single filtering condition to the data set.
656
+ *
657
+ * @property {function(conditions: ICallback<any>[]): IFilterSetup<T>} pushFilters
658
+ * Applies multiple filtering conditions to the data set in bulk.
659
+ */
145
660
  export type IFilter<T> = {
146
661
  filter(condition: ICallback<any>): IFilterSetup<T>;
147
662
  pushFilters(conditions: ICallback<any>[]): IFilterSetup<T>;
148
663
  };
664
+ /**
665
+ * Interface representing a filter switch mechanism.
666
+ *
667
+ * This interface defines a method for managing cases within a filter switch
668
+ * process, allowing the user to determine a specific behavior based on a given
669
+ * context or condition mapped to the type parameter `T`.
670
+ *
671
+ * @template T Type of the context or condition used by the filter switch.
672
+ */
149
673
  export type IFilterSwitch<T> = {
150
674
  switch(): FilterSwitchCase<T>;
151
675
  };
676
+ /**
677
+ * Represents a filtering construct that allows chaining of conditional cases.
678
+ * Utilized to sequentially apply multiple conditions for filtering items.
679
+ *
680
+ * @template T - The type of the elements to be filtered.
681
+ */
152
682
  export type IFilterCase<T> = {
153
683
  case(condition: ICallback<any>): IFilterCase<T>;
154
684
  pushCases(conditions: ICallback<any>[]): IFilterCase<T>;
155
685
  };
686
+ /**
687
+ * Represents the structure of a filter payload that includes the state of a break, availability, and additional payload.
688
+ *
689
+ * @typedef {Object} IFilterPayload
690
+ * @property {boolean} isBreak Indicates whether the current state represents a break.
691
+ * @property {boolean} isAvailable Indicates whether the current state is available.
692
+ * @property {any} payload Holds additional data associated with the filter payload.
693
+ */
156
694
  export type IFilterPayload = {
157
695
  isBreak: boolean;
158
696
  isAvailable: boolean;
159
697
  payload: any;
160
698
  };
699
+ /**
700
+ * Represents a callback function that is invoked during a filter chain operation.
701
+ *
702
+ * The IFilterChainCallback is intended to process or manipulate the provided
703
+ * filter payload and perform necessary actions as part of the filter chain execution.
704
+ *
705
+ * The callback function receives a single argument, which is the filter payload data,
706
+ * allowing it to perform operations relevant to the filtering process.
707
+ *
708
+ * @callback IFilterChainCallback
709
+ * @param {IFilterPayload} data - The payload data to be processed by the callback during the filter chain execution.
710
+ */
161
711
  export type IFilterChainCallback = (data: IFilterPayload) => void;
712
+ /**
713
+ * Represents the response format for a filtering operation.
714
+ *
715
+ * This type defines the standard structure for the response data when
716
+ * performing a filter operation. It indicates the success status and
717
+ * contains the corresponding payload of data.
718
+ *
719
+ * Properties:
720
+ * - `isOK`: A boolean indicating whether the filtering operation was successful.
721
+ * - `payload`: The data retrieved or processed during the filtering operation;
722
+ * this can be of any type.
723
+ */
162
724
  export type IFilterResponse = {
163
725
  isOK: boolean;
164
726
  payload: any;