@powersync/node 0.0.0-dev-20250318143512 → 0.0.0-dev-20250319141441

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,6 +10,7 @@ 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[][]>;
13
14
  executeBatch: (query: string, params: any[][]) => Promise<ProxiedQueryResult>;
14
15
  close: () => Promise<void>;
15
16
  collectCommittedUpdates: () => Promise<string[]>;
@@ -25,6 +25,7 @@ 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[][]>;
28
29
  executeBatch(query: string, params?: any[][]): Promise<QueryResult>;
29
30
  refreshSchema(): Promise<void>;
30
31
  }
@@ -26,7 +26,9 @@ 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), { name: isWriter ? `write ${dbFilePath}` : `read ${dbFilePath}` });
29
+ const worker = new Worker(new URL('./SqliteWorker.js', import.meta.url), {
30
+ name: isWriter ? `write ${dbFilePath}` : `read ${dbFilePath}`
31
+ });
30
32
  const listeners = new WeakMap();
31
33
  const comlink = Comlink.wrap({
32
34
  postMessage: worker.postMessage.bind(worker),
@@ -166,6 +168,7 @@ export class BetterSQLite3DBAdapter extends BaseObserver {
166
168
  await connection.execute('BEGIN');
167
169
  const result = await fn({
168
170
  execute: (query, params) => connection.execute(query, params),
171
+ executeRaw: (query, params) => connection.executeRaw(query, params),
169
172
  executeBatch: (query, params) => connection.executeBatch(query, params),
170
173
  get: (query, params) => connection.get(query, params),
171
174
  getAll: (query, params) => connection.getAll(query, params),
@@ -199,6 +202,9 @@ export class BetterSQLite3DBAdapter extends BaseObserver {
199
202
  execute(query, params) {
200
203
  return this.writeLock((ctx) => ctx.execute(query, params));
201
204
  }
205
+ executeRaw(query, params) {
206
+ return this.writeLock((ctx) => ctx.executeRaw(query, params));
207
+ }
202
208
  executeBatch(query, params) {
203
209
  return this.writeTransaction((ctx) => ctx.executeBatch(query, params));
204
210
  }
@@ -13,6 +13,7 @@ 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[][]>;
16
17
  getAll<T>(sql: string, parameters?: any[]): Promise<T[]>;
17
18
  getOptional<T>(sql: string, parameters?: any[]): Promise<T | null>;
18
19
  get<T>(sql: string, parameters?: any[]): Promise<T>;
@@ -20,6 +20,9 @@ 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
+ }
23
26
  async getAll(sql, parameters) {
24
27
  const res = await this.execute(sql, parameters);
25
28
  return res.rows?._array ?? [];
@@ -54,6 +54,16 @@ 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
+ }
57
67
  async executeBatch(query, params) {
58
68
  params = params ?? [];
59
69
  let rowsAffected = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/node",
3
- "version": "0.0.0-dev-20250318143512",
3
+ "version": "0.0.0-dev-20250319141441",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -26,19 +26,21 @@
26
26
  },
27
27
  "homepage": "https://docs.powersync.com/",
28
28
  "peerDependencies": {
29
- "@powersync/common": "^1.22.0",
29
+ "@powersync/common": "0.0.0-dev-20250319141441",
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": "1.25.0"
36
+ "@powersync/common": "0.0.0-dev-20250319141441"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/async-lock": "^1.4.0",
40
+ "drizzle-orm": "^0.35.2",
40
41
  "typescript": "^5.5.3",
41
- "vitest": "^3.0.5"
42
+ "vitest": "^3.0.5",
43
+ "@powersync/drizzle-driver": "0.0.0-dev-20250319141441"
42
44
  },
43
45
  "keywords": [
44
46
  "data sync",