pyric 0.0.1 → 0.1.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -2
- package/README.md.orig +54 -0
- package/dist/app/index.d.ts +81 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/app/index.js +78 -0
- package/dist/app/index.js.map +1 -0
- package/dist/auth/index.d.ts +346 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +701 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/prod-backend.d.ts +39 -0
- package/dist/auth/prod-backend.d.ts.map +1 -0
- package/dist/auth/prod-backend.js +179 -0
- package/dist/auth/prod-backend.js.map +1 -0
- package/dist/auth/providers.d.ts +107 -0
- package/dist/auth/providers.d.ts.map +1 -0
- package/dist/auth/providers.js +138 -0
- package/dist/auth/providers.js.map +1 -0
- package/dist/auth/sandbox-backend.d.ts +769 -0
- package/dist/auth/sandbox-backend.d.ts.map +1 -0
- package/dist/auth/sandbox-backend.js +1598 -0
- package/dist/auth/sandbox-backend.js.map +1 -0
- package/dist/auth/target.d.ts +40 -0
- package/dist/auth/target.d.ts.map +1 -0
- package/dist/auth/target.js +28 -0
- package/dist/auth/target.js.map +1 -0
- package/dist/auth/types.d.ts +252 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +26 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/database/constraints/atoms.d.ts +29 -0
- package/dist/database/constraints/atoms.d.ts.map +1 -0
- package/dist/database/constraints/atoms.js +43 -0
- package/dist/database/constraints/atoms.js.map +1 -0
- package/dist/database/constraints/compose.d.ts +16 -0
- package/dist/database/constraints/compose.d.ts.map +1 -0
- package/dist/database/constraints/compose.js +15 -0
- package/dist/database/constraints/compose.js.map +1 -0
- package/dist/database/constraints/data.d.ts +30 -0
- package/dist/database/constraints/data.d.ts.map +1 -0
- package/dist/database/constraints/data.js +46 -0
- package/dist/database/constraints/data.js.map +1 -0
- package/dist/database/constraints/document.d.ts +42 -0
- package/dist/database/constraints/document.d.ts.map +1 -0
- package/dist/database/constraints/document.js +86 -0
- package/dist/database/constraints/document.js.map +1 -0
- package/dist/database/constraints/game.d.ts +30 -0
- package/dist/database/constraints/game.d.ts.map +1 -0
- package/dist/database/constraints/game.js +49 -0
- package/dist/database/constraints/game.js.map +1 -0
- package/dist/database/constraints/index.d.ts +12 -0
- package/dist/database/constraints/index.d.ts.map +1 -0
- package/dist/database/constraints/index.js +9 -0
- package/dist/database/constraints/index.js.map +1 -0
- package/dist/database/constraints/policies.d.ts +16 -0
- package/dist/database/constraints/policies.d.ts.map +1 -0
- package/dist/database/constraints/policies.js +17 -0
- package/dist/database/constraints/policies.js.map +1 -0
- package/dist/database/constraints/ruleset.d.ts +5 -0
- package/dist/database/constraints/ruleset.d.ts.map +1 -0
- package/dist/database/constraints/ruleset.js +132 -0
- package/dist/database/constraints/ruleset.js.map +1 -0
- package/dist/database/constraints/schema.d.ts +17 -0
- package/dist/database/constraints/schema.d.ts.map +1 -0
- package/dist/database/constraints/schema.js +74 -0
- package/dist/database/constraints/schema.js.map +1 -0
- package/dist/database/constraints/types.d.ts +22 -0
- package/dist/database/constraints/types.d.ts.map +1 -0
- package/dist/database/constraints/types.js +2 -0
- package/dist/database/constraints/types.js.map +1 -0
- package/dist/database/crawl/handler.d.ts +7 -0
- package/dist/database/crawl/handler.d.ts.map +1 -0
- package/dist/database/crawl/handler.js +91 -0
- package/dist/database/crawl/handler.js.map +1 -0
- package/dist/database/crawl/semaphore.d.ts +9 -0
- package/dist/database/crawl/semaphore.d.ts.map +1 -0
- package/dist/database/crawl/semaphore.js +27 -0
- package/dist/database/crawl/semaphore.js.map +1 -0
- package/dist/database/crawl/spec.d.ts +33 -0
- package/dist/database/crawl/spec.d.ts.map +1 -0
- package/dist/database/crawl/spec.js +12 -0
- package/dist/database/crawl/spec.js.map +1 -0
- package/dist/database/data/handler.d.ts +9 -0
- package/dist/database/data/handler.d.ts.map +1 -0
- package/dist/database/data/handler.js +96 -0
- package/dist/database/data/handler.js.map +1 -0
- package/dist/database/data/spec.d.ts +77 -0
- package/dist/database/data/spec.d.ts.map +1 -0
- package/dist/database/data/spec.js +17 -0
- package/dist/database/data/spec.js.map +1 -0
- package/dist/database/data/validated.d.ts +8 -0
- package/dist/database/data/validated.d.ts.map +1 -0
- package/dist/database/data/validated.js +99 -0
- package/dist/database/data/validated.js.map +1 -0
- package/dist/database/grammar/RtdbExpr.ohm +98 -0
- package/dist/database/grammar/RtdbExpr.ohm.generated.d.ts +2 -0
- package/dist/database/grammar/RtdbExpr.ohm.generated.d.ts.map +1 -0
- package/dist/database/grammar/RtdbExpr.ohm.generated.js +103 -0
- package/dist/database/grammar/RtdbExpr.ohm.generated.js.map +1 -0
- package/dist/database/grammar/RtdbExprParser.d.ts +5 -0
- package/dist/database/grammar/RtdbExprParser.d.ts.map +1 -0
- package/dist/database/grammar/RtdbExprParser.js +53 -0
- package/dist/database/grammar/RtdbExprParser.js.map +1 -0
- package/dist/database/grammar/linter.d.ts +3 -0
- package/dist/database/grammar/linter.d.ts.map +1 -0
- package/dist/database/grammar/linter.js +66 -0
- package/dist/database/grammar/linter.js.map +1 -0
- package/dist/database/grammar/simulator.d.ts +31 -0
- package/dist/database/grammar/simulator.d.ts.map +1 -0
- package/dist/database/grammar/simulator.js +255 -0
- package/dist/database/grammar/simulator.js.map +1 -0
- package/dist/database/grammar/validator.d.ts +3 -0
- package/dist/database/grammar/validator.d.ts.map +1 -0
- package/dist/database/grammar/validator.js +84 -0
- package/dist/database/grammar/validator.js.map +1 -0
- package/dist/database/host.d.ts +50 -0
- package/dist/database/host.d.ts.map +1 -0
- package/dist/database/host.js +41 -0
- package/dist/database/host.js.map +1 -0
- package/dist/database/index.d.ts +40 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +47 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/initialize-from-app.d.ts +28 -0
- package/dist/database/initialize-from-app.d.ts.map +1 -0
- package/dist/database/initialize-from-app.js +23 -0
- package/dist/database/initialize-from-app.js.map +1 -0
- package/dist/database/ir/handler.d.ts +6 -0
- package/dist/database/ir/handler.d.ts.map +1 -0
- package/dist/database/ir/handler.js +52 -0
- package/dist/database/ir/handler.js.map +1 -0
- package/dist/database/ir/spec.d.ts +25 -0
- package/dist/database/ir/spec.d.ts.map +1 -0
- package/dist/database/ir/spec.js +11 -0
- package/dist/database/ir/spec.js.map +1 -0
- package/dist/database/mapper.d.ts +9 -0
- package/dist/database/mapper.d.ts.map +1 -0
- package/dist/database/mapper.js +115 -0
- package/dist/database/mapper.js.map +1 -0
- package/dist/database/modular.d.ts +604 -0
- package/dist/database/modular.d.ts.map +1 -0
- package/dist/database/modular.js +1226 -0
- package/dist/database/modular.js.map +1 -0
- package/dist/database/replay.d.ts +33 -0
- package/dist/database/replay.d.ts.map +1 -0
- package/dist/database/replay.js +124 -0
- package/dist/database/replay.js.map +1 -0
- package/dist/database/resolver.d.ts +4 -0
- package/dist/database/resolver.d.ts.map +1 -0
- package/dist/database/resolver.js +66 -0
- package/dist/database/resolver.js.map +1 -0
- package/dist/database/sandbox/backend.d.ts +403 -0
- package/dist/database/sandbox/backend.d.ts.map +1 -0
- package/dist/database/sandbox/backend.js +1467 -0
- package/dist/database/sandbox/backend.js.map +1 -0
- package/dist/database/sandbox/data-tree.d.ts +123 -0
- package/dist/database/sandbox/data-tree.d.ts.map +1 -0
- package/dist/database/sandbox/data-tree.js +310 -0
- package/dist/database/sandbox/data-tree.js.map +1 -0
- package/dist/database/sandbox/normalize.d.ts +77 -0
- package/dist/database/sandbox/normalize.d.ts.map +1 -0
- package/dist/database/sandbox/normalize.js +165 -0
- package/dist/database/sandbox/normalize.js.map +1 -0
- package/dist/database/sandbox/push-id.d.ts +32 -0
- package/dist/database/sandbox/push-id.d.ts.map +1 -0
- package/dist/database/sandbox/push-id.js +82 -0
- package/dist/database/sandbox/push-id.js.map +1 -0
- package/dist/database/sandbox/query.d.ts +175 -0
- package/dist/database/sandbox/query.d.ts.map +1 -0
- package/dist/database/sandbox/query.js +269 -0
- package/dist/database/sandbox/query.js.map +1 -0
- package/dist/database/sandbox/rules-eval.d.ts +69 -0
- package/dist/database/sandbox/rules-eval.d.ts.map +1 -0
- package/dist/database/sandbox/rules-eval.js +124 -0
- package/dist/database/sandbox/rules-eval.js.map +1 -0
- package/dist/database/sandbox/sentinels.d.ts +71 -0
- package/dist/database/sandbox/sentinels.d.ts.map +1 -0
- package/dist/database/sandbox/sentinels.js +92 -0
- package/dist/database/sandbox/sentinels.js.map +1 -0
- package/dist/database/simulation/handler.d.ts +6 -0
- package/dist/database/simulation/handler.d.ts.map +1 -0
- package/dist/database/simulation/handler.js +236 -0
- package/dist/database/simulation/handler.js.map +1 -0
- package/dist/database/simulation/spec.d.ts +69 -0
- package/dist/database/simulation/spec.d.ts.map +1 -0
- package/dist/database/simulation/spec.js +25 -0
- package/dist/database/simulation/spec.js.map +1 -0
- package/dist/database/tools.d.ts +22 -0
- package/dist/database/tools.d.ts.map +1 -0
- package/dist/database/tools.js +272 -0
- package/dist/database/tools.js.map +1 -0
- package/dist/database/types.d.ts +210 -0
- package/dist/database/types.d.ts.map +1 -0
- package/dist/database/types.js +26 -0
- package/dist/database/types.js.map +1 -0
- package/dist/database/write/handler.d.ts +7 -0
- package/dist/database/write/handler.d.ts.map +1 -0
- package/dist/database/write/handler.js +42 -0
- package/dist/database/write/handler.js.map +1 -0
- package/dist/database/write/spec.d.ts +18 -0
- package/dist/database/write/spec.d.ts.map +1 -0
- package/dist/database/write/spec.js +7 -0
- package/dist/database/write/spec.js.map +1 -0
- package/dist/firestore/index.d.ts +533 -0
- package/dist/firestore/index.d.ts.map +1 -0
- package/dist/firestore/index.js +1536 -0
- package/dist/firestore/index.js.map +1 -0
- package/dist/firestore/tools.d.ts +67 -0
- package/dist/firestore/tools.d.ts.map +1 -0
- package/dist/firestore/tools.js +318 -0
- package/dist/firestore/tools.js.map +1 -0
- package/dist/firestore-values/index.d.ts +63 -0
- package/dist/firestore-values/index.d.ts.map +1 -0
- package/dist/firestore-values/index.js +148 -0
- package/dist/firestore-values/index.js.map +1 -0
- package/dist/project-scope.d.ts +5 -0
- package/dist/project-scope.d.ts.map +1 -0
- package/dist/project-scope.js +2 -0
- package/dist/project-scope.js.map +1 -0
- package/dist/rules/extract.d.ts +28 -0
- package/dist/rules/extract.d.ts.map +1 -0
- package/dist/rules/extract.js +25 -0
- package/dist/rules/extract.js.map +1 -0
- package/dist/rules/generators/assembler.d.ts +19 -0
- package/dist/rules/generators/assembler.d.ts.map +1 -0
- package/dist/rules/generators/assembler.js +292 -0
- package/dist/rules/generators/assembler.js.map +1 -0
- package/dist/rules/generators/expressions.d.ts +52 -0
- package/dist/rules/generators/expressions.d.ts.map +1 -0
- package/dist/rules/generators/expressions.js +117 -0
- package/dist/rules/generators/expressions.js.map +1 -0
- package/dist/rules/generators/grid.d.ts +22 -0
- package/dist/rules/generators/grid.d.ts.map +1 -0
- package/dist/rules/generators/grid.js +52 -0
- package/dist/rules/generators/grid.js.map +1 -0
- package/dist/rules/grammar/FirestoreAST.d.ts +129 -0
- package/dist/rules/grammar/FirestoreAST.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreAST.js +3 -0
- package/dist/rules/grammar/FirestoreAST.js.map +1 -0
- package/dist/rules/grammar/FirestoreAssembler.d.ts +5 -0
- package/dist/rules/grammar/FirestoreAssembler.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreAssembler.js +158 -0
- package/dist/rules/grammar/FirestoreAssembler.js.map +1 -0
- package/dist/rules/grammar/FirestoreParser.d.ts +46 -0
- package/dist/rules/grammar/FirestoreParser.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreParser.js +409 -0
- package/dist/rules/grammar/FirestoreParser.js.map +1 -0
- package/dist/rules/grammar/FirestoreRules.ohm +229 -0
- package/dist/rules/grammar/FirestoreRules.ohm.generated.d.ts +2 -0
- package/dist/rules/grammar/FirestoreRules.ohm.generated.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreRules.ohm.generated.js +234 -0
- package/dist/rules/grammar/FirestoreRules.ohm.generated.js.map +1 -0
- package/dist/rules/grammar/FirestoreValidator.d.ts +10 -0
- package/dist/rules/grammar/FirestoreValidator.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreValidator.js +482 -0
- package/dist/rules/grammar/FirestoreValidator.js.map +1 -0
- package/dist/rules/index.d.ts +67 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +80 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/indexes/extract/annotation-collect.d.ts +42 -0
- package/dist/rules/indexes/extract/annotation-collect.d.ts.map +1 -0
- package/dist/rules/indexes/extract/annotation-collect.js +69 -0
- package/dist/rules/indexes/extract/annotation-collect.js.map +1 -0
- package/dist/rules/indexes/extract/annotations.d.ts +50 -0
- package/dist/rules/indexes/extract/annotations.d.ts.map +1 -0
- package/dist/rules/indexes/extract/annotations.js +144 -0
- package/dist/rules/indexes/extract/annotations.js.map +1 -0
- package/dist/rules/indexes/extract/ast.d.ts +54 -0
- package/dist/rules/indexes/extract/ast.d.ts.map +1 -0
- package/dist/rules/indexes/extract/ast.js +119 -0
- package/dist/rules/indexes/extract/ast.js.map +1 -0
- package/dist/rules/indexes/extract/classify.d.ts +41 -0
- package/dist/rules/indexes/extract/classify.d.ts.map +1 -0
- package/dist/rules/indexes/extract/classify.js +138 -0
- package/dist/rules/indexes/extract/classify.js.map +1 -0
- package/dist/rules/indexes/extract/composite.d.ts +38 -0
- package/dist/rules/indexes/extract/composite.d.ts.map +1 -0
- package/dist/rules/indexes/extract/composite.js +85 -0
- package/dist/rules/indexes/extract/composite.js.map +1 -0
- package/dist/rules/indexes/extract/dataflow.d.ts +45 -0
- package/dist/rules/indexes/extract/dataflow.d.ts.map +1 -0
- package/dist/rules/indexes/extract/dataflow.js +200 -0
- package/dist/rules/indexes/extract/dataflow.js.map +1 -0
- package/dist/rules/indexes/extract/enumerate.d.ts +41 -0
- package/dist/rules/indexes/extract/enumerate.d.ts.map +1 -0
- package/dist/rules/indexes/extract/enumerate.js +163 -0
- package/dist/rules/indexes/extract/enumerate.js.map +1 -0
- package/dist/rules/indexes/extract/extractor.d.ts +3 -0
- package/dist/rules/indexes/extract/extractor.d.ts.map +1 -0
- package/dist/rules/indexes/extract/extractor.js +274 -0
- package/dist/rules/indexes/extract/extractor.js.map +1 -0
- package/dist/rules/indexes/extract/types.d.ts +211 -0
- package/dist/rules/indexes/extract/types.d.ts.map +1 -0
- package/dist/rules/indexes/extract/types.js +14 -0
- package/dist/rules/indexes/extract/types.js.map +1 -0
- package/dist/rules/indexes/extractHandler.d.ts +16 -0
- package/dist/rules/indexes/extractHandler.d.ts.map +1 -0
- package/dist/rules/indexes/extractHandler.js +100 -0
- package/dist/rules/indexes/extractHandler.js.map +1 -0
- package/dist/rules/indexes/extractTool.d.ts +15 -0
- package/dist/rules/indexes/extractTool.d.ts.map +1 -0
- package/dist/rules/indexes/extractTool.js +55 -0
- package/dist/rules/indexes/extractTool.js.map +1 -0
- package/dist/rules/indexes/types.d.ts +71 -0
- package/dist/rules/indexes/types.d.ts.map +1 -0
- package/dist/rules/indexes/types.js +15 -0
- package/dist/rules/indexes/types.js.map +1 -0
- package/dist/rules/inspect/handler.d.ts +6 -0
- package/dist/rules/inspect/handler.d.ts.map +1 -0
- package/dist/rules/inspect/handler.js +144 -0
- package/dist/rules/inspect/handler.js.map +1 -0
- package/dist/rules/inspect/spec.d.ts +37 -0
- package/dist/rules/inspect/spec.d.ts.map +1 -0
- package/dist/rules/inspect/spec.js +2 -0
- package/dist/rules/inspect/spec.js.map +1 -0
- package/dist/rules/inspect/tools.d.ts +21 -0
- package/dist/rules/inspect/tools.d.ts.map +1 -0
- package/dist/rules/inspect/tools.js +21 -0
- package/dist/rules/inspect/tools.js.map +1 -0
- package/dist/rules/linter/ast-utils.d.ts +97 -0
- package/dist/rules/linter/ast-utils.d.ts.map +1 -0
- package/dist/rules/linter/ast-utils.js +491 -0
- package/dist/rules/linter/ast-utils.js.map +1 -0
- package/dist/rules/linter/hallucinations.d.ts +34 -0
- package/dist/rules/linter/hallucinations.d.ts.map +1 -0
- package/dist/rules/linter/hallucinations.js +334 -0
- package/dist/rules/linter/hallucinations.js.map +1 -0
- package/dist/rules/linter/linter.d.ts +84 -0
- package/dist/rules/linter/linter.d.ts.map +1 -0
- package/dist/rules/linter/linter.js +784 -0
- package/dist/rules/linter/linter.js.map +1 -0
- package/dist/rules/modules/resolver-browser.d.ts +41 -0
- package/dist/rules/modules/resolver-browser.d.ts.map +1 -0
- package/dist/rules/modules/resolver-browser.js +63 -0
- package/dist/rules/modules/resolver-browser.js.map +1 -0
- package/dist/rules/modules/resolver-core.d.ts +51 -0
- package/dist/rules/modules/resolver-core.d.ts.map +1 -0
- package/dist/rules/modules/resolver-core.js +338 -0
- package/dist/rules/modules/resolver-core.js.map +1 -0
- package/dist/rules/modules/resolver.d.ts +17 -0
- package/dist/rules/modules/resolver.d.ts.map +1 -0
- package/dist/rules/modules/resolver.js +49 -0
- package/dist/rules/modules/resolver.js.map +1 -0
- package/dist/rules/modules/stdlib/atomic.rules +52 -0
- package/dist/rules/modules/stdlib/atomic.test.json +152 -0
- package/dist/rules/modules/stdlib/auth.rules +7 -0
- package/dist/rules/modules/stdlib/auth.test.json +53 -0
- package/dist/rules/modules/stdlib/content.rules +50 -0
- package/dist/rules/modules/stdlib/content.test.json +238 -0
- package/dist/rules/modules/stdlib/counters.rules +41 -0
- package/dist/rules/modules/stdlib/counters.test.json +254 -0
- package/dist/rules/modules/stdlib/geometry.rules +43 -0
- package/dist/rules/modules/stdlib/geometry.test.json +200 -0
- package/dist/rules/modules/stdlib/joining.rules +49 -0
- package/dist/rules/modules/stdlib/joining.test.json +287 -0
- package/dist/rules/modules/stdlib/lifecycle.rules +51 -0
- package/dist/rules/modules/stdlib/lifecycle.test.json +288 -0
- package/dist/rules/modules/stdlib/lobby.rules +44 -0
- package/dist/rules/modules/stdlib/lobby.test.json +32 -0
- package/dist/rules/modules/stdlib/membership.rules +40 -0
- package/dist/rules/modules/stdlib/membership.test.json +107 -0
- package/dist/rules/modules/stdlib/spaces.rules +46 -0
- package/dist/rules/modules/stdlib/spaces.test.json +392 -0
- package/dist/rules/modules/stdlib/state.rules +28 -0
- package/dist/rules/modules/stdlib/state.test.json +55 -0
- package/dist/rules/modules/stdlib/timing.rules +20 -0
- package/dist/rules/modules/stdlib/timing.test.json +106 -0
- package/dist/rules/modules/stdlib/transitions.rules +34 -0
- package/dist/rules/modules/stdlib/transitions.test.json +86 -0
- package/dist/rules/modules/stdlib/turns.rules +27 -0
- package/dist/rules/modules/stdlib/turns.test.json +64 -0
- package/dist/rules/modules/stdlib/validation.rules +31 -0
- package/dist/rules/modules/stdlib/validation.test.json +184 -0
- package/dist/rules/modules/stdlib-content.d.ts +11 -0
- package/dist/rules/modules/stdlib-content.d.ts.map +1 -0
- package/dist/rules/modules/stdlib-content.js +590 -0
- package/dist/rules/modules/stdlib-content.js.map +1 -0
- package/dist/rules/node.d.ts +17 -0
- package/dist/rules/node.d.ts.map +1 -0
- package/dist/rules/node.js +21 -0
- package/dist/rules/node.js.map +1 -0
- package/dist/rules/rtdb.d.ts +28 -0
- package/dist/rules/rtdb.d.ts.map +1 -0
- package/dist/rules/rtdb.js +15 -0
- package/dist/rules/rtdb.js.map +1 -0
- package/dist/rules/simulator/evaluator.d.ts +179 -0
- package/dist/rules/simulator/evaluator.d.ts.map +1 -0
- package/dist/rules/simulator/evaluator.js +1221 -0
- package/dist/rules/simulator/evaluator.js.map +1 -0
- package/dist/rules/simulator/expression/eval-errors.d.ts +86 -0
- package/dist/rules/simulator/expression/eval-errors.d.ts.map +1 -0
- package/dist/rules/simulator/expression/eval-errors.js +68 -0
- package/dist/rules/simulator/expression/eval-errors.js.map +1 -0
- package/dist/rules/simulator/expression/evaluator.d.ts +43 -0
- package/dist/rules/simulator/expression/evaluator.d.ts.map +1 -0
- package/dist/rules/simulator/expression/evaluator.js +298 -0
- package/dist/rules/simulator/expression/evaluator.js.map +1 -0
- package/dist/rules/simulator/expression/lexer.d.ts +36 -0
- package/dist/rules/simulator/expression/lexer.d.ts.map +1 -0
- package/dist/rules/simulator/expression/lexer.js +318 -0
- package/dist/rules/simulator/expression/lexer.js.map +1 -0
- package/dist/rules/simulator/expression/parser.d.ts +39 -0
- package/dist/rules/simulator/expression/parser.d.ts.map +1 -0
- package/dist/rules/simulator/expression/parser.js +329 -0
- package/dist/rules/simulator/expression/parser.js.map +1 -0
- package/dist/rules/simulator/expression/types.d.ts +137 -0
- package/dist/rules/simulator/expression/types.d.ts.map +1 -0
- package/dist/rules/simulator/expression/types.js +90 -0
- package/dist/rules/simulator/expression/types.js.map +1 -0
- package/dist/rules/simulator/expression/walk-data.d.ts +52 -0
- package/dist/rules/simulator/expression/walk-data.d.ts.map +1 -0
- package/dist/rules/simulator/expression/walk-data.js +167 -0
- package/dist/rules/simulator/expression/walk-data.js.map +1 -0
- package/dist/rules/simulator/firestore-set.d.ts +25 -0
- package/dist/rules/simulator/firestore-set.d.ts.map +1 -0
- package/dist/rules/simulator/firestore-set.js +89 -0
- package/dist/rules/simulator/firestore-set.js.map +1 -0
- package/dist/rules/simulator/handler.d.ts +36 -0
- package/dist/rules/simulator/handler.d.ts.map +1 -0
- package/dist/rules/simulator/handler.js +583 -0
- package/dist/rules/simulator/handler.js.map +1 -0
- package/dist/rules/simulator/mapdiff.d.ts +29 -0
- package/dist/rules/simulator/mapdiff.d.ts.map +1 -0
- package/dist/rules/simulator/mapdiff.js +72 -0
- package/dist/rules/simulator/mapdiff.js.map +1 -0
- package/dist/rules/simulator/project-after-state.d.ts +33 -0
- package/dist/rules/simulator/project-after-state.d.ts.map +1 -0
- package/dist/rules/simulator/project-after-state.js +88 -0
- package/dist/rules/simulator/project-after-state.js.map +1 -0
- package/dist/rules/simulator/query-proof.d.ts +80 -0
- package/dist/rules/simulator/query-proof.d.ts.map +1 -0
- package/dist/rules/simulator/query-proof.js +142 -0
- package/dist/rules/simulator/query-proof.js.map +1 -0
- package/dist/rules/simulator/value-equality.d.ts +8 -0
- package/dist/rules/simulator/value-equality.d.ts.map +1 -0
- package/dist/rules/simulator/value-equality.js +40 -0
- package/dist/rules/simulator/value-equality.js.map +1 -0
- package/dist/rules/simulator/wrappers/base.d.ts +129 -0
- package/dist/rules/simulator/wrappers/base.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/base.js +90 -0
- package/dist/rules/simulator/wrappers/base.js.map +1 -0
- package/dist/rules/simulator/wrappers/bytes.d.ts +45 -0
- package/dist/rules/simulator/wrappers/bytes.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/bytes.js +130 -0
- package/dist/rules/simulator/wrappers/bytes.js.map +1 -0
- package/dist/rules/simulator/wrappers/duration.d.ts +76 -0
- package/dist/rules/simulator/wrappers/duration.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/duration.js +176 -0
- package/dist/rules/simulator/wrappers/duration.js.map +1 -0
- package/dist/rules/simulator/wrappers/float.d.ts +52 -0
- package/dist/rules/simulator/wrappers/float.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/float.js +88 -0
- package/dist/rules/simulator/wrappers/float.js.map +1 -0
- package/dist/rules/simulator/wrappers/latlng.d.ts +40 -0
- package/dist/rules/simulator/wrappers/latlng.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/latlng.js +100 -0
- package/dist/rules/simulator/wrappers/latlng.js.map +1 -0
- package/dist/rules/simulator/wrappers/path.d.ts +75 -0
- package/dist/rules/simulator/wrappers/path.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/path.js +158 -0
- package/dist/rules/simulator/wrappers/path.js.map +1 -0
- package/dist/rules/simulator/wrappers/reference.d.ts +82 -0
- package/dist/rules/simulator/wrappers/reference.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/reference.js +145 -0
- package/dist/rules/simulator/wrappers/reference.js.map +1 -0
- package/dist/rules/simulator/wrappers/timestamp.d.ts +86 -0
- package/dist/rules/simulator/wrappers/timestamp.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/timestamp.js +207 -0
- package/dist/rules/simulator/wrappers/timestamp.js.map +1 -0
- package/dist/rules/simulator/wrappers/vector.d.ts +43 -0
- package/dist/rules/simulator/wrappers/vector.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/vector.js +80 -0
- package/dist/rules/simulator/wrappers/vector.js.map +1 -0
- package/dist/rules/simulator-tools-impl.d.ts +64 -0
- package/dist/rules/simulator-tools-impl.d.ts.map +1 -0
- package/dist/rules/simulator-tools-impl.js +462 -0
- package/dist/rules/simulator-tools-impl.js.map +1 -0
- package/dist/rules/simulator.d.ts +20 -0
- package/dist/rules/simulator.d.ts.map +1 -0
- package/dist/rules/simulator.js +24 -0
- package/dist/rules/simulator.js.map +1 -0
- package/dist/rules/stdlib-modules.d.ts +73 -0
- package/dist/rules/stdlib-modules.d.ts.map +1 -0
- package/dist/rules/stdlib-modules.js +849 -0
- package/dist/rules/stdlib-modules.js.map +1 -0
- package/dist/rules/stdlib-tools.d.ts +19 -0
- package/dist/rules/stdlib-tools.d.ts.map +1 -0
- package/dist/rules/stdlib-tools.js +164 -0
- package/dist/rules/stdlib-tools.js.map +1 -0
- package/dist/rules/test/handler.d.ts +9 -0
- package/dist/rules/test/handler.d.ts.map +1 -0
- package/dist/rules/test/handler.js +124 -0
- package/dist/rules/test/handler.js.map +1 -0
- package/dist/rules/test/spec.d.ts +517 -0
- package/dist/rules/test/spec.d.ts.map +1 -0
- package/dist/rules/test/spec.js +227 -0
- package/dist/rules/test/spec.js.map +1 -0
- package/dist/rules/tools.d.ts +41 -0
- package/dist/rules/tools.d.ts.map +1 -0
- package/dist/rules/tools.js +124 -0
- package/dist/rules/tools.js.map +1 -0
- package/dist/rules/write/handler.d.ts +6 -0
- package/dist/rules/write/handler.d.ts.map +1 -0
- package/dist/rules/write/handler.js +126 -0
- package/dist/rules/write/handler.js.map +1 -0
- package/dist/rules/write/spec.d.ts +28 -0
- package/dist/rules/write/spec.d.ts.map +1 -0
- package/dist/rules/write/spec.js +2 -0
- package/dist/rules/write/spec.js.map +1 -0
- package/dist/sandbox/admin-compat.d.ts +20 -0
- package/dist/sandbox/admin-compat.d.ts.map +1 -0
- package/dist/sandbox/admin-compat.js +19 -0
- package/dist/sandbox/admin-compat.js.map +1 -0
- package/dist/sandbox/admin-firestore/error-translation.d.ts +86 -0
- package/dist/sandbox/admin-firestore/error-translation.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/error-translation.js +204 -0
- package/dist/sandbox/admin-firestore/error-translation.js.map +1 -0
- package/dist/sandbox/admin-firestore/index.d.ts +169 -0
- package/dist/sandbox/admin-firestore/index.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/index.js +456 -0
- package/dist/sandbox/admin-firestore/index.js.map +1 -0
- package/dist/sandbox/admin-firestore/remote.d.ts +97 -0
- package/dist/sandbox/admin-firestore/remote.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/remote.js +735 -0
- package/dist/sandbox/admin-firestore/remote.js.map +1 -0
- package/dist/sandbox/branches/index.d.ts +141 -0
- package/dist/sandbox/branches/index.d.ts.map +1 -0
- package/dist/sandbox/branches/index.js +327 -0
- package/dist/sandbox/branches/index.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/batch.d.ts +34 -0
- package/dist/sandbox/firestore/admin-compat/batch.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/batch.js +73 -0
- package/dist/sandbox/firestore/admin-compat/batch.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/doc-ref.d.ts +38 -0
- package/dist/sandbox/firestore/admin-compat/doc-ref.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/doc-ref.js +154 -0
- package/dist/sandbox/firestore/admin-compat/doc-ref.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/firestore.d.ts +45 -0
- package/dist/sandbox/firestore/admin-compat/firestore.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/firestore.js +114 -0
- package/dist/sandbox/firestore/admin-compat/firestore.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/index.d.ts +45 -0
- package/dist/sandbox/firestore/admin-compat/index.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/index.js +27 -0
- package/dist/sandbox/firestore/admin-compat/index.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/paths.d.ts +37 -0
- package/dist/sandbox/firestore/admin-compat/paths.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/paths.js +49 -0
- package/dist/sandbox/firestore/admin-compat/paths.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/query.d.ts +261 -0
- package/dist/sandbox/firestore/admin-compat/query.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/query.js +704 -0
- package/dist/sandbox/firestore/admin-compat/query.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/read-translation.d.ts +8 -0
- package/dist/sandbox/firestore/admin-compat/read-translation.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/read-translation.js +59 -0
- package/dist/sandbox/firestore/admin-compat/read-translation.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/snapshots.d.ts +39 -0
- package/dist/sandbox/firestore/admin-compat/snapshots.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/snapshots.js +50 -0
- package/dist/sandbox/firestore/admin-compat/snapshots.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/transaction.d.ts +35 -0
- package/dist/sandbox/firestore/admin-compat/transaction.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/transaction.js +88 -0
- package/dist/sandbox/firestore/admin-compat/transaction.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/types.d.ts +297 -0
- package/dist/sandbox/firestore/admin-compat/types.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/types.js +127 -0
- package/dist/sandbox/firestore/admin-compat/types.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/value-order.d.ts +49 -0
- package/dist/sandbox/firestore/admin-compat/value-order.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/value-order.js +172 -0
- package/dist/sandbox/firestore/admin-compat/value-order.js.map +1 -0
- package/dist/sandbox/firestore/auto-id.d.ts +26 -0
- package/dist/sandbox/firestore/auto-id.d.ts.map +1 -0
- package/dist/sandbox/firestore/auto-id.js +36 -0
- package/dist/sandbox/firestore/auto-id.js.map +1 -0
- package/dist/sandbox/firestore/converters/bytes-geopoint.d.ts +48 -0
- package/dist/sandbox/firestore/converters/bytes-geopoint.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/bytes-geopoint.js +85 -0
- package/dist/sandbox/firestore/converters/bytes-geopoint.js.map +1 -0
- package/dist/sandbox/firestore/converters/fieldvalue.d.ts +69 -0
- package/dist/sandbox/firestore/converters/fieldvalue.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/fieldvalue.js +166 -0
- package/dist/sandbox/firestore/converters/fieldvalue.js.map +1 -0
- package/dist/sandbox/firestore/converters/reference.d.ts +31 -0
- package/dist/sandbox/firestore/converters/reference.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/reference.js +51 -0
- package/dist/sandbox/firestore/converters/reference.js.map +1 -0
- package/dist/sandbox/firestore/converters/timestamp.d.ts +32 -0
- package/dist/sandbox/firestore/converters/timestamp.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/timestamp.js +63 -0
- package/dist/sandbox/firestore/converters/timestamp.js.map +1 -0
- package/dist/sandbox/firestore/converters/user-timestamp.d.ts +46 -0
- package/dist/sandbox/firestore/converters/user-timestamp.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/user-timestamp.js +65 -0
- package/dist/sandbox/firestore/converters/user-timestamp.js.map +1 -0
- package/dist/sandbox/firestore/converters/vector.d.ts +24 -0
- package/dist/sandbox/firestore/converters/vector.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/vector.js +53 -0
- package/dist/sandbox/firestore/converters/vector.js.map +1 -0
- package/dist/sandbox/firestore/errors.d.ts +82 -0
- package/dist/sandbox/firestore/errors.d.ts.map +1 -0
- package/dist/sandbox/firestore/errors.js +54 -0
- package/dist/sandbox/firestore/errors.js.map +1 -0
- package/dist/sandbox/firestore/event-log.d.ts +99 -0
- package/dist/sandbox/firestore/event-log.d.ts.map +1 -0
- package/dist/sandbox/firestore/event-log.js +67 -0
- package/dist/sandbox/firestore/event-log.js.map +1 -0
- package/dist/sandbox/firestore/field-merge.d.ts +64 -0
- package/dist/sandbox/firestore/field-merge.d.ts.map +1 -0
- package/dist/sandbox/firestore/field-merge.js +221 -0
- package/dist/sandbox/firestore/field-merge.js.map +1 -0
- package/dist/sandbox/firestore/list-query-proof.d.ts +77 -0
- package/dist/sandbox/firestore/list-query-proof.d.ts.map +1 -0
- package/dist/sandbox/firestore/list-query-proof.js +170 -0
- package/dist/sandbox/firestore/list-query-proof.js.map +1 -0
- package/dist/sandbox/firestore/local-environment.d.ts +806 -0
- package/dist/sandbox/firestore/local-environment.d.ts.map +1 -0
- package/dist/sandbox/firestore/local-environment.js +3028 -0
- package/dist/sandbox/firestore/local-environment.js.map +1 -0
- package/dist/sandbox/firestore/local-state.d.ts +196 -0
- package/dist/sandbox/firestore/local-state.d.ts.map +1 -0
- package/dist/sandbox/firestore/local-state.js +413 -0
- package/dist/sandbox/firestore/local-state.js.map +1 -0
- package/dist/sandbox/firestore/overlay-backing.d.ts +44 -0
- package/dist/sandbox/firestore/overlay-backing.d.ts.map +1 -0
- package/dist/sandbox/firestore/overlay-backing.js +82 -0
- package/dist/sandbox/firestore/overlay-backing.js.map +1 -0
- package/dist/sandbox/firestore/sentinel-capture.d.ts +30 -0
- package/dist/sandbox/firestore/sentinel-capture.d.ts.map +1 -0
- package/dist/sandbox/firestore/sentinel-capture.js +61 -0
- package/dist/sandbox/firestore/sentinel-capture.js.map +1 -0
- package/dist/sandbox/firestore/snapshot-listeners.d.ts +284 -0
- package/dist/sandbox/firestore/snapshot-listeners.d.ts.map +1 -0
- package/dist/sandbox/firestore/snapshot-listeners.js +194 -0
- package/dist/sandbox/firestore/snapshot-listeners.js.map +1 -0
- package/dist/sandbox/firestore/topk.d.ts +12 -0
- package/dist/sandbox/firestore/topk.d.ts.map +1 -0
- package/dist/sandbox/firestore/topk.js +42 -0
- package/dist/sandbox/firestore/topk.js.map +1 -0
- package/dist/sandbox/firestore/transaction-merge.d.ts +55 -0
- package/dist/sandbox/firestore/transaction-merge.d.ts.map +1 -0
- package/dist/sandbox/firestore/transaction-merge.js +107 -0
- package/dist/sandbox/firestore/transaction-merge.js.map +1 -0
- package/dist/sandbox/firestore/transaction-types.d.ts +152 -0
- package/dist/sandbox/firestore/transaction-types.d.ts.map +1 -0
- package/dist/sandbox/firestore/transaction-types.js +10 -0
- package/dist/sandbox/firestore/transaction-types.js.map +1 -0
- package/dist/sandbox/firestore/transaction.d.ts +79 -0
- package/dist/sandbox/firestore/transaction.d.ts.map +1 -0
- package/dist/sandbox/firestore/transaction.js +95 -0
- package/dist/sandbox/firestore/transaction.js.map +1 -0
- package/dist/sandbox/firestore/value-equality.d.ts +2 -0
- package/dist/sandbox/firestore/value-equality.d.ts.map +1 -0
- package/dist/sandbox/firestore/value-equality.js +35 -0
- package/dist/sandbox/firestore/value-equality.js.map +1 -0
- package/dist/sandbox/firestore/value-resolver.d.ts +172 -0
- package/dist/sandbox/firestore/value-resolver.d.ts.map +1 -0
- package/dist/sandbox/firestore/value-resolver.js +221 -0
- package/dist/sandbox/firestore/value-resolver.js.map +1 -0
- package/dist/sandbox/firestore/wire-encoder.d.ts +14 -0
- package/dist/sandbox/firestore/wire-encoder.d.ts.map +1 -0
- package/dist/sandbox/firestore/wire-encoder.js +130 -0
- package/dist/sandbox/firestore/wire-encoder.js.map +1 -0
- package/dist/sandbox/index.d.ts +50 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/index.js +63 -0
- package/dist/sandbox/index.js.map +1 -0
- package/dist/sandbox/internal/index.d.ts +36 -0
- package/dist/sandbox/internal/index.d.ts.map +1 -0
- package/dist/sandbox/internal/index.js +72 -0
- package/dist/sandbox/internal/index.js.map +1 -0
- package/dist/sandbox/internal/sandbox-impl.d.ts +343 -0
- package/dist/sandbox/internal/sandbox-impl.d.ts.map +1 -0
- package/dist/sandbox/internal/sandbox-impl.js +718 -0
- package/dist/sandbox/internal/sandbox-impl.js.map +1 -0
- package/dist/sandbox/persistence/backends.d.ts +37 -0
- package/dist/sandbox/persistence/backends.d.ts.map +1 -0
- package/dist/sandbox/persistence/backends.js +202 -0
- package/dist/sandbox/persistence/backends.js.map +1 -0
- package/dist/sandbox/persistence/chunk-format.d.ts +58 -0
- package/dist/sandbox/persistence/chunk-format.d.ts.map +1 -0
- package/dist/sandbox/persistence/chunk-format.js +163 -0
- package/dist/sandbox/persistence/chunk-format.js.map +1 -0
- package/dist/sandbox/persistence/controller.d.ts +39 -0
- package/dist/sandbox/persistence/controller.d.ts.map +1 -0
- package/dist/sandbox/persistence/controller.js +605 -0
- package/dist/sandbox/persistence/controller.js.map +1 -0
- package/dist/sandbox/persistence/index.d.ts +13 -0
- package/dist/sandbox/persistence/index.d.ts.map +1 -0
- package/dist/sandbox/persistence/index.js +5 -0
- package/dist/sandbox/persistence/index.js.map +1 -0
- package/dist/sandbox/persistence/serialize.d.ts +53 -0
- package/dist/sandbox/persistence/serialize.d.ts.map +1 -0
- package/dist/sandbox/persistence/serialize.js +98 -0
- package/dist/sandbox/persistence/serialize.js.map +1 -0
- package/dist/sandbox/persistence/types.d.ts +118 -0
- package/dist/sandbox/persistence/types.d.ts.map +1 -0
- package/dist/sandbox/persistence/types.js +15 -0
- package/dist/sandbox/persistence/types.js.map +1 -0
- package/dist/sandbox/remote.d.ts +118 -0
- package/dist/sandbox/remote.d.ts.map +1 -0
- package/dist/sandbox/remote.js +60 -0
- package/dist/sandbox/remote.js.map +1 -0
- package/dist/sandbox/replay/index.d.ts +106 -0
- package/dist/sandbox/replay/index.d.ts.map +1 -0
- package/dist/sandbox/replay/index.js +246 -0
- package/dist/sandbox/replay/index.js.map +1 -0
- package/dist/sandbox/sandbox-context.d.ts +40 -0
- package/dist/sandbox/sandbox-context.d.ts.map +1 -0
- package/dist/sandbox/sandbox-context.js +72 -0
- package/dist/sandbox/sandbox-context.js.map +1 -0
- package/dist/sandbox/tab-sync/index.d.ts +120 -0
- package/dist/sandbox/tab-sync/index.d.ts.map +1 -0
- package/dist/sandbox/tab-sync/index.js +272 -0
- package/dist/sandbox/tab-sync/index.js.map +1 -0
- package/dist/sandbox/types.d.ts +1235 -0
- package/dist/sandbox/types.d.ts.map +1 -0
- package/dist/sandbox/types.js +46 -0
- package/dist/sandbox/types.js.map +1 -0
- package/dist/storage/admin/api.d.ts +206 -0
- package/dist/storage/admin/api.d.ts.map +1 -0
- package/dist/storage/admin/api.js +349 -0
- package/dist/storage/admin/api.js.map +1 -0
- package/dist/storage/admin/handler.d.ts +29 -0
- package/dist/storage/admin/handler.d.ts.map +1 -0
- package/dist/storage/admin/handler.js +82 -0
- package/dist/storage/admin/handler.js.map +1 -0
- package/dist/storage/admin/spec.d.ts +64 -0
- package/dist/storage/admin/spec.d.ts.map +1 -0
- package/dist/storage/admin/spec.js +8 -0
- package/dist/storage/admin/spec.js.map +1 -0
- package/dist/storage/admin/tools.d.ts +23 -0
- package/dist/storage/admin/tools.d.ts.map +1 -0
- package/dist/storage/admin/tools.js +90 -0
- package/dist/storage/admin/tools.js.map +1 -0
- package/dist/storage/download.d.ts +27 -0
- package/dist/storage/download.d.ts.map +1 -0
- package/dist/storage/download.js +136 -0
- package/dist/storage/download.js.map +1 -0
- package/dist/storage/enforce.d.ts +26 -0
- package/dist/storage/enforce.d.ts.map +1 -0
- package/dist/storage/enforce.js +16 -0
- package/dist/storage/enforce.js.map +1 -0
- package/dist/storage/errors.d.ts +46 -0
- package/dist/storage/errors.d.ts.map +1 -0
- package/dist/storage/errors.js +62 -0
- package/dist/storage/errors.js.map +1 -0
- package/dist/storage/index.d.ts +49 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +60 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/internal.d.ts +18 -0
- package/dist/storage/internal.d.ts.map +1 -0
- package/dist/storage/internal.js +18 -0
- package/dist/storage/internal.js.map +1 -0
- package/dist/storage/list.d.ts +17 -0
- package/dist/storage/list.d.ts.map +1 -0
- package/dist/storage/list.js +91 -0
- package/dist/storage/list.js.map +1 -0
- package/dist/storage/metadata.d.ts +86 -0
- package/dist/storage/metadata.d.ts.map +1 -0
- package/dist/storage/metadata.js +167 -0
- package/dist/storage/metadata.js.map +1 -0
- package/dist/storage/persistence.d.ts +134 -0
- package/dist/storage/persistence.d.ts.map +1 -0
- package/dist/storage/persistence.js +132 -0
- package/dist/storage/persistence.js.map +1 -0
- package/dist/storage/reference.d.ts +63 -0
- package/dist/storage/reference.d.ts.map +1 -0
- package/dist/storage/reference.js +156 -0
- package/dist/storage/reference.js.map +1 -0
- package/dist/storage/rules.d.ts +176 -0
- package/dist/storage/rules.d.ts.map +1 -0
- package/dist/storage/rules.js +621 -0
- package/dist/storage/rules.js.map +1 -0
- package/dist/storage/service.d.ts +139 -0
- package/dist/storage/service.d.ts.map +1 -0
- package/dist/storage/service.js +241 -0
- package/dist/storage/service.js.map +1 -0
- package/dist/storage/upload.d.ts +43 -0
- package/dist/storage/upload.d.ts.map +1 -0
- package/dist/storage/upload.js +235 -0
- package/dist/storage/upload.js.map +1 -0
- package/package.json +110 -3
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `pyric/rules` — Pyric-native Firestore rules tooling.
|
|
3
|
+
*
|
|
4
|
+
* Sibling to `pyric/firestore` (the modular Web-SDK swap-in). Rules
|
|
5
|
+
* tooling lives here so non-standard surface (linter, parser, etc.)
|
|
6
|
+
* doesn't pollute the swap-in namespace.
|
|
7
|
+
*
|
|
8
|
+
* Surface:
|
|
9
|
+
* - Parser + AST (parser/AST/validator/assembler)
|
|
10
|
+
* - Linter (`lintFirestoreRules` + warning/metrics types)
|
|
11
|
+
* - 2+modules resolver (`resolveModules`) + stdlib
|
|
12
|
+
* - Rules simulator (`SimulateFirestoreRulesHandler` + value
|
|
13
|
+
* wrappers — `Timestamp`, `Path`, etc.)
|
|
14
|
+
* - Rules Test API client (`TestFirestoreRulesHandler`, takes
|
|
15
|
+
* `ProjectScope` per F3)
|
|
16
|
+
* - Sentinel expression engine (used by sandbox for $expr
|
|
17
|
+
* resolution in declarative transactions)
|
|
18
|
+
*/
|
|
19
|
+
// ─── Parser + AST ────────────────────────────────────────────────────
|
|
20
|
+
export { parseToAST, parseToASTOrError, parseFunctions, } from './grammar/FirestoreParser.js';
|
|
21
|
+
export { assembleRules, assembleExpression as printExpression } from './grammar/FirestoreAssembler.js';
|
|
22
|
+
export { validateFirestoreRules } from './grammar/FirestoreValidator.js';
|
|
23
|
+
// ─── Linter ──────────────────────────────────────────────────────────
|
|
24
|
+
export { lintFirestoreRules } from './linter/linter.js';
|
|
25
|
+
// ─── Rules simulator ─────────────────────────────────────────────────
|
|
26
|
+
export { SimulateFirestoreRulesHandler, SERVER_TIMESTAMP } from './simulator/handler.js';
|
|
27
|
+
export { evaluate, UnsupportedError, TraceRecorder } from './simulator/evaluator.js';
|
|
28
|
+
export { projectAfterState } from './simulator/project-after-state.js';
|
|
29
|
+
export { MapDiff, FirestoreSet } from './simulator/mapdiff.js';
|
|
30
|
+
// ─── Expression DSL primitives (used by sdk's transaction probe + tests)
|
|
31
|
+
export { tokenize } from './simulator/expression/lexer.js';
|
|
32
|
+
export { parse } from './simulator/expression/parser.js';
|
|
33
|
+
// ─── Value wrappers ──────────────────────────────────────────────────
|
|
34
|
+
export { Timestamp } from './simulator/wrappers/timestamp.js';
|
|
35
|
+
export { Path } from './simulator/wrappers/path.js';
|
|
36
|
+
export { Reference, referenceToResourceName } from './simulator/wrappers/reference.js';
|
|
37
|
+
export { Vector } from './simulator/wrappers/vector.js';
|
|
38
|
+
export { Bytes } from './simulator/wrappers/bytes.js';
|
|
39
|
+
export { Duration } from './simulator/wrappers/duration.js';
|
|
40
|
+
export { LatLng } from './simulator/wrappers/latlng.js';
|
|
41
|
+
export { RulesValue, NO_OP } from './simulator/wrappers/base.js';
|
|
42
|
+
// ─── Rules Test API client ───────────────────────────────────────────
|
|
43
|
+
export { TestFirestoreRulesHandler } from './test/handler.js';
|
|
44
|
+
export { FIRESTORE_METHODS, TestCaseSchema, TestIdentitySchema, renderLegacyDebugMessages, projectEvaluatedRule, } from './test/spec.js';
|
|
45
|
+
// ─── Sentinel expression engine ──────────────────────────────────────
|
|
46
|
+
export { resolveExpressionsInData, ExpressionWalkError } from './simulator/expression/walk-data.js';
|
|
47
|
+
export { EvalError } from './simulator/expression/eval-errors.js';
|
|
48
|
+
export { ExpressionLexError, ExpressionParseError, } from './simulator/expression/types.js';
|
|
49
|
+
// ─── Stdlib reference (browser-safe — pure data) ─────────────────────
|
|
50
|
+
// Module-organized reference an agent can call before writing rules.
|
|
51
|
+
// Exposed via the `firestore_rules_stdlib_list` + `_get` tools in
|
|
52
|
+
// `createFirestoreRulesStdlibTools()`; also importable directly for
|
|
53
|
+
// non-agent consumers (docs generators, lint integrations).
|
|
54
|
+
export { STDLIB_MODULES, findModuleByKey, allModuleKeys, suggestKey, } from './stdlib-modules.js';
|
|
55
|
+
export { createFirestoreRulesStdlibTools } from './stdlib-tools.js';
|
|
56
|
+
// Browser-safe `2+modules` resolver — pre-supplies the inlined stdlib
|
|
57
|
+
// content so it works without `node:fs`. Node consumers should keep
|
|
58
|
+
// importing `resolveModules` from `pyric/rules/node`,
|
|
59
|
+
// which falls back to disk reads for stdlib modules and picks up
|
|
60
|
+
// `.rules` edits between builds without re-running the inliner.
|
|
61
|
+
export { resolveModulesBrowser, STDLIB_INLINE } from './modules/resolver-browser.js';
|
|
62
|
+
// ─── Rules deploy (write) — Firebase Rules API client ─────────────────
|
|
63
|
+
// Takes ProjectScope (per F3). Pairs with `firestore_test_rules`
|
|
64
|
+
// (also takes ProjectScope) and `lintFirestoreRules` / `validateFirestoreRules`
|
|
65
|
+
// in the same package — full rules lifecycle on one surface.
|
|
66
|
+
export { WriteFirestoreRulesHandler } from './write/handler.js';
|
|
67
|
+
// ─── Rules inspect (read) — Firebase Rules API client ─────────────────
|
|
68
|
+
// Fetches + parses the deployed Firestore ruleset (list + get latest),
|
|
69
|
+
// returns AST + summary + validator findings. Takes ProjectScope (per
|
|
70
|
+
// F3). Browser-safe — REST + Bearer token only, no firebase-admin.
|
|
71
|
+
// Pairs with WriteFirestoreRulesHandler on the write side.
|
|
72
|
+
export { InspectFirestoreRulesHandler } from './inspect/handler.js';
|
|
73
|
+
export { createFirestoreInspectTool } from './inspect/tools.js';
|
|
74
|
+
// ─── Game-rules generators — declarative rules assembly ───────────────
|
|
75
|
+
// Used by playground game scaffolding to emit Firestore rules for grid
|
|
76
|
+
// games (TTT, C4, Gomoku) without hand-writing the boilerplate.
|
|
77
|
+
export { assembleGameRules, } from './generators/assembler.js';
|
|
78
|
+
export { generateWinLines, defaultCellName, indexToColRow, emptyBoard, } from './generators/grid.js';
|
|
79
|
+
export * from './generators/expressions.js';
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,wEAAwE;AACxE,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,cAAc,GACf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,kBAAkB,IAAI,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvG,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAYzE,wEAAwE;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAcxD,wEAAwE;AACxE,OAAO,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,MAA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C5D,OAAO,EACL,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,GACX,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AAEpE,sEAAsE;AACtE,oEAAoE;AACpE,sDAAsD;AACtD,iEAAiE;AACjE,gEAAgE;AAChE,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAuCrF,yEAAyE;AACzE,iEAAiE;AACjE,gFAAgF;AAChF,6DAA6D;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAGhE,yEAAyE;AACzE,uEAAuE;AACvE,sEAAsE;AACtE,mEAAmE;AACnE,2DAA2D;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAGhE,yEAAyE;AACzE,uEAAuE;AACvE,gEAAgE;AAChE,OAAO,EACL,iBAAiB,GAElB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,UAAU,GAEX,MAAM,sBAAsB,CAAC;AAC9B,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AST walker that pairs each function-like declaration with its leading
|
|
3
|
+
* JSDoc-style comment block, parses any `@firestore-*` tags out of it,
|
|
4
|
+
* and yields the parsed annotations alongside the function name.
|
|
5
|
+
*
|
|
6
|
+
* Pure walker — no enumeration logic, no pruning. The orchestrator
|
|
7
|
+
* (`extractor.ts`) consumes these and threads them into `enumerateShapes`.
|
|
8
|
+
*
|
|
9
|
+
* Coverage matches `iterFunctionBodies` (see Issue A1 in the layer-2
|
|
10
|
+
* progress doc):
|
|
11
|
+
* - function declarations
|
|
12
|
+
* - arrow / function expressions assigned to a variable
|
|
13
|
+
* Method declarations on classes are deliberately out of scope for v1
|
|
14
|
+
* because Firebase query builders are almost never methods. Add when
|
|
15
|
+
* real-world demand surfaces.
|
|
16
|
+
*/
|
|
17
|
+
import ts from 'typescript';
|
|
18
|
+
import { type AnnotationWarning, type Annotations } from './annotations.js';
|
|
19
|
+
/** One function paired with its parsed annotations. */
|
|
20
|
+
export interface CollectedAnnotation {
|
|
21
|
+
/** Function name, or `'<anon>'` for an unnamed function expression. */
|
|
22
|
+
functionName: string;
|
|
23
|
+
/** Annotations parsed from the function's leading comment block. */
|
|
24
|
+
annotations: Annotations;
|
|
25
|
+
/** Warnings raised while parsing those annotations. */
|
|
26
|
+
warnings: AnnotationWarning[];
|
|
27
|
+
/**
|
|
28
|
+
* `true` when the leading comment block contained at least one
|
|
29
|
+
* `@firestore-*` tag (recognized or not). Useful so the orchestrator
|
|
30
|
+
* can skip emitting an `AnnotationApplied` summary for functions
|
|
31
|
+
* without any annotation activity.
|
|
32
|
+
*/
|
|
33
|
+
hasFirestoreTag: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Walk every function-like declaration in a SourceFile and yield one
|
|
37
|
+
* `CollectedAnnotation` per declaration. Functions without leading
|
|
38
|
+
* comments still appear with empty annotations and `hasFirestoreTag:
|
|
39
|
+
* false` — the caller decides whether to keep them.
|
|
40
|
+
*/
|
|
41
|
+
export declare function collectAnnotations(sf: ts.SourceFile): CollectedAnnotation[];
|
|
42
|
+
//# sourceMappingURL=annotation-collect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation-collect.d.ts","sourceRoot":"","sources":["../../../../src/rules/indexes/extract/annotation-collect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAoB,KAAK,iBAAiB,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE9F,uDAAuD;AACvD,MAAM,WAAW,mBAAmB;IAClC,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,WAAW,EAAE,WAAW,CAAC;IACzB,uDAAuD;IACvD,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B;;;;;OAKG;IACH,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,EAAE,CAAC,UAAU,GAAG,mBAAmB,EAAE,CAiC3E"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AST walker that pairs each function-like declaration with its leading
|
|
3
|
+
* JSDoc-style comment block, parses any `@firestore-*` tags out of it,
|
|
4
|
+
* and yields the parsed annotations alongside the function name.
|
|
5
|
+
*
|
|
6
|
+
* Pure walker — no enumeration logic, no pruning. The orchestrator
|
|
7
|
+
* (`extractor.ts`) consumes these and threads them into `enumerateShapes`.
|
|
8
|
+
*
|
|
9
|
+
* Coverage matches `iterFunctionBodies` (see Issue A1 in the layer-2
|
|
10
|
+
* progress doc):
|
|
11
|
+
* - function declarations
|
|
12
|
+
* - arrow / function expressions assigned to a variable
|
|
13
|
+
* Method declarations on classes are deliberately out of scope for v1
|
|
14
|
+
* because Firebase query builders are almost never methods. Add when
|
|
15
|
+
* real-world demand surfaces.
|
|
16
|
+
*/
|
|
17
|
+
import ts from 'typescript';
|
|
18
|
+
import { parseAnnotations } from './annotations.js';
|
|
19
|
+
/**
|
|
20
|
+
* Walk every function-like declaration in a SourceFile and yield one
|
|
21
|
+
* `CollectedAnnotation` per declaration. Functions without leading
|
|
22
|
+
* comments still appear with empty annotations and `hasFirestoreTag:
|
|
23
|
+
* false` — the caller decides whether to keep them.
|
|
24
|
+
*/
|
|
25
|
+
export function collectAnnotations(sf) {
|
|
26
|
+
const out = [];
|
|
27
|
+
const fullText = sf.getFullText();
|
|
28
|
+
function record(name, node) {
|
|
29
|
+
const commentText = leadingCommentTextOf(node, fullText);
|
|
30
|
+
const { annotations, warnings } = parseAnnotations(commentText);
|
|
31
|
+
const hasFirestoreTag = /@firestore-[a-zA-Z0-9_-]+/.test(commentText);
|
|
32
|
+
out.push({ functionName: name, annotations, warnings, hasFirestoreTag });
|
|
33
|
+
}
|
|
34
|
+
function visit(n) {
|
|
35
|
+
if (ts.isFunctionDeclaration(n) && n.body) {
|
|
36
|
+
const name = n.name?.text ?? '<anon>';
|
|
37
|
+
record(name, n);
|
|
38
|
+
}
|
|
39
|
+
else if (ts.isVariableStatement(n)) {
|
|
40
|
+
for (const d of n.declarationList.declarations) {
|
|
41
|
+
if (d.initializer &&
|
|
42
|
+
(ts.isArrowFunction(d.initializer) || ts.isFunctionExpression(d.initializer))) {
|
|
43
|
+
const name = ts.isIdentifier(d.name) ? d.name.text : '<anon>';
|
|
44
|
+
// Use the variable statement as the comment anchor — leading
|
|
45
|
+
// comments attach to the statement, not the initializer.
|
|
46
|
+
record(name, n);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
ts.forEachChild(n, visit);
|
|
51
|
+
}
|
|
52
|
+
visit(sf);
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Concatenate every leading comment range attached to `node` into a
|
|
57
|
+
* single string. Returns `''` if no leading comments exist.
|
|
58
|
+
*
|
|
59
|
+
* `ts.getLeadingCommentRanges` returns spans into the full source text;
|
|
60
|
+
* we slice them and join with newlines so multi-block leading comments
|
|
61
|
+
* (rare but legal) all participate in the parse.
|
|
62
|
+
*/
|
|
63
|
+
function leadingCommentTextOf(node, fullText) {
|
|
64
|
+
const ranges = ts.getLeadingCommentRanges(fullText, node.getFullStart());
|
|
65
|
+
if (!ranges || ranges.length === 0)
|
|
66
|
+
return '';
|
|
67
|
+
return ranges.map(r => fullText.slice(r.pos, r.end)).join('\n');
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=annotation-collect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation-collect.js","source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,WAAW,CAAC,CAAC,EAC7E,CAAC;oBACD,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;oBAC9D,6DAA6D;oBAC7D,yDAAyD;oBACzD,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;gBAClB,CAAC;YACH,CAAC;QACH,CAAC;QACD,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,oBAAoB,CAAC,IAAa,EAAE,QAAgB;IAC3D,MAAM,MAAM,GAAG,EAAE,CAAC,uBAAuB,CAAC,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IACzE,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAC9C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure parser for `@firestore-*` annotations in JSDoc comment blocks.
|
|
3
|
+
*
|
|
4
|
+
* Recognized syntax (Layer 2, locked from the P-prune v1 scope):
|
|
5
|
+
*
|
|
6
|
+
* @firestore-mutex { fieldA, fieldB, fieldC }
|
|
7
|
+
* — at most one of these fields can be active in any extracted
|
|
8
|
+
* shape. Multiple lines = multiple independent groups.
|
|
9
|
+
*
|
|
10
|
+
* @firestore-required fieldA, fieldB
|
|
11
|
+
* — every extracted shape must include these fields.
|
|
12
|
+
*
|
|
13
|
+
* @firestore-budget N
|
|
14
|
+
* — soft cap on emitted index entries. Surfaces as a warning when
|
|
15
|
+
* exceeded; does not drop entries.
|
|
16
|
+
*
|
|
17
|
+
* Annotations are additive — the absence of any tag falls back to
|
|
18
|
+
* Layer 1 behavior. Malformed tags degrade gracefully: a warning is
|
|
19
|
+
* emitted and the offending tag is ignored.
|
|
20
|
+
*
|
|
21
|
+
* This module does no AST work — it operates on raw comment text.
|
|
22
|
+
* Pairing comments with function declarations happens in
|
|
23
|
+
* `annotation-collect.ts`.
|
|
24
|
+
*/
|
|
25
|
+
export interface Annotations {
|
|
26
|
+
/** Each set is one mutex group. A combo violates a group if 2+ fields hit. */
|
|
27
|
+
mutexGroups: Set<string>[];
|
|
28
|
+
/** Fields every extracted shape must include. */
|
|
29
|
+
required: Set<string>;
|
|
30
|
+
/** Soft cap on emitted entries. Undefined = no cap. */
|
|
31
|
+
budget?: number;
|
|
32
|
+
}
|
|
33
|
+
export type AnnotationWarningCode = 'unknown-firestore-tag' | 'malformed-mutex' | 'malformed-required' | 'malformed-budget';
|
|
34
|
+
export interface AnnotationWarning {
|
|
35
|
+
code: AnnotationWarningCode;
|
|
36
|
+
/** The tag name without the leading `@`, e.g. "firestore-mutex". */
|
|
37
|
+
tag: string;
|
|
38
|
+
message: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ParseAnnotationsResult {
|
|
41
|
+
annotations: Annotations;
|
|
42
|
+
warnings: AnnotationWarning[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Parse `@firestore-*` tags out of a comment block. Returns an empty
|
|
46
|
+
* `Annotations` with no warnings when the input contains no firestore
|
|
47
|
+
* tags — this is the additive fallback.
|
|
48
|
+
*/
|
|
49
|
+
export declare function parseAnnotations(commentText: string): ParseAnnotationsResult;
|
|
50
|
+
//# sourceMappingURL=annotations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../../../src/rules/indexes/extract/annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,WAAW;IAC1B,8EAA8E;IAC9E,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;IAC3B,iDAAiD;IACjD,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,qBAAqB,GAC7B,uBAAuB,GACvB,iBAAiB,GACjB,oBAAoB,GACpB,kBAAkB,CAAC;AAEvB,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,oEAAoE;IACpE,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAQD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,sBAAsB,CAyF5E"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure parser for `@firestore-*` annotations in JSDoc comment blocks.
|
|
3
|
+
*
|
|
4
|
+
* Recognized syntax (Layer 2, locked from the P-prune v1 scope):
|
|
5
|
+
*
|
|
6
|
+
* @firestore-mutex { fieldA, fieldB, fieldC }
|
|
7
|
+
* — at most one of these fields can be active in any extracted
|
|
8
|
+
* shape. Multiple lines = multiple independent groups.
|
|
9
|
+
*
|
|
10
|
+
* @firestore-required fieldA, fieldB
|
|
11
|
+
* — every extracted shape must include these fields.
|
|
12
|
+
*
|
|
13
|
+
* @firestore-budget N
|
|
14
|
+
* — soft cap on emitted index entries. Surfaces as a warning when
|
|
15
|
+
* exceeded; does not drop entries.
|
|
16
|
+
*
|
|
17
|
+
* Annotations are additive — the absence of any tag falls back to
|
|
18
|
+
* Layer 1 behavior. Malformed tags degrade gracefully: a warning is
|
|
19
|
+
* emitted and the offending tag is ignored.
|
|
20
|
+
*
|
|
21
|
+
* This module does no AST work — it operates on raw comment text.
|
|
22
|
+
* Pairing comments with function declarations happens in
|
|
23
|
+
* `annotation-collect.ts`.
|
|
24
|
+
*/
|
|
25
|
+
const KNOWN_TAGS = new Set([
|
|
26
|
+
'firestore-mutex',
|
|
27
|
+
'firestore-required',
|
|
28
|
+
'firestore-budget',
|
|
29
|
+
]);
|
|
30
|
+
/**
|
|
31
|
+
* Parse `@firestore-*` tags out of a comment block. Returns an empty
|
|
32
|
+
* `Annotations` with no warnings when the input contains no firestore
|
|
33
|
+
* tags — this is the additive fallback.
|
|
34
|
+
*/
|
|
35
|
+
export function parseAnnotations(commentText) {
|
|
36
|
+
const annotations = { mutexGroups: [], required: new Set() };
|
|
37
|
+
const warnings = [];
|
|
38
|
+
if (!commentText)
|
|
39
|
+
return { annotations, warnings };
|
|
40
|
+
// Normalize JSDoc syntax so the trailing `*/` and per-line ` * `
|
|
41
|
+
// don't leak into our value captures. We don't care about the
|
|
42
|
+
// comment structure — only the @firestore-* tags and their args.
|
|
43
|
+
commentText = stripCommentMarkers(commentText);
|
|
44
|
+
// ── @firestore-mutex { f1, f2, ... } ──────────────────────────────────
|
|
45
|
+
// Use a regex that captures the brace contents. Empty braces or no
|
|
46
|
+
// braces at all are malformed.
|
|
47
|
+
const mutexAll = commentText.matchAll(/@firestore-mutex\b([^\n]*)/g);
|
|
48
|
+
for (const m of mutexAll) {
|
|
49
|
+
const tail = m[1];
|
|
50
|
+
const braceMatch = tail.match(/\{\s*([^}]*?)\s*\}/);
|
|
51
|
+
if (!braceMatch) {
|
|
52
|
+
warnings.push({
|
|
53
|
+
code: 'malformed-mutex',
|
|
54
|
+
tag: 'firestore-mutex',
|
|
55
|
+
message: `@firestore-mutex requires a brace-delimited field list, e.g. \`@firestore-mutex { a, b, c }\` — got: ${tail.trim() || '(empty)'}`,
|
|
56
|
+
});
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
const fields = splitFields(braceMatch[1]);
|
|
60
|
+
if (fields.length === 0) {
|
|
61
|
+
warnings.push({
|
|
62
|
+
code: 'malformed-mutex',
|
|
63
|
+
tag: 'firestore-mutex',
|
|
64
|
+
message: '@firestore-mutex group is empty — at least one field is required.',
|
|
65
|
+
});
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
annotations.mutexGroups.push(new Set(fields));
|
|
69
|
+
}
|
|
70
|
+
// ── @firestore-required f1, f2 ────────────────────────────────────────
|
|
71
|
+
const requiredAll = commentText.matchAll(/@firestore-required\b([^\n@]*)/g);
|
|
72
|
+
for (const m of requiredAll) {
|
|
73
|
+
const fields = splitFields(m[1]);
|
|
74
|
+
if (fields.length === 0) {
|
|
75
|
+
warnings.push({
|
|
76
|
+
code: 'malformed-required',
|
|
77
|
+
tag: 'firestore-required',
|
|
78
|
+
message: '@firestore-required needs at least one field, e.g. `@firestore-required tenantId`.',
|
|
79
|
+
});
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
for (const f of fields)
|
|
83
|
+
annotations.required.add(f);
|
|
84
|
+
}
|
|
85
|
+
// ── @firestore-budget N ───────────────────────────────────────────────
|
|
86
|
+
const budgetAll = [...commentText.matchAll(/@firestore-budget\b([^\n@]*)/g)];
|
|
87
|
+
for (const m of budgetAll) {
|
|
88
|
+
const raw = m[1].trim();
|
|
89
|
+
const parsed = Number(raw);
|
|
90
|
+
if (!raw || !Number.isInteger(parsed) || parsed <= 0) {
|
|
91
|
+
warnings.push({
|
|
92
|
+
code: 'malformed-budget',
|
|
93
|
+
tag: 'firestore-budget',
|
|
94
|
+
message: `@firestore-budget needs a positive integer, e.g. \`@firestore-budget 12\` — got: ${raw || '(empty)'}`,
|
|
95
|
+
});
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
// Last write wins if multiple budget tags appear — pick the
|
|
99
|
+
// tightest cap so the agent sees the strictest constraint.
|
|
100
|
+
annotations.budget = annotations.budget === undefined ? parsed : Math.min(annotations.budget, parsed);
|
|
101
|
+
}
|
|
102
|
+
// ── Unknown @firestore-* tags ─────────────────────────────────────────
|
|
103
|
+
// Catch typos like @firestore-mutext or @firestore-mutexx so the
|
|
104
|
+
// agent doesn't silently skip an intended annotation.
|
|
105
|
+
const allTags = commentText.matchAll(/@(firestore-[a-zA-Z0-9_-]+)/g);
|
|
106
|
+
const seenUnknown = new Set();
|
|
107
|
+
for (const m of allTags) {
|
|
108
|
+
const tag = m[1];
|
|
109
|
+
if (KNOWN_TAGS.has(tag))
|
|
110
|
+
continue;
|
|
111
|
+
if (seenUnknown.has(tag))
|
|
112
|
+
continue;
|
|
113
|
+
seenUnknown.add(tag);
|
|
114
|
+
warnings.push({
|
|
115
|
+
code: 'unknown-firestore-tag',
|
|
116
|
+
tag,
|
|
117
|
+
message: `Unknown annotation '@${tag}'. Recognized: @firestore-mutex, @firestore-required, @firestore-budget.`,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return { annotations, warnings };
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Split a comma-separated field list. Trims whitespace, drops empties,
|
|
124
|
+
* and strips trailing commas. Field identifiers themselves are
|
|
125
|
+
* preserved as written — no validation against actual source.
|
|
126
|
+
*/
|
|
127
|
+
function splitFields(s) {
|
|
128
|
+
return s.split(',').map(f => f.trim()).filter(Boolean);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Strip `/*`, `* /`, leading per-line ` * `, and `//` markers so the
|
|
132
|
+
* downstream regexes don't pick them up as part of value captures.
|
|
133
|
+
* Preserves newlines so multi-line tags still split correctly.
|
|
134
|
+
*/
|
|
135
|
+
function stripCommentMarkers(s) {
|
|
136
|
+
// Remove block-comment open/close.
|
|
137
|
+
s = s.replace(/\/\*+/g, '').replace(/\*+\//g, '');
|
|
138
|
+
// Remove leading ` * ` (and the bare ` *`) on each line.
|
|
139
|
+
s = s.replace(/^[ \t]*\*+[ \t]?/gm, '');
|
|
140
|
+
// Remove `//` line-comment markers (rare for JSDoc, but legal).
|
|
141
|
+
s = s.replace(/^[ \t]*\/\/[ \t]?/gm, '');
|
|
142
|
+
return s;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=annotations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.js","sourceRoot":"","sources":["../../../../src/rules/indexes/extract/annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AA6BH,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,iBAAiB;IACjB,oBAAoB;IACpB,kBAAkB;CACnB,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,MAAM,WAAW,GAAgB,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;IAC1E,MAAM,QAAQ,GAAwB,EAAE,CAAC;IAEzC,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;IAEnD,iEAAiE;IACjE,8DAA8D;IAC9D,iEAAiE;IACjE,WAAW,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAE/C,yEAAyE;IACzE,mEAAmE;IACnE,+BAA+B;IAC/B,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC;IACrE,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAClB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACpD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,iBAA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;AACH,SAAS,WAAW,CAAC,CAAS;IAC5B,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,CAAS;IACpC,mCAAmC;IACnC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAClD,yDAAyD;IACzD,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;IACxC,gEAAgE;IAChE,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;IACzC,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small TypeScript-AST helpers used by the rest of the extractor.
|
|
3
|
+
* Pure utilities — no extractor state, no allocation of context.
|
|
4
|
+
*/
|
|
5
|
+
import ts from 'typescript';
|
|
6
|
+
/**
|
|
7
|
+
* Returns the literal text of a string-literal or no-substitution
|
|
8
|
+
* template literal node. Returns `null` for any other expression so the
|
|
9
|
+
* caller can decide how to handle the dynamic case.
|
|
10
|
+
*/
|
|
11
|
+
export declare function strLit(node: ts.Node): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Extract the callee name from a call expression. Handles both bare
|
|
14
|
+
* identifiers (`query(...)`) and property accesses (`firestore.query(...)`),
|
|
15
|
+
* returning the **rightmost** identifier in either case so module-style
|
|
16
|
+
* imports and namespace imports both work.
|
|
17
|
+
*
|
|
18
|
+
* Returns `null` for callees we can't resolve statically (e.g.,
|
|
19
|
+
* `(foo ? a : b)(...)` or `arr[0](...)`).
|
|
20
|
+
*/
|
|
21
|
+
export declare function getCalleeName(call: ts.CallExpression): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Find a top-level function (declaration, function-expression assigned to
|
|
24
|
+
* a `let`/`const`, or arrow function assigned to one) by name and return
|
|
25
|
+
* the function body node. Returns `null` if no such function exists.
|
|
26
|
+
*
|
|
27
|
+
* Used by the extractor to locate the function whose query chain we want
|
|
28
|
+
* to scan. A more complete implementation would build a real symbol
|
|
29
|
+
* table; this is enough for the common Firebase-app pattern of one
|
|
30
|
+
* exported function per query.
|
|
31
|
+
*/
|
|
32
|
+
export declare function findFunctionByName(sf: ts.SourceFile, name: string): ts.Node | null;
|
|
33
|
+
/**
|
|
34
|
+
* Walk every function-like node in a source file and yield each body.
|
|
35
|
+
* Used by the orchestrator when no specific function name is given —
|
|
36
|
+
* scan everything that could contain a query chain.
|
|
37
|
+
*
|
|
38
|
+
* Includes function declarations, arrow functions, function expressions,
|
|
39
|
+
* and method declarations. Class constructors and getters/setters are
|
|
40
|
+
* also included since they can issue queries too.
|
|
41
|
+
*/
|
|
42
|
+
export declare function iterFunctionBodies(sf: ts.SourceFile): Generator<{
|
|
43
|
+
name: string;
|
|
44
|
+
body: ts.Node;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Parse a string of JS/TS source into a SourceFile. Returns `null` if
|
|
48
|
+
* TypeScript reports a fatal lex error — TypeScript's parser is very
|
|
49
|
+
* lenient (it'll happily produce a partially-correct AST for malformed
|
|
50
|
+
* input), so this almost always succeeds. The orchestrator still wraps
|
|
51
|
+
* the call in a try/catch for the rare hard failure.
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseSource(name: string, source: string): ts.SourceFile;
|
|
54
|
+
//# sourceMappingURL=ast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../../../src/rules/indexes/extract/ast.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,GAAG,IAAI,CAGnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,GAAG,MAAM,GAAG,IAAI,CAKpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,CAAC,IAAI,GAAG,IAAI,CAsBlF;AAED;;;;;;;;GAQG;AACH,wBAAiB,kBAAkB,CAAC,EAAE,EAAE,EAAE,CAAC,UAAU,GAAG,SAAS,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;CAAE,CAAC,CA4BjG;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,EAAE,CAAC,UAAU,CAKvE"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small TypeScript-AST helpers used by the rest of the extractor.
|
|
3
|
+
* Pure utilities — no extractor state, no allocation of context.
|
|
4
|
+
*/
|
|
5
|
+
import ts from 'typescript';
|
|
6
|
+
/**
|
|
7
|
+
* Returns the literal text of a string-literal or no-substitution
|
|
8
|
+
* template literal node. Returns `null` for any other expression so the
|
|
9
|
+
* caller can decide how to handle the dynamic case.
|
|
10
|
+
*/
|
|
11
|
+
export function strLit(node) {
|
|
12
|
+
if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node))
|
|
13
|
+
return node.text;
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Extract the callee name from a call expression. Handles both bare
|
|
18
|
+
* identifiers (`query(...)`) and property accesses (`firestore.query(...)`),
|
|
19
|
+
* returning the **rightmost** identifier in either case so module-style
|
|
20
|
+
* imports and namespace imports both work.
|
|
21
|
+
*
|
|
22
|
+
* Returns `null` for callees we can't resolve statically (e.g.,
|
|
23
|
+
* `(foo ? a : b)(...)` or `arr[0](...)`).
|
|
24
|
+
*/
|
|
25
|
+
export function getCalleeName(call) {
|
|
26
|
+
const e = call.expression;
|
|
27
|
+
if (ts.isIdentifier(e))
|
|
28
|
+
return e.text;
|
|
29
|
+
if (ts.isPropertyAccessExpression(e))
|
|
30
|
+
return e.name.text;
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Find a top-level function (declaration, function-expression assigned to
|
|
35
|
+
* a `let`/`const`, or arrow function assigned to one) by name and return
|
|
36
|
+
* the function body node. Returns `null` if no such function exists.
|
|
37
|
+
*
|
|
38
|
+
* Used by the extractor to locate the function whose query chain we want
|
|
39
|
+
* to scan. A more complete implementation would build a real symbol
|
|
40
|
+
* table; this is enough for the common Firebase-app pattern of one
|
|
41
|
+
* exported function per query.
|
|
42
|
+
*/
|
|
43
|
+
export function findFunctionByName(sf, name) {
|
|
44
|
+
let found = null;
|
|
45
|
+
function visit(n) {
|
|
46
|
+
if (found)
|
|
47
|
+
return;
|
|
48
|
+
if (ts.isFunctionDeclaration(n) && n.name?.text === name) {
|
|
49
|
+
found = n.body ?? null;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (ts.isVariableStatement(n)) {
|
|
53
|
+
for (const d of n.declarationList.declarations) {
|
|
54
|
+
if (ts.isIdentifier(d.name) && d.name.text === name && d.initializer) {
|
|
55
|
+
if (ts.isArrowFunction(d.initializer) || ts.isFunctionExpression(d.initializer)) {
|
|
56
|
+
found = d.initializer.body;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
ts.forEachChild(n, visit);
|
|
63
|
+
}
|
|
64
|
+
visit(sf);
|
|
65
|
+
return found;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Walk every function-like node in a source file and yield each body.
|
|
69
|
+
* Used by the orchestrator when no specific function name is given —
|
|
70
|
+
* scan everything that could contain a query chain.
|
|
71
|
+
*
|
|
72
|
+
* Includes function declarations, arrow functions, function expressions,
|
|
73
|
+
* and method declarations. Class constructors and getters/setters are
|
|
74
|
+
* also included since they can issue queries too.
|
|
75
|
+
*/
|
|
76
|
+
export function* iterFunctionBodies(sf) {
|
|
77
|
+
function nameOf(n) {
|
|
78
|
+
if (ts.isFunctionDeclaration(n) || ts.isMethodDeclaration(n)) {
|
|
79
|
+
const id = n.name;
|
|
80
|
+
if (id && ts.isIdentifier(id))
|
|
81
|
+
return id.text;
|
|
82
|
+
}
|
|
83
|
+
return '<anon>';
|
|
84
|
+
}
|
|
85
|
+
function* visit(n) {
|
|
86
|
+
if (ts.isFunctionDeclaration(n) && n.body) {
|
|
87
|
+
yield { name: nameOf(n), body: n.body };
|
|
88
|
+
}
|
|
89
|
+
else if (ts.isMethodDeclaration(n) && n.body) {
|
|
90
|
+
yield { name: nameOf(n), body: n.body };
|
|
91
|
+
}
|
|
92
|
+
else if (ts.isVariableStatement(n)) {
|
|
93
|
+
for (const d of n.declarationList.declarations) {
|
|
94
|
+
if (d.initializer && (ts.isArrowFunction(d.initializer) || ts.isFunctionExpression(d.initializer))) {
|
|
95
|
+
const name = ts.isIdentifier(d.name) ? d.name.text : '<anon>';
|
|
96
|
+
yield { name, body: d.initializer.body };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
for (const child of n.getChildren()) {
|
|
101
|
+
yield* visit(child);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
yield* visit(sf);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Parse a string of JS/TS source into a SourceFile. Returns `null` if
|
|
108
|
+
* TypeScript reports a fatal lex error — TypeScript's parser is very
|
|
109
|
+
* lenient (it'll happily produce a partially-correct AST for malformed
|
|
110
|
+
* input), so this almost always succeeds. The orchestrator still wraps
|
|
111
|
+
* the call in a try/catch for the rare hard failure.
|
|
112
|
+
*/
|
|
113
|
+
export function parseSource(name, source) {
|
|
114
|
+
// ScriptKind.JS for the modular Firebase API in JS; TS is a superset
|
|
115
|
+
// so this still parses .ts correctly. Using JS here means JSDoc tags
|
|
116
|
+
// are surfaced (we'll use this for the Layer 2 annotation work).
|
|
117
|
+
return ts.createSourceFile(name, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.JS);
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=ast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../../../src/rules/indexes/extract/ast.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,IAAa;IAClC,IAAI,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,+BAA+B,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IAC3F,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,IAAuB;IACnD,MAAM,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;IAC1B,IAAI,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC,IAAI,CAAC;IACtC,IAAI,EAAE,CAAC,0BAA0B,CAAC,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACzD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAiB,EAAE,IAAY;IAChE,IAAI,KAAK,GAAmB,IAAI,CAAC;IACjC,SAAS,KAAK,CAAC,CAAU;QACvB,IAAI,KAAK;YAAE,OAAO;QAClB,IAAI,EAAE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nB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,MAAc;IACtD,qEAAqE;IACrE,qEAAqE;IACrE,iEAAiE;IACjE,OAAO,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AAC3F,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `classifyQueryCall` — given a `query(...)` call expression, decide whether
|
|
3
|
+
* it's an INIT (`query(collection(db, "X"), ...)`) or a WRAP
|
|
4
|
+
* (`query(q, ...constraints)`), and produce the fragments contributed by
|
|
5
|
+
* the call's constraint arguments.
|
|
6
|
+
*
|
|
7
|
+
* One call may produce multiple fragments — `query(q, where(...), orderBy(...))`
|
|
8
|
+
* yields a `where` and an `orderBy` fragment. Callers wrap each fragment
|
|
9
|
+
* with branch context (branchId/clauseId/skippable) before storing.
|
|
10
|
+
*/
|
|
11
|
+
import ts from 'typescript';
|
|
12
|
+
import type { Filter, Order } from './types.js';
|
|
13
|
+
/**
|
|
14
|
+
* A fragment without branch context — `dataflow.ts` adds branchId/clauseId
|
|
15
|
+
* /skippable when it sees the fragment in its lexical position.
|
|
16
|
+
*/
|
|
17
|
+
export interface ClassifiedFragment {
|
|
18
|
+
kind: 'where' | 'orderBy' | 'limit' | 'unknown';
|
|
19
|
+
filter?: Filter;
|
|
20
|
+
order?: Order;
|
|
21
|
+
limit?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ClassifiedCall {
|
|
24
|
+
/** True iff this call initializes the chain (`query(collection(...))`). */
|
|
25
|
+
isInit: boolean;
|
|
26
|
+
/** Present when isInit is true and the path was statically resolvable. */
|
|
27
|
+
collectionPath?: string | null;
|
|
28
|
+
/** True when the INIT used `collectionGroup(...)` instead of `collection(...)`. */
|
|
29
|
+
isCollectionGroup?: boolean;
|
|
30
|
+
/** Constraints emitted by this call. */
|
|
31
|
+
fragments: ClassifiedFragment[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Classify a `query(...)` call. Caller is expected to have already
|
|
35
|
+
* confirmed `getCalleeName(call) === 'query'`.
|
|
36
|
+
*
|
|
37
|
+
* `varName` is the local that the chain is being built on (typically `q`).
|
|
38
|
+
* Used to recognize the WRAP shape `query(q, ...)`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function classifyQueryCall(call: ts.CallExpression, varName: string): ClassifiedCall;
|
|
41
|
+
//# sourceMappingURL=classify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../../../src/rules/indexes/extract/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,MAAM,EAAE,OAAO,CAAC;IAChB,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,mFAAmF;IACnF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,wCAAwC;IACxC,SAAS,EAAE,kBAAkB,EAAE,CAAC;CACjC;AAkFD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAuC1F"}
|