jazz-run 0.19.21 → 0.19.22
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/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# jazz-run
|
|
2
2
|
|
|
3
|
+
## 0.19.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3b70482: Wait for CoValues' dependencies to be garbage-collected before collecting them. This makes accounts and groups safe to be collected.
|
|
8
|
+
- Updated dependencies [89d8798]
|
|
9
|
+
- Updated dependencies [3b70482]
|
|
10
|
+
- Updated dependencies [30b5339]
|
|
11
|
+
- Updated dependencies [6078ea5]
|
|
12
|
+
- jazz-tools@0.19.22
|
|
13
|
+
- cojson@0.19.22
|
|
14
|
+
- jazz-webhook@0.19.22
|
|
15
|
+
- cojson-storage-sqlite@0.19.22
|
|
16
|
+
- cojson-transport-ws@0.19.22
|
|
17
|
+
|
|
3
18
|
## 0.19.19
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { IncomingMessage, ServerResponse } from "node:http";
|
|
1
2
|
import { CryptoProvider } from "cojson";
|
|
2
3
|
import { type SyncServer } from "./types.js";
|
|
3
|
-
export declare const startSyncServer: ({ host, port, inMemory, db, crypto, }: {
|
|
4
|
+
export declare const startSyncServer: ({ host, port, inMemory, db, crypto, middleware, }: {
|
|
4
5
|
host: string | undefined;
|
|
5
6
|
port: string | undefined;
|
|
6
7
|
inMemory: boolean;
|
|
7
8
|
db: string;
|
|
8
9
|
crypto?: CryptoProvider;
|
|
10
|
+
middleware?: (req: IncomingMessage, res: ServerResponse) => boolean;
|
|
9
11
|
}) => Promise<SyncServer>;
|
|
10
12
|
//# sourceMappingURL=startSyncServer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startSyncServer.d.ts","sourceRoot":"","sources":["../src/startSyncServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"startSyncServer.d.ts","sourceRoot":"","sources":["../src/startSyncServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG1E,OAAO,EAAE,cAAc,EAAa,MAAM,QAAQ,CAAC;AAKnD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,eAAe,sDAOzB;IACD,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC;CACrE,KAAG,OAAO,CAAC,UAAU,CAmGrB,CAAC"}
|
package/dist/startSyncServer.js
CHANGED
|
@@ -6,9 +6,12 @@ import { getBetterSqliteStorage } from "cojson-storage-sqlite";
|
|
|
6
6
|
import { createWebSocketPeer } from "cojson-transport-ws";
|
|
7
7
|
import { WasmCrypto } from "cojson/crypto/WasmCrypto";
|
|
8
8
|
import { WebSocketServer } from "ws";
|
|
9
|
-
export const startSyncServer = async ({ host, port, inMemory, db, crypto, }) => {
|
|
9
|
+
export const startSyncServer = async ({ host, port, inMemory, db, crypto, middleware, }) => {
|
|
10
10
|
crypto ?? (crypto = await WasmCrypto.create());
|
|
11
11
|
const server = createServer((req, res) => {
|
|
12
|
+
if (middleware?.(req, res)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
12
15
|
if (req.url === "/health") {
|
|
13
16
|
res.writeHead(200);
|
|
14
17
|
res.end("ok");
|
|
@@ -23,9 +26,7 @@ export const startSyncServer = async ({ host, port, inMemory, db, crypto, }) =>
|
|
|
23
26
|
const storage = getBetterSqliteStorage(db);
|
|
24
27
|
localNode.setStorage(storage);
|
|
25
28
|
}
|
|
26
|
-
localNode.enableGarbageCollector(
|
|
27
|
-
garbageCollectGroups: true,
|
|
28
|
-
});
|
|
29
|
+
localNode.enableGarbageCollector();
|
|
29
30
|
wss.on("connection", function connection(ws, req) {
|
|
30
31
|
// ping/pong for the connection liveness
|
|
31
32
|
const pinging = setInterval(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startSyncServer.js","sourceRoot":"","sources":["../src/startSyncServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"startSyncServer.js","sourceRoot":"","sources":["../src/startSyncServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAmC,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAkB,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAGrC,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,EACpC,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,EAAE,EACF,MAAM,EACN,UAAU,GAQX,EAAuB,EAAE;IACxB,MAAM,KAAN,MAAM,GAAK,MAAM,UAAU,CAAC,MAAM,EAAE,EAAC;IAErC,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACvC,IAAI,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;YAC3B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AG,MAAM,CAAC,KAAK,CAAC;IAE5B,MAAM,CAAC,KAAK,GAAG,GAAG,EAAE;QAClB,SAAS,CAAC,gBAAgB,EAAE,CAAC;QAE7B,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAEjE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAEvD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE;YAC5B,OAAO,CAAC,MAAoB,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"bin": "./dist/index.js",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.19.
|
|
6
|
+
"version": "0.19.22",
|
|
7
7
|
"exports": {
|
|
8
8
|
"./startSyncServer": {
|
|
9
9
|
"types": "./dist/startSyncServer.d.ts",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"@effect/printer-ansi": "^0.34.5",
|
|
22
22
|
"@effect/schema": "^0.71.1",
|
|
23
23
|
"@effect/typeclass": "^0.25.5",
|
|
24
|
-
"cojson": "0.19.
|
|
25
|
-
"cojson-storage-sqlite": "0.19.
|
|
26
|
-
"cojson-transport-ws": "0.19.
|
|
24
|
+
"cojson": "0.19.22",
|
|
25
|
+
"cojson-storage-sqlite": "0.19.22",
|
|
26
|
+
"cojson-transport-ws": "0.19.22",
|
|
27
27
|
"effect": "^3.6.5",
|
|
28
|
-
"jazz-tools": "0.19.
|
|
29
|
-
"jazz-webhook": "0.19.
|
|
28
|
+
"jazz-tools": "0.19.22",
|
|
29
|
+
"jazz-webhook": "0.19.22",
|
|
30
30
|
"ws": "^8.14.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
package/src/startSyncServer.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createServer } from "node:http";
|
|
1
|
+
import { createServer, IncomingMessage, ServerResponse } from "node:http";
|
|
2
2
|
import { mkdir } from "node:fs/promises";
|
|
3
3
|
import { dirname } from "node:path";
|
|
4
4
|
import { CryptoProvider, LocalNode } from "cojson";
|
|
@@ -14,16 +14,21 @@ export const startSyncServer = async ({
|
|
|
14
14
|
inMemory,
|
|
15
15
|
db,
|
|
16
16
|
crypto,
|
|
17
|
+
middleware,
|
|
17
18
|
}: {
|
|
18
19
|
host: string | undefined;
|
|
19
20
|
port: string | undefined;
|
|
20
21
|
inMemory: boolean;
|
|
21
22
|
db: string;
|
|
22
23
|
crypto?: CryptoProvider;
|
|
24
|
+
middleware?: (req: IncomingMessage, res: ServerResponse) => boolean;
|
|
23
25
|
}): Promise<SyncServer> => {
|
|
24
26
|
crypto ??= await WasmCrypto.create();
|
|
25
27
|
|
|
26
28
|
const server = createServer((req, res) => {
|
|
29
|
+
if (middleware?.(req, res)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
27
32
|
if (req.url === "/health") {
|
|
28
33
|
res.writeHead(200);
|
|
29
34
|
res.end("ok");
|
|
@@ -48,9 +53,7 @@ export const startSyncServer = async ({
|
|
|
48
53
|
localNode.setStorage(storage);
|
|
49
54
|
}
|
|
50
55
|
|
|
51
|
-
localNode.enableGarbageCollector(
|
|
52
|
-
garbageCollectGroups: true,
|
|
53
|
-
});
|
|
56
|
+
localNode.enableGarbageCollector();
|
|
54
57
|
|
|
55
58
|
wss.on("connection", function connection(ws, req) {
|
|
56
59
|
// ping/pong for the connection liveness
|