@evolu/nodejs 2.2.0 → 2.3.0
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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{Evolu → local-first}/Relay.d.ts +1 -1
- package/dist/local-first/Relay.d.ts.map +1 -0
- package/dist/{Evolu → local-first}/Relay.js +11 -7
- package/package.json +3 -3
- package/src/index.ts +1 -1
- package/src/{Evolu → local-first}/Relay.ts +9 -6
- package/dist/Evolu/Relay.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./BetterSqliteDriver.js";
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./local-first/Relay.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConsoleDep, CreateSqliteDriverDep, Result, SqliteError } from "@evolu/common";
|
|
2
|
-
import { Relay, RelayConfig } from "@evolu/common/
|
|
2
|
+
import { Relay, RelayConfig } from "@evolu/common/local-first";
|
|
3
3
|
export interface NodeJsRelayConfig extends RelayConfig {
|
|
4
4
|
/** The port number for the HTTP server. */
|
|
5
5
|
readonly port?: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Relay.d.ts","sourceRoot":"","sources":["../../src/local-first/Relay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,qBAAqB,EAKrB,MAAM,EAEN,WAAW,EAGZ,MAAM,eAAe,CAAC;AACvB,OAAO,EASL,KAAK,EACL,WAAW,EACZ,MAAM,2BAA2B,CAAC;AAOnC,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC3B,MAAM,UAAU,MAChB,QAAQ,iBAAiB,KAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAInD,CAAC;AAEf;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,GAC3C,MAAM,UAAU,GAAG,qBAAqB,MACxC,QAAQ,iBAAiB,KAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAKnD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRelation, createRandom, createSqlite, isAsync, ok, SimpleName, Uint8Array, } from "@evolu/common";
|
|
2
|
-
import { applyProtocolMessageAsRelay, createBaseSqliteStorageTables, createRelayLogger, createRelaySqliteStorage, createRelayStorageTables, defaultProtocolMessageMaxSize, parseOwnerIdFromOwnerWebSocketTransportUrl, } from "@evolu/common/
|
|
2
|
+
import { applyProtocolMessageAsRelay, createBaseSqliteStorageTables, createRelayLogger, createRelaySqliteStorage, createRelayStorageTables, defaultProtocolMessageMaxSize, parseOwnerIdFromOwnerWebSocketTransportUrl, } from "@evolu/common/local-first";
|
|
3
3
|
import { existsSync } from "fs";
|
|
4
4
|
import { createServer } from "http";
|
|
5
5
|
import { WebSocket, WebSocketServer } from "ws";
|
|
@@ -36,12 +36,16 @@ const createNodeJsRelayWithDeps = (deps) => async ({ port = 443, name = SimpleNa
|
|
|
36
36
|
return sqlite;
|
|
37
37
|
const depsWithSqlite = { ...deps, sqlite: sqlite.value };
|
|
38
38
|
if (!dbFileExists) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
{
|
|
40
|
+
const result = createBaseSqliteStorageTables(depsWithSqlite);
|
|
41
|
+
if (!result.ok)
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
{
|
|
45
|
+
const result = createRelayStorageTables(depsWithSqlite);
|
|
46
|
+
if (!result.ok)
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
50
|
const storage = createRelaySqliteStorage(depsWithSqlite)({
|
|
47
51
|
onStorageError: log.storageError,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evolu/nodejs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Evolu for Node.js",
|
|
5
5
|
"author": "Daniel Steigerwald <daniel@steigerwald.cz>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"shx": "^0.4.0",
|
|
31
31
|
"typescript": "^5.9.2",
|
|
32
32
|
"vitest": "^4.0.4",
|
|
33
|
-
"@evolu/common": "7.
|
|
33
|
+
"@evolu/common": "7.3.0",
|
|
34
34
|
"@evolu/tsconfig": "0.0.2"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@evolu/common": "^7.
|
|
37
|
+
"@evolu/common": "^7.3.0"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">=22.0.0"
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./BetterSqliteDriver.js";
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./local-first/Relay.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
parseOwnerIdFromOwnerWebSocketTransportUrl,
|
|
26
26
|
Relay,
|
|
27
27
|
RelayConfig,
|
|
28
|
-
} from "@evolu/common/
|
|
28
|
+
} from "@evolu/common/local-first";
|
|
29
29
|
import { existsSync } from "fs";
|
|
30
30
|
import { createServer } from "http";
|
|
31
31
|
import { WebSocket, WebSocketServer } from "ws";
|
|
@@ -87,11 +87,14 @@ const createNodeJsRelayWithDeps =
|
|
|
87
87
|
const depsWithSqlite = { ...deps, sqlite: sqlite.value };
|
|
88
88
|
|
|
89
89
|
if (!dbFileExists) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
{
|
|
91
|
+
const result = createBaseSqliteStorageTables(depsWithSqlite);
|
|
92
|
+
if (!result.ok) return result;
|
|
93
|
+
}
|
|
94
|
+
{
|
|
95
|
+
const result = createRelayStorageTables(depsWithSqlite);
|
|
96
|
+
if (!result.ok) return result;
|
|
97
|
+
}
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
const storage = createRelaySqliteStorage(depsWithSqlite)({
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Relay.d.ts","sourceRoot":"","sources":["../../src/Evolu/Relay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,qBAAqB,EAKrB,MAAM,EAEN,WAAW,EAGZ,MAAM,eAAe,CAAC;AACvB,OAAO,EASL,KAAK,EACL,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAO7B,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC3B,MAAM,UAAU,MAChB,QAAQ,iBAAiB,KAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAInD,CAAC;AAEf;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,GAC3C,MAAM,UAAU,GAAG,qBAAqB,MACxC,QAAQ,iBAAiB,KAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAKnD,CAAC"}
|