pyric 0.0.1 → 0.1.0-alpha.8
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 +138 -2
- package/README.md.orig +54 -0
- package/dist/app/index.d.ts +81 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/app/index.js +78 -0
- package/dist/app/index.js.map +1 -0
- package/dist/auth/index.d.ts +346 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +701 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/prod-backend.d.ts +39 -0
- package/dist/auth/prod-backend.d.ts.map +1 -0
- package/dist/auth/prod-backend.js +179 -0
- package/dist/auth/prod-backend.js.map +1 -0
- package/dist/auth/providers.d.ts +107 -0
- package/dist/auth/providers.d.ts.map +1 -0
- package/dist/auth/providers.js +138 -0
- package/dist/auth/providers.js.map +1 -0
- package/dist/auth/sandbox-backend.d.ts +769 -0
- package/dist/auth/sandbox-backend.d.ts.map +1 -0
- package/dist/auth/sandbox-backend.js +1598 -0
- package/dist/auth/sandbox-backend.js.map +1 -0
- package/dist/auth/target.d.ts +40 -0
- package/dist/auth/target.d.ts.map +1 -0
- package/dist/auth/target.js +28 -0
- package/dist/auth/target.js.map +1 -0
- package/dist/auth/types.d.ts +252 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +26 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/database/constraints/atoms.d.ts +29 -0
- package/dist/database/constraints/atoms.d.ts.map +1 -0
- package/dist/database/constraints/atoms.js +43 -0
- package/dist/database/constraints/atoms.js.map +1 -0
- package/dist/database/constraints/compose.d.ts +16 -0
- package/dist/database/constraints/compose.d.ts.map +1 -0
- package/dist/database/constraints/compose.js +15 -0
- package/dist/database/constraints/compose.js.map +1 -0
- package/dist/database/constraints/data.d.ts +30 -0
- package/dist/database/constraints/data.d.ts.map +1 -0
- package/dist/database/constraints/data.js +46 -0
- package/dist/database/constraints/data.js.map +1 -0
- package/dist/database/constraints/document.d.ts +42 -0
- package/dist/database/constraints/document.d.ts.map +1 -0
- package/dist/database/constraints/document.js +86 -0
- package/dist/database/constraints/document.js.map +1 -0
- package/dist/database/constraints/game.d.ts +30 -0
- package/dist/database/constraints/game.d.ts.map +1 -0
- package/dist/database/constraints/game.js +49 -0
- package/dist/database/constraints/game.js.map +1 -0
- package/dist/database/constraints/index.d.ts +12 -0
- package/dist/database/constraints/index.d.ts.map +1 -0
- package/dist/database/constraints/index.js +9 -0
- package/dist/database/constraints/index.js.map +1 -0
- package/dist/database/constraints/policies.d.ts +16 -0
- package/dist/database/constraints/policies.d.ts.map +1 -0
- package/dist/database/constraints/policies.js +17 -0
- package/dist/database/constraints/policies.js.map +1 -0
- package/dist/database/constraints/ruleset.d.ts +5 -0
- package/dist/database/constraints/ruleset.d.ts.map +1 -0
- package/dist/database/constraints/ruleset.js +132 -0
- package/dist/database/constraints/ruleset.js.map +1 -0
- package/dist/database/constraints/schema.d.ts +17 -0
- package/dist/database/constraints/schema.d.ts.map +1 -0
- package/dist/database/constraints/schema.js +74 -0
- package/dist/database/constraints/schema.js.map +1 -0
- package/dist/database/constraints/types.d.ts +22 -0
- package/dist/database/constraints/types.d.ts.map +1 -0
- package/dist/database/constraints/types.js +2 -0
- package/dist/database/constraints/types.js.map +1 -0
- package/dist/database/crawl/handler.d.ts +7 -0
- package/dist/database/crawl/handler.d.ts.map +1 -0
- package/dist/database/crawl/handler.js +91 -0
- package/dist/database/crawl/handler.js.map +1 -0
- package/dist/database/crawl/semaphore.d.ts +9 -0
- package/dist/database/crawl/semaphore.d.ts.map +1 -0
- package/dist/database/crawl/semaphore.js +27 -0
- package/dist/database/crawl/semaphore.js.map +1 -0
- package/dist/database/crawl/spec.d.ts +33 -0
- package/dist/database/crawl/spec.d.ts.map +1 -0
- package/dist/database/crawl/spec.js +12 -0
- package/dist/database/crawl/spec.js.map +1 -0
- package/dist/database/data/handler.d.ts +9 -0
- package/dist/database/data/handler.d.ts.map +1 -0
- package/dist/database/data/handler.js +96 -0
- package/dist/database/data/handler.js.map +1 -0
- package/dist/database/data/spec.d.ts +77 -0
- package/dist/database/data/spec.d.ts.map +1 -0
- package/dist/database/data/spec.js +17 -0
- package/dist/database/data/spec.js.map +1 -0
- package/dist/database/data/validated.d.ts +8 -0
- package/dist/database/data/validated.d.ts.map +1 -0
- package/dist/database/data/validated.js +99 -0
- package/dist/database/data/validated.js.map +1 -0
- package/dist/database/grammar/RtdbExpr.ohm +98 -0
- package/dist/database/grammar/RtdbExpr.ohm.generated.d.ts +2 -0
- package/dist/database/grammar/RtdbExpr.ohm.generated.d.ts.map +1 -0
- package/dist/database/grammar/RtdbExpr.ohm.generated.js +103 -0
- package/dist/database/grammar/RtdbExpr.ohm.generated.js.map +1 -0
- package/dist/database/grammar/RtdbExprParser.d.ts +5 -0
- package/dist/database/grammar/RtdbExprParser.d.ts.map +1 -0
- package/dist/database/grammar/RtdbExprParser.js +53 -0
- package/dist/database/grammar/RtdbExprParser.js.map +1 -0
- package/dist/database/grammar/linter.d.ts +3 -0
- package/dist/database/grammar/linter.d.ts.map +1 -0
- package/dist/database/grammar/linter.js +66 -0
- package/dist/database/grammar/linter.js.map +1 -0
- package/dist/database/grammar/simulator.d.ts +31 -0
- package/dist/database/grammar/simulator.d.ts.map +1 -0
- package/dist/database/grammar/simulator.js +255 -0
- package/dist/database/grammar/simulator.js.map +1 -0
- package/dist/database/grammar/validator.d.ts +3 -0
- package/dist/database/grammar/validator.d.ts.map +1 -0
- package/dist/database/grammar/validator.js +84 -0
- package/dist/database/grammar/validator.js.map +1 -0
- package/dist/database/host.d.ts +50 -0
- package/dist/database/host.d.ts.map +1 -0
- package/dist/database/host.js +41 -0
- package/dist/database/host.js.map +1 -0
- package/dist/database/index.d.ts +40 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +47 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/initialize-from-app.d.ts +28 -0
- package/dist/database/initialize-from-app.d.ts.map +1 -0
- package/dist/database/initialize-from-app.js +23 -0
- package/dist/database/initialize-from-app.js.map +1 -0
- package/dist/database/ir/handler.d.ts +6 -0
- package/dist/database/ir/handler.d.ts.map +1 -0
- package/dist/database/ir/handler.js +52 -0
- package/dist/database/ir/handler.js.map +1 -0
- package/dist/database/ir/spec.d.ts +25 -0
- package/dist/database/ir/spec.d.ts.map +1 -0
- package/dist/database/ir/spec.js +11 -0
- package/dist/database/ir/spec.js.map +1 -0
- package/dist/database/mapper.d.ts +9 -0
- package/dist/database/mapper.d.ts.map +1 -0
- package/dist/database/mapper.js +115 -0
- package/dist/database/mapper.js.map +1 -0
- package/dist/database/modular.d.ts +604 -0
- package/dist/database/modular.d.ts.map +1 -0
- package/dist/database/modular.js +1226 -0
- package/dist/database/modular.js.map +1 -0
- package/dist/database/replay.d.ts +33 -0
- package/dist/database/replay.d.ts.map +1 -0
- package/dist/database/replay.js +124 -0
- package/dist/database/replay.js.map +1 -0
- package/dist/database/resolver.d.ts +4 -0
- package/dist/database/resolver.d.ts.map +1 -0
- package/dist/database/resolver.js +66 -0
- package/dist/database/resolver.js.map +1 -0
- package/dist/database/sandbox/backend.d.ts +403 -0
- package/dist/database/sandbox/backend.d.ts.map +1 -0
- package/dist/database/sandbox/backend.js +1467 -0
- package/dist/database/sandbox/backend.js.map +1 -0
- package/dist/database/sandbox/data-tree.d.ts +123 -0
- package/dist/database/sandbox/data-tree.d.ts.map +1 -0
- package/dist/database/sandbox/data-tree.js +310 -0
- package/dist/database/sandbox/data-tree.js.map +1 -0
- package/dist/database/sandbox/normalize.d.ts +77 -0
- package/dist/database/sandbox/normalize.d.ts.map +1 -0
- package/dist/database/sandbox/normalize.js +165 -0
- package/dist/database/sandbox/normalize.js.map +1 -0
- package/dist/database/sandbox/push-id.d.ts +32 -0
- package/dist/database/sandbox/push-id.d.ts.map +1 -0
- package/dist/database/sandbox/push-id.js +82 -0
- package/dist/database/sandbox/push-id.js.map +1 -0
- package/dist/database/sandbox/query.d.ts +175 -0
- package/dist/database/sandbox/query.d.ts.map +1 -0
- package/dist/database/sandbox/query.js +269 -0
- package/dist/database/sandbox/query.js.map +1 -0
- package/dist/database/sandbox/rules-eval.d.ts +69 -0
- package/dist/database/sandbox/rules-eval.d.ts.map +1 -0
- package/dist/database/sandbox/rules-eval.js +124 -0
- package/dist/database/sandbox/rules-eval.js.map +1 -0
- package/dist/database/sandbox/sentinels.d.ts +71 -0
- package/dist/database/sandbox/sentinels.d.ts.map +1 -0
- package/dist/database/sandbox/sentinels.js +92 -0
- package/dist/database/sandbox/sentinels.js.map +1 -0
- package/dist/database/simulation/handler.d.ts +6 -0
- package/dist/database/simulation/handler.d.ts.map +1 -0
- package/dist/database/simulation/handler.js +236 -0
- package/dist/database/simulation/handler.js.map +1 -0
- package/dist/database/simulation/spec.d.ts +69 -0
- package/dist/database/simulation/spec.d.ts.map +1 -0
- package/dist/database/simulation/spec.js +25 -0
- package/dist/database/simulation/spec.js.map +1 -0
- package/dist/database/tools.d.ts +22 -0
- package/dist/database/tools.d.ts.map +1 -0
- package/dist/database/tools.js +272 -0
- package/dist/database/tools.js.map +1 -0
- package/dist/database/types.d.ts +210 -0
- package/dist/database/types.d.ts.map +1 -0
- package/dist/database/types.js +26 -0
- package/dist/database/types.js.map +1 -0
- package/dist/database/write/handler.d.ts +7 -0
- package/dist/database/write/handler.d.ts.map +1 -0
- package/dist/database/write/handler.js +42 -0
- package/dist/database/write/handler.js.map +1 -0
- package/dist/database/write/spec.d.ts +18 -0
- package/dist/database/write/spec.d.ts.map +1 -0
- package/dist/database/write/spec.js +7 -0
- package/dist/database/write/spec.js.map +1 -0
- package/dist/firestore/index.d.ts +533 -0
- package/dist/firestore/index.d.ts.map +1 -0
- package/dist/firestore/index.js +1536 -0
- package/dist/firestore/index.js.map +1 -0
- package/dist/firestore/tools.d.ts +67 -0
- package/dist/firestore/tools.d.ts.map +1 -0
- package/dist/firestore/tools.js +318 -0
- package/dist/firestore/tools.js.map +1 -0
- package/dist/firestore-values/index.d.ts +63 -0
- package/dist/firestore-values/index.d.ts.map +1 -0
- package/dist/firestore-values/index.js +148 -0
- package/dist/firestore-values/index.js.map +1 -0
- package/dist/project-scope.d.ts +5 -0
- package/dist/project-scope.d.ts.map +1 -0
- package/dist/project-scope.js +2 -0
- package/dist/project-scope.js.map +1 -0
- package/dist/rules/extract.d.ts +28 -0
- package/dist/rules/extract.d.ts.map +1 -0
- package/dist/rules/extract.js +25 -0
- package/dist/rules/extract.js.map +1 -0
- package/dist/rules/generators/assembler.d.ts +19 -0
- package/dist/rules/generators/assembler.d.ts.map +1 -0
- package/dist/rules/generators/assembler.js +292 -0
- package/dist/rules/generators/assembler.js.map +1 -0
- package/dist/rules/generators/expressions.d.ts +52 -0
- package/dist/rules/generators/expressions.d.ts.map +1 -0
- package/dist/rules/generators/expressions.js +117 -0
- package/dist/rules/generators/expressions.js.map +1 -0
- package/dist/rules/generators/grid.d.ts +22 -0
- package/dist/rules/generators/grid.d.ts.map +1 -0
- package/dist/rules/generators/grid.js +52 -0
- package/dist/rules/generators/grid.js.map +1 -0
- package/dist/rules/grammar/FirestoreAST.d.ts +129 -0
- package/dist/rules/grammar/FirestoreAST.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreAST.js +3 -0
- package/dist/rules/grammar/FirestoreAST.js.map +1 -0
- package/dist/rules/grammar/FirestoreAssembler.d.ts +5 -0
- package/dist/rules/grammar/FirestoreAssembler.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreAssembler.js +158 -0
- package/dist/rules/grammar/FirestoreAssembler.js.map +1 -0
- package/dist/rules/grammar/FirestoreParser.d.ts +46 -0
- package/dist/rules/grammar/FirestoreParser.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreParser.js +409 -0
- package/dist/rules/grammar/FirestoreParser.js.map +1 -0
- package/dist/rules/grammar/FirestoreRules.ohm +229 -0
- package/dist/rules/grammar/FirestoreRules.ohm.generated.d.ts +2 -0
- package/dist/rules/grammar/FirestoreRules.ohm.generated.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreRules.ohm.generated.js +234 -0
- package/dist/rules/grammar/FirestoreRules.ohm.generated.js.map +1 -0
- package/dist/rules/grammar/FirestoreValidator.d.ts +10 -0
- package/dist/rules/grammar/FirestoreValidator.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreValidator.js +482 -0
- package/dist/rules/grammar/FirestoreValidator.js.map +1 -0
- package/dist/rules/index.d.ts +67 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +80 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/indexes/extract/annotation-collect.d.ts +42 -0
- package/dist/rules/indexes/extract/annotation-collect.d.ts.map +1 -0
- package/dist/rules/indexes/extract/annotation-collect.js +69 -0
- package/dist/rules/indexes/extract/annotation-collect.js.map +1 -0
- package/dist/rules/indexes/extract/annotations.d.ts +50 -0
- package/dist/rules/indexes/extract/annotations.d.ts.map +1 -0
- package/dist/rules/indexes/extract/annotations.js +144 -0
- package/dist/rules/indexes/extract/annotations.js.map +1 -0
- package/dist/rules/indexes/extract/ast.d.ts +54 -0
- package/dist/rules/indexes/extract/ast.d.ts.map +1 -0
- package/dist/rules/indexes/extract/ast.js +119 -0
- package/dist/rules/indexes/extract/ast.js.map +1 -0
- package/dist/rules/indexes/extract/classify.d.ts +41 -0
- package/dist/rules/indexes/extract/classify.d.ts.map +1 -0
- package/dist/rules/indexes/extract/classify.js +138 -0
- package/dist/rules/indexes/extract/classify.js.map +1 -0
- package/dist/rules/indexes/extract/composite.d.ts +38 -0
- package/dist/rules/indexes/extract/composite.d.ts.map +1 -0
- package/dist/rules/indexes/extract/composite.js +85 -0
- package/dist/rules/indexes/extract/composite.js.map +1 -0
- package/dist/rules/indexes/extract/dataflow.d.ts +45 -0
- package/dist/rules/indexes/extract/dataflow.d.ts.map +1 -0
- package/dist/rules/indexes/extract/dataflow.js +200 -0
- package/dist/rules/indexes/extract/dataflow.js.map +1 -0
- package/dist/rules/indexes/extract/enumerate.d.ts +41 -0
- package/dist/rules/indexes/extract/enumerate.d.ts.map +1 -0
- package/dist/rules/indexes/extract/enumerate.js +163 -0
- package/dist/rules/indexes/extract/enumerate.js.map +1 -0
- package/dist/rules/indexes/extract/extractor.d.ts +3 -0
- package/dist/rules/indexes/extract/extractor.d.ts.map +1 -0
- package/dist/rules/indexes/extract/extractor.js +274 -0
- package/dist/rules/indexes/extract/extractor.js.map +1 -0
- package/dist/rules/indexes/extract/types.d.ts +211 -0
- package/dist/rules/indexes/extract/types.d.ts.map +1 -0
- package/dist/rules/indexes/extract/types.js +14 -0
- package/dist/rules/indexes/extract/types.js.map +1 -0
- package/dist/rules/indexes/extractHandler.d.ts +16 -0
- package/dist/rules/indexes/extractHandler.d.ts.map +1 -0
- package/dist/rules/indexes/extractHandler.js +100 -0
- package/dist/rules/indexes/extractHandler.js.map +1 -0
- package/dist/rules/indexes/extractTool.d.ts +15 -0
- package/dist/rules/indexes/extractTool.d.ts.map +1 -0
- package/dist/rules/indexes/extractTool.js +55 -0
- package/dist/rules/indexes/extractTool.js.map +1 -0
- package/dist/rules/indexes/types.d.ts +71 -0
- package/dist/rules/indexes/types.d.ts.map +1 -0
- package/dist/rules/indexes/types.js +15 -0
- package/dist/rules/indexes/types.js.map +1 -0
- package/dist/rules/inspect/handler.d.ts +6 -0
- package/dist/rules/inspect/handler.d.ts.map +1 -0
- package/dist/rules/inspect/handler.js +144 -0
- package/dist/rules/inspect/handler.js.map +1 -0
- package/dist/rules/inspect/spec.d.ts +37 -0
- package/dist/rules/inspect/spec.d.ts.map +1 -0
- package/dist/rules/inspect/spec.js +2 -0
- package/dist/rules/inspect/spec.js.map +1 -0
- package/dist/rules/inspect/tools.d.ts +21 -0
- package/dist/rules/inspect/tools.d.ts.map +1 -0
- package/dist/rules/inspect/tools.js +21 -0
- package/dist/rules/inspect/tools.js.map +1 -0
- package/dist/rules/linter/ast-utils.d.ts +97 -0
- package/dist/rules/linter/ast-utils.d.ts.map +1 -0
- package/dist/rules/linter/ast-utils.js +491 -0
- package/dist/rules/linter/ast-utils.js.map +1 -0
- package/dist/rules/linter/hallucinations.d.ts +34 -0
- package/dist/rules/linter/hallucinations.d.ts.map +1 -0
- package/dist/rules/linter/hallucinations.js +334 -0
- package/dist/rules/linter/hallucinations.js.map +1 -0
- package/dist/rules/linter/linter.d.ts +84 -0
- package/dist/rules/linter/linter.d.ts.map +1 -0
- package/dist/rules/linter/linter.js +784 -0
- package/dist/rules/linter/linter.js.map +1 -0
- package/dist/rules/modules/resolver-browser.d.ts +41 -0
- package/dist/rules/modules/resolver-browser.d.ts.map +1 -0
- package/dist/rules/modules/resolver-browser.js +63 -0
- package/dist/rules/modules/resolver-browser.js.map +1 -0
- package/dist/rules/modules/resolver-core.d.ts +51 -0
- package/dist/rules/modules/resolver-core.d.ts.map +1 -0
- package/dist/rules/modules/resolver-core.js +338 -0
- package/dist/rules/modules/resolver-core.js.map +1 -0
- package/dist/rules/modules/resolver.d.ts +17 -0
- package/dist/rules/modules/resolver.d.ts.map +1 -0
- package/dist/rules/modules/resolver.js +49 -0
- package/dist/rules/modules/resolver.js.map +1 -0
- package/dist/rules/modules/stdlib/atomic.rules +52 -0
- package/dist/rules/modules/stdlib/atomic.test.json +152 -0
- package/dist/rules/modules/stdlib/auth.rules +7 -0
- package/dist/rules/modules/stdlib/auth.test.json +53 -0
- package/dist/rules/modules/stdlib/content.rules +50 -0
- package/dist/rules/modules/stdlib/content.test.json +238 -0
- package/dist/rules/modules/stdlib/counters.rules +41 -0
- package/dist/rules/modules/stdlib/counters.test.json +254 -0
- package/dist/rules/modules/stdlib/geometry.rules +43 -0
- package/dist/rules/modules/stdlib/geometry.test.json +200 -0
- package/dist/rules/modules/stdlib/joining.rules +49 -0
- package/dist/rules/modules/stdlib/joining.test.json +287 -0
- package/dist/rules/modules/stdlib/lifecycle.rules +51 -0
- package/dist/rules/modules/stdlib/lifecycle.test.json +288 -0
- package/dist/rules/modules/stdlib/lobby.rules +44 -0
- package/dist/rules/modules/stdlib/lobby.test.json +32 -0
- package/dist/rules/modules/stdlib/membership.rules +40 -0
- package/dist/rules/modules/stdlib/membership.test.json +107 -0
- package/dist/rules/modules/stdlib/spaces.rules +46 -0
- package/dist/rules/modules/stdlib/spaces.test.json +392 -0
- package/dist/rules/modules/stdlib/state.rules +28 -0
- package/dist/rules/modules/stdlib/state.test.json +55 -0
- package/dist/rules/modules/stdlib/timing.rules +20 -0
- package/dist/rules/modules/stdlib/timing.test.json +106 -0
- package/dist/rules/modules/stdlib/transitions.rules +34 -0
- package/dist/rules/modules/stdlib/transitions.test.json +86 -0
- package/dist/rules/modules/stdlib/turns.rules +27 -0
- package/dist/rules/modules/stdlib/turns.test.json +64 -0
- package/dist/rules/modules/stdlib/validation.rules +31 -0
- package/dist/rules/modules/stdlib/validation.test.json +184 -0
- package/dist/rules/modules/stdlib-content.d.ts +11 -0
- package/dist/rules/modules/stdlib-content.d.ts.map +1 -0
- package/dist/rules/modules/stdlib-content.js +590 -0
- package/dist/rules/modules/stdlib-content.js.map +1 -0
- package/dist/rules/node.d.ts +17 -0
- package/dist/rules/node.d.ts.map +1 -0
- package/dist/rules/node.js +21 -0
- package/dist/rules/node.js.map +1 -0
- package/dist/rules/rtdb.d.ts +28 -0
- package/dist/rules/rtdb.d.ts.map +1 -0
- package/dist/rules/rtdb.js +15 -0
- package/dist/rules/rtdb.js.map +1 -0
- package/dist/rules/simulator/evaluator.d.ts +179 -0
- package/dist/rules/simulator/evaluator.d.ts.map +1 -0
- package/dist/rules/simulator/evaluator.js +1221 -0
- package/dist/rules/simulator/evaluator.js.map +1 -0
- package/dist/rules/simulator/expression/eval-errors.d.ts +86 -0
- package/dist/rules/simulator/expression/eval-errors.d.ts.map +1 -0
- package/dist/rules/simulator/expression/eval-errors.js +68 -0
- package/dist/rules/simulator/expression/eval-errors.js.map +1 -0
- package/dist/rules/simulator/expression/evaluator.d.ts +43 -0
- package/dist/rules/simulator/expression/evaluator.d.ts.map +1 -0
- package/dist/rules/simulator/expression/evaluator.js +298 -0
- package/dist/rules/simulator/expression/evaluator.js.map +1 -0
- package/dist/rules/simulator/expression/lexer.d.ts +36 -0
- package/dist/rules/simulator/expression/lexer.d.ts.map +1 -0
- package/dist/rules/simulator/expression/lexer.js +318 -0
- package/dist/rules/simulator/expression/lexer.js.map +1 -0
- package/dist/rules/simulator/expression/parser.d.ts +39 -0
- package/dist/rules/simulator/expression/parser.d.ts.map +1 -0
- package/dist/rules/simulator/expression/parser.js +329 -0
- package/dist/rules/simulator/expression/parser.js.map +1 -0
- package/dist/rules/simulator/expression/types.d.ts +137 -0
- package/dist/rules/simulator/expression/types.d.ts.map +1 -0
- package/dist/rules/simulator/expression/types.js +90 -0
- package/dist/rules/simulator/expression/types.js.map +1 -0
- package/dist/rules/simulator/expression/walk-data.d.ts +52 -0
- package/dist/rules/simulator/expression/walk-data.d.ts.map +1 -0
- package/dist/rules/simulator/expression/walk-data.js +167 -0
- package/dist/rules/simulator/expression/walk-data.js.map +1 -0
- package/dist/rules/simulator/firestore-set.d.ts +25 -0
- package/dist/rules/simulator/firestore-set.d.ts.map +1 -0
- package/dist/rules/simulator/firestore-set.js +89 -0
- package/dist/rules/simulator/firestore-set.js.map +1 -0
- package/dist/rules/simulator/handler.d.ts +36 -0
- package/dist/rules/simulator/handler.d.ts.map +1 -0
- package/dist/rules/simulator/handler.js +583 -0
- package/dist/rules/simulator/handler.js.map +1 -0
- package/dist/rules/simulator/mapdiff.d.ts +29 -0
- package/dist/rules/simulator/mapdiff.d.ts.map +1 -0
- package/dist/rules/simulator/mapdiff.js +72 -0
- package/dist/rules/simulator/mapdiff.js.map +1 -0
- package/dist/rules/simulator/project-after-state.d.ts +33 -0
- package/dist/rules/simulator/project-after-state.d.ts.map +1 -0
- package/dist/rules/simulator/project-after-state.js +88 -0
- package/dist/rules/simulator/project-after-state.js.map +1 -0
- package/dist/rules/simulator/query-proof.d.ts +80 -0
- package/dist/rules/simulator/query-proof.d.ts.map +1 -0
- package/dist/rules/simulator/query-proof.js +142 -0
- package/dist/rules/simulator/query-proof.js.map +1 -0
- package/dist/rules/simulator/value-equality.d.ts +8 -0
- package/dist/rules/simulator/value-equality.d.ts.map +1 -0
- package/dist/rules/simulator/value-equality.js +40 -0
- package/dist/rules/simulator/value-equality.js.map +1 -0
- package/dist/rules/simulator/wrappers/base.d.ts +129 -0
- package/dist/rules/simulator/wrappers/base.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/base.js +90 -0
- package/dist/rules/simulator/wrappers/base.js.map +1 -0
- package/dist/rules/simulator/wrappers/bytes.d.ts +45 -0
- package/dist/rules/simulator/wrappers/bytes.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/bytes.js +130 -0
- package/dist/rules/simulator/wrappers/bytes.js.map +1 -0
- package/dist/rules/simulator/wrappers/duration.d.ts +76 -0
- package/dist/rules/simulator/wrappers/duration.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/duration.js +176 -0
- package/dist/rules/simulator/wrappers/duration.js.map +1 -0
- package/dist/rules/simulator/wrappers/float.d.ts +52 -0
- package/dist/rules/simulator/wrappers/float.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/float.js +88 -0
- package/dist/rules/simulator/wrappers/float.js.map +1 -0
- package/dist/rules/simulator/wrappers/latlng.d.ts +40 -0
- package/dist/rules/simulator/wrappers/latlng.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/latlng.js +100 -0
- package/dist/rules/simulator/wrappers/latlng.js.map +1 -0
- package/dist/rules/simulator/wrappers/path.d.ts +75 -0
- package/dist/rules/simulator/wrappers/path.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/path.js +158 -0
- package/dist/rules/simulator/wrappers/path.js.map +1 -0
- package/dist/rules/simulator/wrappers/reference.d.ts +82 -0
- package/dist/rules/simulator/wrappers/reference.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/reference.js +145 -0
- package/dist/rules/simulator/wrappers/reference.js.map +1 -0
- package/dist/rules/simulator/wrappers/timestamp.d.ts +86 -0
- package/dist/rules/simulator/wrappers/timestamp.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/timestamp.js +207 -0
- package/dist/rules/simulator/wrappers/timestamp.js.map +1 -0
- package/dist/rules/simulator/wrappers/vector.d.ts +43 -0
- package/dist/rules/simulator/wrappers/vector.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/vector.js +80 -0
- package/dist/rules/simulator/wrappers/vector.js.map +1 -0
- package/dist/rules/simulator-tools-impl.d.ts +64 -0
- package/dist/rules/simulator-tools-impl.d.ts.map +1 -0
- package/dist/rules/simulator-tools-impl.js +462 -0
- package/dist/rules/simulator-tools-impl.js.map +1 -0
- package/dist/rules/simulator.d.ts +20 -0
- package/dist/rules/simulator.d.ts.map +1 -0
- package/dist/rules/simulator.js +24 -0
- package/dist/rules/simulator.js.map +1 -0
- package/dist/rules/stdlib-modules.d.ts +73 -0
- package/dist/rules/stdlib-modules.d.ts.map +1 -0
- package/dist/rules/stdlib-modules.js +849 -0
- package/dist/rules/stdlib-modules.js.map +1 -0
- package/dist/rules/stdlib-tools.d.ts +19 -0
- package/dist/rules/stdlib-tools.d.ts.map +1 -0
- package/dist/rules/stdlib-tools.js +164 -0
- package/dist/rules/stdlib-tools.js.map +1 -0
- package/dist/rules/test/handler.d.ts +9 -0
- package/dist/rules/test/handler.d.ts.map +1 -0
- package/dist/rules/test/handler.js +124 -0
- package/dist/rules/test/handler.js.map +1 -0
- package/dist/rules/test/spec.d.ts +517 -0
- package/dist/rules/test/spec.d.ts.map +1 -0
- package/dist/rules/test/spec.js +227 -0
- package/dist/rules/test/spec.js.map +1 -0
- package/dist/rules/tools.d.ts +41 -0
- package/dist/rules/tools.d.ts.map +1 -0
- package/dist/rules/tools.js +124 -0
- package/dist/rules/tools.js.map +1 -0
- package/dist/rules/write/handler.d.ts +6 -0
- package/dist/rules/write/handler.d.ts.map +1 -0
- package/dist/rules/write/handler.js +126 -0
- package/dist/rules/write/handler.js.map +1 -0
- package/dist/rules/write/spec.d.ts +28 -0
- package/dist/rules/write/spec.d.ts.map +1 -0
- package/dist/rules/write/spec.js +2 -0
- package/dist/rules/write/spec.js.map +1 -0
- package/dist/sandbox/admin-compat.d.ts +20 -0
- package/dist/sandbox/admin-compat.d.ts.map +1 -0
- package/dist/sandbox/admin-compat.js +19 -0
- package/dist/sandbox/admin-compat.js.map +1 -0
- package/dist/sandbox/admin-firestore/error-translation.d.ts +86 -0
- package/dist/sandbox/admin-firestore/error-translation.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/error-translation.js +204 -0
- package/dist/sandbox/admin-firestore/error-translation.js.map +1 -0
- package/dist/sandbox/admin-firestore/index.d.ts +169 -0
- package/dist/sandbox/admin-firestore/index.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/index.js +456 -0
- package/dist/sandbox/admin-firestore/index.js.map +1 -0
- package/dist/sandbox/admin-firestore/remote.d.ts +97 -0
- package/dist/sandbox/admin-firestore/remote.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/remote.js +735 -0
- package/dist/sandbox/admin-firestore/remote.js.map +1 -0
- package/dist/sandbox/branches/index.d.ts +141 -0
- package/dist/sandbox/branches/index.d.ts.map +1 -0
- package/dist/sandbox/branches/index.js +327 -0
- package/dist/sandbox/branches/index.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/batch.d.ts +34 -0
- package/dist/sandbox/firestore/admin-compat/batch.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/batch.js +73 -0
- package/dist/sandbox/firestore/admin-compat/batch.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/doc-ref.d.ts +38 -0
- package/dist/sandbox/firestore/admin-compat/doc-ref.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/doc-ref.js +154 -0
- package/dist/sandbox/firestore/admin-compat/doc-ref.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/firestore.d.ts +45 -0
- package/dist/sandbox/firestore/admin-compat/firestore.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/firestore.js +114 -0
- package/dist/sandbox/firestore/admin-compat/firestore.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/index.d.ts +45 -0
- package/dist/sandbox/firestore/admin-compat/index.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/index.js +27 -0
- package/dist/sandbox/firestore/admin-compat/index.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/paths.d.ts +37 -0
- package/dist/sandbox/firestore/admin-compat/paths.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/paths.js +49 -0
- package/dist/sandbox/firestore/admin-compat/paths.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/query.d.ts +261 -0
- package/dist/sandbox/firestore/admin-compat/query.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/query.js +704 -0
- package/dist/sandbox/firestore/admin-compat/query.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/read-translation.d.ts +8 -0
- package/dist/sandbox/firestore/admin-compat/read-translation.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/read-translation.js +59 -0
- package/dist/sandbox/firestore/admin-compat/read-translation.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/snapshots.d.ts +39 -0
- package/dist/sandbox/firestore/admin-compat/snapshots.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/snapshots.js +50 -0
- package/dist/sandbox/firestore/admin-compat/snapshots.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/transaction.d.ts +35 -0
- package/dist/sandbox/firestore/admin-compat/transaction.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/transaction.js +88 -0
- package/dist/sandbox/firestore/admin-compat/transaction.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/types.d.ts +297 -0
- package/dist/sandbox/firestore/admin-compat/types.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/types.js +127 -0
- package/dist/sandbox/firestore/admin-compat/types.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/value-order.d.ts +49 -0
- package/dist/sandbox/firestore/admin-compat/value-order.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/value-order.js +172 -0
- package/dist/sandbox/firestore/admin-compat/value-order.js.map +1 -0
- package/dist/sandbox/firestore/auto-id.d.ts +26 -0
- package/dist/sandbox/firestore/auto-id.d.ts.map +1 -0
- package/dist/sandbox/firestore/auto-id.js +36 -0
- package/dist/sandbox/firestore/auto-id.js.map +1 -0
- package/dist/sandbox/firestore/converters/bytes-geopoint.d.ts +48 -0
- package/dist/sandbox/firestore/converters/bytes-geopoint.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/bytes-geopoint.js +85 -0
- package/dist/sandbox/firestore/converters/bytes-geopoint.js.map +1 -0
- package/dist/sandbox/firestore/converters/fieldvalue.d.ts +69 -0
- package/dist/sandbox/firestore/converters/fieldvalue.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/fieldvalue.js +166 -0
- package/dist/sandbox/firestore/converters/fieldvalue.js.map +1 -0
- package/dist/sandbox/firestore/converters/reference.d.ts +31 -0
- package/dist/sandbox/firestore/converters/reference.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/reference.js +51 -0
- package/dist/sandbox/firestore/converters/reference.js.map +1 -0
- package/dist/sandbox/firestore/converters/timestamp.d.ts +32 -0
- package/dist/sandbox/firestore/converters/timestamp.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/timestamp.js +63 -0
- package/dist/sandbox/firestore/converters/timestamp.js.map +1 -0
- package/dist/sandbox/firestore/converters/user-timestamp.d.ts +46 -0
- package/dist/sandbox/firestore/converters/user-timestamp.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/user-timestamp.js +65 -0
- package/dist/sandbox/firestore/converters/user-timestamp.js.map +1 -0
- package/dist/sandbox/firestore/converters/vector.d.ts +24 -0
- package/dist/sandbox/firestore/converters/vector.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/vector.js +53 -0
- package/dist/sandbox/firestore/converters/vector.js.map +1 -0
- package/dist/sandbox/firestore/errors.d.ts +82 -0
- package/dist/sandbox/firestore/errors.d.ts.map +1 -0
- package/dist/sandbox/firestore/errors.js +54 -0
- package/dist/sandbox/firestore/errors.js.map +1 -0
- package/dist/sandbox/firestore/event-log.d.ts +99 -0
- package/dist/sandbox/firestore/event-log.d.ts.map +1 -0
- package/dist/sandbox/firestore/event-log.js +67 -0
- package/dist/sandbox/firestore/event-log.js.map +1 -0
- package/dist/sandbox/firestore/field-merge.d.ts +64 -0
- package/dist/sandbox/firestore/field-merge.d.ts.map +1 -0
- package/dist/sandbox/firestore/field-merge.js +221 -0
- package/dist/sandbox/firestore/field-merge.js.map +1 -0
- package/dist/sandbox/firestore/list-query-proof.d.ts +77 -0
- package/dist/sandbox/firestore/list-query-proof.d.ts.map +1 -0
- package/dist/sandbox/firestore/list-query-proof.js +170 -0
- package/dist/sandbox/firestore/list-query-proof.js.map +1 -0
- package/dist/sandbox/firestore/local-environment.d.ts +806 -0
- package/dist/sandbox/firestore/local-environment.d.ts.map +1 -0
- package/dist/sandbox/firestore/local-environment.js +3028 -0
- package/dist/sandbox/firestore/local-environment.js.map +1 -0
- package/dist/sandbox/firestore/local-state.d.ts +196 -0
- package/dist/sandbox/firestore/local-state.d.ts.map +1 -0
- package/dist/sandbox/firestore/local-state.js +413 -0
- package/dist/sandbox/firestore/local-state.js.map +1 -0
- package/dist/sandbox/firestore/overlay-backing.d.ts +44 -0
- package/dist/sandbox/firestore/overlay-backing.d.ts.map +1 -0
- package/dist/sandbox/firestore/overlay-backing.js +82 -0
- package/dist/sandbox/firestore/overlay-backing.js.map +1 -0
- package/dist/sandbox/firestore/sentinel-capture.d.ts +30 -0
- package/dist/sandbox/firestore/sentinel-capture.d.ts.map +1 -0
- package/dist/sandbox/firestore/sentinel-capture.js +61 -0
- package/dist/sandbox/firestore/sentinel-capture.js.map +1 -0
- package/dist/sandbox/firestore/snapshot-listeners.d.ts +284 -0
- package/dist/sandbox/firestore/snapshot-listeners.d.ts.map +1 -0
- package/dist/sandbox/firestore/snapshot-listeners.js +194 -0
- package/dist/sandbox/firestore/snapshot-listeners.js.map +1 -0
- package/dist/sandbox/firestore/topk.d.ts +12 -0
- package/dist/sandbox/firestore/topk.d.ts.map +1 -0
- package/dist/sandbox/firestore/topk.js +42 -0
- package/dist/sandbox/firestore/topk.js.map +1 -0
- package/dist/sandbox/firestore/transaction-merge.d.ts +55 -0
- package/dist/sandbox/firestore/transaction-merge.d.ts.map +1 -0
- package/dist/sandbox/firestore/transaction-merge.js +107 -0
- package/dist/sandbox/firestore/transaction-merge.js.map +1 -0
- package/dist/sandbox/firestore/transaction-types.d.ts +152 -0
- package/dist/sandbox/firestore/transaction-types.d.ts.map +1 -0
- package/dist/sandbox/firestore/transaction-types.js +10 -0
- package/dist/sandbox/firestore/transaction-types.js.map +1 -0
- package/dist/sandbox/firestore/transaction.d.ts +79 -0
- package/dist/sandbox/firestore/transaction.d.ts.map +1 -0
- package/dist/sandbox/firestore/transaction.js +95 -0
- package/dist/sandbox/firestore/transaction.js.map +1 -0
- package/dist/sandbox/firestore/value-equality.d.ts +2 -0
- package/dist/sandbox/firestore/value-equality.d.ts.map +1 -0
- package/dist/sandbox/firestore/value-equality.js +35 -0
- package/dist/sandbox/firestore/value-equality.js.map +1 -0
- package/dist/sandbox/firestore/value-resolver.d.ts +172 -0
- package/dist/sandbox/firestore/value-resolver.d.ts.map +1 -0
- package/dist/sandbox/firestore/value-resolver.js +221 -0
- package/dist/sandbox/firestore/value-resolver.js.map +1 -0
- package/dist/sandbox/firestore/wire-encoder.d.ts +14 -0
- package/dist/sandbox/firestore/wire-encoder.d.ts.map +1 -0
- package/dist/sandbox/firestore/wire-encoder.js +130 -0
- package/dist/sandbox/firestore/wire-encoder.js.map +1 -0
- package/dist/sandbox/index.d.ts +50 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/index.js +63 -0
- package/dist/sandbox/index.js.map +1 -0
- package/dist/sandbox/internal/index.d.ts +36 -0
- package/dist/sandbox/internal/index.d.ts.map +1 -0
- package/dist/sandbox/internal/index.js +72 -0
- package/dist/sandbox/internal/index.js.map +1 -0
- package/dist/sandbox/internal/sandbox-impl.d.ts +343 -0
- package/dist/sandbox/internal/sandbox-impl.d.ts.map +1 -0
- package/dist/sandbox/internal/sandbox-impl.js +718 -0
- package/dist/sandbox/internal/sandbox-impl.js.map +1 -0
- package/dist/sandbox/persistence/backends.d.ts +37 -0
- package/dist/sandbox/persistence/backends.d.ts.map +1 -0
- package/dist/sandbox/persistence/backends.js +202 -0
- package/dist/sandbox/persistence/backends.js.map +1 -0
- package/dist/sandbox/persistence/chunk-format.d.ts +58 -0
- package/dist/sandbox/persistence/chunk-format.d.ts.map +1 -0
- package/dist/sandbox/persistence/chunk-format.js +163 -0
- package/dist/sandbox/persistence/chunk-format.js.map +1 -0
- package/dist/sandbox/persistence/controller.d.ts +39 -0
- package/dist/sandbox/persistence/controller.d.ts.map +1 -0
- package/dist/sandbox/persistence/controller.js +605 -0
- package/dist/sandbox/persistence/controller.js.map +1 -0
- package/dist/sandbox/persistence/index.d.ts +13 -0
- package/dist/sandbox/persistence/index.d.ts.map +1 -0
- package/dist/sandbox/persistence/index.js +5 -0
- package/dist/sandbox/persistence/index.js.map +1 -0
- package/dist/sandbox/persistence/serialize.d.ts +53 -0
- package/dist/sandbox/persistence/serialize.d.ts.map +1 -0
- package/dist/sandbox/persistence/serialize.js +98 -0
- package/dist/sandbox/persistence/serialize.js.map +1 -0
- package/dist/sandbox/persistence/types.d.ts +118 -0
- package/dist/sandbox/persistence/types.d.ts.map +1 -0
- package/dist/sandbox/persistence/types.js +15 -0
- package/dist/sandbox/persistence/types.js.map +1 -0
- package/dist/sandbox/remote.d.ts +118 -0
- package/dist/sandbox/remote.d.ts.map +1 -0
- package/dist/sandbox/remote.js +60 -0
- package/dist/sandbox/remote.js.map +1 -0
- package/dist/sandbox/replay/index.d.ts +106 -0
- package/dist/sandbox/replay/index.d.ts.map +1 -0
- package/dist/sandbox/replay/index.js +246 -0
- package/dist/sandbox/replay/index.js.map +1 -0
- package/dist/sandbox/sandbox-context.d.ts +40 -0
- package/dist/sandbox/sandbox-context.d.ts.map +1 -0
- package/dist/sandbox/sandbox-context.js +72 -0
- package/dist/sandbox/sandbox-context.js.map +1 -0
- package/dist/sandbox/tab-sync/index.d.ts +120 -0
- package/dist/sandbox/tab-sync/index.d.ts.map +1 -0
- package/dist/sandbox/tab-sync/index.js +272 -0
- package/dist/sandbox/tab-sync/index.js.map +1 -0
- package/dist/sandbox/types.d.ts +1235 -0
- package/dist/sandbox/types.d.ts.map +1 -0
- package/dist/sandbox/types.js +46 -0
- package/dist/sandbox/types.js.map +1 -0
- package/dist/storage/admin/api.d.ts +206 -0
- package/dist/storage/admin/api.d.ts.map +1 -0
- package/dist/storage/admin/api.js +349 -0
- package/dist/storage/admin/api.js.map +1 -0
- package/dist/storage/admin/handler.d.ts +29 -0
- package/dist/storage/admin/handler.d.ts.map +1 -0
- package/dist/storage/admin/handler.js +82 -0
- package/dist/storage/admin/handler.js.map +1 -0
- package/dist/storage/admin/spec.d.ts +64 -0
- package/dist/storage/admin/spec.d.ts.map +1 -0
- package/dist/storage/admin/spec.js +8 -0
- package/dist/storage/admin/spec.js.map +1 -0
- package/dist/storage/admin/tools.d.ts +23 -0
- package/dist/storage/admin/tools.d.ts.map +1 -0
- package/dist/storage/admin/tools.js +90 -0
- package/dist/storage/admin/tools.js.map +1 -0
- package/dist/storage/download.d.ts +27 -0
- package/dist/storage/download.d.ts.map +1 -0
- package/dist/storage/download.js +136 -0
- package/dist/storage/download.js.map +1 -0
- package/dist/storage/enforce.d.ts +26 -0
- package/dist/storage/enforce.d.ts.map +1 -0
- package/dist/storage/enforce.js +16 -0
- package/dist/storage/enforce.js.map +1 -0
- package/dist/storage/errors.d.ts +46 -0
- package/dist/storage/errors.d.ts.map +1 -0
- package/dist/storage/errors.js +62 -0
- package/dist/storage/errors.js.map +1 -0
- package/dist/storage/index.d.ts +49 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +60 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/internal.d.ts +18 -0
- package/dist/storage/internal.d.ts.map +1 -0
- package/dist/storage/internal.js +18 -0
- package/dist/storage/internal.js.map +1 -0
- package/dist/storage/list.d.ts +17 -0
- package/dist/storage/list.d.ts.map +1 -0
- package/dist/storage/list.js +91 -0
- package/dist/storage/list.js.map +1 -0
- package/dist/storage/metadata.d.ts +86 -0
- package/dist/storage/metadata.d.ts.map +1 -0
- package/dist/storage/metadata.js +167 -0
- package/dist/storage/metadata.js.map +1 -0
- package/dist/storage/persistence.d.ts +134 -0
- package/dist/storage/persistence.d.ts.map +1 -0
- package/dist/storage/persistence.js +132 -0
- package/dist/storage/persistence.js.map +1 -0
- package/dist/storage/reference.d.ts +63 -0
- package/dist/storage/reference.d.ts.map +1 -0
- package/dist/storage/reference.js +156 -0
- package/dist/storage/reference.js.map +1 -0
- package/dist/storage/rules.d.ts +176 -0
- package/dist/storage/rules.d.ts.map +1 -0
- package/dist/storage/rules.js +621 -0
- package/dist/storage/rules.js.map +1 -0
- package/dist/storage/service.d.ts +139 -0
- package/dist/storage/service.d.ts.map +1 -0
- package/dist/storage/service.js +241 -0
- package/dist/storage/service.js.map +1 -0
- package/dist/storage/upload.d.ts +43 -0
- package/dist/storage/upload.d.ts.map +1 -0
- package/dist/storage/upload.js +235 -0
- package/dist/storage/upload.js.map +1 -0
- package/package.json +110 -3
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `QueryImpl` + `CollectionRefImpl` — Admin-SDK-compat query / collection
|
|
3
|
+
* surfaces backed by `LocalEnvironment.listDocuments(...)`.
|
|
4
|
+
*
|
|
5
|
+
* Ported from bench's `pilot/src/firestore-wrapper.ts:277-353`.
|
|
6
|
+
*
|
|
7
|
+
* Filtering is done JS-side because `listDocuments` returns the full
|
|
8
|
+
* collection unfiltered. That's the simulator's contract — it's a
|
|
9
|
+
* read-once snapshot, not a query engine — so the wrapper does the
|
|
10
|
+
* `where`/`orderBy`/`limit` work in memory before yielding snapshots.
|
|
11
|
+
*
|
|
12
|
+
* Differences from the bench source:
|
|
13
|
+
* - Phantom parent docs (synthetic records the SDK injects for any
|
|
14
|
+
* parent path that has descendants but no own data; see
|
|
15
|
+
* `LocalEnvironment.listDocuments` JSDoc) are filtered OUT before
|
|
16
|
+
* query results are returned. Phantom docs are a discover-crawler
|
|
17
|
+
* affordance, not a query result — production Firestore would not
|
|
18
|
+
* surface them in a `collection().get()` either.
|
|
19
|
+
* - `compareValues` and `matchesWhere` use typed narrowing rather
|
|
20
|
+
* than the bench's `as any` coercion. Same end result for
|
|
21
|
+
* number/string/boolean/bigint fields (the only types the corpus
|
|
22
|
+
* exercises today, per the design-doc inventory) and a deterministic
|
|
23
|
+
* fallback (`String(...)` comparison) for cross-type cases.
|
|
24
|
+
* - `firestoreValuesEqual` keeps query value matching aligned with
|
|
25
|
+
* transform dedupe and Firestore value wrappers.
|
|
26
|
+
*
|
|
27
|
+
* Circular import note: `doc-ref.ts` imports `CollectionRefImpl` for
|
|
28
|
+
* `.parent` / `.collection(name)`; this file imports `DocumentRefImpl`
|
|
29
|
+
* for `CollectionRefImpl.doc()` and `QueryImpl.get()`. Both references
|
|
30
|
+
* sit inside method bodies (not class evaluation), so ESM's deferred
|
|
31
|
+
* binding resolves them correctly — no lazy-load machinery needed.
|
|
32
|
+
*/
|
|
33
|
+
import { generateAutoId } from 'pyric/sandbox/internal';
|
|
34
|
+
import { lastSegment } from './paths.js';
|
|
35
|
+
import { translateReadData } from './snapshots.js';
|
|
36
|
+
import { DocumentRefImpl } from './doc-ref.js';
|
|
37
|
+
// Canonical Firestore value comparison (FS-B3) — type-order-aware,
|
|
38
|
+
// NaN-correct. Replaces the old `String().localeCompare` fallback that
|
|
39
|
+
// mis-ordered cross-type values + broke NaN. See `value-order.ts`.
|
|
40
|
+
import { compareValues, typeOrderRank } from './value-order.js';
|
|
41
|
+
import { topK } from '../topk.js';
|
|
42
|
+
import { firestoreValuesEqual } from '../value-equality.js';
|
|
43
|
+
import { FirestoreCompatError, } from './types.js';
|
|
44
|
+
// FS-B8 — the document-key sentinel field. Firestore normalizes every
|
|
45
|
+
// query's sort to include an implicit final ordering on the document key
|
|
46
|
+
// (`__name__`) so equal-valued docs have a deterministic order and cursors
|
|
47
|
+
// can disambiguate them. We model the key value as a reference-like
|
|
48
|
+
// `{ path }` so the canonical `compareValues` reference branch orders it.
|
|
49
|
+
const KEY_FIELD = '__name__';
|
|
50
|
+
/** Operators that make a `where` clause an inequality filter — these imply
|
|
51
|
+
* an orderBy on the filtered field (mirrors `getInequalityFilterFields`). */
|
|
52
|
+
const INEQUALITY_OPS = new Set([
|
|
53
|
+
'<', '<=', '>', '>=', '!=', 'not-in',
|
|
54
|
+
]);
|
|
55
|
+
/** Read the order value for a row at `field`. `__name__` resolves to a
|
|
56
|
+
* reference-like keyed on the document path so `compareValues` orders it
|
|
57
|
+
* via its reference branch; all other fields read from the doc data. */
|
|
58
|
+
function orderValue(row, field) {
|
|
59
|
+
return field === KEY_FIELD ? { path: row.path } : row.data[field];
|
|
60
|
+
}
|
|
61
|
+
/** The set of fields a filter constrains with an inequality operator —
|
|
62
|
+
* recurses through composite AND/OR filters. Mirrors upstream
|
|
63
|
+
* `getInequalityFilterFields`. */
|
|
64
|
+
function inequalityFields(filter) {
|
|
65
|
+
if (filter.kind === 'where') {
|
|
66
|
+
return INEQUALITY_OPS.has(filter.op) ? [filter.field] : [];
|
|
67
|
+
}
|
|
68
|
+
// 'and' / 'or' — gather from sub-filters.
|
|
69
|
+
return filter.filters.flatMap(inequalityFields);
|
|
70
|
+
}
|
|
71
|
+
/** True when a filter (possibly composite) carries any inequality op. */
|
|
72
|
+
function hasInequality(filter) {
|
|
73
|
+
return inequalityFields(filter).length > 0;
|
|
74
|
+
}
|
|
75
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
76
|
+
// Range comparators (FS-B3) — canonical, type-order-aware.
|
|
77
|
+
//
|
|
78
|
+
// Firestore range filters (`<` `<=` `>` `>=`) only match values of the
|
|
79
|
+
// SAME canonical type as the operand (a `>` 5 never matches a string),
|
|
80
|
+
// so the comparators short-circuit to `false` across type ranks and
|
|
81
|
+
// delegate within-type to the canonical `compareValues`. This replaces
|
|
82
|
+
// the old `String(a) < String(b)` cross-type fallback that produced
|
|
83
|
+
// lexicographic nonsense for timestamps/numbers and broke NaN.
|
|
84
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
85
|
+
/** True when `a` and `b` share a canonical type rank (and so are
|
|
86
|
+
* range-comparable). NaN is a number for ranking but Firestore's
|
|
87
|
+
* inequality filters never match NaN — guarded by the callers. */
|
|
88
|
+
function sameType(a, b) {
|
|
89
|
+
return typeOrderRank(a) === typeOrderRank(b);
|
|
90
|
+
}
|
|
91
|
+
function lessThan(a, b) {
|
|
92
|
+
return sameType(a, b) && compareValues(a, b) < 0;
|
|
93
|
+
}
|
|
94
|
+
function lessOrEqual(a, b) {
|
|
95
|
+
return sameType(a, b) && compareValues(a, b) <= 0;
|
|
96
|
+
}
|
|
97
|
+
function greaterThan(a, b) {
|
|
98
|
+
return sameType(a, b) && compareValues(a, b) > 0;
|
|
99
|
+
}
|
|
100
|
+
function greaterOrEqual(a, b) {
|
|
101
|
+
return sameType(a, b) && compareValues(a, b) >= 0;
|
|
102
|
+
}
|
|
103
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
104
|
+
// Where / order / limit application.
|
|
105
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
106
|
+
function matchesWhere(value, op, target) {
|
|
107
|
+
// FS-B7 — a missing field (value === undefined) never matches any
|
|
108
|
+
// filter except via the existence rules below; mirrors upstream
|
|
109
|
+
// `FieldFilter.matches`, where `doc.data.field(...) === null` (absent)
|
|
110
|
+
// short-circuits every operator to false.
|
|
111
|
+
const present = value !== undefined;
|
|
112
|
+
switch (op) {
|
|
113
|
+
case '==': return present && firestoreValuesEqual(value, target);
|
|
114
|
+
case '!=':
|
|
115
|
+
// != requires the field to EXIST and be non-null, then differ.
|
|
116
|
+
// (clones/.../core/filter.ts FieldFilter.matches NOT_EQUAL branch.)
|
|
117
|
+
return present && value !== null && !firestoreValuesEqual(value, target);
|
|
118
|
+
case '<': return present && lessThan(value, target);
|
|
119
|
+
case '<=': return present && lessOrEqual(value, target);
|
|
120
|
+
case '>': return present && greaterThan(value, target);
|
|
121
|
+
case '>=': return present && greaterOrEqual(value, target);
|
|
122
|
+
case 'in':
|
|
123
|
+
return present && Array.isArray(target) && target.some((t) => firestoreValuesEqual(value, t));
|
|
124
|
+
case 'not-in':
|
|
125
|
+
// not-in requires existence + non-null; a null in the operand list
|
|
126
|
+
// makes the filter match nothing (clones/.../core/filter.ts
|
|
127
|
+
// NotInFilter.matches). Field must also not equal any operand.
|
|
128
|
+
if (!Array.isArray(target))
|
|
129
|
+
return false;
|
|
130
|
+
if (target.some((t) => t === null))
|
|
131
|
+
return false;
|
|
132
|
+
return present && value !== null && !target.some((t) => firestoreValuesEqual(value, t));
|
|
133
|
+
case 'array-contains':
|
|
134
|
+
return Array.isArray(value) && value.some((v) => firestoreValuesEqual(v, target));
|
|
135
|
+
case 'array-contains-any':
|
|
136
|
+
return Array.isArray(value)
|
|
137
|
+
&& Array.isArray(target)
|
|
138
|
+
&& target.some((t) => value.some((v) => firestoreValuesEqual(v, t)));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Recursive filter evaluator. `where` leaves call into the existing
|
|
143
|
+
* scalar-op matcher; AND / OR composite filters short-circuit
|
|
144
|
+
* across their sub-filter list.
|
|
145
|
+
*/
|
|
146
|
+
function matchesFilter(data, filter) {
|
|
147
|
+
if (filter.kind === 'where') {
|
|
148
|
+
return matchesWhere(data[filter.field], filter.op, filter.value);
|
|
149
|
+
}
|
|
150
|
+
if (filter.kind === 'and') {
|
|
151
|
+
return filter.filters.every((sub) => matchesFilter(data, sub));
|
|
152
|
+
}
|
|
153
|
+
// 'or'
|
|
154
|
+
return filter.filters.some((sub) => matchesFilter(data, sub));
|
|
155
|
+
}
|
|
156
|
+
function applyFilters(docs, filters) {
|
|
157
|
+
return docs.filter((d) => filters.every((f) => matchesFilter(d.data, f)));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Pull the cursor values out of a `DocumentSnapshot` at the query's
|
|
161
|
+
* orderBy fields. Backs the `startCursorFromSnapshot` /
|
|
162
|
+
* `endCursorFromSnapshot` overload that mirrors the JS SDK's
|
|
163
|
+
* `startAt(snapshot)` / `startAfter(snapshot)` / `endAt(snapshot)` /
|
|
164
|
+
* `endBefore(snapshot)`.
|
|
165
|
+
*
|
|
166
|
+
* Throws when the query has no `orderBy` clauses — production
|
|
167
|
+
* raises the same precondition. The snapshot's `.data()` is read
|
|
168
|
+
* once and indexed positionally for each clause.
|
|
169
|
+
*/
|
|
170
|
+
function cursorValuesFromSnapshot(snapshot, orders) {
|
|
171
|
+
const data = snapshot.data();
|
|
172
|
+
if (data === undefined) {
|
|
173
|
+
// FS-B16 — carry a FirestoreError `.code`. Prod raises `not-found`:
|
|
174
|
+
// "Can't use a DocumentSnapshot that doesn't exist for …()."
|
|
175
|
+
// (clones/.../lite-api/query.ts:newQueryBoundFromDocument).
|
|
176
|
+
throw new FirestoreCompatError({
|
|
177
|
+
code: 'not-found',
|
|
178
|
+
message: 'Snapshot-based cursors require an existing document — got an empty ' +
|
|
179
|
+
`snapshot for ${snapshot.id ?? '<unknown>'}.`,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
// FS-B8 — `orders` is the NORMALIZED sort (always carries the implicit
|
|
183
|
+
// `__name__` clause), so a `startAt(snapshot)` with no explicit orderBy
|
|
184
|
+
// is legal in prod: it positions on the document key. `__name__` reads
|
|
185
|
+
// the snapshot's ref path; data fields read positionally.
|
|
186
|
+
return orders.map((o) => o.field === KEY_FIELD ? { path: snapshot.ref.path } : data[o.field]);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Compare a row's ordered field values to a cursor's values in the
|
|
190
|
+
* direction of the orderBy clauses. Returns negative when the row
|
|
191
|
+
* precedes the cursor in ordered position, 0 on tie, positive when
|
|
192
|
+
* it follows. Lexicographic across `cursor.values.length` orderBy
|
|
193
|
+
* clauses — any tail of orderBy clauses beyond the cursor length is
|
|
194
|
+
* not consulted (matches production's "prefix cursor" semantics).
|
|
195
|
+
*/
|
|
196
|
+
function compareToCursor(row, cursorValues, orders) {
|
|
197
|
+
for (let i = 0; i < cursorValues.length; i++) {
|
|
198
|
+
const cmp = compareValues(orderValue(row, orders[i].field), cursorValues[i]);
|
|
199
|
+
if (cmp !== 0) {
|
|
200
|
+
return orders[i].direction === 'desc' ? -cmp : cmp;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return 0;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Slice `rows` to the portion of the ordering between (optionally)
|
|
207
|
+
* `start` and `end` cursors. `rows` must already be sorted per
|
|
208
|
+
* `orders`. Inclusive flags switch ≥ / > for start and ≤ / < for
|
|
209
|
+
* end.
|
|
210
|
+
*/
|
|
211
|
+
function applyCursors(rows, orders, start, end) {
|
|
212
|
+
return rows.filter((row) => {
|
|
213
|
+
if (start) {
|
|
214
|
+
const cmp = compareToCursor(row, start.values, orders);
|
|
215
|
+
if (start.inclusive ? cmp < 0 : cmp <= 0)
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
if (end) {
|
|
219
|
+
const cmp = compareToCursor(row, end.values, orders);
|
|
220
|
+
if (end.inclusive ? cmp > 0 : cmp >= 0)
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
return true;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
// FS-B3: Firestore excludes docs that are missing ANY orderBy field (an
|
|
227
|
+
// orderBy on a field implies the field must exist). Sorting them in with
|
|
228
|
+
// `compareValues(undefined, …)` would surface docs a production query never
|
|
229
|
+
// returns. `__name__` is always present (the doc key), so the implicit FS-B8
|
|
230
|
+
// key order never excludes a doc.
|
|
231
|
+
function orderPresent(docs, orders) {
|
|
232
|
+
return docs.filter((d) => orders.every((o) => o.field === KEY_FIELD || d.data[o.field] !== undefined));
|
|
233
|
+
}
|
|
234
|
+
/** The orderBy comparator over the (normalized) orders. Shared by the full sort
|
|
235
|
+
* and the top-k fast path so they are guaranteed identical. */
|
|
236
|
+
function orderComparator(orders) {
|
|
237
|
+
return (a, b) => {
|
|
238
|
+
for (const o of orders) {
|
|
239
|
+
const cmp = compareValues(orderValue(a, o.field), orderValue(b, o.field));
|
|
240
|
+
if (cmp !== 0)
|
|
241
|
+
return o.direction === 'desc' ? -cmp : cmp;
|
|
242
|
+
}
|
|
243
|
+
return 0;
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function applyOrder(docs, orders) {
|
|
247
|
+
if (orders.length === 0)
|
|
248
|
+
return docs;
|
|
249
|
+
return orderPresent(docs, orders).sort(orderComparator(orders));
|
|
250
|
+
}
|
|
251
|
+
export class QueryImpl {
|
|
252
|
+
env;
|
|
253
|
+
auth;
|
|
254
|
+
collectionPath;
|
|
255
|
+
clauses;
|
|
256
|
+
orders;
|
|
257
|
+
limitCount;
|
|
258
|
+
limitFromEnd;
|
|
259
|
+
start;
|
|
260
|
+
end;
|
|
261
|
+
bypassRules;
|
|
262
|
+
constructor(env, auth, collectionPath, clauses = [], orders = [], limitCount,
|
|
263
|
+
/**
|
|
264
|
+
* When true, the query was built via `limitToLast(n)`. The
|
|
265
|
+
* `applyConstraints` pipeline reverses each orderBy direction
|
|
266
|
+
* before slicing and re-reverses afterwards. Requires at least
|
|
267
|
+
* one `orderBy` clause (the runtime check fires in `get()` /
|
|
268
|
+
* `aggregate()`).
|
|
269
|
+
*/
|
|
270
|
+
limitFromEnd = false, start, end,
|
|
271
|
+
// Studio admin lens (Gap #2): stamped on the `list`/`get` reads this
|
|
272
|
+
// query issues so rule evaluation is skipped. Preserved across `clone`
|
|
273
|
+
// (so chained `.where`/`.orderBy`/etc keep the bypass) and through to
|
|
274
|
+
// the `DocumentReference`s `.get()` returns. Default false.
|
|
275
|
+
bypassRules = false) {
|
|
276
|
+
this.env = env;
|
|
277
|
+
this.auth = auth;
|
|
278
|
+
this.collectionPath = collectionPath;
|
|
279
|
+
this.clauses = clauses;
|
|
280
|
+
this.orders = orders;
|
|
281
|
+
this.limitCount = limitCount;
|
|
282
|
+
this.limitFromEnd = limitFromEnd;
|
|
283
|
+
this.start = start;
|
|
284
|
+
this.end = end;
|
|
285
|
+
this.bypassRules = bypassRules;
|
|
286
|
+
}
|
|
287
|
+
where(field, op, value) {
|
|
288
|
+
return this.clone({ clauses: [...this.clauses, { kind: 'where', field, op, value }] });
|
|
289
|
+
}
|
|
290
|
+
applyFilter(filter) {
|
|
291
|
+
return this.clone({ clauses: [...this.clauses, filter] });
|
|
292
|
+
}
|
|
293
|
+
orderBy(field, direction = 'asc') {
|
|
294
|
+
return this.clone({ orders: [...this.orders, { field, direction }] });
|
|
295
|
+
}
|
|
296
|
+
limit(n) {
|
|
297
|
+
return this.clone({ limitCount: n, limitFromEnd: false });
|
|
298
|
+
}
|
|
299
|
+
limitToLast(n) {
|
|
300
|
+
return this.clone({ limitCount: n, limitFromEnd: true });
|
|
301
|
+
}
|
|
302
|
+
startCursor(values, inclusive) {
|
|
303
|
+
return this.clone({ start: { values: [...values], inclusive, fromSnapshot: false } });
|
|
304
|
+
}
|
|
305
|
+
endCursor(values, inclusive) {
|
|
306
|
+
return this.clone({ end: { values: [...values], inclusive, fromSnapshot: false } });
|
|
307
|
+
}
|
|
308
|
+
startCursorFromSnapshot(snapshot, inclusive) {
|
|
309
|
+
return this.clone({
|
|
310
|
+
start: {
|
|
311
|
+
values: cursorValuesFromSnapshot(snapshot, this.normalizedOrders()),
|
|
312
|
+
inclusive,
|
|
313
|
+
fromSnapshot: true,
|
|
314
|
+
},
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
endCursorFromSnapshot(snapshot, inclusive) {
|
|
318
|
+
return this.clone({
|
|
319
|
+
end: {
|
|
320
|
+
values: cursorValuesFromSnapshot(snapshot, this.normalizedOrders()),
|
|
321
|
+
inclusive,
|
|
322
|
+
fromSnapshot: true,
|
|
323
|
+
},
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Build a fresh `QueryImpl` carrying the same identity (collectionPath,
|
|
328
|
+
* auth, env) plus the patches in `overrides`. Subclasses
|
|
329
|
+
* (`CollectionGroupQueryImpl`) override this to construct their own
|
|
330
|
+
* type so chained calls preserve the cross-collection semantics.
|
|
331
|
+
*/
|
|
332
|
+
clone(overrides) {
|
|
333
|
+
return new QueryImpl(this.env, this.auth, this.collectionPath, overrides.clauses ?? this.clauses, overrides.orders ?? this.orders, overrides.limitCount !== undefined || 'limitCount' in overrides ? overrides.limitCount : this.limitCount, overrides.limitFromEnd ?? this.limitFromEnd, 'start' in overrides ? overrides.start : this.start, 'end' in overrides ? overrides.end : this.end, this.bypassRules);
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Hook subclasses (e.g. `CollectionGroupQueryImpl`) override to
|
|
337
|
+
* change WHERE docs come from. The default scans this query's
|
|
338
|
+
* `collectionPath` via `listDocuments`. Aggregations and `.get()`
|
|
339
|
+
* both run through this hook so they see the same candidate set.
|
|
340
|
+
*/
|
|
341
|
+
gatherCandidates() {
|
|
342
|
+
// Real direct children only, straight from the DocStore seam: `directOnly`
|
|
343
|
+
// excludes deeper descendants, and without `phantoms` we never synthesize a
|
|
344
|
+
// phantom parent (a query can't match one), equivalent to the old
|
|
345
|
+
// `listDocuments(...).filter(!phantom)` without the post-filter.
|
|
346
|
+
return this.env.scanDocuments(this.collectionPath, { directOnly: true });
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* The collection path the `list` security rule evaluates against.
|
|
350
|
+
* Defaults to this query's `collectionPath`; `CollectionGroupQueryImpl`
|
|
351
|
+
* overrides it to the group-id match path so the group `list` rule
|
|
352
|
+
* fires. Used by {@link readCandidates}.
|
|
353
|
+
*/
|
|
354
|
+
listRulePath() {
|
|
355
|
+
return this.collectionPath;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Gather candidates AND enforce security rules on the read (FS-B1 /
|
|
359
|
+
* RULES-B1). `get()` and `aggregate()` both run through this so query
|
|
360
|
+
* reads are rule-checked the same way `DocumentReference.get()` is — a
|
|
361
|
+
* deny-all rule set throws `permission-denied` instead of silently
|
|
362
|
+
* returning the whole collection.
|
|
363
|
+
*
|
|
364
|
+
* RULES-B11 — enforcement follows production's query-proof model
|
|
365
|
+
* ("rules are not filters"): the structured `where` constraints are
|
|
366
|
+
* threaded into {@link LocalEnvironment.readQueryCandidates} so a
|
|
367
|
+
* doc-data-dependent `list` rule the query's equalities discharge is
|
|
368
|
+
* ALLOWED, and an unprovable query is DENIED whole — never silently
|
|
369
|
+
* filtered to the readable subset.
|
|
370
|
+
*
|
|
371
|
+
* This is the auth-scoped read path. The raw, rules-bypassing
|
|
372
|
+
* {@link LocalEnvironment.listDocuments} stays reserved for explicit
|
|
373
|
+
* admin/crawler access (transaction read-sets, discover) — not exposed
|
|
374
|
+
* through the query surface.
|
|
375
|
+
*/
|
|
376
|
+
readCandidates(opts) {
|
|
377
|
+
const auth = opts?.auth !== undefined ? opts.auth : this.auth;
|
|
378
|
+
const result = this.env.readQueryCandidates(this.gatherCandidates(), this.listRulePath(), auth, this.structuredConstraints(), this.bypassRules);
|
|
379
|
+
if (!result.allowed)
|
|
380
|
+
throw new FirestoreCompatError(result.error);
|
|
381
|
+
return result.docs;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* RULES-B11 — this query's constraints as DATA (vs. the opaque row
|
|
385
|
+
* transformer {@link applyConstraints} is). `where` carries every leaf
|
|
386
|
+
* equality/inequality reachable through top-level AND composition —
|
|
387
|
+
* the conjunctive spine, where each clause is unconditionally
|
|
388
|
+
* guaranteed for every returned doc. Clauses under an `or(...)` are
|
|
389
|
+
* NOT included (they guarantee nothing individually), and non-primitive
|
|
390
|
+
* operand values are skipped — both omissions are conservative: the
|
|
391
|
+
* proof can only fail to discharge a rule predicate (deny), never
|
|
392
|
+
* falsely discharge one.
|
|
393
|
+
*/
|
|
394
|
+
structuredConstraints() {
|
|
395
|
+
const where = [];
|
|
396
|
+
const visit = (f) => {
|
|
397
|
+
if (f.kind === 'where') {
|
|
398
|
+
const v = f.value;
|
|
399
|
+
if (v === null || typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean') {
|
|
400
|
+
where.push({ field: f.field, op: f.op, value: v });
|
|
401
|
+
}
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
if (f.kind === 'and')
|
|
405
|
+
f.filters.forEach(visit);
|
|
406
|
+
// 'or' — skip: sub-clauses are not unconditionally guaranteed.
|
|
407
|
+
};
|
|
408
|
+
for (const f of this.clauses)
|
|
409
|
+
visit(f);
|
|
410
|
+
return {
|
|
411
|
+
where,
|
|
412
|
+
limit: this.limitCount ?? null,
|
|
413
|
+
offset: null,
|
|
414
|
+
orderBy: this.orders.length > 0 ? this.orders[0].field : null,
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Apply this query's clauses + orders + limit to a candidate set.
|
|
419
|
+
* Used by both `get()` and `aggregate()` so the filter logic
|
|
420
|
+
* stays single-sourced.
|
|
421
|
+
*/
|
|
422
|
+
applyConstraints(rows) {
|
|
423
|
+
// 1. WHERE-style filters (leaf + composite OR/AND).
|
|
424
|
+
let filtered = applyFilters(rows, [...this.clauses]);
|
|
425
|
+
// FS-B8 — the NORMALIZED sort: explicit orderBy + an implicit order on
|
|
426
|
+
// each inequality-filtered field + a final `__name__` doc-key tiebreak.
|
|
427
|
+
// It is applied whenever the query needs an ordering (explicit orderBy,
|
|
428
|
+
// an inequality filter, or any cursor); a bare unordered scan keeps the
|
|
429
|
+
// candidate (insertion) order so existing collection-scan expectations
|
|
430
|
+
// hold.
|
|
431
|
+
const normalized = this.normalizedOrders();
|
|
432
|
+
const needsOrder = this.orders.length > 0 ||
|
|
433
|
+
this.start !== undefined ||
|
|
434
|
+
this.end !== undefined ||
|
|
435
|
+
this.clauses.some(hasInequality);
|
|
436
|
+
// FAST PATH (Phase 4 top-k): an ordered, forward-limited query with no
|
|
437
|
+
// cursor selects its k results without sorting the whole filtered set. Uses
|
|
438
|
+
// the SAME present-filter + comparator as applyOrder, so the result is
|
|
439
|
+
// identical to applyOrder(filtered).slice(0, limitCount). limitToLast and
|
|
440
|
+
// cursor queries fall through to the full pipeline below.
|
|
441
|
+
if (needsOrder &&
|
|
442
|
+
this.limitCount !== undefined &&
|
|
443
|
+
!this.limitFromEnd &&
|
|
444
|
+
this.start === undefined &&
|
|
445
|
+
this.end === undefined) {
|
|
446
|
+
return topK(orderPresent(filtered, normalized), this.limitCount, orderComparator(normalized));
|
|
447
|
+
}
|
|
448
|
+
// 2. ORDER BY — required before cursors / limitToLast take effect.
|
|
449
|
+
if (needsOrder) {
|
|
450
|
+
filtered = applyOrder(filtered, normalized);
|
|
451
|
+
}
|
|
452
|
+
// 3. CURSORS — start/end positions relative to the normalized orderBy.
|
|
453
|
+
// A SNAPSHOT cursor is legal without an explicit orderBy (FS-B8): the
|
|
454
|
+
// implicit `__name__` clause positions on the document key. A VALUE
|
|
455
|
+
// cursor positions against the EXPLICIT orderBy only and must not
|
|
456
|
+
// carry more values than explicit orderBy clauses (upstream
|
|
457
|
+
// `boundFromFields` "Too many arguments").
|
|
458
|
+
if (this.start || this.end) {
|
|
459
|
+
for (const c of [this.start, this.end]) {
|
|
460
|
+
if (c && !c.fromSnapshot && c.values.length > this.orders.length) {
|
|
461
|
+
throw new FirestoreCompatError({
|
|
462
|
+
code: 'invalid-argument',
|
|
463
|
+
message: 'Too many arguments provided to a cursor (startAt / startAfter / ' +
|
|
464
|
+
'endAt / endBefore). The number of cursor values must be less than ' +
|
|
465
|
+
'or equal to the number of orderBy() clauses.',
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
filtered = applyCursors(filtered, normalized, this.start, this.end);
|
|
470
|
+
}
|
|
471
|
+
// 4. LIMIT / LIMIT-TO-LAST — slicing happens last. limitToLast
|
|
472
|
+
// reverses the ordering to take the trailing n, then reverses
|
|
473
|
+
// back so consumer code still sees ascending-by-orderBy output.
|
|
474
|
+
if (this.limitCount !== undefined) {
|
|
475
|
+
if (this.limitFromEnd) {
|
|
476
|
+
if (this.orders.length === 0) {
|
|
477
|
+
// FS-B16 — FirestoreError `.code` (prod: `invalid-argument`,
|
|
478
|
+
// "limitToLast() queries require specifying at least one orderBy()").
|
|
479
|
+
throw new FirestoreCompatError({
|
|
480
|
+
code: 'invalid-argument',
|
|
481
|
+
message: 'limitToLast() queries require at least one orderBy clause.',
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
const tail = filtered.slice(-this.limitCount);
|
|
485
|
+
filtered = tail;
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
filtered = filtered.slice(0, this.limitCount);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return filtered;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* FS-B8 — the normalized sort order, mirroring upstream
|
|
495
|
+
* `core/query.ts:queryNormalizedOrderBy`:
|
|
496
|
+
* 1. explicit orderBy clauses as-is;
|
|
497
|
+
* 2. an implicit order on each inequality-filtered field not already
|
|
498
|
+
* ordered (direction = last explicit direction, or asc);
|
|
499
|
+
* 3. a final `__name__` doc-key clause when the key is not explicitly
|
|
500
|
+
* ordered, so equal-valued docs are deterministic and cursors can
|
|
501
|
+
* disambiguate them.
|
|
502
|
+
*/
|
|
503
|
+
normalizedOrders() {
|
|
504
|
+
const out = [...this.orders];
|
|
505
|
+
const seen = new Set(out.map((o) => o.field));
|
|
506
|
+
const lastDir = this.orders.length > 0 ? this.orders[this.orders.length - 1].direction : 'asc';
|
|
507
|
+
// Inequality fields, in first-seen order, not already explicitly ordered.
|
|
508
|
+
for (const f of this.clauses) {
|
|
509
|
+
for (const field of inequalityFields(f)) {
|
|
510
|
+
if (field !== KEY_FIELD && !seen.has(field)) {
|
|
511
|
+
seen.add(field);
|
|
512
|
+
out.push({ field, direction: lastDir });
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (!seen.has(KEY_FIELD)) {
|
|
517
|
+
out.push({ field: KEY_FIELD, direction: lastDir });
|
|
518
|
+
}
|
|
519
|
+
return out;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Public, side-effect-free view of this query's `where` / `orderBy` /
|
|
523
|
+
* cursor / `limit` constraints as a pure row transformer. The
|
|
524
|
+
* snapshot-listener path (FS-B2) threads this into the `SnapshotTarget`
|
|
525
|
+
* so a filtered/ordered/limited `onSnapshot(query(...))` delivers the
|
|
526
|
+
* same membership a one-shot `getDocs(query(...))` would — instead of
|
|
527
|
+
* the whole collection. Returns `undefined` when the query carries no
|
|
528
|
+
* constraints (a bare collection listen) so the listener path can skip
|
|
529
|
+
* the transform entirely.
|
|
530
|
+
*
|
|
531
|
+
* RULES-B11 — the applier also carries the structured constraints (see
|
|
532
|
+
* {@link structuredConstraints}) so the listener read path can run the
|
|
533
|
+
* query-proof gate against the matched `list` rule.
|
|
534
|
+
*/
|
|
535
|
+
snapshotConstraints() {
|
|
536
|
+
if (this.clauses.length === 0 &&
|
|
537
|
+
this.orders.length === 0 &&
|
|
538
|
+
this.limitCount === undefined &&
|
|
539
|
+
this.start === undefined &&
|
|
540
|
+
this.end === undefined) {
|
|
541
|
+
return undefined;
|
|
542
|
+
}
|
|
543
|
+
const applier = (rows) => this.applyConstraints(rows);
|
|
544
|
+
applier.structured = this.structuredConstraints();
|
|
545
|
+
return applier;
|
|
546
|
+
}
|
|
547
|
+
async get(opts) {
|
|
548
|
+
// Query reads enforce security rules (FS-B1) under the query-proof
|
|
549
|
+
// model (RULES-B11): a deny-all rule set throws `permission-denied`,
|
|
550
|
+
// and a doc-data-dependent `list` rule the query's `where()`
|
|
551
|
+
// equalities can't discharge denies the WHOLE query — never a
|
|
552
|
+
// silently filtered subset. The `opts.auth` override threads through
|
|
553
|
+
// to the rule eval the same way the single-doc/write paths use it.
|
|
554
|
+
// Phantom parent docs are a discover-crawler affordance — already
|
|
555
|
+
// stripped by `gatherCandidates`; the rule-enforced read preserves
|
|
556
|
+
// that (see file header).
|
|
557
|
+
const filtered = this.applyConstraints(this.readCandidates(opts));
|
|
558
|
+
const docs = filtered.map((d) => {
|
|
559
|
+
const ref = new DocumentRefImpl(this.env, this.auth, d.path, this.bypassRules);
|
|
560
|
+
// Translate timestamps + future typed values on the read path.
|
|
561
|
+
// Done eagerly per row so .data() callers don't pay translation
|
|
562
|
+
// cost twice if they invoke it more than once.
|
|
563
|
+
const translated = translateReadData(d.data);
|
|
564
|
+
// QueryDocumentSnapshot narrows `data()` to non-undefined — by
|
|
565
|
+
// construction we never include missing docs, so this is sound.
|
|
566
|
+
return {
|
|
567
|
+
id: ref.id,
|
|
568
|
+
ref,
|
|
569
|
+
exists: true,
|
|
570
|
+
data: () => translated,
|
|
571
|
+
};
|
|
572
|
+
});
|
|
573
|
+
return {
|
|
574
|
+
size: docs.length,
|
|
575
|
+
empty: docs.length === 0,
|
|
576
|
+
docs,
|
|
577
|
+
forEach(cb) { docs.forEach(cb); },
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
async aggregate(spec, opts) {
|
|
581
|
+
// Aggregates read through the rule-enforced path too (FS-B1) — the
|
|
582
|
+
// count/sum/avg is computed only over docs the caller can read.
|
|
583
|
+
const filtered = this.applyConstraints(this.readCandidates(opts));
|
|
584
|
+
const data = {};
|
|
585
|
+
for (const alias of Object.keys(spec)) {
|
|
586
|
+
data[alias] = computeAggregate(spec[alias], filtered);
|
|
587
|
+
}
|
|
588
|
+
return { data: () => data };
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Run one aggregate against a filtered doc set. Non-numeric values
|
|
593
|
+
* are skipped silently (Firestore production behavior on heterogeneous
|
|
594
|
+
* fields). Empty inputs produce `0` for count/sum and `null` for
|
|
595
|
+
* average — the latter matches the JS SDK's
|
|
596
|
+
* `AggregateField.average(...)` contract.
|
|
597
|
+
*/
|
|
598
|
+
function computeAggregate(field, rows) {
|
|
599
|
+
if (field.kind === 'count')
|
|
600
|
+
return rows.length;
|
|
601
|
+
let sum = 0;
|
|
602
|
+
let n = 0;
|
|
603
|
+
for (const row of rows) {
|
|
604
|
+
const v = row.data[field.field];
|
|
605
|
+
if (typeof v === 'number' && Number.isFinite(v)) {
|
|
606
|
+
sum += v;
|
|
607
|
+
n++;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
if (field.kind === 'sum')
|
|
611
|
+
return sum;
|
|
612
|
+
// average — undefined for empty/all-non-numeric sets
|
|
613
|
+
return n === 0 ? null : sum / n;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Cross-collection query — walks `env.snapshot()` (the in-memory
|
|
617
|
+
* keyspace) and returns every document whose immediate parent
|
|
618
|
+
* collection equals `collectionId`. Backs `Firestore.collectionGroup`.
|
|
619
|
+
*
|
|
620
|
+
* `collectionId` is matched on the second-to-last segment of each
|
|
621
|
+
* stored doc path. For doc `parents/X/items/Y`, segments are
|
|
622
|
+
* `[parents, X, items, Y]` so the parent collection is `items`.
|
|
623
|
+
*
|
|
624
|
+
* Inherits all `where` / `orderBy` / `limit` / `aggregate` plumbing
|
|
625
|
+
* from `QueryImpl`. Overrides only `gatherCandidates()` so the base
|
|
626
|
+
* class's get/aggregate machinery picks up the cross-collection scan
|
|
627
|
+
* automatically.
|
|
628
|
+
*/
|
|
629
|
+
export class CollectionGroupQueryImpl extends QueryImpl {
|
|
630
|
+
collectionId;
|
|
631
|
+
constructor(env, auth, collectionId, clauses = [], orders = [], limitCount, limitFromEnd = false, start, end, bypassRules = false) {
|
|
632
|
+
// Pass an empty `collectionPath` to the parent — we never use it
|
|
633
|
+
// (gatherCandidates overrides the env.listDocuments call).
|
|
634
|
+
super(env, auth, '', clauses, orders, limitCount, limitFromEnd, start, end, bypassRules);
|
|
635
|
+
this.collectionId = collectionId;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Subclass clone: hand back a fresh `CollectionGroupQueryImpl`
|
|
639
|
+
* so chained calls (`where`, `applyFilter`, `orderBy`, `limit`,
|
|
640
|
+
* `limitToLast`, cursors) preserve the cross-collection
|
|
641
|
+
* identity. The base-class methods all dispatch through this
|
|
642
|
+
* hook — no per-method overrides needed.
|
|
643
|
+
*/
|
|
644
|
+
clone(overrides) {
|
|
645
|
+
return new CollectionGroupQueryImpl(this.env, this.auth, this.collectionId, overrides.clauses ?? this.clauses, overrides.orders ?? this.orders, 'limitCount' in overrides ? overrides.limitCount : this.limitCount, overrides.limitFromEnd ?? this.limitFromEnd, 'start' in overrides ? overrides.start : this.start, 'end' in overrides ? overrides.end : this.end, this.bypassRules);
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Cross-collection candidate gathering. Walks the in-memory
|
|
649
|
+
* snapshot once and keeps docs whose immediate parent collection
|
|
650
|
+
* matches `collectionId`. Snapshot is a copy so iteration is safe
|
|
651
|
+
* even if writes interleave.
|
|
652
|
+
*/
|
|
653
|
+
gatherCandidates() {
|
|
654
|
+
const out = [];
|
|
655
|
+
const snap = this.env.snapshot();
|
|
656
|
+
for (const path of Object.keys(snap)) {
|
|
657
|
+
if (parentCollectionName(path) === this.collectionId) {
|
|
658
|
+
out.push({ path, data: snap[path] });
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
return out;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Group reads span many parent collections, so there's no single
|
|
665
|
+
* concrete collection path to evaluate the `list` rule against. Use
|
|
666
|
+
* the group id as the representative match path — per-doc `get`
|
|
667
|
+
* enforcement (against each real candidate path) still runs, so a
|
|
668
|
+
* doc the caller can't read is dropped regardless of where it lives.
|
|
669
|
+
*/
|
|
670
|
+
listRulePath() {
|
|
671
|
+
return this.collectionId;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Return the name of the collection a doc path lives directly in.
|
|
676
|
+
* For `parents/X/items/Y`, returns `'items'`. For `items/Y`, returns
|
|
677
|
+
* `'items'`. Returns `null` when the path isn't a valid doc path
|
|
678
|
+
* (odd-segment count).
|
|
679
|
+
*/
|
|
680
|
+
function parentCollectionName(path) {
|
|
681
|
+
const segments = path.split('/').filter((s) => s.length > 0);
|
|
682
|
+
if (segments.length === 0 || segments.length % 2 !== 0)
|
|
683
|
+
return null;
|
|
684
|
+
return segments[segments.length - 2];
|
|
685
|
+
}
|
|
686
|
+
export class CollectionRefImpl extends QueryImpl {
|
|
687
|
+
id;
|
|
688
|
+
path;
|
|
689
|
+
constructor(env, auth, path, bypassRules = false) {
|
|
690
|
+
super(env, auth, path, [], [], undefined, false, undefined, undefined, bypassRules);
|
|
691
|
+
this.path = path;
|
|
692
|
+
this.id = lastSegment(path);
|
|
693
|
+
}
|
|
694
|
+
doc(id) {
|
|
695
|
+
const finalId = id ?? generateAutoId();
|
|
696
|
+
return new DocumentRefImpl(this.env, this.auth, `${this.path}/${finalId}`, this.bypassRules);
|
|
697
|
+
}
|
|
698
|
+
async add(data, opts) {
|
|
699
|
+
const ref = this.doc();
|
|
700
|
+
await ref.set(data, opts);
|
|
701
|
+
return ref;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
//# sourceMappingURL=query.js.map
|