@dxos/echo-query 0.8.4-main.c4373fc → 0.8.4-main.cb12b3f963
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/neutral/index.mjs +917 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/query-lite/index.d.ts +9975 -0
- package/dist/query-lite/index.d.ts.map +1 -0
- package/dist/query-lite/index.js +548 -0
- 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/gen/index.d.ts.map +1 -1
- package/dist/types/src/parser/gen/query.terms.d.ts +1 -1
- package/dist/types/src/parser/gen/query.terms.d.ts.map +1 -1
- package/dist/types/src/parser/query-builder.d.ts +19 -4
- package/dist/types/src/parser/query-builder.d.ts.map +1 -1
- package/dist/types/src/query-lite/index.d.ts +2 -0
- package/dist/types/src/query-lite/index.d.ts.map +1 -0
- package/dist/types/src/query-lite/query-lite.d.ts +8 -0
- package/dist/types/src/query-lite/query-lite.d.ts.map +1 -0
- 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/query-sandbox.d.ts.map +1 -1
- package/dist/types/src/sandbox/quickjs.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -20
- package/src/env.d.ts +1 -1
- package/src/index.ts +1 -0
- package/src/parser/gen/query.terms.ts +24 -23
- package/src/parser/gen/query.ts +8 -8
- package/src/parser/query-builder.ts +334 -21
- package/src/parser/query.grammar +8 -2
- package/src/parser/query.test.ts +210 -44
- package/src/query-lite/index.ts +5 -0
- package/src/query-lite/query-lite.ts +744 -0
- package/src/sandbox/index.ts +5 -0
- package/src/sandbox/query-sandbox.test.ts +15 -14
- package/src/sandbox/query-sandbox.ts +4 -4
- package/src/sandbox/quickjs.ts +1 -2
- package/dist/lib/browser/index.mjs +0 -530
- 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 -530
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/query-env/index.js +0 -387
- package/dist/types/src/query-env/index.d.ts +0 -8
- package/dist/types/src/query-env/index.d.ts.map +0 -1
- package/src/query-env/index.ts +0 -462
package/src/query-env/index.ts
DELETED
|
@@ -1,462 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import type * as Schema from 'effect/Schema';
|
|
6
|
-
|
|
7
|
-
import type { Filter, Order, Query, Ref } from '@dxos/echo';
|
|
8
|
-
import type * as Echo from '@dxos/echo';
|
|
9
|
-
import type { ForeignKey, QueryAST } from '@dxos/echo-protocol';
|
|
10
|
-
import { assertArgument } from '@dxos/invariant';
|
|
11
|
-
import type { DXN, ObjectId } from '@dxos/keys';
|
|
12
|
-
|
|
13
|
-
class OrderClass implements Echo.Order<any> {
|
|
14
|
-
private static variance: Echo.Order<any>['~Order'] = {} as Echo.Order<any>['~Order'];
|
|
15
|
-
|
|
16
|
-
static is(value: unknown): value is Echo.Order<any> {
|
|
17
|
-
return typeof value === 'object' && value !== null && '~Order' in value;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
constructor(public readonly ast: QueryAST.Order) {}
|
|
21
|
-
|
|
22
|
-
'~Order' = OrderClass.variance;
|
|
23
|
-
}
|
|
24
|
-
namespace Order1 {
|
|
25
|
-
export const natural: Echo.Order<any> = new OrderClass({ kind: 'natural' });
|
|
26
|
-
export const property = <T>(property: keyof T & string, direction: QueryAST.OrderDirection): Echo.Order<T> =>
|
|
27
|
-
new OrderClass({
|
|
28
|
-
kind: 'property',
|
|
29
|
-
property,
|
|
30
|
-
direction,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const Order2: typeof Echo.Order = Order1;
|
|
35
|
-
export { Order2 as Order };
|
|
36
|
-
|
|
37
|
-
class FilterClass implements Echo.Filter<any> {
|
|
38
|
-
private static variance: Echo.Filter<any>['~Filter'] = {} as Echo.Filter<any>['~Filter'];
|
|
39
|
-
|
|
40
|
-
static is(value: unknown): value is Echo.Filter<any> {
|
|
41
|
-
return typeof value === 'object' && value !== null && '~Filter' in value;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
static fromAst(ast: QueryAST.Filter): Filter<any> {
|
|
45
|
-
return new FilterClass(ast);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
static everything(): FilterClass {
|
|
49
|
-
return new FilterClass({
|
|
50
|
-
type: 'object',
|
|
51
|
-
typename: null,
|
|
52
|
-
props: {},
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
static nothing(): FilterClass {
|
|
57
|
-
return new FilterClass({
|
|
58
|
-
type: 'not',
|
|
59
|
-
filter: {
|
|
60
|
-
type: 'object',
|
|
61
|
-
typename: null,
|
|
62
|
-
props: {},
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
static relation() {
|
|
68
|
-
return new FilterClass({
|
|
69
|
-
type: 'object',
|
|
70
|
-
typename: null,
|
|
71
|
-
props: {},
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
static ids(...ids: ObjectId[]): Echo.Filter<any> {
|
|
76
|
-
// assertArgument(
|
|
77
|
-
// ids.every((id) => ObjectId.isValid(id)),
|
|
78
|
-
// 'ids',
|
|
79
|
-
// 'ids must be valid',
|
|
80
|
-
// );
|
|
81
|
-
|
|
82
|
-
if (ids.length === 0) {
|
|
83
|
-
return FilterClass.nothing();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return new FilterClass({
|
|
87
|
-
type: 'object',
|
|
88
|
-
typename: null,
|
|
89
|
-
id: ids,
|
|
90
|
-
props: {},
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
static type<S extends Schema.Schema.All>(
|
|
95
|
-
schema: S | string,
|
|
96
|
-
props?: Echo.Filter.Props<Schema.Schema.Type<S>>,
|
|
97
|
-
): Echo.Filter<Schema.Schema.Type<S>> {
|
|
98
|
-
if (typeof schema !== 'string') {
|
|
99
|
-
throw new TypeError('expected typename as the first paramter');
|
|
100
|
-
}
|
|
101
|
-
return new FilterClass({
|
|
102
|
-
type: 'object',
|
|
103
|
-
typename: makeTypeDxn(schema),
|
|
104
|
-
...propsFilterToAst(props ?? {}),
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
static typename(typename: string): Echo.Filter<any> {
|
|
109
|
-
return new FilterClass({
|
|
110
|
-
type: 'object',
|
|
111
|
-
typename: makeTypeDxn(typename),
|
|
112
|
-
props: {},
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
static typeDXN(dxn: DXN): Echo.Filter<any> {
|
|
117
|
-
return new FilterClass({
|
|
118
|
-
type: 'object',
|
|
119
|
-
typename: dxn.toString(),
|
|
120
|
-
props: {},
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
static tag(tag: string): Echo.Filter<any> {
|
|
125
|
-
return new FilterClass({
|
|
126
|
-
type: 'tag',
|
|
127
|
-
tag,
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
static props<T>(props: Echo.Filter.Props<T>): Echo.Filter<T> {
|
|
132
|
-
return new FilterClass({
|
|
133
|
-
type: 'object',
|
|
134
|
-
typename: null,
|
|
135
|
-
...propsFilterToAst(props),
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
static text(text: string, options?: Echo.Query.TextSearchOptions): Echo.Filter<any> {
|
|
140
|
-
return new FilterClass({
|
|
141
|
-
type: 'text-search',
|
|
142
|
-
text,
|
|
143
|
-
searchKind: options?.type,
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
static foreignKeys<S extends Schema.Schema.All>(
|
|
148
|
-
schema: S | string,
|
|
149
|
-
keys: ForeignKey[],
|
|
150
|
-
): Echo.Filter<Schema.Schema.Type<S>> {
|
|
151
|
-
assertArgument(typeof schema === 'string', 'schema');
|
|
152
|
-
assertArgument(!schema.startsWith('dxn:'), 'schema');
|
|
153
|
-
return new FilterClass({
|
|
154
|
-
type: 'object',
|
|
155
|
-
typename: `dxn:type:${schema}`,
|
|
156
|
-
props: {},
|
|
157
|
-
foreignKeys: keys,
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
static eq<T>(value: T): Echo.Filter<T> {
|
|
162
|
-
if (!isRef(value) && typeof value === 'object' && value !== null) {
|
|
163
|
-
throw new TypeError('Cannot use object as a value for eq filter');
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return new FilterClass({
|
|
167
|
-
type: 'compare',
|
|
168
|
-
operator: 'eq',
|
|
169
|
-
value: isRef(value) ? value.noInline().encode() : value,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
static neq<T>(value: T): Echo.Filter<T> {
|
|
174
|
-
return new FilterClass({
|
|
175
|
-
type: 'compare',
|
|
176
|
-
operator: 'neq',
|
|
177
|
-
value,
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
static gt<T>(value: T): Echo.Filter<T> {
|
|
182
|
-
return new FilterClass({
|
|
183
|
-
type: 'compare',
|
|
184
|
-
operator: 'gt',
|
|
185
|
-
value,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
static gte<T>(value: T): Echo.Filter<T> {
|
|
190
|
-
return new FilterClass({
|
|
191
|
-
type: 'compare',
|
|
192
|
-
operator: 'gte',
|
|
193
|
-
value,
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
static lt<T>(value: T): Echo.Filter<T> {
|
|
198
|
-
return new FilterClass({
|
|
199
|
-
type: 'compare',
|
|
200
|
-
operator: 'lt',
|
|
201
|
-
value,
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
static lte<T>(value: T): Echo.Filter<T> {
|
|
206
|
-
return new FilterClass({
|
|
207
|
-
type: 'compare',
|
|
208
|
-
operator: 'lte',
|
|
209
|
-
value,
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
static in<T>(...values: T[]): Echo.Filter<T> {
|
|
214
|
-
return new FilterClass({
|
|
215
|
-
type: 'in',
|
|
216
|
-
values,
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
static contains<T>(value: T): Echo.Filter<T[]> {
|
|
221
|
-
return new FilterClass({
|
|
222
|
-
type: 'contains',
|
|
223
|
-
value,
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
static between<T>(from: T, to: T): Echo.Filter<T> {
|
|
228
|
-
return new FilterClass({
|
|
229
|
-
type: 'range',
|
|
230
|
-
from,
|
|
231
|
-
to,
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
static not<F extends Echo.Filter.Any>(filter: F): Echo.Filter<Echo.Filter.Type<F>> {
|
|
236
|
-
return new FilterClass({
|
|
237
|
-
type: 'not',
|
|
238
|
-
filter: filter.ast,
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
static and<T>(...filters: Echo.Filter<T>[]): Echo.Filter<T> {
|
|
243
|
-
return new FilterClass({
|
|
244
|
-
type: 'and',
|
|
245
|
-
filters: filters.map((f) => f.ast),
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
static or<T>(...filters: Echo.Filter<T>[]): Echo.Filter<T> {
|
|
250
|
-
return new FilterClass({
|
|
251
|
-
type: 'or',
|
|
252
|
-
filters: filters.map((f) => f.ast),
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
private constructor(public readonly ast: QueryAST.Filter) {}
|
|
257
|
-
|
|
258
|
-
'~Filter' = FilterClass.variance;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
export const Filter1: typeof Echo.Filter = FilterClass;
|
|
262
|
-
export { Filter1 as Filter };
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* All property paths inside T that are references.
|
|
266
|
-
*/
|
|
267
|
-
// TODO(dmaretskyi): Filter only properties that are references (or optional references, or unions that include references).
|
|
268
|
-
type RefPropKey<T> = keyof T & string;
|
|
269
|
-
|
|
270
|
-
const propsFilterToAst = (predicates: Echo.Filter.Props<any>): Pick<QueryAST.FilterObject, 'id' | 'props'> => {
|
|
271
|
-
let idFilter: readonly ObjectId[] | undefined;
|
|
272
|
-
if ('id' in predicates) {
|
|
273
|
-
assertArgument(
|
|
274
|
-
typeof predicates.id === 'string' || Array.isArray(predicates.id),
|
|
275
|
-
'predicates.id',
|
|
276
|
-
'invalid id filter',
|
|
277
|
-
);
|
|
278
|
-
idFilter = typeof predicates.id === 'string' ? [predicates.id] : predicates.id;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
return {
|
|
282
|
-
id: idFilter,
|
|
283
|
-
props: Object.fromEntries(
|
|
284
|
-
Object.entries(predicates)
|
|
285
|
-
.filter(([prop, _value]) => prop !== 'id')
|
|
286
|
-
.map(([prop, predicate]) => [prop, processPredicate(predicate)]),
|
|
287
|
-
) as Record<string, QueryAST.Filter>,
|
|
288
|
-
};
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
const processPredicate = (predicate: any): QueryAST.Filter => {
|
|
292
|
-
if (FilterClass.is(predicate)) {
|
|
293
|
-
return predicate.ast;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
if (Array.isArray(predicate)) {
|
|
297
|
-
throw new Error('Array predicates are not yet supported.');
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
if (!isRef(predicate) && typeof predicate === 'object' && predicate !== null) {
|
|
301
|
-
const nestedProps = Object.fromEntries(
|
|
302
|
-
Object.entries(predicate).map(([key, value]) => [key, processPredicate(value)]),
|
|
303
|
-
);
|
|
304
|
-
|
|
305
|
-
return {
|
|
306
|
-
type: 'object',
|
|
307
|
-
typename: null,
|
|
308
|
-
props: nestedProps,
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
return FilterClass.eq(predicate).ast;
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
class QueryClass implements Echo.Query<any> {
|
|
316
|
-
private static variance: Echo.Query<any>['~Query'] = {} as Echo.Query<any>['~Query'];
|
|
317
|
-
|
|
318
|
-
static is(value: unknown): value is Echo.Query<any> {
|
|
319
|
-
return typeof value === 'object' && value !== null && '~Query' in value;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
static fromAst(ast: QueryAST.Query): Echo.Query<any> {
|
|
323
|
-
return new QueryClass(ast);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
static select<F extends Echo.Filter.Any>(filter: F): Echo.Query<Echo.Filter.Type<F>> {
|
|
327
|
-
return new QueryClass({
|
|
328
|
-
type: 'select',
|
|
329
|
-
filter: filter.ast,
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
static type(schema: Schema.Schema.All | string, predicates?: Echo.Filter.Props<unknown>): Query<any> {
|
|
334
|
-
return new QueryClass({
|
|
335
|
-
type: 'select',
|
|
336
|
-
filter: FilterClass.type(schema, predicates).ast,
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
static all(...queries: Query<any>[]): Query<any> {
|
|
341
|
-
if (queries.length === 0) {
|
|
342
|
-
throw new TypeError(
|
|
343
|
-
'Query.all combines results of multiple queries, to query all objects use Query.select(Filter.everything())',
|
|
344
|
-
);
|
|
345
|
-
}
|
|
346
|
-
return new QueryClass({
|
|
347
|
-
type: 'union',
|
|
348
|
-
queries: queries.map((q) => q.ast),
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
static without<T>(source: Query<T>, exclude: Query<T>): Query<T> {
|
|
353
|
-
return new QueryClass({
|
|
354
|
-
type: 'set-difference',
|
|
355
|
-
source: source.ast,
|
|
356
|
-
exclude: exclude.ast,
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
constructor(public readonly ast: QueryAST.Query) {}
|
|
361
|
-
|
|
362
|
-
'~Query' = QueryClass.variance;
|
|
363
|
-
|
|
364
|
-
select(filter: Filter<any> | Filter.Props<any>): Query<any> {
|
|
365
|
-
if (FilterClass.is(filter)) {
|
|
366
|
-
return new QueryClass({
|
|
367
|
-
type: 'filter',
|
|
368
|
-
selection: this.ast,
|
|
369
|
-
filter: filter.ast,
|
|
370
|
-
});
|
|
371
|
-
} else {
|
|
372
|
-
return new QueryClass({
|
|
373
|
-
type: 'filter',
|
|
374
|
-
selection: this.ast,
|
|
375
|
-
filter: FilterClass.props(filter).ast,
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
reference(key: string): Query<any> {
|
|
381
|
-
return new QueryClass({
|
|
382
|
-
type: 'reference-traversal',
|
|
383
|
-
anchor: this.ast,
|
|
384
|
-
property: key,
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
referencedBy(target: Schema.Schema.All | string, key: string): Query<any> {
|
|
389
|
-
assertArgument(typeof target === 'string', 'target');
|
|
390
|
-
assertArgument(!target.startsWith('dxn:'), 'target');
|
|
391
|
-
return new QueryClass({
|
|
392
|
-
type: 'incoming-references',
|
|
393
|
-
anchor: this.ast,
|
|
394
|
-
property: key,
|
|
395
|
-
typename: target,
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
sourceOf(relation: Schema.Schema.All | string, predicates?: Filter.Props<unknown> | undefined): Query<any> {
|
|
400
|
-
return new QueryClass({
|
|
401
|
-
type: 'relation',
|
|
402
|
-
anchor: this.ast,
|
|
403
|
-
direction: 'outgoing',
|
|
404
|
-
filter: FilterClass.type(relation, predicates).ast,
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
targetOf(relation: Schema.Schema.All | string, predicates?: Filter.Props<unknown> | undefined): Query<any> {
|
|
409
|
-
return new QueryClass({
|
|
410
|
-
type: 'relation',
|
|
411
|
-
anchor: this.ast,
|
|
412
|
-
direction: 'incoming',
|
|
413
|
-
filter: FilterClass.type(relation, predicates).ast,
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
source(): Query<any> {
|
|
418
|
-
return new QueryClass({
|
|
419
|
-
type: 'relation-traversal',
|
|
420
|
-
anchor: this.ast,
|
|
421
|
-
direction: 'source',
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
target(): Query<any> {
|
|
426
|
-
return new QueryClass({
|
|
427
|
-
type: 'relation-traversal',
|
|
428
|
-
anchor: this.ast,
|
|
429
|
-
direction: 'target',
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
orderBy(...order: Order<any>[]): Query<any> {
|
|
434
|
-
return new QueryClass({
|
|
435
|
-
type: 'order',
|
|
436
|
-
query: this.ast,
|
|
437
|
-
order: order.map((o) => o.ast),
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
options(options: QueryAST.QueryOptions): Query<any> {
|
|
442
|
-
return new QueryClass({
|
|
443
|
-
type: 'options',
|
|
444
|
-
query: this.ast,
|
|
445
|
-
options,
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
export const Query1: typeof Echo.Query = QueryClass;
|
|
451
|
-
export { Query1 as Query };
|
|
452
|
-
|
|
453
|
-
const RefTypeId: unique symbol = Symbol('@dxos/echo-query/Ref');
|
|
454
|
-
const isRef = (obj: any): obj is Ref.Ref<any> => {
|
|
455
|
-
return obj && typeof obj === 'object' && RefTypeId in obj;
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
const makeTypeDxn = (typename: string) => {
|
|
459
|
-
assertArgument(typeof typename === 'string', 'typename');
|
|
460
|
-
assertArgument(!typename.startsWith('dxn:'), 'typename');
|
|
461
|
-
return `dxn:type:${typename}`;
|
|
462
|
-
};
|