@dxos/echo-protocol 0.8.4-main.7ace549 → 0.8.4-main.937b3ca

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/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "@dxos/echo-protocol",
3
- "version": "0.8.4-main.7ace549",
3
+ "version": "0.8.4-main.937b3ca",
4
4
  "description": "Core ECHO APIs.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
- "repository": "github:dxos/dxos",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
8
11
  "license": "MIT",
9
12
  "author": "DXOS.org",
10
- "sideEffects": true,
13
+ "sideEffects": false,
11
14
  "type": "module",
12
15
  "exports": {
13
16
  ".": {
@@ -26,12 +29,12 @@
26
29
  "src"
27
30
  ],
28
31
  "dependencies": {
29
- "effect": "3.18.3",
30
- "@dxos/crypto": "0.8.4-main.7ace549",
31
- "@dxos/invariant": "0.8.4-main.7ace549",
32
- "@dxos/keys": "0.8.4-main.7ace549",
33
- "@dxos/protocols": "0.8.4-main.7ace549",
34
- "@dxos/util": "0.8.4-main.7ace549"
32
+ "effect": "3.19.11",
33
+ "@dxos/crypto": "0.8.4-main.937b3ca",
34
+ "@dxos/invariant": "0.8.4-main.937b3ca",
35
+ "@dxos/util": "0.8.4-main.937b3ca",
36
+ "@dxos/keys": "0.8.4-main.937b3ca",
37
+ "@dxos/protocols": "0.8.4-main.937b3ca"
35
38
  },
36
39
  "publishConfig": {
37
40
  "access": "public"
package/src/query/ast.ts CHANGED
@@ -212,7 +212,11 @@ export const QueryReferenceTraversalClause: Schema.Schema<QueryReferenceTraversa
212
212
  const QueryIncomingReferencesClause_ = Schema.Struct({
213
213
  type: Schema.Literal('incoming-references'),
214
214
  anchor: Schema.suspend(() => Query),
215
- property: Schema.String,
215
+ /**
216
+ * Property path where the reference is located.
217
+ * If null, matches references from any property.
218
+ */
219
+ property: Schema.NullOr(Schema.String),
216
220
  typename: TypenameSpecifier,
217
221
  });
218
222
 
@@ -286,6 +290,12 @@ const Order_ = Schema.Union(
286
290
  property: Schema.String,
287
291
  direction: OrderDirection,
288
292
  }),
293
+ Schema.Struct({
294
+ // Order by relevance rank (for FTS/vector search results).
295
+ // Default direction is 'desc' (higher rank = better match first).
296
+ kind: Schema.Literal('rank'),
297
+ direction: OrderDirection,
298
+ }),
289
299
  );
290
300
 
291
301
  export type Order = Schema.Schema.Type<typeof Order_>;
@@ -316,6 +326,18 @@ const QueryOptionsClause_ = Schema.Struct({
316
326
  export interface QueryOptionsClause extends Schema.Schema.Type<typeof QueryOptionsClause_> {}
317
327
  export const QueryOptionsClause: Schema.Schema<QueryOptionsClause> = QueryOptionsClause_;
318
328
 
329
+ /**
330
+ * Limit the number of results.
331
+ */
332
+ const QueryLimitClause_ = Schema.Struct({
333
+ type: Schema.Literal('limit'),
334
+ query: Schema.suspend(() => Query),
335
+ limit: Schema.Number,
336
+ });
337
+
338
+ export interface QueryLimitClause extends Schema.Schema.Type<typeof QueryLimitClause_> {}
339
+ export const QueryLimitClause: Schema.Schema<QueryLimitClause> = QueryLimitClause_;
340
+
319
341
  const Query_ = Schema.Union(
320
342
  QuerySelectClause,
321
343
  QueryFilterClause,
@@ -327,6 +349,7 @@ const Query_ = Schema.Union(
327
349
  QuerySetDifferenceClause,
328
350
  QueryOrderClause,
329
351
  QueryOptionsClause,
352
+ QueryLimitClause,
330
353
  ).annotations({ identifier: 'dxos.org/schema/Query' });
331
354
 
332
355
  export type Query = Schema.Schema.Type<typeof Query_>;
@@ -340,6 +363,11 @@ export const QueryOptions = Schema.Struct({
340
363
  */
341
364
  spaceIds: Schema.optional(Schema.Array(Schema.String)),
342
365
 
366
+ /**
367
+ * If true, the nested select statements will select from all queues in the spaces specified by `spaceIds`.
368
+ */
369
+ allQueuesFromSpaces: Schema.optional(Schema.Boolean),
370
+
343
371
  /**
344
372
  * The nested select statemets will select from the given queues.
345
373
  *
@@ -371,6 +399,7 @@ export const visit = (query: Query, visitor: (node: Query) => void) => {
371
399
  visit(exclude, visitor);
372
400
  }),
373
401
  Match.when({ type: 'order' }, ({ query }) => visit(query, visitor)),
402
+ Match.when({ type: 'limit' }, ({ query }) => visit(query, visitor)),
374
403
  Match.when({ type: 'select' }, () => {}),
375
404
  Match.exhaustive,
376
405
  );
@@ -390,6 +419,7 @@ export const fold = <T>(query: Query, reducer: (node: Query) => T): T[] => {
390
419
  fold(source, reducer).concat(fold(exclude, reducer)),
391
420
  ),
392
421
  Match.when({ type: 'order' }, ({ query }) => fold(query, reducer)),
422
+ Match.when({ type: 'limit' }, ({ query }) => fold(query, reducer)),
393
423
  Match.when({ type: 'select' }, () => []),
394
424
  Match.exhaustive,
395
425
  );
package/src/reference.ts CHANGED
@@ -177,6 +177,9 @@ export const EncodedReference = Object.freeze({
177
177
  return DXN.parse(EncodedReference.getReferenceString(value));
178
178
  },
179
179
  fromDXN: (dxn: DXN): EncodedReference => {
180
- return encodeReference(Reference.fromDXN(dxn));
180
+ return { '/': dxn.toString() };
181
+ },
182
+ fromLegacyTypename: (typename: string): EncodedReference => {
183
+ return { '/': DXN.fromTypename(typename).toString() };
181
184
  },
182
185
  });