@altertable/data-app 0.79.0 → 0.80.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics-BU06BbS0.js","names":[],"sources":["../../src/core/operation.ts","../../src/core/uuid.ts","../../src/core/diagnostics.ts","../../src/core/actions.ts","../../src/core/logger.ts","../../src/core/widget-capture.ts","../../src/core/bridge.ts","../../src/core/bridge-endpoint.ts","../../src/core/presentation.ts","../../src/client/frame-sizing.ts","../../src/client/logger.ts","../../src/client/messages.ts","../../src/client/transport.ts","../../src/client/iframe.ts","../../src/client/diagnostics.ts"],"sourcesContent":["import { DataSourceError } from './contract.ts';\nimport { DimensionMembershipError } from './dimension-source.ts';\nimport type {\n DataOperations,\n DisclosedQuery,\n Lakehouse,\n SqlLakehouse,\n OperationContext,\n DataQueryBody,\n} from './operation-types.ts';\n\ntype Operation = DataOperations[string];\ntype OperationExecutionOptions = {\n operationName: string;\n lakehouse: Lakehouse;\n signal: AbortSignal;\n requestId: string;\n queryParams?: OperationContext['queryParams'];\n onQuery?: (name: string, error?: unknown) => void;\n};\n\n/** Shared operation execution. Adapters own authorization, delivery, and public errors. */\nexport async function executeDataOperation(\n operation: Operation,\n value: unknown,\n {\n operationName,\n lakehouse,\n signal: requestSignal,\n requestId,\n queryParams,\n onQuery,\n }: OperationExecutionOptions\n) {\n requestSignal.throwIfAborted();\n let input: unknown;\n try {\n input = operation.input(value);\n } catch {\n throw new OperationInputError();\n }\n\n const signal = AbortSignal.any([\n requestSignal,\n AbortSignal.timeout(operation.policy.maxDurationMs),\n ]);\n const execution = createOperationLakehouse(\n operation,\n lakehouse,\n signal,\n operationName,\n onQuery\n );\n try {\n const output = await runOperation(operation, input, {\n lakehouse: execution.lakehouse,\n signal,\n queryParams,\n });\n const body: DataQueryBody<unknown> = {\n data: output,\n requestId,\n queriedAt: new Date().toISOString(),\n queryIds: execution.queryIds,\n queries: execution.queries,\n };\n const serializedBody = JSON.stringify(body);\n const responseBytes = new TextEncoder().encode(serializedBody).byteLength;\n if (responseBytes > (operation.policy.maxResponseBytes ?? 1_000_000))\n throw new Error('Response exceeds byte limit.');\n\n return { body, serializedBody };\n } catch (error) {\n if (signal.aborted && !(error instanceof DataSourceError))\n throw new OperationTimeoutError();\n throw error;\n }\n}\n\n/** Query evidence follows statement invocation order; query IDs retain completion order. */\nfunction createOperationLakehouse(\n operation: Operation,\n source: Lakehouse,\n signal: AbortSignal,\n operationName: string,\n onQuery?: (name: string, error?: unknown) => void\n) {\n const queryIds: string[] = [];\n const queries: DisclosedQuery[] = [];\n const lakehouse: SqlLakehouse = {\n async queryAll(statement, options) {\n signal.throwIfAborted();\n if (!Number.isInteger(options.limit) || options.limit < 1)\n throw new Error('Query needs a positive row limit.');\n if (\n operation.queryNames &&\n !Object.values(operation.queryNames).includes(options.name ?? '')\n )\n throw new Error(\n `Query name is not registered for operation ${operationName}.`\n );\n const query: DisclosedQuery = {\n name: options.name ?? `Query ${queries.length + 1}`,\n statement,\n ...(options.params === undefined ? {} : { params: options.params }),\n };\n queries.push(query);\n const limit = Math.min(options.limit, operation.policy.maxQueryRows);\n const querySignal = AbortSignal.any([signal, options.signal]);\n let result;\n try {\n const queryOptions = {\n limit,\n ...(options.params === undefined ? {} : { params: options.params }),\n signal: querySignal,\n };\n if ('queryAllById' in source) {\n if (!options.name || !operation.queryNames)\n throw new Error('A registered query name is required.');\n result = await source.queryAllById(options.name, queryOptions);\n } else {\n result = await source.queryAll(statement, {\n ...queryOptions,\n ...(options.name === undefined ? {} : { name: options.name }),\n });\n }\n } catch (error) {\n if (!querySignal.aborted) onQuery?.(query.name, error);\n if (error instanceof DataSourceError) error.queryName = query.name;\n throw error;\n }\n onQuery?.(query.name);\n if (result.rows.length > limit)\n throw new Error('Result exceeds row limit.');\n if (result.queryId) {\n query.queryId = result.queryId;\n queryIds.push(result.queryId);\n }\n\n return result;\n },\n };\n\n return { lakehouse, queries, queryIds };\n}\n\n/** Settle cancellation even when operation code or its lakehouse ignores the signal. */\nasync function runOperation(\n operation: Operation,\n input: unknown,\n { lakehouse, signal, queryParams }: OperationContext\n) {\n let abort: (() => void) | undefined;\n try {\n signal.throwIfAborted();\n const cancelled = new Promise<never>((_, reject) => {\n function rejectAborted() {\n reject(new Error('Request aborted.'));\n }\n abort = rejectAborted;\n signal.addEventListener('abort', rejectAborted, { once: true });\n if (signal.aborted) rejectAborted();\n });\n\n return await Promise.race([\n cancelled,\n Promise.resolve().then(() => {\n signal.throwIfAborted();\n\n return operation.run(\n { lakehouse, signal, queryParams },\n input as never\n );\n }),\n ]);\n } finally {\n if (abort) signal.removeEventListener('abort', abort);\n }\n}\n\nclass OperationTimeoutError extends Error {}\n\nclass OperationInputError extends Error {}\n\nconst sourceErrorMessages = {\n unauthorized:\n 'This app could not authenticate its data connection. Contact the app owner.',\n forbidden:\n 'This app cannot access the requested data. Contact the app owner.',\n rate_limited: 'The lakehouse is busy. Wait a moment and retry.',\n query_rejected:\n \"A lakehouse query was rejected. Check the app's data operation.\",\n unavailable: 'The lakehouse is unavailable. Check the connection and retry.',\n};\n\nexport function toDataOperationFailure(error: unknown, aborted = false) {\n if (\n error instanceof OperationInputError ||\n error instanceof DimensionMembershipError\n )\n return {\n status: 400,\n code: 'invalid_input',\n message: \"Check this operation's inputs.\",\n };\n if (error instanceof DataSourceError)\n return {\n status: error.reason === 'rate_limited' ? 429 : 502,\n code: `source_${error.reason}`,\n message: sourceErrorMessages[error.reason],\n };\n const timedOut = aborted || error instanceof OperationTimeoutError;\n return {\n status: timedOut ? 504 : 502,\n code: timedOut ? 'timeout' : 'query_failed',\n message: timedOut\n ? 'The data request timed out.'\n : 'The data request failed.',\n };\n}\n","/** Opaque documents can lack randomUUID even when cryptographic randomness is available. */\nexport function randomUuid(): string {\n if (typeof crypto.randomUUID === 'function') return crypto.randomUUID();\n const bytes = crypto.getRandomValues(new Uint8Array(16));\n bytes[6] = (bytes[6]! & 15) | 64;\n bytes[8] = (bytes[8]! & 63) | 128;\n const hex = Array.from(bytes, byte => byte.toString(16).padStart(2, '0'));\n return [\n hex.slice(0, 4),\n hex.slice(4, 6),\n hex.slice(6, 8),\n hex.slice(8, 10),\n hex.slice(10),\n ]\n .map(part => part.join(''))\n .join('-');\n}\n","/** Failures observed during the checks and interactions actually exercised. */\nexport type AppFailure = {\n /** Mounted widget identity when multiple widgets share a label. */\n id?: string;\n kind: 'query' | 'operation' | 'render';\n name: string;\n message: string;\n /** Sanitized filename and one-based line/column. Source contents are never included. */\n source?: { file: string; line: number; column: number };\n};\nexport type AppDiagnosticReport = {\n /** Current observed failures, limited to 30 entries. */\n failures: AppFailure[];\n /** Observed checks that have not finished. */\n pending: number;\n /** Failures omitted from this report's bounded failure list. */\n truncated: number;\n};\n\n/** Omit query values, URL parameters and common credential forms from error text. */\nfunction diagnosticText(value: string, limit = 800) {\n const text = value\n .replace(/https?:\\/\\/[^\\s)]+/g, url => {\n try {\n const parsed = new URL(url);\n return `${parsed.origin}${parsed.pathname}`;\n } catch {\n return '[url]';\n }\n })\n .replace(\n /\\b((?:set-cookie|cookie|(?:x-)?api[-_]?key)\\s*[:=]\\s*)[^\\r\\n]*/gi,\n '$1[redacted]'\n )\n .replace(\n /\\b((?:proxy-)?authorization\\s*[:=]\\s*)(?:(?:bearer|basic)\\s+)?(?:\"[^\"\\n]*\"|'[^'\\n]*'|[^\\s,;]+)/gi,\n '$1[redacted]'\n )\n .replace(/\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}\\b/gi, '[email]')\n .replace(\n /\\b(bearer\\s+|(?:password|token|secret)\\s*[:=]\\s*)(?:\"[^\"\\n]*\"|'[^'\\n]*'|[^\\s,;]+)/gi,\n '$1[redacted]'\n )\n .replace(/\\b[\\w.-]+\\s*=\\s*[^\\s,;]+/g, '[parameter]')\n .replace(/(['\"`])[^\\n]*?\\1/g, '[value]');\n return text.length > limit ? `${text.slice(0, limit)}… [truncated]` : text;\n}\n\nexport function appFailure(\n kind: AppFailure['kind'],\n name: string,\n error: unknown\n): AppFailure {\n const source =\n error instanceof Error ? sourceLocation(error.stack) : undefined;\n\n return {\n kind,\n name: diagnosticText(name, 120),\n message: diagnosticText(\n error instanceof Error ? error.message : 'Unknown failure'\n ),\n ...(source ? { source } : {}),\n };\n}\n\nconst MAX_STACK_LENGTH = 16_384;\n\n/** Extract one location, excluding stack text, URL parameters and local directory paths. */\nfunction sourceLocation(stack?: string): AppFailure['source'] {\n // Inspect a bounded stack prefix; malformed frame tokens must not cause backtracking.\n const frames = stack?.slice(0, MAX_STACK_LENGTH).split('\\n').slice(1) ?? [];\n if (stack && stack.length > MAX_STACK_LENGTH) frames.pop();\n for (const frame of frames) {\n for (const token of frame.split(/[\\s()]+/)) {\n const columnSeparator = token.lastIndexOf(':');\n const lineSeparator = token.lastIndexOf(':', columnSeparator - 1);\n if (lineSeparator < 1 || columnSeparator <= lineSeparator) continue;\n const lineText = token.slice(lineSeparator + 1, columnSeparator);\n const columnText = token.slice(columnSeparator + 1);\n if (!/^\\d+$/.test(lineText) || !/^\\d+$/.test(columnText)) continue;\n const line = Number(lineText);\n const column = Number(columnText);\n if (\n !Number.isSafeInteger(line) ||\n line < 1 ||\n !Number.isSafeInteger(column) ||\n column < 1\n )\n continue;\n const file = token.slice(0, lineSeparator).split(/[/\\\\]/).at(-1)!;\n\n return { file: diagnosticText(file, 200), line, column };\n }\n }\n\n return undefined;\n}\nfunction parseSource(value: unknown): AppFailure['source'] {\n if (!value || typeof value !== 'object')\n throw new Error('Invalid source location');\n const source = value as NonNullable<AppFailure['source']>;\n if (\n typeof source.file !== 'string' ||\n !Number.isSafeInteger(source.line) ||\n source.line < 1 ||\n !Number.isSafeInteger(source.column) ||\n source.column < 1\n )\n throw new Error('Invalid source location');\n return {\n file: diagnosticText(\n source.file.split(/[?#]/, 1)[0]!.split(/[/\\\\]/).at(-1)!,\n 200\n ),\n line: source.line,\n column: source.column,\n };\n}\n\n/** Validate and project iframe reports. Unknown fields (including query inputs) never cross this boundary. */\nexport function parseAppDiagnosticReport(value: unknown): AppDiagnosticReport {\n if (!value || typeof value !== 'object')\n throw new Error('Invalid diagnostic report');\n const report = value as AppDiagnosticReport;\n if (\n !Array.isArray(report.failures) ||\n report.failures.length > 30 ||\n !Number.isSafeInteger(report.pending) ||\n report.pending < 0 ||\n !Number.isSafeInteger(report.truncated) ||\n report.truncated < 0\n )\n throw new Error('Invalid diagnostic report');\n return {\n failures: report.failures.map(failure => {\n if (\n !failure ||\n !['query', 'operation', 'render'].includes(failure.kind) ||\n typeof failure.name !== 'string' ||\n typeof failure.message !== 'string'\n )\n throw new Error('Invalid diagnostic failure');\n return {\n kind: failure.kind,\n ...(typeof failure.id === 'string'\n ? { id: diagnosticText(failure.id, 120) }\n : {}),\n name: diagnosticText(failure.name, 120),\n message: diagnosticText(failure.message),\n ...(failure.source ? { source: parseSource(failure.source) } : {}),\n };\n }),\n pending: report.pending,\n truncated: report.truncated,\n };\n}\n","import { isRecord } from './record.ts';\n\n/** Page actions an embedded app offers its host, replaced as a whole on every change.\n * An absent key means the app does not offer that action. */\nexport type DataAppActions = {\n /** Run `refresh`; while `refreshing`, run `cancelRefresh` if `cancellable`. */\n refresh?: { refreshing: boolean; cancellable: boolean };\n /** Run `exportCsv`. `tables` names the datasets an action's `table` may select. */\n exportCsv?: { enabled: boolean; tables: readonly string[] };\n /** Run `presentStory`; while `presenting`, run `closeStory`. */\n presentStory?: { enabled: boolean; presenting: boolean };\n /** Run `aboutData` to open the data inspector. */\n aboutData?: { enabled: boolean };\n};\n\n/** A host request to run an offered page action. The app ignores unavailable actions. */\nexport type DataAppAction =\n | { type: 'refresh' }\n | { type: 'cancelRefresh' }\n /** Omit `table` to export every dataset, as a ZIP when there are several. */\n | { type: 'exportCsv'; table?: string }\n | { type: 'presentStory' }\n | { type: 'closeStory' }\n | { type: 'aboutData' };\n\nconst MAX_TABLES = 64;\n\nexport function parseDataAppActions(value: unknown): DataAppActions {\n if (!isRecord(value)) throw new Error('Invalid actions.');\n const actions: DataAppActions = {};\n const { refresh, exportCsv } = value;\n if (refresh !== undefined) {\n if (\n !isRecord(refresh) ||\n typeof refresh.refreshing !== 'boolean' ||\n typeof refresh.cancellable !== 'boolean'\n )\n throw new Error('Invalid refresh action.');\n actions.refresh = {\n refreshing: refresh.refreshing,\n cancellable: refresh.cancellable,\n };\n }\n if (exportCsv !== undefined) {\n if (\n !isRecord(exportCsv) ||\n typeof exportCsv.enabled !== 'boolean' ||\n !Array.isArray(exportCsv.tables) ||\n exportCsv.tables.length > MAX_TABLES ||\n !exportCsv.tables.every(\n table => typeof table === 'string' && table.length <= 256\n )\n )\n throw new Error('Invalid export action.');\n actions.exportCsv = {\n enabled: exportCsv.enabled,\n tables: [...(exportCsv.tables as string[])],\n };\n }\n const { presentStory } = value;\n if (presentStory !== undefined) {\n if (\n !isRecord(presentStory) ||\n typeof presentStory.enabled !== 'boolean' ||\n typeof presentStory.presenting !== 'boolean'\n )\n throw new Error('Invalid story action.');\n actions.presentStory = {\n enabled: presentStory.enabled,\n presenting: presentStory.presenting,\n };\n }\n const { aboutData } = value;\n if (aboutData !== undefined) {\n if (!isRecord(aboutData) || typeof aboutData.enabled !== 'boolean')\n throw new Error('Invalid inspection action.');\n actions.aboutData = { enabled: aboutData.enabled };\n }\n return actions;\n}\n\nexport function parseDataAppAction(value: unknown): DataAppAction {\n if (!isRecord(value)) throw new Error('Invalid action.');\n switch (value.type) {\n case 'refresh':\n case 'cancelRefresh':\n case 'presentStory':\n case 'closeStory':\n case 'aboutData':\n return { type: value.type };\n case 'exportCsv':\n if (value.table !== undefined && typeof value.table !== 'string')\n throw new Error('Invalid export table.');\n return value.table === undefined\n ? { type: 'exportCsv' }\n : { type: 'exportCsv', table: value.table };\n default:\n throw new Error('Unknown action.');\n }\n}\n","/** Host-owned log sink; compatible with console and frontend createLogger(). */\nexport type DataAppLogger = {\n log: (...args: unknown[]) => void;\n info: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n};\n\nexport type LogEntry = {\n method: keyof DataAppLogger;\n args: unknown[];\n};\n\nexport function isLogEntry(value: unknown): value is LogEntry {\n if (!value || typeof value !== 'object') return false;\n const entry = value as Record<string, unknown>;\n return (\n (entry.method === 'log' ||\n entry.method === 'info' ||\n entry.method === 'warn' ||\n entry.method === 'error') &&\n Array.isArray(entry.args) &&\n entry.args.length <= 128\n );\n}\n","import { appUrlKeys } from './app-url-keys.ts';\nimport { isRecord } from './record.ts';\n\n/** The focused widget's state. Ready includes its fitted content height in CSS pixels. */\nexport type DataAppWidgetCaptureState =\n | { state: 'loading' | 'empty' | 'error'; widgetId: string }\n | { state: 'ready'; widgetId: string; height: number }\n | { state: 'invalid-target' };\n\nexport type WidgetCaptureRenderState =\n | Exclude<DataAppWidgetCaptureState, { state: 'ready' }>\n | { state: 'ready'; widgetId: string };\n\nexport function isWidgetId(id: string) {\n return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(id);\n}\n\n/** Returns undefined for normal navigation and null for an invalid widget link. */\nexport function readWidgetId(\n search: URLSearchParams\n): string | null | undefined {\n const [id, ...duplicates] = search.getAll(appUrlKeys.widget);\n if (id === undefined) return undefined;\n return duplicates.length === 0 && isWidgetId(id) ? id : null;\n}\n\nexport const reportWidgetCapture = Symbol.for('altertable.reportWidgetCapture');\n\n/** The host's capture request for this search, when the host state matches it. */\nexport function readWidgetCaptureRequest(state: unknown, search: string) {\n if (\n isRecord(state) &&\n typeof state.search === 'string' &&\n new URLSearchParams(state.search).toString() === search &&\n typeof state.widgetCaptureRequest === 'string'\n )\n return state.widgetCaptureRequest;\n return undefined;\n}\n","import { parseDataAppAction, parseDataAppActions } from './actions.ts';\nimport { isLogEntry } from './logger.ts';\nimport { isRecord } from './record.ts';\nimport {\n isWidgetId,\n type DataAppWidgetCaptureState,\n} from './widget-capture.ts';\n\n/** Data app delivery protocol. IDs identify a document, a shell session, and an individual call. */\nconst BRIDGE = 'altertable:data-app';\nexport const PARENT_PARAM = '__altertable_parent';\n/** Bound pending requests in the client and host independently.\n * The host enforces its own limit because frames can send messages directly. */\nexport const MAX_PENDING = 128;\nexport const REQUEST_TIMEOUT_MS = 60_000;\nexport { type TransportResponse } from './operation-types.ts';\n\nexport function validId(value: unknown): value is string {\n return typeof value === 'string' && /^[a-zA-Z0-9_-]{1,128}$/.test(value);\n}\n\ntype Fields = Record<string, unknown>;\nexport type BridgeRole = 'host' | 'app';\ntype SessionRule = 'none' | 'establish' | 'current';\n\nfunction event<\n const Wire extends string,\n const Role extends BridgeRole,\n const Session extends SessionRule,\n Payload,\n>({\n wire,\n from,\n session,\n parse,\n}: {\n wire: Wire;\n from: Role;\n session: Session;\n parse: (fields: Fields) => Payload;\n}) {\n return { wire, from, session, parse };\n}\n\nfunction id(fields: Fields) {\n if (!validId(fields.id)) throw new Error('Invalid request ID.');\n return fields.id;\n}\n\nfunction string(fields: Fields, key: string) {\n const value = fields[key];\n if (typeof value !== 'string') throw new Error(`Invalid ${key}.`);\n return value;\n}\n\nfunction length(fields: Fields, key: string) {\n const value = fields[key];\n if (typeof value !== 'number' || !Number.isFinite(value) || value < 0)\n throw new Error(`Invalid ${key}.`);\n return value;\n}\n\nfunction empty() {\n return {};\n}\n\n/** Parsers project known fields; opaque values are validated by their owning route or adapter. */\nexport const bridgeProtocol = {\n channel: BRIDGE,\n version: 1,\n events: {\n connect: event({\n wire: 'bridge:connect',\n from: 'host',\n session: 'none',\n parse: empty,\n }),\n ready: event({\n wire: 'bridge:ready',\n from: 'app',\n session: 'none',\n parse: empty,\n }),\n initialize: event({\n wire: 'bridge:initialize',\n from: 'host',\n session: 'establish',\n parse: fields => ({ state: fields.state }),\n }),\n request: event({\n wire: 'bridge:request',\n from: 'app',\n session: 'current',\n parse: fields => {\n const route = string(fields, 'route');\n if (!route || route.length > 256)\n throw new Error('Invalid message route.');\n return { id: id(fields), route, payload: fields.payload };\n },\n }),\n result: event({\n wire: 'bridge:result',\n from: 'host',\n session: 'current',\n parse: fields => {\n if (!Object.hasOwn(fields, 'response'))\n throw new Error('Missing response.');\n return { id: id(fields), response: fields.response };\n },\n }),\n error: event({\n wire: 'bridge:error',\n from: 'host',\n session: 'current',\n parse: fields => {\n if (\n fields.requestId !== undefined &&\n typeof fields.requestId !== 'string'\n )\n throw new Error('Invalid requestId.');\n return {\n id: id(fields),\n code: string(fields, 'code'),\n message: string(fields, 'message'),\n ...(fields.requestId === undefined\n ? {}\n : { requestId: fields.requestId }),\n };\n },\n }),\n cancel: event({\n wire: 'bridge:cancel',\n from: 'app',\n session: 'current',\n parse: fields => ({ id: id(fields) }),\n }),\n disconnect: event({\n wire: 'bridge:disconnect',\n from: 'app',\n session: 'current',\n parse: empty,\n }),\n scriptLoad: event({\n wire: 'script:load',\n from: 'host',\n session: 'current',\n parse: fields => ({ javascript: string(fields, 'javascript') }),\n }),\n stateUpdate: event({\n wire: 'state:update',\n from: 'host',\n session: 'current',\n parse: fields => ({ state: fields.state }),\n }),\n runtimeLog: event({\n wire: 'runtime:log',\n from: 'app',\n session: 'current',\n parse: fields => {\n if (!isLogEntry(fields.payload)) throw new Error('Invalid log entry.');\n return { payload: fields.payload };\n },\n }),\n runtimeReady: event({\n wire: 'runtime:ready',\n from: 'app',\n session: 'current',\n parse: empty,\n }),\n runtimeError: event({\n wire: 'runtime:error',\n from: 'app',\n session: 'current',\n parse: empty,\n }),\n /** Content height in CSS pixels; hosts apply it only to content-sized frames. */\n runtimeResize: event({\n wire: 'runtime:resize',\n from: 'app',\n session: 'current',\n parse: fields => ({ height: length(fields, 'height') }),\n }),\n widgetCapture: event({\n wire: 'widget:capture',\n from: 'app',\n session: 'current',\n parse(fields): {\n captureRequest: string;\n capture: DataAppWidgetCaptureState;\n } {\n const captureRequest = string(fields, 'captureRequest');\n if (!validId(captureRequest))\n throw new Error('Invalid capture request.');\n const capture = fields.capture;\n if (!isRecord(capture)) throw new Error('Invalid widget capture.');\n const state = string(capture, 'state');\n if (state === 'invalid-target')\n return { captureRequest, capture: { state } };\n const widgetId = string(capture, 'widgetId');\n if (!isWidgetId(widgetId)) throw new Error('Invalid widget ID.');\n if (state === 'ready') {\n const height = length(capture, 'height');\n if (height === 0 || !Number.isSafeInteger(height))\n throw new Error('Invalid capture height.');\n return { captureRequest, capture: { state, widgetId, height } };\n }\n if (state === 'loading' || state === 'empty' || state === 'error')\n return { captureRequest, capture: { state, widgetId } };\n throw new Error('Invalid widget capture state.');\n },\n }),\n /** The page actions the app currently offers; replaces the previous set. */\n actionsUpdate: event({\n wire: 'actions:update',\n from: 'app',\n session: 'current',\n parse: fields => ({ actions: parseDataAppActions(fields.actions) }),\n }),\n actionRun: event({\n wire: 'action:run',\n from: 'host',\n session: 'current',\n parse: fields => ({ action: parseDataAppAction(fields.action) }),\n }),\n /** CSS pixels of a content-sized frame hidden above and below the parent's visible area. */\n viewportUpdate: event({\n wire: 'viewport:update',\n from: 'host',\n session: 'current',\n parse: fields => ({\n top: length(fields, 'top'),\n bottom: length(fields, 'bottom'),\n }),\n }),\n },\n} as const;\n\ntype Events = typeof bridgeProtocol.events;\nexport type BridgeEventName = keyof Events;\nexport type BridgePayload<Name extends BridgeEventName> = ReturnType<\n Events[Name]['parse']\n>;\nexport type BridgeEnvelope = {\n channel: typeof BRIDGE;\n version: typeof bridgeProtocol.version;\n documentId: string;\n sessionId?: string;\n token?: string;\n};\nexport type BridgeEventMessage<Name extends BridgeEventName> =\n Name extends BridgeEventName\n ? BridgeEnvelope & {\n type: Events[Name]['wire'];\n } & (Events[Name]['session'] extends 'none'\n ? {}\n : { sessionId: string }) &\n BridgePayload<Name>\n : never;\nexport type BridgeMessage = {\n [Name in BridgeEventName]: BridgeEventMessage<Name>;\n}[BridgeEventName];\nexport type BridgeEventsFrom<Role extends BridgeRole> = {\n [Name in BridgeEventName]: Events[Name]['from'] extends Role ? Name : never;\n}[BridgeEventName];\nexport type BridgeHandlers<Role extends BridgeRole> = {\n [Name in BridgeEventsFrom<Role extends 'host' ? 'app' : 'host'>]: (\n message: BridgeEventMessage<Name>\n ) => void;\n};\n\n/** Delivery metadata safe to log on either side; never payloads or session credentials. */\nexport type BridgeMessageMetadata = {\n type: BridgeMessage['type'];\n id?: string;\n route?: string;\n operation?: string;\n error?: { code: string; message: string; requestId?: string };\n};\n\nexport function bridgeMessageMetadata(\n message: BridgeMessage\n): BridgeMessageMetadata {\n const metadata: BridgeMessageMetadata = { type: message.type };\n if ('id' in message) metadata.id = message.id;\n if (message.type === 'bridge:request') {\n metadata.route = message.route;\n const payload = message.payload;\n if (\n message.route === 'data:query' &&\n isRecord(payload) &&\n typeof payload.operation === 'string'\n )\n metadata.operation = payload.operation.slice(0, 256);\n }\n if (message.type === 'bridge:error')\n metadata.error = {\n code: message.code,\n message: message.message,\n ...(message.requestId === undefined\n ? {}\n : { requestId: message.requestId }),\n };\n return metadata;\n}\n\n/** Why a message from the connected peer was ignored. Messages from other windows are not reported. */\nexport type BridgeDropReason =\n | 'invalid_envelope'\n | 'token_mismatch'\n | 'unexpected_type'\n | 'session_mismatch'\n | 'invalid_payload';\n\nexport type BridgeDiagnostic =\n | ({ direction: 'send' | 'receive' } & BridgeMessageMetadata)\n | { direction: 'drop'; type?: string; reason: BridgeDropReason };\n\nconst byWire = new Map<string, BridgeEventName>();\nfor (const name of Object.keys(bridgeProtocol.events) as BridgeEventName[]) {\n const wire = bridgeProtocol.events[name].wire;\n if (byWire.has(wire)) throw new Error(`Duplicate bridge event: ${wire}`);\n byWire.set(wire, name);\n}\n\nexport function bridgeEventName(wire: string) {\n return byWire.get(wire);\n}\n\n/** Envelope parsing precedes authentication; event-specific fields remain untrusted. */\nexport function parseBridgeEnvelope(\n value: unknown\n): (BridgeEnvelope & Fields & { type: string }) | undefined {\n if (!value || typeof value !== 'object') return;\n const fields = value as Fields;\n if (\n fields.channel !== BRIDGE ||\n fields.version !== bridgeProtocol.version ||\n typeof fields.type !== 'string' ||\n typeof fields.documentId !== 'string' ||\n !fields.documentId ||\n fields.documentId.length > 128 ||\n (fields.sessionId !== undefined && !validId(fields.sessionId)) ||\n (fields.token !== undefined && typeof fields.token !== 'string')\n )\n return;\n return fields as BridgeEnvelope & Fields & { type: string };\n}\n\n/** Project event fields after the caller has checked envelope eligibility. */\nexport function parseBridgePayload(\n envelope: NonNullable<ReturnType<typeof parseBridgeEnvelope>>,\n definition: Events[BridgeEventName]\n): BridgeMessage | undefined {\n try {\n return {\n channel: BRIDGE,\n version: bridgeProtocol.version,\n documentId: envelope.documentId,\n ...(envelope.sessionId === undefined\n ? {}\n : { sessionId: envelope.sessionId }),\n ...(envelope.token === undefined ? {} : { token: envelope.token }),\n type: definition.wire,\n ...definition.parse(envelope),\n } as BridgeMessage;\n } catch {\n return;\n }\n}\n\nexport function parseBridgeMessage(value: unknown): BridgeMessage | undefined {\n const envelope = parseBridgeEnvelope(value);\n if (!envelope) return;\n const name = bridgeEventName(envelope.type);\n if (!name) return;\n const definition = bridgeProtocol.events[name];\n if (definition.session !== 'none' && envelope.sessionId === undefined) return;\n return parseBridgePayload(envelope, definition);\n}\n","import {\n bridgeProtocol,\n bridgeEventName,\n bridgeMessageMetadata,\n parseBridgeEnvelope,\n parseBridgeMessage,\n parseBridgePayload,\n validId,\n type BridgeDiagnostic,\n type BridgeDropReason,\n type BridgeMessage,\n type BridgeRole,\n type BridgeEventsFrom,\n type BridgePayload,\n type BridgeEnvelope,\n type BridgeHandlers,\n} from './bridge.ts';\nimport { isRecord } from './record.ts';\n\ntype ConnectionContext = Pick<BridgeEnvelope, 'sessionId' | 'token'> & {\n documentId?: string;\n};\n\n/** The connection owns IDs and token rotation; callers can only supply event payloads. */\nexport function createBridgeEndpoint<const Role extends BridgeRole>({\n role,\n origin,\n source,\n opaque,\n context,\n post,\n diagnostic,\n invalidRequest,\n handlers,\n}: {\n role: Role;\n handlers: BridgeHandlers<NoInfer<Role>>;\n origin: string;\n source: () => MessageEventSource | null;\n opaque: boolean;\n context: () => ConnectionContext;\n post: (message: BridgeMessage) => void;\n diagnostic?: (event: BridgeDiagnostic) => void;\n invalidRequest?: (id: string) => void;\n}) {\n let disposed = false;\n\n function drop(reason: BridgeDropReason, type: unknown) {\n diagnostic?.({\n direction: 'drop',\n reason,\n ...(typeof type === 'string' ? { type: type.slice(0, 64) } : {}),\n });\n }\n\n function send<\n Name extends BridgeEventsFrom<Role>,\n const Payload extends BridgePayload<NoInfer<Name>>,\n >(\n name: Name,\n payload: Payload &\n Record<Exclude<keyof Payload, keyof BridgePayload<NoInfer<Name>>>, never>\n ) {\n if (disposed) throw new Error('The bridge endpoint has closed.');\n const definition = bridgeProtocol.events[name];\n const current = context();\n const message = parseBridgeMessage({\n ...payload,\n channel: bridgeProtocol.channel,\n version: bridgeProtocol.version,\n type: definition.wire,\n documentId: name === 'connect' ? 'host' : current.documentId,\n sessionId: current.sessionId,\n token: opaque ? current.token : undefined,\n });\n if (!message || (opaque && !validId(current.token)))\n throw new Error('The bridge is not ready to send this event.');\n diagnostic?.({ direction: 'send', ...bridgeMessageMetadata(message) });\n if (disposed) return;\n post(message);\n }\n\n function receive(event: MessageEvent) {\n const peer = source();\n if (disposed || !peer || event.origin !== origin || event.source !== peer)\n return;\n const envelope = parseBridgeEnvelope(event.data);\n if (!envelope) {\n const data: unknown = event.data;\n if (isRecord(data) && data.channel === bridgeProtocol.channel)\n drop('invalid_envelope', 'type' in data ? data.type : undefined);\n return;\n }\n const current = context();\n // The app learns its opaque token from a trusted host connect message.\n const connecting =\n role === 'app' && envelope.type === bridgeProtocol.events.connect.wire;\n if (\n opaque &&\n (connecting\n ? !validId(envelope.token)\n : !current.token || envelope.token !== current.token)\n )\n return drop('token_mismatch', envelope.type);\n const name = bridgeEventName(envelope.type);\n if (!name) return drop('unexpected_type', envelope.type);\n const definition = bridgeProtocol.events[name];\n if (definition.from === role) return drop('unexpected_type', envelope.type);\n if (definition.session === 'establish') {\n if (\n envelope.documentId !== current.documentId ||\n envelope.sessionId === undefined\n )\n return drop('session_mismatch', envelope.type);\n } else if (definition.session === 'current') {\n if (\n !current.sessionId ||\n envelope.sessionId !== current.sessionId ||\n envelope.documentId !== current.documentId\n )\n return drop('session_mismatch', envelope.type);\n }\n const message = parseBridgePayload(envelope, definition);\n if (!message) {\n drop('invalid_payload', envelope.type);\n if (role === 'host' && name === 'request' && validId(envelope.id))\n invalidRequest?.(envelope.id);\n return;\n }\n diagnostic?.({ direction: 'receive', ...bridgeMessageMetadata(message) });\n if (disposed) return;\n // The catalog lookup correlates the key and parsed discriminated message.\n const handler = (handlers as Record<string, (message: unknown) => void>)[\n name\n ]!;\n handler(message);\n }\n\n return {\n send,\n receive,\n dispose() {\n disposed = true;\n },\n };\n}\n","import {\n isAnnotationPresentation,\n type DataAppAnnotationPresentation,\n} from './annotations.ts';\nimport { type Theme } from './appearance.ts';\n\n/** Presentation owned by the parent shell, delivered only over a trusted bridge. */\nexport type DataAppPresentation = {\n surface: 'embedded' | 'standalone';\n theme: Theme;\n annotations?: DataAppAnnotationPresentation;\n /** `frame` (default): the parent sizes the iframe and the app scrolls inside it.\n * `content`: the iframe follows the app's content height and the parent page scrolls. */\n sizing?: 'frame' | 'content';\n};\n\nexport function isDataAppPresentation(\n value: unknown\n): value is DataAppPresentation {\n if (!value || typeof value !== 'object') return false;\n const presentation = value as DataAppPresentation;\n\n return (\n (presentation.surface === 'embedded' ||\n presentation.surface === 'standalone') &&\n (presentation.theme === 'light' || presentation.theme === 'dark') &&\n (presentation.annotations === undefined ||\n isAnnotationPresentation(presentation.annotations)) &&\n (presentation.sizing === undefined ||\n presentation.sizing === 'frame' ||\n presentation.sizing === 'content')\n );\n}\n","import { isDataAppPresentation } from '../core/presentation.ts';\nimport { isRecord } from '../core/record.ts';\n\n/** Reports the document height to a parent that sizes the iframe to its content.\n * Sizing applies only while the parent requests it and a UI owner whose styles support it\n * has opted in, so older app styles under a newer bootstrap stay frame-sized.\n * The root attribute and inset properties let fixed overlays stay within the parent's visible area. */\nexport function createFrameSizing(\n document: Document,\n report: (height: number) => void,\n measured: (height: number, fitted: boolean) => void\n) {\n const root = document.documentElement;\n const frame = document.defaultView;\n let observer: ResizeObserver | undefined;\n let reported: number | undefined;\n let requested = false;\n let owners = 0;\n let viewport: { top: number; bottom: number } | undefined;\n\n function measure() {\n const height = Math.ceil(root.getBoundingClientRect().height);\n const fitted = height > 0 && height === frame?.innerHeight;\n // A matching viewport acknowledges convergence after the parent resized us.\n // Resend it even if the content did not change, so independent updates do\n // not accumulate as one feedback loop in the host.\n if (height !== reported || fitted) {\n reported = height;\n report(height);\n }\n measured(height, fitted);\n }\n\n function stop() {\n observer?.disconnect();\n observer = undefined;\n frame?.removeEventListener('resize', measure);\n reported = undefined;\n delete root.dataset.atblFrameSizing;\n root.style.removeProperty('--atbl-frame-inset-top');\n root.style.removeProperty('--atbl-frame-inset-bottom');\n }\n\n function applyViewport() {\n if (!observer || !viewport) return;\n root.style.setProperty('--atbl-frame-inset-top', `${viewport.top}px`);\n root.style.setProperty('--atbl-frame-inset-bottom', `${viewport.bottom}px`);\n }\n\n function sync() {\n if (!requested || !owners) return stop();\n if (observer) return;\n root.dataset.atblFrameSizing = 'content';\n observer = new (document.defaultView ?? globalThis).ResizeObserver(measure);\n observer.observe(root);\n frame?.addEventListener('resize', measure);\n applyViewport();\n }\n\n return {\n measure() {\n if (!observer) return false;\n measure();\n return true;\n },\n /** A new session starts with a parent that has not received the current height. */\n update(state: unknown, session: 'new' | 'current') {\n const presentation = isRecord(state) ? state.presentation : undefined;\n requested =\n isDataAppPresentation(presentation) &&\n presentation.sizing === 'content';\n if (!requested) viewport = undefined;\n if (session === 'new') reported = undefined;\n if (observer && requested) measure();\n sync();\n },\n support() {\n owners++;\n sync();\n let released = false;\n\n return () => {\n if (released) return;\n released = true;\n owners--;\n sync();\n };\n },\n viewport(top: number, bottom: number) {\n if (!requested) return;\n viewport = { top, bottom };\n applyViewport();\n },\n dispose() {\n requested = false;\n viewport = undefined;\n owners = 0;\n stop();\n },\n };\n}\n","import { type BridgeDiagnostic } from '../core/bridge.ts';\nimport { type DataAppLogger, type LogEntry } from '../core/logger.ts';\n\n/** Lazy arguments run in the iframe; only resolved values cross the bridge. */\nexport function createBridgeLogger(\n enabled: () => boolean,\n send: (entry: LogEntry) => void\n): DataAppLogger {\n function resolve(args: unknown[]): unknown[] {\n if (args.length === 1 && typeof args[0] === 'function') {\n const value: unknown = args[0]();\n return Array.isArray(value) ? value : [value];\n }\n return args.map(arg => (typeof arg === 'function' ? arg() : arg));\n }\n\n function write(method: keyof DataAppLogger, args: unknown[]) {\n if (!enabled()) return;\n try {\n send({ method, args: resolve(args) });\n } catch {\n // Logging must not interrupt the app or recursively log delivery failures.\n }\n }\n\n return {\n log: (...args) => write('log', args),\n info: (...args) => write('info', args),\n warn: (...args) => write('warn', args),\n error: (...args) => write('error', args),\n };\n}\n\nconst diagnosticLabels = {\n send: 'Sending message to parent',\n receive: 'Received message from parent',\n drop: 'Ignored message from parent',\n} as const;\n\n/** Log only delivery metadata; payloads and session credentials stay private. */\nexport function logBridgeDiagnostic(\n logger: DataAppLogger,\n { direction, ...metadata }: BridgeDiagnostic\n) {\n // Log delivery and per-frame sizing messages would flood the host logger.\n if (\n metadata.type === 'runtime:log' ||\n metadata.type === 'runtime:resize' ||\n metadata.type === 'viewport:update'\n )\n return;\n logger.log(diagnosticLabels[direction], metadata);\n}\n\n/** Error instances do not survive every logger, so only their text crosses the bridge. */\nexport function describeError(error: unknown) {\n if (error instanceof Error)\n return {\n name: error.name,\n message: error.message,\n ...(error.stack ? { stack: error.stack } : {}),\n };\n return { message: String(error) };\n}\n","import {\n MessageRoutingError,\n type MessageInput,\n type MessageOutput,\n type MessageRoutes,\n type MessageTransport,\n} from '../core/messages.ts';\n\n/** Both ends validate using the same contracts; the transport owns delivery and cancellation. */\nexport function createMessageClient<const Routes extends MessageRoutes>(\n routes: Routes,\n transport: MessageTransport\n) {\n return {\n async request<\n Name extends keyof Routes & string,\n const Input extends MessageInput<NoInfer<Routes[Name]>>,\n >(\n route: Name,\n payload: Input,\n { signal }: { signal?: AbortSignal } = {}\n ): Promise<MessageOutput<Routes[Name], Input>> {\n signal?.throwIfAborted();\n if (!Object.hasOwn(routes, route))\n throw new MessageRoutingError(\n 'unknown_route',\n 'Unknown message route.'\n );\n const contract = routes[route]!;\n let input: unknown;\n try {\n input = contract.input(payload);\n } catch {\n throw new MessageRoutingError(\n 'invalid_payload',\n 'Invalid message payload.'\n );\n }\n const response = await transport({ route, payload: input }, signal);\n signal?.throwIfAborted();\n try {\n return contract.output(response, input as never) as MessageOutput<\n Routes[Name],\n Input\n >;\n } catch (error) {\n if (error instanceof MessageRoutingError) throw error;\n throw new MessageRoutingError(\n 'invalid_response',\n 'Invalid message response.'\n );\n }\n },\n };\n}\n","// A bootstrap and its app may bundle independent copies in the same window.\nconst errorBrand = Symbol.for('@altertable/data-app/DataAppError');\n\nexport class DataAppError extends Error {\n readonly [errorBrand] = true;\n\n static override [Symbol.hasInstance](value: unknown): boolean {\n return (\n value instanceof Error &&\n (value as { [errorBrand]?: unknown })[errorBrand] === true\n );\n }\n\n constructor(\n message: string,\n public readonly code: string,\n public readonly requestId?: string\n ) {\n super(message);\n this.name = 'DataAppError';\n }\n}\n","import { type DataAppAction, type DataAppActions } from '../core/actions.ts';\nimport { createBridgeEndpoint } from '../core/bridge-endpoint.ts';\nimport {\n PARENT_PARAM,\n MAX_PENDING,\n REQUEST_TIMEOUT_MS,\n} from '../core/bridge.ts';\nimport { type HostedLakehouse } from '../core/contract.ts';\nimport {\n registeredQueryRoute,\n MessageRoutingError,\n type RoutedMessage,\n} from '../core/messages.ts';\nimport { isRecord } from '../core/record.ts';\nimport { randomUuid } from '../core/uuid.ts';\nimport {\n reportWidgetCapture,\n type DataAppWidgetCaptureState,\n type WidgetCaptureRenderState,\n} from '../core/widget-capture.ts';\nimport { appDiagnostics } from './diagnostics.ts';\nimport { createFrameSizing } from './frame-sizing.ts';\nimport {\n createBridgeLogger,\n describeError,\n logBridgeDiagnostic,\n} from './logger.ts';\nimport { createMessageClient } from './messages.ts';\nimport { DataAppError } from './transport.ts';\n\ntype Pending = {\n start: () => void;\n reject: (error: unknown) => void;\n resolve: (value: unknown) => void;\n};\n\n/** Data clients expose one error type for HTTP and message delivery. */\nfunction rethrowDataMessageError(error: unknown): never {\n if (error instanceof MessageRoutingError)\n throw new DataAppError(error.message, error.code, error.requestId);\n throw error;\n}\n\n/** One bridge per document, shared by all clients and retained across module hot replacement. */\nexport function createIframeTransport({\n parentOrigin,\n window: frame = window,\n timeoutMs = REQUEST_TIMEOUT_MS,\n mode = 'url',\n loadScript,\n}: {\n parentOrigin: string;\n window?: Window;\n timeoutMs?: number;\n mode?: 'url' | 'bundle';\n loadScript?: (javascript: string) => void;\n}) {\n if (new URL(parentOrigin).origin !== parentOrigin)\n throw new Error('Expected an exact parent origin.');\n const documentId = randomUuid();\n let token: string | undefined;\n let sessionId: string | undefined;\n let disposed = false;\n const pending = new Map<string, Pending>();\n let hostState: unknown;\n let diagnosticsWaiting = false;\n let diagnosticTimer: ReturnType<typeof setTimeout> | undefined;\n const unsubscribeDiagnostics = appDiagnostics.subscribe(scheduleDiagnostics);\n function scheduleDiagnostics() {\n clearTimeout(diagnosticTimer);\n diagnosticTimer = setTimeout(() => {\n if (\n !hostState ||\n typeof hostState !== 'object' ||\n !('repair' in hostState) ||\n typeof hostState.repair !== 'string'\n )\n return;\n if (pending.size >= MAX_PENDING) {\n diagnosticsWaiting = true;\n return;\n }\n diagnosticsWaiting = false;\n if (!disposed && sessionId)\n void requestMessage({\n route: 'diagnostics:report',\n payload: appDiagnostics.snapshot(),\n }).catch(() => {});\n }, 150);\n }\n const stateListeners = new Set<(state: unknown) => void>();\n // The page actions last offered to the host, compared by value.\n let actions: DataAppActions = {};\n let actionsIdentity = '{}';\n const actionListeners = new Set<(action: DataAppAction) => void>();\n const logger = createBridgeLogger(\n () =>\n !disposed &&\n !!sessionId &&\n isRecord(hostState) &&\n hostState.logging === true,\n entry => send('runtimeLog', { payload: entry })\n );\n\n const endpoint = createBridgeEndpoint({\n role: 'app',\n origin: parentOrigin,\n source: () => frame.parent,\n opaque: mode === 'bundle',\n context: () => ({ documentId, sessionId, token }),\n post(message) {\n frame.parent.postMessage(message, parentOrigin);\n },\n diagnostic: event => logBridgeDiagnostic(logger, event),\n handlers: {\n connect(message) {\n if (mode === 'bundle') token = message.token;\n send('ready', {});\n },\n initialize(message) {\n if (sessionId && sessionId !== message.sessionId) {\n if (pending.size)\n logger.warn('Preview reconnected; rejecting pending requests', {\n count: pending.size,\n });\n for (const entry of pending.values())\n entry.reject(\n new DataAppError(\n 'The preview reconnected. Retry the request.',\n 'bridge_reset'\n )\n );\n }\n const first = !sessionId;\n sessionId = message.sessionId;\n receiveState(message.state, 'new');\n if (first) for (const entry of pending.values()) entry.start();\n if (disposed) return;\n if (actionsIdentity !== '{}') send('actionsUpdate', { actions });\n if (mode === 'url') send('runtimeReady', {});\n },\n stateUpdate(message) {\n receiveState(message.state, 'current');\n },\n actionRun(message) {\n for (const listener of actionListeners) listener(message.action);\n },\n viewportUpdate(message) {\n frameSizing.viewport(message.top, message.bottom);\n },\n scriptLoad(message) {\n if (mode === 'bundle') loadScript?.(message.javascript);\n },\n result(message) {\n pending.get(message.id)?.resolve(message.response);\n },\n error(message) {\n pending\n .get(message.id)\n ?.reject(\n new MessageRoutingError(\n message.code,\n message.message,\n message.requestId\n )\n );\n },\n },\n });\n const send = endpoint.send;\n const receive = endpoint.receive;\n /** The focused widget's latest render state for the host's capture request. */\n let capture:\n | { request: string; render: WidgetCaptureRenderState }\n | undefined;\n /** Identity of the last report sent, so repeated renders do not resend it. */\n let sentCapture: string | undefined;\n\n function publishCapture(request: string, state: DataAppWidgetCaptureState) {\n if (\n disposed ||\n !sessionId ||\n !isRecord(hostState) ||\n hostState.widgetCaptureRequest !== request\n )\n return;\n const identity = JSON.stringify([request, state]);\n if (identity === sentCapture) return;\n sentCapture = identity;\n send('widgetCapture', { captureRequest: request, capture: state });\n }\n\n const frameSizing = createFrameSizing(\n frame.document,\n height => {\n if (!disposed && sessionId) send('runtimeResize', { height });\n },\n (height, fitted) => {\n if (capture?.render.state !== 'ready') return;\n const { widgetId } = capture.render;\n publishCapture(\n capture.request,\n fitted\n ? { state: 'ready', widgetId, height }\n : { state: 'loading', widgetId }\n );\n }\n );\n\n function receiveState(state: unknown, session: 'new' | 'current') {\n if (session === 'new') {\n sentCapture = undefined;\n scheduleDiagnostics();\n }\n hostState = state;\n frameSizing.update(state, session);\n for (const listener of stateListeners) listener(state);\n }\n\n frame.addEventListener('message', receive);\n\n function requestMessage(\n message: RoutedMessage,\n signal?: AbortSignal\n ): Promise<unknown> {\n return new Promise((resolve, reject) => {\n if (disposed)\n return reject(\n new DataAppError('The preview has closed.', 'bridge_closed')\n );\n if (signal?.aborted) return reject(signal.reason);\n if (pending.size >= MAX_PENDING)\n return reject(\n new DataAppError('Too many pending data requests.', 'bridge_busy')\n );\n const id = randomUuid();\n let sent = false;\n\n function cleanup() {\n clearTimeout(timer);\n signal?.removeEventListener('abort', abort);\n pending.delete(id);\n if (diagnosticsWaiting) scheduleDiagnostics();\n }\n\n function abort() {\n if (sent) send('cancel', { id });\n cleanup();\n reject(signal?.reason);\n }\n\n const timer = setTimeout(() => {\n logger.warn('Message request timed out', {\n id,\n route: message.route,\n timeoutMs,\n sent,\n });\n if (sent) send('cancel', { id });\n cleanup();\n reject(\n new DataAppError(\n sessionId\n ? 'The data request timed out.'\n : 'The preview shell is unavailable. Reload the preview.',\n sessionId ? 'timeout' : 'bridge_unavailable'\n )\n );\n }, timeoutMs);\n const entry: Pending = {\n start() {\n if (sent) return;\n try {\n send('request', {\n id,\n route: message.route,\n payload: message.payload,\n });\n sent = true;\n } catch {\n cleanup();\n reject(\n new DataAppError(\n 'The message payload could not be sent.',\n 'invalid_payload'\n )\n );\n }\n },\n resolve(value) {\n cleanup();\n resolve(value);\n },\n reject(error) {\n cleanup();\n reject(error);\n },\n };\n pending.set(id, entry);\n signal?.addEventListener('abort', abort, { once: true });\n if (sessionId) entry.start();\n else if (mode === 'url' || token) send('ready', {});\n });\n }\n\n const messages = createMessageClient(\n {\n 'data:query': registeredQueryRoute,\n },\n requestMessage\n );\n\n function disconnect() {\n if (sessionId) send('disconnect', {});\n sessionId = undefined;\n for (const entry of pending.values())\n entry.reject(\n new DataAppError('The preview has closed.', 'bridge_closed')\n );\n }\n\n function resume(event: PageTransitionEvent) {\n if (event.persisted && (mode === 'url' || token)) send('ready', {});\n }\n\n function dispose() {\n if (disposed) return;\n disconnect();\n disposed = true;\n clearTimeout(diagnosticTimer);\n unsubscribeDiagnostics();\n endpoint.dispose();\n frameSizing.dispose();\n frame.removeEventListener('message', receive);\n frame.removeEventListener('pagehide', disconnect);\n frame.removeEventListener('pageshow', resume);\n stateListeners.clear();\n actionListeners.clear();\n }\n\n frame.addEventListener('pagehide', disconnect);\n frame.addEventListener('pageshow', resume);\n if (mode === 'url') send('ready', {});\n\n return {\n diagnostics: appDiagnostics,\n logger,\n request: requestMessage,\n lakehouse: {\n queryAllById(queryId, { limit, signal, params }) {\n return messages\n .request(\n 'data:query',\n {\n queryId,\n limit,\n ...(params === undefined ? {} : { params }),\n },\n { signal }\n )\n .catch(rethrowDataMessageError);\n },\n } satisfies HostedLakehouse,\n dispose,\n mode,\n snapshot() {\n return hostState;\n },\n subscribe(listener: (state: unknown) => void) {\n stateListeners.add(listener);\n\n return () => {\n stateListeners.delete(listener);\n };\n },\n ready() {\n if (!disposed && sessionId) send('runtimeReady', {});\n },\n /** Offers page actions to the host, replacing the previous set; `{}` withdraws them.\n * Unchanged sets are not resent, so callers can report their latest set on every render.\n * The current set is resent when the host reconnects. */\n setActions(value: DataAppActions) {\n const identity = JSON.stringify(value);\n if (disposed || identity === actionsIdentity) return;\n actions = value;\n actionsIdentity = identity;\n if (sessionId) send('actionsUpdate', { actions });\n },\n /** Receives host requests to run offered page actions. */\n onAction(listener: (action: DataAppAction) => void) {\n actionListeners.add(listener);\n\n return () => {\n actionListeners.delete(listener);\n };\n },\n [reportWidgetCapture](request: string, render: WidgetCaptureRenderState) {\n if (!isRecord(hostState) || hostState.widgetCaptureRequest !== request)\n return;\n capture = { request, render };\n if (render.state === 'ready') {\n if (frameSizing.measure()) return;\n publishCapture(request, {\n state: 'loading',\n widgetId: render.widgetId,\n });\n } else {\n publishCapture(request, render);\n }\n },\n /** The UI owner calls this once its styles support content sizing; the parent's\n * `sizing: 'content'` presentation then applies until the returned release runs. */\n supportContentSizing() {\n return frameSizing.support();\n },\n /** Reports a fatal app failure; the cause reaches the host logger only. */\n fail(cause?: unknown) {\n if (disposed || !sessionId) return;\n appDiagnostics.record('render', 'App startup', cause);\n if (cause !== undefined)\n logger.error(() => ['Data app failed', describeError(cause)]);\n send('runtimeError', {});\n },\n };\n}\n\nexport type IframeTransport = ReturnType<typeof createIframeTransport>;\n\nconst bridgeKey = Symbol.for('altertable.localFrameBridge');\nconst installedKey = Symbol.for('altertable.installedTransport');\ntype LocalBridge = Partial<Pick<IframeTransport, 'request'>> & {\n connect?: () => Promise<IframeTransport>;\n};\ntype FrameWindow = Window & {\n [bridgeKey]?: LocalBridge;\n [installedKey]?: ReturnType<typeof createIframeTransport>;\n};\n\n/** The URL opts into local preview; only same-origin server configuration establishes trust. */\nexport function localFrameBridge(window?: Window): LocalBridge | undefined {\n const activeWindow =\n window ??\n (typeof globalThis.window === 'undefined' ? undefined : globalThis.window);\n if (!activeWindow) return undefined;\n const frame = activeWindow as FrameWindow;\n if (frame[bridgeKey]) return frame[bridgeKey];\n const parentOrigin =\n new URL(frame.location.href).searchParams.get(PARENT_PARAM) ?? '';\n if (!parentOrigin) return undefined;\n\n async function connect(parentOrigin: string) {\n try {\n const response = await frame.fetch('/__altertable/parent', {\n signal: AbortSignal.timeout(5000),\n });\n const config = (await response.json()) as { origin?: unknown };\n if (\n !response.ok ||\n config.origin !== parentOrigin ||\n frame.parent === frame\n )\n throw new Error('Invalid local parent configuration.');\n // Another owner can install a trusted bridge while configuration is pending.\n if (frame[installedKey]) return frame[installedKey];\n if (frame[bridgeKey] !== proxy)\n throw new Error('Preview transport owner changed.');\n const bridge = createIframeTransport({ parentOrigin, window: frame });\n frame[bridgeKey] = bridge;\n frame[installedKey] = bridge;\n\n return bridge;\n } catch {\n throw new DataAppError(\n 'The preview shell could not be verified. Open the URL printed by altertable app dev.',\n 'bridge_unavailable'\n );\n }\n }\n\n let connection: Promise<ReturnType<typeof createIframeTransport>> | undefined;\n\n function getConnection() {\n const installed = frame[installedKey];\n if (installed) return Promise.resolve(installed);\n if (!connection) {\n const attempt = connect(parentOrigin);\n connection = attempt;\n // Clear only this failed attempt; retained proxy references can explicitly retry.\n void attempt.catch(() => {\n if (connection === attempt) connection = undefined;\n });\n }\n\n return connection;\n }\n\n const proxy: LocalBridge = { connect: getConnection };\n frame[bridgeKey] = proxy;\n // Static mounting still verifies eagerly, without an unhandled rejection.\n void getConnection().catch(() => {});\n\n return proxy;\n}\n\n/** Install an explicitly trusted transport for hosted apps and their URL-backed controls. */\nexport function installDataAppTransport(\n bridge: ReturnType<typeof createIframeTransport>,\n frame: Window = window\n) {\n const target = frame as FrameWindow;\n if (target[installedKey])\n throw new Error('A data app transport is already installed.');\n target[bridgeKey] = bridge;\n target[installedKey] = bridge;\n\n return () => {\n if (target[bridgeKey] === bridge) delete target[bridgeKey];\n if (target[installedKey] === bridge) delete target[installedKey];\n bridge.dispose();\n };\n}\n\n/** The bootstrap installs this before executing app code. URL apps can install an explicit connection. */\nexport function getDataAppTransport(frame: Window = window) {\n return (frame as FrameWindow)[installedKey];\n}\n","import {\n appFailure,\n type AppFailure,\n type AppDiagnosticReport,\n} from '../core/diagnostics.ts';\nimport { getDataAppTransport } from './iframe.ts';\n\nconst listeners = new Set<() => void>();\nconst failures = new Map<string, AppFailure>();\nlet pending = 0;\nfunction publish() {\n for (const listener of listeners) listener();\n}\n\n/** Lightweight live observations only. No query values or result rows are retained. */\ntype Diagnostics = {\n snapshot: () => AppDiagnosticReport;\n subscribe: (listener: () => void) => () => void;\n record: (\n kind: AppFailure['kind'],\n name: string,\n error: unknown,\n identity?: string\n ) => void;\n clear: (kind: AppFailure['kind'], name: string, identity?: string) => void;\n begin: () => () => void;\n};\nfunction installed(): Diagnostics | undefined {\n const diagnostics =\n typeof window === 'undefined'\n ? undefined\n : getDataAppTransport()?.diagnostics;\n return diagnostics !== appDiagnostics ? diagnostics : undefined;\n}\nexport const appDiagnostics: Diagnostics = {\n snapshot(): AppDiagnosticReport {\n if (installed()) return installed()!.snapshot();\n const observed: AppFailure[] = [];\n for (const failure of failures.values()) {\n observed.push(failure);\n if (observed.length === 30) break;\n }\n return {\n failures: observed,\n pending,\n truncated: Math.max(0, failures.size - 30),\n };\n },\n subscribe(listener: () => void) {\n if (installed()) return installed()!.subscribe(listener);\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n record(\n kind: AppFailure['kind'],\n name: string,\n error: unknown,\n identity?: string\n ) {\n if (installed()) return installed()!.record(kind, name, error, identity);\n const failure = appFailure(kind, name, error);\n if (identity) failure.id = identity;\n const key = `${kind}:${identity ?? name}`;\n // Retain active failures until cleared; bound messages and outgoing reports.\n failures.set(key, failure);\n publish();\n },\n clear(kind: AppFailure['kind'], name: string, identity?: string) {\n if (installed()) return installed()!.clear(kind, name, identity);\n if (failures.delete(`${kind}:${identity ?? name}`)) publish();\n },\n begin() {\n if (installed()) return installed()!.begin();\n pending++;\n publish();\n return () => {\n pending--;\n publish();\n };\n },\n};\n"],"mappings":";;;;AAsBA,eAAsB,qBACpB,WACA,OACA,EACE,eACA,WACA,QAAQ,eACR,WACA,aACA,WAEF;CACA,cAAc,eAAe;CAC7B,IAAI;CACJ,IAAI;EACF,QAAQ,UAAU,MAAM,KAAK;CAC/B,QAAQ;EACN,MAAM,IAAI,oBAAoB;CAChC;CAEA,MAAM,SAAS,YAAY,IAAI,CAC7B,eACA,YAAY,QAAQ,UAAU,OAAO,aAAa,CACpD,CAAC;CACD,MAAM,YAAY,yBAChB,WACA,WACA,QACA,eACA,OACF;CACA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,CAAC,CAAE,OAAO,MAAM,MAAM,OAAO,QAAQ;EACvE,MAAM,UAAU,WAAW,MAAM,MAAM,KAAK;EAC5C,IAAI,UAAU,QAAQ,KAAK;EAC3B,MAAM,MAAM,GAAG,KAAK,GAAG,YAAY;EAEnC,SAAS,IAAI,KAAK,OAAO;EACzB,QAAQ;CACV;CACA,MAAM,MAA0B,MAAc,UAAmB;EAC/D,IAAI,UAAU,GAAG,OAAO,UAAU,CAAC,CAAE,MAAM,MAAM,MAAM,QAAQ;EAC/D,IAAI,SAAS,OAAO,GAAG,KAAK,GAAG,YAAY,MAAM,GAAG,QAAQ;CAC9D;CACA,QAAQ;EACN,IAAI,UAAU,GAAG,OAAO,UAAU,CAAC,CAAE,MAAM;EAC3C;EACA,QAAQ;EACR,aAAa;GACX;GACA,QAAQ;EACV;CACF;AACF"}
@@ -1,6 +1,6 @@
1
- import { _ as navigationUpdateRoute, a as annotationDraftRoute, c as annotationSendRoute, f as MessageRoutingError, i as resolveExternalLinkTarget, l as annotationUpdateRoute, n as openExternalLinkRoute, o as annotationEditorStateRoute, s as annotationModeRoute, y as validLocation } from "../chunks/contract-BTG-BUwW.js";
2
- import { a as localFrameBridge, d as PARENT_PARAM, i as installDataAppTransport, n as createIframeTransport, o as DataAppError, r as getDataAppTransport, s as createMessageClient, t as appDiagnostics } from "../chunks/diagnostics-BwpM9wGn.js";
3
- import { n as createLocalQueryLakehouse, r as installLocalQueryLakehouse, t as createDataClient } from "../chunks/data-client-C4Pay-UE.js";
1
+ import { _ as navigationUpdateRoute, a as annotationDraftRoute, c as annotationSendRoute, f as MessageRoutingError, i as resolveExternalLinkTarget, l as annotationUpdateRoute, n as openExternalLinkRoute, o as annotationEditorStateRoute, s as annotationModeRoute, y as validLocation } from "../chunks/contract-CNG8X16X.js";
2
+ import { a as localFrameBridge, d as PARENT_PARAM, i as installDataAppTransport, n as createIframeTransport, o as DataAppError, r as getDataAppTransport, s as createMessageClient, t as appDiagnostics } from "../chunks/diagnostics-BU06BbS0.js";
3
+ import { n as createLocalQueryLakehouse, r as installLocalQueryLakehouse, t as createDataClient } from "../chunks/data-client-BC_Xsl95.js";
4
4
  //#region src/client/location.ts
5
5
  /** Opaque sandboxes keep app state in memory; URL frames retain their real URL for HMR. */
6
6
  function createAppLocation(frame, virtual, publish) {
@@ -1,5 +1,5 @@
1
- import { $ as snapshotQueries, J as bindDimensionSource, x as defineOperation } from "../chunks/contract-BTG-BUwW.js";
2
- import { t as createDataClient } from "../chunks/data-client-C4Pay-UE.js";
1
+ import { Y as bindDimensionSource, et as snapshotQueries, x as defineOperation } from "../chunks/contract-CNG8X16X.js";
2
+ import { t as createDataClient } from "../chunks/data-client-BC_Xsl95.js";
3
3
  //#region src/core/config.ts
4
4
  /**
5
5
  * App configuration shared by browser and server.
@@ -1,3 +1,3 @@
1
- import { a as resolveDateTimeRange, i as parseDateTimeRange, n as formatDateTimeRange, o as serializeDateTimeRange, r as parseDateTimeBound, t as formatDateTimeBound } from "../chunks/date-time-range-value-D-XfqVTT.js";
2
- import { A as resolvedDateTimeRangeParams, C as parseCount, D as dateTimeRangePresets, E as dateTimeRangeFilter, G as searchFilter, I as parseBooleanSelection, L as parseNumberSelection, N as booleanFilter, O as queryDateTimeRangeParams, P as numberFilter, S as defineQueryNames, T as parseTrue, U as displayChoice, V as choiceFilter, W as multiChoiceFilter, _ as navigationUpdateRoute, a as annotationDraftRoute, at as parseDimensionSelection, b as connectionCheck, c as annotationSendRoute, d as parseDataAppAnnotationDraft, f as MessageRoutingError, g as defineMessageRoute, h as defineDataOperationRoute, i as resolveExternalLinkTarget, it as dimensionPredicate, j as facetFilter, k as dateTimeRangeSql, l as annotationUpdateRoute, m as dataAppRoutes, n as openExternalLinkRoute, nt as dimensionFilter, o as annotationEditorStateRoute, ot as parseFacetOptions, p as createMessageRouter, r as parseExternalUrl, s as annotationModeRoute, t as DataSourceError, v as registeredQueryRoute, w as parseLabel, x as defineOperation } from "../chunks/contract-BTG-BUwW.js";
1
+ import { a as resolveDateTimeRange, i as parseDateTimeRange, n as formatDateTimeRange, o as serializeDateTimeRange, r as parseDateTimeBound, t as formatDateTimeBound } from "../chunks/date-time-range-value-DA8GWV_U.js";
2
+ import { A as resolvedDateTimeRangeParams, C as parseCount, D as dateTimeRangePresets, E as dateTimeRangeFilter, G as searchFilter, I as parseBooleanSelection, L as parseNumberSelection, N as booleanFilter, O as queryDateTimeRangeParams, P as numberFilter, S as defineQueryNames, T as parseTrue, U as displayChoice, V as choiceFilter, W as multiChoiceFilter, _ as navigationUpdateRoute, a as annotationDraftRoute, at as dimensionPredicate, b as connectionCheck, c as annotationSendRoute, d as parseDataAppAnnotationDraft, f as MessageRoutingError, g as defineMessageRoute, h as defineDataOperationRoute, i as resolveExternalLinkTarget, j as facetFilter, k as dateTimeRangeSql, l as annotationUpdateRoute, m as dataAppRoutes, n as openExternalLinkRoute, o as annotationEditorStateRoute, ot as parseDimensionSelection, p as createMessageRouter, r as parseExternalUrl, rt as dimensionFilter, s as annotationModeRoute, st as parseFacetOptions, t as DataSourceError, v as registeredQueryRoute, w as parseLabel, x as defineOperation } from "../chunks/contract-CNG8X16X.js";
3
3
  export { DataSourceError, MessageRoutingError, annotationDraftRoute, annotationEditorStateRoute, annotationModeRoute, annotationSendRoute, annotationUpdateRoute, booleanFilter, choiceFilter, connectionCheck, createMessageRouter, dataAppRoutes, dateTimeRangeFilter, dateTimeRangePresets, dateTimeRangeSql, defineDataOperationRoute, defineMessageRoute, defineOperation, defineQueryNames, dimensionFilter, dimensionPredicate, displayChoice, facetFilter, formatDateTimeBound, formatDateTimeRange, multiChoiceFilter, navigationUpdateRoute, numberFilter, openExternalLinkRoute, parseBooleanSelection, parseCount, parseDataAppAnnotationDraft, parseDateTimeBound, parseDateTimeRange, parseDimensionSelection, parseExternalUrl, parseFacetOptions, parseLabel, parseNumberSelection, parseTrue, queryDateTimeRangeParams, registeredQueryRoute, resolveDateTimeRange, resolveExternalLinkTarget, resolvedDateTimeRangeParams, searchFilter, serializeDateTimeRange };
@@ -1,4 +1,4 @@
1
- import { c as parseDateTimeRangeInput, n as formatDateTimeRange } from "../chunks/date-time-range-value-D-XfqVTT.js";
1
+ import { n as formatDateTimeRange, s as parseDateTimeRangeInput } from "../chunks/date-time-range-value-DA8GWV_U.js";
2
2
  //#region src/core/date-format.ts
3
3
  const calendarDate = /^\d{4}-\d{2}-\d{2}$/;
4
4
  const timestamp = /^(\d{4}-\d{2}-\d{2})T(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d{1,9})?)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;
package/dist/internal.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as resolveDateTimeRange, i as parseDateTimeRange, l as invariant, n as formatDateTimeRange, o as serializeDateTimeRange, r as parseDateTimeBound, s as fixedUnitMilliseconds, t as formatDateTimeBound } from "./chunks/date-time-range-value-D-XfqVTT.js";
2
- import { B as resolveFilterInput, D as dateTimeRangePresets, E as dateTimeRangeFilter, F as numberOperatorLabels, G as searchFilter, H as defineAppFilters, K as validateChoiceOptions, M as facetSource, Q as REGISTERED_QUERY_ID_PATTERN, R as combineOperationFilters, U as displayChoice, V as choiceFilter, W as multiChoiceFilter, Y as dimensionSource, Z as MAX_QUERY_ROWS, et as unsupportedParameterReference, rt as dimensionMemberKey, st as KEY_SEPARATOR, tt as createDimensionFilter, z as dateFilterName } from "./chunks/contract-BTG-BUwW.js";
3
- import { _ as toDataOperationFailure, a as localFrameBridge, c as isDataAppPresentation, d as PARENT_PARAM, f as REQUEST_TIMEOUT_MS, h as randomUuid, l as createBridgeEndpoint, m as parseAppDiagnosticReport, p as validId, u as MAX_PENDING } from "./chunks/diagnostics-BwpM9wGn.js";
1
+ import { a as resolveDateTimeRange, c as fixedUnitMilliseconds, i as parseDateTimeRange, l as invariant, n as formatDateTimeRange, o as serializeDateTimeRange, r as parseDateTimeBound, t as formatDateTimeBound } from "./chunks/date-time-range-value-DA8GWV_U.js";
2
+ import { $ as REGISTERED_QUERY_ID_PATTERN, B as resolveFilterInput, D as dateTimeRangePresets, E as dateTimeRangeFilter, F as numberOperatorLabels, G as searchFilter, H as defineAppFilters, K as validateChoiceOptions, M as facetSource, Q as MAX_QUERY_ROWS, R as combineOperationFilters, U as displayChoice, V as choiceFilter, W as multiChoiceFilter, X as dimensionSource, ct as KEY_SEPARATOR, it as dimensionMemberKey, nt as createDimensionFilter, q as appUrlKeys, tt as unsupportedParameterReference, z as dateFilterName } from "./chunks/contract-CNG8X16X.js";
3
+ import { _ as reportWidgetCapture, a as localFrameBridge, c as isDataAppPresentation, d as PARENT_PARAM, f as REQUEST_TIMEOUT_MS, g as readWidgetId, h as readWidgetCaptureRequest, l as createBridgeEndpoint, m as isWidgetId, p as validId, u as MAX_PENDING, v as parseAppDiagnosticReport, x as toDataOperationFailure, y as randomUuid } from "./chunks/diagnostics-BU06BbS0.js";
4
4
  //#region src/client/download.ts
5
5
  /** Start a browser download and release its temporary anchor and object URL. */
6
6
  function downloadBlob({ filename, blob }) {
@@ -119,6 +119,6 @@ async function readRequestBody(request, maxBytes) {
119
119
  }
120
120
  }
121
121
  //#endregion
122
- export { KEY_SEPARATOR, MAX_PENDING, MAX_QUERY_ROWS, PARENT_PARAM, REGISTERED_QUERY_ID_PATTERN, REQUEST_TIMEOUT_MS, RequestBodyTooLargeError, choiceFilter, combineOperationFilters, createBridgeEndpoint, createDimensionFilter, dateFilterName, dateTimeRangeFilter, dateTimeRangePresets, defineAppFilters, dimensionMemberKey, dimensionSource, displayChoice, displayedSnapshot, downloadBlob, facetSource, fixedUnitMilliseconds, formatDateTimeBound, formatDateTimeRange, invariant, isDataAppPresentation, localFrameBridge, multiChoiceFilter, numberOperatorLabels, parseAppDiagnosticReport, parseDateTimeBound, parseDateTimeRange, randomUuid, readRequestBody, resolveDataView, resolveDateTimeRange, resolveFilterInput, searchFilter, serializeDateTimeRange, toDataOperationFailure, unsupportedParameterReference, validId, validateChoiceOptions };
122
+ export { KEY_SEPARATOR, MAX_PENDING, MAX_QUERY_ROWS, PARENT_PARAM, REGISTERED_QUERY_ID_PATTERN, REQUEST_TIMEOUT_MS, RequestBodyTooLargeError, appUrlKeys, choiceFilter, combineOperationFilters, createBridgeEndpoint, createDimensionFilter, dateFilterName, dateTimeRangeFilter, dateTimeRangePresets, defineAppFilters, dimensionMemberKey, dimensionSource, displayChoice, displayedSnapshot, downloadBlob, facetSource, fixedUnitMilliseconds, formatDateTimeBound, formatDateTimeRange, invariant, isDataAppPresentation, isWidgetId, localFrameBridge, multiChoiceFilter, numberOperatorLabels, parseAppDiagnosticReport, parseDateTimeBound, parseDateTimeRange, randomUuid, readRequestBody, readWidgetCaptureRequest, readWidgetId, reportWidgetCapture, resolveDataView, resolveDateTimeRange, resolveFilterInput, searchFilter, serializeDateTimeRange, toDataOperationFailure, unsupportedParameterReference, validId, validateChoiceOptions };
123
123
 
124
124
  //# sourceMappingURL=internal.js.map
@@ -54,6 +54,31 @@ type DataAppAction = {
54
54
  type: 'aboutData';
55
55
  };
56
56
  //#endregion
57
+ //#region src/core/widget-capture.d.ts
58
+ /** The focused widget's state. Ready includes its fitted content height in CSS pixels. */
59
+ type DataAppWidgetCaptureState = {
60
+ state: 'loading' | 'empty' | 'error';
61
+ widgetId: string;
62
+ } | {
63
+ state: 'ready';
64
+ widgetId: string;
65
+ height: number;
66
+ } | {
67
+ state: 'invalid-target';
68
+ };
69
+ type WidgetCaptureRenderState = Exclude<DataAppWidgetCaptureState, {
70
+ state: 'ready';
71
+ }> | {
72
+ state: 'ready';
73
+ widgetId: string;
74
+ };
75
+ declare function isWidgetId(id: string): boolean;
76
+ /** Returns undefined for normal navigation and null for an invalid widget link. */
77
+ declare function readWidgetId(search: URLSearchParams): string | null | undefined;
78
+ declare const reportWidgetCapture: unique symbol;
79
+ /** The host's capture request for this search, when the host state matches it. */
80
+ declare function readWidgetCaptureRequest(state: unknown, search: string): string | undefined;
81
+ //#endregion
57
82
  //#region src/client/transport.d.ts
58
83
  declare const errorBrand: unique symbol;
59
84
  declare class DataAppError extends Error {
@@ -113,6 +138,7 @@ declare function createIframeTransport({ parentOrigin, window: frame, timeoutMs,
113
138
  setActions(value: DataAppActions): void;
114
139
  /** Receives host requests to run offered page actions. */
115
140
  onAction(listener: (action: DataAppAction) => void): () => void;
141
+ [reportWidgetCapture](request: string, render: WidgetCaptureRenderState): void;
116
142
  /** The UI owner calls this once its styles support content sizing; the parent's
117
143
  * `sizing: 'content'` presentation then applies until the returned release runs. */
118
144
  supportContentSizing(): () => void;
@@ -156,6 +182,7 @@ declare function getDataAppTransport(frame?: Window): {
156
182
  setActions(value: DataAppActions): void;
157
183
  /** Receives host requests to run offered page actions. */
158
184
  onAction(listener: (action: DataAppAction) => void): () => void;
185
+ [reportWidgetCapture](request: string, render: WidgetCaptureRenderState): void;
159
186
  /** The UI owner calls this once its styles support content sizing; the parent's
160
187
  * `sizing: 'content'` presentation then applies until the returned release runs. */
161
188
  supportContentSizing(): () => void;
@@ -260,5 +287,5 @@ declare function navigateNewWindow(url: string, options?: NavigationOptions): Pr
260
287
  /** Send only modifier keys, never the DOM/React event. Shift requests a window, Ctrl/Cmd a tab; otherwise no navigation. */
261
288
  declare function navigateNewWindowOrTab(url: string, event: ExternalLinkModifiers, options?: NavigationOptions): Promise<ExternalLinkResult>;
262
289
  //#endregion
263
- export { DataAppActions as C, DataAppAction as S, LogEntry as T, localFrameBridge as _, AppDiagnosticReport as a, installLocalQueryLakehouse as b, createAnnotationClient as c, createDataAppNavigation as d, getDataAppNavigation as f, installDataAppTransport as g, getDataAppTransport as h, appDiagnostics as i, createMessageClient as l, createIframeTransport as m, navigateNewWindow as n, AppFailure as o, IframeTransport as p, navigateNewWindowOrTab as r, parseAppDiagnosticReport as s, navigateNewTab as t, DataAppNavigation as u, DataAppLocation as v, DataAppLogger as w, DataAppError as x, createLocalQueryLakehouse as y };
290
+ export { DataAppLogger as A, WidgetCaptureRenderState as C, reportWidgetCapture as D, readWidgetId as E, DataAppAction as O, DataAppWidgetCaptureState as S, readWidgetCaptureRequest as T, localFrameBridge as _, AppDiagnosticReport as a, installLocalQueryLakehouse as b, createAnnotationClient as c, createDataAppNavigation as d, getDataAppNavigation as f, installDataAppTransport as g, getDataAppTransport as h, appDiagnostics as i, LogEntry as j, DataAppActions as k, createMessageClient as l, createIframeTransport as m, navigateNewWindow as n, AppFailure as o, IframeTransport as p, navigateNewWindowOrTab as r, parseAppDiagnosticReport as s, navigateNewTab as t, DataAppNavigation as u, DataAppLocation as v, isWidgetId as w, DataAppError as x, createLocalQueryLakehouse as y };
264
291
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
1
  import { Ut as OutputOf, gt as AppLocation, zt as InputOf } from "../chunks/contract.js";
2
- import { C as DataAppActions, S as DataAppAction, a as AppDiagnosticReport, b as installLocalQueryLakehouse, c as createAnnotationClient, d as createDataAppNavigation, f as getDataAppNavigation, g as installDataAppTransport, h as getDataAppTransport, i as appDiagnostics, l as createMessageClient, m as createIframeTransport, n as navigateNewWindow, o as AppFailure, p as IframeTransport, r as navigateNewWindowOrTab, t as navigateNewTab, u as DataAppNavigation, v as DataAppLocation, w as DataAppLogger, x as DataAppError, y as createLocalQueryLakehouse } from "../chunks/index.js";
2
+ import { A as DataAppLogger, O as DataAppAction, a as AppDiagnosticReport, b as installLocalQueryLakehouse, c as createAnnotationClient, d as createDataAppNavigation, f as getDataAppNavigation, g as installDataAppTransport, h as getDataAppTransport, i as appDiagnostics, k as DataAppActions, l as createMessageClient, m as createIframeTransport, n as navigateNewWindow, o as AppFailure, p as IframeTransport, r as navigateNewWindowOrTab, t as navigateNewTab, u as DataAppNavigation, v as DataAppLocation, x as DataAppError, y as createLocalQueryLakehouse } from "../chunks/index.js";
3
3
  import { a as createDataClient, i as OperationFilters, n as DataClientOptions, r as DataResponse, t as DataClient } from "../chunks/data-client.js";
4
4
  export { type AppDiagnosticReport, type AppFailure, type AppLocation, type DataAppAction, type DataAppActions, DataAppError, type DataAppLocation, type DataAppLogger, type DataAppNavigation, type DataClient, type DataClientOptions, type DataResponse, type IframeTransport, type InputOf, type OperationFilters, type OutputOf, appDiagnostics, createAnnotationClient, createDataAppNavigation, createDataClient, createIframeTransport, createLocalQueryLakehouse, createMessageClient, getDataAppNavigation, getDataAppTransport, installDataAppTransport, installLocalQueryLakehouse, navigateNewTab, navigateNewWindow, navigateNewWindowOrTab };
@@ -1,6 +1,6 @@
1
1
  import { a as resolveDateTimeRange, c as DateTimeRange, f as RelativeUnit, i as parseDateTimeRange, n as formatDateTimeRange, o as serializeDateTimeRange, r as parseDateTimeBound, s as AbsoluteOrRelativeDateTime, t as formatDateTimeBound, u as RelativeDateTime } from "./chunks/date-time-range-value.js";
2
2
  import { $ as dateFilterName, An as dateTimeRangePresets, Cn as DateTimeRangeComparison, Dn as DateTimeRangeRequest, En as DateTimeRangePreset, Et as numberOperatorLabels, Jt as IsUnion, Mn as DateTimeRangeInput, Mt as dimensionSource, On as DateTimeRangeSelection, Q as combineOperationFilters, Sn as facetSource, Tn as DateTimeRangeFilterOptions, Xt as MAX_QUERY_ROWS, Z as FilterInput, _n as dimensionMemberKey, _t as HistoryMode, at as FilterCollection, ct as MultiChoiceFilter, dt as defineAppFilters, et as resolveFilterInput, ft as displayChoice, hn as createDimensionFilter, ht as validateChoiceOptions, it as ChoiceOption, jt as SourceDimensionFilter, kn as dateTimeRangeFilter, ln as DimensionFilterSettings, lt as SearchFilter, mn as DimensionValue, mt as searchFilter, nt as CheckedFilterDeclarations, on as REGISTERED_QUERY_ID_PATTERN, ot as FilterPresentation, pn as DimensionSelectionFilter, pt as multiChoiceFilter, rt as ChoiceFilter, st as FilterValues, tt as AppFilter, u as DataAppAnnotationPresentation, ut as choiceFilter, wn as DateTimeRangeFilter, xn as FacetFilter } from "./chunks/contract.js";
3
- import { C as DataAppActions, S as DataAppAction, T as LogEntry, _ as localFrameBridge, s as parseAppDiagnosticReport } from "./chunks/index.js";
3
+ import { C as WidgetCaptureRenderState, D as reportWidgetCapture, E as readWidgetId, O as DataAppAction, S as DataAppWidgetCaptureState, T as readWidgetCaptureRequest, _ as localFrameBridge, j as LogEntry, k as DataAppActions, s as parseAppDiagnosticReport, w as isWidgetId } from "./chunks/index.js";
4
4
  import { c as Theme } from "./chunks/appearance.js";
5
5
  //#region src/core/bridge.d.ts
6
6
  /** Data app delivery protocol. IDs identify a document, a shell session, and an individual call. */
@@ -127,6 +127,15 @@ declare const bridgeProtocol: {
127
127
  height: number;
128
128
  };
129
129
  };
130
+ readonly widgetCapture: {
131
+ wire: "widget:capture";
132
+ from: "app";
133
+ session: "current";
134
+ parse: (fields: Fields) => {
135
+ captureRequest: string;
136
+ capture: DataAppWidgetCaptureState;
137
+ };
138
+ };
130
139
  /** The page actions the app currently offers; replaces the previous set. */
131
140
  readonly actionsUpdate: {
132
141
  wire: "actions:update";
@@ -334,5 +343,17 @@ export declare function unsupportedParameterReference(statement: string): string
334
343
  /** Fixed durations in UTC-rebased arithmetic; months and years are calendar-dependent. */
335
344
  export declare const fixedUnitMilliseconds: Partial<Record<RelativeUnit, number>> & Record<'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK', number>;
336
345
  //#endregion
337
- export { type AbsoluteOrRelativeDateTime, type AppFilter, type BridgeDiagnostic, type BridgeEventMessage, type CheckedFilterDeclarations, type ChoiceFilter, type ChoiceOption, type DataAppPresentation, type DataReading, type DataView, type DateTimeRange, type DateTimeRangeComparison, type DateTimeRangeFilter, type DateTimeRangeFilterOptions, type DateTimeRangePreset, type DateTimeRangeRequest, type DateTimeRangeSelection, type DimensionFilterSettings, type DimensionSelectionFilter, type DimensionValue, type DisplayedSnapshot, type FacetFilter, type FilterCollection, type FilterInput, type FilterPresentation, type FilterValues, type HistoryMode, type IsUnion, MAX_QUERY_ROWS, type MetricReading, type MetricValues, type MultiChoiceFilter, REGISTERED_QUERY_ID_PATTERN, type RelativeDateTime, type SearchFilter, type SourceDimensionFilter, choiceFilter, combineOperationFilters, createDimensionFilter, dateFilterName, dateTimeRangeFilter, dateTimeRangePresets, defineAppFilters, dimensionMemberKey, dimensionSource, displayChoice, facetSource, formatDateTimeBound, formatDateTimeRange, localFrameBridge, multiChoiceFilter, numberOperatorLabels, parseAppDiagnosticReport, parseDateTimeBound, parseDateTimeRange, resolveDateTimeRange, resolveFilterInput, searchFilter, serializeDateTimeRange, validateChoiceOptions };
346
+ //#region src/core/app-url-keys.d.ts
347
+ export declare const appUrlKeys: {
348
+ readonly view: '_view';
349
+ readonly about: '_about';
350
+ readonly tab: '_tab';
351
+ readonly present: '_present';
352
+ readonly step: '_step';
353
+ readonly details: '_details';
354
+ readonly widget: '_widget';
355
+ readonly theme: '_theme';
356
+ };
357
+ //#endregion
358
+ export { type AbsoluteOrRelativeDateTime, type AppFilter, type BridgeDiagnostic, type BridgeEventMessage, type CheckedFilterDeclarations, type ChoiceFilter, type ChoiceOption, type DataAppPresentation, type DataAppWidgetCaptureState, type DataReading, type DataView, type DateTimeRange, type DateTimeRangeComparison, type DateTimeRangeFilter, type DateTimeRangeFilterOptions, type DateTimeRangePreset, type DateTimeRangeRequest, type DateTimeRangeSelection, type DimensionFilterSettings, type DimensionSelectionFilter, type DimensionValue, type DisplayedSnapshot, type FacetFilter, type FilterCollection, type FilterInput, type FilterPresentation, type FilterValues, type HistoryMode, type IsUnion, MAX_QUERY_ROWS, type MetricReading, type MetricValues, type MultiChoiceFilter, REGISTERED_QUERY_ID_PATTERN, type RelativeDateTime, type SearchFilter, type SourceDimensionFilter, type WidgetCaptureRenderState, choiceFilter, combineOperationFilters, createDimensionFilter, dateFilterName, dateTimeRangeFilter, dateTimeRangePresets, defineAppFilters, dimensionMemberKey, dimensionSource, displayChoice, facetSource, formatDateTimeBound, formatDateTimeRange, isWidgetId, localFrameBridge, multiChoiceFilter, numberOperatorLabels, parseAppDiagnosticReport, parseDateTimeBound, parseDateTimeRange, readWidgetCaptureRequest, readWidgetId, reportWidgetCapture, resolveDateTimeRange, resolveFilterInput, searchFilter, serializeDateTimeRange, validateChoiceOptions };
338
359
  //# sourceMappingURL=internal.d.ts.map
package/docs/embed.md CHANGED
@@ -86,6 +86,25 @@ Host Back/Forward events publish opaque host state through the bridge. The app's
86
86
  optional navigation adapter interprets search/hash and synchronizes controls;
87
87
  opaque apps keep that state in memory rather than modifying their document URL.
88
88
 
89
+ ## Focused widget states
90
+
91
+ Open `?_widget=event-log` to render the visualization declared with
92
+ `view.content(..., { id: 'event-log' })`. For hosted bundles, pass the query
93
+ through the navigation adapter. The query also accepts the selected view’s
94
+ filters and a theme override (`_theme=light` or `_theme=dark`).
95
+
96
+ Use a borderless, full-width, [content-sized iframe](#content-sizing) and
97
+ set the capture viewport to the desired layout width. Subscribe to
98
+ `onWidgetCaptureChange` on `attachDataAppBridge()` or `<DataAppBridge>`.
99
+ Capture the iframe or its wrapper when the active frame reports `ready` for
100
+ the requested `widgetId`. The callback reports the fitted `height` in CSS pixels.
101
+
102
+ Wait through `loading` with a timeout. Clear readiness on `undefined` and
103
+ end the capture attempt on `empty`, `error`, or `invalid-target`.
104
+
105
+ Inside the app document, the focused `<main>` exposes `data-widget-state`
106
+ and, for a valid target, `data-focused-widget`.
107
+
89
108
  ## External links
90
109
 
91
110
  Register the external link route to let apps request HTTPS navigation without
package/docs/filters.md CHANGED
@@ -265,5 +265,5 @@ Clear removes filter predicates and returns dates to defaults, preserving search
265
265
  and display choices. `resetAll()` restores all defaults. Filters apply immediately;
266
266
  use app-owned drafts only when the task needs Apply/Cancel.
267
267
 
268
- The keys `view`, `about`, `tab`, `present`, `step`, and `details` are reserved
269
- for inspection, presentation, and navigation.
268
+ Filter keys cannot start with `_`: the runtime owns those keys for inspection,
269
+ presentation, navigation, and focused widgets.
@@ -103,6 +103,8 @@ the session. Resolve system preference in the parent to `'light'` or `'dark'`.
103
103
  Inside an embedded surface, `<DataApp>` hides its header, footer, and page
104
104
  toolbar. See [parent presentation](embed.md#parent-presentation).
105
105
 
106
+ See [focused widget states](embed.md#focused-widget-states) for screenshot setup.
107
+
106
108
  ## Page actions
107
109
 
108
110
  Render the app's page actions in the parent with `onActionsChange`, and run them
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altertable/data-app",
3
- "version": "0.79.0",
3
+ "version": "0.80.0",
4
4
  "description": "Portable definitions, contracts, formatting, browser clients, and request handlers for Altertable data apps.",
5
5
  "keywords": [
6
6
  "altertable",