/** * `select` for the SDK CLI's machine-mode envelopes, applied by the tools rather * than the CLI. * * The CLI applies `--select` to failure envelopes too (`@servicenow/sdk-cli` * `util/json-select.js` `printMachineEnvelope`), so a failed call printed only the * selected value, usually `null`, and its reason was lost. For `exec` that also hid * whether the script ran at all. The tools therefore never forward `--select`: they * request the full JSON envelope and apply the path here, to a successful * (`ok: true`) result only. A failure keeps its full envelope. * * An envelope cut by the runner's output cap cannot be parsed, so these commands * capture stdout with `ENVELOPE_RUN_OPTIONS` and bound the shaped result to the * normal size only afterwards (`shapeEnvelopeResult`). */ import { CommandResult, ProcessRunOptions } from './types.js'; /** Process options for a command whose stdout is a JSON envelope to be read whole. */ export declare const ENVELOPE_RUN_OPTIONS: ProcessRunOptions; /** * Resolve a dot/bracket path against a JSON value, exactly as the CLI's * `resolveJsonPath` does; an unresolvable path yields undefined. */ export declare function resolveJsonPath(value: unknown, path: string): unknown; /** * Format a selected value as the CLI prints it: compact JSON (`undefined` as * `null`), or with `raw`, strings unquoted and `undefined` as empty. */ export declare function formatSelectedValue(value: unknown, raw: boolean): string; /** * Replace a successful command's envelope output with the value at `select`. * The result is returned unchanged when no path is given, the command failed, * or the output is not an `ok: true` envelope, so a failure is always reported * with its full envelope. An envelope the runner cut is reported as such * instead of being returned as broken JSON. * @param result The command result whose output is the CLI's JSON envelope * @param select The dot/bracket path, if the caller supplied one * @param raw Print a selected string unquoted (the CLI's `--output raw`) */ export declare function applySelect(result: CommandResult, select: unknown, raw?: boolean): CommandResult; /** * Apply `select`, then bound the output and error message to the normal size. * Run on a result captured with `ENVELOPE_RUN_OPTIONS`. */ export declare function shapeEnvelopeResult(result: CommandResult, select: unknown, raw?: boolean): CommandResult; //# sourceMappingURL=jsonSelect.d.ts.map