1 | import { JsonMap } from '@salesforce/ts-types';
|
2 | import { Logger } from '../logger';
|
3 | /**
|
4 | * Renders schema properties. By default, this is simply an identity transform. Subclasses may provide more
|
5 | * interesting decorations of each values, such as ANSI coloring.
|
6 | *
|
7 | * @deprecated
|
8 | */
|
9 | export declare class SchemaPropertyRenderer {
|
10 | /**
|
11 | * Renders a name.
|
12 | *
|
13 | * @param name The name value to render.
|
14 | */
|
15 | renderName(name: string): string;
|
16 | /**
|
17 | * Renders a title.
|
18 | *
|
19 | * @param title The title value to render.
|
20 | */
|
21 | renderTitle(title: string): string;
|
22 | /**
|
23 | * Renders a description.
|
24 | *
|
25 | * @param description The description value to render.
|
26 | */
|
27 | renderDescription(description: string): string;
|
28 | /**
|
29 | * Renders a type.
|
30 | *
|
31 | * @param propertyType The type value to render.
|
32 | */
|
33 | renderType(propertyType: string): string;
|
34 | }
|
35 | /**
|
36 | * Prints a JSON schema in a human-friendly format.
|
37 | *
|
38 | * @deprecated
|
39 | *
|
40 | * ```
|
41 | * import chalk from 'chalk';
|
42 | * class MyPropertyRenderer extends SchemaPropertyRenderer {
|
43 | * renderName(name) { return chalk.bold.blue(name); }
|
44 | * }
|
45 | *
|
46 | * const printer = new SchemaPrinter(logger, schema, new MyPropertyRenderer());
|
47 | * printer.getLines().forEach(console.log);
|
48 | * ```
|
49 | */
|
50 | export declare class SchemaPrinter {
|
51 | private schema;
|
52 | private propertyRenderer;
|
53 | private logger;
|
54 | private lines;
|
55 | /**
|
56 | * Constructs a new `SchemaPrinter`.
|
57 | *
|
58 | * @param logger The logger to use when emitting the printed schema.
|
59 | * @param schema The schema to print.
|
60 | * @param propertyRenderer The property renderer.
|
61 | */
|
62 | constructor(logger: Logger, schema: JsonMap, propertyRenderer?: SchemaPropertyRenderer);
|
63 | /**
|
64 | * Gets a read-only array of ready-to-display lines.
|
65 | */
|
66 | getLines(): readonly string[];
|
67 | /**
|
68 | * Gets a ready-to-display line by index.
|
69 | *
|
70 | * @param index The line index to get.
|
71 | */
|
72 | getLine(index: number): string;
|
73 | /**
|
74 | * Prints the accumulated set of schema lines as info log lines to the logger.
|
75 | */
|
76 | print(): void;
|
77 | private addFn;
|
78 | private parseProperty;
|
79 | }
|