@shopify/cli-kit 0.33.1 → 0.33.5
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.
- package/CHANGELOG.md +18 -0
- package/dist/{index-8420b891.js → index-a04aadf7.js} +13491 -14839
- package/dist/index-a04aadf7.js.map +1 -0
- package/dist/index.d.ts +1710 -62
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/dist/{multipart-parser-3fcf3810.js → multipart-parser-3e0627f2.js} +4 -6
- package/dist/multipart-parser-3e0627f2.js.map +1 -0
- package/package.json +14 -13
- package/dist/index-8420b891.js.map +0 -1
- package/dist/multipart-parser-3fcf3810.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,45 +1,1421 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { Readable } from 'stream';
|
|
2
4
|
import { Writable } from 'node:stream';
|
|
3
|
-
import open from 'open';
|
|
4
5
|
import path$1 from 'path';
|
|
5
6
|
import * as fs from 'fs';
|
|
6
|
-
import {
|
|
7
|
+
import { platform } from 'node:process';
|
|
7
8
|
import { RequestOptions } from 'http';
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Represents a disposable resource, such as the execution of an Observable. A
|
|
12
|
+
* Subscription has one important method, `unsubscribe`, that takes no argument
|
|
13
|
+
* and just disposes the resource held by the subscription.
|
|
14
|
+
*
|
|
15
|
+
* Additionally, subscriptions may be grouped together through the `add()`
|
|
16
|
+
* method, which will attach a child Subscription to the current Subscription.
|
|
17
|
+
* When a Subscription is unsubscribed, all its children (and its grandchildren)
|
|
18
|
+
* will be unsubscribed as well.
|
|
19
|
+
*
|
|
20
|
+
* @class Subscription
|
|
21
|
+
*/
|
|
22
|
+
declare class Subscription implements SubscriptionLike {
|
|
23
|
+
private initialTeardown?;
|
|
24
|
+
/** @nocollapse */
|
|
25
|
+
static EMPTY: Subscription;
|
|
26
|
+
/**
|
|
27
|
+
* A flag to indicate whether this Subscription has already been unsubscribed.
|
|
28
|
+
*/
|
|
29
|
+
closed: boolean;
|
|
30
|
+
private _parentage;
|
|
31
|
+
/**
|
|
32
|
+
* The list of registered teardowns to execute upon unsubscription. Adding and removing from this
|
|
33
|
+
* list occurs in the {@link #add} and {@link #remove} methods.
|
|
34
|
+
*/
|
|
35
|
+
private _teardowns;
|
|
36
|
+
/**
|
|
37
|
+
* @param initialTeardown A function executed first as part of the teardown
|
|
38
|
+
* process that is kicked off when {@link #unsubscribe} is called.
|
|
39
|
+
*/
|
|
40
|
+
constructor(initialTeardown?: (() => void) | undefined);
|
|
41
|
+
/**
|
|
42
|
+
* Disposes the resources held by the subscription. May, for instance, cancel
|
|
43
|
+
* an ongoing Observable execution or cancel any other type of work that
|
|
44
|
+
* started when the Subscription was created.
|
|
45
|
+
* @return {void}
|
|
46
|
+
*/
|
|
47
|
+
unsubscribe(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Adds a teardown to this subscription, so that teardown will be unsubscribed/called
|
|
50
|
+
* when this subscription is unsubscribed. If this subscription is already {@link #closed},
|
|
51
|
+
* because it has already been unsubscribed, then whatever teardown is passed to it
|
|
52
|
+
* will automatically be executed (unless the teardown itself is also a closed subscription).
|
|
53
|
+
*
|
|
54
|
+
* Closed Subscriptions cannot be added as teardowns to any subscription. Adding a closed
|
|
55
|
+
* subscription to a any subscription will result in no operation. (A noop).
|
|
56
|
+
*
|
|
57
|
+
* Adding a subscription to itself, or adding `null` or `undefined` will not perform any
|
|
58
|
+
* operation at all. (A noop).
|
|
59
|
+
*
|
|
60
|
+
* `Subscription` instances that are added to this instance will automatically remove themselves
|
|
61
|
+
* if they are unsubscribed. Functions and {@link Unsubscribable} objects that you wish to remove
|
|
62
|
+
* will need to be removed manually with {@link #remove}
|
|
63
|
+
*
|
|
64
|
+
* @param teardown The teardown logic to add to this subscription.
|
|
65
|
+
*/
|
|
66
|
+
add(teardown: TeardownLogic): void;
|
|
67
|
+
/**
|
|
68
|
+
* Checks to see if a this subscription already has a particular parent.
|
|
69
|
+
* This will signal that this subscription has already been added to the parent in question.
|
|
70
|
+
* @param parent the parent to check for
|
|
71
|
+
*/
|
|
72
|
+
private _hasParent;
|
|
73
|
+
/**
|
|
74
|
+
* Adds a parent to this subscription so it can be removed from the parent if it
|
|
75
|
+
* unsubscribes on it's own.
|
|
76
|
+
*
|
|
77
|
+
* NOTE: THIS ASSUMES THAT {@link _hasParent} HAS ALREADY BEEN CHECKED.
|
|
78
|
+
* @param parent The parent subscription to add
|
|
79
|
+
*/
|
|
80
|
+
private _addParent;
|
|
81
|
+
/**
|
|
82
|
+
* Called on a child when it is removed via {@link #remove}.
|
|
83
|
+
* @param parent The parent to remove
|
|
84
|
+
*/
|
|
85
|
+
private _removeParent;
|
|
86
|
+
/**
|
|
87
|
+
* Removes a teardown from this subscription that was previously added with the {@link #add} method.
|
|
88
|
+
*
|
|
89
|
+
* Note that `Subscription` instances, when unsubscribed, will automatically remove themselves
|
|
90
|
+
* from every other `Subscription` they have been added to. This means that using the `remove` method
|
|
91
|
+
* is not a common thing and should be used thoughtfully.
|
|
92
|
+
*
|
|
93
|
+
* If you add the same teardown instance of a function or an unsubscribable object to a `Subcription` instance
|
|
94
|
+
* more than once, you will need to call `remove` the same number of times to remove all instances.
|
|
95
|
+
*
|
|
96
|
+
* All teardown instances are removed to free up memory upon unsubscription.
|
|
97
|
+
*
|
|
98
|
+
* @param teardown The teardown to remove from this subscription
|
|
99
|
+
*/
|
|
100
|
+
remove(teardown: Exclude<TeardownLogic, void>): void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/// <reference lib="esnext.asynciterable" />
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Note: This will add Symbol.observable globally for all TypeScript users,
|
|
107
|
+
* however, we are no longer polyfilling Symbol.observable
|
|
108
|
+
*/
|
|
109
|
+
declare global {
|
|
110
|
+
interface SymbolConstructor {
|
|
111
|
+
readonly observable: symbol;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/** OPERATOR INTERFACES */
|
|
115
|
+
interface UnaryFunction<T, R> {
|
|
116
|
+
(source: T): R;
|
|
117
|
+
}
|
|
118
|
+
interface OperatorFunction<T, R> extends UnaryFunction<Observable<T>, Observable<R>> {
|
|
119
|
+
}
|
|
120
|
+
/** SUBSCRIPTION INTERFACES */
|
|
121
|
+
interface Unsubscribable {
|
|
122
|
+
unsubscribe(): void;
|
|
123
|
+
}
|
|
124
|
+
declare type TeardownLogic = Subscription | Unsubscribable | (() => void) | void;
|
|
125
|
+
interface SubscriptionLike extends Unsubscribable {
|
|
126
|
+
unsubscribe(): void;
|
|
127
|
+
readonly closed: boolean;
|
|
128
|
+
}
|
|
129
|
+
/** OBSERVABLE INTERFACES */
|
|
130
|
+
interface Subscribable<T> {
|
|
131
|
+
subscribe(observer: Partial<Observer<T>>): Unsubscribable;
|
|
132
|
+
}
|
|
133
|
+
interface Observer<T> {
|
|
134
|
+
next: (value: T) => void;
|
|
135
|
+
error: (err: any) => void;
|
|
136
|
+
complete: () => void;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Implements the {@link Observer} interface and extends the
|
|
141
|
+
* {@link Subscription} class. While the {@link Observer} is the public API for
|
|
142
|
+
* consuming the values of an {@link Observable}, all Observers get converted to
|
|
143
|
+
* a Subscriber, in order to provide Subscription-like capabilities such as
|
|
144
|
+
* `unsubscribe`. Subscriber is a common type in RxJS, and crucial for
|
|
145
|
+
* implementing operators, but it is rarely used as a public API.
|
|
146
|
+
*
|
|
147
|
+
* @class Subscriber<T>
|
|
148
|
+
*/
|
|
149
|
+
declare class Subscriber<T> extends Subscription implements Observer<T> {
|
|
150
|
+
/**
|
|
151
|
+
* A static factory for a Subscriber, given a (potentially partial) definition
|
|
152
|
+
* of an Observer.
|
|
153
|
+
* @param next The `next` callback of an Observer.
|
|
154
|
+
* @param error The `error` callback of an
|
|
155
|
+
* Observer.
|
|
156
|
+
* @param complete The `complete` callback of an
|
|
157
|
+
* Observer.
|
|
158
|
+
* @return A Subscriber wrapping the (partially defined)
|
|
159
|
+
* Observer represented by the given arguments.
|
|
160
|
+
* @nocollapse
|
|
161
|
+
* @deprecated Do not use. Will be removed in v8. There is no replacement for this
|
|
162
|
+
* method, and there is no reason to be creating instances of `Subscriber` directly.
|
|
163
|
+
* If you have a specific use case, please file an issue.
|
|
164
|
+
*/
|
|
165
|
+
static create<T>(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber<T>;
|
|
166
|
+
/** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
|
|
167
|
+
protected isStopped: boolean;
|
|
168
|
+
/** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
|
|
169
|
+
protected destination: Subscriber<any> | Observer<any>;
|
|
170
|
+
/**
|
|
171
|
+
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
|
|
172
|
+
* There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.
|
|
173
|
+
*/
|
|
174
|
+
constructor(destination?: Subscriber<any> | Observer<any>);
|
|
175
|
+
/**
|
|
176
|
+
* The {@link Observer} callback to receive notifications of type `next` from
|
|
177
|
+
* the Observable, with a value. The Observable may call this method 0 or more
|
|
178
|
+
* times.
|
|
179
|
+
* @param {T} [value] The `next` value.
|
|
180
|
+
* @return {void}
|
|
181
|
+
*/
|
|
182
|
+
next(value?: T): void;
|
|
183
|
+
/**
|
|
184
|
+
* The {@link Observer} callback to receive notifications of type `error` from
|
|
185
|
+
* the Observable, with an attached `Error`. Notifies the Observer that
|
|
186
|
+
* the Observable has experienced an error condition.
|
|
187
|
+
* @param {any} [err] The `error` exception.
|
|
188
|
+
* @return {void}
|
|
189
|
+
*/
|
|
190
|
+
error(err?: any): void;
|
|
191
|
+
/**
|
|
192
|
+
* The {@link Observer} callback to receive a valueless notification of type
|
|
193
|
+
* `complete` from the Observable. Notifies the Observer that the Observable
|
|
194
|
+
* has finished sending push-based notifications.
|
|
195
|
+
* @return {void}
|
|
196
|
+
*/
|
|
197
|
+
complete(): void;
|
|
198
|
+
unsubscribe(): void;
|
|
199
|
+
protected _next(value: T): void;
|
|
200
|
+
protected _error(err: any): void;
|
|
201
|
+
protected _complete(): void;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/***
|
|
205
|
+
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
|
|
206
|
+
*/
|
|
207
|
+
interface Operator<T, R> {
|
|
208
|
+
call(subscriber: Subscriber<R>, source: any): TeardownLogic;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* A representation of any set of values over any amount of time. This is the most basic building block
|
|
213
|
+
* of RxJS.
|
|
214
|
+
*
|
|
215
|
+
* @class Observable<T>
|
|
216
|
+
*/
|
|
217
|
+
declare class Observable<T> implements Subscribable<T> {
|
|
218
|
+
/**
|
|
219
|
+
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
|
|
220
|
+
*/
|
|
221
|
+
source: Observable<any> | undefined;
|
|
222
|
+
/**
|
|
223
|
+
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
|
|
224
|
+
*/
|
|
225
|
+
operator: Operator<any, T> | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* @constructor
|
|
228
|
+
* @param {Function} subscribe the function that is called when the Observable is
|
|
229
|
+
* initially subscribed to. This function is given a Subscriber, to which new values
|
|
230
|
+
* can be `next`ed, or an `error` method can be called to raise an error, or
|
|
231
|
+
* `complete` can be called to notify of a successful completion.
|
|
232
|
+
*/
|
|
233
|
+
constructor(subscribe?: (this: Observable<T>, subscriber: Subscriber<T>) => TeardownLogic);
|
|
234
|
+
/**
|
|
235
|
+
* Creates a new Observable by calling the Observable constructor
|
|
236
|
+
* @owner Observable
|
|
237
|
+
* @method create
|
|
238
|
+
* @param {Function} subscribe? the subscriber function to be passed to the Observable constructor
|
|
239
|
+
* @return {Observable} a new observable
|
|
240
|
+
* @nocollapse
|
|
241
|
+
* @deprecated Use `new Observable()` instead. Will be removed in v8.
|
|
242
|
+
*/
|
|
243
|
+
static create: (...args: any[]) => any;
|
|
244
|
+
/**
|
|
245
|
+
* Creates a new Observable, with this Observable instance as the source, and the passed
|
|
246
|
+
* operator defined as the new observable's operator.
|
|
247
|
+
* @method lift
|
|
248
|
+
* @param operator the operator defining the operation to take on the observable
|
|
249
|
+
* @return a new observable with the Operator applied
|
|
250
|
+
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
|
|
251
|
+
* If you have implemented an operator using `lift`, it is recommended that you create an
|
|
252
|
+
* operator by simply returning `new Observable()` directly. See "Creating new operators from
|
|
253
|
+
* scratch" section here: https://rxjs.dev/guide/operators
|
|
254
|
+
*/
|
|
255
|
+
lift<R>(operator?: Operator<T, R>): Observable<R>;
|
|
256
|
+
subscribe(observer?: Partial<Observer<T>>): Subscription;
|
|
257
|
+
subscribe(next: (value: T) => void): Subscription;
|
|
258
|
+
/** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */
|
|
259
|
+
subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): Subscription;
|
|
260
|
+
/**
|
|
261
|
+
* Used as a NON-CANCELLABLE means of subscribing to an observable, for use with
|
|
262
|
+
* APIs that expect promises, like `async/await`. You cannot unsubscribe from this.
|
|
263
|
+
*
|
|
264
|
+
* **WARNING**: Only use this with observables you *know* will complete. If the source
|
|
265
|
+
* observable does not complete, you will end up with a promise that is hung up, and
|
|
266
|
+
* potentially all of the state of an async function hanging out in memory. To avoid
|
|
267
|
+
* this situation, look into adding something like {@link timeout}, {@link take},
|
|
268
|
+
* {@link takeWhile}, or {@link takeUntil} amongst others.
|
|
269
|
+
*
|
|
270
|
+
* ## Example
|
|
271
|
+
*
|
|
272
|
+
* ```ts
|
|
273
|
+
* import { interval, take } from 'rxjs';
|
|
274
|
+
*
|
|
275
|
+
* const source$ = interval(1000).pipe(take(4));
|
|
276
|
+
*
|
|
277
|
+
* async function getTotal() {
|
|
278
|
+
* let total = 0;
|
|
279
|
+
*
|
|
280
|
+
* await source$.forEach(value => {
|
|
281
|
+
* total += value;
|
|
282
|
+
* console.log('observable -> ' + value);
|
|
283
|
+
* });
|
|
284
|
+
*
|
|
285
|
+
* return total;
|
|
286
|
+
* }
|
|
287
|
+
*
|
|
288
|
+
* getTotal().then(
|
|
289
|
+
* total => console.log('Total: ' + total)
|
|
290
|
+
* );
|
|
291
|
+
*
|
|
292
|
+
* // Expected:
|
|
293
|
+
* // 'observable -> 0'
|
|
294
|
+
* // 'observable -> 1'
|
|
295
|
+
* // 'observable -> 2'
|
|
296
|
+
* // 'observable -> 3'
|
|
297
|
+
* // 'Total: 6'
|
|
298
|
+
* ```
|
|
299
|
+
*
|
|
300
|
+
* @param next a handler for each value emitted by the observable
|
|
301
|
+
* @return a promise that either resolves on observable completion or
|
|
302
|
+
* rejects with the handled error
|
|
303
|
+
*/
|
|
304
|
+
forEach(next: (value: T) => void): Promise<void>;
|
|
305
|
+
/**
|
|
306
|
+
* @param next a handler for each value emitted by the observable
|
|
307
|
+
* @param promiseCtor a constructor function used to instantiate the Promise
|
|
308
|
+
* @return a promise that either resolves on observable completion or
|
|
309
|
+
* rejects with the handled error
|
|
310
|
+
* @deprecated Passing a Promise constructor will no longer be available
|
|
311
|
+
* in upcoming versions of RxJS. This is because it adds weight to the library, for very
|
|
312
|
+
* little benefit. If you need this functionality, it is recommended that you either
|
|
313
|
+
* polyfill Promise, or you create an adapter to convert the returned native promise
|
|
314
|
+
* to whatever promise implementation you wanted. Will be removed in v8.
|
|
315
|
+
*/
|
|
316
|
+
forEach(next: (value: T) => void, promiseCtor: PromiseConstructorLike): Promise<void>;
|
|
317
|
+
pipe(): Observable<T>;
|
|
318
|
+
pipe<A>(op1: OperatorFunction<T, A>): Observable<A>;
|
|
319
|
+
pipe<A, B>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>): Observable<B>;
|
|
320
|
+
pipe<A, B, C>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): Observable<C>;
|
|
321
|
+
pipe<A, B, C, D>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>): Observable<D>;
|
|
322
|
+
pipe<A, B, C, D, E>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>): Observable<E>;
|
|
323
|
+
pipe<A, B, C, D, E, F>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>): Observable<F>;
|
|
324
|
+
pipe<A, B, C, D, E, F, G>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>): Observable<G>;
|
|
325
|
+
pipe<A, B, C, D, E, F, G, H>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>): Observable<H>;
|
|
326
|
+
pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>): Observable<I>;
|
|
327
|
+
pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>, ...operations: OperatorFunction<any, any>[]): Observable<unknown>;
|
|
328
|
+
/** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
|
|
329
|
+
toPromise(): Promise<T | undefined>;
|
|
330
|
+
/** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
|
|
331
|
+
toPromise(PromiseCtor: typeof Promise): Promise<T | undefined>;
|
|
332
|
+
/** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
|
|
333
|
+
toPromise(PromiseCtor: PromiseConstructorLike): Promise<T | undefined>;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* A Subject is a special type of Observable that allows values to be
|
|
338
|
+
* multicasted to many Observers. Subjects are like EventEmitters.
|
|
339
|
+
*
|
|
340
|
+
* Every Subject is an Observable and an Observer. You can subscribe to a
|
|
341
|
+
* Subject, and you can call next to feed values as well as error and complete.
|
|
342
|
+
*/
|
|
343
|
+
declare class Subject<T> extends Observable<T> implements SubscriptionLike {
|
|
344
|
+
closed: boolean;
|
|
345
|
+
/** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
|
|
346
|
+
observers: Observer<T>[];
|
|
347
|
+
/** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
|
|
348
|
+
isStopped: boolean;
|
|
349
|
+
/** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
|
|
350
|
+
hasError: boolean;
|
|
351
|
+
/** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
|
|
352
|
+
thrownError: any;
|
|
353
|
+
/**
|
|
354
|
+
* Creates a "subject" by basically gluing an observer to an observable.
|
|
355
|
+
*
|
|
356
|
+
* @nocollapse
|
|
357
|
+
* @deprecated Recommended you do not use. Will be removed at some point in the future. Plans for replacement still under discussion.
|
|
358
|
+
*/
|
|
359
|
+
static create: (...args: any[]) => any;
|
|
360
|
+
constructor();
|
|
361
|
+
/** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
|
|
362
|
+
lift<R>(operator: Operator<T, R>): Observable<R>;
|
|
363
|
+
next(value: T): void;
|
|
364
|
+
error(err: any): void;
|
|
365
|
+
complete(): void;
|
|
366
|
+
unsubscribe(): void;
|
|
367
|
+
get observed(): boolean;
|
|
368
|
+
/**
|
|
369
|
+
* Creates a new Observable with this Subject as the source. You can do this
|
|
370
|
+
* to create customize Observer-side logic of the Subject and conceal it from
|
|
371
|
+
* code that uses the Observable.
|
|
372
|
+
* @return {Observable} Observable that the Subject casts to
|
|
373
|
+
*/
|
|
374
|
+
asObservable(): Observable<T>;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
interface BasePromptOptions$1 {
|
|
378
|
+
name: string | (() => string)
|
|
379
|
+
type: string | (() => string)
|
|
380
|
+
message: string | (() => string) | (() => Promise<string>)
|
|
381
|
+
initial?: any
|
|
382
|
+
required?: boolean
|
|
383
|
+
format?(value: string): string | Promise<string>
|
|
384
|
+
result?(value: string): string | Promise<string>
|
|
385
|
+
skip?: ((state: object) => boolean | Promise<boolean>) | boolean
|
|
386
|
+
validate?(value: string): boolean | Promise<boolean> | string | Promise<string>
|
|
387
|
+
onSubmit?(name: string, value: any, prompt: Enquirer.Prompt): boolean | Promise<boolean>
|
|
388
|
+
onCancel?(name: string, value: any, prompt: Enquirer.Prompt): boolean | Promise<boolean>
|
|
389
|
+
stdin?: NodeJS.ReadStream
|
|
390
|
+
stdout?: NodeJS.WriteStream
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
interface Choice {
|
|
394
|
+
name: string
|
|
395
|
+
message?: string
|
|
396
|
+
value?: string
|
|
397
|
+
hint?: string
|
|
398
|
+
disabled?: boolean | string
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
interface ArrayPromptOptions$1 extends BasePromptOptions$1 {
|
|
402
|
+
type:
|
|
403
|
+
| 'autocomplete'
|
|
404
|
+
| 'editable'
|
|
405
|
+
| 'form'
|
|
406
|
+
| 'multiselect'
|
|
407
|
+
| 'select'
|
|
408
|
+
| 'survey'
|
|
409
|
+
| 'list'
|
|
410
|
+
| 'scale'
|
|
411
|
+
choices: string[] | Choice[]
|
|
412
|
+
maxChoices?: number
|
|
413
|
+
muliple?: boolean
|
|
414
|
+
initial?: number
|
|
415
|
+
delay?: number
|
|
416
|
+
separator?: boolean
|
|
417
|
+
sort?: boolean
|
|
418
|
+
linebreak?: boolean
|
|
419
|
+
edgeLength?: number
|
|
420
|
+
align?: 'left' | 'right'
|
|
421
|
+
scroll?: boolean
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
interface BooleanPromptOptions$1 extends BasePromptOptions$1 {
|
|
425
|
+
type: 'confirm'
|
|
426
|
+
initial?: boolean
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
interface StringPromptOptions$1 extends BasePromptOptions$1 {
|
|
430
|
+
type: 'input' | 'invisible' | 'list' | 'password' | 'text'
|
|
431
|
+
initial?: string
|
|
432
|
+
multiline?: boolean
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
interface NumberPromptOptions$1 extends BasePromptOptions$1 {
|
|
436
|
+
type: 'numeral'
|
|
437
|
+
min?: number
|
|
438
|
+
max?: number
|
|
439
|
+
delay?: number
|
|
440
|
+
float?: boolean
|
|
441
|
+
round?: boolean
|
|
442
|
+
major?: number
|
|
443
|
+
minor?: number
|
|
444
|
+
initial?: number
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
interface SnippetPromptOptions$1 extends BasePromptOptions$1 {
|
|
448
|
+
type: 'snippet'
|
|
449
|
+
newline?: string
|
|
450
|
+
template?: string
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
interface SortPromptOptions$1 extends BasePromptOptions$1 {
|
|
454
|
+
type: 'sort'
|
|
455
|
+
hint?: string
|
|
456
|
+
drag?: boolean
|
|
457
|
+
numbered?: boolean
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
type PromptOptions$1 =
|
|
461
|
+
| BasePromptOptions$1
|
|
462
|
+
| ArrayPromptOptions$1
|
|
463
|
+
| BooleanPromptOptions$1
|
|
464
|
+
| StringPromptOptions$1
|
|
465
|
+
| NumberPromptOptions$1
|
|
466
|
+
| SnippetPromptOptions$1
|
|
467
|
+
| SortPromptOptions$1
|
|
468
|
+
|
|
469
|
+
declare class BasePrompt extends EventEmitter {
|
|
470
|
+
constructor(options?: PromptOptions$1);
|
|
471
|
+
|
|
472
|
+
render(): void;
|
|
473
|
+
|
|
474
|
+
run(): Promise<any>;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
declare class Enquirer<T = object> extends EventEmitter {
|
|
478
|
+
constructor(options?: object, answers?: T);
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Register a custom prompt type.
|
|
482
|
+
*
|
|
483
|
+
* @param type
|
|
484
|
+
* @param fn `Prompt` class, or a function that returns a `Prompt` class.
|
|
485
|
+
*/
|
|
486
|
+
register(type: string, fn: typeof BasePrompt | (() => typeof BasePrompt)): this;
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Register a custom prompt type.
|
|
490
|
+
*/
|
|
491
|
+
register(type: { [key: string]: typeof BasePrompt | (() => typeof BasePrompt) }): this;
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Prompt function that takes a "question" object or array of question objects,
|
|
495
|
+
* and returns an object with responses from the user.
|
|
496
|
+
*
|
|
497
|
+
* @param questions Options objects for one or more prompts to run.
|
|
498
|
+
*/
|
|
499
|
+
prompt(
|
|
500
|
+
questions:
|
|
501
|
+
| PromptOptions$1
|
|
502
|
+
| ((this: Enquirer) => PromptOptions$1)
|
|
503
|
+
| (PromptOptions$1 | ((this: Enquirer) => PromptOptions$1))[]
|
|
504
|
+
): Promise<T>;
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Use an enquirer plugin.
|
|
508
|
+
*
|
|
509
|
+
* @param plugin Plugin function that takes an instance of Enquirer.
|
|
510
|
+
*/
|
|
511
|
+
use(plugin: (this: this, enquirer: this) => void): this;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
declare namespace Enquirer {
|
|
515
|
+
function prompt<T = object>(
|
|
516
|
+
questions:
|
|
517
|
+
| PromptOptions$1
|
|
518
|
+
| ((this: Enquirer) => PromptOptions$1)
|
|
519
|
+
| (PromptOptions$1 | ((this: Enquirer) => PromptOptions$1))[]
|
|
520
|
+
): Promise<T>;
|
|
521
|
+
|
|
522
|
+
class Prompt extends BasePrompt {}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/** Type of listr internal events. */
|
|
526
|
+
declare enum ListrEventType {
|
|
527
|
+
TITLE = "TITLE",
|
|
528
|
+
STATE = "STATE",
|
|
529
|
+
ENABLED = "ENABLED",
|
|
530
|
+
SUBTASK = "SUBTASK",
|
|
531
|
+
DATA = "DATA",
|
|
532
|
+
MESSAGE = "MESSAGE"
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/** Listr Default Context */
|
|
536
|
+
declare type ListrContext = any | undefined;
|
|
537
|
+
/**
|
|
538
|
+
* ListrTask.
|
|
539
|
+
*
|
|
540
|
+
* Defines the task, conditions and options to run a specific task in the listr.
|
|
541
|
+
*/
|
|
542
|
+
interface ListrTask<Ctx = ListrContext, Renderer extends ListrRendererFactory = any> {
|
|
543
|
+
/**
|
|
544
|
+
* Title of the task.
|
|
545
|
+
*
|
|
546
|
+
* Give this task a title if you want to track it by name in the current renderer.
|
|
547
|
+
*
|
|
548
|
+
* Tasks without a title will hide in the default renderer and are useful for running a background instance.
|
|
549
|
+
* On verbose renderer, state changes from these tasks will log as 'Task without a title.'
|
|
550
|
+
*/
|
|
551
|
+
title?: string;
|
|
552
|
+
/**
|
|
553
|
+
* The task itself.
|
|
554
|
+
*
|
|
555
|
+
* Task can be a sync or async function, an Observable, or a Stream.
|
|
556
|
+
* Task will be executed, if the certain criteria of the state are met and whenever the time for that specific task has come.
|
|
557
|
+
*/
|
|
558
|
+
task: (ctx: Ctx, task: TaskWrapper<Ctx, Renderer>) => void | ListrTaskResult<Ctx>;
|
|
559
|
+
/**
|
|
560
|
+
* Skip this task depending on the context.
|
|
561
|
+
*
|
|
562
|
+
* The function that has been passed in will be evaluated at the runtime when the task tries to initially run.
|
|
563
|
+
*/
|
|
564
|
+
skip?: boolean | string | ((ctx: Ctx) => boolean | string | Promise<boolean | string>);
|
|
565
|
+
/**
|
|
566
|
+
* Enable a task depending on the context.
|
|
567
|
+
*
|
|
568
|
+
* The function that has been passed in will be evaluated at the initial creation of the Listr class for rendering purposes,
|
|
569
|
+
* as well as re-evaluated when the time for that specific task has come.
|
|
570
|
+
*/
|
|
571
|
+
enabled?: boolean | ((ctx: Ctx) => boolean | Promise<boolean>);
|
|
572
|
+
/**
|
|
573
|
+
* Adds the given number of retry attempts to the task if the task fails.
|
|
574
|
+
*/
|
|
575
|
+
retry?: number;
|
|
576
|
+
/**
|
|
577
|
+
* Runs a specific event if the current task or any of the subtasks has failed.
|
|
578
|
+
*
|
|
579
|
+
* Mostly useful for rollback purposes for subtasks.
|
|
580
|
+
* But can also be useful whenever a task is failed and some measures have to be taken to ensure the state is not changed.
|
|
581
|
+
*/
|
|
582
|
+
rollback?: (ctx: Ctx, task: TaskWrapper<Ctx, Renderer>) => void | ListrTaskResult<Ctx>;
|
|
583
|
+
/**
|
|
584
|
+
* Set exit on the error option from task-level instead of setting it for all the subtasks.
|
|
585
|
+
*/
|
|
586
|
+
exitOnError?: boolean | ((ctx: Ctx) => boolean | Promise<boolean>);
|
|
587
|
+
/**
|
|
588
|
+
* Per task options, that depends on the selected renderer.
|
|
589
|
+
*
|
|
590
|
+
* These options depend on the implementation of the selected renderer. If the selected renderer has no options it will
|
|
591
|
+
* be displayed as never.
|
|
592
|
+
*/
|
|
593
|
+
options?: ListrGetRendererTaskOptions<Renderer>;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Options to set the behavior of this base task.
|
|
597
|
+
*/
|
|
598
|
+
interface ListrOptions<Ctx = ListrContext> {
|
|
599
|
+
/**
|
|
600
|
+
* To inject a context through this options wrapper. Context can also be defined in run time.
|
|
601
|
+
*
|
|
602
|
+
* @default {}
|
|
603
|
+
*/
|
|
604
|
+
ctx?: Ctx;
|
|
605
|
+
/**
|
|
606
|
+
* Concurrency sets how many tasks will be run at the same time in parallel.
|
|
607
|
+
*
|
|
608
|
+
* @default false > Default is to run everything synchronously.
|
|
609
|
+
*
|
|
610
|
+
* `true` will set it to `Infinity`, `false` will set it to synchronous.
|
|
611
|
+
*
|
|
612
|
+
* If you pass in a `number` it will limit it to that number.
|
|
613
|
+
*/
|
|
614
|
+
concurrent?: boolean | number;
|
|
615
|
+
/**
|
|
616
|
+
* Determine the default behavior of exiting on errors.
|
|
617
|
+
*
|
|
618
|
+
* @default true > exit on any error coming from the tasks.
|
|
619
|
+
*/
|
|
620
|
+
exitOnError?: boolean;
|
|
621
|
+
/**
|
|
622
|
+
* Determine the behavior of exiting after rollback actions.
|
|
623
|
+
*
|
|
624
|
+
* This is independent of exitOnError, since failure of a rollback can be a more critical operation comparing to
|
|
625
|
+
* failing a single task.
|
|
626
|
+
*
|
|
627
|
+
* @default true > exit after rolling back tasks
|
|
628
|
+
*/
|
|
629
|
+
exitAfterRollback?: boolean;
|
|
630
|
+
/**
|
|
631
|
+
* Collects errors to `ListrInstance.errors`
|
|
632
|
+
*
|
|
633
|
+
* This can take up a lot of memory, so disabling it can fix out-of-memory errors
|
|
634
|
+
*
|
|
635
|
+
* - 'full' will clone the current context and task in to the error instance
|
|
636
|
+
* - 'minimal' will only collect the error message and the location
|
|
637
|
+
* - false will collect no errors
|
|
638
|
+
*
|
|
639
|
+
* @default 'minimal'
|
|
640
|
+
*/
|
|
641
|
+
collectErrors?: false | 'minimal' | 'full';
|
|
642
|
+
/**
|
|
643
|
+
* By default, Listr2 will track SIGINIT signal to update the renderer one last time before completely failing.
|
|
644
|
+
*
|
|
645
|
+
* @default true
|
|
646
|
+
*/
|
|
647
|
+
registerSignalListeners?: boolean;
|
|
648
|
+
/**
|
|
649
|
+
* Determine the certain condition required to use the non-TTY renderer.
|
|
650
|
+
*
|
|
651
|
+
* @default null > handled internally
|
|
652
|
+
*/
|
|
653
|
+
rendererFallback?: boolean | (() => boolean);
|
|
654
|
+
/**
|
|
655
|
+
* Determine the certain condition required to use the silent renderer.
|
|
656
|
+
*
|
|
657
|
+
* @default null > handled internally
|
|
658
|
+
*/
|
|
659
|
+
rendererSilent?: boolean | (() => boolean);
|
|
660
|
+
/**
|
|
661
|
+
* Disabling the color, useful for tests and such.
|
|
662
|
+
*
|
|
663
|
+
* @default false
|
|
664
|
+
*/
|
|
665
|
+
disableColor?: boolean;
|
|
666
|
+
/**
|
|
667
|
+
* Inject data directly to TaskWrapper.
|
|
668
|
+
*/
|
|
669
|
+
injectWrapper?: {
|
|
670
|
+
enquirer?: Enquirer<object>;
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Task can be set of sync or async function, an Observable or a stream.
|
|
675
|
+
*/
|
|
676
|
+
declare type ListrTaskResult<Ctx> = string | Promise<any> | Listr<Ctx, ListrRendererValue, any> | Readable | NodeJS.ReadableStream | Observable<any>;
|
|
677
|
+
/**
|
|
678
|
+
* Parent class options.
|
|
679
|
+
*
|
|
680
|
+
* Parent class has more options where you can also select the and set renderer and non-tty renderer.
|
|
681
|
+
*
|
|
682
|
+
* Any subtasks will respect those options so they will be stripped of that properties.
|
|
683
|
+
*/
|
|
684
|
+
declare type ListrBaseClassOptions<Ctx = ListrContext, Renderer extends ListrRendererValue = ListrDefaultRendererValue, FallbackRenderer extends ListrRendererValue = ListrFallbackRendererValue> = ListrOptions<Ctx> & ListrDefaultRendererOptions<Renderer> & ListrDefaultNonTTYRendererOptions<FallbackRenderer>;
|
|
685
|
+
/**
|
|
686
|
+
* Sub class options.
|
|
687
|
+
*
|
|
688
|
+
* Subtasks has reduced set options where the missing ones are explicitly set by the base class.
|
|
689
|
+
*/
|
|
690
|
+
declare type ListrSubClassOptions<Ctx = ListrContext, Renderer extends ListrRendererValue = ListrDefaultRendererValue> = ListrOptions<Ctx> & Omit<ListrDefaultRendererOptions<Renderer>, 'renderer'>;
|
|
691
|
+
/** The internal communication event. */
|
|
692
|
+
declare type ListrEvent = {
|
|
693
|
+
type: Exclude<ListrEventType, 'MESSAGE' | 'DATA'>;
|
|
694
|
+
data?: string | boolean;
|
|
695
|
+
} | {
|
|
696
|
+
type: ListrEventType.DATA;
|
|
697
|
+
data: string;
|
|
698
|
+
} | {
|
|
699
|
+
type: ListrEventType.MESSAGE;
|
|
700
|
+
data: Task$1<any, any>['message'];
|
|
701
|
+
};
|
|
702
|
+
/**
|
|
703
|
+
* Used to match event.type to ListrEvent permutations
|
|
704
|
+
*/
|
|
705
|
+
declare type ListrEventFromType<T extends ListrEventType, E = ListrEvent> = E extends {
|
|
706
|
+
type: infer U;
|
|
707
|
+
} ? T extends U ? E : never : never;
|
|
708
|
+
|
|
709
|
+
interface BasePromptOptions {
|
|
710
|
+
message: string | (() => string) | (() => Promise<string>);
|
|
711
|
+
initial?: boolean | number | number[] | string | (() => string) | (() => Promise<string>);
|
|
712
|
+
required?: boolean;
|
|
713
|
+
stdin?: NodeJS.ReadStream;
|
|
714
|
+
stdout?: NodeJS.WriteStream;
|
|
715
|
+
header?: string;
|
|
716
|
+
footer?: string;
|
|
717
|
+
skip?: (value: any) => boolean | Promise<boolean>;
|
|
718
|
+
format?: (value: any) => any | Promise<any>;
|
|
719
|
+
result?: (value: any) => any | Promise<any>;
|
|
720
|
+
validate?: (value: any, state: any) => boolean | Promise<boolean> | string | Promise<string> | Promise<string | boolean>;
|
|
721
|
+
onSubmit?: (name: any, value: any, prompt: Enquirer.Prompt) => boolean | Promise<boolean>;
|
|
722
|
+
onCancel?: (name: any, value: any, prompt: Enquirer.Prompt) => boolean | Promise<boolean>;
|
|
723
|
+
}
|
|
724
|
+
interface BasePromptOptionsWithName extends BasePromptOptions {
|
|
725
|
+
name: string | (() => string);
|
|
726
|
+
}
|
|
727
|
+
interface ArrayPromptOptions extends BasePromptOptions {
|
|
728
|
+
choices: string[] | BasePromptOptionsWithName[];
|
|
729
|
+
maxChoices?: number;
|
|
730
|
+
multiple?: boolean;
|
|
731
|
+
initial?: number | number[];
|
|
732
|
+
delay?: number;
|
|
733
|
+
separator?: boolean;
|
|
734
|
+
sort?: boolean;
|
|
735
|
+
linebreak?: boolean;
|
|
736
|
+
edgeLength?: number;
|
|
737
|
+
align?: 'left' | 'right';
|
|
738
|
+
scroll?: boolean;
|
|
739
|
+
hint?: string;
|
|
740
|
+
}
|
|
741
|
+
interface BooleanPromptOptions extends BasePromptOptions {
|
|
742
|
+
initial?: boolean | (() => string) | (() => Promise<string>);
|
|
743
|
+
}
|
|
744
|
+
interface StringPromptOptions extends BasePromptOptions {
|
|
745
|
+
initial?: string;
|
|
746
|
+
multiline?: boolean;
|
|
747
|
+
}
|
|
748
|
+
interface ScalePromptOptions extends ArrayPromptOptions {
|
|
749
|
+
scale: StringPromptOptions[];
|
|
750
|
+
margin?: [number, number, number, number];
|
|
751
|
+
}
|
|
752
|
+
interface NumberPromptOptions extends BasePromptOptions {
|
|
753
|
+
min?: number;
|
|
754
|
+
max?: number;
|
|
755
|
+
delay?: number;
|
|
756
|
+
float?: boolean;
|
|
757
|
+
round?: boolean;
|
|
758
|
+
major?: number;
|
|
759
|
+
minor?: number;
|
|
760
|
+
initial?: number;
|
|
761
|
+
}
|
|
762
|
+
interface SnippetPromptOptions extends BasePromptOptions {
|
|
763
|
+
newline?: string;
|
|
764
|
+
fields: Partial<BasePromptOptionsWithName>[];
|
|
765
|
+
template: string;
|
|
766
|
+
}
|
|
767
|
+
interface SortPromptOptions extends BasePromptOptions {
|
|
768
|
+
hint?: string;
|
|
769
|
+
drag?: boolean;
|
|
770
|
+
numbered?: boolean;
|
|
771
|
+
}
|
|
772
|
+
interface SurveyPromptOptions extends ArrayPromptOptions {
|
|
773
|
+
scale: BasePromptOptionsWithName[];
|
|
774
|
+
margin: [number, number, number, number];
|
|
775
|
+
}
|
|
776
|
+
interface QuizPromptOptions extends ArrayPromptOptions {
|
|
777
|
+
correctChoice: number;
|
|
778
|
+
}
|
|
779
|
+
interface TogglePromptOptions extends BasePromptOptions {
|
|
780
|
+
enabled?: string;
|
|
781
|
+
disabled?: string;
|
|
782
|
+
}
|
|
783
|
+
/** Returns all the prompt options depending on the type selected. */
|
|
784
|
+
declare type PromptOptions<T extends boolean = false> = Unionize<{
|
|
785
|
+
[K in PromptTypes]-?: T extends true ? {
|
|
786
|
+
type: K;
|
|
787
|
+
} & PromptOptionsType<K> & {
|
|
788
|
+
name: string | (() => string);
|
|
789
|
+
} : {
|
|
790
|
+
type: K;
|
|
791
|
+
} & PromptOptionsType<K>;
|
|
792
|
+
}> | ({
|
|
793
|
+
type: string;
|
|
794
|
+
} & T extends true ? PromptOptionsType<string> & {
|
|
795
|
+
name: string | (() => string);
|
|
796
|
+
} : PromptOptionsType<string>);
|
|
797
|
+
declare type Unionize<T extends Record<PropertyKey, unknown>> = {
|
|
798
|
+
[P in keyof T]: T[P];
|
|
799
|
+
}[keyof T];
|
|
800
|
+
declare type PromptTypes = 'AutoComplete' | 'BasicAuth' | 'Confirm' | 'Editable' | 'Form' | 'Input' | 'Invisible' | 'List' | 'MultiSelect' | 'Numeral' | 'Password' | 'Quiz' | 'Scale' | 'Select' | 'Snippet' | 'Sort' | 'Survey' | 'Text' | 'Toggle';
|
|
801
|
+
declare type PromptOptionsType<T> = T extends keyof PromptOptionsMap ? PromptOptionsMap[T] : T extends string ? BasePromptOptions & Record<PropertyKey, unknown> : any;
|
|
802
|
+
declare class PromptOptionsMap implements Record<PromptTypes, Record<PropertyKey, any>> {
|
|
803
|
+
AutoComplete: ArrayPromptOptions;
|
|
804
|
+
BasicAuth: StringPromptOptions;
|
|
805
|
+
Confirm: BooleanPromptOptions;
|
|
806
|
+
Editable: ArrayPromptOptions;
|
|
807
|
+
Form: ArrayPromptOptions;
|
|
808
|
+
Input: StringPromptOptions;
|
|
809
|
+
Invisible: StringPromptOptions;
|
|
810
|
+
List: ArrayPromptOptions;
|
|
811
|
+
MultiSelect: ArrayPromptOptions;
|
|
812
|
+
Numeral: NumberPromptOptions;
|
|
813
|
+
Password: StringPromptOptions;
|
|
814
|
+
Quiz: QuizPromptOptions;
|
|
815
|
+
Scale: ScalePromptOptions;
|
|
816
|
+
Select: ArrayPromptOptions;
|
|
817
|
+
Snippet: SnippetPromptOptions;
|
|
818
|
+
Sort: SortPromptOptions;
|
|
819
|
+
Survey: SurveyPromptOptions;
|
|
820
|
+
Text: StringPromptOptions;
|
|
821
|
+
Toggle: TogglePromptOptions;
|
|
822
|
+
}
|
|
823
|
+
interface PromptInstance extends Omit<BasePromptOptions, 'onCancel' | 'onSubmit'> {
|
|
824
|
+
submit: () => void;
|
|
825
|
+
cancel: (err?: string) => void;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* Extend the task to have more functionality while accesing from the outside.
|
|
830
|
+
*/
|
|
831
|
+
declare class TaskWrapper<Ctx, Renderer extends ListrRendererFactory> {
|
|
832
|
+
task: Task$1<Ctx, ListrRendererFactory>;
|
|
833
|
+
errors: ListrError<Ctx>[];
|
|
834
|
+
private options;
|
|
835
|
+
constructor(task: Task$1<Ctx, ListrRendererFactory>, errors: ListrError<Ctx>[], options: ListrBaseClassOptions<Ctx, any, any>);
|
|
836
|
+
/** Get the title of the current task. */
|
|
837
|
+
get title(): string;
|
|
838
|
+
/** Change the title of the current task. */
|
|
839
|
+
set title(data: string);
|
|
840
|
+
/** Get the output from the output channel. */
|
|
841
|
+
get output(): string;
|
|
842
|
+
/** Send a output to the output channel. */
|
|
843
|
+
set output(data: string);
|
|
844
|
+
/** Create a new subtask with given renderer selection from the parent task. */
|
|
845
|
+
newListr<NewCtx = Ctx>(task: ListrTask<NewCtx, Renderer> | ListrTask<NewCtx, Renderer>[] | ((parent: Omit<this, 'skip' | 'enabled'>) => ListrTask<NewCtx, Renderer> | ListrTask<NewCtx, Renderer>[]), options?: ListrSubClassOptions<NewCtx, Renderer>): Listr<NewCtx, any, any>;
|
|
846
|
+
/** Report a error in process for error collection. */
|
|
847
|
+
report(error: Error, type: ListrErrorTypes): void;
|
|
848
|
+
/** Skip current task. */
|
|
849
|
+
skip(message?: string): void;
|
|
850
|
+
/** Get the number of retrying, else returns false */
|
|
851
|
+
isRetrying(): Task$1<Ctx, Renderer>['retry'];
|
|
852
|
+
/**
|
|
853
|
+
* Create a new Enquirer prompt using prompt options.
|
|
854
|
+
*
|
|
855
|
+
* Since process.stdout is controlled by Listr, this will passthrough all Enquirer data through internal stdout.
|
|
856
|
+
*/
|
|
857
|
+
prompt<T = any>(options: PromptOptions | PromptOptions<true>[]): Promise<T>;
|
|
858
|
+
/** Cancels the current prompt attach to this task. */
|
|
859
|
+
cancelPrompt(throwError?: boolean): void;
|
|
860
|
+
/**
|
|
861
|
+
* Pass stream of data to internal stdout.
|
|
862
|
+
*
|
|
863
|
+
* Since Listr2 takes control of process.stdout utilizing the default renderer, any data outputted to process.stdout
|
|
864
|
+
* will corupt its looks.
|
|
865
|
+
*
|
|
866
|
+
* This returns a fake stream to pass any stream inside Listr as task data.
|
|
867
|
+
*/
|
|
868
|
+
stdout(): NodeJS.WriteStream & NodeJS.WritableStream;
|
|
869
|
+
/** Run this task. */
|
|
870
|
+
run(ctx: Ctx): Promise<void>;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/** Available task states. */
|
|
874
|
+
declare enum ListrTaskState {
|
|
875
|
+
PENDING = "PENDING",
|
|
876
|
+
COMPLETED = "COMPLETED",
|
|
877
|
+
FAILED = "FAILED",
|
|
878
|
+
SKIPPED = "SKIPPED",
|
|
879
|
+
ROLLING_BACK = "ROLLING_BACK",
|
|
880
|
+
ROLLED_BACK = "ROLLED_BACK",
|
|
881
|
+
RETRY = "RETRY"
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Create a task from the given set of variables and make it runnable.
|
|
886
|
+
*/
|
|
887
|
+
declare class Task$1<Ctx, Renderer extends ListrRendererFactory> extends Subject<ListrEvent> {
|
|
888
|
+
listr: Listr<Ctx, any, any>;
|
|
889
|
+
tasks: ListrTask<Ctx, any>;
|
|
890
|
+
options: ListrOptions;
|
|
891
|
+
rendererOptions: ListrGetRendererOptions<Renderer>;
|
|
892
|
+
/** Unique id per task, randomly generated in the uuid v4 format */
|
|
893
|
+
id: string;
|
|
894
|
+
/** The current state of the task. */
|
|
895
|
+
state: string;
|
|
896
|
+
/** The task object itself, to further utilize it. */
|
|
897
|
+
task: (ctx: Ctx, task: TaskWrapper<Ctx, Renderer>) => void | ListrTaskResult<Ctx>;
|
|
898
|
+
/** Extend current task with multiple subtasks. */
|
|
899
|
+
subtasks: Task$1<Ctx, any>[];
|
|
900
|
+
/** Title of the task */
|
|
901
|
+
title?: string;
|
|
902
|
+
/** Untouched unchanged title of the task */
|
|
903
|
+
initialTitle?: string;
|
|
904
|
+
/** Output data from the task. */
|
|
905
|
+
output?: string;
|
|
906
|
+
/** Skip current task. */
|
|
907
|
+
skip: boolean | string | ((ctx: Ctx) => boolean | string | Promise<boolean | string>);
|
|
908
|
+
/** Current retry number of the task if retrying */
|
|
909
|
+
retry?: {
|
|
910
|
+
count: number;
|
|
911
|
+
withError?: any;
|
|
912
|
+
};
|
|
913
|
+
/**
|
|
914
|
+
* A channel for messages.
|
|
915
|
+
*
|
|
916
|
+
* This requires a separate channel for messages like error, skip or runtime messages to further utilize in the renderers.
|
|
917
|
+
*/
|
|
918
|
+
message: {
|
|
919
|
+
/** Run time of the task, if it has been successfully resolved. */
|
|
920
|
+
duration?: number;
|
|
921
|
+
/** Error message of the task, if it has been failed. */
|
|
922
|
+
error?: string;
|
|
923
|
+
/** Skip message of the task, if it has been skipped. */
|
|
924
|
+
skip?: string;
|
|
925
|
+
/** Rollback message of the task, if the rollback finishes */
|
|
926
|
+
rollback?: string;
|
|
927
|
+
/** Retry messages */
|
|
928
|
+
retry?: {
|
|
929
|
+
count: number;
|
|
930
|
+
withError?: any;
|
|
931
|
+
};
|
|
932
|
+
};
|
|
933
|
+
/** Per task options for the current renderer of the task. */
|
|
934
|
+
rendererTaskOptions: ListrGetRendererTaskOptions<Renderer>;
|
|
935
|
+
/** This will be triggered each time a new render should happen. */
|
|
936
|
+
renderHook$: Subject<void>;
|
|
937
|
+
prompt: undefined | PromptInstance | PromptError;
|
|
938
|
+
private enabled;
|
|
939
|
+
private enabledFn;
|
|
940
|
+
constructor(listr: Listr<Ctx, any, any>, tasks: ListrTask<Ctx, any>, options: ListrOptions, rendererOptions: ListrGetRendererOptions<Renderer>);
|
|
941
|
+
set state$(state: ListrTaskState);
|
|
942
|
+
set output$(data: string);
|
|
943
|
+
set message$(data: Task$1<Ctx, Renderer>['message']);
|
|
944
|
+
set title$(title: string);
|
|
945
|
+
/**
|
|
946
|
+
* A function to check whether this task should run at all via enable.
|
|
947
|
+
*/
|
|
948
|
+
check(ctx: Ctx): Promise<void>;
|
|
949
|
+
/** Returns whether this task has subtasks. */
|
|
950
|
+
hasSubtasks(): boolean;
|
|
951
|
+
/** Returns whether this task is in progress. */
|
|
952
|
+
isPending(): boolean;
|
|
953
|
+
/** Returns whether this task is skipped. */
|
|
954
|
+
isSkipped(): boolean;
|
|
955
|
+
/** Returns whether this task has been completed. */
|
|
956
|
+
isCompleted(): boolean;
|
|
957
|
+
/** Returns whether this task has been failed. */
|
|
958
|
+
hasFailed(): boolean;
|
|
959
|
+
/** Returns whether this task has an active rollback task going on. */
|
|
960
|
+
isRollingBack(): boolean;
|
|
961
|
+
/** Returns whether the rollback action was successful. */
|
|
962
|
+
hasRolledBack(): boolean;
|
|
963
|
+
/** Returns whether this task has an actively retrying task going on. */
|
|
964
|
+
isRetrying(): boolean;
|
|
965
|
+
/** Returns whether enabled function resolves to true. */
|
|
966
|
+
isEnabled(): boolean;
|
|
967
|
+
/** Returns whether this task actually has a title. */
|
|
968
|
+
hasTitle(): boolean;
|
|
969
|
+
/** Returns whether this task has a prompt inside. */
|
|
970
|
+
isPrompt(): boolean;
|
|
971
|
+
/** Run the current task. */
|
|
972
|
+
run(context: Ctx, wrapper: TaskWrapper<Ctx, Renderer>): Promise<void>;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
/** Default updating renderer for Listr2 */
|
|
976
|
+
declare class DefaultRenderer implements ListrRenderer {
|
|
977
|
+
tasks: Task$1<any, typeof DefaultRenderer>[];
|
|
978
|
+
options: typeof DefaultRenderer['rendererOptions'];
|
|
979
|
+
renderHook$?: Task$1<any, any>['renderHook$'];
|
|
980
|
+
/** designates whether this renderer can output to a non-tty console */
|
|
981
|
+
static nonTTY: boolean;
|
|
982
|
+
/** renderer options for the defauult renderer */
|
|
983
|
+
static rendererOptions: {
|
|
984
|
+
/**
|
|
985
|
+
* indentation per level of subtask
|
|
986
|
+
*
|
|
987
|
+
* @default 2
|
|
988
|
+
*/
|
|
989
|
+
indentation?: number;
|
|
990
|
+
/**
|
|
991
|
+
* clear all the output generated by the renderer when the task finishes its execution
|
|
992
|
+
*
|
|
993
|
+
* @default false
|
|
994
|
+
* @global global option that can not be temperated with subtasks
|
|
995
|
+
*/
|
|
996
|
+
clearOutput?: boolean;
|
|
997
|
+
/**
|
|
998
|
+
* show the subtasks of the current task
|
|
999
|
+
*
|
|
1000
|
+
* @default true
|
|
1001
|
+
*/
|
|
1002
|
+
showSubtasks?: boolean;
|
|
1003
|
+
/**
|
|
1004
|
+
* collapse subtasks after current task completes its execution
|
|
1005
|
+
*
|
|
1006
|
+
* @default true
|
|
1007
|
+
*/
|
|
1008
|
+
collapse?: boolean;
|
|
1009
|
+
/**
|
|
1010
|
+
* show skip messages or show the original title of the task, this will also disable collapseSkips mode
|
|
1011
|
+
*
|
|
1012
|
+
* You can disable showing the skip messages, even though you passed in a message by settings this option,
|
|
1013
|
+
* if you want to keep the original task title intact.
|
|
1014
|
+
*
|
|
1015
|
+
* @default true
|
|
1016
|
+
*/
|
|
1017
|
+
showSkipMessage?: boolean;
|
|
1018
|
+
/**
|
|
1019
|
+
* collapse skip messages into a single message and overwrite the task title
|
|
1020
|
+
*
|
|
1021
|
+
* @default true
|
|
1022
|
+
*/
|
|
1023
|
+
collapseSkips?: boolean;
|
|
1024
|
+
/**
|
|
1025
|
+
* suffix skip messages with [SKIPPED] when in collapseSkips mode
|
|
1026
|
+
*
|
|
1027
|
+
* @default true
|
|
1028
|
+
*/
|
|
1029
|
+
suffixSkips?: boolean;
|
|
1030
|
+
/**
|
|
1031
|
+
* shows the thrown error message or show the original title of the task, this will also disable collapseErrors mode
|
|
1032
|
+
* You can disable showing the error messages, even though you passed in a message by settings this option,
|
|
1033
|
+
* if you want to keep the original task title intact.
|
|
1034
|
+
*
|
|
1035
|
+
* @default true
|
|
1036
|
+
*/
|
|
1037
|
+
showErrorMessage?: boolean;
|
|
1038
|
+
/**
|
|
1039
|
+
* collapse error messages into a single message and overwrite the task title
|
|
1040
|
+
*
|
|
1041
|
+
* @default true
|
|
1042
|
+
*/
|
|
1043
|
+
collapseErrors?: boolean;
|
|
1044
|
+
/**
|
|
1045
|
+
* suffix retry messages with [RETRY-${COUNT}] when retry is enabled for a task
|
|
1046
|
+
*
|
|
1047
|
+
* @default true
|
|
1048
|
+
*/
|
|
1049
|
+
suffixRetries?: boolean;
|
|
1050
|
+
/**
|
|
1051
|
+
* only update through triggers from renderhook
|
|
1052
|
+
*
|
|
1053
|
+
* useful for tests and stuff. this will disable showing spinner and only update the screen if something else has
|
|
1054
|
+
* happened in the task worthy to show
|
|
1055
|
+
*
|
|
1056
|
+
* @default false
|
|
1057
|
+
* @global global option that can not be temperated with subtasks
|
|
1058
|
+
*/
|
|
1059
|
+
lazy?: boolean;
|
|
1060
|
+
/**
|
|
1061
|
+
* show duration for all tasks
|
|
1062
|
+
*
|
|
1063
|
+
* @default false
|
|
1064
|
+
* @global global option that can not be temperated with subtasks
|
|
1065
|
+
*/
|
|
1066
|
+
showTimer?: boolean;
|
|
1067
|
+
/**
|
|
1068
|
+
* removes empty lines from the data output
|
|
1069
|
+
*
|
|
1070
|
+
* @default true
|
|
1071
|
+
*/
|
|
1072
|
+
removeEmptyLines?: boolean;
|
|
1073
|
+
/**
|
|
1074
|
+
* formats data output depending on your requirements.
|
|
1075
|
+
*
|
|
1076
|
+
* @default 'truncate'
|
|
1077
|
+
* @global global option that can not be temperated with subtasks
|
|
1078
|
+
*/
|
|
1079
|
+
formatOutput?: 'truncate' | 'wrap';
|
|
1080
|
+
};
|
|
1081
|
+
/** per task options for the default renderer */
|
|
1082
|
+
static rendererTaskOptions: {
|
|
1083
|
+
/**
|
|
1084
|
+
* write task output to the bottom bar instead of the gap under the task title itself.
|
|
1085
|
+
* useful for a stream of data.
|
|
1086
|
+
* @default false
|
|
1087
|
+
*
|
|
1088
|
+
* `true` only keep 1 line of the latest data outputted by the task.
|
|
1089
|
+
* `false` only keep 1 line of the latest data outputted by the task.
|
|
1090
|
+
* `number` will keep designated data of the latest data outputted by the task.
|
|
1091
|
+
*/
|
|
1092
|
+
bottomBar?: boolean | number;
|
|
1093
|
+
/**
|
|
1094
|
+
* keep output after task finishes
|
|
1095
|
+
* @default false
|
|
1096
|
+
*
|
|
1097
|
+
* works both for the bottom bar and the default behavior
|
|
1098
|
+
*/
|
|
1099
|
+
persistentOutput?: boolean;
|
|
1100
|
+
/**
|
|
1101
|
+
* show the task time if it was successful
|
|
1102
|
+
*/
|
|
1103
|
+
showTimer?: boolean;
|
|
1104
|
+
};
|
|
1105
|
+
private id?;
|
|
1106
|
+
private bottomBar;
|
|
1107
|
+
private promptBar;
|
|
1108
|
+
private readonly spinner;
|
|
1109
|
+
private spinnerPosition;
|
|
1110
|
+
constructor(tasks: Task$1<any, typeof DefaultRenderer>[], options: typeof DefaultRenderer['rendererOptions'], renderHook$?: Task$1<any, any>['renderHook$']);
|
|
1111
|
+
getTaskOptions(task: Task$1<any, typeof DefaultRenderer>): typeof DefaultRenderer['rendererTaskOptions'];
|
|
1112
|
+
isBottomBar(task: Task$1<any, typeof DefaultRenderer>): boolean;
|
|
1113
|
+
hasPersistentOutput(task: Task$1<any, typeof DefaultRenderer>): boolean;
|
|
1114
|
+
hasTimer(task: Task$1<any, typeof DefaultRenderer>): boolean;
|
|
1115
|
+
getSelfOrParentOption<T extends keyof typeof DefaultRenderer['rendererOptions']>(task: Task$1<any, typeof DefaultRenderer>, key: T): typeof DefaultRenderer['rendererOptions'][T];
|
|
1116
|
+
getTaskTime(task: Task$1<any, typeof DefaultRenderer>): string;
|
|
1117
|
+
createRender(options?: {
|
|
1118
|
+
tasks?: boolean;
|
|
1119
|
+
bottomBar?: boolean;
|
|
1120
|
+
prompt?: boolean;
|
|
1121
|
+
}): string;
|
|
1122
|
+
render(): void;
|
|
1123
|
+
end(): void;
|
|
1124
|
+
private multiLineRenderer;
|
|
1125
|
+
private renderBottomBar;
|
|
1126
|
+
private renderPrompt;
|
|
1127
|
+
private dumpData;
|
|
1128
|
+
private formatString;
|
|
1129
|
+
private indentMultilineOutput;
|
|
1130
|
+
private getSymbol;
|
|
1131
|
+
private addSuffixToMessage;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
declare class SilentRenderer implements ListrRenderer {
|
|
1135
|
+
tasks: Task$1<any, typeof SilentRenderer>[];
|
|
1136
|
+
options: typeof SilentRenderer['rendererOptions'];
|
|
1137
|
+
/** designates whether this renderer can output to a non-tty console */
|
|
1138
|
+
static nonTTY: boolean;
|
|
1139
|
+
/** renderer options for the silent renderer */
|
|
1140
|
+
static rendererOptions: never;
|
|
1141
|
+
/** per task options for the silent renderer */
|
|
1142
|
+
static rendererTaskOptions: never;
|
|
1143
|
+
constructor(tasks: Task$1<any, typeof SilentRenderer>[], options: typeof SilentRenderer['rendererOptions']);
|
|
1144
|
+
render(): void;
|
|
1145
|
+
end(): void;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* This is the default renderer which is neither verbose or updating.
|
|
1150
|
+
* It provides short output like update renderer, but does not disturb
|
|
1151
|
+
* stdin during execution of listr tasks
|
|
1152
|
+
*/
|
|
1153
|
+
declare class SimpleRenderer implements ListrRenderer {
|
|
1154
|
+
readonly tasks: Task$1<any, typeof SimpleRenderer>[];
|
|
1155
|
+
options: typeof SimpleRenderer['rendererOptions'];
|
|
1156
|
+
static nonTTY: boolean;
|
|
1157
|
+
static rendererOptions: {
|
|
1158
|
+
/**
|
|
1159
|
+
* if true this will add
|
|
1160
|
+
* timestamp at the begin of the rendered line
|
|
1161
|
+
*
|
|
1162
|
+
* @example
|
|
1163
|
+
*
|
|
1164
|
+
* ```bash
|
|
1165
|
+
* [12:33:44] ✔ Do something important
|
|
1166
|
+
* ```
|
|
1167
|
+
*
|
|
1168
|
+
* @default false
|
|
1169
|
+
*/
|
|
1170
|
+
prefixWithTimestamp?: boolean;
|
|
1171
|
+
/**
|
|
1172
|
+
* choose between process.stdout and process.stderr
|
|
1173
|
+
*
|
|
1174
|
+
* @default stdout
|
|
1175
|
+
*/
|
|
1176
|
+
output?: 'stdout' | 'stderr';
|
|
1177
|
+
};
|
|
1178
|
+
static rendererTaskOptions: never;
|
|
1179
|
+
/**
|
|
1180
|
+
* Event type renderer map contains functions to process different task events
|
|
1181
|
+
*/
|
|
1182
|
+
eventTypeRendererMap: Partial<{
|
|
1183
|
+
[P in ListrEventType]: (t: Task$1<any, typeof SimpleRenderer>, event: ListrEventFromType<P>) => void;
|
|
1184
|
+
}>;
|
|
1185
|
+
constructor(tasks: Task$1<any, typeof SimpleRenderer>[], options: typeof SimpleRenderer['rendererOptions']);
|
|
1186
|
+
static now(): Date;
|
|
1187
|
+
static formatTitle(task?: Task$1<any, typeof SimpleRenderer>): string;
|
|
1188
|
+
log(output?: string): void;
|
|
1189
|
+
end(): void;
|
|
1190
|
+
render(tasks?: Task$1<any, typeof SimpleRenderer>[]): void;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
/** Default loglevels for the logger */
|
|
1194
|
+
declare enum LogLevels {
|
|
1195
|
+
SILENT = "SILENT",
|
|
1196
|
+
FAILED = "FAILED",
|
|
1197
|
+
SKIPPED = "SKIPPED",
|
|
1198
|
+
SUCCESS = "SUCCESS",
|
|
1199
|
+
DATA = "DATA",
|
|
1200
|
+
STARTED = "STARTED",
|
|
1201
|
+
TITLE = "TITLE",
|
|
1202
|
+
RETRY = "RETRY",
|
|
1203
|
+
ROLLBACK = "ROLLBACK"
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* Options for the logger
|
|
1208
|
+
*/
|
|
1209
|
+
interface LoggerOptions {
|
|
1210
|
+
useIcons: boolean;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* A internal logger for using in the verbose renderer mostly.
|
|
1215
|
+
*/
|
|
1216
|
+
declare class Logger {
|
|
1217
|
+
private options?;
|
|
1218
|
+
constructor(options?: LoggerOptions);
|
|
1219
|
+
fail(message: string): void;
|
|
1220
|
+
skip(message: string): void;
|
|
1221
|
+
success(message: string): void;
|
|
1222
|
+
data(message: string): void;
|
|
1223
|
+
start(message: string): void;
|
|
1224
|
+
title(message: string): void;
|
|
1225
|
+
retry(message: string): void;
|
|
1226
|
+
rollback(message: string): void;
|
|
1227
|
+
protected parseMessage(level: LogLevels, message: string): string;
|
|
1228
|
+
protected logColoring({ level, message }: {
|
|
1229
|
+
level: LogLevels;
|
|
1230
|
+
message: string;
|
|
1231
|
+
}): string;
|
|
1232
|
+
private wrapInBrackets;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
declare class VerboseRenderer implements ListrRenderer {
|
|
1236
|
+
tasks: Task$1<any, typeof VerboseRenderer>[];
|
|
1237
|
+
options: typeof VerboseRenderer['rendererOptions'];
|
|
1238
|
+
/** designates whether this renderer can output to a non-tty console */
|
|
1239
|
+
static nonTTY: boolean;
|
|
1240
|
+
/** renderer options for the verbose renderer */
|
|
1241
|
+
static rendererOptions: ({
|
|
1242
|
+
/**
|
|
1243
|
+
* useIcons instead of text for log level
|
|
1244
|
+
* @default false
|
|
1245
|
+
*/
|
|
1246
|
+
useIcons?: boolean;
|
|
1247
|
+
/**
|
|
1248
|
+
* log tasks with empty titles
|
|
1249
|
+
* @default true
|
|
1250
|
+
*/
|
|
1251
|
+
logEmptyTitle?: boolean;
|
|
1252
|
+
/**
|
|
1253
|
+
* log title changes
|
|
1254
|
+
* @default true
|
|
1255
|
+
*/
|
|
1256
|
+
logTitleChange?: boolean;
|
|
1257
|
+
/**
|
|
1258
|
+
* show duration for all tasks
|
|
1259
|
+
*/
|
|
1260
|
+
showTimer?: boolean;
|
|
1261
|
+
} & {
|
|
1262
|
+
/**
|
|
1263
|
+
* inject a custom logger
|
|
1264
|
+
*/
|
|
1265
|
+
logger?: new (...args: any) => Logger;
|
|
1266
|
+
/**
|
|
1267
|
+
* inject options to custom logger
|
|
1268
|
+
*/
|
|
1269
|
+
options?: any;
|
|
1270
|
+
});
|
|
1271
|
+
/** per task options for the verbose renderer */
|
|
1272
|
+
static rendererTaskOptions: never;
|
|
1273
|
+
private logger;
|
|
1274
|
+
constructor(tasks: Task$1<any, typeof VerboseRenderer>[], options: typeof VerboseRenderer['rendererOptions']);
|
|
1275
|
+
render(): void;
|
|
1276
|
+
end(): void;
|
|
1277
|
+
private verboseRenderer;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
/** The default renderer value used in Listr2 applications */
|
|
1281
|
+
declare type ListrDefaultRendererValue = 'default';
|
|
1282
|
+
/** Type of default renderer */
|
|
1283
|
+
declare type ListrDefaultRenderer = typeof DefaultRenderer;
|
|
1284
|
+
/** Name of default fallback renderer */
|
|
1285
|
+
declare type ListrFallbackRendererValue = 'verbose';
|
|
1286
|
+
/** Type of default fallback renderer */
|
|
1287
|
+
declare type ListrFallbackRenderer = typeof VerboseRenderer;
|
|
1288
|
+
/** Silent rendere for internal usage */
|
|
1289
|
+
declare type ListrSilentRendererValue = 'silent';
|
|
1290
|
+
/** Typeof silent renderer */
|
|
1291
|
+
declare type ListrSilentRenderer = typeof SilentRenderer;
|
|
1292
|
+
/** Simple renderer that simplifies things */
|
|
1293
|
+
declare type ListrSimpleRendererValue = 'simple';
|
|
1294
|
+
/** Typeof simple renderer */
|
|
1295
|
+
declare type ListrSimpleRenderer = typeof SimpleRenderer;
|
|
1296
|
+
/**
|
|
1297
|
+
* Listr2 can process either the integrated renderers as string aliases,
|
|
1298
|
+
* or utilize a compatible style renderer that extends the ListrRenderer abstract class.
|
|
1299
|
+
*/
|
|
1300
|
+
declare type ListrRendererValue = ListrSilentRendererValue | ListrDefaultRendererValue | ListrSimpleRendererValue | ListrFallbackRendererValue | ListrRendererFactory;
|
|
1301
|
+
/**
|
|
1302
|
+
* Returns the class type from friendly names of the renderers.
|
|
1303
|
+
*/
|
|
1304
|
+
declare type ListrGetRendererClassFromValue<T extends ListrRendererValue> = T extends ListrDefaultRendererValue ? ListrDefaultRenderer : T extends ListrSimpleRendererValue ? ListrSimpleRenderer : T extends ListrFallbackRendererValue ? ListrFallbackRenderer : T extends ListrSilentRenderer ? ListrSilentRenderer : T extends ListrRendererFactory ? T : never;
|
|
1305
|
+
/**
|
|
1306
|
+
* Returns renderer global options depending on the renderer type.
|
|
1307
|
+
*/
|
|
1308
|
+
declare type ListrGetRendererOptions<T extends ListrRendererValue> = T extends ListrDefaultRendererValue ? ListrDefaultRenderer['rendererOptions'] : T extends ListrSimpleRendererValue ? ListrSimpleRenderer['rendererOptions'] : T extends ListrFallbackRendererValue ? ListrFallbackRenderer['rendererOptions'] : T extends ListrSilentRenderer ? ListrSilentRenderer['rendererOptions'] : T extends ListrRendererFactory ? T['rendererOptions'] : never;
|
|
1309
|
+
/**
|
|
1310
|
+
* Returns renderer per task options depending on the renderer type.
|
|
1311
|
+
*/
|
|
1312
|
+
declare type ListrGetRendererTaskOptions<T extends ListrRendererValue> = T extends ListrDefaultRendererValue ? ListrDefaultRenderer['rendererTaskOptions'] : T extends ListrSimpleRendererValue ? ListrSimpleRenderer : T extends ListrFallbackRendererValue ? ListrFallbackRenderer['rendererTaskOptions'] : T extends ListrSilentRenderer ? ListrSilentRenderer['rendererTaskOptions'] : T extends ListrRendererFactory ? T['rendererTaskOptions'] : never;
|
|
1313
|
+
/** Select renderer as default renderer */
|
|
1314
|
+
interface ListrDefaultRendererOptions<T extends ListrRendererValue> {
|
|
1315
|
+
/** the default renderer */
|
|
1316
|
+
renderer?: T;
|
|
1317
|
+
/** Renderer options depending on the current renderer */
|
|
1318
|
+
rendererOptions?: ListrGetRendererOptions<T>;
|
|
1319
|
+
}
|
|
1320
|
+
/** Select a fallback renderer to fallback to in non-tty conditions */
|
|
1321
|
+
interface ListrDefaultNonTTYRendererOptions<T extends ListrRendererValue> {
|
|
1322
|
+
/** the fallback renderer to fallback to on non-tty conditions */
|
|
1323
|
+
nonTTYRenderer?: T;
|
|
1324
|
+
/** Renderer options depending on the current renderer */
|
|
1325
|
+
nonTTYRendererOptions?: ListrGetRendererOptions<T>;
|
|
1326
|
+
}
|
|
1327
|
+
/** The bones of a listr renderer. */
|
|
1328
|
+
declare class ListrRenderer {
|
|
1329
|
+
/** designate renderer global options that is specific to the current renderer */
|
|
1330
|
+
static rendererOptions: Record<PropertyKey, any>;
|
|
1331
|
+
/** designate renderer per task options that is specific to the current renderer */
|
|
1332
|
+
static rendererTaskOptions: Record<PropertyKey, any>;
|
|
1333
|
+
/** designate whether this renderer can work in non-tty environments */
|
|
1334
|
+
static nonTTY: boolean;
|
|
1335
|
+
/** A function to what to do on render */
|
|
1336
|
+
render: () => void;
|
|
1337
|
+
/** A function to what to do on end of the render */
|
|
1338
|
+
end: (err?: Error) => void;
|
|
1339
|
+
/** create a new renderer */
|
|
1340
|
+
constructor(tasks: readonly Task$1<any, ListrRendererFactory>[], options: typeof ListrRenderer.rendererOptions, renderHook$?: Subject<void>);
|
|
1341
|
+
}
|
|
1342
|
+
/** A renderer factory from the current type */
|
|
1343
|
+
declare type ListrRendererFactory = typeof ListrRenderer;
|
|
1344
|
+
|
|
1345
|
+
/** The internal error handling mechanism.. */
|
|
1346
|
+
declare class ListrError<Ctx extends Record<PropertyKey, any> = Record<PropertyKey, any>> extends Error {
|
|
1347
|
+
error: Error;
|
|
1348
|
+
type: ListrErrorTypes;
|
|
1349
|
+
task: Task$1<Ctx, ListrRendererFactory>;
|
|
1350
|
+
path: string;
|
|
1351
|
+
ctx: Ctx;
|
|
1352
|
+
constructor(error: Error, type: ListrErrorTypes, task: Task$1<Ctx, ListrRendererFactory>);
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* The actual error type that is collected and to help identify where the error is triggered from.
|
|
1356
|
+
*/
|
|
1357
|
+
declare enum ListrErrorTypes {
|
|
1358
|
+
/** Task has failed and will try to retry. */
|
|
1359
|
+
WILL_RETRY = "WILL_RETRY",
|
|
1360
|
+
/** Task has failed and will try to rollback. */
|
|
1361
|
+
WILL_ROLLBACK = "WILL_ROLLBACK",
|
|
1362
|
+
/** Task has failed, ran the rollback action but the rollback action itself has failed. */
|
|
1363
|
+
HAS_FAILED_TO_ROLLBACK = "HAS_FAILED_TO_ROLLBACK",
|
|
1364
|
+
/** Task has failed. */
|
|
1365
|
+
HAS_FAILED = "HAS_FAILED",
|
|
1366
|
+
/** Task has failed, but exitOnError is set to false, so will ignore this error. */
|
|
1367
|
+
HAS_FAILED_WITHOUT_ERROR = "HAS_FAILED_WITHOUT_ERROR"
|
|
1368
|
+
}
|
|
1369
|
+
/** The internal error handling mechanism for prompts only. */
|
|
1370
|
+
declare class PromptError extends Error {
|
|
1371
|
+
constructor(message: string);
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
/**
|
|
1375
|
+
* Creates a new set of Listr2 task list.
|
|
1376
|
+
*/
|
|
1377
|
+
declare class Listr<Ctx = ListrContext, Renderer extends ListrRendererValue = ListrDefaultRendererValue, FallbackRenderer extends ListrRendererValue = ListrFallbackRendererValue> {
|
|
1378
|
+
task: ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>> | ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>>[];
|
|
1379
|
+
options?: ListrBaseClassOptions<Ctx, Renderer, FallbackRenderer>;
|
|
1380
|
+
parentTask?: Task$1<any, any>;
|
|
1381
|
+
tasks: Task$1<Ctx, ListrGetRendererClassFromValue<Renderer>>[];
|
|
1382
|
+
err: ListrError<Ctx>[];
|
|
1383
|
+
ctx: Ctx;
|
|
1384
|
+
rendererClass: ListrRendererFactory;
|
|
1385
|
+
rendererClassOptions: ListrGetRendererOptions<ListrRendererFactory>;
|
|
1386
|
+
renderHook$: Task$1<any, any>['renderHook$'];
|
|
1387
|
+
path: string[];
|
|
1388
|
+
private concurrency;
|
|
1389
|
+
private renderer;
|
|
1390
|
+
constructor(task: ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>> | ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>>[], options?: ListrBaseClassOptions<Ctx, Renderer, FallbackRenderer>, parentTask?: Task$1<any, any>);
|
|
1391
|
+
add(task: ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>> | ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>>[]): void;
|
|
1392
|
+
run(context?: Ctx): Promise<Ctx>;
|
|
1393
|
+
private checkAll;
|
|
1394
|
+
private runTask;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
9
1397
|
interface Question {
|
|
10
1398
|
type: 'input' | 'select';
|
|
11
1399
|
name: string;
|
|
12
1400
|
message: string;
|
|
1401
|
+
validate?: (value: string) => string | boolean;
|
|
13
1402
|
default?: string;
|
|
14
|
-
choices?: string[]
|
|
1403
|
+
choices?: string[] | {
|
|
1404
|
+
name: string;
|
|
1405
|
+
value: string;
|
|
1406
|
+
}[];
|
|
15
1407
|
}
|
|
16
1408
|
declare const prompt: <T>(questions: Question[]) => Promise<T>;
|
|
17
|
-
interface Task$1 {
|
|
18
|
-
title: string;
|
|
19
|
-
output: string;
|
|
20
|
-
}
|
|
21
|
-
interface Context {
|
|
22
|
-
}
|
|
23
|
-
interface ListTask {
|
|
24
|
-
title: string;
|
|
25
|
-
task: (ctx: Context, task: Task$1) => Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
interface ListOptions {
|
|
28
|
-
concurrent?: boolean;
|
|
29
|
-
}
|
|
30
|
-
declare const list: (tasks: ListTask[], options?: ListOptions | undefined) => Promise<void>;
|
|
31
1409
|
|
|
32
1410
|
type ui_Question = Question;
|
|
33
1411
|
declare const ui_prompt: typeof prompt;
|
|
34
|
-
type
|
|
35
|
-
declare const
|
|
1412
|
+
type ui_Listr<Ctx = ListrContext, Renderer extends ListrRendererValue = ListrDefaultRendererValue, FallbackRenderer extends ListrRendererValue = ListrFallbackRendererValue> = Listr<Ctx, Renderer, FallbackRenderer>;
|
|
1413
|
+
declare const ui_Listr: typeof Listr;
|
|
36
1414
|
declare namespace ui {
|
|
37
1415
|
export {
|
|
38
1416
|
ui_Question as Question,
|
|
39
1417
|
ui_prompt as prompt,
|
|
40
|
-
|
|
41
|
-
ui_Context as Context,
|
|
42
|
-
ui_list as list,
|
|
1418
|
+
ui_Listr as Listr,
|
|
43
1419
|
};
|
|
44
1420
|
}
|
|
45
1421
|
|
|
@@ -90,6 +1466,7 @@ interface ExecOptions {
|
|
|
90
1466
|
stdout?: Writable;
|
|
91
1467
|
stderr?: Writable;
|
|
92
1468
|
}
|
|
1469
|
+
declare const open: (url: string) => Promise<void>;
|
|
93
1470
|
/**
|
|
94
1471
|
* Runs a command asynchronously, aggregates the stdout data, and returns it.
|
|
95
1472
|
* @param command {string} Command to be executed.
|
|
@@ -100,15 +1477,15 @@ declare const captureOutput: (command: string, args: string[]) => Promise<string
|
|
|
100
1477
|
declare const exec: (command: string, args: string[], options?: ExecOptions | undefined) => Promise<void>;
|
|
101
1478
|
|
|
102
1479
|
type system_ExecOptions = ExecOptions;
|
|
1480
|
+
declare const system_open: typeof open;
|
|
103
1481
|
declare const system_captureOutput: typeof captureOutput;
|
|
104
1482
|
declare const system_exec: typeof exec;
|
|
105
|
-
declare const system_open: typeof open;
|
|
106
1483
|
declare namespace system {
|
|
107
1484
|
export {
|
|
108
1485
|
system_ExecOptions as ExecOptions,
|
|
1486
|
+
system_open as open,
|
|
109
1487
|
system_captureOutput as captureOutput,
|
|
110
1488
|
system_exec as exec,
|
|
111
|
-
system_open as open,
|
|
112
1489
|
};
|
|
113
1490
|
}
|
|
114
1491
|
|
|
@@ -144,6 +1521,8 @@ declare function camelCase(input: string, options?: Options$4): string;
|
|
|
144
1521
|
|
|
145
1522
|
declare function paramCase(input: string, options?: Options$4): string;
|
|
146
1523
|
|
|
1524
|
+
declare function snakeCase(input: string, options?: Options$4): string;
|
|
1525
|
+
|
|
147
1526
|
/** Returns a random string */
|
|
148
1527
|
declare function randomHex(size: number): string;
|
|
149
1528
|
declare function generateRandomChallengePair(): {
|
|
@@ -159,6 +1538,7 @@ declare namespace string {
|
|
|
159
1538
|
string_generateRandomChallengePair as generateRandomChallengePair,
|
|
160
1539
|
camelCase as camelize,
|
|
161
1540
|
paramCase as hyphenize,
|
|
1541
|
+
snakeCase as underscore,
|
|
162
1542
|
};
|
|
163
1543
|
}
|
|
164
1544
|
|
|
@@ -175,7 +1555,7 @@ declare const relative: typeof path$1.relative;
|
|
|
175
1555
|
declare const dirname: typeof path$1.dirname;
|
|
176
1556
|
declare const format: typeof path$1.format;
|
|
177
1557
|
declare const basename: typeof path$1.basename;
|
|
178
|
-
declare const parse
|
|
1558
|
+
declare const parse: typeof path$1.parse;
|
|
179
1559
|
|
|
180
1560
|
interface Options$3 {
|
|
181
1561
|
/**
|
|
@@ -498,6 +1878,7 @@ declare const path_isAbsolute: typeof isAbsolute;
|
|
|
498
1878
|
declare const path_join: typeof join;
|
|
499
1879
|
declare const path_normalize: typeof normalize;
|
|
500
1880
|
declare const path_normalizeString: typeof normalizeString;
|
|
1881
|
+
declare const path_parse: typeof parse;
|
|
501
1882
|
declare const path_relative: typeof relative;
|
|
502
1883
|
declare const path_resolve: typeof resolve;
|
|
503
1884
|
declare const path_sep: typeof sep;
|
|
@@ -515,7 +1896,7 @@ declare namespace path {
|
|
|
515
1896
|
path_join as join,
|
|
516
1897
|
path_normalize as normalize,
|
|
517
1898
|
path_normalizeString as normalizeString,
|
|
518
|
-
|
|
1899
|
+
path_parse as parse,
|
|
519
1900
|
path_relative as relative,
|
|
520
1901
|
path_resolve as resolve,
|
|
521
1902
|
path_sep as sep,
|
|
@@ -523,6 +1904,11 @@ declare namespace path {
|
|
|
523
1904
|
};
|
|
524
1905
|
}
|
|
525
1906
|
|
|
1907
|
+
/**
|
|
1908
|
+
* Creates a temporary directory and ties its lifecycle ot the lifecycle of the callback.
|
|
1909
|
+
* @param callback - The callback that receives the temporary directory.
|
|
1910
|
+
*/
|
|
1911
|
+
declare function inTemporaryDirectory<T>(callback: (tmpDir: string) => T | Promise<T>): Promise<T>;
|
|
526
1912
|
/**
|
|
527
1913
|
* It reads a file and returns its content as a string using the
|
|
528
1914
|
* utf-8 encoding
|
|
@@ -537,29 +1923,65 @@ declare function read(path: string): Promise<string>;
|
|
|
537
1923
|
*/
|
|
538
1924
|
declare function copy(from: string, to: string): Promise<void>;
|
|
539
1925
|
declare function write(path: string, data: string): Promise<void>;
|
|
1926
|
+
declare function append(path: string, data: string): Promise<void>;
|
|
540
1927
|
declare function mkdir(path: string): Promise<void>;
|
|
541
1928
|
declare function rmdir(path: string): Promise<void>;
|
|
542
1929
|
declare function mkTmpDir(): Promise<string>;
|
|
543
1930
|
declare function isDirectory(path: string): Promise<boolean>;
|
|
1931
|
+
/**
|
|
1932
|
+
* Moves a file.
|
|
1933
|
+
* @param src {string} File to be moved.
|
|
1934
|
+
* @param dest {string} Path to be moved to.
|
|
1935
|
+
* @param options {object} Moving options.
|
|
1936
|
+
*/
|
|
1937
|
+
declare function move(src: string, dest: string, options?: {
|
|
1938
|
+
overwrite?: boolean;
|
|
1939
|
+
}): Promise<void>;
|
|
1940
|
+
/**
|
|
1941
|
+
* Changes the permissions of a directory or file.
|
|
1942
|
+
* @param path {string} Path to the file or directory whose permissions will be modified.
|
|
1943
|
+
* @param mode {string | numbers} Permissions to set to the file or directory.
|
|
1944
|
+
*/
|
|
1945
|
+
declare function chmod(path: string, mode: number | string): Promise<void>;
|
|
1946
|
+
/**
|
|
1947
|
+
* Checks if a file has executable permissions.
|
|
1948
|
+
* @param path {string} Path to the file whose permissions will be checked.
|
|
1949
|
+
*/
|
|
1950
|
+
declare function hasExecutablePermissions(path: string): Promise<boolean>;
|
|
1951
|
+
/**
|
|
1952
|
+
* Returns true if a file or directory exists
|
|
1953
|
+
* @param path {string} Path to the directory or file.
|
|
1954
|
+
* @returns {boolean} True if it exists.
|
|
1955
|
+
*/
|
|
544
1956
|
declare function exists(path: string): Promise<boolean>;
|
|
545
1957
|
|
|
1958
|
+
declare const file_inTemporaryDirectory: typeof inTemporaryDirectory;
|
|
546
1959
|
declare const file_read: typeof read;
|
|
547
1960
|
declare const file_copy: typeof copy;
|
|
548
1961
|
declare const file_write: typeof write;
|
|
1962
|
+
declare const file_append: typeof append;
|
|
549
1963
|
declare const file_mkdir: typeof mkdir;
|
|
550
1964
|
declare const file_rmdir: typeof rmdir;
|
|
551
1965
|
declare const file_mkTmpDir: typeof mkTmpDir;
|
|
552
1966
|
declare const file_isDirectory: typeof isDirectory;
|
|
1967
|
+
declare const file_move: typeof move;
|
|
1968
|
+
declare const file_chmod: typeof chmod;
|
|
1969
|
+
declare const file_hasExecutablePermissions: typeof hasExecutablePermissions;
|
|
553
1970
|
declare const file_exists: typeof exists;
|
|
554
1971
|
declare namespace file {
|
|
555
1972
|
export {
|
|
1973
|
+
file_inTemporaryDirectory as inTemporaryDirectory,
|
|
556
1974
|
file_read as read,
|
|
557
1975
|
file_copy as copy,
|
|
558
1976
|
file_write as write,
|
|
1977
|
+
file_append as append,
|
|
559
1978
|
file_mkdir as mkdir,
|
|
560
1979
|
file_rmdir as rmdir,
|
|
561
1980
|
file_mkTmpDir as mkTmpDir,
|
|
562
1981
|
file_isDirectory as isDirectory,
|
|
1982
|
+
file_move as move,
|
|
1983
|
+
file_chmod as chmod,
|
|
1984
|
+
file_hasExecutablePermissions as hasExecutablePermissions,
|
|
563
1985
|
file_exists as exists,
|
|
564
1986
|
};
|
|
565
1987
|
}
|
|
@@ -589,25 +2011,82 @@ declare class TokenizedString {
|
|
|
589
2011
|
}
|
|
590
2012
|
declare type Message = string | TokenizedString;
|
|
591
2013
|
declare function content(strings: TemplateStringsArray, ...keys: (ContentToken | string)[]): TokenizedString;
|
|
2014
|
+
/** Log levels */
|
|
2015
|
+
declare type LogLevel = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'silent';
|
|
2016
|
+
/**
|
|
2017
|
+
*
|
|
2018
|
+
* @returns {LogLevel} It returns the log level set by the user.
|
|
2019
|
+
*/
|
|
2020
|
+
declare const currentLogLevel: () => LogLevel;
|
|
2021
|
+
declare const shouldOutput: (logLevel: LogLevel) => boolean;
|
|
2022
|
+
/**
|
|
2023
|
+
* Ouputs information to the user. This is akin to "console.log"
|
|
2024
|
+
* Info messages don't get additional formatting.
|
|
2025
|
+
* Note: Info messages are sent through the standard output.
|
|
2026
|
+
* @param content {string} The content to be output to the user.
|
|
2027
|
+
*/
|
|
2028
|
+
declare const info: (content: Message) => void;
|
|
2029
|
+
/**
|
|
2030
|
+
* Outputs a success message to the user.
|
|
2031
|
+
* Success message receive a special formatting to make them stand out in the console.
|
|
2032
|
+
* Note: Success messages are sent through the standard output.
|
|
2033
|
+
* @param content {string} The content to be output to the user.
|
|
2034
|
+
*/
|
|
592
2035
|
declare const success: (content: Message) => void;
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
2036
|
+
/**
|
|
2037
|
+
* Ouputs debug information to the user. By default these output is hidden unless the user calls the CLI with --verbose.
|
|
2038
|
+
* Debug messages don't get additional formatting.
|
|
2039
|
+
* Note: Debug messages are sent through the standard output.
|
|
2040
|
+
* @param content {string} The content to be output to the user.
|
|
2041
|
+
*/
|
|
2042
|
+
declare const debug: (content: Message) => void;
|
|
2043
|
+
/**
|
|
2044
|
+
* Outputs a warning message to the user.
|
|
2045
|
+
* Warning messages receive a special formatting to make them stand out in the console.
|
|
2046
|
+
* Note: Warning messages are sent through the standard output.
|
|
2047
|
+
* @param content {string} The content to be output to the user.
|
|
2048
|
+
*/
|
|
2049
|
+
declare const warn: (content: Message) => void;
|
|
2050
|
+
/**
|
|
2051
|
+
* Prints a new line in the terminal.
|
|
2052
|
+
*/
|
|
2053
|
+
declare const newline: () => void;
|
|
2054
|
+
/**
|
|
2055
|
+
* Formats and outputs a fatal error.
|
|
2056
|
+
* Note: This API is not intended to be used internally. If you want to
|
|
2057
|
+
* abort the execution due to an error, raise a fatal error and let the
|
|
2058
|
+
* error handler handle and format it.
|
|
2059
|
+
* @param content {Fatal} The fatal error to be output.
|
|
2060
|
+
*/
|
|
2061
|
+
declare const error: (content: Fatal) => void;
|
|
2062
|
+
declare function stringifyMessage(message: Message): string;
|
|
596
2063
|
|
|
597
2064
|
declare const output$1_token: typeof token;
|
|
598
2065
|
declare const output$1_content: typeof content;
|
|
2066
|
+
type output$1_LogLevel = LogLevel;
|
|
2067
|
+
declare const output$1_currentLogLevel: typeof currentLogLevel;
|
|
2068
|
+
declare const output$1_shouldOutput: typeof shouldOutput;
|
|
2069
|
+
declare const output$1_info: typeof info;
|
|
599
2070
|
declare const output$1_success: typeof success;
|
|
600
|
-
declare const output$
|
|
2071
|
+
declare const output$1_debug: typeof debug;
|
|
2072
|
+
declare const output$1_warn: typeof warn;
|
|
2073
|
+
declare const output$1_newline: typeof newline;
|
|
601
2074
|
declare const output$1_error: typeof error;
|
|
602
|
-
declare const output$
|
|
2075
|
+
declare const output$1_stringifyMessage: typeof stringifyMessage;
|
|
603
2076
|
declare namespace output$1 {
|
|
604
2077
|
export {
|
|
605
2078
|
output$1_token as token,
|
|
606
2079
|
output$1_content as content,
|
|
2080
|
+
output$1_LogLevel as LogLevel,
|
|
2081
|
+
output$1_currentLogLevel as currentLogLevel,
|
|
2082
|
+
output$1_shouldOutput as shouldOutput,
|
|
2083
|
+
output$1_info as info,
|
|
607
2084
|
output$1_success as success,
|
|
608
|
-
output$
|
|
2085
|
+
output$1_debug as debug,
|
|
2086
|
+
output$1_warn as warn,
|
|
2087
|
+
output$1_newline as newline,
|
|
609
2088
|
output$1_error as error,
|
|
610
|
-
output$
|
|
2089
|
+
output$1_stringifyMessage as stringifyMessage,
|
|
611
2090
|
};
|
|
612
2091
|
}
|
|
613
2092
|
|
|
@@ -659,12 +2138,22 @@ declare namespace version {
|
|
|
659
2138
|
};
|
|
660
2139
|
}
|
|
661
2140
|
|
|
662
|
-
declare const username: () => Promise<string | null>;
|
|
2141
|
+
declare const username: (platform?: typeof platform) => Promise<string | null>;
|
|
2142
|
+
/**
|
|
2143
|
+
* Returns the platform and architecture.
|
|
2144
|
+
* @returns {{platform: string, arch: string}} Returns the current platform and architecture.
|
|
2145
|
+
*/
|
|
2146
|
+
declare const platformAndArch: (platform?: typeof platform) => {
|
|
2147
|
+
platform: string;
|
|
2148
|
+
arch: string;
|
|
2149
|
+
};
|
|
663
2150
|
|
|
664
2151
|
declare const os_username: typeof username;
|
|
2152
|
+
declare const os_platformAndArch: typeof platformAndArch;
|
|
665
2153
|
declare namespace os {
|
|
666
2154
|
export {
|
|
667
2155
|
os_username as username,
|
|
2156
|
+
os_platformAndArch as platformAndArch,
|
|
668
2157
|
};
|
|
669
2158
|
}
|
|
670
2159
|
|
|
@@ -816,18 +2305,52 @@ interface OAuthApplications {
|
|
|
816
2305
|
storefrontRendererApi?: StorefrontRendererAPIOAuthOptions;
|
|
817
2306
|
partnersApi?: PartnersAPIOAuthOptions;
|
|
818
2307
|
}
|
|
2308
|
+
interface OAuthSession {
|
|
2309
|
+
admin?: string;
|
|
2310
|
+
partners?: string;
|
|
2311
|
+
storefront?: string;
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* Ensure that we have a valid session to access the Partners API.
|
|
2315
|
+
* If SHOPIFY_CLI_PARTNERS_TOKEN exists, that token will be used to obtain a valid Partners Token
|
|
2316
|
+
* If SHOPIFY_CLI_PARTNERS_TOKEN exists, scopes will be ignored
|
|
2317
|
+
* @param scopes {string[]} Optional array of extra scopes to authenticate with.
|
|
2318
|
+
* @returns {Promise<string>} The access token for the Partners API.
|
|
2319
|
+
*/
|
|
2320
|
+
declare function ensureAuthenticatedPartners(scopes?: string[], env?: NodeJS.ProcessEnv): Promise<string>;
|
|
2321
|
+
/**
|
|
2322
|
+
* Ensure that we have a valid session to access the Storefront API.
|
|
2323
|
+
* @param scopes {string[]} Optional array of extra scopes to authenticate with.
|
|
2324
|
+
* @returns {Promise<string>} The access token for the Storefront API.
|
|
2325
|
+
*/
|
|
2326
|
+
declare function ensureAuthenticatedStorefront(scopes?: string[]): Promise<string>;
|
|
2327
|
+
/**
|
|
2328
|
+
* Ensure that we have a valid Admin session for the given store.
|
|
2329
|
+
* @param store {string} Store fqdn to request auth for
|
|
2330
|
+
* @param scopes {string[]} Optional array of extra scopes to authenticate with.
|
|
2331
|
+
* @returns {Promise<string>} The access token for the Admin API
|
|
2332
|
+
*/
|
|
2333
|
+
declare function ensureAuthenticatedAdmin(store: string, scopes?: string[]): Promise<string>;
|
|
819
2334
|
/**
|
|
820
2335
|
* This method ensures that we have a valid session to authenticate against the given applications using the provided scopes.
|
|
821
|
-
* @param
|
|
2336
|
+
* @param applications {OAuthApplications} An object containing the applications we need to be authenticated with.
|
|
822
2337
|
* @returns {OAuthSession} An instance with the access tokens organized by application.
|
|
823
2338
|
*/
|
|
824
|
-
declare function ensureAuthenticated(applications: OAuthApplications): Promise<
|
|
2339
|
+
declare function ensureAuthenticated(applications: OAuthApplications, env?: NodeJS.ProcessEnv): Promise<OAuthSession>;
|
|
825
2340
|
|
|
826
2341
|
type session_OAuthApplications = OAuthApplications;
|
|
2342
|
+
type session_OAuthSession = OAuthSession;
|
|
2343
|
+
declare const session_ensureAuthenticatedPartners: typeof ensureAuthenticatedPartners;
|
|
2344
|
+
declare const session_ensureAuthenticatedStorefront: typeof ensureAuthenticatedStorefront;
|
|
2345
|
+
declare const session_ensureAuthenticatedAdmin: typeof ensureAuthenticatedAdmin;
|
|
827
2346
|
declare const session_ensureAuthenticated: typeof ensureAuthenticated;
|
|
828
2347
|
declare namespace session {
|
|
829
2348
|
export {
|
|
830
2349
|
session_OAuthApplications as OAuthApplications,
|
|
2350
|
+
session_OAuthSession as OAuthSession,
|
|
2351
|
+
session_ensureAuthenticatedPartners as ensureAuthenticatedPartners,
|
|
2352
|
+
session_ensureAuthenticatedStorefront as ensureAuthenticatedStorefront,
|
|
2353
|
+
session_ensureAuthenticatedAdmin as ensureAuthenticatedAdmin,
|
|
831
2354
|
session_ensureAuthenticated as ensureAuthenticated,
|
|
832
2355
|
};
|
|
833
2356
|
}
|
|
@@ -2158,12 +3681,15 @@ declare namespace schema {
|
|
|
2158
3681
|
};
|
|
2159
3682
|
}
|
|
2160
3683
|
|
|
2161
|
-
declare function
|
|
3684
|
+
declare function decode(input: string): object;
|
|
3685
|
+
declare function encode(content: any): string;
|
|
2162
3686
|
|
|
2163
|
-
declare const
|
|
3687
|
+
declare const toml_decode: typeof decode;
|
|
3688
|
+
declare const toml_encode: typeof encode;
|
|
2164
3689
|
declare namespace toml {
|
|
2165
3690
|
export {
|
|
2166
|
-
|
|
3691
|
+
toml_decode as decode,
|
|
3692
|
+
toml_encode as encode,
|
|
2167
3693
|
};
|
|
2168
3694
|
}
|
|
2169
3695
|
|
|
@@ -3363,34 +4889,35 @@ declare class Conf<T extends Record<string, any> = Record<string, unknown>> impl
|
|
|
3363
4889
|
private _set;
|
|
3364
4890
|
}
|
|
3365
4891
|
|
|
3366
|
-
|
|
4892
|
+
interface CachedAppInfo {
|
|
4893
|
+
appId: string;
|
|
4894
|
+
orgId?: string;
|
|
4895
|
+
storeFqdn?: string;
|
|
4896
|
+
}
|
|
4897
|
+
interface ConfSchema {
|
|
4898
|
+
appInfo: CachedAppInfo[];
|
|
4899
|
+
}
|
|
4900
|
+
declare const cliKit: Conf<ConfSchema>;
|
|
4901
|
+
declare function getAppInfo(appId: string): CachedAppInfo | undefined;
|
|
4902
|
+
declare function setAppInfo(appId: string, data: {
|
|
4903
|
+
storeFqdn?: string;
|
|
4904
|
+
orgId?: string;
|
|
4905
|
+
}): void;
|
|
3367
4906
|
|
|
4907
|
+
type store_CachedAppInfo = CachedAppInfo;
|
|
3368
4908
|
declare const store_cliKit: typeof cliKit;
|
|
4909
|
+
declare const store_getAppInfo: typeof getAppInfo;
|
|
4910
|
+
declare const store_setAppInfo: typeof setAppInfo;
|
|
3369
4911
|
declare namespace store {
|
|
3370
4912
|
export {
|
|
4913
|
+
store_CachedAppInfo as CachedAppInfo,
|
|
3371
4914
|
store_cliKit as cliKit,
|
|
4915
|
+
store_getAppInfo as getAppInfo,
|
|
4916
|
+
store_setAppInfo as setAppInfo,
|
|
3372
4917
|
};
|
|
3373
4918
|
}
|
|
3374
4919
|
|
|
3375
|
-
|
|
3376
|
-
* The schema represents an application token.
|
|
3377
|
-
*/
|
|
3378
|
-
declare const ApplicationTokenSchema: ZodObject<{
|
|
3379
|
-
accessToken: ZodString;
|
|
3380
|
-
expiresAt: ZodEffects<ZodDate, Date, Date>;
|
|
3381
|
-
scopes: ZodArray<ZodString, "many">;
|
|
3382
|
-
}, "strip", ZodTypeAny, {
|
|
3383
|
-
accessToken: string;
|
|
3384
|
-
expiresAt: Date;
|
|
3385
|
-
scopes: string[];
|
|
3386
|
-
}, {
|
|
3387
|
-
accessToken: string;
|
|
3388
|
-
expiresAt: Date;
|
|
3389
|
-
scopes: string[];
|
|
3390
|
-
}>;
|
|
3391
|
-
declare type ApplicationToken = TypeOf<typeof ApplicationTokenSchema>;
|
|
3392
|
-
|
|
3393
|
-
declare function request$1<T>(query: any, token: ApplicationToken, store: string, variables?: any): Promise<T>;
|
|
4920
|
+
declare function request$1<T>(query: any, token: string, store: string, variables?: any): Promise<T>;
|
|
3394
4921
|
|
|
3395
4922
|
declare namespace admin {
|
|
3396
4923
|
export {
|
|
@@ -3398,7 +4925,7 @@ declare namespace admin {
|
|
|
3398
4925
|
};
|
|
3399
4926
|
}
|
|
3400
4927
|
|
|
3401
|
-
declare function request<T>(query: any, token:
|
|
4928
|
+
declare function request<T>(query: any, token: string, variables?: any): Promise<T>;
|
|
3402
4929
|
|
|
3403
4930
|
declare const partners_request: typeof request;
|
|
3404
4931
|
declare namespace partners {
|
|
@@ -3407,15 +4934,111 @@ declare namespace partners {
|
|
|
3407
4934
|
};
|
|
3408
4935
|
}
|
|
3409
4936
|
|
|
4937
|
+
declare const FindOrganizationQuery: string;
|
|
4938
|
+
interface FindOrganizationQuerySchema {
|
|
4939
|
+
organizations: {
|
|
4940
|
+
nodes: {
|
|
4941
|
+
id: string;
|
|
4942
|
+
businessName: string;
|
|
4943
|
+
website: string;
|
|
4944
|
+
stores: {
|
|
4945
|
+
nodes: {
|
|
4946
|
+
shopId: string;
|
|
4947
|
+
link: string;
|
|
4948
|
+
shopDomain: string;
|
|
4949
|
+
shopName: string;
|
|
4950
|
+
transferDisabled: boolean;
|
|
4951
|
+
convertableToPartnerTest: boolean;
|
|
4952
|
+
}[];
|
|
4953
|
+
};
|
|
4954
|
+
apps: {
|
|
4955
|
+
nodes: {
|
|
4956
|
+
id: string;
|
|
4957
|
+
title: string;
|
|
4958
|
+
apiKey: string;
|
|
4959
|
+
apiSecretKeys: {
|
|
4960
|
+
secret: string;
|
|
4961
|
+
};
|
|
4962
|
+
appType: string;
|
|
4963
|
+
}[];
|
|
4964
|
+
};
|
|
4965
|
+
}[];
|
|
4966
|
+
};
|
|
4967
|
+
}
|
|
4968
|
+
|
|
4969
|
+
interface AllOrganizationsQuerySchema {
|
|
4970
|
+
organizations: {
|
|
4971
|
+
nodes: {
|
|
4972
|
+
id: string;
|
|
4973
|
+
businessName: string;
|
|
4974
|
+
website: string;
|
|
4975
|
+
}[];
|
|
4976
|
+
};
|
|
4977
|
+
}
|
|
4978
|
+
declare const AllOrganizationsQuery: string;
|
|
4979
|
+
|
|
4980
|
+
declare const CreateAppQuery: string;
|
|
4981
|
+
interface CreateAppQueryVariables {
|
|
4982
|
+
org: number;
|
|
4983
|
+
title: string;
|
|
4984
|
+
appUrl: string;
|
|
4985
|
+
redir: string[];
|
|
4986
|
+
type: string;
|
|
4987
|
+
}
|
|
4988
|
+
interface CreateAppQuerySchema {
|
|
4989
|
+
appCreate: {
|
|
4990
|
+
app: {
|
|
4991
|
+
id: string;
|
|
4992
|
+
apiKey: string;
|
|
4993
|
+
title: string;
|
|
4994
|
+
applicationUrl: string;
|
|
4995
|
+
redirectUrlWhitelist: string[];
|
|
4996
|
+
apiSecretKeys: {
|
|
4997
|
+
secret: string;
|
|
4998
|
+
};
|
|
4999
|
+
appType: string;
|
|
5000
|
+
};
|
|
5001
|
+
userErrors: {
|
|
5002
|
+
field: string[];
|
|
5003
|
+
message: string;
|
|
5004
|
+
}[];
|
|
5005
|
+
};
|
|
5006
|
+
}
|
|
5007
|
+
|
|
5008
|
+
declare const index_FindOrganizationQuery: typeof FindOrganizationQuery;
|
|
5009
|
+
type index_FindOrganizationQuerySchema = FindOrganizationQuerySchema;
|
|
5010
|
+
type index_AllOrganizationsQuerySchema = AllOrganizationsQuerySchema;
|
|
5011
|
+
declare const index_AllOrganizationsQuery: typeof AllOrganizationsQuery;
|
|
5012
|
+
declare const index_CreateAppQuery: typeof CreateAppQuery;
|
|
5013
|
+
type index_CreateAppQueryVariables = CreateAppQueryVariables;
|
|
5014
|
+
type index_CreateAppQuerySchema = CreateAppQuerySchema;
|
|
5015
|
+
declare namespace index {
|
|
5016
|
+
export {
|
|
5017
|
+
index_FindOrganizationQuery as FindOrganizationQuery,
|
|
5018
|
+
index_FindOrganizationQuerySchema as FindOrganizationQuerySchema,
|
|
5019
|
+
index_AllOrganizationsQuerySchema as AllOrganizationsQuerySchema,
|
|
5020
|
+
index_AllOrganizationsQuery as AllOrganizationsQuery,
|
|
5021
|
+
index_CreateAppQuery as CreateAppQuery,
|
|
5022
|
+
index_CreateAppQueryVariables as CreateAppQueryVariables,
|
|
5023
|
+
index_CreateAppQuerySchema as CreateAppQuerySchema,
|
|
5024
|
+
};
|
|
5025
|
+
}
|
|
5026
|
+
|
|
3410
5027
|
declare const api_admin: typeof admin;
|
|
3411
5028
|
declare const api_partners: typeof partners;
|
|
3412
5029
|
declare namespace api {
|
|
3413
5030
|
export {
|
|
3414
5031
|
api_admin as admin,
|
|
3415
5032
|
api_partners as partners,
|
|
5033
|
+
index as graphql,
|
|
3416
5034
|
};
|
|
3417
5035
|
}
|
|
3418
5036
|
|
|
5037
|
+
declare const FormData: {
|
|
5038
|
+
new (): FormData;
|
|
5039
|
+
prototype: FormData;
|
|
5040
|
+
};
|
|
5041
|
+
|
|
3419
5042
|
/** @type {typeof globalThis.Blob} */
|
|
3420
5043
|
declare const Blob: typeof globalThis.Blob;
|
|
3421
5044
|
|
|
@@ -3619,9 +5242,33 @@ declare namespace http {
|
|
|
3619
5242
|
};
|
|
3620
5243
|
}
|
|
3621
5244
|
|
|
5245
|
+
declare const InvalidChecksumError: ({ file, expected, got }: {
|
|
5246
|
+
file: string;
|
|
5247
|
+
expected: string;
|
|
5248
|
+
got: string;
|
|
5249
|
+
}) => Abort;
|
|
5250
|
+
/**
|
|
5251
|
+
* Given a local file and a URL pointing to a remote file representing the MD5 of a local file,
|
|
5252
|
+
* it validates the authenticity of the binary using an MD5 checksum.
|
|
5253
|
+
* @param options: The file to validate and the URL that points to the file containing the MD5.
|
|
5254
|
+
*/
|
|
5255
|
+
declare function validateMD5({ file, md5FileURL }: {
|
|
5256
|
+
file: string;
|
|
5257
|
+
md5FileURL: string;
|
|
5258
|
+
}): Promise<void>;
|
|
5259
|
+
|
|
5260
|
+
declare const checksum_InvalidChecksumError: typeof InvalidChecksumError;
|
|
5261
|
+
declare const checksum_validateMD5: typeof validateMD5;
|
|
5262
|
+
declare namespace checksum {
|
|
5263
|
+
export {
|
|
5264
|
+
checksum_InvalidChecksumError as InvalidChecksumError,
|
|
5265
|
+
checksum_validateMD5 as validateMD5,
|
|
5266
|
+
};
|
|
5267
|
+
}
|
|
5268
|
+
|
|
3622
5269
|
declare const constants: {
|
|
3623
5270
|
environmentVariables: {
|
|
3624
|
-
|
|
5271
|
+
shopifyConfig: string;
|
|
3625
5272
|
runAsUser: string;
|
|
3626
5273
|
partnersEnv: string;
|
|
3627
5274
|
shopifyEnv: string;
|
|
@@ -3631,6 +5278,7 @@ declare const constants: {
|
|
|
3631
5278
|
spinWorkspace: string;
|
|
3632
5279
|
spinNamespace: string;
|
|
3633
5280
|
spinHost: string;
|
|
5281
|
+
partnersToken: string;
|
|
3634
5282
|
};
|
|
3635
5283
|
paths: {
|
|
3636
5284
|
executables: {
|
|
@@ -3658,5 +5306,5 @@ declare const constants: {
|
|
|
3658
5306
|
};
|
|
3659
5307
|
};
|
|
3660
5308
|
|
|
3661
|
-
export { api, constants, dependency, environment, error$1 as error, file, http, os, output$1 as output, path, schema, session, store, string, system, template, toml, ui, version };
|
|
5309
|
+
export { api, checksum, constants, dependency, environment, error$1 as error, file, http, os, output$1 as output, path, schema, session, store, string, system, template, toml, ui, version };
|
|
3662
5310
|
//# sourceMappingURL=index.d.ts.map
|