@appium/base-plugin 2.2.2 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/build/lib/plugin.d.ts +6 -7
- package/build/lib/plugin.d.ts.map +1 -1
- package/build/lib/plugin.js +11 -10
- package/build/lib/plugin.js.map +1 -1
- package/lib/plugin.js +15 -11
- package/package.json +4 -4
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
|
|
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.
|
package/build/lib/plugin.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default BasePlugin;
|
|
2
2
|
export type Plugin = import('@appium/types').Plugin;
|
|
3
3
|
export type NextPluginCallback = import('@appium/types').NextPluginCallback;
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
4
|
+
export type Constraints = import('@appium/types').Constraints;
|
|
5
|
+
export type Driver<C extends import("@appium/types").Constraints> = import('@appium/types').Driver<C>;
|
|
6
6
|
/**
|
|
7
7
|
* @implements {Plugin}
|
|
8
8
|
*/
|
|
@@ -54,13 +54,12 @@ export class BasePlugin implements Plugin {
|
|
|
54
54
|
* `next` and `driver` objects since naturally we'd want to make sure to trigger the driver's own
|
|
55
55
|
* `executeMethod` call if an execute method is not found on the plugin itself.
|
|
56
56
|
*
|
|
57
|
-
* @template {
|
|
57
|
+
* @template {Constraints} C
|
|
58
58
|
* @param {NextPluginCallback} next
|
|
59
|
-
* @param {
|
|
59
|
+
* @param {Driver<C>} driver
|
|
60
60
|
* @param {string} script
|
|
61
|
-
* @param {[
|
|
62
|
-
* @this {Plugin}
|
|
61
|
+
* @param {readonly [import('@appium/types').StringRecord<unknown>] | readonly any[]} protoArgs
|
|
63
62
|
*/
|
|
64
|
-
executeMethod<
|
|
63
|
+
executeMethod<C extends import("@appium/types").Constraints>(next: NextPluginCallback, driver: import("@appium/types").Driver<C, import("@appium/types").StringRecord<any>, import("@appium/types").StringRecord<any>, import("@appium/types").DefaultCreateSessionResult<C>, void>, script: string, protoArgs: readonly [import('@appium/types').StringRecord<unknown>] | readonly any[]): Promise<unknown>;
|
|
65
64
|
}
|
|
66
65
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../lib/plugin.js"],"names":[],"mappings":";qBAuFa,OAAO,eAAe,EAAE,MAAM;iCAC9B,OAAO,eAAe,EAAE,kBAAkB;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../lib/plugin.js"],"names":[],"mappings":";qBAuFa,OAAO,eAAe,EAAE,MAAM;iCAC9B,OAAO,eAAe,EAAE,kBAAkB;0BAC1C,OAAO,eAAe,EAAE,WAAW;oEAKnC,OAAO,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;AA3F9C;;GAEG;AACH;IACE;;;;;;;;;;;;;;OAcG;IACH,wBAAyB;IAEzB;;;;;;;;;;;;;;;OAeG;IACH,4BAA6B;IAE7B;;;OAGG;IACH,kBAHW,MAAM,iDAOhB;IAHC,aAAgB;IAChB,iCAAsB;IACtB,6CAAkD;IAGpD;;;;;;;;;;;OAWG;IACH,mEALW,kBAAkB,wMAElB,MAAM,aACN,SAAS,CAAC,OAAO,eAAe,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,EAAE,oBAkBnF;CACF"}
|
package/build/lib/plugin.js
CHANGED
|
@@ -22,22 +22,20 @@ class BasePlugin {
|
|
|
22
22
|
* `next` and `driver` objects since naturally we'd want to make sure to trigger the driver's own
|
|
23
23
|
* `executeMethod` call if an execute method is not found on the plugin itself.
|
|
24
24
|
*
|
|
25
|
-
* @template {
|
|
25
|
+
* @template {Constraints} C
|
|
26
26
|
* @param {NextPluginCallback} next
|
|
27
|
-
* @param {
|
|
27
|
+
* @param {Driver<C>} driver
|
|
28
28
|
* @param {string} script
|
|
29
|
-
* @param {[
|
|
30
|
-
* @this {Plugin}
|
|
29
|
+
* @param {readonly [import('@appium/types').StringRecord<unknown>] | readonly any[]} protoArgs
|
|
31
30
|
*/
|
|
32
31
|
async executeMethod(next, driver, script, protoArgs) {
|
|
33
|
-
const Plugin = /** @type {PluginClass} */ (this.constructor);
|
|
32
|
+
const Plugin = /** @type {import('@appium/types').PluginClass<Plugin>} */ (this.constructor);
|
|
34
33
|
const commandMetadata = { ...Plugin.executeMethodMap?.[script] };
|
|
35
|
-
|
|
36
|
-
let command;
|
|
37
|
-
if (!commandMetadata.command || !(command = this[commandMetadata.command])) {
|
|
34
|
+
if (!commandMetadata.command || !(commandMetadata.command in this)) {
|
|
38
35
|
this.logger.info(`Plugin did not know how to handle method '${script}'. Passing control to next`);
|
|
39
36
|
return await next();
|
|
40
37
|
}
|
|
38
|
+
const command = /** @type {import('@appium/types').PluginCommand<Driver<C>>} */ (this[commandMetadata.command]);
|
|
41
39
|
const args = (0, base_driver_1.validateExecuteMethodParams)(protoArgs, commandMetadata.params);
|
|
42
40
|
return await command.call(this, next, driver, ...args);
|
|
43
41
|
}
|
|
@@ -80,7 +78,10 @@ exports.default = BasePlugin;
|
|
|
80
78
|
/**
|
|
81
79
|
* @typedef {import('@appium/types').Plugin} Plugin
|
|
82
80
|
* @typedef {import('@appium/types').NextPluginCallback} NextPluginCallback
|
|
83
|
-
* @typedef {import('@appium/types').
|
|
84
|
-
|
|
81
|
+
* @typedef {import('@appium/types').Constraints} Constraints
|
|
82
|
+
*/
|
|
83
|
+
/**
|
|
84
|
+
* @template {Constraints} C
|
|
85
|
+
* @typedef {import('@appium/types').Driver<C>} Driver
|
|
85
86
|
*/
|
|
86
87
|
//# sourceMappingURL=plugin.js.map
|
package/build/lib/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../lib/plugin.js"],"names":[],"mappings":";;;AAAA,6CAAuC;AACvC,qDAAgE;AAEhE;;GAEG;AACH,MAAM,UAAU;IAoCd;;;OAGG;IACH,YAAY,IAAI,EAAE,OAAO,GAAG,EAAE;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,gBAAM,CAAC,SAAS,CAAC,WAAW,IAAI,GAAG,CAAC,CAAC;IACrD,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../lib/plugin.js"],"names":[],"mappings":";;;AAAA,6CAAuC;AACvC,qDAAgE;AAEhE;;GAEG;AACH,MAAM,UAAU;IAoCd;;;OAGG;IACH,YAAY,IAAI,EAAE,OAAO,GAAG,EAAE;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,gBAAM,CAAC,SAAS,CAAC,WAAW,IAAI,GAAG,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS;QACjD,MAAM,MAAM,GAAG,0DAA0D,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC7F,MAAM,eAAe,GAAG,EAAC,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAC,CAAC;QAE/D,IAAI,CAAC,eAAe,CAAC,OAAO,IAAI,CAAC,CAAC,eAAe,CAAC,OAAO,IAAI,IAAI,CAAC,EAAE;YAClE,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,6CAA6C,MAAM,4BAA4B,CAChF,CAAC;YACF,OAAO,MAAM,IAAI,EAAE,CAAC;SACrB;QAED,MAAM,OAAO,GAAG,+DAA+D,CAAC,CAC9E,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAC9B,CAAC;QACF,MAAM,IAAI,GAAG,IAAA,yCAA2B,EAAC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;QAC5E,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IACzD,CAAC;;AAIK,gCAAU;AA7EhB;;;;;;;;;;;;;;GAcG;AACI,uBAAY,GAAG,EAAE,CAAC;AAEzB;;;;;;;;;;;;;;;GAeG;AACI,2BAAgB,GAAG,EAAE,CAAC;AA2C/B,kBAAe,UAAU,CAAC;AAG1B;;;;GAIG;AAEH;;;GAGG"}
|
package/lib/plugin.js
CHANGED
|
@@ -56,26 +56,26 @@ class BasePlugin {
|
|
|
56
56
|
* `next` and `driver` objects since naturally we'd want to make sure to trigger the driver's own
|
|
57
57
|
* `executeMethod` call if an execute method is not found on the plugin itself.
|
|
58
58
|
*
|
|
59
|
-
* @template {
|
|
59
|
+
* @template {Constraints} C
|
|
60
60
|
* @param {NextPluginCallback} next
|
|
61
|
-
* @param {
|
|
61
|
+
* @param {Driver<C>} driver
|
|
62
62
|
* @param {string} script
|
|
63
|
-
* @param {[
|
|
64
|
-
* @this {Plugin}
|
|
63
|
+
* @param {readonly [import('@appium/types').StringRecord<unknown>] | readonly any[]} protoArgs
|
|
65
64
|
*/
|
|
66
65
|
async executeMethod(next, driver, script, protoArgs) {
|
|
67
|
-
const Plugin = /** @type {PluginClass} */ (this.constructor);
|
|
66
|
+
const Plugin = /** @type {import('@appium/types').PluginClass<Plugin>} */ (this.constructor);
|
|
68
67
|
const commandMetadata = {...Plugin.executeMethodMap?.[script]};
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
let command;
|
|
72
|
-
|
|
73
|
-
if (!commandMetadata.command || !(command = this[commandMetadata.command])) {
|
|
69
|
+
if (!commandMetadata.command || !(commandMetadata.command in this)) {
|
|
74
70
|
this.logger.info(
|
|
75
71
|
`Plugin did not know how to handle method '${script}'. Passing control to next`
|
|
76
72
|
);
|
|
77
73
|
return await next();
|
|
78
74
|
}
|
|
75
|
+
|
|
76
|
+
const command = /** @type {import('@appium/types').PluginCommand<Driver<C>>} */ (
|
|
77
|
+
this[commandMetadata.command]
|
|
78
|
+
);
|
|
79
79
|
const args = validateExecuteMethodParams(protoArgs, commandMetadata.params);
|
|
80
80
|
return await command.call(this, next, driver, ...args);
|
|
81
81
|
}
|
|
@@ -87,6 +87,10 @@ export {BasePlugin};
|
|
|
87
87
|
/**
|
|
88
88
|
* @typedef {import('@appium/types').Plugin} Plugin
|
|
89
89
|
* @typedef {import('@appium/types').NextPluginCallback} NextPluginCallback
|
|
90
|
-
* @typedef {import('@appium/types').
|
|
91
|
-
|
|
90
|
+
* @typedef {import('@appium/types').Constraints} Constraints
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @template {Constraints} C
|
|
95
|
+
* @typedef {import('@appium/types').Driver<C>} Driver
|
|
92
96
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/base-plugin",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
4
4
|
"description": "The base plugin used to create Appium 2.0 plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@appium/base-driver": "^9.3.
|
|
44
|
-
"@appium/support": "^3.1.
|
|
43
|
+
"@appium/base-driver": "^9.3.4",
|
|
44
|
+
"@appium/support": "^3.1.8"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": "^14.17.0 || ^16.13.0 || >=18.0.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "d514ebdd7ebd27bb236509d0a3d580f0f18a34e5",
|
|
54
54
|
"tags": [
|
|
55
55
|
"appium"
|
|
56
56
|
],
|