cojson 0.0.6 → 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.
@@ -116,7 +116,6 @@ export class CoValue {
116
116
  return false;
117
117
  }
118
118
  const transactions = ((_a = this.sessions[sessionID]) == null ? void 0 : _a.transactions) ?? [];
119
- console.log("transactions before", this.id, transactions.length, this.getValidSortedTransactions().length);
120
119
  transactions.push(...newTransactions);
121
120
  this.sessions[sessionID] = {
122
121
  transactions,
@@ -125,17 +124,14 @@ export class CoValue {
125
124
  lastSignature: newSignature
126
125
  };
127
126
  this.content = void 0;
128
- console.log("transactions after", this.id, transactions.length, this.getValidSortedTransactions().length);
129
127
  const content = this.getCurrentContent();
130
128
  for (const listener of this.listeners) {
131
- console.log("Calling listener (update)", this.id, content.toJSON());
132
129
  listener(content);
133
130
  }
134
131
  return true;
135
132
  }
136
133
  subscribe(listener) {
137
134
  this.listeners.add(listener);
138
- console.log("Calling listener (initial)", this.id, this.getCurrentContent().toJSON());
139
135
  listener(this.getCurrentContent());
140
136
  return () => {
141
137
  this.listeners.delete(listener);
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "cojson",
3
- "module": "dist/index.js",
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.6",
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
  };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes