@wxn0brp/db-crdt 0.0.1 → 0.0.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/README.md +9 -5
- package/package.json +35 -38
package/README.md
CHANGED
|
@@ -7,16 +7,16 @@ This library provides a CRDT (Conflict-free Replicated Data Type) implementation
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
npm i @wxn0brp/db-crdt
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
import {
|
|
16
|
+
import { createCrdtValthera } from "@wxn0brp/db-crdt";
|
|
17
17
|
import { Valthera } from "@wxn0brp/db";
|
|
18
18
|
|
|
19
|
-
const db =
|
|
19
|
+
const db = createCrdtValthera(new Valthera("dir"));
|
|
20
20
|
|
|
21
21
|
// All operations are now CRDT-enabled
|
|
22
22
|
await db.add("my-collection", { name: "John Doe" });
|
|
@@ -24,9 +24,9 @@ await db.add("my-collection", { name: "John Doe" });
|
|
|
24
24
|
|
|
25
25
|
## API
|
|
26
26
|
|
|
27
|
-
### `
|
|
27
|
+
### `createCrdtValthera(target: ValtheraCompatible): ValtheraCRDT`
|
|
28
28
|
|
|
29
|
-
This is the main function that wraps a
|
|
29
|
+
This is the main function that wraps a any `ValtheraCompatible` instance and returns a `ValtheraCRDT` instance.
|
|
30
30
|
|
|
31
31
|
### `ValtheraCRDT`
|
|
32
32
|
|
|
@@ -43,3 +43,7 @@ Sync a collection from `my` to `other`.
|
|
|
43
43
|
## License
|
|
44
44
|
|
|
45
45
|
This project is licensed under the MIT License.
|
|
46
|
+
|
|
47
|
+
## Contributing
|
|
48
|
+
|
|
49
|
+
Contributions are welcome!
|
package/package.json
CHANGED
|
@@ -1,42 +1,39 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
"name": "@wxn0brp/db-crdt",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"description": "CRDT integration for ValtheraDB",
|
|
7
|
+
"author": "wxn0brP",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"homepage": "https://github.com/wxn0brP/ValtheraDB-crdt",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/wxn0brP/ValtheraDB-crdt.git"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/node": "*",
|
|
17
|
+
"@wxn0brp/db": "^0.41.0",
|
|
18
|
+
"tsc-alias": "*",
|
|
19
|
+
"typescript": "*"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@wxn0brp/db-core": ">=0.3.0"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js",
|
|
31
|
+
"import": "./dist/index.js"
|
|
14
32
|
},
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"@types/node": "*",
|
|
20
|
-
"@wxn0brp/db": "^0.41.0",
|
|
21
|
-
"tsc-alias": "*",
|
|
22
|
-
"typescript": "*"
|
|
23
|
-
},
|
|
24
|
-
"peerDependencies": {
|
|
25
|
-
"@wxn0brp/db-core": ">=0.3.0"
|
|
26
|
-
},
|
|
27
|
-
"files": [
|
|
28
|
-
"dist"
|
|
29
|
-
],
|
|
30
|
-
"exports": {
|
|
31
|
-
".": {
|
|
32
|
-
"types": "./dist/index.d.ts",
|
|
33
|
-
"default": "./dist/index.js",
|
|
34
|
-
"import": "./dist/index.js"
|
|
35
|
-
},
|
|
36
|
-
"./*": {
|
|
37
|
-
"types": "./dist/*.d.ts",
|
|
38
|
-
"default": "./dist/*.js",
|
|
39
|
-
"import": "./dist/*.js"
|
|
40
|
-
}
|
|
33
|
+
"./*": {
|
|
34
|
+
"types": "./dist/*.d.ts",
|
|
35
|
+
"default": "./dist/*.js",
|
|
36
|
+
"import": "./dist/*.js"
|
|
41
37
|
}
|
|
38
|
+
}
|
|
42
39
|
}
|