import { Release } from '../lib/publish-package'; import { ValidationResult } from './contrext-guard'; declare type Ok> = { kind: 'ok'; type: T; data: D; }; export declare type Exception> = { kind: 'exception'; type: string; data: { summary: string; context: C; }; }; declare type Message = Ok | Exception; /** * Passthrough to the underlying output mechanism. */ export declare function outputRaw(message: string): void; declare type OutputOptions = { json: boolean; }; /** * This module encapsulates the various structures that dripip may output. * Precise data details stay local throughout the codebase but core concerns * like data envelop and serialization are encoded here. */ /** * Output Ok data to stdout. Use this to handle general output. */ export declare function outputOk(type: string, data: Record): void; /** * Outout Exception data to stdout. Unlike an error, exceptions are failure * scenarios that are known to be possible, and thus handled gracefully. * * @param identifier This is a meaningful exception slug like `no_permissions`. * Use this for to organize exeptions into a catalogue. * * @param summary Free form text that briefly explains what the exception * is, why it is happening, etc. Do not rely on rich context rendering here. * Instead prefer to put the data/variables at hand into the context object. * * @param context Arbitrary data that relates to the exception at hand. */ export declare function outputException(identifier: string, summary: string, opts: OutputOptions & { context: Record; }): void; export declare function output(message: Message, opts: OutputOptions): void; /** * See output version docs. */ export declare function createOk(type: T, data: Record): Ok; declare type DryRun = Ok<'dry_run'>; export declare function createDryRun(data: Record): DryRun; /** * See output version docs. */ export declare function createException(type: string, { summary, context, }: { summary: string; context?: Record; }): Exception; export declare function createDidNotPublish(data: { reasons: ValidationResult[]; }): Ok<"did_not_publish", Record>; export declare function createDidPublish(data: { release: Release; }): Ok<"did_publish", Record>; /** * Output Message to stdout. */ export declare function outputMessage(msg: Message): void; /** * Output JSON to stdout. */ export declare function outputJson(msg: object): void; export {}; //# sourceMappingURL=output.d.ts.map