@smthrs/sync 1.0.0-rc.5 → 1.0.0-rc.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.
- package/README.md +6 -6
- package/dist/cjs/BranchRpcs.d.ts +2 -2
- package/dist/cjs/BranchRpcs.d.ts.map +1 -1
- package/dist/cjs/BranchRpcs.js +1 -1
- package/dist/cjs/BranchRpcs.js.map +2 -2
- package/dist/cjs/BranchServer.d.ts +2 -2
- package/dist/cjs/BranchServer.d.ts.map +1 -1
- package/dist/cjs/BranchServer.js.map +2 -2
- package/dist/cjs/SyncAuth.d.ts +1 -1
- package/dist/cjs/SyncAuth.d.ts.map +1 -1
- package/dist/cjs/SyncAuth.js +5 -5
- package/dist/cjs/SyncAuth.js.map +2 -2
- package/dist/cjs/SyncClient.d.ts +3 -3
- package/dist/cjs/SyncClient.d.ts.map +1 -1
- package/dist/cjs/SyncClient.js +2 -2
- package/dist/cjs/SyncClient.js.map +2 -2
- package/dist/cjs/SyncRpcs.d.ts +2 -2
- package/dist/cjs/SyncRpcs.d.ts.map +1 -1
- package/dist/cjs/SyncRpcs.js +1 -1
- package/dist/cjs/SyncRpcs.js.map +1 -1
- package/dist/cjs/SyncServer.d.ts +2 -2
- package/dist/cjs/SyncServer.d.ts.map +1 -1
- package/dist/cjs/SyncServer.js.map +2 -2
- package/dist/cjs/test/TestSocket.d.ts +1 -1
- package/dist/cjs/test/TestSocket.d.ts.map +1 -1
- package/dist/cjs/test/TestSocket.js +1 -1
- package/dist/cjs/test/TestSocket.js.map +1 -1
- package/dist/cjs/test/TestSync.d.ts +1 -1
- package/dist/cjs/test/TestSync.d.ts.map +1 -1
- package/dist/cjs/test/TestSync.js +6 -6
- package/dist/cjs/test/TestSync.js.map +1 -1
- package/dist/esm/BranchRpcs.d.ts +2 -2
- package/dist/esm/BranchRpcs.d.ts.map +1 -1
- package/dist/esm/BranchRpcs.js +1 -1
- package/dist/esm/BranchRpcs.js.map +1 -1
- package/dist/esm/BranchServer.d.ts +2 -2
- package/dist/esm/BranchServer.d.ts.map +1 -1
- package/dist/esm/BranchServer.js.map +1 -1
- package/dist/esm/SyncAuth.d.ts +1 -1
- package/dist/esm/SyncAuth.d.ts.map +1 -1
- package/dist/esm/SyncAuth.js +5 -5
- package/dist/esm/SyncAuth.js.map +1 -1
- package/dist/esm/SyncClient.d.ts +3 -3
- package/dist/esm/SyncClient.d.ts.map +1 -1
- package/dist/esm/SyncClient.js +2 -2
- package/dist/esm/SyncClient.js.map +1 -1
- package/dist/esm/SyncRpcs.d.ts +2 -2
- package/dist/esm/SyncRpcs.d.ts.map +1 -1
- package/dist/esm/SyncRpcs.js +1 -1
- package/dist/esm/SyncRpcs.js.map +1 -1
- package/dist/esm/SyncServer.d.ts +2 -2
- package/dist/esm/SyncServer.d.ts.map +1 -1
- package/dist/esm/SyncServer.js.map +1 -1
- package/dist/esm/test/TestSocket.d.ts +1 -1
- package/dist/esm/test/TestSocket.d.ts.map +1 -1
- package/dist/esm/test/TestSocket.js +1 -1
- package/dist/esm/test/TestSocket.js.map +1 -1
- package/dist/esm/test/TestSync.d.ts +1 -1
- package/dist/esm/test/TestSync.d.ts.map +1 -1
- package/dist/esm/test/TestSync.js +6 -6
- package/dist/esm/test/TestSync.js.map +1 -1
- package/docs/README.md +2 -2
- package/docs/guides/follow-a-run.md +4 -4
- package/docs/guides/serve-the-read-path.md +1 -1
- package/docs/installation.md +3 -3
- package/package.json +9 -9
- package/src/BranchRpcs.ts +1 -1
- package/src/BranchServer.ts +2 -2
- package/src/SyncAuth.ts +5 -5
- package/src/SyncClient.ts +3 -3
- package/src/SyncRpcs.ts +1 -1
- package/src/SyncServer.ts +2 -2
- package/src/test/TestSocket.ts +1 -1
- package/src/test/TestSync.ts +6 -6
|
@@ -42,7 +42,7 @@ face the same rules:
|
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
44
|
import { SyncRpcs } from "@smthrs/sync/SyncRpcs"
|
|
45
|
-
import * as RpcServer from "effect/
|
|
45
|
+
import * as RpcServer from "effect/rpc/RpcServer"
|
|
46
46
|
|
|
47
47
|
const mount = RpcServer.layer(SyncRpcs, { disableFatalDefects: true }).pipe(
|
|
48
48
|
Layer.provide(SyncServer.layerHandlers),
|
package/docs/installation.md
CHANGED
|
@@ -47,7 +47,7 @@ Node-only import. `@smthrs/sync/test/TestSocket` is an in-memory socket pair
|
|
|
47
47
|
and runs anywhere. Install the optional SQLite driver when using `TestSync`:
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
|
-
pnpm add @effect/sql-sqlite-node
|
|
50
|
+
pnpm add @effect/sql-sqlite-node
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
`@smthrs/sync/internal/*` is not exported. A path under it fails to resolve.
|
|
@@ -59,11 +59,11 @@ A follower needs a transport. `SyncClient.layer` derives its RPC client from
|
|
|
59
59
|
serialization:
|
|
60
60
|
|
|
61
61
|
```bash
|
|
62
|
-
pnpm add @effect/platform-node
|
|
62
|
+
pnpm add @effect/platform-node @effect/platform-node-shared
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
A browser follower needs no extra package: the WebSocket protocol and the JSON
|
|
66
|
-
serialization both come from `effect/
|
|
66
|
+
serialization both come from `effect/rpc`.
|
|
67
67
|
|
|
68
68
|
## What a server adds
|
|
69
69
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smthrs/sync",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.7",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"smthrs": {
|
|
7
7
|
"group": "engine"
|
|
@@ -265,19 +265,19 @@
|
|
|
265
265
|
"tag": "next"
|
|
266
266
|
},
|
|
267
267
|
"dependencies": {
|
|
268
|
-
"@smthrs/journal": "1.0.0-rc.
|
|
268
|
+
"@smthrs/journal": "1.0.0-rc.7"
|
|
269
269
|
},
|
|
270
270
|
"devDependencies": {
|
|
271
271
|
"@effect/language-service": "0.87.2",
|
|
272
|
-
"@effect/platform-node": "4.0.
|
|
273
|
-
"@effect/vitest": "4.0.
|
|
272
|
+
"@effect/platform-node": "4.0.4",
|
|
273
|
+
"@effect/vitest": "4.0.4",
|
|
274
274
|
"@eslint/js": "9.39.5",
|
|
275
|
-
"@smthrs/database": "1.0.0-rc.
|
|
276
|
-
"@smthrs/engine-store": "1.0.0-rc.
|
|
275
|
+
"@smthrs/database": "1.0.0-rc.7",
|
|
276
|
+
"@smthrs/engine-store": "1.0.0-rc.7",
|
|
277
277
|
"@types/node": "26.4.1",
|
|
278
278
|
"@vitest/coverage-v8": "5.0.0",
|
|
279
279
|
"dprint": "0.57.1",
|
|
280
|
-
"effect": "4.0.
|
|
280
|
+
"effect": "4.0.4",
|
|
281
281
|
"esbuild": "0.28.2",
|
|
282
282
|
"eslint": "9.39.5",
|
|
283
283
|
"eslint-import-resolver-typescript": "4.4.5",
|
|
@@ -288,11 +288,11 @@
|
|
|
288
288
|
"typescript": "5.9.3",
|
|
289
289
|
"typescript-eslint": "8.69.0",
|
|
290
290
|
"vitest": "5.0.0",
|
|
291
|
-
"@smthrs/time-travel": "1.0.0-rc.
|
|
291
|
+
"@smthrs/time-travel": "1.0.0-rc.7",
|
|
292
292
|
"fast-check": "4.9.0"
|
|
293
293
|
},
|
|
294
294
|
"peerDependencies": {
|
|
295
|
-
"effect": "4.0.
|
|
295
|
+
"effect": "^4.0.4"
|
|
296
296
|
},
|
|
297
297
|
"scripts": {
|
|
298
298
|
"lint": "eslint src --max-warnings=0 && dprint check",
|
package/src/BranchRpcs.ts
CHANGED
package/src/BranchServer.ts
CHANGED
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
import * as Clock from "effect/Clock"
|
|
20
20
|
import * as Effect from "effect/Effect"
|
|
21
21
|
import type * as Layer from "effect/Layer"
|
|
22
|
+
import type * as Rpc from "effect/rpc/Rpc"
|
|
23
|
+
import type * as RpcGroup from "effect/rpc/RpcGroup"
|
|
22
24
|
import * as Stream from "effect/Stream"
|
|
23
|
-
import type * as Rpc from "effect/unstable/rpc/Rpc"
|
|
24
|
-
import type * as RpcGroup from "effect/unstable/rpc/RpcGroup"
|
|
25
25
|
import * as BranchCommands from "./BranchCommands.ts"
|
|
26
26
|
import * as BranchIds from "./BranchIds.ts"
|
|
27
27
|
import * as BranchPresence from "./BranchPresence.ts"
|
package/src/SyncAuth.ts
CHANGED
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import * as Effect from "effect/Effect"
|
|
24
|
-
import * as
|
|
24
|
+
import * as Base64Url from "effect/encoding/Base64Url"
|
|
25
|
+
import * as Headers from "effect/http/Headers"
|
|
25
26
|
import * as Layer from "effect/Layer"
|
|
26
27
|
import * as Result from "effect/Result"
|
|
28
|
+
import * as RpcMiddleware from "effect/rpc/RpcMiddleware"
|
|
27
29
|
import * as Schema from "effect/Schema"
|
|
28
|
-
import * as Headers from "effect/unstable/http/Headers"
|
|
29
|
-
import * as RpcMiddleware from "effect/unstable/rpc/RpcMiddleware"
|
|
30
30
|
import { causeText } from "./internal/CauseText.ts"
|
|
31
31
|
import * as shareSigner from "./internal/ShareSigner.ts"
|
|
32
32
|
import { SyncError } from "./SyncError.ts"
|
|
@@ -65,7 +65,7 @@ export const encodeCapability = (
|
|
|
65
65
|
cause: causeText(encoded.failure)
|
|
66
66
|
})
|
|
67
67
|
)
|
|
68
|
-
: Effect.succeed(
|
|
68
|
+
: Effect.succeed(Base64Url.encode(JSON.stringify(encoded.success)))
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
@@ -76,7 +76,7 @@ export const encodeCapability = (
|
|
|
76
76
|
* @since 0.1.0
|
|
77
77
|
*/
|
|
78
78
|
export const decodeCapability = (value: string): Effect.Effect<WorkspaceShare.WorkspaceCapability, SyncError> => {
|
|
79
|
-
const text =
|
|
79
|
+
const text = Base64Url.decodeString(value)
|
|
80
80
|
if (Result.isFailure(text)) {
|
|
81
81
|
return Effect.fail(denied("The workspace capability header is not a capability"))
|
|
82
82
|
}
|
package/src/SyncClient.ts
CHANGED
|
@@ -10,12 +10,12 @@ import * as Context from "effect/Context"
|
|
|
10
10
|
import * as Effect from "effect/Effect"
|
|
11
11
|
import * as Layer from "effect/Layer"
|
|
12
12
|
import * as Ref from "effect/Ref"
|
|
13
|
+
import * as RpcClient from "effect/rpc/RpcClient"
|
|
14
|
+
import * as RpcClientError from "effect/rpc/RpcClientError"
|
|
15
|
+
import type * as RpcGroup from "effect/rpc/RpcGroup"
|
|
13
16
|
import * as Schedule from "effect/Schedule"
|
|
14
17
|
import * as Schema from "effect/Schema"
|
|
15
18
|
import * as Stream from "effect/Stream"
|
|
16
|
-
import * as RpcClient from "effect/unstable/rpc/RpcClient"
|
|
17
|
-
import * as RpcClientError from "effect/unstable/rpc/RpcClientError"
|
|
18
|
-
import type * as RpcGroup from "effect/unstable/rpc/RpcGroup"
|
|
19
19
|
import type { ShareCapability } from "./BranchProtocol.ts"
|
|
20
20
|
import * as Admission from "./internal/Admission.ts"
|
|
21
21
|
import { boundedText, causeCode, causeText } from "./internal/CauseText.ts"
|
package/src/SyncRpcs.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @since 0.1.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { Rpc, RpcGroup, RpcMiddleware } from "effect/
|
|
7
|
+
import { Rpc, RpcGroup, RpcMiddleware } from "effect/rpc"
|
|
8
8
|
import { SyncError } from "./SyncError.ts"
|
|
9
9
|
import { Frame, ReadRequest, ReadResponse, Snapshot, SnapshotRequest, SubscribeRequest } from "./SyncProtocol.ts"
|
|
10
10
|
|
package/src/SyncServer.ts
CHANGED
|
@@ -13,9 +13,9 @@ import * as Effect from "effect/Effect"
|
|
|
13
13
|
import * as Layer from "effect/Layer"
|
|
14
14
|
import * as Option from "effect/Option"
|
|
15
15
|
import * as PubSub from "effect/PubSub"
|
|
16
|
+
import type * as Rpc from "effect/rpc/Rpc"
|
|
17
|
+
import type * as RpcGroup from "effect/rpc/RpcGroup"
|
|
16
18
|
import * as Stream from "effect/Stream"
|
|
17
|
-
import type * as Rpc from "effect/unstable/rpc/Rpc"
|
|
18
|
-
import type * as RpcGroup from "effect/unstable/rpc/RpcGroup"
|
|
19
19
|
import { type BranchId, branchOfRunId, type ShareCapability, type ShareClaims } from "./BranchProtocol.ts"
|
|
20
20
|
import * as BranchShare from "./BranchShare.ts"
|
|
21
21
|
import * as Admission from "./internal/Admission.ts"
|
package/src/test/TestSocket.ts
CHANGED
|
@@ -9,7 +9,7 @@ import * as Effect from "effect/Effect"
|
|
|
9
9
|
import * as Latch from "effect/Latch"
|
|
10
10
|
import * as Queue from "effect/Queue"
|
|
11
11
|
import * as Scope from "effect/Scope"
|
|
12
|
-
import * as Socket from "effect/
|
|
12
|
+
import * as Socket from "effect/socket/Socket"
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* A predicate or byte transformation installed between the two socket ends.
|
package/src/test/TestSync.ts
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
import * as TestJournal from "@smthrs/journal/test/TestJournal"
|
|
8
8
|
import * as Effect from "effect/Effect"
|
|
9
9
|
import * as Layer from "effect/Layer"
|
|
10
|
-
import * as NetAddress from "effect/
|
|
11
|
-
import * as RpcClient from "effect/
|
|
12
|
-
import * as RpcSerialization from "effect/
|
|
13
|
-
import * as RpcServer from "effect/
|
|
14
|
-
import * as Socket from "effect/
|
|
15
|
-
import * as SocketServer from "effect/
|
|
10
|
+
import * as NetAddress from "effect/net/NetAddress"
|
|
11
|
+
import * as RpcClient from "effect/rpc/RpcClient"
|
|
12
|
+
import * as RpcSerialization from "effect/rpc/RpcSerialization"
|
|
13
|
+
import * as RpcServer from "effect/rpc/RpcServer"
|
|
14
|
+
import * as Socket from "effect/socket/Socket"
|
|
15
|
+
import * as SocketServer from "effect/socket/SocketServer"
|
|
16
16
|
import * as RunCatalog from "../RunCatalog.ts"
|
|
17
17
|
import * as SyncClient from "../SyncClient.ts"
|
|
18
18
|
import * as SyncPrincipal from "../SyncPrincipal.ts"
|