@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
|
@@ -4,20 +4,23 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
//
|
|
7
|
+
// src/document-structure.ts
|
|
8
8
|
import { invariant } from "@dxos/invariant";
|
|
9
9
|
import { visitValues } from "@dxos/util";
|
|
10
10
|
|
|
11
|
-
//
|
|
11
|
+
// src/reference.ts
|
|
12
|
+
import { assertArgument } from "@dxos/invariant";
|
|
12
13
|
import { DXN, LOCAL_SPACE_TAG } from "@dxos/keys";
|
|
13
14
|
var Reference = class _Reference {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
_objectId;
|
|
16
|
+
_protocol;
|
|
17
|
+
_host;
|
|
18
|
+
_dxn;
|
|
19
|
+
/**
|
|
20
|
+
* Protocol references to runtime registered types.
|
|
21
|
+
* @deprecated
|
|
22
|
+
*/
|
|
23
|
+
static TYPE_PROTOCOL = "protobuf";
|
|
21
24
|
static fromDXN(dxn) {
|
|
22
25
|
switch (dxn.kind) {
|
|
23
26
|
case DXN.kind.TYPE:
|
|
@@ -32,8 +35,8 @@ var Reference = class _Reference {
|
|
|
32
35
|
return new _Reference(dxn.parts[0], void 0, dxn.parts[0], dxn);
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
|
-
static fromValue(
|
|
36
|
-
return new _Reference(
|
|
38
|
+
static fromValue(value2) {
|
|
39
|
+
return new _Reference(value2.objectId, value2.protocol, value2.host);
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
39
42
|
* Reference an object in the local space.
|
|
@@ -121,20 +124,40 @@ var REFERENCE_TYPE_TAG = "dxos.echo.model.document.Reference";
|
|
|
121
124
|
var encodeReference = (reference) => ({
|
|
122
125
|
"/": reference.toDXN().toString()
|
|
123
126
|
});
|
|
124
|
-
var decodeReference = (
|
|
125
|
-
if (typeof
|
|
127
|
+
var decodeReference = (value2) => {
|
|
128
|
+
if (typeof value2 !== "object" || value2 === null || typeof value2["/"] !== "string") {
|
|
126
129
|
throw new Error("Invalid reference");
|
|
127
130
|
}
|
|
128
|
-
const dxnString =
|
|
131
|
+
const dxnString = value2["/"];
|
|
129
132
|
if (dxnString.length % 2 === 0 && dxnString.slice(0, dxnString.length / 2) === dxnString.slice(dxnString.length / 2) && dxnString.includes("dxn:echo")) {
|
|
130
133
|
throw new Error("Automerge bug detected!");
|
|
131
134
|
}
|
|
132
135
|
return Reference.fromDXN(DXN.parse(dxnString));
|
|
133
136
|
};
|
|
134
|
-
var isEncodedReference = (
|
|
137
|
+
var isEncodedReference = (value2) => typeof value2 === "object" && value2 !== null && Object.keys(value2).length === 1 && typeof value2["/"] === "string";
|
|
138
|
+
var EncodedReference = Object.freeze({
|
|
139
|
+
isEncodedReference,
|
|
140
|
+
getReferenceString: (value2) => {
|
|
141
|
+
assertArgument(isEncodedReference(value2), "value", "invalid reference");
|
|
142
|
+
return value2["/"];
|
|
143
|
+
},
|
|
144
|
+
toDXN: (value2) => {
|
|
145
|
+
return DXN.parse(EncodedReference.getReferenceString(value2));
|
|
146
|
+
},
|
|
147
|
+
fromDXN: (dxn) => {
|
|
148
|
+
return {
|
|
149
|
+
"/": dxn.toString()
|
|
150
|
+
};
|
|
151
|
+
},
|
|
152
|
+
fromLegacyTypename: (typename) => {
|
|
153
|
+
return {
|
|
154
|
+
"/": DXN.fromTypename(typename).toString()
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
});
|
|
135
158
|
|
|
136
|
-
//
|
|
137
|
-
var __dxlog_file = "/
|
|
159
|
+
// src/document-structure.ts
|
|
160
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/core/echo/echo-protocol/src/document-structure.ts";
|
|
138
161
|
var DatabaseDirectory = Object.freeze({
|
|
139
162
|
/**
|
|
140
163
|
* @returns Space key in hex of the space that owns the document. In hex format. Without 0x prefix.
|
|
@@ -202,29 +225,35 @@ var ObjectStructure = Object.freeze({
|
|
|
202
225
|
getRelationTarget: (object) => {
|
|
203
226
|
return object.system?.target;
|
|
204
227
|
},
|
|
228
|
+
getParent: (object) => {
|
|
229
|
+
return object.system?.parent;
|
|
230
|
+
},
|
|
205
231
|
/**
|
|
206
232
|
* @returns All references in the data section of the object.
|
|
207
233
|
*/
|
|
208
234
|
getAllOutgoingReferences: (object) => {
|
|
209
235
|
const references = [];
|
|
210
|
-
const visit2 = (path,
|
|
211
|
-
if (isEncodedReference(
|
|
236
|
+
const visit2 = (path, value2) => {
|
|
237
|
+
if (isEncodedReference(value2)) {
|
|
212
238
|
references.push({
|
|
213
239
|
path,
|
|
214
|
-
reference:
|
|
240
|
+
reference: value2
|
|
215
241
|
});
|
|
216
242
|
} else {
|
|
217
|
-
visitValues(
|
|
243
|
+
visitValues(value2, (value3, key) => visit2([
|
|
218
244
|
...path,
|
|
219
245
|
String(key)
|
|
220
|
-
],
|
|
246
|
+
], value3));
|
|
221
247
|
}
|
|
222
248
|
};
|
|
223
|
-
visitValues(object.data, (
|
|
249
|
+
visitValues(object.data, (value2, key) => visit2([
|
|
224
250
|
String(key)
|
|
225
|
-
],
|
|
251
|
+
], value2));
|
|
226
252
|
return references;
|
|
227
253
|
},
|
|
254
|
+
getTags: (object) => {
|
|
255
|
+
return object.meta.tags ?? [];
|
|
256
|
+
},
|
|
228
257
|
makeObject: ({ type, data, keys }) => {
|
|
229
258
|
return {
|
|
230
259
|
system: {
|
|
@@ -260,7 +289,7 @@ var ObjectStructure = Object.freeze({
|
|
|
260
289
|
var PROPERTY_ID = "id";
|
|
261
290
|
var DATA_NAMESPACE = "data";
|
|
262
291
|
|
|
263
|
-
//
|
|
292
|
+
// src/space-doc-version.ts
|
|
264
293
|
var SpaceDocVersion = Object.freeze({
|
|
265
294
|
/**
|
|
266
295
|
* For the documents created before the versioning was introduced.
|
|
@@ -272,7 +301,7 @@ var SpaceDocVersion = Object.freeze({
|
|
|
272
301
|
CURRENT: 1
|
|
273
302
|
});
|
|
274
303
|
|
|
275
|
-
//
|
|
304
|
+
// src/space-id.ts
|
|
276
305
|
import { subtleCrypto } from "@dxos/crypto";
|
|
277
306
|
import { PublicKey, SpaceId } from "@dxos/keys";
|
|
278
307
|
import { ComplexMap } from "@dxos/util";
|
|
@@ -289,8 +318,9 @@ var createIdFromSpaceKey = async (spaceKey) => {
|
|
|
289
318
|
return spaceId;
|
|
290
319
|
};
|
|
291
320
|
|
|
292
|
-
//
|
|
293
|
-
import
|
|
321
|
+
// src/foreign-key.ts
|
|
322
|
+
import * as Schema from "effect/Schema";
|
|
323
|
+
import * as SchemaAST from "effect/SchemaAST";
|
|
294
324
|
var ForeignKey_ = Schema.Struct({
|
|
295
325
|
/**
|
|
296
326
|
* Name of the foreign database/system.
|
|
@@ -301,42 +331,51 @@ var ForeignKey_ = Schema.Struct({
|
|
|
301
331
|
* Id within the foreign database.
|
|
302
332
|
*/
|
|
303
333
|
// TODO(wittjosiah): This annotation is currently used to ensure id field shows up in forms.
|
|
304
|
-
// TODO(dmaretskyi): `false` is not a valid value for the annotation.
|
|
334
|
+
// TODO(dmaretskyi): `false` is not a valid value for the annotation. Use a different annotation.
|
|
305
335
|
id: Schema.String.annotations({
|
|
306
|
-
[SchemaAST.IdentifierAnnotationId]: false
|
|
336
|
+
[SchemaAST.IdentifierAnnotationId]: "false"
|
|
307
337
|
})
|
|
308
338
|
});
|
|
309
339
|
var ForeignKey = ForeignKey_;
|
|
310
340
|
|
|
311
|
-
//
|
|
341
|
+
// src/query/ast.ts
|
|
312
342
|
var ast_exports = {};
|
|
313
343
|
__export(ast_exports, {
|
|
314
344
|
Filter: () => Filter,
|
|
315
345
|
FilterAnd: () => FilterAnd,
|
|
316
346
|
FilterCompare: () => FilterCompare,
|
|
347
|
+
FilterContains: () => FilterContains,
|
|
317
348
|
FilterIn: () => FilterIn,
|
|
318
349
|
FilterNot: () => FilterNot,
|
|
319
350
|
FilterObject: () => FilterObject,
|
|
320
351
|
FilterOr: () => FilterOr,
|
|
321
352
|
FilterRange: () => FilterRange,
|
|
353
|
+
FilterTag: () => FilterTag,
|
|
322
354
|
FilterTextSearch: () => FilterTextSearch,
|
|
355
|
+
Order: () => Order,
|
|
356
|
+
OrderDirection: () => OrderDirection,
|
|
323
357
|
Query: () => Query,
|
|
324
358
|
QueryFilterClause: () => QueryFilterClause,
|
|
359
|
+
QueryHierarchyTraversalClause: () => QueryHierarchyTraversalClause,
|
|
325
360
|
QueryIncomingReferencesClause: () => QueryIncomingReferencesClause,
|
|
361
|
+
QueryLimitClause: () => QueryLimitClause,
|
|
326
362
|
QueryOptions: () => QueryOptions,
|
|
327
363
|
QueryOptionsClause: () => QueryOptionsClause,
|
|
364
|
+
QueryOrderClause: () => QueryOrderClause,
|
|
328
365
|
QueryReferenceTraversalClause: () => QueryReferenceTraversalClause,
|
|
329
366
|
QueryRelationClause: () => QueryRelationClause,
|
|
330
367
|
QueryRelationTraversalClause: () => QueryRelationTraversalClause,
|
|
331
368
|
QuerySelectClause: () => QuerySelectClause,
|
|
332
369
|
QuerySetDifferenceClause: () => QuerySetDifferenceClause,
|
|
333
370
|
QueryUnionClause: () => QueryUnionClause,
|
|
371
|
+
fold: () => fold,
|
|
334
372
|
visit: () => visit
|
|
335
373
|
});
|
|
336
|
-
import
|
|
374
|
+
import * as Match from "effect/Match";
|
|
375
|
+
import * as Schema2 from "effect/Schema";
|
|
337
376
|
import { DXN as DXN2, ObjectId } from "@dxos/keys";
|
|
338
377
|
var TypenameSpecifier = Schema2.Union(DXN2.Schema, Schema2.Null).annotations({
|
|
339
|
-
description: "DXN or null
|
|
378
|
+
description: "DXN or null; null matches any type"
|
|
340
379
|
});
|
|
341
380
|
var FilterObject_ = Schema2.Struct({
|
|
342
381
|
type: Schema2.Literal("object"),
|
|
@@ -369,6 +408,16 @@ var FilterIn_ = Schema2.Struct({
|
|
|
369
408
|
values: Schema2.Array(Schema2.Any)
|
|
370
409
|
});
|
|
371
410
|
var FilterIn = FilterIn_;
|
|
411
|
+
var FilterContains_ = Schema2.Struct({
|
|
412
|
+
type: Schema2.Literal("contains"),
|
|
413
|
+
value: Schema2.Any
|
|
414
|
+
});
|
|
415
|
+
var FilterContains = FilterContains_;
|
|
416
|
+
var FilterTag_ = Schema2.Struct({
|
|
417
|
+
type: Schema2.Literal("tag"),
|
|
418
|
+
tag: Schema2.String
|
|
419
|
+
});
|
|
420
|
+
var FilterTag = FilterTag_;
|
|
372
421
|
var FilterRange_ = Schema2.Struct({
|
|
373
422
|
type: Schema2.Literal("range"),
|
|
374
423
|
from: Schema2.Any,
|
|
@@ -396,7 +445,9 @@ var FilterOr_ = Schema2.Struct({
|
|
|
396
445
|
filters: Schema2.Array(Schema2.suspend(() => Filter))
|
|
397
446
|
});
|
|
398
447
|
var FilterOr = FilterOr_;
|
|
399
|
-
var Filter = Schema2.Union(FilterObject,
|
|
448
|
+
var Filter = Schema2.Union(FilterObject, FilterCompare, FilterIn, FilterContains, FilterTag, FilterRange, FilterTextSearch, FilterNot, FilterAnd, FilterOr).annotations({
|
|
449
|
+
identifier: "dxos.org/schema/Filter"
|
|
450
|
+
});
|
|
400
451
|
var QuerySelectClause_ = Schema2.Struct({
|
|
401
452
|
type: Schema2.Literal("select"),
|
|
402
453
|
filter: Schema2.suspend(() => Filter)
|
|
@@ -417,7 +468,11 @@ var QueryReferenceTraversalClause = QueryReferenceTraversalClause_;
|
|
|
417
468
|
var QueryIncomingReferencesClause_ = Schema2.Struct({
|
|
418
469
|
type: Schema2.Literal("incoming-references"),
|
|
419
470
|
anchor: Schema2.suspend(() => Query),
|
|
420
|
-
|
|
471
|
+
/**
|
|
472
|
+
* Property path where the reference is located.
|
|
473
|
+
* If null, matches references from any property.
|
|
474
|
+
*/
|
|
475
|
+
property: Schema2.NullOr(Schema2.String),
|
|
421
476
|
typename: TypenameSpecifier
|
|
422
477
|
});
|
|
423
478
|
var QueryIncomingReferencesClause = QueryIncomingReferencesClause_;
|
|
@@ -439,6 +494,16 @@ var QueryRelationTraversalClause_ = Schema2.Struct({
|
|
|
439
494
|
direction: Schema2.Literal("source", "target", "both")
|
|
440
495
|
});
|
|
441
496
|
var QueryRelationTraversalClause = QueryRelationTraversalClause_;
|
|
497
|
+
var QueryHierarchyTraversalClause_ = Schema2.Struct({
|
|
498
|
+
type: Schema2.Literal("hierarchy-traversal"),
|
|
499
|
+
anchor: Schema2.suspend(() => Query),
|
|
500
|
+
/**
|
|
501
|
+
* to-parent: traverse from child to parent.
|
|
502
|
+
* to-children: traverse from parent to children.
|
|
503
|
+
*/
|
|
504
|
+
direction: Schema2.Literal("to-parent", "to-children")
|
|
505
|
+
});
|
|
506
|
+
var QueryHierarchyTraversalClause = QueryHierarchyTraversalClause_;
|
|
442
507
|
var QueryUnionClause_ = Schema2.Struct({
|
|
443
508
|
type: Schema2.Literal("union"),
|
|
444
509
|
queries: Schema2.Array(Schema2.suspend(() => Query))
|
|
@@ -450,50 +515,128 @@ var QuerySetDifferenceClause_ = Schema2.Struct({
|
|
|
450
515
|
exclude: Schema2.suspend(() => Query)
|
|
451
516
|
});
|
|
452
517
|
var QuerySetDifferenceClause = QuerySetDifferenceClause_;
|
|
518
|
+
var OrderDirection = Schema2.Literal("asc", "desc");
|
|
519
|
+
var Order_ = Schema2.Union(Schema2.Struct({
|
|
520
|
+
// How database wants to order them (in practice - by id).
|
|
521
|
+
kind: Schema2.Literal("natural")
|
|
522
|
+
}), Schema2.Struct({
|
|
523
|
+
kind: Schema2.Literal("property"),
|
|
524
|
+
property: Schema2.String,
|
|
525
|
+
direction: OrderDirection
|
|
526
|
+
}), Schema2.Struct({
|
|
527
|
+
// Order by relevance rank (for FTS/vector search results).
|
|
528
|
+
// Default direction is 'desc' (higher rank = better match first).
|
|
529
|
+
kind: Schema2.Literal("rank"),
|
|
530
|
+
direction: OrderDirection
|
|
531
|
+
}));
|
|
532
|
+
var Order = Order_;
|
|
533
|
+
var QueryOrderClause_ = Schema2.Struct({
|
|
534
|
+
type: Schema2.Literal("order"),
|
|
535
|
+
query: Schema2.suspend(() => Query),
|
|
536
|
+
order: Schema2.Array(Order)
|
|
537
|
+
});
|
|
538
|
+
var QueryOrderClause = QueryOrderClause_;
|
|
453
539
|
var QueryOptionsClause_ = Schema2.Struct({
|
|
454
540
|
type: Schema2.Literal("options"),
|
|
455
541
|
query: Schema2.suspend(() => Query),
|
|
456
542
|
options: Schema2.suspend(() => QueryOptions)
|
|
457
543
|
});
|
|
458
544
|
var QueryOptionsClause = QueryOptionsClause_;
|
|
459
|
-
var
|
|
545
|
+
var QueryLimitClause_ = Schema2.Struct({
|
|
546
|
+
type: Schema2.Literal("limit"),
|
|
547
|
+
query: Schema2.suspend(() => Query),
|
|
548
|
+
limit: Schema2.Number
|
|
549
|
+
});
|
|
550
|
+
var QueryLimitClause = QueryLimitClause_;
|
|
551
|
+
var Query_ = Schema2.Union(QuerySelectClause, QueryFilterClause, QueryReferenceTraversalClause, QueryIncomingReferencesClause, QueryRelationClause, QueryRelationTraversalClause, QueryHierarchyTraversalClause, QueryUnionClause, QuerySetDifferenceClause, QueryOrderClause, QueryOptionsClause, QueryLimitClause).annotations({
|
|
552
|
+
identifier: "dxos.org/schema/Query"
|
|
553
|
+
});
|
|
460
554
|
var Query = Query_;
|
|
461
555
|
var QueryOptions = Schema2.Struct({
|
|
556
|
+
/**
|
|
557
|
+
* The nested select statemets will select from the given spaces.
|
|
558
|
+
*
|
|
559
|
+
* NOTE: Spaces and queues are unioned together if both are specified.
|
|
560
|
+
*/
|
|
462
561
|
spaceIds: Schema2.optional(Schema2.Array(Schema2.String)),
|
|
562
|
+
/**
|
|
563
|
+
* If true, the nested select statements will select from all queues in the spaces specified by `spaceIds`.
|
|
564
|
+
*/
|
|
565
|
+
allQueuesFromSpaces: Schema2.optional(Schema2.Boolean),
|
|
566
|
+
/**
|
|
567
|
+
* The nested select statemets will select from the given queues.
|
|
568
|
+
*
|
|
569
|
+
* NOTE: Spaces and queues are unioned together if both are specified.
|
|
570
|
+
*/
|
|
571
|
+
queues: Schema2.optional(Schema2.Array(DXN2.Schema)),
|
|
572
|
+
/**
|
|
573
|
+
* Nested select statements will use this option to filter deleted objects.
|
|
574
|
+
*/
|
|
463
575
|
deleted: Schema2.optional(Schema2.Literal("include", "exclude", "only"))
|
|
464
576
|
});
|
|
465
577
|
var visit = (query, visitor) => {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
}
|
|
578
|
+
visitor(query);
|
|
579
|
+
Match.value(query).pipe(Match.when({
|
|
580
|
+
type: "filter"
|
|
581
|
+
}, ({ selection }) => visit(selection, visitor)), Match.when({
|
|
582
|
+
type: "reference-traversal"
|
|
583
|
+
}, ({ anchor }) => visit(anchor, visitor)), Match.when({
|
|
584
|
+
type: "incoming-references"
|
|
585
|
+
}, ({ anchor }) => visit(anchor, visitor)), Match.when({
|
|
586
|
+
type: "relation"
|
|
587
|
+
}, ({ anchor }) => visit(anchor, visitor)), Match.when({
|
|
588
|
+
type: "options"
|
|
589
|
+
}, ({ query: query2 }) => visit(query2, visitor)), Match.when({
|
|
590
|
+
type: "relation-traversal"
|
|
591
|
+
}, ({ anchor }) => visit(anchor, visitor)), Match.when({
|
|
592
|
+
type: "hierarchy-traversal"
|
|
593
|
+
}, ({ anchor }) => visit(anchor, visitor)), Match.when({
|
|
594
|
+
type: "union"
|
|
595
|
+
}, ({ queries }) => queries.forEach((q) => visit(q, visitor))), Match.when({
|
|
596
|
+
type: "set-difference"
|
|
597
|
+
}, ({ source, exclude }) => {
|
|
598
|
+
visit(source, visitor);
|
|
599
|
+
visit(exclude, visitor);
|
|
600
|
+
}), Match.when({
|
|
601
|
+
type: "order"
|
|
602
|
+
}, ({ query: query2 }) => visit(query2, visitor)), Match.when({
|
|
603
|
+
type: "limit"
|
|
604
|
+
}, ({ query: query2 }) => visit(query2, visitor)), Match.when({
|
|
605
|
+
type: "select"
|
|
606
|
+
}, () => {
|
|
607
|
+
}), Match.exhaustive);
|
|
608
|
+
};
|
|
609
|
+
var fold = (query, reducer) => {
|
|
610
|
+
return Match.value(query).pipe(Match.withReturnType(), Match.when({
|
|
611
|
+
type: "filter"
|
|
612
|
+
}, ({ selection }) => fold(selection, reducer)), Match.when({
|
|
613
|
+
type: "reference-traversal"
|
|
614
|
+
}, ({ anchor }) => fold(anchor, reducer)), Match.when({
|
|
615
|
+
type: "incoming-references"
|
|
616
|
+
}, ({ anchor }) => fold(anchor, reducer)), Match.when({
|
|
617
|
+
type: "relation"
|
|
618
|
+
}, ({ anchor }) => fold(anchor, reducer)), Match.when({
|
|
619
|
+
type: "options"
|
|
620
|
+
}, ({ query: query2 }) => fold(query2, reducer)), Match.when({
|
|
621
|
+
type: "relation-traversal"
|
|
622
|
+
}, ({ anchor }) => fold(anchor, reducer)), Match.when({
|
|
623
|
+
type: "hierarchy-traversal"
|
|
624
|
+
}, ({ anchor }) => fold(anchor, reducer)), Match.when({
|
|
625
|
+
type: "union"
|
|
626
|
+
}, ({ queries }) => queries.flatMap((q) => fold(q, reducer))), Match.when({
|
|
627
|
+
type: "set-difference"
|
|
628
|
+
}, ({ source, exclude }) => fold(source, reducer).concat(fold(exclude, reducer))), Match.when({
|
|
629
|
+
type: "order"
|
|
630
|
+
}, ({ query: query2 }) => fold(query2, reducer)), Match.when({
|
|
631
|
+
type: "limit"
|
|
632
|
+
}, ({ query: query2 }) => fold(query2, reducer)), Match.when({
|
|
633
|
+
type: "select"
|
|
634
|
+
}, () => []), Match.exhaustive);
|
|
493
635
|
};
|
|
494
636
|
export {
|
|
495
637
|
DATA_NAMESPACE,
|
|
496
638
|
DatabaseDirectory,
|
|
639
|
+
EncodedReference,
|
|
497
640
|
ForeignKey,
|
|
498
641
|
ObjectStructure,
|
|
499
642
|
PROPERTY_ID,
|
|
@@ -0,0 +1,7 @@
|
|
|
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 getParent: (object: ObjectStructure): EncodedReference | undefined => {\n return object.system?.parent;\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 getTags: (object: ObjectStructure): string[] => {\n return object.meta.tags ?? [];\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 * Tags.\n * An array of DXNs of Tag objects within the space.\n *\n * NOTE: Optional for backwards compatibilty.\n */\n tags?: string[];\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 * Object parent.\n * Objects with no parent are at the top level of the object hierarchy in the space.\n */\n parent?: EncodedReference;\n\n /**\n * Only for relations.\n */\n source?: EncodedReference;\n\n /**\n * Only for relations.\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), '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 { '/': dxn.toString() };\n },\n fromLegacyTypename: (typename: string): EncodedReference => {\n return { '/': DXN.fromTypename(typename).toString() };\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 * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\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. Use a different 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 * as Match from 'effect/Match';\nimport * as Schema from 'effect/Schema';\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 matches any type',\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\n/**\n * Compare.\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\n/**\n * In.\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\n/**\n * Contains.\n */\nconst FilterContains_ = Schema.Struct({\n type: Schema.Literal('contains'),\n value: Schema.Any,\n});\n\nexport interface FilterContains extends Schema.Schema.Type<typeof FilterContains_> {}\n\n/**\n * Predicate for an array property to contain the provided value.\n * Nested objects are matched using strict structural matching.\n */\nexport const FilterContains: Schema.Schema<FilterContains> = FilterContains_;\n\n/**\n * Filters objects that have certain tag.\n */\nconst FilterTag_ = Schema.Struct({\n type: Schema.Literal('tag'),\n tag: Schema.String, // TODO(burdon): Make OR-collection?\n});\n\nexport interface FilterTag extends Schema.Schema.Type<typeof FilterTag_> {}\nexport const FilterTag: Schema.Schema<FilterTag> = FilterTag_;\n\n/**\n * Range.\n */\nconst FilterRange_ = Schema.Struct({\n type: Schema.Literal('range'),\n from: Schema.Any,\n to: Schema.Any,\n});\n\nexport interface FilterRange extends Schema.Schema.Type<typeof FilterRange_> {}\nexport const FilterRange: Schema.Schema<FilterRange> = FilterRange_;\n\n/**\n * Text search.\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});\n\nexport interface FilterTextSearch extends Schema.Schema.Type<typeof FilterTextSearch_> {}\nexport const FilterTextSearch: Schema.Schema<FilterTextSearch> = FilterTextSearch_;\n\n/**\n * Not.\n */\nconst FilterNot_ = Schema.Struct({\n type: Schema.Literal('not'),\n filter: Schema.suspend(() => Filter),\n});\n\nexport interface FilterNot extends Schema.Schema.Type<typeof FilterNot_> {}\nexport const FilterNot: Schema.Schema<FilterNot> = FilterNot_;\n\n/**\n * And.\n */\nconst FilterAnd_ = Schema.Struct({\n type: Schema.Literal('and'),\n filters: Schema.Array(Schema.suspend(() => Filter)),\n});\n\nexport interface FilterAnd extends Schema.Schema.Type<typeof FilterAnd_> {}\nexport const FilterAnd: Schema.Schema<FilterAnd> = FilterAnd_;\n\n/**\n * Or.\n */\nconst FilterOr_ = Schema.Struct({\n type: Schema.Literal('or'),\n filters: Schema.Array(Schema.suspend(() => Filter)),\n});\n\nexport interface FilterOr extends Schema.Schema.Type<typeof FilterOr_> {}\nexport const FilterOr: Schema.Schema<FilterOr> = FilterOr_;\n\n/**\n * Union of filters.\n */\nexport const Filter = Schema.Union(\n FilterObject,\n FilterCompare,\n FilterIn,\n FilterContains,\n FilterTag,\n FilterRange,\n FilterTextSearch,\n FilterNot,\n FilterAnd,\n FilterOr,\n).annotations({ identifier: 'dxos.org/schema/Filter' });\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});\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});\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});\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 /**\n * Property path where the reference is located.\n * If null, matches references from any property.\n */\n property: Schema.NullOr(Schema.String),\n typename: TypenameSpecifier,\n});\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});\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});\n\nexport interface QueryRelationTraversalClause extends Schema.Schema.Type<typeof QueryRelationTraversalClause_> {}\nexport const QueryRelationTraversalClause: Schema.Schema<QueryRelationTraversalClause> = QueryRelationTraversalClause_;\n\n/**\n * Traverse parent-child hierarchy.\n */\nconst QueryHierarchyTraversalClause_ = Schema.Struct({\n type: Schema.Literal('hierarchy-traversal'),\n anchor: Schema.suspend(() => Query),\n /**\n * to-parent: traverse from child to parent.\n * to-children: traverse from parent to children.\n */\n direction: Schema.Literal('to-parent', 'to-children'),\n});\n\nexport interface QueryHierarchyTraversalClause extends Schema.Schema.Type<typeof QueryHierarchyTraversalClause_> {}\nexport const QueryHierarchyTraversalClause: Schema.Schema<QueryHierarchyTraversalClause> =\n QueryHierarchyTraversalClause_;\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});\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});\n\nexport interface QuerySetDifferenceClause extends Schema.Schema.Type<typeof QuerySetDifferenceClause_> {}\nexport const QuerySetDifferenceClause: Schema.Schema<QuerySetDifferenceClause> = QuerySetDifferenceClause_;\n\nexport const OrderDirection = Schema.Literal('asc', 'desc');\nexport type OrderDirection = Schema.Schema.Type<typeof OrderDirection>;\n\nconst Order_ = Schema.Union(\n Schema.Struct({\n // How database wants to order them (in practice - by id).\n kind: Schema.Literal('natural'),\n }),\n Schema.Struct({\n kind: Schema.Literal('property'),\n property: Schema.String,\n direction: OrderDirection,\n }),\n Schema.Struct({\n // Order by relevance rank (for FTS/vector search results).\n // Default direction is 'desc' (higher rank = better match first).\n kind: Schema.Literal('rank'),\n direction: OrderDirection,\n }),\n);\n\nexport type Order = Schema.Schema.Type<typeof Order_>;\nexport const Order: Schema.Schema<Order> = Order_;\n\n/**\n * Order the query results.\n * Left-to-right the orders dominate.\n */\nconst QueryOrderClause_ = Schema.Struct({\n type: Schema.Literal('order'),\n query: Schema.suspend(() => Query),\n order: Schema.Array(Order),\n});\n\nexport interface QueryOrderClause extends Schema.Schema.Type<typeof QueryOrderClause_> {}\nexport const QueryOrderClause: Schema.Schema<QueryOrderClause> = QueryOrderClause_;\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});\n\nexport interface QueryOptionsClause extends Schema.Schema.Type<typeof QueryOptionsClause_> {}\nexport const QueryOptionsClause: Schema.Schema<QueryOptionsClause> = QueryOptionsClause_;\n\n/**\n * Limit the number of results.\n */\nconst QueryLimitClause_ = Schema.Struct({\n type: Schema.Literal('limit'),\n query: Schema.suspend(() => Query),\n limit: Schema.Number,\n});\n\nexport interface QueryLimitClause extends Schema.Schema.Type<typeof QueryLimitClause_> {}\nexport const QueryLimitClause: Schema.Schema<QueryLimitClause> = QueryLimitClause_;\n\nconst Query_ = Schema.Union(\n QuerySelectClause,\n QueryFilterClause,\n QueryReferenceTraversalClause,\n QueryIncomingReferencesClause,\n QueryRelationClause,\n QueryRelationTraversalClause,\n QueryHierarchyTraversalClause,\n QueryUnionClause,\n QuerySetDifferenceClause,\n QueryOrderClause,\n QueryOptionsClause,\n QueryLimitClause,\n).annotations({ identifier: 'dxos.org/schema/Query' });\n\nexport type Query = Schema.Schema.Type<typeof Query_>;\nexport const Query: Schema.Schema<Query> = Query_;\n\nexport const QueryOptions = Schema.Struct({\n /**\n * The nested select statemets will select from the given spaces.\n *\n * NOTE: Spaces and queues are unioned together if both are specified.\n */\n spaceIds: Schema.optional(Schema.Array(Schema.String)),\n\n /**\n * If true, the nested select statements will select from all queues in the spaces specified by `spaceIds`.\n */\n allQueuesFromSpaces: Schema.optional(Schema.Boolean),\n\n /**\n * The nested select statemets will select from the given queues.\n *\n * NOTE: Spaces and queues are unioned together if both are specified.\n */\n queues: Schema.optional(Schema.Array(DXN.Schema)),\n\n /**\n * Nested select statements will use this option to filter deleted objects.\n */\n deleted: Schema.optional(Schema.Literal('include', 'exclude', 'only')),\n});\n\nexport interface QueryOptions extends Schema.Schema.Type<typeof QueryOptions> {}\n\nexport const visit = (query: Query, visitor: (node: Query) => void) => {\n visitor(query);\n\n Match.value(query).pipe(\n Match.when({ type: 'filter' }, ({ selection }) => visit(selection, visitor)),\n Match.when({ type: 'reference-traversal' }, ({ anchor }) => visit(anchor, visitor)),\n Match.when({ type: 'incoming-references' }, ({ anchor }) => visit(anchor, visitor)),\n Match.when({ type: 'relation' }, ({ anchor }) => visit(anchor, visitor)),\n Match.when({ type: 'options' }, ({ query }) => visit(query, visitor)),\n Match.when({ type: 'relation-traversal' }, ({ anchor }) => visit(anchor, visitor)),\n Match.when({ type: 'hierarchy-traversal' }, ({ anchor }) => visit(anchor, visitor)),\n Match.when({ type: 'union' }, ({ queries }) => queries.forEach((q) => visit(q, visitor))),\n Match.when({ type: 'set-difference' }, ({ source, exclude }) => {\n visit(source, visitor);\n visit(exclude, visitor);\n }),\n Match.when({ type: 'order' }, ({ query }) => visit(query, visitor)),\n Match.when({ type: 'limit' }, ({ query }) => visit(query, visitor)),\n Match.when({ type: 'select' }, () => {}),\n Match.exhaustive,\n );\n};\n\nexport const fold = <T>(query: Query, reducer: (node: Query) => T): T[] => {\n return Match.value(query).pipe(\n Match.withReturnType<T[]>(),\n Match.when({ type: 'filter' }, ({ selection }) => fold(selection, reducer)),\n Match.when({ type: 'reference-traversal' }, ({ anchor }) => fold(anchor, reducer)),\n Match.when({ type: 'incoming-references' }, ({ anchor }) => fold(anchor, reducer)),\n Match.when({ type: 'relation' }, ({ anchor }) => fold(anchor, reducer)),\n Match.when({ type: 'options' }, ({ query }) => fold(query, reducer)),\n Match.when({ type: 'relation-traversal' }, ({ anchor }) => fold(anchor, reducer)),\n Match.when({ type: 'hierarchy-traversal' }, ({ anchor }) => fold(anchor, reducer)),\n Match.when({ type: 'union' }, ({ queries }) => queries.flatMap((q) => fold(q, reducer))),\n Match.when({ type: 'set-difference' }, ({ source, exclude }) =>\n fold(source, reducer).concat(fold(exclude, reducer)),\n ),\n Match.when({ type: 'order' }, ({ query }) => fold(query, reducer)),\n Match.when({ type: 'limit' }, ({ query }) => fold(query, reducer)),\n Match.when({ type: 'select' }, () => []),\n Match.exhaustive,\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,Y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,GACnEL,WAAK;IAAEpG,MAAM;EAAW,GAAG,CAAC,EAAEsD,OAAM,MAAOkD,KAAKlD,QAAQmD,OAAAA,CAAAA,GACxDL,WAAK;IAAEpG,MAAM;EAAU,GAAG,CAAC,EAAE+E,OAAAA,OAAK,MAAOyB,KAAKzB,QAAO0B,OAAAA,CAAAA,GACrDL,WAAK;IAAEpG,MAAM;EAAqB,GAAG,CAAC,EAAEsD,OAAM,MAAOkD,KAAKlD,QAAQmD,OAAAA,CAAAA,GAClEL,WAAK;IAAEpG,MAAM;EAAsB,GAAG,CAAC,EAAEsD,OAAM,MAAOkD,KAAKlD,QAAQmD,OAAAA,CAAAA,GACnEL,WAAK;IAAEpG,MAAM;EAAQ,GAAG,CAAC,EAAEoE,QAAO,MAAOA,QAAQuC,QAAQ,CAACL,MAAME,KAAKF,GAAGG,OAAAA,CAAAA,CAAAA,GACxEL,WAAK;IAAEpG,MAAM;EAAiB,GAAG,CAAC,EAAEuE,QAAQC,QAAO,MACvDgC,KAAKjC,QAAQkC,OAAAA,EAASG,OAAOJ,KAAKhC,SAASiC,OAAAA,CAAAA,CAAAA,GAEvCL,WAAK;IAAEpG,MAAM;EAAQ,GAAG,CAAC,EAAE+E,OAAAA,OAAK,MAAOyB,KAAKzB,QAAO0B,OAAAA,CAAAA,GACnDL,WAAK;IAAEpG,MAAM;EAAQ,GAAG,CAAC,EAAE+E,OAAAA,OAAK,MAAOyB,KAAKzB,QAAO0B,OAAAA,CAAAA,GACnDL,WAAK;IAAEpG,MAAM;EAAS,GAAG,MAAM,CAAA,CAAE,GACjCuG,gBAAU;AAEpB;",
|
|
6
|
+
"names": ["invariant", "visitValues", "assertArgument", "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", "EncodedReference", "freeze", "getReferenceString", "assertArgument", "typename", "fromTypename", "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", "getParent", "parent", "getAllOutgoingReferences", "references", "visit", "path", "value", "isEncodedReference", "push", "reference", "visitValues", "key", "data", "getTags", "meta", "tags", "makeObject", "keys", "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_", "Struct", "source", "String", "id", "annotations", "IdentifierAnnotationId", "ForeignKey", "Match", "Schema", "DXN", "ObjectId", "TypenameSpecifier", "Union", "DXN", "Schema", "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", "FilterContains_", "FilterContains", "FilterTag_", "tag", "FilterTag", "FilterRange_", "from", "to", "FilterRange", "FilterTextSearch_", "text", "searchKind", "FilterTextSearch", "FilterNot_", "filter", "FilterNot", "FilterAnd_", "filters", "FilterAnd", "FilterOr_", "FilterOr", "identifier", "QuerySelectClause_", "QuerySelectClause", "QueryFilterClause_", "selection", "Query", "QueryFilterClause", "QueryReferenceTraversalClause_", "anchor", "property", "QueryReferenceTraversalClause", "QueryIncomingReferencesClause_", "NullOr", "QueryIncomingReferencesClause", "QueryRelationClause_", "direction", "QueryRelationClause", "QueryRelationTraversalClause_", "QueryRelationTraversalClause", "QueryHierarchyTraversalClause_", "QueryHierarchyTraversalClause", "QueryUnionClause_", "queries", "QueryUnionClause", "QuerySetDifferenceClause_", "source", "exclude", "QuerySetDifferenceClause", "OrderDirection", "Order_", "kind", "Order", "QueryOrderClause_", "query", "order", "QueryOrderClause", "QueryOptionsClause_", "options", "QueryOptions", "QueryOptionsClause", "QueryLimitClause_", "limit", "Number", "QueryLimitClause", "Query_", "spaceIds", "allQueuesFromSpaces", "Boolean", "queues", "deleted", "visit", "visitor", "Match", "pipe", "when", "forEach", "q", "exhaustive", "fold", "reducer", "withReturnType", "flatMap", "concat"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/reference.ts":{"bytes":17438,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true}],"format":"esm"},"src/document-structure.ts":{"bytes":16741,"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":2618,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true}],"format":"esm"},"src/query/ast.ts":{"bytes":44393,"imports":[{"path":"effect/Match","kind":"import-statement","external":true},{"path":"effect/Schema","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/neutral/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":44683},"dist/lib/neutral/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/Schema","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true},{"path":"effect/Schema","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":3165},"src/reference.ts":{"bytesInOutput":3823},"src/index.ts":{"bytesInOutput":0},"src/space-doc-version.ts":{"bytesInOutput":179},"src/space-id.ts":{"bytesInOutput":604},"src/foreign-key.ts":{"bytesInOutput":586},"src/query/ast.ts":{"bytesInOutput":10839},"src/query/index.ts":{"bytesInOutput":0}},"bytes":19855}}}
|
|
@@ -74,6 +74,7 @@ export declare const ObjectStructure: Readonly<{
|
|
|
74
74
|
isDeleted: (object: ObjectStructure) => boolean;
|
|
75
75
|
getRelationSource: (object: ObjectStructure) => EncodedReference | undefined;
|
|
76
76
|
getRelationTarget: (object: ObjectStructure) => EncodedReference | undefined;
|
|
77
|
+
getParent: (object: ObjectStructure) => EncodedReference | undefined;
|
|
77
78
|
/**
|
|
78
79
|
* @returns All references in the data section of the object.
|
|
79
80
|
*/
|
|
@@ -81,6 +82,7 @@ export declare const ObjectStructure: Readonly<{
|
|
|
81
82
|
path: ObjectPropPath;
|
|
82
83
|
reference: EncodedReference;
|
|
83
84
|
}[];
|
|
85
|
+
getTags: (object: ObjectStructure) => string[];
|
|
84
86
|
makeObject: ({ type, data, keys, }: {
|
|
85
87
|
type: DXN.String;
|
|
86
88
|
deleted?: boolean;
|
|
@@ -104,6 +106,13 @@ export type ObjectMeta = {
|
|
|
104
106
|
* Foreign keys.
|
|
105
107
|
*/
|
|
106
108
|
keys: ForeignKey[];
|
|
109
|
+
/**
|
|
110
|
+
* Tags.
|
|
111
|
+
* An array of DXNs of Tag objects within the space.
|
|
112
|
+
*
|
|
113
|
+
* NOTE: Optional for backwards compatibilty.
|
|
114
|
+
*/
|
|
115
|
+
tags?: string[];
|
|
107
116
|
};
|
|
108
117
|
/**
|
|
109
118
|
* Automerge object system properties.
|
|
@@ -122,12 +131,17 @@ export type ObjectSystem = {
|
|
|
122
131
|
* Deletion marker.
|
|
123
132
|
*/
|
|
124
133
|
deleted?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Object parent.
|
|
136
|
+
* Objects with no parent are at the top level of the object hierarchy in the space.
|
|
137
|
+
*/
|
|
138
|
+
parent?: EncodedReference;
|
|
125
139
|
/**
|
|
126
140
|
* Only for relations.
|
|
127
141
|
*/
|
|
128
142
|
source?: EncodedReference;
|
|
129
143
|
/**
|
|
130
|
-
* Only for relations.
|
|
144
|
+
* Only for relations.
|
|
131
145
|
*/
|
|
132
146
|
target?: EncodedReference;
|
|
133
147
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-structure.d.ts","sourceRoot":"","sources":["../../../src/document-structure.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"document-structure.d.ts","sourceRoot":"","sources":["../../../src/document-structure.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,KAAK,gBAAgB,EAAsB,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,MAAM,UAAU,GAAG;IAEvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAChC,MAAM,MAAM,cAAc,GAAG,UAAU,EAAE,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,eAAe,CAAC;IAE1B,MAAM,CAAC,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF;;OAEG;IACH,OAAO,CAAC,E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,EAAE;wCAQzC;QACD,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC;QACpB,IAAI,CAAC,EAAE,OAAO,CAAC;KAChB,KAAG,eAAe;mEAoBhB;QACD,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC;QACjB,MAAM,EAAE,gBAAgB,CAAC;QACzB,MAAM,EAAE,gBAAgB,CAAC;QACzB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC;QACpB,IAAI,CAAC,EAAE,OAAO,CAAC;KAChB,KAAG,eAAe;EAenB,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,IAAI,EAAE,UAAU,EAAE,CAAC;IAEnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAE7B;;OAEG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IAExB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAE1B;;OAEG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAE1B;;OAEG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,OAAO,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,cAAc,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"foreign-key.d.ts","sourceRoot":"","sources":["../../../src/foreign-key.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"foreign-key.d.ts","sourceRoot":"","sources":["../../../src/foreign-key.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,QAAA,MAAM,WAAW;IACf;;;OAGG;;IAGH;;OAEG;;EAIH,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAe,CAAC"}
|