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
|
@@ -1,7 +1,49 @@
|
|
|
1
1
|
import { analyzeRelations } from "../codegen/relation-analyzer.js";
|
|
2
|
+
import { sha256 } from "@noble/hashes/sha2.js";
|
|
3
|
+
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
4
|
+
import { assertSchemaNameAllowed } from "../schema-name.js";
|
|
2
5
|
const OUTER_ROW_SESSION_PREFIX = "__jazz_outer_row";
|
|
3
6
|
const RECURSIVE_POLICY_MAX_DEPTH_DEFAULT = 10;
|
|
7
|
+
const REACHABLE_POLICY_MAX_DEPTH_DEFAULT = 8;
|
|
4
8
|
const RECURSIVE_POLICY_MAX_DEPTH_HARD_CAP = 64;
|
|
9
|
+
const PERMISSION_EXPRESSION_BRAND = Symbol("jazz.permission-expression");
|
|
10
|
+
const POLICY_EXPRESSION_DISCRIMINATORS = {
|
|
11
|
+
Cmp: true,
|
|
12
|
+
SessionCmp: true,
|
|
13
|
+
IsNull: true,
|
|
14
|
+
SessionIsNull: true,
|
|
15
|
+
IsNotNull: true,
|
|
16
|
+
SessionIsNotNull: true,
|
|
17
|
+
Contains: true,
|
|
18
|
+
SessionContains: true,
|
|
19
|
+
In: true,
|
|
20
|
+
InList: true,
|
|
21
|
+
SessionInList: true,
|
|
22
|
+
Exists: true,
|
|
23
|
+
ExistsRel: true,
|
|
24
|
+
Inherits: true,
|
|
25
|
+
InheritsReferencing: true,
|
|
26
|
+
And: true,
|
|
27
|
+
Or: true,
|
|
28
|
+
Not: true,
|
|
29
|
+
True: true,
|
|
30
|
+
False: true,
|
|
31
|
+
};
|
|
32
|
+
function brandPermissionExpression(expression) {
|
|
33
|
+
Object.defineProperty(expression, PERMISSION_EXPRESSION_BRAND, {
|
|
34
|
+
configurable: false,
|
|
35
|
+
enumerable: false,
|
|
36
|
+
value: true,
|
|
37
|
+
writable: false,
|
|
38
|
+
});
|
|
39
|
+
return expression;
|
|
40
|
+
}
|
|
41
|
+
function relationJoinAlias(kind, join, index) {
|
|
42
|
+
if (kind === "recursive") {
|
|
43
|
+
return `__recursive_join_${index}`;
|
|
44
|
+
}
|
|
45
|
+
return join.viaHop ? `__hop_${index}` : `__join_${index}`;
|
|
46
|
+
}
|
|
5
47
|
class PermissionRelationBuilder {
|
|
6
48
|
state;
|
|
7
49
|
relations;
|
|
@@ -10,21 +52,33 @@ class PermissionRelationBuilder {
|
|
|
10
52
|
this.relations = relations;
|
|
11
53
|
}
|
|
12
54
|
where(input) {
|
|
55
|
+
if (this.state.kind === "union") {
|
|
56
|
+
throw new Error("where(...) does not support union(...) relations in MVP.");
|
|
57
|
+
}
|
|
13
58
|
const where = resolveRelationWhereInput(input);
|
|
14
|
-
const filters = [...this.state.filters, ...extractRelationFilters(where)];
|
|
59
|
+
const filters = [...this.state.filters, ...extractRelationFilters(where, this.state)];
|
|
15
60
|
return new PermissionRelationBuilder({
|
|
16
61
|
...this.state,
|
|
17
62
|
filters,
|
|
18
63
|
}, this.relations);
|
|
19
64
|
}
|
|
20
65
|
join(target, on) {
|
|
21
|
-
|
|
66
|
+
if (this.state.kind === "union") {
|
|
67
|
+
throw new Error("join(...) does not support union(...) relations in MVP.");
|
|
68
|
+
}
|
|
69
|
+
const relation = isPermissionRelation(target) ? target : undefined;
|
|
70
|
+
const table = relation
|
|
71
|
+
? validateFilteredJoinRelation(relation, this.state).outputTable
|
|
72
|
+
: relationJoinTargetToTable(target);
|
|
73
|
+
const leftScope = currentRelationScope(this.state);
|
|
22
74
|
const joins = [
|
|
23
75
|
...this.state.joins,
|
|
24
76
|
{
|
|
25
77
|
table,
|
|
26
78
|
left: on.left,
|
|
79
|
+
leftScope,
|
|
27
80
|
right: on.right,
|
|
81
|
+
relation,
|
|
28
82
|
},
|
|
29
83
|
];
|
|
30
84
|
return new PermissionRelationBuilder({
|
|
@@ -33,13 +87,19 @@ class PermissionRelationBuilder {
|
|
|
33
87
|
}, this.relations);
|
|
34
88
|
}
|
|
35
89
|
select(columns) {
|
|
90
|
+
if (this.state.kind === "union") {
|
|
91
|
+
throw new Error("select(...) does not support union(...) relations in MVP.");
|
|
92
|
+
}
|
|
36
93
|
return new PermissionRelationBuilder({
|
|
37
94
|
...this.state,
|
|
38
95
|
selectMap: normalizeRelationSelectMap(columns),
|
|
39
96
|
}, this.relations);
|
|
40
97
|
}
|
|
41
98
|
hopTo(relation) {
|
|
42
|
-
|
|
99
|
+
if (this.state.kind === "union") {
|
|
100
|
+
throw new Error("hopTo(...) does not support union(...) relations in MVP.");
|
|
101
|
+
}
|
|
102
|
+
const relationName = relation;
|
|
43
103
|
if (!relationName) {
|
|
44
104
|
throw new Error("hopTo(...) requires a non-empty relation name.");
|
|
45
105
|
}
|
|
@@ -51,21 +111,25 @@ class PermissionRelationBuilder {
|
|
|
51
111
|
throw new Error("hopTo(...) cannot be composed after select(...).");
|
|
52
112
|
}
|
|
53
113
|
const rel = resolveNamedRelation(this.relations, this.state.outputTable, relationName);
|
|
114
|
+
const leftScope = currentRelationScope(this.state);
|
|
54
115
|
const join = rel.type === "forward"
|
|
55
116
|
? {
|
|
56
117
|
table: rel.toTable,
|
|
118
|
+
leftScope,
|
|
57
119
|
left: rel.fromColumn,
|
|
58
120
|
right: "id",
|
|
59
121
|
viaHop: true,
|
|
60
122
|
}
|
|
61
123
|
: {
|
|
62
124
|
table: rel.toTable,
|
|
125
|
+
leftScope,
|
|
63
126
|
left: "id",
|
|
64
127
|
right: rel.toColumn,
|
|
65
128
|
viaHop: true,
|
|
66
129
|
};
|
|
67
130
|
return new PermissionRelationBuilder({
|
|
68
131
|
...this.state,
|
|
132
|
+
outputTable: rel.toTable,
|
|
69
133
|
joins: [...this.state.joins, join],
|
|
70
134
|
}, this.relations);
|
|
71
135
|
}
|
|
@@ -79,9 +143,11 @@ class PermissionRelationBuilder {
|
|
|
79
143
|
}
|
|
80
144
|
return new PermissionRelationBuilder({
|
|
81
145
|
...this.state,
|
|
146
|
+
outputTable: rel.toTable,
|
|
82
147
|
joins: [
|
|
83
148
|
...this.state.joins,
|
|
84
149
|
{
|
|
150
|
+
leftScope: currentRelationScope(this.state),
|
|
85
151
|
table: rel.toTable,
|
|
86
152
|
left: "id",
|
|
87
153
|
right: rel.toColumn,
|
|
@@ -91,17 +157,16 @@ class PermissionRelationBuilder {
|
|
|
91
157
|
}, this.relations);
|
|
92
158
|
}
|
|
93
159
|
gather(options) {
|
|
94
|
-
if (this.state.kind !== "table") {
|
|
95
|
-
throw new Error("gather(...) must start from policy.<table>.");
|
|
96
|
-
}
|
|
97
|
-
if (this.state.joins.length > 0) {
|
|
98
|
-
throw new Error("gather(...) does not support pre-joined start relations in MVP.");
|
|
99
|
-
}
|
|
100
160
|
if (typeof options.step !== "function") {
|
|
101
161
|
throw new Error("gather(...) requires a step callback.");
|
|
102
162
|
}
|
|
103
|
-
|
|
104
|
-
|
|
163
|
+
if (this.state.selectMap && Object.keys(this.state.selectMap).length > 0) {
|
|
164
|
+
throw new Error("gather(...) does not support select(...) seeds in MVP.");
|
|
165
|
+
}
|
|
166
|
+
if (options.start && this.state.kind === "union" && !isPermissionRelation(options.start)) {
|
|
167
|
+
throw new Error("gather(...) start does not support union(...) seeds in MVP.");
|
|
168
|
+
}
|
|
169
|
+
const seedState = buildGatherSeedState(this.state, options.start, this.relations);
|
|
105
170
|
const currentToken = {
|
|
106
171
|
__jazzPermissionKind: "recursive-current",
|
|
107
172
|
};
|
|
@@ -120,63 +185,61 @@ class PermissionRelationBuilder {
|
|
|
120
185
|
throw new Error("gather(...) step must include exactly one where condition bound to current.");
|
|
121
186
|
}
|
|
122
187
|
const currentFilter = currentFilters[0];
|
|
188
|
+
if (!currentFilter) {
|
|
189
|
+
throw new Error("gather(...) step must include exactly one where condition bound to current.");
|
|
190
|
+
}
|
|
123
191
|
const stepFilters = stepState.filters.filter((filter) => filter !== currentFilter);
|
|
124
192
|
const stepJoin = stepState.joins[0];
|
|
125
193
|
if (stepJoin.table !== this.state.outputTable || stripQualifier(stepJoin.right) !== "id") {
|
|
126
194
|
throw new Error(`gather(...) step must hop back to "${this.state.outputTable}" rows via hopTo(...).`);
|
|
127
195
|
}
|
|
128
|
-
const
|
|
129
|
-
const seed = applyRelFilter(this.state.base, seedPredicates);
|
|
196
|
+
const seed = relationStateToRelExpr(seedState);
|
|
130
197
|
const stepPredicates = [
|
|
131
|
-
...stepFilters.flatMap((filter) => relationFilterToPredicates(filter
|
|
198
|
+
...stepFilters.flatMap((filter) => relationFilterToPredicates(filter)),
|
|
132
199
|
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
200
|
+
Cmp: {
|
|
201
|
+
left: {
|
|
202
|
+
scope: currentFilter.scope,
|
|
203
|
+
column: stripQualifier(currentFilter.column),
|
|
204
|
+
},
|
|
205
|
+
op: "Eq",
|
|
206
|
+
right: {
|
|
207
|
+
RowId: "Frontier",
|
|
208
|
+
},
|
|
142
209
|
},
|
|
143
210
|
},
|
|
144
211
|
];
|
|
145
212
|
const stepFiltered = applyRelFilter(stepState.base, stepPredicates);
|
|
146
|
-
|
|
213
|
+
// Gather carries only the recursive key across the frontier. The
|
|
214
|
+
// hopTo(...) validation above proves that stepJoin.left is the foreign key
|
|
215
|
+
// of the output row, so joining every hop back to the output table would
|
|
216
|
+
// add an unnecessary existence requirement and prevent an unmaterialized
|
|
217
|
+
// parent key from authorizing a later access-table join.
|
|
147
218
|
const stepProjected = {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
left: stepFiltered,
|
|
152
|
-
right: {
|
|
153
|
-
type: "TableScan",
|
|
154
|
-
table: this.state.outputTable,
|
|
155
|
-
},
|
|
156
|
-
on: [
|
|
219
|
+
Project: {
|
|
220
|
+
input: stepFiltered,
|
|
221
|
+
columns: [
|
|
157
222
|
{
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
223
|
+
alias: "id",
|
|
224
|
+
expr: {
|
|
225
|
+
Column: relationColumnRef(stepJoin.left, stepJoin.leftScope),
|
|
161
226
|
},
|
|
162
|
-
right: { scope: recursiveHopScope, column: "id" },
|
|
163
227
|
},
|
|
164
228
|
],
|
|
165
|
-
joinKind: "Inner",
|
|
166
229
|
},
|
|
167
|
-
columns: projectHopResult(recursiveHopScope),
|
|
168
230
|
};
|
|
169
231
|
const maxDepth = normalizeRecursiveRelationDepth(options.maxDepth);
|
|
170
232
|
return new PermissionRelationBuilder({
|
|
171
233
|
kind: "recursive",
|
|
172
234
|
outputTable: this.state.outputTable,
|
|
173
235
|
base: {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
236
|
+
Gather: {
|
|
237
|
+
seed,
|
|
238
|
+
step: stepProjected,
|
|
239
|
+
frontier_key: { RowId: "Current" },
|
|
240
|
+
bound: { MaxDepth: maxDepth },
|
|
241
|
+
dedupe_key: [{ RowId: "Current" }],
|
|
242
|
+
},
|
|
180
243
|
},
|
|
181
244
|
initialScope: this.state.outputTable,
|
|
182
245
|
filters: [],
|
|
@@ -184,22 +247,152 @@ class PermissionRelationBuilder {
|
|
|
184
247
|
selectMap: undefined,
|
|
185
248
|
}, this.relations);
|
|
186
249
|
}
|
|
250
|
+
reachable_via(access_table, access_row_column, access_team_column, from, edge_table, edge_member_column, edge_parent_column, edge_filters = {}) {
|
|
251
|
+
return this.reachable_via_with_access_filters(access_table, access_row_column, access_team_column, from, {}, edge_table, edge_member_column, edge_parent_column, edge_filters);
|
|
252
|
+
}
|
|
253
|
+
reachable_via_with_access_filters(access_table, access_row_column, access_team_column, from, access_filters, edge_table, edge_member_column, edge_parent_column, edge_filters = {}) {
|
|
254
|
+
return new ReachableRelationSeedBuilder(this.state.outputTable, {
|
|
255
|
+
access_table,
|
|
256
|
+
access_row_column,
|
|
257
|
+
access_team_column,
|
|
258
|
+
from,
|
|
259
|
+
access_filters,
|
|
260
|
+
edge_table,
|
|
261
|
+
edge_member_column,
|
|
262
|
+
edge_parent_column,
|
|
263
|
+
edge_filters,
|
|
264
|
+
}, this.relations);
|
|
265
|
+
}
|
|
187
266
|
toState() {
|
|
188
267
|
return this.state;
|
|
189
268
|
}
|
|
190
269
|
}
|
|
270
|
+
class ReachableRelationSeedBuilder {
|
|
271
|
+
rootTable;
|
|
272
|
+
args;
|
|
273
|
+
relations;
|
|
274
|
+
constructor(rootTable, args, relations) {
|
|
275
|
+
this.rootTable = rootTable;
|
|
276
|
+
this.args = args;
|
|
277
|
+
this.relations = relations;
|
|
278
|
+
}
|
|
279
|
+
seeded_by(seed_table, user_column, from, team_column) {
|
|
280
|
+
if (!isSessionRefValue(from)) {
|
|
281
|
+
throw new Error('seeded_by(...) takes a session reference such as session.user or session.claims["sub"].');
|
|
282
|
+
}
|
|
283
|
+
const accessScope = "__reachable_access_0";
|
|
284
|
+
const seedScope = seed_table;
|
|
285
|
+
const seedPredicates = [
|
|
286
|
+
{
|
|
287
|
+
Cmp: {
|
|
288
|
+
left: { scope: seedScope, column: user_column },
|
|
289
|
+
op: "Eq",
|
|
290
|
+
right: { SessionRef: from.path },
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
];
|
|
294
|
+
const seed = {
|
|
295
|
+
Project: {
|
|
296
|
+
input: applyRelFilter({ TableScan: { table: seed_table } }, seedPredicates),
|
|
297
|
+
columns: [
|
|
298
|
+
{
|
|
299
|
+
alias: "id",
|
|
300
|
+
expr: { Column: { scope: seedScope, column: team_column } },
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
const stepPredicates = [
|
|
306
|
+
{
|
|
307
|
+
Cmp: {
|
|
308
|
+
left: { scope: this.args.edge_table, column: this.args.edge_member_column },
|
|
309
|
+
op: "Eq",
|
|
310
|
+
right: { RowId: "Frontier" },
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
...whereObjectToRelationPredicates(this.args.edge_filters, this.args.edge_table),
|
|
314
|
+
];
|
|
315
|
+
const stepFiltered = applyRelFilter({ TableScan: { table: this.args.edge_table } }, stepPredicates);
|
|
316
|
+
const step = {
|
|
317
|
+
Project: {
|
|
318
|
+
input: stepFiltered,
|
|
319
|
+
columns: [
|
|
320
|
+
{
|
|
321
|
+
alias: "id",
|
|
322
|
+
expr: {
|
|
323
|
+
Column: {
|
|
324
|
+
scope: this.args.edge_table,
|
|
325
|
+
column: this.args.edge_parent_column,
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
},
|
|
331
|
+
};
|
|
332
|
+
const gather = {
|
|
333
|
+
Gather: {
|
|
334
|
+
seed,
|
|
335
|
+
step,
|
|
336
|
+
frontier_key: { RowId: "Current" },
|
|
337
|
+
bound: { MaxDepth: REACHABLE_POLICY_MAX_DEPTH_DEFAULT },
|
|
338
|
+
dedupe_key: [{ RowId: "Current" }],
|
|
339
|
+
},
|
|
340
|
+
};
|
|
341
|
+
const joined = {
|
|
342
|
+
Join: {
|
|
343
|
+
left: gather,
|
|
344
|
+
right: {
|
|
345
|
+
TableScan: {
|
|
346
|
+
table: this.args.access_table,
|
|
347
|
+
alias: accessScope,
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
on: [
|
|
351
|
+
{
|
|
352
|
+
left: { column: "id" },
|
|
353
|
+
right: { scope: accessScope, column: this.args.access_team_column },
|
|
354
|
+
},
|
|
355
|
+
],
|
|
356
|
+
join_kind: "Inner",
|
|
357
|
+
},
|
|
358
|
+
};
|
|
359
|
+
const correlated = [
|
|
360
|
+
{
|
|
361
|
+
Cmp: {
|
|
362
|
+
left: { scope: accessScope, column: this.args.access_row_column },
|
|
363
|
+
op: "Eq",
|
|
364
|
+
right: { RowId: "Outer" },
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
...whereObjectToRelationPredicates(this.args.access_filters, accessScope),
|
|
368
|
+
];
|
|
369
|
+
return new PermissionRelationBuilder({
|
|
370
|
+
kind: "recursive",
|
|
371
|
+
outputTable: this.rootTable,
|
|
372
|
+
base: applyRelFilter(joined, correlated),
|
|
373
|
+
initialScope: this.rootTable,
|
|
374
|
+
filters: [],
|
|
375
|
+
joins: [],
|
|
376
|
+
selectMap: undefined,
|
|
377
|
+
}, this.relations);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
191
380
|
class UpdateRuleBuilder {
|
|
192
381
|
table;
|
|
382
|
+
hasTypeColumn;
|
|
193
383
|
registerRule;
|
|
384
|
+
columnTransforms;
|
|
194
385
|
oldCondition;
|
|
195
386
|
newCondition;
|
|
196
387
|
isRegistered = false;
|
|
197
|
-
constructor(table, registerRule) {
|
|
388
|
+
constructor(table, hasTypeColumn, registerRule, columnTransforms) {
|
|
198
389
|
this.table = table;
|
|
390
|
+
this.hasTypeColumn = hasTypeColumn;
|
|
199
391
|
this.registerRule = registerRule;
|
|
392
|
+
this.columnTransforms = columnTransforms;
|
|
200
393
|
}
|
|
201
|
-
where(input) {
|
|
202
|
-
const condition =
|
|
394
|
+
where(input, ..._guard) {
|
|
395
|
+
const condition = resolveRuleInput(`policy.${this.table}.allowUpdate.where`, input, this.hasTypeColumn, this.columnTransforms);
|
|
203
396
|
const rule = {
|
|
204
397
|
table: this.table,
|
|
205
398
|
action: "update",
|
|
@@ -209,13 +402,19 @@ class UpdateRuleBuilder {
|
|
|
209
402
|
this.registerRule?.(rule);
|
|
210
403
|
return rule;
|
|
211
404
|
}
|
|
212
|
-
|
|
213
|
-
this.
|
|
405
|
+
never() {
|
|
406
|
+
return this.where(neverCondition());
|
|
407
|
+
}
|
|
408
|
+
always() {
|
|
409
|
+
return this.where(alwaysCondition());
|
|
410
|
+
}
|
|
411
|
+
whereOld(input, ..._guard) {
|
|
412
|
+
this.oldCondition = resolveRuleInput(`policy.${this.table}.allowUpdate.whereOld`, input, this.hasTypeColumn, this.columnTransforms);
|
|
214
413
|
this.registerBuilder();
|
|
215
414
|
return this;
|
|
216
415
|
}
|
|
217
|
-
whereNew(input) {
|
|
218
|
-
this.newCondition =
|
|
416
|
+
whereNew(input, ..._guard) {
|
|
417
|
+
this.newCondition = resolveRuleInput(`policy.${this.table}.allowUpdate.whereNew`, input, this.hasTypeColumn, this.columnTransforms);
|
|
219
418
|
this.registerBuilder();
|
|
220
419
|
return this;
|
|
221
420
|
}
|
|
@@ -235,13 +434,51 @@ class UpdateRuleBuilder {
|
|
|
235
434
|
action: "update",
|
|
236
435
|
using: this.oldCondition ?? this.newCondition,
|
|
237
436
|
withCheck: this.newCondition ?? this.oldCondition,
|
|
437
|
+
// A rule with just one side intentionally uses that predicate for both
|
|
438
|
+
// halves. Two separately supplied predicates are conservatively treated
|
|
439
|
+
// as asymmetric, even when their eventual lowered form happens to look
|
|
440
|
+
// alike: that keeps policy composition fail-closed without requiring a
|
|
441
|
+
// lossy or exception-prone serialization of policy values.
|
|
442
|
+
asymmetricUpdate: this.oldCondition !== undefined &&
|
|
443
|
+
this.newCondition !== undefined &&
|
|
444
|
+
this.oldCondition !== this.newCondition,
|
|
238
445
|
};
|
|
239
446
|
}
|
|
240
447
|
}
|
|
241
448
|
export function definePermissions(app, factory) {
|
|
449
|
+
if (app === undefined || app === null) {
|
|
450
|
+
// What a circular import hands over: permissions.ts imports the app
|
|
451
|
+
// from schema.ts while schema.ts is still loading because it imports
|
|
452
|
+
// permissions.ts.
|
|
453
|
+
throw new Error("definePermissions(app, ...) got no app. If permissions.ts imports the app from " +
|
|
454
|
+
"schema.ts and schema.ts imports permissions.ts, the import is circular: import " +
|
|
455
|
+
"permissions.ts where you create Jazz instead of from schema.ts.");
|
|
456
|
+
}
|
|
457
|
+
const tableNames = Object.entries(app)
|
|
458
|
+
.filter(([, value]) => typeof value === "object" &&
|
|
459
|
+
value !== null &&
|
|
460
|
+
"where" in value &&
|
|
461
|
+
typeof value.where === "function")
|
|
462
|
+
.map(([tableName]) => tableName);
|
|
463
|
+
for (const tableName of tableNames) {
|
|
464
|
+
assertSchemaNameAllowed(tableName);
|
|
465
|
+
}
|
|
466
|
+
const appSchema = "wasmSchema" in app ? app.wasmSchema : undefined;
|
|
467
|
+
if (appSchema && typeof appSchema === "object") {
|
|
468
|
+
for (const [tableName] of Object.entries(appSchema)) {
|
|
469
|
+
assertSchemaNameAllowed(tableName);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
242
472
|
const fkReferencesByTable = collectFkReferencesByTable(app);
|
|
473
|
+
const tablesWithTypeColumn = collectTablesWithTypeColumn(app);
|
|
243
474
|
const relationsByTable = collectRelationsByTable(app);
|
|
244
|
-
const
|
|
475
|
+
const columnTransformsByTable = Object.create(null);
|
|
476
|
+
for (const table of tableNames) {
|
|
477
|
+
const transforms = app[table]
|
|
478
|
+
?._columnTransforms;
|
|
479
|
+
if (transforms)
|
|
480
|
+
columnTransformsByTable[table] = transforms;
|
|
481
|
+
}
|
|
245
482
|
const rules = [];
|
|
246
483
|
const seenRules = new Set();
|
|
247
484
|
const collectRule = (ruleLike) => {
|
|
@@ -252,15 +489,35 @@ export function definePermissions(app, factory) {
|
|
|
252
489
|
rules.push(ruleLike);
|
|
253
490
|
};
|
|
254
491
|
const ctx = {
|
|
255
|
-
policy: buildPolicyContext(tableNames, relationsByTable, collectRule),
|
|
492
|
+
policy: buildPolicyContext(tableNames, relationsByTable, tablesWithTypeColumn, collectRule, columnTransformsByTable),
|
|
256
493
|
anyOf,
|
|
257
494
|
allOf,
|
|
495
|
+
raw: rawPermissionExpression,
|
|
258
496
|
allowedTo: createAllowedToContext(),
|
|
259
497
|
session: createSessionContext(),
|
|
260
498
|
};
|
|
499
|
+
// Removed in alpha.60; destructuring it names its replacement instead of
|
|
500
|
+
// passing `undefined` on to a rule.
|
|
501
|
+
Object.defineProperty(ctx, "isCreator", {
|
|
502
|
+
enumerable: false,
|
|
503
|
+
get() {
|
|
504
|
+
throw new Error(ISCREATOR_REMOVED);
|
|
505
|
+
},
|
|
506
|
+
});
|
|
261
507
|
factory(ctx);
|
|
262
|
-
|
|
508
|
+
const compiled = compileRules(rules, fkReferencesByTable, relationsByTable);
|
|
509
|
+
for (const [table, policies] of Object.entries(compiled)) {
|
|
510
|
+
for (const operation of [policies.select, policies.insert, policies.update, policies.delete]) {
|
|
511
|
+
validateComputedPermissionReferences(operation?.using, table, columnTransformsByTable);
|
|
512
|
+
validateComputedPermissionReferences(operation?.with_check, table, columnTransformsByTable);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
return compiled;
|
|
263
516
|
}
|
|
517
|
+
const ISCREATOR_REMOVED = "`isCreator` was removed in alpha.60. Write the creator check out as a row condition: " +
|
|
518
|
+
"`{ $createdBy: session.user }` matches rows written through any identity linked to the " +
|
|
519
|
+
"account (including alpha.59 rows imported with an account), and " +
|
|
520
|
+
'`{ "$createdBy.identity": session.identity }` only the exact login.';
|
|
264
521
|
function collectFkReferencesByTable(app) {
|
|
265
522
|
const result = new Map();
|
|
266
523
|
const schema = app.wasmSchema;
|
|
@@ -268,12 +525,12 @@ function collectFkReferencesByTable(app) {
|
|
|
268
525
|
return result;
|
|
269
526
|
}
|
|
270
527
|
const typedSchema = schema;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
528
|
+
for (const [tableName, table] of Object.entries(typedSchema)) {
|
|
529
|
+
if (!table || typeof table !== "object" || !Array.isArray(table.columns)) {
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
275
532
|
const fkColumns = new Map();
|
|
276
|
-
for (const column of table.columns
|
|
533
|
+
for (const column of table.columns) {
|
|
277
534
|
if (column.references) {
|
|
278
535
|
fkColumns.set(column.name, column.references);
|
|
279
536
|
}
|
|
@@ -282,55 +539,74 @@ function collectFkReferencesByTable(app) {
|
|
|
282
539
|
}
|
|
283
540
|
return result;
|
|
284
541
|
}
|
|
285
|
-
function
|
|
542
|
+
function collectTablesWithTypeColumn(app) {
|
|
543
|
+
const result = new Set();
|
|
544
|
+
if (!("wasmSchema" in app)) {
|
|
545
|
+
return result;
|
|
546
|
+
}
|
|
286
547
|
const schema = app.wasmSchema;
|
|
287
548
|
if (!schema || typeof schema !== "object") {
|
|
288
|
-
return
|
|
549
|
+
return result;
|
|
289
550
|
}
|
|
290
551
|
const typedSchema = schema;
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
552
|
+
for (const [tableName, table] of Object.entries(typedSchema)) {
|
|
553
|
+
if (table &&
|
|
554
|
+
Array.isArray(table.columns) &&
|
|
555
|
+
table.columns.some(({ name }) => name === "type")) {
|
|
556
|
+
result.add(tableName);
|
|
557
|
+
}
|
|
296
558
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
559
|
+
return result;
|
|
560
|
+
}
|
|
561
|
+
function collectRelationsByTable(app) {
|
|
562
|
+
const schema = app.wasmSchema;
|
|
563
|
+
if (!schema || typeof schema !== "object") {
|
|
300
564
|
return new Map();
|
|
301
565
|
}
|
|
566
|
+
const typedSchema = schema;
|
|
567
|
+
return analyzeRelations(typedSchema);
|
|
302
568
|
}
|
|
303
|
-
function buildPolicyContext(tableNames, relationsByTable, collectRule) {
|
|
569
|
+
function buildPolicyContext(tableNames, relationsByTable, tablesWithTypeColumn, collectRule, columnTransformsByTable) {
|
|
304
570
|
const context = {};
|
|
305
571
|
for (const table of tableNames) {
|
|
306
|
-
context[table] = buildTablePolicyBuilder(table, relationsByTable, collectRule);
|
|
572
|
+
context[table] = buildTablePolicyBuilder(table, relationsByTable, tablesWithTypeColumn.has(table), collectRule, columnTransformsByTable);
|
|
307
573
|
}
|
|
308
|
-
context.exists = (relation) => ({
|
|
574
|
+
context.exists = (relation) => brandPermissionExpression({
|
|
309
575
|
__jazzPermissionKind: "exists-relation",
|
|
310
576
|
relation,
|
|
311
577
|
});
|
|
578
|
+
context.union = (relations) => createUnionRelation(relations, relationsByTable);
|
|
312
579
|
return context;
|
|
313
580
|
}
|
|
314
|
-
function buildTablePolicyBuilder(table, relationsByTable, collectRule) {
|
|
581
|
+
function buildTablePolicyBuilder(table, relationsByTable, hasTypeColumn, collectRule, columnTransformsByTable) {
|
|
582
|
+
const columnTransforms = columnTransformsByTable[table];
|
|
315
583
|
const registerRule = (rule) => {
|
|
316
584
|
collectRule(rule);
|
|
317
585
|
return rule;
|
|
318
586
|
};
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
587
|
+
const actionBuilder = (action, clause) => {
|
|
588
|
+
const builder = {
|
|
589
|
+
where: ((input) => {
|
|
590
|
+
const condition = resolveRuleInput(`policy.${table}.allow${capitalize(action)}.where`, input, hasTypeColumn, columnTransforms);
|
|
591
|
+
return registerRule(clause === "using"
|
|
592
|
+
? { table, action, using: condition }
|
|
593
|
+
: { table, action, withCheck: condition });
|
|
594
|
+
}),
|
|
595
|
+
always: () => builder.where(alwaysCondition()),
|
|
596
|
+
never: () => builder.where(neverCondition()),
|
|
597
|
+
};
|
|
598
|
+
return builder;
|
|
327
599
|
};
|
|
328
|
-
const
|
|
600
|
+
const read = actionBuilder("read", "using");
|
|
601
|
+
const insert = actionBuilder("insert", "withCheck");
|
|
602
|
+
const del = actionBuilder("delete", "using");
|
|
603
|
+
const relation = () => createTableRelation(table, relationsByTable);
|
|
604
|
+
const updateFactory = () => new UpdateRuleBuilder(table, hasTypeColumn, collectRule, columnTransforms);
|
|
329
605
|
const exists = {
|
|
330
|
-
where: (input) => ({
|
|
606
|
+
where: (input) => brandPermissionExpression({
|
|
331
607
|
__jazzPermissionKind: "exists",
|
|
332
608
|
table,
|
|
333
|
-
where: normalizeWhereObject(input),
|
|
609
|
+
where: normalizeWhereObject(input, hasTypeColumn),
|
|
334
610
|
}),
|
|
335
611
|
};
|
|
336
612
|
return {
|
|
@@ -349,18 +625,12 @@ function buildTablePolicyBuilder(table, relationsByTable, collectRule) {
|
|
|
349
625
|
return updateFactory();
|
|
350
626
|
},
|
|
351
627
|
exists,
|
|
352
|
-
where(input)
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
hopTo(relation) {
|
|
359
|
-
return createTableRelation(table, relationsByTable).hopTo(relation);
|
|
360
|
-
},
|
|
361
|
-
gather(options) {
|
|
362
|
-
return createTableRelation(table, relationsByTable).gather(options);
|
|
363
|
-
},
|
|
628
|
+
where: (input) => relation().where(input),
|
|
629
|
+
select: (columns) => relation().select(columns),
|
|
630
|
+
hopTo: (name) => relation().hopTo(name),
|
|
631
|
+
gather: (options) => relation().gather(options),
|
|
632
|
+
reachable_via: (...args) => relation().reachable_via(...args),
|
|
633
|
+
reachable_via_with_access_filters: (...args) => relation().reachable_via_with_access_filters(...args),
|
|
364
634
|
};
|
|
365
635
|
}
|
|
366
636
|
function createTableRelation(table, relationsByTable) {
|
|
@@ -368,8 +638,9 @@ function createTableRelation(table, relationsByTable) {
|
|
|
368
638
|
kind: "table",
|
|
369
639
|
outputTable: table,
|
|
370
640
|
base: {
|
|
371
|
-
|
|
372
|
-
|
|
641
|
+
TableScan: {
|
|
642
|
+
table,
|
|
643
|
+
},
|
|
373
644
|
},
|
|
374
645
|
initialScope: table,
|
|
375
646
|
filters: [],
|
|
@@ -377,6 +648,124 @@ function createTableRelation(table, relationsByTable) {
|
|
|
377
648
|
selectMap: undefined,
|
|
378
649
|
}, relationsByTable);
|
|
379
650
|
}
|
|
651
|
+
function createUnionRelation(relations, relationsByTable) {
|
|
652
|
+
if (relations.length === 0) {
|
|
653
|
+
throw new Error("union(...) requires at least one relation.");
|
|
654
|
+
}
|
|
655
|
+
const states = relations.map((relation) => getRelationState(relation));
|
|
656
|
+
const firstState = states[0];
|
|
657
|
+
if (!firstState) {
|
|
658
|
+
throw new Error("union(...) requires at least one relation.");
|
|
659
|
+
}
|
|
660
|
+
if (states.some((state) => state.outputTable !== firstState.outputTable)) {
|
|
661
|
+
throw new Error("union(...) requires all relations to output the same table.");
|
|
662
|
+
}
|
|
663
|
+
if (states.some((state) => state.selectMap && Object.keys(state.selectMap).length > 0)) {
|
|
664
|
+
throw new Error("union(...) does not support select(...) relations in MVP.");
|
|
665
|
+
}
|
|
666
|
+
return new PermissionRelationBuilder({
|
|
667
|
+
kind: "union",
|
|
668
|
+
outputTable: firstState.outputTable,
|
|
669
|
+
base: {
|
|
670
|
+
Union: {
|
|
671
|
+
inputs: states.map((state) => {
|
|
672
|
+
const input = relationStateToRelExpr(state);
|
|
673
|
+
return {
|
|
674
|
+
label: `permission:${bytesToHex(sha256(new TextEncoder().encode(JSON.stringify(input))))}`,
|
|
675
|
+
input,
|
|
676
|
+
};
|
|
677
|
+
}),
|
|
678
|
+
},
|
|
679
|
+
},
|
|
680
|
+
initialScope: "",
|
|
681
|
+
filters: [],
|
|
682
|
+
joins: [],
|
|
683
|
+
selectMap: undefined,
|
|
684
|
+
}, relationsByTable);
|
|
685
|
+
}
|
|
686
|
+
function buildGatherSeedState(state, start, relationsByTable) {
|
|
687
|
+
if (start === undefined) {
|
|
688
|
+
return state;
|
|
689
|
+
}
|
|
690
|
+
if (isPermissionRelation(start)) {
|
|
691
|
+
const seedState = getRelationState(start);
|
|
692
|
+
if (seedState.outputTable !== state.outputTable) {
|
|
693
|
+
throw new Error(`gather(...) explicit relation seed must output "${state.outputTable}" rows, got "${seedState.outputTable}".`);
|
|
694
|
+
}
|
|
695
|
+
return seedState;
|
|
696
|
+
}
|
|
697
|
+
const joins = [...state.joins];
|
|
698
|
+
const filters = [...state.filters];
|
|
699
|
+
collectQualifiedWhere(resolveRelationWhereInput(start), state.outputTable, currentRelationScope(state), state.kind, relationsByTable, { joins, filters }, { subject: "gather(...) qualified start", alternative: "explicit relation seed" });
|
|
700
|
+
return {
|
|
701
|
+
...state,
|
|
702
|
+
joins,
|
|
703
|
+
filters,
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Adds a filter per entry of `where` to `into`. A column qualified with another
|
|
708
|
+
* table name is resolved through the single direct relation from `outputTable`
|
|
709
|
+
* to that table, joined once per qualifying table. Returns whether any column
|
|
710
|
+
* was qualified.
|
|
711
|
+
*/
|
|
712
|
+
function collectQualifiedWhere(where, outputTable, baseScope, kind, relationsByTable, into, errors) {
|
|
713
|
+
const { joins, filters } = into;
|
|
714
|
+
const qualifiedRelationByPrefix = new Map();
|
|
715
|
+
const qualifiedScopeByPrefix = new Map();
|
|
716
|
+
const ambiguous = (prefix) => new Error(`${errors.subject} table "${prefix}" is ambiguous from "${outputTable}"; use an ${errors.alternative} instead.`);
|
|
717
|
+
let hasQualifiedFilters = false;
|
|
718
|
+
for (const [column, raw] of Object.entries(where)) {
|
|
719
|
+
if (raw === undefined) {
|
|
720
|
+
continue;
|
|
721
|
+
}
|
|
722
|
+
const [prefix, bare] = splitQualifiedColumn(column);
|
|
723
|
+
if (!prefix || prefix === outputTable) {
|
|
724
|
+
filters.push({ column: bare, raw, scope: baseScope });
|
|
725
|
+
continue;
|
|
726
|
+
}
|
|
727
|
+
hasQualifiedFilters = true;
|
|
728
|
+
const candidates = (relationsByTable.get(outputTable) ?? []).filter((relation) => relation.toTable === prefix);
|
|
729
|
+
if (candidates.length === 0) {
|
|
730
|
+
throw new Error(`${errors.subject} column "${prefix}.${bare}" does not match a direct relation from "${outputTable}".`);
|
|
731
|
+
}
|
|
732
|
+
const matching = candidates.length === 1
|
|
733
|
+
? candidates
|
|
734
|
+
: candidates.filter((relation) => relation.type === "forward" ? relation.fromColumn === bare : relation.toColumn === bare);
|
|
735
|
+
if (matching.length !== 1)
|
|
736
|
+
throw ambiguous(prefix);
|
|
737
|
+
const relation = matching[0];
|
|
738
|
+
const existingRelation = qualifiedRelationByPrefix.get(prefix);
|
|
739
|
+
if (existingRelation && existingRelation.name !== relation.name)
|
|
740
|
+
throw ambiguous(prefix);
|
|
741
|
+
qualifiedRelationByPrefix.set(prefix, relation);
|
|
742
|
+
let scope = qualifiedScopeByPrefix.get(prefix);
|
|
743
|
+
if (!scope) {
|
|
744
|
+
const join = relationToJoinSpec(relation, baseScope);
|
|
745
|
+
joins.push(join);
|
|
746
|
+
scope = relationJoinAlias(kind, join, joins.length - 1);
|
|
747
|
+
qualifiedScopeByPrefix.set(prefix, scope);
|
|
748
|
+
}
|
|
749
|
+
filters.push({ column: bare, raw, scope });
|
|
750
|
+
}
|
|
751
|
+
return hasQualifiedFilters;
|
|
752
|
+
}
|
|
753
|
+
function relationToJoinSpec(relation, leftScope) {
|
|
754
|
+
if (relation.type === "forward") {
|
|
755
|
+
return {
|
|
756
|
+
table: relation.toTable,
|
|
757
|
+
leftScope,
|
|
758
|
+
left: relation.fromColumn,
|
|
759
|
+
right: "id",
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
return {
|
|
763
|
+
table: relation.toTable,
|
|
764
|
+
leftScope,
|
|
765
|
+
left: "id",
|
|
766
|
+
right: relation.toColumn,
|
|
767
|
+
};
|
|
768
|
+
}
|
|
380
769
|
function relationJoinTargetToTable(target) {
|
|
381
770
|
if (typeof target === "string") {
|
|
382
771
|
return target;
|
|
@@ -386,11 +775,35 @@ function relationJoinTargetToTable(target) {
|
|
|
386
775
|
typeof target.__jazzPermissionTable === "string") {
|
|
387
776
|
return target.__jazzPermissionTable;
|
|
388
777
|
}
|
|
389
|
-
throw new Error("join(...) expects a table builder (policy.<table>) or table name string.");
|
|
778
|
+
throw new Error("join(...) expects a table relation, table builder (policy.<table>), or table name string.");
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* A relation target is deliberately narrower than a normal relation. The
|
|
782
|
+
* lowering embeds it directly as the right side of the join, so it has no
|
|
783
|
+
* opportunity to allocate aliases for another relation tree. Keep that
|
|
784
|
+
* contract explicit until the lowering grows fresh alias rebinding.
|
|
785
|
+
*/
|
|
786
|
+
function validateFilteredJoinRelation(relation, leftState) {
|
|
787
|
+
const state = getRelationState(relation);
|
|
788
|
+
if (state.kind !== "table") {
|
|
789
|
+
throw new Error("join(...) relation RHS must be a filtered single-table relation; union(...) and gather(...) RHS are unsupported.");
|
|
790
|
+
}
|
|
791
|
+
if (state.joins.length > 0) {
|
|
792
|
+
throw new Error("join(...) relation RHS must be a filtered single-table relation; nested join(...) and hopTo(...) RHS are unsupported.");
|
|
793
|
+
}
|
|
794
|
+
if (state.selectMap && Object.keys(state.selectMap).length > 0) {
|
|
795
|
+
throw new Error("join(...) relation RHS must be a filtered single-table relation; select(...) RHS are unsupported.");
|
|
796
|
+
}
|
|
797
|
+
if (state.filters.length === 0) {
|
|
798
|
+
throw new Error("join(...) relation RHS must include where(...); pass policy.<table> directly for an unfiltered join.");
|
|
799
|
+
}
|
|
800
|
+
if (accumulatedRelationScopes(leftState).has(state.initialScope)) {
|
|
801
|
+
throw new Error(`join(...) cannot use filtered relation scope "${state.initialScope}" because that scope is already present in the left relation. Use a distinct scope or wait for aliased relation joins.`);
|
|
802
|
+
}
|
|
803
|
+
return state;
|
|
390
804
|
}
|
|
391
805
|
function resolveNamedRelation(relationsByTable, table, relationName) {
|
|
392
|
-
const
|
|
393
|
-
const relation = relations.find((candidate) => candidate.name === relationName);
|
|
806
|
+
const relation = (relationsByTable.get(table) ?? []).find((candidate) => candidate.name === relationName);
|
|
394
807
|
if (!relation) {
|
|
395
808
|
throw new Error(`Unknown relation "${relationName}" on table "${table}".`);
|
|
396
809
|
}
|
|
@@ -408,20 +821,78 @@ function isRecursiveCurrentFilter(raw, token) {
|
|
|
408
821
|
}
|
|
409
822
|
function resolveRelationWhereInput(input) {
|
|
410
823
|
if (typeof input === "function") {
|
|
824
|
+
// Relation callbacks reference the enclosing policy row, whose table is not known yet.
|
|
411
825
|
return resolveRelationWhereInput(input(createRowContext()));
|
|
412
826
|
}
|
|
413
827
|
return normalizeWhereObject(input);
|
|
414
828
|
}
|
|
415
|
-
function
|
|
829
|
+
function currentRelationScope(state) {
|
|
830
|
+
if (state.joins.length === 0) {
|
|
831
|
+
return state.initialScope;
|
|
832
|
+
}
|
|
833
|
+
const joinIndex = state.joins.length - 1;
|
|
834
|
+
const join = state.joins[joinIndex];
|
|
835
|
+
return relationJoinScope(state, join, joinIndex);
|
|
836
|
+
}
|
|
837
|
+
function relationJoinScope(state, join, index) {
|
|
838
|
+
return join.relation
|
|
839
|
+
? currentRelationScope(getRelationState(join.relation))
|
|
840
|
+
: relationJoinAlias(state.kind, join, index);
|
|
841
|
+
}
|
|
842
|
+
function accumulatedRelationScopes(state) {
|
|
843
|
+
const scopes = new Set();
|
|
844
|
+
if (state.initialScope) {
|
|
845
|
+
scopes.add(state.initialScope);
|
|
846
|
+
}
|
|
847
|
+
state.joins.forEach((join, index) => {
|
|
848
|
+
scopes.add(relationJoinScope(state, join, index));
|
|
849
|
+
});
|
|
850
|
+
return scopes;
|
|
851
|
+
}
|
|
852
|
+
function extractRelationFilters(where, state) {
|
|
416
853
|
const filters = [];
|
|
854
|
+
const defaultScope = currentRelationScope(state);
|
|
417
855
|
for (const [column, raw] of Object.entries(where)) {
|
|
418
856
|
if (raw === undefined) {
|
|
419
857
|
continue;
|
|
420
858
|
}
|
|
421
|
-
|
|
859
|
+
const [prefix, bare] = splitQualifiedColumn(column);
|
|
860
|
+
filters.push({
|
|
861
|
+
column: bare,
|
|
862
|
+
raw,
|
|
863
|
+
scope: prefix ? resolveQualifiedRelationFilterScope(state, prefix, bare) : defaultScope,
|
|
864
|
+
});
|
|
422
865
|
}
|
|
423
866
|
return filters;
|
|
424
867
|
}
|
|
868
|
+
function relationBaseScopeBinding(state) {
|
|
869
|
+
if (!state.initialScope) {
|
|
870
|
+
return null;
|
|
871
|
+
}
|
|
872
|
+
return {
|
|
873
|
+
table: state.initialScope,
|
|
874
|
+
scope: state.initialScope,
|
|
875
|
+
};
|
|
876
|
+
}
|
|
877
|
+
function resolveQualifiedRelationFilterScope(state, qualifiedTable, column) {
|
|
878
|
+
const scopes = new Set();
|
|
879
|
+
const baseBinding = relationBaseScopeBinding(state);
|
|
880
|
+
if (baseBinding && baseBinding.table === qualifiedTable) {
|
|
881
|
+
scopes.add(baseBinding.scope);
|
|
882
|
+
}
|
|
883
|
+
state.joins.forEach((join, index) => {
|
|
884
|
+
if (join.table === qualifiedTable) {
|
|
885
|
+
scopes.add(relationJoinScope(state, join, index));
|
|
886
|
+
}
|
|
887
|
+
});
|
|
888
|
+
if (scopes.size === 0) {
|
|
889
|
+
throw new Error(`Qualified relation where(...) column "${qualifiedTable}.${column}" does not match the current relation scopes.`);
|
|
890
|
+
}
|
|
891
|
+
if (scopes.size > 1) {
|
|
892
|
+
throw new Error(`Qualified relation where(...) table "${qualifiedTable}" is ambiguous in the current relation; use an unambiguous relation shape instead.`);
|
|
893
|
+
}
|
|
894
|
+
return scopes.values().next().value;
|
|
895
|
+
}
|
|
425
896
|
function normalizeRelationSelectMap(columns) {
|
|
426
897
|
if (!isPlainObject(columns)) {
|
|
427
898
|
throw new Error("select(...) expects an object map: { alias: column }.");
|
|
@@ -447,8 +918,8 @@ function normalizeRecursiveRelationDepth(maxDepth) {
|
|
|
447
918
|
if (maxDepth === undefined) {
|
|
448
919
|
return RECURSIVE_POLICY_MAX_DEPTH_DEFAULT;
|
|
449
920
|
}
|
|
450
|
-
if (!Number.isInteger(maxDepth) || maxDepth
|
|
451
|
-
throw new Error("gather(...) maxDepth must be a
|
|
921
|
+
if (!Number.isInteger(maxDepth) || maxDepth < 0) {
|
|
922
|
+
throw new Error("gather(...) maxDepth must be a non-negative integer.");
|
|
452
923
|
}
|
|
453
924
|
if (maxDepth > RECURSIVE_POLICY_MAX_DEPTH_HARD_CAP) {
|
|
454
925
|
throw new Error(`gather(...) maxDepth ${maxDepth} exceeds hard cap ${RECURSIVE_POLICY_MAX_DEPTH_HARD_CAP}.`);
|
|
@@ -461,170 +932,114 @@ function getRelationState(relation) {
|
|
|
461
932
|
}
|
|
462
933
|
throw new Error("Expected a relation built from policy.<table> with where/join/hopTo/gather.");
|
|
463
934
|
}
|
|
935
|
+
function isPermissionRelation(value) {
|
|
936
|
+
return value instanceof PermissionRelationBuilder;
|
|
937
|
+
}
|
|
464
938
|
function relationColumnRef(column, defaultScope) {
|
|
465
939
|
const [prefix, bare] = splitQualifiedColumn(column);
|
|
466
940
|
if (prefix) {
|
|
467
941
|
return { scope: prefix, column: bare };
|
|
468
942
|
}
|
|
469
|
-
return { scope: defaultScope, column: bare };
|
|
943
|
+
return defaultScope ? { scope: defaultScope, column: bare } : { column: bare };
|
|
470
944
|
}
|
|
471
945
|
function toRelValueRef(value, options) {
|
|
472
946
|
if (isSessionRefValue(value)) {
|
|
473
|
-
return {
|
|
947
|
+
return { SessionRef: value.path };
|
|
474
948
|
}
|
|
475
949
|
if (isRowRefValue(value)) {
|
|
476
950
|
if (!options.allowRowRefs) {
|
|
477
951
|
throw new Error("Row references are only valid inside exists() clauses.");
|
|
478
952
|
}
|
|
479
953
|
return {
|
|
480
|
-
|
|
481
|
-
column: { column: value.column },
|
|
954
|
+
OuterColumn: { column: value.column },
|
|
482
955
|
};
|
|
483
956
|
}
|
|
484
|
-
return {
|
|
957
|
+
return { Literal: value };
|
|
485
958
|
}
|
|
486
|
-
function relationFilterToPredicates(filter
|
|
487
|
-
const left = relationColumnRef(filter.column,
|
|
959
|
+
function relationFilterToPredicates(filter) {
|
|
960
|
+
const left = relationColumnRef(filter.column, filter.scope);
|
|
488
961
|
const raw = filter.raw;
|
|
489
962
|
if (raw === null) {
|
|
490
|
-
return [{
|
|
963
|
+
return [{ IsNull: { column: left } }];
|
|
491
964
|
}
|
|
492
965
|
if (isSessionRefValue(raw) || isRowRefValue(raw)) {
|
|
493
966
|
return [
|
|
494
967
|
{
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
968
|
+
Cmp: {
|
|
969
|
+
left,
|
|
970
|
+
op: "Eq",
|
|
971
|
+
right: toRelValueRef(raw, { allowRowRefs: true }),
|
|
972
|
+
},
|
|
499
973
|
},
|
|
500
974
|
];
|
|
501
975
|
}
|
|
502
976
|
if (!isPlainObject(raw)) {
|
|
503
977
|
return [
|
|
504
978
|
{
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
979
|
+
Cmp: {
|
|
980
|
+
left,
|
|
981
|
+
op: "Eq",
|
|
982
|
+
right: { Literal: raw },
|
|
983
|
+
},
|
|
509
984
|
},
|
|
510
985
|
];
|
|
511
986
|
}
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
case "ne":
|
|
532
|
-
if (value === null) {
|
|
533
|
-
predicates.push({ type: "IsNotNull", column: left });
|
|
534
|
-
}
|
|
535
|
-
else {
|
|
536
|
-
predicates.push({
|
|
537
|
-
type: "Cmp",
|
|
538
|
-
left,
|
|
539
|
-
op: "Ne",
|
|
540
|
-
right: toRelValueRef(value, { allowRowRefs: true }),
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
break;
|
|
544
|
-
case "gt":
|
|
545
|
-
predicates.push({
|
|
546
|
-
type: "Cmp",
|
|
547
|
-
left,
|
|
548
|
-
op: "Gt",
|
|
549
|
-
right: toRelValueRef(value, { allowRowRefs: true }),
|
|
550
|
-
});
|
|
551
|
-
break;
|
|
552
|
-
case "gte":
|
|
553
|
-
predicates.push({
|
|
554
|
-
type: "Cmp",
|
|
555
|
-
left,
|
|
556
|
-
op: "Ge",
|
|
557
|
-
right: toRelValueRef(value, { allowRowRefs: true }),
|
|
558
|
-
});
|
|
559
|
-
break;
|
|
560
|
-
case "lt":
|
|
561
|
-
predicates.push({
|
|
562
|
-
type: "Cmp",
|
|
563
|
-
left,
|
|
564
|
-
op: "Lt",
|
|
565
|
-
right: toRelValueRef(value, { allowRowRefs: true }),
|
|
566
|
-
});
|
|
567
|
-
break;
|
|
568
|
-
case "lte":
|
|
569
|
-
predicates.push({
|
|
570
|
-
type: "Cmp",
|
|
571
|
-
left,
|
|
572
|
-
op: "Le",
|
|
573
|
-
right: toRelValueRef(value, { allowRowRefs: true }),
|
|
574
|
-
});
|
|
575
|
-
break;
|
|
576
|
-
case "isNull":
|
|
577
|
-
if (typeof value !== "boolean") {
|
|
578
|
-
throw new Error(`"${filter.column}.isNull" expects a boolean value.`);
|
|
579
|
-
}
|
|
580
|
-
predicates.push(value ? { type: "IsNull", column: left } : { type: "IsNotNull", column: left });
|
|
581
|
-
break;
|
|
582
|
-
case "in":
|
|
583
|
-
if (!Array.isArray(value)) {
|
|
584
|
-
throw new Error(`"${filter.column}.in" expects an array value.`);
|
|
585
|
-
}
|
|
586
|
-
predicates.push({
|
|
587
|
-
type: "In",
|
|
588
|
-
left,
|
|
589
|
-
values: value.map((entry) => toRelValueRef(entry, { allowRowRefs: true })),
|
|
590
|
-
});
|
|
591
|
-
break;
|
|
592
|
-
case "contains":
|
|
593
|
-
predicates.push({
|
|
594
|
-
type: "Contains",
|
|
595
|
-
left,
|
|
596
|
-
value: toRelValueRef(value, { allowRowRefs: true }),
|
|
597
|
-
});
|
|
598
|
-
break;
|
|
599
|
-
default:
|
|
600
|
-
throw new Error(`Unsupported where operator "${op}" in relation IR lowering.`);
|
|
601
|
-
}
|
|
987
|
+
const right = (value) => toRelValueRef(value, { allowRowRefs: true });
|
|
988
|
+
return lowerWhereOperators(raw, {
|
|
989
|
+
isNull: (isNull) => (isNull ? { IsNull: { column: left } } : { IsNotNull: { column: left } }),
|
|
990
|
+
cmp: (op, value) => ({ Cmp: { left, op, right: right(value) } }),
|
|
991
|
+
contains: (value) => ({ Contains: { left, right: right(value) } }),
|
|
992
|
+
in: (value) => {
|
|
993
|
+
if (!Array.isArray(value)) {
|
|
994
|
+
throw new Error(`"${filter.column}.in" expects an array value.`);
|
|
995
|
+
}
|
|
996
|
+
return { In: { left, values: value.map(right) } };
|
|
997
|
+
},
|
|
998
|
+
isNullError: `"${filter.column}.isNull" expects a boolean value.`,
|
|
999
|
+
unsupported: (op) => `Unsupported where operator "${op}" in relation IR lowering.`,
|
|
1000
|
+
empty: "True",
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
function whereObjectToRelationPredicates(where, defaultScope) {
|
|
1004
|
+
if (!where) {
|
|
1005
|
+
return [];
|
|
602
1006
|
}
|
|
603
|
-
return
|
|
1007
|
+
return Object.entries(where).flatMap(([column, raw]) => {
|
|
1008
|
+
if (raw === undefined) {
|
|
1009
|
+
return [];
|
|
1010
|
+
}
|
|
1011
|
+
const [prefix, bare] = splitQualifiedColumn(column);
|
|
1012
|
+
return relationFilterToPredicates({
|
|
1013
|
+
column: bare,
|
|
1014
|
+
raw,
|
|
1015
|
+
scope: prefix ?? defaultScope,
|
|
1016
|
+
});
|
|
1017
|
+
});
|
|
604
1018
|
}
|
|
605
1019
|
function andRelPredicates(predicates) {
|
|
606
1020
|
if (predicates.length === 0) {
|
|
607
|
-
return
|
|
1021
|
+
return "True";
|
|
608
1022
|
}
|
|
609
1023
|
if (predicates.length === 1) {
|
|
610
1024
|
return predicates[0];
|
|
611
1025
|
}
|
|
612
|
-
return {
|
|
1026
|
+
return { And: predicates };
|
|
613
1027
|
}
|
|
614
1028
|
function applyRelFilter(input, predicates) {
|
|
615
1029
|
const predicate = andRelPredicates(predicates);
|
|
616
|
-
if (predicate
|
|
1030
|
+
if (predicate === "True") {
|
|
617
1031
|
return input;
|
|
618
1032
|
}
|
|
619
1033
|
return {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
1034
|
+
Filter: {
|
|
1035
|
+
input,
|
|
1036
|
+
predicate,
|
|
1037
|
+
},
|
|
623
1038
|
};
|
|
624
1039
|
}
|
|
625
|
-
function joinConditionFromSpec(join,
|
|
1040
|
+
function joinConditionFromSpec(join, rightScope) {
|
|
626
1041
|
return {
|
|
627
|
-
left: relationColumnRef(join.left, leftScope),
|
|
1042
|
+
left: relationColumnRef(join.left, join.leftScope),
|
|
628
1043
|
right: relationColumnRef(join.right, rightScope),
|
|
629
1044
|
};
|
|
630
1045
|
}
|
|
@@ -633,8 +1048,7 @@ function projectHopResult(scope) {
|
|
|
633
1048
|
{
|
|
634
1049
|
alias: "id",
|
|
635
1050
|
expr: {
|
|
636
|
-
|
|
637
|
-
column: { scope, column: "id" },
|
|
1051
|
+
Column: { scope, column: "id" },
|
|
638
1052
|
},
|
|
639
1053
|
},
|
|
640
1054
|
];
|
|
@@ -645,41 +1059,48 @@ function applyRelationTail(options) {
|
|
|
645
1059
|
let hasHopJoin = false;
|
|
646
1060
|
for (let i = 0; i < options.joins.length; i += 1) {
|
|
647
1061
|
const join = options.joins[i];
|
|
648
|
-
const
|
|
1062
|
+
const rightState = join.relation ? getRelationState(join.relation) : undefined;
|
|
1063
|
+
const rightScope = rightState ? currentRelationScope(rightState) : options.joinAlias(join, i);
|
|
649
1064
|
relation = {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
1065
|
+
Join: {
|
|
1066
|
+
left: relation,
|
|
1067
|
+
right: rightState
|
|
1068
|
+
? relationStateToRelExpr(rightState)
|
|
1069
|
+
: {
|
|
1070
|
+
TableScan: {
|
|
1071
|
+
table: join.table,
|
|
1072
|
+
alias: rightScope,
|
|
1073
|
+
},
|
|
1074
|
+
},
|
|
1075
|
+
on: [joinConditionFromSpec(join, rightScope)],
|
|
1076
|
+
join_kind: "Inner",
|
|
655
1077
|
},
|
|
656
|
-
on: [joinConditionFromSpec(join, defaultScope, rightScope)],
|
|
657
|
-
joinKind: "Inner",
|
|
658
1078
|
};
|
|
659
1079
|
defaultScope = rightScope;
|
|
660
1080
|
hasHopJoin ||= Boolean(join.viaHop);
|
|
661
1081
|
}
|
|
662
|
-
const predicates = options.filters.flatMap((filter) => relationFilterToPredicates(filter
|
|
1082
|
+
const predicates = options.filters.flatMap((filter) => relationFilterToPredicates(filter));
|
|
663
1083
|
relation = applyRelFilter(relation, predicates);
|
|
664
1084
|
if (options.selectMap && Object.keys(options.selectMap).length > 0) {
|
|
665
1085
|
const columns = Object.entries(options.selectMap).map(([alias, column]) => ({
|
|
666
1086
|
alias,
|
|
667
1087
|
expr: {
|
|
668
|
-
|
|
669
|
-
column: relationColumnRef(column, defaultScope),
|
|
1088
|
+
Column: relationColumnRef(column, defaultScope),
|
|
670
1089
|
},
|
|
671
1090
|
}));
|
|
672
1091
|
relation = {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
1092
|
+
Project: {
|
|
1093
|
+
input: relation,
|
|
1094
|
+
columns,
|
|
1095
|
+
},
|
|
676
1096
|
};
|
|
677
1097
|
}
|
|
678
1098
|
else if (hasHopJoin) {
|
|
679
1099
|
relation = {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
1100
|
+
Project: {
|
|
1101
|
+
input: relation,
|
|
1102
|
+
columns: projectHopResult(defaultScope),
|
|
1103
|
+
},
|
|
683
1104
|
};
|
|
684
1105
|
}
|
|
685
1106
|
return relation;
|
|
@@ -691,23 +1112,28 @@ function relationStateToRelExpr(state) {
|
|
|
691
1112
|
joins: state.joins,
|
|
692
1113
|
filters: state.filters,
|
|
693
1114
|
selectMap: state.selectMap,
|
|
694
|
-
joinAlias: (join, index) => state.kind
|
|
695
|
-
? `__recursive_join_${index}`
|
|
696
|
-
: join.viaHop
|
|
697
|
-
? `__hop_${index}`
|
|
698
|
-
: `__join_${index}`,
|
|
1115
|
+
joinAlias: (join, index) => relationJoinAlias(state.kind, join, index),
|
|
699
1116
|
});
|
|
700
1117
|
}
|
|
701
1118
|
export function relationToIr(relation) {
|
|
702
1119
|
return relationStateToRelExpr(getRelationState(relation));
|
|
703
1120
|
}
|
|
704
1121
|
export function relationExistsToPolicy(relation) {
|
|
705
|
-
return {
|
|
1122
|
+
return brandPermissionExpression({
|
|
706
1123
|
type: "ExistsRel",
|
|
707
1124
|
rel: relationToIr(relation),
|
|
708
|
-
};
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* Marks manually-authored policy IR as an expression rather than a row
|
|
1129
|
+
* predicate. Prefer the typed DSL helpers when one is available.
|
|
1130
|
+
*/
|
|
1131
|
+
export function rawPermissionExpression(expression) {
|
|
1132
|
+
return brandPermissionExpression({ ...expression });
|
|
709
1133
|
}
|
|
710
1134
|
function splitQualifiedColumn(column) {
|
|
1135
|
+
if (column.startsWith("$"))
|
|
1136
|
+
return [undefined, column];
|
|
711
1137
|
const dotIndex = column.indexOf(".");
|
|
712
1138
|
if (dotIndex < 0) {
|
|
713
1139
|
return [undefined, column];
|
|
@@ -718,56 +1144,77 @@ function stripQualifier(column) {
|
|
|
718
1144
|
const [, bare] = splitQualifiedColumn(column);
|
|
719
1145
|
return bare;
|
|
720
1146
|
}
|
|
721
|
-
|
|
722
|
-
|
|
1147
|
+
/** @internal */
|
|
1148
|
+
export function createSessionContext() {
|
|
1149
|
+
const claimRef = (...path) => ({
|
|
723
1150
|
__jazzPermissionKind: "session-ref",
|
|
724
|
-
path
|
|
1151
|
+
path,
|
|
725
1152
|
});
|
|
1153
|
+
const user = claimRef("user");
|
|
1154
|
+
// `session.user` is the account itself now: name the replacement for the
|
|
1155
|
+
// parts it used to have instead of building a policy on `undefined`.
|
|
1156
|
+
for (const [part, replacement] of [
|
|
1157
|
+
["account", "session.user, which is the account"],
|
|
1158
|
+
["identity", "session.identity, the exact login"],
|
|
1159
|
+
]) {
|
|
1160
|
+
Object.defineProperty(user, part, {
|
|
1161
|
+
enumerable: false,
|
|
1162
|
+
get() {
|
|
1163
|
+
throw new Error(`session.user.${part} was removed: use ${replacement}.`);
|
|
1164
|
+
},
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
const identity = Object.assign(claimRef("identity"), {
|
|
1168
|
+
issuer: claimRef("identity", "issuer"),
|
|
1169
|
+
subject: claimRef("identity", "subject"),
|
|
1170
|
+
});
|
|
1171
|
+
const whereBuilder = Object.assign((input) => brandPermissionExpression({
|
|
1172
|
+
__jazzPermissionKind: "session-where",
|
|
1173
|
+
where: normalizeWhereObject(input),
|
|
1174
|
+
}), claimRef("where"));
|
|
726
1175
|
return new Proxy({}, {
|
|
727
1176
|
get(_target, prop, _receiver) {
|
|
728
1177
|
if (typeof prop === "string") {
|
|
729
|
-
|
|
1178
|
+
if (prop === "where") {
|
|
1179
|
+
return whereBuilder;
|
|
1180
|
+
}
|
|
1181
|
+
if (prop === "claims") {
|
|
1182
|
+
return new Proxy({}, {
|
|
1183
|
+
get(_claims, claim) {
|
|
1184
|
+
return typeof claim === "string" ? claimRef("claims", claim) : undefined;
|
|
1185
|
+
},
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
if (prop === "user")
|
|
1189
|
+
return user;
|
|
1190
|
+
if (prop === "identity")
|
|
1191
|
+
return identity;
|
|
1192
|
+
if (prop === "authMode")
|
|
1193
|
+
return claimRef(prop);
|
|
1194
|
+
throw new Error(`Unknown session property ${prop}; raw provider claims must use session.claims["${prop}"]`);
|
|
730
1195
|
}
|
|
731
1196
|
return undefined;
|
|
732
1197
|
},
|
|
733
1198
|
});
|
|
734
1199
|
}
|
|
735
1200
|
function createAllowedToContext() {
|
|
736
|
-
const inheritsExpr = (operation,
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
if (!Number.isInteger(maxDepth) || maxDepth <= 0) {
|
|
740
|
-
throw new Error(`allowedTo.*("${fkColumn}") maxDepth must be a positive integer.`);
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
const expr = {
|
|
744
|
-
type: "Inherits",
|
|
745
|
-
operation,
|
|
746
|
-
via_column: fkColumn,
|
|
747
|
-
};
|
|
748
|
-
if (maxDepth !== undefined) {
|
|
749
|
-
expr.max_depth = maxDepth;
|
|
1201
|
+
const inheritsExpr = (operation, relation, options, sourceTable) => {
|
|
1202
|
+
if (typeof relation !== "string" || !relation.length) {
|
|
1203
|
+
throw new Error("allowedTo requires a non-empty declared relationship name.");
|
|
750
1204
|
}
|
|
751
|
-
return expr;
|
|
752
|
-
};
|
|
753
|
-
const inheritsReferencingExpr = (operation, sourceTable, fkColumn, options) => {
|
|
754
1205
|
const maxDepth = options?.maxDepth;
|
|
755
|
-
if (maxDepth !== undefined) {
|
|
756
|
-
|
|
757
|
-
throw new Error(`allowedTo.*Referencing(..., "${fkColumn}") maxDepth must be a positive integer.`);
|
|
758
|
-
}
|
|
1206
|
+
if (maxDepth !== undefined && (!Number.isInteger(maxDepth) || maxDepth < 0)) {
|
|
1207
|
+
throw new Error(`allowedTo.*("${relation}") maxDepth must be a non-negative integer.`);
|
|
759
1208
|
}
|
|
760
|
-
|
|
761
|
-
|
|
1209
|
+
return brandPermissionExpression({
|
|
1210
|
+
__jazzPermissionKind: "allowed-relation",
|
|
762
1211
|
operation,
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
expr.max_depth = maxDepth;
|
|
768
|
-
}
|
|
769
|
-
return expr;
|
|
1212
|
+
relation,
|
|
1213
|
+
sourceTable,
|
|
1214
|
+
maxDepth,
|
|
1215
|
+
});
|
|
770
1216
|
};
|
|
1217
|
+
const inheritsReferencingExpr = (operation, sourceTable, relation, options) => inheritsExpr(operation, relation, options, relationJoinTargetToTable(sourceTable));
|
|
771
1218
|
return {
|
|
772
1219
|
read(fkColumn, options) {
|
|
773
1220
|
return inheritsExpr("Select", fkColumn, options);
|
|
@@ -799,10 +1246,88 @@ function normalizeSessionPath(path) {
|
|
|
799
1246
|
const parts = Array.isArray(path) ? path : path.split(".");
|
|
800
1247
|
return parts.map((part) => part.trim()).filter((part) => part.length > 0);
|
|
801
1248
|
}
|
|
802
|
-
function
|
|
1249
|
+
function assertStoredPermissionReference(column, transforms) {
|
|
1250
|
+
if (transforms?.[column]?.computed)
|
|
1251
|
+
throw new TypeError(`Computed field "${column}" cannot be referenced in permission policies.`);
|
|
1252
|
+
}
|
|
1253
|
+
/** Check outer references only once a relation is attached to its owning policy. */
|
|
1254
|
+
function validateComputedPermissionReferences(expression, table, transforms) {
|
|
1255
|
+
if (!expression)
|
|
1256
|
+
return;
|
|
1257
|
+
if (expression.type === "And" || expression.type === "Or") {
|
|
1258
|
+
for (const child of expression.exprs)
|
|
1259
|
+
validateComputedPermissionReferences(child, table, transforms);
|
|
1260
|
+
}
|
|
1261
|
+
else if (expression.type === "Not") {
|
|
1262
|
+
validateComputedPermissionReferences(expression.expr, table, transforms);
|
|
1263
|
+
}
|
|
1264
|
+
else if (expression.type === "Exists") {
|
|
1265
|
+
validateComputedPermissionReferences(expression.condition, expression.table, transforms);
|
|
1266
|
+
}
|
|
1267
|
+
else if (expression.type === "ExistsRel" && transforms[table]) {
|
|
1268
|
+
const value = (ref) => {
|
|
1269
|
+
if ("OuterColumn" in ref)
|
|
1270
|
+
assertStoredPermissionReference(ref.OuterColumn.column, transforms[table]);
|
|
1271
|
+
};
|
|
1272
|
+
const predicate = (expr) => {
|
|
1273
|
+
if (typeof expr === "string")
|
|
1274
|
+
return;
|
|
1275
|
+
if ("Cmp" in expr)
|
|
1276
|
+
value(expr.Cmp.right);
|
|
1277
|
+
else if ("Contains" in expr)
|
|
1278
|
+
value(expr.Contains.right);
|
|
1279
|
+
else if ("In" in expr)
|
|
1280
|
+
expr.In.values.forEach(value);
|
|
1281
|
+
else if ("And" in expr)
|
|
1282
|
+
expr.And.forEach(predicate);
|
|
1283
|
+
else if ("Or" in expr)
|
|
1284
|
+
expr.Or.forEach(predicate);
|
|
1285
|
+
else if ("Not" in expr)
|
|
1286
|
+
predicate(expr.Not);
|
|
1287
|
+
else if ("EnumMatch" in expr)
|
|
1288
|
+
predicate(expr.EnumMatch.payload);
|
|
1289
|
+
};
|
|
1290
|
+
const relation = (expr) => {
|
|
1291
|
+
if ("Filter" in expr) {
|
|
1292
|
+
relation(expr.Filter.input);
|
|
1293
|
+
predicate(expr.Filter.predicate);
|
|
1294
|
+
}
|
|
1295
|
+
else if ("Union" in expr) {
|
|
1296
|
+
for (const arm of expr.Union.inputs)
|
|
1297
|
+
relation(arm.input);
|
|
1298
|
+
}
|
|
1299
|
+
else if ("Join" in expr) {
|
|
1300
|
+
relation(expr.Join.left);
|
|
1301
|
+
relation(expr.Join.right);
|
|
1302
|
+
}
|
|
1303
|
+
else if ("Gather" in expr) {
|
|
1304
|
+
relation(expr.Gather.seed);
|
|
1305
|
+
relation(expr.Gather.step);
|
|
1306
|
+
}
|
|
1307
|
+
else {
|
|
1308
|
+
const unary = "Project" in expr
|
|
1309
|
+
? expr.Project
|
|
1310
|
+
: "Distinct" in expr
|
|
1311
|
+
? expr.Distinct
|
|
1312
|
+
: "OrderBy" in expr
|
|
1313
|
+
? expr.OrderBy
|
|
1314
|
+
: "Offset" in expr
|
|
1315
|
+
? expr.Offset
|
|
1316
|
+
: "Limit" in expr
|
|
1317
|
+
? expr.Limit
|
|
1318
|
+
: undefined;
|
|
1319
|
+
if (unary)
|
|
1320
|
+
relation(unary.input);
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
relation(expression.rel);
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
function createRowContext(columnTransforms) {
|
|
803
1327
|
return new Proxy({}, {
|
|
804
1328
|
get(_target, prop) {
|
|
805
1329
|
if (typeof prop === "string") {
|
|
1330
|
+
assertStoredPermissionReference(prop, columnTransforms);
|
|
806
1331
|
return {
|
|
807
1332
|
__jazzPermissionKind: "row-ref",
|
|
808
1333
|
column: prop,
|
|
@@ -812,41 +1337,129 @@ function createRowContext() {
|
|
|
812
1337
|
},
|
|
813
1338
|
});
|
|
814
1339
|
}
|
|
815
|
-
function normalizeWhereObject(input) {
|
|
1340
|
+
function normalizeWhereObject(input, hasTypeColumn) {
|
|
816
1341
|
if (!isPlainObject(input)) {
|
|
817
1342
|
throw new Error("Expected a where-object condition.");
|
|
818
1343
|
}
|
|
1344
|
+
if (hasTypeColumn === false && isPolicyExpressionDiscriminator(input.type)) {
|
|
1345
|
+
throw new Error(`Unbranded permission condition with policy expression discriminator "${input.type}" cannot be treated as row data because this table has no "type" column. Wrap manually-authored policy IR with raw(...).`);
|
|
1346
|
+
}
|
|
819
1347
|
return input;
|
|
820
1348
|
}
|
|
821
|
-
|
|
1349
|
+
/** {@link resolveWhereInput} for the rule `site` names, which its errors name too. */
|
|
1350
|
+
function resolveRuleInput(site, input, hasTypeColumn, columnTransforms) {
|
|
1351
|
+
try {
|
|
1352
|
+
return resolveWhereInput(input, hasTypeColumn, columnTransforms);
|
|
1353
|
+
}
|
|
1354
|
+
catch (error) {
|
|
1355
|
+
if (error instanceof Error && error.message.startsWith("Unsupported permission condition")) {
|
|
1356
|
+
error.message = `${site}: ${error.message}`;
|
|
1357
|
+
}
|
|
1358
|
+
throw error;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
function capitalize(word) {
|
|
1362
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
1363
|
+
}
|
|
1364
|
+
function resolveWhereInput(input, hasTypeColumn, columnTransforms) {
|
|
822
1365
|
if (typeof input === "function") {
|
|
823
|
-
const result = input(createRowContext());
|
|
824
|
-
return resolveWhereInput(result);
|
|
1366
|
+
const result = input(createRowContext(columnTransforms));
|
|
1367
|
+
return resolveWhereInput(result, hasTypeColumn, columnTransforms);
|
|
825
1368
|
}
|
|
826
|
-
if (
|
|
1369
|
+
if (isPolicyExpr(input) || isAllowedRelationCondition(input)) {
|
|
827
1370
|
return input;
|
|
828
1371
|
}
|
|
829
|
-
if (
|
|
1372
|
+
if (isSessionWhereCondition(input)) {
|
|
830
1373
|
return input;
|
|
831
1374
|
}
|
|
832
|
-
if (
|
|
1375
|
+
if (isExistsCondition(input)) {
|
|
833
1376
|
return input;
|
|
834
1377
|
}
|
|
835
|
-
if (
|
|
1378
|
+
if (isExistsRelationCondition(input)) {
|
|
836
1379
|
return input;
|
|
837
1380
|
}
|
|
1381
|
+
if (isCompoundConditionInput(input)) {
|
|
1382
|
+
return brandPermissionExpression({
|
|
1383
|
+
__jazzPermissionKind: "compound",
|
|
1384
|
+
op: input.op,
|
|
1385
|
+
conditions: input.conditions.map((condition) => resolveWhereInput(condition, hasTypeColumn, columnTransforms)),
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
838
1388
|
if (isPlainObject(input)) {
|
|
839
|
-
return
|
|
1389
|
+
return brandPermissionExpression({
|
|
1390
|
+
__jazzPermissionKind: "where-object",
|
|
1391
|
+
where: normalizeWhereObject(input, hasTypeColumn),
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
throw new Error(`Unsupported permission condition input: ${describeConditionInput(input)}. A condition is a ` +
|
|
1395
|
+
"where-object such as `{ owner_id: session.user }`, a function of the row returning " +
|
|
1396
|
+
"one, `anyOf`/`allOf` of conditions, `policy.<table>.exists.where(...)`, `allowedTo.<op>(...)`, " +
|
|
1397
|
+
"or `raw(...)`.");
|
|
1398
|
+
}
|
|
1399
|
+
function describeConditionInput(input) {
|
|
1400
|
+
if (input === null)
|
|
1401
|
+
return "null";
|
|
1402
|
+
if (Array.isArray(input))
|
|
1403
|
+
return "an array (wrap several conditions in anyOf or allOf)";
|
|
1404
|
+
return typeof input === "string" ? `the string ${JSON.stringify(input)}` : String(typeof input);
|
|
1405
|
+
}
|
|
1406
|
+
function filtersToCondition(filters, options) {
|
|
1407
|
+
const exprs = [];
|
|
1408
|
+
for (const filter of filters) {
|
|
1409
|
+
exprs.push(...columnFilterToExprs(filter.column, filter.raw, options));
|
|
840
1410
|
}
|
|
841
|
-
|
|
1411
|
+
return andExpr(exprs);
|
|
842
1412
|
}
|
|
843
|
-
function
|
|
1413
|
+
function analyzeQualifiedWhereObject(table, where, relationsByTable) {
|
|
1414
|
+
const joins = [];
|
|
1415
|
+
const filters = [];
|
|
1416
|
+
const hasQualifiedFilters = collectQualifiedWhere(where, table, table, "table", relationsByTable, { joins, filters }, { subject: "Qualified where(...)", alternative: "explicit relation" });
|
|
1417
|
+
return {
|
|
1418
|
+
hasQualifiedFilters,
|
|
1419
|
+
joins,
|
|
1420
|
+
filters,
|
|
1421
|
+
};
|
|
1422
|
+
}
|
|
1423
|
+
function compileQualifiedWhereRelation(table, where, relationsByTable, options) {
|
|
1424
|
+
const analysis = analyzeQualifiedWhereObject(table, where, relationsByTable);
|
|
1425
|
+
let relation = applyRelationTail({
|
|
1426
|
+
base: {
|
|
1427
|
+
TableScan: {
|
|
1428
|
+
table,
|
|
1429
|
+
},
|
|
1430
|
+
},
|
|
1431
|
+
initialScope: table,
|
|
1432
|
+
joins: analysis.joins,
|
|
1433
|
+
filters: analysis.filters,
|
|
1434
|
+
selectMap: undefined,
|
|
1435
|
+
joinAlias: (join, index) => relationJoinAlias("table", join, index),
|
|
1436
|
+
});
|
|
1437
|
+
if (!options.anchorOuterRow) {
|
|
1438
|
+
return relation;
|
|
1439
|
+
}
|
|
1440
|
+
relation = applyRelFilter(relation, [
|
|
1441
|
+
{
|
|
1442
|
+
Cmp: {
|
|
1443
|
+
left: {
|
|
1444
|
+
scope: table,
|
|
1445
|
+
column: "id",
|
|
1446
|
+
},
|
|
1447
|
+
op: "Eq",
|
|
1448
|
+
right: {
|
|
1449
|
+
RowId: "Outer",
|
|
1450
|
+
},
|
|
1451
|
+
},
|
|
1452
|
+
},
|
|
1453
|
+
]);
|
|
1454
|
+
return relation;
|
|
1455
|
+
}
|
|
1456
|
+
function sessionWhereObjectToCondition(where) {
|
|
844
1457
|
const exprs = [];
|
|
845
|
-
for (const [
|
|
1458
|
+
for (const [path, raw] of Object.entries(where)) {
|
|
846
1459
|
if (raw === undefined) {
|
|
847
1460
|
continue;
|
|
848
1461
|
}
|
|
849
|
-
exprs.push(...
|
|
1462
|
+
exprs.push(...sessionPathFilterToExprs(path, raw));
|
|
850
1463
|
}
|
|
851
1464
|
return andExpr(exprs);
|
|
852
1465
|
}
|
|
@@ -864,82 +1477,122 @@ function columnFilterToExprs(column, raw, options) {
|
|
|
864
1477
|
return [cmpExpr(column, "Eq", raw, options)];
|
|
865
1478
|
}
|
|
866
1479
|
if (isPlainObject(raw)) {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
1480
|
+
return lowerWhereOperators(raw, {
|
|
1481
|
+
isNull: (isNull) => ({ type: isNull ? "IsNull" : "IsNotNull", column }),
|
|
1482
|
+
cmp: (op, value) => cmpExpr(column, op, value, options),
|
|
1483
|
+
contains: (value) => ({ type: "Contains", column, value: toPolicyValue(value, options) }),
|
|
1484
|
+
in: (value) => {
|
|
1485
|
+
if (isSessionRefValue(value))
|
|
1486
|
+
return { type: "In", column, session_path: value.path };
|
|
1487
|
+
if (!Array.isArray(value)) {
|
|
1488
|
+
throw new Error(`"${column}.in" expects an array or session reference.`);
|
|
1489
|
+
}
|
|
1490
|
+
if (value.length === 0)
|
|
1491
|
+
return { type: "False" };
|
|
1492
|
+
return {
|
|
1493
|
+
type: "InList",
|
|
1494
|
+
column,
|
|
1495
|
+
values: value.map((entry) => toPolicyValue(entry, options)),
|
|
1496
|
+
};
|
|
1497
|
+
},
|
|
1498
|
+
isNullError: `"${column}.isNull" expects a boolean value.`,
|
|
1499
|
+
unsupported: (op) => `Unsupported where operator "${op}" in permissions DSL.`,
|
|
1500
|
+
empty: { type: "True" },
|
|
1501
|
+
});
|
|
1502
|
+
}
|
|
1503
|
+
return [cmpExpr(column, "Eq", raw, options)];
|
|
1504
|
+
}
|
|
1505
|
+
function sessionPathFilterToExprs(path, raw) {
|
|
1506
|
+
const sessionPath = normalizeSessionPath(path);
|
|
1507
|
+
if (sessionPath.length === 0) {
|
|
1508
|
+
throw new Error("session.where(...) requires non-empty session path keys.");
|
|
1509
|
+
}
|
|
1510
|
+
if (raw === null) {
|
|
1511
|
+
return [{ type: "SessionIsNull", path: sessionPath }];
|
|
1512
|
+
}
|
|
1513
|
+
if (!isPlainObject(raw) ||
|
|
1514
|
+
isSessionRefValue(raw) ||
|
|
1515
|
+
isRowRefValue(raw) ||
|
|
1516
|
+
isRecursiveCurrentValue(raw) ||
|
|
1517
|
+
isExistsCondition(raw) ||
|
|
1518
|
+
isExistsRelationCondition(raw) ||
|
|
1519
|
+
isCompoundCondition(raw) ||
|
|
1520
|
+
isPolicyExpr(raw)) {
|
|
1521
|
+
return [sessionCmpExpr(sessionPath, "Eq", raw, path)];
|
|
1522
|
+
}
|
|
1523
|
+
return lowerWhereOperators(raw, {
|
|
1524
|
+
isNull: (isNull) => ({
|
|
1525
|
+
type: isNull ? "SessionIsNull" : "SessionIsNotNull",
|
|
1526
|
+
path: sessionPath,
|
|
1527
|
+
}),
|
|
1528
|
+
cmp: (op, value, name) => {
|
|
1529
|
+
if (op !== "Eq" && op !== "Ne") {
|
|
1530
|
+
throw new Error(`Unsupported session.where operator "${name}" in permissions DSL.`);
|
|
871
1531
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
if (value === null) {
|
|
883
|
-
exprs.push({ type: "IsNotNull", column });
|
|
884
|
-
}
|
|
885
|
-
else {
|
|
886
|
-
exprs.push(cmpExpr(column, "Ne", value, options));
|
|
887
|
-
}
|
|
888
|
-
break;
|
|
889
|
-
case "gt":
|
|
890
|
-
exprs.push(cmpExpr(column, "Gt", value, options));
|
|
891
|
-
break;
|
|
892
|
-
case "gte":
|
|
893
|
-
exprs.push(cmpExpr(column, "Ge", value, options));
|
|
894
|
-
break;
|
|
895
|
-
case "lt":
|
|
896
|
-
exprs.push(cmpExpr(column, "Lt", value, options));
|
|
897
|
-
break;
|
|
898
|
-
case "lte":
|
|
899
|
-
exprs.push(cmpExpr(column, "Le", value, options));
|
|
900
|
-
break;
|
|
901
|
-
case "isNull":
|
|
902
|
-
if (typeof value !== "boolean") {
|
|
903
|
-
throw new Error(`"${column}.isNull" expects a boolean value.`);
|
|
904
|
-
}
|
|
905
|
-
exprs.push(value ? { type: "IsNull", column } : { type: "IsNotNull", column });
|
|
906
|
-
break;
|
|
907
|
-
case "contains":
|
|
908
|
-
exprs.push({
|
|
909
|
-
type: "Contains",
|
|
910
|
-
column,
|
|
911
|
-
value: toPolicyValue(value, options),
|
|
912
|
-
});
|
|
913
|
-
break;
|
|
914
|
-
case "in":
|
|
915
|
-
if (isSessionRefValue(value)) {
|
|
916
|
-
exprs.push({
|
|
917
|
-
type: "In",
|
|
918
|
-
column,
|
|
919
|
-
session_path: value.path,
|
|
920
|
-
});
|
|
921
|
-
break;
|
|
922
|
-
}
|
|
923
|
-
if (!Array.isArray(value)) {
|
|
924
|
-
throw new Error(`"${column}.in" expects an array or session reference.`);
|
|
925
|
-
}
|
|
926
|
-
if (value.length === 0) {
|
|
927
|
-
exprs.push({ type: "False" });
|
|
928
|
-
break;
|
|
929
|
-
}
|
|
930
|
-
exprs.push({
|
|
931
|
-
type: "InList",
|
|
932
|
-
column,
|
|
933
|
-
values: value.map((entry) => toPolicyValue(entry, options)),
|
|
934
|
-
});
|
|
935
|
-
break;
|
|
936
|
-
default:
|
|
937
|
-
throw new Error(`Unsupported where operator "${op}" in permissions DSL.`);
|
|
1532
|
+
return sessionCmpExpr(sessionPath, op, value, path);
|
|
1533
|
+
},
|
|
1534
|
+
contains: (value) => ({
|
|
1535
|
+
type: "SessionContains",
|
|
1536
|
+
path: sessionPath,
|
|
1537
|
+
value: toPolicyLiteralValue(value, `session.where("${path}.contains")`),
|
|
1538
|
+
}),
|
|
1539
|
+
in: (value) => {
|
|
1540
|
+
if (!Array.isArray(value)) {
|
|
1541
|
+
throw new Error(`session.where("${path}.in") expects an array of literal values.`);
|
|
938
1542
|
}
|
|
1543
|
+
if (value.length === 0)
|
|
1544
|
+
return { type: "False" };
|
|
1545
|
+
return {
|
|
1546
|
+
type: "SessionInList",
|
|
1547
|
+
path: sessionPath,
|
|
1548
|
+
values: value.map((entry) => toPolicyLiteralValue(entry, `session.where("${path}.in")`)),
|
|
1549
|
+
};
|
|
1550
|
+
},
|
|
1551
|
+
isNullError: `session.where("${path}.isNull") expects a boolean value.`,
|
|
1552
|
+
unsupported: (op) => `Unsupported session.where operator "${op}" in permissions DSL. Nested object claim syntax is not supported; use dotted path keys instead.`,
|
|
1553
|
+
empty: { type: "True" },
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
const WHERE_CMP_OPS = {
|
|
1557
|
+
eq: "Eq",
|
|
1558
|
+
ne: "Ne",
|
|
1559
|
+
gt: "Gt",
|
|
1560
|
+
gte: "Ge",
|
|
1561
|
+
lt: "Lt",
|
|
1562
|
+
lte: "Le",
|
|
1563
|
+
};
|
|
1564
|
+
/**
|
|
1565
|
+
* Lower a where-operator object (`{ eq, ne, gt, gte, lt, lte, isNull, contains, in }`)
|
|
1566
|
+
* to one node per present operator; `eq: null`/`ne: null` become null checks.
|
|
1567
|
+
*/
|
|
1568
|
+
function lowerWhereOperators(raw, lowering) {
|
|
1569
|
+
const out = [];
|
|
1570
|
+
for (const [op, value] of Object.entries(raw)) {
|
|
1571
|
+
if (value === undefined)
|
|
1572
|
+
continue;
|
|
1573
|
+
const cmpOp = Object.hasOwn(WHERE_CMP_OPS, op) ? WHERE_CMP_OPS[op] : undefined;
|
|
1574
|
+
if (op === "isNull") {
|
|
1575
|
+
if (typeof value !== "boolean")
|
|
1576
|
+
throw new Error(lowering.isNullError);
|
|
1577
|
+
out.push(lowering.isNull(value));
|
|
1578
|
+
}
|
|
1579
|
+
else if (value === null && (op === "eq" || op === "ne")) {
|
|
1580
|
+
out.push(lowering.isNull(op === "eq"));
|
|
1581
|
+
}
|
|
1582
|
+
else if (cmpOp) {
|
|
1583
|
+
out.push(lowering.cmp(cmpOp, value, op));
|
|
1584
|
+
}
|
|
1585
|
+
else if (op === "contains") {
|
|
1586
|
+
out.push(lowering.contains(value));
|
|
1587
|
+
}
|
|
1588
|
+
else if (op === "in") {
|
|
1589
|
+
out.push(lowering.in(value));
|
|
1590
|
+
}
|
|
1591
|
+
else {
|
|
1592
|
+
throw new Error(lowering.unsupported(op));
|
|
939
1593
|
}
|
|
940
|
-
return exprs.length === 0 ? [{ type: "True" }] : exprs;
|
|
941
1594
|
}
|
|
942
|
-
return
|
|
1595
|
+
return out.length > 0 ? out : [lowering.empty];
|
|
943
1596
|
}
|
|
944
1597
|
function cmpExpr(column, op, value, options) {
|
|
945
1598
|
return {
|
|
@@ -949,6 +1602,14 @@ function cmpExpr(column, op, value, options) {
|
|
|
949
1602
|
value: toPolicyValue(value, options),
|
|
950
1603
|
};
|
|
951
1604
|
}
|
|
1605
|
+
function sessionCmpExpr(path, op, value, originalPath) {
|
|
1606
|
+
return {
|
|
1607
|
+
type: "SessionCmp",
|
|
1608
|
+
path,
|
|
1609
|
+
op,
|
|
1610
|
+
value: toPolicyLiteralValue(value, `session.where("${originalPath}")`),
|
|
1611
|
+
};
|
|
1612
|
+
}
|
|
952
1613
|
function toPolicyValue(value, options) {
|
|
953
1614
|
if (isSessionRefValue(value)) {
|
|
954
1615
|
return { type: "SessionRef", path: value.path };
|
|
@@ -964,6 +1625,39 @@ function toPolicyValue(value, options) {
|
|
|
964
1625
|
}
|
|
965
1626
|
return { type: "Literal", value };
|
|
966
1627
|
}
|
|
1628
|
+
function toPolicyLiteralValue(value, context) {
|
|
1629
|
+
assertSessionWhereLiteralValue(value, context);
|
|
1630
|
+
return { type: "Literal", value };
|
|
1631
|
+
}
|
|
1632
|
+
function assertSessionWhereLiteralValue(value, context) {
|
|
1633
|
+
if (isSessionRefValue(value)) {
|
|
1634
|
+
throw new Error(`${context} only accepts literal values; session references are not supported.`);
|
|
1635
|
+
}
|
|
1636
|
+
if (isRowRefValue(value)) {
|
|
1637
|
+
throw new Error(`${context} only accepts literal values; row references are not supported.`);
|
|
1638
|
+
}
|
|
1639
|
+
if (isRecursiveCurrentValue(value)) {
|
|
1640
|
+
throw new Error(`${context} only accepts literal values; recursive current refs are not supported.`);
|
|
1641
|
+
}
|
|
1642
|
+
if (isExistsCondition(value) ||
|
|
1643
|
+
isExistsRelationCondition(value) ||
|
|
1644
|
+
isCompoundCondition(value) ||
|
|
1645
|
+
isPolicyExpr(value)) {
|
|
1646
|
+
throw new Error(`${context} only accepts literal values; relation and policy expressions are not supported.`);
|
|
1647
|
+
}
|
|
1648
|
+
if (typeof value === "function" || value === undefined) {
|
|
1649
|
+
throw new Error(`${context} only accepts literal values.`);
|
|
1650
|
+
}
|
|
1651
|
+
if (Array.isArray(value)) {
|
|
1652
|
+
for (const entry of value) {
|
|
1653
|
+
assertSessionWhereLiteralValue(entry, context);
|
|
1654
|
+
}
|
|
1655
|
+
return;
|
|
1656
|
+
}
|
|
1657
|
+
if (isPlainObject(value)) {
|
|
1658
|
+
throw new Error(`${context} only accepts literal values; nested objects are not supported.`);
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
967
1661
|
function andExpr(exprs) {
|
|
968
1662
|
if (exprs.length === 0) {
|
|
969
1663
|
return { type: "True" };
|
|
@@ -979,45 +1673,60 @@ export function anyOf(conditions) {
|
|
|
979
1673
|
export function allOf(conditions) {
|
|
980
1674
|
return compoundCondition("And", conditions);
|
|
981
1675
|
}
|
|
1676
|
+
function alwaysCondition() {
|
|
1677
|
+
return allOf([]);
|
|
1678
|
+
}
|
|
1679
|
+
function neverCondition() {
|
|
1680
|
+
return anyOf([]);
|
|
1681
|
+
}
|
|
982
1682
|
function compoundCondition(op, inputs) {
|
|
983
1683
|
if (!Array.isArray(inputs)) {
|
|
984
1684
|
const fnName = op === "And" ? "allOf" : "anyOf";
|
|
985
1685
|
throw new Error(`"${fnName}(...)" expects an array of conditions.`);
|
|
986
1686
|
}
|
|
987
|
-
return {
|
|
988
|
-
__jazzPermissionKind: "compound",
|
|
1687
|
+
return brandPermissionExpression({
|
|
1688
|
+
__jazzPermissionKind: "compound-input",
|
|
989
1689
|
op,
|
|
990
|
-
conditions: inputs
|
|
991
|
-
};
|
|
1690
|
+
conditions: [...inputs],
|
|
1691
|
+
});
|
|
992
1692
|
}
|
|
993
|
-
function compileRules(rules, fkReferencesByTable) {
|
|
1693
|
+
function compileRules(rules, fkReferencesByTable, relationsByTable) {
|
|
994
1694
|
const compiled = {};
|
|
1695
|
+
const updateRuleAsymmetry = new Map();
|
|
995
1696
|
for (const ruleLike of rules) {
|
|
996
1697
|
const rule = isUpdateRuleBuilder(ruleLike) ? ruleLike.toRule() : ruleLike;
|
|
997
1698
|
if (!compiled[rule.table]) {
|
|
998
|
-
compiled[rule.table] =
|
|
1699
|
+
compiled[rule.table] = emptyTablePolicies();
|
|
999
1700
|
}
|
|
1000
1701
|
const tablePolicies = compiled[rule.table];
|
|
1001
1702
|
switch (rule.action) {
|
|
1002
1703
|
case "read":
|
|
1003
1704
|
tablePolicies.select = mergeOperationPolicy(tablePolicies.select, {
|
|
1004
|
-
using: compileCondition(rule.using, rule.table, fkReferencesByTable),
|
|
1705
|
+
using: compileCondition(rule.using, rule.table, fkReferencesByTable, relationsByTable),
|
|
1005
1706
|
});
|
|
1006
1707
|
break;
|
|
1007
1708
|
case "insert":
|
|
1008
1709
|
tablePolicies.insert = mergeOperationPolicy(tablePolicies.insert, {
|
|
1009
|
-
with_check: compileCondition(rule.withCheck, rule.table, fkReferencesByTable),
|
|
1710
|
+
with_check: compileCondition(rule.withCheck, rule.table, fkReferencesByTable, relationsByTable),
|
|
1010
1711
|
});
|
|
1011
1712
|
break;
|
|
1012
|
-
case "update":
|
|
1013
|
-
|
|
1014
|
-
using: compileCondition(rule.using, rule.table, fkReferencesByTable),
|
|
1015
|
-
with_check: compileCondition(rule.withCheck, rule.table, fkReferencesByTable),
|
|
1016
|
-
}
|
|
1713
|
+
case "update": {
|
|
1714
|
+
const incoming = {
|
|
1715
|
+
using: compileCondition(rule.using, rule.table, fkReferencesByTable, relationsByTable),
|
|
1716
|
+
with_check: compileCondition(rule.withCheck, rule.table, fkReferencesByTable, relationsByTable),
|
|
1717
|
+
};
|
|
1718
|
+
const previousIsAsymmetric = updateRuleAsymmetry.get(rule.table);
|
|
1719
|
+
const isAsymmetric = rule.asymmetricUpdate === true;
|
|
1720
|
+
if (previousIsAsymmetric !== undefined && (previousIsAsymmetric || isAsymmetric)) {
|
|
1721
|
+
throw new Error(`Multiple asymmetric update rules for table "${rule.table}" are unsupported because their USING and WITH CHECK clauses would be ORed independently. Use one symmetric condition, model each transition as a separate record/action, or mediate the transition on a trusted backend.`);
|
|
1722
|
+
}
|
|
1723
|
+
updateRuleAsymmetry.set(rule.table, previousIsAsymmetric ?? isAsymmetric);
|
|
1724
|
+
tablePolicies.update = mergeOperationPolicy(tablePolicies.update, incoming);
|
|
1017
1725
|
break;
|
|
1726
|
+
}
|
|
1018
1727
|
case "delete":
|
|
1019
1728
|
tablePolicies.delete = mergeOperationPolicy(tablePolicies.delete, {
|
|
1020
|
-
using: compileCondition(rule.using, rule.table, fkReferencesByTable),
|
|
1729
|
+
using: compileCondition(rule.using, rule.table, fkReferencesByTable, relationsByTable),
|
|
1021
1730
|
});
|
|
1022
1731
|
break;
|
|
1023
1732
|
default:
|
|
@@ -1026,6 +1735,17 @@ function compileRules(rules, fkReferencesByTable) {
|
|
|
1026
1735
|
}
|
|
1027
1736
|
return compiled;
|
|
1028
1737
|
}
|
|
1738
|
+
function emptyOperationPolicy() {
|
|
1739
|
+
return {};
|
|
1740
|
+
}
|
|
1741
|
+
function emptyTablePolicies() {
|
|
1742
|
+
return {
|
|
1743
|
+
select: emptyOperationPolicy(),
|
|
1744
|
+
insert: emptyOperationPolicy(),
|
|
1745
|
+
update: emptyOperationPolicy(),
|
|
1746
|
+
delete: emptyOperationPolicy(),
|
|
1747
|
+
};
|
|
1748
|
+
}
|
|
1029
1749
|
function mergeOperationPolicy(existing, incoming) {
|
|
1030
1750
|
return {
|
|
1031
1751
|
using: mergeExprWithOr(existing?.using, incoming.using),
|
|
@@ -1054,14 +1774,56 @@ function mergeExprWithOr(left, right) {
|
|
|
1054
1774
|
}
|
|
1055
1775
|
return { type: "Or", exprs };
|
|
1056
1776
|
}
|
|
1057
|
-
function compileCondition(condition, table, fkReferencesByTable) {
|
|
1777
|
+
function compileCondition(condition, table, fkReferencesByTable, relationsByTable) {
|
|
1058
1778
|
if (!condition) {
|
|
1059
1779
|
return undefined;
|
|
1060
1780
|
}
|
|
1781
|
+
if (isAllowedRelationCondition(condition)) {
|
|
1782
|
+
const relation = resolveNamedRelation(relationsByTable, condition.sourceTable ?? table, condition.relation);
|
|
1783
|
+
if (condition.sourceTable !== undefined &&
|
|
1784
|
+
(relation.type !== "forward" || relation.toTable !== table)) {
|
|
1785
|
+
throw new Error(`allowedTo.*Referencing(policy.${condition.sourceTable}, "${condition.relation}") requires a declared forward relationship targeting "${table}".`);
|
|
1786
|
+
}
|
|
1787
|
+
const reverse = condition.sourceTable !== undefined || relation.type === "reverse";
|
|
1788
|
+
if (reverse && condition.maxDepth !== undefined) {
|
|
1789
|
+
throw new Error("allowedTo reverse relationships do not support maxDepth; omit it. Reverse inheritance cycles are rejected during schema validation.");
|
|
1790
|
+
}
|
|
1791
|
+
const expr = reverse
|
|
1792
|
+
? {
|
|
1793
|
+
type: "InheritsReferencing",
|
|
1794
|
+
operation: condition.operation,
|
|
1795
|
+
source_table: condition.sourceTable ?? relation.toTable,
|
|
1796
|
+
via_column: condition.sourceTable !== undefined ? relation.fromColumn : relation.toColumn,
|
|
1797
|
+
}
|
|
1798
|
+
: { type: "Inherits", operation: condition.operation, via_column: relation.fromColumn };
|
|
1799
|
+
if (condition.maxDepth !== undefined)
|
|
1800
|
+
expr.max_depth = condition.maxDepth;
|
|
1801
|
+
resolveAndAssertInheritsColumns(expr, table, fkReferencesByTable);
|
|
1802
|
+
return expr;
|
|
1803
|
+
}
|
|
1061
1804
|
if (isPolicyExpr(condition)) {
|
|
1062
|
-
|
|
1805
|
+
resolveAndAssertInheritsColumns(condition, table, fkReferencesByTable);
|
|
1063
1806
|
return condition;
|
|
1064
1807
|
}
|
|
1808
|
+
if (isWhereObjectCondition(condition)) {
|
|
1809
|
+
const analysis = analyzeQualifiedWhereObject(table, condition.where, relationsByTable);
|
|
1810
|
+
if (analysis.hasQualifiedFilters) {
|
|
1811
|
+
return {
|
|
1812
|
+
type: "ExistsRel",
|
|
1813
|
+
rel: compileQualifiedWhereRelation(table, condition.where, relationsByTable, {
|
|
1814
|
+
anchorOuterRow: true,
|
|
1815
|
+
}),
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1818
|
+
const compiledCondition = filtersToCondition(analysis.filters, {
|
|
1819
|
+
allowRowRefs: false,
|
|
1820
|
+
});
|
|
1821
|
+
resolveAndAssertInheritsColumns(compiledCondition, table, fkReferencesByTable);
|
|
1822
|
+
return compiledCondition;
|
|
1823
|
+
}
|
|
1824
|
+
if (isSessionWhereCondition(condition)) {
|
|
1825
|
+
return sessionWhereObjectToCondition(condition.where);
|
|
1826
|
+
}
|
|
1065
1827
|
if (isExistsRelationCondition(condition)) {
|
|
1066
1828
|
return {
|
|
1067
1829
|
type: "ExistsRel",
|
|
@@ -1069,11 +1831,19 @@ function compileCondition(condition, table, fkReferencesByTable) {
|
|
|
1069
1831
|
};
|
|
1070
1832
|
}
|
|
1071
1833
|
if (isExistsCondition(condition)) {
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1834
|
+
const analysis = analyzeQualifiedWhereObject(condition.table, condition.where, relationsByTable);
|
|
1835
|
+
if (analysis.hasQualifiedFilters) {
|
|
1836
|
+
return {
|
|
1837
|
+
type: "ExistsRel",
|
|
1838
|
+
rel: compileQualifiedWhereRelation(condition.table, condition.where, relationsByTable, {
|
|
1839
|
+
anchorOuterRow: false,
|
|
1840
|
+
}),
|
|
1841
|
+
};
|
|
1076
1842
|
}
|
|
1843
|
+
const compiledCondition = filtersToCondition(analysis.filters, {
|
|
1844
|
+
allowRowRefs: true,
|
|
1845
|
+
});
|
|
1846
|
+
resolveAndAssertInheritsColumns(compiledCondition, condition.table, fkReferencesByTable);
|
|
1077
1847
|
return {
|
|
1078
1848
|
type: "Exists",
|
|
1079
1849
|
table: condition.table,
|
|
@@ -1081,7 +1851,7 @@ function compileCondition(condition, table, fkReferencesByTable) {
|
|
|
1081
1851
|
};
|
|
1082
1852
|
}
|
|
1083
1853
|
if (isCompoundCondition(condition)) {
|
|
1084
|
-
const compiledChildren = condition.conditions.map((child) => compileCondition(child, table, fkReferencesByTable));
|
|
1854
|
+
const compiledChildren = condition.conditions.map((child) => compileCondition(child, table, fkReferencesByTable, relationsByTable));
|
|
1085
1855
|
const exprs = compiledChildren.filter((expr) => Boolean(expr));
|
|
1086
1856
|
if (exprs.length === 0) {
|
|
1087
1857
|
return condition.op === "And" ? { type: "True" } : { type: "False" };
|
|
@@ -1093,7 +1863,18 @@ function compileCondition(condition, table, fkReferencesByTable) {
|
|
|
1093
1863
|
}
|
|
1094
1864
|
throw new Error("Unsupported condition in permissions compiler.");
|
|
1095
1865
|
}
|
|
1096
|
-
function
|
|
1866
|
+
function resolveFkColumn(name, fkColumns) {
|
|
1867
|
+
if (fkColumns.has(name))
|
|
1868
|
+
return name;
|
|
1869
|
+
const withId = name + "Id";
|
|
1870
|
+
if (fkColumns.has(withId))
|
|
1871
|
+
return withId;
|
|
1872
|
+
const withUnderId = name + "_id";
|
|
1873
|
+
if (fkColumns.has(withUnderId))
|
|
1874
|
+
return withUnderId;
|
|
1875
|
+
return undefined;
|
|
1876
|
+
}
|
|
1877
|
+
function resolveAndAssertInheritsColumns(expr, table, fkReferencesByTable) {
|
|
1097
1878
|
const check = (node, currentTable) => {
|
|
1098
1879
|
switch (node.type) {
|
|
1099
1880
|
case "Inherits": {
|
|
@@ -1102,29 +1883,34 @@ function assertInheritsColumns(expr, table, fkReferencesByTable) {
|
|
|
1102
1883
|
throw new Error(`allowedTo.${node.operation.toLowerCase()}("${node.via_column}") is invalid for table "${currentTable}": ` +
|
|
1103
1884
|
`table metadata is missing in app.wasmSchema.`);
|
|
1104
1885
|
}
|
|
1105
|
-
|
|
1886
|
+
const resolved = resolveFkColumn(node.via_column, fkColumns);
|
|
1887
|
+
if (!resolved) {
|
|
1106
1888
|
const fkList = [...fkColumns.keys()].sort();
|
|
1107
1889
|
const available = fkList.length > 0 ? fkList.join(", ") : "(none)";
|
|
1108
1890
|
throw new Error(`allowedTo.${node.operation.toLowerCase()}("${node.via_column}") is invalid for table "${currentTable}": ` +
|
|
1109
1891
|
`column is not a foreign key reference. Available FK columns: ${available}.`);
|
|
1110
1892
|
}
|
|
1893
|
+
node.via_column = resolved;
|
|
1111
1894
|
break;
|
|
1112
1895
|
}
|
|
1113
1896
|
case "InheritsReferencing": {
|
|
1897
|
+
const originalColumn = node.via_column;
|
|
1114
1898
|
const sourceFks = fkReferencesByTable.get(node.source_table);
|
|
1115
1899
|
if (!sourceFks) {
|
|
1116
|
-
throw new Error(`allowedTo.${node.operation.toLowerCase()}Referencing(policy.${node.source_table}, "${
|
|
1900
|
+
throw new Error(`allowedTo.${node.operation.toLowerCase()}Referencing(policy.${node.source_table}, "${originalColumn}") is invalid for table "${currentTable}": ` +
|
|
1117
1901
|
`source table metadata is missing in app.wasmSchema.`);
|
|
1118
1902
|
}
|
|
1119
|
-
const
|
|
1120
|
-
if (!
|
|
1903
|
+
const resolved = resolveFkColumn(originalColumn, sourceFks);
|
|
1904
|
+
if (!resolved) {
|
|
1121
1905
|
const fkList = [...sourceFks.keys()].sort();
|
|
1122
1906
|
const available = fkList.length > 0 ? fkList.join(", ") : "(none)";
|
|
1123
|
-
throw new Error(`allowedTo.${node.operation.toLowerCase()}Referencing(policy.${node.source_table}, "${
|
|
1907
|
+
throw new Error(`allowedTo.${node.operation.toLowerCase()}Referencing(policy.${node.source_table}, "${originalColumn}") is invalid for table "${currentTable}": ` +
|
|
1124
1908
|
`column is not a foreign key reference on source table. Available FK columns: ${available}.`);
|
|
1125
1909
|
}
|
|
1910
|
+
node.via_column = resolved;
|
|
1911
|
+
const referenced = sourceFks.get(resolved);
|
|
1126
1912
|
if (referenced !== currentTable) {
|
|
1127
|
-
throw new Error(`allowedTo.${node.operation.toLowerCase()}Referencing(policy.${node.source_table}, "${
|
|
1913
|
+
throw new Error(`allowedTo.${node.operation.toLowerCase()}Referencing(policy.${node.source_table}, "${originalColumn}") is invalid for table "${currentTable}": ` +
|
|
1128
1914
|
`source FK references "${referenced}" but this rule is for "${currentTable}".`);
|
|
1129
1915
|
}
|
|
1130
1916
|
break;
|
|
@@ -1150,36 +1936,36 @@ function assertInheritsColumns(expr, table, fkReferencesByTable) {
|
|
|
1150
1936
|
function isPlainObject(value) {
|
|
1151
1937
|
return Object.prototype.toString.call(value) === "[object Object]";
|
|
1152
1938
|
}
|
|
1939
|
+
function isBrandedPermissionExpression(input) {
|
|
1940
|
+
return isPlainObject(input) && Reflect.get(input, PERMISSION_EXPRESSION_BRAND) === true;
|
|
1941
|
+
}
|
|
1942
|
+
const isAllowedRelationCondition = kindGuard("allowed-relation", true);
|
|
1943
|
+
/**
|
|
1944
|
+
* A guard for a permissions-DSL object of the given `__jazzPermissionKind`.
|
|
1945
|
+
* `branded` additionally requires the permission-expression brand.
|
|
1946
|
+
*/
|
|
1947
|
+
function kindGuard(kind, branded, valid = () => true) {
|
|
1948
|
+
return (input) => {
|
|
1949
|
+
if (!isPlainObject(input) || (branded && !isBrandedPermissionExpression(input)))
|
|
1950
|
+
return false;
|
|
1951
|
+
return input.__jazzPermissionKind === kind && valid(input);
|
|
1952
|
+
};
|
|
1953
|
+
}
|
|
1153
1954
|
function isPolicyExpr(input) {
|
|
1154
|
-
return
|
|
1155
|
-
}
|
|
1156
|
-
function
|
|
1157
|
-
return (
|
|
1158
|
-
input.__jazzPermissionKind === "session-ref" &&
|
|
1159
|
-
Array.isArray(input.path));
|
|
1160
|
-
}
|
|
1161
|
-
function isRowRefValue(input) {
|
|
1162
|
-
return (isPlainObject(input) &&
|
|
1163
|
-
input.__jazzPermissionKind === "row-ref" &&
|
|
1164
|
-
typeof input.column === "string");
|
|
1165
|
-
}
|
|
1166
|
-
function isExistsCondition(input) {
|
|
1167
|
-
return (isPlainObject(input) &&
|
|
1168
|
-
input.__jazzPermissionKind === "exists" &&
|
|
1169
|
-
typeof input.table === "string" &&
|
|
1170
|
-
isPlainObject(input.where));
|
|
1171
|
-
}
|
|
1172
|
-
function isExistsRelationCondition(input) {
|
|
1173
|
-
return (isPlainObject(input) &&
|
|
1174
|
-
input.__jazzPermissionKind === "exists-relation" &&
|
|
1175
|
-
isPlainObject(input.relation));
|
|
1176
|
-
}
|
|
1177
|
-
function isCompoundCondition(input) {
|
|
1178
|
-
return (isPlainObject(input) &&
|
|
1179
|
-
input.__jazzPermissionKind === "compound" &&
|
|
1180
|
-
(input.op === "And" || input.op === "Or") &&
|
|
1181
|
-
Array.isArray(input.conditions));
|
|
1955
|
+
return isBrandedPermissionExpression(input) && typeof input.type === "string";
|
|
1956
|
+
}
|
|
1957
|
+
function isPolicyExpressionDiscriminator(input) {
|
|
1958
|
+
return typeof input === "string" && Object.hasOwn(POLICY_EXPRESSION_DISCRIMINATORS, input);
|
|
1182
1959
|
}
|
|
1960
|
+
const isSessionRefValue = kindGuard("session-ref", false, (value) => Array.isArray(value.path));
|
|
1961
|
+
const isSessionWhereCondition = kindGuard("session-where", true, (value) => isPlainObject(value.where));
|
|
1962
|
+
const isRowRefValue = kindGuard("row-ref", false, (value) => typeof value.column === "string");
|
|
1963
|
+
const isExistsCondition = kindGuard("exists", true, (value) => typeof value.table === "string" && isPlainObject(value.where));
|
|
1964
|
+
const isExistsRelationCondition = kindGuard("exists-relation", true, (value) => isPlainObject(value.relation));
|
|
1965
|
+
const isWhereObjectCondition = kindGuard("where-object", true, (value) => isPlainObject(value.where));
|
|
1966
|
+
const isCompoundConditionInput = kindGuard("compound-input", true, (value) => (value.op === "And" || value.op === "Or") && Array.isArray(value.conditions));
|
|
1967
|
+
const isCompoundCondition = kindGuard("compound", true, (value) => (value.op === "And" || value.op === "Or") && Array.isArray(value.conditions));
|
|
1968
|
+
const isRecursiveCurrentValue = kindGuard("recursive-current", false);
|
|
1183
1969
|
function isUpdateRuleBuilder(input) {
|
|
1184
1970
|
return isPlainObject(input) && typeof input.toRule === "function";
|
|
1185
1971
|
}
|