@based/db 0.0.41 → 0.0.42
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-v20.node +0 -0
- package/dist/lib/darwin_aarch64/libnode-v21.node +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/libselva.dylib +0 -0
- package/dist/lib/linux_aarch64/libnode-v20.node +0 -0
- package/dist/lib/linux_aarch64/libnode-v21.node +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/libselva.so +0 -0
- package/dist/lib/linux_x86_64/libnode-v20.node +0 -0
- package/dist/lib/linux_x86_64/libnode-v21.node +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/libselva.so +0 -0
- package/dist/src/client/modify/references/appendEdgeRefs.d.ts +3 -3
- package/dist/src/client/modify/references/appendEdgeRefs.js +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/server/index.d.ts +4 -0
- package/dist/src/server/index.js +3 -0
- package/dist/src/server/start.js +1 -1
- package/dist/src/utils.js +1 -1
- 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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropDefEdge } from '@based/schema/def';
|
|
2
|
-
import { ModifyCtx } from '../../flushModify.js';
|
|
3
|
-
import { ModifyErr } from '../types.js';
|
|
1
|
+
import type { PropDefEdge } from '@based/schema/def';
|
|
2
|
+
import type { ModifyCtx } from '../../flushModify.js';
|
|
3
|
+
import type { ModifyErr } from '../types.js';
|
|
4
4
|
export declare function appendEdgeRefs(t: PropDefEdge, ctx: ModifyCtx, value: any[]): ModifyErr;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { ModifyCtx };
|
|
|
8
8
|
export { DbClient, DbServer };
|
|
9
9
|
export { xxHash64 } from './client/xxHash64.js';
|
|
10
10
|
export { crc32 } from './client/crc32.js';
|
|
11
|
+
export { default as createHash } from './server/dbHash.js';
|
|
11
12
|
export * from './client/query/serialize.js';
|
|
12
13
|
export * from './utils.js';
|
|
13
14
|
export * from './client/query/query.js';
|
package/dist/src/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { ModifyCtx }; // TODO move this somewhere
|
|
|
11
11
|
export { DbClient, DbServer };
|
|
12
12
|
export { xxHash64 } from './client/xxHash64.js';
|
|
13
13
|
export { crc32 } from './client/crc32.js';
|
|
14
|
+
export { default as createHash } from './server/dbHash.js';
|
|
14
15
|
export * from './client/query/serialize.js';
|
|
15
16
|
export * from './utils.js';
|
|
16
17
|
export * from './client/query/query.js';
|
|
@@ -30,6 +30,7 @@ export declare class DbServer {
|
|
|
30
30
|
dbCtxExternal: any;
|
|
31
31
|
schema: StrictSchema & {
|
|
32
32
|
lastId: number;
|
|
33
|
+
hash?: number;
|
|
33
34
|
};
|
|
34
35
|
migrating: number;
|
|
35
36
|
schemaTypesParsed: SchemaTypesParsed;
|
|
@@ -88,12 +89,15 @@ export declare class DbServer {
|
|
|
88
89
|
getSortIndex(typeId: number, field: number, start: number, lang: number): SortIndex;
|
|
89
90
|
migrateSchema(schema: StrictSchema, transform?: Record<string, (node: Record<string, any>) => Record<string, any> | [string, Record<string, any>]>): Promise<StrictSchema & {
|
|
90
91
|
lastId: number;
|
|
92
|
+
hash?: number;
|
|
91
93
|
}>;
|
|
92
94
|
createSortIndexBuffer(typeId: number, field: number, start: number, lang: number): SortIndex;
|
|
93
95
|
setSchema(strictSchema: StrictSchema, fromStart?: boolean, transformFns?: TransformFns): (StrictSchema & {
|
|
94
96
|
lastId: number;
|
|
97
|
+
hash?: number;
|
|
95
98
|
}) | Promise<StrictSchema & {
|
|
96
99
|
lastId: number;
|
|
100
|
+
hash?: number;
|
|
97
101
|
}>;
|
|
98
102
|
modify(buf: Uint8Array): Record<number, number>;
|
|
99
103
|
addToQueryQueue(resolve: any, buf: any): void;
|
package/dist/src/server/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
12
12
|
import { setTimeout } from 'node:timers/promises';
|
|
13
13
|
import { migrate } from './migrate/index.js';
|
|
14
14
|
import { debugServer, schemaLooseEqual } from '../utils.js';
|
|
15
|
+
import { hash } from '@saulx/hash';
|
|
15
16
|
export const SCHEMA_FILE = 'schema.json';
|
|
16
17
|
export const WRITELOG_FILE = 'writelog.json';
|
|
17
18
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -339,6 +340,8 @@ export class DbServer {
|
|
|
339
340
|
}
|
|
340
341
|
}
|
|
341
342
|
updateTypeDefs(this.schema, this.schemaTypesParsed, this.schemaTypesParsedById);
|
|
343
|
+
const { hash: _, ...schemaWithoutHash } = this.schema;
|
|
344
|
+
this.schema.hash = hash(schemaWithoutHash);
|
|
342
345
|
if (!fromStart) {
|
|
343
346
|
writeFile(join(this.fileSystemPath, SCHEMA_FILE), JSON.stringify(this.schema)).catch((err) => console.error('!!!', SCHEMA_FILE, err));
|
|
344
347
|
let types = Object.keys(this.schemaTypesParsed);
|
package/dist/src/server/start.js
CHANGED
|
@@ -47,7 +47,7 @@ export async function start(db, opts) {
|
|
|
47
47
|
const schema = await readFile(join(path, SCHEMA_FILE));
|
|
48
48
|
if (schema) {
|
|
49
49
|
// Prop need to not call setting in selva
|
|
50
|
-
db.setSchema(JSON.parse(schema.toString()), true);
|
|
50
|
+
await db.setSchema(JSON.parse(schema.toString()), true);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
catch (err) {
|
package/dist/src/utils.js
CHANGED
|
@@ -43,7 +43,7 @@ export const debugMode = (target, getInfo = null) => {
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
export const debugServer = (server) => debugMode(server, () => `p: ${server.processingQueries} m: ${server.modifyQueue.length} q: ${server.queryQueue.size}`);
|
|
46
|
-
const exclude = new Set(['id', 'lastId']);
|
|
46
|
+
const exclude = new Set(['id', 'lastId', 'hash']);
|
|
47
47
|
export const schemaLooseEqual = (a, b, key) => {
|
|
48
48
|
if (a === b) {
|
|
49
49
|
return true;
|