/** * Output text formatting — case transforms + positional mask. * * Pure string → string functions shared by three call sites: `compute` tags * (``/``/…), `` `case=`/`mask=` attributes, and `${{… | …}}` * interpolation filters. See * docs/specs/2026-07-18-output-formatting-and-ordering-design.md. */ export declare const CASE_TRANSFORMS: readonly ["upper", "lower", "capitalize", "title"]; /** * Build the per-value formatter for a gen's `mask=`/`case=` attributes (mask * first, then case), or `undefined` if neither applies. Used as a post-processor * in both the in-memory and streaming engines. */ export declare function genFormatter(mask: string | undefined, kase: string | undefined): ((v: string) => string) | undefined; export type CaseTransform = (typeof CASE_TRANSFORMS)[number]; /** True if `name` is one of the four case transforms. */ export declare function isCaseTransform(name: string): name is CaseTransform; /** Apply a case transform. `capitalize`/`title` leave non-first chars unchanged. */ export declare function applyCase(name: string, s: string): string; /** Substring by code-point index, `[from, to)`; `to` omitted means to the end. */ export declare function applySlice(s: string, from: number, to?: number): string; /** Replace every occurrence of `from` with `to`. */ export declare function applyReplace(s: string, from: string, to: string): string; /** Strip leading/trailing whitespace. */ export declare function applyTrim(s: string): string; /** Group characters from the RIGHT into chunks of `size`, joined by `sep`. */ export declare function applyGroup(s: string, size: number, sep: string): string; /** All interpolation-filter / formatting names, for validation. */ export declare const FILTER_NAMES: readonly ["upper", "lower", "capitalize", "title", "mask", "slice", "replace", "trim", "group", "compact", "csv", "sql", "json"]; /** True if `name` is a known interpolation filter. */ export declare function isFilterName(name: string): boolean; /** * Apply one interpolation filter `kind` (with its raw `arg`) to `value`. Unknown * filters are a no-op (the validator flags the typo). Arg formats: `mask:PATTERN`, * `slice:from[,to]`, `replace:from,to`, `trim`, `group:size[,sep]` (sep default * space), and the four case transforms (no arg). */ export declare function applyFilter(kind: string, arg: string | undefined, value: string): string; /** * Apply a positional mask (spec docs/specs/2026-07-23-mask-positional-reordering.md). * * `x` — one character, `w` — one word (+ swallow one whitespace), `*` — everything * not yet consumed; a backslash escapes the next character; every other character * is a literal. * * `x[i]` / `w[i]` address the ORIGINAL input, 0-based, negative from the end, * `a..b` inclusive. Two channels that do not interfere: what an index EMITS never * depends on consumption, and consumption only decides what the bare `x`/`w`/`*` * have left. So the same notation reads as a move when nothing else picks that * position up, and as a copy when something does. * * Lenient by design: an out-of-range index emits nothing, silently — the input * length is unknown until render time, so there is nothing to validate against, * and aborting a million-row run over one short value is worse than a gap. */ export declare function applyMask(pattern: string, input: string): string; /** * Render a whole number in a shorter alphabet — `1000000` becomes `lfls`. * * The point is a unique suffix that stays readable at scale: a row id appended * to a generated email keeps it unique, but `john.smith2000000000@` is nobody's * address. In base 36 the same id is `x2qxvk`, and six characters carry over * two billion rows. * * LOWERCASE only, and deliberately so. Base 62 would be shorter still, but many * systems fold the local part of an address to lower case — `aB` and `Ab` would * merge and silently reintroduce exactly the duplicates the suffix exists to * prevent. * * A value that is not a whole number passes through untouched. Filters here are * lenient by design; the validator is where a mistake gets named. */ export declare function applyCompact(value: string, base: number): string; /** * Quote a value for CSV per RFC 4180: wrap in quotes and double any inside. * * `` assembles TEXT and knows nothing about the file being written, so a * value carrying the delimiter silently splits the row. Measured on a real * catalogue: one product named `Набор ножей, 3 шт` turned 6172 of 50 000 rows * into eight fields where the header declares seven — category landing in * price, price in quantity — with no error and nothing visibly wrong. * * Quoting unconditionally rather than only when needed: a rule with no * exceptions is one nobody has to remember, every CSV reader accepts redundant * quotes, and "only when it contains a comma" is exactly the reasoning that * loses to a newline or a quote later. * * `arg` names the delimiter for a non-comma file (`csv:;`) — it does not change * the output today, but it documents intent at the call site and keeps the door * open for a smarter rule. */ export declare function applyCsv(value: string, _delimiter: string): string; /** * Escape a value for a single-quoted SQL literal by doubling apostrophes. * * `O'Brien` closes the string early and the statement fails to parse — or, far * worse in generated data, parses into something else. Emits the BODY only, no * surrounding quotes, so the caller keeps writing `'${{Name|sql}}'` and the * shape of the statement stays visible in the config. */ export declare function applySql(value: string): string; /** * A value as a complete JSON value: a quoted, escaped string, or `null` when the cell is empty. * * With a separator (`json:;`) the cell is a LIST — a `repeat=` column joined with that * separator — and comes out as an array of strings, `[]` when empty. Elements are trimmed, since * an argument cannot carry the space of a `", "` separator. * * Without it a name with a quote or a backslash in it broke the document, and the docs could only * suggest `replace`, one character at a time. Written by hand rather than with * `JSON.stringify`: the five implementations must agree byte for byte, and their JSON libraries * do not — which characters get `\u` escapes differs from one to the next. */ export declare function applyJson(value: string, separator: string | undefined): string; //# sourceMappingURL=transforms.d.ts.map