-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathmobile.d.ts
1272 lines (1112 loc) · 42.6 KB
/
mobile.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
declare module Mobile {
interface ISyncOptions {
skipRefresh?: boolean;
}
/**
* Describes available information for a device.
*/
interface IDeviceInfo extends IPlatform {
/**
* Unique identifier of the device.
*/
identifier: string;
/**
* The name of the device.
* For Android this is the value of device's 'ro.product.name' property.
* For iOS this is the value of device's 'DeviceName' property.
*/
displayName: string;
/**
* Device model.
* For Android this is the value of device's 'ro.product.model' property.
* For iOS this is the value of device's 'ProductType' property.
*/
model: string;
/**
* Version of the OS.
* For Android this is the value of device's 'ro.build.version.release' property.
* For iOS this is the value of device's 'ProductVersion' property.
*/
version: string;
/**
* Vendor of the device.
* For Android this is the value of device's 'ro.product.brand' property.
* For iOS the value is always "Apple".
*/
vendor: string;
/**
* Status of device describing if you can work with this device or there's communication error.
* Can be Connected or Unauthorized.
*/
status: string;
/**
* Additional information for errors that prevents working with this device.
* It will be null when status is Connected.
*/
errorHelp: string;
/**
* Defines if the device is tablet or not.
* For Android the value will be true when device's 'ro.build.characteristics' property contains "tablet" word or when the 'ro.build.version.release' is 3.x
* For iOS the value will be true when device's 'ProductType' property contains "ipad" word.
*/
isTablet: boolean;
/**
* Defines if the device is emulator or not.
* Can be "Device" or "Emulator"
*/
type: string;
/**
* Optional property describing the color of the device.
* Available for iOS only - the value of device's 'DeviceColor' property.
*/
color?: string;
/**
* Optional property describing the architecture of the device
* Available for iOS only - can be "armv7" or "arm64"
*/
activeArchitecture?: string;
/**
* Available only for emulators. Should be null for devices.
* The identifier of the image. For geny emulators - the vm's identifier
* For avd emulators - the name of the .ini file
* For iOS simulators - same as the identifier.
*/
imageIdentifier?: string;
}
interface IDeviceError extends Error, IDeviceIdentifier { }
interface IDeviceIdentifier {
deviceIdentifier: string;
}
interface IDevicesOperationError extends Error {
allErrors: IDeviceError[];
}
interface IDevice {
deviceInfo: Mobile.IDeviceInfo;
applicationManager: Mobile.IDeviceApplicationManager;
fileSystem: Mobile.IDeviceFileSystem;
isEmulator: boolean;
openDeviceLogStream(): Promise<void>;
getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo>;
/**
* Called when device is lost. Its purpose is to clean any resources used by the instance.
* @returns {void}
*/
detach?(): void;
}
interface IiOSDevice extends IDevice {
connectToPort(port: number): Promise<any>;
openDeviceLogStream(options?: IiOSLogStreamOptions): Promise<void>;
}
interface IAndroidDevice extends IDevice {
adb: Mobile.IDeviceAndroidDebugBridge;
init(): Promise<void>;
fileSystem: Mobile.IAndroidDeviceFileSystem;
}
interface IAndroidDeviceFileSystem extends IDeviceFileSystem {
getDeviceHashService(appIdentifier: string): Mobile.IAndroidDeviceHashService;
}
interface IiOSSimulator extends IDevice { }
/**
* Describes log stream options
*/
interface IiOSLogStreamOptions {
/**
* This is the --predicate option which will be passed to `log stream` command
* log stream --predicate examples:
--predicate 'eventMessage contains "my message"'
--predicate 'eventType == logEvent and messageType == info'
--predicate 'processImagePath endswith "d"'
--predicate 'not processImagePath contains[c] "some spammer"'
--predicate 'processID < 100'
--predicate 'senderImagePath beginswith "my sender"'
--predicate 'eventType == logEvent and subsystem contains "com.example.my_subsystem"'
*/
predicate?: string;
}
interface IDeviceAppData extends IPlatform, IConnectTimeoutOption {
appIdentifier: string;
device: Mobile.IDevice;
getDeviceProjectRootPath(): Promise<string>;
deviceSyncZipPath?: string;
isLiveSyncSupported(): Promise<boolean>;
}
interface IDeviceAppDataFactory {
create<T extends Mobile.IDeviceAppData>(appIdentifier: string, platform: string, device: Mobile.IDevice, liveSyncOptions?: { isForCompanionApp: boolean }): T;
}
interface IDeviceAppDataFactoryRule {
vanilla: any;
companion?: any;
}
interface IDeviceAppDataProvider {
createFactoryRules(): IDictionary<Mobile.IDeviceAppDataFactoryRule>;
}
interface IAndroidLiveSyncService {
liveSyncCommands: any;
livesync(appIdentifier: string, liveSyncRoot: string, commands: string[]): Promise<void>;
createCommandsFileOnDevice(commandsFileDevicePath: string, commands: string[]): Promise<void>;
}
interface ILogcatStartOptions {
deviceIdentifier: string;
pid?: string;
keepSingleProcess?: boolean;
}
interface ILogcatHelper {
start(options: ILogcatStartOptions): Promise<void>;
stop(deviceIdentifier: string): void;
dump(deviceIdentifier: string): Promise<void>;
}
/**
* Describes methods for providing device logs to a specific consumer.
*/
interface IDeviceLogProvider extends NodeJS.EventEmitter {
/**
* Logs data in the specific way for the consumer.
* @param {string} line String from the device logs.
* @param {string} platform The platform of the device (for example iOS or Android).
* @param {string} deviceIdentifier The unique identifier of the device.
* @returns {void}
*/
logData(line: string, platform: string, deviceIdentifier: string): void;
/**
* Sets the level of logging that will be used.
* @param {string} level The level of logs - could be INFO or FULL.
* @param {string} deviceIdentifier @optional The unique identifier of the device. When it is passed, only it's logging level is changed.
*/
setLogLevel(level: string, deviceIdentifier?: string): void;
/**
* Sets the PID of the application on the specified device.
* @param {string} deviceIdentifier The unique identifier of the device.
* @param {string} pid The Process ID of the currently running application for which we need the logs.
*/
setApplicationPidForDevice(deviceIdentifier: string, pid: string): void;
/**
* Sets the project name of the application on the specified device.
* @param {string} deviceIdentifier The unique identifier of the device.
* @param {string} projectName The project name of the currently running application for which we need the logs.
*/
setProjectNameForDevice(deviceIdentifier: string, projectName: string): void;
/**
* Disables logs on the specified device and does not print any logs on the console.
* @param {string} deviceIdentifier The unique identifier of the device.
*/
muteLogsForDevice(deviceIdentifier: string): void;
}
/**
* Describes different options for filtering device logs.
*/
interface IDeviceLogOptions extends IDictionary<string | boolean> {
/**
* Process id of the application on the device.
*/
applicationPid?: string;
/**
* Selected log level for the current device. It can be INFO or FULL.
*/
logLevel: string;
/**
* The project name.
*/
projectName?: string;
/**
* Specifies if the logs will be printed on the console.
*/
muteLogs?: boolean;
}
/**
* Describes required methods for getting iOS Simulator's logs.
*/
interface IiOSSimulatorLogProvider extends NodeJS.EventEmitter, IShouldDispose {
/**
* Starts the process for getting simulator logs and emits and DEVICE_LOG_EVENT_NAME event.
* @param {string} deviceId The unique identifier of the device.
* @param {Mobile.IiOSLogStreamOptions} options Describes the options which can be passed
*/
startLogProcess(deviceId: string, options?: Mobile.IiOSLogStreamOptions): Promise<void>;
}
/**
* Describes common filtering rules for device logs.
*/
interface ILogFilter {
/**
* The logging level that will be used for filtering in case logLevel is not passed to filterData method.
* Defaults to INFO.
*/
loggingLevel: string;
/**
* Filters data for specified platform.
* @param {string} platform The platform for which is the device log.
* @param {string} data The input data for filtering.
* @param {Mobile.IDeviceLogOptions} deviceLogOptions The logging options based on which the filtering for this device logs will be executed.
* @return {string} The filtered result based on the input or null when the input data shouldn't be shown.
*/
filterData(platform: string, data: string, deviceLogOptions: Mobile.IDeviceLogOptions): string;
}
/**
* Describes filtering logic for specific platform (Android, iOS).
*/
interface IPlatformLogFilter {
/**
* Filters passed string data based on the passed logging level.
* @param {string} data The string data that will be checked based on the logging level.
* @param {string} logLevel Selected logging level.
* @param {string} pid The Process ID of the currently running application for which we need the logs.
* @return {string} The filtered result based on the input or null when the input data shouldn't be shown.
*/
filterData(data: string, deviceLogOptions: Mobile.IDeviceLogOptions): string;
}
interface ILoggingLevels {
info: string;
full: string;
}
interface IApplicationData {
appId: string;
projectName: string;
justLaunch?: boolean;
}
interface IInstallAppData extends IApplicationData {
packagePath: string;
}
interface IDeviceApplicationManager extends NodeJS.EventEmitter {
getInstalledApplications(): Promise<string[]>;
isApplicationInstalled(appIdentifier: string): Promise<boolean>;
installApplication(packageFilePath: string, appIdentifier?: string): Promise<void>;
uninstallApplication(appIdentifier: string): Promise<void>;
reinstallApplication(appIdentifier: string, packageFilePath: string): Promise<void>;
startApplication(appData: IApplicationData): Promise<void>;
stopApplication(appData: IApplicationData): Promise<void>;
restartApplication(appData: IApplicationData): Promise<void>;
checkForApplicationUpdates(): Promise<void>;
isLiveSyncSupported(appIdentifier: string): Promise<boolean>;
getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo>;
tryStartApplication(appData: IApplicationData): Promise<void>;
getDebuggableApps(): Promise<Mobile.IDeviceApplicationInformation[]>;
getDebuggableAppViews(appIdentifiers: string[]): Promise<IDictionary<Mobile.IDebugWebViewInfo[]>>;
}
/**
* Describes information about livesync in an application.
*/
interface ILiveSyncApplicationInfo extends IApplicationInfo {
/**
* Whether LiveSync is supported
* @type {boolean}
*/
isLiveSyncSupported: boolean;
}
/**
* Describes information about an application.
*/
interface IApplicationInfo {
/**
* Application's identifier
* @type {string}
*/
applicationIdentifier: string;
/**
* Device's identifier
* @type {string}
*/
deviceIdentifier?: string;
/**
* The configuration of the currently deployed application (e.g. debug, release, live, etc.)
* @type {string}
*/
configuration: string
}
interface IDeviceFileSystem {
listFiles(devicePath: string, appIdentifier?: string): Promise<any>;
getFile(deviceFilePath: string, appIdentifier: string, outputFilePath?: string): Promise<void>;
putFile(localFilePath: string, deviceFilePath: string, appIdentifier: string): Promise<void>;
deleteFile(deviceFilePath: string, appIdentifier: string): Promise<void>;
transferFiles(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]): Promise<Mobile.ILocalToDevicePathData[]>;
transferDirectory(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], projectFilesPath: string): Promise<Mobile.ILocalToDevicePathData[]>;
transferFile?(localFilePath: string, deviceFilePath: string): Promise<void>;
createFileOnDevice?(deviceFilePath: string, fileContent: string): Promise<void>;
/**
* Updates the hash file on device with the current hashes of files.
* @param hashes - All file's hashes
* @param appIdentifier - The identifier of the application.
*/
updateHashesOnDevice(hashes: IStringDictionary, appIdentifier: string): Promise<void>;
}
interface IAndroidDebugBridgeCommandOptions {
fromEvent?: string;
returnChildProcess?: boolean;
treatErrorsAsWarnings?: boolean;
childProcessOptions?: any;
deviceIdentifier?: string;
}
interface IAndroidDebugBridge {
executeCommand(args: string[], options?: IAndroidDebugBridgeCommandOptions): Promise<any>;
executeShellCommand(args: string[], options?: IAndroidDebugBridgeCommandOptions): Promise<any>;
pushFile(localFilePath: string, deviceFilePath: string): Promise<void>;
removeFile(deviceFilePath: string): Promise<void>;
/**
* Gets the property value from device
* @param deviceId The identifier of device
* @param propertyName The name of the property
* @returns {Promise<string>} Returns the property's value
*/
getPropertyValue(deviceId: string, propertyName: string): Promise<string>;
/**
* Gets all connected android devices
* @returns {Promise<string>} Returns all connected android devices
*/
getDevices(): Promise<string[]>;
/**
* Returns current Android devices or empty array in case of an error.
* @returns {Promise<string[]>} Array of currently running devices.
*/
getDevicesSafe(): Promise<string[]>;
}
interface IDeviceAndroidDebugBridge extends IAndroidDebugBridge {
sendBroadcastToDevice(action: string, extras?: IStringDictionary): Promise<number>;
}
interface IDebugOnDeviceSetup {
frontEndPath?: string;
}
interface IDeviceDiscovery extends NodeJS.EventEmitter {
startLookingForDevices(options?: IDeviceLookingOptions): Promise<void>;
}
interface IiOSSimulatorDiscovery extends IDeviceDiscovery {
checkForAvailableSimulators(): Promise<void>;
}
interface IAndroidDeviceDiscovery extends IDeviceDiscovery {
ensureAdbServerStarted(): Promise<any>;
}
/**
* Describes options that can be passed to devices service's initialization method.
*/
interface IDevicesServicesInitializationOptions {
/**
* The platform for which to initialize. If passed will detect only devices belonging to said platform.
*/
platform?: string;
/**
* If passed will start an emulator if necesasry.
*/
emulator?: boolean;
/**
* Specifies a device with which to work with.
*/
deviceId?: string;
/**
* Specifies that platform should not be infered. That is to say that all devices will be detected regardless of platform and no errors will be thrown.
*/
skipInferPlatform?: boolean;
/**
* If passed along with skipInferPlatform then the device detection interval will not be started but instead the currently attached devices will be detected.
*/
skipDeviceDetectionInterval?: boolean;
/**
* Specifies whether we should skip the emulator starting.
*/
skipEmulatorStart?: boolean;
/**
* Defines if the initialization should await the whole iOS detection to finish or it can just start the detection.
*/
shouldReturnImmediateResult?: boolean;
/**
* Currently available only for iOS. Specifies the sdk version of the iOS simulator.
* In case when `tns run ios --device "iPhone 6"` command is executed, the user can specify the sdk of the simulator because it is possible to have more than one device with the same name but with different sdk versions.
*/
sdk?: string;
}
interface IDeviceActionResult<T> extends IDeviceIdentifier {
result: T;
}
/**
* Describes a projectIdentifier for both platforms.
*/
interface IProjectIdentifier {
ios: string;
android: string;
[platform: string]: string;
}
interface IDevicesService extends NodeJS.EventEmitter, IPlatform {
hasDevices: boolean;
deviceCount: number;
execute<T>(action: (device: Mobile.IDevice) => Promise<T>, canExecute?: (dev: Mobile.IDevice) => boolean, options?: { allowNoDevices?: boolean }): Promise<IDeviceActionResult<T>[]>;
/**
* Initializes DevicesService, so after that device operations could be executed.
* @param {IDevicesServicesInitializationOptions} data Defines the options which will be used for whole devicesService.
* @return {Promise<void>}
*/
initialize(data?: IDevicesServicesInitializationOptions): Promise<void>;
/**
* Add an IDeviceDiscovery instance which will from now on report devices. The instance should implement IDeviceDiscovery and raise "deviceFound" and "deviceLost" events.
* @param {IDeviceDiscovery} deviceDiscovery Instance, implementing IDeviceDiscovery and raising raise "deviceFound" and "deviceLost" events.
* @return {void}
*/
addDeviceDiscovery(deviceDiscovery: IDeviceDiscovery): void;
getDevices(): Mobile.IDeviceInfo[];
/**
* Gets device instance by specified identifier or number.
* @param {string} deviceOption The specified device identifier or number.
* @returns {Promise<Mobile.IDevice>} Instance of IDevice.
*/
getDevice(deviceOption: string): Promise<Mobile.IDevice>;
getDevicesForPlatform(platform: string): Mobile.IDevice[];
getDeviceInstances(): Mobile.IDevice[];
getDeviceByDeviceOption(): Mobile.IDevice;
isAndroidDevice(device: Mobile.IDevice): boolean;
isiOSDevice(device: Mobile.IDevice): boolean;
isiOSSimulator(device: Mobile.IDevice): boolean;
isOnlyiOSSimultorRunning(): boolean;
isAppInstalledOnDevices(deviceIdentifiers: string[], appIdentifier: string, framework: string): Promise<IAppInstalledInfo>[];
setLogLevel(logLevel: string, deviceIdentifier?: string): void;
deployOnDevices(deviceIdentifiers: string[], packageFile: string, packageName: string, framework: string): Promise<void>[];
getDeviceByIdentifier(identifier: string): Mobile.IDevice;
mapAbstractToTcpPort(deviceIdentifier: string, appIdentifier: string, framework: string): Promise<string>;
isCompanionAppInstalledOnDevices(deviceIdentifiers: string[], framework: string): Promise<IAppInstalledInfo>[];
getDebuggableApps(deviceIdentifiers: string[]): Promise<Mobile.IDeviceApplicationInformation[]>[];
getDebuggableViews(deviceIdentifier: string, appIdentifier: string): Promise<Mobile.IDebugWebViewInfo[]>;
/**
* Returns all applications installed on the specified device.
* @param {string} deviceIdentifer The identifier of the device for which to get installed applications.
* @returns {Promise<string[]>} Array of all application identifiers of the apps installed on device.
*/
getInstalledApplications(deviceIdentifier: string): Promise<string[]>;
/**
* Returns all available iOS and/or Android emulators.
* @param options The options that can be passed to filter the result.
* @returns {Promise<Mobile.IListEmulatorsOutput>} Dictionary with the following format: { ios: { devices: Mobile.IDeviceInfo[], errors: string[] }, android: { devices: Mobile.IDeviceInfo[], errors: string[]}}.
*/
getEmulatorImages(options?: Mobile.IListEmulatorsOptions): Promise<Mobile.IListEmulatorsOutput>;
/**
* Starts an emulator by provided options.
* @param options
* @returns {Promise<string[]>} - Returns array of errors.
*/
startEmulator(options?: IStartEmulatorOptions): Promise<string[]>;
}
interface IListEmulatorsOptions {
platform?: string;
}
interface IListEmulatorsOutput extends IDictionary<IEmulatorImagesOutput> {
ios: IEmulatorImagesOutput;
android: IEmulatorImagesOutput;
}
interface IEmulatorImagesOutput {
devices: Mobile.IDeviceInfo[];
errors: string[];
}
interface IPortForwardDataBase {
deviceIdentifier: string;
appIdentifier: string;
}
interface IPortForwardData extends IPortForwardDataBase {
abstractPort: string;
}
/**
* Describes methods for working with Android processes.
*/
interface IAndroidProcessService {
/**
* Checks for available ports and forwards the current abstract port to one of the available ports.
* @param deviceIdentifier The identifier of the device.
* @param appIdentifier The identifier of the application.
* @param framework {string} The framework of the application. Could be Cordova or NativeScript.
* @return {string} Returns the tcp port number which is mapped to the abstract port.
*/
mapAbstractToTcpPort(deviceIdentifier: string, appIdentifier: string, framework: string): Promise<string>;
/**
* Gets the applications which are available for debugging on the specified device.
* @param deviceIdentifier The identifier of the device.
* @return {Mobile.IDeviceApplicationInformation[]} Returns array of applications information for the applications which are available for debugging.
*/
getDebuggableApps(deviceIdentifier: string): Promise<Mobile.IDeviceApplicationInformation[]>;
/**
* Gets all mapped abstract to tcp ports for specified device id and application identifiers.
* @param deviceIdentifier {string} The identifier of the device.
* @param appIdentifiers {string[]} Application identifiers that will be checked.
* @param framework {string} The framework of the application. Could be Cordova or NativeScript.
* @return {Promise<IDictionary<number>>} Dictionary, where the keys are app identifiers and the values are local ports.
*/
getMappedAbstractToTcpPorts(deviceIdentifier: string, appIdentifiers: string[], framework: string): Promise<IDictionary<number>>;
/**
* Gets the PID of a running application.
* @param deviceIdentifier {string} The identifier of the device.
* @param appIdentifier The identifier of the application.
* @return {string} Returns the process id matching the application identifier in the device process list.
*/
getAppProcessId(deviceIdentifier: string, appIdentifier: string): Promise<string>;
/**
* Sets port forwarding to a specified abstract port.
* First checks if there's already existing port forwarding and if yes, takes the TCP port from there and returns it to the result.
* In case there's no port forwarding, gets a free TCP port and executes adb forward.
* @param {IPortForwardData} portForwardInputData Data describing required information to setup port forwarding.
* @returns {number} The TCP port that is used for the forwarding.
*/
forwardFreeTcpToAbstractPort(portForwardInputData: IPortForwardData): Promise<number>;
}
/**
* Describes information for WebView that can be debugged.
*/
interface IDebugWebViewInfo {
/**
* Short description of the view.
*/
description: string;
/**
* Url to the devtools.
* @example http://chrome-devtools-frontend.appspot.com/serve_rev/@211d45a5b74b06d12bb016f3c4d54095faf2646f/inspector.html?ws=127.0.0.1:53213/devtools/page/4024
*/
devtoolsFrontendUrl: string;
/**
* Unique identifier of the web view. Could be number or GUID.
* @example 4027
*/
id: string;
/**
* Title of the WebView.
* @example https://bit.ly/12345V is not available
*/
title: string;
/**
* Type of the WebView.
* @example page
*/
type: string;
/**
* URL loaded in the view.
* @example https://bit.ly/12345V
*/
url: string;
/**
* Debugger URL.
* @example ws://127.0.0.1:53213/devtools/page/4027
*/
webSocketDebuggerUrl: string;
}
interface IiTunesValidator {
getError(): string;
}
interface ILocalToDevicePathData {
getLocalPath(): string;
getDevicePath(): string;
getRelativeToProjectBasePath(): string;
deviceProjectRootPath: string;
}
interface ILocalToDevicePathDataFactory {
create(fileName: string, localProjectRootPath: string, onDeviceFileName: string, deviceProjectRootPath: string): Mobile.ILocalToDevicePathData;
}
interface IPlatformCapabilities {
wirelessDeploy?: boolean;
cableDeploy: boolean;
companion?: boolean;
hostPlatformsForDeploy: string[];
}
interface IAvdInfo extends IDictionary<string | number> {
target: string;
targetNum: number;
path: string;
device?: string;
displayName?: string;
avdId?: string;
name?: string;
abi?: string;
skin?: string;
sdcard?: string;
}
interface IAvdManagerDeviceInfo extends IStringDictionary {
name: string;
device: string;
path: string;
target: string;
skin: string;
sdcard: string;
}
interface IEmulatorPlatformService {
/**
* Gets all available emulators
* @returns {Promise<Mobile.IEmulatorImagesOutput>}
*/
getEmulatorImages(): Promise<Mobile.IEmulatorImagesOutput>;
/**
* Gets the ids of all running emulators
* @returns {Promise<string[]>}
*/
getRunningEmulatorIds(): Promise<string[]>;
/**
* Gets the name of the running emulator.
* @param emulatorId - The identifier of the running emulator.
* @returns {Promise<string>} - The name of the running emulator.
*/
getRunningEmulatorName(emulatorId: string): Promise<string>;
/**
* Gets the emulator image identifier of a running emulator specified by emulatorId parameter.
* @param emulatorId - The identifier of the running emulator.
* @returns {Promise<string>} - The image identifier ot the running emulator.
*/
getRunningEmulatorImageIdentifier(emulatorId: string): Promise<string>;
/**
* Starts the emulator by provided options.
* @param options
* @returns {Promise<IStartEmulatorOutput>} Starts the emulator and returns the errors if some error occurs.
*/
startEmulator(options: Mobile.IStartEmulatorOptions): Promise<IStartEmulatorOutput>;
/**
* Called when emulator is lost. Its purpose is to clean any resources used by the instance.
* @returns {void}
*/
detach?(deviceInfo: Mobile.IDeviceInfo): void;
}
interface IStartEmulatorOutput {
errors: string[];
}
interface IAndroidVirtualDeviceService {
/**
* Gets all available emulators.
* @returns {Promise<Mobile.IEmulatorImagesOutput>} - Dictionary in the following format: { devices: Mobile.IDevice[], errors: string[] }.
* Returns array of all available android emulators - genymotion and native avd emulators and array of errors.
*/
getEmulatorImages(adbDevicesOutput: string[]): Promise<Mobile.IEmulatorImagesOutput>;
/**
* Gets all identifiers of all running android emulators.
* @param adbDevicesOutput The output from "adb devices" command
* @returns {Promise<string[]>} - Array of ids of all running emulators.
*/
getRunningEmulatorIds(adbDevicesOutput: string[]): Promise<string[]>;
/**
* Gets the name of the running emulator specified by emulatorId parameter.
* @param emulatorId - The identifier of the running emulator.
* @returns {Promise<string>} - The name of the running emulator.
*/
getRunningEmulatorName(emulatorId: string): Promise<string>;
/**
* Gets the image identifier of the running emulator specified by emulatorId parameter.
* @param emulatorId - The identifier of the running emulator.
* @returns {Promise<string>} - The image identifier of the running emulator.
*/
getRunningEmulatorImageIdentifier(emulatorId: string): Promise<string>;
/**
* Gets the path to emulator executable. It will be passed to spawn when starting the emulator.
* For genymotion emulators - the path to player.
* For avd emulators - the path to emulator executable.
*/
pathToEmulatorExecutable: string;
/**
* Gets the arguments that will be passed to spawn when starting the emulator.
* @param imageIdentifier - The imagerIdentifier of the emulator.
*/
startEmulatorArgs(imageIdentifier: string): string[];
/**
* Called when emulator is lost. Its purpose is to clean any resources used by the instance.
* @returns {void}
*/
detach?(deviceInfo: Mobile.IDeviceInfo): void;
}
interface IVirtualBoxService {
/**
* Lists all virtual machines.
* @returns {Promise<IVirtualBoxListVmsOutput>} - Returns a dictionary in the following format: { vms: IVirtualBoxVm[]; error?: string; }
* where vms is an array of name and id for each virtual machine.
*/
listVms(): Promise<IVirtualBoxListVmsOutput>;
/**
* Gets all propertier for the specified virtual machine.
* @param id - The identifier of the virtual machine.
* @returns {Promise<IVirtualBoxEnumerateGuestPropertiesOutput>} - Returns a dictionary in the following format: { properties: string; error?: string; }
*/
enumerateGuestProperties(id: string): Promise<IVirtualBoxEnumerateGuestPropertiesOutput>;
}
interface IVirtualBoxListVmsOutput {
/**
* List of virtual machines
*/
vms: IVirtualBoxVm[];
/**
* The error if something is not configured properly.
*/
error?: string;
}
interface IVirtualBoxEnumerateGuestPropertiesOutput {
/**
* The output of `vboxmanage enumerate guestproperty <id>` command
*/
properties: string;
/**
* The error if something is not configured properly.
*/
error?: string;
}
interface IVirtualBoxVm {
/**
* The id of the virtual machine.
*/
id: string;
/**
* The name of the virtual machine.
*/
name: string;
}
interface IAndroidIniFileParser {
/**
* Returns avdInfo from provided .ini file.
* @param iniFilePath - The full path to .ini file.
* @param avdInfo - avdInfo from previously parsed .ini file in case there are such.
*/
parseIniFile(iniFilePath: string, avdInfo?: Mobile.IAvdInfo): Mobile.IAvdInfo;
}
interface IiSimDevice {
/**
* The name of the simulator. For example: 'iPhone 4s', 'iPad Retina'
*/
name: string;
/**
* The unique identifier of the simulator. For example: 'B2FD3FD3-5982-4B56-A7E8-285DBC74ECCB', '49AFB795-8B1B-4CD1-8399-690A1A9BC00D'
*/
id: string;
/**
* The full identifier of the simulator. For example: 'com.apple.CoreSimulator.SimDeviceType.iPhone 5s', 'com.apple.CoreSimulator.SimDeviceType.iPad Retina'
*/
fullId: string;
/**
* The sdk version of the simulator. For example: '8.4', '9.3', '11.3'
*/
runtimeVersion: string;
/**
* The state of the simulator. Can be 'Shutdown' or 'Booted'
*/
state?: string;
}
interface IiOSSimResolver {
iOSSim: IiOSSim;
iOSSimPath: string;
}
interface IiOSSim {
getApplicationPath(deviceId: string, appIdentifier: string): string;
getDeviceLogProcess(deviceId: string, options?: any): any;
getDevices(): Promise<Mobile.IiSimDevice[]>;
getRunningSimulators(): Promise<IiSimDevice[]>;
launchApplication(applicationPath: string, appIdentifier: string, options: IiOSSimLaunchApplicationOptions): Promise<any>;
printDeviceTypes(): Promise<any>;
sendNotification(notification: string, deviceId: string): Promise<void>;
startSimulator(data: IiOSSimStartSimulatorInput): Promise<string>;
}
interface IiOSSimStartSimulatorInput {
/**
* The name or identifier of device that will be started.
*/
device: string;
/**
* The sdk version of the device that will be started.
*/
sdkVersion: string;
state?: string;
}
interface IiOSSimLaunchApplicationOptions {
timeout: string;
sdkVersion: string;
device: string;
args: string[];
waitForDebugger: boolean;
skipInstall: boolean;
}
/**
* Describes the information when trying to connect to port.
*/
interface IConnectToPortData {
/**
* The port to connect.
* @type {number}
*/
port: number;
/**
* Timeout in milliseconds.
* @type {number}
*/
timeout?: number;
}
interface IiOSSimulatorService extends IEmulatorPlatformService {
postDarwinNotification(notification: string, deviceId: string): Promise<void>;
/**
* Tries to connect to specified port for speciefied amount of time.
* In case it succeeds, a socket is returned.
* In case it fails, undefined is returned.
* @param {IConnectToPortData} connectToPortData Data describing port and timeout to try to connect.
* @returns {net.Socket} Returns instance of net.Socket when connection is successful, otherwise undefined is returned.
*/
connectToPort(connectToPortData: IConnectToPortData): Promise<any>;
/**
* Runs an application on emulator
* @param app The path to executable .app
* @param emulatorOptions Emulator options that can be passed
* @returns {Promise<any>} Returns the appId with the process of the running application on the simulator. For example: org.nativescript.myapp 55434
*/
runApplicationOnEmulator(app: string, emulatorOptions?: IRunApplicationOnEmulatorOptions): Promise<any>;
}
interface IEmulatorSettingsService {
/**
* Gives information if current project can be started in emulator.
* @param {string} platform The mobile platform of the emulator (android, ios, wp8).
* @returns {boolean} true in case the project can be started in emulator. In case not, the method will throw error.
*/
canStart(platform: string): boolean;
minVersion: number;
}
interface IRunApplicationOnEmulatorOptions {
/**
* The identifier of the application that will be started on device.
*/
appId?: string;
/**
* The args that will be passed to the application.
*/
args?: string;
/**
* The device identifier.
*/
device?: string;
/**
* If provided, redirect the application's standard output to a file.
*/
stderrFilePath?: string;
/**
* If provided, redirect the applications's standard error to a file.
*/
stdoutFilePath?: string;
/**
* If provided, only run the app on device (will skip app installation).
*/
skipInstall?: boolean;
/**
* If provided, wait for debugger to attach.
*/
waitForDebugger?: boolean;
captureStdin?: boolean;
/**
* If provided, print all available devices
*/
availableDevices?: boolean;
timeout?: string;
/**
* The sdk version of the emulator.
*/