jazz-tools 2.0.0-alpha.60 → 2.0.0-alpha.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +13 -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 +38 -2
- package/dist/accounts/persistence.d.ts.map +1 -1
- package/dist/accounts/persistence.js +123 -6
- package/dist/accounts/persistence.js.map +1 -1
- package/dist/accounts/registry-client.d.ts +29 -0
- package/dist/accounts/registry-client.d.ts.map +1 -1
- package/dist/accounts/registry-client.js +45 -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-context.d.ts +7 -0
- package/dist/backend/create-jazz-context.d.ts.map +1 -1
- package/dist/backend/create-jazz-context.js +115 -18
- package/dist/backend/create-jazz-context.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 +196 -38
- package/dist/backend/create-jazz.d.ts.map +1 -1
- package/dist/backend/create-jazz.js +935 -147
- 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/external-jwt.d.ts.map +1 -1
- package/dist/backend/external-jwt.js +34 -10
- package/dist/backend/external-jwt.js.map +1 -1
- package/dist/backend/from-jwt.d.ts +6 -4
- package/dist/backend/from-jwt.d.ts.map +1 -1
- package/dist/backend/from-jwt.js +11 -3
- 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 +133 -0
- package/dist/backend/inspect.d.ts.map +1 -0
- package/dist/backend/inspect.js +983 -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/request-auth.d.ts +11 -0
- package/dist/backend/request-auth.d.ts.map +1 -1
- package/dist/backend/request-auth.js +14 -0
- package/dist/backend/request-auth.js.map +1 -1
- 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 +10 -0
- package/dist/backend/signing-key.d.ts.map +1 -0
- package/dist/backend/signing-key.js +15 -0
- package/dist/backend/signing-key.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/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 +88 -12
- package/dist/backend/vercel-store.d.ts.map +1 -1
- package/dist/backend/vercel-store.js +303 -44
- package/dist/backend/vercel-store.js.map +1 -1
- 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 +40 -0
- package/dist/backend/ws-peer.js.map +1 -0
- package/dist/better-auth-adapter/fixtures/issuer-upgrade-schema.d.ts +134 -0
- package/dist/better-auth-adapter/fixtures/issuer-upgrade-schema.d.ts.map +1 -0
- package/dist/better-auth-adapter/fixtures/issuer-upgrade-schema.js +121 -0
- package/dist/better-auth-adapter/fixtures/issuer-upgrade-schema.js.map +1 -0
- package/dist/better-auth-adapter/fixtures/schema.d.ts +2 -1
- package/dist/better-auth-adapter/fixtures/schema.d.ts.map +1 -1
- package/dist/better-auth-adapter/fixtures/schema.js +2 -1
- package/dist/better-auth-adapter/fixtures/schema.js.map +1 -1
- package/dist/better-auth-adapter/index.d.ts.map +1 -1
- package/dist/better-auth-adapter/index.js +47 -0
- package/dist/better-auth-adapter/index.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 +54 -11
- 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-project.d.ts +12 -3
- package/dist/dev/catalogue-project.d.ts.map +1 -1
- package/dist/dev/catalogue-project.js +29 -4
- package/dist/dev/catalogue-project.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 +94 -15
- package/dist/dev/catalogue.js.map +1 -1
- package/dist/dev/dev-server.d.ts +4 -1
- package/dist/dev/dev-server.d.ts.map +1 -1
- package/dist/dev/dev-server.js +41 -3
- package/dist/dev/dev-server.js.map +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/backend-C6JfNAB2.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-X_T_QKCN.js → create-legacy-browser-delegate-Bf58kV5i.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/{esm-aRzpnC3u.js → esm-B8Fn7-qJ.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/{esm-ezD5H765.js → esm-C3BWHq-S.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/esm-DC_mAoiW.js +1 -0
- 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-C_pcvEcg.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/{jazz-broker-worker-XRRxJUcx.js → jazz-broker-worker-Cv6-V0tc.js} +787 -608
- package/dist/dev/inspector-overlay/embedded/assets/jazz-broker-worker-Db-pNME-.js +5 -0
- package/dist/dev/inspector-overlay/embedded/assets/jazz_wasm-CTwPHZcZ.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm_bg-KR7h3v27.wasm → jazz_wasm_bg-HpkRDlj-.wasm} +0 -0
- package/dist/dev/inspector-overlay/embedded/assets/src-B5UtjtXQ.js +22 -0
- package/dist/dev/inspector-overlay/embedded/assets/{index-C78Pprka.css → src-Cq8gSOLx.css} +1 -1
- 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/dev/migrations.d.ts.map +1 -1
- package/dist/dev/migrations.js +53 -7
- package/dist/dev/migrations.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 +53 -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/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/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 +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -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 +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/local-first/index.d.ts +2 -0
- package/dist/local-first/index.d.ts.map +1 -1
- package/dist/local-first/index.js +2 -0
- package/dist/local-first/index.js.map +1 -1
- package/dist/migrations.d.ts +23 -3
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +28 -6
- package/dist/migrations.js.map +1 -1
- 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/permissions/index.d.ts +1 -1
- package/dist/permissions/index.d.ts.map +1 -1
- package/dist/permissions/index.js +31 -10
- package/dist/permissions/index.js.map +1 -1
- package/dist/prosemirror/sync.d.ts.map +1 -1
- package/dist/prosemirror/sync.js +43 -21
- package/dist/prosemirror/sync.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 +42 -90
- 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 +53 -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 +21 -0
- package/dist/react-native/native-foreground-db.d.ts.map +1 -1
- package/dist/react-native/native-foreground-db.js +47 -1
- 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.d.ts +22 -0
- package/dist/react-native/runtime-source.d.ts.map +1 -1
- package/dist/react-native/runtime-source.js +68 -5
- 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/authority-changed-error.d.ts +5 -3
- package/dist/runtime/authority-changed-error.d.ts.map +1 -1
- package/dist/runtime/authority-changed-error.js +5 -3
- package/dist/runtime/authority-changed-error.js.map +1 -1
- package/dist/runtime/browser-worker-assets.d.ts +19 -1
- package/dist/runtime/browser-worker-assets.d.ts.map +1 -1
- package/dist/runtime/browser-worker-assets.js +23 -1
- package/dist/runtime/browser-worker-assets.js.map +1 -1
- 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 +2 -0
- package/dist/runtime/browser-worker-assets.native.d.ts.map +1 -1
- package/dist/runtime/browser-worker-assets.native.js +2 -0
- package/dist/runtime/browser-worker-assets.native.js.map +1 -1
- package/dist/runtime/browser-worker-config.d.ts +23 -0
- package/dist/runtime/browser-worker-config.d.ts.map +1 -1
- package/dist/runtime/browser-worker-config.js +72 -4
- package/dist/runtime/browser-worker-config.js.map +1 -1
- package/dist/runtime/client-migrations.d.ts +6 -4
- package/dist/runtime/client-migrations.d.ts.map +1 -1
- package/dist/runtime/client-migrations.js +20 -2
- package/dist/runtime/client-migrations.js.map +1 -1
- package/dist/runtime/client.d.ts +46 -6
- package/dist/runtime/client.d.ts.map +1 -1
- package/dist/runtime/client.js +65 -13
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/connection-manager/browser-connection-manager.d.ts +5 -1
- package/dist/runtime/connection-manager/browser-connection-manager.d.ts.map +1 -1
- package/dist/runtime/connection-manager/browser-connection-manager.js +38 -2
- package/dist/runtime/connection-manager/browser-connection-manager.js.map +1 -1
- package/dist/runtime/connection-manager/direct-connection-manager.d.ts +3 -1
- package/dist/runtime/connection-manager/direct-connection-manager.d.ts.map +1 -1
- package/dist/runtime/connection-manager/direct-connection-manager.js +7 -3
- package/dist/runtime/connection-manager/direct-connection-manager.js.map +1 -1
- package/dist/runtime/connection-manager/types.d.ts +23 -2
- package/dist/runtime/connection-manager/types.d.ts.map +1 -1
- package/dist/runtime/connection-manager/types.js +49 -6
- package/dist/runtime/connection-manager/types.js.map +1 -1
- package/dist/runtime/context.d.ts +5 -1
- 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 +18 -3
- package/dist/runtime/credentialed-transport.d.ts.map +1 -1
- package/dist/runtime/credentialed-transport.js +34 -11
- 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 +40 -8
- package/dist/runtime/db.d.ts.map +1 -1
- package/dist/runtime/db.js +76 -9
- package/dist/runtime/db.js.map +1 -1
- package/dist/runtime/default-runtime-source.d.ts.map +1 -1
- package/dist/runtime/default-runtime-source.js +6 -1
- package/dist/runtime/default-runtime-source.js.map +1 -1
- 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/index.d.ts +4 -4
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/local-first-upgrade.d.ts +9 -0
- package/dist/runtime/local-first-upgrade.d.ts.map +1 -1
- package/dist/runtime/local-first-upgrade.js.map +1 -1
- 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-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 +4 -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 +3 -0
- package/dist/runtime/native-runtime/attached-browser-worker-connection.js.map +1 -1
- 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 +6 -1
- package/dist/runtime/native-runtime/browser-follower-connection.d.ts.map +1 -1
- package/dist/runtime/native-runtime/browser-follower-connection.js +9 -3
- package/dist/runtime/native-runtime/browser-follower-connection.js.map +1 -1
- package/dist/runtime/native-runtime/browser-shared-worker-connection.d.ts +12 -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 +140 -7
- package/dist/runtime/native-runtime/browser-shared-worker-connection.js.map +1 -1
- package/dist/runtime/native-runtime/browser-worker-protocol.d.ts +29 -1
- 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 +148 -44
- package/dist/runtime/native-runtime/http-stream-socket.js.map +1 -1
- package/dist/runtime/native-runtime/native-error-code.d.ts +1 -1
- package/dist/runtime/native-runtime/native-error-code.d.ts.map +1 -1
- package/dist/runtime/native-runtime/native-error-code.js +1 -0
- package/dist/runtime/native-runtime/native-error-code.js.map +1 -1
- package/dist/runtime/native-runtime/native-runtime-adapter.d.ts +105 -7
- package/dist/runtime/native-runtime/native-runtime-adapter.d.ts.map +1 -1
- package/dist/runtime/native-runtime/native-runtime-adapter.js +306 -27
- package/dist/runtime/native-runtime/native-runtime-adapter.js.map +1 -1
- 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 +22 -0
- package/dist/runtime/native-runtime/stream-endpoint-memory.d.ts.map +1 -0
- package/dist/runtime/native-runtime/stream-endpoint-memory.js +69 -0
- package/dist/runtime/native-runtime/stream-endpoint-memory.js.map +1 -0
- package/dist/runtime/native-runtime/websocket.d.ts +51 -1
- package/dist/runtime/native-runtime/websocket.d.ts.map +1 -1
- package/dist/runtime/native-runtime/websocket.js +187 -7
- package/dist/runtime/native-runtime/websocket.js.map +1 -1
- 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/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.map +1 -1
- package/dist/runtime/row-transformer.js +20 -0
- package/dist/runtime/row-transformer.js.map +1 -1
- package/dist/runtime/runtime-config.d.ts +5 -1
- package/dist/runtime/runtime-config.d.ts.map +1 -1
- package/dist/runtime/runtime-config.js +5 -1
- package/dist/runtime/runtime-config.js.map +1 -1
- package/dist/runtime/runtime-source.d.ts +6 -1
- package/dist/runtime/runtime-source.d.ts.map +1 -1
- package/dist/runtime/runtime-source.js.map +1 -1
- package/dist/runtime/schema-metadata.d.ts +17 -0
- package/dist/runtime/schema-metadata.d.ts.map +1 -1
- package/dist/runtime/schema-metadata.js +28 -0
- package/dist/runtime/schema-metadata.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/runtime/wasm-loader.d.ts.map +1 -1
- package/dist/runtime/wasm-loader.js +8 -1
- package/dist/runtime/wasm-loader.js.map +1 -1
- package/dist/schema-loader.d.ts +2 -0
- package/dist/schema-loader.d.ts.map +1 -1
- package/dist/schema-loader.js +7 -2
- package/dist/schema-loader.js.map +1 -1
- package/dist/schema-permissions.d.ts.map +1 -1
- package/dist/schema-permissions.js +19 -0
- package/dist/schema-permissions.js.map +1 -1
- package/dist/schema-source.d.ts.map +1 -1
- package/dist/schema-source.js +14 -0
- package/dist/schema-source.js.map +1 -1
- package/dist/session/backend-watch.d.ts +56 -15
- package/dist/session/backend-watch.d.ts.map +1 -1
- package/dist/session/backend-watch.js +127 -31
- 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 +55 -21
- package/dist/session/create-jazz-session.d.ts.map +1 -1
- package/dist/session/create-jazz-session.js +215 -166
- package/dist/session/create-jazz-session.js.map +1 -1
- package/dist/session/follow-user.d.ts +30 -11
- package/dist/session/follow-user.d.ts.map +1 -1
- package/dist/session/follow-user.js +49 -9
- package/dist/session/follow-user.js.map +1 -1
- package/dist/session/jazz-session.d.ts +182 -0
- package/dist/session/jazz-session.d.ts.map +1 -0
- package/dist/session/jazz-session.js +459 -0
- package/dist/session/jazz-session.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 +450 -0
- package/dist/session/replica-ledger.js.map +1 -0
- package/dist/session/state.d.ts +50 -13
- package/dist/session/state.d.ts.map +1 -1
- package/dist/session/state.js +158 -29
- 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 +86 -23
- 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/client-migrations.d.ts +8 -1
- package/dist/testing/client-migrations.d.ts.map +1 -1
- package/dist/testing/client-migrations.js +11 -0
- package/dist/testing/client-migrations.js.map +1 -1
- 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 +6 -3
- 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 +53 -3
- package/dist/thin/thin-runtime.d.ts.map +1 -1
- package/dist/thin/thin-runtime.js +256 -33
- package/dist/thin/thin-runtime.js.map +1 -1
- package/dist/typed-app.d.ts +10 -4
- package/dist/typed-app.d.ts.map +1 -1
- package/dist/typed-app.js +44 -18
- package/dist/typed-app.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 +80 -23
- package/dist/vue/session.js.map +1 -1
- package/dist/web/create-jazz-client.d.ts +5 -1
- package/dist/web/create-jazz-client.d.ts.map +1 -1
- package/dist/web/create-jazz-client.js +30 -3
- package/dist/web/create-jazz-client.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 +118 -20
- package/dist/worker/jazz-broker-worker-core.js.map +1 -1
- package/dist/worker/jazz-broker-worker.js +787 -608
- 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/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 +30 -10
- 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/session/left-behind-replicas.d.ts +0 -62
- package/dist/session/left-behind-replicas.d.ts.map +0 -1
- package/dist/session/left-behind-replicas.js +0 -146
- package/dist/session/left-behind-replicas.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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-secret-store.js","sourceRoot":"","sources":["../../src/runtime/auth-secret-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth-secret-store.js","sourceRoot":"","sources":["../../src/runtime/auth-secret-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAEhC;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACjC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import { formatAuthSecret } from \"./auth-secret-codec.js\";\n\nexport {\n authSecretStorageKey,\n AuthSecretFormatError,\n formatAuthSecret,\n parseAuthSecret,\n} from \"./auth-secret-codec.js\";\n\n/**\n * Generate a new 32-byte auth secret in canonical versioned form.\n * Uses the platform's native CSPRNG.\n */\nexport function generateAuthSecret(): string {\n const bytes = new Uint8Array(32);\n crypto.getRandomValues(bytes);\n return formatAuthSecret(bytes);\n}\n"]}
|
|
@@ -22,9 +22,11 @@ export declare const AUTHORITY_CHANGED_ERROR_CODE = "authority_changed";
|
|
|
22
22
|
* old server are lost with the store. If the server was replaced by
|
|
23
23
|
* mistake, bring the old one back and call `db.reconnect()` instead.
|
|
24
24
|
*
|
|
25
|
-
* In the browser, a tab that syncs through a shared worker is
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* In the browser, a tab that syncs through a shared worker is told of a
|
|
26
|
+
* refusal its worker received through its subscriptions: its remote
|
|
27
|
+
* subscriptions end with this error, while its local-first ones keep
|
|
28
|
+
* reading the worker's store. Its Global waits are not yet told, and may
|
|
29
|
+
* keep waiting (unverified path).
|
|
28
30
|
*
|
|
29
31
|
* Class identity does not survive native bindings or browser worker
|
|
30
32
|
* messages, so detect it with {@link isAuthorityChangedError}, which checks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authority-changed-error.d.ts","sourceRoot":"","sources":["../../src/runtime/authority-changed-error.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,eAAO,MAAM,4BAA4B,sBAAsB,CAAC;AAEhE
|
|
1
|
+
{"version":3,"file":"authority-changed-error.d.ts","sourceRoot":"","sources":["../../src/runtime/authority-changed-error.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,eAAO,MAAM,4BAA4B,sBAAsB,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,SAAkB,IAAI,2BAA2B;IACjD,QAAQ,CAAC,IAAI,uBAAgC;gBAEjC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAG3D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,KAAK,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,4BAA4B,CAAA;CAAE,CAGzE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,KAAK,GAAG,IAAI,CAcnE"}
|
|
@@ -22,9 +22,11 @@ export const AUTHORITY_CHANGED_ERROR_CODE = "authority_changed";
|
|
|
22
22
|
* old server are lost with the store. If the server was replaced by
|
|
23
23
|
* mistake, bring the old one back and call `db.reconnect()` instead.
|
|
24
24
|
*
|
|
25
|
-
* In the browser, a tab that syncs through a shared worker is
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* In the browser, a tab that syncs through a shared worker is told of a
|
|
26
|
+
* refusal its worker received through its subscriptions: its remote
|
|
27
|
+
* subscriptions end with this error, while its local-first ones keep
|
|
28
|
+
* reading the worker's store. Its Global waits are not yet told, and may
|
|
29
|
+
* keep waiting (unverified path).
|
|
28
30
|
*
|
|
29
31
|
* Class identity does not survive native bindings or browser worker
|
|
30
32
|
* messages, so detect it with {@link isAuthorityChangedError}, which checks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authority-changed-error.js","sourceRoot":"","sources":["../../src/runtime/authority-changed-error.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAEhE
|
|
1
|
+
{"version":3,"file":"authority-changed-error.js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AAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5F,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/** Stable `code` of a changed-authority refusal on every platform and binding. */\nexport const AUTHORITY_CHANGED_ERROR_CODE = \"authority_changed\";\n\n/**\n * The server serves another history than the one this client's local store\n * follows, so the client stopped syncing with it.\n *\n * Each server store has an authority namespace, minted once when the store\n * is created. A server whose store was recreated (its data directory\n * deleted, an in-memory dev server restarted, a new environment behind the\n * same URL) has a new one, and so does another app's server. The local\n * store's rows, sync positions and unsynced writes belong to the old\n * history, so the link stops: `db.getSyncStatus().link` is\n * `{ state: \"offline\", reason: \"authority-changed\" }`, remote subscriptions\n * end with this error, and waits for the server (`wait({ tier: \"global\" })`,\n * `waitForSync()`) fail with it instead of hanging. Local reads and writes\n * keep working, and unsynced writes are kept.\n *\n * Nothing is reset automatically. To sync with the new server, reset the\n * local store: in the browser, `await db.deleteClientStorage()` (the client\n * reconnects on a fresh store); in Node, delete the client's data directory\n * and open the client again. Writes that never reached the\n * old server are lost with the store. If the server was replaced by\n * mistake, bring the old one back and call `db.reconnect()` instead.\n *\n * In the browser, a tab that syncs through a shared worker is told of a\n * refusal its worker received through its subscriptions: its remote\n * subscriptions end with this error, while its local-first ones keep\n * reading the worker's store. Its Global waits are not yet told, and may\n * keep waiting (unverified path).\n *\n * Class identity does not survive native bindings or browser worker\n * messages, so detect it with {@link isAuthorityChangedError}, which checks\n * the stable `code`.\n */\nexport class AuthorityChangedError extends Error {\n override readonly name = \"AuthorityChangedError\";\n readonly code = AUTHORITY_CHANGED_ERROR_CODE;\n\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options);\n }\n}\n\n/**\n * Whether `error` is a changed-authority refusal, by its stable `code`: an\n * {@link AuthorityChangedError}, or an error a native binding or worker relay\n * threw with code `\"authority_changed\"`.\n */\nexport function isAuthorityChangedError(\n error: unknown,\n): error is Error & { readonly code: typeof AUTHORITY_CHANGED_ERROR_CODE } {\n if (!error || typeof error !== \"object\") return false;\n return (error as { code?: unknown }).code === AUTHORITY_CHANGED_ERROR_CODE;\n}\n\n/**\n * The refusal a binding's `Transport.upstreamRefusal()` reported, as an\n * error: an {@link AuthorityChangedError} for a changed authority, an\n * `Error` keeping the core `code` otherwise, and `null` for no refusal.\n */\nexport function upstreamRefusalError(refusal: unknown): Error | null {\n if (refusal === null || refusal === undefined) return null;\n const message =\n typeof refusal === \"object\" && typeof (refusal as { message?: unknown }).message === \"string\"\n ? (refusal as { message: string }).message\n : String(refusal);\n if (isAuthorityChangedError(refusal)) {\n return new AuthorityChangedError(message, { cause: refusal });\n }\n if (refusal instanceof Error) return refusal;\n const error = new Error(message);\n const code = typeof refusal === \"object\" ? (refusal as { code?: unknown }).code : undefined;\n if (typeof code === \"string\") Object.assign(error, { code });\n return error;\n}\n"]}
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Keep browser asset literals visible to bundlers, outside native imports.
|
|
3
|
+
*
|
|
4
|
+
* Metro does not follow these literals, so Expo web takes
|
|
5
|
+
* `browser-worker-assets.metro.ts` in place of this module, through `withJazz`
|
|
6
|
+
* from `jazz-tools/expo/metro`. Both export the same names.
|
|
7
|
+
*/
|
|
2
8
|
export declare function browserRuntimeModuleUrl(): string;
|
|
3
9
|
export declare function bundledBrowserWorkerUrl(): string;
|
|
10
|
+
/**
|
|
11
|
+
* URL of the WASM binary, for a bundler that cannot follow wasm-bindgen's own
|
|
12
|
+
* `new URL("jazz_wasm_bg.wasm", import.meta.url)`. These bundlers can, so
|
|
13
|
+
* wasm-bindgen keeps resolving the binary itself.
|
|
14
|
+
*/
|
|
15
|
+
export declare function bundledWasmUrl(): string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Script type of the worker at `bundledBrowserWorkerUrl()`, for a bundler that
|
|
18
|
+
* must start it from that URL. Null here: these bundlers build the worker from
|
|
19
|
+
* the `new SharedWorker(new URL(...))` expression instead.
|
|
20
|
+
*/
|
|
21
|
+
export declare function bundledBrowserWorkerType(): WorkerType | null;
|
|
4
22
|
//# sourceMappingURL=browser-worker-assets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-worker-assets.d.ts","sourceRoot":"","sources":["../../src/runtime/browser-worker-assets.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"browser-worker-assets.d.ts","sourceRoot":"","sources":["../../src/runtime/browser-worker-assets.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AACD,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,UAAU,GAAG,IAAI,CAE5D"}
|
|
@@ -1,8 +1,30 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Keep browser asset literals visible to bundlers, outside native imports.
|
|
3
|
+
*
|
|
4
|
+
* Metro does not follow these literals, so Expo web takes
|
|
5
|
+
* `browser-worker-assets.metro.ts` in place of this module, through `withJazz`
|
|
6
|
+
* from `jazz-tools/expo/metro`. Both export the same names.
|
|
7
|
+
*/
|
|
2
8
|
export function browserRuntimeModuleUrl() {
|
|
3
9
|
return import.meta.url;
|
|
4
10
|
}
|
|
5
11
|
export function bundledBrowserWorkerUrl() {
|
|
6
12
|
return new URL("../worker/jazz-broker-worker.js", import.meta.url).href;
|
|
7
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* URL of the WASM binary, for a bundler that cannot follow wasm-bindgen's own
|
|
16
|
+
* `new URL("jazz_wasm_bg.wasm", import.meta.url)`. These bundlers can, so
|
|
17
|
+
* wasm-bindgen keeps resolving the binary itself.
|
|
18
|
+
*/
|
|
19
|
+
export function bundledWasmUrl() {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Script type of the worker at `bundledBrowserWorkerUrl()`, for a bundler that
|
|
24
|
+
* must start it from that URL. Null here: these bundlers build the worker from
|
|
25
|
+
* the `new SharedWorker(new URL(...))` expression instead.
|
|
26
|
+
*/
|
|
27
|
+
export function bundledBrowserWorkerType() {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
8
30
|
//# sourceMappingURL=browser-worker-assets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-worker-assets.js","sourceRoot":"","sources":["../../src/runtime/browser-worker-assets.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"browser-worker-assets.js","sourceRoot":"","sources":["../../src/runtime/browser-worker-assets.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AACzB,CAAC;AACD,MAAM,UAAU,uBAAuB;IACrC,OAAO,IAAI,GAAG,CAAC,iCAAiC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AAC1E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB;IACtC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/**\n * Keep browser asset literals visible to bundlers, outside native imports.\n *\n * Metro does not follow these literals, so Expo web takes\n * `browser-worker-assets.metro.ts` in place of this module, through `withJazz`\n * from `jazz-tools/expo/metro`. Both export the same names.\n */\nexport function browserRuntimeModuleUrl(): string {\n return import.meta.url;\n}\nexport function bundledBrowserWorkerUrl(): string {\n return new URL(\"../worker/jazz-broker-worker.js\", import.meta.url).href;\n}\n\n/**\n * URL of the WASM binary, for a bundler that cannot follow wasm-bindgen's own\n * `new URL(\"jazz_wasm_bg.wasm\", import.meta.url)`. These bundlers can, so\n * wasm-bindgen keeps resolving the binary itself.\n */\nexport function bundledWasmUrl(): string | null {\n return null;\n}\n\n/**\n * Script type of the worker at `bundledBrowserWorkerUrl()`, for a bundler that\n * must start it from that URL. Null here: these bundlers build the worker from\n * the `new SharedWorker(new URL(...))` expression instead.\n */\nexport function bundledBrowserWorkerType(): WorkerType | null {\n return null;\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expo web takes this module in place of `browser-worker-assets.ts`, through
|
|
3
|
+
* `withJazz` from `jazz-tools/expo/metro`. See that module for the exports.
|
|
4
|
+
*
|
|
5
|
+
* Metro does not follow `new URL(..., import.meta.url)`, and Expo rewrites
|
|
6
|
+
* `new SharedWorker(new URL(...))` into a dedicated Worker. So both assets go
|
|
7
|
+
* through Metro's own graph here, which serves them in development and writes
|
|
8
|
+
* them to an export under content-hashed names:
|
|
9
|
+
* - the worker as a worker chunk, started by URL as a real SharedWorker;
|
|
10
|
+
* - the WASM as an asset (`withJazz` adds `wasm` to `assetExts`).
|
|
11
|
+
*
|
|
12
|
+
* The chunk is the shipped worker. Expo compiles its `import.meta` to a
|
|
13
|
+
* registry that worker chunks do not have, so the worker must not read
|
|
14
|
+
* `import.meta.url` here: the page hands it the WASM URL, and the loader asks
|
|
15
|
+
* for its own module's URL only when it has none.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Expo's `import.meta.url` is the URL of the script that is executing, and is
|
|
19
|
+
* null once that script has finished (SDK 54). A Metro bundle is served from
|
|
20
|
+
* the page's origin, so the page stands in for the module.
|
|
21
|
+
*/
|
|
22
|
+
export declare function browserRuntimeModuleUrl(): string;
|
|
23
|
+
export declare function bundledBrowserWorkerUrl(): string;
|
|
24
|
+
/** The binary shipped beside the worker, which is the pair the worker's glue was checked against. */
|
|
25
|
+
export declare function bundledWasmUrl(): string | null;
|
|
26
|
+
/** A Metro chunk is a classic script. */
|
|
27
|
+
export declare function bundledBrowserWorkerType(): WorkerType | null;
|
|
28
|
+
//# sourceMappingURL=browser-worker-assets.metro.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-worker-assets.metro.d.ts","sourceRoot":"","sources":["../../src/runtime/browser-worker-assets.metro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAeH;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AACD,wBAAgB,uBAAuB,IAAI,MAAM,CAahD;AAED,qGAAqG;AACrG,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAE9C;AAED,yCAAyC;AACzC,wBAAgB,wBAAwB,IAAI,UAAU,GAAG,IAAI,CAE5D"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expo web takes this module in place of `browser-worker-assets.ts`, through
|
|
3
|
+
* `withJazz` from `jazz-tools/expo/metro`. See that module for the exports.
|
|
4
|
+
*
|
|
5
|
+
* Metro does not follow `new URL(..., import.meta.url)`, and Expo rewrites
|
|
6
|
+
* `new SharedWorker(new URL(...))` into a dedicated Worker. So both assets go
|
|
7
|
+
* through Metro's own graph here, which serves them in development and writes
|
|
8
|
+
* them to an export under content-hashed names:
|
|
9
|
+
* - the worker as a worker chunk, started by URL as a real SharedWorker;
|
|
10
|
+
* - the WASM as an asset (`withJazz` adds `wasm` to `assetExts`).
|
|
11
|
+
*
|
|
12
|
+
* The chunk is the shipped worker. Expo compiles its `import.meta` to a
|
|
13
|
+
* registry that worker chunks do not have, so the worker must not read
|
|
14
|
+
* `import.meta.url` here: the page hands it the WASM URL, and the loader asks
|
|
15
|
+
* for its own module's URL only when it has none.
|
|
16
|
+
*/
|
|
17
|
+
import { METRO_WORKER_API_ERROR } from "./metro-setup-error.js";
|
|
18
|
+
function pageUrl(path) {
|
|
19
|
+
return new URL(path, location.href).href;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Expo's `import.meta.url` is the URL of the script that is executing, and is
|
|
23
|
+
* null once that script has finished (SDK 54). A Metro bundle is served from
|
|
24
|
+
* the page's origin, so the page stands in for the module.
|
|
25
|
+
*/
|
|
26
|
+
export function browserRuntimeModuleUrl() {
|
|
27
|
+
return location.href;
|
|
28
|
+
}
|
|
29
|
+
export function bundledBrowserWorkerUrl() {
|
|
30
|
+
// Expo rewrites this exact call at build time (@expo/metro-config's
|
|
31
|
+
// collect-dependencies matches `require.unstable_resolveWorker(...)`), so
|
|
32
|
+
// `require.unstable_resolveWorker` never exists at runtime: never read it
|
|
33
|
+
// except in this call. Undocumented in Expo, so a Metro that no longer
|
|
34
|
+
// rewrites it fails here by name, not with a bare TypeError.
|
|
35
|
+
let worker;
|
|
36
|
+
try {
|
|
37
|
+
worker = require.unstable_resolveWorker("../worker/jazz-broker-worker.js");
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
throw new Error(METRO_WORKER_API_ERROR);
|
|
41
|
+
}
|
|
42
|
+
return pageUrl(worker);
|
|
43
|
+
}
|
|
44
|
+
/** The binary shipped beside the worker, which is the pair the worker's glue was checked against. */
|
|
45
|
+
export function bundledWasmUrl() {
|
|
46
|
+
return pageUrl(require("../worker/jazz_wasm_bg.wasm"));
|
|
47
|
+
}
|
|
48
|
+
/** A Metro chunk is a classic script. */
|
|
49
|
+
export function bundledBrowserWorkerType() {
|
|
50
|
+
return "classic";
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=browser-worker-assets.metro.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-worker-assets.metro.js","sourceRoot":"","sources":["../../src/runtime/browser-worker-assets.metro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAShE,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,IAAI,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC;AACD,MAAM,UAAU,uBAAuB;IACrC,oEAAoE;IACpE,0EAA0E;IAC1E,0EAA0E;IAC1E,uEAAuE;IACvE,6DAA6D;IAC7D,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC;QACH,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,iCAAiC,CAAC,CAAC;IAC7E,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;AACzB,CAAC;AAED,qGAAqG;AACrG,MAAM,UAAU,cAAc;IAC5B,OAAO,OAAO,CAAC,OAAO,CAAC,6BAA6B,CAAW,CAAC,CAAC;AACnE,CAAC;AAED,yCAAyC;AACzC,MAAM,UAAU,wBAAwB;IACtC,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/**\n * Expo web takes this module in place of `browser-worker-assets.ts`, through\n * `withJazz` from `jazz-tools/expo/metro`. See that module for the exports.\n *\n * Metro does not follow `new URL(..., import.meta.url)`, and Expo rewrites\n * `new SharedWorker(new URL(...))` into a dedicated Worker. So both assets go\n * through Metro's own graph here, which serves them in development and writes\n * them to an export under content-hashed names:\n * - the worker as a worker chunk, started by URL as a real SharedWorker;\n * - the WASM as an asset (`withJazz` adds `wasm` to `assetExts`).\n *\n * The chunk is the shipped worker. Expo compiles its `import.meta` to a\n * registry that worker chunks do not have, so the worker must not read\n * `import.meta.url` here: the page hands it the WASM URL, and the loader asks\n * for its own module's URL only when it has none.\n */\n\nimport { METRO_WORKER_API_ERROR } from \"./metro-setup-error.js\";\n\n// Metro's module-scoped `require`. `unstable_resolveWorker` is how Expo names\n// a worker chunk without constructing the worker.\ndeclare const require: {\n (path: string): unknown;\n unstable_resolveWorker(path: string): string;\n};\n\nfunction pageUrl(path: string): string {\n return new URL(path, location.href).href;\n}\n\n/**\n * Expo's `import.meta.url` is the URL of the script that is executing, and is\n * null once that script has finished (SDK 54). A Metro bundle is served from\n * the page's origin, so the page stands in for the module.\n */\nexport function browserRuntimeModuleUrl(): string {\n return location.href;\n}\nexport function bundledBrowserWorkerUrl(): string {\n // Expo rewrites this exact call at build time (@expo/metro-config's\n // collect-dependencies matches `require.unstable_resolveWorker(...)`), so\n // `require.unstable_resolveWorker` never exists at runtime: never read it\n // except in this call. Undocumented in Expo, so a Metro that no longer\n // rewrites it fails here by name, not with a bare TypeError.\n let worker: string;\n try {\n worker = require.unstable_resolveWorker(\"../worker/jazz-broker-worker.js\");\n } catch {\n throw new Error(METRO_WORKER_API_ERROR);\n }\n return pageUrl(worker);\n}\n\n/** The binary shipped beside the worker, which is the pair the worker's glue was checked against. */\nexport function bundledWasmUrl(): string | null {\n return pageUrl(require(\"../worker/jazz_wasm_bg.wasm\") as string);\n}\n\n/** A Metro chunk is a classic script. */\nexport function bundledBrowserWorkerType(): WorkerType | null {\n return \"classic\";\n}\n"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
declare function unsupported(): never;
|
|
2
2
|
export declare const browserRuntimeModuleUrl: typeof unsupported;
|
|
3
3
|
export declare const bundledBrowserWorkerUrl: typeof unsupported;
|
|
4
|
+
export declare const bundledWasmUrl: typeof unsupported;
|
|
5
|
+
export declare const bundledBrowserWorkerType: typeof unsupported;
|
|
4
6
|
export {};
|
|
5
7
|
//# sourceMappingURL=browser-worker-assets.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-worker-assets.native.d.ts","sourceRoot":"","sources":["../../src/runtime/browser-worker-assets.native.ts"],"names":[],"mappings":"AAAA,iBAAS,WAAW,IAAI,KAAK,CAE5B;AACD,eAAO,MAAM,uBAAuB,oBAAc,CAAC;AACnD,eAAO,MAAM,uBAAuB,oBAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"browser-worker-assets.native.d.ts","sourceRoot":"","sources":["../../src/runtime/browser-worker-assets.native.ts"],"names":[],"mappings":"AAAA,iBAAS,WAAW,IAAI,KAAK,CAE5B;AACD,eAAO,MAAM,uBAAuB,oBAAc,CAAC;AACnD,eAAO,MAAM,uBAAuB,oBAAc,CAAC;AACnD,eAAO,MAAM,cAAc,oBAAc,CAAC;AAC1C,eAAO,MAAM,wBAAwB,oBAAc,CAAC"}
|
|
@@ -3,4 +3,6 @@ function unsupported() {
|
|
|
3
3
|
}
|
|
4
4
|
export const browserRuntimeModuleUrl = unsupported;
|
|
5
5
|
export const bundledBrowserWorkerUrl = unsupported;
|
|
6
|
+
export const bundledWasmUrl = unsupported;
|
|
7
|
+
export const bundledBrowserWorkerType = unsupported;
|
|
6
8
|
//# sourceMappingURL=browser-worker-assets.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-worker-assets.native.js","sourceRoot":"","sources":["../../src/runtime/browser-worker-assets.native.ts"],"names":[],"mappings":"AAAA,SAAS,WAAW;IAClB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;AAC3E,CAAC;AACD,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAC;AACnD,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAC","sourcesContent":["function unsupported(): never {\n throw new Error(\"Browser worker assets are unavailable on React Native\");\n}\nexport const browserRuntimeModuleUrl = unsupported;\nexport const bundledBrowserWorkerUrl = unsupported;\n"]}
|
|
1
|
+
{"version":3,"file":"browser-worker-assets.native.js","sourceRoot":"","sources":["../../src/runtime/browser-worker-assets.native.ts"],"names":[],"mappings":"AAAA,SAAS,WAAW;IAClB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;AAC3E,CAAC;AACD,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAC;AACnD,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAC;AACnD,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAC1C,MAAM,CAAC,MAAM,wBAAwB,GAAG,WAAW,CAAC","sourcesContent":["function unsupported(): never {\n throw new Error(\"Browser worker assets are unavailable on React Native\");\n}\nexport const browserRuntimeModuleUrl = unsupported;\nexport const bundledBrowserWorkerUrl = unsupported;\nexport const bundledWasmUrl = unsupported;\nexport const bundledBrowserWorkerType = unsupported;\n"]}
|
|
@@ -2,6 +2,29 @@ import type { RuntimeSourcesConfig } from "./context.js";
|
|
|
2
2
|
import type { DbConfig } from "./db.js";
|
|
3
3
|
/** Resolve the exact script URL that identifies the origin-wide SharedWorker. */
|
|
4
4
|
export declare function resolveBrowserWorkerUrl(runtimeSources?: RuntimeSourcesConfig): string;
|
|
5
|
+
/** The package export the Vite dev server resolves to the broker worker entry. */
|
|
6
|
+
export declare const BROKER_WORKER_EXPORT = "jazz-tools/_worker/broker";
|
|
7
|
+
/**
|
|
8
|
+
* Where the Vite dev server serves the broker worker when Jazz runs from its
|
|
9
|
+
* dependency pre-bundle, or undefined anywhere else.
|
|
10
|
+
*
|
|
11
|
+
* Pre-bundling moves Jazz's code into one chunk under `.vite/deps`, so the
|
|
12
|
+
* worker literal `new URL("../../worker/jazz-broker-worker.js", import.meta.url)`
|
|
13
|
+
* no longer sits next to the worker file. Vite 6 and 7 resolve it against the
|
|
14
|
+
* chunk, to a path that doesn't exist (the dev server answers it with
|
|
15
|
+
* index.html); only Vite 8 rewrites it. The dev server itself can resolve the
|
|
16
|
+
* package, wherever the package manager put it: `<base>@id/<bare id>` asks it
|
|
17
|
+
* to, through jazz-tools' own `exports`. This covers every Vite version, and
|
|
18
|
+
* nothing outside the dev server's pre-bundle takes this path.
|
|
19
|
+
*
|
|
20
|
+
* The URL carries Vite's own worker-entry query, `worker_file&type=module`, as
|
|
21
|
+
* every worker URL Vite generates does. Without it the dev server treats the
|
|
22
|
+
* bare id as one more dependency and pre-bundles the worker into `.vite/deps`
|
|
23
|
+
* too, which moves the worker's own `new URL("jazz_wasm_bg.wasm",
|
|
24
|
+
* import.meta.url)` there: the worker starts, and then loads index.html as its
|
|
25
|
+
* WASM. With it, the dev server serves the worker from the package's files.
|
|
26
|
+
*/
|
|
27
|
+
export declare function vitePrebundledBrokerWorkerUrl(moduleUrl: string): string | undefined;
|
|
5
28
|
/**
|
|
6
29
|
* Resolve page-owned asset configuration before it crosses into a SharedWorker.
|
|
7
30
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-worker-config.d.ts","sourceRoot":"","sources":["../../src/runtime/browser-worker-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"browser-worker-config.d.ts","sourceRoot":"","sources":["../../src/runtime/browser-worker-config.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAmBxC,iFAAiF;AACjF,wBAAgB,uBAAuB,CAAC,cAAc,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAsBrF;AAaD,kFAAkF;AAClF,eAAO,MAAM,oBAAoB,8BAA8B,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAYnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,kCAAkC,CAChD,cAAc,CAAC,EAAE,oBAAoB,GACpC,oBAAoB,GAAG,SAAS,CA0BlC;AAmBD;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAAC,cAAc,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAO3F;AA2BD,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GACjB,MAAM,CAoBR;AA+DD,+EAA+E;AAC/E,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAUpE;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAYlE;AAED;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAS1F;AAED;;;;;;;;;GASG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQ5F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clientScope } from "./client-scope.js";
|
|
2
|
-
import { browserRuntimeModuleUrl, bundledBrowserWorkerUrl } from "./browser-worker-assets.js";
|
|
2
|
+
import { browserRuntimeModuleUrl, bundledBrowserWorkerUrl, bundledWasmUrl, } from "./browser-worker-assets.js";
|
|
3
3
|
import { resolveClientInternalSessionSync } from "./client-session.js";
|
|
4
4
|
import { getTrustedReservedSession } from "./db-internal-session.js";
|
|
5
5
|
import { canonicalAuthorSubject } from "./author-id.js";
|
|
@@ -15,10 +15,63 @@ export function resolveBrowserWorkerUrl(runtimeSources) {
|
|
|
15
15
|
if (runtimeSources?.brokerWorkerUrl || runtimeSources?.baseUrl) {
|
|
16
16
|
return resolveRuntimeConfigBrokerWorkerUrl(browserRuntimeModuleUrl(), typeof location !== "undefined" ? location.href : undefined, runtimeSources);
|
|
17
17
|
}
|
|
18
|
+
const prebundledUrl = vitePrebundledBrokerWorkerUrl(browserRuntimeModuleUrl());
|
|
19
|
+
if (prebundledUrl) {
|
|
20
|
+
// Appended as text: re-serializing the query would turn Vite's exact
|
|
21
|
+
// `worker_file&type=module` marker into `worker_file=&type=module`.
|
|
22
|
+
return runtimeSources?.wasmVersion
|
|
23
|
+
? `${prebundledUrl}&jazz-runtime-version=${encodeURIComponent(runtimeSources.wasmVersion)}`
|
|
24
|
+
: prebundledUrl;
|
|
25
|
+
}
|
|
18
26
|
// Keep this literal statically analyzable so bundlers emit the worker asset.
|
|
19
27
|
const bundledUrl = bundledBrowserWorkerUrl();
|
|
20
28
|
return versionRuntimeAssetUrl(resolveConfiguredUrl(bundledUrl, typeof location !== "undefined" ? location.href : undefined), runtimeSources);
|
|
21
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The path of a module the Vite dev server pre-bundled: `<base>node_modules/.vite/deps/<chunk>.js`.
|
|
32
|
+
* The cache directory may nest the deps (`.vite/vitest/<hash>/deps`) or suffix
|
|
33
|
+
* them per environment (`deps_ssr`); anything else is not Vite's pre-bundle.
|
|
34
|
+
*/
|
|
35
|
+
const VITE_PREBUNDLED_MODULE_PATH = /^(.*?\/)node_modules\/\.vite\/(?:.*\/)?deps(?:_[^/]*)?\/[^/]+$/;
|
|
36
|
+
/** Vite's marker for a module worker entry, exactly as Vite writes it. */
|
|
37
|
+
const VITE_WORKER_ENTRY_QUERY = "worker_file&type=module";
|
|
38
|
+
/** The package export the Vite dev server resolves to the broker worker entry. */
|
|
39
|
+
export const BROKER_WORKER_EXPORT = "jazz-tools/_worker/broker";
|
|
40
|
+
/**
|
|
41
|
+
* Where the Vite dev server serves the broker worker when Jazz runs from its
|
|
42
|
+
* dependency pre-bundle, or undefined anywhere else.
|
|
43
|
+
*
|
|
44
|
+
* Pre-bundling moves Jazz's code into one chunk under `.vite/deps`, so the
|
|
45
|
+
* worker literal `new URL("../../worker/jazz-broker-worker.js", import.meta.url)`
|
|
46
|
+
* no longer sits next to the worker file. Vite 6 and 7 resolve it against the
|
|
47
|
+
* chunk, to a path that doesn't exist (the dev server answers it with
|
|
48
|
+
* index.html); only Vite 8 rewrites it. The dev server itself can resolve the
|
|
49
|
+
* package, wherever the package manager put it: `<base>@id/<bare id>` asks it
|
|
50
|
+
* to, through jazz-tools' own `exports`. This covers every Vite version, and
|
|
51
|
+
* nothing outside the dev server's pre-bundle takes this path.
|
|
52
|
+
*
|
|
53
|
+
* The URL carries Vite's own worker-entry query, `worker_file&type=module`, as
|
|
54
|
+
* every worker URL Vite generates does. Without it the dev server treats the
|
|
55
|
+
* bare id as one more dependency and pre-bundles the worker into `.vite/deps`
|
|
56
|
+
* too, which moves the worker's own `new URL("jazz_wasm_bg.wasm",
|
|
57
|
+
* import.meta.url)` there: the worker starts, and then loads index.html as its
|
|
58
|
+
* WASM. With it, the dev server serves the worker from the package's files.
|
|
59
|
+
*/
|
|
60
|
+
export function vitePrebundledBrokerWorkerUrl(moduleUrl) {
|
|
61
|
+
let url;
|
|
62
|
+
try {
|
|
63
|
+
url = new URL(moduleUrl);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
if (url.protocol !== "http:" && url.protocol !== "https:")
|
|
69
|
+
return undefined;
|
|
70
|
+
const match = VITE_PREBUNDLED_MODULE_PATH.exec(url.pathname);
|
|
71
|
+
return match
|
|
72
|
+
? `${url.origin}${match[1]}@id/${BROKER_WORKER_EXPORT}?${VITE_WORKER_ENTRY_QUERY}`
|
|
73
|
+
: undefined;
|
|
74
|
+
}
|
|
22
75
|
/**
|
|
23
76
|
* Resolve page-owned asset configuration before it crosses into a SharedWorker.
|
|
24
77
|
*
|
|
@@ -30,8 +83,10 @@ export function resolveBrowserWorkerUrl(runtimeSources) {
|
|
|
30
83
|
*/
|
|
31
84
|
export function resolveBrowserWorkerRuntimeSources(runtimeSources) {
|
|
32
85
|
if (!runtimeSources)
|
|
33
|
-
return runtimeSources;
|
|
34
|
-
if ((runtimeSources.baseUrl ||
|
|
86
|
+
return withBundledWasmUrl(runtimeSources);
|
|
87
|
+
if ((runtimeSources.baseUrl ||
|
|
88
|
+
(runtimeSources.wasmUrl && !isBundledWasmUrl(runtimeSources.wasmUrl)) ||
|
|
89
|
+
runtimeSources.brokerWorkerUrl) &&
|
|
35
90
|
!runtimeSources.wasmVersion) {
|
|
36
91
|
throw new Error("Configured browser runtime assets require runtimeSources.wasmVersion. Use an immutable build version that changes whenever the WASM or worker bytes change.");
|
|
37
92
|
}
|
|
@@ -41,9 +96,22 @@ export function resolveBrowserWorkerRuntimeSources(runtimeSources) {
|
|
|
41
96
|
}
|
|
42
97
|
const wasmUrl = resolveRuntimeConfigWasmUrl(browserRuntimeModuleUrl(), typeof location !== "undefined" ? location.href : undefined, runtimeSources);
|
|
43
98
|
if (!wasmUrl)
|
|
44
|
-
return runtimeSources;
|
|
99
|
+
return withBundledWasmUrl(runtimeSources);
|
|
45
100
|
return { ...runtimeSources, wasmUrl };
|
|
46
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Hand the worker the bundler's URL for the binary when the bundler has one
|
|
104
|
+
* (Metro). The worker is a separate chunk that cannot name the asset itself.
|
|
105
|
+
* The bundler owns this URL and changes it with the bytes, so it carries no
|
|
106
|
+
* `wasmVersion`.
|
|
107
|
+
*/
|
|
108
|
+
function withBundledWasmUrl(runtimeSources) {
|
|
109
|
+
const wasmUrl = bundledWasmUrl();
|
|
110
|
+
return wasmUrl ? { ...runtimeSources, wasmUrl } : runtimeSources;
|
|
111
|
+
}
|
|
112
|
+
function isBundledWasmUrl(wasmUrl) {
|
|
113
|
+
return wasmUrl === bundledWasmUrl();
|
|
114
|
+
}
|
|
47
115
|
/**
|
|
48
116
|
* Name SharedWorker realms by the code/asset pair they can safely host.
|
|
49
117
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-worker-config.js","sourceRoot":"","sources":["../../src/runtime/browser-worker-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAG9F,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAA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AG,EAAE,MAAM,CAAC,GAAG,IAAI,KAAK;QACxB,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC;KAClC,CAAC,CAAC;IACH,OAAO,GAAG,QAAQ,sBAAsB,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAgB;IACxC,IAAI,MAAM,CAAC,WAAW;QAAE,OAAO,OAAO,CAAC;IACvC,MAAM,OAAO,GAAG,gCAAgC,CAAC;QAC/C,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC;QAC1B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,sBAAsB,EAAE,yBAAyB,CAAC,MAAM,CAAC;KAC1D,CAAC,CAAC;IACH,IAAI,CAAC,OAAO,EAAE,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,WAAW;QAAE,OAAO,WAAW,CAAC;IAC9E,OAAO,GAAG,OAAO,CAAC,QAAQ,IAAI,sBAAsB,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;AAC9G,CAAC","sourcesContent":["import { clientScope } from \"./client-scope.js\";\nimport { browserRuntimeModuleUrl, bundledBrowserWorkerUrl } from \"./browser-worker-assets.js\";\nimport type { RuntimeSourcesConfig } from \"./context.js\";\nimport type { DbConfig } from \"./db.js\";\nimport { resolveClientInternalSessionSync } from \"./client-session.js\";\nimport { getTrustedReservedSession } from \"./db-internal-session.js\";\nimport { canonicalAuthorSubject } from \"./author-id.js\";\nimport {\n resolveConfiguredUrl,\n resolveRuntimeConfigBrokerWorkerUrl,\n resolveRuntimeConfigWasmUrl,\n versionRuntimeAssetUrl,\n} from \"./runtime-config.js\";\n\nimport { normalizeOtlpEndpoint } from \"./sync-telemetry.js\";\n\nconst SHARED_RUNTIME_PROTOCOL_VERSION = \"jazz-shared-runtime-v2\";\n// Coupled to IndexedDbPageStore's durable epoch. Keeping it in the database\n// scope prevents an old worker from opening incompatible root metadata.\nconst BROWSER_STORAGE_FORMAT_VERSION = \"idbtree-v1\";\nconst inMemoryWasmAssetIds = new WeakMap<object, string>();\n\n/** Resolve the exact script URL that identifies the origin-wide SharedWorker. */\nexport function resolveBrowserWorkerUrl(runtimeSources?: RuntimeSourcesConfig): string {\n if (runtimeSources?.brokerWorkerUrl || runtimeSources?.baseUrl) {\n return resolveRuntimeConfigBrokerWorkerUrl(\n browserRuntimeModuleUrl(),\n typeof location !== \"undefined\" ? location.href : undefined,\n runtimeSources,\n );\n }\n // Keep this literal statically analyzable so bundlers emit the worker asset.\n const bundledUrl = bundledBrowserWorkerUrl();\n return versionRuntimeAssetUrl(\n resolveConfiguredUrl(bundledUrl, typeof location !== \"undefined\" ? location.href : undefined),\n runtimeSources,\n );\n}\n\n/**\n * Resolve page-owned asset configuration before it crosses into a SharedWorker.\n *\n * A relative `wasmUrl` or `baseUrl` belongs to the page which selected it, not\n * to the worker script. Those can legitimately have different origins during\n * Vite development, a rolling deployment, or a test server restart. Sending\n * the relative form lets a long-lived worker reinterpret it relative to its\n * own (possibly stale) script URL and fetch an HTML fallback as WASM.\n */\nexport function resolveBrowserWorkerRuntimeSources(\n runtimeSources?: RuntimeSourcesConfig,\n): RuntimeSourcesConfig | undefined {\n if (!runtimeSources) return runtimeSources;\n\n if (\n (runtimeSources.baseUrl || runtimeSources.wasmUrl || runtimeSources.brokerWorkerUrl) &&\n !runtimeSources.wasmVersion\n ) {\n throw new Error(\n \"Configured browser runtime assets require runtimeSources.wasmVersion. Use an immutable build version that changes whenever the WASM or worker bytes change.\",\n );\n }\n\n const workerWasmAssetIdentity = inMemoryWasmAssetIdentity(runtimeSources);\n if (workerWasmAssetIdentity) {\n return { ...runtimeSources, workerWasmAssetIdentity };\n }\n\n const wasmUrl = resolveRuntimeConfigWasmUrl(\n browserRuntimeModuleUrl(),\n typeof location !== \"undefined\" ? location.href : undefined,\n runtimeSources,\n );\n if (!wasmUrl) return runtimeSources;\n return { ...runtimeSources, wasmUrl };\n}\n\n/**\n * Name SharedWorker realms by the code/asset pair they can safely host.\n *\n * A worker module owns one wasm-bindgen initialization for its entire process\n * lifetime. Keeping this scope out of the database name allows an old Vite\n * origin or an earlier deployment to keep serving a new tab with its stale\n * asset URL. The complete canonical identity is intentionally kept instead\n * of a short hash: a collision must not let incompatible WASM bytes share a\n * process-global wasm-bindgen module.\n */\nexport function createBrowserWorkerAssetScope(runtimeSources?: RuntimeSourcesConfig): string {\n const resolvedSources = resolveBrowserWorkerRuntimeSources(runtimeSources);\n return JSON.stringify({\n protocolVersion: SHARED_RUNTIME_PROTOCOL_VERSION,\n workerUrl: resolveBrowserWorkerUrl(resolvedSources),\n wasmAsset: workerWasmAssetIdentity(resolvedSources),\n });\n}\n\nfunction inMemoryWasmAssetIdentity(runtimeSources: RuntimeSourcesConfig): string | undefined {\n const [value, kind] = runtimeSources.wasmModule\n ? [runtimeSources.wasmModule, \"module\"]\n : runtimeSources.wasmSource\n ? [runtimeSources.wasmSource, \"source\"]\n : [];\n if (!value || !kind) return undefined;\n let identity = inMemoryWasmAssetIds.get(value);\n if (!identity) {\n identity = `${kind}:${crypto.randomUUID()}`;\n inMemoryWasmAssetIds.set(value, identity);\n }\n return identity;\n}\n\nfunction workerWasmAssetIdentity(runtimeSources?: RuntimeSourcesConfig): string {\n if (runtimeSources?.wasmModule) {\n return `module:${runtimeSources.workerWasmAssetIdentity ?? \"unscoped\"}`;\n }\n if (runtimeSources?.wasmSource) {\n return `source:${runtimeSources.workerWasmAssetIdentity ?? \"unscoped\"}`;\n }\n return `url:${runtimeSources?.wasmUrl ?? \"worker-local\"}`;\n}\n\nexport function createBrowserWorkerFingerprint(\n config: DbConfig,\n dbName: string,\n schemaHash: string,\n): string {\n const collectorUrl = config.telemetryCollectorUrl?.trim() || undefined;\n return JSON.stringify({\n protocolVersion: SHARED_RUNTIME_PROTOCOL_VERSION,\n storageFormatVersion: BROWSER_STORAGE_FORMAT_VERSION,\n appId: clientScope(config),\n dbName,\n env: config.env ?? \"dev\",\n schemaHash,\n authClass: resolveAuthClass(config),\n workerUrl: resolveBrowserWorkerUrl(config.runtimeSources),\n workerAssetScope: createBrowserWorkerAssetScope(config.runtimeSources),\n telemetryCollector: collectorUrl\n ? {\n traceUrl: normalizeOtlpEndpoint(collectorUrl, \"traces\"),\n logUrl: normalizeOtlpEndpoint(collectorUrl, \"logs\"),\n }\n : undefined,\n wasmLogLevel: config.logLevel ?? \"warn\",\n });\n}\n\n/**\n * Exact, non-secret authentication scope carried by browser worker and\n * durable-owner metadata.\n *\n * This deliberately names the authenticated principal rather than hashing it:\n * the identifier is already the canonical public encoding of\n * `session.identity` (`[issuer, subject]`), and a collision here could give two accounts the same\n * worker or physical store. Tokens, secrets, claims, expiry and other\n * credentials are never included. Anonymous callers intentionally share their\n * app/environment scope; a browser persistent worker never admits a backend,\n * but `system` keeps this representation total for defensive callers.\n */\ntype BrowserAuthScope =\n | { kind: \"anonymous\" }\n | { kind: \"system\" }\n | {\n kind: \"principal\";\n authMode: \"external\" | \"local-first\";\n user: string;\n };\n\nfunction browserAuthScope(config: DbConfig): BrowserAuthScope {\n if (config.adminSecret) return { kind: \"system\" };\n\n const session = resolveClientInternalSessionSync({\n appId: clientScope(config),\n accountId: config.accountId,\n jwtToken: config.jwtToken,\n cookieSession: config.cookieSession,\n trustedReservedSession: getTrustedReservedSession(config),\n });\n if (!session || session.authMode === \"anonymous\") return { kind: \"anonymous\" };\n\n return {\n kind: \"principal\",\n authMode: session.authMode,\n // Reuse the public/session and row-authorship identity codec. JSON array\n // encoding preserves exact issuer + subject boundaries and spelling.\n user: canonicalAuthorSubject(session.issuer, session.user_id, session.account_id),\n };\n}\n\nfunction browserStorageScope(\n config: DbConfig,\n): BrowserAuthScope | { kind: \"account\"; account: string; registry: string } {\n if (config.accountId && !config.adminSecret) {\n return {\n kind: \"account\",\n account: config.accountId,\n registry: accountRegistryAuthority(config),\n };\n }\n return browserAuthScope(config);\n}\n\nfunction accountRegistryAuthority(config: DbConfig): string {\n if (!config.accountRegistryAuthority)\n throw new Error(\"Account storage requires its registry authority\");\n return config.accountRegistryAuthority;\n}\n\n/** Stable, non-secret exact namespace for one browser authentication scope. */\nexport function createBrowserAuthSessionKey(config: DbConfig): string {\n // Authentication scopes are also app/environment-scoped. Two apps may use\n // the same external provider subject without sharing a relay lifecycle.\n return JSON.stringify({\n version: 1,\n appId: clientScope(config),\n env: config.env ?? \"dev\",\n auth: browserAuthScope(config),\n ...(config.accountId ? { registry: accountRegistryAuthority(config) } : {}),\n });\n}\n\n/**\n * Stable, non-secret owner identity for a physical browser persistence root.\n * This is intentionally separate from the IDB name (physical location) and\n * from the foreground replica/node identity. An explicitly supplied name is\n * therefore still safe: it is permanently bound to one app/environment/auth\n * scope until the caller explicitly destroys that database.\n */\nexport function createBrowserStorageOwner(config: DbConfig): string {\n // This is the exact durable value stored under\n // INDEXEDDB_BROWSER_RUNTIME_OWNER_KEY. Keep it canonical JSON: changing its\n // shape is a deliberate browser-owner-marker schema migration, not a hash\n // implementation detail. The marker contains only app/environment and the\n // auth scope above, never a credential or arbitrary claims.\n return JSON.stringify({\n version: 1,\n appId: clientScope(config),\n env: config.env ?? \"dev\",\n auth: browserStorageScope(config),\n });\n}\n\n/**\n * A persistent browser root is durably bound to its opening principal. Token\n * refresh for that principal is safe; changing principal in a live runtime is\n * not. Callers must shut down and reopen (or explicitly reset) instead of\n * briefly exposing the old root under the new session.\n */\nexport function assertBrowserStorageOwnerUnchanged(current: DbConfig, next: DbConfig): void {\n if (\n createBrowserStorageOwner(current) !== createBrowserStorageOwner(next) ||\n createBrowserAuthSessionKey(current) !== createBrowserAuthSessionKey(next)\n ) {\n throw new Error(\n \"Cannot change the authenticated user of a live persistent browser Db; shut it down and reopen for the new user, or explicitly reset its storage\",\n );\n }\n}\n\n/**\n * Derive the physical IndexedDB/SharedWorker namespace from a caller-selected\n * logical base and its complete, non-secret browser storage scope.\n *\n * `driver.dbName` and `config.dbName` are deliberately bases, not physical\n * roots. This lets a shared device retain caches for Alice and Bob under the\n * same application-selected base while routing each open back to the right\n * account. The durable owner marker remains an independent backstop if a\n * caller or future derivation ever reaches the wrong physical root.\n */\nexport function createBrowserPhysicalDatabaseName(config: DbConfig, baseName: string): string {\n const scope = JSON.stringify({\n version: 1,\n appId: clientScope(config),\n env: config.env ?? \"dev\",\n auth: browserStorageScope(config),\n });\n return `${baseName}::jazz-browser-v1::${encodeURIComponent(scope)}`;\n}\n\nfunction resolveAuthClass(config: DbConfig): string {\n if (config.adminSecret) return \"admin\";\n const session = resolveClientInternalSessionSync({\n appId: clientScope(config),\n accountId: config.accountId,\n jwtToken: config.jwtToken,\n cookieSession: config.cookieSession,\n trustedReservedSession: getTrustedReservedSession(config),\n });\n if (!session?.user_id || session.authMode === \"anonymous\") return \"anonymous\";\n return `${session.authMode}:${canonicalAuthorSubject(session.issuer, session.user_id, session.account_id)}`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"browser-worker-config.js","sourceRoot":"","sources":["../../src/runtime/browser-worker-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,cAAc,GACf,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EACL,oBAAoB,EACpB,mCAAmC,EACnC,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,+BAA+B,GAAG,wBAAwB,CAAC;AACjE,4EAA4E;A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,CAAC,GAAG,IAAI,KAAK;QACxB,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC;KAClC,CAAC,CAAC;IACH,OAAO,GAAG,QAAQ,sBAAsB,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAgB;IACxC,IAAI,MAAM,CAAC,WAAW;QAAE,OAAO,OAAO,CAAC;IACvC,MAAM,OAAO,GAAG,gCAAgC,CAAC;QAC/C,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC;QAC1B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,sBAAsB,EAAE,yBAAyB,CAAC,MAAM,CAAC;KAC1D,CAAC,CAAC;IACH,IAAI,CAAC,OAAO,EAAE,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,WAAW;QAAE,OAAO,WAAW,CAAC;IAC9E,OAAO,GAAG,OAAO,CAAC,QAAQ,IAAI,sBAAsB,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;AAC9G,CAAC","sourcesContent":["import { clientScope } from \"./client-scope.js\";\nimport {\n browserRuntimeModuleUrl,\n bundledBrowserWorkerUrl,\n bundledWasmUrl,\n} from \"./browser-worker-assets.js\";\nimport type { RuntimeSourcesConfig } from \"./context.js\";\nimport type { DbConfig } from \"./db.js\";\nimport { resolveClientInternalSessionSync } from \"./client-session.js\";\nimport { getTrustedReservedSession } from \"./db-internal-session.js\";\nimport { canonicalAuthorSubject } from \"./author-id.js\";\nimport {\n resolveConfiguredUrl,\n resolveRuntimeConfigBrokerWorkerUrl,\n resolveRuntimeConfigWasmUrl,\n versionRuntimeAssetUrl,\n} from \"./runtime-config.js\";\n\nimport { normalizeOtlpEndpoint } from \"./sync-telemetry.js\";\n\nconst SHARED_RUNTIME_PROTOCOL_VERSION = \"jazz-shared-runtime-v2\";\n// Coupled to IndexedDbPageStore's durable epoch. Keeping it in the database\n// scope prevents an old worker from opening incompatible root metadata.\nconst BROWSER_STORAGE_FORMAT_VERSION = \"idbtree-v1\";\nconst inMemoryWasmAssetIds = new WeakMap<object, string>();\n\n/** Resolve the exact script URL that identifies the origin-wide SharedWorker. */\nexport function resolveBrowserWorkerUrl(runtimeSources?: RuntimeSourcesConfig): string {\n if (runtimeSources?.brokerWorkerUrl || runtimeSources?.baseUrl) {\n return resolveRuntimeConfigBrokerWorkerUrl(\n browserRuntimeModuleUrl(),\n typeof location !== \"undefined\" ? location.href : undefined,\n runtimeSources,\n );\n }\n const prebundledUrl = vitePrebundledBrokerWorkerUrl(browserRuntimeModuleUrl());\n if (prebundledUrl) {\n // Appended as text: re-serializing the query would turn Vite's exact\n // `worker_file&type=module` marker into `worker_file=&type=module`.\n return runtimeSources?.wasmVersion\n ? `${prebundledUrl}&jazz-runtime-version=${encodeURIComponent(runtimeSources.wasmVersion)}`\n : prebundledUrl;\n }\n // Keep this literal statically analyzable so bundlers emit the worker asset.\n const bundledUrl = bundledBrowserWorkerUrl();\n return versionRuntimeAssetUrl(\n resolveConfiguredUrl(bundledUrl, typeof location !== \"undefined\" ? location.href : undefined),\n runtimeSources,\n );\n}\n\n/**\n * The path of a module the Vite dev server pre-bundled: `<base>node_modules/.vite/deps/<chunk>.js`.\n * The cache directory may nest the deps (`.vite/vitest/<hash>/deps`) or suffix\n * them per environment (`deps_ssr`); anything else is not Vite's pre-bundle.\n */\nconst VITE_PREBUNDLED_MODULE_PATH =\n /^(.*?\\/)node_modules\\/\\.vite\\/(?:.*\\/)?deps(?:_[^/]*)?\\/[^/]+$/;\n\n/** Vite's marker for a module worker entry, exactly as Vite writes it. */\nconst VITE_WORKER_ENTRY_QUERY = \"worker_file&type=module\";\n\n/** The package export the Vite dev server resolves to the broker worker entry. */\nexport const BROKER_WORKER_EXPORT = \"jazz-tools/_worker/broker\";\n\n/**\n * Where the Vite dev server serves the broker worker when Jazz runs from its\n * dependency pre-bundle, or undefined anywhere else.\n *\n * Pre-bundling moves Jazz's code into one chunk under `.vite/deps`, so the\n * worker literal `new URL(\"../../worker/jazz-broker-worker.js\", import.meta.url)`\n * no longer sits next to the worker file. Vite 6 and 7 resolve it against the\n * chunk, to a path that doesn't exist (the dev server answers it with\n * index.html); only Vite 8 rewrites it. The dev server itself can resolve the\n * package, wherever the package manager put it: `<base>@id/<bare id>` asks it\n * to, through jazz-tools' own `exports`. This covers every Vite version, and\n * nothing outside the dev server's pre-bundle takes this path.\n *\n * The URL carries Vite's own worker-entry query, `worker_file&type=module`, as\n * every worker URL Vite generates does. Without it the dev server treats the\n * bare id as one more dependency and pre-bundles the worker into `.vite/deps`\n * too, which moves the worker's own `new URL(\"jazz_wasm_bg.wasm\",\n * import.meta.url)` there: the worker starts, and then loads index.html as its\n * WASM. With it, the dev server serves the worker from the package's files.\n */\nexport function vitePrebundledBrokerWorkerUrl(moduleUrl: string): string | undefined {\n let url: URL;\n try {\n url = new URL(moduleUrl);\n } catch {\n return undefined;\n }\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") return undefined;\n const match = VITE_PREBUNDLED_MODULE_PATH.exec(url.pathname);\n return match\n ? `${url.origin}${match[1]}@id/${BROKER_WORKER_EXPORT}?${VITE_WORKER_ENTRY_QUERY}`\n : undefined;\n}\n\n/**\n * Resolve page-owned asset configuration before it crosses into a SharedWorker.\n *\n * A relative `wasmUrl` or `baseUrl` belongs to the page which selected it, not\n * to the worker script. Those can legitimately have different origins during\n * Vite development, a rolling deployment, or a test server restart. Sending\n * the relative form lets a long-lived worker reinterpret it relative to its\n * own (possibly stale) script URL and fetch an HTML fallback as WASM.\n */\nexport function resolveBrowserWorkerRuntimeSources(\n runtimeSources?: RuntimeSourcesConfig,\n): RuntimeSourcesConfig | undefined {\n if (!runtimeSources) return withBundledWasmUrl(runtimeSources);\n\n if (\n (runtimeSources.baseUrl ||\n (runtimeSources.wasmUrl && !isBundledWasmUrl(runtimeSources.wasmUrl)) ||\n runtimeSources.brokerWorkerUrl) &&\n !runtimeSources.wasmVersion\n ) {\n throw new Error(\n \"Configured browser runtime assets require runtimeSources.wasmVersion. Use an immutable build version that changes whenever the WASM or worker bytes change.\",\n );\n }\n\n const workerWasmAssetIdentity = inMemoryWasmAssetIdentity(runtimeSources);\n if (workerWasmAssetIdentity) {\n return { ...runtimeSources, workerWasmAssetIdentity };\n }\n\n const wasmUrl = resolveRuntimeConfigWasmUrl(\n browserRuntimeModuleUrl(),\n typeof location !== \"undefined\" ? location.href : undefined,\n runtimeSources,\n );\n if (!wasmUrl) return withBundledWasmUrl(runtimeSources);\n return { ...runtimeSources, wasmUrl };\n}\n\n/**\n * Hand the worker the bundler's URL for the binary when the bundler has one\n * (Metro). The worker is a separate chunk that cannot name the asset itself.\n * The bundler owns this URL and changes it with the bytes, so it carries no\n * `wasmVersion`.\n */\nfunction withBundledWasmUrl(\n runtimeSources: RuntimeSourcesConfig | undefined,\n): RuntimeSourcesConfig | undefined {\n const wasmUrl = bundledWasmUrl();\n return wasmUrl ? { ...runtimeSources, wasmUrl } : runtimeSources;\n}\n\nfunction isBundledWasmUrl(wasmUrl: string): boolean {\n return wasmUrl === bundledWasmUrl();\n}\n\n/**\n * Name SharedWorker realms by the code/asset pair they can safely host.\n *\n * A worker module owns one wasm-bindgen initialization for its entire process\n * lifetime. Keeping this scope out of the database name allows an old Vite\n * origin or an earlier deployment to keep serving a new tab with its stale\n * asset URL. The complete canonical identity is intentionally kept instead\n * of a short hash: a collision must not let incompatible WASM bytes share a\n * process-global wasm-bindgen module.\n */\nexport function createBrowserWorkerAssetScope(runtimeSources?: RuntimeSourcesConfig): string {\n const resolvedSources = resolveBrowserWorkerRuntimeSources(runtimeSources);\n return JSON.stringify({\n protocolVersion: SHARED_RUNTIME_PROTOCOL_VERSION,\n workerUrl: resolveBrowserWorkerUrl(resolvedSources),\n wasmAsset: workerWasmAssetIdentity(resolvedSources),\n });\n}\n\nfunction inMemoryWasmAssetIdentity(runtimeSources: RuntimeSourcesConfig): string | undefined {\n const [value, kind] = runtimeSources.wasmModule\n ? [runtimeSources.wasmModule, \"module\"]\n : runtimeSources.wasmSource\n ? [runtimeSources.wasmSource, \"source\"]\n : [];\n if (!value || !kind) return undefined;\n let identity = inMemoryWasmAssetIds.get(value);\n if (!identity) {\n identity = `${kind}:${crypto.randomUUID()}`;\n inMemoryWasmAssetIds.set(value, identity);\n }\n return identity;\n}\n\nfunction workerWasmAssetIdentity(runtimeSources?: RuntimeSourcesConfig): string {\n if (runtimeSources?.wasmModule) {\n return `module:${runtimeSources.workerWasmAssetIdentity ?? \"unscoped\"}`;\n }\n if (runtimeSources?.wasmSource) {\n return `source:${runtimeSources.workerWasmAssetIdentity ?? \"unscoped\"}`;\n }\n return `url:${runtimeSources?.wasmUrl ?? \"worker-local\"}`;\n}\n\nexport function createBrowserWorkerFingerprint(\n config: DbConfig,\n dbName: string,\n schemaHash: string,\n): string {\n const collectorUrl = config.telemetryCollectorUrl?.trim() || undefined;\n return JSON.stringify({\n protocolVersion: SHARED_RUNTIME_PROTOCOL_VERSION,\n storageFormatVersion: BROWSER_STORAGE_FORMAT_VERSION,\n appId: clientScope(config),\n dbName,\n env: config.env ?? \"dev\",\n schemaHash,\n authClass: resolveAuthClass(config),\n workerUrl: resolveBrowserWorkerUrl(config.runtimeSources),\n workerAssetScope: createBrowserWorkerAssetScope(config.runtimeSources),\n telemetryCollector: collectorUrl\n ? {\n traceUrl: normalizeOtlpEndpoint(collectorUrl, \"traces\"),\n logUrl: normalizeOtlpEndpoint(collectorUrl, \"logs\"),\n }\n : undefined,\n wasmLogLevel: config.logLevel ?? \"warn\",\n });\n}\n\n/**\n * Exact, non-secret authentication scope carried by browser worker and\n * durable-owner metadata.\n *\n * This deliberately names the authenticated principal rather than hashing it:\n * the identifier is already the canonical public encoding of\n * `session.identity` (`[issuer, subject]`), and a collision here could give two accounts the same\n * worker or physical store. Tokens, secrets, claims, expiry and other\n * credentials are never included. Anonymous callers intentionally share their\n * app/environment scope; a browser persistent worker never admits a backend,\n * but `system` keeps this representation total for defensive callers.\n */\ntype BrowserAuthScope =\n | { kind: \"anonymous\" }\n | { kind: \"system\" }\n | {\n kind: \"principal\";\n authMode: \"external\" | \"local-first\";\n user: string;\n };\n\nfunction browserAuthScope(config: DbConfig): BrowserAuthScope {\n if (config.adminSecret) return { kind: \"system\" };\n\n const session = resolveClientInternalSessionSync({\n appId: clientScope(config),\n accountId: config.accountId,\n jwtToken: config.jwtToken,\n cookieSession: config.cookieSession,\n trustedReservedSession: getTrustedReservedSession(config),\n });\n if (!session || session.authMode === \"anonymous\") return { kind: \"anonymous\" };\n\n return {\n kind: \"principal\",\n authMode: session.authMode,\n // Reuse the public/session and row-authorship identity codec. JSON array\n // encoding preserves exact issuer + subject boundaries and spelling.\n user: canonicalAuthorSubject(session.issuer, session.user_id, session.account_id),\n };\n}\n\nfunction browserStorageScope(\n config: DbConfig,\n): BrowserAuthScope | { kind: \"account\"; account: string; registry: string } {\n if (config.accountId && !config.adminSecret) {\n return {\n kind: \"account\",\n account: config.accountId,\n registry: accountRegistryAuthority(config),\n };\n }\n return browserAuthScope(config);\n}\n\nfunction accountRegistryAuthority(config: DbConfig): string {\n if (!config.accountRegistryAuthority)\n throw new Error(\"Account storage requires its registry authority\");\n return config.accountRegistryAuthority;\n}\n\n/** Stable, non-secret exact namespace for one browser authentication scope. */\nexport function createBrowserAuthSessionKey(config: DbConfig): string {\n // Authentication scopes are also app/environment-scoped. Two apps may use\n // the same external provider subject without sharing a relay lifecycle.\n return JSON.stringify({\n version: 1,\n appId: clientScope(config),\n env: config.env ?? \"dev\",\n auth: browserAuthScope(config),\n ...(config.accountId ? { registry: accountRegistryAuthority(config) } : {}),\n });\n}\n\n/**\n * Stable, non-secret owner identity for a physical browser persistence root.\n * This is intentionally separate from the IDB name (physical location) and\n * from the foreground replica/node identity. An explicitly supplied name is\n * therefore still safe: it is permanently bound to one app/environment/auth\n * scope until the caller explicitly destroys that database.\n */\nexport function createBrowserStorageOwner(config: DbConfig): string {\n // This is the exact durable value stored under\n // INDEXEDDB_BROWSER_RUNTIME_OWNER_KEY. Keep it canonical JSON: changing its\n // shape is a deliberate browser-owner-marker schema migration, not a hash\n // implementation detail. The marker contains only app/environment and the\n // auth scope above, never a credential or arbitrary claims.\n return JSON.stringify({\n version: 1,\n appId: clientScope(config),\n env: config.env ?? \"dev\",\n auth: browserStorageScope(config),\n });\n}\n\n/**\n * A persistent browser root is durably bound to its opening principal. Token\n * refresh for that principal is safe; changing principal in a live runtime is\n * not. Callers must shut down and reopen (or explicitly reset) instead of\n * briefly exposing the old root under the new session.\n */\nexport function assertBrowserStorageOwnerUnchanged(current: DbConfig, next: DbConfig): void {\n if (\n createBrowserStorageOwner(current) !== createBrowserStorageOwner(next) ||\n createBrowserAuthSessionKey(current) !== createBrowserAuthSessionKey(next)\n ) {\n throw new Error(\n \"Cannot change the authenticated user of a live persistent browser Db; shut it down and reopen for the new user, or explicitly reset its storage\",\n );\n }\n}\n\n/**\n * Derive the physical IndexedDB/SharedWorker namespace from a caller-selected\n * logical base and its complete, non-secret browser storage scope.\n *\n * `driver.dbName` and `config.dbName` are deliberately bases, not physical\n * roots. This lets a shared device retain caches for Alice and Bob under the\n * same application-selected base while routing each open back to the right\n * account. The durable owner marker remains an independent backstop if a\n * caller or future derivation ever reaches the wrong physical root.\n */\nexport function createBrowserPhysicalDatabaseName(config: DbConfig, baseName: string): string {\n const scope = JSON.stringify({\n version: 1,\n appId: clientScope(config),\n env: config.env ?? \"dev\",\n auth: browserStorageScope(config),\n });\n return `${baseName}::jazz-browser-v1::${encodeURIComponent(scope)}`;\n}\n\nfunction resolveAuthClass(config: DbConfig): string {\n if (config.adminSecret) return \"admin\";\n const session = resolveClientInternalSessionSync({\n appId: clientScope(config),\n accountId: config.accountId,\n jwtToken: config.jwtToken,\n cookieSession: config.cookieSession,\n trustedReservedSession: getTrustedReservedSession(config),\n });\n if (!session?.user_id || session.authMode === \"anonymous\") return \"anonymous\";\n return `${session.authMode}:${canonicalAuthorSubject(session.issuer, session.user_id, session.account_id)}`;\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { WasmSchema } from "../drivers/types.js";
|
|
2
2
|
/**
|
|
3
3
|
* The app's schema versions and the migrations between them (the `schemas`
|
|
4
|
-
* and `migrations` a deployment publishes).
|
|
5
|
-
* `migrations/index.ts` beside schema.ts on
|
|
6
|
-
*
|
|
7
|
-
* `defineApp`:
|
|
4
|
+
* and `migrations` a deployment publishes). Once schema.ts imports them,
|
|
5
|
+
* `jazz-tools` generates them in `migrations/index.ts` beside schema.ts on
|
|
6
|
+
* every validate and `migrations create`, even while the app has a single
|
|
7
|
+
* version, and the app passes them to `defineApp`:
|
|
8
8
|
*
|
|
9
9
|
* ```ts
|
|
10
10
|
* import { migrations } from "./migrations";
|
|
@@ -30,4 +30,6 @@ export interface ClientMigrations {
|
|
|
30
30
|
export declare function shipMigrations(schema: WasmSchema, migrations: ClientMigrations | "none" | undefined): void;
|
|
31
31
|
/** The migrations the app defining `schema` ships, if it ships any. */
|
|
32
32
|
export declare function shippedMigrations(schema: WasmSchema): ClientMigrations | undefined;
|
|
33
|
+
/** Whether the app defining `schema` passed `{ migrations: "none" }` to `defineApp`. */
|
|
34
|
+
export declare function shipsNoMigrations(schema: WasmSchema): boolean;
|
|
33
35
|
//# sourceMappingURL=client-migrations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-migrations.d.ts","sourceRoot":"","sources":["../../src/runtime/client-migrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAClD,UAAU,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC,CAAC;CAC7E;
|
|
1
|
+
{"version":3,"file":"client-migrations.d.ts","sourceRoot":"","sources":["../../src/runtime/client-migrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAClD,UAAU,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC,CAAC;CAC7E;AAsBD,gEAAgE;AAChE,wBAAgB,cAAc,CAC5B,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAChD,IAAI,CAqBN;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,gBAAgB,GAAG,SAAS,CAElF;AAED,wFAAwF;AACxF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAE7D"}
|
|
@@ -9,13 +9,27 @@
|
|
|
9
9
|
* hash, stay as they are.
|
|
10
10
|
*/
|
|
11
11
|
const SHIPPED = Symbol.for("jazz-tools.shippedMigrations");
|
|
12
|
+
/**
|
|
13
|
+
* Where the app's schema records that `defineApp` was given
|
|
14
|
+
* `{ migrations: "none" }`, read across copies of jazz-tools like
|
|
15
|
+
* {@link SHIPPED}. It tells such an app apart from a schema that never went
|
|
16
|
+
* through `defineApp`, so `createJazz` can refuse it on a persistent store.
|
|
17
|
+
*/
|
|
18
|
+
const NONE = Symbol.for("jazz-tools.noMigrations");
|
|
12
19
|
/** Record that the app defining `schema` ships `migrations`. */
|
|
13
20
|
export function shipMigrations(schema, migrations) {
|
|
14
21
|
if (migrations === undefined) {
|
|
15
|
-
throw new Error('defineApp needs the app\'s migrations: `s.defineApp(schema, { migrations })` with `import { migrations } from "./migrations"`, or `{ migrations: "none" }` for an app that
|
|
22
|
+
throw new Error('defineApp needs the app\'s migrations: `s.defineApp(schema, { migrations })` with `import { migrations } from "./migrations"`, or `{ migrations: "none" }` for an app that only ever runs on memory(), such as a test\'s');
|
|
16
23
|
}
|
|
17
|
-
if (migrations === "none")
|
|
24
|
+
if (migrations === "none") {
|
|
25
|
+
Object.defineProperty(schema, NONE, {
|
|
26
|
+
value: true,
|
|
27
|
+
enumerable: false,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: false,
|
|
30
|
+
});
|
|
18
31
|
return;
|
|
32
|
+
}
|
|
19
33
|
Object.defineProperty(schema, SHIPPED, {
|
|
20
34
|
value: migrations,
|
|
21
35
|
enumerable: false,
|
|
@@ -27,4 +41,8 @@ export function shipMigrations(schema, migrations) {
|
|
|
27
41
|
export function shippedMigrations(schema) {
|
|
28
42
|
return schema[SHIPPED];
|
|
29
43
|
}
|
|
44
|
+
/** Whether the app defining `schema` passed `{ migrations: "none" }` to `defineApp`. */
|
|
45
|
+
export function shipsNoMigrations(schema) {
|
|
46
|
+
return schema[NONE] === true;
|
|
47
|
+
}
|
|
30
48
|
//# sourceMappingURL=client-migrations.js.map
|