@travetto/model-query 3.1.14 → 3.1.15
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/README.md +1 -2
- package/package.json +5 -5
- package/src/internal/util/types.ts +1 -1
- package/src/model/where-clause.ts +0 -1
- package/support/test/query.ts +16 -16
package/README.md
CHANGED
|
@@ -131,7 +131,7 @@ One of the complexities of abstracting multiple storage mechanisms, is providing
|
|
|
131
131
|
|
|
132
132
|
* `field: { $eq: T }` to determine if a field is equal to a value
|
|
133
133
|
* `field: { $ne: T }` to determine if a field is not equal to a value
|
|
134
|
-
* `field: { $exists: boolean }` to determine if a field exists or not
|
|
134
|
+
* `field: { $exists: boolean }` to determine if a field exists or not, or for arrays, if its empty or not
|
|
135
135
|
* `field: T` to see if the field is equal to whatever value is passed in`
|
|
136
136
|
|
|
137
137
|
### General Single Valued Fields
|
|
@@ -158,7 +158,6 @@ One of the complexities of abstracting multiple storage mechanisms, is providing
|
|
|
158
158
|
### Array Fields
|
|
159
159
|
|
|
160
160
|
* `field: { $all: T[]] }` checks to see if the records value contains everything within `$all`
|
|
161
|
-
* `field: { $empty: boolean }` to determine if an array is missing or is of zero length.
|
|
162
161
|
|
|
163
162
|
### String Fields
|
|
164
163
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-query",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.15",
|
|
4
4
|
"description": "Datastore abstraction for advanced query support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datastore",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"directory": "module/model-query"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@travetto/di": "^3.1.
|
|
31
|
-
"@travetto/model": "^3.1.
|
|
32
|
-
"@travetto/schema": "^3.1.
|
|
30
|
+
"@travetto/di": "^3.1.5",
|
|
31
|
+
"@travetto/model": "^3.1.15",
|
|
32
|
+
"@travetto/schema": "^3.1.9"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@travetto/test": "^3.1.
|
|
35
|
+
"@travetto/test": "^3.1.6"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@travetto/test": {
|
|
@@ -6,7 +6,7 @@ import { PointImpl } from '../model/point';
|
|
|
6
6
|
const st = (t: string | string[], isArr: boolean = false): Set<string> =>
|
|
7
7
|
new Set((Array.isArray(t) ? t : [t]).map(v => isArr ? `${v}[]` : v));
|
|
8
8
|
|
|
9
|
-
const basic = (types: Set<string>): Record<string, Set<string>> => ({ $ne: types, $eq: types, $exists: st('boolean')
|
|
9
|
+
const basic = (types: Set<string>): Record<string, Set<string>> => ({ $ne: types, $eq: types, $exists: st('boolean') });
|
|
10
10
|
const scalar = (types: Set<string>): Record<string, Set<string>> => ({ $in: types, $nin: types });
|
|
11
11
|
const str = (): Record<string, Set<string>> => ({ $regex: st(['RegExp', 'string']) });
|
|
12
12
|
const comp = (types: Set<string>): Record<string, Set<string>> => ({ $lt: types, $lte: types, $gt: types, $gte: types });
|
package/support/test/query.ts
CHANGED
|
@@ -326,43 +326,43 @@ export abstract class ModelQuerySuite extends BaseModelSuite<ModelQuerySupport &
|
|
|
326
326
|
|
|
327
327
|
let total = await service.queryCount(WithNestedLists, {
|
|
328
328
|
where: {
|
|
329
|
-
names: { $
|
|
329
|
+
names: { $exists: true }
|
|
330
330
|
}
|
|
331
331
|
});
|
|
332
332
|
assert(total === 3);
|
|
333
333
|
total = await service.queryCount(WithNestedLists, {
|
|
334
334
|
where: {
|
|
335
|
-
names: { $
|
|
335
|
+
names: { $exists: false }
|
|
336
336
|
}
|
|
337
337
|
});
|
|
338
338
|
assert(total === 2);
|
|
339
339
|
|
|
340
340
|
total = await service.queryCount(WithNestedLists, {
|
|
341
341
|
where: {
|
|
342
|
-
tags: { $
|
|
342
|
+
tags: { $exists: false }
|
|
343
343
|
}
|
|
344
344
|
});
|
|
345
345
|
assert(total === 3);
|
|
346
346
|
|
|
347
347
|
total = await service.queryCount(WithNestedLists, {
|
|
348
348
|
where: {
|
|
349
|
-
tags: { $
|
|
349
|
+
tags: { $exists: true }
|
|
350
350
|
}
|
|
351
351
|
});
|
|
352
352
|
assert(total === 2);
|
|
353
353
|
|
|
354
354
|
total = await service.queryCount(WithNestedLists, {
|
|
355
355
|
where: {
|
|
356
|
-
tags: { $
|
|
357
|
-
names: { $
|
|
356
|
+
tags: { $exists: false },
|
|
357
|
+
names: { $exists: false }
|
|
358
358
|
}
|
|
359
359
|
});
|
|
360
360
|
assert(total === 1);
|
|
361
361
|
|
|
362
362
|
total = await service.queryCount(WithNestedLists, {
|
|
363
363
|
where: {
|
|
364
|
-
tags: { $
|
|
365
|
-
names: { $
|
|
364
|
+
tags: { $exists: true },
|
|
365
|
+
names: { $exists: true }
|
|
366
366
|
}
|
|
367
367
|
});
|
|
368
368
|
|
|
@@ -397,43 +397,43 @@ export abstract class ModelQuerySuite extends BaseModelSuite<ModelQuerySupport &
|
|
|
397
397
|
|
|
398
398
|
let total = await service.queryCount(WithNestedNestedLists, {
|
|
399
399
|
where: {
|
|
400
|
-
sub: { names: { $
|
|
400
|
+
sub: { names: { $exists: true } }
|
|
401
401
|
}
|
|
402
402
|
});
|
|
403
403
|
assert(total === 3);
|
|
404
404
|
total = await service.queryCount(WithNestedNestedLists, {
|
|
405
405
|
where: {
|
|
406
|
-
sub: { names: { $
|
|
406
|
+
sub: { names: { $exists: false } }
|
|
407
407
|
}
|
|
408
408
|
});
|
|
409
409
|
assert(total === 2);
|
|
410
410
|
|
|
411
411
|
total = await service.queryCount(WithNestedNestedLists, {
|
|
412
412
|
where: {
|
|
413
|
-
tags: { $
|
|
413
|
+
tags: { $exists: false }
|
|
414
414
|
}
|
|
415
415
|
});
|
|
416
416
|
assert(total === 3);
|
|
417
417
|
|
|
418
418
|
total = await service.queryCount(WithNestedNestedLists, {
|
|
419
419
|
where: {
|
|
420
|
-
tags: { $
|
|
420
|
+
tags: { $exists: true }
|
|
421
421
|
}
|
|
422
422
|
});
|
|
423
423
|
assert(total === 2);
|
|
424
424
|
|
|
425
425
|
total = await service.queryCount(WithNestedNestedLists, {
|
|
426
426
|
where: {
|
|
427
|
-
tags: { $
|
|
428
|
-
sub: { names: { $
|
|
427
|
+
tags: { $exists: false },
|
|
428
|
+
sub: { names: { $exists: false } }
|
|
429
429
|
}
|
|
430
430
|
});
|
|
431
431
|
assert(total === 1);
|
|
432
432
|
|
|
433
433
|
total = await service.queryCount(WithNestedNestedLists, {
|
|
434
434
|
where: {
|
|
435
|
-
tags: { $
|
|
436
|
-
sub: { names: { $
|
|
435
|
+
tags: { $exists: true },
|
|
436
|
+
sub: { names: { $exists: true } }
|
|
437
437
|
}
|
|
438
438
|
});
|
|
439
439
|
|