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.
Files changed (787) hide show
  1. package/README.md +138 -2
  2. package/README.md.orig +54 -0
  3. package/dist/app/index.d.ts +81 -0
  4. package/dist/app/index.d.ts.map +1 -0
  5. package/dist/app/index.js +78 -0
  6. package/dist/app/index.js.map +1 -0
  7. package/dist/auth/index.d.ts +346 -0
  8. package/dist/auth/index.d.ts.map +1 -0
  9. package/dist/auth/index.js +701 -0
  10. package/dist/auth/index.js.map +1 -0
  11. package/dist/auth/prod-backend.d.ts +39 -0
  12. package/dist/auth/prod-backend.d.ts.map +1 -0
  13. package/dist/auth/prod-backend.js +179 -0
  14. package/dist/auth/prod-backend.js.map +1 -0
  15. package/dist/auth/providers.d.ts +107 -0
  16. package/dist/auth/providers.d.ts.map +1 -0
  17. package/dist/auth/providers.js +138 -0
  18. package/dist/auth/providers.js.map +1 -0
  19. package/dist/auth/sandbox-backend.d.ts +769 -0
  20. package/dist/auth/sandbox-backend.d.ts.map +1 -0
  21. package/dist/auth/sandbox-backend.js +1598 -0
  22. package/dist/auth/sandbox-backend.js.map +1 -0
  23. package/dist/auth/target.d.ts +40 -0
  24. package/dist/auth/target.d.ts.map +1 -0
  25. package/dist/auth/target.js +28 -0
  26. package/dist/auth/target.js.map +1 -0
  27. package/dist/auth/types.d.ts +252 -0
  28. package/dist/auth/types.d.ts.map +1 -0
  29. package/dist/auth/types.js +26 -0
  30. package/dist/auth/types.js.map +1 -0
  31. package/dist/database/constraints/atoms.d.ts +29 -0
  32. package/dist/database/constraints/atoms.d.ts.map +1 -0
  33. package/dist/database/constraints/atoms.js +43 -0
  34. package/dist/database/constraints/atoms.js.map +1 -0
  35. package/dist/database/constraints/compose.d.ts +16 -0
  36. package/dist/database/constraints/compose.d.ts.map +1 -0
  37. package/dist/database/constraints/compose.js +15 -0
  38. package/dist/database/constraints/compose.js.map +1 -0
  39. package/dist/database/constraints/data.d.ts +30 -0
  40. package/dist/database/constraints/data.d.ts.map +1 -0
  41. package/dist/database/constraints/data.js +46 -0
  42. package/dist/database/constraints/data.js.map +1 -0
  43. package/dist/database/constraints/document.d.ts +42 -0
  44. package/dist/database/constraints/document.d.ts.map +1 -0
  45. package/dist/database/constraints/document.js +86 -0
  46. package/dist/database/constraints/document.js.map +1 -0
  47. package/dist/database/constraints/game.d.ts +30 -0
  48. package/dist/database/constraints/game.d.ts.map +1 -0
  49. package/dist/database/constraints/game.js +49 -0
  50. package/dist/database/constraints/game.js.map +1 -0
  51. package/dist/database/constraints/index.d.ts +12 -0
  52. package/dist/database/constraints/index.d.ts.map +1 -0
  53. package/dist/database/constraints/index.js +9 -0
  54. package/dist/database/constraints/index.js.map +1 -0
  55. package/dist/database/constraints/policies.d.ts +16 -0
  56. package/dist/database/constraints/policies.d.ts.map +1 -0
  57. package/dist/database/constraints/policies.js +17 -0
  58. package/dist/database/constraints/policies.js.map +1 -0
  59. package/dist/database/constraints/ruleset.d.ts +5 -0
  60. package/dist/database/constraints/ruleset.d.ts.map +1 -0
  61. package/dist/database/constraints/ruleset.js +132 -0
  62. package/dist/database/constraints/ruleset.js.map +1 -0
  63. package/dist/database/constraints/schema.d.ts +17 -0
  64. package/dist/database/constraints/schema.d.ts.map +1 -0
  65. package/dist/database/constraints/schema.js +74 -0
  66. package/dist/database/constraints/schema.js.map +1 -0
  67. package/dist/database/constraints/types.d.ts +22 -0
  68. package/dist/database/constraints/types.d.ts.map +1 -0
  69. package/dist/database/constraints/types.js +2 -0
  70. package/dist/database/constraints/types.js.map +1 -0
  71. package/dist/database/crawl/handler.d.ts +7 -0
  72. package/dist/database/crawl/handler.d.ts.map +1 -0
  73. package/dist/database/crawl/handler.js +91 -0
  74. package/dist/database/crawl/handler.js.map +1 -0
  75. package/dist/database/crawl/semaphore.d.ts +9 -0
  76. package/dist/database/crawl/semaphore.d.ts.map +1 -0
  77. package/dist/database/crawl/semaphore.js +27 -0
  78. package/dist/database/crawl/semaphore.js.map +1 -0
  79. package/dist/database/crawl/spec.d.ts +33 -0
  80. package/dist/database/crawl/spec.d.ts.map +1 -0
  81. package/dist/database/crawl/spec.js +12 -0
  82. package/dist/database/crawl/spec.js.map +1 -0
  83. package/dist/database/data/handler.d.ts +9 -0
  84. package/dist/database/data/handler.d.ts.map +1 -0
  85. package/dist/database/data/handler.js +96 -0
  86. package/dist/database/data/handler.js.map +1 -0
  87. package/dist/database/data/spec.d.ts +77 -0
  88. package/dist/database/data/spec.d.ts.map +1 -0
  89. package/dist/database/data/spec.js +17 -0
  90. package/dist/database/data/spec.js.map +1 -0
  91. package/dist/database/data/validated.d.ts +8 -0
  92. package/dist/database/data/validated.d.ts.map +1 -0
  93. package/dist/database/data/validated.js +99 -0
  94. package/dist/database/data/validated.js.map +1 -0
  95. package/dist/database/grammar/RtdbExpr.ohm +98 -0
  96. package/dist/database/grammar/RtdbExpr.ohm.generated.d.ts +2 -0
  97. package/dist/database/grammar/RtdbExpr.ohm.generated.d.ts.map +1 -0
  98. package/dist/database/grammar/RtdbExpr.ohm.generated.js +103 -0
  99. package/dist/database/grammar/RtdbExpr.ohm.generated.js.map +1 -0
  100. package/dist/database/grammar/RtdbExprParser.d.ts +5 -0
  101. package/dist/database/grammar/RtdbExprParser.d.ts.map +1 -0
  102. package/dist/database/grammar/RtdbExprParser.js +53 -0
  103. package/dist/database/grammar/RtdbExprParser.js.map +1 -0
  104. package/dist/database/grammar/linter.d.ts +3 -0
  105. package/dist/database/grammar/linter.d.ts.map +1 -0
  106. package/dist/database/grammar/linter.js +66 -0
  107. package/dist/database/grammar/linter.js.map +1 -0
  108. package/dist/database/grammar/simulator.d.ts +31 -0
  109. package/dist/database/grammar/simulator.d.ts.map +1 -0
  110. package/dist/database/grammar/simulator.js +255 -0
  111. package/dist/database/grammar/simulator.js.map +1 -0
  112. package/dist/database/grammar/validator.d.ts +3 -0
  113. package/dist/database/grammar/validator.d.ts.map +1 -0
  114. package/dist/database/grammar/validator.js +84 -0
  115. package/dist/database/grammar/validator.js.map +1 -0
  116. package/dist/database/host.d.ts +50 -0
  117. package/dist/database/host.d.ts.map +1 -0
  118. package/dist/database/host.js +41 -0
  119. package/dist/database/host.js.map +1 -0
  120. package/dist/database/index.d.ts +40 -0
  121. package/dist/database/index.d.ts.map +1 -0
  122. package/dist/database/index.js +47 -0
  123. package/dist/database/index.js.map +1 -0
  124. package/dist/database/initialize-from-app.d.ts +28 -0
  125. package/dist/database/initialize-from-app.d.ts.map +1 -0
  126. package/dist/database/initialize-from-app.js +23 -0
  127. package/dist/database/initialize-from-app.js.map +1 -0
  128. package/dist/database/ir/handler.d.ts +6 -0
  129. package/dist/database/ir/handler.d.ts.map +1 -0
  130. package/dist/database/ir/handler.js +52 -0
  131. package/dist/database/ir/handler.js.map +1 -0
  132. package/dist/database/ir/spec.d.ts +25 -0
  133. package/dist/database/ir/spec.d.ts.map +1 -0
  134. package/dist/database/ir/spec.js +11 -0
  135. package/dist/database/ir/spec.js.map +1 -0
  136. package/dist/database/mapper.d.ts +9 -0
  137. package/dist/database/mapper.d.ts.map +1 -0
  138. package/dist/database/mapper.js +115 -0
  139. package/dist/database/mapper.js.map +1 -0
  140. package/dist/database/modular.d.ts +604 -0
  141. package/dist/database/modular.d.ts.map +1 -0
  142. package/dist/database/modular.js +1226 -0
  143. package/dist/database/modular.js.map +1 -0
  144. package/dist/database/replay.d.ts +33 -0
  145. package/dist/database/replay.d.ts.map +1 -0
  146. package/dist/database/replay.js +124 -0
  147. package/dist/database/replay.js.map +1 -0
  148. package/dist/database/resolver.d.ts +4 -0
  149. package/dist/database/resolver.d.ts.map +1 -0
  150. package/dist/database/resolver.js +66 -0
  151. package/dist/database/resolver.js.map +1 -0
  152. package/dist/database/sandbox/backend.d.ts +403 -0
  153. package/dist/database/sandbox/backend.d.ts.map +1 -0
  154. package/dist/database/sandbox/backend.js +1467 -0
  155. package/dist/database/sandbox/backend.js.map +1 -0
  156. package/dist/database/sandbox/data-tree.d.ts +123 -0
  157. package/dist/database/sandbox/data-tree.d.ts.map +1 -0
  158. package/dist/database/sandbox/data-tree.js +310 -0
  159. package/dist/database/sandbox/data-tree.js.map +1 -0
  160. package/dist/database/sandbox/normalize.d.ts +77 -0
  161. package/dist/database/sandbox/normalize.d.ts.map +1 -0
  162. package/dist/database/sandbox/normalize.js +165 -0
  163. package/dist/database/sandbox/normalize.js.map +1 -0
  164. package/dist/database/sandbox/push-id.d.ts +32 -0
  165. package/dist/database/sandbox/push-id.d.ts.map +1 -0
  166. package/dist/database/sandbox/push-id.js +82 -0
  167. package/dist/database/sandbox/push-id.js.map +1 -0
  168. package/dist/database/sandbox/query.d.ts +175 -0
  169. package/dist/database/sandbox/query.d.ts.map +1 -0
  170. package/dist/database/sandbox/query.js +269 -0
  171. package/dist/database/sandbox/query.js.map +1 -0
  172. package/dist/database/sandbox/rules-eval.d.ts +69 -0
  173. package/dist/database/sandbox/rules-eval.d.ts.map +1 -0
  174. package/dist/database/sandbox/rules-eval.js +124 -0
  175. package/dist/database/sandbox/rules-eval.js.map +1 -0
  176. package/dist/database/sandbox/sentinels.d.ts +71 -0
  177. package/dist/database/sandbox/sentinels.d.ts.map +1 -0
  178. package/dist/database/sandbox/sentinels.js +92 -0
  179. package/dist/database/sandbox/sentinels.js.map +1 -0
  180. package/dist/database/simulation/handler.d.ts +6 -0
  181. package/dist/database/simulation/handler.d.ts.map +1 -0
  182. package/dist/database/simulation/handler.js +236 -0
  183. package/dist/database/simulation/handler.js.map +1 -0
  184. package/dist/database/simulation/spec.d.ts +69 -0
  185. package/dist/database/simulation/spec.d.ts.map +1 -0
  186. package/dist/database/simulation/spec.js +25 -0
  187. package/dist/database/simulation/spec.js.map +1 -0
  188. package/dist/database/tools.d.ts +22 -0
  189. package/dist/database/tools.d.ts.map +1 -0
  190. package/dist/database/tools.js +272 -0
  191. package/dist/database/tools.js.map +1 -0
  192. package/dist/database/types.d.ts +210 -0
  193. package/dist/database/types.d.ts.map +1 -0
  194. package/dist/database/types.js +26 -0
  195. package/dist/database/types.js.map +1 -0
  196. package/dist/database/write/handler.d.ts +7 -0
  197. package/dist/database/write/handler.d.ts.map +1 -0
  198. package/dist/database/write/handler.js +42 -0
  199. package/dist/database/write/handler.js.map +1 -0
  200. package/dist/database/write/spec.d.ts +18 -0
  201. package/dist/database/write/spec.d.ts.map +1 -0
  202. package/dist/database/write/spec.js +7 -0
  203. package/dist/database/write/spec.js.map +1 -0
  204. package/dist/firestore/index.d.ts +533 -0
  205. package/dist/firestore/index.d.ts.map +1 -0
  206. package/dist/firestore/index.js +1536 -0
  207. package/dist/firestore/index.js.map +1 -0
  208. package/dist/firestore/tools.d.ts +67 -0
  209. package/dist/firestore/tools.d.ts.map +1 -0
  210. package/dist/firestore/tools.js +318 -0
  211. package/dist/firestore/tools.js.map +1 -0
  212. package/dist/firestore-values/index.d.ts +63 -0
  213. package/dist/firestore-values/index.d.ts.map +1 -0
  214. package/dist/firestore-values/index.js +148 -0
  215. package/dist/firestore-values/index.js.map +1 -0
  216. package/dist/project-scope.d.ts +5 -0
  217. package/dist/project-scope.d.ts.map +1 -0
  218. package/dist/project-scope.js +2 -0
  219. package/dist/project-scope.js.map +1 -0
  220. package/dist/rules/extract.d.ts +28 -0
  221. package/dist/rules/extract.d.ts.map +1 -0
  222. package/dist/rules/extract.js +25 -0
  223. package/dist/rules/extract.js.map +1 -0
  224. package/dist/rules/generators/assembler.d.ts +19 -0
  225. package/dist/rules/generators/assembler.d.ts.map +1 -0
  226. package/dist/rules/generators/assembler.js +292 -0
  227. package/dist/rules/generators/assembler.js.map +1 -0
  228. package/dist/rules/generators/expressions.d.ts +52 -0
  229. package/dist/rules/generators/expressions.d.ts.map +1 -0
  230. package/dist/rules/generators/expressions.js +117 -0
  231. package/dist/rules/generators/expressions.js.map +1 -0
  232. package/dist/rules/generators/grid.d.ts +22 -0
  233. package/dist/rules/generators/grid.d.ts.map +1 -0
  234. package/dist/rules/generators/grid.js +52 -0
  235. package/dist/rules/generators/grid.js.map +1 -0
  236. package/dist/rules/grammar/FirestoreAST.d.ts +129 -0
  237. package/dist/rules/grammar/FirestoreAST.d.ts.map +1 -0
  238. package/dist/rules/grammar/FirestoreAST.js +3 -0
  239. package/dist/rules/grammar/FirestoreAST.js.map +1 -0
  240. package/dist/rules/grammar/FirestoreAssembler.d.ts +5 -0
  241. package/dist/rules/grammar/FirestoreAssembler.d.ts.map +1 -0
  242. package/dist/rules/grammar/FirestoreAssembler.js +158 -0
  243. package/dist/rules/grammar/FirestoreAssembler.js.map +1 -0
  244. package/dist/rules/grammar/FirestoreParser.d.ts +46 -0
  245. package/dist/rules/grammar/FirestoreParser.d.ts.map +1 -0
  246. package/dist/rules/grammar/FirestoreParser.js +409 -0
  247. package/dist/rules/grammar/FirestoreParser.js.map +1 -0
  248. package/dist/rules/grammar/FirestoreRules.ohm +229 -0
  249. package/dist/rules/grammar/FirestoreRules.ohm.generated.d.ts +2 -0
  250. package/dist/rules/grammar/FirestoreRules.ohm.generated.d.ts.map +1 -0
  251. package/dist/rules/grammar/FirestoreRules.ohm.generated.js +234 -0
  252. package/dist/rules/grammar/FirestoreRules.ohm.generated.js.map +1 -0
  253. package/dist/rules/grammar/FirestoreValidator.d.ts +10 -0
  254. package/dist/rules/grammar/FirestoreValidator.d.ts.map +1 -0
  255. package/dist/rules/grammar/FirestoreValidator.js +482 -0
  256. package/dist/rules/grammar/FirestoreValidator.js.map +1 -0
  257. package/dist/rules/index.d.ts +67 -0
  258. package/dist/rules/index.d.ts.map +1 -0
  259. package/dist/rules/index.js +80 -0
  260. package/dist/rules/index.js.map +1 -0
  261. package/dist/rules/indexes/extract/annotation-collect.d.ts +42 -0
  262. package/dist/rules/indexes/extract/annotation-collect.d.ts.map +1 -0
  263. package/dist/rules/indexes/extract/annotation-collect.js +69 -0
  264. package/dist/rules/indexes/extract/annotation-collect.js.map +1 -0
  265. package/dist/rules/indexes/extract/annotations.d.ts +50 -0
  266. package/dist/rules/indexes/extract/annotations.d.ts.map +1 -0
  267. package/dist/rules/indexes/extract/annotations.js +144 -0
  268. package/dist/rules/indexes/extract/annotations.js.map +1 -0
  269. package/dist/rules/indexes/extract/ast.d.ts +54 -0
  270. package/dist/rules/indexes/extract/ast.d.ts.map +1 -0
  271. package/dist/rules/indexes/extract/ast.js +119 -0
  272. package/dist/rules/indexes/extract/ast.js.map +1 -0
  273. package/dist/rules/indexes/extract/classify.d.ts +41 -0
  274. package/dist/rules/indexes/extract/classify.d.ts.map +1 -0
  275. package/dist/rules/indexes/extract/classify.js +138 -0
  276. package/dist/rules/indexes/extract/classify.js.map +1 -0
  277. package/dist/rules/indexes/extract/composite.d.ts +38 -0
  278. package/dist/rules/indexes/extract/composite.d.ts.map +1 -0
  279. package/dist/rules/indexes/extract/composite.js +85 -0
  280. package/dist/rules/indexes/extract/composite.js.map +1 -0
  281. package/dist/rules/indexes/extract/dataflow.d.ts +45 -0
  282. package/dist/rules/indexes/extract/dataflow.d.ts.map +1 -0
  283. package/dist/rules/indexes/extract/dataflow.js +200 -0
  284. package/dist/rules/indexes/extract/dataflow.js.map +1 -0
  285. package/dist/rules/indexes/extract/enumerate.d.ts +41 -0
  286. package/dist/rules/indexes/extract/enumerate.d.ts.map +1 -0
  287. package/dist/rules/indexes/extract/enumerate.js +163 -0
  288. package/dist/rules/indexes/extract/enumerate.js.map +1 -0
  289. package/dist/rules/indexes/extract/extractor.d.ts +3 -0
  290. package/dist/rules/indexes/extract/extractor.d.ts.map +1 -0
  291. package/dist/rules/indexes/extract/extractor.js +274 -0
  292. package/dist/rules/indexes/extract/extractor.js.map +1 -0
  293. package/dist/rules/indexes/extract/types.d.ts +211 -0
  294. package/dist/rules/indexes/extract/types.d.ts.map +1 -0
  295. package/dist/rules/indexes/extract/types.js +14 -0
  296. package/dist/rules/indexes/extract/types.js.map +1 -0
  297. package/dist/rules/indexes/extractHandler.d.ts +16 -0
  298. package/dist/rules/indexes/extractHandler.d.ts.map +1 -0
  299. package/dist/rules/indexes/extractHandler.js +100 -0
  300. package/dist/rules/indexes/extractHandler.js.map +1 -0
  301. package/dist/rules/indexes/extractTool.d.ts +15 -0
  302. package/dist/rules/indexes/extractTool.d.ts.map +1 -0
  303. package/dist/rules/indexes/extractTool.js +55 -0
  304. package/dist/rules/indexes/extractTool.js.map +1 -0
  305. package/dist/rules/indexes/types.d.ts +71 -0
  306. package/dist/rules/indexes/types.d.ts.map +1 -0
  307. package/dist/rules/indexes/types.js +15 -0
  308. package/dist/rules/indexes/types.js.map +1 -0
  309. package/dist/rules/inspect/handler.d.ts +6 -0
  310. package/dist/rules/inspect/handler.d.ts.map +1 -0
  311. package/dist/rules/inspect/handler.js +144 -0
  312. package/dist/rules/inspect/handler.js.map +1 -0
  313. package/dist/rules/inspect/spec.d.ts +37 -0
  314. package/dist/rules/inspect/spec.d.ts.map +1 -0
  315. package/dist/rules/inspect/spec.js +2 -0
  316. package/dist/rules/inspect/spec.js.map +1 -0
  317. package/dist/rules/inspect/tools.d.ts +21 -0
  318. package/dist/rules/inspect/tools.d.ts.map +1 -0
  319. package/dist/rules/inspect/tools.js +21 -0
  320. package/dist/rules/inspect/tools.js.map +1 -0
  321. package/dist/rules/linter/ast-utils.d.ts +97 -0
  322. package/dist/rules/linter/ast-utils.d.ts.map +1 -0
  323. package/dist/rules/linter/ast-utils.js +491 -0
  324. package/dist/rules/linter/ast-utils.js.map +1 -0
  325. package/dist/rules/linter/hallucinations.d.ts +34 -0
  326. package/dist/rules/linter/hallucinations.d.ts.map +1 -0
  327. package/dist/rules/linter/hallucinations.js +334 -0
  328. package/dist/rules/linter/hallucinations.js.map +1 -0
  329. package/dist/rules/linter/linter.d.ts +84 -0
  330. package/dist/rules/linter/linter.d.ts.map +1 -0
  331. package/dist/rules/linter/linter.js +784 -0
  332. package/dist/rules/linter/linter.js.map +1 -0
  333. package/dist/rules/modules/resolver-browser.d.ts +41 -0
  334. package/dist/rules/modules/resolver-browser.d.ts.map +1 -0
  335. package/dist/rules/modules/resolver-browser.js +63 -0
  336. package/dist/rules/modules/resolver-browser.js.map +1 -0
  337. package/dist/rules/modules/resolver-core.d.ts +51 -0
  338. package/dist/rules/modules/resolver-core.d.ts.map +1 -0
  339. package/dist/rules/modules/resolver-core.js +338 -0
  340. package/dist/rules/modules/resolver-core.js.map +1 -0
  341. package/dist/rules/modules/resolver.d.ts +17 -0
  342. package/dist/rules/modules/resolver.d.ts.map +1 -0
  343. package/dist/rules/modules/resolver.js +49 -0
  344. package/dist/rules/modules/resolver.js.map +1 -0
  345. package/dist/rules/modules/stdlib/atomic.rules +52 -0
  346. package/dist/rules/modules/stdlib/atomic.test.json +152 -0
  347. package/dist/rules/modules/stdlib/auth.rules +7 -0
  348. package/dist/rules/modules/stdlib/auth.test.json +53 -0
  349. package/dist/rules/modules/stdlib/content.rules +50 -0
  350. package/dist/rules/modules/stdlib/content.test.json +238 -0
  351. package/dist/rules/modules/stdlib/counters.rules +41 -0
  352. package/dist/rules/modules/stdlib/counters.test.json +254 -0
  353. package/dist/rules/modules/stdlib/geometry.rules +43 -0
  354. package/dist/rules/modules/stdlib/geometry.test.json +200 -0
  355. package/dist/rules/modules/stdlib/joining.rules +49 -0
  356. package/dist/rules/modules/stdlib/joining.test.json +287 -0
  357. package/dist/rules/modules/stdlib/lifecycle.rules +51 -0
  358. package/dist/rules/modules/stdlib/lifecycle.test.json +288 -0
  359. package/dist/rules/modules/stdlib/lobby.rules +44 -0
  360. package/dist/rules/modules/stdlib/lobby.test.json +32 -0
  361. package/dist/rules/modules/stdlib/membership.rules +40 -0
  362. package/dist/rules/modules/stdlib/membership.test.json +107 -0
  363. package/dist/rules/modules/stdlib/spaces.rules +46 -0
  364. package/dist/rules/modules/stdlib/spaces.test.json +392 -0
  365. package/dist/rules/modules/stdlib/state.rules +28 -0
  366. package/dist/rules/modules/stdlib/state.test.json +55 -0
  367. package/dist/rules/modules/stdlib/timing.rules +20 -0
  368. package/dist/rules/modules/stdlib/timing.test.json +106 -0
  369. package/dist/rules/modules/stdlib/transitions.rules +34 -0
  370. package/dist/rules/modules/stdlib/transitions.test.json +86 -0
  371. package/dist/rules/modules/stdlib/turns.rules +27 -0
  372. package/dist/rules/modules/stdlib/turns.test.json +64 -0
  373. package/dist/rules/modules/stdlib/validation.rules +31 -0
  374. package/dist/rules/modules/stdlib/validation.test.json +184 -0
  375. package/dist/rules/modules/stdlib-content.d.ts +11 -0
  376. package/dist/rules/modules/stdlib-content.d.ts.map +1 -0
  377. package/dist/rules/modules/stdlib-content.js +590 -0
  378. package/dist/rules/modules/stdlib-content.js.map +1 -0
  379. package/dist/rules/node.d.ts +17 -0
  380. package/dist/rules/node.d.ts.map +1 -0
  381. package/dist/rules/node.js +21 -0
  382. package/dist/rules/node.js.map +1 -0
  383. package/dist/rules/rtdb.d.ts +28 -0
  384. package/dist/rules/rtdb.d.ts.map +1 -0
  385. package/dist/rules/rtdb.js +15 -0
  386. package/dist/rules/rtdb.js.map +1 -0
  387. package/dist/rules/simulator/evaluator.d.ts +179 -0
  388. package/dist/rules/simulator/evaluator.d.ts.map +1 -0
  389. package/dist/rules/simulator/evaluator.js +1221 -0
  390. package/dist/rules/simulator/evaluator.js.map +1 -0
  391. package/dist/rules/simulator/expression/eval-errors.d.ts +86 -0
  392. package/dist/rules/simulator/expression/eval-errors.d.ts.map +1 -0
  393. package/dist/rules/simulator/expression/eval-errors.js +68 -0
  394. package/dist/rules/simulator/expression/eval-errors.js.map +1 -0
  395. package/dist/rules/simulator/expression/evaluator.d.ts +43 -0
  396. package/dist/rules/simulator/expression/evaluator.d.ts.map +1 -0
  397. package/dist/rules/simulator/expression/evaluator.js +298 -0
  398. package/dist/rules/simulator/expression/evaluator.js.map +1 -0
  399. package/dist/rules/simulator/expression/lexer.d.ts +36 -0
  400. package/dist/rules/simulator/expression/lexer.d.ts.map +1 -0
  401. package/dist/rules/simulator/expression/lexer.js +318 -0
  402. package/dist/rules/simulator/expression/lexer.js.map +1 -0
  403. package/dist/rules/simulator/expression/parser.d.ts +39 -0
  404. package/dist/rules/simulator/expression/parser.d.ts.map +1 -0
  405. package/dist/rules/simulator/expression/parser.js +329 -0
  406. package/dist/rules/simulator/expression/parser.js.map +1 -0
  407. package/dist/rules/simulator/expression/types.d.ts +137 -0
  408. package/dist/rules/simulator/expression/types.d.ts.map +1 -0
  409. package/dist/rules/simulator/expression/types.js +90 -0
  410. package/dist/rules/simulator/expression/types.js.map +1 -0
  411. package/dist/rules/simulator/expression/walk-data.d.ts +52 -0
  412. package/dist/rules/simulator/expression/walk-data.d.ts.map +1 -0
  413. package/dist/rules/simulator/expression/walk-data.js +167 -0
  414. package/dist/rules/simulator/expression/walk-data.js.map +1 -0
  415. package/dist/rules/simulator/firestore-set.d.ts +25 -0
  416. package/dist/rules/simulator/firestore-set.d.ts.map +1 -0
  417. package/dist/rules/simulator/firestore-set.js +89 -0
  418. package/dist/rules/simulator/firestore-set.js.map +1 -0
  419. package/dist/rules/simulator/handler.d.ts +36 -0
  420. package/dist/rules/simulator/handler.d.ts.map +1 -0
  421. package/dist/rules/simulator/handler.js +583 -0
  422. package/dist/rules/simulator/handler.js.map +1 -0
  423. package/dist/rules/simulator/mapdiff.d.ts +29 -0
  424. package/dist/rules/simulator/mapdiff.d.ts.map +1 -0
  425. package/dist/rules/simulator/mapdiff.js +72 -0
  426. package/dist/rules/simulator/mapdiff.js.map +1 -0
  427. package/dist/rules/simulator/project-after-state.d.ts +33 -0
  428. package/dist/rules/simulator/project-after-state.d.ts.map +1 -0
  429. package/dist/rules/simulator/project-after-state.js +88 -0
  430. package/dist/rules/simulator/project-after-state.js.map +1 -0
  431. package/dist/rules/simulator/query-proof.d.ts +80 -0
  432. package/dist/rules/simulator/query-proof.d.ts.map +1 -0
  433. package/dist/rules/simulator/query-proof.js +142 -0
  434. package/dist/rules/simulator/query-proof.js.map +1 -0
  435. package/dist/rules/simulator/value-equality.d.ts +8 -0
  436. package/dist/rules/simulator/value-equality.d.ts.map +1 -0
  437. package/dist/rules/simulator/value-equality.js +40 -0
  438. package/dist/rules/simulator/value-equality.js.map +1 -0
  439. package/dist/rules/simulator/wrappers/base.d.ts +129 -0
  440. package/dist/rules/simulator/wrappers/base.d.ts.map +1 -0
  441. package/dist/rules/simulator/wrappers/base.js +90 -0
  442. package/dist/rules/simulator/wrappers/base.js.map +1 -0
  443. package/dist/rules/simulator/wrappers/bytes.d.ts +45 -0
  444. package/dist/rules/simulator/wrappers/bytes.d.ts.map +1 -0
  445. package/dist/rules/simulator/wrappers/bytes.js +130 -0
  446. package/dist/rules/simulator/wrappers/bytes.js.map +1 -0
  447. package/dist/rules/simulator/wrappers/duration.d.ts +76 -0
  448. package/dist/rules/simulator/wrappers/duration.d.ts.map +1 -0
  449. package/dist/rules/simulator/wrappers/duration.js +176 -0
  450. package/dist/rules/simulator/wrappers/duration.js.map +1 -0
  451. package/dist/rules/simulator/wrappers/float.d.ts +52 -0
  452. package/dist/rules/simulator/wrappers/float.d.ts.map +1 -0
  453. package/dist/rules/simulator/wrappers/float.js +88 -0
  454. package/dist/rules/simulator/wrappers/float.js.map +1 -0
  455. package/dist/rules/simulator/wrappers/latlng.d.ts +40 -0
  456. package/dist/rules/simulator/wrappers/latlng.d.ts.map +1 -0
  457. package/dist/rules/simulator/wrappers/latlng.js +100 -0
  458. package/dist/rules/simulator/wrappers/latlng.js.map +1 -0
  459. package/dist/rules/simulator/wrappers/path.d.ts +75 -0
  460. package/dist/rules/simulator/wrappers/path.d.ts.map +1 -0
  461. package/dist/rules/simulator/wrappers/path.js +158 -0
  462. package/dist/rules/simulator/wrappers/path.js.map +1 -0
  463. package/dist/rules/simulator/wrappers/reference.d.ts +82 -0
  464. package/dist/rules/simulator/wrappers/reference.d.ts.map +1 -0
  465. package/dist/rules/simulator/wrappers/reference.js +145 -0
  466. package/dist/rules/simulator/wrappers/reference.js.map +1 -0
  467. package/dist/rules/simulator/wrappers/timestamp.d.ts +86 -0
  468. package/dist/rules/simulator/wrappers/timestamp.d.ts.map +1 -0
  469. package/dist/rules/simulator/wrappers/timestamp.js +207 -0
  470. package/dist/rules/simulator/wrappers/timestamp.js.map +1 -0
  471. package/dist/rules/simulator/wrappers/vector.d.ts +43 -0
  472. package/dist/rules/simulator/wrappers/vector.d.ts.map +1 -0
  473. package/dist/rules/simulator/wrappers/vector.js +80 -0
  474. package/dist/rules/simulator/wrappers/vector.js.map +1 -0
  475. package/dist/rules/simulator-tools-impl.d.ts +64 -0
  476. package/dist/rules/simulator-tools-impl.d.ts.map +1 -0
  477. package/dist/rules/simulator-tools-impl.js +462 -0
  478. package/dist/rules/simulator-tools-impl.js.map +1 -0
  479. package/dist/rules/simulator.d.ts +20 -0
  480. package/dist/rules/simulator.d.ts.map +1 -0
  481. package/dist/rules/simulator.js +24 -0
  482. package/dist/rules/simulator.js.map +1 -0
  483. package/dist/rules/stdlib-modules.d.ts +73 -0
  484. package/dist/rules/stdlib-modules.d.ts.map +1 -0
  485. package/dist/rules/stdlib-modules.js +849 -0
  486. package/dist/rules/stdlib-modules.js.map +1 -0
  487. package/dist/rules/stdlib-tools.d.ts +19 -0
  488. package/dist/rules/stdlib-tools.d.ts.map +1 -0
  489. package/dist/rules/stdlib-tools.js +164 -0
  490. package/dist/rules/stdlib-tools.js.map +1 -0
  491. package/dist/rules/test/handler.d.ts +9 -0
  492. package/dist/rules/test/handler.d.ts.map +1 -0
  493. package/dist/rules/test/handler.js +124 -0
  494. package/dist/rules/test/handler.js.map +1 -0
  495. package/dist/rules/test/spec.d.ts +517 -0
  496. package/dist/rules/test/spec.d.ts.map +1 -0
  497. package/dist/rules/test/spec.js +227 -0
  498. package/dist/rules/test/spec.js.map +1 -0
  499. package/dist/rules/tools.d.ts +41 -0
  500. package/dist/rules/tools.d.ts.map +1 -0
  501. package/dist/rules/tools.js +124 -0
  502. package/dist/rules/tools.js.map +1 -0
  503. package/dist/rules/write/handler.d.ts +6 -0
  504. package/dist/rules/write/handler.d.ts.map +1 -0
  505. package/dist/rules/write/handler.js +126 -0
  506. package/dist/rules/write/handler.js.map +1 -0
  507. package/dist/rules/write/spec.d.ts +28 -0
  508. package/dist/rules/write/spec.d.ts.map +1 -0
  509. package/dist/rules/write/spec.js +2 -0
  510. package/dist/rules/write/spec.js.map +1 -0
  511. package/dist/sandbox/admin-compat.d.ts +20 -0
  512. package/dist/sandbox/admin-compat.d.ts.map +1 -0
  513. package/dist/sandbox/admin-compat.js +19 -0
  514. package/dist/sandbox/admin-compat.js.map +1 -0
  515. package/dist/sandbox/admin-firestore/error-translation.d.ts +86 -0
  516. package/dist/sandbox/admin-firestore/error-translation.d.ts.map +1 -0
  517. package/dist/sandbox/admin-firestore/error-translation.js +204 -0
  518. package/dist/sandbox/admin-firestore/error-translation.js.map +1 -0
  519. package/dist/sandbox/admin-firestore/index.d.ts +169 -0
  520. package/dist/sandbox/admin-firestore/index.d.ts.map +1 -0
  521. package/dist/sandbox/admin-firestore/index.js +456 -0
  522. package/dist/sandbox/admin-firestore/index.js.map +1 -0
  523. package/dist/sandbox/admin-firestore/remote.d.ts +97 -0
  524. package/dist/sandbox/admin-firestore/remote.d.ts.map +1 -0
  525. package/dist/sandbox/admin-firestore/remote.js +735 -0
  526. package/dist/sandbox/admin-firestore/remote.js.map +1 -0
  527. package/dist/sandbox/branches/index.d.ts +141 -0
  528. package/dist/sandbox/branches/index.d.ts.map +1 -0
  529. package/dist/sandbox/branches/index.js +327 -0
  530. package/dist/sandbox/branches/index.js.map +1 -0
  531. package/dist/sandbox/firestore/admin-compat/batch.d.ts +34 -0
  532. package/dist/sandbox/firestore/admin-compat/batch.d.ts.map +1 -0
  533. package/dist/sandbox/firestore/admin-compat/batch.js +73 -0
  534. package/dist/sandbox/firestore/admin-compat/batch.js.map +1 -0
  535. package/dist/sandbox/firestore/admin-compat/doc-ref.d.ts +38 -0
  536. package/dist/sandbox/firestore/admin-compat/doc-ref.d.ts.map +1 -0
  537. package/dist/sandbox/firestore/admin-compat/doc-ref.js +154 -0
  538. package/dist/sandbox/firestore/admin-compat/doc-ref.js.map +1 -0
  539. package/dist/sandbox/firestore/admin-compat/firestore.d.ts +45 -0
  540. package/dist/sandbox/firestore/admin-compat/firestore.d.ts.map +1 -0
  541. package/dist/sandbox/firestore/admin-compat/firestore.js +114 -0
  542. package/dist/sandbox/firestore/admin-compat/firestore.js.map +1 -0
  543. package/dist/sandbox/firestore/admin-compat/index.d.ts +45 -0
  544. package/dist/sandbox/firestore/admin-compat/index.d.ts.map +1 -0
  545. package/dist/sandbox/firestore/admin-compat/index.js +27 -0
  546. package/dist/sandbox/firestore/admin-compat/index.js.map +1 -0
  547. package/dist/sandbox/firestore/admin-compat/paths.d.ts +37 -0
  548. package/dist/sandbox/firestore/admin-compat/paths.d.ts.map +1 -0
  549. package/dist/sandbox/firestore/admin-compat/paths.js +49 -0
  550. package/dist/sandbox/firestore/admin-compat/paths.js.map +1 -0
  551. package/dist/sandbox/firestore/admin-compat/query.d.ts +261 -0
  552. package/dist/sandbox/firestore/admin-compat/query.d.ts.map +1 -0
  553. package/dist/sandbox/firestore/admin-compat/query.js +704 -0
  554. package/dist/sandbox/firestore/admin-compat/query.js.map +1 -0
  555. package/dist/sandbox/firestore/admin-compat/read-translation.d.ts +8 -0
  556. package/dist/sandbox/firestore/admin-compat/read-translation.d.ts.map +1 -0
  557. package/dist/sandbox/firestore/admin-compat/read-translation.js +59 -0
  558. package/dist/sandbox/firestore/admin-compat/read-translation.js.map +1 -0
  559. package/dist/sandbox/firestore/admin-compat/snapshots.d.ts +39 -0
  560. package/dist/sandbox/firestore/admin-compat/snapshots.d.ts.map +1 -0
  561. package/dist/sandbox/firestore/admin-compat/snapshots.js +50 -0
  562. package/dist/sandbox/firestore/admin-compat/snapshots.js.map +1 -0
  563. package/dist/sandbox/firestore/admin-compat/transaction.d.ts +35 -0
  564. package/dist/sandbox/firestore/admin-compat/transaction.d.ts.map +1 -0
  565. package/dist/sandbox/firestore/admin-compat/transaction.js +88 -0
  566. package/dist/sandbox/firestore/admin-compat/transaction.js.map +1 -0
  567. package/dist/sandbox/firestore/admin-compat/types.d.ts +297 -0
  568. package/dist/sandbox/firestore/admin-compat/types.d.ts.map +1 -0
  569. package/dist/sandbox/firestore/admin-compat/types.js +127 -0
  570. package/dist/sandbox/firestore/admin-compat/types.js.map +1 -0
  571. package/dist/sandbox/firestore/admin-compat/value-order.d.ts +49 -0
  572. package/dist/sandbox/firestore/admin-compat/value-order.d.ts.map +1 -0
  573. package/dist/sandbox/firestore/admin-compat/value-order.js +172 -0
  574. package/dist/sandbox/firestore/admin-compat/value-order.js.map +1 -0
  575. package/dist/sandbox/firestore/auto-id.d.ts +26 -0
  576. package/dist/sandbox/firestore/auto-id.d.ts.map +1 -0
  577. package/dist/sandbox/firestore/auto-id.js +36 -0
  578. package/dist/sandbox/firestore/auto-id.js.map +1 -0
  579. package/dist/sandbox/firestore/converters/bytes-geopoint.d.ts +48 -0
  580. package/dist/sandbox/firestore/converters/bytes-geopoint.d.ts.map +1 -0
  581. package/dist/sandbox/firestore/converters/bytes-geopoint.js +85 -0
  582. package/dist/sandbox/firestore/converters/bytes-geopoint.js.map +1 -0
  583. package/dist/sandbox/firestore/converters/fieldvalue.d.ts +69 -0
  584. package/dist/sandbox/firestore/converters/fieldvalue.d.ts.map +1 -0
  585. package/dist/sandbox/firestore/converters/fieldvalue.js +166 -0
  586. package/dist/sandbox/firestore/converters/fieldvalue.js.map +1 -0
  587. package/dist/sandbox/firestore/converters/reference.d.ts +31 -0
  588. package/dist/sandbox/firestore/converters/reference.d.ts.map +1 -0
  589. package/dist/sandbox/firestore/converters/reference.js +51 -0
  590. package/dist/sandbox/firestore/converters/reference.js.map +1 -0
  591. package/dist/sandbox/firestore/converters/timestamp.d.ts +32 -0
  592. package/dist/sandbox/firestore/converters/timestamp.d.ts.map +1 -0
  593. package/dist/sandbox/firestore/converters/timestamp.js +63 -0
  594. package/dist/sandbox/firestore/converters/timestamp.js.map +1 -0
  595. package/dist/sandbox/firestore/converters/user-timestamp.d.ts +46 -0
  596. package/dist/sandbox/firestore/converters/user-timestamp.d.ts.map +1 -0
  597. package/dist/sandbox/firestore/converters/user-timestamp.js +65 -0
  598. package/dist/sandbox/firestore/converters/user-timestamp.js.map +1 -0
  599. package/dist/sandbox/firestore/converters/vector.d.ts +24 -0
  600. package/dist/sandbox/firestore/converters/vector.d.ts.map +1 -0
  601. package/dist/sandbox/firestore/converters/vector.js +53 -0
  602. package/dist/sandbox/firestore/converters/vector.js.map +1 -0
  603. package/dist/sandbox/firestore/errors.d.ts +82 -0
  604. package/dist/sandbox/firestore/errors.d.ts.map +1 -0
  605. package/dist/sandbox/firestore/errors.js +54 -0
  606. package/dist/sandbox/firestore/errors.js.map +1 -0
  607. package/dist/sandbox/firestore/event-log.d.ts +99 -0
  608. package/dist/sandbox/firestore/event-log.d.ts.map +1 -0
  609. package/dist/sandbox/firestore/event-log.js +67 -0
  610. package/dist/sandbox/firestore/event-log.js.map +1 -0
  611. package/dist/sandbox/firestore/field-merge.d.ts +64 -0
  612. package/dist/sandbox/firestore/field-merge.d.ts.map +1 -0
  613. package/dist/sandbox/firestore/field-merge.js +221 -0
  614. package/dist/sandbox/firestore/field-merge.js.map +1 -0
  615. package/dist/sandbox/firestore/list-query-proof.d.ts +77 -0
  616. package/dist/sandbox/firestore/list-query-proof.d.ts.map +1 -0
  617. package/dist/sandbox/firestore/list-query-proof.js +170 -0
  618. package/dist/sandbox/firestore/list-query-proof.js.map +1 -0
  619. package/dist/sandbox/firestore/local-environment.d.ts +806 -0
  620. package/dist/sandbox/firestore/local-environment.d.ts.map +1 -0
  621. package/dist/sandbox/firestore/local-environment.js +3028 -0
  622. package/dist/sandbox/firestore/local-environment.js.map +1 -0
  623. package/dist/sandbox/firestore/local-state.d.ts +196 -0
  624. package/dist/sandbox/firestore/local-state.d.ts.map +1 -0
  625. package/dist/sandbox/firestore/local-state.js +413 -0
  626. package/dist/sandbox/firestore/local-state.js.map +1 -0
  627. package/dist/sandbox/firestore/overlay-backing.d.ts +44 -0
  628. package/dist/sandbox/firestore/overlay-backing.d.ts.map +1 -0
  629. package/dist/sandbox/firestore/overlay-backing.js +82 -0
  630. package/dist/sandbox/firestore/overlay-backing.js.map +1 -0
  631. package/dist/sandbox/firestore/sentinel-capture.d.ts +30 -0
  632. package/dist/sandbox/firestore/sentinel-capture.d.ts.map +1 -0
  633. package/dist/sandbox/firestore/sentinel-capture.js +61 -0
  634. package/dist/sandbox/firestore/sentinel-capture.js.map +1 -0
  635. package/dist/sandbox/firestore/snapshot-listeners.d.ts +284 -0
  636. package/dist/sandbox/firestore/snapshot-listeners.d.ts.map +1 -0
  637. package/dist/sandbox/firestore/snapshot-listeners.js +194 -0
  638. package/dist/sandbox/firestore/snapshot-listeners.js.map +1 -0
  639. package/dist/sandbox/firestore/topk.d.ts +12 -0
  640. package/dist/sandbox/firestore/topk.d.ts.map +1 -0
  641. package/dist/sandbox/firestore/topk.js +42 -0
  642. package/dist/sandbox/firestore/topk.js.map +1 -0
  643. package/dist/sandbox/firestore/transaction-merge.d.ts +55 -0
  644. package/dist/sandbox/firestore/transaction-merge.d.ts.map +1 -0
  645. package/dist/sandbox/firestore/transaction-merge.js +107 -0
  646. package/dist/sandbox/firestore/transaction-merge.js.map +1 -0
  647. package/dist/sandbox/firestore/transaction-types.d.ts +152 -0
  648. package/dist/sandbox/firestore/transaction-types.d.ts.map +1 -0
  649. package/dist/sandbox/firestore/transaction-types.js +10 -0
  650. package/dist/sandbox/firestore/transaction-types.js.map +1 -0
  651. package/dist/sandbox/firestore/transaction.d.ts +79 -0
  652. package/dist/sandbox/firestore/transaction.d.ts.map +1 -0
  653. package/dist/sandbox/firestore/transaction.js +95 -0
  654. package/dist/sandbox/firestore/transaction.js.map +1 -0
  655. package/dist/sandbox/firestore/value-equality.d.ts +2 -0
  656. package/dist/sandbox/firestore/value-equality.d.ts.map +1 -0
  657. package/dist/sandbox/firestore/value-equality.js +35 -0
  658. package/dist/sandbox/firestore/value-equality.js.map +1 -0
  659. package/dist/sandbox/firestore/value-resolver.d.ts +172 -0
  660. package/dist/sandbox/firestore/value-resolver.d.ts.map +1 -0
  661. package/dist/sandbox/firestore/value-resolver.js +221 -0
  662. package/dist/sandbox/firestore/value-resolver.js.map +1 -0
  663. package/dist/sandbox/firestore/wire-encoder.d.ts +14 -0
  664. package/dist/sandbox/firestore/wire-encoder.d.ts.map +1 -0
  665. package/dist/sandbox/firestore/wire-encoder.js +130 -0
  666. package/dist/sandbox/firestore/wire-encoder.js.map +1 -0
  667. package/dist/sandbox/index.d.ts +50 -0
  668. package/dist/sandbox/index.d.ts.map +1 -0
  669. package/dist/sandbox/index.js +63 -0
  670. package/dist/sandbox/index.js.map +1 -0
  671. package/dist/sandbox/internal/index.d.ts +36 -0
  672. package/dist/sandbox/internal/index.d.ts.map +1 -0
  673. package/dist/sandbox/internal/index.js +72 -0
  674. package/dist/sandbox/internal/index.js.map +1 -0
  675. package/dist/sandbox/internal/sandbox-impl.d.ts +343 -0
  676. package/dist/sandbox/internal/sandbox-impl.d.ts.map +1 -0
  677. package/dist/sandbox/internal/sandbox-impl.js +718 -0
  678. package/dist/sandbox/internal/sandbox-impl.js.map +1 -0
  679. package/dist/sandbox/persistence/backends.d.ts +37 -0
  680. package/dist/sandbox/persistence/backends.d.ts.map +1 -0
  681. package/dist/sandbox/persistence/backends.js +202 -0
  682. package/dist/sandbox/persistence/backends.js.map +1 -0
  683. package/dist/sandbox/persistence/chunk-format.d.ts +58 -0
  684. package/dist/sandbox/persistence/chunk-format.d.ts.map +1 -0
  685. package/dist/sandbox/persistence/chunk-format.js +163 -0
  686. package/dist/sandbox/persistence/chunk-format.js.map +1 -0
  687. package/dist/sandbox/persistence/controller.d.ts +39 -0
  688. package/dist/sandbox/persistence/controller.d.ts.map +1 -0
  689. package/dist/sandbox/persistence/controller.js +605 -0
  690. package/dist/sandbox/persistence/controller.js.map +1 -0
  691. package/dist/sandbox/persistence/index.d.ts +13 -0
  692. package/dist/sandbox/persistence/index.d.ts.map +1 -0
  693. package/dist/sandbox/persistence/index.js +5 -0
  694. package/dist/sandbox/persistence/index.js.map +1 -0
  695. package/dist/sandbox/persistence/serialize.d.ts +53 -0
  696. package/dist/sandbox/persistence/serialize.d.ts.map +1 -0
  697. package/dist/sandbox/persistence/serialize.js +98 -0
  698. package/dist/sandbox/persistence/serialize.js.map +1 -0
  699. package/dist/sandbox/persistence/types.d.ts +118 -0
  700. package/dist/sandbox/persistence/types.d.ts.map +1 -0
  701. package/dist/sandbox/persistence/types.js +15 -0
  702. package/dist/sandbox/persistence/types.js.map +1 -0
  703. package/dist/sandbox/remote.d.ts +118 -0
  704. package/dist/sandbox/remote.d.ts.map +1 -0
  705. package/dist/sandbox/remote.js +60 -0
  706. package/dist/sandbox/remote.js.map +1 -0
  707. package/dist/sandbox/replay/index.d.ts +106 -0
  708. package/dist/sandbox/replay/index.d.ts.map +1 -0
  709. package/dist/sandbox/replay/index.js +246 -0
  710. package/dist/sandbox/replay/index.js.map +1 -0
  711. package/dist/sandbox/sandbox-context.d.ts +40 -0
  712. package/dist/sandbox/sandbox-context.d.ts.map +1 -0
  713. package/dist/sandbox/sandbox-context.js +72 -0
  714. package/dist/sandbox/sandbox-context.js.map +1 -0
  715. package/dist/sandbox/tab-sync/index.d.ts +120 -0
  716. package/dist/sandbox/tab-sync/index.d.ts.map +1 -0
  717. package/dist/sandbox/tab-sync/index.js +272 -0
  718. package/dist/sandbox/tab-sync/index.js.map +1 -0
  719. package/dist/sandbox/types.d.ts +1235 -0
  720. package/dist/sandbox/types.d.ts.map +1 -0
  721. package/dist/sandbox/types.js +46 -0
  722. package/dist/sandbox/types.js.map +1 -0
  723. package/dist/storage/admin/api.d.ts +206 -0
  724. package/dist/storage/admin/api.d.ts.map +1 -0
  725. package/dist/storage/admin/api.js +349 -0
  726. package/dist/storage/admin/api.js.map +1 -0
  727. package/dist/storage/admin/handler.d.ts +29 -0
  728. package/dist/storage/admin/handler.d.ts.map +1 -0
  729. package/dist/storage/admin/handler.js +82 -0
  730. package/dist/storage/admin/handler.js.map +1 -0
  731. package/dist/storage/admin/spec.d.ts +64 -0
  732. package/dist/storage/admin/spec.d.ts.map +1 -0
  733. package/dist/storage/admin/spec.js +8 -0
  734. package/dist/storage/admin/spec.js.map +1 -0
  735. package/dist/storage/admin/tools.d.ts +23 -0
  736. package/dist/storage/admin/tools.d.ts.map +1 -0
  737. package/dist/storage/admin/tools.js +90 -0
  738. package/dist/storage/admin/tools.js.map +1 -0
  739. package/dist/storage/download.d.ts +27 -0
  740. package/dist/storage/download.d.ts.map +1 -0
  741. package/dist/storage/download.js +136 -0
  742. package/dist/storage/download.js.map +1 -0
  743. package/dist/storage/enforce.d.ts +26 -0
  744. package/dist/storage/enforce.d.ts.map +1 -0
  745. package/dist/storage/enforce.js +16 -0
  746. package/dist/storage/enforce.js.map +1 -0
  747. package/dist/storage/errors.d.ts +46 -0
  748. package/dist/storage/errors.d.ts.map +1 -0
  749. package/dist/storage/errors.js +62 -0
  750. package/dist/storage/errors.js.map +1 -0
  751. package/dist/storage/index.d.ts +49 -0
  752. package/dist/storage/index.d.ts.map +1 -0
  753. package/dist/storage/index.js +60 -0
  754. package/dist/storage/index.js.map +1 -0
  755. package/dist/storage/internal.d.ts +18 -0
  756. package/dist/storage/internal.d.ts.map +1 -0
  757. package/dist/storage/internal.js +18 -0
  758. package/dist/storage/internal.js.map +1 -0
  759. package/dist/storage/list.d.ts +17 -0
  760. package/dist/storage/list.d.ts.map +1 -0
  761. package/dist/storage/list.js +91 -0
  762. package/dist/storage/list.js.map +1 -0
  763. package/dist/storage/metadata.d.ts +86 -0
  764. package/dist/storage/metadata.d.ts.map +1 -0
  765. package/dist/storage/metadata.js +167 -0
  766. package/dist/storage/metadata.js.map +1 -0
  767. package/dist/storage/persistence.d.ts +134 -0
  768. package/dist/storage/persistence.d.ts.map +1 -0
  769. package/dist/storage/persistence.js +132 -0
  770. package/dist/storage/persistence.js.map +1 -0
  771. package/dist/storage/reference.d.ts +63 -0
  772. package/dist/storage/reference.d.ts.map +1 -0
  773. package/dist/storage/reference.js +156 -0
  774. package/dist/storage/reference.js.map +1 -0
  775. package/dist/storage/rules.d.ts +176 -0
  776. package/dist/storage/rules.d.ts.map +1 -0
  777. package/dist/storage/rules.js +621 -0
  778. package/dist/storage/rules.js.map +1 -0
  779. package/dist/storage/service.d.ts +139 -0
  780. package/dist/storage/service.d.ts.map +1 -0
  781. package/dist/storage/service.js +241 -0
  782. package/dist/storage/service.js.map +1 -0
  783. package/dist/storage/upload.d.ts +43 -0
  784. package/dist/storage/upload.d.ts.map +1 -0
  785. package/dist/storage/upload.js +235 -0
  786. package/dist/storage/upload.js.map +1 -0
  787. package/package.json +110 -3
@@ -0,0 +1,590 @@
1
+ /**
2
+ * GENERATED FILE — do not edit by hand.
3
+ * Regenerate via `bun run inline-stdlib` (or `bun run build`, which
4
+ * runs the generator as part of `prebuild`).
5
+ *
6
+ * Mirror of every `.rules` file under `src/modules/stdlib/`,
7
+ * inlined as TypeScript string literals so the resolver can run
8
+ * in the browser. See `scripts/inline-stdlib.ts`.
9
+ */
10
+ export const STDLIB_INLINE = {
11
+ atomic: `// Atomic module — cross-document integrity for BATCH writes, via the
12
+ // get()/getAfter() pair. Firestore evaluates every write in a batch
13
+ // against rules, and getAfter() returns another document's POST-BATCH
14
+ // state — so a rule can require "this write is only valid if a
15
+ // companion write happened in the same atomic batch".
16
+ //
17
+ // All semantics live-verified against a production database: companion
18
+ // visibility, solo-write denial, wrong-delta denial, single-use consumption
19
+ // incl. replay denial, and out-of-batch getAfter() falling back to current
20
+ // state.
21
+ //
22
+ // Explicit-param design: pass BOTH states of the companion doc —
23
+ // \`get(path).data\` (pre-batch) and \`getAfter(path).data\` (post-batch).
24
+ //
25
+ // import { companionChangedBy, consumedFlag } from 'atomic';
26
+ //
27
+ // // Denormalized counter: creating a task REQUIRES the team's
28
+ // // taskCount to have been incremented in the same batch:
29
+ // match /teams/{teamId}/tasks/{taskId} {
30
+ // function teamBefore() {
31
+ // return get(/databases/$(database)/documents/teams/$(teamId)).data;
32
+ // }
33
+ // function teamAfter() {
34
+ // return getAfter(/databases/$(database)/documents/teams/$(teamId)).data;
35
+ // }
36
+ // allow create: if companionChangedBy(teamBefore(), teamAfter(), 'taskCount', 1);
37
+ // }
38
+ //
39
+ // // Single-use invite: the join is valid only when the invite was
40
+ // // consumed (false -> true) IN THIS BATCH — replays deny because
41
+ // // the pre-batch state is already true:
42
+ // allow update: if consumedFlag(inviteBefore(), inviteAfter(), 'used');
43
+ //
44
+ // NOTE (simulator): in-batch companion semantics cannot be expressed
45
+ // in the simulator or the Rules Test API mock surface — the simulator
46
+ // treats cross-doc getAfter() as get(). These function BODIES are
47
+ // simulator-tested with explicit values; the getAfter() WIRING is the
48
+ // live v1 scope's job. Companion writes need their own allow rules too —
49
+ // every write in a batch is evaluated.
50
+
51
+ // The companion doc's field changed by EXACTLY n in this batch.
52
+ // before/after are the SAME doc's get()/getAfter() data.
53
+ export function companionChangedBy(before, after, field, n) {
54
+ return after[field] == before[field] + n;
55
+ }
56
+
57
+ // A single-use flag was consumed IN THIS BATCH: pre-batch false,
58
+ // post-batch true. Replays deny (pre-batch is already true), and a
59
+ // solo write denies (getAfter == get, so false != true).
60
+ export function consumedFlag(before, after, flagField) {
61
+ return before[flagField] == false && after[flagField] == true;
62
+ }
63
+ `,
64
+ auth: `export function isAuthenticated() {
65
+ return request.auth != null;
66
+ }
67
+
68
+ export function isOwner(userId) {
69
+ return isAuthenticated() && request.auth.uid == userId;
70
+ }
71
+ `,
72
+ content: `// Content module for author-owned documents — the most common
73
+ // Firebase app shape (posts, notes, docs, comments, tasks).
74
+ //
75
+ // Convention: documents carry an author field (a UID string) and
76
+ // usually a status field ('draft' | 'published' | ...). Field names
77
+ // are parameters, not conventions — pass yours.
78
+ //
79
+ // Usage:
80
+ // import { validAuthorCreate, isAuthor, canReadContent, notDeleted } from 'content';
81
+ // import { onlyFieldsChanged } from 'lifecycle';
82
+ //
83
+ // match /posts/{postId} {
84
+ // // Create: author is the signed-in user.
85
+ // allow create: if validAuthorCreate('author');
86
+ // // Read: published to everyone, drafts to the author only.
87
+ // allow read: if canReadContent('status', 'author') && notDeleted();
88
+ // // Update: author edits content fields; authorship immutable.
89
+ // allow update: if isAuthor('author') && onlyFieldsChanged(['title', 'body', 'status']);
90
+ // allow delete: if isAuthor('author');
91
+ // }
92
+
93
+ // Create guard: signed in, and the incoming doc's author field is the
94
+ // caller. Use on \`create\` (reads request.resource).
95
+ export function validAuthorCreate(authorField) {
96
+ return request.auth != null
97
+ && request.resource.data[authorField] == request.auth.uid;
98
+ }
99
+
100
+ // The caller is the EXISTING document's author. Use on update/delete
101
+ // (reads resource).
102
+ export function isAuthor(authorField) {
103
+ return request.auth != null
104
+ && resource.data[authorField] == request.auth.uid;
105
+ }
106
+
107
+ // Read visibility: published content is public; anything else is
108
+ // visible to its author only. Works for get; for list queries the
109
+ // client must filter (rules are not filters — a bare collection query
110
+ // will be denied unless it proves status == 'published').
111
+ export function canReadContent(statusField, authorField) {
112
+ return resource.data[statusField] == 'published'
113
+ || (request.auth != null && resource.data[authorField] == request.auth.uid);
114
+ }
115
+
116
+ // Soft-delete guard: the document is not marked deleted. Reads the
117
+ // EXISTING doc; a doc without the field passes — bracket access is
118
+ // the null-on-miss idiom (dotted access of a missing key ERRORS).
119
+ export function notDeleted() {
120
+ return resource.data['deleted'] != true;
121
+ }
122
+ `,
123
+ counters: `// Counters module for denormalized numeric integrity.
124
+ //
125
+ // The recurring shape: a client-maintained count (likes, votes, moves,
126
+ // quantities) that rules must keep honest — it may only change by a
127
+ // known step, or stay within known bounds. Generalizes the
128
+ // state-module's moveIncremented() (hardcoded to moveCount) to any
129
+ // field.
130
+ //
131
+ // Usage:
132
+ // import { incrementedBy, changedBy, boundedNumber } from 'counters';
133
+ //
134
+ // // A like toggle: likeCount moves by exactly ±1:
135
+ // allow update: if changedBy('likeCount', -1, 1);
136
+ //
137
+ // // A move counter: strictly +1 per move:
138
+ // allow update: if incrementedBy('moveCount', 1);
139
+ //
140
+ // // A rating: any write keeps it in [1, 5]:
141
+ // allow write: if boundedNumber('rating', 1, 5);
142
+
143
+ // The field changed by EXACTLY n relative to the existing document.
144
+ // n may be negative (decrement). Update rules only (needs resource).
145
+ export function incrementedBy(field, n) {
146
+ return request.resource.data[field] == resource.data[field] + n;
147
+ }
148
+
149
+ // The field's delta is within [min, max] (inclusive) — and it is NOT
150
+ // required to change (delta 0 passes when min <= 0 <= max).
151
+ export function changedBy(field, min, max) {
152
+ return request.resource.data[field] - resource.data[field] >= min
153
+ && request.resource.data[field] - resource.data[field] <= max;
154
+ }
155
+
156
+ // The incoming value is a number within [min, max] (inclusive).
157
+ // Works on create and update. Missing field reads null (dynamic
158
+ // access) and fails the type check rather than erroring.
159
+ export function boundedNumber(field, min, max) {
160
+ return (request.resource.data[field] is int || request.resource.data[field] is float)
161
+ && request.resource.data[field] >= min
162
+ && request.resource.data[field] <= max;
163
+ }
164
+ `,
165
+ geometry: `// Geometry module for movement game validation via config document lookup.
166
+ //
167
+ // Caller must pass the config document data as an explicit parameter.
168
+ // The config doc is read via get() and cached per request — define a
169
+ // config() function in your rules and pass its result to these functions.
170
+ //
171
+ // Config doc schema:
172
+ // moves[pieceType][fromCell][toCell] = true
173
+ // jumps[pieceType][fromCell][toCell] = capturedCellName
174
+ //
175
+ // Usage:
176
+ // import { validSimpleMove, validJumpMove } from 'geometry';
177
+ //
178
+ // function config() {
179
+ // return get(/databases/$(database)/documents/gameConfig/checkers).data;
180
+ // }
181
+ //
182
+ // allow update: if validSimpleMove(config())
183
+ // && piecePlaced() && moveIntegrity();
184
+ //
185
+ // allow update: if validJumpMove(config())
186
+ // && captureValid() && captureDecrement() && moveIntegrity();
187
+
188
+ // Validate a simple (non-capture) move via config document lookup.
189
+ // Uses 3-level dynamic nesting: cfg.moves[piece][from][to].
190
+ // piece comes from resource.data (pre-write board) so client can't fake it.
191
+ export function validSimpleMove(cfg) {
192
+ let mf = request.resource.data.moveFrom;
193
+ let mt = request.resource.data.moveTo;
194
+ let piece = resource.data[mf];
195
+ return cfg.moves[piece][mf][mt] == true;
196
+ }
197
+
198
+ // Validate a jump (capture) move via config document lookup.
199
+ // cfg.jumps[piece][from][to] returns the expected captured cell name.
200
+ // Caller must separately verify the captured piece is an opponent piece.
201
+ export function validJumpMove(cfg) {
202
+ let mf = request.resource.data.moveFrom;
203
+ let mt = request.resource.data.moveTo;
204
+ let cap = request.resource.data.captured;
205
+ let piece = resource.data[mf];
206
+ return cfg.jumps[piece][mf][mt] == cap;
207
+ }
208
+ `,
209
+ joining: `// Joining module — how membership CHANGES, safely. The connective
210
+ // tissue between content/spaces: spaces gates children behind a
211
+ // members field; joining lets users enter and leave that field
212
+ // WITHOUT an admin backend, with no privilege escalation.
213
+ //
214
+ // Convention: a MAP-shaped members field (uid -> role) on the parent
215
+ // doc. Compose with lifecycle's onlyFieldsChanged so a join/leave
216
+ // write can't touch anything else:
217
+ //
218
+ // import { onlyAddedSelf, onlyRemovedSelf } from 'joining';
219
+ // import { onlyFieldsChanged } from 'lifecycle';
220
+ // import { isSpaceMember, hasSpaceRole } from 'spaces';
221
+ //
222
+ // match /teams/{teamId} {
223
+ // allow read: if isSpaceMember(resource.data);
224
+ //
225
+ // // Open self-service join (public team) at a fixed role, and
226
+ // // self-service leave — nothing else about the doc may change:
227
+ // allow update: if onlyFieldsChanged(['members'])
228
+ // && (onlyAddedSelf('members', 'editor') || onlyRemovedSelf('members'));
229
+ // // Admins manage the doc freely:
230
+ // allow update: if hasSpaceRole(resource.data, 'admin');
231
+ // }
232
+ //
233
+ // Every guarantee here is production-verified against the live Rules Test API:
234
+ // the field-level map diff is reliable; the empty no-op diff DENIES (set
235
+ // equality, not hasOnly — hasOnly on an empty set passes); role escalation via
236
+ // CHANGING an existing entry denies; adding or removing anyone else denies.
237
+
238
+ // The write adds EXACTLY the caller to the members map, at EXACTLY
239
+ // \`role\`, changing and removing nobody. Update rules only.
240
+ export function onlyAddedSelf(membersField, role) {
241
+ let diff = request.resource.data[membersField].diff(resource.data[membersField]);
242
+ return request.auth != null
243
+ && diff.addedKeys() == [request.auth.uid].toSet()
244
+ && diff.changedKeys().size() == 0
245
+ && diff.removedKeys().size() == 0
246
+ && request.resource.data[membersField][request.auth.uid] == role;
247
+ }
248
+
249
+ // The write removes EXACTLY the caller from the members map, adding
250
+ // and changing nobody. Self-service leave. Update rules only.
251
+ export function onlyRemovedSelf(membersField) {
252
+ let diff = request.resource.data[membersField].diff(resource.data[membersField]);
253
+ return request.auth != null
254
+ && diff.removedKeys() == [request.auth.uid].toSet()
255
+ && diff.addedKeys().size() == 0
256
+ && diff.changedKeys().size() == 0;
257
+ }
258
+ `,
259
+ lifecycle: `// Lifecycle module for field immutability and timestamp enforcement.
260
+ //
261
+ // Common pattern: certain fields must never change after document creation
262
+ // (createdBy, createdAt, authorId).
263
+ //
264
+ // Usage:
265
+ // import { fieldUnchanged, immutableFields, isServerTimestamp } from 'lifecycle';
266
+ //
267
+ // // Single field:
268
+ // allow update: if fieldUnchanged('createdBy');
269
+ //
270
+ // // Multiple fields (replaces chained fieldUnchanged calls):
271
+ // allow update: if immutableFields(['createdBy', 'createdAt', 'authorId']);
272
+ //
273
+ // // The dual: users may edit title/body but NOTHING else:
274
+ // allow update: if onlyFieldsChanged(['title', 'body']);
275
+ //
276
+ // allow create: if isServerTimestamp('createdAt');
277
+
278
+ // Ensure a field's value is identical between existing and incoming document.
279
+ // Use on update rules to enforce immutability.
280
+ export function fieldUnchanged(field) {
281
+ return resource.data[field] == request.resource.data[field];
282
+ }
283
+
284
+ // Ensure multiple fields are unchanged between existing and incoming document.
285
+ // Uses MapDiff — one expression instead of N chained fieldUnchanged() calls.
286
+ export function immutableFields(fields) {
287
+ return request.resource.data.diff(resource.data).unchangedKeys().hasAll(fields);
288
+ }
289
+
290
+ // Ensure a field is set to the server timestamp.
291
+ // Use on create or update rules to enforce server-side time.
292
+ export function isServerTimestamp(field) {
293
+ return request.resource.data[field] == request.time;
294
+ }
295
+
296
+ // The dual of immutableFields: every changed field is in the allowed
297
+ // list (fields NOT listed are implicitly immutable). Top-level keys
298
+ // only — nested-map diffs are unreliable in production; flatten the
299
+ // schema instead of reaching for a nested diff.
300
+ export function onlyFieldsChanged(fields) {
301
+ return request.resource.data.diff(resource.data).affectedKeys().hasOnly(fields);
302
+ }
303
+
304
+ // Exactly n top-level fields changed in this write. n == 1 is the
305
+ // board-integrity / edit-one-field-per-write guard (Pattern 5,
306
+ // generalized beyond games).
307
+ export function nFieldsChanged(n) {
308
+ return request.resource.data.diff(resource.data).affectedKeys().size() == n;
309
+ }
310
+ `,
311
+ lobby: `// Lobby module for 2-participant coordination.
312
+ //
313
+ // Convention: documents must have these fields:
314
+ // host: string (creator's UID)
315
+ // guest: string ('' when waiting, joiner's UID when joined)
316
+ // status: 'waiting' | 'playing' | 'ready' (or any active state)
317
+ //
318
+ // Usage:
319
+ // import { validCreate, validJoin, canCancel } from 'lobby';
320
+ //
321
+ // allow create: if validCreate();
322
+ // allow update: if validJoin();
323
+ // allow delete: if canCancel();
324
+
325
+ // Is this a waiting lobby with an open seat?
326
+ function isWaiting() {
327
+ return resource.data.status == 'waiting'
328
+ && resource.data.guest == '';
329
+ }
330
+
331
+ // Create: caller is host, seat empty, status waiting
332
+ export function validCreate() {
333
+ return request.auth != null
334
+ && request.resource.data.host == request.auth.uid
335
+ && request.resource.data.guest == ''
336
+ && request.resource.data.status == 'waiting';
337
+ }
338
+
339
+ // Join: fill empty seat, transition to next status, no self-join
340
+ export function validJoin() {
341
+ return request.auth != null
342
+ && isWaiting()
343
+ && request.resource.data.guest == request.auth.uid
344
+ && request.auth.uid != resource.data.host
345
+ && request.resource.data.status == 'playing'
346
+ && request.resource.data.host == resource.data.host;
347
+ }
348
+
349
+ // Cancel: only host, only while waiting
350
+ export function canCancel() {
351
+ return request.auth != null
352
+ && resource.data.status == 'waiting'
353
+ && request.auth.uid == resource.data.host;
354
+ }
355
+ `,
356
+ membership: `// Membership module for role-based and claims-based access control.
357
+ //
358
+ // Two access patterns:
359
+ // 1. Custom claims on auth token (0 get() calls, set server-side)
360
+ // 2. Member maps on documents (0 get() calls on the doc itself)
361
+ //
362
+ // Usage:
363
+ // import { hasClaim, hasClaimRole, isMemberOf, hasRole } from 'membership';
364
+ //
365
+ // // Workspace access via custom claims
366
+ // allow read: if hasClaim('workspace_id');
367
+ // allow write: if hasClaimRole('workspace_role', 'admin');
368
+ //
369
+ // // Project access via member map on document
370
+ // allow read: if isMemberOf(resource.data.members);
371
+ // allow update: if hasRole(resource.data.members, 'admin');
372
+
373
+ // Check if the auth token has a non-null value for a claim key.
374
+ export function hasClaim(claim) {
375
+ return request.auth != null
376
+ && request.auth.token[claim] != null;
377
+ }
378
+
379
+ // Check if the auth token has a specific value for a claim key.
380
+ export function hasClaimRole(claim, role) {
381
+ return request.auth != null
382
+ && request.auth.token[claim] == role;
383
+ }
384
+
385
+ // Check if the caller's UID exists as a key in a members map.
386
+ export function isMemberOf(membersMap) {
387
+ return request.auth != null
388
+ && request.auth.uid in membersMap;
389
+ }
390
+
391
+ // Check if the caller has a specific role in a members map.
392
+ export function hasRole(membersMap, role) {
393
+ return request.auth != null
394
+ && membersMap[request.auth.uid] == role;
395
+ }
396
+ `,
397
+ spaces: `// Spaces module — cross-document membership gating for shared spaces
398
+ // (teams, rooms, groups, projects, parties). The second-most-common
399
+ // app shape after author-owned content: a PARENT document defines who
400
+ // may touch its children.
401
+ //
402
+ // Explicit-param design (like geometry): the caller reads the parent
403
+ // doc ONCE via a helper and passes its data in. Define the helper in
404
+ // your rules — get() is cached per request, so every function below
405
+ // can share one read (of the 10-get budget):
406
+ //
407
+ // import { isSpaceMember, hasSpaceRole, validMemberCreate } from 'spaces';
408
+ //
409
+ // match /spaces/{spaceId}/tasks/{taskId} {
410
+ // function space() {
411
+ // return get(/databases/$(database)/documents/spaces/$(spaceId)).data;
412
+ // }
413
+ // allow read: if isSpaceMember(space());
414
+ // allow create: if validMemberCreate(space(), 'author');
415
+ // allow delete: if hasSpaceRole(space(), 'admin');
416
+ // }
417
+ //
418
+ // Members field shapes verified against the production engine:
419
+ // list: members: ['uidA', 'uidB'] → isSpaceMember only
420
+ // map: members: { uidA: 'admin', ... } → isSpaceMember + hasSpaceRole
421
+ // A missing members field, a non-member uid, or a missing parent doc
422
+ // (get() of a missing doc errors) all fail CLOSED.
423
+
424
+ // The caller is in the space's members field. \`in\` covers both
425
+ // shapes: list membership and map keys.
426
+ export function isSpaceMember(spaceData) {
427
+ return request.auth != null && request.auth.uid in spaceData.members;
428
+ }
429
+
430
+ // The caller's role in a MAP-shaped members field equals \`role\`.
431
+ // List-shaped members carry no roles — this denies on them.
432
+ export function hasSpaceRole(spaceData, role) {
433
+ return request.auth != null && spaceData.members[request.auth.uid] == role;
434
+ }
435
+
436
+ // Member-gated authored create: the caller is a member AND the
437
+ // incoming child doc's author field is the caller. The "post a
438
+ // message / add a task" guard.
439
+ export function validMemberCreate(spaceData, authorField) {
440
+ return isSpaceMember(spaceData)
441
+ && request.resource.data[authorField] == request.auth.uid;
442
+ }
443
+ `,
444
+ state: `// Game state machine helpers.
445
+ //
446
+ // Convention: documents must have these fields:
447
+ // status: 'waiting' | 'playing' | 'won' | 'draw'
448
+ // moveCount: number
449
+ // host: string (UID)
450
+ // guest: string (UID)
451
+ //
452
+ // Usage:
453
+ // import { isPlaying, moveIncremented, participantsUnchanged } from 'state';
454
+ //
455
+ // allow update: if isPlaying() && moveIncremented() && participantsUnchanged();
456
+
457
+ // Is the game actively in play?
458
+ export function isPlaying() {
459
+ return resource.data.status == 'playing';
460
+ }
461
+
462
+ // Did moveCount increment by exactly 1?
463
+ export function moveIncremented() {
464
+ return request.resource.data.moveCount == resource.data.moveCount + 1;
465
+ }
466
+
467
+ // Are host and guest unchanged? (prevents mid-game identity swap)
468
+ export function participantsUnchanged() {
469
+ return request.resource.data.host == resource.data.host
470
+ && request.resource.data.guest == resource.data.guest;
471
+ }
472
+ `,
473
+ timing: `// Timing module for cooldown / rate-limit enforcement.
474
+ //
475
+ // Rules CAN rate-limit (contrary to a common assumption — jrpg
476
+ // FINDINGS F-004): compare request.time against a stored server
477
+ // timestamp. Pair with lifecycle's isServerTimestamp on the SAME
478
+ // write so the stored timestamp cannot be forged by the client:
479
+ //
480
+ // import { cooldownElapsed } from 'timing';
481
+ // import { isServerTimestamp } from 'lifecycle';
482
+ //
483
+ // // At most one move every 2 seconds:
484
+ // allow update: if cooldownElapsed('lastMoveAt', 2)
485
+ // && isServerTimestamp('lastMoveAt');
486
+
487
+ // The stored timestamp is more than \`seconds\` old (strict). Update
488
+ // rules only — needs \`resource\`. The field must be a Timestamp; a
489
+ // missing field errors, which denies (fail-closed).
490
+ export function cooldownElapsed(field, seconds) {
491
+ return request.time > resource.data[field] + duration.value(seconds, 's');
492
+ }
493
+ `,
494
+ transitions: `// Transitions module for state machine enforcement.
495
+ //
496
+ // Validates that a field transitions from one known value to another.
497
+ // Use to enforce valid status flows (e.g., open -> in_progress -> completed).
498
+ //
499
+ // Usage:
500
+ // import { validTransition, statusIs, newStatusIs } from 'transitions';
501
+ //
502
+ // // Only allow open -> in_progress
503
+ // allow update: if validTransition('status', 'open', 'in_progress');
504
+ //
505
+ // // Allow update only when currently active
506
+ // allow update: if statusIs('status', 'active');
507
+ //
508
+ // // Compound: multiple valid transitions via OR
509
+ // allow update: if validTransition('status', 'open', 'in_progress')
510
+ // || validTransition('status', 'in_progress', 'completed')
511
+ // || validTransition('status', 'completed', 'archived');
512
+
513
+ // Check that a field transitions from one value to another.
514
+ export function validTransition(field, from, to) {
515
+ return resource.data[field] == from
516
+ && request.resource.data[field] == to;
517
+ }
518
+
519
+ // Check the current (existing) value of a field.
520
+ export function statusIs(field, value) {
521
+ return resource.data[field] == value;
522
+ }
523
+
524
+ // Check the incoming (new) value of a field.
525
+ export function newStatusIs(field, value) {
526
+ return request.resource.data[field] == value;
527
+ }
528
+ `,
529
+ turns: `// Turn enforcement for 2-participant games/sessions.
530
+ //
531
+ // Convention: documents must have these fields:
532
+ // host: string (UID)
533
+ // guest: string (UID)
534
+ // currentTurn: 'host' | 'guest'
535
+ //
536
+ // Usage:
537
+ // import { isMyTurn, turnFlipped } from 'turns';
538
+ //
539
+ // allow update: if isMyTurn() && turnFlipped();
540
+
541
+ // Is the caller the participant whose turn it is?
542
+ export function isMyTurn() {
543
+ return (resource.data.currentTurn == 'host'
544
+ && request.auth.uid == resource.data.host)
545
+ || (resource.data.currentTurn == 'guest'
546
+ && request.auth.uid == resource.data.guest);
547
+ }
548
+
549
+ // Did the turn alternate?
550
+ export function turnFlipped() {
551
+ return (resource.data.currentTurn == 'host'
552
+ && request.resource.data.currentTurn == 'guest')
553
+ || (resource.data.currentTurn == 'guest'
554
+ && request.resource.data.currentTurn == 'host');
555
+ }
556
+ `,
557
+ validation: `// Validation module for document field shape and value checks.
558
+ //
559
+ // Usage:
560
+ // import { hasRequired, hasOnly, validString, isOneOf } from 'validation';
561
+ //
562
+ // allow create: if hasRequired(['title', 'status'])
563
+ // && validString('title', 1, 100)
564
+ // && isOneOf('status', ['draft', 'published']);
565
+
566
+ export function hasRequired(fields) {
567
+ return request.resource.data.keys().hasAll(fields);
568
+ }
569
+
570
+ export function hasOnly(fields) {
571
+ return request.resource.data.keys().hasOnly(fields);
572
+ }
573
+
574
+ // Incoming field is a string with size in [min, max] (inclusive).
575
+ // Uses dynamic access, so a MISSING field reads as null (not an
576
+ // error) and fails the \`is string\` check — safe on optional fields.
577
+ export function validString(field, min, max) {
578
+ return request.resource.data[field] is string
579
+ && request.resource.data[field].size() >= min
580
+ && request.resource.data[field].size() <= max;
581
+ }
582
+
583
+ // Enum check: the incoming field value is one of the allowed values.
584
+ // (\`in\` on a list — NOT \`.includes()\`, which does not exist in rules.)
585
+ export function isOneOf(field, values) {
586
+ return request.resource.data[field] in values;
587
+ }
588
+ `,
589
+ };
590
+ //# sourceMappingURL=stdlib-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdlib-content.js","sourceRoot":"","sources":["../../../src/rules/modules/stdlib-content.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,aAAa,GAA2B;IACnD,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDT;IACC,IAAI,EAAE;;;;;;;CAOP;IACC,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDV;IACC,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCX;IACC,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CX;IACC,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDV;IACC,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDZ;IACC,KAAK,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CR;IACC,UAAU,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCb;IACC,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CT;IACC,KAAK,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BR;IACC,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;CAoBT;IACC,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCd;IACC,KAAK,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BR;IACC,UAAU,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Bb;CACA,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Node-only entry point.
3
+ *
4
+ * Anything that imports `node:fs` / `node:path` / `node:url` at
5
+ * module-init lives here, so the browser-facing root entry stays
6
+ * free of Node builtins. Consumers running in Node (admin tools,
7
+ * SDK agent definitions, tests) import from `pyric/rules/node`.
8
+ *
9
+ * Today the only Node-only surface is the modules resolver — it
10
+ * reads stdlib files off disk via `readFileSync`.
11
+ */
12
+ export { resolveModules, sanitizeModuleName, loadModule, prefixPrivateFunctions, rewriteCalls, } from './modules/resolver.js';
13
+ export type { ResolveResult, ResolveOptions } from './modules/resolver.js';
14
+ export { createFirestoreRulesTools, createFirestoreSimulatorTools, } from './tools.js';
15
+ export type { FirestoreRulesToolDeps, FirestoreSimulatorToolDeps, } from './tools.js';
16
+ export { createFirestoreRulesStdlibTools } from './stdlib-tools.js';
17
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/rules/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EACtB,YAAY,GACb,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAK3E,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Node-only entry point.
3
+ *
4
+ * Anything that imports `node:fs` / `node:path` / `node:url` at
5
+ * module-init lives here, so the browser-facing root entry stays
6
+ * free of Node builtins. Consumers running in Node (admin tools,
7
+ * SDK agent definitions, tests) import from `pyric/rules/node`.
8
+ *
9
+ * Today the only Node-only surface is the modules resolver — it
10
+ * reads stdlib files off disk via `readFileSync`.
11
+ */
12
+ export { resolveModules, sanitizeModuleName, loadModule, prefixPrivateFunctions, rewriteCalls, } from './modules/resolver.js';
13
+ // Tool factories — `createFirestoreRulesTools` wraps resolver +
14
+ // linter + simulator + test handlers into agent-runtime tools.
15
+ // Lives on /node because the resolver dep is Node-only.
16
+ export { createFirestoreRulesTools, createFirestoreSimulatorTools, } from './tools.js';
17
+ // Stdlib discovery tools — `firestore_rules_stdlib_list` +
18
+ // `firestore_rules_stdlib_get`. Live on /node because the stdlib
19
+ // modules ship as files the resolver loads from disk.
20
+ export { createFirestoreRulesStdlibTools } from './stdlib-tools.js';
21
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/rules/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EACtB,YAAY,GACb,MAAM,uBAAuB,CAAC;AAG/B,gEAAgE;AAChE,+DAA+D;AAC/D,wDAAwD;AACxD,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,YAAY,CAAC;AAMpB,2DAA2D;AAC3D,iEAAiE;AACjE,sDAAsD;AACtD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * RTDB rules tooling facade.
3
+ *
4
+ * Firestore rules live under `pyric/rules`; this subpath gives
5
+ * Realtime Database rules the same first-class packaging without
6
+ * moving the existing implementation out of `pyric/database`.
7
+ */
8
+ export type { RtdbHost } from '../database/host.js';
9
+ export { fetchDatabase } from '../database/host.js';
10
+ export { createRtdbRulesTools, type RtdbRulesToolDeps, } from '../database/tools.js';
11
+ export { getRtdbTools } from '../database/resolver.js';
12
+ export { buildRuleExpression, RtdbMapper, } from '../database/mapper.js';
13
+ export { parseExpression } from '../database/grammar/RtdbExprParser.js';
14
+ export { validateExpression } from '../database/grammar/validator.js';
15
+ export { lintExpression } from '../database/grammar/linter.js';
16
+ export { GenerateIRInputSchema, RtdbIRErrorCode, } from '../database/ir/spec.js';
17
+ export type { GenerateIRInput, GenerateIRResult, GenerateIRSpec, } from '../database/ir/spec.js';
18
+ export { GenerateIRHandler } from '../database/ir/handler.js';
19
+ export { SimulationInputSchema, SimulateErrorCode, SimulationResultSchema, } from '../database/simulation/spec.js';
20
+ export type { SimulationInput, SimulationResult, SimulateResult, } from '../database/simulation/spec.js';
21
+ export { SimulateHandler } from '../database/simulation/handler.js';
22
+ export { WriteRulesErrorCode } from '../database/write/spec.js';
23
+ export type { WriteRulesResult, WriteRulesSpec, } from '../database/write/spec.js';
24
+ export { WriteRulesHandler } from '../database/write/handler.js';
25
+ export type { ParsedExpression, ParsedExpression as RtdbExpressionParseResult, RtdbIR, RtdbNode, RtdbRuleExpression, RtdbTools, RuleError, RuleLint, UserAuth, } from '../database/types.js';
26
+ export { expr, all, any, not, deny, always, allow, authenticated, ownPath, ownField, isNew, hasChildren, hasChild, fieldIsString, fieldIsNumber, fieldIsBoolean, fieldEnum, immutable, immutableSelf, rootExists, rootEquals, pathOwnerOnly, fieldOwnerOnly, ownerOrNew, hasRole, isMember, required, transition, dataVal, newDataVal, dataExists, newDataExists, newDataIs, dataParentVal, newDataParentVal, newDataParentExists, eq, neq, gt, lte, AUTH_UID, turnGuard, flip, winCheckHelper, schemaRules, ruleset, defineRtdbRules, } from '../database/constraints/index.js';
27
+ export type { Expr, PathDef, RtdbRulesCheckResult, RtdbRulesDefinition, RtdbRulesDocument, RtdbRulesFinding, RtdbRulesFindingRule, RtdbRulesJson, RtdbRulesSimulationAuth, RtdbRulesSimulationInput, RulesetContext, SchemaRulesResult, Segment, } from '../database/constraints/index.js';
28
+ //# sourceMappingURL=rtdb.d.ts.map