@dxos/echo-protocol 0.8.4-main.406dc2a → 0.8.4-main.40e3dcdf1b

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.
@@ -1 +0,0 @@
1
- {"inputs":{"src/reference.ts":{"bytes":17504,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true}],"format":"esm"},"src/document-structure.ts":{"bytes":16209,"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":38728,"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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":41250},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect/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":3099},"src/reference.ts":{"bytesInOutput":4060},"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":9255},"src/query/index.ts":{"bytesInOutput":0}},"bytes":18442}}}
@@ -1,613 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- var __defProp = Object.defineProperty;
3
- var __export = (target, all) => {
4
- for (var name in all)
5
- __defProp(target, name, { get: all[name], enumerable: true });
6
- };
7
-
8
- // src/document-structure.ts
9
- import { invariant } from "@dxos/invariant";
10
- import { visitValues } from "@dxos/util";
11
-
12
- // src/reference.ts
13
- import { assertArgument } from "@dxos/invariant";
14
- import { DXN, LOCAL_SPACE_TAG } from "@dxos/keys";
15
- function _define_property(obj, key, value2) {
16
- if (key in obj) {
17
- Object.defineProperty(obj, key, {
18
- value: value2,
19
- enumerable: true,
20
- configurable: true,
21
- writable: true
22
- });
23
- } else {
24
- obj[key] = value2;
25
- }
26
- return obj;
27
- }
28
- var Reference = class _Reference {
29
- static fromDXN(dxn) {
30
- switch (dxn.kind) {
31
- case DXN.kind.TYPE:
32
- return new _Reference(dxn.parts[0], _Reference.TYPE_PROTOCOL, "dxos.org", dxn);
33
- case DXN.kind.ECHO:
34
- if (dxn.parts[0] === LOCAL_SPACE_TAG) {
35
- return new _Reference(dxn.parts[1], void 0, void 0, dxn);
36
- } else {
37
- return new _Reference(dxn.parts[1], void 0, dxn.parts[0], dxn);
38
- }
39
- default:
40
- return new _Reference(dxn.parts[0], void 0, dxn.parts[0], dxn);
41
- }
42
- }
43
- static fromValue(value2) {
44
- return new _Reference(value2.objectId, value2.protocol, value2.host);
45
- }
46
- /**
47
- * Reference an object in the local space.
48
- */
49
- static localObjectReference(objectId) {
50
- return new _Reference(objectId);
51
- }
52
- /**
53
- * @deprecated
54
- */
55
- // TODO(dmaretskyi): Remove.
56
- static fromLegacyTypename(type) {
57
- return new _Reference(type, _Reference.TYPE_PROTOCOL, "dxos.org");
58
- }
59
- /**
60
- * @deprecated
61
- */
62
- // TODO(dmaretskyi): Remove
63
- static fromObjectIdAndSpaceKey(objectId, spaceKey) {
64
- return new _Reference(objectId, void 0, spaceKey.toHex());
65
- }
66
- get dxn() {
67
- return this._dxn;
68
- }
69
- /**
70
- * @deprecated
71
- */
72
- // TODO(dmaretskyi): Remove.
73
- get objectId() {
74
- return this._objectId;
75
- }
76
- /**
77
- * @deprecated
78
- */
79
- // TODO(dmaretskyi): Remove.
80
- get protocol() {
81
- return this._protocol;
82
- }
83
- /**
84
- * @deprecated
85
- */
86
- // TODO(dmaretskyi): Remove.
87
- get host() {
88
- return this._host;
89
- }
90
- encode() {
91
- return {
92
- objectId: this.objectId,
93
- host: this.host,
94
- protocol: this.protocol
95
- };
96
- }
97
- // TODO(dmaretskyi): Remove in favor of `reference.dxn`.
98
- toDXN() {
99
- if (this._dxn) {
100
- return this._dxn;
101
- }
102
- if (this.protocol === _Reference.TYPE_PROTOCOL) {
103
- return new DXN(DXN.kind.TYPE, [
104
- this.objectId
105
- ]);
106
- } else {
107
- if (this.host) {
108
- return new DXN(DXN.kind.ECHO, [
109
- this.host,
110
- this.objectId
111
- ]);
112
- } else {
113
- return new DXN(DXN.kind.ECHO, [
114
- LOCAL_SPACE_TAG,
115
- this.objectId
116
- ]);
117
- }
118
- }
119
- }
120
- // prettier-ignore
121
- constructor(_objectId, _protocol, _host, _dxn) {
122
- _define_property(this, "_objectId", void 0);
123
- _define_property(this, "_protocol", void 0);
124
- _define_property(this, "_host", void 0);
125
- _define_property(this, "_dxn", void 0);
126
- this._objectId = _objectId;
127
- this._protocol = _protocol;
128
- this._host = _host;
129
- this._dxn = _dxn;
130
- }
131
- };
132
- _define_property(Reference, "TYPE_PROTOCOL", "protobuf");
133
- var REFERENCE_TYPE_TAG = "dxos.echo.model.document.Reference";
134
- var encodeReference = (reference) => ({
135
- "/": reference.toDXN().toString()
136
- });
137
- var decodeReference = (value2) => {
138
- if (typeof value2 !== "object" || value2 === null || typeof value2["/"] !== "string") {
139
- throw new Error("Invalid reference");
140
- }
141
- const dxnString = value2["/"];
142
- if (dxnString.length % 2 === 0 && dxnString.slice(0, dxnString.length / 2) === dxnString.slice(dxnString.length / 2) && dxnString.includes("dxn:echo")) {
143
- throw new Error("Automerge bug detected!");
144
- }
145
- return Reference.fromDXN(DXN.parse(dxnString));
146
- };
147
- var isEncodedReference = (value2) => typeof value2 === "object" && value2 !== null && Object.keys(value2).length === 1 && typeof value2["/"] === "string";
148
- var EncodedReference = Object.freeze({
149
- isEncodedReference,
150
- getReferenceString: (value2) => {
151
- assertArgument(isEncodedReference(value2), "value", "invalid reference");
152
- return value2["/"];
153
- },
154
- toDXN: (value2) => {
155
- return DXN.parse(EncodedReference.getReferenceString(value2));
156
- },
157
- fromDXN: (dxn) => {
158
- return encodeReference(Reference.fromDXN(dxn));
159
- }
160
- });
161
-
162
- // src/document-structure.ts
163
- var __dxlog_file = "/__w/dxos/dxos/packages/core/echo/echo-protocol/src/document-structure.ts";
164
- var DatabaseDirectory = Object.freeze({
165
- /**
166
- * @returns Space key in hex of the space that owns the document. In hex format. Without 0x prefix.
167
- */
168
- getSpaceKey: (doc) => {
169
- const rawSpaceKey = doc.access?.spaceKey ?? doc.experimental_spaceKey;
170
- if (rawSpaceKey == null) {
171
- return null;
172
- }
173
- const rawKey = String(rawSpaceKey);
174
- invariant(!rawKey.startsWith("0x"), "Space key must not start with 0x", {
175
- F: __dxlog_file,
176
- L: 66,
177
- S: void 0,
178
- A: [
179
- "!rawKey.startsWith('0x')",
180
- "'Space key must not start with 0x'"
181
- ]
182
- });
183
- return rawKey;
184
- },
185
- getInlineObject: (doc, id) => {
186
- return doc.objects?.[id];
187
- },
188
- getLink: (doc, id) => {
189
- return doc.links?.[id]?.toString();
190
- },
191
- make: ({ spaceKey, objects, links }) => ({
192
- access: {
193
- spaceKey
194
- },
195
- objects: objects ?? {},
196
- links: links ?? {}
197
- })
198
- });
199
- var ObjectStructure = Object.freeze({
200
- /**
201
- * @throws On invalid object structure.
202
- */
203
- getTypeReference: (object) => {
204
- return object.system?.type;
205
- },
206
- /**
207
- * @throws On invalid object structure.
208
- */
209
- getEntityKind: (object) => {
210
- const kind = object.system?.kind ?? "object";
211
- invariant(kind === "object" || kind === "relation", "Invalid kind", {
212
- F: __dxlog_file,
213
- L: 124,
214
- S: void 0,
215
- A: [
216
- "kind === 'object' || kind === 'relation'",
217
- "'Invalid kind'"
218
- ]
219
- });
220
- return kind;
221
- },
222
- isDeleted: (object) => {
223
- return object.system?.deleted ?? false;
224
- },
225
- getRelationSource: (object) => {
226
- return object.system?.source;
227
- },
228
- getRelationTarget: (object) => {
229
- return object.system?.target;
230
- },
231
- /**
232
- * @returns All references in the data section of the object.
233
- */
234
- getAllOutgoingReferences: (object) => {
235
- const references = [];
236
- const visit2 = (path, value2) => {
237
- if (isEncodedReference(value2)) {
238
- references.push({
239
- path,
240
- reference: value2
241
- });
242
- } else {
243
- visitValues(value2, (value3, key) => visit2([
244
- ...path,
245
- String(key)
246
- ], value3));
247
- }
248
- };
249
- visitValues(object.data, (value2, key) => visit2([
250
- String(key)
251
- ], value2));
252
- return references;
253
- },
254
- getTags: (object) => {
255
- return object.meta.tags ?? [];
256
- },
257
- makeObject: ({ type, data, keys }) => {
258
- return {
259
- system: {
260
- kind: "object",
261
- type: {
262
- "/": type
263
- }
264
- },
265
- meta: {
266
- keys: keys ?? []
267
- },
268
- data: data ?? {}
269
- };
270
- },
271
- makeRelation: ({ type, source, target, deleted, keys, data }) => {
272
- return {
273
- system: {
274
- kind: "relation",
275
- type: {
276
- "/": type
277
- },
278
- source,
279
- target,
280
- deleted: deleted ?? false
281
- },
282
- meta: {
283
- keys: keys ?? []
284
- },
285
- data: data ?? {}
286
- };
287
- }
288
- });
289
- var PROPERTY_ID = "id";
290
- var DATA_NAMESPACE = "data";
291
-
292
- // src/space-doc-version.ts
293
- var SpaceDocVersion = Object.freeze({
294
- /**
295
- * For the documents created before the versioning was introduced.
296
- */
297
- LEGACY: 0,
298
- /**
299
- * Current version.
300
- */
301
- CURRENT: 1
302
- });
303
-
304
- // src/space-id.ts
305
- import { subtleCrypto } from "@dxos/crypto";
306
- import { PublicKey, SpaceId } from "@dxos/keys";
307
- import { ComplexMap } from "@dxos/util";
308
- var SPACE_IDS_CACHE = new ComplexMap(PublicKey.hash);
309
- var createIdFromSpaceKey = async (spaceKey) => {
310
- const cachedValue = SPACE_IDS_CACHE.get(spaceKey);
311
- if (cachedValue !== void 0) {
312
- return cachedValue;
313
- }
314
- const digest = await subtleCrypto.digest("SHA-256", spaceKey.asUint8Array());
315
- const bytes = new Uint8Array(digest).slice(0, SpaceId.byteLength);
316
- const spaceId = SpaceId.encode(bytes);
317
- SPACE_IDS_CACHE.set(spaceKey, spaceId);
318
- return spaceId;
319
- };
320
-
321
- // src/foreign-key.ts
322
- import * as Schema from "effect/Schema";
323
- import * as SchemaAST from "effect/SchemaAST";
324
- var ForeignKey_ = Schema.Struct({
325
- /**
326
- * Name of the foreign database/system.
327
- * E.g., `github.com`.
328
- */
329
- source: Schema.String,
330
- /**
331
- * Id within the foreign database.
332
- */
333
- // TODO(wittjosiah): This annotation is currently used to ensure id field shows up in forms.
334
- // TODO(dmaretskyi): `false` is not a valid value for the annotation. Use a different annotation.
335
- id: Schema.String.annotations({
336
- [SchemaAST.IdentifierAnnotationId]: "false"
337
- })
338
- });
339
- var ForeignKey = ForeignKey_;
340
-
341
- // src/query/ast.ts
342
- var ast_exports = {};
343
- __export(ast_exports, {
344
- Filter: () => Filter,
345
- FilterAnd: () => FilterAnd,
346
- FilterCompare: () => FilterCompare,
347
- FilterContains: () => FilterContains,
348
- FilterIn: () => FilterIn,
349
- FilterNot: () => FilterNot,
350
- FilterObject: () => FilterObject,
351
- FilterOr: () => FilterOr,
352
- FilterRange: () => FilterRange,
353
- FilterTag: () => FilterTag,
354
- FilterTextSearch: () => FilterTextSearch,
355
- Order: () => Order,
356
- OrderDirection: () => OrderDirection,
357
- Query: () => Query,
358
- QueryFilterClause: () => QueryFilterClause,
359
- QueryIncomingReferencesClause: () => QueryIncomingReferencesClause,
360
- QueryOptions: () => QueryOptions,
361
- QueryOptionsClause: () => QueryOptionsClause,
362
- QueryOrderClause: () => QueryOrderClause,
363
- QueryReferenceTraversalClause: () => QueryReferenceTraversalClause,
364
- QueryRelationClause: () => QueryRelationClause,
365
- QueryRelationTraversalClause: () => QueryRelationTraversalClause,
366
- QuerySelectClause: () => QuerySelectClause,
367
- QuerySetDifferenceClause: () => QuerySetDifferenceClause,
368
- QueryUnionClause: () => QueryUnionClause,
369
- fold: () => fold,
370
- visit: () => visit
371
- });
372
- import * as Match from "effect/Match";
373
- import * as Schema2 from "effect/Schema";
374
- import { DXN as DXN2, ObjectId } from "@dxos/keys";
375
- var TypenameSpecifier = Schema2.Union(DXN2.Schema, Schema2.Null).annotations({
376
- description: "DXN or null. Null means any type will match"
377
- });
378
- var FilterObject_ = Schema2.Struct({
379
- type: Schema2.Literal("object"),
380
- typename: TypenameSpecifier,
381
- id: Schema2.optional(Schema2.Array(ObjectId)),
382
- /**
383
- * Filter by property.
384
- * Must not include object ID.
385
- */
386
- props: Schema2.Record({
387
- key: Schema2.String.annotations({
388
- description: "Property name"
389
- }),
390
- value: Schema2.suspend(() => Filter)
391
- }),
392
- /**
393
- * Objects that have any of the given foreign keys.
394
- */
395
- foreignKeys: Schema2.optional(Schema2.Array(ForeignKey))
396
- });
397
- var FilterObject = FilterObject_;
398
- var FilterCompare_ = Schema2.Struct({
399
- type: Schema2.Literal("compare"),
400
- operator: Schema2.Literal("eq", "neq", "gt", "gte", "lt", "lte"),
401
- value: Schema2.Unknown
402
- });
403
- var FilterCompare = FilterCompare_;
404
- var FilterIn_ = Schema2.Struct({
405
- type: Schema2.Literal("in"),
406
- values: Schema2.Array(Schema2.Any)
407
- });
408
- var FilterIn = FilterIn_;
409
- var FilterContains_ = Schema2.Struct({
410
- type: Schema2.Literal("contains"),
411
- value: Schema2.Any
412
- });
413
- var FilterContains = FilterContains_;
414
- var FilterTag_ = Schema2.Struct({
415
- type: Schema2.Literal("tag"),
416
- tag: Schema2.String
417
- });
418
- var FilterTag = FilterTag_;
419
- var FilterRange_ = Schema2.Struct({
420
- type: Schema2.Literal("range"),
421
- from: Schema2.Any,
422
- to: Schema2.Any
423
- });
424
- var FilterRange = FilterRange_;
425
- var FilterTextSearch_ = Schema2.Struct({
426
- type: Schema2.Literal("text-search"),
427
- text: Schema2.String,
428
- searchKind: Schema2.optional(Schema2.Literal("full-text", "vector"))
429
- });
430
- var FilterTextSearch = FilterTextSearch_;
431
- var FilterNot_ = Schema2.Struct({
432
- type: Schema2.Literal("not"),
433
- filter: Schema2.suspend(() => Filter)
434
- });
435
- var FilterNot = FilterNot_;
436
- var FilterAnd_ = Schema2.Struct({
437
- type: Schema2.Literal("and"),
438
- filters: Schema2.Array(Schema2.suspend(() => Filter))
439
- });
440
- var FilterAnd = FilterAnd_;
441
- var FilterOr_ = Schema2.Struct({
442
- type: Schema2.Literal("or"),
443
- filters: Schema2.Array(Schema2.suspend(() => Filter))
444
- });
445
- var FilterOr = FilterOr_;
446
- var Filter = Schema2.Union(FilterObject, FilterCompare, FilterIn, FilterContains, FilterTag, FilterRange, FilterTextSearch, FilterNot, FilterAnd, FilterOr).annotations({
447
- identifier: "dxos.org/schema/Filter"
448
- });
449
- var QuerySelectClause_ = Schema2.Struct({
450
- type: Schema2.Literal("select"),
451
- filter: Schema2.suspend(() => Filter)
452
- });
453
- var QuerySelectClause = QuerySelectClause_;
454
- var QueryFilterClause_ = Schema2.Struct({
455
- type: Schema2.Literal("filter"),
456
- selection: Schema2.suspend(() => Query),
457
- filter: Schema2.suspend(() => Filter)
458
- });
459
- var QueryFilterClause = QueryFilterClause_;
460
- var QueryReferenceTraversalClause_ = Schema2.Struct({
461
- type: Schema2.Literal("reference-traversal"),
462
- anchor: Schema2.suspend(() => Query),
463
- property: Schema2.String
464
- });
465
- var QueryReferenceTraversalClause = QueryReferenceTraversalClause_;
466
- var QueryIncomingReferencesClause_ = Schema2.Struct({
467
- type: Schema2.Literal("incoming-references"),
468
- anchor: Schema2.suspend(() => Query),
469
- property: Schema2.String,
470
- typename: TypenameSpecifier
471
- });
472
- var QueryIncomingReferencesClause = QueryIncomingReferencesClause_;
473
- var QueryRelationClause_ = Schema2.Struct({
474
- type: Schema2.Literal("relation"),
475
- anchor: Schema2.suspend(() => Query),
476
- /**
477
- * outgoing: anchor is the source of the relation.
478
- * incoming: anchor is the target of the relation.
479
- * both: anchor is either the source or target of the relation.
480
- */
481
- direction: Schema2.Literal("outgoing", "incoming", "both"),
482
- filter: Schema2.optional(Schema2.suspend(() => Filter))
483
- });
484
- var QueryRelationClause = QueryRelationClause_;
485
- var QueryRelationTraversalClause_ = Schema2.Struct({
486
- type: Schema2.Literal("relation-traversal"),
487
- anchor: Schema2.suspend(() => Query),
488
- direction: Schema2.Literal("source", "target", "both")
489
- });
490
- var QueryRelationTraversalClause = QueryRelationTraversalClause_;
491
- var QueryUnionClause_ = Schema2.Struct({
492
- type: Schema2.Literal("union"),
493
- queries: Schema2.Array(Schema2.suspend(() => Query))
494
- });
495
- var QueryUnionClause = QueryUnionClause_;
496
- var QuerySetDifferenceClause_ = Schema2.Struct({
497
- type: Schema2.Literal("set-difference"),
498
- source: Schema2.suspend(() => Query),
499
- exclude: Schema2.suspend(() => Query)
500
- });
501
- var QuerySetDifferenceClause = QuerySetDifferenceClause_;
502
- var OrderDirection = Schema2.Literal("asc", "desc");
503
- var Order_ = Schema2.Union(Schema2.Struct({
504
- // How database wants to order them (in practice - by id).
505
- kind: Schema2.Literal("natural")
506
- }), Schema2.Struct({
507
- kind: Schema2.Literal("property"),
508
- property: Schema2.String,
509
- direction: OrderDirection
510
- }));
511
- var Order = Order_;
512
- var QueryOrderClause_ = Schema2.Struct({
513
- type: Schema2.Literal("order"),
514
- query: Schema2.suspend(() => Query),
515
- order: Schema2.Array(Order)
516
- });
517
- var QueryOrderClause = QueryOrderClause_;
518
- var QueryOptionsClause_ = Schema2.Struct({
519
- type: Schema2.Literal("options"),
520
- query: Schema2.suspend(() => Query),
521
- options: Schema2.suspend(() => QueryOptions)
522
- });
523
- var QueryOptionsClause = QueryOptionsClause_;
524
- var Query_ = Schema2.Union(QuerySelectClause, QueryFilterClause, QueryReferenceTraversalClause, QueryIncomingReferencesClause, QueryRelationClause, QueryRelationTraversalClause, QueryUnionClause, QuerySetDifferenceClause, QueryOrderClause, QueryOptionsClause).annotations({
525
- identifier: "dxos.org/schema/Query"
526
- });
527
- var Query = Query_;
528
- var QueryOptions = Schema2.Struct({
529
- /**
530
- * The nested select statemets will select from the given spaces.
531
- *
532
- * NOTE: Spaces and queues are unioned together if both are specified.
533
- */
534
- spaceIds: Schema2.optional(Schema2.Array(Schema2.String)),
535
- /**
536
- * The nested select statemets will select from the given queues.
537
- *
538
- * NOTE: Spaces and queues are unioned together if both are specified.
539
- */
540
- queues: Schema2.optional(Schema2.Array(DXN2.Schema)),
541
- /**
542
- * Nested select statements will use this option to filter deleted objects.
543
- */
544
- deleted: Schema2.optional(Schema2.Literal("include", "exclude", "only"))
545
- });
546
- var visit = (query, visitor) => {
547
- visitor(query);
548
- Match.value(query).pipe(Match.when({
549
- type: "filter"
550
- }, ({ selection }) => visit(selection, visitor)), Match.when({
551
- type: "reference-traversal"
552
- }, ({ anchor }) => visit(anchor, visitor)), Match.when({
553
- type: "incoming-references"
554
- }, ({ anchor }) => visit(anchor, visitor)), Match.when({
555
- type: "relation"
556
- }, ({ anchor }) => visit(anchor, visitor)), Match.when({
557
- type: "options"
558
- }, ({ query: query2 }) => visit(query2, visitor)), Match.when({
559
- type: "relation-traversal"
560
- }, ({ anchor }) => visit(anchor, visitor)), Match.when({
561
- type: "union"
562
- }, ({ queries }) => queries.forEach((q) => visit(q, visitor))), Match.when({
563
- type: "set-difference"
564
- }, ({ source, exclude }) => {
565
- visit(source, visitor);
566
- visit(exclude, visitor);
567
- }), Match.when({
568
- type: "order"
569
- }, ({ query: query2 }) => visit(query2, visitor)), Match.when({
570
- type: "select"
571
- }, () => {
572
- }), Match.exhaustive);
573
- };
574
- var fold = (query, reducer) => {
575
- return Match.value(query).pipe(Match.withReturnType(), Match.when({
576
- type: "filter"
577
- }, ({ selection }) => fold(selection, reducer)), Match.when({
578
- type: "reference-traversal"
579
- }, ({ anchor }) => fold(anchor, reducer)), Match.when({
580
- type: "incoming-references"
581
- }, ({ anchor }) => fold(anchor, reducer)), Match.when({
582
- type: "relation"
583
- }, ({ anchor }) => fold(anchor, reducer)), Match.when({
584
- type: "options"
585
- }, ({ query: query2 }) => fold(query2, reducer)), Match.when({
586
- type: "relation-traversal"
587
- }, ({ anchor }) => fold(anchor, reducer)), Match.when({
588
- type: "union"
589
- }, ({ queries }) => queries.flatMap((q) => fold(q, reducer))), Match.when({
590
- type: "set-difference"
591
- }, ({ source, exclude }) => fold(source, reducer).concat(fold(exclude, reducer))), Match.when({
592
- type: "order"
593
- }, ({ query: query2 }) => fold(query2, reducer)), Match.when({
594
- type: "select"
595
- }, () => []), Match.exhaustive);
596
- };
597
- export {
598
- DATA_NAMESPACE,
599
- DatabaseDirectory,
600
- EncodedReference,
601
- ForeignKey,
602
- ObjectStructure,
603
- PROPERTY_ID,
604
- ast_exports as QueryAST,
605
- REFERENCE_TYPE_TAG,
606
- Reference,
607
- SpaceDocVersion,
608
- createIdFromSpaceKey,
609
- decodeReference,
610
- encodeReference,
611
- isEncodedReference
612
- };
613
- //# sourceMappingURL=index.mjs.map