@dxos/echo-query 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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/index.mjs +159 -3
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +159 -3
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/query-lite/index.d.ts +8765 -0
- package/dist/query-lite/index.d.ts.map +1 -0
- package/dist/query-lite/index.js +356 -376
- 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/parser/query-builder.d.ts +1 -1
- package/dist/types/src/parser/query-builder.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/quickjs.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -14
- package/src/index.ts +1 -0
- package/src/parser/query-builder.ts +1 -1
- package/src/query-lite/query-lite.ts +79 -57
- package/src/sandbox/index.ts +5 -0
- package/src/sandbox/quickjs.ts +1 -2
package/dist/query-lite/index.js
CHANGED
|
@@ -1,387 +1,367 @@
|
|
|
1
|
-
|
|
1
|
+
//#region ../../../common/invariant/dist/lib/browser/index.mjs
|
|
2
2
|
var assertArgument = (condition, argumentName, message) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
if (!condition) {
|
|
4
|
+
const error = /* @__PURE__ */ new TypeError(`Invalid argument \`${argumentName}\`` + (message ? `: ${message}` : ""));
|
|
5
|
+
Error.captureStackTrace(error, assertArgument);
|
|
6
|
+
throw error;
|
|
7
|
+
}
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/query-lite/query-lite.ts
|
|
12
|
+
var OrderClass = class OrderClass {
|
|
13
|
+
static variance = {};
|
|
14
|
+
static is(value) {
|
|
15
|
+
return typeof value === "object" && value !== null && "~Order" in value;
|
|
16
|
+
}
|
|
17
|
+
constructor(ast) {
|
|
18
|
+
this.ast = ast;
|
|
19
|
+
}
|
|
20
|
+
"~Order" = OrderClass.variance;
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
-
((
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
let Order1;
|
|
23
|
+
(function(_Order) {
|
|
24
|
+
_Order.natural = new OrderClass({ kind: "natural" });
|
|
25
|
+
_Order.property = (property, direction) => new OrderClass({
|
|
26
|
+
kind: "property",
|
|
27
|
+
property,
|
|
28
|
+
direction
|
|
29
|
+
});
|
|
30
|
+
_Order.rank = (direction = "desc") => new OrderClass({
|
|
31
|
+
kind: "rank",
|
|
32
|
+
direction
|
|
33
|
+
});
|
|
29
34
|
})(Order1 || (Order1 = {}));
|
|
30
|
-
|
|
31
|
-
var FilterClass = class
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
return new _FilterClass({
|
|
209
|
-
type: "or",
|
|
210
|
-
filters: filters.map((f) => f.ast)
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
"~Filter" = _FilterClass.variance;
|
|
35
|
+
const Order2 = Order1;
|
|
36
|
+
var FilterClass = class FilterClass {
|
|
37
|
+
static variance = {};
|
|
38
|
+
static is(value) {
|
|
39
|
+
return typeof value === "object" && value !== null && "~Filter" in value;
|
|
40
|
+
}
|
|
41
|
+
static fromAst(ast) {
|
|
42
|
+
return new FilterClass(ast);
|
|
43
|
+
}
|
|
44
|
+
static everything() {
|
|
45
|
+
return new FilterClass({
|
|
46
|
+
type: "object",
|
|
47
|
+
typename: null,
|
|
48
|
+
props: {}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
static nothing() {
|
|
52
|
+
return new FilterClass({
|
|
53
|
+
type: "not",
|
|
54
|
+
filter: {
|
|
55
|
+
type: "object",
|
|
56
|
+
typename: null,
|
|
57
|
+
props: {}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
static relation() {
|
|
62
|
+
return new FilterClass({
|
|
63
|
+
type: "object",
|
|
64
|
+
typename: null,
|
|
65
|
+
props: {}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
static id(...ids) {
|
|
69
|
+
if (ids.length === 0) return FilterClass.nothing();
|
|
70
|
+
return new FilterClass({
|
|
71
|
+
type: "object",
|
|
72
|
+
typename: null,
|
|
73
|
+
id: ids,
|
|
74
|
+
props: {}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
static type(schema, props) {
|
|
78
|
+
if (typeof schema !== "string") throw new TypeError("expected typename as the first paramter");
|
|
79
|
+
return new FilterClass({
|
|
80
|
+
type: "object",
|
|
81
|
+
typename: makeTypeDxn(schema),
|
|
82
|
+
...propsFilterToAst(props ?? {})
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
static typename(typename) {
|
|
86
|
+
return new FilterClass({
|
|
87
|
+
type: "object",
|
|
88
|
+
typename: makeTypeDxn(typename),
|
|
89
|
+
props: {}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
static typeDXN(dxn) {
|
|
93
|
+
return new FilterClass({
|
|
94
|
+
type: "object",
|
|
95
|
+
typename: dxn.toString(),
|
|
96
|
+
props: {}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
static tag(tag) {
|
|
100
|
+
return new FilterClass({
|
|
101
|
+
type: "tag",
|
|
102
|
+
tag
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
static props(props) {
|
|
106
|
+
return new FilterClass({
|
|
107
|
+
type: "object",
|
|
108
|
+
typename: null,
|
|
109
|
+
...propsFilterToAst(props)
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
static text(text, options) {
|
|
113
|
+
return new FilterClass({
|
|
114
|
+
type: "text-search",
|
|
115
|
+
text,
|
|
116
|
+
searchKind: options?.type
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
static foreignKeys(schema, keys) {
|
|
120
|
+
assertArgument(typeof schema === "string", "schema");
|
|
121
|
+
assertArgument(!schema.startsWith("dxn:"), "schema");
|
|
122
|
+
return new FilterClass({
|
|
123
|
+
type: "object",
|
|
124
|
+
typename: `dxn:type:${schema}`,
|
|
125
|
+
props: {},
|
|
126
|
+
foreignKeys: keys
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
static eq(value) {
|
|
130
|
+
if (!isRef(value) && typeof value === "object" && value !== null) throw new TypeError("Cannot use object as a value for eq filter");
|
|
131
|
+
return new FilterClass({
|
|
132
|
+
type: "compare",
|
|
133
|
+
operator: "eq",
|
|
134
|
+
value: isRef(value) ? value.noInline().encode() : value
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
static neq(value) {
|
|
138
|
+
return new FilterClass({
|
|
139
|
+
type: "compare",
|
|
140
|
+
operator: "neq",
|
|
141
|
+
value
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
static gt(value) {
|
|
145
|
+
return new FilterClass({
|
|
146
|
+
type: "compare",
|
|
147
|
+
operator: "gt",
|
|
148
|
+
value
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
static gte(value) {
|
|
152
|
+
return new FilterClass({
|
|
153
|
+
type: "compare",
|
|
154
|
+
operator: "gte",
|
|
155
|
+
value
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
static lt(value) {
|
|
159
|
+
return new FilterClass({
|
|
160
|
+
type: "compare",
|
|
161
|
+
operator: "lt",
|
|
162
|
+
value
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
static lte(value) {
|
|
166
|
+
return new FilterClass({
|
|
167
|
+
type: "compare",
|
|
168
|
+
operator: "lte",
|
|
169
|
+
value
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
static in(...values) {
|
|
173
|
+
return new FilterClass({
|
|
174
|
+
type: "in",
|
|
175
|
+
values
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
static contains(value) {
|
|
179
|
+
return new FilterClass({
|
|
180
|
+
type: "contains",
|
|
181
|
+
value
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
static between(from, to) {
|
|
185
|
+
return new FilterClass({
|
|
186
|
+
type: "range",
|
|
187
|
+
from,
|
|
188
|
+
to
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
static not(filter) {
|
|
192
|
+
return new FilterClass({
|
|
193
|
+
type: "not",
|
|
194
|
+
filter: filter.ast
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
static and(...filters) {
|
|
198
|
+
return new FilterClass({
|
|
199
|
+
type: "and",
|
|
200
|
+
filters: filters.map((f) => f.ast)
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
static or(...filters) {
|
|
204
|
+
return new FilterClass({
|
|
205
|
+
type: "or",
|
|
206
|
+
filters: filters.map((f) => f.ast)
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
constructor(ast) {
|
|
210
|
+
this.ast = ast;
|
|
211
|
+
}
|
|
212
|
+
"~Filter" = FilterClass.variance;
|
|
214
213
|
};
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return {
|
|
227
|
-
id: idFilter,
|
|
228
|
-
props: Object.fromEntries(
|
|
229
|
-
Object.entries(predicates).filter(([prop, _value]) => prop !== "id").map(([prop, predicate]) => [prop, processPredicate(predicate)])
|
|
230
|
-
)
|
|
231
|
-
};
|
|
214
|
+
const Filter1 = FilterClass;
|
|
215
|
+
const propsFilterToAst = (predicates) => {
|
|
216
|
+
let idFilter;
|
|
217
|
+
if ("id" in predicates) {
|
|
218
|
+
assertArgument(typeof predicates.id === "string" || Array.isArray(predicates.id), "predicates.id", "invalid id filter");
|
|
219
|
+
idFilter = typeof predicates.id === "string" ? [predicates.id] : predicates.id;
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
id: idFilter,
|
|
223
|
+
props: Object.fromEntries(Object.entries(predicates).filter(([prop, _value]) => prop !== "id").map(([prop, predicate]) => [prop, processPredicate(predicate)]))
|
|
224
|
+
};
|
|
232
225
|
};
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
Object.entries(predicate).map(([key, value]) => [key, processPredicate(value)])
|
|
243
|
-
);
|
|
244
|
-
return {
|
|
245
|
-
type: "object",
|
|
246
|
-
typename: null,
|
|
247
|
-
props: nestedProps
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
return FilterClass.eq(predicate).ast;
|
|
226
|
+
const processPredicate = (predicate) => {
|
|
227
|
+
if (FilterClass.is(predicate)) return predicate.ast;
|
|
228
|
+
if (Array.isArray(predicate)) throw new Error("Array predicates are not yet supported.");
|
|
229
|
+
if (!isRef(predicate) && typeof predicate === "object" && predicate !== null) return {
|
|
230
|
+
type: "object",
|
|
231
|
+
typename: null,
|
|
232
|
+
props: Object.fromEntries(Object.entries(predicate).map(([key, value]) => [key, processPredicate(value)]))
|
|
233
|
+
};
|
|
234
|
+
return FilterClass.eq(predicate).ast;
|
|
251
235
|
};
|
|
252
|
-
var QueryClass = class
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
236
|
+
var QueryClass = class QueryClass {
|
|
237
|
+
static variance = {};
|
|
238
|
+
static is(value) {
|
|
239
|
+
return typeof value === "object" && value !== null && "~Query" in value;
|
|
240
|
+
}
|
|
241
|
+
static fromAst(ast) {
|
|
242
|
+
return new QueryClass(ast);
|
|
243
|
+
}
|
|
244
|
+
static select(filter) {
|
|
245
|
+
return new QueryClass({
|
|
246
|
+
type: "select",
|
|
247
|
+
filter: filter.ast
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
static type(schema, predicates) {
|
|
251
|
+
return new QueryClass({
|
|
252
|
+
type: "select",
|
|
253
|
+
filter: FilterClass.type(schema, predicates).ast
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
static all(...queries) {
|
|
257
|
+
if (queries.length === 0) throw new TypeError("Query.all combines results of multiple queries, to query all objects use Query.select(Filter.everything())");
|
|
258
|
+
return new QueryClass({
|
|
259
|
+
type: "union",
|
|
260
|
+
queries: queries.map((q) => q.ast)
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
static without(source, exclude) {
|
|
264
|
+
return new QueryClass({
|
|
265
|
+
type: "set-difference",
|
|
266
|
+
source: source.ast,
|
|
267
|
+
exclude: exclude.ast
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
constructor(ast) {
|
|
271
|
+
this.ast = ast;
|
|
272
|
+
}
|
|
273
|
+
"~Query" = QueryClass.variance;
|
|
274
|
+
select(filter) {
|
|
275
|
+
if (FilterClass.is(filter)) return new QueryClass({
|
|
276
|
+
type: "filter",
|
|
277
|
+
selection: this.ast,
|
|
278
|
+
filter: filter.ast
|
|
279
|
+
});
|
|
280
|
+
else return new QueryClass({
|
|
281
|
+
type: "filter",
|
|
282
|
+
selection: this.ast,
|
|
283
|
+
filter: FilterClass.props(filter).ast
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
reference(key) {
|
|
287
|
+
return new QueryClass({
|
|
288
|
+
type: "reference-traversal",
|
|
289
|
+
anchor: this.ast,
|
|
290
|
+
property: key
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
referencedBy(target, key) {
|
|
294
|
+
const typename = target !== void 0 ? (assertArgument(typeof target === "string", "target"), assertArgument(!target.startsWith("dxn:"), "target"), target) : null;
|
|
295
|
+
return new QueryClass({
|
|
296
|
+
type: "incoming-references",
|
|
297
|
+
anchor: this.ast,
|
|
298
|
+
property: key ?? null,
|
|
299
|
+
typename
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
sourceOf(relation, predicates) {
|
|
303
|
+
return new QueryClass({
|
|
304
|
+
type: "relation",
|
|
305
|
+
anchor: this.ast,
|
|
306
|
+
direction: "outgoing",
|
|
307
|
+
filter: FilterClass.type(relation, predicates).ast
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
targetOf(relation, predicates) {
|
|
311
|
+
return new QueryClass({
|
|
312
|
+
type: "relation",
|
|
313
|
+
anchor: this.ast,
|
|
314
|
+
direction: "incoming",
|
|
315
|
+
filter: FilterClass.type(relation, predicates).ast
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
source() {
|
|
319
|
+
return new QueryClass({
|
|
320
|
+
type: "relation-traversal",
|
|
321
|
+
anchor: this.ast,
|
|
322
|
+
direction: "source"
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
target() {
|
|
326
|
+
return new QueryClass({
|
|
327
|
+
type: "relation-traversal",
|
|
328
|
+
anchor: this.ast,
|
|
329
|
+
direction: "target"
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
orderBy(...order) {
|
|
333
|
+
return new QueryClass({
|
|
334
|
+
type: "order",
|
|
335
|
+
query: this.ast,
|
|
336
|
+
order: order.map((o) => o.ast)
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
limit(limit) {
|
|
340
|
+
return new QueryClass({
|
|
341
|
+
type: "limit",
|
|
342
|
+
query: this.ast,
|
|
343
|
+
limit
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
options(options) {
|
|
347
|
+
return new QueryClass({
|
|
348
|
+
type: "options",
|
|
349
|
+
query: this.ast,
|
|
350
|
+
options
|
|
351
|
+
});
|
|
352
|
+
}
|
|
370
353
|
};
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
354
|
+
const Query1 = QueryClass;
|
|
355
|
+
const RefTypeId = Symbol("@dxos/echo-query/Ref");
|
|
356
|
+
const isRef = (obj) => {
|
|
357
|
+
return obj && typeof obj === "object" && RefTypeId in obj;
|
|
375
358
|
};
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
};
|
|
381
|
-
export {
|
|
382
|
-
Filter1 as Filter,
|
|
383
|
-
Filter1,
|
|
384
|
-
Order2 as Order,
|
|
385
|
-
Query1 as Query,
|
|
386
|
-
Query1
|
|
359
|
+
const makeTypeDxn = (typename) => {
|
|
360
|
+
assertArgument(typeof typename === "string", "typename");
|
|
361
|
+
assertArgument(!typename.startsWith("dxn:"), "typename");
|
|
362
|
+
return `dxn:type:${typename}`;
|
|
387
363
|
};
|
|
364
|
+
|
|
365
|
+
//#endregion
|
|
366
|
+
export { Filter1 as Filter, Filter1, Order2 as Order, Query1 as Query, Query1 };
|
|
367
|
+
//# sourceMappingURL=index.js.map
|