import type { SharedObject } from 'expo'; import type { LogRecord, Metric, MetricInput, SessionType } from './types'; /** * A live session recorded by App Metrics, backed by a native shared object. * * The scalar properties (`id`, `type`, `startDate`) are snapshots taken when the * object is created — they do not update as the session evolves. Properties that * can change over the session's lifetime (`isActive`, `getEndDate`) and the * heavier collections (`getMetrics`, `getLogs`) are fetched lazily so they * reflect live state on each call. * * @private This API is unstable and may change without notice. */ export declare class Session extends SharedObject { /** * Unique identifier (UUID) of the session. */ readonly id: string; /** * Kind of session. The per-launch session is `'main'`; a session tracking * foreground time is `'foreground'`. */ readonly type: SessionType; /** * ISO 8601 timestamp of when the session started. */ readonly startDate: string; /** * Fetches whether the session is still active. Read lazily so it reflects the * session's live state rather than a snapshot from when the object was * created. */ isActive(): Promise; /** * Fetches the ISO 8601 timestamp of when the session ended, or `null` while * it is still active. Read lazily so it reflects live state. */ getEndDate(): Promise; /** * Fetches the metrics recorded during this session from the on-device store. */ getMetrics(): Promise; /** * Fetches the log events recorded during this session from the on-device * store. */ getLogs(): Promise; /** * Records a custom metric against this session. The session id is implied by * the receiver, so the metric input carries no `sessionId`. */ addMetric(metric: MetricInput): Promise; }