/** * Strip ONE balanced pair of wrapping single/double quotes, if present. Unlike a * naive `^["']|["']$` strip, this leaves asymmetric or quote-bearing values intact * (e.g. `it's` or `abc"` are returned unchanged). */ export declare function stripWrappingQuotes(value: string): string; /** * Parse a date for a Merit query field. Accepts `YYYY-MM-DD` or `YYYYMMDD` and * returns Merit's wire format `YYYYMMDD`. Rejects non-calendar dates. */ export declare function parseDateYmd(value: string | undefined, flagName?: string): string | undefined; /** * Parse a Merit Palk date. Palk's wire format is `YYYY-MM-DD` (per the Palk * reference manual's Request Format table) — NOT Aktiva's compact `YYYYMMDD`. * Accepts `YYYY-MM-DD` or `YYYYMMDD` input and returns `YYYY-MM-DD`. */ export declare function parseDateIso(value: string | undefined, flagName?: string): string | undefined; /** * Parse a Merit Palk accounting month. Wire format is `YYYYMM` (6 digits, e.g. * 202401 for January 2024). Accepts `YYYY-MM` or `YYYYMM` and returns `YYYYMM`. */ export declare function parseYearMonth(value: string | undefined, flagName?: string): string | undefined; /** Parse a positive integer flag (no upper cap). Returns defaultValue when unset. */ export declare function parsePositiveInt(value: string | undefined, flagName: string, defaultValue?: number): number | undefined; /** * Parse a non-negative integer flag (0 allowed; no upper cap). Returns defaultValue when unset. * Use for enum-style flags whose lowest valid value is 0 — e.g. Merit `DateType` (0 = document * date, 1 = changed date), which `parsePositiveInt` would wrongly reject. */ export declare function parseNonNegativeInt(value: string | undefined, flagName: string, defaultValue?: number): number | undefined; /** * Parse a decimal/number flag. Returns undefined when unset. Accepts a plain decimal * (optional sign, digits, optional fraction) — rejects empty/whitespace, hex (`0x10`), * and exponent (`1e3`) forms that `Number()` would silently coerce. Important for money * fields, where an empty value must error rather than become 0. */ export declare function parseDecimal(value: string | undefined, flagName: string): number | undefined; /** * Parse a boolean flag value that may arrive as a string. Accepts true/false, * 1/0, yes/no (case-insensitive). Returns undefined when unset. */ export declare function parseBool(value: string | boolean | undefined, flagName: string): boolean | undefined; /** * Read a JSON request body from `--data ` (inline string) or * `--file ` (path to a .json file). Returns the parsed object, or * undefined if neither is provided. Throws ValidationError on invalid JSON or * an unreadable file. * * Merit's create/send endpoints take rich, nested bodies (invoices with line * rows + tax arrays, GL batches, etc.). Rather than flatten every field into a * flag, those commands accept the documented JSON body directly via --data/--file. */ export declare function readJsonBody(opts: { data?: string; file?: string; }): unknown | undefined; /** * Read a RAW (non-JSON) request body from `--file ` (preferred) or * `--data `. For endpoints that take verbatim XML (e-invoice import, * camt.053 statement import) — unlike readJsonBody, the content is returned * as-is, never parsed. Throws ValidationError if neither flag is set or the * file is unreadable. `what` names the expected content in error messages. */ export declare function readRawBody(opts: { data?: string; file?: string; }, what?: string): string; /** * Resolve a request body for a create/send command: prefer the explicit JSON * body (--data/--file); otherwise fall back to a body assembled from flags. * Throws if the resulting body has no fields and one is required. * * `mergeFlags`: when true and the JSON body is a plain object, the flag-derived * values are merged in as defaults BENEATH the JSON body (the body wins on key * conflicts). Use it for `` commands so the positional Id (and similar identity * flags) survive even when the caller passes --data/--file without repeating it — * otherwise the explicit body would silently drop the target Id. Default false keeps * the "--data overrides flags" behavior for value-only commands. */ export declare function resolveBody(jsonBody: unknown | undefined, fromFlags: Record, { required, mergeFlags }?: { required?: boolean; mergeFlags?: boolean; }): unknown; /** Guard: throws if `--yes` isn't set on a destructive command. */ export declare function requireYes(opts: Record, action: string): void;