@rs-x/expression-parser 0.4.10 → 0.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/dist/index.d.ts +166 -125
  2. package/dist/index.js +1107 -908
  3. package/package.json +3 -3
  4. package/readme.md +2241 -1711
package/dist/index.d.ts CHANGED
@@ -1,6 +1,31 @@
1
- import { IDisposable, IDisposableOwner, AnyFunction, ConstructorType, IIndexValueAccessor, ISingletonFactory, SingletonFactory, IDeepCloneExcept, ContainerModule } from '@rs-x/core';
2
1
  import { Observable } from 'rxjs';
3
- import { MustProxify as MustProxify$1, IStateManager as IStateManager$1, IStateChange as IStateChange$1, IContextChanged as IContextChanged$1, IMustProxifyItemHandlerFactory, IObjectObserverProxyPairFactory, IObserverProxyPair, IObserver, IProxyTarget } from '@rs-x/state-manager';
2
+ import { IStateManager, IIndexWatchRule as IIndexWatchRule$1, IStateChange, IObserver, IObjectObserverProxyPairFactory, IObserverProxyPair, IProxyTarget } from '@rs-x/state-manager';
3
+ import { IIndexValueAccessor, IGuidFactory, IValueMetadata, IDisposableOwner, IDisposable, AnyFunction, ConstructorType, ISingletonFactory, SingletonFactory, IDeepCloneExcept, ContainerModule } from '@rs-x/core';
4
+ import { IIndexWatchRule } from '@rs-x/state-manager/lib';
5
+
6
+ interface IExpressionServices {
7
+ readonly transactionManager: IExpressionChangeTransactionManager;
8
+ readonly stateManager: IStateManager;
9
+ readonly indexValueAccessor: IIndexValueAccessor;
10
+ readonly guidFactory: IGuidFactory;
11
+ readonly valueMetadata: IValueMetadata;
12
+ }
13
+
14
+ interface IBindConfigurationBase {
15
+ readonly services: IExpressionServices;
16
+ readonly owner?: IDisposableOwner;
17
+ readonly leafIndexWatchRule?: IIndexWatchRule;
18
+ }
19
+ type IExpressionBindConfigurationExtra = {
20
+ readonly currentValue?: unknown;
21
+ };
22
+ type IExpressionBindConfiguration = (IBindConfigurationBase & IExpressionBindConfigurationExtra & {
23
+ rootContext: unknown;
24
+ context?: never;
25
+ }) | (IBindConfigurationBase & IExpressionBindConfigurationExtra & {
26
+ rootContext?: never;
27
+ context: unknown;
28
+ });
4
29
 
5
30
  interface IExpression<T = unknown, PT = unknown> extends IDisposable {
6
31
  readonly changed: Observable<IExpression>;
@@ -11,6 +36,8 @@ interface IExpression<T = unknown, PT = unknown> extends IDisposable {
11
36
  readonly value: T | undefined;
12
37
  readonly isRoot: boolean;
13
38
  toString(): string;
39
+ clone(): this;
40
+ bind(settings: IExpressionBindConfiguration): IExpression;
14
41
  }
15
42
  interface IPropertyPath {
16
43
  object: IPropertyPath;
@@ -74,19 +101,9 @@ declare enum ExpressionType {
74
101
  UnaryPlus = "unary plus"
75
102
  }
76
103
  interface IExpressionParser {
77
- parse(context: object, expression: string, owner?: IDisposableOwner): AbstractExpression;
104
+ parse(expression: string): AbstractExpression;
78
105
  }
79
106
 
80
- interface IMustProxifyHandler {
81
- createMustProxifyHandler: (() => MustProxify$1) | undefined;
82
- releaseMustProxifyHandler: (() => void) | undefined;
83
- }
84
- interface IExpressionInitializeConfig {
85
- context?: unknown;
86
- mustProxifyHandler?: IMustProxifyHandler;
87
- transactionManager?: IExpressionChangeTransactionManager;
88
- owner?: IDisposableOwner;
89
- }
90
107
  declare abstract class AbstractExpression<T = unknown, PT = unknown> implements IExpression<T> {
91
108
  readonly type: ExpressionType;
92
109
  readonly expressionString: string;
@@ -98,8 +115,11 @@ declare abstract class AbstractExpression<T = unknown, PT = unknown> implements
98
115
  private _oldValue;
99
116
  private _commitedSubscription;
100
117
  private _owner;
118
+ private _services;
119
+ private _leafIndexWatchRule?;
101
120
  protected constructor(type: ExpressionType, expressionString: string, ...childExpressions: AbstractExpression[]);
102
- initialize(settings: IExpressionInitializeConfig): AbstractExpression;
121
+ abstract clone(): this;
122
+ bind(settings: IExpressionBindConfiguration): AbstractExpression;
103
123
  get value(): T | undefined;
104
124
  get isRoot(): boolean;
105
125
  get changed(): Observable<IExpression>;
@@ -107,6 +127,13 @@ declare abstract class AbstractExpression<T = unknown, PT = unknown> implements
107
127
  get parent(): AbstractExpression<PT> | undefined;
108
128
  dispose(): void;
109
129
  toString(): string;
130
+ protected get services(): IExpressionServices;
131
+ protected get guidFactory(): IGuidFactory;
132
+ protected get leafIndexWatchRule(): IIndexWatchRule$1 | undefined;
133
+ protected get stateManager(): IStateManager;
134
+ protected get indexValueAccessor(): IIndexValueAccessor;
135
+ protected get transactionManager(): IExpressionChangeTransactionManager;
136
+ protected get valueMetadata(): IValueMetadata;
110
137
  protected get root(): AbstractExpression;
111
138
  protected static setValue(expression: AbstractExpression, evaluate: () => unknown): void;
112
139
  protected static setParent(expression: AbstractExpression, parent: AbstractExpression): void;
@@ -121,9 +148,21 @@ declare abstract class AbstractExpression<T = unknown, PT = unknown> implements
121
148
  private addChildExpressions;
122
149
  }
123
150
 
151
+ interface IExpressionChangeCommitHandler {
152
+ owner: AbstractExpression;
153
+ commit: (root: AbstractExpression, pendingCommits: Set<IExpressionChangeCommitHandler>) => boolean;
154
+ }
155
+ interface IExpressionChangeTransactionManager extends IDisposable {
156
+ readonly commited: Observable<AbstractExpression>;
157
+ registerChange(rootExpression: AbstractExpression, commitHandler: IExpressionChangeCommitHandler): void;
158
+ suspend(): void;
159
+ continue(): void;
160
+ commit(): void;
161
+ }
162
+
124
163
  declare abstract class ParameterizedExpression<T = unknown, PT = unknown> extends AbstractExpression<T, PT> {
125
164
  protected constructor(type: ExpressionType, expressionString: string, ...childExpressions: AbstractExpression[]);
126
- initialize(settings: IExpressionInitializeConfig): AbstractExpression;
165
+ bind(settings: IExpressionBindConfiguration): AbstractExpression;
127
166
  protected abstract evaluateExpression(...args: unknown[]): T;
128
167
  protected prepareReevaluation(): boolean;
129
168
  protected evaluate(): T;
@@ -131,6 +170,7 @@ declare abstract class ParameterizedExpression<T = unknown, PT = unknown> extend
131
170
 
132
171
  declare abstract class BinaryExpression<T = unknown, PT = unknown> extends ParameterizedExpression<T, PT> {
133
172
  protected constructor(expressionType: ExpressionType, expressionString: string, leftExpression: AbstractExpression, rightExpression: AbstractExpression);
173
+ clone(): this;
134
174
  }
135
175
 
136
176
  declare class AdditionExpression extends BinaryExpression<number, number> {
@@ -144,6 +184,7 @@ declare abstract class CollectionExpression<T = unknown> extends ParameterizedEx
144
184
 
145
185
  declare class ArrayExpression extends CollectionExpression<unknown[]> {
146
186
  constructor(expressions: AbstractExpression[]);
187
+ clone(): this;
147
188
  protected evaluateExpression(...args: unknown[]): unknown[];
148
189
  }
149
190
 
@@ -159,6 +200,7 @@ declare class BitwiseLeftShiftExpression extends BinaryExpression<number, number
159
200
 
160
201
  declare class BitwiseNotExpression extends ParameterizedExpression<number, number> {
161
202
  constructor(expressionString: string, expression: AbstractExpression<number>);
203
+ clone(): this;
162
204
  protected evaluateExpression(a: number): number;
163
205
  }
164
206
 
@@ -184,45 +226,43 @@ declare class BitwiseXorExpression extends BinaryExpression<number, number> {
184
226
 
185
227
  declare class ConditionalExpression extends ParameterizedExpression {
186
228
  constructor(expressionString: string, condition: AbstractExpression, ifValueExpression: AbstractExpression, elseValueExpression: AbstractExpression);
229
+ clone(): this;
187
230
  protected evaluateExpression(condition: unknown, consequent: unknown, alternate: unknown): unknown;
188
231
  }
189
232
 
190
233
  declare class ConstantExpression<T> extends AbstractExpression<T> {
191
- private readonly _expressionChangeTransactionManager;
192
234
  private readonly _commitHandler;
193
- constructor(type: ExpressionType, expressionString: string, constValue: T, _expressionChangeTransactionManager: IExpressionChangeTransactionManager);
194
- initialize(settings: IExpressionInitializeConfig): AbstractExpression;
235
+ constructor(type: ExpressionType, expressionString: string, constValue: T);
236
+ clone(): this;
237
+ bind(settings: IExpressionBindConfiguration): AbstractExpression;
195
238
  protected evaluate(): T | undefined;
196
239
  private commit;
197
240
  }
198
241
 
199
242
  declare class ConstantBigIntExpression extends ConstantExpression<bigint> {
200
- constructor(value: bigint, expressionChangeTransactionManager: IExpressionChangeTransactionManager);
243
+ constructor(value: bigint);
201
244
  }
202
245
 
203
246
  declare class ConstantBooleanExpression extends ConstantExpression<boolean> {
204
- constructor(value: boolean, expressionChangeTransactionManager: IExpressionChangeTransactionManager);
247
+ constructor(value: boolean);
205
248
  }
206
249
 
207
250
  declare class ConstantNullExpression extends ConstantExpression<null> {
208
- constructor(expressionChangeTransactionManager: IExpressionChangeTransactionManager);
251
+ constructor();
252
+ clone(): this;
209
253
  }
210
254
 
211
255
  declare class ConstantNumberExpression extends ConstantExpression<number> {
212
- constructor(value: number, expressionChangeTransactionManager: IExpressionChangeTransactionManager);
256
+ constructor(value: number);
213
257
  }
214
258
 
215
259
  declare class ConstantRegExpExpression extends ConstantExpression<RegExp> {
216
- constructor(expressionString: string, value: RegExp, expressionChangeTransactionManager: IExpressionChangeTransactionManager);
260
+ constructor(expressionString: string, value: RegExp);
261
+ clone(): this;
217
262
  }
218
263
 
219
264
  declare class ConstantStringExpression extends ConstantExpression<string> {
220
- constructor(value: string, expressionChangeTransactionManager: IExpressionChangeTransactionManager);
221
- }
222
-
223
- declare class UnaryPlusExpression extends ParameterizedExpression<number> {
224
- constructor(expressionString: string, expression: AbstractExpression);
225
- protected evaluateExpression(a: string | number): number;
265
+ constructor(value: string);
226
266
  }
227
267
 
228
268
  declare class DivisionExpression extends BinaryExpression<number, number> {
@@ -240,47 +280,18 @@ declare class ExponentiationExpression extends BinaryExpression<number, number>
240
280
  protected evaluateExpression(base: number, exponent: number): number;
241
281
  }
242
282
 
243
- interface IGuidFactory {
244
- create(): string;
245
- }
246
-
247
- type MustProxify = (index: unknown, target?: unknown) => boolean;
248
-
249
- interface IContextChanged {
250
- oldContext: unknown;
251
- context: unknown;
252
- key: unknown;
253
- }
254
- interface IStateChange extends IContextChanged {
255
- oldValue: unknown;
256
- newValue?: unknown;
257
- watched?: boolean;
258
- }
259
- interface IStateManager {
260
- readonly changed: Observable<IStateChange>;
261
- readonly contextChanged: Observable<IContextChanged>;
262
- readonly startChangeCycle: Observable<void>;
263
- readonly endChangeCycle: Observable<void>;
264
- isWatched(context: unknown, index: unknown, mustProxify?: MustProxify): boolean;
265
- watchState(context: unknown, index: unknown, mustProxify?: MustProxify): unknown;
266
- releaseState(oontext: unknown, index: unknown, mustProxify?: MustProxify): void;
267
- getState<T>(context: unknown, index: unknown): T;
268
- setState<T>(context: unknown, index: unknown, value: T): void;
269
- clear(): void;
270
- }
271
-
272
283
  declare class FunctionExpression extends AbstractExpression {
273
284
  readonly functionExpression: AbstractExpression<AnyFunction | string | number>;
274
285
  readonly objectExpression: AbstractExpression<object>;
275
286
  readonly argumentsExpression: ArrayExpression;
276
287
  readonly computed: boolean;
277
288
  readonly optional: boolean;
278
- private readonly _stateManager;
279
289
  private _context;
280
290
  private _functionContext;
281
- private readonly _functionId;
282
- constructor(expressionString: string, functionExpression: AbstractExpression<AnyFunction | string | number>, objectExpression: AbstractExpression<object>, argumentsExpression: ArrayExpression, computed: boolean, optional: boolean, expressionChangeTransactionManager: IExpressionChangeTransactionManager, _stateManager: IStateManager, guidFactory: IGuidFactory);
283
- initialize(settings: IExpressionInitializeConfig): AbstractExpression;
291
+ private _functionId;
292
+ constructor(expressionString: string, functionExpression: AbstractExpression<AnyFunction | string | number>, objectExpression: AbstractExpression<object>, argumentsExpression: ArrayExpression, computed: boolean, optional: boolean);
293
+ clone(): this;
294
+ bind(settings: IExpressionBindConfiguration): AbstractExpression;
284
295
  protected internalDispose(): void;
285
296
  protected prepareReevaluation(sender: AbstractExpression, root: AbstractExpression, pendingCommits: Set<IExpressionChangeCommitHandler>): boolean;
286
297
  protected evaluate(): unknown;
@@ -301,42 +312,43 @@ declare class GreaterThanOrEqualExpression extends BinaryExpression {
301
312
 
302
313
  declare class IndexValueObserver {
303
314
  private _context;
304
- private readonly _key;
305
- private readonly _mustProxify;
315
+ private readonly _index;
316
+ private readonly _indexWatchRule;
306
317
  private readonly _stateManager;
318
+ private readonly setContext;
307
319
  private readonly _changeSubscription;
308
320
  private readonly _contextChangeSubscription;
309
321
  private readonly _changed;
310
- private readonly _contextChanged;
311
322
  private _isDisposed;
312
- constructor(_context: unknown, _key: unknown, _mustProxify: MustProxify$1 | undefined, _stateManager: IStateManager$1);
313
- get changed(): Observable<IStateChange$1>;
314
- get contextChanged(): Observable<IContextChanged$1>;
323
+ constructor(_context: unknown, _index: unknown, _indexWatchRule: IIndexWatchRule$1 | undefined, _stateManager: IStateManager, setContext: (context: unknown) => void);
324
+ get changed(): Observable<IStateChange>;
315
325
  dispose(): void;
316
326
  getValue(context: unknown, key: unknown): unknown;
317
327
  private onContextCHanged;
318
328
  private emitChange;
319
329
  }
320
- interface IIdentifierInitializeConfig extends IExpressionInitializeConfig {
330
+ type IIdentifierBindConfiguration = IExpressionBindConfiguration & {
321
331
  currentValue?: unknown;
322
- }
332
+ };
323
333
  declare class IdentifierExpression extends AbstractExpression {
324
- private readonly _rootContext;
325
- private readonly _stateManager;
326
- private readonly _expressionChangeTransactionManager;
327
334
  private readonly _indexValue?;
328
335
  private _changeSubscription;
329
- private _isInitialized;
336
+ private _isBound;
330
337
  private _indexValueObserver;
331
338
  private releaseMustProxifyHandler;
332
339
  private _commitAfterInitialized;
333
340
  private readonly _commitHandler;
334
- constructor(_rootContext: unknown, _stateManager: IStateManager$1, expressionString: string, _expressionChangeTransactionManager: IExpressionChangeTransactionManager, _indexValue?: unknown | undefined);
335
- initialize(settings: IIdentifierInitializeConfig): AbstractExpression;
341
+ private _context;
342
+ private _indexWatchRule;
343
+ constructor(expressionString: string, _indexValue?: unknown | undefined);
344
+ clone(): this;
345
+ bind(settings: IIdentifierBindConfiguration): AbstractExpression;
336
346
  protected internalDispose(): void;
337
347
  protected evaluate(): unknown;
348
+ private get isLeaf();
349
+ private get isMemberExpressionSegment();
350
+ private shouldWatchIndex;
338
351
  private observeChange;
339
- private getDefaultMustProxifyHandler;
340
352
  private disposeObserver;
341
353
  private commit;
342
354
  private onValueChanged;
@@ -349,6 +361,7 @@ declare class InExpression extends BinaryExpression<boolean> {
349
361
 
350
362
  declare class IndexExpression extends ParameterizedExpression {
351
363
  constructor(expression: AbstractExpression);
364
+ clone(): this;
352
365
  protected get root(): AbstractExpression;
353
366
  protected evaluateExpression(index: unknown): unknown;
354
367
  }
@@ -380,6 +393,7 @@ declare class LogicalAndExpression extends BinaryExpression {
380
393
 
381
394
  declare class LogicalNotExpression extends ParameterizedExpression {
382
395
  constructor(expressionString: string, expression: AbstractExpression);
396
+ clone(): this;
383
397
  protected evaluateExpression(value: unknown): boolean;
384
398
  }
385
399
 
@@ -389,29 +403,25 @@ declare class LogicalOrExpression extends BinaryExpression {
389
403
  }
390
404
 
391
405
  declare class MemberExpression extends AbstractExpression {
392
- private readonly _indexValueAccessor;
393
- private readonly _stateManager;
394
- private readonly _mustProxifyItemHandlerFactory;
395
- private readonly _expressionChangeTransactionManager;
396
406
  private _slotObservers;
397
407
  private _rebindingSlot;
398
408
  private readonly _initializeQueue;
399
- constructor(expressionString: string, pathSeqments: AbstractExpression[], _indexValueAccessor: IIndexValueAccessor, _stateManager: IStateManager$1, _mustProxifyItemHandlerFactory: IMustProxifyItemHandlerFactory, _expressionChangeTransactionManager: IExpressionChangeTransactionManager);
400
- initialize(settings: IExpressionInitializeConfig): AbstractExpression;
409
+ constructor(expressionString: string, pathSeqments: AbstractExpression[]);
410
+ clone(): this;
411
+ bind(settings: IExpressionBindConfiguration): AbstractExpression;
401
412
  protected internalDispose(): void;
402
413
  protected prepareReevaluation(sender: AbstractExpression, root: AbstractExpression, pendingCommits: Set<IExpressionChangeCommitHandler>): boolean;
403
414
  protected evaluate(sender: AbstractExpression, root: AbstractExpression): unknown;
404
415
  protected isCommitTarget(sender: AbstractExpression): boolean;
405
- private isPending;
406
416
  private shouldCancelEvaluate;
407
- private initializePathSegement;
417
+ private bindPathSegement;
408
418
  private resolvePathSegment;
409
419
  private resolveCalculated;
410
420
  private disposeSlotObserver;
411
- private getMustProxifyHandler;
412
- private createMustProxifyHandler;
421
+ private isPathSegmentPending;
413
422
  private observeSlot;
414
423
  private onSlotChanged;
424
+ private isPending;
415
425
  private isCalculated;
416
426
  }
417
427
 
@@ -422,6 +432,7 @@ declare class MultiplicationExpression extends BinaryExpression {
422
432
 
423
433
  declare class NewExpression extends ParameterizedExpression {
424
434
  constructor(expressionString: string, constructorExpression: AbstractExpression<ConstructorType>, argumentExpressions: AbstractExpression[]);
435
+ clone(): this;
425
436
  protected evaluateExpression(constructorFunction: ConstructorType, ...args: unknown[]): unknown;
426
437
  }
427
438
 
@@ -437,11 +448,13 @@ declare class PropertyExpression extends BinaryExpression<object, number | strin
437
448
 
438
449
  declare class SpreadExpression extends ParameterizedExpression<unknown[] | object> {
439
450
  constructor(expression: ArrayExpression | ObjectExpression | IdentifierExpression);
451
+ clone(): this;
440
452
  protected evaluateExpression(...args: unknown[]): unknown[] | object;
441
453
  }
442
454
 
443
455
  declare class ObjectExpression extends ParameterizedExpression<object> {
444
456
  constructor(expressionString: string, propertyExpressions: (PropertyExpression | SpreadExpression)[]);
457
+ clone(): this;
445
458
  protected evaluateExpression(...args: unknown[]): object;
446
459
  }
447
460
 
@@ -452,7 +465,8 @@ declare class RemainderExpression extends BinaryExpression<number, number> {
452
465
 
453
466
  declare class SequenceExpression extends AbstractExpression {
454
467
  constructor(expressionString: string, expressions: AbstractExpression[]);
455
- initialize(settings: IExpressionInitializeConfig): AbstractExpression;
468
+ clone(): this;
469
+ bind(settings: IExpressionBindConfiguration): AbstractExpression;
456
470
  protected evaluate(): unknown;
457
471
  }
458
472
 
@@ -473,29 +487,26 @@ declare class SubtractionExpression extends BinaryExpression<number, number> {
473
487
 
474
488
  declare class TemplateStringExpression extends CollectionExpression<string> {
475
489
  constructor(expressionString: string, expressions: AbstractExpression[]);
490
+ clone(): this;
476
491
  protected evaluateExpression(...segments: unknown[]): string;
477
492
  }
478
493
 
479
494
  declare class TypeofExpression extends ParameterizedExpression<string> {
480
495
  constructor(expressionString: string, expression: AbstractExpression);
496
+ clone(): this;
481
497
  protected evaluateExpression(value: unknown): string;
482
498
  }
483
499
 
484
500
  declare class UnaryNegationExpression extends ParameterizedExpression<number> {
485
501
  constructor(expressionString: string, expression: AbstractExpression<number>);
502
+ clone(): this;
486
503
  protected evaluateExpression(value: number): number;
487
504
  }
488
505
 
489
- interface IExpressionChangeCommitHandler {
490
- owner: AbstractExpression;
491
- commit: (root: AbstractExpression, pendingCommits: Set<IExpressionChangeCommitHandler>) => boolean;
492
- }
493
- interface IExpressionChangeTransactionManager extends IDisposable {
494
- readonly commited: Observable<AbstractExpression>;
495
- registerChange(rootExpression: AbstractExpression, commitHandler: IExpressionChangeCommitHandler): void;
496
- suspend(): void;
497
- continue(): void;
498
- commit(): void;
506
+ declare class UnaryPlusExpression extends ParameterizedExpression<number> {
507
+ constructor(expressionString: string, expression: AbstractExpression);
508
+ clone(): this;
509
+ protected evaluateExpression(a: string | number): number;
499
510
  }
500
511
 
501
512
  declare class ExpressionChangeTransactionManager implements IExpressionChangeTransactionManager {
@@ -505,7 +516,7 @@ declare class ExpressionChangeTransactionManager implements IExpressionChangeTra
505
516
  private readonly _endChangeCycleSubscription;
506
517
  private _emittedChangeCounter;
507
518
  private _suspended;
508
- constructor(stateManager: IStateManager$1);
519
+ constructor(stateManager: IStateManager);
509
520
  get commited(): Observable<AbstractExpression>;
510
521
  dispose(): void;
511
522
  suspend(): void;
@@ -517,28 +528,50 @@ declare class ExpressionChangeTransactionManager implements IExpressionChangeTra
517
528
  private onEndChangeCycle;
518
529
  }
519
530
 
531
+ type IExpressionCache = ISingletonFactory<string, string, IExpression>;
532
+
533
+ declare class ExpressionCache extends SingletonFactory<string, string, IExpression> implements IExpressionCache {
534
+ private readonly _expressionParser;
535
+ constructor(_expressionParser: IExpressionParser);
536
+ getId(expressionString: string): string | undefined;
537
+ protected createId(expressionString: string): string;
538
+ create(data: string): {
539
+ referenceCount: number;
540
+ instance: IExpression<unknown, unknown>;
541
+ id: string;
542
+ };
543
+ protected createInstance(expressionString: string): IExpression<unknown, unknown>;
544
+ }
545
+
520
546
  interface IExpressionFactory {
521
- create<T>(context: object, expression: string): IExpression<T>;
547
+ create<T>(context: object, expression: string, leafIndexWatchRule?: IIndexWatchRule$1): IExpression<T>;
522
548
  }
523
549
 
524
550
  interface IExpressionInfo {
525
551
  context: object;
526
552
  expression: string;
527
553
  }
528
- type IExpressionForContextManager = ISingletonFactory<string, string, IExpression>;
554
+ interface IExpressionIdData {
555
+ expressionString: string;
556
+ }
557
+ interface IExpressionData extends IExpressionIdData {
558
+ leafIndexWatchRule?: IIndexWatchRule$1;
559
+ }
560
+ type IExpressionForContextManager = ISingletonFactory<string, IExpressionData, IExpression, IExpressionIdData>;
529
561
  type IExpressionManager = ISingletonFactory<object, object, IExpressionForContextManager>;
530
562
 
531
563
  declare class ExpressionFactory implements IExpressionFactory {
532
564
  private readonly _expressionManager;
533
565
  constructor(_expressionManager: IExpressionManager);
534
- create<T>(context: object, expression: string): IExpression<T>;
566
+ create<T>(context: object, expressionString: string, leafIndexWatchRule?: IIndexWatchRule$1): IExpression<T>;
535
567
  }
536
568
 
537
569
  declare class ExpressionManager extends SingletonFactory<object, object, IExpressionForContextManager> implements IExpressionManager {
538
- private readonly _expressionParser;
570
+ private readonly _expressionCache;
571
+ private readonly _services;
539
572
  getId(context: object): object;
540
573
  protected createId(context: object): object;
541
- constructor(_expressionParser: IExpressionParser);
574
+ constructor(_expressionCache: IExpressionCache, _services: IExpressionServices);
542
575
  protected createInstance(context: object, id: object): IExpressionForContextManager;
543
576
  }
544
577
 
@@ -553,6 +586,7 @@ type IExpressionIndexAccessor = IIndexValueAccessor<unknown, string>;
553
586
  declare class ExpressionIndexAccessor implements IExpressionIndexAccessor {
554
587
  readonly priority: 300;
555
588
  isAsync(): boolean;
589
+ needsProxy(): boolean;
556
590
  getResolvedValue(context: unknown, index: string): unknown;
557
591
  hasValue(context: unknown, index: string): boolean;
558
592
  getValue(context: unknown, index: string): unknown;
@@ -561,16 +595,24 @@ declare class ExpressionIndexAccessor implements IExpressionIndexAccessor {
561
595
  applies(context: unknown, index: string): boolean;
562
596
  }
563
597
 
564
- type IExpressionObserverProxyPairFactory = IObjectObserverProxyPairFactory<AbstractExpression>;
565
-
566
- type IExpressionObserverProxyPair = IObserverProxyPair<AbstractExpression>;
567
-
568
598
  interface IExpressionObserverData {
569
599
  owner?: IDisposableOwner;
570
600
  expression: AbstractExpression;
571
601
  }
572
602
  type IExpressionObserverFactory = ISingletonFactory<AbstractExpression, IExpressionObserverData, IObserver>;
573
603
 
604
+ declare class ExpressionObserverFactory extends SingletonFactory<AbstractExpression, IExpressionObserverData, IObserver> implements IExpressionObserverFactory {
605
+ constructor();
606
+ getId(data: IExpressionObserverData): AbstractExpression;
607
+ protected createId(data: IExpressionObserverData): AbstractExpression;
608
+ protected createInstance(data: IExpressionObserverData, id: AbstractExpression): IObserver;
609
+ protected releaseInstance(observer: IObserver): void;
610
+ }
611
+
612
+ type IExpressionObserverProxyPairFactory = IObjectObserverProxyPairFactory<AbstractExpression>;
613
+
614
+ type IExpressionObserverProxyPair = IObserverProxyPair<AbstractExpression>;
615
+
574
616
  declare class ExpressionObserverProxyPairFactory implements IExpressionObserverProxyPairFactory {
575
617
  private readonly _expressionObserverFactory;
576
618
  readonly priority = 100;
@@ -579,12 +621,13 @@ declare class ExpressionObserverProxyPairFactory implements IExpressionObserverP
579
621
  applies(object: unknown): boolean;
580
622
  }
581
623
 
582
- declare class ExpressionObserverFactory extends SingletonFactory<AbstractExpression, IExpressionObserverData, IObserver> implements IExpressionObserverFactory {
583
- constructor();
584
- getId(data: IExpressionObserverData): AbstractExpression;
585
- protected createId(data: IExpressionObserverData): AbstractExpression;
586
- protected createInstance(data: IExpressionObserverData, id: AbstractExpression): IObserver;
587
- protected releaseInstance(observer: IObserver): void;
624
+ declare class ExpressionServices implements IExpressionServices {
625
+ readonly transactionManager: IExpressionChangeTransactionManager;
626
+ readonly stateManager: IStateManager;
627
+ readonly indexValueAccessor: IIndexValueAccessor;
628
+ readonly guidFactory: IGuidFactory;
629
+ readonly valueMetadata: IValueMetadata;
630
+ constructor(transactionManager: IExpressionChangeTransactionManager, stateManager: IStateManager, indexValueAccessor: IIndexValueAccessor, guidFactory: IGuidFactory, valueMetadata: IValueMetadata);
588
631
  }
589
632
 
590
633
  interface IIdentifierOwnerResolver {
@@ -610,19 +653,14 @@ declare class PropertyOwnerResolver implements IIdentifierOwnerResolver {
610
653
  }
611
654
 
612
655
  declare class JsEspreeExpressionParser implements IExpressionParser {
613
- private readonly _indexValueAccessor;
614
- private readonly _mustProxifyItemHandlerFactory;
615
- private readonly _expressionChangeTransactionManager;
616
- private readonly _stateManager;
617
- private readonly _guidFactory;
618
656
  static readonly instance: IExpressionParser;
619
657
  private readonly createConstantExpression;
620
658
  private readonly expressionFactories;
621
659
  private readonly unaryExpressionFactories;
622
660
  private readonly binaryExpressionFactories;
623
661
  private readonly logicalExpressionFactories;
624
- constructor(_indexValueAccessor: IIndexValueAccessor, _mustProxifyItemHandlerFactory: IMustProxifyItemHandlerFactory, _expressionChangeTransactionManager: IExpressionChangeTransactionManager, _stateManager: IStateManager$1, _guidFactory: IGuidFactory);
625
- parse(context: unknown, expressionString: string, owner: IDisposableOwner): AbstractExpression;
662
+ constructor();
663
+ parse(expressionString: string): AbstractExpression;
626
664
  private tryParse;
627
665
  private createExpression;
628
666
  private createLiteralExpression;
@@ -680,6 +718,9 @@ declare class JsEspreeExpressionParser implements IExpressionParser {
680
718
  private flattenMemberExpression;
681
719
  }
682
720
 
721
+ declare const RsXExpressionParserModule: ContainerModule;
722
+ declare function unloadRsXExpressionParserModule(): Promise<void>;
723
+
683
724
  declare const RsXExpressionParserInjectionTokens: {
684
725
  PropertyOwnerResolver: symbol;
685
726
  ArrayIndexOwnerResolver: symbol;
@@ -693,9 +734,9 @@ declare const RsXExpressionParserInjectionTokens: {
693
734
  IExpressionObserverProxyPairFactory: symbol;
694
735
  IExpressionIndexAccessor: symbol;
695
736
  IExpressionObserverFactory: symbol;
737
+ IExpressionCache: symbol;
738
+ IExpressionServices: symbol;
739
+ ExpressiomMetadata: symbol;
696
740
  };
697
741
 
698
- declare const RsXExpressionParserModule: ContainerModule;
699
- declare function unloadRsXExpressionParserModule(): Promise<void>;
700
-
701
- export { AbstractExpression, AdditionExpression, ArrayExpression, ArrayIndexOwnerResolver, BinaryExpression, BitwiseAndExpression, BitwiseLeftShiftExpression, BitwiseNotExpression, BitwiseOrExpression, BitwiseRightShiftExpression, BitwiseUnsignedRightShiftExpression, BitwiseXorExpression, CollectionExpression, ConditionalExpression, ConstantBigIntExpression, ConstantBooleanExpression, ConstantExpression, ConstantNullExpression, ConstantNumberExpression, ConstantRegExpExpression, ConstantStringExpression, DeepCloneExceptWithExpressionSupport, DefaultIdentifierOwnerResolver, DivisionExpression, EqualityExpression, ExponentiationExpression, ExpressionChangeTransactionManager, ExpressionFactory, ExpressionIndexAccessor, ExpressionManager, ExpressionObserverFactory, ExpressionObserverProxyPairFactory, ExpressionType, FunctionExpression, GreaterThanExpression, GreaterThanOrEqualExpression, type IChangePathValue, type IExpression, type IExpressionChangeCommitHandler, type IExpressionChangeTransactionManager, type IExpressionFactory, type IExpressionForContextManager, type IExpressionIndexAccessor, type IExpressionInfo, type IExpressionInitializeConfig, type IExpressionManager, type IExpressionObserverData, type IExpressionObserverFactory, type IExpressionObserverProxyPair, type IExpressionParser, type IIdentifierInitializeConfig, type IIdentifierOwnerResolver, type IMustProxifyHandler, type IPropertyPath, IdentifierExpression, InExpression, IndexExpression, IndexValueObserver, InequalityExpression, InstanceofExpression, JsEspreeExpressionParser, LessThanExpression, LessThanOrEqualExpression, LogicalAndExpression, LogicalNotExpression, LogicalOrExpression, MapKeyOwnerResolver, MemberExpression, MultiplicationExpression, NewExpression, NullishCoalescingExpression, ObjectExpression, ParameterizedExpression, PropertyExpression, PropertyOwnerResolver, RemainderExpression, RsXExpressionParserInjectionTokens, RsXExpressionParserModule, SequenceExpression, SpreadExpression, StrictEqualityExpression, StrictInequalityExpression, SubtractionExpression, TemplateStringExpression, TypeofExpression, UnaryNegationExpression, UnaryPlusExpression, unloadRsXExpressionParserModule };
742
+ export { AbstractExpression, AdditionExpression, ArrayExpression, ArrayIndexOwnerResolver, BinaryExpression, BitwiseAndExpression, BitwiseLeftShiftExpression, BitwiseNotExpression, BitwiseOrExpression, BitwiseRightShiftExpression, BitwiseUnsignedRightShiftExpression, BitwiseXorExpression, CollectionExpression, ConditionalExpression, ConstantBigIntExpression, ConstantBooleanExpression, ConstantExpression, ConstantNullExpression, ConstantNumberExpression, ConstantRegExpExpression, ConstantStringExpression, DeepCloneExceptWithExpressionSupport, DefaultIdentifierOwnerResolver, DivisionExpression, EqualityExpression, ExponentiationExpression, ExpressionCache, ExpressionChangeTransactionManager, ExpressionFactory, ExpressionIndexAccessor, ExpressionManager, ExpressionObserverFactory, ExpressionObserverProxyPairFactory, ExpressionServices, ExpressionType, FunctionExpression, GreaterThanExpression, GreaterThanOrEqualExpression, type IBindConfigurationBase, type IChangePathValue, type IExpression, type IExpressionBindConfiguration, type IExpressionBindConfigurationExtra, type IExpressionCache, type IExpressionChangeCommitHandler, type IExpressionChangeTransactionManager, type IExpressionData, type IExpressionFactory, type IExpressionForContextManager, type IExpressionIdData, type IExpressionIndexAccessor, type IExpressionInfo, type IExpressionManager, type IExpressionObserverData, type IExpressionObserverFactory, type IExpressionObserverProxyPair, type IExpressionParser, type IExpressionServices, type IIdentifierBindConfiguration, type IIdentifierOwnerResolver, type IPropertyPath, IdentifierExpression, InExpression, IndexExpression, IndexValueObserver, InequalityExpression, InstanceofExpression, JsEspreeExpressionParser, LessThanExpression, LessThanOrEqualExpression, LogicalAndExpression, LogicalNotExpression, LogicalOrExpression, MapKeyOwnerResolver, MemberExpression, MultiplicationExpression, NewExpression, NullishCoalescingExpression, ObjectExpression, ParameterizedExpression, PropertyExpression, PropertyOwnerResolver, RemainderExpression, RsXExpressionParserInjectionTokens, RsXExpressionParserModule, SequenceExpression, SpreadExpression, StrictEqualityExpression, StrictInequalityExpression, SubtractionExpression, TemplateStringExpression, TypeofExpression, UnaryNegationExpression, UnaryPlusExpression, unloadRsXExpressionParserModule };