jazz-tools 2.0.0-alpha.60 → 2.0.0-alpha.62

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 (719) hide show
  1. package/README.md +1 -1
  2. package/bin/jazz-tools.js +3 -0
  3. package/dist/_dev/native-account-session.d.ts +8 -1
  4. package/dist/_dev/native-account-session.d.ts.map +1 -1
  5. package/dist/_dev/native-account-session.js +10 -0
  6. package/dist/_dev/native-account-session.js.map +1 -1
  7. package/dist/accounts/account-manager-core.d.ts +6 -0
  8. package/dist/accounts/account-manager-core.d.ts.map +1 -1
  9. package/dist/accounts/account-manager-core.js +26 -2
  10. package/dist/accounts/account-manager-core.js.map +1 -1
  11. package/dist/accounts/enrollment.d.ts.map +1 -1
  12. package/dist/accounts/enrollment.js +13 -4
  13. package/dist/accounts/enrollment.js.map +1 -1
  14. package/dist/accounts/exports.d.ts +1 -2
  15. package/dist/accounts/exports.d.ts.map +1 -1
  16. package/dist/accounts/exports.js +4 -1
  17. package/dist/accounts/exports.js.map +1 -1
  18. package/dist/accounts/persistence.d.ts +38 -2
  19. package/dist/accounts/persistence.d.ts.map +1 -1
  20. package/dist/accounts/persistence.js +123 -6
  21. package/dist/accounts/persistence.js.map +1 -1
  22. package/dist/accounts/registry-client.d.ts +29 -0
  23. package/dist/accounts/registry-client.d.ts.map +1 -1
  24. package/dist/accounts/registry-client.js +45 -0
  25. package/dist/accounts/registry-client.js.map +1 -1
  26. package/dist/accounts/state.d.ts.map +1 -1
  27. package/dist/accounts/state.js +2 -1
  28. package/dist/accounts/state.js.map +1 -1
  29. package/dist/backend/create-jazz-context.d.ts +7 -0
  30. package/dist/backend/create-jazz-context.d.ts.map +1 -1
  31. package/dist/backend/create-jazz-context.js +115 -18
  32. package/dist/backend/create-jazz-context.js.map +1 -1
  33. package/dist/backend/create-jazz-session.d.ts +9 -7
  34. package/dist/backend/create-jazz-session.d.ts.map +1 -1
  35. package/dist/backend/create-jazz-session.js +55 -17
  36. package/dist/backend/create-jazz-session.js.map +1 -1
  37. package/dist/backend/create-jazz.d.ts +196 -38
  38. package/dist/backend/create-jazz.d.ts.map +1 -1
  39. package/dist/backend/create-jazz.js +935 -147
  40. package/dist/backend/create-jazz.js.map +1 -1
  41. package/dist/backend/early-db.d.ts.map +1 -1
  42. package/dist/backend/early-db.js +1 -0
  43. package/dist/backend/early-db.js.map +1 -1
  44. package/dist/backend/external-jwt.d.ts.map +1 -1
  45. package/dist/backend/external-jwt.js +34 -10
  46. package/dist/backend/external-jwt.js.map +1 -1
  47. package/dist/backend/from-jwt.d.ts +6 -4
  48. package/dist/backend/from-jwt.d.ts.map +1 -1
  49. package/dist/backend/from-jwt.js +11 -3
  50. package/dist/backend/from-jwt.js.map +1 -1
  51. package/dist/backend/index.d.ts +2 -1
  52. package/dist/backend/index.d.ts.map +1 -1
  53. package/dist/backend/index.js +3 -1
  54. package/dist/backend/index.js.map +1 -1
  55. package/dist/backend/inspect-ui.d.ts +14 -0
  56. package/dist/backend/inspect-ui.d.ts.map +1 -0
  57. package/dist/backend/inspect-ui.js +156 -0
  58. package/dist/backend/inspect-ui.js.map +1 -0
  59. package/dist/backend/inspect.d.ts +133 -0
  60. package/dist/backend/inspect.d.ts.map +1 -0
  61. package/dist/backend/inspect.js +983 -0
  62. package/dist/backend/inspect.js.map +1 -0
  63. package/dist/backend/inspector-ui/0.js +2 -0
  64. package/dist/backend/inspector-ui/1.js +2 -0
  65. package/dist/backend/inspector-ui/10.js +2 -0
  66. package/dist/backend/inspector-ui/11.js +2 -0
  67. package/dist/backend/inspector-ui/12.js +2 -0
  68. package/dist/backend/inspector-ui/13.js +2 -0
  69. package/dist/backend/inspector-ui/14.js +2 -0
  70. package/dist/backend/inspector-ui/15.js +2 -0
  71. package/dist/backend/inspector-ui/16.js +2 -0
  72. package/dist/backend/inspector-ui/17.js +2 -0
  73. package/dist/backend/inspector-ui/18.js +2 -0
  74. package/dist/backend/inspector-ui/19.js +2 -0
  75. package/dist/backend/inspector-ui/2.js +2 -0
  76. package/dist/backend/inspector-ui/20.js +2 -0
  77. package/dist/backend/inspector-ui/3.js +2 -0
  78. package/dist/backend/inspector-ui/4.js +2 -0
  79. package/dist/backend/inspector-ui/5.js +2 -0
  80. package/dist/backend/inspector-ui/6.js +2 -0
  81. package/dist/backend/inspector-ui/7.js +2 -0
  82. package/dist/backend/inspector-ui/8.js +2 -0
  83. package/dist/backend/inspector-ui/9.js +2 -0
  84. package/dist/backend/inspector-ui-files.d.ts +4 -0
  85. package/dist/backend/inspector-ui-files.d.ts.map +1 -0
  86. package/dist/backend/inspector-ui-files.js +25 -0
  87. package/dist/backend/request-auth.d.ts +11 -0
  88. package/dist/backend/request-auth.d.ts.map +1 -1
  89. package/dist/backend/request-auth.js +14 -0
  90. package/dist/backend/request-auth.js.map +1 -1
  91. package/dist/backend/session-expiry.d.ts +61 -0
  92. package/dist/backend/session-expiry.d.ts.map +1 -0
  93. package/dist/backend/session-expiry.js +102 -0
  94. package/dist/backend/session-expiry.js.map +1 -0
  95. package/dist/backend/signing-key.d.ts +10 -0
  96. package/dist/backend/signing-key.d.ts.map +1 -0
  97. package/dist/backend/signing-key.js +15 -0
  98. package/dist/backend/signing-key.js.map +1 -0
  99. package/dist/backend/store-log.d.ts +3 -0
  100. package/dist/backend/store-log.d.ts.map +1 -0
  101. package/dist/backend/store-log.js +16 -0
  102. package/dist/backend/store-log.js.map +1 -0
  103. package/dist/backend/upgrade-status.d.ts +19 -0
  104. package/dist/backend/upgrade-status.d.ts.map +1 -0
  105. package/dist/backend/upgrade-status.js +55 -0
  106. package/dist/backend/upgrade-status.js.map +1 -0
  107. package/dist/backend/vercel-store.d.ts +88 -12
  108. package/dist/backend/vercel-store.d.ts.map +1 -1
  109. package/dist/backend/vercel-store.js +303 -44
  110. package/dist/backend/vercel-store.js.map +1 -1
  111. package/dist/backend/ws-peer.d.ts +32 -0
  112. package/dist/backend/ws-peer.d.ts.map +1 -0
  113. package/dist/backend/ws-peer.js +40 -0
  114. package/dist/backend/ws-peer.js.map +1 -0
  115. package/dist/better-auth-adapter/fixtures/issuer-upgrade-schema.d.ts +134 -0
  116. package/dist/better-auth-adapter/fixtures/issuer-upgrade-schema.d.ts.map +1 -0
  117. package/dist/better-auth-adapter/fixtures/issuer-upgrade-schema.js +121 -0
  118. package/dist/better-auth-adapter/fixtures/issuer-upgrade-schema.js.map +1 -0
  119. package/dist/better-auth-adapter/fixtures/schema.d.ts +2 -1
  120. package/dist/better-auth-adapter/fixtures/schema.d.ts.map +1 -1
  121. package/dist/better-auth-adapter/fixtures/schema.js +2 -1
  122. package/dist/better-auth-adapter/fixtures/schema.js.map +1 -1
  123. package/dist/better-auth-adapter/index.d.ts.map +1 -1
  124. package/dist/better-auth-adapter/index.js +47 -0
  125. package/dist/better-auth-adapter/index.js.map +1 -1
  126. package/dist/classic-api.d.ts.map +1 -1
  127. package/dist/classic-api.js +36 -0
  128. package/dist/classic-api.js.map +1 -1
  129. package/dist/cli.d.ts.map +1 -1
  130. package/dist/cli.js +54 -11
  131. package/dist/cli.js.map +1 -1
  132. package/dist/client/index.d.ts +2 -6
  133. package/dist/client/index.d.ts.map +1 -1
  134. package/dist/client/index.js +2 -3
  135. package/dist/client/index.js.map +1 -1
  136. package/dist/cloud/credentials.d.ts +1 -1
  137. package/dist/cloud/credentials.d.ts.map +1 -1
  138. package/dist/cloud/credentials.js.map +1 -1
  139. package/dist/dev/catalogue-project.d.ts +12 -3
  140. package/dist/dev/catalogue-project.d.ts.map +1 -1
  141. package/dist/dev/catalogue-project.js +29 -4
  142. package/dist/dev/catalogue-project.js.map +1 -1
  143. package/dist/dev/catalogue.d.ts +12 -0
  144. package/dist/dev/catalogue.d.ts.map +1 -1
  145. package/dist/dev/catalogue.js +94 -15
  146. package/dist/dev/catalogue.js.map +1 -1
  147. package/dist/dev/dev-server.d.ts +4 -1
  148. package/dist/dev/dev-server.d.ts.map +1 -1
  149. package/dist/dev/dev-server.js +41 -3
  150. package/dist/dev/dev-server.js.map +1 -1
  151. package/dist/dev/inspector-overlay/embedded/assets/backend-C6JfNAB2.js +1 -0
  152. package/dist/dev/inspector-overlay/embedded/assets/backend-DHeT1LCS.css +1 -0
  153. package/dist/dev/inspector-overlay/embedded/assets/{create-legacy-browser-delegate-X_T_QKCN.js → create-legacy-browser-delegate-Bf58kV5i.js} +1 -1
  154. package/dist/dev/inspector-overlay/embedded/assets/{esm-aRzpnC3u.js → esm-B8Fn7-qJ.js} +1 -1
  155. package/dist/dev/inspector-overlay/embedded/assets/{esm-ezD5H765.js → esm-C3BWHq-S.js} +1 -1
  156. package/dist/dev/inspector-overlay/embedded/assets/esm-DC_mAoiW.js +1 -0
  157. package/dist/dev/inspector-overlay/embedded/assets/{esm-7mP3GQX4.js → esm-D_R-EGgt.js} +1 -1
  158. package/dist/dev/inspector-overlay/embedded/assets/{esm-BX6IY2Mv.js → esm-WihpI9g6.js} +1 -1
  159. package/dist/dev/inspector-overlay/embedded/assets/index-C_pcvEcg.js +1 -0
  160. package/dist/dev/inspector-overlay/embedded/assets/{jazz-broker-worker-XRRxJUcx.js → jazz-broker-worker-Cv6-V0tc.js} +787 -608
  161. package/dist/dev/inspector-overlay/embedded/assets/jazz-broker-worker-Db-pNME-.js +5 -0
  162. package/dist/dev/inspector-overlay/embedded/assets/jazz_wasm-CTwPHZcZ.js +1 -0
  163. package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm_bg-KR7h3v27.wasm → jazz_wasm_bg-HpkRDlj-.wasm} +0 -0
  164. package/dist/dev/inspector-overlay/embedded/assets/src-B5UtjtXQ.js +22 -0
  165. package/dist/dev/inspector-overlay/embedded/assets/{index-C78Pprka.css → src-Cq8gSOLx.css} +1 -1
  166. package/dist/dev/inspector-overlay/embedded/assets/{trace-api-B5CaetI0.js → trace-api-BctnwbUf.js} +1 -1
  167. package/dist/dev/inspector-overlay/embedded/backend.html +16 -0
  168. package/dist/dev/inspector-overlay/embedded/embedded.html +3 -2
  169. package/dist/dev/inspector-overlay/host-bridge.d.ts.map +1 -1
  170. package/dist/dev/inspector-overlay/host-bridge.js +4 -1
  171. package/dist/dev/inspector-overlay/host-bridge.js.map +1 -1
  172. package/dist/dev/inspector-overlay/loader.d.ts +12 -1
  173. package/dist/dev/inspector-overlay/loader.d.ts.map +1 -1
  174. package/dist/dev/inspector-overlay/loader.js +31 -4
  175. package/dist/dev/inspector-overlay/loader.js.map +1 -1
  176. package/dist/dev/migrations.d.ts.map +1 -1
  177. package/dist/dev/migrations.js +53 -7
  178. package/dist/dev/migrations.js.map +1 -1
  179. package/dist/drivers/schema-wire.d.ts +6 -2
  180. package/dist/drivers/schema-wire.d.ts.map +1 -1
  181. package/dist/drivers/schema-wire.js +6 -2
  182. package/dist/drivers/schema-wire.js.map +1 -1
  183. package/dist/effect/jazz.d.ts +12 -5
  184. package/dist/effect/jazz.d.ts.map +1 -1
  185. package/dist/effect/jazz.js +28 -5
  186. package/dist/effect/jazz.js.map +1 -1
  187. package/dist/expo/create-account-manager.d.ts +1 -1
  188. package/dist/expo/create-account-manager.d.ts.map +1 -1
  189. package/dist/expo/create-jazz-session.d.ts +37 -17
  190. package/dist/expo/create-jazz-session.d.ts.map +1 -1
  191. package/dist/expo/create-jazz-session.js +53 -10
  192. package/dist/expo/create-jazz-session.js.map +1 -1
  193. package/dist/expo/index.d.ts +5 -8
  194. package/dist/expo/index.d.ts.map +1 -1
  195. package/dist/expo/index.js +5 -7
  196. package/dist/expo/index.js.map +1 -1
  197. package/dist/expo/metro.d.ts +20 -0
  198. package/dist/expo/metro.d.ts.map +1 -0
  199. package/dist/expo/metro.js +58 -0
  200. package/dist/expo/metro.js.map +1 -0
  201. package/dist/expo/provider.d.ts +6 -3
  202. package/dist/expo/provider.d.ts.map +1 -1
  203. package/dist/expo/provider.js +7 -6
  204. package/dist/expo/provider.js.map +1 -1
  205. package/dist/index.d.ts +3 -2
  206. package/dist/index.d.ts.map +1 -1
  207. package/dist/index.js +3 -1
  208. package/dist/index.js.map +1 -1
  209. package/dist/inspect/cli.d.ts +12 -0
  210. package/dist/inspect/cli.d.ts.map +1 -0
  211. package/dist/inspect/cli.js +320 -0
  212. package/dist/inspect/cli.js.map +1 -0
  213. package/dist/inspect/client.d.ts +67 -0
  214. package/dist/inspect/client.d.ts.map +1 -0
  215. package/dist/inspect/client.js +254 -0
  216. package/dist/inspect/client.js.map +1 -0
  217. package/dist/inspect/mcp.d.ts +28 -0
  218. package/dist/inspect/mcp.d.ts.map +1 -0
  219. package/dist/inspect/mcp.js +441 -0
  220. package/dist/inspect/mcp.js.map +1 -0
  221. package/dist/inspect/protocol.d.ts +317 -0
  222. package/dist/inspect/protocol.d.ts.map +1 -0
  223. package/dist/inspect/protocol.js +544 -0
  224. package/dist/inspect/protocol.js.map +1 -0
  225. package/dist/inspector/index.d.ts +10 -0
  226. package/dist/inspector/index.d.ts.map +1 -0
  227. package/dist/inspector/index.js +27 -0
  228. package/dist/inspector/index.js.map +1 -0
  229. package/dist/local-first/index.d.ts +2 -0
  230. package/dist/local-first/index.d.ts.map +1 -1
  231. package/dist/local-first/index.js +2 -0
  232. package/dist/local-first/index.js.map +1 -1
  233. package/dist/migrations.d.ts +23 -3
  234. package/dist/migrations.d.ts.map +1 -1
  235. package/dist/migrations.js +28 -6
  236. package/dist/migrations.js.map +1 -1
  237. package/dist/module-interop.d.ts +17 -0
  238. package/dist/module-interop.d.ts.map +1 -0
  239. package/dist/module-interop.js +32 -0
  240. package/dist/module-interop.js.map +1 -0
  241. package/dist/permissions/index.d.ts +1 -1
  242. package/dist/permissions/index.d.ts.map +1 -1
  243. package/dist/permissions/index.js +31 -10
  244. package/dist/permissions/index.js.map +1 -1
  245. package/dist/prosemirror/sync.d.ts.map +1 -1
  246. package/dist/prosemirror/sync.js +43 -21
  247. package/dist/prosemirror/sync.js.map +1 -1
  248. package/dist/react/index.d.ts +4 -9
  249. package/dist/react/index.d.ts.map +1 -1
  250. package/dist/react/index.js +4 -6
  251. package/dist/react/index.js.map +1 -1
  252. package/dist/react/provider-props.d.ts +7 -0
  253. package/dist/react/provider-props.d.ts.map +1 -0
  254. package/dist/react/provider-props.js +15 -0
  255. package/dist/react/provider-props.js.map +1 -0
  256. package/dist/react/provider.d.ts +9 -15
  257. package/dist/react/provider.d.ts.map +1 -1
  258. package/dist/react/provider.js +19 -38
  259. package/dist/react/provider.js.map +1 -1
  260. package/dist/react-core/index.d.ts +3 -4
  261. package/dist/react-core/index.d.ts.map +1 -1
  262. package/dist/react-core/index.js +8 -4
  263. package/dist/react-core/index.js.map +1 -1
  264. package/dist/react-core/provider.d.ts +6 -6
  265. package/dist/react-core/provider.d.ts.map +1 -1
  266. package/dist/react-core/provider.js +5 -6
  267. package/dist/react-core/provider.js.map +1 -1
  268. package/dist/react-core/session.d.ts +41 -33
  269. package/dist/react-core/session.d.ts.map +1 -1
  270. package/dist/react-core/session.js +42 -90
  271. package/dist/react-core/session.js.map +1 -1
  272. package/dist/react-native/account-session.js +1 -1
  273. package/dist/react-native/account-session.js.map +1 -1
  274. package/dist/react-native/create-account-manager.d.ts +1 -1
  275. package/dist/react-native/create-account-manager.d.ts.map +1 -1
  276. package/dist/react-native/create-jazz-session.d.ts +37 -17
  277. package/dist/react-native/create-jazz-session.d.ts.map +1 -1
  278. package/dist/react-native/create-jazz-session.js +53 -10
  279. package/dist/react-native/create-jazz-session.js.map +1 -1
  280. package/dist/react-native/index.d.ts +5 -10
  281. package/dist/react-native/index.d.ts.map +1 -1
  282. package/dist/react-native/index.js +5 -7
  283. package/dist/react-native/index.js.map +1 -1
  284. package/dist/react-native/native-foreground-db.d.ts +21 -0
  285. package/dist/react-native/native-foreground-db.d.ts.map +1 -1
  286. package/dist/react-native/native-foreground-db.js +47 -1
  287. package/dist/react-native/native-foreground-db.js.map +1 -1
  288. package/dist/react-native/provider.d.ts +14 -19
  289. package/dist/react-native/provider.d.ts.map +1 -1
  290. package/dist/react-native/provider.js +19 -18
  291. package/dist/react-native/provider.js.map +1 -1
  292. package/dist/react-native/runtime-source.d.ts +22 -0
  293. package/dist/react-native/runtime-source.d.ts.map +1 -1
  294. package/dist/react-native/runtime-source.js +68 -5
  295. package/dist/react-native/runtime-source.js.map +1 -1
  296. package/dist/removed-api.d.ts +87 -0
  297. package/dist/removed-api.d.ts.map +1 -0
  298. package/dist/removed-api.js +95 -0
  299. package/dist/removed-api.js.map +1 -0
  300. package/dist/runtime/auth-secret-store.d.ts +0 -44
  301. package/dist/runtime/auth-secret-store.d.ts.map +1 -1
  302. package/dist/runtime/auth-secret-store.js +1 -103
  303. package/dist/runtime/auth-secret-store.js.map +1 -1
  304. package/dist/runtime/authority-changed-error.d.ts +5 -3
  305. package/dist/runtime/authority-changed-error.d.ts.map +1 -1
  306. package/dist/runtime/authority-changed-error.js +5 -3
  307. package/dist/runtime/authority-changed-error.js.map +1 -1
  308. package/dist/runtime/browser-worker-assets.d.ts +19 -1
  309. package/dist/runtime/browser-worker-assets.d.ts.map +1 -1
  310. package/dist/runtime/browser-worker-assets.js +23 -1
  311. package/dist/runtime/browser-worker-assets.js.map +1 -1
  312. package/dist/runtime/browser-worker-assets.metro.d.ts +28 -0
  313. package/dist/runtime/browser-worker-assets.metro.d.ts.map +1 -0
  314. package/dist/runtime/browser-worker-assets.metro.js +52 -0
  315. package/dist/runtime/browser-worker-assets.metro.js.map +1 -0
  316. package/dist/runtime/browser-worker-assets.native.d.ts +2 -0
  317. package/dist/runtime/browser-worker-assets.native.d.ts.map +1 -1
  318. package/dist/runtime/browser-worker-assets.native.js +2 -0
  319. package/dist/runtime/browser-worker-assets.native.js.map +1 -1
  320. package/dist/runtime/browser-worker-config.d.ts +23 -0
  321. package/dist/runtime/browser-worker-config.d.ts.map +1 -1
  322. package/dist/runtime/browser-worker-config.js +72 -4
  323. package/dist/runtime/browser-worker-config.js.map +1 -1
  324. package/dist/runtime/client-migrations.d.ts +6 -4
  325. package/dist/runtime/client-migrations.d.ts.map +1 -1
  326. package/dist/runtime/client-migrations.js +20 -2
  327. package/dist/runtime/client-migrations.js.map +1 -1
  328. package/dist/runtime/client.d.ts +46 -6
  329. package/dist/runtime/client.d.ts.map +1 -1
  330. package/dist/runtime/client.js +65 -13
  331. package/dist/runtime/client.js.map +1 -1
  332. package/dist/runtime/connection-manager/browser-connection-manager.d.ts +5 -1
  333. package/dist/runtime/connection-manager/browser-connection-manager.d.ts.map +1 -1
  334. package/dist/runtime/connection-manager/browser-connection-manager.js +38 -2
  335. package/dist/runtime/connection-manager/browser-connection-manager.js.map +1 -1
  336. package/dist/runtime/connection-manager/direct-connection-manager.d.ts +3 -1
  337. package/dist/runtime/connection-manager/direct-connection-manager.d.ts.map +1 -1
  338. package/dist/runtime/connection-manager/direct-connection-manager.js +7 -3
  339. package/dist/runtime/connection-manager/direct-connection-manager.js.map +1 -1
  340. package/dist/runtime/connection-manager/types.d.ts +23 -2
  341. package/dist/runtime/connection-manager/types.d.ts.map +1 -1
  342. package/dist/runtime/connection-manager/types.js +49 -6
  343. package/dist/runtime/connection-manager/types.js.map +1 -1
  344. package/dist/runtime/context.d.ts +5 -1
  345. package/dist/runtime/context.d.ts.map +1 -1
  346. package/dist/runtime/context.js.map +1 -1
  347. package/dist/runtime/core-tick-failed-error.d.ts +31 -0
  348. package/dist/runtime/core-tick-failed-error.d.ts.map +1 -0
  349. package/dist/runtime/core-tick-failed-error.js +45 -0
  350. package/dist/runtime/core-tick-failed-error.js.map +1 -0
  351. package/dist/runtime/credentialed-transport.d.ts +18 -3
  352. package/dist/runtime/credentialed-transport.d.ts.map +1 -1
  353. package/dist/runtime/credentialed-transport.js +34 -11
  354. package/dist/runtime/credentialed-transport.js.map +1 -1
  355. package/dist/runtime/db-replaced-error.d.ts +3 -1
  356. package/dist/runtime/db-replaced-error.d.ts.map +1 -1
  357. package/dist/runtime/db-replaced-error.js +4 -2
  358. package/dist/runtime/db-replaced-error.js.map +1 -1
  359. package/dist/runtime/db.d.ts +40 -8
  360. package/dist/runtime/db.d.ts.map +1 -1
  361. package/dist/runtime/db.js +76 -9
  362. package/dist/runtime/db.js.map +1 -1
  363. package/dist/runtime/default-runtime-source.d.ts.map +1 -1
  364. package/dist/runtime/default-runtime-source.js +6 -1
  365. package/dist/runtime/default-runtime-source.js.map +1 -1
  366. package/dist/runtime/delete-local-first-store.d.ts +12 -0
  367. package/dist/runtime/delete-local-first-store.d.ts.map +1 -0
  368. package/dist/runtime/delete-local-first-store.js +12 -0
  369. package/dist/runtime/delete-local-first-store.js.map +1 -0
  370. package/dist/runtime/index.d.ts +4 -4
  371. package/dist/runtime/index.d.ts.map +1 -1
  372. package/dist/runtime/index.js +2 -2
  373. package/dist/runtime/index.js.map +1 -1
  374. package/dist/runtime/local-first-upgrade.d.ts +9 -0
  375. package/dist/runtime/local-first-upgrade.d.ts.map +1 -1
  376. package/dist/runtime/local-first-upgrade.js.map +1 -1
  377. package/dist/runtime/metro-setup-error.d.ts +20 -0
  378. package/dist/runtime/metro-setup-error.d.ts.map +1 -0
  379. package/dist/runtime/metro-setup-error.js +22 -0
  380. package/dist/runtime/metro-setup-error.js.map +1 -0
  381. package/dist/runtime/native-artifact-fingerprint-napi.d.ts +1 -1
  382. package/dist/runtime/native-artifact-fingerprint-napi.js +1 -1
  383. package/dist/runtime/native-artifact-fingerprint-napi.js.map +1 -1
  384. package/dist/runtime/native-artifact-fingerprint-wasm.d.ts +1 -1
  385. package/dist/runtime/native-artifact-fingerprint-wasm.js +1 -1
  386. package/dist/runtime/native-artifact-fingerprint-wasm.js.map +1 -1
  387. package/dist/runtime/native-artifact-fingerprints.d.ts +2 -2
  388. package/dist/runtime/native-runtime/attached-browser-worker-connection.d.ts +4 -1
  389. package/dist/runtime/native-runtime/attached-browser-worker-connection.d.ts.map +1 -1
  390. package/dist/runtime/native-runtime/attached-browser-worker-connection.js +3 -0
  391. package/dist/runtime/native-runtime/attached-browser-worker-connection.js.map +1 -1
  392. package/dist/runtime/native-runtime/broker-worker-load-failure.d.ts +34 -0
  393. package/dist/runtime/native-runtime/broker-worker-load-failure.d.ts.map +1 -0
  394. package/dist/runtime/native-runtime/broker-worker-load-failure.js +61 -0
  395. package/dist/runtime/native-runtime/broker-worker-load-failure.js.map +1 -0
  396. package/dist/runtime/native-runtime/browser-follower-connection.d.ts +6 -1
  397. package/dist/runtime/native-runtime/browser-follower-connection.d.ts.map +1 -1
  398. package/dist/runtime/native-runtime/browser-follower-connection.js +9 -3
  399. package/dist/runtime/native-runtime/browser-follower-connection.js.map +1 -1
  400. package/dist/runtime/native-runtime/browser-shared-worker-connection.d.ts +12 -1
  401. package/dist/runtime/native-runtime/browser-shared-worker-connection.d.ts.map +1 -1
  402. package/dist/runtime/native-runtime/browser-shared-worker-connection.js +140 -7
  403. package/dist/runtime/native-runtime/browser-shared-worker-connection.js.map +1 -1
  404. package/dist/runtime/native-runtime/browser-worker-protocol.d.ts +29 -1
  405. package/dist/runtime/native-runtime/browser-worker-protocol.d.ts.map +1 -1
  406. package/dist/runtime/native-runtime/browser-worker-protocol.js.map +1 -1
  407. package/dist/runtime/native-runtime/http-stream-socket.d.ts +25 -7
  408. package/dist/runtime/native-runtime/http-stream-socket.d.ts.map +1 -1
  409. package/dist/runtime/native-runtime/http-stream-socket.js +148 -44
  410. package/dist/runtime/native-runtime/http-stream-socket.js.map +1 -1
  411. package/dist/runtime/native-runtime/native-error-code.d.ts +1 -1
  412. package/dist/runtime/native-runtime/native-error-code.d.ts.map +1 -1
  413. package/dist/runtime/native-runtime/native-error-code.js +1 -0
  414. package/dist/runtime/native-runtime/native-error-code.js.map +1 -1
  415. package/dist/runtime/native-runtime/native-runtime-adapter.d.ts +105 -7
  416. package/dist/runtime/native-runtime/native-runtime-adapter.d.ts.map +1 -1
  417. package/dist/runtime/native-runtime/native-runtime-adapter.js +306 -27
  418. package/dist/runtime/native-runtime/native-runtime-adapter.js.map +1 -1
  419. package/dist/runtime/native-runtime/session-renewal-wire.d.ts +48 -0
  420. package/dist/runtime/native-runtime/session-renewal-wire.d.ts.map +1 -0
  421. package/dist/runtime/native-runtime/session-renewal-wire.js +107 -0
  422. package/dist/runtime/native-runtime/session-renewal-wire.js.map +1 -0
  423. package/dist/runtime/native-runtime/stream-endpoint-memory.d.ts +22 -0
  424. package/dist/runtime/native-runtime/stream-endpoint-memory.d.ts.map +1 -0
  425. package/dist/runtime/native-runtime/stream-endpoint-memory.js +69 -0
  426. package/dist/runtime/native-runtime/stream-endpoint-memory.js.map +1 -0
  427. package/dist/runtime/native-runtime/websocket.d.ts +51 -1
  428. package/dist/runtime/native-runtime/websocket.d.ts.map +1 -1
  429. package/dist/runtime/native-runtime/websocket.js +187 -7
  430. package/dist/runtime/native-runtime/websocket.js.map +1 -1
  431. package/dist/runtime/page-handle.d.ts +83 -0
  432. package/dist/runtime/page-handle.d.ts.map +1 -0
  433. package/dist/runtime/page-handle.js +151 -0
  434. package/dist/runtime/page-handle.js.map +1 -0
  435. package/dist/runtime/removed-provider-props.d.ts +17 -0
  436. package/dist/runtime/removed-provider-props.d.ts.map +1 -0
  437. package/dist/runtime/removed-provider-props.js +16 -0
  438. package/dist/runtime/removed-provider-props.js.map +1 -0
  439. package/dist/runtime/row-transformer.d.ts.map +1 -1
  440. package/dist/runtime/row-transformer.js +20 -0
  441. package/dist/runtime/row-transformer.js.map +1 -1
  442. package/dist/runtime/runtime-config.d.ts +5 -1
  443. package/dist/runtime/runtime-config.d.ts.map +1 -1
  444. package/dist/runtime/runtime-config.js +5 -1
  445. package/dist/runtime/runtime-config.js.map +1 -1
  446. package/dist/runtime/runtime-source.d.ts +6 -1
  447. package/dist/runtime/runtime-source.d.ts.map +1 -1
  448. package/dist/runtime/runtime-source.js.map +1 -1
  449. package/dist/runtime/schema-metadata.d.ts +17 -0
  450. package/dist/runtime/schema-metadata.d.ts.map +1 -1
  451. package/dist/runtime/schema-metadata.js +28 -0
  452. package/dist/runtime/schema-metadata.js.map +1 -1
  453. package/dist/runtime/store-held-by-another-tab-error.d.ts +11 -0
  454. package/dist/runtime/store-held-by-another-tab-error.d.ts.map +1 -1
  455. package/dist/runtime/store-held-by-another-tab-error.js +11 -0
  456. package/dist/runtime/store-held-by-another-tab-error.js.map +1 -1
  457. package/dist/runtime/sync-status.d.ts +60 -1
  458. package/dist/runtime/sync-status.d.ts.map +1 -1
  459. package/dist/runtime/sync-status.js +64 -4
  460. package/dist/runtime/sync-status.js.map +1 -1
  461. package/dist/runtime/wasm-loader.d.ts.map +1 -1
  462. package/dist/runtime/wasm-loader.js +8 -1
  463. package/dist/runtime/wasm-loader.js.map +1 -1
  464. package/dist/schema-loader.d.ts +2 -0
  465. package/dist/schema-loader.d.ts.map +1 -1
  466. package/dist/schema-loader.js +7 -2
  467. package/dist/schema-loader.js.map +1 -1
  468. package/dist/schema-permissions.d.ts.map +1 -1
  469. package/dist/schema-permissions.js +19 -0
  470. package/dist/schema-permissions.js.map +1 -1
  471. package/dist/schema-source.d.ts.map +1 -1
  472. package/dist/schema-source.js +14 -0
  473. package/dist/schema-source.js.map +1 -1
  474. package/dist/session/backend-watch.d.ts +56 -15
  475. package/dist/session/backend-watch.d.ts.map +1 -1
  476. package/dist/session/backend-watch.js +127 -31
  477. package/dist/session/backend-watch.js.map +1 -1
  478. package/dist/session/config-options.d.ts +15 -0
  479. package/dist/session/config-options.d.ts.map +1 -0
  480. package/dist/session/config-options.js +55 -0
  481. package/dist/session/config-options.js.map +1 -0
  482. package/dist/session/consumer.d.ts +1 -1
  483. package/dist/session/consumer.js +1 -1
  484. package/dist/session/consumer.js.map +1 -1
  485. package/dist/session/create-jazz-session.d.ts +55 -21
  486. package/dist/session/create-jazz-session.d.ts.map +1 -1
  487. package/dist/session/create-jazz-session.js +215 -166
  488. package/dist/session/create-jazz-session.js.map +1 -1
  489. package/dist/session/follow-user.d.ts +30 -11
  490. package/dist/session/follow-user.d.ts.map +1 -1
  491. package/dist/session/follow-user.js +49 -9
  492. package/dist/session/follow-user.js.map +1 -1
  493. package/dist/session/jazz-session.d.ts +182 -0
  494. package/dist/session/jazz-session.d.ts.map +1 -0
  495. package/dist/session/jazz-session.js +459 -0
  496. package/dist/session/jazz-session.js.map +1 -0
  497. package/dist/session/no-kept-device-account-error.d.ts +6 -0
  498. package/dist/session/no-kept-device-account-error.d.ts.map +1 -0
  499. package/dist/session/no-kept-device-account-error.js +8 -0
  500. package/dist/session/no-kept-device-account-error.js.map +1 -0
  501. package/dist/session/replica-ledger.d.ts +164 -0
  502. package/dist/session/replica-ledger.d.ts.map +1 -0
  503. package/dist/session/replica-ledger.js +450 -0
  504. package/dist/session/replica-ledger.js.map +1 -0
  505. package/dist/session/state.d.ts +50 -13
  506. package/dist/session/state.d.ts.map +1 -1
  507. package/dist/session/state.js +158 -29
  508. package/dist/session/state.js.map +1 -1
  509. package/dist/solid/index.d.ts +3 -9
  510. package/dist/solid/index.d.ts.map +1 -1
  511. package/dist/solid/index.js +8 -11
  512. package/dist/solid/index.ssr.js +3 -6
  513. package/dist/solid/provider.d.ts +3 -3
  514. package/dist/solid/provider.d.ts.map +1 -1
  515. package/dist/solid/provider.js +23 -39
  516. package/dist/solid/provider.js.map +1 -1
  517. package/dist/solid/provider.ssr.js +6 -23
  518. package/dist/solid/provider.ssr.js.map +1 -1
  519. package/dist/solid/session.d.ts +42 -12
  520. package/dist/solid/session.d.ts.map +1 -1
  521. package/dist/solid/session.js +82 -35
  522. package/dist/solid/session.js.map +1 -1
  523. package/dist/solid/session.ssr.js +86 -23
  524. package/dist/solid/session.ssr.js.map +1 -1
  525. package/dist/svelte/JazzProvider.svelte +54 -20
  526. package/dist/svelte/JazzProvider.svelte.d.ts +14 -4
  527. package/dist/svelte/JazzProvider.svelte.d.ts.map +1 -1
  528. package/dist/svelte/JazzSvelteClientProvider.svelte +1 -7
  529. package/dist/svelte/JazzSvelteClientProvider.svelte.d.ts +0 -1
  530. package/dist/svelte/JazzSvelteClientProvider.svelte.d.ts.map +1 -1
  531. package/dist/svelte/JazzSvelteProvider.svelte +5 -4
  532. package/dist/svelte/JazzSvelteProvider.svelte.d.ts +2 -2
  533. package/dist/svelte/JazzSvelteProvider.svelte.d.ts.map +1 -1
  534. package/dist/svelte/index.d.ts +4 -12
  535. package/dist/svelte/index.d.ts.map +1 -1
  536. package/dist/svelte/index.js +4 -8
  537. package/dist/svelte/session-state.d.ts +14 -4
  538. package/dist/svelte/session-state.d.ts.map +1 -1
  539. package/dist/svelte/session-state.js +10 -4
  540. package/dist/testing/client-migrations.d.ts +8 -1
  541. package/dist/testing/client-migrations.d.ts.map +1 -1
  542. package/dist/testing/client-migrations.js +11 -0
  543. package/dist/testing/client-migrations.js.map +1 -1
  544. package/dist/testing/policy-test-app.d.ts.map +1 -1
  545. package/dist/testing/policy-test-app.js +5 -4
  546. package/dist/testing/policy-test-app.js.map +1 -1
  547. package/dist/testing/test-jazz.d.ts +2 -2
  548. package/dist/testing/test-jazz.d.ts.map +1 -1
  549. package/dist/testing/test-jazz.js +6 -3
  550. package/dist/testing/test-jazz.js.map +1 -1
  551. package/dist/thin/index.d.ts +7 -10
  552. package/dist/thin/index.d.ts.map +1 -1
  553. package/dist/thin/index.js +28 -11
  554. package/dist/thin/index.js.map +1 -1
  555. package/dist/thin/thin-runtime.d.ts +53 -3
  556. package/dist/thin/thin-runtime.d.ts.map +1 -1
  557. package/dist/thin/thin-runtime.js +256 -33
  558. package/dist/thin/thin-runtime.js.map +1 -1
  559. package/dist/typed-app.d.ts +10 -4
  560. package/dist/typed-app.d.ts.map +1 -1
  561. package/dist/typed-app.js +44 -18
  562. package/dist/typed-app.js.map +1 -1
  563. package/dist/vue/index.d.ts +3 -8
  564. package/dist/vue/index.d.ts.map +1 -1
  565. package/dist/vue/index.js +3 -5
  566. package/dist/vue/index.js.map +1 -1
  567. package/dist/vue/provider.d.ts +6 -27
  568. package/dist/vue/provider.d.ts.map +1 -1
  569. package/dist/vue/provider.js +10 -19
  570. package/dist/vue/provider.js.map +1 -1
  571. package/dist/vue/session.d.ts +29 -28
  572. package/dist/vue/session.d.ts.map +1 -1
  573. package/dist/vue/session.js +80 -23
  574. package/dist/vue/session.js.map +1 -1
  575. package/dist/web/create-jazz-client.d.ts +5 -1
  576. package/dist/web/create-jazz-client.d.ts.map +1 -1
  577. package/dist/web/create-jazz-client.js +30 -3
  578. package/dist/web/create-jazz-client.js.map +1 -1
  579. package/dist/window-client-storage.d.ts +4 -30
  580. package/dist/window-client-storage.d.ts.map +1 -1
  581. package/dist/window-client-storage.js +2 -63
  582. package/dist/window-client-storage.js.map +1 -1
  583. package/dist/worker/jazz-broker-worker-core.d.ts.map +1 -1
  584. package/dist/worker/jazz-broker-worker-core.js +118 -20
  585. package/dist/worker/jazz-broker-worker-core.js.map +1 -1
  586. package/dist/worker/jazz-broker-worker.js +787 -608
  587. package/dist/worker/jazz_wasm_bg.wasm +0 -0
  588. package/dist/worker/runtime-admission.d.ts +19 -0
  589. package/dist/worker/runtime-admission.d.ts.map +1 -0
  590. package/dist/worker/runtime-admission.js +34 -0
  591. package/dist/worker/runtime-admission.js.map +1 -0
  592. package/dist/worker/vite-dev-broker.d.ts +2 -0
  593. package/dist/worker/vite-dev-broker.d.ts.map +1 -0
  594. package/dist/worker/vite-dev-broker.js +8 -0
  595. package/dist/worker/vite-dev-broker.js.map +1 -0
  596. package/package.json +30 -10
  597. package/dist/backend/session-recheck.d.ts +0 -18
  598. package/dist/backend/session-recheck.d.ts.map +0 -1
  599. package/dist/backend/session-recheck.js +0 -57
  600. package/dist/backend/session-recheck.js.map +0 -1
  601. package/dist/dev/inspector-overlay/embedded/assets/esm-k3rsq4Gn.js +0 -1
  602. package/dist/dev/inspector-overlay/embedded/assets/index-C-btvLcw.js +0 -20
  603. package/dist/dev/inspector-overlay/embedded/assets/jazz-broker-worker-CAMcDeUa.js +0 -3
  604. package/dist/dev/inspector-overlay/embedded/assets/jazz_wasm-Cc71x_6y.js +0 -1
  605. package/dist/dev/inspector-overlay/serve.d.ts +0 -46
  606. package/dist/dev/inspector-overlay/serve.d.ts.map +0 -1
  607. package/dist/dev/inspector-overlay/serve.js +0 -131
  608. package/dist/dev/inspector-overlay/serve.js.map +0 -1
  609. package/dist/dev-tools/auto-attach.d.ts +0 -11
  610. package/dist/dev-tools/auto-attach.d.ts.map +0 -1
  611. package/dist/dev-tools/auto-attach.js +0 -26
  612. package/dist/dev-tools/auto-attach.js.map +0 -1
  613. package/dist/expo/auth-secret-store.d.ts +0 -37
  614. package/dist/expo/auth-secret-store.d.ts.map +0 -1
  615. package/dist/expo/auth-secret-store.js +0 -139
  616. package/dist/expo/auth-secret-store.js.map +0 -1
  617. package/dist/expo/session.d.ts +0 -10
  618. package/dist/expo/session.d.ts.map +0 -1
  619. package/dist/expo/session.js +0 -5
  620. package/dist/expo/session.js.map +0 -1
  621. package/dist/expo/use-local-first-auth.d.ts +0 -12
  622. package/dist/expo/use-local-first-auth.d.ts.map +0 -1
  623. package/dist/expo/use-local-first-auth.js +0 -13
  624. package/dist/expo/use-local-first-auth.js.map +0 -1
  625. package/dist/react/devtools-auto-attach.d.ts +0 -2
  626. package/dist/react/devtools-auto-attach.d.ts.map +0 -1
  627. package/dist/react/devtools-auto-attach.js +0 -11
  628. package/dist/react/devtools-auto-attach.js.map +0 -1
  629. package/dist/react/session.d.ts +0 -18
  630. package/dist/react/session.d.ts.map +0 -1
  631. package/dist/react/session.js +0 -28
  632. package/dist/react/session.js.map +0 -1
  633. package/dist/react/use-local-first-auth.d.ts +0 -11
  634. package/dist/react/use-local-first-auth.d.ts.map +0 -1
  635. package/dist/react/use-local-first-auth.js +0 -13
  636. package/dist/react/use-local-first-auth.js.map +0 -1
  637. package/dist/react-core/app.d.ts +0 -31
  638. package/dist/react-core/app.d.ts.map +0 -1
  639. package/dist/react-core/app.js +0 -65
  640. package/dist/react-core/app.js.map +0 -1
  641. package/dist/react-core/use-account-state.d.ts +0 -4
  642. package/dist/react-core/use-account-state.d.ts.map +0 -1
  643. package/dist/react-core/use-account-state.js +0 -6
  644. package/dist/react-core/use-account-state.js.map +0 -1
  645. package/dist/react-core/use-local-first-auth.d.ts +0 -12
  646. package/dist/react-core/use-local-first-auth.d.ts.map +0 -1
  647. package/dist/react-core/use-local-first-auth.js +0 -14
  648. package/dist/react-core/use-local-first-auth.js.map +0 -1
  649. package/dist/react-native/session.d.ts +0 -10
  650. package/dist/react-native/session.d.ts.map +0 -1
  651. package/dist/react-native/session.js +0 -5
  652. package/dist/react-native/session.js.map +0 -1
  653. package/dist/react-native/use-local-first-auth.d.ts +0 -15
  654. package/dist/react-native/use-local-first-auth.d.ts.map +0 -1
  655. package/dist/react-native/use-local-first-auth.js +0 -14
  656. package/dist/react-native/use-local-first-auth.js.map +0 -1
  657. package/dist/runtime/local-first-auth-controller.d.ts +0 -29
  658. package/dist/runtime/local-first-auth-controller.d.ts.map +0 -1
  659. package/dist/runtime/local-first-auth-controller.js +0 -101
  660. package/dist/runtime/local-first-auth-controller.js.map +0 -1
  661. package/dist/session/app.d.ts +0 -58
  662. package/dist/session/app.d.ts.map +0 -1
  663. package/dist/session/app.js +0 -325
  664. package/dist/session/app.js.map +0 -1
  665. package/dist/session/create-jazz-app.d.ts +0 -11
  666. package/dist/session/create-jazz-app.d.ts.map +0 -1
  667. package/dist/session/create-jazz-app.js +0 -11
  668. package/dist/session/create-jazz-app.js.map +0 -1
  669. package/dist/session/left-behind-replicas.d.ts +0 -62
  670. package/dist/session/left-behind-replicas.d.ts.map +0 -1
  671. package/dist/session/left-behind-replicas.js +0 -146
  672. package/dist/session/left-behind-replicas.js.map +0 -1
  673. package/dist/solid/app.d.ts +0 -30
  674. package/dist/solid/app.d.ts.map +0 -1
  675. package/dist/solid/app.js +0 -95
  676. package/dist/solid/app.js.map +0 -1
  677. package/dist/solid/app.ssr.js +0 -109
  678. package/dist/solid/app.ssr.js.map +0 -1
  679. package/dist/solid/create-account-state.d.ts +0 -4
  680. package/dist/solid/create-account-state.d.ts.map +0 -1
  681. package/dist/solid/create-account-state.js +0 -10
  682. package/dist/solid/create-account-state.js.map +0 -1
  683. package/dist/solid/create-account-state.ssr.js +0 -12
  684. package/dist/solid/create-account-state.ssr.js.map +0 -1
  685. package/dist/solid/use-local-first-auth.d.ts +0 -11
  686. package/dist/solid/use-local-first-auth.d.ts.map +0 -1
  687. package/dist/solid/use-local-first-auth.js +0 -30
  688. package/dist/solid/use-local-first-auth.js.map +0 -1
  689. package/dist/solid/use-local-first-auth.ssr.js +0 -31
  690. package/dist/solid/use-local-first-auth.ssr.js.map +0 -1
  691. package/dist/svelte/JazzSessionClientProvider.svelte +0 -42
  692. package/dist/svelte/JazzSessionClientProvider.svelte.d.ts +0 -13
  693. package/dist/svelte/JazzSessionClientProvider.svelte.d.ts.map +0 -1
  694. package/dist/svelte/JazzSessionProvider.svelte +0 -68
  695. package/dist/svelte/JazzSessionProvider.svelte.d.ts +0 -19
  696. package/dist/svelte/JazzSessionProvider.svelte.d.ts.map +0 -1
  697. package/dist/svelte/account-state.d.ts +0 -5
  698. package/dist/svelte/account-state.d.ts.map +0 -1
  699. package/dist/svelte/account-state.js +0 -9
  700. package/dist/svelte/auth-state.d.ts +0 -23
  701. package/dist/svelte/auth-state.d.ts.map +0 -1
  702. package/dist/svelte/auth-state.js +0 -16
  703. package/dist/svelte/local-first-auth.svelte.d.ts +0 -50
  704. package/dist/svelte/local-first-auth.svelte.d.ts.map +0 -1
  705. package/dist/svelte/local-first-auth.svelte.js +0 -58
  706. package/dist/vue/app.d.ts +0 -76
  707. package/dist/vue/app.d.ts.map +0 -1
  708. package/dist/vue/app.js +0 -100
  709. package/dist/vue/app.js.map +0 -1
  710. package/dist/vue/use-account-state.d.ts +0 -5
  711. package/dist/vue/use-account-state.d.ts.map +0 -1
  712. package/dist/vue/use-account-state.js +0 -10
  713. package/dist/vue/use-account-state.js.map +0 -1
  714. package/dist/vue/use-local-first-auth.d.ts +0 -53
  715. package/dist/vue/use-local-first-auth.d.ts.map +0 -1
  716. package/dist/vue/use-local-first-auth.js +0 -67
  717. package/dist/vue/use-local-first-auth.js.map +0 -1
  718. /package/dist/dev/inspector-overlay/embedded/assets/{esm-CH5eVyQQ.js → esm-xNe3wI_B.js} +0 -0
  719. /package/dist/dev/inspector-overlay/embedded/assets/{node-foreground-node-lease.browser-Bm3gYjlT.js → node-foreground-node-lease.browser-CH8w-D6S.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { parseSnapshotRef } from "../runtime/snapshot-ref.js";
2
- import { CONNECTED, CONNECTING, offlineLink } from "../runtime/sync-status.js";
2
+ import { CONNECTED, CONNECTING, linkFailureOf, offlineLink, } from "../runtime/sync-status.js";
3
3
  import { streamingChunks } from "../runtime/streaming-source.js";
4
4
  import { runtimeRandomBytes } from "../runtime/runtime-entropy.js";
5
5
  import { writeRow } from "../runtime/write-row.js";
@@ -9,7 +9,7 @@ import { canonicalAuthorSubject } from "../runtime/author-id.js";
9
9
  import { PostcardReader, readNativeSubscriptionDelta, } from "../runtime/native-runtime/native-codec.js";
10
10
  import { addNestedOuterColumns, assertNoUnsupportedPermissionIntrospection, assertSupportedReadOptions, branchViewFromWriteContext, decodeSubscriptionDelta, effectiveUpdatedAtMs, encodeCellsForPatch, encodeCellsForRow, encodeCellsForStreamingPatch, encodeCellsForStreamingRow, encodeQueryJson, openTransactionIdFromOptions, parseUuid, queryHasArraySubqueries, queryIncludesDeleted, readOptions, readRelationSnapshot, readRowBatches, rowsFromBatches, rowsFromRelationSnapshot, subscriptionOutputColumns, txIdFromContext, } from "../runtime/native-runtime/native-runtime-adapter.js";
11
11
  import { encodeSchema } from "../runtime/native-runtime/schema-codec.js";
12
- import { WebSocketCarrier, peerIdentityForWebSocketAuth, wireAuthFailureReason, } from "../runtime/native-runtime/websocket.js";
12
+ import { WebSocketCarrier, peerIdentityForWebSocketAuth, isReauthenticateWireError, wireAuthFailureReason, } from "../runtime/native-runtime/websocket.js";
13
13
  import { FEATURE_THIN_RESULTS, decodeThinResponse, encodeThinRequest, MAX_THIN_MESSAGE_BYTES, ThinAssembler, thinWireFrames, isThinResponse, } from "./wire.js";
14
14
  /** A request failed on the server. `code` is the engine's stable error code. */
15
15
  export class ThinRemoteError extends Error {
@@ -50,6 +50,14 @@ export class ThinTransactionLostError extends Error {
50
50
  }
51
51
  }
52
52
  const DEFAULT_RECONNECT_DELAYS_MS = [250, 500, 1_000, 2_000, 5_000];
53
+ /**
54
+ * How long after a keyed write was first sent it may still be sent again
55
+ * (SPEC 8 §8.14). The authority keeps a thin write's dedupe entry for an
56
+ * hour on its own clock, recorded no earlier than the first send, so every
57
+ * resend inside this window still finds it. Past it, a write whose answer
58
+ * was lost ends with its fate unknown.
59
+ */
60
+ export const THIN_WRITE_RESEND_WINDOW_MS = 10 * 60_000;
53
61
  /** Standalone writes the server dedups by their `writeKey` (SPEC 8 §8.14). */
54
62
  const RESENDABLE_WRITES = new Set([
55
63
  "insert",
@@ -78,6 +86,8 @@ export class ThinRuntime {
78
86
  authJson;
79
87
  /** Requests and live queries go out only once the schema is bound. */
80
88
  bound = false;
89
+ /** A planned re-authentication is reconnecting a bound connection (see `lost`). */
90
+ reauthenticating = false;
81
91
  wanted = false;
82
92
  closed = false;
83
93
  attempt = 0;
@@ -86,12 +96,19 @@ export class ThinRuntime {
86
96
  reconnectTimer;
87
97
  /** The server refused the credential: nothing reconnects until `updateAuth`. */
88
98
  refused = false;
99
+ /** How the server put that refusal, for the writes it leaves unsent at close. */
100
+ refusal;
89
101
  /** The connection ended for good (`fatal`, `close`). */
90
102
  stopped = false;
91
103
  /** When connecting started failing; cleared once connected or refused. */
92
104
  failingSince;
93
105
  outagePublished = false;
94
106
  outageReportMs;
107
+ /** Why the latest connection ended, in the server's words when it said. */
108
+ lastLostMessage;
109
+ /** The way the link is failing now, to record each failure once. */
110
+ failingAs = null;
111
+ lastFailure = null;
95
112
  nextRequestId = 1;
96
113
  oneShots = new Map();
97
114
  nextHandle = 1;
@@ -101,13 +118,19 @@ export class ThinRuntime {
101
118
  /** This runtime's writer node: with {@link nextWriteSeq}, each write's
102
119
  * `writeKey`. The server commits the write under a node it derives from
103
120
  * this one and the session's author, so one node serves every identity
104
- * the runtime writes as. */
105
- writerNode = bytesToHex(runtimeRandomBytes(16));
121
+ * the runtime writes as. It is marked as bounding its resends
122
+ * ({@link boundedWriterNode}). */
123
+ writerNode = bytesToHex(boundedWriterNode());
106
124
  nextWriteSeq = 1;
107
125
  /** Writes the server has not answered yet. */
108
126
  unanswered = 0;
127
+ /** Writes the server rejected, and the latest rejection. */
128
+ rejected = 0;
129
+ lastRejection = null;
109
130
  syncStatusListeners = new Set();
110
131
  transactions = new Map();
132
+ /** Streaming writes still sending their value; each settles once its write is made. */
133
+ streamsInFlight = new Set();
111
134
  mutationErrorCallback;
112
135
  authFailureCallback;
113
136
  constructor(schema, options = {}) {
@@ -176,16 +199,22 @@ export class ThinRuntime {
176
199
  this.closed = true;
177
200
  this.wanted = false;
178
201
  this.stop();
179
- const closed = new ThinConnectionLostError("the thin runtime is closed", {
180
- cause: new RuntimeClosedError("the thin runtime is closed"),
202
+ // Closed while the server refused this client's sign-in (its user's
203
+ // access was revoked, or their session ended, and they signed out):
204
+ // what never reached the server says so, not just that it closed.
205
+ const why = this.refused
206
+ ? `the server refused this client's sign-in (${this.refusal?.message ?? "auth_failed"}), and the thin runtime closed before it signed in again`
207
+ : "the thin runtime is closed";
208
+ const closed = new ThinConnectionLostError(why, {
209
+ cause: new RuntimeClosedError(why),
181
210
  });
182
211
  this.dropConnection(closed);
183
212
  // Nothing connects again: a request not sent yet ends too (a write
184
213
  // waiting to go out again with its fate unknown), so a read the app made
185
214
  // while the server was down asks the Db's successor instead.
186
- this.endWaitingRequests(closed, new ThinRequestNotSentError("the thin runtime closed before sending the request", {
187
- cause: closed.cause,
188
- }));
215
+ this.endWaitingRequests(closed, new ThinRequestNotSentError(this.refused
216
+ ? `the request never reached the server: ${why}`
217
+ : "the thin runtime closed before sending the request", { cause: closed.cause }));
189
218
  for (const live of this.liveQueries.values())
190
219
  live.callback = undefined;
191
220
  this.liveQueries.clear();
@@ -203,6 +232,12 @@ export class ThinRuntime {
203
232
  authJson: this.authJson,
204
233
  WebSocket: this.WebSocketImpl,
205
234
  onFrame: (frame) => this.receive(carrier, frame),
235
+ // The server's planned re-authentication arrives as an error on an open
236
+ // connection, ahead of its close: handle it as the connection's end.
237
+ onError: (error) => {
238
+ if (isReauthenticateWireError(error))
239
+ this.lost(carrier, error);
240
+ },
206
241
  onTerminal: (error) => this.lost(carrier, error),
207
242
  });
208
243
  this.carrier = carrier;
@@ -232,7 +267,9 @@ export class ThinRuntime {
232
267
  }
233
268
  this.attempt = 0;
234
269
  this.bound = true;
270
+ this.reauthenticating = false;
235
271
  this.refused = false;
272
+ this.refusal = undefined;
236
273
  this.stopped = false;
237
274
  this.clearOutage();
238
275
  this.notifySyncStatus();
@@ -268,12 +305,27 @@ export class ThinRuntime {
268
305
  if (this.carrier !== carrier)
269
306
  return;
270
307
  const lostError = new ThinConnectionLostError(`${error.code}: ${error.message}`);
308
+ const wasBound = this.bound;
309
+ this.lastLostMessage = error.message;
310
+ // A planned swap that ends any other way is reported as that ending.
311
+ this.reauthenticating = false;
312
+ if (isReauthenticateWireError(error) && wasBound) {
313
+ // The session reached the expiry the app's auth gave it: connect again
314
+ // at once so `authenticate` decides with the current credential. The
315
+ // app keeps seeing a connected link meanwhile; unanswered writes go
316
+ // out again on the new connection.
317
+ this.reauthenticating = true;
318
+ this.dropConnection(lostError, true);
319
+ this.open();
320
+ return;
321
+ }
271
322
  const authFailure = wireAuthFailureReason(error);
272
323
  if (authFailure) {
273
324
  // Refused before the drop publishes, so the link never reads
274
325
  // "connecting" in between.
275
326
  this.clearOutage();
276
327
  this.refused = true;
328
+ this.refusal = lostError;
277
329
  // Writes left unanswered wait for the renewed credential's connection.
278
330
  this.dropConnection(lostError, this.wanted && !this.closed && error.retry !== "never");
279
331
  this.notifySyncStatus();
@@ -288,11 +340,14 @@ export class ThinRuntime {
288
340
  return;
289
341
  }
290
342
  this.dropConnection(lostError, this.wanted && !this.closed);
291
- // An attempt that fails past the window reports the outage.
343
+ // An attempt that fails past the window reports the outage. A server that
344
+ // answered and refused this connection for now (`backpressure` before
345
+ // admission, such as the connection cap per user) is reported at once:
346
+ // there is nothing to wait out, and its message says why.
292
347
  if (!this.stopped &&
293
348
  !this.outagePublished &&
294
- this.failingSince !== undefined &&
295
- Date.now() - this.failingSince >= this.outageReportMs) {
349
+ ((!wasBound && error.code === "backpressure") ||
350
+ (this.failingSince !== undefined && Date.now() - this.failingSince >= this.outageReportMs))) {
296
351
  this.outagePublished = true;
297
352
  }
298
353
  this.notifySyncStatus();
@@ -346,9 +401,15 @@ export class ThinRuntime {
346
401
  // write sent once, unless this drop ends its resends.
347
402
  if (!oneShot.sent && !(oneShot.resending && !resend))
348
403
  continue;
349
- if (oneShot.sent && resend && oneShot.resendable) {
404
+ if (oneShot.sent && resend && oneShot.resendable && !resendWindowPassed(oneShot)) {
350
405
  oneShot.sent = false;
351
406
  oneShot.resending = true;
407
+ this.endAtResendWindow(id, oneShot);
408
+ continue;
409
+ }
410
+ if (oneShot.sent && resend && oneShot.resendable) {
411
+ this.oneShots.delete(id);
412
+ oneShot.reject(resendWindowEnded(error));
352
413
  continue;
353
414
  }
354
415
  this.oneShots.delete(id);
@@ -364,6 +425,7 @@ export class ThinRuntime {
364
425
  fatal(error) {
365
426
  this.wanted = false;
366
427
  this.failure = error;
428
+ this.lastLostMessage = error.message;
367
429
  this.stop();
368
430
  // A write the server may have taken ends with its fate unknown, not as
369
431
  // the server's rejection of it.
@@ -433,7 +495,9 @@ export class ThinRuntime {
433
495
  this.oneShots.set(id, oneShot);
434
496
  if (this.bound)
435
497
  this.transmit(id, oneShot);
436
- }).then((body) => {
498
+ })
499
+ .finally(() => clearTimeout(oneShot?.windowTimer))
500
+ .then((body) => {
437
501
  if (body.type === "error")
438
502
  throw new ThinRemoteError(body.code, body.message);
439
503
  return body;
@@ -441,13 +505,35 @@ export class ThinRuntime {
441
505
  return { answer, oneShot };
442
506
  }
443
507
  transmit(id, oneShot) {
508
+ // Past its window, a resend could find its dedupe entry gone and be
509
+ // written again: it ends with its fate unknown instead.
510
+ if (oneShot.resending && resendWindowPassed(oneShot)) {
511
+ this.oneShots.delete(id);
512
+ oneShot.reject(resendWindowEnded());
513
+ return;
514
+ }
444
515
  const sent = this.sendFrame(this.carrier, encodeThinRequest(id, oneShot.op), (bytes) => {
445
516
  // Refused here: the server would refuse it.
446
517
  this.oneShots.delete(id);
447
518
  oneShot.reject(tooLarge(oneShot.op.type, bytes));
448
519
  });
449
- if (sent)
520
+ if (sent) {
450
521
  oneShot.sent = true;
522
+ oneShot.firstSentAt ??= Date.now();
523
+ clearTimeout(oneShot.windowTimer);
524
+ }
525
+ }
526
+ /** End `oneShot`, waiting to go out again, once its resend window passes
527
+ * (it may wait offline far longer). */
528
+ endAtResendWindow(id, oneShot) {
529
+ clearTimeout(oneShot.windowTimer);
530
+ const left = (oneShot.firstSentAt ?? Date.now()) + THIN_WRITE_RESEND_WINDOW_MS - Date.now();
531
+ oneShot.windowTimer = setTimeout(() => {
532
+ if (this.oneShots.get(id) !== oneShot || oneShot.sent)
533
+ return;
534
+ this.oneShots.delete(id);
535
+ oneShot.reject(resendWindowEnded());
536
+ }, Math.max(0, left));
451
537
  }
452
538
  receive(carrier, piece) {
453
539
  if (this.carrier !== carrier)
@@ -523,7 +609,7 @@ export class ThinRuntime {
523
609
  operation,
524
610
  transaction: txIdFromContext(writeContext),
525
611
  branchView: branchViewFromWriteContext(writeContext),
526
- updatedAtMs: effectiveUpdatedAtMs(writeContext) ?? Date.now(),
612
+ updatedAtMs: effectiveUpdatedAtMs(writeContext) ?? undefined,
527
613
  };
528
614
  }
529
615
  async query(queryJson, sessionJson, tier, optionsJson) {
@@ -717,6 +803,16 @@ export class ThinRuntime {
717
803
  });
718
804
  }
719
805
  async streamingMutation(mutation, table, values, column, source, writeContext, objectId) {
806
+ const running = this.runStreamingMutation(mutation, table, values, column, source, writeContext, objectId);
807
+ // Until its value is sent and its write made, a graceful shutdown (the
808
+ // drain after the local-first upgrade) waits for it: see
809
+ // `waitForPendingWrites`.
810
+ const settled = running.then(() => undefined, () => undefined);
811
+ this.streamsInFlight.add(settled);
812
+ void settled.then(() => this.streamsInFlight.delete(settled));
813
+ return running;
814
+ }
815
+ async runStreamingMutation(mutation, table, values, column, source, writeContext, objectId) {
720
816
  const operation = mutation === "insert" ? "Insert" : mutation === "update" ? "Update" : "Upsert";
721
817
  const context = this.writeTarget(writeContext, operation);
722
818
  const transaction = context.transaction
@@ -744,6 +840,8 @@ export class ThinRuntime {
744
840
  }, stream);
745
841
  // Chunks go one window at a time: each waits for the server to apply
746
842
  // the one before, which bounds what a slow server buffers.
843
+ // Set when the runtime, not the app's source, failed the stream.
844
+ let runtimeFailed = false;
747
845
  const push = async (bytes) => {
748
846
  const windowBytes = 64 * 1024;
749
847
  for (let offset = 0; offset < bytes.byteLength; offset += windowBytes) {
@@ -751,13 +849,19 @@ export class ThinRuntime {
751
849
  type: "streamChunk",
752
850
  stream,
753
851
  chunk: bytes.subarray(offset, offset + windowBytes),
852
+ }).catch((error) => {
853
+ runtimeFailed = true;
854
+ throw error;
754
855
  });
755
856
  }
756
857
  };
757
858
  const encoder = new TextEncoder();
758
859
  let pendingHighSurrogate = "";
759
860
  try {
760
- await begun;
861
+ await begun.catch((error) => {
862
+ runtimeFailed = true;
863
+ throw error;
864
+ });
761
865
  for await (const chunk of streamingChunks(source)) {
762
866
  if (typeof chunk === "string") {
763
867
  if (kind === "Bytea")
@@ -788,6 +892,14 @@ export class ThinRuntime {
788
892
  }
789
893
  catch (error) {
790
894
  void this.request({ type: "abortStream", stream }).catch(() => undefined);
895
+ // The drain after the upgrade lets a stream finish; only the app
896
+ // shutting the client down (a sign-out, an account switch, a close)
897
+ // ends one. Say so, and that the value was not written: the stream
898
+ // never finished, so nothing committed. (The source's own errors
899
+ // stay as they are. A source that never yields again leaves the
900
+ // stream pending: it ends at the source's next step.)
901
+ if (runtimeFailed && this.closed && this.handedOver)
902
+ throw new ThinConnectionLostError("the thin runtime closed before this stream finished: its Db had upgraded to local-first, and the app then shut the client down (a sign-out, an account switch or a close), so the value was not written. Write it again on the Db now in use.", { cause: error });
791
903
  throw error;
792
904
  }
793
905
  const written = context.branchView ? [] : [{ table, id: formatUuid(row) }];
@@ -942,11 +1054,13 @@ export class ThinRuntime {
942
1054
  return offlineLink("stopped");
943
1055
  if (this.refused)
944
1056
  return offlineLink("auth");
945
- if (this.bound)
1057
+ if (this.bound || this.reauthenticating)
946
1058
  return CONNECTED;
947
1059
  return this.outagePublished ? offlineLink("network") : CONNECTING;
948
1060
  }
949
1061
  setRefused(refused) {
1062
+ if (!refused)
1063
+ this.refusal = undefined;
950
1064
  if (this.refused === refused)
951
1065
  return;
952
1066
  this.refused = refused;
@@ -972,6 +1086,22 @@ export class ThinRuntime {
972
1086
  pendingUploadCount() {
973
1087
  return this.unanswered;
974
1088
  }
1089
+ /** The writes waiting for the server's answer, and what it rejected, for the sync status. */
1090
+ uploadStatus() {
1091
+ let oldestPendingAt = null;
1092
+ for (const write of this.writes.values()) {
1093
+ if (write.answered)
1094
+ continue;
1095
+ if (oldestPendingAt === null || write.madeAt < oldestPendingAt)
1096
+ oldestPendingAt = write.madeAt;
1097
+ }
1098
+ return {
1099
+ pending: this.unanswered,
1100
+ oldestPendingAt,
1101
+ rejected: this.rejected,
1102
+ lastRejection: this.lastRejection,
1103
+ };
1104
+ }
975
1105
  /** Observe changes of {@link pendingUploadCount} and {@link upstreamLinkStatus}. */
976
1106
  onSyncStatusChange(listener, signal) {
977
1107
  if (signal.aborted)
@@ -982,25 +1112,73 @@ export class ThinRuntime {
982
1112
  });
983
1113
  }
984
1114
  notifySyncStatus() {
1115
+ this.noteLinkFailure();
985
1116
  for (const listener of [...this.syncStatusListeners])
986
1117
  listener();
987
1118
  }
988
- /** Every write made so far has been answered. Every write is global once answered. */
1119
+ /** The latest time the link failed, and how; it stays after the link recovers. */
1120
+ lastLinkFailure() {
1121
+ this.noteLinkFailure();
1122
+ return this.lastFailure;
1123
+ }
1124
+ /** Record a failure the first time the link is seen failing that way. */
1125
+ noteLinkFailure() {
1126
+ const link = this.upstreamLinkStatus();
1127
+ const failing = link.state === "offline" ? link.reason : null;
1128
+ if (failing === this.failingAs)
1129
+ return;
1130
+ this.failingAs = failing;
1131
+ const failure = linkFailureOf(link, this.lastLostMessage);
1132
+ if (failure)
1133
+ this.lastFailure = failure;
1134
+ }
1135
+ /**
1136
+ * Every write made so far has been answered. Every write is global once
1137
+ * answered. With `inFlightStreams`, streaming writes still sending their
1138
+ * value finish first, and their writes count too, until that signal
1139
+ * aborts: then only the writes made so far count.
1140
+ */
989
1141
  async waitForPendingWrites(_tier, options = {}) {
990
- // Only writes still waiting for their answer, like a local-first client:
991
- // a rejection the app already had doesn't fail every later wait.
992
- const dones = [...this.writes.values()]
993
- .filter((write) => !write.answered)
994
- .map((write) => write.done);
995
- // Waiting for sync fails on the server's rejection. A write whose
996
- // connection ended unanswered is not rejected, and the shutdown drain
997
- // only waits for every write to be answered.
998
- const answered = options.throughOutage
999
- ? Promise.all(dones.map((done) => done.catch((error) => {
1000
- if (error instanceof ThinRemoteError)
1001
- throw error;
1002
- })))
1003
- : Promise.allSettled(dones);
1142
+ const answered = (async () => {
1143
+ // The drain after the local-first upgrade lets a stream finish rather
1144
+ // than closing the connection under it, until the app shuts down.
1145
+ const streams = options.inFlightStreams;
1146
+ if (streams && !streams.aborted && this.streamsInFlight.size > 0) {
1147
+ const ended = new Promise((resolve) => streams.addEventListener("abort", () => resolve(), { once: true }));
1148
+ while (!streams.aborted && this.streamsInFlight.size > 0)
1149
+ await Promise.race([Promise.all(this.streamsInFlight), ended]);
1150
+ }
1151
+ // Only writes still waiting for their answer, like a local-first client:
1152
+ // a rejection the app already had doesn't fail every later wait.
1153
+ const dones = [...this.writes.values()]
1154
+ .filter((write) => !write.answered)
1155
+ .map((write) => write.done);
1156
+ // Waiting for sync fails on the server's rejection. A write whose
1157
+ // connection ended unanswered is not rejected, and the shutdown drain
1158
+ // only waits for every write to be answered.
1159
+ const settled = options.throughOutage
1160
+ ? Promise.all(dones.map((done) => done.catch((error) => {
1161
+ if (error instanceof ThinRemoteError)
1162
+ throw error;
1163
+ })))
1164
+ : Promise.allSettled(dones);
1165
+ if (options.throughOutage || dones.length === 0)
1166
+ return void (await settled);
1167
+ // The upgrade's drain (`inFlightStreams`) runs beside the app, which
1168
+ // may still renew a refused credential: it waits through a refusal
1169
+ // until the app shuts down (the signal aborts).
1170
+ if (streams && !streams.aborted) {
1171
+ const stopping = new Promise((resolve) => streams.addEventListener("abort", () => resolve(false), { once: true }));
1172
+ if (await Promise.race([settled.then(() => true), stopping]))
1173
+ return;
1174
+ }
1175
+ // A shutdown is final: no new credential comes for a runtime that is
1176
+ // stopping, so while the server refuses this client's sign-in (now or
1177
+ // once the shutdown started) nothing will answer those writes, and the
1178
+ // drain fails instead of waiting for good. (`waitForSync` waits
1179
+ // through a refusal, which the app may renew.)
1180
+ await this.unlessRefused(settled);
1181
+ })();
1004
1182
  const signal = options.signal;
1005
1183
  if (!signal) {
1006
1184
  await answered;
@@ -1014,6 +1192,21 @@ export class ThinRuntime {
1014
1192
  })),
1015
1193
  ]);
1016
1194
  }
1195
+ /** `pending`, failing as soon as the server refuses this client's sign-in. */
1196
+ unlessRefused(pending) {
1197
+ const stop = new AbortController();
1198
+ const refused = new Promise((_, reject) => {
1199
+ const check = () => {
1200
+ if (!this.refused)
1201
+ return;
1202
+ stop.abort();
1203
+ reject(new ThinConnectionLostError(`the server refused this client's sign-in (${this.refusal?.message ?? "auth_failed"}), so its writes can't upload`, { cause: this.refusal }));
1204
+ };
1205
+ check();
1206
+ this.onSyncStatusChange(check, stop.signal);
1207
+ });
1208
+ return Promise.race([pending, refused]).finally(() => stop.abort());
1209
+ }
1017
1210
  write(op, rows = []) {
1018
1211
  const txId = `thin:${this.nextRequestId}`;
1019
1212
  const write = {
@@ -1022,6 +1215,7 @@ export class ThinRuntime {
1022
1215
  answered: false,
1023
1216
  confirmed: false,
1024
1217
  rows,
1218
+ madeAt: Date.now(),
1025
1219
  done: Promise.resolve(),
1026
1220
  };
1027
1221
  // A standalone write goes under this runtime's next write id, so it can
@@ -1050,6 +1244,11 @@ export class ThinRuntime {
1050
1244
  await read(rows).catch(() => undefined);
1051
1245
  }, (error) => {
1052
1246
  const failure = error instanceof Error ? error : new Error(String(error));
1247
+ // The sync status counts a rejection whether or not a wait takes it.
1248
+ if (failure instanceof ThinRemoteError) {
1249
+ this.rejected++;
1250
+ this.lastRejection = { code: failure.code, message: failure.message, at: Date.now() };
1251
+ }
1053
1252
  // A failure no wait observes is reported once, like a local-first
1054
1253
  // client's rejected write.
1055
1254
  queueMicrotask(() => {
@@ -1144,6 +1343,21 @@ function viewOptions(context) {
1144
1343
  updatedAtMs: context.updatedAtMs,
1145
1344
  };
1146
1345
  }
1346
+ /**
1347
+ * A writer node marked as bounding its resends to
1348
+ * {@link THIN_WRITE_RESEND_WINDOW_MS} (SPEC 8 §8.14): the tag `jzRB`, then
1349
+ * random bits, as an RFC 9562 version-8 UUID. The authority drops the
1350
+ * dedupe entries of only such a writer's writes; an unmarked node (an
1351
+ * earlier client's, which may resend any time) keeps them.
1352
+ */
1353
+ /** @internal Exported for its contract test. */
1354
+ export function boundedWriterNode() {
1355
+ const bytes = runtimeRandomBytes(16);
1356
+ bytes.set([0x6a, 0x7a, 0x52, 0x42], 0);
1357
+ bytes[6] = (bytes[6] & 0x0f) | 0x80;
1358
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
1359
+ return bytes;
1360
+ }
1147
1361
  /** A UUIDv7: a millisecond timestamp, then random bits. */
1148
1362
  function uuidv7() {
1149
1363
  const bytes = runtimeRandomBytes(16);
@@ -1187,4 +1401,13 @@ function unknownOutcome(cause) {
1187
1401
  ? cause
1188
1402
  : new ThinConnectionLostError(`the connection ended before the server answered: ${cause.message}`, { cause });
1189
1403
  }
1404
+ function resendWindowPassed(oneShot) {
1405
+ return (oneShot.firstSentAt !== undefined &&
1406
+ Date.now() - oneShot.firstSentAt >= THIN_WRITE_RESEND_WINDOW_MS);
1407
+ }
1408
+ /** A write whose answer was lost, past its resend window: it may have
1409
+ * committed, so its fate is unknown. */
1410
+ function resendWindowEnded(cause) {
1411
+ return new ThinConnectionLostError(`the connection ended before the server answered, and the write was first sent more than ${THIN_WRITE_RESEND_WINDOW_MS / 60_000} minutes ago, so it is not sent again: it may or may not have been made`, cause ? { cause } : undefined);
1412
+ }
1190
1413
  //# sourceMappingURL=thin-runtime.js.map