pyric 0.0.1 → 0.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +216 -0
- package/README.md +179 -2
- package/README.md.orig +54 -0
- package/dist/ai/backend.d.ts +35 -0
- package/dist/ai/backend.d.ts.map +1 -0
- package/dist/ai/backend.js +42 -0
- package/dist/ai/backend.js.map +1 -0
- package/dist/ai/broker/broker.d.ts +65 -0
- package/dist/ai/broker/broker.d.ts.map +1 -0
- package/dist/ai/broker/broker.js +184 -0
- package/dist/ai/broker/broker.js.map +1 -0
- package/dist/ai/broker/index.d.ts +12 -0
- package/dist/ai/broker/index.d.ts.map +1 -0
- package/dist/ai/broker/index.js +11 -0
- package/dist/ai/broker/index.js.map +1 -0
- package/dist/ai/broker/openai-engine.d.ts +175 -0
- package/dist/ai/broker/openai-engine.d.ts.map +1 -0
- package/dist/ai/broker/openai-engine.js +502 -0
- package/dist/ai/broker/openai-engine.js.map +1 -0
- package/dist/ai/broker/scripted-engine.d.ts +44 -0
- package/dist/ai/broker/scripted-engine.d.ts.map +1 -0
- package/dist/ai/broker/scripted-engine.js +218 -0
- package/dist/ai/broker/scripted-engine.js.map +1 -0
- package/dist/ai/broker/synthesizer.d.ts +100 -0
- package/dist/ai/broker/synthesizer.d.ts.map +1 -0
- package/dist/ai/broker/synthesizer.js +278 -0
- package/dist/ai/broker/synthesizer.js.map +1 -0
- package/dist/ai/broker/types.d.ts +210 -0
- package/dist/ai/broker/types.d.ts.map +1 -0
- package/dist/ai/broker/types.js +20 -0
- package/dist/ai/broker/types.js.map +1 -0
- package/dist/ai/enums.d.ts +174 -0
- package/dist/ai/enums.d.ts.map +1 -0
- package/dist/ai/enums.js +155 -0
- package/dist/ai/enums.js.map +1 -0
- package/dist/ai/errors.d.ts +66 -0
- package/dist/ai/errors.d.ts.map +1 -0
- package/dist/ai/errors.js +100 -0
- package/dist/ai/errors.js.map +1 -0
- package/dist/ai/index.d.ts +31 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +27 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/instances.d.ts +15 -0
- package/dist/ai/instances.d.ts.map +1 -0
- package/dist/ai/instances.js +69 -0
- package/dist/ai/instances.js.map +1 -0
- package/dist/ai/internal.d.ts +13 -0
- package/dist/ai/internal.d.ts.map +1 -0
- package/dist/ai/internal.js +45 -0
- package/dist/ai/internal.js.map +1 -0
- package/dist/ai/models.d.ts +116 -0
- package/dist/ai/models.d.ts.map +1 -0
- package/dist/ai/models.js +213 -0
- package/dist/ai/models.js.map +1 -0
- package/dist/ai/request-helpers.d.ts +59 -0
- package/dist/ai/request-helpers.d.ts.map +1 -0
- package/dist/ai/request-helpers.js +157 -0
- package/dist/ai/request-helpers.js.map +1 -0
- package/dist/ai/response-helpers.d.ts +41 -0
- package/dist/ai/response-helpers.d.ts.map +1 -0
- package/dist/ai/response-helpers.js +204 -0
- package/dist/ai/response-helpers.js.map +1 -0
- package/dist/ai/sandbox-plane.d.ts +41 -0
- package/dist/ai/sandbox-plane.d.ts.map +1 -0
- package/dist/ai/sandbox-plane.js +159 -0
- package/dist/ai/sandbox-plane.js.map +1 -0
- package/dist/ai/schema.d.ts +105 -0
- package/dist/ai/schema.d.ts.map +1 -0
- package/dist/ai/schema.js +174 -0
- package/dist/ai/schema.js.map +1 -0
- package/dist/ai/scripting.d.ts +53 -0
- package/dist/ai/scripting.d.ts.map +1 -0
- package/dist/ai/scripting.js +73 -0
- package/dist/ai/scripting.js.map +1 -0
- package/dist/ai/target.d.ts +20 -0
- package/dist/ai/target.d.ts.map +1 -0
- package/dist/ai/target.js +29 -0
- package/dist/ai/target.js.map +1 -0
- package/dist/ai/types.d.ts +400 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +10 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/app/diagnostics.d.ts +29 -0
- package/dist/app/diagnostics.d.ts.map +1 -0
- package/dist/app/diagnostics.js +88 -0
- package/dist/app/diagnostics.js.map +1 -0
- package/dist/app/index.d.ts +7 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/app/index.js +5 -0
- package/dist/app/index.js.map +1 -0
- package/dist/app/internal.d.ts +11 -0
- package/dist/app/internal.d.ts.map +1 -0
- package/dist/app/internal.js +18 -0
- package/dist/app/internal.js.map +1 -0
- package/dist/app/options.d.ts +3 -0
- package/dist/app/options.d.ts.map +1 -0
- package/dist/app/options.js +19 -0
- package/dist/app/options.js.map +1 -0
- package/dist/app/register.d.ts +4 -0
- package/dist/app/register.d.ts.map +1 -0
- package/dist/app/register.js +35 -0
- package/dist/app/register.js.map +1 -0
- package/dist/app/registry.d.ts +12 -0
- package/dist/app/registry.d.ts.map +1 -0
- package/dist/app/registry.js +147 -0
- package/dist/app/registry.js.map +1 -0
- package/dist/app/runtime.d.ts +18 -0
- package/dist/app/runtime.d.ts.map +1 -0
- package/dist/app/runtime.js +119 -0
- package/dist/app/runtime.js.map +1 -0
- package/dist/app/types.d.ts +21 -0
- package/dist/app/types.d.ts.map +1 -0
- package/dist/app/types.js +2 -0
- package/dist/app/types.js.map +1 -0
- package/dist/auth/action-code-url.d.ts +70 -0
- package/dist/auth/action-code-url.d.ts.map +1 -0
- package/dist/auth/action-code-url.js +124 -0
- package/dist/auth/action-code-url.js.map +1 -0
- package/dist/auth/action-codes.d.ts +201 -0
- package/dist/auth/action-codes.d.ts.map +1 -0
- package/dist/auth/action-codes.js +355 -0
- package/dist/auth/action-codes.js.map +1 -0
- package/dist/auth/auth-errors.d.ts +21 -0
- package/dist/auth/auth-errors.d.ts.map +1 -0
- package/dist/auth/auth-errors.js +23 -0
- package/dist/auth/auth-errors.js.map +1 -0
- package/dist/auth/config-tokens.d.ts +90 -0
- package/dist/auth/config-tokens.d.ts.map +1 -0
- package/dist/auth/config-tokens.js +86 -0
- package/dist/auth/config-tokens.js.map +1 -0
- package/dist/auth/credentials.d.ts +140 -0
- package/dist/auth/credentials.d.ts.map +1 -0
- package/dist/auth/credentials.js +194 -0
- package/dist/auth/credentials.js.map +1 -0
- package/dist/auth/email-link.d.ts +91 -0
- package/dist/auth/email-link.d.ts.map +1 -0
- package/dist/auth/email-link.js +172 -0
- package/dist/auth/email-link.js.map +1 -0
- package/dist/auth/enums.d.ts +210 -0
- package/dist/auth/enums.d.ts.map +1 -0
- package/dist/auth/enums.js +206 -0
- package/dist/auth/enums.js.map +1 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/instances.d.ts +14 -0
- package/dist/auth/instances.d.ts.map +1 -0
- package/dist/auth/instances.js +95 -0
- package/dist/auth/instances.js.map +1 -0
- package/dist/auth/linking.d.ts +93 -0
- package/dist/auth/linking.d.ts.map +1 -0
- package/dist/auth/linking.js +189 -0
- package/dist/auth/linking.js.map +1 -0
- package/dist/auth/modular.d.ts +22 -0
- package/dist/auth/modular.d.ts.map +1 -0
- package/dist/auth/modular.js +18 -0
- package/dist/auth/modular.js.map +1 -0
- package/dist/auth/password-policy.d.ts +60 -0
- package/dist/auth/password-policy.d.ts.map +1 -0
- package/dist/auth/password-policy.js +68 -0
- package/dist/auth/password-policy.js.map +1 -0
- package/dist/auth/providers.d.ts +153 -0
- package/dist/auth/providers.d.ts.map +1 -0
- package/dist/auth/providers.js +207 -0
- package/dist/auth/providers.js.map +1 -0
- package/dist/auth/reauth.d.ts +73 -0
- package/dist/auth/reauth.d.ts.map +1 -0
- package/dist/auth/reauth.js +148 -0
- package/dist/auth/reauth.js.map +1 -0
- package/dist/auth/sandbox/driver.d.ts +51 -0
- package/dist/auth/sandbox/driver.d.ts.map +1 -0
- package/dist/auth/sandbox/driver.js +88 -0
- package/dist/auth/sandbox/driver.js.map +1 -0
- package/dist/auth/sandbox/persistence.d.ts +7 -0
- package/dist/auth/sandbox/persistence.d.ts.map +1 -0
- package/dist/auth/sandbox/persistence.js +121 -0
- package/dist/auth/sandbox/persistence.js.map +1 -0
- package/dist/auth/sandbox/project-store.d.ts +15 -0
- package/dist/auth/sandbox/project-store.d.ts.map +1 -0
- package/dist/auth/sandbox/project-store.js +17 -0
- package/dist/auth/sandbox/project-store.js.map +1 -0
- package/dist/auth/sandbox-auth-flow.d.ts +173 -0
- package/dist/auth/sandbox-auth-flow.d.ts.map +1 -0
- package/dist/auth/sandbox-auth-flow.js +165 -0
- package/dist/auth/sandbox-auth-flow.js.map +1 -0
- package/dist/auth/sandbox-backend-types.d.ts +197 -0
- package/dist/auth/sandbox-backend-types.d.ts.map +1 -0
- package/dist/auth/sandbox-backend-types.js +18 -0
- package/dist/auth/sandbox-backend-types.js.map +1 -0
- package/dist/auth/sandbox-backend.d.ts +811 -0
- package/dist/auth/sandbox-backend.d.ts.map +1 -0
- package/dist/auth/sandbox-backend.js +2007 -0
- package/dist/auth/sandbox-backend.js.map +1 -0
- package/dist/auth/sandbox-credential-validators.d.ts +30 -0
- package/dist/auth/sandbox-credential-validators.d.ts.map +1 -0
- package/dist/auth/sandbox-credential-validators.js +47 -0
- package/dist/auth/sandbox-credential-validators.js.map +1 -0
- package/dist/auth/sandbox-token.d.ts +24 -0
- package/dist/auth/sandbox-token.d.ts.map +1 -0
- package/dist/auth/sandbox-token.js +32 -0
- package/dist/auth/sandbox-token.js.map +1 -0
- package/dist/auth/sign-in.d.ts +14 -0
- package/dist/auth/sign-in.d.ts.map +1 -0
- package/dist/auth/sign-in.js +140 -0
- package/dist/auth/sign-in.js.map +1 -0
- package/dist/auth/target.d.ts +29 -0
- package/dist/auth/target.d.ts.map +1 -0
- package/dist/auth/target.js +23 -0
- package/dist/auth/target.js.map +1 -0
- package/dist/auth/tokens.d.ts +54 -0
- package/dist/auth/tokens.d.ts.map +1 -0
- package/dist/auth/tokens.js +142 -0
- package/dist/auth/tokens.js.map +1 -0
- package/dist/auth/types.d.ts +283 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +24 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/auth/user-lifecycle.d.ts +17 -0
- package/dist/auth/user-lifecycle.d.ts.map +1 -0
- package/dist/auth/user-lifecycle.js +60 -0
- package/dist/auth/user-lifecycle.js.map +1 -0
- package/dist/database/index.d.ts +9 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +9 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/listener-registry.d.ts +16 -0
- package/dist/database/listener-registry.d.ts.map +1 -0
- package/dist/database/listener-registry.js +68 -0
- package/dist/database/listener-registry.js.map +1 -0
- package/dist/database/modular.d.ts +632 -0
- package/dist/database/modular.d.ts.map +1 -0
- package/dist/database/modular.js +1071 -0
- package/dist/database/modular.js.map +1 -0
- package/dist/database/replay.d.ts +32 -0
- package/dist/database/replay.d.ts.map +1 -0
- package/dist/database/replay.js +124 -0
- package/dist/database/replay.js.map +1 -0
- package/dist/database/sandbox/backend-for.d.ts +10 -0
- package/dist/database/sandbox/backend-for.d.ts.map +1 -0
- package/dist/database/sandbox/backend-for.js +19 -0
- package/dist/database/sandbox/backend-for.js.map +1 -0
- package/dist/database/sandbox/backend.d.ts +407 -0
- package/dist/database/sandbox/backend.d.ts.map +1 -0
- package/dist/database/sandbox/backend.js +1495 -0
- package/dist/database/sandbox/backend.js.map +1 -0
- package/dist/database/sandbox/data-tree.d.ts +123 -0
- package/dist/database/sandbox/data-tree.d.ts.map +1 -0
- package/dist/database/sandbox/data-tree.js +310 -0
- package/dist/database/sandbox/data-tree.js.map +1 -0
- package/dist/database/sandbox/normalize.d.ts +77 -0
- package/dist/database/sandbox/normalize.d.ts.map +1 -0
- package/dist/database/sandbox/normalize.js +165 -0
- package/dist/database/sandbox/normalize.js.map +1 -0
- package/dist/database/sandbox/push-id.d.ts +32 -0
- package/dist/database/sandbox/push-id.d.ts.map +1 -0
- package/dist/database/sandbox/push-id.js +82 -0
- package/dist/database/sandbox/push-id.js.map +1 -0
- package/dist/database/sandbox/query.d.ts +175 -0
- package/dist/database/sandbox/query.d.ts.map +1 -0
- package/dist/database/sandbox/query.js +269 -0
- package/dist/database/sandbox/query.js.map +1 -0
- package/dist/database/sandbox/rules-eval.d.ts +87 -0
- package/dist/database/sandbox/rules-eval.d.ts.map +1 -0
- package/dist/database/sandbox/rules-eval.js +131 -0
- package/dist/database/sandbox/rules-eval.js.map +1 -0
- package/dist/database/sandbox/sentinels.d.ts +71 -0
- package/dist/database/sandbox/sentinels.d.ts.map +1 -0
- package/dist/database/sandbox/sentinels.js +92 -0
- package/dist/database/sandbox/sentinels.js.map +1 -0
- package/dist/database/sandbox-controls.d.ts +15 -0
- package/dist/database/sandbox-controls.d.ts.map +1 -0
- package/dist/database/sandbox-controls.js +18 -0
- package/dist/database/sandbox-controls.js.map +1 -0
- package/dist/firestore/aggregates.d.ts +50 -0
- package/dist/firestore/aggregates.d.ts.map +1 -0
- package/dist/firestore/aggregates.js +40 -0
- package/dist/firestore/aggregates.js.map +1 -0
- package/dist/firestore/equality.d.ts +5 -0
- package/dist/firestore/equality.d.ts.map +1 -0
- package/dist/firestore/equality.js +20 -0
- package/dist/firestore/equality.js.map +1 -0
- package/dist/firestore/field-values.d.ts +61 -0
- package/dist/firestore/field-values.d.ts.map +1 -0
- package/dist/firestore/field-values.js +167 -0
- package/dist/firestore/field-values.js.map +1 -0
- package/dist/firestore/index.d.ts +54 -0
- package/dist/firestore/index.d.ts.map +1 -0
- package/dist/firestore/index.js +54 -0
- package/dist/firestore/index.js.map +1 -0
- package/dist/firestore/instances.d.ts +123 -0
- package/dist/firestore/instances.d.ts.map +1 -0
- package/dist/firestore/instances.js +177 -0
- package/dist/firestore/instances.js.map +1 -0
- package/dist/firestore/internal/index.d.ts +2 -0
- package/dist/firestore/internal/index.d.ts.map +1 -0
- package/dist/firestore/internal/index.js +2 -0
- package/dist/firestore/internal/index.js.map +1 -0
- package/dist/firestore/internal/listener-routing.d.ts +4 -0
- package/dist/firestore/internal/listener-routing.d.ts.map +1 -0
- package/dist/firestore/internal/listener-routing.js +4 -0
- package/dist/firestore/internal/listener-routing.js.map +1 -0
- package/dist/firestore/listeners.d.ts +12 -0
- package/dist/firestore/listeners.d.ts.map +1 -0
- package/dist/firestore/listeners.js +200 -0
- package/dist/firestore/listeners.js.map +1 -0
- package/dist/firestore/persistence.d.ts +227 -0
- package/dist/firestore/persistence.d.ts.map +1 -0
- package/dist/firestore/persistence.js +245 -0
- package/dist/firestore/persistence.js.map +1 -0
- package/dist/firestore/query-constraints.d.ts +72 -0
- package/dist/firestore/query-constraints.d.ts.map +1 -0
- package/dist/firestore/query-constraints.js +168 -0
- package/dist/firestore/query-constraints.js.map +1 -0
- package/dist/firestore/reads.d.ts +12 -0
- package/dist/firestore/reads.d.ts.map +1 -0
- package/dist/firestore/reads.js +32 -0
- package/dist/firestore/reads.js.map +1 -0
- package/dist/firestore/refs.d.ts +27 -0
- package/dist/firestore/refs.d.ts.map +1 -0
- package/dist/firestore/refs.js +74 -0
- package/dist/firestore/refs.js.map +1 -0
- package/dist/firestore/sandbox-controls.d.ts +60 -0
- package/dist/firestore/sandbox-controls.d.ts.map +1 -0
- package/dist/firestore/sandbox-controls.js +77 -0
- package/dist/firestore/sandbox-controls.js.map +1 -0
- package/dist/firestore/snapshots.d.ts +71 -0
- package/dist/firestore/snapshots.d.ts.map +1 -0
- package/dist/firestore/snapshots.js +160 -0
- package/dist/firestore/snapshots.js.map +1 -0
- package/dist/firestore/state.d.ts +168 -0
- package/dist/firestore/state.d.ts.map +1 -0
- package/dist/firestore/state.js +260 -0
- package/dist/firestore/state.js.map +1 -0
- package/dist/firestore/tools.d.ts +71 -0
- package/dist/firestore/tools.d.ts.map +1 -0
- package/dist/firestore/tools.js +320 -0
- package/dist/firestore/tools.js.map +1 -0
- package/dist/firestore/transactions.d.ts +4 -0
- package/dist/firestore/transactions.d.ts.map +1 -0
- package/dist/firestore/transactions.js +14 -0
- package/dist/firestore/transactions.js.map +1 -0
- package/dist/firestore/types.d.ts +82 -0
- package/dist/firestore/types.d.ts.map +1 -0
- package/dist/firestore/types.js +15 -0
- package/dist/firestore/types.js.map +1 -0
- package/dist/firestore/writes.d.ts +43 -0
- package/dist/firestore/writes.d.ts.map +1 -0
- package/dist/firestore/writes.js +40 -0
- package/dist/firestore/writes.js.map +1 -0
- package/dist/firestore-values/index.d.ts +63 -0
- package/dist/firestore-values/index.d.ts.map +1 -0
- package/dist/firestore-values/index.js +148 -0
- package/dist/firestore-values/index.js.map +1 -0
- package/dist/messaging/broker/broker.d.ts +171 -0
- package/dist/messaging/broker/broker.d.ts.map +1 -0
- package/dist/messaging/broker/broker.js +400 -0
- package/dist/messaging/broker/broker.js.map +1 -0
- package/dist/messaging/broker/envelopes.d.ts +96 -0
- package/dist/messaging/broker/envelopes.d.ts.map +1 -0
- package/dist/messaging/broker/envelopes.js +132 -0
- package/dist/messaging/broker/envelopes.js.map +1 -0
- package/dist/messaging/broker/index.d.ts +27 -0
- package/dist/messaging/broker/index.d.ts.map +1 -0
- package/dist/messaging/broker/index.js +21 -0
- package/dist/messaging/broker/index.js.map +1 -0
- package/dist/messaging/broker/tokens.d.ts +22 -0
- package/dist/messaging/broker/tokens.d.ts.map +1 -0
- package/dist/messaging/broker/tokens.js +37 -0
- package/dist/messaging/broker/tokens.js.map +1 -0
- package/dist/messaging/broker/types.d.ts +117 -0
- package/dist/messaging/broker/types.d.ts.map +1 -0
- package/dist/messaging/broker/types.js +12 -0
- package/dist/messaging/broker/types.js.map +1 -0
- package/dist/messaging/broker/validate.d.ts +58 -0
- package/dist/messaging/broker/validate.d.ts.map +1 -0
- package/dist/messaging/broker/validate.js +196 -0
- package/dist/messaging/broker/validate.js.map +1 -0
- package/dist/messaging/client.d.ts +108 -0
- package/dist/messaging/client.d.ts.map +1 -0
- package/dist/messaging/client.js +65 -0
- package/dist/messaging/client.js.map +1 -0
- package/dist/messaging/index.d.ts +3 -0
- package/dist/messaging/index.d.ts.map +1 -0
- package/dist/messaging/index.js +3 -0
- package/dist/messaging/index.js.map +1 -0
- package/dist/messaging/instance.d.ts +72 -0
- package/dist/messaging/instance.d.ts.map +1 -0
- package/dist/messaging/instance.js +93 -0
- package/dist/messaging/instance.js.map +1 -0
- package/dist/messaging/internal.d.ts +12 -0
- package/dist/messaging/internal.d.ts.map +1 -0
- package/dist/messaging/internal.js +12 -0
- package/dist/messaging/internal.js.map +1 -0
- package/dist/messaging/sw.d.ts +49 -0
- package/dist/messaging/sw.d.ts.map +1 -0
- package/dist/messaging/sw.js +49 -0
- package/dist/messaging/sw.js.map +1 -0
- package/dist/project-scope.d.ts +5 -0
- package/dist/project-scope.d.ts.map +1 -0
- package/dist/project-scope.js +2 -0
- package/dist/project-scope.js.map +1 -0
- package/dist/rules/api/assert.d.ts +39 -0
- package/dist/rules/api/assert.d.ts.map +1 -0
- package/dist/rules/api/assert.js +93 -0
- package/dist/rules/api/assert.js.map +1 -0
- package/dist/rules/api/case-types.d.ts +141 -0
- package/dist/rules/api/case-types.d.ts.map +1 -0
- package/dist/rules/api/case-types.js +13 -0
- package/dist/rules/api/case-types.js.map +1 -0
- package/dist/rules/api/errors.d.ts +38 -0
- package/dist/rules/api/errors.d.ts.map +1 -0
- package/dist/rules/api/errors.js +47 -0
- package/dist/rules/api/errors.js.map +1 -0
- package/dist/rules/api/firestore.d.ts +34 -0
- package/dist/rules/api/firestore.d.ts.map +1 -0
- package/dist/rules/api/firestore.js +137 -0
- package/dist/rules/api/firestore.js.map +1 -0
- package/dist/rules/api/issue.d.ts +50 -0
- package/dist/rules/api/issue.d.ts.map +1 -0
- package/dist/rules/api/issue.js +66 -0
- package/dist/rules/api/issue.js.map +1 -0
- package/dist/rules/api/lint.d.ts +16 -0
- package/dist/rules/api/lint.d.ts.map +1 -0
- package/dist/rules/api/lint.js +60 -0
- package/dist/rules/api/lint.js.map +1 -0
- package/dist/rules/api/rtdb.d.ts +33 -0
- package/dist/rules/api/rtdb.d.ts.map +1 -0
- package/dist/rules/api/rtdb.js +166 -0
- package/dist/rules/api/rtdb.js.map +1 -0
- package/dist/rules/api/values.d.ts +51 -0
- package/dist/rules/api/values.d.ts.map +1 -0
- package/dist/rules/api/values.js +66 -0
- package/dist/rules/api/values.js.map +1 -0
- package/dist/rules/generators/assembler.d.ts +19 -0
- package/dist/rules/generators/assembler.d.ts.map +1 -0
- package/dist/rules/generators/assembler.js +292 -0
- package/dist/rules/generators/assembler.js.map +1 -0
- package/dist/rules/generators/expressions.d.ts +52 -0
- package/dist/rules/generators/expressions.d.ts.map +1 -0
- package/dist/rules/generators/expressions.js +117 -0
- package/dist/rules/generators/expressions.js.map +1 -0
- package/dist/rules/generators/grid.d.ts +22 -0
- package/dist/rules/generators/grid.d.ts.map +1 -0
- package/dist/rules/generators/grid.js +52 -0
- package/dist/rules/generators/grid.js.map +1 -0
- package/dist/rules/grammar/FirestoreAST.d.ts +129 -0
- package/dist/rules/grammar/FirestoreAST.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreAST.js +3 -0
- package/dist/rules/grammar/FirestoreAST.js.map +1 -0
- package/dist/rules/grammar/FirestoreAssembler.d.ts +5 -0
- package/dist/rules/grammar/FirestoreAssembler.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreAssembler.js +158 -0
- package/dist/rules/grammar/FirestoreAssembler.js.map +1 -0
- package/dist/rules/grammar/FirestoreParser.d.ts +46 -0
- package/dist/rules/grammar/FirestoreParser.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreParser.js +409 -0
- package/dist/rules/grammar/FirestoreParser.js.map +1 -0
- package/dist/rules/grammar/FirestoreRules.ohm +229 -0
- package/dist/rules/grammar/FirestoreRules.ohm.generated.d.ts +2 -0
- package/dist/rules/grammar/FirestoreRules.ohm.generated.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreRules.ohm.generated.js +234 -0
- package/dist/rules/grammar/FirestoreRules.ohm.generated.js.map +1 -0
- package/dist/rules/grammar/FirestoreValidator.d.ts +10 -0
- package/dist/rules/grammar/FirestoreValidator.d.ts.map +1 -0
- package/dist/rules/grammar/FirestoreValidator.js +482 -0
- package/dist/rules/grammar/FirestoreValidator.js.map +1 -0
- package/dist/rules/index.d.ts +41 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +40 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/indexes/extract/annotation-collect.d.ts +42 -0
- package/dist/rules/indexes/extract/annotation-collect.d.ts.map +1 -0
- package/dist/rules/indexes/extract/annotation-collect.js +69 -0
- package/dist/rules/indexes/extract/annotation-collect.js.map +1 -0
- package/dist/rules/indexes/extract/annotations.d.ts +50 -0
- package/dist/rules/indexes/extract/annotations.d.ts.map +1 -0
- package/dist/rules/indexes/extract/annotations.js +144 -0
- package/dist/rules/indexes/extract/annotations.js.map +1 -0
- package/dist/rules/indexes/extract/ast.d.ts +54 -0
- package/dist/rules/indexes/extract/ast.d.ts.map +1 -0
- package/dist/rules/indexes/extract/ast.js +119 -0
- package/dist/rules/indexes/extract/ast.js.map +1 -0
- package/dist/rules/indexes/extract/classify.d.ts +41 -0
- package/dist/rules/indexes/extract/classify.d.ts.map +1 -0
- package/dist/rules/indexes/extract/classify.js +138 -0
- package/dist/rules/indexes/extract/classify.js.map +1 -0
- package/dist/rules/indexes/extract/composite.d.ts +38 -0
- package/dist/rules/indexes/extract/composite.d.ts.map +1 -0
- package/dist/rules/indexes/extract/composite.js +85 -0
- package/dist/rules/indexes/extract/composite.js.map +1 -0
- package/dist/rules/indexes/extract/dataflow.d.ts +45 -0
- package/dist/rules/indexes/extract/dataflow.d.ts.map +1 -0
- package/dist/rules/indexes/extract/dataflow.js +200 -0
- package/dist/rules/indexes/extract/dataflow.js.map +1 -0
- package/dist/rules/indexes/extract/enumerate.d.ts +41 -0
- package/dist/rules/indexes/extract/enumerate.d.ts.map +1 -0
- package/dist/rules/indexes/extract/enumerate.js +163 -0
- package/dist/rules/indexes/extract/enumerate.js.map +1 -0
- package/dist/rules/indexes/extract/extractor.d.ts +3 -0
- package/dist/rules/indexes/extract/extractor.d.ts.map +1 -0
- package/dist/rules/indexes/extract/extractor.js +274 -0
- package/dist/rules/indexes/extract/extractor.js.map +1 -0
- package/dist/rules/indexes/extract/types.d.ts +211 -0
- package/dist/rules/indexes/extract/types.d.ts.map +1 -0
- package/dist/rules/indexes/extract/types.js +14 -0
- package/dist/rules/indexes/extract/types.js.map +1 -0
- package/dist/rules/indexes/extractHandler.d.ts +16 -0
- package/dist/rules/indexes/extractHandler.d.ts.map +1 -0
- package/dist/rules/indexes/extractHandler.js +100 -0
- package/dist/rules/indexes/extractHandler.js.map +1 -0
- package/dist/rules/indexes/extractTool.d.ts +15 -0
- package/dist/rules/indexes/extractTool.d.ts.map +1 -0
- package/dist/rules/indexes/extractTool.js +55 -0
- package/dist/rules/indexes/extractTool.js.map +1 -0
- package/dist/rules/indexes/types.d.ts +71 -0
- package/dist/rules/indexes/types.d.ts.map +1 -0
- package/dist/rules/indexes/types.js +15 -0
- package/dist/rules/indexes/types.js.map +1 -0
- package/dist/rules/inspect/handler.d.ts +6 -0
- package/dist/rules/inspect/handler.d.ts.map +1 -0
- package/dist/rules/inspect/handler.js +144 -0
- package/dist/rules/inspect/handler.js.map +1 -0
- package/dist/rules/inspect/spec.d.ts +37 -0
- package/dist/rules/inspect/spec.d.ts.map +1 -0
- package/dist/rules/inspect/spec.js +2 -0
- package/dist/rules/inspect/spec.js.map +1 -0
- package/dist/rules/inspect/tools.d.ts +21 -0
- package/dist/rules/inspect/tools.d.ts.map +1 -0
- package/dist/rules/inspect/tools.js +21 -0
- package/dist/rules/inspect/tools.js.map +1 -0
- package/dist/rules/internal/extract.d.ts +28 -0
- package/dist/rules/internal/extract.d.ts.map +1 -0
- package/dist/rules/internal/extract.js +25 -0
- package/dist/rules/internal/extract.js.map +1 -0
- package/dist/rules/internal/index.d.ts +82 -0
- package/dist/rules/internal/index.d.ts.map +1 -0
- package/dist/rules/internal/index.js +103 -0
- package/dist/rules/internal/index.js.map +1 -0
- package/dist/rules/internal/node.d.ts +18 -0
- package/dist/rules/internal/node.d.ts.map +1 -0
- package/dist/rules/internal/node.js +27 -0
- package/dist/rules/internal/node.js.map +1 -0
- package/dist/rules/internal/rtdb.d.ts +20 -0
- package/dist/rules/internal/rtdb.d.ts.map +1 -0
- package/dist/rules/internal/rtdb.js +15 -0
- package/dist/rules/internal/rtdb.js.map +1 -0
- package/dist/rules/linter/ast-utils.d.ts +97 -0
- package/dist/rules/linter/ast-utils.d.ts.map +1 -0
- package/dist/rules/linter/ast-utils.js +491 -0
- package/dist/rules/linter/ast-utils.js.map +1 -0
- package/dist/rules/linter/hallucinations.d.ts +34 -0
- package/dist/rules/linter/hallucinations.d.ts.map +1 -0
- package/dist/rules/linter/hallucinations.js +334 -0
- package/dist/rules/linter/hallucinations.js.map +1 -0
- package/dist/rules/linter/linter.d.ts +84 -0
- package/dist/rules/linter/linter.d.ts.map +1 -0
- package/dist/rules/linter/linter.js +783 -0
- package/dist/rules/linter/linter.js.map +1 -0
- package/dist/rules/modules/resolver-browser.d.ts +41 -0
- package/dist/rules/modules/resolver-browser.d.ts.map +1 -0
- package/dist/rules/modules/resolver-browser.js +63 -0
- package/dist/rules/modules/resolver-browser.js.map +1 -0
- package/dist/rules/modules/resolver-core.d.ts +51 -0
- package/dist/rules/modules/resolver-core.d.ts.map +1 -0
- package/dist/rules/modules/resolver-core.js +338 -0
- package/dist/rules/modules/resolver-core.js.map +1 -0
- package/dist/rules/modules/resolver.d.ts +17 -0
- package/dist/rules/modules/resolver.d.ts.map +1 -0
- package/dist/rules/modules/resolver.js +49 -0
- package/dist/rules/modules/resolver.js.map +1 -0
- package/dist/rules/modules/stdlib/atomic.rules +52 -0
- package/dist/rules/modules/stdlib/atomic.test.json +152 -0
- package/dist/rules/modules/stdlib/auth.rules +7 -0
- package/dist/rules/modules/stdlib/auth.test.json +53 -0
- package/dist/rules/modules/stdlib/content.rules +50 -0
- package/dist/rules/modules/stdlib/content.test.json +238 -0
- package/dist/rules/modules/stdlib/counters.rules +41 -0
- package/dist/rules/modules/stdlib/counters.test.json +254 -0
- package/dist/rules/modules/stdlib/geometry.rules +43 -0
- package/dist/rules/modules/stdlib/geometry.test.json +200 -0
- package/dist/rules/modules/stdlib/joining.rules +49 -0
- package/dist/rules/modules/stdlib/joining.test.json +287 -0
- package/dist/rules/modules/stdlib/lifecycle.rules +51 -0
- package/dist/rules/modules/stdlib/lifecycle.test.json +288 -0
- package/dist/rules/modules/stdlib/lobby.rules +44 -0
- package/dist/rules/modules/stdlib/lobby.test.json +32 -0
- package/dist/rules/modules/stdlib/membership.rules +40 -0
- package/dist/rules/modules/stdlib/membership.test.json +107 -0
- package/dist/rules/modules/stdlib/spaces.rules +46 -0
- package/dist/rules/modules/stdlib/spaces.test.json +392 -0
- package/dist/rules/modules/stdlib/state.rules +28 -0
- package/dist/rules/modules/stdlib/state.test.json +55 -0
- package/dist/rules/modules/stdlib/timing.rules +20 -0
- package/dist/rules/modules/stdlib/timing.test.json +106 -0
- package/dist/rules/modules/stdlib/transitions.rules +34 -0
- package/dist/rules/modules/stdlib/transitions.test.json +86 -0
- package/dist/rules/modules/stdlib/turns.rules +27 -0
- package/dist/rules/modules/stdlib/turns.test.json +64 -0
- package/dist/rules/modules/stdlib/validation.rules +31 -0
- package/dist/rules/modules/stdlib/validation.test.json +184 -0
- package/dist/rules/modules/stdlib-content.d.ts +11 -0
- package/dist/rules/modules/stdlib-content.d.ts.map +1 -0
- package/dist/rules/modules/stdlib-content.js +590 -0
- package/dist/rules/modules/stdlib-content.js.map +1 -0
- package/dist/rules/rtdb/compiled-rules.d.ts +11 -0
- package/dist/rules/rtdb/compiled-rules.d.ts.map +1 -0
- package/dist/rules/rtdb/compiled-rules.js +95 -0
- package/dist/rules/rtdb/compiled-rules.js.map +1 -0
- package/dist/rules/rtdb/constraints/atoms.d.ts +29 -0
- package/dist/rules/rtdb/constraints/atoms.d.ts.map +1 -0
- package/dist/rules/rtdb/constraints/atoms.js +43 -0
- package/dist/rules/rtdb/constraints/atoms.js.map +1 -0
- package/dist/rules/rtdb/constraints/compose.d.ts +16 -0
- package/dist/rules/rtdb/constraints/compose.d.ts.map +1 -0
- package/dist/rules/rtdb/constraints/compose.js +15 -0
- package/dist/rules/rtdb/constraints/compose.js.map +1 -0
- package/dist/rules/rtdb/constraints/data.d.ts +30 -0
- package/dist/rules/rtdb/constraints/data.d.ts.map +1 -0
- package/dist/rules/rtdb/constraints/data.js +46 -0
- package/dist/rules/rtdb/constraints/data.js.map +1 -0
- package/dist/rules/rtdb/constraints/document.d.ts +57 -0
- package/dist/rules/rtdb/constraints/document.d.ts.map +1 -0
- package/dist/rules/rtdb/constraints/document.js +85 -0
- package/dist/rules/rtdb/constraints/document.js.map +1 -0
- package/dist/rules/rtdb/constraints/game.d.ts +30 -0
- package/dist/rules/rtdb/constraints/game.d.ts.map +1 -0
- package/dist/rules/rtdb/constraints/game.js +49 -0
- package/dist/rules/rtdb/constraints/game.js.map +1 -0
- package/dist/rules/rtdb/constraints/index.d.ts +12 -0
- package/dist/rules/rtdb/constraints/index.d.ts.map +1 -0
- package/dist/rules/rtdb/constraints/index.js +9 -0
- package/dist/rules/rtdb/constraints/index.js.map +1 -0
- package/dist/rules/rtdb/constraints/policies.d.ts +16 -0
- package/dist/rules/rtdb/constraints/policies.d.ts.map +1 -0
- package/dist/rules/rtdb/constraints/policies.js +17 -0
- package/dist/rules/rtdb/constraints/policies.js.map +1 -0
- package/dist/rules/rtdb/constraints/ruleset.d.ts +5 -0
- package/dist/rules/rtdb/constraints/ruleset.d.ts.map +1 -0
- package/dist/rules/rtdb/constraints/ruleset.js +132 -0
- package/dist/rules/rtdb/constraints/ruleset.js.map +1 -0
- package/dist/rules/rtdb/constraints/schema.d.ts +17 -0
- package/dist/rules/rtdb/constraints/schema.d.ts.map +1 -0
- package/dist/rules/rtdb/constraints/schema.js +74 -0
- package/dist/rules/rtdb/constraints/schema.js.map +1 -0
- package/dist/rules/rtdb/constraints/types.d.ts +22 -0
- package/dist/rules/rtdb/constraints/types.d.ts.map +1 -0
- package/dist/rules/rtdb/constraints/types.js +2 -0
- package/dist/rules/rtdb/constraints/types.js.map +1 -0
- package/dist/rules/rtdb/constraints/write-rules-file.d.ts +24 -0
- package/dist/rules/rtdb/constraints/write-rules-file.d.ts.map +1 -0
- package/dist/rules/rtdb/constraints/write-rules-file.js +30 -0
- package/dist/rules/rtdb/constraints/write-rules-file.js.map +1 -0
- package/dist/rules/rtdb/expression-engine.d.ts +8 -0
- package/dist/rules/rtdb/expression-engine.d.ts.map +1 -0
- package/dist/rules/rtdb/expression-engine.js +20 -0
- package/dist/rules/rtdb/expression-engine.js.map +1 -0
- package/dist/rules/rtdb/grammar/RtdbExpr.ohm +98 -0
- package/dist/rules/rtdb/grammar/RtdbExpr.ohm.generated.d.ts +2 -0
- package/dist/rules/rtdb/grammar/RtdbExpr.ohm.generated.d.ts.map +1 -0
- package/dist/rules/rtdb/grammar/RtdbExpr.ohm.generated.js +103 -0
- package/dist/rules/rtdb/grammar/RtdbExpr.ohm.generated.js.map +1 -0
- package/dist/rules/rtdb/grammar/RtdbExprParser.d.ts +3 -0
- package/dist/rules/rtdb/grammar/RtdbExprParser.d.ts.map +1 -0
- package/dist/rules/rtdb/grammar/RtdbExprParser.js +56 -0
- package/dist/rules/rtdb/grammar/RtdbExprParser.js.map +1 -0
- package/dist/rules/rtdb/grammar/linter.d.ts +3 -0
- package/dist/rules/rtdb/grammar/linter.d.ts.map +1 -0
- package/dist/rules/rtdb/grammar/linter.js +73 -0
- package/dist/rules/rtdb/grammar/linter.js.map +1 -0
- package/dist/rules/rtdb/grammar/simulator.d.ts +30 -0
- package/dist/rules/rtdb/grammar/simulator.d.ts.map +1 -0
- package/dist/rules/rtdb/grammar/simulator.js +282 -0
- package/dist/rules/rtdb/grammar/simulator.js.map +1 -0
- package/dist/rules/rtdb/grammar/validator.d.ts +3 -0
- package/dist/rules/rtdb/grammar/validator.d.ts.map +1 -0
- package/dist/rules/rtdb/grammar/validator.js +91 -0
- package/dist/rules/rtdb/grammar/validator.js.map +1 -0
- package/dist/rules/rtdb/simulation/handler.d.ts +6 -0
- package/dist/rules/rtdb/simulation/handler.d.ts.map +1 -0
- package/dist/rules/rtdb/simulation/handler.js +325 -0
- package/dist/rules/rtdb/simulation/handler.js.map +1 -0
- package/dist/rules/rtdb/simulation/spec.d.ts +102 -0
- package/dist/rules/rtdb/simulation/spec.d.ts.map +1 -0
- package/dist/rules/rtdb/simulation/spec.js +40 -0
- package/dist/rules/rtdb/simulation/spec.js.map +1 -0
- package/dist/rules/rtdb/types.d.ts +166 -0
- package/dist/rules/rtdb/types.d.ts.map +1 -0
- package/dist/rules/rtdb/types.js +21 -0
- package/dist/rules/rtdb/types.js.map +1 -0
- package/dist/rules/simulator/evaluator.d.ts +206 -0
- package/dist/rules/simulator/evaluator.d.ts.map +1 -0
- package/dist/rules/simulator/evaluator.js +1251 -0
- package/dist/rules/simulator/evaluator.js.map +1 -0
- package/dist/rules/simulator/expression/eval-errors.d.ts +86 -0
- package/dist/rules/simulator/expression/eval-errors.d.ts.map +1 -0
- package/dist/rules/simulator/expression/eval-errors.js +68 -0
- package/dist/rules/simulator/expression/eval-errors.js.map +1 -0
- package/dist/rules/simulator/expression/evaluator.d.ts +43 -0
- package/dist/rules/simulator/expression/evaluator.d.ts.map +1 -0
- package/dist/rules/simulator/expression/evaluator.js +298 -0
- package/dist/rules/simulator/expression/evaluator.js.map +1 -0
- package/dist/rules/simulator/expression/lexer.d.ts +36 -0
- package/dist/rules/simulator/expression/lexer.d.ts.map +1 -0
- package/dist/rules/simulator/expression/lexer.js +318 -0
- package/dist/rules/simulator/expression/lexer.js.map +1 -0
- package/dist/rules/simulator/expression/parser.d.ts +39 -0
- package/dist/rules/simulator/expression/parser.d.ts.map +1 -0
- package/dist/rules/simulator/expression/parser.js +329 -0
- package/dist/rules/simulator/expression/parser.js.map +1 -0
- package/dist/rules/simulator/expression/types.d.ts +137 -0
- package/dist/rules/simulator/expression/types.d.ts.map +1 -0
- package/dist/rules/simulator/expression/types.js +90 -0
- package/dist/rules/simulator/expression/types.js.map +1 -0
- package/dist/rules/simulator/expression/walk-data.d.ts +52 -0
- package/dist/rules/simulator/expression/walk-data.d.ts.map +1 -0
- package/dist/rules/simulator/expression/walk-data.js +167 -0
- package/dist/rules/simulator/expression/walk-data.js.map +1 -0
- package/dist/rules/simulator/firestore-set.d.ts +25 -0
- package/dist/rules/simulator/firestore-set.d.ts.map +1 -0
- package/dist/rules/simulator/firestore-set.js +89 -0
- package/dist/rules/simulator/firestore-set.js.map +1 -0
- package/dist/rules/simulator/handler.d.ts +47 -0
- package/dist/rules/simulator/handler.d.ts.map +1 -0
- package/dist/rules/simulator/handler.js +644 -0
- package/dist/rules/simulator/handler.js.map +1 -0
- package/dist/rules/simulator/mapdiff.d.ts +29 -0
- package/dist/rules/simulator/mapdiff.d.ts.map +1 -0
- package/dist/rules/simulator/mapdiff.js +72 -0
- package/dist/rules/simulator/mapdiff.js.map +1 -0
- package/dist/rules/simulator/project-after-state.d.ts +33 -0
- package/dist/rules/simulator/project-after-state.d.ts.map +1 -0
- package/dist/rules/simulator/project-after-state.js +88 -0
- package/dist/rules/simulator/project-after-state.js.map +1 -0
- package/dist/rules/simulator/query-proof.d.ts +80 -0
- package/dist/rules/simulator/query-proof.d.ts.map +1 -0
- package/dist/rules/simulator/query-proof.js +142 -0
- package/dist/rules/simulator/query-proof.js.map +1 -0
- package/dist/rules/simulator/value-equality.d.ts +8 -0
- package/dist/rules/simulator/value-equality.d.ts.map +1 -0
- package/dist/rules/simulator/value-equality.js +40 -0
- package/dist/rules/simulator/value-equality.js.map +1 -0
- package/dist/rules/simulator/wrappers/base.d.ts +129 -0
- package/dist/rules/simulator/wrappers/base.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/base.js +90 -0
- package/dist/rules/simulator/wrappers/base.js.map +1 -0
- package/dist/rules/simulator/wrappers/bytes.d.ts +45 -0
- package/dist/rules/simulator/wrappers/bytes.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/bytes.js +130 -0
- package/dist/rules/simulator/wrappers/bytes.js.map +1 -0
- package/dist/rules/simulator/wrappers/duration.d.ts +76 -0
- package/dist/rules/simulator/wrappers/duration.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/duration.js +176 -0
- package/dist/rules/simulator/wrappers/duration.js.map +1 -0
- package/dist/rules/simulator/wrappers/float.d.ts +52 -0
- package/dist/rules/simulator/wrappers/float.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/float.js +88 -0
- package/dist/rules/simulator/wrappers/float.js.map +1 -0
- package/dist/rules/simulator/wrappers/latlng.d.ts +40 -0
- package/dist/rules/simulator/wrappers/latlng.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/latlng.js +100 -0
- package/dist/rules/simulator/wrappers/latlng.js.map +1 -0
- package/dist/rules/simulator/wrappers/path.d.ts +75 -0
- package/dist/rules/simulator/wrappers/path.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/path.js +158 -0
- package/dist/rules/simulator/wrappers/path.js.map +1 -0
- package/dist/rules/simulator/wrappers/reference.d.ts +82 -0
- package/dist/rules/simulator/wrappers/reference.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/reference.js +145 -0
- package/dist/rules/simulator/wrappers/reference.js.map +1 -0
- package/dist/rules/simulator/wrappers/timestamp.d.ts +86 -0
- package/dist/rules/simulator/wrappers/timestamp.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/timestamp.js +207 -0
- package/dist/rules/simulator/wrappers/timestamp.js.map +1 -0
- package/dist/rules/simulator/wrappers/vector.d.ts +43 -0
- package/dist/rules/simulator/wrappers/vector.d.ts.map +1 -0
- package/dist/rules/simulator/wrappers/vector.js +80 -0
- package/dist/rules/simulator/wrappers/vector.js.map +1 -0
- package/dist/rules/simulator-tools-impl.d.ts +64 -0
- package/dist/rules/simulator-tools-impl.d.ts.map +1 -0
- package/dist/rules/simulator-tools-impl.js +462 -0
- package/dist/rules/simulator-tools-impl.js.map +1 -0
- package/dist/rules/simulator.d.ts +20 -0
- package/dist/rules/simulator.d.ts.map +1 -0
- package/dist/rules/simulator.js +24 -0
- package/dist/rules/simulator.js.map +1 -0
- package/dist/rules/stdlib-modules.d.ts +73 -0
- package/dist/rules/stdlib-modules.d.ts.map +1 -0
- package/dist/rules/stdlib-modules.js +837 -0
- package/dist/rules/stdlib-modules.js.map +1 -0
- package/dist/rules/stdlib-tools.d.ts +19 -0
- package/dist/rules/stdlib-tools.d.ts.map +1 -0
- package/dist/rules/stdlib-tools.js +164 -0
- package/dist/rules/stdlib-tools.js.map +1 -0
- package/dist/rules/test/handler.d.ts +21 -0
- package/dist/rules/test/handler.d.ts.map +1 -0
- package/dist/rules/test/handler.js +214 -0
- package/dist/rules/test/handler.js.map +1 -0
- package/dist/rules/test/spec.d.ts +677 -0
- package/dist/rules/test/spec.d.ts.map +1 -0
- package/dist/rules/test/spec.js +327 -0
- package/dist/rules/test/spec.js.map +1 -0
- package/dist/rules/tools.d.ts +41 -0
- package/dist/rules/tools.d.ts.map +1 -0
- package/dist/rules/tools.js +120 -0
- package/dist/rules/tools.js.map +1 -0
- package/dist/rules/write/handler.d.ts +6 -0
- package/dist/rules/write/handler.d.ts.map +1 -0
- package/dist/rules/write/handler.js +126 -0
- package/dist/rules/write/handler.js.map +1 -0
- package/dist/rules/write/spec.d.ts +28 -0
- package/dist/rules/write/spec.d.ts.map +1 -0
- package/dist/rules/write/spec.js +2 -0
- package/dist/rules/write/spec.js.map +1 -0
- package/dist/sandbox/admin-compat.d.ts +20 -0
- package/dist/sandbox/admin-compat.d.ts.map +1 -0
- package/dist/sandbox/admin-compat.js +19 -0
- package/dist/sandbox/admin-compat.js.map +1 -0
- package/dist/sandbox/admin-firestore/error-translation.d.ts +90 -0
- package/dist/sandbox/admin-firestore/error-translation.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/error-translation.js +214 -0
- package/dist/sandbox/admin-firestore/error-translation.js.map +1 -0
- package/dist/sandbox/admin-firestore/get-admin-firestore.d.ts +44 -0
- package/dist/sandbox/admin-firestore/get-admin-firestore.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/get-admin-firestore.js +62 -0
- package/dist/sandbox/admin-firestore/get-admin-firestore.js.map +1 -0
- package/dist/sandbox/admin-firestore/get-firestore.d.ts +34 -0
- package/dist/sandbox/admin-firestore/get-firestore.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/get-firestore.js +71 -0
- package/dist/sandbox/admin-firestore/get-firestore.js.map +1 -0
- package/dist/sandbox/admin-firestore/index.d.ts +36 -0
- package/dist/sandbox/admin-firestore/index.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/index.js +33 -0
- package/dist/sandbox/admin-firestore/index.js.map +1 -0
- package/dist/sandbox/admin-firestore/listeners.d.ts +46 -0
- package/dist/sandbox/admin-firestore/listeners.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/listeners.js +290 -0
- package/dist/sandbox/admin-firestore/listeners.js.map +1 -0
- package/dist/sandbox/admin-firestore/local-handle.d.ts +23 -0
- package/dist/sandbox/admin-firestore/local-handle.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/local-handle.js +74 -0
- package/dist/sandbox/admin-firestore/local-handle.js.map +1 -0
- package/dist/sandbox/admin-firestore/remote/batch.d.ts +6 -0
- package/dist/sandbox/admin-firestore/remote/batch.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/remote/batch.js +38 -0
- package/dist/sandbox/admin-firestore/remote/batch.js.map +1 -0
- package/dist/sandbox/admin-firestore/remote/channel.d.ts +22 -0
- package/dist/sandbox/admin-firestore/remote/channel.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/remote/channel.js +27 -0
- package/dist/sandbox/admin-firestore/remote/channel.js.map +1 -0
- package/dist/sandbox/admin-firestore/remote/doc-ref.d.ts +10 -0
- package/dist/sandbox/admin-firestore/remote/doc-ref.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/remote/doc-ref.js +88 -0
- package/dist/sandbox/admin-firestore/remote/doc-ref.js.map +1 -0
- package/dist/sandbox/admin-firestore/remote/errors.d.ts +17 -0
- package/dist/sandbox/admin-firestore/remote/errors.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/remote/errors.js +32 -0
- package/dist/sandbox/admin-firestore/remote/errors.js.map +1 -0
- package/dist/sandbox/admin-firestore/remote/listeners.d.ts +43 -0
- package/dist/sandbox/admin-firestore/remote/listeners.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/remote/listeners.js +89 -0
- package/dist/sandbox/admin-firestore/remote/listeners.js.map +1 -0
- package/dist/sandbox/admin-firestore/remote/query.d.ts +47 -0
- package/dist/sandbox/admin-firestore/remote/query.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/remote/query.js +186 -0
- package/dist/sandbox/admin-firestore/remote/query.js.map +1 -0
- package/dist/sandbox/admin-firestore/remote/remote-firestore.d.ts +55 -0
- package/dist/sandbox/admin-firestore/remote/remote-firestore.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/remote/remote-firestore.js +111 -0
- package/dist/sandbox/admin-firestore/remote/remote-firestore.js.map +1 -0
- package/dist/sandbox/admin-firestore/remote/snapshots.d.ts +10 -0
- package/dist/sandbox/admin-firestore/remote/snapshots.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/remote/snapshots.js +37 -0
- package/dist/sandbox/admin-firestore/remote/snapshots.js.map +1 -0
- package/dist/sandbox/admin-firestore/remote/transaction.d.ts +19 -0
- package/dist/sandbox/admin-firestore/remote/transaction.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/remote/transaction.js +105 -0
- package/dist/sandbox/admin-firestore/remote/transaction.js.map +1 -0
- package/dist/sandbox/admin-firestore/remote/value-codec.d.ts +52 -0
- package/dist/sandbox/admin-firestore/remote/value-codec.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/remote/value-codec.js +120 -0
- package/dist/sandbox/admin-firestore/remote/value-codec.js.map +1 -0
- package/dist/sandbox/admin-firestore/remote/wire-types.d.ts +111 -0
- package/dist/sandbox/admin-firestore/remote/wire-types.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/remote/wire-types.js +8 -0
- package/dist/sandbox/admin-firestore/remote/wire-types.js.map +1 -0
- package/dist/sandbox/admin-firestore/types.d.ts +59 -0
- package/dist/sandbox/admin-firestore/types.d.ts.map +1 -0
- package/dist/sandbox/admin-firestore/types.js +6 -0
- package/dist/sandbox/admin-firestore/types.js.map +1 -0
- package/dist/sandbox/branches/index.d.ts +141 -0
- package/dist/sandbox/branches/index.d.ts.map +1 -0
- package/dist/sandbox/branches/index.js +327 -0
- package/dist/sandbox/branches/index.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/batch.d.ts +34 -0
- package/dist/sandbox/firestore/admin-compat/batch.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/batch.js +73 -0
- package/dist/sandbox/firestore/admin-compat/batch.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/doc-ref.d.ts +38 -0
- package/dist/sandbox/firestore/admin-compat/doc-ref.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/doc-ref.js +154 -0
- package/dist/sandbox/firestore/admin-compat/doc-ref.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/firestore.d.ts +47 -0
- package/dist/sandbox/firestore/admin-compat/firestore.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/firestore.js +117 -0
- package/dist/sandbox/firestore/admin-compat/firestore.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/index.d.ts +49 -0
- package/dist/sandbox/firestore/admin-compat/index.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/index.js +27 -0
- package/dist/sandbox/firestore/admin-compat/index.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/paths.d.ts +37 -0
- package/dist/sandbox/firestore/admin-compat/paths.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/paths.js +49 -0
- package/dist/sandbox/firestore/admin-compat/paths.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/query.d.ts +261 -0
- package/dist/sandbox/firestore/admin-compat/query.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/query.js +758 -0
- package/dist/sandbox/firestore/admin-compat/query.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/read-translation.d.ts +8 -0
- package/dist/sandbox/firestore/admin-compat/read-translation.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/read-translation.js +59 -0
- package/dist/sandbox/firestore/admin-compat/read-translation.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/snapshots.d.ts +39 -0
- package/dist/sandbox/firestore/admin-compat/snapshots.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/snapshots.js +50 -0
- package/dist/sandbox/firestore/admin-compat/snapshots.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/transaction.d.ts +35 -0
- package/dist/sandbox/firestore/admin-compat/transaction.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/transaction.js +88 -0
- package/dist/sandbox/firestore/admin-compat/transaction.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/types.d.ts +297 -0
- package/dist/sandbox/firestore/admin-compat/types.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/types.js +127 -0
- package/dist/sandbox/firestore/admin-compat/types.js.map +1 -0
- package/dist/sandbox/firestore/admin-compat/value-order.d.ts +49 -0
- package/dist/sandbox/firestore/admin-compat/value-order.d.ts.map +1 -0
- package/dist/sandbox/firestore/admin-compat/value-order.js +172 -0
- package/dist/sandbox/firestore/admin-compat/value-order.js.map +1 -0
- package/dist/sandbox/firestore/auto-id.d.ts +26 -0
- package/dist/sandbox/firestore/auto-id.d.ts.map +1 -0
- package/dist/sandbox/firestore/auto-id.js +36 -0
- package/dist/sandbox/firestore/auto-id.js.map +1 -0
- package/dist/sandbox/firestore/converters/bytes-geopoint.d.ts +48 -0
- package/dist/sandbox/firestore/converters/bytes-geopoint.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/bytes-geopoint.js +85 -0
- package/dist/sandbox/firestore/converters/bytes-geopoint.js.map +1 -0
- package/dist/sandbox/firestore/converters/fieldvalue.d.ts +69 -0
- package/dist/sandbox/firestore/converters/fieldvalue.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/fieldvalue.js +166 -0
- package/dist/sandbox/firestore/converters/fieldvalue.js.map +1 -0
- package/dist/sandbox/firestore/converters/reference.d.ts +31 -0
- package/dist/sandbox/firestore/converters/reference.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/reference.js +51 -0
- package/dist/sandbox/firestore/converters/reference.js.map +1 -0
- package/dist/sandbox/firestore/converters/timestamp.d.ts +32 -0
- package/dist/sandbox/firestore/converters/timestamp.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/timestamp.js +63 -0
- package/dist/sandbox/firestore/converters/timestamp.js.map +1 -0
- package/dist/sandbox/firestore/converters/user-timestamp.d.ts +46 -0
- package/dist/sandbox/firestore/converters/user-timestamp.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/user-timestamp.js +65 -0
- package/dist/sandbox/firestore/converters/user-timestamp.js.map +1 -0
- package/dist/sandbox/firestore/converters/vector.d.ts +24 -0
- package/dist/sandbox/firestore/converters/vector.d.ts.map +1 -0
- package/dist/sandbox/firestore/converters/vector.js +53 -0
- package/dist/sandbox/firestore/converters/vector.js.map +1 -0
- package/dist/sandbox/firestore/errors.d.ts +82 -0
- package/dist/sandbox/firestore/errors.d.ts.map +1 -0
- package/dist/sandbox/firestore/errors.js +54 -0
- package/dist/sandbox/firestore/errors.js.map +1 -0
- package/dist/sandbox/firestore/event-log.d.ts +99 -0
- package/dist/sandbox/firestore/event-log.d.ts.map +1 -0
- package/dist/sandbox/firestore/event-log.js +67 -0
- package/dist/sandbox/firestore/event-log.js.map +1 -0
- package/dist/sandbox/firestore/field-merge.d.ts +64 -0
- package/dist/sandbox/firestore/field-merge.d.ts.map +1 -0
- package/dist/sandbox/firestore/field-merge.js +221 -0
- package/dist/sandbox/firestore/field-merge.js.map +1 -0
- package/dist/sandbox/firestore/list-query-proof.d.ts +77 -0
- package/dist/sandbox/firestore/list-query-proof.d.ts.map +1 -0
- package/dist/sandbox/firestore/list-query-proof.js +170 -0
- package/dist/sandbox/firestore/list-query-proof.js.map +1 -0
- package/dist/sandbox/firestore/local-environment.d.ts +825 -0
- package/dist/sandbox/firestore/local-environment.d.ts.map +1 -0
- package/dist/sandbox/firestore/local-environment.js +3129 -0
- package/dist/sandbox/firestore/local-environment.js.map +1 -0
- package/dist/sandbox/firestore/local-state.d.ts +196 -0
- package/dist/sandbox/firestore/local-state.d.ts.map +1 -0
- package/dist/sandbox/firestore/local-state.js +413 -0
- package/dist/sandbox/firestore/local-state.js.map +1 -0
- package/dist/sandbox/firestore/overlay-backing.d.ts +44 -0
- package/dist/sandbox/firestore/overlay-backing.d.ts.map +1 -0
- package/dist/sandbox/firestore/overlay-backing.js +82 -0
- package/dist/sandbox/firestore/overlay-backing.js.map +1 -0
- package/dist/sandbox/firestore/sentinel-capture.d.ts +30 -0
- package/dist/sandbox/firestore/sentinel-capture.d.ts.map +1 -0
- package/dist/sandbox/firestore/sentinel-capture.js +61 -0
- package/dist/sandbox/firestore/sentinel-capture.js.map +1 -0
- package/dist/sandbox/firestore/snapshot-listeners.d.ts +290 -0
- package/dist/sandbox/firestore/snapshot-listeners.d.ts.map +1 -0
- package/dist/sandbox/firestore/snapshot-listeners.js +194 -0
- package/dist/sandbox/firestore/snapshot-listeners.js.map +1 -0
- package/dist/sandbox/firestore/topk.d.ts +12 -0
- package/dist/sandbox/firestore/topk.d.ts.map +1 -0
- package/dist/sandbox/firestore/topk.js +42 -0
- package/dist/sandbox/firestore/topk.js.map +1 -0
- package/dist/sandbox/firestore/transaction-merge.d.ts +55 -0
- package/dist/sandbox/firestore/transaction-merge.d.ts.map +1 -0
- package/dist/sandbox/firestore/transaction-merge.js +107 -0
- package/dist/sandbox/firestore/transaction-merge.js.map +1 -0
- package/dist/sandbox/firestore/transaction-types.d.ts +155 -0
- package/dist/sandbox/firestore/transaction-types.d.ts.map +1 -0
- package/dist/sandbox/firestore/transaction-types.js +10 -0
- package/dist/sandbox/firestore/transaction-types.js.map +1 -0
- package/dist/sandbox/firestore/transaction.d.ts +79 -0
- package/dist/sandbox/firestore/transaction.d.ts.map +1 -0
- package/dist/sandbox/firestore/transaction.js +95 -0
- package/dist/sandbox/firestore/transaction.js.map +1 -0
- package/dist/sandbox/firestore/value-equality.d.ts +2 -0
- package/dist/sandbox/firestore/value-equality.d.ts.map +1 -0
- package/dist/sandbox/firestore/value-equality.js +35 -0
- package/dist/sandbox/firestore/value-equality.js.map +1 -0
- package/dist/sandbox/firestore/value-resolver.d.ts +172 -0
- package/dist/sandbox/firestore/value-resolver.d.ts.map +1 -0
- package/dist/sandbox/firestore/value-resolver.js +221 -0
- package/dist/sandbox/firestore/value-resolver.js.map +1 -0
- package/dist/sandbox/firestore/wire-encoder.d.ts +14 -0
- package/dist/sandbox/firestore/wire-encoder.d.ts.map +1 -0
- package/dist/sandbox/firestore/wire-encoder.js +130 -0
- package/dist/sandbox/firestore/wire-encoder.js.map +1 -0
- package/dist/sandbox/index.d.ts +53 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/index.js +65 -0
- package/dist/sandbox/index.js.map +1 -0
- package/dist/sandbox/internal/client-app.d.ts +29 -0
- package/dist/sandbox/internal/client-app.d.ts.map +1 -0
- package/dist/sandbox/internal/client-app.js +18 -0
- package/dist/sandbox/internal/client-app.js.map +1 -0
- package/dist/sandbox/internal/firebase-error.d.ts +14 -0
- package/dist/sandbox/internal/firebase-error.d.ts.map +1 -0
- package/dist/sandbox/internal/firebase-error.js +22 -0
- package/dist/sandbox/internal/firebase-error.js.map +1 -0
- package/dist/sandbox/internal/index.d.ts +39 -0
- package/dist/sandbox/internal/index.d.ts.map +1 -0
- package/dist/sandbox/internal/index.js +75 -0
- package/dist/sandbox/internal/index.js.map +1 -0
- package/dist/sandbox/internal/local-brand.d.ts +3 -0
- package/dist/sandbox/internal/local-brand.d.ts.map +1 -0
- package/dist/sandbox/internal/local-brand.js +3 -0
- package/dist/sandbox/internal/local-brand.js.map +1 -0
- package/dist/sandbox/internal/provenance.d.ts +16 -0
- package/dist/sandbox/internal/provenance.d.ts.map +1 -0
- package/dist/sandbox/internal/provenance.js +139 -0
- package/dist/sandbox/internal/provenance.js.map +1 -0
- package/dist/sandbox/internal/sandbox-impl.d.ts +328 -0
- package/dist/sandbox/internal/sandbox-impl.d.ts.map +1 -0
- package/dist/sandbox/internal/sandbox-impl.js +695 -0
- package/dist/sandbox/internal/sandbox-impl.js.map +1 -0
- package/dist/sandbox/operation-record.d.ts +48 -0
- package/dist/sandbox/operation-record.d.ts.map +1 -0
- package/dist/sandbox/operation-record.js +143 -0
- package/dist/sandbox/operation-record.js.map +1 -0
- package/dist/sandbox/persistence/backends.d.ts +37 -0
- package/dist/sandbox/persistence/backends.d.ts.map +1 -0
- package/dist/sandbox/persistence/backends.js +202 -0
- package/dist/sandbox/persistence/backends.js.map +1 -0
- package/dist/sandbox/persistence/chunk-format.d.ts +58 -0
- package/dist/sandbox/persistence/chunk-format.d.ts.map +1 -0
- package/dist/sandbox/persistence/chunk-format.js +163 -0
- package/dist/sandbox/persistence/chunk-format.js.map +1 -0
- package/dist/sandbox/persistence/controller.d.ts +39 -0
- package/dist/sandbox/persistence/controller.d.ts.map +1 -0
- package/dist/sandbox/persistence/controller.js +505 -0
- package/dist/sandbox/persistence/controller.js.map +1 -0
- package/dist/sandbox/persistence/index.d.ts +13 -0
- package/dist/sandbox/persistence/index.d.ts.map +1 -0
- package/dist/sandbox/persistence/index.js +5 -0
- package/dist/sandbox/persistence/index.js.map +1 -0
- package/dist/sandbox/persistence/serialize.d.ts +53 -0
- package/dist/sandbox/persistence/serialize.d.ts.map +1 -0
- package/dist/sandbox/persistence/serialize.js +98 -0
- package/dist/sandbox/persistence/serialize.js.map +1 -0
- package/dist/sandbox/persistence/types.d.ts +118 -0
- package/dist/sandbox/persistence/types.d.ts.map +1 -0
- package/dist/sandbox/persistence/types.js +15 -0
- package/dist/sandbox/persistence/types.js.map +1 -0
- package/dist/sandbox/remote.d.ts +118 -0
- package/dist/sandbox/remote.d.ts.map +1 -0
- package/dist/sandbox/remote.js +60 -0
- package/dist/sandbox/remote.js.map +1 -0
- package/dist/sandbox/replay/index.d.ts +106 -0
- package/dist/sandbox/replay/index.d.ts.map +1 -0
- package/dist/sandbox/replay/index.js +246 -0
- package/dist/sandbox/replay/index.js.map +1 -0
- package/dist/sandbox/sandbox-context.d.ts +48 -0
- package/dist/sandbox/sandbox-context.d.ts.map +1 -0
- package/dist/sandbox/sandbox-context.js +97 -0
- package/dist/sandbox/sandbox-context.js.map +1 -0
- package/dist/sandbox/tab-sync/index.d.ts +120 -0
- package/dist/sandbox/tab-sync/index.d.ts.map +1 -0
- package/dist/sandbox/tab-sync/index.js +273 -0
- package/dist/sandbox/tab-sync/index.js.map +1 -0
- package/dist/sandbox/types/auth-state.d.ts +23 -0
- package/dist/sandbox/types/auth-state.d.ts.map +1 -0
- package/dist/sandbox/types/auth-state.js +8 -0
- package/dist/sandbox/types/auth-state.js.map +1 -0
- package/dist/sandbox/types/context.d.ts +33 -0
- package/dist/sandbox/types/context.d.ts.map +1 -0
- package/dist/sandbox/types/context.js +5 -0
- package/dist/sandbox/types/context.js.map +1 -0
- package/dist/sandbox/types/errors.d.ts +109 -0
- package/dist/sandbox/types/errors.d.ts.map +1 -0
- package/dist/sandbox/types/errors.js +41 -0
- package/dist/sandbox/types/errors.js.map +1 -0
- package/dist/sandbox/types/events.d.ts +577 -0
- package/dist/sandbox/types/events.d.ts.map +1 -0
- package/dist/sandbox/types/events.js +7 -0
- package/dist/sandbox/types/events.js.map +1 -0
- package/dist/sandbox/types/index.d.ts +24 -0
- package/dist/sandbox/types/index.d.ts.map +1 -0
- package/dist/sandbox/types/index.js +17 -0
- package/dist/sandbox/types/index.js.map +1 -0
- package/dist/sandbox/types/operation.d.ts +60 -0
- package/dist/sandbox/types/operation.d.ts.map +1 -0
- package/dist/sandbox/types/operation.js +3 -0
- package/dist/sandbox/types/operation.js.map +1 -0
- package/dist/sandbox/types/persistence.d.ts +130 -0
- package/dist/sandbox/types/persistence.d.ts.map +1 -0
- package/dist/sandbox/types/persistence.js +7 -0
- package/dist/sandbox/types/persistence.js.map +1 -0
- package/dist/sandbox/types/service.d.ts +357 -0
- package/dist/sandbox/types/service.d.ts.map +1 -0
- package/dist/sandbox/types/service.js +6 -0
- package/dist/sandbox/types/service.js.map +1 -0
- package/dist/storage/admin/api.d.ts +206 -0
- package/dist/storage/admin/api.d.ts.map +1 -0
- package/dist/storage/admin/api.js +349 -0
- package/dist/storage/admin/api.js.map +1 -0
- package/dist/storage/admin/handler.d.ts +28 -0
- package/dist/storage/admin/handler.d.ts.map +1 -0
- package/dist/storage/admin/handler.js +82 -0
- package/dist/storage/admin/handler.js.map +1 -0
- package/dist/storage/admin/spec.d.ts +64 -0
- package/dist/storage/admin/spec.d.ts.map +1 -0
- package/dist/storage/admin/spec.js +8 -0
- package/dist/storage/admin/spec.js.map +1 -0
- package/dist/storage/admin/tools.d.ts +22 -0
- package/dist/storage/admin/tools.d.ts.map +1 -0
- package/dist/storage/admin/tools.js +90 -0
- package/dist/storage/admin/tools.js.map +1 -0
- package/dist/storage/download.d.ts +41 -0
- package/dist/storage/download.d.ts.map +1 -0
- package/dist/storage/download.js +137 -0
- package/dist/storage/download.js.map +1 -0
- package/dist/storage/enforce.d.ts +5 -0
- package/dist/storage/enforce.d.ts.map +1 -0
- package/dist/storage/enforce.js +147 -0
- package/dist/storage/enforce.js.map +1 -0
- package/dist/storage/errors.d.ts +44 -0
- package/dist/storage/errors.d.ts.map +1 -0
- package/dist/storage/errors.js +64 -0
- package/dist/storage/errors.js.map +1 -0
- package/dist/storage/index.d.ts +45 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +39 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/instances.d.ts +9 -0
- package/dist/storage/instances.d.ts.map +1 -0
- package/dist/storage/instances.js +24 -0
- package/dist/storage/instances.js.map +1 -0
- package/dist/storage/internal.d.ts +18 -0
- package/dist/storage/internal.d.ts.map +1 -0
- package/dist/storage/internal.js +18 -0
- package/dist/storage/internal.js.map +1 -0
- package/dist/storage/list.d.ts +42 -0
- package/dist/storage/list.d.ts.map +1 -0
- package/dist/storage/list.js +83 -0
- package/dist/storage/list.js.map +1 -0
- package/dist/storage/metadata.d.ts +92 -0
- package/dist/storage/metadata.d.ts.map +1 -0
- package/dist/storage/metadata.js +164 -0
- package/dist/storage/metadata.js.map +1 -0
- package/dist/storage/persistence.d.ts +134 -0
- package/dist/storage/persistence.d.ts.map +1 -0
- package/dist/storage/persistence.js +132 -0
- package/dist/storage/persistence.js.map +1 -0
- package/dist/storage/reference.d.ts +57 -0
- package/dist/storage/reference.d.ts.map +1 -0
- package/dist/storage/reference.js +105 -0
- package/dist/storage/reference.js.map +1 -0
- package/dist/storage/rules.d.ts +339 -0
- package/dist/storage/rules.d.ts.map +1 -0
- package/dist/storage/rules.js +1334 -0
- package/dist/storage/rules.js.map +1 -0
- package/dist/storage/service.d.ts +122 -0
- package/dist/storage/service.d.ts.map +1 -0
- package/dist/storage/service.js +247 -0
- package/dist/storage/service.js.map +1 -0
- package/dist/storage/upload.d.ts +50 -0
- package/dist/storage/upload.d.ts.map +1 -0
- package/dist/storage/upload.js +246 -0
- package/dist/storage/upload.js.map +1 -0
- package/package.json +156 -3
|
@@ -0,0 +1,1071 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `pyric/database` sandbox-only modular SDK mirror.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `firebase/database`'s tree-shakable free-function shape:
|
|
5
|
+
* `getDatabase`, `ref`, `child`, `get`, `set`, `update`, `remove`,
|
|
6
|
+
* `push`, `onValue`, `serverTimestamp`, `connectDatabaseEmulator`.
|
|
7
|
+
*
|
|
8
|
+
* Two sandbox identity modes are picked by what's passed to `getDatabase`:
|
|
9
|
+
*
|
|
10
|
+
* - **Sandbox target** — wraps `RtdbBackend` (in-memory JSON tree
|
|
11
|
+
* plus the existing RTDB rule simulator). Identity is the
|
|
12
|
+
* `SandboxContext`'s frozen `auth`.
|
|
13
|
+
* - **Sandbox-live target** — same backend, but identity is read
|
|
14
|
+
* per-op from `sandbox.currentUser` so a `pyric/auth`-driven
|
|
15
|
+
* sign-in flips the next op's `request.auth` without re-binding.
|
|
16
|
+
*
|
|
17
|
+
* Routing machinery mirrors `pyric/firestore`:
|
|
18
|
+
* - {@link TARGET_SYMBOL} brand on every {@link Database} handle.
|
|
19
|
+
* - {@link refToTarget} WeakMap from refs to their owning target so
|
|
20
|
+
* chained calls (`child(ref, 'sub')`, `get(ref)`) recover routing.
|
|
21
|
+
*
|
|
22
|
+
* **Critical contract — error shape (locked by oracle observation
|
|
23
|
+
* `packages/conformance/observations/rtdb/rtdb-rules-denied-error-code.json`):**
|
|
24
|
+
*
|
|
25
|
+
* - Throws a **plain `Error`** (NOT a `FirebaseError`).
|
|
26
|
+
* - `.code === 'PERMISSION_DENIED'` (uppercase snake-case — distinct
|
|
27
|
+
* from Firestore's `'permission-denied'`).
|
|
28
|
+
* - `.message === 'PERMISSION_DENIED: Permission denied'`.
|
|
29
|
+
*
|
|
30
|
+
* The sandbox backend matches this shape exactly. Tests assert against
|
|
31
|
+
* `.constructor.name === 'Error'` to catch any future "improvement" to
|
|
32
|
+
* a custom subclass.
|
|
33
|
+
*/
|
|
34
|
+
import { SandboxContextImpl } from 'pyric/sandbox';
|
|
35
|
+
import { defaultClientApp, resolveClientApp, } from '../sandbox/internal/client-app.js';
|
|
36
|
+
import { getOrCreateBackend } from './sandbox/backend-for.js';
|
|
37
|
+
import { generatePushId } from './sandbox/push-id.js';
|
|
38
|
+
import { serverTimestampSentinel, incrementSentinel, } from './sandbox/sentinels.js';
|
|
39
|
+
import { joinPath, pathSegments } from './sandbox/data-tree.js';
|
|
40
|
+
import { coerceArrays } from './sandbox/normalize.js';
|
|
41
|
+
import { applyConstraint, emptySpec, } from './sandbox/query.js';
|
|
42
|
+
import { ListenerRegistry } from './listener-registry.js';
|
|
43
|
+
// ─── Brand + routing ─────────────────────────────────────────────────
|
|
44
|
+
/** Hidden brand on every {@link Database} handle. */
|
|
45
|
+
export const TARGET_SYMBOL = Symbol('pyric/database/target');
|
|
46
|
+
/** Resolve the active identity for a sandbox-flavored target. */
|
|
47
|
+
function authFor(t) {
|
|
48
|
+
if (t.admin)
|
|
49
|
+
return null;
|
|
50
|
+
return t.kind === 'sandbox' ? t.auth : (t.currentUser?.() ?? t.sandbox.currentUser);
|
|
51
|
+
}
|
|
52
|
+
const refToTarget = new WeakMap();
|
|
53
|
+
function tag(obj, target) {
|
|
54
|
+
refToTarget.set(obj, target);
|
|
55
|
+
return obj;
|
|
56
|
+
}
|
|
57
|
+
function targetOf(refOrDb) {
|
|
58
|
+
let target;
|
|
59
|
+
if (TARGET_SYMBOL in refOrDb) {
|
|
60
|
+
target = refOrDb[TARGET_SYMBOL];
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
target = refToTarget.get(refOrDb);
|
|
64
|
+
}
|
|
65
|
+
if (!target) {
|
|
66
|
+
throw new TypeError('pyric/database: unrecognized reference — was it produced by a factory in this package?');
|
|
67
|
+
}
|
|
68
|
+
if (target.kind === 'sandbox-live')
|
|
69
|
+
target.assertUsable?.();
|
|
70
|
+
return target;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Hidden brand on every {@link Query} (and on every QueryConstraint).
|
|
74
|
+
* Distinct from `TARGET_SYMBOL`; this brand is only used to dispatch
|
|
75
|
+
* `get` / `onValue` between plain refs and query-wrapped refs.
|
|
76
|
+
*/
|
|
77
|
+
export const QUERY_SYMBOL = Symbol('pyric/database/query');
|
|
78
|
+
/** Hidden brand on every {@link QueryConstraint}. */
|
|
79
|
+
const CONSTRAINT_SYMBOL = Symbol('pyric/database/query-constraint');
|
|
80
|
+
function buildConstraint(type, internal) {
|
|
81
|
+
return Object.freeze({
|
|
82
|
+
type,
|
|
83
|
+
[CONSTRAINT_SYMBOL]: internal,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function isQuery(v) {
|
|
87
|
+
return QUERY_SYMBOL in v;
|
|
88
|
+
}
|
|
89
|
+
export function getDatabase(target) {
|
|
90
|
+
if (target === undefined)
|
|
91
|
+
return getDatabase(defaultClientApp());
|
|
92
|
+
// Package resolution already selected the sandbox mirror; the neutral app
|
|
93
|
+
// adapter resolves an associated FirebaseApp to its app-owned runtime.
|
|
94
|
+
const appRuntime = resolveClientApp(target);
|
|
95
|
+
if (appRuntime) {
|
|
96
|
+
return appRuntime.service('database/default', () => {
|
|
97
|
+
const { sandbox, session } = appRuntime;
|
|
98
|
+
let deleted = false;
|
|
99
|
+
appRuntime.onDelete(() => { deleted = true; });
|
|
100
|
+
const backend = getOrCreateBackend(sandbox);
|
|
101
|
+
const t = {
|
|
102
|
+
kind: 'sandbox-live',
|
|
103
|
+
backend,
|
|
104
|
+
sandbox,
|
|
105
|
+
currentUser: () => session.currentUser,
|
|
106
|
+
onCurrentUserChanged: (callback) => session.onCurrentUserChanged(callback),
|
|
107
|
+
own: (cleanup) => appRuntime.onDelete(cleanup),
|
|
108
|
+
assertUsable: () => {
|
|
109
|
+
if (deleted) {
|
|
110
|
+
throw new Error('FIREBASE FATAL ERROR: Cannot call ref on a deleted database. ');
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
return { [TARGET_SYMBOL]: t, app: target };
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (isSandboxContext(target)) {
|
|
118
|
+
const backend = getOrCreateBackend(target.sandbox);
|
|
119
|
+
const t = { kind: 'sandbox', backend, auth: target.auth };
|
|
120
|
+
return { [TARGET_SYMBOL]: t };
|
|
121
|
+
}
|
|
122
|
+
if (isSandbox(target)) {
|
|
123
|
+
const backend = getOrCreateBackend(target);
|
|
124
|
+
const t = {
|
|
125
|
+
kind: 'sandbox-live',
|
|
126
|
+
backend,
|
|
127
|
+
sandbox: target,
|
|
128
|
+
onCurrentUserChanged: (callback) => target.onCurrentUserChanged(callback),
|
|
129
|
+
};
|
|
130
|
+
return { [TARGET_SYMBOL]: t };
|
|
131
|
+
}
|
|
132
|
+
throw packageResolutionError();
|
|
133
|
+
}
|
|
134
|
+
export function getAdminDatabase(target) {
|
|
135
|
+
const appRuntime = resolveClientApp(target);
|
|
136
|
+
if (appRuntime) {
|
|
137
|
+
appRuntime.assertAlive();
|
|
138
|
+
return getAdminDatabase(appRuntime.sandbox);
|
|
139
|
+
}
|
|
140
|
+
const sandbox = isSandboxContext(target)
|
|
141
|
+
? target.sandbox
|
|
142
|
+
: isSandbox(target)
|
|
143
|
+
? target
|
|
144
|
+
: undefined;
|
|
145
|
+
if (sandbox === undefined)
|
|
146
|
+
throw packageResolutionError();
|
|
147
|
+
const backend = getOrCreateBackend(sandbox);
|
|
148
|
+
const t = { kind: 'sandbox', backend, auth: null, admin: true };
|
|
149
|
+
return { [TARGET_SYMBOL]: t };
|
|
150
|
+
}
|
|
151
|
+
function packageResolutionError() {
|
|
152
|
+
return new TypeError('pyric/database is a sandbox-only mirror. Package resolution must leave firebase/database unchanged for production; activate pyric dev or @pyric/cli/register before importing to select the sandbox.');
|
|
153
|
+
}
|
|
154
|
+
function isSandboxContext(target) {
|
|
155
|
+
return target instanceof SandboxContextImpl;
|
|
156
|
+
}
|
|
157
|
+
function isSandbox(target) {
|
|
158
|
+
if (target === null || typeof target !== 'object')
|
|
159
|
+
return false;
|
|
160
|
+
const o = target;
|
|
161
|
+
return (typeof o.withAuth === 'function'
|
|
162
|
+
&& typeof o.onCurrentUserChanged === 'function'
|
|
163
|
+
&& 'currentUser' in o
|
|
164
|
+
&& 'admin' in o);
|
|
165
|
+
}
|
|
166
|
+
// ─── Reference constructors ──────────────────────────────────────────
|
|
167
|
+
/**
|
|
168
|
+
* Build a {@link DatabaseReference} at `path` (default root).
|
|
169
|
+
*
|
|
170
|
+
* Path normalisation: leading + trailing slashes are stripped;
|
|
171
|
+
* empty path / `'/'` becomes the root.
|
|
172
|
+
*/
|
|
173
|
+
export function ref(db, path) {
|
|
174
|
+
const target = targetOf(db);
|
|
175
|
+
return buildSandboxRef(target, path ?? '/');
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Sub-path constructor. `child(ref, 'sub/path')` returns a ref at
|
|
179
|
+
* `<ref>/sub/path`.
|
|
180
|
+
*
|
|
181
|
+
* Mirrors `firebase/database`'s `child(parent, path)` — leading +
|
|
182
|
+
* empty segments stripped; the result inherits the parent's target.
|
|
183
|
+
*/
|
|
184
|
+
export function child(parent, path) {
|
|
185
|
+
const target = targetOf(parent);
|
|
186
|
+
const absSegs = [...pathSegments(parent._path), ...pathSegments(path)];
|
|
187
|
+
return buildSandboxRef(target, joinPath(absSegs));
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Build a sandbox-backed `DatabaseReference`. Cached parent / root
|
|
191
|
+
* pointers are computed lazily so a long chain doesn't materialise
|
|
192
|
+
* every intermediate ref upfront.
|
|
193
|
+
*/
|
|
194
|
+
function buildSandboxRef(target, path) {
|
|
195
|
+
const canonical = joinPath(pathSegments(path));
|
|
196
|
+
const segs = pathSegments(canonical);
|
|
197
|
+
const key = segs.length === 0 ? null : segs[segs.length - 1];
|
|
198
|
+
const self = {
|
|
199
|
+
key,
|
|
200
|
+
_path: canonical,
|
|
201
|
+
get parent() {
|
|
202
|
+
if (segs.length === 0)
|
|
203
|
+
return null;
|
|
204
|
+
return buildSandboxRef(target, joinPath(segs.slice(0, -1)));
|
|
205
|
+
},
|
|
206
|
+
get root() {
|
|
207
|
+
return buildSandboxRef(target, '/');
|
|
208
|
+
},
|
|
209
|
+
toString() {
|
|
210
|
+
return `sandbox://rtdb${canonical}`;
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
tag(self, target);
|
|
214
|
+
return self;
|
|
215
|
+
}
|
|
216
|
+
// ─── Reads ───────────────────────────────────────────────────────────
|
|
217
|
+
/**
|
|
218
|
+
* `get(ref)` — one-shot read at the ref's path. Resolves to a
|
|
219
|
+
* `DataSnapshot`-shaped object.
|
|
220
|
+
*
|
|
221
|
+
* Runs through the sandbox rule engine; denial throws the plain-`Error`
|
|
222
|
+
* shape locked by the oracle.
|
|
223
|
+
*
|
|
224
|
+
* Absent path → `snap.val() === null && snap.exists() === false`.
|
|
225
|
+
* Matches the SDK's `DataSnapshot.val()` contract.
|
|
226
|
+
*/
|
|
227
|
+
export async function get(r) {
|
|
228
|
+
// Query branch — windowed read.
|
|
229
|
+
if (isQuery(r)) {
|
|
230
|
+
const q = r;
|
|
231
|
+
const target = targetOf(q.ref);
|
|
232
|
+
const rows = target.admin
|
|
233
|
+
? target.backend.adminGetQuery(q.ref._path, q._spec)
|
|
234
|
+
: target.backend.getQuery(authFor(target), q.ref._path, q._spec);
|
|
235
|
+
return buildSandboxQuerySnap(target, q.ref, rows);
|
|
236
|
+
}
|
|
237
|
+
const ref0 = r;
|
|
238
|
+
const target = targetOf(ref0);
|
|
239
|
+
const val = target.admin
|
|
240
|
+
? target.backend.adminGet(ref0._path)
|
|
241
|
+
: target.backend.get(authFor(target), ref0._path);
|
|
242
|
+
return buildSandboxSnap(target, ref0, val);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* `set(ref, value)` — replace the value at `ref`'s path. `null`
|
|
246
|
+
* deletes (matches the RTDB invariant — locked by oracle observation
|
|
247
|
+
* `rtdb-remove-vs-set-null.json`).
|
|
248
|
+
*
|
|
249
|
+
* `serverTimestamp()` sentinels are resolved at write time.
|
|
250
|
+
*/
|
|
251
|
+
export async function set(r, value) {
|
|
252
|
+
const target = targetOf(r);
|
|
253
|
+
if (target.admin) {
|
|
254
|
+
target.backend.adminSet(r._path, value);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
target.backend.set(authFor(target), r._path, value);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* `update(ref, values)` — partial update.
|
|
262
|
+
*
|
|
263
|
+
* - When `values` keys contain `/`, the call is a **multi-path atomic
|
|
264
|
+
* update**: every listed path is written as one transaction (any
|
|
265
|
+
* denial fails the whole batch).
|
|
266
|
+
* - Otherwise it's a **shallow merge** at the ref's path: each
|
|
267
|
+
* top-level key replaces the corresponding child. `null` values
|
|
268
|
+
* delete.
|
|
269
|
+
*
|
|
270
|
+
* Both behaviors are sandbox-implemented per the RtdbBackend's
|
|
271
|
+
* `update` method (`rtdb-modular`-spec atomic claim, matrix row #23).
|
|
272
|
+
*/
|
|
273
|
+
export async function update(r, values) {
|
|
274
|
+
const target = targetOf(r);
|
|
275
|
+
if (target.admin) {
|
|
276
|
+
target.backend.adminUpdate(r._path, values);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
target.backend.update(authFor(target), r._path, values);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* `remove(ref)` — delete the subtree at the ref's path.
|
|
284
|
+
*
|
|
285
|
+
* RTDB invariant (oracle: `rtdb-remove-vs-set-null.json`): equivalent
|
|
286
|
+
* to `set(ref, null)`. The sandbox backend dispatches `remove` through
|
|
287
|
+
* the same code path as `set(_, null)`.
|
|
288
|
+
*/
|
|
289
|
+
export async function remove(r) {
|
|
290
|
+
const target = targetOf(r);
|
|
291
|
+
if (target.admin) {
|
|
292
|
+
target.backend.adminRemove(r._path);
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
target.backend.remove(authFor(target), r._path);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* `push(ref, value?)` — mint an auto-id child key under `ref`'s path,
|
|
300
|
+
* optionally writing `value` at the new child.
|
|
301
|
+
*
|
|
302
|
+
* Returns a ref at the new child path. The ref's `key` is the minted
|
|
303
|
+
* id (locked by oracle observation `rtdb-push-autoid-format.json`:
|
|
304
|
+
* 20 chars, leading `-`, lex-sortable).
|
|
305
|
+
*
|
|
306
|
+
* Production note: the key is minted **client-side** (no server
|
|
307
|
+
* round-trip required); it's available synchronously on the returned
|
|
308
|
+
* ref even when the optional write is denied by rules. The oracle
|
|
309
|
+
* observation confirms this — the sandbox matches.
|
|
310
|
+
*/
|
|
311
|
+
export function push(r, value) {
|
|
312
|
+
const target = targetOf(r);
|
|
313
|
+
// Mint the key SYNCHRONOUSLY (client-side, no rule check) so the
|
|
314
|
+
// returned ref + `.key` are available even if the optional write is
|
|
315
|
+
// later denied (DB-B7). The write is deferred onto the thenable's
|
|
316
|
+
// promise — a rules denial REJECTS the promise rather than throwing
|
|
317
|
+
// here and discarding the key.
|
|
318
|
+
const key = target.backend.mintKey();
|
|
319
|
+
const childPath = joinPath([...pathSegments(r._path), key]);
|
|
320
|
+
// Two refs (mirroring upstream): `thenablePushRef` gets then/catch and
|
|
321
|
+
// is returned; `pushRef` is a SEPARATE plain ref used as the promise's
|
|
322
|
+
// fulfilled value — so resolving the promise doesn't re-enter the
|
|
323
|
+
// thenable's own `then` (the self-reference unwrap trap).
|
|
324
|
+
const thenablePushRef = buildSandboxRef(target, childPath);
|
|
325
|
+
const pushRef = buildSandboxRef(target, childPath);
|
|
326
|
+
const promise = value === undefined
|
|
327
|
+
? Promise.resolve(pushRef)
|
|
328
|
+
: set(pushRef, value).then(() => pushRef);
|
|
329
|
+
return makeThenable(thenablePushRef, promise);
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Attach `then`/`catch` to a ref so it satisfies {@link ThenableReference}.
|
|
333
|
+
* Mirrors upstream's `thenablePushRef.then = promise.then.bind(promise)`
|
|
334
|
+
* (`api/Reference_impl.ts:627-629`). The ref's own fields are untouched —
|
|
335
|
+
* it stays a usable {@link DatabaseReference}.
|
|
336
|
+
*/
|
|
337
|
+
function makeThenable(pushRef, promise) {
|
|
338
|
+
const thenable = pushRef;
|
|
339
|
+
thenable.then = promise.then.bind(promise);
|
|
340
|
+
thenable.catch = promise.catch.bind(promise);
|
|
341
|
+
return thenable;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Pre-mint a push key without writing. Used by callers that need the
|
|
345
|
+
* key for a multi-path update (`update(rootRef, { [\`/users/${key}\`]: ... })`).
|
|
346
|
+
* Returns a freshly-minted key.
|
|
347
|
+
*/
|
|
348
|
+
export function pushKey() {
|
|
349
|
+
return generatePushId();
|
|
350
|
+
}
|
|
351
|
+
// ─── Listeners (Tier 2) ──────────────────────────────────────────────
|
|
352
|
+
/**
|
|
353
|
+
* RTDB evaluates a listener with the Auth instance attached to its app. When
|
|
354
|
+
* that app's session changes, replace the backend registration with one made
|
|
355
|
+
* under the new identity. Registrations belonging to other app sessions are
|
|
356
|
+
* untouched even though all equal-config apps share one data backend.
|
|
357
|
+
*/
|
|
358
|
+
function subscribeWithLiveAuth(target, subscribe) {
|
|
359
|
+
let stopped = false;
|
|
360
|
+
let backendUnsubscribe = subscribe(authFor(target));
|
|
361
|
+
const sessionUnsubscribe = target.kind === 'sandbox-live'
|
|
362
|
+
? target.onCurrentUserChanged?.(() => {
|
|
363
|
+
backendUnsubscribe();
|
|
364
|
+
try {
|
|
365
|
+
backendUnsubscribe = subscribe(authFor(target));
|
|
366
|
+
}
|
|
367
|
+
catch {
|
|
368
|
+
// The public subset currently has no cancel callback overload. A
|
|
369
|
+
// denied identity therefore suspends delivery until this app's next
|
|
370
|
+
// Auth transition instead of leaking events under the old identity.
|
|
371
|
+
backendUnsubscribe = () => { };
|
|
372
|
+
}
|
|
373
|
+
})
|
|
374
|
+
: undefined;
|
|
375
|
+
const stop = () => {
|
|
376
|
+
if (stopped)
|
|
377
|
+
return;
|
|
378
|
+
stopped = true;
|
|
379
|
+
sessionUnsubscribe?.();
|
|
380
|
+
backendUnsubscribe();
|
|
381
|
+
};
|
|
382
|
+
const release = target.kind === 'sandbox-live' ? target.own?.(stop) : undefined;
|
|
383
|
+
return () => {
|
|
384
|
+
release?.();
|
|
385
|
+
stop();
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* `onValue(ref, cb)` — subscribe to value changes at the ref's path.
|
|
390
|
+
*
|
|
391
|
+
* Fires immediately on subscribe with the current value (or
|
|
392
|
+
* `null` + `exists: false` for an absent path), then on every
|
|
393
|
+
* subsequent write that touches the path or any descendant.
|
|
394
|
+
*
|
|
395
|
+
* Returns an unsubscribe function. The unsubscribe is idempotent;
|
|
396
|
+
* calling it twice is a no-op.
|
|
397
|
+
*
|
|
398
|
+
* `options.onlyOnce` (DB-B12): when `true`, the listener auto-unsubscribes
|
|
399
|
+
* after its first fire (mirrors `api/Reference_impl.ts:975-980`).
|
|
400
|
+
*
|
|
401
|
+
* Errors path: subscribing under rules that deny the read throws the
|
|
402
|
+
* plain-`Error` `PERMISSION_DENIED` shape synchronously (matching the
|
|
403
|
+
* production behavior where the subscribe path immediately errors).
|
|
404
|
+
*/
|
|
405
|
+
export function onValue(r, cb, options) {
|
|
406
|
+
// `onlyOnce` (DB-B12): wrap the callback so it unsubscribes itself
|
|
407
|
+
// after the first fire. The unsub is filled in once the real
|
|
408
|
+
// subscription is created below.
|
|
409
|
+
if (options?.onlyOnce) {
|
|
410
|
+
let unsub = null;
|
|
411
|
+
let fired = false;
|
|
412
|
+
const onceCb = (snap) => {
|
|
413
|
+
if (fired)
|
|
414
|
+
return;
|
|
415
|
+
fired = true;
|
|
416
|
+
// `unsub` may not be assigned yet if the initial fire is
|
|
417
|
+
// synchronous (the backend fires during subscribe, before
|
|
418
|
+
// `onValue` returns). The post-subscribe check below covers it.
|
|
419
|
+
if (unsub)
|
|
420
|
+
unsub();
|
|
421
|
+
cb(snap);
|
|
422
|
+
};
|
|
423
|
+
unsub = onValue(r, onceCb);
|
|
424
|
+
// Synchronous initial fire: `onceCb` ran before `unsub` was set, so
|
|
425
|
+
// remove the now-stale listener here.
|
|
426
|
+
if (fired)
|
|
427
|
+
unsub();
|
|
428
|
+
return fired ? () => { } : unsub;
|
|
429
|
+
}
|
|
430
|
+
// Query branch — fire only when the windowed result changes.
|
|
431
|
+
// Locked by oracle observation `rtdb-modular-onvalue-with-query.json`:
|
|
432
|
+
// a write OUTSIDE the window does NOT re-fire the listener; a write
|
|
433
|
+
// INSIDE or one that displaces a member DOES.
|
|
434
|
+
if (isQuery(r)) {
|
|
435
|
+
const q = r;
|
|
436
|
+
const target = targetOf(q.ref);
|
|
437
|
+
return subscribeWithLiveAuth(target, (auth) => target.backend.onValue(auth, q.ref._path, (raw) => {
|
|
438
|
+
const snap = buildSandboxSnapFromRaw(target, q.ref, raw.val);
|
|
439
|
+
try {
|
|
440
|
+
cb(snap);
|
|
441
|
+
}
|
|
442
|
+
catch {
|
|
443
|
+
// Listener throws are swallowed.
|
|
444
|
+
}
|
|
445
|
+
}, q._spec));
|
|
446
|
+
}
|
|
447
|
+
const ref0 = r;
|
|
448
|
+
const target = targetOf(ref0);
|
|
449
|
+
const wrapper = (raw) => {
|
|
450
|
+
const snap = buildSandboxSnapFromRaw(target, ref0, raw.val);
|
|
451
|
+
try {
|
|
452
|
+
cb(snap);
|
|
453
|
+
}
|
|
454
|
+
catch {
|
|
455
|
+
// Listener throws are swallowed — match `firebase/database`'s
|
|
456
|
+
// behavior where one observer's exception doesn't block others.
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
const unsub = subscribeWithLiveAuth(target, (auth) => target.backend.onValue(auth, ref0._path, wrapper));
|
|
460
|
+
const registration = { unsubscribe: unsub };
|
|
461
|
+
listenerRegistry.add(target, ref0._path, 'value', cb, registration);
|
|
462
|
+
return () => {
|
|
463
|
+
listenerRegistry.removeExact(target, ref0._path, 'value', cb, registration);
|
|
464
|
+
unsub();
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* `onChildAdded(ref, cb)` — subscribe to child-added events at the
|
|
469
|
+
* ref's path.
|
|
470
|
+
*
|
|
471
|
+
* Semantics (locked by oracle observations under
|
|
472
|
+
* `packages/conformance/observations/rtdb-modular/rtdb-modular-onchildadded-*.json`):
|
|
473
|
+
*
|
|
474
|
+
* - On subscribe, replays every existing direct child of `ref`'s path
|
|
475
|
+
* (one fire per existing key, in `orderByKey`-default order).
|
|
476
|
+
* - After subscribe, fires exactly once per new direct child write.
|
|
477
|
+
*
|
|
478
|
+
* Also accepts a {@link Query} (a `query(ref, ...)` with `orderBy*` /
|
|
479
|
+
* `limitTo*` constraints): child events are then computed against the
|
|
480
|
+
* ordered, windowed result — a child ENTERING the window fires
|
|
481
|
+
* `child_added`; on subscribe the current window is replayed in window
|
|
482
|
+
* order.
|
|
483
|
+
*
|
|
484
|
+
* Returns an unsubscribe; calling it twice is a no-op.
|
|
485
|
+
*/
|
|
486
|
+
export function onChildAdded(r, cb) {
|
|
487
|
+
return onChildEvent(r, 'child_added', cb);
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* `onChildChanged(ref, cb)` — subscribe to child-changed events.
|
|
491
|
+
*
|
|
492
|
+
* Semantics (oracle: `rtdb-modular-onchildchanged-fires-on-update`):
|
|
493
|
+
*
|
|
494
|
+
* - No initial replay.
|
|
495
|
+
* - Fires when an existing direct child's value transitions to a
|
|
496
|
+
* NEW non-null value. Snapshot carries the NEW value.
|
|
497
|
+
* - Does NOT fire for added or removed children.
|
|
498
|
+
*
|
|
499
|
+
* Also accepts a {@link Query}: fires when a child that is IN the query
|
|
500
|
+
* window changes value (an in-window update).
|
|
501
|
+
*/
|
|
502
|
+
export function onChildChanged(r, cb) {
|
|
503
|
+
return onChildEvent(r, 'child_changed', cb);
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* `onChildRemoved(ref, cb)` — subscribe to child-removed events.
|
|
507
|
+
*
|
|
508
|
+
* Semantics (oracle: `rtdb-modular-onchildremoved-fires-on-delete`):
|
|
509
|
+
*
|
|
510
|
+
* - No initial replay.
|
|
511
|
+
* - Fires when a direct child is deleted (via `remove(child)` or
|
|
512
|
+
* `set(child, null)`).
|
|
513
|
+
* - Snapshot carries the PRIOR (now-removed) value — the listener
|
|
514
|
+
* sees what was there before deletion.
|
|
515
|
+
*
|
|
516
|
+
* Also accepts a {@link Query}: a child LEAVING the query window (e.g.
|
|
517
|
+
* displaced past a `limitTo*` boundary or filtered out) fires
|
|
518
|
+
* `child_removed` carrying its prior value.
|
|
519
|
+
*/
|
|
520
|
+
export function onChildRemoved(r, cb) {
|
|
521
|
+
return onChildEvent(r, 'child_removed', cb);
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* `onChildMoved(ref, cb)` — subscribe to child-moved events.
|
|
525
|
+
*
|
|
526
|
+
* Semantics (oracle: `rtdb-modular-onchildmoved-with-orderby`):
|
|
527
|
+
*
|
|
528
|
+
* - Only fires under an ordered query (`query(ref, orderByChild(...))`).
|
|
529
|
+
* - Under a plain ref, this listener is effectively a no-op — the
|
|
530
|
+
* upstream SDK accepts the subscription but never fires it
|
|
531
|
+
* (matches RTDB docs).
|
|
532
|
+
*
|
|
533
|
+
* Accepts a {@link Query} WITHOUT throwing, but the sandbox deliberately
|
|
534
|
+
* does NOT fire `child_moved` on reorder yet: prod fires here (matrix row
|
|
535
|
+
* `rtdb-modular#137`) while the sandbox holds — the reorder /
|
|
536
|
+
* `previousChildName` ordering semantics are pending two new oracle
|
|
537
|
+
* captures. This is a documented, pinned divergence (both sides asserted
|
|
538
|
+
* in `test/database/modular/sandbox-child-events.test.ts`).
|
|
539
|
+
*/
|
|
540
|
+
export function onChildMoved(r, cb) {
|
|
541
|
+
return onChildEvent(r, 'child_moved', cb);
|
|
542
|
+
}
|
|
543
|
+
const listenerRegistry = new ListenerRegistry();
|
|
544
|
+
function cancelSubscriptions(target, path, event) {
|
|
545
|
+
for (const registration of listenerRegistry.takeMatching(target, path, event)) {
|
|
546
|
+
registration.unsubscribe();
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Internal shared implementation for the four `onChild*` variants.
|
|
551
|
+
*
|
|
552
|
+
* Accepts a plain {@link DatabaseReference} OR a {@link Query}
|
|
553
|
+
* (a `query(ref, ...)` with `orderBy*` / `limitTo*`). For a query, the
|
|
554
|
+
* child-event diff is computed against the ordered, windowed result rather
|
|
555
|
+
* than the raw child
|
|
556
|
+
* key-set — a child entering/leaving the window fires `child_added` /
|
|
557
|
+
* `child_removed`, an in-window value change fires `child_changed`. (Note
|
|
558
|
+
* `child_moved` on a query registers but does not fire on reorder — the
|
|
559
|
+
* reorder semantics are held pending fresh oracle captures.)
|
|
560
|
+
*/
|
|
561
|
+
function onChildEvent(r, event, cb) {
|
|
562
|
+
// Unwrap a Query into its base ref + spec; a plain ref has no spec.
|
|
563
|
+
const isQ = isQuery(r);
|
|
564
|
+
const baseRef = isQ ? r.ref : r;
|
|
565
|
+
const spec = isQ ? r._spec : undefined;
|
|
566
|
+
const target = targetOf(baseRef);
|
|
567
|
+
const wrapper = (raw) => {
|
|
568
|
+
// Synthesize a snapshot rooted at the child path so `snap.key`
|
|
569
|
+
// and `snap.val()` match the upstream `onChildAdded` snapshot
|
|
570
|
+
// shape (key = the child's key, val = the child's value).
|
|
571
|
+
const childRef = child(baseRef, raw.key);
|
|
572
|
+
const snap = buildSandboxSnapFromRaw(target, childRef, raw.val);
|
|
573
|
+
try {
|
|
574
|
+
cb(snap);
|
|
575
|
+
}
|
|
576
|
+
catch {
|
|
577
|
+
// Listener throws are swallowed — match `firebase/database`'s
|
|
578
|
+
// behavior where one observer's exception doesn't block others.
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
const unsub = subscribeWithLiveAuth(target, (auth) => target.backend.onChild(auth, event, baseRef._path, wrapper, spec));
|
|
582
|
+
const registration = { unsubscribe: unsub };
|
|
583
|
+
listenerRegistry.add(target, baseRef._path, event, cb, registration);
|
|
584
|
+
return () => {
|
|
585
|
+
listenerRegistry.removeExact(target, baseRef._path, event, cb, registration);
|
|
586
|
+
unsub();
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* `off(ref, eventType?, callback?)` — unsubscribe variant.
|
|
591
|
+
*
|
|
592
|
+
* Semantics (locked by oracle observation
|
|
593
|
+
* `packages/conformance/observations/rtdb-modular/rtdb-modular-off-stops-child-fires.json`):
|
|
594
|
+
*
|
|
595
|
+
* - `off(ref)` (no eventType) removes ALL listeners at that ref —
|
|
596
|
+
* value + every child event variety.
|
|
597
|
+
* - `off(ref, 'value')` removes only `value` listeners.
|
|
598
|
+
* - `off(ref, 'child_added')` (or any child event type) removes only
|
|
599
|
+
* that variety.
|
|
600
|
+
* - `off(ref, eventType, cb)` removes only the matching callback.
|
|
601
|
+
*
|
|
602
|
+
* The returned-unsubscribe pattern from `onValue` / `onChild*` is
|
|
603
|
+
* functionally equivalent to `off(ref, eventType, cb)` for a specific
|
|
604
|
+
* registration — both are supported.
|
|
605
|
+
*/
|
|
606
|
+
export function off(r, eventType, callback) {
|
|
607
|
+
const target = targetOf(r);
|
|
608
|
+
if (callback !== undefined && eventType !== undefined) {
|
|
609
|
+
listenerRegistry.takeFirst(target, r._path, eventType, callback)?.unsubscribe();
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
cancelSubscriptions(target, r._path, eventType);
|
|
613
|
+
}
|
|
614
|
+
// ─── Queries (Tier 3) ────────────────────────────────────────────────
|
|
615
|
+
/**
|
|
616
|
+
* `query(ref, ...constraints)` — wrap a ref in an immutable
|
|
617
|
+
* constraint chain. The resulting {@link Query} routes through
|
|
618
|
+
* {@link get}/{@link onValue} and applies the ordering + filtering +
|
|
619
|
+
* limit pipeline on the sandbox backend.
|
|
620
|
+
*
|
|
621
|
+
* Chaining is supported — `query(query(ref, orderByChild('x')),
|
|
622
|
+
* limitToFirst(2))` folds both constraints into one spec.
|
|
623
|
+
*
|
|
624
|
+
* Locked semantics (oracle):
|
|
625
|
+
* - `orderByChild('p') + startAt(v) + endAt(w)` is BOTH-inclusive
|
|
626
|
+
* (`rtdb-modular-orderbychild-window.json`).
|
|
627
|
+
* - `orderByKey() + startAt('b') + endAt('d')` matches `[b, c, d]`
|
|
628
|
+
* (`rtdb-modular-orderbykey-window.json`).
|
|
629
|
+
* - `orderByValue() + limitToFirst(3)` returns the 3 smallest by
|
|
630
|
+
* value (`rtdb-modular-orderbyvalue-numeric.json` — note: prod
|
|
631
|
+
* requires `.indexOn: ".value"`; sandbox does not enforce indexes).
|
|
632
|
+
* - `orderByChild('group') + equalTo('b')` returns ALL matching
|
|
633
|
+
* children (`rtdb-modular-equalTo-filter.json`).
|
|
634
|
+
* - `limitToFirst(N)` / `limitToLast(N)` take from the start / end of
|
|
635
|
+
* the ordered window (`rtdb-modular-limittofirst-vs-limittolast.json`).
|
|
636
|
+
* - `startAfter` / `endBefore` are EXCLUSIVE
|
|
637
|
+
* (`rtdb-modular-startafter-endbefore-exclusive.json`).
|
|
638
|
+
*/
|
|
639
|
+
export function query(refOrQuery, ...constraints) {
|
|
640
|
+
// Resolve base — could be a ref or a prior query (chaining).
|
|
641
|
+
let baseRef;
|
|
642
|
+
let baseSpec;
|
|
643
|
+
if (isQuery(refOrQuery)) {
|
|
644
|
+
const prior = refOrQuery;
|
|
645
|
+
baseRef = prior.ref;
|
|
646
|
+
baseSpec = prior._spec;
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
baseRef = refOrQuery;
|
|
650
|
+
baseSpec = emptySpec();
|
|
651
|
+
}
|
|
652
|
+
let spec = baseSpec;
|
|
653
|
+
for (const c of constraints) {
|
|
654
|
+
spec = applyConstraint(spec, c[CONSTRAINT_SYMBOL]);
|
|
655
|
+
}
|
|
656
|
+
const q = {
|
|
657
|
+
ref: baseRef,
|
|
658
|
+
_spec: spec,
|
|
659
|
+
[QUERY_SYMBOL]: true,
|
|
660
|
+
toString() {
|
|
661
|
+
return baseRef.toString();
|
|
662
|
+
},
|
|
663
|
+
};
|
|
664
|
+
return q;
|
|
665
|
+
}
|
|
666
|
+
/** `orderByChild('path')` — order children by the value at the nested
|
|
667
|
+
* child path. Locked by oracle observation
|
|
668
|
+
* `rtdb-modular-orderbychild-window.json`. */
|
|
669
|
+
export function orderByChild(path) {
|
|
670
|
+
return buildConstraint('orderByChild', {
|
|
671
|
+
kind: 'orderBy',
|
|
672
|
+
spec: { kind: 'child', path },
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
/** `orderByKey()` — order children lexicographically by key string.
|
|
676
|
+
* Locked by oracle observation `rtdb-modular-orderbykey-window.json`. */
|
|
677
|
+
export function orderByKey() {
|
|
678
|
+
return buildConstraint('orderByKey', {
|
|
679
|
+
kind: 'orderBy',
|
|
680
|
+
spec: { kind: 'key' },
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
/** `orderByValue()` — order children by primitive value. Prod requires
|
|
684
|
+
* `.indexOn: ".value"` (oracle: `rtdb-modular-orderbyvalue-numeric.json`
|
|
685
|
+
* threw `Index not defined` against blockingfun); sandbox does NOT
|
|
686
|
+
* enforce indexes (the rules engine here checks read-allow only, not
|
|
687
|
+
* query-index conformance). */
|
|
688
|
+
export function orderByValue() {
|
|
689
|
+
return buildConstraint('orderByValue', {
|
|
690
|
+
kind: 'orderBy',
|
|
691
|
+
spec: { kind: 'value' },
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
/** `startAt(value, key?)` — INCLUSIVE lower bound under the active
|
|
695
|
+
* ordering. Optional `key` is the tie-breaker when ordering by
|
|
696
|
+
* child/value and multiple children share the bound's value. */
|
|
697
|
+
export function startAt(value, key) {
|
|
698
|
+
return buildConstraint('startAt', {
|
|
699
|
+
kind: 'bound',
|
|
700
|
+
bound: { kind: 'startAt', value, key },
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
/** `startAfter(value, key?)` — EXCLUSIVE lower bound. Locked by
|
|
704
|
+
* `rtdb-modular-startafter-endbefore-exclusive.json`. */
|
|
705
|
+
export function startAfter(value, key) {
|
|
706
|
+
return buildConstraint('startAfter', {
|
|
707
|
+
kind: 'bound',
|
|
708
|
+
bound: { kind: 'startAfter', value, key },
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
/** `endAt(value, key?)` — INCLUSIVE upper bound. Adjacent to startAt;
|
|
712
|
+
* same key tie-breaker semantics. */
|
|
713
|
+
export function endAt(value, key) {
|
|
714
|
+
return buildConstraint('endAt', {
|
|
715
|
+
kind: 'bound',
|
|
716
|
+
bound: { kind: 'endAt', value, key },
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
/** `endBefore(value, key?)` — EXCLUSIVE upper bound. Locked by
|
|
720
|
+
* `rtdb-modular-startafter-endbefore-exclusive.json`. */
|
|
721
|
+
export function endBefore(value, key) {
|
|
722
|
+
return buildConstraint('endBefore', {
|
|
723
|
+
kind: 'bound',
|
|
724
|
+
bound: { kind: 'endBefore', value, key },
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
/** `equalTo(value, key?)` — sugar for `startAt(value, key) +
|
|
728
|
+
* endAt(value, key)`. Returns ALL matching children (no uniqueness).
|
|
729
|
+
* Locked by oracle observation `rtdb-modular-equalTo-filter.json`. */
|
|
730
|
+
export function equalTo(value, key) {
|
|
731
|
+
return buildConstraint('equalTo', {
|
|
732
|
+
kind: 'bound',
|
|
733
|
+
bound: { kind: 'equalTo', value, key },
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
/** `limitToFirst(n)` — keep the first N children of the ordered window.
|
|
737
|
+
* Locked by oracle observation `rtdb-modular-limittofirst-vs-limittolast.json`. */
|
|
738
|
+
export function limitToFirst(n) {
|
|
739
|
+
return buildConstraint('limitToFirst', {
|
|
740
|
+
kind: 'limit',
|
|
741
|
+
limitKind: 'limitToFirst',
|
|
742
|
+
n,
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
/** `limitToLast(n)` — keep the last N children of the ordered window.
|
|
746
|
+
* Locked by oracle observation `rtdb-modular-limittofirst-vs-limittolast.json`. */
|
|
747
|
+
export function limitToLast(n) {
|
|
748
|
+
return buildConstraint('limitToLast', {
|
|
749
|
+
kind: 'limit',
|
|
750
|
+
limitKind: 'limitToLast',
|
|
751
|
+
n,
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* `runTransaction(ref, transactionUpdate, options?)` — atomic
|
|
756
|
+
* read-modify-write.
|
|
757
|
+
*
|
|
758
|
+
* Contract (oracle-locked):
|
|
759
|
+
*
|
|
760
|
+
* 1. `transactionUpdate` is called with the CURRENT value at `ref`'s
|
|
761
|
+
* path. For an absent path the arg is `null` (NOT `undefined`);
|
|
762
|
+
* oracle:
|
|
763
|
+
* `rtdb-modular-runtransaction-current-value-arg.json` →
|
|
764
|
+
* `missingFirstWasNull: true`.
|
|
765
|
+
* 2. Returning `undefined` from the update fn ABORTS the transaction:
|
|
766
|
+
* resolves `{ committed: false, snapshot }` where the snapshot is
|
|
767
|
+
* the pre-transaction value; oracle:
|
|
768
|
+
* `rtdb-modular-runtransaction-abort-undefined.json` → `committed:
|
|
769
|
+
* false, snapVal: null`.
|
|
770
|
+
* 3. Returning any defined value WRITES that value (rules-checked);
|
|
771
|
+
* resolves `{ committed: true, snapshot }` where `snapshot.val()`
|
|
772
|
+
* is the committed value; oracle:
|
|
773
|
+
* `rtdb-modular-runtransaction-success.json` → `committedNewValue:
|
|
774
|
+
* true` and
|
|
775
|
+
* `rtdb-modular-runtransaction-returns-committed-snapshot.json`.
|
|
776
|
+
* 4. If rules deny the write, the promise REJECTS with a plain
|
|
777
|
+
* `Error` whose `message === 'permission_denied'` and NO `.code`
|
|
778
|
+
* field (distinct from `set`/`get`'s `'PERMISSION_DENIED:
|
|
779
|
+
* Permission denied'`); oracle:
|
|
780
|
+
* `rtdb-modular-runtransaction-on-rules-denied-path.json`.
|
|
781
|
+
*
|
|
782
|
+
* `options.applyLocally` (default `true`): when `false`, the
|
|
783
|
+
* intermediate optimistic value is NOT fanned out to listeners — they
|
|
784
|
+
* see only the committed value. In a single-client harness this is
|
|
785
|
+
* usually invisible; we honor the flag for prod-parity. Oracle
|
|
786
|
+
* observation `rtdb-modular-runtransaction-options-applylocally.json`
|
|
787
|
+
* confirms both branches commit and end at the same value; the
|
|
788
|
+
* intermediate-fire difference isn't observable from a single client.
|
|
789
|
+
*
|
|
790
|
+
* Single-client sandbox doesn't model concurrency conflicts; the
|
|
791
|
+
* documented "retry on conflict" path is degenerate (no other writer
|
|
792
|
+
* exists to conflict with). The fn is invoked once.
|
|
793
|
+
*/
|
|
794
|
+
export async function runTransaction(r, transactionUpdate, options) {
|
|
795
|
+
const target = targetOf(r);
|
|
796
|
+
const result = target.backend.runTransaction(authFor(target), r._path, transactionUpdate, options);
|
|
797
|
+
const snap = buildSandboxSnapFromRaw(target, r, result.val);
|
|
798
|
+
return { committed: result.committed, snapshot: snap };
|
|
799
|
+
}
|
|
800
|
+
// ─── Sentinels ───────────────────────────────────────────────────────
|
|
801
|
+
/**
|
|
802
|
+
* `serverTimestamp()` — returns the `{ ".sv": "timestamp" }` sentinel
|
|
803
|
+
* the wire encoder recognises. Resolves to `Date.now()` (epoch ms) on
|
|
804
|
+
* write — locked by the prod SDK's resolved-as-number contract
|
|
805
|
+
* (oracle: `rtdb-servertimestamp-resolves.json`).
|
|
806
|
+
*
|
|
807
|
+
* The sandbox backend recognises the marker.
|
|
808
|
+
*/
|
|
809
|
+
export function serverTimestamp() {
|
|
810
|
+
return serverTimestampSentinel();
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* `increment(delta)` — returns the `{ ".sv": { increment: delta } }`
|
|
814
|
+
* sentinel that atomically adds `delta` to the current value at the
|
|
815
|
+
* write's field. Starts from `0` when the field is absent or
|
|
816
|
+
* non-numeric (oracle: `rtdb-modular-increment-from-missing.json`).
|
|
817
|
+
*
|
|
818
|
+
* The sandbox backend resolves it against the field's prior value at write
|
|
819
|
+
* time. Mirrors `firebase/database`'s `increment` (`api/ServerValue.ts:38-44`).
|
|
820
|
+
*/
|
|
821
|
+
export function increment(delta) {
|
|
822
|
+
return incrementSentinel(delta);
|
|
823
|
+
}
|
|
824
|
+
// ─── Emulator (no-op on sandbox) ─────────────────────────────────────
|
|
825
|
+
/**
|
|
826
|
+
* `connectDatabaseEmulator(db, host, port)` is an accepted no-op because the
|
|
827
|
+
* selected backend already is the local sandbox.
|
|
828
|
+
*/
|
|
829
|
+
export function connectDatabaseEmulator(_db, _host, _port, _options) {
|
|
830
|
+
// Accepted no-op.
|
|
831
|
+
}
|
|
832
|
+
// ─── Low-hanging-fruit exports (issue #149) ─────────────────────────
|
|
833
|
+
//
|
|
834
|
+
// Honest aliases / honest no-ops for `firebase/database` free functions
|
|
835
|
+
// that a real app imports at module load.
|
|
836
|
+
/**
|
|
837
|
+
* `goOffline(db)` — disconnect the client from the RTDB backend.
|
|
838
|
+
*
|
|
839
|
+
* No-op on sandbox handles: there is NO network connection in the local
|
|
840
|
+
* sandbox to toggle, so honest behavior is to accept the call and do
|
|
841
|
+
* nothing (we deliberately do NOT simulate a disconnect — pending
|
|
842
|
+
* writes, listeners, and `get()` all keep working exactly as before).
|
|
843
|
+
*/
|
|
844
|
+
export function goOffline(_db) {
|
|
845
|
+
// Accepted no-op.
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* `goOnline(db)` — reconnect the client to the RTDB backend.
|
|
849
|
+
*
|
|
850
|
+
* No-op on sandbox handles (there is no connection to reopen — see
|
|
851
|
+
* {@link goOffline}).
|
|
852
|
+
*/
|
|
853
|
+
export function goOnline(_db) {
|
|
854
|
+
// Accepted no-op.
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* `forceLongPolling()` — force the long-polling transport for all
|
|
858
|
+
* subsequent `getDatabase` connections.
|
|
859
|
+
*
|
|
860
|
+
* No-op: transport selection is meaningless to the in-process/worker
|
|
861
|
+
* sandbox, which never opens a real socket. Accepted so init code that
|
|
862
|
+
* calls it unconditionally compiles + runs.
|
|
863
|
+
*/
|
|
864
|
+
export function forceLongPolling() {
|
|
865
|
+
// Accepted no-op — see docstring.
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* `forceWebSockets()` — force the WebSocket transport for all
|
|
869
|
+
* subsequent `getDatabase` connections.
|
|
870
|
+
*
|
|
871
|
+
* No-op: transport selection is not applicable to the in-process/worker
|
|
872
|
+
* sandbox (see {@link forceLongPolling}).
|
|
873
|
+
*/
|
|
874
|
+
export function forceWebSockets() {
|
|
875
|
+
// Accepted no-op — see docstring.
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* `enableLogging(logger?, persistent?)` — toggle RTDB SDK logging.
|
|
879
|
+
*
|
|
880
|
+
* Accepted no-op: the sandbox has no modular-SDK-style logger to wire a
|
|
881
|
+
* level/sink into (it uses host-level `console` logging directly, gated
|
|
882
|
+
* by `pyric dev`'s own flags — matching `pyric/firestore`'s
|
|
883
|
+
* `setLogLevel`). Accepted so init code that calls it compiles + runs.
|
|
884
|
+
*/
|
|
885
|
+
export function enableLogging(logger, persistent) {
|
|
886
|
+
void logger;
|
|
887
|
+
void persistent;
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* `refFromURL(db, url)` — build a {@link DatabaseReference} from an
|
|
891
|
+
* absolute database URL (`https://<namespace>.firebaseio.com/path`).
|
|
892
|
+
*
|
|
893
|
+
* Real alias with real behavior: parses the path out of the URL and
|
|
894
|
+
* delegates to {@link ref}, so the returned ref resolves + reads exactly
|
|
895
|
+
* like `ref(db, path)`. The sandbox is single-database and has no host /
|
|
896
|
+
* namespace, so the URL's HOST is not validated against the handle (the
|
|
897
|
+
* real SDK throws if the host doesn't match the db's namespace); only
|
|
898
|
+
* the path component is honored.
|
|
899
|
+
*/
|
|
900
|
+
export function refFromURL(db, url) {
|
|
901
|
+
// Strip the scheme + host, keep the path. `new URL` handles the
|
|
902
|
+
// `https://<ns>.firebaseio.com/a/b` and `.firebasedatabase.app`
|
|
903
|
+
// hosts alike; the query string / hash (if any) is dropped —
|
|
904
|
+
// RTDB paths carry neither.
|
|
905
|
+
let path;
|
|
906
|
+
try {
|
|
907
|
+
path = new URL(url).pathname;
|
|
908
|
+
}
|
|
909
|
+
catch {
|
|
910
|
+
throw new Error(`pyric/database: refFromURL received a value that is not an absolute URL: ${url}`);
|
|
911
|
+
}
|
|
912
|
+
return ref(db, path);
|
|
913
|
+
}
|
|
914
|
+
// ─── Sandbox-only ops ───────────────────────────────────────────────
|
|
915
|
+
//
|
|
916
|
+
// Mirrors `pyric/firestore`'s `sandbox` namespace — explicit
|
|
917
|
+
// per-package sandbox lifecycle.
|
|
918
|
+
export const sandbox = {
|
|
919
|
+
/**
|
|
920
|
+
* Replace deployed rules. Pass `null` to clear (sandbox returns to
|
|
921
|
+
* default-allow). Rules are evaluated through the existing
|
|
922
|
+
* RTDB rules simulator — the same engine used by the rules tooling.
|
|
923
|
+
*
|
|
924
|
+
* @example
|
|
925
|
+
* ```ts
|
|
926
|
+
* sandbox.setRules(db, {
|
|
927
|
+
* rules: {
|
|
928
|
+
* '.read': 'auth != null',
|
|
929
|
+
* '.write': 'auth != null',
|
|
930
|
+
* },
|
|
931
|
+
* });
|
|
932
|
+
* ```
|
|
933
|
+
*/
|
|
934
|
+
setRules(db, rulesJson) {
|
|
935
|
+
const target = targetOf(db);
|
|
936
|
+
target.backend.setRules(rulesJson);
|
|
937
|
+
},
|
|
938
|
+
/**
|
|
939
|
+
* Bulk-load data bypassing rules. The supplied map's keys are
|
|
940
|
+
* absolute paths (`'/users/alice'`) and the values land at those
|
|
941
|
+
* paths. Convenient for test fixtures.
|
|
942
|
+
*/
|
|
943
|
+
setData(db, data) {
|
|
944
|
+
const target = targetOf(db);
|
|
945
|
+
target.backend.setData(data);
|
|
946
|
+
},
|
|
947
|
+
/** Snapshot the full sandbox tree (rule-bypass read). Usually a keyed
|
|
948
|
+
* object; may be a primitive when the root holds one (DB-B13). */
|
|
949
|
+
snapshotState(db) {
|
|
950
|
+
const target = targetOf(db);
|
|
951
|
+
return target.backend.snapshotState();
|
|
952
|
+
},
|
|
953
|
+
};
|
|
954
|
+
// ─── Snapshot wrappers ───────────────────────────────────────────────
|
|
955
|
+
function buildSandboxSnap(target, refForSnap, val) {
|
|
956
|
+
return buildSandboxSnapFromRaw(target, refForSnap, val);
|
|
957
|
+
}
|
|
958
|
+
function buildSandboxSnapFromRaw(_target, refForSnap, val) {
|
|
959
|
+
const exists = val !== null;
|
|
960
|
+
// `val` is the STORED (integer-keyed) shape. Structural ops
|
|
961
|
+
// (`child`/`forEach`/`hasChildren`/`numChildren`) walk it directly;
|
|
962
|
+
// `val()`/`toJSON()` render the DB-B2 array coercion lazily so a list
|
|
963
|
+
// written as an array reads back as an array.
|
|
964
|
+
const coerced = coerceArrays(val);
|
|
965
|
+
const childCount = (val !== null && typeof val === 'object' && !Array.isArray(val))
|
|
966
|
+
? Object.keys(val).length
|
|
967
|
+
: 0;
|
|
968
|
+
return {
|
|
969
|
+
key: refForSnap.key,
|
|
970
|
+
ref: refForSnap,
|
|
971
|
+
size: childCount,
|
|
972
|
+
priority: null,
|
|
973
|
+
exists() { return exists; },
|
|
974
|
+
val() { return coerced; },
|
|
975
|
+
child(p) {
|
|
976
|
+
const segs = pathSegments(p);
|
|
977
|
+
let cur = val;
|
|
978
|
+
for (const s of segs) {
|
|
979
|
+
if (cur === null || typeof cur !== 'object' || Array.isArray(cur)) {
|
|
980
|
+
cur = null;
|
|
981
|
+
break;
|
|
982
|
+
}
|
|
983
|
+
cur = cur[s] ?? null;
|
|
984
|
+
}
|
|
985
|
+
const childRef = child(refForSnap, p);
|
|
986
|
+
return buildSandboxSnapFromRaw(_target, childRef, cur);
|
|
987
|
+
},
|
|
988
|
+
hasChild(p) {
|
|
989
|
+
return this.child(p).exists();
|
|
990
|
+
},
|
|
991
|
+
hasChildren() {
|
|
992
|
+
return val !== null && typeof val === 'object' && !Array.isArray(val)
|
|
993
|
+
&& Object.keys(val).length > 0;
|
|
994
|
+
},
|
|
995
|
+
exportVal() { return coerced; },
|
|
996
|
+
toJSON() { return coerced; },
|
|
997
|
+
forEach(cb) {
|
|
998
|
+
if (val === null || typeof val !== 'object' || Array.isArray(val))
|
|
999
|
+
return false;
|
|
1000
|
+
for (const [k, v] of Object.entries(val)) {
|
|
1001
|
+
const childRef = child(refForSnap, k);
|
|
1002
|
+
const childSnap = buildSandboxSnapFromRaw(_target, childRef, v);
|
|
1003
|
+
if (cb(childSnap) === true)
|
|
1004
|
+
return true;
|
|
1005
|
+
}
|
|
1006
|
+
return false;
|
|
1007
|
+
},
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Build a snapshot from a query result. Differs from
|
|
1012
|
+
* {@link buildSandboxSnapFromRaw} in that the children iterate in the
|
|
1013
|
+
* order the executor produced them (not insertion order).
|
|
1014
|
+
*
|
|
1015
|
+
* `val()` returns a `Record<string, JsonValue>` containing only the
|
|
1016
|
+
* windowed children (or `null` if the window is empty), matching
|
|
1017
|
+
* `firebase/database`'s `DataSnapshot.val()` on a query snap.
|
|
1018
|
+
*
|
|
1019
|
+
* `numChildren()` is the window size; `forEach` walks the ordered rows.
|
|
1020
|
+
*/
|
|
1021
|
+
function buildSandboxQuerySnap(target, refForSnap, rows) {
|
|
1022
|
+
let val;
|
|
1023
|
+
if (rows.length === 0) {
|
|
1024
|
+
val = null;
|
|
1025
|
+
}
|
|
1026
|
+
else {
|
|
1027
|
+
const obj = {};
|
|
1028
|
+
for (const { key, value } of rows)
|
|
1029
|
+
obj[key] = value;
|
|
1030
|
+
val = obj;
|
|
1031
|
+
}
|
|
1032
|
+
const exists = rows.length > 0;
|
|
1033
|
+
const coerced = coerceArrays(val);
|
|
1034
|
+
return {
|
|
1035
|
+
key: refForSnap.key,
|
|
1036
|
+
ref: refForSnap,
|
|
1037
|
+
size: rows.length,
|
|
1038
|
+
priority: null,
|
|
1039
|
+
exists() { return exists; },
|
|
1040
|
+
val() { return coerced; },
|
|
1041
|
+
child(p) {
|
|
1042
|
+
const segs = pathSegments(p);
|
|
1043
|
+
let cur = val;
|
|
1044
|
+
for (const s of segs) {
|
|
1045
|
+
if (cur === null || typeof cur !== 'object' || Array.isArray(cur)) {
|
|
1046
|
+
cur = null;
|
|
1047
|
+
break;
|
|
1048
|
+
}
|
|
1049
|
+
cur = cur[s] ?? null;
|
|
1050
|
+
}
|
|
1051
|
+
const childRef = child(refForSnap, p);
|
|
1052
|
+
return buildSandboxSnapFromRaw(target, childRef, cur);
|
|
1053
|
+
},
|
|
1054
|
+
hasChild(p) {
|
|
1055
|
+
return this.child(p).exists();
|
|
1056
|
+
},
|
|
1057
|
+
hasChildren() { return rows.length > 0; },
|
|
1058
|
+
exportVal() { return coerced; },
|
|
1059
|
+
toJSON() { return coerced; },
|
|
1060
|
+
forEach(cb) {
|
|
1061
|
+
for (const { key, value } of rows) {
|
|
1062
|
+
const childRef = child(refForSnap, key);
|
|
1063
|
+
const childSnap = buildSandboxSnapFromRaw(target, childRef, value);
|
|
1064
|
+
if (cb(childSnap) === true)
|
|
1065
|
+
return true;
|
|
1066
|
+
}
|
|
1067
|
+
return false;
|
|
1068
|
+
},
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
//# sourceMappingURL=modular.js.map
|