@appium/types 0.10.1 → 0.10.3

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.
Files changed (51) hide show
  1. package/build/lib/action.d.ts +1 -7
  2. package/build/lib/action.d.ts.map +1 -1
  3. package/build/lib/action.js.map +1 -1
  4. package/build/lib/capabilities.d.ts +34 -23
  5. package/build/lib/capabilities.d.ts.map +1 -1
  6. package/build/lib/command.d.ts +24 -6
  7. package/build/lib/command.d.ts.map +1 -1
  8. package/build/lib/config.d.ts +2 -13
  9. package/build/lib/config.d.ts.map +1 -1
  10. package/build/lib/config.js.map +1 -1
  11. package/build/lib/constraints.d.ts +54 -67
  12. package/build/lib/constraints.d.ts.map +1 -1
  13. package/build/lib/constraints.js +2 -5
  14. package/build/lib/constraints.js.map +1 -1
  15. package/build/lib/driver.d.ts +206 -281
  16. package/build/lib/driver.d.ts.map +1 -1
  17. package/build/lib/http.d.ts +11 -0
  18. package/build/lib/http.d.ts.map +1 -0
  19. package/build/lib/http.js +3 -0
  20. package/build/lib/http.js.map +1 -0
  21. package/build/lib/index.d.ts +5 -104
  22. package/build/lib/index.d.ts.map +1 -1
  23. package/build/lib/index.js +5 -3
  24. package/build/lib/index.js.map +1 -1
  25. package/build/lib/logger.d.ts +39 -0
  26. package/build/lib/logger.d.ts.map +1 -0
  27. package/build/lib/logger.js +3 -0
  28. package/build/lib/logger.js.map +1 -0
  29. package/build/lib/plugin.d.ts +29 -5
  30. package/build/lib/plugin.d.ts.map +1 -1
  31. package/build/lib/server.d.ts +60 -0
  32. package/build/lib/server.d.ts.map +1 -0
  33. package/build/lib/server.js +3 -0
  34. package/build/lib/server.js.map +1 -0
  35. package/build/lib/util.d.ts +67 -0
  36. package/build/lib/util.d.ts.map +1 -0
  37. package/build/lib/util.js +3 -0
  38. package/build/lib/util.js.map +1 -0
  39. package/lib/action.ts +1 -7
  40. package/lib/capabilities.ts +40 -53
  41. package/lib/command.ts +30 -10
  42. package/lib/config.ts +2 -36
  43. package/lib/{constraints.js → constraints.ts} +5 -5
  44. package/lib/driver.ts +240 -345
  45. package/lib/http.ts +31 -0
  46. package/lib/index.ts +5 -143
  47. package/lib/logger.ts +41 -0
  48. package/lib/plugin.ts +37 -6
  49. package/lib/server.ts +73 -0
  50. package/lib/util.ts +91 -0
  51. package/package.json +5 -4
package/lib/driver.ts CHANGED
@@ -1,21 +1,21 @@
1
1
  import type {EventEmitter} from 'events';
2
- import {Element, ActionSequence} from './action';
3
- import {
4
- HTTPMethod,
5
- AppiumServer,
6
- UpdateServerCallback,
7
- Class,
8
- AppiumLogger,
9
- StringRecord,
10
- ConstraintsToCaps,
11
- BaseDriverCapConstraints,
12
- W3CCapabilities,
13
- Capabilities,
14
- } from '.';
2
+ import {Entries} from 'type-fest';
3
+ import {ActionSequence} from './action';
4
+ import {Capabilities, DriverCaps, W3CCapabilities, W3CDriverCaps} from './capabilities';
5
+ import {ExecuteMethodMap, MethodMap} from './command';
15
6
  import {ServerArgs} from './config';
16
- import {AsyncReturnType, Entries} from 'type-fest';
17
- import {MethodMap, ExecuteMethodMap} from './command';
7
+ import {HTTPHeaders, HTTPMethod} from './http';
8
+ import {AppiumLogger} from './logger';
9
+ import {AppiumServer, UpdateServerCallback} from './server';
10
+ import {Class, StringRecord, Element} from './util';
18
11
 
12
+ /**
13
+ * Interface implemented by the `DeviceSettings` class in `@appium/base-driver`
14
+ */
15
+ export interface IDeviceSettings<T extends StringRecord> {
16
+ update(newSettings: T): Promise<void>;
17
+ getSettings(): T;
18
+ }
19
19
  export interface ITimeoutCommands {
20
20
  /**
21
21
  * Set the various timeouts associated with a session
@@ -48,6 +48,7 @@ export interface ITimeoutCommands {
48
48
  * @param ms - the timeout in ms
49
49
  *
50
50
  * @deprecated Use `timeouts` instead
51
+ *
51
52
  */
52
53
  implicitWait(ms: number | string): Promise<void>;
53
54
 
@@ -169,7 +170,7 @@ export interface ISessionCommands {
169
170
  *
170
171
  * @returns A session data object
171
172
  */
172
- getSession(): Promise<SingularSessionData>;
173
+ getSession<C extends Constraints>(): Promise<SingularSessionData<C>>;
173
174
  }
174
175
 
175
176
  export interface IExecuteCommands {
@@ -182,21 +183,24 @@ export interface IExecuteCommands {
182
183
  *
183
184
  * @returns The result of calling the Execute Method
184
185
  */
185
- executeMethod<TReturn = any>(script: string, args: [StringRecord] | any[]): Promise<TReturn>;
186
+ executeMethod<
187
+ TArgs extends readonly any[] | readonly [StringRecord<unknown>] = unknown[],
188
+ TReturn = unknown
189
+ >(
190
+ script: string,
191
+ args: TArgs
192
+ ): Promise<TReturn>;
186
193
  }
187
194
 
188
- export interface MultiSessionData<
189
- C extends Constraints = BaseDriverCapConstraints,
190
- Extra extends StringRecord | void = void
191
- > {
195
+ export interface MultiSessionData<C extends Constraints = Constraints> {
192
196
  id: string;
193
- capabilities: Capabilities<C, Extra>;
197
+ capabilities: DriverCaps<C>;
194
198
  }
195
199
 
196
- export type SingularSessionData<
197
- C extends Constraints = BaseDriverCapConstraints,
198
- Extra extends StringRecord | void = void
199
- > = Capabilities<C, Extra> & {events?: EventHistory; error?: string};
200
+ export type SingularSessionData<C extends Constraints = Constraints> = DriverCaps<C> & {
201
+ events?: EventHistory;
202
+ error?: string;
203
+ };
200
204
 
201
205
  export interface IFindCommands {
202
206
  /**
@@ -343,7 +347,7 @@ export interface ILogCommands {
343
347
  *
344
348
  * @param logType - Name/key of log type as defined in {@linkcode ILogCommands.supportedLogTypes}.
345
349
  */
346
- getLog(logType: string): Promise<any[]>;
350
+ getLog(logType: string): Promise<unknown[]>;
347
351
  }
348
352
 
349
353
  /**
@@ -368,10 +372,10 @@ export interface LogDef {
368
372
  *
369
373
  * This implementation *should* drain, truncate or otherwise reset the log buffer.
370
374
  */
371
- getter: <C extends Constraints, T = any>(driver: Driver<C>) => Promise<T[]>;
375
+ getter: (driver: any) => Promise<unknown[]> | unknown[];
372
376
  }
373
377
 
374
- export interface ISettingsCommands {
378
+ export interface ISettingsCommands<T extends StringRecord = StringRecord> {
375
379
  /**
376
380
  * Update the session's settings dictionary with a new settings object
377
381
  *
@@ -385,14 +389,29 @@ export interface ISettingsCommands {
385
389
  *
386
390
  * @returns The settings object
387
391
  */
388
- getSettings(): Promise<StringRecord>;
392
+ getSettings(): Promise<T>;
389
393
  }
390
394
 
391
- export interface SessionHandler<
392
- CreateResult,
393
- DeleteResult,
394
- C extends Constraints = BaseDriverCapConstraints,
395
- Extra extends StringRecord | void = void
395
+ /**
396
+ * @see {@linkcode ISessionHandler}
397
+ */
398
+ export type DefaultCreateSessionResult<C extends Constraints> = [
399
+ sessionId: string,
400
+ capabilities: DriverCaps<C>
401
+ ];
402
+
403
+ /**
404
+ * @see {@linkcode ISessionHandler}
405
+ */
406
+ export type DefaultDeleteSessionResult = void;
407
+
408
+ /**
409
+ * An interface which creates and deletes sessions.
410
+ */
411
+ export interface ISessionHandler<
412
+ C extends Constraints = Constraints,
413
+ CreateResult = DefaultCreateSessionResult<C>,
414
+ DeleteResult = DefaultDeleteSessionResult
396
415
  > {
397
416
  /**
398
417
  * Start a new automation session
@@ -412,9 +431,9 @@ export interface SessionHandler<
412
431
  * @returns The capabilities object representing the created session
413
432
  */
414
433
  createSession(
415
- w3cCaps1: W3CCapabilities<C, Extra>,
416
- w3cCaps2?: W3CCapabilities<C, Extra>,
417
- w3cCaps3?: W3CCapabilities<C, Extra>,
434
+ w3cCaps1: W3CDriverCaps<C>,
435
+ w3cCaps2?: W3CDriverCaps<C>,
436
+ w3cCaps3?: W3CDriverCaps<C>,
418
437
  driverData?: DriverData[]
419
438
  ): Promise<CreateResult>;
420
439
 
@@ -433,19 +452,6 @@ export interface SessionHandler<
433
452
  */
434
453
  export type DriverData = Record<string, unknown>;
435
454
 
436
- /**
437
- * Extensions can define new methods for the Appium server to map to command names, of the same
438
- * format as used in Appium's `routes.js`.
439
- *
440
- *
441
- * @example
442
- * {
443
- * '/session/:sessionId/new_method': {
444
- * GET: {command: 'getNewThing'},
445
- * POST: {command: 'setNewThing', payloadParams: {required: ['someParam']}}
446
- * }
447
- * }
448
- */
449
455
  export interface Constraint {
450
456
  readonly presence?: boolean | Readonly<{allowEmpty: boolean}>;
451
457
  readonly isString?: boolean;
@@ -454,17 +460,26 @@ export interface Constraint {
454
460
  readonly isObject?: boolean;
455
461
  readonly isArray?: boolean;
456
462
  readonly deprecated?: boolean;
457
- readonly inclusion?: Readonly<[any, ...any[]]>;
458
- readonly inclusionCaseInsensitive?: Readonly<[any, ...any[]]>;
463
+ readonly inclusion?: Readonly<[string, ...string[]]>;
464
+ readonly inclusionCaseInsensitive?: Readonly<[string, ...string[]]>;
465
+ }
466
+
467
+ /**
468
+ * A collection of constraints describing the allowed capabilities for a driver.
469
+ */
470
+ export interface Constraints {
471
+ [name: string]: Constraint;
459
472
  }
460
- export type Constraints = Readonly<Record<string, Constraint>>;
461
473
 
462
- export interface DriverHelpers<C extends Constraints> {
463
- configureApp: (app: string, supportedAppExtensions: string[]) => Promise<string>;
474
+ export interface DriverHelpers {
475
+ configureApp: (
476
+ app: string,
477
+ supportedAppExtensions?: string | string[] | ConfigureAppOptions
478
+ ) => Promise<string>;
464
479
  isPackageOrBundle: (app: string) => boolean;
465
480
  duplicateKeys: <T>(input: T, firstKey: string, secondKey: string) => T;
466
481
  parseCapsArray: (cap: string | string[]) => string[];
467
- generateDriverLogPrefix: (obj: Core<C>, sessionId?: string) => string;
482
+ generateDriverLogPrefix: <C extends Constraints>(obj: Core<C>, sessionId?: string) => string;
468
483
  }
469
484
 
470
485
  export type SettingsUpdateListener<T extends Record<string, unknown> = Record<string, unknown>> = (
@@ -473,11 +488,6 @@ export type SettingsUpdateListener<T extends Record<string, unknown> = Record<st
473
488
  curValue: unknown
474
489
  ) => Promise<void>;
475
490
 
476
- export interface DeviceSettings<T = any> {
477
- update(newSettings: Record<string, T>): Promise<void>;
478
- getSettings(): Record<string, T>;
479
- }
480
-
481
491
  // WebDriver
482
492
 
483
493
  export interface Rect {
@@ -581,13 +591,13 @@ export interface EventHistoryCommand {
581
591
  *
582
592
  * This should not be used directly by external code.
583
593
  */
584
- export interface Core<C extends Constraints = BaseDriverCapConstraints> {
594
+ export interface Core<C extends Constraints, Settings extends StringRecord = StringRecord> {
585
595
  shouldValidateCaps: boolean;
586
596
  sessionId: string | null;
587
597
  opts: DriverOpts<C>;
588
- initialOpts: ServerArgs;
598
+ initialOpts: Partial<DriverOpts<C>>;
589
599
  protocol?: string;
590
- helpers: DriverHelpers<C>;
600
+ helpers: DriverHelpers;
591
601
  basePath: string;
592
602
  relaxedSecurityEnabled: boolean;
593
603
  allowInsecure: string[];
@@ -597,9 +607,9 @@ export interface Core<C extends Constraints = BaseDriverCapConstraints> {
597
607
  locatorStrategies: string[];
598
608
  webLocatorStrategies: string[];
599
609
  eventEmitter: EventEmitter;
600
- settings: DeviceSettings;
610
+ settings: IDeviceSettings<Settings>;
601
611
  log: AppiumLogger;
602
- driverData?: DriverData;
612
+ driverData: DriverData;
603
613
  isCommandsQueueEnabled: boolean;
604
614
  eventHistory: EventHistory;
605
615
  onUnexpectedShutdown(handler: () => any): void;
@@ -635,7 +645,7 @@ export interface Core<C extends Constraints = BaseDriverCapConstraints> {
635
645
  * ```
636
646
  */
637
647
  getStatus(): Promise<any>;
638
- sessionExists(sessionId: string): boolean;
648
+ sessionExists(sessionId?: string): boolean;
639
649
  isW3CProtocol(): boolean;
640
650
  isMjsonwpProtocol(): boolean;
641
651
  isFeatureEnabled(name: string): boolean;
@@ -658,24 +668,32 @@ export interface Core<C extends Constraints = BaseDriverCapConstraints> {
658
668
  *
659
669
  * `C` should be the constraints of the driver.
660
670
  * `CArgs` would be the shape of `cliArgs`.
661
- * `Ctx` would be the type of the element context (e.g., string, dictionary of some sort, etc.)
671
+ * `Settings` is the shape of the raw device settings object (see {@linkcode IDeviceSettings})
662
672
  */
663
673
  export interface Driver<
664
674
  C extends Constraints = Constraints,
665
- CArgs extends StringRecord = StringRecord
675
+ CArgs extends StringRecord = StringRecord,
676
+ Settings extends StringRecord = StringRecord,
677
+ CreateResult = DefaultCreateSessionResult<C>,
678
+ DeleteResult = DefaultDeleteSessionResult
666
679
  > extends ISessionCommands,
667
680
  ILogCommands,
668
681
  IFindCommands,
669
- ISettingsCommands,
682
+ ISettingsCommands<Settings>,
670
683
  ITimeoutCommands,
671
684
  IEventCommands,
672
685
  IExecuteCommands,
673
- SessionHandler<[sessionId: string, caps: any], void, C>,
674
- Core {
686
+ ISessionHandler<C, CreateResult, DeleteResult>,
687
+ Core<C, Settings> {
675
688
  /**
676
689
  * The set of command line arguments set for this driver
677
690
  */
678
691
  cliArgs: CArgs;
692
+ // The following properties are assigned by appium */
693
+ server?: AppiumServer;
694
+ serverHost?: string;
695
+ serverPort?: number;
696
+ serverPath?: string;
679
697
 
680
698
  // The following methods are implemented by `BaseDriver`.
681
699
 
@@ -707,6 +725,7 @@ export interface Driver<
707
725
  * Reset the current session (run the delete session and create session subroutines)
708
726
  *
709
727
  * @deprecated Use explicit session management commands instead
728
+ * @privateRemarks This is implemented by `BaseDriver` and is used within `@appium/driver-test-support`
710
729
  */
711
730
  reset(): Promise<void>;
712
731
 
@@ -734,7 +753,7 @@ export interface Driver<
734
753
  *
735
754
  * @returns Whether or not the capabilities are valid
736
755
  */
737
- validateDesiredCaps(caps: Capabilities<C>): boolean;
756
+ validateDesiredCaps(caps: DriverCaps<C>): boolean;
738
757
 
739
758
  /**
740
759
  * A helper function to log unrecognized capabilities to the console
@@ -743,7 +762,7 @@ export interface Driver<
743
762
  *
744
763
  * @internal
745
764
  */
746
- logExtraCaps(caps: Capabilities<C>): void;
765
+ logExtraCaps(caps: DriverCaps<C>): void;
747
766
 
748
767
  /**
749
768
  * A helper function used to assign server information to the driver instance so the driver knows
@@ -761,13 +780,8 @@ export interface Driver<
761
780
  * External drivers must subclass `BaseDriver`, and can implement any of these methods.
762
781
  * None of these are implemented within Appium itself.
763
782
  */
764
- export interface ExternalDriver<C extends Constraints = Constraints> extends Driver<C> {
765
- // The following properties are assigned by appium */
766
- server?: AppiumServer;
767
- serverHost?: string;
768
- serverPort?: number;
769
- serverPath?: string;
770
-
783
+ export interface ExternalDriver<C extends Constraints = Constraints, Ctx = string>
784
+ extends Driver<C> {
771
785
  // WebDriver spec commands
772
786
 
773
787
  /**
@@ -1208,13 +1222,6 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1208
1222
 
1209
1223
  // Appium W3C WebDriver Extension
1210
1224
 
1211
- /**
1212
- * Shake the device
1213
- *
1214
- * @deprecated
1215
- */
1216
- mobileShake?(): Promise<void>;
1217
-
1218
1225
  /**
1219
1226
  * Get the current time on the device under timeouts
1220
1227
  *
@@ -1224,52 +1231,6 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1224
1231
  */
1225
1232
  getDeviceTime?(format?: string): Promise<string>;
1226
1233
 
1227
- /**
1228
- * Lock the device, and optionally unlock the device after a certain amount of time
1229
- *
1230
- * @param seconds - the number of seconds after which to unlock the device. Set to zero or leave
1231
- * empty to not unlock the device automatically
1232
- *
1233
- * @deprecated
1234
- */
1235
- lock?(seconds?: number): Promise<void>;
1236
-
1237
- /**
1238
- * Unlock the device
1239
- *
1240
- * @deprecated
1241
- */
1242
- unlock?(): Promise<void>;
1243
-
1244
- /**
1245
- * Determine whether the device is locked
1246
- *
1247
- * @returns True if the device is locked, false otherwise
1248
- *
1249
- * @deprecated
1250
- */
1251
- isLocked?(): Promise<boolean>;
1252
-
1253
- /**
1254
- * Direct Appium to start recording the device screen
1255
- *
1256
- * @param options - parameters for screen recording
1257
- *
1258
- * @deprecated
1259
- */
1260
- startRecordingScreen?(options?: StartScreenRecordOptions): Promise<void>;
1261
-
1262
- /**
1263
- * Direct Appium to stop screen recording and return the video
1264
- *
1265
- * @param options - parameters for stopping like video Uploading
1266
- *
1267
- * @returns The base64-encoded video data
1268
- *
1269
- * @deprecated
1270
- */
1271
- stopRecordingScreen?(options?: StopScreenRecordOptions): Promise<string>;
1272
-
1273
1234
  /**
1274
1235
  * List the performance data types supported by this driver, which can be used in a call to get
1275
1236
  * the performance data by type.
@@ -1277,6 +1238,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1277
1238
  * @returns The list of types
1278
1239
  *
1279
1240
  * @deprecated
1241
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1280
1242
  */
1281
1243
  getPerformanceDataTypes?(): Promise<string[]>;
1282
1244
 
@@ -1291,6 +1253,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1291
1253
  * @returns A list of performance data strings
1292
1254
  *
1293
1255
  * @deprecated
1256
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1294
1257
  */
1295
1258
  getPerformanceData?(
1296
1259
  packageName: string,
@@ -1306,6 +1269,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1306
1269
  * @param flags - the code denoting the combination of extra flags
1307
1270
  *
1308
1271
  * @deprecated
1272
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1309
1273
  */
1310
1274
  pressKeyCode?(keycode: number, metastate?: number, flags?: number): Promise<void>;
1311
1275
 
@@ -1317,6 +1281,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1317
1281
  * @param flags - the code denoting the combination of extra flags
1318
1282
  *
1319
1283
  * @deprecated
1284
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1320
1285
  */
1321
1286
  longPressKeyCode?(keycode: number, metastate?: number, flags?: number): Promise<void>;
1322
1287
 
@@ -1326,6 +1291,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1326
1291
  * @param fingerprintId - the numeric ID of the fingerprint to use
1327
1292
  *
1328
1293
  * @deprecated
1294
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1329
1295
  */
1330
1296
  fingerprint?(fingerprintId: number): Promise<void>;
1331
1297
 
@@ -1336,6 +1302,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1336
1302
  * @param message - the SMS text
1337
1303
  *
1338
1304
  * @deprecated
1305
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1339
1306
  */
1340
1307
  sendSMS?(phoneNumber: string, message: string): Promise<void>;
1341
1308
 
@@ -1347,6 +1314,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1347
1314
  * @param action - the action to take in response (accept, reject, etc...)
1348
1315
  *
1349
1316
  * @deprecated
1317
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1350
1318
  */
1351
1319
  gsmCall?(phoneNumber: string, action: string): Promise<void>;
1352
1320
 
@@ -1356,6 +1324,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1356
1324
  * @param singalStrength - the strength in a driver-appropriate string
1357
1325
  *
1358
1326
  * @deprecated
1327
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1359
1328
  */
1360
1329
  gsmSignal?(signalStrength: string): Promise<void>;
1361
1330
 
@@ -1365,6 +1334,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1365
1334
  * @param state - the state
1366
1335
  *
1367
1336
  * @deprecated
1337
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1368
1338
  */
1369
1339
  gsmVoice?(state: string): Promise<void>;
1370
1340
 
@@ -1374,6 +1344,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1374
1344
  * @param percent - how full the battery should become
1375
1345
  *
1376
1346
  * @deprecated
1347
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1377
1348
  */
1378
1349
  powerCapacity?(percent: number): Promise<void>;
1379
1350
 
@@ -1383,6 +1354,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1383
1354
  * @param state - whether the device is connected to power or not
1384
1355
  *
1385
1356
  * @deprecated
1357
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1386
1358
  */
1387
1359
  powerAC?(state: string): Promise<void>;
1388
1360
 
@@ -1392,6 +1364,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1392
1364
  * @param netspeed - the speed as a string, like '3G'
1393
1365
  *
1394
1366
  * @deprecated
1367
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1395
1368
  */
1396
1369
  networkSpeed?(netspeed: string): Promise<void>;
1397
1370
 
@@ -1402,6 +1375,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1402
1375
  * @param metastate - the combination of meta startUnexpectedShutdown
1403
1376
  *
1404
1377
  * @deprecated
1378
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1405
1379
  */
1406
1380
  keyevent?(keycode: string, metastate?: string): Promise<void>;
1407
1381
 
@@ -1416,6 +1390,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1416
1390
  * @param elementId - if we're rotating around an element
1417
1391
  *
1418
1392
  * @deprecated Use setRotation instead
1393
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1419
1394
  */
1420
1395
  mobileRotation?(
1421
1396
  x: number,
@@ -1433,6 +1408,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1433
1408
  * @returns The activity name
1434
1409
  *
1435
1410
  * @deprecated
1411
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1436
1412
  */
1437
1413
  getCurrentActivity?(): Promise<string>;
1438
1414
 
@@ -1442,6 +1418,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1442
1418
  * @returns The package name
1443
1419
  *
1444
1420
  * @deprecated
1421
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1445
1422
  */
1446
1423
  getCurrentPackage?(): Promise<string>;
1447
1424
 
@@ -1489,10 +1466,11 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1489
1466
  *
1490
1467
  * @param appId - the package or bundle ID of the application
1491
1468
  *
1492
- * @returns A number representing the state. 0 means not installed, 1 means not running, 3 means
1493
- * running in the background, and 4 means running in the foreground
1469
+ * @returns A number representing the state. `0` means not installed, `1` means not running, `2`
1470
+ * means running in background but suspended, `3` means running in the background, and `4` means
1471
+ * running in the foreground
1494
1472
  */
1495
- queryAppState?(appId: string): Promise<0 | 1 | 3 | 4>;
1473
+ queryAppState?(appId: string): Promise<0 | 1 | 2 | 3 | 4>;
1496
1474
 
1497
1475
  /**
1498
1476
  * Attempt to hide a virtual keyboard
@@ -1541,6 +1519,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1541
1519
  * Toggle airplane/flight mode for the device
1542
1520
  *
1543
1521
  * @deprecated
1522
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1544
1523
  */
1545
1524
  toggleFlightMode?(): Promise<void>;
1546
1525
 
@@ -1548,6 +1527,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1548
1527
  * Toggle cell network data
1549
1528
  *
1550
1529
  * @deprecated
1530
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1551
1531
  */
1552
1532
  toggleData?(): Promise<void>;
1553
1533
 
@@ -1555,6 +1535,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1555
1535
  * Toggle WiFi radio status
1556
1536
  *
1557
1537
  * @deprecated
1538
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1558
1539
  */
1559
1540
  toggleWiFi?(): Promise<void>;
1560
1541
 
@@ -1562,6 +1543,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1562
1543
  * Toggle location services for the device
1563
1544
  *
1564
1545
  * @deprecated
1546
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1565
1547
  */
1566
1548
  toggleLocationServices?(): Promise<void>;
1567
1549
 
@@ -1569,6 +1551,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1569
1551
  * Open the notifications shade/screen
1570
1552
  *
1571
1553
  * @deprecated
1554
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1572
1555
  */
1573
1556
  openNotifications?(): Promise<void>;
1574
1557
 
@@ -1588,6 +1571,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1588
1571
  * activity
1589
1572
  *
1590
1573
  * @deprecated
1574
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1591
1575
  */
1592
1576
  startActivity?(
1593
1577
  appPackage: string,
@@ -1607,6 +1591,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1607
1591
  * @returns An array of information objects of driver-specific shape
1608
1592
  *
1609
1593
  * @deprecated
1594
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1610
1595
  */
1611
1596
  getSystemBars?(): Promise<unknown[]>;
1612
1597
 
@@ -1616,50 +1601,10 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1616
1601
  * @returns The density
1617
1602
  *
1618
1603
  * @deprecated
1604
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1619
1605
  */
1620
1606
  getDisplayDensity?(): Promise<number>;
1621
1607
 
1622
- /**
1623
- * Trigger a touch/fingerprint match or match failure
1624
- *
1625
- * @param match - whether the match should be a success or failure
1626
- *
1627
- * @deprecated
1628
- */
1629
- touchId?(match: boolean): Promise<void>;
1630
-
1631
- /**
1632
- * Toggle whether the device is enrolled in the touch ID program
1633
- *
1634
- * @param enabled - whether to enable or disable the touch ID program
1635
- *
1636
- * @deprecated
1637
- */
1638
- toggleEnrollTouchId?(enabled: boolean): Promise<void>;
1639
-
1640
- /**
1641
- * Start the session after it has been started.
1642
- *
1643
- * @deprecated Don't use this, it never made sense.
1644
- */
1645
- launchApp?(): Promise<void>;
1646
-
1647
- /**
1648
- * Stop the session without stopping the session
1649
- *
1650
- * @deprecated Don't use this, it never made sense.
1651
- */
1652
- closeApp?(): Promise<void>;
1653
-
1654
- /**
1655
- * Background (close) the app either permanently or for a certain amount of time
1656
- *
1657
- * @param seconds - the number of seconds to background the app for, or `null` for permanently
1658
- *
1659
- * @deprecated
1660
- */
1661
- background?(seconds: null | number): Promise<void>;
1662
-
1663
1608
  /**
1664
1609
  * End platform-specific code coverage tracing
1665
1610
  *
@@ -1667,31 +1612,10 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1667
1612
  * @param path - the path to place the results
1668
1613
  *
1669
1614
  * @deprecated
1615
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1670
1616
  */
1671
1617
  endCoverage?(intent: string, path: string): Promise<void>;
1672
1618
 
1673
- /**
1674
- * Return the language-specific strings for an app
1675
- *
1676
- * @param language - the language to retrieve strings for
1677
- * @param stringFile - the path to the localized strings file if not in the default location
1678
- *
1679
- * @returns A record of localized keys to localized text
1680
- *
1681
- * @deprecated
1682
- */
1683
- getStrings?(language?: string, stringFile?: string): Promise<Record<string, unknown>>;
1684
-
1685
- /**
1686
- * Set the value, but like, now? Don't use this.
1687
- *
1688
- * @param value - the value to set
1689
- * @param elementId - the element to set the value of
1690
- *
1691
- * @deprecated
1692
- */
1693
- setValueImmediate?(value: string, elementId: string): Promise<void>;
1694
-
1695
1619
  /**
1696
1620
  * Set the value of a text field but ensure the current value is replace and not appended
1697
1621
  *
@@ -1699,93 +1623,11 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1699
1623
  * @param elementId - the element to set it in
1700
1624
  *
1701
1625
  * @deprecated
1626
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1702
1627
  */
1703
1628
  replaceValue?(value: string, elementId: string): Promise<void>;
1704
1629
 
1705
- /**
1706
- * Collect the response of an async script execution? It's unclear what this is for. Don't use
1707
- * it.
1708
- *
1709
- * @param response - idk
1710
- *
1711
- * @deprecated
1712
- */
1713
- receiveAsyncResponse?(response: unknown): Promise<void>;
1714
-
1715
- /**
1716
- * Set the contents of the device clipboard
1717
- *
1718
- * @param content - the text to set
1719
- * @param contentType - the media type if not text
1720
- * @param label - the label if not text
1721
- *
1722
- * @deprecated
1723
- */
1724
- setClipboard?(content: string, contentType?: string, label?: string): Promise<void>;
1725
-
1726
- /**
1727
- * Get the contents of the device clipboard, converted into an appropriate media type
1728
- *
1729
- * @param contentType - the media type if not text
1730
- *
1731
- * @returns The text or media content (base64-encoded) of the clipboard
1732
- *
1733
- * @deprecated
1734
- */
1735
- getClipboard?(contentType?: string): Promise<string>;
1736
-
1737
1630
  // JSONWP
1738
- /**
1739
- * Set the async execute script timeout
1740
- *
1741
- * @param ms - the timeout
1742
- *
1743
- * @deprecated Use the W3C timeouts command instead
1744
- */
1745
- asyncScriptTimeout?(ms: number): Promise<void>;
1746
-
1747
- /**
1748
- * Get the window size
1749
- *
1750
- * @returns The size (width and height)
1751
- *
1752
- * @deprecated Use getWindowRect instead
1753
- */
1754
- getWindowSize?(): Promise<Size>;
1755
-
1756
- /**
1757
- * Get the position of an element on screen
1758
- *
1759
- * @param elementId - the element ID
1760
- *
1761
- * @returns The position of the element
1762
- *
1763
- * @deprecated Use getElementRect instead
1764
- */
1765
- getLocation?(elementId: string): Promise<Position>;
1766
-
1767
- /**
1768
- * Get the position of an element on screen within a certain other view
1769
- *
1770
- * @param elementId - the element ID
1771
- *
1772
- * @returns The position of the element
1773
- *
1774
- * @deprecated Use getElementRect instead
1775
- */
1776
- getLocationInView?(elementId: string): Promise<Position>;
1777
-
1778
- /**
1779
- * Get the size of an element
1780
- *
1781
- * @param elementId - the element ID
1782
- *
1783
- * @returns The size of the element
1784
- *
1785
- * @deprecated Use getElementRect instead
1786
- */
1787
- getSize?(elementId: string): Promise<Size>;
1788
-
1789
1631
  /**
1790
1632
  * Check whether two elements are identical
1791
1633
  *
@@ -1795,33 +1637,16 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1795
1637
  * @returns True if the elements are equal, false otherwise
1796
1638
  *
1797
1639
  * @deprecated
1640
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1798
1641
  */
1799
1642
  equalsElement?(elementId: string, otherElementId: string): Promise<boolean>;
1800
-
1801
- /**
1802
- * Submit the form an element is in
1803
- *
1804
- * @param elementId - the element ID
1805
- *
1806
- * @deprecated
1807
- */
1808
- submit?(elementId: string): Promise<void>;
1809
-
1810
- /**
1811
- * Send keys to the app
1812
- *
1813
- * @param value: the array of keys to send
1814
- *
1815
- * @deprecated Use the W3C send keys method instead
1816
- */
1817
- keys?(value: string[]): Promise<void>;
1818
-
1819
1643
  /**
1820
1644
  * Get the list of IME engines
1821
1645
  *
1822
1646
  * @returns The list of IME engines
1823
1647
  *
1824
1648
  * @deprecated
1649
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1825
1650
  */
1826
1651
  availableIMEEngines?(): Promise<string[]>;
1827
1652
 
@@ -1831,6 +1656,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1831
1656
  * @returns The name of the active engine
1832
1657
  *
1833
1658
  * @deprecated
1659
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1834
1660
  */
1835
1661
  getActiveIMEEngine?(): Promise<string>;
1836
1662
 
@@ -1840,6 +1666,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1840
1666
  * @returns True if the IME is activated
1841
1667
  *
1842
1668
  * @deprecated
1669
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1843
1670
  */
1844
1671
  isIMEActivated?(): Promise<boolean>;
1845
1672
 
@@ -1847,6 +1674,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1847
1674
  * Deactivate an IME engine
1848
1675
  *
1849
1676
  * @deprecated
1677
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1850
1678
  */
1851
1679
  deactivateIMEEngine?(): Promise<void>;
1852
1680
 
@@ -1856,6 +1684,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1856
1684
  * @param engine - the name of the engine
1857
1685
  *
1858
1686
  * @deprecated
1687
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1859
1688
  */
1860
1689
  activateIMEEngine?(engine: string): Promise<void>;
1861
1690
 
@@ -1873,23 +1702,13 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1873
1702
  */
1874
1703
  setOrientation?(orientation: string): Promise<void>;
1875
1704
 
1876
- /**
1877
- * Move the mouse pointer to a particular screen location
1878
- *
1879
- * @param element - the element ID if the move is relative to an element
1880
- * @param xOffset - the x offset
1881
- * @param yOffset - the y offset
1882
- *
1883
- * @deprecated Use the Actions API instead
1884
- */
1885
- moveTo?(element?: null | string, xOffset?: number, yOffset?: number): Promise<void>;
1886
-
1887
1705
  /**
1888
1706
  * Trigger a mouse button down
1889
1707
  *
1890
1708
  * @param button - the button ID
1891
1709
  *
1892
1710
  * @deprecated Use the Actions API instead
1711
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1893
1712
  */
1894
1713
  buttonDown?(button?: number): Promise<void>;
1895
1714
 
@@ -1899,6 +1718,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1899
1718
  * @param button - the button ID
1900
1719
  *
1901
1720
  * @deprecated Use the Actions API instead
1721
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1902
1722
  */
1903
1723
  buttonUp?(button?: number): Promise<void>;
1904
1724
 
@@ -1908,6 +1728,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1908
1728
  * @param button - the button ID
1909
1729
  *
1910
1730
  * @deprecated Use the Actions API instead
1731
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1911
1732
  */
1912
1733
  clickCurrent?(button?: number): Promise<void>;
1913
1734
 
@@ -1915,6 +1736,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1915
1736
  * Double-click the current mouse location
1916
1737
  *
1917
1738
  * @deprecated Use the Actions API instead
1739
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1918
1740
  */
1919
1741
  doubleClick?(): Promise<void>;
1920
1742
 
@@ -1925,6 +1747,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1925
1747
  * @param y - the y coordinate
1926
1748
  *
1927
1749
  * @deprecated Use the Actions API instead
1750
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1928
1751
  */
1929
1752
  touchDown?(x: number, y: number): Promise<void>;
1930
1753
 
@@ -1935,6 +1758,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1935
1758
  * @param y - the y coordinate
1936
1759
  *
1937
1760
  * @deprecated Use the Actions API instead
1761
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1938
1762
  */
1939
1763
  touchUp?(x: number, y: number): Promise<void>;
1940
1764
 
@@ -1945,6 +1769,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1945
1769
  * @param y - the y coordinate
1946
1770
  *
1947
1771
  * @deprecated Use the Actions API instead
1772
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1948
1773
  */
1949
1774
  touchMove?(x: number, y: number): Promise<void>;
1950
1775
 
@@ -1954,6 +1779,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1954
1779
  * @param elementId - the id of the element to long touch
1955
1780
  *
1956
1781
  * @deprecated Use the Actions API instead
1782
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1957
1783
  */
1958
1784
  touchLongClick?(elementId: string): Promise<void>;
1959
1785
 
@@ -1968,6 +1794,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
1968
1794
  * @param speed - the speed (unclear how this relates to xSpeed and ySpeed)
1969
1795
  *
1970
1796
  * @deprecated Use the Actions API instead
1797
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1971
1798
  */
1972
1799
  flick?(
1973
1800
  element?: string,
@@ -2000,7 +1827,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
2000
1827
  *
2001
1828
  * @returns The context name
2002
1829
  */
2003
- getCurrentContext?(): Promise<string | null>;
1830
+ getCurrentContext?(): Promise<Ctx | null>;
2004
1831
 
2005
1832
  /**
2006
1833
  * Switch to a context by name
@@ -2008,7 +1835,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
2008
1835
  *
2009
1836
  * @param name - the context name
2010
1837
  */
2011
- setContext?(name: string): Promise<void>;
1838
+ setContext?(name: string, ...args: any[]): Promise<void>;
2012
1839
 
2013
1840
  /**
2014
1841
  * Get the list of available contexts
@@ -2016,7 +1843,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
2016
1843
  *
2017
1844
  * @returns The list of context names
2018
1845
  */
2019
- getContexts?(): Promise<string[]>;
1846
+ getContexts?(): Promise<Ctx[]>;
2020
1847
 
2021
1848
  /**
2022
1849
  * Get the index of an element on the page
@@ -2026,6 +1853,7 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
2026
1853
  * @returns The page index
2027
1854
  *
2028
1855
  * @deprecated
1856
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
2029
1857
  */
2030
1858
  getPageIndex?(elementId: string): Promise<string>;
2031
1859
 
@@ -2046,25 +1874,6 @@ export interface ExternalDriver<C extends Constraints = Constraints> extends Dri
2046
1874
  */
2047
1875
  setNetworkConnection?(type: number): Promise<void>;
2048
1876
 
2049
- /**
2050
- * Perform a set of touch actions
2051
- *
2052
- * @param actions - the old MJSONWP style touch action objects
2053
- *
2054
- * @deprecated Use the W3C Actions API instead
2055
- */
2056
- performTouch?(actions: unknown): Promise<void>;
2057
-
2058
- /**
2059
- * Perform a set of touch actions
2060
- *
2061
- * @param actions - the old MJSONWP style touch action objects
2062
- * @param elementId - the id of an element if actions are restricted to one element
2063
- *
2064
- * @deprecated Use the W3C Actions API instead
2065
- */
2066
- performMultiAction?(actions: unknown, elementId: string): Promise<void>;
2067
-
2068
1877
  /**
2069
1878
  * Get the current rotation state of the device
2070
1879
  * @see {@link https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#device-rotation}
@@ -2225,23 +2034,109 @@ export interface ExtraDriverOpts {
2225
2034
  *
2226
2035
  * The combination happens within Appium prior to calling the constructor.
2227
2036
  */
2228
- export type DriverOpts<C extends Constraints = BaseDriverCapConstraints> = ServerArgs &
2229
- ExtraDriverOpts &
2230
- Partial<ConstraintsToCaps<C>>;
2037
+ export type DriverOpts<C extends Constraints> = ServerArgs & ExtraDriverOpts & DriverCaps<C>;
2231
2038
 
2232
2039
  /**
2233
2040
  * An instance method of a driver class, whose name may be referenced by {@linkcode MethodDef.command}, and serves as an Appium command.
2234
2041
  *
2235
2042
  * Note that this signature differs from a `PluginCommand`.
2236
2043
  */
2237
- export type DriverCommand<TArgs = any, TRetval = unknown> = (...args: TArgs[]) => Promise<TRetval>;
2238
-
2239
- export type DriverCommands<TArgs = any, TReturn = unknown> = Record<
2240
- string,
2241
- DriverCommand<TArgs, TReturn>
2242
- >;
2044
+ export type DriverCommand<TArgs extends readonly any[] = any[], TRetval = unknown> = (
2045
+ ...args: TArgs
2046
+ ) => Promise<TRetval>;
2243
2047
 
2244
2048
  /**
2245
2049
  * Tuple of an HTTP method with a regex matching a request path
2246
2050
  */
2247
2051
  export type RouteMatcher = [HTTPMethod, RegExp];
2052
+
2053
+ /**
2054
+ * Result of the {@linkcode onPostProcess ConfigureAppOptions.onPostProcess} callback.
2055
+ */
2056
+ export interface PostProcessResult {
2057
+ /**
2058
+ * The full past to the post-processed application package on the local file system .
2059
+ *
2060
+ * This might be a file or a folder path.
2061
+ */
2062
+ appPath: string;
2063
+ }
2064
+
2065
+ /**
2066
+ * Information about a cached app instance.
2067
+ */
2068
+ export interface CachedAppInfo {
2069
+ /**
2070
+ * SHA1 hash of the package if it is a file (and not a folder)
2071
+ */
2072
+ packageHash: string;
2073
+ /**
2074
+ * Date instance; the value of the file's `Last-Modified` header
2075
+ */
2076
+ lastModified?: Date;
2077
+ /**
2078
+ * `true` if the file contains an `immutable` mark in `Cache-control` header
2079
+ */
2080
+ immutable?: boolean;
2081
+ /**
2082
+ * Integer representation of `maxAge` parameter in `Cache-control` header
2083
+ */
2084
+ maxAge?: number;
2085
+ /**
2086
+ * The timestamp this item has been added to the cache (measured in Unix epoch milliseconds)
2087
+ */
2088
+ timestamp?: number;
2089
+ /**
2090
+ * An object containing either `file` property with SHA1 hash of the file or `folder` property
2091
+ * with total amount of cached files and subfolders
2092
+ */
2093
+ integrity?: {file?: string} | {folder?: number};
2094
+ /**
2095
+ * The full path to the cached app
2096
+ */
2097
+ fullPath?: string;
2098
+ }
2099
+
2100
+ /**
2101
+ * Options for the post-processing step
2102
+ *
2103
+ * The generic can be supplied if using `axios`, where `headers` is a fancy object.
2104
+ */
2105
+ export interface PostProcessOptions<Headers = HTTPHeaders> {
2106
+ /**
2107
+ * The information about the previously cached app instance (if exists)
2108
+ */
2109
+ cachedAppInfo?: CachedAppInfo;
2110
+ /**
2111
+ * Whether the app has been downloaded from a remote URL
2112
+ */
2113
+ isUrl?: boolean;
2114
+ /**
2115
+ * Optional headers object.
2116
+ *
2117
+ * Only present if `isUrl` is `true` and if the server responds to `HEAD` requests. All header names are normalized to lowercase.
2118
+ */
2119
+ headers?: Headers;
2120
+ /**
2121
+ * A string containing full path to the preprocessed application package (either downloaded or a local one)
2122
+ */
2123
+ appPath?: string;
2124
+ }
2125
+
2126
+ export interface ConfigureAppOptions {
2127
+ /**
2128
+ *
2129
+ * Optional function, which should be applied to the application after it is
2130
+ * downloaded/preprocessed.
2131
+ *
2132
+ * This function may be async and is expected to accept single object parameter. The function is
2133
+ * expected to either return a falsy value, which means the app must not be cached and a fresh
2134
+ * copy of it is downloaded each time, _or_ if this function returns an object containing an
2135
+ * `appPath` property, then the integrity of it will be verified and stored into the cache.
2136
+ * @returns
2137
+ */
2138
+ onPostProcess?: (
2139
+ obj: PostProcessOptions
2140
+ ) => Promise<PostProcessResult | undefined> | PostProcessResult | undefined;
2141
+ supportedExtensions: string[];
2142
+ }