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,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference wrapper — Item 3 of simulator-prod-parity.md.
|
|
3
|
+
*
|
|
4
|
+
* Reference surface (rules.Reference):
|
|
5
|
+
* - `.path` — relative document path string ('users/u1')
|
|
6
|
+
* - `.id` — last segment of the path ('u1')
|
|
7
|
+
* - `.parent` — parent collection path string ('users')
|
|
8
|
+
* - `is reference` — type test
|
|
9
|
+
* - `==` / `!=` against another Reference
|
|
10
|
+
*
|
|
11
|
+
* Per 0.B per-wrapper table:
|
|
12
|
+
* typeName: 'reference'
|
|
13
|
+
* valueOf: NaN (no meaningful numeric coercion — like Path/LatLng)
|
|
14
|
+
* toString: 'users/u1' (relative path; round-trips with the admin SDK
|
|
15
|
+
* DocumentReference.path getter)
|
|
16
|
+
* equals: path-string equality (project/database not significant in
|
|
17
|
+
* the simulator — every Reference lives in the same logical DB)
|
|
18
|
+
* binaryOp: NO_OP (== / != route through equals)
|
|
19
|
+
*
|
|
20
|
+
* Why a relative-path-only wrapper rather than a full project/database/doc
|
|
21
|
+
* model: Firestore rules see references as opaque path values. The
|
|
22
|
+
* `referenceValue` wire encoding *does* need a fully-qualified
|
|
23
|
+
* `projects/<p>/databases/<d>/documents/<path>` string for round-trip
|
|
24
|
+
* with discover/wire.ts, but that's a write-out concern — the wire
|
|
25
|
+
* encoder synthesizes a default qualifier on the way out. Inside the
|
|
26
|
+
* simulator, two references are the same reference iff their relative
|
|
27
|
+
* paths match.
|
|
28
|
+
*
|
|
29
|
+
* The admin SDK DocumentReference exposes more (e.g., `.firestore`,
|
|
30
|
+
* `formattedName`); the rules language does not — we deliberately
|
|
31
|
+
* shrink to the rules-visible surface so accidental `ref.firestore`
|
|
32
|
+
* reads in a rule (which production would silently null out) match
|
|
33
|
+
* the simulator.
|
|
34
|
+
*/
|
|
35
|
+
import { RulesValue, NO_OP } from './base.js';
|
|
36
|
+
export class Reference extends RulesValue {
|
|
37
|
+
typeName = 'reference';
|
|
38
|
+
/** Relative document path, e.g. 'users/u1' or 'users/u1/posts/p1'. */
|
|
39
|
+
path;
|
|
40
|
+
constructor(path) {
|
|
41
|
+
super();
|
|
42
|
+
// Normalize: strip any leading slash, trailing slash, or fully-qualified
|
|
43
|
+
// `projects/.../documents/` prefix so internal compares are uniform.
|
|
44
|
+
this.path = normalizeRelativePath(path);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Construct from an admin-SDK-style fully-qualified resource name like
|
|
48
|
+
* `projects/p/databases/(default)/documents/users/u1`. The fully-
|
|
49
|
+
* qualified form is what `referenceValue` emits on the wire; using this
|
|
50
|
+
* helper at the decode boundary keeps the relative-path invariant.
|
|
51
|
+
*/
|
|
52
|
+
static fromResourceName(resourceName) {
|
|
53
|
+
return new Reference(stripDocumentsPrefix(resourceName));
|
|
54
|
+
}
|
|
55
|
+
/** Last path segment; '' for an empty path. */
|
|
56
|
+
get id() {
|
|
57
|
+
const i = this.path.lastIndexOf('/');
|
|
58
|
+
return i === -1 ? this.path : this.path.slice(i + 1);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Parent collection path as a string. For `users/u1` returns `users`;
|
|
62
|
+
* for `users/u1/posts/p1` returns `users/u1/posts`. An empty string
|
|
63
|
+
* if there is no parent (a root-level reference is degenerate, but
|
|
64
|
+
* we don't throw to keep diagnostics-friendly).
|
|
65
|
+
*
|
|
66
|
+
* Returning a string (not a Reference) matches Firestore rules' lack of
|
|
67
|
+
* a CollectionReference type — collections aren't first-class values in
|
|
68
|
+
* rules. Agents that want to compare against a collection path do so by
|
|
69
|
+
* string equality, which this supports.
|
|
70
|
+
*/
|
|
71
|
+
get parent() {
|
|
72
|
+
const i = this.path.lastIndexOf('/');
|
|
73
|
+
return i === -1 ? '' : this.path.slice(0, i);
|
|
74
|
+
}
|
|
75
|
+
// ─── RulesValue contract ─────────────────────────────────────────────
|
|
76
|
+
valueOf() {
|
|
77
|
+
return NaN; // No meaningful numeric coercion (matches Path, LatLng).
|
|
78
|
+
}
|
|
79
|
+
toString() {
|
|
80
|
+
// Relative path matches the admin SDK DocumentReference.path getter
|
|
81
|
+
// exactly, so a rule that does `string(ref) == 'users/u1'` works
|
|
82
|
+
// without needing the fully-qualified form.
|
|
83
|
+
return this.path;
|
|
84
|
+
}
|
|
85
|
+
toJSON() {
|
|
86
|
+
return { __type: 'reference', path: this.path };
|
|
87
|
+
}
|
|
88
|
+
equals(other) {
|
|
89
|
+
if (!(other instanceof Reference))
|
|
90
|
+
return false;
|
|
91
|
+
return this.path === other.path;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Property dispatch. Mirrors the admin SDK read surface: `.path`,
|
|
95
|
+
* `.id`, `.parent`. Anything else returns null (Firestore rules
|
|
96
|
+
* "missing map key" shape, consistent with other wrappers).
|
|
97
|
+
*/
|
|
98
|
+
field(name) {
|
|
99
|
+
switch (name) {
|
|
100
|
+
case 'path': return this.path;
|
|
101
|
+
case 'id': return this.id;
|
|
102
|
+
case 'parent': return this.parent;
|
|
103
|
+
default: return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
callMethod(_method, _args) {
|
|
107
|
+
// References have no callable methods in the rules language — the
|
|
108
|
+
// admin SDK's get/set/update aren't exposed to rules. Returning
|
|
109
|
+
// NO_OP triggers UnsupportedError so a rule like `ref.get()` fails
|
|
110
|
+
// loudly rather than silently denying.
|
|
111
|
+
return NO_OP;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// ─── Helpers ─────────────────────────────────────────────────────────────
|
|
115
|
+
/**
|
|
116
|
+
* Strip leading slash and any `projects/<p>/databases/<d>/documents/`
|
|
117
|
+
* prefix to produce the relative path. Tolerates both forms because
|
|
118
|
+
* agents may seed either shape.
|
|
119
|
+
*/
|
|
120
|
+
function normalizeRelativePath(path) {
|
|
121
|
+
let p = stripDocumentsPrefix(path);
|
|
122
|
+
if (p.startsWith('/'))
|
|
123
|
+
p = p.slice(1);
|
|
124
|
+
if (p.endsWith('/'))
|
|
125
|
+
p = p.slice(0, -1);
|
|
126
|
+
return p;
|
|
127
|
+
}
|
|
128
|
+
function stripDocumentsPrefix(s) {
|
|
129
|
+
const marker = '/documents/';
|
|
130
|
+
const idx = s.indexOf(marker);
|
|
131
|
+
if (idx === -1)
|
|
132
|
+
return s;
|
|
133
|
+
return s.slice(idx + marker.length);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Build the fully-qualified resource name used by Firestore's
|
|
137
|
+
* `referenceValue` wire field. The simulator doesn't carry a real
|
|
138
|
+
* project ID, so callers (the wire encoder) supply one — defaulting
|
|
139
|
+
* to `'sim'` and database `'(default)'` keeps the round-trip intact
|
|
140
|
+
* without inventing fake projects in the wrapper itself.
|
|
141
|
+
*/
|
|
142
|
+
export function referenceToResourceName(ref, projectId = 'sim', databaseId = '(default)') {
|
|
143
|
+
return `projects/${projectId}/databases/${databaseId}/documents/${ref.path}`;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.js","sourceRoot":"","sources":["../../../../src/rules/simulator/wrappers/reference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,EAAa,MAAM,WAAW,CAAC;AAEzD,MAAM,OAAO,SAAU,SAAQ,UAAU;IAC9B,QAAQ,GAAG,WAAW,CAAC;IAEhC,sEAAsE;IAC7D,IAAI,CAAS;IAEtB,YAAY,IAAY;QACtB,KAAK,EAAE,CAAC;QACR,yEAAyE;QACzE,qEAAqE;QACrE,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,YAAoB;QAC1C,OAAO,IAAI,SAAS,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,+CAA+C;IAC/C,IAAI,EAAE;QACJ,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACrC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,MAAM;Q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AAC,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxC,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,oBAAoB,CAAC,CAAS;IACrC,MAAM,MAAM,GAAG,aAAa,CAAC;IAC7B,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAI,GAAG,KAAK,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IACzB,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,GAAc,EACd,YAAoB,KAAK,EACzB,aAAqB,WAAW;IAEhC,OAAO,YAAY,SAAS,cAAc,UAAU,cAAc,GAAG,CAAC,IAAI,EAAE,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timestamp wrapper for Firestore Rules `timestamp` type — Item 1.3.
|
|
3
|
+
*
|
|
4
|
+
* Closes the entire `Timestamp` type gap (was "❌ entire type" in the
|
|
5
|
+
* REBUILD_PLAN Reference Inventory) and the `request.time` type bug
|
|
6
|
+
* (was an ISO string — see REBUILD_PLAN Risk 1).
|
|
7
|
+
*
|
|
8
|
+
* Reference surface (12 instance methods):
|
|
9
|
+
* date, day, dayOfWeek, dayOfYear, hours, minutes, month, nanos,
|
|
10
|
+
* seconds, time, toMillis, year
|
|
11
|
+
*
|
|
12
|
+
* Construction (atomic flip per REBUILD_PLAN Risk 3):
|
|
13
|
+
* - timestamp.date(y, m, d) month is 1-based
|
|
14
|
+
* - timestamp.value(epochMs) millis since Unix epoch
|
|
15
|
+
* - request.time wrapped by handler.ts
|
|
16
|
+
* - serverTimestamp sentinel resolution wrapped by handler.ts
|
|
17
|
+
*
|
|
18
|
+
* Internal storage per 0.C: plain `{ seconds, nanos }` Numbers.
|
|
19
|
+
* Comparison and arithmetic go field-wise via binaryOp; valueOf() is a
|
|
20
|
+
* legacy-fallback only and silently truncates sub-ms precision.
|
|
21
|
+
*
|
|
22
|
+
* Canonical form: nanos in `[0, 999_999_999]` non-negative (protobuf
|
|
23
|
+
* Timestamp spec). Negative epoch seconds are allowed (pre-1970) but
|
|
24
|
+
* nanos always normalize positive — `equals()` is a straight field
|
|
25
|
+
* compare without per-call normalization.
|
|
26
|
+
*/
|
|
27
|
+
import { RulesValue, type NoOp } from './base.js';
|
|
28
|
+
export declare class Timestamp extends RulesValue {
|
|
29
|
+
readonly typeName = "timestamp";
|
|
30
|
+
readonly seconds: number;
|
|
31
|
+
readonly nanos: number;
|
|
32
|
+
constructor(seconds: number, nanos: number);
|
|
33
|
+
/** `timestamp.value(epochMs)` — milliseconds since Unix epoch. */
|
|
34
|
+
static fromMillis(ms: number): Timestamp;
|
|
35
|
+
/** `timestamp.date(y, m, d)` — midnight UTC; month is 1-based. */
|
|
36
|
+
static fromYMD(year: number, month: number, day: number): Timestamp;
|
|
37
|
+
/**
|
|
38
|
+
* Parse an ISO-8601 string into a Timestamp. Used by `handler.ts` to
|
|
39
|
+
* convert `tc.requestTime` (kept as ISO string for backwards-compat
|
|
40
|
+
* with the prod Test API) into the wrapper. Sub-millisecond precision
|
|
41
|
+
* in the input string is dropped because `Date.parse` only sees ms —
|
|
42
|
+
* acceptable here because `tc.requestTime` is a developer-facing pin
|
|
43
|
+
* (no nanosecond precision test exists for it).
|
|
44
|
+
*/
|
|
45
|
+
static fromIsoString(iso: string): Timestamp;
|
|
46
|
+
toMillis(): number;
|
|
47
|
+
/**
|
|
48
|
+
* Convert to a JavaScript `Date` (millisecond precision).
|
|
49
|
+
* Sub-millisecond nanos are dropped — same behaviour as the real
|
|
50
|
+
* `firebase/firestore` `Timestamp.toDate()`.
|
|
51
|
+
*/
|
|
52
|
+
toDate(): Date;
|
|
53
|
+
valueOf(): number;
|
|
54
|
+
/**
|
|
55
|
+
* ISO-8601 UTC with 9-digit nanosecond precision. Standard
|
|
56
|
+
* `Date.toISOString()` only carries millisecond precision; we
|
|
57
|
+
* substitute the full nanos to preserve sub-ms detail for
|
|
58
|
+
* debugMessages.
|
|
59
|
+
*/
|
|
60
|
+
toString(): string;
|
|
61
|
+
toJSON(): unknown;
|
|
62
|
+
equals(other: unknown): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Date components (year/month/day/hours/etc.) derive from JS `Date`
|
|
65
|
+
* which only handles millisecond precision. The Timestamp's `seconds`
|
|
66
|
+
* field already encodes whole-seconds, so date math is exact even
|
|
67
|
+
* when sub-ms nanos are present. `dayOfWeek` follows ISO 8601:
|
|
68
|
+
* Monday = 1, Sunday = 7.
|
|
69
|
+
*/
|
|
70
|
+
callMethod(method: string, _args: unknown[]): unknown | NoOp;
|
|
71
|
+
private asDate;
|
|
72
|
+
/**
|
|
73
|
+
* Cross-type arithmetic per REBUILD_PLAN Operators table:
|
|
74
|
+
* Timestamp + Duration → Timestamp
|
|
75
|
+
* Timestamp - Duration → Timestamp
|
|
76
|
+
* Timestamp - Timestamp → Duration
|
|
77
|
+
* Plus `< <= > >=` for two Timestamps via field-wise compareTo.
|
|
78
|
+
*
|
|
79
|
+
* `Duration + Timestamp` (commutative) is reachable through the
|
|
80
|
+
* evaluator's right-side dispatch on `+` — Duration.binaryOp returns
|
|
81
|
+
* NO_OP, then `rv` (Timestamp).binaryOp(+, lv) lands here.
|
|
82
|
+
*/
|
|
83
|
+
binaryOp(op: string, other: unknown): unknown | NoOp;
|
|
84
|
+
private compareTo;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=timestamp.d.ts.map
|
|
@@ -0,0 +1 @@
|
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rapper for Firestore Rules `timestamp` type — Item 1.3.
|
|
3
|
+
*
|
|
4
|
+
* Closes the entire `Timestamp` type gap (was "❌ entire type" in the
|
|
5
|
+
* REBUILD_PLAN Reference Inventory) and the `request.time` type bug
|
|
6
|
+
* (was an ISO string — see REBUILD_PLAN Risk 1).
|
|
7
|
+
*
|
|
8
|
+
* Reference surface (12 instance methods):
|
|
9
|
+
* date, day, dayOfWeek, dayOfYear, hours, minutes, month, nanos,
|
|
10
|
+
* seconds, time, toMillis, year
|
|
11
|
+
*
|
|
12
|
+
* Construction (atomic flip per REBUILD_PLAN Risk 3):
|
|
13
|
+
* - timestamp.date(y, m, d) month is 1-based
|
|
14
|
+
* - timestamp.value(epochMs) millis since Unix epoch
|
|
15
|
+
* - request.time wrapped by handler.ts
|
|
16
|
+
* - serverTimestamp sentinel resolution wrapped by handler.ts
|
|
17
|
+
*
|
|
18
|
+
* Internal storage per 0.C: plain `{ seconds, nanos }` Numbers.
|
|
19
|
+
* Comparison and arithmetic go field-wise via binaryOp; valueOf() is a
|
|
20
|
+
* legacy-fallback only and silently truncates sub-ms precision.
|
|
21
|
+
*
|
|
22
|
+
* Canonical form: nanos in `[0, 999_999_999]` non-negative (protobuf
|
|
23
|
+
* Timestamp spec). Negative epoch seconds are allowed (pre-1970) but
|
|
24
|
+
* nanos always normalize positive — `equals()` is a straight field
|
|
25
|
+
* compare without per-call normalization.
|
|
26
|
+
*/
|
|
27
|
+
import { RulesValue, NO_OP } from './base.js';
|
|
28
|
+
import { Duration } from './duration.js';
|
|
29
|
+
const NANOS_PER_SECOND = 1_000_000_000;
|
|
30
|
+
const MS_PER_DAY = 86_400_000;
|
|
31
|
+
const SECONDS_PER_DAY = 86_400;
|
|
32
|
+
/**
|
|
33
|
+
* Roll over-/under-flow nanos into seconds and force nanos non-negative.
|
|
34
|
+
* Uses `Math.floor` (not truncation) so negative nanos correctly borrow
|
|
35
|
+
* a second: `(0, -1)` → `(-1, 999_999_999)` rather than `(0, -1)`.
|
|
36
|
+
*/
|
|
37
|
+
function normalize(seconds, nanos) {
|
|
38
|
+
const carry = Math.floor(nanos / NANOS_PER_SECOND);
|
|
39
|
+
return {
|
|
40
|
+
seconds: seconds + carry,
|
|
41
|
+
nanos: nanos - carry * NANOS_PER_SECOND,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export class Timestamp extends RulesValue {
|
|
45
|
+
typeName = 'timestamp';
|
|
46
|
+
seconds;
|
|
47
|
+
nanos;
|
|
48
|
+
constructor(seconds, nanos) {
|
|
49
|
+
super();
|
|
50
|
+
const norm = normalize(seconds, nanos);
|
|
51
|
+
this.seconds = norm.seconds;
|
|
52
|
+
this.nanos = norm.nanos;
|
|
53
|
+
}
|
|
54
|
+
/** `timestamp.value(epochMs)` — milliseconds since Unix epoch. */
|
|
55
|
+
static fromMillis(ms) {
|
|
56
|
+
const seconds = Math.floor(ms / 1000);
|
|
57
|
+
const remainderMs = ms - seconds * 1000;
|
|
58
|
+
return new Timestamp(seconds, remainderMs * 1_000_000);
|
|
59
|
+
}
|
|
60
|
+
/** `timestamp.date(y, m, d)` — midnight UTC; month is 1-based. */
|
|
61
|
+
static fromYMD(year, month, day) {
|
|
62
|
+
return Timestamp.fromMillis(Date.UTC(year, month - 1, day));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Parse an ISO-8601 string into a Timestamp. Used by `handler.ts` to
|
|
66
|
+
* convert `tc.requestTime` (kept as ISO string for backwards-compat
|
|
67
|
+
* with the prod Test API) into the wrapper. Sub-millisecond precision
|
|
68
|
+
* in the input string is dropped because `Date.parse` only sees ms —
|
|
69
|
+
* acceptable here because `tc.requestTime` is a developer-facing pin
|
|
70
|
+
* (no nanosecond precision test exists for it).
|
|
71
|
+
*/
|
|
72
|
+
static fromIsoString(iso) {
|
|
73
|
+
return Timestamp.fromMillis(Date.parse(iso));
|
|
74
|
+
}
|
|
75
|
+
toMillis() {
|
|
76
|
+
return this.seconds * 1000 + Math.floor(this.nanos / 1_000_000);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Convert to a JavaScript `Date` (millisecond precision).
|
|
80
|
+
* Sub-millisecond nanos are dropped — same behaviour as the real
|
|
81
|
+
* `firebase/firestore` `Timestamp.toDate()`.
|
|
82
|
+
*/
|
|
83
|
+
toDate() {
|
|
84
|
+
return new Date(this.toMillis());
|
|
85
|
+
}
|
|
86
|
+
valueOf() {
|
|
87
|
+
return this.toMillis();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* ISO-8601 UTC with 9-digit nanosecond precision. Standard
|
|
91
|
+
* `Date.toISOString()` only carries millisecond precision; we
|
|
92
|
+
* substitute the full nanos to preserve sub-ms detail for
|
|
93
|
+
* debugMessages.
|
|
94
|
+
*/
|
|
95
|
+
toString() {
|
|
96
|
+
const isoMs = new Date(this.toMillis()).toISOString();
|
|
97
|
+
const nanoStr = this.nanos.toString().padStart(9, '0');
|
|
98
|
+
return isoMs.replace(/\.\d{3}Z$/, `.${nanoStr}Z`);
|
|
99
|
+
}
|
|
100
|
+
toJSON() {
|
|
101
|
+
return { __type: 'timestamp', seconds: this.seconds, nanos: this.nanos };
|
|
102
|
+
}
|
|
103
|
+
equals(other) {
|
|
104
|
+
return (other instanceof Timestamp &&
|
|
105
|
+
this.seconds === other.seconds &&
|
|
106
|
+
this.nanos === other.nanos);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Date components (year/month/day/hours/etc.) derive from JS `Date`
|
|
110
|
+
* which only handles millisecond precision. The Timestamp's `seconds`
|
|
111
|
+
* field already encodes whole-seconds, so date math is exact even
|
|
112
|
+
* when sub-ms nanos are present. `dayOfWeek` follows ISO 8601:
|
|
113
|
+
* Monday = 1, Sunday = 7.
|
|
114
|
+
*/
|
|
115
|
+
callMethod(method, _args) {
|
|
116
|
+
switch (method) {
|
|
117
|
+
case 'seconds':
|
|
118
|
+
return this.seconds;
|
|
119
|
+
case 'nanos':
|
|
120
|
+
return this.nanos;
|
|
121
|
+
case 'toMillis':
|
|
122
|
+
return this.toMillis();
|
|
123
|
+
case 'year':
|
|
124
|
+
return this.asDate().getUTCFullYear();
|
|
125
|
+
case 'month':
|
|
126
|
+
return this.asDate().getUTCMonth() + 1;
|
|
127
|
+
case 'day':
|
|
128
|
+
return this.asDate().getUTCDate();
|
|
129
|
+
case 'hours':
|
|
130
|
+
return this.asDate().getUTCHours();
|
|
131
|
+
case 'minutes':
|
|
132
|
+
return this.asDate().getUTCMinutes();
|
|
133
|
+
case 'dayOfWeek': {
|
|
134
|
+
const jsDay = this.asDate().getUTCDay(); // 0=Sun .. 6=Sat
|
|
135
|
+
return jsDay === 0 ? 7 : jsDay;
|
|
136
|
+
}
|
|
137
|
+
case 'dayOfYear': {
|
|
138
|
+
const d = this.asDate();
|
|
139
|
+
const startOfYear = Date.UTC(d.getUTCFullYear(), 0, 1);
|
|
140
|
+
return Math.floor((this.toMillis() - startOfYear) / MS_PER_DAY) + 1;
|
|
141
|
+
}
|
|
142
|
+
case 'date':
|
|
143
|
+
// Same year/month/day, time-of-day zeroed.
|
|
144
|
+
return Timestamp.fromYMD(this.asDate().getUTCFullYear(), this.asDate().getUTCMonth() + 1, this.asDate().getUTCDate());
|
|
145
|
+
case 'time': {
|
|
146
|
+
// Time-of-day as Duration. Compute from seconds field directly
|
|
147
|
+
// so sub-ms nanos survive (JS Date would truncate them).
|
|
148
|
+
const secOfDay = ((this.seconds % SECONDS_PER_DAY) + SECONDS_PER_DAY) % SECONDS_PER_DAY;
|
|
149
|
+
const h = Math.floor(secOfDay / 3600);
|
|
150
|
+
const m = Math.floor((secOfDay % 3600) / 60);
|
|
151
|
+
const s = secOfDay % 60;
|
|
152
|
+
return Duration.fromTime(h, m, s, this.nanos);
|
|
153
|
+
}
|
|
154
|
+
default:
|
|
155
|
+
return NO_OP;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
asDate() {
|
|
159
|
+
return new Date(this.toMillis());
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Cross-type arithmetic per REBUILD_PLAN Operators table:
|
|
163
|
+
* Timestamp + Duration → Timestamp
|
|
164
|
+
* Timestamp - Duration → Timestamp
|
|
165
|
+
* Timestamp - Timestamp → Duration
|
|
166
|
+
* Plus `< <= > >=` for two Timestamps via field-wise compareTo.
|
|
167
|
+
*
|
|
168
|
+
* `Duration + Timestamp` (commutative) is reachable through the
|
|
169
|
+
* evaluator's right-side dispatch on `+` — Duration.binaryOp returns
|
|
170
|
+
* NO_OP, then `rv` (Timestamp).binaryOp(+, lv) lands here.
|
|
171
|
+
*/
|
|
172
|
+
binaryOp(op, other) {
|
|
173
|
+
if (other instanceof Timestamp) {
|
|
174
|
+
switch (op) {
|
|
175
|
+
case '-':
|
|
176
|
+
return new Duration(this.seconds - other.seconds, this.nanos - other.nanos);
|
|
177
|
+
case '<':
|
|
178
|
+
return this.compareTo(other) < 0;
|
|
179
|
+
case '<=':
|
|
180
|
+
return this.compareTo(other) <= 0;
|
|
181
|
+
case '>':
|
|
182
|
+
return this.compareTo(other) > 0;
|
|
183
|
+
case '>=':
|
|
184
|
+
return this.compareTo(other) >= 0;
|
|
185
|
+
default:
|
|
186
|
+
return NO_OP;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (other instanceof Duration) {
|
|
190
|
+
switch (op) {
|
|
191
|
+
case '+':
|
|
192
|
+
return new Timestamp(this.seconds + other.seconds, this.nanos + other.nanos);
|
|
193
|
+
case '-':
|
|
194
|
+
return new Timestamp(this.seconds - other.seconds, this.nanos - other.nanos);
|
|
195
|
+
default:
|
|
196
|
+
return NO_OP;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return NO_OP;
|
|
200
|
+
}
|
|
201
|
+
compareTo(other) {
|
|
202
|
+
if (this.seconds !== other.seconds)
|
|
203
|
+
return this.seconds - other.seconds;
|
|
204
|
+
return this.nanos - other.nanos;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=timest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prod-parity.md.
|
|
3
|
+
*
|
|
4
|
+
* Vector surface (rules side):
|
|
5
|
+
* The Firestore Rules language does NOT expose a `vector` type test
|
|
6
|
+
* or any vector-specific properties. Vectors exist purely on the data
|
|
7
|
+
* side — they round-trip through wire encoding so that the discover
|
|
8
|
+
* crawler reports `kind: 'vector', dimension: N`, and so that rules
|
|
9
|
+
* that treat the field as an opaque map (`field is map`, etc.) see
|
|
10
|
+
* the sentinel shape live Firestore would expose.
|
|
11
|
+
*
|
|
12
|
+
* Because there's no `is vector` in the grammar, the wrapper's
|
|
13
|
+
* typeName isn't a parser-visible token; it's still recorded for
|
|
14
|
+
* diagnostics and the toJSON debug shape.
|
|
15
|
+
*
|
|
16
|
+
* Per 0.B per-wrapper table:
|
|
17
|
+
* typeName: 'vector'
|
|
18
|
+
* valueOf: NaN (no meaningful numeric coercion)
|
|
19
|
+
* toString: '[v0, v1, ...]' (human-readable, no parser round-trip)
|
|
20
|
+
* equals: element-wise equality on .value arrays
|
|
21
|
+
* binaryOp: NO_OP (no defined cross-type ops)
|
|
22
|
+
*
|
|
23
|
+
* Why a class wrapper rather than a plain `{__type__: '__vector__'}`
|
|
24
|
+
* object: the write-boundary resolver descends into plain objects but
|
|
25
|
+
* skips class instances. Wrapping in a class is what makes "agent
|
|
26
|
+
* passes admin SDK VectorValue" round-trip cleanly without having to
|
|
27
|
+
* detect the sentinel map at every read site too.
|
|
28
|
+
*/
|
|
29
|
+
import { RulesValue, type NoOp } from './base.js';
|
|
30
|
+
export declare class Vector extends RulesValue {
|
|
31
|
+
readonly typeName = "vector";
|
|
32
|
+
/** Defensive copy of the input array — Vector instances are immutable. */
|
|
33
|
+
readonly value: readonly number[];
|
|
34
|
+
constructor(value: readonly number[]);
|
|
35
|
+
/** Length of the vector — how many components it has. */
|
|
36
|
+
get dimension(): number;
|
|
37
|
+
valueOf(): number;
|
|
38
|
+
toString(): string;
|
|
39
|
+
toJSON(): unknown;
|
|
40
|
+
equals(other: unknown): boolean;
|
|
41
|
+
callMethod(_method: string, _args: unknown[]): unknown | NoOp;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=vector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../../src/rules/simulator/wrappers/vector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,UAAU,EAAS,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAEzD,qBAAa,MAAO,SAAQ,UAAU;IACpC,QAAQ,CAAC,QAAQ,YAAY;IAE7B,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;gBAEtB,KAAK,EAAE,SAAS,MAAM,EAAE;IAgBpC,yDAAyD;IACzD,IAAI,SAAS,IAAI,MAAM,CAEtB;IAID,OAAO,IAAI,MAAM;IAIjB,QAAQ,IAAI,MAAM;IAIlB,MAAM,IAAI,OAAO;IAOjB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAS/B,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,GAAG,IAAI;CAI9D"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vector wrapper — Item 5 of simulator-prod-parity.md.
|
|
3
|
+
*
|
|
4
|
+
* Vector surface (rules side):
|
|
5
|
+
* The Firestore Rules language does NOT expose a `vector` type test
|
|
6
|
+
* or any vector-specific properties. Vectors exist purely on the data
|
|
7
|
+
* side — they round-trip through wire encoding so that the discover
|
|
8
|
+
* crawler reports `kind: 'vector', dimension: N`, and so that rules
|
|
9
|
+
* that treat the field as an opaque map (`field is map`, etc.) see
|
|
10
|
+
* the sentinel shape live Firestore would expose.
|
|
11
|
+
*
|
|
12
|
+
* Because there's no `is vector` in the grammar, the wrapper's
|
|
13
|
+
* typeName isn't a parser-visible token; it's still recorded for
|
|
14
|
+
* diagnostics and the toJSON debug shape.
|
|
15
|
+
*
|
|
16
|
+
* Per 0.B per-wrapper table:
|
|
17
|
+
* typeName: 'vector'
|
|
18
|
+
* valueOf: NaN (no meaningful numeric coercion)
|
|
19
|
+
* toString: '[v0, v1, ...]' (human-readable, no parser round-trip)
|
|
20
|
+
* equals: element-wise equality on .value arrays
|
|
21
|
+
* binaryOp: NO_OP (no defined cross-type ops)
|
|
22
|
+
*
|
|
23
|
+
* Why a class wrapper rather than a plain `{__type__: '__vector__'}`
|
|
24
|
+
* object: the write-boundary resolver descends into plain objects but
|
|
25
|
+
* skips class instances. Wrapping in a class is what makes "agent
|
|
26
|
+
* passes admin SDK VectorValue" round-trip cleanly without having to
|
|
27
|
+
* detect the sentinel map at every read site too.
|
|
28
|
+
*/
|
|
29
|
+
import { RulesValue, NO_OP } from './base.js';
|
|
30
|
+
export class Vector extends RulesValue {
|
|
31
|
+
typeName = 'vector';
|
|
32
|
+
/** Defensive copy of the input array — Vector instances are immutable. */
|
|
33
|
+
value;
|
|
34
|
+
constructor(value) {
|
|
35
|
+
super();
|
|
36
|
+
if (!Array.isArray(value)) {
|
|
37
|
+
throw new TypeError('Vector: value must be a number[]');
|
|
38
|
+
}
|
|
39
|
+
for (let i = 0; i < value.length; i++) {
|
|
40
|
+
if (typeof value[i] !== 'number') {
|
|
41
|
+
throw new TypeError(`Vector: element at index ${i} is not a number (got ${typeof value[i]})`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Freeze a copy so callers can't mutate the wrapper after construction.
|
|
45
|
+
this.value = Object.freeze(value.slice());
|
|
46
|
+
}
|
|
47
|
+
/** Length of the vector — how many components it has. */
|
|
48
|
+
get dimension() {
|
|
49
|
+
return this.value.length;
|
|
50
|
+
}
|
|
51
|
+
// ─── RulesValue contract ─────────────────────────────────────────────
|
|
52
|
+
valueOf() {
|
|
53
|
+
return NaN; // No meaningful numeric coercion.
|
|
54
|
+
}
|
|
55
|
+
toString() {
|
|
56
|
+
return `[${this.value.join(', ')}]`;
|
|
57
|
+
}
|
|
58
|
+
toJSON() {
|
|
59
|
+
// Mirrors the wire sentinel shape (`__type__`/`value`) so a
|
|
60
|
+
// JSON.stringify round-trip looks like the encoded form a
|
|
61
|
+
// discover crawler would see.
|
|
62
|
+
return { __type__: '__vector__', value: this.value.slice() };
|
|
63
|
+
}
|
|
64
|
+
equals(other) {
|
|
65
|
+
if (!(other instanceof Vector))
|
|
66
|
+
return false;
|
|
67
|
+
if (other.value.length !== this.value.length)
|
|
68
|
+
return false;
|
|
69
|
+
for (let i = 0; i < this.value.length; i++) {
|
|
70
|
+
if (other.value[i] !== this.value[i])
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
callMethod(_method, _args) {
|
|
76
|
+
// No methods exposed to rules.
|
|
77
|
+
return NO_OP;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=vector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector.js","sourceRoot":"","sources":["../../../../src/rules/simulator/wrappers/vector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,EAAa,MAAM,WAAW,CAAC;AAEzD,MAAM,OAAO,MAAO,SAAQ,UAAU;IAC3B,QAAQ,GAAG,QAAQ,CAAC;IAE7B,0EAA0E;IACjE,KAAK,CAAoB;IAElC,YAAY,KAAwB;QAClC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,SAAS,CAAC,kCAAkC,CAAC,CAAC;QAC1D,CAAC;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,IAAI,OA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Ae,EAAE,KAAgB;QAC1C,+BAA+B;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `createFirestoreSimulatorTools` factory — extracted from `tools.ts`
|
|
3
|
+
* so it can run in both Node and the browser without forcing the
|
|
4
|
+
* Node-only `resolveModules` (which reads stdlib off disk) into the
|
|
5
|
+
* browser bundle.
|
|
6
|
+
*
|
|
7
|
+
* The factory takes `resolveModulesFn` as an injected dep:
|
|
8
|
+
* - `pyric/rules/node` wires `resolveModules` from `./modules/resolver.js`
|
|
9
|
+
* — Node's disk-reading version.
|
|
10
|
+
* - `./simulator.ts` wires `resolveModulesBrowser` from
|
|
11
|
+
* `./modules/resolver-browser.js`, which pre-supplies the stdlib content
|
|
12
|
+
* inlined at build time.
|
|
13
|
+
* - When the dep is absent, the `firestore_simulator_create` tool
|
|
14
|
+
* returns a clear error if a caller seeds `'2+modules'` rules.
|
|
15
|
+
*
|
|
16
|
+
* Why this matters: prior to the extraction, `@pyric/dev`'s browser
|
|
17
|
+
* client hand-coded a parallel dispatcher that mirrored these tool
|
|
18
|
+
* shapes. Any new simulator tool added to `tools.ts` silently
|
|
19
|
+
* diverged from the dispatcher. Now both sides consume this single
|
|
20
|
+
* source of truth.
|
|
21
|
+
*/
|
|
22
|
+
import type { ToolHandler } from '@inbrowser/agent';
|
|
23
|
+
import type { LocalEnvironment } from 'pyric/sandbox/internal';
|
|
24
|
+
import type { ResolveResult } from './modules/resolver.js';
|
|
25
|
+
export interface FirestoreSimulatorToolDeps {
|
|
26
|
+
/**
|
|
27
|
+
* Per-dispatch resolver returning the session's LocalEnvironment.
|
|
28
|
+
* Per F4, handlers call this inside `execute` — hosts that reset
|
|
29
|
+
* or swap the sandbox transparently get fresh environments
|
|
30
|
+
* without re-registering tools.
|
|
31
|
+
*
|
|
32
|
+
* For sessions that need a single long-lived env, the host can
|
|
33
|
+
* pass `() => singletonEnv`; for fleets that isolate per-session,
|
|
34
|
+
* `() => sessionContext.env`.
|
|
35
|
+
*/
|
|
36
|
+
resolveSandbox: () => LocalEnvironment | Promise<LocalEnvironment>;
|
|
37
|
+
/**
|
|
38
|
+
* Resolver for `rules_version = '2+modules'` sources. Wire one of:
|
|
39
|
+
* - `resolveModules` from `./modules/resolver.js` (Node; disk).
|
|
40
|
+
* - `resolveModulesBrowser` from `./modules/resolver-browser.js`
|
|
41
|
+
* (browser; inlined stdlib).
|
|
42
|
+
* When absent, attempts to seed `2+modules` rules error cleanly.
|
|
43
|
+
*/
|
|
44
|
+
resolveModulesFn?: (source: string) => ResolveResult;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Stateful simulator tools — operate against a session-scoped
|
|
48
|
+
* `LocalEnvironment`. The nine-tool family — `_create`, `_execute`,
|
|
49
|
+
* `_read`, `_batch`, `_create_with_auto_id`, `_undo`, `_redo`,
|
|
50
|
+
* `_events`, `_transaction` — is the factory-shaped simulator tool group.
|
|
51
|
+
*
|
|
52
|
+
* Key shape difference vs legacy: there is no `environmentId`. In
|
|
53
|
+
* factory mode the resolved `LocalEnvironment` IS the environment —
|
|
54
|
+
* one per session. Hosts that need multi-env semantics can layer
|
|
55
|
+
* registry/context above the resolver. `firestore_simulator_create`
|
|
56
|
+
* therefore acts as a re-seed: it overwrites whatever the resolved
|
|
57
|
+
* env held before.
|
|
58
|
+
*
|
|
59
|
+
* `resolveSandbox` is awaited inside each handler so hosts that swap
|
|
60
|
+
* environments transparently (per-session fleets, hot-reload pipes)
|
|
61
|
+
* get fresh refs without re-registering tools.
|
|
62
|
+
*/
|
|
63
|
+
export declare function createFirestoreSimulatorTools(deps: FirestoreSimulatorToolDeps): ToolHandler[];
|
|
64
|
+
//# sourceMappingURL=simulator-tools-impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulator-tools-impl.d.ts","sourceRoot":"","sources":["../../src/rules/simulator-tools-impl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAW3D,MAAM,WAAW,0BAA0B;IACzC;;;;;;;;;OASG;IACH,cAAc,EAAE,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnE;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,aAAa,CAAC;CACtD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,0BAA0B,GAC/B,WAAW,EAAE,CAmdf"}
|