@dxos/echo-protocol 0.8.4-main.8360d9e660 → 0.8.4-main.8baae0fced
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/neutral/index.mjs +51 -27
- package/dist/lib/neutral/index.mjs.map +4 -4
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/types/src/document-structure.d.ts +11 -1
- package/dist/types/src/document-structure.d.ts.map +1 -1
- package/dist/types/src/echo-feed-codec.d.ts.map +1 -1
- package/dist/types/src/edge-peer.d.ts +11 -0
- package/dist/types/src/edge-peer.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/query/ast.d.ts +76 -34
- package/dist/types/src/query/ast.d.ts.map +1 -1
- package/dist/types/src/reference.d.ts.map +1 -1
- package/dist/types/src/space-id.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -11
- package/src/document-structure.ts +12 -0
- package/src/edge-peer.ts +27 -0
- package/src/index.ts +1 -0
- package/src/query/ast.ts +53 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/echo-protocol",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.8baae0fced",
|
|
4
4
|
"description": "Core ECHO APIs.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/dxos/dxos"
|
|
10
10
|
},
|
|
11
|
-
"license": "
|
|
11
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"type": "module",
|
|
@@ -20,20 +20,17 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"types": "dist/types/src/index.d.ts",
|
|
23
|
-
"typesVersions": {
|
|
24
|
-
"*": {}
|
|
25
|
-
},
|
|
26
23
|
"files": [
|
|
27
24
|
"dist",
|
|
28
25
|
"src"
|
|
29
26
|
],
|
|
30
27
|
"dependencies": {
|
|
31
|
-
"effect": "3.
|
|
32
|
-
"@dxos/crypto": "0.8.4-main.
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
28
|
+
"effect": "3.20.0",
|
|
29
|
+
"@dxos/crypto": "0.8.4-main.8baae0fced",
|
|
30
|
+
"@dxos/invariant": "0.8.4-main.8baae0fced",
|
|
31
|
+
"@dxos/keys": "0.8.4-main.8baae0fced",
|
|
32
|
+
"@dxos/util": "0.8.4-main.8baae0fced",
|
|
33
|
+
"@dxos/protocols": "0.8.4-main.8baae0fced"
|
|
37
34
|
},
|
|
38
35
|
"publishConfig": {
|
|
39
36
|
"access": "public"
|
|
@@ -230,6 +230,18 @@ export type ObjectMeta = {
|
|
|
230
230
|
* NOTE: Optional for backwards compatibilty.
|
|
231
231
|
*/
|
|
232
232
|
tags?: string[];
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Fully-qualified registry key for the object (FQN format, e.g. `org.example.type.foo`).
|
|
236
|
+
* Identifies the canonical registry entry the object instance was created from.
|
|
237
|
+
*/
|
|
238
|
+
key?: string;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Semantic version of the registry entry the object was created from.
|
|
242
|
+
* Must be a valid semver string (e.g. `1.2.3`).
|
|
243
|
+
*/
|
|
244
|
+
version?: string;
|
|
233
245
|
};
|
|
234
246
|
|
|
235
247
|
/**
|
package/src/edge-peer.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type SpaceId } from '@dxos/keys';
|
|
6
|
+
import { EdgeService } from '@dxos/protocols';
|
|
7
|
+
import { compositeKey } from '@dxos/util';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Returns true if the given peerId belongs to an EDGE replicator (Automerge or Subduction).
|
|
11
|
+
*
|
|
12
|
+
* When `spaceId` is provided, the match is scoped to that space (peerId must start with
|
|
13
|
+
* `<service>:<spaceId>`). When omitted, only the leading service segment is checked
|
|
14
|
+
* (peerId must start with `<service>:`), which is useful when the caller doesn't have a
|
|
15
|
+
* spaceId on hand or wants to match any edge replicator regardless of space.
|
|
16
|
+
*/
|
|
17
|
+
export const isEdgePeerId = (peerId: string, spaceId?: SpaceId): boolean => {
|
|
18
|
+
const automergePrefix =
|
|
19
|
+
spaceId !== undefined
|
|
20
|
+
? compositeKey(EdgeService.AUTOMERGE_REPLICATOR, spaceId)
|
|
21
|
+
: `${EdgeService.AUTOMERGE_REPLICATOR}:`;
|
|
22
|
+
const subductionPrefix =
|
|
23
|
+
spaceId !== undefined
|
|
24
|
+
? compositeKey(EdgeService.SUBDUCTION_REPLICATOR, spaceId)
|
|
25
|
+
: `${EdgeService.SUBDUCTION_REPLICATOR}:`;
|
|
26
|
+
return peerId.startsWith(automergePrefix) || peerId.startsWith(subductionPrefix);
|
|
27
|
+
};
|
package/src/index.ts
CHANGED
package/src/query/ast.ts
CHANGED
|
@@ -42,6 +42,17 @@ const FilterObject_ = Schema.Struct({
|
|
|
42
42
|
*/
|
|
43
43
|
foreignKeys: Schema.optional(Schema.Array(ForeignKey)),
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Match objects whose meta `key` equals this fully-qualified registry key (FQN format).
|
|
47
|
+
*/
|
|
48
|
+
metaKey: Schema.optional(Schema.String),
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Semver range matched against the object's meta `version`.
|
|
52
|
+
* Only consulted when {@link metaKey} is set. Objects with no `version` do not satisfy a version-constrained filter.
|
|
53
|
+
*/
|
|
54
|
+
metaVersion: Schema.optional(Schema.String),
|
|
55
|
+
|
|
45
56
|
// NOTE: Make sure to update `FilterStep.isNoop` if you change this.
|
|
46
57
|
});
|
|
47
58
|
export interface FilterObject extends Schema.Schema.Type<typeof FilterObject_> {}
|
|
@@ -107,6 +118,20 @@ const FilterRange_ = Schema.Struct({
|
|
|
107
118
|
export interface FilterRange extends Schema.Schema.Type<typeof FilterRange_> {}
|
|
108
119
|
export const FilterRange: Schema.Schema<FilterRange> = FilterRange_;
|
|
109
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Filter by system timestamp (createdAt / updatedAt).
|
|
123
|
+
* Timestamps are unix milliseconds stored in the object meta index.
|
|
124
|
+
*/
|
|
125
|
+
const FilterTimestamp_ = Schema.Struct({
|
|
126
|
+
type: Schema.Literal('timestamp'),
|
|
127
|
+
field: Schema.Literal('createdAt', 'updatedAt'),
|
|
128
|
+
operator: Schema.Literal('gt', 'gte', 'lt', 'lte'),
|
|
129
|
+
value: Schema.Number,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export interface FilterTimestamp extends Schema.Schema.Type<typeof FilterTimestamp_> {}
|
|
133
|
+
export const FilterTimestamp: Schema.Schema<FilterTimestamp> = FilterTimestamp_;
|
|
134
|
+
|
|
110
135
|
/**
|
|
111
136
|
* Text search.
|
|
112
137
|
*/
|
|
@@ -152,6 +177,21 @@ const FilterOr_ = Schema.Struct({
|
|
|
152
177
|
export interface FilterOr extends Schema.Schema.Type<typeof FilterOr_> {}
|
|
153
178
|
export const FilterOr: Schema.Schema<FilterOr> = FilterOr_;
|
|
154
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Filter objects that are children of the specified parents.
|
|
182
|
+
* With transitive=true (default), matches grandchildren and beyond.
|
|
183
|
+
*/
|
|
184
|
+
const FilterChildOf_ = Schema.Struct({
|
|
185
|
+
type: Schema.Literal('child-of'),
|
|
186
|
+
/** Parent DXNs to match children of. */
|
|
187
|
+
parents: Schema.Array(DXN.Schema),
|
|
188
|
+
/** Whether to match transitively (grandchildren, etc.). Defaults to true. */
|
|
189
|
+
transitive: Schema.Boolean,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
export interface FilterChildOf extends Schema.Schema.Type<typeof FilterChildOf_> {}
|
|
193
|
+
export const FilterChildOf: Schema.Schema<FilterChildOf> = FilterChildOf_;
|
|
194
|
+
|
|
155
195
|
/**
|
|
156
196
|
* Union of filters.
|
|
157
197
|
*/
|
|
@@ -162,7 +202,9 @@ export const Filter = Schema.Union(
|
|
|
162
202
|
FilterContains,
|
|
163
203
|
FilterTag,
|
|
164
204
|
FilterRange,
|
|
205
|
+
FilterTimestamp,
|
|
165
206
|
FilterTextSearch,
|
|
207
|
+
FilterChildOf,
|
|
166
208
|
FilterNot,
|
|
167
209
|
FilterAnd,
|
|
168
210
|
FilterOr,
|
|
@@ -394,6 +436,11 @@ export const QueryOptions = Schema.Struct({
|
|
|
394
436
|
* Nested select statements will use this option to filter deleted objects.
|
|
395
437
|
*/
|
|
396
438
|
deleted: Schema.optional(Schema.Literal('include', 'exclude', 'only')),
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Diagnostics-only label for logs / tooling (not used by execution semantics).
|
|
442
|
+
*/
|
|
443
|
+
debugLabel: Schema.optional(Schema.String),
|
|
397
444
|
});
|
|
398
445
|
|
|
399
446
|
export interface QueryOptions extends Schema.Schema.Type<typeof QueryOptions> {}
|
|
@@ -405,21 +452,21 @@ export const Scope = Schema.Struct({
|
|
|
405
452
|
/**
|
|
406
453
|
* The nested select statemets will select from the given spaces.
|
|
407
454
|
*
|
|
408
|
-
* NOTE: Spaces and
|
|
455
|
+
* NOTE: Spaces and feeds are unioned together if both are specified.
|
|
409
456
|
*/
|
|
410
457
|
spaceIds: Schema.optional(Schema.Array(Schema.String)),
|
|
411
458
|
|
|
412
459
|
/**
|
|
413
|
-
* If true, the nested select statements will select from all
|
|
460
|
+
* If true, the nested select statements will select from all feeds in the spaces specified by `spaceIds`.
|
|
414
461
|
*/
|
|
415
|
-
|
|
462
|
+
allFeedsFromSpaces: Schema.optional(Schema.Boolean),
|
|
416
463
|
|
|
417
464
|
/**
|
|
418
|
-
* The nested select statemets will select from the given
|
|
465
|
+
* The nested select statemets will select from the given feeds (by underlying queue DXN).
|
|
419
466
|
*
|
|
420
|
-
* NOTE: Spaces and
|
|
467
|
+
* NOTE: Spaces and feeds are unioned together if both are specified.
|
|
421
468
|
*/
|
|
422
|
-
|
|
469
|
+
feeds: Schema.optional(Schema.Array(DXN.Schema)),
|
|
423
470
|
});
|
|
424
471
|
export interface Scope extends Schema.Schema.Type<typeof Scope> {}
|
|
425
472
|
|