@elgato/cli 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,328 @@
1
+ /**
2
+ * An object that references a location.
3
+ */
4
+ type LocationRef<T extends JsonLocation | Location = Location> = {
5
+ /**
6
+ * The location this instance references.
7
+ */
8
+ location?: T;
9
+ };
10
+ /**
11
+ * Location of an item within a file.
12
+ */
13
+ type Location = {
14
+ /**
15
+ * Column number.
16
+ */
17
+ column?: number;
18
+ /**
19
+ * Identifies the location within the file, for example the property reference for a JSON error.
20
+ */
21
+ key: string | undefined;
22
+ /**
23
+ * Line number.
24
+ */
25
+ line?: number;
26
+ };
27
+ /**
28
+ * Location of a JSON value within a file.
29
+ */
30
+ type JsonLocation = Location & {
31
+ /**
32
+ * JSON pointer to the value.
33
+ */
34
+ instancePath: string;
35
+ };
36
+
37
+ /**
38
+ * Provides information about a validation entry.
39
+ */
40
+ declare class ValidationEntry {
41
+ readonly level: ValidationLevel;
42
+ readonly message: string;
43
+ readonly details?: ValidationEntryDetails | undefined;
44
+ /**
45
+ * Location of the validation entry, represented as a string in the format {line}:{column}.
46
+ */
47
+ readonly location: string;
48
+ /**
49
+ * Initializes a new instance of the {@link ValidationEntry} class.
50
+ * @param level Severity level of the entry.
51
+ * @param message Validation message.
52
+ * @param details Supporting optional details.
53
+ */
54
+ constructor(level: ValidationLevel, message: string, details?: ValidationEntryDetails | undefined);
55
+ /**
56
+ * Converts the entry to a summary string.
57
+ * @param padding Optional padding required to align the position of each entry.
58
+ * @returns String that represents the entry.
59
+ */
60
+ toSummary(padding?: number): string;
61
+ }
62
+ /**
63
+ * Levels of validation.
64
+ */
65
+ declare enum ValidationLevel {
66
+ /**
67
+ * Error.
68
+ */
69
+ error = 0,
70
+ /**
71
+ * Warning.
72
+ */
73
+ warning = 1
74
+ }
75
+ /**
76
+ * Optional details associated with the validation entry.
77
+ */
78
+ type ValidationEntryDetails = LocationRef & {
79
+ /**
80
+ * Optional suggestion to fix the validation entry.
81
+ */
82
+ suggestion?: string;
83
+ };
84
+
85
+ /**
86
+ * An ordered array; items pushed onto the array are inserted in the sort ordered as defined by the `compareOn` delegates provided in the constructor.
87
+ */
88
+ declare class OrderedArray<T> extends Array<T> {
89
+ #private;
90
+ /**
91
+ * Initializes a new instance of the {@link OrderedArray} class.
92
+ * @param compareOn Delegates responsible for determining the sort order.
93
+ */
94
+ constructor(...compareOn: ((value: T) => number | string)[]);
95
+ /**
96
+ * "Pushes" the specified {@link value} in a sorted order.
97
+ * @param value Value to push.
98
+ * @returns New length of the array.
99
+ */
100
+ push(value: T): number;
101
+ }
102
+
103
+ /**
104
+ * Options associated with a {@link ConsoleStdOut}.
105
+ */
106
+ type ConsoleStdOutOptions = {
107
+ /**
108
+ * Determines whether the standard output stream is interactive.
109
+ */
110
+ interactive: boolean;
111
+ /**
112
+ * The minimum {@link MessageLevel} to write.
113
+ */
114
+ level: MessageLevel;
115
+ /**
116
+ * Determines whether the standard output stream should display non-essential motion, e.g. spinning bars.
117
+ */
118
+ reduceMotion: boolean;
119
+ };
120
+ /**
121
+ * Provides interactive console writer that writes to the stdout, including a spinner and status results.
122
+ */
123
+ type StdOut = ConsoleStdOut;
124
+ /**
125
+ * Provides interactive console writer that writes to the stdout, including a spinner and status results.
126
+ */
127
+ declare class ConsoleStdOut {
128
+ private readonly options;
129
+ /**
130
+ * Private backing field for {@link ConsoleStdOut.isLoading}.
131
+ */
132
+ private _isLoading;
133
+ /**
134
+ * Current symbol index.
135
+ */
136
+ private index;
137
+ /**
138
+ * The active message associated with the task denoted by the spinner.
139
+ */
140
+ private message;
141
+ /**
142
+ * Identifies the timer responsible for displaying the spinning symbol.
143
+ */
144
+ private timerId?;
145
+ /**
146
+ * Initializes a new instance of the {@link ConsoleStdOut} class.
147
+ * @param options Options associated with this instance.
148
+ */
149
+ constructor(options: ConsoleStdOutOptions);
150
+ /**
151
+ * Gets a value that determines whether there is active loading-feedback, e.g. spinning ({@link ConsoleStdOut.spin}) due to a task running.
152
+ * @returns `true` when the feedback is spinning; otherwise `false`.
153
+ */
154
+ get isLoading(): boolean;
155
+ /**
156
+ * Display the {@link message} as an error message, and stops any current interactive feedback (spinners).
157
+ * @param message Optional text to display.
158
+ * @returns An error reporter capable of outputting more detailed information.
159
+ */
160
+ error(message?: string): ErrorReporter;
161
+ /**
162
+ * Exits the process.
163
+ * @param code Optional exit code.
164
+ */
165
+ exit(code?: number): never;
166
+ /**
167
+ * Display the {@link message} as an informational message, and stops any current interactive feedback (spinners).
168
+ * @param message Optional text to display.
169
+ * @returns This instance for chaining.
170
+ */
171
+ info(message?: string): this;
172
+ /**
173
+ * Logs the specified {@link message} to the console.
174
+ * @param message Message to write.
175
+ * @returns This instance for chaining.
176
+ */
177
+ log(message?: unknown): this;
178
+ /**
179
+ * Displays an interactive spinner and the {@link message}.
180
+ * @param message Text to show next to the spinner.
181
+ * @param task Task that the spinner represents.
182
+ * @returns A promise fulfilled when the {@link task} completes.
183
+ */
184
+ spin(message: string, task?: (writer: ConsoleStdOut) => Promise<number | void> | void): Promise<void>;
185
+ /**
186
+ * Display the {@link message} as a success message, and stops any current interactive feedback (spinners).
187
+ * @param message Optional text to display.
188
+ * @returns This instance for chaining.
189
+ */
190
+ success(message?: string): this;
191
+ /**
192
+ * Display the {@link message} as a warning message, and stops any current interactive feedback (spinners).
193
+ * @param message Optional text to display.
194
+ * @returns This instance for chaining.
195
+ */
196
+ warn(message?: string): this;
197
+ /**
198
+ * Gets the symbol associated with the {@link level}.
199
+ * @param level Message level.
200
+ * @returns Associated symbol that denotes the {@link level} as an icon.
201
+ */
202
+ private getSymbol;
203
+ /**
204
+ * Starts the spinner.
205
+ */
206
+ private startSpinner;
207
+ /**
208
+ * Writes the message; when there is an active spinner, it is stopped and the message is associated with the task that was running.
209
+ * @param param0 Message to display.
210
+ * @param param0.level The {@link MessageLevel} associated with the message.
211
+ * @param param0.text Text to write.
212
+ * @returns This instance for chaining.
213
+ */
214
+ private stopAndWrite;
215
+ }
216
+ /**
217
+ * Provides logging and exiting facilities as part of reporting an error.
218
+ */
219
+ declare class ErrorReporter {
220
+ /**
221
+ * Determines whether a message has been logged; the first log is yellow.
222
+ */
223
+ private hasMessageBeenLogged;
224
+ /**
225
+ * Exits the process.
226
+ * @param code Optional exit code.
227
+ */
228
+ exit(code?: number): never;
229
+ /**
230
+ * Logs a message to the console; if this is the first message as part of the reporter, the message will be highlighted in yellow.
231
+ * @param message Message to log.
232
+ * @returns This instance for chaining.
233
+ */
234
+ log(message: unknown): this;
235
+ }
236
+ /**
237
+ * Levels of logging used by {@link ConsoleStdOut}.
238
+ */
239
+ declare enum MessageLevel {
240
+ /**
241
+ * Error message used to indicate an error was thrown, or something critically went wrong.
242
+ */
243
+ ERROR = 0,
244
+ /**
245
+ * Warning message used to indicate something went wrong, but the application is able to recover.
246
+ */
247
+ WARN = 1,
248
+ /**
249
+ * Success message that indicates the completion of a task or operation
250
+ */
251
+ SUCCESS = 2,
252
+ /**
253
+ * Information message for general usage.
254
+ */
255
+ INFO = 3,
256
+ /**
257
+ * Miscellaneous information that is not represented by a symbol.
258
+ */
259
+ LOG = 4
260
+ }
261
+
262
+ /**
263
+ * Provides validation results for a specific file path.
264
+ */
265
+ declare class FileValidationResult extends OrderedArray<ValidationEntry> {
266
+ #private;
267
+ readonly path: string;
268
+ /**
269
+ * Initializes a new instance of the {@link FileValidationResult} class.
270
+ * @param path Path that groups the entries together.
271
+ */
272
+ constructor(path: string);
273
+ /**
274
+ * Adds the specified {@link entry} to the collection.
275
+ * @param entry Entry to add.
276
+ * @returns New length of the validation results.
277
+ */
278
+ push(entry: ValidationEntry): number;
279
+ /**
280
+ * Writes the entry collection to the {@link output}.
281
+ * @param output Output to write to.
282
+ */
283
+ writeTo(output: StdOut): void;
284
+ }
285
+
286
+ /**
287
+ * Validation result containing a collection of {@link FileValidationResult} grouped by the directory or file path they're associated with.
288
+ */
289
+ declare class ValidationResult extends Array<FileValidationResult> implements ReadonlyArray<FileValidationResult> {
290
+ /**
291
+ * Private backing field for {@link Result.errorCount}.
292
+ */
293
+ private errorCount;
294
+ /**
295
+ * Private backing field for {@link Result.warningCount}.
296
+ */
297
+ private warningCount;
298
+ /**
299
+ * Adds a new validation entry to the result.
300
+ * @param path Directory or file path the entry is associated with.
301
+ * @param entry Validation entry.
302
+ */
303
+ add(path: string, entry: ValidationEntry): void;
304
+ /**
305
+ * Determines whether the result contains errors.
306
+ * @returns `true` when the result has errors.
307
+ */
308
+ hasErrors(): boolean;
309
+ /**
310
+ * Determines whether the result contains warnings.
311
+ * @returns `true` when the result has warnings.
312
+ */
313
+ hasWarnings(): boolean;
314
+ /**
315
+ * Writes the results to the specified {@link output}.
316
+ * @param output Output to write to.
317
+ */
318
+ writeTo(output: StdOut): void;
319
+ }
320
+
321
+ /**
322
+ * Validates the Stream Deck plugin as the specified {@link path}.
323
+ * @param path Path to the plugin.
324
+ * @returns The validation result.
325
+ */
326
+ declare function validatePlugin(path: string): Promise<ValidationResult>;
327
+
328
+ export { FileValidationResult, ValidationEntry, type ValidationEntryDetails, ValidationLevel, ValidationResult, validatePlugin as validateStreamDeckPlugin };