jazz-tools 2.0.0-alpha.9 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +134 -7
- package/bin/jazz-tools.js +95 -68
- package/dist/_dev/inspector-cache-runtime.d.ts +8 -0
- package/dist/_dev/inspector-cache-runtime.d.ts.map +1 -0
- package/dist/_dev/inspector-cache-runtime.js +246 -0
- package/dist/_dev/inspector-cache-runtime.js.map +1 -0
- package/dist/_dev/inspector-client.d.ts +15 -0
- package/dist/_dev/inspector-client.d.ts.map +1 -0
- package/dist/_dev/inspector-client.js +134 -0
- package/dist/_dev/inspector-client.js.map +1 -0
- package/dist/_dev/native-account-session.d.ts +23 -0
- package/dist/_dev/native-account-session.d.ts.map +1 -0
- package/dist/_dev/native-account-session.js +61 -0
- package/dist/_dev/native-account-session.js.map +1 -0
- package/dist/_dev/native-binding-codec.d.ts +9 -0
- package/dist/_dev/native-binding-codec.d.ts.map +1 -0
- package/dist/_dev/native-binding-codec.js +9 -0
- package/dist/_dev/native-binding-codec.js.map +1 -0
- package/dist/accounts/account-manager-core.d.ts +87 -0
- package/dist/accounts/account-manager-core.d.ts.map +1 -0
- package/dist/accounts/account-manager-core.js +236 -0
- package/dist/accounts/account-manager-core.js.map +1 -0
- package/dist/accounts/browser-host.d.ts +8 -0
- package/dist/accounts/browser-host.d.ts.map +1 -0
- package/dist/accounts/browser-host.js +16 -0
- package/dist/accounts/browser-host.js.map +1 -0
- package/dist/accounts/config-capability.d.ts +26 -0
- package/dist/accounts/config-capability.d.ts.map +1 -0
- package/dist/accounts/config-capability.js +58 -0
- package/dist/accounts/config-capability.js.map +1 -0
- package/dist/accounts/context.d.ts +14 -0
- package/dist/accounts/context.d.ts.map +1 -0
- package/dist/accounts/context.js +214 -0
- package/dist/accounts/context.js.map +1 -0
- package/dist/accounts/enrollment.d.ts +95 -0
- package/dist/accounts/enrollment.d.ts.map +1 -0
- package/dist/accounts/enrollment.js +314 -0
- package/dist/accounts/enrollment.js.map +1 -0
- package/dist/accounts/exports.d.ts +3 -0
- package/dist/accounts/exports.d.ts.map +1 -0
- package/dist/accounts/exports.js +5 -0
- package/dist/accounts/exports.js.map +1 -0
- package/dist/accounts/local-first.d.ts +17 -0
- package/dist/accounts/local-first.d.ts.map +1 -0
- package/dist/accounts/local-first.js +62 -0
- package/dist/accounts/local-first.js.map +1 -0
- package/dist/accounts/persistence.d.ts +79 -0
- package/dist/accounts/persistence.d.ts.map +1 -0
- package/dist/accounts/persistence.js +533 -0
- package/dist/accounts/persistence.js.map +1 -0
- package/dist/accounts/process-store.d.ts +27 -0
- package/dist/accounts/process-store.d.ts.map +1 -0
- package/dist/accounts/process-store.js +49 -0
- package/dist/accounts/process-store.js.map +1 -0
- package/dist/accounts/registry-client.d.ts +79 -0
- package/dist/accounts/registry-client.d.ts.map +1 -0
- package/dist/accounts/registry-client.js +153 -0
- package/dist/accounts/registry-client.js.map +1 -0
- package/dist/accounts/state.d.ts +76 -0
- package/dist/accounts/state.d.ts.map +1 -0
- package/dist/accounts/state.js +172 -0
- package/dist/accounts/state.js.map +1 -0
- package/dist/app-file-enums.d.ts +9 -0
- package/dist/app-file-enums.d.ts.map +1 -0
- package/dist/app-file-enums.js +34 -0
- package/dist/app-file-enums.js.map +1 -0
- package/dist/authoring.d.ts +9 -0
- package/dist/authoring.d.ts.map +1 -0
- package/dist/authoring.js +9 -0
- package/dist/authoring.js.map +1 -0
- package/dist/backend/admission.d.ts +28 -0
- package/dist/backend/admission.d.ts.map +1 -0
- package/dist/backend/admission.js +146 -0
- package/dist/backend/admission.js.map +1 -0
- package/dist/backend/api.d.ts +12 -0
- package/dist/backend/api.d.ts.map +1 -0
- package/dist/backend/api.js +11 -0
- package/dist/backend/api.js.map +1 -0
- package/dist/backend/backend-clients.d.ts +76 -0
- package/dist/backend/backend-clients.d.ts.map +1 -0
- package/dist/backend/backend-clients.js +237 -0
- package/dist/backend/backend-clients.js.map +1 -0
- package/dist/backend/backend-issuer.d.ts +6 -0
- package/dist/backend/backend-issuer.d.ts.map +1 -0
- package/dist/backend/backend-issuer.js +6 -0
- package/dist/backend/backend-issuer.js.map +1 -0
- package/dist/backend/backend-native.d.ts +40 -0
- package/dist/backend/backend-native.d.ts.map +1 -0
- package/dist/backend/backend-native.js +37 -0
- package/dist/backend/backend-native.js.map +1 -0
- package/dist/backend/blobs.d.ts +130 -0
- package/dist/backend/blobs.d.ts.map +1 -0
- package/dist/backend/blobs.js +132 -0
- package/dist/backend/blobs.js.map +1 -0
- package/dist/backend/core-transport.d.ts +61 -0
- package/dist/backend/core-transport.d.ts.map +1 -0
- package/dist/backend/core-transport.js +106 -0
- package/dist/backend/core-transport.js.map +1 -0
- package/dist/backend/create-jazz-context.d.ts +94 -28
- package/dist/backend/create-jazz-context.d.ts.map +1 -1
- package/dist/backend/create-jazz-context.js +661 -67
- package/dist/backend/create-jazz-context.js.map +1 -1
- package/dist/backend/create-jazz-session.d.ts +125 -0
- package/dist/backend/create-jazz-session.d.ts.map +1 -0
- package/dist/backend/create-jazz-session.js +528 -0
- package/dist/backend/create-jazz-session.js.map +1 -0
- package/dist/backend/create-jazz.d.ts +677 -0
- package/dist/backend/create-jazz.d.ts.map +1 -0
- package/dist/backend/create-jazz.js +4076 -0
- package/dist/backend/create-jazz.js.map +1 -0
- package/dist/backend/early-db.d.ts +29 -0
- package/dist/backend/early-db.d.ts.map +1 -0
- package/dist/backend/early-db.js +203 -0
- package/dist/backend/early-db.js.map +1 -0
- package/dist/backend/external-jwt.d.ts +27 -0
- package/dist/backend/external-jwt.d.ts.map +1 -0
- package/dist/backend/external-jwt.js +404 -0
- package/dist/backend/external-jwt.js.map +1 -0
- package/dist/backend/from-jwt.d.ts +64 -0
- package/dist/backend/from-jwt.d.ts.map +1 -0
- package/dist/backend/from-jwt.js +104 -0
- package/dist/backend/from-jwt.js.map +1 -0
- package/dist/backend/index.d.ts +6 -3
- package/dist/backend/index.d.ts.map +1 -1
- package/dist/backend/index.js +18 -2
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/inspect-ui.d.ts +14 -0
- package/dist/backend/inspect-ui.d.ts.map +1 -0
- package/dist/backend/inspect-ui.js +156 -0
- package/dist/backend/inspect-ui.js.map +1 -0
- package/dist/backend/inspect.d.ts +133 -0
- package/dist/backend/inspect.d.ts.map +1 -0
- package/dist/backend/inspect.js +1001 -0
- package/dist/backend/inspect.js.map +1 -0
- package/dist/backend/inspector-ui/0.js +2 -0
- package/dist/backend/inspector-ui/1.js +2 -0
- package/dist/backend/inspector-ui/10.js +2 -0
- package/dist/backend/inspector-ui/11.js +2 -0
- package/dist/backend/inspector-ui/12.js +2 -0
- package/dist/backend/inspector-ui/13.js +2 -0
- package/dist/backend/inspector-ui/14.js +2 -0
- package/dist/backend/inspector-ui/15.js +2 -0
- package/dist/backend/inspector-ui/16.js +2 -0
- package/dist/backend/inspector-ui/17.js +2 -0
- package/dist/backend/inspector-ui/18.js +2 -0
- package/dist/backend/inspector-ui/19.js +2 -0
- package/dist/backend/inspector-ui/2.js +2 -0
- package/dist/backend/inspector-ui/20.js +2 -0
- package/dist/backend/inspector-ui/21.js +2 -0
- package/dist/backend/inspector-ui/3.js +2 -0
- package/dist/backend/inspector-ui/4.js +2 -0
- package/dist/backend/inspector-ui/5.js +2 -0
- package/dist/backend/inspector-ui/6.js +2 -0
- package/dist/backend/inspector-ui/7.js +2 -0
- package/dist/backend/inspector-ui/8.js +2 -0
- package/dist/backend/inspector-ui/9.js +2 -0
- package/dist/backend/inspector-ui-files.d.ts +4 -0
- package/dist/backend/inspector-ui-files.d.ts.map +1 -0
- package/dist/backend/inspector-ui-files.js +26 -0
- package/dist/backend/no-account-error.d.ts +23 -0
- package/dist/backend/no-account-error.d.ts.map +1 -0
- package/dist/backend/no-account-error.js +30 -0
- package/dist/backend/no-account-error.js.map +1 -0
- package/dist/backend/node-native.d.ts +3 -0
- package/dist/backend/node-native.d.ts.map +1 -0
- package/dist/backend/node-native.js +19 -0
- package/dist/backend/node-native.js.map +1 -0
- package/dist/backend/node-peers.d.ts +10 -0
- package/dist/backend/node-peers.d.ts.map +1 -0
- package/dist/backend/node-peers.js +37 -0
- package/dist/backend/node-peers.js.map +1 -0
- package/dist/backend/optional-peer.d.ts +9 -0
- package/dist/backend/optional-peer.d.ts.map +1 -0
- package/dist/backend/optional-peer.js +24 -0
- package/dist/backend/optional-peer.js.map +1 -0
- package/dist/backend/request-auth.d.ts +69 -0
- package/dist/backend/request-auth.d.ts.map +1 -0
- package/dist/backend/request-auth.js +122 -0
- package/dist/backend/request-auth.js.map +1 -0
- package/dist/backend/session-expiry.d.ts +61 -0
- package/dist/backend/session-expiry.d.ts.map +1 -0
- package/dist/backend/session-expiry.js +102 -0
- package/dist/backend/session-expiry.js.map +1 -0
- package/dist/backend/signing-key.d.ts +32 -0
- package/dist/backend/signing-key.d.ts.map +1 -0
- package/dist/backend/signing-key.js +63 -0
- package/dist/backend/signing-key.js.map +1 -0
- package/dist/backend/socket-deadline.d.ts +23 -0
- package/dist/backend/socket-deadline.d.ts.map +1 -0
- package/dist/backend/socket-deadline.js +70 -0
- package/dist/backend/socket-deadline.js.map +1 -0
- package/dist/backend/store-log.d.ts +3 -0
- package/dist/backend/store-log.d.ts.map +1 -0
- package/dist/backend/store-log.js +16 -0
- package/dist/backend/store-log.js.map +1 -0
- package/dist/backend/thin-relay.d.ts +66 -0
- package/dist/backend/thin-relay.d.ts.map +1 -0
- package/dist/backend/thin-relay.js +204 -0
- package/dist/backend/thin-relay.js.map +1 -0
- package/dist/backend/thin-session-client.d.ts +23 -0
- package/dist/backend/thin-session-client.d.ts.map +1 -0
- package/dist/backend/thin-session-client.js +69 -0
- package/dist/backend/thin-session-client.js.map +1 -0
- package/dist/backend/upgrade-status.d.ts +19 -0
- package/dist/backend/upgrade-status.d.ts.map +1 -0
- package/dist/backend/upgrade-status.js +55 -0
- package/dist/backend/upgrade-status.js.map +1 -0
- package/dist/backend/vercel-store.d.ts +345 -0
- package/dist/backend/vercel-store.d.ts.map +1 -0
- package/dist/backend/vercel-store.js +1387 -0
- package/dist/backend/vercel-store.js.map +1 -0
- package/dist/backend/workerd-backend.d.ts +36 -0
- package/dist/backend/workerd-backend.d.ts.map +1 -0
- package/dist/backend/workerd-backend.js +97 -0
- package/dist/backend/workerd-backend.js.map +1 -0
- package/dist/backend/workerd.d.ts +3 -0
- package/dist/backend/workerd.d.ts.map +1 -0
- package/dist/backend/workerd.js +39 -0
- package/dist/backend/workerd.js.map +1 -0
- package/dist/backend/ws-peer.d.ts +32 -0
- package/dist/backend/ws-peer.d.ts.map +1 -0
- package/dist/backend/ws-peer.js +41 -0
- package/dist/backend/ws-peer.js.map +1 -0
- package/dist/better-auth-adapter/fixtures/app.d.ts +151 -0
- package/dist/better-auth-adapter/fixtures/app.d.ts.map +1 -0
- package/dist/better-auth-adapter/fixtures/app.js +13 -0
- package/dist/better-auth-adapter/fixtures/app.js.map +1 -0
- package/dist/better-auth-adapter/fixtures/issuer-upgrade.d.ts +20 -0
- package/dist/better-auth-adapter/fixtures/issuer-upgrade.d.ts.map +1 -0
- package/dist/better-auth-adapter/fixtures/issuer-upgrade.js +27 -0
- package/dist/better-auth-adapter/fixtures/issuer-upgrade.js.map +1 -0
- package/dist/better-auth-adapter/index.d.ts +13 -0
- package/dist/better-auth-adapter/index.d.ts.map +1 -0
- package/dist/better-auth-adapter/index.js +406 -0
- package/dist/better-auth-adapter/index.js.map +1 -0
- package/dist/better-auth-adapter/indexes.d.ts +9 -0
- package/dist/better-auth-adapter/indexes.d.ts.map +1 -0
- package/dist/better-auth-adapter/indexes.js +40 -0
- package/dist/better-auth-adapter/indexes.js.map +1 -0
- package/dist/better-auth-adapter/schema.d.ts +88 -0
- package/dist/better-auth-adapter/schema.d.ts.map +1 -0
- package/dist/better-auth-adapter/schema.js +332 -0
- package/dist/better-auth-adapter/schema.js.map +1 -0
- package/dist/better-auth-adapter/types.d.ts +13 -0
- package/dist/better-auth-adapter/types.d.ts.map +1 -0
- package/dist/better-auth-adapter/types.js +2 -0
- package/dist/better-auth-adapter/types.js.map +1 -0
- package/dist/better-auth-adapter/utils.d.ts +53 -0
- package/dist/better-auth-adapter/utils.d.ts.map +1 -0
- package/dist/better-auth-adapter/utils.js +126 -0
- package/dist/better-auth-adapter/utils.js.map +1 -0
- package/dist/browser-benchmark-mode.d.ts +6 -0
- package/dist/browser-benchmark-mode.d.ts.map +1 -0
- package/dist/browser-benchmark-mode.js +13 -0
- package/dist/browser-benchmark-mode.js.map +1 -0
- package/dist/classic-api.d.ts +59 -0
- package/dist/classic-api.d.ts.map +1 -0
- package/dist/classic-api.js +122 -0
- package/dist/classic-api.js.map +1 -0
- package/dist/cli.d.ts +38 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +457 -265
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +5 -0
- package/dist/client/index.js.map +1 -0
- package/dist/cloud/api.d.ts +11 -0
- package/dist/cloud/api.d.ts.map +1 -0
- package/dist/cloud/api.js +46 -0
- package/dist/cloud/api.js.map +1 -0
- package/dist/cloud/commands.d.ts +13 -0
- package/dist/cloud/commands.d.ts.map +1 -0
- package/dist/cloud/commands.js +425 -0
- package/dist/cloud/commands.js.map +1 -0
- package/dist/cloud/credentials.d.ts +49 -0
- package/dist/cloud/credentials.d.ts.map +1 -0
- package/dist/cloud/credentials.js +219 -0
- package/dist/cloud/credentials.js.map +1 -0
- package/dist/cloud/session.d.ts +57 -0
- package/dist/cloud/session.d.ts.map +1 -0
- package/dist/cloud/session.js +269 -0
- package/dist/cloud/session.js.map +1 -0
- package/dist/codegen/relation-analyzer.d.ts +5 -12
- package/dist/codegen/relation-analyzer.d.ts.map +1 -1
- package/dist/codegen/relation-analyzer.js +53 -64
- package/dist/codegen/relation-analyzer.js.map +1 -1
- package/dist/dev/app-files.d.ts +32 -0
- package/dist/dev/app-files.d.ts.map +1 -0
- package/dist/dev/app-files.js +72 -0
- package/dist/dev/app-files.js.map +1 -0
- package/dist/dev/catalogue-api.d.ts +147 -0
- package/dist/dev/catalogue-api.d.ts.map +1 -0
- package/dist/dev/catalogue-api.js +127 -0
- package/dist/dev/catalogue-api.js.map +1 -0
- package/dist/dev/catalogue.d.ts +69 -0
- package/dist/dev/catalogue.d.ts.map +1 -0
- package/dist/dev/catalogue.js +70 -0
- package/dist/dev/catalogue.js.map +1 -0
- package/dist/dev/codegen-napi.d.ts +139 -0
- package/dist/dev/codegen-napi.d.ts.map +1 -0
- package/dist/dev/codegen-napi.js +157 -0
- package/dist/dev/codegen-napi.js.map +1 -0
- package/dist/dev/dev-server.d.ts +62 -0
- package/dist/dev/dev-server.d.ts.map +1 -0
- package/dist/dev/dev-server.js +164 -0
- package/dist/dev/dev-server.js.map +1 -0
- package/dist/dev/index.d.ts +3 -0
- package/dist/dev/index.d.ts.map +1 -0
- package/dist/dev/index.js +3 -0
- package/dist/dev/index.js.map +1 -0
- package/dist/dev/inspector-overlay/browser-control-registry.d.ts +10 -0
- package/dist/dev/inspector-overlay/browser-control-registry.d.ts.map +1 -0
- package/dist/dev/inspector-overlay/browser-control-registry.js +188 -0
- package/dist/dev/inspector-overlay/browser-control-registry.js.map +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/ExportResult-C0ZojfNk.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/backend-0Idv0niF.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/backend-DHeT1LCS.css +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/create-legacy-browser-delegate-DeI8PAZ5.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/diag-api-3Z_Eel3W.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-BB6DtWpZ.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-B_xpsQL2.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-CE7mSo95.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-CcBEG-yV.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-DZrCzNXM.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-k373aadI.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/index-DUKUt96e.js +5 -0
- package/dist/dev/inspector-overlay/embedded/assets/jazz-broker-worker-C_mr9Omd.js +5 -0
- package/dist/dev/inspector-overlay/embedded/assets/jazz_wasm-BOvbCHn3.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/jazz_wasm_bg-BG8gazqt.wasm +0 -0
- package/dist/dev/inspector-overlay/embedded/assets/node-foreground-node-lease.browser-2mfp13Qb.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/src-4JwhxZaW.js +16 -0
- package/dist/dev/inspector-overlay/embedded/assets/src-Cq8gSOLx.css +1 -0
- package/dist/dev/inspector-overlay/embedded/backend.html +17 -0
- package/dist/dev/inspector-overlay/embedded/embedded.html +15 -0
- package/dist/dev/inspector-overlay/embedded/favicon.ico +0 -0
- package/dist/dev/inspector-overlay/host-bridge.d.ts +8 -0
- package/dist/dev/inspector-overlay/host-bridge.d.ts.map +1 -0
- package/dist/dev/inspector-overlay/host-bridge.js +139 -0
- package/dist/dev/inspector-overlay/host-bridge.js.map +1 -0
- package/dist/dev/inspector-overlay/inspector-host-types.d.ts +35 -0
- package/dist/dev/inspector-overlay/inspector-host-types.d.ts.map +1 -0
- package/dist/dev/inspector-overlay/inspector-host-types.js +10 -0
- package/dist/dev/inspector-overlay/inspector-host-types.js.map +1 -0
- package/dist/dev/inspector-overlay/loader.d.ts +24 -0
- package/dist/dev/inspector-overlay/loader.d.ts.map +1 -0
- package/dist/dev/inspector-overlay/loader.js +533 -0
- package/dist/dev/inspector-overlay/loader.js.map +1 -0
- package/dist/dev/migration-graph.d.ts +32 -0
- package/dist/dev/migration-graph.d.ts.map +1 -0
- package/dist/dev/migration-graph.js +136 -0
- package/dist/dev/migration-graph.js.map +1 -0
- package/dist/dev/migrations.d.ts +145 -0
- package/dist/dev/migrations.d.ts.map +1 -0
- package/dist/dev/migrations.js +700 -0
- package/dist/dev/migrations.js.map +1 -0
- package/dist/dev/project.d.ts +65 -0
- package/dist/dev/project.d.ts.map +1 -0
- package/dist/dev/project.js +179 -0
- package/dist/dev/project.js.map +1 -0
- package/dist/dev/schema-utils.d.ts +8 -0
- package/dist/dev/schema-utils.d.ts.map +1 -0
- package/dist/dev/schema-utils.js +75 -0
- package/dist/dev/schema-utils.js.map +1 -0
- package/dist/dev/schema-validation.d.ts +5 -0
- package/dist/dev/schema-validation.d.ts.map +1 -0
- package/dist/dev/schema-validation.js +11 -0
- package/dist/dev/schema-validation.js.map +1 -0
- package/dist/dev/ts-project.d.ts +77 -0
- package/dist/dev/ts-project.d.ts.map +1 -0
- package/dist/dev/ts-project.js +191 -0
- package/dist/dev/ts-project.js.map +1 -0
- package/dist/drivers/index.d.ts +1 -1
- package/dist/drivers/index.d.ts.map +1 -1
- package/dist/drivers/index.js.map +1 -1
- package/dist/drivers/schema-wire.d.ts +19 -3
- package/dist/drivers/schema-wire.d.ts.map +1 -1
- package/dist/drivers/schema-wire.js +61 -11
- package/dist/drivers/schema-wire.js.map +1 -1
- package/dist/drivers/types.d.ts +166 -29
- package/dist/drivers/types.d.ts.map +1 -1
- package/dist/drivers/types.js +5 -2
- package/dist/drivers/types.js.map +1 -1
- package/dist/dsl.d.ts +276 -121
- package/dist/dsl.d.ts.map +1 -1
- package/dist/dsl.js +196 -160
- package/dist/dsl.js.map +1 -1
- package/dist/durable-object/index.d.ts +26 -0
- package/dist/durable-object/index.d.ts.map +1 -0
- package/dist/durable-object/index.js +26 -0
- package/dist/durable-object/index.js.map +1 -0
- package/dist/e2ee/SODIUM-LICENSE.txt +36 -0
- package/dist/e2ee/SODIUM-SOURCES.json +4 -0
- package/dist/e2ee/browser.d.ts +18 -0
- package/dist/e2ee/browser.d.ts.map +1 -0
- package/dist/e2ee/browser.js +111 -0
- package/dist/e2ee/browser.js.map +1 -0
- package/dist/e2ee/context.d.ts +23 -0
- package/dist/e2ee/context.d.ts.map +1 -0
- package/dist/e2ee/context.js +49 -0
- package/dist/e2ee/context.js.map +1 -0
- package/dist/e2ee/crypto.d.ts +10 -0
- package/dist/e2ee/crypto.d.ts.map +1 -0
- package/dist/e2ee/crypto.js +22 -0
- package/dist/e2ee/crypto.js.map +1 -0
- package/dist/e2ee/envelope.d.ts +22 -0
- package/dist/e2ee/envelope.d.ts.map +1 -0
- package/dist/e2ee/envelope.js +52 -0
- package/dist/e2ee/envelope.js.map +1 -0
- package/dist/e2ee/index.d.ts +14 -0
- package/dist/e2ee/index.d.ts.map +1 -0
- package/dist/e2ee/index.js +3 -0
- package/dist/e2ee/index.js.map +1 -0
- package/dist/e2ee/large-value.d.ts +20 -0
- package/dist/e2ee/large-value.d.ts.map +1 -0
- package/dist/e2ee/large-value.js +204 -0
- package/dist/e2ee/large-value.js.map +1 -0
- package/dist/e2ee/native.d.ts +18 -0
- package/dist/e2ee/native.d.ts.map +1 -0
- package/dist/e2ee/native.js +91 -0
- package/dist/e2ee/native.js.map +1 -0
- package/dist/e2ee/record-frame.d.ts +3 -0
- package/dist/e2ee/record-frame.d.ts.map +1 -0
- package/dist/e2ee/record-frame.js +18 -0
- package/dist/e2ee/record-frame.js.map +1 -0
- package/dist/e2ee/signer.d.ts +10 -0
- package/dist/e2ee/signer.d.ts.map +1 -0
- package/dist/e2ee/signer.js +54 -0
- package/dist/e2ee/signer.js.map +1 -0
- package/dist/e2ee/sodium-browser.d.ts +2 -0
- package/dist/e2ee/sodium-browser.d.ts.map +1 -0
- package/dist/e2ee/sodium-browser.js +3432 -0
- package/dist/e2ee/sodium.d.ts +20 -0
- package/dist/e2ee/sodium.d.ts.map +1 -0
- package/dist/e2ee/sodium.js +165 -0
- package/dist/e2ee/sodium.js.map +1 -0
- package/dist/e2ee/types.d.ts +92 -0
- package/dist/e2ee/types.d.ts.map +1 -0
- package/dist/e2ee/types.js +2 -0
- package/dist/e2ee/types.js.map +1 -0
- package/dist/effect/backend/index.d.ts +8 -0
- package/dist/effect/backend/index.d.ts.map +1 -0
- package/dist/effect/backend/index.js +8 -0
- package/dist/effect/backend/index.js.map +1 -0
- package/dist/effect/errors.d.ts +53 -0
- package/dist/effect/errors.d.ts.map +1 -0
- package/dist/effect/errors.js +61 -0
- package/dist/effect/errors.js.map +1 -0
- package/dist/effect/index.d.ts +9 -0
- package/dist/effect/index.d.ts.map +1 -0
- package/dist/effect/index.js +9 -0
- package/dist/effect/index.js.map +1 -0
- package/dist/effect/jazz-backend.d.ts +69 -0
- package/dist/effect/jazz-backend.d.ts.map +1 -0
- package/dist/effect/jazz-backend.js +95 -0
- package/dist/effect/jazz-backend.js.map +1 -0
- package/dist/effect/jazz.d.ts +129 -0
- package/dist/effect/jazz.d.ts.map +1 -0
- package/dist/effect/jazz.js +182 -0
- package/dist/effect/jazz.js.map +1 -0
- package/dist/expo/create-account-manager.d.ts +28 -0
- package/dist/expo/create-account-manager.d.ts.map +1 -0
- package/dist/expo/create-account-manager.js +35 -0
- package/dist/expo/create-account-manager.js.map +1 -0
- package/dist/expo/create-jazz-session.d.ts +66 -0
- package/dist/expo/create-jazz-session.d.ts.map +1 -0
- package/dist/expo/create-jazz-session.js +96 -0
- package/dist/expo/create-jazz-session.js.map +1 -0
- package/dist/expo/index.d.ts +12 -0
- package/dist/expo/index.d.ts.map +1 -0
- package/dist/expo/index.js +10 -0
- package/dist/expo/index.js.map +1 -0
- package/dist/expo/metro.d.ts +20 -0
- package/dist/expo/metro.d.ts.map +1 -0
- package/dist/expo/metro.js +58 -0
- package/dist/expo/metro.js.map +1 -0
- package/dist/expo/polyfills.d.ts +2 -0
- package/dist/expo/polyfills.d.ts.map +1 -0
- package/dist/expo/polyfills.js +5 -0
- package/dist/expo/polyfills.js.map +1 -0
- package/dist/expo/provider.d.ts +10 -0
- package/dist/expo/provider.d.ts.map +1 -0
- package/dist/expo/provider.js +11 -0
- package/dist/expo/provider.js.map +1 -0
- package/dist/index.d.ts +21 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -12
- package/dist/index.js.map +1 -1
- package/dist/inspect/cli.d.ts +12 -0
- package/dist/inspect/cli.d.ts.map +1 -0
- package/dist/inspect/cli.js +320 -0
- package/dist/inspect/cli.js.map +1 -0
- package/dist/inspect/client.d.ts +67 -0
- package/dist/inspect/client.d.ts.map +1 -0
- package/dist/inspect/client.js +254 -0
- package/dist/inspect/client.js.map +1 -0
- package/dist/inspect/mcp.d.ts +28 -0
- package/dist/inspect/mcp.d.ts.map +1 -0
- package/dist/inspect/mcp.js +441 -0
- package/dist/inspect/mcp.js.map +1 -0
- package/dist/inspect/protocol.d.ts +317 -0
- package/dist/inspect/protocol.d.ts.map +1 -0
- package/dist/inspect/protocol.js +544 -0
- package/dist/inspect/protocol.js.map +1 -0
- package/dist/inspector/index.d.ts +10 -0
- package/dist/inspector/index.d.ts.map +1 -0
- package/dist/inspector/index.js +27 -0
- package/dist/inspector/index.js.map +1 -0
- package/dist/internal/inspector-query.d.ts +6 -0
- package/dist/internal/inspector-query.d.ts.map +1 -0
- package/dist/internal/inspector-query.js +20 -0
- package/dist/internal/inspector-query.js.map +1 -0
- package/dist/ir.d.ts +43 -7
- package/dist/ir.d.ts.map +1 -1
- package/dist/ir.js +509 -1
- package/dist/ir.js.map +1 -1
- package/dist/json-value.d.ts +6 -0
- package/dist/json-value.d.ts.map +1 -0
- package/dist/json-value.js +2 -0
- package/dist/json-value.js.map +1 -0
- package/dist/local-first/index.d.ts +18 -0
- package/dist/local-first/index.d.ts.map +1 -0
- package/dist/local-first/index.js +17 -0
- package/dist/local-first/index.js.map +1 -0
- package/dist/local-first-auth/browser.d.ts +18 -0
- package/dist/local-first-auth/browser.d.ts.map +1 -0
- package/dist/local-first-auth/browser.js +26 -0
- package/dist/local-first-auth/browser.js.map +1 -0
- package/dist/local-first-auth/encoding.d.ts +10 -0
- package/dist/local-first-auth/encoding.d.ts.map +1 -0
- package/dist/local-first-auth/encoding.js +38 -0
- package/dist/local-first-auth/encoding.js.map +1 -0
- package/dist/local-first-auth/identity.d.ts +73 -0
- package/dist/local-first-auth/identity.d.ts.map +1 -0
- package/dist/local-first-auth/identity.js +258 -0
- package/dist/local-first-auth/identity.js.map +1 -0
- package/dist/local-first-auth/index.d.ts +6 -0
- package/dist/local-first-auth/index.d.ts.map +1 -0
- package/dist/local-first-auth/index.js +4 -0
- package/dist/local-first-auth/index.js.map +1 -0
- package/dist/local-first-auth/passkey.d.ts +22 -0
- package/dist/local-first-auth/passkey.d.ts.map +1 -0
- package/dist/local-first-auth/passkey.js +116 -0
- package/dist/local-first-auth/passkey.js.map +1 -0
- package/dist/local-first-auth/recovery-phrase.d.ts +10 -0
- package/dist/local-first-auth/recovery-phrase.d.ts.map +1 -0
- package/dist/local-first-auth/recovery-phrase.js +59 -0
- package/dist/local-first-auth/recovery-phrase.js.map +1 -0
- package/dist/local-first-auth/secret.d.ts +25 -0
- package/dist/local-first-auth/secret.d.ts.map +1 -0
- package/dist/local-first-auth/secret.js +68 -0
- package/dist/local-first-auth/secret.js.map +1 -0
- package/dist/local-first-auth/server.d.ts +13 -0
- package/dist/local-first-auth/server.d.ts.map +1 -0
- package/dist/local-first-auth/server.js +32 -0
- package/dist/local-first-auth/server.js.map +1 -0
- package/dist/local-first-auth/store.d.ts +51 -0
- package/dist/local-first-auth/store.d.ts.map +1 -0
- package/dist/local-first-auth/store.js +112 -0
- package/dist/local-first-auth/store.js.map +1 -0
- package/dist/magic-columns.d.ts +40 -0
- package/dist/magic-columns.d.ts.map +1 -0
- package/dist/magic-columns.js +110 -0
- package/dist/magic-columns.js.map +1 -0
- package/dist/migration-namespace.d.ts +12 -0
- package/dist/migration-namespace.d.ts.map +1 -0
- package/dist/migration-namespace.js +13 -0
- package/dist/migration-namespace.js.map +1 -0
- package/dist/migrations.d.ts +286 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +188 -0
- package/dist/migrations.js.map +1 -0
- package/dist/module-interop.d.ts +17 -0
- package/dist/module-interop.d.ts.map +1 -0
- package/dist/module-interop.js +32 -0
- package/dist/module-interop.js.map +1 -0
- package/dist/observed-jazz-client.d.ts +15 -0
- package/dist/observed-jazz-client.d.ts.map +1 -0
- package/dist/observed-jazz-client.js +47 -0
- package/dist/observed-jazz-client.js.map +1 -0
- package/dist/passkey-backup.d.ts +3 -0
- package/dist/passkey-backup.d.ts.map +1 -0
- package/dist/passkey-backup.js +2 -0
- package/dist/passkey-backup.js.map +1 -0
- package/dist/passphrase.d.ts +2 -0
- package/dist/passphrase.d.ts.map +1 -0
- package/dist/passphrase.js +2 -0
- package/dist/passphrase.js.map +1 -0
- package/dist/permissions/__fixtures__/big-label-better-auth.d.ts +89 -0
- package/dist/permissions/__fixtures__/big-label-better-auth.d.ts.map +1 -0
- package/dist/permissions/__fixtures__/big-label-better-auth.js +62 -0
- package/dist/permissions/__fixtures__/big-label-better-auth.js.map +1 -0
- package/dist/permissions/__fixtures__/big-label.d.ts +332 -0
- package/dist/permissions/__fixtures__/big-label.d.ts.map +1 -0
- package/dist/permissions/__fixtures__/big-label.js +177 -0
- package/dist/permissions/__fixtures__/big-label.js.map +1 -0
- package/dist/permissions/__fixtures__/chat-react.d.ts +112 -0
- package/dist/permissions/__fixtures__/chat-react.d.ts.map +1 -0
- package/dist/permissions/__fixtures__/chat-react.js +51 -0
- package/dist/permissions/__fixtures__/chat-react.js.map +1 -0
- package/dist/permissions/compile.d.ts +182 -0
- package/dist/permissions/compile.d.ts.map +1 -0
- package/dist/permissions/compile.js +715 -0
- package/dist/permissions/compile.js.map +1 -0
- package/dist/permissions/dsl.d.ts +158 -0
- package/dist/permissions/dsl.d.ts.map +1 -0
- package/dist/permissions/dsl.js +391 -0
- package/dist/permissions/dsl.js.map +1 -0
- package/dist/permissions/relation.d.ts +84 -0
- package/dist/permissions/relation.d.ts.map +1 -0
- package/dist/permissions/relation.js +150 -0
- package/dist/permissions/relation.js.map +1 -0
- package/dist/permissions/types.d.ts +357 -0
- package/dist/permissions/types.d.ts.map +1 -0
- package/dist/permissions/types.js +5 -0
- package/dist/permissions/types.js.map +1 -0
- package/dist/printer/app-json.d.ts +96 -0
- package/dist/printer/app-json.d.ts.map +1 -0
- package/dist/printer/app-json.js +18 -0
- package/dist/printer/app-json.js.map +1 -0
- package/dist/printer/cli.d.ts +15 -0
- package/dist/printer/cli.d.ts.map +1 -0
- package/dist/printer/cli.js +76 -0
- package/dist/printer/cli.js.map +1 -0
- package/dist/printer/defs.d.ts +11 -0
- package/dist/printer/defs.d.ts.map +1 -0
- package/dist/printer/defs.js +123 -0
- package/dist/printer/defs.js.map +1 -0
- package/dist/printer/expr.d.ts +281 -0
- package/dist/printer/expr.d.ts.map +1 -0
- package/dist/printer/expr.js +940 -0
- package/dist/printer/expr.js.map +1 -0
- package/dist/printer/format.d.ts +17 -0
- package/dist/printer/format.d.ts.map +1 -0
- package/dist/printer/format.js +315 -0
- package/dist/printer/format.js.map +1 -0
- package/dist/printer/index.d.ts +31 -0
- package/dist/printer/index.d.ts.map +1 -0
- package/dist/printer/index.js +51 -0
- package/dist/printer/index.js.map +1 -0
- package/dist/printer/migrations.d.ts +28 -0
- package/dist/printer/migrations.d.ts.map +1 -0
- package/dist/printer/migrations.js +179 -0
- package/dist/printer/migrations.js.map +1 -0
- package/dist/printer/names.d.ts +17 -0
- package/dist/printer/names.d.ts.map +1 -0
- package/dist/printer/names.js +124 -0
- package/dist/printer/names.js.map +1 -0
- package/dist/printer/permissions.d.ts +60 -0
- package/dist/printer/permissions.d.ts.map +1 -0
- package/dist/printer/permissions.js +1167 -0
- package/dist/printer/permissions.js.map +1 -0
- package/dist/printer/schema.d.ts +18 -0
- package/dist/printer/schema.d.ts.map +1 -0
- package/dist/printer/schema.js +132 -0
- package/dist/printer/schema.js.map +1 -0
- package/dist/prosemirror/anchors.d.ts +30 -0
- package/dist/prosemirror/anchors.d.ts.map +1 -0
- package/dist/prosemirror/anchors.js +28 -0
- package/dist/prosemirror/anchors.js.map +1 -0
- package/dist/prosemirror/index.d.ts +7 -0
- package/dist/prosemirror/index.d.ts.map +1 -0
- package/dist/prosemirror/index.js +7 -0
- package/dist/prosemirror/index.js.map +1 -0
- package/dist/prosemirror/markdown.d.ts +95 -0
- package/dist/prosemirror/markdown.d.ts.map +1 -0
- package/dist/prosemirror/markdown.js +428 -0
- package/dist/prosemirror/markdown.js.map +1 -0
- package/dist/prosemirror/overlays.d.ts +69 -0
- package/dist/prosemirror/overlays.d.ts.map +1 -0
- package/dist/prosemirror/overlays.js +143 -0
- package/dist/prosemirror/overlays.js.map +1 -0
- package/dist/prosemirror/presence.d.ts +39 -0
- package/dist/prosemirror/presence.d.ts.map +1 -0
- package/dist/prosemirror/presence.js +88 -0
- package/dist/prosemirror/presence.js.map +1 -0
- package/dist/prosemirror/sync.d.ts +60 -0
- package/dist/prosemirror/sync.d.ts.map +1 -0
- package/dist/prosemirror/sync.js +196 -0
- package/dist/prosemirror/sync.js.map +1 -0
- package/dist/prosemirror/text-map.d.ts +21 -0
- package/dist/prosemirror/text-map.d.ts.map +1 -0
- package/dist/prosemirror/text-map.js +85 -0
- package/dist/prosemirror/text-map.js.map +1 -0
- package/dist/react/create-jazz-client.d.ts +2 -11
- package/dist/react/create-jazz-client.d.ts.map +1 -1
- package/dist/react/create-jazz-client.js +1 -47
- package/dist/react/create-jazz-client.js.map +1 -1
- package/dist/react/index.d.ts +14 -7
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +8 -6
- package/dist/react/index.js.map +1 -1
- package/dist/react/provider-props.d.ts +7 -0
- package/dist/react/provider-props.d.ts.map +1 -0
- package/dist/react/provider-props.js +15 -0
- package/dist/react/provider-props.js.map +1 -0
- package/dist/react/provider.d.ts +19 -15
- package/dist/react/provider.d.ts.map +1 -1
- package/dist/react/provider.js +25 -5
- package/dist/react/provider.js.map +1 -1
- package/dist/react/use-all.d.ts +1 -1
- package/dist/react/use-all.d.ts.map +1 -1
- package/dist/react/use-all.js +1 -1
- package/dist/react/use-all.js.map +1 -1
- package/dist/react/use-one.d.ts +2 -0
- package/dist/react/use-one.d.ts.map +1 -0
- package/dist/react/use-one.js +2 -0
- package/dist/react/use-one.js.map +1 -0
- package/dist/react-core/index.d.ts +9 -4
- package/dist/react-core/index.d.ts.map +1 -1
- package/dist/react-core/index.js +10 -2
- package/dist/react-core/index.js.map +1 -1
- package/dist/react-core/provider.d.ts +48 -12
- package/dist/react-core/provider.d.ts.map +1 -1
- package/dist/react-core/provider.js +117 -13
- package/dist/react-core/provider.js.map +1 -1
- package/dist/react-core/session-context.d.ts +7 -0
- package/dist/react-core/session-context.d.ts.map +1 -0
- package/dist/react-core/session-context.js +8 -0
- package/dist/react-core/session-context.js.map +1 -0
- package/dist/react-core/session.d.ts +63 -0
- package/dist/react-core/session.d.ts.map +1 -0
- package/dist/react-core/session.js +97 -0
- package/dist/react-core/session.js.map +1 -0
- package/dist/react-core/use-all.d.ts +95 -3
- package/dist/react-core/use-all.d.ts.map +1 -1
- package/dist/react-core/use-all.js +126 -52
- package/dist/react-core/use-all.js.map +1 -1
- package/dist/react-core/use-auth-state.d.ts +13 -0
- package/dist/react-core/use-auth-state.d.ts.map +1 -0
- package/dist/react-core/use-auth-state.js +15 -0
- package/dist/react-core/use-auth-state.js.map +1 -0
- package/dist/react-core/use-one.d.ts +58 -0
- package/dist/react-core/use-one.d.ts.map +1 -0
- package/dist/react-core/use-one.js +19 -0
- package/dist/react-core/use-one.js.map +1 -0
- package/dist/react-core/use-sync-status.d.ts +8 -0
- package/dist/react-core/use-sync-status.d.ts.map +1 -0
- package/dist/react-core/use-sync-status.js +12 -0
- package/dist/react-core/use-sync-status.js.map +1 -0
- package/dist/react-native/abort-signal.d.ts +9 -0
- package/dist/react-native/abort-signal.d.ts.map +1 -0
- package/dist/react-native/abort-signal.js +51 -0
- package/dist/react-native/abort-signal.js.map +1 -0
- package/dist/react-native/account-session.d.ts +11 -0
- package/dist/react-native/account-session.d.ts.map +1 -0
- package/dist/react-native/account-session.js +59 -0
- package/dist/react-native/account-session.js.map +1 -0
- package/dist/react-native/create-account-manager.d.ts +28 -0
- package/dist/react-native/create-account-manager.d.ts.map +1 -0
- package/dist/react-native/create-account-manager.js +30 -0
- package/dist/react-native/create-account-manager.js.map +1 -0
- package/dist/react-native/create-db.d.ts +8 -0
- package/dist/react-native/create-db.d.ts.map +1 -0
- package/dist/react-native/create-db.js +9 -0
- package/dist/react-native/create-db.js.map +1 -0
- package/dist/react-native/create-jazz-client.d.ts +12 -10
- package/dist/react-native/create-jazz-client.d.ts.map +1 -1
- package/dist/react-native/create-jazz-client.js +6 -21
- package/dist/react-native/create-jazz-client.js.map +1 -1
- package/dist/react-native/create-jazz-session.d.ts +66 -0
- package/dist/react-native/create-jazz-session.d.ts.map +1 -0
- package/dist/react-native/create-jazz-session.js +96 -0
- package/dist/react-native/create-jazz-session.js.map +1 -0
- package/dist/react-native/errors.d.ts +6 -0
- package/dist/react-native/errors.d.ts.map +1 -0
- package/dist/react-native/errors.js +6 -0
- package/dist/react-native/errors.js.map +1 -0
- package/dist/react-native/index.d.ts +19 -9
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +13 -7
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/native-foreground-db.d.ts +227 -0
- package/dist/react-native/native-foreground-db.d.ts.map +1 -0
- package/dist/react-native/native-foreground-db.js +905 -0
- package/dist/react-native/native-foreground-db.js.map +1 -0
- package/dist/react-native/native-relay.d.ts +7 -0
- package/dist/react-native/native-relay.d.ts.map +1 -0
- package/dist/react-native/native-relay.js +14 -0
- package/dist/react-native/native-relay.js.map +1 -0
- package/dist/react-native/provider.d.ts +19 -13
- package/dist/react-native/provider.d.ts.map +1 -1
- package/dist/react-native/provider.js +25 -5
- package/dist/react-native/provider.js.map +1 -1
- package/dist/react-native/runtime-source.d.ts +62 -0
- package/dist/react-native/runtime-source.d.ts.map +1 -0
- package/dist/react-native/runtime-source.js +314 -0
- package/dist/react-native/runtime-source.js.map +1 -0
- package/dist/react-native/use-all.d.ts +1 -1
- package/dist/react-native/use-all.d.ts.map +1 -1
- package/dist/react-native/use-all.js +1 -1
- package/dist/react-native/use-all.js.map +1 -1
- package/dist/react-native/use-one.d.ts +2 -0
- package/dist/react-native/use-one.d.ts.map +1 -0
- package/dist/react-native/use-one.js +2 -0
- package/dist/react-native/use-one.js.map +1 -0
- package/dist/reconcile-array.d.ts +45 -0
- package/dist/reconcile-array.d.ts.map +1 -0
- package/dist/reconcile-array.js +252 -0
- package/dist/reconcile-array.js.map +1 -0
- package/dist/relationships.d.ts +18 -0
- package/dist/relationships.d.ts.map +1 -0
- package/dist/relationships.js +28 -0
- package/dist/relationships.js.map +1 -0
- package/dist/runtime/auth-renewal-backoff.d.ts +14 -0
- package/dist/runtime/auth-renewal-backoff.d.ts.map +1 -0
- package/dist/runtime/auth-renewal-backoff.js +23 -0
- package/dist/runtime/auth-renewal-backoff.js.map +1 -0
- package/dist/runtime/auth-request-deadline.d.ts +3 -0
- package/dist/runtime/auth-request-deadline.d.ts.map +1 -0
- package/dist/runtime/auth-request-deadline.js +24 -0
- package/dist/runtime/auth-request-deadline.js.map +1 -0
- package/dist/runtime/auth-secret-codec.d.ts +21 -0
- package/dist/runtime/auth-secret-codec.d.ts.map +1 -0
- package/dist/runtime/auth-secret-codec.js +32 -0
- package/dist/runtime/auth-secret-codec.js.map +1 -0
- package/dist/runtime/auth-secret-store.d.ts +7 -0
- package/dist/runtime/auth-secret-store.d.ts.map +1 -0
- package/dist/runtime/auth-secret-store.js +12 -0
- package/dist/runtime/auth-secret-store.js.map +1 -0
- package/dist/runtime/auth-state.d.ts +47 -0
- package/dist/runtime/auth-state.d.ts.map +1 -0
- package/dist/runtime/auth-state.js +161 -0
- package/dist/runtime/auth-state.js.map +1 -0
- package/dist/runtime/author-id.d.ts +42 -0
- package/dist/runtime/author-id.d.ts.map +1 -0
- package/dist/runtime/author-id.js +172 -0
- package/dist/runtime/author-id.js.map +1 -0
- package/dist/runtime/authority-changed-error.d.ts +56 -0
- package/dist/runtime/authority-changed-error.d.ts.map +1 -0
- package/dist/runtime/authority-changed-error.js +74 -0
- package/dist/runtime/authority-changed-error.js.map +1 -0
- package/dist/runtime/backlog-rows.d.ts +3 -0
- package/dist/runtime/backlog-rows.d.ts.map +1 -0
- package/dist/runtime/backlog-rows.js +7 -0
- package/dist/runtime/backlog-rows.js.map +1 -0
- package/dist/runtime/browser-physical-database-epoch.d.ts +37 -0
- package/dist/runtime/browser-physical-database-epoch.d.ts.map +1 -0
- package/dist/runtime/browser-physical-database-epoch.js +89 -0
- package/dist/runtime/browser-physical-database-epoch.js.map +1 -0
- package/dist/runtime/browser-storage-invalidation.d.ts +8 -0
- package/dist/runtime/browser-storage-invalidation.d.ts.map +1 -0
- package/dist/runtime/browser-storage-invalidation.js +20 -0
- package/dist/runtime/browser-storage-invalidation.js.map +1 -0
- package/dist/runtime/browser-store-generation.d.ts +15 -0
- package/dist/runtime/browser-store-generation.d.ts.map +1 -0
- package/dist/runtime/browser-store-generation.js +48 -0
- package/dist/runtime/browser-store-generation.js.map +1 -0
- package/dist/runtime/browser-worker-assets.d.ts +31 -0
- package/dist/runtime/browser-worker-assets.d.ts.map +1 -0
- package/dist/runtime/browser-worker-assets.js +40 -0
- package/dist/runtime/browser-worker-assets.js.map +1 -0
- package/dist/runtime/browser-worker-assets.metro.d.ts +28 -0
- package/dist/runtime/browser-worker-assets.metro.d.ts.map +1 -0
- package/dist/runtime/browser-worker-assets.metro.js +52 -0
- package/dist/runtime/browser-worker-assets.metro.js.map +1 -0
- package/dist/runtime/browser-worker-assets.native.d.ts +7 -0
- package/dist/runtime/browser-worker-assets.native.d.ts.map +1 -0
- package/dist/runtime/browser-worker-assets.native.js +8 -0
- package/dist/runtime/browser-worker-assets.native.js.map +1 -0
- package/dist/runtime/browser-worker-config.d.ts +78 -0
- package/dist/runtime/browser-worker-config.d.ts.map +1 -0
- package/dist/runtime/browser-worker-config.js +299 -0
- package/dist/runtime/browser-worker-config.js.map +1 -0
- package/dist/runtime/client-config-key.d.ts +6 -0
- package/dist/runtime/client-config-key.d.ts.map +1 -0
- package/dist/runtime/client-config-key.js +83 -0
- package/dist/runtime/client-config-key.js.map +1 -0
- package/dist/runtime/client-migrations.d.ts +27 -0
- package/dist/runtime/client-migrations.d.ts.map +1 -0
- package/dist/runtime/client-migrations.js +25 -0
- package/dist/runtime/client-migrations.js.map +1 -0
- package/dist/runtime/client-registry.d.ts +21 -0
- package/dist/runtime/client-registry.d.ts.map +1 -0
- package/dist/runtime/client-registry.js +169 -0
- package/dist/runtime/client-registry.js.map +1 -0
- package/dist/runtime/client-scope.d.ts +38 -0
- package/dist/runtime/client-scope.d.ts.map +1 -0
- package/dist/runtime/client-scope.js +64 -0
- package/dist/runtime/client-scope.js.map +1 -0
- package/dist/runtime/client-session.d.ts +56 -14
- package/dist/runtime/client-session.d.ts.map +1 -1
- package/dist/runtime/client-session.js +211 -195
- package/dist/runtime/client-session.js.map +1 -1
- package/dist/runtime/client.d.ts +721 -194
- package/dist/runtime/client.d.ts.map +1 -1
- package/dist/runtime/client.js +1213 -434
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/column-transforms.d.ts +26 -0
- package/dist/runtime/column-transforms.d.ts.map +1 -0
- package/dist/runtime/column-transforms.js +186 -0
- package/dist/runtime/column-transforms.js.map +1 -0
- package/dist/runtime/connection-manager/browser-connection-manager.d.ts +178 -0
- package/dist/runtime/connection-manager/browser-connection-manager.d.ts.map +1 -0
- package/dist/runtime/connection-manager/browser-connection-manager.js +1030 -0
- package/dist/runtime/connection-manager/browser-connection-manager.js.map +1 -0
- package/dist/runtime/connection-manager/direct-connection-manager.d.ts +28 -0
- package/dist/runtime/connection-manager/direct-connection-manager.d.ts.map +1 -0
- package/dist/runtime/connection-manager/direct-connection-manager.js +202 -0
- package/dist/runtime/connection-manager/direct-connection-manager.js.map +1 -0
- package/dist/runtime/connection-manager/index.d.ts +5 -0
- package/dist/runtime/connection-manager/index.d.ts.map +1 -0
- package/dist/runtime/connection-manager/index.js +4 -0
- package/dist/runtime/connection-manager/index.js.map +1 -0
- package/dist/runtime/connection-manager/types.d.ts +174 -0
- package/dist/runtime/connection-manager/types.d.ts.map +1 -0
- package/dist/runtime/connection-manager/types.js +396 -0
- package/dist/runtime/connection-manager/types.js.map +1 -0
- package/dist/runtime/context.d.ts +100 -30
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/context.js.map +1 -1
- package/dist/runtime/core-tick-failed-error.d.ts +31 -0
- package/dist/runtime/core-tick-failed-error.d.ts.map +1 -0
- package/dist/runtime/core-tick-failed-error.js +45 -0
- package/dist/runtime/core-tick-failed-error.js.map +1 -0
- package/dist/runtime/credentialed-transport.d.ts +42 -0
- package/dist/runtime/credentialed-transport.d.ts.map +1 -0
- package/dist/runtime/credentialed-transport.js +178 -0
- package/dist/runtime/credentialed-transport.js.map +1 -0
- package/dist/runtime/db-access-context.d.ts +14 -0
- package/dist/runtime/db-access-context.d.ts.map +1 -0
- package/dist/runtime/db-access-context.js +26 -0
- package/dist/runtime/db-access-context.js.map +1 -0
- package/dist/runtime/db-internal-session.d.ts +7 -0
- package/dist/runtime/db-internal-session.d.ts.map +1 -0
- package/dist/runtime/db-internal-session.js +21 -0
- package/dist/runtime/db-internal-session.js.map +1 -0
- package/dist/runtime/db-replaced-error.d.ts +21 -0
- package/dist/runtime/db-replaced-error.d.ts.map +1 -0
- package/dist/runtime/db-replaced-error.js +22 -0
- package/dist/runtime/db-replaced-error.js.map +1 -0
- package/dist/runtime/db.d.ts +857 -215
- package/dist/runtime/db.d.ts.map +1 -1
- package/dist/runtime/db.js +3474 -834
- package/dist/runtime/db.js.map +1 -1
- package/dist/runtime/default-create-db.d.ts +5 -0
- package/dist/runtime/default-create-db.d.ts.map +1 -0
- package/dist/runtime/default-create-db.js +7 -0
- package/dist/runtime/default-create-db.js.map +1 -0
- package/dist/runtime/default-runtime-source.d.ts +41 -0
- package/dist/runtime/default-runtime-source.d.ts.map +1 -0
- package/dist/runtime/default-runtime-source.js +326 -0
- package/dist/runtime/default-runtime-source.js.map +1 -0
- package/dist/runtime/delete-local-first-store.d.ts +12 -0
- package/dist/runtime/delete-local-first-store.d.ts.map +1 -0
- package/dist/runtime/delete-local-first-store.js +12 -0
- package/dist/runtime/delete-local-first-store.js.map +1 -0
- package/dist/runtime/deterministic-bytes.d.ts +6 -0
- package/dist/runtime/deterministic-bytes.d.ts.map +1 -0
- package/dist/runtime/deterministic-bytes.js +18 -0
- package/dist/runtime/deterministic-bytes.js.map +1 -0
- package/dist/runtime/graceful-shutdown-error.d.ts +17 -0
- package/dist/runtime/graceful-shutdown-error.d.ts.map +1 -0
- package/dist/runtime/graceful-shutdown-error.js +31 -0
- package/dist/runtime/graceful-shutdown-error.js.map +1 -0
- package/dist/runtime/hex.d.ts +21 -0
- package/dist/runtime/hex.d.ts.map +1 -0
- package/dist/runtime/hex.js +62 -0
- package/dist/runtime/hex.js.map +1 -0
- package/dist/runtime/history-relation.d.ts +8 -0
- package/dist/runtime/history-relation.d.ts.map +1 -0
- package/dist/runtime/history-relation.js +44 -0
- package/dist/runtime/history-relation.js.map +1 -0
- package/dist/runtime/in-process-transport.d.ts +18 -0
- package/dist/runtime/in-process-transport.d.ts.map +1 -0
- package/dist/runtime/in-process-transport.js +32 -0
- package/dist/runtime/in-process-transport.js.map +1 -0
- package/dist/runtime/index.d.ts +22 -13
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +14 -12
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/indexeddb-page-store.d.ts +214 -0
- package/dist/runtime/indexeddb-page-store.d.ts.map +1 -0
- package/dist/runtime/indexeddb-page-store.js +848 -0
- package/dist/runtime/indexeddb-page-store.js.map +1 -0
- package/dist/runtime/introspection-fetch.d.ts +18 -0
- package/dist/runtime/introspection-fetch.d.ts.map +1 -0
- package/dist/runtime/introspection-fetch.js +12 -0
- package/dist/runtime/introspection-fetch.js.map +1 -0
- package/dist/runtime/json-schema-evaluate.d.ts +55 -0
- package/dist/runtime/json-schema-evaluate.d.ts.map +1 -0
- package/dist/runtime/json-schema-evaluate.js +946 -0
- package/dist/runtime/json-schema-evaluate.js.map +1 -0
- package/dist/runtime/json-schema-formats.d.ts +14 -0
- package/dist/runtime/json-schema-formats.d.ts.map +1 -0
- package/dist/runtime/json-schema-formats.js +555 -0
- package/dist/runtime/json-schema-formats.js.map +1 -0
- package/dist/runtime/json-schema-json.d.ts +41 -0
- package/dist/runtime/json-schema-json.d.ts.map +1 -0
- package/dist/runtime/json-schema-json.js +309 -0
- package/dist/runtime/json-schema-json.js.map +1 -0
- package/dist/runtime/json-schema-metaschemas.d.ts +1403 -0
- package/dist/runtime/json-schema-metaschemas.d.ts.map +1 -0
- package/dist/runtime/json-schema-metaschemas.js +64 -0
- package/dist/runtime/json-schema-metaschemas.js.map +1 -0
- package/dist/runtime/json-schema-regex.d.ts +32 -0
- package/dist/runtime/json-schema-regex.d.ts.map +1 -0
- package/dist/runtime/json-schema-regex.js +895 -0
- package/dist/runtime/json-schema-regex.js.map +1 -0
- package/dist/runtime/json-schema-validator.d.ts +50 -0
- package/dist/runtime/json-schema-validator.d.ts.map +1 -0
- package/dist/runtime/json-schema-validator.js +404 -0
- package/dist/runtime/json-schema-validator.js.map +1 -0
- package/dist/runtime/json-text.js.map +1 -1
- package/dist/runtime/local-first-token.d.ts +11 -0
- package/dist/runtime/local-first-token.d.ts.map +1 -0
- package/dist/runtime/local-first-token.js +20 -0
- package/dist/runtime/local-first-token.js.map +1 -0
- package/dist/runtime/local-first-unavailable.d.ts +40 -0
- package/dist/runtime/local-first-unavailable.d.ts.map +1 -0
- package/dist/runtime/local-first-unavailable.js +81 -0
- package/dist/runtime/local-first-unavailable.js.map +1 -0
- package/dist/runtime/local-first-upgrade.d.ts +36 -0
- package/dist/runtime/local-first-upgrade.d.ts.map +1 -0
- package/dist/runtime/local-first-upgrade.js +31 -0
- package/dist/runtime/local-first-upgrade.js.map +1 -0
- package/dist/runtime/local-write-observer.d.ts +5 -0
- package/dist/runtime/local-write-observer.d.ts.map +1 -0
- package/dist/runtime/local-write-observer.js +31 -0
- package/dist/runtime/local-write-observer.js.map +1 -0
- package/dist/runtime/metro-setup-error.d.ts +20 -0
- package/dist/runtime/metro-setup-error.d.ts.map +1 -0
- package/dist/runtime/metro-setup-error.js +22 -0
- package/dist/runtime/metro-setup-error.js.map +1 -0
- package/dist/runtime/native-artifact-compatibility.d.ts +12 -0
- package/dist/runtime/native-artifact-compatibility.d.ts.map +1 -0
- package/dist/runtime/native-artifact-compatibility.js +26 -0
- package/dist/runtime/native-artifact-compatibility.js.map +1 -0
- package/dist/runtime/native-artifact-fingerprint-napi.d.ts +2 -0
- package/dist/runtime/native-artifact-fingerprint-napi.d.ts.map +1 -0
- package/dist/runtime/native-artifact-fingerprint-napi.js +3 -0
- package/dist/runtime/native-artifact-fingerprint-napi.js.map +1 -0
- package/dist/runtime/native-artifact-fingerprint-wasm.d.ts +2 -0
- package/dist/runtime/native-artifact-fingerprint-wasm.d.ts.map +1 -0
- package/dist/runtime/native-artifact-fingerprint-wasm.js +3 -0
- package/dist/runtime/native-artifact-fingerprint-wasm.js.map +1 -0
- package/dist/runtime/native-artifact-fingerprints.d.ts +5 -0
- package/dist/runtime/native-artifact-fingerprints.d.ts.map +1 -0
- package/dist/runtime/native-artifact-fingerprints.js +7 -0
- package/dist/runtime/native-artifact-fingerprints.js.map +1 -0
- package/dist/runtime/native-artifact-mismatch-error.d.ts +25 -0
- package/dist/runtime/native-artifact-mismatch-error.d.ts.map +1 -0
- package/dist/runtime/native-artifact-mismatch-error.js +34 -0
- package/dist/runtime/native-artifact-mismatch-error.js.map +1 -0
- package/dist/runtime/native-runtime/attached-browser-worker-connection.d.ts +23 -0
- package/dist/runtime/native-runtime/attached-browser-worker-connection.d.ts.map +1 -0
- package/dist/runtime/native-runtime/attached-browser-worker-connection.js +45 -0
- package/dist/runtime/native-runtime/attached-browser-worker-connection.js.map +1 -0
- package/dist/runtime/native-runtime/auxiliary-receive-deadline.d.ts +15 -0
- package/dist/runtime/native-runtime/auxiliary-receive-deadline.d.ts.map +1 -0
- package/dist/runtime/native-runtime/auxiliary-receive-deadline.js +64 -0
- package/dist/runtime/native-runtime/auxiliary-receive-deadline.js.map +1 -0
- package/dist/runtime/native-runtime/broker-worker-load-failure.d.ts +34 -0
- package/dist/runtime/native-runtime/broker-worker-load-failure.d.ts.map +1 -0
- package/dist/runtime/native-runtime/broker-worker-load-failure.js +61 -0
- package/dist/runtime/native-runtime/broker-worker-load-failure.js.map +1 -0
- package/dist/runtime/native-runtime/browser-follower-connection.d.ts +109 -0
- package/dist/runtime/native-runtime/browser-follower-connection.d.ts.map +1 -0
- package/dist/runtime/native-runtime/browser-follower-connection.js +558 -0
- package/dist/runtime/native-runtime/browser-follower-connection.js.map +1 -0
- package/dist/runtime/native-runtime/browser-shared-worker-connection.d.ts +130 -0
- package/dist/runtime/native-runtime/browser-shared-worker-connection.d.ts.map +1 -0
- package/dist/runtime/native-runtime/browser-shared-worker-connection.js +988 -0
- package/dist/runtime/native-runtime/browser-shared-worker-connection.js.map +1 -0
- package/dist/runtime/native-runtime/browser-worker-protocol.d.ts +527 -0
- package/dist/runtime/native-runtime/browser-worker-protocol.d.ts.map +1 -0
- package/dist/runtime/native-runtime/browser-worker-protocol.js +296 -0
- package/dist/runtime/native-runtime/browser-worker-protocol.js.map +1 -0
- package/dist/runtime/native-runtime/browser-worker-transport.d.ts +56 -0
- package/dist/runtime/native-runtime/browser-worker-transport.d.ts.map +1 -0
- package/dist/runtime/native-runtime/browser-worker-transport.js +305 -0
- package/dist/runtime/native-runtime/browser-worker-transport.js.map +1 -0
- package/dist/runtime/native-runtime/exact-integer.d.ts +7 -0
- package/dist/runtime/native-runtime/exact-integer.d.ts.map +1 -0
- package/dist/runtime/native-runtime/exact-integer.js +18 -0
- package/dist/runtime/native-runtime/exact-integer.js.map +1 -0
- package/dist/runtime/native-runtime/http-stream-socket.d.ts +103 -0
- package/dist/runtime/native-runtime/http-stream-socket.d.ts.map +1 -0
- package/dist/runtime/native-runtime/http-stream-socket.js +554 -0
- package/dist/runtime/native-runtime/http-stream-socket.js.map +1 -0
- package/dist/runtime/native-runtime/inspector-control-lifecycle.d.ts +4 -0
- package/dist/runtime/native-runtime/inspector-control-lifecycle.d.ts.map +1 -0
- package/dist/runtime/native-runtime/inspector-control-lifecycle.js +33 -0
- package/dist/runtime/native-runtime/inspector-control-lifecycle.js.map +1 -0
- package/dist/runtime/native-runtime/native-codec.d.ts +172 -0
- package/dist/runtime/native-runtime/native-codec.d.ts.map +1 -0
- package/dist/runtime/native-runtime/native-codec.js +629 -0
- package/dist/runtime/native-runtime/native-codec.js.map +1 -0
- package/dist/runtime/native-runtime/native-error-code.d.ts +39 -0
- package/dist/runtime/native-runtime/native-error-code.d.ts.map +1 -0
- package/dist/runtime/native-runtime/native-error-code.js +64 -0
- package/dist/runtime/native-runtime/native-error-code.js.map +1 -0
- package/dist/runtime/native-runtime/native-row-codec.d.ts +161 -0
- package/dist/runtime/native-runtime/native-row-codec.d.ts.map +1 -0
- package/dist/runtime/native-runtime/native-row-codec.js +903 -0
- package/dist/runtime/native-runtime/native-row-codec.js.map +1 -0
- package/dist/runtime/native-runtime/native-row-descriptor-key.d.ts +15 -0
- package/dist/runtime/native-runtime/native-row-descriptor-key.d.ts.map +1 -0
- package/dist/runtime/native-runtime/native-row-descriptor-key.js +25 -0
- package/dist/runtime/native-runtime/native-row-descriptor-key.js.map +1 -0
- package/dist/runtime/native-runtime/native-runtime-adapter.d.ts +913 -0
- package/dist/runtime/native-runtime/native-runtime-adapter.d.ts.map +1 -0
- package/dist/runtime/native-runtime/native-runtime-adapter.js +5999 -0
- package/dist/runtime/native-runtime/native-runtime-adapter.js.map +1 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.browser.d.ts +17 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.browser.d.ts.map +1 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.browser.js +4 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.browser.js.map +1 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.d.ts +19 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.d.ts.map +1 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.js +297 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.js.map +1 -0
- package/dist/runtime/native-runtime/row-values-transport.d.ts +2 -0
- package/dist/runtime/native-runtime/row-values-transport.d.ts.map +1 -0
- package/dist/runtime/native-runtime/row-values-transport.js +21 -0
- package/dist/runtime/native-runtime/row-values-transport.js.map +1 -0
- package/dist/runtime/native-runtime/schema-codec.d.ts +10 -0
- package/dist/runtime/native-runtime/schema-codec.d.ts.map +1 -0
- package/dist/runtime/native-runtime/schema-codec.js +13 -0
- package/dist/runtime/native-runtime/schema-codec.js.map +1 -0
- package/dist/runtime/native-runtime/session-renewal-wire.d.ts +48 -0
- package/dist/runtime/native-runtime/session-renewal-wire.d.ts.map +1 -0
- package/dist/runtime/native-runtime/session-renewal-wire.js +107 -0
- package/dist/runtime/native-runtime/session-renewal-wire.js.map +1 -0
- package/dist/runtime/native-runtime/stream-endpoint-memory.d.ts +34 -0
- package/dist/runtime/native-runtime/stream-endpoint-memory.d.ts.map +1 -0
- package/dist/runtime/native-runtime/stream-endpoint-memory.js +146 -0
- package/dist/runtime/native-runtime/stream-endpoint-memory.js.map +1 -0
- package/dist/runtime/native-runtime/websocket.d.ts +327 -0
- package/dist/runtime/native-runtime/websocket.d.ts.map +1 -0
- package/dist/runtime/native-runtime/websocket.js +1112 -0
- package/dist/runtime/native-runtime/websocket.js.map +1 -0
- package/dist/runtime/newer-build-reload.d.ts +30 -0
- package/dist/runtime/newer-build-reload.d.ts.map +1 -0
- package/dist/runtime/newer-build-reload.js +59 -0
- package/dist/runtime/newer-build-reload.js.map +1 -0
- package/dist/runtime/page-cache.d.ts +44 -0
- package/dist/runtime/page-cache.d.ts.map +1 -0
- package/dist/runtime/page-cache.js +104 -0
- package/dist/runtime/page-cache.js.map +1 -0
- package/dist/runtime/page-handle.d.ts +83 -0
- package/dist/runtime/page-handle.d.ts.map +1 -0
- package/dist/runtime/page-handle.js +151 -0
- package/dist/runtime/page-handle.js.map +1 -0
- package/dist/runtime/passkey-backup.d.ts +3 -0
- package/dist/runtime/passkey-backup.d.ts.map +1 -0
- package/dist/runtime/passkey-backup.js +2 -0
- package/dist/runtime/passkey-backup.js.map +1 -0
- package/dist/runtime/platform-url.d.ts +10 -0
- package/dist/runtime/platform-url.d.ts.map +1 -0
- package/dist/runtime/platform-url.js +3 -0
- package/dist/runtime/platform-url.js.map +1 -0
- package/dist/runtime/platform-url.native.d.ts +6 -0
- package/dist/runtime/platform-url.native.d.ts.map +1 -0
- package/dist/runtime/platform-url.native.js +38 -0
- package/dist/runtime/platform-url.native.js.map +1 -0
- package/dist/runtime/query-adapter.d.ts +7 -15
- package/dist/runtime/query-adapter.d.ts.map +1 -1
- package/dist/runtime/query-adapter.js +390 -110
- package/dist/runtime/query-adapter.js.map +1 -1
- package/dist/runtime/query-builder-shape.d.ts +75 -0
- package/dist/runtime/query-builder-shape.d.ts.map +1 -0
- package/dist/runtime/query-builder-shape.js +225 -0
- package/dist/runtime/query-builder-shape.js.map +1 -0
- package/dist/runtime/query-column-name.d.ts +3 -0
- package/dist/runtime/query-column-name.d.ts.map +1 -0
- package/dist/runtime/query-column-name.js +10 -0
- package/dist/runtime/query-column-name.js.map +1 -0
- package/dist/runtime/query-output-table.d.ts +5 -0
- package/dist/runtime/query-output-table.d.ts.map +1 -0
- package/dist/runtime/query-output-table.js +30 -0
- package/dist/runtime/query-output-table.js.map +1 -0
- package/dist/runtime/recovery-phrase.d.ts +3 -0
- package/dist/runtime/recovery-phrase.d.ts.map +1 -0
- package/dist/runtime/recovery-phrase.js +2 -0
- package/dist/runtime/recovery-phrase.js.map +1 -0
- package/dist/runtime/remote-link-state.d.ts +20 -0
- package/dist/runtime/remote-link-state.d.ts.map +1 -0
- package/dist/runtime/remote-link-state.js +5 -0
- package/dist/runtime/remote-link-state.js.map +1 -0
- package/dist/runtime/removed-provider-props.d.ts +17 -0
- package/dist/runtime/removed-provider-props.d.ts.map +1 -0
- package/dist/runtime/removed-provider-props.js +16 -0
- package/dist/runtime/removed-provider-props.js.map +1 -0
- package/dist/runtime/row-transformer.d.ts +17 -3
- package/dist/runtime/row-transformer.d.ts.map +1 -1
- package/dist/runtime/row-transformer.js +163 -38
- package/dist/runtime/row-transformer.js.map +1 -1
- package/dist/runtime/run-cleanup-steps.d.ts +5 -0
- package/dist/runtime/run-cleanup-steps.d.ts.map +1 -0
- package/dist/runtime/run-cleanup-steps.js +19 -0
- package/dist/runtime/run-cleanup-steps.js.map +1 -0
- package/dist/runtime/runtime-closed-error.d.ts +9 -0
- package/dist/runtime/runtime-closed-error.d.ts.map +1 -0
- package/dist/runtime/runtime-closed-error.js +12 -0
- package/dist/runtime/runtime-closed-error.js.map +1 -0
- package/dist/runtime/runtime-config.d.ts +13 -0
- package/dist/runtime/runtime-config.d.ts.map +1 -0
- package/dist/runtime/runtime-config.js +115 -0
- package/dist/runtime/runtime-config.js.map +1 -0
- package/dist/runtime/runtime-entropy.d.ts +14 -0
- package/dist/runtime/runtime-entropy.d.ts.map +1 -0
- package/dist/runtime/runtime-entropy.js +43 -0
- package/dist/runtime/runtime-entropy.js.map +1 -0
- package/dist/runtime/runtime-source.d.ts +206 -0
- package/dist/runtime/runtime-source.d.ts.map +1 -0
- package/dist/runtime/runtime-source.js +64 -0
- package/dist/runtime/runtime-source.js.map +1 -0
- package/dist/runtime/schema-metadata.d.ts +22 -0
- package/dist/runtime/schema-metadata.d.ts.map +1 -0
- package/dist/runtime/schema-metadata.js +70 -0
- package/dist/runtime/schema-metadata.js.map +1 -0
- package/dist/runtime/select-projection.d.ts +5 -0
- package/dist/runtime/select-projection.d.ts.map +1 -0
- package/dist/runtime/select-projection.js +47 -0
- package/dist/runtime/select-projection.js.map +1 -0
- package/dist/runtime/snapshot-ref.d.ts +24 -0
- package/dist/runtime/snapshot-ref.d.ts.map +1 -0
- package/dist/runtime/snapshot-ref.js +43 -0
- package/dist/runtime/snapshot-ref.js.map +1 -0
- package/dist/runtime/store-held-by-another-tab-error.d.ts +53 -0
- package/dist/runtime/store-held-by-another-tab-error.d.ts.map +1 -0
- package/dist/runtime/store-held-by-another-tab-error.js +55 -0
- package/dist/runtime/store-held-by-another-tab-error.js.map +1 -0
- package/dist/runtime/streaming-source.d.ts +4 -0
- package/dist/runtime/streaming-source.d.ts.map +1 -0
- package/dist/runtime/streaming-source.js +53 -0
- package/dist/runtime/streaming-source.js.map +1 -0
- package/dist/runtime/structural-values.d.ts +6 -0
- package/dist/runtime/structural-values.d.ts.map +1 -0
- package/dist/runtime/structural-values.js +51 -0
- package/dist/runtime/structural-values.js.map +1 -0
- package/dist/runtime/subscription-manager.d.ts +103 -14
- package/dist/runtime/subscription-manager.d.ts.map +1 -1
- package/dist/runtime/subscription-manager.js +1051 -25
- package/dist/runtime/subscription-manager.js.map +1 -1
- package/dist/runtime/sync-status.d.ts +178 -0
- package/dist/runtime/sync-status.d.ts.map +1 -0
- package/dist/runtime/sync-status.js +163 -0
- package/dist/runtime/sync-status.js.map +1 -0
- package/dist/runtime/sync-telemetry.d.ts +35 -0
- package/dist/runtime/sync-telemetry.d.ts.map +1 -0
- package/dist/runtime/sync-telemetry.js +354 -0
- package/dist/runtime/sync-telemetry.js.map +1 -0
- package/dist/runtime/system-identity.d.ts +5 -0
- package/dist/runtime/system-identity.d.ts.map +1 -0
- package/dist/runtime/system-identity.js +10 -0
- package/dist/runtime/system-identity.js.map +1 -0
- package/dist/runtime/telemetry-env.d.ts +2 -0
- package/dist/runtime/telemetry-env.d.ts.map +1 -0
- package/dist/runtime/telemetry-env.js +16 -0
- package/dist/runtime/telemetry-env.js.map +1 -0
- package/dist/runtime/telemetry-env.native.d.ts +3 -0
- package/dist/runtime/telemetry-env.native.d.ts.map +1 -0
- package/dist/runtime/telemetry-env.native.js +7 -0
- package/dist/runtime/telemetry-env.native.js.map +1 -0
- package/dist/runtime/text-anchors.d.ts +58 -0
- package/dist/runtime/text-anchors.d.ts.map +1 -0
- package/dist/runtime/text-anchors.js +9 -0
- package/dist/runtime/text-anchors.js.map +1 -0
- package/dist/runtime/unsupported-storage-codecs-error.d.ts +53 -0
- package/dist/runtime/unsupported-storage-codecs-error.d.ts.map +1 -0
- package/dist/runtime/unsupported-storage-codecs-error.js +74 -0
- package/dist/runtime/unsupported-storage-codecs-error.js.map +1 -0
- package/dist/runtime/url.d.ts +32 -0
- package/dist/runtime/url.d.ts.map +1 -0
- package/dist/runtime/url.js +96 -0
- package/dist/runtime/url.js.map +1 -0
- package/dist/runtime/utf8.d.ts +10 -0
- package/dist/runtime/utf8.d.ts.map +1 -0
- package/dist/runtime/utf8.js +93 -0
- package/dist/runtime/utf8.js.map +1 -0
- package/dist/runtime/util.d.ts +18 -0
- package/dist/runtime/util.d.ts.map +1 -0
- package/dist/runtime/util.js +59 -0
- package/dist/runtime/util.js.map +1 -0
- package/dist/runtime/value-converter.d.ts +9 -17
- package/dist/runtime/value-converter.d.ts.map +1 -1
- package/dist/runtime/value-converter.js +156 -42
- package/dist/runtime/value-converter.js.map +1 -1
- package/dist/runtime/wasm-loader.d.ts +6 -0
- package/dist/runtime/wasm-loader.d.ts.map +1 -0
- package/dist/runtime/wasm-loader.js +127 -0
- package/dist/runtime/wasm-loader.js.map +1 -0
- package/dist/runtime/write-preparation.d.ts +24 -0
- package/dist/runtime/write-preparation.d.ts.map +1 -0
- package/dist/runtime/write-preparation.js +63 -0
- package/dist/runtime/write-preparation.js.map +1 -0
- package/dist/runtime/write-row.d.ts +8 -0
- package/dist/runtime/write-row.d.ts.map +1 -0
- package/dist/runtime/write-row.js +17 -0
- package/dist/runtime/write-row.js.map +1 -0
- package/dist/schema-builders.d.ts +48 -0
- package/dist/schema-builders.d.ts.map +1 -0
- package/dist/schema-builders.js +26 -0
- package/dist/schema-builders.js.map +1 -0
- package/dist/schema-dsl/define-schema.d.ts +32 -0
- package/dist/schema-dsl/define-schema.d.ts.map +1 -0
- package/dist/schema-dsl/define-schema.js +80 -0
- package/dist/schema-dsl/define-schema.js.map +1 -0
- package/dist/schema-dsl/readable-app.d.ts +30 -0
- package/dist/schema-dsl/readable-app.d.ts.map +1 -0
- package/dist/schema-dsl/readable-app.js +139 -0
- package/dist/schema-dsl/readable-app.js.map +1 -0
- package/dist/schema-dsl/table.d.ts +101 -0
- package/dist/schema-dsl/table.d.ts.map +1 -0
- package/dist/schema-dsl/table.js +153 -0
- package/dist/schema-dsl/table.js.map +1 -0
- package/dist/schema-errors.d.ts +6 -0
- package/dist/schema-errors.d.ts.map +1 -0
- package/dist/schema-errors.js +6 -0
- package/dist/schema-errors.js.map +1 -0
- package/dist/schema-loader.d.ts +16 -0
- package/dist/schema-loader.d.ts.map +1 -0
- package/dist/schema-loader.js +108 -0
- package/dist/schema-loader.js.map +1 -0
- package/dist/schema-name.d.ts +2 -0
- package/dist/schema-name.d.ts.map +1 -0
- package/dist/schema-name.js +19 -0
- package/dist/schema-name.js.map +1 -0
- package/dist/schema-namespace.d.ts +7 -0
- package/dist/schema-namespace.d.ts.map +1 -0
- package/dist/schema-namespace.js +7 -0
- package/dist/schema-namespace.js.map +1 -0
- package/dist/schema-permissions.d.ts +12 -0
- package/dist/schema-permissions.d.ts.map +1 -0
- package/dist/schema-permissions.js +17 -0
- package/dist/schema-permissions.js.map +1 -0
- package/dist/schema-source.d.ts +11 -0
- package/dist/schema-source.d.ts.map +1 -0
- package/dist/schema-source.js +53 -0
- package/dist/schema-source.js.map +1 -0
- package/dist/schema.d.ts +95 -38
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +1 -16
- package/dist/schema.js.map +1 -1
- package/dist/session/backend-watch.d.ts +186 -0
- package/dist/session/backend-watch.d.ts.map +1 -0
- package/dist/session/backend-watch.js +698 -0
- package/dist/session/backend-watch.js.map +1 -0
- package/dist/session/config-options.d.ts +15 -0
- package/dist/session/config-options.d.ts.map +1 -0
- package/dist/session/config-options.js +55 -0
- package/dist/session/config-options.js.map +1 -0
- package/dist/session/consumer.d.ts +3 -0
- package/dist/session/consumer.d.ts.map +1 -0
- package/dist/session/consumer.js +3 -0
- package/dist/session/consumer.js.map +1 -0
- package/dist/session/create-jazz-session.d.ts +123 -0
- package/dist/session/create-jazz-session.d.ts.map +1 -0
- package/dist/session/create-jazz-session.js +542 -0
- package/dist/session/create-jazz-session.js.map +1 -0
- package/dist/session/follow-user.d.ts +72 -0
- package/dist/session/follow-user.d.ts.map +1 -0
- package/dist/session/follow-user.js +147 -0
- package/dist/session/follow-user.js.map +1 -0
- package/dist/session/jazz-session.d.ts +234 -0
- package/dist/session/jazz-session.d.ts.map +1 -0
- package/dist/session/jazz-session.js +528 -0
- package/dist/session/jazz-session.js.map +1 -0
- package/dist/session/native-backend-watch.d.ts +4 -0
- package/dist/session/native-backend-watch.d.ts.map +1 -0
- package/dist/session/native-backend-watch.js +14 -0
- package/dist/session/native-backend-watch.js.map +1 -0
- package/dist/session/no-kept-device-account-error.d.ts +6 -0
- package/dist/session/no-kept-device-account-error.d.ts.map +1 -0
- package/dist/session/no-kept-device-account-error.js +8 -0
- package/dist/session/no-kept-device-account-error.js.map +1 -0
- package/dist/session/replica-ledger.d.ts +164 -0
- package/dist/session/replica-ledger.d.ts.map +1 -0
- package/dist/session/replica-ledger.js +496 -0
- package/dist/session/replica-ledger.js.map +1 -0
- package/dist/session/state.d.ts +135 -0
- package/dist/session/state.d.ts.map +1 -0
- package/dist/session/state.js +535 -0
- package/dist/session/state.js.map +1 -0
- package/dist/shared/index.d.ts +20 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +17 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/solid/create-solid-jazz-client-internal.d.ts +13 -0
- package/dist/solid/create-solid-jazz-client-internal.d.ts.map +1 -0
- package/dist/solid/create-solid-jazz-client-internal.js +82 -0
- package/dist/solid/create-solid-jazz-client-internal.js.map +1 -0
- package/dist/solid/create-solid-jazz-client-internal.ssr.js +101 -0
- package/dist/solid/create-solid-jazz-client-internal.ssr.js.map +1 -0
- package/dist/solid/create-solid-jazz-client.d.ts +24 -0
- package/dist/solid/create-solid-jazz-client.d.ts.map +1 -0
- package/dist/solid/create-solid-jazz-client.js +42 -0
- package/dist/solid/create-solid-jazz-client.js.map +1 -0
- package/dist/solid/create-solid-jazz-client.ssr.js +45 -0
- package/dist/solid/create-solid-jazz-client.ssr.js.map +1 -0
- package/dist/solid/index.d.ts +13 -0
- package/dist/solid/index.d.ts.map +1 -0
- package/dist/solid/index.js +9 -0
- package/dist/solid/index.ssr.js +9 -0
- package/dist/solid/provider.d.ts +25 -0
- package/dist/solid/provider.d.ts.map +1 -0
- package/dist/solid/provider.js +48 -0
- package/dist/solid/provider.js.map +1 -0
- package/dist/solid/provider.ssr.js +48 -0
- package/dist/solid/provider.ssr.js.map +1 -0
- package/dist/solid/session-context.d.ts +14 -0
- package/dist/solid/session-context.d.ts.map +1 -0
- package/dist/solid/session-context.js +6 -0
- package/dist/solid/session-context.js.map +1 -0
- package/dist/solid/session-context.ssr.js +10 -0
- package/dist/solid/session-context.ssr.js.map +1 -0
- package/dist/solid/session.d.ts +55 -0
- package/dist/solid/session.d.ts.map +1 -0
- package/dist/solid/session.js +130 -0
- package/dist/solid/session.js.map +1 -0
- package/dist/solid/session.ssr.js +156 -0
- package/dist/solid/session.ssr.js.map +1 -0
- package/dist/solid/solid-jazz-client-store.d.ts +11 -0
- package/dist/solid/solid-jazz-client-store.d.ts.map +1 -0
- package/dist/solid/solid-jazz-client-store.js +38 -0
- package/dist/solid/solid-jazz-client-store.js.map +1 -0
- package/dist/solid/solid-jazz-client-store.ssr.js +39 -0
- package/dist/solid/solid-jazz-client-store.ssr.js.map +1 -0
- package/dist/solid/use-all.d.ts +18 -0
- package/dist/solid/use-all.d.ts.map +1 -0
- package/dist/solid/use-all.js +71 -0
- package/dist/solid/use-all.js.map +1 -0
- package/dist/solid/use-all.ssr.js +84 -0
- package/dist/solid/use-all.ssr.js.map +1 -0
- package/dist/solid/use-one.d.ts +18 -0
- package/dist/solid/use-one.d.ts.map +1 -0
- package/dist/solid/use-one.js +27 -0
- package/dist/solid/use-one.js.map +1 -0
- package/dist/solid/use-one.ssr.js +27 -0
- package/dist/solid/use-one.ssr.js.map +1 -0
- package/dist/solid/use-sync-status.d.ts +8 -0
- package/dist/solid/use-sync-status.d.ts.map +1 -0
- package/dist/solid/use-sync-status.js +13 -0
- package/dist/solid/use-sync-status.js.map +1 -0
- package/dist/solid/use-sync-status.ssr.js +20 -0
- package/dist/solid/use-sync-status.ssr.js.map +1 -0
- package/dist/subscription-store-internal.d.ts +11 -0
- package/dist/subscription-store-internal.d.ts.map +1 -0
- package/dist/subscription-store-internal.js +18 -0
- package/dist/subscription-store-internal.js.map +1 -0
- package/dist/subscriptions-orchestrator.d.ts +92 -14
- package/dist/subscriptions-orchestrator.d.ts.map +1 -1
- package/dist/subscriptions-orchestrator.js +390 -75
- package/dist/subscriptions-orchestrator.js.map +1 -1
- package/dist/svelte/JazzProvider.svelte +110 -0
- package/dist/svelte/JazzProvider.svelte.d.ts +24 -0
- package/dist/svelte/JazzProvider.svelte.d.ts.map +1 -0
- package/dist/svelte/JazzSvelteClientProvider.svelte +83 -0
- package/dist/svelte/JazzSvelteClientProvider.svelte.d.ts +15 -0
- package/dist/svelte/JazzSvelteClientProvider.svelte.d.ts.map +1 -0
- package/dist/svelte/context.svelte.d.ts +19 -3
- package/dist/svelte/context.svelte.d.ts.map +1 -1
- package/dist/svelte/context.svelte.js +21 -5
- package/dist/svelte/create-jazz-client.d.ts +2 -8
- package/dist/svelte/create-jazz-client.d.ts.map +1 -1
- package/dist/svelte/create-jazz-client.js +1 -17
- package/dist/svelte/index.d.ts +14 -7
- package/dist/svelte/index.d.ts.map +1 -1
- package/dist/svelte/index.js +10 -7
- package/dist/svelte/query-subscription.svelte.d.ts +60 -0
- package/dist/svelte/query-subscription.svelte.d.ts.map +1 -0
- package/dist/svelte/query-subscription.svelte.js +135 -0
- package/dist/svelte/session-state.d.ts +27 -0
- package/dist/svelte/session-state.d.ts.map +1 -0
- package/dist/svelte/session-state.js +49 -0
- package/dist/svelte/sync-status.d.ts +11 -0
- package/dist/svelte/sync-status.d.ts.map +1 -0
- package/dist/svelte/sync-status.js +15 -0
- package/dist/testing/fixtures/with-bigint/schema.d.ts +18 -0
- package/dist/testing/fixtures/with-bigint/schema.d.ts.map +1 -0
- package/dist/testing/fixtures/with-bigint/schema.js +15 -0
- package/dist/testing/fixtures/with-bigint/schema.js.map +1 -0
- package/dist/testing/index.d.ts +6 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +5 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/policy-test-app.d.ts +129 -0
- package/dist/testing/policy-test-app.d.ts.map +1 -0
- package/dist/testing/policy-test-app.js +229 -0
- package/dist/testing/policy-test-app.js.map +1 -0
- package/dist/testing/test-app.d.ts +272 -0
- package/dist/testing/test-app.d.ts.map +1 -0
- package/dist/testing/test-app.js +62 -0
- package/dist/testing/test-app.js.map +1 -0
- package/dist/testing/test-jazz.d.ts +119 -0
- package/dist/testing/test-jazz.d.ts.map +1 -0
- package/dist/testing/test-jazz.js +162 -0
- package/dist/testing/test-jazz.js.map +1 -0
- package/dist/testing/test-jwt-issuer.d.ts +19 -0
- package/dist/testing/test-jwt-issuer.d.ts.map +1 -0
- package/dist/testing/test-jwt-issuer.js +40 -0
- package/dist/testing/test-jwt-issuer.js.map +1 -0
- package/dist/text-field/index.d.ts +40 -0
- package/dist/text-field/index.d.ts.map +1 -0
- package/dist/text-field/index.js +129 -0
- package/dist/text-field/index.js.map +1 -0
- package/dist/thin/index.d.ts +80 -0
- package/dist/thin/index.d.ts.map +1 -0
- package/dist/thin/index.js +219 -0
- package/dist/thin/index.js.map +1 -0
- package/dist/thin/self-signed-token.d.ts +13 -0
- package/dist/thin/self-signed-token.d.ts.map +1 -0
- package/dist/thin/self-signed-token.js +100 -0
- package/dist/thin/self-signed-token.js.map +1 -0
- package/dist/thin/thin-runtime-source.d.ts +19 -0
- package/dist/thin/thin-runtime-source.d.ts.map +1 -0
- package/dist/thin/thin-runtime-source.js +66 -0
- package/dist/thin/thin-runtime-source.js.map +1 -0
- package/dist/thin/thin-runtime.d.ts +294 -0
- package/dist/thin/thin-runtime.d.ts.map +1 -0
- package/dist/thin/thin-runtime.js +1492 -0
- package/dist/thin/thin-runtime.js.map +1 -0
- package/dist/thin/wire.d.ts +160 -0
- package/dist/thin/wire.d.ts.map +1 -0
- package/dist/thin/wire.js +304 -0
- package/dist/thin/wire.js.map +1 -0
- package/dist/typed-app.d.ts +644 -0
- package/dist/typed-app.d.ts.map +1 -0
- package/dist/typed-app.js +549 -0
- package/dist/typed-app.js.map +1 -0
- package/dist/vue/create-jazz-client.d.ts +3 -0
- package/dist/vue/create-jazz-client.d.ts.map +1 -0
- package/dist/vue/create-jazz-client.js +2 -0
- package/dist/vue/create-jazz-client.js.map +1 -0
- package/dist/vue/index.d.ts +13 -0
- package/dist/vue/index.d.ts.map +1 -0
- package/dist/vue/index.js +9 -0
- package/dist/vue/index.js.map +1 -0
- package/dist/vue/provider.d.ts +50 -0
- package/dist/vue/provider.d.ts.map +1 -0
- package/dist/vue/provider.js +97 -0
- package/dist/vue/provider.js.map +1 -0
- package/dist/vue/session-key.d.ts +15 -0
- package/dist/vue/session-key.d.ts.map +1 -0
- package/dist/vue/session-key.js +7 -0
- package/dist/vue/session-key.js.map +1 -0
- package/dist/vue/session.d.ts +40 -0
- package/dist/vue/session.d.ts.map +1 -0
- package/dist/vue/session.js +112 -0
- package/dist/vue/session.js.map +1 -0
- package/dist/vue/use-all.d.ts +61 -0
- package/dist/vue/use-all.d.ts.map +1 -0
- package/dist/vue/use-all.js +104 -0
- package/dist/vue/use-all.js.map +1 -0
- package/dist/vue/use-one.d.ts +24 -0
- package/dist/vue/use-one.d.ts.map +1 -0
- package/dist/vue/use-one.js +17 -0
- package/dist/vue/use-one.js.map +1 -0
- package/dist/vue/use-sync-status.d.ts +9 -0
- package/dist/vue/use-sync-status.d.ts.map +1 -0
- package/dist/vue/use-sync-status.js +16 -0
- package/dist/vue/use-sync-status.js.map +1 -0
- package/dist/web/create-jazz-client.d.ts +12 -0
- package/dist/web/create-jazz-client.d.ts.map +1 -0
- package/dist/web/create-jazz-client.js +35 -0
- package/dist/web/create-jazz-client.js.map +1 -0
- package/dist/web/lazy-local-first.d.ts +5 -0
- package/dist/web/lazy-local-first.d.ts.map +1 -0
- package/dist/web/lazy-local-first.js +8 -0
- package/dist/web/lazy-local-first.js.map +1 -0
- package/dist/web/registered-jazz-client.d.ts +15 -0
- package/dist/web/registered-jazz-client.d.ts.map +1 -0
- package/dist/web/registered-jazz-client.js +35 -0
- package/dist/web/registered-jazz-client.js.map +1 -0
- package/dist/where-operators.d.ts +13 -0
- package/dist/where-operators.d.ts.map +1 -0
- package/dist/where-operators.js +66 -0
- package/dist/where-operators.js.map +1 -0
- package/dist/window-client-storage.d.ts +7 -0
- package/dist/window-client-storage.d.ts.map +1 -0
- package/dist/window-client-storage.js +27 -0
- package/dist/window-client-storage.js.map +1 -0
- package/dist/worker/jazz-broker-worker-core.d.ts +34 -0
- package/dist/worker/jazz-broker-worker-core.d.ts.map +1 -0
- package/dist/worker/jazz-broker-worker-core.js +2241 -0
- package/dist/worker/jazz-broker-worker-core.js.map +1 -0
- package/dist/worker/jazz-broker-worker.d.ts +3 -0
- package/dist/worker/jazz-broker-worker.d.ts.map +1 -0
- package/dist/worker/jazz-broker-worker.js +5 -0
- package/dist/worker/jazz_wasm_bg.wasm +0 -0
- package/dist/worker/mutation-error-delivery.d.ts +8 -0
- package/dist/worker/mutation-error-delivery.d.ts.map +1 -0
- package/dist/worker/mutation-error-delivery.js +10 -0
- package/dist/worker/mutation-error-delivery.js.map +1 -0
- package/dist/worker/runtime-admission.d.ts +34 -0
- package/dist/worker/runtime-admission.d.ts.map +1 -0
- package/dist/worker/runtime-admission.js +60 -0
- package/dist/worker/runtime-admission.js.map +1 -0
- package/dist/worker/vite-dev-broker.d.ts +2 -0
- package/dist/worker/vite-dev-broker.d.ts.map +1 -0
- package/dist/worker/vite-dev-broker.js +8 -0
- package/dist/worker/vite-dev-broker.js.map +1 -0
- package/package.json +299 -37
- package/bin/native/.gitkeep +0 -0
- package/bin/native/jazz-tools-darwin-arm64 +0 -0
- package/bin/native/jazz-tools-darwin-x64 +0 -0
- package/bin/native/jazz-tools-linux-arm64 +0 -0
- package/bin/native/jazz-tools-linux-x64 +0 -0
- package/bin/native/jazz-tools-windows-x64.exe +0 -0
- package/dist/backend/create-jazz-context.test.d.ts +0 -2
- package/dist/backend/create-jazz-context.test.d.ts.map +0 -1
- package/dist/backend/create-jazz-context.test.js +0 -141
- package/dist/backend/create-jazz-context.test.js.map +0 -1
- package/dist/cli.test.d.ts +0 -2
- package/dist/cli.test.d.ts.map +0 -1
- package/dist/cli.test.js +0 -154
- package/dist/cli.test.js.map +0 -1
- package/dist/codegen/codegen.test.d.ts +0 -2
- package/dist/codegen/codegen.test.d.ts.map +0 -1
- package/dist/codegen/codegen.test.js +0 -914
- package/dist/codegen/codegen.test.js.map +0 -1
- package/dist/codegen/index.d.ts +0 -18
- package/dist/codegen/index.d.ts.map +0 -1
- package/dist/codegen/index.js +0 -22
- package/dist/codegen/index.js.map +0 -1
- package/dist/codegen/query-builder-generator.d.ts +0 -26
- package/dist/codegen/query-builder-generator.d.ts.map +0 -1
- package/dist/codegen/query-builder-generator.js +0 -342
- package/dist/codegen/query-builder-generator.js.map +0 -1
- package/dist/codegen/schema-reader.d.ts +0 -12
- package/dist/codegen/schema-reader.d.ts.map +0 -1
- package/dist/codegen/schema-reader.js +0 -180
- package/dist/codegen/schema-reader.js.map +0 -1
- package/dist/codegen/type-generator.d.ts +0 -29
- package/dist/codegen/type-generator.d.ts.map +0 -1
- package/dist/codegen/type-generator.js +0 -296
- package/dist/codegen/type-generator.js.map +0 -1
- package/dist/dev-tools/dev-tools.d.ts +0 -15
- package/dist/dev-tools/dev-tools.d.ts.map +0 -1
- package/dist/dev-tools/dev-tools.js +0 -297
- package/dist/dev-tools/dev-tools.js.map +0 -1
- package/dist/dev-tools/extension-panel.d.ts +0 -19
- package/dist/dev-tools/extension-panel.d.ts.map +0 -1
- package/dist/dev-tools/extension-panel.js +0 -419
- package/dist/dev-tools/extension-panel.js.map +0 -1
- package/dist/dev-tools/index.d.ts +0 -3
- package/dist/dev-tools/index.d.ts.map +0 -1
- package/dist/dev-tools/index.js +0 -3
- package/dist/dev-tools/index.js.map +0 -1
- package/dist/dev-tools/protocol.d.ts +0 -49
- package/dist/dev-tools/protocol.d.ts.map +0 -1
- package/dist/dev-tools/protocol.js +0 -40
- package/dist/dev-tools/protocol.js.map +0 -1
- package/dist/dsl.test.d.ts +0 -2
- package/dist/dsl.test.d.ts.map +0 -1
- package/dist/dsl.test.js +0 -51
- package/dist/dsl.test.js.map +0 -1
- package/dist/permissions/index.d.ts +0 -146
- package/dist/permissions/index.d.ts.map +0 -1
- package/dist/permissions/index.js +0 -1211
- package/dist/permissions/index.js.map +0 -1
- package/dist/permissions/index.test.d.ts +0 -2
- package/dist/permissions/index.test.d.ts.map +0 -1
- package/dist/permissions/index.test.js +0 -830
- package/dist/permissions/index.test.js.map +0 -1
- package/dist/permissions/type-inference.test.d.ts +0 -2
- package/dist/permissions/type-inference.test.d.ts.map +0 -1
- package/dist/permissions/type-inference.test.js +0 -149
- package/dist/permissions/type-inference.test.js.map +0 -1
- package/dist/react/create-jazz-client.integration.test.d.ts +0 -2
- package/dist/react/create-jazz-client.integration.test.d.ts.map +0 -1
- package/dist/react/create-jazz-client.integration.test.js +0 -82
- package/dist/react/create-jazz-client.integration.test.js.map +0 -1
- package/dist/react/create-jazz-client.test.d.ts +0 -2
- package/dist/react/create-jazz-client.test.d.ts.map +0 -1
- package/dist/react/create-jazz-client.test.js +0 -135
- package/dist/react/create-jazz-client.test.js.map +0 -1
- package/dist/react/synthetic-user-switcher.d.ts +0 -9
- package/dist/react/synthetic-user-switcher.d.ts.map +0 -1
- package/dist/react/synthetic-user-switcher.js +0 -65
- package/dist/react/synthetic-user-switcher.js.map +0 -1
- package/dist/react/synthetic-users.d.ts +0 -2
- package/dist/react/synthetic-users.d.ts.map +0 -1
- package/dist/react/synthetic-users.js +0 -2
- package/dist/react/synthetic-users.js.map +0 -1
- package/dist/react/synthetic-users.test.d.ts +0 -2
- package/dist/react/synthetic-users.test.d.ts.map +0 -1
- package/dist/react/synthetic-users.test.js +0 -43
- package/dist/react/synthetic-users.test.js.map +0 -1
- package/dist/react/use-link-external-identity.d.ts +0 -25
- package/dist/react/use-link-external-identity.d.ts.map +0 -1
- package/dist/react/use-link-external-identity.js +0 -45
- package/dist/react/use-link-external-identity.js.map +0 -1
- package/dist/react-native/create-jazz-client.test.d.ts +0 -2
- package/dist/react-native/create-jazz-client.test.d.ts.map +0 -1
- package/dist/react-native/create-jazz-client.test.js +0 -162
- package/dist/react-native/create-jazz-client.test.js.map +0 -1
- package/dist/react-native/create-jazz-rn-runtime.d.ts +0 -13
- package/dist/react-native/create-jazz-rn-runtime.d.ts.map +0 -1
- package/dist/react-native/create-jazz-rn-runtime.js +0 -7
- package/dist/react-native/create-jazz-rn-runtime.js.map +0 -1
- package/dist/react-native/db.d.ts +0 -16
- package/dist/react-native/db.d.ts.map +0 -1
- package/dist/react-native/db.js +0 -50
- package/dist/react-native/db.js.map +0 -1
- package/dist/react-native/db.test.d.ts +0 -2
- package/dist/react-native/db.test.d.ts.map +0 -1
- package/dist/react-native/db.test.js +0 -148
- package/dist/react-native/db.test.js.map +0 -1
- package/dist/react-native/jazz-rn-runtime-adapter.d.ts +0 -56
- package/dist/react-native/jazz-rn-runtime-adapter.d.ts.map +0 -1
- package/dist/react-native/jazz-rn-runtime-adapter.js +0 -192
- package/dist/react-native/jazz-rn-runtime-adapter.js.map +0 -1
- package/dist/react-native/jazz-rn-runtime-adapter.test.d.ts +0 -2
- package/dist/react-native/jazz-rn-runtime-adapter.test.d.ts.map +0 -1
- package/dist/react-native/jazz-rn-runtime-adapter.test.js +0 -165
- package/dist/react-native/jazz-rn-runtime-adapter.test.js.map +0 -1
- package/dist/runtime/client-session.test.d.ts +0 -2
- package/dist/runtime/client-session.test.d.ts.map +0 -1
- package/dist/runtime/client-session.test.js +0 -84
- package/dist/runtime/client-session.test.js.map +0 -1
- package/dist/runtime/client.for-request.test.d.ts +0 -2
- package/dist/runtime/client.for-request.test.d.ts.map +0 -1
- package/dist/runtime/client.for-request.test.js +0 -191
- package/dist/runtime/client.for-request.test.js.map +0 -1
- package/dist/runtime/cloud-server.integration.test.d.ts +0 -2
- package/dist/runtime/cloud-server.integration.test.d.ts.map +0 -1
- package/dist/runtime/cloud-server.integration.test.js +0 -1210
- package/dist/runtime/cloud-server.integration.test.js.map +0 -1
- package/dist/runtime/dynamic-query.d.ts +0 -10
- package/dist/runtime/dynamic-query.d.ts.map +0 -1
- package/dist/runtime/dynamic-query.js +0 -11
- package/dist/runtime/dynamic-query.js.map +0 -1
- package/dist/runtime/leader-lock.d.ts +0 -15
- package/dist/runtime/leader-lock.d.ts.map +0 -1
- package/dist/runtime/leader-lock.js +0 -49
- package/dist/runtime/leader-lock.js.map +0 -1
- package/dist/runtime/local-auth.d.ts +0 -32
- package/dist/runtime/local-auth.d.ts.map +0 -1
- package/dist/runtime/local-auth.js +0 -93
- package/dist/runtime/local-auth.js.map +0 -1
- package/dist/runtime/local-auth.test.d.ts +0 -2
- package/dist/runtime/local-auth.test.d.ts.map +0 -1
- package/dist/runtime/local-auth.test.js +0 -50
- package/dist/runtime/local-auth.test.js.map +0 -1
- package/dist/runtime/query-adapter.test.d.ts +0 -5
- package/dist/runtime/query-adapter.test.d.ts.map +0 -1
- package/dist/runtime/query-adapter.test.js +0 -1249
- package/dist/runtime/query-adapter.test.js.map +0 -1
- package/dist/runtime/row-transformer.test.d.ts +0 -5
- package/dist/runtime/row-transformer.test.d.ts.map +0 -1
- package/dist/runtime/row-transformer.test.js +0 -385
- package/dist/runtime/row-transformer.test.js.map +0 -1
- package/dist/runtime/schema-fetch.d.ts +0 -17
- package/dist/runtime/schema-fetch.d.ts.map +0 -1
- package/dist/runtime/schema-fetch.js +0 -33
- package/dist/runtime/schema-fetch.js.map +0 -1
- package/dist/runtime/schema-fetch.test.d.ts +0 -2
- package/dist/runtime/schema-fetch.test.d.ts.map +0 -1
- package/dist/runtime/schema-fetch.test.js +0 -87
- package/dist/runtime/schema-fetch.test.js.map +0 -1
- package/dist/runtime/subscription-manager.test.d.ts +0 -5
- package/dist/runtime/subscription-manager.test.d.ts.map +0 -1
- package/dist/runtime/subscription-manager.test.js +0 -120
- package/dist/runtime/subscription-manager.test.js.map +0 -1
- package/dist/runtime/sync-transport.d.ts +0 -163
- package/dist/runtime/sync-transport.d.ts.map +0 -1
- package/dist/runtime/sync-transport.js +0 -477
- package/dist/runtime/sync-transport.js.map +0 -1
- package/dist/runtime/sync-transport.test.d.ts +0 -2
- package/dist/runtime/sync-transport.test.d.ts.map +0 -1
- package/dist/runtime/sync-transport.test.js +0 -310
- package/dist/runtime/sync-transport.test.js.map +0 -1
- package/dist/runtime/tab-leader-election.d.ts +0 -97
- package/dist/runtime/tab-leader-election.d.ts.map +0 -1
- package/dist/runtime/tab-leader-election.js +0 -339
- package/dist/runtime/tab-leader-election.js.map +0 -1
- package/dist/runtime/tab-leader-election.test.d.ts +0 -2
- package/dist/runtime/tab-leader-election.test.d.ts.map +0 -1
- package/dist/runtime/tab-leader-election.test.js +0 -278
- package/dist/runtime/tab-leader-election.test.js.map +0 -1
- package/dist/runtime/testing/wasm-runtime-test-utils.d.ts +0 -13
- package/dist/runtime/testing/wasm-runtime-test-utils.d.ts.map +0 -1
- package/dist/runtime/testing/wasm-runtime-test-utils.js +0 -76
- package/dist/runtime/testing/wasm-runtime-test-utils.js.map +0 -1
- package/dist/runtime/utils.d.ts +0 -2
- package/dist/runtime/utils.d.ts.map +0 -1
- package/dist/runtime/utils.js +0 -16
- package/dist/runtime/utils.js.map +0 -1
- package/dist/runtime/value-converter.test.d.ts +0 -5
- package/dist/runtime/value-converter.test.d.ts.map +0 -1
- package/dist/runtime/value-converter.test.js +0 -222
- package/dist/runtime/value-converter.test.js.map +0 -1
- package/dist/runtime/worker-bridge.d.ts +0 -82
- package/dist/runtime/worker-bridge.d.ts.map +0 -1
- package/dist/runtime/worker-bridge.js +0 -308
- package/dist/runtime/worker-bridge.js.map +0 -1
- package/dist/runtime/worker-bridge.race-harness.test.d.ts +0 -2
- package/dist/runtime/worker-bridge.race-harness.test.d.ts.map +0 -1
- package/dist/runtime/worker-bridge.race-harness.test.js +0 -284
- package/dist/runtime/worker-bridge.race-harness.test.js.map +0 -1
- package/dist/runtime/worker-bridge.test.d.ts +0 -2
- package/dist/runtime/worker-bridge.test.d.ts.map +0 -1
- package/dist/runtime/worker-bridge.test.js +0 -233
- package/dist/runtime/worker-bridge.test.js.map +0 -1
- package/dist/sql-gen.d.ts +0 -4
- package/dist/sql-gen.d.ts.map +0 -1
- package/dist/sql-gen.js +0 -163
- package/dist/sql-gen.js.map +0 -1
- package/dist/sql-gen.test.d.ts +0 -2
- package/dist/sql-gen.test.d.ts.map +0 -1
- package/dist/sql-gen.test.js +0 -412
- package/dist/sql-gen.test.js.map +0 -1
- package/dist/subscriptions-orchestrator.integration.test.d.ts +0 -2
- package/dist/subscriptions-orchestrator.integration.test.d.ts.map +0 -1
- package/dist/subscriptions-orchestrator.integration.test.js +0 -192
- package/dist/subscriptions-orchestrator.integration.test.js.map +0 -1
- package/dist/subscriptions-orchestrator.test.d.ts +0 -2
- package/dist/subscriptions-orchestrator.test.d.ts.map +0 -1
- package/dist/subscriptions-orchestrator.test.js +0 -367
- package/dist/subscriptions-orchestrator.test.js.map +0 -1
- package/dist/svelte/JazzSvelteProvider.svelte +0 -49
- package/dist/svelte/JazzSvelteProvider.svelte.d.ts +0 -13
- package/dist/svelte/JazzSvelteProvider.svelte.d.ts.map +0 -1
- package/dist/svelte/SyntheticUserSwitcher.svelte +0 -121
- package/dist/svelte/SyntheticUserSwitcher.svelte.d.ts +0 -11
- package/dist/svelte/SyntheticUserSwitcher.svelte.d.ts.map +0 -1
- package/dist/svelte/context.test.d.ts +0 -2
- package/dist/svelte/context.test.d.ts.map +0 -1
- package/dist/svelte/context.test.js +0 -55
- package/dist/svelte/create-jazz-client.test.d.ts +0 -2
- package/dist/svelte/create-jazz-client.test.d.ts.map +0 -1
- package/dist/svelte/create-jazz-client.test.js +0 -50
- package/dist/svelte/use-all.svelte.d.ts +0 -32
- package/dist/svelte/use-all.svelte.d.ts.map +0 -1
- package/dist/svelte/use-all.svelte.js +0 -61
- package/dist/svelte/use-all.test.d.ts +0 -2
- package/dist/svelte/use-all.test.d.ts.map +0 -1
- package/dist/svelte/use-all.test.js +0 -158
- package/dist/svelte/use-link-external-identity.d.ts +0 -25
- package/dist/svelte/use-link-external-identity.d.ts.map +0 -1
- package/dist/svelte/use-link-external-identity.js +0 -33
- package/dist/svelte/use-link-external-identity.test.d.ts +0 -2
- package/dist/svelte/use-link-external-identity.test.d.ts.map +0 -1
- package/dist/svelte/use-link-external-identity.test.js +0 -97
- package/dist/synthetic-user-switcher.d.ts +0 -16
- package/dist/synthetic-user-switcher.d.ts.map +0 -1
- package/dist/synthetic-user-switcher.js +0 -134
- package/dist/synthetic-user-switcher.js.map +0 -1
- package/dist/synthetic-users.d.ts +0 -32
- package/dist/synthetic-users.d.ts.map +0 -1
- package/dist/synthetic-users.js +0 -124
- package/dist/synthetic-users.js.map +0 -1
- package/dist/testing/fixtures/basic/app.d.ts +0 -55
- package/dist/testing/fixtures/basic/app.d.ts.map +0 -1
- package/dist/testing/fixtures/basic/app.js +0 -174
- package/dist/testing/fixtures/basic/app.js.map +0 -1
- package/dist/testing/fixtures/basic/current.d.ts +0 -2
- package/dist/testing/fixtures/basic/current.d.ts.map +0 -1
- package/dist/testing/fixtures/basic/current.js +0 -6
- package/dist/testing/fixtures/basic/current.js.map +0 -1
- package/dist/testing/index.test.d.ts +0 -2
- package/dist/testing/index.test.d.ts.map +0 -1
- package/dist/testing/index.test.js +0 -234
- package/dist/testing/index.test.js.map +0 -1
- package/dist/testing/local-jazz-server.d.ts +0 -34
- package/dist/testing/local-jazz-server.d.ts.map +0 -1
- package/dist/testing/local-jazz-server.js +0 -313
- package/dist/testing/local-jazz-server.js.map +0 -1
- package/dist/testing/relation-ir-test-helpers.d.ts +0 -3
- package/dist/testing/relation-ir-test-helpers.d.ts.map +0 -1
- package/dist/testing/relation-ir-test-helpers.js +0 -258
- package/dist/testing/relation-ir-test-helpers.js.map +0 -1
- package/dist/worker/jazz-worker.d.ts +0 -9
- package/dist/worker/jazz-worker.d.ts.map +0 -1
- package/dist/worker/jazz-worker.js +0 -555
- package/dist/worker/jazz-worker.js.map +0 -1
- package/dist/worker/jazz-worker.ts +0 -630
- package/dist/worker/worker-protocol.d.ts +0 -136
- package/dist/worker/worker-protocol.d.ts.map +0 -1
- package/dist/worker/worker-protocol.js +0 -7
- package/dist/worker/worker-protocol.js.map +0 -1
|
@@ -0,0 +1,1492 @@
|
|
|
1
|
+
import { parseSnapshotRef } from "../runtime/snapshot-ref.js";
|
|
2
|
+
import { CONNECTED, CONNECTING, linkFailureOf, offlineLink, } from "../runtime/sync-status.js";
|
|
3
|
+
import { streamingChunks } from "../runtime/streaming-source.js";
|
|
4
|
+
import { runtimeRandomBytes } from "../runtime/runtime-entropy.js";
|
|
5
|
+
import { writeRow } from "../runtime/write-row.js";
|
|
6
|
+
import { bytesToHex, formatUuid } from "../runtime/hex.js";
|
|
7
|
+
import { RuntimeClosedError } from "../runtime/runtime-closed-error.js";
|
|
8
|
+
import { canonicalAuthorSubject } from "../runtime/author-id.js";
|
|
9
|
+
import { PostcardReader, readNativeSubscriptionDelta, } from "../runtime/native-runtime/native-codec.js";
|
|
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
|
+
import { encodeSchema } from "../runtime/native-runtime/schema-codec.js";
|
|
12
|
+
import { WebSocketCarrier, peerIdentityForWebSocketAuth, classifyWireLinkFailure, isReauthenticateWireError, wireAuthFailureReason, } from "../runtime/native-runtime/websocket.js";
|
|
13
|
+
import { FEATURE_THIN_RESULTS, decodeThinResponse, encodeThinRequest, MAX_THIN_MESSAGE_BYTES, ThinAssembler, thinWireFrames, isThinResponse, } from "./wire.js";
|
|
14
|
+
/** A request failed on the server. `code` is the engine's stable error code. */
|
|
15
|
+
export class ThinRemoteError extends Error {
|
|
16
|
+
code;
|
|
17
|
+
constructor(code, message) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.code = code;
|
|
20
|
+
this.name = "ThinRemoteError";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The backend serving this session's transactions could not learn whether a
|
|
25
|
+
* commit applied: the core didn't confirm it in time. It may have applied,
|
|
26
|
+
* or may still: don't retry it as if it failed. Read the rows it wrote to
|
|
27
|
+
* find out.
|
|
28
|
+
*/
|
|
29
|
+
export class ThinCommitOutcomeUnknownError extends ThinRemoteError {
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super(COMMIT_OUTCOME_UNKNOWN, message);
|
|
32
|
+
this.name = "ThinCommitOutcomeUnknownError";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** The code of a commit whose outcome is unknown (SPEC 8.14). */
|
|
36
|
+
export const COMMIT_OUTCOME_UNKNOWN = "commit_outcome_unknown";
|
|
37
|
+
/** The error a thin request's error answer is thrown as. */
|
|
38
|
+
export function thinRemoteError(code, message) {
|
|
39
|
+
return code === COMMIT_OUTCOME_UNKNOWN
|
|
40
|
+
? new ThinCommitOutcomeUnknownError(message)
|
|
41
|
+
: new ThinRemoteError(code, message);
|
|
42
|
+
}
|
|
43
|
+
/** The connection ended before the server answered. A write may or may not have committed. */
|
|
44
|
+
export class ThinConnectionLostError extends Error {
|
|
45
|
+
constructor(message = "the connection to the Jazz server ended before it answered", options) {
|
|
46
|
+
super(message, options);
|
|
47
|
+
this.name = "ThinConnectionLostError";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The request never reached the server: a write didn't commit. The thin
|
|
52
|
+
* runtime ended it before a connection could carry it (it closed, or its Db
|
|
53
|
+
* handed over to the local-first one).
|
|
54
|
+
*/
|
|
55
|
+
export class ThinRequestNotSentError extends Error {
|
|
56
|
+
constructor(message = "the request never reached the Jazz server", options) {
|
|
57
|
+
super(message, options);
|
|
58
|
+
this.name = "ThinRequestNotSentError";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The server ends a thin connection's open transactions with it (on a
|
|
63
|
+
* reconnect, including the one a credential renewal takes): their staged
|
|
64
|
+
* writes are gone, and the transaction can only be started again.
|
|
65
|
+
*/
|
|
66
|
+
export class ThinTransactionLostError extends Error {
|
|
67
|
+
constructor(id) {
|
|
68
|
+
super(`transaction ${id} was lost with the connection to the Jazz server; its staged writes were discarded, so start it again`);
|
|
69
|
+
this.name = "ThinTransactionLostError";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const DEFAULT_RECONNECT_DELAYS_MS = [250, 500, 1_000, 2_000, 5_000];
|
|
73
|
+
/**
|
|
74
|
+
* How long after a keyed write was first sent it may still be sent again
|
|
75
|
+
* (SPEC 8 §8.14). The authority keeps a thin write's dedupe entry for an
|
|
76
|
+
* hour on its own clock, recorded no earlier than the first send, so every
|
|
77
|
+
* resend inside this window still finds it. Past it, a write whose answer
|
|
78
|
+
* was lost ends with its fate unknown.
|
|
79
|
+
*/
|
|
80
|
+
export const THIN_WRITE_RESEND_WINDOW_MS = 10 * 60_000;
|
|
81
|
+
/** Standalone writes the server dedups by their `writeKey` (SPEC 8 §8.14). */
|
|
82
|
+
const RESENDABLE_WRITES = new Set([
|
|
83
|
+
"insert",
|
|
84
|
+
"update",
|
|
85
|
+
"upsert",
|
|
86
|
+
"delete",
|
|
87
|
+
"restore",
|
|
88
|
+
]);
|
|
89
|
+
/**
|
|
90
|
+
* How long the connection may keep failing before the link reports an
|
|
91
|
+
* outage, as the core link does: a short blip never shows as offline.
|
|
92
|
+
*/
|
|
93
|
+
const OUTAGE_REPORT_MS = 7_500;
|
|
94
|
+
/** Committed writes kept for later waits on them. */
|
|
95
|
+
const RETAINED_WRITES = 1024;
|
|
96
|
+
export class ThinRuntime {
|
|
97
|
+
schema;
|
|
98
|
+
schemaBytes;
|
|
99
|
+
WebSocketImpl;
|
|
100
|
+
reconnectDelaysMs;
|
|
101
|
+
author;
|
|
102
|
+
carrier;
|
|
103
|
+
/** Joins the current connection's split responses. */
|
|
104
|
+
parts = new ThinAssembler();
|
|
105
|
+
url;
|
|
106
|
+
authJson;
|
|
107
|
+
/** Whether the server took this connection's schema. Live queries and
|
|
108
|
+
* the schema go out right behind the `Hello` (see `open`); other requests
|
|
109
|
+
* only once it is bound. */
|
|
110
|
+
bound = false;
|
|
111
|
+
/** A planned re-authentication is reconnecting a bound connection (see `lost`). */
|
|
112
|
+
reauthenticating = false;
|
|
113
|
+
wanted = false;
|
|
114
|
+
closed = false;
|
|
115
|
+
attempt = 0;
|
|
116
|
+
/** Why this runtime stopped for good (a server that can't serve it). */
|
|
117
|
+
failure;
|
|
118
|
+
reconnectTimer;
|
|
119
|
+
/** The server refused the credential: nothing reconnects until `updateAuth`. */
|
|
120
|
+
refused = false;
|
|
121
|
+
/** How the server put that refusal, for the writes it leaves unsent at close. */
|
|
122
|
+
refusal;
|
|
123
|
+
/** The connection ended for good (`fatal`, `close`). */
|
|
124
|
+
stopped = false;
|
|
125
|
+
/** When connecting started failing; cleared once connected or refused. */
|
|
126
|
+
failingSince;
|
|
127
|
+
outagePublished = false;
|
|
128
|
+
outageReportMs;
|
|
129
|
+
/** Why the latest connection ended, in the server's words when it said. */
|
|
130
|
+
lastLostMessage;
|
|
131
|
+
/** The way the link is failing now, to record each failure once. */
|
|
132
|
+
failingAs = null;
|
|
133
|
+
lastFailure = null;
|
|
134
|
+
nextRequestId = 1;
|
|
135
|
+
oneShots = new Map();
|
|
136
|
+
nextHandle = 1;
|
|
137
|
+
liveQueries = new Map();
|
|
138
|
+
liveByRequest = new Map();
|
|
139
|
+
writes = new Map();
|
|
140
|
+
/** This runtime's writer node: with {@link nextWriteSeq}, each write's
|
|
141
|
+
* `writeKey`. The server commits the write under a node it derives from
|
|
142
|
+
* this one and the session's author, so one node serves every identity
|
|
143
|
+
* the runtime writes as. It is marked as bounding its resends
|
|
144
|
+
* ({@link boundedWriterNode}). */
|
|
145
|
+
writerNode = bytesToHex(boundedWriterNode());
|
|
146
|
+
nextWriteSeq = 1;
|
|
147
|
+
/** Writes the server has not answered yet. */
|
|
148
|
+
unanswered = 0;
|
|
149
|
+
/** Writes the server rejected, and the latest rejection. */
|
|
150
|
+
rejected = 0;
|
|
151
|
+
lastRejection = null;
|
|
152
|
+
syncStatusListeners = new Set();
|
|
153
|
+
transactions = new Map();
|
|
154
|
+
/** Streaming writes still sending their value; each settles once its write is made. */
|
|
155
|
+
streamsInFlight = new Set();
|
|
156
|
+
mutationErrorCallback;
|
|
157
|
+
authFailureCallback;
|
|
158
|
+
authRestoredCallback;
|
|
159
|
+
constructor(schema, options = {}) {
|
|
160
|
+
this.schema = schema;
|
|
161
|
+
this.schemaBytes = encodeSchema(schema);
|
|
162
|
+
this.WebSocketImpl = options.WebSocket;
|
|
163
|
+
this.reconnectDelaysMs = options.reconnectDelaysMs ?? DEFAULT_RECONNECT_DELAYS_MS;
|
|
164
|
+
this.outageReportMs = options.outageReportMs ?? OUTAGE_REPORT_MS;
|
|
165
|
+
this.author = options.author;
|
|
166
|
+
}
|
|
167
|
+
// ---- connection -------------------------------------------------------
|
|
168
|
+
connect(url, authJson) {
|
|
169
|
+
const changed = (this.url !== undefined && url !== this.url) ||
|
|
170
|
+
(this.authJson !== undefined && authJson !== this.authJson);
|
|
171
|
+
this.url = url;
|
|
172
|
+
this.authJson = authJson;
|
|
173
|
+
this.wanted = true;
|
|
174
|
+
// Another server or credential, as for `updateAuth`: the connection
|
|
175
|
+
// bound to the old one goes, and a sent write waiting to go out again
|
|
176
|
+
// ends with its fate unknown instead of being made as someone else.
|
|
177
|
+
if (changed)
|
|
178
|
+
this.dropConnection(new ThinConnectionLostError());
|
|
179
|
+
// An explicit connect (a reconnect after a refusal or a terminal error)
|
|
180
|
+
// starts over, as the core link does.
|
|
181
|
+
if (!this.closed)
|
|
182
|
+
this.stopped = false;
|
|
183
|
+
this.failure = undefined;
|
|
184
|
+
this.setRefused(false);
|
|
185
|
+
this.open();
|
|
186
|
+
}
|
|
187
|
+
async disconnect(options) {
|
|
188
|
+
this.wanted = false;
|
|
189
|
+
this.clearOutage();
|
|
190
|
+
this.dropConnection(options?.rejectWaiters === false ? undefined : new ThinConnectionLostError());
|
|
191
|
+
}
|
|
192
|
+
updateAuth(authJson) {
|
|
193
|
+
this.authJson = authJson;
|
|
194
|
+
this.setRefused(false);
|
|
195
|
+
// The new credential may name another user (a cookie session names
|
|
196
|
+
// none here), as whom a sent write must not be made: one that may have
|
|
197
|
+
// been made ends with its fate unknown, as it did before resends.
|
|
198
|
+
this.dropConnection(new ThinConnectionLostError());
|
|
199
|
+
if (!this.wanted)
|
|
200
|
+
return;
|
|
201
|
+
// The server binds a connection to the credential it opened with: a new
|
|
202
|
+
// one takes a new connection.
|
|
203
|
+
this.open();
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The client's own session: calls naming it are served as this
|
|
207
|
+
* connection, calls naming any other are refused. Set before the client
|
|
208
|
+
* connects and again as its auth changes.
|
|
209
|
+
*/
|
|
210
|
+
useSession(session) {
|
|
211
|
+
this.author = session
|
|
212
|
+
? canonicalAuthorSubject(session.issuer, session.user_id, session.account_id)
|
|
213
|
+
: undefined;
|
|
214
|
+
}
|
|
215
|
+
onAuthFailure(callback) {
|
|
216
|
+
this.authFailureCallback = callback;
|
|
217
|
+
}
|
|
218
|
+
onAuthRestored(callback) {
|
|
219
|
+
this.authRestoredCallback = callback;
|
|
220
|
+
}
|
|
221
|
+
onMutationError(callback) {
|
|
222
|
+
this.mutationErrorCallback = callback;
|
|
223
|
+
}
|
|
224
|
+
close() {
|
|
225
|
+
this.closed = true;
|
|
226
|
+
this.wanted = false;
|
|
227
|
+
this.stop();
|
|
228
|
+
// Closed while the server refused this client's sign-in (its user's
|
|
229
|
+
// access was revoked, or their session ended, and they signed out):
|
|
230
|
+
// what never reached the server says so, not just that it closed.
|
|
231
|
+
const why = this.refused
|
|
232
|
+
? `the server refused this client's sign-in (${this.refusal?.message ?? "auth_failed"}), and the thin runtime closed before it signed in again`
|
|
233
|
+
: "the thin runtime is closed";
|
|
234
|
+
const closed = new ThinConnectionLostError(why, {
|
|
235
|
+
cause: new RuntimeClosedError(why),
|
|
236
|
+
});
|
|
237
|
+
this.dropConnection(closed);
|
|
238
|
+
// Nothing connects again: a request not sent yet ends too (a write
|
|
239
|
+
// waiting to go out again with its fate unknown), so a read the app made
|
|
240
|
+
// while the server was down asks the Db's successor instead.
|
|
241
|
+
this.endWaitingRequests(closed, new ThinRequestNotSentError(this.refused
|
|
242
|
+
? `the request never reached the server: ${why}`
|
|
243
|
+
: "the thin runtime closed before sending the request", { cause: closed.cause }));
|
|
244
|
+
for (const live of this.liveQueries.values())
|
|
245
|
+
live.callback = undefined;
|
|
246
|
+
this.liveQueries.clear();
|
|
247
|
+
}
|
|
248
|
+
open() {
|
|
249
|
+
if (this.closed || !this.url || this.authJson === undefined || this.carrier)
|
|
250
|
+
return;
|
|
251
|
+
clearTimeout(this.reconnectTimer);
|
|
252
|
+
this.failingSince ??= Date.now();
|
|
253
|
+
this.parts.reset();
|
|
254
|
+
const carrier = new WebSocketCarrier({
|
|
255
|
+
endpointUrl: this.url,
|
|
256
|
+
peerIdentity: peerIdentityForWebSocketAuth(this.authJson, this.author === undefined ? runtimeRandomBytes(16) : new TextEncoder().encode(this.author)),
|
|
257
|
+
features: FEATURE_THIN_RESULTS,
|
|
258
|
+
authJson: this.authJson,
|
|
259
|
+
WebSocket: this.WebSocketImpl,
|
|
260
|
+
onFrame: (frame) => this.receive(carrier, frame),
|
|
261
|
+
// The server's planned re-authentication, and a refusal of an admitted
|
|
262
|
+
// session (`jazz.revokeUser`), arrive as an error on an open connection,
|
|
263
|
+
// ahead of its close: handle it as the connection's end, so a refusal
|
|
264
|
+
// says why (`revoked`) rather than reading as a dropped connection.
|
|
265
|
+
onError: (error) => {
|
|
266
|
+
if (isReauthenticateWireError(error) || wireAuthFailureReason(error))
|
|
267
|
+
this.lost(carrier, error);
|
|
268
|
+
},
|
|
269
|
+
onTerminal: (error) => this.lost(carrier, error),
|
|
270
|
+
});
|
|
271
|
+
this.carrier = carrier;
|
|
272
|
+
// Pipelined: the schema and the app's live queries go out right behind
|
|
273
|
+
// the `Hello`, without waiting for the server's or for the schema's
|
|
274
|
+
// answer. The server reads them only once it admitted this connection,
|
|
275
|
+
// in order, so each live query resolves against the schema just before
|
|
276
|
+
// it; a connection it refuses never reads them (SPEC §8.1.2, §8.14).
|
|
277
|
+
// The first results then arrive one round trip after the socket opens,
|
|
278
|
+
// not three. Refused or lost, nothing sent ahead took effect: the next
|
|
279
|
+
// connection sends it all again.
|
|
280
|
+
this.bindSchema(carrier);
|
|
281
|
+
for (const live of this.liveQueries.values())
|
|
282
|
+
if (live.callback)
|
|
283
|
+
this.openLive(live);
|
|
284
|
+
void carrier.ready().then((negotiation) => {
|
|
285
|
+
if (this.carrier !== carrier)
|
|
286
|
+
return;
|
|
287
|
+
if ((negotiation.features & FEATURE_THIN_RESULTS) === 0) {
|
|
288
|
+
this.fatal(new Error("this Jazz server does not serve thin clients"));
|
|
289
|
+
}
|
|
290
|
+
}, () => {
|
|
291
|
+
// `onTerminal` reports why.
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
bindSchema(carrier) {
|
|
295
|
+
const id = this.nextRequestId++;
|
|
296
|
+
this.oneShots.set(id, {
|
|
297
|
+
op: { type: "schema", schema: this.schemaBytes },
|
|
298
|
+
sent: true,
|
|
299
|
+
resolve: (body) => {
|
|
300
|
+
if (this.carrier !== carrier)
|
|
301
|
+
return;
|
|
302
|
+
if (body.type === "error") {
|
|
303
|
+
this.fatal(new ThinRemoteError(body.code, body.message));
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
this.attempt = 0;
|
|
307
|
+
this.bound = true;
|
|
308
|
+
this.reauthenticating = false;
|
|
309
|
+
this.refused = false;
|
|
310
|
+
this.refusal = undefined;
|
|
311
|
+
// Admitted: whatever refused the credential before holds no more.
|
|
312
|
+
this.authRestoredCallback?.();
|
|
313
|
+
this.stopped = false;
|
|
314
|
+
this.clearOutage();
|
|
315
|
+
this.notifySyncStatus();
|
|
316
|
+
// Live queries opened since went out ahead already (`executeSubscription`).
|
|
317
|
+
for (const live of this.liveQueries.values()) {
|
|
318
|
+
if (live.callback && live.requestId === undefined)
|
|
319
|
+
this.openLive(live);
|
|
320
|
+
}
|
|
321
|
+
for (const [requestId, oneShot] of this.oneShots) {
|
|
322
|
+
if (!oneShot.sent)
|
|
323
|
+
this.transmit(requestId, oneShot);
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
// A connection that ends before the answer is retried as a whole.
|
|
327
|
+
reject: () => undefined,
|
|
328
|
+
});
|
|
329
|
+
this.sendFrame(carrier, encodeThinRequest(id, { type: "schema", schema: this.schemaBytes }), (bytes) => {
|
|
330
|
+
this.oneShots.delete(id);
|
|
331
|
+
this.fatal(tooLarge("schema", bytes));
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
/** Send `frame`, in parts when it is over a wire frame; `tooLarge`
|
|
335
|
+
* instead past what one request takes. */
|
|
336
|
+
sendFrame(carrier, frame, refused) {
|
|
337
|
+
const frames = thinWireFrames(frame);
|
|
338
|
+
if (frames === null) {
|
|
339
|
+
refused(frame.byteLength);
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
// Parts of one frame go back to back, and every frame in the order sent,
|
|
343
|
+
// also before the server's `Hello` (see `open`).
|
|
344
|
+
carrier?.sendAhead(frames);
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
lost(carrier, error) {
|
|
348
|
+
if (this.carrier !== carrier)
|
|
349
|
+
return;
|
|
350
|
+
const lostError = new ThinConnectionLostError(`${error.code}: ${error.message}`);
|
|
351
|
+
const wasBound = this.bound;
|
|
352
|
+
this.lastLostMessage = error.message;
|
|
353
|
+
// A planned swap that ends any other way is reported as that ending.
|
|
354
|
+
this.reauthenticating = false;
|
|
355
|
+
const kind = classifyWireLinkFailure(error, wasBound);
|
|
356
|
+
if (kind === "reauthenticate" && wasBound) {
|
|
357
|
+
// The session reached the expiry the app's auth gave it: connect again
|
|
358
|
+
// at once so `authenticate` decides with the current credential. The
|
|
359
|
+
// app keeps seeing a connected link meanwhile; unanswered writes go
|
|
360
|
+
// out again on the new connection.
|
|
361
|
+
this.reauthenticating = true;
|
|
362
|
+
this.dropConnection(lostError, true);
|
|
363
|
+
this.open();
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
// The auth path follows the classification: an `auth_failed` with a retry
|
|
367
|
+
// this client does not know is a refusal it retries, not a refused
|
|
368
|
+
// credential (a reauthenticate before binding is still one).
|
|
369
|
+
const authFailure = kind === "authRejected" || kind === "reauthenticate" ? wireAuthFailureReason(error) : null;
|
|
370
|
+
if (authFailure) {
|
|
371
|
+
// Refused before the drop publishes, so the link never reads
|
|
372
|
+
// "connecting" in between.
|
|
373
|
+
this.clearOutage();
|
|
374
|
+
this.refused = true;
|
|
375
|
+
this.refusal = lostError;
|
|
376
|
+
// Writes left unanswered wait for the renewed credential's connection.
|
|
377
|
+
this.dropConnection(lostError, this.wanted && !this.closed && error.retry !== "never");
|
|
378
|
+
this.notifySyncStatus();
|
|
379
|
+
// Nothing reconnects until the credential is renewed (`updateAuth`).
|
|
380
|
+
this.authFailureCallback?.(authFailure);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (kind === "fatal") {
|
|
384
|
+
// Stopped for good: only an explicit connect starts over, and requests
|
|
385
|
+
// waiting for a connection end now. Decided by the code, so a
|
|
386
|
+
// malformed frame that says `later` does not loop.
|
|
387
|
+
this.fatal(lostError);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
this.dropConnection(lostError, this.wanted && !this.closed);
|
|
391
|
+
// An attempt that fails past the window reports the outage. A server that
|
|
392
|
+
// answered and refused this connection for now (`backpressure` before
|
|
393
|
+
// admission, such as the connection cap per user) is reported at once:
|
|
394
|
+
// there is nothing to wait out, and its message says why.
|
|
395
|
+
if (!this.stopped &&
|
|
396
|
+
!this.outagePublished &&
|
|
397
|
+
(kind === "refused" ||
|
|
398
|
+
(this.failingSince !== undefined && Date.now() - this.failingSince >= this.outageReportMs))) {
|
|
399
|
+
this.outagePublished = true;
|
|
400
|
+
}
|
|
401
|
+
this.notifySyncStatus();
|
|
402
|
+
if (!this.wanted || this.closed)
|
|
403
|
+
return;
|
|
404
|
+
// The thin client keeps its own delays rather than the link's policy, but
|
|
405
|
+
// spreads them as the link does (equal jitter, within [d/2, d]), so
|
|
406
|
+
// clients dropped together do not reconnect together.
|
|
407
|
+
const delays = this.reconnectDelaysMs;
|
|
408
|
+
const ceiling = delays[Math.min(this.attempt, delays.length - 1)] ?? 1_000;
|
|
409
|
+
const delay = ceiling / 2 + Math.random() * (ceiling / 2);
|
|
410
|
+
this.attempt += 1;
|
|
411
|
+
this.reconnectTimer = setTimeout(() => this.open(), delay);
|
|
412
|
+
}
|
|
413
|
+
/** Close the connection; requests already sent fail with `error`, live queries reopen later.
|
|
414
|
+
* With `resend`, a write under a `writeKey` the connection left unanswered
|
|
415
|
+
* waits for the next connection instead, and goes out again in order. */
|
|
416
|
+
dropConnection(error, resend = false,
|
|
417
|
+
/** What a sent write ends with, when not `error`: it may have committed. */
|
|
418
|
+
sentWriteError = error) {
|
|
419
|
+
clearTimeout(this.reconnectTimer);
|
|
420
|
+
const carrier = this.carrier;
|
|
421
|
+
this.carrier = undefined;
|
|
422
|
+
if (this.bound) {
|
|
423
|
+
this.bound = false;
|
|
424
|
+
this.notifySyncStatus();
|
|
425
|
+
}
|
|
426
|
+
carrier?.close();
|
|
427
|
+
for (const live of this.liveQueries.values()) {
|
|
428
|
+
if (live.requestId !== undefined)
|
|
429
|
+
this.liveByRequest.delete(live.requestId);
|
|
430
|
+
live.requestId = undefined;
|
|
431
|
+
if (live.delivered)
|
|
432
|
+
live.resetNext = true;
|
|
433
|
+
}
|
|
434
|
+
// The server abandoned every transaction begun on this connection.
|
|
435
|
+
const lost = new Set();
|
|
436
|
+
for (const [id, transaction] of this.transactions) {
|
|
437
|
+
if (transaction.begin.sent && !transaction.lost) {
|
|
438
|
+
// Kept, so its handle's commit says it was lost, but without its
|
|
439
|
+
// staged writes' answers.
|
|
440
|
+
transaction.lost = true;
|
|
441
|
+
transaction.requests = [];
|
|
442
|
+
lost.add(id);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
for (const [id, oneShot] of this.oneShots) {
|
|
446
|
+
const transaction = transactionOf(oneShot.op);
|
|
447
|
+
if (transaction !== undefined && lost.has(transaction)) {
|
|
448
|
+
this.oneShots.delete(id);
|
|
449
|
+
oneShot.reject(new ThinTransactionLostError(transaction));
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
// Requests not sent yet wait for the next connection, and so does a
|
|
453
|
+
// write sent once, unless this drop ends its resends.
|
|
454
|
+
if (!oneShot.sent && !(oneShot.resending && !resend))
|
|
455
|
+
continue;
|
|
456
|
+
if (oneShot.sent && resend && oneShot.resendable && !resendWindowPassed(oneShot)) {
|
|
457
|
+
oneShot.sent = false;
|
|
458
|
+
oneShot.resending = true;
|
|
459
|
+
this.endAtResendWindow(id, oneShot);
|
|
460
|
+
continue;
|
|
461
|
+
}
|
|
462
|
+
if (oneShot.sent && resend && oneShot.resendable) {
|
|
463
|
+
this.oneShots.delete(id);
|
|
464
|
+
oneShot.reject(resendWindowEnded(error));
|
|
465
|
+
continue;
|
|
466
|
+
}
|
|
467
|
+
this.oneShots.delete(id);
|
|
468
|
+
if (error)
|
|
469
|
+
oneShot.reject(oneShot.write ? (sentWriteError ?? error) : error);
|
|
470
|
+
// A sent write is never sent again after an explicit disconnect: it may
|
|
471
|
+
// have committed, so it ends with its fate unknown. (A sent read is
|
|
472
|
+
// dropped unanswered, as before.)
|
|
473
|
+
else if (oneShot.write)
|
|
474
|
+
oneShot.reject(new ThinConnectionLostError());
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
fatal(error) {
|
|
478
|
+
this.wanted = false;
|
|
479
|
+
this.failure = error;
|
|
480
|
+
this.lastLostMessage = error.message;
|
|
481
|
+
this.stop();
|
|
482
|
+
// A write the server may have taken ends with its fate unknown, not as
|
|
483
|
+
// the server's rejection of it.
|
|
484
|
+
this.dropConnection(error, false, unknownOutcome(error));
|
|
485
|
+
// Requests not sent yet would wait for a connection that never comes.
|
|
486
|
+
this.endWaitingRequests(error);
|
|
487
|
+
for (const live of this.liveQueries.values())
|
|
488
|
+
live.callback?.(error);
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* End every request still waiting for a connection. A write sent once and
|
|
492
|
+
* waiting to go out again ends with its fate unknown, as it may have
|
|
493
|
+
* committed; one never sent with {@link ThinRequestNotSentError}, as it
|
|
494
|
+
* certainly didn't. Any other request ends with `notSent`.
|
|
495
|
+
*/
|
|
496
|
+
endWaitingRequests(error, notSent = error) {
|
|
497
|
+
for (const [id, oneShot] of this.oneShots) {
|
|
498
|
+
this.oneShots.delete(id);
|
|
499
|
+
if (oneShot.resending)
|
|
500
|
+
oneShot.reject(unknownOutcome(error));
|
|
501
|
+
else if (oneShot.write && !(notSent instanceof ThinRequestNotSentError))
|
|
502
|
+
oneShot.reject(new ThinRequestNotSentError(`the request never reached the server: ${error.message}`, {
|
|
503
|
+
cause: error,
|
|
504
|
+
}));
|
|
505
|
+
else
|
|
506
|
+
oneShot.reject(notSent);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* @internal Its Db handed over to a successor: end the reads (outside a
|
|
511
|
+
* transaction) not sent yet, and any made from now on, with
|
|
512
|
+
* {@link RuntimeClosedError} as their cause,
|
|
513
|
+
* so each asks the successor instead of waiting for this runtime's server.
|
|
514
|
+
* Writes stay, to upload once it answers.
|
|
515
|
+
*/
|
|
516
|
+
endUnsentReads() {
|
|
517
|
+
// A read that reaches this runtime later (it was still on its way when
|
|
518
|
+
// the Db handed over) ends the same way.
|
|
519
|
+
this.handedOver = true;
|
|
520
|
+
for (const [id, oneShot] of this.oneShots) {
|
|
521
|
+
if (oneShot.sent || !endsAtHandOver(oneShot.op))
|
|
522
|
+
continue;
|
|
523
|
+
this.oneShots.delete(id);
|
|
524
|
+
oneShot.reject(handedOver());
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
/** Set by {@link endUnsentReads}. */
|
|
528
|
+
handedOver = false;
|
|
529
|
+
// ---- requests ---------------------------------------------------------
|
|
530
|
+
request(op, id = this.nextRequestId++) {
|
|
531
|
+
return this.requestWith(op, id).answer;
|
|
532
|
+
}
|
|
533
|
+
/** {@link request}, with the request's own record. */
|
|
534
|
+
requestWith(op, id = this.nextRequestId++) {
|
|
535
|
+
if (this.closed)
|
|
536
|
+
return {
|
|
537
|
+
answer: Promise.reject(new RuntimeClosedError("the thin runtime is closed")),
|
|
538
|
+
};
|
|
539
|
+
// Handed over first: the successor serves a read even after a failure here.
|
|
540
|
+
if (this.handedOver && endsAtHandOver(op))
|
|
541
|
+
return { answer: Promise.reject(handedOver()) };
|
|
542
|
+
if (this.failure)
|
|
543
|
+
return { answer: Promise.reject(this.failure) };
|
|
544
|
+
let oneShot;
|
|
545
|
+
const answer = new Promise((resolve, reject) => {
|
|
546
|
+
oneShot = { op, resolve, reject, sent: false };
|
|
547
|
+
this.oneShots.set(id, oneShot);
|
|
548
|
+
if (this.bound)
|
|
549
|
+
this.transmit(id, oneShot);
|
|
550
|
+
})
|
|
551
|
+
.finally(() => clearTimeout(oneShot?.windowTimer))
|
|
552
|
+
.then((body) => {
|
|
553
|
+
if (body.type === "error")
|
|
554
|
+
throw thinRemoteError(body.code, body.message);
|
|
555
|
+
return body;
|
|
556
|
+
});
|
|
557
|
+
return { answer, oneShot };
|
|
558
|
+
}
|
|
559
|
+
transmit(id, oneShot) {
|
|
560
|
+
// Past its window, a resend could find its dedupe entry gone and be
|
|
561
|
+
// written again: it ends with its fate unknown instead.
|
|
562
|
+
if (oneShot.resending && resendWindowPassed(oneShot)) {
|
|
563
|
+
this.oneShots.delete(id);
|
|
564
|
+
oneShot.reject(resendWindowEnded());
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
const sent = this.sendFrame(this.carrier, encodeThinRequest(id, oneShot.op), (bytes) => {
|
|
568
|
+
// Refused here: the server would refuse it.
|
|
569
|
+
this.oneShots.delete(id);
|
|
570
|
+
oneShot.reject(tooLarge(oneShot.op.type, bytes));
|
|
571
|
+
});
|
|
572
|
+
if (sent) {
|
|
573
|
+
oneShot.sent = true;
|
|
574
|
+
oneShot.firstSentAt ??= Date.now();
|
|
575
|
+
clearTimeout(oneShot.windowTimer);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
/** End `oneShot`, waiting to go out again, once its resend window passes
|
|
579
|
+
* (it may wait offline far longer). */
|
|
580
|
+
endAtResendWindow(id, oneShot) {
|
|
581
|
+
clearTimeout(oneShot.windowTimer);
|
|
582
|
+
const left = (oneShot.firstSentAt ?? Date.now()) + THIN_WRITE_RESEND_WINDOW_MS - Date.now();
|
|
583
|
+
oneShot.windowTimer = setTimeout(() => {
|
|
584
|
+
if (this.oneShots.get(id) !== oneShot || oneShot.sent)
|
|
585
|
+
return;
|
|
586
|
+
this.oneShots.delete(id);
|
|
587
|
+
oneShot.reject(resendWindowEnded());
|
|
588
|
+
}, Math.max(0, left));
|
|
589
|
+
}
|
|
590
|
+
receive(carrier, piece) {
|
|
591
|
+
if (this.carrier !== carrier)
|
|
592
|
+
return;
|
|
593
|
+
let response;
|
|
594
|
+
try {
|
|
595
|
+
let frame = piece;
|
|
596
|
+
if (ThinAssembler.isPart(piece)) {
|
|
597
|
+
const joined = this.parts.push(piece);
|
|
598
|
+
if (joined === undefined)
|
|
599
|
+
return;
|
|
600
|
+
frame = joined;
|
|
601
|
+
}
|
|
602
|
+
else if (this.parts.joining) {
|
|
603
|
+
throw new Error("a thin frame arrived inside a split one");
|
|
604
|
+
}
|
|
605
|
+
if (!isThinResponse(frame))
|
|
606
|
+
return;
|
|
607
|
+
response = decodeThinResponse(frame);
|
|
608
|
+
}
|
|
609
|
+
catch (error) {
|
|
610
|
+
// The server broke the framing: start over on a new connection.
|
|
611
|
+
this.parts.reset();
|
|
612
|
+
this.lost(carrier, {
|
|
613
|
+
code: "MalformedFrame",
|
|
614
|
+
retry: "later",
|
|
615
|
+
message: error instanceof Error ? error.message : String(error),
|
|
616
|
+
});
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
const { id, body } = response;
|
|
620
|
+
const handle = this.liveByRequest.get(id);
|
|
621
|
+
if (handle !== undefined) {
|
|
622
|
+
this.receiveLive(handle, id, body);
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
const oneShot = this.oneShots.get(id);
|
|
626
|
+
if (!oneShot)
|
|
627
|
+
return;
|
|
628
|
+
this.oneShots.delete(id);
|
|
629
|
+
oneShot.resolve(body);
|
|
630
|
+
}
|
|
631
|
+
// ---- reads ------------------------------------------------------------
|
|
632
|
+
/**
|
|
633
|
+
* Every read and write runs as this connection's session. The client
|
|
634
|
+
* names its own session with each call; another one (a trusted backend
|
|
635
|
+
* acting for a user, `db.forSession(other)`) is refused rather than
|
|
636
|
+
* silently served as this one. A connection that does not know its
|
|
637
|
+
* author (a cookie session) refuses any session named explicitly.
|
|
638
|
+
*/
|
|
639
|
+
refuseOtherSession(sessionJson, operation) {
|
|
640
|
+
if (sessionJson == null)
|
|
641
|
+
return;
|
|
642
|
+
// A session, or a write context naming one.
|
|
643
|
+
const parsed = JSON.parse(sessionJson);
|
|
644
|
+
if (parsed.attribution != null) {
|
|
645
|
+
throw new Error(`${operation} failed: attributed writes are not supported in thin mode`);
|
|
646
|
+
}
|
|
647
|
+
const session = parsed.session ?? parsed;
|
|
648
|
+
if (session.user_id === undefined)
|
|
649
|
+
return;
|
|
650
|
+
const author = session.issuer
|
|
651
|
+
? canonicalAuthorSubject(session.issuer, session.user_id, session.account_id)
|
|
652
|
+
: undefined;
|
|
653
|
+
if (this.author === undefined || author !== this.author) {
|
|
654
|
+
throw new Error(`${operation} failed: reading or writing as another session is not supported in thin mode`);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
/** What a write context asks of a thin write. Its session is the connection's. */
|
|
658
|
+
writeTarget(writeContext, operation) {
|
|
659
|
+
this.refuseOtherSession(writeContext, operation);
|
|
660
|
+
return {
|
|
661
|
+
operation,
|
|
662
|
+
transaction: txIdFromContext(writeContext),
|
|
663
|
+
branchView: branchViewFromWriteContext(writeContext),
|
|
664
|
+
updatedAtMs: effectiveUpdatedAtMs(writeContext) ?? undefined,
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
async query(queryJson, sessionJson, tier, optionsJson) {
|
|
668
|
+
this.refuseOtherSession(sessionJson, "Query");
|
|
669
|
+
assertSupportedReadOptions(tier, optionsJson);
|
|
670
|
+
assertNoUnsupportedPermissionIntrospection(queryJson);
|
|
671
|
+
const coreQueryJson = addNestedOuterColumns(queryJson);
|
|
672
|
+
const transaction = openTransactionIdFromOptions(optionsJson);
|
|
673
|
+
if (transaction)
|
|
674
|
+
this.openTransaction(transaction, "Query setup");
|
|
675
|
+
const body = await this.request({
|
|
676
|
+
type: "query",
|
|
677
|
+
query: encodeQueryJson(coreQueryJson, this.schema),
|
|
678
|
+
options: readOptions(tier, queryIncludesDeleted(coreQueryJson), optionsJson),
|
|
679
|
+
transaction,
|
|
680
|
+
});
|
|
681
|
+
if (body.type !== "rows")
|
|
682
|
+
throw new Error(`unexpected answer to a query: ${body.type}`);
|
|
683
|
+
const projected = subscriptionOutputColumns(coreQueryJson, this.schema).rootColumns;
|
|
684
|
+
return queryHasArraySubqueries(coreQueryJson) || body.relation
|
|
685
|
+
? rowsFromRelationSnapshot(readRelationSnapshot(body.rows), this.schema, projected)
|
|
686
|
+
: rowsFromBatches(readRowBatches(body.rows), this.schema, projected);
|
|
687
|
+
}
|
|
688
|
+
createSubscription(queryJson, sessionJson, tier, optionsJson) {
|
|
689
|
+
this.refuseOtherSession(sessionJson, "Subscription");
|
|
690
|
+
assertSupportedReadOptions(tier, optionsJson);
|
|
691
|
+
assertNoUnsupportedPermissionIntrospection(queryJson);
|
|
692
|
+
const handle = this.nextHandle++;
|
|
693
|
+
this.liveQueries.set(handle, {
|
|
694
|
+
queryJson,
|
|
695
|
+
query: encodeQueryJson(queryJson, this.schema),
|
|
696
|
+
options: readOptions(tier, queryIncludesDeleted(queryJson), optionsJson),
|
|
697
|
+
outputColumns: subscriptionOutputColumns(queryJson, this.schema),
|
|
698
|
+
delivered: false,
|
|
699
|
+
resetNext: false,
|
|
700
|
+
});
|
|
701
|
+
return handle;
|
|
702
|
+
}
|
|
703
|
+
executeSubscription(handle, onUpdate) {
|
|
704
|
+
const live = this.liveQueries.get(handle);
|
|
705
|
+
if (!live)
|
|
706
|
+
return;
|
|
707
|
+
if (live.callback)
|
|
708
|
+
throw new Error("Subscription has already been activated");
|
|
709
|
+
live.callback = onUpdate;
|
|
710
|
+
// Behind the schema, also while its answer is on its way (see `open`).
|
|
711
|
+
if (this.carrier)
|
|
712
|
+
this.openLive(live);
|
|
713
|
+
}
|
|
714
|
+
/** @internal The runtime queries the app is subscribed to now, for an upgrade to warm. */
|
|
715
|
+
liveQueryJsons() {
|
|
716
|
+
return [...this.liveQueries.values()]
|
|
717
|
+
.filter((live) => live.callback !== undefined)
|
|
718
|
+
.map((live) => live.queryJson);
|
|
719
|
+
}
|
|
720
|
+
unsubscribe(handle) {
|
|
721
|
+
const live = this.liveQueries.get(handle);
|
|
722
|
+
if (!live)
|
|
723
|
+
return;
|
|
724
|
+
this.liveQueries.delete(handle);
|
|
725
|
+
live.callback = undefined;
|
|
726
|
+
if (live.requestId === undefined)
|
|
727
|
+
return;
|
|
728
|
+
this.liveByRequest.delete(live.requestId);
|
|
729
|
+
if (this.bound) {
|
|
730
|
+
void this.request({
|
|
731
|
+
type: "unsubscribe",
|
|
732
|
+
subscription: live.requestId,
|
|
733
|
+
}).catch(() => {
|
|
734
|
+
// The connection ended: the server closed the live query with it.
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
else if (this.carrier) {
|
|
738
|
+
// Opened ahead of the schema's answer: closed the same way, right
|
|
739
|
+
// behind it. Nobody waits for the answer (its id is unknown here),
|
|
740
|
+
// and a connection that ends first took the live query with it.
|
|
741
|
+
const id = this.nextRequestId++;
|
|
742
|
+
this.sendFrame(this.carrier, encodeThinRequest(id, { type: "unsubscribe", subscription: live.requestId }), () => undefined);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
openLive(live) {
|
|
746
|
+
const id = this.nextRequestId++;
|
|
747
|
+
const handle = [...this.liveQueries].find(([, candidate]) => candidate === live)?.[0];
|
|
748
|
+
if (handle === undefined)
|
|
749
|
+
return;
|
|
750
|
+
live.requestId = id;
|
|
751
|
+
this.liveByRequest.set(id, handle);
|
|
752
|
+
this.sendFrame(this.carrier, encodeThinRequest(id, { type: "subscribe", query: live.query, options: live.options }), (bytes) => {
|
|
753
|
+
this.liveByRequest.delete(id);
|
|
754
|
+
live.requestId = undefined;
|
|
755
|
+
this.receiveLive(handle, id, {
|
|
756
|
+
type: "error",
|
|
757
|
+
code: "TooLarge",
|
|
758
|
+
message: tooLarge("subscribe", bytes).message,
|
|
759
|
+
});
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
receiveLive(handle, requestId, body) {
|
|
763
|
+
const live = this.liveQueries.get(handle);
|
|
764
|
+
if (!live?.callback)
|
|
765
|
+
return;
|
|
766
|
+
if (body.type === "event") {
|
|
767
|
+
const reset = body.reset || live.resetNext;
|
|
768
|
+
live.resetNext = false;
|
|
769
|
+
live.delivered = true;
|
|
770
|
+
const delta = decodeSubscriptionDelta(readNativeSubscriptionDelta(new PostcardReader(body.delta)), this.schema, reset, live.outputColumns);
|
|
771
|
+
live.callback(delta);
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
// Anything else ends the live query on the server. The app still wants
|
|
775
|
+
// it (an unsubscribe forgets the request first), so it hears why.
|
|
776
|
+
this.liveByRequest.delete(requestId);
|
|
777
|
+
live.requestId = undefined;
|
|
778
|
+
const callback = live.callback;
|
|
779
|
+
this.liveQueries.delete(handle);
|
|
780
|
+
live.callback = undefined;
|
|
781
|
+
callback(body.type === "error"
|
|
782
|
+
? new ThinRemoteError(body.code, body.message)
|
|
783
|
+
: new ThinRemoteError("Closed", "the Jazz server ended this live query"));
|
|
784
|
+
}
|
|
785
|
+
// ---- writes -----------------------------------------------------------
|
|
786
|
+
insert(table, values, writeContext, objectId) {
|
|
787
|
+
const context = this.writeTarget(writeContext, "Insert");
|
|
788
|
+
const definition = this.definition(table);
|
|
789
|
+
const id = objectId ?? formatUuid(uuidv7());
|
|
790
|
+
const cells = encodeCellsForRow(definition, values, table);
|
|
791
|
+
const receipt = this.mutate(context, {
|
|
792
|
+
type: "insert",
|
|
793
|
+
table,
|
|
794
|
+
cells,
|
|
795
|
+
options: {
|
|
796
|
+
rowId: parseUuid(id),
|
|
797
|
+
branch: context.branchView?.head,
|
|
798
|
+
updatedAtMs: context.updatedAtMs,
|
|
799
|
+
},
|
|
800
|
+
});
|
|
801
|
+
const row = writeRow(table, id, definition.columns, values);
|
|
802
|
+
return { id: row.id, values: row.values, ...receipt };
|
|
803
|
+
}
|
|
804
|
+
update(table, objectId, values, writeContext) {
|
|
805
|
+
const context = this.writeTarget(writeContext, "Update");
|
|
806
|
+
return this.mutate(context, {
|
|
807
|
+
type: "update",
|
|
808
|
+
table,
|
|
809
|
+
row: parseUuid(objectId),
|
|
810
|
+
patch: encodeCellsForPatch(this.definition(table), values),
|
|
811
|
+
options: viewOptions(context),
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
upsert(table, objectId, values, writeContext) {
|
|
815
|
+
const context = this.writeTarget(writeContext, "Upsert");
|
|
816
|
+
return this.mutate(context, {
|
|
817
|
+
type: "upsert",
|
|
818
|
+
table,
|
|
819
|
+
row: parseUuid(objectId),
|
|
820
|
+
cells: encodeCellsForPatch(this.definition(table), values),
|
|
821
|
+
options: viewOptions(context),
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
delete(table, objectId, writeContext) {
|
|
825
|
+
const context = this.writeTarget(writeContext, "Delete");
|
|
826
|
+
this.definition(table);
|
|
827
|
+
return this.mutate(context, {
|
|
828
|
+
type: "delete",
|
|
829
|
+
table,
|
|
830
|
+
row: parseUuid(objectId),
|
|
831
|
+
options: viewOptions(context),
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
restore(table, objectId, values, writeContext) {
|
|
835
|
+
const context = this.writeTarget(writeContext, "Restore");
|
|
836
|
+
const definition = this.definition(table);
|
|
837
|
+
const receipt = this.mutate(context, {
|
|
838
|
+
type: "restore",
|
|
839
|
+
table,
|
|
840
|
+
row: parseUuid(objectId),
|
|
841
|
+
cells: encodeCellsForRow(definition, values, table),
|
|
842
|
+
options: {
|
|
843
|
+
branch: context.branchView?.head,
|
|
844
|
+
updatedAtMs: context.updatedAtMs,
|
|
845
|
+
},
|
|
846
|
+
});
|
|
847
|
+
const row = writeRow(table, objectId, definition.columns, values);
|
|
848
|
+
return { id: row.id, values: row.values, ...receipt };
|
|
849
|
+
}
|
|
850
|
+
updateLargeValues(table, objectId, values, descriptors, writeContext) {
|
|
851
|
+
const context = this.writeTarget(writeContext, "Update");
|
|
852
|
+
// Branch views have no partial-value coordinate space yet (#2087).
|
|
853
|
+
if (context.branchView) {
|
|
854
|
+
throw new Error("Partial-value updates (applyDiffs, editedFrom) are not yet supported in branch views.");
|
|
855
|
+
}
|
|
856
|
+
return this.mutate(context, {
|
|
857
|
+
type: "updateLargeValues",
|
|
858
|
+
table,
|
|
859
|
+
row: parseUuid(objectId),
|
|
860
|
+
patch: encodeCellsForPatch(this.definition(table), values),
|
|
861
|
+
mutations: descriptors,
|
|
862
|
+
updatedAtMs: context.updatedAtMs,
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
async streamingMutation(mutation, table, values, column, source, writeContext, objectId) {
|
|
866
|
+
const running = this.runStreamingMutation(mutation, table, values, column, source, writeContext, objectId);
|
|
867
|
+
// Until its value is sent and its write made, a graceful shutdown (the
|
|
868
|
+
// drain after the local-first upgrade) waits for it: see
|
|
869
|
+
// `waitForPendingWrites`.
|
|
870
|
+
const settled = running.then(() => undefined, () => undefined);
|
|
871
|
+
this.streamsInFlight.add(settled);
|
|
872
|
+
void settled.then(() => this.streamsInFlight.delete(settled));
|
|
873
|
+
return running;
|
|
874
|
+
}
|
|
875
|
+
async runStreamingMutation(mutation, table, values, column, source, writeContext, objectId) {
|
|
876
|
+
const operation = mutation === "insert" ? "Insert" : mutation === "update" ? "Update" : "Upsert";
|
|
877
|
+
const context = this.writeTarget(writeContext, operation);
|
|
878
|
+
const transaction = context.transaction
|
|
879
|
+
? this.openTransaction(context.transaction, operation)
|
|
880
|
+
: undefined;
|
|
881
|
+
const definition = this.definition(table);
|
|
882
|
+
const kind = definition.columns.find((candidate) => candidate.name === column)?.column_type
|
|
883
|
+
.type;
|
|
884
|
+
if (kind !== "Text" && kind !== "Json" && kind !== "Bytea") {
|
|
885
|
+
throw new Error(`Streaming insert requires a Text, Json, or Bytea column: ${table}.${column}`);
|
|
886
|
+
}
|
|
887
|
+
const row = objectId ? parseUuid(objectId) : uuidv7();
|
|
888
|
+
const stream = this.nextRequestId++;
|
|
889
|
+
const begun = this.request({
|
|
890
|
+
type: "beginStream",
|
|
891
|
+
table,
|
|
892
|
+
row,
|
|
893
|
+
cells: mutation === "insert"
|
|
894
|
+
? encodeCellsForStreamingRow(definition, values, column, table)
|
|
895
|
+
: encodeCellsForStreamingPatch(definition, values, column),
|
|
896
|
+
column,
|
|
897
|
+
mutation,
|
|
898
|
+
options: viewOptions(context),
|
|
899
|
+
transaction: context.transaction ?? undefined,
|
|
900
|
+
}, stream);
|
|
901
|
+
// Chunks go one window at a time: each waits for the server to apply
|
|
902
|
+
// the one before, which bounds what a slow server buffers.
|
|
903
|
+
// Set when the runtime, not the app's source, failed the stream.
|
|
904
|
+
let runtimeFailed = false;
|
|
905
|
+
const push = async (bytes) => {
|
|
906
|
+
const windowBytes = 64 * 1024;
|
|
907
|
+
for (let offset = 0; offset < bytes.byteLength; offset += windowBytes) {
|
|
908
|
+
await this.request({
|
|
909
|
+
type: "streamChunk",
|
|
910
|
+
stream,
|
|
911
|
+
chunk: bytes.subarray(offset, offset + windowBytes),
|
|
912
|
+
}).catch((error) => {
|
|
913
|
+
runtimeFailed = true;
|
|
914
|
+
throw error;
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
const encoder = new TextEncoder();
|
|
919
|
+
let pendingHighSurrogate = "";
|
|
920
|
+
try {
|
|
921
|
+
await begun.catch((error) => {
|
|
922
|
+
runtimeFailed = true;
|
|
923
|
+
throw error;
|
|
924
|
+
});
|
|
925
|
+
for await (const chunk of streamingChunks(source)) {
|
|
926
|
+
if (typeof chunk === "string") {
|
|
927
|
+
if (kind === "Bytea")
|
|
928
|
+
throw new Error("Bytea streams require Uint8Array chunks");
|
|
929
|
+
let text = pendingHighSurrogate + chunk;
|
|
930
|
+
pendingHighSurrogate = "";
|
|
931
|
+
const trailing = text.charCodeAt(text.length - 1);
|
|
932
|
+
if (trailing >= 0xd800 && trailing <= 0xdbff) {
|
|
933
|
+
pendingHighSurrogate = text.slice(-1);
|
|
934
|
+
text = text.slice(0, -1);
|
|
935
|
+
}
|
|
936
|
+
if (text.length > 0)
|
|
937
|
+
await push(encoder.encode(text));
|
|
938
|
+
}
|
|
939
|
+
else if (chunk instanceof Uint8Array) {
|
|
940
|
+
if (pendingHighSurrogate) {
|
|
941
|
+
await push(encoder.encode(pendingHighSurrogate));
|
|
942
|
+
pendingHighSurrogate = "";
|
|
943
|
+
}
|
|
944
|
+
await push(chunk);
|
|
945
|
+
}
|
|
946
|
+
else {
|
|
947
|
+
throw new Error("Streaming insert chunks must be strings or Uint8Array values");
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
if (pendingHighSurrogate)
|
|
951
|
+
await push(encoder.encode(pendingHighSurrogate));
|
|
952
|
+
}
|
|
953
|
+
catch (error) {
|
|
954
|
+
void this.request({ type: "abortStream", stream }).catch(() => undefined);
|
|
955
|
+
// The drain after the upgrade lets a stream finish; only the app
|
|
956
|
+
// shutting the client down (a sign-out, an account switch, a close)
|
|
957
|
+
// ends one. Say so, and that the value was not written: the stream
|
|
958
|
+
// never finished, so nothing committed. (The source's own errors
|
|
959
|
+
// stay as they are. A source that never yields again leaves the
|
|
960
|
+
// stream pending: it ends at the source's next step.)
|
|
961
|
+
if (runtimeFailed && this.closed && this.handedOver)
|
|
962
|
+
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 });
|
|
963
|
+
throw error;
|
|
964
|
+
}
|
|
965
|
+
const written = context.branchView ? [] : [{ table, id: formatUuid(row) }];
|
|
966
|
+
if (transaction) {
|
|
967
|
+
// The value is staged in the transaction; its commit reports a
|
|
968
|
+
// refusal of the row write.
|
|
969
|
+
transaction.rows.push(...written);
|
|
970
|
+
const staged = this.request({ type: "finishStream", stream });
|
|
971
|
+
transaction.requests.push(staged);
|
|
972
|
+
transaction.staged = true;
|
|
973
|
+
await staged;
|
|
974
|
+
return {
|
|
975
|
+
id: formatUuid(row),
|
|
976
|
+
kind: "staged",
|
|
977
|
+
openTransactionId: context.transaction,
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
return {
|
|
981
|
+
id: formatUuid(row),
|
|
982
|
+
kind: "committed",
|
|
983
|
+
txId: this.write({ type: "finishStream", stream }, written),
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
// ---- transactions -----------------------------------------------------
|
|
987
|
+
beginTransaction(kind, id, sessionJson) {
|
|
988
|
+
this.refuseOtherSession(sessionJson, "Begin transaction");
|
|
989
|
+
if (this.closed)
|
|
990
|
+
throw new Error("Begin transaction failed: the thin runtime is closed");
|
|
991
|
+
if (this.transactions.has(id)) {
|
|
992
|
+
throw new Error(`Begin transaction failed: transaction ${id} has already been opened`);
|
|
993
|
+
}
|
|
994
|
+
// The server binds the transaction to this connection's session.
|
|
995
|
+
const { answer: begun, oneShot: begin } = this.requestWith({
|
|
996
|
+
type: "begin",
|
|
997
|
+
transaction: id,
|
|
998
|
+
kind,
|
|
999
|
+
});
|
|
1000
|
+
begun.catch(() => undefined);
|
|
1001
|
+
this.transactions.set(id, {
|
|
1002
|
+
kind,
|
|
1003
|
+
requests: [begun],
|
|
1004
|
+
staged: false,
|
|
1005
|
+
begin: begin,
|
|
1006
|
+
lost: false,
|
|
1007
|
+
rows: [],
|
|
1008
|
+
});
|
|
1009
|
+
return id;
|
|
1010
|
+
}
|
|
1011
|
+
hasStagedTransactionWrites(id) {
|
|
1012
|
+
const transaction = this.transactions.get(id);
|
|
1013
|
+
return transaction ? transaction.staged : undefined;
|
|
1014
|
+
}
|
|
1015
|
+
commitTransaction(id) {
|
|
1016
|
+
const transaction = this.transactions.get(id);
|
|
1017
|
+
if (!transaction) {
|
|
1018
|
+
throw new Error(`Commit transaction failed: Write error: open transaction ${id} has already been completed or was never opened`);
|
|
1019
|
+
}
|
|
1020
|
+
if (!transaction.staged && transaction.kind === "mergeable") {
|
|
1021
|
+
throw new Error("Commit transaction failed: empty mergeable transaction has no committed unit; roll it back instead");
|
|
1022
|
+
}
|
|
1023
|
+
this.transactions.delete(id);
|
|
1024
|
+
if (transaction.lost)
|
|
1025
|
+
return Promise.reject(new ThinTransactionLostError(id));
|
|
1026
|
+
// A staged write the server refused outright fails the commit; one its
|
|
1027
|
+
// row's state refused is the commit's own rejection, from the server.
|
|
1028
|
+
const committed = Promise.all(transaction.requests).then(() => this.write({ type: "commit", transaction: id }, transaction.rows), (error) => {
|
|
1029
|
+
void this.request({ type: "rollback", transaction: id }).catch(() => undefined);
|
|
1030
|
+
throw error;
|
|
1031
|
+
});
|
|
1032
|
+
// Until its staged requests are answered the commit is not a write yet:
|
|
1033
|
+
// `waitForPendingWrites` (the local-first upgrade's drain, a shutdown
|
|
1034
|
+
// that waits for sync) waits for it here, or it would close this runtime
|
|
1035
|
+
// under a commit the app already made.
|
|
1036
|
+
const committing = committed.then(() => undefined, () => undefined);
|
|
1037
|
+
this.committing.add(committing);
|
|
1038
|
+
void committing.finally(() => this.committing.delete(committing));
|
|
1039
|
+
return committed;
|
|
1040
|
+
}
|
|
1041
|
+
/** Commits whose staged requests are still being answered (see {@link commitTransaction}). */
|
|
1042
|
+
committing = new Set();
|
|
1043
|
+
async rollbackTransaction(id) {
|
|
1044
|
+
const transaction = this.transactions.get(id);
|
|
1045
|
+
if (!transaction) {
|
|
1046
|
+
throw new Error(`Rollback transaction failed: Write error: open transaction ${id} has already been completed or was never opened`);
|
|
1047
|
+
}
|
|
1048
|
+
this.transactions.delete(id);
|
|
1049
|
+
// The server already abandoned a lost transaction.
|
|
1050
|
+
if (transaction.lost)
|
|
1051
|
+
return true;
|
|
1052
|
+
await this.request({ type: "rollback", transaction: id });
|
|
1053
|
+
return true;
|
|
1054
|
+
}
|
|
1055
|
+
async captureSnapshot() {
|
|
1056
|
+
const body = await this.request({ type: "captureSnapshot" });
|
|
1057
|
+
if (body.type !== "snapshot") {
|
|
1058
|
+
throw new Error(`unexpected answer to a snapshot capture: ${body.type}`);
|
|
1059
|
+
}
|
|
1060
|
+
return parseSnapshotRef(new TextDecoder().decode(body.snapshot));
|
|
1061
|
+
}
|
|
1062
|
+
openTransaction(id, operation) {
|
|
1063
|
+
const transaction = this.transactions.get(id);
|
|
1064
|
+
if (!transaction) {
|
|
1065
|
+
throw new Error(`${operation} failed: Write error: open transaction ${id} has already been completed or was never opened`);
|
|
1066
|
+
}
|
|
1067
|
+
if (transaction.lost)
|
|
1068
|
+
throw new ThinTransactionLostError(id);
|
|
1069
|
+
return transaction;
|
|
1070
|
+
}
|
|
1071
|
+
/** A write, staged in its transaction or committed on its own. */
|
|
1072
|
+
mutate(context, op) {
|
|
1073
|
+
const id = context.transaction;
|
|
1074
|
+
const row = writtenRow(context, op);
|
|
1075
|
+
if (!id)
|
|
1076
|
+
return { kind: "committed", txId: this.write(op, row ? [row] : []) };
|
|
1077
|
+
const transaction = this.openTransaction(id, context.operation);
|
|
1078
|
+
if (row)
|
|
1079
|
+
transaction.rows.push(row);
|
|
1080
|
+
const staged = this.request({ ...op, transaction: id });
|
|
1081
|
+
staged.catch(() => undefined);
|
|
1082
|
+
transaction.requests.push(staged);
|
|
1083
|
+
transaction.staged = true;
|
|
1084
|
+
return { kind: "staged", openTransactionId: id };
|
|
1085
|
+
}
|
|
1086
|
+
async waitForTransaction(txId, _tier, options) {
|
|
1087
|
+
const id = await txId;
|
|
1088
|
+
const write = this.writes.get(id);
|
|
1089
|
+
if (!write) {
|
|
1090
|
+
// Forgotten once committed (see pruneWrites); ids are this runtime's own.
|
|
1091
|
+
if (typeof id === "string" && id.startsWith("thin:"))
|
|
1092
|
+
return;
|
|
1093
|
+
throw new Error(`unknown thin write ${String(id)}`);
|
|
1094
|
+
}
|
|
1095
|
+
// The server confirms a thin write only once it committed on the
|
|
1096
|
+
// authority, which meets every durability tier.
|
|
1097
|
+
if (!options?.observeOnly)
|
|
1098
|
+
write.observed = true;
|
|
1099
|
+
if (!options?.signal)
|
|
1100
|
+
return write.done;
|
|
1101
|
+
const signal = options.signal;
|
|
1102
|
+
signal.throwIfAborted();
|
|
1103
|
+
return Promise.race([
|
|
1104
|
+
write.done,
|
|
1105
|
+
new Promise((_, reject) => signal.addEventListener("abort", () => reject(signal.reason), {
|
|
1106
|
+
once: true,
|
|
1107
|
+
})),
|
|
1108
|
+
]);
|
|
1109
|
+
}
|
|
1110
|
+
writtenRowsReader;
|
|
1111
|
+
/**
|
|
1112
|
+
* @internal Hand the rows this runtime writes to `read`, which reads them
|
|
1113
|
+
* into the local-first client taking over: from now on each write's rows
|
|
1114
|
+
* once the server confirms it, before that write's waits resolve. `read`
|
|
1115
|
+
* must give up on its own (offline, a timeout); a failure is ignored.
|
|
1116
|
+
* Returns the rows of the writes the server already confirmed, for the
|
|
1117
|
+
* caller to read.
|
|
1118
|
+
*/
|
|
1119
|
+
handOffWrittenRows(read) {
|
|
1120
|
+
this.writtenRowsReader = read;
|
|
1121
|
+
return [...this.writes.values()]
|
|
1122
|
+
.filter((write) => write.confirmed)
|
|
1123
|
+
.flatMap((write) => write.rows);
|
|
1124
|
+
}
|
|
1125
|
+
/** The upstream link as the app sees it (see `linkStatusFromUpstream`). */
|
|
1126
|
+
upstreamLinkStatus() {
|
|
1127
|
+
if (this.stopped)
|
|
1128
|
+
return offlineLink("stopped");
|
|
1129
|
+
if (this.refused)
|
|
1130
|
+
return offlineLink("auth");
|
|
1131
|
+
if (this.bound || this.reauthenticating)
|
|
1132
|
+
return CONNECTED;
|
|
1133
|
+
return this.outagePublished ? offlineLink("network") : CONNECTING;
|
|
1134
|
+
}
|
|
1135
|
+
setRefused(refused) {
|
|
1136
|
+
if (!refused)
|
|
1137
|
+
this.refusal = undefined;
|
|
1138
|
+
if (this.refused === refused)
|
|
1139
|
+
return;
|
|
1140
|
+
this.refused = refused;
|
|
1141
|
+
this.notifySyncStatus();
|
|
1142
|
+
}
|
|
1143
|
+
clearOutage() {
|
|
1144
|
+
this.failingSince = undefined;
|
|
1145
|
+
this.outagePublished = false;
|
|
1146
|
+
}
|
|
1147
|
+
stop() {
|
|
1148
|
+
this.clearOutage();
|
|
1149
|
+
if (this.stopped)
|
|
1150
|
+
return;
|
|
1151
|
+
this.stopped = true;
|
|
1152
|
+
this.notifySyncStatus();
|
|
1153
|
+
}
|
|
1154
|
+
/** @internal Stop handing rows to `read` (its upgrade failed), unless another reader took over. */
|
|
1155
|
+
stopHandingOffWrittenRows(read) {
|
|
1156
|
+
if (this.writtenRowsReader === read)
|
|
1157
|
+
this.writtenRowsReader = undefined;
|
|
1158
|
+
}
|
|
1159
|
+
/** How many writes still wait for the server's answer. */
|
|
1160
|
+
pendingUploadCount() {
|
|
1161
|
+
return this.unanswered;
|
|
1162
|
+
}
|
|
1163
|
+
/** The writes waiting for the server's answer, and what it rejected, for the sync status. */
|
|
1164
|
+
uploadStatus() {
|
|
1165
|
+
let oldestPendingAt = null;
|
|
1166
|
+
for (const write of this.writes.values()) {
|
|
1167
|
+
if (write.answered)
|
|
1168
|
+
continue;
|
|
1169
|
+
if (oldestPendingAt === null || write.madeAt < oldestPendingAt)
|
|
1170
|
+
oldestPendingAt = write.madeAt;
|
|
1171
|
+
}
|
|
1172
|
+
return {
|
|
1173
|
+
pending: this.unanswered,
|
|
1174
|
+
oldestPendingAt,
|
|
1175
|
+
rejected: this.rejected,
|
|
1176
|
+
lastRejection: this.lastRejection,
|
|
1177
|
+
pendingRevision: 0,
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
/** Observe changes of {@link pendingUploadCount} and {@link upstreamLinkStatus}. */
|
|
1181
|
+
onSyncStatusChange(listener, signal) {
|
|
1182
|
+
if (signal.aborted)
|
|
1183
|
+
return;
|
|
1184
|
+
this.syncStatusListeners.add(listener);
|
|
1185
|
+
signal.addEventListener("abort", () => this.syncStatusListeners.delete(listener), {
|
|
1186
|
+
once: true,
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
notifySyncStatus() {
|
|
1190
|
+
this.noteLinkFailure();
|
|
1191
|
+
for (const listener of [...this.syncStatusListeners])
|
|
1192
|
+
listener();
|
|
1193
|
+
}
|
|
1194
|
+
/** The latest time the link failed, and how; it stays after the link recovers. */
|
|
1195
|
+
lastLinkFailure() {
|
|
1196
|
+
this.noteLinkFailure();
|
|
1197
|
+
return this.lastFailure;
|
|
1198
|
+
}
|
|
1199
|
+
/** Record a failure the first time the link is seen failing that way. */
|
|
1200
|
+
noteLinkFailure() {
|
|
1201
|
+
const link = this.upstreamLinkStatus();
|
|
1202
|
+
const failing = link.state === "offline" ? link.reason : null;
|
|
1203
|
+
if (failing === this.failingAs)
|
|
1204
|
+
return;
|
|
1205
|
+
this.failingAs = failing;
|
|
1206
|
+
const failure = linkFailureOf(link, this.lastLostMessage);
|
|
1207
|
+
if (failure)
|
|
1208
|
+
this.lastFailure = failure;
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Every write made so far has been answered. Every write is global once
|
|
1212
|
+
* answered. With `inFlightStreams`, streaming writes still sending their
|
|
1213
|
+
* value finish first, and their writes count too, until that signal
|
|
1214
|
+
* aborts: then only the writes made so far count.
|
|
1215
|
+
*/
|
|
1216
|
+
async waitForPendingWrites(_tier, options = {}) {
|
|
1217
|
+
const answered = (async () => {
|
|
1218
|
+
// The drain after the local-first upgrade lets a stream finish rather
|
|
1219
|
+
// than closing the connection under it, until the app shuts down.
|
|
1220
|
+
const streams = options.inFlightStreams;
|
|
1221
|
+
if (streams && !streams.aborted && this.streamsInFlight.size > 0) {
|
|
1222
|
+
const ended = new Promise((resolve) => streams.addEventListener("abort", () => resolve(), { once: true }));
|
|
1223
|
+
while (!streams.aborted && this.streamsInFlight.size > 0)
|
|
1224
|
+
await Promise.race([Promise.all(this.streamsInFlight), ended]);
|
|
1225
|
+
}
|
|
1226
|
+
// A commit made before this wait becomes a write once its staged
|
|
1227
|
+
// requests are answered: it counts as made so far.
|
|
1228
|
+
if (this.committing.size > 0)
|
|
1229
|
+
await Promise.all([...this.committing]);
|
|
1230
|
+
// Only writes still waiting for their answer, like a local-first client:
|
|
1231
|
+
// a rejection the app already had doesn't fail every later wait.
|
|
1232
|
+
const dones = [...this.writes.values()]
|
|
1233
|
+
.filter((write) => !write.answered)
|
|
1234
|
+
.map((write) => write.done);
|
|
1235
|
+
// Waiting for sync fails on the server's rejection. A write whose
|
|
1236
|
+
// connection ended unanswered is not rejected, and the shutdown drain
|
|
1237
|
+
// only waits for every write to be answered.
|
|
1238
|
+
const settled = options.throughOutage
|
|
1239
|
+
? Promise.all(dones.map((done) => done.catch((error) => {
|
|
1240
|
+
if (error instanceof ThinRemoteError)
|
|
1241
|
+
throw error;
|
|
1242
|
+
})))
|
|
1243
|
+
: Promise.allSettled(dones);
|
|
1244
|
+
if (options.throughOutage || dones.length === 0)
|
|
1245
|
+
return void (await settled);
|
|
1246
|
+
// The upgrade's drain (`inFlightStreams`) runs beside the app, which
|
|
1247
|
+
// may still renew a refused credential: it waits through a refusal
|
|
1248
|
+
// until the app shuts down (the signal aborts).
|
|
1249
|
+
if (streams && !streams.aborted) {
|
|
1250
|
+
const stopping = new Promise((resolve) => streams.addEventListener("abort", () => resolve(false), { once: true }));
|
|
1251
|
+
if (await Promise.race([settled.then(() => true), stopping]))
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
// A shutdown is final: no new credential comes for a runtime that is
|
|
1255
|
+
// stopping, so while the server refuses this client's sign-in (now or
|
|
1256
|
+
// once the shutdown started) nothing will answer those writes, and the
|
|
1257
|
+
// drain fails instead of waiting for good. (`waitForSync` waits
|
|
1258
|
+
// through a refusal, which the app may renew.)
|
|
1259
|
+
await this.unlessRefused(settled);
|
|
1260
|
+
})();
|
|
1261
|
+
const signal = options.signal;
|
|
1262
|
+
if (!signal) {
|
|
1263
|
+
await answered;
|
|
1264
|
+
return;
|
|
1265
|
+
}
|
|
1266
|
+
signal.throwIfAborted();
|
|
1267
|
+
await Promise.race([
|
|
1268
|
+
answered,
|
|
1269
|
+
new Promise((_, reject) => signal.addEventListener("abort", () => reject(signal.reason), {
|
|
1270
|
+
once: true,
|
|
1271
|
+
})),
|
|
1272
|
+
]);
|
|
1273
|
+
}
|
|
1274
|
+
/** `pending`, failing as soon as the server refuses this client's sign-in. */
|
|
1275
|
+
unlessRefused(pending) {
|
|
1276
|
+
const stop = new AbortController();
|
|
1277
|
+
const refused = new Promise((_, reject) => {
|
|
1278
|
+
const check = () => {
|
|
1279
|
+
if (!this.refused)
|
|
1280
|
+
return;
|
|
1281
|
+
stop.abort();
|
|
1282
|
+
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 }));
|
|
1283
|
+
};
|
|
1284
|
+
check();
|
|
1285
|
+
this.onSyncStatusChange(check, stop.signal);
|
|
1286
|
+
});
|
|
1287
|
+
return Promise.race([pending, refused]).finally(() => stop.abort());
|
|
1288
|
+
}
|
|
1289
|
+
write(op, rows = []) {
|
|
1290
|
+
const txId = `thin:${this.nextRequestId}`;
|
|
1291
|
+
const write = {
|
|
1292
|
+
observed: false,
|
|
1293
|
+
committed: false,
|
|
1294
|
+
answered: false,
|
|
1295
|
+
confirmed: false,
|
|
1296
|
+
rows,
|
|
1297
|
+
madeAt: Date.now(),
|
|
1298
|
+
done: Promise.resolve(),
|
|
1299
|
+
};
|
|
1300
|
+
// A standalone write goes under this runtime's next write id, so it can
|
|
1301
|
+
// be sent again after a lost answer. Ids follow the order writes are
|
|
1302
|
+
// made in, which is the order they reach the server, resent or not.
|
|
1303
|
+
const resendable = RESENDABLE_WRITES.has(op.type) && "options" in op;
|
|
1304
|
+
const sent = resendable
|
|
1305
|
+
? {
|
|
1306
|
+
...op,
|
|
1307
|
+
options: { ...op.options, writeKey: { node: this.writerNode, seq: this.nextWriteSeq++ } },
|
|
1308
|
+
}
|
|
1309
|
+
: op;
|
|
1310
|
+
const { answer, oneShot } = this.requestWith(sent);
|
|
1311
|
+
if (oneShot) {
|
|
1312
|
+
oneShot.write = true;
|
|
1313
|
+
oneShot.resendable = resendable;
|
|
1314
|
+
}
|
|
1315
|
+
write.done = answer.then(async (body) => {
|
|
1316
|
+
if (body.type !== "written")
|
|
1317
|
+
throw new Error(`unexpected answer to a write: ${body.type}`);
|
|
1318
|
+
write.confirmed = true;
|
|
1319
|
+
// Once handed off, a committed write's rows reach the local-first
|
|
1320
|
+
// client before its waits resolve, so its local reads show them.
|
|
1321
|
+
const read = this.writtenRowsReader;
|
|
1322
|
+
if (read && rows.length > 0)
|
|
1323
|
+
await read(rows).catch(() => undefined);
|
|
1324
|
+
}, (error) => {
|
|
1325
|
+
const failure = error instanceof Error ? error : new Error(String(error));
|
|
1326
|
+
// The sync status counts a rejection whether or not a wait takes it.
|
|
1327
|
+
if (failure instanceof ThinRemoteError) {
|
|
1328
|
+
this.rejected++;
|
|
1329
|
+
this.lastRejection = { code: failure.code, message: failure.message, at: Date.now() };
|
|
1330
|
+
}
|
|
1331
|
+
// A failure no wait observes is reported once, like a local-first
|
|
1332
|
+
// client's rejected write.
|
|
1333
|
+
queueMicrotask(() => {
|
|
1334
|
+
if (write.observed)
|
|
1335
|
+
return;
|
|
1336
|
+
// Only the server's answer is a rejection. A write whose
|
|
1337
|
+
// connection ended unanswered may have committed: its fate is
|
|
1338
|
+
// unknown, not rejected.
|
|
1339
|
+
const rejected = failure instanceof ThinRemoteError;
|
|
1340
|
+
// Never sent: it certainly didn't commit.
|
|
1341
|
+
const code = rejected
|
|
1342
|
+
? failure.code
|
|
1343
|
+
: failure instanceof ThinRequestNotSentError
|
|
1344
|
+
? "not_sent"
|
|
1345
|
+
: "outcome_unknown";
|
|
1346
|
+
this.mutationErrorCallback?.({
|
|
1347
|
+
code,
|
|
1348
|
+
reason: failure.message,
|
|
1349
|
+
transaction: {
|
|
1350
|
+
transactionId: txId,
|
|
1351
|
+
kind: "mergeable",
|
|
1352
|
+
sealed: true,
|
|
1353
|
+
latestSettlement: rejected
|
|
1354
|
+
? {
|
|
1355
|
+
kind: "rejected",
|
|
1356
|
+
transactionId: txId,
|
|
1357
|
+
code,
|
|
1358
|
+
reason: failure.message,
|
|
1359
|
+
}
|
|
1360
|
+
: { kind: "missing", transactionId: txId },
|
|
1361
|
+
},
|
|
1362
|
+
});
|
|
1363
|
+
});
|
|
1364
|
+
throw failure;
|
|
1365
|
+
});
|
|
1366
|
+
// An unobserved failure is reported above, not as an unhandled rejection.
|
|
1367
|
+
write.done.catch(() => undefined);
|
|
1368
|
+
this.unanswered++;
|
|
1369
|
+
this.notifySyncStatus();
|
|
1370
|
+
void write.done
|
|
1371
|
+
.catch(() => undefined)
|
|
1372
|
+
.then(() => {
|
|
1373
|
+
write.answered = true;
|
|
1374
|
+
this.unanswered--;
|
|
1375
|
+
this.notifySyncStatus();
|
|
1376
|
+
});
|
|
1377
|
+
write.done.then(() => (write.committed = true), () => undefined);
|
|
1378
|
+
this.writes.set(txId, write);
|
|
1379
|
+
this.pruneWrites();
|
|
1380
|
+
return txId;
|
|
1381
|
+
}
|
|
1382
|
+
/**
|
|
1383
|
+
* Forget the oldest committed writes beyond {@link RETAINED_WRITES}: a
|
|
1384
|
+
* long session makes unboundedly many. A wait on a forgotten write
|
|
1385
|
+
* resolves, as every forgotten write committed.
|
|
1386
|
+
*/
|
|
1387
|
+
pruneWrites() {
|
|
1388
|
+
if (this.writes.size <= RETAINED_WRITES)
|
|
1389
|
+
return;
|
|
1390
|
+
for (const [txId, write] of this.writes) {
|
|
1391
|
+
if (this.writes.size <= RETAINED_WRITES)
|
|
1392
|
+
break;
|
|
1393
|
+
if (write.committed)
|
|
1394
|
+
this.writes.delete(txId);
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
definition(table) {
|
|
1398
|
+
const definition = this.schema[table];
|
|
1399
|
+
if (!definition)
|
|
1400
|
+
throw new Error(`unknown table ${table}`);
|
|
1401
|
+
return definition;
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
/**
|
|
1405
|
+
* The main-branch row `op` writes, if any, to hand off. Not a delete: a read
|
|
1406
|
+
* of a deleted row brings nothing back.
|
|
1407
|
+
*/
|
|
1408
|
+
function writtenRow(context, op) {
|
|
1409
|
+
if (context.branchView || op.type === "delete")
|
|
1410
|
+
return undefined;
|
|
1411
|
+
if (op.type === "insert") {
|
|
1412
|
+
const rowId = op.options.rowId;
|
|
1413
|
+
return rowId ? { table: op.table, id: formatUuid(rowId) } : undefined;
|
|
1414
|
+
}
|
|
1415
|
+
return "row" in op && op.row ? { table: op.table, id: formatUuid(op.row) } : undefined;
|
|
1416
|
+
}
|
|
1417
|
+
/** Write options for a write through a branch view. */
|
|
1418
|
+
function viewOptions(context) {
|
|
1419
|
+
return {
|
|
1420
|
+
head: context.branchView?.head,
|
|
1421
|
+
base: context.branchView?.base,
|
|
1422
|
+
updatedAtMs: context.updatedAtMs,
|
|
1423
|
+
};
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* A writer node marked as bounding its resends to
|
|
1427
|
+
* {@link THIN_WRITE_RESEND_WINDOW_MS} (SPEC 8 §8.14): the tag `jzRB`, then
|
|
1428
|
+
* random bits, as an RFC 9562 version-8 UUID. The authority drops the
|
|
1429
|
+
* dedupe entries of only such a writer's writes; an unmarked node (an
|
|
1430
|
+
* earlier client's, which may resend any time) keeps them.
|
|
1431
|
+
*/
|
|
1432
|
+
/** @internal Exported for its contract test. */
|
|
1433
|
+
export function boundedWriterNode() {
|
|
1434
|
+
const bytes = runtimeRandomBytes(16);
|
|
1435
|
+
bytes.set([0x6a, 0x7a, 0x52, 0x42], 0);
|
|
1436
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x80;
|
|
1437
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
1438
|
+
return bytes;
|
|
1439
|
+
}
|
|
1440
|
+
/** A UUIDv7: a millisecond timestamp, then random bits. */
|
|
1441
|
+
function uuidv7() {
|
|
1442
|
+
const bytes = runtimeRandomBytes(16);
|
|
1443
|
+
const now = Date.now();
|
|
1444
|
+
bytes[0] = Math.floor(now / 2 ** 40) & 0xff;
|
|
1445
|
+
bytes[1] = Math.floor(now / 2 ** 32) & 0xff;
|
|
1446
|
+
bytes[2] = Math.floor(now / 2 ** 24) & 0xff;
|
|
1447
|
+
bytes[3] = Math.floor(now / 2 ** 16) & 0xff;
|
|
1448
|
+
bytes[4] = Math.floor(now / 2 ** 8) & 0xff;
|
|
1449
|
+
bytes[5] = now & 0xff;
|
|
1450
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x70;
|
|
1451
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
1452
|
+
return bytes;
|
|
1453
|
+
}
|
|
1454
|
+
/** The open transaction a request belongs to, if any. */
|
|
1455
|
+
function transactionOf(op) {
|
|
1456
|
+
const transaction = op.transaction;
|
|
1457
|
+
return typeof transaction === "string" ? transaction : undefined;
|
|
1458
|
+
}
|
|
1459
|
+
/** The local refusal of a request past what one takes. */
|
|
1460
|
+
function tooLarge(op, bytes) {
|
|
1461
|
+
return new ThinRemoteError("TooLarge", `this ${op} is ${bytes} bytes, more than the ${MAX_THIN_MESSAGE_BYTES} a thin client ` +
|
|
1462
|
+
`sends in one request: write values that large with insertStreaming or updateStreaming`);
|
|
1463
|
+
}
|
|
1464
|
+
/**
|
|
1465
|
+
* A request its Db's successor serves instead once the Db hands over: a read
|
|
1466
|
+
* outside a transaction (`Db.all` asks the successor again). Writes stay, to
|
|
1467
|
+
* upload, and so does a snapshot capture, which has no such retry.
|
|
1468
|
+
*/
|
|
1469
|
+
function endsAtHandOver(op) {
|
|
1470
|
+
return op.type === "query" && transactionOf(op) === undefined;
|
|
1471
|
+
}
|
|
1472
|
+
function handedOver() {
|
|
1473
|
+
return new ThinRequestNotSentError("the Db handed over to its local-first successor", {
|
|
1474
|
+
cause: new RuntimeClosedError("the thin runtime handed over"),
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
/** The error for a write that may have committed before `cause` ended it. */
|
|
1478
|
+
function unknownOutcome(cause) {
|
|
1479
|
+
return cause instanceof ThinConnectionLostError
|
|
1480
|
+
? cause
|
|
1481
|
+
: new ThinConnectionLostError(`the connection ended before the server answered: ${cause.message}`, { cause });
|
|
1482
|
+
}
|
|
1483
|
+
function resendWindowPassed(oneShot) {
|
|
1484
|
+
return (oneShot.firstSentAt !== undefined &&
|
|
1485
|
+
Date.now() - oneShot.firstSentAt >= THIN_WRITE_RESEND_WINDOW_MS);
|
|
1486
|
+
}
|
|
1487
|
+
/** A write whose answer was lost, past its resend window: it may have
|
|
1488
|
+
* committed, so its fate is unknown. */
|
|
1489
|
+
function resendWindowEnded(cause) {
|
|
1490
|
+
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);
|
|
1491
|
+
}
|
|
1492
|
+
//# sourceMappingURL=thin-runtime.js.map
|