@dxos/echo-query 0.8.4-main.422d1c7879 → 0.8.4-main.4f23b4e393

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/echo-query",
3
- "version": "0.8.4-main.422d1c7879",
3
+ "version": "0.8.4-main.4f23b4e393",
4
4
  "description": "ECHO queries.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -32,22 +32,22 @@
32
32
  "@lezer/common": "^1.2.2",
33
33
  "@lezer/lezer": "^1.1.2",
34
34
  "@lezer/lr": "^1.4.2",
35
- "@dxos/context": "0.8.4-main.422d1c7879",
36
- "@dxos/debug": "0.8.4-main.422d1c7879",
37
- "@dxos/echo": "0.8.4-main.422d1c7879",
38
- "@dxos/errors": "0.8.4-main.422d1c7879",
39
- "@dxos/echo-protocol": "0.8.4-main.422d1c7879",
40
- "@dxos/invariant": "0.8.4-main.422d1c7879",
41
- "@dxos/node-std": "0.8.4-main.422d1c7879",
42
- "@dxos/vendor-quickjs": "0.8.4-main.422d1c7879",
43
- "@dxos/util": "0.8.4-main.422d1c7879"
35
+ "@dxos/context": "0.8.4-main.4f23b4e393",
36
+ "@dxos/echo-protocol": "0.8.4-main.4f23b4e393",
37
+ "@dxos/echo": "0.8.4-main.4f23b4e393",
38
+ "@dxos/errors": "0.8.4-main.4f23b4e393",
39
+ "@dxos/debug": "0.8.4-main.4f23b4e393",
40
+ "@dxos/invariant": "0.8.4-main.4f23b4e393",
41
+ "@dxos/node-std": "0.8.4-main.4f23b4e393",
42
+ "@dxos/util": "0.8.4-main.4f23b4e393",
43
+ "@dxos/vendor-quickjs": "0.8.4-main.4f23b4e393"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@lezer/generator": "^1.7.1",
47
47
  "tsdown": "^0.16.7",
48
48
  "typescript": "^6.0.3",
49
- "@dxos/echo-generator": "0.8.4-main.422d1c7879",
50
- "@dxos/random": "0.8.4-main.422d1c7879"
49
+ "@dxos/echo-generator": "0.8.4-main.4f23b4e393",
50
+ "@dxos/random": "0.8.4-main.4f23b4e393"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public"
@@ -246,8 +246,9 @@ export class QueryBuilder {
246
246
  let exprEnd = cursor.to;
247
247
 
248
248
  while (cursor.nextSibling() && depth > 0) {
249
- if (cursor.node.name === '(') depth++;
250
- else if (cursor.node.name === ')') {
249
+ if (cursor.node.name === '(') {
250
+ depth++;
251
+ } else if (cursor.node.name === ')') {
251
252
  depth--;
252
253
  if (depth === 0) {
253
254
  exprEnd = cursor.from;
@@ -681,12 +682,24 @@ export const normalizeInput = (input: string): string => {
681
682
  let scanIndex = pos;
682
683
  while (scanIndex < input.length) {
683
684
  const innerChar = input[scanIndex];
684
- if (innerChar === '"') break;
685
- if (innerChar === "'" && scanIndex > pos && !/[a-zA-Z0-9_]/.test(input[scanIndex - 1])) break;
686
- if (innerChar === "'" && scanIndex === pos) break;
687
- if (innerChar !== "'" && SPECIAL_CHARS.test(innerChar)) break;
688
- if (innerChar === '-' && input[scanIndex + 1] === '>') break;
689
- if (innerChar === '<' && input[scanIndex + 1] === '-') break;
685
+ if (innerChar === '"') {
686
+ break;
687
+ }
688
+ if (innerChar === "'" && scanIndex > pos && !/[a-zA-Z0-9_]/.test(input[scanIndex - 1])) {
689
+ break;
690
+ }
691
+ if (innerChar === "'" && scanIndex === pos) {
692
+ break;
693
+ }
694
+ if (innerChar !== "'" && SPECIAL_CHARS.test(innerChar)) {
695
+ break;
696
+ }
697
+ if (innerChar === '-' && input[scanIndex + 1] === '>') {
698
+ break;
699
+ }
700
+ if (innerChar === '<' && input[scanIndex + 1] === '-') {
701
+ break;
702
+ }
690
703
  scanIndex++;
691
704
  }
692
705
  // Defensive: if no characters were consumed, advance one to avoid infinite loops.
@@ -111,7 +111,7 @@ class FilterClass implements Filter$.Any {
111
111
  }
112
112
  return new FilterClass({
113
113
  type: 'object',
114
- typename: makeTypeDxn(schema),
114
+ typename: makeTypeDXN(schema),
115
115
  ...propsFilterToAst(props ?? {}),
116
116
  });
117
117
  }
@@ -119,7 +119,7 @@ class FilterClass implements Filter$.Any {
119
119
  static typename(typename: string): Filter$.Any {
120
120
  return new FilterClass({
121
121
  type: 'object',
122
- typename: makeTypeDxn(typename),
122
+ typename: makeTypeDXN(typename),
123
123
  props: {},
124
124
  });
125
125
  }
@@ -451,7 +451,7 @@ class QueryClass implements Query$.Any {
451
451
  from: {
452
452
  _tag: 'scope',
453
453
  scope: {
454
- ...(options?.includeFeeds ? { allQueuesFromSpaces: true } : {}),
454
+ ...(options?.includeFeeds ? { allFeedsFromSpaces: true } : {}),
455
455
  },
456
456
  },
457
457
  });
@@ -573,6 +573,21 @@ class QueryClass implements Query$.Any {
573
573
  options,
574
574
  });
575
575
  }
576
+
577
+ debugLabel(label: string): Query$.Any {
578
+ if (this.ast.type === 'options') {
579
+ return new QueryClass({
580
+ type: 'options',
581
+ query: this.ast.query,
582
+ options: { ...this.ast.options, debugLabel: label },
583
+ });
584
+ }
585
+ return new QueryClass({
586
+ type: 'options',
587
+ query: this.ast,
588
+ options: { debugLabel: label },
589
+ });
590
+ }
576
591
  }
577
592
 
578
593
  export const Query1: typeof Query$ = QueryClass;
@@ -583,7 +598,7 @@ const isRef = (obj: any): obj is Ref.Ref<any> => {
583
598
  return obj && typeof obj === 'object' && RefTypeId in obj;
584
599
  };
585
600
 
586
- const makeTypeDxn = (typename: string) => {
601
+ const makeTypeDXN = (typename: string) => {
587
602
  assertArgument(typeof typename === 'string', 'typename');
588
603
  assertArgument(!typename.startsWith('dxn:'), 'typename');
589
604
  return `dxn:type:${typename}`;
@@ -599,7 +614,7 @@ const isDxnLike = (value: unknown): value is DXN => {
599
614
  );
600
615
  };
601
616
 
602
- const SCOPE_KEYS = new Set(['spaceIds', 'queues', 'allQueuesFromSpaces']);
617
+ const SCOPE_KEYS = new Set(['spaceIds', 'feeds', 'allFeedsFromSpaces']);
603
618
 
604
619
  const _isScopeLike = (value: unknown): value is QueryAST.Scope => {
605
620
  if (typeof value !== 'object' || value === null || Array.isArray(value)) {
@@ -701,6 +716,9 @@ const prettyQuery = (query: QueryAST.Query): string => {
701
716
  if (query.options.deleted !== undefined) {
702
717
  parts.push(`deleted: ${JSON.stringify(query.options.deleted)}`);
703
718
  }
719
+ if (query.options.debugLabel !== undefined) {
720
+ parts.push(`debugLabel: ${JSON.stringify(query.options.debugLabel)}`);
721
+ }
704
722
  return `${prettyQuery(query.query)}.options({ ${parts.join(', ')} })`;
705
723
  }
706
724
  case 'from': {
@@ -710,11 +728,11 @@ const prettyQuery = (query: QueryAST.Query): string => {
710
728
  if (scope.spaceIds !== undefined) {
711
729
  parts.push(`spaceIds: [${scope.spaceIds.join(', ')}]`);
712
730
  }
713
- if (scope.queues !== undefined) {
714
- parts.push(`queues: [${scope.queues.join(', ')}]`);
731
+ if (scope.feeds !== undefined) {
732
+ parts.push(`feeds: [${scope.feeds.join(', ')}]`);
715
733
  }
716
- if (scope.allQueuesFromSpaces !== undefined) {
717
- parts.push(`allQueuesFromSpaces: ${scope.allQueuesFromSpaces}`);
734
+ if (scope.allFeedsFromSpaces !== undefined) {
735
+ parts.push(`allFeedsFromSpaces: ${scope.allFeedsFromSpaces}`);
718
736
  }
719
737
  return `${prettyQuery(query.query)}.from({ ${parts.join(', ')} })`;
720
738
  }