@pyric/cli 0.1.0-alpha.10 → 0.1.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md.orig +2 -2
- package/dist/assurance/.generated/conformance-verdicts.d.ts +16 -0
- package/dist/assurance/.generated/conformance-verdicts.d.ts.map +1 -1
- package/dist/assurance/.generated/conformance-verdicts.js +16 -0
- package/dist/assurance/.generated/conformance-verdicts.js.map +1 -1
- package/dist/bridge/server/peer.d.ts +1 -1
- package/dist/bridge/server.d.ts +1 -1
- package/dist/bridge/server.js +1 -1
- package/dist/cli/index.d.ts +11 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +13 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init.d.ts +3 -3
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +5 -5
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/serve.d.ts.map +1 -1
- package/dist/cli/serve.js +8 -2
- package/dist/cli/serve.js.map +1 -1
- package/dist/conformance/.generated/can-i-use-browser.d.ts.map +1 -1
- package/dist/conformance/.generated/can-i-use-browser.js +1 -1
- package/dist/conformance/.generated/can-i-use-browser.js.map +1 -1
- package/dist/conformance/.generated/can-i-use.d.ts.map +1 -1
- package/dist/conformance/.generated/can-i-use.js +2 -2
- package/dist/conformance/.generated/can-i-use.js.map +1 -1
- package/dist/conformance/.generated/conformance-docs.d.ts +12 -0
- package/dist/conformance/.generated/conformance-docs.d.ts.map +1 -0
- package/dist/conformance/.generated/conformance-docs.js +2 -0
- package/dist/conformance/.generated/conformance-docs.js.map +1 -0
- package/dist/conformance/docs.d.ts +6 -0
- package/dist/conformance/docs.d.ts.map +1 -0
- package/dist/conformance/docs.js +6 -0
- package/dist/conformance/docs.js.map +1 -0
- package/dist/remote/index.d.ts.map +1 -1
- package/dist/remote/index.js +1 -0
- package/dist/remote/index.js.map +1 -1
- package/dist/serve/activity-guard.d.ts +4 -0
- package/dist/serve/activity-guard.d.ts.map +1 -0
- package/dist/serve/activity-guard.js +22 -0
- package/dist/serve/activity-guard.js.map +1 -0
- package/dist/serve/activity-route.d.ts +4 -0
- package/dist/serve/activity-route.d.ts.map +1 -0
- package/dist/serve/activity-route.js +157 -0
- package/dist/serve/activity-route.js.map +1 -0
- package/dist/serve/activity-warning.d.ts +4 -0
- package/dist/serve/activity-warning.d.ts.map +1 -0
- package/dist/serve/activity-warning.js +21 -0
- package/dist/serve/activity-warning.js.map +1 -0
- package/dist/serve/bridge-mount.d.ts +5 -0
- package/dist/serve/bridge-mount.d.ts.map +1 -1
- package/dist/serve/bridge-mount.js +1 -0
- package/dist/serve/bridge-mount.js.map +1 -1
- package/dist/serve/docs-ui/404.html +3 -0
- package/dist/serve/docs-ui/_astro/{_slug_.DPUwShm2.css → _slug_.CXh9yTP1.css} +1 -1
- package/dist/serve/docs-ui/_astro/_slug_.DUci-duz.css +1 -0
- package/dist/serve/docs-ui/docs/_rhythm/index.html +2 -1
- package/dist/serve/docs-ui/docs/agent/set-up-your-agent/index.html +3 -2
- package/dist/serve/docs-ui/docs/agent/set-up-your-agent.md +1 -1
- package/dist/serve/docs-ui/docs/agent/watch-and-review/index.html +2 -1
- package/dist/serve/docs-ui/docs/agent/work-with-an-agent/index.html +2 -1
- package/dist/serve/docs-ui/docs/ai-compat/index.html +2 -1
- package/dist/serve/docs-ui/docs/api-reference/index.html +51 -49
- package/dist/serve/docs-ui/docs/api-reference.md +3 -3
- package/dist/serve/docs-ui/docs/app-compat/index.html +2 -1
- package/dist/serve/docs-ui/docs/auth-compat/index.html +2 -1
- package/dist/serve/docs-ui/docs/build/ai-logic/index.html +18 -3
- package/dist/serve/docs-ui/docs/build/ai-logic.md +30 -2
- package/dist/serve/docs-ui/docs/build/authentication/index.html +2 -1
- package/dist/serve/docs-ui/docs/build/authentication.md +1 -1
- package/dist/serve/docs-ui/docs/build/cloud-firestore/index.html +2 -1
- package/dist/serve/docs-ui/docs/build/cloud-messaging/index.html +46 -2
- package/dist/serve/docs-ui/docs/build/cloud-messaging.md +56 -1
- package/dist/serve/docs-ui/docs/build/cloud-storage/index.html +2 -1
- package/dist/serve/docs-ui/docs/build/cloud-storage.md +1 -1
- package/dist/serve/docs-ui/docs/build/realtime-database/index.html +21 -3
- package/dist/serve/docs-ui/docs/build/realtime-database.md +25 -1
- package/dist/serve/docs-ui/docs/conformance-scores/index.html +2 -1
- package/dist/serve/docs-ui/docs/create-pyric-reference-api/index.html +61 -28
- package/dist/serve/docs-ui/docs/create-pyric-reference-api.md +65 -20
- package/dist/serve/docs-ui/docs/database-compat/index.html +2 -1
- package/dist/serve/docs-ui/docs/firestore-compat/index.html +6 -5
- package/dist/serve/docs-ui/docs/firestore-compat.md +4 -4
- package/dist/serve/docs-ui/docs/functions-rtdb-compat/index.html +2 -1
- package/dist/serve/docs-ui/docs/get-started/how-the-swap-works/index.html +2 -1
- package/dist/serve/docs-ui/docs/get-started/start-building/index.html +4 -3
- package/dist/serve/docs-ui/docs/get-started/start-building.md +2 -2
- package/dist/serve/docs-ui/docs/index.json +979 -579
- package/dist/serve/docs-ui/docs/messaging-compat/index.html +2 -1
- package/dist/serve/docs-ui/docs/observe/see-whats-happening/index.html +2 -1
- package/dist/serve/docs-ui/docs/observe/shape-your-data/index.html +2 -1
- package/dist/serve/docs-ui/docs/overview/index.html +2 -1
- package/dist/serve/docs-ui/docs/pyric-admin-app-reference-api/index.html +5 -4
- package/dist/serve/docs-ui/docs/pyric-admin-app-reference-api.md +3 -4
- package/dist/serve/docs-ui/docs/pyric-admin-auth-reference-api/index.html +5 -4
- package/dist/serve/docs-ui/docs/pyric-admin-auth-reference-api.md +3 -4
- package/dist/serve/docs-ui/docs/pyric-admin-database-reference-api/index.html +5 -4
- package/dist/serve/docs-ui/docs/pyric-admin-database-reference-api.md +3 -4
- package/dist/serve/docs-ui/docs/pyric-admin-firestore-reference-api/index.html +2503 -12
- package/dist/serve/docs-ui/docs/pyric-admin-firestore-reference-api.md +2219 -8
- package/dist/serve/docs-ui/docs/pyric-admin-messaging-reference-api/index.html +916 -0
- package/dist/serve/docs-ui/docs/pyric-admin-messaging-reference-api.md +706 -0
- package/dist/serve/docs-ui/docs/pyric-admin-storage-reference-api/index.html +4 -3
- package/dist/serve/docs-ui/docs/pyric-admin-storage-reference-api.md +2 -3
- package/dist/serve/docs-ui/docs/pyric-ai-reference-api/index.html +16 -11
- package/dist/serve/docs-ui/docs/pyric-ai-reference-api.md +14 -13
- package/dist/serve/docs-ui/docs/pyric-ai-scripting-reference-api/index.html +4 -3
- package/dist/serve/docs-ui/docs/pyric-ai-scripting-reference-api.md +2 -3
- package/dist/serve/docs-ui/docs/pyric-app-reference-api/index.html +7 -2
- package/dist/serve/docs-ui/docs/pyric-app-reference-api.md +5 -2
- package/dist/serve/docs-ui/docs/pyric-auth-reference-api/index.html +23 -12
- package/dist/serve/docs-ui/docs/pyric-auth-reference-api.md +15 -12
- package/dist/serve/docs-ui/docs/pyric-cli-assurance-browser-reference-api/index.html +10 -48
- package/dist/serve/docs-ui/docs/pyric-cli-assurance-browser-reference-api.md +11 -24
- package/dist/serve/docs-ui/docs/pyric-cli-assurance-reference-api/index.html +87 -97
- package/dist/serve/docs-ui/docs/pyric-cli-assurance-reference-api.md +53 -65
- package/dist/serve/docs-ui/docs/pyric-cli-bridge-client-reference-api/index.html +14 -15
- package/dist/serve/docs-ui/docs/pyric-cli-bridge-client-reference-api.md +19 -28
- package/dist/serve/docs-ui/docs/pyric-cli-bridge-reference-api/index.html +4 -3
- package/dist/serve/docs-ui/docs/pyric-cli-bridge-reference-api.md +2 -3
- package/dist/serve/docs-ui/docs/pyric-cli-conformance-browser-reference-api/index.html +3 -2
- package/dist/serve/docs-ui/docs/pyric-cli-conformance-browser-reference-api.md +1 -2
- package/dist/serve/docs-ui/docs/pyric-cli-conformance-docs-reference-api/index.html +51 -0
- package/dist/serve/docs-ui/docs/pyric-cli-conformance-docs-reference-api.md +36 -0
- package/dist/serve/docs-ui/docs/pyric-cli-conformance-reference-api/index.html +3 -2
- package/dist/serve/docs-ui/docs/pyric-cli-conformance-reference-api.md +1 -2
- package/dist/serve/docs-ui/docs/pyric-cli-credentials-node-reference-api/index.html +3 -2
- package/dist/serve/docs-ui/docs/pyric-cli-credentials-node-reference-api.md +1 -2
- package/dist/serve/docs-ui/docs/pyric-cli-discover-reference-api/index.html +3 -2
- package/dist/serve/docs-ui/docs/pyric-cli-discover-reference-api.md +1 -2
- package/dist/serve/docs-ui/docs/pyric-cli-register-reference-api/index.html +3 -2
- package/dist/serve/docs-ui/docs/pyric-cli-register-reference-api.md +1 -2
- package/dist/serve/docs-ui/docs/pyric-cli-remote-reference-api/index.html +1067 -83
- package/dist/serve/docs-ui/docs/pyric-cli-remote-reference-api.md +1291 -160
- package/dist/serve/docs-ui/docs/pyric-cli-serve-worker-reference-api/index.html +253 -157
- package/dist/serve/docs-ui/docs/pyric-cli-serve-worker-reference-api.md +179 -85
- package/dist/serve/docs-ui/docs/pyric-cli-verify-reference-api/index.html +72 -7
- package/dist/serve/docs-ui/docs/pyric-cli-verify-reference-api.md +22 -7
- package/dist/serve/docs-ui/docs/pyric-cli-vite-reference-api/index.html +33 -12
- package/dist/serve/docs-ui/docs/pyric-cli-vite-reference-api.md +15 -12
- package/dist/serve/docs-ui/docs/pyric-database-reference-api/index.html +18 -17
- package/dist/serve/docs-ui/docs/pyric-database-reference-api.md +19 -22
- package/dist/serve/docs-ui/docs/pyric-firestore-reference-api/index.html +1512 -545
- package/dist/serve/docs-ui/docs/pyric-firestore-reference-api.md +1311 -316
- package/dist/serve/docs-ui/docs/pyric-messaging-reference-api/index.html +5 -4
- package/dist/serve/docs-ui/docs/pyric-messaging-reference-api.md +3 -4
- package/dist/serve/docs-ui/docs/pyric-messaging-sw-reference-api/index.html +69 -369
- package/dist/serve/docs-ui/docs/pyric-messaging-sw-reference-api.md +103 -216
- package/dist/serve/docs-ui/docs/pyric-rules-reference-api/index.html +10 -9
- package/dist/serve/docs-ui/docs/pyric-rules-reference-api.md +9 -10
- package/dist/serve/docs-ui/docs/pyric-sandbox-database-reference-api/index.html +8 -7
- package/dist/serve/docs-ui/docs/pyric-sandbox-database-reference-api.md +6 -7
- package/dist/serve/docs-ui/docs/pyric-sandbox-firestore-reference-api/index.html +10 -9
- package/dist/serve/docs-ui/docs/pyric-sandbox-firestore-reference-api.md +9 -10
- package/dist/serve/docs-ui/docs/pyric-sandbox-reference-api/index.html +371 -884
- package/dist/serve/docs-ui/docs/pyric-sandbox-reference-api.md +369 -883
- package/dist/serve/docs-ui/docs/pyric-storage-reference-api/index.html +25 -17
- package/dist/serve/docs-ui/docs/pyric-storage-reference-api.md +21 -19
- package/dist/serve/docs-ui/docs/pyric-ui-agents-reference-api/index.html +3 -2
- package/dist/serve/docs-ui/docs/pyric-ui-agents-reference-api.md +1 -2
- package/dist/serve/docs-ui/docs/pyric-ui-auth-hooks-reference-api/index.html +63 -776
- package/dist/serve/docs-ui/docs/pyric-ui-auth-hooks-reference-api.md +69 -510
- package/dist/serve/docs-ui/docs/pyric-ui-auth-reference-api/index.html +22 -21
- package/dist/serve/docs-ui/docs/pyric-ui-auth-reference-api.md +29 -30
- package/dist/serve/docs-ui/docs/pyric-ui-events-hooks-reference-api/index.html +15 -168
- package/dist/serve/docs-ui/docs/pyric-ui-events-hooks-reference-api.md +17 -87
- package/dist/serve/docs-ui/docs/pyric-ui-events-reference-api/index.html +6 -5
- package/dist/serve/docs-ui/docs/pyric-ui-events-reference-api.md +5 -6
- package/dist/serve/docs-ui/docs/pyric-ui-firestore-hooks-reference-api/index.html +82 -970
- package/dist/serve/docs-ui/docs/pyric-ui-firestore-hooks-reference-api.md +104 -479
- package/dist/serve/docs-ui/docs/pyric-ui-firestore-reference-api/index.html +30 -29
- package/dist/serve/docs-ui/docs/pyric-ui-firestore-reference-api.md +54 -55
- package/dist/serve/docs-ui/docs/pyric-ui-primitives-reference-api/index.html +3 -2
- package/dist/serve/docs-ui/docs/pyric-ui-primitives-reference-api.md +1 -2
- package/dist/serve/docs-ui/docs/pyric-ui-rtdb-reference-api/index.html +5 -4
- package/dist/serve/docs-ui/docs/pyric-ui-rtdb-reference-api.md +3 -4
- package/dist/serve/docs-ui/docs/pyric-ui-rules-hooks-reference-api/index.html +9 -124
- package/dist/serve/docs-ui/docs/pyric-ui-rules-hooks-reference-api.md +7 -58
- package/dist/serve/docs-ui/docs/pyric-ui-rules-reference-api/index.html +24 -23
- package/dist/serve/docs-ui/docs/pyric-ui-rules-reference-api.md +31 -34
- package/dist/serve/docs-ui/docs/pyric-ui-storage-hooks-reference-api/index.html +104 -1385
- package/dist/serve/docs-ui/docs/pyric-ui-storage-hooks-reference-api.md +133 -817
- package/dist/serve/docs-ui/docs/pyric-ui-storage-reference-api/index.html +34 -33
- package/dist/serve/docs-ui/docs/pyric-ui-storage-reference-api.md +37 -38
- package/dist/serve/docs-ui/docs/pyric-ui-traffic-hooks-reference-api/index.html +116 -1169
- package/dist/serve/docs-ui/docs/pyric-ui-traffic-hooks-reference-api.md +142 -590
- package/dist/serve/docs-ui/docs/pyric-ui-traffic-reference-api/index.html +4 -3
- package/dist/serve/docs-ui/docs/pyric-ui-traffic-reference-api.md +3 -4
- package/dist/serve/docs-ui/docs/rules-compat/index.html +34 -1
- package/dist/serve/docs-ui/docs/rules-compat.md +32 -0
- package/dist/serve/docs-ui/docs/secure/audit-your-rules/index.html +19 -2
- package/dist/serve/docs-ui/docs/secure/audit-your-rules.md +32 -0
- package/dist/serve/docs-ui/docs/secure/firestore-rules-limits/index.html +2 -1
- package/dist/serve/docs-ui/docs/secure/read-a-denial/index.html +2 -1
- package/dist/serve/docs-ui/docs/secure/rtdb-rules-in-typescript/index.html +2 -1
- package/dist/serve/docs-ui/docs/secure/rtdb-rules-in-typescript.md +1 -1
- package/dist/serve/docs-ui/docs/secure/rules-standard-library/index.html +2 -1
- package/dist/serve/docs-ui/docs/secure/secure-it-with-rules/index.html +2 -1
- package/dist/serve/docs-ui/docs/secure/simulate-and-lint/index.html +2 -1
- package/dist/serve/docs-ui/docs/secure/write-a-rules-test-suite/index.html +2 -1
- package/dist/serve/docs-ui/docs/ship/ship-to-production/index.html +2 -1
- package/dist/serve/docs-ui/docs/ship/test-in-node/index.html +2 -1
- package/dist/serve/docs-ui/docs/storage-compat/index.html +2 -1
- package/dist/serve/docs-ui/docs/trust/how-we-know-it-matches-firebase/index.html +2 -1
- package/dist/serve/docs-ui/docs/trust/versioning-and-compatibility/index.html +2 -1
- package/dist/serve/docs-ui/llms.txt +2 -1
- package/dist/serve/entries/ai.d.ts.map +1 -1
- package/dist/serve/entries/ai.js +39 -1
- package/dist/serve/entries/ai.js.map +1 -1
- package/dist/serve/entries/messaging-sw.d.ts.map +1 -1
- package/dist/serve/entries/messaging-sw.js +5 -1
- package/dist/serve/entries/messaging-sw.js.map +1 -1
- package/dist/serve/entries/messaging.d.ts.map +1 -1
- package/dist/serve/entries/messaging.js +7 -1
- package/dist/serve/entries/messaging.js.map +1 -1
- package/dist/serve/entries/runtime.d.ts.map +1 -1
- package/dist/serve/entries/runtime.js +20 -1
- package/dist/serve/entries/runtime.js.map +1 -1
- package/dist/serve/init-payload.d.ts +25 -0
- package/dist/serve/init-payload.d.ts.map +1 -1
- package/dist/serve/namespace.d.ts +39 -0
- package/dist/serve/namespace.d.ts.map +1 -1
- package/dist/serve/namespace.js +80 -1
- package/dist/serve/namespace.js.map +1 -1
- package/dist/serve/standalone-assets.d.ts +11 -9
- package/dist/serve/standalone-assets.d.ts.map +1 -1
- package/dist/serve/standalone-assets.js +6 -5
- package/dist/serve/standalone-assets.js.map +1 -1
- package/dist/serve/studio-ui/assets/{RulesCodeEditor-CXdSLKhO.js → RulesCodeEditor-CxVYcZXw.js} +1 -1
- package/dist/serve/studio-ui/assets/index-cpSfgQ7H.js +1218 -0
- package/dist/serve/studio-ui/assets/seed-DeuFKi4J.js +20 -0
- package/dist/serve/studio-ui/index.html +1 -1
- package/dist/serve/vite-plugin.d.ts +92 -15
- package/dist/serve/vite-plugin.d.ts.map +1 -1
- package/dist/serve/vite-plugin.js +281 -11
- package/dist/serve/vite-plugin.js.map +1 -1
- package/dist/serve/worker/activity-bootstrap.d.ts +8 -0
- package/dist/serve/worker/activity-bootstrap.d.ts.map +1 -0
- package/dist/serve/worker/activity-bootstrap.js +11 -0
- package/dist/serve/worker/activity-bootstrap.js.map +1 -0
- package/dist/serve/worker/client/connection.d.ts.map +1 -1
- package/dist/serve/worker/client/connection.js +17 -5
- package/dist/serve/worker/client/connection.js.map +1 -1
- package/dist/serve/worker/client/core.d.ts +2 -2
- package/dist/serve/worker/client/core.d.ts.map +1 -1
- package/dist/serve/worker/client/core.js +33 -5
- package/dist/serve/worker/client/core.js.map +1 -1
- package/dist/serve/worker/client/firestore-writes.d.ts.map +1 -1
- package/dist/serve/worker/client/firestore-writes.js +1 -0
- package/dist/serve/worker/client/firestore-writes.js.map +1 -1
- package/dist/serve/worker/client/messaging.d.ts +9 -1
- package/dist/serve/worker/client/messaging.d.ts.map +1 -1
- package/dist/serve/worker/client/messaging.js +15 -0
- package/dist/serve/worker/client/messaging.js.map +1 -1
- package/dist/serve/worker/client/studio.d.ts +10 -0
- package/dist/serve/worker/client/studio.d.ts.map +1 -1
- package/dist/serve/worker/client/studio.js +11 -0
- package/dist/serve/worker/client/studio.js.map +1 -1
- package/dist/serve/worker/durable-persistence.d.ts +12 -0
- package/dist/serve/worker/durable-persistence.d.ts.map +1 -0
- package/dist/serve/worker/durable-persistence.js +118 -0
- package/dist/serve/worker/durable-persistence.js.map +1 -0
- package/dist/serve/worker/entry.d.ts +7 -3
- package/dist/serve/worker/entry.d.ts.map +1 -1
- package/dist/serve/worker/entry.js +7 -3
- package/dist/serve/worker/entry.js.map +1 -1
- package/dist/serve/worker/host/core.d.ts +9 -5
- package/dist/serve/worker/host/core.d.ts.map +1 -1
- package/dist/serve/worker/host/core.js +34 -9
- package/dist/serve/worker/host/core.js.map +1 -1
- package/dist/serve/worker/host/dispatch.d.ts.map +1 -1
- package/dist/serve/worker/host/dispatch.js +9 -2
- package/dist/serve/worker/host/dispatch.js.map +1 -1
- package/dist/serve/worker/host/firestore-writes.d.ts.map +1 -1
- package/dist/serve/worker/host/firestore-writes.js +3 -2
- package/dist/serve/worker/host/firestore-writes.js.map +1 -1
- package/dist/serve/worker/host/studio.d.ts +1 -1
- package/dist/serve/worker/host/studio.d.ts.map +1 -1
- package/dist/serve/worker/host/studio.js +36 -1
- package/dist/serve/worker/host/studio.js.map +1 -1
- package/dist/serve/worker/host/subscriptions.d.ts.map +1 -1
- package/dist/serve/worker/host/subscriptions.js +27 -7
- package/dist/serve/worker/host/subscriptions.js.map +1 -1
- package/dist/serve/worker/host-context.d.ts +15 -0
- package/dist/serve/worker/host-context.d.ts.map +1 -1
- package/dist/serve/worker/host-context.js +10 -0
- package/dist/serve/worker/host-context.js.map +1 -1
- package/dist/serve/worker/host-messaging.d.ts.map +1 -1
- package/dist/serve/worker/host-messaging.js +9 -2
- package/dist/serve/worker/host-messaging.js.map +1 -1
- package/dist/serve/worker/index.d.ts +3 -2
- package/dist/serve/worker/index.d.ts.map +1 -1
- package/dist/serve/worker/index.js +4 -1
- package/dist/serve/worker/index.js.map +1 -1
- package/dist/serve/worker/protocol.d.ts +25 -3
- package/dist/serve/worker/protocol.d.ts.map +1 -1
- package/dist/serve/worker/protocol.js +2 -2
- package/dist/serve/worker/protocol.js.map +1 -1
- package/dist/serve/worker/serve-init.d.ts +23 -37
- package/dist/serve/worker/serve-init.d.ts.map +1 -1
- package/dist/serve/worker/serve-init.js +95 -172
- package/dist/serve/worker/serve-init.js.map +1 -1
- package/dist/vite.d.ts +4 -4
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +3 -3
- package/dist/vite.js.map +1 -1
- package/package.json +9 -4
- package/src/assurance/.generated/conformance-verdicts.ts +1090 -0
- package/src/assurance/attachment.ts +211 -0
- package/src/assurance/browser.ts +80 -0
- package/src/assurance/campaign.ts +496 -0
- package/src/assurance/capabilities.ts +446 -0
- package/src/assurance/cases.ts +43 -0
- package/src/assurance/index.ts +75 -0
- package/src/assurance/runner.ts +885 -0
- package/src/assurance/tool-names.ts +15 -0
- package/src/assurance/tools.ts +830 -0
- package/src/assurance/types.ts +352 -0
- package/src/assurance/validation.ts +434 -0
- package/src/bridge/client/bridge.ts +550 -0
- package/src/bridge/client/dispatch.ts +137 -0
- package/src/bridge/client.ts +45 -0
- package/src/bridge/protocol.ts +351 -0
- package/src/bridge/server/audit.ts +53 -0
- package/src/bridge/server/bridge.ts +597 -0
- package/src/bridge/server/headless.ts +160 -0
- package/src/bridge/server/json-schema-to-zod.ts +108 -0
- package/src/bridge/server/local-bridge.ts +66 -0
- package/src/bridge/server/logger.ts +50 -0
- package/src/bridge/server/mcp-contract.ts +93 -0
- package/src/bridge/server/mcp.ts +129 -0
- package/src/bridge/server/peer.ts +232 -0
- package/src/bridge/server/standalone.ts +347 -0
- package/src/bridge/server/tool-metadata.ts +99 -0
- package/src/bridge/server.ts +28 -0
- package/src/cli/can-i-use.ts +50 -0
- package/src/cli/cli.test.ts +493 -0
- package/src/cli/database-rules.ts +329 -0
- package/src/cli/dev-runner.ts +282 -0
- package/src/cli/firebase-json.ts +100 -0
- package/src/cli/firestore-indexes.ts +70 -0
- package/src/cli/index.ts +425 -0
- package/src/cli/init.ts +260 -0
- package/src/cli/mcp-proxy.ts +196 -0
- package/src/cli/parse-args.ts +80 -0
- package/src/cli/rules.ts +259 -0
- package/src/cli/scope.ts +67 -0
- package/src/cli/serve.ts +996 -0
- package/src/cli/service-commands.ts +73 -0
- package/src/cli/snapshot.ts +164 -0
- package/src/cli/storage-rules.ts +172 -0
- package/src/cli/verify.ts +416 -0
- package/src/conformance/.generated/can-i-use-browser.ts +113 -0
- package/src/conformance/.generated/can-i-use.ts +117 -0
- package/src/conformance/.generated/conformance-docs.ts +14 -0
- package/src/conformance/browser.ts +24 -0
- package/src/conformance/can-i-use-tool.ts +51 -0
- package/src/conformance/can-i-use.ts +18 -0
- package/src/conformance/docs.ts +8 -0
- package/src/conformance/index.ts +20 -0
- package/src/conformance/tools.ts +16 -0
- package/src/credentials/core/memoize-ttl.ts +142 -0
- package/src/credentials/core/types.ts +10 -0
- package/src/credentials/node/from-adc.ts +96 -0
- package/src/credentials/node/from-service-account.ts +133 -0
- package/src/credentials/node/index.ts +6 -0
- package/src/discover/concurrency.ts +127 -0
- package/src/discover/crawler-adapter.ts +142 -0
- package/src/discover/crawler.ts +1127 -0
- package/src/discover/credential-free.ts +27 -0
- package/src/discover/findCollectionGroup.ts +131 -0
- package/src/discover/firestore-source.ts +59 -0
- package/src/discover/index.ts +5 -0
- package/src/discover/merge.ts +523 -0
- package/src/discover/session.ts +402 -0
- package/src/discover/tools.ts +201 -0
- package/src/discover/types.ts +187 -0
- package/src/discover/wire.ts +324 -0
- package/src/functions-rtdb/child.ts +382 -0
- package/src/functions-rtdb/delivery.ts +7 -0
- package/src/functions-rtdb/discovery.ts +136 -0
- package/src/functions-rtdb/event.ts +64 -0
- package/src/functions-rtdb/execution.ts +111 -0
- package/src/functions-rtdb/in-memory-delivery.ts +40 -0
- package/src/functions-rtdb/project.ts +74 -0
- package/src/functions-rtdb/projection.ts +104 -0
- package/src/functions-rtdb/reference-pattern.ts +20 -0
- package/src/functions-rtdb/remote-delivery.ts +23 -0
- package/src/pkg-version.ts +49 -0
- package/src/register/esm-exports.ts +63 -0
- package/src/register/hooks.ts +30 -0
- package/src/register/index.ts +150 -0
- package/src/register/mapping.ts +33 -0
- package/src/remote/index.ts +1050 -0
- package/src/rtdb/crawl-snapshot.ts +118 -0
- package/src/rtdb/inspection.ts +137 -0
- package/src/rtdb/load-rules-document.ts +56 -0
- package/src/rtdb/rules-generation-tool.ts +38 -0
- package/src/rtdb/rules-json.ts +29 -0
- package/src/serve/activity-guard.ts +29 -0
- package/src/serve/activity-route.ts +164 -0
- package/src/serve/activity-warning.ts +26 -0
- package/src/serve/bridge-mount.ts +200 -0
- package/src/serve/bundler.ts +493 -0
- package/src/serve/capture-store.ts +65 -0
- package/src/serve/discovery.ts +199 -0
- package/src/serve/entries/ai.ts +292 -0
- package/src/serve/entries/app-backend.ts +4 -0
- package/src/serve/entries/app-client.ts +26 -0
- package/src/serve/entries/app-session-store.ts +47 -0
- package/src/serve/entries/app.ts +11 -0
- package/src/serve/entries/auth-helper-core.ts +181 -0
- package/src/serve/entries/auth-helper-dom.ts +134 -0
- package/src/serve/entries/auth-helper-runtime.ts +20 -0
- package/src/serve/entries/auth.ts +255 -0
- package/src/serve/entries/bridge-url.ts +31 -0
- package/src/serve/entries/database.ts +129 -0
- package/src/serve/entries/firestore.ts +232 -0
- package/src/serve/entries/init.ts +46 -0
- package/src/serve/entries/keepalive.ts +46 -0
- package/src/serve/entries/messaging-sw.ts +75 -0
- package/src/serve/entries/messaging.ts +96 -0
- package/src/serve/entries/runtime.ts +540 -0
- package/src/serve/entries/session-store.ts +97 -0
- package/src/serve/entries/storage.ts +92 -0
- package/src/serve/entries/tab-sync-wiring.ts +274 -0
- package/src/serve/entries/worker-runtime.ts +75 -0
- package/src/serve/init-payload.ts +42 -0
- package/src/serve/namespace.ts +675 -0
- package/src/serve/open-browser.ts +68 -0
- package/src/serve/rules.ts +272 -0
- package/src/serve/sandbox-marker.ts +31 -0
- package/src/serve/server.ts +428 -0
- package/src/serve/standalone-assets.ts +180 -0
- package/src/serve/state-store.ts +166 -0
- package/src/serve/studio/disk-project-store.ts +185 -0
- package/src/serve/studio/disk-workspace.ts +162 -0
- package/src/serve/studio/index.ts +20 -0
- package/src/serve/studio/routes.ts +237 -0
- package/src/serve/studio/store-types.ts +48 -0
- package/src/serve/studio/studio-storage.test.ts +289 -0
- package/src/serve/vite-plugin.ts +1102 -0
- package/src/serve/worker/activity-bootstrap.ts +24 -0
- package/src/serve/worker/client/admin-firestore.ts +38 -0
- package/src/serve/worker/client/ai.ts +124 -0
- package/src/serve/worker/client/auth.ts +489 -0
- package/src/serve/worker/client/connection.ts +202 -0
- package/src/serve/worker/client/core.ts +350 -0
- package/src/serve/worker/client/disconnect.ts +45 -0
- package/src/serve/worker/client/firestore-reads.ts +181 -0
- package/src/serve/worker/client/firestore-refs.ts +226 -0
- package/src/serve/worker/client/firestore-writes.ts +232 -0
- package/src/serve/worker/client/handles.ts +91 -0
- package/src/serve/worker/client/messaging.ts +119 -0
- package/src/serve/worker/client/presence.ts +174 -0
- package/src/serve/worker/client/rtdb.ts +311 -0
- package/src/serve/worker/client/rules.ts +63 -0
- package/src/serve/worker/client/service-worker-connection.ts +59 -0
- package/src/serve/worker/client/snapshots.ts +86 -0
- package/src/serve/worker/client/storage.ts +195 -0
- package/src/serve/worker/client/studio.ts +88 -0
- package/src/serve/worker/client.ts +57 -0
- package/src/serve/worker/durable-persistence.ts +137 -0
- package/src/serve/worker/entry.ts +179 -0
- package/src/serve/worker/host/admin-firestore.ts +88 -0
- package/src/serve/worker/host/connection.ts +179 -0
- package/src/serve/worker/host/core.ts +387 -0
- package/src/serve/worker/host/dispatch.ts +316 -0
- package/src/serve/worker/host/firestore-reads.ts +117 -0
- package/src/serve/worker/host/firestore-writes.ts +456 -0
- package/src/serve/worker/host/presence.ts +312 -0
- package/src/serve/worker/host/rtdb.ts +136 -0
- package/src/serve/worker/host/rules.ts +128 -0
- package/src/serve/worker/host/storage.ts +312 -0
- package/src/serve/worker/host/studio.ts +75 -0
- package/src/serve/worker/host/subscriptions.ts +238 -0
- package/src/serve/worker/host-ai.ts +165 -0
- package/src/serve/worker/host-auth.ts +469 -0
- package/src/serve/worker/host-context.ts +273 -0
- package/src/serve/worker/host-events.ts +94 -0
- package/src/serve/worker/host-messaging.ts +240 -0
- package/src/serve/worker/host.ts +47 -0
- package/src/serve/worker/index.ts +196 -0
- package/src/serve/worker/presence-timing.ts +15 -0
- package/src/serve/worker/protocol.ts +1112 -0
- package/src/serve/worker/serve-init.ts +606 -0
- package/src/serve/worker/service-worker-channel.ts +33 -0
- package/src/serve/worker/service-worker-relay.ts +86 -0
- package/src/serve/writer-lock.ts +53 -0
- package/src/verify/cases.ts +233 -0
- package/src/verify/fixture.ts +258 -0
- package/src/verify/index.ts +519 -0
- package/src/verify/tools.ts +108 -0
- package/src/version/compat-target.ts +17 -0
- package/src/vite.ts +17 -0
- package/dist/serve/docs-ui/docs/pyric-firestore-values-reference-api/index.html +0 -30
- package/dist/serve/docs-ui/docs/pyric-firestore-values-reference-api.md +0 -30
- package/dist/serve/studio-ui/assets/index-BvtQIpGn.js +0 -1211
- package/dist/serve/studio-ui/assets/seed-3DMedLL3.js +0 -2
|
@@ -1,30 +1,2241 @@
|
|
|
1
|
+
<!-- Generated from published package declarations via TypeDoc. Rendered by the api-reference content loader. -->
|
|
1
2
|
|
|
2
|
-
|
|
3
|
+
## Interfaces
|
|
4
|
+
|
|
5
|
+
<a id="admindocumentsnapshot"></a>
|
|
6
|
+
|
|
7
|
+
### AdminDocumentSnapshot
|
|
8
|
+
|
|
9
|
+
#### Extended by
|
|
10
|
+
|
|
11
|
+
- [`AdminQueryDocumentSnapshot`](#adminquerydocumentsnapshot)
|
|
12
|
+
|
|
13
|
+
#### Properties
|
|
14
|
+
|
|
15
|
+
| Property | Modifier | Type |
|
|
16
|
+
| :------ | :------ | :------ |
|
|
17
|
+
| <a id="exists"></a> `exists` | `readonly` | `boolean` |
|
|
18
|
+
| <a id="id"></a> `id` | `readonly` | `string` |
|
|
19
|
+
| <a id="ref"></a> `ref` | `readonly` | [`DocumentReference`](#documentreference) |
|
|
20
|
+
|
|
21
|
+
#### Methods
|
|
22
|
+
|
|
23
|
+
<a id="data"></a>
|
|
24
|
+
|
|
25
|
+
##### data()
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
data(): DocumentData;
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
###### Returns
|
|
32
|
+
|
|
33
|
+
[`DocumentData`](pyric-firestore-reference-api.md#documentdata)
|
|
34
|
+
|
|
35
|
+
***
|
|
36
|
+
|
|
37
|
+
<a id="adminquerydocumentsnapshot"></a>
|
|
38
|
+
|
|
39
|
+
### AdminQueryDocumentSnapshot
|
|
40
|
+
|
|
41
|
+
#### Extends
|
|
42
|
+
|
|
43
|
+
- [`AdminDocumentSnapshot`](#admindocumentsnapshot)
|
|
44
|
+
|
|
45
|
+
#### Properties
|
|
46
|
+
|
|
47
|
+
| Property | Modifier | Type |
|
|
48
|
+
| :------ | :------ | :------ |
|
|
49
|
+
| <a id="exists-1"></a> `exists` | `readonly` | `boolean` |
|
|
50
|
+
| <a id="id-1"></a> `id` | `readonly` | `string` |
|
|
51
|
+
| <a id="ref-1"></a> `ref` | `readonly` | [`DocumentReference`](#documentreference) |
|
|
52
|
+
|
|
53
|
+
#### Methods
|
|
54
|
+
|
|
55
|
+
<a id="data-2"></a>
|
|
56
|
+
|
|
57
|
+
##### data()
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
data(): DocumentData;
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
###### Returns
|
|
64
|
+
|
|
65
|
+
[`DocumentData`](pyric-firestore-reference-api.md#documentdata)
|
|
66
|
+
|
|
67
|
+
###### Overrides
|
|
68
|
+
|
|
69
|
+
[`AdminDocumentSnapshot`](#admindocumentsnapshot).[`data`](#data)
|
|
70
|
+
|
|
71
|
+
***
|
|
72
|
+
|
|
73
|
+
<a id="adminquerysnapshot"></a>
|
|
74
|
+
|
|
75
|
+
### AdminQuerySnapshot
|
|
76
|
+
|
|
77
|
+
#### Properties
|
|
78
|
+
|
|
79
|
+
| Property | Modifier | Type |
|
|
80
|
+
| :------ | :------ | :------ |
|
|
81
|
+
| <a id="docs"></a> `docs` | `readonly` | [`AdminQueryDocumentSnapshot`](#adminquerydocumentsnapshot)[] |
|
|
82
|
+
| <a id="empty"></a> `empty` | `readonly` | `boolean` |
|
|
83
|
+
| <a id="size"></a> `size` | `readonly` | `number` |
|
|
84
|
+
|
|
85
|
+
#### Methods
|
|
86
|
+
|
|
87
|
+
<a id="foreach"></a>
|
|
88
|
+
|
|
89
|
+
##### forEach()
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
forEach(callback: (snap: AdminQueryDocumentSnapshot) => void): void;
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
###### Parameters
|
|
96
|
+
|
|
97
|
+
| Parameter | Type |
|
|
98
|
+
| :------ | :------ |
|
|
99
|
+
| `callback` | (`snap`: [`AdminQueryDocumentSnapshot`](#adminquerydocumentsnapshot)) => `void` |
|
|
100
|
+
|
|
101
|
+
###### Returns
|
|
102
|
+
|
|
103
|
+
`void`
|
|
104
|
+
|
|
105
|
+
***
|
|
106
|
+
|
|
107
|
+
<a id="aggregatequerysnapshot"></a>
|
|
108
|
+
|
|
109
|
+
### AggregateQuerySnapshot
|
|
110
|
+
|
|
111
|
+
Result of `Query.aggregate(spec).get()`. `.data()` returns the
|
|
112
|
+
computed numbers under the spec's aliases. Empty-input averages
|
|
113
|
+
resolve to `null` to mirror Firestore production behavior
|
|
114
|
+
(averaging over zero documents has no meaningful number).
|
|
115
|
+
|
|
116
|
+
#### Methods
|
|
117
|
+
|
|
118
|
+
<a id="data-4"></a>
|
|
119
|
+
|
|
120
|
+
##### data()
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
data(): Record<string, number | null>;
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
###### Returns
|
|
127
|
+
|
|
128
|
+
`Record`\<`string`, `number` \| `null`\>
|
|
129
|
+
|
|
130
|
+
***
|
|
131
|
+
|
|
132
|
+
<a id="collectionreference"></a>
|
|
133
|
+
|
|
134
|
+
### CollectionReference
|
|
135
|
+
|
|
136
|
+
#### Extends
|
|
137
|
+
|
|
138
|
+
- [`Query`](#query)
|
|
139
|
+
|
|
140
|
+
#### Properties
|
|
141
|
+
|
|
142
|
+
| Property | Modifier | Type |
|
|
143
|
+
| :------ | :------ | :------ |
|
|
144
|
+
| <a id="id-2"></a> `id` | `readonly` | `string` |
|
|
145
|
+
| <a id="path"></a> `path` | `readonly` | `string` |
|
|
146
|
+
|
|
147
|
+
#### Methods
|
|
148
|
+
|
|
149
|
+
<a id="add"></a>
|
|
150
|
+
|
|
151
|
+
##### add()
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
add(data: DocumentData, opts?: OperationOptions): Promise<DocumentReference>;
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
###### Parameters
|
|
158
|
+
|
|
159
|
+
| Parameter | Type |
|
|
160
|
+
| :------ | :------ |
|
|
161
|
+
| `data` | [`DocumentData`](pyric-firestore-reference-api.md#documentdata) |
|
|
162
|
+
| `opts?` | `OperationOptions` |
|
|
163
|
+
|
|
164
|
+
###### Returns
|
|
165
|
+
|
|
166
|
+
`Promise`\<[`DocumentReference`](#documentreference)\>
|
|
167
|
+
|
|
168
|
+
<a id="aggregate"></a>
|
|
169
|
+
|
|
170
|
+
##### aggregate()
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
aggregate(spec: AggregateSpec): Promise<AggregateQuerySnapshot>;
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Compute one or more aggregates over the documents matching this
|
|
177
|
+
query. Mirrors the Admin SDK's `query.aggregate({ … }).get()`
|
|
178
|
+
pattern, collapsed into one call for the simulator (no need to
|
|
179
|
+
build an `AggregateQuery` reference type when there's no remote
|
|
180
|
+
dispatch).
|
|
181
|
+
|
|
182
|
+
Each entry in `spec` is keyed by a caller-chosen alias and
|
|
183
|
+
resolves to an `AggregateField`. The returned snapshot exposes
|
|
184
|
+
the computed numbers under the same aliases via `.data()`.
|
|
185
|
+
|
|
186
|
+
Where / orderBy clauses ARE applied before aggregation (they
|
|
187
|
+
narrow the candidate doc set). `limit` is honored — the aggregate
|
|
188
|
+
computes against the limited set, matching production semantics.
|
|
189
|
+
|
|
190
|
+
###### Parameters
|
|
191
|
+
|
|
192
|
+
| Parameter | Type |
|
|
193
|
+
| :------ | :------ |
|
|
194
|
+
| `spec` | [`AggregateSpec`](#aggregatespec) |
|
|
195
|
+
|
|
196
|
+
###### Returns
|
|
197
|
+
|
|
198
|
+
`Promise`\<[`AggregateQuerySnapshot`](#aggregatequerysnapshot)\>
|
|
199
|
+
|
|
200
|
+
###### Inherited from
|
|
201
|
+
|
|
202
|
+
[`Query`](#query).[`aggregate`](#aggregate-2)
|
|
203
|
+
|
|
204
|
+
<a id="applyfilter"></a>
|
|
205
|
+
|
|
206
|
+
##### applyFilter()
|
|
207
|
+
|
|
208
|
+
```ts
|
|
209
|
+
applyFilter(filter: Filter): Query;
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Add a composite filter (leaf, AND, or OR) to the query's filter
|
|
213
|
+
stack. Each `applyFilter` call AND-s with whatever filters are
|
|
214
|
+
already on the query — same implicit-AND semantics as multiple
|
|
215
|
+
`where()` calls. To OR multiple predicates, wrap them with
|
|
216
|
+
`{ kind: 'or', filters: [...] }` before calling. Backs the
|
|
217
|
+
modular `or()` / `and()` constraints in `pyric/firestore`.
|
|
218
|
+
|
|
219
|
+
###### Parameters
|
|
220
|
+
|
|
221
|
+
| Parameter | Type |
|
|
222
|
+
| :------ | :------ |
|
|
223
|
+
| `filter` | [`Filter`](#filter) |
|
|
224
|
+
|
|
225
|
+
###### Returns
|
|
226
|
+
|
|
227
|
+
[`Query`](#query)
|
|
228
|
+
|
|
229
|
+
###### Inherited from
|
|
230
|
+
|
|
231
|
+
[`Query`](#query).[`applyFilter`](#applyfilter-2)
|
|
232
|
+
|
|
233
|
+
<a id="doc"></a>
|
|
234
|
+
|
|
235
|
+
##### doc()
|
|
236
|
+
|
|
237
|
+
```ts
|
|
238
|
+
doc(id?: string): DocumentReference;
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
###### Parameters
|
|
242
|
+
|
|
243
|
+
| Parameter | Type |
|
|
244
|
+
| :------ | :------ |
|
|
245
|
+
| `id?` | `string` |
|
|
246
|
+
|
|
247
|
+
###### Returns
|
|
248
|
+
|
|
249
|
+
[`DocumentReference`](#documentreference)
|
|
250
|
+
|
|
251
|
+
<a id="endcursor"></a>
|
|
252
|
+
|
|
253
|
+
##### endCursor()
|
|
254
|
+
|
|
255
|
+
```ts
|
|
256
|
+
endCursor(values: unknown[], inclusive: boolean): Query;
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Set the end position of the query relative to the orderBy fields.
|
|
260
|
+
`inclusive` controls `endAt` (true) vs `endBefore` (false).
|
|
261
|
+
|
|
262
|
+
###### Parameters
|
|
263
|
+
|
|
264
|
+
| Parameter | Type |
|
|
265
|
+
| :------ | :------ |
|
|
266
|
+
| `values` | `unknown`[] |
|
|
267
|
+
| `inclusive` | `boolean` |
|
|
268
|
+
|
|
269
|
+
###### Returns
|
|
270
|
+
|
|
271
|
+
[`Query`](#query)
|
|
272
|
+
|
|
273
|
+
###### Inherited from
|
|
274
|
+
|
|
275
|
+
[`Query`](#query).[`endCursor`](#endcursor-2)
|
|
276
|
+
|
|
277
|
+
<a id="endcursorfromsnapshot"></a>
|
|
278
|
+
|
|
279
|
+
##### endCursorFromSnapshot()
|
|
280
|
+
|
|
281
|
+
```ts
|
|
282
|
+
endCursorFromSnapshot(snapshot: AdminDocumentSnapshot, inclusive: boolean): Query;
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Snapshot-based variant of [endCursor](#endcursor-2).
|
|
286
|
+
|
|
287
|
+
###### Parameters
|
|
288
|
+
|
|
289
|
+
| Parameter | Type |
|
|
290
|
+
| :------ | :------ |
|
|
291
|
+
| `snapshot` | [`AdminDocumentSnapshot`](#admindocumentsnapshot) |
|
|
292
|
+
| `inclusive` | `boolean` |
|
|
293
|
+
|
|
294
|
+
###### Returns
|
|
295
|
+
|
|
296
|
+
[`Query`](#query)
|
|
297
|
+
|
|
298
|
+
###### Inherited from
|
|
299
|
+
|
|
300
|
+
[`Query`](#query).[`endCursorFromSnapshot`](#endcursorfromsnapshot-2)
|
|
301
|
+
|
|
302
|
+
<a id="get"></a>
|
|
303
|
+
|
|
304
|
+
##### get()
|
|
305
|
+
|
|
306
|
+
```ts
|
|
307
|
+
get(opts?: OperationOptions): Promise<AdminQuerySnapshot>;
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
###### Parameters
|
|
311
|
+
|
|
312
|
+
| Parameter | Type |
|
|
313
|
+
| :------ | :------ |
|
|
314
|
+
| `opts?` | `OperationOptions` |
|
|
315
|
+
|
|
316
|
+
###### Returns
|
|
317
|
+
|
|
318
|
+
`Promise`\<[`AdminQuerySnapshot`](#adminquerysnapshot)\>
|
|
319
|
+
|
|
320
|
+
###### Inherited from
|
|
321
|
+
|
|
322
|
+
[`Query`](#query).[`get`](#get-6)
|
|
323
|
+
|
|
324
|
+
<a id="limit"></a>
|
|
325
|
+
|
|
326
|
+
##### limit()
|
|
327
|
+
|
|
328
|
+
```ts
|
|
329
|
+
limit(n: number): Query;
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
###### Parameters
|
|
333
|
+
|
|
334
|
+
| Parameter | Type |
|
|
335
|
+
| :------ | :------ |
|
|
336
|
+
| `n` | `number` |
|
|
337
|
+
|
|
338
|
+
###### Returns
|
|
339
|
+
|
|
340
|
+
[`Query`](#query)
|
|
341
|
+
|
|
342
|
+
###### Inherited from
|
|
343
|
+
|
|
344
|
+
[`Query`](#query).[`limit`](#limit-2)
|
|
345
|
+
|
|
346
|
+
<a id="limittolast"></a>
|
|
347
|
+
|
|
348
|
+
##### limitToLast()
|
|
349
|
+
|
|
350
|
+
```ts
|
|
351
|
+
limitToLast(n: number): Query;
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Limit from the END of the ordered result. Equivalent to reversing
|
|
355
|
+
the orderBy, taking `n`, then re-reversing — the simulator
|
|
356
|
+
implements it that way. Requires at least one `orderBy` clause on
|
|
357
|
+
the query (matches the JS SDK's runtime contract).
|
|
358
|
+
|
|
359
|
+
###### Parameters
|
|
360
|
+
|
|
361
|
+
| Parameter | Type |
|
|
362
|
+
| :------ | :------ |
|
|
363
|
+
| `n` | `number` |
|
|
364
|
+
|
|
365
|
+
###### Returns
|
|
366
|
+
|
|
367
|
+
[`Query`](#query)
|
|
368
|
+
|
|
369
|
+
###### Inherited from
|
|
370
|
+
|
|
371
|
+
[`Query`](#query).[`limitToLast`](#limittolast-2)
|
|
372
|
+
|
|
373
|
+
<a id="orderby"></a>
|
|
374
|
+
|
|
375
|
+
##### orderBy()
|
|
376
|
+
|
|
377
|
+
```ts
|
|
378
|
+
orderBy(field: string, direction?: OrderDirection): Query;
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
###### Parameters
|
|
382
|
+
|
|
383
|
+
| Parameter | Type |
|
|
384
|
+
| :------ | :------ |
|
|
385
|
+
| `field` | `string` |
|
|
386
|
+
| `direction?` | [`OrderDirection`](pyric-firestore-reference-api.md#orderdirection) |
|
|
387
|
+
|
|
388
|
+
###### Returns
|
|
389
|
+
|
|
390
|
+
[`Query`](#query)
|
|
391
|
+
|
|
392
|
+
###### Inherited from
|
|
393
|
+
|
|
394
|
+
[`Query`](#query).[`orderBy`](#orderby-2)
|
|
395
|
+
|
|
396
|
+
<a id="startcursor"></a>
|
|
397
|
+
|
|
398
|
+
##### startCursor()
|
|
399
|
+
|
|
400
|
+
```ts
|
|
401
|
+
startCursor(values: unknown[], inclusive: boolean): Query;
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Set the start position of the query relative to the orderBy
|
|
405
|
+
fields. `values` corresponds 1:1 with the orderBy clauses on the
|
|
406
|
+
query (one value per clause); `inclusive` controls `startAt` (true)
|
|
407
|
+
vs `startAfter` (false). Repeated calls replace the previous
|
|
408
|
+
cursor — matches production.
|
|
409
|
+
|
|
410
|
+
###### Parameters
|
|
411
|
+
|
|
412
|
+
| Parameter | Type |
|
|
413
|
+
| :------ | :------ |
|
|
414
|
+
| `values` | `unknown`[] |
|
|
415
|
+
| `inclusive` | `boolean` |
|
|
416
|
+
|
|
417
|
+
###### Returns
|
|
418
|
+
|
|
419
|
+
[`Query`](#query)
|
|
420
|
+
|
|
421
|
+
###### Inherited from
|
|
422
|
+
|
|
423
|
+
[`Query`](#query).[`startCursor`](#startcursor-2)
|
|
424
|
+
|
|
425
|
+
<a id="startcursorfromsnapshot"></a>
|
|
426
|
+
|
|
427
|
+
##### startCursorFromSnapshot()
|
|
428
|
+
|
|
429
|
+
```ts
|
|
430
|
+
startCursorFromSnapshot(snapshot: AdminDocumentSnapshot, inclusive: boolean): Query;
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
Variant of [startCursor](#startcursor-2) that takes a `DocumentSnapshot`
|
|
434
|
+
and extracts the cursor values from the snapshot's data at each
|
|
435
|
+
orderBy field. Mirrors the JS SDK's `startAt(snapshot)` overload
|
|
436
|
+
and shines for cursor-based pagination ("hand me the next page
|
|
437
|
+
after this one"). Requires at least one `orderBy` clause —
|
|
438
|
+
thrown at call time, not at get-time, so the failure surfaces
|
|
439
|
+
close to the bug.
|
|
440
|
+
|
|
441
|
+
###### Parameters
|
|
442
|
+
|
|
443
|
+
| Parameter | Type |
|
|
444
|
+
| :------ | :------ |
|
|
445
|
+
| `snapshot` | [`AdminDocumentSnapshot`](#admindocumentsnapshot) |
|
|
446
|
+
| `inclusive` | `boolean` |
|
|
447
|
+
|
|
448
|
+
###### Returns
|
|
449
|
+
|
|
450
|
+
[`Query`](#query)
|
|
451
|
+
|
|
452
|
+
###### Inherited from
|
|
453
|
+
|
|
454
|
+
[`Query`](#query).[`startCursorFromSnapshot`](#startcursorfromsnapshot-2)
|
|
455
|
+
|
|
456
|
+
<a id="where"></a>
|
|
457
|
+
|
|
458
|
+
##### where()
|
|
459
|
+
|
|
460
|
+
```ts
|
|
461
|
+
where(
|
|
462
|
+
field: string,
|
|
463
|
+
op: WhereFilterOp,
|
|
464
|
+
value: unknown): Query;
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
###### Parameters
|
|
468
|
+
|
|
469
|
+
| Parameter | Type |
|
|
470
|
+
| :------ | :------ |
|
|
471
|
+
| `field` | `string` |
|
|
472
|
+
| `op` | [`WhereFilterOp`](pyric-firestore-reference-api.md#wherefilterop) |
|
|
473
|
+
| `value` | `unknown` |
|
|
474
|
+
|
|
475
|
+
###### Returns
|
|
476
|
+
|
|
477
|
+
[`Query`](#query)
|
|
478
|
+
|
|
479
|
+
###### Inherited from
|
|
480
|
+
|
|
481
|
+
[`Query`](#query).[`where`](#where-2)
|
|
482
|
+
|
|
483
|
+
***
|
|
484
|
+
|
|
485
|
+
<a id="docchangesoptions"></a>
|
|
486
|
+
|
|
487
|
+
### DocChangesOptions
|
|
488
|
+
|
|
489
|
+
Options for `QuerySnapshot.docChanges`. Mirrors Web SDK shape.
|
|
490
|
+
|
|
491
|
+
#### Properties
|
|
492
|
+
|
|
493
|
+
| Property | Type |
|
|
494
|
+
| :------ | :------ |
|
|
495
|
+
| <a id="includemetadatachanges"></a> `includeMetadataChanges?` | `boolean` |
|
|
496
|
+
|
|
497
|
+
***
|
|
498
|
+
|
|
499
|
+
<a id="documentchange"></a>
|
|
500
|
+
|
|
501
|
+
### DocumentChange
|
|
502
|
+
|
|
503
|
+
#### Properties
|
|
504
|
+
|
|
505
|
+
| Property | Modifier | Type | Description |
|
|
506
|
+
| :------ | :------ | :------ | :------ |
|
|
507
|
+
| <a id="doc-2"></a> `doc` | `readonly` | [`QueryDocumentSnapshot`](#querydocumentsnapshot) | - |
|
|
508
|
+
| <a id="newindex"></a> `newIndex` | `readonly` | `number` | -1 for `removed`. |
|
|
509
|
+
| <a id="oldindex"></a> `oldIndex` | `readonly` | `number` | -1 for `added`. |
|
|
510
|
+
| <a id="type"></a> `type` | `readonly` | [`DocumentChangeType`](#documentchangetype-1) | - |
|
|
511
|
+
|
|
512
|
+
***
|
|
513
|
+
|
|
514
|
+
<a id="documentreference"></a>
|
|
515
|
+
|
|
516
|
+
### DocumentReference
|
|
517
|
+
|
|
518
|
+
#### Properties
|
|
519
|
+
|
|
520
|
+
| Property | Modifier | Type |
|
|
521
|
+
| :------ | :------ | :------ |
|
|
522
|
+
| <a id="id-3"></a> `id` | `readonly` | `string` |
|
|
523
|
+
| <a id="parent"></a> `parent` | `readonly` | [`CollectionReference`](#collectionreference) |
|
|
524
|
+
| <a id="path-1"></a> `path` | `readonly` | `string` |
|
|
525
|
+
|
|
526
|
+
#### Methods
|
|
527
|
+
|
|
528
|
+
<a id="collection"></a>
|
|
529
|
+
|
|
530
|
+
##### collection()
|
|
531
|
+
|
|
532
|
+
```ts
|
|
533
|
+
collection(name: string): CollectionReference;
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
###### Parameters
|
|
537
|
+
|
|
538
|
+
| Parameter | Type |
|
|
539
|
+
| :------ | :------ |
|
|
540
|
+
| `name` | `string` |
|
|
541
|
+
|
|
542
|
+
###### Returns
|
|
543
|
+
|
|
544
|
+
[`CollectionReference`](#collectionreference)
|
|
545
|
+
|
|
546
|
+
<a id="delete"></a>
|
|
547
|
+
|
|
548
|
+
##### delete()
|
|
549
|
+
|
|
550
|
+
```ts
|
|
551
|
+
delete(opts?: OperationOptions): Promise<void>;
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
###### Parameters
|
|
555
|
+
|
|
556
|
+
| Parameter | Type |
|
|
557
|
+
| :------ | :------ |
|
|
558
|
+
| `opts?` | `OperationOptions` |
|
|
559
|
+
|
|
560
|
+
###### Returns
|
|
561
|
+
|
|
562
|
+
`Promise`\<`void`\>
|
|
563
|
+
|
|
564
|
+
<a id="get-2"></a>
|
|
565
|
+
|
|
566
|
+
##### get()
|
|
567
|
+
|
|
568
|
+
```ts
|
|
569
|
+
get(opts?: OperationOptions): Promise<AdminDocumentSnapshot>;
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
###### Parameters
|
|
573
|
+
|
|
574
|
+
| Parameter | Type |
|
|
575
|
+
| :------ | :------ |
|
|
576
|
+
| `opts?` | `OperationOptions` |
|
|
577
|
+
|
|
578
|
+
###### Returns
|
|
579
|
+
|
|
580
|
+
`Promise`\<[`AdminDocumentSnapshot`](#admindocumentsnapshot)\>
|
|
581
|
+
|
|
582
|
+
<a id="set"></a>
|
|
583
|
+
|
|
584
|
+
##### set()
|
|
585
|
+
|
|
586
|
+
```ts
|
|
587
|
+
set(data: DocumentData, options?: SetOptions): Promise<void>;
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
###### Parameters
|
|
591
|
+
|
|
592
|
+
| Parameter | Type |
|
|
593
|
+
| :------ | :------ |
|
|
594
|
+
| `data` | [`DocumentData`](pyric-firestore-reference-api.md#documentdata) |
|
|
595
|
+
| `options?` | [`SetOptions`](#setoptions) |
|
|
596
|
+
|
|
597
|
+
###### Returns
|
|
598
|
+
|
|
599
|
+
`Promise`\<`void`\>
|
|
600
|
+
|
|
601
|
+
<a id="update"></a>
|
|
602
|
+
|
|
603
|
+
##### update()
|
|
604
|
+
|
|
605
|
+
```ts
|
|
606
|
+
update(data: DocumentData, opts?: OperationOptions): Promise<void>;
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
###### Parameters
|
|
610
|
+
|
|
611
|
+
| Parameter | Type |
|
|
612
|
+
| :------ | :------ |
|
|
613
|
+
| `data` | [`DocumentData`](pyric-firestore-reference-api.md#documentdata) |
|
|
614
|
+
| `opts?` | `OperationOptions` |
|
|
615
|
+
|
|
616
|
+
###### Returns
|
|
617
|
+
|
|
618
|
+
`Promise`\<`void`\>
|
|
619
|
+
|
|
620
|
+
***
|
|
621
|
+
|
|
622
|
+
<a id="documentsnapshot"></a>
|
|
623
|
+
|
|
624
|
+
### DocumentSnapshot
|
|
625
|
+
|
|
626
|
+
#### Extended by
|
|
627
|
+
|
|
628
|
+
- [`QueryDocumentSnapshot`](#querydocumentsnapshot)
|
|
629
|
+
|
|
630
|
+
#### Properties
|
|
631
|
+
|
|
632
|
+
| Property | Modifier | Type |
|
|
633
|
+
| :------ | :------ | :------ |
|
|
634
|
+
| <a id="id-4"></a> `id` | `readonly` | `string` |
|
|
635
|
+
| <a id="metadata"></a> `metadata` | `readonly` | [`SnapshotMetadata`](#snapshotmetadata) |
|
|
636
|
+
| <a id="ref-2"></a> `ref` | `readonly` | `SnapshotDocRef` |
|
|
637
|
+
|
|
638
|
+
#### Methods
|
|
639
|
+
|
|
640
|
+
<a id="data-6"></a>
|
|
641
|
+
|
|
642
|
+
##### data()
|
|
643
|
+
|
|
644
|
+
```ts
|
|
645
|
+
data(): DocumentData;
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
###### Returns
|
|
649
|
+
|
|
650
|
+
`DocumentData`
|
|
651
|
+
|
|
652
|
+
<a id="exists-2"></a>
|
|
653
|
+
|
|
654
|
+
##### exists()
|
|
655
|
+
|
|
656
|
+
```ts
|
|
657
|
+
exists(): boolean;
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
###### Returns
|
|
661
|
+
|
|
662
|
+
`boolean`
|
|
663
|
+
|
|
664
|
+
<a id="get-4"></a>
|
|
665
|
+
|
|
666
|
+
##### get()
|
|
667
|
+
|
|
668
|
+
```ts
|
|
669
|
+
get(fieldPath: string): unknown;
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
Field accessor mirroring `firebase/firestore`'s `DocumentSnapshot.get(fieldPath)`.
|
|
673
|
+
Dotted paths supported. Missing intermediate keys yield `undefined`
|
|
674
|
+
— production behavior; agents commonly chain optional reads.
|
|
675
|
+
|
|
676
|
+
###### Parameters
|
|
677
|
+
|
|
678
|
+
| Parameter | Type |
|
|
679
|
+
| :------ | :------ |
|
|
680
|
+
| `fieldPath` | `string` |
|
|
681
|
+
|
|
682
|
+
###### Returns
|
|
683
|
+
|
|
684
|
+
`unknown`
|
|
685
|
+
|
|
686
|
+
***
|
|
687
|
+
|
|
688
|
+
<a id="firestore"></a>
|
|
689
|
+
|
|
690
|
+
### Firestore
|
|
691
|
+
|
|
692
|
+
#### Extended by
|
|
693
|
+
|
|
694
|
+
- [`SandboxFirestore`](#sandboxfirestore)
|
|
695
|
+
|
|
696
|
+
#### Methods
|
|
697
|
+
|
|
698
|
+
<a id="batch"></a>
|
|
699
|
+
|
|
700
|
+
##### batch()
|
|
701
|
+
|
|
702
|
+
```ts
|
|
703
|
+
batch(): WriteBatch;
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
###### Returns
|
|
707
|
+
|
|
708
|
+
[`WriteBatch`](#writebatch)
|
|
709
|
+
|
|
710
|
+
<a id="collection-2"></a>
|
|
711
|
+
|
|
712
|
+
##### collection()
|
|
713
|
+
|
|
714
|
+
```ts
|
|
715
|
+
collection(path: string): CollectionReference;
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
###### Parameters
|
|
719
|
+
|
|
720
|
+
| Parameter | Type |
|
|
721
|
+
| :------ | :------ |
|
|
722
|
+
| `path` | `string` |
|
|
723
|
+
|
|
724
|
+
###### Returns
|
|
725
|
+
|
|
726
|
+
[`CollectionReference`](#collectionreference)
|
|
727
|
+
|
|
728
|
+
<a id="collectiongroup"></a>
|
|
729
|
+
|
|
730
|
+
##### collectionGroup()
|
|
731
|
+
|
|
732
|
+
```ts
|
|
733
|
+
collectionGroup(collectionId: string): Query;
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
Cross-collection query — returns a `Query` that scans every
|
|
737
|
+
document under every collection whose final segment matches
|
|
738
|
+
`collectionId`, regardless of position in the path. Matches the
|
|
739
|
+
Admin SDK's `Firestore.collectionGroup(id)` shape.
|
|
740
|
+
|
|
741
|
+
The returned `Query` accepts `where` / `orderBy` / `limit` like
|
|
742
|
+
any other; the simulator gathers all candidate docs first, then
|
|
743
|
+
applies the constraints in-memory.
|
|
744
|
+
|
|
745
|
+
###### Parameters
|
|
746
|
+
|
|
747
|
+
| Parameter | Type |
|
|
748
|
+
| :------ | :------ |
|
|
749
|
+
| `collectionId` | `string` |
|
|
750
|
+
|
|
751
|
+
###### Returns
|
|
752
|
+
|
|
753
|
+
[`Query`](#query)
|
|
754
|
+
|
|
755
|
+
<a id="doc-3"></a>
|
|
756
|
+
|
|
757
|
+
##### doc()
|
|
758
|
+
|
|
759
|
+
```ts
|
|
760
|
+
doc(path: string): DocumentReference;
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
###### Parameters
|
|
764
|
+
|
|
765
|
+
| Parameter | Type |
|
|
766
|
+
| :------ | :------ |
|
|
767
|
+
| `path` | `string` |
|
|
768
|
+
|
|
769
|
+
###### Returns
|
|
770
|
+
|
|
771
|
+
[`DocumentReference`](#documentreference)
|
|
772
|
+
|
|
773
|
+
<a id="runtransaction"></a>
|
|
774
|
+
|
|
775
|
+
##### runTransaction()
|
|
776
|
+
|
|
777
|
+
```ts
|
|
778
|
+
runTransaction<R>(fn: (tx: Transaction) => R | Promise<R>, opts?: OperationOptions): Promise<R>;
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
###### Type Parameters
|
|
782
|
+
|
|
783
|
+
| Type Parameter |
|
|
784
|
+
| :------ |
|
|
785
|
+
| `R` |
|
|
786
|
+
|
|
787
|
+
###### Parameters
|
|
788
|
+
|
|
789
|
+
| Parameter | Type |
|
|
790
|
+
| :------ | :------ |
|
|
791
|
+
| `fn` | (`tx`: [`Transaction`](#transaction)) => `R` \| `Promise`\<`R`\> |
|
|
792
|
+
| `opts?` | `OperationOptions` |
|
|
793
|
+
|
|
794
|
+
###### Returns
|
|
795
|
+
|
|
796
|
+
`Promise`\<`R`\>
|
|
797
|
+
|
|
798
|
+
***
|
|
799
|
+
|
|
800
|
+
<a id="lintwarning"></a>
|
|
801
|
+
|
|
802
|
+
### LintWarning
|
|
803
|
+
|
|
804
|
+
#### Properties
|
|
805
|
+
|
|
806
|
+
| Property | Type | Description |
|
|
807
|
+
| :------ | :------ | :------ |
|
|
808
|
+
| <a id="fix"></a> `fix?` | `string` | - |
|
|
809
|
+
| <a id="location"></a> `location?` | \{ `functionName?`: `string`; `matchPath?`: `string`; `ruleIndex?`: `number`; `testCaseDescription?`: `string`; \} | - |
|
|
810
|
+
| `location.functionName?` | `string` | - |
|
|
811
|
+
| `location.matchPath?` | `string` | - |
|
|
812
|
+
| `location.ruleIndex?` | `number` | - |
|
|
813
|
+
| `location.testCaseDescription?` | `string` | Test-case description from `TestCase.description`. Set only by rules that operate on the optional test suite (e.g. REQUEST_TIME_NOT_PINNED). |
|
|
814
|
+
| <a id="message"></a> `message` | `string` | - |
|
|
815
|
+
| <a id="rule"></a> `rule` | `string` | - |
|
|
816
|
+
| <a id="severity"></a> `severity` | `"error"` \| `"warning"` | - |
|
|
817
|
+
|
|
818
|
+
***
|
|
819
|
+
|
|
820
|
+
<a id="query"></a>
|
|
821
|
+
|
|
822
|
+
### Query
|
|
823
|
+
|
|
824
|
+
#### Extended by
|
|
825
|
+
|
|
826
|
+
- [`CollectionReference`](#collectionreference)
|
|
827
|
+
|
|
828
|
+
#### Methods
|
|
829
|
+
|
|
830
|
+
<a id="aggregate-2"></a>
|
|
831
|
+
|
|
832
|
+
##### aggregate()
|
|
833
|
+
|
|
834
|
+
```ts
|
|
835
|
+
aggregate(spec: AggregateSpec): Promise<AggregateQuerySnapshot>;
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
Compute one or more aggregates over the documents matching this
|
|
839
|
+
query. Mirrors the Admin SDK's `query.aggregate({ … }).get()`
|
|
840
|
+
pattern, collapsed into one call for the simulator (no need to
|
|
841
|
+
build an `AggregateQuery` reference type when there's no remote
|
|
842
|
+
dispatch).
|
|
843
|
+
|
|
844
|
+
Each entry in `spec` is keyed by a caller-chosen alias and
|
|
845
|
+
resolves to an `AggregateField`. The returned snapshot exposes
|
|
846
|
+
the computed numbers under the same aliases via `.data()`.
|
|
847
|
+
|
|
848
|
+
Where / orderBy clauses ARE applied before aggregation (they
|
|
849
|
+
narrow the candidate doc set). `limit` is honored — the aggregate
|
|
850
|
+
computes against the limited set, matching production semantics.
|
|
851
|
+
|
|
852
|
+
###### Parameters
|
|
853
|
+
|
|
854
|
+
| Parameter | Type |
|
|
855
|
+
| :------ | :------ |
|
|
856
|
+
| `spec` | [`AggregateSpec`](#aggregatespec) |
|
|
857
|
+
|
|
858
|
+
###### Returns
|
|
859
|
+
|
|
860
|
+
`Promise`\<[`AggregateQuerySnapshot`](#aggregatequerysnapshot)\>
|
|
861
|
+
|
|
862
|
+
<a id="applyfilter-2"></a>
|
|
863
|
+
|
|
864
|
+
##### applyFilter()
|
|
865
|
+
|
|
866
|
+
```ts
|
|
867
|
+
applyFilter(filter: Filter): Query;
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
Add a composite filter (leaf, AND, or OR) to the query's filter
|
|
871
|
+
stack. Each `applyFilter` call AND-s with whatever filters are
|
|
872
|
+
already on the query — same implicit-AND semantics as multiple
|
|
873
|
+
`where()` calls. To OR multiple predicates, wrap them with
|
|
874
|
+
`{ kind: 'or', filters: [...] }` before calling. Backs the
|
|
875
|
+
modular `or()` / `and()` constraints in `pyric/firestore`.
|
|
876
|
+
|
|
877
|
+
###### Parameters
|
|
878
|
+
|
|
879
|
+
| Parameter | Type |
|
|
880
|
+
| :------ | :------ |
|
|
881
|
+
| `filter` | [`Filter`](#filter) |
|
|
882
|
+
|
|
883
|
+
###### Returns
|
|
884
|
+
|
|
885
|
+
[`Query`](#query)
|
|
886
|
+
|
|
887
|
+
<a id="endcursor-2"></a>
|
|
888
|
+
|
|
889
|
+
##### endCursor()
|
|
890
|
+
|
|
891
|
+
```ts
|
|
892
|
+
endCursor(values: unknown[], inclusive: boolean): Query;
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
Set the end position of the query relative to the orderBy fields.
|
|
896
|
+
`inclusive` controls `endAt` (true) vs `endBefore` (false).
|
|
897
|
+
|
|
898
|
+
###### Parameters
|
|
899
|
+
|
|
900
|
+
| Parameter | Type |
|
|
901
|
+
| :------ | :------ |
|
|
902
|
+
| `values` | `unknown`[] |
|
|
903
|
+
| `inclusive` | `boolean` |
|
|
904
|
+
|
|
905
|
+
###### Returns
|
|
906
|
+
|
|
907
|
+
[`Query`](#query)
|
|
908
|
+
|
|
909
|
+
<a id="endcursorfromsnapshot-2"></a>
|
|
910
|
+
|
|
911
|
+
##### endCursorFromSnapshot()
|
|
912
|
+
|
|
913
|
+
```ts
|
|
914
|
+
endCursorFromSnapshot(snapshot: AdminDocumentSnapshot, inclusive: boolean): Query;
|
|
915
|
+
```
|
|
916
|
+
|
|
917
|
+
Snapshot-based variant of [endCursor](#endcursor-2).
|
|
918
|
+
|
|
919
|
+
###### Parameters
|
|
920
|
+
|
|
921
|
+
| Parameter | Type |
|
|
922
|
+
| :------ | :------ |
|
|
923
|
+
| `snapshot` | [`AdminDocumentSnapshot`](#admindocumentsnapshot) |
|
|
924
|
+
| `inclusive` | `boolean` |
|
|
925
|
+
|
|
926
|
+
###### Returns
|
|
927
|
+
|
|
928
|
+
[`Query`](#query)
|
|
929
|
+
|
|
930
|
+
<a id="get-6"></a>
|
|
931
|
+
|
|
932
|
+
##### get()
|
|
933
|
+
|
|
934
|
+
```ts
|
|
935
|
+
get(opts?: OperationOptions): Promise<AdminQuerySnapshot>;
|
|
936
|
+
```
|
|
937
|
+
|
|
938
|
+
###### Parameters
|
|
939
|
+
|
|
940
|
+
| Parameter | Type |
|
|
941
|
+
| :------ | :------ |
|
|
942
|
+
| `opts?` | `OperationOptions` |
|
|
943
|
+
|
|
944
|
+
###### Returns
|
|
945
|
+
|
|
946
|
+
`Promise`\<[`AdminQuerySnapshot`](#adminquerysnapshot)\>
|
|
947
|
+
|
|
948
|
+
<a id="limit-2"></a>
|
|
949
|
+
|
|
950
|
+
##### limit()
|
|
951
|
+
|
|
952
|
+
```ts
|
|
953
|
+
limit(n: number): Query;
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
###### Parameters
|
|
957
|
+
|
|
958
|
+
| Parameter | Type |
|
|
959
|
+
| :------ | :------ |
|
|
960
|
+
| `n` | `number` |
|
|
961
|
+
|
|
962
|
+
###### Returns
|
|
963
|
+
|
|
964
|
+
[`Query`](#query)
|
|
965
|
+
|
|
966
|
+
<a id="limittolast-2"></a>
|
|
967
|
+
|
|
968
|
+
##### limitToLast()
|
|
969
|
+
|
|
970
|
+
```ts
|
|
971
|
+
limitToLast(n: number): Query;
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
Limit from the END of the ordered result. Equivalent to reversing
|
|
975
|
+
the orderBy, taking `n`, then re-reversing — the simulator
|
|
976
|
+
implements it that way. Requires at least one `orderBy` clause on
|
|
977
|
+
the query (matches the JS SDK's runtime contract).
|
|
978
|
+
|
|
979
|
+
###### Parameters
|
|
980
|
+
|
|
981
|
+
| Parameter | Type |
|
|
982
|
+
| :------ | :------ |
|
|
983
|
+
| `n` | `number` |
|
|
984
|
+
|
|
985
|
+
###### Returns
|
|
986
|
+
|
|
987
|
+
[`Query`](#query)
|
|
988
|
+
|
|
989
|
+
<a id="orderby-2"></a>
|
|
990
|
+
|
|
991
|
+
##### orderBy()
|
|
992
|
+
|
|
993
|
+
```ts
|
|
994
|
+
orderBy(field: string, direction?: OrderDirection): Query;
|
|
995
|
+
```
|
|
996
|
+
|
|
997
|
+
###### Parameters
|
|
998
|
+
|
|
999
|
+
| Parameter | Type |
|
|
1000
|
+
| :------ | :------ |
|
|
1001
|
+
| `field` | `string` |
|
|
1002
|
+
| `direction?` | [`OrderDirection`](pyric-firestore-reference-api.md#orderdirection) |
|
|
1003
|
+
|
|
1004
|
+
###### Returns
|
|
1005
|
+
|
|
1006
|
+
[`Query`](#query)
|
|
1007
|
+
|
|
1008
|
+
<a id="startcursor-2"></a>
|
|
1009
|
+
|
|
1010
|
+
##### startCursor()
|
|
1011
|
+
|
|
1012
|
+
```ts
|
|
1013
|
+
startCursor(values: unknown[], inclusive: boolean): Query;
|
|
1014
|
+
```
|
|
1015
|
+
|
|
1016
|
+
Set the start position of the query relative to the orderBy
|
|
1017
|
+
fields. `values` corresponds 1:1 with the orderBy clauses on the
|
|
1018
|
+
query (one value per clause); `inclusive` controls `startAt` (true)
|
|
1019
|
+
vs `startAfter` (false). Repeated calls replace the previous
|
|
1020
|
+
cursor — matches production.
|
|
1021
|
+
|
|
1022
|
+
###### Parameters
|
|
1023
|
+
|
|
1024
|
+
| Parameter | Type |
|
|
1025
|
+
| :------ | :------ |
|
|
1026
|
+
| `values` | `unknown`[] |
|
|
1027
|
+
| `inclusive` | `boolean` |
|
|
1028
|
+
|
|
1029
|
+
###### Returns
|
|
1030
|
+
|
|
1031
|
+
[`Query`](#query)
|
|
1032
|
+
|
|
1033
|
+
<a id="startcursorfromsnapshot-2"></a>
|
|
1034
|
+
|
|
1035
|
+
##### startCursorFromSnapshot()
|
|
1036
|
+
|
|
1037
|
+
```ts
|
|
1038
|
+
startCursorFromSnapshot(snapshot: AdminDocumentSnapshot, inclusive: boolean): Query;
|
|
1039
|
+
```
|
|
1040
|
+
|
|
1041
|
+
Variant of [startCursor](#startcursor-2) that takes a `DocumentSnapshot`
|
|
1042
|
+
and extracts the cursor values from the snapshot's data at each
|
|
1043
|
+
orderBy field. Mirrors the JS SDK's `startAt(snapshot)` overload
|
|
1044
|
+
and shines for cursor-based pagination ("hand me the next page
|
|
1045
|
+
after this one"). Requires at least one `orderBy` clause —
|
|
1046
|
+
thrown at call time, not at get-time, so the failure surfaces
|
|
1047
|
+
close to the bug.
|
|
1048
|
+
|
|
1049
|
+
###### Parameters
|
|
1050
|
+
|
|
1051
|
+
| Parameter | Type |
|
|
1052
|
+
| :------ | :------ |
|
|
1053
|
+
| `snapshot` | [`AdminDocumentSnapshot`](#admindocumentsnapshot) |
|
|
1054
|
+
| `inclusive` | `boolean` |
|
|
1055
|
+
|
|
1056
|
+
###### Returns
|
|
1057
|
+
|
|
1058
|
+
[`Query`](#query)
|
|
1059
|
+
|
|
1060
|
+
<a id="where-2"></a>
|
|
1061
|
+
|
|
1062
|
+
##### where()
|
|
1063
|
+
|
|
1064
|
+
```ts
|
|
1065
|
+
where(
|
|
1066
|
+
field: string,
|
|
1067
|
+
op: WhereFilterOp,
|
|
1068
|
+
value: unknown): Query;
|
|
1069
|
+
```
|
|
1070
|
+
|
|
1071
|
+
###### Parameters
|
|
1072
|
+
|
|
1073
|
+
| Parameter | Type |
|
|
1074
|
+
| :------ | :------ |
|
|
1075
|
+
| `field` | `string` |
|
|
1076
|
+
| `op` | [`WhereFilterOp`](pyric-firestore-reference-api.md#wherefilterop) |
|
|
1077
|
+
| `value` | `unknown` |
|
|
1078
|
+
|
|
1079
|
+
###### Returns
|
|
1080
|
+
|
|
1081
|
+
[`Query`](#query)
|
|
1082
|
+
|
|
1083
|
+
***
|
|
1084
|
+
|
|
1085
|
+
<a id="querydocumentsnapshot"></a>
|
|
1086
|
+
|
|
1087
|
+
### QueryDocumentSnapshot
|
|
1088
|
+
|
|
1089
|
+
Production narrows `data()` to non-undefined here. We follow suit so
|
|
1090
|
+
that agent code calling `snap.data().foo` doesn't need a guard for
|
|
1091
|
+
the items inside a `QuerySnapshot.docs` array.
|
|
1092
|
+
|
|
1093
|
+
#### Extends
|
|
1094
|
+
|
|
1095
|
+
- [`DocumentSnapshot`](#documentsnapshot)
|
|
1096
|
+
|
|
1097
|
+
#### Properties
|
|
1098
|
+
|
|
1099
|
+
| Property | Modifier | Type |
|
|
1100
|
+
| :------ | :------ | :------ |
|
|
1101
|
+
| <a id="id-5"></a> `id` | `readonly` | `string` |
|
|
1102
|
+
| <a id="metadata-1"></a> `metadata` | `readonly` | [`SnapshotMetadata`](#snapshotmetadata) |
|
|
1103
|
+
| <a id="ref-3"></a> `ref` | `readonly` | `SnapshotDocRef` |
|
|
1104
|
+
|
|
1105
|
+
#### Methods
|
|
1106
|
+
|
|
1107
|
+
<a id="data-8"></a>
|
|
1108
|
+
|
|
1109
|
+
##### data()
|
|
1110
|
+
|
|
1111
|
+
```ts
|
|
1112
|
+
data(): DocumentData;
|
|
1113
|
+
```
|
|
1114
|
+
|
|
1115
|
+
###### Returns
|
|
1116
|
+
|
|
1117
|
+
`DocumentData`
|
|
1118
|
+
|
|
1119
|
+
###### Overrides
|
|
1120
|
+
|
|
1121
|
+
[`DocumentSnapshot`](#documentsnapshot).[`data`](#data-6)
|
|
1122
|
+
|
|
1123
|
+
<a id="exists-4"></a>
|
|
1124
|
+
|
|
1125
|
+
##### exists()
|
|
1126
|
+
|
|
1127
|
+
```ts
|
|
1128
|
+
exists(): boolean;
|
|
1129
|
+
```
|
|
1130
|
+
|
|
1131
|
+
###### Returns
|
|
1132
|
+
|
|
1133
|
+
`boolean`
|
|
1134
|
+
|
|
1135
|
+
###### Inherited from
|
|
1136
|
+
|
|
1137
|
+
[`DocumentSnapshot`](#documentsnapshot).[`exists`](#exists-2)
|
|
1138
|
+
|
|
1139
|
+
<a id="get-8"></a>
|
|
1140
|
+
|
|
1141
|
+
##### get()
|
|
1142
|
+
|
|
1143
|
+
```ts
|
|
1144
|
+
get(fieldPath: string): unknown;
|
|
1145
|
+
```
|
|
1146
|
+
|
|
1147
|
+
Field accessor mirroring `firebase/firestore`'s `DocumentSnapshot.get(fieldPath)`.
|
|
1148
|
+
Dotted paths supported. Missing intermediate keys yield `undefined`
|
|
1149
|
+
— production behavior; agents commonly chain optional reads.
|
|
1150
|
+
|
|
1151
|
+
###### Parameters
|
|
1152
|
+
|
|
1153
|
+
| Parameter | Type |
|
|
1154
|
+
| :------ | :------ |
|
|
1155
|
+
| `fieldPath` | `string` |
|
|
1156
|
+
|
|
1157
|
+
###### Returns
|
|
1158
|
+
|
|
1159
|
+
`unknown`
|
|
1160
|
+
|
|
1161
|
+
###### Inherited from
|
|
1162
|
+
|
|
1163
|
+
[`DocumentSnapshot`](#documentsnapshot).[`get`](#get-4)
|
|
1164
|
+
|
|
1165
|
+
***
|
|
1166
|
+
|
|
1167
|
+
<a id="querysnapshot"></a>
|
|
1168
|
+
|
|
1169
|
+
### QuerySnapshot
|
|
1170
|
+
|
|
1171
|
+
#### Properties
|
|
1172
|
+
|
|
1173
|
+
| Property | Modifier | Type |
|
|
1174
|
+
| :------ | :------ | :------ |
|
|
1175
|
+
| <a id="docs-1"></a> `docs` | `readonly` | [`QueryDocumentSnapshot`](#querydocumentsnapshot)[] |
|
|
1176
|
+
| <a id="empty-1"></a> `empty` | `readonly` | `boolean` |
|
|
1177
|
+
| <a id="metadata-2"></a> `metadata` | `readonly` | [`SnapshotMetadata`](#snapshotmetadata) |
|
|
1178
|
+
| <a id="query-1"></a> `query` | `readonly` | `SnapshotQueryRef` |
|
|
1179
|
+
| <a id="size-1"></a> `size` | `readonly` | `number` |
|
|
1180
|
+
|
|
1181
|
+
#### Methods
|
|
1182
|
+
|
|
1183
|
+
<a id="docchanges"></a>
|
|
1184
|
+
|
|
1185
|
+
##### docChanges()
|
|
1186
|
+
|
|
1187
|
+
```ts
|
|
1188
|
+
docChanges(options?: DocChangesOptions): DocumentChange[];
|
|
1189
|
+
```
|
|
1190
|
+
|
|
1191
|
+
Per findings section 4: cached by `includeMetadataChanges` value; throws if
|
|
1192
|
+
called with `true` when the listener did not subscribe with
|
|
1193
|
+
`includeMetadataChanges: true`. The Slice 2 implementation produces
|
|
1194
|
+
"all docs added" on the first fire — Slice 3 supplies real diffs.
|
|
1195
|
+
|
|
1196
|
+
###### Parameters
|
|
1197
|
+
|
|
1198
|
+
| Parameter | Type |
|
|
1199
|
+
| :------ | :------ |
|
|
1200
|
+
| `options?` | [`DocChangesOptions`](#docchangesoptions) |
|
|
1201
|
+
|
|
1202
|
+
###### Returns
|
|
1203
|
+
|
|
1204
|
+
[`DocumentChange`](#documentchange)[]
|
|
1205
|
+
|
|
1206
|
+
<a id="foreach-2"></a>
|
|
1207
|
+
|
|
1208
|
+
##### forEach()
|
|
1209
|
+
|
|
1210
|
+
```ts
|
|
1211
|
+
forEach(callback: (snap: QueryDocumentSnapshot) => void): void;
|
|
1212
|
+
```
|
|
1213
|
+
|
|
1214
|
+
###### Parameters
|
|
1215
|
+
|
|
1216
|
+
| Parameter | Type |
|
|
1217
|
+
| :------ | :------ |
|
|
1218
|
+
| `callback` | (`snap`: [`QueryDocumentSnapshot`](#querydocumentsnapshot)) => `void` |
|
|
1219
|
+
|
|
1220
|
+
###### Returns
|
|
1221
|
+
|
|
1222
|
+
`void`
|
|
1223
|
+
|
|
1224
|
+
***
|
|
1225
|
+
|
|
1226
|
+
<a id="rulesmetrics"></a>
|
|
1227
|
+
|
|
1228
|
+
### RulesMetrics
|
|
1229
|
+
|
|
1230
|
+
#### Properties
|
|
1231
|
+
|
|
1232
|
+
| Property | Type |
|
|
1233
|
+
| :------ | :------ |
|
|
1234
|
+
| <a id="allowrulecount"></a> `allowRuleCount` | `number` |
|
|
1235
|
+
| <a id="functioncount"></a> `functionCount` | `number` |
|
|
1236
|
+
| <a id="getcallcount"></a> `getCallCount` | `number` |
|
|
1237
|
+
| <a id="maxcalldepth"></a> `maxCallDepth` | `number` |
|
|
1238
|
+
| <a id="maxchaindepth"></a> `maxChainDepth` | `number` |
|
|
1239
|
+
| <a id="maxchainop"></a> `maxChainOp` | `string` |
|
|
1240
|
+
| <a id="maxestimatedexpressions"></a> `maxEstimatedExpressions` | `number` |
|
|
1241
|
+
| <a id="maxletbindings"></a> `maxLetBindings` | `number` |
|
|
1242
|
+
| <a id="maxletbindingsfunction"></a> `maxLetBindingsFunction` | `string` |
|
|
1243
|
+
| <a id="sourcesize"></a> `sourceSize` | `number` |
|
|
1244
|
+
|
|
1245
|
+
***
|
|
1246
|
+
|
|
1247
|
+
<a id="sandboxfirestore"></a>
|
|
1248
|
+
|
|
1249
|
+
### SandboxFirestore
|
|
1250
|
+
|
|
1251
|
+
Sandbox-extended Firestore handle. Adds three sandbox-only methods
|
|
1252
|
+
on top of the production-shaped [Firestore](#firestore) surface:
|
|
1253
|
+
|
|
1254
|
+
- [SandboxFirestore.setRules](#setrules) — replace the active ruleset
|
|
1255
|
+
for subsequent operations.
|
|
1256
|
+
- [SandboxFirestore.seed](#seed) — replace stored documents with a
|
|
1257
|
+
fresh seed map (rules are preserved).
|
|
1258
|
+
- [SandboxFirestore.snapshot](#snapshot) — capture all stored documents
|
|
1259
|
+
as a path-keyed map.
|
|
1260
|
+
|
|
1261
|
+
These have no production analog. They use sandbox vocabulary
|
|
1262
|
+
(`setRules`, `seed`, `snapshot`) deliberately so a reader can't
|
|
1263
|
+
confuse them with Firebase deployment semantics.
|
|
1264
|
+
|
|
1265
|
+
#### Extends
|
|
1266
|
+
|
|
1267
|
+
- [`Firestore`](#firestore)
|
|
1268
|
+
|
|
1269
|
+
#### Methods
|
|
1270
|
+
|
|
1271
|
+
<a id="batch-2"></a>
|
|
1272
|
+
|
|
1273
|
+
##### batch()
|
|
1274
|
+
|
|
1275
|
+
```ts
|
|
1276
|
+
batch(): WriteBatch;
|
|
1277
|
+
```
|
|
1278
|
+
|
|
1279
|
+
###### Returns
|
|
1280
|
+
|
|
1281
|
+
[`WriteBatch`](#writebatch)
|
|
1282
|
+
|
|
1283
|
+
###### Inherited from
|
|
1284
|
+
|
|
1285
|
+
[`Firestore`](#firestore).[`batch`](#batch)
|
|
1286
|
+
|
|
1287
|
+
<a id="collection-4"></a>
|
|
1288
|
+
|
|
1289
|
+
##### collection()
|
|
1290
|
+
|
|
1291
|
+
```ts
|
|
1292
|
+
collection(path: string): CollectionReference;
|
|
1293
|
+
```
|
|
1294
|
+
|
|
1295
|
+
###### Parameters
|
|
1296
|
+
|
|
1297
|
+
| Parameter | Type |
|
|
1298
|
+
| :------ | :------ |
|
|
1299
|
+
| `path` | `string` |
|
|
1300
|
+
|
|
1301
|
+
###### Returns
|
|
1302
|
+
|
|
1303
|
+
[`CollectionReference`](#collectionreference)
|
|
1304
|
+
|
|
1305
|
+
###### Inherited from
|
|
1306
|
+
|
|
1307
|
+
[`Firestore`](#firestore).[`collection`](#collection-2)
|
|
1308
|
+
|
|
1309
|
+
<a id="collectiongroup-2"></a>
|
|
1310
|
+
|
|
1311
|
+
##### collectionGroup()
|
|
1312
|
+
|
|
1313
|
+
```ts
|
|
1314
|
+
collectionGroup(collectionId: string): Query;
|
|
1315
|
+
```
|
|
1316
|
+
|
|
1317
|
+
Cross-collection query — returns a `Query` that scans every
|
|
1318
|
+
document under every collection whose final segment matches
|
|
1319
|
+
`collectionId`, regardless of position in the path. Matches the
|
|
1320
|
+
Admin SDK's `Firestore.collectionGroup(id)` shape.
|
|
1321
|
+
|
|
1322
|
+
The returned `Query` accepts `where` / `orderBy` / `limit` like
|
|
1323
|
+
any other; the simulator gathers all candidate docs first, then
|
|
1324
|
+
applies the constraints in-memory.
|
|
1325
|
+
|
|
1326
|
+
###### Parameters
|
|
1327
|
+
|
|
1328
|
+
| Parameter | Type |
|
|
1329
|
+
| :------ | :------ |
|
|
1330
|
+
| `collectionId` | `string` |
|
|
1331
|
+
|
|
1332
|
+
###### Returns
|
|
1333
|
+
|
|
1334
|
+
[`Query`](#query)
|
|
1335
|
+
|
|
1336
|
+
###### Inherited from
|
|
1337
|
+
|
|
1338
|
+
[`Firestore`](#firestore).[`collectionGroup`](#collectiongroup)
|
|
1339
|
+
|
|
1340
|
+
<a id="doc-5"></a>
|
|
1341
|
+
|
|
1342
|
+
##### doc()
|
|
1343
|
+
|
|
1344
|
+
```ts
|
|
1345
|
+
doc(path: string): DocumentReference;
|
|
1346
|
+
```
|
|
1347
|
+
|
|
1348
|
+
###### Parameters
|
|
1349
|
+
|
|
1350
|
+
| Parameter | Type |
|
|
1351
|
+
| :------ | :------ |
|
|
1352
|
+
| `path` | `string` |
|
|
1353
|
+
|
|
1354
|
+
###### Returns
|
|
1355
|
+
|
|
1356
|
+
[`DocumentReference`](#documentreference)
|
|
1357
|
+
|
|
1358
|
+
###### Inherited from
|
|
1359
|
+
|
|
1360
|
+
[`Firestore`](#firestore).[`doc`](#doc-3)
|
|
1361
|
+
|
|
1362
|
+
<a id="runtransaction-2"></a>
|
|
1363
|
+
|
|
1364
|
+
##### runTransaction()
|
|
1365
|
+
|
|
1366
|
+
```ts
|
|
1367
|
+
runTransaction<R>(fn: (tx: Transaction) => R | Promise<R>, opts?: OperationOptions): Promise<R>;
|
|
1368
|
+
```
|
|
1369
|
+
|
|
1370
|
+
###### Type Parameters
|
|
1371
|
+
|
|
1372
|
+
| Type Parameter |
|
|
1373
|
+
| :------ |
|
|
1374
|
+
| `R` |
|
|
1375
|
+
|
|
1376
|
+
###### Parameters
|
|
1377
|
+
|
|
1378
|
+
| Parameter | Type |
|
|
1379
|
+
| :------ | :------ |
|
|
1380
|
+
| `fn` | (`tx`: [`Transaction`](#transaction)) => `R` \| `Promise`\<`R`\> |
|
|
1381
|
+
| `opts?` | `OperationOptions` |
|
|
1382
|
+
|
|
1383
|
+
###### Returns
|
|
1384
|
+
|
|
1385
|
+
`Promise`\<`R`\>
|
|
1386
|
+
|
|
1387
|
+
###### Inherited from
|
|
1388
|
+
|
|
1389
|
+
[`Firestore`](#firestore).[`runTransaction`](#runtransaction)
|
|
1390
|
+
|
|
1391
|
+
<a id="seed"></a>
|
|
1392
|
+
|
|
1393
|
+
##### seed()
|
|
1394
|
+
|
|
1395
|
+
```ts
|
|
1396
|
+
seed(options?: {
|
|
1397
|
+
documents?: Record<string, DocumentData>;
|
|
1398
|
+
}): LintResult;
|
|
1399
|
+
```
|
|
1400
|
+
|
|
1401
|
+
Replace stored documents with a new seed map. Active rules are
|
|
1402
|
+
preserved. Pass an empty `documents` map (or omit it) to clear
|
|
1403
|
+
state without touching rules.
|
|
1404
|
+
|
|
1405
|
+
###### Parameters
|
|
1406
|
+
|
|
1407
|
+
| Parameter | Type |
|
|
1408
|
+
| :------ | :------ |
|
|
1409
|
+
| `options?` | \{ `documents?`: `Record`\<`string`, [`DocumentData`](pyric-firestore-reference-api.md#documentdata)\>; \} |
|
|
1410
|
+
| `options.documents?` | `Record`\<`string`, [`DocumentData`](pyric-firestore-reference-api.md#documentdata)\> |
|
|
1411
|
+
|
|
1412
|
+
###### Returns
|
|
1413
|
+
|
|
1414
|
+
[`LintResult`](pyric-firestore-reference-api.md#lintresult)
|
|
1415
|
+
|
|
1416
|
+
<a id="setrules"></a>
|
|
1417
|
+
|
|
1418
|
+
##### setRules()
|
|
1419
|
+
|
|
1420
|
+
```ts
|
|
1421
|
+
setRules(rules: string): LintResult;
|
|
1422
|
+
```
|
|
1423
|
+
|
|
1424
|
+
Replace the active ruleset. Returns the lint result so callers can
|
|
1425
|
+
surface warnings; if the source has parse-level errors, the rules
|
|
1426
|
+
are not swapped (consistent with `LocalEnvironment.deployRules`).
|
|
1427
|
+
|
|
1428
|
+
###### Parameters
|
|
1429
|
+
|
|
1430
|
+
| Parameter | Type |
|
|
1431
|
+
| :------ | :------ |
|
|
1432
|
+
| `rules` | `string` |
|
|
1433
|
+
|
|
1434
|
+
###### Returns
|
|
1435
|
+
|
|
1436
|
+
[`LintResult`](pyric-firestore-reference-api.md#lintresult)
|
|
1437
|
+
|
|
1438
|
+
<a id="snapshot"></a>
|
|
1439
|
+
|
|
1440
|
+
##### snapshot()
|
|
1441
|
+
|
|
1442
|
+
```ts
|
|
1443
|
+
snapshot(): Record<string, DocumentData>;
|
|
1444
|
+
```
|
|
1445
|
+
|
|
1446
|
+
Capture every stored document as a `{ [path]: data }` map. Reads
|
|
1447
|
+
from the live state and is independent of rules.
|
|
1448
|
+
|
|
1449
|
+
###### Returns
|
|
1450
|
+
|
|
1451
|
+
`Record`\<`string`, [`DocumentData`](pyric-firestore-reference-api.md#documentdata)\>
|
|
1452
|
+
|
|
1453
|
+
***
|
|
1454
|
+
|
|
1455
|
+
<a id="setoptions"></a>
|
|
1456
|
+
|
|
1457
|
+
### SetOptions
|
|
1458
|
+
|
|
1459
|
+
Options for `DocumentReference.set`. Mirrors the modular Web-SDK's
|
|
1460
|
+
`SetOptions` shape with pyric's `auth` per-op override layered on.
|
|
1461
|
+
|
|
1462
|
+
- default (neither flag set) → REPLACE the existing document
|
|
1463
|
+
entirely. Firestore default for `set()`.
|
|
1464
|
+
- `{ merge: true }` → shallow-merge every top-level field in
|
|
1465
|
+
`data` into the existing document. Fields not in `data` are
|
|
1466
|
+
preserved. Rule eval still runs the `update` clause when the
|
|
1467
|
+
doc exists.
|
|
1468
|
+
- `{ mergeFields: [...] }` → project `data` down to just the
|
|
1469
|
+
listed top-level fields, then merge. Other fields in `data` are
|
|
1470
|
+
ignored; other fields in the existing doc are preserved.
|
|
1471
|
+
|
|
1472
|
+
`merge` and `mergeFields` are mutually exclusive at the JS-SDK
|
|
1473
|
+
level. We don't currently enforce the constraint — if both are
|
|
1474
|
+
provided, `mergeFields` wins (matches the JS SDK's effective
|
|
1475
|
+
behavior).
|
|
1476
|
+
|
|
1477
|
+
#### Extends
|
|
1478
|
+
|
|
1479
|
+
- `OperationOptions`
|
|
1480
|
+
|
|
1481
|
+
#### Properties
|
|
1482
|
+
|
|
1483
|
+
| Property | Type |
|
|
1484
|
+
| :------ | :------ |
|
|
1485
|
+
| <a id="auth"></a> `auth?` | \{ `token?`: `Record`\<`string`, `unknown`\>; `uid`: `string`; \} |
|
|
1486
|
+
| `auth.token?` | `Record`\<`string`, `unknown`\> |
|
|
1487
|
+
| `auth.uid` | `string` |
|
|
1488
|
+
| <a id="merge"></a> `merge?` | `boolean` |
|
|
1489
|
+
| <a id="mergefields"></a> `mergeFields?` | readonly `string`[] |
|
|
1490
|
+
|
|
1491
|
+
***
|
|
1492
|
+
|
|
1493
|
+
<a id="snapshotmetadata"></a>
|
|
1494
|
+
|
|
1495
|
+
### SnapshotMetadata
|
|
1496
|
+
|
|
1497
|
+
Mirrors `firebase/firestore`'s `SnapshotMetadata`. `fromCache` is always
|
|
1498
|
+
`false` (the sandbox has no offline cache). `hasPendingWrites` transitions
|
|
1499
|
+
(item 3): a local write's optimistic echo carries `true`, and the server
|
|
1500
|
+
ack carries `false` — so `includeMetadataChanges` has an observable effect
|
|
1501
|
+
matching prod (COMPAT firestore#85).
|
|
1502
|
+
|
|
1503
|
+
#### Properties
|
|
1504
|
+
|
|
1505
|
+
| Property | Modifier | Type |
|
|
1506
|
+
| :------ | :------ | :------ |
|
|
1507
|
+
| <a id="fromcache"></a> `fromCache` | `readonly` | `false` |
|
|
1508
|
+
| <a id="haspendingwrites"></a> `hasPendingWrites` | `readonly` | `boolean` |
|
|
1509
|
+
|
|
1510
|
+
***
|
|
1511
|
+
|
|
1512
|
+
<a id="snapshotobserver"></a>
|
|
1513
|
+
|
|
1514
|
+
### SnapshotObserver
|
|
1515
|
+
|
|
1516
|
+
Observer form accepted by `onSnapshot`. Mirrors `firebase/firestore`'s
|
|
1517
|
+
`PartialObserver<T>` shape — any subset of the three handlers. `complete`
|
|
1518
|
+
is accepted for shape parity but never fires in the sandbox: the local
|
|
1519
|
+
listener stream has no terminal state.
|
|
1520
|
+
|
|
1521
|
+
#### Type Parameters
|
|
1522
|
+
|
|
1523
|
+
| Type Parameter |
|
|
1524
|
+
| :------ |
|
|
1525
|
+
| `T` |
|
|
1526
|
+
|
|
1527
|
+
#### Properties
|
|
1528
|
+
|
|
1529
|
+
| Property | Type |
|
|
1530
|
+
| :------ | :------ |
|
|
1531
|
+
| <a id="complete"></a> `complete?` | () => `void` |
|
|
1532
|
+
| <a id="error"></a> `error?` | (`error`: `unknown`) => `void` |
|
|
1533
|
+
| <a id="next"></a> `next?` | (`snapshot`: `T`) => `void` |
|
|
1534
|
+
|
|
1535
|
+
***
|
|
1536
|
+
|
|
1537
|
+
<a id="transaction"></a>
|
|
1538
|
+
|
|
1539
|
+
### Transaction
|
|
1540
|
+
|
|
1541
|
+
#### Methods
|
|
1542
|
+
|
|
1543
|
+
<a id="delete-2"></a>
|
|
1544
|
+
|
|
1545
|
+
##### delete()
|
|
1546
|
+
|
|
1547
|
+
```ts
|
|
1548
|
+
delete(ref: DocumentReference): Transaction;
|
|
1549
|
+
```
|
|
1550
|
+
|
|
1551
|
+
###### Parameters
|
|
1552
|
+
|
|
1553
|
+
| Parameter | Type |
|
|
1554
|
+
| :------ | :------ |
|
|
1555
|
+
| `ref` | [`DocumentReference`](#documentreference) |
|
|
1556
|
+
|
|
1557
|
+
###### Returns
|
|
1558
|
+
|
|
1559
|
+
[`Transaction`](#transaction)
|
|
1560
|
+
|
|
1561
|
+
<a id="get-10"></a>
|
|
1562
|
+
|
|
1563
|
+
##### get()
|
|
1564
|
+
|
|
1565
|
+
###### Call Signature
|
|
1566
|
+
|
|
1567
|
+
```ts
|
|
1568
|
+
get(ref: DocumentReference): Promise<AdminDocumentSnapshot>;
|
|
1569
|
+
```
|
|
1570
|
+
|
|
1571
|
+
###### Parameters
|
|
1572
|
+
|
|
1573
|
+
| Parameter | Type |
|
|
1574
|
+
| :------ | :------ |
|
|
1575
|
+
| `ref` | [`DocumentReference`](#documentreference) |
|
|
1576
|
+
|
|
1577
|
+
###### Returns
|
|
1578
|
+
|
|
1579
|
+
`Promise`\<[`AdminDocumentSnapshot`](#admindocumentsnapshot)\>
|
|
1580
|
+
|
|
1581
|
+
###### Call Signature
|
|
1582
|
+
|
|
1583
|
+
```ts
|
|
1584
|
+
get(query: Query): Promise<AdminQuerySnapshot>;
|
|
1585
|
+
```
|
|
1586
|
+
|
|
1587
|
+
###### Parameters
|
|
1588
|
+
|
|
1589
|
+
| Parameter | Type |
|
|
1590
|
+
| :------ | :------ |
|
|
1591
|
+
| `query` | [`Query`](#query) |
|
|
1592
|
+
|
|
1593
|
+
###### Returns
|
|
1594
|
+
|
|
1595
|
+
`Promise`\<[`AdminQuerySnapshot`](#adminquerysnapshot)\>
|
|
1596
|
+
|
|
1597
|
+
<a id="set-2"></a>
|
|
1598
|
+
|
|
1599
|
+
##### set()
|
|
1600
|
+
|
|
1601
|
+
```ts
|
|
1602
|
+
set(ref: DocumentReference, data: DocumentData): Transaction;
|
|
1603
|
+
```
|
|
1604
|
+
|
|
1605
|
+
###### Parameters
|
|
1606
|
+
|
|
1607
|
+
| Parameter | Type |
|
|
1608
|
+
| :------ | :------ |
|
|
1609
|
+
| `ref` | [`DocumentReference`](#documentreference) |
|
|
1610
|
+
| `data` | [`DocumentData`](pyric-firestore-reference-api.md#documentdata) |
|
|
1611
|
+
|
|
1612
|
+
###### Returns
|
|
1613
|
+
|
|
1614
|
+
[`Transaction`](#transaction)
|
|
1615
|
+
|
|
1616
|
+
<a id="update-2"></a>
|
|
1617
|
+
|
|
1618
|
+
##### update()
|
|
1619
|
+
|
|
1620
|
+
```ts
|
|
1621
|
+
update(ref: DocumentReference, data: DocumentData): Transaction;
|
|
1622
|
+
```
|
|
1623
|
+
|
|
1624
|
+
###### Parameters
|
|
1625
|
+
|
|
1626
|
+
| Parameter | Type |
|
|
1627
|
+
| :------ | :------ |
|
|
1628
|
+
| `ref` | [`DocumentReference`](#documentreference) |
|
|
1629
|
+
| `data` | [`DocumentData`](pyric-firestore-reference-api.md#documentdata) |
|
|
1630
|
+
|
|
1631
|
+
###### Returns
|
|
1632
|
+
|
|
1633
|
+
[`Transaction`](#transaction)
|
|
1634
|
+
|
|
1635
|
+
***
|
|
1636
|
+
|
|
1637
|
+
<a id="writebatch"></a>
|
|
1638
|
+
|
|
1639
|
+
### WriteBatch
|
|
1640
|
+
|
|
1641
|
+
#### Methods
|
|
1642
|
+
|
|
1643
|
+
<a id="commit"></a>
|
|
1644
|
+
|
|
1645
|
+
##### commit()
|
|
1646
|
+
|
|
1647
|
+
```ts
|
|
1648
|
+
commit(opts?: OperationOptions): Promise<void>;
|
|
1649
|
+
```
|
|
1650
|
+
|
|
1651
|
+
###### Parameters
|
|
1652
|
+
|
|
1653
|
+
| Parameter | Type |
|
|
1654
|
+
| :------ | :------ |
|
|
1655
|
+
| `opts?` | `OperationOptions` |
|
|
1656
|
+
|
|
1657
|
+
###### Returns
|
|
1658
|
+
|
|
1659
|
+
`Promise`\<`void`\>
|
|
1660
|
+
|
|
1661
|
+
<a id="delete-4"></a>
|
|
1662
|
+
|
|
1663
|
+
##### delete()
|
|
1664
|
+
|
|
1665
|
+
```ts
|
|
1666
|
+
delete(ref: DocumentReference): WriteBatch;
|
|
1667
|
+
```
|
|
1668
|
+
|
|
1669
|
+
###### Parameters
|
|
1670
|
+
|
|
1671
|
+
| Parameter | Type |
|
|
1672
|
+
| :------ | :------ |
|
|
1673
|
+
| `ref` | [`DocumentReference`](#documentreference) |
|
|
1674
|
+
|
|
1675
|
+
###### Returns
|
|
1676
|
+
|
|
1677
|
+
[`WriteBatch`](#writebatch)
|
|
1678
|
+
|
|
1679
|
+
<a id="set-4"></a>
|
|
1680
|
+
|
|
1681
|
+
##### set()
|
|
1682
|
+
|
|
1683
|
+
```ts
|
|
1684
|
+
set(ref: DocumentReference, data: DocumentData): WriteBatch;
|
|
1685
|
+
```
|
|
1686
|
+
|
|
1687
|
+
###### Parameters
|
|
1688
|
+
|
|
1689
|
+
| Parameter | Type |
|
|
1690
|
+
| :------ | :------ |
|
|
1691
|
+
| `ref` | [`DocumentReference`](#documentreference) |
|
|
1692
|
+
| `data` | [`DocumentData`](pyric-firestore-reference-api.md#documentdata) |
|
|
1693
|
+
|
|
1694
|
+
###### Returns
|
|
1695
|
+
|
|
1696
|
+
[`WriteBatch`](#writebatch)
|
|
1697
|
+
|
|
1698
|
+
<a id="update-4"></a>
|
|
1699
|
+
|
|
1700
|
+
##### update()
|
|
1701
|
+
|
|
1702
|
+
```ts
|
|
1703
|
+
update(ref: DocumentReference, data: DocumentData): WriteBatch;
|
|
1704
|
+
```
|
|
1705
|
+
|
|
1706
|
+
###### Parameters
|
|
1707
|
+
|
|
1708
|
+
| Parameter | Type |
|
|
1709
|
+
| :------ | :------ |
|
|
1710
|
+
| `ref` | [`DocumentReference`](#documentreference) |
|
|
1711
|
+
| `data` | [`DocumentData`](pyric-firestore-reference-api.md#documentdata) |
|
|
1712
|
+
|
|
1713
|
+
###### Returns
|
|
1714
|
+
|
|
1715
|
+
[`WriteBatch`](#writebatch)
|
|
1716
|
+
|
|
1717
|
+
## Type Aliases
|
|
1718
|
+
|
|
1719
|
+
<a id="aggregatefield"></a>
|
|
1720
|
+
|
|
1721
|
+
### AggregateField
|
|
1722
|
+
|
|
1723
|
+
```ts
|
|
1724
|
+
type AggregateField =
|
|
1725
|
+
| {
|
|
1726
|
+
kind: "count";
|
|
1727
|
+
}
|
|
1728
|
+
| {
|
|
1729
|
+
field: string;
|
|
1730
|
+
kind: "sum";
|
|
1731
|
+
}
|
|
1732
|
+
| {
|
|
1733
|
+
field: string;
|
|
1734
|
+
kind: "average";
|
|
1735
|
+
};
|
|
1736
|
+
```
|
|
1737
|
+
|
|
1738
|
+
Single aggregate definition. Field is required for sum / average,
|
|
1739
|
+
forbidden for count (no field has any meaning when you're
|
|
1740
|
+
counting rows). Encoded as discriminated union so type errors
|
|
1741
|
+
surface at the call site, not at runtime.
|
|
1742
|
+
|
|
1743
|
+
***
|
|
1744
|
+
|
|
1745
|
+
<a id="aggregatespec"></a>
|
|
1746
|
+
|
|
1747
|
+
### AggregateSpec
|
|
1748
|
+
|
|
1749
|
+
```ts
|
|
1750
|
+
type AggregateSpec = Record<string, AggregateField>;
|
|
1751
|
+
```
|
|
1752
|
+
|
|
1753
|
+
Spec passed to `Query.aggregate(...)`. Aliases become the keys in
|
|
1754
|
+
the returned snapshot's `.data()` object.
|
|
1755
|
+
|
|
1756
|
+
***
|
|
1757
|
+
|
|
1758
|
+
<a id="documentchangetype-1"></a>
|
|
1759
|
+
|
|
1760
|
+
### DocumentChangeType
|
|
1761
|
+
|
|
1762
|
+
```ts
|
|
1763
|
+
type DocumentChangeType = "added" | "modified" | "removed";
|
|
1764
|
+
```
|
|
1765
|
+
|
|
1766
|
+
***
|
|
1767
|
+
|
|
1768
|
+
<a id="filter"></a>
|
|
1769
|
+
|
|
1770
|
+
### Filter
|
|
1771
|
+
|
|
1772
|
+
```ts
|
|
1773
|
+
type Filter =
|
|
1774
|
+
| {
|
|
1775
|
+
field: string;
|
|
1776
|
+
kind: "where";
|
|
1777
|
+
op: WhereFilterOp;
|
|
1778
|
+
value: unknown;
|
|
1779
|
+
}
|
|
1780
|
+
| {
|
|
1781
|
+
filters: Filter[];
|
|
1782
|
+
kind: "and";
|
|
1783
|
+
}
|
|
1784
|
+
| {
|
|
1785
|
+
filters: Filter[];
|
|
1786
|
+
kind: "or";
|
|
1787
|
+
};
|
|
1788
|
+
```
|
|
1789
|
+
|
|
1790
|
+
Composite filter tree for `Query.applyFilter`. Recursive — `and` /
|
|
1791
|
+
`or` carry their own `filters` array of nested `Filter`s; the
|
|
1792
|
+
leaves are field/op/value triples (`kind: 'where'`).
|
|
1793
|
+
|
|
1794
|
+
Mirrors `firebase/firestore`'s `QueryFilterConstraint` shape, just
|
|
1795
|
+
as a tagged-union value type (the SDK's classes carry an `_op`
|
|
1796
|
+
field; ours is the `kind` discriminant).
|
|
1797
|
+
|
|
1798
|
+
***
|
|
1799
|
+
|
|
1800
|
+
<a id="snapshotlistenoptions"></a>
|
|
1801
|
+
|
|
1802
|
+
### SnapshotListenOptions
|
|
1803
|
+
|
|
1804
|
+
```ts
|
|
1805
|
+
type SnapshotListenOptions = SnapshotListenerOptions;
|
|
1806
|
+
```
|
|
1807
|
+
|
|
1808
|
+
Mirrors `firebase/firestore`'s `SnapshotListenOptions`. The
|
|
1809
|
+
`includeMetadataChanges` flag is accepted for API parity but has no
|
|
1810
|
+
observable effect in the sandbox: there's no offline cache and no
|
|
1811
|
+
pending-writes window, so `metadata.fromCache` and
|
|
1812
|
+
`metadata.hasPendingWrites` are always `false` (snapshot-listeners.ts section 6).
|
|
1813
|
+
|
|
1814
|
+
***
|
|
1815
|
+
|
|
1816
|
+
<a id="unsubscribe"></a>
|
|
1817
|
+
|
|
1818
|
+
### Unsubscribe()
|
|
1819
|
+
|
|
1820
|
+
```ts
|
|
1821
|
+
type Unsubscribe = () => void;
|
|
1822
|
+
```
|
|
1823
|
+
|
|
1824
|
+
Returned from `onSnapshot`. Calling it deregisters the listener and
|
|
1825
|
+
stops further callback invocations. Idempotent.
|
|
1826
|
+
|
|
1827
|
+
#### Returns
|
|
1828
|
+
|
|
1829
|
+
`void`
|
|
3
1830
|
|
|
4
1831
|
## Functions
|
|
5
1832
|
|
|
1833
|
+
<a id="getadminfirestore"></a>
|
|
1834
|
+
|
|
1835
|
+
### getAdminFirestore()
|
|
1836
|
+
|
|
1837
|
+
#### Call Signature
|
|
1838
|
+
|
|
1839
|
+
```ts
|
|
1840
|
+
function getAdminFirestore(ctx: SandboxContext): SandboxFirestore;
|
|
1841
|
+
```
|
|
1842
|
+
|
|
1843
|
+
Resolve a **rules-bypassing** Firestore handle for a context — the
|
|
1844
|
+
Pyric Studio admin lens (Gap #2). Same chainable `SandboxFirestore`
|
|
1845
|
+
surface as `getFirestore`, but every operation it issues (reads,
|
|
1846
|
+
writes, queries, batches, transactions) SKIPS security-rule evaluation
|
|
1847
|
+
and is treated as ALLOW. This is the modular/chainable-shaped sibling of
|
|
1848
|
+
the path-string `sandbox.admin.*` bypass — it reuses the exact same
|
|
1849
|
+
`LocalEnvironment` bypass execution path (`bypassRules` on the op),
|
|
1850
|
+
rather than reimplementing it.
|
|
1851
|
+
|
|
1852
|
+
Storage preconditions still apply (a `create` on an existing doc still
|
|
1853
|
+
fails `already-exists`, matching real Firestore admin), and the same
|
|
1854
|
+
`request`/`write` events fire + listeners wake, so the change shows up
|
|
1855
|
+
live and on the traffic log (stamped as an admin-bypass read/write).
|
|
1856
|
+
|
|
1857
|
+
Use for "edit anything as admin" surfaces (Studio F2). For rules-applied
|
|
1858
|
+
impersonation ("act as this user"), use `getFirestore(sandbox.withAuth({
|
|
1859
|
+
uid }))` instead — that path is unchanged.
|
|
1860
|
+
|
|
1861
|
+
##### Parameters
|
|
1862
|
+
|
|
1863
|
+
| Parameter | Type |
|
|
1864
|
+
| :------ | :------ |
|
|
1865
|
+
| `ctx` | [`SandboxContext`](pyric-firestore-reference-api.md#sandboxcontext) |
|
|
1866
|
+
|
|
1867
|
+
##### Returns
|
|
1868
|
+
|
|
1869
|
+
[`SandboxFirestore`](#sandboxfirestore)
|
|
1870
|
+
|
|
1871
|
+
##### Example
|
|
1872
|
+
|
|
1873
|
+
```ts
|
|
1874
|
+
import { initializeSandbox } from 'pyric/sandbox';
|
|
1875
|
+
import { getFirestore, getAdminFirestore } from 'pyric-admin/firestore';
|
|
1876
|
+
|
|
1877
|
+
const sandbox = initializeSandbox();
|
|
1878
|
+
getFirestore(sandbox.withAuth(null)).setRules('...deny everything...');
|
|
1879
|
+
|
|
1880
|
+
// Denied under rules:
|
|
1881
|
+
await getFirestore(sandbox.withAuth({ uid: 'alice' }))
|
|
1882
|
+
.doc('locked/x').set({ a: 1 }); // throws permission-denied
|
|
1883
|
+
|
|
1884
|
+
// Bypasses rules:
|
|
1885
|
+
await getAdminFirestore(sandbox).doc('locked/x').set({ a: 1 }); // ok
|
|
1886
|
+
```
|
|
1887
|
+
|
|
1888
|
+
#### Call Signature
|
|
1889
|
+
|
|
1890
|
+
```ts
|
|
1891
|
+
function getAdminFirestore(sandbox: Sandbox): SandboxFirestore;
|
|
1892
|
+
```
|
|
1893
|
+
|
|
1894
|
+
Resolve a **rules-bypassing** Firestore handle for a context — the
|
|
1895
|
+
Pyric Studio admin lens (Gap #2). Same chainable `SandboxFirestore`
|
|
1896
|
+
surface as `getFirestore`, but every operation it issues (reads,
|
|
1897
|
+
writes, queries, batches, transactions) SKIPS security-rule evaluation
|
|
1898
|
+
and is treated as ALLOW. This is the modular/chainable-shaped sibling of
|
|
1899
|
+
the path-string `sandbox.admin.*` bypass — it reuses the exact same
|
|
1900
|
+
`LocalEnvironment` bypass execution path (`bypassRules` on the op),
|
|
1901
|
+
rather than reimplementing it.
|
|
1902
|
+
|
|
1903
|
+
Storage preconditions still apply (a `create` on an existing doc still
|
|
1904
|
+
fails `already-exists`, matching real Firestore admin), and the same
|
|
1905
|
+
`request`/`write` events fire + listeners wake, so the change shows up
|
|
1906
|
+
live and on the traffic log (stamped as an admin-bypass read/write).
|
|
1907
|
+
|
|
1908
|
+
Use for "edit anything as admin" surfaces (Studio F2). For rules-applied
|
|
1909
|
+
impersonation ("act as this user"), use `getFirestore(sandbox.withAuth({
|
|
1910
|
+
uid }))` instead — that path is unchanged.
|
|
1911
|
+
|
|
1912
|
+
##### Parameters
|
|
1913
|
+
|
|
1914
|
+
| Parameter | Type |
|
|
1915
|
+
| :------ | :------ |
|
|
1916
|
+
| `sandbox` | [`Sandbox`](pyric-firestore-reference-api.md#sandbox) |
|
|
1917
|
+
|
|
1918
|
+
##### Returns
|
|
1919
|
+
|
|
1920
|
+
[`SandboxFirestore`](#sandboxfirestore)
|
|
1921
|
+
|
|
1922
|
+
##### Example
|
|
1923
|
+
|
|
1924
|
+
```ts
|
|
1925
|
+
import { initializeSandbox } from 'pyric/sandbox';
|
|
1926
|
+
import { getFirestore, getAdminFirestore } from 'pyric-admin/firestore';
|
|
1927
|
+
|
|
1928
|
+
const sandbox = initializeSandbox();
|
|
1929
|
+
getFirestore(sandbox.withAuth(null)).setRules('...deny everything...');
|
|
1930
|
+
|
|
1931
|
+
// Denied under rules:
|
|
1932
|
+
await getFirestore(sandbox.withAuth({ uid: 'alice' }))
|
|
1933
|
+
.doc('locked/x').set({ a: 1 }); // throws permission-denied
|
|
1934
|
+
|
|
1935
|
+
// Bypasses rules:
|
|
1936
|
+
await getAdminFirestore(sandbox).doc('locked/x').set({ a: 1 }); // ok
|
|
1937
|
+
```
|
|
1938
|
+
|
|
1939
|
+
***
|
|
1940
|
+
|
|
6
1941
|
<a id="getfirestore"></a>
|
|
7
1942
|
|
|
8
1943
|
### getFirestore()
|
|
9
1944
|
|
|
10
1945
|
```ts
|
|
11
|
-
function getFirestore(target?:
|
|
1946
|
+
function getFirestore(target?:
|
|
1947
|
+
| SandboxAdminApp
|
|
1948
|
+
| SandboxContext): SandboxFirestore;
|
|
12
1949
|
```
|
|
13
1950
|
|
|
14
1951
|
Return the admin Firestore handle.
|
|
15
1952
|
|
|
16
|
-
- `getFirestore(ctx)` — the original context form (rules-
|
|
1953
|
+
- `getFirestore(ctx)` — the original context form (rules-APPLIED for the
|
|
17
1954
|
ctx's captured identity). Unchanged; idempotent per `SandboxContext`.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1955
|
+
This is the pyric-internal rules-simulation shape, not a firebase-admin
|
|
1956
|
+
shape, so it keeps rule evaluation.
|
|
1957
|
+
- `getFirestore(app)` — resolves a [PyricAdminApp](pyric-admin-app-reference-api.md#pyricadminapp)'s sandbox to the
|
|
1958
|
+
rules-BYPASS admin lens (firebase-admin parity, #394).
|
|
1959
|
+
- `getFirestore()` — resolves the default app to the rules-BYPASS admin
|
|
1960
|
+
lens; throws `app/no-app` when nothing is initialized.
|
|
1961
|
+
|
|
1962
|
+
The app forms mirror `firebase-admin/firestore`'s `getFirestore(app?)`,
|
|
1963
|
+
which bypasses security rules — so a Cloud Function's admin write lands the
|
|
1964
|
+
same way it does in production, instead of being denied as `request.auth ==
|
|
1965
|
+
null` by the sandbox's anon lens (the #394 deny-direction divergence).
|
|
21
1966
|
|
|
22
1967
|
#### Parameters
|
|
23
1968
|
|
|
24
1969
|
| Parameter | Type |
|
|
25
1970
|
| :------ | :------ |
|
|
26
|
-
| `target?` | `
|
|
1971
|
+
| `target?` | \| [`SandboxAdminApp`](pyric-admin-app-reference-api.md#sandboxadminapp) \| [`SandboxContext`](pyric-firestore-reference-api.md#sandboxcontext) |
|
|
27
1972
|
|
|
28
1973
|
#### Returns
|
|
29
1974
|
|
|
30
|
-
`SandboxFirestore`
|
|
1975
|
+
[`SandboxFirestore`](#sandboxfirestore)
|
|
1976
|
+
|
|
1977
|
+
***
|
|
1978
|
+
|
|
1979
|
+
<a id="onsnapshot"></a>
|
|
1980
|
+
|
|
1981
|
+
### onSnapshot()
|
|
1982
|
+
|
|
1983
|
+
#### Call Signature
|
|
1984
|
+
|
|
1985
|
+
```ts
|
|
1986
|
+
function onSnapshot(reference: DocumentReference, observer: SnapshotObserver<DocumentSnapshot>): Unsubscribe;
|
|
1987
|
+
```
|
|
1988
|
+
|
|
1989
|
+
##### Parameters
|
|
1990
|
+
|
|
1991
|
+
| Parameter | Type |
|
|
1992
|
+
| :------ | :------ |
|
|
1993
|
+
| `reference` | [`DocumentReference`](#documentreference) |
|
|
1994
|
+
| `observer` | [`SnapshotObserver`](#snapshotobserver)\<[`DocumentSnapshot`](#documentsnapshot)\> |
|
|
1995
|
+
|
|
1996
|
+
##### Returns
|
|
1997
|
+
|
|
1998
|
+
[`Unsubscribe`](#unsubscribe)
|
|
1999
|
+
|
|
2000
|
+
#### Call Signature
|
|
2001
|
+
|
|
2002
|
+
```ts
|
|
2003
|
+
function onSnapshot(
|
|
2004
|
+
reference: DocumentReference,
|
|
2005
|
+
options: SnapshotListenerOptions,
|
|
2006
|
+
observer: SnapshotObserver<DocumentSnapshot>): Unsubscribe;
|
|
2007
|
+
```
|
|
2008
|
+
|
|
2009
|
+
##### Parameters
|
|
2010
|
+
|
|
2011
|
+
| Parameter | Type |
|
|
2012
|
+
| :------ | :------ |
|
|
2013
|
+
| `reference` | [`DocumentReference`](#documentreference) |
|
|
2014
|
+
| `options` | `SnapshotListenerOptions` |
|
|
2015
|
+
| `observer` | [`SnapshotObserver`](#snapshotobserver)\<[`DocumentSnapshot`](#documentsnapshot)\> |
|
|
2016
|
+
|
|
2017
|
+
##### Returns
|
|
2018
|
+
|
|
2019
|
+
[`Unsubscribe`](#unsubscribe)
|
|
2020
|
+
|
|
2021
|
+
#### Call Signature
|
|
2022
|
+
|
|
2023
|
+
```ts
|
|
2024
|
+
function onSnapshot(
|
|
2025
|
+
reference: DocumentReference,
|
|
2026
|
+
onNext: (snapshot: DocumentSnapshot) => void,
|
|
2027
|
+
onError?: (error: unknown) => void,
|
|
2028
|
+
onCompletion?: () => void): Unsubscribe;
|
|
2029
|
+
```
|
|
2030
|
+
|
|
2031
|
+
##### Parameters
|
|
2032
|
+
|
|
2033
|
+
| Parameter | Type |
|
|
2034
|
+
| :------ | :------ |
|
|
2035
|
+
| `reference` | [`DocumentReference`](#documentreference) |
|
|
2036
|
+
| `onNext` | (`snapshot`: [`DocumentSnapshot`](#documentsnapshot)) => `void` |
|
|
2037
|
+
| `onError?` | (`error`: `unknown`) => `void` |
|
|
2038
|
+
| `onCompletion?` | () => `void` |
|
|
2039
|
+
|
|
2040
|
+
##### Returns
|
|
2041
|
+
|
|
2042
|
+
[`Unsubscribe`](#unsubscribe)
|
|
2043
|
+
|
|
2044
|
+
#### Call Signature
|
|
2045
|
+
|
|
2046
|
+
```ts
|
|
2047
|
+
function onSnapshot(
|
|
2048
|
+
reference: DocumentReference,
|
|
2049
|
+
options: SnapshotListenerOptions,
|
|
2050
|
+
onNext: (snapshot: DocumentSnapshot) => void,
|
|
2051
|
+
onError?: (error: unknown) => void,
|
|
2052
|
+
onCompletion?: () => void): Unsubscribe;
|
|
2053
|
+
```
|
|
2054
|
+
|
|
2055
|
+
##### Parameters
|
|
2056
|
+
|
|
2057
|
+
| Parameter | Type |
|
|
2058
|
+
| :------ | :------ |
|
|
2059
|
+
| `reference` | [`DocumentReference`](#documentreference) |
|
|
2060
|
+
| `options` | `SnapshotListenerOptions` |
|
|
2061
|
+
| `onNext` | (`snapshot`: [`DocumentSnapshot`](#documentsnapshot)) => `void` |
|
|
2062
|
+
| `onError?` | (`error`: `unknown`) => `void` |
|
|
2063
|
+
| `onCompletion?` | () => `void` |
|
|
2064
|
+
|
|
2065
|
+
##### Returns
|
|
2066
|
+
|
|
2067
|
+
[`Unsubscribe`](#unsubscribe)
|
|
2068
|
+
|
|
2069
|
+
#### Call Signature
|
|
2070
|
+
|
|
2071
|
+
```ts
|
|
2072
|
+
function onSnapshot(reference: Query | CollectionReference, observer: SnapshotObserver<QuerySnapshot>): Unsubscribe;
|
|
2073
|
+
```
|
|
2074
|
+
|
|
2075
|
+
##### Parameters
|
|
2076
|
+
|
|
2077
|
+
| Parameter | Type |
|
|
2078
|
+
| :------ | :------ |
|
|
2079
|
+
| `reference` | [`Query`](#query) \| [`CollectionReference`](#collectionreference) |
|
|
2080
|
+
| `observer` | [`SnapshotObserver`](#snapshotobserver)\<[`QuerySnapshot`](#querysnapshot)\> |
|
|
2081
|
+
|
|
2082
|
+
##### Returns
|
|
2083
|
+
|
|
2084
|
+
[`Unsubscribe`](#unsubscribe)
|
|
2085
|
+
|
|
2086
|
+
#### Call Signature
|
|
2087
|
+
|
|
2088
|
+
```ts
|
|
2089
|
+
function onSnapshot(
|
|
2090
|
+
reference: Query | CollectionReference,
|
|
2091
|
+
options: SnapshotListenerOptions,
|
|
2092
|
+
observer: SnapshotObserver<QuerySnapshot>): Unsubscribe;
|
|
2093
|
+
```
|
|
2094
|
+
|
|
2095
|
+
##### Parameters
|
|
2096
|
+
|
|
2097
|
+
| Parameter | Type |
|
|
2098
|
+
| :------ | :------ |
|
|
2099
|
+
| `reference` | [`Query`](#query) \| [`CollectionReference`](#collectionreference) |
|
|
2100
|
+
| `options` | `SnapshotListenerOptions` |
|
|
2101
|
+
| `observer` | [`SnapshotObserver`](#snapshotobserver)\<[`QuerySnapshot`](#querysnapshot)\> |
|
|
2102
|
+
|
|
2103
|
+
##### Returns
|
|
2104
|
+
|
|
2105
|
+
[`Unsubscribe`](#unsubscribe)
|
|
2106
|
+
|
|
2107
|
+
#### Call Signature
|
|
2108
|
+
|
|
2109
|
+
```ts
|
|
2110
|
+
function onSnapshot(
|
|
2111
|
+
reference: Query | CollectionReference,
|
|
2112
|
+
onNext: (snapshot: QuerySnapshot) => void,
|
|
2113
|
+
onError?: (error: unknown) => void,
|
|
2114
|
+
onCompletion?: () => void): Unsubscribe;
|
|
2115
|
+
```
|
|
2116
|
+
|
|
2117
|
+
##### Parameters
|
|
2118
|
+
|
|
2119
|
+
| Parameter | Type |
|
|
2120
|
+
| :------ | :------ |
|
|
2121
|
+
| `reference` | [`Query`](#query) \| [`CollectionReference`](#collectionreference) |
|
|
2122
|
+
| `onNext` | (`snapshot`: [`QuerySnapshot`](#querysnapshot)) => `void` |
|
|
2123
|
+
| `onError?` | (`error`: `unknown`) => `void` |
|
|
2124
|
+
| `onCompletion?` | () => `void` |
|
|
2125
|
+
|
|
2126
|
+
##### Returns
|
|
2127
|
+
|
|
2128
|
+
[`Unsubscribe`](#unsubscribe)
|
|
2129
|
+
|
|
2130
|
+
#### Call Signature
|
|
2131
|
+
|
|
2132
|
+
```ts
|
|
2133
|
+
function onSnapshot(
|
|
2134
|
+
reference: Query | CollectionReference,
|
|
2135
|
+
options: SnapshotListenerOptions,
|
|
2136
|
+
onNext: (snapshot: QuerySnapshot) => void,
|
|
2137
|
+
onError?: (error: unknown) => void,
|
|
2138
|
+
onCompletion?: () => void): Unsubscribe;
|
|
2139
|
+
```
|
|
2140
|
+
|
|
2141
|
+
##### Parameters
|
|
2142
|
+
|
|
2143
|
+
| Parameter | Type |
|
|
2144
|
+
| :------ | :------ |
|
|
2145
|
+
| `reference` | [`Query`](#query) \| [`CollectionReference`](#collectionreference) |
|
|
2146
|
+
| `options` | `SnapshotListenerOptions` |
|
|
2147
|
+
| `onNext` | (`snapshot`: [`QuerySnapshot`](#querysnapshot)) => `void` |
|
|
2148
|
+
| `onError?` | (`error`: `unknown`) => `void` |
|
|
2149
|
+
| `onCompletion?` | () => `void` |
|
|
2150
|
+
|
|
2151
|
+
##### Returns
|
|
2152
|
+
|
|
2153
|
+
[`Unsubscribe`](#unsubscribe)
|
|
2154
|
+
|
|
2155
|
+
## References
|
|
2156
|
+
|
|
2157
|
+
<a id="authstate"></a>
|
|
2158
|
+
|
|
2159
|
+
### AuthState
|
|
2160
|
+
|
|
2161
|
+
Re-exports [AuthState](pyric-firestore-reference-api.md#authstate)
|
|
2162
|
+
|
|
2163
|
+
***
|
|
2164
|
+
|
|
2165
|
+
<a id="documentdata"></a>
|
|
2166
|
+
|
|
2167
|
+
### DocumentData
|
|
2168
|
+
|
|
2169
|
+
Re-exports [DocumentData](pyric-firestore-reference-api.md#documentdata)
|
|
2170
|
+
|
|
2171
|
+
***
|
|
2172
|
+
|
|
2173
|
+
<a id="fieldvalue"></a>
|
|
2174
|
+
|
|
2175
|
+
### FieldValue
|
|
2176
|
+
|
|
2177
|
+
Re-exports [FieldValue](pyric-firestore-reference-api.md#fieldvalue)
|
|
2178
|
+
|
|
2179
|
+
***
|
|
2180
|
+
|
|
2181
|
+
<a id="fieldvaluesentinel"></a>
|
|
2182
|
+
|
|
2183
|
+
### FieldValueSentinel
|
|
2184
|
+
|
|
2185
|
+
Re-exports [FieldValueSentinel](pyric-firestore-reference-api.md#fieldvaluesentinel)
|
|
2186
|
+
|
|
2187
|
+
***
|
|
2188
|
+
|
|
2189
|
+
<a id="lintresult"></a>
|
|
2190
|
+
|
|
2191
|
+
### LintResult
|
|
2192
|
+
|
|
2193
|
+
Re-exports [LintResult](pyric-firestore-reference-api.md#lintresult)
|
|
2194
|
+
|
|
2195
|
+
***
|
|
2196
|
+
|
|
2197
|
+
<a id="orderdirection"></a>
|
|
2198
|
+
|
|
2199
|
+
### OrderDirection
|
|
2200
|
+
|
|
2201
|
+
Re-exports [OrderDirection](pyric-firestore-reference-api.md#orderdirection)
|
|
2202
|
+
|
|
2203
|
+
***
|
|
2204
|
+
|
|
2205
|
+
<a id="sandbox"></a>
|
|
2206
|
+
|
|
2207
|
+
### Sandbox
|
|
2208
|
+
|
|
2209
|
+
Re-exports [Sandbox](pyric-firestore-reference-api.md#sandbox)
|
|
2210
|
+
|
|
2211
|
+
***
|
|
2212
|
+
|
|
2213
|
+
<a id="sandboxcontext"></a>
|
|
2214
|
+
|
|
2215
|
+
### SandboxContext
|
|
2216
|
+
|
|
2217
|
+
Re-exports [SandboxContext](pyric-firestore-reference-api.md#sandboxcontext)
|
|
2218
|
+
|
|
2219
|
+
***
|
|
2220
|
+
|
|
2221
|
+
<a id="sandboxerror"></a>
|
|
2222
|
+
|
|
2223
|
+
### SandboxError
|
|
2224
|
+
|
|
2225
|
+
Re-exports [SandboxError](pyric-firestore-reference-api.md#sandboxerror)
|
|
2226
|
+
|
|
2227
|
+
***
|
|
2228
|
+
|
|
2229
|
+
<a id="timestamp"></a>
|
|
2230
|
+
|
|
2231
|
+
### Timestamp
|
|
2232
|
+
|
|
2233
|
+
Re-exports [Timestamp](pyric-firestore-reference-api.md#timestamp)
|
|
2234
|
+
|
|
2235
|
+
***
|
|
2236
|
+
|
|
2237
|
+
<a id="wherefilterop"></a>
|
|
2238
|
+
|
|
2239
|
+
### WhereFilterOp
|
|
2240
|
+
|
|
2241
|
+
Re-exports [WhereFilterOp](pyric-firestore-reference-api.md#wherefilterop)
|