@rs-x/state-manager 0.4.4
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/LICENSE +21 -0
- package/dist/index.d.ts +683 -0
- package/dist/index.js +3219 -0
- package/package.json +56 -0
- package/readme.md +1765 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,683 @@
|
|
|
1
|
+
import { IDisposable, IPropertyChange, IDisposableOwner, ISingletonFactory, SingletonFactoryWithGuid, IErrorLog, IGuidFactory, IIndexValueAccessor, IArrayIndexAccessor, IMapKeyAccessor, IPropertyValueAccessor, ISetKeyAccessor, SingletonFactory, IEqualityService, DateProperty, IDatePropertyAccessor, IObservableAccessor, IPromiseAccessor, IMultiInjectService, ContainerModule, IDeepClone, ISingletonFactoryWithIdGeneration } from '@rs-x/core';
|
|
2
|
+
import { Observable, Subject, Subscription } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
interface IObserver<T = unknown> extends IDisposable {
|
|
5
|
+
target: T | undefined;
|
|
6
|
+
id?: unknown;
|
|
7
|
+
readonly changed: Observable<IPropertyChange>;
|
|
8
|
+
readonly value: unknown;
|
|
9
|
+
init(): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare abstract class AbstractObserver<TTarget = unknown, TValue = unknown, TId = unknown> implements IObserver<TTarget> {
|
|
13
|
+
private readonly _owner;
|
|
14
|
+
private _target;
|
|
15
|
+
private _value;
|
|
16
|
+
readonly id?: TId | undefined;
|
|
17
|
+
private _isDisposed;
|
|
18
|
+
private readonly _changed;
|
|
19
|
+
protected constructor(_owner: IDisposableOwner | undefined, _target: TTarget, _value: TValue | undefined, changed?: Subject<IPropertyChange>, id?: TId | undefined);
|
|
20
|
+
get value(): TValue | undefined;
|
|
21
|
+
protected set value(value: TValue | undefined);
|
|
22
|
+
get target(): TTarget;
|
|
23
|
+
protected set target(value: TTarget);
|
|
24
|
+
get changed(): Observable<IPropertyChange>;
|
|
25
|
+
init(): void;
|
|
26
|
+
dispose(): void;
|
|
27
|
+
protected get isDisposed(): boolean;
|
|
28
|
+
protected disposeInternal(): void;
|
|
29
|
+
protected emitChange(change: IPropertyChange): void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface ISubscriptionWithData<TSubscriptionData> {
|
|
33
|
+
subscription: Subscription;
|
|
34
|
+
data: TSubscriptionData;
|
|
35
|
+
}
|
|
36
|
+
interface IChangeSubscriptionsCreateMethods {
|
|
37
|
+
onChanged: (change: IPropertyChange) => void;
|
|
38
|
+
init?: (observer: IObserver) => void;
|
|
39
|
+
}
|
|
40
|
+
interface IGroupedChangeSubscriptionsForContextManager<TSubsriptionData, TData, TIdData = TData> extends ISingletonFactory<string, TData, IObserver, TIdData> {
|
|
41
|
+
getSubsriptionData(id: string): TSubsriptionData | undefined;
|
|
42
|
+
}
|
|
43
|
+
declare abstract class GroupedChangeSubscriptionsForContextManager<TSubsriptionData, TData extends TIdData & IChangeSubscriptionsCreateMethods, TIdData = TData> extends SingletonFactoryWithGuid<TData, IObserver> implements IGroupedChangeSubscriptionsForContextManager<TSubsriptionData, TData, TIdData> {
|
|
44
|
+
protected readonly _context: unknown;
|
|
45
|
+
private readonly releaseContext;
|
|
46
|
+
protected readonly _errorLog: IErrorLog;
|
|
47
|
+
private readonly _subscriptions;
|
|
48
|
+
constructor(_context: unknown, releaseContext: () => void, _errorLog: IErrorLog, guidFactory: IGuidFactory);
|
|
49
|
+
getSubsriptionData(id: string): TSubsriptionData | undefined;
|
|
50
|
+
protected createInstance(data: TData, id: string): IObserver;
|
|
51
|
+
protected onInstanceCreated(observer: IObserver<unknown>, data: TData): void;
|
|
52
|
+
protected abstract createObserver(context: unknown, data: TData, id: string): {
|
|
53
|
+
subscriptionData: TSubsriptionData;
|
|
54
|
+
observer: IObserver;
|
|
55
|
+
};
|
|
56
|
+
protected releaseInstance(observer: IObserver, id: string): void;
|
|
57
|
+
protected onReleased(): void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface IObjectChange {
|
|
61
|
+
root: object;
|
|
62
|
+
mutation: IPropertyChange;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface IObserverProxyPair<TProxy = unknown> {
|
|
66
|
+
observer: IObserver;
|
|
67
|
+
proxy?: TProxy;
|
|
68
|
+
proxyTarget?: TProxy;
|
|
69
|
+
}
|
|
70
|
+
type MustProxify = (index: unknown, target?: unknown) => boolean;
|
|
71
|
+
interface IPropertyIdInfo {
|
|
72
|
+
key: unknown;
|
|
73
|
+
mustProxify?: MustProxify;
|
|
74
|
+
}
|
|
75
|
+
interface IPropertyInfo extends IPropertyIdInfo {
|
|
76
|
+
value?: unknown;
|
|
77
|
+
owner?: IDisposableOwner;
|
|
78
|
+
setValue?: (value: unknown) => boolean;
|
|
79
|
+
initializeManually?: boolean;
|
|
80
|
+
}
|
|
81
|
+
type IPropertyObserverProxyPairManager = ISingletonFactory<unknown, IPropertyInfo, IObserverProxyPair, IPropertyIdInfo>;
|
|
82
|
+
type IObjectPropertyObserverProxyPairManager = ISingletonFactory<unknown, unknown, IPropertyObserverProxyPairManager>;
|
|
83
|
+
|
|
84
|
+
declare class ObserverGroup extends AbstractObserver {
|
|
85
|
+
private readonly _errorLog;
|
|
86
|
+
private readonly getRootObserver?;
|
|
87
|
+
private readonly _observeRootObserver?;
|
|
88
|
+
private readonly _subscriptions;
|
|
89
|
+
private _rootChangeSubscription;
|
|
90
|
+
private readonly _observers;
|
|
91
|
+
private readonly mustHandleChange;
|
|
92
|
+
private _rootObserver;
|
|
93
|
+
private _isInitialized;
|
|
94
|
+
protected _parent: ObserverGroup | undefined;
|
|
95
|
+
constructor(owner: IDisposableOwner | undefined, target: unknown, initialValue: unknown, mustHandleChange: ((change: IPropertyChange) => boolean) | undefined, _errorLog: IErrorLog, id?: unknown, getRootObserver?: (() => IObserver | undefined) | undefined, _observeRootObserver?: boolean | undefined);
|
|
96
|
+
get rootObserver(): IObserver | undefined;
|
|
97
|
+
init(): void;
|
|
98
|
+
addObservers(observers: IObserver[]): ObserverGroup;
|
|
99
|
+
replaceObservers(observers: IObserver[]): void;
|
|
100
|
+
emitValue(newValue: unknown): void;
|
|
101
|
+
removeObserver(target: unknown, id: unknown): void;
|
|
102
|
+
protected disposeInternal(): void;
|
|
103
|
+
protected emitChange: (change: IPropertyChange) => void;
|
|
104
|
+
private unsubscribeToObservers;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
interface IProxyTarget<TTarget> {
|
|
108
|
+
initializeManually?: boolean;
|
|
109
|
+
target: TTarget;
|
|
110
|
+
mustProxify?: MustProxify;
|
|
111
|
+
}
|
|
112
|
+
type IObjectObserverProxyPairManager<TTarget = unknown> = ISingletonFactory<unknown, IProxyTarget<TTarget>, IObserverProxyPair<TTarget>>;
|
|
113
|
+
|
|
114
|
+
interface IObjectObserverProxyPairFactory<TTarget = unknown> {
|
|
115
|
+
readonly priority: number;
|
|
116
|
+
create(owner: IDisposableOwner, proxyTarget: IProxyTarget<TTarget>): IObserverProxyPair<TTarget>;
|
|
117
|
+
applies(object: unknown): boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
declare abstract class AbstractObjectObserverProxyPairFactory<TTarget, TData extends IProxyTarget<TTarget> = IProxyTarget<TTarget>> implements IObjectObserverProxyPairFactory<TTarget> {
|
|
121
|
+
readonly priority: number;
|
|
122
|
+
private readonly _observerRootObserver;
|
|
123
|
+
protected readonly _errorLog: IErrorLog;
|
|
124
|
+
protected readonly _indexAccessor: IIndexValueAccessor;
|
|
125
|
+
protected readonly _objectPropertyObserverProxyPairManager: IObjectPropertyObserverProxyPairManager;
|
|
126
|
+
protected constructor(priority: number, _observerRootObserver: boolean, _errorLog: IErrorLog, _indexAccessor: IIndexValueAccessor, _objectPropertyObserverProxyPairManager: IObjectPropertyObserverProxyPairManager);
|
|
127
|
+
abstract applies(object: object): boolean;
|
|
128
|
+
create(owner: IDisposableOwner, data: TData): IObserverProxyPair<TTarget>;
|
|
129
|
+
protected createDisposableOwner(owner: IDisposableOwner, _data: TData): IDisposableOwner;
|
|
130
|
+
protected abstract createRootObserver(data: TData): IObserverProxyPair<TTarget> | undefined;
|
|
131
|
+
protected onObserverGroupCreate(target: TTarget, observerGroup: ObserverGroup, mustProxify: MustProxify | undefined): void;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
interface IArrayProxyIdData {
|
|
135
|
+
array: unknown[];
|
|
136
|
+
}
|
|
137
|
+
interface IArrayProxyData extends IArrayProxyIdData {
|
|
138
|
+
owner?: IDisposableOwner;
|
|
139
|
+
}
|
|
140
|
+
type IArrayObserverProxyPair = IObserverProxyPair<unknown[]>;
|
|
141
|
+
type IArrayProxyFactory = ISingletonFactory<unknown, IArrayProxyData, IArrayObserverProxyPair, IArrayProxyIdData>;
|
|
142
|
+
|
|
143
|
+
type IArrayObserverProxyPairFactory = IObjectObserverProxyPairFactory<unknown[]>;
|
|
144
|
+
|
|
145
|
+
declare class ArrayObserverProxyPairFactory extends AbstractObjectObserverProxyPairFactory<unknown[]> implements IArrayObserverProxyPairFactory {
|
|
146
|
+
private readonly _arrayProxyFactory;
|
|
147
|
+
constructor(_arrayProxyFactory: IArrayProxyFactory, errorLog: IErrorLog, arrayIndexAccessor: IArrayIndexAccessor, objectPropertyObserverProxyPairManager: IObjectPropertyObserverProxyPairManager);
|
|
148
|
+
applies(object: unknown): boolean;
|
|
149
|
+
protected createRootObserver(data: IProxyTarget<unknown[]>): IArrayObserverProxyPair;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
interface IDateProxyIdData {
|
|
153
|
+
date: Date;
|
|
154
|
+
mustProxify?: MustProxify;
|
|
155
|
+
}
|
|
156
|
+
interface IDateProxyData extends IDateProxyIdData {
|
|
157
|
+
owner?: IDisposableOwner;
|
|
158
|
+
}
|
|
159
|
+
type IDateObserverProxyPair = IObserverProxyPair<Date>;
|
|
160
|
+
type IDateProxyFactory = ISingletonFactory<string, IDateProxyData, IDateObserverProxyPair>;
|
|
161
|
+
|
|
162
|
+
type IDateOserverProxyPair = IObserverProxyPair<Date>;
|
|
163
|
+
type IDateObserverProxyPairFactory = IObjectObserverProxyPairFactory<Date>;
|
|
164
|
+
|
|
165
|
+
declare class DateObserverProxyPairFactory implements IDateObserverProxyPairFactory {
|
|
166
|
+
private readonly _dateProxyFactory;
|
|
167
|
+
readonly priority = 6;
|
|
168
|
+
constructor(_dateProxyFactory: IDateProxyFactory);
|
|
169
|
+
create(owner: IDisposableOwner, proxyTarget: IProxyTarget<Date>): IDateOserverProxyPair;
|
|
170
|
+
applies(object: object): boolean;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
interface IMapProxifyIdData {
|
|
174
|
+
map: Map<unknown, unknown>;
|
|
175
|
+
}
|
|
176
|
+
interface IMapProxifyData extends IMapProxifyIdData {
|
|
177
|
+
owner?: IDisposableOwner;
|
|
178
|
+
}
|
|
179
|
+
type IMapObserverProxyPair = IObserverProxyPair<Map<unknown, unknown>>;
|
|
180
|
+
type IMapProxyFactory = ISingletonFactory<Map<unknown, unknown>, IMapProxifyData, IMapObserverProxyPair>;
|
|
181
|
+
|
|
182
|
+
type IMapObserverProxyPairFactory = IObjectObserverProxyPairFactory<Map<unknown, unknown>>;
|
|
183
|
+
|
|
184
|
+
declare class MapObserverProxyPairFactory extends AbstractObjectObserverProxyPairFactory<Map<unknown, unknown>> implements IMapObserverProxyPairFactory {
|
|
185
|
+
private readonly _mapProxyFactory;
|
|
186
|
+
constructor(_mapProxyFactory: IMapProxyFactory, errorLog: IErrorLog, mapKeyAccessor: IMapKeyAccessor, objectPropertyObserverProxyPairManager: IObjectPropertyObserverProxyPairManager);
|
|
187
|
+
applies(object: unknown): boolean;
|
|
188
|
+
protected createRootObserver(data: IProxyTarget<Map<unknown, unknown>>): IMapObserverProxyPair;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
interface IObservableProxyData {
|
|
192
|
+
owner?: IDisposableOwner;
|
|
193
|
+
observable: Observable<unknown>;
|
|
194
|
+
}
|
|
195
|
+
type IObservableObserverProxyPair = IObserverProxyPair<Observable<unknown>>;
|
|
196
|
+
type IObservableProxyFactory = ISingletonFactory<Observable<unknown>, IObservableProxyData, IObservableObserverProxyPair>;
|
|
197
|
+
|
|
198
|
+
declare class ObservableObserverProxyPairFactory implements IObjectObserverProxyPairFactory<Observable<unknown>> {
|
|
199
|
+
private readonly _observableProxyFactory;
|
|
200
|
+
readonly priority = 3;
|
|
201
|
+
constructor(_observableProxyFactory: IObservableProxyFactory);
|
|
202
|
+
create(owner: IDisposableOwner, objectObserverInfo: IProxyTarget<Observable<unknown>>): IObservableObserverProxyPair;
|
|
203
|
+
applies(object: unknown): boolean;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
type IPlainObjectObserverProxyPairFactory = IObjectObserverProxyPairFactory<Record<string, unknown>>;
|
|
207
|
+
|
|
208
|
+
declare class PlainObjectObserverProxyPairFactory extends AbstractObjectObserverProxyPairFactory<Record<string, unknown>> implements IPlainObjectObserverProxyPairFactory {
|
|
209
|
+
constructor(errorLog: IErrorLog, propertyValueAccessor: IPropertyValueAccessor, objectPropertyObserverProxyPairManager: IObjectPropertyObserverProxyPairManager);
|
|
210
|
+
applies(object: object): boolean;
|
|
211
|
+
protected createRootObserver(data: IProxyTarget<Record<string, unknown>>): IObserverProxyPair<Record<string, unknown>> | undefined;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
interface IPromiseProxyData {
|
|
215
|
+
owner?: IDisposableOwner;
|
|
216
|
+
promise: Promise<unknown>;
|
|
217
|
+
}
|
|
218
|
+
type IPromiseObserverProxyPair = IObserverProxyPair<Promise<unknown>>;
|
|
219
|
+
type IPromiseProxyFactory = ISingletonFactory<Promise<unknown>, IPromiseProxyData, IPromiseObserverProxyPair>;
|
|
220
|
+
|
|
221
|
+
declare class PromiseObserverProxyPairFactory implements IObjectObserverProxyPairFactory<Promise<unknown>> {
|
|
222
|
+
private readonly _promiseProxyFactory;
|
|
223
|
+
readonly priority = 4;
|
|
224
|
+
constructor(_promiseProxyFactory: IPromiseProxyFactory);
|
|
225
|
+
create(owner: IDisposableOwner, proxyTarget: IProxyTarget<Promise<unknown>>): IPromiseObserverProxyPair;
|
|
226
|
+
applies(object: unknown): boolean;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
interface ISetProxifyIdData {
|
|
230
|
+
set: Set<unknown>;
|
|
231
|
+
}
|
|
232
|
+
interface ISetProxifyData extends ISetProxifyIdData {
|
|
233
|
+
owner?: IDisposableOwner;
|
|
234
|
+
}
|
|
235
|
+
type ISetObserverProxyPair = IObserverProxyPair<Set<unknown>>;
|
|
236
|
+
type ISetProxyFactory = ISingletonFactory<Set<unknown>, ISetProxifyData, ISetObserverProxyPair, ISetProxifyIdData>;
|
|
237
|
+
|
|
238
|
+
type ISetObserverProxyPairFactory = IObjectObserverProxyPairFactory<Set<unknown>>;
|
|
239
|
+
|
|
240
|
+
declare class SetObserverProxyPairFactory extends AbstractObjectObserverProxyPairFactory<Set<unknown>> implements ISetObserverProxyPairFactory {
|
|
241
|
+
private readonly _setProxyFactory;
|
|
242
|
+
constructor(_setProxyFactory: ISetProxyFactory, errorLog: IErrorLog, setKeyAccessor: ISetKeyAccessor, objectPropertyObserverProxyPairManager: IObjectPropertyObserverProxyPairManager);
|
|
243
|
+
applies(object: unknown): boolean;
|
|
244
|
+
protected createRootObserver(data: IProxyTarget<Set<unknown>>): ISetObserverProxyPair;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
interface IObjectObserverProxyPairFactoryProvider {
|
|
248
|
+
factories: readonly IObjectObserverProxyPairFactory[];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
declare class ObjectObserverProxyPairFactoryProvider implements IObjectObserverProxyPairFactoryProvider {
|
|
252
|
+
readonly factories: readonly IObjectObserverProxyPairFactory[];
|
|
253
|
+
constructor(factories: readonly IObjectObserverProxyPairFactory[]);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
interface IProxyRegistry {
|
|
257
|
+
getProxyTarget<T>(proxyToFind: unknown): T;
|
|
258
|
+
getProxy<T>(proxyTarget: unknown): T;
|
|
259
|
+
register(proxyTarget: unknown, proxy: unknown): void;
|
|
260
|
+
unregister(proxyTarget: unknown): void;
|
|
261
|
+
isProxy(object: unknown): boolean;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
declare class ObjectObserverProxyPairManager extends SingletonFactoryWithGuid<IProxyTarget<unknown>, IObserverProxyPair> implements IObjectObserverProxyPairManager {
|
|
265
|
+
private readonly getObserverFactoryProvider;
|
|
266
|
+
private readonly _proxyRegistry;
|
|
267
|
+
constructor(getObserverFactoryProvider: () => IObjectObserverProxyPairFactoryProvider, _proxyRegistry: IProxyRegistry, guidFactory: IGuidFactory);
|
|
268
|
+
protected getGroupId(data: IProxyTarget<unknown>): unknown;
|
|
269
|
+
protected getGroupMemberId(data: IProxyTarget<unknown>): unknown;
|
|
270
|
+
create(data: IProxyTarget<unknown>): {
|
|
271
|
+
referenceCount: number;
|
|
272
|
+
instance: IObserverProxyPair<unknown>;
|
|
273
|
+
id: string;
|
|
274
|
+
};
|
|
275
|
+
protected createInstance(objectObserverInfo: IProxyTarget<unknown>, id: string): IObserverProxyPair;
|
|
276
|
+
protected releaseInstance(observerProxyPair: IObserverProxyPair): void;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
interface IIndexObserverProxyPairFactory<TProxy = unknown> extends IDisposable {
|
|
280
|
+
create(owner: IDisposableOwner, object: unknown, data: IPropertyInfo): IObserverProxyPair<TProxy>;
|
|
281
|
+
applies(object: unknown, propertyInfo: IPropertyInfo): boolean;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
declare class ObjectPropertyObserverProxyPairManager extends SingletonFactory<unknown, unknown, IPropertyObserverProxyPairManager> implements IObjectPropertyObserverProxyPairManager {
|
|
285
|
+
private readonly _factories;
|
|
286
|
+
private readonly _guidFactory;
|
|
287
|
+
constructor(_factories: IIndexObserverProxyPairFactory[], _guidFactory: IGuidFactory);
|
|
288
|
+
getId(context: unknown): unknown;
|
|
289
|
+
protected createId(context: unknown): unknown;
|
|
290
|
+
protected createInstance(context: unknown): IPropertyObserverProxyPairManager;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
interface IIndexObserverIdInfo<TIndex = unknown> {
|
|
294
|
+
index: TIndex;
|
|
295
|
+
}
|
|
296
|
+
interface IIndexObserverInfo<TIndex = unknown> extends IIndexObserverIdInfo<TIndex> {
|
|
297
|
+
initialValue?: unknown;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
type Collection = Map<unknown, unknown> | Array<unknown> | Set<unknown>;
|
|
301
|
+
type ICollectionIdexObserverIdInfo = IIndexObserverIdInfo<unknown>;
|
|
302
|
+
type ICollectionIndexObserverManager = ISingletonFactory<unknown, IIndexObserverInfo, IObserver>;
|
|
303
|
+
type ICollectionItemObserverManager = ISingletonFactory<Collection, Collection, ICollectionIndexObserverManager>;
|
|
304
|
+
|
|
305
|
+
declare class CollectionItemObserverManager extends SingletonFactory<Collection, Collection, ICollectionIndexObserverManager> implements ICollectionItemObserverManager {
|
|
306
|
+
private readonly _errorLog;
|
|
307
|
+
private readonly _equalityService;
|
|
308
|
+
private readonly _indexValueAccessor;
|
|
309
|
+
private readonly _objectObserverProxyPairManager;
|
|
310
|
+
constructor(_errorLog: IErrorLog, _equalityService: IEqualityService, _indexValueAccessor: IIndexValueAccessor, _objectObserverProxyPairManager: IObjectObserverProxyPairManager);
|
|
311
|
+
getId(collection: Collection): Collection;
|
|
312
|
+
protected createId(collection: Collection): Collection;
|
|
313
|
+
protected createInstance(collection: Collection): ICollectionIndexObserverManager;
|
|
314
|
+
protected releaseInstance(collectionIndexObserverManager: ICollectionIndexObserverManager): void;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
interface ISubscriptionIdInfo<TIndex> {
|
|
318
|
+
index: TIndex;
|
|
319
|
+
mustProxify?: MustProxify;
|
|
320
|
+
}
|
|
321
|
+
interface ISubscriptionInfo<TIndex> extends ISubscriptionIdInfo<TIndex>, IChangeSubscriptionsCreateMethods {
|
|
322
|
+
initialValue?: unknown;
|
|
323
|
+
indexValueObserver?: IObserver;
|
|
324
|
+
owner: IDisposableOwner;
|
|
325
|
+
initializeManually?: boolean;
|
|
326
|
+
mustHandleChange?: (change: IPropertyChange) => boolean;
|
|
327
|
+
}
|
|
328
|
+
interface IndexChangeSubscriptionForContext<TIndex> {
|
|
329
|
+
context: unknown;
|
|
330
|
+
index: TIndex;
|
|
331
|
+
}
|
|
332
|
+
type IIndexSetObserverManager<TIndex> = ISingletonFactory<unknown, unknown, ISingletonFactory<MustProxify | TIndex, IIndexObserverInfo<TIndex>, IObserver, ISubscriptionIdInfo<TIndex>>>;
|
|
333
|
+
type IIndexChangeSubscriptionsForContextManager<TIndex> = IGroupedChangeSubscriptionsForContextManager<ObserverGroup, ISubscriptionInfo<TIndex>, ISubscriptionIdInfo<TIndex>>;
|
|
334
|
+
declare class IndexChangeSubscriptionManager<TIndex> extends SingletonFactory<unknown, unknown, IIndexChangeSubscriptionsForContextManager<TIndex>> {
|
|
335
|
+
private readonly _indexSetObserverManager;
|
|
336
|
+
private readonly _errorLog;
|
|
337
|
+
private readonly _guidFactory;
|
|
338
|
+
constructor(_indexSetObserverManager: IIndexSetObserverManager<unknown>, _errorLog: IErrorLog, _guidFactory: IGuidFactory);
|
|
339
|
+
getId(context: unknown): unknown;
|
|
340
|
+
protected createId(context: unknown): unknown;
|
|
341
|
+
protected createInstance(context: unknown): IIndexChangeSubscriptionsForContextManager<TIndex>;
|
|
342
|
+
protected releaseInstance(instance: IIndexChangeSubscriptionsForContextManager<TIndex>, id: string): void;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
declare abstract class IndexObserverProxyPairFactory<TContext, TIndex> implements IIndexObserverProxyPairFactory<TContext> {
|
|
346
|
+
private readonly _objectObserveryManager;
|
|
347
|
+
protected readonly _indexValueAccessor: IIndexValueAccessor;
|
|
348
|
+
private readonly _proxyRegister;
|
|
349
|
+
private readonly mustHandleChange?;
|
|
350
|
+
private readonly _indexChangeSubscriptionManager;
|
|
351
|
+
protected constructor(_objectObserveryManager: IObjectObserverProxyPairManager, indexSetObserverManager: IIndexSetObserverManager<TIndex>, errorLog: IErrorLog, guidFactory: IGuidFactory, _indexValueAccessor: IIndexValueAccessor, _proxyRegister: IProxyRegistry, mustHandleChange?: ((change: IPropertyChange) => boolean) | undefined);
|
|
352
|
+
dispose(): void;
|
|
353
|
+
abstract applies(object: unknown, propertyInfo: IPropertyInfo): boolean;
|
|
354
|
+
create(owner: IDisposableOwner, object: TContext, propertyInfo: IPropertyInfo): IObserverProxyPair<TContext>;
|
|
355
|
+
private getMustProxifyHandler;
|
|
356
|
+
private createIndexValueProxy;
|
|
357
|
+
private createGroupObserver;
|
|
358
|
+
private onIndexSet;
|
|
359
|
+
private getNestedObservers;
|
|
360
|
+
private proxifyIndexValue;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
declare class CollectionItemObserverProxyPairFactory extends IndexObserverProxyPairFactory<Collection, unknown> {
|
|
364
|
+
constructor(objectObserverManager: IObjectObserverProxyPairManager, collectionItemObserverManager: ICollectionItemObserverManager, errorLog: IErrorLog, guidFactory: IGuidFactory, indexValueAccessor: IIndexValueAccessor, proxyRegister: IProxyRegistry);
|
|
365
|
+
applies(object: unknown): boolean;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
type ICollectionItemObserverProxyPairFactory = IIndexObserverProxyPairFactory<Collection>;
|
|
369
|
+
|
|
370
|
+
type IMustProxifyItemHandlerFactory = ISingletonFactory<unknown, unknown, MustProxify>;
|
|
371
|
+
|
|
372
|
+
type IDatePropertyObserverIdInfo = IIndexObserverIdInfo<DateProperty>;
|
|
373
|
+
type IDatePropertyObserverInfo = IIndexObserverInfo<DateProperty>;
|
|
374
|
+
type IProperForDataObserverManager = ISingletonFactory<DateProperty, IDatePropertyObserverInfo, IObserver>;
|
|
375
|
+
type IDatePropertyObserverManager = ISingletonFactory<Date, Date, IProperForDataObserverManager>;
|
|
376
|
+
|
|
377
|
+
declare class DatePropertyObserverManager extends SingletonFactory<Date, Date, IProperForDataObserverManager> implements IDatePropertyObserverManager {
|
|
378
|
+
private readonly _dateProxyFactory;
|
|
379
|
+
private readonly _errorLog;
|
|
380
|
+
private readonly _datePropertyAccessor;
|
|
381
|
+
private readonly _mustProxifyItemHandlerFactory;
|
|
382
|
+
constructor(_dateProxyFactory: IDateProxyFactory, _errorLog: IErrorLog, _datePropertyAccessor: IDatePropertyAccessor, _mustProxifyItemHandlerFactory: IMustProxifyItemHandlerFactory);
|
|
383
|
+
getId(date: Date): Date;
|
|
384
|
+
createId(date: Date): Date;
|
|
385
|
+
protected createInstance(date: Date): IProperForDataObserverManager;
|
|
386
|
+
protected releaseInstance(properForDataObserverManager: IProperForDataObserverManager): void;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
type IDatePropertyObserverProxyPairFactory = IIndexObserverProxyPairFactory<Date>;
|
|
390
|
+
|
|
391
|
+
declare class DatePropertyObserverProxyPairFactory extends IndexObserverProxyPairFactory<Date, DateProperty> implements IDatePropertyObserverProxyPairFactory {
|
|
392
|
+
constructor(objectObserverManager: IObjectObserverProxyPairManager, datePropertyObserverManager: IDatePropertyObserverManager, errorLog: IErrorLog, guidFactory: IGuidFactory, datePropertyAccessor: IIndexValueAccessor, proxyRegister: IProxyRegistry);
|
|
393
|
+
applies(object: unknown): boolean;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
type IPropertyObserverIdInfo = IIndexObserverIdInfo<string>;
|
|
397
|
+
type IPropertyObserverInfo = IIndexObserverInfo<string>;
|
|
398
|
+
type IPropertyObserverManager = ISingletonFactory<string, IPropertyObserverInfo, IObserver>;
|
|
399
|
+
type IObjectPropertyObserverManager = ISingletonFactory<object, object, IPropertyObserverManager>;
|
|
400
|
+
|
|
401
|
+
declare class NonIterableObjectPropertyObserverProxyPairFactory extends IndexObserverProxyPairFactory<object, string> {
|
|
402
|
+
constructor(objectObserveryManager: IObjectObserverProxyPairManager, objectPropertyObserverManager: IObjectPropertyObserverManager, errorLog: IErrorLog, guidFactory: IGuidFactory, indexValueAccessor: IIndexValueAccessor, proxyRegister: IProxyRegistry);
|
|
403
|
+
applies(object: unknown, propertyInfo: IPropertyInfo): boolean;
|
|
404
|
+
protected setIndexValue(object: Record<string, unknown>, key: string, value: unknown): void;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
declare class ObjectPropertyObserverManager extends SingletonFactory<object, object, IPropertyObserverManager> implements IObjectPropertyObserverManager {
|
|
408
|
+
private readonly _proxyRegister;
|
|
409
|
+
constructor(_proxyRegister: IProxyRegistry);
|
|
410
|
+
getId(context: object): object;
|
|
411
|
+
protected createId(context: object): object;
|
|
412
|
+
protected createInstance(context: object): IPropertyObserverManager;
|
|
413
|
+
protected releaseInstance(propertyObserverManager: IPropertyObserverManager): void;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
declare class MustProxifyItemHandlerFactory extends SingletonFactory<unknown, unknown, MustProxify> implements IMustProxifyItemHandlerFactory {
|
|
417
|
+
constructor();
|
|
418
|
+
getId(index: unknown): unknown;
|
|
419
|
+
protected createInstance(_: unknown, id: unknown): MustProxify;
|
|
420
|
+
protected createId(index: unknown): unknown;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
declare class ArrayProxyFactory extends SingletonFactory<unknown[], IArrayProxyData, IArrayObserverProxyPair, IArrayProxyIdData> implements IArrayProxyFactory {
|
|
424
|
+
private readonly _proxyRegistry;
|
|
425
|
+
constructor(_proxyRegistry: IProxyRegistry);
|
|
426
|
+
getId(data: IArrayProxyIdData): unknown[];
|
|
427
|
+
protected createId(data: IArrayProxyIdData): unknown[];
|
|
428
|
+
protected createInstance(data: IArrayProxyData, id: unknown[]): IArrayObserverProxyPair;
|
|
429
|
+
protected releaseInstance(arrayObserverWithProxy: IArrayObserverProxyPair, id: unknown[]): void;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
declare class DateProxyFactory extends SingletonFactoryWithGuid<IDateProxyData, IDateObserverProxyPair, IDateProxyIdData> implements IDateProxyFactory {
|
|
433
|
+
private readonly _proxyRegistry;
|
|
434
|
+
constructor(guidFactory: IGuidFactory, _proxyRegistry: IProxyRegistry);
|
|
435
|
+
protected getGroupId(data: IDateProxyIdData): Date;
|
|
436
|
+
protected getGroupMemberId(data: IDateProxyIdData): MustProxify | undefined;
|
|
437
|
+
protected createInstance(dateProxyData: IDateProxyData, id: string): IDateObserverProxyPair;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
declare class MapProxy extends AbstractObserver<Map<unknown, unknown>, Map<unknown, unknown>, undefined> {
|
|
441
|
+
private readonly _proxyRegistry;
|
|
442
|
+
private readonly updateMap;
|
|
443
|
+
constructor(owner: IDisposableOwner, map: Map<unknown, unknown>, _proxyRegistry: IProxyRegistry);
|
|
444
|
+
get(originalMap: Map<unknown, unknown>, property: PropertyKey): unknown;
|
|
445
|
+
protected disposeInternal(): void;
|
|
446
|
+
private isUpdateMapKey;
|
|
447
|
+
private clearMap;
|
|
448
|
+
private setMap;
|
|
449
|
+
private deleteMap;
|
|
450
|
+
private deleteItem;
|
|
451
|
+
private emitSet;
|
|
452
|
+
}
|
|
453
|
+
declare class MapProxyFactory extends SingletonFactory<Map<unknown, unknown>, IMapProxifyData, IMapObserverProxyPair> implements IMapProxyFactory {
|
|
454
|
+
private readonly _proxyRegistry;
|
|
455
|
+
constructor(_proxyRegistry: IProxyRegistry);
|
|
456
|
+
getId(data: IMapProxifyData): Map<unknown, unknown>;
|
|
457
|
+
protected createId(data: IMapProxifyData): Map<unknown, unknown>;
|
|
458
|
+
protected createInstance(data: IMapProxifyData, id: Map<unknown, unknown>): IMapObserverProxyPair;
|
|
459
|
+
protected releaseInstance(mapObserverWithProxy: IMapObserverProxyPair): void;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
declare class ObservableProxyFactory extends SingletonFactory<Observable<unknown>, IObservableProxyData, IObservableObserverProxyPair> implements IObservableProxyFactory {
|
|
463
|
+
private readonly _observableAccessor;
|
|
464
|
+
constructor(_observableAccessor: IObservableAccessor);
|
|
465
|
+
getId(data: IObservableProxyData): Observable<unknown>;
|
|
466
|
+
protected createId(data: IObservableProxyData): Observable<unknown>;
|
|
467
|
+
protected createInstance(data: IObservableProxyData, id: Observable<unknown>): IObservableObserverProxyPair;
|
|
468
|
+
protected releaseInstance(observableObserverWithProxy: IObservableObserverProxyPair): void;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
declare class PromiseProxyFactory extends SingletonFactory<Promise<unknown>, IPromiseProxyData, IPromiseObserverProxyPair> implements IPromiseProxyFactory {
|
|
472
|
+
private readonly _promiseAccessor;
|
|
473
|
+
constructor(_promiseAccessor: IPromiseAccessor);
|
|
474
|
+
getId(data: IPromiseProxyData): Promise<unknown>;
|
|
475
|
+
protected createId(data: IPromiseProxyData): Promise<unknown>;
|
|
476
|
+
protected createInstance(data: IPromiseProxyData, id: Promise<unknown>): IPromiseObserverProxyPair;
|
|
477
|
+
protected releaseInstance(promiseObserverWithProxy: IPromiseObserverProxyPair): void;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
declare class ProxyRegistry implements IProxyRegistry {
|
|
481
|
+
private readonly _proxies;
|
|
482
|
+
getProxyTarget<T>(proxyToFind: unknown): T;
|
|
483
|
+
getProxy<T>(proxyTarget: unknown): T;
|
|
484
|
+
register(proxyTarget: unknown, proxy: unknown): void;
|
|
485
|
+
unregister(proxyTarget: unknown): void;
|
|
486
|
+
isProxy(object: unknown): boolean;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
declare class SetProxy extends AbstractObserver<Set<unknown>, Set<unknown>, undefined> {
|
|
490
|
+
private readonly _proxyRegistry;
|
|
491
|
+
private readonly updateSet;
|
|
492
|
+
constructor(owner: IDisposableOwner, initialValue: Set<unknown>, _proxyRegistry: IProxyRegistry);
|
|
493
|
+
get(originalSet: Set<unknown>, property: PropertyKey): unknown;
|
|
494
|
+
protected disposeInternal(): void;
|
|
495
|
+
private clearSet;
|
|
496
|
+
private addSet;
|
|
497
|
+
private deleteSet;
|
|
498
|
+
private hasSet;
|
|
499
|
+
private emitValueChange;
|
|
500
|
+
}
|
|
501
|
+
declare class SetProxyFactory extends SingletonFactory<Set<unknown>, ISetProxifyData, ISetObserverProxyPair, ISetProxifyIdData> implements ISetProxyFactory {
|
|
502
|
+
private readonly _proxyRegistry;
|
|
503
|
+
constructor(_proxyRegistry: IProxyRegistry);
|
|
504
|
+
getId(data: ISetProxifyIdData): Set<unknown>;
|
|
505
|
+
protected createId(data: ISetProxifyIdData): Set<unknown>;
|
|
506
|
+
protected createInstance(data: ISetProxifyData, id: Set<unknown>): ISetObserverProxyPair;
|
|
507
|
+
protected releaseInstance(setObserverWithProxy: ISetObserverProxyPair): void;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
declare const RsXStateManagerInjectionTokens: {
|
|
511
|
+
IArrayProxyFactory: symbol;
|
|
512
|
+
IMapProxyFactory: symbol;
|
|
513
|
+
ISetProxyFactory: symbol;
|
|
514
|
+
IDateProxyFactory: symbol;
|
|
515
|
+
IProxyRegistry: symbol;
|
|
516
|
+
IPromiseProxyFactory: symbol;
|
|
517
|
+
IObservableProxyFactory: symbol;
|
|
518
|
+
IObjectPropertyObserverProxyPairManager: symbol;
|
|
519
|
+
IPlainObjectObserverProxyPairFactory: symbol;
|
|
520
|
+
IDateObserverProxyPairFactory: symbol;
|
|
521
|
+
IArrayObserverProxyPairFactory: symbol;
|
|
522
|
+
PromiseObserverProxyPairFactory: symbol;
|
|
523
|
+
ObservableObserverProxyPairFactory: symbol;
|
|
524
|
+
IMapObserverProxyPairFactory: symbol;
|
|
525
|
+
ISetObserverProxyPairFactory: symbol;
|
|
526
|
+
IDatePropertyObserverProxyPairFactory: symbol;
|
|
527
|
+
IObjectObserverProxyPairFactoryList: symbol;
|
|
528
|
+
IObjectObserverProxyPairFactoryProvider: symbol;
|
|
529
|
+
IObjectObserverProxyPairManager: symbol;
|
|
530
|
+
IObjectPropertyObserverManager: symbol;
|
|
531
|
+
ICollectionItemObserverManager: symbol;
|
|
532
|
+
ISetItemObserverManager: symbol;
|
|
533
|
+
IDatePropertyObserverManager: symbol;
|
|
534
|
+
IPropertyObserverProxyPairFactoryList: symbol;
|
|
535
|
+
NonIterableObjectPropertyObserverProxyPairFactory: symbol;
|
|
536
|
+
ICollectionItemObserverProxyPairFactory: symbol;
|
|
537
|
+
IMustProxifyItemHandlerFactory: symbol;
|
|
538
|
+
IObjectStateManager: symbol;
|
|
539
|
+
IPropertyObserverProxyPairFactoryProvider: symbol;
|
|
540
|
+
IPropertyObserverProxyPairFactoryProviderFactory: symbol;
|
|
541
|
+
IObjectObserverProxyPairFactoryProviderFactory: symbol;
|
|
542
|
+
IStateManager: symbol;
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
declare const defaultObjectObserverProxyPairFactoryList: readonly IMultiInjectService[];
|
|
546
|
+
declare const defaultPropertyObserverProxyPairFactoryList: readonly IMultiInjectService[];
|
|
547
|
+
declare const RsXStateManagerModule: ContainerModule;
|
|
548
|
+
declare function unloadRsXStateManagerModule(): Promise<void>;
|
|
549
|
+
|
|
550
|
+
interface IState {
|
|
551
|
+
value: unknown;
|
|
552
|
+
valueCopy: unknown;
|
|
553
|
+
watched: boolean;
|
|
554
|
+
}
|
|
555
|
+
interface IValueKey {
|
|
556
|
+
key: unknown;
|
|
557
|
+
}
|
|
558
|
+
interface IValueWithKey extends IValueKey {
|
|
559
|
+
value: unknown;
|
|
560
|
+
watched: boolean;
|
|
561
|
+
}
|
|
562
|
+
interface IStateForObjectManager extends ISingletonFactory<unknown, IValueWithKey, IState, IValueKey> {
|
|
563
|
+
set(key: unknown, value: unknown, watched: boolean): void;
|
|
564
|
+
}
|
|
565
|
+
interface IObjectStateManager extends ISingletonFactory<unknown, unknown, IStateForObjectManager> {
|
|
566
|
+
replaceState(key: unknown, newContext: unknown, newValue: unknown, oldContext: unknown, watched: boolean): void;
|
|
567
|
+
isRegistered(context: unknown, key: unknown): boolean;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
declare class StateForObjectManager extends SingletonFactory<unknown, IValueWithKey, IState, IValueKey> implements IStateForObjectManager {
|
|
571
|
+
private readonly _deepClone;
|
|
572
|
+
private readonly releaseContext;
|
|
573
|
+
constructor(_deepClone: IDeepClone, releaseContext: VoidFunction);
|
|
574
|
+
getId(data: IValueKey): unknown;
|
|
575
|
+
set(key: unknown, value: unknown, watched: boolean): void;
|
|
576
|
+
protected createId(data: IValueKey): unknown;
|
|
577
|
+
private deepClone;
|
|
578
|
+
protected createInstance(data: IValueWithKey): IState;
|
|
579
|
+
protected onReleased(): void;
|
|
580
|
+
}
|
|
581
|
+
declare class ObjectStateManager extends SingletonFactory<unknown, unknown, IStateForObjectManager> implements IObjectStateManager {
|
|
582
|
+
private readonly _deepClone;
|
|
583
|
+
constructor(_deepClone: IDeepClone);
|
|
584
|
+
getId(object: unknown): unknown;
|
|
585
|
+
isRegistered(context: unknown, key: unknown): boolean;
|
|
586
|
+
replaceState(key: unknown, newContext: unknown, newValue: unknown, oldContext: unknown, watched: boolean): void;
|
|
587
|
+
protected createId(object: unknown): unknown;
|
|
588
|
+
protected createInstance(context: unknown): IStateForObjectManager;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
interface IStateChangeObserverInfo {
|
|
592
|
+
readonly observer: IObserver;
|
|
593
|
+
readonly subscription: Subscription;
|
|
594
|
+
}
|
|
595
|
+
interface IStateChangeSubscriptionIdInfo {
|
|
596
|
+
key: unknown;
|
|
597
|
+
mustProxify?: MustProxify;
|
|
598
|
+
}
|
|
599
|
+
interface IStateChangeSubscriptionInfo extends IStateChangeSubscriptionIdInfo {
|
|
600
|
+
onChanged: (change: IPropertyChange) => void;
|
|
601
|
+
init?: (observer: IObserver) => void;
|
|
602
|
+
}
|
|
603
|
+
type IStateChangeSubscriptionsForContextManager = ISingletonFactoryWithIdGeneration<string, IStateChangeSubscriptionInfo, IObserver, IStateChangeSubscriptionIdInfo>;
|
|
604
|
+
interface IStateChangeSubscriptionManager extends ISingletonFactory<unknown, unknown, IStateChangeSubscriptionsForContextManager> {
|
|
605
|
+
isRegistered(context: unknown, key: unknown): boolean;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
declare class StateChangeSubscriptionManager extends SingletonFactory<unknown, unknown, IStateChangeSubscriptionsForContextManager> implements IStateChangeSubscriptionManager {
|
|
609
|
+
private readonly _objectObserverManager;
|
|
610
|
+
private readonly _errorLog;
|
|
611
|
+
private readonly _guidFactory;
|
|
612
|
+
constructor(_objectObserverManager: IObjectPropertyObserverProxyPairManager, _errorLog: IErrorLog, _guidFactory: IGuidFactory);
|
|
613
|
+
getId(context: unknown): unknown;
|
|
614
|
+
isRegistered(context: unknown, key: unknown): boolean;
|
|
615
|
+
protected createId(context: unknown): unknown;
|
|
616
|
+
protected createInstance(context: unknown, id: unknown): IStateChangeSubscriptionsForContextManager;
|
|
617
|
+
protected releaseInstance(instance: IStateChangeSubscriptionsForContextManager, id: unknown): void;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
interface IContextChanged {
|
|
621
|
+
oldContext: unknown;
|
|
622
|
+
context: unknown;
|
|
623
|
+
key: unknown;
|
|
624
|
+
}
|
|
625
|
+
interface IStateChange extends IContextChanged {
|
|
626
|
+
oldValue: unknown;
|
|
627
|
+
newValue?: unknown;
|
|
628
|
+
watched?: boolean;
|
|
629
|
+
}
|
|
630
|
+
interface IStateManager {
|
|
631
|
+
readonly changed: Observable<IStateChange>;
|
|
632
|
+
readonly contextChanged: Observable<IContextChanged>;
|
|
633
|
+
readonly startChangeCycle: Observable<void>;
|
|
634
|
+
readonly endChangeCycle: Observable<void>;
|
|
635
|
+
isWatched(context: unknown, index: unknown, mustProxify?: MustProxify): boolean;
|
|
636
|
+
watchState(context: unknown, index: unknown, mustProxify?: MustProxify): unknown;
|
|
637
|
+
releaseState(oontext: unknown, index: unknown, mustProxify?: MustProxify): void;
|
|
638
|
+
getState<T>(context: unknown, index: unknown): T;
|
|
639
|
+
setState<T>(context: unknown, index: unknown, value: T): void;
|
|
640
|
+
clear(): void;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
declare class StateManager implements IStateManager {
|
|
644
|
+
private readonly _objectStateManager;
|
|
645
|
+
private readonly _indexValueAccessor;
|
|
646
|
+
private readonly _equalityService;
|
|
647
|
+
private readonly _changed;
|
|
648
|
+
private readonly _contextChanged;
|
|
649
|
+
private readonly _startChangeCycle;
|
|
650
|
+
private readonly _endChangeCycle;
|
|
651
|
+
private readonly _stateChangeSubscriptionManager;
|
|
652
|
+
private readonly _pending;
|
|
653
|
+
constructor(objectObserverManager: IObjectPropertyObserverProxyPairManager, _objectStateManager: IObjectStateManager, errorLog: IErrorLog, guidFactory: IGuidFactory, _indexValueAccessor: IIndexValueAccessor, _equalityService: IEqualityService);
|
|
654
|
+
get changed(): Observable<IStateChange>;
|
|
655
|
+
get contextChanged(): Observable<IContextChanged>;
|
|
656
|
+
get startChangeCycle(): Observable<void>;
|
|
657
|
+
get endChangeCycle(): Observable<void>;
|
|
658
|
+
toString(): string;
|
|
659
|
+
isWatched(context: unknown, index: unknown, mustProxify?: MustProxify): boolean;
|
|
660
|
+
watchState(context: unknown, index: unknown, mustProxify?: MustProxify): unknown;
|
|
661
|
+
releaseState(context: unknown, index: unknown, mustProxify: MustProxify): void;
|
|
662
|
+
clear(): void;
|
|
663
|
+
getState<T>(context: unknown, index: unknown): T;
|
|
664
|
+
setState<T>(context: unknown, index: unknown, value: T): void;
|
|
665
|
+
private internalSetState;
|
|
666
|
+
private getOldValue;
|
|
667
|
+
private unnsubscribeToObserverEvents;
|
|
668
|
+
private internalUnregister;
|
|
669
|
+
private emitChange;
|
|
670
|
+
private updateState;
|
|
671
|
+
private canReleaseState;
|
|
672
|
+
private increaseStateReferenceCount;
|
|
673
|
+
private tryToSubscribeToChange;
|
|
674
|
+
private getValue;
|
|
675
|
+
private getStateChanges;
|
|
676
|
+
private tryRebindingNestedState;
|
|
677
|
+
private setInitialValue;
|
|
678
|
+
private getChainChanges;
|
|
679
|
+
private getCurrentValue;
|
|
680
|
+
private onChange;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
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 IIndexObserverIdInfo, type IIndexObserverInfo, type IIndexObserverProxyPairFactory, type IIndexSetObserverManager, type IMapObserverProxyPair, type IMapObserverProxyPairFactory, type IMapProxifyData, type IMapProxifyIdData, type IMapProxyFactory, type IMustProxifyItemHandlerFactory, 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 IPropertyIdInfo, type IPropertyInfo, type IPropertyObserverIdInfo, type IPropertyObserverInfo, type IPropertyObserverManager, type IPropertyObserverProxyPairManager, type IProxyRegistry, 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 IStateForObjectManager, type IStateManager, type ISubscriptionIdInfo, type ISubscriptionInfo, type ISubscriptionWithData, type IValueKey, type IValueWithKey, type IndexChangeSubscriptionForContext, IndexChangeSubscriptionManager, IndexObserverProxyPairFactory, MapObserverProxyPairFactory, MapProxy, MapProxyFactory, type MustProxify, MustProxifyItemHandlerFactory, NonIterableObjectPropertyObserverProxyPairFactory, ObjectObserverProxyPairFactoryProvider, ObjectObserverProxyPairManager, ObjectPropertyObserverManager, ObjectPropertyObserverProxyPairManager, ObjectStateManager, ObservableObserverProxyPairFactory, ObservableProxyFactory, ObserverGroup, PlainObjectObserverProxyPairFactory, PromiseObserverProxyPairFactory, PromiseProxyFactory, ProxyRegistry, RsXStateManagerInjectionTokens, RsXStateManagerModule, SetObserverProxyPairFactory, SetProxy, SetProxyFactory, StateChangeSubscriptionManager, StateForObjectManager, StateManager, defaultObjectObserverProxyPairFactoryList, defaultPropertyObserverProxyPairFactoryList, unloadRsXStateManagerModule };
|