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,735 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remote arm of the admin-shaped Firestore surface (remote sandbox,
|
|
3
|
+
* slice 2 / checkpoint 2).
|
|
4
|
+
*
|
|
5
|
+
* A PARALLEL channel-backed implementation of `pyric/sandbox/admin-compat`'s
|
|
6
|
+
* type surface (`Firestore` / `DocumentReference` / `Query` / `WriteBatch` /
|
|
7
|
+
* `Transaction`), per the remote-Firestore spike verdict: the local
|
|
8
|
+
* admin-compat layer is welded to `LocalEnvironment`'s SYNCHRONOUS engine
|
|
9
|
+
* seam and cannot run over a WebSocket, so the remote arm re-implements the
|
|
10
|
+
* SHAPE over `RemoteSandboxChannel.op`/`subscribe` worker-relay frames —
|
|
11
|
+
* exactly the fork `pyric-admin/database` took for RTDB. The two arms share
|
|
12
|
+
* the type surface and the conformance assertions, not the implementation.
|
|
13
|
+
*
|
|
14
|
+
* DEPENDENCY DIRECTION: this module lives in `pyric` and may only consume
|
|
15
|
+
* the STRUCTURAL channel contract from `pyric/sandbox`'s remote seam
|
|
16
|
+
* (`RemoteSandboxChannel` — one loose `op`, one loose `subscribe`). The
|
|
17
|
+
* concrete worker-protocol unions live in `pyric-tools`, which `pyric`
|
|
18
|
+
* cannot import; ops are spelled loosely (`{ method: 'getDoc', path,
|
|
19
|
+
* actAs }`) and kept structurally identical to
|
|
20
|
+
* `pyric-tools/src/serve/worker/protocol.ts`.
|
|
21
|
+
*
|
|
22
|
+
* IDENTITY: every op and every subscription pins an EXPLICIT `actAs` lens.
|
|
23
|
+
* An ABSENT lens resolves worker-side to the browser tab's PORT SESSION —
|
|
24
|
+
* whoever happens to be signed in in the tab — which is never what a
|
|
25
|
+
* server-side handle means. `getAdminFirestore` pins `{ mode: 'admin' }`
|
|
26
|
+
* (rules bypass); `getFirestore(ctx)` pins `{ mode: 'as', uid, token? }`
|
|
27
|
+
* for a signed identity or `{ mode: 'anon' }` for `withAuth(null)`. The
|
|
28
|
+
* `as` lens carries the FULL `AuthState` (uid + custom-claims token): the
|
|
29
|
+
* worker host resolves it via `sandbox.withAuth({ uid, token })`, so there
|
|
30
|
+
* is no identity-fidelity loss versus the local arm.
|
|
31
|
+
*
|
|
32
|
+
* VALUE CODEC: write payloads are encoded CLIENT-side to the plain-JSON
|
|
33
|
+
* marker forms the worker host rehydrates (`prepareWriteData`): admin
|
|
34
|
+
* `FieldValue` sentinels (`{ __type: 'increment', value }`) become wire
|
|
35
|
+
* `SentinelMarker`s (`{ __sentinel: 'increment', n }`), and Timestamp /
|
|
36
|
+
* Date / rules-wrapper scalars become their `toJSON()` marker shapes — so
|
|
37
|
+
* the worker STORES real typed values (rules comparisons and `orderBy`
|
|
38
|
+
* see a Timestamp, not a map). Read payloads arrive as the
|
|
39
|
+
* `SerializedDocData` JSON envelope and are rehydrated with the ONE shared
|
|
40
|
+
* codec (`pyric/firestore-values`' `rehydrateDocValue`) then translated to
|
|
41
|
+
* the compat field shapes (`translateReadData`) — the same shapes the
|
|
42
|
+
* local arm's read path yields.
|
|
43
|
+
*
|
|
44
|
+
* KNOWN CODEC DIVERGENCE (accepted): user data that happens to be SHAPED
|
|
45
|
+
* like a codec marker — a plain map such as `{ __type: 'timestamp',
|
|
46
|
+
* seconds, nanos }` or `{ type: 'firestore/timestamp/1.0', … }` — is
|
|
47
|
+
* TRANSMUTED into the real typed value on the relayed path (the host's
|
|
48
|
+
* `prepareWriteData` / constraint rehydration cannot tell an intentional
|
|
49
|
+
* marker from a lookalike), while an in-page `setDoc` of the same map
|
|
50
|
+
* stores a plain map. This is the persistence codec's own behavior (an
|
|
51
|
+
* IndexedDB save/reload transmutes the same shapes), so the relay is
|
|
52
|
+
* consistent with the sandbox's durability semantics rather than with
|
|
53
|
+
* the in-page live path — marker-shaped user data is already reserved
|
|
54
|
+
* vocabulary in this system.
|
|
55
|
+
*
|
|
56
|
+
* KNOWN CURSOR LIMITS: the wire has no document-key cursor, so snapshot
|
|
57
|
+
* cursors require explicit non-`__name__` orderBy fields and lose the
|
|
58
|
+
* implicit `__name__` tie-break — see {@link cursorValuesFromSnapshot}.
|
|
59
|
+
*
|
|
60
|
+
* TRANSACTIONS: the worker exposes no interactive transaction session; the
|
|
61
|
+
* protocol is optimistic — every `tx.get` is an ordinary `getDoc`/`getDocs`
|
|
62
|
+
* op recorded into a client-held read-set, and ONE `txnCommit` op ships
|
|
63
|
+
* `{ reads, writes }`. The worker re-reads each path inside a real sandbox
|
|
64
|
+
* transaction and compares SERIALIZED JSON STRINGS. The read-set therefore
|
|
65
|
+
* echoes the worker's ORIGINAL `SerializedDocData.json` strings verbatim —
|
|
66
|
+
* re-serializing rehydrated data on this side would risk cross-process
|
|
67
|
+
* key-order/format drift and phantom aborts (livelock under retry). On
|
|
68
|
+
* `{ code: 'aborted' }` the update function is re-run with a fresh
|
|
69
|
+
* transaction, up to {@link TXN_MAX_ATTEMPTS} attempts (the worker client's
|
|
70
|
+
* model, which itself matches the Firestore SDK default).
|
|
71
|
+
*/
|
|
72
|
+
import { SandboxError, } from 'pyric/sandbox';
|
|
73
|
+
import { rehydrateDocValue } from 'pyric/firestore-values';
|
|
74
|
+
import { Timestamp as CompatTimestamp, } from 'pyric/sandbox/admin-compat';
|
|
75
|
+
import { translateReadData } from '../firestore/admin-compat/read-translation.js';
|
|
76
|
+
import { isCollectionPath, isDocumentPath, lastSegment, parentCollectionPath, } from '../firestore/admin-compat/paths.js';
|
|
77
|
+
import { generateAutoId } from '../firestore/auto-id.js';
|
|
78
|
+
import { READ_AFTER_WRITE_MESSAGE } from '../firestore/transaction-types.js';
|
|
79
|
+
import { buildDocumentSnapshot, buildQuerySnapshot, } from '../firestore/snapshot-listeners.js';
|
|
80
|
+
// ─── Error translation ─────────────────────────────────────────────────────
|
|
81
|
+
/**
|
|
82
|
+
* Wire errors arrive as `Error & { code, denialContext? }` (the channel
|
|
83
|
+
* reconstructs them from the protocol's `SerializedError`). Re-shape them
|
|
84
|
+
* into the SAME `SandboxError` the local arm throws, re-attaching the
|
|
85
|
+
* structured `denialContext` when the worker carried one — so
|
|
86
|
+
* `err instanceof SandboxError && err.code === 'permission-denied'` and
|
|
87
|
+
* `err.denialContext` work identically on both arms.
|
|
88
|
+
*/
|
|
89
|
+
function toRemoteSandboxError(err) {
|
|
90
|
+
if (err instanceof SandboxError)
|
|
91
|
+
return err;
|
|
92
|
+
if (err !== null && typeof err === 'object') {
|
|
93
|
+
const e = err;
|
|
94
|
+
if (typeof e.code === 'string' && typeof e.message === 'string') {
|
|
95
|
+
const denialContext = e.denialContext !== null && typeof e.denialContext === 'object'
|
|
96
|
+
? e.denialContext
|
|
97
|
+
: undefined;
|
|
98
|
+
return new SandboxError(e.code, e.message, denialContext);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return err;
|
|
102
|
+
}
|
|
103
|
+
function invalidArgument(message) {
|
|
104
|
+
return new SandboxError('invalid-argument', message);
|
|
105
|
+
}
|
|
106
|
+
// ─── Write-data encoding (client → wire marker forms) ─────────────────────
|
|
107
|
+
const SENTINEL_TYPES = new Set([
|
|
108
|
+
'serverTimestamp',
|
|
109
|
+
'increment',
|
|
110
|
+
'arrayUnion',
|
|
111
|
+
'arrayRemove',
|
|
112
|
+
'deleteField',
|
|
113
|
+
]);
|
|
114
|
+
function isFieldValueSentinel(v) {
|
|
115
|
+
return (v !== null &&
|
|
116
|
+
typeof v === 'object' &&
|
|
117
|
+
typeof v.__type === 'string' &&
|
|
118
|
+
SENTINEL_TYPES.has(v.__type));
|
|
119
|
+
}
|
|
120
|
+
/** Admin `FieldValue` sentinel (`__type` shape) → the documented wire
|
|
121
|
+
* `SentinelMarker` (`__sentinel` shape) the worker host resolves. */
|
|
122
|
+
function encodeSentinel(s) {
|
|
123
|
+
switch (s.__type) {
|
|
124
|
+
case 'serverTimestamp':
|
|
125
|
+
return { __sentinel: 'serverTimestamp' };
|
|
126
|
+
case 'increment':
|
|
127
|
+
return { __sentinel: 'increment', n: s.value };
|
|
128
|
+
case 'arrayUnion':
|
|
129
|
+
return { __sentinel: 'arrayUnion', values: s.values.map(encodeValue) };
|
|
130
|
+
case 'arrayRemove':
|
|
131
|
+
return { __sentinel: 'arrayRemove', values: s.values.map(encodeValue) };
|
|
132
|
+
case 'deleteField':
|
|
133
|
+
return { __sentinel: 'deleteField' };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Encode ONE value for the wire: sentinels → markers, typed scalars →
|
|
138
|
+
* their `toJSON()` marker shapes, containers walked recursively.
|
|
139
|
+
*
|
|
140
|
+
* Typed scalars are encoded EXPLICITLY (not left for a JSON leg to
|
|
141
|
+
* flatten) so the wire form is transport-independent — the same frames
|
|
142
|
+
* work over structured clone and over the double-JSON WS relay. The
|
|
143
|
+
* host's `prepareWriteData` rehydrates every marker family back into
|
|
144
|
+
* real wrapper instances before the write, which is what makes the
|
|
145
|
+
* worker STORE typed values (the spike's gap-4 semantics).
|
|
146
|
+
*/
|
|
147
|
+
function encodeValue(v) {
|
|
148
|
+
if (v === null || typeof v !== 'object')
|
|
149
|
+
return v;
|
|
150
|
+
if (isFieldValueSentinel(v))
|
|
151
|
+
return encodeSentinel(v);
|
|
152
|
+
if (v instanceof CompatTimestamp)
|
|
153
|
+
return v.toJSON();
|
|
154
|
+
if (v instanceof Date)
|
|
155
|
+
return CompatTimestamp.fromDate(v).toJSON();
|
|
156
|
+
if (Array.isArray(v))
|
|
157
|
+
return v.map(encodeValue);
|
|
158
|
+
const proto = Object.getPrototypeOf(v);
|
|
159
|
+
if (proto !== Object.prototype && proto !== null) {
|
|
160
|
+
// Non-plain instance (rules-wrapper Bytes/LatLng/Duration/… — the
|
|
161
|
+
// shapes the local read path hands back). Their `toJSON()` emits the
|
|
162
|
+
// canonical `__type` marker the shared codec rehydrates. Instances
|
|
163
|
+
// without a toJSON have no wire form — surface that honestly.
|
|
164
|
+
const toJSON = v.toJSON;
|
|
165
|
+
if (typeof toJSON === 'function') {
|
|
166
|
+
return toJSON.call(v);
|
|
167
|
+
}
|
|
168
|
+
throw invalidArgument(`remote Firestore: cannot serialize a ${proto.constructor?.name ?? 'class'} ` +
|
|
169
|
+
'instance for the wire — use plain data, Timestamp, Date, or FieldValue sentinels.');
|
|
170
|
+
}
|
|
171
|
+
const out = {};
|
|
172
|
+
for (const [k, val] of Object.entries(v)) {
|
|
173
|
+
out[k] = encodeValue(val);
|
|
174
|
+
}
|
|
175
|
+
return out;
|
|
176
|
+
}
|
|
177
|
+
function encodeWriteData(data) {
|
|
178
|
+
return encodeValue(data);
|
|
179
|
+
}
|
|
180
|
+
// ─── Read-data decoding (wire → compat shapes) ─────────────────────────────
|
|
181
|
+
/** Parse the JSON envelope with the shared codec, but keep the values in
|
|
182
|
+
* their RULES-INTERNAL wrapper form (what the local engine stores). Used
|
|
183
|
+
* where a downstream helper does its own compat translation. */
|
|
184
|
+
function decodeInternal(serialized) {
|
|
185
|
+
return rehydrateDocValue(JSON.parse(serialized.json));
|
|
186
|
+
}
|
|
187
|
+
/** Full read-path decode: shared codec rehydration + the same
|
|
188
|
+
* internal→compat field-shape translation the local arm applies
|
|
189
|
+
* (`Timestamp{seconds,nanoseconds}`, not the rules wrapper). */
|
|
190
|
+
function decodeDocData(serialized) {
|
|
191
|
+
return translateReadData(decodeInternal(serialized));
|
|
192
|
+
}
|
|
193
|
+
/** Dispatch one worker op with the handle's lens pinned; wire errors
|
|
194
|
+
* re-shape into `SandboxError`. */
|
|
195
|
+
async function armOp(arm, op) {
|
|
196
|
+
try {
|
|
197
|
+
return await arm.sandbox.channel.op({
|
|
198
|
+
...op,
|
|
199
|
+
actAs: arm.lens,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
catch (e) {
|
|
203
|
+
throw toRemoteSandboxError(e);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// ─── Admin-shaped snapshots (one-shot reads) ───────────────────────────────
|
|
207
|
+
function makeDocumentSnapshot(ref, wire) {
|
|
208
|
+
const data = wire.exists && wire.data ? decodeDocData(wire.data) : undefined;
|
|
209
|
+
return {
|
|
210
|
+
id: ref.id,
|
|
211
|
+
ref,
|
|
212
|
+
exists: wire.exists,
|
|
213
|
+
data: () => data,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function makeQuerySnapshot(arm, wire) {
|
|
217
|
+
const docs = wire.docs.map((row) => {
|
|
218
|
+
const path = row.path ?? row.id;
|
|
219
|
+
const ref = makeDocRef(arm, path);
|
|
220
|
+
const data = row.data ? decodeDocData(row.data) : {};
|
|
221
|
+
return {
|
|
222
|
+
id: ref.id,
|
|
223
|
+
ref,
|
|
224
|
+
exists: true,
|
|
225
|
+
data: () => data,
|
|
226
|
+
};
|
|
227
|
+
});
|
|
228
|
+
return {
|
|
229
|
+
size: docs.length,
|
|
230
|
+
empty: docs.length === 0,
|
|
231
|
+
docs,
|
|
232
|
+
forEach(callback) {
|
|
233
|
+
docs.forEach((d) => callback(d));
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
// ─── onSnapshot plumbing ───────────────────────────────────────────────────
|
|
238
|
+
/**
|
|
239
|
+
* Hidden hook the free `onSnapshot(ref, …)` in `index.ts` dispatches on:
|
|
240
|
+
* every remote ref/query exposes a registrar under this symbol that takes
|
|
241
|
+
* the NORMALIZED argument set and returns the unsubscribe. `Symbol.for` is
|
|
242
|
+
* unnecessary here (single module graph inside `pyric`), but a plain
|
|
243
|
+
* unique symbol keeps it invisible to consumer code.
|
|
244
|
+
*/
|
|
245
|
+
const REMOTE_SNAPSHOT_REGISTRAR = Symbol('pyric/sandbox/admin-firestore/remoteSnapshotRegistrar');
|
|
246
|
+
/** Is this ref one of the remote arm's (carries the registrar hook)? */
|
|
247
|
+
export function getRemoteSnapshotRegistrar(ref) {
|
|
248
|
+
if (ref === null || typeof ref !== 'object')
|
|
249
|
+
return undefined;
|
|
250
|
+
const registrar = ref[REMOTE_SNAPSHOT_REGISTRAR];
|
|
251
|
+
return typeof registrar === 'function' ? registrar : undefined;
|
|
252
|
+
}
|
|
253
|
+
let freeOnSnapshot = null;
|
|
254
|
+
export function registerRemoteOnSnapshotImpl(fn) {
|
|
255
|
+
freeOnSnapshot = fn;
|
|
256
|
+
}
|
|
257
|
+
function chainableOnSnapshot(...args) {
|
|
258
|
+
if (freeOnSnapshot === null) {
|
|
259
|
+
throw new SandboxError('failed-precondition', 'remote Firestore: onSnapshot is not wired yet — import pyric-admin/firestore (or pyric/sandbox/admin-firestore) before subscribing.');
|
|
260
|
+
}
|
|
261
|
+
return freeOnSnapshot(this, ...args);
|
|
262
|
+
}
|
|
263
|
+
/** Register a worker subscription for a resolved target and adapt snap
|
|
264
|
+
* frames into the Web-SDK-shaped live snapshots the local `onSnapshot`
|
|
265
|
+
* delivers. Wire `__error` snaps (establishment AND mid-stream, e.g. a
|
|
266
|
+
* rules redeploy turning the read into a denial) surface through
|
|
267
|
+
* `onError` as `SandboxError`s with `denialContext` when carried. */
|
|
268
|
+
function registerRemoteListener(arm, target, options, onNext, onError) {
|
|
269
|
+
const excludesMetadataChanges = options.includeMetadataChanges !== true;
|
|
270
|
+
// Previous query rows, kept so `docChanges()` diffs across fires the
|
|
271
|
+
// same way the local listener path does.
|
|
272
|
+
let prevDocs;
|
|
273
|
+
let detach;
|
|
274
|
+
try {
|
|
275
|
+
detach = arm.sandbox.channel.subscribe({ target, actAs: arm.lens }, (value) => {
|
|
276
|
+
if (!onNext)
|
|
277
|
+
return;
|
|
278
|
+
const snap = value;
|
|
279
|
+
if (Array.isArray(snap.docs)) {
|
|
280
|
+
// Query fire. `buildQuerySnapshot` translates the internal-form
|
|
281
|
+
// data to compat shapes itself, so decode WITHOUT translation.
|
|
282
|
+
const docList = snap.docs.map((row) => ({
|
|
283
|
+
path: row.path ?? row.id,
|
|
284
|
+
data: row.data ? decodeInternal(row.data) : {},
|
|
285
|
+
}));
|
|
286
|
+
const queryPath = target.__ref === 'query'
|
|
287
|
+
? (target.source.__ref === 'group' ? target.source.collectionId : target.source.path)
|
|
288
|
+
: target.__ref === 'group'
|
|
289
|
+
? target.collectionId
|
|
290
|
+
: target.path;
|
|
291
|
+
const querySnap = buildQuerySnapshot({ path: queryPath }, docList, { excludesMetadataChanges }, prevDocs);
|
|
292
|
+
prevDocs = docList;
|
|
293
|
+
onNext(querySnap);
|
|
294
|
+
}
|
|
295
|
+
else if (typeof snap.id === 'string') {
|
|
296
|
+
// Doc fire.
|
|
297
|
+
const path = snap.path ?? snap.id;
|
|
298
|
+
const data = snap.exists && snap.data ? decodeInternal(snap.data) : null;
|
|
299
|
+
onNext(buildDocumentSnapshot(path, data));
|
|
300
|
+
}
|
|
301
|
+
}, (err) => {
|
|
302
|
+
const translated = toRemoteSandboxError(err);
|
|
303
|
+
if (onError)
|
|
304
|
+
onError(translated);
|
|
305
|
+
else
|
|
306
|
+
console.error('pyric remote Firestore: uncaught onSnapshot error:', translated);
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
catch (e) {
|
|
310
|
+
throw toRemoteSandboxError(e);
|
|
311
|
+
}
|
|
312
|
+
return detach;
|
|
313
|
+
}
|
|
314
|
+
/** Brand for `Transaction.get`'s doc-vs-query runtime dispatch and the
|
|
315
|
+
* descriptor recovery it needs. */
|
|
316
|
+
const QUERY_STATE = Symbol('pyric/sandbox/admin-firestore/remoteQueryState');
|
|
317
|
+
function queryStateOf(value) {
|
|
318
|
+
if (value === null || typeof value !== 'object')
|
|
319
|
+
return undefined;
|
|
320
|
+
return value[QUERY_STATE];
|
|
321
|
+
}
|
|
322
|
+
function encodeFilter(filter) {
|
|
323
|
+
if (filter.kind === 'where') {
|
|
324
|
+
validateWhereOp(filter.op);
|
|
325
|
+
return { kind: 'where', field: filter.field, op: filter.op, value: encodeValue(filter.value) };
|
|
326
|
+
}
|
|
327
|
+
return { kind: filter.kind, filters: filter.filters.map(encodeFilter) };
|
|
328
|
+
}
|
|
329
|
+
const WHERE_OPS = new Set([
|
|
330
|
+
'<', '<=', '==', '!=', '>=', '>',
|
|
331
|
+
'in', 'not-in', 'array-contains', 'array-contains-any',
|
|
332
|
+
]);
|
|
333
|
+
function validateWhereOp(op) {
|
|
334
|
+
if (!WHERE_OPS.has(op)) {
|
|
335
|
+
throw invalidArgument(`invalid where operator: ${String(op)}`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
/** Flatten the accumulated state into the wire's constraint list. */
|
|
339
|
+
function buildDescriptor(state) {
|
|
340
|
+
const constraints = [...state.filters];
|
|
341
|
+
for (const o of state.orders) {
|
|
342
|
+
constraints.push({ kind: 'orderBy', field: o.field, direction: o.direction });
|
|
343
|
+
}
|
|
344
|
+
if (state.start) {
|
|
345
|
+
constraints.push({
|
|
346
|
+
kind: state.start.inclusive ? 'startAt' : 'startAfter',
|
|
347
|
+
values: state.start.values.map(encodeValue),
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
if (state.end) {
|
|
351
|
+
constraints.push({
|
|
352
|
+
kind: state.end.inclusive ? 'endAt' : 'endBefore',
|
|
353
|
+
values: state.end.values.map(encodeValue),
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
if (state.limitCount !== undefined) {
|
|
357
|
+
constraints.push(state.limitFromEnd
|
|
358
|
+
? { kind: 'limitToLast', n: state.limitCount }
|
|
359
|
+
: { kind: 'limit', n: state.limitCount });
|
|
360
|
+
}
|
|
361
|
+
if (constraints.length === 0)
|
|
362
|
+
return state.source;
|
|
363
|
+
return { __ref: 'query', source: state.source, constraints };
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Pull cursor values off a `DocumentSnapshot` at the query's EXPLICIT
|
|
367
|
+
* orderBy fields — the remote mirror of the local
|
|
368
|
+
* `cursorValuesFromSnapshot`.
|
|
369
|
+
*
|
|
370
|
+
* HONEST FIDELITY LIMITS (the relay's value-cursor constraints cannot
|
|
371
|
+
* express a document-key cursor; extending the wire with one is filed
|
|
372
|
+
* for later — no protocol change here):
|
|
373
|
+
*
|
|
374
|
+
* 1. Zero explicit orderBy → THROW. The local arm positions on the
|
|
375
|
+
* implicit `__name__` key; the wire cannot.
|
|
376
|
+
* 2. An explicit `orderBy('__name__')` → THROW. `__name__` is not a
|
|
377
|
+
* data field — reading `data()['__name__']` would yield `undefined`
|
|
378
|
+
* and the cursor would silently match NOTHING/EVERYTHING.
|
|
379
|
+
* 3. TIE-BREAK GAP (documented, not thrown — it is only detectable at
|
|
380
|
+
* the data level): the local arm's snapshot cursors also carry the
|
|
381
|
+
* implicit `__name__` tie-break value, so `orderBy('v')
|
|
382
|
+
* .startAfter(snapOfB)` with ties on `v` still positions PAST the
|
|
383
|
+
* exact document. The remote cursor carries only the explicit
|
|
384
|
+
* field values, so under EQUAL orderBy values the boundary is the
|
|
385
|
+
* VALUE, not the document: `startAfter(snap)` skips every doc tied
|
|
386
|
+
* with `snap` (deterministically — the whole tie group), where the
|
|
387
|
+
* local arm keeps the tied docs that sort after it by key. Break
|
|
388
|
+
* ties with an explicit second orderBy field to paginate exactly.
|
|
389
|
+
*/
|
|
390
|
+
function cursorValuesFromSnapshot(snapshot, orders, method) {
|
|
391
|
+
if (orders.length === 0) {
|
|
392
|
+
throw invalidArgument(`${method}(snapshot) on a remote sandbox requires at least one explicit orderBy() ` +
|
|
393
|
+
'clause — the relay protocol has no document-key cursor.');
|
|
394
|
+
}
|
|
395
|
+
if (orders.some((o) => o.field === '__name__')) {
|
|
396
|
+
throw invalidArgument(`${method}(snapshot) on a remote sandbox does not support orderBy('__name__') — ` +
|
|
397
|
+
'the relay protocol has no document-key cursor, and __name__ is not a data ' +
|
|
398
|
+
'field a value cursor can carry. Order by a real document field instead.');
|
|
399
|
+
}
|
|
400
|
+
const data = snapshot.data();
|
|
401
|
+
if (data === undefined) {
|
|
402
|
+
throw new SandboxError('not-found', 'Snapshot-based cursors require an existing document — got an empty ' +
|
|
403
|
+
`snapshot for ${snapshot.id ?? '<unknown>'}.`);
|
|
404
|
+
}
|
|
405
|
+
return orders.map((o) => data[o.field]);
|
|
406
|
+
}
|
|
407
|
+
function makeQuery(arm, state) {
|
|
408
|
+
const clone = (patch) => makeQuery(arm, { ...state, ...patch });
|
|
409
|
+
const query = {
|
|
410
|
+
[QUERY_STATE]: state,
|
|
411
|
+
where(field, op, value) {
|
|
412
|
+
validateWhereOp(op);
|
|
413
|
+
return clone({
|
|
414
|
+
filters: [...state.filters, { kind: 'where', field, op, value: encodeValue(value) }],
|
|
415
|
+
});
|
|
416
|
+
},
|
|
417
|
+
applyFilter(filter) {
|
|
418
|
+
return clone({ filters: [...state.filters, encodeFilter(filter)] });
|
|
419
|
+
},
|
|
420
|
+
orderBy(field, direction = 'asc') {
|
|
421
|
+
return clone({ orders: [...state.orders, { field, direction }] });
|
|
422
|
+
},
|
|
423
|
+
limit(n) {
|
|
424
|
+
return clone({ limitCount: n, limitFromEnd: false });
|
|
425
|
+
},
|
|
426
|
+
limitToLast(n) {
|
|
427
|
+
return clone({ limitCount: n, limitFromEnd: true });
|
|
428
|
+
},
|
|
429
|
+
startCursor(values, inclusive) {
|
|
430
|
+
return clone({ start: { values: [...values], inclusive } });
|
|
431
|
+
},
|
|
432
|
+
endCursor(values, inclusive) {
|
|
433
|
+
return clone({ end: { values: [...values], inclusive } });
|
|
434
|
+
},
|
|
435
|
+
startCursorFromSnapshot(snapshot, inclusive) {
|
|
436
|
+
return clone({
|
|
437
|
+
start: {
|
|
438
|
+
values: cursorValuesFromSnapshot(snapshot, state.orders, inclusive ? 'startAt' : 'startAfter'),
|
|
439
|
+
inclusive,
|
|
440
|
+
},
|
|
441
|
+
});
|
|
442
|
+
},
|
|
443
|
+
endCursorFromSnapshot(snapshot, inclusive) {
|
|
444
|
+
return clone({
|
|
445
|
+
end: {
|
|
446
|
+
values: cursorValuesFromSnapshot(snapshot, state.orders, inclusive ? 'endAt' : 'endBefore'),
|
|
447
|
+
inclusive,
|
|
448
|
+
},
|
|
449
|
+
});
|
|
450
|
+
},
|
|
451
|
+
async get(_opts) {
|
|
452
|
+
validateExecutable(state);
|
|
453
|
+
const wire = (await armOp(arm, {
|
|
454
|
+
method: 'getDocs',
|
|
455
|
+
source: buildDescriptor(state),
|
|
456
|
+
}));
|
|
457
|
+
return makeQuerySnapshot(arm, wire);
|
|
458
|
+
},
|
|
459
|
+
async aggregate(spec) {
|
|
460
|
+
validateExecutable(state);
|
|
461
|
+
const wire = (await armOp(arm, {
|
|
462
|
+
method: 'aggregate',
|
|
463
|
+
source: buildDescriptor(state),
|
|
464
|
+
spec,
|
|
465
|
+
}));
|
|
466
|
+
return { data: () => wire.data };
|
|
467
|
+
},
|
|
468
|
+
[REMOTE_SNAPSHOT_REGISTRAR]: (options, onNext, onError) => {
|
|
469
|
+
validateExecutable(state);
|
|
470
|
+
return registerRemoteListener(arm, buildDescriptor(state), options, onNext, onError);
|
|
471
|
+
},
|
|
472
|
+
onSnapshot: chainableOnSnapshot,
|
|
473
|
+
};
|
|
474
|
+
return query;
|
|
475
|
+
}
|
|
476
|
+
/** Client-side runtime checks matching the local arm's execution-time
|
|
477
|
+
* contract, so the failure surfaces with the same code + guidance
|
|
478
|
+
* instead of a worker round-trip. */
|
|
479
|
+
function validateExecutable(state) {
|
|
480
|
+
if (state.limitFromEnd && state.orders.length === 0) {
|
|
481
|
+
throw invalidArgument('limitToLast() queries require at least one orderBy clause.');
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
function makeCollectionRef(arm, path) {
|
|
485
|
+
const base = makeQuery(arm, {
|
|
486
|
+
source: { __ref: 'collection', path },
|
|
487
|
+
filters: [],
|
|
488
|
+
orders: [],
|
|
489
|
+
limitFromEnd: false,
|
|
490
|
+
});
|
|
491
|
+
const coll = Object.assign(Object.create(Object.getPrototypeOf(base)), base, {
|
|
492
|
+
id: lastSegment(path),
|
|
493
|
+
path,
|
|
494
|
+
doc(id) {
|
|
495
|
+
const finalId = id ?? generateAutoId();
|
|
496
|
+
return makeDocRef(arm, `${path}/${finalId}`);
|
|
497
|
+
},
|
|
498
|
+
async add(data, _opts) {
|
|
499
|
+
// The worker mints the id (`addDoc`), so creation is one round-trip
|
|
500
|
+
// and the id is authoritative from the shared sandbox.
|
|
501
|
+
const res = (await armOp(arm, {
|
|
502
|
+
method: 'addDoc',
|
|
503
|
+
collectionPath: path,
|
|
504
|
+
data: encodeWriteData(data),
|
|
505
|
+
}));
|
|
506
|
+
return makeDocRef(arm, res.path);
|
|
507
|
+
},
|
|
508
|
+
});
|
|
509
|
+
return coll;
|
|
510
|
+
}
|
|
511
|
+
function makeDocRef(arm, path) {
|
|
512
|
+
const ref = {
|
|
513
|
+
id: lastSegment(path),
|
|
514
|
+
path,
|
|
515
|
+
get parent() {
|
|
516
|
+
return makeCollectionRef(arm, parentCollectionPath(path));
|
|
517
|
+
},
|
|
518
|
+
collection(name) {
|
|
519
|
+
const sub = `${path}/${name}`;
|
|
520
|
+
if (!isCollectionPath(sub)) {
|
|
521
|
+
throw invalidArgument(`collection path must have an odd number of segments: ${sub}`);
|
|
522
|
+
}
|
|
523
|
+
return makeCollectionRef(arm, sub);
|
|
524
|
+
},
|
|
525
|
+
async get(_opts) {
|
|
526
|
+
const wire = (await armOp(arm, { method: 'getDoc', path }));
|
|
527
|
+
return makeDocumentSnapshot(ref, wire);
|
|
528
|
+
},
|
|
529
|
+
async set(data, options) {
|
|
530
|
+
await armOp(arm, {
|
|
531
|
+
method: 'setDoc',
|
|
532
|
+
path,
|
|
533
|
+
data: encodeWriteData(data),
|
|
534
|
+
...(setOptionsForWire(options) ? { options: setOptionsForWire(options) } : {}),
|
|
535
|
+
});
|
|
536
|
+
},
|
|
537
|
+
async update(data, _opts) {
|
|
538
|
+
await armOp(arm, { method: 'updateDoc', path, data: encodeWriteData(data) });
|
|
539
|
+
},
|
|
540
|
+
async delete(_opts) {
|
|
541
|
+
await armOp(arm, { method: 'deleteDoc', path });
|
|
542
|
+
},
|
|
543
|
+
[REMOTE_SNAPSHOT_REGISTRAR]: (options, onNext, onError) => registerRemoteListener(arm, { __ref: 'doc', path }, options, onNext, onError),
|
|
544
|
+
onSnapshot: chainableOnSnapshot,
|
|
545
|
+
};
|
|
546
|
+
return ref;
|
|
547
|
+
}
|
|
548
|
+
function setOptionsForWire(options) {
|
|
549
|
+
if (!options)
|
|
550
|
+
return undefined;
|
|
551
|
+
const wire = {};
|
|
552
|
+
if (options.merge !== undefined)
|
|
553
|
+
wire.merge = options.merge;
|
|
554
|
+
if (options.mergeFields !== undefined)
|
|
555
|
+
wire.mergeFields = [...options.mergeFields];
|
|
556
|
+
return wire.merge !== undefined || wire.mergeFields !== undefined ? wire : undefined;
|
|
557
|
+
}
|
|
558
|
+
// ─── WriteBatch ────────────────────────────────────────────────────────────
|
|
559
|
+
function makeWriteBatch(arm) {
|
|
560
|
+
const writes = [];
|
|
561
|
+
let committed = false;
|
|
562
|
+
const batch = {
|
|
563
|
+
set(ref, data) {
|
|
564
|
+
assertNotCommitted();
|
|
565
|
+
writes.push({ method: 'set', path: ref.path, data: encodeWriteData(data) });
|
|
566
|
+
return batch;
|
|
567
|
+
},
|
|
568
|
+
update(ref, data) {
|
|
569
|
+
assertNotCommitted();
|
|
570
|
+
writes.push({ method: 'update', path: ref.path, data: encodeWriteData(data) });
|
|
571
|
+
return batch;
|
|
572
|
+
},
|
|
573
|
+
delete(ref) {
|
|
574
|
+
assertNotCommitted();
|
|
575
|
+
writes.push({ method: 'delete', path: ref.path });
|
|
576
|
+
return batch;
|
|
577
|
+
},
|
|
578
|
+
async commit(_opts) {
|
|
579
|
+
assertNotCommitted();
|
|
580
|
+
committed = true;
|
|
581
|
+
await armOp(arm, { method: 'batchCommit', writes });
|
|
582
|
+
},
|
|
583
|
+
};
|
|
584
|
+
function assertNotCommitted() {
|
|
585
|
+
if (committed) {
|
|
586
|
+
throw new SandboxError('failed-precondition', 'WriteBatch has already been committed.');
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
return batch;
|
|
590
|
+
}
|
|
591
|
+
// ─── Transaction ───────────────────────────────────────────────────────────
|
|
592
|
+
/** Matches the worker client's retry cap (and the Firestore SDK default). */
|
|
593
|
+
const TXN_MAX_ATTEMPTS = 5;
|
|
594
|
+
async function runRemoteTransaction(arm, fn) {
|
|
595
|
+
for (let attempt = 0; attempt < TXN_MAX_ATTEMPTS; attempt++) {
|
|
596
|
+
// Fresh read-set + write buffer per attempt.
|
|
597
|
+
const reads = [];
|
|
598
|
+
const writes = [];
|
|
599
|
+
// READS-BEFORE-WRITES: the local arm's engine transaction throws
|
|
600
|
+
// `failed-precondition` (ReadAfterWriteError) when a read follows any
|
|
601
|
+
// write — the Admin SDK contract. The remote arm buffers writes
|
|
602
|
+
// client-side, so without this gate a `tx.get` after `tx.set` would
|
|
603
|
+
// issue a plain getDoc against PRE-transaction state and commit
|
|
604
|
+
// silently on stale data. Enforce the same contract, same message.
|
|
605
|
+
const assertReadsAllowed = () => {
|
|
606
|
+
if (writes.length > 0) {
|
|
607
|
+
throw new SandboxError('failed-precondition', READ_AFTER_WRITE_MESSAGE);
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
const tx = {
|
|
611
|
+
// Overloaded on the surface (doc ref vs query); runtime dispatch on
|
|
612
|
+
// the remote query brand — mirrors the local structural `isQuery`.
|
|
613
|
+
get(refOrQuery) {
|
|
614
|
+
assertReadsAllowed();
|
|
615
|
+
const state = queryStateOf(refOrQuery);
|
|
616
|
+
if (state !== undefined) {
|
|
617
|
+
return txGetQuery(state);
|
|
618
|
+
}
|
|
619
|
+
return txGetDoc(refOrQuery);
|
|
620
|
+
},
|
|
621
|
+
set(ref, data) {
|
|
622
|
+
writes.push({ method: 'set', path: ref.path, data: encodeWriteData(data) });
|
|
623
|
+
return tx;
|
|
624
|
+
},
|
|
625
|
+
update(ref, data) {
|
|
626
|
+
writes.push({ method: 'update', path: ref.path, data: encodeWriteData(data) });
|
|
627
|
+
return tx;
|
|
628
|
+
},
|
|
629
|
+
delete(ref) {
|
|
630
|
+
writes.push({ method: 'delete', path: ref.path });
|
|
631
|
+
return tx;
|
|
632
|
+
},
|
|
633
|
+
};
|
|
634
|
+
async function txGetDoc(ref) {
|
|
635
|
+
const wire = (await armOp(arm, { method: 'getDoc', path: ref.path }));
|
|
636
|
+
// READ-SET INVARIANT: record the worker's ORIGINAL serialized
|
|
637
|
+
// envelope verbatim. The worker validates by re-serializing the
|
|
638
|
+
// current doc IN ITS OWN process and comparing JSON strings —
|
|
639
|
+
// echoing its bytes back is what keeps the comparison deterministic
|
|
640
|
+
// (re-serializing rehydrated data here would phantom-abort).
|
|
641
|
+
reads.push({
|
|
642
|
+
path: wire.path ?? ref.path,
|
|
643
|
+
data: wire.exists && wire.data ? wire.data : null,
|
|
644
|
+
});
|
|
645
|
+
return makeDocumentSnapshot(ref, wire);
|
|
646
|
+
}
|
|
647
|
+
async function txGetQuery(state) {
|
|
648
|
+
validateExecutable(state);
|
|
649
|
+
const wire = (await armOp(arm, {
|
|
650
|
+
method: 'getDocs',
|
|
651
|
+
source: buildDescriptor(state),
|
|
652
|
+
}));
|
|
653
|
+
// Register every returned doc in the read-set (the local arm's
|
|
654
|
+
// `simTx.getAll` registration) — again echoing the original bytes.
|
|
655
|
+
for (const row of wire.docs) {
|
|
656
|
+
reads.push({ path: row.path ?? row.id, data: row.data ?? null });
|
|
657
|
+
}
|
|
658
|
+
return makeQuerySnapshot(arm, wire);
|
|
659
|
+
}
|
|
660
|
+
const result = await fn(tx);
|
|
661
|
+
try {
|
|
662
|
+
await armOp(arm, { method: 'txnCommit', reads, writes });
|
|
663
|
+
return result;
|
|
664
|
+
}
|
|
665
|
+
catch (err) {
|
|
666
|
+
if (err instanceof SandboxError && err.code === 'aborted') {
|
|
667
|
+
continue; // read-set conflict — re-run fn with fresh reads
|
|
668
|
+
}
|
|
669
|
+
throw err;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
throw new SandboxError('aborted', `Transaction failed after ${TXN_MAX_ATTEMPTS} attempts due to repeated conflicts. ` +
|
|
673
|
+
'Another writer is concurrently updating the same documents.');
|
|
674
|
+
}
|
|
675
|
+
// ─── The handle ────────────────────────────────────────────────────────────
|
|
676
|
+
/** Canonical remediating throw for sync-only sandbox members that cannot
|
|
677
|
+
* span the wire. Mirrors the slice-1 handle's error style. */
|
|
678
|
+
function syncOnlyRemotely(member, remedy) {
|
|
679
|
+
return new SandboxError('unimplemented', `SandboxFirestore.${member} is not available on a remote sandbox — its return ` +
|
|
680
|
+
`value is synchronous and the data lives in the browser worker. ${remedy}`);
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Build the channel-backed `SandboxFirestore` for a remote sandbox handle.
|
|
684
|
+
* `lens` is pinned on EVERY op and subscription (see the module header for
|
|
685
|
+
* the identity mapping); path-shape validation matches the local arm so
|
|
686
|
+
* `invalid-argument` failures surface at the call site without a
|
|
687
|
+
* round-trip.
|
|
688
|
+
*/
|
|
689
|
+
export function createRemoteFirestore(sandbox, lens) {
|
|
690
|
+
const arm = { sandbox, lens };
|
|
691
|
+
return {
|
|
692
|
+
// ── Production-shaped surface ────────────────────────────────────
|
|
693
|
+
collection(path) {
|
|
694
|
+
if (!isCollectionPath(path)) {
|
|
695
|
+
throw invalidArgument(`collection path must have an odd number of segments: ${path}`);
|
|
696
|
+
}
|
|
697
|
+
return makeCollectionRef(arm, path);
|
|
698
|
+
},
|
|
699
|
+
doc(path) {
|
|
700
|
+
if (!isDocumentPath(path)) {
|
|
701
|
+
throw invalidArgument(`document path must have an even number of segments: ${path}`);
|
|
702
|
+
}
|
|
703
|
+
return makeDocRef(arm, path);
|
|
704
|
+
},
|
|
705
|
+
collectionGroup(collectionId) {
|
|
706
|
+
if (collectionId.length === 0 || collectionId.includes('/')) {
|
|
707
|
+
throw invalidArgument(`collection group id must be a single non-empty segment with no '/': ${collectionId}`);
|
|
708
|
+
}
|
|
709
|
+
return makeQuery(arm, {
|
|
710
|
+
source: { __ref: 'group', collectionId },
|
|
711
|
+
filters: [],
|
|
712
|
+
orders: [],
|
|
713
|
+
limitFromEnd: false,
|
|
714
|
+
});
|
|
715
|
+
},
|
|
716
|
+
batch() {
|
|
717
|
+
return makeWriteBatch(arm);
|
|
718
|
+
},
|
|
719
|
+
runTransaction(fn, _opts) {
|
|
720
|
+
return runRemoteTransaction(arm, fn);
|
|
721
|
+
},
|
|
722
|
+
// ── Sandbox-only surface (sync contracts — remediating throws) ───
|
|
723
|
+
setRules() {
|
|
724
|
+
throw syncOnlyRemotely('setRules', "Deploy rules asynchronously through the relay instead: `await sandbox.channel.op({ method: 'setFirestoreRules', source })`.");
|
|
725
|
+
},
|
|
726
|
+
seed() {
|
|
727
|
+
throw syncOnlyRemotely('seed', 'The relay has no atomic seed op; write seed docs through this handle ' +
|
|
728
|
+
"(`db.doc(path).set(data)` / `db.batch()`), or drive `sandbox.channel.op({ method: 'admin.setDocument', path, data })` per document.");
|
|
729
|
+
},
|
|
730
|
+
snapshot() {
|
|
731
|
+
throw syncOnlyRemotely('snapshot', "Read the worker state asynchronously instead: `await sandbox.channel.op({ method: 'admin.readState' })`.");
|
|
732
|
+
},
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
//# sourceMappingURL=remote.js.map
|