@powersync/node 0.0.0-dev-20250319141441 → 0.1.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.
|
@@ -10,7 +10,6 @@ export interface AsyncDatabaseOpener {
|
|
|
10
10
|
}
|
|
11
11
|
export interface AsyncDatabase {
|
|
12
12
|
execute: (query: string, params: any[]) => Promise<ProxiedQueryResult>;
|
|
13
|
-
executeRaw: (query: string, params: any[]) => Promise<any[][]>;
|
|
14
13
|
executeBatch: (query: string, params: any[][]) => Promise<ProxiedQueryResult>;
|
|
15
14
|
close: () => Promise<void>;
|
|
16
15
|
collectCommittedUpdates: () => Promise<string[]>;
|
|
@@ -25,7 +25,6 @@ export declare class BetterSQLite3DBAdapter extends BaseObserver<DBAdapterListen
|
|
|
25
25
|
getOptional<T>(sql: string, parameters?: any[]): Promise<T | null>;
|
|
26
26
|
get<T>(sql: string, parameters?: any[]): Promise<T>;
|
|
27
27
|
execute(query: string, params?: any[] | undefined): Promise<QueryResult>;
|
|
28
|
-
executeRaw(query: string, params?: any[] | undefined): Promise<any[][]>;
|
|
29
28
|
executeBatch(query: string, params?: any[][]): Promise<QueryResult>;
|
|
30
29
|
refreshSchema(): Promise<void>;
|
|
31
30
|
}
|
|
@@ -26,9 +26,7 @@ export class BetterSQLite3DBAdapter extends BaseObserver {
|
|
|
26
26
|
dbFilePath = path.join(this.options.dbLocation, dbFilePath);
|
|
27
27
|
}
|
|
28
28
|
const openWorker = async (isWriter) => {
|
|
29
|
-
const worker = new Worker(new URL('./SqliteWorker.js', import.meta.url), {
|
|
30
|
-
name: isWriter ? `write ${dbFilePath}` : `read ${dbFilePath}`
|
|
31
|
-
});
|
|
29
|
+
const worker = new Worker(new URL('./SqliteWorker.js', import.meta.url), { name: isWriter ? `write ${dbFilePath}` : `read ${dbFilePath}` });
|
|
32
30
|
const listeners = new WeakMap();
|
|
33
31
|
const comlink = Comlink.wrap({
|
|
34
32
|
postMessage: worker.postMessage.bind(worker),
|
|
@@ -168,7 +166,6 @@ export class BetterSQLite3DBAdapter extends BaseObserver {
|
|
|
168
166
|
await connection.execute('BEGIN');
|
|
169
167
|
const result = await fn({
|
|
170
168
|
execute: (query, params) => connection.execute(query, params),
|
|
171
|
-
executeRaw: (query, params) => connection.executeRaw(query, params),
|
|
172
169
|
executeBatch: (query, params) => connection.executeBatch(query, params),
|
|
173
170
|
get: (query, params) => connection.get(query, params),
|
|
174
171
|
getAll: (query, params) => connection.getAll(query, params),
|
|
@@ -202,9 +199,6 @@ export class BetterSQLite3DBAdapter extends BaseObserver {
|
|
|
202
199
|
execute(query, params) {
|
|
203
200
|
return this.writeLock((ctx) => ctx.execute(query, params));
|
|
204
201
|
}
|
|
205
|
-
executeRaw(query, params) {
|
|
206
|
-
return this.writeLock((ctx) => ctx.executeRaw(query, params));
|
|
207
|
-
}
|
|
208
202
|
executeBatch(query, params) {
|
|
209
203
|
return this.writeTransaction((ctx) => ctx.executeBatch(query, params));
|
|
210
204
|
}
|
|
@@ -13,7 +13,6 @@ export declare class RemoteConnection implements LockContext {
|
|
|
13
13
|
constructor(worker: Worker, comlink: Remote<AsyncDatabaseOpener>, database: Remote<AsyncDatabase>);
|
|
14
14
|
executeBatch(query: string, params?: any[][]): Promise<QueryResult>;
|
|
15
15
|
execute(query: string, params?: any[] | undefined): Promise<QueryResult>;
|
|
16
|
-
executeRaw(query: string, params?: any[] | undefined): Promise<any[][]>;
|
|
17
16
|
getAll<T>(sql: string, parameters?: any[]): Promise<T[]>;
|
|
18
17
|
getOptional<T>(sql: string, parameters?: any[]): Promise<T | null>;
|
|
19
18
|
get<T>(sql: string, parameters?: any[]): Promise<T>;
|
|
@@ -20,9 +20,6 @@ export class RemoteConnection {
|
|
|
20
20
|
const result = await this.database.execute(query, params ?? []);
|
|
21
21
|
return RemoteConnection.wrapQueryResult(result);
|
|
22
22
|
}
|
|
23
|
-
async executeRaw(query, params) {
|
|
24
|
-
return await this.database.executeRaw(query, params ?? []);
|
|
25
|
-
}
|
|
26
23
|
async getAll(sql, parameters) {
|
|
27
24
|
const res = await this.execute(sql, parameters);
|
|
28
25
|
return res.rows?._array ?? [];
|
package/lib/db/SqliteWorker.js
CHANGED
|
@@ -54,16 +54,6 @@ class BlockingAsyncDatabase {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
async executeRaw(query, params) {
|
|
58
|
-
const stmt = this.db.prepare(query);
|
|
59
|
-
if (stmt.reader) {
|
|
60
|
-
return stmt.raw().all(params);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
stmt.raw().run(params);
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
57
|
async executeBatch(query, params) {
|
|
68
58
|
params = params ?? [];
|
|
69
59
|
let rowsAffected = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powersync/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -26,21 +26,19 @@
|
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://docs.powersync.com/",
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@powersync/common": "
|
|
29
|
+
"@powersync/common": "^1.22.0",
|
|
30
30
|
"@powersync/better-sqlite3": "^0.1.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"async-lock": "^1.4.0",
|
|
34
34
|
"bson": "^6.6.0",
|
|
35
35
|
"comlink": "^4.4.2",
|
|
36
|
-
"@powersync/common": "
|
|
36
|
+
"@powersync/common": "1.25.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/async-lock": "^1.4.0",
|
|
40
|
-
"drizzle-orm": "^0.35.2",
|
|
41
40
|
"typescript": "^5.5.3",
|
|
42
|
-
"vitest": "^3.0.5"
|
|
43
|
-
"@powersync/drizzle-driver": "0.0.0-dev-20250319141441"
|
|
41
|
+
"vitest": "^3.0.5"
|
|
44
42
|
},
|
|
45
43
|
"keywords": [
|
|
46
44
|
"data sync",
|