@dxos/echo-query 0.8.4-main.72ec0f3 → 0.8.4-main.74a063c4e0
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 +159 -3
- package/dist/lib/{node-esm → neutral}/index.mjs.map +4 -4
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/query-lite/index.d.ts +9932 -0
- package/dist/query-lite/index.d.ts.map +1 -0
- package/dist/query-lite/index.js +506 -375
- package/dist/query-lite/index.js.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-lite/query-lite.d.ts +4 -4
- package/dist/types/src/query-lite/query-lite.d.ts.map +1 -1
- package/dist/types/src/sandbox/index.d.ts +2 -0
- package/dist/types/src/sandbox/index.d.ts.map +1 -0
- package/dist/types/src/sandbox/query-sandbox.d.ts +1 -1
- package/dist/types/src/sandbox/quickjs.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -16
- package/src/index.ts +1 -0
- package/src/parser/query.test.ts +29 -29
- package/src/query-lite/query-lite.ts +302 -70
- package/src/sandbox/index.ts +5 -0
- package/src/sandbox/query-sandbox.test.ts +10 -10
- package/src/sandbox/query-sandbox.ts +1 -1
- package/src/sandbox/quickjs.ts +1 -2
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/node-esm/index.mjs +0 -563
- package/dist/lib/node-esm/meta.json +0 -1
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/echo-query",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.74a063c4e0",
|
|
4
4
|
"description": "ECHO queries.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "info@dxos.org",
|
|
9
13
|
"sideEffects": false,
|
|
@@ -15,9 +19,9 @@
|
|
|
15
19
|
".": {
|
|
16
20
|
"source": "./src/index.ts",
|
|
17
21
|
"types": "./dist/types/src/index.d.ts",
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
"default": "./dist/lib/neutral/index.mjs"
|
|
23
|
+
},
|
|
24
|
+
"./api.d.ts": "./dist/query-lite/index.d.ts"
|
|
21
25
|
},
|
|
22
26
|
"types": "dist/types/src/index.d.ts",
|
|
23
27
|
"typesVersions": {
|
|
@@ -31,21 +35,22 @@
|
|
|
31
35
|
"@lezer/common": "^1.2.2",
|
|
32
36
|
"@lezer/lezer": "^1.1.2",
|
|
33
37
|
"@lezer/lr": "^1.4.2",
|
|
34
|
-
"@
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/vendor-quickjs": "0.8.4-main.72ec0f3"
|
|
38
|
+
"@dxos/context": "0.8.4-main.74a063c4e0",
|
|
39
|
+
"@dxos/echo-protocol": "0.8.4-main.74a063c4e0",
|
|
40
|
+
"@dxos/echo": "0.8.4-main.74a063c4e0",
|
|
41
|
+
"@dxos/errors": "0.8.4-main.74a063c4e0",
|
|
42
|
+
"@dxos/invariant": "0.8.4-main.74a063c4e0",
|
|
43
|
+
"@dxos/node-std": "0.8.4-main.74a063c4e0",
|
|
44
|
+
"@dxos/util": "0.8.4-main.74a063c4e0",
|
|
45
|
+
"@dxos/vendor-quickjs": "0.8.4-main.74a063c4e0",
|
|
46
|
+
"@dxos/debug": "0.8.4-main.74a063c4e0"
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
46
49
|
"@lezer/generator": "^1.7.1",
|
|
47
|
-
"
|
|
48
|
-
"
|
|
50
|
+
"tsdown": "^0.16.7",
|
|
51
|
+
"typescript": "^5.9.3",
|
|
52
|
+
"@dxos/echo-generator": "0.8.4-main.74a063c4e0",
|
|
53
|
+
"@dxos/random": "0.8.4-main.74a063c4e0"
|
|
49
54
|
},
|
|
50
55
|
"publishConfig": {
|
|
51
56
|
"access": "public"
|
package/src/index.ts
CHANGED
package/src/parser/query.test.ts
CHANGED
|
@@ -51,10 +51,10 @@ describe('query', () => {
|
|
|
51
51
|
},
|
|
52
52
|
// Type
|
|
53
53
|
{
|
|
54
|
-
input: 'type:dxos.
|
|
54
|
+
input: 'type:org.dxos.type.person',
|
|
55
55
|
expected: [
|
|
56
56
|
'Query',
|
|
57
|
-
// type:dxos.
|
|
57
|
+
// type:org.dxos.type.person
|
|
58
58
|
'Filter',
|
|
59
59
|
'TypeFilter',
|
|
60
60
|
'TypeKeyword',
|
|
@@ -111,10 +111,10 @@ describe('query', () => {
|
|
|
111
111
|
],
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
|
-
input: 'type:dxos.
|
|
114
|
+
input: 'type:org.dxos.type.person OR type:org.dxos.type.organization',
|
|
115
115
|
expected: [
|
|
116
116
|
'Query',
|
|
117
|
-
// type:dxos.
|
|
117
|
+
// type:org.dxos.type.person
|
|
118
118
|
'Filter',
|
|
119
119
|
'TypeFilter',
|
|
120
120
|
'TypeKeyword',
|
|
@@ -122,7 +122,7 @@ describe('query', () => {
|
|
|
122
122
|
'Identifier',
|
|
123
123
|
// OR
|
|
124
124
|
'Or',
|
|
125
|
-
// type:dxos.
|
|
125
|
+
// type:org.dxos.type.organization
|
|
126
126
|
'Filter',
|
|
127
127
|
'TypeFilter',
|
|
128
128
|
'TypeKeyword',
|
|
@@ -131,11 +131,11 @@ describe('query', () => {
|
|
|
131
131
|
],
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
|
-
input: '(type:dxos.
|
|
134
|
+
input: '(type:org.dxos.type.person OR type:org.dxos.type.organization) AND { name: "DXOS" }',
|
|
135
135
|
expected: [
|
|
136
136
|
'Query',
|
|
137
137
|
'(',
|
|
138
|
-
// type:dxos.
|
|
138
|
+
// type:org.dxos.type.person
|
|
139
139
|
'Filter',
|
|
140
140
|
'TypeFilter',
|
|
141
141
|
'TypeKeyword',
|
|
@@ -143,7 +143,7 @@ describe('query', () => {
|
|
|
143
143
|
'Identifier',
|
|
144
144
|
// OR
|
|
145
145
|
'Or',
|
|
146
|
-
// type:dxos.
|
|
146
|
+
// type:org.dxos.type.organization
|
|
147
147
|
'Filter',
|
|
148
148
|
'TypeFilter',
|
|
149
149
|
'TypeKeyword',
|
|
@@ -164,10 +164,10 @@ describe('query', () => {
|
|
|
164
164
|
],
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
|
-
input: 'type:dxos.
|
|
167
|
+
input: 'type:org.dxos.type.person -> type:org.dxos.type.organization',
|
|
168
168
|
expected: [
|
|
169
169
|
'Query',
|
|
170
|
-
// type:dxos.
|
|
170
|
+
// type:org.dxos.type.person
|
|
171
171
|
'Filter',
|
|
172
172
|
'TypeFilter',
|
|
173
173
|
'TypeKeyword',
|
|
@@ -175,7 +175,7 @@ describe('query', () => {
|
|
|
175
175
|
'Identifier',
|
|
176
176
|
'Relation',
|
|
177
177
|
'ArrowRight',
|
|
178
|
-
// type:dxos.
|
|
178
|
+
// type:org.dxos.type.organization
|
|
179
179
|
'Filter',
|
|
180
180
|
'TypeFilter',
|
|
181
181
|
'TypeKeyword',
|
|
@@ -184,10 +184,10 @@ describe('query', () => {
|
|
|
184
184
|
],
|
|
185
185
|
},
|
|
186
186
|
{
|
|
187
|
-
input: 'type:dxos.
|
|
187
|
+
input: 'type:org.dxos.type.organization <- type:org.dxos.type.person',
|
|
188
188
|
expected: [
|
|
189
189
|
'Query',
|
|
190
|
-
// type:dxos.
|
|
190
|
+
// type:org.dxos.type.organization
|
|
191
191
|
'Filter',
|
|
192
192
|
'TypeFilter',
|
|
193
193
|
'TypeKeyword',
|
|
@@ -195,7 +195,7 @@ describe('query', () => {
|
|
|
195
195
|
'Identifier',
|
|
196
196
|
'Relation',
|
|
197
197
|
'ArrowLeft',
|
|
198
|
-
// type:dxos.
|
|
198
|
+
// type:org.dxos.type.person
|
|
199
199
|
'Filter',
|
|
200
200
|
'TypeFilter',
|
|
201
201
|
'TypeKeyword',
|
|
@@ -206,7 +206,7 @@ describe('query', () => {
|
|
|
206
206
|
{
|
|
207
207
|
// Persons for Organizations with name "DXOS"
|
|
208
208
|
// TODO(burdon): Filter relations.
|
|
209
|
-
input: '((type:dxos.
|
|
209
|
+
input: '((type:org.dxos.type.organization AND { name: "DXOS" }) -> type:org.dxos.type.person)',
|
|
210
210
|
expected: [
|
|
211
211
|
'Query',
|
|
212
212
|
'(',
|
|
@@ -238,7 +238,7 @@ describe('query', () => {
|
|
|
238
238
|
],
|
|
239
239
|
},
|
|
240
240
|
{
|
|
241
|
-
input: 'type:dxos.
|
|
241
|
+
input: 'type:org.dxos.type.person and { name: "DXOS" }',
|
|
242
242
|
expected: [
|
|
243
243
|
'Query',
|
|
244
244
|
'Filter',
|
|
@@ -259,7 +259,7 @@ describe('query', () => {
|
|
|
259
259
|
],
|
|
260
260
|
},
|
|
261
261
|
{
|
|
262
|
-
input: 'x = ( type: dxos.
|
|
262
|
+
input: 'x = ( type: org.dxos.type.person )',
|
|
263
263
|
expected: [
|
|
264
264
|
'Query',
|
|
265
265
|
'Assignment',
|
|
@@ -305,9 +305,9 @@ describe('query', () => {
|
|
|
305
305
|
const tests: Test[] = [
|
|
306
306
|
// Types
|
|
307
307
|
{
|
|
308
|
-
input: 'type:dxos.
|
|
308
|
+
input: 'type:org.dxos.type.person',
|
|
309
309
|
expected: {
|
|
310
|
-
filter: Filter.typename('dxos.
|
|
310
|
+
filter: Filter.typename('org.dxos.type.person'),
|
|
311
311
|
},
|
|
312
312
|
},
|
|
313
313
|
// Tags
|
|
@@ -357,32 +357,32 @@ describe('query', () => {
|
|
|
357
357
|
},
|
|
358
358
|
},
|
|
359
359
|
{
|
|
360
|
-
input: 'type:dxos.
|
|
360
|
+
input: 'type:org.dxos.type.person OR type:org.dxos.type.organization',
|
|
361
361
|
expected: {
|
|
362
|
-
filter: Filter.or(Filter.typename('dxos.
|
|
362
|
+
filter: Filter.or(Filter.typename('org.dxos.type.person'), Filter.typename('org.dxos.type.organization')),
|
|
363
363
|
},
|
|
364
364
|
},
|
|
365
365
|
{
|
|
366
|
-
input: '(type:dxos.
|
|
366
|
+
input: '(type:org.dxos.type.person OR type:org.dxos.type.organization) AND { name: "DXOS" }',
|
|
367
367
|
expected: {
|
|
368
368
|
filter: Filter.and(
|
|
369
|
-
Filter.or(Filter.typename('dxos.
|
|
369
|
+
Filter.or(Filter.typename('org.dxos.type.person'), Filter.typename('org.dxos.type.organization')),
|
|
370
370
|
Filter.props({ name: 'DXOS' }),
|
|
371
371
|
),
|
|
372
372
|
},
|
|
373
373
|
},
|
|
374
374
|
{
|
|
375
|
-
input: 'type:dxos.
|
|
375
|
+
input: 'type:org.dxos.type.person and { name: "DXOS" }',
|
|
376
376
|
expected: {
|
|
377
|
-
filter: Filter.and(Filter.typename('dxos.
|
|
377
|
+
filter: Filter.and(Filter.typename('org.dxos.type.person'), Filter.props({ name: 'DXOS' })),
|
|
378
378
|
},
|
|
379
379
|
},
|
|
380
380
|
// Assignment
|
|
381
381
|
{
|
|
382
|
-
input: 'x = ( type:dxos.
|
|
382
|
+
input: 'x = ( type:org.dxos.type.person )',
|
|
383
383
|
expected: {
|
|
384
384
|
name: 'x',
|
|
385
|
-
filter: Filter.typename('dxos.
|
|
385
|
+
filter: Filter.typename('org.dxos.type.person'),
|
|
386
386
|
},
|
|
387
387
|
},
|
|
388
388
|
{
|
|
@@ -401,9 +401,9 @@ describe('query', () => {
|
|
|
401
401
|
//
|
|
402
402
|
// {
|
|
403
403
|
// input: '',
|
|
404
|
-
// expected: Query.select(Filter.typename('dxos.
|
|
404
|
+
// expected: Query.select(Filter.typename('org.dxos.type.person', { jobTitle: 'investor' }))
|
|
405
405
|
// .reference('organization')
|
|
406
|
-
// .targetOf(Relation.of('dxos.
|
|
406
|
+
// .targetOf(Relation.of('org.dxos.relation.hasSubject')) // TODO(burdon): Invert?
|
|
407
407
|
// .source(),
|
|
408
408
|
// },
|
|
409
409
|
];
|