diff --git a/packages/context/src/daemon/semantic-layer-compute.ts b/packages/context/src/daemon/semantic-layer-compute.ts index d6e2f0b1..a48239eb 100644 --- a/packages/context/src/daemon/semantic-layer-compute.ts +++ b/packages/context/src/daemon/semantic-layer-compute.ts @@ -2,7 +2,7 @@ import { request as httpRequest } from 'node:http'; import { request as httpsRequest } from 'node:https'; import { URL } from 'node:url'; import { spawn } from 'node:child_process'; -import type { SemanticLayerQueryInput, SemanticLayerSource } from '../sl/index.js'; +import type { ResolvedSemanticLayerSource, SemanticLayerQueryInput } from '../sl/types.js'; export interface KtxSemanticLayerComputeQueryResult { sql: string; @@ -54,13 +54,21 @@ export interface KtxSemanticLayerSourceGenerationResult { } export interface KtxSemanticLayerComputePort { + /** + * Callers must pass sources sanitized through toResolvedWire. The Python + * daemon rejects authoring-only fields such as usage and inherits_columns_from. + */ query(input: { - sources: Array | SemanticLayerSource>; + sources: ResolvedSemanticLayerSource[]; query: SemanticLayerQueryInput; dialect: string; }): Promise; + /** + * Callers must pass sources sanitized through toResolvedWire. The Python + * daemon rejects authoring-only fields such as usage and inherits_columns_from. + */ validateSources(input: { - sources: Array | SemanticLayerSource>; + sources: ResolvedSemanticLayerSource[]; dialect: string; recentlyTouched?: string[]; }): Promise; diff --git a/packages/context/src/sl/local-query.ts b/packages/context/src/sl/local-query.ts index f5983892..eb1d8061 100644 --- a/packages/context/src/sl/local-query.ts +++ b/packages/context/src/sl/local-query.ts @@ -76,10 +76,10 @@ function resolveLocalConnectionId(project: KtxLocalProject, requested: string | async function loadComputableSources( project: KtxLocalProject, connectionId: string, -): Promise[]> { +): Promise[]> { return (await loadLocalSlSourceRecords(project, { connectionId: assertSafeConnectionId(connectionId) })) .filter((record) => record.source.table || record.source.sql) - .map((record) => toResolvedWire(record.source) as unknown as Record); + .map((record) => toResolvedWire(record.source)); } function headersFromColumns(columns: Array>): string[] {