@dittolive/ditto 4.10.2 → 4.11.0-preview.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.
- package/DittoReactNative.podspec +1 -17
- package/README.md +4 -80
- package/node/ditto.cjs.js +444 -81
- package/node/ditto.darwin-arm64.node +0 -0
- package/node/ditto.darwin-x64.node +0 -0
- package/node/ditto.linux-arm64.node +0 -0
- package/node/ditto.linux-x64.node +0 -0
- package/node/ditto.win32-x64.node +0 -0
- package/package.json +1 -1
- package/react-native/android/build.gradle +29 -34
- package/react-native/android/cpp-adapter.cpp +10 -11
- package/react-native/android/dittoffi/src/ditto_transaction.cpp +1 -0
- package/react-native/android/dittoffi/src/ditto_transaction.h +91 -0
- package/react-native/android/dittoffi/src/dittoffi.h +587 -390
- package/react-native/android/dittoffi/src/dittoffi_java.cpp +3360 -1358
- package/react-native/android/dittoffi/src/dittoffi_java.h +59 -10
- package/react-native/android/dittoffi/src/dittoffi_java.i +2 -0
- package/react-native/android/dittoffi/src/dittostore_java.i +48 -0
- package/react-native/android/dittoffi/src/mesh_java_interfaces.h +81 -109
- package/react-native/android/gradle.properties +6 -5
- package/react-native/android/src/main/java/com/dittolive/rnsdk/DittoRNSDKModule.kt +23 -15
- package/react-native/cpp/include/DQL.h +1 -0
- package/react-native/cpp/include/Differ.h +14 -0
- package/react-native/cpp/include/Lifecycle.h +1 -1
- package/react-native/cpp/include/Transaction.h +18 -0
- package/react-native/cpp/include/Transports.h +1 -0
- package/react-native/cpp/include/Utils.h +27 -3
- package/react-native/cpp/include/main.h +2 -0
- package/react-native/cpp/src/DQL.cpp +21 -0
- package/react-native/cpp/src/Differ.cpp +57 -0
- package/react-native/cpp/src/Lifecycle.cpp +17 -7
- package/react-native/cpp/src/Misc.cpp +50 -32
- package/react-native/cpp/src/Transaction.cpp +195 -0
- package/react-native/cpp/src/Transports.cpp +77 -1
- package/react-native/cpp/src/Utils.cpp +11 -0
- package/react-native/cpp/src/main.cpp +18 -1
- package/react-native/ditto.es6.js +1 -1
- package/react-native/ios/DittoRNSDK.mm +2 -4
- package/types/ditto.d.ts +271 -33
- package/web/ditto.es6.js +1 -1
- package/web/ditto.umd.js +1 -1
- package/web/ditto.wasm +0 -0
- package/react-native/ios/YeetJSIUtils.h +0 -60
- package/react-native/ios/YeetJSIUtils.mm +0 -196
package/DittoReactNative.podspec
CHANGED
|
@@ -11,7 +11,6 @@ framework_path = File.join(File.dirname(__FILE__), 'react-native', 'ios', 'Ditto
|
|
|
11
11
|
local_framework_exists = File.exist?(framework_path)
|
|
12
12
|
|
|
13
13
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
14
|
-
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
15
14
|
|
|
16
15
|
Pod::Spec.new do |s|
|
|
17
16
|
s.name = "DittoReactNative"
|
|
@@ -37,20 +36,5 @@ Pod::Spec.new do |s|
|
|
|
37
36
|
install_modules_dependencies(s)
|
|
38
37
|
else
|
|
39
38
|
s.dependency "React-Core"
|
|
40
|
-
|
|
41
|
-
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
42
|
-
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
43
|
-
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
44
|
-
s.pod_target_xcconfig = {
|
|
45
|
-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
46
|
-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
47
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
48
|
-
}
|
|
49
|
-
s.dependency "React-Codegen"
|
|
50
|
-
s.dependency "RCT-Folly"
|
|
51
|
-
s.dependency "RCTRequired"
|
|
52
|
-
s.dependency "RCTTypeSafety"
|
|
53
|
-
s.dependency "ReactCommon/turbomodule/core"
|
|
54
|
-
end
|
|
55
|
-
end
|
|
39
|
+
end
|
|
56
40
|
end
|
package/README.md
CHANGED
|
@@ -3,93 +3,17 @@
|
|
|
3
3
|
_Ditto is a cross-platform SDK that allows mobile, web, and IoT apps to sync
|
|
4
4
|
with and even without connectivity._
|
|
5
5
|
|
|
6
|
-
Version: **4.
|
|
6
|
+
Version: **4.11.0-preview.2**
|
|
7
7
|
|
|
8
|
-
For more information please visit [ditto.
|
|
9
|
-
[API Reference](https://software.ditto.live/js/Ditto/4.
|
|
8
|
+
For more information please visit [ditto.com](https://ditto.com), as well as the
|
|
9
|
+
[API Reference](https://software.ditto.live/js/Ditto/4.11.0-preview.2/api-reference/) for this particular version.
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
## Getting Started
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
See [our SDK Install Guides](https://docs.ditto.live/sdk/latest/install-guides/install-guides) for step-by-step instructions.
|
|
16
16
|
|
|
17
|
-
```bash
|
|
18
|
-
npm install --save @dittolive/ditto
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Import `@dittolive/ditto` in your source and start using it:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
```javascript
|
|
25
|
-
import { init, Ditto } from '@dittolive/ditto'
|
|
26
|
-
|
|
27
|
-
(async () => {
|
|
28
|
-
// Initialize the Ditto module
|
|
29
|
-
await init()
|
|
30
|
-
|
|
31
|
-
// Create a Ditto context:
|
|
32
|
-
const identity = { type: 'offlinePlayground', appID: 'live.ditto.playground' }
|
|
33
|
-
const ditto = new Ditto(identity, 'playground')
|
|
34
|
-
|
|
35
|
-
// Get hold of a collection:
|
|
36
|
-
const cars = ditto.store.collection('cars')
|
|
37
|
-
|
|
38
|
-
// Insert an entry:
|
|
39
|
-
const fordBlack = { _id: 'ford-black-123', model: 'Ford', color: 'black' }
|
|
40
|
-
await cars.upsert(fordBlack)
|
|
41
|
-
|
|
42
|
-
// Find an entry by ID:
|
|
43
|
-
const foundFordBlack = await cars.findByID('ford-black-123')
|
|
44
|
-
console.log(foundFordBlack)
|
|
45
|
-
|
|
46
|
-
// Remove an entry:
|
|
47
|
-
await cars.findByID('ford-black-123').remove()
|
|
48
|
-
|
|
49
|
-
// Done:
|
|
50
|
-
console.log('Done, over and out.')
|
|
51
|
-
})()
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Browser Environments
|
|
55
|
-
|
|
56
|
-
When running in the browser and other web environments, Ditto is powered by a
|
|
57
|
-
[WebAssembly](https://developer.mozilla.org/en-US/docs/WebAssembly) core written
|
|
58
|
-
in Rust. By default, Ditto will fetch the corresponding WebAssembly file from
|
|
59
|
-
the web. That same file is contained within the NPM package under
|
|
60
|
-
`web/ditto.wasm` so you can serve it yourself. Simply make the file accessible
|
|
61
|
-
somewhere on your server and pass the URL to `init()`:
|
|
62
|
-
|
|
63
|
-
```javascript
|
|
64
|
-
import { init, Ditto } from '@dittolive/ditto'
|
|
65
|
-
|
|
66
|
-
(async () => {
|
|
67
|
-
// Pass the URL to the ditto.wasm file:
|
|
68
|
-
await init({ webAssemblyModule: 'https://my-app/assets/ditto.wasm' })
|
|
69
|
-
|
|
70
|
-
// Then use Ditto as you normally would:
|
|
71
|
-
const identity = { type: 'offlinePlayground', appID: 'live.ditto.playground' }
|
|
72
|
-
const ditto = new Ditto(identity, 'playground')
|
|
73
|
-
|
|
74
|
-
// ...
|
|
75
|
-
})()
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
This may be useful for development or production environments without a reliable
|
|
79
|
-
internet connection. Make sure to properly configure the server to return the
|
|
80
|
-
correct MIME type (`application/wasm`) and the
|
|
81
|
-
[`Access-Control-Allow-Origin`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin)
|
|
82
|
-
header if the `.wasm` file is served from a different domain. For production
|
|
83
|
-
environments, make sure to use compression (`gzip`) and proper caching headers.
|
|
84
|
-
|
|
85
|
-
### React Native Environments
|
|
86
|
-
|
|
87
|
-
Using Ditto in React Native requires configuration of the native iOS and Android
|
|
88
|
-
projects to request network and location access permissions and to ensure
|
|
89
|
-
compatibility with the target environment. Please refer to our guide for
|
|
90
|
-
[getting started with React
|
|
91
|
-
Native](https://docs.ditto.live/javascript/react-native-quickstart) for more
|
|
92
|
-
information.
|
|
93
17
|
|
|
94
18
|
## Playground
|
|
95
19
|
|