jazz-tools 2.0.0-alpha.9 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +136 -9
- package/bin/jazz-tools.js +95 -68
- package/dist/_dev/inspector-cache-runtime.d.ts +8 -0
- package/dist/_dev/inspector-cache-runtime.d.ts.map +1 -0
- package/dist/_dev/inspector-cache-runtime.js +246 -0
- package/dist/_dev/inspector-cache-runtime.js.map +1 -0
- package/dist/_dev/inspector-client.d.ts +15 -0
- package/dist/_dev/inspector-client.d.ts.map +1 -0
- package/dist/_dev/inspector-client.js +134 -0
- package/dist/_dev/inspector-client.js.map +1 -0
- package/dist/_dev/native-account-session.d.ts +23 -0
- package/dist/_dev/native-account-session.d.ts.map +1 -0
- package/dist/_dev/native-account-session.js +61 -0
- package/dist/_dev/native-account-session.js.map +1 -0
- package/dist/_dev/native-binding-codec.d.ts +9 -0
- package/dist/_dev/native-binding-codec.d.ts.map +1 -0
- package/dist/_dev/native-binding-codec.js +9 -0
- package/dist/_dev/native-binding-codec.js.map +1 -0
- package/dist/accounts/account-manager-core.d.ts +87 -0
- package/dist/accounts/account-manager-core.d.ts.map +1 -0
- package/dist/accounts/account-manager-core.js +236 -0
- package/dist/accounts/account-manager-core.js.map +1 -0
- package/dist/accounts/browser-host.d.ts +8 -0
- package/dist/accounts/browser-host.d.ts.map +1 -0
- package/dist/accounts/browser-host.js +16 -0
- package/dist/accounts/browser-host.js.map +1 -0
- package/dist/accounts/config-capability.d.ts +26 -0
- package/dist/accounts/config-capability.d.ts.map +1 -0
- package/dist/accounts/config-capability.js +58 -0
- package/dist/accounts/config-capability.js.map +1 -0
- package/dist/accounts/context.d.ts +14 -0
- package/dist/accounts/context.d.ts.map +1 -0
- package/dist/accounts/context.js +214 -0
- package/dist/accounts/context.js.map +1 -0
- package/dist/accounts/enrollment.d.ts +95 -0
- package/dist/accounts/enrollment.d.ts.map +1 -0
- package/dist/accounts/enrollment.js +314 -0
- package/dist/accounts/enrollment.js.map +1 -0
- package/dist/accounts/exports.d.ts +3 -0
- package/dist/accounts/exports.d.ts.map +1 -0
- package/dist/accounts/exports.js +5 -0
- package/dist/accounts/exports.js.map +1 -0
- package/dist/accounts/local-first.d.ts +17 -0
- package/dist/accounts/local-first.d.ts.map +1 -0
- package/dist/accounts/local-first.js +62 -0
- package/dist/accounts/local-first.js.map +1 -0
- package/dist/accounts/persistence.d.ts +79 -0
- package/dist/accounts/persistence.d.ts.map +1 -0
- package/dist/accounts/persistence.js +533 -0
- package/dist/accounts/persistence.js.map +1 -0
- package/dist/accounts/process-store.d.ts +27 -0
- package/dist/accounts/process-store.d.ts.map +1 -0
- package/dist/accounts/process-store.js +49 -0
- package/dist/accounts/process-store.js.map +1 -0
- package/dist/accounts/registry-client.d.ts +79 -0
- package/dist/accounts/registry-client.d.ts.map +1 -0
- package/dist/accounts/registry-client.js +153 -0
- package/dist/accounts/registry-client.js.map +1 -0
- package/dist/accounts/state.d.ts +76 -0
- package/dist/accounts/state.d.ts.map +1 -0
- package/dist/accounts/state.js +172 -0
- package/dist/accounts/state.js.map +1 -0
- package/dist/app-file-enums.d.ts +9 -0
- package/dist/app-file-enums.d.ts.map +1 -0
- package/dist/app-file-enums.js +34 -0
- package/dist/app-file-enums.js.map +1 -0
- package/dist/authoring.d.ts +9 -0
- package/dist/authoring.d.ts.map +1 -0
- package/dist/authoring.js +9 -0
- package/dist/authoring.js.map +1 -0
- package/dist/backend/admission.d.ts +28 -0
- package/dist/backend/admission.d.ts.map +1 -0
- package/dist/backend/admission.js +146 -0
- package/dist/backend/admission.js.map +1 -0
- package/dist/backend/api.d.ts +12 -0
- package/dist/backend/api.d.ts.map +1 -0
- package/dist/backend/api.js +11 -0
- package/dist/backend/api.js.map +1 -0
- package/dist/backend/backend-clients.d.ts +76 -0
- package/dist/backend/backend-clients.d.ts.map +1 -0
- package/dist/backend/backend-clients.js +237 -0
- package/dist/backend/backend-clients.js.map +1 -0
- package/dist/backend/backend-issuer.d.ts +6 -0
- package/dist/backend/backend-issuer.d.ts.map +1 -0
- package/dist/backend/backend-issuer.js +6 -0
- package/dist/backend/backend-issuer.js.map +1 -0
- package/dist/backend/backend-native.d.ts +40 -0
- package/dist/backend/backend-native.d.ts.map +1 -0
- package/dist/backend/backend-native.js +37 -0
- package/dist/backend/backend-native.js.map +1 -0
- package/dist/backend/blobs.d.ts +130 -0
- package/dist/backend/blobs.d.ts.map +1 -0
- package/dist/backend/blobs.js +132 -0
- package/dist/backend/blobs.js.map +1 -0
- package/dist/backend/core-transport.d.ts +61 -0
- package/dist/backend/core-transport.d.ts.map +1 -0
- package/dist/backend/core-transport.js +106 -0
- package/dist/backend/core-transport.js.map +1 -0
- package/dist/backend/create-jazz-context.d.ts +94 -28
- package/dist/backend/create-jazz-context.d.ts.map +1 -1
- package/dist/backend/create-jazz-context.js +661 -67
- package/dist/backend/create-jazz-context.js.map +1 -1
- package/dist/backend/create-jazz-session.d.ts +125 -0
- package/dist/backend/create-jazz-session.d.ts.map +1 -0
- package/dist/backend/create-jazz-session.js +528 -0
- package/dist/backend/create-jazz-session.js.map +1 -0
- package/dist/backend/create-jazz.d.ts +677 -0
- package/dist/backend/create-jazz.d.ts.map +1 -0
- package/dist/backend/create-jazz.js +4076 -0
- package/dist/backend/create-jazz.js.map +1 -0
- package/dist/backend/early-db.d.ts +29 -0
- package/dist/backend/early-db.d.ts.map +1 -0
- package/dist/backend/early-db.js +203 -0
- package/dist/backend/early-db.js.map +1 -0
- package/dist/backend/external-jwt.d.ts +27 -0
- package/dist/backend/external-jwt.d.ts.map +1 -0
- package/dist/backend/external-jwt.js +404 -0
- package/dist/backend/external-jwt.js.map +1 -0
- package/dist/backend/from-jwt.d.ts +64 -0
- package/dist/backend/from-jwt.d.ts.map +1 -0
- package/dist/backend/from-jwt.js +104 -0
- package/dist/backend/from-jwt.js.map +1 -0
- package/dist/backend/index.d.ts +6 -3
- package/dist/backend/index.d.ts.map +1 -1
- package/dist/backend/index.js +18 -2
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/inspect-ui.d.ts +14 -0
- package/dist/backend/inspect-ui.d.ts.map +1 -0
- package/dist/backend/inspect-ui.js +156 -0
- package/dist/backend/inspect-ui.js.map +1 -0
- package/dist/backend/inspect.d.ts +133 -0
- package/dist/backend/inspect.d.ts.map +1 -0
- package/dist/backend/inspect.js +1001 -0
- package/dist/backend/inspect.js.map +1 -0
- package/dist/backend/inspector-ui/0.js +2 -0
- package/dist/backend/inspector-ui/1.js +2 -0
- package/dist/backend/inspector-ui/10.js +2 -0
- package/dist/backend/inspector-ui/11.js +2 -0
- package/dist/backend/inspector-ui/12.js +2 -0
- package/dist/backend/inspector-ui/13.js +2 -0
- package/dist/backend/inspector-ui/14.js +2 -0
- package/dist/backend/inspector-ui/15.js +2 -0
- package/dist/backend/inspector-ui/16.js +2 -0
- package/dist/backend/inspector-ui/17.js +2 -0
- package/dist/backend/inspector-ui/18.js +2 -0
- package/dist/backend/inspector-ui/19.js +2 -0
- package/dist/backend/inspector-ui/2.js +2 -0
- package/dist/backend/inspector-ui/20.js +2 -0
- package/dist/backend/inspector-ui/21.js +2 -0
- package/dist/backend/inspector-ui/3.js +2 -0
- package/dist/backend/inspector-ui/4.js +2 -0
- package/dist/backend/inspector-ui/5.js +2 -0
- package/dist/backend/inspector-ui/6.js +2 -0
- package/dist/backend/inspector-ui/7.js +2 -0
- package/dist/backend/inspector-ui/8.js +2 -0
- package/dist/backend/inspector-ui/9.js +2 -0
- package/dist/backend/inspector-ui-files.d.ts +4 -0
- package/dist/backend/inspector-ui-files.d.ts.map +1 -0
- package/dist/backend/inspector-ui-files.js +26 -0
- package/dist/backend/no-account-error.d.ts +23 -0
- package/dist/backend/no-account-error.d.ts.map +1 -0
- package/dist/backend/no-account-error.js +30 -0
- package/dist/backend/no-account-error.js.map +1 -0
- package/dist/backend/node-native.d.ts +3 -0
- package/dist/backend/node-native.d.ts.map +1 -0
- package/dist/backend/node-native.js +19 -0
- package/dist/backend/node-native.js.map +1 -0
- package/dist/backend/node-peers.d.ts +10 -0
- package/dist/backend/node-peers.d.ts.map +1 -0
- package/dist/backend/node-peers.js +37 -0
- package/dist/backend/node-peers.js.map +1 -0
- package/dist/backend/optional-peer.d.ts +9 -0
- package/dist/backend/optional-peer.d.ts.map +1 -0
- package/dist/backend/optional-peer.js +24 -0
- package/dist/backend/optional-peer.js.map +1 -0
- package/dist/backend/request-auth.d.ts +69 -0
- package/dist/backend/request-auth.d.ts.map +1 -0
- package/dist/backend/request-auth.js +122 -0
- package/dist/backend/request-auth.js.map +1 -0
- package/dist/backend/session-expiry.d.ts +61 -0
- package/dist/backend/session-expiry.d.ts.map +1 -0
- package/dist/backend/session-expiry.js +102 -0
- package/dist/backend/session-expiry.js.map +1 -0
- package/dist/backend/signing-key.d.ts +32 -0
- package/dist/backend/signing-key.d.ts.map +1 -0
- package/dist/backend/signing-key.js +63 -0
- package/dist/backend/signing-key.js.map +1 -0
- package/dist/backend/socket-deadline.d.ts +23 -0
- package/dist/backend/socket-deadline.d.ts.map +1 -0
- package/dist/backend/socket-deadline.js +70 -0
- package/dist/backend/socket-deadline.js.map +1 -0
- package/dist/backend/store-log.d.ts +3 -0
- package/dist/backend/store-log.d.ts.map +1 -0
- package/dist/backend/store-log.js +16 -0
- package/dist/backend/store-log.js.map +1 -0
- package/dist/backend/thin-relay.d.ts +66 -0
- package/dist/backend/thin-relay.d.ts.map +1 -0
- package/dist/backend/thin-relay.js +204 -0
- package/dist/backend/thin-relay.js.map +1 -0
- package/dist/backend/thin-session-client.d.ts +23 -0
- package/dist/backend/thin-session-client.d.ts.map +1 -0
- package/dist/backend/thin-session-client.js +69 -0
- package/dist/backend/thin-session-client.js.map +1 -0
- package/dist/backend/upgrade-status.d.ts +19 -0
- package/dist/backend/upgrade-status.d.ts.map +1 -0
- package/dist/backend/upgrade-status.js +55 -0
- package/dist/backend/upgrade-status.js.map +1 -0
- package/dist/backend/vercel-store.d.ts +345 -0
- package/dist/backend/vercel-store.d.ts.map +1 -0
- package/dist/backend/vercel-store.js +1388 -0
- package/dist/backend/vercel-store.js.map +1 -0
- package/dist/backend/workerd-backend.d.ts +36 -0
- package/dist/backend/workerd-backend.d.ts.map +1 -0
- package/dist/backend/workerd-backend.js +97 -0
- package/dist/backend/workerd-backend.js.map +1 -0
- package/dist/backend/workerd.d.ts +3 -0
- package/dist/backend/workerd.d.ts.map +1 -0
- package/dist/backend/workerd.js +39 -0
- package/dist/backend/workerd.js.map +1 -0
- package/dist/backend/ws-peer.d.ts +32 -0
- package/dist/backend/ws-peer.d.ts.map +1 -0
- package/dist/backend/ws-peer.js +41 -0
- package/dist/backend/ws-peer.js.map +1 -0
- package/dist/better-auth-adapter/fixtures/app.d.ts +151 -0
- package/dist/better-auth-adapter/fixtures/app.d.ts.map +1 -0
- package/dist/better-auth-adapter/fixtures/app.js +13 -0
- package/dist/better-auth-adapter/fixtures/app.js.map +1 -0
- package/dist/better-auth-adapter/fixtures/issuer-upgrade.d.ts +20 -0
- package/dist/better-auth-adapter/fixtures/issuer-upgrade.d.ts.map +1 -0
- package/dist/better-auth-adapter/fixtures/issuer-upgrade.js +27 -0
- package/dist/better-auth-adapter/fixtures/issuer-upgrade.js.map +1 -0
- package/dist/better-auth-adapter/index.d.ts +13 -0
- package/dist/better-auth-adapter/index.d.ts.map +1 -0
- package/dist/better-auth-adapter/index.js +406 -0
- package/dist/better-auth-adapter/index.js.map +1 -0
- package/dist/better-auth-adapter/indexes.d.ts +9 -0
- package/dist/better-auth-adapter/indexes.d.ts.map +1 -0
- package/dist/better-auth-adapter/indexes.js +40 -0
- package/dist/better-auth-adapter/indexes.js.map +1 -0
- package/dist/better-auth-adapter/schema.d.ts +88 -0
- package/dist/better-auth-adapter/schema.d.ts.map +1 -0
- package/dist/better-auth-adapter/schema.js +332 -0
- package/dist/better-auth-adapter/schema.js.map +1 -0
- package/dist/better-auth-adapter/types.d.ts +13 -0
- package/dist/better-auth-adapter/types.d.ts.map +1 -0
- package/dist/better-auth-adapter/types.js +2 -0
- package/dist/better-auth-adapter/types.js.map +1 -0
- package/dist/better-auth-adapter/utils.d.ts +53 -0
- package/dist/better-auth-adapter/utils.d.ts.map +1 -0
- package/dist/better-auth-adapter/utils.js +126 -0
- package/dist/better-auth-adapter/utils.js.map +1 -0
- package/dist/browser-benchmark-mode.d.ts +6 -0
- package/dist/browser-benchmark-mode.d.ts.map +1 -0
- package/dist/browser-benchmark-mode.js +13 -0
- package/dist/browser-benchmark-mode.js.map +1 -0
- package/dist/classic-api.d.ts +59 -0
- package/dist/classic-api.d.ts.map +1 -0
- package/dist/classic-api.js +122 -0
- package/dist/classic-api.js.map +1 -0
- package/dist/cli.d.ts +38 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +457 -265
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +5 -0
- package/dist/client/index.js.map +1 -0
- package/dist/cloud/api.d.ts +11 -0
- package/dist/cloud/api.d.ts.map +1 -0
- package/dist/cloud/api.js +46 -0
- package/dist/cloud/api.js.map +1 -0
- package/dist/cloud/commands.d.ts +13 -0
- package/dist/cloud/commands.d.ts.map +1 -0
- package/dist/cloud/commands.js +425 -0
- package/dist/cloud/commands.js.map +1 -0
- package/dist/cloud/credentials.d.ts +49 -0
- package/dist/cloud/credentials.d.ts.map +1 -0
- package/dist/cloud/credentials.js +219 -0
- package/dist/cloud/credentials.js.map +1 -0
- package/dist/cloud/session.d.ts +57 -0
- package/dist/cloud/session.d.ts.map +1 -0
- package/dist/cloud/session.js +269 -0
- package/dist/cloud/session.js.map +1 -0
- package/dist/codegen/relation-analyzer.d.ts +5 -12
- package/dist/codegen/relation-analyzer.d.ts.map +1 -1
- package/dist/codegen/relation-analyzer.js +53 -64
- package/dist/codegen/relation-analyzer.js.map +1 -1
- package/dist/dev/app-files.d.ts +32 -0
- package/dist/dev/app-files.d.ts.map +1 -0
- package/dist/dev/app-files.js +72 -0
- package/dist/dev/app-files.js.map +1 -0
- package/dist/dev/catalogue-api.d.ts +147 -0
- package/dist/dev/catalogue-api.d.ts.map +1 -0
- package/dist/dev/catalogue-api.js +127 -0
- package/dist/dev/catalogue-api.js.map +1 -0
- package/dist/dev/catalogue.d.ts +69 -0
- package/dist/dev/catalogue.d.ts.map +1 -0
- package/dist/dev/catalogue.js +70 -0
- package/dist/dev/catalogue.js.map +1 -0
- package/dist/dev/codegen-napi.d.ts +139 -0
- package/dist/dev/codegen-napi.d.ts.map +1 -0
- package/dist/dev/codegen-napi.js +157 -0
- package/dist/dev/codegen-napi.js.map +1 -0
- package/dist/dev/dev-server.d.ts +62 -0
- package/dist/dev/dev-server.d.ts.map +1 -0
- package/dist/dev/dev-server.js +164 -0
- package/dist/dev/dev-server.js.map +1 -0
- package/dist/dev/index.d.ts +3 -0
- package/dist/dev/index.d.ts.map +1 -0
- package/dist/dev/index.js +3 -0
- package/dist/dev/index.js.map +1 -0
- package/dist/dev/inspector-overlay/browser-control-registry.d.ts +10 -0
- package/dist/dev/inspector-overlay/browser-control-registry.d.ts.map +1 -0
- package/dist/dev/inspector-overlay/browser-control-registry.js +188 -0
- package/dist/dev/inspector-overlay/browser-control-registry.js.map +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/ExportResult-C0ZojfNk.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/backend-0Idv0niF.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/backend-DHeT1LCS.css +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/create-legacy-browser-delegate-DeI8PAZ5.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/diag-api-3Z_Eel3W.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-BB6DtWpZ.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-B_xpsQL2.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-CE7mSo95.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-CcBEG-yV.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-DZrCzNXM.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-k373aadI.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/index-hYDvY1xo.js +5 -0
- package/dist/dev/inspector-overlay/embedded/assets/jazz-broker-worker-Ul47m6zU.js +5 -0
- package/dist/dev/inspector-overlay/embedded/assets/jazz_wasm-zkCtl8wp.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/jazz_wasm_bg-xKxGDG9o.wasm +0 -0
- package/dist/dev/inspector-overlay/embedded/assets/node-foreground-node-lease.browser-2mfp13Qb.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/src-4JwhxZaW.js +16 -0
- package/dist/dev/inspector-overlay/embedded/assets/src-Cq8gSOLx.css +1 -0
- package/dist/dev/inspector-overlay/embedded/backend.html +17 -0
- package/dist/dev/inspector-overlay/embedded/embedded.html +15 -0
- package/dist/dev/inspector-overlay/embedded/favicon.ico +0 -0
- package/dist/dev/inspector-overlay/host-bridge.d.ts +8 -0
- package/dist/dev/inspector-overlay/host-bridge.d.ts.map +1 -0
- package/dist/dev/inspector-overlay/host-bridge.js +139 -0
- package/dist/dev/inspector-overlay/host-bridge.js.map +1 -0
- package/dist/dev/inspector-overlay/inspector-host-types.d.ts +35 -0
- package/dist/dev/inspector-overlay/inspector-host-types.d.ts.map +1 -0
- package/dist/dev/inspector-overlay/inspector-host-types.js +10 -0
- package/dist/dev/inspector-overlay/inspector-host-types.js.map +1 -0
- package/dist/dev/inspector-overlay/loader.d.ts +24 -0
- package/dist/dev/inspector-overlay/loader.d.ts.map +1 -0
- package/dist/dev/inspector-overlay/loader.js +533 -0
- package/dist/dev/inspector-overlay/loader.js.map +1 -0
- package/dist/dev/migration-graph.d.ts +32 -0
- package/dist/dev/migration-graph.d.ts.map +1 -0
- package/dist/dev/migration-graph.js +136 -0
- package/dist/dev/migration-graph.js.map +1 -0
- package/dist/dev/migrations.d.ts +145 -0
- package/dist/dev/migrations.d.ts.map +1 -0
- package/dist/dev/migrations.js +700 -0
- package/dist/dev/migrations.js.map +1 -0
- package/dist/dev/project.d.ts +65 -0
- package/dist/dev/project.d.ts.map +1 -0
- package/dist/dev/project.js +179 -0
- package/dist/dev/project.js.map +1 -0
- package/dist/dev/schema-utils.d.ts +8 -0
- package/dist/dev/schema-utils.d.ts.map +1 -0
- package/dist/dev/schema-utils.js +75 -0
- package/dist/dev/schema-utils.js.map +1 -0
- package/dist/dev/schema-validation.d.ts +5 -0
- package/dist/dev/schema-validation.d.ts.map +1 -0
- package/dist/dev/schema-validation.js +11 -0
- package/dist/dev/schema-validation.js.map +1 -0
- package/dist/dev/ts-project.d.ts +77 -0
- package/dist/dev/ts-project.d.ts.map +1 -0
- package/dist/dev/ts-project.js +191 -0
- package/dist/dev/ts-project.js.map +1 -0
- package/dist/drivers/index.d.ts +1 -1
- package/dist/drivers/index.d.ts.map +1 -1
- package/dist/drivers/index.js.map +1 -1
- package/dist/drivers/schema-wire.d.ts +19 -3
- package/dist/drivers/schema-wire.d.ts.map +1 -1
- package/dist/drivers/schema-wire.js +61 -11
- package/dist/drivers/schema-wire.js.map +1 -1
- package/dist/drivers/types.d.ts +166 -29
- package/dist/drivers/types.d.ts.map +1 -1
- package/dist/drivers/types.js +5 -2
- package/dist/drivers/types.js.map +1 -1
- package/dist/dsl.d.ts +276 -121
- package/dist/dsl.d.ts.map +1 -1
- package/dist/dsl.js +196 -160
- package/dist/dsl.js.map +1 -1
- package/dist/durable-object/index.d.ts +26 -0
- package/dist/durable-object/index.d.ts.map +1 -0
- package/dist/durable-object/index.js +26 -0
- package/dist/durable-object/index.js.map +1 -0
- package/dist/e2ee/SODIUM-LICENSE.txt +36 -0
- package/dist/e2ee/SODIUM-SOURCES.json +4 -0
- package/dist/e2ee/browser.d.ts +18 -0
- package/dist/e2ee/browser.d.ts.map +1 -0
- package/dist/e2ee/browser.js +111 -0
- package/dist/e2ee/browser.js.map +1 -0
- package/dist/e2ee/context.d.ts +23 -0
- package/dist/e2ee/context.d.ts.map +1 -0
- package/dist/e2ee/context.js +49 -0
- package/dist/e2ee/context.js.map +1 -0
- package/dist/e2ee/crypto.d.ts +10 -0
- package/dist/e2ee/crypto.d.ts.map +1 -0
- package/dist/e2ee/crypto.js +22 -0
- package/dist/e2ee/crypto.js.map +1 -0
- package/dist/e2ee/envelope.d.ts +22 -0
- package/dist/e2ee/envelope.d.ts.map +1 -0
- package/dist/e2ee/envelope.js +52 -0
- package/dist/e2ee/envelope.js.map +1 -0
- package/dist/e2ee/index.d.ts +14 -0
- package/dist/e2ee/index.d.ts.map +1 -0
- package/dist/e2ee/index.js +3 -0
- package/dist/e2ee/index.js.map +1 -0
- package/dist/e2ee/large-value.d.ts +20 -0
- package/dist/e2ee/large-value.d.ts.map +1 -0
- package/dist/e2ee/large-value.js +204 -0
- package/dist/e2ee/large-value.js.map +1 -0
- package/dist/e2ee/native.d.ts +18 -0
- package/dist/e2ee/native.d.ts.map +1 -0
- package/dist/e2ee/native.js +91 -0
- package/dist/e2ee/native.js.map +1 -0
- package/dist/e2ee/record-frame.d.ts +3 -0
- package/dist/e2ee/record-frame.d.ts.map +1 -0
- package/dist/e2ee/record-frame.js +18 -0
- package/dist/e2ee/record-frame.js.map +1 -0
- package/dist/e2ee/signer.d.ts +10 -0
- package/dist/e2ee/signer.d.ts.map +1 -0
- package/dist/e2ee/signer.js +54 -0
- package/dist/e2ee/signer.js.map +1 -0
- package/dist/e2ee/sodium-browser.d.ts +2 -0
- package/dist/e2ee/sodium-browser.d.ts.map +1 -0
- package/dist/e2ee/sodium-browser.js +3432 -0
- package/dist/e2ee/sodium.d.ts +20 -0
- package/dist/e2ee/sodium.d.ts.map +1 -0
- package/dist/e2ee/sodium.js +165 -0
- package/dist/e2ee/sodium.js.map +1 -0
- package/dist/e2ee/types.d.ts +92 -0
- package/dist/e2ee/types.d.ts.map +1 -0
- package/dist/e2ee/types.js +2 -0
- package/dist/e2ee/types.js.map +1 -0
- package/dist/effect/backend/index.d.ts +8 -0
- package/dist/effect/backend/index.d.ts.map +1 -0
- package/dist/effect/backend/index.js +8 -0
- package/dist/effect/backend/index.js.map +1 -0
- package/dist/effect/errors.d.ts +53 -0
- package/dist/effect/errors.d.ts.map +1 -0
- package/dist/effect/errors.js +61 -0
- package/dist/effect/errors.js.map +1 -0
- package/dist/effect/index.d.ts +9 -0
- package/dist/effect/index.d.ts.map +1 -0
- package/dist/effect/index.js +9 -0
- package/dist/effect/index.js.map +1 -0
- package/dist/effect/jazz-backend.d.ts +69 -0
- package/dist/effect/jazz-backend.d.ts.map +1 -0
- package/dist/effect/jazz-backend.js +95 -0
- package/dist/effect/jazz-backend.js.map +1 -0
- package/dist/effect/jazz.d.ts +129 -0
- package/dist/effect/jazz.d.ts.map +1 -0
- package/dist/effect/jazz.js +182 -0
- package/dist/effect/jazz.js.map +1 -0
- package/dist/expo/create-account-manager.d.ts +28 -0
- package/dist/expo/create-account-manager.d.ts.map +1 -0
- package/dist/expo/create-account-manager.js +35 -0
- package/dist/expo/create-account-manager.js.map +1 -0
- package/dist/expo/create-jazz-session.d.ts +66 -0
- package/dist/expo/create-jazz-session.d.ts.map +1 -0
- package/dist/expo/create-jazz-session.js +96 -0
- package/dist/expo/create-jazz-session.js.map +1 -0
- package/dist/expo/index.d.ts +12 -0
- package/dist/expo/index.d.ts.map +1 -0
- package/dist/expo/index.js +10 -0
- package/dist/expo/index.js.map +1 -0
- package/dist/expo/metro.d.ts +20 -0
- package/dist/expo/metro.d.ts.map +1 -0
- package/dist/expo/metro.js +58 -0
- package/dist/expo/metro.js.map +1 -0
- package/dist/expo/polyfills.d.ts +2 -0
- package/dist/expo/polyfills.d.ts.map +1 -0
- package/dist/expo/polyfills.js +5 -0
- package/dist/expo/polyfills.js.map +1 -0
- package/dist/expo/provider.d.ts +10 -0
- package/dist/expo/provider.d.ts.map +1 -0
- package/dist/expo/provider.js +11 -0
- package/dist/expo/provider.js.map +1 -0
- package/dist/index.d.ts +21 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -12
- package/dist/index.js.map +1 -1
- package/dist/inspect/cli.d.ts +12 -0
- package/dist/inspect/cli.d.ts.map +1 -0
- package/dist/inspect/cli.js +320 -0
- package/dist/inspect/cli.js.map +1 -0
- package/dist/inspect/client.d.ts +67 -0
- package/dist/inspect/client.d.ts.map +1 -0
- package/dist/inspect/client.js +254 -0
- package/dist/inspect/client.js.map +1 -0
- package/dist/inspect/mcp.d.ts +28 -0
- package/dist/inspect/mcp.d.ts.map +1 -0
- package/dist/inspect/mcp.js +441 -0
- package/dist/inspect/mcp.js.map +1 -0
- package/dist/inspect/protocol.d.ts +317 -0
- package/dist/inspect/protocol.d.ts.map +1 -0
- package/dist/inspect/protocol.js +544 -0
- package/dist/inspect/protocol.js.map +1 -0
- package/dist/inspector/index.d.ts +10 -0
- package/dist/inspector/index.d.ts.map +1 -0
- package/dist/inspector/index.js +27 -0
- package/dist/inspector/index.js.map +1 -0
- package/dist/internal/inspector-query.d.ts +6 -0
- package/dist/internal/inspector-query.d.ts.map +1 -0
- package/dist/internal/inspector-query.js +20 -0
- package/dist/internal/inspector-query.js.map +1 -0
- package/dist/ir.d.ts +43 -7
- package/dist/ir.d.ts.map +1 -1
- package/dist/ir.js +509 -1
- package/dist/ir.js.map +1 -1
- package/dist/json-value.d.ts +6 -0
- package/dist/json-value.d.ts.map +1 -0
- package/dist/json-value.js +2 -0
- package/dist/json-value.js.map +1 -0
- package/dist/local-first/index.d.ts +18 -0
- package/dist/local-first/index.d.ts.map +1 -0
- package/dist/local-first/index.js +17 -0
- package/dist/local-first/index.js.map +1 -0
- package/dist/local-first-auth/browser.d.ts +18 -0
- package/dist/local-first-auth/browser.d.ts.map +1 -0
- package/dist/local-first-auth/browser.js +26 -0
- package/dist/local-first-auth/browser.js.map +1 -0
- package/dist/local-first-auth/encoding.d.ts +10 -0
- package/dist/local-first-auth/encoding.d.ts.map +1 -0
- package/dist/local-first-auth/encoding.js +38 -0
- package/dist/local-first-auth/encoding.js.map +1 -0
- package/dist/local-first-auth/identity.d.ts +73 -0
- package/dist/local-first-auth/identity.d.ts.map +1 -0
- package/dist/local-first-auth/identity.js +258 -0
- package/dist/local-first-auth/identity.js.map +1 -0
- package/dist/local-first-auth/index.d.ts +6 -0
- package/dist/local-first-auth/index.d.ts.map +1 -0
- package/dist/local-first-auth/index.js +4 -0
- package/dist/local-first-auth/index.js.map +1 -0
- package/dist/local-first-auth/passkey.d.ts +22 -0
- package/dist/local-first-auth/passkey.d.ts.map +1 -0
- package/dist/local-first-auth/passkey.js +116 -0
- package/dist/local-first-auth/passkey.js.map +1 -0
- package/dist/local-first-auth/recovery-phrase.d.ts +10 -0
- package/dist/local-first-auth/recovery-phrase.d.ts.map +1 -0
- package/dist/local-first-auth/recovery-phrase.js +59 -0
- package/dist/local-first-auth/recovery-phrase.js.map +1 -0
- package/dist/local-first-auth/secret.d.ts +25 -0
- package/dist/local-first-auth/secret.d.ts.map +1 -0
- package/dist/local-first-auth/secret.js +68 -0
- package/dist/local-first-auth/secret.js.map +1 -0
- package/dist/local-first-auth/server.d.ts +13 -0
- package/dist/local-first-auth/server.d.ts.map +1 -0
- package/dist/local-first-auth/server.js +32 -0
- package/dist/local-first-auth/server.js.map +1 -0
- package/dist/local-first-auth/store.d.ts +51 -0
- package/dist/local-first-auth/store.d.ts.map +1 -0
- package/dist/local-first-auth/store.js +112 -0
- package/dist/local-first-auth/store.js.map +1 -0
- package/dist/magic-columns.d.ts +40 -0
- package/dist/magic-columns.d.ts.map +1 -0
- package/dist/magic-columns.js +110 -0
- package/dist/magic-columns.js.map +1 -0
- package/dist/migration-namespace.d.ts +12 -0
- package/dist/migration-namespace.d.ts.map +1 -0
- package/dist/migration-namespace.js +13 -0
- package/dist/migration-namespace.js.map +1 -0
- package/dist/migrations.d.ts +286 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +188 -0
- package/dist/migrations.js.map +1 -0
- package/dist/module-interop.d.ts +17 -0
- package/dist/module-interop.d.ts.map +1 -0
- package/dist/module-interop.js +32 -0
- package/dist/module-interop.js.map +1 -0
- package/dist/observed-jazz-client.d.ts +15 -0
- package/dist/observed-jazz-client.d.ts.map +1 -0
- package/dist/observed-jazz-client.js +47 -0
- package/dist/observed-jazz-client.js.map +1 -0
- package/dist/passkey-backup.d.ts +3 -0
- package/dist/passkey-backup.d.ts.map +1 -0
- package/dist/passkey-backup.js +2 -0
- package/dist/passkey-backup.js.map +1 -0
- package/dist/passphrase.d.ts +2 -0
- package/dist/passphrase.d.ts.map +1 -0
- package/dist/passphrase.js +2 -0
- package/dist/passphrase.js.map +1 -0
- package/dist/permissions/__fixtures__/big-label-better-auth.d.ts +89 -0
- package/dist/permissions/__fixtures__/big-label-better-auth.d.ts.map +1 -0
- package/dist/permissions/__fixtures__/big-label-better-auth.js +62 -0
- package/dist/permissions/__fixtures__/big-label-better-auth.js.map +1 -0
- package/dist/permissions/__fixtures__/big-label.d.ts +332 -0
- package/dist/permissions/__fixtures__/big-label.d.ts.map +1 -0
- package/dist/permissions/__fixtures__/big-label.js +177 -0
- package/dist/permissions/__fixtures__/big-label.js.map +1 -0
- package/dist/permissions/__fixtures__/chat-react.d.ts +112 -0
- package/dist/permissions/__fixtures__/chat-react.d.ts.map +1 -0
- package/dist/permissions/__fixtures__/chat-react.js +51 -0
- package/dist/permissions/__fixtures__/chat-react.js.map +1 -0
- package/dist/permissions/compile.d.ts +182 -0
- package/dist/permissions/compile.d.ts.map +1 -0
- package/dist/permissions/compile.js +715 -0
- package/dist/permissions/compile.js.map +1 -0
- package/dist/permissions/dsl.d.ts +158 -0
- package/dist/permissions/dsl.d.ts.map +1 -0
- package/dist/permissions/dsl.js +391 -0
- package/dist/permissions/dsl.js.map +1 -0
- package/dist/permissions/relation.d.ts +84 -0
- package/dist/permissions/relation.d.ts.map +1 -0
- package/dist/permissions/relation.js +150 -0
- package/dist/permissions/relation.js.map +1 -0
- package/dist/permissions/types.d.ts +357 -0
- package/dist/permissions/types.d.ts.map +1 -0
- package/dist/permissions/types.js +5 -0
- package/dist/permissions/types.js.map +1 -0
- package/dist/printer/app-json.d.ts +96 -0
- package/dist/printer/app-json.d.ts.map +1 -0
- package/dist/printer/app-json.js +18 -0
- package/dist/printer/app-json.js.map +1 -0
- package/dist/printer/cli.d.ts +15 -0
- package/dist/printer/cli.d.ts.map +1 -0
- package/dist/printer/cli.js +76 -0
- package/dist/printer/cli.js.map +1 -0
- package/dist/printer/defs.d.ts +11 -0
- package/dist/printer/defs.d.ts.map +1 -0
- package/dist/printer/defs.js +123 -0
- package/dist/printer/defs.js.map +1 -0
- package/dist/printer/expr.d.ts +281 -0
- package/dist/printer/expr.d.ts.map +1 -0
- package/dist/printer/expr.js +940 -0
- package/dist/printer/expr.js.map +1 -0
- package/dist/printer/format.d.ts +17 -0
- package/dist/printer/format.d.ts.map +1 -0
- package/dist/printer/format.js +315 -0
- package/dist/printer/format.js.map +1 -0
- package/dist/printer/index.d.ts +31 -0
- package/dist/printer/index.d.ts.map +1 -0
- package/dist/printer/index.js +51 -0
- package/dist/printer/index.js.map +1 -0
- package/dist/printer/migrations.d.ts +28 -0
- package/dist/printer/migrations.d.ts.map +1 -0
- package/dist/printer/migrations.js +179 -0
- package/dist/printer/migrations.js.map +1 -0
- package/dist/printer/names.d.ts +17 -0
- package/dist/printer/names.d.ts.map +1 -0
- package/dist/printer/names.js +124 -0
- package/dist/printer/names.js.map +1 -0
- package/dist/printer/permissions.d.ts +60 -0
- package/dist/printer/permissions.d.ts.map +1 -0
- package/dist/printer/permissions.js +1167 -0
- package/dist/printer/permissions.js.map +1 -0
- package/dist/printer/schema.d.ts +18 -0
- package/dist/printer/schema.d.ts.map +1 -0
- package/dist/printer/schema.js +132 -0
- package/dist/printer/schema.js.map +1 -0
- package/dist/prosemirror/anchors.d.ts +30 -0
- package/dist/prosemirror/anchors.d.ts.map +1 -0
- package/dist/prosemirror/anchors.js +28 -0
- package/dist/prosemirror/anchors.js.map +1 -0
- package/dist/prosemirror/index.d.ts +7 -0
- package/dist/prosemirror/index.d.ts.map +1 -0
- package/dist/prosemirror/index.js +7 -0
- package/dist/prosemirror/index.js.map +1 -0
- package/dist/prosemirror/markdown.d.ts +95 -0
- package/dist/prosemirror/markdown.d.ts.map +1 -0
- package/dist/prosemirror/markdown.js +428 -0
- package/dist/prosemirror/markdown.js.map +1 -0
- package/dist/prosemirror/overlays.d.ts +69 -0
- package/dist/prosemirror/overlays.d.ts.map +1 -0
- package/dist/prosemirror/overlays.js +143 -0
- package/dist/prosemirror/overlays.js.map +1 -0
- package/dist/prosemirror/presence.d.ts +39 -0
- package/dist/prosemirror/presence.d.ts.map +1 -0
- package/dist/prosemirror/presence.js +88 -0
- package/dist/prosemirror/presence.js.map +1 -0
- package/dist/prosemirror/sync.d.ts +60 -0
- package/dist/prosemirror/sync.d.ts.map +1 -0
- package/dist/prosemirror/sync.js +196 -0
- package/dist/prosemirror/sync.js.map +1 -0
- package/dist/prosemirror/text-map.d.ts +21 -0
- package/dist/prosemirror/text-map.d.ts.map +1 -0
- package/dist/prosemirror/text-map.js +85 -0
- package/dist/prosemirror/text-map.js.map +1 -0
- package/dist/react/create-jazz-client.d.ts +2 -11
- package/dist/react/create-jazz-client.d.ts.map +1 -1
- package/dist/react/create-jazz-client.js +1 -47
- package/dist/react/create-jazz-client.js.map +1 -1
- package/dist/react/index.d.ts +14 -7
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +8 -6
- package/dist/react/index.js.map +1 -1
- package/dist/react/provider-props.d.ts +7 -0
- package/dist/react/provider-props.d.ts.map +1 -0
- package/dist/react/provider-props.js +15 -0
- package/dist/react/provider-props.js.map +1 -0
- package/dist/react/provider.d.ts +19 -15
- package/dist/react/provider.d.ts.map +1 -1
- package/dist/react/provider.js +25 -5
- package/dist/react/provider.js.map +1 -1
- package/dist/react/use-all.d.ts +1 -1
- package/dist/react/use-all.d.ts.map +1 -1
- package/dist/react/use-all.js +1 -1
- package/dist/react/use-all.js.map +1 -1
- package/dist/react/use-one.d.ts +2 -0
- package/dist/react/use-one.d.ts.map +1 -0
- package/dist/react/use-one.js +2 -0
- package/dist/react/use-one.js.map +1 -0
- package/dist/react-core/index.d.ts +9 -4
- package/dist/react-core/index.d.ts.map +1 -1
- package/dist/react-core/index.js +10 -2
- package/dist/react-core/index.js.map +1 -1
- package/dist/react-core/provider.d.ts +48 -12
- package/dist/react-core/provider.d.ts.map +1 -1
- package/dist/react-core/provider.js +117 -13
- package/dist/react-core/provider.js.map +1 -1
- package/dist/react-core/session-context.d.ts +7 -0
- package/dist/react-core/session-context.d.ts.map +1 -0
- package/dist/react-core/session-context.js +8 -0
- package/dist/react-core/session-context.js.map +1 -0
- package/dist/react-core/session.d.ts +63 -0
- package/dist/react-core/session.d.ts.map +1 -0
- package/dist/react-core/session.js +97 -0
- package/dist/react-core/session.js.map +1 -0
- package/dist/react-core/use-all.d.ts +95 -3
- package/dist/react-core/use-all.d.ts.map +1 -1
- package/dist/react-core/use-all.js +126 -52
- package/dist/react-core/use-all.js.map +1 -1
- package/dist/react-core/use-auth-state.d.ts +13 -0
- package/dist/react-core/use-auth-state.d.ts.map +1 -0
- package/dist/react-core/use-auth-state.js +15 -0
- package/dist/react-core/use-auth-state.js.map +1 -0
- package/dist/react-core/use-one.d.ts +58 -0
- package/dist/react-core/use-one.d.ts.map +1 -0
- package/dist/react-core/use-one.js +19 -0
- package/dist/react-core/use-one.js.map +1 -0
- package/dist/react-core/use-sync-status.d.ts +8 -0
- package/dist/react-core/use-sync-status.d.ts.map +1 -0
- package/dist/react-core/use-sync-status.js +12 -0
- package/dist/react-core/use-sync-status.js.map +1 -0
- package/dist/react-native/abort-signal.d.ts +9 -0
- package/dist/react-native/abort-signal.d.ts.map +1 -0
- package/dist/react-native/abort-signal.js +51 -0
- package/dist/react-native/abort-signal.js.map +1 -0
- package/dist/react-native/account-session.d.ts +11 -0
- package/dist/react-native/account-session.d.ts.map +1 -0
- package/dist/react-native/account-session.js +59 -0
- package/dist/react-native/account-session.js.map +1 -0
- package/dist/react-native/create-account-manager.d.ts +28 -0
- package/dist/react-native/create-account-manager.d.ts.map +1 -0
- package/dist/react-native/create-account-manager.js +30 -0
- package/dist/react-native/create-account-manager.js.map +1 -0
- package/dist/react-native/create-db.d.ts +8 -0
- package/dist/react-native/create-db.d.ts.map +1 -0
- package/dist/react-native/create-db.js +9 -0
- package/dist/react-native/create-db.js.map +1 -0
- package/dist/react-native/create-jazz-client.d.ts +12 -10
- package/dist/react-native/create-jazz-client.d.ts.map +1 -1
- package/dist/react-native/create-jazz-client.js +6 -21
- package/dist/react-native/create-jazz-client.js.map +1 -1
- package/dist/react-native/create-jazz-session.d.ts +66 -0
- package/dist/react-native/create-jazz-session.d.ts.map +1 -0
- package/dist/react-native/create-jazz-session.js +96 -0
- package/dist/react-native/create-jazz-session.js.map +1 -0
- package/dist/react-native/errors.d.ts +6 -0
- package/dist/react-native/errors.d.ts.map +1 -0
- package/dist/react-native/errors.js +6 -0
- package/dist/react-native/errors.js.map +1 -0
- package/dist/react-native/index.d.ts +19 -9
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +13 -7
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/native-foreground-db.d.ts +227 -0
- package/dist/react-native/native-foreground-db.d.ts.map +1 -0
- package/dist/react-native/native-foreground-db.js +905 -0
- package/dist/react-native/native-foreground-db.js.map +1 -0
- package/dist/react-native/native-relay.d.ts +7 -0
- package/dist/react-native/native-relay.d.ts.map +1 -0
- package/dist/react-native/native-relay.js +14 -0
- package/dist/react-native/native-relay.js.map +1 -0
- package/dist/react-native/provider.d.ts +19 -13
- package/dist/react-native/provider.d.ts.map +1 -1
- package/dist/react-native/provider.js +25 -5
- package/dist/react-native/provider.js.map +1 -1
- package/dist/react-native/runtime-source.d.ts +62 -0
- package/dist/react-native/runtime-source.d.ts.map +1 -0
- package/dist/react-native/runtime-source.js +314 -0
- package/dist/react-native/runtime-source.js.map +1 -0
- package/dist/react-native/use-all.d.ts +1 -1
- package/dist/react-native/use-all.d.ts.map +1 -1
- package/dist/react-native/use-all.js +1 -1
- package/dist/react-native/use-all.js.map +1 -1
- package/dist/react-native/use-one.d.ts +2 -0
- package/dist/react-native/use-one.d.ts.map +1 -0
- package/dist/react-native/use-one.js +2 -0
- package/dist/react-native/use-one.js.map +1 -0
- package/dist/reconcile-array.d.ts +45 -0
- package/dist/reconcile-array.d.ts.map +1 -0
- package/dist/reconcile-array.js +252 -0
- package/dist/reconcile-array.js.map +1 -0
- package/dist/relationships.d.ts +18 -0
- package/dist/relationships.d.ts.map +1 -0
- package/dist/relationships.js +28 -0
- package/dist/relationships.js.map +1 -0
- package/dist/runtime/auth-renewal-backoff.d.ts +14 -0
- package/dist/runtime/auth-renewal-backoff.d.ts.map +1 -0
- package/dist/runtime/auth-renewal-backoff.js +23 -0
- package/dist/runtime/auth-renewal-backoff.js.map +1 -0
- package/dist/runtime/auth-request-deadline.d.ts +3 -0
- package/dist/runtime/auth-request-deadline.d.ts.map +1 -0
- package/dist/runtime/auth-request-deadline.js +24 -0
- package/dist/runtime/auth-request-deadline.js.map +1 -0
- package/dist/runtime/auth-secret-codec.d.ts +21 -0
- package/dist/runtime/auth-secret-codec.d.ts.map +1 -0
- package/dist/runtime/auth-secret-codec.js +32 -0
- package/dist/runtime/auth-secret-codec.js.map +1 -0
- package/dist/runtime/auth-secret-store.d.ts +7 -0
- package/dist/runtime/auth-secret-store.d.ts.map +1 -0
- package/dist/runtime/auth-secret-store.js +12 -0
- package/dist/runtime/auth-secret-store.js.map +1 -0
- package/dist/runtime/auth-state.d.ts +47 -0
- package/dist/runtime/auth-state.d.ts.map +1 -0
- package/dist/runtime/auth-state.js +161 -0
- package/dist/runtime/auth-state.js.map +1 -0
- package/dist/runtime/author-id.d.ts +42 -0
- package/dist/runtime/author-id.d.ts.map +1 -0
- package/dist/runtime/author-id.js +172 -0
- package/dist/runtime/author-id.js.map +1 -0
- package/dist/runtime/authority-changed-error.d.ts +56 -0
- package/dist/runtime/authority-changed-error.d.ts.map +1 -0
- package/dist/runtime/authority-changed-error.js +74 -0
- package/dist/runtime/authority-changed-error.js.map +1 -0
- package/dist/runtime/backlog-rows.d.ts +3 -0
- package/dist/runtime/backlog-rows.d.ts.map +1 -0
- package/dist/runtime/backlog-rows.js +7 -0
- package/dist/runtime/backlog-rows.js.map +1 -0
- package/dist/runtime/browser-physical-database-epoch.d.ts +37 -0
- package/dist/runtime/browser-physical-database-epoch.d.ts.map +1 -0
- package/dist/runtime/browser-physical-database-epoch.js +89 -0
- package/dist/runtime/browser-physical-database-epoch.js.map +1 -0
- package/dist/runtime/browser-storage-invalidation.d.ts +8 -0
- package/dist/runtime/browser-storage-invalidation.d.ts.map +1 -0
- package/dist/runtime/browser-storage-invalidation.js +20 -0
- package/dist/runtime/browser-storage-invalidation.js.map +1 -0
- package/dist/runtime/browser-store-generation.d.ts +15 -0
- package/dist/runtime/browser-store-generation.d.ts.map +1 -0
- package/dist/runtime/browser-store-generation.js +48 -0
- package/dist/runtime/browser-store-generation.js.map +1 -0
- package/dist/runtime/browser-worker-assets.d.ts +31 -0
- package/dist/runtime/browser-worker-assets.d.ts.map +1 -0
- package/dist/runtime/browser-worker-assets.js +40 -0
- package/dist/runtime/browser-worker-assets.js.map +1 -0
- package/dist/runtime/browser-worker-assets.metro.d.ts +28 -0
- package/dist/runtime/browser-worker-assets.metro.d.ts.map +1 -0
- package/dist/runtime/browser-worker-assets.metro.js +52 -0
- package/dist/runtime/browser-worker-assets.metro.js.map +1 -0
- package/dist/runtime/browser-worker-assets.native.d.ts +7 -0
- package/dist/runtime/browser-worker-assets.native.d.ts.map +1 -0
- package/dist/runtime/browser-worker-assets.native.js +8 -0
- package/dist/runtime/browser-worker-assets.native.js.map +1 -0
- package/dist/runtime/browser-worker-config.d.ts +78 -0
- package/dist/runtime/browser-worker-config.d.ts.map +1 -0
- package/dist/runtime/browser-worker-config.js +299 -0
- package/dist/runtime/browser-worker-config.js.map +1 -0
- package/dist/runtime/client-config-key.d.ts +6 -0
- package/dist/runtime/client-config-key.d.ts.map +1 -0
- package/dist/runtime/client-config-key.js +83 -0
- package/dist/runtime/client-config-key.js.map +1 -0
- package/dist/runtime/client-migrations.d.ts +27 -0
- package/dist/runtime/client-migrations.d.ts.map +1 -0
- package/dist/runtime/client-migrations.js +25 -0
- package/dist/runtime/client-migrations.js.map +1 -0
- package/dist/runtime/client-registry.d.ts +21 -0
- package/dist/runtime/client-registry.d.ts.map +1 -0
- package/dist/runtime/client-registry.js +169 -0
- package/dist/runtime/client-registry.js.map +1 -0
- package/dist/runtime/client-scope.d.ts +38 -0
- package/dist/runtime/client-scope.d.ts.map +1 -0
- package/dist/runtime/client-scope.js +64 -0
- package/dist/runtime/client-scope.js.map +1 -0
- package/dist/runtime/client-session.d.ts +56 -14
- package/dist/runtime/client-session.d.ts.map +1 -1
- package/dist/runtime/client-session.js +211 -195
- package/dist/runtime/client-session.js.map +1 -1
- package/dist/runtime/client.d.ts +721 -194
- package/dist/runtime/client.d.ts.map +1 -1
- package/dist/runtime/client.js +1213 -434
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/column-transforms.d.ts +26 -0
- package/dist/runtime/column-transforms.d.ts.map +1 -0
- package/dist/runtime/column-transforms.js +186 -0
- package/dist/runtime/column-transforms.js.map +1 -0
- package/dist/runtime/connection-manager/browser-connection-manager.d.ts +178 -0
- package/dist/runtime/connection-manager/browser-connection-manager.d.ts.map +1 -0
- package/dist/runtime/connection-manager/browser-connection-manager.js +1030 -0
- package/dist/runtime/connection-manager/browser-connection-manager.js.map +1 -0
- package/dist/runtime/connection-manager/direct-connection-manager.d.ts +28 -0
- package/dist/runtime/connection-manager/direct-connection-manager.d.ts.map +1 -0
- package/dist/runtime/connection-manager/direct-connection-manager.js +202 -0
- package/dist/runtime/connection-manager/direct-connection-manager.js.map +1 -0
- package/dist/runtime/connection-manager/index.d.ts +5 -0
- package/dist/runtime/connection-manager/index.d.ts.map +1 -0
- package/dist/runtime/connection-manager/index.js +4 -0
- package/dist/runtime/connection-manager/index.js.map +1 -0
- package/dist/runtime/connection-manager/types.d.ts +174 -0
- package/dist/runtime/connection-manager/types.d.ts.map +1 -0
- package/dist/runtime/connection-manager/types.js +396 -0
- package/dist/runtime/connection-manager/types.js.map +1 -0
- package/dist/runtime/context.d.ts +100 -30
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/context.js.map +1 -1
- package/dist/runtime/core-tick-failed-error.d.ts +31 -0
- package/dist/runtime/core-tick-failed-error.d.ts.map +1 -0
- package/dist/runtime/core-tick-failed-error.js +45 -0
- package/dist/runtime/core-tick-failed-error.js.map +1 -0
- package/dist/runtime/credentialed-transport.d.ts +42 -0
- package/dist/runtime/credentialed-transport.d.ts.map +1 -0
- package/dist/runtime/credentialed-transport.js +178 -0
- package/dist/runtime/credentialed-transport.js.map +1 -0
- package/dist/runtime/db-access-context.d.ts +14 -0
- package/dist/runtime/db-access-context.d.ts.map +1 -0
- package/dist/runtime/db-access-context.js +26 -0
- package/dist/runtime/db-access-context.js.map +1 -0
- package/dist/runtime/db-internal-session.d.ts +7 -0
- package/dist/runtime/db-internal-session.d.ts.map +1 -0
- package/dist/runtime/db-internal-session.js +21 -0
- package/dist/runtime/db-internal-session.js.map +1 -0
- package/dist/runtime/db-replaced-error.d.ts +21 -0
- package/dist/runtime/db-replaced-error.d.ts.map +1 -0
- package/dist/runtime/db-replaced-error.js +22 -0
- package/dist/runtime/db-replaced-error.js.map +1 -0
- package/dist/runtime/db.d.ts +857 -215
- package/dist/runtime/db.d.ts.map +1 -1
- package/dist/runtime/db.js +3474 -834
- package/dist/runtime/db.js.map +1 -1
- package/dist/runtime/default-create-db.d.ts +5 -0
- package/dist/runtime/default-create-db.d.ts.map +1 -0
- package/dist/runtime/default-create-db.js +7 -0
- package/dist/runtime/default-create-db.js.map +1 -0
- package/dist/runtime/default-runtime-source.d.ts +41 -0
- package/dist/runtime/default-runtime-source.d.ts.map +1 -0
- package/dist/runtime/default-runtime-source.js +326 -0
- package/dist/runtime/default-runtime-source.js.map +1 -0
- package/dist/runtime/delete-local-first-store.d.ts +12 -0
- package/dist/runtime/delete-local-first-store.d.ts.map +1 -0
- package/dist/runtime/delete-local-first-store.js +12 -0
- package/dist/runtime/delete-local-first-store.js.map +1 -0
- package/dist/runtime/deterministic-bytes.d.ts +6 -0
- package/dist/runtime/deterministic-bytes.d.ts.map +1 -0
- package/dist/runtime/deterministic-bytes.js +18 -0
- package/dist/runtime/deterministic-bytes.js.map +1 -0
- package/dist/runtime/graceful-shutdown-error.d.ts +17 -0
- package/dist/runtime/graceful-shutdown-error.d.ts.map +1 -0
- package/dist/runtime/graceful-shutdown-error.js +31 -0
- package/dist/runtime/graceful-shutdown-error.js.map +1 -0
- package/dist/runtime/hex.d.ts +21 -0
- package/dist/runtime/hex.d.ts.map +1 -0
- package/dist/runtime/hex.js +62 -0
- package/dist/runtime/hex.js.map +1 -0
- package/dist/runtime/history-relation.d.ts +8 -0
- package/dist/runtime/history-relation.d.ts.map +1 -0
- package/dist/runtime/history-relation.js +44 -0
- package/dist/runtime/history-relation.js.map +1 -0
- package/dist/runtime/in-process-transport.d.ts +18 -0
- package/dist/runtime/in-process-transport.d.ts.map +1 -0
- package/dist/runtime/in-process-transport.js +32 -0
- package/dist/runtime/in-process-transport.js.map +1 -0
- package/dist/runtime/index.d.ts +22 -13
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +14 -12
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/indexeddb-page-store.d.ts +214 -0
- package/dist/runtime/indexeddb-page-store.d.ts.map +1 -0
- package/dist/runtime/indexeddb-page-store.js +848 -0
- package/dist/runtime/indexeddb-page-store.js.map +1 -0
- package/dist/runtime/introspection-fetch.d.ts +18 -0
- package/dist/runtime/introspection-fetch.d.ts.map +1 -0
- package/dist/runtime/introspection-fetch.js +12 -0
- package/dist/runtime/introspection-fetch.js.map +1 -0
- package/dist/runtime/json-schema-evaluate.d.ts +55 -0
- package/dist/runtime/json-schema-evaluate.d.ts.map +1 -0
- package/dist/runtime/json-schema-evaluate.js +946 -0
- package/dist/runtime/json-schema-evaluate.js.map +1 -0
- package/dist/runtime/json-schema-formats.d.ts +14 -0
- package/dist/runtime/json-schema-formats.d.ts.map +1 -0
- package/dist/runtime/json-schema-formats.js +555 -0
- package/dist/runtime/json-schema-formats.js.map +1 -0
- package/dist/runtime/json-schema-json.d.ts +41 -0
- package/dist/runtime/json-schema-json.d.ts.map +1 -0
- package/dist/runtime/json-schema-json.js +309 -0
- package/dist/runtime/json-schema-json.js.map +1 -0
- package/dist/runtime/json-schema-metaschemas.d.ts +1403 -0
- package/dist/runtime/json-schema-metaschemas.d.ts.map +1 -0
- package/dist/runtime/json-schema-metaschemas.js +64 -0
- package/dist/runtime/json-schema-metaschemas.js.map +1 -0
- package/dist/runtime/json-schema-regex.d.ts +32 -0
- package/dist/runtime/json-schema-regex.d.ts.map +1 -0
- package/dist/runtime/json-schema-regex.js +895 -0
- package/dist/runtime/json-schema-regex.js.map +1 -0
- package/dist/runtime/json-schema-validator.d.ts +50 -0
- package/dist/runtime/json-schema-validator.d.ts.map +1 -0
- package/dist/runtime/json-schema-validator.js +404 -0
- package/dist/runtime/json-schema-validator.js.map +1 -0
- package/dist/runtime/json-text.js.map +1 -1
- package/dist/runtime/local-first-token.d.ts +11 -0
- package/dist/runtime/local-first-token.d.ts.map +1 -0
- package/dist/runtime/local-first-token.js +20 -0
- package/dist/runtime/local-first-token.js.map +1 -0
- package/dist/runtime/local-first-unavailable.d.ts +40 -0
- package/dist/runtime/local-first-unavailable.d.ts.map +1 -0
- package/dist/runtime/local-first-unavailable.js +81 -0
- package/dist/runtime/local-first-unavailable.js.map +1 -0
- package/dist/runtime/local-first-upgrade.d.ts +36 -0
- package/dist/runtime/local-first-upgrade.d.ts.map +1 -0
- package/dist/runtime/local-first-upgrade.js +31 -0
- package/dist/runtime/local-first-upgrade.js.map +1 -0
- package/dist/runtime/local-write-observer.d.ts +5 -0
- package/dist/runtime/local-write-observer.d.ts.map +1 -0
- package/dist/runtime/local-write-observer.js +31 -0
- package/dist/runtime/local-write-observer.js.map +1 -0
- package/dist/runtime/metro-setup-error.d.ts +20 -0
- package/dist/runtime/metro-setup-error.d.ts.map +1 -0
- package/dist/runtime/metro-setup-error.js +22 -0
- package/dist/runtime/metro-setup-error.js.map +1 -0
- package/dist/runtime/native-artifact-compatibility.d.ts +12 -0
- package/dist/runtime/native-artifact-compatibility.d.ts.map +1 -0
- package/dist/runtime/native-artifact-compatibility.js +26 -0
- package/dist/runtime/native-artifact-compatibility.js.map +1 -0
- package/dist/runtime/native-artifact-fingerprint-napi.d.ts +2 -0
- package/dist/runtime/native-artifact-fingerprint-napi.d.ts.map +1 -0
- package/dist/runtime/native-artifact-fingerprint-napi.js +3 -0
- package/dist/runtime/native-artifact-fingerprint-napi.js.map +1 -0
- package/dist/runtime/native-artifact-fingerprint-wasm.d.ts +2 -0
- package/dist/runtime/native-artifact-fingerprint-wasm.d.ts.map +1 -0
- package/dist/runtime/native-artifact-fingerprint-wasm.js +3 -0
- package/dist/runtime/native-artifact-fingerprint-wasm.js.map +1 -0
- package/dist/runtime/native-artifact-fingerprints.d.ts +5 -0
- package/dist/runtime/native-artifact-fingerprints.d.ts.map +1 -0
- package/dist/runtime/native-artifact-fingerprints.js +7 -0
- package/dist/runtime/native-artifact-fingerprints.js.map +1 -0
- package/dist/runtime/native-artifact-mismatch-error.d.ts +25 -0
- package/dist/runtime/native-artifact-mismatch-error.d.ts.map +1 -0
- package/dist/runtime/native-artifact-mismatch-error.js +34 -0
- package/dist/runtime/native-artifact-mismatch-error.js.map +1 -0
- package/dist/runtime/native-runtime/attached-browser-worker-connection.d.ts +23 -0
- package/dist/runtime/native-runtime/attached-browser-worker-connection.d.ts.map +1 -0
- package/dist/runtime/native-runtime/attached-browser-worker-connection.js +45 -0
- package/dist/runtime/native-runtime/attached-browser-worker-connection.js.map +1 -0
- package/dist/runtime/native-runtime/auxiliary-receive-deadline.d.ts +15 -0
- package/dist/runtime/native-runtime/auxiliary-receive-deadline.d.ts.map +1 -0
- package/dist/runtime/native-runtime/auxiliary-receive-deadline.js +64 -0
- package/dist/runtime/native-runtime/auxiliary-receive-deadline.js.map +1 -0
- package/dist/runtime/native-runtime/broker-worker-load-failure.d.ts +34 -0
- package/dist/runtime/native-runtime/broker-worker-load-failure.d.ts.map +1 -0
- package/dist/runtime/native-runtime/broker-worker-load-failure.js +61 -0
- package/dist/runtime/native-runtime/broker-worker-load-failure.js.map +1 -0
- package/dist/runtime/native-runtime/browser-follower-connection.d.ts +109 -0
- package/dist/runtime/native-runtime/browser-follower-connection.d.ts.map +1 -0
- package/dist/runtime/native-runtime/browser-follower-connection.js +558 -0
- package/dist/runtime/native-runtime/browser-follower-connection.js.map +1 -0
- package/dist/runtime/native-runtime/browser-shared-worker-connection.d.ts +130 -0
- package/dist/runtime/native-runtime/browser-shared-worker-connection.d.ts.map +1 -0
- package/dist/runtime/native-runtime/browser-shared-worker-connection.js +988 -0
- package/dist/runtime/native-runtime/browser-shared-worker-connection.js.map +1 -0
- package/dist/runtime/native-runtime/browser-worker-protocol.d.ts +527 -0
- package/dist/runtime/native-runtime/browser-worker-protocol.d.ts.map +1 -0
- package/dist/runtime/native-runtime/browser-worker-protocol.js +296 -0
- package/dist/runtime/native-runtime/browser-worker-protocol.js.map +1 -0
- package/dist/runtime/native-runtime/browser-worker-transport.d.ts +56 -0
- package/dist/runtime/native-runtime/browser-worker-transport.d.ts.map +1 -0
- package/dist/runtime/native-runtime/browser-worker-transport.js +305 -0
- package/dist/runtime/native-runtime/browser-worker-transport.js.map +1 -0
- package/dist/runtime/native-runtime/exact-integer.d.ts +7 -0
- package/dist/runtime/native-runtime/exact-integer.d.ts.map +1 -0
- package/dist/runtime/native-runtime/exact-integer.js +18 -0
- package/dist/runtime/native-runtime/exact-integer.js.map +1 -0
- package/dist/runtime/native-runtime/http-stream-socket.d.ts +103 -0
- package/dist/runtime/native-runtime/http-stream-socket.d.ts.map +1 -0
- package/dist/runtime/native-runtime/http-stream-socket.js +554 -0
- package/dist/runtime/native-runtime/http-stream-socket.js.map +1 -0
- package/dist/runtime/native-runtime/inspector-control-lifecycle.d.ts +4 -0
- package/dist/runtime/native-runtime/inspector-control-lifecycle.d.ts.map +1 -0
- package/dist/runtime/native-runtime/inspector-control-lifecycle.js +33 -0
- package/dist/runtime/native-runtime/inspector-control-lifecycle.js.map +1 -0
- package/dist/runtime/native-runtime/native-codec.d.ts +172 -0
- package/dist/runtime/native-runtime/native-codec.d.ts.map +1 -0
- package/dist/runtime/native-runtime/native-codec.js +629 -0
- package/dist/runtime/native-runtime/native-codec.js.map +1 -0
- package/dist/runtime/native-runtime/native-error-code.d.ts +39 -0
- package/dist/runtime/native-runtime/native-error-code.d.ts.map +1 -0
- package/dist/runtime/native-runtime/native-error-code.js +64 -0
- package/dist/runtime/native-runtime/native-error-code.js.map +1 -0
- package/dist/runtime/native-runtime/native-row-codec.d.ts +161 -0
- package/dist/runtime/native-runtime/native-row-codec.d.ts.map +1 -0
- package/dist/runtime/native-runtime/native-row-codec.js +903 -0
- package/dist/runtime/native-runtime/native-row-codec.js.map +1 -0
- package/dist/runtime/native-runtime/native-row-descriptor-key.d.ts +15 -0
- package/dist/runtime/native-runtime/native-row-descriptor-key.d.ts.map +1 -0
- package/dist/runtime/native-runtime/native-row-descriptor-key.js +25 -0
- package/dist/runtime/native-runtime/native-row-descriptor-key.js.map +1 -0
- package/dist/runtime/native-runtime/native-runtime-adapter.d.ts +913 -0
- package/dist/runtime/native-runtime/native-runtime-adapter.d.ts.map +1 -0
- package/dist/runtime/native-runtime/native-runtime-adapter.js +5999 -0
- package/dist/runtime/native-runtime/native-runtime-adapter.js.map +1 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.browser.d.ts +17 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.browser.d.ts.map +1 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.browser.js +4 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.browser.js.map +1 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.d.ts +19 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.d.ts.map +1 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.js +297 -0
- package/dist/runtime/native-runtime/node-foreground-node-lease.js.map +1 -0
- package/dist/runtime/native-runtime/row-values-transport.d.ts +2 -0
- package/dist/runtime/native-runtime/row-values-transport.d.ts.map +1 -0
- package/dist/runtime/native-runtime/row-values-transport.js +21 -0
- package/dist/runtime/native-runtime/row-values-transport.js.map +1 -0
- package/dist/runtime/native-runtime/schema-codec.d.ts +10 -0
- package/dist/runtime/native-runtime/schema-codec.d.ts.map +1 -0
- package/dist/runtime/native-runtime/schema-codec.js +13 -0
- package/dist/runtime/native-runtime/schema-codec.js.map +1 -0
- package/dist/runtime/native-runtime/session-renewal-wire.d.ts +48 -0
- package/dist/runtime/native-runtime/session-renewal-wire.d.ts.map +1 -0
- package/dist/runtime/native-runtime/session-renewal-wire.js +107 -0
- package/dist/runtime/native-runtime/session-renewal-wire.js.map +1 -0
- package/dist/runtime/native-runtime/stream-endpoint-memory.d.ts +34 -0
- package/dist/runtime/native-runtime/stream-endpoint-memory.d.ts.map +1 -0
- package/dist/runtime/native-runtime/stream-endpoint-memory.js +146 -0
- package/dist/runtime/native-runtime/stream-endpoint-memory.js.map +1 -0
- package/dist/runtime/native-runtime/websocket.d.ts +327 -0
- package/dist/runtime/native-runtime/websocket.d.ts.map +1 -0
- package/dist/runtime/native-runtime/websocket.js +1112 -0
- package/dist/runtime/native-runtime/websocket.js.map +1 -0
- package/dist/runtime/newer-build-reload.d.ts +30 -0
- package/dist/runtime/newer-build-reload.d.ts.map +1 -0
- package/dist/runtime/newer-build-reload.js +59 -0
- package/dist/runtime/newer-build-reload.js.map +1 -0
- package/dist/runtime/page-cache.d.ts +44 -0
- package/dist/runtime/page-cache.d.ts.map +1 -0
- package/dist/runtime/page-cache.js +104 -0
- package/dist/runtime/page-cache.js.map +1 -0
- package/dist/runtime/page-handle.d.ts +83 -0
- package/dist/runtime/page-handle.d.ts.map +1 -0
- package/dist/runtime/page-handle.js +151 -0
- package/dist/runtime/page-handle.js.map +1 -0
- package/dist/runtime/passkey-backup.d.ts +3 -0
- package/dist/runtime/passkey-backup.d.ts.map +1 -0
- package/dist/runtime/passkey-backup.js +2 -0
- package/dist/runtime/passkey-backup.js.map +1 -0
- package/dist/runtime/platform-url.d.ts +10 -0
- package/dist/runtime/platform-url.d.ts.map +1 -0
- package/dist/runtime/platform-url.js +3 -0
- package/dist/runtime/platform-url.js.map +1 -0
- package/dist/runtime/platform-url.native.d.ts +6 -0
- package/dist/runtime/platform-url.native.d.ts.map +1 -0
- package/dist/runtime/platform-url.native.js +38 -0
- package/dist/runtime/platform-url.native.js.map +1 -0
- package/dist/runtime/query-adapter.d.ts +7 -15
- package/dist/runtime/query-adapter.d.ts.map +1 -1
- package/dist/runtime/query-adapter.js +390 -110
- package/dist/runtime/query-adapter.js.map +1 -1
- package/dist/runtime/query-builder-shape.d.ts +75 -0
- package/dist/runtime/query-builder-shape.d.ts.map +1 -0
- package/dist/runtime/query-builder-shape.js +225 -0
- package/dist/runtime/query-builder-shape.js.map +1 -0
- package/dist/runtime/query-column-name.d.ts +3 -0
- package/dist/runtime/query-column-name.d.ts.map +1 -0
- package/dist/runtime/query-column-name.js +10 -0
- package/dist/runtime/query-column-name.js.map +1 -0
- package/dist/runtime/query-output-table.d.ts +5 -0
- package/dist/runtime/query-output-table.d.ts.map +1 -0
- package/dist/runtime/query-output-table.js +30 -0
- package/dist/runtime/query-output-table.js.map +1 -0
- package/dist/runtime/recovery-phrase.d.ts +3 -0
- package/dist/runtime/recovery-phrase.d.ts.map +1 -0
- package/dist/runtime/recovery-phrase.js +2 -0
- package/dist/runtime/recovery-phrase.js.map +1 -0
- package/dist/runtime/remote-link-state.d.ts +20 -0
- package/dist/runtime/remote-link-state.d.ts.map +1 -0
- package/dist/runtime/remote-link-state.js +5 -0
- package/dist/runtime/remote-link-state.js.map +1 -0
- package/dist/runtime/removed-provider-props.d.ts +17 -0
- package/dist/runtime/removed-provider-props.d.ts.map +1 -0
- package/dist/runtime/removed-provider-props.js +16 -0
- package/dist/runtime/removed-provider-props.js.map +1 -0
- package/dist/runtime/row-transformer.d.ts +17 -3
- package/dist/runtime/row-transformer.d.ts.map +1 -1
- package/dist/runtime/row-transformer.js +163 -38
- package/dist/runtime/row-transformer.js.map +1 -1
- package/dist/runtime/run-cleanup-steps.d.ts +5 -0
- package/dist/runtime/run-cleanup-steps.d.ts.map +1 -0
- package/dist/runtime/run-cleanup-steps.js +19 -0
- package/dist/runtime/run-cleanup-steps.js.map +1 -0
- package/dist/runtime/runtime-closed-error.d.ts +9 -0
- package/dist/runtime/runtime-closed-error.d.ts.map +1 -0
- package/dist/runtime/runtime-closed-error.js +12 -0
- package/dist/runtime/runtime-closed-error.js.map +1 -0
- package/dist/runtime/runtime-config.d.ts +13 -0
- package/dist/runtime/runtime-config.d.ts.map +1 -0
- package/dist/runtime/runtime-config.js +115 -0
- package/dist/runtime/runtime-config.js.map +1 -0
- package/dist/runtime/runtime-entropy.d.ts +14 -0
- package/dist/runtime/runtime-entropy.d.ts.map +1 -0
- package/dist/runtime/runtime-entropy.js +43 -0
- package/dist/runtime/runtime-entropy.js.map +1 -0
- package/dist/runtime/runtime-source.d.ts +206 -0
- package/dist/runtime/runtime-source.d.ts.map +1 -0
- package/dist/runtime/runtime-source.js +64 -0
- package/dist/runtime/runtime-source.js.map +1 -0
- package/dist/runtime/schema-metadata.d.ts +22 -0
- package/dist/runtime/schema-metadata.d.ts.map +1 -0
- package/dist/runtime/schema-metadata.js +70 -0
- package/dist/runtime/schema-metadata.js.map +1 -0
- package/dist/runtime/select-projection.d.ts +5 -0
- package/dist/runtime/select-projection.d.ts.map +1 -0
- package/dist/runtime/select-projection.js +47 -0
- package/dist/runtime/select-projection.js.map +1 -0
- package/dist/runtime/snapshot-ref.d.ts +24 -0
- package/dist/runtime/snapshot-ref.d.ts.map +1 -0
- package/dist/runtime/snapshot-ref.js +43 -0
- package/dist/runtime/snapshot-ref.js.map +1 -0
- package/dist/runtime/store-held-by-another-tab-error.d.ts +53 -0
- package/dist/runtime/store-held-by-another-tab-error.d.ts.map +1 -0
- package/dist/runtime/store-held-by-another-tab-error.js +55 -0
- package/dist/runtime/store-held-by-another-tab-error.js.map +1 -0
- package/dist/runtime/streaming-source.d.ts +4 -0
- package/dist/runtime/streaming-source.d.ts.map +1 -0
- package/dist/runtime/streaming-source.js +53 -0
- package/dist/runtime/streaming-source.js.map +1 -0
- package/dist/runtime/structural-values.d.ts +6 -0
- package/dist/runtime/structural-values.d.ts.map +1 -0
- package/dist/runtime/structural-values.js +51 -0
- package/dist/runtime/structural-values.js.map +1 -0
- package/dist/runtime/subscription-manager.d.ts +103 -14
- package/dist/runtime/subscription-manager.d.ts.map +1 -1
- package/dist/runtime/subscription-manager.js +1051 -25
- package/dist/runtime/subscription-manager.js.map +1 -1
- package/dist/runtime/sync-status.d.ts +178 -0
- package/dist/runtime/sync-status.d.ts.map +1 -0
- package/dist/runtime/sync-status.js +163 -0
- package/dist/runtime/sync-status.js.map +1 -0
- package/dist/runtime/sync-telemetry.d.ts +35 -0
- package/dist/runtime/sync-telemetry.d.ts.map +1 -0
- package/dist/runtime/sync-telemetry.js +354 -0
- package/dist/runtime/sync-telemetry.js.map +1 -0
- package/dist/runtime/system-identity.d.ts +5 -0
- package/dist/runtime/system-identity.d.ts.map +1 -0
- package/dist/runtime/system-identity.js +10 -0
- package/dist/runtime/system-identity.js.map +1 -0
- package/dist/runtime/telemetry-env.d.ts +2 -0
- package/dist/runtime/telemetry-env.d.ts.map +1 -0
- package/dist/runtime/telemetry-env.js +16 -0
- package/dist/runtime/telemetry-env.js.map +1 -0
- package/dist/runtime/telemetry-env.native.d.ts +3 -0
- package/dist/runtime/telemetry-env.native.d.ts.map +1 -0
- package/dist/runtime/telemetry-env.native.js +7 -0
- package/dist/runtime/telemetry-env.native.js.map +1 -0
- package/dist/runtime/text-anchors.d.ts +58 -0
- package/dist/runtime/text-anchors.d.ts.map +1 -0
- package/dist/runtime/text-anchors.js +9 -0
- package/dist/runtime/text-anchors.js.map +1 -0
- package/dist/runtime/unsupported-storage-codecs-error.d.ts +53 -0
- package/dist/runtime/unsupported-storage-codecs-error.d.ts.map +1 -0
- package/dist/runtime/unsupported-storage-codecs-error.js +74 -0
- package/dist/runtime/unsupported-storage-codecs-error.js.map +1 -0
- package/dist/runtime/url.d.ts +32 -0
- package/dist/runtime/url.d.ts.map +1 -0
- package/dist/runtime/url.js +96 -0
- package/dist/runtime/url.js.map +1 -0
- package/dist/runtime/utf8.d.ts +10 -0
- package/dist/runtime/utf8.d.ts.map +1 -0
- package/dist/runtime/utf8.js +93 -0
- package/dist/runtime/utf8.js.map +1 -0
- package/dist/runtime/util.d.ts +18 -0
- package/dist/runtime/util.d.ts.map +1 -0
- package/dist/runtime/util.js +59 -0
- package/dist/runtime/util.js.map +1 -0
- package/dist/runtime/value-converter.d.ts +9 -17
- package/dist/runtime/value-converter.d.ts.map +1 -1
- package/dist/runtime/value-converter.js +156 -42
- package/dist/runtime/value-converter.js.map +1 -1
- package/dist/runtime/wasm-loader.d.ts +6 -0
- package/dist/runtime/wasm-loader.d.ts.map +1 -0
- package/dist/runtime/wasm-loader.js +127 -0
- package/dist/runtime/wasm-loader.js.map +1 -0
- package/dist/runtime/write-preparation.d.ts +24 -0
- package/dist/runtime/write-preparation.d.ts.map +1 -0
- package/dist/runtime/write-preparation.js +63 -0
- package/dist/runtime/write-preparation.js.map +1 -0
- package/dist/runtime/write-row.d.ts +8 -0
- package/dist/runtime/write-row.d.ts.map +1 -0
- package/dist/runtime/write-row.js +17 -0
- package/dist/runtime/write-row.js.map +1 -0
- package/dist/schema-builders.d.ts +48 -0
- package/dist/schema-builders.d.ts.map +1 -0
- package/dist/schema-builders.js +26 -0
- package/dist/schema-builders.js.map +1 -0
- package/dist/schema-dsl/define-schema.d.ts +32 -0
- package/dist/schema-dsl/define-schema.d.ts.map +1 -0
- package/dist/schema-dsl/define-schema.js +80 -0
- package/dist/schema-dsl/define-schema.js.map +1 -0
- package/dist/schema-dsl/readable-app.d.ts +30 -0
- package/dist/schema-dsl/readable-app.d.ts.map +1 -0
- package/dist/schema-dsl/readable-app.js +139 -0
- package/dist/schema-dsl/readable-app.js.map +1 -0
- package/dist/schema-dsl/table.d.ts +101 -0
- package/dist/schema-dsl/table.d.ts.map +1 -0
- package/dist/schema-dsl/table.js +153 -0
- package/dist/schema-dsl/table.js.map +1 -0
- package/dist/schema-errors.d.ts +6 -0
- package/dist/schema-errors.d.ts.map +1 -0
- package/dist/schema-errors.js +6 -0
- package/dist/schema-errors.js.map +1 -0
- package/dist/schema-loader.d.ts +16 -0
- package/dist/schema-loader.d.ts.map +1 -0
- package/dist/schema-loader.js +108 -0
- package/dist/schema-loader.js.map +1 -0
- package/dist/schema-name.d.ts +2 -0
- package/dist/schema-name.d.ts.map +1 -0
- package/dist/schema-name.js +19 -0
- package/dist/schema-name.js.map +1 -0
- package/dist/schema-namespace.d.ts +7 -0
- package/dist/schema-namespace.d.ts.map +1 -0
- package/dist/schema-namespace.js +7 -0
- package/dist/schema-namespace.js.map +1 -0
- package/dist/schema-permissions.d.ts +12 -0
- package/dist/schema-permissions.d.ts.map +1 -0
- package/dist/schema-permissions.js +17 -0
- package/dist/schema-permissions.js.map +1 -0
- package/dist/schema-source.d.ts +11 -0
- package/dist/schema-source.d.ts.map +1 -0
- package/dist/schema-source.js +53 -0
- package/dist/schema-source.js.map +1 -0
- package/dist/schema.d.ts +95 -38
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +1 -16
- package/dist/schema.js.map +1 -1
- package/dist/session/backend-watch.d.ts +186 -0
- package/dist/session/backend-watch.d.ts.map +1 -0
- package/dist/session/backend-watch.js +698 -0
- package/dist/session/backend-watch.js.map +1 -0
- package/dist/session/config-options.d.ts +15 -0
- package/dist/session/config-options.d.ts.map +1 -0
- package/dist/session/config-options.js +55 -0
- package/dist/session/config-options.js.map +1 -0
- package/dist/session/consumer.d.ts +3 -0
- package/dist/session/consumer.d.ts.map +1 -0
- package/dist/session/consumer.js +3 -0
- package/dist/session/consumer.js.map +1 -0
- package/dist/session/create-jazz-session.d.ts +123 -0
- package/dist/session/create-jazz-session.d.ts.map +1 -0
- package/dist/session/create-jazz-session.js +542 -0
- package/dist/session/create-jazz-session.js.map +1 -0
- package/dist/session/follow-user.d.ts +72 -0
- package/dist/session/follow-user.d.ts.map +1 -0
- package/dist/session/follow-user.js +147 -0
- package/dist/session/follow-user.js.map +1 -0
- package/dist/session/jazz-session.d.ts +234 -0
- package/dist/session/jazz-session.d.ts.map +1 -0
- package/dist/session/jazz-session.js +528 -0
- package/dist/session/jazz-session.js.map +1 -0
- package/dist/session/native-backend-watch.d.ts +4 -0
- package/dist/session/native-backend-watch.d.ts.map +1 -0
- package/dist/session/native-backend-watch.js +14 -0
- package/dist/session/native-backend-watch.js.map +1 -0
- package/dist/session/no-kept-device-account-error.d.ts +6 -0
- package/dist/session/no-kept-device-account-error.d.ts.map +1 -0
- package/dist/session/no-kept-device-account-error.js +8 -0
- package/dist/session/no-kept-device-account-error.js.map +1 -0
- package/dist/session/replica-ledger.d.ts +164 -0
- package/dist/session/replica-ledger.d.ts.map +1 -0
- package/dist/session/replica-ledger.js +496 -0
- package/dist/session/replica-ledger.js.map +1 -0
- package/dist/session/state.d.ts +135 -0
- package/dist/session/state.d.ts.map +1 -0
- package/dist/session/state.js +535 -0
- package/dist/session/state.js.map +1 -0
- package/dist/shared/index.d.ts +20 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +17 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/solid/create-solid-jazz-client-internal.d.ts +13 -0
- package/dist/solid/create-solid-jazz-client-internal.d.ts.map +1 -0
- package/dist/solid/create-solid-jazz-client-internal.js +82 -0
- package/dist/solid/create-solid-jazz-client-internal.js.map +1 -0
- package/dist/solid/create-solid-jazz-client-internal.ssr.js +101 -0
- package/dist/solid/create-solid-jazz-client-internal.ssr.js.map +1 -0
- package/dist/solid/create-solid-jazz-client.d.ts +24 -0
- package/dist/solid/create-solid-jazz-client.d.ts.map +1 -0
- package/dist/solid/create-solid-jazz-client.js +42 -0
- package/dist/solid/create-solid-jazz-client.js.map +1 -0
- package/dist/solid/create-solid-jazz-client.ssr.js +45 -0
- package/dist/solid/create-solid-jazz-client.ssr.js.map +1 -0
- package/dist/solid/index.d.ts +13 -0
- package/dist/solid/index.d.ts.map +1 -0
- package/dist/solid/index.js +9 -0
- package/dist/solid/index.ssr.js +9 -0
- package/dist/solid/provider.d.ts +25 -0
- package/dist/solid/provider.d.ts.map +1 -0
- package/dist/solid/provider.js +48 -0
- package/dist/solid/provider.js.map +1 -0
- package/dist/solid/provider.ssr.js +48 -0
- package/dist/solid/provider.ssr.js.map +1 -0
- package/dist/solid/session-context.d.ts +14 -0
- package/dist/solid/session-context.d.ts.map +1 -0
- package/dist/solid/session-context.js +6 -0
- package/dist/solid/session-context.js.map +1 -0
- package/dist/solid/session-context.ssr.js +10 -0
- package/dist/solid/session-context.ssr.js.map +1 -0
- package/dist/solid/session.d.ts +55 -0
- package/dist/solid/session.d.ts.map +1 -0
- package/dist/solid/session.js +130 -0
- package/dist/solid/session.js.map +1 -0
- package/dist/solid/session.ssr.js +156 -0
- package/dist/solid/session.ssr.js.map +1 -0
- package/dist/solid/solid-jazz-client-store.d.ts +11 -0
- package/dist/solid/solid-jazz-client-store.d.ts.map +1 -0
- package/dist/solid/solid-jazz-client-store.js +38 -0
- package/dist/solid/solid-jazz-client-store.js.map +1 -0
- package/dist/solid/solid-jazz-client-store.ssr.js +39 -0
- package/dist/solid/solid-jazz-client-store.ssr.js.map +1 -0
- package/dist/solid/use-all.d.ts +18 -0
- package/dist/solid/use-all.d.ts.map +1 -0
- package/dist/solid/use-all.js +71 -0
- package/dist/solid/use-all.js.map +1 -0
- package/dist/solid/use-all.ssr.js +84 -0
- package/dist/solid/use-all.ssr.js.map +1 -0
- package/dist/solid/use-one.d.ts +18 -0
- package/dist/solid/use-one.d.ts.map +1 -0
- package/dist/solid/use-one.js +27 -0
- package/dist/solid/use-one.js.map +1 -0
- package/dist/solid/use-one.ssr.js +27 -0
- package/dist/solid/use-one.ssr.js.map +1 -0
- package/dist/solid/use-sync-status.d.ts +8 -0
- package/dist/solid/use-sync-status.d.ts.map +1 -0
- package/dist/solid/use-sync-status.js +13 -0
- package/dist/solid/use-sync-status.js.map +1 -0
- package/dist/solid/use-sync-status.ssr.js +20 -0
- package/dist/solid/use-sync-status.ssr.js.map +1 -0
- package/dist/subscription-store-internal.d.ts +11 -0
- package/dist/subscription-store-internal.d.ts.map +1 -0
- package/dist/subscription-store-internal.js +18 -0
- package/dist/subscription-store-internal.js.map +1 -0
- package/dist/subscriptions-orchestrator.d.ts +92 -14
- package/dist/subscriptions-orchestrator.d.ts.map +1 -1
- package/dist/subscriptions-orchestrator.js +390 -75
- package/dist/subscriptions-orchestrator.js.map +1 -1
- package/dist/svelte/JazzProvider.svelte +110 -0
- package/dist/svelte/JazzProvider.svelte.d.ts +24 -0
- package/dist/svelte/JazzProvider.svelte.d.ts.map +1 -0
- package/dist/svelte/JazzSvelteClientProvider.svelte +83 -0
- package/dist/svelte/JazzSvelteClientProvider.svelte.d.ts +15 -0
- package/dist/svelte/JazzSvelteClientProvider.svelte.d.ts.map +1 -0
- package/dist/svelte/context.svelte.d.ts +19 -3
- package/dist/svelte/context.svelte.d.ts.map +1 -1
- package/dist/svelte/context.svelte.js +21 -5
- package/dist/svelte/create-jazz-client.d.ts +2 -8
- package/dist/svelte/create-jazz-client.d.ts.map +1 -1
- package/dist/svelte/create-jazz-client.js +1 -17
- package/dist/svelte/index.d.ts +14 -7
- package/dist/svelte/index.d.ts.map +1 -1
- package/dist/svelte/index.js +10 -7
- package/dist/svelte/query-subscription.svelte.d.ts +60 -0
- package/dist/svelte/query-subscription.svelte.d.ts.map +1 -0
- package/dist/svelte/query-subscription.svelte.js +135 -0
- package/dist/svelte/session-state.d.ts +27 -0
- package/dist/svelte/session-state.d.ts.map +1 -0
- package/dist/svelte/session-state.js +49 -0
- package/dist/svelte/sync-status.d.ts +11 -0
- package/dist/svelte/sync-status.d.ts.map +1 -0
- package/dist/svelte/sync-status.js +15 -0
- package/dist/testing/fixtures/with-bigint/schema.d.ts +18 -0
- package/dist/testing/fixtures/with-bigint/schema.d.ts.map +1 -0
- package/dist/testing/fixtures/with-bigint/schema.js +15 -0
- package/dist/testing/fixtures/with-bigint/schema.js.map +1 -0
- package/dist/testing/index.d.ts +6 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +5 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/policy-test-app.d.ts +129 -0
- package/dist/testing/policy-test-app.d.ts.map +1 -0
- package/dist/testing/policy-test-app.js +229 -0
- package/dist/testing/policy-test-app.js.map +1 -0
- package/dist/testing/test-app.d.ts +272 -0
- package/dist/testing/test-app.d.ts.map +1 -0
- package/dist/testing/test-app.js +62 -0
- package/dist/testing/test-app.js.map +1 -0
- package/dist/testing/test-jazz.d.ts +119 -0
- package/dist/testing/test-jazz.d.ts.map +1 -0
- package/dist/testing/test-jazz.js +162 -0
- package/dist/testing/test-jazz.js.map +1 -0
- package/dist/testing/test-jwt-issuer.d.ts +19 -0
- package/dist/testing/test-jwt-issuer.d.ts.map +1 -0
- package/dist/testing/test-jwt-issuer.js +40 -0
- package/dist/testing/test-jwt-issuer.js.map +1 -0
- package/dist/text-field/index.d.ts +40 -0
- package/dist/text-field/index.d.ts.map +1 -0
- package/dist/text-field/index.js +129 -0
- package/dist/text-field/index.js.map +1 -0
- package/dist/thin/index.d.ts +80 -0
- package/dist/thin/index.d.ts.map +1 -0
- package/dist/thin/index.js +219 -0
- package/dist/thin/index.js.map +1 -0
- package/dist/thin/self-signed-token.d.ts +13 -0
- package/dist/thin/self-signed-token.d.ts.map +1 -0
- package/dist/thin/self-signed-token.js +100 -0
- package/dist/thin/self-signed-token.js.map +1 -0
- package/dist/thin/thin-runtime-source.d.ts +19 -0
- package/dist/thin/thin-runtime-source.d.ts.map +1 -0
- package/dist/thin/thin-runtime-source.js +66 -0
- package/dist/thin/thin-runtime-source.js.map +1 -0
- package/dist/thin/thin-runtime.d.ts +294 -0
- package/dist/thin/thin-runtime.d.ts.map +1 -0
- package/dist/thin/thin-runtime.js +1492 -0
- package/dist/thin/thin-runtime.js.map +1 -0
- package/dist/thin/wire.d.ts +160 -0
- package/dist/thin/wire.d.ts.map +1 -0
- package/dist/thin/wire.js +304 -0
- package/dist/thin/wire.js.map +1 -0
- package/dist/typed-app.d.ts +644 -0
- package/dist/typed-app.d.ts.map +1 -0
- package/dist/typed-app.js +549 -0
- package/dist/typed-app.js.map +1 -0
- package/dist/vue/create-jazz-client.d.ts +3 -0
- package/dist/vue/create-jazz-client.d.ts.map +1 -0
- package/dist/vue/create-jazz-client.js +2 -0
- package/dist/vue/create-jazz-client.js.map +1 -0
- package/dist/vue/index.d.ts +13 -0
- package/dist/vue/index.d.ts.map +1 -0
- package/dist/vue/index.js +9 -0
- package/dist/vue/index.js.map +1 -0
- package/dist/vue/provider.d.ts +50 -0
- package/dist/vue/provider.d.ts.map +1 -0
- package/dist/vue/provider.js +97 -0
- package/dist/vue/provider.js.map +1 -0
- package/dist/vue/session-key.d.ts +15 -0
- package/dist/vue/session-key.d.ts.map +1 -0
- package/dist/vue/session-key.js +7 -0
- package/dist/vue/session-key.js.map +1 -0
- package/dist/vue/session.d.ts +40 -0
- package/dist/vue/session.d.ts.map +1 -0
- package/dist/vue/session.js +112 -0
- package/dist/vue/session.js.map +1 -0
- package/dist/vue/use-all.d.ts +61 -0
- package/dist/vue/use-all.d.ts.map +1 -0
- package/dist/vue/use-all.js +104 -0
- package/dist/vue/use-all.js.map +1 -0
- package/dist/vue/use-one.d.ts +24 -0
- package/dist/vue/use-one.d.ts.map +1 -0
- package/dist/vue/use-one.js +17 -0
- package/dist/vue/use-one.js.map +1 -0
- package/dist/vue/use-sync-status.d.ts +9 -0
- package/dist/vue/use-sync-status.d.ts.map +1 -0
- package/dist/vue/use-sync-status.js +16 -0
- package/dist/vue/use-sync-status.js.map +1 -0
- package/dist/web/create-jazz-client.d.ts +12 -0
- package/dist/web/create-jazz-client.d.ts.map +1 -0
- package/dist/web/create-jazz-client.js +35 -0
- package/dist/web/create-jazz-client.js.map +1 -0
- package/dist/web/lazy-local-first.d.ts +5 -0
- package/dist/web/lazy-local-first.d.ts.map +1 -0
- package/dist/web/lazy-local-first.js +8 -0
- package/dist/web/lazy-local-first.js.map +1 -0
- package/dist/web/registered-jazz-client.d.ts +15 -0
- package/dist/web/registered-jazz-client.d.ts.map +1 -0
- package/dist/web/registered-jazz-client.js +35 -0
- package/dist/web/registered-jazz-client.js.map +1 -0
- package/dist/where-operators.d.ts +13 -0
- package/dist/where-operators.d.ts.map +1 -0
- package/dist/where-operators.js +66 -0
- package/dist/where-operators.js.map +1 -0
- package/dist/window-client-storage.d.ts +7 -0
- package/dist/window-client-storage.d.ts.map +1 -0
- package/dist/window-client-storage.js +27 -0
- package/dist/window-client-storage.js.map +1 -0
- package/dist/worker/jazz-broker-worker-core.d.ts +34 -0
- package/dist/worker/jazz-broker-worker-core.d.ts.map +1 -0
- package/dist/worker/jazz-broker-worker-core.js +2241 -0
- package/dist/worker/jazz-broker-worker-core.js.map +1 -0
- package/dist/worker/jazz-broker-worker.d.ts +3 -0
- package/dist/worker/jazz-broker-worker.d.ts.map +1 -0
- package/dist/worker/jazz-broker-worker.js +5 -0
- package/dist/worker/jazz_wasm_bg.wasm +0 -0
- package/dist/worker/mutation-error-delivery.d.ts +8 -0
- package/dist/worker/mutation-error-delivery.d.ts.map +1 -0
- package/dist/worker/mutation-error-delivery.js +10 -0
- package/dist/worker/mutation-error-delivery.js.map +1 -0
- package/dist/worker/runtime-admission.d.ts +34 -0
- package/dist/worker/runtime-admission.d.ts.map +1 -0
- package/dist/worker/runtime-admission.js +60 -0
- package/dist/worker/runtime-admission.js.map +1 -0
- package/dist/worker/vite-dev-broker.d.ts +2 -0
- package/dist/worker/vite-dev-broker.d.ts.map +1 -0
- package/dist/worker/vite-dev-broker.js +8 -0
- package/dist/worker/vite-dev-broker.js.map +1 -0
- package/package.json +299 -37
- package/bin/native/.gitkeep +0 -0
- package/bin/native/jazz-tools-darwin-arm64 +0 -0
- package/bin/native/jazz-tools-darwin-x64 +0 -0
- package/bin/native/jazz-tools-linux-arm64 +0 -0
- package/bin/native/jazz-tools-linux-x64 +0 -0
- package/bin/native/jazz-tools-windows-x64.exe +0 -0
- package/dist/backend/create-jazz-context.test.d.ts +0 -2
- package/dist/backend/create-jazz-context.test.d.ts.map +0 -1
- package/dist/backend/create-jazz-context.test.js +0 -141
- package/dist/backend/create-jazz-context.test.js.map +0 -1
- package/dist/cli.test.d.ts +0 -2
- package/dist/cli.test.d.ts.map +0 -1
- package/dist/cli.test.js +0 -154
- package/dist/cli.test.js.map +0 -1
- package/dist/codegen/codegen.test.d.ts +0 -2
- package/dist/codegen/codegen.test.d.ts.map +0 -1
- package/dist/codegen/codegen.test.js +0 -914
- package/dist/codegen/codegen.test.js.map +0 -1
- package/dist/codegen/index.d.ts +0 -18
- package/dist/codegen/index.d.ts.map +0 -1
- package/dist/codegen/index.js +0 -22
- package/dist/codegen/index.js.map +0 -1
- package/dist/codegen/query-builder-generator.d.ts +0 -26
- package/dist/codegen/query-builder-generator.d.ts.map +0 -1
- package/dist/codegen/query-builder-generator.js +0 -342
- package/dist/codegen/query-builder-generator.js.map +0 -1
- package/dist/codegen/schema-reader.d.ts +0 -12
- package/dist/codegen/schema-reader.d.ts.map +0 -1
- package/dist/codegen/schema-reader.js +0 -180
- package/dist/codegen/schema-reader.js.map +0 -1
- package/dist/codegen/type-generator.d.ts +0 -29
- package/dist/codegen/type-generator.d.ts.map +0 -1
- package/dist/codegen/type-generator.js +0 -296
- package/dist/codegen/type-generator.js.map +0 -1
- package/dist/dev-tools/dev-tools.d.ts +0 -15
- package/dist/dev-tools/dev-tools.d.ts.map +0 -1
- package/dist/dev-tools/dev-tools.js +0 -297
- package/dist/dev-tools/dev-tools.js.map +0 -1
- package/dist/dev-tools/extension-panel.d.ts +0 -19
- package/dist/dev-tools/extension-panel.d.ts.map +0 -1
- package/dist/dev-tools/extension-panel.js +0 -419
- package/dist/dev-tools/extension-panel.js.map +0 -1
- package/dist/dev-tools/index.d.ts +0 -3
- package/dist/dev-tools/index.d.ts.map +0 -1
- package/dist/dev-tools/index.js +0 -3
- package/dist/dev-tools/index.js.map +0 -1
- package/dist/dev-tools/protocol.d.ts +0 -49
- package/dist/dev-tools/protocol.d.ts.map +0 -1
- package/dist/dev-tools/protocol.js +0 -40
- package/dist/dev-tools/protocol.js.map +0 -1
- package/dist/dsl.test.d.ts +0 -2
- package/dist/dsl.test.d.ts.map +0 -1
- package/dist/dsl.test.js +0 -51
- package/dist/dsl.test.js.map +0 -1
- package/dist/permissions/index.d.ts +0 -146
- package/dist/permissions/index.d.ts.map +0 -1
- package/dist/permissions/index.js +0 -1211
- package/dist/permissions/index.js.map +0 -1
- package/dist/permissions/index.test.d.ts +0 -2
- package/dist/permissions/index.test.d.ts.map +0 -1
- package/dist/permissions/index.test.js +0 -830
- package/dist/permissions/index.test.js.map +0 -1
- package/dist/permissions/type-inference.test.d.ts +0 -2
- package/dist/permissions/type-inference.test.d.ts.map +0 -1
- package/dist/permissions/type-inference.test.js +0 -149
- package/dist/permissions/type-inference.test.js.map +0 -1
- package/dist/react/create-jazz-client.integration.test.d.ts +0 -2
- package/dist/react/create-jazz-client.integration.test.d.ts.map +0 -1
- package/dist/react/create-jazz-client.integration.test.js +0 -82
- package/dist/react/create-jazz-client.integration.test.js.map +0 -1
- package/dist/react/create-jazz-client.test.d.ts +0 -2
- package/dist/react/create-jazz-client.test.d.ts.map +0 -1
- package/dist/react/create-jazz-client.test.js +0 -135
- package/dist/react/create-jazz-client.test.js.map +0 -1
- package/dist/react/synthetic-user-switcher.d.ts +0 -9
- package/dist/react/synthetic-user-switcher.d.ts.map +0 -1
- package/dist/react/synthetic-user-switcher.js +0 -65
- package/dist/react/synthetic-user-switcher.js.map +0 -1
- package/dist/react/synthetic-users.d.ts +0 -2
- package/dist/react/synthetic-users.d.ts.map +0 -1
- package/dist/react/synthetic-users.js +0 -2
- package/dist/react/synthetic-users.js.map +0 -1
- package/dist/react/synthetic-users.test.d.ts +0 -2
- package/dist/react/synthetic-users.test.d.ts.map +0 -1
- package/dist/react/synthetic-users.test.js +0 -43
- package/dist/react/synthetic-users.test.js.map +0 -1
- package/dist/react/use-link-external-identity.d.ts +0 -25
- package/dist/react/use-link-external-identity.d.ts.map +0 -1
- package/dist/react/use-link-external-identity.js +0 -45
- package/dist/react/use-link-external-identity.js.map +0 -1
- package/dist/react-native/create-jazz-client.test.d.ts +0 -2
- package/dist/react-native/create-jazz-client.test.d.ts.map +0 -1
- package/dist/react-native/create-jazz-client.test.js +0 -162
- package/dist/react-native/create-jazz-client.test.js.map +0 -1
- package/dist/react-native/create-jazz-rn-runtime.d.ts +0 -13
- package/dist/react-native/create-jazz-rn-runtime.d.ts.map +0 -1
- package/dist/react-native/create-jazz-rn-runtime.js +0 -7
- package/dist/react-native/create-jazz-rn-runtime.js.map +0 -1
- package/dist/react-native/db.d.ts +0 -16
- package/dist/react-native/db.d.ts.map +0 -1
- package/dist/react-native/db.js +0 -50
- package/dist/react-native/db.js.map +0 -1
- package/dist/react-native/db.test.d.ts +0 -2
- package/dist/react-native/db.test.d.ts.map +0 -1
- package/dist/react-native/db.test.js +0 -148
- package/dist/react-native/db.test.js.map +0 -1
- package/dist/react-native/jazz-rn-runtime-adapter.d.ts +0 -56
- package/dist/react-native/jazz-rn-runtime-adapter.d.ts.map +0 -1
- package/dist/react-native/jazz-rn-runtime-adapter.js +0 -192
- package/dist/react-native/jazz-rn-runtime-adapter.js.map +0 -1
- package/dist/react-native/jazz-rn-runtime-adapter.test.d.ts +0 -2
- package/dist/react-native/jazz-rn-runtime-adapter.test.d.ts.map +0 -1
- package/dist/react-native/jazz-rn-runtime-adapter.test.js +0 -165
- package/dist/react-native/jazz-rn-runtime-adapter.test.js.map +0 -1
- package/dist/runtime/client-session.test.d.ts +0 -2
- package/dist/runtime/client-session.test.d.ts.map +0 -1
- package/dist/runtime/client-session.test.js +0 -84
- package/dist/runtime/client-session.test.js.map +0 -1
- package/dist/runtime/client.for-request.test.d.ts +0 -2
- package/dist/runtime/client.for-request.test.d.ts.map +0 -1
- package/dist/runtime/client.for-request.test.js +0 -191
- package/dist/runtime/client.for-request.test.js.map +0 -1
- package/dist/runtime/cloud-server.integration.test.d.ts +0 -2
- package/dist/runtime/cloud-server.integration.test.d.ts.map +0 -1
- package/dist/runtime/cloud-server.integration.test.js +0 -1210
- package/dist/runtime/cloud-server.integration.test.js.map +0 -1
- package/dist/runtime/dynamic-query.d.ts +0 -10
- package/dist/runtime/dynamic-query.d.ts.map +0 -1
- package/dist/runtime/dynamic-query.js +0 -11
- package/dist/runtime/dynamic-query.js.map +0 -1
- package/dist/runtime/leader-lock.d.ts +0 -15
- package/dist/runtime/leader-lock.d.ts.map +0 -1
- package/dist/runtime/leader-lock.js +0 -49
- package/dist/runtime/leader-lock.js.map +0 -1
- package/dist/runtime/local-auth.d.ts +0 -32
- package/dist/runtime/local-auth.d.ts.map +0 -1
- package/dist/runtime/local-auth.js +0 -93
- package/dist/runtime/local-auth.js.map +0 -1
- package/dist/runtime/local-auth.test.d.ts +0 -2
- package/dist/runtime/local-auth.test.d.ts.map +0 -1
- package/dist/runtime/local-auth.test.js +0 -50
- package/dist/runtime/local-auth.test.js.map +0 -1
- package/dist/runtime/query-adapter.test.d.ts +0 -5
- package/dist/runtime/query-adapter.test.d.ts.map +0 -1
- package/dist/runtime/query-adapter.test.js +0 -1249
- package/dist/runtime/query-adapter.test.js.map +0 -1
- package/dist/runtime/row-transformer.test.d.ts +0 -5
- package/dist/runtime/row-transformer.test.d.ts.map +0 -1
- package/dist/runtime/row-transformer.test.js +0 -385
- package/dist/runtime/row-transformer.test.js.map +0 -1
- package/dist/runtime/schema-fetch.d.ts +0 -17
- package/dist/runtime/schema-fetch.d.ts.map +0 -1
- package/dist/runtime/schema-fetch.js +0 -33
- package/dist/runtime/schema-fetch.js.map +0 -1
- package/dist/runtime/schema-fetch.test.d.ts +0 -2
- package/dist/runtime/schema-fetch.test.d.ts.map +0 -1
- package/dist/runtime/schema-fetch.test.js +0 -87
- package/dist/runtime/schema-fetch.test.js.map +0 -1
- package/dist/runtime/subscription-manager.test.d.ts +0 -5
- package/dist/runtime/subscription-manager.test.d.ts.map +0 -1
- package/dist/runtime/subscription-manager.test.js +0 -120
- package/dist/runtime/subscription-manager.test.js.map +0 -1
- package/dist/runtime/sync-transport.d.ts +0 -163
- package/dist/runtime/sync-transport.d.ts.map +0 -1
- package/dist/runtime/sync-transport.js +0 -477
- package/dist/runtime/sync-transport.js.map +0 -1
- package/dist/runtime/sync-transport.test.d.ts +0 -2
- package/dist/runtime/sync-transport.test.d.ts.map +0 -1
- package/dist/runtime/sync-transport.test.js +0 -310
- package/dist/runtime/sync-transport.test.js.map +0 -1
- package/dist/runtime/tab-leader-election.d.ts +0 -97
- package/dist/runtime/tab-leader-election.d.ts.map +0 -1
- package/dist/runtime/tab-leader-election.js +0 -339
- package/dist/runtime/tab-leader-election.js.map +0 -1
- package/dist/runtime/tab-leader-election.test.d.ts +0 -2
- package/dist/runtime/tab-leader-election.test.d.ts.map +0 -1
- package/dist/runtime/tab-leader-election.test.js +0 -278
- package/dist/runtime/tab-leader-election.test.js.map +0 -1
- package/dist/runtime/testing/wasm-runtime-test-utils.d.ts +0 -13
- package/dist/runtime/testing/wasm-runtime-test-utils.d.ts.map +0 -1
- package/dist/runtime/testing/wasm-runtime-test-utils.js +0 -76
- package/dist/runtime/testing/wasm-runtime-test-utils.js.map +0 -1
- package/dist/runtime/utils.d.ts +0 -2
- package/dist/runtime/utils.d.ts.map +0 -1
- package/dist/runtime/utils.js +0 -16
- package/dist/runtime/utils.js.map +0 -1
- package/dist/runtime/value-converter.test.d.ts +0 -5
- package/dist/runtime/value-converter.test.d.ts.map +0 -1
- package/dist/runtime/value-converter.test.js +0 -222
- package/dist/runtime/value-converter.test.js.map +0 -1
- package/dist/runtime/worker-bridge.d.ts +0 -82
- package/dist/runtime/worker-bridge.d.ts.map +0 -1
- package/dist/runtime/worker-bridge.js +0 -308
- package/dist/runtime/worker-bridge.js.map +0 -1
- package/dist/runtime/worker-bridge.race-harness.test.d.ts +0 -2
- package/dist/runtime/worker-bridge.race-harness.test.d.ts.map +0 -1
- package/dist/runtime/worker-bridge.race-harness.test.js +0 -284
- package/dist/runtime/worker-bridge.race-harness.test.js.map +0 -1
- package/dist/runtime/worker-bridge.test.d.ts +0 -2
- package/dist/runtime/worker-bridge.test.d.ts.map +0 -1
- package/dist/runtime/worker-bridge.test.js +0 -233
- package/dist/runtime/worker-bridge.test.js.map +0 -1
- package/dist/sql-gen.d.ts +0 -4
- package/dist/sql-gen.d.ts.map +0 -1
- package/dist/sql-gen.js +0 -163
- package/dist/sql-gen.js.map +0 -1
- package/dist/sql-gen.test.d.ts +0 -2
- package/dist/sql-gen.test.d.ts.map +0 -1
- package/dist/sql-gen.test.js +0 -412
- package/dist/sql-gen.test.js.map +0 -1
- package/dist/subscriptions-orchestrator.integration.test.d.ts +0 -2
- package/dist/subscriptions-orchestrator.integration.test.d.ts.map +0 -1
- package/dist/subscriptions-orchestrator.integration.test.js +0 -192
- package/dist/subscriptions-orchestrator.integration.test.js.map +0 -1
- package/dist/subscriptions-orchestrator.test.d.ts +0 -2
- package/dist/subscriptions-orchestrator.test.d.ts.map +0 -1
- package/dist/subscriptions-orchestrator.test.js +0 -367
- package/dist/subscriptions-orchestrator.test.js.map +0 -1
- package/dist/svelte/JazzSvelteProvider.svelte +0 -49
- package/dist/svelte/JazzSvelteProvider.svelte.d.ts +0 -13
- package/dist/svelte/JazzSvelteProvider.svelte.d.ts.map +0 -1
- package/dist/svelte/SyntheticUserSwitcher.svelte +0 -121
- package/dist/svelte/SyntheticUserSwitcher.svelte.d.ts +0 -11
- package/dist/svelte/SyntheticUserSwitcher.svelte.d.ts.map +0 -1
- package/dist/svelte/context.test.d.ts +0 -2
- package/dist/svelte/context.test.d.ts.map +0 -1
- package/dist/svelte/context.test.js +0 -55
- package/dist/svelte/create-jazz-client.test.d.ts +0 -2
- package/dist/svelte/create-jazz-client.test.d.ts.map +0 -1
- package/dist/svelte/create-jazz-client.test.js +0 -50
- package/dist/svelte/use-all.svelte.d.ts +0 -32
- package/dist/svelte/use-all.svelte.d.ts.map +0 -1
- package/dist/svelte/use-all.svelte.js +0 -61
- package/dist/svelte/use-all.test.d.ts +0 -2
- package/dist/svelte/use-all.test.d.ts.map +0 -1
- package/dist/svelte/use-all.test.js +0 -158
- package/dist/svelte/use-link-external-identity.d.ts +0 -25
- package/dist/svelte/use-link-external-identity.d.ts.map +0 -1
- package/dist/svelte/use-link-external-identity.js +0 -33
- package/dist/svelte/use-link-external-identity.test.d.ts +0 -2
- package/dist/svelte/use-link-external-identity.test.d.ts.map +0 -1
- package/dist/svelte/use-link-external-identity.test.js +0 -97
- package/dist/synthetic-user-switcher.d.ts +0 -16
- package/dist/synthetic-user-switcher.d.ts.map +0 -1
- package/dist/synthetic-user-switcher.js +0 -134
- package/dist/synthetic-user-switcher.js.map +0 -1
- package/dist/synthetic-users.d.ts +0 -32
- package/dist/synthetic-users.d.ts.map +0 -1
- package/dist/synthetic-users.js +0 -124
- package/dist/synthetic-users.js.map +0 -1
- package/dist/testing/fixtures/basic/app.d.ts +0 -55
- package/dist/testing/fixtures/basic/app.d.ts.map +0 -1
- package/dist/testing/fixtures/basic/app.js +0 -174
- package/dist/testing/fixtures/basic/app.js.map +0 -1
- package/dist/testing/fixtures/basic/current.d.ts +0 -2
- package/dist/testing/fixtures/basic/current.d.ts.map +0 -1
- package/dist/testing/fixtures/basic/current.js +0 -6
- package/dist/testing/fixtures/basic/current.js.map +0 -1
- package/dist/testing/index.test.d.ts +0 -2
- package/dist/testing/index.test.d.ts.map +0 -1
- package/dist/testing/index.test.js +0 -234
- package/dist/testing/index.test.js.map +0 -1
- package/dist/testing/local-jazz-server.d.ts +0 -34
- package/dist/testing/local-jazz-server.d.ts.map +0 -1
- package/dist/testing/local-jazz-server.js +0 -313
- package/dist/testing/local-jazz-server.js.map +0 -1
- package/dist/testing/relation-ir-test-helpers.d.ts +0 -3
- package/dist/testing/relation-ir-test-helpers.d.ts.map +0 -1
- package/dist/testing/relation-ir-test-helpers.js +0 -258
- package/dist/testing/relation-ir-test-helpers.js.map +0 -1
- package/dist/worker/jazz-worker.d.ts +0 -9
- package/dist/worker/jazz-worker.d.ts.map +0 -1
- package/dist/worker/jazz-worker.js +0 -555
- package/dist/worker/jazz-worker.js.map +0 -1
- package/dist/worker/jazz-worker.ts +0 -630
- package/dist/worker/worker-protocol.d.ts +0 -136
- package/dist/worker/worker-protocol.d.ts.map +0 -1
- package/dist/worker/worker-protocol.js +0 -7
- package/dist/worker/worker-protocol.js.map +0 -1
|
@@ -0,0 +1,1388 @@
|
|
|
1
|
+
// The `vercel()` store: the app's core runs in a persistent Vercel Sandbox
|
|
2
|
+
// in the app's own Vercel project, with its data on a Drive. The backend
|
|
3
|
+
// creates the Sandbox on first use, wakes it when a request needs it and lets
|
|
4
|
+
// it stop when the app goes quiet. The function's own Vercel OIDC token is
|
|
5
|
+
// the only credential: the Sandbox SDK authenticates with it, and the core
|
|
6
|
+
// trusts exactly that workload (its issuer, audience and subject) and admits
|
|
7
|
+
// nothing else, so the app sets no Jazz env vars and no secret exists.
|
|
8
|
+
// Wake handling is adapted from garden-co/infra's v2 sync proxy (ADR 0004).
|
|
9
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
10
|
+
import { connectedBlobStore, resolveVercelBlob, resolveVercelS3, vercelBlob, } from "./blobs.js";
|
|
11
|
+
import { fetchFor, inProcessWebSocketFor, registerInProcessTransport, } from "../runtime/in-process-transport.js";
|
|
12
|
+
import { backendNative } from "./backend-native.js";
|
|
13
|
+
import { optionalPeerImportError } from "./optional-peer.js";
|
|
14
|
+
import { logStoreOpened } from "./store-log.js";
|
|
15
|
+
export const VERCEL_CORE_PORT = 1625;
|
|
16
|
+
const since = (t0) => Math.round(performance.now() - t0);
|
|
17
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
18
|
+
const DEFAULT_IDLE_MS = 5 * 60_000;
|
|
19
|
+
const WAKE_DEADLINE_MS = 60_000;
|
|
20
|
+
// A session reported as running may be seconds from its timeout; reuse it
|
|
21
|
+
// only if it can be extended.
|
|
22
|
+
const MIN_LEFT_MS = 30_000;
|
|
23
|
+
// Vercel's router can answer SANDBOX_NOT_LISTENING for minutes while the
|
|
24
|
+
// server listens; a fresh session routes, so recycle after this long.
|
|
25
|
+
const NOT_LISTENING_RECYCLE_MS = 12_000;
|
|
26
|
+
// How long a wake is trusted before the next request checks again.
|
|
27
|
+
const ENSURE_FRESH_MS = 10_000;
|
|
28
|
+
/**
|
|
29
|
+
* Vercel's router sets this on an answer it gave itself (the Sandbox isn't
|
|
30
|
+
* listening, or is stopping): the request never reached the core.
|
|
31
|
+
*/
|
|
32
|
+
const ROUTER_ERROR_HEADER = "x-vercel-error";
|
|
33
|
+
const KEEPALIVE_MS = 30_000;
|
|
34
|
+
// A session that answers `/health` while connections to its core keep
|
|
35
|
+
// ending without opening (none opening in between), for this long and this
|
|
36
|
+
// many times, is stopped, so the next wake starts a fresh one. A core that
|
|
37
|
+
// is restarting opens connections again well within this.
|
|
38
|
+
const UNREACHED_RECYCLE_MS = 20_000;
|
|
39
|
+
const UNREACHED_RECYCLE_COUNT = 2;
|
|
40
|
+
// After a start that can't succeed, requests fail fast for this long
|
|
41
|
+
// instead of each waking the Sandbox into the same failure.
|
|
42
|
+
const START_FAILURE_HOLD_MS = 30_000;
|
|
43
|
+
/** A core start that gave up (the start script said why); retrying won't help. */
|
|
44
|
+
class CoreStartError extends Error {
|
|
45
|
+
}
|
|
46
|
+
const isWakeConflict = (error) => /\b409\b|already attached|conflict/i.test(String(error));
|
|
47
|
+
/**
|
|
48
|
+
* Whether a lookup (`Sandbox.get`, `Drive.get`) failed because nothing has
|
|
49
|
+
* that name: `@vercel/sandbox`'s `APIError` with a 404 response. Any other
|
|
50
|
+
* failure (a 5xx, the network) says nothing about whether it exists.
|
|
51
|
+
*/
|
|
52
|
+
export const isNotFound = (error) => {
|
|
53
|
+
const status = error?.response?.status;
|
|
54
|
+
if (typeof status === "number")
|
|
55
|
+
return status === 404;
|
|
56
|
+
return /\b404\b/.test(String(error?.message ?? error));
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* A lookup that failed for another reason than "not found": retried until
|
|
60
|
+
* the wake's deadline, never read as a missing core (which would create one).
|
|
61
|
+
*/
|
|
62
|
+
class LookupError extends Error {
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Whether `Sandbox.create` failed because a Sandbox of that name exists:
|
|
66
|
+
* another instance won the race to create it. `@vercel/sandbox` throws an
|
|
67
|
+
* `APIError` whose `response` is the API's answer and whose message carries
|
|
68
|
+
* the API's own ("Status code 4xx is not ok: A sandbox with the name '…'
|
|
69
|
+
* already exists for this project"); the status may be 409 or a 4xx the
|
|
70
|
+
* API uses for invalid requests, so the API's message decides.
|
|
71
|
+
*/
|
|
72
|
+
const isNameTaken = (error) => {
|
|
73
|
+
const e = error;
|
|
74
|
+
const status = typeof e?.response?.status === "number" ? e.response.status : undefined;
|
|
75
|
+
if (status !== undefined && (status < 400 || status >= 500))
|
|
76
|
+
return false;
|
|
77
|
+
const said = [String(error), String(e?.json?.error?.message ?? "")].join(" ");
|
|
78
|
+
return /already exists/i.test(said);
|
|
79
|
+
};
|
|
80
|
+
async function healthy(base, timeoutMs, diag) {
|
|
81
|
+
const deadline = performance.now() + timeoutMs;
|
|
82
|
+
let pause = 50;
|
|
83
|
+
while (performance.now() < deadline) {
|
|
84
|
+
let why;
|
|
85
|
+
try {
|
|
86
|
+
const response = await fetch(`${base}/health`, {
|
|
87
|
+
signal: AbortSignal.timeout(2000),
|
|
88
|
+
});
|
|
89
|
+
if (response.ok)
|
|
90
|
+
return true;
|
|
91
|
+
const routerError = response.headers.get("x-vercel-error");
|
|
92
|
+
why = `http ${response.status}${routerError ? ` ${routerError}` : ""}`;
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
const e = error;
|
|
96
|
+
why = e.name === "TimeoutError" ? "timeout" : (e.cause?.code ?? e.name ?? "error");
|
|
97
|
+
}
|
|
98
|
+
diag[why] = (diag[why] ?? 0) + 1;
|
|
99
|
+
await sleep(pause);
|
|
100
|
+
pause = Math.min(pause * 2, 500);
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Whether version `a` is newer than `b`. A `-` starts a prerelease of what
|
|
106
|
+
* precedes it, at any depth, so `2.0.0-alpha.64-rc.1` is a candidate for
|
|
107
|
+
* `2.0.0-alpha.64` and sorts before it, as `2.0.0-alpha.64` does before
|
|
108
|
+
* `2.0.0`. Dot-separated parts compare numerically when both are numbers;
|
|
109
|
+
* a number sorts before a word. The start script's `newer` orders the same
|
|
110
|
+
* way (GNU `sort -V` with every `-` as `~`).
|
|
111
|
+
*/
|
|
112
|
+
export function newerVersion(a, b) {
|
|
113
|
+
return compareVersions(a, b) > 0;
|
|
114
|
+
}
|
|
115
|
+
const PRERELEASE = Symbol("prerelease");
|
|
116
|
+
function versionParts(version) {
|
|
117
|
+
const parts = [];
|
|
118
|
+
version.split("-").forEach((segment, i) => {
|
|
119
|
+
if (i > 0)
|
|
120
|
+
parts.push(PRERELEASE);
|
|
121
|
+
for (const part of segment.split(".")) {
|
|
122
|
+
parts.push(/^\d+$/.test(part) ? Number(part) : part);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
return parts;
|
|
126
|
+
}
|
|
127
|
+
function compareVersions(a, b) {
|
|
128
|
+
const x = versionParts(a);
|
|
129
|
+
const y = versionParts(b);
|
|
130
|
+
for (let i = 0;; i++) {
|
|
131
|
+
const p = x[i];
|
|
132
|
+
const q = y[i];
|
|
133
|
+
if (p === undefined && q === undefined)
|
|
134
|
+
return 0;
|
|
135
|
+
// One ended: a prerelease marker on the other sorts before the end
|
|
136
|
+
// (`alpha.64-rc.1` < `alpha.64`); any other part sorts after it.
|
|
137
|
+
if (p === undefined)
|
|
138
|
+
return q === PRERELEASE ? 1 : -1;
|
|
139
|
+
if (q === undefined)
|
|
140
|
+
return p === PRERELEASE ? -1 : 1;
|
|
141
|
+
if (p === q)
|
|
142
|
+
continue;
|
|
143
|
+
if (p === PRERELEASE)
|
|
144
|
+
return -1;
|
|
145
|
+
if (q === PRERELEASE)
|
|
146
|
+
return 1;
|
|
147
|
+
if (typeof p === "number" && typeof q === "number")
|
|
148
|
+
return p > q ? 1 : -1;
|
|
149
|
+
if (typeof p === "number")
|
|
150
|
+
return -1;
|
|
151
|
+
if (typeof q === "number")
|
|
152
|
+
return 1;
|
|
153
|
+
return p > q ? 1 : -1;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Writes the tarball at argv[1] to stdout (the Sandbox image has node but
|
|
158
|
+
* no curl). On failure it says why on stderr, and writes to the file at
|
|
159
|
+
* argv[2] whether retrying can help: a 4xx is permanent, except 408, 425
|
|
160
|
+
* and 429; those, a 5xx and a network error are transient.
|
|
161
|
+
*
|
|
162
|
+
* @internal
|
|
163
|
+
*/
|
|
164
|
+
export const DOWNLOAD_CORE = "const [url, kindFile] = process.argv.slice(1);" +
|
|
165
|
+
" const fail = (kind, why) => { require('node:fs').writeFileSync(kindFile, kind); console.error(why); process.exit(1); };" +
|
|
166
|
+
" fetch(url).then(async (r) => {" +
|
|
167
|
+
" if (!r.ok) return fail(r.status >= 400 && r.status < 500 && ![408, 425, 429].includes(r.status) ? 'permanent' : 'transient', 'HTTP ' + r.status);" +
|
|
168
|
+
" process.stdout.write(Buffer.from(await r.arrayBuffer()));" +
|
|
169
|
+
" }).catch((e) => fail('transient', e.message + (e.cause ? ': ' + (e.cause.code || e.cause.message) : '')));";
|
|
170
|
+
/** The addon's file in its npm tarball. */
|
|
171
|
+
const CORE_ADDON = "package/jazz-napi.linux-x64-gnu.node";
|
|
172
|
+
/**
|
|
173
|
+
* Runs the core in the Sandbox's Node: `node -e` with the addon, the app id
|
|
174
|
+
* and the core's options, in that order. Node owns the process's signals: a
|
|
175
|
+
* SIGTERM asks the core to drain, and the process exits once it has. The addon's path stays in the
|
|
176
|
+
* process's command line, which is how a later start recognises it.
|
|
177
|
+
*
|
|
178
|
+
* @internal
|
|
179
|
+
*/
|
|
180
|
+
export const CORE_LAUNCHER = "const [addon, appId, options] = process.argv.slice(1);" +
|
|
181
|
+
" const core = require(addon).serveCore({ ...JSON.parse(options), appId });" +
|
|
182
|
+
" for (const signal of ['SIGTERM', 'SIGINT']) process.once(signal, () => core.stop());" +
|
|
183
|
+
" core.closed().then(() => process.exit(0), (error) => { console.error(error); process.exit(1); });";
|
|
184
|
+
/**
|
|
185
|
+
* Start the core: install the core addon for `version` on the Drive,
|
|
186
|
+
* generate the app id once, and run the newest core version
|
|
187
|
+
* this Drive has seen, so an instance from an older deployment never
|
|
188
|
+
* downgrades data a newer one already wrote. A different running version is
|
|
189
|
+
* stopped first; the same one is left alone.
|
|
190
|
+
*/
|
|
191
|
+
export function startScript(version, tarballUrl, trust, blobs,
|
|
192
|
+
/** @internal Prefix for /data and /tmp, for tests. */
|
|
193
|
+
root = "") {
|
|
194
|
+
const q = (s) => `'${s.replaceAll("'", `'\\''`)}'`;
|
|
195
|
+
const trustLine = `${trust.issuer} ${trust.audience} ${trust.subject}`;
|
|
196
|
+
return `#!/bin/bash
|
|
197
|
+
# Written by jazz-tools' vercel() store for each server start.
|
|
198
|
+
set -euo pipefail
|
|
199
|
+
# The function names each start by its script's file name, and trusts only
|
|
200
|
+
# an error file that names one of its own starts (never a stale one).
|
|
201
|
+
start_id=$(basename "$0" .sh)
|
|
202
|
+
rm -f "$0"
|
|
203
|
+
data=${q(`${root}/data`)}
|
|
204
|
+
run=${q(`${root}/tmp`)}
|
|
205
|
+
# Starts are serialized; the server itself runs without the lock.
|
|
206
|
+
exec 9>"$run/jazz.lock"
|
|
207
|
+
flock 9
|
|
208
|
+
# Version order: GNU sort -V with every "-" as "~" sorts a prerelease
|
|
209
|
+
# before what it is a prerelease of, at any depth (alpha.64-rc.1 before
|
|
210
|
+
# alpha.64 before the release), as newerVersion does in TypeScript.
|
|
211
|
+
newer() {
|
|
212
|
+
[ "$1" != "$2" ] && [ "$(printf '%s\\n%s\\n' "\${1//-/\\~}" "\${2//-/\\~}" | sort -V | tail -1)" = "\${1//-/\\~}" ]
|
|
213
|
+
}
|
|
214
|
+
version=${q(version)}
|
|
215
|
+
trust=${q(trustLine)}
|
|
216
|
+
# A start that gives up says why in this version's error file, which the
|
|
217
|
+
# function reads and reports instead of waiting for a server that won't
|
|
218
|
+
# come: "<start id> permanent: …" when retrying can't help (the function then stops
|
|
219
|
+
# the Sandbox), "<start id> transient: …" when a later start may succeed.
|
|
220
|
+
error_file="$run/jazz-$version.error"
|
|
221
|
+
rm -f "$error_file"
|
|
222
|
+
fail() {
|
|
223
|
+
echo "jazz: $2" >&2
|
|
224
|
+
printf '%s %s: %s\\n' "$start_id" "$1" "$2" > "$error_file"
|
|
225
|
+
exit 1
|
|
226
|
+
}
|
|
227
|
+
trap 'fail transient "the start script failed at line $LINENO"' ERR
|
|
228
|
+
# The first start pins the workload this core trusts; a start for another
|
|
229
|
+
# workload never retargets it.
|
|
230
|
+
pinned=$(cat "$data/trust" 2>/dev/null || true)
|
|
231
|
+
if [ -n "$pinned" ] && [ "$pinned" != "$trust" ]; then
|
|
232
|
+
fail permanent "this core trusts $pinned; not retargeting it to $trust (to re-pin after a rename, delete $data/trust)"
|
|
233
|
+
fi
|
|
234
|
+
[ -n "$pinned" ] || { printf '%s\\n' "$trust" > "$data/trust.tmp" && mv "$data/trust.tmp" "$data/trust"; }
|
|
235
|
+
highest=$(cat "$data/version" 2>/dev/null || true)
|
|
236
|
+
if [ -n "$highest" ] && newer "$highest" "$version"; then
|
|
237
|
+
# A newer deployment owns this Drive: run its core, never ours.
|
|
238
|
+
if [ ! -s "$data/bin/jazz-napi-$highest.node" ]; then
|
|
239
|
+
fail permanent "$highest owns this Drive but its core is missing; not starting $version"
|
|
240
|
+
fi
|
|
241
|
+
version=$highest
|
|
242
|
+
fi
|
|
243
|
+
addon=$data/bin/jazz-napi-$version.node
|
|
244
|
+
# Fetch before stopping anything, so a failed download leaves the old core up.
|
|
245
|
+
if [ ! -s "$addon" ]; then
|
|
246
|
+
mkdir -p "$data/bin"
|
|
247
|
+
url=${q(tarballUrl)}
|
|
248
|
+
rm -f "$run/download.kind"
|
|
249
|
+
if ! node -e ${q(DOWNLOAD_CORE)} "$url" "$run/download.kind" 2>"$run/download.err" \\
|
|
250
|
+
| tar xz -O ${CORE_ADDON} 2>>"$run/download.err" > "$addon.tmp"; then
|
|
251
|
+
rm -f "$addon.tmp"
|
|
252
|
+
# No kind: the download arrived but isn't the core's tarball.
|
|
253
|
+
fail "$(cat "$run/download.kind" 2>/dev/null || echo permanent)" "could not download the core for $version from $url ($(head -c 300 "$run/download.err" | tr '\\n' ' ')); set vercel({ coreTarballUrl }) to a tarball of @garden-co/jazz-napi-linux-x64-gnu for this version"
|
|
254
|
+
fi
|
|
255
|
+
[ -s "$addon.tmp" ] || fail permanent "the core download for $version from $url was empty"
|
|
256
|
+
mv "$addon.tmp" "$addon"
|
|
257
|
+
fi
|
|
258
|
+
# The pid file may be stale (a resumed snapshot): trust it only if that
|
|
259
|
+
# process runs one of our cores. Its stderr is silenced before the input
|
|
260
|
+
# redirect, which fails for a missing pid file or a process that is gone.
|
|
261
|
+
pid=$(cat "$run/jazz.pid" 2>/dev/null || true)
|
|
262
|
+
cmdline=$(tr '\\0' ' ' 2>/dev/null < "/proc/$pid/cmdline" || true)
|
|
263
|
+
if [ -n "$pid" ] && [[ "$cmdline" == *"$data/bin/jazz-napi-"* ]]; then
|
|
264
|
+
[ "$(cat "$run/jazz.version" 2>/dev/null)" = "$version" ] && exit 0
|
|
265
|
+
kill -TERM "$pid" 2>/dev/null || true
|
|
266
|
+
for _ in $(seq 150); do kill -0 "$pid" 2>/dev/null || break; sleep 0.2; done
|
|
267
|
+
kill -KILL "$pid" 2>/dev/null || true
|
|
268
|
+
fi
|
|
269
|
+
if [ ! -s "$data/app-id" ]; then
|
|
270
|
+
app_id=$(cat /proc/sys/kernel/random/uuid)
|
|
271
|
+
printf '%s\\n' "$app_id" > "$data/app-id.tmp" && mv "$data/app-id.tmp" "$data/app-id"
|
|
272
|
+
fi
|
|
273
|
+
app_id=$(cat "$data/app-id")
|
|
274
|
+
export NODE_ENV=production
|
|
275
|
+
mkdir -p "$data/store"
|
|
276
|
+
printf '%s\\n' "$version" > "$data/version.tmp" && mv "$data/version.tmp" "$data/version"
|
|
277
|
+
# Older cores are never started again (see above).
|
|
278
|
+
find "$data/bin" -name 'jazz-napi-*' ! -name "jazz-napi-$version.node" -delete
|
|
279
|
+
printf '%s\\n' "$version" > "$run/jazz.version"
|
|
280
|
+
echo $$ > "$run/jazz.pid"
|
|
281
|
+
exec 9>&-
|
|
282
|
+
# The core admits only the deploying function's own workload.${blobsSetup(blobs, q)}
|
|
283
|
+
exec node -e ${q(CORE_LAUNCHER)} "$addon" "$app_id" ${q(JSON.stringify(coreOptions(`${root}/data/store`, trust, blobs)))}
|
|
284
|
+
`;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* The environment a core with `s3()` starts with: it assumes the
|
|
288
|
+
* Marketplace's role with the function's OIDC token, which every request
|
|
289
|
+
* carries. With `vercelBlob()` that token is the Blob credential itself.
|
|
290
|
+
*/
|
|
291
|
+
function blobsSetup(blobs, q) {
|
|
292
|
+
if (!blobs) {
|
|
293
|
+
return "\n# Large values stay in its SQLite file (they can move to Vercel Blob or S3 later).";
|
|
294
|
+
}
|
|
295
|
+
if ("storeId" in blobs) {
|
|
296
|
+
return "\n# Large values go to the project's Blob store, with the function's own OIDC token.";
|
|
297
|
+
}
|
|
298
|
+
return `
|
|
299
|
+
# Large values go to S3, under the role this project's functions assume.
|
|
300
|
+
export S3_BUCKET_NAME=${q(blobs.bucket)} AWS_REGION=${q(blobs.region)} AWS_ROLE_ARN=${q(blobs.roleArn)}`;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* The Vercel environment (`production`, `preview` or a custom one's slug)
|
|
304
|
+
* whose functions this core trusts, from the token's subject.
|
|
305
|
+
*/
|
|
306
|
+
export function environmentOf(trust) {
|
|
307
|
+
return /:environment:([^:]+)$/.exec(trust.subject)?.[1];
|
|
308
|
+
}
|
|
309
|
+
/** The core's options, but its app id, which the Drive keeps. */
|
|
310
|
+
function coreOptions(dataDir, trust, blobs) {
|
|
311
|
+
// A bucket or Blob store is claimed for the core's environment: one
|
|
312
|
+
// environment's OIDC token reaches the whole store, so preview and
|
|
313
|
+
// production never share one.
|
|
314
|
+
const environment = environmentOf(trust);
|
|
315
|
+
const claim = environment === undefined ? {} : { environment };
|
|
316
|
+
return {
|
|
317
|
+
port: VERCEL_CORE_PORT,
|
|
318
|
+
dataDir,
|
|
319
|
+
blobs: !blobs
|
|
320
|
+
? { kind: "sqlite" }
|
|
321
|
+
: "storeId" in blobs
|
|
322
|
+
? {
|
|
323
|
+
kind: "vercel-blob",
|
|
324
|
+
tokenFromWorkload: true,
|
|
325
|
+
storeId: blobs.storeId,
|
|
326
|
+
...claim,
|
|
327
|
+
...(blobs.prefix === undefined ? {} : { prefix: blobs.prefix }),
|
|
328
|
+
}
|
|
329
|
+
: {
|
|
330
|
+
kind: "s3",
|
|
331
|
+
roleFromWorkload: true,
|
|
332
|
+
...claim,
|
|
333
|
+
...(blobs.endpoint === undefined ? {} : { endpoint: blobs.endpoint }),
|
|
334
|
+
...(blobs.prefix === undefined ? {} : { prefix: blobs.prefix }),
|
|
335
|
+
},
|
|
336
|
+
trustedWorkload: { issuer: trust.issuer, audience: trust.audience, subject: trust.subject },
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Said once per process: a Next.js server bundles each route on its own, so
|
|
341
|
+
* a module-level flag would say it once per route that opens Jazz.
|
|
342
|
+
*/
|
|
343
|
+
const WARNED_NO_BLOB_STORE = Symbol.for("jazz-tools.vercel.warnedNoBlobStore");
|
|
344
|
+
const warnedOnce = globalThis;
|
|
345
|
+
/**
|
|
346
|
+
* Where a `vercel()` core keeps large values: as asked, or by default the
|
|
347
|
+
* project's Blob store when one is connected, and its SQLite file when not.
|
|
348
|
+
*/
|
|
349
|
+
export function resolveCoreBlobs(options, env, warn = console.warn) {
|
|
350
|
+
const blobs = options.blobs ?? (connectedBlobStore(env) ? vercelBlob() : undefined);
|
|
351
|
+
if (blobs === undefined && !warnedOnce[WARNED_NO_BLOB_STORE]) {
|
|
352
|
+
warnedOnce[WARNED_NO_BLOB_STORE] = true;
|
|
353
|
+
warn("vercel(): no Blob store is connected to this project, so large values stay in the core's SQLite file. Connect one (Storage tab in the Vercel dashboard) and they go there from then on.");
|
|
354
|
+
}
|
|
355
|
+
if (blobs === undefined || blobs === "sqlite")
|
|
356
|
+
return undefined;
|
|
357
|
+
if (blobs.kind === "vercel-blob")
|
|
358
|
+
return resolveVercelBlob(blobs, env);
|
|
359
|
+
return resolveVercelS3(blobs, options.region, env, warn);
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Refuse a Blob store that another environment claimed, so a preview
|
|
363
|
+
* deployment given production's store (an API- or CLI-created store is
|
|
364
|
+
* connected to every environment) fails at start and says why. The core
|
|
365
|
+
* checks the same claim, but only at its first large value, since no token
|
|
366
|
+
* reaches it before a request does, and then it only retries in the
|
|
367
|
+
* background while writes are acknowledged. A store nobody claimed yet, or
|
|
368
|
+
* a read that fails, is left to the core's own check.
|
|
369
|
+
*/
|
|
370
|
+
export async function refuseOtherEnvironmentsBlobStore(storeId, environment, token, fetchImpl = fetch) {
|
|
371
|
+
if (environment === undefined)
|
|
372
|
+
return;
|
|
373
|
+
const id = storeId.replace(/^store_/, "").toLowerCase();
|
|
374
|
+
const response = await fetchImpl(`https://${id}.private.blob.vercel-storage.com/${BLOB_ENVIRONMENT_MARKER}?cache=0`, { headers: { authorization: `Bearer ${token}` } }).catch(() => undefined);
|
|
375
|
+
if (!response?.ok)
|
|
376
|
+
return;
|
|
377
|
+
const claimed = (await response.text().catch(() => "")).trim();
|
|
378
|
+
if (claimed && claimed !== environment) {
|
|
379
|
+
throw new Error(`vercel(): Blob store ${storeId} serves the ${claimed} environment, not ${environment}; ` +
|
|
380
|
+
"connect a separate Blob store to each environment (a store connected through the API or " +
|
|
381
|
+
"CLI is connected to all of them)");
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
/** Where a core claims a bucket or Blob store for its environment (jazz-server's `ENVIRONMENT_OBJECT`). */
|
|
385
|
+
const BLOB_ENVIRONMENT_MARKER = ".jazz-environment";
|
|
386
|
+
/** The workload an OIDC token names: whoever holds such a token is trusted. */
|
|
387
|
+
export function workloadOf(token) {
|
|
388
|
+
let claims;
|
|
389
|
+
try {
|
|
390
|
+
claims = JSON.parse(Buffer.from(token.split(".")[1] ?? "", "base64url").toString("utf8"));
|
|
391
|
+
}
|
|
392
|
+
catch {
|
|
393
|
+
throw new Error("vercel(): the backend credential is not an OIDC token");
|
|
394
|
+
}
|
|
395
|
+
const audience = Array.isArray(claims.aud) ? claims.aud[0] : claims.aud;
|
|
396
|
+
if (typeof claims.iss !== "string" ||
|
|
397
|
+
typeof audience !== "string" ||
|
|
398
|
+
typeof claims.sub !== "string") {
|
|
399
|
+
throw new Error("vercel(): the backend credential's token has no iss, aud or sub");
|
|
400
|
+
}
|
|
401
|
+
return { issuer: claims.iss, audience, subject: claims.sub };
|
|
402
|
+
}
|
|
403
|
+
const expiry = (token) => {
|
|
404
|
+
try {
|
|
405
|
+
const { exp } = JSON.parse(Buffer.from(token.split(".")[1] ?? "", "base64url").toString());
|
|
406
|
+
return typeof exp === "number" ? exp * 1000 : 0;
|
|
407
|
+
}
|
|
408
|
+
catch {
|
|
409
|
+
return 0;
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
let latestToken;
|
|
413
|
+
/**
|
|
414
|
+
* The function's OIDC token. Vercel hands a fresh one to each request; work
|
|
415
|
+
* outside a request (reconnects, the first open at cold start) uses the
|
|
416
|
+
* freshest one seen, or `VERCEL_OIDC_TOKEN`.
|
|
417
|
+
*/
|
|
418
|
+
async function functionOidcToken() {
|
|
419
|
+
let fetched;
|
|
420
|
+
let failure;
|
|
421
|
+
try {
|
|
422
|
+
// A literal inside `try`, like `importSandboxSdk`'s.
|
|
423
|
+
const { getVercelOidcToken } = (await backendNative().importPeer("@vercel/functions/oidc"));
|
|
424
|
+
fetched = await getVercelOidcToken();
|
|
425
|
+
}
|
|
426
|
+
catch (error) {
|
|
427
|
+
failure = error;
|
|
428
|
+
fetched = process.env.VERCEL_OIDC_TOKEN;
|
|
429
|
+
}
|
|
430
|
+
for (const token of [fetched, latestToken]) {
|
|
431
|
+
if (token && (!latestToken || expiry(token) > expiry(latestToken)))
|
|
432
|
+
latestToken = token;
|
|
433
|
+
}
|
|
434
|
+
if (latestToken && expiry(latestToken) > Date.now())
|
|
435
|
+
return latestToken;
|
|
436
|
+
throw new Error(`vercel(): no current Vercel OIDC token (enable OIDC for the project, or pass backendCredential)` +
|
|
437
|
+
(failure ? `: ${String(failure)}` : ""));
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* A deployment only ever starts or reaches its own environment's core.
|
|
441
|
+
* Custom environments run with VERCEL_ENV=preview and their own slug in
|
|
442
|
+
* VERCEL_TARGET_ENV and in the token's subject.
|
|
443
|
+
*/
|
|
444
|
+
export function refuseOtherEnvironment(trust, env) {
|
|
445
|
+
const target = env.VERCEL_TARGET_ENV ?? env.VERCEL_ENV;
|
|
446
|
+
if (target && !trust.subject.endsWith(`:environment:${target}`)) {
|
|
447
|
+
throw new Error(`vercel(): this ${target} deployment's OIDC token is for ${trust.subject}; refusing to start its core`);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
/** Whether this process runs in a Vercel deployment (not `vercel dev` or a pulled env). */
|
|
451
|
+
export function onVercelDeployment(env = process.env) {
|
|
452
|
+
return !!env.VERCEL && (env.VERCEL_ENV === "production" || env.VERCEL_ENV === "preview");
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Whether this process runs on Vercel's serverless hosts: no lasting disk,
|
|
456
|
+
* sockets only through `upgradeWebSocket`. Only `vercel dev` (VERCEL_ENV
|
|
457
|
+
* development) is a local machine; a VERCEL flag without VERCEL_ENV counts
|
|
458
|
+
* as a host, the safer default for refusing local disk.
|
|
459
|
+
*/
|
|
460
|
+
export function onVercelHost(env = process.env) {
|
|
461
|
+
return !!env.VERCEL && env.VERCEL_ENV !== "development";
|
|
462
|
+
}
|
|
463
|
+
/** Vercel's limit on a Sandbox name. */
|
|
464
|
+
export const SANDBOX_NAME_MAX = 128;
|
|
465
|
+
/** Vercel's limit on a Drive name. */
|
|
466
|
+
export const DRIVE_NAME_MAX = 64;
|
|
467
|
+
// Project ids are mixed case with an underscore; names stay [a-z0-9-].
|
|
468
|
+
const safeProject = (project) => project.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
469
|
+
// Runs of other characters become one "-"; a "-" stays as it is, so
|
|
470
|
+
// `perBranch`'s names pass through unchanged.
|
|
471
|
+
const safeNamespace = (namespace) => namespace.toLowerCase().replace(/[^a-z0-9-]+/g, "-");
|
|
472
|
+
/** A project id as Vercel issues them (`prj_` and 28 characters), when the real one isn't known yet. */
|
|
473
|
+
const TYPICAL_PROJECT_ID = `prj_${"x".repeat(28)}`;
|
|
474
|
+
const PER_BRANCH_RECIPE = 'namespace: ({ environment, branch }) => environment === "production" ? "production" : perBranch(branch)';
|
|
475
|
+
/** Why `vercel()` needs a namespace, with the usual choices to copy. */
|
|
476
|
+
export function missingNamespaceError() {
|
|
477
|
+
return new Error("vercel(): pass `namespace`, which names this deployment's core (its Sandbox is jazz-<project>-<namespace>). The usual choices:\n" +
|
|
478
|
+
' vercel({ namespace: ({ environment }) => environment, region: "iad1" }) // one core per Vercel environment\n' +
|
|
479
|
+
` vercel({ ${PER_BRANCH_RECIPE}, region: "iad1" }) // production's core and one per preview branch, the cores earlier versions created (perBranch is exported by jazz-tools/backend)`);
|
|
480
|
+
}
|
|
481
|
+
/** Vercel's list of the regions a Sandbox can run in. */
|
|
482
|
+
const SANDBOX_REGIONS_DOCS = "https://vercel.com/docs/sandbox/concepts/regions";
|
|
483
|
+
/** Why `vercel()` needs a region, with the one that keeps existing cores where they are. */
|
|
484
|
+
export function missingRegionError() {
|
|
485
|
+
return new Error("vercel(): pass `region`, the Vercel region this deployment's core runs and keeps its data in (its Sandbox and its Drive, fixed when the core is created). " +
|
|
486
|
+
"Earlier versions created every core in iad1; to keep existing cores where they are, pass:\n" +
|
|
487
|
+
' vercel({ namespace, region: "iad1" })\n' +
|
|
488
|
+
`For a new app, pick the region your functions run in (see ${SANDBOX_REGIONS_DOCS}).`);
|
|
489
|
+
}
|
|
490
|
+
/** Check `region` when `vercel()` is called, so `next dev` reports it too. */
|
|
491
|
+
export function checkRegionOption(options) {
|
|
492
|
+
if (options.region === undefined)
|
|
493
|
+
throw missingRegionError();
|
|
494
|
+
if (typeof options.region !== "string" || !options.region) {
|
|
495
|
+
throw new Error(`vercel(): region must be a Vercel region such as "iad1" (see ${SANDBOX_REGIONS_DOCS}); got ${JSON.stringify(options.region)}`);
|
|
496
|
+
}
|
|
497
|
+
return options.region;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* An existing core (its Sandbox, or its Drive) is in `actual`, not the
|
|
501
|
+
* configured region: refused, since nothing would move it.
|
|
502
|
+
*/
|
|
503
|
+
export function refuseRegionMove(what, actual, configured) {
|
|
504
|
+
if (actual === configured)
|
|
505
|
+
return;
|
|
506
|
+
throw new Error(`vercel(): ${what} is in ${actual}, but \`region\` is ${JSON.stringify(configured)}. ` +
|
|
507
|
+
"Moving a core to another region isn't supported yet: its data would have to be copied (https://github.com/garden-co/jazz/issues/5441). " +
|
|
508
|
+
`To keep using this core, pass \`region: ${JSON.stringify(actual)}\`.`);
|
|
509
|
+
}
|
|
510
|
+
/** Said once per process, like the Blob store warning. */
|
|
511
|
+
const WARNED_FUNCTION_REGION = Symbol.for("jazz-tools.vercel.warnedFunctionRegion");
|
|
512
|
+
const warnedRegion = globalThis;
|
|
513
|
+
/**
|
|
514
|
+
* Warn once per process when this function runs in another region than
|
|
515
|
+
* its core: every request then crosses regions.
|
|
516
|
+
*/
|
|
517
|
+
export function warnFunctionRegion(core, region, env, warn = console.warn) {
|
|
518
|
+
const functionRegion = env.VERCEL_REGION;
|
|
519
|
+
if (!functionRegion || functionRegion === region || warnedRegion[WARNED_FUNCTION_REGION])
|
|
520
|
+
return;
|
|
521
|
+
warnedRegion[WARNED_FUNCTION_REGION] = true;
|
|
522
|
+
warn(`vercel(): this function runs in ${functionRegion}, but its core ${core} is in ${region}, so every request to the core makes a round trip between the two regions. ` +
|
|
523
|
+
`Run your functions in ${region} (the project's Function Region setting).`);
|
|
524
|
+
}
|
|
525
|
+
/** `name` became `namespace`; refused with the migration rather than ignored. */
|
|
526
|
+
/** What happens to a core no namespace reaches, and where to ask for it back. */
|
|
527
|
+
const UNREACHABLE = "Its data stays on that Sandbox and its Drive, but this version opens another core: if you need it, open an issue at https://github.com/garden-co/jazz/issues/new and we'll add a way to reach it, or rename it for you.";
|
|
528
|
+
export function refuseVercelName(options) {
|
|
529
|
+
if (!("name" in options))
|
|
530
|
+
return;
|
|
531
|
+
const defaults = "To keep the cores earlier versions created by default (production's and one per preview branch), pass " +
|
|
532
|
+
`vercel({ ${PER_BRANCH_RECIPE}, region: "iad1" }) with perBranch from jazz-tools/backend.`;
|
|
533
|
+
const project = options.credentials?.projectId ?? process.env.VERCEL_PROJECT_ID;
|
|
534
|
+
const name = options.name;
|
|
535
|
+
// The Sandbox a namespace names: "jazz-", the project id lowercased with
|
|
536
|
+
// each run of other characters as "-", "-", and the namespace.
|
|
537
|
+
const rule = "A core is now always the Sandbox jazz-<project>-<namespace>, where <project> is the project id lowercased with each run of characters other than a-z and 0-9 as one `-` (prj_AbC1 is prj-abc1).";
|
|
538
|
+
let keep;
|
|
539
|
+
if (typeof name !== "string") {
|
|
540
|
+
keep = `${rule} A Sandbox you named \`jazz-<project>-<rest>\` is \`namespace: "<rest>"\`.`;
|
|
541
|
+
}
|
|
542
|
+
else if (!project) {
|
|
543
|
+
keep = `${rule} If ${JSON.stringify(name)} is jazz-<project>-<rest> for this project, pass \`namespace: "<rest>"\`; a name of any other form can't be reached by a namespace any more. ${UNREACHABLE}`;
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
const prefix = `jazz-${safeProject(project)}-`;
|
|
547
|
+
const rest = name.startsWith(prefix) ? name.slice(prefix.length) : undefined;
|
|
548
|
+
keep =
|
|
549
|
+
rest && safeNamespace(rest) === rest && /[a-z0-9]/.test(rest)
|
|
550
|
+
? `To keep the core ${name}, pass \`namespace: ${JSON.stringify(rest)}\`.`
|
|
551
|
+
: `${rule} The core ${name} is not of that form (for this project it would start with ${prefix}), so no namespace reaches it any more. ${UNREACHABLE}`;
|
|
552
|
+
}
|
|
553
|
+
throw new Error(`vercel(): \`name\` is now \`namespace\`. ${keep} ${defaults}`);
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* The namespace earlier versions gave a preview branch's core by default:
|
|
557
|
+
* `preview-<slug>-<hash>`, the branch's first 24 safe characters and a hash
|
|
558
|
+
* of its full name, so `feat/a` and `feat-a` get cores of their own. For a
|
|
559
|
+
* deployment without a branch (from the CLI outside a Git checkout, or
|
|
560
|
+
* through the API) it is `""`, which `vercel()` refuses: those deployments
|
|
561
|
+
* would all share one core, so give them a namespace of their own.
|
|
562
|
+
*/
|
|
563
|
+
export function perBranch(branch) {
|
|
564
|
+
if (!branch)
|
|
565
|
+
return "";
|
|
566
|
+
const slug = branch
|
|
567
|
+
.toLowerCase()
|
|
568
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
569
|
+
.replace(/^-|-$/g, "")
|
|
570
|
+
.slice(0, 24);
|
|
571
|
+
const hash = createHash("sha256").update(branch).digest("hex").slice(0, 8);
|
|
572
|
+
return `preview-${slug}-${hash}`;
|
|
573
|
+
}
|
|
574
|
+
/** The context a namespace function gets for the deployment `env` describes. */
|
|
575
|
+
export function namespaceContext(env) {
|
|
576
|
+
return {
|
|
577
|
+
environment: env.VERCEL_TARGET_ENV || env.VERCEL_ENV || "development",
|
|
578
|
+
branch: env.VERCEL_GIT_COMMIT_REF || undefined,
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Check a namespace that is already a string (`vercel({ namespace })` at
|
|
583
|
+
* call time, or a function's result): what it becomes in the Sandbox's
|
|
584
|
+
* name, refused when empty or too long for `project`.
|
|
585
|
+
*/
|
|
586
|
+
export function checkNamespace(namespace, project, context) {
|
|
587
|
+
if (namespace !== undefined && namespace !== null && typeof namespace !== "string") {
|
|
588
|
+
throw new Error(`vercel(): namespace must be a string, or a function returning one; got ${typeof namespace}`);
|
|
589
|
+
}
|
|
590
|
+
if (!namespace) {
|
|
591
|
+
// Deploys from the CLI outside a Git checkout, or through the API, have
|
|
592
|
+
// an empty branch: `perBranch` gives them no namespace, since they'd
|
|
593
|
+
// all share one core.
|
|
594
|
+
if (context && context.environment !== "production" && context.branch === undefined) {
|
|
595
|
+
throw new Error(`vercel(): this ${context.environment} deployment has no Git branch (VERCEL_GIT_COMMIT_REF is empty, ` +
|
|
596
|
+
"as for deploys from the CLI outside a Git checkout or through the API), and its namespace function returned none; " +
|
|
597
|
+
'return a namespace for it, e.g. `perBranch(branch) || "cli-previews"`');
|
|
598
|
+
}
|
|
599
|
+
throw new Error(context
|
|
600
|
+
? `vercel(): the namespace function returned no namespace for this ${context.environment} deployment (branch ${context.branch})`
|
|
601
|
+
: "vercel(): namespace is empty");
|
|
602
|
+
}
|
|
603
|
+
const safe = safeNamespace(namespace);
|
|
604
|
+
if (!/[a-z0-9]/.test(safe)) {
|
|
605
|
+
throw new Error(`vercel(): namespace ${JSON.stringify(namespace)} has no letters or digits`);
|
|
606
|
+
}
|
|
607
|
+
const prefix = `jazz-${safeProject(project)}-`;
|
|
608
|
+
const max = SANDBOX_NAME_MAX - prefix.length;
|
|
609
|
+
if (safe.length > max) {
|
|
610
|
+
throw new Error(`vercel(): namespace ${JSON.stringify(namespace)} is ${safe.length} characters; with this project's prefix ${prefix} it may have at most ${max} (Vercel's Sandbox names have at most ${SANDBOX_NAME_MAX})`);
|
|
611
|
+
}
|
|
612
|
+
return safe;
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Check a string namespace when `vercel()` is called, so `next dev` reports
|
|
616
|
+
* it too: against the project's id when it's known, else a typical one.
|
|
617
|
+
*/
|
|
618
|
+
export function checkNamespaceOption(options) {
|
|
619
|
+
if (options.namespace === undefined)
|
|
620
|
+
throw missingNamespaceError();
|
|
621
|
+
if (typeof options.namespace === "function")
|
|
622
|
+
return;
|
|
623
|
+
checkNamespace(options.namespace, options.credentials?.projectId ?? process.env.VERCEL_PROJECT_ID ?? TYPICAL_PROJECT_ID);
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* This deployment's core: `jazz-<project>-<namespace>`, with the namespace
|
|
627
|
+
* the option names for it. Cores are kept apart by name, not secured from
|
|
628
|
+
* each other: every preview deployment's OIDC token names the same
|
|
629
|
+
* workload (`…:environment:preview`), so any preview function can reach
|
|
630
|
+
* any preview core. Production is its own workload.
|
|
631
|
+
*/
|
|
632
|
+
export function coreName(project, namespace, env) {
|
|
633
|
+
if (namespace === undefined)
|
|
634
|
+
throw missingNamespaceError();
|
|
635
|
+
const context = namespaceContext(env);
|
|
636
|
+
const chosen = typeof namespace === "function" ? namespace(context) : namespace;
|
|
637
|
+
const safe = checkNamespace(chosen, project, typeof namespace === "function" ? context : undefined);
|
|
638
|
+
return { name: `jazz-${safeProject(project)}-${safe}`, namespace: safe };
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* The Drive a core keeps its data on: `<name>-data`, or, for a name too
|
|
642
|
+
* long for Vercel's Drive names, its first part and a hash of the whole.
|
|
643
|
+
*/
|
|
644
|
+
export function driveName(name) {
|
|
645
|
+
const drive = `${name}-data`;
|
|
646
|
+
if (drive.length <= DRIVE_NAME_MAX)
|
|
647
|
+
return drive;
|
|
648
|
+
const hash = createHash("sha256").update(name).digest("hex").slice(0, 8);
|
|
649
|
+
const head = name.slice(0, DRIVE_NAME_MAX - "-data".length - hash.length - 1);
|
|
650
|
+
return `${head}-${hash}-data`;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* The core addon's tarball for a jazz-tools version: npm's for a published
|
|
654
|
+
* version, the GitHub release asset for a release candidate (rc builds are
|
|
655
|
+
* attached to their release and never reach npm).
|
|
656
|
+
*/
|
|
657
|
+
export function defaultCoreTarballUrl(version) {
|
|
658
|
+
const name = "jazz-napi-linux-x64-gnu";
|
|
659
|
+
// The versions dev/artifacts/rc-tarballs.mjs stamps on a candidate.
|
|
660
|
+
if (/^2\.0\.0-(alpha|beta)\.[0-9]+(\.[0-9]+)?-rc\.[0-9]+$/.test(version)) {
|
|
661
|
+
return `https://github.com/garden-co/jazz/releases/download/v${version}/garden-co-${name}-${version}.tgz`;
|
|
662
|
+
}
|
|
663
|
+
return `https://registry.npmjs.org/@garden-co/${name}/-/${name}-${version}.tgz`;
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* The installed jazz-tools version, as a JSON import of the package's own
|
|
667
|
+
* `package.json` export. Bundlers (webpack, Turbopack) inline it, and Node
|
|
668
|
+
* loads it as a module. Neither reads a path at runtime, unlike `readFile`
|
|
669
|
+
* of a URL resolved against `import.meta.url` (webpack rewrites that URL
|
|
670
|
+
* into one `fs` refuses) or `createRequire` from `import.meta.url`
|
|
671
|
+
* (bundlers bake the build machine's path into it, so a deployed function
|
|
672
|
+
* can't find it).
|
|
673
|
+
*/
|
|
674
|
+
async function installedVersion() {
|
|
675
|
+
const packageJson = (await import("jazz-tools/package.json", { with: { type: "json" } }));
|
|
676
|
+
return packageJson.default.version;
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* `@vercel/sandbox`, an optional peer dependency. The import is a literal
|
|
680
|
+
* inside `try`: bundlers (Turbopack, webpack) then bundle the package when
|
|
681
|
+
* it's installed, and turn a missing one into an error at runtime instead
|
|
682
|
+
* of failing every route that imports jazz-tools (an app on `sqlite()`
|
|
683
|
+
* never needs it). A `.catch()` on the import isn't enough for that.
|
|
684
|
+
*/
|
|
685
|
+
async function importSandboxSdk() {
|
|
686
|
+
try {
|
|
687
|
+
return (await backendNative().importPeer("@vercel/sandbox"));
|
|
688
|
+
}
|
|
689
|
+
catch (error) {
|
|
690
|
+
throw optionalPeerImportError("vercel()", "@vercel/sandbox", error);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
export async function openVercelCore(params) {
|
|
694
|
+
const { options, openRemote } = params;
|
|
695
|
+
refuseVercelAppId(options);
|
|
696
|
+
const env = params.env ?? process.env;
|
|
697
|
+
const sdk = params.sdk ?? options.sdk ?? (await importSandboxSdk());
|
|
698
|
+
const version = params.version ?? (await installedVersion());
|
|
699
|
+
const tarballUrl = options.coreTarballUrl ?? defaultCoreTarballUrl(version);
|
|
700
|
+
const project = options.credentials?.projectId ?? env.VERCEL_PROJECT_ID;
|
|
701
|
+
refuseVercelName(options);
|
|
702
|
+
if (options.namespace === undefined)
|
|
703
|
+
throw missingNamespaceError();
|
|
704
|
+
const region = checkRegionOption(options);
|
|
705
|
+
if (!project) {
|
|
706
|
+
throw new Error("vercel(): VERCEL_PROJECT_ID is not set; enable system environment variables, or pass credentials with its projectId");
|
|
707
|
+
}
|
|
708
|
+
const { name, namespace } = coreName(project, options.namespace, env);
|
|
709
|
+
const drive = driveName(name);
|
|
710
|
+
warnFunctionRegion(name, region, env);
|
|
711
|
+
const creds = options.credentials ?? {};
|
|
712
|
+
const idleMs = options.idleMs ?? DEFAULT_IDLE_MS;
|
|
713
|
+
const backendCredential = options.backendCredential ?? functionOidcToken;
|
|
714
|
+
// The core trusts the workload this function's token names, so every
|
|
715
|
+
// instance of this project and environment reaches it, and nothing else.
|
|
716
|
+
const token = await backendCredential();
|
|
717
|
+
const trust = workloadOf(token);
|
|
718
|
+
// Skipped for a `backendCredential` of your own, which names whatever
|
|
719
|
+
// workload you chose.
|
|
720
|
+
if (!options.backendCredential)
|
|
721
|
+
refuseOtherEnvironment(trust, env);
|
|
722
|
+
const trustLine = `${trust.issuer} ${trust.audience} ${trust.subject}`;
|
|
723
|
+
const blobs = resolveCoreBlobs(options, env);
|
|
724
|
+
if (blobs && environmentOf(trust) === undefined) {
|
|
725
|
+
console.warn(`vercel(): the core's workload ${trust.subject} names no Vercel environment, so its blob store is not claimed for one; make sure no other environment uses that store`);
|
|
726
|
+
}
|
|
727
|
+
// Read while the core wakes; refused before anything is served.
|
|
728
|
+
const storeChecked = blobs && "storeId" in blobs
|
|
729
|
+
? refuseOtherEnvironmentsBlobStore(blobs.storeId, environmentOf(trust), token, params.fetch)
|
|
730
|
+
: undefined;
|
|
731
|
+
void storeChecked?.catch(() => { });
|
|
732
|
+
const script = Buffer.from(startScript(version, tarballUrl, trust, blobs));
|
|
733
|
+
/** This instance's recent starts, by id (its script's file name). */
|
|
734
|
+
const starts = [];
|
|
735
|
+
const startServer = async (sbx) => {
|
|
736
|
+
// A fresh path each time: bash reads a script as it runs, so one that is
|
|
737
|
+
// running must never be rewritten.
|
|
738
|
+
const id = `jazz-start-${randomUUID()}`;
|
|
739
|
+
starts.push(id);
|
|
740
|
+
if (starts.length > 20)
|
|
741
|
+
starts.shift();
|
|
742
|
+
const path = `/tmp/${id}.sh`;
|
|
743
|
+
await sbx.writeFiles([{ path, content: script }]);
|
|
744
|
+
await sbx.runCommand({
|
|
745
|
+
cmd: "bash",
|
|
746
|
+
args: ["-lc", `exec bash ${path} >>/data/server.log 2>&1`],
|
|
747
|
+
detached: true,
|
|
748
|
+
});
|
|
749
|
+
};
|
|
750
|
+
/**
|
|
751
|
+
* Why this version's last start in `sbx` gave up, if it was one of this
|
|
752
|
+
* instance's starts (see `fail` in the start script); a file left by an
|
|
753
|
+
* earlier session or another instance is never read as this one's. A
|
|
754
|
+
* permanent cause never comes up on its own; a transient one may on the
|
|
755
|
+
* next start.
|
|
756
|
+
*/
|
|
757
|
+
const startError = async (sbx) => {
|
|
758
|
+
const text = (await sbx.readFileToBuffer({ path: `/tmp/jazz-${version}.error` }).catch(() => null))
|
|
759
|
+
?.toString("utf8")
|
|
760
|
+
.trim();
|
|
761
|
+
const match = text ? /^(\S+) (permanent|transient): (.*)$/s.exec(text) : null;
|
|
762
|
+
if (!match || !starts.includes(match[1]))
|
|
763
|
+
return undefined;
|
|
764
|
+
return { permanent: match[2] === "permanent", why: match[3] };
|
|
765
|
+
};
|
|
766
|
+
/**
|
|
767
|
+
* Stop the Sandbox rather than keep it awake retrying a start that can't
|
|
768
|
+
* succeed. Other instances may be watching the same Sandbox: only the
|
|
769
|
+
* session this one saw fail is stopped, never a newer one, and never one
|
|
770
|
+
* where another version's core is running or starting (an older
|
|
771
|
+
* deployment's, still in use).
|
|
772
|
+
*/
|
|
773
|
+
const giveUp = async (sbx, why) => {
|
|
774
|
+
const watched = sbx.currentSession().startedAt.getTime();
|
|
775
|
+
const now = await getRunning();
|
|
776
|
+
const other = now ? await runningVersion(now) : undefined;
|
|
777
|
+
if (now &&
|
|
778
|
+
now.currentSession().startedAt.getTime() === watched &&
|
|
779
|
+
(!other || other === version)) {
|
|
780
|
+
await now.stop().catch(() => { });
|
|
781
|
+
}
|
|
782
|
+
throw new CoreStartError(`vercel(): core ${name} could not start: ${why} (log: /data/server.log)`);
|
|
783
|
+
};
|
|
784
|
+
/** The server version running in `sbx`, if any. */
|
|
785
|
+
const runningVersion = async (sbx) => (await sbx.readFileToBuffer({ path: "/tmp/jazz.version" }).catch(() => null))
|
|
786
|
+
?.toString("utf8")
|
|
787
|
+
.trim() || undefined;
|
|
788
|
+
const getRunning = async () => {
|
|
789
|
+
const sbx = await sdk.Sandbox.get({ name, resume: false, ...creds }).catch(() => null);
|
|
790
|
+
if (sbx?.status !== "running")
|
|
791
|
+
return null;
|
|
792
|
+
const session = sbx.currentSession();
|
|
793
|
+
const left = session.startedAt.getTime() + session.timeout - Date.now();
|
|
794
|
+
if (left < MIN_LEFT_MS) {
|
|
795
|
+
const extended = await session.extendTimeout(idleMs).then(() => true, () => false);
|
|
796
|
+
if (!extended)
|
|
797
|
+
return null;
|
|
798
|
+
}
|
|
799
|
+
return sbx;
|
|
800
|
+
};
|
|
801
|
+
/**
|
|
802
|
+
* The core's Sandbox, or `null` only when Vercel says there is none (a
|
|
803
|
+
* 404). Any other failure is a `LookupError`: read as "no Sandbox", it
|
|
804
|
+
* would provision a core, in the configured region, next to one that
|
|
805
|
+
* exists.
|
|
806
|
+
*/
|
|
807
|
+
const findSandbox = async () => {
|
|
808
|
+
try {
|
|
809
|
+
return await sdk.Sandbox.get({ name, resume: false, ...creds });
|
|
810
|
+
}
|
|
811
|
+
catch (error) {
|
|
812
|
+
if (isNotFound(error))
|
|
813
|
+
return null;
|
|
814
|
+
throw new LookupError(`vercel(): could not look up core ${name}: ${String(error)}`);
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
/**
|
|
818
|
+
* Create the Sandbox and start its core, or `null` when another instance
|
|
819
|
+
* created it first (concurrent first requests on a cold deploy): the
|
|
820
|
+
* caller then waits for that one, like any other wake.
|
|
821
|
+
*/
|
|
822
|
+
const provision = async () => {
|
|
823
|
+
// An existing Drive (say, of a deleted Sandbox) keeps its region, which
|
|
824
|
+
// can't change: a core there is refused like an existing Sandbox, before
|
|
825
|
+
// `getOrCreate` is asked for one in the configured region.
|
|
826
|
+
const existing = await sdk.Drive.get({ name: drive, ...creds }).catch((error) => {
|
|
827
|
+
if (isNotFound(error))
|
|
828
|
+
return null;
|
|
829
|
+
throw new LookupError(`vercel(): could not look up core ${name}'s Drive ${drive}: ${String(error)}`);
|
|
830
|
+
});
|
|
831
|
+
if (existing)
|
|
832
|
+
refuseRegionMove(`core ${name}'s Drive ${drive}`, existing.region, region);
|
|
833
|
+
const created = await sdk.Drive.getOrCreate({
|
|
834
|
+
name: drive,
|
|
835
|
+
region,
|
|
836
|
+
maxSize: options.maxDriveBytes ?? 10 * 1024 ** 3,
|
|
837
|
+
...creds,
|
|
838
|
+
});
|
|
839
|
+
refuseRegionMove(`core ${name}'s Drive ${drive}`, created.region, region);
|
|
840
|
+
const sbx = await sdk.Sandbox.create({
|
|
841
|
+
name,
|
|
842
|
+
region,
|
|
843
|
+
image: "vercel/sandbox/node:24",
|
|
844
|
+
ports: [VERCEL_CORE_PORT],
|
|
845
|
+
resources: { vcpus: options.vcpus ?? 1 },
|
|
846
|
+
timeout: idleMs,
|
|
847
|
+
persistent: true,
|
|
848
|
+
keepLastSnapshots: { count: 1 },
|
|
849
|
+
mounts: { "/data": { drive, mode: "read-write" } },
|
|
850
|
+
...creds,
|
|
851
|
+
}).catch((error) => {
|
|
852
|
+
if (isNameTaken(error))
|
|
853
|
+
return null;
|
|
854
|
+
throw error;
|
|
855
|
+
});
|
|
856
|
+
if (sbx)
|
|
857
|
+
await startServer(sbx);
|
|
858
|
+
return sbx;
|
|
859
|
+
};
|
|
860
|
+
const refuseForeignPin = async (sbx) => {
|
|
861
|
+
const pinned = (await sbx.readFileToBuffer({ path: "/data/trust" }).catch(() => null))
|
|
862
|
+
?.toString("utf8")
|
|
863
|
+
.trim();
|
|
864
|
+
if (pinned && pinned !== trustLine) {
|
|
865
|
+
throw new Error(`vercel(): core ${name} trusts ${pinned.split(" ").at(-1)}, not this deployment (${trust.subject}). ` +
|
|
866
|
+
"After a team or project rename, or a change of OIDC issuer mode, delete /data/trust in the Sandbox to re-pin it.");
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
/**
|
|
870
|
+
* Stop the session `sbx` belongs to, so the next wake starts a fresh one.
|
|
871
|
+
* Other instances may be watching the same session; only the session this
|
|
872
|
+
* one saw fail is stopped, never a newer one.
|
|
873
|
+
*/
|
|
874
|
+
const stopSession = async (sbx) => {
|
|
875
|
+
const watched = sbx.currentSession().startedAt.getTime();
|
|
876
|
+
const now = await getRunning();
|
|
877
|
+
if (now && now.currentSession().startedAt.getTime() === watched) {
|
|
878
|
+
await now.stop().catch(() => { });
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
/** Resume (or create) the Sandbox and wait until the server answers. */
|
|
882
|
+
const wake = async () => {
|
|
883
|
+
const t0 = performance.now();
|
|
884
|
+
const deadline = t0 + WAKE_DEADLINE_MS;
|
|
885
|
+
const healthFails = {};
|
|
886
|
+
let recycled = false;
|
|
887
|
+
let restarted = false;
|
|
888
|
+
/** The last transient start failure, for the error if the wake times out. */
|
|
889
|
+
let lastTransient;
|
|
890
|
+
let sbx = await getRunning();
|
|
891
|
+
for (;;) {
|
|
892
|
+
while (!sbx) {
|
|
893
|
+
try {
|
|
894
|
+
const existing = await findSandbox();
|
|
895
|
+
// Before resuming, which starts its server: a core elsewhere is
|
|
896
|
+
// never woken.
|
|
897
|
+
if (existing)
|
|
898
|
+
refuseRegionMove(`core ${name}`, existing.region, region);
|
|
899
|
+
sbx = existing
|
|
900
|
+
? await sdk.Sandbox.get({
|
|
901
|
+
name,
|
|
902
|
+
resume: true,
|
|
903
|
+
...creds,
|
|
904
|
+
onResume: startServer,
|
|
905
|
+
})
|
|
906
|
+
: await provision();
|
|
907
|
+
if (!sbx) {
|
|
908
|
+
// Another instance is creating it: wait for that Sandbox,
|
|
909
|
+
// resuming it if it isn't running yet.
|
|
910
|
+
if (performance.now() > deadline) {
|
|
911
|
+
throw new Error(`vercel(): core ${name} was being created by another instance and did not come up in ${since(t0)} ms`);
|
|
912
|
+
}
|
|
913
|
+
await sleep(250);
|
|
914
|
+
sbx = await getRunning();
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
catch (error) {
|
|
918
|
+
const retry = isWakeConflict(error) || error instanceof LookupError;
|
|
919
|
+
if (!retry || performance.now() > deadline)
|
|
920
|
+
throw error;
|
|
921
|
+
await sleep(500);
|
|
922
|
+
sbx = await getRunning();
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
// A Sandbox is found by name only, and `region` applies only when it
|
|
926
|
+
// is created: a core elsewhere is refused, not silently used.
|
|
927
|
+
refuseRegionMove(`core ${name}`, sbx.region, region);
|
|
928
|
+
// A core pinned to another workload never becomes ours: say so now,
|
|
929
|
+
// not after the health checks time out.
|
|
930
|
+
await refuseForeignPin(sbx);
|
|
931
|
+
let base = sbx.domain(VERCEL_CORE_PORT);
|
|
932
|
+
let ok = await healthy(base, 300, healthFails);
|
|
933
|
+
if (!ok)
|
|
934
|
+
await startServer(sbx);
|
|
935
|
+
const healthT0 = performance.now();
|
|
936
|
+
while (!ok && sbx && performance.now() < deadline) {
|
|
937
|
+
ok = await healthy(base, 5_000, healthFails);
|
|
938
|
+
const failure = ok ? undefined : await startError(sbx);
|
|
939
|
+
if (failure?.permanent)
|
|
940
|
+
await giveUp(sbx, failure.why);
|
|
941
|
+
if (failure)
|
|
942
|
+
lastTransient = failure.why;
|
|
943
|
+
const notListening = Object.keys(healthFails).some((k) => k.includes("SANDBOX_NOT_LISTENING"));
|
|
944
|
+
if (!ok &&
|
|
945
|
+
notListening &&
|
|
946
|
+
!recycled &&
|
|
947
|
+
performance.now() - healthT0 > NOT_LISTENING_RECYCLE_MS) {
|
|
948
|
+
recycled = true;
|
|
949
|
+
await stopSession(sbx);
|
|
950
|
+
sbx = null;
|
|
951
|
+
break;
|
|
952
|
+
}
|
|
953
|
+
if (!ok) {
|
|
954
|
+
sbx = await getRunning();
|
|
955
|
+
if (sbx) {
|
|
956
|
+
base = sbx.domain(VERCEL_CORE_PORT);
|
|
957
|
+
await startServer(sbx);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
if (ok && sbx) {
|
|
962
|
+
// An instance of a newer deployment restarts an older server once;
|
|
963
|
+
// an older instance uses whatever newer server it finds.
|
|
964
|
+
const running = await runningVersion(sbx);
|
|
965
|
+
if (!running || !newerVersion(version, running))
|
|
966
|
+
return { sbx, base };
|
|
967
|
+
if (restarted) {
|
|
968
|
+
throw new Error(`vercel(): core ${name} still runs ${running}, not ${version}`);
|
|
969
|
+
}
|
|
970
|
+
restarted = true;
|
|
971
|
+
await startServer(sbx);
|
|
972
|
+
while (performance.now() < deadline) {
|
|
973
|
+
const now = await runningVersion(sbx);
|
|
974
|
+
if (now && !newerVersion(version, now) && (await healthy(base, 1_000, healthFails))) {
|
|
975
|
+
return { sbx, base };
|
|
976
|
+
}
|
|
977
|
+
// The older core stays up for the deployments still using it.
|
|
978
|
+
const failure = await startError(sbx);
|
|
979
|
+
if (failure?.permanent) {
|
|
980
|
+
throw new CoreStartError(`vercel(): core ${name} could not start ${version}: ${failure.why}`);
|
|
981
|
+
}
|
|
982
|
+
if (failure) {
|
|
983
|
+
// A later start may succeed: try again.
|
|
984
|
+
lastTransient = failure.why;
|
|
985
|
+
await startServer(sbx);
|
|
986
|
+
await sleep(1_000);
|
|
987
|
+
}
|
|
988
|
+
await sleep(250);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
if (performance.now() > deadline) {
|
|
992
|
+
throw new Error(`vercel(): core ${name} did not become healthy in ${since(t0)} ms (${JSON.stringify(healthFails)})` +
|
|
993
|
+
(lastTransient ? `; its last start failed: ${lastTransient}` : ""));
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
let live;
|
|
998
|
+
let pending;
|
|
999
|
+
let lastActivity = Date.now();
|
|
1000
|
+
let sockets = 0;
|
|
1001
|
+
let failed;
|
|
1002
|
+
/**
|
|
1003
|
+
* The core `live` names stopped answering (Vercel's router refused a
|
|
1004
|
+
* request, or a socket to it failed): the next `ensure` wakes it, health
|
|
1005
|
+
* check included, instead of trusting it for `ENSURE_FRESH_MS`.
|
|
1006
|
+
*/
|
|
1007
|
+
let suspect = false;
|
|
1008
|
+
const distrust = () => {
|
|
1009
|
+
suspect = true;
|
|
1010
|
+
};
|
|
1011
|
+
/**
|
|
1012
|
+
* Since when connections to the core have ended without ever opening,
|
|
1013
|
+
* with none opening since, and how many. A core can answer `/health` and
|
|
1014
|
+
* still be out of reach for connections (Vercel's router stopped passing
|
|
1015
|
+
* them to its session): waking it then finds it healthy at the same
|
|
1016
|
+
* address, so only a fresh session gets connections through again.
|
|
1017
|
+
*
|
|
1018
|
+
* Only connections made to a session count, and only against that
|
|
1019
|
+
* session: one that was still waiting for a wake never tried any, and a
|
|
1020
|
+
* wake that brings up a new session starts its count afresh (#6028).
|
|
1021
|
+
*/
|
|
1022
|
+
let unreached;
|
|
1023
|
+
const connectionUnreached = () => {
|
|
1024
|
+
distrust();
|
|
1025
|
+
unreached = unreached
|
|
1026
|
+
? { since: unreached.since, count: unreached.count + 1 }
|
|
1027
|
+
: { since: Date.now(), count: 1 };
|
|
1028
|
+
};
|
|
1029
|
+
const connectionReached = () => {
|
|
1030
|
+
unreached = undefined;
|
|
1031
|
+
};
|
|
1032
|
+
/** Whether the session `live` names keeps refusing connections it answers `/health` for. */
|
|
1033
|
+
const unreachable = () => unreached !== undefined &&
|
|
1034
|
+
unreached.count >= UNREACHED_RECYCLE_COUNT &&
|
|
1035
|
+
Date.now() - unreached.since >= UNREACHED_RECYCLE_MS;
|
|
1036
|
+
const ensure = () => {
|
|
1037
|
+
lastActivity = Date.now();
|
|
1038
|
+
if (live && !suspect && Date.now() - live.checkedAt < ENSURE_FRESH_MS)
|
|
1039
|
+
return Promise.resolve(live);
|
|
1040
|
+
if (failed && Date.now() - failed.at < START_FAILURE_HOLD_MS)
|
|
1041
|
+
return Promise.reject(failed.error);
|
|
1042
|
+
pending ??= (async () => {
|
|
1043
|
+
try {
|
|
1044
|
+
if (live && !suspect && (await getRunning())) {
|
|
1045
|
+
live.checkedAt = Date.now();
|
|
1046
|
+
return live;
|
|
1047
|
+
}
|
|
1048
|
+
if (live && unreachable()) {
|
|
1049
|
+
// Its `/health` would pass again: start a fresh session instead.
|
|
1050
|
+
unreached = undefined;
|
|
1051
|
+
await stopSession(live.sbx);
|
|
1052
|
+
}
|
|
1053
|
+
const before = live?.sbx.currentSession().startedAt.getTime();
|
|
1054
|
+
const { sbx, base } = await wake();
|
|
1055
|
+
suspect = false;
|
|
1056
|
+
// Connections that failed to reach an earlier session say nothing
|
|
1057
|
+
// about this one: stopping it for them would throw away the wake.
|
|
1058
|
+
if (sbx.currentSession().startedAt.getTime() !== before)
|
|
1059
|
+
unreached = undefined;
|
|
1060
|
+
const coreAppId = live?.base === base
|
|
1061
|
+
? live.appId
|
|
1062
|
+
: (await sbx.readFileToBuffer({ path: "/data/app-id" }))?.toString("utf8").trim();
|
|
1063
|
+
if (!coreAppId)
|
|
1064
|
+
throw new Error(`vercel(): core ${name} has no app id on its Drive`);
|
|
1065
|
+
await refuseForeignPin(sbx);
|
|
1066
|
+
if (live?.base === base) {
|
|
1067
|
+
live.sbx = sbx;
|
|
1068
|
+
live.checkedAt = Date.now();
|
|
1069
|
+
return live;
|
|
1070
|
+
}
|
|
1071
|
+
const replaced = live?.core;
|
|
1072
|
+
live = {
|
|
1073
|
+
sbx,
|
|
1074
|
+
base,
|
|
1075
|
+
appId: coreAppId,
|
|
1076
|
+
core: openRemote({ appId: coreAppId, url: base, backendCredential }),
|
|
1077
|
+
checkedAt: Date.now(),
|
|
1078
|
+
};
|
|
1079
|
+
if (replaced)
|
|
1080
|
+
void replaced.close().catch(() => { });
|
|
1081
|
+
failed = undefined;
|
|
1082
|
+
return live;
|
|
1083
|
+
}
|
|
1084
|
+
catch (error) {
|
|
1085
|
+
if (error instanceof CoreStartError)
|
|
1086
|
+
failed = { at: Date.now(), error };
|
|
1087
|
+
throw error;
|
|
1088
|
+
}
|
|
1089
|
+
finally {
|
|
1090
|
+
pending = undefined;
|
|
1091
|
+
}
|
|
1092
|
+
})();
|
|
1093
|
+
return pending;
|
|
1094
|
+
};
|
|
1095
|
+
// Keep the core awake while browsers are connected or requests are recent;
|
|
1096
|
+
// once quiet, its session timeout stops it.
|
|
1097
|
+
// Each instance reads the session fresh and only tops it up to `idleMs`
|
|
1098
|
+
// from now, so many instances don't stack their extensions.
|
|
1099
|
+
const keepalive = setInterval(() => {
|
|
1100
|
+
if (!live)
|
|
1101
|
+
return;
|
|
1102
|
+
if (sockets === 0 && Date.now() - lastActivity > idleMs)
|
|
1103
|
+
return;
|
|
1104
|
+
// Attempts that never reach the core aren't use: a session no
|
|
1105
|
+
// connection gets through to is left to time out, not kept awake.
|
|
1106
|
+
if (unreached)
|
|
1107
|
+
return;
|
|
1108
|
+
void sdk.Sandbox.get({ name, resume: false, ...creds })
|
|
1109
|
+
.then((sbx) => {
|
|
1110
|
+
if (sbx.status !== "running")
|
|
1111
|
+
return;
|
|
1112
|
+
const session = sbx.currentSession();
|
|
1113
|
+
const left = session.startedAt.getTime() + session.timeout - Date.now();
|
|
1114
|
+
if (left < idleMs - KEEPALIVE_MS)
|
|
1115
|
+
return session.extendTimeout(idleMs - left);
|
|
1116
|
+
})
|
|
1117
|
+
.catch(() => { });
|
|
1118
|
+
}, KEEPALIVE_MS);
|
|
1119
|
+
keepalive.unref?.();
|
|
1120
|
+
const ensured = ensure();
|
|
1121
|
+
let first;
|
|
1122
|
+
try {
|
|
1123
|
+
[first] = await Promise.all([ensured, storeChecked]);
|
|
1124
|
+
}
|
|
1125
|
+
catch (error) {
|
|
1126
|
+
clearInterval(keepalive);
|
|
1127
|
+
// The wake may still be under way: close the core it comes up with.
|
|
1128
|
+
void ensured.then(({ core }) => core.close()).catch(() => { });
|
|
1129
|
+
throw error;
|
|
1130
|
+
}
|
|
1131
|
+
logStoreOpened(`jazz: store vercel namespace ${JSON.stringify(namespace)} (core ${name})`);
|
|
1132
|
+
// Clients in this process (the backend's own session) reach the core through
|
|
1133
|
+
// an in-process origin, so each of their requests and reconnects wakes it;
|
|
1134
|
+
// they go on through the current remote core's own in-process origin, which
|
|
1135
|
+
// presents the backend credential.
|
|
1136
|
+
const serverUrl = `http://jazz-vercel-${randomUUID()}.invalid`;
|
|
1137
|
+
const unregister = registerInProcessTransport(serverUrl, {
|
|
1138
|
+
fetch: async (input, init) => {
|
|
1139
|
+
const request = new Request(input, init);
|
|
1140
|
+
const url = new URL(request.url);
|
|
1141
|
+
const send = async (sent) => {
|
|
1142
|
+
const inner = (await ensure()).core.serverUrl;
|
|
1143
|
+
return fetchFor(inner)(new Request(`${inner}${url.pathname}${url.search}`, sent));
|
|
1144
|
+
};
|
|
1145
|
+
// Kept to send again only when that costs little: a clone tees the
|
|
1146
|
+
// body, buffering a streamed upload whole while the first send runs.
|
|
1147
|
+
const again = resendable(request, init?.body) ? request.clone() : undefined;
|
|
1148
|
+
const response = await send(request);
|
|
1149
|
+
if (!response.headers.has(ROUTER_ERROR_HEADER))
|
|
1150
|
+
return response;
|
|
1151
|
+
// Refused before it reached the core: wake it (for the next request
|
|
1152
|
+
// too) and send it again.
|
|
1153
|
+
distrust();
|
|
1154
|
+
if (!again)
|
|
1155
|
+
return response;
|
|
1156
|
+
void response.body?.cancel().catch(() => { });
|
|
1157
|
+
return send(again);
|
|
1158
|
+
},
|
|
1159
|
+
WebSocket: wakingWebSocket(async () => (await ensure()).core.serverUrl, {
|
|
1160
|
+
dropped: distrust,
|
|
1161
|
+
unreached: connectionUnreached,
|
|
1162
|
+
reached: connectionReached,
|
|
1163
|
+
}),
|
|
1164
|
+
});
|
|
1165
|
+
return {
|
|
1166
|
+
appId: first.appId,
|
|
1167
|
+
serverUrl,
|
|
1168
|
+
adminSecret: first.core.adminSecret,
|
|
1169
|
+
backendSecret: first.core.backendSecret,
|
|
1170
|
+
async handle(method, path, headers, body, access) {
|
|
1171
|
+
const response = await (await ensure()).core.handle(method, path, headers, body, access);
|
|
1172
|
+
if (!response.headers.some(([name]) => name.toLowerCase() === ROUTER_ERROR_HEADER))
|
|
1173
|
+
return response;
|
|
1174
|
+
// Refused before it reached the core (a core stopping or restarting
|
|
1175
|
+
// while this instance still trusted it): wake it and send it again.
|
|
1176
|
+
distrust();
|
|
1177
|
+
return (await ensure()).core.handle(method, path, headers, body, access);
|
|
1178
|
+
},
|
|
1179
|
+
openSocket(headers, onEvent, access) {
|
|
1180
|
+
sockets++;
|
|
1181
|
+
let inner;
|
|
1182
|
+
let closed = false;
|
|
1183
|
+
const queued = [];
|
|
1184
|
+
const done = () => {
|
|
1185
|
+
if (!closed)
|
|
1186
|
+
sockets--;
|
|
1187
|
+
closed = true;
|
|
1188
|
+
};
|
|
1189
|
+
ensure().then(({ core }) => {
|
|
1190
|
+
if (closed)
|
|
1191
|
+
return;
|
|
1192
|
+
try {
|
|
1193
|
+
let reached = false;
|
|
1194
|
+
inner = core.openSocket(headers, (error, event) => {
|
|
1195
|
+
if (error || event.kind === "close")
|
|
1196
|
+
done();
|
|
1197
|
+
// A connection that never reached the core counts toward
|
|
1198
|
+
// recycling its session; a dropped one only wakes it: the
|
|
1199
|
+
// client reconnects, and its next session finds it awake.
|
|
1200
|
+
if (event.kind === "close" && inner?.opened && !reached)
|
|
1201
|
+
connectionUnreached();
|
|
1202
|
+
else if (event.kind === "close" && event.code === 1006)
|
|
1203
|
+
distrust();
|
|
1204
|
+
onEvent(error, event);
|
|
1205
|
+
}, access);
|
|
1206
|
+
void inner.opened?.then(() => {
|
|
1207
|
+
reached = true;
|
|
1208
|
+
connectionReached();
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
catch (error) {
|
|
1212
|
+
done();
|
|
1213
|
+
onEvent(error instanceof Error ? error : new Error(String(error)), {
|
|
1214
|
+
kind: "close",
|
|
1215
|
+
code: 1011,
|
|
1216
|
+
reason: "core unavailable",
|
|
1217
|
+
});
|
|
1218
|
+
return;
|
|
1219
|
+
}
|
|
1220
|
+
for (const data of queued.splice(0))
|
|
1221
|
+
inner.send(data);
|
|
1222
|
+
}, (error) => {
|
|
1223
|
+
done();
|
|
1224
|
+
onEvent(error instanceof Error ? error : new Error(String(error)), {
|
|
1225
|
+
kind: "close",
|
|
1226
|
+
code: 1011,
|
|
1227
|
+
reason: "core unavailable",
|
|
1228
|
+
});
|
|
1229
|
+
});
|
|
1230
|
+
return {
|
|
1231
|
+
send(data) {
|
|
1232
|
+
if (closed)
|
|
1233
|
+
return false;
|
|
1234
|
+
lastActivity = Date.now();
|
|
1235
|
+
if (inner)
|
|
1236
|
+
return inner.send(data);
|
|
1237
|
+
queued.push(data);
|
|
1238
|
+
return true;
|
|
1239
|
+
},
|
|
1240
|
+
close() {
|
|
1241
|
+
done();
|
|
1242
|
+
inner?.close();
|
|
1243
|
+
},
|
|
1244
|
+
};
|
|
1245
|
+
},
|
|
1246
|
+
async close() {
|
|
1247
|
+
clearInterval(keepalive);
|
|
1248
|
+
unregister();
|
|
1249
|
+
await live?.core.close();
|
|
1250
|
+
},
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
/** The largest request body kept to send again after the router refused it. */
|
|
1254
|
+
const RESEND_MAX_BYTES = 1024 * 1024;
|
|
1255
|
+
/** Whether `request` has no body, or a small one already in memory or of stated size. */
|
|
1256
|
+
function resendable(request, given) {
|
|
1257
|
+
if (request.body === null)
|
|
1258
|
+
return true;
|
|
1259
|
+
const size = typeof given === "string"
|
|
1260
|
+
? Buffer.byteLength(given)
|
|
1261
|
+
: given instanceof ArrayBuffer || ArrayBuffer.isView(given)
|
|
1262
|
+
? given.byteLength
|
|
1263
|
+
: Number(request.headers.get("content-length") ?? NaN);
|
|
1264
|
+
return Number.isFinite(size) && size <= RESEND_MAX_BYTES;
|
|
1265
|
+
}
|
|
1266
|
+
/**
|
|
1267
|
+
* A WebSocket that wakes the core, then connects to wherever it now runs.
|
|
1268
|
+
*
|
|
1269
|
+
* A connection to the core that fails before it opens (the core is stopping,
|
|
1270
|
+
* restarting, or Vercel's router refuses the upgrade) is tried again once the
|
|
1271
|
+
* core is awake, until the wake deadline: the client hears of it only as a
|
|
1272
|
+
* slower open. Nothing is replayed, since a client sends nothing before
|
|
1273
|
+
* `open`. A connection that opened and then dropped is reported as it is:
|
|
1274
|
+
* the client's own reconnect, and the query machinery above it, take over.
|
|
1275
|
+
*
|
|
1276
|
+
* `hooks` hears how each connection went: `dropped` for a connection to the
|
|
1277
|
+
* core that closed abnormally (the core may be down), `unreached` once a
|
|
1278
|
+
* connection ends without ever having opened (retries spent, or the client
|
|
1279
|
+
* gave up waiting) after a connection to the core was made (not while it
|
|
1280
|
+
* only waited for the wake), and `reached` once one opens.
|
|
1281
|
+
*/
|
|
1282
|
+
function wakingWebSocket(resolveOrigin, hooks) {
|
|
1283
|
+
return class WakingSocket {
|
|
1284
|
+
binaryType = "arraybuffer";
|
|
1285
|
+
readyState = 0;
|
|
1286
|
+
socket;
|
|
1287
|
+
listeners = new Map();
|
|
1288
|
+
path;
|
|
1289
|
+
deadline = performance.now() + WAKE_DEADLINE_MS;
|
|
1290
|
+
pause = 100;
|
|
1291
|
+
/** Whether a connection to the core was made, not just waited for. */
|
|
1292
|
+
tried = false;
|
|
1293
|
+
constructor(url) {
|
|
1294
|
+
this.path = new URL(url).pathname + new URL(url).search;
|
|
1295
|
+
this.connect();
|
|
1296
|
+
}
|
|
1297
|
+
connect() {
|
|
1298
|
+
resolveOrigin().then((origin) => {
|
|
1299
|
+
if (this.readyState >= 2)
|
|
1300
|
+
return;
|
|
1301
|
+
const Socket = inProcessWebSocketFor(origin) ?? globalThis.WebSocket;
|
|
1302
|
+
const socket = new Socket(`${origin.replace(/^http/, "ws")}${this.path}`);
|
|
1303
|
+
socket.binaryType = "arraybuffer";
|
|
1304
|
+
this.socket = socket;
|
|
1305
|
+
this.tried = true;
|
|
1306
|
+
socket.addEventListener("open", () => {
|
|
1307
|
+
if (this.socket !== socket || this.readyState !== 0)
|
|
1308
|
+
return;
|
|
1309
|
+
this.readyState = 1;
|
|
1310
|
+
hooks.reached();
|
|
1311
|
+
this.emit("open");
|
|
1312
|
+
});
|
|
1313
|
+
socket.addEventListener("message", (event) => {
|
|
1314
|
+
if (this.socket === socket)
|
|
1315
|
+
this.emit("message", { data: event.data });
|
|
1316
|
+
});
|
|
1317
|
+
socket.addEventListener("error", (event) => {
|
|
1318
|
+
// A connection that never opened is retried, or reports its close.
|
|
1319
|
+
if (this.socket === socket && this.readyState === 1)
|
|
1320
|
+
this.emit("error", event);
|
|
1321
|
+
});
|
|
1322
|
+
socket.addEventListener("close", (event) => {
|
|
1323
|
+
if (this.socket !== socket)
|
|
1324
|
+
return;
|
|
1325
|
+
if (event.code === 1006)
|
|
1326
|
+
hooks.dropped();
|
|
1327
|
+
if (this.readyState === 0 && event.code === 1006 && this.retry())
|
|
1328
|
+
return;
|
|
1329
|
+
this.finish(event.code, event.reason, this.readyState === 0);
|
|
1330
|
+
});
|
|
1331
|
+
}, (error) => {
|
|
1332
|
+
this.emit("error", error);
|
|
1333
|
+
this.finish(1011, "core unavailable");
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
/** Connect again after a connection that never opened, if there is time left. */
|
|
1337
|
+
retry() {
|
|
1338
|
+
if (performance.now() + this.pause > this.deadline)
|
|
1339
|
+
return false;
|
|
1340
|
+
this.socket = undefined;
|
|
1341
|
+
setTimeout(() => {
|
|
1342
|
+
if (this.readyState === 0)
|
|
1343
|
+
this.connect();
|
|
1344
|
+
}, this.pause);
|
|
1345
|
+
this.pause = Math.min(this.pause * 2, 1_000);
|
|
1346
|
+
return true;
|
|
1347
|
+
}
|
|
1348
|
+
addEventListener(type, listener) {
|
|
1349
|
+
const list = this.listeners.get(type) ?? [];
|
|
1350
|
+
list.push(listener);
|
|
1351
|
+
this.listeners.set(type, list);
|
|
1352
|
+
}
|
|
1353
|
+
send(data) {
|
|
1354
|
+
if (this.readyState !== 1 || !this.socket)
|
|
1355
|
+
throw new Error("socket is not open");
|
|
1356
|
+
this.socket.send(data);
|
|
1357
|
+
}
|
|
1358
|
+
close() {
|
|
1359
|
+
if (this.readyState >= 2)
|
|
1360
|
+
return;
|
|
1361
|
+
this.socket?.close();
|
|
1362
|
+
// A client gives up on a connection that doesn't open in time (its
|
|
1363
|
+
// handshake timeout): that one never reached the core either, if it
|
|
1364
|
+
// tried. One given up while the core was still waking never did.
|
|
1365
|
+
this.finish(1000, "client closed", this.readyState === 0 && this.tried);
|
|
1366
|
+
}
|
|
1367
|
+
emit(type, event) {
|
|
1368
|
+
for (const listener of this.listeners.get(type) ?? [])
|
|
1369
|
+
listener(event);
|
|
1370
|
+
}
|
|
1371
|
+
/** End this socket; `unreached` if it ends without having reached the core. */
|
|
1372
|
+
finish(code, reason, unreached = false) {
|
|
1373
|
+
if (this.readyState >= 3)
|
|
1374
|
+
return;
|
|
1375
|
+
this.readyState = 3;
|
|
1376
|
+
if (unreached)
|
|
1377
|
+
hooks.unreached();
|
|
1378
|
+
this.emit("close", { code, reason });
|
|
1379
|
+
}
|
|
1380
|
+
};
|
|
1381
|
+
}
|
|
1382
|
+
/** The core keeps its own app id; one passed from JavaScript is refused, not ignored. */
|
|
1383
|
+
export function refuseVercelAppId(options) {
|
|
1384
|
+
if ("appId" in options) {
|
|
1385
|
+
throw new Error("vercel(): appId is not an option: the core keeps its own app id on its Drive.");
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
//# sourceMappingURL=vercel-store.js.map
|