cojson 0.0.5 → 0.0.7
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/dist/coValue.mjs +437 -0
- package/dist/coValue.test.mjs +122 -0
- package/dist/contentType.mjs +7 -0
- package/dist/contentType.test.mjs +179 -0
- package/dist/contentTypes/coList.mjs +18 -0
- package/dist/contentTypes/coMap.mjs +126 -0
- package/dist/contentTypes/coStream.mjs +18 -0
- package/dist/contentTypes/static.mjs +16 -0
- package/dist/crypto.mjs +207 -0
- package/dist/crypto.test.mjs +155 -0
- package/dist/ids.mjs +1 -0
- package/dist/index.mjs +21 -0
- package/dist/jsonValue.mjs +1 -0
- package/dist/node.mjs +144 -0
- package/dist/permissions.mjs +244 -0
- package/dist/permissions.test.mjs +985 -0
- package/dist/sync.mjs +318 -0
- package/dist/sync.test.mjs +861 -0
- package/package.json +5 -3
- package/src/coValue.ts +0 -6
- package/src/index.ts +2 -0
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cojson",
|
|
3
|
-
"module": "dist/index.
|
|
3
|
+
"module": "dist/index.mjs",
|
|
4
|
+
"main": "dist/index.mjs",
|
|
4
5
|
"types": "src/index.ts",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"license": "MIT",
|
|
7
|
-
"version": "0.0.
|
|
8
|
+
"version": "0.0.7",
|
|
8
9
|
"devDependencies": {
|
|
9
10
|
"@types/jest": "^29.5.3",
|
|
10
11
|
"@typescript-eslint/eslint-plugin": "^6.2.1",
|
|
@@ -25,7 +26,8 @@
|
|
|
25
26
|
},
|
|
26
27
|
"scripts": {
|
|
27
28
|
"test": "jest",
|
|
28
|
-
"build": "esbuild `find src \\( -name '*.ts' -o -name '*.tsx' \\)` --platform=node --target=node14 --outdir=dist"
|
|
29
|
+
"build": "esbuild `find src \\( -name '*.ts' -o -name '*.tsx' \\)` --out-extension:.js=.mjs --platform=node --target=node14 --outdir=dist",
|
|
30
|
+
"prepublishOnly": "yarn run build"
|
|
29
31
|
},
|
|
30
32
|
"jest": {
|
|
31
33
|
"preset": "ts-jest",
|
package/src/coValue.ts
CHANGED
|
@@ -192,8 +192,6 @@ export class CoValue {
|
|
|
192
192
|
|
|
193
193
|
const transactions = this.sessions[sessionID]?.transactions ?? [];
|
|
194
194
|
|
|
195
|
-
console.log("transactions before", this.id, transactions.length, this.getValidSortedTransactions().length);
|
|
196
|
-
|
|
197
195
|
transactions.push(...newTransactions);
|
|
198
196
|
|
|
199
197
|
this.sessions[sessionID] = {
|
|
@@ -205,12 +203,9 @@ export class CoValue {
|
|
|
205
203
|
|
|
206
204
|
this.content = undefined;
|
|
207
205
|
|
|
208
|
-
console.log("transactions after", this.id, transactions.length, this.getValidSortedTransactions().length);
|
|
209
|
-
|
|
210
206
|
const content = this.getCurrentContent();
|
|
211
207
|
|
|
212
208
|
for (const listener of this.listeners) {
|
|
213
|
-
console.log("Calling listener (update)", this.id, content.toJSON());
|
|
214
209
|
listener(content);
|
|
215
210
|
}
|
|
216
211
|
|
|
@@ -219,7 +214,6 @@ export class CoValue {
|
|
|
219
214
|
|
|
220
215
|
subscribe(listener: (content?: ContentType) => void): () => void {
|
|
221
216
|
this.listeners.add(listener);
|
|
222
|
-
console.log("Calling listener (initial)", this.id, this.getCurrentContent().toJSON());
|
|
223
217
|
listener(this.getCurrentContent());
|
|
224
218
|
|
|
225
219
|
return () => {
|
package/src/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type { AgentCredential } from "./coValue";
|
|
|
14
14
|
import type { AgentID, SessionID } from "./ids";
|
|
15
15
|
import type { CoValueID, ContentType } from "./contentType";
|
|
16
16
|
import type { JsonValue } from "./jsonValue";
|
|
17
|
+
import type { SyncMessage } from "./sync";
|
|
17
18
|
|
|
18
19
|
type Value = JsonValue | ContentType;
|
|
19
20
|
|
|
@@ -36,4 +37,5 @@ export type {
|
|
|
36
37
|
AgentCredential,
|
|
37
38
|
SessionID,
|
|
38
39
|
AgentID,
|
|
40
|
+
SyncMessage
|
|
39
41
|
};
|