import type { Shape, ColumnarData, LayerData } from "./ir"; export declare function isColumnar(data: LayerData): data is ColumnarData; /** `Array` as-is, or a FeatureCollection's `.features`, or a lone object wrapped in an array. */ export declare function normalizeFeatures(json: unknown): unknown[]; /** Parsed-JSON → LayerData: columnar `{ columns }` form, or the usual feature-array normalization. */ export declare function normalizeData(json: unknown): LayerData; /** * The one place the runtime reads a column value out of the ColumnarData * layout (compiled accessors emit the equivalent access as codegen — see * expr/compile.ts `columnAccess`, the documented contract this mirrors). A * missing column reads as an empty column, matching getField's * undefined-not-throw semantics. */ export declare function getColumn(data: ColumnarData, field: string): ArrayLike; /** * Row view over any LayerData. Arrays pass through untouched (zero cost); * columnar data materializes plain flat row objects ONCE per data object and * memoizes — the spec's Tier-2 rule ("bulk raw features is inherently O(N) * when requested") made concrete. Render/stats hot paths never call this; * ctx.data()/dataInViewport(), picking, and highlight-by-id do. */ export declare function asRows(data: LayerData): readonly unknown[]; /** A single row by index — shares the asRows memo so a picked row's identity is stable across picks. */ export declare function rowAt(data: LayerData, index: number): unknown; /** Structural slice of an apache-arrow Table — keeps apache-arrow out of the static import graph. */ export interface ArrowTableLike { numRows: number; schema: { fields: { name: string; type: unknown; metadata?: Map; }[]; }; getChild(name: string): { get(i: number): unknown; toArray(): ArrayLike; } | null; } /** * Arrow Table → ColumnarData. Primitive columns come out as `toArray()` * views (typed arrays for numerics — no per-value copying; Int64 coerces to * Float64 because $field expressions reject BigInt — see expr/compile.ts). * Geometry columns — FixedSizeList (interleaved), or `coordField` for the * separated Struct{x, y} encoding — materialize to per-row [x, y(, z)] * arrays once at load, so `get-position="$geometry"` works like any $field. */ export declare function arrowTableToColumnar(table: ArrowTableLike, coordField?: string): ColumnarData; /** Arrow table → LayerData: line/polygon GeoArrow becomes GeoJSON feature rows; everything else takes the columnar path. */ export declare function arrowTableToLayerData(table: ArrowTableLike): LayerData; export interface DataFormat { /** Claim a URL (extension test) and/or a response (Content-Type test — undefined during URL-only checks). */ match(url: string, contentType?: string): boolean; /** Parse the claimed response. The parser module should be lazy-imported here (HU1 — the apache-arrow precedent). `url` is the requested URL (res.url is empty on constructed Responses — test fetches, service workers). */ parse(res: Response, url: string): Promise; /** * Optional progressive variant for record-per-line formats (CityJSONSeq): * `push` publishes a partial snapshot mid-download, taking the same * cache-swap + notify path a stream flush takes, so the map fills in as * bytes arrive instead of staying empty until EOF. Pass a FRESH array * reference each time — deck.gl diffs `data` by identity. When present this * is used instead of `parse`; the returned value is the complete dataset. * `push` is a no-op during a `refresh` re-fetch — see getData for why. */ parseIncremental?(res: Response, url: string, push: (partial: LayerData) => void): Promise; } /** * Row objects → ColumnarData (the memory-efficient shape: one array per * column instead of N objects; all-numeric columns become Float64Array). * Returns undefined for empty input — an empty flat array round-trips * better than a zero-length columnar table. */ export declare function rowsToColumnar(rows: Record[]): ColumnarData | undefined; /** `OmMap.registerFormat(format)` — plug in a parser for a format the library doesn't ship (spec: "v0.2 / Tier 1"). */ export declare function registerFormat(format: DataFormat): void; /** Opaque controller/element identity used to reference-count data transports. */ export type DataTransportOwner = object; /** Start one descriptor reconciliation transaction for an owner. */ export declare function beginDataOwnerUpdate(owner: DataTransportOwner): void; /** * Release transports no longer named by the owner's complete descriptor * document. Retains their rows: a layer removed or re-pointed is a routine * edit, and re-adding it (or undoing the edit) should repaint, not blink. */ export declare function endDataOwnerUpdate(owner: DataTransportOwner): void; /** * Release every fetch/poller/socket held by an owner. * * Defaults to a permanent teardown — dispose, unmount, an leaving the * document — which drops the rows too, because an owner that cannot come back * has nothing to repaint. Pass `{ retain: true }` for a pause the owner intends * to reverse (`MapController.suspend()`), and resuming repaints the last rows * while the reopened transport catches up. */ export declare function releaseDataOwner(owner: DataTransportOwner, opts?: { retain?: boolean; }): void; /** * A source plugin supplies domain decoding (and optionally a subscription * handshake); the transport (WebSocket, reconnect, flush) is generic. * Registered via `OmMap.registerSource(name, plugin)` and selected by the * layer's `source` attribute. */ export interface SourcePlugin { /** Called on every (re)connect — e.g. send a subscription message (aisstream.io-style APIs). */ onOpen?(send: (message: string) => void): void; /** Raw (JSON-parsed, when parseable) socket message → entity object(s) to upsert, or null to ignore. */ decode(raw: unknown): Record | Record[] | null; } export declare function registerSource(name: string, plugin: SourcePlugin): void; /** Options carried by the layer's reserved live-source attributes (`source`, `key`, `flush` for streams; `refresh` for polling). */ export interface StreamOptions { source?: string; key?: string; flush?: string; refresh?: string; } /** * Request configuration for every `data` URL the Data Layer fetches * (including polling refreshes and Arrow files). Deliberately a * PROGRAMMATIC surface, not manifest attributes: credentials in markup * would put secrets into the DOM — and into agent-generated manifests. * * OmMap.configureData({ headers: { Authorization: `Bearer ${token}` } }); * OmMap.configureData({ headers: (url) => url.startsWith("/api/") ? auth : undefined }); */ export interface DataRequestConfig { /** Static headers, or a per-URL function (return undefined to send none for that URL). */ headers?: HeadersInit | ((url: string) => HeadersInit | undefined); credentials?: RequestCredentials; /** Full fetch replacement (custom retry/signing/proxy logic). Receives the resolved RequestInit. */ fetch?: typeof fetch; } export declare function configureData(config: DataRequestConfig): void; /** @internal Shared request-policy chokepoint for non-row assets (ImageOverlay); not re-exported from the package root. */ export declare function fetchConfiguredResource(url: string, signal?: AbortSignal): Promise; /** @internal Shared Content-Length license backstop for row and non-row sources. */ export declare function assertFetchSizeWithinEntitlement(response: Response): void; /** `data="draw:sketch"` — the reserved scheme for a widget-fed sketch layer (never collides with http/ws/inline). */ export declare function isDrawUrl(url: string): boolean; /** * A tile URL template (spec: "Tiled layers"). deck's `TileLayer`/`MVTLayer` * (and any `TileLayer` subclass) take their `data` prop as a `{z}/{x}/{y}` * template STRING — a template deck expands per tile, NOT a document to fetch * and parse into rows. OnlyMapJS otherwise routes every `data` attribute * through getData() (fetch → parse), so a template would be fetched literally * (`…/{z}/{x}/{y}.png`) and 404; this classifier lets the parser pass it * through to deck untouched instead. Same `{z}/{x}/{y}` convention terrain and * basemap tile URLs already use. */ export declare function isTileTemplateUrl(url: string): boolean; /** * Push a new sketch snapshot into a `draw:` store (the draw widget's * DrawSession.onChange calls this). A FRESH array reference is stored so * deck.gl's shallow `data` diff re-renders, then the bound layer's notify * fires the reconcile — the exact path a stream flush takes. Safe to call * before any layer has bound (the snapshot waits in the store). */ export declare function setDrawData(url: string, features: readonly unknown[]): void; /** Current snapshot for a draw store (autosave / save-to-file read the source of truth here). */ export declare function getDrawData(url: string): LayerData; /** * Returns the currently-known data for `url` (synchronously) — an empty * array if not yet loaded (the Q6 "empty placeholder" pattern). Kicks off a * fetch — or, for `ws:`/`wss:` URLs, a live stream (spec: "Live & Streaming * Data"), or binds a `draw:` sketch store (spec: "Manual Drawing") — on first * call for a given URL, and invokes `onLoaded` on every resolution/flush (the * caller re-reconciles from there). */ export declare function getData(url: string, onLoaded: () => void, opts?: StreamOptions, owner?: DataTransportOwner): LayerData; /** * Is a fetch for this URL still in flight? Feeds the `om-map-ready` signal — * errored fetches count as settled (readiness must not hang on a bad URL). * * With an owner this asks only about that owner's OWN transports: a map must * never wait on — or be released by — a sibling map's fetch. An owner with no * acquired identities has nothing pending by definition, so a missing state is * an empty set, not "match anything". */ export declare function isPendingData(url: string, owner?: DataTransportOwner): boolean; /** * Minimal feature-shape detection (spec: "Feature Field Resolution & Data * Shape" — full per-layer caching/registry treatment is a later phase; this * is just enough to drive $field resolution for the accessor compiler). * Columnar data self-identifies by construction; a GeoJSON feature has * `{ type: "Feature", properties, geometry }`; any other shape is flat. */ export declare function detectShape(data: LayerData): Shape;