@rs-x/state-manager 0.4.21 → 1.0.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 +69 -65
- package/dist/index.js +331 -174
- package/package.json +5 -4
- package/readme.md +26 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observable, Subject, Subscription } from 'rxjs';
|
|
2
|
-
import { IDisposable, IPropertyChange, IDisposableOwner,
|
|
2
|
+
import { IDisposable, IPropertyChange, IDisposableOwner, IKeyedInstanceFactory, GuidKeyedInstanceFactory, IErrorLog, IGuidFactory, 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,10 +37,10 @@ interface IChangeSubscriptionsCreateMethods {
|
|
|
37
37
|
onChanged: (change: IPropertyChange) => void;
|
|
38
38
|
init?: (observer: IObserver) => void;
|
|
39
39
|
}
|
|
40
|
-
interface IGroupedChangeSubscriptionsForContextManager<TSubsriptionData, TData, TIdData = TData> extends
|
|
40
|
+
interface IGroupedChangeSubscriptionsForContextManager<TSubsriptionData, TData, TIdData = TData> extends IKeyedInstanceFactory<string, TData, IObserver, TIdData> {
|
|
41
41
|
getSubsriptionData(id: string): 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 GuidKeyedInstanceFactory<TData, IObserver> implements IGroupedChangeSubscriptionsForContextManager<TSubsriptionData, TData, TIdData> {
|
|
44
44
|
private _context;
|
|
45
45
|
private readonly releaseContext;
|
|
46
46
|
protected readonly _errorLog: IErrorLog;
|
|
@@ -92,8 +92,8 @@ interface IPropertyInfo extends IIndexInfo {
|
|
|
92
92
|
setValue?: (value: unknown) => boolean;
|
|
93
93
|
initializeManually?: boolean;
|
|
94
94
|
}
|
|
95
|
-
type IPropertyObserverProxyPairManager =
|
|
96
|
-
type IObjectPropertyObserverProxyPairManager =
|
|
95
|
+
type IPropertyObserverProxyPairManager = IKeyedInstanceFactory<unknown, IPropertyInfo, IObserverProxyPair, IIndexInfo>;
|
|
96
|
+
type IObjectPropertyObserverProxyPairManager = IKeyedInstanceFactory<unknown, unknown, IPropertyObserverProxyPairManager>;
|
|
97
97
|
|
|
98
98
|
declare class ObserverGroup extends AbstractObserver {
|
|
99
99
|
private readonly _errorLog;
|
|
@@ -123,7 +123,7 @@ interface IProxyTarget<TTarget> {
|
|
|
123
123
|
target: TTarget;
|
|
124
124
|
indexWatchRule?: IIndexWatchRule;
|
|
125
125
|
}
|
|
126
|
-
type IObjectObserverProxyPairManager<TTarget = unknown> =
|
|
126
|
+
type IObjectObserverProxyPairManager<TTarget = unknown> = IKeyedInstanceFactory<unknown, IProxyTarget<TTarget>, IObserverProxyPair<TTarget>>;
|
|
127
127
|
|
|
128
128
|
interface IObjectObserverProxyPairFactory<TTarget = unknown> {
|
|
129
129
|
readonly priority: number;
|
|
@@ -152,7 +152,7 @@ interface IArrayProxyData extends IArrayProxyIdData {
|
|
|
152
152
|
owner?: IDisposableOwner;
|
|
153
153
|
}
|
|
154
154
|
type IArrayObserverProxyPair = IObserverProxyPair<unknown[]>;
|
|
155
|
-
type IArrayProxyFactory =
|
|
155
|
+
type IArrayProxyFactory = IKeyedInstanceFactory<unknown, IArrayProxyData, IArrayObserverProxyPair, IArrayProxyIdData>;
|
|
156
156
|
|
|
157
157
|
type IArrayObserverProxyPairFactory = IObjectObserverProxyPairFactory<unknown[]>;
|
|
158
158
|
|
|
@@ -171,7 +171,7 @@ interface IDateProxyData extends IDateProxyIdData {
|
|
|
171
171
|
owner?: IDisposableOwner;
|
|
172
172
|
}
|
|
173
173
|
type IDateObserverProxyPair = IObserverProxyPair<Date>;
|
|
174
|
-
type IDateProxyFactory =
|
|
174
|
+
type IDateProxyFactory = IKeyedInstanceFactory<string, IDateProxyData, IDateObserverProxyPair>;
|
|
175
175
|
|
|
176
176
|
type IDateOserverProxyPair = IObserverProxyPair<Date>;
|
|
177
177
|
type IDateObserverProxyPairFactory = IObjectObserverProxyPairFactory<Date>;
|
|
@@ -191,7 +191,7 @@ interface IMapProxifyData extends IMapProxifyIdData {
|
|
|
191
191
|
owner?: IDisposableOwner;
|
|
192
192
|
}
|
|
193
193
|
type IMapObserverProxyPair = IObserverProxyPair<Map<unknown, unknown>>;
|
|
194
|
-
type IMapProxyFactory =
|
|
194
|
+
type IMapProxyFactory = IKeyedInstanceFactory<Map<unknown, unknown>, IMapProxifyData, IMapObserverProxyPair>;
|
|
195
195
|
|
|
196
196
|
type IMapObserverProxyPairFactory = IObjectObserverProxyPairFactory<Map<unknown, unknown>>;
|
|
197
197
|
|
|
@@ -207,7 +207,7 @@ interface IObservableProxyData {
|
|
|
207
207
|
observable: Observable<unknown>;
|
|
208
208
|
}
|
|
209
209
|
type IObservableObserverProxyPair = IObserverProxyPair<Observable<unknown>>;
|
|
210
|
-
type IObservableProxyFactory =
|
|
210
|
+
type IObservableProxyFactory = IKeyedInstanceFactory<Observable<unknown>, IObservableProxyData, IObservableObserverProxyPair>;
|
|
211
211
|
|
|
212
212
|
declare class ObservableObserverProxyPairFactory implements IObjectObserverProxyPairFactory<Observable<unknown>> {
|
|
213
213
|
private readonly _observableProxyFactory;
|
|
@@ -230,7 +230,7 @@ interface IPromiseProxyData {
|
|
|
230
230
|
promise: Promise<unknown>;
|
|
231
231
|
}
|
|
232
232
|
type IPromiseObserverProxyPair = IObserverProxyPair<Promise<unknown>>;
|
|
233
|
-
type IPromiseProxyFactory =
|
|
233
|
+
type IPromiseProxyFactory = IKeyedInstanceFactory<Promise<unknown>, IPromiseProxyData, IPromiseObserverProxyPair>;
|
|
234
234
|
|
|
235
235
|
declare class PromiseObserverProxyPairFactory implements IObjectObserverProxyPairFactory<Promise<unknown>> {
|
|
236
236
|
private readonly _promiseProxyFactory;
|
|
@@ -247,7 +247,7 @@ interface ISetProxifyData extends ISetProxifyIdData {
|
|
|
247
247
|
owner?: IDisposableOwner;
|
|
248
248
|
}
|
|
249
249
|
type ISetObserverProxyPair = IObserverProxyPair<Set<unknown>>;
|
|
250
|
-
type ISetProxyFactory =
|
|
250
|
+
type ISetProxyFactory = IKeyedInstanceFactory<Set<unknown>, ISetProxifyData, ISetObserverProxyPair, ISetProxifyIdData>;
|
|
251
251
|
|
|
252
252
|
type ISetObserverProxyPairFactory = IObjectObserverProxyPairFactory<Set<unknown>>;
|
|
253
253
|
|
|
@@ -267,15 +267,7 @@ declare class ObjectObserverProxyPairFactoryProvider implements IObjectObserverP
|
|
|
267
267
|
constructor(factories: readonly IObjectObserverProxyPairFactory[]);
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
|
|
271
|
-
getProxyTarget<T>(proxyToFind: unknown): T;
|
|
272
|
-
getProxy<T>(proxyTarget: unknown): T;
|
|
273
|
-
register(proxyTarget: unknown, proxy: unknown): void;
|
|
274
|
-
unregister(proxyTarget: unknown): void;
|
|
275
|
-
isProxy(object: unknown): boolean;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
declare class ObjectObserverProxyPairManager extends SingletonFactoryWithGuid<IProxyTarget<unknown>, IObserverProxyPair> implements IObjectObserverProxyPairManager {
|
|
270
|
+
declare class ObjectObserverProxyPairManager extends GuidKeyedInstanceFactory<IProxyTarget<unknown>, IObserverProxyPair> implements IObjectObserverProxyPairManager {
|
|
279
271
|
private readonly getObserverFactoryProvider;
|
|
280
272
|
private readonly _proxyRegistry;
|
|
281
273
|
constructor(getObserverFactoryProvider: () => IObjectObserverProxyPairFactoryProvider, _proxyRegistry: IProxyRegistry, guidFactory: IGuidFactory);
|
|
@@ -295,7 +287,7 @@ interface IIndexObserverProxyPairFactory<TProxy = unknown> extends IDisposable {
|
|
|
295
287
|
applies(object: unknown, propertyInfo: IPropertyInfo): boolean;
|
|
296
288
|
}
|
|
297
289
|
|
|
298
|
-
declare class ObjectPropertyObserverProxyPairManager extends
|
|
290
|
+
declare class ObjectPropertyObserverProxyPairManager extends KeyedInstanceFactory<unknown, unknown, IPropertyObserverProxyPairManager> implements IObjectPropertyObserverProxyPairManager {
|
|
299
291
|
private readonly _factories;
|
|
300
292
|
private readonly _guidFactory;
|
|
301
293
|
constructor(_factories: IIndexObserverProxyPairFactory[], _guidFactory: IGuidFactory);
|
|
@@ -313,10 +305,10 @@ interface IIndexObserverInfo<TIndex = unknown> extends IIndexObserverIdInfo<TInd
|
|
|
313
305
|
|
|
314
306
|
type Collection = Map<unknown, unknown> | Array<unknown> | Set<unknown>;
|
|
315
307
|
type ICollectionIdexObserverIdInfo = IIndexObserverIdInfo<unknown>;
|
|
316
|
-
type ICollectionIndexObserverManager =
|
|
317
|
-
type ICollectionItemObserverManager =
|
|
308
|
+
type ICollectionIndexObserverManager = IKeyedInstanceFactory<unknown, IIndexObserverInfo, IObserver>;
|
|
309
|
+
type ICollectionItemObserverManager = IKeyedInstanceFactory<Collection, Collection, ICollectionIndexObserverManager>;
|
|
318
310
|
|
|
319
|
-
declare class CollectionItemObserverManager extends
|
|
311
|
+
declare class CollectionItemObserverManager extends KeyedInstanceFactory<Collection, Collection, ICollectionIndexObserverManager> implements ICollectionItemObserverManager {
|
|
320
312
|
private readonly _errorLog;
|
|
321
313
|
private readonly _equalityService;
|
|
322
314
|
private readonly _indexValueAccessor;
|
|
@@ -343,9 +335,9 @@ interface IndexChangeSubscriptionForContext<TIndex> {
|
|
|
343
335
|
context: unknown;
|
|
344
336
|
index: TIndex;
|
|
345
337
|
}
|
|
346
|
-
type IIndexSetObserverManager<TIndex> =
|
|
338
|
+
type IIndexSetObserverManager<TIndex> = IKeyedInstanceFactory<unknown, unknown, IKeyedInstanceFactory<IIndexWatchRule | TIndex, IIndexObserverInfo<TIndex>, IObserver, ISubscriptionIdInfo<TIndex>>>;
|
|
347
339
|
type IIndexChangeSubscriptionsForContextManager<TIndex> = IGroupedChangeSubscriptionsForContextManager<ObserverGroup, ISubscriptionInfo<TIndex>, ISubscriptionIdInfo<TIndex>>;
|
|
348
|
-
declare class IndexChangeSubscriptionManager<TIndex> extends
|
|
340
|
+
declare class IndexChangeSubscriptionManager<TIndex> extends KeyedInstanceFactory<unknown, unknown, IIndexChangeSubscriptionsForContextManager<TIndex>> {
|
|
349
341
|
private readonly _indexSetObserverManager;
|
|
350
342
|
private readonly _errorLog;
|
|
351
343
|
private readonly _guidFactory;
|
|
@@ -383,10 +375,10 @@ type ICollectionItemObserverProxyPairFactory = IIndexObserverProxyPairFactory<Co
|
|
|
383
375
|
|
|
384
376
|
type IDatePropertyObserverIdInfo = IIndexObserverIdInfo<DateProperty>;
|
|
385
377
|
type IDatePropertyObserverInfo = IIndexObserverInfo<DateProperty>;
|
|
386
|
-
type IProperForDataObserverManager =
|
|
387
|
-
type IDatePropertyObserverManager =
|
|
378
|
+
type IProperForDataObserverManager = IKeyedInstanceFactory<DateProperty, IDatePropertyObserverInfo, IObserver>;
|
|
379
|
+
type IDatePropertyObserverManager = IKeyedInstanceFactory<Date, Date, IProperForDataObserverManager>;
|
|
388
380
|
|
|
389
|
-
declare class DatePropertyObserverManager extends
|
|
381
|
+
declare class DatePropertyObserverManager extends KeyedInstanceFactory<Date, Date, IProperForDataObserverManager> implements IDatePropertyObserverManager {
|
|
390
382
|
private readonly _dateProxyFactory;
|
|
391
383
|
private readonly _errorLog;
|
|
392
384
|
private readonly _datePropertyAccessor;
|
|
@@ -406,8 +398,8 @@ declare class DatePropertyObserverProxyPairFactory extends IndexObserverProxyPai
|
|
|
406
398
|
|
|
407
399
|
type IPropertyObserverIdInfo = IIndexObserverIdInfo<string>;
|
|
408
400
|
type IPropertyObserverInfo = IIndexObserverInfo<string>;
|
|
409
|
-
type IPropertyObserverManager =
|
|
410
|
-
type IObjectPropertyObserverManager =
|
|
401
|
+
type IPropertyObserverManager = IKeyedInstanceFactory<string, IPropertyObserverInfo, IObserver>;
|
|
402
|
+
type IObjectPropertyObserverManager = IKeyedInstanceFactory<object, object, IPropertyObserverManager>;
|
|
411
403
|
|
|
412
404
|
declare class NonIterableObjectPropertyObserverProxyPairFactory extends IndexObserverProxyPairFactory<object, string> {
|
|
413
405
|
constructor(objectObserveryManager: IObjectObserverProxyPairManager, objectPropertyObserverManager: IObjectPropertyObserverManager, errorLog: IErrorLog, guidFactory: IGuidFactory, indexValueAccessor: IIndexValueAccessor, proxyRegister: IProxyRegistry, valueMetadata: IValueMetadata);
|
|
@@ -415,7 +407,7 @@ declare class NonIterableObjectPropertyObserverProxyPairFactory extends IndexObs
|
|
|
415
407
|
protected setIndexValue(object: Record<string, unknown>, key: string, value: unknown): void;
|
|
416
408
|
}
|
|
417
409
|
|
|
418
|
-
declare class ObjectPropertyObserverManager extends
|
|
410
|
+
declare class ObjectPropertyObserverManager extends KeyedInstanceFactory<object, object, IPropertyObserverManager> implements IObjectPropertyObserverManager {
|
|
419
411
|
private readonly _proxyRegister;
|
|
420
412
|
constructor(_proxyRegister: IProxyRegistry);
|
|
421
413
|
getId(context: object): object;
|
|
@@ -424,7 +416,7 @@ declare class ObjectPropertyObserverManager extends SingletonFactory<object, obj
|
|
|
424
416
|
protected releaseInstance(propertyObserverManager: IPropertyObserverManager): void;
|
|
425
417
|
}
|
|
426
418
|
|
|
427
|
-
declare class ArrayProxyFactory extends
|
|
419
|
+
declare class ArrayProxyFactory extends KeyedInstanceFactory<unknown[], IArrayProxyData, IArrayObserverProxyPair, IArrayProxyIdData> implements IArrayProxyFactory {
|
|
428
420
|
private readonly _proxyRegistry;
|
|
429
421
|
constructor(_proxyRegistry: IProxyRegistry);
|
|
430
422
|
getId(data: IArrayProxyIdData): unknown[];
|
|
@@ -433,7 +425,7 @@ declare class ArrayProxyFactory extends SingletonFactory<unknown[], IArrayProxyD
|
|
|
433
425
|
protected releaseInstance(arrayObserverWithProxy: IArrayObserverProxyPair, id: unknown[]): void;
|
|
434
426
|
}
|
|
435
427
|
|
|
436
|
-
declare class DateProxyFactory extends
|
|
428
|
+
declare class DateProxyFactory extends GuidKeyedInstanceFactory<IDateProxyData, IDateObserverProxyPair, IDateProxyIdData> implements IDateProxyFactory {
|
|
437
429
|
private readonly _proxyRegistry;
|
|
438
430
|
constructor(guidFactory: IGuidFactory, _proxyRegistry: IProxyRegistry);
|
|
439
431
|
protected getGroupId(data: IDateProxyIdData): Date;
|
|
@@ -454,7 +446,7 @@ declare class MapProxy extends AbstractObserver<Map<unknown, unknown>, Map<unkno
|
|
|
454
446
|
private deleteItem;
|
|
455
447
|
private emitSet;
|
|
456
448
|
}
|
|
457
|
-
declare class MapProxyFactory extends
|
|
449
|
+
declare class MapProxyFactory extends KeyedInstanceFactory<Map<unknown, unknown>, IMapProxifyData, IMapObserverProxyPair> implements IMapProxyFactory {
|
|
458
450
|
private readonly _proxyRegistry;
|
|
459
451
|
constructor(_proxyRegistry: IProxyRegistry);
|
|
460
452
|
getId(data: IMapProxifyData): Map<unknown, unknown>;
|
|
@@ -463,7 +455,7 @@ declare class MapProxyFactory extends SingletonFactory<Map<unknown, unknown>, IM
|
|
|
463
455
|
protected releaseInstance(mapObserverWithProxy: IMapObserverProxyPair): void;
|
|
464
456
|
}
|
|
465
457
|
|
|
466
|
-
declare class ObservableProxyFactory extends
|
|
458
|
+
declare class ObservableProxyFactory extends KeyedInstanceFactory<Observable<unknown>, IObservableProxyData, IObservableObserverProxyPair> implements IObservableProxyFactory {
|
|
467
459
|
private readonly _observableAccessor;
|
|
468
460
|
constructor(_observableAccessor: IObservableAccessor);
|
|
469
461
|
getId(data: IObservableProxyData): Observable<unknown>;
|
|
@@ -472,7 +464,7 @@ declare class ObservableProxyFactory extends SingletonFactory<Observable<unknown
|
|
|
472
464
|
protected releaseInstance(observableObserverWithProxy: IObservableObserverProxyPair): void;
|
|
473
465
|
}
|
|
474
466
|
|
|
475
|
-
declare class PromiseProxyFactory extends
|
|
467
|
+
declare class PromiseProxyFactory extends KeyedInstanceFactory<Promise<unknown>, IPromiseProxyData, IPromiseObserverProxyPair> implements IPromiseProxyFactory {
|
|
476
468
|
private readonly _promiseAccessor;
|
|
477
469
|
constructor(_promiseAccessor: IPromiseAccessor);
|
|
478
470
|
getId(data: IPromiseProxyData): Promise<unknown>;
|
|
@@ -481,15 +473,6 @@ declare class PromiseProxyFactory extends SingletonFactory<Promise<unknown>, IPr
|
|
|
481
473
|
protected releaseInstance(promiseObserverWithProxy: IPromiseObserverProxyPair): void;
|
|
482
474
|
}
|
|
483
475
|
|
|
484
|
-
declare class ProxyRegistry implements IProxyRegistry {
|
|
485
|
-
private readonly _proxies;
|
|
486
|
-
getProxyTarget<T>(proxyToFind: unknown): T;
|
|
487
|
-
getProxy<T>(proxyTarget: unknown): T;
|
|
488
|
-
register(proxyTarget: unknown, proxy: unknown): void;
|
|
489
|
-
unregister(proxyTarget: unknown): void;
|
|
490
|
-
isProxy(object: unknown): boolean;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
476
|
declare class SetProxy extends AbstractObserver<Set<unknown>, Set<unknown>, undefined> {
|
|
494
477
|
private readonly _proxyRegistry;
|
|
495
478
|
private readonly updateSet;
|
|
@@ -502,7 +485,7 @@ declare class SetProxy extends AbstractObserver<Set<unknown>, Set<unknown>, unde
|
|
|
502
485
|
private hasSet;
|
|
503
486
|
private emitValueChange;
|
|
504
487
|
}
|
|
505
|
-
declare class SetProxyFactory extends
|
|
488
|
+
declare class SetProxyFactory extends KeyedInstanceFactory<Set<unknown>, ISetProxifyData, ISetObserverProxyPair, ISetProxifyIdData> implements ISetProxyFactory {
|
|
506
489
|
private readonly _proxyRegistry;
|
|
507
490
|
constructor(_proxyRegistry: IProxyRegistry);
|
|
508
491
|
getId(data: ISetProxifyIdData): Set<unknown>;
|
|
@@ -521,7 +504,6 @@ declare const RsXStateManagerInjectionTokens: {
|
|
|
521
504
|
IMapProxyFactory: symbol;
|
|
522
505
|
ISetProxyFactory: symbol;
|
|
523
506
|
IDateProxyFactory: symbol;
|
|
524
|
-
IProxyRegistry: symbol;
|
|
525
507
|
IPromiseProxyFactory: symbol;
|
|
526
508
|
IObservableProxyFactory: symbol;
|
|
527
509
|
IObjectPropertyObserverProxyPairManager: symbol;
|
|
@@ -554,6 +536,7 @@ interface IState {
|
|
|
554
536
|
value: unknown;
|
|
555
537
|
valueCopy: unknown;
|
|
556
538
|
watched: boolean;
|
|
539
|
+
ownerId: unknown;
|
|
557
540
|
}
|
|
558
541
|
interface IValueKey {
|
|
559
542
|
key: unknown;
|
|
@@ -561,32 +544,33 @@ interface IValueKey {
|
|
|
561
544
|
interface IValueWithKey extends IValueKey {
|
|
562
545
|
value: unknown;
|
|
563
546
|
watched: boolean;
|
|
547
|
+
ownerId: unknown;
|
|
564
548
|
}
|
|
565
|
-
interface IStateForObjectManager extends
|
|
566
|
-
set(key: unknown, value: unknown, watched: boolean): void;
|
|
549
|
+
interface IStateForObjectManager extends IKeyedInstanceFactory<unknown, IValueWithKey, IState, IValueKey> {
|
|
550
|
+
set(key: unknown, value: unknown, watched: boolean, ownerId: unknown): void;
|
|
567
551
|
}
|
|
568
|
-
interface IObjectStateManager extends
|
|
569
|
-
replaceState(key: unknown, newContext: unknown, newValue: unknown, oldContext: unknown, watched: boolean): void;
|
|
552
|
+
interface IObjectStateManager extends IKeyedInstanceFactory<unknown, unknown, IStateForObjectManager> {
|
|
553
|
+
replaceState(key: unknown, newContext: unknown, newValue: unknown, oldContext: unknown, watched: boolean, ownerId: unknown): void;
|
|
570
554
|
isRegistered(context: unknown, key: unknown): boolean;
|
|
571
555
|
}
|
|
572
556
|
|
|
573
|
-
declare class StateForObjectManager extends
|
|
557
|
+
declare class StateForObjectManager extends KeyedInstanceFactory<unknown, IValueWithKey, IState, IValueKey> implements IStateForObjectManager {
|
|
574
558
|
private readonly _deepClone;
|
|
575
559
|
private readonly releaseContext;
|
|
576
560
|
constructor(_deepClone: IDeepClone, releaseContext: VoidFunction);
|
|
577
561
|
getId(data: IValueKey): unknown;
|
|
578
|
-
set(key: unknown, value: unknown, watched: boolean): void;
|
|
562
|
+
set(key: unknown, value: unknown, watched: boolean, ownerId: unknown): void;
|
|
579
563
|
protected createId(data: IValueKey): unknown;
|
|
580
564
|
private deepClone;
|
|
581
565
|
protected createInstance(data: IValueWithKey): IState;
|
|
582
566
|
protected onReleased(): void;
|
|
583
567
|
}
|
|
584
|
-
declare class ObjectStateManager extends
|
|
568
|
+
declare class ObjectStateManager extends KeyedInstanceFactory<unknown, unknown, IStateForObjectManager> implements IObjectStateManager {
|
|
585
569
|
private readonly _deepClone;
|
|
586
570
|
constructor(_deepClone: IDeepClone);
|
|
587
571
|
getId(object: unknown): unknown;
|
|
588
572
|
isRegistered(context: unknown, key: unknown): boolean;
|
|
589
|
-
replaceState(key: unknown, newContext: unknown, newValue: unknown, oldContext: unknown, watched: boolean): void;
|
|
573
|
+
replaceState(key: unknown, newContext: unknown, newValue: unknown, oldContext: unknown, watched: boolean, ownerId: unknown): void;
|
|
590
574
|
protected createId(object: unknown): unknown;
|
|
591
575
|
protected createInstance(context: unknown): IStateForObjectManager;
|
|
592
576
|
}
|
|
@@ -603,13 +587,13 @@ interface IStateChangeSubscriptionInfo extends IStateChangeSubscriptionIdInfo {
|
|
|
603
587
|
onChanged: (change: IPropertyChange) => void;
|
|
604
588
|
init?: (observer: IObserver) => void;
|
|
605
589
|
}
|
|
606
|
-
type IStateChangeSubscriptionsForContextManager =
|
|
607
|
-
interface IStateChangeSubscriptionManager extends
|
|
590
|
+
type IStateChangeSubscriptionsForContextManager = IGroupedKeyedInstanceFactory<string, IStateChangeSubscriptionInfo, IObserver, IStateChangeSubscriptionIdInfo>;
|
|
591
|
+
interface IStateChangeSubscriptionManager extends IKeyedInstanceFactory<unknown, unknown, IStateChangeSubscriptionsForContextManager> {
|
|
608
592
|
isRegistered(context: unknown, key: unknown): boolean;
|
|
609
593
|
instanceGroupInfoEntriesForContext(context: unknown): IterableIterator<IInstanceGroupInfo<string, IObserver>>;
|
|
610
594
|
}
|
|
611
595
|
|
|
612
|
-
declare class StateChangeSubscriptionManager extends
|
|
596
|
+
declare class StateChangeSubscriptionManager extends KeyedInstanceFactory<unknown, unknown, IStateChangeSubscriptionsForContextManager> implements IStateChangeSubscriptionManager {
|
|
613
597
|
private readonly _objectObserverManager;
|
|
614
598
|
private readonly _errorLog;
|
|
615
599
|
private readonly _guidFactory;
|
|
@@ -632,16 +616,25 @@ interface IStateChange extends IContextChanged {
|
|
|
632
616
|
newValue?: unknown;
|
|
633
617
|
watched?: boolean;
|
|
634
618
|
}
|
|
619
|
+
interface IStateOptions {
|
|
620
|
+
indexWatchRule?: IIndexWatchRule;
|
|
621
|
+
ownerId?: unknown;
|
|
622
|
+
}
|
|
623
|
+
interface IStateEventListener {
|
|
624
|
+
onStateChange: (change: IStateChange) => void;
|
|
625
|
+
onContextChanged: (change: IContextChanged) => void;
|
|
626
|
+
}
|
|
635
627
|
interface IStateManager {
|
|
636
628
|
readonly changed: Observable<IStateChange>;
|
|
637
629
|
readonly contextChanged: Observable<IContextChanged>;
|
|
638
630
|
readonly startChangeCycle: Observable<void>;
|
|
639
631
|
readonly endChangeCycle: Observable<void>;
|
|
640
632
|
isWatched(context: unknown, index: unknown, indexWatchRule?: IIndexWatchRule): boolean;
|
|
641
|
-
watchState(context: unknown, index: unknown,
|
|
633
|
+
watchState(context: unknown, index: unknown, options?: IStateOptions): unknown;
|
|
634
|
+
subscribeStateEvents(context: unknown, index: unknown, listener: IStateEventListener): () => void;
|
|
642
635
|
releaseState(oontext: unknown, index: unknown, indexWatchRule?: IIndexWatchRule): void;
|
|
643
636
|
getState<T>(context: unknown, index: unknown): T;
|
|
644
|
-
setState<T>(context: unknown, index: unknown, value: T): void;
|
|
637
|
+
setState<T>(context: unknown, index: unknown, value: T, ownerId?: unknown): void;
|
|
645
638
|
clear(): void;
|
|
646
639
|
}
|
|
647
640
|
|
|
@@ -655,6 +648,8 @@ declare class StateManager implements IStateManager {
|
|
|
655
648
|
private readonly _endChangeCycle;
|
|
656
649
|
private readonly _stateChangeSubscriptionManager;
|
|
657
650
|
private readonly _pending;
|
|
651
|
+
private readonly _stateEventSubscriptionsByContext;
|
|
652
|
+
private readonly _stateEventSubscriptionPool;
|
|
658
653
|
constructor(objectObserverManager: IObjectPropertyObserverProxyPairManager, _objectStateManager: IObjectStateManager, errorLog: IErrorLog, guidFactory: IGuidFactory, _indexValueAccessor: IIndexValueAccessor, _equalityService: IEqualityService);
|
|
659
654
|
get changed(): Observable<IStateChange>;
|
|
660
655
|
get contextChanged(): Observable<IContextChanged>;
|
|
@@ -662,11 +657,12 @@ declare class StateManager implements IStateManager {
|
|
|
662
657
|
get endChangeCycle(): Observable<void>;
|
|
663
658
|
toString(): string;
|
|
664
659
|
isWatched(context: unknown, index: unknown, indexWatchRule?: IIndexWatchRule): boolean;
|
|
665
|
-
watchState(context: unknown, index: unknown,
|
|
660
|
+
watchState(context: unknown, index: unknown, options?: IStateOptions): unknown;
|
|
661
|
+
subscribeStateEvents(context: unknown, index: unknown, listener: IStateEventListener): () => void;
|
|
666
662
|
releaseState(context: unknown, index: unknown, indexWatchRule?: IIndexWatchRule): void;
|
|
667
663
|
clear(): void;
|
|
668
664
|
getState<T>(context: unknown, index: unknown): T;
|
|
669
|
-
setState<T>(context: unknown, index: unknown, value: T): void;
|
|
665
|
+
setState<T>(context: unknown, index: unknown, value: T, ownerId?: unknown): void;
|
|
670
666
|
private internalSetState;
|
|
671
667
|
private getOldValue;
|
|
672
668
|
private unnsubscribeToObserverEvents;
|
|
@@ -678,11 +674,19 @@ declare class StateManager implements IStateManager {
|
|
|
678
674
|
private tryToSubscribeToChange;
|
|
679
675
|
private getValue;
|
|
680
676
|
private getStateChanges;
|
|
677
|
+
private collectStateChanges;
|
|
681
678
|
private tryRebindingNestedState;
|
|
679
|
+
private addStateEventSubscription;
|
|
680
|
+
private removeStateEventSubscription;
|
|
681
|
+
private emitStateChangeEvents;
|
|
682
|
+
private emitContextChangedEvents;
|
|
683
|
+
private shouldPublish;
|
|
684
|
+
private acquireStateEventSubscription;
|
|
685
|
+
private releaseStateEventSubscription;
|
|
682
686
|
private setInitialValue;
|
|
683
687
|
private getChainChanges;
|
|
684
688
|
private getCurrentValue;
|
|
685
689
|
private onChange;
|
|
686
690
|
}
|
|
687
691
|
|
|
688
|
-
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 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 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
|
|
692
|
+
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 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 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 IndexChangeSubscriptionForContext, IndexChangeSubscriptionManager, IndexObserverProxyPairFactory, IndexWatchRule, 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, defaultObjectObserverProxyPairFactoryList, defaultPropertyObserverProxyPairFactoryList, unloadRsXStateManagerModule, watchIndexRecursiveRule };
|