@based/db 0.2.9 → 0.2.11

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.
Binary file
Binary file
@@ -5,4 +5,4 @@ export type MigrateRange = {
5
5
  start: number;
6
6
  end: number;
7
7
  };
8
- export declare const migrate: (server: DbServer, fromSchema: DbSchema, toSchema: DbSchema, transform?: MigrateFns) => Promise<void>;
8
+ export declare const migrate: (server: DbServer, fromSchema: DbSchema, toSchema: DbSchema, transform?: MigrateFns) => Promise<true | void>;
@@ -80,7 +80,7 @@ export const migrate = async (server, fromSchema, toSchema, transform) => {
80
80
  return newMigrationInProgress;
81
81
  };
82
82
  const tmpDb = new BasedDb({
83
- path: null,
83
+ path: null, //join(tmpdir(), String(Math.random())),
84
84
  });
85
85
  await tmpDb.start({
86
86
  clean: true,
@@ -198,11 +198,12 @@ export const migrate = async (server, fromSchema, toSchema, transform) => {
198
198
  tmpDb.server.dbCtxExternal = fromCtx;
199
199
  // TODO makes this SYNC
200
200
  const promises = [server.ioWorker, ...server.workers].map((worker) => worker.updateCtx(toAddress));
201
- promises.push(tmpDb.destroy(), worker.terminate());
201
+ promises.push(worker.terminate());
202
202
  await Promise.all(promises);
203
203
  if (abort()) {
204
204
  return;
205
205
  }
206
+ tmpDb.destroy();
206
207
  native.membarSyncRead();
207
208
  await save(server, {
208
209
  forceFullDump: true,
@@ -212,5 +213,6 @@ export const migrate = async (server, fromSchema, toSchema, transform) => {
212
213
  await writeSchemaFile(server, toSchema);
213
214
  server.migrating = 0;
214
215
  process.nextTick(() => server.emit('schema', server.schema));
216
+ return true;
215
217
  };
216
218
  //# sourceMappingURL=index.js.map
@@ -110,6 +110,7 @@ export async function save(db, opts = {}) {
110
110
  let err;
111
111
  err = native.saveCommon(join(db.fileSystemPath, COMMON_SDB_FILE), db.dbCtxExternal);
112
112
  if (err) {
113
+ console.log({ err });
113
114
  db.emit('error', `Save common failed: ${err}`);
114
115
  // Return ?
115
116
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@based/db",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "type": "module",
5
5
  "main": "./dist/src/index.js",
6
6
  "scripts": {
@@ -23,6 +23,7 @@
23
23
  "test-fast-linux_aarch64": "podman run -t --rm -v \"$PWD/../..:/usr/src/based-db\" based-db-clibs-build-linux_aarch64 sh -c '\\. \"/usr/local/nvm/nvm.sh\"; cd /usr/src/based-db/packages/db; npm run test-fast'",
24
24
  "test-fast-linux_aarch64-gdb": "podman run -t --rm -v \"$PWD/../..:/usr/src/based-db\" based-db-clibs-build-linux_aarch64 sh -c '\\. \"/usr/local/nvm/nvm.sh\"; cd /usr/src/based-db/packages/db; LOCPATH=../locale/locale-x86_64-gnu/locale gdb -ex run --args node ./scripts/test.js'",
25
25
  "test-fast-linux_aarch64-valgrind": "podman run -t --rm -v \"$PWD/../..:/usr/src/based-db\" based-db-clibs-build-linux_aarch64 sh -c '\\. \"/usr/local/nvm/nvm.sh\"; cd /usr/src/based-db/packages/db; LOCPATH=../locale/locale-aarch64-gnu/locale valgrind --leak-check=full node ./scripts/test.js'",
26
+ "test-fast-linux_aarch64-valgrind-subs": "podman run -t --rm -v \"$PWD/../..:/usr/src/based-db\" based-db-clibs-build-linux_aarch64 sh -c '\\. \"/usr/local/nvm/nvm.sh\"; cd /usr/src/based-db/packages/db; LOCPATH=../locale/locale-aarch64-gnu/locale valgrind --leak-check=full node ./scripts/test.js subscription/subscription.js'",
26
27
  "test-vector": "podman run --rm -v \"$PWD/../..:/usr/src/based-db\" based-db-clibs-build-linux_aarch64 sh -c '\\. \"/usr/local/nvm/nvm.sh\"; cd /usr/src/based-db/packages/db; npm run test-fast -- mem.js'",
27
28
  "test-zig": "npm run build-zig && tsc && npm run test-fast",
28
29
  "test-zig-debug": "npm run build-zig -- debug && tsc && LOCPATH=../locale/locale-x86_64-gnu/locale ./scripts/lldb-node ./scripts/test.js",
@@ -44,7 +45,7 @@
44
45
  "@based/hash": "1.1.0",
45
46
  "@based/schema": "5.1.4",
46
47
  "@based/utils": "1.2.0",
47
- "@based/protocol": "0.1.4",
48
+ "@based/protocol": "0.1.5",
48
49
  "exit-hook": "^4.0.0"
49
50
  },
50
51
  "optionalDependencies": {