@dxos/echo-protocol 0.8.4-main.f5c0578 → 0.8.4-main.fcfe5033a5

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/src/query/ast.ts CHANGED
@@ -2,14 +2,15 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Match from 'effect/Match';
6
+ import * as Schema from 'effect/Schema';
6
7
 
7
8
  import { DXN, ObjectId } from '@dxos/keys';
8
9
 
9
10
  import { ForeignKey } from '../foreign-key';
10
11
 
11
12
  const TypenameSpecifier = Schema.Union(DXN.Schema, Schema.Null).annotations({
12
- description: 'DXN or null. Null means any type will match',
13
+ description: 'DXN or null; null matches any type',
13
14
  });
14
15
 
15
16
  // NOTE: This pattern with 3 definitions per schema is need to make the types opaque, and circular references in AST to not cause compiler errors.
@@ -46,6 +47,9 @@ const FilterObject_ = Schema.Struct({
46
47
  export interface FilterObject extends Schema.Schema.Type<typeof FilterObject_> {}
47
48
  export const FilterObject: Schema.Schema<FilterObject> = FilterObject_;
48
49
 
50
+ /**
51
+ * Compare.
52
+ */
49
53
  const FilterCompare_ = Schema.Struct({
50
54
  type: Schema.Literal('compare'),
51
55
  operator: Schema.Literal('eq', 'neq', 'gt', 'gte', 'lt', 'lte'),
@@ -54,6 +58,9 @@ const FilterCompare_ = Schema.Struct({
54
58
  export interface FilterCompare extends Schema.Schema.Type<typeof FilterCompare_> {}
55
59
  export const FilterCompare: Schema.Schema<FilterCompare> = FilterCompare_;
56
60
 
61
+ /**
62
+ * In.
63
+ */
57
64
  const FilterIn_ = Schema.Struct({
58
65
  type: Schema.Literal('in'),
59
66
  values: Schema.Array(Schema.Any),
@@ -61,53 +68,137 @@ const FilterIn_ = Schema.Struct({
61
68
  export interface FilterIn extends Schema.Schema.Type<typeof FilterIn_> {}
62
69
  export const FilterIn: Schema.Schema<FilterIn> = FilterIn_;
63
70
 
71
+ /**
72
+ * Contains.
73
+ */
74
+ const FilterContains_ = Schema.Struct({
75
+ type: Schema.Literal('contains'),
76
+ value: Schema.Any,
77
+ });
78
+
79
+ export interface FilterContains extends Schema.Schema.Type<typeof FilterContains_> {}
80
+
81
+ /**
82
+ * Predicate for an array property to contain the provided value.
83
+ * Nested objects are matched using strict structural matching.
84
+ */
85
+ export const FilterContains: Schema.Schema<FilterContains> = FilterContains_;
86
+
87
+ /**
88
+ * Filters objects that have certain tag.
89
+ */
90
+ const FilterTag_ = Schema.Struct({
91
+ type: Schema.Literal('tag'),
92
+ tag: Schema.String, // TODO(burdon): Make OR-collection?
93
+ });
94
+
95
+ export interface FilterTag extends Schema.Schema.Type<typeof FilterTag_> {}
96
+ export const FilterTag: Schema.Schema<FilterTag> = FilterTag_;
97
+
98
+ /**
99
+ * Range.
100
+ */
64
101
  const FilterRange_ = Schema.Struct({
65
102
  type: Schema.Literal('range'),
66
103
  from: Schema.Any,
67
104
  to: Schema.Any,
68
105
  });
106
+
69
107
  export interface FilterRange extends Schema.Schema.Type<typeof FilterRange_> {}
70
108
  export const FilterRange: Schema.Schema<FilterRange> = FilterRange_;
71
109
 
110
+ /**
111
+ * Filter by system timestamp (createdAt / updatedAt).
112
+ * Timestamps are unix milliseconds stored in the object meta index.
113
+ */
114
+ const FilterTimestamp_ = Schema.Struct({
115
+ type: Schema.Literal('timestamp'),
116
+ field: Schema.Literal('createdAt', 'updatedAt'),
117
+ operator: Schema.Literal('gt', 'gte', 'lt', 'lte'),
118
+ value: Schema.Number,
119
+ });
120
+
121
+ export interface FilterTimestamp extends Schema.Schema.Type<typeof FilterTimestamp_> {}
122
+ export const FilterTimestamp: Schema.Schema<FilterTimestamp> = FilterTimestamp_;
123
+
124
+ /**
125
+ * Text search.
126
+ */
72
127
  const FilterTextSearch_ = Schema.Struct({
73
128
  type: Schema.Literal('text-search'),
74
129
  text: Schema.String,
75
130
  searchKind: Schema.optional(Schema.Literal('full-text', 'vector')),
76
131
  });
132
+
77
133
  export interface FilterTextSearch extends Schema.Schema.Type<typeof FilterTextSearch_> {}
78
134
  export const FilterTextSearch: Schema.Schema<FilterTextSearch> = FilterTextSearch_;
79
135
 
136
+ /**
137
+ * Not.
138
+ */
80
139
  const FilterNot_ = Schema.Struct({
81
140
  type: Schema.Literal('not'),
82
141
  filter: Schema.suspend(() => Filter),
83
142
  });
143
+
84
144
  export interface FilterNot extends Schema.Schema.Type<typeof FilterNot_> {}
85
145
  export const FilterNot: Schema.Schema<FilterNot> = FilterNot_;
86
146
 
147
+ /**
148
+ * And.
149
+ */
87
150
  const FilterAnd_ = Schema.Struct({
88
151
  type: Schema.Literal('and'),
89
152
  filters: Schema.Array(Schema.suspend(() => Filter)),
90
153
  });
154
+
91
155
  export interface FilterAnd extends Schema.Schema.Type<typeof FilterAnd_> {}
92
156
  export const FilterAnd: Schema.Schema<FilterAnd> = FilterAnd_;
93
157
 
158
+ /**
159
+ * Or.
160
+ */
94
161
  const FilterOr_ = Schema.Struct({
95
162
  type: Schema.Literal('or'),
96
163
  filters: Schema.Array(Schema.suspend(() => Filter)),
97
164
  });
165
+
98
166
  export interface FilterOr extends Schema.Schema.Type<typeof FilterOr_> {}
99
167
  export const FilterOr: Schema.Schema<FilterOr> = FilterOr_;
100
168
 
169
+ /**
170
+ * Filter objects that are children of the specified parents.
171
+ * With transitive=true (default), matches grandchildren and beyond.
172
+ */
173
+ const FilterChildOf_ = Schema.Struct({
174
+ type: Schema.Literal('child-of'),
175
+ /** Parent DXNs to match children of. */
176
+ parents: Schema.Array(DXN.Schema),
177
+ /** Whether to match transitively (grandchildren, etc.). Defaults to true. */
178
+ transitive: Schema.Boolean,
179
+ });
180
+
181
+ export interface FilterChildOf extends Schema.Schema.Type<typeof FilterChildOf_> {}
182
+ export const FilterChildOf: Schema.Schema<FilterChildOf> = FilterChildOf_;
183
+
184
+ /**
185
+ * Union of filters.
186
+ */
101
187
  export const Filter = Schema.Union(
102
188
  FilterObject,
103
- FilterTextSearch,
104
189
  FilterCompare,
105
190
  FilterIn,
191
+ FilterContains,
192
+ FilterTag,
106
193
  FilterRange,
194
+ FilterTimestamp,
195
+ FilterTextSearch,
196
+ FilterChildOf,
107
197
  FilterNot,
108
198
  FilterAnd,
109
199
  FilterOr,
110
- );
200
+ ).annotations({ identifier: 'org.dxos.schema.filter' });
201
+
111
202
  export type Filter = Schema.Schema.Type<typeof Filter>;
112
203
 
113
204
  /**
@@ -117,6 +208,7 @@ const QuerySelectClause_ = Schema.Struct({
117
208
  type: Schema.Literal('select'),
118
209
  filter: Schema.suspend(() => Filter),
119
210
  });
211
+
120
212
  export interface QuerySelectClause extends Schema.Schema.Type<typeof QuerySelectClause_> {}
121
213
  export const QuerySelectClause: Schema.Schema<QuerySelectClause> = QuerySelectClause_;
122
214
 
@@ -128,6 +220,7 @@ const QueryFilterClause_ = Schema.Struct({
128
220
  selection: Schema.suspend(() => Query),
129
221
  filter: Schema.suspend(() => Filter),
130
222
  });
223
+
131
224
  export interface QueryFilterClause extends Schema.Schema.Type<typeof QueryFilterClause_> {}
132
225
  export const QueryFilterClause: Schema.Schema<QueryFilterClause> = QueryFilterClause_;
133
226
 
@@ -139,6 +232,7 @@ const QueryReferenceTraversalClause_ = Schema.Struct({
139
232
  anchor: Schema.suspend(() => Query),
140
233
  property: Schema.String, // TODO(dmaretskyi): Change to EscapedPropPath.
141
234
  });
235
+
142
236
  export interface QueryReferenceTraversalClause extends Schema.Schema.Type<typeof QueryReferenceTraversalClause_> {}
143
237
  export const QueryReferenceTraversalClause: Schema.Schema<QueryReferenceTraversalClause> =
144
238
  QueryReferenceTraversalClause_;
@@ -149,9 +243,14 @@ export const QueryReferenceTraversalClause: Schema.Schema<QueryReferenceTraversa
149
243
  const QueryIncomingReferencesClause_ = Schema.Struct({
150
244
  type: Schema.Literal('incoming-references'),
151
245
  anchor: Schema.suspend(() => Query),
152
- property: Schema.String,
246
+ /**
247
+ * Property path where the reference is located.
248
+ * If null, matches references from any property.
249
+ */
250
+ property: Schema.NullOr(Schema.String),
153
251
  typename: TypenameSpecifier,
154
252
  });
253
+
155
254
  export interface QueryIncomingReferencesClause extends Schema.Schema.Type<typeof QueryIncomingReferencesClause_> {}
156
255
  export const QueryIncomingReferencesClause: Schema.Schema<QueryIncomingReferencesClause> =
157
256
  QueryIncomingReferencesClause_;
@@ -170,6 +269,7 @@ const QueryRelationClause_ = Schema.Struct({
170
269
  direction: Schema.Literal('outgoing', 'incoming', 'both'),
171
270
  filter: Schema.optional(Schema.suspend(() => Filter)),
172
271
  });
272
+
173
273
  export interface QueryRelationClause extends Schema.Schema.Type<typeof QueryRelationClause_> {}
174
274
  export const QueryRelationClause: Schema.Schema<QueryRelationClause> = QueryRelationClause_;
175
275
 
@@ -181,9 +281,27 @@ const QueryRelationTraversalClause_ = Schema.Struct({
181
281
  anchor: Schema.suspend(() => Query),
182
282
  direction: Schema.Literal('source', 'target', 'both'),
183
283
  });
284
+
184
285
  export interface QueryRelationTraversalClause extends Schema.Schema.Type<typeof QueryRelationTraversalClause_> {}
185
286
  export const QueryRelationTraversalClause: Schema.Schema<QueryRelationTraversalClause> = QueryRelationTraversalClause_;
186
287
 
288
+ /**
289
+ * Traverse parent-child hierarchy.
290
+ */
291
+ const QueryHierarchyTraversalClause_ = Schema.Struct({
292
+ type: Schema.Literal('hierarchy-traversal'),
293
+ anchor: Schema.suspend(() => Query),
294
+ /**
295
+ * to-parent: traverse from child to parent.
296
+ * to-children: traverse from parent to children.
297
+ */
298
+ direction: Schema.Literal('to-parent', 'to-children'),
299
+ });
300
+
301
+ export interface QueryHierarchyTraversalClause extends Schema.Schema.Type<typeof QueryHierarchyTraversalClause_> {}
302
+ export const QueryHierarchyTraversalClause: Schema.Schema<QueryHierarchyTraversalClause> =
303
+ QueryHierarchyTraversalClause_;
304
+
187
305
  /**
188
306
  * Union of multiple queries.
189
307
  */
@@ -191,6 +309,7 @@ const QueryUnionClause_ = Schema.Struct({
191
309
  type: Schema.Literal('union'),
192
310
  queries: Schema.Array(Schema.suspend(() => Query)),
193
311
  });
312
+
194
313
  export interface QueryUnionClause extends Schema.Schema.Type<typeof QueryUnionClause_> {}
195
314
  export const QueryUnionClause: Schema.Schema<QueryUnionClause> = QueryUnionClause_;
196
315
 
@@ -202,9 +321,47 @@ const QuerySetDifferenceClause_ = Schema.Struct({
202
321
  source: Schema.suspend(() => Query),
203
322
  exclude: Schema.suspend(() => Query),
204
323
  });
324
+
205
325
  export interface QuerySetDifferenceClause extends Schema.Schema.Type<typeof QuerySetDifferenceClause_> {}
206
326
  export const QuerySetDifferenceClause: Schema.Schema<QuerySetDifferenceClause> = QuerySetDifferenceClause_;
207
327
 
328
+ export const OrderDirection = Schema.Literal('asc', 'desc');
329
+ export type OrderDirection = Schema.Schema.Type<typeof OrderDirection>;
330
+
331
+ const Order_ = Schema.Union(
332
+ Schema.Struct({
333
+ // How database wants to order them (in practice - by id).
334
+ kind: Schema.Literal('natural'),
335
+ }),
336
+ Schema.Struct({
337
+ kind: Schema.Literal('property'),
338
+ property: Schema.String,
339
+ direction: OrderDirection,
340
+ }),
341
+ Schema.Struct({
342
+ // Order by relevance rank (for FTS/vector search results).
343
+ // Default direction is 'desc' (higher rank = better match first).
344
+ kind: Schema.Literal('rank'),
345
+ direction: OrderDirection,
346
+ }),
347
+ );
348
+
349
+ export type Order = Schema.Schema.Type<typeof Order_>;
350
+ export const Order: Schema.Schema<Order> = Order_;
351
+
352
+ /**
353
+ * Order the query results.
354
+ * Left-to-right the orders dominate.
355
+ */
356
+ const QueryOrderClause_ = Schema.Struct({
357
+ type: Schema.Literal('order'),
358
+ query: Schema.suspend(() => Query),
359
+ order: Schema.Array(Order),
360
+ });
361
+
362
+ export interface QueryOrderClause extends Schema.Schema.Type<typeof QueryOrderClause_> {}
363
+ export const QueryOrderClause: Schema.Schema<QueryOrderClause> = QueryOrderClause_;
364
+
208
365
  /**
209
366
  * Add options to a query.
210
367
  */
@@ -213,9 +370,37 @@ const QueryOptionsClause_ = Schema.Struct({
213
370
  query: Schema.suspend(() => Query),
214
371
  options: Schema.suspend(() => QueryOptions),
215
372
  });
373
+
216
374
  export interface QueryOptionsClause extends Schema.Schema.Type<typeof QueryOptionsClause_> {}
217
375
  export const QueryOptionsClause: Schema.Schema<QueryOptionsClause> = QueryOptionsClause_;
218
376
 
377
+ /**
378
+ * Limit the number of results.
379
+ */
380
+ const QueryLimitClause_ = Schema.Struct({
381
+ type: Schema.Literal('limit'),
382
+ query: Schema.suspend(() => Query),
383
+ limit: Schema.Number,
384
+ });
385
+
386
+ export interface QueryLimitClause extends Schema.Schema.Type<typeof QueryLimitClause_> {}
387
+ export const QueryLimitClause: Schema.Schema<QueryLimitClause> = QueryLimitClause_;
388
+
389
+ export const QueryFromClause_ = Schema.Struct({
390
+ type: Schema.Literal('from'),
391
+ query: Schema.suspend(() => Query),
392
+ from: Schema.Union(
393
+ Schema.TaggedStruct('scope', {
394
+ scope: Schema.suspend(() => Scope),
395
+ }),
396
+ Schema.TaggedStruct('query', {
397
+ query: Schema.suspend(() => Query),
398
+ }),
399
+ ),
400
+ });
401
+ export interface QueryFromClause extends Schema.Schema.Type<typeof QueryFromClause_> {}
402
+ export const QueryFromClause: Schema.Schema<QueryFromClause> = QueryFromClause_;
403
+
219
404
  const Query_ = Schema.Union(
220
405
  QuerySelectClause,
221
406
  QueryFilterClause,
@@ -223,46 +408,137 @@ const Query_ = Schema.Union(
223
408
  QueryIncomingReferencesClause,
224
409
  QueryRelationClause,
225
410
  QueryRelationTraversalClause,
411
+ QueryHierarchyTraversalClause,
226
412
  QueryUnionClause,
227
413
  QuerySetDifferenceClause,
414
+ QueryOrderClause,
228
415
  QueryOptionsClause,
229
- );
416
+ QueryLimitClause,
417
+ QueryFromClause,
418
+ ).annotations({ identifier: 'org.dxos.schema.query' });
230
419
 
231
420
  export type Query = Schema.Schema.Type<typeof Query_>;
232
421
  export const Query: Schema.Schema<Query> = Query_;
233
422
 
234
423
  export const QueryOptions = Schema.Struct({
235
- spaceIds: Schema.optional(Schema.Array(Schema.String)),
424
+ /**
425
+ * Nested select statements will use this option to filter deleted objects.
426
+ */
236
427
  deleted: Schema.optional(Schema.Literal('include', 'exclude', 'only')),
237
428
  });
429
+
238
430
  export interface QueryOptions extends Schema.Schema.Type<typeof QueryOptions> {}
239
431
 
432
+ /**
433
+ * Specifies the scope of the data to query from.
434
+ */
435
+ export const Scope = Schema.Struct({
436
+ /**
437
+ * The nested select statemets will select from the given spaces.
438
+ *
439
+ * NOTE: Spaces and queues are unioned together if both are specified.
440
+ */
441
+ spaceIds: Schema.optional(Schema.Array(Schema.String)),
442
+
443
+ /**
444
+ * If true, the nested select statements will select from all queues in the spaces specified by `spaceIds`.
445
+ */
446
+ allQueuesFromSpaces: Schema.optional(Schema.Boolean),
447
+
448
+ /**
449
+ * The nested select statemets will select from the given queues.
450
+ *
451
+ * NOTE: Spaces and queues are unioned together if both are specified.
452
+ */
453
+ queues: Schema.optional(Schema.Array(DXN.Schema)),
454
+ });
455
+ export interface Scope extends Schema.Schema.Type<typeof Scope> {}
456
+
240
457
  export const visit = (query: Query, visitor: (node: Query) => void) => {
241
- switch (query.type) {
242
- case 'filter':
243
- visit(query.selection, visitor);
244
- break;
245
- case 'reference-traversal':
246
- visit(query.anchor, visitor);
247
- break;
248
- case 'incoming-references':
249
- visit(query.anchor, visitor);
250
- break;
251
- case 'relation':
252
- visit(query.anchor, visitor);
253
- break;
254
- case 'options':
255
- visit(query.query, visitor);
256
- break;
257
- case 'relation-traversal':
258
- visit(query.anchor, visitor);
259
- break;
260
- case 'union':
261
- query.queries.forEach((q) => visit(q, visitor));
262
- break;
263
- case 'set-difference':
264
- visit(query.source, visitor);
265
- visit(query.exclude, visitor);
266
- break;
267
- }
458
+ visitor(query);
459
+
460
+ Match.value(query).pipe(
461
+ Match.when({ type: 'filter' }, ({ selection }) => visit(selection, visitor)),
462
+ Match.when({ type: 'reference-traversal' }, ({ anchor }) => visit(anchor, visitor)),
463
+ Match.when({ type: 'incoming-references' }, ({ anchor }) => visit(anchor, visitor)),
464
+ Match.when({ type: 'relation' }, ({ anchor }) => visit(anchor, visitor)),
465
+ Match.when({ type: 'options' }, ({ query }) => visit(query, visitor)),
466
+ Match.when({ type: 'relation-traversal' }, ({ anchor }) => visit(anchor, visitor)),
467
+ Match.when({ type: 'hierarchy-traversal' }, ({ anchor }) => visit(anchor, visitor)),
468
+ Match.when({ type: 'union' }, ({ queries }) => queries.forEach((q) => visit(q, visitor))),
469
+ Match.when({ type: 'set-difference' }, ({ source, exclude }) => {
470
+ visit(source, visitor);
471
+ visit(exclude, visitor);
472
+ }),
473
+ Match.when({ type: 'order' }, ({ query }) => visit(query, visitor)),
474
+ Match.when({ type: 'limit' }, ({ query }) => visit(query, visitor)),
475
+ Match.when({ type: 'from' }, (node) => {
476
+ visit(node.query, visitor);
477
+ if (node.from._tag === 'query') {
478
+ visit(node.from.query, visitor);
479
+ }
480
+ }),
481
+ Match.when({ type: 'select' }, () => {}),
482
+ Match.exhaustive,
483
+ );
484
+ };
485
+
486
+ /**
487
+ * Recursively transforms a query tree bottom-up.
488
+ * The mapper receives each node with its children already transformed.
489
+ */
490
+ export const map = (query: Query, mapper: (node: Query) => Query): Query => {
491
+ const mapped: Query = Match.value(query).pipe(
492
+ Match.when({ type: 'filter' }, (node) => ({ ...node, selection: map(node.selection, mapper) })),
493
+ Match.when({ type: 'reference-traversal' }, (node) => ({ ...node, anchor: map(node.anchor, mapper) })),
494
+ Match.when({ type: 'incoming-references' }, (node) => ({ ...node, anchor: map(node.anchor, mapper) })),
495
+ Match.when({ type: 'relation' }, (node) => ({ ...node, anchor: map(node.anchor, mapper) })),
496
+ Match.when({ type: 'relation-traversal' }, (node) => ({ ...node, anchor: map(node.anchor, mapper) })),
497
+ Match.when({ type: 'hierarchy-traversal' }, (node) => ({ ...node, anchor: map(node.anchor, mapper) })),
498
+ Match.when({ type: 'options' }, (node) => ({ ...node, query: map(node.query, mapper) })),
499
+ Match.when({ type: 'order' }, (node) => ({ ...node, query: map(node.query, mapper) })),
500
+ Match.when({ type: 'limit' }, (node) => ({ ...node, query: map(node.query, mapper) })),
501
+ Match.when({ type: 'from' }, (node) => ({
502
+ ...node,
503
+ query: map(node.query, mapper),
504
+ ...(node.from._tag === 'query' ? { from: { _tag: 'query' as const, query: map(node.from.query, mapper) } } : {}),
505
+ })),
506
+ Match.when({ type: 'union' }, (node) => ({ ...node, queries: node.queries.map((q) => map(q, mapper)) })),
507
+ Match.when({ type: 'set-difference' }, (node) => ({
508
+ ...node,
509
+ source: map(node.source, mapper),
510
+ exclude: map(node.exclude, mapper),
511
+ })),
512
+ Match.when({ type: 'select' }, (node) => node),
513
+ Match.exhaustive,
514
+ );
515
+ return mapper(mapped);
516
+ };
517
+
518
+ export const fold = <T>(query: Query, reducer: (node: Query) => T): T[] => {
519
+ return Match.value(query).pipe(
520
+ Match.withReturnType<T[]>(),
521
+ Match.when({ type: 'filter' }, ({ selection }) => fold(selection, reducer)),
522
+ Match.when({ type: 'reference-traversal' }, ({ anchor }) => fold(anchor, reducer)),
523
+ Match.when({ type: 'incoming-references' }, ({ anchor }) => fold(anchor, reducer)),
524
+ Match.when({ type: 'relation' }, ({ anchor }) => fold(anchor, reducer)),
525
+ Match.when({ type: 'options' }, ({ query }) => fold(query, reducer)),
526
+ Match.when({ type: 'relation-traversal' }, ({ anchor }) => fold(anchor, reducer)),
527
+ Match.when({ type: 'hierarchy-traversal' }, ({ anchor }) => fold(anchor, reducer)),
528
+ Match.when({ type: 'union' }, ({ queries }) => queries.flatMap((q) => fold(q, reducer))),
529
+ Match.when({ type: 'set-difference' }, ({ source, exclude }) =>
530
+ fold(source, reducer).concat(fold(exclude, reducer)),
531
+ ),
532
+ Match.when({ type: 'order' }, ({ query }) => fold(query, reducer)),
533
+ Match.when({ type: 'limit' }, ({ query }) => fold(query, reducer)),
534
+ Match.when({ type: 'from' }, (node) => {
535
+ const results = fold(node.query, reducer);
536
+ if (node.from._tag === 'query') {
537
+ return results.concat(fold(node.from.query, reducer));
538
+ }
539
+ return results;
540
+ }),
541
+ Match.when({ type: 'select' }, () => []),
542
+ Match.exhaustive,
543
+ );
268
544
  };
package/src/reference.ts CHANGED
@@ -170,13 +170,16 @@ export const isEncodedReference = (value: any): value is EncodedReference =>
170
170
  export const EncodedReference = Object.freeze({
171
171
  isEncodedReference,
172
172
  getReferenceString: (value: EncodedReference): string => {
173
- assertArgument(isEncodedReference(value), 'invalid reference');
173
+ assertArgument(isEncodedReference(value), 'value', 'invalid reference');
174
174
  return value['/'];
175
175
  },
176
176
  toDXN: (value: EncodedReference): DXN => {
177
177
  return DXN.parse(EncodedReference.getReferenceString(value));
178
178
  },
179
179
  fromDXN: (dxn: DXN): EncodedReference => {
180
- return encodeReference(Reference.fromDXN(dxn));
180
+ return { '/': dxn.toString() };
181
+ },
182
+ fromLegacyTypename: (typename: string): EncodedReference => {
183
+ return { '/': DXN.fromTypename(typename).toString() };
181
184
  },
182
185
  });
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/document-structure.ts", "../../../src/reference.ts", "../../../src/space-doc-version.ts", "../../../src/space-id.ts", "../../../src/foreign-key.ts", "../../../src/query/ast.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { invariant } from '@dxos/invariant';\nimport type { DXN, ObjectId } from '@dxos/keys';\nimport { visitValues } from '@dxos/util';\n\nimport { type RawString } from './automerge';\nimport type { ForeignKey } from './foreign-key';\nimport { type EncodedReference, isEncodedReference } from './reference';\nimport { type SpaceDocVersion } from './space-doc-version';\n\nexport type SpaceState = {\n // Url of the root automerge document.\n rootUrl?: string;\n};\n\n/**\n * Array indexes get converted to strings.\n */\nexport type ObjectProp = string;\nexport type ObjectPropPath = ObjectProp[];\n\n/**\n * Link to all documents that hold objects in the space.\n */\nexport interface DatabaseDirectory {\n version?: SpaceDocVersion;\n\n access?: {\n spaceKey: string;\n };\n /**\n * Objects inlined in the current document.\n */\n objects?: {\n [id: string]: ObjectStructure;\n };\n /**\n * Object id points to an automerge doc url where the object is embedded.\n */\n links?: {\n [echoId: string]: string | RawString;\n };\n\n /**\n * @deprecated\n * For backward compatibility.\n */\n experimental_spaceKey?: string;\n}\n\nexport const DatabaseDirectory = Object.freeze({\n /**\n * @returns Space key in hex of the space that owns the document. In hex format. Without 0x prefix.\n */\n getSpaceKey: (doc: DatabaseDirectory): string | null => {\n // experimental_spaceKey is set on old documents, new ones are created with doc.access.spaceKey\n const rawSpaceKey = doc.access?.spaceKey ?? doc.experimental_spaceKey;\n if (rawSpaceKey == null) {\n return null;\n }\n\n const rawKey = String(rawSpaceKey);\n invariant(!rawKey.startsWith('0x'), 'Space key must not start with 0x');\n return rawKey;\n },\n\n getInlineObject: (doc: DatabaseDirectory, id: ObjectId): ObjectStructure | undefined => {\n return doc.objects?.[id];\n },\n\n getLink: (doc: DatabaseDirectory, id: ObjectId): string | undefined => {\n return doc.links?.[id]?.toString();\n },\n\n make: ({\n spaceKey,\n objects,\n links,\n }: {\n spaceKey: string;\n objects?: Record<string, ObjectStructure>;\n links?: Record<string, RawString>;\n }): DatabaseDirectory => ({\n access: {\n spaceKey,\n },\n objects: objects ?? {},\n links: links ?? {},\n }),\n});\n\n/**\n * Representation of an ECHO object in an AM document.\n */\nexport type ObjectStructure = {\n // TODO(dmaretskyi): Missing in some cases.\n system?: ObjectSystem;\n\n meta: ObjectMeta;\n /**\n * User-defined data.\n * Adheres to schema in `system.type`\n */\n data: Record<string, any>;\n};\n\n// Helper methods to interact with the {@link ObjectStructure}.\nexport const ObjectStructure = Object.freeze({\n /**\n * @throws On invalid object structure.\n */\n getTypeReference: (object: ObjectStructure): EncodedReference | undefined => {\n return object.system?.type;\n },\n\n /**\n * @throws On invalid object structure.\n */\n getEntityKind: (object: ObjectStructure): 'object' | 'relation' => {\n const kind = object.system?.kind ?? 'object';\n invariant(kind === 'object' || kind === 'relation', 'Invalid kind');\n return kind;\n },\n\n isDeleted: (object: ObjectStructure): boolean => {\n return object.system?.deleted ?? false;\n },\n\n getRelationSource: (object: ObjectStructure): EncodedReference | undefined => {\n return object.system?.source;\n },\n\n getRelationTarget: (object: ObjectStructure): EncodedReference | undefined => {\n return object.system?.target;\n },\n\n /**\n * @returns All references in the data section of the object.\n */\n getAllOutgoingReferences: (object: ObjectStructure): { path: ObjectPropPath; reference: EncodedReference }[] => {\n const references: { path: ObjectPropPath; reference: EncodedReference }[] = [];\n const visit = (path: ObjectPropPath, value: unknown) => {\n if (isEncodedReference(value)) {\n references.push({ path, reference: value });\n } else {\n visitValues(value, (value, key) => visit([...path, String(key)], value));\n }\n };\n visitValues(object.data, (value, key) => visit([String(key)], value));\n return references;\n },\n\n makeObject: ({\n type,\n data,\n keys,\n }: {\n type: DXN.String;\n deleted?: boolean;\n keys?: ForeignKey[];\n data?: unknown;\n }): ObjectStructure => {\n return {\n system: {\n kind: 'object',\n type: { '/': type },\n },\n meta: {\n keys: keys ?? [],\n },\n data: data ?? {},\n };\n },\n\n makeRelation: ({\n type,\n source,\n target,\n deleted,\n keys,\n data,\n }: {\n type: DXN.String;\n source: EncodedReference;\n target: EncodedReference;\n deleted?: boolean;\n keys?: ForeignKey[];\n data?: unknown;\n }): ObjectStructure => {\n return {\n system: {\n kind: 'relation',\n type: { '/': type },\n source,\n target,\n deleted: deleted ?? false,\n },\n meta: {\n keys: keys ?? [],\n },\n data: data ?? {},\n };\n },\n});\n\n/**\n * Echo object metadata.\n */\nexport type ObjectMeta = {\n /**\n * Foreign keys.\n */\n keys: ForeignKey[];\n};\n\n/**\n * Automerge object system properties.\n * (Is automerge specific.)\n */\nexport type ObjectSystem = {\n /**\n * Entity kind.\n */\n kind?: 'object' | 'relation';\n\n /**\n * Object reference ('protobuf' protocol) type.\n */\n type?: EncodedReference;\n\n /**\n * Deletion marker.\n */\n deleted?: boolean;\n\n /**\n * Only for relations.\n */\n source?: EncodedReference;\n\n /**\n * Only for relations.w\n */\n target?: EncodedReference;\n};\n\n/**\n * Id property name.\n */\nexport const PROPERTY_ID = 'id';\n\n/**\n * Data namespace.\n * The key on {@link ObjectStructure} that contains the user-defined data.\n */\nexport const DATA_NAMESPACE = 'data';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { assertArgument } from '@dxos/invariant';\nimport { DXN, LOCAL_SPACE_TAG, type PublicKey } from '@dxos/keys';\nimport { type ObjectId } from '@dxos/protocols';\nimport { type Reference as ReferenceProto } from '@dxos/protocols/proto/dxos/echo/model/document';\n\n/**\n * Runtime representation of an reference in ECHO.\n * Implemented as a DXN, but we might extend it to other URIs in the future.\n * @deprecated Use `EncodedReference` instead.\n */\nexport class Reference {\n /**\n * Protocol references to runtime registered types.\n * @deprecated\n */\n static TYPE_PROTOCOL = 'protobuf';\n\n static fromDXN(dxn: DXN): Reference {\n switch (dxn.kind) {\n case DXN.kind.TYPE:\n return new Reference(dxn.parts[0], Reference.TYPE_PROTOCOL, 'dxos.org', dxn);\n case DXN.kind.ECHO:\n if (dxn.parts[0] === LOCAL_SPACE_TAG) {\n return new Reference(dxn.parts[1], undefined, undefined, dxn);\n } else {\n return new Reference(dxn.parts[1], undefined, dxn.parts[0], dxn);\n }\n default:\n return new Reference(dxn.parts[0], undefined, dxn.parts[0], dxn);\n }\n }\n\n static fromValue(value: ReferenceProto): Reference {\n return new Reference(value.objectId, value.protocol, value.host);\n }\n\n /**\n * Reference an object in the local space.\n */\n static localObjectReference(objectId: ObjectId): Reference {\n return new Reference(objectId);\n }\n\n /**\n * @deprecated\n */\n // TODO(dmaretskyi): Remove.\n static fromLegacyTypename(type: string): Reference {\n return new Reference(type, Reference.TYPE_PROTOCOL, 'dxos.org');\n }\n\n /**\n * @deprecated\n */\n // TODO(dmaretskyi): Remove\n static fromObjectIdAndSpaceKey(objectId: ObjectId, spaceKey: PublicKey): Reference {\n // TODO(dmaretskyi): FIX ME! This should be a space ID not a space key.\n return new Reference(objectId, undefined, spaceKey.toHex());\n }\n\n // prettier-ignore\n private constructor(\n // TODO(dmaretskyi): Remove and just leave DXN.\n private readonly _objectId: ObjectId,\n private readonly _protocol?: string,\n private readonly _host?: string,\n private readonly _dxn?: DXN,\n ) {}\n\n get dxn(): DXN | undefined {\n return this._dxn;\n }\n\n /**\n * @deprecated\n */\n // TODO(dmaretskyi): Remove.\n get objectId(): ObjectId {\n return this._objectId;\n }\n\n /**\n * @deprecated\n */\n // TODO(dmaretskyi): Remove.\n get protocol(): string | undefined {\n return this._protocol;\n }\n\n /**\n * @deprecated\n */\n // TODO(dmaretskyi): Remove.\n get host(): string | undefined {\n return this._host;\n }\n\n encode(): ReferenceProto {\n return { objectId: this.objectId, host: this.host, protocol: this.protocol };\n }\n\n // TODO(dmaretskyi): Remove in favor of `reference.dxn`.\n toDXN(): DXN {\n if (this._dxn) {\n return this._dxn;\n }\n\n if (this.protocol === Reference.TYPE_PROTOCOL) {\n return new DXN(DXN.kind.TYPE, [this.objectId]);\n } else {\n if (this.host) {\n // Host is assumed to be the space key.\n // The DXN should actually have the space ID.\n // TODO(dmaretskyi): Migrate to space id.\n return new DXN(DXN.kind.ECHO, [this.host, this.objectId]);\n } else {\n return new DXN(DXN.kind.ECHO, [LOCAL_SPACE_TAG, this.objectId]);\n }\n }\n }\n}\n\n// TODO(dmaretskyi): Is this used anywhere?\nexport const REFERENCE_TYPE_TAG = 'dxos.echo.model.document.Reference';\n\n/**\n * Reference as it is stored in Automerge document.\n */\nexport type EncodedReference = {\n '/': string;\n};\n\n/**\n * @deprecated Use `EncodedReference.fromDXN` instead.\n */\nexport const encodeReference = (reference: Reference): EncodedReference => ({\n '/': reference.toDXN().toString(),\n});\n\n/**\n * @deprecated Use `EncodedReference.toDXN` instead.\n */\nexport const decodeReference = (value: any) => {\n if (typeof value !== 'object' || value === null || typeof value['/'] !== 'string') {\n throw new Error('Invalid reference');\n }\n const dxnString = value['/'];\n\n if (\n dxnString.length % 2 === 0 &&\n dxnString.slice(0, dxnString.length / 2) === dxnString.slice(dxnString.length / 2) &&\n dxnString.includes('dxn:echo')\n ) {\n throw new Error('Automerge bug detected!');\n }\n\n return Reference.fromDXN(DXN.parse(dxnString));\n};\n\n/**\n * @deprecated Use `EncodedReference.isEncodedReference` instead.\n */\nexport const isEncodedReference = (value: any): value is EncodedReference =>\n typeof value === 'object' && value !== null && Object.keys(value).length === 1 && typeof value['/'] === 'string';\n\nexport const EncodedReference = Object.freeze({\n isEncodedReference,\n getReferenceString: (value: EncodedReference): string => {\n assertArgument(isEncodedReference(value), 'invalid reference');\n return value['/'];\n },\n toDXN: (value: EncodedReference): DXN => {\n return DXN.parse(EncodedReference.getReferenceString(value));\n },\n fromDXN: (dxn: DXN): EncodedReference => {\n return encodeReference(Reference.fromDXN(dxn));\n },\n});\n", "//\n// Copyright 2024 DXOS.org\n//\n\n/**\n * Denotes the data version of the space automerge document as well as the leaf documents for each individual ECHO object.\n */\nexport type SpaceDocVersion = number & { __type: 'SpaceDocVersion' };\n\nexport const SpaceDocVersion = Object.freeze({\n /**\n * For the documents created before the versioning was introduced.\n */\n LEGACY: 0 as SpaceDocVersion,\n\n /**\n * Current version.\n */\n CURRENT: 1 as SpaceDocVersion,\n});\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { subtleCrypto } from '@dxos/crypto';\nimport { PublicKey, SpaceId } from '@dxos/keys';\nimport { ComplexMap } from '@dxos/util';\n\nconst SPACE_IDS_CACHE = new ComplexMap<PublicKey, SpaceId>(PublicKey.hash);\n\n/**\n * Space keys are generated by creating a keypair, and then taking the first 20 bytes of the SHA-256 hash of the public key and encoding them to multibase RFC4648 base-32 format (prefixed with B, see Multibase Table).\n * Inspired by how ethereum addresses are derived.\n */\nexport const createIdFromSpaceKey = async (spaceKey: PublicKey): Promise<SpaceId> => {\n const cachedValue = SPACE_IDS_CACHE.get(spaceKey);\n if (cachedValue !== undefined) {\n return cachedValue;\n }\n\n const digest = await subtleCrypto.digest('SHA-256', spaceKey.asUint8Array() as Uint8Array<ArrayBuffer>);\n\n const bytes = new Uint8Array(digest).slice(0, SpaceId.byteLength);\n const spaceId = SpaceId.encode(bytes);\n SPACE_IDS_CACHE.set(spaceKey, spaceId);\n return spaceId;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema, SchemaAST } from 'effect';\n\nconst ForeignKey_ = Schema.Struct({\n /**\n * Name of the foreign database/system.\n * E.g., `github.com`.\n */\n source: Schema.String,\n\n /**\n * Id within the foreign database.\n */\n // TODO(wittjosiah): This annotation is currently used to ensure id field shows up in forms.\n // TODO(dmaretskyi): `false` is not a valid value for the annotation.\n id: Schema.String.annotations({ [SchemaAST.IdentifierAnnotationId]: false }),\n});\n\nexport type ForeignKey = Schema.Schema.Type<typeof ForeignKey_>;\n\n/**\n * Reference to an object in a foreign database.\n */\nexport const ForeignKey: Schema.Schema<ForeignKey> = ForeignKey_;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { DXN, ObjectId } from '@dxos/keys';\n\nimport { ForeignKey } from '../foreign-key';\n\nconst TypenameSpecifier = Schema.Union(DXN.Schema, Schema.Null).annotations({\n description: 'DXN or null. Null means any type will match',\n});\n\n// NOTE: This pattern with 3 definitions per schema is need to make the types opaque, and circular references in AST to not cause compiler errors.\n\n/**\n * Filter by object type and properties.\n *\n * Clauses are combined using logical AND.\n */\n// TODO(burdon): Filter object vs. relation.\nconst FilterObject_ = Schema.Struct({\n type: Schema.Literal('object'),\n\n typename: TypenameSpecifier,\n\n id: Schema.optional(Schema.Array(ObjectId)),\n\n /**\n * Filter by property.\n * Must not include object ID.\n */\n props: Schema.Record({\n key: Schema.String.annotations({ description: 'Property name' }),\n value: Schema.suspend(() => Filter),\n }),\n\n /**\n * Objects that have any of the given foreign keys.\n */\n foreignKeys: Schema.optional(Schema.Array(ForeignKey)),\n\n // NOTE: Make sure to update `FilterStep.isNoop` if you change this.\n});\nexport interface FilterObject extends Schema.Schema.Type<typeof FilterObject_> {}\nexport const FilterObject: Schema.Schema<FilterObject> = FilterObject_;\n\nconst FilterCompare_ = Schema.Struct({\n type: Schema.Literal('compare'),\n operator: Schema.Literal('eq', 'neq', 'gt', 'gte', 'lt', 'lte'),\n value: Schema.Unknown,\n});\nexport interface FilterCompare extends Schema.Schema.Type<typeof FilterCompare_> {}\nexport const FilterCompare: Schema.Schema<FilterCompare> = FilterCompare_;\n\nconst FilterIn_ = Schema.Struct({\n type: Schema.Literal('in'),\n values: Schema.Array(Schema.Any),\n});\nexport interface FilterIn extends Schema.Schema.Type<typeof FilterIn_> {}\nexport const FilterIn: Schema.Schema<FilterIn> = FilterIn_;\n\nconst FilterRange_ = Schema.Struct({\n type: Schema.Literal('range'),\n from: Schema.Any,\n to: Schema.Any,\n});\nexport interface FilterRange extends Schema.Schema.Type<typeof FilterRange_> {}\nexport const FilterRange: Schema.Schema<FilterRange> = FilterRange_;\n\nconst FilterTextSearch_ = Schema.Struct({\n type: Schema.Literal('text-search'),\n text: Schema.String,\n searchKind: Schema.optional(Schema.Literal('full-text', 'vector')),\n});\nexport interface FilterTextSearch extends Schema.Schema.Type<typeof FilterTextSearch_> {}\nexport const FilterTextSearch: Schema.Schema<FilterTextSearch> = FilterTextSearch_;\n\nconst FilterNot_ = Schema.Struct({\n type: Schema.Literal('not'),\n filter: Schema.suspend(() => Filter),\n});\nexport interface FilterNot extends Schema.Schema.Type<typeof FilterNot_> {}\nexport const FilterNot: Schema.Schema<FilterNot> = FilterNot_;\n\nconst FilterAnd_ = Schema.Struct({\n type: Schema.Literal('and'),\n filters: Schema.Array(Schema.suspend(() => Filter)),\n});\nexport interface FilterAnd extends Schema.Schema.Type<typeof FilterAnd_> {}\nexport const FilterAnd: Schema.Schema<FilterAnd> = FilterAnd_;\n\nconst FilterOr_ = Schema.Struct({\n type: Schema.Literal('or'),\n filters: Schema.Array(Schema.suspend(() => Filter)),\n});\nexport interface FilterOr extends Schema.Schema.Type<typeof FilterOr_> {}\nexport const FilterOr: Schema.Schema<FilterOr> = FilterOr_;\n\nexport const Filter = Schema.Union(\n FilterObject,\n FilterTextSearch,\n FilterCompare,\n FilterIn,\n FilterRange,\n FilterNot,\n FilterAnd,\n FilterOr,\n);\nexport type Filter = Schema.Schema.Type<typeof Filter>;\n\n/**\n * Query objects by type, id, and/or predicates.\n */\nconst QuerySelectClause_ = Schema.Struct({\n type: Schema.Literal('select'),\n filter: Schema.suspend(() => Filter),\n});\nexport interface QuerySelectClause extends Schema.Schema.Type<typeof QuerySelectClause_> {}\nexport const QuerySelectClause: Schema.Schema<QuerySelectClause> = QuerySelectClause_;\n\n/**\n * Filter objects from selection.\n */\nconst QueryFilterClause_ = Schema.Struct({\n type: Schema.Literal('filter'),\n selection: Schema.suspend(() => Query),\n filter: Schema.suspend(() => Filter),\n});\nexport interface QueryFilterClause extends Schema.Schema.Type<typeof QueryFilterClause_> {}\nexport const QueryFilterClause: Schema.Schema<QueryFilterClause> = QueryFilterClause_;\n\n/**\n * Traverse references from an anchor object.\n */\nconst QueryReferenceTraversalClause_ = Schema.Struct({\n type: Schema.Literal('reference-traversal'),\n anchor: Schema.suspend(() => Query),\n property: Schema.String, // TODO(dmaretskyi): Change to EscapedPropPath.\n});\nexport interface QueryReferenceTraversalClause extends Schema.Schema.Type<typeof QueryReferenceTraversalClause_> {}\nexport const QueryReferenceTraversalClause: Schema.Schema<QueryReferenceTraversalClause> =\n QueryReferenceTraversalClause_;\n\n/**\n * Traverse incoming references to an anchor object.\n */\nconst QueryIncomingReferencesClause_ = Schema.Struct({\n type: Schema.Literal('incoming-references'),\n anchor: Schema.suspend(() => Query),\n property: Schema.String,\n typename: TypenameSpecifier,\n});\nexport interface QueryIncomingReferencesClause extends Schema.Schema.Type<typeof QueryIncomingReferencesClause_> {}\nexport const QueryIncomingReferencesClause: Schema.Schema<QueryIncomingReferencesClause> =\n QueryIncomingReferencesClause_;\n\n/**\n * Traverse relations connecting to an anchor object.\n */\nconst QueryRelationClause_ = Schema.Struct({\n type: Schema.Literal('relation'),\n anchor: Schema.suspend(() => Query),\n /**\n * outgoing: anchor is the source of the relation.\n * incoming: anchor is the target of the relation.\n * both: anchor is either the source or target of the relation.\n */\n direction: Schema.Literal('outgoing', 'incoming', 'both'),\n filter: Schema.optional(Schema.suspend(() => Filter)),\n});\nexport interface QueryRelationClause extends Schema.Schema.Type<typeof QueryRelationClause_> {}\nexport const QueryRelationClause: Schema.Schema<QueryRelationClause> = QueryRelationClause_;\n\n/**\n * Traverse into the source or target of a relation.\n */\nconst QueryRelationTraversalClause_ = Schema.Struct({\n type: Schema.Literal('relation-traversal'),\n anchor: Schema.suspend(() => Query),\n direction: Schema.Literal('source', 'target', 'both'),\n});\nexport interface QueryRelationTraversalClause extends Schema.Schema.Type<typeof QueryRelationTraversalClause_> {}\nexport const QueryRelationTraversalClause: Schema.Schema<QueryRelationTraversalClause> = QueryRelationTraversalClause_;\n\n/**\n * Union of multiple queries.\n */\nconst QueryUnionClause_ = Schema.Struct({\n type: Schema.Literal('union'),\n queries: Schema.Array(Schema.suspend(() => Query)),\n});\nexport interface QueryUnionClause extends Schema.Schema.Type<typeof QueryUnionClause_> {}\nexport const QueryUnionClause: Schema.Schema<QueryUnionClause> = QueryUnionClause_;\n\n/**\n * Set difference of two queries.\n */\nconst QuerySetDifferenceClause_ = Schema.Struct({\n type: Schema.Literal('set-difference'),\n source: Schema.suspend(() => Query),\n exclude: Schema.suspend(() => Query),\n});\nexport interface QuerySetDifferenceClause extends Schema.Schema.Type<typeof QuerySetDifferenceClause_> {}\nexport const QuerySetDifferenceClause: Schema.Schema<QuerySetDifferenceClause> = QuerySetDifferenceClause_;\n\n/**\n * Add options to a query.\n */\nconst QueryOptionsClause_ = Schema.Struct({\n type: Schema.Literal('options'),\n query: Schema.suspend(() => Query),\n options: Schema.suspend(() => QueryOptions),\n});\nexport interface QueryOptionsClause extends Schema.Schema.Type<typeof QueryOptionsClause_> {}\nexport const QueryOptionsClause: Schema.Schema<QueryOptionsClause> = QueryOptionsClause_;\n\nconst Query_ = Schema.Union(\n QuerySelectClause,\n QueryFilterClause,\n QueryReferenceTraversalClause,\n QueryIncomingReferencesClause,\n QueryRelationClause,\n QueryRelationTraversalClause,\n QueryUnionClause,\n QuerySetDifferenceClause,\n QueryOptionsClause,\n);\n\nexport type Query = Schema.Schema.Type<typeof Query_>;\nexport const Query: Schema.Schema<Query> = Query_;\n\nexport const QueryOptions = Schema.Struct({\n spaceIds: Schema.optional(Schema.Array(Schema.String)),\n deleted: Schema.optional(Schema.Literal('include', 'exclude', 'only')),\n});\nexport interface QueryOptions extends Schema.Schema.Type<typeof QueryOptions> {}\n\nexport const visit = (query: Query, visitor: (node: Query) => void) => {\n switch (query.type) {\n case 'filter':\n visit(query.selection, visitor);\n break;\n case 'reference-traversal':\n visit(query.anchor, visitor);\n break;\n case 'incoming-references':\n visit(query.anchor, visitor);\n break;\n case 'relation':\n visit(query.anchor, visitor);\n break;\n case 'options':\n visit(query.query, visitor);\n break;\n case 'relation-traversal':\n visit(query.anchor, visitor);\n break;\n case 'union':\n query.queries.forEach((q) => visit(q, visitor));\n break;\n case 'set-difference':\n visit(query.source, visitor);\n visit(query.exclude, visitor);\n break;\n }\n};\n"],
5
- "mappings": ";;;;;;;AAIA,SAASA,iBAAiB;AAE1B,SAASC,mBAAmB;;;ACF5B,SAASC,sBAAsB;AAC/B,SAASC,KAAKC,uBAAuC;AAS9C,IAAMC,YAAN,MAAMA,WAAAA;;;;;;;;;EAKX,OAAOC,gBAAgB;EAEvB,OAAOC,QAAQC,KAAqB;AAClC,YAAQA,IAAIC,MAAI;MACd,KAAKC,IAAID,KAAKE;AACZ,eAAO,IAAIN,WAAUG,IAAII,MAAM,CAAA,GAAIP,WAAUC,eAAe,YAAYE,GAAAA;MAC1E,KAAKE,IAAID,KAAKI;AACZ,YAAIL,IAAII,MAAM,CAAA,MAAOE,iBAAiB;AACpC,iBAAO,IAAIT,WAAUG,IAAII,MAAM,CAAA,GAAIG,QAAWA,QAAWP,GAAAA;QAC3D,OAAO;AACL,iBAAO,IAAIH,WAAUG,IAAII,MAAM,CAAA,GAAIG,QAAWP,IAAII,MAAM,CAAA,GAAIJ,GAAAA;QAC9D;MAC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", "parts", "ECHO", "LOCAL_SPACE_TAG", "undefined", "fromValue", "value", "objectId", "protocol", "host", "localObjectReference", "fromLegacyTypename", "type", "fromObjectIdAndSpaceKey", "spaceKey", "toHex", "_objectId", "_protocol", "_host", "_dxn", "encode", "toDXN", "REFERENCE_TYPE_TAG", "encodeReference", "reference", "toString", "decodeReference", "Error", "dxnString", "length", "slice", "includes", "parse", "isEncodedReference", "Object", "keys", "EncodedReference", "freeze", "getReferenceString", "assertArgument", "DatabaseDirectory", "Object", "freeze", "getSpaceKey", "doc", "rawSpaceKey", "access", "spaceKey", "experimental_spaceKey", "rawKey", "String", "invariant", "startsWith", "getInlineObject", "id", "objects", "getLink", "links", "toString", "make", "ObjectStructure", "getTypeReference", "object", "system", "type", "getEntityKind", "kind", "isDeleted", "deleted", "getRelationSource", "source", "getRelationTarget", "target", "getAllOutgoingReferences", "references", "visit", "path", "value", "isEncodedReference", "push", "reference", "visitValues", "key", "data", "makeObject", "keys", "meta", "makeRelation", "PROPERTY_ID", "DATA_NAMESPACE", "SpaceDocVersion", "Object", "freeze", "LEGACY", "CURRENT", "subtleCrypto", "PublicKey", "SpaceId", "ComplexMap", "SPACE_IDS_CACHE", "ComplexMap", "PublicKey", "hash", "createIdFromSpaceKey", "spaceKey", "cachedValue", "get", "undefined", "digest", "subtleCrypto", "asUint8Array", "bytes", "Uint8Array", "slice", "SpaceId", "byteLength", "spaceId", "encode", "set", "Schema", "SchemaAST", "ForeignKey_", "Schema", "Struct", "source", "String", "id", "annotations", "SchemaAST", "IdentifierAnnotationId", "ForeignKey", "Schema", "DXN", "ObjectId", "TypenameSpecifier", "Schema", "Union", "DXN", "Null", "annotations", "description", "FilterObject_", "Struct", "type", "Literal", "typename", "id", "optional", "Array", "ObjectId", "props", "Record", "key", "String", "value", "suspend", "Filter", "foreignKeys", "ForeignKey", "FilterObject", "FilterCompare_", "operator", "Unknown", "FilterCompare", "FilterIn_", "values", "Any", "FilterIn", "FilterRange_", "from", "to", "FilterRange", "FilterTextSearch_", "text", "searchKind", "FilterTextSearch", "FilterNot_", "filter", "FilterNot", "FilterAnd_", "filters", "FilterAnd", "FilterOr_", "FilterOr", "QuerySelectClause_", "QuerySelectClause", "QueryFilterClause_", "selection", "Query", "QueryFilterClause", "QueryReferenceTraversalClause_", "anchor", "property", "QueryReferenceTraversalClause", "QueryIncomingReferencesClause_", "QueryIncomingReferencesClause", "QueryRelationClause_", "direction", "QueryRelationClause", "QueryRelationTraversalClause_", "QueryRelationTraversalClause", "QueryUnionClause_", "queries", "QueryUnionClause", "QuerySetDifferenceClause_", "source", "exclude", "QuerySetDifferenceClause", "QueryOptionsClause_", "query", "options", "QueryOptions", "QueryOptionsClause", "Query_", "spaceIds", "deleted", "visit", "visitor", "forEach", "q"]
7
- }
@@ -1 +0,0 @@
1
- {"inputs":{"src/reference.ts":{"bytes":16981,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true}],"format":"esm"},"src/document-structure.ts":{"bytes":15682,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/reference.ts","kind":"import-statement","original":"./reference"}],"format":"esm"},"src/space-doc-version.ts":{"bytes":1538,"imports":[],"format":"esm"},"src/space-id.ts":{"bytes":3547,"imports":[{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/foreign-key.ts":{"bytes":2428,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"src/query/ast.ts":{"bytes":26583,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"src/foreign-key.ts","kind":"import-statement","original":"../foreign-key"}],"format":"esm"},"src/query/index.ts":{"bytes":516,"imports":[{"path":"src/query/ast.ts","kind":"import-statement","original":"./ast"}],"format":"esm"},"src/index.ts":{"bytes":1011,"imports":[{"path":"src/document-structure.ts","kind":"import-statement","original":"./document-structure"},{"path":"src/reference.ts","kind":"import-statement","original":"./reference"},{"path":"src/space-doc-version.ts","kind":"import-statement","original":"./space-doc-version"},{"path":"src/space-id.ts","kind":"import-statement","original":"./space-id"},{"path":"src/foreign-key.ts","kind":"import-statement","original":"./foreign-key"},{"path":"src/query/index.ts","kind":"import-statement","original":"./query"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":34978},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true}],"exports":["DATA_NAMESPACE","DatabaseDirectory","EncodedReference","ForeignKey","ObjectStructure","PROPERTY_ID","QueryAST","REFERENCE_TYPE_TAG","Reference","SpaceDocVersion","createIdFromSpaceKey","decodeReference","encodeReference","isEncodedReference"],"entryPoint":"src/index.ts","inputs":{"src/document-structure.ts":{"bytesInOutput":3028},"src/reference.ts":{"bytesInOutput":3689},"src/index.ts":{"bytesInOutput":0},"src/space-doc-version.ts":{"bytesInOutput":179},"src/space-id.ts":{"bytesInOutput":604},"src/foreign-key.ts":{"bytesInOutput":512},"src/query/ast.ts":{"bytesInOutput":6379},"src/query/index.ts":{"bytesInOutput":0}},"bytes":15050}}}