pyric 0.0.1 → 0.1.0-alpha.7
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 +52 -1
- 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 +109 -3
|
@@ -0,0 +1,806 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocalEnvironment — stateful Firestore sandbox.
|
|
3
|
+
*
|
|
4
|
+
* Wraps LocalState + SimulateFirestoreRulesHandler + EventLog into a
|
|
5
|
+
* complete local development environment. Agents can seed data, deploy
|
|
6
|
+
* rules, execute operations, and undo — all without touching production.
|
|
7
|
+
*/
|
|
8
|
+
import { type DocumentData, type DocEntry, type ScanOptions } from './local-state.js';
|
|
9
|
+
import { type AgentEvent } from './event-log.js';
|
|
10
|
+
import { type LintResult } from 'pyric/rules';
|
|
11
|
+
import { type QueryConstraints } from './list-query-proof.js';
|
|
12
|
+
import { Timestamp } from 'pyric/rules';
|
|
13
|
+
import { type FirestoreSimError } from './errors.js';
|
|
14
|
+
import type { Transaction, TransactionOptions, TransactionResult } from './transaction-types.js';
|
|
15
|
+
import type { ListenerAuth, SnapshotCallback, SnapshotErrorCallback, SnapshotListenerOptions, SnapshotTarget } from './snapshot-listeners.js';
|
|
16
|
+
/**
|
|
17
|
+
* Thrown by `LocalEnvironment.execute` / `.batch` when the simulator
|
|
18
|
+
* abstained on a rule (state: UNSUPPORTED). The agent's rule may be
|
|
19
|
+
* correct — the simulator just doesn't implement the feature it uses.
|
|
20
|
+
*
|
|
21
|
+
* Returning `allowed: false` here would silently re-create the
|
|
22
|
+
* misleading-DENY pattern that Item 0.A is designed to prevent (the
|
|
23
|
+
* agent can't tell sim-gap apart from real rule bug). Throwing forces
|
|
24
|
+
* the test to fail loudly with an actionable message pointing at the
|
|
25
|
+
* production Test API as the workaround.
|
|
26
|
+
*/
|
|
27
|
+
export declare class SimulatorUnsupportedError extends Error {
|
|
28
|
+
readonly method: string;
|
|
29
|
+
readonly path: string;
|
|
30
|
+
readonly debugMessages: string[];
|
|
31
|
+
constructor(message: string, method: string, path: string, debugMessages: string[]);
|
|
32
|
+
}
|
|
33
|
+
export interface Operation {
|
|
34
|
+
/**
|
|
35
|
+
* `'set'` is the replace-semantics single-write counterpart of the
|
|
36
|
+
* batch `'set'` op: storage replaces, rule eval translates to
|
|
37
|
+
* `'create'` (doc absent) or `'update'` (doc exists). Use it for
|
|
38
|
+
* `DocumentReference.set(data)` without merge options.
|
|
39
|
+
*/
|
|
40
|
+
method: 'get' | 'list' | 'create' | 'update' | 'set' | 'delete';
|
|
41
|
+
path: string;
|
|
42
|
+
auth: {
|
|
43
|
+
uid: string;
|
|
44
|
+
token?: Record<string, unknown>;
|
|
45
|
+
} | null;
|
|
46
|
+
data?: DocumentData;
|
|
47
|
+
/** Signals that this `create`'s path-last-segment was minted by
|
|
48
|
+
* `LocalEnvironment.createWithAutoId` (not user-supplied). The
|
|
49
|
+
* replay engine reads `WriteSandboxEvent.autoId` and mints a fresh
|
|
50
|
+
* ID on replay rather than preserving the original. Only meaningful
|
|
51
|
+
* on `method: 'create'`; ignored otherwise. */
|
|
52
|
+
autoId?: boolean;
|
|
53
|
+
/** Pin the server-time the rule engine sees for this op (replaces
|
|
54
|
+
* `Timestamp.fromMillis(Date.now())`). Used by the replay engine
|
|
55
|
+
* with `pinRequestTime: true` so `serverTimestamp()` sentinels
|
|
56
|
+
* resolve to the captured value and rules that branch on
|
|
57
|
+
* `request.time` evaluate identically on replay. */
|
|
58
|
+
requestTime?: Timestamp;
|
|
59
|
+
/** FS-B6 — `setDoc(data, {merge})` storage semantics. When set, an
|
|
60
|
+
* `update`/`create` op DEEP-merges (`merge: true`) or projects to the
|
|
61
|
+
* listed field paths (`{ mergeFields }`) instead of the shallow
|
|
62
|
+
* field-path update. Rule evaluation is unaffected (merge still
|
|
63
|
+
* evaluates as create-when-absent / update-when-present). Only
|
|
64
|
+
* meaningful when `doc-ref.set` routes a merge write through here. */
|
|
65
|
+
merge?: boolean | {
|
|
66
|
+
mergeFields: readonly string[];
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Studio admin lens (Pyric Studio Gap #2). When `true`, rule
|
|
70
|
+
* evaluation is SKIPPED for this op — `simulate()` is never called and
|
|
71
|
+
* the op is treated as ALLOW. The write still goes through `applyWrite`
|
|
72
|
+
* (so structural preconditions like create-already-exists / update-
|
|
73
|
+
* missing STILL apply, matching real Firestore admin) and still emits
|
|
74
|
+
* the same `request`/`write` events + wakes listeners. This is the
|
|
75
|
+
* modular-shaped sibling of the path-string `adminSetDocument` /
|
|
76
|
+
* `adminDeleteDocument` bypass — same effect (rules off, store + events
|
|
77
|
+
* on), reachable through the chainable/modular op surface. Default
|
|
78
|
+
* (absent/false) is the unchanged rules-enforced path. */
|
|
79
|
+
bypassRules?: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface OperationResult {
|
|
82
|
+
allowed: boolean;
|
|
83
|
+
data?: DocumentData | null;
|
|
84
|
+
debugMessages: string[];
|
|
85
|
+
event: AgentEvent;
|
|
86
|
+
/**
|
|
87
|
+
* Item 6 — typed error code present on every denial / structural
|
|
88
|
+
* failure. Absent when `allowed: true`. See {@link FirestoreSimError}
|
|
89
|
+
* for the canonical code set and {@link makeError} for construction.
|
|
90
|
+
*/
|
|
91
|
+
error?: FirestoreSimError;
|
|
92
|
+
}
|
|
93
|
+
export interface BatchOperationInput {
|
|
94
|
+
method: 'create' | 'update' | 'delete';
|
|
95
|
+
path: string;
|
|
96
|
+
data?: DocumentData;
|
|
97
|
+
}
|
|
98
|
+
export interface BatchResult {
|
|
99
|
+
allowed: boolean;
|
|
100
|
+
results: {
|
|
101
|
+
path: string;
|
|
102
|
+
allowed: boolean;
|
|
103
|
+
debugMessages: string[];
|
|
104
|
+
/** Item 6 — populated for any per-op denial inside the batch. */
|
|
105
|
+
error?: FirestoreSimError;
|
|
106
|
+
}[];
|
|
107
|
+
event: AgentEvent;
|
|
108
|
+
/**
|
|
109
|
+
* Item 6 — top-level batch error. Set when the batch as a whole was
|
|
110
|
+
* rejected (atomic rollback) — typically the first per-op error, or
|
|
111
|
+
* a sentinel-resolution error that aborted before per-op evaluation.
|
|
112
|
+
*/
|
|
113
|
+
error?: FirestoreSimError;
|
|
114
|
+
}
|
|
115
|
+
export declare class LocalEnvironment {
|
|
116
|
+
private state;
|
|
117
|
+
private eventLog;
|
|
118
|
+
private simulator;
|
|
119
|
+
private rulesSource;
|
|
120
|
+
private seedSnapshot;
|
|
121
|
+
/**
|
|
122
|
+
* Subscribers notified after every `permission-denied` is constructed,
|
|
123
|
+
* regardless of whether downstream user code catches the resulting
|
|
124
|
+
* throw. Lets host environments (the playground runner, tests) surface
|
|
125
|
+
* denials with full eval context even when test code wraps the call
|
|
126
|
+
* in try/catch — the catch otherwise hides everything past `e.code`.
|
|
127
|
+
*/
|
|
128
|
+
private denialListeners;
|
|
129
|
+
/**
|
|
130
|
+
* Subscribers notified for every evaluated op (issue #307). Each
|
|
131
|
+
* receives a public-shape `RequestEvent`. Re-shape from the internal
|
|
132
|
+
* eval payload happens in {@link emitRequest} so the env's hot path
|
|
133
|
+
* doesn't allocate the event object until we know someone's listening.
|
|
134
|
+
*
|
|
135
|
+
* Listener throws are swallowed (same rationale as `denialListeners`).
|
|
136
|
+
*/
|
|
137
|
+
private requestListeners;
|
|
138
|
+
/**
|
|
139
|
+
* Subscribers notified for every COMMITTED write (issue #307). Fires
|
|
140
|
+
* after the keyspace successfully applied the write — denied or
|
|
141
|
+
* rolled-back writes don't emit here (they surface as a request-deny
|
|
142
|
+
* RequestEvent instead). Bridged to `Sandbox.onEvent` consumers via
|
|
143
|
+
* SandboxImpl's attachToEnv.
|
|
144
|
+
*/
|
|
145
|
+
private writeListeners;
|
|
146
|
+
/**
|
|
147
|
+
* Subscribers notified for every snapshot DELIVERED to a user
|
|
148
|
+
* `onSnapshot` callback. Fires after the suppress-check in
|
|
149
|
+
* notify*Listener, so this count tracks real callback invocations
|
|
150
|
+
* (in contrast to `requestListeners[origin='listener']`, which used
|
|
151
|
+
* to over-count before the step-5 refactor).
|
|
152
|
+
*/
|
|
153
|
+
private deliveryListeners;
|
|
154
|
+
/**
|
|
155
|
+
* Subscribers notified for every listener re-eval that was suppressed
|
|
156
|
+
* before reaching the user callback — Slice 3's no-op suppression
|
|
157
|
+
* surfaces here. Useful for "why didn't my listener fire" debugging.
|
|
158
|
+
*/
|
|
159
|
+
private suppressedListeners;
|
|
160
|
+
/**
|
|
161
|
+
* Subscribers notified for listener attach / detach lifecycle. Errored
|
|
162
|
+
* still routes through onSnapshotError (bridged to listener_errored
|
|
163
|
+
* in SandboxImpl) so this channel only carries attach + detach.
|
|
164
|
+
*/
|
|
165
|
+
private lifecycleListeners;
|
|
166
|
+
/**
|
|
167
|
+
* The user-origin op that's currently triggering a listener re-eval,
|
|
168
|
+
* if any. Set by the execute / batch / transaction call sites
|
|
169
|
+
* immediately before `notifyListenersForPaths`. Call sites use a
|
|
170
|
+
* **save/restore** pattern — a listener callback may itself issue a
|
|
171
|
+
* write, recursing through execute and setting up its own trigger; we
|
|
172
|
+
* must put the outer trigger back when the nested call returns so the
|
|
173
|
+
* remaining listeners in the outer fan-out still attribute correctly.
|
|
174
|
+
*
|
|
175
|
+
* Listener-origin RequestEvents copy this into `triggeredBy`. Undefined
|
|
176
|
+
* for the initial-fire path and for deployRules re-evaluation.
|
|
177
|
+
*/
|
|
178
|
+
private currentTrigger?;
|
|
179
|
+
/**
|
|
180
|
+
* RULES-B11 — parsed-AST cache for the query-proof gate. The proof
|
|
181
|
+
* needs the matched `list` rule's condition AST on EVERY list read;
|
|
182
|
+
* re-parsing the (unchanging) rules source per read would be O(source)
|
|
183
|
+
* on the listener hot path. Keyed on the exact source string so
|
|
184
|
+
* `deployRules` / `seed` invalidate it for free.
|
|
185
|
+
*/
|
|
186
|
+
private parsedRulesCache;
|
|
187
|
+
/**
|
|
188
|
+
* Subscribers notified when a snapshot listener is marked errored
|
|
189
|
+
* (Slice 7). Mirrors `denialListeners` but fires from the listener
|
|
190
|
+
* dispatch path, not from one-shot operation evaluation. Two-level
|
|
191
|
+
* model per source survey section 9: the listener's own `errorCallback`
|
|
192
|
+
* receives the error AND every env-level subscriber receives it —
|
|
193
|
+
* the playground subscribes here to surface stream errors as toasts
|
|
194
|
+
* the same way it surfaces denials today.
|
|
195
|
+
*/
|
|
196
|
+
private snapshotErrorListeners;
|
|
197
|
+
/**
|
|
198
|
+
* Active `onSnapshot` listeners. Slice 1 — registry only; the dispatch
|
|
199
|
+
* path is wired in Slices 2 (initial fire), 3 (change detection), and
|
|
200
|
+
* 5 (transaction/batch deferral). Stored as a flat `Map<id, record>`
|
|
201
|
+
* per the implementation plan; query-canonicalization-based dedup
|
|
202
|
+
* (production's `EventManager` shape) is layered on later when caching
|
|
203
|
+
* actually saves work — see source survey section 2 for the eventual target
|
|
204
|
+
* shape. Each record carries its own target so future slices can scan
|
|
205
|
+
* and group on demand without restructuring the registry first.
|
|
206
|
+
*/
|
|
207
|
+
private snapshotListeners;
|
|
208
|
+
private nextListenerId;
|
|
209
|
+
/**
|
|
210
|
+
* Deferred listener deliveries — the shared delivery scheduler (items
|
|
211
|
+
* 3 + 5). Production never invokes an `onSnapshot` callback synchronously
|
|
212
|
+
* on the registering/writing stack: the initial snapshot arrives after
|
|
213
|
+
* the listen round-trip (COMPAT firestore#80 — "asynchronous, never
|
|
214
|
+
* during register"), and a local write's echo + server ack arrive on the
|
|
215
|
+
* async event queue (firestore#85). The sandbox mirrors that by enqueuing
|
|
216
|
+
* every user-facing delivery here and draining it off-stack, on a
|
|
217
|
+
* `queueMicrotask` boundary — which satisfies the "asynchronous" contract
|
|
218
|
+
* without a macrotask's extra latency (the prototype in the deep-divergence
|
|
219
|
+
* review measured identical behavior for micro- vs macro-task deferral).
|
|
220
|
+
*
|
|
221
|
+
* Per-listener FIFO order is preserved: deliveries enqueued *during* a
|
|
222
|
+
* drain — a callback that itself writes, or the item-3 metadata ack a
|
|
223
|
+
* write echo schedules — are appended and drained in the same pass, so a
|
|
224
|
+
* write settles fully before control returns to the microtask loop.
|
|
225
|
+
*/
|
|
226
|
+
private deliveryQueue;
|
|
227
|
+
private deliveryScheduled;
|
|
228
|
+
constructor();
|
|
229
|
+
/**
|
|
230
|
+
* Subscribe to permission-denied events. Returns an unsubscribe fn.
|
|
231
|
+
* The callback receives the structured `FirestoreSimError` carrying
|
|
232
|
+
* `request` / `resource` (when populated) — so subscribers can render
|
|
233
|
+
* a debugger-style frame without re-deriving any state.
|
|
234
|
+
*
|
|
235
|
+
* Listener throws are swallowed to keep the simulator hot path
|
|
236
|
+
* resilient — a faulty subscriber should not change rule semantics.
|
|
237
|
+
*/
|
|
238
|
+
onDenial(cb: (err: FirestoreSimError) => void): () => void;
|
|
239
|
+
private emitDenial;
|
|
240
|
+
/**
|
|
241
|
+
* Subscribe to every evaluated op (issue #307). Returns an unsubscribe
|
|
242
|
+
* fn. The emit sites in `execute`, `batch`, `silentReadDoc`,
|
|
243
|
+
* `silentReadCollection` build the public-shape event lazily — when
|
|
244
|
+
* no subscribers are attached, eval doesn't pay the allocation cost.
|
|
245
|
+
*/
|
|
246
|
+
onRequest(cb: (event: import('../types.js').RequestEvent) => void): () => void;
|
|
247
|
+
/**
|
|
248
|
+
* Subscribe to committed-write events. Internal — bridged to the
|
|
249
|
+
* public `Sandbox.onEvent` channel by SandboxImpl. Fires AFTER the
|
|
250
|
+
* keyspace applies the write; denied / rolled-back writes don't
|
|
251
|
+
* emit here.
|
|
252
|
+
*/
|
|
253
|
+
onWrite(cb: (event: import('../types.js').WriteSandboxEvent) => void): () => void;
|
|
254
|
+
/** Internal — bridge for sandbox-level `onEvent` to receive
|
|
255
|
+
* snapshot-delivery events. Fires after the user callback runs. */
|
|
256
|
+
onSnapshotDelivery(cb: (event: import('../types.js').SnapshotDeliveryEvent) => void): () => void;
|
|
257
|
+
/** Internal bridge for snapshot_suppressed events — re-evals that
|
|
258
|
+
* didn't deliver because diffing found no observable change. */
|
|
259
|
+
onSnapshotSuppressed(cb: (event: import('../types.js').SnapshotSuppressedEvent) => void): () => void;
|
|
260
|
+
/** Internal bridge for listener attach/detach lifecycle. Errored
|
|
261
|
+
* routes through onSnapshotError separately. */
|
|
262
|
+
onListenerLifecycle(cb: (event: import('../types.js').ListenerLifecycleEvent) => void): () => void;
|
|
263
|
+
private emitSnapshotDelivery;
|
|
264
|
+
private emitSnapshotSuppressed;
|
|
265
|
+
private emitLifecycle;
|
|
266
|
+
/**
|
|
267
|
+
* Build and dispatch a `WriteSandboxEvent`. Same sync-throw +
|
|
268
|
+
* async-rejection isolation as emitRequest. Bails early when no
|
|
269
|
+
* subscribers are attached so the hot path stays allocation-free.
|
|
270
|
+
*
|
|
271
|
+
* `sentinels` and `autoId` are reserved fields the caller can
|
|
272
|
+
* populate when the replay-engine work lands. v1 always passes
|
|
273
|
+
* undefined for both.
|
|
274
|
+
*/
|
|
275
|
+
private emitWrite;
|
|
276
|
+
/**
|
|
277
|
+
* Build and dispatch a `RequestEvent` to all `onRequest` subscribers.
|
|
278
|
+
* Bails early when no one's listening so the hot path doesn't allocate
|
|
279
|
+
* an event object. Per the V1 probe numbers, eval rate can reach
|
|
280
|
+
* ~4500/sec in listener-storm scenarios — every cycle matters.
|
|
281
|
+
*
|
|
282
|
+
* Subscriber-throw isolation has two layers:
|
|
283
|
+
* - Sync throws are caught by the try/catch around the invocation.
|
|
284
|
+
* - Async subscribers that return a rejected Promise (e.g.
|
|
285
|
+
* `async (e) => { throw }`) have the rejection silently swallowed
|
|
286
|
+
* by attaching a noop `.catch`. Without this, an
|
|
287
|
+
* `unhandledRejection` would terminate the sandbox process on
|
|
288
|
+
* Node ≥15 default config — one bad subscriber would kill every
|
|
289
|
+
* other observer.
|
|
290
|
+
*
|
|
291
|
+
* Subscriber callbacks are observational; the sandbox doesn't await
|
|
292
|
+
* them and doesn't propagate their errors.
|
|
293
|
+
*/
|
|
294
|
+
private emitRequest;
|
|
295
|
+
/**
|
|
296
|
+
* Subscribe to snapshot-listener stream errors (Slice 7). Returns an
|
|
297
|
+
* unsubscribe fn. Fires every time a snapshot listener is marked
|
|
298
|
+
* errored — initial fire denial, change-driven re-read denial, or
|
|
299
|
+
* `deployRules` re-evaluation flipping a listener allowed → denied.
|
|
300
|
+
*
|
|
301
|
+
* The callback receives the structured `FirestoreSimError` plus the
|
|
302
|
+
* listener's `SnapshotTarget` so the host UI can attribute the error
|
|
303
|
+
* to a specific watch (e.g. "listener on `games/g1` errored").
|
|
304
|
+
*
|
|
305
|
+
* Per source survey section 9, this is the playground-side channel: stream
|
|
306
|
+
* errors fan out to both the listener's own `errorCallback` AND every
|
|
307
|
+
* env-level subscriber here. Subscriber throws are swallowed so a
|
|
308
|
+
* faulty UI handler can't destabilize the simulator.
|
|
309
|
+
*/
|
|
310
|
+
onSnapshotError(cb: (err: FirestoreSimError, target: SnapshotTarget, listenerId: string) => void): () => void;
|
|
311
|
+
private emitSnapshotError;
|
|
312
|
+
/**
|
|
313
|
+
* Register a snapshot listener. Returns an `Unsubscribe` function
|
|
314
|
+
* matching the Web SDK's contract — a zero-arg call that detaches
|
|
315
|
+
* the listener. Idempotent: calling the returned function more than
|
|
316
|
+
* once after the first detach is a no-op.
|
|
317
|
+
*
|
|
318
|
+
* Slice 2: fires the **initial snapshot** synchronously after the
|
|
319
|
+
* record is registered. The current matching docs are read under
|
|
320
|
+
* `auth`'s rules — denied reads invoke `errorCallback` and mark the
|
|
321
|
+
* listener `errored` (no further notifications). Slice 3 will add
|
|
322
|
+
* change-driven fires; Slice 5 batches them through `applyBatch`.
|
|
323
|
+
*
|
|
324
|
+
* `auth` is captured at registration so notifications later evaluate
|
|
325
|
+
* rules under the auth that subscribed — not whatever auth happens
|
|
326
|
+
* to be active when a write triggers the dispatch.
|
|
327
|
+
*/
|
|
328
|
+
addSnapshotListener(target: SnapshotTarget, callback: SnapshotCallback, options?: SnapshotListenerOptions, auth?: ListenerAuth, errorCallback?: SnapshotErrorCallback,
|
|
329
|
+
/**
|
|
330
|
+
* `true` when the registering Firestore handle was a `sandbox-live`
|
|
331
|
+
* (`getFirestore(sandbox)`) target — its identity follows
|
|
332
|
+
* `sandbox.currentUser`, so this listener re-evaluates on a
|
|
333
|
+
* `currentUser` change (see {@link reevaluateLiveListeners}).
|
|
334
|
+
* `false` (default) for frozen-ctx (`getFirestore(ctx)`) listeners,
|
|
335
|
+
* which stay pinned to the auth they captured at registration.
|
|
336
|
+
*/
|
|
337
|
+
followsCurrentUser?: boolean): () => void;
|
|
338
|
+
/**
|
|
339
|
+
* Compute and deliver the initial snapshot for a freshly-registered
|
|
340
|
+
* listener. Reads under the listener's `auth` and respects the
|
|
341
|
+
* deployed rules — denied reads route to `errorCallback` and mark
|
|
342
|
+
* the record `errored`. Splits doc vs query targets along the same
|
|
343
|
+
* seam {@link execute} uses, but does **not** append to the event
|
|
344
|
+
* log: listener reads are bookkeeping, not user-visible operations,
|
|
345
|
+
* and would otherwise drown the event log under any non-trivial UI.
|
|
346
|
+
*/
|
|
347
|
+
private fireInitialSnapshot;
|
|
348
|
+
/**
|
|
349
|
+
* Enqueue a listener delivery and ensure an off-stack drain is pending.
|
|
350
|
+
* See {@link deliveryQueue}.
|
|
351
|
+
*/
|
|
352
|
+
private scheduleDelivery;
|
|
353
|
+
/**
|
|
354
|
+
* Enqueue a write-driven delivery, restoring the triggering op while it
|
|
355
|
+
* runs so listener-origin RequestEvents / delivery events still attribute
|
|
356
|
+
* to the write (`triggeredBy`) even though the callback now fires off the
|
|
357
|
+
* writing stack. See {@link currentTrigger}.
|
|
358
|
+
*/
|
|
359
|
+
private scheduleTriggeredDelivery;
|
|
360
|
+
/**
|
|
361
|
+
* Drain queued deliveries in FIFO order. A delivery may enqueue more (a
|
|
362
|
+
* callback that writes; the item-3 metadata ack a write echo schedules) —
|
|
363
|
+
* those are appended and drained in the same pass.
|
|
364
|
+
*/
|
|
365
|
+
private drainDeliveries;
|
|
366
|
+
/**
|
|
367
|
+
* Synchronously deliver all pending snapshot fires. Test-only seam:
|
|
368
|
+
* production consumers observe deliveries via the microtask drain, but a
|
|
369
|
+
* synchronous test body calls this to settle the queue deterministically
|
|
370
|
+
* before asserting fire counts / snapshot contents. Idempotent — a no-op
|
|
371
|
+
* on an empty queue, and safe when a microtask drain is also pending (that
|
|
372
|
+
* drain then finds the queue already empty).
|
|
373
|
+
*/
|
|
374
|
+
flushListeners(): void;
|
|
375
|
+
/**
|
|
376
|
+
* Walk every active snapshot listener and fire those whose target
|
|
377
|
+
* intersects `touchedPaths`. Called by the write-path commit hooks
|
|
378
|
+
* — `execute` (single write) and the two `applyBatch` call-sites
|
|
379
|
+
* (batch + transaction). Suppresses no-op snapshots per findings section 5
|
|
380
|
+
* (View-level suppression rather than `isEqual`): doc listeners only
|
|
381
|
+
* fire when the underlying data shape changes; query listeners only
|
|
382
|
+
* fire when the change list is non-empty.
|
|
383
|
+
*
|
|
384
|
+
* Iteration walks a snapshotted list of records — a callback is
|
|
385
|
+
* allowed to add or remove listeners (StrictMode + HMR routinely do)
|
|
386
|
+
* and we must not iterate a mutating Map.
|
|
387
|
+
*
|
|
388
|
+
* Items 3 + 5 — each per-listener fire is enqueued on the delivery
|
|
389
|
+
* scheduler rather than run inline, so the write echo lands off the
|
|
390
|
+
* writing stack (like prod's async event queue) and stays ordered behind
|
|
391
|
+
* any still-pending initial fire for the same listener. The errored /
|
|
392
|
+
* unsubscribe checks are re-run at delivery time because a listener may
|
|
393
|
+
* detach or error between this write and the drain.
|
|
394
|
+
*/
|
|
395
|
+
private notifyListenersForPaths;
|
|
396
|
+
private notifyDocListener;
|
|
397
|
+
/**
|
|
398
|
+
* Item 3 — schedule the server-ack fire that follows a write echo. Only
|
|
399
|
+
* fires for includeMetadataChanges listeners (default listeners never see
|
|
400
|
+
* the metadata-only ack; their snapshot stays `pending:true`). Re-delivers
|
|
401
|
+
* the just-echoed data with `hasPendingWrites:false`, as a metadata-only
|
|
402
|
+
* change (no added/modified/removed). Rides the delivery scheduler so it
|
|
403
|
+
* lands off the echo's stack, matching prod's async ack rather than a
|
|
404
|
+
* synchronous same-tick fire. `data` is captured from the echo so a later
|
|
405
|
+
* write can't retroactively change what this ack reports. COMPAT firestore#85.
|
|
406
|
+
*/
|
|
407
|
+
private scheduleDocMetadataAck;
|
|
408
|
+
private notifyQueryListener;
|
|
409
|
+
/**
|
|
410
|
+
* Item 3 — query counterpart of {@link scheduleDocMetadataAck}. Re-delivers
|
|
411
|
+
* the echoed doc set with `hasPendingWrites:false` as a metadata-only change
|
|
412
|
+
* (no added/modified/removed — `prevDocs` equals the current docs), for
|
|
413
|
+
* includeMetadataChanges listeners only. COMPAT firestore#85.
|
|
414
|
+
*/
|
|
415
|
+
private scheduleQueryMetadataAck;
|
|
416
|
+
/**
|
|
417
|
+
* Run a `get` through the rules without touching the event log.
|
|
418
|
+
* Returns the read shape used by listener-snapshot construction.
|
|
419
|
+
*
|
|
420
|
+
* Throws `SimulatorUnsupportedError` on UNSUPPORTED — same loud
|
|
421
|
+
* surface as {@link execute}; the caller is then responsible for
|
|
422
|
+
* propagating it. Listener-init paths catch nothing: an unsupported
|
|
423
|
+
* rule is a sandbox limitation worth surfacing to the agent
|
|
424
|
+
* verbatim, not silently rerouting through `errorCallback`.
|
|
425
|
+
*/
|
|
426
|
+
private silentReadDoc;
|
|
427
|
+
/**
|
|
428
|
+
* RULES-B11 — the parsed rules AST for the query-proof gate, cached
|
|
429
|
+
* per source string. `null` when the source doesn't parse (the
|
|
430
|
+
* simulate() call then reports the failure on its own).
|
|
431
|
+
*/
|
|
432
|
+
private rulesAst;
|
|
433
|
+
/**
|
|
434
|
+
* Collection variant of {@link silentReadDoc}. Returns docs in
|
|
435
|
+
* `LocalState.list` order. Phantom parents are dropped here;
|
|
436
|
+
* agent-visible snapshots only contain real docs.
|
|
437
|
+
*
|
|
438
|
+
* **RULES-B11 — query-proof enforcement ("rules are not filters").**
|
|
439
|
+
* Production never filters a query down to the readable subset: the
|
|
440
|
+
* `list` rule is proven against the query's constraints, and an
|
|
441
|
+
* unprovable query is DENIED whole (firebase.google.com/docs/firestore/
|
|
442
|
+
* security/rules-query). The gate here:
|
|
443
|
+
* 1. `proveListQuery` decides PROVABLE / UNPROVABLE from the matched
|
|
444
|
+
* `list`/`read` rule conditions + the structured `where`
|
|
445
|
+
* constraints carried on the applier (FS-B2 threading).
|
|
446
|
+
* 2. UNPROVABLE → one deny request event + `permission-denied` for
|
|
447
|
+
* the WHOLE query — no silent truncation.
|
|
448
|
+
* 3. PROVABLE → the ordinary simulate() run evaluates the residual
|
|
449
|
+
* (auth / time / request.query) condition; doc-data conjuncts the
|
|
450
|
+
* query pins are evaluated against the synthetic representative
|
|
451
|
+
* resource (see `list-query-proof.ts`).
|
|
452
|
+
* Per-doc `get` rules do NOT filter query results — prod queries are
|
|
453
|
+
* governed by the `list` rule alone (the old per-doc filter loop was
|
|
454
|
+
* the rules-as-filters divergence this replaces). UNSUPPORTED still
|
|
455
|
+
* bubbles through unchanged.
|
|
456
|
+
*/
|
|
457
|
+
private silentReadCollection;
|
|
458
|
+
/**
|
|
459
|
+
* RULES-B11 — apply a PROVABLE proof to the `list` test case before the
|
|
460
|
+
* residual simulate() run:
|
|
461
|
+
* - inject the synthetic representative `resource` (the fields the
|
|
462
|
+
* query pins with `where(field, ==, value)`) so doc-data conjuncts
|
|
463
|
+
* evaluate against what every returnable doc is guaranteed to carry;
|
|
464
|
+
* - populate `request.query` from the structured constraints so rules
|
|
465
|
+
* reading `request.query.limit` / `.orderBy` see the real values.
|
|
466
|
+
*/
|
|
467
|
+
private applyListProof;
|
|
468
|
+
/**
|
|
469
|
+
* Mark a listener as errored and fan the error out to two channels:
|
|
470
|
+
* 1. The listener's own `errorCallback` (per-listener handler the
|
|
471
|
+
* Web SDK consumer registered via `onSnapshot(next, error)`).
|
|
472
|
+
* 2. Every env-level `onSnapshotError` subscriber (Slice 7) — the
|
|
473
|
+
* playground UI surfaces stream errors here without each
|
|
474
|
+
* listener needing to register its own toast handler.
|
|
475
|
+
*
|
|
476
|
+
* Fan-out is unconditional even when `errorCallback` is missing: the
|
|
477
|
+
* env-level channel is the catch-all so the host environment can
|
|
478
|
+
* surface errors from listeners that didn't supply their own handler.
|
|
479
|
+
*/
|
|
480
|
+
private markErrored;
|
|
481
|
+
/**
|
|
482
|
+
* Test seam — exposes registry size without leaking the records.
|
|
483
|
+
* Slice 2+ may add a richer accessor when the diff path needs to
|
|
484
|
+
* iterate; for now this is enough to assert add/remove correctness.
|
|
485
|
+
*/
|
|
486
|
+
getSnapshotListenerCount(): number;
|
|
487
|
+
/**
|
|
488
|
+
* Tear down the environment's listener registries (Slice 8).
|
|
489
|
+
*
|
|
490
|
+
* Clears every snapshot listener, denial subscriber, and snapshot-error
|
|
491
|
+
* subscriber so the environment drops its references to consumer
|
|
492
|
+
* callbacks. Use case: a host (e.g. the playground runner) is about to
|
|
493
|
+
* discard this `LocalEnvironment` in favor of a fresh one — calling
|
|
494
|
+
* `dispose()` first guarantees that any orphan callbacks held by the
|
|
495
|
+
* outgoing env can no longer be invoked, even if some external code path
|
|
496
|
+
* still holds a reference to the old instance.
|
|
497
|
+
*
|
|
498
|
+
* Idempotent: clearing already-empty sets is a no-op. Does not touch
|
|
499
|
+
* data state (`state` / `eventLog` / `rulesSource`) — `dispose()` is
|
|
500
|
+
* about *callback ownership*, not data lifecycle. Construct a fresh
|
|
501
|
+
* `LocalEnvironment` (or call `seed()`) to reset data.
|
|
502
|
+
*/
|
|
503
|
+
dispose(): void;
|
|
504
|
+
/** Seed the environment with rules and initial data. */
|
|
505
|
+
seed(options: {
|
|
506
|
+
rules: string;
|
|
507
|
+
documents?: Record<string, DocumentData>;
|
|
508
|
+
baseDocuments?: Record<string, DocumentData>;
|
|
509
|
+
}): LintResult;
|
|
510
|
+
/**
|
|
511
|
+
* Deploy new rules (re-lint, swap for next operation).
|
|
512
|
+
*
|
|
513
|
+
* **Slice 6 — re-evaluation.** After a successful swap, every active
|
|
514
|
+
* listener is re-evaluated under the new rules. This **diverges from
|
|
515
|
+
* production** (where rule changes don't affect already-attached
|
|
516
|
+
* listeners) and is intentional per the design rationale
|
|
517
|
+
* section 4.1 — the playground's value is seeing rule changes reflected
|
|
518
|
+
* immediately in live UI. Concretely:
|
|
519
|
+
* - A doc that was unreadable but is now readable fires a snapshot
|
|
520
|
+
* (and clears the listener's `errored` flag if applicable).
|
|
521
|
+
* - A doc that was readable but is now unreadable marks the listener
|
|
522
|
+
* errored via {@link markErrored}.
|
|
523
|
+
* - Query listeners diff old↔new readable doc sets; flips surface as
|
|
524
|
+
* `added` / `removed` change entries.
|
|
525
|
+
*/
|
|
526
|
+
deployRules(source: string): LintResult;
|
|
527
|
+
/**
|
|
528
|
+
* Walk every active listener and recompute its snapshot under the
|
|
529
|
+
* current rules. Called by {@link deployRules} after a successful
|
|
530
|
+
* rules swap (Slice 6 section 4.1). Iteration follows the same
|
|
531
|
+
* snapshot-then-skip-orphans pattern as {@link notifyListenersForPaths}
|
|
532
|
+
* — a callback may add or remove listeners (StrictMode + HMR both
|
|
533
|
+
* routinely do this), and the dispatch loop must not iterate a
|
|
534
|
+
* mutating Map.
|
|
535
|
+
*/
|
|
536
|
+
private reEvaluateAllListeners;
|
|
537
|
+
/**
|
|
538
|
+
* Re-evaluate every LIVE listener against a new session auth.
|
|
539
|
+
*
|
|
540
|
+
* Called when the sandbox's `currentUser` changes (sign-out / sign-in
|
|
541
|
+
* as a different user). Production re-establishes the listen stream on
|
|
542
|
+
* a session auth change — an auth-gated listener loses access on
|
|
543
|
+
* sign-out and re-reads under the new identity on sign-in. The sandbox
|
|
544
|
+
* matches that here: for each listener with `followsCurrentUser`, we
|
|
545
|
+
* set `record.auth = newAuth` and re-run the SAME per-listener
|
|
546
|
+
* evaluation `deployRules` uses ({@link reEvaluateDocListener} /
|
|
547
|
+
* {@link reEvaluateQueryListener}) — which re-reads under the new auth
|
|
548
|
+
* and flips allowed↔denied (delivering a fresh snapshot, or marking
|
|
549
|
+
* the listener errored with `permission-denied` when the new auth
|
|
550
|
+
* can't read).
|
|
551
|
+
*
|
|
552
|
+
* Frozen-ctx listeners (`followsCurrentUser === false`) are left
|
|
553
|
+
* untouched — they stay pinned to the identity chosen at
|
|
554
|
+
* `getFirestore(ctx)` time. WRITE-driven re-eval is unaffected: a
|
|
555
|
+
* write by another user still re-evaluates each listener against ITS
|
|
556
|
+
* OWN captured `auth` (this method only runs on auth change, and only
|
|
557
|
+
* touches live listeners' captured auth).
|
|
558
|
+
*
|
|
559
|
+
* No-op when there are no live listeners. Iteration follows the same
|
|
560
|
+
* snapshot-then-skip-orphans pattern as {@link notifyListenersForPaths}
|
|
561
|
+
* — a callback may add or remove listeners during dispatch.
|
|
562
|
+
*/
|
|
563
|
+
reevaluateLiveListeners(newAuth: ListenerAuth): void;
|
|
564
|
+
/**
|
|
565
|
+
* Doc-listener re-evaluation. Three flip cases matter:
|
|
566
|
+
* - Allowed → denied: mark errored (unless already errored, in which
|
|
567
|
+
* case the error is not re-delivered — matches production's
|
|
568
|
+
* once-per-stream error contract).
|
|
569
|
+
* - Errored → allowed: clear `errored` and fire as an initial
|
|
570
|
+
* snapshot (the listener gets a fresh baseline; suppression cannot
|
|
571
|
+
* apply because there is no comparable `currentDocData` from the
|
|
572
|
+
* errored state).
|
|
573
|
+
* - Allowed → allowed: behaves like a write-driven re-fire — diff
|
|
574
|
+
* against `currentDocData` and suppress if unchanged.
|
|
575
|
+
*/
|
|
576
|
+
private reEvaluateDocListener;
|
|
577
|
+
/**
|
|
578
|
+
* Query-listener re-evaluation. Flip semantics mirror the doc path:
|
|
579
|
+
* {@link silentReadCollection} re-runs the query-proof gate + `list`
|
|
580
|
+
* rule under the new rules — a query that flipped unprovable/denied
|
|
581
|
+
* surfaces as a stream error, one that flipped allowed re-delivers,
|
|
582
|
+
* and the diff against `currentDocs` is computed by the same
|
|
583
|
+
* `buildQuerySnapshot` path the write-driven notifier uses.
|
|
584
|
+
*/
|
|
585
|
+
private reEvaluateQueryListener;
|
|
586
|
+
/** Get current rules source. */
|
|
587
|
+
getRules(): string;
|
|
588
|
+
/** Read a document from local state (admin, no rules). */
|
|
589
|
+
getDocument(path: string): DocumentData | null;
|
|
590
|
+
/**
|
|
591
|
+
* List documents in a collection (admin, no rules).
|
|
592
|
+
*
|
|
593
|
+
* Includes phantom parent docs (records synthesized for any parent path
|
|
594
|
+
* that has descendants but no stored data of its own). Phantom records
|
|
595
|
+
* carry `phantom: true` and `data: {}` so the discover crawler — which
|
|
596
|
+
* walks structure rather than data — sees the same shape live Firestore
|
|
597
|
+
* would expose. See {@link LocalState#list} for the contract.
|
|
598
|
+
*/
|
|
599
|
+
listDocuments(collection: string): {
|
|
600
|
+
path: string;
|
|
601
|
+
data: DocumentData;
|
|
602
|
+
phantom?: true;
|
|
603
|
+
}[];
|
|
604
|
+
/**
|
|
605
|
+
* Scan documents under a path through the {@link DocStore} seam (admin, no
|
|
606
|
+
* rules). The query engine gathers candidates with `{ directOnly: true }` for
|
|
607
|
+
* a collection's real direct children (no phantoms); the discover crawler
|
|
608
|
+
* still uses {@link listDocuments}, which adds phantom parents.
|
|
609
|
+
*/
|
|
610
|
+
scanDocuments(prefix: string, opts?: ScanOptions): DocEntry[];
|
|
611
|
+
/**
|
|
612
|
+
* Rule-enforced collection read — the query (`getDocs` / `Query.get` /
|
|
613
|
+
* aggregate) read path for the web-modular + auth-scoped admin-compat
|
|
614
|
+
* surfaces. **Unlike {@link listDocuments} this evaluates security
|
|
615
|
+
* rules** (FS-B1 / RULES-B1): query reads must not be a silent total
|
|
616
|
+
* bypass when single-doc reads (`DocumentReference.get`) are enforced.
|
|
617
|
+
*
|
|
618
|
+
* Semantics mirror the listener read path ({@link silentReadCollection}):
|
|
619
|
+
* 1. RULES-B11 — prove the query against the matched `list` rule
|
|
620
|
+
* ("rules are not filters"): an unprovable query returns
|
|
621
|
+
* `{ allowed: false, error }` for the WHOLE query — the caller
|
|
622
|
+
* throws `permission-denied`. No silent truncation.
|
|
623
|
+
* 2. Evaluate the `list` rule's residual condition once under `auth`
|
|
624
|
+
* (with the synthetic representative resource when the proof
|
|
625
|
+
* pinned doc-data fields). A denial (or simulator error) returns
|
|
626
|
+
* `{ allowed: false, error }`.
|
|
627
|
+
* 3. On PASS every candidate is returned — production queries are
|
|
628
|
+
* governed by the `list` rule alone; per-doc `get` rules do not
|
|
629
|
+
* filter query results.
|
|
630
|
+
*
|
|
631
|
+
* `candidates` is supplied by the caller so collection-group queries
|
|
632
|
+
* (whose candidate set is a cross-collection scan, not a single
|
|
633
|
+
* `state.list`) can reuse the same enforcement. `listPath` is the
|
|
634
|
+
* collection path the `list` rule evaluates against; for
|
|
635
|
+
* collection-group reads the caller passes the group id's match path.
|
|
636
|
+
* `query` is the structured `where`/`limit`/`orderBy` view the proof
|
|
637
|
+
* consumes (the caller still applies the actual row filtering).
|
|
638
|
+
*
|
|
639
|
+
* Emits `origin: 'user'` request events (one per `list`) so inspector
|
|
640
|
+
* consumers see query reads the same way they see writes. UNSUPPORTED
|
|
641
|
+
* rules still bubble as {@link SimulatorUnsupportedError}.
|
|
642
|
+
*/
|
|
643
|
+
readQueryCandidates(candidates: {
|
|
644
|
+
path: string;
|
|
645
|
+
data: DocumentData;
|
|
646
|
+
}[], listPath: string, auth: Operation['auth'], query?: QueryConstraints, bypassRules?: boolean): {
|
|
647
|
+
allowed: true;
|
|
648
|
+
docs: {
|
|
649
|
+
path: string;
|
|
650
|
+
data: DocumentData;
|
|
651
|
+
}[];
|
|
652
|
+
} | {
|
|
653
|
+
allowed: false;
|
|
654
|
+
error: FirestoreSimError;
|
|
655
|
+
};
|
|
656
|
+
/**
|
|
657
|
+
* List root collection IDs derived from the in-memory keyspace.
|
|
658
|
+
* Used by the discover/crawler adapter so `firestore_discover_paths`
|
|
659
|
+
* can run against the simulator without hitting live Firestore.
|
|
660
|
+
*/
|
|
661
|
+
listRootCollections(): string[];
|
|
662
|
+
/**
|
|
663
|
+
* List subcollection IDs underneath the given document path.
|
|
664
|
+
* Companion to {@link listRootCollections} for the discover/crawler adapter.
|
|
665
|
+
*/
|
|
666
|
+
listSubcollections(docPath: string): string[];
|
|
667
|
+
/** Get full state snapshot. */
|
|
668
|
+
snapshot(): Record<string, DocumentData>;
|
|
669
|
+
/**
|
|
670
|
+
* Capture the prior state of just the given paths (for single-write / batch
|
|
671
|
+
* undo), as `{ path: priorData | null }` where `null` records a doc that did
|
|
672
|
+
* not exist. The affected-path alternative to a whole-keyspace
|
|
673
|
+
* {@link snapshot}, so the undo stack stays O(affected) not O(keyspace).
|
|
674
|
+
* Must be called BEFORE the write applies.
|
|
675
|
+
*/
|
|
676
|
+
private capturePriors;
|
|
677
|
+
/**
|
|
678
|
+
* Replace a document at `path` (admin, no rules). `set` semantics —
|
|
679
|
+
* creates if absent, overwrites if present, no merge. Wakes any
|
|
680
|
+
* active listeners attached to `path` so subscriptions see the
|
|
681
|
+
* change live, mirroring what a rule-allowed `set` would do.
|
|
682
|
+
*/
|
|
683
|
+
adminSetDocument(path: string, data: DocumentData): void;
|
|
684
|
+
/**
|
|
685
|
+
* Delete a document at `path` (admin, no rules). Returns
|
|
686
|
+
* `{ deleted }` reflecting whether a doc was actually removed
|
|
687
|
+
* (`false` if the path didn't exist). Idempotent — a no-op on a
|
|
688
|
+
* missing path does not throw. Wakes listeners on `path`.
|
|
689
|
+
*/
|
|
690
|
+
adminDeleteDocument(path: string): {
|
|
691
|
+
deleted: boolean;
|
|
692
|
+
};
|
|
693
|
+
/**
|
|
694
|
+
* Run the rules engine for the given test cases — UNLESS `bypassRules`
|
|
695
|
+
* is set, in which case the rules engine is skipped entirely and a
|
|
696
|
+
* synthetic all-ALLOW result is returned (Pyric Studio Gap #2 admin
|
|
697
|
+
* lens). Every `simulate()` call site in `execute` / `batch` /
|
|
698
|
+
* `transaction` routes through here so the bypass is centralized and
|
|
699
|
+
* the rules-enforced path is byte-for-byte unchanged when `bypassRules`
|
|
700
|
+
* is absent/false.
|
|
701
|
+
*
|
|
702
|
+
* The synthetic result mirrors the engine's success shape
|
|
703
|
+
* (`{ success: true, data: { results, passed, failed, unsupported } }`)
|
|
704
|
+
* with one PASSED entry per test case, so callers that read
|
|
705
|
+
* `simResult.data.results[i]` see a normal ALLOW with no special-casing.
|
|
706
|
+
*/
|
|
707
|
+
private runSimulate;
|
|
708
|
+
/** Execute a single operation. Rules are evaluated against local state.
|
|
709
|
+
* When `operation.bypassRules` is set, rule evaluation is skipped (admin
|
|
710
|
+
* lens — Studio Gap #2): the op is treated as ALLOW and routed through
|
|
711
|
+
* the same apply + emit path, so structural preconditions, events, and
|
|
712
|
+
* listeners behave exactly as a rule-allowed op would. */
|
|
713
|
+
execute(operation: Operation): OperationResult;
|
|
714
|
+
/**
|
|
715
|
+
* Item 7 — `addDoc()`-style create with a Firestore-compatible auto ID.
|
|
716
|
+
*
|
|
717
|
+
* Mirrors the live SDK's `addDoc(collection(db, c), data)` flow: mint a
|
|
718
|
+
* 20-char alphanumeric document ID, append it to the collection path,
|
|
719
|
+
* then run the same `execute({ method: 'create', ... })` pipeline that
|
|
720
|
+
* an explicit-ID create would (rules, sentinel resolution, applyWrite).
|
|
721
|
+
* The minted path is returned so callers can re-read the doc without
|
|
722
|
+
* having to capture the ID via a side channel.
|
|
723
|
+
*/
|
|
724
|
+
createWithAutoId(collection: string, data: DocumentData, auth: Operation['auth'], bypassRules?: boolean): {
|
|
725
|
+
path: string;
|
|
726
|
+
result: OperationResult;
|
|
727
|
+
};
|
|
728
|
+
/** Execute multiple writes atomically. All must pass rules or none apply. */
|
|
729
|
+
batch(operations: BatchOperationInput[], auth: Operation['auth'], bypassRules?: boolean): BatchResult;
|
|
730
|
+
/**
|
|
731
|
+
* Run a callback inside a Firestore-style transaction.
|
|
732
|
+
*
|
|
733
|
+
* The callback may be synchronous or async — return a `Promise` and
|
|
734
|
+
* the method returns `Promise<TransactionResult<R>>`; return a value
|
|
735
|
+
* (or void) and the method returns `TransactionResult<R>` directly.
|
|
736
|
+
* This mirrors the Admin SDK's `runTransaction(fn)` signature, which
|
|
737
|
+
* accepts both shapes.
|
|
738
|
+
*
|
|
739
|
+
* Lifecycle:
|
|
740
|
+
* 1. Build a `TransactionContext` with the read callback bound to
|
|
741
|
+
* `this.state.get` (admin-mode reads, no rules eval — probe 0.B).
|
|
742
|
+
* 2. Invoke `fn(tx)`. If it returns a Promise, await before
|
|
743
|
+
* continuing — sentinel resolution, rules eval, and applyBatch
|
|
744
|
+
* all happen AFTER the callback fully resolves.
|
|
745
|
+
* - Throws (including `ReadAfterWriteError` from probe 0.A/0.J,
|
|
746
|
+
* `AmbiguousPostDeleteWriteError` from the merge layer, or any
|
|
747
|
+
* user error) propagate unchanged after an aborted-tx event is
|
|
748
|
+
* logged. Probe 0.G: custom Error properties survive.
|
|
749
|
+
* 3. Merge same-path queued writes (Item 1.3) into `BatchOperation[]`.
|
|
750
|
+
* 4. Resolve sentinels against pre-tx state (one `serverTime` for the
|
|
751
|
+
* whole tx — mirrors `batch()` semantics). For async callbacks
|
|
752
|
+
* `serverTime` is pinned at commit time, AFTER the await — so
|
|
753
|
+
* `serverTimestamp()` reflects when the writes are actually
|
|
754
|
+
* committed, not when the read happened.
|
|
755
|
+
* 5. Per-op rules evaluation against PRE-tx state. No inter-write
|
|
756
|
+
* visibility (extrapolated from batch parity, probe 0.E). For a
|
|
757
|
+
* queued `set`, rules eval under `create` if the doc is missing
|
|
758
|
+
* pre-tx, else `update` — `applyBatch` still runs the `set` op.
|
|
759
|
+
* 6. If every write passes rules, run `applyBatch` atomically.
|
|
760
|
+
* Structural failures (create-already-exists, update/delete-
|
|
761
|
+
* missing) demote per-op `allowed` and surface typed errors —
|
|
762
|
+
* matches single-op + batch behavior.
|
|
763
|
+
* 7. Append a single `type: 'transaction'` `AgentEvent` carrying
|
|
764
|
+
* `reads[]`, `operations[]`, and a pre-tx snapshot for undo.
|
|
765
|
+
*/
|
|
766
|
+
transaction<R>(fn: (tx: Transaction) => Promise<R>, options: TransactionOptions): Promise<TransactionResult<R>>;
|
|
767
|
+
transaction<R>(fn: (tx: Transaction) => R, options: TransactionOptions): TransactionResult<R>;
|
|
768
|
+
/**
|
|
769
|
+
* Commit phase shared by sync + async transaction paths. Runs after
|
|
770
|
+
* the callback has fully completed (sync return or awaited resolve).
|
|
771
|
+
* Splitting this out keeps `transaction()` readable and keeps the
|
|
772
|
+
* commit logic from being duplicated across the two branches.
|
|
773
|
+
*/
|
|
774
|
+
private commitTransaction;
|
|
775
|
+
/**
|
|
776
|
+
* Append an aborted-transaction event for a callback throw (sync or
|
|
777
|
+
* async path). The original Error is re-thrown by the caller —
|
|
778
|
+
* probe 0.G locks "exceptions propagate unchanged", so this helper
|
|
779
|
+
* never throws on its own.
|
|
780
|
+
*/
|
|
781
|
+
private logAbortedTransaction;
|
|
782
|
+
/** Undo the last write operation. Restores the affected paths (single-write /
|
|
783
|
+
* batch) or the whole keyspace (transaction) to their pre-write state. */
|
|
784
|
+
undo(): AgentEvent | null;
|
|
785
|
+
/** Redo the last undone operation. Re-applies the write directly
|
|
786
|
+
* without going through execute() (which would clear the redo stack). */
|
|
787
|
+
redo(): OperationResult | null;
|
|
788
|
+
/** Get all events. */
|
|
789
|
+
getEvents(): AgentEvent[];
|
|
790
|
+
/** Get event count. */
|
|
791
|
+
getEventCount(): number;
|
|
792
|
+
private buildTestCase;
|
|
793
|
+
/**
|
|
794
|
+
* Apply a write to local state, returning a structural error when
|
|
795
|
+
* the underlying state operation rejects (Item 6). Rules have already
|
|
796
|
+
* decided to ALLOW by the time we get here; what's left are the
|
|
797
|
+
* preconditions only the keyspace knows about — `create` of an
|
|
798
|
+
* existing path, `update`/`delete` of a missing path. The simulator
|
|
799
|
+
* previously dropped these silently (state.create returned
|
|
800
|
+
* `{success:false}` and we ignored it), which let `allowed:true`
|
|
801
|
+
* results coexist with no actual mutation. Returning the failure
|
|
802
|
+
* lets `execute()` demote `allowed` and surface the right error code.
|
|
803
|
+
*/
|
|
804
|
+
private applyWrite;
|
|
805
|
+
}
|
|
806
|
+
//# sourceMappingURL=local-environment.d.ts.map
|