/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { OptionType, StringType, StructType, VariantType, type ValueTypeOf } from "@elaraai/east"; import { SavedQueryType } from "@elaraai/e3-ui/internal"; /** * The query open in a builder. * * @property new - A query not yet saved: `id` tells it from every other new * query, so each keeps its own drafts; `source` is the data source it starts * from; `from`, when it begins as a run of this viewer's that was never * saved, is that run — its name, its description and its checked query * @property saved - A saved query, by its name */ export declare const QueryOpenType: VariantType<{ readonly new: StructType<{ readonly id: StringType; readonly source: StringType; readonly from: OptionType; readonly program: import("@elaraai/east").RecursiveType; readonly array: OptionType; readonly binary: StructType<{ readonly left: import("@elaraai/east").RecursiveTypeMarker; readonly op: StringType; readonly right: import("@elaraai/east").RecursiveTypeMarker; }>; readonly bind: StructType<{ readonly body: import("@elaraai/east").RecursiveTypeMarker; readonly patterns: import("@elaraai/east").ArrayType; readonly object: import("@elaraai/east").ArrayType; }>>; readonly variable: StringType; }>>>; readonly source: import("@elaraai/east").RecursiveTypeMarker; }>; readonly break: StringType; readonly call: StructType<{ readonly args: import("@elaraai/east").ArrayType; readonly name: StringType; }>; readonly comma: StructType<{ readonly left: import("@elaraai/east").RecursiveTypeMarker; readonly right: import("@elaraai/east").RecursiveTypeMarker; }>; readonly def: StructType<{ readonly body: import("@elaraai/east").RecursiveTypeMarker; readonly name: StringType; readonly params: import("@elaraai/east").ArrayType; readonly rest: import("@elaraai/east").RecursiveTypeMarker; }>; readonly descend: import("@elaraai/east").NullType; readonly field: StructType<{ readonly name: StringType; readonly optional: import("@elaraai/east").BooleanType; readonly target: import("@elaraai/east").RecursiveTypeMarker; }>; readonly foreach: StructType<{ readonly extract: OptionType; readonly init: import("@elaraai/east").RecursiveTypeMarker; readonly pattern: import("@elaraai/east").RecursiveType; readonly object: import("@elaraai/east").ArrayType; }>>; readonly variable: StringType; }>>; readonly source: import("@elaraai/east").RecursiveTypeMarker; readonly update: import("@elaraai/east").RecursiveTypeMarker; }>; readonly format: StructType<{ readonly name: StringType; readonly string: OptionType; }>; readonly identity: import("@elaraai/east").NullType; readonly if: StructType<{ readonly branches: import("@elaraai/east").ArrayType>; readonly otherwise: OptionType; }>; readonly index: StructType<{ readonly index: import("@elaraai/east").RecursiveTypeMarker; readonly optional: import("@elaraai/east").BooleanType; readonly target: import("@elaraai/east").RecursiveTypeMarker; }>; readonly iterate: StructType<{ readonly optional: import("@elaraai/east").BooleanType; readonly target: import("@elaraai/east").RecursiveTypeMarker; }>; readonly label: StructType<{ readonly body: import("@elaraai/east").RecursiveTypeMarker; readonly name: StringType; }>; readonly literal: VariantType<{ readonly boolean: import("@elaraai/east").BooleanType; readonly float: import("@elaraai/east").FloatType; readonly integer: import("@elaraai/east").IntegerType; readonly null: import("@elaraai/east").NullType; readonly string: StringType; }>; readonly negate: import("@elaraai/east").RecursiveTypeMarker; readonly object: import("@elaraai/east").ArrayType; readonly value: OptionType; }>>; readonly pipe: StructType<{ readonly left: import("@elaraai/east").RecursiveTypeMarker; readonly right: import("@elaraai/east").RecursiveTypeMarker; }>; readonly reduce: StructType<{ readonly init: import("@elaraai/east").RecursiveTypeMarker; readonly pattern: import("@elaraai/east").RecursiveType; readonly object: import("@elaraai/east").ArrayType; }>>; readonly variable: StringType; }>>; readonly source: import("@elaraai/east").RecursiveTypeMarker; readonly update: import("@elaraai/east").RecursiveTypeMarker; }>; readonly slice: StructType<{ readonly from: OptionType; readonly optional: import("@elaraai/east").BooleanType; readonly target: import("@elaraai/east").RecursiveTypeMarker; readonly to: OptionType; }>; readonly string: import("@elaraai/east").ArrayType>; readonly try: StructType<{ readonly body: import("@elaraai/east").RecursiveTypeMarker; readonly catch: OptionType; }>; readonly update: StructType<{ readonly op: StringType; readonly path: import("@elaraai/east").RecursiveTypeMarker; readonly value: import("@elaraai/east").RecursiveTypeMarker; }>; readonly variable: StringType; }>>; readonly root: import("@elaraai/east").ArrayType>; }>>; readonly saved_at: import("@elaraai/east").DateTimeType; }>>; }>; readonly saved: StringType; }>; /** The query open in a builder. */ export type QueryOpen = ValueTypeOf; /** * The notice a query arrived with. * * @property sourceId - The session of the query it arrived with ({@link querySourceId}) * @property text - What the Query tab says when that query opens */ export declare const QueryArrivalType: StructType<{ readonly sourceId: StringType; readonly text: StringType; }>; /** The notice a query arrived with. */ export type QueryArrival = ValueTypeOf; /** * The open query's editing session's source id — `query.saved:"Big orders"`, * or `query.new:"1"` — one session, and its drafts, per query. * * @param open - The open query * @returns Its source id */ export declare function querySourceId(open: QueryOpen): string; /** * A new query: on a data source, or begun as a run of this viewer's that was * never saved — its own id, so its drafts are its own. * * @param source - The data source it starts from * @param from - The run it begins as, when it does * @returns The query to open */ export declare function newQuery(source: string, from?: ValueTypeOf): QueryOpen; /** * Opens a query: writes it as the open query, with the notice it arrives with. * * @param next - The query to open * @param notice - What the Query tab says when it opens — none for a query opened without one */ export type OpenQueryWrite = (next: QueryOpen, notice?: string) => void; /** * The query open in the builder the key names, a way to open another, and the * notice the open query arrived with. * * @param key - The builder's open-query key * @param first - The query it opens before any is written — a new query on its first data source * @returns The open query; the write that opens another, with the notice it arrives with; and the last notice written */ export declare function useOpenQuery(key: string, first: QueryOpen): [QueryOpen, OpenQueryWrite, QueryArrival | undefined]; //# sourceMappingURL=open-query.d.ts.map