@powersync/react-native 2.3.1 → 2.3.2
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,6 +1,6 @@
|
|
|
1
1
|
import { BasePowerSyncDatabaseOptions, CommonPowerSyncDatabase, DatabaseSource, PowerSyncDatabaseConstructor } from '@powersync/common';
|
|
2
2
|
import { ReactNativeRemoteOptions } from '../sync/stream/ReactNativeRemote';
|
|
3
|
-
import { OPSQLiteOpenFactoryOptions } from './adapters/op-sqlite/OPSqliteDBOpenFactory';
|
|
3
|
+
import type { OPSQLiteOpenFactoryOptions } from './adapters/op-sqlite/OPSqliteDBOpenFactory';
|
|
4
4
|
export type ReactNativeDatabaseOptions = BasePowerSyncDatabaseOptions & DatabaseSource<OPSQLiteOpenFactoryOptions> & ReactNativeSpecificOptions;
|
|
5
5
|
export interface ReactNativeSpecificOptions {
|
|
6
6
|
remote?: ReactNativeRemoteOptions;
|
|
@@ -3,7 +3,6 @@ import { BasePowerSyncDatabase, openDatabase } from '@powersync/shared-internals
|
|
|
3
3
|
import { ReactNativeRemote } from '../sync/stream/ReactNativeRemote';
|
|
4
4
|
import { ReactNativeStreamingSyncImplementation } from '../sync/stream/ReactNativeStreamingSyncImplementation';
|
|
5
5
|
import { ReactNativeBucketStorageAdapter } from './../sync/bucket/ReactNativeBucketStorageAdapter';
|
|
6
|
-
import { OPSqliteOpenFactory } from './adapters/op-sqlite/OPSqliteDBOpenFactory';
|
|
7
6
|
import { defaultFetchImplementation } from '../sync/stream/fetch';
|
|
8
7
|
class ReactNativePowerSyncDatabase extends BasePowerSyncDatabase {
|
|
9
8
|
constructor(options) {
|
|
@@ -12,6 +11,10 @@ class ReactNativePowerSyncDatabase extends BasePowerSyncDatabase {
|
|
|
12
11
|
async _initialize() { }
|
|
13
12
|
openDBAdapter() {
|
|
14
13
|
return openDatabase(this.options, (database) => {
|
|
14
|
+
// Lazily require the op-sqlite adapter so that importing this module does not load
|
|
15
|
+
// op-sqlite. This allows custom database factories (e.g. SQL.js in Expo Go) in
|
|
16
|
+
// environments where the op-sqlite native module is not available.
|
|
17
|
+
const { OPSqliteOpenFactory } = require('./adapters/op-sqlite/OPSqliteDBOpenFactory');
|
|
15
18
|
const defaultFactory = new OPSqliteOpenFactory(database);
|
|
16
19
|
return defaultFactory.openDB();
|
|
17
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PowerSyncDatabase.js","sourceRoot":"","sources":["../../src/db/PowerSyncDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,qBAAqB,EAIrB,YAAY,EACb,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAA4B,MAAM,kCAAkC,CAAC;AAC/F,OAAO,EAAE,sCAAsC,EAAE,MAAM,uDAAuD,CAAC;AAC/G,OAAO,EAAE,+BAA+B,EAAE,MAAM,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"file":"PowerSyncDatabase.js","sourceRoot":"","sources":["../../src/db/PowerSyncDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,qBAAqB,EAIrB,YAAY,EACb,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAA4B,MAAM,kCAAkC,CAAC;AAC/F,OAAO,EAAE,sCAAsC,EAAE,MAAM,uDAAuD,CAAC;AAC/G,OAAO,EAAE,+BAA+B,EAAE,MAAM,kDAAkD,CAAC;AAEnG,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAUlE,MAAM,4BAA6B,SAAQ,qBAAiD;IAC1F,YAAY,OAAmC;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,WAAW,KAAmB,CAAC;IAElB,aAAa;QAC9B,OAAO,YAAY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|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
"homepage": "https://docs.powersync.com/",
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@op-engineering/op-sqlite": ">=17.1.0 <19.0.0",
|
|
33
|
-
"@powersync/common": "^2.
|
|
33
|
+
"@powersync/common": "^2.4.0",
|
|
34
34
|
"react": "*",
|
|
35
35
|
"react-native": "*"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@powersync/common": "2.
|
|
39
|
-
"@powersync/react": "2.0
|
|
40
|
-
"@powersync/shared-internals": "1.
|
|
38
|
+
"@powersync/common": "2.4.0",
|
|
39
|
+
"@powersync/react": "2.1.0",
|
|
40
|
+
"@powersync/shared-internals": "1.4.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@op-engineering/op-sqlite": "
|
|
43
|
+
"@op-engineering/op-sqlite": "18.2.0",
|
|
44
44
|
"expo": "^56.0.0",
|
|
45
45
|
"@types/react": "^19.1.1",
|
|
46
46
|
"react": "^19.2.0",
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import { ReactNativeRemote, ReactNativeRemoteOptions } from '../sync/stream/ReactNativeRemote';
|
|
18
18
|
import { ReactNativeStreamingSyncImplementation } from '../sync/stream/ReactNativeStreamingSyncImplementation';
|
|
19
19
|
import { ReactNativeBucketStorageAdapter } from './../sync/bucket/ReactNativeBucketStorageAdapter';
|
|
20
|
-
import {
|
|
20
|
+
import type { OPSQLiteOpenFactoryOptions } from './adapters/op-sqlite/OPSqliteDBOpenFactory';
|
|
21
21
|
import { defaultFetchImplementation } from '../sync/stream/fetch';
|
|
22
22
|
|
|
23
23
|
export type ReactNativeDatabaseOptions = BasePowerSyncDatabaseOptions &
|
|
@@ -37,6 +37,11 @@ class ReactNativePowerSyncDatabase extends BasePowerSyncDatabase<ReactNativeData
|
|
|
37
37
|
|
|
38
38
|
protected override openDBAdapter(): DBAdapter {
|
|
39
39
|
return openDatabase(this.options, (database) => {
|
|
40
|
+
// Lazily require the op-sqlite adapter so that importing this module does not load
|
|
41
|
+
// op-sqlite. This allows custom database factories (e.g. SQL.js in Expo Go) in
|
|
42
|
+
// environments where the op-sqlite native module is not available.
|
|
43
|
+
const { OPSqliteOpenFactory } =
|
|
44
|
+
require('./adapters/op-sqlite/OPSqliteDBOpenFactory') as typeof import('./adapters/op-sqlite/OPSqliteDBOpenFactory');
|
|
40
45
|
const defaultFactory = new OPSqliteOpenFactory(database);
|
|
41
46
|
return defaultFactory.openDB();
|
|
42
47
|
});
|