appium-mac2-driver 4.3.5 → 4.4.0

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 (372) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/WebDriverAgentMac/IntegrationTests/AMSessionTests.m +14 -0
  3. package/WebDriverAgentMac/WebDriverAgentLib/Commands/FBSessionCommands.m +17 -5
  4. package/WebDriverAgentMac/WebDriverAgentLib/Routing/FBSession.m +5 -1
  5. package/WebDriverAgentMac/WebDriverAgentLib/Utilities/FBXPath.m +48 -2
  6. package/WebDriverAgentMac/WebDriverAgentMac.xcodeproj/project.pbxproj +4 -0
  7. package/build/lib/driver.d.ts +3 -0
  8. package/build/lib/driver.d.ts.map +1 -1
  9. package/build/lib/driver.js +52 -32
  10. package/build/lib/driver.js.map +1 -1
  11. package/build/lib/session-claim-handler.d.ts +41 -0
  12. package/build/lib/session-claim-handler.d.ts.map +1 -0
  13. package/build/lib/session-claim-handler.js +236 -0
  14. package/build/lib/session-claim-handler.js.map +1 -0
  15. package/build/lib/wda-mac.d.ts +6 -2
  16. package/build/lib/wda-mac.d.ts.map +1 -1
  17. package/build/lib/wda-mac.js +43 -14
  18. package/build/lib/wda-mac.js.map +1 -1
  19. package/lib/driver.ts +55 -31
  20. package/lib/session-claim-handler.ts +306 -0
  21. package/lib/wda-mac.ts +45 -15
  22. package/node_modules/@appium/logger/CHANGELOG.md +8 -0
  23. package/node_modules/@appium/logger/package.json +3 -3
  24. package/node_modules/@appium/strongbox/build/lib/index.d.ts.map +1 -1
  25. package/node_modules/@appium/strongbox/build/lib/index.js +6 -1
  26. package/node_modules/@appium/strongbox/build/lib/index.js.map +1 -1
  27. package/node_modules/@appium/strongbox/lib/index.ts +6 -1
  28. package/node_modules/@appium/strongbox/package.json +2 -2
  29. package/node_modules/@appium/support/build/lib/fs.d.ts.map +1 -1
  30. package/node_modules/@appium/support/build/lib/fs.js +7 -0
  31. package/node_modules/@appium/support/build/lib/fs.js.map +1 -1
  32. package/node_modules/@appium/support/build/lib/index.d.ts.map +1 -1
  33. package/node_modules/@appium/support/build/lib/net.d.ts.map +1 -1
  34. package/node_modules/@appium/support/build/lib/net.js +6 -2
  35. package/node_modules/@appium/support/build/lib/net.js.map +1 -1
  36. package/node_modules/@appium/support/build/lib/util.d.ts.map +1 -1
  37. package/node_modules/@appium/support/build/lib/util.js +10 -4
  38. package/node_modules/@appium/support/build/lib/util.js.map +1 -1
  39. package/node_modules/@appium/support/build/lib/zip.d.ts.map +1 -1
  40. package/node_modules/@appium/support/build/lib/zip.js +2 -7
  41. package/node_modules/@appium/support/build/lib/zip.js.map +1 -1
  42. package/node_modules/@appium/support/lib/fs.ts +8 -1
  43. package/node_modules/@appium/support/lib/net.ts +7 -2
  44. package/node_modules/@appium/support/lib/util.ts +9 -3
  45. package/node_modules/@appium/support/lib/zip.ts +3 -9
  46. package/node_modules/@appium/support/package.json +9 -9
  47. package/node_modules/@appium/types/package.json +4 -4
  48. package/node_modules/@img/sharp-darwin-arm64/index.cjs +1 -1
  49. package/node_modules/@img/sharp-darwin-arm64/lib/sharp-darwin-arm64-0.35.5.node +0 -0
  50. package/node_modules/@img/sharp-darwin-arm64/package.json +2 -2
  51. package/node_modules/@img/sharp-libvips-darwin-arm64/README.md +1 -1
  52. package/node_modules/@img/sharp-libvips-darwin-arm64/lib/glib-2.0/include/glibconfig.h +2 -2
  53. package/node_modules/@img/sharp-libvips-darwin-arm64/lib/{libvips-cpp.8.18.6.dylib → libvips-cpp.8.18.7.dylib} +0 -0
  54. package/node_modules/@img/sharp-libvips-darwin-arm64/package.json +2 -2
  55. package/node_modules/@img/sharp-libvips-darwin-arm64/versions.json +11 -11
  56. package/node_modules/appium-xcode/CHANGELOG.md +35 -0
  57. package/node_modules/appium-xcode/README.md +1 -1
  58. package/node_modules/appium-xcode/package.json +14 -18
  59. package/node_modules/async-lock/AUTHORS +21 -0
  60. package/node_modules/async-lock/History.md +132 -0
  61. package/node_modules/async-lock/LICENSE +22 -0
  62. package/node_modules/async-lock/README.md +177 -0
  63. package/node_modules/async-lock/index.js +2 -0
  64. package/node_modules/async-lock/lib/index.js +312 -0
  65. package/node_modules/async-lock/package.json +48 -0
  66. package/node_modules/b4a/browser.js +5 -0
  67. package/node_modules/b4a/index.d.ts +144 -0
  68. package/node_modules/b4a/index.js +5 -0
  69. package/node_modules/b4a/package.json +4 -1
  70. package/node_modules/b4a/runtime.d.ts +14 -0
  71. package/node_modules/bare-fs/binding.c +52 -23
  72. package/node_modules/bare-fs/index.d.ts +12 -10
  73. package/node_modules/bare-fs/index.js +43 -10
  74. package/node_modules/bare-fs/package.json +2 -1
  75. package/node_modules/bare-fs/prebuilds/android-arm/bare-fs.bare +0 -0
  76. package/node_modules/bare-fs/prebuilds/android-arm64/bare-fs.bare +0 -0
  77. package/node_modules/bare-fs/prebuilds/android-ia32/bare-fs.bare +0 -0
  78. package/node_modules/bare-fs/prebuilds/android-x64/bare-fs.bare +0 -0
  79. package/node_modules/bare-fs/prebuilds/darwin-arm64/bare-fs.bare +0 -0
  80. package/node_modules/bare-fs/prebuilds/darwin-x64/bare-fs.bare +0 -0
  81. package/node_modules/bare-fs/prebuilds/ios-arm64/bare-fs.bare +0 -0
  82. package/node_modules/bare-fs/prebuilds/ios-arm64-simulator/bare-fs.bare +0 -0
  83. package/node_modules/bare-fs/prebuilds/ios-x64-simulator/bare-fs.bare +0 -0
  84. package/node_modules/bare-fs/prebuilds/linux-arm64/bare-fs.bare +0 -0
  85. package/node_modules/bare-fs/prebuilds/linux-x64/bare-fs.bare +0 -0
  86. package/node_modules/bare-fs/prebuilds/win32-arm64/bare-fs.bare +0 -0
  87. package/node_modules/bare-fs/prebuilds/win32-x64/bare-fs.bare +0 -0
  88. package/node_modules/bplist-creator/README.md +26 -6
  89. package/node_modules/bplist-creator/dist/index.cjs +508 -0
  90. package/node_modules/bplist-creator/dist/index.cjs.map +7 -0
  91. package/node_modules/bplist-creator/dist/index.d.cts +12 -0
  92. package/node_modules/bplist-creator/dist/index.d.ts +12 -0
  93. package/node_modules/bplist-creator/dist/index.mjs +472 -0
  94. package/node_modules/bplist-creator/dist/index.mjs.map +7 -0
  95. package/node_modules/bplist-creator/package.json +43 -9
  96. package/node_modules/bplist-parser/README.md +37 -3
  97. package/node_modules/bplist-parser/dist/index.cjs +385 -0
  98. package/node_modules/bplist-parser/dist/index.cjs.map +7 -0
  99. package/node_modules/bplist-parser/dist/index.d.cts +13 -0
  100. package/node_modules/bplist-parser/dist/index.d.ts +13 -0
  101. package/node_modules/bplist-parser/{bplistParser.js → dist/index.mjs} +141 -171
  102. package/node_modules/bplist-parser/dist/index.mjs.map +7 -0
  103. package/node_modules/bplist-parser/package.json +39 -12
  104. package/node_modules/brace-expansion/dist/commonjs/index.d.ts +4 -0
  105. package/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -1
  106. package/node_modules/brace-expansion/dist/commonjs/index.js +69 -25
  107. package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
  108. package/node_modules/brace-expansion/dist/esm/index.d.ts +4 -0
  109. package/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -1
  110. package/node_modules/brace-expansion/dist/esm/index.js +68 -24
  111. package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
  112. package/node_modules/brace-expansion/package.json +2 -1
  113. package/node_modules/follow-redirects/index.js +10 -1
  114. package/node_modules/follow-redirects/package.json +1 -1
  115. package/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel-react-native.d.ts.map +1 -0
  116. package/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel-react-native.js.map +1 -0
  117. package/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel.d.ts +5 -0
  118. package/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel.js +7 -0
  119. package/node_modules/lru-cache/dist/commonjs/react-native/index.d.ts +1400 -0
  120. package/node_modules/lru-cache/dist/commonjs/react-native/index.d.ts.map +1 -0
  121. package/node_modules/lru-cache/dist/commonjs/react-native/index.js +1733 -0
  122. package/node_modules/lru-cache/dist/commonjs/react-native/index.js.map +1 -0
  123. package/node_modules/lru-cache/dist/commonjs/react-native/perf.d.ts +12 -0
  124. package/node_modules/lru-cache/dist/commonjs/react-native/perf.d.ts.map +1 -0
  125. package/node_modules/lru-cache/dist/commonjs/react-native/perf.js +10 -0
  126. package/node_modules/lru-cache/dist/commonjs/react-native/perf.js.map +1 -0
  127. package/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel-react-native.d.ts.map +1 -0
  128. package/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel-react-native.js.map +1 -0
  129. package/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel.d.ts +5 -0
  130. package/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel.js +4 -0
  131. package/node_modules/lru-cache/dist/esm/react-native/index.d.ts +1400 -0
  132. package/node_modules/lru-cache/dist/esm/react-native/index.d.ts.map +1 -0
  133. package/node_modules/lru-cache/dist/esm/react-native/index.js +1729 -0
  134. package/node_modules/lru-cache/dist/esm/react-native/index.js.map +1 -0
  135. package/node_modules/lru-cache/dist/esm/react-native/perf.d.ts +12 -0
  136. package/node_modules/lru-cache/dist/esm/react-native/perf.d.ts.map +1 -0
  137. package/node_modules/lru-cache/dist/esm/react-native/perf.js +7 -0
  138. package/node_modules/lru-cache/dist/esm/react-native/perf.js.map +1 -0
  139. package/node_modules/lru-cache/package.json +27 -1
  140. package/node_modules/p-limit/index.d.ts +2 -0
  141. package/node_modules/p-limit/index.js +17 -1
  142. package/node_modules/p-limit/package.json +1 -1
  143. package/node_modules/p-limit/readme.md +2 -0
  144. package/node_modules/readable-stream/lib/internal/shims/process.js +19 -0
  145. package/node_modules/readable-stream/lib/internal/streams/destroy.js +1 -1
  146. package/node_modules/readable-stream/lib/internal/streams/duplexify.js +1 -1
  147. package/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +1 -1
  148. package/node_modules/readable-stream/lib/internal/streams/from.js +1 -1
  149. package/node_modules/readable-stream/lib/internal/streams/legacy.js +6 -1
  150. package/node_modules/readable-stream/lib/internal/streams/pipeline.js +1 -1
  151. package/node_modules/readable-stream/lib/internal/streams/readable.js +1 -1
  152. package/node_modules/readable-stream/lib/internal/streams/writable.js +1 -1
  153. package/node_modules/readable-stream/package.json +3 -2
  154. package/node_modules/sharp/dist/index.d.cts +2 -2
  155. package/node_modules/sharp/dist/index.d.mts +3 -3
  156. package/node_modules/sharp/dist/is.cjs +8 -2
  157. package/node_modules/sharp/dist/is.mjs +8 -2
  158. package/node_modules/sharp/dist/operation.cjs +2 -2
  159. package/node_modules/sharp/dist/operation.mjs +2 -2
  160. package/node_modules/sharp/dist/output.cjs +1 -0
  161. package/node_modules/sharp/dist/output.mjs +1 -0
  162. package/node_modules/sharp/dist/resize.cjs +14 -14
  163. package/node_modules/sharp/dist/resize.mjs +14 -14
  164. package/node_modules/sharp/dist/sharp.cjs +3 -3
  165. package/node_modules/sharp/dist/sharp.mjs +3 -3
  166. package/node_modules/sharp/lib/index.d.ts +2 -2
  167. package/node_modules/sharp/package.json +35 -35
  168. package/node_modules/sharp/src/binding.gyp +1 -1
  169. package/node_modules/sharp/src/common.cc +4 -4
  170. package/node_modules/sharp/src/common.h +2 -2
  171. package/node_modules/sharp/src/pipeline.cc +31 -6
  172. package/node_modules/sharp/src/utilities.cc +1 -1
  173. package/node_modules/spdx-license-ids/index.json +13 -0
  174. package/node_modules/spdx-license-ids/package.json +1 -1
  175. package/node_modules/stream-buffers/.codeclimate.yml +12 -0
  176. package/node_modules/stream-buffers/.eslintignore +1 -0
  177. package/node_modules/stream-buffers/.eslintrc +25 -0
  178. package/node_modules/stream-buffers/.github/workflows/codeql-analysis.yml +71 -0
  179. package/node_modules/stream-buffers/.github/workflows/node.js.yml +31 -0
  180. package/node_modules/stream-buffers/.mailmap +1 -0
  181. package/node_modules/stream-buffers/.nvmrc +1 -0
  182. package/node_modules/stream-buffers/README.md +65 -65
  183. package/node_modules/stream-buffers/lib/constants.js +8 -6
  184. package/node_modules/stream-buffers/lib/readable_streambuffer.js +114 -136
  185. package/node_modules/stream-buffers/lib/streambuffer.js +5 -3
  186. package/node_modules/stream-buffers/lib/writable_streambuffer.js +72 -97
  187. package/node_modules/stream-buffers/package.json +7 -5
  188. package/node_modules/tar-stream/package.json +7 -7
  189. package/node_modules/type-fest/index.d.ts +7 -7
  190. package/node_modules/type-fest/package.json +2 -1
  191. package/node_modules/type-fest/readme.md +7 -16
  192. package/node_modules/type-fest/source/all-extend.d.ts +9 -7
  193. package/node_modules/type-fest/source/array-reverse.d.ts +13 -12
  194. package/node_modules/type-fest/source/array-tail.d.ts +3 -3
  195. package/node_modules/type-fest/source/delimiter-case.d.ts +1 -1
  196. package/node_modules/type-fest/source/get.d.ts +1 -1
  197. package/node_modules/type-fest/source/int-closed-range.d.ts +4 -1
  198. package/node_modules/type-fest/source/int-range.d.ts +56 -9
  199. package/node_modules/type-fest/source/internal/array.d.ts +14 -13
  200. package/node_modules/type-fest/source/internal/numeric.d.ts +0 -38
  201. package/node_modules/type-fest/source/internal/object.d.ts +30 -1
  202. package/node_modules/type-fest/source/is-boolean-literal.d.ts +39 -0
  203. package/node_modules/type-fest/source/is-literal.d.ts +43 -269
  204. package/node_modules/type-fest/source/is-numeric-literal.d.ts +50 -0
  205. package/node_modules/type-fest/source/is-string-literal.d.ts +72 -0
  206. package/node_modules/type-fest/source/is-symbol-literal.d.ts +39 -0
  207. package/node_modules/type-fest/source/is-tuple.d.ts +3 -3
  208. package/node_modules/type-fest/source/jsonify.d.ts +1 -5
  209. package/node_modules/type-fest/source/merge-deep.d.ts +3 -3
  210. package/node_modules/type-fest/source/remove-prefix.d.ts +1 -1
  211. package/node_modules/type-fest/source/remove-suffix.d.ts +1 -1
  212. package/node_modules/type-fest/source/rename-keys.d.ts +163 -0
  213. package/node_modules/type-fest/source/set-required.d.ts +10 -9
  214. package/node_modules/type-fest/source/shared-union-fields-deep.d.ts +6 -4
  215. package/node_modules/type-fest/source/some-extend.d.ts +9 -7
  216. package/node_modules/type-fest/source/split-on-rest-element.d.ts +14 -13
  217. package/node_modules/type-fest/source/split.d.ts +22 -11
  218. package/node_modules/type-fest/source/string-repeat.d.ts +1 -1
  219. package/node_modules/type-fest/source/string-to-array.d.ts +1 -1
  220. package/node_modules/type-fest/source/tsconfig-json.d.ts +1 -1
  221. package/node_modules/type-fest/source/typed-array.d.ts +6 -0
  222. package/node_modules/type-fest/source/union-max.d.ts +56 -0
  223. package/node_modules/type-fest/source/writable.d.ts +2 -2
  224. package/package.json +5 -3
  225. package/node_modules/@appium/support/node_modules/asyncbox/LICENSE +0 -203
  226. package/node_modules/@appium/support/node_modules/asyncbox/README.md +0 -215
  227. package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/asyncbox.d.ts +0 -103
  228. package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/asyncbox.d.ts.map +0 -1
  229. package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/asyncbox.js +0 -301
  230. package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/asyncbox.js.map +0 -1
  231. package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/types.d.ts +0 -84
  232. package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/types.d.ts.map +0 -1
  233. package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/types.js +0 -3
  234. package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/lib/types.js.map +0 -1
  235. package/node_modules/@appium/support/node_modules/asyncbox/build/cjs/package.json +0 -3
  236. package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/asyncbox.d.ts +0 -103
  237. package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/asyncbox.d.ts.map +0 -1
  238. package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/asyncbox.js +0 -288
  239. package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/asyncbox.js.map +0 -1
  240. package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/types.d.ts +0 -84
  241. package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/types.d.ts.map +0 -1
  242. package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/types.js +0 -2
  243. package/node_modules/@appium/support/node_modules/asyncbox/build/esm/lib/types.js.map +0 -1
  244. package/node_modules/@appium/support/node_modules/asyncbox/build/esm/package.json +0 -3
  245. package/node_modules/@appium/support/node_modules/asyncbox/lib/asyncbox.ts +0 -365
  246. package/node_modules/@appium/support/node_modules/asyncbox/lib/types.ts +0 -88
  247. package/node_modules/@appium/support/node_modules/asyncbox/package.json +0 -74
  248. package/node_modules/@appium/support/node_modules/axios/CHANGELOG.md +0 -1872
  249. package/node_modules/@appium/support/node_modules/axios/LICENSE +0 -7
  250. package/node_modules/@appium/support/node_modules/axios/MIGRATION_GUIDE.md +0 -877
  251. package/node_modules/@appium/support/node_modules/axios/README.md +0 -2623
  252. package/node_modules/@appium/support/node_modules/axios/dist/axios.js +0 -5509
  253. package/node_modules/@appium/support/node_modules/axios/dist/axios.min.js +0 -5
  254. package/node_modules/@appium/support/node_modules/axios/dist/axios.min.js.map +0 -1
  255. package/node_modules/@appium/support/node_modules/axios/dist/browser/axios.cjs +0 -5469
  256. package/node_modules/@appium/support/node_modules/axios/dist/esm/axios.js +0 -5490
  257. package/node_modules/@appium/support/node_modules/axios/dist/esm/axios.min.js +0 -3
  258. package/node_modules/@appium/support/node_modules/axios/dist/esm/axios.min.js.map +0 -1
  259. package/node_modules/@appium/support/node_modules/axios/dist/node/axios.cjs +0 -6356
  260. package/node_modules/@appium/support/node_modules/axios/index.d.cts +0 -762
  261. package/node_modules/@appium/support/node_modules/axios/index.d.ts +0 -783
  262. package/node_modules/@appium/support/node_modules/axios/index.js +0 -45
  263. package/node_modules/@appium/support/node_modules/axios/lib/adapters/README.md +0 -36
  264. package/node_modules/@appium/support/node_modules/axios/lib/adapters/adapters.js +0 -132
  265. package/node_modules/@appium/support/node_modules/axios/lib/adapters/fetch.js +0 -643
  266. package/node_modules/@appium/support/node_modules/axios/lib/adapters/http.js +0 -1406
  267. package/node_modules/@appium/support/node_modules/axios/lib/adapters/xhr.js +0 -228
  268. package/node_modules/@appium/support/node_modules/axios/lib/axios.js +0 -89
  269. package/node_modules/@appium/support/node_modules/axios/lib/cancel/CancelToken.js +0 -135
  270. package/node_modules/@appium/support/node_modules/axios/lib/cancel/CanceledError.js +0 -22
  271. package/node_modules/@appium/support/node_modules/axios/lib/cancel/isCancel.js +0 -5
  272. package/node_modules/@appium/support/node_modules/axios/lib/core/Axios.js +0 -301
  273. package/node_modules/@appium/support/node_modules/axios/lib/core/AxiosError.js +0 -219
  274. package/node_modules/@appium/support/node_modules/axios/lib/core/AxiosHeaders.js +0 -474
  275. package/node_modules/@appium/support/node_modules/axios/lib/core/InterceptorManager.js +0 -72
  276. package/node_modules/@appium/support/node_modules/axios/lib/core/README.md +0 -8
  277. package/node_modules/@appium/support/node_modules/axios/lib/core/buildFullPath.js +0 -88
  278. package/node_modules/@appium/support/node_modules/axios/lib/core/dispatchRequest.js +0 -89
  279. package/node_modules/@appium/support/node_modules/axios/lib/core/mergeConfig.js +0 -174
  280. package/node_modules/@appium/support/node_modules/axios/lib/core/setFormDataHeaders.js +0 -27
  281. package/node_modules/@appium/support/node_modules/axios/lib/core/settle.js +0 -27
  282. package/node_modules/@appium/support/node_modules/axios/lib/core/transformData.js +0 -28
  283. package/node_modules/@appium/support/node_modules/axios/lib/defaults/index.js +0 -177
  284. package/node_modules/@appium/support/node_modules/axios/lib/defaults/transitional.js +0 -10
  285. package/node_modules/@appium/support/node_modules/axios/lib/env/README.md +0 -3
  286. package/node_modules/@appium/support/node_modules/axios/lib/env/classes/FormData.js +0 -2
  287. package/node_modules/@appium/support/node_modules/axios/lib/env/data.js +0 -1
  288. package/node_modules/@appium/support/node_modules/axios/lib/helpers/AxiosTransformStream.js +0 -156
  289. package/node_modules/@appium/support/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -59
  290. package/node_modules/@appium/support/node_modules/axios/lib/helpers/Http2Sessions.js +0 -119
  291. package/node_modules/@appium/support/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -78
  292. package/node_modules/@appium/support/node_modules/axios/lib/helpers/README.md +0 -7
  293. package/node_modules/@appium/support/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +0 -29
  294. package/node_modules/@appium/support/node_modules/axios/lib/helpers/bind.js +0 -14
  295. package/node_modules/@appium/support/node_modules/axios/lib/helpers/buildURL.js +0 -69
  296. package/node_modules/@appium/support/node_modules/axios/lib/helpers/callbackify.js +0 -18
  297. package/node_modules/@appium/support/node_modules/axios/lib/helpers/combineURLs.js +0 -23
  298. package/node_modules/@appium/support/node_modules/axios/lib/helpers/composeSignals.js +0 -68
  299. package/node_modules/@appium/support/node_modules/axios/lib/helpers/cookies.js +0 -64
  300. package/node_modules/@appium/support/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -31
  301. package/node_modules/@appium/support/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +0 -166
  302. package/node_modules/@appium/support/node_modules/axios/lib/helpers/formDataToJSON.js +0 -125
  303. package/node_modules/@appium/support/node_modules/axios/lib/helpers/formDataToStream.js +0 -119
  304. package/node_modules/@appium/support/node_modules/axios/lib/helpers/fromDataURI.js +0 -68
  305. package/node_modules/@appium/support/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -19
  306. package/node_modules/@appium/support/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
  307. package/node_modules/@appium/support/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -16
  308. package/node_modules/@appium/support/node_modules/axios/lib/helpers/null.js +0 -2
  309. package/node_modules/@appium/support/node_modules/axios/lib/helpers/parseHeaders.js +0 -71
  310. package/node_modules/@appium/support/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
  311. package/node_modules/@appium/support/node_modules/axios/lib/helpers/progressEventReducer.js +0 -54
  312. package/node_modules/@appium/support/node_modules/axios/lib/helpers/readBlob.js +0 -15
  313. package/node_modules/@appium/support/node_modules/axios/lib/helpers/resolveConfig.js +0 -105
  314. package/node_modules/@appium/support/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +0 -60
  315. package/node_modules/@appium/support/node_modules/axios/lib/helpers/shouldBypassProxy.js +0 -329
  316. package/node_modules/@appium/support/node_modules/axios/lib/helpers/speedometer.js +0 -55
  317. package/node_modules/@appium/support/node_modules/axios/lib/helpers/spread.js +0 -28
  318. package/node_modules/@appium/support/node_modules/axios/lib/helpers/throttle.js +0 -44
  319. package/node_modules/@appium/support/node_modules/axios/lib/helpers/toFormData.js +0 -286
  320. package/node_modules/@appium/support/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -19
  321. package/node_modules/@appium/support/node_modules/axios/lib/helpers/trackStream.js +0 -89
  322. package/node_modules/@appium/support/node_modules/axios/lib/helpers/validator.js +0 -112
  323. package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -3
  324. package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -3
  325. package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -4
  326. package/node_modules/@appium/support/node_modules/axios/lib/platform/browser/index.js +0 -13
  327. package/node_modules/@appium/support/node_modules/axios/lib/platform/common/utils.js +0 -52
  328. package/node_modules/@appium/support/node_modules/axios/lib/platform/index.js +0 -7
  329. package/node_modules/@appium/support/node_modules/axios/lib/platform/node/classes/Buffer.js +0 -11
  330. package/node_modules/@appium/support/node_modules/axios/lib/platform/node/classes/FormData.js +0 -3
  331. package/node_modules/@appium/support/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +0 -4
  332. package/node_modules/@appium/support/node_modules/axios/lib/platform/node/index.js +0 -37
  333. package/node_modules/@appium/support/node_modules/axios/lib/utils.js +0 -1029
  334. package/node_modules/@appium/support/node_modules/axios/package.json +0 -203
  335. package/node_modules/@img/sharp-darwin-arm64/lib/sharp-darwin-arm64-0.35.4.node +0 -0
  336. package/node_modules/big-integer/BigInteger.d.ts +0 -2393
  337. package/node_modules/big-integer/BigInteger.js +0 -1453
  338. package/node_modules/big-integer/BigInteger.min.js +0 -1
  339. package/node_modules/big-integer/LICENSE +0 -24
  340. package/node_modules/big-integer/README.md +0 -589
  341. package/node_modules/big-integer/bower.json +0 -29
  342. package/node_modules/big-integer/package.json +0 -48
  343. package/node_modules/big-integer/tsconfig.json +0 -24
  344. package/node_modules/bplist-creator/bplistCreator.d.ts +0 -8
  345. package/node_modules/bplist-creator/bplistCreator.js +0 -460
  346. package/node_modules/bplist-creator/test/airplay.bplist +0 -0
  347. package/node_modules/bplist-creator/test/binaryData.bplist +0 -0
  348. package/node_modules/bplist-creator/test/creatorTest.js +0 -211
  349. package/node_modules/bplist-creator/test/iTunes-small.bplist +0 -0
  350. package/node_modules/bplist-creator/test/integers.bplist +0 -0
  351. package/node_modules/bplist-creator/test/sample1.bplist +0 -0
  352. package/node_modules/bplist-creator/test/sample2.bplist +0 -0
  353. package/node_modules/bplist-creator/test/uid.bplist +0 -0
  354. package/node_modules/bplist-creator/test/utf16.bplist +0 -0
  355. package/node_modules/bplist-parser/.editorconfig +0 -12
  356. package/node_modules/bplist-parser/.eslintignore +0 -1
  357. package/node_modules/bplist-parser/.eslintrc.js +0 -296
  358. package/node_modules/bplist-parser/bplistParser.d.ts +0 -8
  359. package/node_modules/stream-buffers/.travis.yml +0 -28
  360. package/node_modules/stream-buffers/coverage/coverage.json +0 -1
  361. package/node_modules/stream-buffers/coverage/lcov-report/base.css +0 -182
  362. package/node_modules/stream-buffers/coverage/lcov-report/index.html +0 -73
  363. package/node_modules/stream-buffers/coverage/lcov-report/lib/constants.js.html +0 -63
  364. package/node_modules/stream-buffers/coverage/lcov-report/lib/index.html +0 -112
  365. package/node_modules/stream-buffers/coverage/lcov-report/lib/readable_streambuffer.js.html +0 -453
  366. package/node_modules/stream-buffers/coverage/lcov-report/lib/streambuffer.js.html +0 -54
  367. package/node_modules/stream-buffers/coverage/lcov-report/lib/writable_streambuffer.js.html +0 -336
  368. package/node_modules/stream-buffers/coverage/lcov-report/prettify.css +0 -1
  369. package/node_modules/stream-buffers/coverage/lcov-report/prettify.js +0 -1
  370. package/node_modules/stream-buffers/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  371. package/node_modules/stream-buffers/coverage/lcov-report/sorter.js +0 -156
  372. package/node_modules/stream-buffers/coverage/lcov.info +0 -305
@@ -0,0 +1,236 @@
1
+ import { setTimeout as delay } from 'node:timers/promises';
2
+ import { errors } from 'appium/driver.js';
3
+ import { node, util } from 'appium/support.js';
4
+ import AsyncLock from 'async-lock';
5
+ import { waitForCondition } from 'asyncbox';
6
+ /** Lets a new session make the previous one quit, over a driver-wide IPC (per-session IPCs are isolated). */
7
+ export class SessionClaimHandler {
8
+ getIpc;
9
+ releaseWaitMs;
10
+ static CLAIMED_TOPIC = 'mac2:sessionClaimed';
11
+ static CONTENDED_TOPIC = 'mac2:sessionContended';
12
+ static RELEASED_TOPIC = 'mac2:sessionReleased';
13
+ static STARTUP_LOCK_KEY = 'mac2:sessionStartup';
14
+ static CONTENTION_PROBE_MS = 10;
15
+ static DEFAULT_RELEASE_WAIT_MS = 15000;
16
+ startupLock = new AsyncLock();
17
+ pendingTeardowns = new Set();
18
+ subscriptionsBySessionId = new Map();
19
+ constructor(getIpc, releaseWaitMs = SessionClaimHandler.DEFAULT_RELEASE_WAIT_MS) {
20
+ this.getIpc = getIpc;
21
+ this.releaseWaitMs = releaseWaitMs;
22
+ }
23
+ /** Serializes session startups so the newest wins. Enter before registering the session. */
24
+ async runExclusive(fn) {
25
+ return await this.startupLock.acquire(SessionClaimHandler.STARTUP_LOCK_KEY, fn);
26
+ }
27
+ /** Subscribe the session to claim messages from newer sessions. */
28
+ async registerActiveSession(driver) {
29
+ const ipc = await this.getIpc();
30
+ const sessionId = driver.sessionId;
31
+ if (!ipc || !sessionId) {
32
+ return;
33
+ }
34
+ this.unregisterActiveSession(driver);
35
+ const subscription = ipc.subscribe(SessionClaimHandler.CLAIMED_TOPIC, this.getPublisherId(driver));
36
+ subscription.on('message', (message) => {
37
+ void this.dispatchClaimMessage(driver, sessionId, message);
38
+ });
39
+ this.subscriptionsBySessionId.set(sessionId, subscription);
40
+ }
41
+ /** Unsubscribe the session from claim messages. */
42
+ unregisterActiveSession(driver) {
43
+ const sessionId = driver.sessionId;
44
+ if (!sessionId) {
45
+ return;
46
+ }
47
+ this.subscriptionsBySessionId.get(sessionId)?.unsubscribe();
48
+ this.subscriptionsBySessionId.delete(sessionId);
49
+ }
50
+ /** Tracks a session teardown, so that a new session does not start before it is complete. */
51
+ async trackTeardown(teardown) {
52
+ const promise = teardown();
53
+ const tracked = (async () => {
54
+ try {
55
+ await promise;
56
+ }
57
+ catch {
58
+ // the failure is reported to the caller of trackTeardown()
59
+ }
60
+ })();
61
+ this.pendingTeardowns.add(tracked);
62
+ try {
63
+ await promise;
64
+ }
65
+ finally {
66
+ this.pendingTeardowns.delete(tracked);
67
+ }
68
+ }
69
+ /** Make any other active session quit and wait until it has released the host. */
70
+ async claimHost(driver) {
71
+ await this.requestRelease(driver);
72
+ await this.waitForPendingTeardowns(driver);
73
+ }
74
+ async waitForPendingTeardowns(driver) {
75
+ if (this.pendingTeardowns.size === 0) {
76
+ return;
77
+ }
78
+ driver.log.debug(`Waiting for ${util.pluralize('session', this.pendingTeardowns.size, true)} to finish quitting`);
79
+ const timer = new AbortController();
80
+ const timedOut = Symbol('timedOut');
81
+ const timeout = (async () => {
82
+ try {
83
+ return await delay(this.releaseWaitMs, timedOut, { signal: timer.signal });
84
+ }
85
+ catch {
86
+ return undefined; // aborted
87
+ }
88
+ })();
89
+ try {
90
+ if ((await Promise.race([Promise.all(this.pendingTeardowns), timeout])) === timedOut) {
91
+ // Starting now could let the old teardown (e.g. postrun) interfere with this session
92
+ throw new errors.SessionNotCreatedError(`The previous session did not finish quitting within ${this.releaseWaitMs}ms`);
93
+ }
94
+ }
95
+ finally {
96
+ timer.abort();
97
+ }
98
+ }
99
+ async requestRelease(driver) {
100
+ const ipc = await this.getIpc();
101
+ if (!ipc) {
102
+ driver.log.debug('Driver-instance IPC is unavailable. Skipping the session claim.');
103
+ return;
104
+ }
105
+ const sessionId = driver.sessionId;
106
+ if (!sessionId) {
107
+ return;
108
+ }
109
+ const contendingSessionIds = new Set();
110
+ const releasedSessionIds = new Set();
111
+ const subscriptions = [];
112
+ try {
113
+ const contendedSubscription = ipc.subscribe(SessionClaimHandler.CONTENDED_TOPIC, this.getPublisherId(driver));
114
+ subscriptions.push(contendedSubscription);
115
+ const releasedSubscription = ipc.subscribe(SessionClaimHandler.RELEASED_TOPIC, this.getPublisherId(driver));
116
+ subscriptions.push(releasedSubscription);
117
+ contendedSubscription.on('message', (message) => {
118
+ if (message.data.sessionId !== sessionId) {
119
+ contendingSessionIds.add(message.data.sessionId);
120
+ }
121
+ });
122
+ releasedSubscription.on('message', (message) => {
123
+ if (message.data.sessionId !== sessionId) {
124
+ releasedSessionIds.add(message.data.sessionId);
125
+ }
126
+ });
127
+ await ipc.publish(SessionClaimHandler.CLAIMED_TOPIC, this.getPublisherId(driver), {
128
+ sessionId,
129
+ });
130
+ // Older sessions reply synchronously to the claim, so a short wait is enough to learn about them
131
+ await delay(SessionClaimHandler.CONTENTION_PROBE_MS);
132
+ if (contendingSessionIds.size === 0) {
133
+ return;
134
+ }
135
+ try {
136
+ await waitForCondition(() => [...contendingSessionIds].every((id) => releasedSessionIds.has(id)), {
137
+ waitMs: this.releaseWaitMs,
138
+ intervalMs: 50,
139
+ });
140
+ driver.log.debug(`Received release confirmation from ${util.pluralize('session', contendingSessionIds.size, true)}`);
141
+ }
142
+ catch {
143
+ const pendingSessionIds = [...contendingSessionIds].filter((id) => !releasedSessionIds.has(id));
144
+ // Starting now could let the old session interfere with this one
145
+ throw new errors.SessionNotCreatedError(`${util.pluralize('session', pendingSessionIds.length, true)} [${pendingSessionIds.join(', ')}] ` +
146
+ `did not quit within ${this.releaseWaitMs}ms`);
147
+ }
148
+ }
149
+ finally {
150
+ subscriptions.forEach((sub) => sub.unsubscribe());
151
+ }
152
+ }
153
+ /** @internal Exposed for unit tests. */
154
+ resetForTesting() {
155
+ this.pendingTeardowns.clear();
156
+ for (const subscription of this.subscriptionsBySessionId.values()) {
157
+ subscription.unsubscribe();
158
+ }
159
+ this.subscriptionsBySessionId.clear();
160
+ }
161
+ async dispatchClaimMessage(driver, sessionId, message) {
162
+ try {
163
+ await this.handleClaimMessage(driver, sessionId, message);
164
+ }
165
+ catch (err) {
166
+ const msg = err instanceof Error ? err.message : String(err);
167
+ driver.log.warn(`Could not handle the session claim IPC message for session '${sessionId}': ${msg}`);
168
+ }
169
+ }
170
+ async handleClaimMessage(driver, sessionId, message) {
171
+ if (message.data.sessionId === sessionId || driver.sessionId !== sessionId) {
172
+ return;
173
+ }
174
+ // Tell the claimer that it has to wait for us
175
+ await this.publish(driver, SessionClaimHandler.CONTENDED_TOPIC, sessionId);
176
+ driver.log.warn(`Session '${message.data.sessionId}' is starting, while this session ('${sessionId}') is still active. ` +
177
+ `Only one session at a time is supported, since XCTest is single-threaded. ` +
178
+ `Consider enabling the Appium server's '--session-override' flag and make sure to properly ` +
179
+ `quit the previous session before starting a new one. Terminating the obsolete session.`);
180
+ await this.terminateSession(driver, sessionId);
181
+ }
182
+ async terminateSession(driver, sessionId) {
183
+ const publisherId = this.getPublisherId(driver);
184
+ const { log } = driver;
185
+ try {
186
+ // Unlike deleteSession(), this also makes the server drop the session from its list
187
+ await driver.startUnexpectedShutdown(new errors.NoSuchDriverError('This session has been replaced by a newer one, because only a single session is supported'));
188
+ }
189
+ catch (err) {
190
+ const msg = err instanceof Error ? err.message : String(err);
191
+ log.warn(`Could not terminate session '${sessionId}' on IPC request: ${msg}`);
192
+ }
193
+ await this.publish(driver, SessionClaimHandler.RELEASED_TOPIC, sessionId, publisherId, log);
194
+ }
195
+ async publish(driver, topic, sessionId, publisherId = this.getPublisherId(driver), log = driver.log) {
196
+ try {
197
+ const ipc = await this.getIpc();
198
+ await ipc?.publish(topic, publisherId, { sessionId });
199
+ }
200
+ catch (err) {
201
+ const msg = err instanceof Error ? err.message : String(err);
202
+ log.warn(`Could not publish '${topic}' message for session '${sessionId}': ${msg}`);
203
+ }
204
+ }
205
+ getPublisherId(driver) {
206
+ return node.getObjectId(driver);
207
+ }
208
+ }
209
+ let sharedIpc;
210
+ async function loadSharedIpc() {
211
+ sharedIpc ??= (async () => {
212
+ try {
213
+ const { AppiumIpc } = (await import('appium/driver.js'));
214
+ return AppiumIpc ? new AppiumIpc() : undefined;
215
+ }
216
+ catch {
217
+ return undefined;
218
+ }
219
+ })();
220
+ return await sharedIpc;
221
+ }
222
+ export const sessionClaimHandler = new SessionClaimHandler(loadSharedIpc);
223
+ /**
224
+ * @internal Exposed for unit tests.
225
+ */
226
+ export function setSharedIpcForTesting(ipc) {
227
+ sharedIpc = Promise.resolve(ipc);
228
+ }
229
+ /**
230
+ * @internal Exposed for unit tests.
231
+ */
232
+ export function resetSharedIpcForTesting() {
233
+ sessionClaimHandler.resetForTesting();
234
+ sharedIpc = undefined;
235
+ }
236
+ //# sourceMappingURL=session-claim-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-claim-handler.js","sourceRoot":"","sources":["../../lib/session-claim-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,IAAI,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAW1C,6GAA6G;AAC7G,MAAM,OAAO,mBAAmB;IAeX;IACA;IAfnB,MAAM,CAAU,aAAa,GAAG,qBAAqB,CAAC;IACtD,MAAM,CAAU,eAAe,GAAG,uBAAuB,CAA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AK,CAAC,KAAK,IAAI,EAAE;QACxB,IAAI,CAAC;YACH,MAAM,EAAC,SAAS,EAAC,GAAG,CAAC,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAuC,CAAC;YAC7F,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACjD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;IACL,OAAO,MAAM,SAAS,CAAC;AACzB,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,CAAC,aAAa,CAAC,CAAC;AAE1E;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAA2B;IAChE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB;IACtC,mBAAmB,CAAC,eAAe,EAAE,CAAC;IACtC,SAAS,GAAG,SAAS,CAAC;AACxB,CAAC"}
@@ -13,8 +13,12 @@ export declare class WDAMacServer {
13
13
  private _serverStartupTimeoutMs;
14
14
  private _isProxyingToRemoteServer;
15
15
  get proxy(): WDAMacProxy;
16
- startSession(caps: StartSessionCapabilities, opts?: SessionOptions): Promise<void>;
17
- stopSession(): Promise<void>;
16
+ /** Starts a WDA session, replacing the previous one. Returns the new WDA session id. */
17
+ startSession(caps: StartSessionCapabilities, opts?: SessionOptions): Promise<string>;
18
+ /** Whether the WDA session has not been replaced by a newer one. */
19
+ isSessionActive(sessionId: string | null | undefined): boolean;
20
+ /** Stops the WDA session. A replaced one is skipped, so the newer one is never affected. */
21
+ stopSession(sessionId: string | null | undefined): Promise<void>;
18
22
  private isProxyReady;
19
23
  /**
20
24
  * Returns proxy information where WDAMacServer proxy to.
@@ -1 +1 @@
1
- {"version":3,"file":"wda-mac.d.ts","sourceRoot":"","sources":["../../lib/wda-mac.ts"],"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B"}
@@ -242,6 +242,7 @@ export class WDAMacServer {
242
242
  }
243
243
  return this._proxy;
244
244
  }
245
+ /** Starts a WDA session, replacing the previous one. Returns the new WDA session id. */
245
246
  async startSession(caps, opts = {}) {
246
247
  this._serverStartupTimeoutMs = caps.serverStartupTimeout ?? this._serverStartupTimeoutMs;
247
248
  this._isProxyingToRemoteServer = !!caps.webDriverAgentMacUrl;
@@ -272,13 +273,12 @@ export class WDAMacServer {
272
273
  if (caps.reqBasePath) {
273
274
  proxyOpts.reqBasePath = opts.reqBasePath;
274
275
  }
275
- this._proxy = new WDAMacProxy(proxyOpts);
276
- this._proxy.didProcessExit = false;
276
+ const proxy = new WDAMacProxy(proxyOpts);
277
+ this._proxy = proxy;
277
278
  if (this._process?.proc) {
278
279
  this._process.proc.on('exit', () => {
279
- if (this._proxy) {
280
- this._proxy.didProcessExit = true;
281
- }
280
+ // An older process may exit after another launch has replaced the proxy.
281
+ proxy.didProcessExit = true;
282
282
  });
283
283
  }
284
284
  const timer = new timing.Timer().start();
@@ -319,21 +319,50 @@ export class WDAMacServer {
319
319
  else {
320
320
  log.info('The host process has already been listening. Proceeding with session creation');
321
321
  }
322
- await this._proxy.command('/session', 'POST', {
323
- capabilities: {
324
- firstMatch: [{}],
325
- alwaysMatch: caps,
326
- },
327
- });
322
+ // WDA drops the previous session as soon as it gets this request,
323
+ // so a failure must not leave the proxy pointing at the replaced one
324
+ try {
325
+ await this._proxy.command('/session', 'POST', {
326
+ capabilities: {
327
+ firstMatch: [{}],
328
+ alwaysMatch: caps,
329
+ },
330
+ });
331
+ }
332
+ catch (e) {
333
+ this._proxy.sessionId = null;
334
+ throw e;
335
+ }
336
+ const sessionId = this._proxy.sessionId;
337
+ if (!sessionId) {
338
+ throw new errors.SessionNotCreatedError('WebDriverAgentMac did not return a session id');
339
+ }
340
+ return sessionId;
328
341
  }
329
- async stopSession() {
342
+ /** Whether the WDA session has not been replaced by a newer one. */
343
+ isSessionActive(sessionId) {
344
+ return !!sessionId && this._proxy?.sessionId === sessionId;
345
+ }
346
+ /** Stops the WDA session. A replaced one is skipped, so the newer one is never affected. */
347
+ async stopSession(sessionId) {
330
348
  if (!this._isProxyingToRemoteServer && !this._process?.isRunning) {
331
349
  log.info(`Mac2Driver session cannot be stopped, because the server is not running`);
332
350
  return;
333
351
  }
334
- if (this._proxy?.sessionId) {
352
+ if (!this.isSessionActive(sessionId)) {
353
+ if (sessionId) {
354
+ log.info(`Mac2Driver session '${sessionId}' is not active anymore. Nothing to stop`);
355
+ }
356
+ return;
357
+ }
358
+ const proxy = this._proxy;
359
+ if (proxy) {
335
360
  try {
336
- await this._proxy.command(`/session/${this._proxy.sessionId}`, 'DELETE');
361
+ await proxy.command(`/session/${sessionId}`, 'DELETE');
362
+ // A newer session might have been created while the DELETE was pending
363
+ if (proxy.sessionId === sessionId) {
364
+ proxy.sessionId = null;
365
+ }
337
366
  }
338
367
  catch (e) {
339
368
  log.info(`Mac2Driver session cannot be deleted. Original error: ${e.message}`);
@@ -1 +1 @@
1
- {"version":3,"file":"wda-mac.js","sourceRoot":"","sources":["../../lib/wda-mac.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,UAAU,IAAI,KAAK,EAAC,MAAM,sBAAsB,CAAC;AACzD,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAC,cAAc,EAAE,MAAM,EAAC,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAC,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAC,UAAU,EAAE,IAAI,EAAC,MAAM,cAAc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CAAC,CAAC"}
package/lib/driver.ts CHANGED
@@ -11,7 +11,7 @@ import type {
11
11
  DriverOpts,
12
12
  W3CDriverCaps,
13
13
  } from '@appium/types';
14
- import {BaseDriver, DeviceSettings} from 'appium/driver.js';
14
+ import {BaseDriver, DeviceSettings, errors} from 'appium/driver.js';
15
15
 
16
16
  import * as appManagemenetCommands from './commands/app-management.js';
17
17
  import * as appleScriptCommands from './commands/applescript.js';
@@ -29,6 +29,7 @@ import MAC2_CONSTRAINTS, {type Mac2Constraints} from './constraints.js';
29
29
  import {executeMethodMap} from './execute-method-map.js';
30
30
  import log from './logger.js';
31
31
  import {newMethodMap} from './method-map.js';
32
+ import {sessionClaimHandler} from './session-claim-handler.js';
32
33
  import {WDA_MAC_SERVER, type WDAMacServer} from './wda-mac.js';
33
34
 
34
35
  const NO_PROXY: RouteMatcher[] = [
@@ -116,6 +117,8 @@ export class Mac2Driver
116
117
 
117
118
  private isProxyActive: boolean = false;
118
119
  private _wda: WDAMacServer | null = null;
120
+ private _wdaSessionId: string | null = null;
121
+ private _hasClaimedHost: boolean = false;
119
122
 
120
123
  constructor(opts: InitialOpts = {} as InitialOpts) {
121
124
  super(opts);
@@ -143,6 +146,13 @@ export class Mac2Driver
143
146
  if (!this._wda) {
144
147
  throw new Error('WDA server is not initialized');
145
148
  }
149
+ // The WDA server is shared and only supports a single session, so a newer
150
+ // session replaces this one. Never send commands on its behalf after that.
151
+ if (this._wdaSessionId && !this._wda.isSessionActive(this._wdaSessionId)) {
152
+ throw new errors.NoSuchDriverError(
153
+ 'This session has been replaced by a newer one, because this driver only supports a single session',
154
+ );
155
+ }
146
156
  return this._wda;
147
157
  }
148
158
 
@@ -150,7 +160,7 @@ export class Mac2Driver
150
160
  if (!this._wda) {
151
161
  return;
152
162
  }
153
- return await this._wda.proxy.command('/appium/settings', 'POST', {
163
+ return await this.wda.proxy.command('/appium/settings', 'POST', {
154
164
  settings: {[key]: value},
155
165
  });
156
166
  }
@@ -170,10 +180,7 @@ export class Mac2Driver
170
180
  }
171
181
 
172
182
  async proxyCommand(url: string, method: HTTPMethod, body: HTTPBody = null): Promise<any> {
173
- if (!this._wda) {
174
- throw new Error('WDA server is not initialized');
175
- }
176
- return await this._wda.proxy.command(url, method, body);
183
+ return await this.wda.proxy.command(url, method, body);
177
184
  }
178
185
 
179
186
  override async getStatus(): Promise<any> {
@@ -185,10 +192,7 @@ export class Mac2Driver
185
192
 
186
193
  // needed to make image plugin work
187
194
  async getWindowRect(): Promise<any> {
188
- if (!this._wda) {
189
- throw new Error('WDA server is not initialized');
190
- }
191
- return await this._wda.proxy.command('/window/rect', 'GET');
195
+ return await this.wda.proxy.command('/window/rect', 'GET');
192
196
  }
193
197
 
194
198
  override async createSession(
@@ -202,34 +206,51 @@ export class Mac2Driver
202
206
  this.caps = caps as Mac2DriverCaps;
203
207
  // oxlint-disable-next-line no-self-assign -- narrows this.opts' type for the rest of the method
204
208
  this.opts = this.opts as Mac2DriverOpts;
205
- try {
206
- const prerun = caps.prerun as PrerunCapability | undefined;
207
- if (prerun) {
208
- if (typeof prerun.command !== 'string' && typeof prerun.script !== 'string') {
209
- throw new Error(`'prerun' capability value must either contain 'script' or 'command' entry of string type`);
210
- }
211
- log.info('Executing prerun AppleScript');
212
- const output = await this.macosExecAppleScript(prerun.script, undefined, prerun.command);
213
- if (output.trim()) {
214
- log.info(`Prerun script output: ${output}`);
209
+ // The host supports a single session: the previous one has to quit first
210
+ await sessionClaimHandler.runExclusive(async () => {
211
+ // The session might have been deleted while it was waiting for its turn
212
+ if (!this._wda || !this.sessionId) {
213
+ throw new errors.NoSuchDriverError('The session has been deleted before it could start');
214
+ }
215
+ try {
216
+ await sessionClaimHandler.registerActiveSession(this);
217
+ await sessionClaimHandler.claimHost(this);
218
+ this._hasClaimedHost = true;
219
+ const prerun = caps.prerun as PrerunCapability | undefined;
220
+ if (prerun) {
221
+ if (typeof prerun.command !== 'string' && typeof prerun.script !== 'string') {
222
+ throw new Error(`'prerun' capability value must either contain 'script' or 'command' entry of string type`);
223
+ }
224
+ log.info('Executing prerun AppleScript');
225
+ const output = await this.macosExecAppleScript(prerun.script, undefined, prerun.command);
226
+ if (output.trim()) {
227
+ log.info(`Prerun script output: ${output}`);
228
+ }
215
229
  }
230
+ this._wdaSessionId = await this.wda.startSession(caps, {
231
+ reqBasePath: this.basePath,
232
+ });
233
+ } catch (e: any) {
234
+ await this.deleteSession();
235
+ throw e;
216
236
  }
217
- await this._wda.startSession(caps, {
218
- reqBasePath: this.basePath,
219
- });
220
- } catch (e: any) {
221
- await this.deleteSession();
222
- throw e;
223
- }
224
- this.proxyReqRes = this.wda.proxy.proxyReqRes.bind(this._wda.proxy);
237
+ });
238
+ this.proxyReqRes = (...args: any[]) =>
239
+ (this.wda.proxy.proxyReqRes as (...a: any[]) => any).apply(this.wda.proxy, args);
225
240
  this.isProxyActive = true;
226
241
  return [sessionId, caps];
227
242
  }
228
243
 
229
244
  override async deleteSession(): Promise<void> {
245
+ sessionClaimHandler.unregisterActiveSession(this);
246
+ // A new session waits for the teardown to complete before it starts
247
+ await sessionClaimHandler.trackTeardown(async () => await this.teardownSession());
248
+ }
249
+
250
+ private async teardownSession(): Promise<void> {
230
251
  await this._screenRecorder?.stop(true);
231
252
  if (this._videoChunksBroadcaster.hasPublishers) {
232
- if (this._wda) {
253
+ if (this._wda?.isSessionActive(this._wdaSessionId)) {
233
254
  try {
234
255
  await this.wda.proxy.command('/wda/video/stop', 'POST', {});
235
256
  } catch {}
@@ -237,10 +258,11 @@ export class Mac2Driver
237
258
  await this._videoChunksBroadcaster.shutdown(5000);
238
259
  }
239
260
  if (this._wda) {
240
- await this.wda.stopSession();
261
+ await this._wda.stopSession(this._wdaSessionId);
241
262
  }
242
263
 
243
- const postrun = this.opts.postrun as PostrunCapability | undefined;
264
+ // Skip postrun if the host was never acquired, as the previous session might still be using it
265
+ const postrun = this._hasClaimedHost ? (this.opts.postrun as PostrunCapability | undefined) : undefined;
244
266
  if (postrun) {
245
267
  if (typeof postrun.command !== 'string' && typeof postrun.script !== 'string') {
246
268
  log.error(`'postrun' capability value must either contain 'script' or 'command' entry of string type`);
@@ -264,6 +286,8 @@ export class Mac2Driver
264
286
 
265
287
  private resetState(): void {
266
288
  this._wda = null;
289
+ this._wdaSessionId = null;
290
+ this._hasClaimedHost = false;
267
291
  this.isProxyActive = false;
268
292
  this._videoChunksBroadcaster = new nativeScreenRecordingCommands.NativeVideoChunksBroadcaster(
269
293
  this.eventEmitter,