@powersync/node 0.11.1 → 0.13.0
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 +91 -10
- package/dist/DefaultWorker.cjs +140 -62
- package/dist/DefaultWorker.cjs.map +1 -1
- package/dist/bundle.cjs +31 -13
- package/dist/bundle.cjs.map +1 -1
- package/dist/bundle.d.cts +23 -1
- package/dist/worker.cjs +141 -62
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +9 -1
- package/download_core.js +75 -32
- package/lib/db/AsyncDatabase.d.ts +7 -2
- package/lib/db/BetterSqliteWorker.d.ts +26 -0
- package/lib/db/BetterSqliteWorker.js +58 -0
- package/lib/db/NodeSqliteWorker.d.ts +21 -0
- package/lib/db/NodeSqliteWorker.js +46 -0
- package/lib/db/PowerSyncDatabase.js +2 -2
- package/lib/db/SqliteWorker.d.ts +8 -0
- package/lib/db/SqliteWorker.js +75 -98
- package/lib/db/{BetterSQLite3DBAdapter.d.ts → WorkerConnectionPool.d.ts} +2 -2
- package/lib/db/{BetterSQLite3DBAdapter.js → WorkerConnectionPool.js} +30 -6
- package/lib/db/options.d.ts +23 -1
- package/lib/libpowersync_aarch64.dylib +0 -0
- package/lib/libpowersync_aarch64.so +0 -0
- package/lib/libpowersync_armv7.so +0 -0
- package/lib/libpowersync_riscv64gc.so +0 -0
- package/lib/libpowersync_x64.dylib +0 -0
- package/lib/libpowersync_x86.so +0 -0
- package/lib/powersync_aarch64.dll +0 -0
- package/lib/powersync_x64.dll +0 -0
- package/lib/powersync_x86.dll +0 -0
- package/lib/utils/modules.d.ts +2 -0
- package/lib/utils/modules.js +5 -0
- package/lib/utils/modules_commonjs.d.ts +2 -0
- package/lib/utils/modules_commonjs.js +6 -0
- package/package.json +15 -8
- /package/lib/{libpowersync.so → libpowersync_x64.so} +0 -0
package/lib/db/options.d.ts
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import { type Worker } from 'node:worker_threads';
|
|
2
|
-
import { SQLOpenOptions } from '@powersync/common';
|
|
2
|
+
import { LockContext, SQLOpenOptions } from '@powersync/common';
|
|
3
3
|
export type WorkerOpener = (...args: ConstructorParameters<typeof Worker>) => InstanceType<typeof Worker>;
|
|
4
|
+
/**
|
|
5
|
+
* Use the [better-sqlite3](https://github.com/WiseLibs/better-sqlite3) package as a SQLite driver for PowerSync.
|
|
6
|
+
*/
|
|
7
|
+
export interface BetterSqlite3Options {
|
|
8
|
+
type: 'better-sqlite3';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Use the experimental `node:sqlite` interface as a SQLite driver for PowerSync.
|
|
12
|
+
*
|
|
13
|
+
* Note that this option is not currently tested and highly unstable.
|
|
14
|
+
*/
|
|
15
|
+
export interface NodeSqliteOptions {
|
|
16
|
+
type: 'node:sqlite';
|
|
17
|
+
}
|
|
18
|
+
export type NodeDatabaseImplementation = BetterSqlite3Options | NodeSqliteOptions;
|
|
4
19
|
/**
|
|
5
20
|
* The {@link SQLOpenOptions} available across all PowerSync SDKs for JavaScript extended with
|
|
6
21
|
* Node.JS-specific options.
|
|
7
22
|
*/
|
|
8
23
|
export interface NodeSQLOpenOptions extends SQLOpenOptions {
|
|
24
|
+
implementation?: NodeDatabaseImplementation;
|
|
9
25
|
/**
|
|
10
26
|
* The Node.JS SDK will use one worker to run writing queries and additional workers to run reads.
|
|
11
27
|
* This option controls how many workers to use for reads.
|
|
@@ -19,4 +35,10 @@ export interface NodeSQLOpenOptions extends SQLOpenOptions {
|
|
|
19
35
|
* @returns the resolved worker.
|
|
20
36
|
*/
|
|
21
37
|
openWorker?: WorkerOpener;
|
|
38
|
+
/**
|
|
39
|
+
* Initializes a created database connection.
|
|
40
|
+
*
|
|
41
|
+
* This can be used to e.g. set encryption keys, if an encrypted database should be used.
|
|
42
|
+
*/
|
|
43
|
+
initializeConnection?: (db: LockContext, isWriter: boolean) => Promise<void>;
|
|
22
44
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powersync/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -47,18 +47,25 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://docs.powersync.com/",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@powersync/common": "^1.
|
|
50
|
+
"@powersync/common": "^1.41.0",
|
|
51
|
+
"better-sqlite3": "12.x"
|
|
52
|
+
},
|
|
53
|
+
"peerDependenciesMeta": {
|
|
54
|
+
"better-sqlite3": {
|
|
55
|
+
"optional": true
|
|
56
|
+
}
|
|
51
57
|
},
|
|
52
58
|
"dependencies": {
|
|
53
|
-
"@powersync/better-sqlite3": "^0.2.0",
|
|
54
59
|
"async-lock": "^1.4.0",
|
|
55
60
|
"bson": "^6.6.0",
|
|
56
61
|
"comlink": "^4.4.2",
|
|
57
62
|
"undici": "^7.11.0",
|
|
58
|
-
"@powersync/common": "1.
|
|
63
|
+
"@powersync/common": "1.41.0"
|
|
59
64
|
},
|
|
60
65
|
"devDependencies": {
|
|
61
66
|
"@types/async-lock": "^1.4.0",
|
|
67
|
+
"@types/node": "^24.2.0",
|
|
68
|
+
"better-sqlite3": "^12.2.0",
|
|
62
69
|
"drizzle-orm": "^0.35.2",
|
|
63
70
|
"rollup": "4.14.3",
|
|
64
71
|
"typescript": "^5.5.3",
|
|
@@ -73,12 +80,12 @@
|
|
|
73
80
|
"live data"
|
|
74
81
|
],
|
|
75
82
|
"scripts": {
|
|
76
|
-
"
|
|
77
|
-
"build": "tsc -b && rollup --config",
|
|
78
|
-
"build:prod": "tsc -b --sourceMap false && rollup --config",
|
|
83
|
+
"prepare:core": "node download_core.js",
|
|
84
|
+
"build": " pnpm prepare:core && tsc -b && rollup --config",
|
|
85
|
+
"build:prod": "pnpm prepare:core && tsc -b --sourceMap false && rollup --config",
|
|
79
86
|
"clean": "rm -rf lib dist tsconfig.tsbuildinfo",
|
|
80
87
|
"watch": "tsc -b -w",
|
|
81
|
-
"test": "vitest",
|
|
88
|
+
"test": " pnpm prepare:core && vitest",
|
|
82
89
|
"test:exports": "attw --pack . --ignore-rules no-resolution"
|
|
83
90
|
}
|
|
84
91
|
}
|
|
File without changes
|