import { BaseApi } from "../base-api"; import type { NqlAst } from "./Ast"; import type { Nql, NqlBooleanExpression, NqlCompileResult, NqlExecuteRequest, NqlExecuteResponse, NqlExpression, NqlField, NqlFilterBinaryExpression, NqlFilterExpression, NqlFilterUnaryExpression, NqlQueryInput, NqlResult, NqlWhere } from "./types"; /** * A class for accessing the NQL API. * @extends BaseApi */ declare class NqlApi extends BaseApi { /** * Executes an NQL query and returns the result. * * @deprecated The API deprecates `POST nql/run` in favour of * {@link NqlApi.executeNqlStatement}, which posts to `v1/nql/execute`. The * two are not drop-in equivalents: the replacement returns a workflow and a * run id rather than a query result, so callers poll the run instead of * reading rows off the response. `nql/run` still works, and the API will * announce its removal separately. * * @param {string} nqlQuery - The NQL query to execute. * @returns {Promise} A promise that resolves with the result of the NQL query. * @see https://docs.narrative.io/reference/deprecations/nql-run * @see https://docs.narrative.io/api-reference/nql/run-a-nql-query */ executeNql(payload: NqlQueryInput): Promise; /** * Runs a mutating NQL statement as a workflow. * * Distinct from {@link NqlApi.executeNql}, which posts to `nql/run` and hands * back a query result. This one accepts `INSERT`, `UPDATE`, `DELETE`, * `EXPLAIN` and `CREATE MATERIALIZED VIEW`, compiles the statement into a * workflow, starts a run, and returns both. Nothing here says the statement * succeeded — poll the run for that. * * @param {NqlExecuteRequest} payload - The statement, and optionally the data * plane, compute pool, and `create_as_view` flag. * @returns {Promise} The created workflow and its run id. * Rejects with 400 if the statement fails to compile or is a kind this * endpoint cannot run. * @see https://docs.narrative.io/api-reference/nql/execute-an-nql-statement */ executeNqlStatement(payload: NqlExecuteRequest): Promise; /** * Compiles an NQL query and returns the result, including any errors. * * @param {string} nqlQuery - The NQL query to compile. * @returns {Promise} A promise that resolves with the result of the NQL compilation. */ compileNql(payload: NqlQueryInput): Promise; /** * Compiles an NQL query and returns the result, including any errors. * * @param {string} nqlQuery - The NQL query to compile. * @returns {Promise} A promise that resolves with the result of the NQL compilation. */ parseNql(payload: NqlQueryInput): Promise; /** * Validates an NQL query and returns an abstract syntax tree (AST) representing a structured form of * the query. * * @param {string} nqlQuery - The NQL query to validate. * @returns {Promise} A promise that resolves with the result of the NQL validation. */ validateNql(payload: NqlQueryInput): Promise; /** * Gets an existing NQL query by it's id * * @param {string} id - The id for the NQL query to return. * @returns {Promise} A promise that resolves with the result of the NQL query. */ getNqlByJobId(id: string): Promise; } export * from "./Ast"; export * from "./AstParser"; export * from "./NqlBuilder"; export { type Nql, NqlApi, type NqlBooleanExpression, type NqlCompileResult, type NqlExecuteRequest, type NqlExecuteResponse, type NqlExpression, type NqlField, type NqlFilterBinaryExpression, type NqlFilterExpression, type NqlFilterUnaryExpression, type NqlQueryInput, type NqlResult, type NqlWhere, };