@adecore/database 0.33.3 → 0.34.1

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.
@@ -40,6 +40,7 @@ export const spawnHelper = (path, options = {}) => {
40
40
  const exitListeners = [];
41
41
  let finished = false;
42
42
  let exitCode = null;
43
+ let exitSignal = null;
43
44
  let killed = false;
44
45
  const child = spawn(path, [...(options.args ?? [])], {
45
46
  stdio: ['pipe', 'pipe', 'pipe'],
@@ -53,15 +54,16 @@ export const spawnHelper = (path, options = {}) => {
53
54
  child.stdout.on('data', (chunk) => lines.push(chunk));
54
55
  child.stderr.on('data', (chunk) => logs.push(chunk));
55
56
  child.stdin.on('error', () => { });
56
- const finish = (code) => {
57
+ const finish = (code, signal = null) => {
57
58
  if (finished) {
58
59
  return;
59
60
  }
60
61
  finished = true;
61
62
  exitCode = code;
63
+ exitSignal = signal;
62
64
  lines.flush();
63
65
  logs.flush();
64
- exitListeners.forEach((listener) => listener(code));
66
+ exitListeners.forEach((listener) => listener(code, signal));
65
67
  };
66
68
  child.on('error', (error) => {
67
69
  options.onLog?.(error.message);
@@ -70,7 +72,7 @@ export const spawnHelper = (path, options = {}) => {
70
72
  finish(null);
71
73
  }
72
74
  });
73
- child.on('close', (code) => finish(code));
75
+ child.on('close', (code, signal) => finish(code, signal));
74
76
  return {
75
77
  write(line) {
76
78
  if (!finished && child.stdin.writable) {
@@ -82,7 +84,7 @@ export const spawnHelper = (path, options = {}) => {
82
84
  },
83
85
  onExit(listener) {
84
86
  if (finished) {
85
- queueMicrotask(() => listener(exitCode));
87
+ queueMicrotask(() => listener(exitCode, exitSignal));
86
88
  return;
87
89
  }
88
90
  exitListeners.push(listener);
@@ -2,7 +2,7 @@ import type { ConnectionConfig, DatabaseResponse } from '../protocol/index.ts';
2
2
  export interface HelperProcess {
3
3
  write(line: string): void;
4
4
  onLine(listener: (line: string) => void): void;
5
- onExit(listener: (code: number | null) => void): void;
5
+ onExit(listener: (code: number | null, signal?: string | null) => void): void;
6
6
  kill(): void;
7
7
  }
8
8
  export interface DatabaseHostOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/database",
3
- "version": "0.33.3",
3
+ "version": "0.34.1",
4
4
  "description": "Browse, query and edit SQLite and MySQL databases: React views for the page, a host for the backend and a native helper that talks to the server.",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "author": "Bas Milius",
@@ -50,7 +50,7 @@
50
50
  "build": "bun scripts/build.ts",
51
51
  "typecheck": "tsc --noEmit",
52
52
  "test": "bun test",
53
- "test:dom": "bun test --preload ./src/testing/dom/preload.ts interaction",
53
+ "test:dom": "bun test --preload ../ui/src/file-tree/testing/preload.ts interaction",
54
54
  "helper:build": "cargo build --release --locked --manifest-path helper/Cargo.toml",
55
55
  "helper:check": "cargo fmt --manifest-path helper/Cargo.toml --check && cargo clippy --locked --manifest-path helper/Cargo.toml --all-targets -- -D warnings",
56
56
  "helper:test": "cargo test --locked --manifest-path helper/Cargo.toml"
@@ -61,20 +61,20 @@
61
61
  "lucide-react": "^1.47.0"
62
62
  },
63
63
  "optionalDependencies": {
64
- "@adecore/database-darwin-arm64": "0.33.3",
65
- "@adecore/database-linux-arm64": "0.33.3",
66
- "@adecore/database-linux-x64": "0.33.3",
67
- "@adecore/database-win32-x64": "0.33.3"
64
+ "@adecore/database-darwin-arm64": "0.34.1",
65
+ "@adecore/database-linux-arm64": "0.34.1",
66
+ "@adecore/database-linux-x64": "0.34.1",
67
+ "@adecore/database-win32-x64": "0.34.1"
68
68
  },
69
69
  "peerDependencies": {
70
- "@adecore/ui": "^0.33.3",
70
+ "@adecore/ui": "^0.34.1",
71
71
  "i18next": "^26.4.2",
72
72
  "react": "^19.3.0",
73
73
  "react-dom": "^19.3.0",
74
74
  "react-i18next": "^17.0.15"
75
75
  },
76
76
  "devDependencies": {
77
- "@adecore/ui": "0.33.3",
77
+ "@adecore/ui": "0.34.1",
78
78
  "@happy-dom/global-registrator": "^20.14.5",
79
79
  "@types/bun": "^1.4.2",
80
80
  "@types/node": "^24.13.6",
package/src/host/spawn.ts CHANGED
@@ -53,9 +53,10 @@ const createLineSplitter = (onLine: (line: string) => void) => {
53
53
  /* Runs the helper binary at `path`, speaking one JSON message per line over stdin and stdout. */
54
54
  export const spawnHelper = (path: string, options: SpawnHelperOptions = {}): HelperProcess => {
55
55
  const lineListeners: ((line: string) => void)[] = [];
56
- const exitListeners: ((code: number | null) => void)[] = [];
56
+ const exitListeners: ((code: number | null, signal: string | null) => void)[] = [];
57
57
  let finished = false;
58
58
  let exitCode: number | null = null;
59
+ let exitSignal: string | null = null;
59
60
  let killed = false;
60
61
 
61
62
  const child = spawn(path, [...(options.args ?? [])], {
@@ -73,16 +74,17 @@ export const spawnHelper = (path: string, options: SpawnHelperOptions = {}): Hel
73
74
  child.stderr.on('data', (chunk: string) => logs.push(chunk));
74
75
  child.stdin.on('error', () => {});
75
76
 
76
- const finish = (code: number | null): void => {
77
+ const finish = (code: number | null, signal: string | null = null): void => {
77
78
  if (finished) {
78
79
  return;
79
80
  }
80
81
 
81
82
  finished = true;
82
83
  exitCode = code;
84
+ exitSignal = signal;
83
85
  lines.flush();
84
86
  logs.flush();
85
- exitListeners.forEach((listener) => listener(code));
87
+ exitListeners.forEach((listener) => listener(code, signal));
86
88
  };
87
89
 
88
90
  child.on('error', (error) => {
@@ -93,7 +95,7 @@ export const spawnHelper = (path: string, options: SpawnHelperOptions = {}): Hel
93
95
  finish(null);
94
96
  }
95
97
  });
96
- child.on('close', (code) => finish(code));
98
+ child.on('close', (code, signal) => finish(code, signal));
97
99
 
98
100
  return {
99
101
  write(line: string): void {
@@ -106,7 +108,7 @@ export const spawnHelper = (path: string, options: SpawnHelperOptions = {}): Hel
106
108
  },
107
109
  onExit(listener): void {
108
110
  if (finished) {
109
- queueMicrotask(() => listener(exitCode));
111
+ queueMicrotask(() => listener(exitCode, exitSignal));
110
112
  return;
111
113
  }
112
114
 
package/src/host/types.ts CHANGED
@@ -5,7 +5,7 @@ export interface HelperProcess {
5
5
  /* One message, without its line break. */
6
6
  write(line: string): void;
7
7
  onLine(listener: (line: string) => void): void;
8
- onExit(listener: (code: number | null) => void): void;
8
+ onExit(listener: (code: number | null, signal?: string | null) => void): void;
9
9
  kill(): void;
10
10
  }
11
11