appium-uiautomator2-driver 2.42.2 → 2.43.1

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 (114) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/build/lib/commands/actions.d.ts +22 -1
  3. package/build/lib/commands/actions.d.ts.map +1 -1
  4. package/build/lib/commands/actions.js +30 -62
  5. package/build/lib/commands/actions.js.map +1 -1
  6. package/build/lib/commands/alert.d.ts +28 -1
  7. package/build/lib/commands/alert.d.ts.map +1 -1
  8. package/build/lib/commands/alert.js +42 -23
  9. package/build/lib/commands/alert.js.map +1 -1
  10. package/build/lib/commands/app-management.d.ts +19 -0
  11. package/build/lib/commands/app-management.d.ts.map +1 -0
  12. package/build/lib/commands/app-management.js +45 -0
  13. package/build/lib/commands/app-management.js.map +1 -0
  14. package/build/lib/commands/app-strings.d.ts +9 -0
  15. package/build/lib/commands/app-strings.d.ts.map +1 -1
  16. package/build/lib/commands/app-strings.js +11 -79
  17. package/build/lib/commands/app-strings.js.map +1 -1
  18. package/build/lib/commands/battery.d.ts +7 -0
  19. package/build/lib/commands/battery.d.ts.map +1 -1
  20. package/build/lib/commands/battery.js +14 -20
  21. package/build/lib/commands/battery.js.map +1 -1
  22. package/build/lib/commands/element.d.ts +100 -1
  23. package/build/lib/commands/element.d.ts.map +1 -1
  24. package/build/lib/commands/element.js +175 -125
  25. package/build/lib/commands/element.js.map +1 -1
  26. package/build/lib/commands/execute.d.ts +25 -0
  27. package/build/lib/commands/execute.d.ts.map +1 -0
  28. package/build/lib/commands/execute.js +109 -0
  29. package/build/lib/commands/execute.js.map +1 -0
  30. package/build/lib/commands/find.d.ts +10 -0
  31. package/build/lib/commands/find.d.ts.map +1 -1
  32. package/build/lib/commands/find.js +25 -27
  33. package/build/lib/commands/find.js.map +1 -1
  34. package/build/lib/commands/gestures.d.ts +103 -1
  35. package/build/lib/commands/gestures.d.ts.map +1 -1
  36. package/build/lib/commands/gestures.js +202 -173
  37. package/build/lib/commands/gestures.js.map +1 -1
  38. package/build/lib/commands/keyboard.d.ts +47 -0
  39. package/build/lib/commands/keyboard.d.ts.map +1 -0
  40. package/build/lib/commands/keyboard.js +92 -0
  41. package/build/lib/commands/keyboard.js.map +1 -0
  42. package/build/lib/commands/misc.d.ts +48 -0
  43. package/build/lib/commands/misc.d.ts.map +1 -0
  44. package/build/lib/commands/misc.js +75 -0
  45. package/build/lib/commands/misc.js.map +1 -0
  46. package/build/lib/commands/navigation.d.ts +20 -0
  47. package/build/lib/commands/navigation.d.ts.map +1 -0
  48. package/build/lib/commands/navigation.js +35 -0
  49. package/build/lib/commands/navigation.js.map +1 -0
  50. package/build/lib/commands/screenshot.d.ts +24 -1
  51. package/build/lib/commands/screenshot.d.ts.map +1 -1
  52. package/build/lib/commands/screenshot.js +87 -64
  53. package/build/lib/commands/screenshot.js.map +1 -1
  54. package/build/lib/commands/touch.d.ts +81 -0
  55. package/build/lib/commands/touch.d.ts.map +1 -1
  56. package/build/lib/commands/touch.js +158 -41
  57. package/build/lib/commands/touch.js.map +1 -1
  58. package/build/lib/commands/viewport.d.ts +37 -1
  59. package/build/lib/commands/viewport.d.ts.map +1 -1
  60. package/build/lib/commands/viewport.js +80 -36
  61. package/build/lib/commands/viewport.js.map +1 -1
  62. package/build/lib/driver.d.ts +94 -24
  63. package/build/lib/driver.d.ts.map +1 -1
  64. package/build/lib/driver.js +114 -28
  65. package/build/lib/driver.js.map +1 -1
  66. package/build/lib/helpers.d.ts +12 -6
  67. package/build/lib/helpers.d.ts.map +1 -1
  68. package/build/lib/helpers.js +18 -18
  69. package/build/lib/helpers.js.map +1 -1
  70. package/build/lib/method-map.d.ts +0 -23
  71. package/build/lib/method-map.d.ts.map +1 -1
  72. package/build/lib/uiautomator2.js +3 -3
  73. package/build/lib/uiautomator2.js.map +1 -1
  74. package/build/tsconfig.tsbuildinfo +1 -1
  75. package/lib/commands/actions.js +37 -114
  76. package/lib/commands/alert.js +51 -37
  77. package/lib/commands/app-management.js +42 -0
  78. package/lib/commands/app-strings.js +9 -89
  79. package/lib/commands/battery.js +16 -26
  80. package/lib/commands/element.js +235 -214
  81. package/lib/commands/execute.js +120 -0
  82. package/lib/commands/find.js +31 -37
  83. package/lib/commands/gestures.js +252 -234
  84. package/lib/commands/keyboard.js +103 -0
  85. package/lib/commands/misc.js +106 -0
  86. package/lib/commands/navigation.js +31 -0
  87. package/lib/commands/screenshot.js +96 -77
  88. package/lib/commands/touch.js +190 -48
  89. package/lib/commands/viewport.js +100 -50
  90. package/lib/driver.ts +225 -36
  91. package/lib/helpers.js +15 -22
  92. package/lib/uiautomator2.js +3 -3
  93. package/npm-shrinkwrap.json +34 -34
  94. package/package.json +2 -2
  95. package/build/lib/commands/general.d.ts +0 -4
  96. package/build/lib/commands/general.d.ts.map +0 -1
  97. package/build/lib/commands/general.js +0 -214
  98. package/build/lib/commands/general.js.map +0 -1
  99. package/build/lib/commands/index.d.ts +0 -2
  100. package/build/lib/commands/index.d.ts.map +0 -1
  101. package/build/lib/commands/index.js +0 -14
  102. package/build/lib/commands/index.js.map +0 -1
  103. package/build/lib/commands/mixins.d.ts +0 -87
  104. package/build/lib/commands/mixins.d.ts.map +0 -1
  105. package/build/lib/commands/mixins.js +0 -26
  106. package/build/lib/commands/mixins.js.map +0 -1
  107. package/build/lib/utils.d.ts +0 -10
  108. package/build/lib/utils.d.ts.map +0 -1
  109. package/build/lib/utils.js +0 -26
  110. package/build/lib/utils.js.map +0 -1
  111. package/lib/commands/general.js +0 -289
  112. package/lib/commands/index.js +0 -11
  113. package/lib/commands/mixins.ts +0 -169
  114. package/lib/utils.js +0 -19
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "appium-uiautomator2-driver",
3
- "version": "2.42.2",
3
+ "version": "2.43.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-uiautomator2-driver",
9
- "version": "2.42.2",
9
+ "version": "2.43.1",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "appium-adb": "^12.0.0",
13
- "appium-android-driver": "^7.8.3",
13
+ "appium-android-driver": "^8.1.6",
14
14
  "appium-chromedriver": "^5.6.28",
15
15
  "appium-uiautomator2-server": "^6.0.3",
16
16
  "asyncbox": "^3.0.0",
@@ -881,9 +881,9 @@
881
881
  }
882
882
  },
883
883
  "node_modules/@types/express-serve-static-core": {
884
- "version": "4.17.41",
885
- "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.41.tgz",
886
- "integrity": "sha512-OaJ7XLaelTgrvlZD8/aa0vvvxZdUmlCn6MtWeB7TkiKW70BQLc9XEPpDLPdbo52ZhXUCrznlWdCHWxJWtdyajA==",
884
+ "version": "4.17.42",
885
+ "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.42.tgz",
886
+ "integrity": "sha512-ckM3jm2bf/MfB3+spLPWYPUH573plBFwpOhqQ2WottxYV85j1HQFlxmnTq57X1yHY9awZPig06hL/cLMgNWHIQ==",
887
887
  "dependencies": {
888
888
  "@types/node": "*",
889
889
  "@types/qs": "*",
@@ -964,9 +964,9 @@
964
964
  }
965
965
  },
966
966
  "node_modules/@types/node": {
967
- "version": "20.11.5",
968
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.5.tgz",
969
- "integrity": "sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==",
967
+ "version": "20.11.7",
968
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.7.tgz",
969
+ "integrity": "sha512-GPmeN1C3XAyV5uybAf4cMLWT9fDWcmQhZVtMFu7OR32WjrqGG+Wnk2V1d0bmtUyE/Zy1QJ9BxyiTih9z8Oks8A==",
970
970
  "dependencies": {
971
971
  "undici-types": "~5.26.4"
972
972
  }
@@ -1209,9 +1209,9 @@
1209
1209
  }
1210
1210
  },
1211
1211
  "node_modules/appium-adb": {
1212
- "version": "12.0.1",
1213
- "resolved": "https://registry.npmjs.org/appium-adb/-/appium-adb-12.0.1.tgz",
1214
- "integrity": "sha512-oGrw7pJ6FfYFO5ldnKX+HIsOgYlcsv12l76GEPQvqYnzlehjgNA1Z1fCpNpd0d6bO8C1Cn2pAdGJFpBWhHHldg==",
1212
+ "version": "12.0.2",
1213
+ "resolved": "https://registry.npmjs.org/appium-adb/-/appium-adb-12.0.2.tgz",
1214
+ "integrity": "sha512-Zl/iwOZkLMUT1zIL3Aw8Sgf4Jz7EdLBZ5lQtRTrMfDGXCYzxiNQrEQx888Z7Nr114xBtH57h+mP9CVld/xnmZQ==",
1215
1215
  "dependencies": {
1216
1216
  "@appium/support": "^4.0.0",
1217
1217
  "@devicefarmer/adbkit-apkreader": "^3.2.4",
@@ -1231,13 +1231,13 @@
1231
1231
  }
1232
1232
  },
1233
1233
  "node_modules/appium-android-driver": {
1234
- "version": "7.8.3",
1235
- "resolved": "https://registry.npmjs.org/appium-android-driver/-/appium-android-driver-7.8.3.tgz",
1236
- "integrity": "sha512-CsiLHVMaGFqL77Eq5E9fCQGXCHwV8XR5UN9alTTkT7KBDf1rWMwRFbKDpXscd3FENkRyprAdSeNVNXs+E8KnLw==",
1234
+ "version": "8.1.6",
1235
+ "resolved": "https://registry.npmjs.org/appium-android-driver/-/appium-android-driver-8.1.6.tgz",
1236
+ "integrity": "sha512-tXKpMJ7d+xSZ/BTBPbzZoNCcHrQYT0tDkx8PHp9RL7phVjxZ0yWD6X6DdhA6RvphzN63Dy5bBzdygtP2M22Erg==",
1237
1237
  "dependencies": {
1238
1238
  "@appium/support": "^4.2.0",
1239
1239
  "@colors/colors": "^1.6.0",
1240
- "appium-adb": "^12.0.0",
1240
+ "appium-adb": "^12.0.2",
1241
1241
  "appium-chromedriver": "^5.5.1",
1242
1242
  "asyncbox": "^3.0.0",
1243
1243
  "axios": "^1.x",
@@ -1263,9 +1263,9 @@
1263
1263
  }
1264
1264
  },
1265
1265
  "node_modules/appium-chromedriver": {
1266
- "version": "5.6.29",
1267
- "resolved": "https://registry.npmjs.org/appium-chromedriver/-/appium-chromedriver-5.6.29.tgz",
1268
- "integrity": "sha512-TzdWlBx+t/rLgRXpVslCsQTTMHoPCobGWF2tsvUhAJaaGYyapt7fn6uBL7ghWpkADOihaVDbhxURm6q50IBtAA==",
1266
+ "version": "5.6.30",
1267
+ "resolved": "https://registry.npmjs.org/appium-chromedriver/-/appium-chromedriver-5.6.30.tgz",
1268
+ "integrity": "sha512-UX/Ma1TPJ9dxCVCHctnrmC8bjnKlYpfMgmIsd5KBfYn4wvALpGgfcL5dxSktey0qU87iFckK0vrcFRwZjQR4gQ==",
1269
1269
  "hasInstallScript": true,
1270
1270
  "dependencies": {
1271
1271
  "@appium/base-driver": "^9.1.0",
@@ -1289,9 +1289,9 @@
1289
1289
  }
1290
1290
  },
1291
1291
  "node_modules/appium-uiautomator2-server": {
1292
- "version": "6.0.4",
1293
- "resolved": "https://registry.npmjs.org/appium-uiautomator2-server/-/appium-uiautomator2-server-6.0.4.tgz",
1294
- "integrity": "sha512-YqzzM1Uuw2Y9I2k18v7I2gdXnQmSr7jBmMVZmz/C3eBsymqrw+lMqzoK0oq1Yhn6XXhxFu3upOFqE6XBZ6tOXA==",
1292
+ "version": "6.0.5",
1293
+ "resolved": "https://registry.npmjs.org/appium-uiautomator2-server/-/appium-uiautomator2-server-6.0.5.tgz",
1294
+ "integrity": "sha512-UBT2fA6r8KEm0lD9H7/EVnaG0CERS9OI77m19LrD7Kj1PSZgXEFnhdMWOP/5ToLGo/mtxIoHQ2dLsVLw3zYMEg==",
1295
1295
  "engines": {
1296
1296
  "node": ">=14",
1297
1297
  "npm": ">=8"
@@ -1437,9 +1437,9 @@
1437
1437
  "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
1438
1438
  },
1439
1439
  "node_modules/axios": {
1440
- "version": "1.6.5",
1441
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz",
1442
- "integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==",
1440
+ "version": "1.6.7",
1441
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.7.tgz",
1442
+ "integrity": "sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==",
1443
1443
  "dependencies": {
1444
1444
  "follow-redirects": "^1.15.4",
1445
1445
  "form-data": "^4.0.0",
@@ -2770,9 +2770,9 @@
2770
2770
  }
2771
2771
  },
2772
2772
  "node_modules/io.appium.settings": {
2773
- "version": "5.7.3",
2774
- "resolved": "https://registry.npmjs.org/io.appium.settings/-/io.appium.settings-5.7.3.tgz",
2775
- "integrity": "sha512-r0zFLq1Q2BpucxjpKd7BKktZ2SyGAobyioNVcfMWZkXj4t/sauK+CnDL50VFOOYYitglJTTHOQfKi/t0Pmxyyw==",
2773
+ "version": "5.7.5",
2774
+ "resolved": "https://registry.npmjs.org/io.appium.settings/-/io.appium.settings-5.7.5.tgz",
2775
+ "integrity": "sha512-h6QyCJGERuvMqa+nPytqjJ024rShyX6lc4G4fG0jVrMYsQL64ymtMwVkKkRMED69meuDCuy/4H69qXuJCe5S0w==",
2776
2776
  "dependencies": {
2777
2777
  "asyncbox": "^3.0.0",
2778
2778
  "bluebird": "^3.5.1",
@@ -4117,9 +4117,9 @@
4117
4117
  }
4118
4118
  },
4119
4119
  "node_modules/spdx-exceptions": {
4120
- "version": "2.3.0",
4121
- "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz",
4122
- "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A=="
4120
+ "version": "2.4.0",
4121
+ "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.4.0.tgz",
4122
+ "integrity": "sha512-hcjppoJ68fhxA/cjbN4T8N6uCUejN8yFw69ttpqtBeCbF3u13n7mb31NB9jKwGTTWWnt9IbRA/mf1FprYS8wfw=="
4123
4123
  },
4124
4124
  "node_modules/spdx-expression-parse": {
4125
4125
  "version": "3.0.1",
@@ -4396,9 +4396,9 @@
4396
4396
  "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
4397
4397
  },
4398
4398
  "node_modules/type-fest": {
4399
- "version": "4.10.0",
4400
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.10.0.tgz",
4401
- "integrity": "sha512-NPaKJsb4wyJ16qc8zBQrWswLKv/YirgBFykvUQ1Iajt2wd+twC8E4hFXdlIXqiMl6kWA0zY8tUJ9ELVAdu5h7w==",
4399
+ "version": "4.10.1",
4400
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.10.1.tgz",
4401
+ "integrity": "sha512-7ZnJYTp6uc04uYRISWtiX3DSKB/fxNQT0B5o1OUeCqiQiwF+JC9+rJiZIDrPrNCLLuTqyQmh4VdQqh/ZOkv9MQ==",
4402
4402
  "engines": {
4403
4403
  "node": ">=16"
4404
4404
  },
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "automated testing",
8
8
  "android"
9
9
  ],
10
- "version": "2.42.2",
10
+ "version": "2.43.1",
11
11
  "bugs": {
12
12
  "url": "https://github.com/appium/appium-uiautomator2-driver/issues"
13
13
  },
@@ -63,7 +63,7 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "appium-adb": "^12.0.0",
66
- "appium-android-driver": "^7.8.3",
66
+ "appium-android-driver": "^8.1.6",
67
67
  "appium-chromedriver": "^5.6.28",
68
68
  "appium-uiautomator2-server": "^6.0.3",
69
69
  "asyncbox": "^3.0.0",
@@ -1,4 +0,0 @@
1
- export type UiAutomator2Server = import('../uiautomator2').UiAutomator2Server;
2
- export type ADB = import('appium-adb').ADB;
3
- export type StringRecord<T = any> = import('@appium/types').StringRecord<T>;
4
- //# sourceMappingURL=general.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../lib/commands/general.js"],"names":[],"mappings":"iCAyRa,OAAO,iBAAiB,EAAE,kBAAkB;kBAC5C,OAAO,YAAY,EAAE,GAAG;oCAKxB,OAAO,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC"}
@@ -1,214 +0,0 @@
1
- "use strict";
2
- // @ts-check
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const lodash_1 = __importDefault(require("lodash"));
8
- const bluebird_1 = __importDefault(require("bluebird"));
9
- const driver_1 = require("appium/driver");
10
- const extensions_1 = require("../extensions");
11
- const mixins_1 = require("./mixins");
12
- const driver_2 = require("../driver");
13
- const MOBILE_SCRIPT_NAME_PREFIX = 'mobile:';
14
- /**
15
- * Massages the arguments going into an execute method.
16
- * @remarks A similar method is implemented in `appium-xcuitest-driver`, but it
17
- * appears the methods in here handle unwrapping of `Element` objects, so we do
18
- * not do that here.
19
- * @param {readonly any[] | readonly [StringRecord] | Readonly<StringRecord>} [args]
20
- * @internal
21
- * @returns {StringRecord<unknown>}
22
- */
23
- function preprocessExecuteMethodArgs(args) {
24
- if (lodash_1.default.isArray(args)) {
25
- args = lodash_1.default.first(args);
26
- }
27
- const executeMethodArgs = /** @type {StringRecord<unknown>} */ (args ?? {});
28
- /**
29
- * Renames the deprecated `element` key to `elementId`. Historically,
30
- * all of the pre-Execute-Method-Map execute methods accepted an `element` _or_ and `elementId` param.
31
- * This assigns the `element` value to `elementId` if `elementId` is not already present.
32
- */
33
- if (!('elementId' in executeMethodArgs) && 'element' in executeMethodArgs) {
34
- executeMethodArgs.elementId = executeMethodArgs.element;
35
- delete executeMethodArgs.element;
36
- }
37
- return executeMethodArgs;
38
- }
39
- /**
40
- * Type guard to check if a script is an execute method.
41
- * @param {any} script
42
- * @internal
43
- * @returns {string?}
44
- */
45
- function toExecuteMethodName(script) {
46
- return lodash_1.default.startsWith(script, MOBILE_SCRIPT_NAME_PREFIX)
47
- ? script.replace(new RegExp(`${MOBILE_SCRIPT_NAME_PREFIX}\\s*`), `${MOBILE_SCRIPT_NAME_PREFIX} `)
48
- : null;
49
- }
50
- /**
51
- * @type {import('./mixins').UIA2GeneralMixin}
52
- * @satisfies {import('@appium/types').ExternalDriver}
53
- */
54
- const GeneralMixin = {
55
- async getPageSource() {
56
- return String(await this.uiautomator2.jwproxy.command('/source', 'GET', {}));
57
- },
58
- async getClipboard() {
59
- return String((await this.adb.getApiLevel()) < 29
60
- ? await this.uiautomator2.jwproxy.command('/appium/device/get_clipboard', 'POST', {})
61
- : await this.settingsApp.getClipboard());
62
- },
63
- async doSendKeys(params) {
64
- await this.uiautomator2.jwproxy.command('/keys', 'POST', params);
65
- },
66
- async keyevent(keycode, metastate) {
67
- this.log.debug(`Ignoring metastate ${metastate}`);
68
- await this.adb.keyevent(keycode);
69
- },
70
- async back() {
71
- await this.adb.keyevent(4);
72
- },
73
- async getDisplayDensity() {
74
- return /** @type {number} */ (await this.uiautomator2.jwproxy.command('/appium/device/display_density', 'GET', {}));
75
- },
76
- async getWindowSize() {
77
- return /** @type {import('@appium/types').Size} */ (await this.uiautomator2.jwproxy.command('/window/current/size', 'GET', {}));
78
- },
79
- // For W3C
80
- async getWindowRect() {
81
- const { width, height } = await this.getWindowSize();
82
- return {
83
- width,
84
- height,
85
- x: 0,
86
- y: 0,
87
- };
88
- },
89
- /**
90
- * @override
91
- * @privateRemarks Because the "mobile" commands (execute methods) in this
92
- * driver universally accept an options object, this method will _not_ call
93
- * into `BaseDriver.executeMethod`.
94
- */
95
- async execute(script, args) {
96
- const mobileScriptName = toExecuteMethodName(script);
97
- const isWebContext = this.isWebContext();
98
- if (mobileScriptName && isWebContext || !isWebContext) {
99
- if (mobileScriptName) {
100
- const executeMethodArgs = preprocessExecuteMethodArgs(args);
101
- this.log.info(`Executing method '${mobileScriptName}'`);
102
- return await this.executeMobile(mobileScriptName, executeMethodArgs);
103
- }
104
- // Just pass the script name through and let it fail with a proper error message
105
- return await this.executeMobile(`${script}`, {});
106
- }
107
- const endpoint =
108
- /** @type {import('appium-chromedriver').Chromedriver} */ (this.chromedriver).jwproxy
109
- .downstreamProtocol === driver_1.PROTOCOLS.MJSONWP
110
- ? '/execute'
111
- : '/execute/sync';
112
- return await /** @type {import('appium-chromedriver').Chromedriver} */ (this.chromedriver).jwproxy.command(endpoint, 'POST', {
113
- script,
114
- args,
115
- });
116
- },
117
- /**
118
- * @param script Must be of the form `mobile: <something>`, which differs from its parent class implementation.
119
- * @override
120
- */
121
- async executeMobile(script, opts = {}) {
122
- if (!(script in driver_2.AndroidUiautomator2Driver.executeMethodMap)) {
123
- const commandNames = lodash_1.default.map(lodash_1.default.keys(driver_2.AndroidUiautomator2Driver.executeMethodMap), (value) => value.slice(8));
124
- throw new driver_1.errors.UnknownCommandError(`Unknown mobile command "${script}". ` +
125
- `Only ${commandNames.join(', ')} commands are supported.`);
126
- }
127
- const methodName = driver_2.AndroidUiautomator2Driver.executeMethodMap[
128
- /** @type {keyof import('../execute-method-map').Uiautomator2ExecuteMethodMap} */ (script)].command;
129
- return await /** @type {(opts?: any) => Promise<unknown>} */ (this[methodName])(opts);
130
- },
131
- async mobileViewportScreenshot() {
132
- return await this.getViewportScreenshot();
133
- },
134
- /**
135
- * Returns the viewport coordinates.
136
- * @returns The viewport coordinates.
137
- */
138
- async mobileViewPortRect() {
139
- return await this.getViewPortRect();
140
- },
141
- async setUrl(url) {
142
- await this.adb.startUri(url, /** @type {string} */ (this.opts.appPackage));
143
- },
144
- /**
145
- * Start URL that take users directly to specific content in the app
146
- */
147
- async mobileDeepLink(opts) {
148
- const { url, package: pkg, waitForLaunch } = opts;
149
- return await this.adb.startUri(url, pkg, { waitForLaunch });
150
- },
151
- async openNotifications() {
152
- await this.uiautomator2.jwproxy.command('/appium/device/open_notifications', 'POST', {});
153
- },
154
- // Stop proxying to any Chromedriver and redirect to uiautomator2
155
- suspendChromedriverProxy() {
156
- this.chromedriver = undefined;
157
- this.proxyReqRes = this.uiautomator2.proxyReqRes.bind(this.uiautomator2);
158
- this.proxyCommand = /** @type {typeof this.proxyCommand} */ (this.uiautomator2.proxyCommand.bind(this.uiautomator2));
159
- this.jwpProxyActive = true;
160
- },
161
- /**
162
- * The list of available info entries can be found at
163
- * https://github.com/appium/appium-uiautomator2-server/blob/master/app/src/main/java/io/appium/uiautomator2/handler/GetDeviceInfo.java
164
- */
165
- async mobileGetDeviceInfo() {
166
- return /** @type {StringRecord} */ (await this.uiautomator2.jwproxy.command('/appium/device/info', 'GET'));
167
- },
168
- /**
169
- * Types the given Unicode string.
170
- * It is expected that the focus is already put
171
- * to the destination input field before this method is called.
172
- *
173
- * @returns `true` if the input text has been successfully sent to adb
174
- * @throws {Error} if `text` property has not been provided
175
- */
176
- async mobileType(opts) {
177
- const { text } = opts;
178
- if (lodash_1.default.isUndefined(text)) {
179
- this.log.errorAndThrow(`The 'text' argument is mandatory`);
180
- throw new Error(); // unreachable
181
- }
182
- return await this.settingsApp.typeUnicode(String(text));
183
- },
184
- /**
185
- * Install multiple APKs with `install-multiple` option.
186
- *
187
- * @throws {Error} if an error occured while installing the given APKs.
188
- */
189
- async mobileInstallMultipleApks(opts) {
190
- if (!lodash_1.default.isArray(opts.apks) || lodash_1.default.isEmpty(opts.apks)) {
191
- throw new driver_1.errors.InvalidArgumentError('No apks are given to install');
192
- }
193
- const apks = await bluebird_1.default.all(opts.apks.map((app) => this.helpers.configureApp(app, [extensions_1.APK_EXTENSION])));
194
- await this.adb.installMultipleApks(apks, opts.options);
195
- },
196
- /**
197
- * Puts the app to background and waits the given number of seconds Then restores the app
198
- * if necessary. The call is blocking.
199
- */
200
- async mobileBackgroundApp(opts = {}) {
201
- const { seconds = -1 } = opts;
202
- await this.background(seconds);
203
- },
204
- };
205
- (0, mixins_1.mixin)(GeneralMixin);
206
- /**
207
- * @typedef {import('../uiautomator2').UiAutomator2Server} UiAutomator2Server
208
- * @typedef {import('appium-adb').ADB} ADB
209
- */
210
- /**
211
- * @template [T=any]
212
- * @typedef {import('@appium/types').StringRecord<T>} StringRecord
213
- */
214
- //# sourceMappingURL=general.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"general.js","sourceRoot":"","sources":["../../../lib/commands/general.js"],"names":[],"mappings":";AAAA,YAAY;;;;;AAEZ,oDAAuB;AACvB,wDAAyB;AACzB,0CAAgD;AAChD,8CAA4C;AAC5C,qCAA+B;AAC/B,sCAAoD;AAEpD,MAAM,yBAAyB,GAAG,SAAS,CAAC;AAE5C;;;;;;;;GAQG;AACH,SAAS,2BAA2B,CAAC,IAAI;IACvC,IAAI,gBAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACnB,IAAI,GAAG,gBAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KACtB;IACD,MAAM,iBAAiB,GAAG,oCAAoC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IAC5E;;;;OAIG;IACH,IAAI,CAAC,CAAC,WAAW,IAAI,iBAAiB,CAAC,IAAI,SAAS,IAAI,iBAAiB,EAAE;QACzE,iBAAiB,CAAC,SAAS,GAAG,iBAAiB,CAAC,OAAO,CAAC;QACxD,OAAO,iBAAiB,CAAC,OAAO,CAAC;KAClC;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,MAAM;IACjC,OAAO,gBAAC,CAAC,UAAU,CAAC,MAAM,EAAE,yBAAyB,CAAC;QACpD,CAAC,C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AAC,CAAC;IAC1D,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,yBAAyB,CAAC,IAAI;QAClC,IAAI,CAAC,gBAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,gBAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACjD,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,8BAA8B,CAAC,CAAC;SACvE;QACD,MAAM,IAAI,GAAG,MAAM,kBAAC,CAAC,GAAG,CACtB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,0BAAa,CAAC,CAAC,CAAC,CACxE,CAAC;QACF,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,mBAAmB,CAAC,IAAI,GAAG,EAAE;QACjC,MAAM,EAAC,OAAO,GAAG,CAAC,CAAC,EAAC,GAAG,IAAI,CAAC;QAC5B,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;CACF,CAAC;AAEF,IAAA,cAAK,EAAC,YAAY,CAAC,CAAC;AAEpB;;;GAGG;AAEH;;;GAGG"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/commands/index.js"],"names":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- require("./alert");
4
- require("./find");
5
- require("./general");
6
- require("./touch");
7
- require("./element");
8
- require("./actions");
9
- require("./viewport");
10
- require("./screenshot");
11
- require("./battery");
12
- require("./gestures");
13
- require("./app-strings");
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/commands/index.js"],"names":[],"mappings":";;AAAA,mBAAiB;AACjB,kBAAgB;AAChB,qBAAmB;AACnB,mBAAiB;AACjB,qBAAmB;AACnB,qBAAmB;AACnB,sBAAoB;AACpB,wBAAsB;AACtB,qBAAmB;AACnB,sBAAoB;AACpB,yBAAuB"}
@@ -1,87 +0,0 @@
1
- /**
2
- * @module
3
- * @privateRemarks These mixins are kind of a mishmash of stuff from `appium-android-driver`,
4
- * @privateRemarks unique things, and stuff from `ExternalDriver`. Ideally, we should be pulling the method
5
- * @privateRemarks definitions right out of `ExternalDriver` whenever possible. Also note that the mixins
6
- * @privateRemarks contain _more stuff than just commands or execute methods_.
7
- */
8
- import type { Element, ExternalDriver, StringRecord } from '@appium/types';
9
- import type { ActionsMixin, AlertMixin, ElementMixin, ExecuteMixin, FindMixin, GeneralMixin, NetworkMixin, TouchMixin } from 'appium-android-driver';
10
- import type { EmptyObject } from 'type-fest';
11
- import { AndroidUiautomator2Driver } from '../driver';
12
- import type * as types from './types';
13
- type UIA2Mixin<T = EmptyObject> = ThisType<import('../driver').AndroidUiautomator2Driver> & T;
14
- export type UIA2ActionsMixin = UIA2Mixin<Pick<ActionsMixin, 'pressKeyCode' | 'longPressKeyCode' | 'doSwipe' | 'doDrag' | 'getOrientation' | 'setOrientation'>> & {
15
- mobilePressKey(opts: types.PressKeyOptions): Promise<void>;
16
- mobileScheduleAction(opts?: StringRecord): Promise<unknown>;
17
- mobileGetActionHistory(opts?: types.ActionArgs): Promise<types.ActionResult>;
18
- mobileUnscheduleAction(opts?: types.ActionArgs): Promise<unknown>;
19
- };
20
- export type UIA2AlertMixin = UIA2Mixin<Pick<AlertMixin, 'getAlertText' | 'postAcceptAlert' | 'postDismissAlert'>> & {
21
- mobileAcceptAlert(opts?: types.AcceptAlertOptions): Promise<void>;
22
- mobileDismissAlert(opts?: types.DismissAlertOptions): Promise<void>;
23
- };
24
- export type UIA2AppStringsMixin = UIA2Mixin<Pick<GeneralMixin, 'getStrings'>> & {
25
- mobileGetAppStrings(opts?: types.GetAppStringsOptions): Promise<StringRecord>;
26
- };
27
- export type UIA2BatteryMixin = UIA2Mixin & {
28
- mobileGetBatteryInfo(): Promise<types.BatteryInfo>;
29
- };
30
- export type UIA2ElementMixin = UIA2Mixin<Pick<ElementMixin, 'getAttribute' | 'elementDisplayed' | 'elementEnabled' | 'elementSelected' | 'getName' | 'getLocation' | 'getSize' | 'touchLongClick' | 'touchDown' | 'touchUp' | 'touchMove' | 'doSetElementValue' | 'setValueImmediate' | 'getText' | 'click' | 'tap' | 'clear' | 'getElementRect'>> & {
31
- active(): Promise<Element>;
32
- mobileReplaceElementValue(opts: types.ReplaceValueOptions): Promise<void>;
33
- getElementScreenshot(elementId: string): Promise<string>;
34
- };
35
- export type UIA2FindMixin = UIA2Mixin<Pick<FindMixin, 'doFindElementOrEls'>>;
36
- export type UIA2GeneralMixin = UIA2Mixin<Pick<GeneralMixin & NetworkMixin & ActionsMixin & ExecuteMixin, 'getPageSource' | 'doSendKeys' | 'back' | 'getDisplayDensity' | 'getWindowSize' | 'getWindowRect' | 'setUrl' | 'keyevent' | 'execute' | 'executeMobile'>> & {
37
- getClipboard(): Promise<string>;
38
- mobileViewportScreenshot(): Promise<string>;
39
- mobileViewPortRect(): Promise<types.RelativeRect>;
40
- mobileDeepLink(opts: types.DeepLinkOpts): Promise<void>;
41
- openNotifications(): Promise<void>;
42
- suspendChromedriverProxy(): void;
43
- mobileGetDeviceInfo(): Promise<StringRecord>;
44
- mobileType(opts: types.TypingOptions): Promise<boolean>;
45
- mobileInstallMultipleApks(opts: types.InstallMultipleApksOptions): Promise<void>;
46
- mobileBackgroundApp(opts?: types.BackgroundAppOptions): Promise<void>;
47
- };
48
- export type UIA2ViewportMixin = UIA2Mixin & {
49
- getStatusBarHeight(): Promise<number>;
50
- getDevicePixelRatio(): Promise<string>;
51
- getViewportScreenshot(): Promise<string>;
52
- getViewPortRect(): Promise<types.RelativeRect>;
53
- };
54
- export type UIA2GesturesMixin = UIA2Mixin & {
55
- mobileClickGesture(opts?: types.ClickOptions): Promise<void>;
56
- mobileDoubleClickGesture(opts?: types.ClickOptions): Promise<void>;
57
- mobileDragGesture(opts: types.DragOptions): Promise<void>;
58
- mobileFlingGesture(opts: types.FlingOptions): Promise<boolean>;
59
- mobilePinchCloseGesture(opts: types.PinchOptions): Promise<void>;
60
- mobilePinchOpenGesture(opts: types.PinchOptions): Promise<void>;
61
- mobileSwipeGesture(opts: types.SwipeOptions): Promise<void>;
62
- mobileScrollGesture(opts: types.ScrollGestureOptions): Promise<boolean>;
63
- mobileScrollBackTo(opts: types.ScrollElementToElementOpts): Promise<void>;
64
- mobileScroll(opts: types.ScrollOptions): Promise<void>;
65
- mobileLongClickGesture(opts: types.LongClickOptions): Promise<void>;
66
- };
67
- export type UIA2ScreenshotMixin = UIA2Mixin<Pick<ActionsMixin, 'getScreenshot'>> & {
68
- mobileScreenshots(opts: types.ScreenshotsOpts): Promise<StringRecord<types.Screenshot>>;
69
- };
70
- export type UIA2TouchMixin = UIA2Mixin<Required<Pick<ExternalDriver & TouchMixin, 'performActions' | 'releaseActions' | 'doPerformMultiAction'>>>;
71
- declare module '../driver' {
72
- interface AndroidUiautomator2Driver extends UIA2ActionsMixin, UIA2AlertMixin, UIA2AppStringsMixin, UIA2BatteryMixin, UIA2ElementMixin, UIA2FindMixin, UIA2GeneralMixin, UIA2GesturesMixin, UIA2ScreenshotMixin, UIA2TouchMixin, UIA2ViewportMixin {
73
- }
74
- }
75
- /**
76
- * This function assigns a mixin `T` to the `AndroidUiautomator2Driver` class' prototype.
77
- *
78
- * While each mixin has its own interface which is (in isolation) unrelated to
79
- * `AndroidUiautomator2Driver`, the constraint on this generic type `T` is that it must be a
80
- * partial of `AndroidUiautomator2Driver`'s interface. This enforces that it does not
81
- * conflict with the existing interface of `AndroidUiautomator2Driver`. In that way, you
82
- * can think of it as a type guard.
83
- * @param mixin Mixin implementation
84
- */
85
- export declare function mixin<T extends Partial<AndroidUiautomator2Driver>>(mixin: T): void;
86
- export {};
87
- //# sourceMappingURL=mixins.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mixins.d.ts","sourceRoot":"","sources":["../../../lib/commands/mixins.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACzE,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,UAAU,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAC,yBAAyB,EAAC,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,KAAK,KAAK,MAAM,SAAS,CAAC;AAEtC,KAAK,SAAS,CAAC,CAAC,GAAG,WAAW,IAAI,QAAQ,CAAC,OAAO,WAAW,EAAE,yBAAyB,CAAC,GAAG,CAAC,CAAC;AAE9F,MAAM,MAAM,gBAAgB,GAAG,SAAS,CACtC,IAAI,CACF,YAAY,EACZ,cAAc,GAAG,kBAAkB,GAAG,SAAS,GAAG,QAAQ,GAAG,gBAAgB,GAAG,gBAAgB,CACjG,CACF,GAAG;IACF,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,oBAAoB,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5D,sBAAsB,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAC7E,sBAAsB,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;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M,MAAM,cAAc,GAAG,SAAS,CAEpC,QAAQ,CACN,IAAI,CAAC,cAAc,GAAG,UAAU,EAAE,gBAAgB,GAAG,gBAAgB,GAAG,sBAAsB,CAAC,CAChG,CACF,CAAC;AAEF,OAAO,QAAQ,WAAW,CAAC;IACzB,UAAU,yBACR,SAAQ,gBAAgB,EACtB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,iBAAiB;KAAG;CACzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,OAAO,CAAC,yBAAyB,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAElF"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- /**
3
- * @module
4
- * @privateRemarks These mixins are kind of a mishmash of stuff from `appium-android-driver`,
5
- * @privateRemarks unique things, and stuff from `ExternalDriver`. Ideally, we should be pulling the method
6
- * @privateRemarks definitions right out of `ExternalDriver` whenever possible. Also note that the mixins
7
- * @privateRemarks contain _more stuff than just commands or execute methods_.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.mixin = void 0;
11
- const driver_1 = require("../driver");
12
- /**
13
- * This function assigns a mixin `T` to the `AndroidUiautomator2Driver` class' prototype.
14
- *
15
- * While each mixin has its own interface which is (in isolation) unrelated to
16
- * `AndroidUiautomator2Driver`, the constraint on this generic type `T` is that it must be a
17
- * partial of `AndroidUiautomator2Driver`'s interface. This enforces that it does not
18
- * conflict with the existing interface of `AndroidUiautomator2Driver`. In that way, you
19
- * can think of it as a type guard.
20
- * @param mixin Mixin implementation
21
- */
22
- function mixin(mixin) {
23
- Object.assign(driver_1.AndroidUiautomator2Driver.prototype, mixin);
24
- }
25
- exports.mixin = mixin;
26
- //# sourceMappingURL=mixins.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mixins.js","sourceRoot":"","sources":["../../../lib/commands/mixins.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAcH,sCAAoD;AAwIpD;;;;;;;;;GASG;AACH,SAAgB,KAAK,CAA+C,KAAQ;IAC1E,MAAM,CAAC,MAAM,CAAC,kCAAyB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAC5D,CAAC;AAFD,sBAEC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Assert the presence of particular keys in the given object
3
- *
4
- * @template {Record<string, any>} T
5
- * @param {string|string[]} argNames one or more key names
6
- * @param {T} opts the object to check
7
- * @returns {T} the same given object
8
- */
9
- export function requireArgs<T extends Record<string, any>>(argNames: string | string[], opts: T): T;
10
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,qEAJW,MAAM,GAAC,MAAM,EAAE,cAWzB"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.requireArgs = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
- const driver_1 = require("appium/driver");
9
- /**
10
- * Assert the presence of particular keys in the given object
11
- *
12
- * @template {Record<string, any>} T
13
- * @param {string|string[]} argNames one or more key names
14
- * @param {T} opts the object to check
15
- * @returns {T} the same given object
16
- */
17
- function requireArgs(argNames, opts) {
18
- for (const argName of (lodash_1.default.isArray(argNames) ? argNames : [argNames])) {
19
- if (!lodash_1.default.has(opts, argName)) {
20
- throw new driver_1.errors.InvalidArgumentError(`'${argName}' argument must be provided`);
21
- }
22
- }
23
- return opts;
24
- }
25
- exports.requireArgs = requireArgs;
26
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/utils.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,0CAAuC;AAEvC;;;;;;;GAOG;AACH,SAAgB,WAAW,CAAE,QAAQ,EAAE,IAAI;IACzC,KAAK,MAAM,OAAO,IAAI,CAAC,gBAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE;QACnE,IAAI,CAAC,gBAAC,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE;YACzB,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,IAAI,OAAO,6BAA6B,CAAC,CAAC;SACjF;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAPD,kCAOC"}