@based/db 0.2.2 → 0.2.4
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/darwin_aarch64/libdeflate.dylib +0 -0
- package/dist/lib/darwin_aarch64/libjemalloc_selva.2.dylib +0 -0
- package/dist/lib/darwin_aarch64/libnode-v22.node +0 -0
- package/dist/lib/darwin_aarch64/libnode-v23.node +0 -0
- package/dist/lib/darwin_aarch64/libnode-v24.node +0 -0
- package/dist/lib/darwin_aarch64/libnode-v25.node +0 -0
- package/dist/lib/darwin_aarch64/libselva.dylib +0 -0
- package/dist/lib/linux_aarch64/libnode-v22.node +0 -0
- package/dist/lib/linux_aarch64/libnode-v23.node +0 -0
- package/dist/lib/linux_aarch64/libnode-v24.node +0 -0
- package/dist/lib/linux_aarch64/libnode-v25.node +0 -0
- package/dist/lib/linux_aarch64/libselva.so +0 -0
- package/dist/lib/linux_x86_64/libnode-v22.node +0 -0
- package/dist/lib/linux_x86_64/libnode-v23.node +0 -0
- package/dist/lib/linux_x86_64/libnode-v24.node +0 -0
- package/dist/lib/linux_x86_64/libnode-v25.node +0 -0
- package/dist/lib/linux_x86_64/libselva.so +0 -0
- package/dist/src/client/query/BasedQueryResponse.js +1 -0
- package/dist/src/client/query/filter/convertFilter.js +3 -2
- package/dist/src/client/query/filter/filter.js +7 -2
- package/dist/src/client/query/filter/primitiveFilter.js +21 -9
- package/dist/src/client/query/filter/types.d.ts +2 -1
- package/dist/src/client/query/filter/types.js +1 -0
- package/dist/src/server/subscription.js +6 -4
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -45,8 +45,9 @@ export const convertFilter = (query, field, operator, value, opts) => {
|
|
|
45
45
|
if (value === '' && operator === '=') {
|
|
46
46
|
return [[field, toFilterCtx(def, '!exists', opts), undefined]];
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
else if (value === '' && operator === '!=') {
|
|
49
|
+
return [[field, toFilterCtx(def, 'exists', opts), undefined]];
|
|
50
|
+
}
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
52
53
|
if (operator === '!..') {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isPropDef, ID_FIELD_DEF, TEXT, REFERENCE, } from '@based/schema/def';
|
|
1
|
+
import { isPropDef, ID_FIELD_DEF, TEXT, REFERENCE, REFERENCES, } from '@based/schema/def';
|
|
2
2
|
import { primitiveFilter } from './primitiveFilter.js';
|
|
3
3
|
import { IsFilter } from './types.js';
|
|
4
4
|
import { langCodesMap } from '@based/schema';
|
|
@@ -36,7 +36,12 @@ const referencesFilter = (db, filter, schema, conditions, def) => {
|
|
|
36
36
|
}
|
|
37
37
|
return size;
|
|
38
38
|
}
|
|
39
|
-
if (isPropDef(t) && t.typeIndex ===
|
|
39
|
+
if (isPropDef(t) && t.typeIndex === REFERENCES) {
|
|
40
|
+
console.info('REFERENCES NESTED NOT IMPLEMENTED');
|
|
41
|
+
conditions.references ??= new Map();
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
else if (isPropDef(t) && t.typeIndex === REFERENCE) {
|
|
40
45
|
conditions.references ??= new Map();
|
|
41
46
|
let refConditions = conditions.references.get(t.prop);
|
|
42
47
|
if (!refConditions) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CARDINALITY, REFERENCE, REFERENCES, REVERSE_SIZE_MAP, } from '@based/schema/def';
|
|
2
|
-
import { EQUAL, EXISTS, isNumerical, TYPE_NEGATE } from './types.js';
|
|
1
|
+
import { CARDINALITY, REFERENCE, REFERENCES, REVERSE_SIZE_MAP, REVERSE_TYPE_INDEX_MAP, STRING, } from '@based/schema/def';
|
|
2
|
+
import { EQUAL, EXISTS, isNumerical, TYPE_NEGATE, TYPE_DEFAULT, } from './types.js';
|
|
3
3
|
import { createVariableFilterBuffer } from './createVariableFilterBuffer.js';
|
|
4
4
|
import { createFixedFilterBuffer } from './createFixedFilterBuffer.js';
|
|
5
5
|
import { createReferenceFilter } from './createReferenceFilter.js';
|
|
@@ -13,14 +13,26 @@ export const primitiveFilter = (def, prop, filter, conditions, lang) => {
|
|
|
13
13
|
const fieldIndexChar = prop.prop;
|
|
14
14
|
const bufferMap = prop.__isEdge ? conditions.edges : conditions.conditions;
|
|
15
15
|
if (ctx.operation === EXISTS) {
|
|
16
|
-
if (!
|
|
17
|
-
|
|
16
|
+
if (!prop.separate) {
|
|
17
|
+
if (prop.typeIndex === STRING) {
|
|
18
|
+
ctx.operation = EQUAL;
|
|
19
|
+
ctx.type = ctx.type === TYPE_NEGATE ? TYPE_DEFAULT : TYPE_NEGATE;
|
|
20
|
+
value = '';
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
console.error('MISSING EXIST / !EXIST FILTER FOR', prop.path, REVERSE_TYPE_INDEX_MAP[prop.typeIndex]);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
if (!conditions.exists) {
|
|
28
|
+
conditions.exists = [];
|
|
29
|
+
}
|
|
30
|
+
conditions.exists.push({
|
|
31
|
+
prop: prop,
|
|
32
|
+
negate: filter[1].type === TYPE_NEGATE,
|
|
33
|
+
});
|
|
34
|
+
return 4;
|
|
18
35
|
}
|
|
19
|
-
conditions.exists.push({
|
|
20
|
-
prop: prop,
|
|
21
|
-
negate: filter[1].type === TYPE_NEGATE,
|
|
22
|
-
});
|
|
23
|
-
return 4;
|
|
24
36
|
}
|
|
25
37
|
let size = 0;
|
|
26
38
|
const isArray = Array.isArray(value);
|
|
@@ -44,7 +44,8 @@ export declare const META_EXISTS = 251;
|
|
|
44
44
|
export declare const META_EDGE = 252;
|
|
45
45
|
export declare const META_OR_BRANCH = 253;
|
|
46
46
|
export declare const META_REFERENCE = 254;
|
|
47
|
-
export
|
|
47
|
+
export declare const META_REFERENCES = 250;
|
|
48
|
+
export type FILTER_META = typeof META_EDGE | typeof META_OR_BRANCH | typeof META_REFERENCE | typeof META_EXISTS | typeof META_REFERENCES;
|
|
48
49
|
export type FilterCtx = {
|
|
49
50
|
operation: OPERATOR;
|
|
50
51
|
type: FILTER_TYPE;
|
|
@@ -66,6 +66,7 @@ export const META_EXISTS = 251;
|
|
|
66
66
|
export const META_EDGE = 252;
|
|
67
67
|
export const META_OR_BRANCH = 253;
|
|
68
68
|
export const META_REFERENCE = 254;
|
|
69
|
+
export const META_REFERENCES = 250;
|
|
69
70
|
export const VECTOR_DOT_PRODUCT = 0;
|
|
70
71
|
export const VECTOR_MANHATTAN_DIST = 1;
|
|
71
72
|
export const VECTOR_COSTINE_SIMILARITY = 2;
|
|
@@ -23,10 +23,12 @@ export const startUpdateHandler = (server) => {
|
|
|
23
23
|
const id = readUint32(buffer, i);
|
|
24
24
|
const subId = readUint32(buffer, i + 4);
|
|
25
25
|
const subContainer = server.subscriptions.ids.get(subId);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
fn
|
|
26
|
+
if (subContainer) {
|
|
27
|
+
const ids = subContainer.ids.get(id);
|
|
28
|
+
if (ids) {
|
|
29
|
+
for (const fn of ids) {
|
|
30
|
+
fn();
|
|
31
|
+
}
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
}
|