@based/db 0.0.7 → 0.0.9
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 +425 -8
- package/dist/lib/darwin_aarch64/include/selva/db.h +12 -3
- package/dist/lib/darwin_aarch64/include/selva/fields.h +22 -11
- package/dist/lib/darwin_aarch64/include/selva/history.h +49 -0
- package/dist/lib/darwin_aarch64/include/selva/hll.h +21 -0
- package/dist/lib/darwin_aarch64/include/selva/sort.h +14 -0
- package/dist/lib/darwin_aarch64/include/selva/types.h +9 -2
- package/dist/lib/darwin_aarch64/include/selva/vector.h +22 -1
- package/dist/lib/darwin_aarch64/include/selva/xxhash64.h +23 -0
- 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/libnode-v22.8.0.node +0 -0
- package/dist/lib/darwin_aarch64/libselva.dylib +0 -0
- package/dist/lib/linux_aarch64/include/selva/db.h +12 -3
- package/dist/lib/linux_aarch64/include/selva/fields.h +22 -11
- package/dist/lib/linux_aarch64/include/selva/history.h +49 -0
- package/dist/lib/linux_aarch64/include/selva/hll.h +21 -0
- package/dist/lib/linux_aarch64/include/selva/sort.h +14 -0
- package/dist/lib/linux_aarch64/include/selva/types.h +9 -2
- package/dist/lib/linux_aarch64/include/selva/vector.h +22 -1
- package/dist/lib/linux_aarch64/include/selva/xxhash64.h +23 -0
- 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_x86_64/include/selva/db.h +12 -3
- package/dist/lib/linux_x86_64/include/selva/fields.h +22 -11
- package/dist/lib/linux_x86_64/include/selva/history.h +49 -0
- package/dist/lib/linux_x86_64/include/selva/hll.h +21 -0
- package/dist/lib/linux_x86_64/include/selva/sort.h +14 -0
- package/dist/lib/linux_x86_64/include/selva/types.h +9 -2
- package/dist/lib/linux_x86_64/include/selva/vector.h +22 -1
- package/dist/lib/linux_x86_64/include/selva/xxhash64.h +23 -0
- 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/src/client/bitWise.js +21 -1
- package/dist/src/client/index.d.ts +11 -5
- package/dist/src/client/index.js +57 -11
- package/dist/src/client/modify/ModifyRes.d.ts +4 -1
- package/dist/src/client/modify/ModifyRes.js +8 -1
- package/dist/src/client/modify/alias.js +3 -3
- package/dist/src/client/modify/binary.js +5 -2
- package/dist/src/client/modify/cardinality.d.ts +4 -0
- package/dist/src/client/modify/cardinality.js +50 -0
- package/dist/src/client/modify/create copy.d.ts +5 -0
- package/dist/src/client/modify/create copy.js +112 -0
- package/dist/src/client/modify/create.d.ts +2 -1
- package/dist/src/client/modify/create.js +11 -7
- package/dist/src/client/modify/delete.d.ts +2 -0
- package/dist/src/client/modify/delete.js +37 -0
- package/dist/src/client/modify/expire.d.ts +3 -0
- package/dist/src/client/modify/expire.js +25 -0
- package/dist/src/client/modify/fixed.js +11 -1
- package/dist/src/client/modify/index.d.ts +1 -1
- package/dist/src/client/modify/index.js +1 -1
- package/dist/src/client/modify/json.d.ts +4 -0
- package/dist/src/client/modify/json.js +5 -0
- package/dist/src/client/modify/modify.js +11 -7
- package/dist/src/client/modify/references/edge.js +21 -6
- package/dist/src/client/modify/references/reference.js +2 -2
- package/dist/src/client/modify/references/references.d.ts +0 -1
- package/dist/src/client/modify/references/references.js +4 -4
- package/dist/src/client/modify/remove.d.ts +1 -2
- package/dist/src/client/modify/remove.js +9 -6
- package/dist/src/client/modify/setCursor.d.ts +1 -1
- package/dist/src/client/modify/setCursor.js +4 -1
- package/dist/src/client/modify/string.js +2 -2
- package/dist/src/client/modify/text.d.ts +2 -1
- package/dist/src/client/modify/text.js +13 -7
- package/dist/src/client/modify/types.d.ts +8 -1
- package/dist/src/client/modify/types.js +1 -0
- package/dist/src/client/modify/update.d.ts +2 -1
- package/dist/src/client/modify/update.js +9 -5
- package/dist/src/client/modify/upsert.d.ts +2 -1
- package/dist/src/client/modify/upsert.js +3 -3
- package/dist/src/client/modify/vector copy.d.ts +4 -0
- package/dist/src/client/modify/vector copy.js +46 -0
- package/dist/src/client/modify/vector.js +6 -4
- package/dist/src/client/query/BasedDbQuery.d.ts +4 -3
- package/dist/src/client/query/BasedDbQuery.js +39 -16
- package/dist/src/client/query/BasedIterable.js +3 -3
- package/dist/src/client/query/filter/FilterBranch.d.ts +2 -2
- package/dist/src/client/query/filter/FilterBranch.js +2 -2
- package/dist/src/client/query/filter/createFixedFilterBuffer.d.ts +3 -2
- package/dist/src/client/query/filter/createFixedFilterBuffer.js +14 -11
- package/dist/src/client/query/filter/createReferenceFilter.d.ts +2 -1
- package/dist/src/client/query/filter/createReferenceFilter.js +6 -5
- package/dist/src/client/query/filter/createVariableFilterBuffer.d.ts +2 -1
- package/dist/src/client/query/filter/createVariableFilterBuffer.js +61 -30
- package/dist/src/client/query/filter/filter.d.ts +2 -2
- package/dist/src/client/query/filter/filter.js +27 -22
- package/dist/src/client/query/filter/parseFilterValue.js +9 -64
- package/dist/src/client/query/filter/primitiveFilter.js +7 -11
- package/dist/src/client/query/filter/toBuffer.js +5 -7
- package/dist/src/client/query/filter/types.d.ts +51 -2
- package/dist/src/client/query/filter/types.js +114 -0
- package/dist/src/client/query/include/props.d.ts +2 -0
- package/dist/src/client/query/include/props.js +25 -6
- package/dist/src/client/query/include/toBuffer.js +21 -1
- package/dist/src/client/query/include/walk.js +17 -2
- package/dist/src/client/query/queryDef.js +1 -0
- package/dist/src/client/query/read/read.js +85 -21
- package/dist/src/client/query/search/index.d.ts +2 -0
- package/dist/src/client/query/search/index.js +79 -23
- package/dist/src/client/query/subscription/index.js +2 -2
- package/dist/src/client/query/subscription/markers.d.ts +1 -1
- package/dist/src/client/query/subscription/markers.js +2 -2
- package/dist/src/client/query/toBuffer.js +0 -4
- package/dist/src/client/query/types.d.ts +10 -0
- package/dist/src/client/query/validation.d.ts +3 -2
- package/dist/src/client/query/validation.js +17 -2
- package/dist/src/client/timestamp.d.ts +1 -0
- package/dist/src/client/timestamp.js +68 -0
- package/dist/src/client/xxHash64.d.ts +1 -0
- package/dist/src/client/xxHash64.js +5 -0
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.js +13 -3
- package/dist/src/native.d.ts +1 -0
- package/dist/src/native.js +4 -1
- package/dist/src/server/csmt/tree.js +12 -2
- package/dist/src/server/index.d.ts +12 -4
- package/dist/src/server/index.js +63 -17
- package/dist/src/server/migrate/index.js +6 -2
- package/dist/src/server/migrate/worker.js +3 -3
- package/dist/src/server/schema/selvaBuffer.js +20 -11
- package/dist/src/server/schema/typeDef.d.ts +2 -2
- package/dist/src/server/schema/typeDef.js +14 -5
- package/dist/src/server/schema/types.d.ts +7 -2
- package/dist/src/server/schema/types.js +6 -3
- package/package.json +1 -1
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { BasedDb } from '../../index.js';
|
|
2
|
-
import { join } from 'path';
|
|
2
|
+
import { dirname, join } from 'path';
|
|
3
3
|
import { tmpdir } from 'os';
|
|
4
4
|
import { Worker, MessageChannel } from 'node:worker_threads';
|
|
5
5
|
import native from '../../native.js';
|
|
6
6
|
import './worker.js';
|
|
7
7
|
import { foreachDirtyBlock } from '../tree.js';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
11
|
+
const workerPath = join(__dirname, 'worker.js');
|
|
8
12
|
let migrationCnt = 0;
|
|
9
13
|
const parseTransform = (transform) => {
|
|
10
14
|
const res = {};
|
|
@@ -45,7 +49,7 @@ export const migrate = async (fromDbServer, toSchema, transform) => {
|
|
|
45
49
|
const toAddress = native.intFromExternal(toCtx);
|
|
46
50
|
const transformFns = parseTransform(transform);
|
|
47
51
|
atomics[0] = 1;
|
|
48
|
-
const worker = new Worker(
|
|
52
|
+
const worker = new Worker(workerPath, {
|
|
49
53
|
workerData: {
|
|
50
54
|
from: fromAddress,
|
|
51
55
|
to: toAddress,
|
|
@@ -52,10 +52,10 @@ else {
|
|
|
52
52
|
continue;
|
|
53
53
|
}
|
|
54
54
|
if (Array.isArray(res)) {
|
|
55
|
-
toDb.create(res[0], res[1] || node, true);
|
|
55
|
+
toDb.create(res[0], res[1] || node, { unsafe: true });
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
|
-
toDb.create(type, res || node, true);
|
|
58
|
+
toDb.create(type, res || node, { unsafe: true });
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -66,7 +66,7 @@ else {
|
|
|
66
66
|
.range(leafData.start - 1, leafData.end - leafData.start + 1)
|
|
67
67
|
._getSync(fromCtx);
|
|
68
68
|
for (const node of nodes) {
|
|
69
|
-
toDb.create(type, node, true);
|
|
69
|
+
toDb.create(type, node, { unsafe: true });
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ALIAS, ALIASES, BINARY, BOOLEAN, CREATED, EMPTY_MICRO_BUFFER, ENUM,
|
|
1
|
+
import { ALIAS, ALIASES, BINARY, BOOLEAN, CREATED, EMPTY_MICRO_BUFFER, ENUM, CARDINALITY, INT16, INT32, INT64, INT8, MICRO_BUFFER, NULL, NUMBER, REFERENCE, REFERENCES, STRING, TEXT, TIMESTAMP, UINT16, UINT32, UINT8, UPDATED, VECTOR, WEAK_REFERENCE, WEAK_REFERENCES, JSON, } from './types.js';
|
|
2
2
|
const selvaTypeMap = [];
|
|
3
3
|
selvaTypeMap[NULL] = 0;
|
|
4
4
|
selvaTypeMap[TIMESTAMP] = 1;
|
|
5
5
|
selvaTypeMap[CREATED] = 1;
|
|
6
6
|
selvaTypeMap[UPDATED] = 1;
|
|
7
7
|
selvaTypeMap[NUMBER] = 4;
|
|
8
|
-
selvaTypeMap[
|
|
8
|
+
selvaTypeMap[CARDINALITY] = 11;
|
|
9
9
|
selvaTypeMap[INT8] = 20;
|
|
10
10
|
selvaTypeMap[UINT8] = 6;
|
|
11
11
|
selvaTypeMap[INT16] = 21;
|
|
@@ -26,9 +26,14 @@ selvaTypeMap[ALIAS] = 18;
|
|
|
26
26
|
selvaTypeMap[ALIASES] = 19;
|
|
27
27
|
selvaTypeMap[BINARY] = 11;
|
|
28
28
|
selvaTypeMap[VECTOR] = 17;
|
|
29
|
+
selvaTypeMap[JSON] = 11;
|
|
30
|
+
const EDGE_FIELD_CONSTRAINT_FLAG_DEPENDENT = 0x01;
|
|
29
31
|
function sepPropCount(props) {
|
|
30
32
|
return props.filter((prop) => prop.separate).length;
|
|
31
33
|
}
|
|
34
|
+
function makeEdgeConstraintFlags(prop) {
|
|
35
|
+
return prop.dependent ? EDGE_FIELD_CONSTRAINT_FLAG_DEPENDENT : 0x00;
|
|
36
|
+
}
|
|
32
37
|
const propDefBuffer = (schema, prop, isEdge) => {
|
|
33
38
|
const type = prop.typeIndex;
|
|
34
39
|
const selvaType = selvaTypeMap[type];
|
|
@@ -39,32 +44,36 @@ const propDefBuffer = (schema, prop, isEdge) => {
|
|
|
39
44
|
return [...buf.values()];
|
|
40
45
|
}
|
|
41
46
|
else if (type === REFERENCE || type === REFERENCES) {
|
|
42
|
-
const buf = Buffer.allocUnsafe(
|
|
47
|
+
const buf = Buffer.allocUnsafe(9);
|
|
43
48
|
const dstType = schema[prop.inverseTypeName];
|
|
44
49
|
let eschema = [];
|
|
45
50
|
// @ts-ignore
|
|
46
|
-
buf[0] = selvaType + 2 * !!isEdge;
|
|
47
|
-
buf
|
|
48
|
-
buf.
|
|
51
|
+
buf[0] = selvaType + 2 * !!isEdge; // field type
|
|
52
|
+
buf[1] = makeEdgeConstraintFlags(prop); // flags
|
|
53
|
+
buf.writeUInt16LE(dstType.id, 2); // dst_node_type
|
|
54
|
+
buf.writeUint32LE(0, 5); // schema_len
|
|
49
55
|
if (!isEdge) {
|
|
50
56
|
prop.inverseTypeId = dstType.id;
|
|
51
57
|
prop.inversePropNumber = dstType.props[prop.inversePropName].prop;
|
|
52
|
-
buf[
|
|
58
|
+
buf[4] = prop.inversePropNumber;
|
|
53
59
|
if (prop.edges) {
|
|
54
60
|
const props = Object.values(prop.edges);
|
|
55
61
|
eschema = props
|
|
56
62
|
.map((prop) => propDefBuffer(schema, prop, true))
|
|
57
63
|
.flat(1);
|
|
58
|
-
eschema.unshift(
|
|
59
|
-
buf.writeUint32LE(eschema.length,
|
|
64
|
+
eschema.unshift(0, 0, 0, 0, sepPropCount(props), 0);
|
|
65
|
+
buf.writeUint32LE(eschema.length, 5);
|
|
60
66
|
}
|
|
61
67
|
}
|
|
62
68
|
return [...buf.values(), ...eschema];
|
|
63
69
|
}
|
|
64
|
-
else if (type === STRING ||
|
|
70
|
+
else if (type === STRING ||
|
|
71
|
+
type === BINARY ||
|
|
72
|
+
type === CARDINALITY ||
|
|
73
|
+
type === JSON) {
|
|
65
74
|
return [selvaType, prop.len < 50 ? prop.len : 0];
|
|
66
75
|
}
|
|
67
|
-
|
|
76
|
+
{
|
|
68
77
|
return [selvaType];
|
|
69
78
|
}
|
|
70
79
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SchemaObject, StrictSchemaType } from '@based/schema';
|
|
1
|
+
import { SchemaObject, StrictSchemaType, SchemaLocales } from '@based/schema';
|
|
2
2
|
import { SchemaTypeDef } from './types.js';
|
|
3
3
|
import { DbClient } from '../../client/index.js';
|
|
4
4
|
import { DbServer } from '../index.js';
|
|
5
5
|
export declare const updateTypeDefs: (db: DbClient | DbServer) => void;
|
|
6
|
-
export declare const createSchemaTypeDef: (typeName: string, type: StrictSchemaType | SchemaObject, parsed: DbClient["schemaTypesParsed"], result?: Partial<SchemaTypeDef>, path?: string[], top?: boolean) => SchemaTypeDef;
|
|
6
|
+
export declare const createSchemaTypeDef: (typeName: string, type: StrictSchemaType | SchemaObject, parsed: DbClient["schemaTypesParsed"], locales: Partial<SchemaLocales>, result?: Partial<SchemaTypeDef>, path?: string[], top?: boolean) => SchemaTypeDef;
|
|
@@ -72,7 +72,9 @@ export const updateTypeDefs = (db) => {
|
|
|
72
72
|
if (!type.id) {
|
|
73
73
|
type.id = genId(db);
|
|
74
74
|
}
|
|
75
|
-
const def = createSchemaTypeDef(field, type, db.schemaTypesParsed
|
|
75
|
+
const def = createSchemaTypeDef(field, type, db.schemaTypesParsed, db.schema.locales ?? {
|
|
76
|
+
en: {},
|
|
77
|
+
});
|
|
76
78
|
def.blockCapacity =
|
|
77
79
|
field === '_root' ? 2147483647 : DEFAULT_BLOCK_CAPACITY; // TODO this should come from somewhere else
|
|
78
80
|
db.schemaTypesParsed[field] = def;
|
|
@@ -80,7 +82,7 @@ export const updateTypeDefs = (db) => {
|
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
};
|
|
83
|
-
export const createSchemaTypeDef = (typeName, type, parsed, result = {
|
|
85
|
+
export const createSchemaTypeDef = (typeName, type, parsed, locales, result = {
|
|
84
86
|
cnt: 0,
|
|
85
87
|
checksum: hashObjectIgnoreKeyOrder(type),
|
|
86
88
|
type: typeName,
|
|
@@ -105,6 +107,7 @@ export const createSchemaTypeDef = (typeName, type, parsed, result = {
|
|
|
105
107
|
throw new Error(`Invalid schema type id ${result.type}`);
|
|
106
108
|
}
|
|
107
109
|
}
|
|
110
|
+
result.locales = locales;
|
|
108
111
|
result.idUint8[0] = result.id & 255;
|
|
109
112
|
result.idUint8[1] = result.id >> 8;
|
|
110
113
|
const encoder = new TextEncoder();
|
|
@@ -115,13 +118,15 @@ export const createSchemaTypeDef = (typeName, type, parsed, result = {
|
|
|
115
118
|
const propPath = [...path, key];
|
|
116
119
|
const propType = getPropType(schemaProp);
|
|
117
120
|
if (propType === 'object') {
|
|
118
|
-
createSchemaTypeDef(typeName, schemaProp, parsed, result, propPath, false);
|
|
121
|
+
createSchemaTypeDef(typeName, schemaProp, parsed, locales, result, propPath, false);
|
|
119
122
|
}
|
|
120
123
|
else {
|
|
121
124
|
let len = SIZE_MAP[propType];
|
|
122
125
|
if (isPropType('string', schemaProp) ||
|
|
123
126
|
isPropType('alias', schemaProp) ||
|
|
124
|
-
isPropType('binary', schemaProp)
|
|
127
|
+
isPropType('binary', schemaProp) ||
|
|
128
|
+
isPropType('cardinality', schemaProp) // TODO: maieutica
|
|
129
|
+
) {
|
|
125
130
|
if (typeof schemaProp === 'object') {
|
|
126
131
|
if (schemaProp.maxBytes < 61) {
|
|
127
132
|
len = schemaProp.maxBytes + 1;
|
|
@@ -137,7 +142,9 @@ export const createSchemaTypeDef = (typeName, type, parsed, result = {
|
|
|
137
142
|
stringFields++;
|
|
138
143
|
}
|
|
139
144
|
}
|
|
140
|
-
else if (isPropType('text', schemaProp)
|
|
145
|
+
else if (isPropType('text', schemaProp) ||
|
|
146
|
+
isPropType('cardinality', schemaProp)) {
|
|
147
|
+
// TODO: maieutica
|
|
141
148
|
stringFields++;
|
|
142
149
|
}
|
|
143
150
|
else if (isPropType('vector', schemaProp)) {
|
|
@@ -166,11 +173,13 @@ export const createSchemaTypeDef = (typeName, type, parsed, result = {
|
|
|
166
173
|
else if (isPropType('references', schemaProp)) {
|
|
167
174
|
prop.inversePropName = schemaProp.items.prop;
|
|
168
175
|
prop.inverseTypeName = schemaProp.items.ref;
|
|
176
|
+
prop.dependent = schemaProp.items.dependent;
|
|
169
177
|
addEdges(prop, schemaProp.items);
|
|
170
178
|
}
|
|
171
179
|
else if (isPropType('reference', schemaProp)) {
|
|
172
180
|
prop.inversePropName = schemaProp.prop;
|
|
173
181
|
prop.inverseTypeName = schemaProp.ref;
|
|
182
|
+
prop.dependent = schemaProp.dependent;
|
|
174
183
|
addEdges(prop, schemaProp);
|
|
175
184
|
}
|
|
176
185
|
else if (typeof schemaProp === 'object') {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { SchemaLocales } from '@based/schema';
|
|
1
2
|
export declare const NULL = 0;
|
|
2
3
|
export declare const TIMESTAMP = 1;
|
|
3
4
|
export declare const CREATED = 2;
|
|
4
5
|
export declare const UPDATED = 3;
|
|
5
6
|
export declare const NUMBER = 4;
|
|
6
|
-
export declare const
|
|
7
|
+
export declare const CARDINALITY = 5;
|
|
7
8
|
export declare const INT8 = 20;
|
|
8
9
|
export declare const UINT8 = 6;
|
|
9
10
|
export declare const INT16 = 21;
|
|
@@ -25,6 +26,7 @@ export declare const ALIASES = 19;
|
|
|
25
26
|
export declare const BINARY = 25;
|
|
26
27
|
export declare const ID = 26;
|
|
27
28
|
export declare const VECTOR = 27;
|
|
29
|
+
export declare const JSON = 28;
|
|
28
30
|
export declare const TYPE_INDEX_MAP: {
|
|
29
31
|
alias: number;
|
|
30
32
|
aliases: number;
|
|
@@ -47,8 +49,9 @@ export declare const TYPE_INDEX_MAP: {
|
|
|
47
49
|
int8: number;
|
|
48
50
|
id: number;
|
|
49
51
|
binary: number;
|
|
50
|
-
hll: number;
|
|
51
52
|
vector: number;
|
|
53
|
+
cardinality: number;
|
|
54
|
+
json: number;
|
|
52
55
|
};
|
|
53
56
|
export type InternalSchemaProp = keyof typeof TYPE_INDEX_MAP;
|
|
54
57
|
export type TypeIndex = (typeof TYPE_INDEX_MAP)[InternalSchemaProp];
|
|
@@ -77,6 +80,7 @@ export type PropDef = {
|
|
|
77
80
|
[prop: string]: PropDefEdge;
|
|
78
81
|
};
|
|
79
82
|
__isEdge?: boolean;
|
|
83
|
+
dependent?: boolean;
|
|
80
84
|
};
|
|
81
85
|
export type PropDefEdge = Partial<PropDef> & {
|
|
82
86
|
__isPropDef: true;
|
|
@@ -120,6 +124,7 @@ export type SchemaTypeDef = {
|
|
|
120
124
|
stringPropsLoop: PropDef[];
|
|
121
125
|
createTs?: PropDef[];
|
|
122
126
|
updateTs?: PropDef[];
|
|
127
|
+
locales: Partial<SchemaLocales>;
|
|
123
128
|
};
|
|
124
129
|
export declare const SIZE_MAP: Record<InternalSchemaProp, number>;
|
|
125
130
|
export declare let REVERSE_SIZE_MAP: Record<TypeIndex, number>;
|
|
@@ -4,7 +4,7 @@ export const TIMESTAMP = 1;
|
|
|
4
4
|
export const CREATED = 2;
|
|
5
5
|
export const UPDATED = 3;
|
|
6
6
|
export const NUMBER = 4;
|
|
7
|
-
export const
|
|
7
|
+
export const CARDINALITY = 5; //se colocar 11 ele faz o console de Ao menos entra aqui?
|
|
8
8
|
export const INT8 = 20;
|
|
9
9
|
export const UINT8 = 6;
|
|
10
10
|
export const INT16 = 21;
|
|
@@ -26,6 +26,7 @@ export const ALIASES = 19;
|
|
|
26
26
|
export const BINARY = 25;
|
|
27
27
|
export const ID = 26;
|
|
28
28
|
export const VECTOR = 27;
|
|
29
|
+
export const JSON = 28;
|
|
29
30
|
export const TYPE_INDEX_MAP = {
|
|
30
31
|
alias: ALIAS,
|
|
31
32
|
aliases: ALIASES,
|
|
@@ -48,8 +49,9 @@ export const TYPE_INDEX_MAP = {
|
|
|
48
49
|
int8: INT8,
|
|
49
50
|
id: NULL,
|
|
50
51
|
binary: BINARY,
|
|
51
|
-
hll: HLL,
|
|
52
52
|
vector: VECTOR,
|
|
53
|
+
cardinality: CARDINALITY,
|
|
54
|
+
json: JSON,
|
|
53
55
|
};
|
|
54
56
|
export const SIZE_MAP = {
|
|
55
57
|
timestamp: 8, // 64bit
|
|
@@ -68,7 +70,7 @@ export const SIZE_MAP = {
|
|
|
68
70
|
enum: 1, // enum
|
|
69
71
|
string: 0, // separate
|
|
70
72
|
text: 0, // separate
|
|
71
|
-
|
|
73
|
+
cardinality: 0, // separate
|
|
72
74
|
references: 0, // separate
|
|
73
75
|
microbuffer: 0, // separate
|
|
74
76
|
alias: 0,
|
|
@@ -76,6 +78,7 @@ export const SIZE_MAP = {
|
|
|
76
78
|
id: 4,
|
|
77
79
|
binary: 0,
|
|
78
80
|
vector: 0, // separate
|
|
81
|
+
json: 0,
|
|
79
82
|
};
|
|
80
83
|
const reverseMap = {};
|
|
81
84
|
for (const k in TYPE_INDEX_MAP) {
|