/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * Editing steps (#933): pure functions from a query to a new one, every value * built with East's constructors; the fixes the check offers, applied; and a * new step of each kind with its defaults (`Query Editor Spec.md` §4.4). * * @packageDocumentation */ import { type EastType, type option } from "@elaraai/east"; import type { StepFix } from "./check.js"; import { type Shape } from "./shape.js"; import { type Condition, type Match, type Step, type StepKind, type StepQuery, type StepValue } from "./values.js"; /** * An empty test, its slots not chosen. * * @param id - its id; a fresh one when omitted * @returns the condition */ export declare function emptyCondition(id?: string): Condition; /** * A query with a step inserted. * * @param query - the query * @param step - the step * @param at - where: before the step at this index; at the end when omitted * @returns the new query */ export declare function insertStep(query: StepQuery, step: Step, at?: number): StepQuery; /** A query without a step. */ export declare function removeStep(query: StepQuery, stepId: string): StepQuery; /** * A query with a step moved. * * @param query - the query * @param stepId - the step * @param by - how many places, up (negative) or down; a move past an end is no move * @returns the new query */ export declare function moveStep(query: StepQuery, stepId: string, by: number): StepQuery; /** A query with a step replaced whole: the step given keeps its place. */ export declare function updateStep(query: StepQuery, stepId: string, step: Step): StepQuery; /** * A query with an empty condition added to a filter, or to a group in it. * * @param query - the query * @param stepId - the filter * @param groupId - the group; the filter itself when omitted * @param id - the new condition's id; a fresh one when omitted * @returns the new query */ export declare function addCondition(query: StepQuery, stepId: string, groupId?: string, id?: string): StepQuery; /** * A query with a group added to a filter, or to a group in it: the opposite * match to where it is, with two empty conditions. * * @param query - the query * @param stepId - the filter * @param groupId - the group it goes in; the filter itself when omitted * @returns the new query */ export declare function addGroup(query: StepQuery, stepId: string, groupId?: string): StepQuery; /** A query without a condition, wherever it is in a filter. */ export declare function removeCondition(query: StepQuery, stepId: string, condId: string): StepQuery; /** * A query with a filter's or a group's match changed. A group inside it of * the same match is no group any more, and its conditions join it. * * @param query - the query * @param stepId - the filter * @param groupId - the group; the filter itself when omitted * @param match - the new match * @returns the new query */ export declare function setMatch(query: StepQuery, stepId: string, groupId: string | undefined, match: Match): StepQuery; /** A query with a condition's value set. */ export declare function setConditionValue(query: StepQuery, stepId: string, condId: string, value: option): StepQuery; /** * A query with a condition's field set. A new field of the kind the old one * was (a whole number and a number are one kind here) keeps the comparison * and the value; another starts from its own comparison (is in year for a * date, has at least 1 for a list, …). * * @param query - the query * @param stepId - the filter * @param condId - the condition * @param field - the new field's ref * @param root - the root's type * @returns the new query */ export declare function setConditionField(query: StepQuery, stepId: string, condId: string, field: string, root: EastType): StepQuery; /** * A query with a fix the check offers applied. * * @param query - the query * @param fix - the fix * @param root - the root's type * @returns the new query * * @remarks * Keep only a case's rows first puts `field is case` at the front of the * filter the problem is in (in place of a case test of that field), and an * any filter becomes all of it and the old conditions as a group; for a step * of another kind, a filter of it goes before the step. */ export declare function applyFix(query: StepQuery, fix: StepFix, root: EastType): StepQuery; /** * A new step of a kind, with the defaults it starts with * (`Query Editor Spec.md` §4.4). * * @param kind - the kind of step * @param before - the shape of the rows it will take * @param root - the root's type, whose lookup tables a Look up starts from * @returns the step, with fresh ids */ export declare function newStep(kind: StepKind, before: Shape, root: EastType): Step; //# sourceMappingURL=edit.d.ts.map