@based/db 0.0.14 → 0.0.16
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/include/selva/hll.h +2 -1
- package/dist/lib/darwin_aarch64/libnode-v20.11.1.node +0 -0
- package/dist/lib/darwin_aarch64/libnode-v20.18.1.node +0 -0
- package/dist/lib/darwin_aarch64/libnode-v22.13.0.node +0 -0
- package/dist/lib/darwin_aarch64/libselva.dylib +0 -0
- package/dist/lib/darwin_aarch64/libxxhash.0.8.2.dylib +0 -0
- package/dist/lib/darwin_aarch64/libxxhash.0.dylib +0 -0
- package/dist/lib/darwin_aarch64/libxxhash.dylib +0 -0
- package/dist/lib/linux_aarch64/include/selva/hll.h +2 -1
- package/dist/lib/linux_aarch64/libnode-v20.11.1.node +0 -0
- package/dist/lib/linux_aarch64/libnode-v20.18.1.node +0 -0
- package/dist/lib/linux_aarch64/libnode-v22.13.0.node +0 -0
- package/dist/lib/linux_aarch64/libselva.so +0 -0
- package/dist/lib/linux_aarch64/libxxhash.so +0 -0
- package/dist/lib/linux_aarch64/libxxhash.so.0 +0 -0
- package/dist/lib/linux_x86_64/include/selva/hll.h +2 -1
- package/dist/lib/linux_x86_64/libnode-v20.11.1.node +0 -0
- package/dist/lib/linux_x86_64/libnode-v20.18.1.node +0 -0
- package/dist/lib/linux_x86_64/libnode-v22.13.0.node +0 -0
- package/dist/lib/linux_x86_64/libselva.so +0 -0
- package/dist/lib/linux_x86_64/libxxhash.so +0 -0
- package/dist/lib/linux_x86_64/libxxhash.so.0 +0 -0
- package/dist/src/client/bitWise.js +1 -0
- package/dist/src/client/modify/cardinality.js +8 -9
- package/dist/src/client/query/BasedDbQuery.d.ts +1 -1
- package/dist/src/client/query/BasedDbQuery.js +14 -7
- package/dist/src/client/query/display.js +11 -3
- package/dist/src/client/query/filter/FilterBranch.js +8 -3
- package/dist/src/client/query/filter/convertFilter.d.ts +4 -0
- package/dist/src/client/query/filter/convertFilter.js +56 -0
- package/dist/src/client/query/filter/filter.d.ts +1 -2
- package/dist/src/client/query/filter/filter.js +5 -56
- package/dist/src/client/query/filter/primitiveFilter.d.ts +2 -2
- package/dist/src/client/query/filter/primitiveFilter.js +5 -1
- package/dist/src/client/query/filter/types.d.ts +2 -1
- package/dist/src/client/query/filter/types.js +23 -12
- package/dist/src/client/query/read/read.js +21 -32
- package/dist/src/client/query/read/types.d.ts +4 -0
- package/dist/src/client/query/read/types.js +5 -0
- package/dist/src/client/query/validation.d.ts +7 -1
- package/dist/src/client/query/validation.js +129 -46
- package/dist/src/client/xxHash64.d.ts +1 -1
- package/dist/src/client/xxHash64.js +7 -2
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.js +16 -1
- package/dist/src/native.d.ts +1 -1
- package/dist/src/native.js +2 -2
- package/dist/src/server/schema/utils.d.ts +1 -0
- package/dist/src/server/schema/utils.js +18 -5
- package/package.json +1 -1
- package/dist/lib/darwin_aarch64/libnode-v22.8.0.node +0 -0
- package/dist/src/client/modify/create copy.d.ts +0 -5
- package/dist/src/client/modify/create copy.js +0 -112
- package/dist/src/client/modify/hll.d.ts +0 -4
- package/dist/src/client/modify/hll.js +0 -58
- package/dist/src/client/modify/remove.d.ts +0 -1
- package/dist/src/client/modify/remove.js +0 -39
- package/dist/src/client/modify/vector copy.d.ts +0 -4
- package/dist/src/client/modify/vector copy.js +0 -46
- package/dist/src/client/query/filter/operators.d.ts +0 -6
- package/dist/src/client/query/filter/operators.js +0 -98
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ModifyCtx } from '../../index.js';
|
|
2
|
-
import { SchemaTypeDef, PropDef } from '../../server/schema/types.js';
|
|
3
|
-
import { ModifyOp, ModifyErr } from './types.js';
|
|
4
|
-
export declare function writeHll(value: string | null | Buffer, ctx: ModifyCtx, def: SchemaTypeDef, t: PropDef, parentId: number, modifyOp: ModifyOp): ModifyErr;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { UPDATE, RANGE_ERR, DELETE } from './types.js';
|
|
2
|
-
import { ModifyError } from './ModifyRes.js';
|
|
3
|
-
import { setCursor } from './setCursor.js';
|
|
4
|
-
import { crc32 } from '../crc32.js';
|
|
5
|
-
export function writeHll(value, ctx, def, t, parentId, modifyOp) {
|
|
6
|
-
if (typeof value !== 'object') {
|
|
7
|
-
return new ModifyError(t, value);
|
|
8
|
-
}
|
|
9
|
-
if (value === null) {
|
|
10
|
-
if (modifyOp === UPDATE) {
|
|
11
|
-
if (ctx.len + 11 > ctx.max) {
|
|
12
|
-
return RANGE_ERR;
|
|
13
|
-
}
|
|
14
|
-
setCursor(ctx, def, t.prop, parentId, modifyOp);
|
|
15
|
-
ctx.buf[ctx.len++] = DELETE;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
else if (Array.isArray(value)) {
|
|
19
|
-
return addHll(value, ctx, def, t, parentId, modifyOp, 0);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
for (const key in value) {
|
|
23
|
-
if (key === 'add') {
|
|
24
|
-
const err = addHll(value, ctx, def, t, parentId, modifyOp, 1);
|
|
25
|
-
if (err) {
|
|
26
|
-
return err;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
return new ModifyError(t, value);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function addHll(value, ctx, def, t, parentId, modifyOp, addOrPut) {
|
|
36
|
-
let size = value.length * 4 + 1;
|
|
37
|
-
if (ctx.len + size + 11 > ctx.max) {
|
|
38
|
-
return RANGE_ERR;
|
|
39
|
-
}
|
|
40
|
-
setCursor(ctx, def, t.prop, parentId, modifyOp);
|
|
41
|
-
ctx.buf[ctx.len++] = modifyOp;
|
|
42
|
-
ctx.buf[ctx.len++] = size;
|
|
43
|
-
ctx.buf[ctx.len++] = size >>>= 8;
|
|
44
|
-
ctx.buf[ctx.len++] = size >>>= 8;
|
|
45
|
-
ctx.buf[ctx.len++] = size >>>= 8;
|
|
46
|
-
ctx.buf[ctx.len++] = addOrPut;
|
|
47
|
-
for (const str of value) {
|
|
48
|
-
if (typeof str !== 'string') {
|
|
49
|
-
return new ModifyError(t, value);
|
|
50
|
-
}
|
|
51
|
-
let hash = crc32(Buffer.from(str));
|
|
52
|
-
ctx.buf[ctx.len++] = hash;
|
|
53
|
-
ctx.buf[ctx.len++] = hash >>>= 8;
|
|
54
|
-
ctx.buf[ctx.len++] = hash >>>= 8;
|
|
55
|
-
ctx.buf[ctx.len++] = hash >>>= 8;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=hll.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { flushBuffer, startDrain } from '../operations.js';
|
|
2
|
-
import { setCursor } from './setCursor.js';
|
|
3
|
-
import { UPDATE } from './types.js';
|
|
4
|
-
import { MICRO_BUFFER } from '../../server/schema/schema.js';
|
|
5
|
-
export const ;
|
|
6
|
-
delete ;
|
|
7
|
-
(db, type, id) => {
|
|
8
|
-
const ctx = db.modifyCtx;
|
|
9
|
-
const schema = db.schemaTypesParsed[type];
|
|
10
|
-
const separate = schema.separate;
|
|
11
|
-
if (separate) {
|
|
12
|
-
const size = 12 + separate.length * 12;
|
|
13
|
-
if (ctx.len + size > ctx.max) {
|
|
14
|
-
flushBuffer(db);
|
|
15
|
-
return delete (db, type, id);
|
|
16
|
-
}
|
|
17
|
-
setCursor(ctx, schema, 0, MICRO_BUFFER, id, UPDATE);
|
|
18
|
-
ctx.buf[ctx.len++] = 4;
|
|
19
|
-
for (const s of separate) {
|
|
20
|
-
setCursor(ctx, schema, s.prop, s.typeIndex, id, UPDATE);
|
|
21
|
-
ctx.buf[ctx.len++] = 4;
|
|
22
|
-
}
|
|
23
|
-
ctx.buf[ctx.len++] = 10;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
if (ctx.len + 12 > ctx.max) {
|
|
27
|
-
flushBuffer(db);
|
|
28
|
-
return delete (db, type, id);
|
|
29
|
-
}
|
|
30
|
-
setCursor(ctx, schema, 0, MICRO_BUFFER, id, UPDATE);
|
|
31
|
-
ctx.buf[ctx.len++] = 4;
|
|
32
|
-
ctx.buf[ctx.len++] = 10;
|
|
33
|
-
}
|
|
34
|
-
if (!db.isDraining) {
|
|
35
|
-
startDrain(db);
|
|
36
|
-
}
|
|
37
|
-
return true;
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=remove.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ModifyCtx } from '../../index.js';
|
|
2
|
-
import { PropDef, SchemaTypeDef } from '../../server/schema/types.js';
|
|
3
|
-
import { ModifyOp, ModifyErr } from './types.js';
|
|
4
|
-
export declare function writeVector(value: any, ctx: ModifyCtx, schema: SchemaTypeDef, t: PropDef, parentId: number, modifyOp: ModifyOp): ModifyErr;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { UPDATE, RANGE_ERR, DELETE } from './types.js';
|
|
2
|
-
import { ModifyError } from './ModifyRes.js';
|
|
3
|
-
import { setCursor } from './setCursor.js';
|
|
4
|
-
function write(value, ctx, fieldSize) {
|
|
5
|
-
const size = Math.min(value.byteLength, fieldSize);
|
|
6
|
-
let tmp = size;
|
|
7
|
-
// 16-bits would be enough but the zig code now expects 32-bits
|
|
8
|
-
ctx.buf[ctx.len++] = tmp;
|
|
9
|
-
ctx.buf[ctx.len++] = tmp >>>= 8;
|
|
10
|
-
ctx.buf[ctx.len++] = tmp >>>= 8;
|
|
11
|
-
ctx.buf[ctx.len++] = tmp >>>= 8;
|
|
12
|
-
Buffer.from(value.buffer).copy(ctx.buf, ctx.len, 0, size);
|
|
13
|
-
ctx.len += size;
|
|
14
|
-
}
|
|
15
|
-
export function writeVector(value, ctx, schema, t, parentId, modifyOp) {
|
|
16
|
-
let size;
|
|
17
|
-
if (value === null) {
|
|
18
|
-
size = 0;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
if (!value) {
|
|
22
|
-
return new ModifyError(t, value);
|
|
23
|
-
}
|
|
24
|
-
size = value.byteLength + 4;
|
|
25
|
-
}
|
|
26
|
-
if (size === 0) {
|
|
27
|
-
if (modifyOp === UPDATE) {
|
|
28
|
-
if (ctx.len + 11 > ctx.max) {
|
|
29
|
-
// TODO ???
|
|
30
|
-
return RANGE_ERR;
|
|
31
|
-
}
|
|
32
|
-
setCursor(ctx, schema, t.prop, t.typeIndex, parentId, modifyOp);
|
|
33
|
-
ctx.buf[ctx.len++] = DELETE;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
if (ctx.len + 15 + size > ctx.max) {
|
|
38
|
-
// TODO ???
|
|
39
|
-
return RANGE_ERR;
|
|
40
|
-
}
|
|
41
|
-
setCursor(ctx, schema, t.prop, t.typeIndex, parentId, modifyOp);
|
|
42
|
-
ctx.buf[ctx.len++] = modifyOp;
|
|
43
|
-
write(value, ctx, t.len);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=vector%20copy.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const validOperators: readonly ["=", "has", "!has", "<", ">", "!=", "like", ">=", "<=", "..", "!..", "hasLoose"];
|
|
2
|
-
export type Operator = '=' | 'has' | '!has' | '<' | '>' | '!=' | 'like' | '>=' | '<=' | '..' | '!..' | 'like' | 'hasLoose';
|
|
3
|
-
export declare const operationToByte: (op: Operator) => number;
|
|
4
|
-
export declare const isNumerical: (op: number) => boolean;
|
|
5
|
-
export declare const stripNegation: (op: number) => number;
|
|
6
|
-
export declare const negateType: (op: number) => number;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
export const validOperators = [
|
|
2
|
-
'=',
|
|
3
|
-
'has',
|
|
4
|
-
'!has',
|
|
5
|
-
'<',
|
|
6
|
-
'>',
|
|
7
|
-
'!=',
|
|
8
|
-
'like',
|
|
9
|
-
'>=',
|
|
10
|
-
'<=',
|
|
11
|
-
'..',
|
|
12
|
-
'!..',
|
|
13
|
-
'hasLoose',
|
|
14
|
-
];
|
|
15
|
-
// -------------------------------------------
|
|
16
|
-
// operations shared
|
|
17
|
-
// 1 = equality
|
|
18
|
-
// 2 = has (simd)
|
|
19
|
-
// 3 = not equal
|
|
20
|
-
// 4 = ends with
|
|
21
|
-
// 5 = starts with
|
|
22
|
-
// -------------------------------------------
|
|
23
|
-
// operations numbers
|
|
24
|
-
// 6 = larger then
|
|
25
|
-
// 7 = smaller then
|
|
26
|
-
// 8 = larger then inclusive
|
|
27
|
-
// 9 = smaller then inclusive
|
|
28
|
-
// 10 = range
|
|
29
|
-
// 11 = exclude range
|
|
30
|
-
// -------------------------------------------
|
|
31
|
-
// operations strings
|
|
32
|
-
// 12 = equality to lower case
|
|
33
|
-
// 13 = has to lower case (simd)
|
|
34
|
-
// 14 = starts with to lower case
|
|
35
|
-
// 15 = ends with to lower case
|
|
36
|
-
// 18 = search
|
|
37
|
-
// -------------------------------------------
|
|
38
|
-
export const operationToByte = (op) => {
|
|
39
|
-
if (op === '=') {
|
|
40
|
-
return 1;
|
|
41
|
-
}
|
|
42
|
-
if (op === 'has') {
|
|
43
|
-
return 2;
|
|
44
|
-
}
|
|
45
|
-
if (op === '!=') {
|
|
46
|
-
return 3;
|
|
47
|
-
}
|
|
48
|
-
if (op === '!has') {
|
|
49
|
-
return 16;
|
|
50
|
-
}
|
|
51
|
-
if (op === '>') {
|
|
52
|
-
return 6;
|
|
53
|
-
}
|
|
54
|
-
if (op === '<') {
|
|
55
|
-
return 7;
|
|
56
|
-
}
|
|
57
|
-
if (op === '>=') {
|
|
58
|
-
return 8;
|
|
59
|
-
}
|
|
60
|
-
if (op === '<=') {
|
|
61
|
-
return 9;
|
|
62
|
-
}
|
|
63
|
-
if (op === '..') {
|
|
64
|
-
return 10;
|
|
65
|
-
}
|
|
66
|
-
if (op === '!..') {
|
|
67
|
-
return 11;
|
|
68
|
-
}
|
|
69
|
-
if (op === 'like') {
|
|
70
|
-
return 18;
|
|
71
|
-
}
|
|
72
|
-
if (op === 'hasLoose') {
|
|
73
|
-
return 19;
|
|
74
|
-
}
|
|
75
|
-
return 0;
|
|
76
|
-
};
|
|
77
|
-
export const isNumerical = (op) => {
|
|
78
|
-
if (op === 6 || op === 7 || op === 8 || op === 9 || op === 10 || op === 11) {
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
return false;
|
|
82
|
-
};
|
|
83
|
-
export const stripNegation = (op) => {
|
|
84
|
-
if (op === 16) {
|
|
85
|
-
return 2;
|
|
86
|
-
}
|
|
87
|
-
if (op === 3) {
|
|
88
|
-
return 1;
|
|
89
|
-
}
|
|
90
|
-
return op;
|
|
91
|
-
};
|
|
92
|
-
export const negateType = (op) => {
|
|
93
|
-
if (op === 3) {
|
|
94
|
-
return 1;
|
|
95
|
-
}
|
|
96
|
-
return 2;
|
|
97
|
-
};
|
|
98
|
-
//# sourceMappingURL=operators.js.map
|