@dxos/echo-protocol 0.8.3 → 0.8.4-main.1068cf700f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/{browser → neutral}/index.mjs +206 -63
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/types/src/document-structure.d.ts +15 -1
- package/dist/types/src/document-structure.d.ts.map +1 -1
- package/dist/types/src/foreign-key.d.ts +1 -1
- package/dist/types/src/foreign-key.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/query/ast.d.ts +165 -20
- package/dist/types/src/query/ast.d.ts.map +1 -1
- package/dist/types/src/reference.d.ts +17 -0
- package/dist/types/src/reference.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -11
- package/src/document-structure.ts +24 -2
- package/src/foreign-key.ts +4 -3
- package/src/index.ts +1 -1
- package/src/query/ast.ts +211 -33
- package/src/reference.ts +29 -0
- package/src/space-id.ts +1 -1
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/node/index.cjs +0 -527
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node-esm/index.mjs +0 -510
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
export * from './document-structure';
|
|
6
6
|
export * from './reference';
|
|
7
7
|
export * from './space-doc-version';
|
|
8
|
-
export * from './collection-sync';
|
|
8
|
+
export type * from './collection-sync';
|
|
9
9
|
export * from './space-id';
|
|
10
10
|
export * from './foreign-key';
|
|
11
11
|
export * from './query';
|
package/src/query/ast.ts
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
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
|
|
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,106 @@ 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
|
+
* Text search.
|
|
112
|
+
*/
|
|
72
113
|
const FilterTextSearch_ = Schema.Struct({
|
|
73
114
|
type: Schema.Literal('text-search'),
|
|
74
115
|
text: Schema.String,
|
|
75
116
|
searchKind: Schema.optional(Schema.Literal('full-text', 'vector')),
|
|
76
117
|
});
|
|
118
|
+
|
|
77
119
|
export interface FilterTextSearch extends Schema.Schema.Type<typeof FilterTextSearch_> {}
|
|
78
120
|
export const FilterTextSearch: Schema.Schema<FilterTextSearch> = FilterTextSearch_;
|
|
79
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Not.
|
|
124
|
+
*/
|
|
80
125
|
const FilterNot_ = Schema.Struct({
|
|
81
126
|
type: Schema.Literal('not'),
|
|
82
127
|
filter: Schema.suspend(() => Filter),
|
|
83
128
|
});
|
|
129
|
+
|
|
84
130
|
export interface FilterNot extends Schema.Schema.Type<typeof FilterNot_> {}
|
|
85
131
|
export const FilterNot: Schema.Schema<FilterNot> = FilterNot_;
|
|
86
132
|
|
|
133
|
+
/**
|
|
134
|
+
* And.
|
|
135
|
+
*/
|
|
87
136
|
const FilterAnd_ = Schema.Struct({
|
|
88
137
|
type: Schema.Literal('and'),
|
|
89
138
|
filters: Schema.Array(Schema.suspend(() => Filter)),
|
|
90
139
|
});
|
|
140
|
+
|
|
91
141
|
export interface FilterAnd extends Schema.Schema.Type<typeof FilterAnd_> {}
|
|
92
142
|
export const FilterAnd: Schema.Schema<FilterAnd> = FilterAnd_;
|
|
93
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Or.
|
|
146
|
+
*/
|
|
94
147
|
const FilterOr_ = Schema.Struct({
|
|
95
148
|
type: Schema.Literal('or'),
|
|
96
149
|
filters: Schema.Array(Schema.suspend(() => Filter)),
|
|
97
150
|
});
|
|
151
|
+
|
|
98
152
|
export interface FilterOr extends Schema.Schema.Type<typeof FilterOr_> {}
|
|
99
153
|
export const FilterOr: Schema.Schema<FilterOr> = FilterOr_;
|
|
100
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Union of filters.
|
|
157
|
+
*/
|
|
101
158
|
export const Filter = Schema.Union(
|
|
102
159
|
FilterObject,
|
|
103
|
-
FilterTextSearch,
|
|
104
160
|
FilterCompare,
|
|
105
161
|
FilterIn,
|
|
162
|
+
FilterContains,
|
|
163
|
+
FilterTag,
|
|
106
164
|
FilterRange,
|
|
165
|
+
FilterTextSearch,
|
|
107
166
|
FilterNot,
|
|
108
167
|
FilterAnd,
|
|
109
168
|
FilterOr,
|
|
110
|
-
);
|
|
169
|
+
).annotations({ identifier: 'dxos.org/schema/Filter' });
|
|
170
|
+
|
|
111
171
|
export type Filter = Schema.Schema.Type<typeof Filter>;
|
|
112
172
|
|
|
113
173
|
/**
|
|
@@ -117,6 +177,7 @@ const QuerySelectClause_ = Schema.Struct({
|
|
|
117
177
|
type: Schema.Literal('select'),
|
|
118
178
|
filter: Schema.suspend(() => Filter),
|
|
119
179
|
});
|
|
180
|
+
|
|
120
181
|
export interface QuerySelectClause extends Schema.Schema.Type<typeof QuerySelectClause_> {}
|
|
121
182
|
export const QuerySelectClause: Schema.Schema<QuerySelectClause> = QuerySelectClause_;
|
|
122
183
|
|
|
@@ -128,6 +189,7 @@ const QueryFilterClause_ = Schema.Struct({
|
|
|
128
189
|
selection: Schema.suspend(() => Query),
|
|
129
190
|
filter: Schema.suspend(() => Filter),
|
|
130
191
|
});
|
|
192
|
+
|
|
131
193
|
export interface QueryFilterClause extends Schema.Schema.Type<typeof QueryFilterClause_> {}
|
|
132
194
|
export const QueryFilterClause: Schema.Schema<QueryFilterClause> = QueryFilterClause_;
|
|
133
195
|
|
|
@@ -139,6 +201,7 @@ const QueryReferenceTraversalClause_ = Schema.Struct({
|
|
|
139
201
|
anchor: Schema.suspend(() => Query),
|
|
140
202
|
property: Schema.String, // TODO(dmaretskyi): Change to EscapedPropPath.
|
|
141
203
|
});
|
|
204
|
+
|
|
142
205
|
export interface QueryReferenceTraversalClause extends Schema.Schema.Type<typeof QueryReferenceTraversalClause_> {}
|
|
143
206
|
export const QueryReferenceTraversalClause: Schema.Schema<QueryReferenceTraversalClause> =
|
|
144
207
|
QueryReferenceTraversalClause_;
|
|
@@ -149,9 +212,14 @@ export const QueryReferenceTraversalClause: Schema.Schema<QueryReferenceTraversa
|
|
|
149
212
|
const QueryIncomingReferencesClause_ = Schema.Struct({
|
|
150
213
|
type: Schema.Literal('incoming-references'),
|
|
151
214
|
anchor: Schema.suspend(() => Query),
|
|
152
|
-
|
|
215
|
+
/**
|
|
216
|
+
* Property path where the reference is located.
|
|
217
|
+
* If null, matches references from any property.
|
|
218
|
+
*/
|
|
219
|
+
property: Schema.NullOr(Schema.String),
|
|
153
220
|
typename: TypenameSpecifier,
|
|
154
221
|
});
|
|
222
|
+
|
|
155
223
|
export interface QueryIncomingReferencesClause extends Schema.Schema.Type<typeof QueryIncomingReferencesClause_> {}
|
|
156
224
|
export const QueryIncomingReferencesClause: Schema.Schema<QueryIncomingReferencesClause> =
|
|
157
225
|
QueryIncomingReferencesClause_;
|
|
@@ -170,6 +238,7 @@ const QueryRelationClause_ = Schema.Struct({
|
|
|
170
238
|
direction: Schema.Literal('outgoing', 'incoming', 'both'),
|
|
171
239
|
filter: Schema.optional(Schema.suspend(() => Filter)),
|
|
172
240
|
});
|
|
241
|
+
|
|
173
242
|
export interface QueryRelationClause extends Schema.Schema.Type<typeof QueryRelationClause_> {}
|
|
174
243
|
export const QueryRelationClause: Schema.Schema<QueryRelationClause> = QueryRelationClause_;
|
|
175
244
|
|
|
@@ -181,9 +250,27 @@ const QueryRelationTraversalClause_ = Schema.Struct({
|
|
|
181
250
|
anchor: Schema.suspend(() => Query),
|
|
182
251
|
direction: Schema.Literal('source', 'target', 'both'),
|
|
183
252
|
});
|
|
253
|
+
|
|
184
254
|
export interface QueryRelationTraversalClause extends Schema.Schema.Type<typeof QueryRelationTraversalClause_> {}
|
|
185
255
|
export const QueryRelationTraversalClause: Schema.Schema<QueryRelationTraversalClause> = QueryRelationTraversalClause_;
|
|
186
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Traverse parent-child hierarchy.
|
|
259
|
+
*/
|
|
260
|
+
const QueryHierarchyTraversalClause_ = Schema.Struct({
|
|
261
|
+
type: Schema.Literal('hierarchy-traversal'),
|
|
262
|
+
anchor: Schema.suspend(() => Query),
|
|
263
|
+
/**
|
|
264
|
+
* to-parent: traverse from child to parent.
|
|
265
|
+
* to-children: traverse from parent to children.
|
|
266
|
+
*/
|
|
267
|
+
direction: Schema.Literal('to-parent', 'to-children'),
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
export interface QueryHierarchyTraversalClause extends Schema.Schema.Type<typeof QueryHierarchyTraversalClause_> {}
|
|
271
|
+
export const QueryHierarchyTraversalClause: Schema.Schema<QueryHierarchyTraversalClause> =
|
|
272
|
+
QueryHierarchyTraversalClause_;
|
|
273
|
+
|
|
187
274
|
/**
|
|
188
275
|
* Union of multiple queries.
|
|
189
276
|
*/
|
|
@@ -191,6 +278,7 @@ const QueryUnionClause_ = Schema.Struct({
|
|
|
191
278
|
type: Schema.Literal('union'),
|
|
192
279
|
queries: Schema.Array(Schema.suspend(() => Query)),
|
|
193
280
|
});
|
|
281
|
+
|
|
194
282
|
export interface QueryUnionClause extends Schema.Schema.Type<typeof QueryUnionClause_> {}
|
|
195
283
|
export const QueryUnionClause: Schema.Schema<QueryUnionClause> = QueryUnionClause_;
|
|
196
284
|
|
|
@@ -202,9 +290,47 @@ const QuerySetDifferenceClause_ = Schema.Struct({
|
|
|
202
290
|
source: Schema.suspend(() => Query),
|
|
203
291
|
exclude: Schema.suspend(() => Query),
|
|
204
292
|
});
|
|
293
|
+
|
|
205
294
|
export interface QuerySetDifferenceClause extends Schema.Schema.Type<typeof QuerySetDifferenceClause_> {}
|
|
206
295
|
export const QuerySetDifferenceClause: Schema.Schema<QuerySetDifferenceClause> = QuerySetDifferenceClause_;
|
|
207
296
|
|
|
297
|
+
export const OrderDirection = Schema.Literal('asc', 'desc');
|
|
298
|
+
export type OrderDirection = Schema.Schema.Type<typeof OrderDirection>;
|
|
299
|
+
|
|
300
|
+
const Order_ = Schema.Union(
|
|
301
|
+
Schema.Struct({
|
|
302
|
+
// How database wants to order them (in practice - by id).
|
|
303
|
+
kind: Schema.Literal('natural'),
|
|
304
|
+
}),
|
|
305
|
+
Schema.Struct({
|
|
306
|
+
kind: Schema.Literal('property'),
|
|
307
|
+
property: Schema.String,
|
|
308
|
+
direction: OrderDirection,
|
|
309
|
+
}),
|
|
310
|
+
Schema.Struct({
|
|
311
|
+
// Order by relevance rank (for FTS/vector search results).
|
|
312
|
+
// Default direction is 'desc' (higher rank = better match first).
|
|
313
|
+
kind: Schema.Literal('rank'),
|
|
314
|
+
direction: OrderDirection,
|
|
315
|
+
}),
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
export type Order = Schema.Schema.Type<typeof Order_>;
|
|
319
|
+
export const Order: Schema.Schema<Order> = Order_;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Order the query results.
|
|
323
|
+
* Left-to-right the orders dominate.
|
|
324
|
+
*/
|
|
325
|
+
const QueryOrderClause_ = Schema.Struct({
|
|
326
|
+
type: Schema.Literal('order'),
|
|
327
|
+
query: Schema.suspend(() => Query),
|
|
328
|
+
order: Schema.Array(Order),
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
export interface QueryOrderClause extends Schema.Schema.Type<typeof QueryOrderClause_> {}
|
|
332
|
+
export const QueryOrderClause: Schema.Schema<QueryOrderClause> = QueryOrderClause_;
|
|
333
|
+
|
|
208
334
|
/**
|
|
209
335
|
* Add options to a query.
|
|
210
336
|
*/
|
|
@@ -213,9 +339,22 @@ const QueryOptionsClause_ = Schema.Struct({
|
|
|
213
339
|
query: Schema.suspend(() => Query),
|
|
214
340
|
options: Schema.suspend(() => QueryOptions),
|
|
215
341
|
});
|
|
342
|
+
|
|
216
343
|
export interface QueryOptionsClause extends Schema.Schema.Type<typeof QueryOptionsClause_> {}
|
|
217
344
|
export const QueryOptionsClause: Schema.Schema<QueryOptionsClause> = QueryOptionsClause_;
|
|
218
345
|
|
|
346
|
+
/**
|
|
347
|
+
* Limit the number of results.
|
|
348
|
+
*/
|
|
349
|
+
const QueryLimitClause_ = Schema.Struct({
|
|
350
|
+
type: Schema.Literal('limit'),
|
|
351
|
+
query: Schema.suspend(() => Query),
|
|
352
|
+
limit: Schema.Number,
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
export interface QueryLimitClause extends Schema.Schema.Type<typeof QueryLimitClause_> {}
|
|
356
|
+
export const QueryLimitClause: Schema.Schema<QueryLimitClause> = QueryLimitClause_;
|
|
357
|
+
|
|
219
358
|
const Query_ = Schema.Union(
|
|
220
359
|
QuerySelectClause,
|
|
221
360
|
QueryFilterClause,
|
|
@@ -223,46 +362,85 @@ const Query_ = Schema.Union(
|
|
|
223
362
|
QueryIncomingReferencesClause,
|
|
224
363
|
QueryRelationClause,
|
|
225
364
|
QueryRelationTraversalClause,
|
|
365
|
+
QueryHierarchyTraversalClause,
|
|
226
366
|
QueryUnionClause,
|
|
227
367
|
QuerySetDifferenceClause,
|
|
368
|
+
QueryOrderClause,
|
|
228
369
|
QueryOptionsClause,
|
|
229
|
-
|
|
370
|
+
QueryLimitClause,
|
|
371
|
+
).annotations({ identifier: 'dxos.org/schema/Query' });
|
|
230
372
|
|
|
231
373
|
export type Query = Schema.Schema.Type<typeof Query_>;
|
|
232
374
|
export const Query: Schema.Schema<Query> = Query_;
|
|
233
375
|
|
|
234
376
|
export const QueryOptions = Schema.Struct({
|
|
377
|
+
/**
|
|
378
|
+
* The nested select statemets will select from the given spaces.
|
|
379
|
+
*
|
|
380
|
+
* NOTE: Spaces and queues are unioned together if both are specified.
|
|
381
|
+
*/
|
|
235
382
|
spaceIds: Schema.optional(Schema.Array(Schema.String)),
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* If true, the nested select statements will select from all queues in the spaces specified by `spaceIds`.
|
|
386
|
+
*/
|
|
387
|
+
allQueuesFromSpaces: Schema.optional(Schema.Boolean),
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* The nested select statemets will select from the given queues.
|
|
391
|
+
*
|
|
392
|
+
* NOTE: Spaces and queues are unioned together if both are specified.
|
|
393
|
+
*/
|
|
394
|
+
queues: Schema.optional(Schema.Array(DXN.Schema)),
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Nested select statements will use this option to filter deleted objects.
|
|
398
|
+
*/
|
|
236
399
|
deleted: Schema.optional(Schema.Literal('include', 'exclude', 'only')),
|
|
237
400
|
});
|
|
401
|
+
|
|
238
402
|
export interface QueryOptions extends Schema.Schema.Type<typeof QueryOptions> {}
|
|
239
403
|
|
|
240
404
|
export const visit = (query: Query, visitor: (node: Query) => void) => {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
405
|
+
visitor(query);
|
|
406
|
+
|
|
407
|
+
Match.value(query).pipe(
|
|
408
|
+
Match.when({ type: 'filter' }, ({ selection }) => visit(selection, visitor)),
|
|
409
|
+
Match.when({ type: 'reference-traversal' }, ({ anchor }) => visit(anchor, visitor)),
|
|
410
|
+
Match.when({ type: 'incoming-references' }, ({ anchor }) => visit(anchor, visitor)),
|
|
411
|
+
Match.when({ type: 'relation' }, ({ anchor }) => visit(anchor, visitor)),
|
|
412
|
+
Match.when({ type: 'options' }, ({ query }) => visit(query, visitor)),
|
|
413
|
+
Match.when({ type: 'relation-traversal' }, ({ anchor }) => visit(anchor, visitor)),
|
|
414
|
+
Match.when({ type: 'hierarchy-traversal' }, ({ anchor }) => visit(anchor, visitor)),
|
|
415
|
+
Match.when({ type: 'union' }, ({ queries }) => queries.forEach((q) => visit(q, visitor))),
|
|
416
|
+
Match.when({ type: 'set-difference' }, ({ source, exclude }) => {
|
|
417
|
+
visit(source, visitor);
|
|
418
|
+
visit(exclude, visitor);
|
|
419
|
+
}),
|
|
420
|
+
Match.when({ type: 'order' }, ({ query }) => visit(query, visitor)),
|
|
421
|
+
Match.when({ type: 'limit' }, ({ query }) => visit(query, visitor)),
|
|
422
|
+
Match.when({ type: 'select' }, () => {}),
|
|
423
|
+
Match.exhaustive,
|
|
424
|
+
);
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
export const fold = <T>(query: Query, reducer: (node: Query) => T): T[] => {
|
|
428
|
+
return Match.value(query).pipe(
|
|
429
|
+
Match.withReturnType<T[]>(),
|
|
430
|
+
Match.when({ type: 'filter' }, ({ selection }) => fold(selection, reducer)),
|
|
431
|
+
Match.when({ type: 'reference-traversal' }, ({ anchor }) => fold(anchor, reducer)),
|
|
432
|
+
Match.when({ type: 'incoming-references' }, ({ anchor }) => fold(anchor, reducer)),
|
|
433
|
+
Match.when({ type: 'relation' }, ({ anchor }) => fold(anchor, reducer)),
|
|
434
|
+
Match.when({ type: 'options' }, ({ query }) => fold(query, reducer)),
|
|
435
|
+
Match.when({ type: 'relation-traversal' }, ({ anchor }) => fold(anchor, reducer)),
|
|
436
|
+
Match.when({ type: 'hierarchy-traversal' }, ({ anchor }) => fold(anchor, reducer)),
|
|
437
|
+
Match.when({ type: 'union' }, ({ queries }) => queries.flatMap((q) => fold(q, reducer))),
|
|
438
|
+
Match.when({ type: 'set-difference' }, ({ source, exclude }) =>
|
|
439
|
+
fold(source, reducer).concat(fold(exclude, reducer)),
|
|
440
|
+
),
|
|
441
|
+
Match.when({ type: 'order' }, ({ query }) => fold(query, reducer)),
|
|
442
|
+
Match.when({ type: 'limit' }, ({ query }) => fold(query, reducer)),
|
|
443
|
+
Match.when({ type: 'select' }, () => []),
|
|
444
|
+
Match.exhaustive,
|
|
445
|
+
);
|
|
268
446
|
};
|
package/src/reference.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { assertArgument } from '@dxos/invariant';
|
|
5
6
|
import { DXN, LOCAL_SPACE_TAG, type PublicKey } from '@dxos/keys';
|
|
6
7
|
import { type ObjectId } from '@dxos/protocols';
|
|
7
8
|
import { type Reference as ReferenceProto } from '@dxos/protocols/proto/dxos/echo/model/document';
|
|
@@ -9,6 +10,7 @@ import { type Reference as ReferenceProto } from '@dxos/protocols/proto/dxos/ech
|
|
|
9
10
|
/**
|
|
10
11
|
* Runtime representation of an reference in ECHO.
|
|
11
12
|
* Implemented as a DXN, but we might extend it to other URIs in the future.
|
|
13
|
+
* @deprecated Use `EncodedReference` instead.
|
|
12
14
|
*/
|
|
13
15
|
export class Reference {
|
|
14
16
|
/**
|
|
@@ -122,6 +124,7 @@ export class Reference {
|
|
|
122
124
|
}
|
|
123
125
|
}
|
|
124
126
|
|
|
127
|
+
// TODO(dmaretskyi): Is this used anywhere?
|
|
125
128
|
export const REFERENCE_TYPE_TAG = 'dxos.echo.model.document.Reference';
|
|
126
129
|
|
|
127
130
|
/**
|
|
@@ -131,10 +134,16 @@ export type EncodedReference = {
|
|
|
131
134
|
'/': string;
|
|
132
135
|
};
|
|
133
136
|
|
|
137
|
+
/**
|
|
138
|
+
* @deprecated Use `EncodedReference.fromDXN` instead.
|
|
139
|
+
*/
|
|
134
140
|
export const encodeReference = (reference: Reference): EncodedReference => ({
|
|
135
141
|
'/': reference.toDXN().toString(),
|
|
136
142
|
});
|
|
137
143
|
|
|
144
|
+
/**
|
|
145
|
+
* @deprecated Use `EncodedReference.toDXN` instead.
|
|
146
|
+
*/
|
|
138
147
|
export const decodeReference = (value: any) => {
|
|
139
148
|
if (typeof value !== 'object' || value === null || typeof value['/'] !== 'string') {
|
|
140
149
|
throw new Error('Invalid reference');
|
|
@@ -152,5 +161,25 @@ export const decodeReference = (value: any) => {
|
|
|
152
161
|
return Reference.fromDXN(DXN.parse(dxnString));
|
|
153
162
|
};
|
|
154
163
|
|
|
164
|
+
/**
|
|
165
|
+
* @deprecated Use `EncodedReference.isEncodedReference` instead.
|
|
166
|
+
*/
|
|
155
167
|
export const isEncodedReference = (value: any): value is EncodedReference =>
|
|
156
168
|
typeof value === 'object' && value !== null && Object.keys(value).length === 1 && typeof value['/'] === 'string';
|
|
169
|
+
|
|
170
|
+
export const EncodedReference = Object.freeze({
|
|
171
|
+
isEncodedReference,
|
|
172
|
+
getReferenceString: (value: EncodedReference): string => {
|
|
173
|
+
assertArgument(isEncodedReference(value), 'value', 'invalid reference');
|
|
174
|
+
return value['/'];
|
|
175
|
+
},
|
|
176
|
+
toDXN: (value: EncodedReference): DXN => {
|
|
177
|
+
return DXN.parse(EncodedReference.getReferenceString(value));
|
|
178
|
+
},
|
|
179
|
+
fromDXN: (dxn: DXN): EncodedReference => {
|
|
180
|
+
return { '/': dxn.toString() };
|
|
181
|
+
},
|
|
182
|
+
fromLegacyTypename: (typename: string): EncodedReference => {
|
|
183
|
+
return { '/': DXN.fromTypename(typename).toString() };
|
|
184
|
+
},
|
|
185
|
+
});
|
package/src/space-id.ts
CHANGED
|
@@ -18,7 +18,7 @@ export const createIdFromSpaceKey = async (spaceKey: PublicKey): Promise<SpaceId
|
|
|
18
18
|
return cachedValue;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const digest = await subtleCrypto.digest('SHA-256', spaceKey.asUint8Array());
|
|
21
|
+
const digest = await subtleCrypto.digest('SHA-256', spaceKey.asUint8Array() as Uint8Array<ArrayBuffer>);
|
|
22
22
|
|
|
23
23
|
const bytes = new Uint8Array(digest).slice(0, SpaceId.byteLength);
|
|
24
24
|
const spaceId = SpaceId.encode(bytes);
|
|
@@ -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 { isEncodedReference, type EncodedReference } 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 { 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 */\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\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\nexport const encodeReference = (reference: Reference): EncodedReference => ({\n '/': reference.toDXN().toString(),\n});\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\nexport const isEncodedReference = (value: any): value is EncodedReference =>\n typeof value === 'object' && value !== null && Object.keys(value).length === 1 && typeof value['/'] === 'string';\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());\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,KAAKC,uBAAuC;AAQ9C,IAAMC,YAAN,MAAMA,WAAAA;EAKX;;;;;SAAOC,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;MACF;AACE,eAAO,IAAIH,WAAU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QAAOO,OAAO;EACxCwE,UAAU/E,QAAOY,SAASZ,QAAOa,MAAMb,QAAOkB,MAAM,CAAA;EACpD8D,SAAShF,QAAOY,SAASZ,QAAOS,QAAQ,WAAW,WAAW,MAAA,CAAA;AAChE,CAAA;AAGO,IAAMwE,QAAQ,CAACP,OAAcQ,YAAAA;AAClC,UAAQR,MAAMlE,MAAI;IAChB,KAAK;AACHyE,YAAMP,MAAMtB,WAAW8B,OAAAA;AACvB;IACF,KAAK;AACHD,YAAMP,MAAMlB,QAAQ0B,OAAAA;AACpB;IACF,KAAK;AACHD,YAAMP,MAAMlB,QAAQ0B,OAAAA;AACpB;IACF,KAAK;AACHD,YAAMP,MAAMlB,QAAQ0B,OAAAA;AACpB;IACF,KAAK;AACHD,YAAMP,MAAMA,OAAOQ,OAAAA;AACnB;IACF,KAAK;AACHD,YAAMP,MAAMlB,QAAQ0B,OAAAA;AACpB;IACF,KAAK;AACHR,YAAMP,QAAQgB,QAAQ,CAACC,MAAMH,MAAMG,GAAGF,OAAAA,CAAAA;AACtC;IACF,KAAK;AACHD,YAAMP,MAAMJ,QAAQY,OAAAA;AACpBD,YAAMP,MAAMH,SAASW,OAAAA;AACrB;EACJ;AACF;",
|
|
6
|
-
"names": ["invariant", "visitValues", "DXN", "LOCAL_SPACE_TAG", "Reference", "TYPE_PROTOCOL", "fromDXN", "dxn", "kind", "DXN", "TYPE", "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", "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":{"packages/core/echo/echo-protocol/src/reference.ts":{"bytes":14611,"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true}],"format":"esm"},"packages/core/echo/echo-protocol/src/document-structure.ts":{"bytes":15695,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/echo/echo-protocol/src/reference.ts","kind":"import-statement","original":"./reference"}],"format":"esm"},"packages/core/echo/echo-protocol/src/space-doc-version.ts":{"bytes":1551,"imports":[],"format":"esm"},"packages/core/echo/echo-protocol/src/collection-sync.ts":{"bytes":522,"imports":[],"format":"esm"},"packages/core/echo/echo-protocol/src/space-id.ts":{"bytes":3524,"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"},"packages/core/echo/echo-protocol/src/foreign-key.ts":{"bytes":2441,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/echo/echo-protocol/src/query/ast.ts":{"bytes":26596,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"packages/core/echo/echo-protocol/src/foreign-key.ts","kind":"import-statement","original":"../foreign-key"}],"format":"esm"},"packages/core/echo/echo-protocol/src/query/index.ts":{"bytes":529,"imports":[{"path":"packages/core/echo/echo-protocol/src/query/ast.ts","kind":"import-statement","original":"./ast"}],"format":"esm"},"packages/core/echo/echo-protocol/src/index.ts":{"bytes":1075,"imports":[{"path":"packages/core/echo/echo-protocol/src/document-structure.ts","kind":"import-statement","original":"./document-structure"},{"path":"packages/core/echo/echo-protocol/src/reference.ts","kind":"import-statement","original":"./reference"},{"path":"packages/core/echo/echo-protocol/src/space-doc-version.ts","kind":"import-statement","original":"./space-doc-version"},{"path":"packages/core/echo/echo-protocol/src/collection-sync.ts","kind":"import-statement","original":"./collection-sync"},{"path":"packages/core/echo/echo-protocol/src/space-id.ts","kind":"import-statement","original":"./space-id"},{"path":"packages/core/echo/echo-protocol/src/foreign-key.ts","kind":"import-statement","original":"./foreign-key"},{"path":"packages/core/echo/echo-protocol/src/query/index.ts","kind":"import-statement","original":"./query"}],"format":"esm"}},"outputs":{"packages/core/echo/echo-protocol/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":33728},"packages/core/echo/echo-protocol/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","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","ForeignKey","ObjectStructure","PROPERTY_ID","QueryAST","REFERENCE_TYPE_TAG","Reference","SpaceDocVersion","createIdFromSpaceKey","decodeReference","encodeReference","isEncodedReference"],"entryPoint":"packages/core/echo/echo-protocol/src/index.ts","inputs":{"packages/core/echo/echo-protocol/src/document-structure.ts":{"bytesInOutput":3041},"packages/core/echo/echo-protocol/src/reference.ts":{"bytesInOutput":3252},"packages/core/echo/echo-protocol/src/index.ts":{"bytesInOutput":0},"packages/core/echo/echo-protocol/src/space-doc-version.ts":{"bytesInOutput":179},"packages/core/echo/echo-protocol/src/space-id.ts":{"bytesInOutput":604},"packages/core/echo/echo-protocol/src/foreign-key.ts":{"bytesInOutput":512},"packages/core/echo/echo-protocol/src/query/ast.ts":{"bytesInOutput":6379},"packages/core/echo/echo-protocol/src/query/index.ts":{"bytesInOutput":0}},"bytes":14837}}}
|