@pyric/cli 0.1.0-alpha.13 → 0.1.0-alpha.15

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 (614) hide show
  1. package/dist/assurance/.generated/conformance-verdicts.d.ts +120 -75
  2. package/dist/assurance/.generated/conformance-verdicts.d.ts.map +1 -1
  3. package/dist/assurance/.generated/conformance-verdicts.js +120 -75
  4. package/dist/assurance/.generated/conformance-verdicts.js.map +1 -1
  5. package/dist/cli/serve.d.ts +1 -1
  6. package/dist/cli/serve.d.ts.map +1 -1
  7. package/dist/cli/serve.js +208 -285
  8. package/dist/cli/serve.js.map +1 -1
  9. package/dist/cli/service-command-records/database-rules-generate.d.ts +4 -0
  10. package/dist/cli/service-command-records/database-rules-generate.d.ts.map +1 -0
  11. package/dist/cli/service-command-records/database-rules-generate.js +3 -0
  12. package/dist/cli/service-command-records/database-rules-generate.js.map +1 -0
  13. package/dist/cli/service-command-records/database-rules-lint.d.ts +4 -0
  14. package/dist/cli/service-command-records/database-rules-lint.d.ts.map +1 -0
  15. package/dist/cli/service-command-records/database-rules-lint.js +3 -0
  16. package/dist/cli/service-command-records/database-rules-lint.js.map +1 -0
  17. package/dist/cli/service-command-records/database-rules-simulate.d.ts +4 -0
  18. package/dist/cli/service-command-records/database-rules-simulate.d.ts.map +1 -0
  19. package/dist/cli/service-command-records/database-rules-simulate.js +3 -0
  20. package/dist/cli/service-command-records/database-rules-simulate.js.map +1 -0
  21. package/dist/cli/service-command-records/database-rules-validate.d.ts +4 -0
  22. package/dist/cli/service-command-records/database-rules-validate.d.ts.map +1 -0
  23. package/dist/cli/service-command-records/database-rules-validate.js +3 -0
  24. package/dist/cli/service-command-records/database-rules-validate.js.map +1 -0
  25. package/dist/cli/service-command-records/firestore-indexes-generate.d.ts +4 -0
  26. package/dist/cli/service-command-records/firestore-indexes-generate.d.ts.map +1 -0
  27. package/dist/cli/service-command-records/firestore-indexes-generate.js +3 -0
  28. package/dist/cli/service-command-records/firestore-indexes-generate.js.map +1 -0
  29. package/dist/cli/service-command-records/firestore-rules-lint.d.ts +4 -0
  30. package/dist/cli/service-command-records/firestore-rules-lint.d.ts.map +1 -0
  31. package/dist/cli/service-command-records/firestore-rules-lint.js +3 -0
  32. package/dist/cli/service-command-records/firestore-rules-lint.js.map +1 -0
  33. package/dist/cli/service-command-records/firestore-rules-resolve.d.ts +4 -0
  34. package/dist/cli/service-command-records/firestore-rules-resolve.d.ts.map +1 -0
  35. package/dist/cli/service-command-records/firestore-rules-resolve.js +3 -0
  36. package/dist/cli/service-command-records/firestore-rules-resolve.js.map +1 -0
  37. package/dist/cli/service-command-records/firestore-rules-simulate.d.ts +4 -0
  38. package/dist/cli/service-command-records/firestore-rules-simulate.d.ts.map +1 -0
  39. package/dist/cli/service-command-records/firestore-rules-simulate.js +3 -0
  40. package/dist/cli/service-command-records/firestore-rules-simulate.js.map +1 -0
  41. package/dist/cli/service-command-records/firestore-rules-validate.d.ts +4 -0
  42. package/dist/cli/service-command-records/firestore-rules-validate.d.ts.map +1 -0
  43. package/dist/cli/service-command-records/firestore-rules-validate.js +3 -0
  44. package/dist/cli/service-command-records/firestore-rules-validate.js.map +1 -0
  45. package/dist/cli/service-command-records/storage-rules-lint.d.ts +4 -0
  46. package/dist/cli/service-command-records/storage-rules-lint.d.ts.map +1 -0
  47. package/dist/cli/service-command-records/storage-rules-lint.js +3 -0
  48. package/dist/cli/service-command-records/storage-rules-lint.js.map +1 -0
  49. package/dist/cli/service-command-records/storage-rules-simulate.d.ts +4 -0
  50. package/dist/cli/service-command-records/storage-rules-simulate.d.ts.map +1 -0
  51. package/dist/cli/service-command-records/storage-rules-simulate.js +3 -0
  52. package/dist/cli/service-command-records/storage-rules-simulate.js.map +1 -0
  53. package/dist/cli/service-commands.d.ts +7 -0
  54. package/dist/cli/service-commands.d.ts.map +1 -1
  55. package/dist/cli/service-commands.generated.d.ts +35 -0
  56. package/dist/cli/service-commands.generated.d.ts.map +1 -0
  57. package/dist/cli/service-commands.generated.js +25 -0
  58. package/dist/cli/service-commands.generated.js.map +1 -0
  59. package/dist/cli/service-commands.js +23 -40
  60. package/dist/cli/service-commands.js.map +1 -1
  61. package/dist/conformance/.generated/can-i-use-browser.d.ts.map +1 -1
  62. package/dist/conformance/.generated/can-i-use-browser.js +1 -1
  63. package/dist/conformance/.generated/can-i-use-browser.js.map +1 -1
  64. package/dist/conformance/.generated/can-i-use.d.ts.map +1 -1
  65. package/dist/conformance/.generated/can-i-use.js +1 -1
  66. package/dist/conformance/.generated/can-i-use.js.map +1 -1
  67. package/dist/conformance/.generated/conformance-docs.d.ts.map +1 -1
  68. package/dist/conformance/.generated/conformance-docs.js +1 -1
  69. package/dist/conformance/.generated/conformance-docs.js.map +1 -1
  70. package/dist/functions-rtdb/development-runtime.d.ts +63 -0
  71. package/dist/functions-rtdb/development-runtime.d.ts.map +1 -0
  72. package/dist/functions-rtdb/development-runtime.js +244 -0
  73. package/dist/functions-rtdb/development-runtime.js.map +1 -0
  74. package/dist/serve/bridge-mount.d.ts +32 -2
  75. package/dist/serve/bridge-mount.d.ts.map +1 -1
  76. package/dist/serve/bridge-mount.js +232 -18
  77. package/dist/serve/bridge-mount.js.map +1 -1
  78. package/dist/serve/bundler.d.ts +4 -18
  79. package/dist/serve/bundler.d.ts.map +1 -1
  80. package/dist/serve/bundler.js +15 -37
  81. package/dist/serve/bundler.js.map +1 -1
  82. package/dist/serve/entries/app-client.d.ts.map +1 -1
  83. package/dist/serve/entries/app-client.js +5 -5
  84. package/dist/serve/entries/app-client.js.map +1 -1
  85. package/dist/serve/entries/auth-helper-core.d.ts +23 -6
  86. package/dist/serve/entries/auth-helper-core.d.ts.map +1 -1
  87. package/dist/serve/entries/auth-helper-core.js +55 -24
  88. package/dist/serve/entries/auth-helper-core.js.map +1 -1
  89. package/dist/serve/entries/database.d.ts +28 -0
  90. package/dist/serve/entries/database.d.ts.map +1 -1
  91. package/dist/serve/entries/database.js +95 -26
  92. package/dist/serve/entries/database.js.map +1 -1
  93. package/dist/serve/entries/init.d.ts.map +1 -1
  94. package/dist/serve/entries/init.js +21 -12
  95. package/dist/serve/entries/init.js.map +1 -1
  96. package/dist/serve/html-injection.d.ts +5 -0
  97. package/dist/serve/html-injection.d.ts.map +1 -0
  98. package/dist/serve/html-injection.js +59 -0
  99. package/dist/serve/html-injection.js.map +1 -0
  100. package/dist/serve/namespace.d.ts +6 -22
  101. package/dist/serve/namespace.d.ts.map +1 -1
  102. package/dist/serve/namespace.js +23 -145
  103. package/dist/serve/namespace.js.map +1 -1
  104. package/dist/serve/runtime/worker-generation.d.ts +10 -2
  105. package/dist/serve/runtime/worker-generation.d.ts.map +1 -1
  106. package/dist/serve/runtime/worker-generation.js +29 -8
  107. package/dist/serve/runtime/worker-generation.js.map +1 -1
  108. package/dist/serve/runtime/worker-replacement.d.ts +1 -2
  109. package/dist/serve/runtime/worker-replacement.d.ts.map +1 -1
  110. package/dist/serve/sandbox-session.d.ts +78 -0
  111. package/dist/serve/sandbox-session.d.ts.map +1 -0
  112. package/dist/serve/sandbox-session.js +171 -0
  113. package/dist/serve/sandbox-session.js.map +1 -0
  114. package/dist/serve/server.d.ts +5 -2
  115. package/dist/serve/server.d.ts.map +1 -1
  116. package/dist/serve/server.js +21 -5
  117. package/dist/serve/server.js.map +1 -1
  118. package/dist/serve/site-tree.d.ts +8 -0
  119. package/dist/serve/site-tree.d.ts.map +1 -0
  120. package/dist/serve/site-tree.js +113 -0
  121. package/dist/serve/site-tree.js.map +1 -0
  122. package/dist/serve/site-ui/_astro/RulesCodeEditor.CzwHdCi9.js +23 -0
  123. package/dist/serve/site-ui/_astro/_example_.jevZ7OdV.css +1 -0
  124. package/dist/serve/site-ui/_astro/_slug_.BoKXYrnu.css +1 -0
  125. package/dist/serve/site-ui/_astro/_studio_.BtYpqe1A.css +1 -0
  126. package/dist/serve/site-ui/_astro/app.BnMC0ywl.js +109 -0
  127. package/dist/serve/site-ui/_astro/app.BsFsMjn0.css +1 -0
  128. package/dist/serve/site-ui/_astro/app.DVXXR-WI.js +1 -0
  129. package/dist/serve/site-ui/_astro/chess-showcase.DzPO6kz0.js +1 -0
  130. package/dist/serve/site-ui/_astro/chess-source-explorer.C5k9c5yK.js +1 -0
  131. package/dist/serve/site-ui/_astro/chess-v2.CFHmd3UL.js +354 -0
  132. package/dist/serve/site-ui/_astro/client.D2ORs4B-.js +25 -0
  133. package/dist/serve/site-ui/_astro/example-runtime.CM0H02rx.js +291 -0
  134. package/dist/serve/site-ui/_astro/index.B4Kh80he.js +1 -0
  135. package/dist/serve/site-ui/_astro/index.DBy5LfQW.js +9 -0
  136. package/dist/serve/site-ui/_astro/index.DNyk7q8W.js +9 -0
  137. package/dist/serve/site-ui/_astro/jsx-runtime.D_zvdyIk.js +9 -0
  138. package/dist/serve/site-ui/_astro/reads.D1exkX1-.js +1 -0
  139. package/dist/serve/site-ui/_astro/sandbox-controls.BqMePr5V.js +1153 -0
  140. package/dist/serve/site-ui/_astro/seed.BCn5DhHS.js +20 -0
  141. package/dist/serve/site-ui/auth/index.html +11 -0
  142. package/dist/serve/site-ui/docs/_rhythm/index.html +100 -0
  143. package/dist/serve/site-ui/docs/agent/set-up-your-agent/index.html +43 -0
  144. package/dist/serve/site-ui/docs/agent/watch-and-review/index.html +26 -0
  145. package/dist/serve/site-ui/docs/agent/work-with-an-agent/index.html +70 -0
  146. package/dist/serve/{docs-ui → site-ui}/docs/ai-compat/index.html +3 -3
  147. package/dist/serve/site-ui/docs/api-reference/index.html +68 -0
  148. package/dist/serve/{docs-ui → site-ui}/docs/app-compat/index.html +3 -3
  149. package/dist/serve/{docs-ui → site-ui}/docs/auth-compat/index.html +3 -3
  150. package/dist/serve/site-ui/docs/build/ai-logic/index.html +64 -0
  151. package/dist/serve/site-ui/docs/build/authentication/index.html +66 -0
  152. package/dist/serve/site-ui/docs/build/cloud-firestore/index.html +84 -0
  153. package/dist/serve/site-ui/docs/build/cloud-messaging/index.html +71 -0
  154. package/dist/serve/site-ui/docs/build/cloud-storage/index.html +66 -0
  155. package/dist/serve/{docs-ui → site-ui}/docs/build/cloud-storage.md +2 -2
  156. package/dist/serve/site-ui/docs/build/realtime-database/index.html +67 -0
  157. package/dist/serve/site-ui/docs/conformance-scores/index.html +50 -0
  158. package/dist/serve/{docs-ui → site-ui}/docs/conformance-scores.md +3 -3
  159. package/dist/serve/site-ui/docs/create-pyric-reference-api/index.html +531 -0
  160. package/dist/serve/{docs-ui → site-ui}/docs/database-compat/index.html +211 -168
  161. package/dist/serve/{docs-ui → site-ui}/docs/database-compat.md +208 -170
  162. package/dist/serve/site-ui/docs/examples/chess/index.html +384 -0
  163. package/dist/serve/site-ui/docs/examples/chess.md +57 -0
  164. package/dist/serve/site-ui/docs/examples/index.html +3 -0
  165. package/dist/serve/site-ui/docs/examples.md +4 -0
  166. package/dist/serve/{docs-ui → site-ui}/docs/firestore-compat/index.html +55 -91
  167. package/dist/serve/{docs-ui → site-ui}/docs/firestore-compat.md +52 -88
  168. package/dist/serve/site-ui/docs/functions-rtdb-compat/index.html +73 -0
  169. package/dist/serve/site-ui/docs/get-started/how-the-swap-works/index.html +29 -0
  170. package/dist/serve/site-ui/docs/get-started/start-building/index.html +33 -0
  171. package/dist/serve/{docs-ui → site-ui}/docs/index.json +595 -26
  172. package/dist/serve/site-ui/docs/messaging-compat/index.html +324 -0
  173. package/dist/serve/{docs-ui → site-ui}/docs/messaging-compat.md +71 -1
  174. package/dist/serve/site-ui/docs/observe/resolve-runtime-status/index.html +28 -0
  175. package/dist/serve/site-ui/docs/observe/see-whats-happening/index.html +74 -0
  176. package/dist/serve/site-ui/docs/observe/shape-your-data/index.html +45 -0
  177. package/dist/serve/site-ui/docs/overview/index.html +17 -0
  178. package/dist/serve/site-ui/docs/pyric-admin-app-reference-api/index.html +186 -0
  179. package/dist/serve/{docs-ui → site-ui}/docs/pyric-admin-auth-reference-api/index.html +4 -4
  180. package/dist/serve/{docs-ui → site-ui}/docs/pyric-admin-database-reference-api/index.html +4 -4
  181. package/dist/serve/{docs-ui → site-ui}/docs/pyric-admin-firestore-reference-api/index.html +318 -202
  182. package/dist/serve/{docs-ui → site-ui}/docs/pyric-admin-firestore-reference-api.md +154 -27
  183. package/dist/serve/{docs-ui → site-ui}/docs/pyric-admin-messaging-reference-api/index.html +5 -5
  184. package/dist/serve/site-ui/docs/pyric-admin-storage-reference-api/index.html +318 -0
  185. package/dist/serve/{docs-ui → site-ui}/docs/pyric-ai-reference-api/index.html +5 -5
  186. package/dist/serve/site-ui/docs/pyric-ai-scripting-reference-api/index.html +160 -0
  187. package/dist/serve/site-ui/docs/pyric-app-reference-api/index.html +425 -0
  188. package/dist/serve/{docs-ui → site-ui}/docs/pyric-auth-reference-api/index.html +5 -5
  189. package/dist/serve/site-ui/docs/pyric-cli-assurance-browser-reference-api/index.html +60 -0
  190. package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-assurance-reference-api/index.html +4 -4
  191. package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-bridge-client-reference-api/index.html +4 -4
  192. package/dist/serve/site-ui/docs/pyric-cli-bridge-reference-api/index.html +507 -0
  193. package/dist/serve/site-ui/docs/pyric-cli-conformance-browser-reference-api/index.html +258 -0
  194. package/dist/serve/site-ui/docs/pyric-cli-conformance-docs-reference-api/index.html +51 -0
  195. package/dist/serve/site-ui/docs/pyric-cli-conformance-reference-api/index.html +308 -0
  196. package/dist/serve/site-ui/docs/pyric-cli-credentials-node-reference-api/index.html +68 -0
  197. package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-discover-reference-api/index.html +4 -4
  198. package/dist/serve/site-ui/docs/pyric-cli-register-reference-api/index.html +11 -0
  199. package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-remote-reference-api/index.html +4 -4
  200. package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-serve-worker-reference-api/index.html +1186 -1384
  201. package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-serve-worker-reference-api.md +817 -1291
  202. package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-verify-reference-api/index.html +4 -4
  203. package/dist/serve/site-ui/docs/pyric-cli-vite-reference-api/index.html +126 -0
  204. package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-vite-reference-api.md +1 -1
  205. package/dist/serve/site-ui/docs/pyric-database-reference-api/index.html +2641 -0
  206. package/dist/serve/{docs-ui → site-ui}/docs/pyric-database-reference-api.md +1055 -158
  207. package/dist/serve/{docs-ui → site-ui}/docs/pyric-firestore-reference-api/index.html +311 -249
  208. package/dist/serve/{docs-ui → site-ui}/docs/pyric-firestore-reference-api.md +72 -54
  209. package/dist/serve/site-ui/docs/pyric-messaging-reference-api/index.html +509 -0
  210. package/dist/serve/site-ui/docs/pyric-messaging-sw-reference-api/index.html +182 -0
  211. package/dist/serve/{docs-ui → site-ui}/docs/pyric-rules-reference-api/index.html +7 -26
  212. package/dist/serve/{docs-ui → site-ui}/docs/pyric-rules-reference-api.md +13 -23
  213. package/dist/serve/site-ui/docs/pyric-sandbox-database-reference-api/index.html +121 -0
  214. package/dist/serve/site-ui/docs/pyric-sandbox-firestore-reference-api/index.html +203 -0
  215. package/dist/serve/{docs-ui → site-ui}/docs/pyric-sandbox-reference-api/index.html +26 -5
  216. package/dist/serve/{docs-ui → site-ui}/docs/pyric-sandbox-reference-api.md +22 -22
  217. package/dist/serve/{docs-ui → site-ui}/docs/pyric-storage-reference-api/index.html +5 -15
  218. package/dist/serve/{docs-ui → site-ui}/docs/pyric-storage-reference-api.md +0 -13
  219. package/dist/serve/site-ui/docs/pyric-ui-agents-reference-api/index.html +639 -0
  220. package/dist/serve/site-ui/docs/pyric-ui-auth-hooks-reference-api/index.html +100 -0
  221. package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-auth-reference-api/index.html +4 -4
  222. package/dist/serve/site-ui/docs/pyric-ui-events-hooks-reference-api/index.html +24 -0
  223. package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-events-reference-api/index.html +4 -4
  224. package/dist/serve/site-ui/docs/pyric-ui-firestore-hooks-reference-api/index.html +136 -0
  225. package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-firestore-reference-api/index.html +7 -7
  226. package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-firestore-reference-api.md +4 -4
  227. package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-primitives-reference-api/index.html +4 -4
  228. package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-rtdb-reference-api/index.html +4 -4
  229. package/dist/serve/site-ui/docs/pyric-ui-rules-hooks-reference-api/index.html +16 -0
  230. package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-rules-reference-api/index.html +4 -4
  231. package/dist/serve/site-ui/docs/pyric-ui-storage-hooks-reference-api/index.html +176 -0
  232. package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-storage-reference-api/index.html +10 -11
  233. package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-storage-reference-api.md +7 -8
  234. package/dist/serve/site-ui/docs/pyric-ui-traffic-hooks-reference-api/index.html +188 -0
  235. package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-traffic-reference-api/index.html +4 -4
  236. package/dist/serve/{docs-ui → site-ui}/docs/rules-compat/index.html +87 -57
  237. package/dist/serve/{docs-ui → site-ui}/docs/rules-compat.md +84 -54
  238. package/dist/serve/site-ui/docs/secure/audit-your-rules/index.html +51 -0
  239. package/dist/serve/site-ui/docs/secure/firestore-rules-limits/index.html +106 -0
  240. package/dist/serve/site-ui/docs/secure/read-a-denial/index.html +41 -0
  241. package/dist/serve/site-ui/docs/secure/rtdb-rules-in-typescript/index.html +67 -0
  242. package/dist/serve/site-ui/docs/secure/rules-standard-library/index.html +159 -0
  243. package/dist/serve/{docs-ui → site-ui}/docs/secure/rules-standard-library.md +2 -2
  244. package/dist/serve/site-ui/docs/secure/secure-it-with-rules/index.html +47 -0
  245. package/dist/serve/site-ui/docs/secure/simulate-and-lint/index.html +95 -0
  246. package/dist/serve/site-ui/docs/secure/write-a-rules-test-suite/index.html +82 -0
  247. package/dist/serve/site-ui/docs/ship/ship-to-production/index.html +37 -0
  248. package/dist/serve/site-ui/docs/ship/test-in-node/index.html +75 -0
  249. package/dist/serve/{docs-ui → site-ui}/docs/storage-compat/index.html +8 -8
  250. package/dist/serve/{docs-ui → site-ui}/docs/storage-compat.md +5 -5
  251. package/dist/serve/site-ui/docs/trust/how-we-know-it-matches-firebase/index.html +132 -0
  252. package/dist/serve/site-ui/docs/trust/rules-standard-library/index.html +861 -0
  253. package/dist/serve/site-ui/docs/trust/rules-standard-library.md +344 -0
  254. package/dist/serve/site-ui/docs/trust/storage-rules-stdlib-research/index.html +582 -0
  255. package/dist/serve/site-ui/docs/trust/storage-rules-stdlib-research.md +448 -0
  256. package/dist/serve/site-ui/docs/trust/versioning-and-compatibility/index.html +14 -0
  257. package/dist/serve/{docs-ui → site-ui}/docs/tutorial/index.html +4 -4
  258. package/dist/serve/{docs-ui → site-ui}/docs/tutorial.md +1 -1
  259. package/dist/serve/site-ui/examples/chess/index.html +2 -0
  260. package/dist/serve/site-ui/examples/firestore-first-write/index.html +2 -0
  261. package/dist/serve/site-ui/firestore/index.html +11 -0
  262. package/dist/serve/site-ui/index.html +11 -0
  263. package/dist/serve/{docs-ui → site-ui}/llms.txt +6 -2
  264. package/dist/serve/site-ui/rtdb/index.html +11 -0
  265. package/dist/serve/site-ui/settings/index.html +11 -0
  266. package/dist/serve/site-ui/storage/index.html +11 -0
  267. package/dist/serve/site-ui/studio-routes.json +1 -0
  268. package/dist/serve/site-ui/traffic/index.html +11 -0
  269. package/dist/serve/standalone-assets.d.ts +4 -10
  270. package/dist/serve/standalone-assets.d.ts.map +1 -1
  271. package/dist/serve/standalone-assets.js +8 -21
  272. package/dist/serve/standalone-assets.js.map +1 -1
  273. package/dist/serve/vite-ai-config.d.ts +2 -0
  274. package/dist/serve/vite-ai-config.d.ts.map +1 -1
  275. package/dist/serve/vite-ai-config.js +4 -0
  276. package/dist/serve/vite-ai-config.js.map +1 -1
  277. package/dist/serve/vite-functions-development.d.ts +29 -0
  278. package/dist/serve/vite-functions-development.d.ts.map +1 -0
  279. package/dist/serve/vite-functions-development.js +150 -0
  280. package/dist/serve/vite-functions-development.js.map +1 -0
  281. package/dist/serve/vite-generation-bridge.d.ts +17 -0
  282. package/dist/serve/vite-generation-bridge.d.ts.map +1 -0
  283. package/dist/serve/vite-generation-bridge.js +47 -0
  284. package/dist/serve/vite-generation-bridge.js.map +1 -0
  285. package/dist/serve/vite-generation-functions.d.ts +35 -0
  286. package/dist/serve/vite-generation-functions.d.ts.map +1 -0
  287. package/dist/serve/vite-generation-functions.js +46 -0
  288. package/dist/serve/vite-generation-functions.js.map +1 -0
  289. package/dist/serve/vite-generation-middleware.d.ts +10 -0
  290. package/dist/serve/vite-generation-middleware.d.ts.map +1 -0
  291. package/dist/serve/vite-generation-middleware.js +40 -0
  292. package/dist/serve/vite-generation-middleware.js.map +1 -0
  293. package/dist/serve/vite-generation-rules-watch.d.ts +8 -0
  294. package/dist/serve/vite-generation-rules-watch.d.ts.map +1 -0
  295. package/dist/serve/vite-generation-rules-watch.js +33 -0
  296. package/dist/serve/vite-generation-rules-watch.js.map +1 -0
  297. package/dist/serve/vite-module-swap.d.ts +16 -0
  298. package/dist/serve/vite-module-swap.d.ts.map +1 -0
  299. package/dist/serve/vite-module-swap.js +96 -0
  300. package/dist/serve/vite-module-swap.js.map +1 -0
  301. package/dist/serve/vite-page-runtime.d.ts +29 -0
  302. package/dist/serve/vite-page-runtime.d.ts.map +1 -0
  303. package/dist/serve/vite-page-runtime.js +71 -0
  304. package/dist/serve/vite-page-runtime.js.map +1 -0
  305. package/dist/serve/vite-plugin.d.ts +44 -4
  306. package/dist/serve/vite-plugin.d.ts.map +1 -1
  307. package/dist/serve/vite-plugin.js +62 -864
  308. package/dist/serve/vite-plugin.js.map +1 -1
  309. package/dist/serve/vite-sandbox-generation.d.ts +57 -0
  310. package/dist/serve/vite-sandbox-generation.d.ts.map +1 -0
  311. package/dist/serve/vite-sandbox-generation.js +178 -0
  312. package/dist/serve/vite-sandbox-generation.js.map +1 -0
  313. package/dist/serve/vite-worker-runtime.d.ts +1 -1
  314. package/dist/serve/vite-worker-runtime.d.ts.map +1 -1
  315. package/dist/serve/vite-worker-runtime.js +8 -4
  316. package/dist/serve/vite-worker-runtime.js.map +1 -1
  317. package/dist/serve/worker/client/disconnect.d.ts.map +1 -1
  318. package/dist/serve/worker/client/disconnect.js +2 -0
  319. package/dist/serve/worker/client/disconnect.js.map +1 -1
  320. package/dist/serve/worker/client/handles.d.ts +5 -0
  321. package/dist/serve/worker/client/handles.d.ts.map +1 -1
  322. package/dist/serve/worker/client/handles.js.map +1 -1
  323. package/dist/serve/worker/client/pagehide.d.ts +13 -0
  324. package/dist/serve/worker/client/pagehide.d.ts.map +1 -0
  325. package/dist/serve/worker/client/pagehide.js +19 -0
  326. package/dist/serve/worker/client/pagehide.js.map +1 -0
  327. package/dist/serve/worker/client/rtdb-admin.d.ts +8 -0
  328. package/dist/serve/worker/client/rtdb-admin.d.ts.map +1 -0
  329. package/dist/serve/worker/client/rtdb-admin.js +39 -0
  330. package/dist/serve/worker/client/rtdb-admin.js.map +1 -0
  331. package/dist/serve/worker/client/rtdb-connection-lifecycle.d.ts +15 -0
  332. package/dist/serve/worker/client/rtdb-connection-lifecycle.d.ts.map +1 -0
  333. package/dist/serve/worker/client/rtdb-connection-lifecycle.js +45 -0
  334. package/dist/serve/worker/client/rtdb-connection-lifecycle.js.map +1 -0
  335. package/dist/serve/worker/client/rtdb-controls.d.ts +6 -0
  336. package/dist/serve/worker/client/rtdb-controls.d.ts.map +1 -0
  337. package/dist/serve/worker/client/rtdb-controls.js +8 -0
  338. package/dist/serve/worker/client/rtdb-controls.js.map +1 -0
  339. package/dist/serve/worker/client/rtdb-listeners.d.ts +24 -0
  340. package/dist/serve/worker/client/rtdb-listeners.d.ts.map +1 -0
  341. package/dist/serve/worker/client/rtdb-listeners.js +262 -0
  342. package/dist/serve/worker/client/rtdb-listeners.js.map +1 -0
  343. package/dist/serve/worker/client/rtdb-reads.d.ts +4 -0
  344. package/dist/serve/worker/client/rtdb-reads.d.ts.map +1 -0
  345. package/dist/serve/worker/client/rtdb-reads.js +11 -0
  346. package/dist/serve/worker/client/rtdb-reads.js.map +1 -0
  347. package/dist/serve/worker/client/rtdb-references.d.ts +19 -0
  348. package/dist/serve/worker/client/rtdb-references.d.ts.map +1 -0
  349. package/dist/serve/worker/client/rtdb-references.js +63 -0
  350. package/dist/serve/worker/client/rtdb-references.js.map +1 -0
  351. package/dist/serve/worker/client/rtdb-snapshots.d.ts +20 -0
  352. package/dist/serve/worker/client/rtdb-snapshots.d.ts.map +1 -0
  353. package/dist/serve/worker/client/rtdb-snapshots.js +64 -0
  354. package/dist/serve/worker/client/rtdb-snapshots.js.map +1 -0
  355. package/dist/serve/worker/client/rtdb-transactions.d.ts +14 -0
  356. package/dist/serve/worker/client/rtdb-transactions.d.ts.map +1 -0
  357. package/dist/serve/worker/client/rtdb-transactions.js +34 -0
  358. package/dist/serve/worker/client/rtdb-transactions.js.map +1 -0
  359. package/dist/serve/worker/client/rtdb-writes.d.ts +8 -0
  360. package/dist/serve/worker/client/rtdb-writes.d.ts.map +1 -0
  361. package/dist/serve/worker/client/rtdb-writes.js +65 -0
  362. package/dist/serve/worker/client/rtdb-writes.js.map +1 -0
  363. package/dist/serve/worker/client.d.ts +0 -2
  364. package/dist/serve/worker/client.d.ts.map +1 -1
  365. package/dist/serve/worker/client.js +0 -2
  366. package/dist/serve/worker/client.js.map +1 -1
  367. package/dist/serve/worker/entry.js +2 -2
  368. package/dist/serve/worker/entry.js.map +1 -1
  369. package/dist/serve/worker/host/dispatch.d.ts +2 -0
  370. package/dist/serve/worker/host/dispatch.d.ts.map +1 -1
  371. package/dist/serve/worker/host/dispatch.js +24 -2
  372. package/dist/serve/worker/host/dispatch.js.map +1 -1
  373. package/dist/serve/worker/host/rtdb.d.ts +6 -2
  374. package/dist/serve/worker/host/rtdb.d.ts.map +1 -1
  375. package/dist/serve/worker/host/rtdb.js +224 -2
  376. package/dist/serve/worker/host/rtdb.js.map +1 -1
  377. package/dist/serve/worker/host/studio.d.ts.map +1 -1
  378. package/dist/serve/worker/host/studio.js +2 -0
  379. package/dist/serve/worker/host/studio.js.map +1 -1
  380. package/dist/serve/worker/host/subscriptions.d.ts.map +1 -1
  381. package/dist/serve/worker/host/subscriptions.js +3 -3
  382. package/dist/serve/worker/host/subscriptions.js.map +1 -1
  383. package/dist/serve/worker/host.d.ts +1 -1
  384. package/dist/serve/worker/host.d.ts.map +1 -1
  385. package/dist/serve/worker/host.js +1 -1
  386. package/dist/serve/worker/host.js.map +1 -1
  387. package/dist/serve/worker/index.d.ts +16 -1
  388. package/dist/serve/worker/index.d.ts.map +1 -1
  389. package/dist/serve/worker/index.js +17 -4
  390. package/dist/serve/worker/index.js.map +1 -1
  391. package/dist/serve/worker/protocol.d.ts +57 -0
  392. package/dist/serve/worker/protocol.d.ts.map +1 -1
  393. package/dist/serve/worker/protocol.js.map +1 -1
  394. package/dist/serve/worker/rtdb-value-equality.d.ts +3 -0
  395. package/dist/serve/worker/rtdb-value-equality.d.ts.map +1 -0
  396. package/dist/serve/worker/rtdb-value-equality.js +18 -0
  397. package/dist/serve/worker/rtdb-value-equality.js.map +1 -0
  398. package/dist/serve/worker/serve-init.js +2 -2
  399. package/dist/serve/worker/serve-init.js.map +1 -1
  400. package/dist/serve/worker/service-worker-relay.js +2 -2
  401. package/dist/serve/worker/service-worker-relay.js.map +1 -1
  402. package/package.json +7 -5
  403. package/src/assurance/.generated/conformance-verdicts.ts +120 -75
  404. package/src/cli/serve.ts +216 -308
  405. package/src/cli/service-command-records/database-rules-generate.ts +3 -0
  406. package/src/cli/service-command-records/database-rules-lint.ts +3 -0
  407. package/src/cli/service-command-records/database-rules-simulate.ts +3 -0
  408. package/src/cli/service-command-records/database-rules-validate.ts +3 -0
  409. package/src/cli/service-command-records/firestore-indexes-generate.ts +3 -0
  410. package/src/cli/service-command-records/firestore-rules-lint.ts +3 -0
  411. package/src/cli/service-command-records/firestore-rules-resolve.ts +3 -0
  412. package/src/cli/service-command-records/firestore-rules-simulate.ts +3 -0
  413. package/src/cli/service-command-records/firestore-rules-validate.ts +3 -0
  414. package/src/cli/service-command-records/storage-rules-lint.ts +3 -0
  415. package/src/cli/service-command-records/storage-rules-simulate.ts +3 -0
  416. package/src/cli/service-commands.generated.ts +27 -0
  417. package/src/cli/service-commands.test.ts +43 -0
  418. package/src/cli/service-commands.ts +36 -51
  419. package/src/conformance/.generated/can-i-use-browser.ts +1 -1
  420. package/src/conformance/.generated/can-i-use.ts +1 -1
  421. package/src/conformance/.generated/conformance-docs.ts +1 -1
  422. package/src/functions-rtdb/development-runtime.ts +299 -0
  423. package/src/serve/bridge-mount.ts +253 -19
  424. package/src/serve/bundler.ts +17 -36
  425. package/src/serve/entries/app-client.ts +5 -4
  426. package/src/serve/entries/auth-helper-core.ts +83 -30
  427. package/src/serve/entries/database.ts +180 -57
  428. package/src/serve/entries/init.ts +30 -20
  429. package/src/serve/html-injection.ts +65 -0
  430. package/src/serve/namespace.ts +26 -169
  431. package/src/serve/runtime/worker-generation.ts +29 -7
  432. package/src/serve/runtime/worker-replacement.ts +1 -1
  433. package/src/serve/sandbox-session.ts +233 -0
  434. package/src/serve/server.ts +20 -5
  435. package/src/serve/site-tree.ts +146 -0
  436. package/src/serve/standalone-assets.ts +9 -26
  437. package/src/serve/vite-ai-config.ts +8 -0
  438. package/src/serve/vite-functions-development.ts +201 -0
  439. package/src/serve/vite-generation-bridge.ts +66 -0
  440. package/src/serve/vite-generation-functions.ts +78 -0
  441. package/src/serve/vite-generation-middleware.ts +56 -0
  442. package/src/serve/vite-generation-rules-watch.ts +37 -0
  443. package/src/serve/vite-module-swap.ts +119 -0
  444. package/src/serve/vite-page-runtime.ts +100 -0
  445. package/src/serve/vite-plugin.ts +78 -882
  446. package/src/serve/vite-sandbox-generation.ts +255 -0
  447. package/src/serve/vite-worker-runtime.ts +12 -5
  448. package/src/serve/worker/client/disconnect.ts +3 -1
  449. package/src/serve/worker/client/handles.ts +5 -0
  450. package/src/serve/worker/client/pagehide.ts +31 -0
  451. package/src/serve/worker/client/rtdb-admin.ts +74 -0
  452. package/src/serve/worker/client/rtdb-connection-lifecycle.ts +52 -0
  453. package/src/serve/worker/client/rtdb-controls.ts +8 -0
  454. package/src/serve/worker/client/rtdb-listeners.ts +337 -0
  455. package/src/serve/worker/client/rtdb-reads.ts +12 -0
  456. package/src/serve/worker/client/rtdb-references.ts +85 -0
  457. package/src/serve/worker/client/rtdb-snapshots.ts +118 -0
  458. package/src/serve/worker/client/rtdb-transactions.ts +51 -0
  459. package/src/serve/worker/client/rtdb-writes.ts +74 -0
  460. package/src/serve/worker/client.ts +0 -2
  461. package/src/serve/worker/entry.ts +2 -2
  462. package/src/serve/worker/host/dispatch.ts +22 -2
  463. package/src/serve/worker/host/rtdb.ts +243 -2
  464. package/src/serve/worker/host/studio.ts +2 -0
  465. package/src/serve/worker/host/subscriptions.ts +8 -4
  466. package/src/serve/worker/host.ts +1 -1
  467. package/src/serve/worker/index.ts +58 -10
  468. package/src/serve/worker/protocol.ts +23 -2
  469. package/src/serve/worker/rtdb-value-equality.ts +17 -0
  470. package/src/serve/worker/serve-init.ts +2 -2
  471. package/src/serve/worker/service-worker-relay.ts +2 -2
  472. package/dist/serve/docs-ui/_astro/_slug_.DUci-duz.css +0 -1
  473. package/dist/serve/docs-ui/docs/_rhythm/index.html +0 -100
  474. package/dist/serve/docs-ui/docs/agent/set-up-your-agent/index.html +0 -43
  475. package/dist/serve/docs-ui/docs/agent/watch-and-review/index.html +0 -26
  476. package/dist/serve/docs-ui/docs/agent/work-with-an-agent/index.html +0 -70
  477. package/dist/serve/docs-ui/docs/api-reference/index.html +0 -68
  478. package/dist/serve/docs-ui/docs/build/ai-logic/index.html +0 -64
  479. package/dist/serve/docs-ui/docs/build/authentication/index.html +0 -66
  480. package/dist/serve/docs-ui/docs/build/cloud-firestore/index.html +0 -70
  481. package/dist/serve/docs-ui/docs/build/cloud-messaging/index.html +0 -71
  482. package/dist/serve/docs-ui/docs/build/cloud-storage/index.html +0 -66
  483. package/dist/serve/docs-ui/docs/build/realtime-database/index.html +0 -67
  484. package/dist/serve/docs-ui/docs/conformance-scores/index.html +0 -50
  485. package/dist/serve/docs-ui/docs/create-pyric-reference-api/index.html +0 -531
  486. package/dist/serve/docs-ui/docs/functions-rtdb-compat/index.html +0 -73
  487. package/dist/serve/docs-ui/docs/get-started/how-the-swap-works/index.html +0 -29
  488. package/dist/serve/docs-ui/docs/get-started/start-building/index.html +0 -33
  489. package/dist/serve/docs-ui/docs/messaging-compat/index.html +0 -265
  490. package/dist/serve/docs-ui/docs/observe/resolve-runtime-status/index.html +0 -28
  491. package/dist/serve/docs-ui/docs/observe/see-whats-happening/index.html +0 -74
  492. package/dist/serve/docs-ui/docs/observe/shape-your-data/index.html +0 -45
  493. package/dist/serve/docs-ui/docs/overview/index.html +0 -17
  494. package/dist/serve/docs-ui/docs/pyric-admin-app-reference-api/index.html +0 -186
  495. package/dist/serve/docs-ui/docs/pyric-admin-storage-reference-api/index.html +0 -318
  496. package/dist/serve/docs-ui/docs/pyric-ai-scripting-reference-api/index.html +0 -160
  497. package/dist/serve/docs-ui/docs/pyric-app-reference-api/index.html +0 -425
  498. package/dist/serve/docs-ui/docs/pyric-cli-assurance-browser-reference-api/index.html +0 -60
  499. package/dist/serve/docs-ui/docs/pyric-cli-bridge-reference-api/index.html +0 -507
  500. package/dist/serve/docs-ui/docs/pyric-cli-conformance-browser-reference-api/index.html +0 -258
  501. package/dist/serve/docs-ui/docs/pyric-cli-conformance-docs-reference-api/index.html +0 -51
  502. package/dist/serve/docs-ui/docs/pyric-cli-conformance-reference-api/index.html +0 -308
  503. package/dist/serve/docs-ui/docs/pyric-cli-credentials-node-reference-api/index.html +0 -68
  504. package/dist/serve/docs-ui/docs/pyric-cli-register-reference-api/index.html +0 -11
  505. package/dist/serve/docs-ui/docs/pyric-cli-vite-reference-api/index.html +0 -126
  506. package/dist/serve/docs-ui/docs/pyric-database-reference-api/index.html +0 -1852
  507. package/dist/serve/docs-ui/docs/pyric-messaging-reference-api/index.html +0 -509
  508. package/dist/serve/docs-ui/docs/pyric-messaging-sw-reference-api/index.html +0 -182
  509. package/dist/serve/docs-ui/docs/pyric-sandbox-database-reference-api/index.html +0 -121
  510. package/dist/serve/docs-ui/docs/pyric-sandbox-firestore-reference-api/index.html +0 -203
  511. package/dist/serve/docs-ui/docs/pyric-ui-agents-reference-api/index.html +0 -639
  512. package/dist/serve/docs-ui/docs/pyric-ui-auth-hooks-reference-api/index.html +0 -100
  513. package/dist/serve/docs-ui/docs/pyric-ui-events-hooks-reference-api/index.html +0 -24
  514. package/dist/serve/docs-ui/docs/pyric-ui-firestore-hooks-reference-api/index.html +0 -136
  515. package/dist/serve/docs-ui/docs/pyric-ui-rules-hooks-reference-api/index.html +0 -16
  516. package/dist/serve/docs-ui/docs/pyric-ui-storage-hooks-reference-api/index.html +0 -176
  517. package/dist/serve/docs-ui/docs/pyric-ui-traffic-hooks-reference-api/index.html +0 -188
  518. package/dist/serve/docs-ui/docs/secure/audit-your-rules/index.html +0 -51
  519. package/dist/serve/docs-ui/docs/secure/firestore-rules-limits/index.html +0 -106
  520. package/dist/serve/docs-ui/docs/secure/read-a-denial/index.html +0 -41
  521. package/dist/serve/docs-ui/docs/secure/rtdb-rules-in-typescript/index.html +0 -67
  522. package/dist/serve/docs-ui/docs/secure/rules-standard-library/index.html +0 -159
  523. package/dist/serve/docs-ui/docs/secure/secure-it-with-rules/index.html +0 -47
  524. package/dist/serve/docs-ui/docs/secure/simulate-and-lint/index.html +0 -95
  525. package/dist/serve/docs-ui/docs/secure/write-a-rules-test-suite/index.html +0 -82
  526. package/dist/serve/docs-ui/docs/ship/ship-to-production/index.html +0 -37
  527. package/dist/serve/docs-ui/docs/ship/test-in-node/index.html +0 -75
  528. package/dist/serve/docs-ui/docs/trust/how-we-know-it-matches-firebase/index.html +0 -132
  529. package/dist/serve/docs-ui/docs/trust/versioning-and-compatibility/index.html +0 -14
  530. package/dist/serve/docs-ui/index.html +0 -1
  531. package/dist/serve/studio-ui/assets/RulesCodeEditor-BDlH-5lp.js +0 -23
  532. package/dist/serve/studio-ui/assets/index-Bf9SSE8L.js +0 -1218
  533. package/dist/serve/studio-ui/assets/index-BlSGru_r.css +0 -1
  534. package/dist/serve/studio-ui/assets/seed-D_UjxfOU.js +0 -20
  535. package/dist/serve/studio-ui/index.html +0 -32
  536. package/dist/serve/worker/client/rtdb.d.ts +0 -36
  537. package/dist/serve/worker/client/rtdb.d.ts.map +0 -1
  538. package/dist/serve/worker/client/rtdb.js +0 -241
  539. package/dist/serve/worker/client/rtdb.js.map +0 -1
  540. package/src/serve/worker/client/rtdb.ts +0 -311
  541. /package/dist/serve/{docs-ui → site-ui}/404.html +0 -0
  542. /package/dist/serve/{docs-ui → site-ui}/_astro/_slug_.CXh9yTP1.css +0 -0
  543. /package/dist/serve/{docs-ui → site-ui}/docs/_rhythm.md +0 -0
  544. /package/dist/serve/{docs-ui → site-ui}/docs/agent/set-up-your-agent.md +0 -0
  545. /package/dist/serve/{docs-ui → site-ui}/docs/agent/watch-and-review.md +0 -0
  546. /package/dist/serve/{docs-ui → site-ui}/docs/agent/work-with-an-agent.md +0 -0
  547. /package/dist/serve/{docs-ui → site-ui}/docs/ai-compat.md +0 -0
  548. /package/dist/serve/{docs-ui → site-ui}/docs/api-reference.md +0 -0
  549. /package/dist/serve/{docs-ui → site-ui}/docs/app-compat.md +0 -0
  550. /package/dist/serve/{docs-ui → site-ui}/docs/auth-compat.md +0 -0
  551. /package/dist/serve/{docs-ui → site-ui}/docs/build/ai-logic.md +0 -0
  552. /package/dist/serve/{docs-ui → site-ui}/docs/build/authentication.md +0 -0
  553. /package/dist/serve/{docs-ui → site-ui}/docs/build/cloud-firestore.md +0 -0
  554. /package/dist/serve/{docs-ui → site-ui}/docs/build/cloud-messaging.md +0 -0
  555. /package/dist/serve/{docs-ui → site-ui}/docs/build/realtime-database.md +0 -0
  556. /package/dist/serve/{docs-ui → site-ui}/docs/create-pyric-reference-api.md +0 -0
  557. /package/dist/serve/{docs-ui → site-ui}/docs/functions-rtdb-compat.md +0 -0
  558. /package/dist/serve/{docs-ui → site-ui}/docs/get-started/how-the-swap-works.md +0 -0
  559. /package/dist/serve/{docs-ui → site-ui}/docs/get-started/start-building.md +0 -0
  560. /package/dist/serve/{docs-ui → site-ui}/docs/index.html +0 -0
  561. /package/dist/serve/{docs-ui → site-ui}/docs/observe/resolve-runtime-status.md +0 -0
  562. /package/dist/serve/{docs-ui → site-ui}/docs/observe/see-whats-happening.md +0 -0
  563. /package/dist/serve/{docs-ui → site-ui}/docs/observe/shape-your-data.md +0 -0
  564. /package/dist/serve/{docs-ui → site-ui}/docs/overview.md +0 -0
  565. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-admin-app-reference-api.md +0 -0
  566. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-admin-auth-reference-api.md +0 -0
  567. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-admin-database-reference-api.md +0 -0
  568. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-admin-messaging-reference-api.md +0 -0
  569. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-admin-storage-reference-api.md +0 -0
  570. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ai-reference-api.md +0 -0
  571. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ai-scripting-reference-api.md +0 -0
  572. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-app-reference-api.md +0 -0
  573. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-auth-reference-api.md +0 -0
  574. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-assurance-browser-reference-api.md +0 -0
  575. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-assurance-reference-api.md +0 -0
  576. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-bridge-client-reference-api.md +0 -0
  577. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-bridge-reference-api.md +0 -0
  578. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-conformance-browser-reference-api.md +0 -0
  579. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-conformance-docs-reference-api.md +0 -0
  580. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-conformance-reference-api.md +0 -0
  581. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-credentials-node-reference-api.md +0 -0
  582. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-discover-reference-api.md +0 -0
  583. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-register-reference-api.md +0 -0
  584. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-remote-reference-api.md +0 -0
  585. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-cli-verify-reference-api.md +0 -0
  586. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-messaging-reference-api.md +0 -0
  587. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-messaging-sw-reference-api.md +0 -0
  588. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-sandbox-database-reference-api.md +0 -0
  589. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-sandbox-firestore-reference-api.md +0 -0
  590. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-agents-reference-api.md +0 -0
  591. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-auth-hooks-reference-api.md +0 -0
  592. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-auth-reference-api.md +0 -0
  593. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-events-hooks-reference-api.md +0 -0
  594. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-events-reference-api.md +0 -0
  595. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-firestore-hooks-reference-api.md +0 -0
  596. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-primitives-reference-api.md +0 -0
  597. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-rtdb-reference-api.md +0 -0
  598. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-rules-hooks-reference-api.md +0 -0
  599. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-rules-reference-api.md +0 -0
  600. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-storage-hooks-reference-api.md +0 -0
  601. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-traffic-hooks-reference-api.md +0 -0
  602. /package/dist/serve/{docs-ui → site-ui}/docs/pyric-ui-traffic-reference-api.md +0 -0
  603. /package/dist/serve/{docs-ui → site-ui}/docs/secure/audit-your-rules.md +0 -0
  604. /package/dist/serve/{docs-ui → site-ui}/docs/secure/firestore-rules-limits.md +0 -0
  605. /package/dist/serve/{docs-ui → site-ui}/docs/secure/read-a-denial.md +0 -0
  606. /package/dist/serve/{docs-ui → site-ui}/docs/secure/rtdb-rules-in-typescript.md +0 -0
  607. /package/dist/serve/{docs-ui → site-ui}/docs/secure/secure-it-with-rules.md +0 -0
  608. /package/dist/serve/{docs-ui → site-ui}/docs/secure/simulate-and-lint.md +0 -0
  609. /package/dist/serve/{docs-ui → site-ui}/docs/secure/write-a-rules-test-suite.md +0 -0
  610. /package/dist/serve/{docs-ui → site-ui}/docs/ship/ship-to-production.md +0 -0
  611. /package/dist/serve/{docs-ui → site-ui}/docs/ship/test-in-node.md +0 -0
  612. /package/dist/serve/{docs-ui → site-ui}/docs/trust/how-we-know-it-matches-firebase.md +0 -0
  613. /package/dist/serve/{docs-ui → site-ui}/docs/trust/versioning-and-compatibility.md +0 -0
  614. /package/dist/serve/{studio-ui → site-ui}/pyric-logo.svg +0 -0
@@ -1,1852 +0,0 @@
1
- <!DOCTYPE html><html lang="en"> <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>API reference: pyric/database · Pyric Studio</title><meta name="description" content="Published declarations for pyric/database."><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap" rel="stylesheet"><link rel="stylesheet" href="/__pyric/ui/_astro/_slug_.CXh9yTP1.css">
2
- <link rel="stylesheet" href="/__pyric/ui/_astro/_slug_.DUci-duz.css"></head> <body> <header class="studio__bar"> <div class="studio__bar-inner"> <a class="studio__brand" href="/__pyric/ui/" aria-label="Pyric Studio">Pyric</a> <nav class="studio__nav" aria-label="Studio tabs"> <a class="studio__nav-tab" href="/__pyric/ui/"> Home </a><a class="studio__nav-tab" href="/__pyric/ui/firestore"> Firestore </a><a class="studio__nav-tab" href="/__pyric/ui/auth"> Auth </a><a class="studio__nav-tab" href="/__pyric/ui/rtdb"> RTDB </a><a class="studio__nav-tab" href="/__pyric/ui/storage"> Storage </a><a class="studio__nav-tab" href="/__pyric/ui/traffic"> Traffic </a><a class="studio__nav-tab" href="/__pyric/ui/settings"> Settings </a><a class="studio__nav-tab" href="/__pyric/ui/docs" aria-current="page"> Docs </a> </nav> </div> </header> <div class="docs-shell"> <details class="docs-nav-drawer"> <summary>Navigate</summary> <nav class="docs-nav" aria-label="Documentation"> <div class="docs-search" data-index-url="/__pyric/ui/docs/index.json"> <div class="docs-search-field"> <svg class="docs-search-icon" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"> <path d="M11.5 11.5 15 15M13 7A6 6 0 1 1 1 7a6 6 0 0 1 12 0Z" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"></path> </svg> <input type="text" class="docs-search-input" placeholder="Search docs" aria-label="Search docs" autocomplete="off" spellcheck="false"> <kbd class="docs-search-kbd">⌘K</kbd> </div> <ul class="docs-search-results" hidden></ul> </div> <script type="module">let i=null;function d(t){return i||(i=fetch(t).then(e=>e.json())),i}function l(t,e){return t.title.toLowerCase().includes(e)||t.excerpt.toLowerCase().includes(e)?!0:t.headings.some(r=>r.text.toLowerCase().includes(e))}function u(t,e,r){if(e.innerHTML="",t.length===0){e.hidden=!1;{const n=document.createElement("li");n.className="docs-search-empty",n.textContent="No matches",e.appendChild(n)}return}e.hidden=!1;for(const n of t.slice(0,8)){const s=document.createElement("li"),c=document.createElement("a");c.href=n.path;const o=document.createElement("span");o.className="docs-search-result-title",o.textContent=n.title;const a=document.createElement("span");a.className="docs-search-result-meta",a.textContent=[n.group,n.section].filter(Boolean).join(" / "),c.append(o,a),s.appendChild(c),e.appendChild(s)}}document.querySelectorAll(".docs-search").forEach(t=>{const e=t.dataset.indexUrl,r=t.querySelector(".docs-search-input"),n=t.querySelector(".docs-search-results");r.addEventListener("input",async()=>{const s=r.value.trim().toLowerCase();if(!s){n.hidden=!0,n.innerHTML="";return}const{pages:c}=await d(e);r.value.trim().toLowerCase()===s&&u(c.filter(o=>l(o,s)),n)}),r.addEventListener("focus",()=>{d(e),n.childElementCount>0&&(n.hidden=!1)}),r.addEventListener("keydown",s=>{s.key==="Escape"&&(r.value="",n.hidden=!0,n.innerHTML="",r.blur())}),r.addEventListener("blur",()=>{window.setTimeout(()=>{n.hidden=!0},150)})});document.addEventListener("keydown",t=>{if(!(t.metaKey||t.ctrlKey)||t.key.toLowerCase()!=="k")return;const e=[...document.querySelectorAll(".docs-search-input")].find(r=>r.offsetParent!==null);e&&(t.preventDefault(),e.focus(),e.select())});</script> <details class="docs-nav-group"> <summary>Overview</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/overview/"> Overview </a> </li><li> <a href="/__pyric/ui/docs/tutorial/"> Tutorial </a> </li> </ul> </div> </div> </details><details class="docs-nav-group"> <summary>Get started</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/get-started/start-building/"> Quickstart </a> </li><li> <a href="/__pyric/ui/docs/get-started/how-the-swap-works/"> How the swap works </a> </li> </ul> </div> </div> </details><details class="docs-nav-group"> <summary>Build</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/build/authentication/"> Authentication </a> </li><li> <a href="/__pyric/ui/docs/build/cloud-firestore/"> Cloud Firestore </a> </li><li> <a href="/__pyric/ui/docs/build/realtime-database/"> Realtime Database </a> </li><li> <a href="/__pyric/ui/docs/build/cloud-storage/"> Cloud Storage </a> </li><li> <a href="/__pyric/ui/docs/build/cloud-messaging/"> Cloud Messaging </a> </li><li> <a href="/__pyric/ui/docs/build/ai-logic/"> AI Logic </a> </li> </ul> </div> </div> </details><details class="docs-nav-group"> <summary>Secure &amp; debug</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/secure/secure-it-with-rules/"> Security Rules </a> </li><li> <a href="/__pyric/ui/docs/secure/simulate-and-lint/"> Simulate and lint before you deploy </a> </li><li> <a href="/__pyric/ui/docs/secure/write-a-rules-test-suite/"> Write a rules test suite </a> </li><li> <a href="/__pyric/ui/docs/secure/read-a-denial/"> Read a denial and understand it </a> </li><li> <a href="/__pyric/ui/docs/secure/rules-standard-library/"> The rules standard library </a> </li><li> <a href="/__pyric/ui/docs/secure/rtdb-rules-in-typescript/"> RTDB rules in TypeScript </a> </li><li> <a href="/__pyric/ui/docs/secure/firestore-rules-limits/"> Rules limits </a> </li><li> <a href="/__pyric/ui/docs/secure/audit-your-rules/"> Audit rules and data </a> </li> </ul> </div> </div> </details><details class="docs-nav-group"> <summary>Observe &amp; shape</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/observe/see-whats-happening/"> Traffic &amp; rule verdicts </a> </li><li> <a href="/__pyric/ui/docs/observe/resolve-runtime-status/"> Runtime status </a> </li><li> <a href="/__pyric/ui/docs/observe/shape-your-data/"> Seed, snapshot, replay </a> </li> </ul> </div> </div> </details><details class="docs-nav-group"> <summary>Ship &amp; test</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/ship/ship-to-production/"> Ship to production </a> </li><li> <a href="/__pyric/ui/docs/ship/test-in-node/"> Test in Node </a> </li> </ul> </div> </div> </details><details class="docs-nav-group"> <summary>Work with an agent</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/agent/set-up-your-agent/"> Connect an agent </a> </li><li> <a href="/__pyric/ui/docs/agent/work-with-an-agent/"> Use the MCP tools </a> </li><li> <a href="/__pyric/ui/docs/agent/watch-and-review/"> Watch in Pyric Studio </a> </li> </ul> </div> </div> </details><a class="docs-nav-toplink" href="/__pyric/ui/docs/trust/versioning-and-compatibility/"> Trust </a><details class="docs-nav-group"> <summary>Conformance</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/conformance-scores/"> Public API coverage </a> </li><li> <a href="/__pyric/ui/docs/trust/how-we-know-it-matches-firebase/"> How we know it matches Firebase </a> </li><li> <a href="/__pyric/ui/docs/app-compat/"> App </a> </li><li> <a href="/__pyric/ui/docs/ai-compat/"> AI Logic </a> </li><li> <a href="/__pyric/ui/docs/auth-compat/"> Auth </a> </li><li> <a href="/__pyric/ui/docs/firestore-compat/"> Firestore </a> </li><li> <a href="/__pyric/ui/docs/database-compat/"> Realtime Database </a> </li><li> <a href="/__pyric/ui/docs/storage-compat/"> Storage </a> </li><li> <a href="/__pyric/ui/docs/messaging-compat/"> Messaging </a> </li><li> <a href="/__pyric/ui/docs/functions-rtdb-compat/"> Functions · RTDB </a> </li><li> <a href="/__pyric/ui/docs/rules-compat/"> Rules </a> </li> </ul> </div> </div> </details> <details class="docs-nav-group" open> <summary>Reference</summary> <div class="docs-nav-group-body docs-nav-group-body--reference"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/api-reference/"> API reference </a> </li> </ul> </div><div class="docs-nav-section"> <h2 class="docs-nav-heading">pyric</h2> <ul> <li> <a href="/__pyric/ui/docs/pyric-app-reference-api/"> pyric/app </a> </li><li> <a href="/__pyric/ui/docs/pyric-firestore-reference-api/"> pyric/firestore </a> </li><li> <a href="/__pyric/ui/docs/pyric-auth-reference-api/"> pyric/auth </a> </li><li> <a href="/__pyric/ui/docs/pyric-ai-reference-api/"> pyric/ai </a> </li><li> <a href="/__pyric/ui/docs/pyric-ai-scripting-reference-api/"> pyric/ai/scripting </a> </li><li> <a href="/__pyric/ui/docs/pyric-database-reference-api/" aria-current="page"> pyric/database </a> </li><li> <a href="/__pyric/ui/docs/pyric-storage-reference-api/"> pyric/storage </a> </li><li> <a href="/__pyric/ui/docs/pyric-messaging-reference-api/"> pyric/messaging </a> </li><li> <a href="/__pyric/ui/docs/pyric-messaging-sw-reference-api/"> pyric/messaging/sw </a> </li><li> <a href="/__pyric/ui/docs/pyric-rules-reference-api/"> pyric/rules </a> </li><li> <a href="/__pyric/ui/docs/pyric-sandbox-reference-api/"> pyric/sandbox </a> </li><li> <a href="/__pyric/ui/docs/pyric-sandbox-firestore-reference-api/"> pyric/sandbox/firestore </a> </li><li> <a href="/__pyric/ui/docs/pyric-sandbox-database-reference-api/"> pyric/sandbox/database </a> </li> </ul> </div><div class="docs-nav-section"> <h2 class="docs-nav-heading">pyric-admin</h2> <ul> <li> <a href="/__pyric/ui/docs/pyric-admin-app-reference-api/"> pyric-admin/app </a> </li><li> <a href="/__pyric/ui/docs/pyric-admin-firestore-reference-api/"> pyric-admin/firestore </a> </li><li> <a href="/__pyric/ui/docs/pyric-admin-auth-reference-api/"> pyric-admin/auth </a> </li><li> <a href="/__pyric/ui/docs/pyric-admin-database-reference-api/"> pyric-admin/database </a> </li><li> <a href="/__pyric/ui/docs/pyric-admin-storage-reference-api/"> pyric-admin/storage </a> </li><li> <a href="/__pyric/ui/docs/pyric-admin-messaging-reference-api/"> pyric-admin/messaging </a> </li> </ul> </div><div class="docs-nav-section"> <h2 class="docs-nav-heading">create-pyric</h2> <ul> <li> <a href="/__pyric/ui/docs/create-pyric-reference-api/"> create-pyric </a> </li> </ul> </div><div class="docs-nav-section"> <h2 class="docs-nav-heading">@pyric/cli</h2> <ul> <li> <a href="/__pyric/ui/docs/pyric-cli-credentials-node-reference-api/"> @pyric/cli/credentials/node </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-verify-reference-api/"> @pyric/cli/verify </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-conformance-reference-api/"> @pyric/cli/conformance </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-conformance-browser-reference-api/"> @pyric/cli/conformance/browser </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-conformance-docs-reference-api/"> @pyric/cli/conformance/docs </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-assurance-reference-api/"> @pyric/cli/assurance </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-assurance-browser-reference-api/"> @pyric/cli/assurance/browser </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-bridge-reference-api/"> @pyric/cli/bridge </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-bridge-client-reference-api/"> @pyric/cli/bridge/client </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-discover-reference-api/"> @pyric/cli/discover </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-vite-reference-api/"> @pyric/cli/vite </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-serve-worker-reference-api/"> @pyric/cli/serve/worker </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-remote-reference-api/"> @pyric/cli/remote </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-register-reference-api/"> @pyric/cli/register </a> </li> </ul> </div><div class="docs-nav-section"> <h2 class="docs-nav-heading">@pyric/ui</h2> <ul> <li> <a href="/__pyric/ui/docs/pyric-ui-auth-reference-api/"> @pyric/ui/auth </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-auth-hooks-reference-api/"> @pyric/ui/auth/hooks </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-primitives-reference-api/"> @pyric/ui/primitives </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-firestore-reference-api/"> @pyric/ui/firestore </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-firestore-hooks-reference-api/"> @pyric/ui/firestore/hooks </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-rtdb-reference-api/"> @pyric/ui/rtdb </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-storage-reference-api/"> @pyric/ui/storage </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-storage-hooks-reference-api/"> @pyric/ui/storage/hooks </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-traffic-reference-api/"> @pyric/ui/traffic </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-traffic-hooks-reference-api/"> @pyric/ui/traffic/hooks </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-events-reference-api/"> @pyric/ui/events </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-events-hooks-reference-api/"> @pyric/ui/events/hooks </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-agents-reference-api/"> @pyric/ui/agents </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-rules-reference-api/"> @pyric/ui/rules </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-rules-hooks-reference-api/"> @pyric/ui/rules/hooks </a> </li> </ul> </div> </div> </details> </nav> </details> <nav class="docs-nav" aria-label="Documentation"> <div class="docs-search" data-index-url="/__pyric/ui/docs/index.json"> <div class="docs-search-field"> <svg class="docs-search-icon" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"> <path d="M11.5 11.5 15 15M13 7A6 6 0 1 1 1 7a6 6 0 0 1 12 0Z" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"></path> </svg> <input type="text" class="docs-search-input" placeholder="Search docs" aria-label="Search docs" autocomplete="off" spellcheck="false"> <kbd class="docs-search-kbd">⌘K</kbd> </div> <ul class="docs-search-results" hidden></ul> </div> <details class="docs-nav-group" id="nav-group-overview"> <summary>Overview</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/overview/"> Overview </a> </li><li> <a href="/__pyric/ui/docs/tutorial/"> Tutorial </a> </li> </ul> </div> </div> </details><details class="docs-nav-group" id="nav-group-get-started"> <summary>Get started</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/get-started/start-building/"> Quickstart </a> </li><li> <a href="/__pyric/ui/docs/get-started/how-the-swap-works/"> How the swap works </a> </li> </ul> </div> </div> </details><details class="docs-nav-group" id="nav-group-build"> <summary>Build</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/build/authentication/"> Authentication </a> </li><li> <a href="/__pyric/ui/docs/build/cloud-firestore/"> Cloud Firestore </a> </li><li> <a href="/__pyric/ui/docs/build/realtime-database/"> Realtime Database </a> </li><li> <a href="/__pyric/ui/docs/build/cloud-storage/"> Cloud Storage </a> </li><li> <a href="/__pyric/ui/docs/build/cloud-messaging/"> Cloud Messaging </a> </li><li> <a href="/__pyric/ui/docs/build/ai-logic/"> AI Logic </a> </li> </ul> </div> </div> </details><details class="docs-nav-group" id="nav-group-secure-debug"> <summary>Secure &amp; debug</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/secure/secure-it-with-rules/"> Security Rules </a> </li><li> <a href="/__pyric/ui/docs/secure/simulate-and-lint/"> Simulate and lint before you deploy </a> </li><li> <a href="/__pyric/ui/docs/secure/write-a-rules-test-suite/"> Write a rules test suite </a> </li><li> <a href="/__pyric/ui/docs/secure/read-a-denial/"> Read a denial and understand it </a> </li><li> <a href="/__pyric/ui/docs/secure/rules-standard-library/"> The rules standard library </a> </li><li> <a href="/__pyric/ui/docs/secure/rtdb-rules-in-typescript/"> RTDB rules in TypeScript </a> </li><li> <a href="/__pyric/ui/docs/secure/firestore-rules-limits/"> Rules limits </a> </li><li> <a href="/__pyric/ui/docs/secure/audit-your-rules/"> Audit rules and data </a> </li> </ul> </div> </div> </details><details class="docs-nav-group" id="nav-group-observe-shape"> <summary>Observe &amp; shape</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/observe/see-whats-happening/"> Traffic &amp; rule verdicts </a> </li><li> <a href="/__pyric/ui/docs/observe/resolve-runtime-status/"> Runtime status </a> </li><li> <a href="/__pyric/ui/docs/observe/shape-your-data/"> Seed, snapshot, replay </a> </li> </ul> </div> </div> </details><details class="docs-nav-group" id="nav-group-ship-test"> <summary>Ship &amp; test</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/ship/ship-to-production/"> Ship to production </a> </li><li> <a href="/__pyric/ui/docs/ship/test-in-node/"> Test in Node </a> </li> </ul> </div> </div> </details><details class="docs-nav-group" id="nav-group-work-with-an-agent"> <summary>Work with an agent</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/agent/set-up-your-agent/"> Connect an agent </a> </li><li> <a href="/__pyric/ui/docs/agent/work-with-an-agent/"> Use the MCP tools </a> </li><li> <a href="/__pyric/ui/docs/agent/watch-and-review/"> Watch in Pyric Studio </a> </li> </ul> </div> </div> </details><a class="docs-nav-toplink" href="/__pyric/ui/docs/trust/versioning-and-compatibility/" id="nav-group-trust"> Trust </a><details class="docs-nav-group" id="nav-group-conformance"> <summary>Conformance</summary> <div class="docs-nav-group-body"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/conformance-scores/"> Public API coverage </a> </li><li> <a href="/__pyric/ui/docs/trust/how-we-know-it-matches-firebase/"> How we know it matches Firebase </a> </li><li> <a href="/__pyric/ui/docs/app-compat/"> App </a> </li><li> <a href="/__pyric/ui/docs/ai-compat/"> AI Logic </a> </li><li> <a href="/__pyric/ui/docs/auth-compat/"> Auth </a> </li><li> <a href="/__pyric/ui/docs/firestore-compat/"> Firestore </a> </li><li> <a href="/__pyric/ui/docs/database-compat/"> Realtime Database </a> </li><li> <a href="/__pyric/ui/docs/storage-compat/"> Storage </a> </li><li> <a href="/__pyric/ui/docs/messaging-compat/"> Messaging </a> </li><li> <a href="/__pyric/ui/docs/functions-rtdb-compat/"> Functions · RTDB </a> </li><li> <a href="/__pyric/ui/docs/rules-compat/"> Rules </a> </li> </ul> </div> </div> </details> <details class="docs-nav-group" id="nav-group-reference" open> <summary>Reference</summary> <div class="docs-nav-group-body docs-nav-group-body--reference"> <div class="docs-nav-section"> <ul> <li> <a href="/__pyric/ui/docs/api-reference/"> API reference </a> </li> </ul> </div><div class="docs-nav-section"> <h2 class="docs-nav-heading">pyric</h2> <ul> <li> <a href="/__pyric/ui/docs/pyric-app-reference-api/"> pyric/app </a> </li><li> <a href="/__pyric/ui/docs/pyric-firestore-reference-api/"> pyric/firestore </a> </li><li> <a href="/__pyric/ui/docs/pyric-auth-reference-api/"> pyric/auth </a> </li><li> <a href="/__pyric/ui/docs/pyric-ai-reference-api/"> pyric/ai </a> </li><li> <a href="/__pyric/ui/docs/pyric-ai-scripting-reference-api/"> pyric/ai/scripting </a> </li><li> <a href="/__pyric/ui/docs/pyric-database-reference-api/" aria-current="page"> pyric/database </a> </li><li> <a href="/__pyric/ui/docs/pyric-storage-reference-api/"> pyric/storage </a> </li><li> <a href="/__pyric/ui/docs/pyric-messaging-reference-api/"> pyric/messaging </a> </li><li> <a href="/__pyric/ui/docs/pyric-messaging-sw-reference-api/"> pyric/messaging/sw </a> </li><li> <a href="/__pyric/ui/docs/pyric-rules-reference-api/"> pyric/rules </a> </li><li> <a href="/__pyric/ui/docs/pyric-sandbox-reference-api/"> pyric/sandbox </a> </li><li> <a href="/__pyric/ui/docs/pyric-sandbox-firestore-reference-api/"> pyric/sandbox/firestore </a> </li><li> <a href="/__pyric/ui/docs/pyric-sandbox-database-reference-api/"> pyric/sandbox/database </a> </li> </ul> </div><div class="docs-nav-section"> <h2 class="docs-nav-heading">pyric-admin</h2> <ul> <li> <a href="/__pyric/ui/docs/pyric-admin-app-reference-api/"> pyric-admin/app </a> </li><li> <a href="/__pyric/ui/docs/pyric-admin-firestore-reference-api/"> pyric-admin/firestore </a> </li><li> <a href="/__pyric/ui/docs/pyric-admin-auth-reference-api/"> pyric-admin/auth </a> </li><li> <a href="/__pyric/ui/docs/pyric-admin-database-reference-api/"> pyric-admin/database </a> </li><li> <a href="/__pyric/ui/docs/pyric-admin-storage-reference-api/"> pyric-admin/storage </a> </li><li> <a href="/__pyric/ui/docs/pyric-admin-messaging-reference-api/"> pyric-admin/messaging </a> </li> </ul> </div><div class="docs-nav-section"> <h2 class="docs-nav-heading">create-pyric</h2> <ul> <li> <a href="/__pyric/ui/docs/create-pyric-reference-api/"> create-pyric </a> </li> </ul> </div><div class="docs-nav-section"> <h2 class="docs-nav-heading">@pyric/cli</h2> <ul> <li> <a href="/__pyric/ui/docs/pyric-cli-credentials-node-reference-api/"> @pyric/cli/credentials/node </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-verify-reference-api/"> @pyric/cli/verify </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-conformance-reference-api/"> @pyric/cli/conformance </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-conformance-browser-reference-api/"> @pyric/cli/conformance/browser </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-conformance-docs-reference-api/"> @pyric/cli/conformance/docs </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-assurance-reference-api/"> @pyric/cli/assurance </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-assurance-browser-reference-api/"> @pyric/cli/assurance/browser </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-bridge-reference-api/"> @pyric/cli/bridge </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-bridge-client-reference-api/"> @pyric/cli/bridge/client </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-discover-reference-api/"> @pyric/cli/discover </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-vite-reference-api/"> @pyric/cli/vite </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-serve-worker-reference-api/"> @pyric/cli/serve/worker </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-remote-reference-api/"> @pyric/cli/remote </a> </li><li> <a href="/__pyric/ui/docs/pyric-cli-register-reference-api/"> @pyric/cli/register </a> </li> </ul> </div><div class="docs-nav-section"> <h2 class="docs-nav-heading">@pyric/ui</h2> <ul> <li> <a href="/__pyric/ui/docs/pyric-ui-auth-reference-api/"> @pyric/ui/auth </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-auth-hooks-reference-api/"> @pyric/ui/auth/hooks </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-primitives-reference-api/"> @pyric/ui/primitives </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-firestore-reference-api/"> @pyric/ui/firestore </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-firestore-hooks-reference-api/"> @pyric/ui/firestore/hooks </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-rtdb-reference-api/"> @pyric/ui/rtdb </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-storage-reference-api/"> @pyric/ui/storage </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-storage-hooks-reference-api/"> @pyric/ui/storage/hooks </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-traffic-reference-api/"> @pyric/ui/traffic </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-traffic-hooks-reference-api/"> @pyric/ui/traffic/hooks </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-events-reference-api/"> @pyric/ui/events </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-events-hooks-reference-api/"> @pyric/ui/events/hooks </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-agents-reference-api/"> @pyric/ui/agents </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-rules-reference-api/"> @pyric/ui/rules </a> </li><li> <a href="/__pyric/ui/docs/pyric-ui-rules-hooks-reference-api/"> @pyric/ui/rules/hooks </a> </li> </ul> </div> </div> </details> </nav> <main class="doc-main"> <nav class="docs-breadcrumbs" aria-label="Breadcrumb"> <ol> <li> <a href="/__pyric/ui/docs/api-reference/">API reference</a> </li><li> <span class="docs-breadcrumbs-sep" aria-hidden="true">/</span> <span>pyric</span> </li><li> <span class="docs-breadcrumbs-sep" aria-hidden="true">/</span> <span aria-current="page">pyric/database</span> </li> </ol> </nav> <header class="api-reference-header"> <p class="api-reference-kicker">API reference</p> <h1><code>pyric/database</code></h1> <p class="api-reference-meta"> 53 published symbols from <code>pyric</code> </p> <p class="api-reference-source">
3
- Generated from the TypeScript declarations shipped at this import path.
4
- </p> <a class="api-reference-evidence" href="/__pyric/ui/docs/database-compat/">
5
- Check behavioral conformance
6
- </a> </header> <article class="prose api-reference-body"> <!-- Generated from published package declarations via TypeDoc. Rendered by the api-reference content loader. -->
7
- <h2 id="interfaces">Interfaces</h2>
8
- <p><a id="database"></a></p>
9
- <h3 id="database">Database</h3>
10
- <p>Opaque RTDB handle. Routes via <a href="#target_symbol-1">TARGET_SYMBOL</a>.</p>
11
- <h4 id="properties">Properties</h4>
12
- <div class="table-scroll">
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
- <table><thead><tr><th align="left">Property</th><th align="left">Modifier</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><a id="target_symbol"></a> <code>[TARGET_SYMBOL]</code></td><td align="left"><code>readonly</code></td><td align="left"><code>Target</code></td></tr><tr><td align="left"><a id="app"></a> <code>app?</code></td><td align="left"><code>readonly</code></td><td align="left"><a href="/docs/pyric-app-reference-api/#firebaseapp"><code>FirebaseApp</code></a></td></tr></tbody></table></div>
33
- <hr>
34
- <p><a id="databasereference"></a></p>
35
- <h3 id="databasereference">DatabaseReference</h3>
36
- <p>RTDB-shaped reference. Backend-opaque to consumers; mirrors
37
- <code>firebase/database</code>’s <code>DatabaseReference</code> for the subset of methods
38
- the modular SDK uses idiomatically as plain free-function args.</p>
39
- <p><code>key</code> is the last path segment (matches <code>DatabaseReference.key</code>).
40
- <code>null</code> for the root ref. <code>parent</code> is the ref one segment up
41
- (<code>null</code> at root). <code>root</code> is always the root ref.</p>
42
- <p><code>toString()</code> returns a stable <code>sandbox://</code> URL.</p>
43
- <h4 id="extended-by">Extended by</h4>
44
- <ul>
45
- <li><a href="#thenablereference"><code>ThenableReference</code></a></li>
46
- </ul>
47
- <h4 id="properties-1">Properties</h4>
48
- <div class="table-scroll">
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
- <table><thead><tr><th align="left">Property</th><th align="left">Modifier</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><a id="key"></a> <code>key</code></td><td align="left"><code>readonly</code></td><td align="left"><code>string</code></td></tr><tr><td align="left"><a id="parent"></a> <code>parent</code></td><td align="left"><code>readonly</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a></td></tr><tr><td align="left"><a id="root"></a> <code>root</code></td><td align="left"><code>readonly</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a></td></tr></tbody></table></div>
74
- <h4 id="methods">Methods</h4>
75
- <p><a id="tostring"></a></p>
76
- <h5 id="tostring">toString()</h5>
77
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">toString</span><span style="color:#ABB2BF">(): </span><span style="color:#E06C75">string</span><span style="color:#ABB2BF">;</span></span></code></pre>
78
- <h6 id="returns">Returns</h6>
79
- <p><code>string</code></p>
80
- <hr>
81
- <p><a id="datasnapshot"></a></p>
82
- <h3 id="datasnapshot">DataSnapshot</h3>
83
- <p>Lightweight <code>DataSnapshot</code> — matches the subset of
84
- <code>firebase/database</code>’s <code>DataSnapshot</code> we surface synchronously on a
85
- <code>get()</code>. Methods are the load-bearing ones (<code>val</code>, <code>exists</code>, <code>key</code>,
86
- <code>child</code>) plus a few utilities consumer code routinely reads.</p>
87
- <h4 id="properties-2">Properties</h4>
88
- <div class="table-scroll">
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
- <table><thead><tr><th align="left">Property</th><th align="left">Modifier</th><th align="left">Type</th><th align="left">Description</th></tr></thead><tbody><tr><td align="left"><a id="key-1"></a> <code>key</code></td><td align="left"><code>readonly</code></td><td align="left"><code>string</code></td><td align="left">-</td></tr><tr><td align="left"><a id="priority"></a> <code>priority</code></td><td align="left"><code>readonly</code></td><td align="left"><code>string</code> | <code>number</code></td><td align="left">The node’s priority, or <code>null</code>. The sandbox does not model RTDB’s priority values, so this is always <code>null</code>, matching the common case (no <code>.priority</code> set). Mirrors <code>api/Reference_impl.ts:312</code>.</td></tr><tr><td align="left"><a id="ref"></a> <code>ref</code></td><td align="left"><code>readonly</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a></td><td align="left">The ref the snap was taken from.</td></tr><tr><td align="left"><a id="size"></a> <code>size</code></td><td align="left"><code>readonly</code></td><td align="left"><code>number</code></td><td align="left">Number of child properties of this snapshot. A getter (NOT a <code>numChildren()</code> method — that was the legacy namespaced API). Locked by oracle <code>rtdb-modular-get-snapshot-shape.json</code> (<code>hasSize: true, hasNumChildren: false</code>) + upstream <code>api/Reference_impl.ts:331-333</code>.</td></tr></tbody></table></div>
124
- <h4 id="methods-1">Methods</h4>
125
- <p><a id="child"></a></p>
126
- <h5 id="child">child()</h5>
127
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">child</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">path</span><span style="color:#ABB2BF">: </span><span style="color:#E06C75">string</span><span style="color:#ABB2BF">): </span><span style="color:#E06C75">DataSnapshot</span><span style="color:#ABB2BF">;</span></span></code></pre>
128
- <h6 id="parameters">Parameters</h6>
129
- <div class="table-scroll">
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>path</code></td><td align="left"><code>string</code></td></tr></tbody></table></div>
143
- <h6 id="returns-1">Returns</h6>
144
- <p><a href="#datasnapshot"><code>DataSnapshot</code></a></p>
145
- <p><a id="exists"></a></p>
146
- <h5 id="exists">exists()</h5>
147
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">exists</span><span style="color:#ABB2BF">(): </span><span style="color:#E06C75">boolean</span><span style="color:#ABB2BF">;</span></span></code></pre>
148
- <h6 id="returns-2">Returns</h6>
149
- <p><code>boolean</code></p>
150
- <p><a id="exportval"></a></p>
151
- <h5 id="exportval">exportVal()</h5>
152
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">exportVal</span><span style="color:#ABB2BF">(): </span><span style="color:#E06C75">JsonValue</span><span style="color:#ABB2BF">;</span></span></code></pre>
153
- <p>Like <code>val()</code> but includes priority info (for backups). With no
154
- priority modeled, this equals <code>val()</code>. Mirrors
155
- <code>api/Reference_impl.ts:374-376</code>.</p>
156
- <h6 id="returns-3">Returns</h6>
157
- <p><a href="#jsonvalue"><code>JsonValue</code></a></p>
158
- <p><a id="foreach"></a></p>
159
- <h5 id="foreach">forEach()</h5>
160
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">forEach</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">cb</span><span style="color:#ABB2BF">: (</span><span style="color:#E06C75;font-style:italic">child</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DataSnapshot</span><span style="color:#ABB2BF">) </span><span style="color:#C678DD">=></span><span style="color:#E06C75"> boolean</span><span style="color:#56B6C2"> |</span><span style="color:#C678DD"> void</span><span style="color:#ABB2BF">): </span><span style="color:#E06C75">boolean</span><span style="color:#ABB2BF">;</span></span></code></pre>
161
- <p>Iterate the snapshot’s immediate children. The callback is invoked
162
- with a child <code>DataSnapshot</code> for each child; return <code>true</code> to stop
163
- iteration early (matches the <code>firebase/database</code> contract).</p>
164
- <p>For a snapshot built from a <a href="#query">Query</a>, children are visited in
165
- the order the query’s <code>orderBy*</code> constraint computed — the windowed</p>
166
- <ul>
167
- <li>filtered + limited sequence. For a plain ref snapshot, children
168
- are visited in key-insertion order (V8 object iteration order; the
169
- RTDB SDK does NOT guarantee an order on plain refs either).</li>
170
- </ul>
171
- <h6 id="parameters-1">Parameters</h6>
172
- <div class="table-scroll">
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>cb</code></td><td align="left">(<code>child</code>: <a href="#datasnapshot"><code>DataSnapshot</code></a>) => <code>boolean</code> | <code>void</code></td></tr></tbody></table></div>
186
- <h6 id="returns-4">Returns</h6>
187
- <p><code>boolean</code></p>
188
- <p><a id="haschild"></a></p>
189
- <h5 id="haschild">hasChild()</h5>
190
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">hasChild</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">path</span><span style="color:#ABB2BF">: </span><span style="color:#E06C75">string</span><span style="color:#ABB2BF">): </span><span style="color:#E06C75">boolean</span><span style="color:#ABB2BF">;</span></span></code></pre>
191
- <h6 id="parameters-2">Parameters</h6>
192
- <div class="table-scroll">
193
-
194
-
195
-
196
-
197
-
198
-
199
-
200
-
201
-
202
-
203
-
204
-
205
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>path</code></td><td align="left"><code>string</code></td></tr></tbody></table></div>
206
- <h6 id="returns-5">Returns</h6>
207
- <p><code>boolean</code></p>
208
- <p><a id="haschildren"></a></p>
209
- <h5 id="haschildren">hasChildren()</h5>
210
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">hasChildren</span><span style="color:#ABB2BF">(): </span><span style="color:#E06C75">boolean</span><span style="color:#ABB2BF">;</span></span></code></pre>
211
- <h6 id="returns-6">Returns</h6>
212
- <p><code>boolean</code></p>
213
- <p><a id="tojson"></a></p>
214
- <h5 id="tojson">toJSON()</h5>
215
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">toJSON</span><span style="color:#ABB2BF">(): </span><span style="color:#E06C75">JsonValue</span><span style="color:#ABB2BF">;</span></span></code></pre>
216
- <h6 id="returns-7">Returns</h6>
217
- <p><a href="#jsonvalue"><code>JsonValue</code></a></p>
218
- <p><a id="val"></a></p>
219
- <h5 id="val">val()</h5>
220
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">val</span><span style="color:#ABB2BF">(): </span><span style="color:#E06C75">JsonValue</span><span style="color:#ABB2BF">;</span></span></code></pre>
221
- <h6 id="returns-8">Returns</h6>
222
- <p><a href="#jsonvalue"><code>JsonValue</code></a></p>
223
- <hr>
224
- <p><a id="query"></a></p>
225
- <h3 id="query">Query</h3>
226
- <p>RTDB-shaped Query — a ref + an immutable constraint chain. Mirrors
227
- <code>firebase/database</code>’s <code>Query</code> for the subset of methods the modular
228
- SDK uses idiomatically.</p>
229
- <p>Construct with <a href="#query-1">query</a>; pass to <a href="#get">get</a> or <a href="#onvalue">onValue</a>.</p>
230
- <h4 id="properties-3">Properties</h4>
231
- <div class="table-scroll">
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
-
243
-
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
- <table><thead><tr><th align="left">Property</th><th align="left">Modifier</th><th align="left">Type</th><th align="left">Description</th></tr></thead><tbody><tr><td align="left"><a id="query_symbol"></a> <code>[QUERY_SYMBOL]</code></td><td align="left"><code>readonly</code></td><td align="left"><code>true</code></td><td align="left">-</td></tr><tr><td align="left"><a id="ref-1"></a> <code>ref</code></td><td align="left"><code>readonly</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a></td><td align="left">The Query’s location. Used by <code>query()</code> chaining + listener fan-out.</td></tr></tbody></table></div>
255
- <h4 id="methods-2">Methods</h4>
256
- <p><a id="tostring-2"></a></p>
257
- <h5 id="tostring-1">toString()</h5>
258
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">toString</span><span style="color:#ABB2BF">(): </span><span style="color:#E06C75">string</span><span style="color:#ABB2BF">;</span></span></code></pre>
259
- <p>Resolves to the same URL the ref would.</p>
260
- <h6 id="returns-9">Returns</h6>
261
- <p><code>string</code></p>
262
- <hr>
263
- <p><a id="queryconstraint"></a></p>
264
- <h3 id="queryconstraint">QueryConstraint</h3>
265
- <p>Opaque constraint produced by <code>orderByChild</code> / <code>equalTo</code> / <code>limitToFirst</code>
266
- etc. Pass to <a href="#query-1">query</a>.</p>
267
- <h4 id="properties-4">Properties</h4>
268
- <div class="table-scroll">
269
-
270
-
271
-
272
-
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
-
287
-
288
-
289
-
290
-
291
- <table><thead><tr><th align="left">Property</th><th align="left">Modifier</th><th align="left">Type</th><th align="left">Description</th></tr></thead><tbody><tr><td align="left"><a id="constraint_symbol"></a> <code>[CONSTRAINT_SYMBOL]</code></td><td align="left"><code>readonly</code></td><td align="left"><code>Constraint</code></td><td align="left">-</td></tr><tr><td align="left"><a id="type"></a> <code>type</code></td><td align="left"><code>readonly</code></td><td align="left">| <code>"orderByChild"</code> | <code>"orderByKey"</code> | <code>"orderByValue"</code> | <code>"startAt"</code> | <code>"startAfter"</code> | <code>"endAt"</code> | <code>"endBefore"</code> | <code>"equalTo"</code> | <code>"limitToFirst"</code> | <code>"limitToLast"</code></td><td align="left">The constraint’s variant — surfaces as the SDK’s <code>QueryConstraintType</code> strings.</td></tr></tbody></table></div>
292
- <hr>
293
- <p><a id="thenablereference"></a></p>
294
- <h3 id="thenablereference">ThenableReference</h3>
295
- <p>The return type of <a href="#push">push</a> — a regular <a href="#databasereference">DatabaseReference</a>
296
- with <code>.then</code> / <code>.catch</code> attached so it can be <code>await</code>ed. Mirrors
297
- <code>firebase/database</code>’s <code>ThenableReference</code> (<code>api/Reference_impl.ts:569</code>).</p>
298
- <p>Critical (DB-B7): the ref + its <code>.key</code> are available SYNCHRONOUSLY —
299
- the key is minted client-side. The promise covers only the optional
300
- value write; a rules-denied write rejects the promise (it does NOT
301
- throw synchronously and lose the key). Oracle:
302
- <code>rtdb-push-autoid-format.json</code>.</p>
303
- <h4 id="extends">Extends</h4>
304
- <ul>
305
- <li><a href="#databasereference"><code>DatabaseReference</code></a></li>
306
- </ul>
307
- <h4 id="properties-5">Properties</h4>
308
- <div class="table-scroll">
309
-
310
-
311
-
312
-
313
-
314
-
315
-
316
-
317
-
318
-
319
-
320
-
321
-
322
-
323
-
324
-
325
-
326
-
327
-
328
-
329
-
330
-
331
-
332
-
333
- <table><thead><tr><th align="left">Property</th><th align="left">Modifier</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><a id="key-2"></a> <code>key</code></td><td align="left"><code>readonly</code></td><td align="left"><code>string</code></td></tr><tr><td align="left"><a id="parent-1"></a> <code>parent</code></td><td align="left"><code>readonly</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a></td></tr><tr><td align="left"><a id="root-1"></a> <code>root</code></td><td align="left"><code>readonly</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a></td></tr></tbody></table></div>
334
- <h4 id="methods-3">Methods</h4>
335
- <p><a id="catch"></a></p>
336
- <h5 id="catch">catch()</h5>
337
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">catch</span><span style="color:#56B6C2">&#x3C;</span><span style="color:#E06C75">TResult</span><span style="color:#56B6C2">></span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">onrejected</span><span style="color:#C678DD">?:</span><span style="color:#ABB2BF"> (</span><span style="color:#E06C75;font-style:italic">reason</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">unknown</span><span style="color:#ABB2BF">) </span><span style="color:#C678DD">=></span><span style="color:#E06C75"> TResult</span><span style="color:#56B6C2"> |</span><span style="color:#E06C75"> PromiseLike</span><span style="color:#56B6C2">&#x3C;</span><span style="color:#E06C75">TResult</span><span style="color:#56B6C2">></span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">Promise</span><span style="color:#56B6C2">&#x3C;</span><span style="color:#E06C75">DatabaseReference</span><span style="color:#56B6C2"> |</span><span style="color:#E06C75"> TResult</span><span style="color:#56B6C2">></span><span style="color:#ABB2BF">;</span></span></code></pre>
338
- <h6 id="type-parameters">Type Parameters</h6>
339
- <div class="table-scroll">
340
-
341
-
342
-
343
-
344
-
345
-
346
-
347
-
348
-
349
-
350
-
351
-
352
- <table><thead><tr><th align="left">Type Parameter</th><th align="left">Default type</th></tr></thead><tbody><tr><td align="left"><code>TResult</code></td><td align="left"><code>never</code></td></tr></tbody></table></div>
353
- <h6 id="parameters-3">Parameters</h6>
354
- <div class="table-scroll">
355
-
356
-
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
-
365
-
366
-
367
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>onrejected?</code></td><td align="left">(<code>reason</code>: <code>unknown</code>) => <code>TResult</code> | <code>PromiseLike</code>&#x3C;<code>TResult</code>></td></tr></tbody></table></div>
368
- <h6 id="returns-10">Returns</h6>
369
- <p><code>Promise</code>&#x3C;<a href="#databasereference"><code>DatabaseReference</code></a> | <code>TResult</code>></p>
370
- <p><a id="then"></a></p>
371
- <h5 id="then">then()</h5>
372
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">then</span><span style="color:#ABB2BF">&#x3C;</span><span style="color:#E5C07B">TResult1</span><span style="color:#ABB2BF">, </span><span style="color:#E5C07B">TResult2</span><span style="color:#ABB2BF">>(</span><span style="color:#E06C75">onfulfilled</span><span style="color:#C678DD">?:</span><span style="color:#ABB2BF"> (</span><span style="color:#E06C75;font-style:italic">value</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF">) </span><span style="color:#C678DD">=></span><span style="color:#E06C75"> TResult1</span><span style="color:#56B6C2"> |</span><span style="color:#E06C75"> PromiseLike</span><span style="color:#56B6C2">&#x3C;</span><span style="color:#E06C75">TResult1</span><span style="color:#56B6C2">></span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">onrejected</span><span style="color:#C678DD">?:</span><span style="color:#ABB2BF"> (</span><span style="color:#E06C75;font-style:italic">reason</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">unknown</span><span style="color:#ABB2BF">) </span><span style="color:#C678DD">=></span><span style="color:#E06C75"> TResult2</span><span style="color:#56B6C2"> |</span><span style="color:#E06C75"> PromiseLike</span><span style="color:#56B6C2">&#x3C;</span><span style="color:#E06C75">TResult2</span><span style="color:#56B6C2">></span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">Promise</span><span style="color:#56B6C2">&#x3C;</span><span style="color:#E06C75">TResult1</span><span style="color:#56B6C2"> |</span><span style="color:#E06C75"> TResult2</span><span style="color:#56B6C2">></span><span style="color:#ABB2BF">;</span></span></code></pre>
373
- <h6 id="type-parameters-1">Type Parameters</h6>
374
- <div class="table-scroll">
375
-
376
-
377
-
378
-
379
-
380
-
381
-
382
-
383
-
384
-
385
-
386
-
387
-
388
-
389
-
390
-
391
- <table><thead><tr><th align="left">Type Parameter</th><th align="left">Default type</th></tr></thead><tbody><tr><td align="left"><code>TResult1</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a></td></tr><tr><td align="left"><code>TResult2</code></td><td align="left"><code>never</code></td></tr></tbody></table></div>
392
- <h6 id="parameters-4">Parameters</h6>
393
- <div class="table-scroll">
394
-
395
-
396
-
397
-
398
-
399
-
400
-
401
-
402
-
403
-
404
-
405
-
406
-
407
-
408
-
409
-
410
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>onfulfilled?</code></td><td align="left">(<code>value</code>: <a href="#databasereference"><code>DatabaseReference</code></a>) => <code>TResult1</code> | <code>PromiseLike</code>&#x3C;<code>TResult1</code>></td></tr><tr><td align="left"><code>onrejected?</code></td><td align="left">(<code>reason</code>: <code>unknown</code>) => <code>TResult2</code> | <code>PromiseLike</code>&#x3C;<code>TResult2</code>></td></tr></tbody></table></div>
411
- <h6 id="returns-11">Returns</h6>
412
- <p><code>Promise</code>&#x3C;<code>TResult1</code> | <code>TResult2</code>></p>
413
- <p><a id="tostring-4"></a></p>
414
- <h5 id="tostring-2">toString()</h5>
415
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">toString</span><span style="color:#ABB2BF">(): </span><span style="color:#E06C75">string</span><span style="color:#ABB2BF">;</span></span></code></pre>
416
- <h6 id="returns-12">Returns</h6>
417
- <p><code>string</code></p>
418
- <h6 id="inherited-from">Inherited from</h6>
419
- <p><a href="#databasereference"><code>DatabaseReference</code></a>.<a href="#tostring"><code>toString</code></a></p>
420
- <hr>
421
- <p><a id="transactionresult"></a></p>
422
- <h3 id="transactionresult">TransactionResult</h3>
423
- <p>Result of <a href="#runtransaction">runTransaction</a>. Matches <code>firebase/database</code>’s
424
- <code>TransactionResult</code> for the fields agent / playground code reads
425
- idiomatically.</p>
426
- <p><code>committed === false</code> when the update fn aborted by returning
427
- <code>undefined</code>. The snapshot still resolves — it reflects the <strong>pre-
428
- transaction</strong> value (oracle:
429
- <code>rtdb-modular-runtransaction-abort-undefined.json</code> →
430
- <code>afterValOnServer: 100</code> preserved).</p>
431
- <p>On rule denial the promise rejects with a plain <code>Error</code> whose
432
- <code>message === 'permission_denied'</code> (lowercase, no <code>.code</code>); see
433
- <code>rtdb-modular-runtransaction-on-rules-denied-path.json</code>.</p>
434
- <h4 id="properties-6">Properties</h4>
435
- <div class="table-scroll">
436
-
437
-
438
-
439
-
440
-
441
-
442
-
443
-
444
-
445
-
446
-
447
-
448
-
449
-
450
-
451
-
452
-
453
-
454
-
455
- <table><thead><tr><th align="left">Property</th><th align="left">Modifier</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><a id="committed"></a> <code>committed</code></td><td align="left"><code>readonly</code></td><td align="left"><code>boolean</code></td></tr><tr><td align="left"><a id="snapshot"></a> <code>snapshot</code></td><td align="left"><code>readonly</code></td><td align="left"><a href="#datasnapshot"><code>DataSnapshot</code></a></td></tr></tbody></table></div>
456
- <h2 id="type-aliases">Type Aliases</h2>
457
- <p><a id="appdatabase"></a></p>
458
- <h3 id="appdatabase">AppDatabase</h3>
459
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">type</span><span style="color:#E5C07B"> AppDatabase</span><span style="color:#56B6C2"> =</span><span style="color:#E5C07B"> Database</span><span style="color:#ABB2BF"> &#x26; {</span></span>
460
- <span class="line"><span style="color:#E06C75"> app</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">FirebaseApp</span><span style="color:#ABB2BF">;</span></span>
461
- <span class="line"><span style="color:#ABB2BF">};</span></span></code></pre>
462
- <p>Database handle returned by Firebase-shaped app overloads.</p>
463
- <h4 id="type-declaration">Type Declaration</h4>
464
- <h5 id="app">app</h5>
465
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#E06C75">readonly</span><span style="color:#E06C75"> app</span><span style="color:#ABB2BF">: </span><span style="color:#E06C75">FirebaseApp</span><span style="color:#ABB2BF">;</span></span></code></pre>
466
- <hr>
467
- <p><a id="jsonvalue"></a></p>
468
- <h3 id="jsonvalue">JsonValue</h3>
469
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">type</span><span style="color:#E5C07B"> JsonValue</span><span style="color:#56B6C2"> =</span></span>
470
- <span class="line"><span style="color:#ABB2BF"> | </span><span style="color:#E5C07B">null</span></span>
471
- <span class="line"><span style="color:#ABB2BF"> | </span><span style="color:#E5C07B">boolean</span></span>
472
- <span class="line"><span style="color:#ABB2BF"> | </span><span style="color:#E5C07B">number</span></span>
473
- <span class="line"><span style="color:#ABB2BF"> | </span><span style="color:#E5C07B">string</span></span>
474
- <span class="line"><span style="color:#ABB2BF"> | </span><span style="color:#E5C07B">JsonValue</span><span style="color:#ABB2BF">[]</span></span>
475
- <span class="line"><span style="color:#ABB2BF"> | {</span></span>
476
- <span class="line"><span style="color:#ABB2BF">[</span><span style="color:#E06C75;font-style:italic">key</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">]: </span><span style="color:#E5C07B">JsonValue</span><span style="color:#ABB2BF">;</span></span>
477
- <span class="line"><span style="color:#ABB2BF">};</span></span></code></pre>
478
- <p>RTDB-shaped in-memory JSON tree.</p>
479
- <p>The data layer for the modular SDK’s sandbox target. RTDB stores a
480
- single nested JSON tree; reads name a path and walk; writes either
481
- replace a subtree (<code>set</code>) or merge top-level keys (<code>update</code>).</p>
482
- <p>Path semantics (matches <code>firebase/database</code>):</p>
483
- <ul>
484
- <li><code>'/'</code> is the root.</li>
485
- <li>Leading + trailing slashes are stripped; empty segments are
486
- ignored.</li>
487
- <li><code>null</code> at any level erases that subtree. Locked by oracle
488
- observation
489
- <code>packages/conformance/observations/rtdb/rtdb-remove-vs-set-null.json</code> which
490
- says <code>set(ref, null)</code> and <code>remove(ref)</code> produce equivalent end
491
- states.</li>
492
- <li>A read of an absent path returns <code>null</code> (NOT an error). Matches
493
- the <code>DataSnapshot.val()</code> contract.</li>
494
- </ul>
495
- <p>Trimming: when a write or delete leaves a sibling-less empty branch,
496
- the empty branch is removed. RTDB’s documented invariant: “Empty
497
- nodes don’t exist”. The crawl + listener layers count on this so
498
- <code>exists()</code> and <code>hasChildren()</code> match prod.</p>
499
- <p>This module is identity-agnostic — rules evaluation happens in
500
- <code>local-environment.ts</code>. The tree just stores bytes.</p>
501
- <hr>
502
- <p><a id="unsubscribe"></a></p>
503
- <h3 id="unsubscribe">Unsubscribe()</h3>
504
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">type</span><span style="color:#E5C07B"> Unsubscribe</span><span style="color:#56B6C2"> =</span><span style="color:#ABB2BF"> () </span><span style="color:#C678DD">=></span><span style="color:#E5C07B"> void</span><span style="color:#ABB2BF">;</span></span></code></pre>
505
- <h4 id="returns-13">Returns</h4>
506
- <p><code>void</code></p>
507
- <h2 id="variables">Variables</h2>
508
- <p><a id="query_symbol-1"></a></p>
509
- <h3 id="query_symbol">QUERY_SYMBOL</h3>
510
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> QUERY_SYMBOL</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">unique</span><span style="color:#E5C07B"> symbol</span><span style="color:#ABB2BF">;</span></span></code></pre>
511
- <p>Hidden brand on every <a href="#query">Query</a> (and on every QueryConstraint).
512
- Distinct from <code>TARGET_SYMBOL</code>; this brand is only used to dispatch
513
- <code>get</code> / <code>onValue</code> between plain refs and query-wrapped refs.</p>
514
- <hr>
515
- <p><a id="sandbox"></a></p>
516
- <h3 id="sandbox">sandbox</h3>
517
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> sandbox</span><span style="color:#ABB2BF">: {</span></span>
518
- <span class="line"><span style="color:#E06C75"> setData</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">void</span><span style="color:#ABB2BF">;</span></span>
519
- <span class="line"><span style="color:#E06C75"> setRules</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">void</span><span style="color:#ABB2BF">;</span></span>
520
- <span class="line"><span style="color:#E06C75"> snapshotState</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">JsonValue</span><span style="color:#ABB2BF">;</span></span>
521
- <span class="line"><span style="color:#ABB2BF">};</span></span></code></pre>
522
- <h4 id="type-declaration-1">Type Declaration</h4>
523
- <p><a id="setdata"></a></p>
524
- <h5 id="setdata">setData()</h5>
525
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">setData</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">db</span><span style="color:#ABB2BF">: </span><span style="color:#E06C75">Database</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">data</span><span style="color:#ABB2BF">: </span><span style="color:#E06C75">Record</span><span style="color:#56B6C2">&#x3C;</span><span style="color:#E06C75">string</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">unknown</span><span style="color:#56B6C2">></span><span style="color:#ABB2BF">): </span><span style="color:#C678DD">void</span><span style="color:#ABB2BF">;</span></span></code></pre>
526
- <p>Bulk-load data bypassing rules. The supplied map’s keys are
527
- absolute paths (<code>'/users/alice'</code>) and the values land at those
528
- paths. Convenient for test fixtures.</p>
529
- <h6 id="parameters-5">Parameters</h6>
530
- <div class="table-scroll">
531
-
532
-
533
-
534
-
535
-
536
-
537
-
538
-
539
-
540
-
541
-
542
-
543
-
544
-
545
-
546
-
547
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>db</code></td><td align="left"><a href="#database"><code>Database</code></a></td></tr><tr><td align="left"><code>data</code></td><td align="left"><code>Record</code>&#x3C;<code>string</code>, <code>unknown</code>></td></tr></tbody></table></div>
548
- <h6 id="returns-14">Returns</h6>
549
- <p><code>void</code></p>
550
- <p><a id="setrules"></a></p>
551
- <h5 id="setrules">setRules()</h5>
552
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">setRules</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">db</span><span style="color:#ABB2BF">: </span><span style="color:#E06C75">Database</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">rulesJson</span><span style="color:#ABB2BF">: {</span></span>
553
- <span class="line"><span style="color:#E06C75"> rules</span><span style="color:#ABB2BF">: </span><span style="color:#E06C75">Record</span><span style="color:#56B6C2">&#x3C;</span><span style="color:#E06C75">string</span><span style="color:#ABB2BF">, unknown>;</span></span>
554
- <span class="line"><span style="color:#ABB2BF">}): </span><span style="color:#C678DD">void</span><span style="color:#ABB2BF">;</span></span></code></pre>
555
- <p>Replace deployed rules. Pass <code>null</code> to clear (sandbox returns to
556
- default-allow). Rules are evaluated through the existing
557
- RTDB rules simulator — the same engine used by the rules tooling.</p>
558
- <h6 id="parameters-6">Parameters</h6>
559
- <div class="table-scroll">
560
-
561
-
562
-
563
-
564
-
565
-
566
-
567
-
568
-
569
-
570
-
571
-
572
-
573
-
574
-
575
-
576
-
577
-
578
-
579
-
580
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>db</code></td><td align="left"><a href="#database"><code>Database</code></a></td></tr><tr><td align="left"><code>rulesJson</code></td><td align="left">{ <code>rules</code>: <code>Record</code>&#x3C;<code>string</code>, <code>unknown</code>>; }</td></tr><tr><td align="left"><code>rulesJson.rules</code></td><td align="left"><code>Record</code>&#x3C;<code>string</code>, <code>unknown</code>></td></tr></tbody></table></div>
581
- <h6 id="returns-15">Returns</h6>
582
- <p><code>void</code></p>
583
- <h6 id="example">Example</h6>
584
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#E5C07B">sandbox</span><span style="color:#ABB2BF">.</span><span style="color:#61AFEF">setRules</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">db</span><span style="color:#ABB2BF">, {</span></span>
585
- <span class="line"><span style="color:#E06C75"> rules</span><span style="color:#ABB2BF">: {</span></span>
586
- <span class="line"><span style="color:#98C379"> '.read'</span><span style="color:#ABB2BF">: </span><span style="color:#98C379">'auth != null'</span><span style="color:#ABB2BF">,</span></span>
587
- <span class="line"><span style="color:#98C379"> '.write'</span><span style="color:#ABB2BF">: </span><span style="color:#98C379">'auth != null'</span><span style="color:#ABB2BF">,</span></span>
588
- <span class="line"><span style="color:#ABB2BF"> },</span></span>
589
- <span class="line"><span style="color:#ABB2BF">});</span></span></code></pre>
590
- <p><a id="snapshotstate"></a></p>
591
- <h5 id="snapshotstate">snapshotState()</h5>
592
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#61AFEF">snapshotState</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">db</span><span style="color:#ABB2BF">: </span><span style="color:#E06C75">Database</span><span style="color:#ABB2BF">): </span><span style="color:#E06C75">JsonValue</span><span style="color:#ABB2BF">;</span></span></code></pre>
593
- <p>Snapshot the full sandbox tree (rule-bypass read). Usually a keyed
594
- object; may be a primitive when the root holds one (DB-B13).</p>
595
- <h6 id="parameters-7">Parameters</h6>
596
- <div class="table-scroll">
597
-
598
-
599
-
600
-
601
-
602
-
603
-
604
-
605
-
606
-
607
-
608
-
609
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>db</code></td><td align="left"><a href="#database"><code>Database</code></a></td></tr></tbody></table></div>
610
- <h6 id="returns-16">Returns</h6>
611
- <p><a href="#jsonvalue"><code>JsonValue</code></a></p>
612
- <hr>
613
- <p><a id="target_symbol-1"></a></p>
614
- <h3 id="target_symbol">TARGET_SYMBOL</h3>
615
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> TARGET_SYMBOL</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">unique</span><span style="color:#E5C07B"> symbol</span><span style="color:#ABB2BF">;</span></span></code></pre>
616
- <p>Hidden brand on every <a href="#database">Database</a> handle.</p>
617
- <h2 id="functions">Functions</h2>
618
- <p><a id="child-2"></a></p>
619
- <h3 id="child-1">child()</h3>
620
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> child</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">parent</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75;font-style:italic">path</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF">;</span></span></code></pre>
621
- <p>Sub-path constructor. <code>child(ref, 'sub/path')</code> returns a ref at
622
- <code>&#x3C;ref>/sub/path</code>.</p>
623
- <p>Mirrors <code>firebase/database</code>’s <code>child(parent, path)</code> — leading +
624
- empty segments stripped; the result inherits the parent’s target.</p>
625
- <h4 id="parameters-8">Parameters</h4>
626
- <div class="table-scroll">
627
-
628
-
629
-
630
-
631
-
632
-
633
-
634
-
635
-
636
-
637
-
638
-
639
-
640
-
641
-
642
-
643
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>parent</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a></td></tr><tr><td align="left"><code>path</code></td><td align="left"><code>string</code></td></tr></tbody></table></div>
644
- <h4 id="returns-17">Returns</h4>
645
- <p><a href="#databasereference"><code>DatabaseReference</code></a></p>
646
- <hr>
647
- <p><a id="connectdatabaseemulator"></a></p>
648
- <h3 id="connectdatabaseemulator">connectDatabaseEmulator()</h3>
649
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> connectDatabaseEmulator</span><span style="color:#ABB2BF">(</span></span>
650
- <span class="line"><span style="color:#E06C75;font-style:italic"> _db</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">Database</span><span style="color:#ABB2BF">,</span></span>
651
- <span class="line"><span style="color:#E06C75;font-style:italic"> _host</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">,</span></span>
652
- <span class="line"><span style="color:#E06C75;font-style:italic"> _port</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">number</span><span style="color:#ABB2BF">,</span></span>
653
- <span class="line"><span style="color:#E06C75;font-style:italic"> _options</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: {</span></span>
654
- <span class="line"><span style="color:#E06C75"> mockUserToken</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF"> | </span><span style="color:#E5C07B">Record</span><span style="color:#ABB2BF">&#x3C;</span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">, </span><span style="color:#E5C07B">unknown</span><span style="color:#ABB2BF">>;</span></span>
655
- <span class="line"><span style="color:#ABB2BF">}): </span><span style="color:#E5C07B">void</span><span style="color:#ABB2BF">;</span></span></code></pre>
656
- <p><code>connectDatabaseEmulator(db, host, port)</code> is an accepted no-op because the
657
- selected backend already is the local sandbox.</p>
658
- <h4 id="parameters-9">Parameters</h4>
659
- <div class="table-scroll">
660
-
661
-
662
-
663
-
664
-
665
-
666
-
667
-
668
-
669
-
670
-
671
-
672
-
673
-
674
-
675
-
676
-
677
-
678
-
679
-
680
-
681
-
682
-
683
-
684
-
685
-
686
-
687
-
688
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>_db</code></td><td align="left"><a href="#database"><code>Database</code></a></td></tr><tr><td align="left"><code>_host</code></td><td align="left"><code>string</code></td></tr><tr><td align="left"><code>_port</code></td><td align="left"><code>number</code></td></tr><tr><td align="left"><code>_options?</code></td><td align="left">{ <code>mockUserToken?</code>: <code>string</code> | <code>Record</code>&#x3C;<code>string</code>, <code>unknown</code>>; }</td></tr><tr><td align="left"><code>_options.mockUserToken?</code></td><td align="left"><code>string</code> | <code>Record</code>&#x3C;<code>string</code>, <code>unknown</code>></td></tr></tbody></table></div>
689
- <h4 id="returns-18">Returns</h4>
690
- <p><code>void</code></p>
691
- <hr>
692
- <p><a id="enablelogging"></a></p>
693
- <h3 id="enablelogging">enableLogging()</h3>
694
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> enableLogging</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">logger</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">boolean</span><span style="color:#ABB2BF"> | (</span><span style="color:#E06C75;font-style:italic">message</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">) </span><span style="color:#C678DD">=></span><span style="color:#E5C07B"> void</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75;font-style:italic">persistent</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">boolean</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">void</span><span style="color:#ABB2BF">;</span></span></code></pre>
695
- <p><code>enableLogging(logger?, persistent?)</code> — toggle RTDB SDK logging.</p>
696
- <p>Accepted no-op: the sandbox has no modular-SDK-style logger to wire a
697
- level/sink into (it uses host-level <code>console</code> logging directly, gated
698
- by <code>pyric dev</code>’s own flags — matching <code>pyric/firestore</code>’s
699
- <code>setLogLevel</code>). Accepted so init code that calls it compiles + runs.</p>
700
- <h4 id="parameters-10">Parameters</h4>
701
- <div class="table-scroll">
702
-
703
-
704
-
705
-
706
-
707
-
708
-
709
-
710
-
711
-
712
-
713
-
714
-
715
-
716
-
717
-
718
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>logger?</code></td><td align="left"><code>boolean</code> | (<code>message</code>: <code>string</code>) => <code>void</code></td></tr><tr><td align="left"><code>persistent?</code></td><td align="left"><code>boolean</code></td></tr></tbody></table></div>
719
- <h4 id="returns-19">Returns</h4>
720
- <p><code>void</code></p>
721
- <hr>
722
- <p><a id="endat"></a></p>
723
- <h3 id="endat">endAt()</h3>
724
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> endAt</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">value</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">JsonValue</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75;font-style:italic">key</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">QueryConstraint</span><span style="color:#ABB2BF">;</span></span></code></pre>
725
- <p><code>endAt(value, key?)</code> — INCLUSIVE upper bound. Adjacent to startAt;
726
- same key tie-breaker semantics.</p>
727
- <h4 id="parameters-11">Parameters</h4>
728
- <div class="table-scroll">
729
-
730
-
731
-
732
-
733
-
734
-
735
-
736
-
737
-
738
-
739
-
740
-
741
-
742
-
743
-
744
-
745
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>value</code></td><td align="left"><a href="#jsonvalue"><code>JsonValue</code></a></td></tr><tr><td align="left"><code>key?</code></td><td align="left"><code>string</code></td></tr></tbody></table></div>
746
- <h4 id="returns-20">Returns</h4>
747
- <p><a href="#queryconstraint"><code>QueryConstraint</code></a></p>
748
- <hr>
749
- <p><a id="endbefore"></a></p>
750
- <h3 id="endbefore">endBefore()</h3>
751
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> endBefore</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">value</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">JsonValue</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75;font-style:italic">key</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">QueryConstraint</span><span style="color:#ABB2BF">;</span></span></code></pre>
752
- <p><code>endBefore(value, key?)</code> — EXCLUSIVE upper bound. Locked by
753
- <code>rtdb-modular-startafter-endbefore-exclusive.json</code>.</p>
754
- <h4 id="parameters-12">Parameters</h4>
755
- <div class="table-scroll">
756
-
757
-
758
-
759
-
760
-
761
-
762
-
763
-
764
-
765
-
766
-
767
-
768
-
769
-
770
-
771
-
772
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>value</code></td><td align="left"><a href="#jsonvalue"><code>JsonValue</code></a></td></tr><tr><td align="left"><code>key?</code></td><td align="left"><code>string</code></td></tr></tbody></table></div>
773
- <h4 id="returns-21">Returns</h4>
774
- <p><a href="#queryconstraint"><code>QueryConstraint</code></a></p>
775
- <hr>
776
- <p><a id="equalto"></a></p>
777
- <h3 id="equalto">equalTo()</h3>
778
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> equalTo</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">value</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">JsonValue</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75;font-style:italic">key</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">QueryConstraint</span><span style="color:#ABB2BF">;</span></span></code></pre>
779
- <p><code>equalTo(value, key?)</code> — sugar for <code>startAt(value, key) + endAt(value, key)</code>. Returns ALL matching children (no uniqueness).
780
- Locked by oracle observation <code>rtdb-modular-equalTo-filter.json</code>.</p>
781
- <h4 id="parameters-13">Parameters</h4>
782
- <div class="table-scroll">
783
-
784
-
785
-
786
-
787
-
788
-
789
-
790
-
791
-
792
-
793
-
794
-
795
-
796
-
797
-
798
-
799
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>value</code></td><td align="left"><a href="#jsonvalue"><code>JsonValue</code></a></td></tr><tr><td align="left"><code>key?</code></td><td align="left"><code>string</code></td></tr></tbody></table></div>
800
- <h4 id="returns-22">Returns</h4>
801
- <p><a href="#queryconstraint"><code>QueryConstraint</code></a></p>
802
- <hr>
803
- <p><a id="forcelongpolling"></a></p>
804
- <h3 id="forcelongpolling">forceLongPolling()</h3>
805
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> forceLongPolling</span><span style="color:#ABB2BF">(): </span><span style="color:#E5C07B">void</span><span style="color:#ABB2BF">;</span></span></code></pre>
806
- <p><code>forceLongPolling()</code> — force the long-polling transport for all
807
- subsequent <code>getDatabase</code> connections.</p>
808
- <p>No-op: transport selection is meaningless to the in-process/worker
809
- sandbox, which never opens a real socket. Accepted so init code that
810
- calls it unconditionally compiles + runs.</p>
811
- <h4 id="returns-23">Returns</h4>
812
- <p><code>void</code></p>
813
- <hr>
814
- <p><a id="forcewebsockets"></a></p>
815
- <h3 id="forcewebsockets">forceWebSockets()</h3>
816
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> forceWebSockets</span><span style="color:#ABB2BF">(): </span><span style="color:#E5C07B">void</span><span style="color:#ABB2BF">;</span></span></code></pre>
817
- <p><code>forceWebSockets()</code> — force the WebSocket transport for all
818
- subsequent <code>getDatabase</code> connections.</p>
819
- <p>No-op: transport selection is not applicable to the in-process/worker
820
- sandbox (see <a href="#forcelongpolling">forceLongPolling</a>).</p>
821
- <h4 id="returns-24">Returns</h4>
822
- <p><code>void</code></p>
823
- <hr>
824
- <p><a id="get"></a></p>
825
- <h3 id="get">get()</h3>
826
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> get</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">r</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF"> | </span><span style="color:#E5C07B">Query</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">Promise</span><span style="color:#ABB2BF">&#x3C;</span><span style="color:#E5C07B">DataSnapshot</span><span style="color:#ABB2BF">>;</span></span></code></pre>
827
- <p><code>get(ref)</code> — one-shot read at the ref’s path. Resolves to a
828
- <code>DataSnapshot</code>-shaped object.</p>
829
- <p>Runs through the sandbox rule engine; denial throws the plain-<code>Error</code>
830
- shape locked by the oracle.</p>
831
- <p>Absent path → <code>snap.val() === null &#x26;&#x26; snap.exists() === false</code>.
832
- Matches the SDK’s <code>DataSnapshot.val()</code> contract.</p>
833
- <h4 id="parameters-14">Parameters</h4>
834
- <div class="table-scroll">
835
-
836
-
837
-
838
-
839
-
840
-
841
-
842
-
843
-
844
-
845
-
846
-
847
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>r</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a> | <a href="#query"><code>Query</code></a></td></tr></tbody></table></div>
848
- <h4 id="returns-25">Returns</h4>
849
- <p><code>Promise</code>&#x3C;<a href="#datasnapshot"><code>DataSnapshot</code></a>></p>
850
- <hr>
851
- <p><a id="getadmindatabase"></a></p>
852
- <h3 id="getadmindatabase">getAdminDatabase()</h3>
853
- <h4 id="call-signature">Call Signature</h4>
854
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> getAdminDatabase</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">sandbox</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">Sandbox</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">Database</span><span style="color:#ABB2BF">;</span></span></code></pre>
855
- <p>Sandbox-only rules-bypass RTDB handle. Mirrors Firestore’s
856
- <code>getAdminFirestore(sandbox)</code> for Studio/Playground data browsers and
857
- controlled admin tools.</p>
858
- <h5 id="parameters-15">Parameters</h5>
859
- <div class="table-scroll">
860
-
861
-
862
-
863
-
864
-
865
-
866
-
867
-
868
-
869
-
870
-
871
-
872
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>sandbox</code></td><td align="left"><a href="/docs/pyric-firestore-reference-api/#sandbox"><code>Sandbox</code></a></td></tr></tbody></table></div>
873
- <h5 id="returns-26">Returns</h5>
874
- <p><a href="#database"><code>Database</code></a></p>
875
- <h4 id="call-signature-1">Call Signature</h4>
876
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> getAdminDatabase</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">ctx</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">SandboxContext</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">Database</span><span style="color:#ABB2BF">;</span></span></code></pre>
877
- <p>Sandbox-only rules-bypass RTDB handle. Mirrors Firestore’s
878
- <code>getAdminFirestore(sandbox)</code> for Studio/Playground data browsers and
879
- controlled admin tools.</p>
880
- <h5 id="parameters-16">Parameters</h5>
881
- <div class="table-scroll">
882
-
883
-
884
-
885
-
886
-
887
-
888
-
889
-
890
-
891
-
892
-
893
-
894
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>ctx</code></td><td align="left"><a href="/docs/pyric-firestore-reference-api/#sandboxcontext"><code>SandboxContext</code></a></td></tr></tbody></table></div>
895
- <h5 id="returns-27">Returns</h5>
896
- <p><a href="#database"><code>Database</code></a></p>
897
- <h4 id="call-signature-2">Call Signature</h4>
898
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> getAdminDatabase</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">app</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">FirebaseApp</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">Database</span><span style="color:#ABB2BF">;</span></span></code></pre>
899
- <p>Sandbox-only rules-bypass RTDB handle. Mirrors Firestore’s
900
- <code>getAdminFirestore(sandbox)</code> for Studio/Playground data browsers and
901
- controlled admin tools.</p>
902
- <h5 id="parameters-17">Parameters</h5>
903
- <div class="table-scroll">
904
-
905
-
906
-
907
-
908
-
909
-
910
-
911
-
912
-
913
-
914
-
915
-
916
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>app</code></td><td align="left"><a href="/docs/pyric-app-reference-api/#firebaseapp"><code>FirebaseApp</code></a></td></tr></tbody></table></div>
917
- <h5 id="returns-28">Returns</h5>
918
- <p><a href="#database"><code>Database</code></a></p>
919
- <hr>
920
- <p><a id="getdatabase"></a></p>
921
- <h3 id="getdatabase">getDatabase()</h3>
922
- <h4 id="call-signature-3">Call Signature</h4>
923
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> getDatabase</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">ctx</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">SandboxContext</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">Database</span><span style="color:#ABB2BF">;</span></span></code></pre>
924
- <p>Build a sandbox Database handle:</p>
925
- <ul>
926
- <li><code>SandboxContext</code> → sandbox-backed, frozen identity.</li>
927
- <li><code>Sandbox</code> → sandbox-backed, live identity (per-op <code>currentUser</code>).</li>
928
- </ul>
929
- <h5 id="parameters-18">Parameters</h5>
930
- <div class="table-scroll">
931
-
932
-
933
-
934
-
935
-
936
-
937
-
938
-
939
-
940
-
941
-
942
-
943
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>ctx</code></td><td align="left"><a href="/docs/pyric-firestore-reference-api/#sandboxcontext"><code>SandboxContext</code></a></td></tr></tbody></table></div>
944
- <h5 id="returns-29">Returns</h5>
945
- <p><a href="#database"><code>Database</code></a></p>
946
- <h5 id="example-1">Example</h5>
947
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">import</span><span style="color:#ABB2BF"> { </span><span style="color:#E06C75">initializeSandbox</span><span style="color:#ABB2BF"> } </span><span style="color:#C678DD">from</span><span style="color:#98C379"> 'pyric/sandbox'</span><span style="color:#ABB2BF">;</span></span>
948
- <span class="line"><span style="color:#C678DD">import</span><span style="color:#ABB2BF"> { </span><span style="color:#E06C75">getDatabase</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">ref</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">set</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">get</span><span style="color:#ABB2BF"> } </span><span style="color:#C678DD">from</span><span style="color:#98C379"> 'pyric/database'</span><span style="color:#ABB2BF">;</span></span>
949
- <span class="line"></span>
950
- <span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> sandbox</span><span style="color:#56B6C2"> =</span><span style="color:#61AFEF"> initializeSandbox</span><span style="color:#ABB2BF">();</span></span>
951
- <span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> db</span><span style="color:#56B6C2"> =</span><span style="color:#61AFEF"> getDatabase</span><span style="color:#ABB2BF">(</span><span style="color:#E5C07B">sandbox</span><span style="color:#ABB2BF">.</span><span style="color:#61AFEF">withAuth</span><span style="color:#ABB2BF">({ </span><span style="color:#E06C75">uid</span><span style="color:#ABB2BF">: </span><span style="color:#98C379">'alice'</span><span style="color:#ABB2BF"> }));</span></span>
952
- <span class="line"><span style="color:#C678DD">await</span><span style="color:#61AFEF"> set</span><span style="color:#ABB2BF">(</span><span style="color:#61AFEF">ref</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">db</span><span style="color:#ABB2BF">, </span><span style="color:#98C379">'greetings/hello'</span><span style="color:#ABB2BF">), { </span><span style="color:#E06C75">text</span><span style="color:#ABB2BF">: </span><span style="color:#98C379">'hi'</span><span style="color:#ABB2BF"> });</span></span>
953
- <span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> snap</span><span style="color:#56B6C2"> =</span><span style="color:#C678DD"> await</span><span style="color:#61AFEF"> get</span><span style="color:#ABB2BF">(</span><span style="color:#61AFEF">ref</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">db</span><span style="color:#ABB2BF">, </span><span style="color:#98C379">'greetings/hello'</span><span style="color:#ABB2BF">));</span></span>
954
- <span class="line"><span style="color:#E5C07B">console</span><span style="color:#ABB2BF">.</span><span style="color:#61AFEF">log</span><span style="color:#ABB2BF">(</span><span style="color:#E5C07B">snap</span><span style="color:#ABB2BF">.</span><span style="color:#61AFEF">val</span><span style="color:#ABB2BF">()); </span><span style="color:#7F848E;font-style:italic">// { text: 'hi' }</span></span></code></pre>
955
- <h4 id="call-signature-4">Call Signature</h4>
956
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> getDatabase</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">sandbox</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">Sandbox</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">Database</span><span style="color:#ABB2BF">;</span></span></code></pre>
957
- <p>Build a sandbox Database handle:</p>
958
- <ul>
959
- <li><code>SandboxContext</code> → sandbox-backed, frozen identity.</li>
960
- <li><code>Sandbox</code> → sandbox-backed, live identity (per-op <code>currentUser</code>).</li>
961
- </ul>
962
- <h5 id="parameters-19">Parameters</h5>
963
- <div class="table-scroll">
964
-
965
-
966
-
967
-
968
-
969
-
970
-
971
-
972
-
973
-
974
-
975
-
976
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>sandbox</code></td><td align="left"><a href="/docs/pyric-firestore-reference-api/#sandbox"><code>Sandbox</code></a></td></tr></tbody></table></div>
977
- <h5 id="returns-30">Returns</h5>
978
- <p><a href="#database"><code>Database</code></a></p>
979
- <h5 id="example-2">Example</h5>
980
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">import</span><span style="color:#ABB2BF"> { </span><span style="color:#E06C75">initializeSandbox</span><span style="color:#ABB2BF"> } </span><span style="color:#C678DD">from</span><span style="color:#98C379"> 'pyric/sandbox'</span><span style="color:#ABB2BF">;</span></span>
981
- <span class="line"><span style="color:#C678DD">import</span><span style="color:#ABB2BF"> { </span><span style="color:#E06C75">getDatabase</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">ref</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">set</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">get</span><span style="color:#ABB2BF"> } </span><span style="color:#C678DD">from</span><span style="color:#98C379"> 'pyric/database'</span><span style="color:#ABB2BF">;</span></span>
982
- <span class="line"></span>
983
- <span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> sandbox</span><span style="color:#56B6C2"> =</span><span style="color:#61AFEF"> initializeSandbox</span><span style="color:#ABB2BF">();</span></span>
984
- <span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> db</span><span style="color:#56B6C2"> =</span><span style="color:#61AFEF"> getDatabase</span><span style="color:#ABB2BF">(</span><span style="color:#E5C07B">sandbox</span><span style="color:#ABB2BF">.</span><span style="color:#61AFEF">withAuth</span><span style="color:#ABB2BF">({ </span><span style="color:#E06C75">uid</span><span style="color:#ABB2BF">: </span><span style="color:#98C379">'alice'</span><span style="color:#ABB2BF"> }));</span></span>
985
- <span class="line"><span style="color:#C678DD">await</span><span style="color:#61AFEF"> set</span><span style="color:#ABB2BF">(</span><span style="color:#61AFEF">ref</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">db</span><span style="color:#ABB2BF">, </span><span style="color:#98C379">'greetings/hello'</span><span style="color:#ABB2BF">), { </span><span style="color:#E06C75">text</span><span style="color:#ABB2BF">: </span><span style="color:#98C379">'hi'</span><span style="color:#ABB2BF"> });</span></span>
986
- <span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> snap</span><span style="color:#56B6C2"> =</span><span style="color:#C678DD"> await</span><span style="color:#61AFEF"> get</span><span style="color:#ABB2BF">(</span><span style="color:#61AFEF">ref</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">db</span><span style="color:#ABB2BF">, </span><span style="color:#98C379">'greetings/hello'</span><span style="color:#ABB2BF">));</span></span>
987
- <span class="line"><span style="color:#E5C07B">console</span><span style="color:#ABB2BF">.</span><span style="color:#61AFEF">log</span><span style="color:#ABB2BF">(</span><span style="color:#E5C07B">snap</span><span style="color:#ABB2BF">.</span><span style="color:#61AFEF">val</span><span style="color:#ABB2BF">()); </span><span style="color:#7F848E;font-style:italic">// { text: 'hi' }</span></span></code></pre>
988
- <h4 id="call-signature-5">Call Signature</h4>
989
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> getDatabase</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">app</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">FirebaseApp</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">AppDatabase</span><span style="color:#ABB2BF">;</span></span></code></pre>
990
- <p>Build a sandbox Database handle:</p>
991
- <ul>
992
- <li><code>SandboxContext</code> → sandbox-backed, frozen identity.</li>
993
- <li><code>Sandbox</code> → sandbox-backed, live identity (per-op <code>currentUser</code>).</li>
994
- </ul>
995
- <h5 id="parameters-20">Parameters</h5>
996
- <div class="table-scroll">
997
-
998
-
999
-
1000
-
1001
-
1002
-
1003
-
1004
-
1005
-
1006
-
1007
-
1008
-
1009
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>app</code></td><td align="left"><a href="/docs/pyric-app-reference-api/#firebaseapp"><code>FirebaseApp</code></a></td></tr></tbody></table></div>
1010
- <h5 id="returns-31">Returns</h5>
1011
- <p><a href="#appdatabase"><code>AppDatabase</code></a></p>
1012
- <h5 id="example-3">Example</h5>
1013
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">import</span><span style="color:#ABB2BF"> { </span><span style="color:#E06C75">initializeSandbox</span><span style="color:#ABB2BF"> } </span><span style="color:#C678DD">from</span><span style="color:#98C379"> 'pyric/sandbox'</span><span style="color:#ABB2BF">;</span></span>
1014
- <span class="line"><span style="color:#C678DD">import</span><span style="color:#ABB2BF"> { </span><span style="color:#E06C75">getDatabase</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">ref</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">set</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">get</span><span style="color:#ABB2BF"> } </span><span style="color:#C678DD">from</span><span style="color:#98C379"> 'pyric/database'</span><span style="color:#ABB2BF">;</span></span>
1015
- <span class="line"></span>
1016
- <span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> sandbox</span><span style="color:#56B6C2"> =</span><span style="color:#61AFEF"> initializeSandbox</span><span style="color:#ABB2BF">();</span></span>
1017
- <span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> db</span><span style="color:#56B6C2"> =</span><span style="color:#61AFEF"> getDatabase</span><span style="color:#ABB2BF">(</span><span style="color:#E5C07B">sandbox</span><span style="color:#ABB2BF">.</span><span style="color:#61AFEF">withAuth</span><span style="color:#ABB2BF">({ </span><span style="color:#E06C75">uid</span><span style="color:#ABB2BF">: </span><span style="color:#98C379">'alice'</span><span style="color:#ABB2BF"> }));</span></span>
1018
- <span class="line"><span style="color:#C678DD">await</span><span style="color:#61AFEF"> set</span><span style="color:#ABB2BF">(</span><span style="color:#61AFEF">ref</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">db</span><span style="color:#ABB2BF">, </span><span style="color:#98C379">'greetings/hello'</span><span style="color:#ABB2BF">), { </span><span style="color:#E06C75">text</span><span style="color:#ABB2BF">: </span><span style="color:#98C379">'hi'</span><span style="color:#ABB2BF"> });</span></span>
1019
- <span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> snap</span><span style="color:#56B6C2"> =</span><span style="color:#C678DD"> await</span><span style="color:#61AFEF"> get</span><span style="color:#ABB2BF">(</span><span style="color:#61AFEF">ref</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">db</span><span style="color:#ABB2BF">, </span><span style="color:#98C379">'greetings/hello'</span><span style="color:#ABB2BF">));</span></span>
1020
- <span class="line"><span style="color:#E5C07B">console</span><span style="color:#ABB2BF">.</span><span style="color:#61AFEF">log</span><span style="color:#ABB2BF">(</span><span style="color:#E5C07B">snap</span><span style="color:#ABB2BF">.</span><span style="color:#61AFEF">val</span><span style="color:#ABB2BF">()); </span><span style="color:#7F848E;font-style:italic">// { text: 'hi' }</span></span></code></pre>
1021
- <h4 id="call-signature-6">Call Signature</h4>
1022
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> getDatabase</span><span style="color:#ABB2BF">(): </span><span style="color:#E5C07B">AppDatabase</span><span style="color:#ABB2BF">;</span></span></code></pre>
1023
- <p>Build a sandbox Database handle:</p>
1024
- <ul>
1025
- <li><code>SandboxContext</code> → sandbox-backed, frozen identity.</li>
1026
- <li><code>Sandbox</code> → sandbox-backed, live identity (per-op <code>currentUser</code>).</li>
1027
- </ul>
1028
- <h5 id="returns-32">Returns</h5>
1029
- <p><a href="#appdatabase"><code>AppDatabase</code></a></p>
1030
- <h5 id="example-4">Example</h5>
1031
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">import</span><span style="color:#ABB2BF"> { </span><span style="color:#E06C75">initializeSandbox</span><span style="color:#ABB2BF"> } </span><span style="color:#C678DD">from</span><span style="color:#98C379"> 'pyric/sandbox'</span><span style="color:#ABB2BF">;</span></span>
1032
- <span class="line"><span style="color:#C678DD">import</span><span style="color:#ABB2BF"> { </span><span style="color:#E06C75">getDatabase</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">ref</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">set</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75">get</span><span style="color:#ABB2BF"> } </span><span style="color:#C678DD">from</span><span style="color:#98C379"> 'pyric/database'</span><span style="color:#ABB2BF">;</span></span>
1033
- <span class="line"></span>
1034
- <span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> sandbox</span><span style="color:#56B6C2"> =</span><span style="color:#61AFEF"> initializeSandbox</span><span style="color:#ABB2BF">();</span></span>
1035
- <span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> db</span><span style="color:#56B6C2"> =</span><span style="color:#61AFEF"> getDatabase</span><span style="color:#ABB2BF">(</span><span style="color:#E5C07B">sandbox</span><span style="color:#ABB2BF">.</span><span style="color:#61AFEF">withAuth</span><span style="color:#ABB2BF">({ </span><span style="color:#E06C75">uid</span><span style="color:#ABB2BF">: </span><span style="color:#98C379">'alice'</span><span style="color:#ABB2BF"> }));</span></span>
1036
- <span class="line"><span style="color:#C678DD">await</span><span style="color:#61AFEF"> set</span><span style="color:#ABB2BF">(</span><span style="color:#61AFEF">ref</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">db</span><span style="color:#ABB2BF">, </span><span style="color:#98C379">'greetings/hello'</span><span style="color:#ABB2BF">), { </span><span style="color:#E06C75">text</span><span style="color:#ABB2BF">: </span><span style="color:#98C379">'hi'</span><span style="color:#ABB2BF"> });</span></span>
1037
- <span class="line"><span style="color:#C678DD">const</span><span style="color:#E5C07B"> snap</span><span style="color:#56B6C2"> =</span><span style="color:#C678DD"> await</span><span style="color:#61AFEF"> get</span><span style="color:#ABB2BF">(</span><span style="color:#61AFEF">ref</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75">db</span><span style="color:#ABB2BF">, </span><span style="color:#98C379">'greetings/hello'</span><span style="color:#ABB2BF">));</span></span>
1038
- <span class="line"><span style="color:#E5C07B">console</span><span style="color:#ABB2BF">.</span><span style="color:#61AFEF">log</span><span style="color:#ABB2BF">(</span><span style="color:#E5C07B">snap</span><span style="color:#ABB2BF">.</span><span style="color:#61AFEF">val</span><span style="color:#ABB2BF">()); </span><span style="color:#7F848E;font-style:italic">// { text: 'hi' }</span></span></code></pre>
1039
- <hr>
1040
- <p><a id="gooffline"></a></p>
1041
- <h3 id="gooffline">goOffline()</h3>
1042
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> goOffline</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">_db</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">Database</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">void</span><span style="color:#ABB2BF">;</span></span></code></pre>
1043
- <p><code>goOffline(db)</code> — disconnect the client from the RTDB backend.</p>
1044
- <p>No-op on sandbox handles: there is NO network connection in the local
1045
- sandbox to toggle, so honest behavior is to accept the call and do
1046
- nothing (we deliberately do NOT simulate a disconnect — pending
1047
- writes, listeners, and <code>get()</code> all keep working exactly as before).</p>
1048
- <h4 id="parameters-21">Parameters</h4>
1049
- <div class="table-scroll">
1050
-
1051
-
1052
-
1053
-
1054
-
1055
-
1056
-
1057
-
1058
-
1059
-
1060
-
1061
-
1062
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>_db</code></td><td align="left"><a href="#database"><code>Database</code></a></td></tr></tbody></table></div>
1063
- <h4 id="returns-33">Returns</h4>
1064
- <p><code>void</code></p>
1065
- <hr>
1066
- <p><a id="goonline"></a></p>
1067
- <h3 id="goonline">goOnline()</h3>
1068
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> goOnline</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">_db</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">Database</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">void</span><span style="color:#ABB2BF">;</span></span></code></pre>
1069
- <p><code>goOnline(db)</code> — reconnect the client to the RTDB backend.</p>
1070
- <p>No-op on sandbox handles (there is no connection to reopen — see
1071
- <a href="#gooffline">goOffline</a>).</p>
1072
- <h4 id="parameters-22">Parameters</h4>
1073
- <div class="table-scroll">
1074
-
1075
-
1076
-
1077
-
1078
-
1079
-
1080
-
1081
-
1082
-
1083
-
1084
-
1085
-
1086
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>_db</code></td><td align="left"><a href="#database"><code>Database</code></a></td></tr></tbody></table></div>
1087
- <h4 id="returns-34">Returns</h4>
1088
- <p><code>void</code></p>
1089
- <hr>
1090
- <p><a id="increment"></a></p>
1091
- <h3 id="increment">increment()</h3>
1092
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> increment</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">delta</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">number</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">IncrementSentinel</span><span style="color:#ABB2BF">;</span></span></code></pre>
1093
- <p><code>increment(delta)</code> — returns the <code>{ ".sv": { increment: delta } }</code>
1094
- sentinel that atomically adds <code>delta</code> to the current value at the
1095
- write’s field. Starts from <code>0</code> when the field is absent or
1096
- non-numeric (oracle: <code>rtdb-modular-increment-from-missing.json</code>).</p>
1097
- <p>The sandbox backend resolves it against the field’s prior value at write
1098
- time. Mirrors <code>firebase/database</code>’s <code>increment</code> (<code>api/ServerValue.ts:38-44</code>).</p>
1099
- <h4 id="parameters-23">Parameters</h4>
1100
- <div class="table-scroll">
1101
-
1102
-
1103
-
1104
-
1105
-
1106
-
1107
-
1108
-
1109
-
1110
-
1111
-
1112
-
1113
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>delta</code></td><td align="left"><code>number</code></td></tr></tbody></table></div>
1114
- <h4 id="returns-35">Returns</h4>
1115
- <p><code>IncrementSentinel</code></p>
1116
- <hr>
1117
- <p><a id="limittofirst"></a></p>
1118
- <h3 id="limittofirst">limitToFirst()</h3>
1119
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> limitToFirst</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">n</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">number</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">QueryConstraint</span><span style="color:#ABB2BF">;</span></span></code></pre>
1120
- <p><code>limitToFirst(n)</code> — keep the first N children of the ordered window.
1121
- Locked by oracle observation <code>rtdb-modular-limittofirst-vs-limittolast.json</code>.</p>
1122
- <h4 id="parameters-24">Parameters</h4>
1123
- <div class="table-scroll">
1124
-
1125
-
1126
-
1127
-
1128
-
1129
-
1130
-
1131
-
1132
-
1133
-
1134
-
1135
-
1136
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>n</code></td><td align="left"><code>number</code></td></tr></tbody></table></div>
1137
- <h4 id="returns-36">Returns</h4>
1138
- <p><a href="#queryconstraint"><code>QueryConstraint</code></a></p>
1139
- <hr>
1140
- <p><a id="limittolast"></a></p>
1141
- <h3 id="limittolast">limitToLast()</h3>
1142
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> limitToLast</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">n</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">number</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">QueryConstraint</span><span style="color:#ABB2BF">;</span></span></code></pre>
1143
- <p><code>limitToLast(n)</code> — keep the last N children of the ordered window.
1144
- Locked by oracle observation <code>rtdb-modular-limittofirst-vs-limittolast.json</code>.</p>
1145
- <h4 id="parameters-25">Parameters</h4>
1146
- <div class="table-scroll">
1147
-
1148
-
1149
-
1150
-
1151
-
1152
-
1153
-
1154
-
1155
-
1156
-
1157
-
1158
-
1159
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>n</code></td><td align="left"><code>number</code></td></tr></tbody></table></div>
1160
- <h4 id="returns-37">Returns</h4>
1161
- <p><a href="#queryconstraint"><code>QueryConstraint</code></a></p>
1162
- <hr>
1163
- <p><a id="off"></a></p>
1164
- <h3 id="off">off()</h3>
1165
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> off</span><span style="color:#ABB2BF">(</span></span>
1166
- <span class="line"><span style="color:#E06C75;font-style:italic"> r</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF">,</span></span>
1167
- <span class="line"><span style="color:#E06C75;font-style:italic"> eventType</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: </span><span style="color:#98C379">"value"</span><span style="color:#ABB2BF"> | </span><span style="color:#E5C07B">ChildEvent</span><span style="color:#ABB2BF">,</span></span>
1168
- <span class="line"><span style="color:#61AFEF"> callback</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: (</span><span style="color:#E06C75;font-style:italic">snap</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DataSnapshot</span><span style="color:#ABB2BF">) </span><span style="color:#C678DD">=></span><span style="color:#E5C07B"> void</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">void</span><span style="color:#ABB2BF">;</span></span></code></pre>
1169
- <p><code>off(ref, eventType?, callback?)</code> — unsubscribe variant.</p>
1170
- <p>Semantics (locked by oracle observation
1171
- <code>packages/conformance/observations/rtdb-modular/rtdb-modular-off-stops-child-fires.json</code>):</p>
1172
- <ul>
1173
- <li><code>off(ref)</code> (no eventType) removes ALL listeners at that ref —
1174
- value + every child event variety.</li>
1175
- <li><code>off(ref, 'value')</code> removes only <code>value</code> listeners.</li>
1176
- <li><code>off(ref, 'child_added')</code> (or any child event type) removes only
1177
- that variety.</li>
1178
- <li><code>off(ref, eventType, cb)</code> removes only the matching callback.</li>
1179
- </ul>
1180
- <p>The returned-unsubscribe pattern from <code>onValue</code> / <code>onChild*</code> is
1181
- functionally equivalent to <code>off(ref, eventType, cb)</code> for a specific
1182
- registration — both are supported.</p>
1183
- <h4 id="parameters-26">Parameters</h4>
1184
- <div class="table-scroll">
1185
-
1186
-
1187
-
1188
-
1189
-
1190
-
1191
-
1192
-
1193
-
1194
-
1195
-
1196
-
1197
-
1198
-
1199
-
1200
-
1201
-
1202
-
1203
-
1204
-
1205
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>r</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a></td></tr><tr><td align="left"><code>eventType?</code></td><td align="left"><code>"value"</code> | <code>ChildEvent</code></td></tr><tr><td align="left"><code>callback?</code></td><td align="left">(<code>snap</code>: <a href="#datasnapshot"><code>DataSnapshot</code></a>) => <code>void</code></td></tr></tbody></table></div>
1206
- <h4 id="returns-38">Returns</h4>
1207
- <p><code>void</code></p>
1208
- <hr>
1209
- <p><a id="onchildadded"></a></p>
1210
- <h3 id="onchildadded">onChildAdded()</h3>
1211
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> onChildAdded</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">r</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF"> | </span><span style="color:#E5C07B">Query</span><span style="color:#ABB2BF">, </span><span style="color:#61AFEF">cb</span><span style="color:#ABB2BF">: (</span><span style="color:#E06C75;font-style:italic">snap</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DataSnapshot</span><span style="color:#ABB2BF">) </span><span style="color:#C678DD">=></span><span style="color:#E5C07B"> void</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">Unsubscribe</span><span style="color:#ABB2BF">;</span></span></code></pre>
1212
- <p><code>onChildAdded(ref, cb)</code> — subscribe to child-added events at the
1213
- ref’s path.</p>
1214
- <p>Semantics (locked by oracle observations under
1215
- <code>packages/conformance/observations/rtdb-modular/rtdb-modular-onchildadded-*.json</code>):</p>
1216
- <ul>
1217
- <li>On subscribe, replays every existing direct child of <code>ref</code>’s path
1218
- (one fire per existing key, in <code>orderByKey</code>-default order).</li>
1219
- <li>After subscribe, fires exactly once per new direct child write.</li>
1220
- </ul>
1221
- <p>Also accepts a <a href="#query">Query</a> (a <code>query(ref, ...)</code> with <code>orderBy*</code> /
1222
- <code>limitTo*</code> constraints): child events are then computed against the
1223
- ordered, windowed result — a child ENTERING the window fires
1224
- <code>child_added</code>; on subscribe the current window is replayed in window
1225
- order.</p>
1226
- <p>Returns an unsubscribe; calling it twice is a no-op.</p>
1227
- <h4 id="parameters-27">Parameters</h4>
1228
- <div class="table-scroll">
1229
-
1230
-
1231
-
1232
-
1233
-
1234
-
1235
-
1236
-
1237
-
1238
-
1239
-
1240
-
1241
-
1242
-
1243
-
1244
-
1245
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>r</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a> | <a href="#query"><code>Query</code></a></td></tr><tr><td align="left"><code>cb</code></td><td align="left">(<code>snap</code>: <a href="#datasnapshot"><code>DataSnapshot</code></a>) => <code>void</code></td></tr></tbody></table></div>
1246
- <h4 id="returns-39">Returns</h4>
1247
- <p><a href="#unsubscribe"><code>Unsubscribe</code></a></p>
1248
- <hr>
1249
- <p><a id="onchildchanged"></a></p>
1250
- <h3 id="onchildchanged">onChildChanged()</h3>
1251
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> onChildChanged</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">r</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF"> | </span><span style="color:#E5C07B">Query</span><span style="color:#ABB2BF">, </span><span style="color:#61AFEF">cb</span><span style="color:#ABB2BF">: (</span><span style="color:#E06C75;font-style:italic">snap</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DataSnapshot</span><span style="color:#ABB2BF">) </span><span style="color:#C678DD">=></span><span style="color:#E5C07B"> void</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">Unsubscribe</span><span style="color:#ABB2BF">;</span></span></code></pre>
1252
- <p><code>onChildChanged(ref, cb)</code> — subscribe to child-changed events.</p>
1253
- <p>Semantics (oracle: <code>rtdb-modular-onchildchanged-fires-on-update</code>):</p>
1254
- <ul>
1255
- <li>No initial replay.</li>
1256
- <li>Fires when an existing direct child’s value transitions to a
1257
- NEW non-null value. Snapshot carries the NEW value.</li>
1258
- <li>Does NOT fire for added or removed children.</li>
1259
- </ul>
1260
- <p>Also accepts a <a href="#query">Query</a>: fires when a child that is IN the query
1261
- window changes value (an in-window update).</p>
1262
- <h4 id="parameters-28">Parameters</h4>
1263
- <div class="table-scroll">
1264
-
1265
-
1266
-
1267
-
1268
-
1269
-
1270
-
1271
-
1272
-
1273
-
1274
-
1275
-
1276
-
1277
-
1278
-
1279
-
1280
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>r</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a> | <a href="#query"><code>Query</code></a></td></tr><tr><td align="left"><code>cb</code></td><td align="left">(<code>snap</code>: <a href="#datasnapshot"><code>DataSnapshot</code></a>) => <code>void</code></td></tr></tbody></table></div>
1281
- <h4 id="returns-40">Returns</h4>
1282
- <p><a href="#unsubscribe"><code>Unsubscribe</code></a></p>
1283
- <hr>
1284
- <p><a id="onchildmoved"></a></p>
1285
- <h3 id="onchildmoved">onChildMoved()</h3>
1286
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> onChildMoved</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">r</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF"> | </span><span style="color:#E5C07B">Query</span><span style="color:#ABB2BF">, </span><span style="color:#61AFEF">cb</span><span style="color:#ABB2BF">: (</span><span style="color:#E06C75;font-style:italic">snap</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DataSnapshot</span><span style="color:#ABB2BF">) </span><span style="color:#C678DD">=></span><span style="color:#E5C07B"> void</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">Unsubscribe</span><span style="color:#ABB2BF">;</span></span></code></pre>
1287
- <p><code>onChildMoved(ref, cb)</code> — subscribe to child-moved events.</p>
1288
- <p>Semantics (oracle: <code>rtdb-modular-onchildmoved-with-orderby</code>):</p>
1289
- <ul>
1290
- <li>Only fires under an ordered query (<code>query(ref, orderByChild(...))</code>).</li>
1291
- <li>Under a plain ref, this listener is effectively a no-op — the
1292
- upstream SDK accepts the subscription but never fires it
1293
- (matches RTDB docs).</li>
1294
- </ul>
1295
- <p>Accepts a <a href="#query">Query</a> WITHOUT throwing, but the sandbox deliberately
1296
- does NOT fire <code>child_moved</code> on reorder yet: prod fires here (matrix row
1297
- <code>rtdb-modular#137</code>) while the sandbox holds — the reorder /
1298
- <code>previousChildName</code> ordering semantics are pending two new oracle
1299
- captures. This is a documented, pinned divergence (both sides asserted
1300
- in <code>test/database/modular/sandbox-child-events.test.ts</code>).</p>
1301
- <h4 id="parameters-29">Parameters</h4>
1302
- <div class="table-scroll">
1303
-
1304
-
1305
-
1306
-
1307
-
1308
-
1309
-
1310
-
1311
-
1312
-
1313
-
1314
-
1315
-
1316
-
1317
-
1318
-
1319
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>r</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a> | <a href="#query"><code>Query</code></a></td></tr><tr><td align="left"><code>cb</code></td><td align="left">(<code>snap</code>: <a href="#datasnapshot"><code>DataSnapshot</code></a>) => <code>void</code></td></tr></tbody></table></div>
1320
- <h4 id="returns-41">Returns</h4>
1321
- <p><a href="#unsubscribe"><code>Unsubscribe</code></a></p>
1322
- <hr>
1323
- <p><a id="onchildremoved"></a></p>
1324
- <h3 id="onchildremoved">onChildRemoved()</h3>
1325
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> onChildRemoved</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">r</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF"> | </span><span style="color:#E5C07B">Query</span><span style="color:#ABB2BF">, </span><span style="color:#61AFEF">cb</span><span style="color:#ABB2BF">: (</span><span style="color:#E06C75;font-style:italic">snap</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DataSnapshot</span><span style="color:#ABB2BF">) </span><span style="color:#C678DD">=></span><span style="color:#E5C07B"> void</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">Unsubscribe</span><span style="color:#ABB2BF">;</span></span></code></pre>
1326
- <p><code>onChildRemoved(ref, cb)</code> — subscribe to child-removed events.</p>
1327
- <p>Semantics (oracle: <code>rtdb-modular-onchildremoved-fires-on-delete</code>):</p>
1328
- <ul>
1329
- <li>No initial replay.</li>
1330
- <li>Fires when a direct child is deleted (via <code>remove(child)</code> or
1331
- <code>set(child, null)</code>).</li>
1332
- <li>Snapshot carries the PRIOR (now-removed) value — the listener
1333
- sees what was there before deletion.</li>
1334
- </ul>
1335
- <p>Also accepts a <a href="#query">Query</a>: a child LEAVING the query window (e.g.
1336
- displaced past a <code>limitTo*</code> boundary or filtered out) fires
1337
- <code>child_removed</code> carrying its prior value.</p>
1338
- <h4 id="parameters-30">Parameters</h4>
1339
- <div class="table-scroll">
1340
-
1341
-
1342
-
1343
-
1344
-
1345
-
1346
-
1347
-
1348
-
1349
-
1350
-
1351
-
1352
-
1353
-
1354
-
1355
-
1356
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>r</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a> | <a href="#query"><code>Query</code></a></td></tr><tr><td align="left"><code>cb</code></td><td align="left">(<code>snap</code>: <a href="#datasnapshot"><code>DataSnapshot</code></a>) => <code>void</code></td></tr></tbody></table></div>
1357
- <h4 id="returns-42">Returns</h4>
1358
- <p><a href="#unsubscribe"><code>Unsubscribe</code></a></p>
1359
- <hr>
1360
- <p><a id="onvalue"></a></p>
1361
- <h3 id="onvalue">onValue()</h3>
1362
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> onValue</span><span style="color:#ABB2BF">(</span></span>
1363
- <span class="line"><span style="color:#E06C75;font-style:italic"> r</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF"> | </span><span style="color:#E5C07B">Query</span><span style="color:#ABB2BF">,</span></span>
1364
- <span class="line"><span style="color:#61AFEF"> cb</span><span style="color:#ABB2BF">: (</span><span style="color:#E06C75;font-style:italic">snap</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DataSnapshot</span><span style="color:#ABB2BF">) </span><span style="color:#C678DD">=></span><span style="color:#E5C07B"> void</span><span style="color:#ABB2BF">,</span></span>
1365
- <span class="line"><span style="color:#E06C75;font-style:italic"> options</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: {</span></span>
1366
- <span class="line"><span style="color:#E06C75"> onlyOnce</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">boolean</span><span style="color:#ABB2BF">;</span></span>
1367
- <span class="line"><span style="color:#ABB2BF">}): </span><span style="color:#E5C07B">Unsubscribe</span><span style="color:#ABB2BF">;</span></span></code></pre>
1368
- <p><code>onValue(ref, cb)</code> — subscribe to value changes at the ref’s path.</p>
1369
- <p>Fires immediately on subscribe with the current value (or
1370
- <code>null</code> + <code>exists: false</code> for an absent path), then on every
1371
- subsequent write that touches the path or any descendant.</p>
1372
- <p>Returns an unsubscribe function. The unsubscribe is idempotent;
1373
- calling it twice is a no-op.</p>
1374
- <p><code>options.onlyOnce</code> (DB-B12): when <code>true</code>, the listener auto-unsubscribes
1375
- after its first fire (mirrors <code>api/Reference_impl.ts:975-980</code>).</p>
1376
- <p>Errors path: subscribing under rules that deny the read throws the
1377
- plain-<code>Error</code> <code>PERMISSION_DENIED</code> shape synchronously (matching the
1378
- production behavior where the subscribe path immediately errors).</p>
1379
- <h4 id="parameters-31">Parameters</h4>
1380
- <div class="table-scroll">
1381
-
1382
-
1383
-
1384
-
1385
-
1386
-
1387
-
1388
-
1389
-
1390
-
1391
-
1392
-
1393
-
1394
-
1395
-
1396
-
1397
-
1398
-
1399
-
1400
-
1401
-
1402
-
1403
-
1404
-
1405
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>r</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a> | <a href="#query"><code>Query</code></a></td></tr><tr><td align="left"><code>cb</code></td><td align="left">(<code>snap</code>: <a href="#datasnapshot"><code>DataSnapshot</code></a>) => <code>void</code></td></tr><tr><td align="left"><code>options?</code></td><td align="left">{ <code>onlyOnce?</code>: <code>boolean</code>; }</td></tr><tr><td align="left"><code>options.onlyOnce?</code></td><td align="left"><code>boolean</code></td></tr></tbody></table></div>
1406
- <h4 id="returns-43">Returns</h4>
1407
- <p><a href="#unsubscribe"><code>Unsubscribe</code></a></p>
1408
- <hr>
1409
- <p><a id="orderbychild"></a></p>
1410
- <h3 id="orderbychild">orderByChild()</h3>
1411
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> orderByChild</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">path</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">QueryConstraint</span><span style="color:#ABB2BF">;</span></span></code></pre>
1412
- <p><code>orderByChild('path')</code> — order children by the value at the nested
1413
- child path. Locked by oracle observation
1414
- <code>rtdb-modular-orderbychild-window.json</code>.</p>
1415
- <h4 id="parameters-32">Parameters</h4>
1416
- <div class="table-scroll">
1417
-
1418
-
1419
-
1420
-
1421
-
1422
-
1423
-
1424
-
1425
-
1426
-
1427
-
1428
-
1429
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>path</code></td><td align="left"><code>string</code></td></tr></tbody></table></div>
1430
- <h4 id="returns-44">Returns</h4>
1431
- <p><a href="#queryconstraint"><code>QueryConstraint</code></a></p>
1432
- <hr>
1433
- <p><a id="orderbykey"></a></p>
1434
- <h3 id="orderbykey">orderByKey()</h3>
1435
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> orderByKey</span><span style="color:#ABB2BF">(): </span><span style="color:#E5C07B">QueryConstraint</span><span style="color:#ABB2BF">;</span></span></code></pre>
1436
- <p><code>orderByKey()</code> — order children lexicographically by key string.
1437
- Locked by oracle observation <code>rtdb-modular-orderbykey-window.json</code>.</p>
1438
- <h4 id="returns-45">Returns</h4>
1439
- <p><a href="#queryconstraint"><code>QueryConstraint</code></a></p>
1440
- <hr>
1441
- <p><a id="orderbyvalue"></a></p>
1442
- <h3 id="orderbyvalue">orderByValue()</h3>
1443
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> orderByValue</span><span style="color:#ABB2BF">(): </span><span style="color:#E5C07B">QueryConstraint</span><span style="color:#ABB2BF">;</span></span></code></pre>
1444
- <p><code>orderByValue()</code> — order children by primitive value. Prod requires
1445
- <code>.indexOn: ".value"</code> (oracle: <code>rtdb-modular-orderbyvalue-numeric.json</code>
1446
- threw <code>Index not defined</code> against blockingfun); sandbox does NOT
1447
- enforce indexes (the rules engine here checks read-allow only, not
1448
- query-index conformance).</p>
1449
- <h4 id="returns-46">Returns</h4>
1450
- <p><a href="#queryconstraint"><code>QueryConstraint</code></a></p>
1451
- <hr>
1452
- <p><a id="push"></a></p>
1453
- <h3 id="push">push()</h3>
1454
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> push</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">r</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75;font-style:italic">value</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">unknown</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">ThenableReference</span><span style="color:#ABB2BF">;</span></span></code></pre>
1455
- <p><code>push(ref, value?)</code> — mint an auto-id child key under <code>ref</code>’s path,
1456
- optionally writing <code>value</code> at the new child.</p>
1457
- <p>Returns a ref at the new child path. The ref’s <code>key</code> is the minted
1458
- id (locked by oracle observation <code>rtdb-push-autoid-format.json</code>:
1459
- 20 chars, leading <code>-</code>, lex-sortable).</p>
1460
- <p>Production note: the key is minted <strong>client-side</strong> (no server
1461
- round-trip required); it’s available synchronously on the returned
1462
- ref even when the optional write is denied by rules. The oracle
1463
- observation confirms this — the sandbox matches.</p>
1464
- <h4 id="parameters-33">Parameters</h4>
1465
- <div class="table-scroll">
1466
-
1467
-
1468
-
1469
-
1470
-
1471
-
1472
-
1473
-
1474
-
1475
-
1476
-
1477
-
1478
-
1479
-
1480
-
1481
-
1482
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>r</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a></td></tr><tr><td align="left"><code>value?</code></td><td align="left"><code>unknown</code></td></tr></tbody></table></div>
1483
- <h4 id="returns-47">Returns</h4>
1484
- <p><a href="#thenablereference"><code>ThenableReference</code></a></p>
1485
- <hr>
1486
- <p><a id="pushkey"></a></p>
1487
- <h3 id="pushkey">pushKey()</h3>
1488
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> pushKey</span><span style="color:#ABB2BF">(): </span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">;</span></span></code></pre>
1489
- <p>Pre-mint a push key without writing. Used by callers that need the
1490
- key for a multi-path update (<code>update(rootRef, { [\</code>/users/${key}`]: … })`).
1491
- Returns a freshly-minted key.</p>
1492
- <h4 id="returns-48">Returns</h4>
1493
- <p><code>string</code></p>
1494
- <hr>
1495
- <p><a id="query-1"></a></p>
1496
- <h3 id="query-1">query()</h3>
1497
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> query</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">refOrQuery</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF"> | </span><span style="color:#E5C07B">Query</span><span style="color:#ABB2BF">, ...</span><span style="color:#E06C75;font-style:italic">constraints</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">QueryConstraint</span><span style="color:#ABB2BF">[]): </span><span style="color:#E5C07B">Query</span><span style="color:#ABB2BF">;</span></span></code></pre>
1498
- <p><code>query(ref, ...constraints)</code> — wrap a ref in an immutable
1499
- constraint chain. The resulting <a href="#query">Query</a> routes through
1500
- <a href="#get">get</a>/<a href="#onvalue">onValue</a> and applies the ordering + filtering +
1501
- limit pipeline on the sandbox backend.</p>
1502
- <p>Chaining is supported — <code>query(query(ref, orderByChild('x')), limitToFirst(2))</code> folds both constraints into one spec.</p>
1503
- <p>Locked semantics (oracle):</p>
1504
- <ul>
1505
- <li><code>orderByChild('p') + startAt(v) + endAt(w)</code> is BOTH-inclusive
1506
- (<code>rtdb-modular-orderbychild-window.json</code>).</li>
1507
- <li><code>orderByKey() + startAt('b') + endAt('d')</code> matches <code>[b, c, d]</code>
1508
- (<code>rtdb-modular-orderbykey-window.json</code>).</li>
1509
- <li><code>orderByValue() + limitToFirst(3)</code> returns the 3 smallest by
1510
- value (<code>rtdb-modular-orderbyvalue-numeric.json</code> — note: prod
1511
- requires <code>.indexOn: ".value"</code>; sandbox does not enforce indexes).</li>
1512
- <li><code>orderByChild('group') + equalTo('b')</code> returns ALL matching
1513
- children (<code>rtdb-modular-equalTo-filter.json</code>).</li>
1514
- <li><code>limitToFirst(N)</code> / <code>limitToLast(N)</code> take from the start / end of
1515
- the ordered window (<code>rtdb-modular-limittofirst-vs-limittolast.json</code>).</li>
1516
- <li><code>startAfter</code> / <code>endBefore</code> are EXCLUSIVE
1517
- (<code>rtdb-modular-startafter-endbefore-exclusive.json</code>).</li>
1518
- </ul>
1519
- <h4 id="parameters-34">Parameters</h4>
1520
- <div class="table-scroll">
1521
-
1522
-
1523
-
1524
-
1525
-
1526
-
1527
-
1528
-
1529
-
1530
-
1531
-
1532
-
1533
-
1534
-
1535
-
1536
-
1537
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>refOrQuery</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a> | <a href="#query"><code>Query</code></a></td></tr><tr><td align="left">…<code>constraints</code></td><td align="left"><a href="#queryconstraint"><code>QueryConstraint</code></a>[]</td></tr></tbody></table></div>
1538
- <h4 id="returns-49">Returns</h4>
1539
- <p><a href="#query"><code>Query</code></a></p>
1540
- <hr>
1541
- <p><a id="ref-2"></a></p>
1542
- <h3 id="ref">ref()</h3>
1543
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> ref</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">db</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">Database</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75;font-style:italic">path</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF">;</span></span></code></pre>
1544
- <p>Build a <a href="#databasereference">DatabaseReference</a> at <code>path</code> (default root).</p>
1545
- <p>Path normalisation: leading + trailing slashes are stripped;
1546
- empty path / <code>'/'</code> becomes the root.</p>
1547
- <h4 id="parameters-35">Parameters</h4>
1548
- <div class="table-scroll">
1549
-
1550
-
1551
-
1552
-
1553
-
1554
-
1555
-
1556
-
1557
-
1558
-
1559
-
1560
-
1561
-
1562
-
1563
-
1564
-
1565
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>db</code></td><td align="left"><a href="#database"><code>Database</code></a></td></tr><tr><td align="left"><code>path?</code></td><td align="left"><code>string</code></td></tr></tbody></table></div>
1566
- <h4 id="returns-50">Returns</h4>
1567
- <p><a href="#databasereference"><code>DatabaseReference</code></a></p>
1568
- <hr>
1569
- <p><a id="reffromurl"></a></p>
1570
- <h3 id="reffromurl">refFromURL()</h3>
1571
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> refFromURL</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">db</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">Database</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75;font-style:italic">url</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF">;</span></span></code></pre>
1572
- <p><code>refFromURL(db, url)</code> — build a <a href="#databasereference">DatabaseReference</a> from an
1573
- absolute database URL (<code>https://&#x3C;namespace>.firebaseio.com/path</code>).</p>
1574
- <p>Real alias with real behavior: parses the path out of the URL and
1575
- delegates to <a href="#ref-2">ref</a>, so the returned ref resolves + reads exactly
1576
- like <code>ref(db, path)</code>. The sandbox is single-database and has no host /
1577
- namespace, so the URL’s HOST is not validated against the handle (the
1578
- real SDK throws if the host doesn’t match the db’s namespace); only
1579
- the path component is honored.</p>
1580
- <h4 id="parameters-36">Parameters</h4>
1581
- <div class="table-scroll">
1582
-
1583
-
1584
-
1585
-
1586
-
1587
-
1588
-
1589
-
1590
-
1591
-
1592
-
1593
-
1594
-
1595
-
1596
-
1597
-
1598
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>db</code></td><td align="left"><a href="#database"><code>Database</code></a></td></tr><tr><td align="left"><code>url</code></td><td align="left"><code>string</code></td></tr></tbody></table></div>
1599
- <h4 id="returns-51">Returns</h4>
1600
- <p><a href="#databasereference"><code>DatabaseReference</code></a></p>
1601
- <hr>
1602
- <p><a id="remove"></a></p>
1603
- <h3 id="remove">remove()</h3>
1604
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> remove</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">r</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">Promise</span><span style="color:#ABB2BF">&#x3C;</span><span style="color:#E5C07B">void</span><span style="color:#ABB2BF">>;</span></span></code></pre>
1605
- <p><code>remove(ref)</code> — delete the subtree at the ref’s path.</p>
1606
- <p>RTDB invariant (oracle: <code>rtdb-remove-vs-set-null.json</code>): equivalent
1607
- to <code>set(ref, null)</code>. The sandbox backend dispatches <code>remove</code> through
1608
- the same code path as <code>set(_, null)</code>.</p>
1609
- <h4 id="parameters-37">Parameters</h4>
1610
- <div class="table-scroll">
1611
-
1612
-
1613
-
1614
-
1615
-
1616
-
1617
-
1618
-
1619
-
1620
-
1621
-
1622
-
1623
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>r</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a></td></tr></tbody></table></div>
1624
- <h4 id="returns-52">Returns</h4>
1625
- <p><code>Promise</code>&#x3C;<code>void</code>></p>
1626
- <hr>
1627
- <p><a id="runtransaction"></a></p>
1628
- <h3 id="runtransaction">runTransaction()</h3>
1629
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> runTransaction</span><span style="color:#ABB2BF">&#x3C;</span><span style="color:#E5C07B">T</span><span style="color:#ABB2BF">>(</span></span>
1630
- <span class="line"><span style="color:#E06C75;font-style:italic"> r</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF">,</span></span>
1631
- <span class="line"><span style="color:#61AFEF"> transactionUpdate</span><span style="color:#ABB2BF">: (</span><span style="color:#E06C75;font-style:italic">current</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">T</span><span style="color:#ABB2BF">) </span><span style="color:#C678DD">=></span><span style="color:#E5C07B"> T</span><span style="color:#ABB2BF">,</span></span>
1632
- <span class="line"><span style="color:#E06C75;font-style:italic"> options</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: {</span></span>
1633
- <span class="line"><span style="color:#E06C75"> applyLocally</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">boolean</span><span style="color:#ABB2BF">;</span></span>
1634
- <span class="line"><span style="color:#ABB2BF">}): </span><span style="color:#E5C07B">Promise</span><span style="color:#ABB2BF">&#x3C;</span><span style="color:#E5C07B">TransactionResult</span><span style="color:#ABB2BF">>;</span></span></code></pre>
1635
- <p><code>runTransaction(ref, transactionUpdate, options?)</code> — atomic
1636
- read-modify-write.</p>
1637
- <p>Contract (oracle-locked):</p>
1638
- <ol>
1639
- <li><code>transactionUpdate</code> is called with the CURRENT value at <code>ref</code>’s
1640
- path. For an absent path the arg is <code>null</code> (NOT <code>undefined</code>);
1641
- oracle:
1642
- <code>rtdb-modular-runtransaction-current-value-arg.json</code> →
1643
- <code>missingFirstWasNull: true</code>.</li>
1644
- <li>Returning <code>undefined</code> from the update fn ABORTS the transaction:
1645
- resolves <code>{ committed: false, snapshot }</code> where the snapshot is
1646
- the pre-transaction value; oracle:
1647
- <code>rtdb-modular-runtransaction-abort-undefined.json</code> → <code>committed: false, snapVal: null</code>.</li>
1648
- <li>Returning any defined value WRITES that value (rules-checked);
1649
- resolves <code>{ committed: true, snapshot }</code> where <code>snapshot.val()</code>
1650
- is the committed value; oracle:
1651
- <code>rtdb-modular-runtransaction-success.json</code> → <code>committedNewValue: true</code> and
1652
- <code>rtdb-modular-runtransaction-returns-committed-snapshot.json</code>.</li>
1653
- <li>If rules deny the write, the promise REJECTS with a plain
1654
- <code>Error</code> whose <code>message === 'permission_denied'</code> and NO <code>.code</code>
1655
- field (distinct from <code>set</code>/<code>get</code>’s <code>'PERMISSION_DENIED: Permission denied'</code>); oracle:
1656
- <code>rtdb-modular-runtransaction-on-rules-denied-path.json</code>.</li>
1657
- </ol>
1658
- <p><code>options.applyLocally</code> (default <code>true</code>): when <code>false</code>, the
1659
- intermediate optimistic value is NOT fanned out to listeners — they
1660
- see only the committed value. In a single-client harness this is
1661
- usually invisible; we honor the flag for prod-parity. Oracle
1662
- observation <code>rtdb-modular-runtransaction-options-applylocally.json</code>
1663
- confirms both branches commit and end at the same value; the
1664
- intermediate-fire difference isn’t observable from a single client.</p>
1665
- <p>Single-client sandbox doesn’t model concurrency conflicts; the
1666
- documented “retry on conflict” path is degenerate (no other writer
1667
- exists to conflict with). The fn is invoked once.</p>
1668
- <h4 id="type-parameters-2">Type Parameters</h4>
1669
- <div class="table-scroll">
1670
-
1671
-
1672
-
1673
-
1674
-
1675
-
1676
-
1677
-
1678
-
1679
-
1680
- <table><thead><tr><th align="left">Type Parameter</th></tr></thead><tbody><tr><td align="left"><code>T</code></td></tr></tbody></table></div>
1681
- <h4 id="parameters-38">Parameters</h4>
1682
- <div class="table-scroll">
1683
-
1684
-
1685
-
1686
-
1687
-
1688
-
1689
-
1690
-
1691
-
1692
-
1693
-
1694
-
1695
-
1696
-
1697
-
1698
-
1699
-
1700
-
1701
-
1702
-
1703
-
1704
-
1705
-
1706
-
1707
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>r</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a></td></tr><tr><td align="left"><code>transactionUpdate</code></td><td align="left">(<code>current</code>: <code>T</code>) => <code>T</code></td></tr><tr><td align="left"><code>options?</code></td><td align="left">{ <code>applyLocally?</code>: <code>boolean</code>; }</td></tr><tr><td align="left"><code>options.applyLocally?</code></td><td align="left"><code>boolean</code></td></tr></tbody></table></div>
1708
- <h4 id="returns-53">Returns</h4>
1709
- <p><code>Promise</code>&#x3C;<a href="#transactionresult"><code>TransactionResult</code></a>></p>
1710
- <hr>
1711
- <p><a id="servertimestamp"></a></p>
1712
- <h3 id="servertimestamp">serverTimestamp()</h3>
1713
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> serverTimestamp</span><span style="color:#ABB2BF">(): </span><span style="color:#E5C07B">ServerTimestampSentinel</span><span style="color:#ABB2BF">;</span></span></code></pre>
1714
- <p><code>serverTimestamp()</code> — returns the <code>{ ".sv": "timestamp" }</code> sentinel
1715
- the wire encoder recognises. Resolves to <code>Date.now()</code> (epoch ms) on
1716
- write — locked by the prod SDK’s resolved-as-number contract
1717
- (oracle: <code>rtdb-servertimestamp-resolves.json</code>).</p>
1718
- <p>The sandbox backend recognises the marker.</p>
1719
- <h4 id="returns-54">Returns</h4>
1720
- <p><code>ServerTimestampSentinel</code></p>
1721
- <hr>
1722
- <p><a id="set"></a></p>
1723
- <h3 id="set">set()</h3>
1724
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> set</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">r</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75;font-style:italic">value</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">unknown</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">Promise</span><span style="color:#ABB2BF">&#x3C;</span><span style="color:#E5C07B">void</span><span style="color:#ABB2BF">>;</span></span></code></pre>
1725
- <p><code>set(ref, value)</code> — replace the value at <code>ref</code>’s path. <code>null</code>
1726
- deletes (matches the RTDB invariant — locked by oracle observation
1727
- <code>rtdb-remove-vs-set-null.json</code>).</p>
1728
- <p><code>serverTimestamp()</code> sentinels are resolved at write time.</p>
1729
- <h4 id="parameters-39">Parameters</h4>
1730
- <div class="table-scroll">
1731
-
1732
-
1733
-
1734
-
1735
-
1736
-
1737
-
1738
-
1739
-
1740
-
1741
-
1742
-
1743
-
1744
-
1745
-
1746
-
1747
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>r</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a></td></tr><tr><td align="left"><code>value</code></td><td align="left"><code>unknown</code></td></tr></tbody></table></div>
1748
- <h4 id="returns-55">Returns</h4>
1749
- <p><code>Promise</code>&#x3C;<code>void</code>></p>
1750
- <hr>
1751
- <p><a id="startafter"></a></p>
1752
- <h3 id="startafter">startAfter()</h3>
1753
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> startAfter</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">value</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">JsonValue</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75;font-style:italic">key</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">QueryConstraint</span><span style="color:#ABB2BF">;</span></span></code></pre>
1754
- <p><code>startAfter(value, key?)</code> — EXCLUSIVE lower bound. Locked by
1755
- <code>rtdb-modular-startafter-endbefore-exclusive.json</code>.</p>
1756
- <h4 id="parameters-40">Parameters</h4>
1757
- <div class="table-scroll">
1758
-
1759
-
1760
-
1761
-
1762
-
1763
-
1764
-
1765
-
1766
-
1767
-
1768
-
1769
-
1770
-
1771
-
1772
-
1773
-
1774
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>value</code></td><td align="left"><a href="#jsonvalue"><code>JsonValue</code></a></td></tr><tr><td align="left"><code>key?</code></td><td align="left"><code>string</code></td></tr></tbody></table></div>
1775
- <h4 id="returns-56">Returns</h4>
1776
- <p><a href="#queryconstraint"><code>QueryConstraint</code></a></p>
1777
- <hr>
1778
- <p><a id="startat"></a></p>
1779
- <h3 id="startat">startAt()</h3>
1780
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> startAt</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">value</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">JsonValue</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75;font-style:italic">key</span><span style="color:#C678DD">?</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">): </span><span style="color:#E5C07B">QueryConstraint</span><span style="color:#ABB2BF">;</span></span></code></pre>
1781
- <p><code>startAt(value, key?)</code> — INCLUSIVE lower bound under the active
1782
- ordering. Optional <code>key</code> is the tie-breaker when ordering by
1783
- child/value and multiple children share the bound’s value.</p>
1784
- <h4 id="parameters-41">Parameters</h4>
1785
- <div class="table-scroll">
1786
-
1787
-
1788
-
1789
-
1790
-
1791
-
1792
-
1793
-
1794
-
1795
-
1796
-
1797
-
1798
-
1799
-
1800
-
1801
-
1802
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>value</code></td><td align="left"><a href="#jsonvalue"><code>JsonValue</code></a></td></tr><tr><td align="left"><code>key?</code></td><td align="left"><code>string</code></td></tr></tbody></table></div>
1803
- <h4 id="returns-57">Returns</h4>
1804
- <p><a href="#queryconstraint"><code>QueryConstraint</code></a></p>
1805
- <hr>
1806
- <p><a id="update"></a></p>
1807
- <h3 id="update">update()</h3>
1808
- <pre class="astro-code one-dark-pro" style="background-color:#282c34;color:#abb2bf; overflow-x: auto;" tabindex="0" data-language="ts"><code><span class="line"><span style="color:#C678DD">function</span><span style="color:#61AFEF"> update</span><span style="color:#ABB2BF">(</span><span style="color:#E06C75;font-style:italic">r</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">DatabaseReference</span><span style="color:#ABB2BF">, </span><span style="color:#E06C75;font-style:italic">values</span><span style="color:#ABB2BF">: </span><span style="color:#E5C07B">Record</span><span style="color:#ABB2BF">&#x3C;</span><span style="color:#E5C07B">string</span><span style="color:#ABB2BF">, </span><span style="color:#E5C07B">unknown</span><span style="color:#ABB2BF">>): </span><span style="color:#E5C07B">Promise</span><span style="color:#ABB2BF">&#x3C;</span><span style="color:#E5C07B">void</span><span style="color:#ABB2BF">>;</span></span></code></pre>
1809
- <p><code>update(ref, values)</code> — partial update.</p>
1810
- <ul>
1811
- <li>When <code>values</code> keys contain <code>/</code>, the call is a <strong>multi-path atomic
1812
- update</strong>: every listed path is written as one transaction (any
1813
- denial fails the whole batch).</li>
1814
- <li>Otherwise it’s a <strong>shallow merge</strong> at the ref’s path: each
1815
- top-level key replaces the corresponding child. <code>null</code> values
1816
- delete.</li>
1817
- </ul>
1818
- <p>Both behaviors are sandbox-implemented per the RtdbBackend’s
1819
- <code>update</code> method (<code>rtdb-modular</code>-spec atomic claim, matrix row #23).</p>
1820
- <h4 id="parameters-42">Parameters</h4>
1821
- <div class="table-scroll">
1822
-
1823
-
1824
-
1825
-
1826
-
1827
-
1828
-
1829
-
1830
-
1831
-
1832
-
1833
-
1834
-
1835
-
1836
-
1837
-
1838
- <table><thead><tr><th align="left">Parameter</th><th align="left">Type</th></tr></thead><tbody><tr><td align="left"><code>r</code></td><td align="left"><a href="#databasereference"><code>DatabaseReference</code></a></td></tr><tr><td align="left"><code>values</code></td><td align="left"><code>Record</code>&#x3C;<code>string</code>, <code>unknown</code>></td></tr></tbody></table></div>
1839
- <h4 id="returns-58">Returns</h4>
1840
- <p><code>Promise</code>&#x3C;<code>void</code>></p>
1841
- <h2 id="references">References</h2>
1842
- <p><a id="authstate"></a></p>
1843
- <h3 id="authstate">AuthState</h3>
1844
- <p>Re-exports <a href="/docs/pyric-firestore-reference-api/#authstate">AuthState</a></p>
1845
- <hr>
1846
- <p><a id="sandbox-1"></a></p>
1847
- <h3 id="sandbox-1">Sandbox</h3>
1848
- <p>Re-exports <a href="/docs/pyric-firestore-reference-api/#sandbox">Sandbox</a></p>
1849
- <hr>
1850
- <p><a id="sandboxcontext"></a></p>
1851
- <h3 id="sandboxcontext">SandboxContext</h3>
1852
- <p>Re-exports <a href="/docs/pyric-firestore-reference-api/#sandboxcontext">SandboxContext</a></p> </article> </main> <aside class="doc-toc api-symbols" aria-label="API symbols"> <h2 class="doc-toc-heading">Symbols</h2> <input class="api-symbol-filter" type="search" placeholder="Filter symbols" aria-label="Filter API symbols" data-api-symbol-filter> <div class="api-symbol-groups" data-api-symbol-groups> <section class="api-symbol-group" data-api-symbol-group> <a class="api-symbol-kind" href="#interfaces"> Interfaces </a> <ul> <li data-api-symbol="database"> <a href="#database">Database</a> </li><li data-api-symbol="databasereference"> <a href="#databasereference">DatabaseReference</a> </li><li data-api-symbol="datasnapshot"> <a href="#datasnapshot">DataSnapshot</a> </li><li data-api-symbol="query"> <a href="#query">Query</a> </li><li data-api-symbol="queryconstraint"> <a href="#queryconstraint">QueryConstraint</a> </li><li data-api-symbol="thenablereference"> <a href="#thenablereference">ThenableReference</a> </li><li data-api-symbol="transactionresult"> <a href="#transactionresult">TransactionResult</a> </li> </ul> </section><section class="api-symbol-group" data-api-symbol-group> <a class="api-symbol-kind" href="#type-aliases"> Type Aliases </a> <ul> <li data-api-symbol="appdatabase"> <a href="#appdatabase">AppDatabase</a> </li><li data-api-symbol="jsonvalue"> <a href="#jsonvalue">JsonValue</a> </li><li data-api-symbol="unsubscribe()"> <a href="#unsubscribe">Unsubscribe()</a> </li> </ul> </section><section class="api-symbol-group" data-api-symbol-group> <a class="api-symbol-kind" href="#variables"> Variables </a> <ul> <li data-api-symbol="query_symbol"> <a href="#query_symbol">QUERY_SYMBOL</a> </li><li data-api-symbol="sandbox"> <a href="#sandbox">sandbox</a> </li><li data-api-symbol="target_symbol"> <a href="#target_symbol">TARGET_SYMBOL</a> </li> </ul> </section><section class="api-symbol-group" data-api-symbol-group> <a class="api-symbol-kind" href="#functions"> Functions </a> <ul> <li data-api-symbol="child()"> <a href="#child-1">child()</a> </li><li data-api-symbol="connectdatabaseemulator()"> <a href="#connectdatabaseemulator">connectDatabaseEmulator()</a> </li><li data-api-symbol="enablelogging()"> <a href="#enablelogging">enableLogging()</a> </li><li data-api-symbol="endat()"> <a href="#endat">endAt()</a> </li><li data-api-symbol="endbefore()"> <a href="#endbefore">endBefore()</a> </li><li data-api-symbol="equalto()"> <a href="#equalto">equalTo()</a> </li><li data-api-symbol="forcelongpolling()"> <a href="#forcelongpolling">forceLongPolling()</a> </li><li data-api-symbol="forcewebsockets()"> <a href="#forcewebsockets">forceWebSockets()</a> </li><li data-api-symbol="get()"> <a href="#get">get()</a> </li><li data-api-symbol="getadmindatabase()"> <a href="#getadmindatabase">getAdminDatabase()</a> </li><li data-api-symbol="getdatabase()"> <a href="#getdatabase">getDatabase()</a> </li><li data-api-symbol="gooffline()"> <a href="#gooffline">goOffline()</a> </li><li data-api-symbol="goonline()"> <a href="#goonline">goOnline()</a> </li><li data-api-symbol="increment()"> <a href="#increment">increment()</a> </li><li data-api-symbol="limittofirst()"> <a href="#limittofirst">limitToFirst()</a> </li><li data-api-symbol="limittolast()"> <a href="#limittolast">limitToLast()</a> </li><li data-api-symbol="off()"> <a href="#off">off()</a> </li><li data-api-symbol="onchildadded()"> <a href="#onchildadded">onChildAdded()</a> </li><li data-api-symbol="onchildchanged()"> <a href="#onchildchanged">onChildChanged()</a> </li><li data-api-symbol="onchildmoved()"> <a href="#onchildmoved">onChildMoved()</a> </li><li data-api-symbol="onchildremoved()"> <a href="#onchildremoved">onChildRemoved()</a> </li><li data-api-symbol="onvalue()"> <a href="#onvalue">onValue()</a> </li><li data-api-symbol="orderbychild()"> <a href="#orderbychild">orderByChild()</a> </li><li data-api-symbol="orderbykey()"> <a href="#orderbykey">orderByKey()</a> </li><li data-api-symbol="orderbyvalue()"> <a href="#orderbyvalue">orderByValue()</a> </li><li data-api-symbol="push()"> <a href="#push">push()</a> </li><li data-api-symbol="pushkey()"> <a href="#pushkey">pushKey()</a> </li><li data-api-symbol="query()"> <a href="#query-1">query()</a> </li><li data-api-symbol="ref()"> <a href="#ref">ref()</a> </li><li data-api-symbol="reffromurl()"> <a href="#reffromurl">refFromURL()</a> </li><li data-api-symbol="remove()"> <a href="#remove">remove()</a> </li><li data-api-symbol="runtransaction()"> <a href="#runtransaction">runTransaction()</a> </li><li data-api-symbol="servertimestamp()"> <a href="#servertimestamp">serverTimestamp()</a> </li><li data-api-symbol="set()"> <a href="#set">set()</a> </li><li data-api-symbol="startafter()"> <a href="#startafter">startAfter()</a> </li><li data-api-symbol="startat()"> <a href="#startat">startAt()</a> </li><li data-api-symbol="update()"> <a href="#update">update()</a> </li> </ul> </section><section class="api-symbol-group" data-api-symbol-group> <a class="api-symbol-kind" href="#references"> References </a> <ul> <li data-api-symbol="authstate"> <a href="#authstate">AuthState</a> </li><li data-api-symbol="sandbox"> <a href="#sandbox-1">Sandbox</a> </li><li data-api-symbol="sandboxcontext"> <a href="#sandboxcontext">SandboxContext</a> </li> </ul> </section> <p class="api-symbol-empty" data-api-symbol-empty hidden>No matching symbols</p> </div> </aside> </div> <script type="module">const a=document.querySelector("[data-api-symbol-filter]"),d=[...document.querySelectorAll("[data-api-symbol-group]")],n=document.querySelector("[data-api-symbol-empty]");a?.addEventListener("input",()=>{const t=a.value.trim().toLowerCase();let o=0;for(const i of d){let e=0;i.querySelectorAll("[data-api-symbol]").forEach(l=>{const r=!t||(l.dataset.apiSymbol??"").includes(t);l.hidden=!r,r&&e++}),i.hidden=e===0,o+=e}n&&(n.hidden=o>0)});</script> <script type="module">const s=new Map;document.querySelectorAll('.doc-toc a[href^="#"]').forEach(t=>s.set(decodeURIComponent(t.hash.slice(1)),t));if(s.size>0){const t=new Set,n=()=>{let o=null;for(const e of s.keys())if(t.has(e)){o=e;break}s.forEach((e,c)=>e.classList.toggle("active",c===o))},r=new IntersectionObserver(o=>{for(const e of o)e.isIntersecting?t.add(e.target.id):t.delete(e.target.id);n()},{rootMargin:"-72px 0px -60% 0px"});s.forEach((o,e)=>{const c=document.getElementById(e);c&&r.observe(c)})}</script> <script type="module">document.querySelector('.studio__nav [aria-current="page"]')?.scrollIntoView({block:"nearest",inline:"center"});</script> </body> </html>