UrgentcareCLI 0.1.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/UrgentCare/CLI.rb +1 -2
- data/lib/UrgentCare/Scraper.rb +65 -0
- data/lib/UrgentCare/version.rb +2 -2
- data/lib/UrgentCare.rb +1 -0
- metadata +3 -313
- data/.gitignore +0 -11
- data/.rspec +0 -3
- data/.travis.yml +0 -5
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -12
- data/Gemfile.lock +0 -84
- data/LICENSE.txt +0 -21
- data/Notes +0 -41
- data/README.md +0 -41
- data/Rakefile +0 -8
- data/UrgentCare.gemspec +0 -39
- data/background.jpg +0 -0
- data/data.txt +0 -4
- data/lib/Urgentcare/Scraper.rb +0 -78
- data/node_modules/.bin/rimraf +0 -1
- data/node_modules/.package-lock.json +0 -250
- data/node_modules/balanced-match/.github/FUNDING.yml +0 -2
- data/node_modules/balanced-match/LICENSE.md +0 -21
- data/node_modules/balanced-match/README.md +0 -97
- data/node_modules/balanced-match/index.js +0 -62
- data/node_modules/balanced-match/package.json +0 -48
- data/node_modules/brace-expansion/LICENSE +0 -21
- data/node_modules/brace-expansion/README.md +0 -129
- data/node_modules/brace-expansion/index.js +0 -201
- data/node_modules/brace-expansion/package.json +0 -47
- data/node_modules/concat-map/.travis.yml +0 -4
- data/node_modules/concat-map/LICENSE +0 -18
- data/node_modules/concat-map/README.markdown +0 -62
- data/node_modules/concat-map/example/map.js +0 -6
- data/node_modules/concat-map/index.js +0 -13
- data/node_modules/concat-map/package.json +0 -43
- data/node_modules/concat-map/test/map.js +0 -39
- data/node_modules/core-util-is/LICENSE +0 -19
- data/node_modules/core-util-is/README.md +0 -3
- data/node_modules/core-util-is/float.patch +0 -604
- data/node_modules/core-util-is/lib/util.js +0 -107
- data/node_modules/core-util-is/package.json +0 -32
- data/node_modules/core-util-is/test.js +0 -68
- data/node_modules/fs.realpath/LICENSE +0 -43
- data/node_modules/fs.realpath/README.md +0 -33
- data/node_modules/fs.realpath/index.js +0 -66
- data/node_modules/fs.realpath/old.js +0 -303
- data/node_modules/fs.realpath/package.json +0 -26
- data/node_modules/glob/LICENSE +0 -21
- data/node_modules/glob/README.md +0 -375
- data/node_modules/glob/changelog.md +0 -67
- data/node_modules/glob/common.js +0 -234
- data/node_modules/glob/glob.js +0 -788
- data/node_modules/glob/package.json +0 -51
- data/node_modules/glob/sync.js +0 -484
- data/node_modules/immediate/LICENSE.txt +0 -20
- data/node_modules/immediate/README.md +0 -93
- data/node_modules/immediate/dist/immediate.js +0 -75
- data/node_modules/immediate/dist/immediate.min.js +0 -1
- data/node_modules/immediate/lib/browser.js +0 -69
- data/node_modules/immediate/lib/index.js +0 -73
- data/node_modules/immediate/package.json +0 -42
- data/node_modules/inflight/LICENSE +0 -15
- data/node_modules/inflight/README.md +0 -37
- data/node_modules/inflight/inflight.js +0 -54
- data/node_modules/inflight/package.json +0 -29
- data/node_modules/inherits/LICENSE +0 -16
- data/node_modules/inherits/README.md +0 -42
- data/node_modules/inherits/inherits.js +0 -9
- data/node_modules/inherits/inherits_browser.js +0 -27
- data/node_modules/inherits/package.json +0 -29
- data/node_modules/isarray/.npmignore +0 -1
- data/node_modules/isarray/.travis.yml +0 -4
- data/node_modules/isarray/Makefile +0 -6
- data/node_modules/isarray/README.md +0 -60
- data/node_modules/isarray/component.json +0 -19
- data/node_modules/isarray/index.js +0 -5
- data/node_modules/isarray/package.json +0 -45
- data/node_modules/isarray/test.js +0 -20
- data/node_modules/jszip/.codeclimate.yml +0 -16
- data/node_modules/jszip/.editorconfig +0 -8
- data/node_modules/jszip/.jshintignore +0 -1
- data/node_modules/jszip/.jshintrc +0 -21
- data/node_modules/jszip/.travis.yml +0 -17
- data/node_modules/jszip/CHANGES.md +0 -163
- data/node_modules/jszip/LICENSE.markdown +0 -651
- data/node_modules/jszip/README.markdown +0 -35
- data/node_modules/jszip/dist/jszip.js +0 -30
- data/node_modules/jszip/dist/jszip.min.js +0 -13
- data/node_modules/jszip/index.d.ts +0 -270
- data/node_modules/jszip/lib/base64.js +0 -106
- data/node_modules/jszip/lib/compressedObject.js +0 -74
- data/node_modules/jszip/lib/compressions.js +0 -14
- data/node_modules/jszip/lib/crc32.js +0 -77
- data/node_modules/jszip/lib/defaults.js +0 -11
- data/node_modules/jszip/lib/external.js +0 -19
- data/node_modules/jszip/lib/flate.js +0 -85
- data/node_modules/jszip/lib/generate/ZipFileWorker.js +0 -540
- data/node_modules/jszip/lib/generate/index.js +0 -57
- data/node_modules/jszip/lib/index.js +0 -52
- data/node_modules/jszip/lib/license_header.js +0 -11
- data/node_modules/jszip/lib/load.js +0 -81
- data/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +0 -74
- data/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +0 -42
- data/node_modules/jszip/lib/nodejsUtils.js +0 -57
- data/node_modules/jszip/lib/object.js +0 -389
- data/node_modules/jszip/lib/readable-stream-browser.js +0 -9
- data/node_modules/jszip/lib/reader/ArrayReader.js +0 -57
- data/node_modules/jszip/lib/reader/DataReader.js +0 -116
- data/node_modules/jszip/lib/reader/NodeBufferReader.js +0 -19
- data/node_modules/jszip/lib/reader/StringReader.js +0 -38
- data/node_modules/jszip/lib/reader/Uint8ArrayReader.js +0 -22
- data/node_modules/jszip/lib/reader/readerFor.js +0 -28
- data/node_modules/jszip/lib/signature.js +0 -7
- data/node_modules/jszip/lib/stream/ConvertWorker.js +0 -26
- data/node_modules/jszip/lib/stream/Crc32Probe.js +0 -24
- data/node_modules/jszip/lib/stream/DataLengthProbe.js +0 -29
- data/node_modules/jszip/lib/stream/DataWorker.js +0 -116
- data/node_modules/jszip/lib/stream/GenericWorker.js +0 -263
- data/node_modules/jszip/lib/stream/StreamHelper.js +0 -212
- data/node_modules/jszip/lib/support.js +0 -38
- data/node_modules/jszip/lib/utf8.js +0 -275
- data/node_modules/jszip/lib/utils.js +0 -476
- data/node_modules/jszip/lib/zipEntries.js +0 -262
- data/node_modules/jszip/lib/zipEntry.js +0 -294
- data/node_modules/jszip/lib/zipObject.js +0 -133
- data/node_modules/jszip/package.json +0 -63
- data/node_modules/jszip/vendor/FileSaver.js +0 -247
- data/node_modules/lie/README.md +0 -62
- data/node_modules/lie/dist/lie.js +0 -350
- data/node_modules/lie/dist/lie.min.js +0 -1
- data/node_modules/lie/dist/lie.polyfill.js +0 -358
- data/node_modules/lie/dist/lie.polyfill.min.js +0 -1
- data/node_modules/lie/lib/browser.js +0 -273
- data/node_modules/lie/lib/index.js +0 -298
- data/node_modules/lie/license.md +0 -7
- data/node_modules/lie/lie.d.ts +0 -244
- data/node_modules/lie/package.json +0 -69
- data/node_modules/lie/polyfill.js +0 -4
- data/node_modules/minimatch/LICENSE +0 -15
- data/node_modules/minimatch/README.md +0 -209
- data/node_modules/minimatch/minimatch.js +0 -923
- data/node_modules/minimatch/package.json +0 -30
- data/node_modules/once/LICENSE +0 -15
- data/node_modules/once/README.md +0 -79
- data/node_modules/once/once.js +0 -42
- data/node_modules/once/package.json +0 -33
- data/node_modules/pako/CHANGELOG.md +0 -164
- data/node_modules/pako/LICENSE +0 -21
- data/node_modules/pako/README.md +0 -191
- data/node_modules/pako/dist/pako.js +0 -6818
- data/node_modules/pako/dist/pako.min.js +0 -1
- data/node_modules/pako/dist/pako_deflate.js +0 -3997
- data/node_modules/pako/dist/pako_deflate.min.js +0 -1
- data/node_modules/pako/dist/pako_inflate.js +0 -3300
- data/node_modules/pako/dist/pako_inflate.min.js +0 -1
- data/node_modules/pako/index.js +0 -14
- data/node_modules/pako/lib/deflate.js +0 -400
- data/node_modules/pako/lib/inflate.js +0 -423
- data/node_modules/pako/lib/utils/common.js +0 -105
- data/node_modules/pako/lib/utils/strings.js +0 -187
- data/node_modules/pako/lib/zlib/README +0 -59
- data/node_modules/pako/lib/zlib/adler32.js +0 -51
- data/node_modules/pako/lib/zlib/constants.js +0 -68
- data/node_modules/pako/lib/zlib/crc32.js +0 -59
- data/node_modules/pako/lib/zlib/deflate.js +0 -1874
- data/node_modules/pako/lib/zlib/gzheader.js +0 -58
- data/node_modules/pako/lib/zlib/inffast.js +0 -345
- data/node_modules/pako/lib/zlib/inflate.js +0 -1556
- data/node_modules/pako/lib/zlib/inftrees.js +0 -343
- data/node_modules/pako/lib/zlib/messages.js +0 -32
- data/node_modules/pako/lib/zlib/trees.js +0 -1222
- data/node_modules/pako/lib/zlib/zstream.js +0 -47
- data/node_modules/pako/package.json +0 -44
- data/node_modules/path-is-absolute/index.js +0 -20
- data/node_modules/path-is-absolute/license +0 -21
- data/node_modules/path-is-absolute/package.json +0 -43
- data/node_modules/path-is-absolute/readme.md +0 -59
- data/node_modules/process-nextick-args/index.js +0 -45
- data/node_modules/process-nextick-args/license.md +0 -19
- data/node_modules/process-nextick-args/package.json +0 -25
- data/node_modules/process-nextick-args/readme.md +0 -18
- data/node_modules/readable-stream/.travis.yml +0 -34
- data/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- data/node_modules/readable-stream/GOVERNANCE.md +0 -136
- data/node_modules/readable-stream/LICENSE +0 -47
- data/node_modules/readable-stream/README.md +0 -58
- data/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
- data/node_modules/readable-stream/duplex-browser.js +0 -1
- data/node_modules/readable-stream/duplex.js +0 -1
- data/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
- data/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
- data/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
- data/node_modules/readable-stream/lib/_stream_transform.js +0 -214
- data/node_modules/readable-stream/lib/_stream_writable.js +0 -687
- data/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
- data/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
- data/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- data/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- data/node_modules/readable-stream/package.json +0 -52
- data/node_modules/readable-stream/passthrough.js +0 -1
- data/node_modules/readable-stream/readable-browser.js +0 -7
- data/node_modules/readable-stream/readable.js +0 -19
- data/node_modules/readable-stream/transform.js +0 -1
- data/node_modules/readable-stream/writable-browser.js +0 -1
- data/node_modules/readable-stream/writable.js +0 -8
- data/node_modules/rimraf/LICENSE +0 -15
- data/node_modules/rimraf/README.md +0 -101
- data/node_modules/rimraf/bin.js +0 -50
- data/node_modules/rimraf/package.json +0 -29
- data/node_modules/rimraf/rimraf.js +0 -372
- data/node_modules/safe-buffer/LICENSE +0 -21
- data/node_modules/safe-buffer/README.md +0 -584
- data/node_modules/safe-buffer/index.d.ts +0 -187
- data/node_modules/safe-buffer/index.js +0 -62
- data/node_modules/safe-buffer/package.json +0 -37
- data/node_modules/selenium-webdriver/CHANGES.md +0 -1114
- data/node_modules/selenium-webdriver/LICENSE +0 -202
- data/node_modules/selenium-webdriver/NOTICE +0 -2
- data/node_modules/selenium-webdriver/README.md +0 -229
- data/node_modules/selenium-webdriver/chrome.js +0 -295
- data/node_modules/selenium-webdriver/chromium.js +0 -829
- data/node_modules/selenium-webdriver/devtools/CDPConnection.js +0 -35
- data/node_modules/selenium-webdriver/edge.js +0 -224
- data/node_modules/selenium-webdriver/example/chrome_android.js +0 -45
- data/node_modules/selenium-webdriver/example/chrome_mobile_emulation.js +0 -46
- data/node_modules/selenium-webdriver/example/firefox_channels.js +0 -84
- data/node_modules/selenium-webdriver/example/google_search.js +0 -50
- data/node_modules/selenium-webdriver/example/google_search_test.js +0 -70
- data/node_modules/selenium-webdriver/example/headless.js +0 -63
- data/node_modules/selenium-webdriver/example/logging.js +0 -64
- data/node_modules/selenium-webdriver/firefox.js +0 -789
- data/node_modules/selenium-webdriver/http/index.js +0 -324
- data/node_modules/selenium-webdriver/http/util.js +0 -172
- data/node_modules/selenium-webdriver/ie.js +0 -503
- data/node_modules/selenium-webdriver/index.js +0 -825
- data/node_modules/selenium-webdriver/io/exec.js +0 -162
- data/node_modules/selenium-webdriver/io/index.js +0 -348
- data/node_modules/selenium-webdriver/io/zip.js +0 -223
- data/node_modules/selenium-webdriver/lib/atoms/find-elements.js +0 -123
- data/node_modules/selenium-webdriver/lib/atoms/get-attribute.js +0 -101
- data/node_modules/selenium-webdriver/lib/atoms/is-displayed.js +0 -101
- data/node_modules/selenium-webdriver/lib/atoms/mutation-listener.js +0 -55
- data/node_modules/selenium-webdriver/lib/by.js +0 -415
- data/node_modules/selenium-webdriver/lib/capabilities.js +0 -553
- data/node_modules/selenium-webdriver/lib/command.js +0 -206
- data/node_modules/selenium-webdriver/lib/error.js +0 -605
- data/node_modules/selenium-webdriver/lib/http.js +0 -704
- data/node_modules/selenium-webdriver/lib/input.js +0 -946
- data/node_modules/selenium-webdriver/lib/logging.js +0 -661
- data/node_modules/selenium-webdriver/lib/promise.js +0 -285
- data/node_modules/selenium-webdriver/lib/proxy.js +0 -212
- data/node_modules/selenium-webdriver/lib/session.js +0 -77
- data/node_modules/selenium-webdriver/lib/symbols.js +0 -37
- data/node_modules/selenium-webdriver/lib/until.js +0 -429
- data/node_modules/selenium-webdriver/lib/webdriver.js +0 -2919
- data/node_modules/selenium-webdriver/net/index.js +0 -107
- data/node_modules/selenium-webdriver/net/portprober.js +0 -75
- data/node_modules/selenium-webdriver/opera.js +0 -406
- data/node_modules/selenium-webdriver/package.json +0 -54
- data/node_modules/selenium-webdriver/proxy.js +0 -32
- data/node_modules/selenium-webdriver/remote/index.js +0 -624
- data/node_modules/selenium-webdriver/safari.js +0 -168
- data/node_modules/selenium-webdriver/testing/index.js +0 -504
- data/node_modules/set-immediate-shim/index.js +0 -7
- data/node_modules/set-immediate-shim/package.json +0 -34
- data/node_modules/set-immediate-shim/readme.md +0 -31
- data/node_modules/string_decoder/.travis.yml +0 -50
- data/node_modules/string_decoder/LICENSE +0 -48
- data/node_modules/string_decoder/README.md +0 -47
- data/node_modules/string_decoder/lib/string_decoder.js +0 -296
- data/node_modules/string_decoder/package.json +0 -31
- data/node_modules/tmp/CHANGELOG.md +0 -288
- data/node_modules/tmp/LICENSE +0 -21
- data/node_modules/tmp/README.md +0 -365
- data/node_modules/tmp/lib/tmp.js +0 -780
- data/node_modules/tmp/node_modules/.bin/rimraf +0 -1
- data/node_modules/tmp/node_modules/rimraf/CHANGELOG.md +0 -65
- data/node_modules/tmp/node_modules/rimraf/LICENSE +0 -15
- data/node_modules/tmp/node_modules/rimraf/README.md +0 -101
- data/node_modules/tmp/node_modules/rimraf/bin.js +0 -68
- data/node_modules/tmp/node_modules/rimraf/package.json +0 -32
- data/node_modules/tmp/node_modules/rimraf/rimraf.js +0 -360
- data/node_modules/tmp/package.json +0 -58
- data/node_modules/util-deprecate/History.md +0 -16
- data/node_modules/util-deprecate/LICENSE +0 -24
- data/node_modules/util-deprecate/README.md +0 -53
- data/node_modules/util-deprecate/browser.js +0 -67
- data/node_modules/util-deprecate/node.js +0 -6
- data/node_modules/util-deprecate/package.json +0 -27
- data/node_modules/wrappy/LICENSE +0 -15
- data/node_modules/wrappy/README.md +0 -36
- data/node_modules/wrappy/package.json +0 -29
- data/node_modules/wrappy/wrappy.js +0 -33
- data/node_modules/ws/LICENSE +0 -21
- data/node_modules/ws/README.md +0 -496
- data/node_modules/ws/browser.js +0 -8
- data/node_modules/ws/index.js +0 -10
- data/node_modules/ws/lib/buffer-util.js +0 -129
- data/node_modules/ws/lib/constants.js +0 -10
- data/node_modules/ws/lib/event-target.js +0 -184
- data/node_modules/ws/lib/extension.js +0 -223
- data/node_modules/ws/lib/limiter.js +0 -55
- data/node_modules/ws/lib/permessage-deflate.js +0 -517
- data/node_modules/ws/lib/receiver.js +0 -507
- data/node_modules/ws/lib/sender.js +0 -405
- data/node_modules/ws/lib/stream.js +0 -165
- data/node_modules/ws/lib/validation.js +0 -104
- data/node_modules/ws/lib/websocket-server.js +0 -418
- data/node_modules/ws/lib/websocket.js +0 -942
- data/node_modules/ws/package.json +0 -56
- data/package-lock.json +0 -458
- data/package.json +0 -5
- data/selenium.log +0 -1
- data/spec.md +0 -6
- data/test.data +0 -2110
@@ -1,285 +0,0 @@
|
|
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
|
-
/**
|
19
|
-
* @fileoverview Defines a handful of utility functions to simplify working
|
20
|
-
* with promises.
|
21
|
-
*/
|
22
|
-
|
23
|
-
'use strict'
|
24
|
-
|
25
|
-
/**
|
26
|
-
* Determines whether a {@code value} should be treated as a promise.
|
27
|
-
* Any object whose "then" property is a function will be considered a promise.
|
28
|
-
*
|
29
|
-
* @param {?} value The value to test.
|
30
|
-
* @return {boolean} Whether the value is a promise.
|
31
|
-
*/
|
32
|
-
function isPromise(value) {
|
33
|
-
return Object.prototype.toString.call(value) === '[object Promise]'
|
34
|
-
}
|
35
|
-
|
36
|
-
/**
|
37
|
-
* Creates a promise that will be resolved at a set time in the future.
|
38
|
-
* @param {number} ms The amount of time, in milliseconds, to wait before
|
39
|
-
* resolving the promise.
|
40
|
-
* @return {!Promise<void>} The promise.
|
41
|
-
*/
|
42
|
-
function delayed(ms) {
|
43
|
-
return new Promise((resolve) => setTimeout(resolve, ms))
|
44
|
-
}
|
45
|
-
|
46
|
-
/**
|
47
|
-
* Wraps a function that expects a node-style callback as its final
|
48
|
-
* argument. This callback expects two arguments: an error value (which will be
|
49
|
-
* null if the call succeeded), and the success value as the second argument.
|
50
|
-
* The callback will the resolve or reject the returned promise, based on its
|
51
|
-
* arguments.
|
52
|
-
* @param {!Function} fn The function to wrap.
|
53
|
-
* @param {...?} args The arguments to apply to the function, excluding the
|
54
|
-
* final callback.
|
55
|
-
* @return {!Thenable} A promise that will be resolved with the
|
56
|
-
* result of the provided function's callback.
|
57
|
-
*/
|
58
|
-
function checkedNodeCall(fn, ...args) {
|
59
|
-
return new Promise(function (fulfill, reject) {
|
60
|
-
try {
|
61
|
-
fn(...args, function (error, value) {
|
62
|
-
error ? reject(error) : fulfill(value)
|
63
|
-
})
|
64
|
-
} catch (ex) {
|
65
|
-
reject(ex)
|
66
|
-
}
|
67
|
-
})
|
68
|
-
}
|
69
|
-
|
70
|
-
/**
|
71
|
-
* Registers a listener to invoke when a promise is resolved, regardless
|
72
|
-
* of whether the promise's value was successfully computed. This function
|
73
|
-
* is synonymous with the {@code finally} clause in a synchronous API:
|
74
|
-
*
|
75
|
-
* // Synchronous API:
|
76
|
-
* try {
|
77
|
-
* doSynchronousWork();
|
78
|
-
* } finally {
|
79
|
-
* cleanUp();
|
80
|
-
* }
|
81
|
-
*
|
82
|
-
* // Asynchronous promise API:
|
83
|
-
* doAsynchronousWork().finally(cleanUp);
|
84
|
-
*
|
85
|
-
* __Note:__ similar to the {@code finally} clause, if the registered
|
86
|
-
* callback returns a rejected promise or throws an error, it will silently
|
87
|
-
* replace the rejection error (if any) from this promise:
|
88
|
-
*
|
89
|
-
* try {
|
90
|
-
* throw Error('one');
|
91
|
-
* } finally {
|
92
|
-
* throw Error('two'); // Hides Error: one
|
93
|
-
* }
|
94
|
-
*
|
95
|
-
* let p = Promise.reject(Error('one'));
|
96
|
-
* promise.finally(p, function() {
|
97
|
-
* throw Error('two'); // Hides Error: one
|
98
|
-
* });
|
99
|
-
*
|
100
|
-
* @param {!IThenable<?>} promise The promise to add the listener to.
|
101
|
-
* @param {function(): (R|IThenable<R>)} callback The function to call when
|
102
|
-
* the promise is resolved.
|
103
|
-
* @return {!Promise<R>} A promise that will be resolved with the callback
|
104
|
-
* result.
|
105
|
-
* @template R
|
106
|
-
*/
|
107
|
-
async function thenFinally(promise, callback) {
|
108
|
-
try {
|
109
|
-
await Promise.resolve(promise)
|
110
|
-
return callback()
|
111
|
-
} catch (e) {
|
112
|
-
await callback()
|
113
|
-
throw e
|
114
|
-
}
|
115
|
-
}
|
116
|
-
|
117
|
-
/**
|
118
|
-
* Calls a function for each element in an array and inserts the result into a
|
119
|
-
* new array, which is used as the fulfillment value of the promise returned
|
120
|
-
* by this function.
|
121
|
-
*
|
122
|
-
* If the return value of the mapping function is a promise, this function
|
123
|
-
* will wait for it to be fulfilled before inserting it into the new array.
|
124
|
-
*
|
125
|
-
* If the mapping function throws or returns a rejected promise, the
|
126
|
-
* promise returned by this function will be rejected with the same reason.
|
127
|
-
* Only the first failure will be reported; all subsequent errors will be
|
128
|
-
* silently ignored.
|
129
|
-
*
|
130
|
-
* @param {!(Array<TYPE>|IThenable<!Array<TYPE>>)} array The array to iterate
|
131
|
-
* over, or a promise that will resolve to said array.
|
132
|
-
* @param {function(this: SELF, TYPE, number, !Array<TYPE>): ?} fn The
|
133
|
-
* function to call for each element in the array. This function should
|
134
|
-
* expect three arguments (the element, the index, and the array itself.
|
135
|
-
* @param {SELF=} self The object to be used as the value of 'this' within `fn`.
|
136
|
-
* @template TYPE, SELF
|
137
|
-
*/
|
138
|
-
async function map(array, fn, self = undefined) {
|
139
|
-
const v = await Promise.resolve(array)
|
140
|
-
if (!Array.isArray(v)) {
|
141
|
-
throw TypeError('not an array')
|
142
|
-
}
|
143
|
-
|
144
|
-
const arr = /** @type {!Array} */ (v)
|
145
|
-
const n = arr.length
|
146
|
-
const values = new Array(n)
|
147
|
-
|
148
|
-
for (let i = 0; i < n; i++) {
|
149
|
-
if (i in arr) {
|
150
|
-
values[i] = await Promise.resolve(fn.call(self, arr[i], i, arr))
|
151
|
-
}
|
152
|
-
}
|
153
|
-
return values
|
154
|
-
}
|
155
|
-
|
156
|
-
/**
|
157
|
-
* Calls a function for each element in an array, and if the function returns
|
158
|
-
* true adds the element to a new array.
|
159
|
-
*
|
160
|
-
* If the return value of the filter function is a promise, this function
|
161
|
-
* will wait for it to be fulfilled before determining whether to insert the
|
162
|
-
* element into the new array.
|
163
|
-
*
|
164
|
-
* If the filter function throws or returns a rejected promise, the promise
|
165
|
-
* returned by this function will be rejected with the same reason. Only the
|
166
|
-
* first failure will be reported; all subsequent errors will be silently
|
167
|
-
* ignored.
|
168
|
-
*
|
169
|
-
* @param {!(Array<TYPE>|IThenable<!Array<TYPE>>)} array The array to iterate
|
170
|
-
* over, or a promise that will resolve to said array.
|
171
|
-
* @param {function(this: SELF, TYPE, number, !Array<TYPE>): (
|
172
|
-
* boolean|IThenable<boolean>)} fn The function
|
173
|
-
* to call for each element in the array.
|
174
|
-
* @param {SELF=} self The object to be used as the value of 'this' within `fn`.
|
175
|
-
* @template TYPE, SELF
|
176
|
-
*/
|
177
|
-
async function filter(array, fn, self = undefined) {
|
178
|
-
const v = await Promise.resolve(array)
|
179
|
-
if (!Array.isArray(v)) {
|
180
|
-
throw TypeError('not an array')
|
181
|
-
}
|
182
|
-
|
183
|
-
const arr = /** @type {!Array} */ (v)
|
184
|
-
const n = arr.length
|
185
|
-
const values = []
|
186
|
-
let valuesLength = 0
|
187
|
-
|
188
|
-
for (let i = 0; i < n; i++) {
|
189
|
-
if (i in arr) {
|
190
|
-
const value = arr[i]
|
191
|
-
const include = await fn.call(self, value, i, arr)
|
192
|
-
if (include) {
|
193
|
-
values[valuesLength++] = value
|
194
|
-
}
|
195
|
-
}
|
196
|
-
}
|
197
|
-
return values
|
198
|
-
}
|
199
|
-
|
200
|
-
/**
|
201
|
-
* Returns a promise that will be resolved with the input value in a
|
202
|
-
* fully-resolved state. If the value is an array, each element will be fully
|
203
|
-
* resolved. Likewise, if the value is an object, all keys will be fully
|
204
|
-
* resolved. In both cases, all nested arrays and objects will also be
|
205
|
-
* fully resolved. All fields are resolved in place; the returned promise will
|
206
|
-
* resolve on {@code value} and not a copy.
|
207
|
-
*
|
208
|
-
* Warning: This function makes no checks against objects that contain
|
209
|
-
* cyclical references:
|
210
|
-
*
|
211
|
-
* var value = {};
|
212
|
-
* value['self'] = value;
|
213
|
-
* promise.fullyResolved(value); // Stack overflow.
|
214
|
-
*
|
215
|
-
* @param {*} value The value to fully resolve.
|
216
|
-
* @return {!Thenable} A promise for a fully resolved version
|
217
|
-
* of the input value.
|
218
|
-
*/
|
219
|
-
async function fullyResolved(value) {
|
220
|
-
value = await Promise.resolve(value)
|
221
|
-
if (Array.isArray(value)) {
|
222
|
-
return fullyResolveKeys(/** @type {!Array} */ (value))
|
223
|
-
}
|
224
|
-
|
225
|
-
if (value && typeof value === 'object') {
|
226
|
-
return fullyResolveKeys(/** @type {!Object} */ (value))
|
227
|
-
}
|
228
|
-
|
229
|
-
if (typeof value === 'function') {
|
230
|
-
return fullyResolveKeys(/** @type {!Object} */ (value))
|
231
|
-
}
|
232
|
-
|
233
|
-
return value
|
234
|
-
}
|
235
|
-
|
236
|
-
/**
|
237
|
-
* @param {!(Array|Object)} obj the object to resolve.
|
238
|
-
* @return {!Thenable} A promise that will be resolved with the
|
239
|
-
* input object once all of its values have been fully resolved.
|
240
|
-
*/
|
241
|
-
async function fullyResolveKeys(obj) {
|
242
|
-
const isArray = Array.isArray(obj)
|
243
|
-
const numKeys = isArray ? obj.length : Object.keys(obj).length
|
244
|
-
|
245
|
-
if (!numKeys) {
|
246
|
-
return obj
|
247
|
-
}
|
248
|
-
|
249
|
-
async function forEachProperty(obj, fn) {
|
250
|
-
for (let key in obj) {
|
251
|
-
await fn(obj[key], key)
|
252
|
-
}
|
253
|
-
}
|
254
|
-
|
255
|
-
async function forEachElement(arr, fn) {
|
256
|
-
for (let i = 0; i < arr.length; i++) {
|
257
|
-
await fn(arr[i], i)
|
258
|
-
}
|
259
|
-
}
|
260
|
-
|
261
|
-
const forEachKey = isArray ? forEachElement : forEachProperty
|
262
|
-
await forEachKey(obj, async function (partialValue, key) {
|
263
|
-
if (
|
264
|
-
!Array.isArray(partialValue) &&
|
265
|
-
(!partialValue || typeof partialValue !== 'object')
|
266
|
-
) {
|
267
|
-
return
|
268
|
-
}
|
269
|
-
let resolvedValue = await fullyResolved(partialValue)
|
270
|
-
obj[key] = resolvedValue
|
271
|
-
})
|
272
|
-
return obj
|
273
|
-
}
|
274
|
-
|
275
|
-
// PUBLIC API
|
276
|
-
|
277
|
-
module.exports = {
|
278
|
-
checkedNodeCall,
|
279
|
-
delayed,
|
280
|
-
filter,
|
281
|
-
finally: thenFinally,
|
282
|
-
fullyResolved,
|
283
|
-
isPromise,
|
284
|
-
map,
|
285
|
-
}
|
@@ -1,212 +0,0 @@
|
|
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
|
-
/**
|
19
|
-
* @fileoverview Defines functions for configuring a webdriver proxy:
|
20
|
-
*
|
21
|
-
* const proxy = require('selenium-webdriver/proxy');
|
22
|
-
* const {Capabilities} = require('selenium-webdriver');
|
23
|
-
*
|
24
|
-
* let capabilities = new Capabilities();
|
25
|
-
* capabilities.setProxy(proxy.manual({http: 'host:1234'});
|
26
|
-
*/
|
27
|
-
|
28
|
-
'use strict'
|
29
|
-
|
30
|
-
/**
|
31
|
-
* Supported {@linkplain Config proxy configuration} types.
|
32
|
-
*
|
33
|
-
* @enum {string}
|
34
|
-
*/
|
35
|
-
const Type = {
|
36
|
-
AUTODETECT: 'autodetect',
|
37
|
-
DIRECT: 'direct',
|
38
|
-
MANUAL: 'manual',
|
39
|
-
PAC: 'pac',
|
40
|
-
SYSTEM: 'system',
|
41
|
-
}
|
42
|
-
|
43
|
-
/**
|
44
|
-
* Describes how a proxy should be configured for a WebDriver session.
|
45
|
-
* @record
|
46
|
-
*/
|
47
|
-
function Config() {}
|
48
|
-
|
49
|
-
/**
|
50
|
-
* The proxy type.
|
51
|
-
* @type {Type}
|
52
|
-
*/
|
53
|
-
Config.prototype.proxyType
|
54
|
-
|
55
|
-
/**
|
56
|
-
* Describes how to configure a PAC proxy.
|
57
|
-
* @record
|
58
|
-
* @extends {Config}
|
59
|
-
*/
|
60
|
-
function PacConfig() {}
|
61
|
-
|
62
|
-
/**
|
63
|
-
* URL for the PAC file to use.
|
64
|
-
*
|
65
|
-
* @type {string}
|
66
|
-
*/
|
67
|
-
PacConfig.prototype.proxyAutoconfigUrl
|
68
|
-
|
69
|
-
/**
|
70
|
-
* Record object that defines a manual proxy configuration. Manual
|
71
|
-
* configurations can be easily created using either the
|
72
|
-
* {@link ./proxy.manual proxy.manual()} or {@link ./proxy.socks proxy.socks()}
|
73
|
-
* factory method.
|
74
|
-
*
|
75
|
-
* @record
|
76
|
-
* @extends {Config}
|
77
|
-
*/
|
78
|
-
function ManualConfig() {}
|
79
|
-
|
80
|
-
/**
|
81
|
-
* The proxy host for FTP requests.
|
82
|
-
*
|
83
|
-
* @type {(string|undefined)}
|
84
|
-
*/
|
85
|
-
ManualConfig.prototype.ftpProxy
|
86
|
-
|
87
|
-
/**
|
88
|
-
* The proxy host for HTTP requests.
|
89
|
-
*
|
90
|
-
* @type {(string|undefined)}
|
91
|
-
*/
|
92
|
-
ManualConfig.prototype.httpProxy
|
93
|
-
|
94
|
-
/**
|
95
|
-
* An array of hosts which should bypass all proxies.
|
96
|
-
*
|
97
|
-
* @type {(Array<string>|undefined)}
|
98
|
-
*/
|
99
|
-
ManualConfig.prototype.noProxy
|
100
|
-
|
101
|
-
/**
|
102
|
-
* The proxy host for HTTPS requests.
|
103
|
-
*
|
104
|
-
* @type {(string|undefined)}
|
105
|
-
*/
|
106
|
-
ManualConfig.prototype.sslProxy
|
107
|
-
|
108
|
-
/**
|
109
|
-
* Defines the host and port for the SOCKS proxy to use.
|
110
|
-
*
|
111
|
-
* @type {(number|undefined)}
|
112
|
-
*/
|
113
|
-
ManualConfig.prototype.socksProxy
|
114
|
-
|
115
|
-
/**
|
116
|
-
* Defines the SOCKS proxy version. Must be a number in the range [0, 255].
|
117
|
-
*
|
118
|
-
* @type {(number|undefined)}
|
119
|
-
*/
|
120
|
-
ManualConfig.prototype.socksVersion
|
121
|
-
|
122
|
-
// PUBLIC API
|
123
|
-
|
124
|
-
/** @const */ exports.Config = Config
|
125
|
-
/** @const */ exports.ManualConfig = ManualConfig
|
126
|
-
/** @const */ exports.PacConfig = PacConfig
|
127
|
-
/** @const */ exports.Type = Type
|
128
|
-
|
129
|
-
/**
|
130
|
-
* Configures WebDriver to bypass all browser proxies.
|
131
|
-
* @return {!Config} A new proxy configuration object.
|
132
|
-
*/
|
133
|
-
exports.direct = function () {
|
134
|
-
return { proxyType: Type.DIRECT }
|
135
|
-
}
|
136
|
-
|
137
|
-
/**
|
138
|
-
* Manually configures the browser proxy. The following options are
|
139
|
-
* supported:
|
140
|
-
*
|
141
|
-
* - `ftp`: Proxy host to use for FTP requests
|
142
|
-
* - `http`: Proxy host to use for HTTP requests
|
143
|
-
* - `https`: Proxy host to use for HTTPS requests
|
144
|
-
* - `bypass`: A list of hosts requests should directly connect to,
|
145
|
-
* bypassing any other proxies for that request. May be specified as a
|
146
|
-
* comma separated string, or a list of strings.
|
147
|
-
*
|
148
|
-
* Behavior is undefined for FTP, HTTP, and HTTPS requests if the
|
149
|
-
* corresponding key is omitted from the configuration options.
|
150
|
-
*
|
151
|
-
* @param {{ftp: (string|undefined),
|
152
|
-
* http: (string|undefined),
|
153
|
-
* https: (string|undefined),
|
154
|
-
* bypass: (Array<string>|undefined)}} options Proxy
|
155
|
-
* configuration options.
|
156
|
-
* @return {!ManualConfig} A new proxy configuration object.
|
157
|
-
*/
|
158
|
-
exports.manual = function ({ ftp, http, https, bypass }) {
|
159
|
-
return {
|
160
|
-
proxyType: Type.MANUAL,
|
161
|
-
ftpProxy: ftp,
|
162
|
-
httpProxy: http,
|
163
|
-
sslProxy: https,
|
164
|
-
noProxy: bypass,
|
165
|
-
}
|
166
|
-
}
|
167
|
-
|
168
|
-
/**
|
169
|
-
* Creates a proxy configuration for a socks proxy.
|
170
|
-
*
|
171
|
-
* __Example:__
|
172
|
-
*
|
173
|
-
* const {Capabilities} = require('selenium-webdriver');
|
174
|
-
* const proxy = require('selenium-webdriver/lib/proxy');
|
175
|
-
*
|
176
|
-
* let capabilities = new Capabilities();
|
177
|
-
* capabilities.setProxy(proxy.socks('localhost:1234'));
|
178
|
-
*
|
179
|
-
* // Or, to include authentication.
|
180
|
-
* capabilities.setProxy(proxy.socks('bob:password@localhost:1234'));
|
181
|
-
*
|
182
|
-
*
|
183
|
-
* @param {string} socksProxy The proxy host, in the form `hostname:port`.
|
184
|
-
* @param {number=} socksVersion The SOCKS proxy version.
|
185
|
-
* @return {!ManualConfig} A new proxy configuration object.
|
186
|
-
* @see https://en.wikipedia.org/wiki/SOCKS
|
187
|
-
*/
|
188
|
-
exports.socks = function (socksProxy, socksVersion = undefined) {
|
189
|
-
return /** @type {!Config} */ ({
|
190
|
-
proxyType: Type.MANUAL,
|
191
|
-
socksProxy,
|
192
|
-
socksVersion,
|
193
|
-
})
|
194
|
-
}
|
195
|
-
|
196
|
-
/**
|
197
|
-
* Configures WebDriver to configure the browser proxy using the PAC file at
|
198
|
-
* the given URL.
|
199
|
-
* @param {string} proxyAutoconfigUrl URL for the PAC proxy to use.
|
200
|
-
* @return {!PacConfig} A new proxy configuration object.
|
201
|
-
*/
|
202
|
-
exports.pac = function (proxyAutoconfigUrl) {
|
203
|
-
return { proxyType: Type.PAC, proxyAutoconfigUrl }
|
204
|
-
}
|
205
|
-
|
206
|
-
/**
|
207
|
-
* Configures WebDriver to use the current system's proxy.
|
208
|
-
* @return {!Config} A new proxy configuration object.
|
209
|
-
*/
|
210
|
-
exports.system = function () {
|
211
|
-
return { proxyType: Type.SYSTEM }
|
212
|
-
}
|