Compare commits
21 Commits
cojson@0.7
...
jazz-react
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be7e208b1c | ||
|
|
c3bffbf4de | ||
|
|
d46467f318 | ||
|
|
6d21400803 | ||
|
|
db53161296 | ||
|
|
cb4a116cec | ||
|
|
013199b9b2 | ||
|
|
a8b74ff703 | ||
|
|
b1985a9161 | ||
|
|
3bf512719f | ||
|
|
d83ed69d41 | ||
|
|
fdde8db664 | ||
|
|
dd5581ba2d | ||
|
|
07fe2b9dcf | ||
|
|
b297c93b80 | ||
|
|
d2e62e5b44 | ||
|
|
fe73ce7514 | ||
|
|
0fed16cea4 | ||
|
|
08804ad435 | ||
|
|
79fa7724ad | ||
|
|
4604c2184a |
@@ -1,5 +1,73 @@
|
||||
# jazz-example-chat
|
||||
|
||||
## 0.0.80
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [b297c93]
|
||||
- Updated dependencies [3bf5127]
|
||||
- Updated dependencies [a8b74ff]
|
||||
- Updated dependencies [db53161]
|
||||
- cojson@0.7.33
|
||||
- jazz-react@0.7.33
|
||||
- jazz-tools@0.7.33
|
||||
|
||||
## 0.0.80-hotfixes.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.5
|
||||
- jazz-react@0.7.33-hotfixes.5
|
||||
- jazz-tools@0.7.33-hotfixes.5
|
||||
|
||||
## 0.0.80-hotfixes.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.4
|
||||
- jazz-react@0.7.33-hotfixes.4
|
||||
- jazz-tools@0.7.33-hotfixes.4
|
||||
|
||||
## 0.0.80-hotfixes.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.3
|
||||
- jazz-react@0.7.33-hotfixes.3
|
||||
- jazz-tools@0.7.33-hotfixes.3
|
||||
|
||||
## 0.0.80-hotfixes.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.7.33-hotfixes.2
|
||||
|
||||
## 0.0.80-hotfixes.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.7.33-hotfixes.1
|
||||
|
||||
## 0.0.80-hotfixes.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.0
|
||||
- jazz-react@0.7.33-hotfixes.0
|
||||
- jazz-tools@0.7.33-hotfixes.0
|
||||
|
||||
## 0.0.79
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- jazz-tools@0.7.32
|
||||
- jazz-react@0.7.32
|
||||
|
||||
## 0.0.78
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# Jazz Chat Example
|
||||
|
||||
Live version: https://example-chat.jazz.tools
|
||||
Live version: [https://chat.jazz.tools](https://chat.jazz.tools)
|
||||
|
||||
## Installing & running the example locally
|
||||
|
||||
(this requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
||||
|
||||
Start by checking out `jazz`
|
||||
|
||||
```bash
|
||||
git clone https://github.com/gardencmp/jazz.git
|
||||
cd jazz/examples/chat
|
||||
@@ -34,7 +35,6 @@ pnpm dev
|
||||
|
||||
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
||||
|
||||
|
||||
## Configuration: sync server
|
||||
|
||||
By default, the example app uses [Jazz Global Mesh](https://jazz.tools/mesh) (`wss://sync.jazz.tools`) - so cross-device use, invites and collaboration should just work.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-chat",
|
||||
"private": true,
|
||||
"version": "0.0.78",
|
||||
"version": "0.0.80",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,64 @@
|
||||
# jazz-example-chat
|
||||
|
||||
## 0.0.58
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fdde8db]
|
||||
- Updated dependencies [b297c93]
|
||||
- Updated dependencies [07fe2b9]
|
||||
- Updated dependencies [3bf5127]
|
||||
- Updated dependencies [a8b74ff]
|
||||
- Updated dependencies [db53161]
|
||||
- cojson-transport-ws@0.7.33
|
||||
- cojson@0.7.33
|
||||
|
||||
## 0.0.58-hotfixes.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.5
|
||||
- cojson-transport-ws@0.7.33-hotfixes.5
|
||||
|
||||
## 0.0.58-hotfixes.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.4
|
||||
- cojson-transport-ws@0.7.33-hotfixes.4
|
||||
|
||||
## 0.0.58-hotfixes.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson-transport-ws@0.7.33-hotfixes.3
|
||||
- cojson@0.7.33-hotfixes.3
|
||||
|
||||
## 0.0.58-hotfixes.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson-transport-ws@0.7.33-hotfixes.2
|
||||
|
||||
## 0.0.58-hotfixes.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson-transport-ws@0.7.33-hotfixes.1
|
||||
|
||||
## 0.0.58-hotfixes.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.0
|
||||
- cojson-transport-ws@0.7.33-hotfixes.0
|
||||
|
||||
## 0.0.57
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-inspector",
|
||||
"private": true,
|
||||
"version": "0.0.57",
|
||||
"version": "0.0.58",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,68 @@
|
||||
# jazz-example-pets
|
||||
|
||||
## 0.0.98
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.7.33
|
||||
- jazz-tools@0.7.33
|
||||
- jazz-browser-media-images@0.7.33
|
||||
|
||||
## 0.0.98-hotfixes.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.7.33-hotfixes.5
|
||||
- jazz-tools@0.7.33-hotfixes.5
|
||||
- jazz-browser-media-images@0.7.33-hotfixes.5
|
||||
|
||||
## 0.0.98-hotfixes.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.7.33-hotfixes.4
|
||||
- jazz-tools@0.7.33-hotfixes.4
|
||||
- jazz-browser-media-images@0.7.33-hotfixes.4
|
||||
|
||||
## 0.0.98-hotfixes.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.7.33-hotfixes.3
|
||||
- jazz-tools@0.7.33-hotfixes.3
|
||||
- jazz-browser-media-images@0.7.33-hotfixes.3
|
||||
|
||||
## 0.0.98-hotfixes.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser-media-images@0.7.33-hotfixes.2
|
||||
- jazz-react@0.7.33-hotfixes.2
|
||||
|
||||
## 0.0.98-hotfixes.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser-media-images@0.7.33-hotfixes.1
|
||||
- jazz-react@0.7.33-hotfixes.1
|
||||
|
||||
## 0.0.98-hotfixes.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.7.33-hotfixes.0
|
||||
- jazz-tools@0.7.33-hotfixes.0
|
||||
- jazz-browser-media-images@0.7.33-hotfixes.0
|
||||
|
||||
## 0.0.97
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- jazz-tools@0.7.32
|
||||
- jazz-browser-media-images@0.7.32
|
||||
- jazz-react@0.7.32
|
||||
|
||||
## 0.0.96
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-pets",
|
||||
"private": true,
|
||||
"version": "0.0.96",
|
||||
"version": "0.0.98",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,60 @@
|
||||
# jazz-example-todo
|
||||
|
||||
## 0.0.97
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.7.33
|
||||
- jazz-tools@0.7.33
|
||||
|
||||
## 0.0.97-hotfixes.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.7.33-hotfixes.5
|
||||
- jazz-tools@0.7.33-hotfixes.5
|
||||
|
||||
## 0.0.97-hotfixes.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.7.33-hotfixes.4
|
||||
- jazz-tools@0.7.33-hotfixes.4
|
||||
|
||||
## 0.0.97-hotfixes.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.7.33-hotfixes.3
|
||||
- jazz-tools@0.7.33-hotfixes.3
|
||||
|
||||
## 0.0.97-hotfixes.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.7.33-hotfixes.2
|
||||
|
||||
## 0.0.97-hotfixes.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.7.33-hotfixes.1
|
||||
|
||||
## 0.0.97-hotfixes.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.7.33-hotfixes.0
|
||||
- jazz-tools@0.7.33-hotfixes.0
|
||||
|
||||
## 0.0.96
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- jazz-tools@0.7.32
|
||||
- jazz-react@0.7.32
|
||||
|
||||
## 0.0.95
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-todo",
|
||||
"private": true,
|
||||
"version": "0.0.95",
|
||||
"version": "0.0.97",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,45 @@
|
||||
# cojson-storage-indexeddb
|
||||
|
||||
## 0.7.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 3bf5127: Allow crashing whole node on peer errors
|
||||
- Updated dependencies [b297c93]
|
||||
- Updated dependencies [3bf5127]
|
||||
- Updated dependencies [a8b74ff]
|
||||
- Updated dependencies [db53161]
|
||||
- cojson@0.7.33
|
||||
|
||||
## 0.7.33-hotfixes.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.5
|
||||
|
||||
## 0.7.33-hotfixes.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.4
|
||||
|
||||
## 0.7.33-hotfixes.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Allow crashing whole node on peer errors
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.3
|
||||
|
||||
## 0.7.33-hotfixes.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.0
|
||||
|
||||
## 0.7.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cojson-storage-indexeddb",
|
||||
"version": "0.7.31",
|
||||
"version": "0.7.33",
|
||||
"main": "dist/index.js",
|
||||
"type": "module",
|
||||
"types": "src/index.ts",
|
||||
|
||||
@@ -92,7 +92,7 @@ export class IDBStorage {
|
||||
const [localNodeAsPeer, storageAsPeer] = cojsonInternals.connectedPeers(
|
||||
localNodeName,
|
||||
"storage",
|
||||
{ peer1role: "client", peer2role: "server", trace },
|
||||
{ peer1role: "client", peer2role: "server", trace, crashOnClose: true },
|
||||
);
|
||||
|
||||
await IDBStorage.open(
|
||||
|
||||
@@ -1,5 +1,52 @@
|
||||
# cojson-storage-sqlite
|
||||
|
||||
## 0.7.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 3bf5127: Allow crashing whole node on peer errors
|
||||
- Updated dependencies [b297c93]
|
||||
- Updated dependencies [3bf5127]
|
||||
- Updated dependencies [a8b74ff]
|
||||
- Updated dependencies [db53161]
|
||||
- cojson@0.7.33
|
||||
|
||||
## 0.7.33-hotfixes.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Get rid of simulated errors
|
||||
|
||||
## 0.7.33-hotfixes.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Make simulated errors even more likely
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.5
|
||||
|
||||
## 0.7.33-hotfixes.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.4
|
||||
|
||||
## 0.7.33-hotfixes.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Allow crashing whole node on peer errors
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.3
|
||||
|
||||
## 0.7.33-hotfixes.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.0
|
||||
|
||||
## 0.7.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "cojson-storage-sqlite",
|
||||
"type": "module",
|
||||
"version": "0.7.31",
|
||||
"version": "0.7.33",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -94,7 +94,7 @@ export class SQLiteStorage {
|
||||
const [localNodeAsPeer, storageAsPeer] = cojsonInternals.connectedPeers(
|
||||
localNodeName,
|
||||
"storage",
|
||||
{ peer1role: "client", peer2role: "server", trace },
|
||||
{ peer1role: "client", peer2role: "server", trace, crashOnClose: true },
|
||||
);
|
||||
|
||||
await SQLiteStorage.open(
|
||||
|
||||
@@ -1,5 +1,59 @@
|
||||
# cojson-transport-nodejs-ws
|
||||
|
||||
## 0.7.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- fdde8db: Handle ws closing while buffering
|
||||
- 07fe2b9: Wait if WS buffer is full
|
||||
- 3bf5127: Allow crashing whole node on peer errors
|
||||
- Updated dependencies [b297c93]
|
||||
- Updated dependencies [3bf5127]
|
||||
- Updated dependencies [a8b74ff]
|
||||
- Updated dependencies [db53161]
|
||||
- cojson@0.7.33
|
||||
|
||||
## 0.7.33-hotfixes.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.5
|
||||
|
||||
## 0.7.33-hotfixes.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.4
|
||||
|
||||
## 0.7.33-hotfixes.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Allow crashing whole node on peer errors
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.3
|
||||
|
||||
## 0.7.33-hotfixes.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Handle ws closing while buffering
|
||||
|
||||
## 0.7.33-hotfixes.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Wait if WS buffer is full
|
||||
|
||||
## 0.7.33-hotfixes.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.0
|
||||
|
||||
## 0.7.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "cojson-transport-ws",
|
||||
"type": "module",
|
||||
"version": "0.7.31",
|
||||
"version": "0.7.33",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -29,6 +29,7 @@ interface AnyWebSocket {
|
||||
close(): void;
|
||||
send(data: string): void;
|
||||
readyState: number;
|
||||
bufferedAmount: number;
|
||||
}
|
||||
|
||||
const g: typeof globalThis & {
|
||||
@@ -108,6 +109,16 @@ export function createWebSocketPeer({
|
||||
async push(msg) {
|
||||
await websocketOpen;
|
||||
if (websocket.readyState === 1) {
|
||||
while (websocket.bufferedAmount > 1_000_000) {
|
||||
console.log("WS buffer filling", id, websocket.bufferedAmount);
|
||||
await new Promise((resolve) =>
|
||||
setTimeout(resolve, 100),
|
||||
);
|
||||
if (websocket.readyState !== 1) {
|
||||
console.log("WebSocket closed while buffering", id, websocket.bufferedAmount);
|
||||
return;
|
||||
}
|
||||
}
|
||||
websocket.send(JSON.stringify(msg));
|
||||
}
|
||||
},
|
||||
@@ -123,5 +134,6 @@ export function createWebSocketPeer({
|
||||
},
|
||||
},
|
||||
role,
|
||||
crashOnClose: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
# cojson
|
||||
|
||||
## 0.7.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- b297c93: Improve logging
|
||||
- 3bf5127: Allow crashing whole node on peer errors
|
||||
- a8b74ff: Throw properly on peer that should crash on close
|
||||
|
||||
## 0.7.33-hotfixes.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Make simulated errors even more likely
|
||||
|
||||
## 0.7.33-hotfixes.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Throw properly on peer that should crash on close
|
||||
|
||||
## 0.7.33-hotfixes.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Allow crashing whole node on peer errors
|
||||
|
||||
## 0.7.33-hotfixes.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Improve logging
|
||||
|
||||
## 0.7.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"types": "src/index.ts",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.7.31",
|
||||
"version": "0.7.33",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.3",
|
||||
"@typescript-eslint/eslint-plugin": "^6.2.1",
|
||||
|
||||
@@ -367,6 +367,9 @@ export class CoValueCore {
|
||||
newStreamingHash: StreamingHash,
|
||||
notifyMode: "immediate" | "deferred",
|
||||
) {
|
||||
if (this.node.crashed) {
|
||||
throw new Error("Trying to add transactions after node is crashed");
|
||||
}
|
||||
const transactions =
|
||||
this.sessionLogs.get(sessionID)?.transactions ?? [];
|
||||
transactions.push(...newTransactions);
|
||||
|
||||
@@ -49,6 +49,8 @@ export class LocalNode {
|
||||
/** @category 3. Low-level */
|
||||
syncManager = new SyncManager(this);
|
||||
|
||||
crashed: Error | undefined = undefined;
|
||||
|
||||
/** @category 3. Low-level */
|
||||
constructor(
|
||||
account: ControlledAccountOrAgent,
|
||||
@@ -240,6 +242,10 @@ export class LocalNode {
|
||||
|
||||
/** @internal */
|
||||
createCoValue(header: CoValueHeader): CoValueCore {
|
||||
if (this.crashed) {
|
||||
throw new Error("Trying to create CoValue after node has crashed", { cause: this.crashed });
|
||||
}
|
||||
|
||||
const coValue = new CoValueCore(header, this);
|
||||
this.coValues[coValue.id] = { state: "loaded", coValue: coValue };
|
||||
|
||||
@@ -257,6 +263,10 @@ export class LocalNode {
|
||||
onProgress?: (progress: number) => void;
|
||||
} = {},
|
||||
): Promise<CoValueCore | "unavailable"> {
|
||||
if (this.crashed) {
|
||||
throw new Error("Trying to load CoValue after node has crashed", { cause: this.crashed });
|
||||
}
|
||||
|
||||
let entry = this.coValues[id];
|
||||
if (!entry) {
|
||||
const peersToWaitFor = new Set(
|
||||
|
||||
@@ -562,6 +562,7 @@ export class LSMStorage<WH, RH, FS extends FileSystem<WH, RH>> {
|
||||
peer1role: "client",
|
||||
peer2role: "server",
|
||||
trace,
|
||||
crashOnClose: true,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -9,10 +9,12 @@ export function connectedPeers(
|
||||
trace = false,
|
||||
peer1role = "peer",
|
||||
peer2role = "peer",
|
||||
crashOnClose = false,
|
||||
}: {
|
||||
trace?: boolean;
|
||||
peer1role?: Peer["role"];
|
||||
peer2role?: Peer["role"];
|
||||
crashOnClose?: boolean;
|
||||
} = {},
|
||||
): [Peer, Peer] {
|
||||
const [from1to2Rx, from1to2Tx] = newQueuePair(
|
||||
@@ -27,6 +29,7 @@ export function connectedPeers(
|
||||
incoming: from2to1Rx,
|
||||
outgoing: from1to2Tx,
|
||||
role: peer2role,
|
||||
crashOnClose: crashOnClose,
|
||||
};
|
||||
|
||||
const peer1AsPeer: Peer = {
|
||||
@@ -34,6 +37,7 @@ export function connectedPeers(
|
||||
incoming: from1to2Rx,
|
||||
outgoing: from2to1Tx,
|
||||
role: peer1role,
|
||||
crashOnClose: crashOnClose,
|
||||
};
|
||||
|
||||
return [peer1AsPeer, peer2AsPeer];
|
||||
|
||||
@@ -72,8 +72,8 @@ export interface Peer {
|
||||
incoming: IncomingSyncStream;
|
||||
outgoing: OutgoingSyncQueue;
|
||||
role: "peer" | "server" | "client";
|
||||
delayOnError?: number;
|
||||
priority?: number;
|
||||
crashOnClose: boolean;
|
||||
}
|
||||
|
||||
export interface PeerState {
|
||||
@@ -83,8 +83,8 @@ export interface PeerState {
|
||||
incoming: IncomingSyncStream;
|
||||
outgoing: OutgoingSyncQueue;
|
||||
role: "peer" | "server" | "client";
|
||||
delayOnError?: number;
|
||||
priority?: number;
|
||||
crashOnClose: boolean;
|
||||
}
|
||||
|
||||
export function combinedKnownStates(
|
||||
@@ -343,8 +343,8 @@ export class SyncManager {
|
||||
outgoing: peer.outgoing,
|
||||
toldKnownState: new Set(),
|
||||
role: peer.role,
|
||||
delayOnError: peer.delayOnError,
|
||||
priority: peer.priority,
|
||||
crashOnClose: peer.crashOnClose,
|
||||
};
|
||||
this.peers[peer.id] = peerState;
|
||||
|
||||
@@ -392,8 +392,18 @@ export class SyncManager {
|
||||
}
|
||||
};
|
||||
|
||||
processMessages().catch((e) => {
|
||||
processMessages().then(() => {
|
||||
if (peer.crashOnClose) {
|
||||
console.error("Unexepcted close from peer", peer.id);
|
||||
this.local.crashed = new Error("Unexpected close from peer");
|
||||
throw new Error("Unexpected close from peer");
|
||||
}
|
||||
}).catch((e) => {
|
||||
console.error("Error processing messages from peer", peer.id, e);
|
||||
if (peer.crashOnClose) {
|
||||
this.local.crashed = e;
|
||||
throw new Error(e);
|
||||
}
|
||||
}).finally(() => {
|
||||
peer.outgoing.close();
|
||||
delete this.peers[peer.id];
|
||||
@@ -446,12 +456,12 @@ export class SyncManager {
|
||||
}
|
||||
|
||||
if (entry.state === "loading") {
|
||||
console.log(
|
||||
"Waiting for loaded",
|
||||
msg.id,
|
||||
"after message from",
|
||||
peer.id,
|
||||
);
|
||||
// console.debug(
|
||||
// "Waiting for loaded",
|
||||
// msg.id,
|
||||
// "after message from",
|
||||
// peer.id,
|
||||
// );
|
||||
const loaded = await entry.done;
|
||||
// console.log("Loaded", msg.id, loaded);
|
||||
if (loaded === "unavailable") {
|
||||
@@ -651,11 +661,9 @@ export class SyncManager {
|
||||
console.error(
|
||||
"Failed to add transactions",
|
||||
msg.id,
|
||||
JSON.stringify(newTransactions, (k, v) =>
|
||||
k === "changes" || k === "encryptedChanges"
|
||||
? v.slice(0, 20) + "..."
|
||||
: v,
|
||||
),
|
||||
newTransactions.length + ' new transactions',
|
||||
'we have' + ourTotalnTxs,
|
||||
'they have' + theirTotalnTxs,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ test("Node replies with initial tx and header to empty subscribe", async () => {
|
||||
incoming: inRx,
|
||||
outgoing: outTx,
|
||||
role: "peer",
|
||||
crashOnClose: true,
|
||||
});
|
||||
|
||||
await inTx.push({
|
||||
@@ -109,6 +110,7 @@ test("Node replies with only new tx to subscribe with some known state", async (
|
||||
incoming: inRx,
|
||||
outgoing: outTx,
|
||||
role: "peer",
|
||||
crashOnClose: true,
|
||||
});
|
||||
|
||||
await inTx.push({
|
||||
@@ -182,6 +184,7 @@ test("After subscribing, node sends own known state and new txs to peer", async
|
||||
incoming: inRx,
|
||||
outgoing: outTx,
|
||||
role: "peer",
|
||||
crashOnClose: true,
|
||||
});
|
||||
|
||||
await inTx.push({
|
||||
@@ -294,6 +297,7 @@ test("Client replies with known new content to tellKnownState from server", asyn
|
||||
incoming: inRx,
|
||||
outgoing: outTx,
|
||||
role: "peer",
|
||||
crashOnClose: true,
|
||||
});
|
||||
|
||||
// expect((await outRxQ.next()).value).toMatchObject(groupStateEx(group));
|
||||
@@ -366,6 +370,7 @@ test("No matter the optimistic known state, node respects invalid known state me
|
||||
incoming: inRx,
|
||||
outgoing: outTx,
|
||||
role: "peer",
|
||||
crashOnClose: true,
|
||||
});
|
||||
|
||||
await inTx.push({
|
||||
@@ -463,6 +468,7 @@ test("If we add a peer, but it never subscribes to a coValue, it won't get any m
|
||||
incoming: inRx,
|
||||
outgoing: outTx,
|
||||
role: "peer",
|
||||
crashOnClose: true,
|
||||
});
|
||||
|
||||
map.set("hello", "world", "trusting");
|
||||
@@ -498,6 +504,7 @@ test.todo(
|
||||
incoming: inRx,
|
||||
outgoing: outTx,
|
||||
role: "server",
|
||||
crashOnClose: true,
|
||||
});
|
||||
|
||||
// expect((await outRxQ.next()).value).toMatchObject({
|
||||
@@ -573,6 +580,7 @@ test.skip("If we add a server peer, newly created coValues are auto-subscribed t
|
||||
incoming: inRx,
|
||||
outgoing: outTx,
|
||||
role: "server",
|
||||
crashOnClose: true,
|
||||
});
|
||||
|
||||
// expect((await outRxQ.next()).value).toMatchObject({
|
||||
@@ -627,6 +635,7 @@ test("When we connect a new server peer, we try to sync all existing coValues to
|
||||
incoming: inRx,
|
||||
outgoing: outTx,
|
||||
role: "server",
|
||||
crashOnClose: true,
|
||||
});
|
||||
|
||||
// const _adminSubscribeMessage = await outRxQ.next();
|
||||
@@ -662,6 +671,7 @@ test("When receiving a subscribe with a known state that is ahead of our own, pe
|
||||
incoming: inRx,
|
||||
outgoing: outTx,
|
||||
role: "peer",
|
||||
crashOnClose: true,
|
||||
});
|
||||
|
||||
await inTx.push({
|
||||
@@ -700,6 +710,7 @@ test.skip("When replaying creation and transactions of a coValue as new content,
|
||||
incoming: inRx1,
|
||||
outgoing: outTx1,
|
||||
role: "server",
|
||||
crashOnClose: true,
|
||||
});
|
||||
|
||||
const node2 = new LocalNode(admin, newRandomSessionID(admin.id), Crypto);
|
||||
@@ -713,6 +724,7 @@ test.skip("When replaying creation and transactions of a coValue as new content,
|
||||
incoming: inRx2,
|
||||
outgoing: outTx2,
|
||||
role: "client",
|
||||
crashOnClose: true,
|
||||
});
|
||||
|
||||
const adminSubscribeMessage = (await outRxQ1.next()).value;
|
||||
|
||||
@@ -1,5 +1,60 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.7.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.7.33
|
||||
- jazz-tools@0.7.33
|
||||
|
||||
## 0.7.33-hotfixes.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.7.33-hotfixes.5
|
||||
- jazz-tools@0.7.33-hotfixes.5
|
||||
|
||||
## 0.7.33-hotfixes.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.7.33-hotfixes.4
|
||||
- jazz-tools@0.7.33-hotfixes.4
|
||||
|
||||
## 0.7.33-hotfixes.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.7.33-hotfixes.3
|
||||
- jazz-tools@0.7.33-hotfixes.3
|
||||
|
||||
## 0.7.33-hotfixes.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.7.33-hotfixes.2
|
||||
|
||||
## 0.7.33-hotfixes.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.7.33-hotfixes.1
|
||||
|
||||
## 0.7.33-hotfixes.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.7.33-hotfixes.0
|
||||
- jazz-tools@0.7.33-hotfixes.0
|
||||
|
||||
## 0.7.32
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- jazz-tools@0.7.32
|
||||
- jazz-browser@0.7.32
|
||||
|
||||
## 0.7.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-browser-media-images",
|
||||
"version": "0.7.31",
|
||||
"version": "0.7.33",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
|
||||
@@ -1,5 +1,81 @@
|
||||
# jazz-browser
|
||||
|
||||
## 0.7.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fdde8db]
|
||||
- Updated dependencies [b297c93]
|
||||
- Updated dependencies [07fe2b9]
|
||||
- Updated dependencies [3bf5127]
|
||||
- Updated dependencies [a8b74ff]
|
||||
- Updated dependencies [db53161]
|
||||
- cojson-transport-ws@0.7.33
|
||||
- cojson@0.7.33
|
||||
- cojson-storage-indexeddb@0.7.33
|
||||
- jazz-tools@0.7.33
|
||||
|
||||
## 0.7.33-hotfixes.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.5
|
||||
- cojson-storage-indexeddb@0.7.33-hotfixes.5
|
||||
- cojson-transport-ws@0.7.33-hotfixes.5
|
||||
- jazz-tools@0.7.33-hotfixes.5
|
||||
|
||||
## 0.7.33-hotfixes.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.4
|
||||
- cojson-storage-indexeddb@0.7.33-hotfixes.4
|
||||
- cojson-transport-ws@0.7.33-hotfixes.4
|
||||
- jazz-tools@0.7.33-hotfixes.4
|
||||
|
||||
## 0.7.33-hotfixes.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson-storage-indexeddb@0.7.33-hotfixes.3
|
||||
- cojson-transport-ws@0.7.33-hotfixes.3
|
||||
- cojson@0.7.33-hotfixes.3
|
||||
- jazz-tools@0.7.33-hotfixes.3
|
||||
|
||||
## 0.7.33-hotfixes.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson-transport-ws@0.7.33-hotfixes.2
|
||||
|
||||
## 0.7.33-hotfixes.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson-transport-ws@0.7.33-hotfixes.1
|
||||
|
||||
## 0.7.33-hotfixes.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.0
|
||||
- cojson-storage-indexeddb@0.7.33-hotfixes.0
|
||||
- cojson-transport-ws@0.7.33-hotfixes.0
|
||||
- jazz-tools@0.7.33-hotfixes.0
|
||||
|
||||
## 0.7.32
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- jazz-tools@0.7.32
|
||||
|
||||
## 0.7.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-browser",
|
||||
"version": "0.7.31",
|
||||
"version": "0.7.33",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
|
||||
@@ -1,5 +1,76 @@
|
||||
# jazz-autosub
|
||||
|
||||
## 0.7.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fdde8db]
|
||||
- Updated dependencies [b297c93]
|
||||
- Updated dependencies [07fe2b9]
|
||||
- Updated dependencies [3bf5127]
|
||||
- Updated dependencies [a8b74ff]
|
||||
- Updated dependencies [db53161]
|
||||
- cojson-transport-ws@0.7.33
|
||||
- cojson@0.7.33
|
||||
- jazz-tools@0.7.33
|
||||
|
||||
## 0.7.33-hotfixes.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.5
|
||||
- cojson-transport-ws@0.7.33-hotfixes.5
|
||||
- jazz-tools@0.7.33-hotfixes.5
|
||||
|
||||
## 0.7.33-hotfixes.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.4
|
||||
- cojson-transport-ws@0.7.33-hotfixes.4
|
||||
- jazz-tools@0.7.33-hotfixes.4
|
||||
|
||||
## 0.7.33-hotfixes.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson-transport-ws@0.7.33-hotfixes.3
|
||||
- cojson@0.7.33-hotfixes.3
|
||||
- jazz-tools@0.7.33-hotfixes.3
|
||||
|
||||
## 0.7.33-hotfixes.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson-transport-ws@0.7.33-hotfixes.2
|
||||
|
||||
## 0.7.33-hotfixes.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson-transport-ws@0.7.33-hotfixes.1
|
||||
|
||||
## 0.7.33-hotfixes.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.0
|
||||
- cojson-transport-ws@0.7.33-hotfixes.0
|
||||
- jazz-tools@0.7.33-hotfixes.0
|
||||
|
||||
## 0.7.32
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- jazz-tools@0.7.32
|
||||
|
||||
## 0.7.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"types": "src/index.ts",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.7.31",
|
||||
"version": "0.7.33",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:*",
|
||||
"cojson-transport-ws": "workspace:*",
|
||||
|
||||
@@ -1,5 +1,73 @@
|
||||
# jazz-react
|
||||
|
||||
## 0.7.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [b297c93]
|
||||
- Updated dependencies [3bf5127]
|
||||
- Updated dependencies [a8b74ff]
|
||||
- Updated dependencies [db53161]
|
||||
- cojson@0.7.33
|
||||
- jazz-browser@0.7.33
|
||||
- jazz-tools@0.7.33
|
||||
|
||||
## 0.7.33-hotfixes.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.5
|
||||
- jazz-browser@0.7.33-hotfixes.5
|
||||
- jazz-tools@0.7.33-hotfixes.5
|
||||
|
||||
## 0.7.33-hotfixes.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.4
|
||||
- jazz-browser@0.7.33-hotfixes.4
|
||||
- jazz-tools@0.7.33-hotfixes.4
|
||||
|
||||
## 0.7.33-hotfixes.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.3
|
||||
- jazz-browser@0.7.33-hotfixes.3
|
||||
- jazz-tools@0.7.33-hotfixes.3
|
||||
|
||||
## 0.7.33-hotfixes.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.7.33-hotfixes.2
|
||||
|
||||
## 0.7.33-hotfixes.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.7.33-hotfixes.1
|
||||
|
||||
## 0.7.33-hotfixes.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.0
|
||||
- jazz-browser@0.7.33-hotfixes.0
|
||||
- jazz-tools@0.7.33-hotfixes.0
|
||||
|
||||
## 0.7.32
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- jazz-tools@0.7.32
|
||||
- jazz-browser@0.7.32
|
||||
|
||||
## 0.7.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react",
|
||||
"version": "0.7.31",
|
||||
"version": "0.7.33",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
|
||||
@@ -1,5 +1,76 @@
|
||||
# jazz-autosub
|
||||
|
||||
## 0.7.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fdde8db]
|
||||
- Updated dependencies [b297c93]
|
||||
- Updated dependencies [07fe2b9]
|
||||
- Updated dependencies [3bf5127]
|
||||
- Updated dependencies [a8b74ff]
|
||||
- Updated dependencies [db53161]
|
||||
- cojson-transport-ws@0.7.33
|
||||
- cojson@0.7.33
|
||||
- jazz-tools@0.7.33
|
||||
|
||||
## 0.7.33-hotfixes.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.5
|
||||
- cojson-transport-ws@0.7.33-hotfixes.5
|
||||
- jazz-tools@0.7.33-hotfixes.5
|
||||
|
||||
## 0.7.33-hotfixes.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.4
|
||||
- cojson-transport-ws@0.7.33-hotfixes.4
|
||||
- jazz-tools@0.7.33-hotfixes.4
|
||||
|
||||
## 0.7.33-hotfixes.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson-transport-ws@0.7.33-hotfixes.3
|
||||
- cojson@0.7.33-hotfixes.3
|
||||
- jazz-tools@0.7.33-hotfixes.3
|
||||
|
||||
## 0.7.33-hotfixes.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson-transport-ws@0.7.33-hotfixes.2
|
||||
|
||||
## 0.7.33-hotfixes.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson-transport-ws@0.7.33-hotfixes.1
|
||||
|
||||
## 0.7.33-hotfixes.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.0
|
||||
- cojson-transport-ws@0.7.33-hotfixes.0
|
||||
- jazz-tools@0.7.33-hotfixes.0
|
||||
|
||||
## 0.7.32
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- jazz-tools@0.7.32
|
||||
|
||||
## 0.7.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"bin": "./dist/index.js",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.7.31",
|
||||
"version": "0.7.33",
|
||||
"scripts": {
|
||||
"lint": "eslint . --ext ts,tsx",
|
||||
"format": "prettier --write './src/**/*.{ts,tsx}'",
|
||||
|
||||
@@ -1,5 +1,49 @@
|
||||
# jazz-autosub
|
||||
|
||||
## 0.7.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [b297c93]
|
||||
- Updated dependencies [3bf5127]
|
||||
- Updated dependencies [a8b74ff]
|
||||
- Updated dependencies [db53161]
|
||||
- cojson@0.7.33
|
||||
|
||||
## 0.7.33-hotfixes.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.5
|
||||
|
||||
## 0.7.33-hotfixes.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.4
|
||||
|
||||
## 0.7.33-hotfixes.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.3
|
||||
|
||||
## 0.7.33-hotfixes.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- cojson@0.7.33-hotfixes.0
|
||||
|
||||
## 0.7.32
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Adapt type of applyDiff to make CoMaps fully subclassable again
|
||||
|
||||
## 0.7.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"types": "./src/index.ts",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.7.31",
|
||||
"version": "0.7.33",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:*",
|
||||
"fast-check": "^3.17.2"
|
||||
|
||||
@@ -457,7 +457,7 @@ export class CoMap extends CoValueBase implements CoValue {
|
||||
return subscribeToExistingCoValue(this, depth, listener);
|
||||
}
|
||||
|
||||
applyDiff(newValues: Partial<CoMapInit<this>>) {
|
||||
applyDiff<N extends Partial<CoMapInit<this>>>(newValues: N) {
|
||||
for (const key in newValues) {
|
||||
if (Object.prototype.hasOwnProperty.call(newValues, key)) {
|
||||
const tKey = key as keyof typeof newValues & keyof this;
|
||||
@@ -466,7 +466,7 @@ export class CoMap extends CoValueBase implements CoValue {
|
||||
|
||||
if (tKey in this._schema) {
|
||||
const newValue = newValues[tKey];
|
||||
const currentValue = this[tKey];
|
||||
const currentValue = (this as unknown as N)[tKey];
|
||||
|
||||
if (descriptor === "json" || "encoded" in descriptor) {
|
||||
if (currentValue !== newValue) {
|
||||
|
||||
Reference in New Issue
Block a user