@smthrs/sync 0.0.0-stage → 1.0.0-rc.4

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.
Files changed (266) hide show
  1. package/CHANGELOG.md +208 -0
  2. package/LICENSE +21 -0
  3. package/README.md +208 -2
  4. package/dist/cjs/BranchCommands.d.ts +228 -0
  5. package/dist/cjs/BranchCommands.d.ts.map +1 -0
  6. package/dist/cjs/BranchCommands.js +316 -0
  7. package/dist/cjs/BranchCommands.js.map +7 -0
  8. package/dist/cjs/BranchIds.d.ts +65 -0
  9. package/dist/cjs/BranchIds.d.ts.map +1 -0
  10. package/dist/cjs/BranchIds.js +53 -0
  11. package/dist/cjs/BranchIds.js.map +7 -0
  12. package/dist/cjs/BranchPresence.d.ts +195 -0
  13. package/dist/cjs/BranchPresence.d.ts.map +1 -0
  14. package/dist/cjs/BranchPresence.js +276 -0
  15. package/dist/cjs/BranchPresence.js.map +7 -0
  16. package/dist/cjs/BranchProjection.d.ts +179 -0
  17. package/dist/cjs/BranchProjection.d.ts.map +1 -0
  18. package/dist/cjs/BranchProjection.js +197 -0
  19. package/dist/cjs/BranchProjection.js.map +7 -0
  20. package/dist/cjs/BranchProtocol.d.ts +415 -0
  21. package/dist/cjs/BranchProtocol.d.ts.map +1 -0
  22. package/dist/cjs/BranchProtocol.js +172 -0
  23. package/dist/cjs/BranchProtocol.js.map +7 -0
  24. package/dist/cjs/BranchRpcs.d.ts +177 -0
  25. package/dist/cjs/BranchRpcs.d.ts.map +1 -0
  26. package/dist/cjs/BranchRpcs.js +85 -0
  27. package/dist/cjs/BranchRpcs.js.map +7 -0
  28. package/dist/cjs/BranchServer.d.ts +55 -0
  29. package/dist/cjs/BranchServer.d.ts.map +1 -0
  30. package/dist/cjs/BranchServer.js +147 -0
  31. package/dist/cjs/BranchServer.js.map +7 -0
  32. package/dist/cjs/BranchShare.d.ts +159 -0
  33. package/dist/cjs/BranchShare.d.ts.map +1 -0
  34. package/dist/cjs/BranchShare.js +147 -0
  35. package/dist/cjs/BranchShare.js.map +7 -0
  36. package/dist/cjs/RunCatalog.d.ts +207 -0
  37. package/dist/cjs/RunCatalog.d.ts.map +1 -0
  38. package/dist/cjs/RunCatalog.js +122 -0
  39. package/dist/cjs/RunCatalog.js.map +7 -0
  40. package/dist/cjs/SyncAuth.d.ts +70 -0
  41. package/dist/cjs/SyncAuth.d.ts.map +1 -0
  42. package/dist/cjs/SyncAuth.js +109 -0
  43. package/dist/cjs/SyncAuth.js.map +7 -0
  44. package/dist/cjs/SyncClient.d.ts +274 -0
  45. package/dist/cjs/SyncClient.d.ts.map +1 -0
  46. package/dist/cjs/SyncClient.js +474 -0
  47. package/dist/cjs/SyncClient.js.map +7 -0
  48. package/dist/cjs/SyncError.d.ts +107 -0
  49. package/dist/cjs/SyncError.d.ts.map +1 -0
  50. package/dist/cjs/SyncError.js +110 -0
  51. package/dist/cjs/SyncError.js.map +7 -0
  52. package/dist/cjs/SyncPrincipal.d.ts +100 -0
  53. package/dist/cjs/SyncPrincipal.d.ts.map +1 -0
  54. package/dist/cjs/SyncPrincipal.js +48 -0
  55. package/dist/cjs/SyncPrincipal.js.map +7 -0
  56. package/dist/cjs/SyncProtocol.d.ts +592 -0
  57. package/dist/cjs/SyncProtocol.d.ts.map +1 -0
  58. package/dist/cjs/SyncProtocol.js +165 -0
  59. package/dist/cjs/SyncProtocol.js.map +7 -0
  60. package/dist/cjs/SyncRpcs.d.ts +92 -0
  61. package/dist/cjs/SyncRpcs.d.ts.map +1 -0
  62. package/dist/cjs/SyncRpcs.js +35 -0
  63. package/dist/cjs/SyncRpcs.js.map +7 -0
  64. package/dist/cjs/SyncServer.d.ts +184 -0
  65. package/dist/cjs/SyncServer.d.ts.map +1 -0
  66. package/dist/cjs/SyncServer.js +513 -0
  67. package/dist/cjs/SyncServer.js.map +7 -0
  68. package/dist/cjs/WorkspaceShare.d.ts +174 -0
  69. package/dist/cjs/WorkspaceShare.d.ts.map +1 -0
  70. package/dist/cjs/WorkspaceShare.js +149 -0
  71. package/dist/cjs/WorkspaceShare.js.map +7 -0
  72. package/dist/cjs/index.d.ts +91 -0
  73. package/dist/cjs/index.d.ts.map +1 -0
  74. package/dist/cjs/index.js +67 -0
  75. package/dist/cjs/index.js.map +7 -0
  76. package/dist/cjs/internal/Admission.d.ts +43 -0
  77. package/dist/cjs/internal/Admission.d.ts.map +1 -0
  78. package/dist/cjs/internal/Admission.js +90 -0
  79. package/dist/cjs/internal/Admission.js.map +7 -0
  80. package/dist/cjs/internal/CauseText.d.ts +55 -0
  81. package/dist/cjs/internal/CauseText.d.ts.map +1 -0
  82. package/dist/cjs/internal/CauseText.js +38 -0
  83. package/dist/cjs/internal/CauseText.js.map +7 -0
  84. package/dist/cjs/internal/JournalErrorCode.d.ts +23 -0
  85. package/dist/cjs/internal/JournalErrorCode.d.ts.map +1 -0
  86. package/dist/cjs/internal/JournalErrorCode.js +34 -0
  87. package/dist/cjs/internal/JournalErrorCode.js.map +7 -0
  88. package/dist/cjs/internal/PolicyOptions.d.ts +57 -0
  89. package/dist/cjs/internal/PolicyOptions.d.ts.map +1 -0
  90. package/dist/cjs/internal/PolicyOptions.js +62 -0
  91. package/dist/cjs/internal/PolicyOptions.js.map +7 -0
  92. package/dist/cjs/internal/ProtocolVersion.d.ts +17 -0
  93. package/dist/cjs/internal/ProtocolVersion.d.ts.map +1 -0
  94. package/dist/cjs/internal/ProtocolVersion.js +44 -0
  95. package/dist/cjs/internal/ProtocolVersion.js.map +7 -0
  96. package/dist/cjs/internal/ShareSigner.d.ts +173 -0
  97. package/dist/cjs/internal/ShareSigner.d.ts.map +1 -0
  98. package/dist/cjs/internal/ShareSigner.js +150 -0
  99. package/dist/cjs/internal/ShareSigner.js.map +7 -0
  100. package/dist/cjs/internal/SnapshotBoundary.d.ts +17 -0
  101. package/dist/cjs/internal/SnapshotBoundary.d.ts.map +1 -0
  102. package/dist/cjs/internal/SnapshotBoundary.js +97 -0
  103. package/dist/cjs/internal/SnapshotBoundary.js.map +7 -0
  104. package/dist/cjs/package.json +1 -0
  105. package/dist/cjs/test/TestSocket.d.ts +55 -0
  106. package/dist/cjs/test/TestSocket.d.ts.map +1 -0
  107. package/dist/cjs/test/TestSocket.js +145 -0
  108. package/dist/cjs/test/TestSocket.js.map +7 -0
  109. package/dist/cjs/test/TestSync.d.ts +54 -0
  110. package/dist/cjs/test/TestSync.d.ts.map +1 -0
  111. package/dist/cjs/test/TestSync.js +96 -0
  112. package/dist/cjs/test/TestSync.js.map +7 -0
  113. package/dist/esm/BranchCommands.d.ts +228 -0
  114. package/dist/esm/BranchCommands.d.ts.map +1 -0
  115. package/dist/esm/BranchCommands.js +496 -0
  116. package/dist/esm/BranchCommands.js.map +1 -0
  117. package/dist/esm/BranchIds.d.ts +65 -0
  118. package/dist/esm/BranchIds.d.ts.map +1 -0
  119. package/dist/esm/BranchIds.js +61 -0
  120. package/dist/esm/BranchIds.js.map +1 -0
  121. package/dist/esm/BranchPresence.d.ts +195 -0
  122. package/dist/esm/BranchPresence.d.ts.map +1 -0
  123. package/dist/esm/BranchPresence.js +361 -0
  124. package/dist/esm/BranchPresence.js.map +1 -0
  125. package/dist/esm/BranchProjection.d.ts +179 -0
  126. package/dist/esm/BranchProjection.d.ts.map +1 -0
  127. package/dist/esm/BranchProjection.js +269 -0
  128. package/dist/esm/BranchProjection.js.map +1 -0
  129. package/dist/esm/BranchProtocol.d.ts +415 -0
  130. package/dist/esm/BranchProtocol.d.ts.map +1 -0
  131. package/dist/esm/BranchProtocol.js +323 -0
  132. package/dist/esm/BranchProtocol.js.map +1 -0
  133. package/dist/esm/BranchRpcs.d.ts +177 -0
  134. package/dist/esm/BranchRpcs.d.ts.map +1 -0
  135. package/dist/esm/BranchRpcs.js +103 -0
  136. package/dist/esm/BranchRpcs.js.map +1 -0
  137. package/dist/esm/BranchServer.d.ts +55 -0
  138. package/dist/esm/BranchServer.d.ts.map +1 -0
  139. package/dist/esm/BranchServer.js +168 -0
  140. package/dist/esm/BranchServer.js.map +1 -0
  141. package/dist/esm/BranchShare.d.ts +159 -0
  142. package/dist/esm/BranchShare.d.ts.map +1 -0
  143. package/dist/esm/BranchShare.js +213 -0
  144. package/dist/esm/BranchShare.js.map +1 -0
  145. package/dist/esm/RunCatalog.d.ts +207 -0
  146. package/dist/esm/RunCatalog.d.ts.map +1 -0
  147. package/dist/esm/RunCatalog.js +196 -0
  148. package/dist/esm/RunCatalog.js.map +1 -0
  149. package/dist/esm/SyncAuth.d.ts +70 -0
  150. package/dist/esm/SyncAuth.d.ts.map +1 -0
  151. package/dist/esm/SyncAuth.js +119 -0
  152. package/dist/esm/SyncAuth.js.map +1 -0
  153. package/dist/esm/SyncClient.d.ts +274 -0
  154. package/dist/esm/SyncClient.d.ts.map +1 -0
  155. package/dist/esm/SyncClient.js +586 -0
  156. package/dist/esm/SyncClient.js.map +1 -0
  157. package/dist/esm/SyncError.d.ts +107 -0
  158. package/dist/esm/SyncError.d.ts.map +1 -0
  159. package/dist/esm/SyncError.js +133 -0
  160. package/dist/esm/SyncError.js.map +1 -0
  161. package/dist/esm/SyncPrincipal.d.ts +100 -0
  162. package/dist/esm/SyncPrincipal.d.ts.map +1 -0
  163. package/dist/esm/SyncPrincipal.js +58 -0
  164. package/dist/esm/SyncPrincipal.js.map +1 -0
  165. package/dist/esm/SyncProtocol.d.ts +592 -0
  166. package/dist/esm/SyncProtocol.d.ts.map +1 -0
  167. package/dist/esm/SyncProtocol.js +434 -0
  168. package/dist/esm/SyncProtocol.js.map +1 -0
  169. package/dist/esm/SyncRpcs.d.ts +92 -0
  170. package/dist/esm/SyncRpcs.d.ts.map +1 -0
  171. package/dist/esm/SyncRpcs.js +35 -0
  172. package/dist/esm/SyncRpcs.js.map +1 -0
  173. package/dist/esm/SyncServer.d.ts +184 -0
  174. package/dist/esm/SyncServer.d.ts.map +1 -0
  175. package/dist/esm/SyncServer.js +897 -0
  176. package/dist/esm/SyncServer.js.map +1 -0
  177. package/dist/esm/WorkspaceShare.d.ts +174 -0
  178. package/dist/esm/WorkspaceShare.d.ts.map +1 -0
  179. package/dist/esm/WorkspaceShare.js +208 -0
  180. package/dist/esm/WorkspaceShare.js.map +1 -0
  181. package/dist/esm/index.d.ts +91 -0
  182. package/dist/esm/index.d.ts.map +1 -0
  183. package/dist/esm/index.js +91 -0
  184. package/dist/esm/index.js.map +1 -0
  185. package/dist/esm/internal/Admission.d.ts +43 -0
  186. package/dist/esm/internal/Admission.d.ts.map +1 -0
  187. package/dist/esm/internal/Admission.js +80 -0
  188. package/dist/esm/internal/Admission.js.map +1 -0
  189. package/dist/esm/internal/CauseText.d.ts +55 -0
  190. package/dist/esm/internal/CauseText.d.ts.map +1 -0
  191. package/dist/esm/internal/CauseText.js +67 -0
  192. package/dist/esm/internal/CauseText.js.map +1 -0
  193. package/dist/esm/internal/JournalErrorCode.d.ts +23 -0
  194. package/dist/esm/internal/JournalErrorCode.d.ts.map +1 -0
  195. package/dist/esm/internal/JournalErrorCode.js +44 -0
  196. package/dist/esm/internal/JournalErrorCode.js.map +1 -0
  197. package/dist/esm/internal/PolicyOptions.d.ts +57 -0
  198. package/dist/esm/internal/PolicyOptions.d.ts.map +1 -0
  199. package/dist/esm/internal/PolicyOptions.js +70 -0
  200. package/dist/esm/internal/PolicyOptions.js.map +1 -0
  201. package/dist/esm/internal/ProtocolVersion.d.ts +17 -0
  202. package/dist/esm/internal/ProtocolVersion.d.ts.map +1 -0
  203. package/dist/esm/internal/ProtocolVersion.js +24 -0
  204. package/dist/esm/internal/ProtocolVersion.js.map +1 -0
  205. package/dist/esm/internal/ShareSigner.d.ts +173 -0
  206. package/dist/esm/internal/ShareSigner.d.ts.map +1 -0
  207. package/dist/esm/internal/ShareSigner.js +219 -0
  208. package/dist/esm/internal/ShareSigner.js.map +1 -0
  209. package/dist/esm/internal/SnapshotBoundary.d.ts +17 -0
  210. package/dist/esm/internal/SnapshotBoundary.d.ts.map +1 -0
  211. package/dist/esm/internal/SnapshotBoundary.js +68 -0
  212. package/dist/esm/internal/SnapshotBoundary.js.map +1 -0
  213. package/dist/esm/test/TestSocket.d.ts +55 -0
  214. package/dist/esm/test/TestSocket.d.ts.map +1 -0
  215. package/dist/esm/test/TestSocket.js +128 -0
  216. package/dist/esm/test/TestSocket.js.map +1 -0
  217. package/dist/esm/test/TestSync.d.ts +54 -0
  218. package/dist/esm/test/TestSync.d.ts.map +1 -0
  219. package/dist/esm/test/TestSync.js +76 -0
  220. package/dist/esm/test/TestSync.js.map +1 -0
  221. package/docs/README.md +156 -0
  222. package/docs/api.md +328 -0
  223. package/docs/concepts/authorization.md +117 -0
  224. package/docs/concepts/branches.md +195 -0
  225. package/docs/concepts/compaction.md +144 -0
  226. package/docs/concepts/replay-then-follow.md +129 -0
  227. package/docs/concepts/scopes-and-cursors.md +135 -0
  228. package/docs/guides/authorize-a-connection.md +174 -0
  229. package/docs/guides/follow-a-run.md +174 -0
  230. package/docs/guides/handle-a-compacted-run.md +158 -0
  231. package/docs/guides/list-workspace-runs.md +120 -0
  232. package/docs/guides/run-a-long-soak.md +80 -0
  233. package/docs/guides/serve-the-read-path.md +146 -0
  234. package/docs/guides/test-a-follower.md +273 -0
  235. package/docs/installation.md +92 -0
  236. package/docs/protocol.md +183 -0
  237. package/docs/quickstart.md +159 -0
  238. package/docs/troubleshooting.md +234 -0
  239. package/package.json +304 -3
  240. package/src/BranchCommands.ts +684 -0
  241. package/src/BranchIds.ts +76 -0
  242. package/src/BranchPresence.ts +512 -0
  243. package/src/BranchProjection.ts +308 -0
  244. package/src/BranchProtocol.ts +411 -0
  245. package/src/BranchRpcs.ts +163 -0
  246. package/src/BranchServer.ts +202 -0
  247. package/src/BranchShare.ts +297 -0
  248. package/src/RunCatalog.ts +308 -0
  249. package/src/SyncAuth.ts +146 -0
  250. package/src/SyncClient.ts +902 -0
  251. package/src/SyncError.ts +147 -0
  252. package/src/SyncPrincipal.ts +115 -0
  253. package/src/SyncProtocol.ts +594 -0
  254. package/src/SyncRpcs.ts +40 -0
  255. package/src/SyncServer.ts +1184 -0
  256. package/src/WorkspaceShare.ts +292 -0
  257. package/src/index.ts +107 -0
  258. package/src/internal/Admission.ts +119 -0
  259. package/src/internal/CauseText.ts +74 -0
  260. package/src/internal/JournalErrorCode.ts +46 -0
  261. package/src/internal/PolicyOptions.ts +97 -0
  262. package/src/internal/ProtocolVersion.ts +28 -0
  263. package/src/internal/ShareSigner.ts +300 -0
  264. package/src/internal/SnapshotBoundary.ts +91 -0
  265. package/src/test/TestSocket.ts +192 -0
  266. package/src/test/TestSync.ts +113 -0
@@ -0,0 +1,119 @@
1
+ /**
2
+ * The sync read path's connection authentication: implementations of the
3
+ * `SyncRpcs.SyncAuth` RPC middleware.
4
+ *
5
+ * A connection presents a {@link WorkspaceShare.WorkspaceCapability} in the
6
+ * {@link capabilityHeader} request header. {@link layer} verifies it against
7
+ * the workspace's {@link WorkspaceShare.WorkspaceShare} authority and runs
8
+ * the handler as the workspace principal. A request with no header runs as
9
+ * the anonymous principal — branch share capabilities carried in request
10
+ * payloads still authorize branch reads — and the server refuses anonymous
11
+ * access to every non-branch run. A request whose header is present but
12
+ * malformed, forged, expired, or signed by an unknown key is refused
13
+ * outright: presence of a credential is a claim, and a false claim is never
14
+ * downgraded to anonymity.
15
+ *
16
+ * There is deliberately no trusted pass-through implementation here: the only
17
+ * sanctioned bypass is an in-process caller providing `SyncPrincipal` itself,
18
+ * never a transport.
19
+ *
20
+ * @since 0.1.0
21
+ */
22
+ import * as Effect from "effect/Effect";
23
+ import * as Encoding from "effect/Encoding";
24
+ import * as Layer from "effect/Layer";
25
+ import * as Result from "effect/Result";
26
+ import * as Schema from "effect/Schema";
27
+ import * as Headers from "effect/unstable/http/Headers";
28
+ import * as RpcMiddleware from "effect/unstable/rpc/RpcMiddleware";
29
+ import { causeText } from "./internal/CauseText.js";
30
+ import * as shareSigner from "./internal/ShareSigner.js";
31
+ import { SyncError } from "./SyncError.js";
32
+ import * as SyncPrincipal from "./SyncPrincipal.js";
33
+ import { SyncAuth } from "./SyncRpcs.js";
34
+ import * as WorkspaceShare from "./WorkspaceShare.js";
35
+ /**
36
+ * The request header a connection presents its workspace capability in.
37
+ *
38
+ * @category constants
39
+ * @since 0.1.0
40
+ */
41
+ export const capabilityHeader = "flows-sync-workspace";
42
+ const denied = shareSigner.unauthorized;
43
+ /**
44
+ * Renders a workspace capability as its header value: unpadded base64url of
45
+ * the schema-encoded capability JSON.
46
+ *
47
+ * @category encoding
48
+ * @since 0.1.0
49
+ */
50
+ export const encodeCapability = (capability) => {
51
+ const encoded = Schema.encodeUnknownResult(WorkspaceShare.WorkspaceCapability)(capability);
52
+ return Result.isFailure(encoded)
53
+ ? Effect.fail(new SyncError({
54
+ code: "invalid_request",
55
+ message: "The workspace capability does not encode",
56
+ // The rendering, never the parse failure itself: a schema issue
57
+ // carries the value it rejected, and the value here is a credential.
58
+ cause: causeText(encoded.failure)
59
+ }))
60
+ : Effect.succeed(Encoding.encodeBase64Url(JSON.stringify(encoded.success)));
61
+ };
62
+ /**
63
+ * Decodes a capability header value. Every malformation folds to the same
64
+ * `unauthorized` refusal so the header is not a parsing oracle.
65
+ *
66
+ * @category encoding
67
+ * @since 0.1.0
68
+ */
69
+ export const decodeCapability = (value) => {
70
+ const text = Encoding.decodeBase64UrlString(value);
71
+ if (Result.isFailure(text)) {
72
+ return Effect.fail(denied("The workspace capability header is not a capability"));
73
+ }
74
+ let parsed;
75
+ try {
76
+ parsed = JSON.parse(text.success);
77
+ }
78
+ catch {
79
+ return Effect.fail(denied("The workspace capability header is not a capability"));
80
+ }
81
+ const decoded = Schema.decodeUnknownResult(WorkspaceShare.WorkspaceCapability)(parsed);
82
+ return Result.isFailure(decoded)
83
+ ? Effect.fail(denied("The workspace capability header is not a capability"))
84
+ : Effect.succeed(decoded.success);
85
+ };
86
+ /**
87
+ * Provides the workspace-capability authentication middleware: no header
88
+ * runs the handler as anonymous, a verified header runs it as the workspace
89
+ * principal, and anything else refuses the request. Verification faults
90
+ * (Web Crypto failing) propagate as their own error rather than as a
91
+ * refusal.
92
+ *
93
+ * @category layers
94
+ * @since 0.1.0
95
+ */
96
+ export const layer = Layer.effect(SyncAuth, Effect.gen(function* () {
97
+ const share = yield* WorkspaceShare.WorkspaceShare;
98
+ const middleware = (effect, options) => {
99
+ const header = Headers.get(options.headers, capabilityHeader);
100
+ if (header._tag === "None") {
101
+ return Effect.provideService(effect, SyncPrincipal.SyncPrincipal, SyncPrincipal.anonymous);
102
+ }
103
+ return decodeCapability(header.value).pipe(Effect.flatMap((capability) => share.verify(capability, { access: "read" })), Effect.flatMap((claims) => Effect.provideService(effect, SyncPrincipal.SyncPrincipal,
104
+ // The signed expiry travels WITH the identity. A handler that
105
+ // opens a stream authorizes once; reducing the verified claims to
106
+ // a capability id here left the stream with nothing to expire on.
107
+ SyncPrincipal.workspace(claims.capabilityId, claims.expiresAtMs))));
108
+ };
109
+ return middleware;
110
+ }));
111
+ /**
112
+ * Stamps every outgoing request from a generated RPC client with the given
113
+ * workspace capability.
114
+ *
115
+ * @category layers
116
+ * @since 0.1.0
117
+ */
118
+ export const layerClient = (capability) => RpcMiddleware.layerClient(SyncAuth, Effect.map(encodeCapability(capability), (header) => ({ next, request }) => next({ ...request, headers: Headers.set(request.headers, capabilityHeader, header) })));
119
+ //# sourceMappingURL=SyncAuth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyncAuth.js","sourceRoot":"","sources":["../../src/SyncAuth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAA;AACvD,OAAO,KAAK,aAAa,MAAM,mCAA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C,CAAC,UAAU,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,EAC5E,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CACxB,MAAM,CAAC,cAAc,CACnB,MAAM,EACN,aAAa,CAAC,aAAa;QAC3B,8DAA8D;QAC9D,kEAAkE;QAClE,kEAAkE;QAClE,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,CACjE,CACF,CACF,CAAA;IACH,CAAC,CAAA;IACD,OAAO,UAAU,CAAA;AACnB,CAAC,CAAC,CACH,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,UAA8C,EACa,EAAE,CAC7D,aAAa,CAAC,WAAW,CACvB,QAAQ,EACR,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CACzE,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CACzF,CAAA","sourcesContent":["/**\n * The sync read path's connection authentication: implementations of the\n * `SyncRpcs.SyncAuth` RPC middleware.\n *\n * A connection presents a {@link WorkspaceShare.WorkspaceCapability} in the\n * {@link capabilityHeader} request header. {@link layer} verifies it against\n * the workspace's {@link WorkspaceShare.WorkspaceShare} authority and runs\n * the handler as the workspace principal. A request with no header runs as\n * the anonymous principal — branch share capabilities carried in request\n * payloads still authorize branch reads — and the server refuses anonymous\n * access to every non-branch run. A request whose header is present but\n * malformed, forged, expired, or signed by an unknown key is refused\n * outright: presence of a credential is a claim, and a false claim is never\n * downgraded to anonymity.\n *\n * There is deliberately no trusted pass-through implementation here: the only\n * sanctioned bypass is an in-process caller providing `SyncPrincipal` itself,\n * never a transport.\n *\n * @since 0.1.0\n */\n\nimport * as Effect from \"effect/Effect\"\nimport * as Encoding from \"effect/Encoding\"\nimport * as Layer from \"effect/Layer\"\nimport * as Result from \"effect/Result\"\nimport * as Schema from \"effect/Schema\"\nimport * as Headers from \"effect/unstable/http/Headers\"\nimport * as RpcMiddleware from \"effect/unstable/rpc/RpcMiddleware\"\nimport { causeText } from \"./internal/CauseText.ts\"\nimport * as shareSigner from \"./internal/ShareSigner.ts\"\nimport { SyncError } from \"./SyncError.ts\"\nimport * as SyncPrincipal from \"./SyncPrincipal.ts\"\nimport { SyncAuth } from \"./SyncRpcs.ts\"\nimport * as WorkspaceShare from \"./WorkspaceShare.ts\"\n\n/**\n * The request header a connection presents its workspace capability in.\n *\n * @category constants\n * @since 0.1.0\n */\nexport const capabilityHeader = \"flows-sync-workspace\"\n\nconst denied = shareSigner.unauthorized\n\n/**\n * Renders a workspace capability as its header value: unpadded base64url of\n * the schema-encoded capability JSON.\n *\n * @category encoding\n * @since 0.1.0\n */\nexport const encodeCapability = (\n capability: WorkspaceShare.WorkspaceCapability\n): Effect.Effect<string, SyncError> => {\n const encoded = Schema.encodeUnknownResult(WorkspaceShare.WorkspaceCapability)(capability)\n return Result.isFailure(encoded)\n ? Effect.fail(\n new SyncError({\n code: \"invalid_request\",\n message: \"The workspace capability does not encode\",\n // The rendering, never the parse failure itself: a schema issue\n // carries the value it rejected, and the value here is a credential.\n cause: causeText(encoded.failure)\n })\n )\n : Effect.succeed(Encoding.encodeBase64Url(JSON.stringify(encoded.success)))\n}\n\n/**\n * Decodes a capability header value. Every malformation folds to the same\n * `unauthorized` refusal so the header is not a parsing oracle.\n *\n * @category encoding\n * @since 0.1.0\n */\nexport const decodeCapability = (value: string): Effect.Effect<WorkspaceShare.WorkspaceCapability, SyncError> => {\n const text = Encoding.decodeBase64UrlString(value)\n if (Result.isFailure(text)) {\n return Effect.fail(denied(\"The workspace capability header is not a capability\"))\n }\n let parsed: unknown\n try {\n parsed = JSON.parse(text.success)\n } catch {\n return Effect.fail(denied(\"The workspace capability header is not a capability\"))\n }\n const decoded = Schema.decodeUnknownResult(WorkspaceShare.WorkspaceCapability)(parsed)\n return Result.isFailure(decoded)\n ? Effect.fail(denied(\"The workspace capability header is not a capability\"))\n : Effect.succeed(decoded.success)\n}\n\n/**\n * Provides the workspace-capability authentication middleware: no header\n * runs the handler as anonymous, a verified header runs it as the workspace\n * principal, and anything else refuses the request. Verification faults\n * (Web Crypto failing) propagate as their own error rather than as a\n * refusal.\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layer: Layer.Layer<SyncAuth, never, WorkspaceShare.WorkspaceShare> = Layer.effect(\n SyncAuth,\n Effect.gen(function*() {\n const share = yield* WorkspaceShare.WorkspaceShare\n const middleware: RpcMiddleware.RpcMiddleware<never, SyncError, never> = (effect, options) => {\n const header = Headers.get(options.headers, capabilityHeader)\n if (header._tag === \"None\") {\n return Effect.provideService(effect, SyncPrincipal.SyncPrincipal, SyncPrincipal.anonymous)\n }\n return decodeCapability(header.value).pipe(\n Effect.flatMap((capability) => share.verify(capability, { access: \"read\" })),\n Effect.flatMap((claims) =>\n Effect.provideService(\n effect,\n SyncPrincipal.SyncPrincipal,\n // The signed expiry travels WITH the identity. A handler that\n // opens a stream authorizes once; reducing the verified claims to\n // a capability id here left the stream with nothing to expire on.\n SyncPrincipal.workspace(claims.capabilityId, claims.expiresAtMs)\n )\n )\n )\n }\n return middleware\n })\n)\n\n/**\n * Stamps every outgoing request from a generated RPC client with the given\n * workspace capability.\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layerClient = (\n capability: WorkspaceShare.WorkspaceCapability\n): Layer.Layer<RpcMiddleware.ForClient<SyncAuth>, SyncError> =>\n RpcMiddleware.layerClient(\n SyncAuth,\n Effect.map(encodeCapability(capability), (header) => ({ next, request }) =>\n next({ ...request, headers: Headers.set(request.headers, capabilityHeader, header) }))\n )\n"]}
@@ -0,0 +1,274 @@
1
+ /**
2
+ * Browser-safe client for replaying and following journal entries.
3
+ *
4
+ * @since 0.1.0
5
+ */
6
+ import type * as JournalEvent from "@smthrs/journal/JournalEvent";
7
+ import * as Context from "effect/Context";
8
+ import * as Effect from "effect/Effect";
9
+ import * as Layer from "effect/Layer";
10
+ import * as Stream from "effect/Stream";
11
+ import * as RpcClient from "effect/unstable/rpc/RpcClient";
12
+ import * as RpcClientError from "effect/unstable/rpc/RpcClientError";
13
+ import type * as RpcGroup from "effect/unstable/rpc/RpcGroup";
14
+ import type { ShareCapability } from "./BranchProtocol.ts";
15
+ import { SyncError, SyncGapError } from "./SyncError.ts";
16
+ import { type Progress, type Resync, RunCursor, type Scope, type Snapshot, type SnapshotRequest, type WorkspaceCursor } from "./SyncProtocol.ts";
17
+ import { SyncRpcs } from "./SyncRpcs.ts";
18
+ /**
19
+ * Frames one subscription round may carry before the follow replenishes it.
20
+ *
21
+ * A subscription's `credit` is a hard frame limit the server enforces with
22
+ * `Stream.take`, so the number the client sends is the size of its window, not
23
+ * a hint. At `credit: 1` the window closed after every single entry and the
24
+ * follow resubscribed: following a run that emits a hundred entries cost a
25
+ * hundred subscribe round trips, each of them a fresh cursor snapshot and a
26
+ * fresh server-side fan-out. Replenishing 256 frames at a time makes the
27
+ * round-trip cost proportional to the window rather than to the traffic, and
28
+ * keeps it bounded — an unbounded window would hand the server one
29
+ * never-closing subscription per follower.
30
+ *
31
+ * @category constants
32
+ * @since 0.1.0
33
+ */
34
+ export declare const defaultCredit = 256;
35
+ /**
36
+ * Entries one catch-up page asks for.
37
+ *
38
+ * Bootstrap is the replay half of replay-then-follow, so the page size is the
39
+ * memory one catch-up costs and the granularity at which its cursor advances.
40
+ * It matches {@link defaultCredit} and stays under
41
+ * `SyncProtocol.maxReadLimit`, which is the ceiling the server enforces.
42
+ *
43
+ * @category constants
44
+ * @since 1.0.0-rc.0
45
+ */
46
+ export declare const defaultBootstrapLimit = 256;
47
+ /**
48
+ * The policy one sync client runs every operation under.
49
+ *
50
+ * Both fields are validated by {@link makeWith} and {@link layerWith}, so a
51
+ * value that is not a positive safe integer fails the constructor rather than
52
+ * disabling the bound it configures.
53
+ *
54
+ * @category models
55
+ * @since 1.0.0-rc.0
56
+ */
57
+ export interface Options {
58
+ /**
59
+ * Largest summed encoded-entry size one frame or bootstrap page may carry,
60
+ * in bytes. Defaults to {@link defaultMaxFrameBytes}.
61
+ */
62
+ readonly maxFrameBytes?: number | undefined;
63
+ /**
64
+ * Entries one catch-up page asks for. Defaults to
65
+ * {@link defaultBootstrapLimit}, and may not exceed
66
+ * `SyncProtocol.maxReadLimit`.
67
+ */
68
+ readonly bootstrapLimit?: number | undefined;
69
+ }
70
+ /**
71
+ * Input accepted by a sync subscription.
72
+ *
73
+ * `capability` authorizes branch reads: following a shared branch's run
74
+ * requires a capability that verifies for that branch on the server.
75
+ *
76
+ * `EApply` and `EResync` are the consumer's own failure types for `apply` and
77
+ * `onResync`. The subscription fails with them unchanged, so an application
78
+ * failure is never dressed as a transport or protocol {@link SyncError}.
79
+ *
80
+ * @category models
81
+ * @since 0.1.0
82
+ */
83
+ export interface SubscribeOptions<EApply = never, EResync = never> {
84
+ readonly scope: Scope;
85
+ /**
86
+ * Where this subscription starts, per run. The effective position is the
87
+ * LATER of this and the client's matching progress map (applied when an
88
+ * apply callback is present, delivered otherwise), so a caller
89
+ * ahead of the shared view keeps its place and a caller behind it is
90
+ * fast-forwarded. Rebuild from an earlier position with a fresh client.
91
+ */
92
+ readonly cursors: WorkspaceCursor;
93
+ readonly capability?: ShareCapability;
94
+ /**
95
+ * Frames one subscription round may carry before the follow replenishes the
96
+ * window. Defaults to {@link defaultCredit}, and must be a positive integer
97
+ * no greater than `SyncProtocol.maxSubscribeCredit`.
98
+ */
99
+ readonly credit?: number | undefined;
100
+ /**
101
+ * Applies one entry, and DEFINES what this subscription's cursor means.
102
+ *
103
+ * Without it the cursor advances as each entry is handed to the consumer,
104
+ * so a consumer whose own application then fails has a cursor naming an
105
+ * entry it never materialized. With it the cursor advances only after this
106
+ * effect succeeds, and records it in `Progress.applied`. A failure here
107
+ * fails the subscription with the entry unacknowledged, so the
108
+ * next applying subscription delivers it again; the effect must
109
+ * therefore be idempotent, because a redelivery is exactly what a retry is.
110
+ */
111
+ readonly apply?: ((entry: JournalEvent.Entry) => Effect.Effect<void, EApply>) | undefined;
112
+ /**
113
+ * Restores state when the server refuses a cursor below a compaction floor.
114
+ * Return the exact run and sequence actually restored, after applying it.
115
+ *
116
+ * The entries under the floor are deleted. Fetch an explicitly public
117
+ * projection through `snapshot` or an authorized local source; a
118
+ * projection has a real hole to fill. The returned sequence must cover the
119
+ * requested floor; a newer snapshot resumes at its own sequence, not the
120
+ * older floor. Missing handlers, failures, interruption, and invalid receipts
121
+ * leave the cursor unmoved. There is no implicit skip of deleted history.
122
+ *
123
+ * Durable consumers must commit their restored state and durable cursor in
124
+ * their own transaction and seed a fresh client from that cursor on restart.
125
+ * This client's cursor is in memory, not an atomic cross-store transaction.
126
+ * Recovery must be idempotent, including when a newer compaction requires
127
+ * another restoration before the suffix can be read.
128
+ */
129
+ readonly onResync?: ((resync: Resync) => Effect.Effect<RunCursor, EResync>) | undefined;
130
+ }
131
+ /**
132
+ * Replicated journal subscription operations.
133
+ *
134
+ * @category models
135
+ * @since 0.1.0
136
+ */
137
+ export interface Service {
138
+ /** Fetches a public snapshot without applying state or advancing a cursor. */
139
+ readonly snapshot: (request: SnapshotRequest) => Effect.Effect<Snapshot, SyncError>;
140
+ /** Replays then follows `options.scope`, also failing with the callbacks' own errors. */
141
+ readonly subscribe: <EApply = never, EResync = never>(options: SubscribeOptions<EApply, EResync>) => Stream.Stream<JournalEvent.Entry, SyncError | SyncGapError | EApply | EResync>;
142
+ /**
143
+ * Delivery and application positions. `delivered` is a transport bookmark
144
+ * only; `applied` is what the `apply` and `onResync` callbacks acknowledged.
145
+ */
146
+ readonly progress: Effect.Effect<Progress>;
147
+ }
148
+ declare const SyncClient_base: Context.ServiceClass<SyncClient, "@smthrs/sync/SyncClient", Service>;
149
+ /**
150
+ * The browser-safe journal replication client.
151
+ *
152
+ * @category services
153
+ * @since 1.0.0-rc.0
154
+ */
155
+ export declare class SyncClient extends SyncClient_base {
156
+ }
157
+ /**
158
+ * The client tag's former name, kept for one release.
159
+ *
160
+ * @deprecated Use {@link SyncClient}.
161
+ * @category services
162
+ * @since 0.1.0
163
+ */
164
+ export declare const Sync: typeof SyncClient;
165
+ /**
166
+ * The client tag's former name, kept for one release.
167
+ *
168
+ * @deprecated Use {@link SyncClient}.
169
+ * @category services
170
+ * @since 0.1.0
171
+ */
172
+ export type Sync = SyncClient;
173
+ /**
174
+ * Constructs a closed sync stub, optionally overriding individual operations.
175
+ *
176
+ * @category constructors
177
+ * @since 0.1.0
178
+ */
179
+ export declare const makeNoop: (overrides?: Partial<Service>) => Service;
180
+ /**
181
+ * Provides a closed sync stub.
182
+ *
183
+ * @category layers
184
+ * @since 0.1.0
185
+ */
186
+ export declare const layerNoop: (overrides?: Partial<Service>) => Layer.Layer<SyncClient>;
187
+ type Client = RpcClient.RpcClient<RpcGroup.Rpcs<typeof SyncRpcs>, RpcClientError.RpcClientError>;
188
+ /**
189
+ * Projects a Sync RPC client into the local replication service.
190
+ *
191
+ * Delivered and applied cursors are separate per-service `Ref` maps: concurrent
192
+ * subscriptions for one materialization share them, and each commit advances
193
+ * its matching map monotonically. A
194
+ * cursor advances in the same stream pull that admits each entry to the
195
+ * consumer, or — when the caller supplies `SubscribeOptions.apply` — only
196
+ * after that callback has applied the entry. Interrupted partial pages
197
+ * therefore retain the last admitted entry rather than incorrectly
198
+ * acknowledging the server's whole page.
199
+ *
200
+ * A frame or bootstrap page whose encoded entries exceed `maxFrameBytes` is
201
+ * refused with `frame_too_large`. Out-of-scope entries, repeated or reordered
202
+ * sequences, and missing response generations fail with `protocol_violation`
203
+ * before delivery. Each entry-bearing run in a Read page must have exactly one
204
+ * explicit generation cursor, and every entry must be above the requested
205
+ * cursor. Live frames instead drop already-covered entries and deliver only
206
+ * the suffix above the cursor. An incomplete bootstrap page with no entries
207
+ * or a completed subscription window with no frames fails with
208
+ * `protocol_violation` instead of reopening immediately.
209
+ *
210
+ * A live follow that loses its transport reconnects under
211
+ * {@link reconnectPolicy}, resuming from the acknowledged cursors; the failure
212
+ * cause is logged before the retry folds it. The follow spends a credit window
213
+ * of {@link defaultCredit} frames per subscription round and replenishes it by
214
+ * resubscribing from the cursors it has acknowledged. Already-covered entries
215
+ * are not delivered again; the round-trip cost scales with credit windows.
216
+ *
217
+ * A `compacted` refusal fails closed unless `SubscribeOptions.onResync`
218
+ * restores the missing prefix and returns its exact cursor. Snapshot fetching
219
+ * never applies state or advances cursors. Only a validated receipt for the requested run at or
220
+ * above its compaction floor advances the cursor before reading the suffix.
221
+ *
222
+ * A subscription's effective cursor per run is the LATER of the caller's and
223
+ * the matching progress map: a caller that restored its own progress is never
224
+ * regressed, and a caller asking for history this client already acknowledged
225
+ * is fast-forwarded. Rebuild a projection from an earlier position with a
226
+ * fresh client, whose acknowledged map is empty.
227
+ *
228
+ * This constructor carries the default policy, which is valid by
229
+ * construction and so cannot fail. {@link makeWith} takes an explicit
230
+ * {@link Options} and validates it.
231
+ *
232
+ * @category constructors
233
+ * @since 0.1.0
234
+ */
235
+ export declare const make: ({ client }: {
236
+ readonly client: Client;
237
+ }) => Effect.Effect<Service>;
238
+ /**
239
+ * Constructs the sync client under an explicit policy.
240
+ *
241
+ * Every option is validated here, once, so a client either exists under a
242
+ * policy it can serve or never exists at all. Validating on each `subscribe`
243
+ * and each `snapshot` instead accepted a `maxFrameBytes` of `NaN` at
244
+ * construction and then refused every operation under it, which reported a
245
+ * composition's mistake as a run-time failure of the follow. This mirrors
246
+ * `SyncServer.makeLiveWith` and `BranchCommands.makeLiveWith`.
247
+ *
248
+ * `SubscribeOptions.credit` is a REQUEST count rather than a client policy, so
249
+ * it is still checked where the request is built.
250
+ *
251
+ * @category constructors
252
+ * @since 1.0.0-rc.0
253
+ */
254
+ export declare const makeWith: ({ bootstrapLimit, client, maxFrameBytes }: Options & {
255
+ readonly client: Client;
256
+ }) => Effect.Effect<Service, SyncError>;
257
+ /**
258
+ * Provides the sync client from the active RPC protocol.
259
+ *
260
+ * @category layers
261
+ * @since 0.1.0
262
+ */
263
+ export declare const layer: Layer.Layer<SyncClient, never, RpcClient.Protocol>;
264
+ /**
265
+ * Provides the sync client under an explicit policy. Fails with
266
+ * `invalid_request` when an option is not a positive safe integer, so a bad
267
+ * policy fails the composition rather than every operation under it.
268
+ *
269
+ * @category layers
270
+ * @since 1.0.0-rc.0
271
+ */
272
+ export declare const layerWith: (options: Options) => Layer.Layer<SyncClient, SyncError, RpcClient.Protocol>;
273
+ export {};
274
+ //# sourceMappingURL=SyncClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyncClient.d.ts","sourceRoot":"","sources":["../../src/SyncClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,YAAY,MAAM,8BAA8B,CAAA;AAEjE,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAIrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAA;AAC1D,OAAO,KAAK,cAAc,MAAM,oCAAoC,CAAA;AACpE,OAAO,KAAK,KAAK,QAAQ,MAAM,8BAA8B,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAK1D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EASL,KAAK,QAAQ,EAIb,KAAK,MAAM,EACX,SAAS,EACT,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,eAAe,EACrB,MAAM,mBAAm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