Compare commits

...

15 Commits

Author SHA1 Message Date
Anselm
b297c93b80 Release fixes 2024-08-19 15:08:08 +01:00
Anselm
d2e62e5b44 Reduce log level on loading message 2024-08-19 14:50:26 +01:00
Anselm
fe73ce7514 Make failed transaction log message leaner 2024-08-19 14:48:57 +01:00
Anselm Eickhoff
0fed16cea4 Merge pull request #323 from gardencmp/callumflack-jazz-240
fix: chat example URL
2024-08-19 11:15:39 +01:00
Callum Flack
08804ad435 fix: chat example URL 2024-08-19 11:03:33 +10:00
Anselm
79fa7724ad Release 2024-08-15 19:35:11 +01:00
Anselm
4604c2184a Adapt type of applyDiff to make CoMaps fully subclassable again 2024-08-15 19:34:47 +01:00
Anselm
11bac697fb Release 2024-08-15 19:23:19 +01:00
Anselm
96cec27f89 Close both ends of the peer on gracefulShutdown 2024-08-15 19:22:59 +01:00
Anselm
bcd412b8f9 Properly close connecting websockets 2024-08-15 19:22:19 +01:00
Anselm
6b456e2841 Properly close and delete peer on incoming disconnect/timeout 2024-08-15 19:10:22 +01:00
Anselm
1df72b3dc8 Reintroduce nomad example deploy, but only on main 2024-08-15 19:08:42 +01:00
Anselm
402d692739 Don't deploy examples to Nomad anymore 2024-08-15 17:02:40 +01:00
Anselm
fad46b2fb5 Release 2024-08-15 16:37:47 +01:00
Anselm
0153c80cf2 Immediately resolve an already-open websocket 2024-08-15 16:37:23 +01:00
35 changed files with 427 additions and 28 deletions

View File

@@ -0,0 +1,5 @@
---
"cojson": patch
---
Improve logging

24
.changeset/pre.json Normal file
View File

@@ -0,0 +1,24 @@
{
"mode": "pre",
"tag": "hotfixes",
"initialVersions": {
"jazz-example-chat": "0.0.79",
"jazz-inspector": "0.0.57",
"jazz-example-pets": "0.0.97",
"jazz-example-todo": "0.0.96",
"cojson": "0.7.31",
"cojson-storage-indexeddb": "0.7.31",
"cojson-storage-sqlite": "0.7.31",
"cojson-transport-ws": "0.7.31",
"hash-slash": "0.2.0",
"jazz-browser": "0.7.32",
"jazz-browser-media-images": "0.7.32",
"jazz-nodejs": "0.7.32",
"jazz-react": "0.7.32",
"jazz-run": "0.7.32",
"jazz-tools": "0.7.32"
},
"changesets": [
"bright-files-help"
]
}

View File

@@ -3,8 +3,6 @@ name: Build and Deploy
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build-examples:

View File

@@ -1,5 +1,37 @@
# jazz-example-chat
## 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
- Updated dependencies
- cojson@0.7.31
- jazz-react@0.7.31
- jazz-tools@0.7.31
## 0.0.77
### Patch Changes
- jazz-react@0.7.30
## 0.0.76
### Patch Changes

View File

@@ -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.

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-chat",
"private": true,
"version": "0.0.76",
"version": "0.0.80-hotfixes.0",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,29 @@
# jazz-example-chat
## 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
- Updated dependencies
- Updated dependencies
- cojson-transport-ws@0.7.31
- cojson@0.7.31
## 0.0.56
### Patch Changes
- Updated dependencies
- cojson-transport-ws@0.7.30
## 0.0.55
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-inspector",
"private": true,
"version": "0.0.55",
"version": "0.0.58-hotfixes.0",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,37 @@
# jazz-example-pets
## 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
- jazz-react@0.7.31
- jazz-tools@0.7.31
- jazz-browser-media-images@0.7.31
## 0.0.95
### Patch Changes
- jazz-browser-media-images@0.7.30
- jazz-react@0.7.30
## 0.0.94
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-pets",
"private": true,
"version": "0.0.94",
"version": "0.0.98-hotfixes.0",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,33 @@
# jazz-example-todo
## 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
- jazz-react@0.7.31
- jazz-tools@0.7.31
## 0.0.94
### Patch Changes
- jazz-react@0.7.30
## 0.0.93
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-todo",
"private": true,
"version": "0.0.93",
"version": "0.0.97-hotfixes.0",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,19 @@
# cojson-storage-indexeddb
## 0.7.33-hotfixes.0
### Patch Changes
- Updated dependencies
- cojson@0.7.33-hotfixes.0
## 0.7.31
### Patch Changes
- Updated dependencies
- cojson@0.7.31
## 0.7.29
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "cojson-storage-indexeddb",
"version": "0.7.29",
"version": "0.7.33-hotfixes.0",
"main": "dist/index.js",
"type": "module",
"types": "src/index.ts",

View File

@@ -1,5 +1,19 @@
# cojson-storage-sqlite
## 0.7.33-hotfixes.0
### Patch Changes
- Updated dependencies
- cojson@0.7.33-hotfixes.0
## 0.7.31
### Patch Changes
- Updated dependencies
- cojson@0.7.31
## 0.7.29
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "cojson-storage-sqlite",
"type": "module",
"version": "0.7.29",
"version": "0.7.33-hotfixes.0",
"main": "dist/index.js",
"types": "src/index.ts",
"license": "MIT",

View File

@@ -1,5 +1,26 @@
# cojson-transport-nodejs-ws
## 0.7.33-hotfixes.0
### Patch Changes
- Updated dependencies
- cojson@0.7.33-hotfixes.0
## 0.7.31
### Patch Changes
- Properly close connecting websockets
- Updated dependencies
- cojson@0.7.31
## 0.7.30
### Patch Changes
- Immediately resolve an already-open websocket
## 0.7.29
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "cojson-transport-ws",
"type": "module",
"version": "0.7.29",
"version": "0.7.33-hotfixes.0",
"main": "dist/index.js",
"types": "src/index.ts",
"license": "MIT",

View File

@@ -94,7 +94,11 @@ export function createWebSocketPeer({
});
const websocketOpen = new Promise<void>((resolve) => {
websocket.addEventListener("open", resolve, { once: true });
if (websocket.readyState === 1) {
resolve();
} else {
websocket.addEventListener("open", resolve, { once: true });
}
});
return {
@@ -108,7 +112,12 @@ export function createWebSocketPeer({
}
},
close() {
if (websocket.readyState === 1) {
console.log("Trying to close", id, websocket.readyState)
if (websocket.readyState === 0) {
websocket.addEventListener("open", function handleClose() {
websocket.close();
}, { once: true });
} else if (websocket.readyState == 1) {
websocket.close();
}
},

View File

@@ -1,5 +1,17 @@
# cojson
## 0.7.33-hotfixes.0
### Patch Changes
- Improve logging
## 0.7.31
### Patch Changes
- Close both ends of the peer on gracefulShutdown
## 0.7.29
### Patch Changes

View File

@@ -5,7 +5,7 @@
"types": "src/index.ts",
"type": "module",
"license": "MIT",
"version": "0.7.29",
"version": "0.7.33-hotfixes.0",
"devDependencies": {
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.2.1",

View File

@@ -394,6 +394,9 @@ export class SyncManager {
processMessages().catch((e) => {
console.error("Error processing messages from peer", peer.id, e);
}).finally(() => {
peer.outgoing.close();
delete this.peers[peer.id];
});
}
@@ -443,7 +446,7 @@ export class SyncManager {
}
if (entry.state === "loading") {
console.log(
console.debug(
"Waiting for loaded",
msg.id,
"after message from",
@@ -648,11 +651,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;
}
@@ -747,7 +748,11 @@ export class SyncManager {
gracefulShutdown() {
for (const peer of Object.values(this.peers)) {
console.debug("Gracefully closing", peer.id);
peer.outgoing.close();
peer.incoming = (async function* () {
yield "Disconnected" as const;
})();
}
}
}

View File

@@ -1,5 +1,33 @@
# jazz-browser-media-images
## 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
- jazz-browser@0.7.31
- jazz-tools@0.7.31
## 0.7.30
### Patch Changes
- jazz-browser@0.7.30
## 0.7.29
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-browser-media-images",
"version": "0.7.29",
"version": "0.7.33-hotfixes.0",
"type": "module",
"main": "dist/index.js",
"types": "src/index.ts",

View File

@@ -1,5 +1,40 @@
# jazz-browser
## 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
- Updated dependencies
- Updated dependencies
- cojson-transport-ws@0.7.31
- cojson@0.7.31
- cojson-storage-indexeddb@0.7.31
- jazz-tools@0.7.31
## 0.7.30
### Patch Changes
- Updated dependencies
- cojson-transport-ws@0.7.30
## 0.7.29
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-browser",
"version": "0.7.29",
"version": "0.7.33-hotfixes.0",
"type": "module",
"main": "dist/index.js",
"types": "src/index.ts",

View File

@@ -1,5 +1,38 @@
# jazz-autosub
## 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
- Updated dependencies
- Updated dependencies
- cojson-transport-ws@0.7.31
- cojson@0.7.31
- jazz-tools@0.7.31
## 0.7.30
### Patch Changes
- Updated dependencies
- cojson-transport-ws@0.7.30
## 0.7.29
### Patch Changes

View File

@@ -5,7 +5,7 @@
"types": "src/index.ts",
"type": "module",
"license": "MIT",
"version": "0.7.29",
"version": "0.7.33-hotfixes.0",
"dependencies": {
"cojson": "workspace:*",
"cojson-transport-ws": "workspace:*",

View File

@@ -1,5 +1,37 @@
# jazz-react
## 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
- Updated dependencies
- cojson@0.7.31
- jazz-browser@0.7.31
- jazz-tools@0.7.31
## 0.7.30
### Patch Changes
- jazz-browser@0.7.30
## 0.7.29
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-react",
"version": "0.7.29",
"version": "0.7.33-hotfixes.0",
"type": "module",
"main": "dist/index.js",
"types": "src/index.ts",

View File

@@ -1,5 +1,38 @@
# jazz-autosub
## 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
- Updated dependencies
- Updated dependencies
- cojson-transport-ws@0.7.31
- cojson@0.7.31
- jazz-tools@0.7.31
## 0.7.30
### Patch Changes
- Updated dependencies
- cojson-transport-ws@0.7.30
## 0.7.29
### Patch Changes

View File

@@ -3,7 +3,7 @@
"bin": "./dist/index.js",
"type": "module",
"license": "MIT",
"version": "0.7.29",
"version": "0.7.33-hotfixes.0",
"scripts": {
"lint": "eslint . --ext ts,tsx",
"format": "prettier --write './src/**/*.{ts,tsx}'",

View File

@@ -1,5 +1,25 @@
# jazz-autosub
## 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
- Updated dependencies
- cojson@0.7.31
## 0.7.29
### Patch Changes

View File

@@ -5,7 +5,7 @@
"types": "./src/index.ts",
"type": "module",
"license": "MIT",
"version": "0.7.29",
"version": "0.7.33-hotfixes.0",
"dependencies": {
"cojson": "workspace:*",
"fast-check": "^3.17.2"

View File

@@ -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) {