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
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { UsageEvidence } from './usage-evidence.js';
|
|
2
|
+
import type { EventService } from '../types/operation.js';
|
|
3
|
+
import type { SdkActivityEvent, SdkActivityRecord } from './sdk-activity.js';
|
|
4
|
+
|
|
5
|
+
/** SDK adapters use `database`; sandbox operation records use `rtdb`. */
|
|
6
|
+
export function observationService(service: EventService | 'database'): EventService {
|
|
7
|
+
if (service === 'database') return 'rtdb';
|
|
8
|
+
return service;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Public SDK evidence only. No results, credentials, query values or DOM owners. */
|
|
12
|
+
export interface SdkObservation {
|
|
13
|
+
readonly ai?: SdkActivityRecord['ai'];
|
|
14
|
+
/** Numeric usage evidence; never the result payload. */
|
|
15
|
+
readonly usage?: UsageEvidence;
|
|
16
|
+
/** Journal-local delivery order, used to reject replay without retaining IDs. */
|
|
17
|
+
readonly sequence: number;
|
|
18
|
+
/** Unique within this journal session, including repeated listener deliveries. */
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly activityId: string;
|
|
21
|
+
readonly appId: string;
|
|
22
|
+
/** A retained source identity, not a permanent metric-series identifier. */
|
|
23
|
+
readonly sourceId: string;
|
|
24
|
+
readonly service: EventService;
|
|
25
|
+
readonly method: string;
|
|
26
|
+
readonly kind: SdkActivityRecord['kind'];
|
|
27
|
+
readonly status: SdkActivityRecord['status'];
|
|
28
|
+
/** `remove` releases retained state. It is never a call or delivery. */
|
|
29
|
+
readonly phase: Exclude<SdkActivityEvent['phase'], 'progress'>;
|
|
30
|
+
readonly deliveryNumber: number;
|
|
31
|
+
/** Wall-clock observation time for display. */
|
|
32
|
+
readonly at: number;
|
|
33
|
+
/** Monotonic observation time for rate windows, local to this realm. */
|
|
34
|
+
readonly monotonicAt: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function sdkObservation(
|
|
38
|
+
event: SdkActivityEvent,
|
|
39
|
+
at: number,
|
|
40
|
+
monotonicAt: number,
|
|
41
|
+
sequence: number,
|
|
42
|
+
): SdkObservation | undefined {
|
|
43
|
+
if (event.phase === 'progress' || (event.phase === 'transport' && !event.record.ai)) return undefined;
|
|
44
|
+
const { record, phase } = event;
|
|
45
|
+
return Object.freeze({
|
|
46
|
+
...(event.usage ? { usage: Object.freeze({ ...event.usage }) } : {}),
|
|
47
|
+
...(record.ai ? { ai: record.ai } : {}),
|
|
48
|
+
sequence,
|
|
49
|
+
id: `${record.id}/${phase}/${record.deliveryCount}`,
|
|
50
|
+
activityId: record.id,
|
|
51
|
+
appId: record.appId,
|
|
52
|
+
sourceId: record.sourceId,
|
|
53
|
+
service: observationService(record.service),
|
|
54
|
+
method: record.method,
|
|
55
|
+
kind: record.kind,
|
|
56
|
+
status: record.status,
|
|
57
|
+
phase,
|
|
58
|
+
deliveryNumber: record.deliveryCount,
|
|
59
|
+
at,
|
|
60
|
+
monotonicAt,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import type { UsageEvidence } from './usage-evidence.js';
|
|
2
|
+
import { sdkActivity, type SdkActivityRecord, type createSdkActivityJournal } from './sdk-activity.js';
|
|
3
|
+
import type { EventService } from '../types/operation.js';
|
|
4
|
+
import { observationService, type SdkObservation } from './sdk-observation.js';
|
|
5
|
+
import { sdkMethodCoverage, sdkUntrackedMethods, type SdkMethodCategory } from './sdk-coverage.js';
|
|
6
|
+
|
|
7
|
+
const RETAINED_SECONDS = 60;
|
|
8
|
+
const WINDOW_SECONDS = 5;
|
|
9
|
+
function ringSlot(second: number): number {
|
|
10
|
+
return ((second % RETAINED_SECONDS) + RETAINED_SECONDS) % RETAINED_SECONDS;
|
|
11
|
+
}
|
|
12
|
+
interface Bucket { second: number; calls: number; deliveries: number }
|
|
13
|
+
interface UsageBucket { aiCompleted: number; aiInputTokens: number; aiOutputTokens: number; aiEstimatedTokens: number; aiUnknownUsage: number; aiFailures: number; second: number; documentReads: number; documentWrites: number; documentDeletes: number; payloadBytes: number; uploadedBytes: number; downloadedBytes: number; unmeasured: number }
|
|
14
|
+
export interface ServiceUsageRate {
|
|
15
|
+
readonly aiCompleted?: number;
|
|
16
|
+
readonly aiInputTokens?: number;
|
|
17
|
+
readonly aiOutputTokens?: number;
|
|
18
|
+
readonly aiEstimatedTokens?: number;
|
|
19
|
+
readonly aiUnknownUsage?: number;
|
|
20
|
+
readonly aiFailures?: number;
|
|
21
|
+
|
|
22
|
+
readonly uploadedBytes?: number;
|
|
23
|
+
readonly downloadedBytes?: number;
|
|
24
|
+
readonly documentReads: number;
|
|
25
|
+
readonly documentWrites: number;
|
|
26
|
+
readonly documentDeletes: number;
|
|
27
|
+
readonly payloadBytes: number;
|
|
28
|
+
readonly unmeasured: number;
|
|
29
|
+
}
|
|
30
|
+
const usageKeys = ['aiCompleted', 'aiInputTokens', 'aiOutputTokens', 'aiEstimatedTokens', 'aiUnknownUsage', 'aiFailures', 'documentReads', 'documentWrites', 'documentDeletes', 'payloadBytes', 'uploadedBytes', 'downloadedBytes', 'unmeasured'] as const;
|
|
31
|
+
function emptyUsage(second: number): UsageBucket {
|
|
32
|
+
return { second, aiCompleted: 0, aiInputTokens: 0, aiOutputTokens: 0, aiEstimatedTokens: 0, aiUnknownUsage: 0, aiFailures: 0, documentReads: 0, documentWrites: 0, documentDeletes: 0, payloadBytes: 0, uploadedBytes: 0, downloadedBytes: 0, unmeasured: 0 };
|
|
33
|
+
}
|
|
34
|
+
interface Series {
|
|
35
|
+
service: EventService;
|
|
36
|
+
method: string;
|
|
37
|
+
category: SdkMethodCategory;
|
|
38
|
+
buckets: Bucket[];
|
|
39
|
+
activeListeners: number;
|
|
40
|
+
observed: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface SdkRateBucket {
|
|
43
|
+
readonly second: number;
|
|
44
|
+
readonly calls: number;
|
|
45
|
+
readonly deliveries: number;
|
|
46
|
+
}
|
|
47
|
+
export interface SdkMethodRate {
|
|
48
|
+
readonly method: string;
|
|
49
|
+
readonly category: SdkMethodCategory;
|
|
50
|
+
readonly callsPerSecond: number;
|
|
51
|
+
readonly deliveriesPerSecond: number;
|
|
52
|
+
readonly activeListeners: number;
|
|
53
|
+
readonly observed: boolean;
|
|
54
|
+
readonly buckets: readonly SdkRateBucket[];
|
|
55
|
+
}
|
|
56
|
+
export interface AiRequestObservation { readonly response?: SdkActivityRecord['response']; readonly id: string; readonly startedAt?: number; readonly startedSecond?: number; readonly at: number; readonly second: number; readonly method: string; readonly status: string; readonly detail: NonNullable<SdkActivityRecord['ai']> }
|
|
57
|
+
export interface SdkServiceRate {
|
|
58
|
+
readonly aiInProgress?: number;
|
|
59
|
+
readonly aiRequests?: readonly AiRequestObservation[];
|
|
60
|
+
readonly service: EventService;
|
|
61
|
+
readonly usage?: ServiceUsageRate;
|
|
62
|
+
readonly lastActivityAt?: number;
|
|
63
|
+
readonly usageBuckets?: readonly (ServiceUsageRate & { readonly second: number })[];
|
|
64
|
+
/** Latest activity window survives idle time; bounded to 60 one-second buckets. */
|
|
65
|
+
readonly history?: { readonly endSecond: number; readonly startedSecond: number; readonly methods: readonly SdkMethodRate[]; readonly usageBuckets?: readonly (ServiceUsageRate & { readonly second: number })[] };
|
|
66
|
+
/** Unsupported services have no methods or numeric totals to imply zero usage. */
|
|
67
|
+
readonly coverage: 'partial' | 'unsupported';
|
|
68
|
+
readonly untrackedMethods: readonly string[];
|
|
69
|
+
readonly observed: boolean;
|
|
70
|
+
readonly methods: readonly SdkMethodRate[];
|
|
71
|
+
}
|
|
72
|
+
export interface SdkRateSnapshot {
|
|
73
|
+
readonly monotonicAt: number;
|
|
74
|
+
readonly windowSeconds: number;
|
|
75
|
+
readonly services: readonly SdkServiceRate[];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* One accumulator per ordered journal observer stream. Sequence watermarks discard
|
|
80
|
+
* replay without retaining completed activities. Only live listener IDs are held.
|
|
81
|
+
* Fixed method coverage bounds series count; fixed rings bound event storage.
|
|
82
|
+
*/
|
|
83
|
+
export function createSdkRates(options: { monotonicNow?: () => number; activeListeners?: readonly SdkActivityRecord[] } = {}) {
|
|
84
|
+
const now = options.monotonicNow ?? (() => performance.now());
|
|
85
|
+
const series = new Map<string, Series>();
|
|
86
|
+
const startedSecond = Math.floor(now() / 1000);
|
|
87
|
+
const lastActivity = new Map<EventService, { second: number; at: number }>();
|
|
88
|
+
const active = new Map<string, Series>();
|
|
89
|
+
const usage = new Map<EventService, UsageBucket[]>();
|
|
90
|
+
function recordUsage(service: EventService, second: number, evidence: UsageEvidence): void {
|
|
91
|
+
let ring = usage.get(service);
|
|
92
|
+
if (!ring) { ring = Array.from({ length: RETAINED_SECONDS }, () => emptyUsage(-Infinity)); usage.set(service, ring); }
|
|
93
|
+
const slot = ringSlot(second);
|
|
94
|
+
if (ring[slot]!.second !== second) ring[slot] = emptyUsage(second);
|
|
95
|
+
for (const key of usageKeys) {
|
|
96
|
+
const value = evidence[key];
|
|
97
|
+
if (value !== undefined && Number.isFinite(value) && value >= 0) ring[slot]![key] += value;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const aiRequests: AiRequestObservation[] = [];
|
|
101
|
+
const aiActive = new Map<string, { at: number; second: number }>();
|
|
102
|
+
let sequence = 0;
|
|
103
|
+
for (const service of ['firestore', 'rtdb', 'storage', 'ai'] as const) {
|
|
104
|
+
for (const entry of sdkMethodCoverage(service)) {
|
|
105
|
+
series.set(`${service}/${entry.method}`, {
|
|
106
|
+
service, ...entry, observed: false, activeListeners: 0,
|
|
107
|
+
buckets: Array.from({ length: RETAINED_SECONDS }, () => ({ second: -Infinity, calls: 0, deliveries: 0 })),
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// A late subscriber can seed the live gauge without inventing historical calls.
|
|
112
|
+
for (const listener of options.activeListeners ?? []) {
|
|
113
|
+
if (listener.kind !== 'subscription' || listener.endedAt !== undefined) continue;
|
|
114
|
+
const service = observationService(listener.service);
|
|
115
|
+
const row = series.get(`${service}/${listener.method}`);
|
|
116
|
+
if (row && !active.has(listener.id)) {
|
|
117
|
+
active.set(listener.id, row);
|
|
118
|
+
++row.activeListeners;
|
|
119
|
+
row.observed = true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function record(event: SdkObservation, response?: SdkActivityRecord['response']): void {
|
|
123
|
+
if (event.sequence <= sequence) return;
|
|
124
|
+
sequence = event.sequence;
|
|
125
|
+
const row = series.get(`${event.service}/${event.method}`);
|
|
126
|
+
if (!row) return;
|
|
127
|
+
if (event.service === 'ai' && event.phase === 'start') aiActive.set(event.activityId, { at: event.at, second: Math.floor(event.monotonicAt / 1000) });
|
|
128
|
+
if (event.usage) {
|
|
129
|
+
recordUsage(event.service, Math.floor(event.monotonicAt / 1000), event.usage);
|
|
130
|
+
lastActivity.set(event.service, { second: Math.floor(event.monotonicAt / 1000), at: event.at });
|
|
131
|
+
}
|
|
132
|
+
if (event.ai && event.phase !== 'remove') {
|
|
133
|
+
const index = aiRequests.findIndex(request => request.id === event.activityId);
|
|
134
|
+
const previous = aiRequests[index];
|
|
135
|
+
const request = Object.freeze({ id: event.activityId, startedAt: previous?.startedAt ?? aiActive.get(event.activityId)?.at ?? event.at,
|
|
136
|
+
startedSecond: previous?.startedSecond ?? aiActive.get(event.activityId)?.second ?? Math.floor(event.monotonicAt / 1000),
|
|
137
|
+
at: event.at, second: Math.floor(event.monotonicAt / 1000), method: event.method, status: event.status, response, detail: event.ai });
|
|
138
|
+
if (index < 0) aiRequests.push(request); else aiRequests[index] = request;
|
|
139
|
+
if (aiRequests.length > 100) aiRequests.shift();
|
|
140
|
+
}
|
|
141
|
+
if (event.phase === 'transport') return;
|
|
142
|
+
if (event.phase === 'end' || event.phase === 'remove') {
|
|
143
|
+
aiActive.delete(event.activityId);
|
|
144
|
+
const listener = active.get(event.activityId);
|
|
145
|
+
if (listener) {
|
|
146
|
+
--listener.activeListeners;
|
|
147
|
+
active.delete(event.activityId);
|
|
148
|
+
}
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
row.observed = true;
|
|
152
|
+
const second = Math.floor(event.monotonicAt / 1000);
|
|
153
|
+
if ((event.phase === 'start' && row.category !== 'listener') || (event.phase === 'delivery' && row.category === 'listener')) {
|
|
154
|
+
lastActivity.set(event.service, { second, at: event.at });
|
|
155
|
+
}
|
|
156
|
+
const slot = ringSlot(second);
|
|
157
|
+
let bucket = row.buckets[slot]!;
|
|
158
|
+
if (bucket.second !== second) {
|
|
159
|
+
bucket = { second, calls: 0, deliveries: 0 };
|
|
160
|
+
row.buckets[slot] = bucket;
|
|
161
|
+
}
|
|
162
|
+
if (event.phase === 'start') {
|
|
163
|
+
++bucket.calls;
|
|
164
|
+
if (event.kind === 'subscription' && !active.has(event.activityId)) {
|
|
165
|
+
++row.activeListeners;
|
|
166
|
+
active.set(event.activityId, row);
|
|
167
|
+
}
|
|
168
|
+
} else if (event.phase === 'delivery') {
|
|
169
|
+
++bucket.deliveries;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function snapshot(): SdkRateSnapshot {
|
|
173
|
+
const monotonicAt = now();
|
|
174
|
+
const second = Math.floor(monotonicAt / 1000);
|
|
175
|
+
const services = (['firestore', 'rtdb', 'storage', 'ai'] as const).map(service => {
|
|
176
|
+
const methods = [...series.values()].filter(row => row.service === service).map(row => {
|
|
177
|
+
const buckets = Array.from({ length: RETAINED_SECONDS }, (_, index) => {
|
|
178
|
+
const stamp = second - RETAINED_SECONDS + 1 + index;
|
|
179
|
+
const slot = ringSlot(stamp);
|
|
180
|
+
const bucket = row.buckets[slot]!;
|
|
181
|
+
return Object.freeze({ second: stamp, calls: bucket.second === stamp ? bucket.calls : 0,
|
|
182
|
+
deliveries: bucket.second === stamp ? bucket.deliveries : 0 });
|
|
183
|
+
});
|
|
184
|
+
const recent = buckets.slice(-WINDOW_SECONDS);
|
|
185
|
+
return Object.freeze({ method: row.method, category: row.category,
|
|
186
|
+
callsPerSecond: recent.reduce((sum, bucket) => sum + bucket.calls, 0) / WINDOW_SECONDS,
|
|
187
|
+
deliveriesPerSecond: recent.reduce((sum, bucket) => sum + bucket.deliveries, 0) / WINDOW_SECONDS,
|
|
188
|
+
activeListeners: row.activeListeners, observed: row.observed, buckets: Object.freeze(buckets) });
|
|
189
|
+
});
|
|
190
|
+
const last = lastActivity.get(service);
|
|
191
|
+
const historyEnd = last ? Math.min(second, last.second + 2) : second;
|
|
192
|
+
const historyMethods = methods.map(method => {
|
|
193
|
+
const row = series.get(`${service}/${method.method}`)!;
|
|
194
|
+
const buckets = Array.from({ length: RETAINED_SECONDS }, (_, index) => {
|
|
195
|
+
const stamp = historyEnd - RETAINED_SECONDS + 1 + index;
|
|
196
|
+
const bucket = row.buckets[ringSlot(stamp)]!;
|
|
197
|
+
return Object.freeze({ second: stamp, calls: bucket.second === stamp ? bucket.calls : 0,
|
|
198
|
+
deliveries: bucket.second === stamp ? bucket.deliveries : 0 });
|
|
199
|
+
});
|
|
200
|
+
return Object.freeze({ ...method, buckets: Object.freeze(buckets) });
|
|
201
|
+
});
|
|
202
|
+
const usageWindow = (end: number) => Object.freeze(Array.from({ length: RETAINED_SECONDS }, (_, index) => {
|
|
203
|
+
const stamp = end - RETAINED_SECONDS + 1 + index;
|
|
204
|
+
const bucket = usage.get(service)?.[ringSlot(stamp)];
|
|
205
|
+
return Object.freeze(bucket?.second === stamp ? { ...bucket } : emptyUsage(stamp));
|
|
206
|
+
}));
|
|
207
|
+
const totals = emptyUsage(second);
|
|
208
|
+
for (const bucket of usage.get(service) ?? []) {
|
|
209
|
+
if (bucket.second <= second && bucket.second > second - WINDOW_SECONDS) {
|
|
210
|
+
for (const key of usageKeys) totals[key] += bucket[key];
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const measurement = Object.freeze({ ...(service === 'ai' ? { aiCompleted: totals.aiCompleted / WINDOW_SECONDS, aiInputTokens: totals.aiInputTokens / WINDOW_SECONDS, aiOutputTokens: totals.aiOutputTokens / WINDOW_SECONDS, aiEstimatedTokens: totals.aiEstimatedTokens / WINDOW_SECONDS, aiUnknownUsage: totals.aiUnknownUsage / WINDOW_SECONDS, aiFailures: totals.aiFailures / WINDOW_SECONDS } : {}), documentReads: totals.documentReads / WINDOW_SECONDS,
|
|
214
|
+
documentWrites: totals.documentWrites / WINDOW_SECONDS, documentDeletes: totals.documentDeletes / WINDOW_SECONDS,
|
|
215
|
+
payloadBytes: totals.payloadBytes / WINDOW_SECONDS, uploadedBytes: totals.uploadedBytes / WINDOW_SECONDS, downloadedBytes: totals.downloadedBytes / WINDOW_SECONDS, unmeasured: totals.unmeasured });
|
|
216
|
+
return Object.freeze({ service, ...(service === 'ai' ? { aiRequests: Object.freeze([...aiRequests]), aiInProgress: aiActive.size } : {}), usage: measurement, usageBuckets: usageWindow(second),
|
|
217
|
+
...(last ? { lastActivityAt: last.at } : {}),
|
|
218
|
+
history: Object.freeze({ endSecond: historyEnd, startedSecond, methods: Object.freeze(historyMethods), usageBuckets: usageWindow(historyEnd) }), coverage: methods.length ? 'partial' as const : 'unsupported' as const,
|
|
219
|
+
untrackedMethods: sdkUntrackedMethods(service),
|
|
220
|
+
observed: methods.some(method => method.observed), methods: Object.freeze(methods) });
|
|
221
|
+
});
|
|
222
|
+
return Object.freeze({ monotonicAt, windowSeconds: WINDOW_SECONDS, services: Object.freeze(services) });
|
|
223
|
+
}
|
|
224
|
+
return Object.freeze({ record, snapshot });
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** Install independently of any UI; disposing a view must not dispose its monitor. */
|
|
228
|
+
export function createSdkRateMonitor(
|
|
229
|
+
journal: ReturnType<typeof createSdkActivityJournal> = sdkActivity,
|
|
230
|
+
options: { monotonicNow?: () => number } = {},
|
|
231
|
+
) {
|
|
232
|
+
const rates = createSdkRates({ ...options, activeListeners: journal.records() });
|
|
233
|
+
const dispose = journal.observe(event => rates.record(event, event.ai ? journal.records().find(record => record.id === event.activityId)?.response : undefined));
|
|
234
|
+
return Object.freeze({ snapshot: rates.snapshot, dispose });
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Separate source/dist runtime bundles share one observer and one accumulation.
|
|
238
|
+
const RATES_KEY = Symbol.for('pyric.sdk-rates');
|
|
239
|
+
const globalStore = globalThis as { [RATES_KEY]?: ReturnType<typeof createSdkRateMonitor> };
|
|
240
|
+
export const sdkRates = globalStore[RATES_KEY] ?? (globalStore[RATES_KEY] = createSdkRateMonitor());
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { UsageEvidence } from './usage-evidence.js';
|
|
2
|
+
import type { SdkActivityHandle } from './sdk-activity.js';
|
|
3
|
+
|
|
4
|
+
/** A write acknowledgment is not a data delivery. Preserve the operation's error. */
|
|
5
|
+
export async function runSdkWrite<T>(activity: SdkActivityHandle, write: () => T | PromiseLike<T>, usage?: () => UsageEvidence): Promise<T> {
|
|
6
|
+
try {
|
|
7
|
+
const result = await write();
|
|
8
|
+
activity.complete(usage?.());
|
|
9
|
+
return result;
|
|
10
|
+
} catch (error) {
|
|
11
|
+
activity.fail();
|
|
12
|
+
throw error;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { SeedUser } from '../../auth/seed-user.js';
|
|
3
|
+
import type { StoredMetadata } from '../../storage/persistence.js';
|
|
4
|
+
|
|
5
|
+
// Keep every exported account field in the file codec. Extra fields are
|
|
6
|
+
// retained so reading a fixture does not silently discard its contents.
|
|
7
|
+
const userFields = {
|
|
8
|
+
uid: z.string(),
|
|
9
|
+
createdAt: z.string().optional(),
|
|
10
|
+
lastLoginAt: z.string().nullable().optional(),
|
|
11
|
+
email: z.string().optional(),
|
|
12
|
+
password: z.string().optional(),
|
|
13
|
+
displayName: z.string().optional(),
|
|
14
|
+
customClaims: z.record(z.unknown()).optional(),
|
|
15
|
+
photoUrl: z.string().optional(),
|
|
16
|
+
phoneNumber: z.string().optional(),
|
|
17
|
+
emailVerified: z.boolean().optional(),
|
|
18
|
+
disabled: z.boolean().optional(),
|
|
19
|
+
tenantId: z.string().optional(),
|
|
20
|
+
providerId: z.string().optional(),
|
|
21
|
+
providerUserInfo: z.array(z.object({ providerId: z.string() })).optional(),
|
|
22
|
+
} satisfies Record<keyof SeedUser, z.ZodType<unknown>>;
|
|
23
|
+
|
|
24
|
+
const storageMetadataFields = {
|
|
25
|
+
fullPath: z.string(),
|
|
26
|
+
name: z.string(),
|
|
27
|
+
bucket: z.string(),
|
|
28
|
+
generation: z.string(),
|
|
29
|
+
metageneration: z.string(),
|
|
30
|
+
timeCreated: z.string(),
|
|
31
|
+
updated: z.string(),
|
|
32
|
+
size: z.number().int().nonnegative(),
|
|
33
|
+
contentType: z.string().optional(),
|
|
34
|
+
cacheControl: z.string().optional(),
|
|
35
|
+
contentDisposition: z.string().optional(),
|
|
36
|
+
contentEncoding: z.string().optional(),
|
|
37
|
+
contentLanguage: z.string().optional(),
|
|
38
|
+
customMetadata: z.record(z.string()).optional(),
|
|
39
|
+
downloadTokens: z.string().optional(),
|
|
40
|
+
md5Hash: z.string().optional(),
|
|
41
|
+
} satisfies Record<keyof StoredMetadata, z.ZodType<unknown>>;
|
|
42
|
+
|
|
43
|
+
/** Shared account file shape used by checkpoints and host state. */
|
|
44
|
+
export const seedUserSchema = z.object(userFields).passthrough();
|
|
45
|
+
|
|
46
|
+
/** Complete stored object metadata shared by state readers. */
|
|
47
|
+
export const storedMetadataSchema = z.object(storageMetadataFields).passthrough();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { assertEncodedDocValueDepth, encodeDocValue, rehydrateEncodedDocValue, requireDocumentData,
|
|
2
|
+
type DocValueEncoding } from '../../firestore/internal/value-codec.js';
|
|
3
|
+
|
|
4
|
+
/** Preserve SDK values and escape ordinary marker-shaped maps before JSON removes their identity. */
|
|
5
|
+
export function encodeStateDocument(document: Record<string, unknown>): Record<string, unknown> {
|
|
6
|
+
return requireDocumentData(JSON.parse(JSON.stringify(encodeDocValue(document))));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Decode declared encodings, preserving literal maps in legacy full states. */
|
|
10
|
+
export function decodeStateDocument(
|
|
11
|
+
document: Record<string, unknown>,
|
|
12
|
+
encoding: DocValueEncoding | undefined,
|
|
13
|
+
): Record<string, unknown> {
|
|
14
|
+
const isLegacyState = encoding === undefined;
|
|
15
|
+
if (isLegacyState) {
|
|
16
|
+
assertEncodedDocValueDepth(document);
|
|
17
|
+
return structuredClone(document);
|
|
18
|
+
}
|
|
19
|
+
return requireDocumentData(rehydrateEncodedDocValue(document, encoding));
|
|
20
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { sdkActivity, type SdkActivityHandle } from './sdk-activity.js';
|
|
2
|
+
import type { UsageEvidence } from './usage-evidence.js';
|
|
3
|
+
|
|
4
|
+
interface StorageSource { readonly storage?: object; readonly port?: object; readonly bucket: string; readonly fullPath: string }
|
|
5
|
+
const tasks = new WeakMap<object, SdkActivityHandle>();
|
|
6
|
+
/** Called immediately before a real application observer; no payload is retained. */
|
|
7
|
+
export function storageTaskProgress(task: object): void { tasks.get(task)?.progress(); }
|
|
8
|
+
export function storageTaskResult(task: object): void {
|
|
9
|
+
const activity = tasks.get(task);
|
|
10
|
+
activity?.delivered(undefined, {});
|
|
11
|
+
// Each callback gets its own render window, but the result is counted once.
|
|
12
|
+
activity?.progress();
|
|
13
|
+
}
|
|
14
|
+
/** Preserve promises and UploadTask handles; observe completion without wrapping them. */
|
|
15
|
+
export function observeStorageOperation<S extends StorageSource, A extends unknown[], R extends PromiseLike<unknown>>(
|
|
16
|
+
method: string, operation: (ref: S, ...args: A) => R,
|
|
17
|
+
): (ref: S, ...args: A) => R {
|
|
18
|
+
return (ref, ...args) => {
|
|
19
|
+
const activity = sdkActivity.begin({ app: ref.storage ?? ref.port ?? ref, method, kind: 'operation',
|
|
20
|
+
source: { service: 'storage', target: `${ref.bucket}/${ref.fullPath}`, key: `storage:${ref.bucket}/${ref.fullPath}` } });
|
|
21
|
+
try {
|
|
22
|
+
const result = operation(ref, ...args);
|
|
23
|
+
if (method === 'uploadBytesResumable') tasks.set(result, activity);
|
|
24
|
+
void result.then(value => {
|
|
25
|
+
const usage: UsageEvidence = storageUsage(method, value);
|
|
26
|
+
// Results open a render window; byte usage is recorded once at its original boundary.
|
|
27
|
+
activity.delivered(undefined, method.startsWith('get') || method === 'listAll' ? usage : {});
|
|
28
|
+
if (method === 'uploadBytesResumable') activity.progress();
|
|
29
|
+
activity.complete(method.startsWith('get') || method === 'listAll' ? undefined : usage);
|
|
30
|
+
}, () => { activity.fail(); tasks.delete(result); });
|
|
31
|
+
return result;
|
|
32
|
+
} catch (error) { activity.fail(); throw error; }
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function storageUsage(method: string, value: unknown): UsageEvidence {
|
|
36
|
+
if (method === 'getBytes' && value instanceof ArrayBuffer) return { downloadedBytes: value.byteLength };
|
|
37
|
+
if (method === 'getBlob' && value && typeof value === 'object' && 'size' in value && typeof value.size === 'number') return { downloadedBytes: value.size };
|
|
38
|
+
if (method.startsWith('upload') && value && typeof value === 'object' && 'metadata' in value) {
|
|
39
|
+
const metadata = value.metadata as { size?: number };
|
|
40
|
+
if (typeof metadata.size === 'number') return { uploadedBytes: metadata.size };
|
|
41
|
+
}
|
|
42
|
+
return {};
|
|
43
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** Numeric evidence only. Never retain documents, tokens, or serialized payloads. */
|
|
2
|
+
export interface UsageEvidence {
|
|
3
|
+
readonly aiInputTokens?: number;
|
|
4
|
+
readonly aiOutputTokens?: number;
|
|
5
|
+
readonly aiEstimatedTokens?: number;
|
|
6
|
+
readonly aiUnknownUsage?: number;
|
|
7
|
+
readonly aiCompleted?: number;
|
|
8
|
+
readonly aiFailures?: number;
|
|
9
|
+
|
|
10
|
+
readonly uploadedBytes?: number;
|
|
11
|
+
readonly downloadedBytes?: number;
|
|
12
|
+
readonly documentReads?: number;
|
|
13
|
+
readonly documentWrites?: number;
|
|
14
|
+
readonly documentDeletes?: number;
|
|
15
|
+
readonly payloadBytes?: number;
|
|
16
|
+
readonly unmeasured?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ReadSnapshot {
|
|
20
|
+
readonly size?: number;
|
|
21
|
+
readonly docs?: readonly unknown[];
|
|
22
|
+
readonly metadata?: { fromCache?: boolean; hasPendingWrites?: boolean };
|
|
23
|
+
exists?: boolean | (() => boolean);
|
|
24
|
+
docChanges?: () => readonly { type: string }[];
|
|
25
|
+
val?: () => unknown;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Query removals cannot distinguish deletion from leaving a query here. */
|
|
29
|
+
export function firestoreReadUsage(value: unknown, listener = false, initial = true): UsageEvidence {
|
|
30
|
+
if (!value || typeof value !== 'object') return { unmeasured: 1 };
|
|
31
|
+
const snapshot = value as ReadSnapshot;
|
|
32
|
+
if (snapshot.metadata?.fromCache) return { documentReads: 0 };
|
|
33
|
+
if (Array.isArray(snapshot.docs)) {
|
|
34
|
+
if (!listener || initial) return { documentReads: Math.max(1, snapshot.docs.length) };
|
|
35
|
+
if (!snapshot.docChanges) return { unmeasured: 1 };
|
|
36
|
+
const changes = snapshot.docChanges();
|
|
37
|
+
return {
|
|
38
|
+
documentReads: changes.filter(change => change.type === 'added' || change.type === 'modified').length,
|
|
39
|
+
...(changes.some(change => change.type === 'removed') ? { unmeasured: 1 } : {}),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (snapshot.exists !== undefined) {
|
|
43
|
+
const exists = typeof snapshot.exists === 'function' ? snapshot.exists() : snapshot.exists;
|
|
44
|
+
return { documentReads: !listener || initial || exists ? 1 : 0 };
|
|
45
|
+
}
|
|
46
|
+
// Aggregation/index-entry scans have no document-result billing equivalent.
|
|
47
|
+
return { unmeasured: 1 };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Full callback JSON, not transport deltas, protocol overhead, or billed bytes. */
|
|
51
|
+
export function databaseReadUsage(value: unknown): UsageEvidence {
|
|
52
|
+
if (!value || typeof value !== 'object' || !('val' in value) || typeof value.val !== 'function') {
|
|
53
|
+
return { unmeasured: 1 };
|
|
54
|
+
}
|
|
55
|
+
const json = JSON.stringify(value.val());
|
|
56
|
+
return json === undefined ? { unmeasured: 1 } : { payloadBytes: new TextEncoder().encode(json).byteLength };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function firestoreWriteUsage(method: string): UsageEvidence | undefined {
|
|
60
|
+
if (['setDoc', 'updateDoc', 'addDoc'].includes(method)) return { documentWrites: 1 };
|
|
61
|
+
if (method === 'deleteDoc') return { documentDeletes: 1 };
|
|
62
|
+
if (method === 'writeBatch.commit' || method === 'runTransaction') return { unmeasured: 1 };
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Shared page/host accounting: synthetic and estimated tokens are never backend usage. */
|
|
67
|
+
export function aiCompletionUsage(detail: import('./ai-evidence.js').AiEvidence, method: string): UsageEvidence {
|
|
68
|
+
if (method === 'countTokens') return { aiCompleted: 1 };
|
|
69
|
+
const backend = detail.usageSource === 'backend';
|
|
70
|
+
const estimated = detail.usageSource === 'estimated' || detail.usageSource === 'scripted';
|
|
71
|
+
const incomplete = detail.inputTokens === undefined || detail.outputTokens === undefined || detail.usageSource === 'unknown';
|
|
72
|
+
return { aiCompleted: 1,
|
|
73
|
+
...(backend ? { aiInputTokens: detail.inputTokens, aiOutputTokens: detail.outputTokens } : {}),
|
|
74
|
+
...(estimated ? { aiEstimatedTokens: detail.totalTokens } : {}),
|
|
75
|
+
aiUnknownUsage: incomplete ? 1 : 0,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { observationPayload } from './internal/observation-payload.js';
|
|
1
2
|
/**
|
|
2
3
|
* Canonical operation records.
|
|
3
4
|
*
|
|
@@ -22,6 +23,7 @@ import type {
|
|
|
22
23
|
} from './types/events.js';
|
|
23
24
|
|
|
24
25
|
export interface OperationRecord {
|
|
26
|
+
readonly observation?: import('./types/request-observation.js').RequestObservation;
|
|
25
27
|
readonly id: string;
|
|
26
28
|
readonly at: number;
|
|
27
29
|
readonly eventKind: 'request' | 'operation' | 'listener';
|
|
@@ -32,6 +34,7 @@ export interface OperationRecord {
|
|
|
32
34
|
readonly result?: RequestEvent['result'] | SandboxOperationEvent['result'] | SandboxListenerEvent['result'];
|
|
33
35
|
readonly context: OperationContext;
|
|
34
36
|
readonly rules: RulesDisposition;
|
|
37
|
+
readonly queryProof?: RequestEvent['queryProof'];
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
type OperationEvent = (RequestEvent | SandboxOperationEvent | SandboxListenerEvent) & EventProvenance;
|
|
@@ -213,9 +216,31 @@ function immutableValue(value: unknown): unknown {
|
|
|
213
216
|
return value;
|
|
214
217
|
}
|
|
215
218
|
|
|
219
|
+
/** Auth changes have no rules seam; normalize their recorded outcome alongside data operations. */
|
|
220
|
+
export function trafficOperationEvent(event: SandboxEvent): OperationEvent | null {
|
|
221
|
+
if (isOperationEvent(event)) return event;
|
|
222
|
+
const isAuthChange = event.kind === 'service_mutation' && event.service === 'auth';
|
|
223
|
+
if (!isAuthChange) return null;
|
|
224
|
+
const safe = (value: unknown): unknown => {
|
|
225
|
+
const preview = observationPayload(value);
|
|
226
|
+
if (!preview || preview.truncated) return undefined;
|
|
227
|
+
return JSON.parse(preview.text);
|
|
228
|
+
};
|
|
229
|
+
return {
|
|
230
|
+
kind: 'operation', id: event.id, at: event.at, service: 'auth', method: event.op,
|
|
231
|
+
path: event.path, auth: event.auth, origin: 'user', result: 'not-applicable',
|
|
232
|
+
rulesDisposition: { kind: 'not-evaluated', reason: 'not-a-rules-operation' },
|
|
233
|
+
operationContext: operationContextFor(event),
|
|
234
|
+
detail: { transition: event.op, evidence: safe(event.detail) },
|
|
235
|
+
resourceBefore: event.before === undefined ? undefined : { data: safe(event.before), exists: true },
|
|
236
|
+
resourceAfter: event.after === undefined ? undefined : { data: safe(event.after), exists: true },
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
216
240
|
/** Project either traffic event family into the canonical record. */
|
|
217
|
-
export function toOperationRecord(
|
|
218
|
-
|
|
241
|
+
export function toOperationRecord(input: SandboxEvent): OperationRecord | null {
|
|
242
|
+
const event = trafficOperationEvent(input);
|
|
243
|
+
if (!event) return null;
|
|
219
244
|
let methodVal = 'listen';
|
|
220
245
|
let pathVal: string | undefined = undefined;
|
|
221
246
|
if (event.kind === 'request' || event.kind === 'operation') {
|
|
@@ -233,9 +258,14 @@ export function toOperationRecord(event: SandboxEvent): OperationRecord | null {
|
|
|
233
258
|
if (event.service !== undefined) {
|
|
234
259
|
serviceVal = event.service;
|
|
235
260
|
}
|
|
261
|
+
let queryProof: RequestEvent['queryProof'];
|
|
262
|
+
if ('queryProof' in event && event.queryProof) {
|
|
263
|
+
queryProof = immutableValue(event.queryProof) as RequestEvent['queryProof'];
|
|
264
|
+
}
|
|
236
265
|
return Object.freeze({
|
|
237
|
-
id: event.id,
|
|
238
|
-
at: event.at,
|
|
266
|
+
id: event.kind === 'operation' ? event.observation?.id ?? event.id : event.id,
|
|
267
|
+
at: event.kind === 'operation' ? event.observation?.startedAt ?? event.at : event.at,
|
|
268
|
+
...(event.kind === 'operation' && event.observation ? { observation: event.observation } : {}),
|
|
239
269
|
eventKind: event.kind,
|
|
240
270
|
service: serviceVal,
|
|
241
271
|
method: methodVal,
|
|
@@ -244,5 +274,78 @@ export function toOperationRecord(event: SandboxEvent): OperationRecord | null {
|
|
|
244
274
|
result: event.result,
|
|
245
275
|
context: operationContextFor(event),
|
|
246
276
|
rules: Object.freeze({ ...rulesDispositionFor(event) }),
|
|
277
|
+
queryProof,
|
|
247
278
|
});
|
|
248
279
|
}
|
|
280
|
+
|
|
281
|
+
/** The five phases a listener passes through, whatever variant carried it. */
|
|
282
|
+
export type ListenerPhase = 'attach' | 'detach' | 'delivery' | 'suppressed' | 'errored';
|
|
283
|
+
|
|
284
|
+
/** Which phase an event reports, or `null` when it is not listener lifecycle. */
|
|
285
|
+
function listenerPhaseOf(event: SandboxEvent): ListenerPhase | null {
|
|
286
|
+
if (event.kind === 'listener') return event.phase;
|
|
287
|
+
if (event.kind === 'listener_attach') return 'attach';
|
|
288
|
+
if (event.kind === 'listener_detach') return 'detach';
|
|
289
|
+
if (event.kind === 'listener_errored') return 'errored';
|
|
290
|
+
if (event.kind === 'snapshot_delivery') return 'delivery';
|
|
291
|
+
if (event.kind === 'snapshot_suppressed') return 'suppressed';
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/** Only an errored listener met Security Rules; the other phases never did. */
|
|
296
|
+
function listenerRulesDisposition(event: SandboxEvent, phase: ListenerPhase): RulesDisposition {
|
|
297
|
+
if (phase !== 'errored') return { kind: 'not-evaluated', reason: 'not-a-rules-operation' };
|
|
298
|
+
return rulesDispositionFor(event as OperationEvent);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** The listener-shaped fields every lifecycle variant carries. */
|
|
302
|
+
interface ListenerShape {
|
|
303
|
+
target: { kind: string; path?: string };
|
|
304
|
+
auth: AuthState;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Project one listener lifecycle event into the canonical record, with the
|
|
309
|
+
* phase as the record's `method`.
|
|
310
|
+
*
|
|
311
|
+
* Firestore reports lifecycle through its own `listener_attach` /
|
|
312
|
+
* `listener_detach` / `listener_errored` / `snapshot_delivery` /
|
|
313
|
+
* `snapshot_suppressed` variants; every other service reports it through the
|
|
314
|
+
* canonical `listener` variant. Both arrive here as the same five phases, so a
|
|
315
|
+
* caller paging listener activity never has to know which service produced it.
|
|
316
|
+
*
|
|
317
|
+
* Returns `null` for anything that is not listener lifecycle.
|
|
318
|
+
*/
|
|
319
|
+
export function toListenerRecord(event: SandboxEvent): OperationRecord | null {
|
|
320
|
+
const phase = listenerPhaseOf(event);
|
|
321
|
+
if (phase === null) return null;
|
|
322
|
+
const listener = event as unknown as ListenerShape;
|
|
323
|
+
|
|
324
|
+
let serviceVal: EventService = 'firestore';
|
|
325
|
+
if (event.service !== undefined) {
|
|
326
|
+
serviceVal = event.service;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
let resultVal: OperationRecord['result'] = undefined;
|
|
330
|
+
if (event.kind === 'listener' && event.result !== undefined) {
|
|
331
|
+
resultVal = event.result;
|
|
332
|
+
} else if (phase === 'errored') {
|
|
333
|
+
resultVal = 'deny';
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const record: {
|
|
337
|
+
-readonly [Key in keyof OperationRecord]: OperationRecord[Key];
|
|
338
|
+
} = {
|
|
339
|
+
id: event.id,
|
|
340
|
+
at: event.at,
|
|
341
|
+
eventKind: 'listener',
|
|
342
|
+
service: serviceVal,
|
|
343
|
+
method: phase,
|
|
344
|
+
auth: immutableAuthState(listener.auth),
|
|
345
|
+
result: resultVal,
|
|
346
|
+
context: operationContextFor(event),
|
|
347
|
+
rules: Object.freeze(listenerRulesDisposition(event, phase)),
|
|
348
|
+
};
|
|
349
|
+
if (listener.target.path !== undefined) record.path = listener.target.path;
|
|
350
|
+
return Object.freeze(record);
|
|
351
|
+
}
|