@dittolive/ditto 2.0.7 → 2.1.0-experimental.test.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/LICENSE.md CHANGED
@@ -1,34 +1,34 @@
1
- Ditto Binary License
2
-
3
- Copyright © 2021 DittoLive Incorporated. All rights reserved.
4
-
5
- NOTICE: All information contained herein is, and remains the property of
6
- DittoLive. The intellectual and technical concepts contained herein are
7
- proprietary to DittoLive and may be covered by U.S. and Foreign Patents,
8
- patents in process, and are protected by trade secret and copyright law.
9
-
10
- Redistribution and use in binary form, with or without modification, is
11
- permitted provided that the following conditions are met:
12
-
13
- 1. You agree not to attempt to decompile, disassemble, reverse engineer or
14
- otherwise discover the source code from which the binary code was derived.
15
-
16
- 2. Redistributions in binary form must reproduce the above copyright notice,
17
- this list of conditions and the following disclaimer in the documentation
18
- and/or other materials provided with the distribution.
19
-
20
- 3. Neither the name of the copyright holder nor the names of its
21
- contributors may be used to endorse or promote products derived from this
22
- software without specific prior written permission.
23
-
24
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
- POSSIBILITY OF SUCH DAMAGE.
1
+ Ditto Binary License
2
+
3
+ Copyright © 2021 DittoLive Incorporated. All rights reserved.
4
+
5
+ NOTICE: All information contained herein is, and remains the property of
6
+ DittoLive. The intellectual and technical concepts contained herein are
7
+ proprietary to DittoLive and may be covered by U.S. and Foreign Patents,
8
+ patents in process, and are protected by trade secret and copyright law.
9
+
10
+ Redistribution and use in binary form, with or without modification, is
11
+ permitted provided that the following conditions are met:
12
+
13
+ 1. You agree not to attempt to decompile, disassemble, reverse engineer or
14
+ otherwise discover the source code from which the binary code was derived.
15
+
16
+ 2. Redistributions in binary form must reproduce the above copyright notice,
17
+ this list of conditions and the following disclaimer in the documentation
18
+ and/or other materials provided with the distribution.
19
+
20
+ 3. Neither the name of the copyright holder nor the names of its
21
+ contributors may be used to endorse or promote products derived from this
22
+ software without specific prior written permission.
23
+
24
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
+ POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,89 +1,89 @@
1
- # Ditto JS SDK
2
-
3
- *Ditto is a cross platform SDK that allows mobile, web, and IoT apps to sync
4
- with and even without connectivity.*
5
-
6
- Version: **2.0.7**
7
-
8
- Please visit [ditto.live](https://ditto.live) for more info as well as the
9
- [API Reference](https://software.ditto.live/js/Ditto/2.0.7/api-reference/) for this particular version.
10
-
11
- --------------------------------------------------------------------------------
12
-
13
- ## Getting Started
14
-
15
- Add the Ditto NPM package to your project:
16
-
17
- npm install --save @dittolive/ditto
18
-
19
- Import `@dittolive/ditto` in your source and start using it:
20
-
21
- import { init, Ditto } from '@dittolive/ditto'
22
-
23
- (async () => {
24
- // Initialize the Ditto module
25
- await init()
26
-
27
- // Create a Ditto context:
28
- const identity = { type: 'offlinePlayground', appID: 'live.ditto.playground') }
29
- const ditto = new Ditto(identity, 'playground')
30
-
31
- // Get hold of a collection:
32
- const cars = ditto.store.collection('cars')
33
-
34
- // Insert an entry:
35
- const fordBlack = { _id: "ford-black-123", model: "Ford", color: "black" }
36
- await cars.upsert(fordBlack)
37
-
38
- // Find an entry by ID:
39
- const foundFordBlack = await cars.findByID('ford-black-123')
40
- console.log(foundFordBlack)
41
-
42
- // Remove an entry:
43
- await cars.findByID('ford-black-123').remove()
44
-
45
- // Done:
46
- console.log("Done, over and out.")
47
- })()
48
-
49
- **NOTE**: Ditto is powered by a
50
- [WebAssembly](https://developer.mozilla.org/en-US/docs/WebAssembly) and native
51
- Node core written in Rust under the hood. By default, when running in the
52
- browser, Ditto will fetch the corresponding WebAssembly file from the web. That
53
- same file is contained within the NPM package under `web/ditto.wasm` so you can
54
- serve it yourself. Simply make the file accessible somewhere on your server and
55
- pass the URL to `init()`:
56
-
57
- import { init, Ditto } from '@dittolive/ditto'
58
-
59
- (async () => {
60
- // Pass the URL to the ditto.wasm file:
61
- await init({ webAssemblyModule: 'https://my-app/assets/ditto.wasm' })
62
-
63
- // Then use Ditto as you normally would:
64
- const identity = { type: 'offlinePlayground', appID: 'live.ditto.playground' }
65
- const ditto = new Ditto(identity, 'playground')
66
-
67
- // ...
68
- })
69
-
70
- This may be useful for development or production environments without a reliable
71
- internet connection. Make sure to properly configure the server to return
72
- the correct MIME type (`application/wasm`) and the [`Access-Control-Allow-Origin`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin)
73
- header if the `.wasm` file is served from a different domain. For production
74
- environments, make sure to use compression (`gzip`) and proper caching headers.
75
-
76
- ## Playground
77
-
78
- The NPM package has a built-in bare minimum playground web page (`index.html`)
79
- as well as a Node REPL ('playground.cjs') allowing you to start playing with
80
- the Ditto SDK right away. Simply `cd` into the package directory, run
81
- `npm run play:web` or `npm run play:node` and follow the on-screen
82
- instructions.
83
-
84
- ## Copyright
85
-
86
- *Ditto JS SDK* is a commercial product. Please consult `LICENSE.md` within this
87
- package for license details.
88
-
89
- Copyright © 2021 DittoLive Incorporated. All rights reserved.
1
+ # Ditto JS SDK
2
+
3
+ *Ditto is a cross platform SDK that allows mobile, web, and IoT apps to sync
4
+ with and even without connectivity.*
5
+
6
+ Version: **2.1.0-experimental.test.1**
7
+
8
+ Please visit [ditto.live](https://ditto.live) for more info as well as the
9
+ [API Reference](https://software.ditto.live/js/Ditto/0.0.0-manual-build.20221111-191305914-d8252906e/api-reference/) for this particular version.
10
+
11
+ --------------------------------------------------------------------------------
12
+
13
+ ## Getting Started
14
+
15
+ Add the Ditto NPM package to your project:
16
+
17
+ npm install --save @dittolive/ditto
18
+
19
+ Import `@dittolive/ditto` in your source and start using it:
20
+
21
+ import { init, Ditto } from '@dittolive/ditto'
22
+
23
+ (async () => {
24
+ // Initialize the Ditto module
25
+ await init()
26
+
27
+ // Create a Ditto context:
28
+ const identity = { type: 'offlinePlayground', appID: 'live.ditto.playground') }
29
+ const ditto = new Ditto(identity, 'playground')
30
+
31
+ // Get hold of a collection:
32
+ const cars = ditto.store.collection('cars')
33
+
34
+ // Insert an entry:
35
+ const fordBlack = { _id: "ford-black-123", model: "Ford", color: "black" }
36
+ await cars.upsert(fordBlack)
37
+
38
+ // Find an entry by ID:
39
+ const foundFordBlack = await cars.findByID('ford-black-123')
40
+ console.log(foundFordBlack)
41
+
42
+ // Remove an entry:
43
+ await cars.findByID('ford-black-123').remove()
44
+
45
+ // Done:
46
+ console.log("Done, over and out.")
47
+ })()
48
+
49
+ **NOTE**: Ditto is powered by a
50
+ [WebAssembly](https://developer.mozilla.org/en-US/docs/WebAssembly) and native
51
+ Node core written in Rust under the hood. By default, when running in the
52
+ browser, Ditto will fetch the corresponding WebAssembly file from the web. That
53
+ same file is contained within the NPM package under `web/ditto.wasm` so you can
54
+ serve it yourself. Simply make the file accessible somewhere on your server and
55
+ pass the URL to `init()`:
56
+
57
+ import { init, Ditto } from '@dittolive/ditto'
58
+
59
+ (async () => {
60
+ // Pass the URL to the ditto.wasm file:
61
+ await init({ webAssemblyModule: 'https://my-app/assets/ditto.wasm' })
62
+
63
+ // Then use Ditto as you normally would:
64
+ const identity = { type: 'offlinePlayground', appID: 'live.ditto.playground' }
65
+ const ditto = new Ditto(identity, 'playground')
66
+
67
+ // ...
68
+ })
69
+
70
+ This may be useful for development or production environments without a reliable
71
+ internet connection. Make sure to properly configure the server to return
72
+ the correct MIME type (`application/wasm`) and the [`Access-Control-Allow-Origin`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin)
73
+ header if the `.wasm` file is served from a different domain. For production
74
+ environments, make sure to use compression (`gzip`) and proper caching headers.
75
+
76
+ ## Playground
77
+
78
+ The NPM package has a built-in bare minimum playground web page (`index.html`)
79
+ as well as a Node REPL ('playground.cjs') allowing you to start playing with
80
+ the Ditto SDK right away. Simply `cd` into the package directory, run
81
+ `npm run play:web` or `npm run play:node` and follow the on-screen
82
+ instructions.
83
+
84
+ ## Copyright
85
+
86
+ *Ditto JS SDK* is a commercial product. Please consult `LICENSE.md` within this
87
+ package for license details.
88
+
89
+ Copyright © 2021 DittoLive Incorporated. All rights reserved.