@powersync/react-native 2.1.0 → 2.2.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.
- package/README.md +1 -1
- package/android/build.gradle +9 -2
- package/ios/Package.swift +30 -0
- package/ios/swiftpm/empty.swift +2 -0
- package/lib/db/PowerSyncDatabase.js +2 -9
- package/lib/db/PowerSyncDatabase.js.map +1 -1
- package/package.json +9 -8
- package/powersync-react-native.podspec +2 -1
- package/react-native.config.js +13 -0
- package/src/db/PowerSyncDatabase.ts +2 -9
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# PowerSync SDK for React Native
|
|
6
6
|
|
|
7
|
-
_[PowerSync](https://www.powersync.com)
|
|
7
|
+
_[PowerSync](https://www.powersync.com) keeps a client-side SQLite database in sync with your backend database. Changes appear across users and devices in real-time, user interactions feel instant and your app continues to work even when offline. Supports Postgres, MongoDB, MySQL, and SQL Server. Client SDKs are available for a wide range of environments including web, mobile, desktop, headless and embedded._
|
|
8
8
|
|
|
9
9
|
This package (`packages/react-native`) is the PowerSync SDK for React Native clients. It is an extension of `packages/common`.
|
|
10
10
|
|
package/android/build.gradle
CHANGED
|
@@ -15,7 +15,14 @@ buildscript {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
apply plugin: "com.android.library"
|
|
18
|
-
|
|
18
|
+
// AGP 9 ships built-in Kotlin support and registers the `kotlin` extension
|
|
19
|
+
// itself. Applying the Kotlin plugin on top of it fails configuration with
|
|
20
|
+
// "Cannot add extension with name 'kotlin'". Only apply it when nothing has
|
|
21
|
+
// registered that extension yet.
|
|
22
|
+
if (project.extensions.findByName('kotlin') == null) {
|
|
23
|
+
apply plugin: "kotlin-android"
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
apply plugin: "com.facebook.react"
|
|
20
27
|
|
|
21
28
|
def getExtOrDefault(name) {
|
|
@@ -81,7 +88,7 @@ repositories {
|
|
|
81
88
|
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
82
89
|
|
|
83
90
|
dependencies {
|
|
84
|
-
implementation 'com.powersync:powersync-sqlite-core:0.5.
|
|
91
|
+
implementation 'com.powersync:powersync-sqlite-core:0.5.3'
|
|
85
92
|
// For < 0.71, this will be from the local maven repo
|
|
86
93
|
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
87
94
|
//noinspection GradleDynamicVersion
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// swift-tools-version: 6.0
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
// When updating this, also update the version in powersync-react-native.podspec and android/build.gradle
|
|
5
|
+
let coreExtensionVersion: Version = "0.5.3"
|
|
6
|
+
|
|
7
|
+
let packageName = "PowerSyncReactNative"
|
|
8
|
+
|
|
9
|
+
let package = Package(
|
|
10
|
+
name: packageName,
|
|
11
|
+
platforms: [.iOS(.v15)],
|
|
12
|
+
products: [
|
|
13
|
+
.library(name: packageName, targets: [packageName])
|
|
14
|
+
],
|
|
15
|
+
dependencies: [
|
|
16
|
+
.package(
|
|
17
|
+
url: "https://github.com/powersync-ja/powersync-sqlite-core-swift.git",
|
|
18
|
+
exact: coreExtensionVersion
|
|
19
|
+
)
|
|
20
|
+
],
|
|
21
|
+
targets: [
|
|
22
|
+
.target(
|
|
23
|
+
name: packageName,
|
|
24
|
+
dependencies: [
|
|
25
|
+
.product(name: "PowerSyncSQLiteCore", package: "powersync-sqlite-core-swift")
|
|
26
|
+
],
|
|
27
|
+
path: "swiftpm"
|
|
28
|
+
)
|
|
29
|
+
],
|
|
30
|
+
)
|
|
@@ -22,15 +22,8 @@ class ReactNativePowerSyncDatabase extends BasePowerSyncDatabase {
|
|
|
22
22
|
generateSyncStreamImplementation(connector, options) {
|
|
23
23
|
const remote = new ReactNativeRemote(connector, this.logger, this.options.remote);
|
|
24
24
|
return new ReactNativeStreamingSyncImplementation({
|
|
25
|
-
...options,
|
|
26
|
-
|
|
27
|
-
remote,
|
|
28
|
-
uploadCrud: async () => {
|
|
29
|
-
await this.waitForReady();
|
|
30
|
-
await connector.uploadData(this);
|
|
31
|
-
},
|
|
32
|
-
identifier: this.database.name,
|
|
33
|
-
logger: this.logger
|
|
25
|
+
...this.commonSyncOptions(connector, options),
|
|
26
|
+
remote
|
|
34
27
|
});
|
|
35
28
|
}
|
|
36
29
|
get defaultConnectionMethod() {
|
|
@@ -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;AACnG,OAAO,EAAE,mBAAmB,EAA8B,MAAM,4CAA4C,CAAC;AAC7G,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,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE;YAC7C,MAAM,cAAc,GAAG,IAAI,mBAAmB,CAAC,QAAQ,CAAC,CAAC;YACzD,OAAO,cAAc,CAAC,MAAM,EAAE,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;IAES,4BAA4B;QACpC,OAAO,IAAI,+BAA+B,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC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wC;QAExC,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAElF,OAAO,IAAI,sCAAsC,CAAC;YAChD,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC;YAC7C,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED,IAAc,uBAAuB;QACnC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,mBAAmB,IAAI,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClG,OAAO,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC,CAAC,0BAA0B,CAAC,UAAU,CAAC;IACzG,CAAC;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA6D,4BAA4B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powersync/react-native",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"src",
|
|
16
16
|
"android",
|
|
17
17
|
"ios",
|
|
18
|
-
"*.podspec"
|
|
18
|
+
"*.podspec",
|
|
19
|
+
"react-native.config.js"
|
|
19
20
|
],
|
|
20
21
|
"repository": {
|
|
21
22
|
"type": "git",
|
|
@@ -28,18 +29,18 @@
|
|
|
28
29
|
},
|
|
29
30
|
"homepage": "https://docs.powersync.com/",
|
|
30
31
|
"peerDependencies": {
|
|
31
|
-
"@op-engineering/op-sqlite": "
|
|
32
|
-
"@powersync/common": "^2.1
|
|
32
|
+
"@op-engineering/op-sqlite": ">=17.1.0 <19.0.0",
|
|
33
|
+
"@powersync/common": "^2.2.1",
|
|
33
34
|
"react": "*",
|
|
34
35
|
"react-native": "*"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@powersync/common": "2.1
|
|
38
|
-
"@powersync/react": "2.0.
|
|
39
|
-
"@powersync/shared-internals": "1.
|
|
38
|
+
"@powersync/common": "2.2.1",
|
|
39
|
+
"@powersync/react": "2.0.1",
|
|
40
|
+
"@powersync/shared-internals": "1.2.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"@op-engineering/op-sqlite": "^
|
|
43
|
+
"@op-engineering/op-sqlite": "^18.2.0",
|
|
43
44
|
"expo": "^56.0.0",
|
|
44
45
|
"@types/react": "^19.1.1",
|
|
45
46
|
"react": "^19.2.0",
|
|
@@ -23,7 +23,8 @@ Pod::Spec.new do |s|
|
|
|
23
23
|
|
|
24
24
|
s.dependency "React-callinvoker"
|
|
25
25
|
s.dependency "React"
|
|
26
|
-
|
|
26
|
+
# When updating this, also update the version in Package.swift and android/build.gradle
|
|
27
|
+
s.dependency "powersync-sqlite-core", "~> 0.5.3"
|
|
27
28
|
if defined?(install_modules_dependencies())
|
|
28
29
|
install_modules_dependencies(s)
|
|
29
30
|
else
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Hack: @react-native-community/cli reads this file with import(), while react-native/scripts/spm/expand-spm-dependencies.js
|
|
2
|
+
// reads it using require(). Both are able to read this file, but in the require case we need to return the spm key we
|
|
3
|
+
// care about as a separate item because it otherwise gets exported as {default: ...} object.
|
|
4
|
+
export const spm = {
|
|
5
|
+
// Change the Swift Package name and target autolinking expects for this npm package. By default, it would use
|
|
6
|
+
// 'ReactNative' which conflicts with RN itself.
|
|
7
|
+
// This option appears to be undocumented, it's read here: https://github.com/react/react-native/blob/2dd6d4b482c2512d3e92fbaf0a10a9f8ac055e5d/packages/react-native/scripts/spm/expand-spm-dependencies.js#L59-L82
|
|
8
|
+
name: 'PowerSyncReactNative'
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
spm
|
|
13
|
+
};
|
|
@@ -53,15 +53,8 @@ class ReactNativePowerSyncDatabase extends BasePowerSyncDatabase<ReactNativeData
|
|
|
53
53
|
const remote = new ReactNativeRemote(connector, this.logger, this.options.remote);
|
|
54
54
|
|
|
55
55
|
return new ReactNativeStreamingSyncImplementation({
|
|
56
|
-
...options,
|
|
57
|
-
|
|
58
|
-
remote,
|
|
59
|
-
uploadCrud: async () => {
|
|
60
|
-
await this.waitForReady();
|
|
61
|
-
await connector.uploadData(this);
|
|
62
|
-
},
|
|
63
|
-
identifier: this.database.name,
|
|
64
|
-
logger: this.logger
|
|
56
|
+
...this.commonSyncOptions(connector, options),
|
|
57
|
+
remote
|
|
65
58
|
});
|
|
66
59
|
}
|
|
67
60
|
|