@appium/base-driver 9.3.2 → 9.3.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 (67) hide show
  1. package/LICENSE +1 -1
  2. package/build/lib/basedriver/commands/event.d.ts +5 -9
  3. package/build/lib/basedriver/commands/event.d.ts.map +1 -1
  4. package/build/lib/basedriver/commands/event.js +28 -49
  5. package/build/lib/basedriver/commands/event.js.map +1 -1
  6. package/build/lib/basedriver/commands/execute.d.ts +5 -11
  7. package/build/lib/basedriver/commands/execute.d.ts.map +1 -1
  8. package/build/lib/basedriver/commands/execute.js +15 -39
  9. package/build/lib/basedriver/commands/execute.js.map +1 -1
  10. package/build/lib/basedriver/commands/find.d.ts +5 -12
  11. package/build/lib/basedriver/commands/find.d.ts.map +1 -1
  12. package/build/lib/basedriver/commands/find.js +38 -98
  13. package/build/lib/basedriver/commands/find.js.map +1 -1
  14. package/build/lib/basedriver/commands/index.d.ts +7 -3
  15. package/build/lib/basedriver/commands/index.d.ts.map +1 -1
  16. package/build/lib/basedriver/commands/index.js +20 -27
  17. package/build/lib/basedriver/commands/index.js.map +1 -1
  18. package/build/lib/basedriver/commands/log.d.ts +5 -10
  19. package/build/lib/basedriver/commands/log.d.ts.map +1 -1
  20. package/build/lib/basedriver/commands/log.js +17 -50
  21. package/build/lib/basedriver/commands/log.js.map +1 -1
  22. package/build/lib/basedriver/commands/mixin.d.ts +12 -0
  23. package/build/lib/basedriver/commands/mixin.d.ts.map +1 -0
  24. package/build/lib/basedriver/commands/mixin.js +17 -0
  25. package/build/lib/basedriver/commands/mixin.js.map +1 -0
  26. package/build/lib/basedriver/commands/session.d.ts +5 -11
  27. package/build/lib/basedriver/commands/session.d.ts.map +1 -1
  28. package/build/lib/basedriver/commands/session.js +20 -52
  29. package/build/lib/basedriver/commands/session.js.map +1 -1
  30. package/build/lib/basedriver/commands/settings.d.ts +5 -9
  31. package/build/lib/basedriver/commands/settings.d.ts.map +1 -1
  32. package/build/lib/basedriver/commands/settings.js +14 -34
  33. package/build/lib/basedriver/commands/settings.js.map +1 -1
  34. package/build/lib/basedriver/commands/timeout.d.ts +5 -9
  35. package/build/lib/basedriver/commands/timeout.d.ts.map +1 -1
  36. package/build/lib/basedriver/commands/timeout.js +107 -126
  37. package/build/lib/basedriver/commands/timeout.js.map +1 -1
  38. package/build/lib/basedriver/core.d.ts +2 -4
  39. package/build/lib/basedriver/core.d.ts.map +1 -1
  40. package/build/lib/basedriver/core.js +0 -2
  41. package/build/lib/basedriver/core.js.map +1 -1
  42. package/build/lib/basedriver/driver.d.ts +12 -12
  43. package/build/lib/basedriver/driver.d.ts.map +1 -1
  44. package/build/lib/basedriver/driver.js +22 -14
  45. package/build/lib/basedriver/driver.js.map +1 -1
  46. package/build/lib/express/server.d.ts +3 -15
  47. package/build/lib/express/server.d.ts.map +1 -1
  48. package/lib/basedriver/commands/event.ts +48 -0
  49. package/lib/basedriver/commands/execute.ts +39 -0
  50. package/lib/basedriver/commands/find.ts +79 -0
  51. package/lib/basedriver/commands/index.ts +7 -0
  52. package/lib/basedriver/commands/log.ts +36 -0
  53. package/lib/basedriver/commands/mixin.ts +14 -0
  54. package/lib/basedriver/commands/session.ts +34 -0
  55. package/lib/basedriver/commands/settings.ts +25 -0
  56. package/lib/basedriver/commands/timeout.ts +155 -0
  57. package/lib/basedriver/core.js +0 -3
  58. package/lib/basedriver/driver.js +8 -11
  59. package/package.json +6 -6
  60. package/lib/basedriver/commands/event.js +0 -63
  61. package/lib/basedriver/commands/execute.js +0 -45
  62. package/lib/basedriver/commands/find.js +0 -108
  63. package/lib/basedriver/commands/index.js +0 -35
  64. package/lib/basedriver/commands/log.js +0 -64
  65. package/lib/basedriver/commands/session.js +0 -57
  66. package/lib/basedriver/commands/settings.js +0 -38
  67. package/lib/basedriver/commands/timeout.js +0 -168
package/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright JS Foundation and other contributors, https://js.foundation
189
+ Copyright OpenJS Foundation and other contributors, https://openjsf.org/
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -1,10 +1,6 @@
1
- /**
2
- * @template {Constraints} C
3
- * @param {import('./timeout').TimeoutBase<C>} Base
4
- * @returns {EventBase<C>}
5
- */
6
- export function EventMixin<C extends Readonly<Record<string, import("@appium/types").Constraint>>>(Base: import("./timeout").TimeoutBase<C>): EventBase<C>;
7
- export type Constraints = import('@appium/types').Constraints;
8
- export type IEventCommands = import('@appium/types').IEventCommands;
9
- export type EventBase<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & IEventCommands>;
1
+ import { IEventCommands } from '@appium/types';
2
+ declare module '../driver' {
3
+ interface BaseDriver<C extends Constraints> extends IEventCommands {
4
+ }
5
+ }
10
6
  //# sourceMappingURL=event.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/event.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,2JA2CC;0BAGY,OAAO,eAAe,EAAE,WAAW;6BACnC,OAAO,eAAe,EAAE,cAAc;gGAKtC,OAAO,WAAW,EAAE,cAAc,CAAC,CAAC,EAAE,OAAO,eAAe,EAAE,gBAAgB,GAAG,cAAc,CAAC"}
1
+ {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/event.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,cAAc,EAAC,MAAM,eAAe,CAAC;AAI1D,OAAO,QAAQ,WAAW,CAAC;IACzB,UAAU,UAAU,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,cAAc;KAAG;CACtE"}
@@ -3,58 +3,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.EventMixin = void 0;
7
- /* eslint-disable require-await */
8
- // @ts-check
9
6
  const lodash_1 = __importDefault(require("lodash"));
10
- /**
11
- * @template {Constraints} C
12
- * @param {import('./timeout').TimeoutBase<C>} Base
13
- * @returns {EventBase<C>}
14
- */
15
- function EventMixin(Base) {
7
+ const mixin_1 = require("./mixin");
8
+ const EventCommands = {
16
9
  /**
17
- * @implements {IEventCommands}
10
+ * Log a user-defined event in the event log.
11
+ *
12
+ * @param vendor - a vendor prefix for the user, to ensure namespace
13
+ * separation
14
+ * @param event - the event name
18
15
  */
19
- class EventCommands extends Base {
20
- /**
21
- * Log a user-defined event in the event log.
22
- *
23
- * @param {string} vendor - a vendor prefix for the user, to ensure namespace
24
- * separation
25
- * @param {string} event - the event name
26
- */
27
- async logCustomEvent(vendor, event) {
28
- this.logEvent(`${vendor}:${event}`);
16
+ async logCustomEvent(vendor, event) {
17
+ this.logEvent(`${vendor}:${event}`);
18
+ },
19
+ /**
20
+ * Get the event log
21
+ * @param type - the event type to filter with.
22
+ * It returns all events if the type is not provided or empty string/array.
23
+ * @returns the event history log object
24
+ */
25
+ async getLogEvents(type) {
26
+ if (lodash_1.default.isEmpty(type)) {
27
+ return this.eventHistory;
29
28
  }
30
- /**
31
- * Get the event log
32
- * @param {string|string[]} [type] - the event type to filter with.
33
- * It returns all events if the type is not provided or empty string/array.
34
- * @returns {Promise<import('@appium/types').EventHistory|Record<string,number>>} - the event history log object
35
- */
36
- async getLogEvents(type) {
37
- if (lodash_1.default.isEmpty(type)) {
38
- return this.eventHistory;
29
+ const typeList = lodash_1.default.castArray(type);
30
+ return lodash_1.default.reduce(this.eventHistory, (acc, eventTimes, eventType) => {
31
+ if (typeList.includes(eventType)) {
32
+ acc[eventType] = eventTimes;
39
33
  }
40
- const typeList = lodash_1.default.castArray(type);
41
- return lodash_1.default.reduce(this.eventHistory, (acc, eventTimes, eventType) => {
42
- if (typeList.includes(eventType)) {
43
- acc[eventType] = eventTimes;
44
- }
45
- return acc;
46
- }, {});
47
- }
48
- }
49
- return EventCommands;
50
- }
51
- exports.EventMixin = EventMixin;
52
- /**
53
- * @typedef {import('@appium/types').Constraints} Constraints
54
- * @typedef {import('@appium/types').IEventCommands} IEventCommands
55
- */
56
- /**
57
- * @template {Constraints} C
58
- * @typedef {import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & IEventCommands>} EventBase
59
- */
34
+ return acc;
35
+ }, {});
36
+ },
37
+ };
38
+ (0, mixin_1.mixin)(EventCommands);
60
39
  //# sourceMappingURL=event.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"event.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/event.js"],"names":[],"mappings":";;;;;;AAAA,kCAAkC;AAClC,YAAY;AACZ,oDAAuB;AAEvB;;;;GAIG;AACH,SAAgB,UAAU,CAAC,IAAI;IAC7B;;OAEG;IACH,MAAM,aAAc,SAAQ,IAAI;QAC9B;;;;;;WAMG;QACH,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK;YAChC,IAAI,CAAC,QAAQ,CAAC,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC,CAAC;QACtC,CAAC;QAED;;;;;WAKG;QACH,KAAK,CAAC,YAAY,CAAC,IAAI;YACrB,IAAI,gBAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACnB,OAAO,IAAI,CAAC,YAAY,CAAC;aAC1B;YAED,MAAM,QAAQ,GAAG,gBAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAEnC,OAAO,gBAAC,CAAC,MAAM,CACb,IAAI,CAAC,YAAY,EACjB,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE;gBAC7B,IAAI,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;oBAChC,GAAG,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC;iBAC7B;gBACD,OAAO,GAAG,CAAC;YACb,CAAC,EACD,EAAE,CACH,CAAC;QACJ,CAAC;KACF;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AA3CD,gCA2CC;AAED;;;GAGG;AAEH;;;GAGG"}
1
+ {"version":3,"file":"event.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/event.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AAEvB,mCAA8B;AAO9B,MAAM,aAAa,GAAmB;IACpC;;;;;;OAMG;IACH,KAAK,CAAC,cAAc,CAA6C,MAAc,EAAE,KAAa;QAC5F,IAAI,CAAC,QAAQ,CAAC,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC,CAAC;IACtC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAA6C,IAAuB;QACpF,IAAI,gBAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnB,OAAO,IAAI,CAAC,YAAY,CAAC;SAC1B;QAED,MAAM,QAAQ,GAAG,gBAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAEnC,OAAO,gBAAC,CAAC,MAAM,CACb,IAAI,CAAC,YAAY,EACjB,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE;YAC7B,IAAI,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;gBAChC,GAAG,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC;aAC7B;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EACD,EAAE,CACH,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,IAAA,aAAK,EAAC,aAAa,CAAC,CAAC"}
@@ -1,12 +1,6 @@
1
- /**
2
- * @template {Constraints} C
3
- * @param {import('./session').SessionBase<C>} Base
4
- * @returns {ExecuteBase<C>}
5
- */
6
- export function ExecuteMixin<C extends Readonly<Record<string, import("@appium/types").Constraint>>>(Base: import("./session").SessionBase<C>): ExecuteBase<C>;
7
- export type IExecuteCommands = import('@appium/types').IExecuteCommands;
8
- export type Driver = import('@appium/types').Driver;
9
- export type DriverClass = import('@appium/types').DriverClass;
10
- export type Constraints = import('@appium/types').Constraints;
11
- export type ExecuteBase<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & import('@appium/types').ILogCommands<C> & import('@appium/types').ISettingsCommands & import('@appium/types').ISessionCommands & IExecuteCommands>;
1
+ import { IExecuteCommands } from '@appium/types';
2
+ declare module '../driver' {
3
+ interface BaseDriver<C extends Constraints> extends IExecuteCommands {
4
+ }
5
+ }
12
6
  //# sourceMappingURL=execute.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/execute.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,+JAwBC;+BAGY,OAAO,eAAe,EAAE,gBAAgB;qBACxC,OAAO,eAAe,EAAE,MAAM;0BAC9B,OAAO,eAAe,EAAE,WAAW;0BACnC,OAAO,eAAe,EAAE,WAAW;kGAKnC,OAAO,WAAW,EAAE,cAAc,CAAC,CAAC,EAAE,OAAO,eAAe,EAAE,gBAAgB,GAAG,OAAO,eAAe,EAAE,cAAc,GAAG,OAAO,eAAe,EAAE,aAAa,GAAG,OAAO,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,eAAe,EAAE,iBAAiB,GAAG,OAAO,eAAe,EAAE,gBAAgB,GAAG,gBAAgB,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/execute.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,gBAAgB,EAEjB,MAAM,eAAe,CAAC;AAIvB,OAAO,QAAQ,WAAW,CAAC;IACzB,UAAU,UAAU,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,gBAAgB;KAAG;CACxE"}
@@ -3,46 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ExecuteMixin = void 0;
7
6
  const lodash_1 = __importDefault(require("lodash"));
8
7
  const protocol_1 = require("../../protocol");
9
- /**
10
- * @template {Constraints} C
11
- * @param {import('./session').SessionBase<C>} Base
12
- * @returns {ExecuteBase<C>}
13
- */
14
- function ExecuteMixin(Base) {
15
- /**
16
- * @implements {IExecuteCommands}
17
- */
18
- class ExecuteCommands extends Base {
19
- /**
20
- * @param {string} script
21
- * @param {[Record<string, any>]|[]} protoArgs
22
- */
23
- async executeMethod(script, protoArgs) {
24
- const Driver = /** @type {DriverClass} */ (this.constructor);
25
- const commandMetadata = { ...Driver.executeMethodMap?.[script] };
26
- if (!commandMetadata.command) {
27
- const availableScripts = lodash_1.default.keys(Driver.executeMethodMap);
28
- throw new protocol_1.errors.UnsupportedOperationError(`Unsupported execute method '${script}'. Available methods ` +
29
- `are: ${availableScripts.join(', ')}`);
30
- }
31
- const args = (0, protocol_1.validateExecuteMethodParams)(protoArgs, commandMetadata.params);
32
- return await this[commandMetadata.command](...args);
8
+ const mixin_1 = require("./mixin");
9
+ const ExecuteCommands = {
10
+ async executeMethod(script, protoArgs) {
11
+ const Driver = this.constructor;
12
+ const commandMetadata = { ...Driver.executeMethodMap?.[script] };
13
+ if (!commandMetadata.command) {
14
+ const availableScripts = lodash_1.default.keys(Driver.executeMethodMap);
15
+ throw new protocol_1.errors.UnsupportedOperationError(`Unsupported execute method '${script}'. Available methods ` +
16
+ `are: ${availableScripts.join(', ')}`);
33
17
  }
34
- }
35
- return ExecuteCommands;
36
- }
37
- exports.ExecuteMixin = ExecuteMixin;
38
- /**
39
- * @typedef {import('@appium/types').IExecuteCommands} IExecuteCommands
40
- * @typedef {import('@appium/types').Driver} Driver
41
- * @typedef {import('@appium/types').DriverClass} DriverClass
42
- * @typedef {import('@appium/types').Constraints} Constraints
43
- */
44
- /**
45
- * @template {Constraints} C
46
- * @typedef {import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & import('@appium/types').ILogCommands<C> & import('@appium/types').ISettingsCommands & import('@appium/types').ISessionCommands & IExecuteCommands>} ExecuteBase
47
- */
18
+ const args = (0, protocol_1.validateExecuteMethodParams)(protoArgs, commandMetadata.params);
19
+ const command = this[commandMetadata.command];
20
+ return await command.call(this, ...args);
21
+ },
22
+ };
23
+ (0, mixin_1.mixin)(ExecuteCommands);
48
24
  //# sourceMappingURL=execute.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/execute.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,6CAAmE;AAEnE;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAI;IAC/B;;OAEG;IACH,MAAM,eAAgB,SAAQ,IAAI;QAChC;;;WAGG;QACH,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,SAAS;YACnC,MAAM,MAAM,GAAG,0BAA0B,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC7D,MAAM,eAAe,GAAG,EAAC,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAC,CAAC;YAC/D,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE;gBAC5B,MAAM,gBAAgB,GAAG,gBAAC,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;gBACzD,MAAM,IAAI,iBAAM,CAAC,yBAAyB,CACxC,+BAA+B,MAAM,uBAAuB;oBAC1D,QAAQ,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxC,CAAC;aACH;YACD,MAAM,IAAI,GAAG,IAAA,sCAA2B,EAAC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;YAC5E,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QACtD,CAAC;KACF;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAxBD,oCAwBC;AAED;;;;;GAKG;AAEH;;;GAGG"}
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/execute.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AACvB,6CAAmE;AASnE,mCAA8B;AAO9B,MAAM,eAAe,GAAqB;IACxC,KAAK,CAAC,aAAa,CAEjB,MAAc,EACd,SAAiC;QAEjC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAqC,CAAC;QAC1D,MAAM,eAAe,GAAG,EAAC,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAC,CAAC;QAC/D,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE;YAC5B,MAAM,gBAAgB,GAAG,gBAAC,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACzD,MAAM,IAAI,iBAAM,CAAC,yBAAyB,CACxC,+BAA+B,MAAM,uBAAuB;gBAC1D,QAAQ,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxC,CAAC;SACH;QACD,MAAM,IAAI,GAAG,IAAA,sCAA2B,EAAC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;QAC5E,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAkB,CAAC;QAC/D,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF,CAAC;AAEF,IAAA,aAAK,EAAC,eAAe,CAAC,CAAC"}
@@ -1,13 +1,6 @@
1
- /**
2
- * @template {Constraints} C
3
- * @param {import('./event').EventBase<C>} Base
4
- * @returns {FindBase<C>}
5
- */
6
- export function FindMixin<C extends Readonly<Record<string, import("@appium/types").Constraint>>>(Base: import("./event").EventBase<C>): FindBase<C>;
7
- export type Element = import('@appium/types').Element;
8
- export type Constraints = import('@appium/types').Constraints;
9
- export type IFindCommands = import('@appium/types').IFindCommands;
10
- export type ITimeoutCommands = import('@appium/types').ITimeoutCommands;
11
- export type IEventCommands = import('@appium/types').IEventCommands;
12
- export type FindBase<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('../driver').BaseDriverBase<C, ITimeoutCommands & IEventCommands & IFindCommands>;
1
+ import { IFindCommands } from '@appium/types';
2
+ declare module '../driver' {
3
+ interface BaseDriver<C extends Constraints> extends IFindCommands {
4
+ }
5
+ }
13
6
  //# sourceMappingURL=find.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/find.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,qJAqFC;sBAGY,OAAO,eAAe,EAAE,OAAO;0BAC/B,OAAO,eAAe,EAAE,WAAW;4BACnC,OAAO,eAAe,EAAE,aAAa;+BACrC,OAAO,eAAe,EAAE,gBAAgB;6BACxC,OAAO,eAAe,EAAE,cAAc;+FAItC,OAAO,WAAW,EAAE,cAAc,CAAC,CAAC,EAAE,gBAAgB,GAAG,cAAc,GAAG,aAAa,CAAC"}
1
+ {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/find.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAC,MAAM,eAAe,CAAC;AAKzD,OAAO,QAAQ,WAAW,CAAC;IACzB,UAAU,UAAU,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,aAAa;KAAG;CACrE"}
@@ -1,107 +1,47 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FindMixin = void 0;
4
- /* eslint-disable no-unused-vars */
5
- /* eslint-disable require-await */
6
- // @ts-check
7
3
  const protocol_1 = require("../../protocol");
8
- /**
9
- * @template {Constraints} C
10
- * @param {import('./event').EventBase<C>} Base
11
- * @returns {FindBase<C>}
12
- */
13
- function FindMixin(Base) {
4
+ const mixin_1 = require("./mixin");
5
+ const FindCommands = {
6
+ async findElement(strategy, selector) {
7
+ return await this.findElOrElsWithProcessing(strategy, selector, false);
8
+ },
9
+ async findElements(strategy, selector) {
10
+ return await this.findElOrElsWithProcessing(strategy, selector, true);
11
+ },
12
+ async findElementFromElement(strategy, selector, elementId) {
13
+ return await this.findElOrElsWithProcessing(strategy, selector, false, elementId);
14
+ },
15
+ async findElementsFromElement(strategy, selector, elementId) {
16
+ return await this.findElOrElsWithProcessing(strategy, selector, true, elementId);
17
+ },
14
18
  /**
15
- * @implements {IFindCommands}
19
+ * Returns an object which adheres to the way the JSON Wire Protocol represents elements:
20
+ *
21
+ * Override this for your own driver!
16
22
  */
17
- class FindCommands extends Base {
18
- /**
19
- *
20
- * @returns {Promise<Element>}
21
- */
22
- async findElement(strategy, selector) {
23
- return await this.findElOrElsWithProcessing(strategy, selector, false);
23
+ async findElOrEls(strategy, selector, mult, context) {
24
+ throw new protocol_1.errors.NotImplementedError('Not implemented yet for find.');
25
+ },
26
+ async getPageSource() {
27
+ throw new protocol_1.errors.NotImplementedError('Not implemented yet for find.');
28
+ },
29
+ async findElOrElsWithProcessing(strategy, selector, mult, context) {
30
+ this.validateLocatorStrategy(strategy);
31
+ try {
32
+ return await this.findElOrEls(strategy, selector, mult, context);
24
33
  }
25
- /**
26
- *
27
- * @returns {Promise<Element[]>}
28
- */
29
- async findElements(strategy, selector) {
30
- return await this.findElOrElsWithProcessing(strategy, selector, true);
31
- }
32
- /**
33
- *
34
- * @returns {Promise<Element>}
35
- */
36
- async findElementFromElement(strategy, selector, elementId) {
37
- return await this.findElOrElsWithProcessing(strategy, selector, false, elementId);
38
- }
39
- /**
40
- *
41
- * @returns {Promise<Element[]>}
42
- */
43
- async findElementsFromElement(strategy, selector, elementId) {
44
- return await this.findElOrElsWithProcessing(strategy, selector, true, elementId);
45
- }
46
- /**
47
- * Returns an object which adheres to the way the JSON Wire Protocol represents elements:
48
- *
49
- * Override this for your own driver!
50
- * @template {boolean} Mult
51
- * @template [Ctx=any]
52
- * @param {string} strategy
53
- * @param {string} selector
54
- * @param {Mult} mult
55
- * @param {Ctx} [context]
56
- * @returns {Promise<Mult extends true ? Element[] : Element>}
57
- */
58
- async findElOrEls(strategy, selector, mult, context) {
59
- throw new protocol_1.errors.NotImplementedError('Not implemented yet for find.');
60
- }
61
- /**
62
- * @returns {Promise<string>}
63
- */
64
- async getPageSource() {
65
- throw new protocol_1.errors.NotImplementedError('Not implemented yet for find.');
66
- }
67
- /**
68
- * @template {boolean} Mult
69
- * @template [Ctx=any]
70
- * @param {string} strategy
71
- * @param {string} selector
72
- * @param {Mult} mult
73
- * @param {Ctx} [context]
74
- * @returns {Promise<Mult extends true ? Element[] : Element>}
75
- */
76
- async findElOrElsWithProcessing(strategy, selector, mult, context) {
77
- this.validateLocatorStrategy(strategy);
78
- try {
79
- return await this.findElOrEls(strategy, selector, mult, context);
80
- }
81
- catch (err) {
82
- if (this.opts.printPageSourceOnFindFailure) {
83
- const src = await this.getPageSource();
84
- this.log.debug(`Error finding element${mult ? 's' : ''}: ${err.message}`);
85
- this.log.debug(`Page source requested through 'printPageSourceOnFindFailure':`);
86
- this.log.debug(src);
87
- }
88
- // still want the error to occur
89
- throw err;
34
+ catch (err) {
35
+ if (this.opts.printPageSourceOnFindFailure) {
36
+ const src = await this.getPageSource();
37
+ this.log.debug(`Error finding element${mult ? 's' : ''}: ${err.message}`);
38
+ this.log.debug(`Page source requested through 'printPageSourceOnFindFailure':`);
39
+ this.log.debug(src);
90
40
  }
41
+ // still want the error to occur
42
+ throw err;
91
43
  }
92
- }
93
- return FindCommands;
94
- }
95
- exports.FindMixin = FindMixin;
96
- /**
97
- * @typedef {import('@appium/types').Element} Element
98
- * @typedef {import('@appium/types').Constraints} Constraints
99
- * @typedef {import('@appium/types').IFindCommands} IFindCommands
100
- * @typedef {import('@appium/types').ITimeoutCommands} ITimeoutCommands
101
- * @typedef {import('@appium/types').IEventCommands} IEventCommands
102
- */
103
- /**
104
- * @template {Constraints} C
105
- * @typedef {import('../driver').BaseDriverBase<C, ITimeoutCommands & IEventCommands & IFindCommands>} FindBase
106
- */
44
+ },
45
+ };
46
+ (0, mixin_1.mixin)(FindCommands);
107
47
  //# sourceMappingURL=find.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"find.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/find.js"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,kCAAkC;AAClC,YAAY;AACZ,6CAAsC;AAEtC;;;;GAIG;AACH,SAAgB,SAAS,CAAC,IAAI;IAC5B;;OAEG;IACH,MAAM,YAAa,SAAQ,IAAI;QAC7B;;;WAGG;QACH,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ;YAClC,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QACzE,CAAC;QAED;;;WAGG;QACH,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ;YACnC,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QACxE,CAAC;QAED;;;WAGG;QACH,KAAK,CAAC,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS;YACxD,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QACpF,CAAC;QAED;;;WAGG;QACH,KAAK,CAAC,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS;YACzD,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QACnF,CAAC;QACD;;;;;;;;;;;WAWG;QACH,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;YACjD,MAAM,IAAI,iBAAM,CAAC,mBAAmB,CAAC,+BAA+B,CAAC,CAAC;QACxE,CAAC;QAED;;WAEG;QACH,KAAK,CAAC,aAAa;YACjB,MAAM,IAAI,iBAAM,CAAC,mBAAmB,CAAC,+BAA+B,CAAC,CAAC;QACxE,CAAC;QACD;;;;;;;;WAQG;QACH,KAAK,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;YAC/D,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;YACvC,IAAI;gBACF,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;aAClE;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,IAAI,CAAC,IAAI,CAAC,4BAA4B,EAAE;oBAC1C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;oBACvC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,wBAAwB,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;oBAC1E,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;oBAChF,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;iBACrB;gBACD,gCAAgC;gBAChC,MAAM,GAAG,CAAC;aACX;QACH,CAAC;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AArFD,8BAqFC;AAED;;;;;;GAMG;AACH;;;GAGG"}
1
+ {"version":3,"file":"find.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/find.ts"],"names":[],"mappings":";;AACA,6CAAsC;AAEtC,mCAA8B;AAM9B,MAAM,YAAY,GAAkB;IAClC,KAAK,CAAC,WAAW,CAA6C,QAAQ,EAAE,QAAQ;QAC9E,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,YAAY,CAA6C,QAAQ,EAAE,QAAQ;QAC/E,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,sBAAsB,CAE1B,QAAgB,EAChB,QAAgB,EAChB,SAAiB;QAEjB,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACpF,CAAC;IAED,KAAK,CAAC,uBAAuB,CAE3B,QAAgB,EAChB,QAAgB,EAChB,SAAiB;QAEjB,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IACnF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAW,CAEf,QAAgB,EAChB,QAAgB,EAChB,IAAU,EACV,OAAY;QAEZ,MAAM,IAAI,iBAAM,CAAC,mBAAmB,CAAC,+BAA+B,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,MAAM,IAAI,iBAAM,CAAC,mBAAmB,CAAC,+BAA+B,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,yBAAyB,CAE7B,QAAgB,EAChB,QAAgB,EAChB,IAAU,EACV,OAAa;QAEb,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI;YACF,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;SAClE;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,IAAI,CAAC,IAAI,CAAC,4BAA4B,EAAE;gBAC1C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;gBACvC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,wBAAwB,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC1E,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;gBAChF,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACrB;YACD,gCAAgC;YAChC,MAAM,GAAG,CAAC;SACX;IACH,CAAC;CACF,CAAC;AAEF,IAAA,aAAK,EAAC,YAAY,CAAC,CAAC"}
@@ -1,4 +1,8 @@
1
- export function createBaseDriverClass<C_1 extends Readonly<Record<string, import("@appium/types").Constraint>>>(Base: import("../driver").BaseDriverBase<C_1, {}, {}>): import("./execute").ExecuteBase<C_1>;
2
- export type BaseDriverBase<C_1 extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('../driver').BaseDriverBase<C>;
3
- export type Constraints = import('@appium/types').Constraints;
1
+ export * from './event';
2
+ export * from './find';
3
+ export * from './log';
4
+ export * from './session';
5
+ export * from './settings';
6
+ export * from './timeout';
7
+ export * from './execute';
4
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/index.js"],"names":[],"mappings":"AAmCy3K,6MAAmB;uGAN/3K,OAAO,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;0BAIrC,OAAO,eAAe,EAAE,WAAW"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
@@ -1,31 +1,24 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4
15
  };
5
16
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createBaseDriverClass = void 0;
7
- // @ts-check
8
- const lodash_1 = __importDefault(require("lodash"));
9
- const event_1 = require("./event");
10
- const find_1 = require("./find");
11
- const log_1 = require("./log");
12
- const session_1 = require("./session");
13
- const settings_1 = require("./settings");
14
- const timeout_1 = require("./timeout");
15
- const execute_1 = require("./execute");
16
- /**
17
- * Applies all the mixins to the `BaseDriverBase` class; returns a `BaseDriver` class definition.
18
- * Each mixin is applied in the order it is listed here, and each type is a union with the previous.
19
- *
20
- * @template {Constraints} C
21
- * @param {BaseDriverBase<C>} Base
22
- */
23
- exports.createBaseDriverClass = lodash_1.default.flow(timeout_1.TimeoutMixin, event_1.EventMixin, find_1.FindMixin, log_1.LogMixin, settings_1.SettingsMixin, session_1.SessionMixin, execute_1.ExecuteMixin);
24
- /**
25
- * @template {Constraints} C
26
- * @typedef {import('../driver').BaseDriverBase<C>} BaseDriverBase
27
- */
28
- /**
29
- * @typedef {import('@appium/types').Constraints} Constraints
30
- */
17
+ __exportStar(require("./event"), exports);
18
+ __exportStar(require("./find"), exports);
19
+ __exportStar(require("./log"), exports);
20
+ __exportStar(require("./session"), exports);
21
+ __exportStar(require("./settings"), exports);
22
+ __exportStar(require("./timeout"), exports);
23
+ __exportStar(require("./execute"), exports);
31
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/index.js"],"names":[],"mappings":";;;;;;AAAA,YAAY;AACZ,oDAAuB;AACvB,mCAAmC;AACnC,iCAAiC;AACjC,+BAA+B;AAC/B,uCAAuC;AACvC,yCAAyC;AACzC,uCAAuC;AACvC,uCAAuC;AAEvC;;;;;;GAMG;AACU,QAAA,qBAAqB,GAAG,gBAAC,CAAC,IAAI,CACzC,sBAAY,EACZ,kBAAU,EACV,gBAAS,EACT,cAAQ,EACR,wBAAa,EACb,sBAAY,EACZ,sBAAY,CACb,CAAC;AAEF;;;GAGG;AAEH;;GAEG"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,yCAAuB;AACvB,wCAAsB;AACtB,4CAA0B;AAC1B,6CAA2B;AAC3B,4CAA0B;AAC1B,4CAA0B"}
@@ -1,11 +1,6 @@
1
- /**
2
- * @template {Constraints} C
3
- * @param {import('./find').FindBase<C>} Base
4
- * @returns {LogBase<C>}
5
- */
6
- export function LogMixin<C extends Readonly<Record<string, import("@appium/types").Constraint>>>(Base: import("./find").FindBase<C>): LogBase<C>;
7
- export type Constraints = import('@appium/types').Constraints;
8
- export type StringRecord = import('@appium/types').StringRecord;
9
- export type ILogCommands<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('@appium/types').ILogCommands<C>;
10
- export type LogBase<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & ILogCommands<C>>;
1
+ import { ILogCommands } from '@appium/types';
2
+ declare module '../driver' {
3
+ interface BaseDriver<C extends Constraints> extends ILogCommands {
4
+ }
5
+ }
11
6
  //# sourceMappingURL=log.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/log.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,iJAsCC;0BAGY,OAAO,eAAe,EAAE,WAAW;2BACnC,OAAO,eAAe,EAAE,YAAY;mGAKpC,OAAO,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC;8FAKvC,OAAO,WAAW,EAAE,cAAc,CAAC,CAAC,EAAE,OAAO,eAAe,EAAE,gBAAgB,GAAG,OAAO,eAAe,EAAE,cAAc,GAAG,OAAO,eAAe,EAAE,aAAa,GAAG,aAAa,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAe,MAAM,eAAe,CAAC;AAK9E,OAAO,QAAQ,WAAW,CAAC;IACzB,UAAU,UAAU,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,YAAY;KAAG;CACpE"}
@@ -1,58 +1,25 @@
1
1
  "use strict";
2
- /* eslint-disable require-await */
3
- // @ts-check
4
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
5
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
6
4
  };
7
5
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.LogMixin = void 0;
9
6
  const lodash_1 = __importDefault(require("lodash"));
10
- /**
11
- * @template {Constraints} C
12
- * @param {import('./find').FindBase<C>} Base
13
- * @returns {LogBase<C>}
14
- */
15
- function LogMixin(Base) {
16
- /**
17
- * @implements {ILogCommands<C>}
18
- */
19
- class LogCommands extends Base {
20
- constructor(...args) {
21
- super(...args);
22
- this.supportedLogTypes ?? (this.supportedLogTypes = {});
7
+ const mixin_1 = require("./mixin");
8
+ const LogCommands = {
9
+ supportedLogTypes: {},
10
+ async getLogTypes() {
11
+ this.log.debug('Retrieving supported log types');
12
+ return Object.keys(this.supportedLogTypes);
13
+ },
14
+ async getLog(logType) {
15
+ this.log.debug(`Retrieving '${String(logType)}' logs`);
16
+ if (!(logType in this.supportedLogTypes)) {
17
+ const logsTypesWithDescriptions = lodash_1.default.mapValues(this.supportedLogTypes, 'description');
18
+ throw new Error(`Unsupported log type '${String(logType)}'. ` +
19
+ `Supported types: ${JSON.stringify(logsTypesWithDescriptions)}`);
23
20
  }
24
- async getLogTypes() {
25
- this.log.debug('Retrieving supported log types');
26
- return Object.keys(this.supportedLogTypes);
27
- }
28
- /**
29
- * @this {import('@appium/types').Driver<C>}
30
- * @param {keyof typeof this.supportedLogTypes} logType
31
- * @returns {Promise<import('type-fest').AsyncReturnType<typeof this.supportedLogTypes[keyof typeof this.supportedLogTypes]['getter']>>}
32
- */
33
- async getLog(logType) {
34
- this.log.debug(`Retrieving '${String(logType)}' logs`);
35
- if (!(logType in this.supportedLogTypes)) {
36
- const logsTypesWithDescriptions = lodash_1.default.mapValues(this.supportedLogTypes, 'description');
37
- throw new Error(`Unsupported log type '${String(logType)}'. ` +
38
- `Supported types: ${JSON.stringify(logsTypesWithDescriptions)}`);
39
- }
40
- return await this.supportedLogTypes[logType].getter(this);
41
- }
42
- }
43
- return LogCommands;
44
- }
45
- exports.LogMixin = LogMixin;
46
- /**
47
- * @typedef {import('@appium/types').Constraints} Constraints
48
- * @typedef {import('@appium/types').StringRecord} StringRecord
49
- */
50
- /**
51
- * @template {Constraints} C
52
- * @typedef {import('@appium/types').ILogCommands<C>} ILogCommands
53
- */
54
- /**
55
- * @template {Constraints} C
56
- * @typedef {import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & ILogCommands<C>>} LogBase
57
- */
21
+ return await this.supportedLogTypes[logType].getter(this);
22
+ },
23
+ };
24
+ (0, mixin_1.mixin)(LogCommands);
58
25
  //# sourceMappingURL=log.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/log.js"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,YAAY;;;;;;AAEZ,oDAAuB;AAEvB;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,IAAI;IAC3B;;OAEG;IACH,MAAM,WAAY,SAAQ,IAAI;QAI5B,YAAY,GAAG,IAAI;YACjB,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YACf,IAAI,CAAC,iBAAiB,KAAtB,IAAI,CAAC,iBAAiB,GAAK,EAAE,EAAC;QAChC,CAAC;QAED,KAAK,CAAC,WAAW;YACf,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;YACjD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC7C,CAAC;QAED;;;;WAIG;QACH,KAAK,CAAC,MAAM,CAAC,OAAO;YAClB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,eAAe,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAEvD,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,iBAAiB,CAAC,EAAE;gBACxC,MAAM,yBAAyB,GAAG,gBAAC,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;gBACrF,MAAM,IAAI,KAAK,CACb,yBAAyB,MAAM,CAAC,OAAO,CAAC,KAAK;oBAC3C,oBAAoB,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,EAAE,CAClE,CAAC;aACH;YAED,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC5D,CAAC;KACF;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAtCD,4BAsCC;AAED;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG"}
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/log.ts"],"names":[],"mappings":";;;;;AACA,oDAAuB;AAEvB,mCAA8B;AAM9B,MAAM,WAAW,GAAiB;IAChC,iBAAiB,EAAgB,EAAE;IAEnC,KAAK,CAAC,WAAW;QACf,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACjD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,MAAM,CAEV,OAAgD;QAEhD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,eAAe,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEvD,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,iBAAiB,CAAC,EAAE;YACxC,MAAM,yBAAyB,GAAG,gBAAC,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;YACrF,MAAM,IAAI,KAAK,CACb,yBAAyB,MAAM,CAAC,OAAO,CAAC,KAAK;gBAC3C,oBAAoB,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,EAAE,CAClE,CAAC;SACH;QAED,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC;CACF,CAAC;AAEF,IAAA,aAAK,EAAC,WAAW,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Constraints } from '@appium/types';
2
+ import { BaseDriver } from '../driver';
3
+ /**
4
+ * This function assigns a mixin `T` to the `FakeDriver` class' prototype.
5
+ * While each mixin has its own interface which is (in isolation) unrelated to `FakeDriver`, the constraint
6
+ * on this generic type `T` is that it must be a partial of `FakeDriver`'s interface. This enforces
7
+ * that it does not conflict with the existing interface of `FakeDriver`. In that way, you can
8
+ * think of it as a type guard.
9
+ * @param mixin Mixin implementation
10
+ */
11
+ export declare function mixin<C extends Constraints, T extends Partial<BaseDriver<C>>>(mixin: T): void;
12
+ //# sourceMappingURL=mixin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixin.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAErC;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAE7F"}