selenium-webdriver 4.16.0 → 4.18.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 (65) hide show
  1. package/CHANGES.md +253 -196
  2. package/LICENSE +1 -1
  3. package/NOTICE +1 -1
  4. package/bidi/addInterceptParameters.js +86 -0
  5. package/bidi/browsingContext.js +167 -38
  6. package/bidi/browsingContextInspector.js +13 -40
  7. package/bidi/evaluateResult.js +4 -10
  8. package/bidi/filterBy.js +2 -6
  9. package/bidi/index.js +31 -29
  10. package/bidi/input.js +97 -0
  11. package/bidi/interceptPhase.js +24 -0
  12. package/bidi/logInspector.js +15 -20
  13. package/bidi/network.js +178 -0
  14. package/bidi/networkInspector.js +12 -2
  15. package/bidi/networkTypes.js +22 -49
  16. package/bidi/protocolType.js +4 -9
  17. package/bidi/protocolValue.js +48 -17
  18. package/bidi/realmInfo.js +3 -10
  19. package/bidi/scriptManager.js +60 -48
  20. package/bidi/scriptTypes.js +58 -0
  21. package/bidi/urlPattern.js +58 -0
  22. package/bin/linux/selenium-manager +0 -0
  23. package/bin/macos/selenium-manager +0 -0
  24. package/bin/windows/selenium-manager.exe +0 -0
  25. package/chrome.js +2 -14
  26. package/chromium.js +28 -143
  27. package/common/driverFinder.js +1 -1
  28. package/common/seleniumManager.js +5 -12
  29. package/devtools/CDPConnection.js +1 -3
  30. package/edge.js +1 -3
  31. package/example/chrome_android.js +2 -5
  32. package/example/chrome_mobile_emulation.js +2 -4
  33. package/example/google_search.js +1 -3
  34. package/example/headless.js +4 -10
  35. package/example/logging.js +3 -9
  36. package/firefox.js +37 -111
  37. package/http/index.js +7 -10
  38. package/ie.js +5 -15
  39. package/index.js +10 -32
  40. package/io/exec.js +1 -2
  41. package/io/index.js +3 -3
  42. package/io/zip.js +8 -30
  43. package/lib/atoms/find-elements.js +1 -1
  44. package/lib/atoms/get-attribute.js +6 -100
  45. package/lib/by.js +2 -9
  46. package/lib/capabilities.js +8 -7
  47. package/lib/command.js +4 -0
  48. package/lib/error.js +2 -9
  49. package/lib/http.js +37 -130
  50. package/lib/input.js +22 -34
  51. package/lib/logging.js +3 -11
  52. package/lib/promise.js +2 -7
  53. package/lib/select.js +3 -9
  54. package/lib/until.js +28 -49
  55. package/lib/util.js +1 -4
  56. package/lib/virtual_authenticator.js +4 -22
  57. package/lib/webdriver.js +146 -269
  58. package/lib/webelement.js +1 -5
  59. package/net/index.js +1 -4
  60. package/package.json +2 -1
  61. package/remote/index.js +9 -24
  62. package/remote/util.js +6 -19
  63. package/safari.js +3 -8
  64. package/testing/index.js +6 -11
  65. package/example/firefox_channels.js +0 -84
package/bidi/input.js ADDED
@@ -0,0 +1,97 @@
1
+ // Licensed to the Software Freedom Conservancy (SFC) under one
2
+ // or more contributor license agreements. See the NOTICE file
3
+ // distributed with this work for additional information
4
+ // regarding copyright ownership. The SFC licenses this file
5
+ // to you under the Apache License, Version 2.0 (the
6
+ // "License"); you may not use this file except in compliance
7
+ // with the License. You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing,
12
+ // software distributed under the License is distributed on an
13
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ // KIND, either express or implied. See the License for the
15
+ // specific language governing permissions and limitations
16
+ // under the License.
17
+
18
+ // type: module added to package.json
19
+ // import { WebElement } from '../lib/webdriver'
20
+ const { WebElement } = require('../lib/webdriver')
21
+
22
+ class Input {
23
+ constructor(driver) {
24
+ this._driver = driver
25
+ }
26
+
27
+ async init() {
28
+ if (!(await this._driver.getCapabilities()).get('webSocketUrl')) {
29
+ throw Error('WebDriver instance must support BiDi protocol')
30
+ }
31
+
32
+ this.bidi = await this._driver.getBidi()
33
+ }
34
+
35
+ async perform(browsingContextId, actions) {
36
+ const _actions = await updateActions(actions)
37
+
38
+ const command = {
39
+ method: 'input.performActions',
40
+ params: {
41
+ context: browsingContextId,
42
+ actions: _actions,
43
+ },
44
+ }
45
+
46
+ let response = await this.bidi.send(command)
47
+
48
+ return response
49
+ }
50
+
51
+ async release(browsingContextId) {
52
+ const command = {
53
+ method: 'input.releaseActions',
54
+ params: {
55
+ context: browsingContextId,
56
+ },
57
+ }
58
+ return await this.bidi.send(command)
59
+ }
60
+ }
61
+
62
+ async function updateActions(actions) {
63
+ const _actions = []
64
+ for (const action of actions) {
65
+ const sequenceList = action.actions
66
+ let updatedSequenceList = []
67
+
68
+ if (action.type === 'pointer' || action.type === 'wheel') {
69
+ for (const sequence of sequenceList) {
70
+ if ((sequence.type === 'pointerMove' || sequence.type === 'scroll') && sequence.origin instanceof WebElement) {
71
+ const element = sequence.origin
72
+ const elementId = await element.getId()
73
+ sequence.origin = {
74
+ type: 'element',
75
+ element: { sharedId: elementId },
76
+ }
77
+ }
78
+ updatedSequenceList.push(sequence)
79
+ }
80
+
81
+ const updatedAction = { ...action, actions: updatedSequenceList }
82
+ _actions.push(updatedAction)
83
+ } else {
84
+ _actions.push(action)
85
+ }
86
+ }
87
+
88
+ return _actions
89
+ }
90
+
91
+ async function getInputInstance(driver) {
92
+ let instance = new Input(driver)
93
+ await instance.init()
94
+ return instance
95
+ }
96
+
97
+ module.exports = getInputInstance
@@ -0,0 +1,24 @@
1
+ // Licensed to the Software Freedom Conservancy (SFC) under one
2
+ // or more contributor license agreements. See the NOTICE file
3
+ // distributed with this work for additional information
4
+ // regarding copyright ownership. The SFC licenses this file
5
+ // to you under the Apache License, Version 2.0 (the
6
+ // "License"); you may not use this file except in compliance
7
+ // with the License. You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing,
12
+ // software distributed under the License is distributed on an
13
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ // KIND, either express or implied. See the License for the
15
+ // specific language governing permissions and limitations
16
+ // under the License.
17
+
18
+ const InterceptPhase = {
19
+ BEFORE_REQUEST_SENT: 'beforeRequestSent',
20
+ RESPONSE_STARTED: 'responseStarted',
21
+ AUTH_REQUIRED: 'authRequired',
22
+ }
23
+
24
+ module.exports = {InterceptPhase}
@@ -19,15 +19,15 @@ const { FilterBy } = require('./filterBy')
19
19
  const { ConsoleLogEntry, JavascriptLogEntry, GenericLogEntry } = require('./logEntries')
20
20
 
21
21
  const LOG = {
22
- TYPE_CONSOLE : 'console',
23
- TYPE_JS_LOGS : 'javascript',
22
+ TYPE_CONSOLE: 'console',
23
+ TYPE_JS_LOGS: 'javascript',
24
24
  }
25
25
 
26
26
  class LogInspector {
27
27
  bidi
28
28
  ws
29
29
 
30
- constructor (driver, browsingContextIds) {
30
+ constructor(driver, browsingContextIds) {
31
31
  this._driver = driver
32
32
  this._browsingContextIds = browsingContextIds
33
33
  this.listener = {}
@@ -37,7 +37,7 @@ class LogInspector {
37
37
  * Subscribe to log event
38
38
  * @returns {Promise<void>}
39
39
  */
40
- async init () {
40
+ async init() {
41
41
  this.bidi = await this._driver.getBidi()
42
42
  await this.bidi.subscribe('log.entryAdded', this._browsingContextIds)
43
43
  }
@@ -45,7 +45,7 @@ class LogInspector {
45
45
  /**
46
46
  * @param kind
47
47
  */
48
- logListener (kind) {
48
+ logListener(kind) {
49
49
  if (!(kind in this.listener)) {
50
50
  this.listener[kind] = []
51
51
  }
@@ -76,7 +76,7 @@ class LogInspector {
76
76
  params.method,
77
77
  params.realm,
78
78
  params.args,
79
- params.stackTrace
79
+ params.stackTrace,
80
80
  )
81
81
 
82
82
  if (filterBy !== undefined) {
@@ -113,7 +113,7 @@ class LogInspector {
113
113
  params.text,
114
114
  params.timestamp,
115
115
  params.type,
116
- params.stackTrace
116
+ params.stackTrace,
117
117
  )
118
118
 
119
119
  if (filterBy !== undefined) {
@@ -135,9 +135,7 @@ class LogInspector {
135
135
  */
136
136
  async onJavascriptException(callback) {
137
137
  this.ws = await this.bidi.socket
138
- let enabled =
139
- LOG.TYPE_JS_EXCEPTION in this.listener ||
140
- this.logListener(LOG.TYPE_JS_EXCEPTION)
138
+ let enabled = LOG.TYPE_JS_EXCEPTION in this.listener || this.logListener(LOG.TYPE_JS_EXCEPTION)
141
139
  this.listener[LOG.TYPE_JS_EXCEPTION].push(callback)
142
140
 
143
141
  if (enabled) {
@@ -152,7 +150,7 @@ class LogInspector {
152
150
  params.text,
153
151
  params.timestamp,
154
152
  params.type,
155
- params.stackTrace
153
+ params.stackTrace,
156
154
  )
157
155
 
158
156
  this.listener[LOG.TYPE_JS_EXCEPTION].forEach((listener) => {
@@ -183,7 +181,7 @@ class LogInspector {
183
181
  params.text,
184
182
  params.timestamp,
185
183
  params.type,
186
- params.stackTrace
184
+ params.stackTrace,
187
185
  )
188
186
 
189
187
  if (filterBy !== undefined) {
@@ -206,7 +204,7 @@ class LogInspector {
206
204
  params.method,
207
205
  params.realm,
208
206
  params.args,
209
- params.stackTrace
207
+ params.stackTrace,
210
208
  )
211
209
 
212
210
  if (filterBy !== undefined) {
@@ -220,16 +218,13 @@ class LogInspector {
220
218
  return
221
219
  }
222
220
 
223
- if (
224
- params !== undefined &&
225
- !['console', 'javascript'].includes(params?.type)
226
- ) {
221
+ if (params !== undefined && !['console', 'javascript'].includes(params?.type)) {
227
222
  let genericEntry = new GenericLogEntry(
228
223
  params.level,
229
224
  params.text,
230
225
  params.timestamp,
231
226
  params.type,
232
- params.stackTrace
227
+ params.stackTrace,
233
228
  )
234
229
 
235
230
  if (filterBy !== undefined) {
@@ -248,7 +243,7 @@ class LogInspector {
248
243
  * Unsubscribe to log event
249
244
  * @returns {Promise<void>}
250
245
  */
251
- async close () {
246
+ async close() {
252
247
  await this.bidi.unsubscribe('log.entryAdded', this._browsingContextIds)
253
248
  }
254
249
  }
@@ -259,7 +254,7 @@ class LogInspector {
259
254
  * @param browsingContextIds
260
255
  * @returns {Promise<LogInspector>}
261
256
  */
262
- async function getLogInspectorInstance (driver, browsingContextIds) {
257
+ async function getLogInspectorInstance(driver, browsingContextIds) {
263
258
  let instance = new LogInspector(driver, browsingContextIds)
264
259
  await instance.init()
265
260
  return instance
@@ -0,0 +1,178 @@
1
+ // Licensed to the Software Freedom Conservancy (SFC) under one
2
+ // or more contributor license agreements. See the NOTICE file
3
+ // distributed with this work for additional information
4
+ // regarding copyright ownership. The SFC licenses this file
5
+ // to you under the Apache License, Version 2.0 (the
6
+ // "License"); you may not use this file except in compliance
7
+ // with the License. You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing,
12
+ // software distributed under the License is distributed on an
13
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ // KIND, either express or implied. See the License for the
15
+ // specific language governing permissions and limitations
16
+ // under the License.
17
+
18
+ const { BeforeRequestSent, ResponseStarted, FetchError} = require('./networkTypes')
19
+ const {AddInterceptParameters} = require("./addInterceptParameters");
20
+
21
+ class Network {
22
+ constructor(driver, browsingContextIds) {
23
+ this._driver = driver
24
+ this._browsingContextIds = browsingContextIds
25
+ }
26
+
27
+ async init() {
28
+ this.bidi = await this._driver.getBidi()
29
+ }
30
+
31
+ async beforeRequestSent(callback) {
32
+ await this.subscribeAndHandleEvent('network.beforeRequestSent', callback)
33
+ }
34
+
35
+ async responseStarted(callback) {
36
+ await this.subscribeAndHandleEvent('network.responseStarted', callback)
37
+ }
38
+
39
+ async responseCompleted(callback) {
40
+ await this.subscribeAndHandleEvent('network.responseCompleted', callback)
41
+ }
42
+
43
+ async authRequired(callback) {
44
+ await this.subscribeAndHandleEvent('network.authRequired', callback)
45
+ }
46
+
47
+ async fetchError(callback) {
48
+ await this.subscribeAndHandleEvent('network.fetchError', callback)
49
+ }
50
+
51
+ async subscribeAndHandleEvent(eventType, callback) {
52
+ if (this._browsingContextIds != null) {
53
+ await this.bidi.subscribe(eventType, this._browsingContextIds)
54
+ } else {
55
+ await this.bidi.subscribe(eventType)
56
+ }
57
+ await this._on(callback)
58
+ }
59
+
60
+ async _on(callback) {
61
+ this.ws = await this.bidi.socket
62
+ this.ws.on('message', (event) => {
63
+ const { params } = JSON.parse(Buffer.from(event.toString()))
64
+ if (params) {
65
+ let response = null
66
+ if ('initiator' in params) {
67
+ response = new BeforeRequestSent(
68
+ params.context,
69
+ params.navigation,
70
+ params.redirectCount,
71
+ params.request,
72
+ params.timestamp,
73
+ params.initiator,
74
+ )
75
+ } else if ('response' in params) {
76
+ response = new ResponseStarted(
77
+ params.context,
78
+ params.navigation,
79
+ params.redirectCount,
80
+ params.request,
81
+ params.timestamp,
82
+ params.response,
83
+ )
84
+ } else if ('errorText' in params) {
85
+ response = new FetchError(
86
+ params.context,
87
+ params.navigation,
88
+ params.redirectCount,
89
+ params.request,
90
+ params.timestamp,
91
+ params.errorText,
92
+ )
93
+ }
94
+ callback(response)
95
+ }
96
+ })
97
+ }
98
+
99
+ async addIntercept(params) {
100
+
101
+ if (!params instanceof AddInterceptParameters) {
102
+ throw new Error(`Params must be an instance of AddInterceptParamenters. Received:'${params}'`)
103
+ }
104
+
105
+ const command = {
106
+ method: 'network.addIntercept',
107
+ params: Object.fromEntries(params.asMap())
108
+ }
109
+
110
+ let response = await this.bidi.send(command)
111
+
112
+ return response.result.intercept
113
+ }
114
+
115
+ async removeIntercept(interceptId) {
116
+ const command = {
117
+ method: 'network.removeIntercept',
118
+ params: {intercept: interceptId},
119
+ }
120
+
121
+ await this.bidi.send(command)
122
+ }
123
+
124
+ async continueWithAuth(requestId, username, password) {
125
+ const command = {
126
+ method: 'network.continueWithAuth',
127
+ params: {
128
+ request: requestId.toString(),
129
+ action: 'provideCredentials',
130
+ credentials: {
131
+ type: 'password',
132
+ username: username,
133
+ password: password
134
+ },
135
+ },
136
+ }
137
+ await this.bidi.send(command)
138
+ }
139
+
140
+ async continueWithAuthNoCredentials(requestId) {
141
+ const command = {
142
+ method: 'network.continueWithAuth',
143
+ params: {
144
+ request: requestId.toString(),
145
+ action: 'default'
146
+ },
147
+ }
148
+ await this.bidi.send(command)
149
+ }
150
+
151
+ async cancelAuth(requestId) {
152
+ const command = {
153
+ method: 'network.continueWithAuth',
154
+ params: {
155
+ request: requestId.toString(),
156
+ action: 'cancel'
157
+ },
158
+ }
159
+ await this.bidi.send(command)
160
+ }
161
+
162
+ async close() {
163
+ await this.bidi.unsubscribe(
164
+ 'network.beforeRequestSent',
165
+ 'network.responseStarted',
166
+ 'network.responseCompleted',
167
+ 'network.authRequired')
168
+ }
169
+
170
+ }
171
+
172
+ async function getNetworkInstance(driver, browsingContextIds = null) {
173
+ let instance = new Network(driver, browsingContextIds)
174
+ await instance.init()
175
+ return instance
176
+ }
177
+
178
+ module.exports = getNetworkInstance
@@ -17,6 +17,12 @@
17
17
 
18
18
  const { BeforeRequestSent, ResponseStarted } = require('./networkTypes')
19
19
 
20
+ /**
21
+ * @deprecated
22
+ * in favor of using the `Network` class from `bidi/network.js`
23
+ * Inspector is specific to listening to events.
24
+ * Goal is to club commands and events under one class called Network.
25
+ */
20
26
  class NetworkInspector {
21
27
  constructor(driver, browsingContextIds) {
22
28
  this._driver = driver
@@ -39,6 +45,10 @@ class NetworkInspector {
39
45
  await this.subscribeAndHandleEvent('network.responseCompleted', callback)
40
46
  }
41
47
 
48
+ async authRequired(callback) {
49
+ await this.subscribeAndHandleEvent('network.authRequired', callback)
50
+ }
51
+
42
52
  async subscribeAndHandleEvent(eventType, callback) {
43
53
  if (this._browsingContextIds != null) {
44
54
  await this.bidi.subscribe(eventType, this._browsingContextIds)
@@ -61,7 +71,7 @@ class NetworkInspector {
61
71
  params.redirectCount,
62
72
  params.request,
63
73
  params.timestamp,
64
- params.initiator
74
+ params.initiator,
65
75
  )
66
76
  } else if ('response' in params) {
67
77
  response = new ResponseStarted(
@@ -70,7 +80,7 @@ class NetworkInspector {
70
80
  params.redirectCount,
71
81
  params.request,
72
82
  params.timestamp,
73
- params.response
83
+ params.response,
74
84
  )
75
85
  }
76
86
  callback(response)
@@ -38,18 +38,7 @@ class Header {
38
38
  }
39
39
 
40
40
  class Cookie {
41
- constructor(
42
- name,
43
- value,
44
- binaryValue,
45
- domain,
46
- path,
47
- expires,
48
- size,
49
- httpOnly,
50
- secure,
51
- sameSite
52
- ) {
41
+ constructor(name, value, binaryValue, domain, path, expires, size, httpOnly, secure, sameSite) {
53
42
  this._name = name
54
43
  this._value = value
55
44
  this._binaryValue = binaryValue
@@ -118,7 +107,7 @@ class FetchTimingInfo {
118
107
  tlsStart,
119
108
  requestStart,
120
109
  responseStart,
121
- responseEnd
110
+ responseEnd,
122
111
  ) {
123
112
  this._originTime = originTime
124
113
  this._requestTime = requestTime
@@ -189,16 +178,7 @@ class FetchTimingInfo {
189
178
  }
190
179
 
191
180
  class RequestData {
192
- constructor(
193
- request,
194
- url,
195
- method,
196
- headers,
197
- cookies,
198
- headersSize,
199
- bodySize,
200
- timings
201
- ) {
181
+ constructor(request, url, method, headers, cookies, headersSize, bodySize, timings) {
202
182
  this._request = request
203
183
  this._url = url
204
184
  this._method = method
@@ -224,20 +204,7 @@ class RequestData {
224
204
  let binaryValue = 'binaryValue' in cookie ? cookie.binaryValue : null
225
205
  let expires = 'expires' in cookie ? cookie.expires : null
226
206
 
227
- this._cookies.push(
228
- new Cookie(
229
- name,
230
- value,
231
- binaryValue,
232
- domain,
233
- path,
234
- expires,
235
- size,
236
- httpOnly,
237
- secure,
238
- sameSite
239
- )
240
- )
207
+ this._cookies.push(new Cookie(name, value, binaryValue, domain, path, expires, size, httpOnly, secure, sameSite))
241
208
  })
242
209
  this._headersSize = headersSize
243
210
  this._bodySize = bodySize
@@ -254,7 +221,7 @@ class RequestData {
254
221
  timings.tlsStart,
255
222
  timings.requestStart,
256
223
  timings.responseStart,
257
- timings.responseEnd
224
+ timings.responseEnd,
258
225
  )
259
226
  }
260
227
 
@@ -296,12 +263,7 @@ class BaseParameters {
296
263
  this._id = id
297
264
  this._navigation =
298
265
  navigation != null
299
- ? new NavigationInfo(
300
- navigation.context,
301
- navigation.navigation,
302
- navigation.timestamp,
303
- navigation.url
304
- )
266
+ ? new NavigationInfo(navigation.context, navigation.navigation, navigation.timestamp, navigation.url)
305
267
  : null
306
268
  this._redirectCount = redirectCount
307
269
  this._request = new RequestData(
@@ -312,7 +274,7 @@ class BaseParameters {
312
274
  request.cookies,
313
275
  request.headersSize,
314
276
  request.bodySize,
315
- request.timings
277
+ request.timings,
316
278
  )
317
279
  this._timestamp = timestamp
318
280
  }
@@ -376,7 +338,7 @@ class BeforeRequestSent extends BaseParameters {
376
338
  initiator.columnNumber,
377
339
  initiator.lineNumber,
378
340
  initiator.stackTrace,
379
- initiator.request
341
+ initiator.request,
380
342
  )
381
343
  }
382
344
 
@@ -385,6 +347,17 @@ class BeforeRequestSent extends BaseParameters {
385
347
  }
386
348
  }
387
349
 
350
+ class FetchError extends BaseParameters {
351
+ constructor(id, navigation, redirectCount, request, timestamp, errorText) {
352
+ super(id, navigation, redirectCount, request, timestamp)
353
+ this._errorText = errorText
354
+ }
355
+
356
+ get errorText() {
357
+ return this._errorText
358
+ }
359
+ }
360
+
388
361
  class ResponseData {
389
362
  constructor(
390
363
  url,
@@ -397,7 +370,7 @@ class ResponseData {
397
370
  bytesReceived,
398
371
  headersSize,
399
372
  bodySize,
400
- content
373
+ content,
401
374
  ) {
402
375
  this._url = url
403
376
  this._protocol = protocol
@@ -471,7 +444,7 @@ class ResponseStarted extends BaseParameters {
471
444
  response.bytesReceived,
472
445
  response.headerSize,
473
446
  response.bodySize,
474
- response.content
447
+ response.content,
475
448
  )
476
449
  }
477
450
 
@@ -480,4 +453,4 @@ class ResponseStarted extends BaseParameters {
480
453
  }
481
454
  }
482
455
 
483
- module.exports = { BeforeRequestSent, ResponseStarted }
456
+ module.exports = { BeforeRequestSent, ResponseStarted, FetchError }
@@ -27,9 +27,7 @@ const PrimitiveType = {
27
27
  findByName(name) {
28
28
  return (
29
29
  Object.values(this).find((type) => {
30
- return (
31
- typeof type === 'string' && name.toLowerCase() === type.toLowerCase()
32
- )
30
+ return typeof type === 'string' && name.toLowerCase() === type.toLowerCase()
33
31
  }) || null
34
32
  )
35
33
  },
@@ -42,13 +40,12 @@ const NonPrimitiveType = {
42
40
  OBJECT: 'object',
43
41
  REGULAR_EXPRESSION: 'regexp',
44
42
  SET: 'set',
43
+ CHANNEL: 'channel',
45
44
 
46
45
  findByName(name) {
47
46
  return (
48
47
  Object.values(this).find((type) => {
49
- return (
50
- typeof type === 'string' && name.toLowerCase() === type.toLowerCase()
51
- )
48
+ return typeof type === 'string' && name.toLowerCase() === type.toLowerCase()
52
49
  }) || null
53
50
  )
54
51
  },
@@ -74,9 +71,7 @@ const RemoteType = {
74
71
  findByName(name) {
75
72
  return (
76
73
  Object.values(this).find((type) => {
77
- return (
78
- typeof type === 'string' && name.toLowerCase() === type.toLowerCase()
79
- )
74
+ return typeof type === 'string' && name.toLowerCase() === type.toLowerCase()
80
75
  }) || null
81
76
  )
82
77
  },