pyric 0.1.0-alpha.21 → 0.1.0-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -4
- package/dist/ai/activity.d.ts +9 -0
- package/dist/ai/activity.d.ts.map +1 -0
- package/dist/ai/activity.js +45 -0
- package/dist/ai/activity.js.map +1 -0
- package/dist/ai/broker/broker.d.ts +25 -0
- package/dist/ai/broker/broker.d.ts.map +1 -1
- package/dist/ai/broker/broker.js +46 -42
- package/dist/ai/broker/broker.js.map +1 -1
- package/dist/ai/broker/gemini-engine.d.ts +7 -0
- package/dist/ai/broker/gemini-engine.d.ts.map +1 -1
- package/dist/ai/broker/gemini-engine.js +15 -0
- package/dist/ai/broker/gemini-engine.js.map +1 -1
- package/dist/ai/broker/index.d.ts +1 -1
- package/dist/ai/broker/index.d.ts.map +1 -1
- package/dist/ai/broker/index.js.map +1 -1
- package/dist/ai/broker/openai-engine.d.ts.map +1 -1
- package/dist/ai/broker/openai-engine.js +7 -3
- package/dist/ai/broker/openai-engine.js.map +1 -1
- package/dist/ai/broker/scripted-engine.d.ts +9 -1
- package/dist/ai/broker/scripted-engine.d.ts.map +1 -1
- package/dist/ai/broker/scripted-engine.js +14 -5
- package/dist/ai/broker/scripted-engine.js.map +1 -1
- package/dist/ai/broker/types.d.ts +6 -2
- package/dist/ai/broker/types.d.ts.map +1 -1
- package/dist/ai/events.d.ts +12 -0
- package/dist/ai/events.d.ts.map +1 -0
- package/dist/ai/events.js +17 -0
- package/dist/ai/events.js.map +1 -0
- package/dist/ai/generation-enums.d.ts +43 -0
- package/dist/ai/generation-enums.d.ts.map +1 -0
- package/dist/ai/generation-enums.js +37 -0
- package/dist/ai/generation-enums.js.map +1 -0
- package/dist/ai/index.d.ts +1 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +1 -0
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/instances.d.ts +6 -0
- package/dist/ai/instances.d.ts.map +1 -1
- package/dist/ai/instances.js +20 -2
- package/dist/ai/instances.js.map +1 -1
- package/dist/ai/internal.d.ts +3 -0
- package/dist/ai/internal.d.ts.map +1 -1
- package/dist/ai/internal.js +3 -0
- package/dist/ai/internal.js.map +1 -1
- package/dist/ai/sandbox-plane.d.ts.map +1 -1
- package/dist/ai/sandbox-plane.js +23 -8
- package/dist/ai/sandbox-plane.js.map +1 -1
- package/dist/ai/scripting.d.ts +20 -2
- package/dist/ai/scripting.d.ts.map +1 -1
- package/dist/ai/scripting.js +30 -3
- package/dist/ai/scripting.js.map +1 -1
- package/dist/app/internal.d.ts +1 -0
- package/dist/app/internal.d.ts.map +1 -1
- package/dist/app/internal.js +1 -0
- package/dist/app/internal.js.map +1 -1
- package/dist/auth/email-link.d.ts +8 -1
- package/dist/auth/email-link.d.ts.map +1 -1
- package/dist/auth/email-link.js +29 -20
- package/dist/auth/email-link.js.map +1 -1
- package/dist/auth/events.d.ts +12 -0
- package/dist/auth/events.d.ts.map +1 -0
- package/dist/auth/events.js +18 -0
- package/dist/auth/events.js.map +1 -0
- package/dist/auth/factor-id.d.ts +7 -0
- package/dist/auth/factor-id.d.ts.map +1 -0
- package/dist/auth/factor-id.js +6 -0
- package/dist/auth/factor-id.js.map +1 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +1 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/instances.d.ts.map +1 -1
- package/dist/auth/instances.js +13 -1
- package/dist/auth/instances.js.map +1 -1
- package/dist/auth/internal.d.ts +20 -0
- package/dist/auth/internal.d.ts.map +1 -0
- package/dist/auth/internal.js +19 -0
- package/dist/auth/internal.js.map +1 -0
- package/dist/auth/modular.d.ts +9 -0
- package/dist/auth/modular.d.ts.map +1 -1
- package/dist/auth/modular.js +20 -0
- package/dist/auth/modular.js.map +1 -1
- package/dist/auth/reauth.js +3 -2
- package/dist/auth/reauth.js.map +1 -1
- package/dist/auth/sandbox/default-avatar.d.ts +64 -0
- package/dist/auth/sandbox/default-avatar.d.ts.map +1 -0
- package/dist/auth/sandbox/default-avatar.js +118 -0
- package/dist/auth/sandbox/default-avatar.js.map +1 -0
- package/dist/auth/sandbox/driver.d.ts +36 -0
- package/dist/auth/sandbox/driver.d.ts.map +1 -1
- package/dist/auth/sandbox/driver.js +47 -0
- package/dist/auth/sandbox/driver.js.map +1 -1
- package/dist/auth/sandbox/project-store.d.ts +0 -1
- package/dist/auth/sandbox/project-store.d.ts.map +1 -1
- package/dist/auth/sandbox/project-store.js +0 -1
- package/dist/auth/sandbox/project-store.js.map +1 -1
- package/dist/auth/sandbox-backend-types.d.ts +34 -20
- package/dist/auth/sandbox-backend-types.d.ts.map +1 -1
- package/dist/auth/sandbox-backend-types.js +2 -3
- package/dist/auth/sandbox-backend-types.js.map +1 -1
- package/dist/auth/sandbox-backend.d.ts +98 -20
- package/dist/auth/sandbox-backend.d.ts.map +1 -1
- package/dist/auth/sandbox-backend.js +403 -96
- package/dist/auth/sandbox-backend.js.map +1 -1
- package/dist/auth/seed-user.d.ts +38 -0
- package/dist/auth/seed-user.d.ts.map +1 -0
- package/dist/auth/seed-user.js +2 -0
- package/dist/auth/seed-user.js.map +1 -0
- package/dist/auth/tokens.d.ts +6 -1
- package/dist/auth/tokens.d.ts.map +1 -1
- package/dist/auth/tokens.js +19 -17
- package/dist/auth/tokens.js.map +1 -1
- package/dist/auth/types.d.ts +13 -1
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js.map +1 -1
- package/dist/database/activity-coverage.d.ts +9 -0
- package/dist/database/activity-coverage.d.ts.map +1 -0
- package/dist/database/activity-coverage.js +11 -0
- package/dist/database/activity-coverage.js.map +1 -0
- package/dist/database/connection-lifecycle.d.ts +3 -0
- package/dist/database/connection-lifecycle.d.ts.map +1 -1
- package/dist/database/connection-lifecycle.js +54 -23
- package/dist/database/connection-lifecycle.js.map +1 -1
- package/dist/database/events.d.ts +12 -0
- package/dist/database/events.d.ts.map +1 -0
- package/dist/database/events.js +10 -0
- package/dist/database/events.js.map +1 -0
- package/dist/database/instances.d.ts +7 -7
- package/dist/database/instances.d.ts.map +1 -1
- package/dist/database/instances.js +35 -13
- package/dist/database/instances.js.map +1 -1
- package/dist/database/internal/query-projection.d.ts +102 -0
- package/dist/database/internal/query-projection.d.ts.map +1 -0
- package/dist/database/internal/query-projection.js +293 -0
- package/dist/database/internal/query-projection.js.map +1 -0
- package/dist/database/internal.d.ts +2 -0
- package/dist/database/internal.d.ts.map +1 -1
- package/dist/database/internal.js +2 -0
- package/dist/database/internal.js.map +1 -1
- package/dist/database/listeners.d.ts.map +1 -1
- package/dist/database/listeners.js +165 -37
- package/dist/database/listeners.js.map +1 -1
- package/dist/database/operations.d.ts.map +1 -1
- package/dist/database/operations.js +77 -50
- package/dist/database/operations.js.map +1 -1
- package/dist/database/replay.d.ts.map +1 -1
- package/dist/database/replay.js +6 -2
- package/dist/database/replay.js.map +1 -1
- package/dist/database/routing.d.ts +4 -0
- package/dist/database/routing.d.ts.map +1 -1
- package/dist/database/routing.js.map +1 -1
- package/dist/database/sandbox/backend-for.d.ts +4 -3
- package/dist/database/sandbox/backend-for.d.ts.map +1 -1
- package/dist/database/sandbox/backend-for.js +130 -24
- package/dist/database/sandbox/backend-for.js.map +1 -1
- package/dist/database/sandbox/backend-state.d.ts +7 -0
- package/dist/database/sandbox/backend-state.d.ts.map +1 -1
- package/dist/database/sandbox/backend-state.js +15 -1
- package/dist/database/sandbox/backend-state.js.map +1 -1
- package/dist/database/sandbox/backend.d.ts +2 -1
- package/dist/database/sandbox/backend.d.ts.map +1 -1
- package/dist/database/sandbox/backend.js +3 -3
- package/dist/database/sandbox/backend.js.map +1 -1
- package/dist/database/sandbox/child-listeners.d.ts +5 -0
- package/dist/database/sandbox/child-listeners.d.ts.map +1 -1
- package/dist/database/sandbox/child-listeners.js +34 -14
- package/dist/database/sandbox/child-listeners.js.map +1 -1
- package/dist/database/sandbox/listener-types.d.ts +5 -0
- package/dist/database/sandbox/listener-types.d.ts.map +1 -1
- package/dist/database/sandbox/operation-events.d.ts +5 -0
- package/dist/database/sandbox/operation-events.d.ts.map +1 -1
- package/dist/database/sandbox/operation-events.js +18 -3
- package/dist/database/sandbox/operation-events.js.map +1 -1
- package/dist/database/sandbox/persistence-state.d.ts.map +1 -1
- package/dist/database/sandbox/persistence-state.js +1 -8
- package/dist/database/sandbox/persistence-state.js.map +1 -1
- package/dist/database/sandbox/priority-writes.js +2 -2
- package/dist/database/sandbox/priority-writes.js.map +1 -1
- package/dist/database/sandbox/query.d.ts +2 -101
- package/dist/database/sandbox/query.d.ts.map +1 -1
- package/dist/database/sandbox/query.js +1 -225
- package/dist/database/sandbox/query.js.map +1 -1
- package/dist/database/sandbox/rules-eval.d.ts +28 -0
- package/dist/database/sandbox/rules-eval.d.ts.map +1 -1
- package/dist/database/sandbox/rules-eval.js +136 -9
- package/dist/database/sandbox/rules-eval.js.map +1 -1
- package/dist/database/sandbox/transactions.d.ts.map +1 -1
- package/dist/database/sandbox/transactions.js +17 -38
- package/dist/database/sandbox/transactions.js.map +1 -1
- package/dist/database/sandbox/value-listeners.d.ts +11 -1
- package/dist/database/sandbox/value-listeners.d.ts.map +1 -1
- package/dist/database/sandbox/value-listeners.js +65 -27
- package/dist/database/sandbox/value-listeners.js.map +1 -1
- package/dist/database/sandbox/write-plane.d.ts.map +1 -1
- package/dist/database/sandbox/write-plane.js +30 -22
- package/dist/database/sandbox/write-plane.js.map +1 -1
- package/dist/database/sdk-activity.d.ts +5 -0
- package/dist/database/sdk-activity.d.ts.map +1 -0
- package/dist/database/sdk-activity.js +20 -0
- package/dist/database/sdk-activity.js.map +1 -0
- package/dist/database/transactions.d.ts.map +1 -1
- package/dist/database/transactions.js +7 -3
- package/dist/database/transactions.js.map +1 -1
- package/dist/database/types.d.ts +9 -1
- package/dist/database/types.d.ts.map +1 -1
- package/dist/database/types.js.map +1 -1
- package/dist/deferred/entry.d.ts +6 -3
- package/dist/deferred/entry.d.ts.map +1 -1
- package/dist/deferred/entry.js +13 -10
- package/dist/deferred/entry.js.map +1 -1
- package/dist/firestore/activity-coverage.d.ts +9 -0
- package/dist/firestore/activity-coverage.d.ts.map +1 -0
- package/dist/firestore/activity-coverage.js +9 -0
- package/dist/firestore/activity-coverage.js.map +1 -0
- package/dist/firestore/aggregates.d.ts.map +1 -1
- package/dist/firestore/aggregates.js +32 -10
- package/dist/firestore/aggregates.js.map +1 -1
- package/dist/firestore/bytes.d.ts +13 -0
- package/dist/firestore/bytes.d.ts.map +1 -0
- package/dist/firestore/bytes.js +51 -0
- package/dist/firestore/bytes.js.map +1 -0
- package/dist/firestore/converter-method.d.ts +11 -0
- package/dist/firestore/converter-method.d.ts.map +1 -0
- package/dist/firestore/converter-method.js +39 -0
- package/dist/firestore/converter-method.js.map +1 -0
- package/dist/firestore/errors.d.ts.map +1 -1
- package/dist/firestore/errors.js +4 -0
- package/dist/firestore/errors.js.map +1 -1
- package/dist/firestore/field-values.d.ts +3 -36
- package/dist/firestore/field-values.d.ts.map +1 -1
- package/dist/firestore/field-values.js +3 -136
- package/dist/firestore/field-values.js.map +1 -1
- package/dist/firestore/geo-point.d.ts +15 -0
- package/dist/firestore/geo-point.d.ts.map +1 -0
- package/dist/firestore/geo-point.js +50 -0
- package/dist/firestore/geo-point.js.map +1 -0
- package/dist/firestore/index.d.ts +1 -1
- package/dist/firestore/index.d.ts.map +1 -1
- package/dist/firestore/index.js +1 -1
- package/dist/firestore/index.js.map +1 -1
- package/dist/firestore/instances.d.ts.map +1 -1
- package/dist/firestore/instances.js +23 -2
- package/dist/firestore/instances.js.map +1 -1
- package/dist/firestore/internal/document-data.d.ts +3 -0
- package/dist/firestore/internal/document-data.d.ts.map +1 -0
- package/dist/firestore/internal/document-data.js +10 -0
- package/dist/firestore/internal/document-data.js.map +1 -0
- package/dist/firestore/internal/index.d.ts +3 -0
- package/dist/firestore/internal/index.d.ts.map +1 -1
- package/dist/firestore/internal/index.js +5 -0
- package/dist/firestore/internal/index.js.map +1 -1
- package/dist/firestore/internal/value-codec.d.ts +16 -61
- package/dist/firestore/internal/value-codec.d.ts.map +1 -1
- package/dist/firestore/internal/value-codec.js +137 -82
- package/dist/firestore/internal/value-codec.js.map +1 -1
- package/dist/firestore/internal/value-depth.d.ts +3 -0
- package/dist/firestore/internal/value-depth.d.ts.map +1 -0
- package/dist/firestore/internal/value-depth.js +19 -0
- package/dist/firestore/internal/value-depth.js.map +1 -0
- package/dist/firestore/listeners.d.ts +18 -1
- package/dist/firestore/listeners.d.ts.map +1 -1
- package/dist/firestore/listeners.js +60 -21
- package/dist/firestore/listeners.js.map +1 -1
- package/dist/firestore/persistence.d.ts +0 -9
- package/dist/firestore/persistence.d.ts.map +1 -1
- package/dist/firestore/persistence.js +23 -9
- package/dist/firestore/persistence.js.map +1 -1
- package/dist/firestore/plain-object.d.ts +3 -0
- package/dist/firestore/plain-object.d.ts.map +1 -0
- package/dist/firestore/plain-object.js +9 -0
- package/dist/firestore/plain-object.js.map +1 -0
- package/dist/firestore/query-constraints.d.ts.map +1 -1
- package/dist/firestore/query-constraints.js +4 -3
- package/dist/firestore/query-constraints.js.map +1 -1
- package/dist/firestore/reads.d.ts +9 -7
- package/dist/firestore/reads.d.ts.map +1 -1
- package/dist/firestore/reads.js +74 -36
- package/dist/firestore/reads.js.map +1 -1
- package/dist/firestore/refs.d.ts +2 -1
- package/dist/firestore/refs.d.ts.map +1 -1
- package/dist/firestore/refs.js +37 -24
- package/dist/firestore/refs.js.map +1 -1
- package/dist/firestore/sandbox/activity-query-display.d.ts +67 -0
- package/dist/firestore/sandbox/activity-query-display.d.ts.map +1 -0
- package/dist/firestore/sandbox/activity-query-display.js +119 -0
- package/dist/firestore/sandbox/activity-query-display.js.map +1 -0
- package/dist/firestore/sandbox/admin-compat/batch.d.ts +4 -8
- package/dist/firestore/sandbox/admin-compat/batch.d.ts.map +1 -1
- package/dist/firestore/sandbox/admin-compat/batch.js +27 -19
- package/dist/firestore/sandbox/admin-compat/batch.js.map +1 -1
- package/dist/firestore/sandbox/admin-compat/query-comparison.d.ts.map +1 -1
- package/dist/firestore/sandbox/admin-compat/query-comparison.js +8 -3
- package/dist/firestore/sandbox/admin-compat/query-comparison.js.map +1 -1
- package/dist/firestore/sandbox/admin-compat/query.d.ts +8 -0
- package/dist/firestore/sandbox/admin-compat/query.d.ts.map +1 -1
- package/dist/firestore/sandbox/admin-compat/query.js +44 -5
- package/dist/firestore/sandbox/admin-compat/query.js.map +1 -1
- package/dist/firestore/sandbox/admin-compat/read-translation.d.ts.map +1 -1
- package/dist/firestore/sandbox/admin-compat/read-translation.js +18 -9
- package/dist/firestore/sandbox/admin-compat/read-translation.js.map +1 -1
- package/dist/firestore/sandbox/admin-compat/transaction.d.ts +2 -2
- package/dist/firestore/sandbox/admin-compat/transaction.d.ts.map +1 -1
- package/dist/firestore/sandbox/admin-compat/transaction.js +13 -4
- package/dist/firestore/sandbox/admin-compat/transaction.js.map +1 -1
- package/dist/firestore/sandbox/admin-compat/types.d.ts +6 -33
- package/dist/firestore/sandbox/admin-compat/types.d.ts.map +1 -1
- package/dist/firestore/sandbox/admin-compat/types.js +1 -76
- package/dist/firestore/sandbox/admin-compat/types.js.map +1 -1
- package/dist/firestore/sandbox/atomic-state.d.ts +4 -0
- package/dist/firestore/sandbox/atomic-state.d.ts.map +1 -0
- package/dist/firestore/sandbox/atomic-state.js +105 -0
- package/dist/firestore/sandbox/atomic-state.js.map +1 -0
- package/dist/firestore/sandbox/atomic-write-pipeline.d.ts +3 -2
- package/dist/firestore/sandbox/atomic-write-pipeline.d.ts.map +1 -1
- package/dist/firestore/sandbox/atomic-write-pipeline.js +128 -58
- package/dist/firestore/sandbox/atomic-write-pipeline.js.map +1 -1
- package/dist/firestore/sandbox/batch-write-executor.d.ts.map +1 -1
- package/dist/firestore/sandbox/batch-write-executor.js +54 -28
- package/dist/firestore/sandbox/batch-write-executor.js.map +1 -1
- package/dist/firestore/sandbox/converters/user-timestamp.d.ts +6 -40
- package/dist/firestore/sandbox/converters/user-timestamp.d.ts.map +1 -1
- package/dist/firestore/sandbox/converters/user-timestamp.js +20 -43
- package/dist/firestore/sandbox/converters/user-timestamp.js.map +1 -1
- package/dist/firestore/sandbox/document-copy.d.ts +4 -0
- package/dist/firestore/sandbox/document-copy.d.ts.map +1 -0
- package/dist/firestore/sandbox/document-copy.js +28 -0
- package/dist/firestore/sandbox/document-copy.js.map +1 -0
- package/dist/firestore/sandbox/document-store.d.ts +99 -0
- package/dist/firestore/sandbox/document-store.d.ts.map +1 -0
- package/dist/firestore/sandbox/document-store.js +2 -0
- package/dist/firestore/sandbox/document-store.js.map +1 -0
- package/dist/firestore/sandbox/errors.d.ts +4 -1
- package/dist/firestore/sandbox/errors.d.ts.map +1 -1
- package/dist/firestore/sandbox/errors.js +2 -25
- package/dist/firestore/sandbox/errors.js.map +1 -1
- package/dist/firestore/sandbox/event-log.d.ts +22 -4
- package/dist/firestore/sandbox/event-log.d.ts.map +1 -1
- package/dist/firestore/sandbox/event-log.js +66 -6
- package/dist/firestore/sandbox/event-log.js.map +1 -1
- package/dist/firestore/sandbox/field-merge.d.ts.map +1 -1
- package/dist/firestore/sandbox/field-merge.js +10 -20
- package/dist/firestore/sandbox/field-merge.js.map +1 -1
- package/dist/firestore/sandbox/history-controls.d.ts +1 -1
- package/dist/firestore/sandbox/history-controls.d.ts.map +1 -1
- package/dist/firestore/sandbox/history-controls.js +1 -1
- package/dist/firestore/sandbox/history-controls.js.map +1 -1
- package/dist/firestore/sandbox/list-query-proof.d.ts +4 -1
- package/dist/firestore/sandbox/list-query-proof.d.ts.map +1 -1
- package/dist/firestore/sandbox/list-query-proof.js +32 -96
- package/dist/firestore/sandbox/list-query-proof.js.map +1 -1
- package/dist/firestore/sandbox/listener-dispatch.d.ts +26 -1
- package/dist/firestore/sandbox/listener-dispatch.d.ts.map +1 -1
- package/dist/firestore/sandbox/listener-dispatch.js +58 -5
- package/dist/firestore/sandbox/listener-dispatch.js.map +1 -1
- package/dist/firestore/sandbox/local-environment.d.ts +16 -2
- package/dist/firestore/sandbox/local-environment.d.ts.map +1 -1
- package/dist/firestore/sandbox/local-environment.js +33 -9
- package/dist/firestore/sandbox/local-environment.js.map +1 -1
- package/dist/firestore/sandbox/local-state.d.ts +5 -99
- package/dist/firestore/sandbox/local-state.d.ts.map +1 -1
- package/dist/firestore/sandbox/local-state.js +64 -117
- package/dist/firestore/sandbox/local-state.js.map +1 -1
- package/dist/firestore/sandbox/query-execution.d.ts +4 -1
- package/dist/firestore/sandbox/query-execution.d.ts.map +1 -1
- package/dist/firestore/sandbox/query-execution.js +51 -26
- package/dist/firestore/sandbox/query-execution.js.map +1 -1
- package/dist/firestore/sandbox/query-operand-equality.d.ts.map +1 -1
- package/dist/firestore/sandbox/query-operand-equality.js +50 -14
- package/dist/firestore/sandbox/query-operand-equality.js.map +1 -1
- package/dist/firestore/sandbox/query-operators.d.ts +4 -0
- package/dist/firestore/sandbox/query-operators.d.ts.map +1 -0
- package/dist/firestore/sandbox/query-operators.js +17 -0
- package/dist/firestore/sandbox/query-operators.js.map +1 -0
- package/dist/firestore/sandbox/query-value-registry.d.ts +1 -1
- package/dist/firestore/sandbox/query-value-registry.d.ts.map +1 -1
- package/dist/firestore/sandbox/query-value-registry.js +3 -1
- package/dist/firestore/sandbox/query-value-registry.js.map +1 -1
- package/dist/firestore/sandbox/request-events.d.ts +3 -0
- package/dist/firestore/sandbox/request-events.d.ts.map +1 -1
- package/dist/firestore/sandbox/request-events.js +4 -0
- package/dist/firestore/sandbox/request-events.js.map +1 -1
- package/dist/firestore/sandbox/rules-evidence.d.ts +7 -0
- package/dist/firestore/sandbox/rules-evidence.d.ts.map +1 -0
- package/dist/firestore/sandbox/rules-evidence.js +87 -0
- package/dist/firestore/sandbox/rules-evidence.js.map +1 -0
- package/dist/firestore/sandbox/rules-list-authorizer.d.ts +13 -1
- package/dist/firestore/sandbox/rules-list-authorizer.d.ts.map +1 -1
- package/dist/firestore/sandbox/rules-list-authorizer.js +53 -74
- package/dist/firestore/sandbox/rules-list-authorizer.js.map +1 -1
- package/dist/firestore/sandbox/rules-operation-reader.d.ts +8 -1
- package/dist/firestore/sandbox/rules-operation-reader.d.ts.map +1 -1
- package/dist/firestore/sandbox/rules-operation-reader.js +13 -5
- package/dist/firestore/sandbox/rules-operation-reader.js.map +1 -1
- package/dist/firestore/sandbox/rules-read-engine.d.ts +8 -1
- package/dist/firestore/sandbox/rules-read-engine.d.ts.map +1 -1
- package/dist/firestore/sandbox/rules-read-engine.js +21 -10
- package/dist/firestore/sandbox/rules-read-engine.js.map +1 -1
- package/dist/firestore/sandbox/rules-state.d.ts +5 -0
- package/dist/firestore/sandbox/rules-state.d.ts.map +1 -1
- package/dist/firestore/sandbox/rules-state.js +16 -0
- package/dist/firestore/sandbox/rules-state.js.map +1 -1
- package/dist/firestore/sandbox/snapshot-listeners.d.ts +9 -1
- package/dist/firestore/sandbox/snapshot-listeners.d.ts.map +1 -1
- package/dist/firestore/sandbox/snapshot-listeners.js.map +1 -1
- package/dist/firestore/sandbox/transaction-merge.d.ts +2 -33
- package/dist/firestore/sandbox/transaction-merge.d.ts.map +1 -1
- package/dist/firestore/sandbox/transaction-merge.js +19 -7
- package/dist/firestore/sandbox/transaction-merge.js.map +1 -1
- package/dist/firestore/sandbox/transaction-types.d.ts +11 -21
- package/dist/firestore/sandbox/transaction-types.d.ts.map +1 -1
- package/dist/firestore/sandbox/transaction-types.js.map +1 -1
- package/dist/firestore/sandbox/transaction-write-executor.d.ts +2 -1
- package/dist/firestore/sandbox/transaction-write-executor.d.ts.map +1 -1
- package/dist/firestore/sandbox/transaction-write-executor.js +110 -69
- package/dist/firestore/sandbox/transaction-write-executor.js.map +1 -1
- package/dist/firestore/sandbox/transaction.d.ts +3 -2
- package/dist/firestore/sandbox/transaction.d.ts.map +1 -1
- package/dist/firestore/sandbox/transaction.js +23 -6
- package/dist/firestore/sandbox/transaction.js.map +1 -1
- package/dist/firestore/sandbox/value-resolver.d.ts +1 -8
- package/dist/firestore/sandbox/value-resolver.d.ts.map +1 -1
- package/dist/firestore/sandbox/value-resolver.js +2 -13
- package/dist/firestore/sandbox/value-resolver.js.map +1 -1
- package/dist/firestore/sandbox/write-engine.d.ts +5 -1
- package/dist/firestore/sandbox/write-engine.d.ts.map +1 -1
- package/dist/firestore/sandbox/write-engine.js +14 -7
- package/dist/firestore/sandbox/write-engine.js.map +1 -1
- package/dist/firestore/sandbox/write-runtime.d.ts +12 -4
- package/dist/firestore/sandbox/write-runtime.d.ts.map +1 -1
- package/dist/firestore/sandbox/write-runtime.js +72 -38
- package/dist/firestore/sandbox/write-runtime.js.map +1 -1
- package/dist/firestore/sandbox/writes.d.ts +3 -1
- package/dist/firestore/sandbox/writes.d.ts.map +1 -1
- package/dist/firestore/sdk-activity.d.ts +8 -0
- package/dist/firestore/sdk-activity.d.ts.map +1 -0
- package/dist/firestore/sdk-activity.js +23 -0
- package/dist/firestore/sdk-activity.js.map +1 -0
- package/dist/firestore/snapshots.d.ts +18 -2
- package/dist/firestore/snapshots.d.ts.map +1 -1
- package/dist/firestore/snapshots.js +69 -16
- package/dist/firestore/snapshots.js.map +1 -1
- package/dist/firestore/state.d.ts +8 -3
- package/dist/firestore/state.d.ts.map +1 -1
- package/dist/firestore/state.js +30 -13
- package/dist/firestore/state.js.map +1 -1
- package/dist/firestore/timestamp.d.ts +28 -0
- package/dist/firestore/timestamp.d.ts.map +1 -0
- package/dist/firestore/timestamp.js +80 -0
- package/dist/firestore/timestamp.js.map +1 -0
- package/dist/firestore/tools.d.ts.map +1 -1
- package/dist/firestore/tools.js +2 -4
- package/dist/firestore/tools.js.map +1 -1
- package/dist/firestore/transactions.d.ts.map +1 -1
- package/dist/firestore/transactions.js +76 -3
- package/dist/firestore/transactions.js.map +1 -1
- package/dist/firestore/types.d.ts +26 -5
- package/dist/firestore/types.d.ts.map +1 -1
- package/dist/firestore/types.js.map +1 -1
- package/dist/firestore/vector-value.d.ts +11 -0
- package/dist/firestore/vector-value.d.ts.map +1 -0
- package/dist/firestore/vector-value.js +51 -0
- package/dist/firestore/vector-value.js.map +1 -0
- package/dist/firestore/writes.d.ts +0 -7
- package/dist/firestore/writes.d.ts.map +1 -1
- package/dist/firestore/writes.js +42 -25
- package/dist/firestore/writes.js.map +1 -1
- package/dist/functions/events.d.ts +12 -0
- package/dist/functions/events.d.ts.map +1 -0
- package/dist/functions/events.js +10 -0
- package/dist/functions/events.js.map +1 -0
- package/dist/messaging/broker/broker.d.ts +43 -30
- package/dist/messaging/broker/broker.d.ts.map +1 -1
- package/dist/messaging/broker/broker.js +148 -43
- package/dist/messaging/broker/broker.js.map +1 -1
- package/dist/messaging/broker/delivery-history.d.ts +5 -0
- package/dist/messaging/broker/delivery-history.d.ts.map +1 -0
- package/dist/messaging/broker/delivery-history.js +46 -0
- package/dist/messaging/broker/delivery-history.js.map +1 -0
- package/dist/messaging/broker/index.d.ts +2 -1
- package/dist/messaging/broker/index.d.ts.map +1 -1
- package/dist/messaging/broker/index.js +7 -0
- package/dist/messaging/broker/index.js.map +1 -1
- package/dist/messaging/broker/persistence.d.ts +12 -0
- package/dist/messaging/broker/persistence.d.ts.map +1 -0
- package/dist/messaging/broker/persistence.js +42 -0
- package/dist/messaging/broker/persistence.js.map +1 -0
- package/dist/messaging/broker/types.d.ts +44 -0
- package/dist/messaging/broker/types.d.ts.map +1 -1
- package/dist/messaging/broker/types.js +10 -1
- package/dist/messaging/broker/types.js.map +1 -1
- package/dist/messaging/events.d.ts +12 -0
- package/dist/messaging/events.d.ts.map +1 -0
- package/dist/messaging/events.js +19 -0
- package/dist/messaging/events.js.map +1 -0
- package/dist/rules/api/case-types.d.ts +7 -0
- package/dist/rules/api/case-types.d.ts.map +1 -1
- package/dist/rules/api/rtdb.d.ts.map +1 -1
- package/dist/rules/api/rtdb.js +20 -7
- package/dist/rules/api/rtdb.js.map +1 -1
- package/dist/rules/grammar/parse-error-wording.d.ts +31 -0
- package/dist/rules/grammar/parse-error-wording.d.ts.map +1 -0
- package/dist/rules/grammar/parse-error-wording.js +86 -0
- package/dist/rules/grammar/parse-error-wording.js.map +1 -0
- package/dist/rules/indexes/query-analysis.d.ts +33 -0
- package/dist/rules/indexes/query-analysis.d.ts.map +1 -0
- package/dist/rules/indexes/query-analysis.js +153 -0
- package/dist/rules/indexes/query-analysis.js.map +1 -0
- package/dist/rules/indexes/service-query.d.ts +48 -0
- package/dist/rules/indexes/service-query.d.ts.map +1 -0
- package/dist/rules/indexes/service-query.js +60 -0
- package/dist/rules/indexes/service-query.js.map +1 -0
- package/dist/rules/internal/index.d.ts +4 -0
- package/dist/rules/internal/index.d.ts.map +1 -1
- package/dist/rules/internal/index.js +10 -0
- package/dist/rules/internal/index.js.map +1 -1
- package/dist/rules/modules/rules-capabilities.generated.d.ts +1 -1
- package/dist/rules/modules/rules-capabilities.generated.js +1 -1
- package/dist/rules/modules/rules-capabilities.generated.js.map +1 -1
- package/dist/rules/rtdb/constraints/atoms.d.ts.map +1 -1
- package/dist/rules/rtdb/constraints/atoms.js +7 -7
- package/dist/rules/rtdb/constraints/atoms.js.map +1 -1
- package/dist/rules/rtdb/constraints/data.d.ts +2 -2
- package/dist/rules/rtdb/constraints/data.d.ts.map +1 -1
- package/dist/rules/rtdb/constraints/data.js +4 -4
- package/dist/rules/rtdb/constraints/data.js.map +1 -1
- package/dist/rules/rtdb/constraints/document.d.ts.map +1 -1
- package/dist/rules/rtdb/constraints/document.js +6 -2
- package/dist/rules/rtdb/constraints/document.js.map +1 -1
- package/dist/rules/rtdb/constraints/policies.d.ts +2 -2
- package/dist/rules/rtdb/constraints/policies.d.ts.map +1 -1
- package/dist/rules/rtdb/constraints/policies.js +3 -3
- package/dist/rules/rtdb/constraints/policies.js.map +1 -1
- package/dist/rules/rtdb/constraints/schema.js +3 -3
- package/dist/rules/rtdb/constraints/schema.js.map +1 -1
- package/dist/rules/rtdb/grammar/RtdbExpr.ohm +1 -3
- package/dist/rules/rtdb/grammar/RtdbExpr.ohm.generated.d.ts +1 -1
- package/dist/rules/rtdb/grammar/RtdbExpr.ohm.generated.d.ts.map +1 -1
- package/dist/rules/rtdb/grammar/RtdbExpr.ohm.generated.js +1 -3
- package/dist/rules/rtdb/grammar/RtdbExpr.ohm.generated.js.map +1 -1
- package/dist/rules/rtdb/grammar/linter.d.ts.map +1 -1
- package/dist/rules/rtdb/grammar/linter.js +28 -30
- package/dist/rules/rtdb/grammar/linter.js.map +1 -1
- package/dist/rules/rtdb/grammar/simulator.d.ts +15 -1
- package/dist/rules/rtdb/grammar/simulator.d.ts.map +1 -1
- package/dist/rules/rtdb/grammar/simulator.js +93 -65
- package/dist/rules/rtdb/grammar/simulator.js.map +1 -1
- package/dist/rules/rtdb/grammar/validator.d.ts.map +1 -1
- package/dist/rules/rtdb/grammar/validator.js +25 -26
- package/dist/rules/rtdb/grammar/validator.js.map +1 -1
- package/dist/rules/rtdb/simulation/handler.d.ts.map +1 -1
- package/dist/rules/rtdb/simulation/handler.js +136 -32
- package/dist/rules/rtdb/simulation/handler.js.map +1 -1
- package/dist/rules/rtdb/simulation/spec.d.ts +95 -5
- package/dist/rules/rtdb/simulation/spec.d.ts.map +1 -1
- package/dist/rules/rtdb/simulation/spec.js +22 -1
- package/dist/rules/rtdb/simulation/spec.js.map +1 -1
- package/dist/rules/rtdb/types.d.ts +18 -18
- package/dist/rules/simulator/evaluator.js +35 -69
- package/dist/rules/simulator/evaluator.js.map +1 -1
- package/dist/rules/simulator/handler.d.ts.map +1 -1
- package/dist/rules/simulator/handler.js +12 -3
- package/dist/rules/simulator/handler.js.map +1 -1
- package/dist/rules/simulator/mapdiff.d.ts +2 -0
- package/dist/rules/simulator/mapdiff.d.ts.map +1 -1
- package/dist/rules/simulator/mapdiff.js +7 -5
- package/dist/rules/simulator/mapdiff.js.map +1 -1
- package/dist/rules/simulator/query-proof-residual.d.ts +11 -0
- package/dist/rules/simulator/query-proof-residual.d.ts.map +1 -0
- package/dist/rules/simulator/query-proof-residual.js +177 -0
- package/dist/rules/simulator/query-proof-residual.js.map +1 -0
- package/dist/rules/simulator/query-proof.d.ts +21 -47
- package/dist/rules/simulator/query-proof.d.ts.map +1 -1
- package/dist/rules/simulator/query-proof.js +78 -13
- package/dist/rules/simulator/query-proof.js.map +1 -1
- package/dist/rules/simulator/request-path.d.ts +26 -0
- package/dist/rules/simulator/request-path.d.ts.map +1 -0
- package/dist/rules/simulator/request-path.js +36 -0
- package/dist/rules/simulator/request-path.js.map +1 -0
- package/dist/rules/simulator/trace-recorder.d.ts +1 -0
- package/dist/rules/simulator/trace-recorder.d.ts.map +1 -1
- package/dist/rules/simulator/trace-recorder.js +4 -0
- package/dist/rules/simulator/trace-recorder.js.map +1 -1
- package/dist/rules/simulator/wrappers/timestamp.d.ts +6 -0
- package/dist/rules/simulator/wrappers/timestamp.d.ts.map +1 -1
- package/dist/rules/simulator/wrappers/timestamp.js +8 -1
- package/dist/rules/simulator/wrappers/timestamp.js.map +1 -1
- package/dist/rules/simulator-tools-impl.d.ts.map +1 -1
- package/dist/rules/simulator-tools-impl.js +6 -3
- package/dist/rules/simulator-tools-impl.js.map +1 -1
- package/dist/rules/stdlib-tools.js +4 -4
- package/dist/rules/stdlib-tools.js.map +1 -1
- package/dist/rules/test/spec.d.ts +4 -4
- package/dist/sandbox/active-listeners.d.ts +69 -0
- package/dist/sandbox/active-listeners.d.ts.map +1 -0
- package/dist/sandbox/active-listeners.js +159 -0
- package/dist/sandbox/active-listeners.js.map +1 -0
- package/dist/sandbox/admin-firestore/error-translation.d.ts.map +1 -1
- package/dist/sandbox/admin-firestore/error-translation.js +15 -2
- package/dist/sandbox/admin-firestore/error-translation.js.map +1 -1
- package/dist/sandbox/admin-firestore/listeners.d.ts +0 -25
- package/dist/sandbox/admin-firestore/listeners.d.ts.map +1 -1
- package/dist/sandbox/admin-firestore/listeners.js +26 -2
- package/dist/sandbox/admin-firestore/listeners.js.map +1 -1
- package/dist/sandbox/admin-firestore/remote/listeners.d.ts.map +1 -1
- package/dist/sandbox/admin-firestore/remote/listeners.js +50 -29
- package/dist/sandbox/admin-firestore/remote/listeners.js.map +1 -1
- package/dist/sandbox/admin-firestore/remote/value-codec.d.ts +5 -12
- package/dist/sandbox/admin-firestore/remote/value-codec.d.ts.map +1 -1
- package/dist/sandbox/admin-firestore/remote/value-codec.js +7 -14
- package/dist/sandbox/admin-firestore/remote/value-codec.js.map +1 -1
- package/dist/sandbox/admin-firestore/remote/wire-types.d.ts +2 -0
- package/dist/sandbox/admin-firestore/remote/wire-types.d.ts.map +1 -1
- package/dist/sandbox/attribution/attribution-mode.d.ts +36 -0
- package/dist/sandbox/attribution/attribution-mode.d.ts.map +1 -0
- package/dist/sandbox/attribution/attribution-mode.js +68 -0
- package/dist/sandbox/attribution/attribution-mode.js.map +1 -0
- package/dist/sandbox/attribution/effect-regions.d.ts +37 -0
- package/dist/sandbox/attribution/effect-regions.d.ts.map +1 -0
- package/dist/sandbox/attribution/effect-regions.js +114 -0
- package/dist/sandbox/attribution/effect-regions.js.map +1 -0
- package/dist/sandbox/attribution/element-selector.d.ts +42 -0
- package/dist/sandbox/attribution/element-selector.d.ts.map +1 -0
- package/dist/sandbox/attribution/element-selector.js +109 -0
- package/dist/sandbox/attribution/element-selector.js.map +1 -0
- package/dist/sandbox/attribution/listener-owners.d.ts +111 -0
- package/dist/sandbox/attribution/listener-owners.d.ts.map +1 -0
- package/dist/sandbox/attribution/listener-owners.js +215 -0
- package/dist/sandbox/attribution/listener-owners.js.map +1 -0
- package/dist/sandbox/branches/engine.d.ts +129 -0
- package/dist/sandbox/branches/engine.d.ts.map +1 -0
- package/dist/sandbox/branches/engine.js +280 -0
- package/dist/sandbox/branches/engine.js.map +1 -0
- package/dist/sandbox/branches/index.d.ts +12 -139
- package/dist/sandbox/branches/index.d.ts.map +1 -1
- package/dist/sandbox/branches/index.js +8 -390
- package/dist/sandbox/branches/index.js.map +1 -1
- package/dist/sandbox/branches/promotion.d.ts +27 -0
- package/dist/sandbox/branches/promotion.d.ts.map +1 -0
- package/dist/sandbox/branches/promotion.js +160 -0
- package/dist/sandbox/branches/promotion.js.map +1 -0
- package/dist/sandbox/branches/state-diff.d.ts +66 -0
- package/dist/sandbox/branches/state-diff.d.ts.map +1 -0
- package/dist/sandbox/branches/state-diff.js +270 -0
- package/dist/sandbox/branches/state-diff.js.map +1 -0
- package/dist/sandbox/branches/store.d.ts +64 -0
- package/dist/sandbox/branches/store.d.ts.map +1 -0
- package/dist/sandbox/branches/store.js +264 -0
- package/dist/sandbox/branches/store.js.map +1 -0
- package/dist/sandbox/checkpoints/capture.d.ts +39 -0
- package/dist/sandbox/checkpoints/capture.d.ts.map +1 -0
- package/dist/sandbox/checkpoints/capture.js +69 -0
- package/dist/sandbox/checkpoints/capture.js.map +1 -0
- package/dist/sandbox/checkpoints/directory-backend.d.ts +30 -0
- package/dist/sandbox/checkpoints/directory-backend.d.ts.map +1 -0
- package/dist/sandbox/checkpoints/directory-backend.js +98 -0
- package/dist/sandbox/checkpoints/directory-backend.js.map +1 -0
- package/dist/sandbox/checkpoints/index.d.ts +15 -0
- package/dist/sandbox/checkpoints/index.d.ts.map +1 -0
- package/dist/sandbox/checkpoints/index.js +13 -0
- package/dist/sandbox/checkpoints/index.js.map +1 -0
- package/dist/sandbox/checkpoints/record-backend.d.ts +25 -0
- package/dist/sandbox/checkpoints/record-backend.d.ts.map +1 -0
- package/dist/sandbox/checkpoints/record-backend.js +81 -0
- package/dist/sandbox/checkpoints/record-backend.js.map +1 -0
- package/dist/sandbox/checkpoints/saved-states.d.ts +35 -0
- package/dist/sandbox/checkpoints/saved-states.d.ts.map +1 -0
- package/dist/sandbox/checkpoints/saved-states.js +47 -0
- package/dist/sandbox/checkpoints/saved-states.js.map +1 -0
- package/dist/sandbox/checkpoints/types.d.ts +84 -0
- package/dist/sandbox/checkpoints/types.d.ts.map +1 -0
- package/dist/sandbox/checkpoints/types.js +51 -0
- package/dist/sandbox/checkpoints/types.js.map +1 -0
- package/dist/sandbox/checkpoints/validation.d.ts +3 -0
- package/dist/sandbox/checkpoints/validation.d.ts.map +1 -0
- package/dist/sandbox/checkpoints/validation.js +99 -0
- package/dist/sandbox/checkpoints/validation.js.map +1 -0
- package/dist/sandbox/clock.d.ts +121 -0
- package/dist/sandbox/clock.d.ts.map +1 -0
- package/dist/sandbox/clock.js +167 -0
- package/dist/sandbox/clock.js.map +1 -0
- package/dist/sandbox/full-state.d.ts +160 -0
- package/dist/sandbox/full-state.d.ts.map +1 -0
- package/dist/sandbox/full-state.js +267 -0
- package/dist/sandbox/full-state.js.map +1 -0
- package/dist/sandbox/index.d.ts +13 -6
- package/dist/sandbox/index.d.ts.map +1 -1
- package/dist/sandbox/index.js +23 -9
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/internal/ai-evidence.d.ts +27 -0
- package/dist/sandbox/internal/ai-evidence.d.ts.map +1 -0
- package/dist/sandbox/internal/ai-evidence.js +29 -0
- package/dist/sandbox/internal/ai-evidence.js.map +1 -0
- package/dist/sandbox/internal/event-history.d.ts +32 -0
- package/dist/sandbox/internal/event-history.d.ts.map +1 -0
- package/dist/sandbox/internal/event-history.js +199 -0
- package/dist/sandbox/internal/event-history.js.map +1 -0
- package/dist/sandbox/internal/history-integrity.d.ts +3 -0
- package/dist/sandbox/internal/history-integrity.d.ts.map +1 -0
- package/dist/sandbox/internal/history-integrity.js +12 -0
- package/dist/sandbox/internal/history-integrity.js.map +1 -0
- package/dist/sandbox/internal/history-retention.d.ts +6 -0
- package/dist/sandbox/internal/history-retention.d.ts.map +1 -0
- package/dist/sandbox/internal/history-retention.js +12 -0
- package/dist/sandbox/internal/history-retention.js.map +1 -0
- package/dist/sandbox/internal/index.d.ts +27 -0
- package/dist/sandbox/internal/index.d.ts.map +1 -1
- package/dist/sandbox/internal/index.js +26 -0
- package/dist/sandbox/internal/index.js.map +1 -1
- package/dist/sandbox/internal/observation-history.d.ts +6 -0
- package/dist/sandbox/internal/observation-history.d.ts.map +1 -0
- package/dist/sandbox/internal/observation-history.js +6 -0
- package/dist/sandbox/internal/observation-history.js.map +1 -0
- package/dist/sandbox/internal/observation-payload.d.ts +6 -0
- package/dist/sandbox/internal/observation-payload.d.ts.map +1 -0
- package/dist/sandbox/internal/observation-payload.js +24 -0
- package/dist/sandbox/internal/observation-payload.js.map +1 -0
- package/dist/sandbox/internal/provenance.d.ts +0 -1
- package/dist/sandbox/internal/provenance.d.ts.map +1 -1
- package/dist/sandbox/internal/provenance.js +6 -0
- package/dist/sandbox/internal/provenance.js.map +1 -1
- package/dist/sandbox/internal/root.d.ts +2 -1
- package/dist/sandbox/internal/root.d.ts.map +1 -1
- package/dist/sandbox/internal/root.js +2 -2
- package/dist/sandbox/internal/root.js.map +1 -1
- package/dist/sandbox/internal/rules-evidence-retention.d.ts +11 -0
- package/dist/sandbox/internal/rules-evidence-retention.d.ts.map +1 -0
- package/dist/sandbox/internal/rules-evidence-retention.js +27 -0
- package/dist/sandbox/internal/rules-evidence-retention.js.map +1 -0
- package/dist/sandbox/internal/sandbox-impl.d.ts +40 -33
- package/dist/sandbox/internal/sandbox-impl.d.ts.map +1 -1
- package/dist/sandbox/internal/sandbox-impl.js +83 -40
- package/dist/sandbox/internal/sandbox-impl.js.map +1 -1
- package/dist/sandbox/internal/sdk-activity.d.ts +112 -0
- package/dist/sandbox/internal/sdk-activity.d.ts.map +1 -0
- package/dist/sandbox/internal/sdk-activity.js +240 -0
- package/dist/sandbox/internal/sdk-activity.js.map +1 -0
- package/dist/sandbox/internal/sdk-coverage.d.ts +10 -0
- package/dist/sandbox/internal/sdk-coverage.d.ts.map +1 -0
- package/dist/sandbox/internal/sdk-coverage.js +21 -0
- package/dist/sandbox/internal/sdk-coverage.js.map +1 -0
- package/dist/sandbox/internal/sdk-observation.d.ts +32 -0
- package/dist/sandbox/internal/sdk-observation.d.ts.map +1 -0
- package/dist/sandbox/internal/sdk-observation.js +29 -0
- package/dist/sandbox/internal/sdk-observation.js.map +1 -0
- package/dist/sandbox/internal/sdk-rates.d.ts +97 -0
- package/dist/sandbox/internal/sdk-rates.d.ts.map +1 -0
- package/dist/sandbox/internal/sdk-rates.js +187 -0
- package/dist/sandbox/internal/sdk-rates.js.map +1 -0
- package/dist/sandbox/internal/sdk-write-activity.d.ts +5 -0
- package/dist/sandbox/internal/sdk-write-activity.d.ts.map +1 -0
- package/dist/sandbox/internal/sdk-write-activity.js +13 -0
- package/dist/sandbox/internal/sdk-write-activity.js.map +1 -0
- package/dist/sandbox/internal/state-schemas.d.ts +120 -0
- package/dist/sandbox/internal/state-schemas.d.ts.map +1 -0
- package/dist/sandbox/internal/state-schemas.js +42 -0
- package/dist/sandbox/internal/state-schemas.js.map +1 -0
- package/dist/sandbox/internal/state-values.d.ts +6 -0
- package/dist/sandbox/internal/state-values.d.ts.map +1 -0
- package/dist/sandbox/internal/state-values.js +15 -0
- package/dist/sandbox/internal/state-values.js.map +1 -0
- package/dist/sandbox/internal/storage-activity.d.ts +13 -0
- package/dist/sandbox/internal/storage-activity.d.ts.map +1 -0
- package/dist/sandbox/internal/storage-activity.js +48 -0
- package/dist/sandbox/internal/storage-activity.js.map +1 -0
- package/dist/sandbox/internal/usage-evidence.d.ts +24 -0
- package/dist/sandbox/internal/usage-evidence.d.ts.map +1 -0
- package/dist/sandbox/internal/usage-evidence.js +56 -0
- package/dist/sandbox/internal/usage-evidence.js.map +1 -0
- package/dist/sandbox/operation-record.d.ts +20 -1
- package/dist/sandbox/operation-record.d.ts.map +1 -1
- package/dist/sandbox/operation-record.js +100 -4
- package/dist/sandbox/operation-record.js.map +1 -1
- package/dist/sandbox/persistence/changed-buckets.d.ts +19 -0
- package/dist/sandbox/persistence/changed-buckets.d.ts.map +1 -0
- package/dist/sandbox/persistence/changed-buckets.js +72 -0
- package/dist/sandbox/persistence/changed-buckets.js.map +1 -0
- package/dist/sandbox/persistence/chunk-format.d.ts +27 -1
- package/dist/sandbox/persistence/chunk-format.d.ts.map +1 -1
- package/dist/sandbox/persistence/chunk-format.js +37 -25
- package/dist/sandbox/persistence/chunk-format.js.map +1 -1
- package/dist/sandbox/persistence/controller.d.ts.map +1 -1
- package/dist/sandbox/persistence/controller.js +91 -36
- package/dist/sandbox/persistence/controller.js.map +1 -1
- package/dist/sandbox/persistence/import-bundle.d.ts +8 -0
- package/dist/sandbox/persistence/import-bundle.d.ts.map +1 -0
- package/dist/sandbox/persistence/import-bundle.js +66 -0
- package/dist/sandbox/persistence/import-bundle.js.map +1 -0
- package/dist/sandbox/persistence/serialize.d.ts +1 -1
- package/dist/sandbox/persistence/serialize.d.ts.map +1 -1
- package/dist/sandbox/persistence/serialize.js +16 -11
- package/dist/sandbox/persistence/serialize.js.map +1 -1
- package/dist/sandbox/persistence/types.d.ts +4 -0
- package/dist/sandbox/persistence/types.d.ts.map +1 -1
- package/dist/sandbox/persistence/validate-services.d.ts +7 -0
- package/dist/sandbox/persistence/validate-services.d.ts.map +1 -0
- package/dist/sandbox/persistence/validate-services.js +73 -0
- package/dist/sandbox/persistence/validate-services.js.map +1 -0
- package/dist/sandbox/remote.d.ts +6 -0
- package/dist/sandbox/remote.d.ts.map +1 -1
- package/dist/sandbox/remote.js.map +1 -1
- package/dist/sandbox/replay/index.d.ts +1 -1
- package/dist/sandbox/replay/index.d.ts.map +1 -1
- package/dist/sandbox/replay/index.js +18 -8
- package/dist/sandbox/replay/index.js.map +1 -1
- package/dist/sandbox/types/errors.d.ts +3 -1
- package/dist/sandbox/types/errors.d.ts.map +1 -1
- package/dist/sandbox/types/errors.js +0 -4
- package/dist/sandbox/types/errors.js.map +1 -1
- package/dist/sandbox/types/events.d.ts +105 -76
- package/dist/sandbox/types/events.d.ts.map +1 -1
- package/dist/sandbox/types/events.js +0 -5
- package/dist/sandbox/types/events.js.map +1 -1
- package/dist/sandbox/types/index.d.ts +2 -1
- package/dist/sandbox/types/index.d.ts.map +1 -1
- package/dist/sandbox/types/index.js +1 -0
- package/dist/sandbox/types/index.js.map +1 -1
- package/dist/sandbox/types/operation.d.ts +13 -4
- package/dist/sandbox/types/operation.d.ts.map +1 -1
- package/dist/sandbox/types/persistence.d.ts +2 -2
- package/dist/sandbox/types/query-proof.d.ts +25 -0
- package/dist/sandbox/types/query-proof.d.ts.map +1 -0
- package/dist/sandbox/types/query-proof.js +2 -0
- package/dist/sandbox/types/query-proof.js.map +1 -0
- package/dist/sandbox/types/request-observation.d.ts +19 -0
- package/dist/sandbox/types/request-observation.d.ts.map +1 -0
- package/dist/sandbox/types/request-observation.js +13 -0
- package/dist/sandbox/types/request-observation.js.map +1 -0
- package/dist/sandbox/types/rules-evidence.d.ts +48 -0
- package/dist/sandbox/types/rules-evidence.d.ts.map +1 -0
- package/dist/sandbox/types/rules-evidence.js +2 -0
- package/dist/sandbox/types/rules-evidence.js.map +1 -0
- package/dist/sandbox/types/service-event-record.d.ts +30 -0
- package/dist/sandbox/types/service-event-record.d.ts.map +1 -0
- package/dist/sandbox/types/service-event-record.js +13 -0
- package/dist/sandbox/types/service-event-record.js.map +1 -0
- package/dist/sandbox/types/service-event-records.d.ts +64 -0
- package/dist/sandbox/types/service-event-records.d.ts.map +1 -0
- package/dist/sandbox/types/service-event-records.js +31 -0
- package/dist/sandbox/types/service-event-records.js.map +1 -0
- package/dist/sandbox/types/service-mutation-event.d.ts +88 -0
- package/dist/sandbox/types/service-mutation-event.d.ts.map +1 -0
- package/dist/sandbox/types/service-mutation-event.js +2 -0
- package/dist/sandbox/types/service-mutation-event.js.map +1 -0
- package/dist/storage/activity-coverage.d.ts +9 -0
- package/dist/storage/activity-coverage.d.ts.map +1 -0
- package/dist/storage/activity-coverage.js +9 -0
- package/dist/storage/activity-coverage.js.map +1 -0
- package/dist/storage/base64.d.ts +14 -0
- package/dist/storage/base64.d.ts.map +1 -0
- package/dist/storage/base64.js +34 -0
- package/dist/storage/base64.js.map +1 -0
- package/dist/storage/download.d.ts +12 -4
- package/dist/storage/download.d.ts.map +1 -1
- package/dist/storage/download.js +19 -6
- package/dist/storage/download.js.map +1 -1
- package/dist/storage/enforce.d.ts +13 -2
- package/dist/storage/enforce.d.ts.map +1 -1
- package/dist/storage/enforce.js +21 -3
- package/dist/storage/enforce.js.map +1 -1
- package/dist/storage/errors.d.ts +29 -5
- package/dist/storage/errors.d.ts.map +1 -1
- package/dist/storage/errors.js +28 -0
- package/dist/storage/errors.js.map +1 -1
- package/dist/storage/events.d.ts +12 -0
- package/dist/storage/events.d.ts.map +1 -0
- package/dist/storage/events.js +10 -0
- package/dist/storage/events.js.map +1 -0
- package/dist/storage/index.d.ts +7 -7
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +7 -5
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.d.ts +10 -1
- package/dist/storage/internal.d.ts.map +1 -1
- package/dist/storage/internal.js +9 -1
- package/dist/storage/internal.js.map +1 -1
- package/dist/storage/metadata.d.ts +19 -0
- package/dist/storage/metadata.d.ts.map +1 -1
- package/dist/storage/metadata.js +50 -19
- package/dist/storage/metadata.js.map +1 -1
- package/dist/storage/observed.d.ts +16 -0
- package/dist/storage/observed.d.ts.map +1 -0
- package/dist/storage/observed.js +17 -0
- package/dist/storage/observed.js.map +1 -0
- package/dist/storage/persistence.d.ts +157 -20
- package/dist/storage/persistence.d.ts.map +1 -1
- package/dist/storage/persistence.js +423 -53
- package/dist/storage/persistence.js.map +1 -1
- package/dist/storage/reference.d.ts +3 -1
- package/dist/storage/reference.d.ts.map +1 -1
- package/dist/storage/reference.js +3 -2
- package/dist/storage/reference.js.map +1 -1
- package/dist/storage/remote-bytes.d.ts +44 -0
- package/dist/storage/remote-bytes.d.ts.map +1 -0
- package/dist/storage/remote-bytes.js +97 -0
- package/dist/storage/remote-bytes.js.map +1 -0
- package/dist/storage/resumable.d.ts.map +1 -1
- package/dist/storage/resumable.js +16 -0
- package/dist/storage/resumable.js.map +1 -1
- package/dist/storage/rules-resolution.d.ts +13 -1
- package/dist/storage/rules-resolution.d.ts.map +1 -1
- package/dist/storage/rules-resolution.js +28 -0
- package/dist/storage/rules-resolution.js.map +1 -1
- package/dist/storage/sandbox/persistence-state.d.ts +25 -0
- package/dist/storage/sandbox/persistence-state.d.ts.map +1 -0
- package/dist/storage/sandbox/persistence-state.js +53 -0
- package/dist/storage/sandbox/persistence-state.js.map +1 -0
- package/dist/storage/sandbox/rules-bindings.d.ts +15 -0
- package/dist/storage/sandbox/rules-bindings.d.ts.map +1 -0
- package/dist/storage/sandbox/rules-bindings.js +69 -0
- package/dist/storage/sandbox/rules-bindings.js.map +1 -0
- package/dist/storage/sandbox/rules-collection-methods.d.ts +3 -0
- package/dist/storage/sandbox/rules-collection-methods.d.ts.map +1 -0
- package/dist/storage/sandbox/rules-collection-methods.js +149 -0
- package/dist/storage/sandbox/rules-collection-methods.js.map +1 -0
- package/dist/storage/sandbox/rules-evaluator.d.ts +2 -2
- package/dist/storage/sandbox/rules-evaluator.d.ts.map +1 -1
- package/dist/storage/sandbox/rules-evaluator.js +51 -129
- package/dist/storage/sandbox/rules-evaluator.js.map +1 -1
- package/dist/storage/sandbox/rules-firestore-lookup.d.ts +25 -0
- package/dist/storage/sandbox/rules-firestore-lookup.d.ts.map +1 -0
- package/dist/storage/sandbox/rules-firestore-lookup.js +94 -0
- package/dist/storage/sandbox/rules-firestore-lookup.js.map +1 -0
- package/dist/storage/sandbox/rules-hashing-methods.d.ts +16 -0
- package/dist/storage/sandbox/rules-hashing-methods.d.ts.map +1 -0
- package/dist/storage/sandbox/rules-hashing-methods.js +41 -0
- package/dist/storage/sandbox/rules-hashing-methods.js.map +1 -0
- package/dist/storage/sandbox/rules-method-calls.d.ts +40 -0
- package/dist/storage/sandbox/rules-method-calls.d.ts.map +1 -0
- package/dist/storage/sandbox/rules-method-calls.js +47 -0
- package/dist/storage/sandbox/rules-method-calls.js.map +1 -0
- package/dist/storage/sandbox/rules-methods.d.ts +11 -12
- package/dist/storage/sandbox/rules-methods.d.ts.map +1 -1
- package/dist/storage/sandbox/rules-methods.js +62 -359
- package/dist/storage/sandbox/rules-methods.js.map +1 -1
- package/dist/storage/sandbox/rules-operators.d.ts +32 -0
- package/dist/storage/sandbox/rules-operators.d.ts.map +1 -0
- package/dist/storage/sandbox/rules-operators.js +85 -0
- package/dist/storage/sandbox/rules-operators.js.map +1 -0
- package/dist/storage/sandbox/rules-string-methods.d.ts +3 -0
- package/dist/storage/sandbox/rules-string-methods.d.ts.map +1 -0
- package/dist/storage/sandbox/rules-string-methods.js +199 -0
- package/dist/storage/sandbox/rules-string-methods.js.map +1 -0
- package/dist/storage/sandbox/rules-time-methods.d.ts +25 -0
- package/dist/storage/sandbox/rules-time-methods.d.ts.map +1 -0
- package/dist/storage/sandbox/rules-time-methods.js +89 -0
- package/dist/storage/sandbox/rules-time-methods.js.map +1 -0
- package/dist/storage/sandbox/rules-values.d.ts +6 -0
- package/dist/storage/sandbox/rules-values.d.ts.map +1 -1
- package/dist/storage/sandbox/rules-values.js +29 -2
- package/dist/storage/sandbox/rules-values.js.map +1 -1
- package/dist/storage/sandbox/rules.d.ts +25 -13
- package/dist/storage/sandbox/rules.d.ts.map +1 -1
- package/dist/storage/sandbox/rules.js +19 -10
- package/dist/storage/sandbox/rules.js.map +1 -1
- package/dist/storage/sandbox/running-service.d.ts +65 -0
- package/dist/storage/sandbox/running-service.d.ts.map +1 -0
- package/dist/storage/sandbox/running-service.js +30 -0
- package/dist/storage/sandbox/running-service.js.map +1 -0
- package/dist/storage/service.d.ts +46 -28
- package/dist/storage/service.d.ts.map +1 -1
- package/dist/storage/service.js +169 -57
- package/dist/storage/service.js.map +1 -1
- package/dist/storage/string-format.d.ts +9 -0
- package/dist/storage/string-format.d.ts.map +1 -0
- package/dist/storage/string-format.js +8 -0
- package/dist/storage/string-format.js.map +1 -0
- package/dist/storage/upload.d.ts +2 -1
- package/dist/storage/upload.d.ts.map +1 -1
- package/dist/storage/upload.js +6 -2
- package/dist/storage/upload.js.map +1 -1
- package/dist/storage/url.d.ts +18 -0
- package/dist/storage/url.d.ts.map +1 -0
- package/dist/storage/url.js +84 -0
- package/dist/storage/url.js.map +1 -0
- package/package.json +17 -1
- package/src/ai/activity.ts +43 -0
- package/src/ai/broker/broker.ts +59 -6
- package/src/ai/broker/gemini-engine.ts +16 -0
- package/src/ai/broker/index.ts +1 -1
- package/src/ai/broker/openai-engine.ts +6 -3
- package/src/ai/broker/scripted-engine.ts +16 -5
- package/src/ai/broker/types.ts +6 -2
- package/src/ai/events.ts +29 -0
- package/src/ai/generation-enums.ts +48 -0
- package/src/ai/index.ts +9 -0
- package/src/ai/instances.ts +22 -2
- package/src/ai/internal.ts +5 -0
- package/src/ai/sandbox-plane.ts +23 -8
- package/src/ai/scripting.ts +42 -7
- package/src/app/internal.ts +1 -0
- package/src/auth/email-link.ts +32 -21
- package/src/auth/events.ts +29 -0
- package/src/auth/factor-id.ts +7 -0
- package/src/auth/index.ts +2 -0
- package/src/auth/instances.ts +13 -1
- package/src/auth/internal.ts +24 -0
- package/src/auth/modular.ts +27 -0
- package/src/auth/reauth.ts +3 -2
- package/src/auth/sandbox/default-avatar.ts +177 -0
- package/src/auth/sandbox/driver.ts +54 -0
- package/src/auth/sandbox/project-store.ts +0 -2
- package/src/auth/sandbox-backend-types.ts +31 -20
- package/src/auth/sandbox-backend.ts +400 -94
- package/src/auth/seed-user.ts +38 -0
- package/src/auth/tokens.ts +21 -18
- package/src/auth/types.ts +13 -1
- package/src/database/activity-coverage.ts +10 -0
- package/src/database/connection-lifecycle.ts +53 -24
- package/src/database/events.ts +20 -0
- package/src/database/instances.ts +52 -21
- package/src/database/internal/query-projection.ts +333 -0
- package/src/database/internal.ts +2 -0
- package/src/database/listeners.ts +162 -44
- package/src/database/operations.ts +73 -50
- package/src/database/replay.ts +6 -2
- package/src/database/routing.ts +4 -0
- package/src/database/sandbox/backend-for.ts +145 -25
- package/src/database/sandbox/backend-state.ts +15 -1
- package/src/database/sandbox/backend.ts +4 -2
- package/src/database/sandbox/child-listeners.ts +32 -13
- package/src/database/sandbox/listener-types.ts +5 -0
- package/src/database/sandbox/operation-events.ts +23 -9
- package/src/database/sandbox/persistence-state.ts +4 -11
- package/src/database/sandbox/priority-writes.ts +2 -2
- package/src/database/sandbox/query.ts +13 -268
- package/src/database/sandbox/rules-eval.ts +144 -10
- package/src/database/sandbox/transactions.ts +17 -39
- package/src/database/sandbox/value-listeners.ts +66 -23
- package/src/database/sandbox/write-plane.ts +29 -22
- package/src/database/sdk-activity.ts +26 -0
- package/src/database/transactions.ts +15 -11
- package/src/database/types.ts +12 -1
- package/src/deferred/entry.ts +16 -10
- package/src/firestore/activity-coverage.ts +8 -0
- package/src/firestore/aggregates.ts +17 -9
- package/src/firestore/bytes.ts +56 -0
- package/src/firestore/converter-method.ts +49 -0
- package/src/firestore/errors.ts +8 -0
- package/src/firestore/field-values.ts +3 -158
- package/src/firestore/geo-point.ts +56 -0
- package/src/firestore/index.ts +1 -1
- package/src/firestore/instances.ts +23 -2
- package/src/firestore/internal/document-data.ts +9 -0
- package/src/firestore/internal/index.ts +7 -0
- package/src/firestore/internal/value-codec.ts +150 -83
- package/src/firestore/internal/value-depth.ts +19 -0
- package/src/firestore/listeners.ts +60 -18
- package/src/firestore/persistence.ts +14 -9
- package/src/firestore/plain-object.ts +7 -0
- package/src/firestore/query-constraints.ts +4 -8
- package/src/firestore/reads.ts +81 -48
- package/src/firestore/refs.ts +56 -41
- package/src/firestore/sandbox/activity-query-display.ts +138 -0
- package/src/firestore/sandbox/admin-compat/batch.ts +26 -19
- package/src/firestore/sandbox/admin-compat/query-comparison.ts +9 -8
- package/src/firestore/sandbox/admin-compat/query.ts +46 -12
- package/src/firestore/sandbox/admin-compat/read-translation.ts +18 -6
- package/src/firestore/sandbox/admin-compat/transaction.ts +14 -4
- package/src/firestore/sandbox/admin-compat/types.ts +6 -88
- package/src/firestore/sandbox/atomic-state.ts +112 -0
- package/src/firestore/sandbox/atomic-write-pipeline.ts +129 -77
- package/src/firestore/sandbox/batch-write-executor.ts +51 -29
- package/src/firestore/sandbox/converters/user-timestamp.ts +19 -42
- package/src/firestore/sandbox/document-copy.ts +27 -0
- package/src/firestore/sandbox/document-store.ts +108 -0
- package/src/firestore/sandbox/errors.ts +5 -1
- package/src/firestore/sandbox/event-log.ts +72 -7
- package/src/firestore/sandbox/field-merge.ts +10 -19
- package/src/firestore/sandbox/history-controls.ts +1 -1
- package/src/firestore/sandbox/list-query-proof.ts +43 -72
- package/src/firestore/sandbox/listener-dispatch.ts +59 -4
- package/src/firestore/sandbox/local-environment.ts +35 -7
- package/src/firestore/sandbox/local-state.ts +72 -232
- package/src/firestore/sandbox/query-execution.ts +56 -34
- package/src/firestore/sandbox/query-operand-equality.ts +57 -14
- package/src/firestore/sandbox/query-operators.ts +20 -0
- package/src/firestore/sandbox/query-value-registry.ts +3 -2
- package/src/firestore/sandbox/request-events.ts +5 -0
- package/src/firestore/sandbox/rules-evidence.ts +94 -0
- package/src/firestore/sandbox/rules-list-authorizer.ts +62 -107
- package/src/firestore/sandbox/rules-operation-reader.ts +11 -4
- package/src/firestore/sandbox/rules-read-engine.ts +19 -8
- package/src/firestore/sandbox/rules-state.ts +21 -0
- package/src/firestore/sandbox/snapshot-listeners.ts +12 -1
- package/src/firestore/sandbox/transaction-merge.ts +33 -20
- package/src/firestore/sandbox/transaction-types.ts +11 -21
- package/src/firestore/sandbox/transaction-write-executor.ts +103 -69
- package/src/firestore/sandbox/transaction.ts +24 -7
- package/src/firestore/sandbox/value-resolver.ts +2 -13
- package/src/firestore/sandbox/write-engine.ts +13 -5
- package/src/firestore/sandbox/write-runtime.ts +68 -40
- package/src/firestore/sandbox/writes.ts +3 -1
- package/src/firestore/sdk-activity.ts +31 -0
- package/src/firestore/snapshots.ts +84 -18
- package/src/firestore/state.ts +34 -14
- package/src/firestore/timestamp.ts +86 -0
- package/src/firestore/tools.ts +3 -3
- package/src/firestore/transactions.ts +88 -8
- package/src/firestore/types.ts +26 -5
- package/src/firestore/vector-value.ts +54 -0
- package/src/firestore/writes.ts +53 -43
- package/src/functions/events.ts +27 -0
- package/src/messaging/broker/broker.test.ts +114 -0
- package/src/messaging/broker/broker.ts +152 -65
- package/src/messaging/broker/delivery-history.ts +49 -0
- package/src/messaging/broker/index.ts +11 -0
- package/src/messaging/broker/persistence.ts +54 -0
- package/src/messaging/broker/types.ts +50 -0
- package/src/messaging/events.ts +29 -0
- package/src/rules/api/case-types.ts +7 -0
- package/src/rules/api/rtdb.ts +15 -7
- package/src/rules/grammar/parse-error-wording.ts +98 -0
- package/src/rules/indexes/query-analysis.ts +136 -0
- package/src/rules/indexes/service-query.ts +69 -0
- package/src/rules/internal/index.ts +16 -0
- package/src/rules/modules/rules-capabilities.generated.ts +1 -1
- package/src/rules/rtdb/constraints/atoms.spec.ts +7 -7
- package/src/rules/rtdb/constraints/atoms.ts +7 -7
- package/src/rules/rtdb/constraints/data.ts +4 -4
- package/src/rules/rtdb/constraints/document.ts +4 -2
- package/src/rules/rtdb/constraints/game.spec.ts +4 -4
- package/src/rules/rtdb/constraints/policies.spec.ts +5 -5
- package/src/rules/rtdb/constraints/policies.ts +4 -4
- package/src/rules/rtdb/constraints/schema.ts +3 -3
- package/src/rules/rtdb/grammar/RtdbExpr.ohm +1 -3
- package/src/rules/rtdb/grammar/RtdbExpr.ohm.generated.ts +1 -3
- package/src/rules/rtdb/grammar/linter.ts +34 -30
- package/src/rules/rtdb/grammar/simulator.ts +112 -74
- package/src/rules/rtdb/grammar/validator.ts +30 -26
- package/src/rules/rtdb/simulation/handler.ts +139 -36
- package/src/rules/rtdb/simulation/spec.ts +24 -1
- package/src/rules/simulator/evaluator.ts +34 -41
- package/src/rules/simulator/handler.ts +12 -3
- package/src/rules/simulator/mapdiff.ts +7 -5
- package/src/rules/simulator/query-proof-residual.ts +209 -0
- package/src/rules/simulator/query-proof.ts +53 -27
- package/src/rules/simulator/request-path.ts +39 -0
- package/src/rules/simulator/trace-recorder.ts +3 -0
- package/src/rules/simulator/wrappers/timestamp.ts +8 -1
- package/src/rules/simulator-tools-impl.ts +6 -3
- package/src/rules/stdlib-tools.ts +4 -4
- package/src/sandbox/active-listeners.ts +245 -0
- package/src/sandbox/admin-firestore/error-translation.ts +16 -2
- package/src/sandbox/admin-firestore/listeners.ts +26 -1
- package/src/sandbox/admin-firestore/remote/listeners.ts +50 -32
- package/src/sandbox/admin-firestore/remote/value-codec.ts +7 -14
- package/src/sandbox/admin-firestore/remote/wire-types.ts +3 -0
- package/src/sandbox/attribution/attribution-mode.ts +74 -0
- package/src/sandbox/attribution/effect-regions.ts +130 -0
- package/src/sandbox/attribution/element-selector.ts +118 -0
- package/src/sandbox/attribution/listener-owners.ts +277 -0
- package/src/sandbox/branches/engine.ts +362 -0
- package/src/sandbox/branches/index.ts +12 -448
- package/src/sandbox/branches/promotion.ts +207 -0
- package/src/sandbox/branches/state-diff.ts +333 -0
- package/src/sandbox/branches/store.ts +317 -0
- package/src/sandbox/checkpoints/capture.ts +77 -0
- package/src/sandbox/checkpoints/directory-backend.ts +110 -0
- package/src/sandbox/checkpoints/index.ts +32 -0
- package/src/sandbox/checkpoints/record-backend.ts +109 -0
- package/src/sandbox/checkpoints/saved-states.ts +72 -0
- package/src/sandbox/checkpoints/types.ts +115 -0
- package/src/sandbox/checkpoints/validation.ts +102 -0
- package/src/sandbox/clock.ts +205 -0
- package/src/sandbox/full-state.ts +403 -0
- package/src/sandbox/index.ts +53 -10
- package/src/sandbox/internal/ai-evidence.ts +38 -0
- package/src/sandbox/internal/event-history.ts +193 -0
- package/src/sandbox/internal/history-integrity.ts +12 -0
- package/src/sandbox/internal/history-retention.ts +16 -0
- package/src/sandbox/internal/index.ts +65 -0
- package/src/sandbox/internal/observation-history.ts +5 -0
- package/src/sandbox/internal/observation-payload.ts +18 -0
- package/src/sandbox/internal/provenance.ts +5 -0
- package/src/sandbox/internal/root.ts +3 -2
- package/src/sandbox/internal/rules-evidence-retention.ts +28 -0
- package/src/sandbox/internal/sandbox-impl.ts +91 -45
- package/src/sandbox/internal/sdk-activity.ts +291 -0
- package/src/sandbox/internal/sdk-coverage.ts +28 -0
- package/src/sandbox/internal/sdk-observation.ts +62 -0
- package/src/sandbox/internal/sdk-rates.ts +240 -0
- package/src/sandbox/internal/sdk-write-activity.ts +14 -0
- package/src/sandbox/internal/state-schemas.ts +47 -0
- package/src/sandbox/internal/state-values.ts +20 -0
- package/src/sandbox/internal/storage-activity.ts +43 -0
- package/src/sandbox/internal/usage-evidence.ts +77 -0
- package/src/sandbox/operation-record.ts +107 -4
- package/src/sandbox/persistence/changed-buckets.ts +61 -0
- package/src/sandbox/persistence/chunk-format.ts +39 -27
- package/src/sandbox/persistence/controller.ts +85 -33
- package/src/sandbox/persistence/import-bundle.ts +64 -0
- package/src/sandbox/persistence/serialize.ts +16 -10
- package/src/sandbox/persistence/types.ts +4 -0
- package/src/sandbox/persistence/validate-services.ts +70 -0
- package/src/sandbox/remote.ts +7 -0
- package/src/sandbox/replay/index.ts +15 -8
- package/src/sandbox/types/errors.ts +3 -1
- package/src/sandbox/types/events.ts +118 -75
- package/src/sandbox/types/index.ts +12 -0
- package/src/sandbox/types/operation.ts +14 -4
- package/src/sandbox/types/persistence.ts +2 -2
- package/src/sandbox/types/query-proof.ts +26 -0
- package/src/sandbox/types/request-observation.ts +25 -0
- package/src/sandbox/types/rules-evidence.ts +37 -0
- package/src/sandbox/types/service-event-record.ts +34 -0
- package/src/sandbox/types/service-event-records.ts +42 -0
- package/src/sandbox/types/service-mutation-event.ts +93 -0
- package/src/storage/activity-coverage.ts +8 -0
- package/src/storage/base64.ts +35 -0
- package/src/storage/download.ts +19 -6
- package/src/storage/enforce.ts +26 -4
- package/src/storage/errors.ts +29 -14
- package/src/storage/events.ts +21 -0
- package/src/storage/index.ts +7 -7
- package/src/storage/internal.ts +21 -0
- package/src/storage/metadata.ts +68 -19
- package/src/storage/observed.ts +16 -0
- package/src/storage/persistence.ts +574 -66
- package/src/storage/reference.ts +6 -3
- package/src/storage/remote-bytes.ts +122 -0
- package/src/storage/resumable.ts +16 -3
- package/src/storage/rules-resolution.ts +43 -1
- package/src/storage/sandbox/persistence-state.ts +71 -0
- package/src/storage/sandbox/rules-bindings.ts +69 -0
- package/src/storage/sandbox/rules-collection-methods.ts +161 -0
- package/src/storage/sandbox/rules-evaluator.ts +65 -142
- package/src/storage/sandbox/rules-firestore-lookup.ts +112 -0
- package/src/storage/sandbox/rules-hashing-methods.ts +50 -0
- package/src/storage/sandbox/rules-method-calls.ts +67 -0
- package/src/storage/sandbox/rules-methods.ts +63 -404
- package/src/storage/sandbox/rules-operators.ts +93 -0
- package/src/storage/sandbox/rules-string-methods.ts +214 -0
- package/src/storage/sandbox/rules-time-methods.ts +98 -0
- package/src/storage/sandbox/rules-values.ts +20 -1
- package/src/storage/sandbox/rules.ts +27 -14
- package/src/storage/sandbox/running-service.ts +52 -0
- package/src/storage/service.ts +196 -85
- package/src/storage/string-format.ts +8 -0
- package/src/storage/upload.ts +8 -3
- package/src/storage/url.ts +106 -0
|
@@ -38,7 +38,9 @@ import { AuthFlowRegistry, } from './sandbox-auth-flow.js';
|
|
|
38
38
|
import { sandboxTokenFor } from './sandbox-token.js';
|
|
39
39
|
import { validateEmailFormat, validatePasswordStrength } from './sandbox-credential-validators.js';
|
|
40
40
|
import { createAuthProjectStore, } from './sandbox/project-store.js';
|
|
41
|
-
import {
|
|
41
|
+
import { defaultAvatarMint } from './sandbox/default-avatar.js';
|
|
42
|
+
import { normalizeAuthState } from 'pyric/sandbox';
|
|
43
|
+
import { emitSandboxEvent, getClock, makeServiceMutationEvent } from 'pyric/sandbox/internal';
|
|
42
44
|
import { USER_INTERNAL, } from './types.js';
|
|
43
45
|
import { NO_PASSWORD_SENTINEL, } from './sandbox-backend-types.js';
|
|
44
46
|
// Re-export the public backend types + the sentinel value from the
|
|
@@ -50,6 +52,15 @@ export { NO_PASSWORD_SENTINEL } from './sandbox-backend-types.js';
|
|
|
50
52
|
* sibling app backends share account/provider maps but not currentUser,
|
|
51
53
|
* listeners, tokens, flow staging, or persistence mode.
|
|
52
54
|
*/
|
|
55
|
+
/**
|
|
56
|
+
* The claims rules see on `auth.token` for a signed-in data context: the
|
|
57
|
+
* custom claims, plus the `firebase` namespace the minted ID token carries
|
|
58
|
+
* (`sign_in_provider`, and `tenant` for a tenant sign-in), as production's
|
|
59
|
+
* decoded ID token does.
|
|
60
|
+
*/
|
|
61
|
+
function rulesTokenClaims(claims, minted) {
|
|
62
|
+
return { ...claims, firebase: minted.claims.firebase };
|
|
63
|
+
}
|
|
53
64
|
export class SandboxBackend {
|
|
54
65
|
/** Email → stored user. Lowercase keys so lookups are case-
|
|
55
66
|
* insensitive (matches upstream). */
|
|
@@ -107,7 +118,7 @@ export class SandboxBackend {
|
|
|
107
118
|
* change). The subscriber only notifies for EXTERNAL mutations
|
|
108
119
|
* (direct sandbox writes, `reset()`, another handle). */
|
|
109
120
|
applyingTransition = false;
|
|
110
|
-
/** Per-uid current ID token + result. Refreshed on each
|
|
121
|
+
/** Per-uid and signed-in tenant current ID token + result. Refreshed on each
|
|
111
122
|
* `getIdToken(forceRefresh=true)` and on each new sign-in
|
|
112
123
|
* transition (so a sign-out / sign-in round-trip mints a fresh
|
|
113
124
|
* token, matching prod's "new session = new token" semantics).
|
|
@@ -183,6 +194,38 @@ export class SandboxBackend {
|
|
|
183
194
|
* section) — {@link assertProviderEnabled} becomes a no-op. Not
|
|
184
195
|
* persisted: a runtime wiring decision, not project config. */
|
|
185
196
|
providerEnforcementDelegated = false;
|
|
197
|
+
/**
|
|
198
|
+
* The hook that assigns a default `photoURL` to a federated-provider record
|
|
199
|
+
* at creation (see {@link makeStored}). The built-in mint returns a
|
|
200
|
+
* deterministic SVG data URI, which resolves with no server at all — so an
|
|
201
|
+
* in-page sandbox and any host that configures nothing behave identically.
|
|
202
|
+
*
|
|
203
|
+
* A HOST OVERRIDES IT ({@link setAvatarMint}): the served dev server swaps in
|
|
204
|
+
* a mint that returns its `/__pyric/assets/avatar/<uid>` route, and a server
|
|
205
|
+
* with avatars disabled swaps in one that returns `null`, which restores
|
|
206
|
+
* Firebase's own no-photo behaviour. Not persisted: a runtime wiring
|
|
207
|
+
* decision, not project config — but the URL it returns IS persisted, so a
|
|
208
|
+
* host must install its mint before any user record is created.
|
|
209
|
+
*/
|
|
210
|
+
avatarMint = defaultAvatarMint;
|
|
211
|
+
/**
|
|
212
|
+
* Tenant the NEXT sign-in through this handle authenticates against, or
|
|
213
|
+
* `null` for the project-level pool. Backs `Auth.tenantId`: the handle is a
|
|
214
|
+
* thin accessor over this field, so the value an app assigns before calling
|
|
215
|
+
* a sign-in function is the value {@link applyTenantScope} stamps onto the
|
|
216
|
+
* user and its stored record.
|
|
217
|
+
*/
|
|
218
|
+
tenantId = null;
|
|
219
|
+
/** Read `Auth.tenantId`. */
|
|
220
|
+
getTenantId() {
|
|
221
|
+
return this.tenantId;
|
|
222
|
+
}
|
|
223
|
+
/** Write `Auth.tenantId`. Takes effect on the next sign-in; the current
|
|
224
|
+
* session keeps the tenant it authenticated with, matching prod, where the
|
|
225
|
+
* tenant is fixed at the moment credentials are exchanged. */
|
|
226
|
+
setTenantId(tenantId) {
|
|
227
|
+
this.tenantId = tenantId;
|
|
228
|
+
}
|
|
186
229
|
constructor(sandbox, session = sandbox, projectStore = createAuthProjectStore(), ownCleanup) {
|
|
187
230
|
this.sandbox = sandbox;
|
|
188
231
|
this.session = session;
|
|
@@ -240,6 +283,20 @@ export class SandboxBackend {
|
|
|
240
283
|
getCurrentUser() {
|
|
241
284
|
return this.cachedUser;
|
|
242
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* The provider the current session signed in through. This is the same
|
|
288
|
+
* value {@link mintToken} puts on `IdTokenResult.signInProvider` and on the
|
|
289
|
+
* `firebase.sign_in_provider` claim, read without minting a token.
|
|
290
|
+
*
|
|
291
|
+
* `null` while the app is signed out, and `null` for an identity driven
|
|
292
|
+
* straight through the test driver, which records no provider.
|
|
293
|
+
*/
|
|
294
|
+
getCurrentSignInProvider() {
|
|
295
|
+
const user = this.cachedUser;
|
|
296
|
+
if (user === null)
|
|
297
|
+
return null;
|
|
298
|
+
return this.signInProviderByUid.get(user.uid) ?? null;
|
|
299
|
+
}
|
|
243
300
|
// ─── Listener registries ────────────────────────────────────────────
|
|
244
301
|
/**
|
|
245
302
|
* Subscribe to user change. Fires *immediately* on subscribe with
|
|
@@ -342,9 +399,23 @@ export class SandboxBackend {
|
|
|
342
399
|
}
|
|
343
400
|
}
|
|
344
401
|
// ─── User DB ────────────────────────────────────────────────────────
|
|
345
|
-
/**
|
|
346
|
-
|
|
347
|
-
|
|
402
|
+
/**
|
|
403
|
+
* Build a fresh {@link StoredUser} with admin-field defaults.
|
|
404
|
+
*
|
|
405
|
+
* THE ONE PLACE A DEFAULT PHOTO IS ASSIGNED. A federated-provider record
|
|
406
|
+
* that arrives without a photo gets one from {@link avatarMint} here, so
|
|
407
|
+
* `photoURL` is populated the instant the user object exists — never null
|
|
408
|
+
* for a moment and then patched. Every other path is untouched: an update,
|
|
409
|
+
* `updateProfile`, or `linkProvider` on an existing record never mints, and
|
|
410
|
+
* a caller-supplied photo always wins (see {@link mintsDefaultPhoto}).
|
|
411
|
+
*
|
|
412
|
+
* `signInProviderId` is the provider a flow is creating this record under,
|
|
413
|
+
* for the two paths that link the provider AFTER the record exists
|
|
414
|
+
* (`recordProviderSignIn`, `createSignInCredential`). Every other path
|
|
415
|
+
* carries its providers in `init.providerUserInfo`.
|
|
416
|
+
*/
|
|
417
|
+
makeStored(init, signInProviderId = null) {
|
|
418
|
+
const record = {
|
|
348
419
|
email: null,
|
|
349
420
|
password: null,
|
|
350
421
|
displayName: null,
|
|
@@ -355,10 +426,21 @@ export class SandboxBackend {
|
|
|
355
426
|
providerUserInfo: [],
|
|
356
427
|
disabled: false,
|
|
357
428
|
emailVerified: false,
|
|
358
|
-
createdAt:
|
|
429
|
+
createdAt: this.now().toISOString(),
|
|
359
430
|
lastLoginAt: null,
|
|
431
|
+
tenantId: null,
|
|
360
432
|
...init,
|
|
361
433
|
};
|
|
434
|
+
const providerId = creationProviderId(record, signInProviderId);
|
|
435
|
+
if (mintsDefaultPhoto(record, providerId)) {
|
|
436
|
+
record.photoUrl = this.avatarMint({
|
|
437
|
+
uid: record.uid,
|
|
438
|
+
displayName: record.displayName,
|
|
439
|
+
email: record.email,
|
|
440
|
+
providerId,
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
return record;
|
|
362
444
|
}
|
|
363
445
|
/** Fan a coarse "user DB changed" notification out to
|
|
364
446
|
* `subscribeUsers` listeners. Snapshotted iteration; throwing
|
|
@@ -373,6 +455,16 @@ export class SandboxBackend {
|
|
|
373
455
|
}
|
|
374
456
|
}
|
|
375
457
|
}
|
|
458
|
+
/**
|
|
459
|
+
* The sandbox's current time. Every time this backend records reads it: an
|
|
460
|
+
* account's `createdAt` and `lastLoginAt`, and a minted token's `iat`,
|
|
461
|
+
* `auth_time`, and `exp`. So a token minted while the sandbox clock is
|
|
462
|
+
* pinned to a date carries that date, and a rule reading
|
|
463
|
+
* `request.auth.token.iat` sees the same instant the write pipeline stamps.
|
|
464
|
+
*/
|
|
465
|
+
now() {
|
|
466
|
+
return getClock(this.sandbox).date();
|
|
467
|
+
}
|
|
376
468
|
/**
|
|
377
469
|
* Emit an auth {@link ServiceMutationEvent} onto the sandbox's unified
|
|
378
470
|
* `onEvent`/`history()` stream (Pyric Studio keystone). Best-effort and
|
|
@@ -386,6 +478,7 @@ export class SandboxBackend {
|
|
|
386
478
|
emitAuthEvent(op, fields = {}) {
|
|
387
479
|
try {
|
|
388
480
|
emitSandboxEvent(this.sandbox, makeServiceMutationEvent({
|
|
481
|
+
at: this.now().getTime(),
|
|
389
482
|
service: 'auth',
|
|
390
483
|
op,
|
|
391
484
|
path: fields.path,
|
|
@@ -470,6 +563,16 @@ export class SandboxBackend {
|
|
|
470
563
|
setProviderEnforcementDelegated(delegated) {
|
|
471
564
|
this.providerEnforcementDelegated = delegated;
|
|
472
565
|
}
|
|
566
|
+
/**
|
|
567
|
+
* Install the {@link AvatarMint} this backend assigns default photos with,
|
|
568
|
+
* replacing the built-in data-URI mint. A host installs its mint during
|
|
569
|
+
* boot, before it seeds or signs anyone in: the minted URL is written into
|
|
570
|
+
* the stored record, so records created earlier keep the mint that was
|
|
571
|
+
* installed when they were created.
|
|
572
|
+
*/
|
|
573
|
+
setAvatarMint(mint) {
|
|
574
|
+
this.avatarMint = mint;
|
|
575
|
+
}
|
|
473
576
|
/**
|
|
474
577
|
* Gate a provider entry point. Throws real Firebase's
|
|
475
578
|
* `auth/operation-not-allowed` (exactly the code/shape prod throws
|
|
@@ -601,49 +704,111 @@ export class SandboxBackend {
|
|
|
601
704
|
// in (AUTH-B9) — otherwise both emails would resolve, the old one
|
|
602
705
|
// to a now-orphaned record.
|
|
603
706
|
const prior = this.usersByUid.get(u.uid);
|
|
604
|
-
|
|
605
|
-
|
|
707
|
+
const priorEmail = prior?.email;
|
|
708
|
+
const hasPriorEmail = typeof priorEmail === 'string' && priorEmail.length > 0;
|
|
709
|
+
const changesEmail = hasPriorEmail && priorEmail.toLowerCase() !== u.email?.toLowerCase();
|
|
710
|
+
if (changesEmail) {
|
|
711
|
+
this.usersByEmail.delete(priorEmail.toLowerCase());
|
|
606
712
|
}
|
|
713
|
+
const isAnonymousSeed = u.providerId === 'anonymous';
|
|
714
|
+
const linkedProviders = u.providerUserInfo ?? [{ providerId: u.providerId ?? 'password' }];
|
|
715
|
+
const providerUserInfo = isAnonymousSeed ? [] : linkedProviders.map(provider => ({ ...provider }));
|
|
716
|
+
const hasPasswordProvider = providerUserInfo.some(provider => provider.providerId === 'password');
|
|
717
|
+
const hasLegacyPlaceholder = u.password === NO_PASSWORD_SENTINEL || u.password === '__pyric_popup_no_password__';
|
|
718
|
+
const isLegacyPasswordlessAccount = hasLegacyPlaceholder && !hasPasswordProvider;
|
|
719
|
+
const hasNoPassword = isAnonymousSeed || isLegacyPasswordlessAccount;
|
|
607
720
|
const record = this.makeStored({
|
|
608
721
|
uid: u.uid,
|
|
609
|
-
email: u.email,
|
|
610
|
-
password: u.password,
|
|
722
|
+
email: isAnonymousSeed ? null : (u.email ?? null),
|
|
723
|
+
password: hasNoPassword ? null : (u.password ?? null),
|
|
611
724
|
displayName: u.displayName ?? null,
|
|
725
|
+
phoneNumber: u.phoneNumber ?? null,
|
|
726
|
+
photoUrl: u.photoUrl ?? null,
|
|
612
727
|
customClaims: u.customClaims ?? {},
|
|
613
|
-
|
|
728
|
+
emailVerified: u.emailVerified ?? false,
|
|
729
|
+
disabled: u.disabled ?? false,
|
|
730
|
+
isAnonymous: isAnonymousSeed,
|
|
731
|
+
providerUserInfo,
|
|
732
|
+
tenantId: u.tenantId ?? null,
|
|
614
733
|
});
|
|
615
|
-
|
|
734
|
+
const { createdAt, lastLoginAt, email } = u;
|
|
735
|
+
const hasCreatedAt = createdAt !== undefined;
|
|
736
|
+
if (hasCreatedAt)
|
|
737
|
+
record.createdAt = createdAt;
|
|
738
|
+
const hasLastLoginAt = lastLoginAt !== undefined;
|
|
739
|
+
if (hasLastLoginAt)
|
|
740
|
+
record.lastLoginAt = lastLoginAt;
|
|
741
|
+
const indexesEmail = !isAnonymousSeed && email !== undefined;
|
|
742
|
+
if (indexesEmail)
|
|
743
|
+
this.usersByEmail.set(email.toLowerCase(), record);
|
|
616
744
|
this.usersByUid.set(u.uid, record);
|
|
617
745
|
}
|
|
618
|
-
|
|
746
|
+
const hasSeedUsers = users.length > 0;
|
|
747
|
+
if (hasSeedUsers)
|
|
619
748
|
this.notifyUsersChanged();
|
|
620
749
|
}
|
|
621
750
|
/**
|
|
622
751
|
* Export the user DB as `SeedUser`s — the exact shape `seedUsers`
|
|
623
|
-
* accepts,
|
|
624
|
-
* the
|
|
625
|
-
*
|
|
626
|
-
*
|
|
627
|
-
*
|
|
628
|
-
*
|
|
629
|
-
* ephemeral by design; documented divergence from prod's persisted
|
|
630
|
-
* anonymous sessions.
|
|
752
|
+
* accepts, including every linked provider. Passwordless accounts omit
|
|
753
|
+
* the password; legacy placeholder values are decoded only on import.
|
|
754
|
+
* Anonymous users (no email) export with
|
|
755
|
+
* `providerId: 'anonymous'` and no email or password, so a checkpoint,
|
|
756
|
+
* a branch, and a restart keep them, matching real Firebase, which
|
|
757
|
+
* keeps anonymous accounts in its user pool rather than discarding them.
|
|
631
758
|
*/
|
|
632
759
|
exportUsers() {
|
|
633
760
|
const out = [];
|
|
634
761
|
for (const u of this.usersByUid.values()) {
|
|
635
|
-
|
|
636
|
-
|
|
762
|
+
const { email, displayName, photoUrl, tenantId, phoneNumber, isAnonymous, disabled, emailVerified } = u;
|
|
763
|
+
const hasDisplayName = displayName !== null;
|
|
764
|
+
const hasPhotoUrl = photoUrl !== null;
|
|
765
|
+
const hasCustomClaims = Object.keys(u.customClaims).length > 0;
|
|
766
|
+
const hasTenant = tenantId !== null;
|
|
767
|
+
if (isAnonymous) {
|
|
768
|
+
const seed = { uid: u.uid, providerId: 'anonymous', createdAt: u.createdAt, lastLoginAt: u.lastLoginAt };
|
|
769
|
+
if (hasDisplayName)
|
|
770
|
+
seed.displayName = displayName;
|
|
771
|
+
if (hasPhotoUrl)
|
|
772
|
+
seed.photoUrl = photoUrl;
|
|
773
|
+
if (hasCustomClaims)
|
|
774
|
+
seed.customClaims = u.customClaims;
|
|
775
|
+
if (disabled)
|
|
776
|
+
seed.disabled = true;
|
|
777
|
+
if (hasTenant)
|
|
778
|
+
seed.tenantId = tenantId;
|
|
779
|
+
out.push(seed);
|
|
780
|
+
continue;
|
|
781
|
+
}
|
|
782
|
+
const hasNoEmail = email === null;
|
|
783
|
+
if (hasNoEmail)
|
|
784
|
+
continue; // credential-less, non-anonymous: not round-trippable
|
|
637
785
|
const seed = {
|
|
638
786
|
uid: u.uid,
|
|
639
|
-
|
|
640
|
-
|
|
787
|
+
createdAt: u.createdAt,
|
|
788
|
+
lastLoginAt: u.lastLoginAt,
|
|
789
|
+
email,
|
|
641
790
|
providerId: u.providerUserInfo[0]?.providerId ?? 'password',
|
|
791
|
+
providerUserInfo: u.providerUserInfo.map(provider => ({ ...provider })),
|
|
642
792
|
};
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
if (
|
|
793
|
+
const { password } = u;
|
|
794
|
+
const hasPassword = password !== null;
|
|
795
|
+
if (hasPassword)
|
|
796
|
+
seed.password = password;
|
|
797
|
+
if (hasDisplayName)
|
|
798
|
+
seed.displayName = displayName;
|
|
799
|
+
if (hasPhotoUrl)
|
|
800
|
+
seed.photoUrl = photoUrl;
|
|
801
|
+
const hasPhoneNumber = phoneNumber !== null;
|
|
802
|
+
if (hasPhoneNumber)
|
|
803
|
+
seed.phoneNumber = phoneNumber;
|
|
804
|
+
if (hasCustomClaims)
|
|
646
805
|
seed.customClaims = u.customClaims;
|
|
806
|
+
if (emailVerified)
|
|
807
|
+
seed.emailVerified = true;
|
|
808
|
+
if (disabled)
|
|
809
|
+
seed.disabled = true;
|
|
810
|
+
if (hasTenant)
|
|
811
|
+
seed.tenantId = tenantId;
|
|
647
812
|
out.push(seed);
|
|
648
813
|
}
|
|
649
814
|
return out;
|
|
@@ -786,8 +951,10 @@ export class SandboxBackend {
|
|
|
786
951
|
validateEmailFormat(email);
|
|
787
952
|
const key = email.toLowerCase();
|
|
788
953
|
const existing = this.usersByEmail.get(key);
|
|
789
|
-
|
|
790
|
-
|
|
954
|
+
const hasAccount = existing !== undefined;
|
|
955
|
+
if (hasAccount) {
|
|
956
|
+
const needsPasswordProvider = !existing.providerUserInfo.some((p) => p.providerId === 'password');
|
|
957
|
+
if (needsPasswordProvider) {
|
|
791
958
|
existing.providerUserInfo.push({ providerId: 'password' });
|
|
792
959
|
}
|
|
793
960
|
// Redeeming a link mailed to this address proves control of it.
|
|
@@ -795,7 +962,8 @@ export class SandboxBackend {
|
|
|
795
962
|
this.notifyUsersChanged();
|
|
796
963
|
return { stored: existing, isNewUser: false };
|
|
797
964
|
}
|
|
798
|
-
|
|
965
|
+
// Email punctuation is invalid in common UID-keyed RTDB paths.
|
|
966
|
+
const uid = `email-${globalThis.crypto.randomUUID()}`;
|
|
799
967
|
const record = this.makeStored({
|
|
800
968
|
uid,
|
|
801
969
|
email,
|
|
@@ -920,10 +1088,12 @@ export class SandboxBackend {
|
|
|
920
1088
|
validateEmailFormat(email);
|
|
921
1089
|
validatePasswordStrength(password);
|
|
922
1090
|
const key = email.toLowerCase();
|
|
923
|
-
|
|
1091
|
+
const emailInUse = this.usersByEmail.has(key);
|
|
1092
|
+
if (emailInUse) {
|
|
924
1093
|
throw makeAuthError('auth/email-already-in-use', `An account already exists for ${email}.`);
|
|
925
1094
|
}
|
|
926
|
-
|
|
1095
|
+
// Email punctuation is invalid in common UID-keyed RTDB paths.
|
|
1096
|
+
const uid = `email-${globalThis.crypto.randomUUID()}`;
|
|
927
1097
|
const record = this.makeStored({
|
|
928
1098
|
uid,
|
|
929
1099
|
email,
|
|
@@ -1033,6 +1203,13 @@ export class SandboxBackend {
|
|
|
1033
1203
|
* pre-resolved promise on the fast path instead of ever suspending.
|
|
1034
1204
|
*/
|
|
1035
1205
|
transitionCurrentUser(user, signInProvider) {
|
|
1206
|
+
// A `signInProvider` argument marks a REAL sign-in, which is the moment
|
|
1207
|
+
// the tenant is fixed (the test driver omits it and leaves the tenant
|
|
1208
|
+
// alone). Applied before the gate runs so a `beforeAuthStateChanged`
|
|
1209
|
+
// callback inspecting the user sees the tenant it will sign in under.
|
|
1210
|
+
if (user !== null && signInProvider !== undefined) {
|
|
1211
|
+
this.scopeSignInToTenant(user);
|
|
1212
|
+
}
|
|
1036
1213
|
const hasActiveGate = this.beforeStateSubs.some((reg) => reg.active);
|
|
1037
1214
|
if (!hasActiveGate || user === this.cachedUser) {
|
|
1038
1215
|
this.setCurrentUser(user, signInProvider);
|
|
@@ -1058,8 +1235,24 @@ export class SandboxBackend {
|
|
|
1058
1235
|
* test driver (`sandbox.setUser`), which leaves any previous value
|
|
1059
1236
|
* in place.
|
|
1060
1237
|
*/
|
|
1238
|
+
/**
|
|
1239
|
+
* Fix a signing-in user to the handle's current {@link tenantId}. This is
|
|
1240
|
+
* the sandbox's stand-in for Identity Platform resolving credentials against
|
|
1241
|
+
* one tenant's user pool. The value lands in two places: on the `User` (so
|
|
1242
|
+
* `user.tenantId` reads back, matching `firebase/auth`) and on the stored
|
|
1243
|
+
* record (so a session restored after a reload, which rebuilds the user from
|
|
1244
|
+
* that record, keeps the tenant it authenticated with).
|
|
1245
|
+
*/
|
|
1246
|
+
scopeSignInToTenant(user) {
|
|
1247
|
+
const tenantId = this.tenantId;
|
|
1248
|
+
user.tenantId = tenantId;
|
|
1249
|
+
const stored = this.usersByUid.get(user.uid);
|
|
1250
|
+
if (stored)
|
|
1251
|
+
stored.tenantId = tenantId;
|
|
1252
|
+
}
|
|
1061
1253
|
setCurrentUser(user, signInProvider) {
|
|
1062
|
-
|
|
1254
|
+
const signsOut = user === null;
|
|
1255
|
+
if (signsOut) {
|
|
1063
1256
|
// Sign-out. Drop the cached token so a later re-sign-in for the
|
|
1064
1257
|
// same uid mints a fresh one ("new session = new token"). Fire
|
|
1065
1258
|
// listeners only if we were actually signed in (signing out an
|
|
@@ -1073,7 +1266,8 @@ export class SandboxBackend {
|
|
|
1073
1266
|
finally {
|
|
1074
1267
|
this.applyingTransition = false;
|
|
1075
1268
|
}
|
|
1076
|
-
|
|
1269
|
+
const hadUser = previousUser !== null;
|
|
1270
|
+
if (hadUser) {
|
|
1077
1271
|
this.tokenCache.delete(previousUser.uid);
|
|
1078
1272
|
this.notifyAuthListeners();
|
|
1079
1273
|
this.notifySessionChanged();
|
|
@@ -1087,9 +1281,10 @@ export class SandboxBackend {
|
|
|
1087
1281
|
}
|
|
1088
1282
|
return;
|
|
1089
1283
|
}
|
|
1284
|
+
const isSignIn = signInProvider !== undefined;
|
|
1090
1285
|
// Record this session's provider BEFORE any token mint below so
|
|
1091
1286
|
// the freshly-minted token carries the right sign_in_provider.
|
|
1092
|
-
if (
|
|
1287
|
+
if (isSignIn) {
|
|
1093
1288
|
this.signInProviderByUid.set(user.uid, signInProvider);
|
|
1094
1289
|
}
|
|
1095
1290
|
// Look up custom claims for this uid (if we know them). Falls
|
|
@@ -1099,8 +1294,9 @@ export class SandboxBackend {
|
|
|
1099
1294
|
const claims = stored?.customClaims ?? {};
|
|
1100
1295
|
// A `signInProvider` argument marks an actual sign-in (the test
|
|
1101
1296
|
// driver omits it) — bump the record's lastLoginAt.
|
|
1102
|
-
|
|
1103
|
-
|
|
1297
|
+
const recordsSignIn = isSignIn && stored !== undefined;
|
|
1298
|
+
if (recordsSignIn) {
|
|
1299
|
+
stored.lastLoginAt = this.now().toISOString();
|
|
1104
1300
|
this.notifyUsersChanged();
|
|
1105
1301
|
}
|
|
1106
1302
|
// Stash the (possibly richer) User snapshot so listeners fire with
|
|
@@ -1110,11 +1306,15 @@ export class SandboxBackend {
|
|
|
1110
1306
|
// is unchanged (AUTH-B8: a same-uid re-sign-in still rotates the
|
|
1111
1307
|
// token, which `onIdTokenChanged` then observes). Matches prod's
|
|
1112
1308
|
// "new session = new token".
|
|
1113
|
-
this.
|
|
1309
|
+
const minted = this.mintToken(user.uid, claims, user.tenantId ?? null);
|
|
1114
1310
|
// Push to the sandbox under the guard so the synchronous subscriber
|
|
1115
1311
|
// doesn't notify — we drive the fan-out below with the correct
|
|
1116
1312
|
// id-token / auth-state split.
|
|
1117
|
-
const
|
|
1313
|
+
const signedInState = { uid: user.uid, token: rulesTokenClaims(claims, minted.result) };
|
|
1314
|
+
const hasTenant = typeof user.tenantId === 'string';
|
|
1315
|
+
if (hasTenant)
|
|
1316
|
+
signedInState.tenant = user.tenantId;
|
|
1317
|
+
const nextState = signedInState;
|
|
1118
1318
|
this.applyingTransition = true;
|
|
1119
1319
|
try {
|
|
1120
1320
|
this.session.currentUser = nextState;
|
|
@@ -1133,7 +1333,7 @@ export class SandboxBackend {
|
|
|
1133
1333
|
// the test driver (`sandbox.setUser`) omits it and is not a sign-in
|
|
1134
1334
|
// worth surfacing on the activity stream. The acting identity IS the
|
|
1135
1335
|
// user that just signed in.
|
|
1136
|
-
if (
|
|
1336
|
+
if (isSignIn) {
|
|
1137
1337
|
this.emitAuthEvent('sign_in', {
|
|
1138
1338
|
path: user.uid,
|
|
1139
1339
|
auth: nextState,
|
|
@@ -1170,23 +1370,30 @@ export class SandboxBackend {
|
|
|
1170
1370
|
* with its real provider. Upserts: unknown uids get a fresh record
|
|
1171
1371
|
* (no password — these identities can't sign in via
|
|
1172
1372
|
* `signInWithEmailAndPassword`); known uids get the provider
|
|
1173
|
-
* appended to `providerUserInfo` if it isn't already linked
|
|
1373
|
+
* appended to `providerUserInfo` if it isn't already linked, and their
|
|
1374
|
+
* stored photo refreshed when the identity carries one (see
|
|
1375
|
+
* {@link refreshStoredPhoto}).
|
|
1174
1376
|
*/
|
|
1175
1377
|
recordProviderSignIn(user, providerId) {
|
|
1176
1378
|
let changed = false;
|
|
1379
|
+
const identityPhotoUrl = user.photoURL ?? null;
|
|
1177
1380
|
let stored = this.usersByUid.get(user.uid);
|
|
1178
1381
|
if (!stored) {
|
|
1179
1382
|
stored = this.makeStored({
|
|
1180
1383
|
uid: user.uid,
|
|
1181
1384
|
email: user.email,
|
|
1182
1385
|
displayName: user.displayName,
|
|
1386
|
+
photoUrl: identityPhotoUrl,
|
|
1183
1387
|
isAnonymous: user.isAnonymous,
|
|
1184
|
-
});
|
|
1388
|
+
}, providerId);
|
|
1185
1389
|
this.usersByUid.set(user.uid, stored);
|
|
1186
1390
|
if (user.email)
|
|
1187
1391
|
this.usersByEmail.set(user.email.toLowerCase(), stored);
|
|
1188
1392
|
changed = true;
|
|
1189
1393
|
}
|
|
1394
|
+
else if (refreshStoredPhoto(stored, identityPhotoUrl)) {
|
|
1395
|
+
changed = true;
|
|
1396
|
+
}
|
|
1190
1397
|
if (!stored.providerUserInfo.some((p) => p.providerId === providerId)) {
|
|
1191
1398
|
stored.providerUserInfo.push({ providerId });
|
|
1192
1399
|
changed = true;
|
|
@@ -1215,7 +1422,10 @@ export class SandboxBackend {
|
|
|
1215
1422
|
* and NO password (provider identities can't sign in via
|
|
1216
1423
|
* `signInWithEmailAndPassword`).
|
|
1217
1424
|
*
|
|
1218
|
-
* In both shapes the provider is linked into `providerUserInfo`.
|
|
1425
|
+
* In both shapes the provider is linked into `providerUserInfo`. A
|
|
1426
|
+
* `spec.photoUrl` is stored on a fresh record and refreshes a reused
|
|
1427
|
+
* same-email one; a spec without a photo never clears a stored one (see
|
|
1428
|
+
* {@link refreshStoredPhoto}).
|
|
1219
1429
|
* The credential does NOT sign the user in — hand it to the
|
|
1220
1430
|
* resolver's promise; `signInWithPopup`/`signInWithRedirect`
|
|
1221
1431
|
* complete the sign-in.
|
|
@@ -1228,21 +1438,27 @@ export class SandboxBackend {
|
|
|
1228
1438
|
if (!found) {
|
|
1229
1439
|
throw makeAuthError('auth/user-not-found', `createSignInCredential: no identity with uid ${req.uid}. Use the {spec} shape to create one.`);
|
|
1230
1440
|
}
|
|
1441
|
+
this.assertUserEnabled(found);
|
|
1231
1442
|
stored = found;
|
|
1232
1443
|
}
|
|
1233
1444
|
else {
|
|
1234
1445
|
const { spec } = req;
|
|
1446
|
+
const specPhotoUrl = spec.photoUrl ?? null;
|
|
1235
1447
|
const byEmail = this.usersByEmail.get(spec.email.toLowerCase());
|
|
1236
1448
|
if (byEmail) {
|
|
1449
|
+
this.assertUserEnabled(byEmail);
|
|
1237
1450
|
stored = byEmail;
|
|
1451
|
+
if (refreshStoredPhoto(stored, specPhotoUrl))
|
|
1452
|
+
this.notifyUsersChanged();
|
|
1238
1453
|
}
|
|
1239
1454
|
else {
|
|
1240
1455
|
stored = this.makeStored({
|
|
1241
1456
|
uid: spec.uid ?? mintProviderUid(),
|
|
1242
1457
|
email: spec.email,
|
|
1243
1458
|
displayName: spec.displayName ?? null,
|
|
1459
|
+
photoUrl: specPhotoUrl,
|
|
1244
1460
|
customClaims: spec.customClaims ?? {},
|
|
1245
|
-
});
|
|
1461
|
+
}, providerId);
|
|
1246
1462
|
this.usersByUid.set(stored.uid, stored);
|
|
1247
1463
|
this.usersByEmail.set(spec.email.toLowerCase(), stored);
|
|
1248
1464
|
this.notifyUsersChanged();
|
|
@@ -1292,6 +1508,7 @@ export class SandboxBackend {
|
|
|
1292
1508
|
isAnonymous: u.isAnonymous,
|
|
1293
1509
|
disabled: u.disabled,
|
|
1294
1510
|
emailVerified: u.emailVerified,
|
|
1511
|
+
tenantId: u.tenantId,
|
|
1295
1512
|
createdAt: u.createdAt,
|
|
1296
1513
|
lastLoginAt: u.lastLoginAt,
|
|
1297
1514
|
};
|
|
@@ -1325,11 +1542,20 @@ export class SandboxBackend {
|
|
|
1325
1542
|
next.unshift({ providerId: 'password' });
|
|
1326
1543
|
return next;
|
|
1327
1544
|
}
|
|
1545
|
+
/** Restored or explicitly seeded users may already occupy generated IDs. */
|
|
1546
|
+
nextAvailableAdminUid() {
|
|
1547
|
+
for (;;) {
|
|
1548
|
+
const uid = `user-${this.sharedCounters.nextAdminUserId++}`;
|
|
1549
|
+
const isAvailable = !this.usersByUid.has(uid);
|
|
1550
|
+
if (isAvailable)
|
|
1551
|
+
return uid;
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1328
1554
|
/** Admin user creation. Does NOT sign the user in (unlike
|
|
1329
1555
|
* `createUserWithEmailAndPassword`) — matches the emulator's
|
|
1330
1556
|
* add-user flow / admin SDK semantics. */
|
|
1331
1557
|
createUser(req) {
|
|
1332
|
-
const uid = req.uid ??
|
|
1558
|
+
const uid = req.uid ?? this.nextAvailableAdminUid();
|
|
1333
1559
|
if (this.usersByUid.has(uid)) {
|
|
1334
1560
|
throw makeAuthError('auth/uid-already-exists', `createUser: a user with uid ${uid} already exists.`);
|
|
1335
1561
|
}
|
|
@@ -1471,6 +1697,7 @@ export class SandboxBackend {
|
|
|
1471
1697
|
emailVerified: stored.emailVerified,
|
|
1472
1698
|
phoneNumber: stored.phoneNumber,
|
|
1473
1699
|
providers: stored.providerUserInfo,
|
|
1700
|
+
tenantId: stored.tenantId,
|
|
1474
1701
|
});
|
|
1475
1702
|
}
|
|
1476
1703
|
/** Mint a fresh anonymous user with an auto-generated uid. Records
|
|
@@ -1478,7 +1705,7 @@ export class SandboxBackend {
|
|
|
1478
1705
|
* the emulator) so `listIdentities` / future user-admin surfaces
|
|
1479
1706
|
* see anonymous accounts too. */
|
|
1480
1707
|
mintAnonymousUser() {
|
|
1481
|
-
const uid = `anonymous-${
|
|
1708
|
+
const uid = `anonymous-${globalThis.crypto.randomUUID()}`;
|
|
1482
1709
|
const record = this.makeStored({ uid, isAnonymous: true });
|
|
1483
1710
|
this.usersByUid.set(uid, record);
|
|
1484
1711
|
this.notifyUsersChanged();
|
|
@@ -1518,46 +1745,62 @@ export class SandboxBackend {
|
|
|
1518
1745
|
* authenticated session, same as real Firebase.
|
|
1519
1746
|
*/
|
|
1520
1747
|
mintDetachedSession(request) {
|
|
1748
|
+
const tenantId = request.tenantId ?? null;
|
|
1521
1749
|
switch (request.kind) {
|
|
1522
1750
|
case 'anonymous':
|
|
1523
1751
|
this.assertProviderEnabled('anonymous');
|
|
1524
|
-
return this.establishDetachedSession(this.mintAnonymousUser(), 'anonymous');
|
|
1752
|
+
return this.establishDetachedSession(this.mintAnonymousUser(), 'anonymous', tenantId);
|
|
1525
1753
|
case 'password':
|
|
1526
1754
|
this.assertProviderEnabled('password');
|
|
1527
|
-
return this.establishDetachedSession(this.buildUserFromStored(this.validatePassword(request.email, request.password)), 'password');
|
|
1755
|
+
return this.establishDetachedSession(this.buildUserFromStored(this.validatePassword(request.email, request.password)), 'password', tenantId);
|
|
1528
1756
|
case 'createPassword':
|
|
1529
1757
|
this.assertProviderEnabled('password');
|
|
1530
|
-
return this.establishDetachedSession(this.buildUserFromStored(this.createEmailPasswordUser(request.email, request.password)), 'password');
|
|
1758
|
+
return this.establishDetachedSession(this.buildUserFromStored(this.createEmailPasswordUser(request.email, request.password)), 'password', tenantId);
|
|
1759
|
+
case 'provider':
|
|
1760
|
+
case 'custom':
|
|
1531
1761
|
case 'uid': {
|
|
1762
|
+
const isProviderSignIn = request.kind === 'provider';
|
|
1763
|
+
if (isProviderSignIn)
|
|
1764
|
+
this.assertProviderEnabled(request.providerId);
|
|
1532
1765
|
// restoreSession semantics minus the global set: an EXISTING
|
|
1533
1766
|
// identity (per-tab session restore / provider-bridge accept).
|
|
1534
1767
|
const stored = this.usersByUid.get(request.uid);
|
|
1535
|
-
|
|
1768
|
+
const missingUser = stored === undefined;
|
|
1769
|
+
if (missingUser) {
|
|
1536
1770
|
throw makeAuthError('auth/user-not-found', `mintSession: no identity with uid ${request.uid}.`);
|
|
1537
1771
|
}
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1772
|
+
this.assertUserEnabled(stored);
|
|
1773
|
+
const isAnonymous = stored.isAnonymous;
|
|
1774
|
+
const restoredProvider = isAnonymous ? 'anonymous' : (stored.providerUserInfo[0]?.providerId ?? 'password');
|
|
1775
|
+
let providerId = isProviderSignIn ? request.providerId : restoredProvider;
|
|
1776
|
+
const isCustomSignIn = request.kind === 'custom';
|
|
1777
|
+
if (isCustomSignIn)
|
|
1778
|
+
providerId = 'custom';
|
|
1779
|
+
return this.establishDetachedSession(this.buildUserFromStored(stored), providerId, tenantId);
|
|
1545
1780
|
}
|
|
1546
1781
|
}
|
|
1547
1782
|
}
|
|
1548
1783
|
/** The shared sign-in bookkeeping behind {@link mintDetachedSession} —
|
|
1549
1784
|
* everything {@link setCurrentUser} does for a real sign-in EXCEPT the
|
|
1550
1785
|
* global-session parts. */
|
|
1551
|
-
establishDetachedSession(user, signInProvider) {
|
|
1786
|
+
establishDetachedSession(user, signInProvider, tenantId) {
|
|
1552
1787
|
this.signInProviderByUid.set(user.uid, signInProvider);
|
|
1553
1788
|
const stored = this.usersByUid.get(user.uid);
|
|
1554
1789
|
const claims = stored?.customClaims ?? {};
|
|
1555
|
-
|
|
1556
|
-
|
|
1790
|
+
const hasStoredUser = stored !== undefined;
|
|
1791
|
+
if (hasStoredUser) {
|
|
1792
|
+
stored.lastLoginAt = this.now().toISOString();
|
|
1557
1793
|
this.notifyUsersChanged();
|
|
1558
1794
|
}
|
|
1559
|
-
|
|
1560
|
-
|
|
1795
|
+
// The tenant rides on the session, not on the shared record: ports are
|
|
1796
|
+
// independent sessions over one user pool, so two ports can hold the same
|
|
1797
|
+
// identity under different tenants and neither may overwrite the other.
|
|
1798
|
+
user.tenantId = tenantId;
|
|
1799
|
+
const minted = this.mintToken(user.uid, claims, tenantId);
|
|
1800
|
+
const state = { uid: user.uid, token: rulesTokenClaims(claims, minted.result) };
|
|
1801
|
+
const hasTenant = tenantId !== null;
|
|
1802
|
+
if (hasTenant)
|
|
1803
|
+
state.tenant = tenantId;
|
|
1561
1804
|
this.emitAuthEvent('sign_in', {
|
|
1562
1805
|
path: user.uid,
|
|
1563
1806
|
auth: state,
|
|
@@ -1581,6 +1824,7 @@ export class SandboxBackend {
|
|
|
1581
1824
|
return this.buildUserFromStored({
|
|
1582
1825
|
...stored,
|
|
1583
1826
|
customClaims: state.token ?? stored.customClaims,
|
|
1827
|
+
tenantId: state.tenant ?? stored.tenantId,
|
|
1584
1828
|
});
|
|
1585
1829
|
}
|
|
1586
1830
|
return this.makeUser({
|
|
@@ -1589,6 +1833,7 @@ export class SandboxBackend {
|
|
|
1589
1833
|
displayName: null,
|
|
1590
1834
|
isAnonymous: state.uid.startsWith('anonymous-'),
|
|
1591
1835
|
claims: state.token ?? {},
|
|
1836
|
+
tenantId: state.tenant ?? null,
|
|
1592
1837
|
});
|
|
1593
1838
|
}
|
|
1594
1839
|
// ─── Token cache / refresh ──────────────────────────────────────────
|
|
@@ -1599,12 +1844,11 @@ export class SandboxBackend {
|
|
|
1599
1844
|
* refreshes inside the same millisecond still produce distinct
|
|
1600
1845
|
* token strings.
|
|
1601
1846
|
*/
|
|
1602
|
-
mintToken(uid, claims) {
|
|
1603
|
-
const issuedAt =
|
|
1847
|
+
mintToken(uid, claims, tenantId) {
|
|
1848
|
+
const issuedAt = this.now();
|
|
1604
1849
|
// 100 years out — sandbox tokens never expire.
|
|
1605
1850
|
const expires = new Date(issuedAt.getTime() + 100 * 365 * 24 * 60 * 60 * 1000);
|
|
1606
1851
|
const serial = this.nextTokenSerial++;
|
|
1607
|
-
const token = sandboxTokenFor(uid, claims, serial);
|
|
1608
1852
|
// The provider of the current sign-in session for this uid —
|
|
1609
1853
|
// recorded by setCurrentUser at sign-in time. Null for identities
|
|
1610
1854
|
// driven via the test driver (no prod analog for that path).
|
|
@@ -1623,15 +1867,23 @@ export class SandboxBackend {
|
|
|
1623
1867
|
// `firebase.sign_in_provider`.
|
|
1624
1868
|
firebase: { sign_in_provider: signInProvider },
|
|
1625
1869
|
};
|
|
1870
|
+
const identity = normalizeAuthState({ uid, tenant: tenantId ?? undefined, token: fullClaims });
|
|
1871
|
+
const tokenClaims = identity?.token ?? fullClaims;
|
|
1872
|
+
const sessionClaims = { ...claims, firebase: tokenClaims.firebase };
|
|
1873
|
+
const token = sandboxTokenFor(uid, sessionClaims, serial);
|
|
1626
1874
|
const result = {
|
|
1627
1875
|
token,
|
|
1628
|
-
claims:
|
|
1876
|
+
claims: tokenClaims,
|
|
1629
1877
|
expirationTime: expires.toISOString(),
|
|
1630
1878
|
issuedAtTime: issuedAt.toISOString(),
|
|
1631
1879
|
authTime: issuedAt.toISOString(),
|
|
1632
1880
|
signInProvider,
|
|
1633
1881
|
};
|
|
1634
|
-
|
|
1882
|
+
const entry = { token, result };
|
|
1883
|
+
const tokens = this.tokenCache.get(uid) ?? new Map();
|
|
1884
|
+
tokens.set(tenantId, entry);
|
|
1885
|
+
this.tokenCache.set(uid, tokens);
|
|
1886
|
+
return entry;
|
|
1635
1887
|
}
|
|
1636
1888
|
/**
|
|
1637
1889
|
* Get-or-mint the ID token entry for a uid. `forceRefresh: true`
|
|
@@ -1645,36 +1897,34 @@ export class SandboxBackend {
|
|
|
1645
1897
|
* - `auth-onidtokenchanged-force-refresh.json` — onIdTokenChanged
|
|
1646
1898
|
* fires after a forced refresh.
|
|
1647
1899
|
*/
|
|
1648
|
-
getIdTokenFor(uid, claims, forceRefresh) {
|
|
1649
|
-
|
|
1650
|
-
const fresh = this.mintToken(uid, claims);
|
|
1651
|
-
this.tokenCache.set(uid, fresh);
|
|
1652
|
-
// Fan out to onIdTokenChanged listeners only — identity is
|
|
1653
|
-
// unchanged, so onAuthStateChanged stays silent.
|
|
1654
|
-
this.fanOut('id-token');
|
|
1655
|
-
return fresh.token;
|
|
1656
|
-
}
|
|
1657
|
-
const cached = this.tokenCache.get(uid);
|
|
1658
|
-
if (cached)
|
|
1659
|
-
return cached.token;
|
|
1660
|
-
const fresh = this.mintToken(uid, claims);
|
|
1661
|
-
this.tokenCache.set(uid, fresh);
|
|
1662
|
-
return fresh.token;
|
|
1900
|
+
getIdTokenFor(uid, claims, forceRefresh, tenantId = null) {
|
|
1901
|
+
return this.getIdTokenResultFor(uid, claims, forceRefresh, tenantId).token;
|
|
1663
1902
|
}
|
|
1664
1903
|
/** {@link getIdTokenFor} variant returning the full IdTokenResult.
|
|
1665
1904
|
* Same cache + fan-out semantics. */
|
|
1666
|
-
getIdTokenResultFor(uid, claims, forceRefresh) {
|
|
1905
|
+
getIdTokenResultFor(uid, claims, forceRefresh, tenantId = null) {
|
|
1667
1906
|
if (forceRefresh) {
|
|
1668
|
-
const fresh = this.mintToken(uid, claims);
|
|
1669
|
-
this.
|
|
1907
|
+
const fresh = this.mintToken(uid, claims, tenantId);
|
|
1908
|
+
const current = this.session.currentUser;
|
|
1909
|
+
const refreshesCurrentUser = current !== null && current.uid === uid && (current.tenant ?? null) === tenantId;
|
|
1910
|
+
if (refreshesCurrentUser) {
|
|
1911
|
+
// Rules follow refreshed claims without turning a token refresh into a sign-in.
|
|
1912
|
+
this.applyingTransition = true;
|
|
1913
|
+
try {
|
|
1914
|
+
this.session.currentUser = { ...current, token: rulesTokenClaims(claims, fresh.result) };
|
|
1915
|
+
}
|
|
1916
|
+
finally {
|
|
1917
|
+
this.applyingTransition = false;
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1670
1920
|
this.fanOut('id-token');
|
|
1671
1921
|
return fresh.result;
|
|
1672
1922
|
}
|
|
1673
|
-
const cached = this.tokenCache.get(uid);
|
|
1674
|
-
|
|
1923
|
+
const cached = this.tokenCache.get(uid)?.get(tenantId);
|
|
1924
|
+
const hasCachedToken = cached !== undefined;
|
|
1925
|
+
if (hasCachedToken)
|
|
1675
1926
|
return cached.result;
|
|
1676
|
-
const fresh = this.mintToken(uid, claims);
|
|
1677
|
-
this.tokenCache.set(uid, fresh);
|
|
1927
|
+
const fresh = this.mintToken(uid, claims, tenantId);
|
|
1678
1928
|
return fresh.result;
|
|
1679
1929
|
}
|
|
1680
1930
|
/**
|
|
@@ -1707,7 +1957,8 @@ export class SandboxBackend {
|
|
|
1707
1957
|
// `unlink` of the last provider produces. Falling back on `[]` would
|
|
1708
1958
|
// resurrect the very provider the user just removed.
|
|
1709
1959
|
const linked = args.providers ?? [{ providerId: 'password' }];
|
|
1710
|
-
const
|
|
1960
|
+
const isAnonymous = args.isAnonymous === true;
|
|
1961
|
+
const providerData = isAnonymous
|
|
1711
1962
|
? []
|
|
1712
1963
|
: linked.map((p) => ({
|
|
1713
1964
|
uid: args.uid,
|
|
@@ -1725,6 +1976,7 @@ export class SandboxBackend {
|
|
|
1725
1976
|
photoURL,
|
|
1726
1977
|
phoneNumber,
|
|
1727
1978
|
isAnonymous: args.isAnonymous,
|
|
1979
|
+
tenantId: args.tenantId ?? null,
|
|
1728
1980
|
providerId,
|
|
1729
1981
|
providerData,
|
|
1730
1982
|
// Read LIVE claims by uid on each token call (not the claims frozen
|
|
@@ -1733,8 +1985,8 @@ export class SandboxBackend {
|
|
|
1733
1985
|
// `getIdToken(true)` (AUTH-B10) — same propagation story as prod.
|
|
1734
1986
|
// Falls back to the closed-over claims for users not in the DB
|
|
1735
1987
|
// (anonymous / popup), matching how they were minted.
|
|
1736
|
-
getIdToken: async (forceRefresh) => this.getIdTokenFor(args.uid, this.liveClaims(args.uid, args.claims), forceRefresh === true),
|
|
1737
|
-
getIdTokenResult: async (forceRefresh) => this.getIdTokenResultFor(args.uid, this.liveClaims(args.uid, args.claims), forceRefresh === true),
|
|
1988
|
+
getIdToken: async (forceRefresh) => this.getIdTokenFor(args.uid, this.liveClaims(args.uid, args.claims), forceRefresh === true, user.tenantId),
|
|
1989
|
+
getIdTokenResult: async (forceRefresh) => this.getIdTokenResultFor(args.uid, this.liveClaims(args.uid, args.claims), forceRefresh === true, user.tenantId),
|
|
1738
1990
|
};
|
|
1739
1991
|
// Stamp the backend-dispatch hook non-enumerably so the top-level
|
|
1740
1992
|
// `updateProfile(user, …)` free function can update THIS user (and the
|
|
@@ -1960,6 +2212,11 @@ export class SandboxBackend {
|
|
|
1960
2212
|
liveClaims(uid, fallback) {
|
|
1961
2213
|
return this.usersByUid.get(uid)?.customClaims ?? fallback;
|
|
1962
2214
|
}
|
|
2215
|
+
assertUserEnabled(user) {
|
|
2216
|
+
if (user.disabled) {
|
|
2217
|
+
throw makeAuthError('auth/user-disabled', 'The user account has been disabled by an administrator.');
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
1963
2220
|
/** Internal validator for email/password — checks the password
|
|
1964
2221
|
* matches the stored record. Throws `auth/invalid-email` on a
|
|
1965
2222
|
* malformed email, `auth/wrong-password` on mismatch,
|
|
@@ -1992,15 +2249,65 @@ export class SandboxBackend {
|
|
|
1992
2249
|
// exact prod ordering (disabled-vs-wrong-password) is flagged for
|
|
1993
2250
|
// an oracle capture; the code (`auth/user-disabled`) and message
|
|
1994
2251
|
// match prod's documented shape.
|
|
1995
|
-
|
|
1996
|
-
throw makeAuthError('auth/user-disabled', 'The user account has been disabled by an administrator.');
|
|
1997
|
-
}
|
|
2252
|
+
this.assertUserEnabled(stored);
|
|
1998
2253
|
if (stored.password !== password) {
|
|
1999
2254
|
throw makeAuthError('auth/wrong-password', 'Invalid password.');
|
|
2000
2255
|
}
|
|
2001
2256
|
return stored;
|
|
2002
2257
|
}
|
|
2003
2258
|
}
|
|
2259
|
+
/**
|
|
2260
|
+
* Apply a provider sign-in's photo to an already-stored identity, reporting
|
|
2261
|
+
* whether the record changed.
|
|
2262
|
+
*
|
|
2263
|
+
* A provider sign-in refreshes the provider profile data it actually carries.
|
|
2264
|
+
* An identity that carries no photo leaves the stored one alone rather than
|
|
2265
|
+
* blanking it, mirroring Firebase: a provider refresh updates the fields the
|
|
2266
|
+
* provider supplied and never clears one it omitted.
|
|
2267
|
+
*/
|
|
2268
|
+
/**
|
|
2269
|
+
* The provider a record is being created under: the provider a sign-in flow
|
|
2270
|
+
* names explicitly, otherwise the first provider already on the record. Null
|
|
2271
|
+
* when neither exists — an anonymous or provider-less record.
|
|
2272
|
+
*/
|
|
2273
|
+
function creationProviderId(record, signInProviderId) {
|
|
2274
|
+
if (signInProviderId !== null)
|
|
2275
|
+
return signInProviderId;
|
|
2276
|
+
const firstLinked = record.providerUserInfo[0];
|
|
2277
|
+
if (firstLinked === undefined)
|
|
2278
|
+
return null;
|
|
2279
|
+
return firstLinked.providerId;
|
|
2280
|
+
}
|
|
2281
|
+
/**
|
|
2282
|
+
* Whether a freshly built record gets a default photo.
|
|
2283
|
+
*
|
|
2284
|
+
* Firebase populates `photoURL` only for federated identities: a real Google
|
|
2285
|
+
* or GitHub sign-in always returns one, while `password`, `phone`, email-link,
|
|
2286
|
+
* and anonymous users return null in production. Federated provider ids are
|
|
2287
|
+
* exactly the dotted ones (`google.com`, `github.com`, `oidc.acme`,
|
|
2288
|
+
* `saml.corp`); the first-party ids never contain a dot. Defaulting everyone
|
|
2289
|
+
* would trade this divergence for a new one.
|
|
2290
|
+
*
|
|
2291
|
+
* A photo the caller supplied always wins — the mint only fills a record that
|
|
2292
|
+
* would otherwise be photo-less.
|
|
2293
|
+
*/
|
|
2294
|
+
function mintsDefaultPhoto(record, providerId) {
|
|
2295
|
+
if (record.photoUrl !== null)
|
|
2296
|
+
return false;
|
|
2297
|
+
if (record.isAnonymous)
|
|
2298
|
+
return false;
|
|
2299
|
+
if (providerId === null)
|
|
2300
|
+
return false;
|
|
2301
|
+
return providerId.includes('.');
|
|
2302
|
+
}
|
|
2303
|
+
function refreshStoredPhoto(stored, photoUrl) {
|
|
2304
|
+
if (photoUrl === null)
|
|
2305
|
+
return false;
|
|
2306
|
+
if (stored.photoUrl === photoUrl)
|
|
2307
|
+
return false;
|
|
2308
|
+
stored.photoUrl = photoUrl;
|
|
2309
|
+
return true;
|
|
2310
|
+
}
|
|
2004
2311
|
/** Provider UIDs are opaque Firebase identifiers, not encoded credentials. */
|
|
2005
2312
|
function mintProviderUid() {
|
|
2006
2313
|
return `provider-${globalThis.crypto.randomUUID()}`;
|