@appium/base-driver 8.7.3 → 9.0.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 (121) hide show
  1. package/build/lib/basedriver/capabilities.d.ts +11 -163
  2. package/build/lib/basedriver/capabilities.d.ts.map +1 -1
  3. package/build/lib/basedriver/capabilities.js +354 -236
  4. package/build/lib/basedriver/capabilities.js.map +1 -1
  5. package/build/lib/basedriver/commands/event.d.ts +7 -6
  6. package/build/lib/basedriver/commands/event.d.ts.map +1 -1
  7. package/build/lib/basedriver/commands/event.js +55 -35
  8. package/build/lib/basedriver/commands/event.js.map +1 -1
  9. package/build/lib/basedriver/commands/execute.d.ts +7 -6
  10. package/build/lib/basedriver/commands/execute.d.ts.map +1 -1
  11. package/build/lib/basedriver/commands/execute.js +66 -58
  12. package/build/lib/basedriver/commands/execute.js.map +1 -1
  13. package/build/lib/basedriver/commands/find.d.ts +9 -7
  14. package/build/lib/basedriver/commands/find.d.ts.map +1 -1
  15. package/build/lib/basedriver/commands/find.js +102 -54
  16. package/build/lib/basedriver/commands/find.js.map +1 -1
  17. package/build/lib/basedriver/commands/index.d.ts +3 -7
  18. package/build/lib/basedriver/commands/index.d.ts.map +1 -1
  19. package/build/lib/basedriver/commands/index.js +30 -33
  20. package/build/lib/basedriver/commands/index.js.map +1 -1
  21. package/build/lib/basedriver/commands/log.d.ts +8 -9
  22. package/build/lib/basedriver/commands/log.d.ts.map +1 -1
  23. package/build/lib/basedriver/commands/log.js +54 -38
  24. package/build/lib/basedriver/commands/log.js.map +1 -1
  25. package/build/lib/basedriver/commands/session.d.ts +7 -6
  26. package/build/lib/basedriver/commands/session.d.ts.map +1 -1
  27. package/build/lib/basedriver/commands/session.js +46 -39
  28. package/build/lib/basedriver/commands/session.js.map +1 -1
  29. package/build/lib/basedriver/commands/settings.d.ts +7 -7
  30. package/build/lib/basedriver/commands/settings.d.ts.map +1 -1
  31. package/build/lib/basedriver/commands/settings.js +35 -28
  32. package/build/lib/basedriver/commands/settings.js.map +1 -1
  33. package/build/lib/basedriver/commands/timeout.d.ts +7 -5
  34. package/build/lib/basedriver/commands/timeout.d.ts.map +1 -1
  35. package/build/lib/basedriver/commands/timeout.js +144 -162
  36. package/build/lib/basedriver/commands/timeout.js.map +1 -1
  37. package/build/lib/basedriver/core.d.ts +6 -157
  38. package/build/lib/basedriver/core.d.ts.map +1 -1
  39. package/build/lib/basedriver/core.js +361 -230
  40. package/build/lib/basedriver/core.js.map +1 -1
  41. package/build/lib/basedriver/desired-caps.js +80 -110
  42. package/build/lib/basedriver/desired-caps.js.map +1 -1
  43. package/build/lib/basedriver/device-settings.js +57 -62
  44. package/build/lib/basedriver/device-settings.js.map +1 -1
  45. package/build/lib/basedriver/driver.d.ts +11 -262
  46. package/build/lib/basedriver/driver.d.ts.map +1 -1
  47. package/build/lib/basedriver/driver.js +362 -262
  48. package/build/lib/basedriver/driver.js.map +1 -1
  49. package/build/lib/basedriver/helpers.js +500 -495
  50. package/build/lib/basedriver/helpers.js.map +1 -1
  51. package/build/lib/basedriver/logger.d.ts +1 -1
  52. package/build/lib/basedriver/logger.d.ts.map +1 -1
  53. package/build/lib/basedriver/logger.js +5 -15
  54. package/build/lib/basedriver/logger.js.map +1 -1
  55. package/build/lib/constants.js +14 -14
  56. package/build/lib/constants.js.map +1 -1
  57. package/build/lib/express/crash.js +8 -15
  58. package/build/lib/express/crash.js.map +1 -1
  59. package/build/lib/express/express-logging.js +49 -59
  60. package/build/lib/express/express-logging.js.map +1 -1
  61. package/build/lib/express/idempotency.js +125 -177
  62. package/build/lib/express/idempotency.js.map +1 -1
  63. package/build/lib/express/logger.d.ts +1 -1
  64. package/build/lib/express/logger.d.ts.map +1 -1
  65. package/build/lib/express/logger.js +5 -15
  66. package/build/lib/express/logger.js.map +1 -1
  67. package/build/lib/express/middleware.js +82 -107
  68. package/build/lib/express/middleware.js.map +1 -1
  69. package/build/lib/express/server.d.ts +17 -5
  70. package/build/lib/express/server.d.ts.map +1 -1
  71. package/build/lib/express/server.js +259 -224
  72. package/build/lib/express/server.js.map +1 -1
  73. package/build/lib/express/static.js +64 -81
  74. package/build/lib/express/static.js.map +1 -1
  75. package/build/lib/express/websocket.js +115 -87
  76. package/build/lib/express/websocket.js.map +1 -1
  77. package/build/lib/helpers/capabilities.d.ts +1 -59
  78. package/build/lib/helpers/capabilities.d.ts.map +1 -1
  79. package/build/lib/helpers/capabilities.js +72 -69
  80. package/build/lib/helpers/capabilities.js.map +1 -1
  81. package/build/lib/index.js +64 -180
  82. package/build/lib/index.js.map +1 -1
  83. package/build/lib/jsonwp-proxy/protocol-converter.js +215 -227
  84. package/build/lib/jsonwp-proxy/protocol-converter.js.map +1 -1
  85. package/build/lib/jsonwp-proxy/proxy.d.ts.map +1 -1
  86. package/build/lib/jsonwp-proxy/proxy.js +355 -393
  87. package/build/lib/jsonwp-proxy/proxy.js.map +1 -1
  88. package/build/lib/jsonwp-status/status.js +119 -130
  89. package/build/lib/jsonwp-status/status.js.map +1 -1
  90. package/build/lib/protocol/errors.d.ts +135 -32
  91. package/build/lib/protocol/errors.d.ts.map +1 -1
  92. package/build/lib/protocol/errors.js +871 -919
  93. package/build/lib/protocol/errors.js.map +1 -1
  94. package/build/lib/protocol/helpers.js +37 -37
  95. package/build/lib/protocol/helpers.js.map +1 -1
  96. package/build/lib/protocol/index.js +22 -109
  97. package/build/lib/protocol/index.js.map +1 -1
  98. package/build/lib/protocol/protocol.js +394 -350
  99. package/build/lib/protocol/protocol.js.map +1 -1
  100. package/build/lib/protocol/routes.d.ts +1238 -4
  101. package/build/lib/protocol/routes.d.ts.map +1 -1
  102. package/build/lib/protocol/routes.js +964 -1327
  103. package/build/lib/protocol/routes.js.map +1 -1
  104. package/build/lib/protocol/validators.js +32 -39
  105. package/build/lib/protocol/validators.js.map +1 -1
  106. package/build/tsconfig.tsbuildinfo +1 -1
  107. package/lib/basedriver/capabilities.js +80 -39
  108. package/lib/basedriver/commands/event.js +10 -5
  109. package/lib/basedriver/commands/execute.js +14 -9
  110. package/lib/basedriver/commands/find.js +18 -12
  111. package/lib/basedriver/commands/index.js +21 -16
  112. package/lib/basedriver/commands/log.js +24 -18
  113. package/lib/basedriver/commands/session.js +10 -5
  114. package/lib/basedriver/commands/settings.js +9 -6
  115. package/lib/basedriver/commands/timeout.js +10 -4
  116. package/lib/basedriver/core.js +2 -3
  117. package/lib/basedriver/driver.js +12 -16
  118. package/lib/express/server.js +6 -3
  119. package/lib/protocol/errors.js +155 -44
  120. package/lib/protocol/routes.js +11 -7
  121. package/package.json +14 -16
@@ -45,9 +45,12 @@ export class NoSuchDriverError extends ProtocolError {
45
45
  static error() {
46
46
  return 'invalid session id';
47
47
  }
48
- constructor(err) {
48
+ /**
49
+ * @param {string} [message] error message
50
+ */
51
+ constructor(message) {
49
52
  super(
50
- err || 'A session is either terminated or not started',
53
+ message || 'A session is either terminated or not started',
51
54
  NoSuchDriverError.code(),
52
55
  NoSuchDriverError.w3cStatus(),
53
56
  NoSuchDriverError.error()
@@ -65,9 +68,13 @@ export class NoSuchElementError extends ProtocolError {
65
68
  static error() {
66
69
  return 'no such element';
67
70
  }
68
- constructor(err) {
71
+ /**
72
+ * @param {string} [message] error message
73
+ */
74
+ constructor(message) {
69
75
  super(
70
- err || 'An element could not be located on the page using the given ' + 'search parameters.',
76
+ message ||
77
+ 'An element could not be located on the page using the given ' + 'search parameters.',
71
78
  NoSuchElementError.code(),
72
79
  NoSuchElementError.w3cStatus(),
73
80
  NoSuchElementError.error()
@@ -85,9 +92,13 @@ export class NoSuchFrameError extends ProtocolError {
85
92
  static w3cStatus() {
86
93
  return HTTPStatusCodes.NOT_FOUND;
87
94
  }
88
- constructor(err) {
95
+ /**
96
+ *
97
+ * @param {string} [message]
98
+ */
99
+ constructor(message) {
89
100
  super(
90
- err ||
101
+ message ||
91
102
  'A request to switch to a frame could not be satisfied because ' +
92
103
  'the frame could not be found.',
93
104
  NoSuchFrameError.code(),
@@ -107,9 +118,13 @@ export class UnknownCommandError extends ProtocolError {
107
118
  static error() {
108
119
  return 'unknown command';
109
120
  }
110
- constructor(err) {
121
+ /**
122
+ *
123
+ * @param {string} [message]
124
+ */
125
+ constructor(message) {
111
126
  super(
112
- err ||
127
+ message ||
113
128
  'The requested resource could not be found, or a request was ' +
114
129
  'received using an HTTP method that is not supported by the mapped ' +
115
130
  'resource.',
@@ -130,9 +145,13 @@ export class StaleElementReferenceError extends ProtocolError {
130
145
  static error() {
131
146
  return 'stale element reference';
132
147
  }
133
- constructor(err) {
148
+ /**
149
+ *
150
+ * @param {string} [message]
151
+ */
152
+ constructor(message) {
134
153
  super(
135
- err ||
154
+ message ||
136
155
  'An element command failed because the referenced element is no ' +
137
156
  'longer attached to the DOM.',
138
157
  StaleElementReferenceError.code(),
@@ -152,9 +171,12 @@ export class ElementNotVisibleError extends ProtocolError {
152
171
  static error() {
153
172
  return 'element not visible';
154
173
  }
155
- constructor(err) {
174
+ /**
175
+ * @param {string} [message] error message
176
+ */
177
+ constructor(message) {
156
178
  super(
157
- err ||
179
+ message ||
158
180
  'An element command could not be completed because the element is ' +
159
181
  'not visible on the page.',
160
182
  ElementNotVisibleError.code(),
@@ -174,9 +196,13 @@ export class InvalidElementStateError extends ProtocolError {
174
196
  static error() {
175
197
  return 'invalid element state';
176
198
  }
177
- constructor(err) {
199
+ /**
200
+ *
201
+ * @param {string} [message]
202
+ */
203
+ constructor(message) {
178
204
  super(
179
- err ||
205
+ message ||
180
206
  'An element command could not be completed because the element is ' +
181
207
  'in an invalid state (e.g. attempting to click a disabled element).',
182
208
  InvalidElementStateError.code(),
@@ -217,9 +243,13 @@ export class UnknownMethodError extends ProtocolError {
217
243
  static error() {
218
244
  return 'unknown method';
219
245
  }
220
- constructor(err) {
246
+ /**
247
+ * @param {string} [message] error message
248
+ */
249
+ constructor(message) {
221
250
  super(
222
- err || 'The requested command matched a known URL but did not match an method for that URL',
251
+ message ||
252
+ 'The requested command matched a known URL but did not match an method for that URL',
223
253
  UnknownMethodError.code(),
224
254
  UnknownMethodError.w3cStatus(),
225
255
  UnknownMethodError.error()
@@ -237,9 +267,12 @@ export class UnsupportedOperationError extends ProtocolError {
237
267
  static error() {
238
268
  return 'unsupported operation';
239
269
  }
240
- constructor(err) {
270
+ /**
271
+ * @param {string} [message] error message
272
+ */
273
+ constructor(message) {
241
274
  super(
242
- err || 'A server-side error occurred. Command cannot be supported.',
275
+ message || 'A server-side error occurred. Command cannot be supported.',
243
276
  UnsupportedOperationError.code(),
244
277
  UnsupportedOperationError.w3cStatus(),
245
278
  UnsupportedOperationError.error()
@@ -257,9 +290,12 @@ export class ElementIsNotSelectableError extends ProtocolError {
257
290
  static w3cStatus() {
258
291
  return HTTPStatusCodes.BAD_REQUEST;
259
292
  }
260
- constructor(err) {
293
+ /**
294
+ * @param {string} [message] error message
295
+ */
296
+ constructor(message) {
261
297
  super(
262
- err || 'An attempt was made to select an element that cannot be selected.',
298
+ message || 'An attempt was made to select an element that cannot be selected.',
263
299
  ElementIsNotSelectableError.code(),
264
300
  ElementIsNotSelectableError.w3cStatus(),
265
301
  ElementIsNotSelectableError.error()
@@ -277,9 +313,12 @@ export class ElementClickInterceptedError extends ProtocolError {
277
313
  static w3cStatus() {
278
314
  return HTTPStatusCodes.BAD_REQUEST;
279
315
  }
280
- constructor(err) {
316
+ /**
317
+ * @param {string} [message] error message
318
+ */
319
+ constructor(message) {
281
320
  super(
282
- err ||
321
+ message ||
283
322
  'The Element Click command could not be completed because the element receiving ' +
284
323
  'the events is obscuring the element that was requested clicked',
285
324
  ElementClickInterceptedError.code(),
@@ -299,9 +338,12 @@ export class ElementNotInteractableError extends ProtocolError {
299
338
  static w3cStatus() {
300
339
  return HTTPStatusCodes.BAD_REQUEST;
301
340
  }
302
- constructor(err) {
341
+ /**
342
+ * @param {string} [message] error message
343
+ */
344
+ constructor(message) {
303
345
  super(
304
- err ||
346
+ message ||
305
347
  'A command could not be completed because the element is not pointer- or keyboard interactable',
306
348
  ElementNotInteractableError.code(),
307
349
  ElementNotInteractableError.w3cStatus(),
@@ -314,9 +356,12 @@ export class InsecureCertificateError extends ProtocolError {
314
356
  static error() {
315
357
  return 'insecure certificate';
316
358
  }
317
- constructor(err) {
359
+ /**
360
+ * @param {string} [message] error message
361
+ */
362
+ constructor(message) {
318
363
  super(
319
- err ||
364
+ message ||
320
365
  'Navigation caused the user agent to hit a certificate warning, which is usually the result of an expired or invalid TLS certificate',
321
366
  ElementIsNotSelectableError.code(),
322
367
  null,
@@ -335,9 +380,12 @@ export class JavaScriptError extends ProtocolError {
335
380
  static error() {
336
381
  return 'javascript error';
337
382
  }
338
- constructor(err) {
383
+ /**
384
+ * @param {string} [message] error message
385
+ */
386
+ constructor(message) {
339
387
  super(
340
- err || 'An error occurred while executing user supplied JavaScript.',
388
+ message || 'An error occurred while executing user supplied JavaScript.',
341
389
  JavaScriptError.code(),
342
390
  JavaScriptError.w3cStatus(),
343
391
  JavaScriptError.error()
@@ -355,9 +403,12 @@ export class XPathLookupError extends ProtocolError {
355
403
  static error() {
356
404
  return 'invalid selector';
357
405
  }
358
- constructor(err) {
406
+ /**
407
+ * @param {string} [message] error message
408
+ */
409
+ constructor(message) {
359
410
  super(
360
- err || 'An error occurred while searching for an element by XPath.',
411
+ message || 'An error occurred while searching for an element by XPath.',
361
412
  XPathLookupError.code(),
362
413
  XPathLookupError.w3cStatus(),
363
414
  XPathLookupError.error()
@@ -375,9 +426,12 @@ export class TimeoutError extends ProtocolError {
375
426
  static error() {
376
427
  return 'timeout';
377
428
  }
378
- constructor(err) {
429
+ /**
430
+ * @param {string} [message] error message
431
+ */
432
+ constructor(message) {
379
433
  super(
380
- err || 'An operation did not complete before its timeout expired.',
434
+ message || 'An operation did not complete before its timeout expired.',
381
435
  TimeoutError.code(),
382
436
  TimeoutError.w3cStatus(),
383
437
  TimeoutError.error()
@@ -395,9 +449,12 @@ export class NoSuchWindowError extends ProtocolError {
395
449
  static w3cStatus() {
396
450
  return HTTPStatusCodes.NOT_FOUND;
397
451
  }
398
- constructor(err) {
452
+ /**
453
+ * @param {string} [message] error message
454
+ */
455
+ constructor(message) {
399
456
  super(
400
- err ||
457
+ message ||
401
458
  'A request to switch to a different window could not be satisfied ' +
402
459
  'because the window could not be found.',
403
460
  NoSuchWindowError.code(),
@@ -417,6 +474,9 @@ export class InvalidArgumentError extends ProtocolError {
417
474
  static w3cStatus() {
418
475
  return HTTPStatusCodes.BAD_REQUEST;
419
476
  }
477
+ /**
478
+ * @param {string} [err] error message
479
+ */
420
480
  constructor(err) {
421
481
  super(
422
482
  err || 'The arguments passed to the command are either invalid or malformed',
@@ -437,6 +497,9 @@ export class InvalidCookieDomainError extends ProtocolError {
437
497
  static w3cStatus() {
438
498
  return HTTPStatusCodes.BAD_REQUEST;
439
499
  }
500
+ /**
501
+ * @param {string} [err] error message
502
+ */
440
503
  constructor(err) {
441
504
  super(
442
505
  err ||
@@ -459,6 +522,9 @@ export class NoSuchCookieError extends ProtocolError {
459
522
  static error() {
460
523
  return 'no such cookie';
461
524
  }
525
+ /**
526
+ * @param {string} [err] error message
527
+ */
462
528
  constructor(err) {
463
529
  super(
464
530
  err ||
@@ -480,6 +546,9 @@ export class UnableToSetCookieError extends ProtocolError {
480
546
  static error() {
481
547
  return 'unable to set cookie';
482
548
  }
549
+ /**
550
+ * @param {string} [err] error message
551
+ */
483
552
  constructor(err) {
484
553
  super(
485
554
  err || "A request to set a cookie's value could not be satisfied.",
@@ -500,9 +569,12 @@ export class UnexpectedAlertOpenError extends ProtocolError {
500
569
  static error() {
501
570
  return 'unexpected alert open';
502
571
  }
503
- constructor(err) {
572
+ /**
573
+ * @param {string} [message] error message
574
+ */
575
+ constructor(message) {
504
576
  super(
505
- err || 'A modal dialog was open, blocking this operation',
577
+ message || 'A modal dialog was open, blocking this operation',
506
578
  UnexpectedAlertOpenError.code(),
507
579
  UnexpectedAlertOpenError.w3cStatus(),
508
580
  UnexpectedAlertOpenError.error()
@@ -520,9 +592,13 @@ export class NoAlertOpenError extends ProtocolError {
520
592
  static error() {
521
593
  return 'no such alert';
522
594
  }
523
- constructor(err) {
595
+ /**
596
+ *
597
+ * @param {string} [message]
598
+ */
599
+ constructor(message) {
524
600
  super(
525
- err || 'An attempt was made to operate on a modal dialog when one ' + 'was not open.',
601
+ message || 'An attempt was made to operate on a modal dialog when one ' + 'was not open.',
526
602
  NoAlertOpenError.code(),
527
603
  NoAlertOpenError.w3cStatus(),
528
604
  NoAlertOpenError.error()
@@ -542,6 +618,9 @@ export class ScriptTimeoutError extends ProtocolError {
542
618
  static error() {
543
619
  return 'script timeout';
544
620
  }
621
+ /**
622
+ * @param {string} [err] error message
623
+ */
545
624
  constructor(err) {
546
625
  super(
547
626
  err || 'A script did not complete before its timeout expired.',
@@ -562,6 +641,9 @@ export class InvalidElementCoordinatesError extends ProtocolError {
562
641
  static error() {
563
642
  return 'invalid coordinates';
564
643
  }
644
+ /**
645
+ * @param {string} [err] error message
646
+ */
565
647
  constructor(err) {
566
648
  super(
567
649
  err || 'The coordinates provided to an interactions operation are invalid.',
@@ -584,9 +666,12 @@ export class IMENotAvailableError extends ProtocolError {
584
666
  static error() {
585
667
  return 'unsupported operation';
586
668
  }
587
- constructor(err) {
669
+ /**
670
+ * @param {string} [message] error message
671
+ */
672
+ constructor(message) {
588
673
  super(
589
- err || 'IME was not available.',
674
+ message || 'IME was not available.',
590
675
  IMENotAvailableError.code(),
591
676
  IMENotAvailableError.w3cStatus(),
592
677
  IMENotAvailableError.error()
@@ -604,6 +689,9 @@ export class IMEEngineActivationFailedError extends ProtocolError {
604
689
  static error() {
605
690
  return 'unsupported operation';
606
691
  }
692
+ /**
693
+ * @param {string} [err] error message
694
+ */
607
695
  constructor(err) {
608
696
  super(
609
697
  err || 'An IME engine could not be started.',
@@ -624,6 +712,9 @@ export class InvalidSelectorError extends ProtocolError {
624
712
  static error() {
625
713
  return 'invalid selector';
626
714
  }
715
+ /**
716
+ * @param {string} [err] error message
717
+ */
627
718
  constructor(err) {
628
719
  super(
629
720
  err || 'Argument was an invalid selector (e.g. XPath/CSS).',
@@ -669,6 +760,9 @@ export class MoveTargetOutOfBoundsError extends ProtocolError {
669
760
  static error() {
670
761
  return 'move target out of bounds';
671
762
  }
763
+ /**
764
+ * @param {string} [err] error message
765
+ */
672
766
  constructor(err) {
673
767
  super(
674
768
  err || 'Target provided for a move action is out of bounds.',
@@ -683,8 +777,12 @@ export class NoSuchContextError extends ProtocolError {
683
777
  static code() {
684
778
  return 35;
685
779
  }
686
- constructor(err) {
687
- super(err || 'No such context found.', NoSuchContextError.code());
780
+ /**
781
+ *
782
+ * @param {string} [message]
783
+ */
784
+ constructor(message) {
785
+ super(message || 'No such context found.', NoSuchContextError.code());
688
786
  }
689
787
  }
690
788
 
@@ -692,9 +790,13 @@ export class InvalidContextError extends ProtocolError {
692
790
  static code() {
693
791
  return 36;
694
792
  }
695
- constructor(err) {
793
+ /**
794
+ *
795
+ * @param {string} [message]
796
+ */
797
+ constructor(message) {
696
798
  super(
697
- err || 'That command could not be executed in the current context.',
799
+ message || 'That command could not be executed in the current context.',
698
800
  InvalidContextError.code()
699
801
  );
700
802
  }
@@ -702,11 +804,17 @@ export class InvalidContextError extends ProtocolError {
702
804
 
703
805
  // These are aliases for UnknownMethodError
704
806
  export class NotYetImplementedError extends UnknownMethodError {
807
+ /**
808
+ * @param {string} [err] error message
809
+ */
705
810
  constructor(err) {
706
811
  super(err || 'Method has not yet been implemented');
707
812
  }
708
813
  }
709
814
  export class NotImplementedError extends UnknownMethodError {
815
+ /**
816
+ * @param {string} [err] error message
817
+ */
710
818
  constructor(err) {
711
819
  super(err || 'Method is not implemented');
712
820
  }
@@ -722,6 +830,9 @@ export class UnableToCaptureScreen extends ProtocolError {
722
830
  static error() {
723
831
  return 'unable to capture screen';
724
832
  }
833
+ /**
834
+ * @param {string} [err] error message
835
+ */
725
836
  constructor(err) {
726
837
  super(
727
838
  err || 'A screen capture was made impossible',
@@ -18,9 +18,8 @@ const SET_ALERT_TEXT_PAYLOAD_PARAMS = {
18
18
  * define the routes, mapping of HTTP methods to particular driver commands, and
19
19
  * any parameters that are expected in a request parameters can be `required` or
20
20
  * `optional`
21
- * @type {MethodMap}
22
21
  */
23
- const METHOD_MAP = {
22
+ const METHOD_MAP = /** @type {const} */ ({
24
23
  '/status': {
25
24
  GET: {command: 'getStatus'},
26
25
  },
@@ -915,7 +914,7 @@ const METHOD_MAP = {
915
914
  },
916
915
 
917
916
  //endregion
918
- };
917
+ });
919
918
 
920
919
  // driver command names
921
920
  let ALL_COMMANDS = [];
@@ -991,9 +990,9 @@ function routeToCommandName(endpoint, method, basePath = DEFAULT_BASE_PATH) {
991
990
  }
992
991
  if (!dstRoute) return; // eslint-disable-line curly
993
992
 
994
- const methods = _.get(METHOD_MAP, dstRoute);
993
+ const methods = METHOD_MAP[dstRoute];
995
994
  method = /** @type {Uppercase<typeof method>} */ (_.toUpper(method));
996
- if (_.has(methods, method)) {
995
+ if (method in methods) {
997
996
  const dstMethod = _.get(methods, method);
998
997
  if (dstMethod.command) {
999
998
  return dstMethod.command;
@@ -1007,6 +1006,11 @@ const NO_SESSION_ID_COMMANDS = ['createSession', 'getStatus', 'getSessions'];
1007
1006
  export {METHOD_MAP, ALL_COMMANDS, NO_SESSION_ID_COMMANDS, routeToCommandName};
1008
1007
 
1009
1008
  /**
1010
- * @typedef {import('@appium/types').Driver} Driver
1011
- * @typedef {import('@appium/types').MethodMap} MethodMap
1009
+ * This checks compat with the `MethodMap` interface.
1010
+ * @ignore
1012
1011
  */
1012
+ // eslint-disable-next-line no-unused-vars
1013
+ const _validMethodMap =
1014
+ /** @type {import('@appium/types').MethodMap<import('@appium/types').ExternalDriver<import('@appium/types').BaseDriverCapConstraints>>} */ (
1015
+ METHOD_MAP
1016
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appium/base-driver",
3
- "version": "8.7.3",
3
+ "version": "9.0.0",
4
4
  "description": "Base driver class for Appium drivers",
5
5
  "keywords": [
6
6
  "automation",
@@ -23,6 +23,7 @@
23
23
  },
24
24
  "license": "Apache-2.0",
25
25
  "author": "https://github.com/appium",
26
+ "types": "./build/lib/index.d.ts",
26
27
  "directories": {
27
28
  "lib": "lib"
28
29
  },
@@ -34,48 +35,45 @@
34
35
  "build"
35
36
  ],
36
37
  "scripts": {
37
- "build": "babel lib --root-mode=upward --out-dir=build/lib",
38
- "dev": "npm run build -- --watch",
39
- "fix": "npm run lint -- --fix",
40
- "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
41
- "prepare": "npm run build",
42
38
  "test": "npm run test:unit",
43
39
  "test:e2e": "mocha --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
44
40
  "test:smoke": "node ./index.js",
45
41
  "test:unit": "mocha \"./test/unit/**/*.spec.js\""
46
42
  },
47
43
  "dependencies": {
48
- "@appium/support": "^2.61.1",
44
+ "@appium/support": "^3.0.0",
49
45
  "@colors/colors": "1.5.0",
50
46
  "@types/async-lock": "1.3.0",
51
- "@types/bluebird": "3.5.37",
47
+ "@types/bluebird": "3.5.38",
52
48
  "@types/express": "4.17.14",
53
49
  "@types/method-override": "0.0.32",
54
50
  "@types/serve-favicon": "2.5.3",
55
- "async-lock": "1.3.2",
56
- "asyncbox": "2.9.2",
57
- "axios": "0.27.2",
51
+ "async-lock": "1.4.0",
52
+ "asyncbox": "2.9.4",
53
+ "axios": "1.2.1",
58
54
  "bluebird": "3.7.2",
59
55
  "body-parser": "1.20.1",
60
56
  "es6-error": "4.1.1",
61
57
  "express": "4.18.2",
62
58
  "http-status-codes": "2.2.0",
63
59
  "lodash": "4.17.21",
64
- "lru-cache": "7.14.0",
60
+ "lru-cache": "7.14.1",
65
61
  "method-override": "3.0.0",
66
62
  "morgan": "1.10.0",
67
63
  "serve-favicon": "2.5.0",
68
64
  "source-map-support": "0.5.21",
69
- "type-fest": "3.1.0",
65
+ "type-fest": "3.3.0",
70
66
  "validate.js": "0.13.1"
71
67
  },
72
68
  "engines": {
73
- "node": ">=14",
69
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0",
74
70
  "npm": ">=8"
75
71
  },
76
72
  "publishConfig": {
77
73
  "access": "public"
78
74
  },
79
- "types": "./build/lib/index.d.ts",
80
- "gitHead": "6b3cc1a8743f78c1f50320364f25f3011d2b2136"
75
+ "gitHead": "0823f0b60e40395cd1dc3b72cfa3c0092bc81302",
76
+ "typedoc": {
77
+ "entryPoint": "./build/lib/index.js"
78
+ }
81
79
  }