@dxos/echo-query 0.9.0 → 0.9.1-staging.ee54ba693a

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/echo-query",
3
- "version": "0.9.0",
3
+ "version": "0.9.1-staging.ee54ba693a",
4
4
  "description": "ECHO queries.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -31,20 +31,20 @@
31
31
  "dependencies": {
32
32
  "@lezer/common": "^1.5.2",
33
33
  "@lezer/lr": "^1.4.10",
34
- "@dxos/context": "0.9.0",
35
- "@dxos/echo": "0.9.0",
36
- "@dxos/echo-protocol": "0.9.0",
37
- "@dxos/invariant": "0.9.0",
38
- "@dxos/vendor-quickjs": "0.9.0",
39
- "@dxos/util": "0.9.0",
40
- "@dxos/node-std": "0.9.0"
34
+ "@dxos/context": "0.9.1-staging.ee54ba693a",
35
+ "@dxos/invariant": "0.9.1-staging.ee54ba693a",
36
+ "@dxos/echo-protocol": "0.9.1-staging.ee54ba693a",
37
+ "@dxos/node-std": "0.9.1-staging.ee54ba693a",
38
+ "@dxos/echo": "0.9.1-staging.ee54ba693a",
39
+ "@dxos/vendor-quickjs": "0.9.1-staging.ee54ba693a",
40
+ "@dxos/util": "0.9.1-staging.ee54ba693a"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@lezer/generator": "^1.8.0",
44
44
  "tsdown": "^0.16.7",
45
45
  "typescript": "^6.0.3",
46
- "@dxos/random": "0.9.0",
47
- "@dxos/echo-generator": "0.9.0"
46
+ "@dxos/echo-generator": "0.9.1-staging.ee54ba693a",
47
+ "@dxos/random": "0.9.1-staging.ee54ba693a"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"
@@ -4,7 +4,7 @@
4
4
 
5
5
  import type * as Schema from 'effect/Schema';
6
6
 
7
- import type { Filter as Filter$, Obj as Obj$, Order as Order$, Query as Query$, Ref, Type as Type$ } from '@dxos/echo';
7
+ import type { Ref, Filter as Filter$, Obj as Obj$, Order as Order$, Query as Query$, Type as Type$ } from '@dxos/echo';
8
8
  import type { ForeignKey, QueryAST } from '@dxos/echo-protocol';
9
9
  import { assertArgument } from '@dxos/invariant';
10
10
  // `DXN`/`EID` are type-only imports to keep the `query-lite` bundle free of
@@ -20,11 +20,11 @@ import type { DXN, EID, EntityId, URI } from '@dxos/keys';
20
20
  class OrderClass implements Order$.Any {
21
21
  private static 'variance': Order$.Any['~Order'] = {} as Order$.Any['~Order'];
22
22
 
23
- static is(value: unknown): value is Order$.Any {
23
+ static 'is'(value: unknown): value is Order$.Any {
24
24
  return typeof value === 'object' && value !== null && '~Order' in value;
25
25
  }
26
26
 
27
- constructor(public readonly ast: QueryAST.Order) {}
27
+ 'constructor'(public readonly ast: QueryAST.Order) {}
28
28
 
29
29
  '~Order' = OrderClass.variance;
30
30
  }
@@ -59,18 +59,103 @@ namespace Order1 {
59
59
  const Order2: typeof Order$ = Order1;
60
60
  export { Order2 as Order };
61
61
 
62
+ // Local filter-match helpers used by FilterClass.toPredicate.
63
+ // Written without a runtime @dxos/echo import so the QuickJS sandbox bundle stays clean.
64
+ const _filterMatchValueLocal = (filter: QueryAST.Filter, value: unknown): boolean => {
65
+ switch (filter.type) {
66
+ case 'compare': {
67
+ switch (filter.operator) {
68
+ case 'eq':
69
+ return value === filter.value;
70
+ case 'neq':
71
+ return value !== filter.value;
72
+ case 'gt':
73
+ return (value as any) > (filter.value as any);
74
+ case 'gte':
75
+ return (value as any) >= (filter.value as any);
76
+ case 'lt':
77
+ return (value as any) < (filter.value as any);
78
+ case 'lte':
79
+ return (value as any) <= (filter.value as any);
80
+ default:
81
+ return false;
82
+ }
83
+ }
84
+ case 'object': {
85
+ if (typeof value !== 'object' || value === null) {
86
+ return false;
87
+ }
88
+ if (filter.props) {
89
+ for (const [key, vf] of Object.entries(filter.props)) {
90
+ if (!_filterMatchValueLocal(vf, (value as any)[key])) {
91
+ return false;
92
+ }
93
+ }
94
+ }
95
+ return true;
96
+ }
97
+ case 'in':
98
+ return filter.values.includes(value);
99
+ case 'range':
100
+ return (value as any) >= filter.from && (value as any) <= filter.to;
101
+ case 'not':
102
+ return !_filterMatchValueLocal(filter.filter, value);
103
+ case 'and':
104
+ return filter.filters.every((f) => _filterMatchValueLocal(f, value));
105
+ case 'or':
106
+ return filter.filters.some((f) => _filterMatchValueLocal(f, value));
107
+ default:
108
+ return false;
109
+ }
110
+ };
111
+
112
+ const _filterMatchEntityLocal = (filter: QueryAST.Filter, entity: any): boolean => {
113
+ switch (filter.type) {
114
+ case 'object': {
115
+ if (filter.typename !== null) {
116
+ const typeURI: string | undefined = entity?.['@type'] ?? entity?.system?.type;
117
+ if (!typeURI || typeURI !== filter.typename) {
118
+ return false;
119
+ }
120
+ }
121
+ if (filter.id && filter.id.length > 0 && !filter.id.includes(entity?.id)) {
122
+ return false;
123
+ }
124
+ if (filter.props) {
125
+ for (const [key, vf] of Object.entries(filter.props)) {
126
+ if (key.startsWith('@')) {
127
+ continue;
128
+ }
129
+ if (!_filterMatchValueLocal(vf, entity?.[key])) {
130
+ return false;
131
+ }
132
+ }
133
+ }
134
+ return true;
135
+ }
136
+ case 'not':
137
+ return !_filterMatchEntityLocal(filter.filter, entity);
138
+ case 'and':
139
+ return filter.filters.every((f) => _filterMatchEntityLocal(f, entity));
140
+ case 'or':
141
+ return filter.filters.some((f) => _filterMatchEntityLocal(f, entity));
142
+ default:
143
+ throw new Error(`Filter type '${(filter as any).type}' is not supported in toPredicate.`);
144
+ }
145
+ };
146
+
62
147
  class FilterClass implements Filter$.Any {
63
148
  private static 'variance': Filter$.Any['~Filter'] = {} as Filter$.Any['~Filter'];
64
149
 
65
- static is(value: unknown): value is Filter$.Any {
150
+ static 'is'(value: unknown): value is Filter$.Any {
66
151
  return typeof value === 'object' && value !== null && '~Filter' in value;
67
152
  }
68
153
 
69
- static fromAst(ast: QueryAST.Filter): Filter$.Any {
154
+ static 'fromAst'(ast: QueryAST.Filter): Filter$.Any {
70
155
  return new FilterClass(ast);
71
156
  }
72
157
 
73
- static everything(): FilterClass {
158
+ static 'everything'(): FilterClass {
74
159
  return new FilterClass({
75
160
  type: 'object',
76
161
  typename: null,
@@ -78,7 +163,7 @@ class FilterClass implements Filter$.Any {
78
163
  });
79
164
  }
80
165
 
81
- static nothing(): FilterClass {
166
+ static 'nothing'(): FilterClass {
82
167
  return new FilterClass({
83
168
  type: 'not',
84
169
  filter: {
@@ -89,7 +174,7 @@ class FilterClass implements Filter$.Any {
89
174
  });
90
175
  }
91
176
 
92
- static relation() {
177
+ static 'relation'() {
93
178
  return new FilterClass({
94
179
  type: 'object',
95
180
  typename: null,
@@ -97,7 +182,7 @@ class FilterClass implements Filter$.Any {
97
182
  });
98
183
  }
99
184
 
100
- static id(...ids: EntityId[]): Filter$.Any {
185
+ static 'id'(...ids: EntityId[]): Filter$.Any {
101
186
  // assertArgument(
102
187
  // ids.every((id) => EntityId.isValid(id)),
103
188
  // 'ids',
@@ -116,12 +201,12 @@ class FilterClass implements Filter$.Any {
116
201
  });
117
202
  }
118
203
 
119
- static type<T extends Type$.AnyEntity>(
204
+ static 'type'<T extends Type$.AnyEntity>(
120
205
  type: T,
121
206
  props?: Filter$.Props<Type$.InstanceType<T>>,
122
207
  ): Filter$.Filter<Type$.InstanceType<T>>;
123
- static type(schema: string, props?: Filter$.Props<unknown>): Filter$.Filter<any>;
124
- static type(schema: Type$.AnyEntity | string, props?: Filter$.Props<unknown>): Filter$.Filter<unknown> {
208
+ static 'type'(schema: string, props?: Filter$.Props<unknown>): Filter$.Filter<any>;
209
+ static 'type'(schema: Type$.AnyEntity | string, props?: Filter$.Props<unknown>): Filter$.Filter<unknown> {
125
210
  if (typeof schema !== 'string') {
126
211
  throw new TypeError('expected typename as the first paramter');
127
212
  }
@@ -132,7 +217,7 @@ class FilterClass implements Filter$.Any {
132
217
  });
133
218
  }
134
219
 
135
- static typename(typename: string): Filter$.Any {
220
+ static 'typename'(typename: string): Filter$.Any {
136
221
  return new FilterClass({
137
222
  type: 'object',
138
223
  typename: makeTypeDxn(typename),
@@ -140,7 +225,7 @@ class FilterClass implements Filter$.Any {
140
225
  });
141
226
  }
142
227
 
143
- static typeURI(uri: URI.URI): Filter$.Any {
228
+ static 'typeURI'(uri: URI.URI): Filter$.Any {
144
229
  return new FilterClass({
145
230
  type: 'object',
146
231
  typename: uri,
@@ -148,14 +233,14 @@ class FilterClass implements Filter$.Any {
148
233
  });
149
234
  }
150
235
 
151
- static tag(tag: string): Filter$.Any {
236
+ static 'tag'(tag: string): Filter$.Any {
152
237
  return new FilterClass({
153
238
  type: 'tag',
154
239
  tag,
155
240
  });
156
241
  }
157
242
 
158
- static key(key: string, options?: Filter$.KeyFilterOptions): Filter$.Any {
243
+ static 'key'(key: string, options?: Filter$.KeyFilterOptions): Filter$.Any {
159
244
  return new FilterClass({
160
245
  type: 'object',
161
246
  typename: null,
@@ -165,7 +250,7 @@ class FilterClass implements Filter$.Any {
165
250
  });
166
251
  }
167
252
 
168
- static props<T>(props: Filter$.Props<T>): Filter$.Filter<T> {
253
+ static 'props'<T>(props: Filter$.Props<T>): Filter$.Filter<T> {
169
254
  return new FilterClass({
170
255
  type: 'object',
171
256
  typename: null,
@@ -173,7 +258,7 @@ class FilterClass implements Filter$.Any {
173
258
  });
174
259
  }
175
260
 
176
- static text(text: string, options?: Filter$.TextSearchOptions): Filter$.Any {
261
+ static 'text'(text: string, options?: Filter$.TextSearchOptions): Filter$.Any {
177
262
  return new FilterClass({
178
263
  type: 'text-search',
179
264
  text,
@@ -181,7 +266,7 @@ class FilterClass implements Filter$.Any {
181
266
  });
182
267
  }
183
268
 
184
- static foreignKeys<S extends Type$.AnyEntity | string>(
269
+ static 'foreignKeys'<S extends Type$.AnyEntity | string>(
185
270
  schema: S,
186
271
  keys: ForeignKey[],
187
272
  ): Filter$.Filter<S extends Type$.AnyEntity ? Type$.InstanceType<S> : unknown> {
@@ -195,7 +280,7 @@ class FilterClass implements Filter$.Any {
195
280
  });
196
281
  }
197
282
 
198
- static eq<T>(value: T): Filter$.Filter<T | undefined> {
283
+ static 'eq'<T>(value: T): Filter$.Filter<T | undefined> {
199
284
  if (!isRef(value) && typeof value === 'object' && value !== null) {
200
285
  throw new TypeError('Cannot use object as a value for eq filter');
201
286
  }
@@ -207,7 +292,7 @@ class FilterClass implements Filter$.Any {
207
292
  });
208
293
  }
209
294
 
210
- static neq<T>(value: T): Filter$.Filter<T | undefined> {
295
+ static 'neq'<T>(value: T): Filter$.Filter<T | undefined> {
211
296
  return new FilterClass({
212
297
  type: 'compare',
213
298
  operator: 'neq',
@@ -215,7 +300,7 @@ class FilterClass implements Filter$.Any {
215
300
  });
216
301
  }
217
302
 
218
- static gt<T>(value: T): Filter$.Filter<T | undefined> {
303
+ static 'gt'<T>(value: T): Filter$.Filter<T | undefined> {
219
304
  return new FilterClass({
220
305
  type: 'compare',
221
306
  operator: 'gt',
@@ -223,7 +308,7 @@ class FilterClass implements Filter$.Any {
223
308
  });
224
309
  }
225
310
 
226
- static gte<T>(value: T): Filter$.Filter<T | undefined> {
311
+ static 'gte'<T>(value: T): Filter$.Filter<T | undefined> {
227
312
  return new FilterClass({
228
313
  type: 'compare',
229
314
  operator: 'gte',
@@ -231,7 +316,7 @@ class FilterClass implements Filter$.Any {
231
316
  });
232
317
  }
233
318
 
234
- static lt<T>(value: T): Filter$.Filter<T | undefined> {
319
+ static 'lt'<T>(value: T): Filter$.Filter<T | undefined> {
235
320
  return new FilterClass({
236
321
  type: 'compare',
237
322
  operator: 'lt',
@@ -239,7 +324,7 @@ class FilterClass implements Filter$.Any {
239
324
  });
240
325
  }
241
326
 
242
- static lte<T>(value: T): Filter$.Filter<T | undefined> {
327
+ static 'lte'<T>(value: T): Filter$.Filter<T | undefined> {
243
328
  return new FilterClass({
244
329
  type: 'compare',
245
330
  operator: 'lte',
@@ -247,21 +332,21 @@ class FilterClass implements Filter$.Any {
247
332
  });
248
333
  }
249
334
 
250
- static in<T>(...values: T[]): Filter$.Filter<T> {
335
+ static 'in'<T>(...values: T[]): Filter$.Filter<T> {
251
336
  return new FilterClass({
252
337
  type: 'in',
253
338
  values,
254
339
  });
255
340
  }
256
341
 
257
- static contains<T>(value: T): Filter$.Filter<readonly T[] | undefined> {
342
+ static 'contains'<T>(value: T): Filter$.Filter<readonly T[] | undefined> {
258
343
  return new FilterClass({
259
344
  type: 'contains',
260
345
  value,
261
346
  });
262
347
  }
263
348
 
264
- static between<T>(from: T, to: T): Filter$.Filter<T> {
349
+ static 'between'<T>(from: T, to: T): Filter$.Filter<T> {
265
350
  return new FilterClass({
266
351
  type: 'range',
267
352
  from,
@@ -269,15 +354,15 @@ class FilterClass implements Filter$.Any {
269
354
  });
270
355
  }
271
356
 
272
- static updated(range: { after?: Date | number; before?: Date | number }): Filter$.Any {
357
+ static 'updated'(range: { after?: Date | number; before?: Date | number }): Filter$.Any {
273
358
  return FilterClass._timeRangeFilter('updatedAt', range);
274
359
  }
275
360
 
276
- static created(range: { after?: Date | number; before?: Date | number }): Filter$.Any {
361
+ static 'created'(range: { after?: Date | number; before?: Date | number }): Filter$.Any {
277
362
  return FilterClass._timeRangeFilter('createdAt', range);
278
363
  }
279
364
 
280
- static childOf(parents: unknown | unknown[], options?: { transitive?: boolean }): Filter$.Any {
365
+ static 'childOf'(parents: unknown | unknown[], options?: { transitive?: boolean }): Filter$.Any {
281
366
  const items = Array.isArray(parents) ? parents : [parents];
282
367
  const dxns = items.map((item) => {
283
368
  if (isEchoUriLike(item)) {
@@ -292,7 +377,7 @@ class FilterClass implements Filter$.Any {
292
377
  });
293
378
  }
294
379
 
295
- private static _timeRangeFilter(
380
+ private static '_timeRangeFilter'(
296
381
  field: 'updatedAt' | 'createdAt',
297
382
  range: { after?: Date | number; before?: Date | number },
298
383
  ): Filter$.Any {
@@ -310,14 +395,14 @@ class FilterClass implements Filter$.Any {
310
395
  return filters.length === 1 ? filters[0] : FilterClass.and(...filters);
311
396
  }
312
397
 
313
- static not<F extends Filter$.Any>(filter: F): Filter$.Filter<Filter$.Type<F>> {
398
+ static 'not'<F extends Filter$.Any>(filter: F): Filter$.Filter<Filter$.Type<F>> {
314
399
  return new FilterClass({
315
400
  type: 'not',
316
401
  filter: filter.ast,
317
402
  });
318
403
  }
319
404
 
320
- static and<Filters extends readonly Filter$.Any[]>(
405
+ static 'and'<Filters extends readonly Filter$.Any[]>(
321
406
  ...filters: Filters
322
407
  ): Filter$.Filter<Filter$.Type<Filters[number]>> {
323
408
  return new FilterClass({
@@ -326,7 +411,7 @@ class FilterClass implements Filter$.Any {
326
411
  });
327
412
  }
328
413
 
329
- static or<Filters extends readonly Filter$.Any[]>(
414
+ static 'or'<Filters extends readonly Filter$.Any[]>(
330
415
  ...filters: Filters
331
416
  ): Filter$.Filter<Filter$.Type<Filters[number]>> {
332
417
  return new FilterClass({
@@ -336,11 +421,21 @@ class FilterClass implements Filter$.Any {
336
421
  }
337
422
 
338
423
  /** Returns a human-readable string representation of a Filter AST. */
339
- static pretty(filter: Filter$.Any): string {
424
+ static 'pretty'(filter: Filter$.Any): string {
340
425
  return prettyFilter(filter.ast);
341
426
  }
342
427
 
343
- private constructor(public readonly ast: QueryAST.Filter) {}
428
+ /** Create a predicate from a filter. */
429
+ // Cast required: TypeScript cannot verify a plain overloaded function satisfies a type-predicate
430
+ // overload signature without the cast; Effect's dual() has the same limitation here.
431
+ static 'toPredicate' = ((entityOrFilter: any, filter?: any): any => {
432
+ if (filter === undefined) {
433
+ return (entity: any) => _filterMatchEntityLocal(entityOrFilter.ast, entity);
434
+ }
435
+ return _filterMatchEntityLocal(filter.ast, entityOrFilter);
436
+ }) as typeof Filter$.toPredicate;
437
+
438
+ private 'constructor'(public readonly ast: QueryAST.Filter) {}
344
439
 
345
440
  '~Filter' = FilterClass.variance;
346
441
  }
@@ -402,22 +497,22 @@ const processPredicate = (predicate: any): QueryAST.Filter => {
402
497
  class QueryClass implements Query$.Any {
403
498
  private static 'variance': Query$.Any['~Query'] = {} as Query$.Any['~Query'];
404
499
 
405
- static is(value: unknown): value is Query$.Any {
500
+ static 'is'(value: unknown): value is Query$.Any {
406
501
  return typeof value === 'object' && value !== null && '~Query' in value;
407
502
  }
408
503
 
409
- static fromAst(ast: QueryAST.Query): Query$.Any {
504
+ static 'fromAst'(ast: QueryAST.Query): Query$.Any {
410
505
  return new QueryClass(ast);
411
506
  }
412
507
 
413
- static select<F extends Filter$.Any>(filter: F): Query$.Query<Filter$.Type<F>> {
508
+ static 'select'<F extends Filter$.Any>(filter: F): Query$.Query<Filter$.Type<F>> {
414
509
  return new QueryClass({
415
510
  type: 'select',
416
511
  filter: filter.ast,
417
512
  });
418
513
  }
419
514
 
420
- select(filter: Filter$.Any | Filter$.Props<any>): Query$.Any {
515
+ 'select'(filter: Filter$.Any | Filter$.Props<any>): Query$.Any {
421
516
  if (FilterClass.is(filter)) {
422
517
  return new QueryClass({
423
518
  type: 'filter',
@@ -433,13 +528,13 @@ class QueryClass implements Query$.Any {
433
528
  }
434
529
  }
435
530
 
436
- static type<S extends Schema.Schema.All>(
531
+ static 'type'<S extends Schema.Schema.All>(
437
532
  schema: S,
438
533
  predicates?: Filter$.Props<Schema.Schema.Type<S>>,
439
534
  ): Query$.Query<Schema.Schema.Type<S>>;
440
- static type(type: Type$.Type, predicates?: Filter$.Props<Obj$.Unknown>): Query$.Query<Obj$.Unknown>;
441
- static type(schema: string, predicates?: Filter$.Props<unknown>): Query$.Query<any>;
442
- static type(schema: Schema.Schema.All | Type$.Type | string, predicates?: Filter$.Props<unknown>): Query$.Any {
535
+ static 'type'(type: Type$.Type, predicates?: Filter$.Props<Obj$.Unknown>): Query$.Query<Obj$.Unknown>;
536
+ static 'type'(schema: string, predicates?: Filter$.Props<unknown>): Query$.Query<any>;
537
+ static 'type'(schema: Schema.Schema.All | Type$.Type | string, predicates?: Filter$.Props<unknown>): Query$.Any {
443
538
  if (typeof schema !== 'string') {
444
539
  throw new TypeError('expected typename as the first paramter');
445
540
  }
@@ -449,7 +544,7 @@ class QueryClass implements Query$.Any {
449
544
  });
450
545
  }
451
546
 
452
- static all(...queries: Query$.Any[]): Query$.Any {
547
+ static 'all'(...queries: Query$.Any[]): Query$.Any {
453
548
  if (queries.length === 0) {
454
549
  throw new TypeError(
455
550
  'Query.all combines results of multiple queries, to query all objects use Query.select(Filter.everything())',
@@ -461,7 +556,7 @@ class QueryClass implements Query$.Any {
461
556
  });
462
557
  }
463
558
 
464
- static without<T>(source: Query$.Query<T>, exclude: Query$.Query<T>): Query$.Query<T> {
559
+ static 'without'<T>(source: Query$.Query<T>, exclude: Query$.Query<T>): Query$.Query<T> {
465
560
  return new QueryClass({
466
561
  type: 'set-difference',
467
562
  source: source.ast,
@@ -469,7 +564,7 @@ class QueryClass implements Query$.Any {
469
564
  });
470
565
  }
471
566
 
472
- static from(...args: any[]): Query$.Any {
567
+ static 'from'(...args: any[]): Query$.Any {
473
568
  const baseQuery: QueryAST.Query = {
474
569
  type: 'select',
475
570
  filter: FilterClass.everything().ast,
@@ -478,7 +573,7 @@ class QueryClass implements Query$.Any {
478
573
  return (wrapper.from as (...args: any[]) => Query$.Any)(...args);
479
574
  }
480
575
 
481
- from(...args: any[]): Query$.Any {
576
+ 'from'(...args: any[]): Query$.Any {
482
577
  // Variadic raw scopes: `.from(Scope.space(), Scope.registry())`.
483
578
  if (args.length > 1 && args.every((arg) => _isScopeLike(arg))) {
484
579
  return new QueryClass({
@@ -509,15 +604,15 @@ class QueryClass implements Query$.Any {
509
604
  }
510
605
 
511
606
  /** Returns a human-readable string representation of a Query AST. */
512
- static pretty(query: Query$.Any): string {
607
+ static 'pretty'(query: Query$.Any): string {
513
608
  return prettyQuery(query.ast);
514
609
  }
515
610
 
516
- constructor(public readonly ast: QueryAST.Query) {}
611
+ 'constructor'(public readonly ast: QueryAST.Query) {}
517
612
 
518
613
  '~Query' = QueryClass.variance;
519
614
 
520
- reference(key: string): Query$.Any {
615
+ 'reference'(key: string): Query$.Any {
521
616
  return new QueryClass({
522
617
  type: 'reference-traversal',
523
618
  anchor: this.ast,
@@ -525,7 +620,7 @@ class QueryClass implements Query$.Any {
525
620
  });
526
621
  }
527
622
 
528
- referencedBy(target?: Type$.AnyEntity | string, key?: string): Query$.Any {
623
+ 'referencedBy'(target?: Type$.AnyEntity | string, key?: string): Query$.Any {
529
624
  if (target !== undefined && typeof target !== 'string') {
530
625
  throw new TypeError('referencedBy requires a typename string in query-lite');
531
626
  }
@@ -538,7 +633,7 @@ class QueryClass implements Query$.Any {
538
633
  });
539
634
  }
540
635
 
541
- sourceOf(
636
+ 'sourceOf'(
542
637
  relation?: Type$.Relation<any, any, any, any> | string,
543
638
  predicates?: Filter$.Props<unknown> | undefined,
544
639
  ): Query$.Any {
@@ -555,7 +650,7 @@ class QueryClass implements Query$.Any {
555
650
  });
556
651
  }
557
652
 
558
- targetOf(
653
+ 'targetOf'(
559
654
  relation?: Type$.Relation<any, any, any, any> | string,
560
655
  predicates?: Filter$.Props<unknown> | undefined,
561
656
  ): Query$.Any {
@@ -572,7 +667,7 @@ class QueryClass implements Query$.Any {
572
667
  });
573
668
  }
574
669
 
575
- source(): Query$.Any {
670
+ 'source'(): Query$.Any {
576
671
  return new QueryClass({
577
672
  type: 'relation-traversal',
578
673
  anchor: this.ast,
@@ -580,7 +675,7 @@ class QueryClass implements Query$.Any {
580
675
  });
581
676
  }
582
677
 
583
- target(): Query$.Any {
678
+ 'target'(): Query$.Any {
584
679
  return new QueryClass({
585
680
  type: 'relation-traversal',
586
681
  anchor: this.ast,
@@ -588,7 +683,7 @@ class QueryClass implements Query$.Any {
588
683
  });
589
684
  }
590
685
 
591
- parent(): Query$.Any {
686
+ 'parent'(): Query$.Any {
592
687
  return new QueryClass({
593
688
  type: 'hierarchy-traversal',
594
689
  anchor: this.ast,
@@ -596,7 +691,7 @@ class QueryClass implements Query$.Any {
596
691
  });
597
692
  }
598
693
 
599
- children(): Query$.Any {
694
+ 'children'(): Query$.Any {
600
695
  return new QueryClass({
601
696
  type: 'hierarchy-traversal',
602
697
  anchor: this.ast,
@@ -604,7 +699,7 @@ class QueryClass implements Query$.Any {
604
699
  });
605
700
  }
606
701
 
607
- orderBy(...order: Order$.Any[]): Query$.Any {
702
+ 'orderBy'(...order: Order$.Any[]): Query$.Any {
608
703
  return new QueryClass({
609
704
  type: 'order',
610
705
  query: this.ast,
@@ -612,7 +707,7 @@ class QueryClass implements Query$.Any {
612
707
  });
613
708
  }
614
709
 
615
- limit(limit: number): Query$.Any {
710
+ 'limit'(limit: number): Query$.Any {
616
711
  return new QueryClass({
617
712
  type: 'limit',
618
713
  query: this.ast,
@@ -620,7 +715,7 @@ class QueryClass implements Query$.Any {
620
715
  });
621
716
  }
622
717
 
623
- options(options: QueryAST.QueryOptions): Query$.Any {
718
+ 'options'(options: QueryAST.QueryOptions): Query$.Any {
624
719
  return new QueryClass({
625
720
  type: 'options',
626
721
  query: this.ast,
@@ -628,7 +723,7 @@ class QueryClass implements Query$.Any {
628
723
  });
629
724
  }
630
725
 
631
- debugLabel(label: string): Query$.Any {
726
+ 'debugLabel'(label: string): Query$.Any {
632
727
  if (this.ast.type === 'options') {
633
728
  return new QueryClass({
634
729
  type: 'options',