jazz-tools 2.0.0-alpha.60 → 2.0.0-alpha.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/jazz-tools.js +3 -0
- package/dist/_dev/native-account-session.d.ts +8 -1
- package/dist/_dev/native-account-session.d.ts.map +1 -1
- package/dist/_dev/native-account-session.js +10 -0
- package/dist/_dev/native-account-session.js.map +1 -1
- package/dist/accounts/account-manager-core.d.ts +6 -0
- package/dist/accounts/account-manager-core.d.ts.map +1 -1
- package/dist/accounts/account-manager-core.js +26 -2
- package/dist/accounts/account-manager-core.js.map +1 -1
- package/dist/accounts/enrollment.d.ts.map +1 -1
- package/dist/accounts/enrollment.js +11 -4
- package/dist/accounts/enrollment.js.map +1 -1
- package/dist/accounts/exports.d.ts +1 -2
- package/dist/accounts/exports.d.ts.map +1 -1
- package/dist/accounts/exports.js +4 -1
- package/dist/accounts/exports.js.map +1 -1
- package/dist/accounts/persistence.d.ts +8 -0
- package/dist/accounts/persistence.d.ts.map +1 -1
- package/dist/accounts/persistence.js +12 -0
- package/dist/accounts/persistence.js.map +1 -1
- package/dist/accounts/registry-client.d.ts +20 -0
- package/dist/accounts/registry-client.d.ts.map +1 -1
- package/dist/accounts/registry-client.js +34 -0
- package/dist/accounts/registry-client.js.map +1 -1
- package/dist/accounts/state.d.ts.map +1 -1
- package/dist/accounts/state.js +2 -1
- package/dist/accounts/state.js.map +1 -1
- package/dist/backend/create-jazz-session.d.ts +9 -7
- package/dist/backend/create-jazz-session.d.ts.map +1 -1
- package/dist/backend/create-jazz-session.js +55 -17
- package/dist/backend/create-jazz-session.js.map +1 -1
- package/dist/backend/create-jazz.d.ts +122 -34
- package/dist/backend/create-jazz.d.ts.map +1 -1
- package/dist/backend/create-jazz.js +396 -101
- package/dist/backend/create-jazz.js.map +1 -1
- package/dist/backend/early-db.d.ts.map +1 -1
- package/dist/backend/early-db.js +1 -0
- package/dist/backend/early-db.js.map +1 -1
- package/dist/backend/from-jwt.d.ts +2 -2
- package/dist/backend/from-jwt.d.ts.map +1 -1
- package/dist/backend/from-jwt.js +7 -1
- package/dist/backend/from-jwt.js.map +1 -1
- package/dist/backend/index.d.ts +2 -1
- package/dist/backend/index.d.ts.map +1 -1
- package/dist/backend/index.js +3 -1
- 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 +129 -0
- package/dist/backend/inspect.d.ts.map +1 -0
- package/dist/backend/inspect.js +763 -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/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 +25 -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/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-sockets.d.ts +16 -0
- package/dist/backend/vercel-sockets.d.ts.map +1 -0
- package/dist/backend/vercel-sockets.js +24 -0
- package/dist/backend/vercel-sockets.js.map +1 -0
- package/dist/backend/vercel-store.d.ts.map +1 -1
- package/dist/backend/vercel-store.js +77 -10
- package/dist/backend/vercel-store.js.map +1 -1
- package/dist/classic-api.d.ts.map +1 -1
- package/dist/classic-api.js +36 -0
- package/dist/classic-api.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +30 -2
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +2 -6
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -3
- package/dist/client/index.js.map +1 -1
- package/dist/cloud/credentials.d.ts +1 -1
- package/dist/cloud/credentials.d.ts.map +1 -1
- package/dist/cloud/credentials.js.map +1 -1
- package/dist/dev/catalogue.d.ts +12 -0
- package/dist/dev/catalogue.d.ts.map +1 -1
- package/dist/dev/catalogue.js +31 -0
- package/dist/dev/catalogue.js.map +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/backend-DHeT1LCS.css +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/backend-Dt5FYVfX.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/{create-legacy-browser-delegate-X_T_QKCN.js → create-legacy-browser-delegate-Bf58kV5i.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/esm-BQhYkCKN.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/{esm-aRzpnC3u.js → esm-CI6IodCN.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/{esm-ezD5H765.js → esm-D5aLlEYl.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/{esm-7mP3GQX4.js → esm-D_R-EGgt.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/{esm-BX6IY2Mv.js → esm-WihpI9g6.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/index-CjhxdwQ7.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/jazz-broker-worker-CaVlHITU.js +3 -0
- package/dist/dev/inspector-overlay/embedded/assets/{jazz-broker-worker-XRRxJUcx.js → jazz-broker-worker-D-HQuhdu.js} +160 -557
- package/dist/dev/inspector-overlay/embedded/assets/jazz_wasm-t1Mm3faf.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm_bg-KR7h3v27.wasm → jazz_wasm_bg-BazWJnU4.wasm} +0 -0
- package/dist/dev/inspector-overlay/embedded/assets/{index-C78Pprka.css → src-Cq8gSOLx.css} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/src-Dg6641Mj.js +22 -0
- package/dist/dev/inspector-overlay/embedded/assets/{trace-api-B5CaetI0.js → trace-api-BctnwbUf.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/backend.html +16 -0
- package/dist/dev/inspector-overlay/embedded/embedded.html +3 -2
- package/dist/dev/inspector-overlay/host-bridge.d.ts.map +1 -1
- package/dist/dev/inspector-overlay/host-bridge.js +4 -1
- package/dist/dev/inspector-overlay/host-bridge.js.map +1 -1
- package/dist/dev/inspector-overlay/loader.d.ts +12 -1
- package/dist/dev/inspector-overlay/loader.d.ts.map +1 -1
- package/dist/dev/inspector-overlay/loader.js +31 -4
- package/dist/dev/inspector-overlay/loader.js.map +1 -1
- package/dist/drivers/schema-wire.d.ts +6 -2
- package/dist/drivers/schema-wire.d.ts.map +1 -1
- package/dist/drivers/schema-wire.js +6 -2
- package/dist/drivers/schema-wire.js.map +1 -1
- package/dist/effect/jazz.d.ts +12 -5
- package/dist/effect/jazz.d.ts.map +1 -1
- package/dist/effect/jazz.js +28 -5
- package/dist/effect/jazz.js.map +1 -1
- package/dist/expo/create-account-manager.d.ts +1 -1
- package/dist/expo/create-account-manager.d.ts.map +1 -1
- package/dist/expo/create-jazz-session.d.ts +37 -17
- package/dist/expo/create-jazz-session.d.ts.map +1 -1
- package/dist/expo/create-jazz-session.js +49 -10
- package/dist/expo/create-jazz-session.js.map +1 -1
- package/dist/expo/index.d.ts +5 -8
- package/dist/expo/index.d.ts.map +1 -1
- package/dist/expo/index.js +5 -7
- package/dist/expo/index.js.map +1 -1
- package/dist/expo/provider.d.ts +6 -3
- package/dist/expo/provider.d.ts.map +1 -1
- package/dist/expo/provider.js +7 -6
- package/dist/expo/provider.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- 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 +292 -0
- package/dist/inspect/cli.js.map +1 -0
- package/dist/inspect/client.d.ts +60 -0
- package/dist/inspect/client.d.ts.map +1 -0
- package/dist/inspect/client.js +241 -0
- package/dist/inspect/client.js.map +1 -0
- package/dist/inspect/mcp.d.ts +17 -0
- package/dist/inspect/mcp.d.ts.map +1 -0
- package/dist/inspect/mcp.js +308 -0
- package/dist/inspect/mcp.js.map +1 -0
- package/dist/inspect/protocol.d.ts +218 -0
- package/dist/inspect/protocol.d.ts.map +1 -0
- package/dist/inspect/protocol.js +357 -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/migrations.d.ts +1 -1
- package/dist/migrations.js +1 -1
- package/dist/migrations.js.map +1 -1
- package/dist/react/index.d.ts +4 -9
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +4 -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 +9 -15
- package/dist/react/provider.d.ts.map +1 -1
- package/dist/react/provider.js +19 -38
- package/dist/react/provider.js.map +1 -1
- package/dist/react-core/index.d.ts +3 -4
- package/dist/react-core/index.d.ts.map +1 -1
- package/dist/react-core/index.js +8 -4
- package/dist/react-core/index.js.map +1 -1
- package/dist/react-core/provider.d.ts +6 -6
- package/dist/react-core/provider.d.ts.map +1 -1
- package/dist/react-core/provider.js +5 -6
- package/dist/react-core/provider.js.map +1 -1
- package/dist/react-core/session.d.ts +41 -33
- package/dist/react-core/session.d.ts.map +1 -1
- package/dist/react-core/session.js +41 -89
- package/dist/react-core/session.js.map +1 -1
- package/dist/react-native/account-session.js +1 -1
- package/dist/react-native/account-session.js.map +1 -1
- package/dist/react-native/create-account-manager.d.ts +1 -1
- package/dist/react-native/create-account-manager.d.ts.map +1 -1
- package/dist/react-native/create-jazz-session.d.ts +37 -17
- package/dist/react-native/create-jazz-session.d.ts.map +1 -1
- package/dist/react-native/create-jazz-session.js +49 -10
- package/dist/react-native/create-jazz-session.js.map +1 -1
- package/dist/react-native/index.d.ts +5 -10
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +5 -7
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/native-foreground-db.d.ts +7 -0
- package/dist/react-native/native-foreground-db.d.ts.map +1 -1
- package/dist/react-native/native-foreground-db.js +29 -0
- package/dist/react-native/native-foreground-db.js.map +1 -1
- package/dist/react-native/provider.d.ts +14 -19
- package/dist/react-native/provider.d.ts.map +1 -1
- package/dist/react-native/provider.js +19 -18
- package/dist/react-native/provider.js.map +1 -1
- package/dist/react-native/runtime-source.js +1 -1
- package/dist/react-native/runtime-source.js.map +1 -1
- package/dist/removed-api.d.ts +87 -0
- package/dist/removed-api.d.ts.map +1 -0
- package/dist/removed-api.js +95 -0
- package/dist/removed-api.js.map +1 -0
- package/dist/runtime/auth-secret-store.d.ts +0 -44
- package/dist/runtime/auth-secret-store.d.ts.map +1 -1
- package/dist/runtime/auth-secret-store.js +1 -103
- package/dist/runtime/auth-secret-store.js.map +1 -1
- package/dist/runtime/client.d.ts +10 -4
- package/dist/runtime/client.d.ts.map +1 -1
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/connection-manager/browser-connection-manager.d.ts +4 -1
- package/dist/runtime/connection-manager/browser-connection-manager.d.ts.map +1 -1
- package/dist/runtime/connection-manager/browser-connection-manager.js +33 -2
- package/dist/runtime/connection-manager/browser-connection-manager.js.map +1 -1
- package/dist/runtime/connection-manager/types.d.ts +17 -2
- package/dist/runtime/connection-manager/types.d.ts.map +1 -1
- package/dist/runtime/connection-manager/types.js +19 -5
- package/dist/runtime/connection-manager/types.js.map +1 -1
- package/dist/runtime/credentialed-transport.d.ts +5 -2
- package/dist/runtime/credentialed-transport.d.ts.map +1 -1
- package/dist/runtime/credentialed-transport.js +12 -3
- package/dist/runtime/credentialed-transport.js.map +1 -1
- package/dist/runtime/db-replaced-error.d.ts +3 -1
- package/dist/runtime/db-replaced-error.d.ts.map +1 -1
- package/dist/runtime/db-replaced-error.js +4 -2
- package/dist/runtime/db-replaced-error.js.map +1 -1
- package/dist/runtime/db.d.ts +35 -7
- package/dist/runtime/db.d.ts.map +1 -1
- package/dist/runtime/db.js +65 -9
- package/dist/runtime/db.js.map +1 -1
- package/dist/runtime/index.d.ts +3 -4
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -2
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.d.ts +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.js +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.js.map +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.d.ts +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.js +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.js.map +1 -1
- package/dist/runtime/native-artifact-fingerprints.d.ts +2 -2
- package/dist/runtime/native-runtime/attached-browser-worker-connection.d.ts +3 -1
- package/dist/runtime/native-runtime/attached-browser-worker-connection.d.ts.map +1 -1
- package/dist/runtime/native-runtime/attached-browser-worker-connection.js.map +1 -1
- package/dist/runtime/native-runtime/broker-worker-load-failure.d.ts +31 -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 +66 -0
- package/dist/runtime/native-runtime/broker-worker-load-failure.js.map +1 -0
- package/dist/runtime/native-runtime/browser-follower-connection.d.ts +5 -1
- package/dist/runtime/native-runtime/browser-follower-connection.d.ts.map +1 -1
- package/dist/runtime/native-runtime/browser-follower-connection.js +4 -3
- package/dist/runtime/native-runtime/browser-follower-connection.js.map +1 -1
- package/dist/runtime/native-runtime/browser-shared-worker-connection.d.ts +3 -1
- package/dist/runtime/native-runtime/browser-shared-worker-connection.d.ts.map +1 -1
- package/dist/runtime/native-runtime/browser-shared-worker-connection.js +55 -4
- package/dist/runtime/native-runtime/browser-shared-worker-connection.js.map +1 -1
- package/dist/runtime/native-runtime/browser-worker-protocol.d.ts +5 -0
- package/dist/runtime/native-runtime/browser-worker-protocol.d.ts.map +1 -1
- package/dist/runtime/native-runtime/browser-worker-protocol.js.map +1 -1
- package/dist/runtime/native-runtime/http-stream-socket.d.ts +25 -7
- package/dist/runtime/native-runtime/http-stream-socket.d.ts.map +1 -1
- package/dist/runtime/native-runtime/http-stream-socket.js +56 -29
- package/dist/runtime/native-runtime/http-stream-socket.js.map +1 -1
- package/dist/runtime/native-runtime/native-runtime-adapter.d.ts +13 -5
- package/dist/runtime/native-runtime/native-runtime-adapter.d.ts.map +1 -1
- package/dist/runtime/native-runtime/native-runtime-adapter.js +38 -10
- package/dist/runtime/native-runtime/native-runtime-adapter.js.map +1 -1
- package/dist/runtime/native-runtime/websocket.d.ts +13 -0
- package/dist/runtime/native-runtime/websocket.d.ts.map +1 -1
- package/dist/runtime/native-runtime/websocket.js +23 -4
- package/dist/runtime/native-runtime/websocket.js.map +1 -1
- package/dist/runtime/page-handle.d.ts +87 -0
- package/dist/runtime/page-handle.d.ts.map +1 -0
- package/dist/runtime/page-handle.js +144 -0
- package/dist/runtime/page-handle.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/runtime-source.d.ts +4 -1
- package/dist/runtime/runtime-source.d.ts.map +1 -1
- package/dist/runtime/runtime-source.js.map +1 -1
- package/dist/runtime/store-held-by-another-tab-error.d.ts +11 -0
- package/dist/runtime/store-held-by-another-tab-error.d.ts.map +1 -1
- package/dist/runtime/store-held-by-another-tab-error.js +11 -0
- package/dist/runtime/store-held-by-another-tab-error.js.map +1 -1
- package/dist/runtime/sync-status.d.ts +60 -1
- package/dist/runtime/sync-status.d.ts.map +1 -1
- package/dist/runtime/sync-status.js +64 -4
- package/dist/runtime/sync-status.js.map +1 -1
- package/dist/session/backend-watch.d.ts +53 -14
- package/dist/session/backend-watch.d.ts.map +1 -1
- package/dist/session/backend-watch.js +99 -22
- package/dist/session/backend-watch.js.map +1 -1
- 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 +1 -1
- package/dist/session/consumer.js +1 -1
- package/dist/session/consumer.js.map +1 -1
- package/dist/session/create-jazz-session.d.ts +57 -21
- package/dist/session/create-jazz-session.d.ts.map +1 -1
- package/dist/session/create-jazz-session.js +257 -58
- package/dist/session/create-jazz-session.js.map +1 -1
- package/dist/session/follow-user.d.ts +17 -7
- package/dist/session/follow-user.d.ts.map +1 -1
- package/dist/session/follow-user.js +23 -2
- package/dist/session/follow-user.js.map +1 -1
- package/dist/session/jazz-session.d.ts +164 -0
- package/dist/session/jazz-session.d.ts.map +1 -0
- package/dist/session/jazz-session.js +432 -0
- package/dist/session/jazz-session.js.map +1 -0
- package/dist/session/left-behind-replicas.d.ts +8 -1
- package/dist/session/left-behind-replicas.d.ts.map +1 -1
- package/dist/session/left-behind-replicas.js +21 -4
- package/dist/session/left-behind-replicas.js.map +1 -1
- package/dist/session/state.d.ts +20 -13
- package/dist/session/state.d.ts.map +1 -1
- package/dist/session/state.js +68 -23
- package/dist/session/state.js.map +1 -1
- package/dist/solid/index.d.ts +3 -9
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.js +8 -11
- package/dist/solid/index.ssr.js +3 -6
- package/dist/solid/provider.d.ts +3 -3
- package/dist/solid/provider.d.ts.map +1 -1
- package/dist/solid/provider.js +23 -39
- package/dist/solid/provider.js.map +1 -1
- package/dist/solid/provider.ssr.js +6 -23
- package/dist/solid/provider.ssr.js.map +1 -1
- package/dist/solid/session.d.ts +42 -12
- package/dist/solid/session.d.ts.map +1 -1
- package/dist/solid/session.js +82 -35
- package/dist/solid/session.js.map +1 -1
- package/dist/solid/session.ssr.js +85 -22
- package/dist/solid/session.ssr.js.map +1 -1
- package/dist/svelte/JazzProvider.svelte +54 -20
- package/dist/svelte/JazzProvider.svelte.d.ts +14 -4
- package/dist/svelte/JazzProvider.svelte.d.ts.map +1 -1
- package/dist/svelte/JazzSvelteClientProvider.svelte +1 -7
- package/dist/svelte/JazzSvelteClientProvider.svelte.d.ts +0 -1
- package/dist/svelte/JazzSvelteClientProvider.svelte.d.ts.map +1 -1
- package/dist/svelte/JazzSvelteProvider.svelte +5 -4
- package/dist/svelte/JazzSvelteProvider.svelte.d.ts +2 -2
- package/dist/svelte/JazzSvelteProvider.svelte.d.ts.map +1 -1
- package/dist/svelte/index.d.ts +4 -12
- package/dist/svelte/index.d.ts.map +1 -1
- package/dist/svelte/index.js +4 -8
- package/dist/svelte/session-state.d.ts +14 -4
- package/dist/svelte/session-state.d.ts.map +1 -1
- package/dist/svelte/session-state.js +10 -4
- package/dist/testing/policy-test-app.d.ts.map +1 -1
- package/dist/testing/policy-test-app.js +5 -4
- package/dist/testing/policy-test-app.js.map +1 -1
- package/dist/testing/test-jazz.d.ts +2 -2
- package/dist/testing/test-jazz.d.ts.map +1 -1
- package/dist/testing/test-jazz.js +5 -2
- package/dist/testing/test-jazz.js.map +1 -1
- package/dist/thin/index.d.ts +7 -10
- package/dist/thin/index.d.ts.map +1 -1
- package/dist/thin/index.js +28 -11
- package/dist/thin/index.js.map +1 -1
- package/dist/thin/thin-runtime.d.ts +22 -2
- package/dist/thin/thin-runtime.d.ts.map +1 -1
- package/dist/thin/thin-runtime.js +157 -24
- package/dist/thin/thin-runtime.js.map +1 -1
- package/dist/vue/index.d.ts +3 -8
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +3 -5
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/provider.d.ts +6 -27
- package/dist/vue/provider.d.ts.map +1 -1
- package/dist/vue/provider.js +10 -19
- package/dist/vue/provider.js.map +1 -1
- package/dist/vue/session.d.ts +29 -28
- package/dist/vue/session.d.ts.map +1 -1
- package/dist/vue/session.js +79 -22
- package/dist/vue/session.js.map +1 -1
- package/dist/window-client-storage.d.ts +4 -30
- package/dist/window-client-storage.d.ts.map +1 -1
- package/dist/window-client-storage.js +2 -63
- package/dist/window-client-storage.js.map +1 -1
- package/dist/worker/jazz-broker-worker-core.d.ts.map +1 -1
- package/dist/worker/jazz-broker-worker-core.js +16 -19
- package/dist/worker/jazz-broker-worker-core.js.map +1 -1
- package/dist/worker/jazz-broker-worker.js +160 -557
- package/dist/worker/jazz_wasm_bg.wasm +0 -0
- package/dist/worker/runtime-admission.d.ts +19 -0
- package/dist/worker/runtime-admission.d.ts.map +1 -0
- package/dist/worker/runtime-admission.js +34 -0
- package/dist/worker/runtime-admission.js.map +1 -0
- package/package.json +18 -5
- package/dist/backend/session-recheck.d.ts +0 -18
- package/dist/backend/session-recheck.d.ts.map +0 -1
- package/dist/backend/session-recheck.js +0 -57
- package/dist/backend/session-recheck.js.map +0 -1
- package/dist/dev/inspector-overlay/embedded/assets/esm-k3rsq4Gn.js +0 -1
- package/dist/dev/inspector-overlay/embedded/assets/index-C-btvLcw.js +0 -20
- package/dist/dev/inspector-overlay/embedded/assets/jazz-broker-worker-CAMcDeUa.js +0 -3
- package/dist/dev/inspector-overlay/embedded/assets/jazz_wasm-Cc71x_6y.js +0 -1
- package/dist/dev/inspector-overlay/serve.d.ts +0 -46
- package/dist/dev/inspector-overlay/serve.d.ts.map +0 -1
- package/dist/dev/inspector-overlay/serve.js +0 -131
- package/dist/dev/inspector-overlay/serve.js.map +0 -1
- package/dist/dev-tools/auto-attach.d.ts +0 -11
- package/dist/dev-tools/auto-attach.d.ts.map +0 -1
- package/dist/dev-tools/auto-attach.js +0 -26
- package/dist/dev-tools/auto-attach.js.map +0 -1
- package/dist/expo/auth-secret-store.d.ts +0 -37
- package/dist/expo/auth-secret-store.d.ts.map +0 -1
- package/dist/expo/auth-secret-store.js +0 -139
- package/dist/expo/auth-secret-store.js.map +0 -1
- package/dist/expo/session.d.ts +0 -10
- package/dist/expo/session.d.ts.map +0 -1
- package/dist/expo/session.js +0 -5
- package/dist/expo/session.js.map +0 -1
- package/dist/expo/use-local-first-auth.d.ts +0 -12
- package/dist/expo/use-local-first-auth.d.ts.map +0 -1
- package/dist/expo/use-local-first-auth.js +0 -13
- package/dist/expo/use-local-first-auth.js.map +0 -1
- package/dist/react/devtools-auto-attach.d.ts +0 -2
- package/dist/react/devtools-auto-attach.d.ts.map +0 -1
- package/dist/react/devtools-auto-attach.js +0 -11
- package/dist/react/devtools-auto-attach.js.map +0 -1
- package/dist/react/session.d.ts +0 -18
- package/dist/react/session.d.ts.map +0 -1
- package/dist/react/session.js +0 -28
- package/dist/react/session.js.map +0 -1
- package/dist/react/use-local-first-auth.d.ts +0 -11
- package/dist/react/use-local-first-auth.d.ts.map +0 -1
- package/dist/react/use-local-first-auth.js +0 -13
- package/dist/react/use-local-first-auth.js.map +0 -1
- package/dist/react-core/app.d.ts +0 -31
- package/dist/react-core/app.d.ts.map +0 -1
- package/dist/react-core/app.js +0 -65
- package/dist/react-core/app.js.map +0 -1
- package/dist/react-core/use-account-state.d.ts +0 -4
- package/dist/react-core/use-account-state.d.ts.map +0 -1
- package/dist/react-core/use-account-state.js +0 -6
- package/dist/react-core/use-account-state.js.map +0 -1
- package/dist/react-core/use-local-first-auth.d.ts +0 -12
- package/dist/react-core/use-local-first-auth.d.ts.map +0 -1
- package/dist/react-core/use-local-first-auth.js +0 -14
- package/dist/react-core/use-local-first-auth.js.map +0 -1
- package/dist/react-native/session.d.ts +0 -10
- package/dist/react-native/session.d.ts.map +0 -1
- package/dist/react-native/session.js +0 -5
- package/dist/react-native/session.js.map +0 -1
- package/dist/react-native/use-local-first-auth.d.ts +0 -15
- package/dist/react-native/use-local-first-auth.d.ts.map +0 -1
- package/dist/react-native/use-local-first-auth.js +0 -14
- package/dist/react-native/use-local-first-auth.js.map +0 -1
- package/dist/runtime/local-first-auth-controller.d.ts +0 -29
- package/dist/runtime/local-first-auth-controller.d.ts.map +0 -1
- package/dist/runtime/local-first-auth-controller.js +0 -101
- package/dist/runtime/local-first-auth-controller.js.map +0 -1
- package/dist/session/app.d.ts +0 -58
- package/dist/session/app.d.ts.map +0 -1
- package/dist/session/app.js +0 -325
- package/dist/session/app.js.map +0 -1
- package/dist/session/create-jazz-app.d.ts +0 -11
- package/dist/session/create-jazz-app.d.ts.map +0 -1
- package/dist/session/create-jazz-app.js +0 -11
- package/dist/session/create-jazz-app.js.map +0 -1
- package/dist/solid/app.d.ts +0 -30
- package/dist/solid/app.d.ts.map +0 -1
- package/dist/solid/app.js +0 -95
- package/dist/solid/app.js.map +0 -1
- package/dist/solid/app.ssr.js +0 -109
- package/dist/solid/app.ssr.js.map +0 -1
- package/dist/solid/create-account-state.d.ts +0 -4
- package/dist/solid/create-account-state.d.ts.map +0 -1
- package/dist/solid/create-account-state.js +0 -10
- package/dist/solid/create-account-state.js.map +0 -1
- package/dist/solid/create-account-state.ssr.js +0 -12
- package/dist/solid/create-account-state.ssr.js.map +0 -1
- package/dist/solid/use-local-first-auth.d.ts +0 -11
- package/dist/solid/use-local-first-auth.d.ts.map +0 -1
- package/dist/solid/use-local-first-auth.js +0 -30
- package/dist/solid/use-local-first-auth.js.map +0 -1
- package/dist/solid/use-local-first-auth.ssr.js +0 -31
- package/dist/solid/use-local-first-auth.ssr.js.map +0 -1
- package/dist/svelte/JazzSessionClientProvider.svelte +0 -42
- package/dist/svelte/JazzSessionClientProvider.svelte.d.ts +0 -13
- package/dist/svelte/JazzSessionClientProvider.svelte.d.ts.map +0 -1
- package/dist/svelte/JazzSessionProvider.svelte +0 -68
- package/dist/svelte/JazzSessionProvider.svelte.d.ts +0 -19
- package/dist/svelte/JazzSessionProvider.svelte.d.ts.map +0 -1
- package/dist/svelte/account-state.d.ts +0 -5
- package/dist/svelte/account-state.d.ts.map +0 -1
- package/dist/svelte/account-state.js +0 -9
- package/dist/svelte/auth-state.d.ts +0 -23
- package/dist/svelte/auth-state.d.ts.map +0 -1
- package/dist/svelte/auth-state.js +0 -16
- package/dist/svelte/local-first-auth.svelte.d.ts +0 -50
- package/dist/svelte/local-first-auth.svelte.d.ts.map +0 -1
- package/dist/svelte/local-first-auth.svelte.js +0 -58
- package/dist/vue/app.d.ts +0 -76
- package/dist/vue/app.d.ts.map +0 -1
- package/dist/vue/app.js +0 -100
- package/dist/vue/app.js.map +0 -1
- package/dist/vue/use-account-state.d.ts +0 -5
- package/dist/vue/use-account-state.d.ts.map +0 -1
- package/dist/vue/use-account-state.js +0 -10
- package/dist/vue/use-account-state.js.map +0 -1
- package/dist/vue/use-local-first-auth.d.ts +0 -53
- package/dist/vue/use-local-first-auth.d.ts.map +0 -1
- package/dist/vue/use-local-first-auth.js +0 -67
- package/dist/vue/use-local-first-auth.js.map +0 -1
- /package/dist/dev/inspector-overlay/embedded/assets/{esm-CH5eVyQQ.js → esm-xNe3wI_B.js} +0 -0
- /package/dist/dev/inspector-overlay/embedded/assets/{node-foreground-node-lease.browser-Bm3gYjlT.js → node-foreground-node-lease.browser-CH8w-D6S.js} +0 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { SignedOutDecision } from "./backend-watch.js";
|
|
1
2
|
import type { AccountManagerConfig } from "../accounts/create-account-manager.js";
|
|
2
3
|
import { type JazzClient } from "../web/registered-jazz-client.js";
|
|
3
4
|
import type { OpenJazzClientConfig } from "../web/create-jazz-client.js";
|
|
4
5
|
import { type LocalFirstLoader } from "../runtime/local-first-upgrade.js";
|
|
6
|
+
import { type JazzSession } from "./jazz-session.js";
|
|
5
7
|
import { type UserFollowingSession } from "./follow-user.js";
|
|
6
8
|
export type { LocalFirstLoader };
|
|
7
9
|
export type JazzClientConfig = Omit<OpenJazzClientConfig, "account" | "serverUrl" | "appId"> & Omit<AccountManagerConfig, "appId"> & {
|
|
@@ -15,31 +17,42 @@ export type JazzClientConfig = Omit<OpenJazzClientConfig, "account" | "serverUrl
|
|
|
15
17
|
/**
|
|
16
18
|
* Your app's Jazz endpoint: by default `"/jazz"`, where `createJazz` is
|
|
17
19
|
* mounted in your own backend. `null` keeps Jazz on this device only: no
|
|
18
|
-
* server, no sign-in, one
|
|
19
|
-
*
|
|
20
|
+
* server, no sign-in, one device account per browser profile. That needs
|
|
21
|
+
* the local-first client (`client`).
|
|
20
22
|
*/
|
|
21
23
|
serverUrl?: string | null;
|
|
22
24
|
/**
|
|
23
25
|
* Who the app starts as before your backend names a user: signed out
|
|
24
|
-
* (the default, also `"signed-out"`), or a `"
|
|
25
|
-
* account on this device
|
|
26
|
-
*
|
|
27
|
-
* (`
|
|
28
|
-
*
|
|
26
|
+
* (the default, also `"signed-out"`), or a `"device"` account: an
|
|
27
|
+
* account whose key lives on this device, which is how you let people
|
|
28
|
+
* start as guests, and which can later link to your backend's user
|
|
29
|
+
* (`linkDeviceAccount()`). Your backend must accept device accounts
|
|
30
|
+
* (`acceptDeviceAccounts`). A device account works offline once its
|
|
31
|
+
* client is the local-first one (`client`).
|
|
29
32
|
*/
|
|
30
|
-
initial?: "
|
|
33
|
+
initial?: "device" | "signed-out";
|
|
31
34
|
/**
|
|
32
|
-
* When a
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* the account and everything
|
|
36
|
-
* default. Turn it off on shared devices, where the
|
|
37
|
-
* else's: the session then leaves
|
|
38
|
-
* decides after its own sign-in, with `
|
|
39
|
-
*
|
|
40
|
-
*
|
|
35
|
+
* When a device account is on this device and the user who signs in has
|
|
36
|
+
* no Jazz account yet (they just signed up, or they are an existing user
|
|
37
|
+
* signing in to Jazz for the first time), link the device account to
|
|
38
|
+
* them: the account and everything it wrote become theirs. On by
|
|
39
|
+
* default. Turn it off on shared devices, where the device account may be
|
|
40
|
+
* someone else's guest: the session then leaves it as it is, and your
|
|
41
|
+
* app decides after its own sign-in, with `linkDeviceAccount()` (its data
|
|
42
|
+
* becomes the user's) or `refresh()` (an account of the user's own; the
|
|
43
|
+
* device account stays on this device).
|
|
41
44
|
*/
|
|
42
|
-
|
|
45
|
+
linkDeviceAccountOnSignUp?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Called when your backend says no one is signed in any more (confirmed
|
|
48
|
+
* by a second answer a moment later), before the session signs the
|
|
49
|
+
* user out. Return `"keep"` to stay signed in for now (your app refreshed
|
|
50
|
+
* its session itself, or redirects to sign-in first): the session asks
|
|
51
|
+
* your backend again on the next focus, refusal or `refresh()`.
|
|
52
|
+
* Return `"sign-out"` (or nothing) to sign out. A hook that throws signs
|
|
53
|
+
* out.
|
|
54
|
+
*/
|
|
55
|
+
onSignedOut?: () => SignedOutDecision | void | Promise<SignedOutDecision | void>;
|
|
43
56
|
/**
|
|
44
57
|
* On sign-out (or a switch to another user), wipe the account's local
|
|
45
58
|
* storage instead of keeping it for that user's next sign-in. For shared
|
|
@@ -60,9 +73,32 @@ export type JazzClientConfig = Omit<OpenJazzClientConfig, "account" | "serverUrl
|
|
|
60
73
|
* away, so it works offline.
|
|
61
74
|
*/
|
|
62
75
|
client?: LocalFirstLoader;
|
|
76
|
+
/**
|
|
77
|
+
* When the local-first client (`client`) opens:
|
|
78
|
+
* - `"background"` (the default): start thin and upgrade once the page
|
|
79
|
+
* has loaded, unless this account upgraded in this browser before.
|
|
80
|
+
* The first paint needs no WASM.
|
|
81
|
+
* - `"now"`: open the local-first client straight away, for every
|
|
82
|
+
* account. For apps that must work offline from the first render, or
|
|
83
|
+
* that use `db.transaction`, which only the local-first client has.
|
|
84
|
+
* If the local-first client can't load, the session fails (`retry()`
|
|
85
|
+
* tries again) rather than running thin.
|
|
86
|
+
*
|
|
87
|
+
* Needs `client`: `"now"` without it is refused.
|
|
88
|
+
*/
|
|
89
|
+
localFirst?: "now" | "background";
|
|
63
90
|
};
|
|
64
|
-
/** A browser's
|
|
91
|
+
/** @internal A browser session's core, which follows your auth's signed-in user. */
|
|
65
92
|
export type BrowserJazzSession = UserFollowingSession<JazzClient>;
|
|
66
|
-
/**
|
|
67
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Open a Jazz session in this browser: who is signed in, and the client that
|
|
95
|
+
* reads and writes as them. Resolves once it started; rejects if it can't.
|
|
96
|
+
* Your backend decides who is signed in; call `session.refresh()` after your
|
|
97
|
+
* own sign-in or sign-out.
|
|
98
|
+
*/
|
|
99
|
+
export declare function createJazzClient(config: JazzClientConfig): Promise<JazzSession<JazzClient>>;
|
|
100
|
+
/** @internal The session core `createJazzClient` and `<JazzProvider>` own. */
|
|
101
|
+
export declare function openBrowserSessionCore(config: JazzClientConfig): Promise<BrowserJazzSession>;
|
|
102
|
+
/** How often a page tries again a sign-out's wipe that another tab held off. */
|
|
103
|
+
export declare const WIPE_RETRY_MS = 15000;
|
|
68
104
|
//# sourceMappingURL=create-jazz-session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-jazz-session.d.ts","sourceRoot":"","sources":["../../src/session/create-jazz-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"create-jazz-session.d.ts","sourceRoot":"","sources":["../../src/session/create-jazz-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAUlF,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAOzE,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAyC,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG5F,OAAO,EAKL,KAAK,oBAAoB,EAC1B,MAAM,kBAAkB,CAAC;AAe1B,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC,GAC1F,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,GAAG;IACpC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IAClC;;;;;;;;;;OAUG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,MAAM,iBAAiB,GAAG,IAAI,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IACjF;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,EAAE,KAAK,GAAG,YAAY,CAAC;CACnC,CAAC;AA8BJ,oFAAoF;AACpF,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;AAgClE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAE3F;AAED,8EAA8E;AAC9E,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,kBAAkB,CAAC,CA2Z7B;AAMD,gFAAgF;AAChF,eAAO,MAAM,aAAa,QAAS,CAAC"}
|
|
@@ -1,15 +1,46 @@
|
|
|
1
|
-
import { clientRegistryUrl, createAccountManagerWithMinter, } from "../accounts/account-manager-core.js";
|
|
1
|
+
import { clientRegistryUrl, createAccountManagerWithMinter, watchStoredSelection, } from "../accounts/account-manager-core.js";
|
|
2
2
|
import { attachSubscriptionStore, getSubscriptionStore } from "../subscription-store-internal.js";
|
|
3
3
|
import { bearerFetch } from "../runtime/credentialed-transport.js";
|
|
4
4
|
import { createRegisteredJazzClient, } from "../web/registered-jazz-client.js";
|
|
5
5
|
import { createClient as createThinDb, mintLocalFirstTokenInJs, prefetchThinQueries, handOffThinWrites, } from "../thin/index.js";
|
|
6
6
|
import { setLocalFirstUpgrader, } from "../runtime/local-first-upgrade.js";
|
|
7
7
|
import { createJazzSessionOwner, replaceJazzSessionClient } from "./state.js";
|
|
8
|
+
import { coreInitial, createStartedJazzSession } from "./jazz-session.js";
|
|
8
9
|
import { DEFAULT_SERVER_URL, refuseClientAppId } from "../runtime/client-scope.js";
|
|
9
10
|
import { browserBackendWatchEvents } from "./backend-watch.js";
|
|
10
11
|
import { backendAnswered, firstBackendAnswer, followUser, signedInIdentity, } from "./follow-user.js";
|
|
11
|
-
import { holdReplica, leftBehindReplicas, whileNoTabHolds, wipeLeftBehindReplicas, } from "./left-behind-replicas.js";
|
|
12
|
+
import { holdReplica, leftBehindReplicas, whileNoTabHolds, wipeLeftBehindReplicas, replicaHeld, WIPE_TIMEOUT_MS, } from "./left-behind-replicas.js";
|
|
13
|
+
import { refuseInvalidSessionConfig } from "./config-options.js";
|
|
14
|
+
import { refuseWindowJazzConflict } from "../runtime/page-handle.js";
|
|
15
|
+
import { accountForgotten } from "../accounts/persistence.js";
|
|
12
16
|
import { rememberBackendUser } from "../accounts/enrollment.js";
|
|
17
|
+
/**
|
|
18
|
+
* Every option `createJazzClient` takes in a browser, checked against the
|
|
19
|
+
* config type both ways (`appId` and `backendSecret` are refused by type, and
|
|
20
|
+
* `appId` by name too).
|
|
21
|
+
*/
|
|
22
|
+
const BROWSER_SESSION_OPTIONS = {
|
|
23
|
+
serverUrl: true,
|
|
24
|
+
initial: true,
|
|
25
|
+
linkDeviceAccountOnSignUp: true,
|
|
26
|
+
onSignedOut: true,
|
|
27
|
+
clearOnSignOut: true,
|
|
28
|
+
client: true,
|
|
29
|
+
localFirst: true,
|
|
30
|
+
scope: true,
|
|
31
|
+
driver: true,
|
|
32
|
+
env: true,
|
|
33
|
+
runtimeSources: true,
|
|
34
|
+
dbName: true,
|
|
35
|
+
initialSyncFlushEvery: true,
|
|
36
|
+
logLevel: true,
|
|
37
|
+
telemetryCollectorUrl: true,
|
|
38
|
+
devMode: true,
|
|
39
|
+
slowQueryThresholdMs: true,
|
|
40
|
+
store: true,
|
|
41
|
+
fetch: true,
|
|
42
|
+
bearer: true,
|
|
43
|
+
};
|
|
13
44
|
/**
|
|
14
45
|
* A client keeps its options as configuration (`db.getConfig()` clones them),
|
|
15
46
|
* so one that holds a function or class could only fail later, in whatever
|
|
@@ -34,17 +65,34 @@ function refuseUnkeptOptions(clientConfig) {
|
|
|
34
65
|
}
|
|
35
66
|
}
|
|
36
67
|
}
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Open a Jazz session in this browser: who is signed in, and the client that
|
|
70
|
+
* reads and writes as them. Resolves once it started; rejects if it can't.
|
|
71
|
+
* Your backend decides who is signed in; call `session.refresh()` after your
|
|
72
|
+
* own sign-in or sign-out.
|
|
73
|
+
*/
|
|
74
|
+
export function createJazzClient(config) {
|
|
75
|
+
return createStartedJazzSession(config, openBrowserSessionCore);
|
|
76
|
+
}
|
|
77
|
+
/** @internal The session core `createJazzClient` and `<JazzProvider>` own. */
|
|
78
|
+
export async function openBrowserSessionCore(config) {
|
|
79
|
+
if (config && typeof config === "object")
|
|
80
|
+
refuseClientAppId(config);
|
|
81
|
+
refuseInvalidSessionConfig(config, BROWSER_SESSION_OPTIONS);
|
|
82
|
+
// `window.__jazz` is Jazz's page handle: an app's own global there would
|
|
83
|
+
// only fail later, when the local-first client opens.
|
|
84
|
+
const page = globalThis.window;
|
|
85
|
+
if (page && typeof page.document !== "undefined")
|
|
86
|
+
refuseWindowJazzConflict(page);
|
|
40
87
|
if (config.serverUrl === null)
|
|
41
88
|
return createDeviceOnlySession(config);
|
|
42
89
|
const serverUrl = config.serverUrl ?? DEFAULT_SERVER_URL;
|
|
43
|
-
const { initial, clearOnSignOut,
|
|
90
|
+
const { initial, clearOnSignOut, linkDeviceAccountOnSignUp, onSignedOut, client: loadLocalFirst, localFirst,
|
|
44
91
|
// The account manager's own: neither is client configuration, and a Db
|
|
45
92
|
// keeps only cloneable data (db.getConfig()).
|
|
46
93
|
store: _store, fetch: _fetch, bearer, ...clientConfig } = { ...config, serverUrl };
|
|
47
94
|
refuseUnkeptOptions(clientConfig);
|
|
95
|
+
refuseLocalFirstTiming(localFirst, loadLocalFirst);
|
|
48
96
|
const accounts = await createAccountManagerWithMinter({ ...config, serverUrl }, mintLocalFirstTokenInJs,
|
|
49
97
|
// A shared device: never reopen the last user before the backend answers.
|
|
50
98
|
{ rememberBackendUser: !clearOnSignOut });
|
|
@@ -54,44 +102,36 @@ export async function createJazzClient(config) {
|
|
|
54
102
|
const wipesOnSignOut = !!clearOnSignOut && (config.driver?.type ?? "persistent") === "persistent";
|
|
55
103
|
// Local-first replicas a sign-out may leave behind (see `leftBehindReplicas`).
|
|
56
104
|
const leftBehind = wipesOnSignOut && loadLocalFirst ? leftBehindReplicas(registry) : undefined;
|
|
57
|
-
// Accounts whose local-first client is (or was) the session's own in this
|
|
58
|
-
// page: signing them out here wiped their replica.
|
|
59
|
-
const inSession = new Set();
|
|
60
105
|
// Accounts this page is opening a local-first client for, and replicas
|
|
61
106
|
// being wiped: an account's open waits for its wipe to finish.
|
|
62
107
|
const opening = new Set();
|
|
63
108
|
const wiping = new Map();
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
void whileNoTabHolds(registry, id, async () => {
|
|
71
|
-
if (!signedOutHere.delete(id) || opening.has(id) || inSession.has(id))
|
|
72
|
-
return;
|
|
73
|
-
leftBehind.forget(id);
|
|
74
|
-
}).catch(() => { });
|
|
75
|
-
};
|
|
76
|
-
/** Open `account`'s local-first client, recorded and held open against other tabs' wipes. */
|
|
109
|
+
/**
|
|
110
|
+
* Open `account`'s local-first client, held open against other tabs'
|
|
111
|
+
* wipes (a guest's too: its tabs share one store). A user the backend
|
|
112
|
+
* signed in is also recorded, so a later load wipes what a sign-out leaves
|
|
113
|
+
* behind.
|
|
114
|
+
*/
|
|
77
115
|
const openReplica = async (createDb, account) => {
|
|
78
|
-
|
|
79
|
-
if (!leftBehind || !rememberBackendUser(account))
|
|
116
|
+
if (!leftBehind)
|
|
80
117
|
return openLocalFirst(createDb, account);
|
|
118
|
+
// A guest's replica is the device's own: no later load wipes it.
|
|
119
|
+
const recorded = rememberBackendUser(account);
|
|
81
120
|
opening.add(account.id);
|
|
82
|
-
signedOutHere.delete(account.id);
|
|
83
121
|
try {
|
|
84
122
|
await wiping.get(account.id)?.catch(() => { });
|
|
85
|
-
|
|
123
|
+
if (recorded)
|
|
124
|
+
leftBehind.remember(account);
|
|
86
125
|
const release = await holdReplica(registry, account.id);
|
|
87
|
-
// Again once held: another tab's
|
|
88
|
-
|
|
126
|
+
// Again once held: another tab's wipe may have forgotten it before.
|
|
127
|
+
if (recorded)
|
|
128
|
+
leftBehind.remember(account);
|
|
89
129
|
let client;
|
|
90
130
|
try {
|
|
91
131
|
client = await openLocalFirst(createDb, account);
|
|
92
132
|
}
|
|
93
133
|
catch (error) {
|
|
94
|
-
release();
|
|
134
|
+
await release();
|
|
95
135
|
throw error;
|
|
96
136
|
}
|
|
97
137
|
const shutdown = client.shutdown.bind(client);
|
|
@@ -100,8 +140,7 @@ export async function createJazzClient(config) {
|
|
|
100
140
|
await shutdown(options);
|
|
101
141
|
}
|
|
102
142
|
finally {
|
|
103
|
-
release();
|
|
104
|
-
forgetSignedOut(account.id);
|
|
143
|
+
await release();
|
|
105
144
|
}
|
|
106
145
|
};
|
|
107
146
|
return client;
|
|
@@ -110,6 +149,159 @@ export async function createJazzClient(config) {
|
|
|
110
149
|
opening.delete(account.id);
|
|
111
150
|
}
|
|
112
151
|
};
|
|
152
|
+
/**
|
|
153
|
+
* Wipe `account`'s replica once no tab has it open, from a client opened
|
|
154
|
+
* only to delete it: never under an open client, so no tab's store is
|
|
155
|
+
* reset beneath it. `"held"` while a tab has it open (that tab's user is
|
|
156
|
+
* still signed in there; the last tab out wipes). `"given-up"` when its
|
|
157
|
+
* open hangs past the timeout before the delete began: it lets go of the
|
|
158
|
+
* lock, so an open of the account doesn't wait on it. `ownPending` is what
|
|
159
|
+
* the signing-out tab counted itself, for a worker that doesn't say.
|
|
160
|
+
*/
|
|
161
|
+
const wipeReplica = async (open, account, ownPending = 0) => {
|
|
162
|
+
let wiped = false;
|
|
163
|
+
const ran = await whileNoTabHolds(registry, account, async () => {
|
|
164
|
+
const timeout = AbortSignal.timeout(WIPE_TIMEOUT_MS);
|
|
165
|
+
let deleting = false;
|
|
166
|
+
const run = (async () => {
|
|
167
|
+
// Its socket carries the signed-out user's sign-in, or none: a
|
|
168
|
+
// write the server still accepts may upload meanwhile.
|
|
169
|
+
const client = await open();
|
|
170
|
+
let pendingUploads;
|
|
171
|
+
try {
|
|
172
|
+
// Given up on while it opened: leave the replica for a retry.
|
|
173
|
+
if (timeout.aborted)
|
|
174
|
+
return;
|
|
175
|
+
deleting = true;
|
|
176
|
+
({ pendingUploads } = await client.db.wipeClientStorage());
|
|
177
|
+
}
|
|
178
|
+
finally {
|
|
179
|
+
await client.shutdown();
|
|
180
|
+
}
|
|
181
|
+
wiped = true;
|
|
182
|
+
leftBehind?.forget(account);
|
|
183
|
+
const lost = Math.max(pendingUploads ?? 0, ownPending);
|
|
184
|
+
if (lost > 0)
|
|
185
|
+
console.warn(`Jazz signed out and wiped ${lost} write(s) the server hadn't confirmed, as clearOnSignOut asks. They are gone from this device; any the server did receive stay there.`);
|
|
186
|
+
})();
|
|
187
|
+
run.catch(() => { });
|
|
188
|
+
wiping.set(account, run);
|
|
189
|
+
// Given up on before its delete began: let go of the lock at once. A
|
|
190
|
+
// delete that began is waited for, however long it takes: an open of
|
|
191
|
+
// the account meanwhile would get half-wiped storage.
|
|
192
|
+
const givenUp = new Promise((resolve) => {
|
|
193
|
+
const giveUp = () => {
|
|
194
|
+
if (!deleting)
|
|
195
|
+
resolve();
|
|
196
|
+
};
|
|
197
|
+
if (timeout.aborted)
|
|
198
|
+
giveUp();
|
|
199
|
+
timeout.addEventListener("abort", giveUp, { once: true });
|
|
200
|
+
});
|
|
201
|
+
try {
|
|
202
|
+
await Promise.race([run, givenUp]);
|
|
203
|
+
}
|
|
204
|
+
finally {
|
|
205
|
+
if (wiping.get(account) === run)
|
|
206
|
+
wiping.delete(account);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
return !ran ? "held" : wiped ? "wiped" : "given-up";
|
|
210
|
+
};
|
|
211
|
+
// Signed-out accounts whose wipe waits for the tabs that still hold them.
|
|
212
|
+
const retrying = new Set();
|
|
213
|
+
/**
|
|
214
|
+
* Try a wipe that couldn't run (a tab held the replica, or its open hung)
|
|
215
|
+
* again every `WIPE_RETRY_MS` in this page, so it doesn't wait for a
|
|
216
|
+
* reload. Only while no tab holds the replica, this page isn't on the
|
|
217
|
+
* account again, and (a user the backend signed in) the backend no longer
|
|
218
|
+
* names them: a tab that closed while still signed in leaves its unsynced
|
|
219
|
+
* writes for that user's next sign-in. `open` gives the client to delete
|
|
220
|
+
* through; `parked`, one opened for that already, is closed when it stops.
|
|
221
|
+
*/
|
|
222
|
+
const retryWipe = (account, open, ownPending, parked) => {
|
|
223
|
+
if (retrying.has(account.id)) {
|
|
224
|
+
void parked?.shutdown().catch(() => { });
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
retrying.add(account.id);
|
|
228
|
+
const stop = () => {
|
|
229
|
+
retrying.delete(account.id);
|
|
230
|
+
void parked?.shutdown().catch(() => { });
|
|
231
|
+
};
|
|
232
|
+
const tick = async () => {
|
|
233
|
+
const snapshot = session?.getSnapshot();
|
|
234
|
+
if (!snapshot ||
|
|
235
|
+
snapshot.status === "closed" ||
|
|
236
|
+
snapshot.account?.id === account.id ||
|
|
237
|
+
opening.has(account.id))
|
|
238
|
+
return stop();
|
|
239
|
+
try {
|
|
240
|
+
if (await replicaHeld(registry, account.id))
|
|
241
|
+
return schedule();
|
|
242
|
+
if (rememberBackendUser(account)) {
|
|
243
|
+
const signedIn = await signedInIdentity(registry, config.fetch);
|
|
244
|
+
if (signedIn?.issuer === account.identity.issuer &&
|
|
245
|
+
signedIn.subject === account.identity.subject)
|
|
246
|
+
return schedule();
|
|
247
|
+
}
|
|
248
|
+
if ((await wipeReplica(open, account.id, ownPending)) === "wiped") {
|
|
249
|
+
// Its shutdown was the wipe's.
|
|
250
|
+
parked = undefined;
|
|
251
|
+
return stop();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
catch {
|
|
255
|
+
// The backend or the storage failed this time: try again.
|
|
256
|
+
}
|
|
257
|
+
schedule();
|
|
258
|
+
};
|
|
259
|
+
const schedule = () => void setTimeout(() => void tick(), WIPE_RETRY_MS);
|
|
260
|
+
schedule();
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* How this page signs a local-first account out under `clearOnSignOut`:
|
|
264
|
+
* upload what the server still accepts, close this tab's client (letting
|
|
265
|
+
* go of its hold), then wipe if no other tab has the account open, or
|
|
266
|
+
* retry until none has. Resolves whether it wiped now.
|
|
267
|
+
*/
|
|
268
|
+
const wipeSignedOut = async (client, account) => {
|
|
269
|
+
// Loaded first: a chunk that won't load fails the sign-out while the
|
|
270
|
+
// client still works, rather than after it closed.
|
|
271
|
+
const { createClient } = await loadLocalFirst();
|
|
272
|
+
await client.db.waitForSync({ timeoutMs: 5_000 }).catch(() => { });
|
|
273
|
+
// What this tab counts itself, for a worker too old to count the store.
|
|
274
|
+
const ownPending = client.db.getSyncStatus().pendingUploads;
|
|
275
|
+
await client.shutdown();
|
|
276
|
+
const outcome = await wipeReplica(() => openLocalFirst(createClient, account), account.id, ownPending);
|
|
277
|
+
if (outcome === "held") {
|
|
278
|
+
// The account can't be opened once signed out: open the client the
|
|
279
|
+
// retry deletes through now. It holds no replica, so it keeps no tab's
|
|
280
|
+
// wipe waiting, and it stays a client of the store the other tab has
|
|
281
|
+
// open. Without it, a later load's sweep wipes a recorded user.
|
|
282
|
+
const parked = await openLocalFirst(createClient, account).catch(() => undefined);
|
|
283
|
+
if (parked)
|
|
284
|
+
retryWipe(account, async () => parked, ownPending, parked);
|
|
285
|
+
}
|
|
286
|
+
else if (outcome === "given-up" && rememberBackendUser(account)) {
|
|
287
|
+
// Its open hung: reopen the user from the record, as a later load would.
|
|
288
|
+
retryWipe(account, () => reopenSignedOut(account, createClient), ownPending);
|
|
289
|
+
}
|
|
290
|
+
return outcome === "wiped";
|
|
291
|
+
};
|
|
292
|
+
/** A signed-out backend user's local-first client, reopened from what the record keeps. */
|
|
293
|
+
const reopenSignedOut = async (account, createDb) => {
|
|
294
|
+
const { issuer, subject } = account.identity;
|
|
295
|
+
const remembered = await createAccountManagerWithMinter({
|
|
296
|
+
...config,
|
|
297
|
+
serverUrl,
|
|
298
|
+
store: rememberedUserStore({ account: account.id, identity: { issuer, subject } }),
|
|
299
|
+
}, mintLocalFirstTokenInJs);
|
|
300
|
+
const reopened = remembered.getLoggedIn();
|
|
301
|
+
if (!reopened)
|
|
302
|
+
throw new Error("Jazz could not reopen the signed-out user to wipe");
|
|
303
|
+
return openLocalFirst(createDb, reopened);
|
|
304
|
+
};
|
|
113
305
|
let session;
|
|
114
306
|
const openLocalFirst = (createDb, account) => createRegisteredJazzClient("web", { ...clientConfig, account }, createDb);
|
|
115
307
|
const upgrade = async (loader) => {
|
|
@@ -130,10 +322,8 @@ export async function createJazzClient(config) {
|
|
|
130
322
|
}, (current, next) => upgradesInPlace.get(current)(next));
|
|
131
323
|
// Only once the session took the new client: a superseded upgrade
|
|
132
324
|
// (a logout or account switch meanwhile) is not remembered.
|
|
133
|
-
if (upgraded)
|
|
325
|
+
if (upgraded)
|
|
134
326
|
upgrades.remember(upgraded);
|
|
135
|
-
inSession.add(upgraded.id);
|
|
136
|
-
}
|
|
137
327
|
};
|
|
138
328
|
const openThin = async (account) => {
|
|
139
329
|
const thin = await createRegisteredJazzClient("web-thin", { ...clientConfig, account }, createThinDb);
|
|
@@ -147,36 +337,47 @@ export async function createJazzClient(config) {
|
|
|
147
337
|
return upgradableClient(thin);
|
|
148
338
|
};
|
|
149
339
|
const openClient = async (account) => {
|
|
150
|
-
if (loadLocalFirst && upgrades.has(account)) {
|
|
340
|
+
if (loadLocalFirst && (localFirst === "now" || upgrades.has(account))) {
|
|
151
341
|
let module;
|
|
152
342
|
try {
|
|
153
343
|
module = await loadLocalFirst();
|
|
154
344
|
}
|
|
155
345
|
catch (error) {
|
|
346
|
+
// Asked for local-first now: running thin would quietly break what
|
|
347
|
+
// the app needs it for (offline, db.transaction).
|
|
348
|
+
if (localFirst === "now")
|
|
349
|
+
throw error;
|
|
156
350
|
// A chunk that no longer loads (renamed by a deploy, or the network)
|
|
157
351
|
// costs the app its offline start, not the session: it runs thin,
|
|
158
352
|
// and the background upgrade tries the loader again.
|
|
159
353
|
console.warn("Jazz could not load the local-first client; starting thin.", error);
|
|
160
354
|
return openThin(account);
|
|
161
355
|
}
|
|
162
|
-
|
|
163
|
-
inSession.add(account.id);
|
|
164
|
-
return client;
|
|
356
|
+
return openReplica(module.createClient, account);
|
|
165
357
|
}
|
|
166
358
|
return openThin(account);
|
|
167
359
|
};
|
|
168
360
|
session = await createJazzSessionOwner({
|
|
169
361
|
accounts,
|
|
170
|
-
initial,
|
|
362
|
+
initial: coreInitial(initial),
|
|
171
363
|
// A memory-only client has no storage to wipe.
|
|
172
364
|
clearOnSignOut: wipesOnSignOut,
|
|
365
|
+
...(leftBehind ? { wipeSignedOut } : {}),
|
|
173
366
|
openClient,
|
|
174
367
|
decorate: followUser({
|
|
175
368
|
registry,
|
|
176
369
|
events: browserBackendWatchEvents(`jazz-account:${registry}`),
|
|
177
|
-
linkGuest:
|
|
178
|
-
|
|
179
|
-
|
|
370
|
+
linkGuest: linkDeviceAccountOnSignUp,
|
|
371
|
+
forgotten: (account) => accountForgotten(accounts, account.id),
|
|
372
|
+
watchAccounts: (changed) => watchStoredSelection(accounts, changed),
|
|
373
|
+
// Ask "who is signed in" the way sign-in asks: through the app's own
|
|
374
|
+
// `fetch` when it gives one, and with its bearer when it has no cookies.
|
|
375
|
+
...(bearer
|
|
376
|
+
? { fetch: bearerFetch(bearer, config.fetch) }
|
|
377
|
+
: config.fetch
|
|
378
|
+
? { fetch: config.fetch }
|
|
379
|
+
: {}),
|
|
380
|
+
onSignedOut,
|
|
180
381
|
}),
|
|
181
382
|
});
|
|
182
383
|
if (loadLocalFirst)
|
|
@@ -184,19 +385,6 @@ export async function createJazzClient(config) {
|
|
|
184
385
|
if (leftBehind && loadLocalFirst) {
|
|
185
386
|
const record = leftBehind;
|
|
186
387
|
const following = session;
|
|
187
|
-
// Signed out in this page: the session wiped the replica as it did.
|
|
188
|
-
following.subscribe(() => {
|
|
189
|
-
const { status, account } = following.getSnapshot();
|
|
190
|
-
if (status !== "ready" && status !== "signed-out")
|
|
191
|
-
return;
|
|
192
|
-
for (const id of inSession) {
|
|
193
|
-
if (id === account?.id)
|
|
194
|
-
continue;
|
|
195
|
-
inSession.delete(id);
|
|
196
|
-
signedOutHere.add(id);
|
|
197
|
-
forgetSignedOut(id);
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
388
|
const stillLeftBehind = (account) => following.getSnapshot().status !== "closed" &&
|
|
201
389
|
!opening.has(account) &&
|
|
202
390
|
following.getSnapshot().account?.id !== account;
|
|
@@ -280,6 +468,8 @@ export async function createJazzClient(config) {
|
|
|
280
468
|
const LOCAL_FIRST_ISSUER = "urn:jazz:local-first";
|
|
281
469
|
/** As the backend watch confirms a signed-out answer before it signs anyone out. */
|
|
282
470
|
const CONFIRM_SIGNED_OUT_MS = 2_000;
|
|
471
|
+
/** How often a page tries again a sign-out's wipe that another tab held off. */
|
|
472
|
+
export const WIPE_RETRY_MS = 15_000;
|
|
283
473
|
/** Resolves once `session` is ready or signed out. */
|
|
284
474
|
function settledSession(session) {
|
|
285
475
|
return new Promise((resolve) => {
|
|
@@ -352,12 +542,12 @@ function upgradableClient(thin) {
|
|
|
352
542
|
* client straight away, on this browser's local-first account.
|
|
353
543
|
*/
|
|
354
544
|
async function createDeviceOnlySession(config) {
|
|
355
|
-
const { initial, clearOnSignOut,
|
|
545
|
+
const { initial, clearOnSignOut, linkDeviceAccountOnSignUp: _linkDeviceAccountOnSignUp, localFirst: _localFirst, onSignedOut: _onSignedOut, client: loadLocalFirst, store: _store, fetch: _fetch, ...rest } = config;
|
|
356
546
|
if (!loadLocalFirst) {
|
|
357
547
|
throw new Error('serverUrl: null keeps Jazz on this device, which needs the local-first client: pass client: () => import("jazz-tools/local-first")');
|
|
358
548
|
}
|
|
359
|
-
if (initial
|
|
360
|
-
throw new Error('serverUrl: null has no backend to sign in through, so it always opens this device\'s
|
|
549
|
+
if (coreInitial(initial) === "signed-out") {
|
|
550
|
+
throw new Error('serverUrl: null has no backend to sign in through, so it always opens this device\'s device account: leave out initial or set it to "device"');
|
|
361
551
|
}
|
|
362
552
|
const { serverUrl: _serverUrl, ...clientConfig } = rest;
|
|
363
553
|
refuseUnkeptOptions(clientConfig);
|
|
@@ -445,4 +635,13 @@ function localFirstMemory(registry) {
|
|
|
445
635
|
},
|
|
446
636
|
};
|
|
447
637
|
}
|
|
638
|
+
/** `localFirst`, checked: a timing the session can't honour fails by name. */
|
|
639
|
+
function refuseLocalFirstTiming(localFirst, loader) {
|
|
640
|
+
if (localFirst === undefined || localFirst === "background")
|
|
641
|
+
return;
|
|
642
|
+
if (localFirst !== "now")
|
|
643
|
+
throw new Error(`Unknown localFirst ${JSON.stringify(localFirst)}; expected "now" or "background"`);
|
|
644
|
+
if (!loader)
|
|
645
|
+
throw new Error('localFirst: "now" opens the local-first client, which needs the `client` loader: pass client: () => import("jazz-tools/local-first")');
|
|
646
|
+
}
|
|
448
647
|
//# sourceMappingURL=create-jazz-session.js.map
|