This repository has been archived by the owner on Feb 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdeclarations.d.ts
2056 lines (1806 loc) · 59.4 KB
/
declarations.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
interface Object {
[key: string]: any;
}
interface IStringDictionary extends IDictionary<string> { }
/**
* Describes iTunes Connect application types
*/
interface IiTunesConnectApplicationType {
/**
* Applications developed for iOS
* @type {string}
*/
iOS: string;
/**
* Applications developed for Mac OS
* @type {string}
*/
Mac: string;
}
/**
* Describes the types of data that can be send to Google Analytics.
* Their values are the names of the methods in universnal-analytics that have to be called to track this type of data.
* Also known as Hit Type: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#t
*/
declare const enum GoogleAnalyticsDataType {
Page = "pageview",
Event = "event"
}
/**
* Descibes iTunes Connect applications
*/
interface IiTunesConnectApplication {
/**
* Unique Apple ID for each application. Automatically generated and assigned by Apple.
* @type {string}
*/
adamId: string;
/**
* No information available.
* @type {number}
*/
addOnCount: number;
/**
* The application's bundle identifier.
* @type {string}
*/
bundleId: string;
/**
* Application's name
* @type {string}
*/
name: string;
/**
* Application's stock keeping unit. User-defined unique string to keep track of the applications
* @type {string}
*/
sku: string;
/**
* Application's type
* @type {IItunesConnectApplicationTypes}
*/
type: string;
/**
* Application's current version
* @type {string}
*/
version: string;
}
/**
* Describes configuration settings that modify the behavior of some methods.
*/
interface IConfigurationSettings {
/**
* This string will be used when constructing the UserAgent http header.
* @type {string}
*/
userAgentName?: string;
/**
* Describes the profile directory that will be used for various CLI settings, like user-settings.json file location, extensions, etc.
* @type {string}
*/
profileDir?: string;
}
/**
* Describes service used to confugure various settings.
*/
interface ISettingsService {
/**
* Used to set various settings in order to modify the behavior of some methods.
* @param {IConfigurationSettings} settings Settings which will modify the behaviour of some methods.
* @returns {void}
*/
setSettings(settings: IConfigurationSettings): void;
/**
* Returns currently used profile directory.
* @returns {string}
*/
getProfileDir(): string;
}
/**
* Describes data returned from querying itunes' Content Delivery api
*/
interface IContentDeliveryBody {
/**
* Error object - likely present if result's Success is false.
*/
error?: Error;
/**
* Query results.
*/
result: {
/**
* A list of the user's applications.
* @type {IItunesConnectApplication[]}
*/
Applications: IiTunesConnectApplication[];
/**
* Error code - likely present if Success is false.
* @type {number}
*/
ErrorCode?: number;
/**
* Error message - likely present if Success is false.
* @type {string}
*/
ErrorMessage?: string;
/**
* Error message - likely present if Success is false.
* @type {string[]}
*/
Errors?: string[];
/**
* Indication whether the query was a success or not.
* @type {boolean}
*/
Success: boolean;
};
}
declare module Server {
interface IResponse {
response: any;
body?: any;
headers: any;
error?: Error;
}
interface IHttpClient {
httpRequest(url: string): Promise<IResponse>;
httpRequest(options: any, proxySettings?: IProxySettings): Promise<IResponse>;
}
interface IRequestResponseData {
statusCode: number;
headers: { [index: string]: any };
pipe(destination: any, options?: { end?: boolean; }): IRequestResponseData;
on(event: string, listener: Function): void;
}
}
interface IDisposable {
dispose(): void;
}
interface IShouldDispose {
shouldDispose: boolean;
setShouldDispose(shouldDispose: boolean): void;
}
/**
* Describes the type of data sent to analytics service.
*/
declare const enum TrackingTypes {
/**
* Defines that the data contains information for initialization of a new Analytics monitor.
*/
Initialization = "initialization",
/**
* Defines that the data contains feature that should be tracked.
*/
Feature = "feature",
/**
* Defines that the data contains exception that should be tracked.
*/
Exception = "exception",
/**
* Defines that the data contains the answer of the question if user allows to be tracked.
*/
AcceptTrackFeatureUsage = "acceptTrackFeatureUsage",
/**
* Defines data that will be tracked to Google Analytics.
*/
GoogleAnalyticsData = "googleAnalyticsData",
/**
* Defines that all information has been sent and no more data will be tracked in current session.
*/
Finish = "finish"
}
/**
* Describes the status of the current Analytics status, i.e. has the user allowed to be tracked.
*/
declare const enum AnalyticsStatus {
/**
* User has allowed to be tracked.
*/
enabled = "enabled",
/**
* User has declined to be tracked.
*/
disabled = "disabled",
/**
* User has not been asked to allow feature and error tracking.
*/
notConfirmed = "not confirmed"
}
/**
* Describes types of options that manage -- flags.
*/
declare const enum OptionType {
/**
* String option
*/
String = "string",
/**
* Boolean option
*/
Boolean = "boolean",
/**
* Number option
*/
Number = "number",
/**
* Array option
*/
Array = "array",
/**
* Object option
*/
Object = "object"
}
/**
* Describes options that can be passed to fs.readFile method.
*/
interface IReadFileOptions {
/**
* Defines the encoding. Defaults to null.
*/
encoding: string;
/**
* Defines file flags. Defaults to "r".
*/
flag?: string;
}
interface IFileSystem {
zipFiles(zipFile: string, files: string[], zipPathCallback: (path: string) => string): Promise<void>;
unzip(zipFile: string, destinationDir: string, options?: { overwriteExisitingFiles?: boolean; caseSensitive?: boolean }, fileFilters?: string[]): Promise<void>;
/**
* Test whether or not the given path exists by checking with the file system.
* @param {string} path Path to be checked.
* @returns {boolean} True if path exists, false otherwise.
*/
exists(path: string): boolean;
/**
* Deletes a file.
* @param {string} path Path to be deleted.
* @returns {void} undefined
*/
deleteFile(path: string): void;
/**
* Deletes whole directory. Implementation uses shelljs.
* @param {string} directory Path to directory that has to be deleted.
* @returns {void}
*/
deleteDirectory(directory: string): void;
/**
* Returns the size of specified file.
* @param {string} path Path to file.
* @returns {number} File size in bytes.
*/
getFileSize(path: string): number;
/**
* Change file timestamps of the file referenced by the supplied path.
* @param {string} path File path
* @param {Date} atime Access time
* @param {Date} mtime Modified time
* @returns {void}
*/
utimes(path: string, atime: Date, mtime: Date): void
futureFromEvent(eventEmitter: NodeJS.EventEmitter, event: string): Promise<any>;
/**
* Create a new directory and any necessary subdirectories at specified location.
* @param {string} path Directory to be created.
* @returns {void}
*/
createDirectory(path: string): void;
/**
* Reads contents of directory and returns an array of filenames excluding '.' and '..'.
* @param {string} path Path to directory to be checked.
* @retruns {string[]} Array of filenames excluding '.' and '..'
*/
readDirectory(path: string): string[];
/**
* Reads the entire contents of a file.
* @param {string} filename Path to the file that has to be read.
* @param {string} @optional options Options used for reading the file - encoding and flags.
* @returns {string|NodeBuffer} Content of the file as buffer. In case encoding is specified, the content is returned as string.
*/
readFile(filename: string, options?: IReadFileOptions): string | NodeBuffer;
/**
* Reads the entire contents of a file and returns the result as string.
* @param {string} filename Path to the file that has to be read.
* @param {string} @optional options Options used for reading the file - encoding and flags. If options are not passed, utf8 is used.
* @returns {string} Content of the file as string.
*/
readText(filename: string, encoding?: IReadFileOptions | string): string;
/**
* Reads the entire content of a file and parses it to JSON object.
* @param {string} filename Path to the file that has to be read.
* @param {string} @optional encoding File encoding, defaults to utf8.
* @returns {string} Content of the file as JSON object.
*/
readJson(filename: string, encoding?: string): any;
readStdin(): Promise<string>;
/**
* Writes data to a file, replacing the file if it already exists. data can be a string or a buffer.
* @param {string} filename Path to file to be created.
* @param {string | NodeBuffer} data Data to be written to file.
* @param {string} encoding @optional File encoding, defaults to utf8.
* @returns {void}
*/
writeFile(filename: string, data: string | NodeBuffer, encoding?: string): void;
/**
* Appends data to a file, creating the file if it does not yet exist. Data can be a string or a buffer.
* @param {string} filename Path to file to be created.
* @param {string | NodeBuffer} data Data to be appended to file.
* @param {string} encoding @optional File encoding, defaults to utf8.
* @returns {void}
*/
appendFile(filename: string, data: string | NodeBuffer, encoding?: string): void;
/**
* Writes JSON data to file.
* @param {string} filename Path to file to be created.
* @param {any} data JSON data to be written to file.
* @param {string} space Identation that will be used for the file.
* @param {string} encoding @optional File encoding, defaults to utf8.
* @returns {void}
*/
writeJson(filename: string, data: any, space?: string, encoding?: string): void;
/**
* Copies a file.
* @param {string} sourceFileName The original file that has to be copied.
* @param {string} destinationFileName The filepath where the file should be copied.
* @returns {void}
*/
copyFile(sourceFileName: string, destinationFileName: string): void;
/**
* Returns unique file name based on the passed name by checkin if it exists and adding numbers to the passed name until a non-existent file is found.
* @param {string} baseName The name based on which the unique name will be generated.
* @returns {string} Unique filename. In case baseName does not exist, it will be returned.
*/
getUniqueFileName(baseName: string): string;
/**
* Checks if specified directory is empty.
* @param {string} directoryPath The directory that will be checked.
* @returns {boolean} True in case the directory is empty. False otherwise.
*/
isEmptyDir(directoryPath: string): boolean;
isRelativePath(path: string): boolean /* feels so lonely here, I don't have a Future */;
/**
* Checks if directory exists and if not - creates it.
* @param {string} directoryPath Directory path.
* @returns {void}
*/
ensureDirectoryExists(directoryPath: string): void;
/**
* Renames file/directory. This method throws error in case the original file name does not exist.
* @param {string} oldPath The original filename.
* @param {string} newPath New filename.
* @returns {string} void.
*/
rename(oldPath: string, newPath: string): void;
/**
* Renames specified file to the specified name only in case it exists.
* Used to skip ENOENT errors when rename is called directly.
* @param {string} oldPath Path to original file that has to be renamed. If this file does not exists, no operation is executed.
* @param {string} newPath The path where the file will be moved.
* @return {boolean} True in case of successful rename. False in case the file does not exist.
*/
renameIfExists(oldPath: string, newPath: string): boolean
/**
* Returns information about the specified file.
* In case the passed path is symlink, the returned information is about the original file.
* @param {string} path Path to file for which the information will be taken.
* @returns {IFsStats} Inforamation about the specified file.
*/
getFsStats(path: string): IFsStats;
/**
* Returns information about the specified file.
* In case the passed path is symlink, the returned information is about the symlink itself.
* @param {string} path Path to file for which the information will be taken.
* @returns {IFsStats} Inforamation about the specified file.
*/
getLsStats(path: string): IFsStats;
symlink(sourcePath: string, destinationPath: string, type: "file"): void;
symlink(sourcePath: string, destinationPath: string, type: "dir"): void;
symlink(sourcePath: string, destinationPath: string, type: "junction"): void;
/**
* Creates a symbolic link.
* Symbolic links are interpreted at run time as if the contents of the
* link had been substituted into the path being followed to find a file
* or directory.
* @param {string} sourcePath The original path of the file/dir.
* @param {string} destinationPath The destination where symlink will be created.
* @param {string} @optional type "file", "dir" or "junction". Default is 'file'.
* Type option is only available on Windows (ignored on other platforms).
* Note that Windows junction points require the destination path to be absolute.
* When using 'junction', the target argument will automatically be normalized to absolute path.
* @returns {void}
*/
symlink(sourcePath: string, destinationPath: string, type?: string): void;
createReadStream(path: string, options?: {
flags?: string;
encoding?: string;
fd?: number;
mode?: number;
bufferSize?: number;
start?: number;
end?: number;
highWaterMark?: number;
}): NodeJS.ReadableStream;
createWriteStream(path: string, options?: {
flags?: string;
encoding?: string;
string?: string;
}): any;
/**
* Changes file mode of the specified file. In case it is a symlink, the original file's mode is modified.
* @param {string} path Filepath to be modified.
* @param {number | string} mode File mode.
* @returns {void}
*/
chmod(path: string, mode: number | string): void;
setCurrentUserAsOwner(path: string, owner: string): Promise<void>;
enumerateFilesInDirectorySync(directoryPath: string, filterCallback?: (file: string, stat: IFsStats) => boolean, opts?: { enumerateDirectories?: boolean, includeEmptyDirectories?: boolean }): string[];
/**
* Hashes a file's contents.
* @param {string} fileName Path to file
* @param {Object} options algorithm and digest encoding. Default values are sha1 for algorithm and hex for encoding
* @return {Promise<string>} The computed shasum
*/
getFileShasum(fileName: string, options?: { algorithm?: string, encoding?: "latin1" | "hex" | "base64" }): Promise<string>;
// shell.js wrappers
/**
* @param (string) options Options, can be undefined or a combination of "-r" (recursive) and "-f" (force)
* @param (string[]) files files and direcories to delete
*/
rm(options: string, ...files: string[]): void;
/**
* Deletes all empty parent directories.
* @param {string} directory The directory from which this method will start looking for empty parents.
* @returns {void}
*/
deleteEmptyParents(directory: string): void;
/**
* Return the canonicalized absolute pathname.
* NOTE: The method accepts second argument, but it's type and usage is different in Node 4 and Node 6. Once we drop support for Node 4, we can use the second argument as well.
* @param {string} filePath Path to file which should be resolved.
* @returns {string} The canonicalized absolute path to file.
*/
realpath(filePath: string): string;
}
// duplicated from fs.Stats, because I cannot import it here
interface IFsStats {
isFile(): boolean;
isDirectory(): boolean;
isBlockDevice(): boolean;
isCharacterDevice(): boolean;
isSymbolicLink(): boolean;
isFIFO(): boolean;
isSocket(): boolean;
dev: number;
ino: number;
mode: number;
nlink: number;
uid: number;
gid: number;
rdev: number;
size: number;
blksize: number;
blocks: number;
atime: Date;
mtime: Date;
ctime: Date;
}
interface IOpener {
open(filename: string, appname?: string): void;
}
interface IErrors {
fail(formatStr: string, ...args: any[]): never;
fail(opts: { formatStr?: string; errorCode?: number; suppressCommandHelp?: boolean, proxyAuthenticationRequired?: boolean, printOnStdout?: boolean }, ...args: any[]): never;
failWithoutHelp(message: string, ...args: any[]): never;
beginCommand(action: () => Promise<boolean>, printCommandHelp: () => Promise<void>): Promise<boolean>;
verifyHeap(message: string): void;
printCallStack: boolean;
}
/**
* Describes error raised when making http requests.
*/
interface IHttpRequestError extends Error {
/**
* Defines if the error is caused by the proxy requiring authentication.
*/
proxyAuthenticationRequired: boolean;
}
/**
* Describes error that has stderr information.
*/
interface IStdError extends Error {
/**
* If the error comes from process and have some stderr information - use this property to store it.
*/
stderr: string;
}
interface ICommandOptions {
disableAnalytics?: boolean;
enableHooks?: boolean;
disableCommandHelpSuggestion?: boolean;
}
declare const enum ErrorCodes {
UNCAUGHT = 120,
UNKNOWN = 127,
INVALID_ARGUMENT = 128,
RESOURCE_PROBLEM = 129,
KARMA_FAIL = 130,
UNHANDLED_REJECTION_FAILURE = 131
}
interface IFutureDispatcher {
run(): void;
dispatch(action: () => Promise<void>): void;
}
interface ICommandDispatcher {
dispatchCommand(): Promise<void>;
completeCommand(): Promise<boolean>;
}
interface ICancellationService extends IDisposable {
begin(name: string): Promise<void>;
end(name: string): void;
}
interface IQueue<T> {
enqueue(item: T): void;
dequeue(): Promise<T>;
}
interface IChildProcess extends NodeJS.EventEmitter {
exec(command: string, options?: any, execOptions?: IExecOptions): Promise<any>;
execFile<T>(command: string, args: string[]): Promise<T>;
spawn(command: string, args?: string[], options?: any): any; // it returns child_process.ChildProcess you can safely cast to it
spawnFromEvent(command: string, args: string[], event: string, options?: any, spawnFromEventOptions?: ISpawnFromEventOptions): Promise<ISpawnResult>;
trySpawnFromCloseEvent(command: string, args: string[], options?: any, spawnFromEventOptions?: ISpawnFromEventOptions): Promise<ISpawnResult>;
tryExecuteApplication(command: string, args: string[], event: string, errorMessage: string, condition?: (childProcess: any) => boolean): Promise<any>;
/**
* This is a special case of the child_process.spawn() functionality for spawning Node.js processes.
* In addition to having all the methods in a normal ChildProcess instance, the returned object has a communication channel built-in.
* Note: Unlike the fork() POSIX system call, child_process.fork() does not clone the current process.
* @param {string} modulePath String The module to run in the child
* @param {string[]} args Array List of string arguments You can access them in the child with 'process.argv'.
* @param {string} options Object
* @return {child_process} ChildProcess object.
*/
fork(modulePath: string, args?: string[], options?: { cwd?: string, env?: any, execPath?: string, execArgv?: string[], silent?: boolean, uid?: number, gid?: number }): any;
}
interface IExecOptions {
showStderr: boolean;
}
interface ISpawnResult {
stderr: string;
stdout: string;
exitCode: number;
}
interface ISpawnFromEventOptions {
throwError: boolean;
emitOptions?: {
eventName: string;
}
}
interface IProjectDir {
projectDir: string;
}
interface IProjectHelper extends IProjectDir {
generateDefaultAppId(appName: string, baseAppId: string): string;
sanitizeName(appName: string): string;
}
interface IDictionary<T> {
[key: string]: T
}
interface IAnalyticsService {
checkConsent(): Promise<void>;
trackFeature(featureName: string): Promise<void>;
trackException(exception: any, message: string): Promise<void>;
setStatus(settingName: string, enabled: boolean): Promise<void>;
getStatusMessage(settingName: string, jsonFormat: boolean, readableSettingName: string): Promise<string>;
isEnabled(settingName: string): Promise<boolean>;
track(featureName: string, featureValue: string): Promise<void>;
/**
* Tries to stop current eqatec monitor, clean it's state and remove the process.exit event handler.
* @param {string|number} code - Exit code as the method is used for process.exit event handler.
* @return void
*/
tryStopEqatecMonitors(code?: string | number): void;
/**
* Tracks the answer of question if user allows to be tracked.
* @param {{ acceptTrackFeatureUsage: boolean }} settings Object containing information about user's answer.
* @return {Promise<void>}
*/
trackAcceptFeatureUsage(settings: { acceptTrackFeatureUsage: boolean }): Promise<void>;
/**
* Tracks data to Google Analytics project.
* @param {IGoogleAnalyticsData} data DTO describing the data that should be tracked.
* @return {Promise<void>}
*/
trackInGoogleAnalytics(data: IGoogleAnalyticsData): Promise<void>;
/**
* Tracks event action in Google Analytics project.
* @param {IEventActionData} data DTO describing information for the event.
* @return {Promise<void>}
*/
trackEventActionInGoogleAnalytics(data: IEventActionData): Promise<void>;
/**
* Defines if the instance should be disposed.
* @param {boolean} shouldDispose Defines if the instance should be disposed and the child processes should be disconnected.
* @returns {void}
*/
setShouldDispose(shouldDispose: boolean): void;
}
interface IAllowEmpty {
allowEmpty?: boolean
}
interface IPrompterOptions extends IAllowEmpty {
defaultAction?: () => string
}
interface IPrompter extends IDisposable {
get(schemas: IPromptSchema[]): Promise<any>;
getPassword(prompt: string, options?: IAllowEmpty): Promise<string>;
getString(prompt: string, options?: IPrompterOptions): Promise<string>;
promptForChoice(promptMessage: string, choices: any[]): Promise<string>;
confirm(prompt: string, defaultAction?: () => boolean): Promise<boolean>;
}
interface IAnalyticsSettingsService {
canDoRequest(): Promise<boolean>;
getUserId(): Promise<string>;
getClientName(): string;
getPrivacyPolicyLink(): string;
/**
* Gets current user sessions count.
* @param {string} projectName The analytics project id for which the counter should be taken.
* @return {number} Number of user sessions.
*/
getUserSessionsCount(projectName: string): Promise<number>;
/**
* Set the number of user sessions.
* @param {number} count The number that will be set for user sessions.
* @param {string} projectName The analytics project id for which the counter should be set.
* @return {Promise<void>}
*/
setUserSessionsCount(count: number, projectName: string): Promise<void>;
/**
* Gets the unique client identifier (AnalyticsInstallationId). In case it does not exist - set it to new value and return it.
* @returns {Promise<string>}
*/
getClientId(): Promise<string>;
/**
* Gets user agent string identifing the current system in the following format: `${identifier} (${systemInfo}) ${osArch}`
* @param {string} identifier The product identifier.
* @returns {string} The user agent string.
*/
getUserAgentString(identifier: string): string;
/**
* Gets information for projects that are exported from playground
* @param projectDir Project directory path
*/
getPlaygroundInfo(projectDir?: string): Promise<IPlaygroundInfo>;
}
/**
* Designed for getting information for projects that are exported from playground.
*/
interface IPlaygroundService {
/**
* Gets information for projects that are exported from playground
* @return {Promise<IPlaygroundInfo>} collected info
* @param projectDir Project directory path
*/
getPlaygroundInfo(projectDir?: string): Promise<IPlaygroundInfo>;
}
/**
* Describes information about project that is exported from playground.
*/
interface IPlaygroundInfo {
/**
* The unique client identifier
*/
id: string;
/**
* Whether the user comes from tutorial page. Can be true or false
*/
usedTutorial: boolean;
}
interface IHostCapabilities {
capabilities: IDictionary<IHostCapability>;
}
interface IHostCapability {
debugToolsSupported: boolean;
}
interface IAutoCompletionService {
/**
* Enables command line autocompletion by creating a `.<cliname>rc` file and sourcing it in all profiles (.bash_profile, .bashrc, etc.).
* @returns {Promise<void>}
*/
enableAutoCompletion(): Promise<void>;
/**
* Disables auto completion by removing the entries from all profiles.
* @returns {void}
*/
disableAutoCompletion(): void;
/**
* Checks if autocompletion is enabled.
* @returns {boolean} true in case autocompletion is enabled in any file. false otherwise.
*/
isAutoCompletionEnabled(): boolean;
/**
* Checks if obsolete autocompletion code exists in any profile file.
* @returns {boolean} true in case there's some old code in any profile file. false otherwise.
*/
isObsoleteAutoCompletionEnabled(): boolean;
}
interface IHooksService {
hookArgsName: string;
executeBeforeHooks(commandName: string, hookArguments?: IDictionary<any>): Promise<void>;
executeAfterHooks(commandName: string, hookArguments?: IDictionary<any>): Promise<void>;
}
interface IHook {
name: string;
fullPath: string;
}
/**
* Describes TypeScript compilation methods.
*/
interface ITypeScriptService {
/**
* Transpiles specified files or all files in the project directory. The default passed options are overriden by the ones in tsconfig.json file. The options from tsconfig.json file are overriden by the passed compiler options.
* @param {string} projectDir: Specifies the directory of the project.
* @param {string[]} typeScriptFiles @optional The files that will be compiled.
* @param {string[]} definitionFiles @optional The definition files used for compilation.
* @param {ITypeScriptTranspileOptions} options @optional The transpilation options.
* @return {Promise<void>}
*/
transpile(projectDir: string, typeScriptFiles?: string[], definitionFiles?: string[], options?: ITypeScriptTranspileOptions): Promise<void>;
/**
* Returns new object, containing all TypeScript and all TypeScript definition files.
* @param {string} projectDir The directory of the project which contains TypeScript files.
* @return {ITypeScriptFiles} all TypeScript and all TypeScript definition files.
*/
getTypeScriptFilesData(projectDir: string): ITypeScriptFiles
/**
* Checks if the project language is TypeScript by enumerating all files and checking if there are at least one TypeScript file (.ts), that is not definition file(.d.ts)
* @param {string} projectDir The directory of the project.
* @return {boolean} true when the project contains .ts files and false otherwise.
*/
isTypeScriptProject(projectDir: string): boolean;
/**
* Checks if the file is TypeScript file.
* @param {string} file The file name.
* @return {boolean} true when the file is TypeScript file.
*/
isTypeScriptFile(file: string): boolean;
}
interface IDynamicHelpService {
/**
* Checks if current project's framework is one of the specified as arguments.
* @param args {string[]} Frameworks to be checked.
* @returns {boolean} True in case the current project's framework is one of the passed as args, false otherwise.
*/
isProjectType(...args: string[]): boolean;
isPlatform(...args: string[]): boolean;
/**
* Gives an object containing all required variables that can be used in help content and their values.
* @param {any} Object with one boolean property - `isHtml` - it defines if the help content is generated for html or for console help.
* @returs {IDictionary<any>} Key-value pairs of variables and their values.
*/
getLocalVariables(options: { isHtml: boolean }): IDictionary<any>;
}
/**
* Describes standard username/password type credentials.
*/
interface ICredentials {
username: string;
password: string;
}
interface IRejectUnauthorized {
/**
* Defines if NODE_TLS_REJECT_UNAUTHORIZED should be set to true or false. Default value is true.
*/
rejectUnauthorized: boolean;
}
/**
* Proxy settings required for http request.
*/
interface IProxySettings extends IRejectUnauthorized, ICredentials, IProxySettingsBase {
/**
* Hostname of the machine used for proxy.
*/
hostname: string;
/**
* Port of the machine used for proxy that allows connections.
*/
port: string;
/**
* Protocol of the proxy - http or https
*/
protocol?: string;
}
interface IProxySettingsBase {
/**
* The url that should be passed to the request module in order to use the proxy.
* As request expects the property to be called `proxy` reuse the same name, so the IProxySettings object can be passed directly to request.
*/
proxy?: string;
}
interface IProxyLibSettings extends IRejectUnauthorized, ICredentials {
proxyUrl: string;
credentialsKey?: string;
userSpecifiedSettingsFilePath?: string;
}
/**
* Describes Service used for interaction with the proxy cache.
*/
interface IProxyService {
/**
* Caches proxy data.
* @param cacheData {IProxyLibSettings} Data to be cached.
* @returns {Promise<void>} The cache.
*/
setCache(settings: IProxyLibSettings): Promise<void>;
/**
* Retrieves proxy cache data.
* @returns {Promise<IProxySettings>} Proxy data.
*/
getCache(): Promise<IProxySettings>;
/**
* Clears proxy cache data.
* @returns {Promise<void>}
*/
clearCache(): Promise<void>;
/**
* Gets info about the proxy that can be printed and shown to the user.
* @returns {Promise<string>} Info about the proxy.
*/
getInfo(): Promise<string>
}
interface IQrCodeGenerator {
generateDataUri(data: string): Promise<string>;
}
interface IDynamicHelpProvider {
/**
* Checks if current project's framework is one of the specified as arguments.
* @param args {string[]} Frameworks to be checked.
* @returns {boolean} True in case the current project's framework is one of the passed as args, false otherwise.
*/
isProjectType(args: string[]): boolean;
/**
* Gives an object containing all required variables that can be used in help content and their values.
* @param {any} Object with one boolean property - `isHtml` - it defines if the help content is generated for html or for console help.
* @returs {IDictionary<any>} Key-value pairs of variables and their values.
*/
getLocalVariables(options: { isHtml: boolean }): IDictionary<any>;
}
interface IMicroTemplateService {
parseContent(data: string, options: { isHtml: boolean }): Promise<string>;
}
interface IHelpService {