@rs-x/state-manager 1.0.2 → 2.0.0-next.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.
- package/dist/index.d.ts +116 -42
- package/dist/index.js +772 -399
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observable, Subject, Subscription } from 'rxjs';
|
|
2
|
-
import { IDisposable, IPropertyChange, IDisposableOwner, IKeyedInstanceFactory,
|
|
2
|
+
import { IDisposable, IPropertyChange, IDisposableOwner, IKeyedInstanceFactory, GroupedKeyedInstanceFactory, IErrorLog, IIndexValueAccessor, IArrayIndexAccessor, IMapKeyAccessor, IPropertyValueAccessor, ISetKeyAccessor, IProxyRegistry, KeyedInstanceFactory, IEqualityService, IValueMetadata, DateProperty, IDatePropertyAccessor, IObservableAccessor, IPromiseAccessor, IMultiInjectService, ContainerModule, IDeepClone, IGroupedKeyedInstanceFactory, IInstanceGroupInfo } from '@rs-x/core';
|
|
3
3
|
|
|
4
4
|
interface IObserver<T = unknown> extends IDisposable {
|
|
5
5
|
target: T | undefined;
|
|
@@ -37,40 +37,56 @@ interface IChangeSubscriptionsCreateMethods {
|
|
|
37
37
|
onChanged: (change: IPropertyChange) => void;
|
|
38
38
|
init?: (observer: IObserver) => void;
|
|
39
39
|
}
|
|
40
|
-
interface IGroupedChangeSubscriptionsForContextManager<TSubsriptionData, TData, TIdData = TData> extends IKeyedInstanceFactory<
|
|
41
|
-
getSubsriptionData(id:
|
|
40
|
+
interface IGroupedChangeSubscriptionsForContextManager<TSubsriptionData, TData, TIdData = TData> extends IKeyedInstanceFactory<number, TData, IObserver, TIdData> {
|
|
41
|
+
getSubsriptionData(id: number): TSubsriptionData | undefined;
|
|
42
42
|
}
|
|
43
|
-
declare abstract class GroupedChangeSubscriptionsForContextManager<TSubsriptionData, TData extends TIdData & IChangeSubscriptionsCreateMethods, TIdData = TData> extends
|
|
43
|
+
declare abstract class GroupedChangeSubscriptionsForContextManager<TSubsriptionData, TData extends TIdData & IChangeSubscriptionsCreateMethods, TIdData = TData> extends GroupedKeyedInstanceFactory<number, TData, IObserver> implements IGroupedChangeSubscriptionsForContextManager<TSubsriptionData, TData, TIdData> {
|
|
44
44
|
private _context;
|
|
45
45
|
private readonly releaseContext;
|
|
46
46
|
protected readonly _errorLog: IErrorLog;
|
|
47
|
+
private _nextId;
|
|
47
48
|
private readonly _subscriptions;
|
|
48
|
-
constructor(_context: unknown, releaseContext: () => void, _errorLog: IErrorLog
|
|
49
|
+
constructor(_context: unknown, releaseContext: () => void, _errorLog: IErrorLog);
|
|
49
50
|
protected get context(): unknown;
|
|
50
|
-
getSubsriptionData(id:
|
|
51
|
-
protected createInstance(data: TData, id:
|
|
51
|
+
getSubsriptionData(id: number): TSubsriptionData | undefined;
|
|
52
|
+
protected createInstance(data: TData, id: number): IObserver;
|
|
52
53
|
protected onInstanceCreated(observer: IObserver<unknown>, data: TData): void;
|
|
53
|
-
protected abstract createObserver(context: unknown, data: TData, id:
|
|
54
|
+
protected abstract createObserver(context: unknown, data: TData, id: number): {
|
|
54
55
|
subscriptionData: TSubsriptionData;
|
|
55
56
|
observer: IObserver;
|
|
56
57
|
};
|
|
57
|
-
protected releaseInstance(observer: IObserver, id:
|
|
58
|
+
protected releaseInstance(observer: IObserver, id: number): void;
|
|
58
59
|
protected onReleased(): void;
|
|
60
|
+
protected createUniqueId(_data: TData): number;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
type ShouldWatchIndexPredicate = (context: unknown, index: unknown, target: unknown) => boolean;
|
|
62
|
-
interface IIndexWatchRule {
|
|
64
|
+
interface IIndexWatchRule extends IDisposable {
|
|
65
|
+
id: unknown;
|
|
63
66
|
context: unknown;
|
|
64
67
|
test(index: unknown, target: unknown): boolean;
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
declare class IndexWatchRule implements IIndexWatchRule {
|
|
71
|
+
readonly id: string;
|
|
68
72
|
context: unknown;
|
|
69
73
|
private readonly predicate;
|
|
70
|
-
constructor(context: unknown, predicate: (index: unknown, target: unknown, context: unknown) => boolean);
|
|
74
|
+
constructor(id: string, context: unknown, predicate: (index: unknown, target: unknown, context: unknown) => boolean);
|
|
75
|
+
dispose(): void;
|
|
71
76
|
test(index: unknown, target: unknown): boolean;
|
|
72
77
|
}
|
|
73
|
-
|
|
78
|
+
|
|
79
|
+
interface IIndexWatchRuleFactory {
|
|
80
|
+
create(context: unknown, index: unknown): IIndexWatchRule;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare class IndexWatchRuleFactory implements IIndexWatchRuleFactory {
|
|
84
|
+
private readonly _identifierIndexWatchRuleManager;
|
|
85
|
+
constructor();
|
|
86
|
+
create(context: unknown, index: unknown): IIndexWatchRule;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
declare const watchIndexRecursiveRule: IIndexWatchRule;
|
|
74
90
|
|
|
75
91
|
interface IObjectChange {
|
|
76
92
|
root: object;
|
|
@@ -171,7 +187,7 @@ interface IDateProxyData extends IDateProxyIdData {
|
|
|
171
187
|
owner?: IDisposableOwner;
|
|
172
188
|
}
|
|
173
189
|
type IDateObserverProxyPair = IObserverProxyPair<Date>;
|
|
174
|
-
type IDateProxyFactory = IKeyedInstanceFactory<
|
|
190
|
+
type IDateProxyFactory = IKeyedInstanceFactory<number, IDateProxyData, IDateObserverProxyPair>;
|
|
175
191
|
|
|
176
192
|
type IDateOserverProxyPair = IObserverProxyPair<Date>;
|
|
177
193
|
type IDateObserverProxyPairFactory = IObjectObserverProxyPairFactory<Date>;
|
|
@@ -267,19 +283,21 @@ declare class ObjectObserverProxyPairFactoryProvider implements IObjectObserverP
|
|
|
267
283
|
constructor(factories: readonly IObjectObserverProxyPairFactory[]);
|
|
268
284
|
}
|
|
269
285
|
|
|
270
|
-
declare class ObjectObserverProxyPairManager extends
|
|
286
|
+
declare class ObjectObserverProxyPairManager extends GroupedKeyedInstanceFactory<number, IProxyTarget<unknown>, IObserverProxyPair> implements IObjectObserverProxyPairManager {
|
|
271
287
|
private readonly getObserverFactoryProvider;
|
|
272
288
|
private readonly _proxyRegistry;
|
|
273
|
-
|
|
289
|
+
private _nextId;
|
|
290
|
+
constructor(getObserverFactoryProvider: () => IObjectObserverProxyPairFactoryProvider, _proxyRegistry: IProxyRegistry);
|
|
274
291
|
protected getGroupId(data: IProxyTarget<unknown>): unknown;
|
|
275
292
|
protected getGroupMemberId(data: IProxyTarget<unknown>): IIndexWatchRule | undefined;
|
|
276
293
|
create(data: IProxyTarget<unknown>): {
|
|
277
294
|
referenceCount: number;
|
|
278
295
|
instance: IObserverProxyPair<unknown>;
|
|
279
|
-
id:
|
|
296
|
+
id: number;
|
|
280
297
|
};
|
|
281
|
-
protected createInstance(objectObserverInfo: IProxyTarget<unknown>, id:
|
|
298
|
+
protected createInstance(objectObserverInfo: IProxyTarget<unknown>, id: number): IObserverProxyPair;
|
|
282
299
|
protected releaseInstance(observerProxyPair: IObserverProxyPair): void;
|
|
300
|
+
protected createUniqueId(_data: IProxyTarget<unknown>): number;
|
|
283
301
|
}
|
|
284
302
|
|
|
285
303
|
interface IIndexObserverProxyPairFactory<TProxy = unknown> extends IDisposable {
|
|
@@ -289,8 +307,7 @@ interface IIndexObserverProxyPairFactory<TProxy = unknown> extends IDisposable {
|
|
|
289
307
|
|
|
290
308
|
declare class ObjectPropertyObserverProxyPairManager extends KeyedInstanceFactory<unknown, unknown, IPropertyObserverProxyPairManager> implements IObjectPropertyObserverProxyPairManager {
|
|
291
309
|
private readonly _factories;
|
|
292
|
-
|
|
293
|
-
constructor(_factories: IIndexObserverProxyPairFactory[], _guidFactory: IGuidFactory);
|
|
310
|
+
constructor(_factories: IIndexObserverProxyPairFactory[]);
|
|
294
311
|
getId(context: unknown): unknown;
|
|
295
312
|
protected createId(context: unknown): unknown;
|
|
296
313
|
protected createInstance(context: unknown): IPropertyObserverProxyPairManager;
|
|
@@ -340,12 +357,11 @@ type IIndexChangeSubscriptionsForContextManager<TIndex> = IGroupedChangeSubscrip
|
|
|
340
357
|
declare class IndexChangeSubscriptionManager<TIndex> extends KeyedInstanceFactory<unknown, unknown, IIndexChangeSubscriptionsForContextManager<TIndex>> {
|
|
341
358
|
private readonly _indexSetObserverManager;
|
|
342
359
|
private readonly _errorLog;
|
|
343
|
-
|
|
344
|
-
constructor(_indexSetObserverManager: IIndexSetObserverManager<unknown>, _errorLog: IErrorLog, _guidFactory: IGuidFactory);
|
|
360
|
+
constructor(_indexSetObserverManager: IIndexSetObserverManager<unknown>, _errorLog: IErrorLog);
|
|
345
361
|
getId(context: unknown): unknown;
|
|
346
362
|
protected createId(context: unknown): unknown;
|
|
347
363
|
protected createInstance(context: unknown): IIndexChangeSubscriptionsForContextManager<TIndex>;
|
|
348
|
-
protected releaseInstance(instance: IIndexChangeSubscriptionsForContextManager<TIndex>, id:
|
|
364
|
+
protected releaseInstance(instance: IIndexChangeSubscriptionsForContextManager<TIndex>, id: number): void;
|
|
349
365
|
}
|
|
350
366
|
|
|
351
367
|
declare abstract class IndexObserverProxyPairFactory<TContext, TIndex> implements IIndexObserverProxyPairFactory<TContext> {
|
|
@@ -355,7 +371,7 @@ declare abstract class IndexObserverProxyPairFactory<TContext, TIndex> implement
|
|
|
355
371
|
private readonly _valueMetadata;
|
|
356
372
|
private readonly mustHandleChange?;
|
|
357
373
|
private readonly _indexChangeSubscriptionManager;
|
|
358
|
-
protected constructor(_objectObserveryManager: IObjectObserverProxyPairManager, indexSetObserverManager: IIndexSetObserverManager<TIndex>, errorLog: IErrorLog,
|
|
374
|
+
protected constructor(_objectObserveryManager: IObjectObserverProxyPairManager, indexSetObserverManager: IIndexSetObserverManager<TIndex>, errorLog: IErrorLog, _indexValueAccessor: IIndexValueAccessor, _proxyRegister: IProxyRegistry, _valueMetadata: IValueMetadata, mustHandleChange?: ((change: IPropertyChange) => boolean) | undefined);
|
|
359
375
|
dispose(): void;
|
|
360
376
|
abstract applies(object: unknown, propertyInfo: IPropertyInfo): boolean;
|
|
361
377
|
create(owner: IDisposableOwner, object: TContext, propertyInfo: IPropertyInfo): IObserverProxyPair<TContext>;
|
|
@@ -367,7 +383,7 @@ declare abstract class IndexObserverProxyPairFactory<TContext, TIndex> implement
|
|
|
367
383
|
}
|
|
368
384
|
|
|
369
385
|
declare class CollectionItemObserverProxyPairFactory extends IndexObserverProxyPairFactory<Collection, unknown> {
|
|
370
|
-
constructor(objectObserverManager: IObjectObserverProxyPairManager, collectionItemObserverManager: ICollectionItemObserverManager, errorLog: IErrorLog,
|
|
386
|
+
constructor(objectObserverManager: IObjectObserverProxyPairManager, collectionItemObserverManager: ICollectionItemObserverManager, errorLog: IErrorLog, indexValueAccessor: IIndexValueAccessor, proxyRegister: IProxyRegistry, valueMetadata: IValueMetadata);
|
|
371
387
|
applies(object: unknown): boolean;
|
|
372
388
|
}
|
|
373
389
|
|
|
@@ -382,7 +398,8 @@ declare class DatePropertyObserverManager extends KeyedInstanceFactory<Date, Dat
|
|
|
382
398
|
private readonly _dateProxyFactory;
|
|
383
399
|
private readonly _errorLog;
|
|
384
400
|
private readonly _datePropertyAccessor;
|
|
385
|
-
|
|
401
|
+
private readonly _indexWatchRuleFactory;
|
|
402
|
+
constructor(_dateProxyFactory: IDateProxyFactory, _errorLog: IErrorLog, _datePropertyAccessor: IDatePropertyAccessor, _indexWatchRuleFactory: IIndexWatchRuleFactory);
|
|
386
403
|
getId(date: Date): Date;
|
|
387
404
|
createId(date: Date): Date;
|
|
388
405
|
protected createInstance(date: Date): IProperForDataObserverManager;
|
|
@@ -392,7 +409,7 @@ declare class DatePropertyObserverManager extends KeyedInstanceFactory<Date, Dat
|
|
|
392
409
|
type IDatePropertyObserverProxyPairFactory = IIndexObserverProxyPairFactory<Date>;
|
|
393
410
|
|
|
394
411
|
declare class DatePropertyObserverProxyPairFactory extends IndexObserverProxyPairFactory<Date, DateProperty> implements IDatePropertyObserverProxyPairFactory {
|
|
395
|
-
constructor(objectObserverManager: IObjectObserverProxyPairManager, datePropertyObserverManager: IDatePropertyObserverManager, errorLog: IErrorLog,
|
|
412
|
+
constructor(objectObserverManager: IObjectObserverProxyPairManager, datePropertyObserverManager: IDatePropertyObserverManager, errorLog: IErrorLog, datePropertyAccessor: IIndexValueAccessor, proxyRegister: IProxyRegistry, valueMetadata: IValueMetadata);
|
|
396
413
|
applies(object: unknown): boolean;
|
|
397
414
|
}
|
|
398
415
|
|
|
@@ -402,7 +419,7 @@ type IPropertyObserverManager = IKeyedInstanceFactory<string, IPropertyObserverI
|
|
|
402
419
|
type IObjectPropertyObserverManager = IKeyedInstanceFactory<object, object, IPropertyObserverManager>;
|
|
403
420
|
|
|
404
421
|
declare class NonIterableObjectPropertyObserverProxyPairFactory extends IndexObserverProxyPairFactory<object, string> {
|
|
405
|
-
constructor(objectObserveryManager: IObjectObserverProxyPairManager, objectPropertyObserverManager: IObjectPropertyObserverManager, errorLog: IErrorLog,
|
|
422
|
+
constructor(objectObserveryManager: IObjectObserverProxyPairManager, objectPropertyObserverManager: IObjectPropertyObserverManager, errorLog: IErrorLog, indexValueAccessor: IIndexValueAccessor, proxyRegister: IProxyRegistry, valueMetadata: IValueMetadata);
|
|
406
423
|
applies(object: unknown, propertyInfo: IPropertyInfo): boolean;
|
|
407
424
|
protected setIndexValue(object: Record<string, unknown>, key: string, value: unknown): void;
|
|
408
425
|
}
|
|
@@ -425,12 +442,14 @@ declare class ArrayProxyFactory extends KeyedInstanceFactory<unknown[], IArrayPr
|
|
|
425
442
|
protected releaseInstance(arrayObserverWithProxy: IArrayObserverProxyPair, id: unknown[]): void;
|
|
426
443
|
}
|
|
427
444
|
|
|
428
|
-
declare class DateProxyFactory extends
|
|
445
|
+
declare class DateProxyFactory extends GroupedKeyedInstanceFactory<number, IDateProxyData, IDateObserverProxyPair, IDateProxyIdData> implements IDateProxyFactory {
|
|
429
446
|
private readonly _proxyRegistry;
|
|
430
|
-
|
|
447
|
+
private _nextId;
|
|
448
|
+
constructor(_proxyRegistry: IProxyRegistry);
|
|
431
449
|
protected getGroupId(data: IDateProxyIdData): Date;
|
|
432
450
|
protected getGroupMemberId(data: IDateProxyIdData): IIndexWatchRule | undefined;
|
|
433
|
-
protected createInstance(dateProxyData: IDateProxyData, id:
|
|
451
|
+
protected createInstance(dateProxyData: IDateProxyData, id: number): IDateObserverProxyPair;
|
|
452
|
+
protected createUniqueId(_data: IDateProxyIdData): number;
|
|
434
453
|
}
|
|
435
454
|
|
|
436
455
|
declare class MapProxy extends AbstractObserver<Map<unknown, unknown>, Map<unknown, unknown>, undefined> {
|
|
@@ -530,6 +549,8 @@ declare const RsXStateManagerInjectionTokens: {
|
|
|
530
549
|
IPropertyObserverProxyPairFactoryProviderFactory: symbol;
|
|
531
550
|
IObjectObserverProxyPairFactoryProviderFactory: symbol;
|
|
532
551
|
IStateManager: symbol;
|
|
552
|
+
IWatchFactory: symbol;
|
|
553
|
+
IIndexWatchRuleFactory: symbol;
|
|
533
554
|
};
|
|
534
555
|
|
|
535
556
|
interface IState {
|
|
@@ -587,19 +608,18 @@ interface IStateChangeSubscriptionInfo extends IStateChangeSubscriptionIdInfo {
|
|
|
587
608
|
onChanged: (change: IPropertyChange) => void;
|
|
588
609
|
init?: (observer: IObserver) => void;
|
|
589
610
|
}
|
|
590
|
-
type IStateChangeSubscriptionsForContextManager = IGroupedKeyedInstanceFactory<
|
|
611
|
+
type IStateChangeSubscriptionsForContextManager = IGroupedKeyedInstanceFactory<number, IStateChangeSubscriptionInfo, IObserver, IStateChangeSubscriptionIdInfo>;
|
|
591
612
|
interface IStateChangeSubscriptionManager extends IKeyedInstanceFactory<unknown, unknown, IStateChangeSubscriptionsForContextManager> {
|
|
592
613
|
isRegistered(context: unknown, key: unknown): boolean;
|
|
593
|
-
instanceGroupInfoEntriesForContext(context: unknown): IterableIterator<IInstanceGroupInfo<
|
|
614
|
+
instanceGroupInfoEntriesForContext(context: unknown): IterableIterator<IInstanceGroupInfo<number, IObserver>>;
|
|
594
615
|
}
|
|
595
616
|
|
|
596
617
|
declare class StateChangeSubscriptionManager extends KeyedInstanceFactory<unknown, unknown, IStateChangeSubscriptionsForContextManager> implements IStateChangeSubscriptionManager {
|
|
597
618
|
private readonly _objectObserverManager;
|
|
598
619
|
private readonly _errorLog;
|
|
599
|
-
|
|
600
|
-
constructor(_objectObserverManager: IObjectPropertyObserverProxyPairManager, _errorLog: IErrorLog, _guidFactory: IGuidFactory);
|
|
620
|
+
constructor(_objectObserverManager: IObjectPropertyObserverProxyPairManager, _errorLog: IErrorLog);
|
|
601
621
|
getId(context: unknown): unknown;
|
|
602
|
-
instanceGroupInfoEntriesForContext(context: unknown): IterableIterator<IInstanceGroupInfo<
|
|
622
|
+
instanceGroupInfoEntriesForContext(context: unknown): IterableIterator<IInstanceGroupInfo<number, IObserver>>;
|
|
603
623
|
isRegistered(context: unknown, key: unknown): boolean;
|
|
604
624
|
protected createId(context: unknown): unknown;
|
|
605
625
|
protected createInstance(context: unknown, id: unknown): IStateChangeSubscriptionsForContextManager;
|
|
@@ -619,20 +639,27 @@ interface IStateChange extends IContextChanged {
|
|
|
619
639
|
interface IStateOptions {
|
|
620
640
|
indexWatchRule?: IIndexWatchRule;
|
|
621
641
|
ownerId?: unknown;
|
|
642
|
+
suppressInitialChangeEmit?: boolean;
|
|
622
643
|
}
|
|
623
644
|
interface IStateEventListener {
|
|
624
645
|
onStateChange: (change: IStateChange) => void;
|
|
625
646
|
onContextChanged: (change: IContextChanged) => void;
|
|
647
|
+
onStartChangeCycle?: (cycle: IChangeCycleIndex) => void;
|
|
648
|
+
onEndChangeCycle?: (cycle: IChangeCycleIndex) => void;
|
|
649
|
+
}
|
|
650
|
+
interface IChangeCycleIndex {
|
|
651
|
+
context: unknown;
|
|
652
|
+
index: unknown;
|
|
626
653
|
}
|
|
627
654
|
interface IStateManager {
|
|
628
655
|
readonly changed: Observable<IStateChange>;
|
|
629
656
|
readonly contextChanged: Observable<IContextChanged>;
|
|
630
|
-
readonly startChangeCycle: Observable<
|
|
631
|
-
readonly endChangeCycle: Observable<
|
|
657
|
+
readonly startChangeCycle: Observable<IChangeCycleIndex>;
|
|
658
|
+
readonly endChangeCycle: Observable<IChangeCycleIndex>;
|
|
632
659
|
isWatched(context: unknown, index: unknown, indexWatchRule?: IIndexWatchRule): boolean;
|
|
633
660
|
watchState(context: unknown, index: unknown, options?: IStateOptions): unknown;
|
|
634
661
|
subscribeStateEvents(context: unknown, index: unknown, listener: IStateEventListener): () => void;
|
|
635
|
-
releaseState(
|
|
662
|
+
releaseState(context: unknown, index: unknown, indexWatchRule?: IIndexWatchRule): void;
|
|
636
663
|
getState<T>(context: unknown, index: unknown): T;
|
|
637
664
|
setState<T>(context: unknown, index: unknown, value: T, ownerId?: unknown): void;
|
|
638
665
|
clear(): void;
|
|
@@ -642,6 +669,7 @@ declare class StateManager implements IStateManager {
|
|
|
642
669
|
private readonly _objectStateManager;
|
|
643
670
|
private readonly _indexValueAccessor;
|
|
644
671
|
private readonly _equalityService;
|
|
672
|
+
private readonly _proxyRegistry;
|
|
645
673
|
private readonly _changed;
|
|
646
674
|
private readonly _contextChanged;
|
|
647
675
|
private readonly _startChangeCycle;
|
|
@@ -650,11 +678,11 @@ declare class StateManager implements IStateManager {
|
|
|
650
678
|
private readonly _pending;
|
|
651
679
|
private readonly _stateEventSubscriptionsByContext;
|
|
652
680
|
private readonly _stateEventSubscriptionPool;
|
|
653
|
-
constructor(objectObserverManager: IObjectPropertyObserverProxyPairManager, _objectStateManager: IObjectStateManager, errorLog: IErrorLog,
|
|
681
|
+
constructor(objectObserverManager: IObjectPropertyObserverProxyPairManager, _objectStateManager: IObjectStateManager, errorLog: IErrorLog, _indexValueAccessor: IIndexValueAccessor, _equalityService: IEqualityService, _proxyRegistry: IProxyRegistry);
|
|
654
682
|
get changed(): Observable<IStateChange>;
|
|
655
683
|
get contextChanged(): Observable<IContextChanged>;
|
|
656
|
-
get startChangeCycle(): Observable<
|
|
657
|
-
get endChangeCycle(): Observable<
|
|
684
|
+
get startChangeCycle(): Observable<IChangeCycleIndex>;
|
|
685
|
+
get endChangeCycle(): Observable<IChangeCycleIndex>;
|
|
658
686
|
toString(): string;
|
|
659
687
|
isWatched(context: unknown, index: unknown, indexWatchRule?: IIndexWatchRule): boolean;
|
|
660
688
|
watchState(context: unknown, index: unknown, options?: IStateOptions): unknown;
|
|
@@ -666,6 +694,7 @@ declare class StateManager implements IStateManager {
|
|
|
666
694
|
private internalSetState;
|
|
667
695
|
private getOldValue;
|
|
668
696
|
private unnsubscribeToObserverEvents;
|
|
697
|
+
private hasChanged;
|
|
669
698
|
private internalUnregister;
|
|
670
699
|
private emitChange;
|
|
671
700
|
private updateState;
|
|
@@ -678,6 +707,8 @@ declare class StateManager implements IStateManager {
|
|
|
678
707
|
private tryRebindingNestedState;
|
|
679
708
|
private addStateEventSubscription;
|
|
680
709
|
private removeStateEventSubscription;
|
|
710
|
+
private emitStartChangeCycleEvents;
|
|
711
|
+
private emitEndChangeCycleEvents;
|
|
681
712
|
private emitStateChangeEvents;
|
|
682
713
|
private emitContextChangedEvents;
|
|
683
714
|
private shouldPublish;
|
|
@@ -689,4 +720,47 @@ declare class StateManager implements IStateManager {
|
|
|
689
720
|
private onChange;
|
|
690
721
|
}
|
|
691
722
|
|
|
692
|
-
|
|
723
|
+
interface IWatchCallbacks {
|
|
724
|
+
onChanged: (change: IStateChange) => void;
|
|
725
|
+
onContextChanged: (change: IContextChanged) => void;
|
|
726
|
+
onStartChangeCycle: (cycle: IChangeCycleIndex) => void;
|
|
727
|
+
onEndChangeCycle: (cycle: IChangeCycleIndex) => void;
|
|
728
|
+
}
|
|
729
|
+
interface IWatch extends IDisposable {
|
|
730
|
+
readonly changed: Observable<IStateChange>;
|
|
731
|
+
readonly contextChange: Observable<IContextChanged>;
|
|
732
|
+
readonly startChangeCycle: Observable<IChangeCycleIndex>;
|
|
733
|
+
readonly endChangeCycle: Observable<IChangeCycleIndex>;
|
|
734
|
+
readonly context: unknown;
|
|
735
|
+
readonly index: unknown;
|
|
736
|
+
readonly value: unknown;
|
|
737
|
+
watch(): void;
|
|
738
|
+
unwatch(): void;
|
|
739
|
+
/** Zero-allocation alternative to subscribing to the four Observables individually. */
|
|
740
|
+
addListeners(key: unknown, callbacks: IWatchCallbacks): void;
|
|
741
|
+
removeListeners(key: unknown): void;
|
|
742
|
+
}
|
|
743
|
+
interface IWatchDispableOwner extends IDisposableOwner {
|
|
744
|
+
}
|
|
745
|
+
interface IWatchId {
|
|
746
|
+
context: unknown;
|
|
747
|
+
index: unknown;
|
|
748
|
+
}
|
|
749
|
+
interface IWatchData extends IWatchId {
|
|
750
|
+
options: IStateOptions;
|
|
751
|
+
}
|
|
752
|
+
type IWatchFactory = IKeyedInstanceFactory<number, IWatchData, IWatch, IWatchId>;
|
|
753
|
+
declare class WatchFactory extends GroupedKeyedInstanceFactory<number, IWatchData, IWatch, IWatchId> implements IWatchFactory {
|
|
754
|
+
private readonly _stateManager;
|
|
755
|
+
private readonly _identityMap;
|
|
756
|
+
private _identityIndex;
|
|
757
|
+
private _nextId;
|
|
758
|
+
constructor(_stateManager: IStateManager);
|
|
759
|
+
protected getGroupId(data: IWatchId): unknown;
|
|
760
|
+
protected getGroupMemberId(data: IWatchId): unknown;
|
|
761
|
+
protected createInstance(data: IWatchData, id: number): IWatch;
|
|
762
|
+
protected createUniqueId(_data: IWatchData): number;
|
|
763
|
+
private toIdentityKey;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
export { AbstractObjectObserverProxyPairFactory, AbstractObserver, ArrayObserverProxyPairFactory, ArrayProxyFactory, type Collection, CollectionItemObserverManager, CollectionItemObserverProxyPairFactory, DateObserverProxyPairFactory, DatePropertyObserverManager, DatePropertyObserverProxyPairFactory, DateProxyFactory, GroupedChangeSubscriptionsForContextManager, type IArrayObserverProxyPair, type IArrayObserverProxyPairFactory, type IArrayProxyData, type IArrayProxyFactory, type IArrayProxyIdData, type IChangeCycleIndex, type IChangeSubscriptionsCreateMethods, type ICollectionIdexObserverIdInfo, type ICollectionIndexObserverManager, type ICollectionItemObserverManager, type ICollectionItemObserverProxyPairFactory, type IContextChanged, type IDateObserverProxyPair, type IDateObserverProxyPairFactory, type IDateOserverProxyPair, type IDatePropertyObserverIdInfo, type IDatePropertyObserverInfo, type IDatePropertyObserverManager, type IDatePropertyObserverProxyPairFactory, type IDateProxyData, type IDateProxyFactory, type IDateProxyIdData, type IGroupedChangeSubscriptionsForContextManager, type IIndexChangeSubscriptionsForContextManager, type IIndexInfo, type IIndexObserverIdInfo, type IIndexObserverInfo, type IIndexObserverProxyPairFactory, type IIndexSetObserverManager, type IIndexWatchRule, type IIndexWatchRuleFactory, type IMapObserverProxyPair, type IMapObserverProxyPairFactory, type IMapProxifyData, type IMapProxifyIdData, type IMapProxyFactory, type IObjectChange, type IObjectObserverProxyPairFactory, type IObjectObserverProxyPairFactoryProvider, type IObjectObserverProxyPairManager, type IObjectPropertyObserverManager, type IObjectPropertyObserverProxyPairManager, type IObjectStateManager, type IObservableObserverProxyPair, type IObservableProxyData, type IObservableProxyFactory, type IObserver, type IObserverProxyPair, type IPlainObjectObserverProxyPairFactory, type IPromiseObserverProxyPair, type IPromiseProxyData, type IPromiseProxyFactory, type IProperForDataObserverManager, type IPropertyInfo, type IPropertyObserverIdInfo, type IPropertyObserverInfo, type IPropertyObserverManager, type IPropertyObserverProxyPairManager, type IProxyTarget, type ISetObserverProxyPair, type ISetObserverProxyPairFactory, type ISetProxifyData, type ISetProxifyIdData, type ISetProxyFactory, type IState, type IStateChange, type IStateChangeObserverInfo, type IStateChangeSubscriptionIdInfo, type IStateChangeSubscriptionInfo, type IStateChangeSubscriptionManager, type IStateChangeSubscriptionsForContextManager, type IStateEventListener, type IStateForObjectManager, type IStateManager, type IStateOptions, type ISubscriptionIdInfo, type ISubscriptionInfo, type ISubscriptionWithData, type IValueKey, type IValueWithKey, type IWatch, type IWatchCallbacks, type IWatchData, type IWatchDispableOwner, type IWatchFactory, type IWatchId, type IndexChangeSubscriptionForContext, IndexChangeSubscriptionManager, IndexObserverProxyPairFactory, IndexWatchRule, IndexWatchRuleFactory, MapObserverProxyPairFactory, MapProxy, MapProxyFactory, NonIterableObjectPropertyObserverProxyPairFactory, ObjectObserverProxyPairFactoryProvider, ObjectObserverProxyPairManager, ObjectPropertyObserverManager, ObjectPropertyObserverProxyPairManager, ObjectStateManager, ObservableObserverProxyPairFactory, ObservableProxyFactory, ObserverGroup, PlainObjectObserverProxyPairFactory, PromiseObserverProxyPairFactory, PromiseProxyFactory, RsXStateManagerInjectionTokens, RsXStateManagerModule, SetObserverProxyPairFactory, SetProxy, SetProxyFactory, type ShouldWatchIndexPredicate, StateChangeSubscriptionManager, StateForObjectManager, StateManager, WatchFactory, defaultObjectObserverProxyPairFactoryList, defaultPropertyObserverProxyPairFactoryList, unloadRsXStateManagerModule, watchIndexRecursiveRule };
|