/** * Epoch query profiles (loop D.2) — THE primary public query API surface. * * Two layers live here: * * 1. ENGINE-NATIVE epoch profiles (`nearest` / `as_of` / `forward`): the * exact per-object window queries the sdn-server runs inside the * FlatSQL-WASM engine over the unified per-standard view * (sdn-server/internal/storage/engine_records.go). The SQL built here for * OMM MUST stay BYTE-IDENTICAL to the server's constants — same engine * query-cache identity, same aligned result streams on every host. The * shared fixture `shared-test-vectors/flatsql-parity.json` * (`engineEpochSql`) pins the strings; sdn-js asserts builder === fixture * (src/flatsql-parity.test.ts) and the Go host asserts constants === * fixture (sdn-server/internal/storage/engine_records_parity_test.go). * * Positional params, in this exact order (server contract): * ?1 source shadow-table name (`OMM@celestrak-gp`; '' = all sources) * ?2 epoch unix seconds (fractional allowed) * ?3 limit (-1 = unlimited) * * TLV note: the JS engine binding encodes integral JS numbers as INT64 * and fractional numbers as FLOAT64, while the Go host always binds the * epoch as FLOAT64. SQLite numeric comparison makes the RESULT STREAMS * byte-identical either way (proven by the parity harness for both an * integral and a fractional epoch); for byte-identical TLV/cache identity * with the server, pass a fractional epoch (the default epoch — now — is * effectively always fractional). * * 2. Control-path profile SQL for the webUI/LLM query context (day / window * / coverage plus row-oriented as_of/forward/nearest over the EPOCH * string column). Promoted unchanged from `src/ui/runtime/` (the old * path re-exports this module). */ export declare const ENGINE_EPOCH_PROFILES: readonly ["nearest", "as_of", "forward"]; export type EngineEpochProfile = (typeof ENGINE_EPOCH_PROFILES)[number]; /** Columns the engine profile SQL is built from for one standard. */ export interface EngineEpochProfileSpec { /** Engine table / unified-view name (`OMM`). */ tableName: string; /** Per-object partition column (`NORAD_CAT_ID`). */ partitionColumn: string; /** Numeric epoch column (`USER_DEFINED_EPOCH_TIMESTAMP`). */ epochColumn: string; } /** * Built-in per-standard specs. OMM is the only standard the server routes * into the engine today; the registry (plus the per-schema `epochSpec` * override on `LocalFlatSqlSchema`) is how CAT/MPE/SPW pick up engine epoch * profiles WITHOUT code changes once their columns are configured. */ export declare const DEFAULT_ENGINE_EPOCH_SPECS: Record>; /** Retrieval-module fallback profile (modules data-source/retrieval). */ export declare const ENGINE_EPOCH_FALLBACK_PROFILE: EngineEpochProfile; /** Retrieval-module fallback limit (modules data-source/retrieval). */ export declare const ENGINE_EPOCH_FALLBACK_LIMIT = 50000; /** Accepts `nearest` / `as_of` / `forward`, with or without the `epoch.` prefix. */ export declare function normalizeEngineEpochProfile(profile: string): EngineEpochProfile; /** * Engine profile SQL. For the OMM spec the output is byte-identical to * sdn-server internal/storage/engine_records.go (engineEpochNearestSQL / * engineEpochAsOfSQL / engineEpochForwardSQL) — asserted against the shared * parity fixture on both hosts. Do NOT reformat these strings. */ export declare function buildEngineEpochProfileSql(profile: EngineEpochProfile | string, spec: EngineEpochProfileSpec): string; /** Per-request epoch query fields (all optional — config/fallback fill the rest). */ export interface EngineEpochQueryRequest { /** `nearest` / `as_of` / `forward` (optionally `epoch.`-prefixed). */ profile?: string | null; /** Bare source name (`celestrak-gp`); empty/absent = all sources. */ source?: string | null; /** Epoch unix seconds (fractional allowed). Default: now. */ epoch?: number | null; /** Row limit; any value <= 0 means unlimited. Default: 50000 (retrieval-module fallback). */ limit?: number | null; } /** * Per-standard default query profile — the same JSON shape the retrieval * module reads through plugin.getConfig: * `{"profiles":{"OMM.fbs":{"profile":"nearest","limit":50000,...}}}`. */ export type EngineEpochProfileDefaults = EngineEpochQueryRequest; /** Per-standard profile config keyed by schema name (`OMM.fbs`) or standard id (`OMM`). */ export type EngineEpochQueryProfilesConfig = Record; /** A fully resolved engine epoch query, ready for queryRawFlatBufferStream. */ export interface EngineEpochQuery { profile: EngineEpochProfile; sql: string; /** * Positional params exactly as the server binds them: * [sourceShadowName, epochUnixSeconds, limit]. */ params: [string, number, number]; } /** * Resolve an engine epoch query with the retrieval module's precedence: * request > per-standard config defaults > compiled fallback * (`nearest`, epoch = now, limit 50000). */ export declare function resolveEngineEpochQuery(options: { spec: EngineEpochProfileSpec; request?: EngineEpochQueryRequest | null; defaults?: EngineEpochProfileDefaults | null; nowSeconds?: (() => number) | null; }): EngineEpochQuery; export type EpochSqlProfile = 'epoch.day' | 'epoch.window' | 'epoch.as_of' | 'epoch.forward' | 'epoch.nearest' | 'epoch.coverage'; export interface EpochProfileSqlOptions { standardId: string; profile: EpochSqlProfile; day?: string | null; at?: string | null; from?: string | null; to?: string | null; maxDeltaSeconds?: number | null; entityId?: string | null; limit?: number | null; } export declare const EPOCH_SQL_PROFILES: Array<{ id: EpochSqlProfile; label: string; }>; export declare const EPOCH_SQL_PROFILE_DESCRIPTIONS: Record; export declare function buildEpochProfileSql(options: EpochProfileSqlOptions): string; //# sourceMappingURL=epoch-query-sql.d.ts.map