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,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write-boundary value resolver — central pass that runs over every value
|
|
3
|
+
* tree about to enter {@link LocalState}.
|
|
4
|
+
*
|
|
5
|
+
* Why this exists:
|
|
6
|
+
* The simulator stores plain JS objects but agents seed/write values
|
|
7
|
+
* that need normalization before either rules or storage see them:
|
|
8
|
+
* - `Date` / `Timestamp` instances must round-trip with the right
|
|
9
|
+
* wire type (Item 1).
|
|
10
|
+
* - `serverTimestamp()`, `increment()`, `arrayUnion/Remove()`,
|
|
11
|
+
* `deleteField()` sentinels must be resolved against prior doc
|
|
12
|
+
* state (Item 2).
|
|
13
|
+
* - `DocumentReference`, `VectorValue` need wrapper conversion
|
|
14
|
+
* (Items 3, 5).
|
|
15
|
+
*
|
|
16
|
+
* Doing each of these in five different write methods is a recipe for
|
|
17
|
+
* drift. Item 0 introduces a single chokepoint: every value about to
|
|
18
|
+
* land in storage passes through {@link resolveValueTree} first.
|
|
19
|
+
*
|
|
20
|
+
* Design — registry of converters:
|
|
21
|
+
* Items 1, 2, 3, 5 each register a {@link ValueConverter}. Converters
|
|
22
|
+
* inspect a value and either substitute it (returning the replacement)
|
|
23
|
+
* or decline (returning {@link KEEP}). The resolver tries converters in
|
|
24
|
+
* registration order; if none claim the value, plain objects and arrays
|
|
25
|
+
* are walked recursively. Class instances the resolver doesn't recognize
|
|
26
|
+
* pass through unchanged.
|
|
27
|
+
*
|
|
28
|
+
* Idempotency contract:
|
|
29
|
+
* Every converter MUST no-op on its own output. This lets multiple
|
|
30
|
+
* layers (LocalEnvironment.execute pre-rules, LocalState.write
|
|
31
|
+
* pre-storage) call the resolver without double-applying conversions.
|
|
32
|
+
* The Item 0 test contract verifies the empty-registry case is itself
|
|
33
|
+
* idempotent.
|
|
34
|
+
*
|
|
35
|
+
* Today (Item 0) the registry is empty — the resolver is an identity
|
|
36
|
+
* walk. Wiring is in place so Items 1+ are pure additions.
|
|
37
|
+
*/
|
|
38
|
+
export type DocumentData = Record<string, unknown>;
|
|
39
|
+
/** Operation that triggered the resolve. Converters can branch on this. */
|
|
40
|
+
export type ResolveMethod = 'seed' | 'create' | 'update' | 'set';
|
|
41
|
+
export interface ResolveContext {
|
|
42
|
+
/** Doc path being written (e.g., `users/u1`). */
|
|
43
|
+
path: string;
|
|
44
|
+
/** Method that triggered the resolve. */
|
|
45
|
+
method: ResolveMethod;
|
|
46
|
+
/** Prior doc state at `path`, or `null` if the doc did not exist. */
|
|
47
|
+
prior: DocumentData | null;
|
|
48
|
+
/**
|
|
49
|
+
* Dotted field path inside the doc; empty string for the root map.
|
|
50
|
+
* Array indices are bracketed: `tags[0]`, `users.profile.name`.
|
|
51
|
+
* Used by sentinel converters that need to read prior at the right
|
|
52
|
+
* field (e.g., `increment` reads `prior.<fieldPath>`).
|
|
53
|
+
*/
|
|
54
|
+
fieldPath: string;
|
|
55
|
+
/**
|
|
56
|
+
* Server time for this write, if the caller wants every
|
|
57
|
+
* `serverTimestamp()` sentinel in the tree to resolve to the SAME
|
|
58
|
+
* Timestamp instance. `LocalEnvironment.execute` plumbs this in (Item 1)
|
|
59
|
+
* so `request.resource.data.createdAt == request.time` works
|
|
60
|
+
* deterministically. Direct `LocalState.write` calls leave it
|
|
61
|
+
* undefined; sentinel converters fall back to `Timestamp.fromMillis(
|
|
62
|
+
* Date.now())` per call.
|
|
63
|
+
*
|
|
64
|
+
* Type is `unknown` here to keep the resolver core decoupled from
|
|
65
|
+
* the wrappers package. Converters cast as needed.
|
|
66
|
+
*/
|
|
67
|
+
serverTime?: unknown;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Sentinel returned by converters that decline to claim a value. Using a
|
|
71
|
+
* Symbol rather than `undefined` lets converters legitimately substitute
|
|
72
|
+
* `undefined` if they ever need to (e.g., `deleteField()` resolution).
|
|
73
|
+
*/
|
|
74
|
+
export declare const KEEP: unique symbol;
|
|
75
|
+
export type Keep = typeof KEEP;
|
|
76
|
+
/**
|
|
77
|
+
* Sentinel substituted by the deleteField converter (Item 2). The
|
|
78
|
+
* resolver returns this in place of `{ __type: 'deleteField' }`; the
|
|
79
|
+
* write layer ({@link partitionDeletes}) then strips these markers
|
|
80
|
+
* out of the value tree and surfaces the affected top-level keys to
|
|
81
|
+
* `LocalState` so the existing field is removed from storage.
|
|
82
|
+
*
|
|
83
|
+
* Why a symbol rather than another `__type` object: it cannot
|
|
84
|
+
* accidentally collide with user data, it survives a structuredClone-
|
|
85
|
+
* free copy intact (the resolver doesn't clone its outputs), and it
|
|
86
|
+
* makes idempotency trivial — the converter only matches the sentinel
|
|
87
|
+
* shape, never the marker.
|
|
88
|
+
*/
|
|
89
|
+
export declare const DELETE_MARKER: unique symbol;
|
|
90
|
+
export type DeleteMarker = typeof DELETE_MARKER;
|
|
91
|
+
export interface ValueConverter {
|
|
92
|
+
/** Name surfaced in diagnostics; must be unique across registrations. */
|
|
93
|
+
name: string;
|
|
94
|
+
/**
|
|
95
|
+
* Inspect a value. Return any value to substitute it (the resolver
|
|
96
|
+
* does NOT descend into the substituted value — converters own their
|
|
97
|
+
* output). Return {@link KEEP} to decline; the resolver tries the next
|
|
98
|
+
* converter, then descends into containers.
|
|
99
|
+
*/
|
|
100
|
+
convert(value: unknown, ctx: ResolveContext): unknown | Keep;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Register a converter. Idempotent on `name` — re-registering the same
|
|
104
|
+
* named converter is a no-op. Item modules register their converters via
|
|
105
|
+
* {@link registerDefaultConverters} on simulator startup.
|
|
106
|
+
*/
|
|
107
|
+
export declare function registerConverter(c: ValueConverter): void;
|
|
108
|
+
/** For tests only — clears the registry. Production code never calls this. */
|
|
109
|
+
export declare function _clearConvertersForTest(): void;
|
|
110
|
+
/** Snapshot of registered converter names. Diagnostics + test introspection. */
|
|
111
|
+
export declare function listConverters(): string[];
|
|
112
|
+
/**
|
|
113
|
+
* Resolve a full document tree. Walks each top-level field with the
|
|
114
|
+
* resolver, returning a new object — never mutates input.
|
|
115
|
+
*/
|
|
116
|
+
export declare function resolveValueTree(data: DocumentData, ctx: Omit<ResolveContext, 'fieldPath'>): DocumentData;
|
|
117
|
+
/**
|
|
118
|
+
* Resolve a single value. Exported for converter unit tests; production
|
|
119
|
+
* code should call {@link resolveValueTree}.
|
|
120
|
+
*/
|
|
121
|
+
export declare function resolveValue(value: unknown, ctx: ResolveContext): unknown;
|
|
122
|
+
/**
|
|
123
|
+
* Plain-object detection: an object literal whose prototype chain is
|
|
124
|
+
* `Object.prototype` (or null, for `Object.create(null)`). Class
|
|
125
|
+
* instances like `Date`, `Timestamp`, `DocumentReference` deliberately
|
|
126
|
+
* fall through to converter-or-identity handling — the resolver should
|
|
127
|
+
* not silently strip their prototype by walking them as plain maps.
|
|
128
|
+
*/
|
|
129
|
+
export declare function isPlainObject(value: unknown): value is DocumentData;
|
|
130
|
+
/**
|
|
131
|
+
* Item 2 — split a resolved tree into "values to write" and "fields to
|
|
132
|
+
* delete" by walking it for {@link DELETE_MARKER} sentinels.
|
|
133
|
+
*
|
|
134
|
+
* For top-level keys whose value is `DELETE_MARKER`, the key is removed
|
|
135
|
+
* from `writes` and added to `deletedKeys`. For nested occurrences, the
|
|
136
|
+
* marker is stripped from its containing object so it never lands in
|
|
137
|
+
* storage. Arrays are not a Firestore-idiomatic place for deleteField,
|
|
138
|
+
* but for safety any nested marker inside an array is dropped (the
|
|
139
|
+
* array is rebuilt without the deleted element to avoid leaving a
|
|
140
|
+
* symbol in the wire payload).
|
|
141
|
+
*
|
|
142
|
+
* Idempotency: a tree that has already been partitioned contains no
|
|
143
|
+
* markers, so this is a no-op on its own output. Both
|
|
144
|
+
* `LocalEnvironment.execute` (for rule visibility) and `LocalState.write`
|
|
145
|
+
* call this; the second call sees nothing to do.
|
|
146
|
+
*
|
|
147
|
+
* Note: this top-level partition backs the `create` / non-merge `set`
|
|
148
|
+
* paths. The `update` path is handled by `field-merge.applyUpdate`, which
|
|
149
|
+
* supports dot-path deletes (`{'a.b': deleteField()}` removes the nested
|
|
150
|
+
* leaf — FS-B5) and rejects a `deleteField()` nested inside a map literal
|
|
151
|
+
* with `invalid-argument` (FS-B13), rather than silently destroying the
|
|
152
|
+
* sibling map. `partitionDeletes` itself only sees top-level markers and
|
|
153
|
+
* strips any nested ones it encounters.
|
|
154
|
+
*/
|
|
155
|
+
export declare function partitionDeletes(data: DocumentData): {
|
|
156
|
+
writes: DocumentData;
|
|
157
|
+
deletedKeys: string[];
|
|
158
|
+
};
|
|
159
|
+
export declare function stripMarkers(value: unknown): unknown;
|
|
160
|
+
/**
|
|
161
|
+
* Register every converter the simulator ships with. Called by
|
|
162
|
+
* {@link LocalEnvironment} on construction; safe to call multiple times
|
|
163
|
+
* (each `registerConverter` is idempotent on name). Items 1+ extend this
|
|
164
|
+
* function as their converters land.
|
|
165
|
+
*
|
|
166
|
+
* Converter ordering note: order matters for first-wins claiming. Items
|
|
167
|
+
* 2-5 must register their sentinel/wrapper converters BEFORE the generic
|
|
168
|
+
* plain-object descent kicks in — but converters never compete with each
|
|
169
|
+
* other in practice (they each detect a distinct shape).
|
|
170
|
+
*/
|
|
171
|
+
export declare function registerDefaultConverters(): void;
|
|
172
|
+
//# sourceMappingURL=value-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-resolver.d.ts","sourceRoot":"","sources":["../../../src/sandbox/firestore/value-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAcH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnD,2EAA2E;AAC3E,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,MAAM,EAAE,aAAa,CAAC;IACtB,qEAAqE;IACrE,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAC3B;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,IAAI,EAAE,OAAO,MAAsC,CAAC;AACjE,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC;AAE/B;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,EAAE,OAAO,MAA+C,CAAC;AACnF,MAAM,MAAM,YAAY,GAAG,OAAO,aAAa,CAAC;AAEhD,MAAM,WAAW,cAAc;IAC7B,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,GAAG,IAAI,CAAC;CAC9D;AAID;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,cAAc,GAAG,IAAI,CAGzD;AAED,8EAA8E;AAC9E,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C;AAED,gFAAgF;AAChF,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,YAAY,EAClB,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,GACrC,YAAY,CAMd;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAuBzE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAInE;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,YAAY,GACjB;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAWjD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAcpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAsBhD"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write-boundary value resolver — central pass that runs over every value
|
|
3
|
+
* tree about to enter {@link LocalState}.
|
|
4
|
+
*
|
|
5
|
+
* Why this exists:
|
|
6
|
+
* The simulator stores plain JS objects but agents seed/write values
|
|
7
|
+
* that need normalization before either rules or storage see them:
|
|
8
|
+
* - `Date` / `Timestamp` instances must round-trip with the right
|
|
9
|
+
* wire type (Item 1).
|
|
10
|
+
* - `serverTimestamp()`, `increment()`, `arrayUnion/Remove()`,
|
|
11
|
+
* `deleteField()` sentinels must be resolved against prior doc
|
|
12
|
+
* state (Item 2).
|
|
13
|
+
* - `DocumentReference`, `VectorValue` need wrapper conversion
|
|
14
|
+
* (Items 3, 5).
|
|
15
|
+
*
|
|
16
|
+
* Doing each of these in five different write methods is a recipe for
|
|
17
|
+
* drift. Item 0 introduces a single chokepoint: every value about to
|
|
18
|
+
* land in storage passes through {@link resolveValueTree} first.
|
|
19
|
+
*
|
|
20
|
+
* Design — registry of converters:
|
|
21
|
+
* Items 1, 2, 3, 5 each register a {@link ValueConverter}. Converters
|
|
22
|
+
* inspect a value and either substitute it (returning the replacement)
|
|
23
|
+
* or decline (returning {@link KEEP}). The resolver tries converters in
|
|
24
|
+
* registration order; if none claim the value, plain objects and arrays
|
|
25
|
+
* are walked recursively. Class instances the resolver doesn't recognize
|
|
26
|
+
* pass through unchanged.
|
|
27
|
+
*
|
|
28
|
+
* Idempotency contract:
|
|
29
|
+
* Every converter MUST no-op on its own output. This lets multiple
|
|
30
|
+
* layers (LocalEnvironment.execute pre-rules, LocalState.write
|
|
31
|
+
* pre-storage) call the resolver without double-applying conversions.
|
|
32
|
+
* The Item 0 test contract verifies the empty-registry case is itself
|
|
33
|
+
* idempotent.
|
|
34
|
+
*
|
|
35
|
+
* Today (Item 0) the registry is empty — the resolver is an identity
|
|
36
|
+
* walk. Wiring is in place so Items 1+ are pure additions.
|
|
37
|
+
*/
|
|
38
|
+
import { dateConverter, serverTimestampConverter } from './converters/timestamp.js';
|
|
39
|
+
import { userTimestampConverter } from './converters/user-timestamp.js';
|
|
40
|
+
import { incrementConverter, arrayUnionConverter, arrayRemoveConverter, deleteFieldConverter, } from './converters/fieldvalue.js';
|
|
41
|
+
import { documentReferenceConverter } from './converters/reference.js';
|
|
42
|
+
import { vectorValueConverter } from './converters/vector.js';
|
|
43
|
+
import { bytesConverter, geoPointConverter } from './converters/bytes-geopoint.js';
|
|
44
|
+
/**
|
|
45
|
+
* Sentinel returned by converters that decline to claim a value. Using a
|
|
46
|
+
* Symbol rather than `undefined` lets converters legitimately substitute
|
|
47
|
+
* `undefined` if they ever need to (e.g., `deleteField()` resolution).
|
|
48
|
+
*/
|
|
49
|
+
export const KEEP = Symbol('value-resolver:KEEP');
|
|
50
|
+
/**
|
|
51
|
+
* Sentinel substituted by the deleteField converter (Item 2). The
|
|
52
|
+
* resolver returns this in place of `{ __type: 'deleteField' }`; the
|
|
53
|
+
* write layer ({@link partitionDeletes}) then strips these markers
|
|
54
|
+
* out of the value tree and surfaces the affected top-level keys to
|
|
55
|
+
* `LocalState` so the existing field is removed from storage.
|
|
56
|
+
*
|
|
57
|
+
* Why a symbol rather than another `__type` object: it cannot
|
|
58
|
+
* accidentally collide with user data, it survives a structuredClone-
|
|
59
|
+
* free copy intact (the resolver doesn't clone its outputs), and it
|
|
60
|
+
* makes idempotency trivial — the converter only matches the sentinel
|
|
61
|
+
* shape, never the marker.
|
|
62
|
+
*/
|
|
63
|
+
export const DELETE_MARKER = Symbol('value-resolver:DELETE_MARKER');
|
|
64
|
+
const converters = [];
|
|
65
|
+
/**
|
|
66
|
+
* Register a converter. Idempotent on `name` — re-registering the same
|
|
67
|
+
* named converter is a no-op. Item modules register their converters via
|
|
68
|
+
* {@link registerDefaultConverters} on simulator startup.
|
|
69
|
+
*/
|
|
70
|
+
export function registerConverter(c) {
|
|
71
|
+
if (converters.some((existing) => existing.name === c.name))
|
|
72
|
+
return;
|
|
73
|
+
converters.push(c);
|
|
74
|
+
}
|
|
75
|
+
/** For tests only — clears the registry. Production code never calls this. */
|
|
76
|
+
export function _clearConvertersForTest() {
|
|
77
|
+
converters.length = 0;
|
|
78
|
+
}
|
|
79
|
+
/** Snapshot of registered converter names. Diagnostics + test introspection. */
|
|
80
|
+
export function listConverters() {
|
|
81
|
+
return converters.map((c) => c.name);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Resolve a full document tree. Walks each top-level field with the
|
|
85
|
+
* resolver, returning a new object — never mutates input.
|
|
86
|
+
*/
|
|
87
|
+
export function resolveValueTree(data, ctx) {
|
|
88
|
+
const out = {};
|
|
89
|
+
for (const [key, value] of Object.entries(data)) {
|
|
90
|
+
out[key] = resolveValue(value, { ...ctx, fieldPath: key });
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Resolve a single value. Exported for converter unit tests; production
|
|
96
|
+
* code should call {@link resolveValueTree}.
|
|
97
|
+
*/
|
|
98
|
+
export function resolveValue(value, ctx) {
|
|
99
|
+
// First pass: offer the value to every converter in registration order.
|
|
100
|
+
for (const c of converters) {
|
|
101
|
+
const replaced = c.convert(value, ctx);
|
|
102
|
+
if (replaced !== KEEP)
|
|
103
|
+
return replaced;
|
|
104
|
+
}
|
|
105
|
+
// No converter claimed it. Descend into containers; pass through everything else.
|
|
106
|
+
if (Array.isArray(value)) {
|
|
107
|
+
return value.map((v, i) => resolveValue(v, { ...ctx, fieldPath: `${ctx.fieldPath}[${i}]` }));
|
|
108
|
+
}
|
|
109
|
+
if (isPlainObject(value)) {
|
|
110
|
+
const inner = {};
|
|
111
|
+
for (const [k, v] of Object.entries(value)) {
|
|
112
|
+
const childPath = ctx.fieldPath ? `${ctx.fieldPath}.${k}` : k;
|
|
113
|
+
inner[k] = resolveValue(v, { ...ctx, fieldPath: childPath });
|
|
114
|
+
}
|
|
115
|
+
return inner;
|
|
116
|
+
}
|
|
117
|
+
// Primitives, Dates, class instances, functions, etc. — identity.
|
|
118
|
+
return value;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Plain-object detection: an object literal whose prototype chain is
|
|
122
|
+
* `Object.prototype` (or null, for `Object.create(null)`). Class
|
|
123
|
+
* instances like `Date`, `Timestamp`, `DocumentReference` deliberately
|
|
124
|
+
* fall through to converter-or-identity handling — the resolver should
|
|
125
|
+
* not silently strip their prototype by walking them as plain maps.
|
|
126
|
+
*/
|
|
127
|
+
export function isPlainObject(value) {
|
|
128
|
+
if (value === null || typeof value !== 'object')
|
|
129
|
+
return false;
|
|
130
|
+
const proto = Object.getPrototypeOf(value);
|
|
131
|
+
return proto === Object.prototype || proto === null;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Item 2 — split a resolved tree into "values to write" and "fields to
|
|
135
|
+
* delete" by walking it for {@link DELETE_MARKER} sentinels.
|
|
136
|
+
*
|
|
137
|
+
* For top-level keys whose value is `DELETE_MARKER`, the key is removed
|
|
138
|
+
* from `writes` and added to `deletedKeys`. For nested occurrences, the
|
|
139
|
+
* marker is stripped from its containing object so it never lands in
|
|
140
|
+
* storage. Arrays are not a Firestore-idiomatic place for deleteField,
|
|
141
|
+
* but for safety any nested marker inside an array is dropped (the
|
|
142
|
+
* array is rebuilt without the deleted element to avoid leaving a
|
|
143
|
+
* symbol in the wire payload).
|
|
144
|
+
*
|
|
145
|
+
* Idempotency: a tree that has already been partitioned contains no
|
|
146
|
+
* markers, so this is a no-op on its own output. Both
|
|
147
|
+
* `LocalEnvironment.execute` (for rule visibility) and `LocalState.write`
|
|
148
|
+
* call this; the second call sees nothing to do.
|
|
149
|
+
*
|
|
150
|
+
* Note: this top-level partition backs the `create` / non-merge `set`
|
|
151
|
+
* paths. The `update` path is handled by `field-merge.applyUpdate`, which
|
|
152
|
+
* supports dot-path deletes (`{'a.b': deleteField()}` removes the nested
|
|
153
|
+
* leaf — FS-B5) and rejects a `deleteField()` nested inside a map literal
|
|
154
|
+
* with `invalid-argument` (FS-B13), rather than silently destroying the
|
|
155
|
+
* sibling map. `partitionDeletes` itself only sees top-level markers and
|
|
156
|
+
* strips any nested ones it encounters.
|
|
157
|
+
*/
|
|
158
|
+
export function partitionDeletes(data) {
|
|
159
|
+
const writes = {};
|
|
160
|
+
const deletedKeys = [];
|
|
161
|
+
for (const [key, value] of Object.entries(data)) {
|
|
162
|
+
if (value === DELETE_MARKER) {
|
|
163
|
+
deletedKeys.push(key);
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
writes[key] = stripMarkers(value);
|
|
167
|
+
}
|
|
168
|
+
return { writes, deletedKeys };
|
|
169
|
+
}
|
|
170
|
+
export function stripMarkers(value) {
|
|
171
|
+
if (value === DELETE_MARKER)
|
|
172
|
+
return undefined;
|
|
173
|
+
if (Array.isArray(value)) {
|
|
174
|
+
return value.filter((v) => v !== DELETE_MARKER).map(stripMarkers);
|
|
175
|
+
}
|
|
176
|
+
if (isPlainObject(value)) {
|
|
177
|
+
const out = {};
|
|
178
|
+
for (const [k, v] of Object.entries(value)) {
|
|
179
|
+
if (v === DELETE_MARKER)
|
|
180
|
+
continue;
|
|
181
|
+
out[k] = stripMarkers(v);
|
|
182
|
+
}
|
|
183
|
+
return out;
|
|
184
|
+
}
|
|
185
|
+
return value;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Register every converter the simulator ships with. Called by
|
|
189
|
+
* {@link LocalEnvironment} on construction; safe to call multiple times
|
|
190
|
+
* (each `registerConverter` is idempotent on name). Items 1+ extend this
|
|
191
|
+
* function as their converters land.
|
|
192
|
+
*
|
|
193
|
+
* Converter ordering note: order matters for first-wins claiming. Items
|
|
194
|
+
* 2-5 must register their sentinel/wrapper converters BEFORE the generic
|
|
195
|
+
* plain-object descent kicks in — but converters never compete with each
|
|
196
|
+
* other in practice (they each detect a distinct shape).
|
|
197
|
+
*/
|
|
198
|
+
export function registerDefaultConverters() {
|
|
199
|
+
// Item 1: Date → Timestamp + serverTimestamp sentinel resolution.
|
|
200
|
+
registerConverter(dateConverter);
|
|
201
|
+
registerConverter(serverTimestampConverter);
|
|
202
|
+
// FS-B4: a user-written compat / firebase Timestamp → rules-internal
|
|
203
|
+
// Timestamp, so it passes `is timestamp` and shares storage shape with
|
|
204
|
+
// serverTimestamp()/Date-resolved timestamps (unified comparability).
|
|
205
|
+
registerConverter(userTimestampConverter);
|
|
206
|
+
// Item 2: FieldValue sentinels (increment, arrayUnion/Remove, deleteField).
|
|
207
|
+
registerConverter(incrementConverter);
|
|
208
|
+
registerConverter(arrayUnionConverter);
|
|
209
|
+
registerConverter(arrayRemoveConverter);
|
|
210
|
+
registerConverter(deleteFieldConverter);
|
|
211
|
+
// Item 3: admin SDK DocumentReference → Reference wrapper.
|
|
212
|
+
registerConverter(documentReferenceConverter);
|
|
213
|
+
// Item 5: admin SDK VectorValue → Vector wrapper.
|
|
214
|
+
registerConverter(vectorValueConverter);
|
|
215
|
+
// Item 6: firebase/firestore Bytes + GeoPoint → rules-wrapper Bytes/LatLng.
|
|
216
|
+
// Lets `Bytes` / `GeoPoint` written via the modular SDK round-trip
|
|
217
|
+
// through the sandbox as proper instances (closes #109 + #110).
|
|
218
|
+
registerConverter(bytesConverter);
|
|
219
|
+
registerConverter(geoPointConverter);
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=value-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-resolver.js","sourceRoot":"","sources":["../../../src/sandbox/firestore/value-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,g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,yBAAyB;IACvC,kEAAkE;IAClE,iBAAiB,CAAC,aAAa,CAAC,CAAC;IACjC,iBAAiB,CAAC,wBAAwB,CAAC,CAAC;IAC5C,qEAAqE;IACrE,uEAAuE;IACvE,sEAAsE;IACtE,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;IAC1C,4EAA4E;IAC5E,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IACtC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IACvC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IACxC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IACxC,2DAA2D;IAC3D,iBAAiB,CAAC,0BAA0B,CAAC,CAAC;IAC9C,kDAAkD;IAClD,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IACxC,4EAA4E;IAC5E,mEAAmE;IACnE,gEAAgE;IAChE,iBAAiB,CAAC,cAAc,CAAC,CAAC;IAClC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type WireValue = Record<string, any>;
|
|
2
|
+
/**
|
|
3
|
+
* Encode a plain value into a single Firestore wire-format value.
|
|
4
|
+
* Throws on unsupported shapes (BigInt, Date, etc.) to surface gaps
|
|
5
|
+
* rather than silently producing wrong types.
|
|
6
|
+
*/
|
|
7
|
+
export declare function encodeValue(v: unknown): WireValue;
|
|
8
|
+
/**
|
|
9
|
+
* Encode a full DocumentData record into the `_fieldsProto` shape.
|
|
10
|
+
* Each top-level key becomes a wire value at the same key.
|
|
11
|
+
*/
|
|
12
|
+
export declare function encodeFieldsProto(data: Record<string, unknown>): Record<string, WireValue>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=wire-encoder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire-encoder.d.ts","sourceRoot":"","sources":["../../../src/sandbox/firestore/wire-encoder.ts"],"names":[],"mappings":"AAmCA,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAErC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,SAAS,CAiFjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAM1F"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire-format encoder — synthesizes Firestore `_fieldsProto` from plain
|
|
3
|
+
* JavaScript values stored in {@link LocalState}.
|
|
4
|
+
*
|
|
5
|
+
* Background: `firestore_discover_paths` reads document type information
|
|
6
|
+
* from `DocumentSnapshot._fieldsProto` (Phase 0.A lock — fail loud if
|
|
7
|
+
* absent, never silently fall back to `data()`). The local simulator
|
|
8
|
+
* stores plain objects, so to drive the same crawler against the
|
|
9
|
+
* simulator we round-trip plain values into the wire shape that
|
|
10
|
+
* `wire.ts` consumes.
|
|
11
|
+
*
|
|
12
|
+
* Type mapping (plain JS → wire discriminator):
|
|
13
|
+
* - `null` → `{ nullValue: null }`
|
|
14
|
+
* - `boolean` → `{ booleanValue }`
|
|
15
|
+
* - integer `number` → `{ integerValue: String(n) }` (matches admin SDK's int64 encoding)
|
|
16
|
+
* - non-integer `number` → `{ doubleValue }`
|
|
17
|
+
* - `string` → `{ stringValue }`
|
|
18
|
+
* - `Date` → `{ timestampValue: { seconds, nanos } }` (Item 1)
|
|
19
|
+
* - `Timestamp` wrapper → `{ timestampValue: { seconds, nanos } }` (Item 1)
|
|
20
|
+
* - `Reference` wrapper → `{ referenceValue: 'projects/.../documents/<path>' }` (Item 3)
|
|
21
|
+
* - `Array` → `{ arrayValue: { values } }`
|
|
22
|
+
* - plain object → `{ mapValue: { fields } }`
|
|
23
|
+
*
|
|
24
|
+
* Limitations:
|
|
25
|
+
* - `Buffer`, `GeoPoint`, BigInt and vector sentinels are NOT encoded —
|
|
26
|
+
* agents seeding the simulator for discover_paths testing should stick
|
|
27
|
+
* to the supported shapes.
|
|
28
|
+
* If extended later, follow the discriminator forms in
|
|
29
|
+
* {@link ../discover/wire.ts} verbatim.
|
|
30
|
+
*/
|
|
31
|
+
import { Timestamp } from 'pyric/rules';
|
|
32
|
+
import { Reference, referenceToResourceName } from 'pyric/rules';
|
|
33
|
+
import { Vector } from 'pyric/rules';
|
|
34
|
+
/**
|
|
35
|
+
* Encode a plain value into a single Firestore wire-format value.
|
|
36
|
+
* Throws on unsupported shapes (BigInt, Date, etc.) to surface gaps
|
|
37
|
+
* rather than silently producing wrong types.
|
|
38
|
+
*/
|
|
39
|
+
export function encodeValue(v) {
|
|
40
|
+
if (v === null || v === undefined) {
|
|
41
|
+
// Firestore distinguishes "field absent" from "field null"; LocalState
|
|
42
|
+
// stores `undefined` only when explicitly set, which is rare. Treat
|
|
43
|
+
// both as `nullValue` for encoding — the merge layer will see a
|
|
44
|
+
// legitimate scalar:null observation.
|
|
45
|
+
return { nullValue: null };
|
|
46
|
+
}
|
|
47
|
+
if (typeof v === 'boolean') {
|
|
48
|
+
return { booleanValue: v };
|
|
49
|
+
}
|
|
50
|
+
if (typeof v === 'number') {
|
|
51
|
+
if (Number.isInteger(v)) {
|
|
52
|
+
// admin SDK encodes int64 as a string in `integerValue` for safe-int
|
|
53
|
+
// preservation. Mirror that contract so wire.ts's downstream parser
|
|
54
|
+
// (Number(raw)) lands on the same value.
|
|
55
|
+
return { integerValue: String(v) };
|
|
56
|
+
}
|
|
57
|
+
return { doubleValue: v };
|
|
58
|
+
}
|
|
59
|
+
if (typeof v === 'string') {
|
|
60
|
+
return { stringValue: v };
|
|
61
|
+
}
|
|
62
|
+
// Item 1 — Timestamp wrappers and raw Dates both encode as
|
|
63
|
+
// `timestampValue: { seconds, nanos }`. The Timestamp check must come
|
|
64
|
+
// BEFORE the generic object-walk below; otherwise a Timestamp's plain
|
|
65
|
+
// `seconds`/`nanos` fields would be re-encoded as a `mapValue`,
|
|
66
|
+
// erasing the timestamp type for downstream wire decoders. Date
|
|
67
|
+
// similarly must be claimed before the `typeof v === 'object'` branch.
|
|
68
|
+
if (v instanceof Timestamp) {
|
|
69
|
+
return { timestampValue: { seconds: v.seconds, nanos: v.nanos } };
|
|
70
|
+
}
|
|
71
|
+
if (v instanceof Date) {
|
|
72
|
+
const ts = Timestamp.fromMillis(v.getTime());
|
|
73
|
+
return { timestampValue: { seconds: ts.seconds, nanos: ts.nanos } };
|
|
74
|
+
}
|
|
75
|
+
// Item 3 — Reference wrapper rides out as `referenceValue`. The field
|
|
76
|
+
// value is the fully-qualified resource name; discover/wire.ts strips
|
|
77
|
+
// the `projects/.../documents/` prefix back to the relative collection
|
|
78
|
+
// path so the schema reports `kind:'reference', targetCollection:'users'`.
|
|
79
|
+
// Must be claimed BEFORE the generic object-walk below (Reference is
|
|
80
|
+
// an instance, not a plain map).
|
|
81
|
+
if (v instanceof Reference) {
|
|
82
|
+
return { referenceValue: referenceToResourceName(v) };
|
|
83
|
+
}
|
|
84
|
+
// Item 5 — Vector encodes as the sentinel map shape live Firestore
|
|
85
|
+
// uses for its embedding type. discover/wire.ts detects this exact
|
|
86
|
+
// shape (`__type__: '__vector__'` + `value: <arrayValue>`) and reports
|
|
87
|
+
// `kind: 'vector', dimension: N`. Must be claimed BEFORE the generic
|
|
88
|
+
// object-walk below — Vector is a class instance, not a plain map,
|
|
89
|
+
// but skipping past this branch would still emit the wrong shape via
|
|
90
|
+
// the generic descent (no `__type__` field exists on the wrapper).
|
|
91
|
+
if (v instanceof Vector) {
|
|
92
|
+
return {
|
|
93
|
+
mapValue: {
|
|
94
|
+
fields: {
|
|
95
|
+
__type__: { stringValue: '__vector__' },
|
|
96
|
+
value: {
|
|
97
|
+
arrayValue: {
|
|
98
|
+
values: v.value.map((n) => ({ doubleValue: n })),
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (Array.isArray(v)) {
|
|
106
|
+
return { arrayValue: { values: v.map((e) => encodeValue(e)) } };
|
|
107
|
+
}
|
|
108
|
+
if (typeof v === 'object') {
|
|
109
|
+
const fields = {};
|
|
110
|
+
for (const [k, sub] of Object.entries(v)) {
|
|
111
|
+
fields[k] = encodeValue(sub);
|
|
112
|
+
}
|
|
113
|
+
return { mapValue: { fields } };
|
|
114
|
+
}
|
|
115
|
+
throw new Error(`wire-encoder: unsupported value type ${typeof v} (value=${String(v)}). ` +
|
|
116
|
+
`LocalState's discover_paths adapter only supports JSON-shaped data ` +
|
|
117
|
+
`(null, boolean, number, string, array, plain object).`);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Encode a full DocumentData record into the `_fieldsProto` shape.
|
|
121
|
+
* Each top-level key becomes a wire value at the same key.
|
|
122
|
+
*/
|
|
123
|
+
export function encodeFieldsProto(data) {
|
|
124
|
+
const proto = {};
|
|
125
|
+
for (const [k, v] of Object.entries(data)) {
|
|
126
|
+
proto[k] = encodeValue(v);
|
|
127
|
+
}
|
|
128
|
+
return proto;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=wire-encoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire-encoder.js","sourceRoot":"","sources":["../../../src/sandbox/firestore/wire-encoder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAKrC;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,CAAU;IACpC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QAClC,uEAAuE;QACvE,oEAAoE;QACpE,gEAAgE;QACh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J,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAA6B;IAC7D,MAAM,KAAK,GAA8B,EAAE,CAAC;IAC5C,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,KAAK,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `pyric/sandbox` — sandbox host (foundation). Provides the
|
|
3
|
+
* `Sandbox` type, the `SandboxContext` identity handle, the
|
|
4
|
+
* `initializeSandbox` factory, and the `SandboxError` family.
|
|
5
|
+
*
|
|
6
|
+
* Service handles live in sibling packages (`pyric-admin` for the
|
|
7
|
+
* Admin-SDK-shaped chainable Firestore adapter, future
|
|
8
|
+
* `pyric/firestore` for the modular Web SDK adapter,
|
|
9
|
+
* `pyric/auth`/`pyric/database`/`pyric/storage` later) and consume
|
|
10
|
+
* `SandboxContext` from here.
|
|
11
|
+
*
|
|
12
|
+
* Adapter packages also reach into `pyric/sandbox/internal` for the
|
|
13
|
+
* non-public protocol (`getInternalEnv`, etc.). See
|
|
14
|
+
* the design rationale and
|
|
15
|
+
* the design rationale for the design rationale.
|
|
16
|
+
*/
|
|
17
|
+
import type { Sandbox, SandboxConfig } from './types.js';
|
|
18
|
+
export type { AuthLens, AuthState, DenialContext, DenialEvent, EventActor, EventProvenance, EventService, ListenerLifecycleEvent, PersistableService, RequestEvent, Sandbox, SandboxConfig, SandboxContext, SandboxCommitEvent, SandboxErrorCode, SandboxEvent, SandboxListenerEvent, SandboxOperationEvent, SandboxRuntimeErrorEvent, SandboxSnapshot, ServiceMutationEvent, SessionBoundaryEvent, SnapshotDeliveryEvent, SnapshotErrorEvent, SnapshotSuppressedEvent, WriteSandboxEvent, } from './types.js';
|
|
19
|
+
export { SandboxError } from './types.js';
|
|
20
|
+
export { SandboxContextImpl } from './sandbox-context.js';
|
|
21
|
+
export { REMOTE_SANDBOX, REMOTE_SANDBOX_FACTORY, isRemoteSandbox } from './remote.js';
|
|
22
|
+
export type { RemoteSandbox, RemoteSandboxChannel, RemoteSandboxFactory, RemoteSandboxFactoryOptions, } from './remote.js';
|
|
23
|
+
export { replay } from './replay/index.js';
|
|
24
|
+
export type { Divergence, ReplayOptions, ReplayResult } from './replay/index.js';
|
|
25
|
+
export { apply, discard, diff, fork, promote } from './branches/index.js';
|
|
26
|
+
export type { Branch, DiffTarget } from './branches/index.js';
|
|
27
|
+
export type { PersistenceBackend, PersistenceController, SandboxPersistenceOptions, WebStorageLike, } from './persistence/index.js';
|
|
28
|
+
export { attachPersistence, createIndexedDBBackend, createMemoryBackend, recordBackendOverBlob, serializeToBuckets, deserializeFromBuckets, bundleRecords, parseBundle, PersistenceSchemaError, rehydrateDocValue, } from './persistence/index.js';
|
|
29
|
+
export type { BroadcastChannelLike, TabSyncOptions } from './tab-sync/index.js';
|
|
30
|
+
export { attachTabSync } from './tab-sync/index.js';
|
|
31
|
+
/**
|
|
32
|
+
* Create a sandbox.
|
|
33
|
+
*
|
|
34
|
+
* Identity is **not** part of init — call `sandbox.withAuth(...)` to
|
|
35
|
+
* derive a {@link SandboxContext} for service operations. Service-
|
|
36
|
+
* specific configuration (rules, seed data) happens through service
|
|
37
|
+
* handles — for example, `getFirestore(ctx).setRules(...)`.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { initializeSandbox } from 'pyric/sandbox';
|
|
42
|
+
* import { getFirestore } from 'pyric-admin/firestore';
|
|
43
|
+
*
|
|
44
|
+
* const sandbox = initializeSandbox();
|
|
45
|
+
* const dbAlice = getFirestore(sandbox.withAuth({ uid: 'alice' }));
|
|
46
|
+
* const dbAnon = getFirestore(sandbox.withAuth(null));
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function initializeSandbox(_config?: SandboxConfig): Sandbox;
|
|
50
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sandbox/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEzD,YAAY,EACV,QAAQ,EACR,SAAS,EACT,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,YAAY,EACZ,OAAO,EACP,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACxB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAM1D,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACtF,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AASjF,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC1E,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAK9D,YAAY,EACV,kB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