appium-espresso-driver 10.0.1 → 10.0.2

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 (151) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/lib/commands/server/builder.js +1 -1
  3. package/build/lib/commands/server/builder.js.map +1 -1
  4. package/build/lib/driver.d.ts.map +1 -1
  5. package/build/lib/driver.js.map +1 -1
  6. package/espresso-server/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk +0 -0
  7. package/espresso-server/buildSrc/.gradle/9.7.1/executionHistory/executionHistory.bin +0 -0
  8. package/espresso-server/buildSrc/.gradle/9.7.1/executionHistory/executionHistory.lock +0 -0
  9. package/espresso-server/buildSrc/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  10. package/espresso-server/buildSrc/.gradle/buildOutputCleanup/cache.properties +1 -1
  11. package/espresso-server/buildSrc/build/kotlin/compileKotlin/cacheable/last-build.bin +0 -0
  12. package/espresso-server/library/src/main/java/io/appium/espressoserver/lib/helpers/Version.kt +1 -1
  13. package/lib/commands/server/builder.ts +1 -1
  14. package/lib/driver.ts +2 -2
  15. package/node_modules/@appium/base-driver/build/lib/index.d.ts +1 -1
  16. package/node_modules/@appium/base-driver/build/lib/index.d.ts.map +1 -1
  17. package/node_modules/@appium/base-driver/build/lib/index.js +1 -1
  18. package/node_modules/@appium/base-driver/build/lib/index.js.map +1 -1
  19. package/node_modules/@appium/base-driver/build/lib/protocol/errors.d.ts.map +1 -1
  20. package/node_modules/@appium/base-driver/build/lib/protocol/errors.js.map +1 -1
  21. package/node_modules/@appium/base-driver/build/lib/protocol/helpers.d.ts +27 -0
  22. package/node_modules/@appium/base-driver/build/lib/protocol/helpers.d.ts.map +1 -1
  23. package/node_modules/@appium/base-driver/build/lib/protocol/helpers.js +50 -0
  24. package/node_modules/@appium/base-driver/build/lib/protocol/helpers.js.map +1 -1
  25. package/node_modules/@appium/base-driver/build/lib/protocol/index.d.ts +1 -0
  26. package/node_modules/@appium/base-driver/build/lib/protocol/index.d.ts.map +1 -1
  27. package/node_modules/@appium/base-driver/build/lib/protocol/index.js +1 -0
  28. package/node_modules/@appium/base-driver/build/lib/protocol/index.js.map +1 -1
  29. package/node_modules/@appium/base-driver/build/lib/protocol/route-handler.js +19 -24
  30. package/node_modules/@appium/base-driver/build/lib/protocol/route-handler.js.map +1 -1
  31. package/node_modules/@appium/base-driver/build/lib/protocol/session.d.ts +0 -7
  32. package/node_modules/@appium/base-driver/build/lib/protocol/session.d.ts.map +1 -1
  33. package/node_modules/@appium/base-driver/build/lib/protocol/session.js +0 -17
  34. package/node_modules/@appium/base-driver/build/lib/protocol/session.js.map +1 -1
  35. package/node_modules/@appium/base-driver/lib/index.ts +2 -0
  36. package/node_modules/@appium/base-driver/lib/protocol/errors.ts +4 -4
  37. package/node_modules/@appium/base-driver/lib/protocol/helpers.ts +60 -0
  38. package/node_modules/@appium/base-driver/lib/protocol/index.ts +1 -0
  39. package/node_modules/@appium/base-driver/lib/protocol/route-handler.ts +18 -28
  40. package/node_modules/@appium/base-driver/lib/protocol/session.ts +0 -20
  41. package/node_modules/@appium/base-driver/package.json +5 -5
  42. package/node_modules/@appium/schema/build/lib/appium-config-schema.d.ts +21 -0
  43. package/node_modules/@appium/schema/build/lib/appium-config-schema.d.ts.map +1 -1
  44. package/node_modules/@appium/schema/build/lib/appium-config-schema.js +21 -0
  45. package/node_modules/@appium/schema/build/lib/appium-config-schema.js.map +1 -1
  46. package/node_modules/@appium/schema/lib/appium-config-schema.ts +24 -0
  47. package/node_modules/@appium/schema/lib/appium-config.schema.json +21 -0
  48. package/node_modules/@appium/schema/package.json +2 -2
  49. package/node_modules/@appium/support/build/lib/index.d.ts +1 -1
  50. package/node_modules/@appium/support/build/lib/index.d.ts.map +1 -1
  51. package/node_modules/@appium/support/build/lib/internal/zip-extractor.d.ts.map +1 -1
  52. package/node_modules/@appium/support/build/lib/internal/zip-extractor.js +8 -1
  53. package/node_modules/@appium/support/build/lib/internal/zip-extractor.js.map +1 -1
  54. package/node_modules/@appium/support/build/lib/net.d.ts +56 -0
  55. package/node_modules/@appium/support/build/lib/net.d.ts.map +1 -1
  56. package/node_modules/@appium/support/build/lib/net.js +96 -1
  57. package/node_modules/@appium/support/build/lib/net.js.map +1 -1
  58. package/node_modules/@appium/support/lib/index.ts +9 -1
  59. package/node_modules/@appium/support/lib/internal/zip-extractor.ts +7 -1
  60. package/node_modules/@appium/support/lib/net.ts +126 -1
  61. package/node_modules/@appium/support/package.json +5 -5
  62. package/node_modules/@appium/types/build/lib/appium-config.d.ts +15 -0
  63. package/node_modules/@appium/types/build/lib/appium-config.d.ts.map +1 -1
  64. package/node_modules/@appium/types/build/lib/bidi.d.ts +44 -0
  65. package/node_modules/@appium/types/build/lib/bidi.d.ts.map +1 -0
  66. package/node_modules/@appium/types/build/lib/bidi.js +2 -0
  67. package/node_modules/@appium/types/build/lib/bidi.js.map +1 -0
  68. package/node_modules/@appium/types/build/lib/driver.d.ts +6 -0
  69. package/node_modules/@appium/types/build/lib/driver.d.ts.map +1 -1
  70. package/node_modules/@appium/types/build/lib/index.d.ts +1 -0
  71. package/node_modules/@appium/types/build/lib/index.d.ts.map +1 -1
  72. package/node_modules/@appium/types/build/lib/index.js +1 -0
  73. package/node_modules/@appium/types/build/lib/index.js.map +1 -1
  74. package/node_modules/@appium/types/lib/appium-config.ts +15 -0
  75. package/node_modules/@appium/types/lib/bidi.ts +45 -0
  76. package/node_modules/@appium/types/lib/driver.ts +6 -0
  77. package/node_modules/@appium/types/lib/index.ts +1 -0
  78. package/node_modules/@appium/types/package.json +4 -4
  79. package/node_modules/appium-android-driver/CHANGELOG.md +24 -0
  80. package/node_modules/appium-android-driver/package.json +4 -4
  81. package/node_modules/appium-chromedriver/CHANGELOG.md +7 -0
  82. package/node_modules/appium-chromedriver/config/mapping.json +1 -0
  83. package/node_modules/appium-chromedriver/package.json +2 -2
  84. package/node_modules/bare-buffer/CMakeLists.txt +3 -3
  85. package/node_modules/bare-buffer/README.md +4 -0
  86. package/node_modules/bare-buffer/package.json +2 -2
  87. package/node_modules/bare-buffer/prebuilds/android-arm/bare-buffer.bare +0 -0
  88. package/node_modules/bare-buffer/prebuilds/android-arm64/bare-buffer.bare +0 -0
  89. package/node_modules/bare-buffer/prebuilds/android-ia32/bare-buffer.bare +0 -0
  90. package/node_modules/bare-buffer/prebuilds/android-x64/bare-buffer.bare +0 -0
  91. package/node_modules/bare-buffer/prebuilds/darwin-arm64/bare-buffer.bare +0 -0
  92. package/node_modules/bare-buffer/prebuilds/darwin-x64/bare-buffer.bare +0 -0
  93. package/node_modules/bare-buffer/prebuilds/ios-arm64/bare-buffer.bare +0 -0
  94. package/node_modules/bare-buffer/prebuilds/ios-arm64-simulator/bare-buffer.bare +0 -0
  95. package/node_modules/bare-buffer/prebuilds/ios-x64-simulator/bare-buffer.bare +0 -0
  96. package/node_modules/bare-buffer/prebuilds/linux-arm64/bare-buffer.bare +0 -0
  97. package/node_modules/bare-buffer/prebuilds/linux-x64/bare-buffer.bare +0 -0
  98. package/node_modules/bare-buffer/prebuilds/win32-arm64/bare-buffer.bare +0 -0
  99. package/node_modules/bare-buffer/prebuilds/win32-x64/bare-buffer.bare +0 -0
  100. package/node_modules/bare-path/README.md +8 -0
  101. package/node_modules/bare-path/binding.c +33 -12
  102. package/node_modules/bare-path/index.d.ts +64 -0
  103. package/node_modules/bare-path/package.json +1 -1
  104. package/node_modules/bare-path/prebuilds/android-arm/bare-path.bare +0 -0
  105. package/node_modules/bare-path/prebuilds/android-arm64/bare-path.bare +0 -0
  106. package/node_modules/bare-path/prebuilds/android-ia32/bare-path.bare +0 -0
  107. package/node_modules/bare-path/prebuilds/android-x64/bare-path.bare +0 -0
  108. package/node_modules/bare-path/prebuilds/darwin-arm64/bare-path.bare +0 -0
  109. package/node_modules/bare-path/prebuilds/darwin-x64/bare-path.bare +0 -0
  110. package/node_modules/bare-path/prebuilds/ios-arm64/bare-path.bare +0 -0
  111. package/node_modules/bare-path/prebuilds/ios-arm64-simulator/bare-path.bare +0 -0
  112. package/node_modules/bare-path/prebuilds/ios-x64-simulator/bare-path.bare +0 -0
  113. package/node_modules/bare-path/prebuilds/linux-arm64/bare-path.bare +0 -0
  114. package/node_modules/bare-path/prebuilds/linux-x64/bare-path.bare +0 -0
  115. package/node_modules/bare-path/prebuilds/win32-arm64/bare-path.bare +0 -0
  116. package/node_modules/bare-path/prebuilds/win32-x64/bare-path.bare +0 -0
  117. package/node_modules/bare-url/CMakeLists.txt +5 -5
  118. package/node_modules/bare-url/package.json +2 -2
  119. package/node_modules/bare-url/prebuilds/android-arm/bare-url.bare +0 -0
  120. package/node_modules/bare-url/prebuilds/android-arm64/bare-url.bare +0 -0
  121. package/node_modules/bare-url/prebuilds/android-ia32/bare-url.bare +0 -0
  122. package/node_modules/bare-url/prebuilds/android-x64/bare-url.bare +0 -0
  123. package/node_modules/bare-url/prebuilds/darwin-arm64/bare-url.bare +0 -0
  124. package/node_modules/bare-url/prebuilds/darwin-x64/bare-url.bare +0 -0
  125. package/node_modules/bare-url/prebuilds/ios-arm64/bare-url.bare +0 -0
  126. package/node_modules/bare-url/prebuilds/ios-arm64-simulator/bare-url.bare +0 -0
  127. package/node_modules/bare-url/prebuilds/ios-x64-simulator/bare-url.bare +0 -0
  128. package/node_modules/bare-url/prebuilds/linux-arm64/bare-url.bare +0 -0
  129. package/node_modules/bare-url/prebuilds/linux-x64/bare-url.bare +0 -0
  130. package/node_modules/bare-url/prebuilds/win32-arm64/bare-url.bare +0 -0
  131. package/node_modules/bare-url/prebuilds/win32-x64/bare-url.bare +0 -0
  132. package/node_modules/io.appium.settings/CHANGELOG.md +14 -0
  133. package/node_modules/io.appium.settings/README.md +23 -0
  134. package/node_modules/io.appium.settings/apks/settings_apk-debug.apk +0 -0
  135. package/node_modules/io.appium.settings/build/lib/client.d.ts +3 -0
  136. package/node_modules/io.appium.settings/build/lib/client.d.ts.map +1 -1
  137. package/node_modules/io.appium.settings/build/lib/client.js +5 -0
  138. package/node_modules/io.appium.settings/build/lib/client.js.map +1 -1
  139. package/node_modules/io.appium.settings/build/lib/commands/accessibility.d.ts +25 -0
  140. package/node_modules/io.appium.settings/build/lib/commands/accessibility.d.ts.map +1 -0
  141. package/node_modules/io.appium.settings/build/lib/commands/accessibility.js +71 -0
  142. package/node_modules/io.appium.settings/build/lib/commands/accessibility.js.map +1 -0
  143. package/node_modules/io.appium.settings/build/lib/constants.d.ts +1 -0
  144. package/node_modules/io.appium.settings/build/lib/constants.d.ts.map +1 -1
  145. package/node_modules/io.appium.settings/build/lib/constants.js +1 -0
  146. package/node_modules/io.appium.settings/build/lib/constants.js.map +1 -1
  147. package/node_modules/io.appium.settings/lib/client.ts +7 -0
  148. package/node_modules/io.appium.settings/lib/commands/accessibility.ts +82 -0
  149. package/node_modules/io.appium.settings/lib/constants.ts +2 -0
  150. package/node_modules/io.appium.settings/package.json +3 -3
  151. package/package.json +4 -4
@@ -1,14 +1,14 @@
1
1
  import { logger, util } from '@appium/support';
2
- import { DEFAULT_BASE_PATH, MAX_LOG_BODY_LENGTH, PROTOCOLS } from '../constants.js';
2
+ import { DEFAULT_BASE_PATH, MAX_LOG_BODY_LENGTH } from '../constants.js';
3
3
  import { errorFromW3CJsonCode, errors, getResponseForW3CError, isErrorType } from './errors.js';
4
- import { ensureW3cResponse, formatResponseValue } from './helpers.js';
4
+ import { ensureW3cResponse, formatResponseValue, isProtocolResponseEnvelope } from './helpers.js';
5
5
  import { preserveIdempotentSessionResponse } from './idempotency.js';
6
6
  import { jsonParseErrors } from './json-parse-error.js';
7
7
  import { checkParams, makeArgs, unwrapParams, wrapParams } from './params.js';
8
8
  import { runWithProxyReq } from './proxy-context.js';
9
9
  import { tryWdProxy } from './proxy.js';
10
10
  import { CREATE_SESSION_COMMAND, DELETE_SESSION_COMMAND, METHOD_MAP } from './routes/index.js';
11
- import { extractProtocol, getLogger, getSessionId, isSessionCommand } from './session.js';
11
+ import { getLogger, getSessionId, isSessionCommand } from './session.js';
12
12
  import { getCommandValidator } from './validators.js';
13
13
  export const deprecatedCommandsLogged = new Set();
14
14
  /**
@@ -60,7 +60,6 @@ function buildHandler(app, method, path, spec, driver, isSessCmd) {
60
60
  let httpStatus = 200;
61
61
  let newSessionId;
62
62
  const sessionId = getSessionId(driver, req);
63
- let currentProtocol = extractProtocol(driver, sessionId);
64
63
  try {
65
64
  logDeprecationWarning(driver, method, path, spec, sessionId);
66
65
  ensureSessionExists(driver, sessionId, isSessCmd);
@@ -95,9 +94,8 @@ function buildHandler(app, method, path, spec, driver, isSessCmd) {
95
94
  // run the driver command wrapped inside the argument validators
96
95
  getLogger(driver, sessionId).debug(`Calling %s.%s() with args: %s`, driver.constructor.name, command, logger.markSensitive(util.truncateString(JSON.stringify(args), { length: MAX_LOG_BODY_LENGTH })));
97
96
  const result = didPluginOverrideProxy
98
- ? await runWithProxyReq(req, () => runDriverCommand(driver, command, args, sessionId, currentProtocol))
99
- : await runDriverCommand(driver, command, args, sessionId, currentProtocol);
100
- currentProtocol = result.currentProtocol;
97
+ ? await runWithProxyReq(req, () => runDriverCommand(driver, command, args, sessionId))
98
+ : await runDriverCommand(driver, command, args, sessionId);
101
99
  newSessionId = result.newSessionId;
102
100
  httpResBody.value = result.driverRes;
103
101
  getLogger(driver, sessionId || newSessionId).debug(`Responding ` +
@@ -106,14 +104,13 @@ function buildHandler(app, method, path, spec, driver, isSessCmd) {
106
104
  })}`);
107
105
  }
108
106
  catch (err) {
109
- currentProtocol = currentProtocol || extractProtocol(driver, sessionId || newSessionId);
110
107
  [httpStatus, httpResBody] = buildErrorResponse(err, driver, sessionId || newSessionId);
111
108
  }
112
109
  if (newSessionId && abandonIfDisconnected?.()) {
113
110
  await deleteAbandonedSession(driver, newSessionId);
114
111
  }
115
112
  else {
116
- sendHandlerResponse(res, httpStatus, httpResBody, newSessionId, currentProtocol);
113
+ sendHandlerResponse(res, httpStatus, httpResBody, newSessionId);
117
114
  }
118
115
  return newSessionId;
119
116
  };
@@ -236,28 +233,25 @@ function buildCommandArgs({ req, jsonObj, spec, command, validateCommandArgument
236
233
  return args;
237
234
  }
238
235
  /**
239
- * Runs the driver command and interprets its result: resolves the protocol used for the
240
- * response, unpacks the createSession/deleteSession special cases, and raises W3C errors
241
- * embedded in the result value.
236
+ * Runs the driver command and interprets its result: unpacks the createSession/deleteSession
237
+ * special cases, and raises W3C errors embedded in the result value.
242
238
  */
243
- async function runDriverCommand(driver, command, args, sessionId, currentProtocol) {
239
+ async function runDriverCommand(driver, command, args, sessionId) {
244
240
  let driverRes = await driver.executeCommand(command, ...args);
245
- // Get the protocol after executeCommand
246
- currentProtocol = extractProtocol(driver, sessionId) || currentProtocol;
247
- // If `executeCommand` was overridden and the method returns an object
248
- // with a protocol and value/error property, re-assign the protocol
249
- if (util.isPlainObject(driverRes) && Object.hasOwn(driverRes, 'protocol')) {
250
- currentProtocol = driverRes.protocol || currentProtocol;
241
+ // A marked envelope, or `{protocol, error}` when `error` is an Error.
242
+ // `{protocol: 'W3C', value}` is command data.
243
+ if (isProtocolResponseEnvelope(driverRes)) {
251
244
  if (driverRes.error) {
252
245
  throw driverRes.error;
253
246
  }
254
247
  driverRes = driverRes.value;
255
248
  }
249
+ // a protocol field on the unwrapped value means it is command data
250
+ const isProtocolData = util.isPlainObject(driverRes) && Object.hasOwn(driverRes, 'protocol');
256
251
  let newSessionId;
257
252
  // unpack createSession response
258
253
  if (command === CREATE_SESSION_COMMAND) {
259
254
  newSessionId = driverRes[0];
260
- getLogger(driver, newSessionId).debug(`Cached the protocol value '${currentProtocol}' for the new session ${newSessionId}`);
261
255
  driverRes = {
262
256
  capabilities: driverRes[1],
263
257
  };
@@ -271,10 +265,10 @@ async function runDriverCommand(driver, command, args, sessionId, currentProtoco
271
265
  getLogger(driver, sessionId).debug('But deleting session, so not returning');
272
266
  driverRes = null;
273
267
  }
274
- if (util.hasValue(driverRes) && util.isPlainObject(driverRes.value) && driverRes.value.error) {
268
+ if (!isProtocolData && util.hasValue(driverRes) && util.isPlainObject(driverRes.value) && driverRes.value.error) {
275
269
  throw errorFromW3CJsonCode(driverRes.value.error, driverRes.value.message, driverRes.value.stacktrace, driverRes.value.data);
276
270
  }
277
- return { driverRes, currentProtocol, newSessionId };
271
+ return { driverRes, newSessionId };
278
272
  }
279
273
  /**
280
274
  * Normalizes a thrown value into an Error instance, warning when it wasn't one to begin with.
@@ -313,12 +307,13 @@ function buildErrorResponse(err, driver, sessionId) {
313
307
  /**
314
308
  * Writes the final HTTP response, either the pre-serialized string or the JSON body.
315
309
  */
316
- function sendHandlerResponse(res, httpStatus, httpResBody, newSessionId, currentProtocol) {
310
+ function sendHandlerResponse(res, httpStatus, httpResBody, newSessionId) {
317
311
  if (typeof httpResBody === 'string') {
318
312
  res.status(httpStatus).setHeader('content-type', 'application/json; charset=utf-8').send(httpResBody);
319
313
  return;
320
314
  }
321
- if (newSessionId && currentProtocol === PROTOCOLS.W3C) {
315
+ // Appium 4 only writes W3C responses, so the new session id is always part of the body.
316
+ if (newSessionId && util.isPlainObject(httpResBody.value)) {
322
317
  httpResBody.value.sessionId = newSessionId;
323
318
  }
324
319
  res.status(httpStatus).json(ensureW3cResponse(httpResBody));
@@ -1 +1 @@
1
- {"version":3,"file":"route-handler.js","sourceRoot":"","sources":["../../../lib/protocol/route-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAK7C,OAAO,EAAC,iBAAiB,EAAE,mBAAmB,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAC,oBAAoB,EAAE,MAAM,EAAE,sBAAsB,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAC9F,OAAO,EAAC,iBAAiB,EAAE,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACpE,OAAO,EAAC,iCAAiC,EAAC,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAC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AAG,GAAG,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAChE,CAAC;IACD,IAAI,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACrD,SAAS,GAAG,SAAS,CAAC,cAAc,EAAE,CAAC;IACzC,CAAC;SAAM,CAAC;QACN,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,KAAK,CAAC,+CAA+C,MAAM,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED,OAAO,sBAAsB,CAAC,SAAS,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAC1B,GAAa,EACb,UAAkB,EAClB,WAAgB,EAChB,YAAgC;IAEhC,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QACpC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,cAAc,EAAE,iCAAiC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACtG,OAAO;IACT,CAAC;IACD,wFAAwF;IACxF,IAAI,YAAY,IAAI,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1D,WAAW,CAAC,KAAK,CAAC,SAAS,GAAG,YAAY,CAAC;IAC7C,CAAC;IACD,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;AAC9D,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import type { AppiumLogger, Core } from '@appium/types';
2
2
  import type { Request } from 'express';
3
- import { PROTOCOLS } from '../constants.js';
4
3
  /**
5
4
  * Extract and validate the sessionId from the Express route parameter.
6
5
  * Express may return route params as string | string[] | undefined.
@@ -19,12 +18,6 @@ export declare function getSessionId(driver: Core<any>, req: Request): string |
19
18
  * @returns Whether the command requires a session id in the URL
20
19
  */
21
20
  export declare function isSessionCommand(command: string): boolean;
22
- /**
23
- * @param driver - Active driver, possibly an umbrella driver managing multiple sessions
24
- * @param sessionId - Id of the session to resolve the protocol for
25
- * @returns The active protocol for the given session
26
- */
27
- export declare function extractProtocol(driver: Core<any>, sessionId?: string | null): keyof typeof PROTOCOLS;
28
21
  /**
29
22
  * @param driver - Active driver, possibly an umbrella driver managing multiple sessions
30
23
  * @param sessionId - Id of the session to resolve the logger for
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../lib/protocol/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAErC,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAI1C;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAehF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,SAAS,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,OAAO,SAAS,CAY1G;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,SAAS,GAAE,MAAM,GAAG,IAAW,GAAG,YAAY,CAW1F"}
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../lib/protocol/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAKrC;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAehF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,SAAS,GAAE,MAAM,GAAG,IAAW,GAAG,YAAY,CAW1F"}
@@ -1,5 +1,4 @@
1
1
  import { logger } from '@appium/support';
2
- import { PROTOCOLS } from '../constants.js';
3
2
  import { generateDriverLogPrefix } from '../helpers/log-prefix.js';
4
3
  import { NO_SESSION_ID_COMMANDS } from './routes/index.js';
5
4
  /**
@@ -35,22 +34,6 @@ export function getSessionId(driver, req) {
35
34
  export function isSessionCommand(command) {
36
35
  return !NO_SESSION_ID_COMMANDS.includes(command);
37
36
  }
38
- /**
39
- * @param driver - Active driver, possibly an umbrella driver managing multiple sessions
40
- * @param sessionId - Id of the session to resolve the protocol for
41
- * @returns The active protocol for the given session
42
- */
43
- export function extractProtocol(driver, sessionId = null) {
44
- const dstDriver = typeof driver.driverForSession === 'function' && sessionId ? driver.driverForSession(sessionId) : driver;
45
- if (dstDriver === driver) {
46
- // Shortcircuit if the driver instance is not an umbrella driver
47
- // or it is Fake driver instance, where `driver.driverForSession`
48
- // always returns self instance
49
- return driver.protocol ?? PROTOCOLS.W3C;
50
- }
51
- // Extract the protocol for the current session if the given driver is the umbrella one
52
- return dstDriver?.protocol ?? PROTOCOLS.W3C;
53
- }
54
37
  /**
55
38
  * @param driver - Active driver, possibly an umbrella driver managing multiple sessions
56
39
  * @param sessionId - Id of the session to resolve the logger for
@@ -1 +1 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../../../lib/protocol/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM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YAC/C,0CAA0C,SAAS,IAAI;YACvD,wDAAwD,CAC3D,CAAC;QACF,iDAAiD;QACjD,GAAG,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;QACjC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,MAAiB,EAAE,YAA2B,IAAI;IAC1E,MAAM,SAAS,GACb,SAAS,IAAI,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU;QACxD,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC;QAChD,CAAC,CAAC,MAAM,CAAC;IACb,IAAI,OAAO,SAAS,CAAC,GAAG,EAAE,IAAI,KAAK,UAAU,EAAE,CAAC;QAC9C,OAAO,SAAS,CAAC,GAAG,CAAC;IACvB,CAAC;IAED,MAAM,SAAS,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IACrD,OAAO,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACrC,CAAC"}
@@ -35,6 +35,8 @@ export {
35
35
  JsonParseErrors,
36
36
  jsonParseErrors,
37
37
  isErrorType,
38
+ isProtocolResponseEnvelope,
39
+ markResponseEnvelope,
38
40
  isSessionCommand,
39
41
  handleIdempotency,
40
42
  makeArgs,
@@ -6,10 +6,10 @@ import {HTTPStatusCodes} from '../helpers/http-status-codes.js';
6
6
  const w3cLog = logger.getLogger('W3C');
7
7
 
8
8
  class BaseError extends Error {
9
- public cause: Error | undefined;
10
- public message: string;
11
- public name: string;
12
- public stack: string | undefined;
9
+ public override cause: Error | undefined;
10
+ public override message: string;
11
+ public override name: string;
12
+ public override stack: string | undefined;
13
13
 
14
14
  constructor(message: string = '', cause?: Error) {
15
15
  super(message);
@@ -1,5 +1,7 @@
1
1
  import {util} from '@appium/support';
2
2
 
3
+ import {PROTOCOLS} from '../constants.js';
4
+
3
5
  /**
4
6
  * Preprocesses the resulting value for API responses.
5
7
  * The argument value is NOT mutated.
@@ -28,3 +30,61 @@ export function ensureW3cResponse(responseBody: Record<string, unknown>): Record
28
30
  delete result.sessionId;
29
31
  return result;
30
32
  }
33
+
34
+ /** Shared by every copy of this package. Enumerable so a spread or `Object.assign` clone keeps it. */
35
+ const RESPONSE_ENVELOPE = Symbol.for('appium.responseEnvelope');
36
+
37
+ /** Frozen objects cannot take the symbol. This copy still remembers them. */
38
+ const responseEnvelopes = new WeakSet<object>();
39
+
40
+ type ProtocolResponse = {
41
+ protocol?: typeof PROTOCOLS.W3C | typeof PROTOCOLS.MJSONWP | null;
42
+ value?: unknown;
43
+ error?: unknown;
44
+ };
45
+
46
+ /**
47
+ * Marks a response Appium built. A command result such as `{protocol: 'W3C', value: 5}` is not marked.
48
+ * Only Appium's umbrella driver calls this. A driver returns the value or throws.
49
+ * The mark is visible to another copy of this package, and to a spread or `Object.assign` clone.
50
+ * A frozen object is remembered only by this copy.
51
+ *
52
+ * @param envelope - Response object Appium just built
53
+ * @returns The same object
54
+ */
55
+ export function markResponseEnvelope<T extends object>(envelope: T): T {
56
+ responseEnvelopes.add(envelope);
57
+ try {
58
+ Object.defineProperty(envelope, RESPONSE_ENVELOPE, {
59
+ value: true,
60
+ enumerable: true,
61
+ });
62
+ } catch {
63
+ // frozen or sealed
64
+ }
65
+ return envelope;
66
+ }
67
+
68
+ /**
69
+ * Whether `value` is a driver response envelope rather than command data.
70
+ * Marked responses qualify, as does `{protocol, error}` when `protocol` is `W3C` or `MJSONWP`
71
+ * and `error` is an Error.
72
+ * `{protocol: 'W3C', value: 5}` is command data.
73
+ *
74
+ * @param value - Command result or already wrapped handler result
75
+ * @returns `true` when the caller should read `value` / `error` instead of returning the object
76
+ */
77
+ export function isProtocolResponseEnvelope(value: unknown): value is ProtocolResponse {
78
+ if (!util.isPlainObject(value)) {
79
+ return false;
80
+ }
81
+ const marker = Object.getOwnPropertyDescriptor(value, RESPONSE_ENVELOPE);
82
+ if (responseEnvelopes.has(value) || marker?.value === true) {
83
+ return true;
84
+ }
85
+ if (!(value.error instanceof Error)) {
86
+ return false;
87
+ }
88
+ const protocol = value.protocol;
89
+ return protocol === PROTOCOLS.W3C || protocol === PROTOCOLS.MJSONWP;
90
+ }
@@ -1,5 +1,6 @@
1
1
  export {BIDI_COMMANDS} from './bidi-commands/index.js';
2
2
  export {errorFromW3CJsonCode, errors, getResponseForW3CError, isErrorType} from './errors.js';
3
+ export {isProtocolResponseEnvelope, markResponseEnvelope} from './helpers.js';
3
4
  export {handleIdempotency} from './idempotency.js';
4
5
  export {JsonParseErrors, jsonParseErrors} from './json-parse-error.js';
5
6
  export {checkParams, makeArgs, validateExecuteMethodParams} from './params.js';
@@ -3,16 +3,16 @@ import type {Constraints, Core, Driver, DriverMethodDef, ExternalDriver, MethodM
3
3
  import type {Application, Express, Request, Response} from 'express';
4
4
 
5
5
  import type {BaseDriver} from '../basedriver/driver.js';
6
- import {DEFAULT_BASE_PATH, MAX_LOG_BODY_LENGTH, PROTOCOLS} from '../constants.js';
6
+ import {DEFAULT_BASE_PATH, MAX_LOG_BODY_LENGTH} from '../constants.js';
7
7
  import {errorFromW3CJsonCode, errors, getResponseForW3CError, isErrorType} from './errors.js';
8
- import {ensureW3cResponse, formatResponseValue} from './helpers.js';
8
+ import {ensureW3cResponse, formatResponseValue, isProtocolResponseEnvelope} from './helpers.js';
9
9
  import {preserveIdempotentSessionResponse} from './idempotency.js';
10
10
  import {jsonParseErrors} from './json-parse-error.js';
11
11
  import {checkParams, makeArgs, unwrapParams, wrapParams} from './params.js';
12
12
  import {runWithProxyReq} from './proxy-context.js';
13
13
  import {tryWdProxy} from './proxy.js';
14
14
  import {CREATE_SESSION_COMMAND, DELETE_SESSION_COMMAND, METHOD_MAP} from './routes/index.js';
15
- import {extractProtocol, getLogger, getSessionId, isSessionCommand} from './session.js';
15
+ import {getLogger, getSessionId, isSessionCommand} from './session.js';
16
16
  import {getCommandValidator} from './validators.js';
17
17
 
18
18
  export const deprecatedCommandsLogged: Set<string> = new Set();
@@ -97,7 +97,6 @@ function buildHandler(
97
97
  let httpStatus = 200;
98
98
  let newSessionId: string | undefined;
99
99
  const sessionId = getSessionId(driver, req);
100
- let currentProtocol = extractProtocol(driver, sessionId);
101
100
 
102
101
  try {
103
102
  logDeprecationWarning(driver, method, path, spec, sessionId);
@@ -143,9 +142,8 @@ function buildHandler(
143
142
  );
144
143
 
145
144
  const result = didPluginOverrideProxy
146
- ? await runWithProxyReq(req, () => runDriverCommand(driver, command, args, sessionId, currentProtocol))
147
- : await runDriverCommand(driver, command, args, sessionId, currentProtocol);
148
- currentProtocol = result.currentProtocol;
145
+ ? await runWithProxyReq(req, () => runDriverCommand(driver, command, args, sessionId))
146
+ : await runDriverCommand(driver, command, args, sessionId);
149
147
  newSessionId = result.newSessionId;
150
148
  httpResBody.value = result.driverRes;
151
149
 
@@ -156,14 +154,13 @@ function buildHandler(
156
154
  })}`,
157
155
  );
158
156
  } catch (err) {
159
- currentProtocol = currentProtocol || extractProtocol(driver, sessionId || newSessionId);
160
157
  [httpStatus, httpResBody] = buildErrorResponse(err, driver, sessionId || newSessionId);
161
158
  }
162
159
 
163
160
  if (newSessionId && abandonIfDisconnected?.()) {
164
161
  await deleteAbandonedSession(driver, newSessionId);
165
162
  } else {
166
- sendHandlerResponse(res, httpStatus, httpResBody, newSessionId, currentProtocol);
163
+ sendHandlerResponse(res, httpStatus, httpResBody, newSessionId);
167
164
  }
168
165
  return newSessionId;
169
166
  };
@@ -325,44 +322,37 @@ function buildCommandArgs({req, jsonObj, spec, command, validateCommandArguments
325
322
 
326
323
  interface DriverCommandResult {
327
324
  driverRes: any;
328
- currentProtocol: keyof typeof PROTOCOLS;
329
325
  newSessionId?: string;
330
326
  }
331
327
 
332
328
  /**
333
- * Runs the driver command and interprets its result: resolves the protocol used for the
334
- * response, unpacks the createSession/deleteSession special cases, and raises W3C errors
335
- * embedded in the result value.
329
+ * Runs the driver command and interprets its result: unpacks the createSession/deleteSession
330
+ * special cases, and raises W3C errors embedded in the result value.
336
331
  */
337
332
  async function runDriverCommand(
338
333
  driver: Core<any>,
339
334
  command: string,
340
335
  args: any[],
341
336
  sessionId: string | undefined,
342
- currentProtocol: keyof typeof PROTOCOLS,
343
337
  ): Promise<DriverCommandResult> {
344
338
  let driverRes: any = await (driver as BaseDriver<any>).executeCommand(command, ...args);
345
339
 
346
- // Get the protocol after executeCommand
347
- currentProtocol = extractProtocol(driver, sessionId) || currentProtocol;
348
-
349
- // If `executeCommand` was overridden and the method returns an object
350
- // with a protocol and value/error property, re-assign the protocol
351
- if (util.isPlainObject(driverRes) && Object.hasOwn(driverRes, 'protocol')) {
352
- currentProtocol = (driverRes as {protocol?: keyof typeof PROTOCOLS}).protocol || currentProtocol;
340
+ // A marked envelope, or `{protocol, error}` when `error` is an Error.
341
+ // `{protocol: 'W3C', value}` is command data.
342
+ if (isProtocolResponseEnvelope(driverRes)) {
353
343
  if (driverRes.error) {
354
344
  throw driverRes.error;
355
345
  }
356
346
  driverRes = driverRes.value;
357
347
  }
358
348
 
349
+ // a protocol field on the unwrapped value means it is command data
350
+ const isProtocolData = util.isPlainObject(driverRes) && Object.hasOwn(driverRes, 'protocol');
351
+
359
352
  let newSessionId: string | undefined;
360
353
  // unpack createSession response
361
354
  if (command === CREATE_SESSION_COMMAND) {
362
355
  newSessionId = driverRes[0];
363
- getLogger(driver, newSessionId).debug(
364
- `Cached the protocol value '${currentProtocol}' for the new session ${newSessionId}`,
365
- );
366
356
  driverRes = {
367
357
  capabilities: driverRes[1],
368
358
  };
@@ -381,7 +371,7 @@ async function runDriverCommand(
381
371
  driverRes = null;
382
372
  }
383
373
 
384
- if (util.hasValue(driverRes) && util.isPlainObject(driverRes.value) && driverRes.value.error) {
374
+ if (!isProtocolData && util.hasValue(driverRes) && util.isPlainObject(driverRes.value) && driverRes.value.error) {
385
375
  throw errorFromW3CJsonCode(
386
376
  driverRes.value.error,
387
377
  driverRes.value.message,
@@ -390,7 +380,7 @@ async function runDriverCommand(
390
380
  );
391
381
  }
392
382
 
393
- return {driverRes, currentProtocol, newSessionId};
383
+ return {driverRes, newSessionId};
394
384
  }
395
385
 
396
386
  /**
@@ -440,13 +430,13 @@ function sendHandlerResponse(
440
430
  httpStatus: number,
441
431
  httpResBody: any,
442
432
  newSessionId: string | undefined,
443
- currentProtocol: keyof typeof PROTOCOLS,
444
433
  ): void {
445
434
  if (typeof httpResBody === 'string') {
446
435
  res.status(httpStatus).setHeader('content-type', 'application/json; charset=utf-8').send(httpResBody);
447
436
  return;
448
437
  }
449
- if (newSessionId && currentProtocol === PROTOCOLS.W3C) {
438
+ // Appium 4 only writes W3C responses, so the new session id is always part of the body.
439
+ if (newSessionId && util.isPlainObject(httpResBody.value)) {
450
440
  httpResBody.value.sessionId = newSessionId;
451
441
  }
452
442
  res.status(httpStatus).json(ensureW3cResponse(httpResBody));
@@ -2,7 +2,6 @@ import {logger} from '@appium/support';
2
2
  import type {AppiumLogger, Core} from '@appium/types';
3
3
  import type {Request} from 'express';
4
4
 
5
- import {PROTOCOLS} from '../constants.js';
6
5
  import {generateDriverLogPrefix} from '../helpers/log-prefix.js';
7
6
  import {NO_SESSION_ID_COMMANDS} from './routes/index.js';
8
7
 
@@ -43,25 +42,6 @@ export function isSessionCommand(command: string): boolean {
43
42
  return !NO_SESSION_ID_COMMANDS.includes(command);
44
43
  }
45
44
 
46
- /**
47
- * @param driver - Active driver, possibly an umbrella driver managing multiple sessions
48
- * @param sessionId - Id of the session to resolve the protocol for
49
- * @returns The active protocol for the given session
50
- */
51
- export function extractProtocol(driver: Core<any>, sessionId: string | null = null): keyof typeof PROTOCOLS {
52
- const dstDriver =
53
- typeof driver.driverForSession === 'function' && sessionId ? driver.driverForSession(sessionId) : driver;
54
- if (dstDriver === driver) {
55
- // Shortcircuit if the driver instance is not an umbrella driver
56
- // or it is Fake driver instance, where `driver.driverForSession`
57
- // always returns self instance
58
- return driver.protocol ?? PROTOCOLS.W3C;
59
- }
60
-
61
- // Extract the protocol for the current session if the given driver is the umbrella one
62
- return dstDriver?.protocol ?? PROTOCOLS.W3C;
63
- }
64
-
65
45
  /**
66
46
  * @param driver - Active driver, possibly an umbrella driver managing multiple sessions
67
47
  * @param sessionId - Id of the session to resolve the logger for
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@appium/base-driver",
3
- "version": "11.0.0-beta.6",
4
- "gitHead": "3d31d20e9e11010ec517c7803baf29434a7a2c89",
3
+ "version": "11.0.0-beta.7",
4
+ "gitHead": "8fead4e46c638a9d52334127fcaa20496d9b690e",
5
5
  "description": "Base driver class for Appium drivers",
6
6
  "keywords": [
7
7
  "android",
@@ -53,9 +53,9 @@
53
53
  "test:types": "tsd"
54
54
  },
55
55
  "dependencies": {
56
- "@appium/support": "^8.0.0-beta.6",
57
- "@appium/types": "~2.0.0-beta.5",
58
- "asyncbox": "^6.5.0",
56
+ "@appium/support": "^8.0.0-beta.7",
57
+ "@appium/types": "^2.0.0-beta.6",
58
+ "asyncbox": "^6.6.0",
59
59
  "axios": "^1.20.0",
60
60
  "lru-cache": "^11.5.2",
61
61
  "path-to-regexp": "^8.4.2",
@@ -67,6 +67,27 @@ export declare const AppiumConfigJsonSchema: {
67
67
  readonly title: "base-path config";
68
68
  readonly type: "string";
69
69
  };
70
+ readonly 'bidi-heartbeat-interval': {
71
+ readonly default: 15;
72
+ readonly description: "Number of seconds between WebSocket ping frames sent to each BiDi client. A connection that misses two consecutive pongs is terminated. A value of 0 disables the heartbeat.";
73
+ readonly minimum: 0;
74
+ readonly title: "bidi-heartbeat-interval config";
75
+ readonly type: "integer";
76
+ };
77
+ readonly 'bidi-max-buffered-bytes': {
78
+ readonly default: 33554432;
79
+ readonly description: "Maximum number of bytes the server may keep buffered for a single BiDi connection that is not reading fast enough. A connection that stays above this limit for longer than \"bidi-max-buffered-ms\" (or exceeds twice the limit) is closed with the code 1013. A value of 0 disables the limit, as well as skipping of droppable events.";
80
+ readonly minimum: 0;
81
+ readonly title: "bidi-max-buffered-bytes config";
82
+ readonly type: "integer";
83
+ };
84
+ readonly 'bidi-max-buffered-ms': {
85
+ readonly default: 30000;
86
+ readonly description: "Number of milliseconds a BiDi connection may stay above \"bidi-max-buffered-bytes\" before it is closed. A value of 0 closes the connection as soon as the limit is exceeded.";
87
+ readonly minimum: 0;
88
+ readonly title: "bidi-max-buffered-ms config";
89
+ readonly type: "integer";
90
+ };
70
91
  readonly 'default-capabilities': {
71
92
  readonly $comment: "TODO";
72
93
  readonly appiumCliAliases: readonly ["dc"];
@@ -1 +1 @@
1
- {"version":3,"file":"appium-config-schema.d.ts","sourceRoot":"","sources":["../../lib/appium-config-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAE7C;;;;GAIG;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCA4FP,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAwH3B,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgN7C,CAAC"}
1
+ {"version":3,"file":"appium-config-schema.d.ts","sourceRoot":"","sources":["../../lib/appium-config-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAE7C;;;;GAIG;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAoHP,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAwH3B,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgN7C,CAAC"}
@@ -67,6 +67,27 @@ export const AppiumConfigJsonSchema = {
67
67
  title: 'base-path config',
68
68
  type: 'string',
69
69
  },
70
+ 'bidi-heartbeat-interval': {
71
+ default: 15,
72
+ description: 'Number of seconds between WebSocket ping frames sent to each BiDi client. A connection that misses two consecutive pongs is terminated. A value of 0 disables the heartbeat.',
73
+ minimum: 0,
74
+ title: 'bidi-heartbeat-interval config',
75
+ type: 'integer',
76
+ },
77
+ 'bidi-max-buffered-bytes': {
78
+ default: 33554432,
79
+ description: 'Maximum number of bytes the server may keep buffered for a single BiDi connection that is not reading fast enough. A connection that stays above this limit for longer than "bidi-max-buffered-ms" (or exceeds twice the limit) is closed with the code 1013. A value of 0 disables the limit, as well as skipping of droppable events.',
80
+ minimum: 0,
81
+ title: 'bidi-max-buffered-bytes config',
82
+ type: 'integer',
83
+ },
84
+ 'bidi-max-buffered-ms': {
85
+ default: 30000,
86
+ description: 'Number of milliseconds a BiDi connection may stay above "bidi-max-buffered-bytes" before it is closed. A value of 0 closes the connection as soon as the limit is exceeded.',
87
+ minimum: 0,
88
+ title: 'bidi-max-buffered-ms config',
89
+ type: 'integer',
90
+ },
70
91
  'default-capabilities': {
71
92
  $comment: 'TODO',
72
93
  appiumCliAliases: ['dc'],