@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,67 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var index_exports = {};
30
+ __export(index_exports, {
31
+ BranchCommands: () => BranchCommands,
32
+ BranchIds: () => BranchIds,
33
+ BranchPresence: () => BranchPresence,
34
+ BranchProjection: () => BranchProjection,
35
+ BranchProtocol: () => BranchProtocol,
36
+ BranchRpcs: () => BranchRpcs,
37
+ BranchServer: () => BranchServer,
38
+ BranchShare: () => BranchShare,
39
+ RunCatalog: () => RunCatalog,
40
+ SyncAuth: () => SyncAuth,
41
+ SyncClient: () => SyncClient,
42
+ SyncError: () => SyncError,
43
+ SyncPrincipal: () => SyncPrincipal,
44
+ SyncProtocol: () => SyncProtocol,
45
+ SyncRpcs: () => SyncRpcs,
46
+ SyncServer: () => SyncServer,
47
+ WorkspaceShare: () => WorkspaceShare
48
+ });
49
+ module.exports = __toCommonJS(index_exports);
50
+ var SyncError = __toESM(require("./SyncError.js"), 1);
51
+ var SyncProtocol = __toESM(require("./SyncProtocol.js"), 1);
52
+ var BranchProtocol = __toESM(require("./BranchProtocol.js"), 1);
53
+ var BranchProjection = __toESM(require("./BranchProjection.js"), 1);
54
+ var SyncRpcs = __toESM(require("./SyncRpcs.js"), 1);
55
+ var BranchRpcs = __toESM(require("./BranchRpcs.js"), 1);
56
+ var RunCatalog = __toESM(require("./RunCatalog.js"), 1);
57
+ var SyncServer = __toESM(require("./SyncServer.js"), 1);
58
+ var SyncClient = __toESM(require("./SyncClient.js"), 1);
59
+ var BranchShare = __toESM(require("./BranchShare.js"), 1);
60
+ var WorkspaceShare = __toESM(require("./WorkspaceShare.js"), 1);
61
+ var SyncPrincipal = __toESM(require("./SyncPrincipal.js"), 1);
62
+ var SyncAuth = __toESM(require("./SyncAuth.js"), 1);
63
+ var BranchPresence = __toESM(require("./BranchPresence.js"), 1);
64
+ var BranchCommands = __toESM(require("./BranchCommands.js"), 1);
65
+ var BranchServer = __toESM(require("./BranchServer.js"), 1);
66
+ var BranchIds = __toESM(require("./BranchIds.js"), 1);
67
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "sourcesContent": ["/**\n * Read-only journal synchronization services for flows.\n *\n * @since 0.1.0\n */\n\n/**\n * @category errors\n * @since 0.1.0\n */\nexport * as SyncError from \"./SyncError.ts\"\n\n/**\n * @category protocol\n * @since 0.1.0\n */\nexport * as SyncProtocol from \"./SyncProtocol.ts\"\n\n/**\n * @category protocol\n * @since 0.1.0\n */\nexport * as BranchProtocol from \"./BranchProtocol.ts\"\n\n/**\n * @category projections\n * @since 0.1.0\n */\nexport * as BranchProjection from \"./BranchProjection.ts\"\n\n/**\n * @category rpc\n * @since 0.1.0\n */\nexport * as SyncRpcs from \"./SyncRpcs.ts\"\n\n/**\n * @category rpc\n * @since 0.1.0\n */\nexport * as BranchRpcs from \"./BranchRpcs.ts\"\n\n/**\n * @category services\n * @since 0.1.0\n */\nexport * as RunCatalog from \"./RunCatalog.ts\"\n\n/**\n * @category services\n * @since 0.1.0\n */\nexport * as SyncServer from \"./SyncServer.ts\"\n\n/**\n * @category services\n * @since 0.1.0\n */\nexport * as SyncClient from \"./SyncClient.ts\"\n\n/**\n * @category services\n * @since 0.1.0\n */\nexport * as BranchShare from \"./BranchShare.ts\"\n\n/**\n * @category services\n * @since 0.1.0\n */\nexport * as WorkspaceShare from \"./WorkspaceShare.ts\"\n\n/**\n * @category services\n * @since 0.1.0\n */\nexport * as SyncPrincipal from \"./SyncPrincipal.ts\"\n\n/**\n * @category rpc\n * @since 0.1.0\n */\nexport * as SyncAuth from \"./SyncAuth.ts\"\n\n/**\n * @category services\n * @since 0.1.0\n */\nexport * as BranchPresence from \"./BranchPresence.ts\"\n\n/**\n * @category services\n * @since 0.1.0\n */\nexport * as BranchCommands from \"./BranchCommands.ts\"\n\n/**\n * @category services\n * @since 0.1.0\n */\nexport * as BranchServer from \"./BranchServer.ts\"\n\n/**\n * @category services\n * @since 0.1.0\n */\nexport * as BranchIds from \"./BranchIds.ts\"\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,gBAA2B;AAM3B,mBAA8B;AAM9B,qBAAgC;AAMhC,uBAAkC;AAMlC,eAA0B;AAM1B,iBAA4B;AAM5B,iBAA4B;AAM5B,iBAA4B;AAM5B,iBAA4B;AAM5B,kBAA6B;AAM7B,qBAAgC;AAMhC,oBAA+B;AAM/B,eAA0B;AAM1B,qBAAgC;AAMhC,qBAAgC;AAMhC,mBAA8B;AAM9B,gBAA2B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,43 @@
1
+ /** Admission of host and transport values before any progress is committed.
2
+ * @since 1.0.0-rc.0
3
+ */
4
+ import * as JournalEvent from "@smthrs/journal/JournalEvent";
5
+ import * as Effect from "effect/Effect";
6
+ import * as Schema from "effect/Schema";
7
+ import { CommandEventPayload } from "../BranchProtocol.ts";
8
+ import { SyncError } from "../SyncError.ts";
9
+ /** Decode a boundary value while retaining a safe cause classification.
10
+ * @category validation
11
+ * @since 1.0.0-rc.0
12
+ */
13
+ export declare const decode: <S extends Schema.Top & {
14
+ readonly DecodingServices: never;
15
+ }>(schema: S, value: unknown, code?: "decode_failed" | "invalid_request") => Effect.Effect<S["Type"], SyncError>;
16
+ /** One admitted entry beside the command payload admission decoded from it.
17
+ * `command` is `undefined` for every event type other than `CommandEvent`.
18
+ * @category models
19
+ * @since 1.0.0-rc.0
20
+ */
21
+ export interface Admitted {
22
+ readonly entry: JournalEvent.Entry;
23
+ readonly command: CommandEventPayload | undefined;
24
+ }
25
+ /** Known branch records fail closed; unknown namespaces remain open JSON envelopes.
26
+ * Defaults on persisted command args/target keep their existing additive schema meaning.
27
+ * @category validation
28
+ * @since 1.0.0-rc.0
29
+ */
30
+ export declare const records: (values: ReadonlyArray<JournalEvent.Entry>) => Effect.Effect<ReadonlyArray<JournalEvent.Entry>, SyncError>;
31
+ /** Admit an entire run batch before its caller publishes or updates a cursor,
32
+ * handing back each command beside the payload admission decoded, so a caller
33
+ * that needs a command field reads it instead of decoding the payload again.
34
+ * @category validation
35
+ * @since 1.0.0-rc.0
36
+ */
37
+ export declare const withCommands: (values: ReadonlyArray<JournalEvent.Entry>, runId: JournalEvent.RunId, after: number) => Effect.Effect<ReadonlyArray<Admitted>, SyncError>;
38
+ /** Admit an entire run batch before its caller publishes or updates a cursor.
39
+ * @category validation
40
+ * @since 1.0.0-rc.0
41
+ */
42
+ export declare const entries: (values: ReadonlyArray<JournalEvent.Entry>, runId: JournalEvent.RunId, after: number) => Effect.Effect<ReadonlyArray<JournalEvent.Entry>, SyncError>;
43
+ //# sourceMappingURL=Admission.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Admission.d.ts","sourceRoot":"","sources":["../../../src/internal/Admission.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,YAAY,MAAM,8BAA8B,CAAA;AAC5D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAyC,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AACjG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAG3C;;;GAGG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,MAAM,CAAC,GAAG,GAAG;IAAE,QAAQ,CAAC,gBAAgB,EAAE,KAAK,CAAA;CAAE,EAChF,QAAQ,CAAC,EACT,OAAO,OAAO,EACd,OAAM,eAAe,GAAG,iBAAmC,KAC1D,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,CAIjC,CAAA;AAOJ;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAA;IAClC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAAA;CAClD;AAiCD;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,QAAQ,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,KACxC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,SAAS,CAAyC,CAAA;AAEtG;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GACvB,QAAQ,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,EACzC,OAAO,YAAY,CAAC,KAAK,EACzB,OAAO,MAAM,KACZ,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,SAAS,CAiB/C,CAAA;AAEJ;;;GAGG;AACH,eAAO,MAAM,OAAO,GAClB,QAAQ,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,EACzC,OAAO,YAAY,CAAC,KAAK,EACzB,OAAO,MAAM,KACZ,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,SAAS,CACF,CAAA"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var Admission_exports = {};
30
+ __export(Admission_exports, {
31
+ decode: () => decode,
32
+ entries: () => entries,
33
+ records: () => records,
34
+ withCommands: () => withCommands
35
+ });
36
+ module.exports = __toCommonJS(Admission_exports);
37
+ var JournalEvent = __toESM(require("@smthrs/journal/JournalEvent"), 1);
38
+ var Effect = __toESM(require("effect/Effect"), 1);
39
+ var Schema = __toESM(require("effect/Schema"), 1);
40
+ var import_BranchProtocol = require("../BranchProtocol.js");
41
+ var import_SyncError = require("../SyncError.js");
42
+ var import_CauseText = require("./CauseText.js");
43
+ const decode = (schema, value, code = "decode_failed") => Effect.try({
44
+ try: () => Schema.decodeUnknownSync(schema)(value),
45
+ catch: (cause) => new import_SyncError.SyncError({ code, message: "Invalid sync envelope", cause: (0, import_CauseText.causeCode)(cause) })
46
+ });
47
+ const decodeEntries = Schema.decodeUnknownSync(Schema.Array(JournalEvent.Entry));
48
+ const decodeJson = Schema.decodeUnknownSync(Schema.Struct({ payload: Schema.Json, meta: Schema.Json }));
49
+ const decodeCommand = Schema.decodeUnknownSync(import_BranchProtocol.CommandEventPayload);
50
+ const decodeBranch = Schema.decodeUnknownSync(Schema.Struct({ branchId: Schema.optional(import_BranchProtocol.BranchId) }));
51
+ const admit = (values) => Effect.try({
52
+ // Capture getters once and detach nested payloads before any application
53
+ // callback can mutate the producer's next entry after admission.
54
+ try: () => decodeEntries(structuredClone(values)).map((entry) => {
55
+ decodeJson(entry);
56
+ if (entry.eventType !== import_BranchProtocol.CommandEvent) return { entry, command: void 0 };
57
+ const command = decodeCommand(entry.payload);
58
+ const identity = decodeBranch(entry.payload);
59
+ if (identity.branchId !== void 0 && identity.branchId !== (0, import_BranchProtocol.branchOfRunId)(entry.runId)) {
60
+ throw new import_SyncError.SyncError({
61
+ code: "protocol_violation",
62
+ message: "Command belongs to another branch",
63
+ cause: "foreign_branch"
64
+ });
65
+ }
66
+ return { entry, command };
67
+ }),
68
+ catch: (cause) => cause instanceof import_SyncError.SyncError ? cause : new import_SyncError.SyncError({ code: "decode_failed", message: "Invalid sync record", cause: (0, import_CauseText.causeCode)(cause) })
69
+ });
70
+ const entriesOf = (admitted) => admitted.map(({ entry }) => entry);
71
+ const records = (values) => Effect.map(admit(values), entriesOf);
72
+ const withCommands = (values, runId, after) => Effect.gen(function* () {
73
+ const admitted = yield* admit(values);
74
+ let previous = after;
75
+ for (const { entry } of admitted) {
76
+ if (entry.runId !== runId || entry.seq <= previous) {
77
+ return yield* Effect.fail(
78
+ new import_SyncError.SyncError({
79
+ code: "protocol_violation",
80
+ message: "Journal batch must belong to the requested run and ascend strictly above its cursor",
81
+ cause: entry.runId !== runId ? "foreign_run" : "non_monotonic_sequence"
82
+ })
83
+ );
84
+ }
85
+ previous = entry.seq;
86
+ }
87
+ return admitted;
88
+ });
89
+ const entries = (values, runId, after) => Effect.map(withCommands(values, runId, after), entriesOf);
90
+ //# sourceMappingURL=Admission.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/internal/Admission.ts"],
4
+ "sourcesContent": ["/** Admission of host and transport values before any progress is committed.\n * @since 1.0.0-rc.0\n */\n\nimport * as JournalEvent from \"@smthrs/journal/JournalEvent\"\nimport * as Effect from \"effect/Effect\"\nimport * as Schema from \"effect/Schema\"\nimport { BranchId, branchOfRunId, CommandEvent, CommandEventPayload } from \"../BranchProtocol.ts\"\nimport { SyncError } from \"../SyncError.ts\"\nimport { causeCode } from \"./CauseText.ts\"\n\n/** Decode a boundary value while retaining a safe cause classification.\n * @category validation\n * @since 1.0.0-rc.0\n */\nexport const decode = <S extends Schema.Top & { readonly DecodingServices: never }>(\n schema: S,\n value: unknown,\n code: \"decode_failed\" | \"invalid_request\" = \"decode_failed\"\n): Effect.Effect<S[\"Type\"], SyncError> =>\n Effect.try({\n try: () => Schema.decodeUnknownSync(schema)(value),\n catch: (cause) => new SyncError({ code, message: \"Invalid sync envelope\", cause: causeCode(cause) })\n })\n\nconst decodeEntries = Schema.decodeUnknownSync(Schema.Array(JournalEvent.Entry))\nconst decodeJson = Schema.decodeUnknownSync(Schema.Struct({ payload: Schema.Json, meta: Schema.Json }))\nconst decodeCommand = Schema.decodeUnknownSync(CommandEventPayload)\nconst decodeBranch = Schema.decodeUnknownSync(Schema.Struct({ branchId: Schema.optional(BranchId) }))\n\n/** One admitted entry beside the command payload admission decoded from it.\n * `command` is `undefined` for every event type other than `CommandEvent`.\n * @category models\n * @since 1.0.0-rc.0\n */\nexport interface Admitted {\n readonly entry: JournalEvent.Entry\n readonly command: CommandEventPayload | undefined\n}\n\n/** The one validation `records`, `withCommands`, and `entries` share. It keeps\n * each command's decoded payload beside its entry rather than discarding it.\n */\nconst admit = (values: ReadonlyArray<JournalEvent.Entry>): Effect.Effect<ReadonlyArray<Admitted>, SyncError> =>\n Effect.try({\n // Capture getters once and detach nested payloads before any application\n // callback can mutate the producer's next entry after admission.\n try: () =>\n decodeEntries(structuredClone(values)).map((entry): Admitted => {\n decodeJson(entry)\n if (entry.eventType !== CommandEvent) return { entry, command: undefined }\n const command = decodeCommand(entry.payload)\n const identity = decodeBranch(entry.payload)\n if (identity.branchId !== undefined && identity.branchId !== branchOfRunId(entry.runId)) {\n throw new SyncError({\n code: \"protocol_violation\",\n message: \"Command belongs to another branch\",\n cause: \"foreign_branch\"\n })\n }\n return { entry, command }\n }),\n catch: (cause) =>\n cause instanceof SyncError\n ? cause\n : new SyncError({ code: \"decode_failed\", message: \"Invalid sync record\", cause: causeCode(cause) })\n })\n\nconst entriesOf = (admitted: ReadonlyArray<Admitted>): ReadonlyArray<JournalEvent.Entry> =>\n admitted.map(({ entry }) => entry)\n\n/** Known branch records fail closed; unknown namespaces remain open JSON envelopes.\n * Defaults on persisted command args/target keep their existing additive schema meaning.\n * @category validation\n * @since 1.0.0-rc.0\n */\nexport const records = (\n values: ReadonlyArray<JournalEvent.Entry>\n): Effect.Effect<ReadonlyArray<JournalEvent.Entry>, SyncError> => Effect.map(admit(values), entriesOf)\n\n/** Admit an entire run batch before its caller publishes or updates a cursor,\n * handing back each command beside the payload admission decoded, so a caller\n * that needs a command field reads it instead of decoding the payload again.\n * @category validation\n * @since 1.0.0-rc.0\n */\nexport const withCommands = (\n values: ReadonlyArray<JournalEvent.Entry>,\n runId: JournalEvent.RunId,\n after: number\n): Effect.Effect<ReadonlyArray<Admitted>, SyncError> =>\n Effect.gen(function*() {\n const admitted = yield* admit(values)\n let previous = after\n for (const { entry } of admitted) {\n if (entry.runId !== runId || entry.seq <= previous) {\n return yield* Effect.fail(\n new SyncError({\n code: \"protocol_violation\",\n message: \"Journal batch must belong to the requested run and ascend strictly above its cursor\",\n cause: entry.runId !== runId ? \"foreign_run\" : \"non_monotonic_sequence\"\n })\n )\n }\n previous = entry.seq\n }\n return admitted\n })\n\n/** Admit an entire run batch before its caller publishes or updates a cursor.\n * @category validation\n * @since 1.0.0-rc.0\n */\nexport const entries = (\n values: ReadonlyArray<JournalEvent.Entry>,\n runId: JournalEvent.RunId,\n after: number\n): Effect.Effect<ReadonlyArray<JournalEvent.Entry>, SyncError> =>\n Effect.map(withCommands(values, runId, after), entriesOf)\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA8B;AAC9B,aAAwB;AACxB,aAAwB;AACxB,4BAA2E;AAC3E,uBAA0B;AAC1B,uBAA0B;AAMnB,MAAM,SAAS,CACpB,QACA,OACA,OAA4C,oBAE5C,OAAO,IAAI;AAAA,EACT,KAAK,MAAM,OAAO,kBAAkB,MAAM,EAAE,KAAK;AAAA,EACjD,OAAO,CAAC,UAAU,IAAI,2BAAU,EAAE,MAAM,SAAS,yBAAyB,WAAO,4BAAU,KAAK,EAAE,CAAC;AACrG,CAAC;AAEH,MAAM,gBAAgB,OAAO,kBAAkB,OAAO,MAAM,aAAa,KAAK,CAAC;AAC/E,MAAM,aAAa,OAAO,kBAAkB,OAAO,OAAO,EAAE,SAAS,OAAO,MAAM,MAAM,OAAO,KAAK,CAAC,CAAC;AACtG,MAAM,gBAAgB,OAAO,kBAAkB,yCAAmB;AAClE,MAAM,eAAe,OAAO,kBAAkB,OAAO,OAAO,EAAE,UAAU,OAAO,SAAS,8BAAQ,EAAE,CAAC,CAAC;AAepG,MAAM,QAAQ,CAAC,WACb,OAAO,IAAI;AAAA;AAAA;AAAA,EAGT,KAAK,MACH,cAAc,gBAAgB,MAAM,CAAC,EAAE,IAAI,CAAC,UAAoB;AAC9D,eAAW,KAAK;AAChB,QAAI,MAAM,cAAc,mCAAc,QAAO,EAAE,OAAO,SAAS,OAAU;AACzE,UAAM,UAAU,cAAc,MAAM,OAAO;AAC3C,UAAM,WAAW,aAAa,MAAM,OAAO;AAC3C,QAAI,SAAS,aAAa,UAAa,SAAS,iBAAa,qCAAc,MAAM,KAAK,GAAG;AACvF,YAAM,IAAI,2BAAU;AAAA,QAClB,MAAM;AAAA,QACN,SAAS;AAAA,QACT,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AACA,WAAO,EAAE,OAAO,QAAQ;AAAA,EAC1B,CAAC;AAAA,EACH,OAAO,CAAC,UACN,iBAAiB,6BACb,QACA,IAAI,2BAAU,EAAE,MAAM,iBAAiB,SAAS,uBAAuB,WAAO,4BAAU,KAAK,EAAE,CAAC;AACxG,CAAC;AAEH,MAAM,YAAY,CAAC,aACjB,SAAS,IAAI,CAAC,EAAE,MAAM,MAAM,KAAK;AAO5B,MAAM,UAAU,CACrB,WACgE,OAAO,IAAI,MAAM,MAAM,GAAG,SAAS;AAQ9F,MAAM,eAAe,CAC1B,QACA,OACA,UAEA,OAAO,IAAI,aAAY;AACrB,QAAM,WAAW,OAAO,MAAM,MAAM;AACpC,MAAI,WAAW;AACf,aAAW,EAAE,MAAM,KAAK,UAAU;AAChC,QAAI,MAAM,UAAU,SAAS,MAAM,OAAO,UAAU;AAClD,aAAO,OAAO,OAAO;AAAA,QACnB,IAAI,2BAAU;AAAA,UACZ,MAAM;AAAA,UACN,SAAS;AAAA,UACT,OAAO,MAAM,UAAU,QAAQ,gBAAgB;AAAA,QACjD,CAAC;AAAA,MACH;AAAA,IACF;AACA,eAAW,MAAM;AAAA,EACnB;AACA,SAAO;AACT,CAAC;AAMI,MAAM,UAAU,CACrB,QACA,OACA,UAEA,OAAO,IAAI,aAAa,QAAQ,OAAO,KAAK,GAAG,SAAS;",
6
+ "names": []
7
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * How a host failure crosses the sync boundary: what a follower is told about
3
+ * it, and what it is not.
4
+ *
5
+ * `SyncError.cause` crosses the wire to a follower that may hold nothing but a
6
+ * branch share link, so it carries a short string rather than the host object
7
+ * that failed. An arbitrary `unknown` had three problems at once: it counted
8
+ * against no ceiling, a class instance or a cyclic value has no defined wire
9
+ * form, and whatever the host threw — a driver message with SQL text, a
10
+ * rejected credential — went out verbatim.
11
+ *
12
+ * @since 1.0.0-rc.0
13
+ */
14
+ /**
15
+ * Clamps one rendering to {@link maxCauseTextLength}.
16
+ *
17
+ * Every string this module produces leaves through here, and so does every
18
+ * other string a `SyncError` carries out of a host failure: `message` is
19
+ * `Schema.String` and is as unbounded as `cause` was.
20
+ *
21
+ * @category encoding
22
+ * @since 1.0.0-rc.0
23
+ */
24
+ export declare const boundedText: (text: string) => string;
25
+ /**
26
+ * Renders one host failure as a bounded string.
27
+ *
28
+ * An `Error` renders as `name: message`; anything else renders as its type
29
+ * alone, because a non-`Error` value is arbitrary host data and its contents
30
+ * are not this boundary's to publish. Nothing is retained beyond the returned
31
+ * string, so an oversized input does not keep its subject alive.
32
+ *
33
+ * @category encoding
34
+ * @since 1.0.0-rc.0
35
+ */
36
+ export declare const causeText: (cause: unknown) => string;
37
+ /**
38
+ * Renders one failure as its TYPE alone, with no message.
39
+ *
40
+ * The journal's message is the SQLite driver's, and it routinely carries SQL
41
+ * text, table and column names, and constraint identifiers. A follower may
42
+ * hold nothing but a branch share link, so what it learns about a storage
43
+ * fault is the stable code the journal enumerates, never the sentence the
44
+ * driver wrote. `decodeCapability` already refuses to be a parsing oracle;
45
+ * this is the same rule for the read and write paths.
46
+ *
47
+ * The result is bounded like {@link causeText}: a `Journal` is a host seam, so
48
+ * the `name` and `code` this reads are as much the host's to choose as the
49
+ * message it refuses to publish.
50
+ *
51
+ * @category encoding
52
+ * @since 1.0.0-rc.0
53
+ */
54
+ export declare const causeCode: (cause: unknown) => string;
55
+ //# sourceMappingURL=CauseText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CauseText.d.ts","sourceRoot":"","sources":["../../../src/internal/CauseText.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,MACoD,CAAA;AAE/F;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,MAGxC,CAAA;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,MAM1C,CAAA"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var CauseText_exports = {};
20
+ __export(CauseText_exports, {
21
+ boundedText: () => boundedText,
22
+ causeCode: () => causeCode,
23
+ causeText: () => causeText
24
+ });
25
+ module.exports = __toCommonJS(CauseText_exports);
26
+ const maxCauseTextLength = 512;
27
+ const boundedText = (text) => text.length <= maxCauseTextLength ? text : `${text.slice(0, maxCauseTextLength)} (truncated)`;
28
+ const causeText = (cause) => boundedText(
29
+ cause instanceof Error ? `${cause.name}: ${cause.message}` : Object.prototype.toString.call(cause)
30
+ );
31
+ const causeCode = (cause) => {
32
+ if (cause instanceof Error) {
33
+ const code = cause.code;
34
+ return boundedText(typeof code === "string" ? `${cause.name}(${code})` : cause.name);
35
+ }
36
+ return boundedText(Object.prototype.toString.call(cause));
37
+ };
38
+ //# sourceMappingURL=CauseText.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/internal/CauseText.ts"],
4
+ "sourcesContent": ["/**\n * How a host failure crosses the sync boundary: what a follower is told about\n * it, and what it is not.\n *\n * `SyncError.cause` crosses the wire to a follower that may hold nothing but a\n * branch share link, so it carries a short string rather than the host object\n * that failed. An arbitrary `unknown` had three problems at once: it counted\n * against no ceiling, a class instance or a cyclic value has no defined wire\n * form, and whatever the host threw \u2014 a driver message with SQL text, a\n * rejected credential \u2014 went out verbatim.\n *\n * @since 1.0.0-rc.0\n */\n\n/**\n * Longest cause rendering that crosses the wire. Long enough to name a failure\n * and short enough that an error can never be the largest thing a follower\n * receives.\n */\nconst maxCauseTextLength = 512\n\n/**\n * Clamps one rendering to {@link maxCauseTextLength}.\n *\n * Every string this module produces leaves through here, and so does every\n * other string a `SyncError` carries out of a host failure: `message` is\n * `Schema.String` and is as unbounded as `cause` was.\n *\n * @category encoding\n * @since 1.0.0-rc.0\n */\nexport const boundedText = (text: string): string =>\n text.length <= maxCauseTextLength ? text : `${text.slice(0, maxCauseTextLength)} (truncated)`\n\n/**\n * Renders one host failure as a bounded string.\n *\n * An `Error` renders as `name: message`; anything else renders as its type\n * alone, because a non-`Error` value is arbitrary host data and its contents\n * are not this boundary's to publish. Nothing is retained beyond the returned\n * string, so an oversized input does not keep its subject alive.\n *\n * @category encoding\n * @since 1.0.0-rc.0\n */\nexport const causeText = (cause: unknown): string =>\n boundedText(\n cause instanceof Error ? `${cause.name}: ${cause.message}` : Object.prototype.toString.call(cause)\n )\n\n/**\n * Renders one failure as its TYPE alone, with no message.\n *\n * The journal's message is the SQLite driver's, and it routinely carries SQL\n * text, table and column names, and constraint identifiers. A follower may\n * hold nothing but a branch share link, so what it learns about a storage\n * fault is the stable code the journal enumerates, never the sentence the\n * driver wrote. `decodeCapability` already refuses to be a parsing oracle;\n * this is the same rule for the read and write paths.\n *\n * The result is bounded like {@link causeText}: a `Journal` is a host seam, so\n * the `name` and `code` this reads are as much the host's to choose as the\n * message it refuses to publish.\n *\n * @category encoding\n * @since 1.0.0-rc.0\n */\nexport const causeCode = (cause: unknown): string => {\n if (cause instanceof Error) {\n const code = (cause as { readonly code?: unknown }).code\n return boundedText(typeof code === \"string\" ? `${cause.name}(${code})` : cause.name)\n }\n return boundedText(Object.prototype.toString.call(cause))\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBA,MAAM,qBAAqB;AAYpB,MAAM,cAAc,CAAC,SAC1B,KAAK,UAAU,qBAAqB,OAAO,GAAG,KAAK,MAAM,GAAG,kBAAkB,CAAC;AAa1E,MAAM,YAAY,CAAC,UACxB;AAAA,EACE,iBAAiB,QAAQ,GAAG,MAAM,IAAI,KAAK,MAAM,OAAO,KAAK,OAAO,UAAU,SAAS,KAAK,KAAK;AACnG;AAmBK,MAAM,YAAY,CAAC,UAA2B;AACnD,MAAI,iBAAiB,OAAO;AAC1B,UAAM,OAAQ,MAAsC;AACpD,WAAO,YAAY,OAAO,SAAS,WAAW,GAAG,MAAM,IAAI,IAAI,IAAI,MAAM,MAAM,IAAI;AAAA,EACrF;AACA,SAAO,YAAY,OAAO,UAAU,SAAS,KAAK,KAAK,CAAC;AAC1D;",
6
+ "names": []
7
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * How a journal failure's stable code maps onto the sync boundary's error
3
+ * vocabulary.
4
+ *
5
+ * @since 1.0.0-rc.0
6
+ */
7
+ /**
8
+ * Projects one journal failure's stable code onto this boundary's vocabulary,
9
+ * or `unknown` when it has no counterpart.
10
+ *
11
+ * `SyncError.ErrorCode` already declares `closed`, `backpressure`, and
12
+ * `decode_failed`, so collapsing every journal failure but `compacted` into
13
+ * `unknown` threw away a classification the wire could already carry, and left
14
+ * a follower unable to tell a shut-down journal from an unexplained fault.
15
+ * Nothing here widens what a follower learns: `causeCode` already publishes
16
+ * the journal's own enumerated code, and the journal's MESSAGE stays refused
17
+ * on every path.
18
+ *
19
+ * @category encoding
20
+ * @since 1.0.0-rc.0
21
+ */
22
+ export declare const journalErrorCode: (cause: unknown) => "backpressure" | "closed" | "decode_failed" | "unknown";
23
+ //# sourceMappingURL=JournalErrorCode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JournalErrorCode.d.ts","sourceRoot":"","sources":["../../../src/internal/JournalErrorCode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,GAC3B,OAAO,OAAO,KACb,cAAc,GAAG,QAAQ,GAAG,eAAe,GAAG,SAIhD,CAAA"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var JournalErrorCode_exports = {};
20
+ __export(JournalErrorCode_exports, {
21
+ journalErrorCode: () => journalErrorCode
22
+ });
23
+ module.exports = __toCommonJS(JournalErrorCode_exports);
24
+ const journalCodes = {
25
+ decode_failed: "decode_failed",
26
+ journal_closed: "closed",
27
+ queue_overflow: "backpressure"
28
+ };
29
+ const journalErrorCode = (cause) => {
30
+ if (!(cause instanceof Error)) return "unknown";
31
+ const code = cause.code;
32
+ return typeof code === "string" ? journalCodes[code] ?? "unknown" : "unknown";
33
+ };
34
+ //# sourceMappingURL=JournalErrorCode.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/internal/JournalErrorCode.ts"],
4
+ "sourcesContent": ["/**\n * How a journal failure's stable code maps onto the sync boundary's error\n * vocabulary.\n *\n * @since 1.0.0-rc.0\n */\n\n/**\n * The journal codes this boundary can state in its own vocabulary.\n *\n * Only codes whose meaning is identical on both sides are here. A journal that\n * is shut down and a sync boundary that is closed are the same fact; an\n * admission queue that overflowed and backpressure are the same fact; a\n * payload the journal could not decode and one this boundary could not decode\n * are the same fact. Everything else \u2014 a fence lost, a sequence conflict, a\n * projection fault \u2014 is a storage-layer distinction a follower cannot act on,\n * and inventing a sync code for it would say more than is known.\n */\nconst journalCodes: Readonly<Record<string, \"backpressure\" | \"closed\" | \"decode_failed\">> = {\n decode_failed: \"decode_failed\",\n journal_closed: \"closed\",\n queue_overflow: \"backpressure\"\n}\n\n/**\n * Projects one journal failure's stable code onto this boundary's vocabulary,\n * or `unknown` when it has no counterpart.\n *\n * `SyncError.ErrorCode` already declares `closed`, `backpressure`, and\n * `decode_failed`, so collapsing every journal failure but `compacted` into\n * `unknown` threw away a classification the wire could already carry, and left\n * a follower unable to tell a shut-down journal from an unexplained fault.\n * Nothing here widens what a follower learns: `causeCode` already publishes\n * the journal's own enumerated code, and the journal's MESSAGE stays refused\n * on every path.\n *\n * @category encoding\n * @since 1.0.0-rc.0\n */\nexport const journalErrorCode = (\n cause: unknown\n): \"backpressure\" | \"closed\" | \"decode_failed\" | \"unknown\" => {\n if (!(cause instanceof Error)) return \"unknown\"\n const code = (cause as { readonly code?: unknown }).code\n return typeof code === \"string\" ? journalCodes[code] ?? \"unknown\" : \"unknown\"\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBA,MAAM,eAAsF;AAAA,EAC1F,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,gBAAgB;AAClB;AAiBO,MAAM,mBAAmB,CAC9B,UAC4D;AAC5D,MAAI,EAAE,iBAAiB,OAAQ,QAAO;AACtC,QAAM,OAAQ,MAAsC;AACpD,SAAO,OAAO,SAAS,WAAW,aAAa,IAAI,KAAK,YAAY;AACtE;",
6
+ "names": []
7
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Execution-time validation of the numeric policies this package's
3
+ * constructors accept.
4
+ *
5
+ * Every `Options` field is typed `number`, and TypeScript admits `NaN`,
6
+ * `Infinity`, zero, and a negative under that type. Each of them disables the
7
+ * thing it configures rather than tightening it: `maxFrameBytes: NaN` makes
8
+ * every `bytes > maxFrameBytes` comparison false, so the ceiling silently
9
+ * stops existing; `concurrency: 0` reaches a bounded `Stream.flatMap`
10
+ * unchecked. A policy is checked once, where it enters, and a bad one is a
11
+ * typed refusal rather than a bound that quietly does nothing.
12
+ *
13
+ * @since 1.0.0-rc.0
14
+ */
15
+ import * as Effect from "effect/Effect";
16
+ import { SyncError } from "../SyncError.ts";
17
+ /**
18
+ * The caller's value when it is a positive safe integer, the fallback when the
19
+ * caller supplied none, and a typed `invalid_request` refusal otherwise. The
20
+ * message names the option so the offending field is identifiable without the
21
+ * error carrying anything but the scalar it was given.
22
+ *
23
+ * @category validation
24
+ * @since 1.0.0-rc.0
25
+ */
26
+ export declare const positiveInt: (name: string, value: number | undefined, fallback: number) => Effect.Effect<number, SyncError>;
27
+ /**
28
+ * A count carried by a REQUEST rather than by a policy: floored at one,
29
+ * ceilinged at what the wire schema allows, and refused otherwise.
30
+ *
31
+ * `SyncProtocol` already bounds `limit` and `credit` on both sides, so a
32
+ * decoded request cannot carry a bad one. An in-process caller that builds the
33
+ * request value directly never meets that schema, and the TypeScript type it
34
+ * does meet is `number`: `NaN`, zero, and a negative all satisfy it. Each of
35
+ * them disables the bound instead of tightening it — `Math.min(NaN, ceiling)`
36
+ * is `NaN`, every `length >= NaN` comparison answers false, and the value
37
+ * reaches the journal as a page size — so the floor is checked here, where
38
+ * both callers share one refusal and one sentence.
39
+ *
40
+ * @category validation
41
+ * @since 1.0.0-rc.0
42
+ */
43
+ export declare const requestCount: (name: string, value: number, ceiling: number) => Effect.Effect<number, SyncError>;
44
+ /**
45
+ * {@link positiveInt} plus a ceiling, for a policy the WIRE also bounds.
46
+ *
47
+ * A value the local schema would accept and the wire schema would refuse is
48
+ * not a transport failure, but that is what it looked like: the RPC client's
49
+ * own decode failure arrived through the same channel a dropped connection
50
+ * does, and the follow retried it under backoff forever. The refusal belongs
51
+ * here, before a request is built.
52
+ *
53
+ * @category validation
54
+ * @since 1.0.0-rc.0
55
+ */
56
+ export declare const boundedInt: (name: string, value: number | undefined, fallback: number, maximum: number) => Effect.Effect<number, SyncError>;
57
+ //# sourceMappingURL=PolicyOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PolicyOptions.d.ts","sourceRoot":"","sources":["../../../src/internal/PolicyOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GACtB,MAAM,MAAM,EACZ,OAAO,MAAM,GAAG,SAAS,EACzB,UAAU,MAAM,KACf,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAQjC,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,MAAM,EACZ,OAAO,MAAM,EACb,SAAS,MAAM,KACd,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAM/B,CAAA;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,GACrB,MAAM,MAAM,EACZ,OAAO,MAAM,GAAG,SAAS,EACzB,UAAU,MAAM,EAChB,SAAS,MAAM,KACd,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAU/B,CAAA"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var PolicyOptions_exports = {};
30
+ __export(PolicyOptions_exports, {
31
+ boundedInt: () => boundedInt,
32
+ positiveInt: () => positiveInt,
33
+ requestCount: () => requestCount
34
+ });
35
+ module.exports = __toCommonJS(PolicyOptions_exports);
36
+ var Effect = __toESM(require("effect/Effect"), 1);
37
+ var import_SyncError = require("../SyncError.js");
38
+ const positiveInt = (name, value, fallback) => {
39
+ if (value === void 0) return Effect.succeed(fallback);
40
+ return Number.isSafeInteger(value) && value > 0 ? Effect.succeed(value) : Effect.fail(
41
+ new import_SyncError.SyncError({
42
+ code: "invalid_request",
43
+ message: `${name} must be a positive safe integer, not ${value}`
44
+ })
45
+ );
46
+ };
47
+ const requestCount = (name, value, ceiling) => Number.isSafeInteger(value) && value > 0 ? Effect.succeed(Math.min(value, ceiling)) : Effect.fail(
48
+ new import_SyncError.SyncError({
49
+ code: "invalid_request",
50
+ message: `${name} must be a positive safe integer, not ${value}`
51
+ })
52
+ );
53
+ const boundedInt = (name, value, fallback, maximum) => Effect.flatMap(
54
+ positiveInt(name, value, fallback),
55
+ (accepted) => accepted <= maximum ? Effect.succeed(accepted) : Effect.fail(
56
+ new import_SyncError.SyncError({
57
+ code: "invalid_request",
58
+ message: `${name} must be at most ${maximum}, not ${accepted}`
59
+ })
60
+ )
61
+ );
62
+ //# sourceMappingURL=PolicyOptions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/internal/PolicyOptions.ts"],
4
+ "sourcesContent": ["/**\n * Execution-time validation of the numeric policies this package's\n * constructors accept.\n *\n * Every `Options` field is typed `number`, and TypeScript admits `NaN`,\n * `Infinity`, zero, and a negative under that type. Each of them disables the\n * thing it configures rather than tightening it: `maxFrameBytes: NaN` makes\n * every `bytes > maxFrameBytes` comparison false, so the ceiling silently\n * stops existing; `concurrency: 0` reaches a bounded `Stream.flatMap`\n * unchecked. A policy is checked once, where it enters, and a bad one is a\n * typed refusal rather than a bound that quietly does nothing.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as Effect from \"effect/Effect\"\nimport { SyncError } from \"../SyncError.ts\"\n\n/**\n * The caller's value when it is a positive safe integer, the fallback when the\n * caller supplied none, and a typed `invalid_request` refusal otherwise. The\n * message names the option so the offending field is identifiable without the\n * error carrying anything but the scalar it was given.\n *\n * @category validation\n * @since 1.0.0-rc.0\n */\nexport const positiveInt = (\n name: string,\n value: number | undefined,\n fallback: number\n): Effect.Effect<number, SyncError> => {\n if (value === undefined) return Effect.succeed(fallback)\n return Number.isSafeInteger(value) && value > 0 ? Effect.succeed(value) : Effect.fail(\n new SyncError({\n code: \"invalid_request\",\n message: `${name} must be a positive safe integer, not ${value}`\n })\n )\n}\n\n/**\n * A count carried by a REQUEST rather than by a policy: floored at one,\n * ceilinged at what the wire schema allows, and refused otherwise.\n *\n * `SyncProtocol` already bounds `limit` and `credit` on both sides, so a\n * decoded request cannot carry a bad one. An in-process caller that builds the\n * request value directly never meets that schema, and the TypeScript type it\n * does meet is `number`: `NaN`, zero, and a negative all satisfy it. Each of\n * them disables the bound instead of tightening it \u2014 `Math.min(NaN, ceiling)`\n * is `NaN`, every `length >= NaN` comparison answers false, and the value\n * reaches the journal as a page size \u2014 so the floor is checked here, where\n * both callers share one refusal and one sentence.\n *\n * @category validation\n * @since 1.0.0-rc.0\n */\nexport const requestCount = (\n name: string,\n value: number,\n ceiling: number\n): Effect.Effect<number, SyncError> =>\n Number.isSafeInteger(value) && value > 0 ? Effect.succeed(Math.min(value, ceiling)) : Effect.fail(\n new SyncError({\n code: \"invalid_request\",\n message: `${name} must be a positive safe integer, not ${value}`\n })\n )\n\n/**\n * {@link positiveInt} plus a ceiling, for a policy the WIRE also bounds.\n *\n * A value the local schema would accept and the wire schema would refuse is\n * not a transport failure, but that is what it looked like: the RPC client's\n * own decode failure arrived through the same channel a dropped connection\n * does, and the follow retried it under backoff forever. The refusal belongs\n * here, before a request is built.\n *\n * @category validation\n * @since 1.0.0-rc.0\n */\nexport const boundedInt = (\n name: string,\n value: number | undefined,\n fallback: number,\n maximum: number\n): Effect.Effect<number, SyncError> =>\n Effect.flatMap(\n positiveInt(name, value, fallback),\n (accepted) =>\n accepted <= maximum ? Effect.succeed(accepted) : Effect.fail(\n new SyncError({\n code: \"invalid_request\",\n message: `${name} must be at most ${maximum}, not ${accepted}`\n })\n )\n )\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,aAAwB;AACxB,uBAA0B;AAWnB,MAAM,cAAc,CACzB,MACA,OACA,aACqC;AACrC,MAAI,UAAU,OAAW,QAAO,OAAO,QAAQ,QAAQ;AACvD,SAAO,OAAO,cAAc,KAAK,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,IAAI,OAAO;AAAA,IAC/E,IAAI,2BAAU;AAAA,MACZ,MAAM;AAAA,MACN,SAAS,GAAG,IAAI,yCAAyC,KAAK;AAAA,IAChE,CAAC;AAAA,EACH;AACF;AAkBO,MAAM,eAAe,CAC1B,MACA,OACA,YAEA,OAAO,cAAc,KAAK,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,IAAI,OAAO,OAAO,CAAC,IAAI,OAAO;AAAA,EAC3F,IAAI,2BAAU;AAAA,IACZ,MAAM;AAAA,IACN,SAAS,GAAG,IAAI,yCAAyC,KAAK;AAAA,EAChE,CAAC;AACH;AAcK,MAAM,aAAa,CACxB,MACA,OACA,UACA,YAEA,OAAO;AAAA,EACL,YAAY,MAAM,OAAO,QAAQ;AAAA,EACjC,CAAC,aACC,YAAY,UAAU,OAAO,QAAQ,QAAQ,IAAI,OAAO;AAAA,IACtD,IAAI,2BAAU;AAAA,MACZ,MAAM;AAAA,MACN,SAAS,GAAG,IAAI,oBAAoB,OAAO,SAAS,QAAQ;AAAA,IAC9D,CAAC;AAAA,EACH;AACJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,17 @@
1
+ /** The one protocol-version comparison every sync boundary answers with.
2
+ * @since 1.0.0-rc.0
3
+ */
4
+ import * as Effect from "effect/Effect";
5
+ import { SyncError } from "../SyncError.ts";
6
+ /** Refuse a version this revision does not speak, on every path, with one code.
7
+ *
8
+ * Read, subscribe and snapshot all decode a mismatched version so the refusal
9
+ * is this typed `protocol_violation` rather than three different decode
10
+ * failures, and the accepted number is only ever
11
+ * {@link SyncProtocol.protocolVersion}.
12
+ *
13
+ * @category validation
14
+ * @since 1.0.0-rc.0
15
+ */
16
+ export declare const requireVersion: (version: number | undefined) => Effect.Effect<void, SyncError>;
17
+ //# sourceMappingURL=ProtocolVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProtocolVersion.d.ts","sourceRoot":"","sources":["../../../src/internal/ProtocolVersion.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAG3C;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,GAAG,SAAS,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CASrF,CAAA"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var ProtocolVersion_exports = {};
30
+ __export(ProtocolVersion_exports, {
31
+ requireVersion: () => requireVersion
32
+ });
33
+ module.exports = __toCommonJS(ProtocolVersion_exports);
34
+ var Effect = __toESM(require("effect/Effect"), 1);
35
+ var import_SyncError = require("../SyncError.js");
36
+ var import_SyncProtocol = require("../SyncProtocol.js");
37
+ const requireVersion = (version) => version === import_SyncProtocol.protocolVersion ? Effect.void : Effect.fail(
38
+ new import_SyncError.SyncError({
39
+ code: "protocol_violation",
40
+ message: `Expected sync protocol version ${import_SyncProtocol.protocolVersion}; received ${version}`,
41
+ cause: "protocol_version_mismatch"
42
+ })
43
+ );
44
+ //# sourceMappingURL=ProtocolVersion.js.map