jazz-tools 2.0.0-alpha.6 → 2.0.0-alpha.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +179 -3
- package/bin/jazz-tools.js +94 -45
- 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 +237 -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 +34 -0
- package/dist/accounts/account-manager-core.d.ts.map +1 -0
- package/dist/accounts/account-manager-core.js +203 -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/create-account-manager.d.ts +52 -0
- package/dist/accounts/create-account-manager.d.ts.map +1 -0
- package/dist/accounts/create-account-manager.js +17 -0
- package/dist/accounts/create-account-manager.js.map +1 -0
- package/dist/accounts/enrollment.d.ts +87 -0
- package/dist/accounts/enrollment.d.ts.map +1 -0
- package/dist/accounts/enrollment.js +312 -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 +14 -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 +42 -0
- package/dist/accounts/persistence.d.ts.map +1 -0
- package/dist/accounts/persistence.js +311 -0
- package/dist/accounts/persistence.js.map +1 -0
- package/dist/accounts/registry-client.d.ts +70 -0
- package/dist/accounts/registry-client.d.ts.map +1 -0
- package/dist/accounts/registry-client.js +142 -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/backend/admission.d.ts +18 -0
- package/dist/backend/admission.d.ts.map +1 -0
- package/dist/backend/admission.js +139 -0
- package/dist/backend/admission.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/blobs.d.ts +121 -0
- package/dist/backend/blobs.d.ts.map +1 -0
- package/dist/backend/blobs.js +123 -0
- package/dist/backend/blobs.js.map +1 -0
- package/dist/backend/create-jazz-context.d.ts +116 -0
- package/dist/backend/create-jazz-context.d.ts.map +1 -0
- package/dist/backend/create-jazz-context.js +607 -0
- package/dist/backend/create-jazz-context.js.map +1 -0
- package/dist/backend/create-jazz-session.d.ts +107 -0
- package/dist/backend/create-jazz-session.d.ts.map +1 -0
- package/dist/backend/create-jazz-session.js +505 -0
- package/dist/backend/create-jazz-session.js.map +1 -0
- package/dist/backend/create-jazz.d.ts +493 -0
- package/dist/backend/create-jazz.d.ts.map +1 -0
- package/dist/backend/create-jazz.js +3026 -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 +380 -0
- package/dist/backend/external-jwt.js.map +1 -0
- package/dist/backend/from-jwt.d.ts +62 -0
- package/dist/backend/from-jwt.d.ts.map +1 -0
- package/dist/backend/from-jwt.js +102 -0
- package/dist/backend/from-jwt.js.map +1 -0
- package/dist/backend/index.d.ts +12 -1
- package/dist/backend/index.d.ts.map +1 -1
- package/dist/backend/index.js +10 -1
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/inspect-ui.d.ts +14 -0
- package/dist/backend/inspect-ui.d.ts.map +1 -0
- package/dist/backend/inspect-ui.js +156 -0
- package/dist/backend/inspect-ui.js.map +1 -0
- package/dist/backend/inspect.d.ts +129 -0
- package/dist/backend/inspect.d.ts.map +1 -0
- package/dist/backend/inspect.js +763 -0
- package/dist/backend/inspect.js.map +1 -0
- package/dist/backend/inspector-ui/0.js +2 -0
- package/dist/backend/inspector-ui/1.js +2 -0
- package/dist/backend/inspector-ui/10.js +2 -0
- package/dist/backend/inspector-ui/11.js +2 -0
- package/dist/backend/inspector-ui/12.js +2 -0
- package/dist/backend/inspector-ui/13.js +2 -0
- package/dist/backend/inspector-ui/14.js +2 -0
- package/dist/backend/inspector-ui/15.js +2 -0
- package/dist/backend/inspector-ui/16.js +2 -0
- package/dist/backend/inspector-ui/17.js +2 -0
- package/dist/backend/inspector-ui/18.js +2 -0
- package/dist/backend/inspector-ui/19.js +2 -0
- package/dist/backend/inspector-ui/2.js +2 -0
- package/dist/backend/inspector-ui/20.js +2 -0
- package/dist/backend/inspector-ui/3.js +2 -0
- package/dist/backend/inspector-ui/4.js +2 -0
- package/dist/backend/inspector-ui/5.js +2 -0
- package/dist/backend/inspector-ui/6.js +2 -0
- package/dist/backend/inspector-ui/7.js +2 -0
- package/dist/backend/inspector-ui/8.js +2 -0
- package/dist/backend/inspector-ui/9.js +2 -0
- package/dist/backend/inspector-ui-files.d.ts +4 -0
- package/dist/backend/inspector-ui-files.d.ts.map +1 -0
- package/dist/backend/inspector-ui-files.js +25 -0
- package/dist/backend/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/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 +39 -0
- package/dist/backend/request-auth.d.ts.map +1 -0
- package/dist/backend/request-auth.js +77 -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/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/upgrade-status.d.ts +19 -0
- package/dist/backend/upgrade-status.d.ts.map +1 -0
- package/dist/backend/upgrade-status.js +55 -0
- package/dist/backend/upgrade-status.js.map +1 -0
- package/dist/backend/vercel-sockets.d.ts +16 -0
- package/dist/backend/vercel-sockets.d.ts.map +1 -0
- package/dist/backend/vercel-sockets.js +24 -0
- package/dist/backend/vercel-sockets.js.map +1 -0
- package/dist/backend/vercel-store.d.ts +223 -0
- package/dist/backend/vercel-store.d.ts.map +1 -0
- package/dist/backend/vercel-store.js +999 -0
- package/dist/backend/vercel-store.js.map +1 -0
- package/dist/better-auth-adapter/fixtures/permissions.d.ts +2 -0
- package/dist/better-auth-adapter/fixtures/permissions.d.ts.map +1 -0
- package/dist/better-auth-adapter/fixtures/permissions.js +2 -0
- package/dist/better-auth-adapter/fixtures/permissions.js.map +1 -0
- package/dist/better-auth-adapter/fixtures/schema.d.ts +69 -0
- package/dist/better-auth-adapter/fixtures/schema.d.ts.map +1 -0
- package/dist/better-auth-adapter/fixtures/schema.js +84 -0
- package/dist/better-auth-adapter/fixtures/schema.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 +366 -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 +49 -0
- package/dist/better-auth-adapter/schema.d.ts.map +1 -0
- package/dist/better-auth-adapter/schema.js +300 -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 +27 -0
- package/dist/better-auth-adapter/utils.d.ts.map +1 -0
- package/dist/better-auth-adapter/utils.js +189 -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 +29 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +385 -267
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +10 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +7 -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 +413 -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 +54 -65
- package/dist/codegen/relation-analyzer.js.map +1 -1
- package/dist/codegen/schema-reader.d.ts +6 -2
- package/dist/codegen/schema-reader.d.ts.map +1 -1
- package/dist/codegen/schema-reader.js +129 -98
- package/dist/codegen/schema-reader.js.map +1 -1
- package/dist/dev/catalogue-api.d.ts +157 -0
- package/dist/dev/catalogue-api.d.ts.map +1 -0
- package/dist/dev/catalogue-api.js +145 -0
- package/dist/dev/catalogue-api.js.map +1 -0
- package/dist/dev/catalogue-project.d.ts +150 -0
- package/dist/dev/catalogue-project.d.ts.map +1 -0
- package/dist/dev/catalogue-project.js +1466 -0
- package/dist/dev/catalogue-project.js.map +1 -0
- package/dist/dev/catalogue.d.ts +84 -0
- package/dist/dev/catalogue.d.ts.map +1 -0
- package/dist/dev/catalogue.js +310 -0
- package/dist/dev/catalogue.js.map +1 -0
- package/dist/dev/dev-server.d.ts +57 -0
- package/dist/dev/dev-server.d.ts.map +1 -0
- package/dist/dev/dev-server.js +122 -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/backend-DHeT1LCS.css +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/backend-Dt5FYVfX.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/create-legacy-browser-delegate-Bf58kV5i.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-BQhYkCKN.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-CI6IodCN.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-D5aLlEYl.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-D_R-EGgt.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-WihpI9g6.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/esm-xNe3wI_B.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/index-CjhxdwQ7.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/jazz-broker-worker-CaVlHITU.js +3 -0
- package/dist/dev/inspector-overlay/embedded/assets/jazz-broker-worker-D-HQuhdu.js +23600 -0
- package/dist/dev/inspector-overlay/embedded/assets/jazz_wasm-t1Mm3faf.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/jazz_wasm_bg-BazWJnU4.wasm +0 -0
- package/dist/dev/inspector-overlay/embedded/assets/node-foreground-node-lease.browser-CH8w-D6S.js +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/src-Cq8gSOLx.css +1 -0
- package/dist/dev/inspector-overlay/embedded/assets/src-Dg6641Mj.js +22 -0
- package/dist/dev/inspector-overlay/embedded/assets/trace-api-BctnwbUf.js +1 -0
- package/dist/dev/inspector-overlay/embedded/backend.html +16 -0
- package/dist/dev/inspector-overlay/embedded/embedded.html +14 -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/legacy-schema-hash.d.ts +4 -0
- package/dist/dev/legacy-schema-hash.d.ts.map +1 -0
- package/dist/dev/legacy-schema-hash.js +12 -0
- package/dist/dev/legacy-schema-hash.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 +14 -0
- package/dist/dev/migrations.d.ts.map +1 -0
- package/dist/dev/migrations.js +441 -0
- package/dist/dev/migrations.js.map +1 -0
- package/dist/dev/schema-utils.d.ts +18 -0
- package/dist/dev/schema-utils.d.ts.map +1 -0
- package/dist/dev/schema-utils.js +365 -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/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 +22 -0
- package/dist/drivers/schema-wire.d.ts.map +1 -0
- package/dist/drivers/schema-wire.js +70 -0
- package/dist/drivers/schema-wire.js.map +1 -0
- package/dist/drivers/types.d.ts +322 -45
- package/dist/drivers/types.d.ts.map +1 -1
- package/dist/drivers/types.js +5 -4
- package/dist/drivers/types.js.map +1 -1
- package/dist/dsl.d.ts +291 -101
- package/dist/dsl.d.ts.map +1 -1
- package/dist/dsl.js +244 -113
- package/dist/dsl.js.map +1 -1
- 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 +92 -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 +55 -0
- package/dist/expo/create-jazz-session.d.ts.map +1 -0
- package/dist/expo/create-jazz-session.js +78 -0
- package/dist/expo/create-jazz-session.js.map +1 -0
- package/dist/expo/index.d.ts +13 -0
- package/dist/expo/index.d.ts.map +1 -0
- package/dist/expo/index.js +12 -0
- package/dist/expo/index.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 +24 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/dist/inspect/cli.d.ts +12 -0
- package/dist/inspect/cli.d.ts.map +1 -0
- package/dist/inspect/cli.js +292 -0
- package/dist/inspect/cli.js.map +1 -0
- package/dist/inspect/client.d.ts +60 -0
- package/dist/inspect/client.d.ts.map +1 -0
- package/dist/inspect/client.js +241 -0
- package/dist/inspect/client.js.map +1 -0
- package/dist/inspect/mcp.d.ts +17 -0
- package/dist/inspect/mcp.d.ts.map +1 -0
- package/dist/inspect/mcp.js +308 -0
- package/dist/inspect/mcp.js.map +1 -0
- package/dist/inspect/protocol.d.ts +218 -0
- package/dist/inspect/protocol.d.ts.map +1 -0
- package/dist/inspect/protocol.js +357 -0
- package/dist/inspect/protocol.js.map +1 -0
- package/dist/inspector/index.d.ts +10 -0
- package/dist/inspector/index.d.ts.map +1 -0
- package/dist/inspector/index.js +27 -0
- package/dist/inspector/index.js.map +1 -0
- package/dist/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 +139 -115
- package/dist/ir.d.ts.map +1 -1
- package/dist/ir.js +496 -1
- package/dist/ir.js.map +1 -1
- package/dist/local-first/index.d.ts +16 -0
- package/dist/local-first/index.d.ts.map +1 -0
- package/dist/local-first/index.js +15 -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 +34 -0
- package/dist/magic-columns.d.ts.map +1 -0
- package/dist/magic-columns.js +86 -0
- package/dist/magic-columns.js.map +1 -0
- package/dist/migration-namespace.d.ts +8 -0
- package/dist/migration-namespace.d.ts.map +1 -0
- package/dist/migration-namespace.js +9 -0
- package/dist/migration-namespace.js.map +1 -0
- package/dist/migrations.d.ts +229 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +383 -0
- package/dist/migrations.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 +38 -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/index.d.ts +149 -41
- package/dist/permissions/index.d.ts.map +1 -1
- package/dist/permissions/index.js +1209 -423
- package/dist/permissions/index.js.map +1 -1
- package/dist/policy-expr-map.d.ts +15 -0
- package/dist/policy-expr-map.d.ts.map +1 -0
- package/dist/policy-expr-map.js +45 -0
- package/dist/policy-expr-map.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 +174 -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/provenance-guidance.d.ts +3 -0
- package/dist/provenance-guidance.d.ts.map +1 -0
- package/dist/provenance-guidance.js +19 -0
- package/dist/provenance-guidance.js.map +1 -0
- package/dist/react/create-jazz-client.d.ts +2 -10
- package/dist/react/create-jazz-client.d.ts.map +1 -1
- package/dist/react/create-jazz-client.js +1 -25
- package/dist/react/create-jazz-client.js.map +1 -1
- package/dist/react/index.d.ts +15 -6
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +10 -5
- 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 -13
- package/dist/react/provider.d.ts.map +1 -1
- package/dist/react/provider.js +25 -4
- 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 +10 -4
- package/dist/react-core/index.d.ts.map +1 -1
- package/dist/react-core/index.js +12 -2
- package/dist/react-core/index.js.map +1 -1
- package/dist/react-core/provider.d.ts +44 -12
- package/dist/react-core/provider.d.ts.map +1 -1
- package/dist/react-core/provider.js +110 -11
- package/dist/react-core/provider.js.map +1 -1
- package/dist/react-core/session.d.ts +53 -0
- package/dist/react-core/session.d.ts.map +1 -0
- package/dist/react-core/session.js +82 -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 +55 -0
- package/dist/react-native/create-jazz-session.d.ts.map +1 -0
- package/dist/react-native/create-jazz-session.js +78 -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 +20 -9
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +15 -7
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/native-foreground-db.d.ts +199 -0
- package/dist/react-native/native-foreground-db.d.ts.map +1 -0
- package/dist/react-native/native-foreground-db.js +830 -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 +20 -12
- package/dist/react-native/provider.d.ts.map +1 -1
- package/dist/react-native/provider.js +25 -4
- package/dist/react-native/provider.js.map +1 -1
- package/dist/react-native/runtime-source.d.ts +40 -0
- package/dist/react-native/runtime-source.d.ts.map +1 -0
- package/dist/react-native/runtime-source.js +250 -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/removed-api.d.ts +87 -0
- package/dist/removed-api.d.ts.map +1 -0
- package/dist/removed-api.js +95 -0
- package/dist/removed-api.js.map +1 -0
- package/dist/runtime/anonymous-write-denied-error.d.ts +13 -0
- package/dist/runtime/anonymous-write-denied-error.d.ts.map +1 -0
- package/dist/runtime/anonymous-write-denied-error.js +58 -0
- package/dist/runtime/anonymous-write-denied-error.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 +40 -0
- package/dist/runtime/auth-state.d.ts.map +1 -0
- package/dist/runtime/auth-state.js +145 -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 +54 -0
- package/dist/runtime/authority-changed-error.d.ts.map +1 -0
- package/dist/runtime/authority-changed-error.js +72 -0
- package/dist/runtime/authority-changed-error.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-worker-assets.d.ts +4 -0
- package/dist/runtime/browser-worker-assets.d.ts.map +1 -0
- package/dist/runtime/browser-worker-assets.js +8 -0
- package/dist/runtime/browser-worker-assets.js.map +1 -0
- package/dist/runtime/browser-worker-assets.native.d.ts +5 -0
- package/dist/runtime/browser-worker-assets.native.d.ts.map +1 -0
- package/dist/runtime/browser-worker-assets.native.js +6 -0
- package/dist/runtime/browser-worker-assets.native.js.map +1 -0
- package/dist/runtime/browser-worker-config.d.ts +55 -0
- package/dist/runtime/browser-worker-config.d.ts.map +1 -0
- package/dist/runtime/browser-worker-config.js +222 -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 +33 -0
- package/dist/runtime/client-migrations.d.ts.map +1 -0
- package/dist/runtime/client-migrations.js +30 -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 -13
- package/dist/runtime/client-session.d.ts.map +1 -1
- package/dist/runtime/client-session.js +212 -196
- package/dist/runtime/client-session.js.map +1 -1
- package/dist/runtime/client.d.ts +630 -191
- package/dist/runtime/client.d.ts.map +1 -1
- package/dist/runtime/client.js +1105 -425
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/column-transforms.d.ts +40 -0
- package/dist/runtime/column-transforms.d.ts.map +1 -0
- package/dist/runtime/column-transforms.js +279 -0
- package/dist/runtime/column-transforms.js.map +1 -0
- package/dist/runtime/connection-manager/browser-connection-manager.d.ts +122 -0
- package/dist/runtime/connection-manager/browser-connection-manager.d.ts.map +1 -0
- package/dist/runtime/connection-manager/browser-connection-manager.js +867 -0
- package/dist/runtime/connection-manager/browser-connection-manager.js.map +1 -0
- package/dist/runtime/connection-manager/direct-connection-manager.d.ts +26 -0
- package/dist/runtime/connection-manager/direct-connection-manager.d.ts.map +1 -0
- package/dist/runtime/connection-manager/direct-connection-manager.js +198 -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 +151 -0
- package/dist/runtime/connection-manager/types.d.ts.map +1 -0
- package/dist/runtime/connection-manager/types.js +354 -0
- package/dist/runtime/connection-manager/types.js.map +1 -0
- package/dist/runtime/context.d.ts +90 -30
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/context.js.map +1 -1
- package/dist/runtime/credentialed-transport.d.ts +30 -0
- package/dist/runtime/credentialed-transport.d.ts.map +1 -0
- package/dist/runtime/credentialed-transport.js +164 -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 +763 -201
- package/dist/runtime/db.d.ts.map +1 -1
- package/dist/runtime/db.js +3341 -725
- 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 +315 -0
- package/dist/runtime/default-runtime-source.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 +9 -0
- package/dist/runtime/graceful-shutdown-error.d.ts.map +1 -0
- package/dist/runtime/graceful-shutdown-error.js +17 -0
- package/dist/runtime/graceful-shutdown-error.js.map +1 -0
- package/dist/runtime/hex.d.ts +17 -0
- package/dist/runtime/hex.d.ts.map +1 -0
- package/dist/runtime/hex.js +56 -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 +21 -11
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +13 -10
- 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 +47 -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.d.ts +2 -0
- package/dist/runtime/json-text.d.ts.map +1 -0
- package/dist/runtime/json-text.js +17 -0
- package/dist/runtime/json-text.js.map +1 -0
- 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-upgrade.d.ts +27 -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/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 +24 -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-runtime/attached-browser-worker-connection.d.ts +22 -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 +42 -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 +31 -0
- package/dist/runtime/native-runtime/broker-worker-load-failure.d.ts.map +1 -0
- package/dist/runtime/native-runtime/broker-worker-load-failure.js +66 -0
- package/dist/runtime/native-runtime/broker-worker-load-failure.js.map +1 -0
- package/dist/runtime/native-runtime/browser-follower-connection.d.ts +82 -0
- package/dist/runtime/native-runtime/browser-follower-connection.d.ts.map +1 -0
- package/dist/runtime/native-runtime/browser-follower-connection.js +495 -0
- package/dist/runtime/native-runtime/browser-follower-connection.js.map +1 -0
- package/dist/runtime/native-runtime/browser-shared-worker-connection.d.ts +98 -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 +831 -0
- package/dist/runtime/native-runtime/browser-shared-worker-connection.js.map +1 -0
- package/dist/runtime/native-runtime/browser-worker-protocol.d.ts +460 -0
- package/dist/runtime/native-runtime/browser-worker-protocol.d.ts.map +1 -0
- package/dist/runtime/native-runtime/browser-worker-protocol.js +281 -0
- package/dist/runtime/native-runtime/browser-worker-protocol.js.map +1 -0
- package/dist/runtime/native-runtime/browser-worker-transport.d.ts +53 -0
- package/dist/runtime/native-runtime/browser-worker-transport.d.ts.map +1 -0
- package/dist/runtime/native-runtime/browser-worker-transport.js +252 -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 +460 -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 +177 -0
- package/dist/runtime/native-runtime/native-codec.d.ts.map +1 -0
- package/dist/runtime/native-runtime/native-codec.js +627 -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 +62 -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 +942 -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 +736 -0
- package/dist/runtime/native-runtime/native-runtime-adapter.d.ts.map +1 -0
- package/dist/runtime/native-runtime/native-runtime-adapter.js +5733 -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/websocket.d.ts +178 -0
- package/dist/runtime/native-runtime/websocket.d.ts.map +1 -0
- package/dist/runtime/native-runtime/websocket.js +732 -0
- package/dist/runtime/native-runtime/websocket.js.map +1 -0
- package/dist/runtime/page-handle.d.ts +87 -0
- package/dist/runtime/page-handle.d.ts.map +1 -0
- package/dist/runtime/page-handle.js +144 -0
- package/dist/runtime/page-handle.js.map +1 -0
- package/dist/runtime/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 +37 -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 +554 -167
- 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 +18 -6
- package/dist/runtime/row-transformer.d.ts.map +1 -1
- package/dist/runtime/row-transformer.js +195 -41
- 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 +9 -0
- package/dist/runtime/runtime-config.d.ts.map +1 -0
- package/dist/runtime/runtime-config.js +111 -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 +170 -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 +5 -0
- package/dist/runtime/schema-metadata.d.ts.map +1 -0
- package/dist/runtime/schema-metadata.js +34 -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 +47 -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 +49 -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 +55 -0
- package/dist/runtime/structural-values.js.map +1 -0
- package/dist/runtime/subscription-manager.d.ts +98 -14
- package/dist/runtime/subscription-manager.d.ts.map +1 -1
- package/dist/runtime/subscription-manager.js +1049 -25
- package/dist/runtime/subscription-manager.js.map +1 -1
- package/dist/runtime/sync-status.d.ts +157 -0
- package/dist/runtime/sync-status.d.ts.map +1 -0
- package/dist/runtime/sync-status.js +153 -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 +196 -43
- 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 +120 -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-hash.d.ts +3 -0
- package/dist/schema-hash.d.ts.map +1 -0
- package/dist/schema-hash.js +5 -0
- package/dist/schema-hash.js.map +1 -0
- package/dist/schema-loader.d.ts +31 -0
- package/dist/schema-loader.d.ts.map +1 -0
- package/dist/schema-loader.js +501 -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 +35 -0
- package/dist/schema-namespace.d.ts.map +1 -0
- package/dist/schema-namespace.js +17 -0
- package/dist/schema-namespace.js.map +1 -0
- package/dist/schema-permissions.d.ts +16 -0
- package/dist/schema-permissions.d.ts.map +1 -0
- package/dist/schema-permissions.js +405 -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 +39 -0
- package/dist/schema-source.js.map +1 -0
- package/dist/schema.d.ts +108 -36
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +1 -10
- package/dist/schema.js.map +1 -1
- package/dist/session/backend-watch.d.ts +177 -0
- package/dist/session/backend-watch.d.ts.map +1 -0
- package/dist/session/backend-watch.js +653 -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 +104 -0
- package/dist/session/create-jazz-session.d.ts.map +1 -0
- package/dist/session/create-jazz-session.js +647 -0
- package/dist/session/create-jazz-session.js.map +1 -0
- package/dist/session/follow-user.d.ts +63 -0
- package/dist/session/follow-user.d.ts.map +1 -0
- package/dist/session/follow-user.js +128 -0
- package/dist/session/follow-user.js.map +1 -0
- package/dist/session/jazz-session.d.ts +164 -0
- package/dist/session/jazz-session.d.ts.map +1 -0
- package/dist/session/jazz-session.js +432 -0
- package/dist/session/jazz-session.js.map +1 -0
- package/dist/session/left-behind-replicas.d.ts +69 -0
- package/dist/session/left-behind-replicas.d.ts.map +1 -0
- package/dist/session/left-behind-replicas.js +163 -0
- package/dist/session/left-behind-replicas.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/state.d.ts +100 -0
- package/dist/session/state.d.ts.map +1 -0
- package/dist/session/state.js +428 -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 +83 -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 +43 -0
- package/dist/solid/create-solid-jazz-client.js.map +1 -0
- package/dist/solid/create-solid-jazz-client.ssr.js +46 -0
- package/dist/solid/create-solid-jazz-client.ssr.js.map +1 -0
- package/dist/solid/index.d.ts +14 -0
- package/dist/solid/index.d.ts.map +1 -0
- package/dist/solid/index.js +10 -0
- package/dist/solid/index.ssr.js +10 -0
- package/dist/solid/provider.d.ts +32 -0
- package/dist/solid/provider.d.ts.map +1 -0
- package/dist/solid/provider.js +47 -0
- package/dist/solid/provider.js.map +1 -0
- package/dist/solid/provider.ssr.js +47 -0
- package/dist/solid/provider.ssr.js.map +1 -0
- package/dist/solid/session.d.ts +52 -0
- package/dist/solid/session.d.ts.map +1 -0
- package/dist/solid/session.js +123 -0
- package/dist/solid/session.js.map +1 -0
- package/dist/solid/session.ssr.js +148 -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 +37 -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 +73 -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 +28 -0
- package/dist/solid/use-one.js.map +1 -0
- package/dist/solid/use-one.ssr.js +28 -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 +14 -0
- package/dist/solid/use-sync-status.js.map +1 -0
- package/dist/solid/use-sync-status.ssr.js +21 -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 +53 -13
- package/dist/subscriptions-orchestrator.d.ts.map +1 -1
- package/dist/subscriptions-orchestrator.js +295 -74
- package/dist/subscriptions-orchestrator.js.map +1 -1
- package/dist/svelte/JazzProvider.svelte +96 -0
- package/dist/svelte/JazzProvider.svelte.d.ts +23 -0
- package/dist/svelte/JazzProvider.svelte.d.ts.map +1 -0
- package/dist/svelte/JazzSvelteClientProvider.svelte +73 -0
- package/dist/svelte/JazzSvelteClientProvider.svelte.d.ts +13 -0
- package/dist/svelte/JazzSvelteClientProvider.svelte.d.ts.map +1 -0
- package/dist/svelte/JazzSvelteProvider.svelte +160 -28
- package/dist/svelte/JazzSvelteProvider.svelte.d.ts +4 -3
- package/dist/svelte/JazzSvelteProvider.svelte.d.ts.map +1 -1
- package/dist/svelte/context.svelte.d.ts +23 -3
- package/dist/svelte/context.svelte.d.ts.map +1 -1
- package/dist/svelte/context.svelte.js +23 -3
- 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 -6
- package/dist/svelte/index.d.ts.map +1 -1
- package/dist/svelte/index.js +11 -6
- 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 +21 -0
- package/dist/svelte/session-state.d.ts.map +1 -0
- package/dist/svelte/session-state.js +29 -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/client-migrations.d.ts +29 -0
- package/dist/testing/client-migrations.d.ts.map +1 -0
- package/dist/testing/client-migrations.js +34 -0
- package/dist/testing/client-migrations.js.map +1 -0
- package/dist/testing/fixtures/basic/schema.d.ts +11 -0
- package/dist/testing/fixtures/basic/schema.d.ts.map +1 -0
- package/dist/testing/fixtures/basic/schema.js +10 -0
- package/dist/testing/fixtures/basic/schema.js.map +1 -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/fixtures/with-defaults/schema.d.ts +385 -0
- package/dist/testing/fixtures/with-defaults/schema.d.ts.map +1 -0
- package/dist/testing/fixtures/with-defaults/schema.js +15 -0
- package/dist/testing/fixtures/with-defaults/schema.js.map +1 -0
- package/dist/testing/fixtures/with-enum-payload-defaults/schema.d.ts +4 -0
- package/dist/testing/fixtures/with-enum-payload-defaults/schema.d.ts.map +1 -0
- package/dist/testing/fixtures/with-enum-payload-defaults/schema.js +22 -0
- package/dist/testing/fixtures/with-enum-payload-defaults/schema.js.map +1 -0
- package/dist/testing/fixtures/with-enum-payload-required-null/schema.d.ts +4 -0
- package/dist/testing/fixtures/with-enum-payload-required-null/schema.d.ts.map +1 -0
- package/dist/testing/fixtures/with-enum-payload-required-null/schema.js +14 -0
- package/dist/testing/fixtures/with-enum-payload-required-null/schema.js.map +1 -0
- package/dist/testing/fixtures/with-enum-payload-wrong-tag/schema.d.ts +4 -0
- package/dist/testing/fixtures/with-enum-payload-wrong-tag/schema.d.ts.map +1 -0
- package/dist/testing/fixtures/with-enum-payload-wrong-tag/schema.js +14 -0
- package/dist/testing/fixtures/with-enum-payload-wrong-tag/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 +123 -0
- package/dist/testing/policy-test-app.d.ts.map +1 -0
- package/dist/testing/policy-test-app.js +216 -0
- package/dist/testing/policy-test-app.js.map +1 -0
- package/dist/testing/test-jazz.d.ts +106 -0
- package/dist/testing/test-jazz.d.ts.map +1 -0
- package/dist/testing/test-jazz.js +157 -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 +81 -0
- package/dist/thin/index.d.ts.map +1 -0
- package/dist/thin/index.js +221 -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 +84 -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 +244 -0
- package/dist/thin/thin-runtime.d.ts.map +1 -0
- package/dist/thin/thin-runtime.js +1323 -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 +729 -0
- package/dist/typed-app.d.ts.map +1 -0
- package/dist/typed-app.js +789 -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 +14 -0
- package/dist/vue/index.d.ts.map +1 -0
- package/dist/vue/index.js +11 -0
- package/dist/vue/index.js.map +1 -0
- package/dist/vue/provider.d.ts +66 -0
- package/dist/vue/provider.d.ts.map +1 -0
- package/dist/vue/provider.js +216 -0
- package/dist/vue/provider.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 +99 -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 +8 -0
- package/dist/web/create-jazz-client.d.ts.map +1 -0
- package/dist/web/create-jazz-client.js +8 -0
- package/dist/web/create-jazz-client.js.map +1 -0
- package/dist/web/lazy-local-first.d.ts +8 -0
- package/dist/web/lazy-local-first.d.ts.map +1 -0
- package/dist/web/lazy-local-first.js +13 -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 +70 -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 +2030 -0
- package/dist/worker/jazz-broker-worker-core.js.map +1 -0
- package/dist/worker/jazz-broker-worker.d.ts +2 -0
- package/dist/worker/jazz-broker-worker.d.ts.map +1 -0
- package/dist/worker/jazz-broker-worker.js +23600 -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 +19 -0
- package/dist/worker/runtime-admission.d.ts.map +1 -0
- package/dist/worker/runtime-admission.js +34 -0
- package/dist/worker/runtime-admission.js.map +1 -0
- package/package.json +262 -31
- 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/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 -844
- 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 -23
- package/dist/codegen/query-builder-generator.d.ts.map +0 -1
- package/dist/codegen/query-builder-generator.js +0 -325
- package/dist/codegen/query-builder-generator.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 -226
- package/dist/codegen/type-generator.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.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 -151
- 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 -84
- 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 -133
- 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 -150
- 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 -171
- 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 -985
- package/dist/runtime/cloud-server.integration.test.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 -1209
- 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 -364
- package/dist/runtime/row-transformer.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 -75
- 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 -212
- package/dist/runtime/value-converter.test.js.map +0 -1
- package/dist/runtime/worker-bridge.d.ts +0 -86
- package/dist/runtime/worker-bridge.d.ts.map +0 -1
- package/dist/runtime/worker-bridge.js +0 -250
- 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 -265
- 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 -194
- 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/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 -51
- 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 -154
- 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 -176
- 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/worker/jazz-worker.d.ts +0 -9
- package/dist/worker/jazz-worker.d.ts.map +0 -1
- package/dist/worker/jazz-worker.js +0 -516
- package/dist/worker/jazz-worker.js.map +0 -1
- package/dist/worker/jazz-worker.ts +0 -581
- 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,1466 @@
|
|
|
1
|
+
import { validateSchemaAndPermissions } from "./schema-validation.js";
|
|
2
|
+
import { runtimeSchemaJsonReplacer } from "../drivers/schema-wire.js";
|
|
3
|
+
/**
|
|
4
|
+
* Contains utilities for deploying schemas, permissions, and migrations to a Jazz server.
|
|
5
|
+
*
|
|
6
|
+
* These are internal utilities for the CLI and dev tooling, which read/write schemas,
|
|
7
|
+
* permissions, and migrations from/to the FS.
|
|
8
|
+
*
|
|
9
|
+
* Prefer using {@link catalogue.ts} utils whenever possible.
|
|
10
|
+
*/
|
|
11
|
+
import { access, link, lstat, mkdir, mkdtemp, open, readFile, readdir, rename, rm, rmdir, unlink, writeFile, } from "node:fs/promises";
|
|
12
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
13
|
+
import { hostname } from "node:os";
|
|
14
|
+
import { basename, dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
|
|
15
|
+
import { pathToFileURL } from "node:url";
|
|
16
|
+
import { build } from "esbuild";
|
|
17
|
+
import { CLIENT_MIGRATIONS_MODULE, clientMigrationsPath, hasRootSchema, loadCompiledSchema, importsClientMigrations, writeClientMigrationsModule, } from "../schema-loader.js";
|
|
18
|
+
import { collectMissingExplicitPolicyDiagnostics, mergePermissionsIntoWasmSchema, } from "../schema-permissions.js";
|
|
19
|
+
import { collectConventionalProvenanceDiagnostics } from "../provenance-guidance.js";
|
|
20
|
+
import { fetchSchemaHashes, fetchStoredWasmSchema } from "./catalogue-api.js";
|
|
21
|
+
import { renderMigrationStub, UNFILLED_STUB_TODO } from "./migrations.js";
|
|
22
|
+
import { normalizeSchemaHashInput } from "./schema-utils.js";
|
|
23
|
+
import { legacySchemaHash } from "./legacy-schema-hash.js";
|
|
24
|
+
import { assertMigrationMatchesCanonicalBundle, computeSchemaHash, deployArtifacts, serializeForwardLenses, resolveKnownSchemaHash, schemaTransitionRequiresRowTransform, shortSchemaHash, } from "./catalogue.js";
|
|
25
|
+
import { combineMigrationGraphs, fetchMigrationGraph, } from "./migration-graph.js";
|
|
26
|
+
export { shortSchemaHash };
|
|
27
|
+
function emit(options, event) {
|
|
28
|
+
options.onEvent?.(event);
|
|
29
|
+
}
|
|
30
|
+
function ensurePermissionsProject(compiled) {
|
|
31
|
+
if (!compiled.permissions ||
|
|
32
|
+
compiled.permissionsFile !== join(compiled.rootDir, "permissions.ts")) {
|
|
33
|
+
throw new Error("Missing permissions.ts for this app. Create a permissions.ts file before validating or deploying.");
|
|
34
|
+
}
|
|
35
|
+
return compiled;
|
|
36
|
+
}
|
|
37
|
+
export async function validateProject(options) {
|
|
38
|
+
const compiled = ensurePermissionsProject(await loadCompiledSchema(options.schemaDir));
|
|
39
|
+
await validateSchemaAndPermissions(compiled.wasmSchema, compiled.permissions);
|
|
40
|
+
const migrationsDir = resolvedMigrationsDir(options.schemaDir, options.migrationsDir);
|
|
41
|
+
await refuseUnfilledStubs(migrationsDir);
|
|
42
|
+
// Legacy migrations go first: alpha.59 wrote them in a DSL this version
|
|
43
|
+
// no longer has, so loading them (as the check below does) would fail.
|
|
44
|
+
let retired = [];
|
|
45
|
+
if (options.check) {
|
|
46
|
+
await checkLegacyMigrations(migrationsDir, compiled.wasmSchema);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
retired = await retireLegacyMigrations(migrationsDir, compiled.wasmSchema);
|
|
50
|
+
}
|
|
51
|
+
await checkLocalMigrations(compiled.wasmSchema, migrationsDir);
|
|
52
|
+
const schema = await schemaSnapshotStatus(migrationsDir, compiled.wasmSchema);
|
|
53
|
+
if (!options.check)
|
|
54
|
+
await writeLocalClientMigrations(options.schemaDir, migrationsDir);
|
|
55
|
+
return {
|
|
56
|
+
schema,
|
|
57
|
+
schemaFile: compiled.schemaFile,
|
|
58
|
+
permissionsFile: compiled.permissionsFile,
|
|
59
|
+
tableCount: compiled.schema.tables.length,
|
|
60
|
+
warnings: [
|
|
61
|
+
...retired,
|
|
62
|
+
...collectConventionalProvenanceDiagnostics(compiled.schema),
|
|
63
|
+
...collectMissingExplicitPolicyDiagnostics(compiled.schema.tables.map((table) => table.name), compiled.permissions).map((diagnostic) => diagnostic.message),
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/** A line that gives `column` a step: `column: …` or `"column": …`. */
|
|
68
|
+
function stepKey(column) {
|
|
69
|
+
const name = column.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
70
|
+
return new RegExp(`^\\s*(?:${name}|"${name}"|'${name}')\\s*:`);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The lines after `lines[index]` up to the end of the block it sits in: the
|
|
74
|
+
* first later line indented less closes it. A stub's TODO sits in its
|
|
75
|
+
* table's `migrate` block, so this stops before the next table and before
|
|
76
|
+
* the `from`/`to` witnesses, which name every column.
|
|
77
|
+
*/
|
|
78
|
+
function tableBlockAfter(lines, index) {
|
|
79
|
+
const indent = (line) => line.length - line.trimStart().length;
|
|
80
|
+
const own = indent(lines[index]);
|
|
81
|
+
const block = [];
|
|
82
|
+
for (const line of lines.slice(index + 1)) {
|
|
83
|
+
if (line.trim() !== "" && indent(line) < own)
|
|
84
|
+
break;
|
|
85
|
+
block.push(line);
|
|
86
|
+
}
|
|
87
|
+
return block;
|
|
88
|
+
}
|
|
89
|
+
/** Refuse a migration file that still holds a step its stub left to fill in. */
|
|
90
|
+
async function refuseUnfilledStubs(migrationsDir) {
|
|
91
|
+
const files = await readdir(migrationsDir).catch(() => []);
|
|
92
|
+
const unfilled = [];
|
|
93
|
+
for (const file of files.filter((name) => name.endsWith(".ts")).sort()) {
|
|
94
|
+
const lines = (await readFile(join(migrationsDir, file), "utf8")).split("\n");
|
|
95
|
+
lines.forEach((line, index) => {
|
|
96
|
+
const todo = UNFILLED_STUB_TODO.exec(line);
|
|
97
|
+
// Authors often fill the step in under the comment and keep it, so
|
|
98
|
+
// only a column its table's block gives no step is unfilled.
|
|
99
|
+
if (todo && !tableBlockAfter(lines, index).some((later) => stepKey(todo[2]).test(later))) {
|
|
100
|
+
unfilled.push(` ${join(basename(migrationsDir), file)}:${index + 1}: ${todo[1]}`);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (unfilled.length === 0)
|
|
105
|
+
return;
|
|
106
|
+
throw new Error(`A migration still has steps to fill in, so it cannot deploy:\n${unfilled.join("\n")}\n` +
|
|
107
|
+
"Replace each TODO with its step (for example `points: m.add.int({ default: 1 })`).");
|
|
108
|
+
}
|
|
109
|
+
/** How `schema` relates to the committed snapshots in `migrationsDir`. */
|
|
110
|
+
async function schemaSnapshotStatus(migrationsDir, schema) {
|
|
111
|
+
const hash = await computeSchemaHash(schema);
|
|
112
|
+
const committed = (await new MigrationStorage(migrationsDir).listSnapshots()).filter((entry) => isCommittedSnapshotFileName(entry.fileName));
|
|
113
|
+
if (committed.some((entry) => entry.hash === hash))
|
|
114
|
+
return { hash, status: "snapshotted" };
|
|
115
|
+
return { hash, status: committed.length === 0 ? "unsnapshotted" : "changed" };
|
|
116
|
+
}
|
|
117
|
+
export async function compileSchema(options) {
|
|
118
|
+
const currentSchema = await loadCurrentSchema(options.schemaDir);
|
|
119
|
+
return {
|
|
120
|
+
...currentSchema,
|
|
121
|
+
snapshotPath: await ensureLocalSnapshot(options.schemaDir, options.migrationsDir, currentSchema),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
async function pathExists(path) {
|
|
125
|
+
try {
|
|
126
|
+
await access(path);
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Portable storage boundary for schema snapshots and migration publications.
|
|
135
|
+
*
|
|
136
|
+
* The project directory is trusted against mutation by another process running
|
|
137
|
+
* as the same OS user: such a process can already rewrite project source and is
|
|
138
|
+
* not an authorization boundary. Within that boundary we validate symlinks
|
|
139
|
+
* before every operation, fail closed when one is observed, serialize Jazz
|
|
140
|
+
* writers, and use atomic no-replace publication so concurrent Jazz commands
|
|
141
|
+
* never clobber an existing file.
|
|
142
|
+
*/
|
|
143
|
+
class MigrationStorage {
|
|
144
|
+
migrationsDir;
|
|
145
|
+
constructor(migrationsDir) {
|
|
146
|
+
this.migrationsDir = resolve(migrationsDir);
|
|
147
|
+
}
|
|
148
|
+
get snapshotsDir() {
|
|
149
|
+
return join(this.migrationsDir, "snapshots");
|
|
150
|
+
}
|
|
151
|
+
async initialize() {
|
|
152
|
+
await assertNoSymlinkComponents(this.migrationsDir, true);
|
|
153
|
+
await mkdir(this.migrationsDir, { recursive: true });
|
|
154
|
+
await assertNoSymlinkComponents(this.migrationsDir);
|
|
155
|
+
}
|
|
156
|
+
async listSnapshots() {
|
|
157
|
+
const dir = this.snapshotsDir;
|
|
158
|
+
if (!(await pathExists(dir))) {
|
|
159
|
+
return [];
|
|
160
|
+
}
|
|
161
|
+
// Snapshots determine both the logical timestamp and the implicit baseline.
|
|
162
|
+
// Do not let either decision follow a redirected committed snapshot path.
|
|
163
|
+
await assertNoSymlinkComponents(dir);
|
|
164
|
+
const files = await readdir(dir);
|
|
165
|
+
return (await Promise.all(files.map((fileName) => readSnapshotEntry(dir, fileName)))).filter((entry) => entry !== null);
|
|
166
|
+
}
|
|
167
|
+
async resolveSnapshot(hash, label) {
|
|
168
|
+
const entries = await this.listSnapshots();
|
|
169
|
+
if (entries.length === 0) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
const normalized = normalizeSchemaHashInput(hash, label);
|
|
173
|
+
if (normalized.length === 64) {
|
|
174
|
+
return entries.find((entry) => entry.hash === normalized) ?? null;
|
|
175
|
+
}
|
|
176
|
+
const matches = entries.filter((entry) => entry.hash.startsWith(normalized));
|
|
177
|
+
if (matches.length === 0) {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
if (matches.length > 1) {
|
|
181
|
+
throw new Error(`${label} prefix ${normalized} is ambiguous: ${matches
|
|
182
|
+
.map((entry) => shortSchemaHash(entry.hash))
|
|
183
|
+
.join(", ")}`);
|
|
184
|
+
}
|
|
185
|
+
return matches[0];
|
|
186
|
+
}
|
|
187
|
+
async writeSnapshot(fileName, schema) {
|
|
188
|
+
if (basename(fileName) !== fileName || !looksLikeSnapshotFileName(fileName)) {
|
|
189
|
+
throw new Error(`Invalid snapshot filename: ${fileName}`);
|
|
190
|
+
}
|
|
191
|
+
await assertNoSymlinkComponents(this.snapshotsDir, true);
|
|
192
|
+
await mkdir(this.snapshotsDir, { recursive: true });
|
|
193
|
+
await assertNoSymlinkComponents(this.snapshotsDir);
|
|
194
|
+
const filePath = join(this.snapshotsDir, fileName);
|
|
195
|
+
await assertNoSymlinkComponents(filePath, true);
|
|
196
|
+
const contents = `${JSON.stringify(schema, runtimeSchemaJsonReplacer, 2)}\n`;
|
|
197
|
+
try {
|
|
198
|
+
await syncFile(filePath, contents);
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
if (error.code !== "EEXIST")
|
|
202
|
+
throw error;
|
|
203
|
+
const identity = contentIdentity(contents);
|
|
204
|
+
await verifiedContents(filePath, identity.size, identity.sha256);
|
|
205
|
+
}
|
|
206
|
+
return filePath;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// Schema snapshots are named from their Unix-millisecond publication time.
|
|
210
|
+
function looksLikeSnapshotFileName(fileName) {
|
|
211
|
+
return /^(?:\d{8,17}T\d{6}-)?[0-9a-f]{12}\.json$/i.test(fileName);
|
|
212
|
+
}
|
|
213
|
+
async function readSnapshotEntry(dir, fileName) {
|
|
214
|
+
if (!looksLikeSnapshotFileName(fileName)) {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
const filePath = join(dir, fileName);
|
|
218
|
+
await assertNoSymlinkComponents(filePath);
|
|
219
|
+
const schema = JSON.parse(await readFile(filePath, "utf8"));
|
|
220
|
+
return {
|
|
221
|
+
hash: await computeSchemaHash(schema),
|
|
222
|
+
fileName,
|
|
223
|
+
filePath,
|
|
224
|
+
schema,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
function snapshotFilename(hash, timestamp = createTimestamp()) {
|
|
228
|
+
return `${timestamp}-${shortSchemaHash(hash)}.json`;
|
|
229
|
+
}
|
|
230
|
+
function createTimestamp(now = new Date()) {
|
|
231
|
+
const year = now.getUTCFullYear();
|
|
232
|
+
const month = String(now.getUTCMonth() + 1).padStart(2, "0");
|
|
233
|
+
const day = String(now.getUTCDate()).padStart(2, "0");
|
|
234
|
+
const hours = String(now.getUTCHours()).padStart(2, "0");
|
|
235
|
+
const minutes = String(now.getUTCMinutes()).padStart(2, "0");
|
|
236
|
+
const seconds = String(now.getUTCSeconds()).padStart(2, "0");
|
|
237
|
+
return `${year}${month}${day}T${hours}${minutes}${seconds}`;
|
|
238
|
+
}
|
|
239
|
+
function timestampDate(timestamp) {
|
|
240
|
+
const match = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})$/.exec(timestamp);
|
|
241
|
+
if (!match) {
|
|
242
|
+
throw new Error(`Invalid migration timestamp: ${timestamp}`);
|
|
243
|
+
}
|
|
244
|
+
return new Date(Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3]), Number(match[4]), Number(match[5]), Number(match[6])));
|
|
245
|
+
}
|
|
246
|
+
async function nextCommittedSnapshotTimestamp(storage, now = new Date()) {
|
|
247
|
+
const current = createTimestamp(now);
|
|
248
|
+
const latest = (await storage.listSnapshots())
|
|
249
|
+
.filter((entry) => isCommittedSnapshotFileName(entry.fileName))
|
|
250
|
+
.map((entry) => /^([0-9]{8}T[0-9]{6})-/.exec(entry.fileName)?.[1])
|
|
251
|
+
.filter((timestamp) => timestamp !== undefined)
|
|
252
|
+
.sort()
|
|
253
|
+
.at(-1);
|
|
254
|
+
if (!latest || current > latest) {
|
|
255
|
+
return current;
|
|
256
|
+
}
|
|
257
|
+
return createTimestamp(new Date(timestampDate(latest).getTime() + 1000));
|
|
258
|
+
}
|
|
259
|
+
function createSnapshotTimestampFromPublishedAt(publishedAt, fallbackNow = new Date()) {
|
|
260
|
+
if (typeof publishedAt !== "number" || !Number.isFinite(publishedAt) || publishedAt < 0) {
|
|
261
|
+
return createTimestamp(fallbackNow);
|
|
262
|
+
}
|
|
263
|
+
return createTimestamp(new Date(publishedAt));
|
|
264
|
+
}
|
|
265
|
+
function resolvedMigrationsDir(schemaDir, migrationsDir) {
|
|
266
|
+
return migrationsDir ?? join(schemaDir, "migrations");
|
|
267
|
+
}
|
|
268
|
+
async function listLocalSnapshotEntries(schemaDir, migrationsDir) {
|
|
269
|
+
const storage = new MigrationStorage(resolvedMigrationsDir(schemaDir, migrationsDir));
|
|
270
|
+
await storage.initialize();
|
|
271
|
+
return storage.listSnapshots();
|
|
272
|
+
}
|
|
273
|
+
async function writeSnapshotSchema(schemaDir, migrationsDir, hash, schema, timestamp = createTimestamp()) {
|
|
274
|
+
const storage = new MigrationStorage(resolvedMigrationsDir(schemaDir, migrationsDir));
|
|
275
|
+
await storage.initialize();
|
|
276
|
+
return storage.writeSnapshot(snapshotFilename(hash, timestamp), schema);
|
|
277
|
+
}
|
|
278
|
+
async function ensureLocalSnapshot(schemaDir, migrationsDir, schema) {
|
|
279
|
+
const entries = await listLocalSnapshotEntries(schemaDir, migrationsDir);
|
|
280
|
+
if (entries.some((entry) => entry.hash === schema.hash)) {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
return writeSnapshotSchema(schemaDir, migrationsDir, schema.hash, schema.schema);
|
|
284
|
+
}
|
|
285
|
+
export function requireServerValue(value, kind) {
|
|
286
|
+
if (value) {
|
|
287
|
+
return value;
|
|
288
|
+
}
|
|
289
|
+
if (kind === "serverUrl") {
|
|
290
|
+
throw new Error("Missing server URL. Pass --server-url <url> or set JAZZ_SERVER_URL (or a framework-prefixed form such as VITE_JAZZ_SERVER_URL).");
|
|
291
|
+
}
|
|
292
|
+
throw new Error("Missing admin secret. Pass --admin-secret <secret> or set JAZZ_ADMIN_SECRET.");
|
|
293
|
+
}
|
|
294
|
+
export function requireAppId(appId) {
|
|
295
|
+
if (appId) {
|
|
296
|
+
return appId;
|
|
297
|
+
}
|
|
298
|
+
throw new Error("Missing app ID. Pass an <appId> positional argument or set JAZZ_APP_ID (or a framework-prefixed form such as VITE_JAZZ_APP_ID).");
|
|
299
|
+
}
|
|
300
|
+
function normalizeMigrationName(name) {
|
|
301
|
+
const normalized = name
|
|
302
|
+
.trim()
|
|
303
|
+
.toLowerCase()
|
|
304
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
305
|
+
.replace(/^-+|-+$/g, "");
|
|
306
|
+
if (normalized.length === 0) {
|
|
307
|
+
throw new Error("Migration name must contain at least one ASCII letter or digit after normalization.");
|
|
308
|
+
}
|
|
309
|
+
return normalized;
|
|
310
|
+
}
|
|
311
|
+
function migrationFilename(migrationsDir, fromHash, toHash, name = "unnamed", timestamp = createTimestamp()) {
|
|
312
|
+
return join(migrationsDir, `${timestamp}-${name}-${shortSchemaHash(fromHash)}-${shortSchemaHash(toHash)}.ts`);
|
|
313
|
+
}
|
|
314
|
+
function isCommittedSnapshotFileName(fileName) {
|
|
315
|
+
return /^\d{8}T\d{6}-[0-9a-f]{12}\.json$/i.test(fileName);
|
|
316
|
+
}
|
|
317
|
+
async function loadLatestCommittedSnapshot(storage) {
|
|
318
|
+
const entries = await storage.listSnapshots();
|
|
319
|
+
const latest = entries
|
|
320
|
+
.filter((entry) => isCommittedSnapshotFileName(entry.fileName))
|
|
321
|
+
.sort((left, right) => left.fileName.localeCompare(right.fileName))
|
|
322
|
+
.at(-1);
|
|
323
|
+
if (!latest) {
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
return {
|
|
327
|
+
hash: latest.hash,
|
|
328
|
+
schema: latest.schema,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
const MIGRATION_STAGE_DIR = ".jazz-create-migration-stage";
|
|
332
|
+
const MIGRATION_JOURNAL = ".jazz-create-migration.journal.json";
|
|
333
|
+
function parseMigrationLockOwner(text) {
|
|
334
|
+
const value = JSON.parse(text);
|
|
335
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
336
|
+
throw new Error("owner is not an object");
|
|
337
|
+
}
|
|
338
|
+
const owner = value;
|
|
339
|
+
if (Object.keys(owner).sort().join(",") !== "hostname,pid,token,version" ||
|
|
340
|
+
owner.version !== 1 ||
|
|
341
|
+
!Number.isSafeInteger(owner.pid) ||
|
|
342
|
+
owner.pid <= 0 ||
|
|
343
|
+
typeof owner.hostname !== "string" ||
|
|
344
|
+
owner.hostname.length === 0 ||
|
|
345
|
+
typeof owner.token !== "string" ||
|
|
346
|
+
!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(owner.token)) {
|
|
347
|
+
throw new Error("owner has an invalid shape");
|
|
348
|
+
}
|
|
349
|
+
return owner;
|
|
350
|
+
}
|
|
351
|
+
function contentIdentity(contents) {
|
|
352
|
+
const bytes = Buffer.isBuffer(contents) ? contents : Buffer.from(contents);
|
|
353
|
+
return { size: bytes.byteLength, sha256: createHash("sha256").update(bytes).digest("hex") };
|
|
354
|
+
}
|
|
355
|
+
async function assertNoSymlinkComponents(path, allowMissingTail = false) {
|
|
356
|
+
const absolute = resolve(path);
|
|
357
|
+
const parsedRoot = parse(absolute).root;
|
|
358
|
+
const components = absolute.slice(parsedRoot.length).split(sep).filter(Boolean);
|
|
359
|
+
let current = parsedRoot;
|
|
360
|
+
for (const component of components) {
|
|
361
|
+
current = join(current, component);
|
|
362
|
+
try {
|
|
363
|
+
const stat = await lstat(current);
|
|
364
|
+
if (stat.isSymbolicLink()) {
|
|
365
|
+
throw new Error(`Migration path must not contain a symlink or junction: ${current}`);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
catch (error) {
|
|
369
|
+
if (error.code === "ENOENT" && allowMissingTail)
|
|
370
|
+
return;
|
|
371
|
+
throw error;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
async function verifiedContents(path, expectedSize, expectedSha256) {
|
|
376
|
+
await assertNoSymlinkComponents(path);
|
|
377
|
+
const contents = await readFile(path);
|
|
378
|
+
const actual = contentIdentity(contents);
|
|
379
|
+
if (actual.size !== expectedSize || actual.sha256 !== expectedSha256) {
|
|
380
|
+
throw new Error(`Migration publication content does not match its journal: ${path}`);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
async function publishStagedFileNoReplace(stagedPath, finalPath, expectedSize, expectedSha256) {
|
|
384
|
+
try {
|
|
385
|
+
// Portable atomic no-replace publication: a concurrent Jazz writer can
|
|
386
|
+
// create the destination first, but this operation never overwrites it.
|
|
387
|
+
await link(stagedPath, finalPath);
|
|
388
|
+
}
|
|
389
|
+
catch (error) {
|
|
390
|
+
if (error.code !== "EEXIST")
|
|
391
|
+
throw error;
|
|
392
|
+
// Recovery may observe its own already-published output. Only adopt it
|
|
393
|
+
// when it matches the fsynced journal identity exactly.
|
|
394
|
+
await verifiedContents(finalPath, expectedSize, expectedSha256);
|
|
395
|
+
}
|
|
396
|
+
await unlink(stagedPath);
|
|
397
|
+
}
|
|
398
|
+
function relativePublicationPath(migrationsDir, finalPath) {
|
|
399
|
+
const relativePath = relative(resolve(migrationsDir), resolve(finalPath));
|
|
400
|
+
if (!relativePath ||
|
|
401
|
+
relativePath === ".." ||
|
|
402
|
+
relativePath.startsWith(`..${sep}`) ||
|
|
403
|
+
isAbsolute(relativePath)) {
|
|
404
|
+
throw new Error(`Migration publication escaped its directory: ${finalPath}`);
|
|
405
|
+
}
|
|
406
|
+
return relativePath;
|
|
407
|
+
}
|
|
408
|
+
async function syncFile(path, contents) {
|
|
409
|
+
const handle = await open(path, "wx");
|
|
410
|
+
try {
|
|
411
|
+
await handle.writeFile(contents);
|
|
412
|
+
await handle.sync();
|
|
413
|
+
}
|
|
414
|
+
finally {
|
|
415
|
+
await handle.close();
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
async function syncDirectory(path) {
|
|
419
|
+
if (process.platform === "win32")
|
|
420
|
+
return;
|
|
421
|
+
const handle = await open(path, "r");
|
|
422
|
+
try {
|
|
423
|
+
await handle.sync();
|
|
424
|
+
}
|
|
425
|
+
finally {
|
|
426
|
+
await handle.close();
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
async function recoverMigrationPublication(storage) {
|
|
430
|
+
const migrationsDir = storage.migrationsDir;
|
|
431
|
+
await assertNoSymlinkComponents(migrationsDir);
|
|
432
|
+
const journalPath = join(migrationsDir, MIGRATION_JOURNAL);
|
|
433
|
+
if (!(await pathExists(journalPath))) {
|
|
434
|
+
const stageDir = join(migrationsDir, MIGRATION_STAGE_DIR);
|
|
435
|
+
await assertNoSymlinkComponents(stageDir, true);
|
|
436
|
+
await rm(stageDir, { recursive: true, force: true });
|
|
437
|
+
for (const entry of await readdir(migrationsDir)) {
|
|
438
|
+
if (entry.startsWith(`${MIGRATION_JOURNAL}.`) && entry.endsWith(".tmp")) {
|
|
439
|
+
await rm(join(migrationsDir, entry), { force: true });
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
await assertNoSymlinkComponents(journalPath);
|
|
445
|
+
const journal = JSON.parse(await readFile(journalPath, "utf8"));
|
|
446
|
+
if (journal.version !== 1 || !Array.isArray(journal.files) || journal.files.length === 0) {
|
|
447
|
+
throw new Error(`Invalid interrupted migration publication journal: ${journalPath}`);
|
|
448
|
+
}
|
|
449
|
+
for (const file of journal.files) {
|
|
450
|
+
if (basename(file.stagedName) !== file.stagedName) {
|
|
451
|
+
throw new Error(`Invalid staged migration filename in ${journalPath}`);
|
|
452
|
+
}
|
|
453
|
+
const stagedPath = join(migrationsDir, MIGRATION_STAGE_DIR, file.stagedName);
|
|
454
|
+
const finalPath = resolve(migrationsDir, file.finalRelativePath);
|
|
455
|
+
if (relativePublicationPath(migrationsDir, finalPath) !== file.finalRelativePath) {
|
|
456
|
+
throw new Error(`Invalid migration publication path in ${journalPath}`);
|
|
457
|
+
}
|
|
458
|
+
if (!Number.isSafeInteger(file.size) || file.size < 0 || !/^[0-9a-f]{64}$/.test(file.sha256)) {
|
|
459
|
+
throw new Error(`Invalid migration publication identity in ${journalPath}`);
|
|
460
|
+
}
|
|
461
|
+
await assertNoSymlinkComponents(dirname(finalPath), true);
|
|
462
|
+
await assertNoSymlinkComponents(finalPath, true);
|
|
463
|
+
await assertNoSymlinkComponents(stagedPath, true);
|
|
464
|
+
if (await pathExists(finalPath)) {
|
|
465
|
+
await verifiedContents(finalPath, file.size, file.sha256);
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
if (!(await pathExists(stagedPath))) {
|
|
469
|
+
throw new Error(`Cannot recover interrupted migration publication: missing ${stagedPath} and ${finalPath}`);
|
|
470
|
+
}
|
|
471
|
+
await mkdir(dirname(finalPath), { recursive: true });
|
|
472
|
+
await assertNoSymlinkComponents(dirname(finalPath));
|
|
473
|
+
await verifiedContents(stagedPath, file.size, file.sha256);
|
|
474
|
+
await publishStagedFileNoReplace(stagedPath, finalPath, file.size, file.sha256);
|
|
475
|
+
await verifiedContents(finalPath, file.size, file.sha256);
|
|
476
|
+
await syncDirectory(dirname(finalPath));
|
|
477
|
+
}
|
|
478
|
+
await rm(journalPath, { force: true });
|
|
479
|
+
await syncDirectory(migrationsDir);
|
|
480
|
+
await rm(join(migrationsDir, MIGRATION_STAGE_DIR), { recursive: true, force: true });
|
|
481
|
+
await syncDirectory(migrationsDir);
|
|
482
|
+
}
|
|
483
|
+
async function pauseMigrationPublicationForTest(phase) {
|
|
484
|
+
if (process.env.NODE_ENV !== "test" || process.env.JAZZ_TEST_MIGRATION_PAUSE_AT !== phase) {
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
const marker = process.env.JAZZ_TEST_MIGRATION_PAUSE_MARKER;
|
|
488
|
+
if (marker)
|
|
489
|
+
await writeFile(marker, phase);
|
|
490
|
+
const releaseMarker = process.env.JAZZ_TEST_MIGRATION_PAUSE_RELEASE_MARKER;
|
|
491
|
+
if (releaseMarker) {
|
|
492
|
+
while (!(await pathExists(releaseMarker))) {
|
|
493
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
494
|
+
}
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
await new Promise(() => {
|
|
498
|
+
setInterval(() => undefined, 1_000);
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
function failMigrationStepForTest(step) {
|
|
502
|
+
if (process.env.NODE_ENV !== "test" || process.env.JAZZ_TEST_MIGRATION_FAIL_AT !== step)
|
|
503
|
+
return;
|
|
504
|
+
throw Object.assign(new Error(`EBUSY: injected test failure at ${step}`), { code: "EBUSY" });
|
|
505
|
+
}
|
|
506
|
+
function migrationLockTimeoutMs() {
|
|
507
|
+
const override = Number(process.env.JAZZ_TEST_MIGRATION_LOCK_TIMEOUT_MS);
|
|
508
|
+
return process.env.NODE_ENV === "test" && Number.isSafeInteger(override) && override > 0
|
|
509
|
+
? override
|
|
510
|
+
: 10_000;
|
|
511
|
+
}
|
|
512
|
+
async function signalMigrationLockContentionForTest() {
|
|
513
|
+
if (process.env.NODE_ENV !== "test")
|
|
514
|
+
return;
|
|
515
|
+
const marker = process.env.JAZZ_TEST_MIGRATION_LOCK_CONTENTION_MARKER;
|
|
516
|
+
if (marker)
|
|
517
|
+
await writeFile(marker, "contended");
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Publish one logical migration generation. Multiple renames cannot be atomic,
|
|
521
|
+
* so a crash may briefly expose a prefix of the files. The fsynced journal is
|
|
522
|
+
* written first; every later invocation recovers that exact generation under
|
|
523
|
+
* the directory lock before inspecting baselines or allocating a timestamp.
|
|
524
|
+
*/
|
|
525
|
+
async function publishMigrationFilesRecoverably(storage, files) {
|
|
526
|
+
if (files.length === 0)
|
|
527
|
+
return;
|
|
528
|
+
const migrationsDir = storage.migrationsDir;
|
|
529
|
+
await assertNoSymlinkComponents(migrationsDir);
|
|
530
|
+
const stageDir = join(migrationsDir, MIGRATION_STAGE_DIR);
|
|
531
|
+
const journalPath = join(migrationsDir, MIGRATION_JOURNAL);
|
|
532
|
+
await assertNoSymlinkComponents(journalPath, true);
|
|
533
|
+
await mkdir(stageDir, { recursive: true });
|
|
534
|
+
await assertNoSymlinkComponents(stageDir);
|
|
535
|
+
const journal = { version: 1, files: [] };
|
|
536
|
+
for (const [index, file] of files.entries()) {
|
|
537
|
+
await assertNoSymlinkComponents(dirname(file.finalPath), true);
|
|
538
|
+
await assertNoSymlinkComponents(file.finalPath, true);
|
|
539
|
+
if (await pathExists(file.finalPath)) {
|
|
540
|
+
throw new Error(`Migration output already exists: ${file.finalPath}`);
|
|
541
|
+
}
|
|
542
|
+
const stagedName = `${randomUUID()}-${index}`;
|
|
543
|
+
const stagedPath = join(stageDir, stagedName);
|
|
544
|
+
await syncFile(stagedPath, file.contents);
|
|
545
|
+
const identity = contentIdentity(file.contents);
|
|
546
|
+
await verifiedContents(stagedPath, identity.size, identity.sha256);
|
|
547
|
+
journal.files.push({
|
|
548
|
+
stagedName,
|
|
549
|
+
finalRelativePath: relativePublicationPath(migrationsDir, file.finalPath),
|
|
550
|
+
...identity,
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
await syncDirectory(stageDir);
|
|
554
|
+
const journalTemp = `${journalPath}.${randomUUID()}.tmp`;
|
|
555
|
+
await syncFile(journalTemp, `${JSON.stringify(journal)}\n`);
|
|
556
|
+
await rename(journalTemp, journalPath);
|
|
557
|
+
await syncDirectory(migrationsDir);
|
|
558
|
+
await pauseMigrationPublicationForTest("journaled");
|
|
559
|
+
for (const [index, file] of journal.files.entries()) {
|
|
560
|
+
const finalPath = resolve(migrationsDir, file.finalRelativePath);
|
|
561
|
+
await assertNoSymlinkComponents(dirname(finalPath), true);
|
|
562
|
+
await mkdir(dirname(finalPath), { recursive: true });
|
|
563
|
+
await assertNoSymlinkComponents(dirname(finalPath));
|
|
564
|
+
const stagedPath = join(stageDir, file.stagedName);
|
|
565
|
+
await verifiedContents(stagedPath, file.size, file.sha256);
|
|
566
|
+
await publishStagedFileNoReplace(stagedPath, finalPath, file.size, file.sha256);
|
|
567
|
+
await verifiedContents(finalPath, file.size, file.sha256);
|
|
568
|
+
await syncDirectory(dirname(finalPath));
|
|
569
|
+
if (index === 0 && journal.files.length > 1) {
|
|
570
|
+
await pauseMigrationPublicationForTest("between-publications");
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
await rm(journalPath, { force: true });
|
|
574
|
+
await syncDirectory(migrationsDir);
|
|
575
|
+
await rm(stageDir, { recursive: true, force: true });
|
|
576
|
+
}
|
|
577
|
+
async function committedSnapshotPublication(storage, schema, timestamp) {
|
|
578
|
+
const entries = await storage.listSnapshots();
|
|
579
|
+
if (entries.some((entry) => entry.hash === schema.hash && isCommittedSnapshotFileName(entry.fileName))) {
|
|
580
|
+
return null;
|
|
581
|
+
}
|
|
582
|
+
return {
|
|
583
|
+
finalPath: join(storage.snapshotsDir, snapshotFilename(schema.hash, timestamp)),
|
|
584
|
+
contents: `${JSON.stringify(schema.schema, runtimeSchemaJsonReplacer, 2)}\n`,
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
async function loadCurrentSchema(schemaDir) {
|
|
588
|
+
const compiled = await loadCompiledSchema(schemaDir);
|
|
589
|
+
return {
|
|
590
|
+
hash: await computeSchemaHash(compiled.wasmSchema),
|
|
591
|
+
schema: compiled.wasmSchema,
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
async function resolveHistoricalSchemaForCreateMigration(storage, hash, label, appId, serverUrl, adminSecret) {
|
|
595
|
+
const local = await storage.resolveSnapshot(hash, label);
|
|
596
|
+
if (local) {
|
|
597
|
+
return { hash: local.hash, schema: local.schema };
|
|
598
|
+
}
|
|
599
|
+
return resolveRemoteHistoricalSchema(storage, hash, label, requireAppId(appId), requireServerValue(serverUrl, "serverUrl"), requireServerValue(adminSecret, "adminSecret"));
|
|
600
|
+
}
|
|
601
|
+
const NO_BASELINE = "No schema snapshot in migrations/snapshots to diff against. Run `jazz-tools migrations create` " +
|
|
602
|
+
"without --fromHash/--toHash on the schema.ts your backend runs to snapshot it as the first " +
|
|
603
|
+
"version. With Jazz Cloud (`remote()`), --server-url and --admin-secret use the schema of the " +
|
|
604
|
+
"app's latest bundle instead.";
|
|
605
|
+
async function loadMigrationBaseline(options, storage) {
|
|
606
|
+
const local = await loadLatestCommittedSnapshot(storage);
|
|
607
|
+
if (local)
|
|
608
|
+
return local;
|
|
609
|
+
if (!options.serverUrl) {
|
|
610
|
+
throw new Error(NO_BASELINE);
|
|
611
|
+
}
|
|
612
|
+
const appId = requireAppId(options.appId);
|
|
613
|
+
const adminSecret = requireServerValue(options.adminSecret, "adminSecret");
|
|
614
|
+
const graph = await fetchMigrationGraph({ appId, serverUrl: options.serverUrl, adminSecret });
|
|
615
|
+
if (!graph.latestBundleSchemaHash) {
|
|
616
|
+
throw new Error("No local schema snapshot or published bundle found. Deploy the initial schema before creating a migration. No snapshot was created.");
|
|
617
|
+
}
|
|
618
|
+
return resolveRemoteHistoricalSchema(storage, graph.latestBundleSchemaHash, "latest bundle's schema", appId, options.serverUrl, adminSecret);
|
|
619
|
+
}
|
|
620
|
+
async function createMigrationUnlocked(options, storage) {
|
|
621
|
+
const explicitHashFlow = Boolean(options.fromHash || options.toHash);
|
|
622
|
+
const currentSchema = !explicitHashFlow || !options.toHash ? await loadCurrentSchema(options.schemaDir) : null;
|
|
623
|
+
let fromSchema;
|
|
624
|
+
let toSchema;
|
|
625
|
+
let shouldWriteCommittedSnapshot = false;
|
|
626
|
+
if (explicitHashFlow) {
|
|
627
|
+
if (options.fromHash) {
|
|
628
|
+
fromSchema = await resolveHistoricalSchemaForCreateMigration(storage, options.fromHash, "fromHash", options.appId, options.serverUrl, options.adminSecret);
|
|
629
|
+
}
|
|
630
|
+
else {
|
|
631
|
+
fromSchema = await loadMigrationBaseline(options, storage);
|
|
632
|
+
}
|
|
633
|
+
toSchema = options.toHash
|
|
634
|
+
? await resolveHistoricalSchemaForCreateMigration(storage, options.toHash, "toHash", options.appId, options.serverUrl, options.adminSecret)
|
|
635
|
+
: currentSchema;
|
|
636
|
+
shouldWriteCommittedSnapshot = !options.toHash;
|
|
637
|
+
}
|
|
638
|
+
else {
|
|
639
|
+
if (!options.serverUrl && !(await loadLatestCommittedSnapshot(storage))) {
|
|
640
|
+
// The project's first snapshot: there is nothing to diff against yet.
|
|
641
|
+
const publication = await committedSnapshotPublication(storage, currentSchema, await nextCommittedSnapshotTimestamp(storage));
|
|
642
|
+
if (!publication)
|
|
643
|
+
throw new Error(NO_BASELINE);
|
|
644
|
+
await publishMigrationFilesRecoverably(storage, [publication]);
|
|
645
|
+
return {
|
|
646
|
+
status: "initial-snapshot",
|
|
647
|
+
hash: currentSchema.hash,
|
|
648
|
+
snapshotPath: publication.finalPath,
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
fromSchema = await loadMigrationBaseline(options, storage);
|
|
652
|
+
toSchema = currentSchema;
|
|
653
|
+
shouldWriteCommittedSnapshot = true;
|
|
654
|
+
}
|
|
655
|
+
// Snapshot filenames are the ordering source for the implicit migration
|
|
656
|
+
// baseline. Treat their second-resolution timestamp as a logical clock so
|
|
657
|
+
// rapid successive schema edits cannot let the hash suffix pick the winner.
|
|
658
|
+
const timestamp = await nextCommittedSnapshotTimestamp(storage);
|
|
659
|
+
if (fromSchema.hash === toSchema.hash) {
|
|
660
|
+
return { status: "unchanged" };
|
|
661
|
+
}
|
|
662
|
+
if (!schemaTransitionRequiresRowTransform(fromSchema.schema, toSchema.schema)) {
|
|
663
|
+
const snapshot = shouldWriteCommittedSnapshot
|
|
664
|
+
? await committedSnapshotPublication(storage, toSchema, timestamp)
|
|
665
|
+
: null;
|
|
666
|
+
if (snapshot)
|
|
667
|
+
await publishMigrationFilesRecoverably(storage, [snapshot]);
|
|
668
|
+
return {
|
|
669
|
+
status: "migration-not-required",
|
|
670
|
+
fromHash: fromSchema.hash,
|
|
671
|
+
toHash: toSchema.hash,
|
|
672
|
+
snapshotPath: snapshot?.finalPath ?? null,
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
const filePath = migrationFilename(options.migrationsDir, fromSchema.hash, toSchema.hash, options.name ? normalizeMigrationName(options.name) : undefined, timestamp);
|
|
676
|
+
const stub = renderMigrationStub({
|
|
677
|
+
fromHash: fromSchema.hash,
|
|
678
|
+
toHash: toSchema.hash,
|
|
679
|
+
fromSchema: fromSchema.schema,
|
|
680
|
+
toSchema: toSchema.schema,
|
|
681
|
+
});
|
|
682
|
+
const snapshot = shouldWriteCommittedSnapshot
|
|
683
|
+
? await committedSnapshotPublication(storage, toSchema, timestamp)
|
|
684
|
+
: null;
|
|
685
|
+
await publishMigrationFilesRecoverably(storage, [
|
|
686
|
+
{ finalPath: filePath, contents: stub },
|
|
687
|
+
...(snapshot ? [snapshot] : []),
|
|
688
|
+
]);
|
|
689
|
+
return {
|
|
690
|
+
status: "generated",
|
|
691
|
+
filePath,
|
|
692
|
+
fromHash: fromSchema.hash,
|
|
693
|
+
toHash: toSchema.hash,
|
|
694
|
+
needsRename: !options.name,
|
|
695
|
+
snapshotPath: snapshot?.finalPath ?? null,
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
const MIGRATION_LOCK_OWNER_RECORD = /^owner-([0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})\.json$/i;
|
|
699
|
+
function migrationLockOwnerRecordName(token) {
|
|
700
|
+
return `owner-${token}.json`;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Serialize migration generation across processes.
|
|
704
|
+
*
|
|
705
|
+
* `mkdir(lockDir)` is the no-replace compare-and-set that acquires the lock.
|
|
706
|
+
* Each lock instance holds exactly one owner record whose file name carries
|
|
707
|
+
* that instance's random token, so a path to the record identifies one lock
|
|
708
|
+
* instance, not whichever lock currently sits at `lockDir`. Release and
|
|
709
|
+
* stale-lock recovery both start by removing that token-named record, which
|
|
710
|
+
* fails with ENOENT if the instance they mean is already gone, so neither can
|
|
711
|
+
* ever remove a lock that another generator acquired later. An ownerless lock
|
|
712
|
+
* directory is never removed by anyone else, so the following rmdir is safe.
|
|
713
|
+
*/
|
|
714
|
+
async function withMigrationDirectoryLock(storage, operation) {
|
|
715
|
+
const migrationsDir = storage.migrationsDir;
|
|
716
|
+
await assertNoSymlinkComponents(migrationsDir);
|
|
717
|
+
const lockDir = join(migrationsDir, ".jazz-create-migration.lock");
|
|
718
|
+
const owner = {
|
|
719
|
+
version: 1,
|
|
720
|
+
pid: process.pid,
|
|
721
|
+
hostname: hostname(),
|
|
722
|
+
token: randomUUID(),
|
|
723
|
+
};
|
|
724
|
+
const ownerPath = join(lockDir, migrationLockOwnerRecordName(owner.token));
|
|
725
|
+
const deadline = Date.now() + migrationLockTimeoutMs();
|
|
726
|
+
const staleLockHint = `If no \`jazz-tools migrations create\` is running for this directory, delete ${lockDir} and retry.`;
|
|
727
|
+
let unknownOwnerSince = null;
|
|
728
|
+
for (;;) {
|
|
729
|
+
try {
|
|
730
|
+
// mkdir is the no-replace cross-process compare-and-set. A process that
|
|
731
|
+
// observes the short owner-write window fails closed rather than ever
|
|
732
|
+
// treating an unknown lock as stale.
|
|
733
|
+
await mkdir(lockDir);
|
|
734
|
+
await syncFile(ownerPath, `${JSON.stringify(owner)}\n`);
|
|
735
|
+
await syncDirectory(lockDir);
|
|
736
|
+
await syncDirectory(migrationsDir);
|
|
737
|
+
await pauseMigrationPublicationForTest("lock-held");
|
|
738
|
+
break;
|
|
739
|
+
}
|
|
740
|
+
catch (error) {
|
|
741
|
+
const code = error.code;
|
|
742
|
+
if (code !== "EEXIST")
|
|
743
|
+
throw error;
|
|
744
|
+
try {
|
|
745
|
+
await assertNoSymlinkComponents(lockDir);
|
|
746
|
+
}
|
|
747
|
+
catch (validationError) {
|
|
748
|
+
if (validationError.code === "ENOENT")
|
|
749
|
+
continue;
|
|
750
|
+
throw validationError;
|
|
751
|
+
}
|
|
752
|
+
let existing;
|
|
753
|
+
let existingPath;
|
|
754
|
+
let legacyOwner = false;
|
|
755
|
+
try {
|
|
756
|
+
const entries = await readdir(lockDir);
|
|
757
|
+
legacyOwner = entries.includes("owner.json");
|
|
758
|
+
const [record, ...extra] = entries;
|
|
759
|
+
const recordToken = record ? MIGRATION_LOCK_OWNER_RECORD.exec(record)?.[1] : undefined;
|
|
760
|
+
if (!record || !recordToken || extra.length > 0) {
|
|
761
|
+
throw new Error("expected exactly one owner record");
|
|
762
|
+
}
|
|
763
|
+
existingPath = join(lockDir, record);
|
|
764
|
+
await assertNoSymlinkComponents(existingPath);
|
|
765
|
+
existing = parseMigrationLockOwner(await readFile(existingPath, "utf8"));
|
|
766
|
+
if (existing.token !== recordToken) {
|
|
767
|
+
throw new Error("owner record name does not match its token");
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
catch {
|
|
771
|
+
if (!(await pathExists(lockDir)))
|
|
772
|
+
continue;
|
|
773
|
+
unknownOwnerSince ??= Date.now();
|
|
774
|
+
// A freshly created lock has a necessarily brief mkdir→owner-write
|
|
775
|
+
// window. Wait for that owner, but never steal the lock if it remains
|
|
776
|
+
// unknown: fail closed with the directory intact.
|
|
777
|
+
if (Date.now() - unknownOwnerSince >= 500) {
|
|
778
|
+
const legacy = legacyOwner
|
|
779
|
+
? " (it holds an owner.json left by an older jazz-tools, which is never recovered automatically)"
|
|
780
|
+
: "";
|
|
781
|
+
throw new Error(`Cannot safely acquire migration lock ${lockDir}; owner metadata is missing, invalid, or unsafe${legacy}. ${staleLockHint}`);
|
|
782
|
+
}
|
|
783
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
784
|
+
continue;
|
|
785
|
+
}
|
|
786
|
+
unknownOwnerSince = null;
|
|
787
|
+
await signalMigrationLockContentionForTest();
|
|
788
|
+
await pauseMigrationPublicationForTest("lock-observed");
|
|
789
|
+
if (existing.hostname === hostname() && !processIsAlive(existing.pid)) {
|
|
790
|
+
// The lock we observed may have been released and replaced by a live
|
|
791
|
+
// generator since we read it. Claim the observed instance by its
|
|
792
|
+
// token-named record, never by the shared lock path: if that instance
|
|
793
|
+
// is gone, this rename fails and we re-inspect whatever is there now.
|
|
794
|
+
const claimed = `${lockDir}.recovery-${owner.token}.json`;
|
|
795
|
+
try {
|
|
796
|
+
await rename(existingPath, claimed);
|
|
797
|
+
}
|
|
798
|
+
catch (claimError) {
|
|
799
|
+
if (claimError.code === "ENOENT")
|
|
800
|
+
continue;
|
|
801
|
+
throw claimError;
|
|
802
|
+
}
|
|
803
|
+
// The claimed instance is now ownerless. Its owner is dead and every
|
|
804
|
+
// other recoverer's claim fails with ENOENT, so nobody else can remove
|
|
805
|
+
// it and no generator can mkdir over it: lockDir is still exactly the
|
|
806
|
+
// instance we observed, and it is empty.
|
|
807
|
+
try {
|
|
808
|
+
await rmdir(lockDir);
|
|
809
|
+
}
|
|
810
|
+
catch (removeError) {
|
|
811
|
+
// Something unexpected is inside the lock; hand the record back so
|
|
812
|
+
// the lock stays attributable and fails closed rather than ownerless.
|
|
813
|
+
await rename(claimed, existingPath).catch(() => undefined);
|
|
814
|
+
throw removeError;
|
|
815
|
+
}
|
|
816
|
+
await syncDirectory(migrationsDir);
|
|
817
|
+
await pauseMigrationPublicationForTest("lock-recovered");
|
|
818
|
+
await rm(claimed, { force: true });
|
|
819
|
+
continue;
|
|
820
|
+
}
|
|
821
|
+
if (Date.now() >= deadline) {
|
|
822
|
+
throw new Error(`Timed out waiting for another migration generator to release ${lockDir}; it is held by pid ${existing.pid} on host ${existing.hostname}. ${staleLockHint}`);
|
|
823
|
+
}
|
|
824
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
try {
|
|
828
|
+
await recoverMigrationPublication(storage);
|
|
829
|
+
return await operation();
|
|
830
|
+
}
|
|
831
|
+
finally {
|
|
832
|
+
await releaseMigrationDirectoryLock(lockDir, ownerPath, owner.token);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Release our lock instance the same way recovery claims a stale one: move our
|
|
837
|
+
* token-named record out first, so the directory becomes an ownerless lock that
|
|
838
|
+
* nobody else removes and the rmdir can only hit our own instance. If the
|
|
839
|
+
* rmdir fails (for example EBUSY from a Windows virus scanner), put the record
|
|
840
|
+
* back: the lock then stays attributed to our pid, which is dead once we exit,
|
|
841
|
+
* so the next run recovers it instead of failing closed on an ownerless lock.
|
|
842
|
+
*/
|
|
843
|
+
async function releaseMigrationDirectoryLock(lockDir, ownerPath, token) {
|
|
844
|
+
const released = `${lockDir}.released-${token}.json`;
|
|
845
|
+
try {
|
|
846
|
+
await rename(ownerPath, released);
|
|
847
|
+
}
|
|
848
|
+
catch {
|
|
849
|
+
// Our record is already gone, so this instance is no longer ours to remove.
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
try {
|
|
853
|
+
failMigrationStepForTest("release-rmdir");
|
|
854
|
+
await rmdir(lockDir);
|
|
855
|
+
}
|
|
856
|
+
catch (error) {
|
|
857
|
+
await rename(released, ownerPath).catch(() => undefined);
|
|
858
|
+
console.warn(`Could not remove migration lock ${lockDir} (${error.code ?? error}); the next run will recover it.`);
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
await unlink(released).catch(() => undefined);
|
|
862
|
+
await syncDirectory(dirname(lockDir));
|
|
863
|
+
}
|
|
864
|
+
function processIsAlive(pid) {
|
|
865
|
+
try {
|
|
866
|
+
process.kill(pid, 0);
|
|
867
|
+
return true;
|
|
868
|
+
}
|
|
869
|
+
catch (error) {
|
|
870
|
+
return error.code !== "ESRCH";
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
export async function createMigration(options) {
|
|
874
|
+
const storage = new MigrationStorage(options.migrationsDir);
|
|
875
|
+
await storage.initialize();
|
|
876
|
+
const result = await withMigrationDirectoryLock(storage, async () => createMigrationUnlocked(options, storage));
|
|
877
|
+
// The app ships migrations/index.ts: what this wrote belongs in it now,
|
|
878
|
+
// not only after the next `validate`.
|
|
879
|
+
if (result.status !== "unchanged" && (await hasRootSchema(options.schemaDir))) {
|
|
880
|
+
await writeLocalClientMigrations(options.schemaDir, options.migrationsDir);
|
|
881
|
+
}
|
|
882
|
+
return result;
|
|
883
|
+
}
|
|
884
|
+
function isDefinedMigration(value) {
|
|
885
|
+
if (typeof value !== "object" || value === null) {
|
|
886
|
+
return false;
|
|
887
|
+
}
|
|
888
|
+
const candidate = value;
|
|
889
|
+
return ((candidate.fromHash === undefined || typeof candidate.fromHash === "string") &&
|
|
890
|
+
(candidate.toHash === undefined || typeof candidate.toHash === "string") &&
|
|
891
|
+
typeof candidate.from === "object" &&
|
|
892
|
+
candidate.from !== null &&
|
|
893
|
+
typeof candidate.to === "object" &&
|
|
894
|
+
candidate.to !== null &&
|
|
895
|
+
Array.isArray(candidate.forward));
|
|
896
|
+
}
|
|
897
|
+
async function bundleToPrivateTempFile(filePath) {
|
|
898
|
+
// A migration is executable local source. Keep the same project-storage
|
|
899
|
+
// boundary as snapshots and publication journals: do not follow a replaced
|
|
900
|
+
// migration entry while preparing the private bundle.
|
|
901
|
+
await assertNoSymlinkComponents(filePath);
|
|
902
|
+
const sourceDir = dirname(resolve(filePath));
|
|
903
|
+
const tempDir = await mkdtemp(join(sourceDir, ".jazz-bundle-"));
|
|
904
|
+
const outFile = join(tempDir, "migration.mjs");
|
|
905
|
+
try {
|
|
906
|
+
await build({
|
|
907
|
+
entryPoints: [resolve(filePath)],
|
|
908
|
+
bundle: true,
|
|
909
|
+
format: "esm",
|
|
910
|
+
platform: "node",
|
|
911
|
+
outfile: outFile,
|
|
912
|
+
packages: "external",
|
|
913
|
+
});
|
|
914
|
+
return { outFile, tempDir };
|
|
915
|
+
}
|
|
916
|
+
catch (error) {
|
|
917
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
918
|
+
throw error;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
// Migration builders that moved from `schema` (or the removed `col` export) to `migration`.
|
|
922
|
+
const LEGACY_MIGRATION_DSL_PATTERN = /\b(?:s|schema|col)\.(?:add|drop|renameFrom|defineMigration|renameTableFrom)\b|\bimport\s*\{[^}]*\bcol\b[^}]*\}\s*from\s*["']jazz-tools["']/;
|
|
923
|
+
export async function loadDefinedMigration(filePath) {
|
|
924
|
+
const { outFile, tempDir } = await bundleToPrivateTempFile(filePath);
|
|
925
|
+
try {
|
|
926
|
+
let loaded;
|
|
927
|
+
try {
|
|
928
|
+
loaded = await import(pathToFileURL(outFile).href);
|
|
929
|
+
}
|
|
930
|
+
catch (error) {
|
|
931
|
+
const source = await readFile(filePath, "utf8");
|
|
932
|
+
const hint = LEGACY_MIGRATION_DSL_PATTERN.test(source)
|
|
933
|
+
? " The migration DSL moved to `migration as m` from jazz-tools: use m.defineMigration, m.add, m.drop, m.renameFrom and m.renameTableFrom, and s.* for schema columns."
|
|
934
|
+
: "";
|
|
935
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
936
|
+
throw new Error(`Failed to load migration ${basename(filePath)}: ${reason}.${hint}`, {
|
|
937
|
+
cause: error,
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
const migration = unwrapMigrationExport(loaded.default ?? loaded.migration);
|
|
941
|
+
if (!isDefinedMigration(migration)) {
|
|
942
|
+
throw new Error(`Invalid migration export in ${basename(filePath)}. Export default defineMigration(...).`);
|
|
943
|
+
}
|
|
944
|
+
return migration;
|
|
945
|
+
}
|
|
946
|
+
finally {
|
|
947
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
function unwrapMigrationExport(value) {
|
|
951
|
+
let current = value;
|
|
952
|
+
while (typeof current === "object" &&
|
|
953
|
+
current !== null &&
|
|
954
|
+
"default" in current &&
|
|
955
|
+
Object.keys(current).length === 1) {
|
|
956
|
+
current = current.default;
|
|
957
|
+
}
|
|
958
|
+
return current;
|
|
959
|
+
}
|
|
960
|
+
async function resolveRemoteHistoricalSchema(storage, hash, label, appId, serverUrl, adminSecret) {
|
|
961
|
+
const normalized = normalizeSchemaHashInput(hash, label);
|
|
962
|
+
const resolvedHash = normalized.length === 64
|
|
963
|
+
? normalized
|
|
964
|
+
: resolveKnownSchemaHash(normalized, label, (await fetchSchemaHashes(serverUrl, { appId, adminSecret })).hashes);
|
|
965
|
+
try {
|
|
966
|
+
const storedSchema = await fetchStoredWasmSchema(serverUrl, {
|
|
967
|
+
appId,
|
|
968
|
+
adminSecret,
|
|
969
|
+
schemaHash: resolvedHash,
|
|
970
|
+
});
|
|
971
|
+
await storage.writeSnapshot(snapshotFilename(resolvedHash, createSnapshotTimestampFromPublishedAt(storedSchema.publishedAt)), storedSchema.schema);
|
|
972
|
+
return { hash: resolvedHash, schema: storedSchema.schema };
|
|
973
|
+
}
|
|
974
|
+
catch (error) {
|
|
975
|
+
if (error instanceof Error && /Schema fetch failed: 404/i.test(error.message)) {
|
|
976
|
+
throw new Error(`No stored schema found for ${label} ${resolvedHash}.`);
|
|
977
|
+
}
|
|
978
|
+
throw error;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
function migrationHashesFromFileName(fileName) {
|
|
982
|
+
const match = fileName.match(/-([0-9a-f]{12,64})-([0-9a-f]{12,64})\.ts$/i);
|
|
983
|
+
if (!match) {
|
|
984
|
+
throw new Error(`Migration filename ${fileName} must end in -<fromHash>-<toHash>.ts using at least 12 hex characters per hash.`);
|
|
985
|
+
}
|
|
986
|
+
return { from: match[1], to: match[2] };
|
|
987
|
+
}
|
|
988
|
+
/** Load and compare local and server history without publishing any artifacts. */
|
|
989
|
+
export async function getMigrationGraph(options) {
|
|
990
|
+
const server = await fetchMigrationGraph(options);
|
|
991
|
+
const local = await loadLocalMigrationGraph(options.schemaDir, resolvedMigrationsDir(options.schemaDir, options.migrationsDir), server.schemas);
|
|
992
|
+
return combineMigrationGraphs(server, local);
|
|
993
|
+
}
|
|
994
|
+
/** Read local history without creating snapshots, migrations, or their directories. */
|
|
995
|
+
async function loadLocalMigrationGraph(schemaDir, migrationsDir, serverSchemaHashes) {
|
|
996
|
+
const snapshots = await new MigrationStorage(migrationsDir).listSnapshots();
|
|
997
|
+
const current = (await hasRootSchema(schemaDir)) ? await loadCurrentSchema(schemaDir) : null;
|
|
998
|
+
const schemas = [
|
|
999
|
+
...new Set([...snapshots.map(({ hash }) => hash), ...(current ? [current.hash] : [])]),
|
|
1000
|
+
];
|
|
1001
|
+
const knownHashes = [...new Set([...serverSchemaHashes, ...schemas])];
|
|
1002
|
+
const migrations = [];
|
|
1003
|
+
if (await pathExists(migrationsDir)) {
|
|
1004
|
+
await assertNoSymlinkComponents(migrationsDir);
|
|
1005
|
+
for (const fileName of (await readdir(migrationsDir)).filter(isMigrationFile).sort()) {
|
|
1006
|
+
const migration = await loadDefinedMigration(join(migrationsDir, fileName));
|
|
1007
|
+
if (!migration.fromHash || !migration.toHash) {
|
|
1008
|
+
throw new Error(`Migration ${fileName} must embed fromHash and toHash metadata; regenerate it to include it in the graph.`);
|
|
1009
|
+
}
|
|
1010
|
+
const resolveHash = (hash, label) => {
|
|
1011
|
+
try {
|
|
1012
|
+
return resolveKnownSchemaHash(hash, label, knownHashes);
|
|
1013
|
+
}
|
|
1014
|
+
catch (error) {
|
|
1015
|
+
throw new Error(`Cannot resolve ${label} in ${fileName} against local snapshots, schema.ts, or server schemas: ${error.message}`);
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
const fromHash = resolveHash(migration.fromHash, "fromHash");
|
|
1019
|
+
const toHash = resolveHash(migration.toHash, "toHash");
|
|
1020
|
+
const named = migrationHashesFromFileName(fileName);
|
|
1021
|
+
if (resolveHash(named.from, "filename fromHash") !== fromHash ||
|
|
1022
|
+
resolveHash(named.to, "filename toHash") !== toHash) {
|
|
1023
|
+
throw new Error(`Migration filename ${fileName} does not match its embedded schema hashes.`);
|
|
1024
|
+
}
|
|
1025
|
+
migrations.push({ fromHash, toHash });
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
return { schemas, migrations, currentSchemaHash: current?.hash ?? null };
|
|
1029
|
+
}
|
|
1030
|
+
/** Publish all missing local history and schema.ts with its permissions as a bundle. */
|
|
1031
|
+
export async function deploy(options) {
|
|
1032
|
+
const migrationsDir = resolvedMigrationsDir(options.schemaDir, options.migrationsDir);
|
|
1033
|
+
if ("noVerify" in options)
|
|
1034
|
+
throw new Error("noVerify is no longer supported; deploy requires a complete migration path.");
|
|
1035
|
+
const compiled = ensurePermissionsProject(await loadCompiledSchema(options.schemaDir));
|
|
1036
|
+
await validateSchemaAndPermissions(compiled.wasmSchema, compiled.permissions);
|
|
1037
|
+
emit(options, { type: "schema-loaded", schemaFile: compiled.schemaFile });
|
|
1038
|
+
emit(options, { type: "permissions-loaded", permissionsFile: compiled.permissionsFile });
|
|
1039
|
+
const toHash = await computeSchemaHash(compiled.wasmSchema);
|
|
1040
|
+
await assertNoLegacyMigrations(migrationsDir, compiled.wasmSchema);
|
|
1041
|
+
const graph = await fetchMigrationGraph(options);
|
|
1042
|
+
if (await pathExists(migrationsDir))
|
|
1043
|
+
await assertNoSymlinkComponents(migrationsDir);
|
|
1044
|
+
const files = ((await pathExists(migrationsDir)) ? await readdir(migrationsDir) : [])
|
|
1045
|
+
.filter(isMigrationFile)
|
|
1046
|
+
.sort();
|
|
1047
|
+
const snapshots = await new MigrationStorage(migrationsDir).listSnapshots();
|
|
1048
|
+
const knownHashes = [
|
|
1049
|
+
...new Set([...graph.schemas, ...snapshots.map(({ hash }) => hash), toHash]),
|
|
1050
|
+
];
|
|
1051
|
+
const canonicalSchemas = new Map(snapshots.map(({ hash, schema }) => [hash, Promise.resolve(schema)]));
|
|
1052
|
+
canonicalSchemas.set(toHash, Promise.resolve(compiled.wasmSchema));
|
|
1053
|
+
const loadCanonicalSchema = (hash) => {
|
|
1054
|
+
const cached = canonicalSchemas.get(hash);
|
|
1055
|
+
if (cached)
|
|
1056
|
+
return cached;
|
|
1057
|
+
const loading = fetchStoredWasmSchema(options.serverUrl, {
|
|
1058
|
+
appId: options.appId,
|
|
1059
|
+
adminSecret: options.adminSecret,
|
|
1060
|
+
schemaHash: hash,
|
|
1061
|
+
}).then((storedSchema) => storedSchema.schema);
|
|
1062
|
+
canonicalSchemas.set(hash, loading);
|
|
1063
|
+
return loading;
|
|
1064
|
+
};
|
|
1065
|
+
const edges = await Promise.all(files.map(async (fileName) => {
|
|
1066
|
+
const filePath = join(migrationsDir, fileName);
|
|
1067
|
+
const migration = await loadDefinedMigration(filePath);
|
|
1068
|
+
if (migration.fromHash === undefined || migration.toHash === undefined) {
|
|
1069
|
+
throw new Error(`Migration ${fileName} must embed fromHash and toHash metadata; regenerate the migration before deployment.`);
|
|
1070
|
+
}
|
|
1071
|
+
const fromHash = resolveKnownSchemaHash(migration.fromHash, `embedded fromHash in ${fileName}`, knownHashes);
|
|
1072
|
+
const toHash = resolveKnownSchemaHash(migration.toHash, `embedded toHash in ${fileName}`, knownHashes);
|
|
1073
|
+
const named = migrationHashesFromFileName(fileName);
|
|
1074
|
+
const namedFromHash = resolveKnownSchemaHash(named.from, `fromHash in ${fileName}`, knownHashes);
|
|
1075
|
+
const namedToHash = resolveKnownSchemaHash(named.to, `toHash in ${fileName}`, knownHashes);
|
|
1076
|
+
if (namedFromHash !== fromHash || namedToHash !== toHash) {
|
|
1077
|
+
throw new Error(`Migration filename ${fileName} does not match its embedded ${shortSchemaHash(fromHash)} -> ${shortSchemaHash(toHash)} edge.`);
|
|
1078
|
+
}
|
|
1079
|
+
const [fromSchema, toSchema] = await Promise.all([
|
|
1080
|
+
loadCanonicalSchema(fromHash),
|
|
1081
|
+
loadCanonicalSchema(toHash),
|
|
1082
|
+
]);
|
|
1083
|
+
assertMigrationMatchesCanonicalBundle(migration, {
|
|
1084
|
+
fromHash,
|
|
1085
|
+
toHash,
|
|
1086
|
+
fromSchema,
|
|
1087
|
+
toSchema,
|
|
1088
|
+
});
|
|
1089
|
+
return { migration, filePath, fromHash, toHash };
|
|
1090
|
+
}));
|
|
1091
|
+
const schemas = new Map(snapshots.map(({ hash, schema }) => [hash, schema]));
|
|
1092
|
+
schemas.set(toHash, compiled.wasmSchema);
|
|
1093
|
+
const result = await deployArtifacts(options, graph, {
|
|
1094
|
+
targetSchemaHash: toHash,
|
|
1095
|
+
schemas: [...schemas].map(([hash, schema]) => ({
|
|
1096
|
+
hash,
|
|
1097
|
+
schema: mergePermissionsIntoWasmSchema(schema, {}),
|
|
1098
|
+
})),
|
|
1099
|
+
migrations: edges.map((edge) => ({
|
|
1100
|
+
fromHash: edge.fromHash,
|
|
1101
|
+
toHash: edge.toHash,
|
|
1102
|
+
forward: serializeForwardLenses(edge.migration.forward),
|
|
1103
|
+
})),
|
|
1104
|
+
permissions: compiled.permissions,
|
|
1105
|
+
});
|
|
1106
|
+
for (const warning of result.warnings)
|
|
1107
|
+
emit(options, { type: "warning", message: warning });
|
|
1108
|
+
for (const hash of result.published.schemas)
|
|
1109
|
+
emit(options, { type: "schema-published", hash });
|
|
1110
|
+
if (result.schema.status === "already-stored")
|
|
1111
|
+
emit(options, { type: "schema-skipped", hash: toHash, reason: "already-stored" });
|
|
1112
|
+
const storedEdges = new Set(graph.migrations.map(({ fromHash, toHash }) => `${fromHash}:${toHash}`));
|
|
1113
|
+
for (const { fromHash, toHash } of edges) {
|
|
1114
|
+
if (storedEdges.has(`${fromHash}:${toHash}`)) {
|
|
1115
|
+
emit(options, { type: "migration-skipped", reason: "already-connected", fromHash, toHash });
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
for (const migration of result.published.migrations) {
|
|
1119
|
+
emit(options, {
|
|
1120
|
+
type: "migration-published",
|
|
1121
|
+
...migration,
|
|
1122
|
+
filePath: edges.find((edge) => edge.fromHash === migration.fromHash && edge.toHash === migration.toHash)?.filePath,
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
if (result.changed)
|
|
1126
|
+
emit(options, { type: "permissions-published", schemaHash: toHash });
|
|
1127
|
+
// Clients ship what the server now holds, so they store each column where
|
|
1128
|
+
// it does, even before their first sync (see ClientMigrations).
|
|
1129
|
+
const bundled = new Map();
|
|
1130
|
+
for (const hash of [
|
|
1131
|
+
...schemas.keys(),
|
|
1132
|
+
...edges.flatMap((edge) => [edge.fromHash, edge.toHash]),
|
|
1133
|
+
]) {
|
|
1134
|
+
if (!bundled.has(hash))
|
|
1135
|
+
bundled.set(hash, await loadCanonicalSchema(hash));
|
|
1136
|
+
}
|
|
1137
|
+
await writeClientMigrations(compiled.schemaFile, bundled, edges);
|
|
1138
|
+
return { ...result, schema: { ...result.schema, schemaFile: compiled.schemaFile } };
|
|
1139
|
+
}
|
|
1140
|
+
/**
|
|
1141
|
+
* The module an app imports its `migrations` from, in the `migrations`
|
|
1142
|
+
* directory beside schema.ts. `jazz-tools` writes it on every validate,
|
|
1143
|
+
* deploy and migration, so it exists even while an app has a single schema
|
|
1144
|
+
* version.
|
|
1145
|
+
*/
|
|
1146
|
+
export const CLIENT_MIGRATIONS_FILE = CLIENT_MIGRATIONS_MODULE;
|
|
1147
|
+
/** A migration file in a migrations directory (not the generated module). */
|
|
1148
|
+
function isMigrationFile(fileName) {
|
|
1149
|
+
return fileName.endsWith(".ts") && fileName !== CLIENT_MIGRATIONS_FILE;
|
|
1150
|
+
}
|
|
1151
|
+
/** Write the app's schema versions and the migrations between them. */
|
|
1152
|
+
async function writeClientMigrations(schemaFile, schemas, edges) {
|
|
1153
|
+
if (!(await importsClientMigrations(schemaFile)))
|
|
1154
|
+
return;
|
|
1155
|
+
const path = clientMigrationsPath(schemaFile);
|
|
1156
|
+
await assertNoSymlinkComponents(dirname(path), true);
|
|
1157
|
+
await writeClientMigrationsModule(path, clientMigrationsJson(schemas, edges));
|
|
1158
|
+
}
|
|
1159
|
+
/** The app's schema versions and migrations as JSON, as it ships them to clients. */
|
|
1160
|
+
function clientMigrationsJson(schemas, edges) {
|
|
1161
|
+
const bundle = {
|
|
1162
|
+
// As a deployment sends them (`{ tables }`), which the bindings decode.
|
|
1163
|
+
schemas: [...schemas]
|
|
1164
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
1165
|
+
.map(([hash, schema]) => ({
|
|
1166
|
+
hash,
|
|
1167
|
+
schema: { tables: mergePermissionsIntoWasmSchema(schema, {}) },
|
|
1168
|
+
})),
|
|
1169
|
+
migrations: edges.map((edge) => ({
|
|
1170
|
+
fromHash: edge.fromHash,
|
|
1171
|
+
toHash: edge.toHash,
|
|
1172
|
+
forward: serializeForwardLenses(edge.migration.forward),
|
|
1173
|
+
})),
|
|
1174
|
+
};
|
|
1175
|
+
return JSON.stringify(bundle, runtimeSchemaJsonReplacer, 2);
|
|
1176
|
+
}
|
|
1177
|
+
/** Where `validate` moves migrations that predate SHA-256 schema hashes. */
|
|
1178
|
+
export const LEGACY_MIGRATIONS_DIR = "legacy";
|
|
1179
|
+
const SNAPSHOT_NAME_HASH = /([0-9a-f]{12})\.json$/i;
|
|
1180
|
+
const SNAPSHOT_HASH_PREFIX = 12;
|
|
1181
|
+
const LEGACY_REASON = "names schema versions by the BLAKE3 hashes Jazz used before alpha.60 switched schema hashes to SHA-256";
|
|
1182
|
+
/**
|
|
1183
|
+
* Schema hashes changed from BLAKE3 to SHA-256 in alpha.60. A snapshot's
|
|
1184
|
+
* hash is recomputed from its contents, but its file name and every
|
|
1185
|
+
* migration written against it still carry the BLAKE3 short hash.
|
|
1186
|
+
*
|
|
1187
|
+
* A migration is legacy when one of its ends resolves to no SHA-256
|
|
1188
|
+
* version this project knows (its snapshots and schema.ts) but is the
|
|
1189
|
+
* BLAKE3 hash of one of them: its edges can't be resolved, and an app
|
|
1190
|
+
* upgrading to alpha.60 starts again from its current schema. This is
|
|
1191
|
+
* decided from the migration and the schemas alone, so a run that stopped
|
|
1192
|
+
* halfway (snapshots renamed, migrations not yet moved) is finished by the
|
|
1193
|
+
* next. A migration whose ends match nothing at all is not legacy; it is
|
|
1194
|
+
* left for the usual checks to report.
|
|
1195
|
+
*
|
|
1196
|
+
* A snapshot named by neither hash of its contents is refused: it was
|
|
1197
|
+
* edited or renamed by hand, and renaming it would hide that.
|
|
1198
|
+
*/
|
|
1199
|
+
async function planLegacyMigrations(migrationsDir, currentSchema) {
|
|
1200
|
+
const plan = { migrations: [], snapshots: [], retired: [] };
|
|
1201
|
+
if (!(await pathExists(migrationsDir)))
|
|
1202
|
+
return plan;
|
|
1203
|
+
await assertNoSymlinkComponents(migrationsDir);
|
|
1204
|
+
const snapshots = await new MigrationStorage(migrationsDir).listSnapshots();
|
|
1205
|
+
const known = [
|
|
1206
|
+
...new Set([...snapshots.map(({ hash }) => hash), await computeSchemaHash(currentSchema)]),
|
|
1207
|
+
];
|
|
1208
|
+
const legacyShort = new Set([shortSchemaHash(legacySchemaHash(currentSchema))]);
|
|
1209
|
+
for (const snapshot of snapshots) {
|
|
1210
|
+
const legacy = shortSchemaHash(legacySchemaHash(snapshot.schema));
|
|
1211
|
+
legacyShort.add(legacy);
|
|
1212
|
+
const named = snapshot.fileName.match(SNAPSHOT_NAME_HASH)?.[1]?.toLowerCase();
|
|
1213
|
+
const current = shortSchemaHash(snapshot.hash);
|
|
1214
|
+
if (!named || named === current)
|
|
1215
|
+
continue;
|
|
1216
|
+
if (named !== legacy) {
|
|
1217
|
+
throw new Error(`Snapshot ${snapshot.fileName} is named for schema hash ${named}, but its contents hash to ${current} (and were ${legacy} before alpha.60). Restore the snapshot from version control, or rename it to end in ${current}.json if its contents are right.`);
|
|
1218
|
+
}
|
|
1219
|
+
plan.snapshots.push({
|
|
1220
|
+
from: snapshot.filePath,
|
|
1221
|
+
to: join(dirname(snapshot.filePath), snapshot.fileName.replace(SNAPSHOT_NAME_HASH, `${current}.json`)),
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
const resolves = (hash) => {
|
|
1225
|
+
try {
|
|
1226
|
+
resolveKnownSchemaHash(hash, "schema hash", known);
|
|
1227
|
+
return true;
|
|
1228
|
+
}
|
|
1229
|
+
catch {
|
|
1230
|
+
return false;
|
|
1231
|
+
}
|
|
1232
|
+
};
|
|
1233
|
+
const legacy = (hash) => !resolves(hash) && legacyShort.has(hash.slice(0, SNAPSHOT_HASH_PREFIX).toLowerCase());
|
|
1234
|
+
for (const fileName of (await readdir(migrationsDir)).filter(isMigrationFile).sort()) {
|
|
1235
|
+
let named;
|
|
1236
|
+
try {
|
|
1237
|
+
named = migrationHashesFromFileName(fileName);
|
|
1238
|
+
}
|
|
1239
|
+
catch {
|
|
1240
|
+
continue;
|
|
1241
|
+
}
|
|
1242
|
+
if (legacy(named.from) || legacy(named.to))
|
|
1243
|
+
plan.migrations.push(fileName);
|
|
1244
|
+
}
|
|
1245
|
+
if (plan.migrations.length > 0 || plan.snapshots.length > 0) {
|
|
1246
|
+
await retireUnreachedSnapshots(plan, migrationsDir, snapshots, currentSchema);
|
|
1247
|
+
}
|
|
1248
|
+
return plan;
|
|
1249
|
+
}
|
|
1250
|
+
/** Plan the snapshots of a project being retired that nothing reaches (see
|
|
1251
|
+
* [`LegacyPlan.retired`]). */
|
|
1252
|
+
async function retireUnreachedSnapshots(plan, migrationsDir, snapshots, currentSchema) {
|
|
1253
|
+
const current = await computeSchemaHash(currentSchema);
|
|
1254
|
+
const reached = new Set();
|
|
1255
|
+
const moving = new Set(plan.migrations);
|
|
1256
|
+
for (const fileName of (await readdir(migrationsDir)).filter(isMigrationFile)) {
|
|
1257
|
+
if (moving.has(fileName))
|
|
1258
|
+
continue;
|
|
1259
|
+
try {
|
|
1260
|
+
const { from, to } = migrationHashesFromFileName(fileName);
|
|
1261
|
+
reached.add(from.toLowerCase());
|
|
1262
|
+
reached.add(to.toLowerCase());
|
|
1263
|
+
}
|
|
1264
|
+
catch {
|
|
1265
|
+
continue;
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
const isReached = (hash) => hash === current || [...reached].some((prefix) => hash.startsWith(prefix));
|
|
1269
|
+
let unreached = snapshots.filter(({ hash }) => !isReached(hash));
|
|
1270
|
+
if (!snapshots.some(({ hash }) => isReached(hash))) {
|
|
1271
|
+
// Committed snapshot names start with their timestamp: the last is the
|
|
1272
|
+
// newest, as `loadLatestCommittedSnapshot` picks it.
|
|
1273
|
+
const newest = unreached
|
|
1274
|
+
.filter(({ fileName }) => isCommittedSnapshotFileName(fileName))
|
|
1275
|
+
.sort((a, b) => a.fileName.localeCompare(b.fileName))
|
|
1276
|
+
.pop();
|
|
1277
|
+
if (newest) {
|
|
1278
|
+
unreached = unreached.filter((snapshot) => snapshot !== newest);
|
|
1279
|
+
const renamed = plan.snapshots.find(({ from }) => from === newest.filePath);
|
|
1280
|
+
plan.startFrom = basename(renamed?.to ?? newest.filePath);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
const retired = new Set(unreached.map(({ filePath }) => filePath));
|
|
1284
|
+
plan.snapshots = plan.snapshots.filter(({ from }) => !retired.has(from));
|
|
1285
|
+
plan.retired = [...retired].sort();
|
|
1286
|
+
}
|
|
1287
|
+
async function sameBytes(left, right) {
|
|
1288
|
+
const [a, b] = await Promise.all([readFile(left), readFile(right)]);
|
|
1289
|
+
return a.equals(b);
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Carry out {@link planLegacyMigrations} under the migrations lock:
|
|
1293
|
+
* migrations move to `legacy/` first, then snapshots are renamed, so an
|
|
1294
|
+
* interrupted run leaves a project the next run finishes. A migration whose
|
|
1295
|
+
* name is taken in `legacy/` by a different file is refused before
|
|
1296
|
+
* anything moves. Returns a warning per change.
|
|
1297
|
+
*/
|
|
1298
|
+
async function retireLegacyMigrations(migrationsDir, currentSchema) {
|
|
1299
|
+
if (!(await pathExists(migrationsDir)))
|
|
1300
|
+
return [];
|
|
1301
|
+
const storage = new MigrationStorage(migrationsDir);
|
|
1302
|
+
return withMigrationDirectoryLock(storage, async () => {
|
|
1303
|
+
const plan = await planLegacyMigrations(migrationsDir, currentSchema);
|
|
1304
|
+
const legacyDir = join(migrationsDir, LEGACY_MIGRATIONS_DIR);
|
|
1305
|
+
const moves = plan.migrations.map((fileName) => ({
|
|
1306
|
+
fileName,
|
|
1307
|
+
from: join(migrationsDir, fileName),
|
|
1308
|
+
to: join(legacyDir, fileName),
|
|
1309
|
+
}));
|
|
1310
|
+
const kept = new Set();
|
|
1311
|
+
for (const move of moves) {
|
|
1312
|
+
if (!(await pathExists(move.to)))
|
|
1313
|
+
continue;
|
|
1314
|
+
if (!(await sameBytes(move.from, move.to))) {
|
|
1315
|
+
throw new Error(`Cannot move ${move.fileName} to ${LEGACY_MIGRATIONS_DIR}/: a different ${LEGACY_MIGRATIONS_DIR}/${move.fileName} is already there. Compare the two, keep the one you want in ${LEGACY_MIGRATIONS_DIR}/ and delete the other, then run validate again.`);
|
|
1316
|
+
}
|
|
1317
|
+
kept.add(move.fileName);
|
|
1318
|
+
}
|
|
1319
|
+
const legacySnapshots = join(legacyDir, "snapshots");
|
|
1320
|
+
const snapshotMoves = plan.retired.map((from) => ({
|
|
1321
|
+
fileName: basename(from),
|
|
1322
|
+
from,
|
|
1323
|
+
to: join(legacySnapshots, basename(from)),
|
|
1324
|
+
}));
|
|
1325
|
+
for (const move of snapshotMoves) {
|
|
1326
|
+
if ((await pathExists(move.to)) && !(await sameBytes(move.from, move.to))) {
|
|
1327
|
+
throw new Error(`Cannot move snapshot ${move.fileName} to ${LEGACY_MIGRATIONS_DIR}/snapshots/: a different ${LEGACY_MIGRATIONS_DIR}/snapshots/${move.fileName} is already there. Compare the two, keep the one you want there and delete the other, then run validate again.`);
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
if (moves.length > 0 || snapshotMoves.length > 0) {
|
|
1331
|
+
await mkdir(legacyDir, { recursive: true });
|
|
1332
|
+
await assertNoSymlinkComponents(legacyDir);
|
|
1333
|
+
}
|
|
1334
|
+
if (snapshotMoves.length > 0) {
|
|
1335
|
+
await mkdir(legacySnapshots, { recursive: true });
|
|
1336
|
+
await assertNoSymlinkComponents(legacySnapshots);
|
|
1337
|
+
}
|
|
1338
|
+
const runsOn = plan.startFrom ? "" : " The app runs on schema.ts as it is.";
|
|
1339
|
+
const warnings = [];
|
|
1340
|
+
for (const move of moves) {
|
|
1341
|
+
if (kept.has(move.fileName)) {
|
|
1342
|
+
await rm(move.from);
|
|
1343
|
+
warnings.push(`Removed ${move.fileName}: it ${LEGACY_REASON}, and the same file is already in ${LEGACY_MIGRATIONS_DIR}/.`);
|
|
1344
|
+
}
|
|
1345
|
+
else {
|
|
1346
|
+
await rename(move.from, move.to);
|
|
1347
|
+
warnings.push(`Moved ${move.fileName} to ${LEGACY_MIGRATIONS_DIR}/: it ${LEGACY_REASON}, so it no longer applies.${runsOn} Delete ${LEGACY_MIGRATIONS_DIR}/ once you no longer need it, or exclude it from type checking.`);
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
for (const move of snapshotMoves) {
|
|
1351
|
+
if (await pathExists(move.to)) {
|
|
1352
|
+
await rm(move.from);
|
|
1353
|
+
}
|
|
1354
|
+
else {
|
|
1355
|
+
await rename(move.from, move.to);
|
|
1356
|
+
}
|
|
1357
|
+
warnings.push(`Moved snapshot ${move.fileName} to ${LEGACY_MIGRATIONS_DIR}/snapshots/: no remaining migration reaches it, so it would be a second root of the history.`);
|
|
1358
|
+
}
|
|
1359
|
+
for (const snapshot of plan.snapshots) {
|
|
1360
|
+
const from = basename(snapshot.from);
|
|
1361
|
+
const to = basename(snapshot.to);
|
|
1362
|
+
if (await pathExists(snapshot.to)) {
|
|
1363
|
+
// The same schema (its SHA-256 says so) under its current name.
|
|
1364
|
+
await rm(snapshot.from);
|
|
1365
|
+
warnings.push(`Removed snapshot ${from}: it is named by its pre-alpha.60 BLAKE3 hash, and ${to} holds the same schema.`);
|
|
1366
|
+
}
|
|
1367
|
+
else {
|
|
1368
|
+
await rename(snapshot.from, snapshot.to);
|
|
1369
|
+
warnings.push(`Renamed snapshot ${from} to ${to}: snapshots are named by their SHA-256 schema hash since alpha.60.`);
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
if (plan.startFrom) {
|
|
1373
|
+
warnings.push(`Run \`jazz-tools migrations create\` before the app starts: no snapshot is for schema.ts, so the app needs a migration from ${plan.startFrom}, the newest snapshot.`);
|
|
1374
|
+
}
|
|
1375
|
+
return warnings;
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
/** Refuse while legacy migrations are in place, pointing at `validate`. */
|
|
1379
|
+
async function assertNoLegacyMigrations(migrationsDir, currentSchema) {
|
|
1380
|
+
const { migrations } = await planLegacyMigrations(migrationsDir, currentSchema);
|
|
1381
|
+
if (migrations.length === 0)
|
|
1382
|
+
return;
|
|
1383
|
+
const one = migrations.length === 1;
|
|
1384
|
+
throw new Error(`${migrations.join(", ")} ${one ? "names" : "name"} schema versions by the BLAKE3 hashes Jazz used before alpha.60 switched schema hashes to SHA-256. Run \`jazz-tools validate\` to move ${one ? "it" : "them"} to ${LEGACY_MIGRATIONS_DIR}/; the app then runs on schema.ts as it is.`);
|
|
1385
|
+
}
|
|
1386
|
+
/**
|
|
1387
|
+
* For `validate --check`: fail, changing nothing, while a project holds
|
|
1388
|
+
* legacy migrations or snapshots named by their BLAKE3 hash.
|
|
1389
|
+
*/
|
|
1390
|
+
async function checkLegacyMigrations(migrationsDir, currentSchema) {
|
|
1391
|
+
const plan = await planLegacyMigrations(migrationsDir, currentSchema);
|
|
1392
|
+
const pending = [
|
|
1393
|
+
...plan.migrations.map((fileName) => `move ${fileName} to ${LEGACY_MIGRATIONS_DIR}/`),
|
|
1394
|
+
...plan.retired.map((from) => `move snapshot ${basename(from)} to ${LEGACY_MIGRATIONS_DIR}/snapshots/`),
|
|
1395
|
+
...plan.snapshots.map(({ from, to }) => `rename snapshot ${basename(from)} to ${basename(to)}`),
|
|
1396
|
+
];
|
|
1397
|
+
if (pending.length === 0)
|
|
1398
|
+
return;
|
|
1399
|
+
throw new Error(`This project still uses the schema hashes Jazz used before alpha.60. Run \`jazz-tools validate\` to ${pending.join("; ")}.${plan.startFrom ? ` Then run \`jazz-tools migrations create\`: no snapshot is for schema.ts, so the app needs a migration from ${plan.startFrom}.` : ""}`);
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Write the app's migrations module from what this project holds locally:
|
|
1403
|
+
* schema.ts, its snapshots and its migration files.
|
|
1404
|
+
*/
|
|
1405
|
+
async function writeLocalClientMigrations(schemaDir, migrationsDir) {
|
|
1406
|
+
const compiled = await loadCompiledSchema(schemaDir);
|
|
1407
|
+
if (!(await importsClientMigrations(compiled.schemaFile)))
|
|
1408
|
+
return;
|
|
1409
|
+
const { schemas, edges } = await localClientMigrations(compiled.wasmSchema, migrationsDir);
|
|
1410
|
+
await writeClientMigrations(compiled.schemaFile, schemas, edges);
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* Check the project's migrations up to `schema` as a deploy of them to a
|
|
1414
|
+
* new authority would, so validate refuses what deploy would refuse.
|
|
1415
|
+
*/
|
|
1416
|
+
async function checkLocalMigrations(schema, migrationsDir) {
|
|
1417
|
+
const { current, schemas, edges } = await localClientMigrations(schema, migrationsDir);
|
|
1418
|
+
if (schemas.size < 2)
|
|
1419
|
+
return;
|
|
1420
|
+
if (typeof process === "undefined" || !process.versions?.node)
|
|
1421
|
+
return;
|
|
1422
|
+
const { checkClientMigrations } = await import("jazz-napi");
|
|
1423
|
+
try {
|
|
1424
|
+
checkClientMigrations(clientMigrationsJson(schemas, edges), current);
|
|
1425
|
+
}
|
|
1426
|
+
catch (error) {
|
|
1427
|
+
throw new Error(`The migrations in ${basename(migrationsDir)} would not deploy: ${error instanceof Error ? error.message : String(error)}`);
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
/** The snapshots and migration files in `migrationsDir`, leading to `schema`. */
|
|
1431
|
+
async function localClientMigrations(schema, migrationsDir) {
|
|
1432
|
+
const current = {
|
|
1433
|
+
hash: await computeSchemaHash(schema),
|
|
1434
|
+
schema,
|
|
1435
|
+
};
|
|
1436
|
+
const schemas = new Map((await new MigrationStorage(migrationsDir).listSnapshots()).map(({ hash, schema }) => [
|
|
1437
|
+
hash,
|
|
1438
|
+
schema,
|
|
1439
|
+
]));
|
|
1440
|
+
schemas.set(current.hash, current.schema);
|
|
1441
|
+
const edges = [];
|
|
1442
|
+
// A migration joins two known versions: with one, none can, so none is loaded.
|
|
1443
|
+
if (schemas.size > 1 && (await pathExists(migrationsDir))) {
|
|
1444
|
+
await assertNoSymlinkComponents(migrationsDir);
|
|
1445
|
+
for (const fileName of (await readdir(migrationsDir)).filter(isMigrationFile).sort()) {
|
|
1446
|
+
const migration = await loadDefinedMigration(join(migrationsDir, fileName));
|
|
1447
|
+
const known = (hash) => hash === undefined
|
|
1448
|
+
? undefined
|
|
1449
|
+
: resolveKnownSchemaHash(hash, fileName, [...schemas.keys()]);
|
|
1450
|
+
let fromHash, toHash;
|
|
1451
|
+
try {
|
|
1452
|
+
fromHash = known(migration.fromHash);
|
|
1453
|
+
toHash = known(migration.toHash);
|
|
1454
|
+
}
|
|
1455
|
+
catch {
|
|
1456
|
+
// A migration from a version this project has no snapshot of is
|
|
1457
|
+
// left out: run `migrations create` to snapshot it, or deploy.
|
|
1458
|
+
continue;
|
|
1459
|
+
}
|
|
1460
|
+
if (fromHash && toHash)
|
|
1461
|
+
edges.push({ fromHash, toHash, migration });
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
return { current: current.hash, schemas, edges };
|
|
1465
|
+
}
|
|
1466
|
+
//# sourceMappingURL=catalogue-project.js.map
|