@powersync/react-native 0.0.0-dev-20250319141441 → 0.0.0-dev-20250416114737

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.
@@ -1,5 +1,5 @@
1
1
  import { BaseObserver, DBAdapter, DBAdapterListener, LockContext as PowerSyncLockContext, Transaction as PowerSyncTransaction, DBLockOptions, QueryResult } from '@powersync/common';
2
- import type { QuickSQLiteConnection, LockContext as RNQSLockContext, TransactionContext as RNQSTransactionContext } from '@journeyapps/react-native-quick-sqlite';
2
+ import type { QuickSQLiteConnection, LockContext as RNQSLockContext } from '@journeyapps/react-native-quick-sqlite';
3
3
  /**
4
4
  * Adapter for React Native Quick SQLite
5
5
  */
@@ -21,15 +21,8 @@ export declare class RNQSDBAdapter extends BaseObserver<DBAdapterListener> imple
21
21
  */
22
22
  executeRaw(query: string, params?: any[]): Promise<any[][]>;
23
23
  executeBatch(query: string, params?: any[][]): Promise<QueryResult>;
24
- generateLockContext(ctx: RNQSLockContext): {
25
- executeRaw: (sql: string, params?: any[]) => Promise<any[]>;
26
- execute: (sql: string, args?: any[]) => Promise<import("@journeyapps/react-native-quick-sqlite").QueryResult>;
27
- };
28
- generateTransactionContext(ctx: RNQSTransactionContext): {
29
- executeRaw: (sql: string, params?: any[]) => Promise<any[]>;
30
- commit: () => Promise<import("@journeyapps/react-native-quick-sqlite").QueryResult>;
31
- rollback: () => Promise<import("@journeyapps/react-native-quick-sqlite").QueryResult>;
32
- execute: (sql: string, args?: any[]) => Promise<import("@journeyapps/react-native-quick-sqlite").QueryResult>;
24
+ generateContext<T extends RNQSLockContext>(ctx: T): T & {
25
+ executeRaw: (sql: string, params?: any[]) => Promise<unknown[][]>;
33
26
  };
34
27
  /**
35
28
  * This provides a top-level read only execute method which is executed inside a read-lock.
@@ -29,16 +29,16 @@ export class RNQSDBAdapter extends BaseObserver {
29
29
  return this.baseDB.close();
30
30
  }
31
31
  readLock(fn, options) {
32
- return this.baseDB.readLock((dbTx) => fn(this.generateDBHelpers(this.generateLockContext(dbTx))), options);
32
+ return this.baseDB.readLock((dbTx) => fn(this.generateDBHelpers(this.generateContext(dbTx))), options);
33
33
  }
34
34
  readTransaction(fn, options) {
35
- return this.baseDB.readTransaction((dbTx) => fn(this.generateDBHelpers(this.generateTransactionContext(dbTx))), options);
35
+ return this.baseDB.readTransaction((dbTx) => fn(this.generateDBHelpers(this.generateContext(dbTx))), options);
36
36
  }
37
37
  writeLock(fn, options) {
38
- return this.baseDB.writeLock((dbTx) => fn(this.generateDBHelpers(this.generateLockContext(dbTx))), options);
38
+ return this.baseDB.writeLock((dbTx) => fn(this.generateDBHelpers(this.generateContext(dbTx))), options);
39
39
  }
40
40
  writeTransaction(fn, options) {
41
- return this.baseDB.writeTransaction((dbTx) => fn(this.generateDBHelpers(this.generateTransactionContext(dbTx))), options);
41
+ return this.baseDB.writeTransaction((dbTx) => fn(this.generateDBHelpers(this.generateContext(dbTx))), options);
42
42
  }
43
43
  execute(query, params) {
44
44
  return this.baseDB.execute(query, params);
@@ -48,7 +48,8 @@ export class RNQSDBAdapter extends BaseObserver {
48
48
  */
49
49
  async executeRaw(query, params) {
50
50
  const result = await this.baseDB.execute(query, params);
51
- return result.rows?._array ?? [];
51
+ const rows = result.rows?._array ?? [];
52
+ return rows.map((row) => Object.values(row));
52
53
  }
53
54
  async executeBatch(query, params = []) {
54
55
  const commands = [];
@@ -60,23 +61,14 @@ export class RNQSDBAdapter extends BaseObserver {
60
61
  rowsAffected: result.rowsAffected ? result.rowsAffected : 0
61
62
  };
62
63
  }
63
- generateLockContext(ctx) {
64
+ generateContext(ctx) {
64
65
  return {
65
66
  ...ctx,
66
67
  // 'executeRaw' is not implemented in RNQS, this falls back to 'execute'.
67
68
  executeRaw: async (sql, params) => {
68
69
  const result = await ctx.execute(sql, params);
69
- return result.rows?._array ?? [];
70
- }
71
- };
72
- }
73
- generateTransactionContext(ctx) {
74
- return {
75
- ...ctx,
76
- // 'executeRaw' is not implemented in RNQS, this falls back to 'execute'.
77
- executeRaw: async (sql, params) => {
78
- const result = await ctx.execute(sql, params);
79
- return result.rows?._array ?? [];
70
+ const rows = result.rows?._array ?? [];
71
+ return rows.map((row) => Object.values(row));
80
72
  }
81
73
  };
82
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/react-native",
3
- "version": "0.0.0-dev-20250319141441",
3
+ "version": "0.0.0-dev-20250416114737",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -25,7 +25,7 @@
25
25
  "homepage": "https://docs.powersync.com/",
26
26
  "peerDependencies": {
27
27
  "@journeyapps/react-native-quick-sqlite": "^2.4.2",
28
- "@powersync/common": "0.0.0-dev-20250319141441",
28
+ "@powersync/common": "0.0.0-dev-20250416114737",
29
29
  "react": "*",
30
30
  "react-native": "*"
31
31
  },
@@ -35,7 +35,7 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@powersync/common": "0.0.0-dev-20250319141441",
38
+ "@powersync/common": "0.0.0-dev-20250416114737",
39
39
  "@powersync/react": "1.5.2"
40
40
  },
41
41
  "devDependencies": {
@@ -51,7 +51,7 @@
51
51
  "@types/async-lock": "^1.4.0",
52
52
  "async-lock": "^1.4.0",
53
53
  "bson": "^6.6.0",
54
- "react": "18.2.0",
54
+ "react": "18.3.1",
55
55
  "react-native": "0.72.4",
56
56
  "react-native-fetch-api": "^3.0.0",
57
57
  "rollup": "4.14.3",