@corellium/corellium-cli 1.2.0 → 1.2.1
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.
- package/.gitlab-ci.yml +32 -1
- package/ci/gitlab-build.sh +1 -1
- package/coverage/cobertura-coverage.xml +9 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +101 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +0 -0
- package/index.js +2 -0
- package/package.json +62 -64
- package/src/clients/Instance.js +4 -0
- package/src/commands/extensions/delete.js +2 -1
- package/src/commands/extensions/list.js +3 -2
- package/src/commands/firmware/list.js +3 -2
- package/src/commands/images/create.js +2 -2
- package/src/commands/images/delete.js +1 -0
- package/src/commands/images/list.js +3 -2
- package/src/commands/index.js +0 -2
- package/src/commands/{agent → instances}/apps/index.js +3 -3
- package/src/commands/instances/create.js +9 -3
- package/src/commands/{agent → instances}/file.js +2 -2
- package/src/commands/instances/index.js +6 -1
- package/src/commands/instances/input.js +52 -0
- package/src/commands/instances/list.js +3 -2
- package/src/commands/instances/upgrade.js +2 -2
- package/src/commands/projects/create.js +2 -2
- package/src/commands/projects/delete.js +2 -1
- package/src/commands/projects/list.js +3 -2
- package/src/commands/webplayer/create.js +2 -2
- package/src/commands/webplayer/list.js +2 -2
- package/src/error.js +12 -6
- package/src/table.js +1 -1
- package/src/utils.js +19 -40
- package/node_modules/@babel/cli/LICENSE +0 -22
- package/node_modules/@babel/cli/README.md +0 -19
- package/node_modules/@babel/cli/bin/babel-external-helpers.js +0 -3
- package/node_modules/@babel/cli/bin/babel.js +0 -3
- package/node_modules/@babel/cli/index.js +0 -1
- package/node_modules/@babel/cli/lib/babel/dir.js +0 -285
- package/node_modules/@babel/cli/lib/babel/file.js +0 -273
- package/node_modules/@babel/cli/lib/babel/index.js +0 -20
- package/node_modules/@babel/cli/lib/babel/options.js +0 -285
- package/node_modules/@babel/cli/lib/babel/util.js +0 -181
- package/node_modules/@babel/cli/lib/babel/watcher.js +0 -162
- package/node_modules/@babel/cli/lib/babel-external-helpers.js +0 -43
- package/node_modules/@babel/cli/node_modules/commander/CHANGELOG.md +0 -436
- package/node_modules/@babel/cli/node_modules/commander/LICENSE +0 -22
- package/node_modules/@babel/cli/node_modules/commander/Readme.md +0 -713
- package/node_modules/@babel/cli/node_modules/commander/index.js +0 -1649
- package/node_modules/@babel/cli/node_modules/commander/package.json +0 -76
- package/node_modules/@babel/cli/node_modules/commander/typings/index.d.ts +0 -311
- package/node_modules/@babel/cli/node_modules/make-dir/index.d.ts +0 -39
- package/node_modules/@babel/cli/node_modules/make-dir/index.js +0 -139
- package/node_modules/@babel/cli/node_modules/make-dir/license +0 -9
- package/node_modules/@babel/cli/node_modules/make-dir/package.json +0 -94
- package/node_modules/@babel/cli/node_modules/make-dir/readme.md +0 -123
- package/node_modules/@babel/cli/node_modules/pify/index.js +0 -68
- package/node_modules/@babel/cli/node_modules/pify/license +0 -9
- package/node_modules/@babel/cli/node_modules/pify/package.json +0 -86
- package/node_modules/@babel/cli/node_modules/pify/readme.md +0 -145
- package/node_modules/@babel/cli/node_modules/semver/CHANGELOG.md +0 -39
- package/node_modules/@babel/cli/node_modules/semver/LICENSE +0 -15
- package/node_modules/@babel/cli/node_modules/semver/README.md +0 -412
- package/node_modules/@babel/cli/node_modules/semver/bin/semver +0 -160
- package/node_modules/@babel/cli/node_modules/semver/package.json +0 -63
- package/node_modules/@babel/cli/node_modules/semver/range.bnf +0 -16
- package/node_modules/@babel/cli/node_modules/semver/semver.js +0 -1483
- package/node_modules/@babel/cli/node_modules/slash/index.js +0 -11
- package/node_modules/@babel/cli/node_modules/slash/license +0 -9
- package/node_modules/@babel/cli/node_modules/slash/package.json +0 -69
- package/node_modules/@babel/cli/node_modules/slash/readme.md +0 -44
- package/node_modules/@babel/cli/package.json +0 -91
- package/node_modules/@corellium/client-api/README.md +0 -209
- package/node_modules/@corellium/client-api/dist/ApiClient.js +0 -780
- package/node_modules/@corellium/client-api/dist/api/CorelliumApi.js +0 -1744
- package/node_modules/@corellium/client-api/dist/index.js +0 -295
- package/node_modules/@corellium/client-api/dist/model/ApiConflictError.js +0 -114
- package/node_modules/@corellium/client-api/dist/model/ApiError.js +0 -101
- package/node_modules/@corellium/client-api/dist/model/ApiNotFoundError.js +0 -111
- package/node_modules/@corellium/client-api/dist/model/ApiToken.js +0 -78
- package/node_modules/@corellium/client-api/dist/model/Bit.js +0 -50
- package/node_modules/@corellium/client-api/dist/model/Credentials.js +0 -91
- package/node_modules/@corellium/client-api/dist/model/Firmware.js +0 -208
- package/node_modules/@corellium/client-api/dist/model/GpioStateDefinition.js +0 -93
- package/node_modules/@corellium/client-api/dist/model/Image.js +0 -249
- package/node_modules/@corellium/client-api/dist/model/Instance.js +0 -313
- package/node_modules/@corellium/client-api/dist/model/InstanceBootOptions.js +0 -134
- package/node_modules/@corellium/client-api/dist/model/InstanceConsoleEndpoint.js +0 -76
- package/node_modules/@corellium/client-api/dist/model/InstanceCreateOptions.js +0 -224
- package/node_modules/@corellium/client-api/dist/model/InstanceNetmonState.js +0 -75
- package/node_modules/@corellium/client-api/dist/model/InstanceReturn.js +0 -92
- package/node_modules/@corellium/client-api/dist/model/InstanceServices.js +0 -77
- package/node_modules/@corellium/client-api/dist/model/InstanceStartOptions.js +0 -76
- package/node_modules/@corellium/client-api/dist/model/InstanceState.js +0 -64
- package/node_modules/@corellium/client-api/dist/model/InstanceStopOptions.js +0 -76
- package/node_modules/@corellium/client-api/dist/model/Model.js +0 -165
- package/node_modules/@corellium/client-api/dist/model/ModelSoftware.js +0 -122
- package/node_modules/@corellium/client-api/dist/model/PeripheralsData.js +0 -147
- package/node_modules/@corellium/client-api/dist/model/Project.js +0 -122
- package/node_modules/@corellium/client-api/dist/model/ProjectQuota.js +0 -93
- package/node_modules/@corellium/client-api/dist/model/ProjectSettings.js +0 -93
- package/node_modules/@corellium/client-api/dist/model/ProjectUsage.js +0 -102
- package/node_modules/@corellium/client-api/dist/model/Snapshot.js +0 -145
- package/node_modules/@corellium/client-api/dist/model/SnapshotCreationOptions.js +0 -79
- package/node_modules/@corellium/client-api/dist/model/SnapshotStatus.js +0 -84
- package/node_modules/@corellium/client-api/dist/model/Token.js +0 -88
- package/node_modules/@corellium/client-api/dist/model/UserError.js +0 -114
- package/node_modules/@corellium/client-api/dist/model/V1SetStateBody.js +0 -80
- package/node_modules/@corellium/client-api/dist/model/VolumeOptions.js +0 -94
- package/node_modules/@corellium/client-api/dist/model/VpnDefinition.js +0 -84
- package/node_modules/@corellium/client-api/package.json +0 -75
- package/node_modules/@jridgewell/resolve-uri/LICENSE +0 -19
- package/node_modules/@jridgewell/resolve-uri/README.md +0 -40
- package/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs +0 -242
- package/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map +0 -1
- package/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js +0 -250
- package/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map +0 -1
- package/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts +0 -4
- package/node_modules/@jridgewell/resolve-uri/package.json +0 -108
- package/node_modules/@jridgewell/sourcemap-codec/LICENSE +0 -21
- package/node_modules/@jridgewell/sourcemap-codec/README.md +0 -200
- package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -164
- package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +0 -1
- package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +0 -175
- package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map +0 -1
- package/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts +0 -6
- package/node_modules/@jridgewell/sourcemap-codec/package.json +0 -110
- package/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts +0 -198
- package/node_modules/@jridgewell/trace-mapping/LICENSE +0 -19
- package/node_modules/@jridgewell/trace-mapping/README.md +0 -252
- package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs +0 -518
- package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map +0 -1
- package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js +0 -532
- package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map +0 -1
- package/node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts +0 -8
- package/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts +0 -32
- package/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts +0 -7
- package/node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts +0 -1
- package/node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts +0 -2
- package/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +0 -16
- package/node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts +0 -4
- package/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +0 -74
- package/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts +0 -85
- package/node_modules/@jridgewell/trace-mapping/package.json +0 -112
- package/node_modules/@jridgewell/trace-mapping/src/any-map.ts +0 -166
- package/node_modules/@jridgewell/trace-mapping/src/binary-search.ts +0 -115
- package/node_modules/@jridgewell/trace-mapping/src/by-source.ts +0 -64
- package/node_modules/@jridgewell/trace-mapping/src/resolve.ts +0 -10
- package/node_modules/@jridgewell/trace-mapping/src/sort.ts +0 -45
- package/node_modules/@jridgewell/trace-mapping/src/sourcemap-segment.ts +0 -23
- package/node_modules/@jridgewell/trace-mapping/src/strip-filename.ts +0 -8
- package/node_modules/@jridgewell/trace-mapping/src/trace-mapping.ts +0 -405
- package/node_modules/@jridgewell/trace-mapping/src/types.ts +0 -90
- package/node_modules/@nicolo-ribaudo/chokidar-2/README.md +0 -3
- package/node_modules/@nicolo-ribaudo/chokidar-2/build-chokidar.sh +0 -30
- package/node_modules/@nicolo-ribaudo/chokidar-2/dist/main.js +0 -2086
- package/node_modules/@nicolo-ribaudo/chokidar-2/package.json +0 -73
- package/node_modules/@nicolo-ribaudo/chokidar-2/types.d.ts +0 -191
- package/node_modules/ansi-regex/index.d.ts +0 -37
- package/node_modules/ansi-regex/index.js +0 -10
- package/node_modules/ansi-regex/license +0 -9
- package/node_modules/ansi-regex/package.json +0 -90
- package/node_modules/ansi-regex/readme.md +0 -78
- package/node_modules/ansi-styles/index.d.ts +0 -345
- package/node_modules/ansi-styles/index.js +0 -163
- package/node_modules/ansi-styles/license +0 -9
- package/node_modules/ansi-styles/package.json +0 -96
- package/node_modules/ansi-styles/readme.md +0 -152
- package/node_modules/anymatch/LICENSE +0 -15
- package/node_modules/anymatch/README.md +0 -87
- package/node_modules/anymatch/index.d.ts +0 -19
- package/node_modules/anymatch/index.js +0 -104
- package/node_modules/anymatch/package.json +0 -80
- package/node_modules/asynckit/LICENSE +0 -21
- package/node_modules/asynckit/README.md +0 -233
- package/node_modules/asynckit/bench.js +0 -76
- package/node_modules/asynckit/index.js +0 -6
- package/node_modules/asynckit/lib/abort.js +0 -29
- package/node_modules/asynckit/lib/async.js +0 -34
- package/node_modules/asynckit/lib/defer.js +0 -26
- package/node_modules/asynckit/lib/iterate.js +0 -75
- package/node_modules/asynckit/lib/readable_asynckit.js +0 -91
- package/node_modules/asynckit/lib/readable_parallel.js +0 -25
- package/node_modules/asynckit/lib/readable_serial.js +0 -25
- package/node_modules/asynckit/lib/readable_serial_ordered.js +0 -29
- package/node_modules/asynckit/lib/state.js +0 -37
- package/node_modules/asynckit/lib/streamify.js +0 -141
- package/node_modules/asynckit/lib/terminator.js +0 -29
- package/node_modules/asynckit/package.json +0 -96
- package/node_modules/asynckit/parallel.js +0 -43
- package/node_modules/asynckit/serial.js +0 -17
- package/node_modules/asynckit/serialOrdered.js +0 -75
- package/node_modules/asynckit/stream.js +0 -21
- package/node_modules/axios/CHANGELOG.md +0 -943
- package/node_modules/axios/LICENSE +0 -19
- package/node_modules/axios/README.md +0 -991
- package/node_modules/axios/SECURITY.md +0 -5
- package/node_modules/axios/UPGRADE_GUIDE.md +0 -168
- package/node_modules/axios/dist/axios.js +0 -2595
- package/node_modules/axios/dist/axios.map +0 -1
- package/node_modules/axios/dist/axios.min.js +0 -3
- package/node_modules/axios/dist/axios.min.map +0 -1
- package/node_modules/axios/index.d.ts +0 -254
- package/node_modules/axios/index.js +0 -1
- package/node_modules/axios/lib/adapters/README.md +0 -37
- package/node_modules/axios/lib/adapters/http.js +0 -424
- package/node_modules/axios/lib/adapters/xhr.js +0 -222
- package/node_modules/axios/lib/axios.js +0 -64
- package/node_modules/axios/lib/cancel/CancelToken.js +0 -119
- package/node_modules/axios/lib/cancel/CanceledError.js +0 -22
- package/node_modules/axios/lib/cancel/isCancel.js +0 -5
- package/node_modules/axios/lib/core/Axios.js +0 -160
- package/node_modules/axios/lib/core/AxiosError.js +0 -86
- package/node_modules/axios/lib/core/InterceptorManager.js +0 -54
- package/node_modules/axios/lib/core/README.md +0 -8
- package/node_modules/axios/lib/core/buildFullPath.js +0 -20
- package/node_modules/axios/lib/core/dispatchRequest.js +0 -87
- package/node_modules/axios/lib/core/mergeConfig.js +0 -100
- package/node_modules/axios/lib/core/settle.js +0 -25
- package/node_modules/axios/lib/core/transformData.js +0 -22
- package/node_modules/axios/lib/defaults/env/FormData.js +0 -2
- package/node_modules/axios/lib/defaults/index.js +0 -146
- package/node_modules/axios/lib/defaults/transitional.js +0 -7
- package/node_modules/axios/lib/env/README.md +0 -3
- package/node_modules/axios/lib/env/data.js +0 -3
- package/node_modules/axios/lib/helpers/README.md +0 -7
- package/node_modules/axios/lib/helpers/bind.js +0 -11
- package/node_modules/axios/lib/helpers/buildURL.js +0 -70
- package/node_modules/axios/lib/helpers/combineURLs.js +0 -14
- package/node_modules/axios/lib/helpers/cookies.js +0 -53
- package/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -24
- package/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -14
- package/node_modules/axios/lib/helpers/isAxiosError.js +0 -13
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -68
- package/node_modules/axios/lib/helpers/normalizeHeaderName.js +0 -12
- package/node_modules/axios/lib/helpers/null.js +0 -2
- package/node_modules/axios/lib/helpers/parseHeaders.js +0 -53
- package/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
- package/node_modules/axios/lib/helpers/spread.js +0 -27
- package/node_modules/axios/lib/helpers/toFormData.js +0 -72
- package/node_modules/axios/lib/helpers/validator.js +0 -86
- package/node_modules/axios/lib/utils.js +0 -470
- package/node_modules/axios/package.json +0 -117
- package/node_modules/axios/tsconfig.json +0 -14
- package/node_modules/axios/tslint.json +0 -6
- package/node_modules/balanced-match/.github/FUNDING.yml +0 -2
- package/node_modules/balanced-match/LICENSE.md +0 -21
- package/node_modules/balanced-match/README.md +0 -97
- package/node_modules/balanced-match/index.js +0 -62
- package/node_modules/balanced-match/package.json +0 -79
- package/node_modules/binary-extensions/binary-extensions.json +0 -260
- package/node_modules/binary-extensions/binary-extensions.json.d.ts +0 -3
- package/node_modules/binary-extensions/index.d.ts +0 -14
- package/node_modules/binary-extensions/index.js +0 -1
- package/node_modules/binary-extensions/license +0 -9
- package/node_modules/binary-extensions/package.json +0 -74
- package/node_modules/binary-extensions/readme.md +0 -41
- package/node_modules/brace-expansion/LICENSE +0 -21
- package/node_modules/brace-expansion/README.md +0 -129
- package/node_modules/brace-expansion/index.js +0 -201
- package/node_modules/brace-expansion/package.json +0 -78
- package/node_modules/braces/CHANGELOG.md +0 -184
- package/node_modules/braces/LICENSE +0 -21
- package/node_modules/braces/README.md +0 -593
- package/node_modules/braces/index.js +0 -170
- package/node_modules/braces/lib/compile.js +0 -57
- package/node_modules/braces/lib/constants.js +0 -57
- package/node_modules/braces/lib/expand.js +0 -113
- package/node_modules/braces/lib/parse.js +0 -333
- package/node_modules/braces/lib/stringify.js +0 -32
- package/node_modules/braces/lib/utils.js +0 -112
- package/node_modules/braces/package.json +0 -127
- package/node_modules/call-bind/.eslintignore +0 -1
- package/node_modules/call-bind/.eslintrc +0 -17
- package/node_modules/call-bind/.github/FUNDING.yml +0 -12
- package/node_modules/call-bind/.nycrc +0 -13
- package/node_modules/call-bind/CHANGELOG.md +0 -42
- package/node_modules/call-bind/LICENSE +0 -21
- package/node_modules/call-bind/README.md +0 -2
- package/node_modules/call-bind/callBound.js +0 -15
- package/node_modules/call-bind/index.js +0 -47
- package/node_modules/call-bind/package.json +0 -126
- package/node_modules/call-bind/test/callBound.js +0 -55
- package/node_modules/call-bind/test/index.js +0 -66
- package/node_modules/chokidar/LICENSE +0 -21
- package/node_modules/chokidar/README.md +0 -308
- package/node_modules/chokidar/index.js +0 -973
- package/node_modules/chokidar/lib/constants.js +0 -65
- package/node_modules/chokidar/lib/fsevents-handler.js +0 -524
- package/node_modules/chokidar/lib/nodefs-handler.js +0 -654
- package/node_modules/chokidar/package.json +0 -123
- package/node_modules/chokidar/types/index.d.ts +0 -188
- package/node_modules/cliui/CHANGELOG.md +0 -121
- package/node_modules/cliui/LICENSE.txt +0 -14
- package/node_modules/cliui/README.md +0 -141
- package/node_modules/cliui/build/index.cjs +0 -302
- package/node_modules/cliui/build/lib/index.js +0 -287
- package/node_modules/cliui/build/lib/string-utils.js +0 -27
- package/node_modules/cliui/index.mjs +0 -13
- package/node_modules/cliui/package.json +0 -121
- package/node_modules/color-convert/CHANGELOG.md +0 -54
- package/node_modules/color-convert/LICENSE +0 -21
- package/node_modules/color-convert/README.md +0 -68
- package/node_modules/color-convert/conversions.js +0 -839
- package/node_modules/color-convert/index.js +0 -81
- package/node_modules/color-convert/package.json +0 -86
- package/node_modules/color-convert/route.js +0 -97
- package/node_modules/color-name/LICENSE +0 -8
- package/node_modules/color-name/README.md +0 -11
- package/node_modules/color-name/index.js +0 -152
- package/node_modules/color-name/package.json +0 -60
- package/node_modules/combined-stream/License +0 -19
- package/node_modules/combined-stream/Readme.md +0 -138
- package/node_modules/combined-stream/lib/combined_stream.js +0 -208
- package/node_modules/combined-stream/package.json +0 -62
- package/node_modules/combined-stream/yarn.lock +0 -17
- package/node_modules/component-emitter/History.md +0 -75
- package/node_modules/component-emitter/LICENSE +0 -24
- package/node_modules/component-emitter/Readme.md +0 -74
- package/node_modules/component-emitter/index.js +0 -175
- package/node_modules/component-emitter/package.json +0 -59
- package/node_modules/concat-map/.travis.yml +0 -4
- package/node_modules/concat-map/LICENSE +0 -18
- package/node_modules/concat-map/README.markdown +0 -62
- package/node_modules/concat-map/example/map.js +0 -6
- package/node_modules/concat-map/index.js +0 -13
- package/node_modules/concat-map/package.json +0 -91
- package/node_modules/concat-map/test/map.js +0 -39
- package/node_modules/convert-source-map/LICENSE +0 -23
- package/node_modules/convert-source-map/README.md +0 -120
- package/node_modules/convert-source-map/index.js +0 -136
- package/node_modules/convert-source-map/package.json +0 -75
- package/node_modules/cookiejar/LICENSE +0 -9
- package/node_modules/cookiejar/cookiejar.js +0 -276
- package/node_modules/cookiejar/package.json +0 -58
- package/node_modules/cookiejar/readme.md +0 -60
- package/node_modules/debug/LICENSE +0 -20
- package/node_modules/debug/README.md +0 -481
- package/node_modules/debug/package.json +0 -113
- package/node_modules/debug/src/browser.js +0 -269
- package/node_modules/debug/src/common.js +0 -274
- package/node_modules/debug/src/index.js +0 -10
- package/node_modules/debug/src/node.js +0 -263
- package/node_modules/delayed-stream/.npmignore +0 -1
- package/node_modules/delayed-stream/License +0 -19
- package/node_modules/delayed-stream/Makefile +0 -7
- package/node_modules/delayed-stream/Readme.md +0 -141
- package/node_modules/delayed-stream/lib/delayed_stream.js +0 -107
- package/node_modules/delayed-stream/package.json +0 -65
- package/node_modules/dotenv/CHANGELOG.md +0 -356
- package/node_modules/dotenv/LICENSE +0 -23
- package/node_modules/dotenv/README.md +0 -408
- package/node_modules/dotenv/config.d.ts +0 -1
- package/node_modules/dotenv/config.js +0 -9
- package/node_modules/dotenv/lib/cli-options.js +0 -11
- package/node_modules/dotenv/lib/env-options.js +0 -20
- package/node_modules/dotenv/lib/main.d.ts +0 -73
- package/node_modules/dotenv/lib/main.js +0 -109
- package/node_modules/dotenv/package.json +0 -87
- package/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
- package/node_modules/emoji-regex/README.md +0 -73
- package/node_modules/emoji-regex/es2015/index.js +0 -6
- package/node_modules/emoji-regex/es2015/text.js +0 -6
- package/node_modules/emoji-regex/index.d.ts +0 -23
- package/node_modules/emoji-regex/index.js +0 -6
- package/node_modules/emoji-regex/package.json +0 -80
- package/node_modules/emoji-regex/text.js +0 -6
- package/node_modules/escalade/dist/index.js +0 -22
- package/node_modules/escalade/dist/index.mjs +0 -22
- package/node_modules/escalade/index.d.ts +0 -3
- package/node_modules/escalade/license +0 -9
- package/node_modules/escalade/package.json +0 -96
- package/node_modules/escalade/readme.md +0 -211
- package/node_modules/escalade/sync/index.d.ts +0 -2
- package/node_modules/escalade/sync/index.js +0 -18
- package/node_modules/escalade/sync/index.mjs +0 -18
- package/node_modules/fast-safe-stringify/.travis.yml +0 -8
- package/node_modules/fast-safe-stringify/CHANGELOG.md +0 -17
- package/node_modules/fast-safe-stringify/LICENSE +0 -23
- package/node_modules/fast-safe-stringify/benchmark.js +0 -137
- package/node_modules/fast-safe-stringify/index.d.ts +0 -23
- package/node_modules/fast-safe-stringify/index.js +0 -229
- package/node_modules/fast-safe-stringify/package.json +0 -90
- package/node_modules/fast-safe-stringify/readme.md +0 -170
- package/node_modules/fast-safe-stringify/test-stable.js +0 -404
- package/node_modules/fast-safe-stringify/test.js +0 -397
- package/node_modules/fill-range/LICENSE +0 -21
- package/node_modules/fill-range/README.md +0 -237
- package/node_modules/fill-range/index.js +0 -249
- package/node_modules/fill-range/package.json +0 -117
- package/node_modules/follow-redirects/LICENSE +0 -18
- package/node_modules/follow-redirects/README.md +0 -155
- package/node_modules/follow-redirects/debug.js +0 -15
- package/node_modules/follow-redirects/http.js +0 -1
- package/node_modules/follow-redirects/https.js +0 -1
- package/node_modules/follow-redirects/index.js +0 -598
- package/node_modules/follow-redirects/package.json +0 -98
- package/node_modules/form-data/License +0 -19
- package/node_modules/form-data/README.md.bak +0 -358
- package/node_modules/form-data/Readme.md +0 -358
- package/node_modules/form-data/index.d.ts +0 -62
- package/node_modules/form-data/lib/browser.js +0 -2
- package/node_modules/form-data/lib/form_data.js +0 -501
- package/node_modules/form-data/lib/populate.js +0 -10
- package/node_modules/form-data/package.json +0 -104
- package/node_modules/formidable/LICENSE +0 -7
- package/node_modules/formidable/Readme.md +0 -448
- package/node_modules/formidable/lib/file.js +0 -81
- package/node_modules/formidable/lib/incoming_form.js +0 -564
- package/node_modules/formidable/lib/index.js +0 -3
- package/node_modules/formidable/lib/json_parser.js +0 -30
- package/node_modules/formidable/lib/multipart_parser.js +0 -332
- package/node_modules/formidable/lib/octet_parser.js +0 -20
- package/node_modules/formidable/lib/querystring_parser.js +0 -27
- package/node_modules/formidable/package.json +0 -63
- package/node_modules/fs-readdir-recursive/LICENSE +0 -22
- package/node_modules/fs-readdir-recursive/README.md +0 -61
- package/node_modules/fs-readdir-recursive/index.js +0 -29
- package/node_modules/fs-readdir-recursive/package.json +0 -60
- package/node_modules/fs.realpath/LICENSE +0 -43
- package/node_modules/fs.realpath/README.md +0 -33
- package/node_modules/fs.realpath/index.js +0 -66
- package/node_modules/fs.realpath/old.js +0 -303
- package/node_modules/fs.realpath/package.json +0 -62
- package/node_modules/function-bind/.editorconfig +0 -20
- package/node_modules/function-bind/.eslintrc +0 -15
- package/node_modules/function-bind/.jscs.json +0 -176
- package/node_modules/function-bind/.npmignore +0 -22
- package/node_modules/function-bind/.travis.yml +0 -168
- package/node_modules/function-bind/LICENSE +0 -20
- package/node_modules/function-bind/README.md +0 -48
- package/node_modules/function-bind/implementation.js +0 -52
- package/node_modules/function-bind/index.js +0 -5
- package/node_modules/function-bind/package.json +0 -100
- package/node_modules/function-bind/test/.eslintrc +0 -9
- package/node_modules/function-bind/test/index.js +0 -252
- package/node_modules/generate-password/.eslintrc.yml +0 -18
- package/node_modules/generate-password/.github/workflows/nodejs.yml +0 -33
- package/node_modules/generate-password/CHANGELOG.md +0 -79
- package/node_modules/generate-password/LICENSE +0 -21
- package/node_modules/generate-password/README.md +0 -61
- package/node_modules/generate-password/example.js +0 -28
- package/node_modules/generate-password/main.js +0 -1
- package/node_modules/generate-password/package.json +0 -68
- package/node_modules/generate-password/src/generate.d.ts +0 -51
- package/node_modules/generate-password/src/generate.js +0 -152
- package/node_modules/generate-password/test/coverage.sh +0 -17
- package/node_modules/generate-password/test/esm.mjs +0 -13
- package/node_modules/generate-password/test/generator.js +0 -164
- package/node_modules/get-caller-file/LICENSE.md +0 -6
- package/node_modules/get-caller-file/README.md +0 -41
- package/node_modules/get-caller-file/index.d.ts +0 -2
- package/node_modules/get-caller-file/index.js +0 -22
- package/node_modules/get-caller-file/index.js.map +0 -1
- package/node_modules/get-caller-file/package.json +0 -72
- package/node_modules/get-intrinsic/.eslintrc +0 -37
- package/node_modules/get-intrinsic/.github/FUNDING.yml +0 -12
- package/node_modules/get-intrinsic/.nycrc +0 -9
- package/node_modules/get-intrinsic/CHANGELOG.md +0 -91
- package/node_modules/get-intrinsic/LICENSE +0 -21
- package/node_modules/get-intrinsic/README.md +0 -71
- package/node_modules/get-intrinsic/index.js +0 -334
- package/node_modules/get-intrinsic/package.json +0 -125
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +0 -274
- package/node_modules/glob/LICENSE +0 -21
- package/node_modules/glob/README.md +0 -378
- package/node_modules/glob/common.js +0 -238
- package/node_modules/glob/glob.js +0 -790
- package/node_modules/glob/package.json +0 -93
- package/node_modules/glob/sync.js +0 -486
- package/node_modules/glob-parent/CHANGELOG.md +0 -110
- package/node_modules/glob-parent/LICENSE +0 -15
- package/node_modules/glob-parent/README.md +0 -137
- package/node_modules/glob-parent/index.js +0 -42
- package/node_modules/glob-parent/package.json +0 -95
- package/node_modules/has/LICENSE-MIT +0 -22
- package/node_modules/has/README.md +0 -18
- package/node_modules/has/package.json +0 -81
- package/node_modules/has/src/index.js +0 -5
- package/node_modules/has/test/index.js +0 -10
- package/node_modules/has-symbols/.eslintrc +0 -11
- package/node_modules/has-symbols/.github/FUNDING.yml +0 -12
- package/node_modules/has-symbols/.nycrc +0 -9
- package/node_modules/has-symbols/CHANGELOG.md +0 -75
- package/node_modules/has-symbols/LICENSE +0 -21
- package/node_modules/has-symbols/README.md +0 -46
- package/node_modules/has-symbols/index.js +0 -13
- package/node_modules/has-symbols/package.json +0 -134
- package/node_modules/has-symbols/shams.js +0 -42
- package/node_modules/has-symbols/test/index.js +0 -22
- package/node_modules/has-symbols/test/shams/core-js.js +0 -28
- package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +0 -28
- package/node_modules/has-symbols/test/tests.js +0 -56
- package/node_modules/inflight/LICENSE +0 -15
- package/node_modules/inflight/README.md +0 -37
- package/node_modules/inflight/inflight.js +0 -54
- package/node_modules/inflight/package.json +0 -61
- package/node_modules/inherits/LICENSE +0 -16
- package/node_modules/inherits/README.md +0 -42
- package/node_modules/inherits/inherits.js +0 -9
- package/node_modules/inherits/inherits_browser.js +0 -27
- package/node_modules/inherits/package.json +0 -70
- package/node_modules/is-binary-path/index.d.ts +0 -17
- package/node_modules/is-binary-path/index.js +0 -7
- package/node_modules/is-binary-path/license +0 -9
- package/node_modules/is-binary-path/package.json +0 -76
- package/node_modules/is-binary-path/readme.md +0 -34
- package/node_modules/is-extglob/LICENSE +0 -21
- package/node_modules/is-extglob/README.md +0 -107
- package/node_modules/is-extglob/index.js +0 -20
- package/node_modules/is-extglob/package.json +0 -103
- package/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
- package/node_modules/is-fullwidth-code-point/index.js +0 -50
- package/node_modules/is-fullwidth-code-point/license +0 -9
- package/node_modules/is-fullwidth-code-point/package.json +0 -80
- package/node_modules/is-fullwidth-code-point/readme.md +0 -39
- package/node_modules/is-glob/LICENSE +0 -21
- package/node_modules/is-glob/README.md +0 -206
- package/node_modules/is-glob/index.js +0 -150
- package/node_modules/is-glob/package.json +0 -127
- package/node_modules/is-number/LICENSE +0 -21
- package/node_modules/is-number/README.md +0 -187
- package/node_modules/is-number/index.js +0 -18
- package/node_modules/is-number/package.json +0 -125
- package/node_modules/lru-cache/LICENSE +0 -15
- package/node_modules/lru-cache/README.md +0 -166
- package/node_modules/lru-cache/index.js +0 -334
- package/node_modules/lru-cache/package.json +0 -72
- package/node_modules/methods/HISTORY.md +0 -29
- package/node_modules/methods/LICENSE +0 -24
- package/node_modules/methods/README.md +0 -51
- package/node_modules/methods/index.js +0 -69
- package/node_modules/methods/package.json +0 -82
- package/node_modules/mime/CHANGELOG.md +0 -296
- package/node_modules/mime/LICENSE +0 -21
- package/node_modules/mime/Mime.js +0 -97
- package/node_modules/mime/README.md +0 -187
- package/node_modules/mime/cli.js +0 -46
- package/node_modules/mime/index.js +0 -4
- package/node_modules/mime/lite.js +0 -4
- package/node_modules/mime/package.json +0 -84
- package/node_modules/mime/types/other.js +0 -1
- package/node_modules/mime/types/standard.js +0 -1
- package/node_modules/mime-db/HISTORY.md +0 -507
- package/node_modules/mime-db/LICENSE +0 -23
- package/node_modules/mime-db/README.md +0 -100
- package/node_modules/mime-db/db.json +0 -8519
- package/node_modules/mime-db/index.js +0 -12
- package/node_modules/mime-db/package.json +0 -106
- package/node_modules/mime-types/HISTORY.md +0 -397
- package/node_modules/mime-types/LICENSE +0 -23
- package/node_modules/mime-types/README.md +0 -113
- package/node_modules/mime-types/index.js +0 -188
- package/node_modules/mime-types/package.json +0 -92
- package/node_modules/minimatch/LICENSE +0 -15
- package/node_modules/minimatch/README.md +0 -230
- package/node_modules/minimatch/minimatch.js +0 -947
- package/node_modules/minimatch/package.json +0 -73
- package/node_modules/ms/index.js +0 -162
- package/node_modules/ms/license.md +0 -21
- package/node_modules/ms/package.json +0 -75
- package/node_modules/ms/readme.md +0 -60
- package/node_modules/multi-progress/.gitattributes +0 -17
- package/node_modules/multi-progress/CHANGELOG.md +0 -56
- package/node_modules/multi-progress/LICENSE.txt +0 -21
- package/node_modules/multi-progress/multi-progress.js +0 -98
- package/node_modules/multi-progress/package.json +0 -58
- package/node_modules/multi-progress/readme.md +0 -33
- package/node_modules/normalize-path/LICENSE +0 -21
- package/node_modules/normalize-path/README.md +0 -127
- package/node_modules/normalize-path/index.js +0 -35
- package/node_modules/normalize-path/package.json +0 -119
- package/node_modules/object-inspect/.eslintrc +0 -53
- package/node_modules/object-inspect/.github/FUNDING.yml +0 -12
- package/node_modules/object-inspect/.nycrc +0 -13
- package/node_modules/object-inspect/CHANGELOG.md +0 -360
- package/node_modules/object-inspect/LICENSE +0 -21
- package/node_modules/object-inspect/example/all.js +0 -23
- package/node_modules/object-inspect/example/circular.js +0 -6
- package/node_modules/object-inspect/example/fn.js +0 -5
- package/node_modules/object-inspect/example/inspect.js +0 -10
- package/node_modules/object-inspect/index.js +0 -512
- package/node_modules/object-inspect/package-support.json +0 -20
- package/node_modules/object-inspect/package.json +0 -126
- package/node_modules/object-inspect/readme.markdown +0 -86
- package/node_modules/object-inspect/test/bigint.js +0 -58
- package/node_modules/object-inspect/test/browser/dom.js +0 -15
- package/node_modules/object-inspect/test/circular.js +0 -16
- package/node_modules/object-inspect/test/deep.js +0 -12
- package/node_modules/object-inspect/test/element.js +0 -53
- package/node_modules/object-inspect/test/err.js +0 -48
- package/node_modules/object-inspect/test/fakes.js +0 -29
- package/node_modules/object-inspect/test/fn.js +0 -76
- package/node_modules/object-inspect/test/has.js +0 -15
- package/node_modules/object-inspect/test/holes.js +0 -15
- package/node_modules/object-inspect/test/indent-option.js +0 -271
- package/node_modules/object-inspect/test/inspect.js +0 -139
- package/node_modules/object-inspect/test/lowbyte.js +0 -12
- package/node_modules/object-inspect/test/number.js +0 -58
- package/node_modules/object-inspect/test/quoteStyle.js +0 -17
- package/node_modules/object-inspect/test/toStringTag.js +0 -40
- package/node_modules/object-inspect/test/undef.js +0 -12
- package/node_modules/object-inspect/test/values.js +0 -211
- package/node_modules/object-inspect/test-core-js.js +0 -26
- package/node_modules/object-inspect/util.inspect.js +0 -1
- package/node_modules/once/LICENSE +0 -15
- package/node_modules/once/README.md +0 -79
- package/node_modules/once/once.js +0 -42
- package/node_modules/once/package.json +0 -74
- package/node_modules/path-is-absolute/index.js +0 -20
- package/node_modules/path-is-absolute/license +0 -21
- package/node_modules/path-is-absolute/package.json +0 -78
- package/node_modules/path-is-absolute/readme.md +0 -59
- package/node_modules/picomatch/CHANGELOG.md +0 -136
- package/node_modules/picomatch/LICENSE +0 -21
- package/node_modules/picomatch/README.md +0 -708
- package/node_modules/picomatch/index.js +0 -3
- package/node_modules/picomatch/lib/constants.js +0 -179
- package/node_modules/picomatch/lib/parse.js +0 -1091
- package/node_modules/picomatch/lib/picomatch.js +0 -342
- package/node_modules/picomatch/lib/scan.js +0 -391
- package/node_modules/picomatch/lib/utils.js +0 -64
- package/node_modules/picomatch/package.json +0 -117
- package/node_modules/progress/CHANGELOG.md +0 -115
- package/node_modules/progress/LICENSE +0 -22
- package/node_modules/progress/Makefile +0 -8
- package/node_modules/progress/Readme.md +0 -146
- package/node_modules/progress/index.js +0 -1
- package/node_modules/progress/lib/node-progress.js +0 -236
- package/node_modules/progress/package.json +0 -74
- package/node_modules/qs/.editorconfig +0 -43
- package/node_modules/qs/.eslintrc +0 -38
- package/node_modules/qs/.github/FUNDING.yml +0 -12
- package/node_modules/qs/.nycrc +0 -13
- package/node_modules/qs/CHANGELOG.md +0 -546
- package/node_modules/qs/LICENSE.md +0 -29
- package/node_modules/qs/README.md +0 -625
- package/node_modules/qs/dist/qs.js +0 -2054
- package/node_modules/qs/lib/formats.js +0 -23
- package/node_modules/qs/lib/index.js +0 -11
- package/node_modules/qs/lib/parse.js +0 -263
- package/node_modules/qs/lib/stringify.js +0 -326
- package/node_modules/qs/lib/utils.js +0 -252
- package/node_modules/qs/package.json +0 -108
- package/node_modules/qs/test/parse.js +0 -855
- package/node_modules/qs/test/stringify.js +0 -909
- package/node_modules/qs/test/utils.js +0 -136
- package/node_modules/readdirp/LICENSE +0 -21
- package/node_modules/readdirp/README.md +0 -122
- package/node_modules/readdirp/index.d.ts +0 -43
- package/node_modules/readdirp/index.js +0 -287
- package/node_modules/readdirp/package.json +0 -162
- package/node_modules/require-directory/.jshintrc +0 -67
- package/node_modules/require-directory/.npmignore +0 -1
- package/node_modules/require-directory/.travis.yml +0 -3
- package/node_modules/require-directory/LICENSE +0 -22
- package/node_modules/require-directory/README.markdown +0 -184
- package/node_modules/require-directory/index.js +0 -86
- package/node_modules/require-directory/package.json +0 -72
- package/node_modules/safe-buffer/LICENSE +0 -21
- package/node_modules/safe-buffer/README.md +0 -584
- package/node_modules/safe-buffer/index.d.ts +0 -187
- package/node_modules/safe-buffer/index.js +0 -62
- package/node_modules/safe-buffer/package.json +0 -69
- package/node_modules/semver/LICENSE +0 -15
- package/node_modules/semver/README.md +0 -568
- package/node_modules/semver/bin/semver.js +0 -183
- package/node_modules/semver/classes/comparator.js +0 -136
- package/node_modules/semver/classes/index.js +0 -5
- package/node_modules/semver/classes/range.js +0 -519
- package/node_modules/semver/classes/semver.js +0 -287
- package/node_modules/semver/functions/clean.js +0 -6
- package/node_modules/semver/functions/cmp.js +0 -52
- package/node_modules/semver/functions/coerce.js +0 -52
- package/node_modules/semver/functions/compare-build.js +0 -7
- package/node_modules/semver/functions/compare-loose.js +0 -3
- package/node_modules/semver/functions/compare.js +0 -5
- package/node_modules/semver/functions/diff.js +0 -23
- package/node_modules/semver/functions/eq.js +0 -3
- package/node_modules/semver/functions/gt.js +0 -3
- package/node_modules/semver/functions/gte.js +0 -3
- package/node_modules/semver/functions/inc.js +0 -18
- package/node_modules/semver/functions/lt.js +0 -3
- package/node_modules/semver/functions/lte.js +0 -3
- package/node_modules/semver/functions/major.js +0 -3
- package/node_modules/semver/functions/minor.js +0 -3
- package/node_modules/semver/functions/neq.js +0 -3
- package/node_modules/semver/functions/parse.js +0 -33
- package/node_modules/semver/functions/patch.js +0 -3
- package/node_modules/semver/functions/prerelease.js +0 -6
- package/node_modules/semver/functions/rcompare.js +0 -3
- package/node_modules/semver/functions/rsort.js +0 -3
- package/node_modules/semver/functions/satisfies.js +0 -10
- package/node_modules/semver/functions/sort.js +0 -3
- package/node_modules/semver/functions/valid.js +0 -6
- package/node_modules/semver/index.js +0 -48
- package/node_modules/semver/internal/constants.js +0 -17
- package/node_modules/semver/internal/debug.js +0 -9
- package/node_modules/semver/internal/identifiers.js +0 -23
- package/node_modules/semver/internal/parse-options.js +0 -11
- package/node_modules/semver/internal/re.js +0 -182
- package/node_modules/semver/package.json +0 -113
- package/node_modules/semver/preload.js +0 -2
- package/node_modules/semver/range.bnf +0 -16
- package/node_modules/semver/ranges/gtr.js +0 -4
- package/node_modules/semver/ranges/intersects.js +0 -7
- package/node_modules/semver/ranges/ltr.js +0 -4
- package/node_modules/semver/ranges/max-satisfying.js +0 -25
- package/node_modules/semver/ranges/min-satisfying.js +0 -24
- package/node_modules/semver/ranges/min-version.js +0 -61
- package/node_modules/semver/ranges/outside.js +0 -80
- package/node_modules/semver/ranges/simplify.js +0 -47
- package/node_modules/semver/ranges/subset.js +0 -244
- package/node_modules/semver/ranges/to-comparators.js +0 -8
- package/node_modules/semver/ranges/valid.js +0 -11
- package/node_modules/side-channel/.eslintignore +0 -1
- package/node_modules/side-channel/.eslintrc +0 -11
- package/node_modules/side-channel/.github/FUNDING.yml +0 -12
- package/node_modules/side-channel/.nycrc +0 -13
- package/node_modules/side-channel/CHANGELOG.md +0 -65
- package/node_modules/side-channel/LICENSE +0 -21
- package/node_modules/side-channel/README.md +0 -2
- package/node_modules/side-channel/index.js +0 -124
- package/node_modules/side-channel/package.json +0 -99
- package/node_modules/side-channel/test/index.js +0 -78
- package/node_modules/string-width/index.d.ts +0 -29
- package/node_modules/string-width/index.js +0 -47
- package/node_modules/string-width/license +0 -9
- package/node_modules/string-width/package.json +0 -98
- package/node_modules/string-width/readme.md +0 -50
- package/node_modules/string_decoder/.travis.yml +0 -50
- package/node_modules/string_decoder/LICENSE +0 -48
- package/node_modules/string_decoder/README.md +0 -47
- package/node_modules/string_decoder/lib/string_decoder.js +0 -296
- package/node_modules/string_decoder/package.json +0 -64
- package/node_modules/strip-ansi/index.d.ts +0 -17
- package/node_modules/strip-ansi/index.js +0 -4
- package/node_modules/strip-ansi/license +0 -9
- package/node_modules/strip-ansi/package.json +0 -95
- package/node_modules/strip-ansi/readme.md +0 -46
- package/node_modules/superagent/.browserslistrc +0 -5
- package/node_modules/superagent/.dist.babelrc +0 -10
- package/node_modules/superagent/.dist.eslintrc +0 -35
- package/node_modules/superagent/.editorconfig +0 -9
- package/node_modules/superagent/.gitattributes +0 -1
- package/node_modules/superagent/.lib.babelrc +0 -11
- package/node_modules/superagent/.lib.eslintrc +0 -24
- package/node_modules/superagent/.remarkignore +0 -3
- package/node_modules/superagent/.zuul.yml +0 -16
- package/node_modules/superagent/CONTRIBUTING.md +0 -7
- package/node_modules/superagent/HISTORY.md +0 -692
- package/node_modules/superagent/LICENSE +0 -22
- package/node_modules/superagent/Makefile +0 -60
- package/node_modules/superagent/README.md +0 -266
- package/node_modules/superagent/dist/superagent.js +0 -2418
- package/node_modules/superagent/dist/superagent.min.js +0 -1
- package/node_modules/superagent/docs/head.html +0 -11
- package/node_modules/superagent/docs/images/bg.png +0 -0
- package/node_modules/superagent/docs/index.md +0 -736
- package/node_modules/superagent/docs/style.css +0 -87
- package/node_modules/superagent/docs/tail.html +0 -36
- package/node_modules/superagent/docs/test.html +0 -5072
- package/node_modules/superagent/index.html +0 -47
- package/node_modules/superagent/lib/agent-base.js +0 -42
- package/node_modules/superagent/lib/client.js +0 -1020
- package/node_modules/superagent/lib/is-object.js +0 -17
- package/node_modules/superagent/lib/node/agent.js +0 -113
- package/node_modules/superagent/lib/node/http2wrapper.js +0 -218
- package/node_modules/superagent/lib/node/index.js +0 -1376
- package/node_modules/superagent/lib/node/parsers/image.js +0 -13
- package/node_modules/superagent/lib/node/parsers/index.js +0 -12
- package/node_modules/superagent/lib/node/parsers/json.js +0 -26
- package/node_modules/superagent/lib/node/parsers/text.js +0 -11
- package/node_modules/superagent/lib/node/parsers/urlencoded.js +0 -22
- package/node_modules/superagent/lib/node/response.js +0 -126
- package/node_modules/superagent/lib/node/unzip.js +0 -72
- package/node_modules/superagent/lib/request-base.js +0 -757
- package/node_modules/superagent/lib/response-base.js +0 -131
- package/node_modules/superagent/lib/utils.js +0 -71
- package/node_modules/superagent/node_modules/form-data/License +0 -19
- package/node_modules/superagent/node_modules/form-data/README.md.bak +0 -356
- package/node_modules/superagent/node_modules/form-data/Readme.md +0 -356
- package/node_modules/superagent/node_modules/form-data/index.d.ts +0 -62
- package/node_modules/superagent/node_modules/form-data/lib/browser.js +0 -2
- package/node_modules/superagent/node_modules/form-data/lib/form_data.js +0 -498
- package/node_modules/superagent/node_modules/form-data/lib/populate.js +0 -10
- package/node_modules/superagent/node_modules/form-data/package.json +0 -104
- package/node_modules/superagent/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- package/node_modules/superagent/node_modules/readable-stream/GOVERNANCE.md +0 -136
- package/node_modules/superagent/node_modules/readable-stream/LICENSE +0 -47
- package/node_modules/superagent/node_modules/readable-stream/README.md +0 -106
- package/node_modules/superagent/node_modules/readable-stream/errors-browser.js +0 -127
- package/node_modules/superagent/node_modules/readable-stream/errors.js +0 -116
- package/node_modules/superagent/node_modules/readable-stream/experimentalWarning.js +0 -17
- package/node_modules/superagent/node_modules/readable-stream/lib/_stream_duplex.js +0 -139
- package/node_modules/superagent/node_modules/readable-stream/lib/_stream_passthrough.js +0 -39
- package/node_modules/superagent/node_modules/readable-stream/lib/_stream_readable.js +0 -1124
- package/node_modules/superagent/node_modules/readable-stream/lib/_stream_transform.js +0 -201
- package/node_modules/superagent/node_modules/readable-stream/lib/_stream_writable.js +0 -697
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/async_iterator.js +0 -207
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/buffer_list.js +0 -210
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -105
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +0 -104
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/from-browser.js +0 -3
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/from.js +0 -64
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/pipeline.js +0 -97
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/state.js +0 -27
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- package/node_modules/superagent/node_modules/readable-stream/package.json +0 -100
- package/node_modules/superagent/node_modules/readable-stream/readable-browser.js +0 -9
- package/node_modules/superagent/node_modules/readable-stream/readable.js +0 -16
- package/node_modules/superagent/package.json +0 -272
- package/node_modules/to-regex-range/LICENSE +0 -21
- package/node_modules/to-regex-range/README.md +0 -305
- package/node_modules/to-regex-range/index.js +0 -288
- package/node_modules/to-regex-range/package.json +0 -128
- package/node_modules/util-deprecate/History.md +0 -16
- package/node_modules/util-deprecate/LICENSE +0 -24
- package/node_modules/util-deprecate/README.md +0 -53
- package/node_modules/util-deprecate/browser.js +0 -67
- package/node_modules/util-deprecate/node.js +0 -6
- package/node_modules/util-deprecate/package.json +0 -61
- package/node_modules/uuid/CHANGELOG.md +0 -229
- package/node_modules/uuid/CONTRIBUTING.md +0 -18
- package/node_modules/uuid/LICENSE.md +0 -9
- package/node_modules/uuid/README.md +0 -505
- package/node_modules/uuid/dist/bin/uuid +0 -2
- package/node_modules/uuid/dist/esm-browser/index.js +0 -9
- package/node_modules/uuid/dist/esm-browser/md5.js +0 -215
- package/node_modules/uuid/dist/esm-browser/nil.js +0 -1
- package/node_modules/uuid/dist/esm-browser/parse.js +0 -35
- package/node_modules/uuid/dist/esm-browser/regex.js +0 -1
- package/node_modules/uuid/dist/esm-browser/rng.js +0 -19
- package/node_modules/uuid/dist/esm-browser/sha1.js +0 -96
- package/node_modules/uuid/dist/esm-browser/stringify.js +0 -30
- package/node_modules/uuid/dist/esm-browser/v1.js +0 -95
- package/node_modules/uuid/dist/esm-browser/v3.js +0 -4
- package/node_modules/uuid/dist/esm-browser/v35.js +0 -64
- package/node_modules/uuid/dist/esm-browser/v4.js +0 -24
- package/node_modules/uuid/dist/esm-browser/v5.js +0 -4
- package/node_modules/uuid/dist/esm-browser/validate.js +0 -7
- package/node_modules/uuid/dist/esm-browser/version.js +0 -11
- package/node_modules/uuid/dist/esm-node/index.js +0 -9
- package/node_modules/uuid/dist/esm-node/md5.js +0 -13
- package/node_modules/uuid/dist/esm-node/nil.js +0 -1
- package/node_modules/uuid/dist/esm-node/parse.js +0 -35
- package/node_modules/uuid/dist/esm-node/regex.js +0 -1
- package/node_modules/uuid/dist/esm-node/rng.js +0 -12
- package/node_modules/uuid/dist/esm-node/sha1.js +0 -13
- package/node_modules/uuid/dist/esm-node/stringify.js +0 -29
- package/node_modules/uuid/dist/esm-node/v1.js +0 -95
- package/node_modules/uuid/dist/esm-node/v3.js +0 -4
- package/node_modules/uuid/dist/esm-node/v35.js +0 -64
- package/node_modules/uuid/dist/esm-node/v4.js +0 -24
- package/node_modules/uuid/dist/esm-node/v5.js +0 -4
- package/node_modules/uuid/dist/esm-node/validate.js +0 -7
- package/node_modules/uuid/dist/esm-node/version.js +0 -11
- package/node_modules/uuid/dist/index.js +0 -79
- package/node_modules/uuid/dist/md5-browser.js +0 -223
- package/node_modules/uuid/dist/md5.js +0 -23
- package/node_modules/uuid/dist/nil.js +0 -8
- package/node_modules/uuid/dist/parse.js +0 -45
- package/node_modules/uuid/dist/regex.js +0 -8
- package/node_modules/uuid/dist/rng-browser.js +0 -26
- package/node_modules/uuid/dist/rng.js +0 -24
- package/node_modules/uuid/dist/sha1-browser.js +0 -104
- package/node_modules/uuid/dist/sha1.js +0 -23
- package/node_modules/uuid/dist/stringify.js +0 -39
- package/node_modules/uuid/dist/umd/uuid.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidNIL.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidParse.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidStringify.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidValidate.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidVersion.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidv1.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidv3.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidv4.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidv5.min.js +0 -1
- package/node_modules/uuid/dist/uuid-bin.js +0 -85
- package/node_modules/uuid/dist/v1.js +0 -107
- package/node_modules/uuid/dist/v3.js +0 -16
- package/node_modules/uuid/dist/v35.js +0 -78
- package/node_modules/uuid/dist/v4.js +0 -37
- package/node_modules/uuid/dist/v5.js +0 -16
- package/node_modules/uuid/dist/validate.js +0 -17
- package/node_modules/uuid/dist/version.js +0 -21
- package/node_modules/uuid/package.json +0 -167
- package/node_modules/uuid/wrapper.mjs +0 -10
- package/node_modules/wrap-ansi/index.js +0 -216
- package/node_modules/wrap-ansi/license +0 -9
- package/node_modules/wrap-ansi/package.json +0 -98
- package/node_modules/wrap-ansi/readme.md +0 -91
- package/node_modules/wrappy/LICENSE +0 -15
- package/node_modules/wrappy/README.md +0 -36
- package/node_modules/wrappy/package.json +0 -62
- package/node_modules/wrappy/wrappy.js +0 -33
- package/node_modules/y18n/CHANGELOG.md +0 -100
- package/node_modules/y18n/LICENSE +0 -13
- package/node_modules/y18n/README.md +0 -127
- package/node_modules/y18n/build/index.cjs +0 -203
- package/node_modules/y18n/build/lib/cjs.js +0 -6
- package/node_modules/y18n/build/lib/index.js +0 -174
- package/node_modules/y18n/build/lib/platform-shims/node.js +0 -19
- package/node_modules/y18n/index.mjs +0 -8
- package/node_modules/y18n/package.json +0 -104
- package/node_modules/yallist/LICENSE +0 -15
- package/node_modules/yallist/README.md +0 -204
- package/node_modules/yallist/iterator.js +0 -8
- package/node_modules/yallist/package.json +0 -68
- package/node_modules/yallist/yallist.js +0 -426
- package/node_modules/yargs/LICENSE +0 -21
- package/node_modules/yargs/README.md +0 -204
- package/node_modules/yargs/browser.mjs +0 -7
- package/node_modules/yargs/build/index.cjs +0 -1
- package/node_modules/yargs/build/lib/argsert.js +0 -62
- package/node_modules/yargs/build/lib/command.js +0 -447
- package/node_modules/yargs/build/lib/completion-templates.js +0 -48
- package/node_modules/yargs/build/lib/completion.js +0 -236
- package/node_modules/yargs/build/lib/middleware.js +0 -88
- package/node_modules/yargs/build/lib/parse-command.js +0 -32
- package/node_modules/yargs/build/lib/typings/common-types.js +0 -9
- package/node_modules/yargs/build/lib/typings/yargs-parser-types.js +0 -1
- package/node_modules/yargs/build/lib/usage.js +0 -579
- package/node_modules/yargs/build/lib/utils/apply-extends.js +0 -59
- package/node_modules/yargs/build/lib/utils/is-promise.js +0 -5
- package/node_modules/yargs/build/lib/utils/levenshtein.js +0 -34
- package/node_modules/yargs/build/lib/utils/maybe-async-result.js +0 -17
- package/node_modules/yargs/build/lib/utils/obj-filter.js +0 -10
- package/node_modules/yargs/build/lib/utils/process-argv.js +0 -17
- package/node_modules/yargs/build/lib/utils/set-blocking.js +0 -12
- package/node_modules/yargs/build/lib/utils/which-module.js +0 -10
- package/node_modules/yargs/build/lib/validation.js +0 -305
- package/node_modules/yargs/build/lib/yargs-factory.js +0 -1497
- package/node_modules/yargs/build/lib/yerror.js +0 -9
- package/node_modules/yargs/helpers/helpers.mjs +0 -10
- package/node_modules/yargs/helpers/index.js +0 -14
- package/node_modules/yargs/helpers/package.json +0 -3
- package/node_modules/yargs/index.cjs +0 -53
- package/node_modules/yargs/index.mjs +0 -8
- package/node_modules/yargs/lib/platform-shims/browser.mjs +0 -95
- package/node_modules/yargs/lib/platform-shims/esm.mjs +0 -73
- package/node_modules/yargs/locales/be.json +0 -46
- package/node_modules/yargs/locales/de.json +0 -46
- package/node_modules/yargs/locales/en.json +0 -51
- package/node_modules/yargs/locales/es.json +0 -46
- package/node_modules/yargs/locales/fi.json +0 -49
- package/node_modules/yargs/locales/fr.json +0 -53
- package/node_modules/yargs/locales/hi.json +0 -49
- package/node_modules/yargs/locales/hu.json +0 -46
- package/node_modules/yargs/locales/id.json +0 -50
- package/node_modules/yargs/locales/it.json +0 -46
- package/node_modules/yargs/locales/ja.json +0 -51
- package/node_modules/yargs/locales/ko.json +0 -49
- package/node_modules/yargs/locales/nb.json +0 -44
- package/node_modules/yargs/locales/nl.json +0 -49
- package/node_modules/yargs/locales/nn.json +0 -44
- package/node_modules/yargs/locales/pirate.json +0 -13
- package/node_modules/yargs/locales/pl.json +0 -49
- package/node_modules/yargs/locales/pt.json +0 -45
- package/node_modules/yargs/locales/pt_BR.json +0 -48
- package/node_modules/yargs/locales/ru.json +0 -51
- package/node_modules/yargs/locales/th.json +0 -46
- package/node_modules/yargs/locales/tr.json +0 -48
- package/node_modules/yargs/locales/uk_UA.json +0 -51
- package/node_modules/yargs/locales/uz.json +0 -52
- package/node_modules/yargs/locales/zh_CN.json +0 -48
- package/node_modules/yargs/locales/zh_TW.json +0 -51
- package/node_modules/yargs/package.json +0 -154
- package/node_modules/yargs/yargs +0 -9
- package/node_modules/yargs/yargs.mjs +0 -10
- package/node_modules/yargs-parser/CHANGELOG.md +0 -287
- package/node_modules/yargs-parser/LICENSE.txt +0 -14
- package/node_modules/yargs-parser/README.md +0 -518
- package/node_modules/yargs-parser/browser.js +0 -29
- package/node_modules/yargs-parser/build/index.cjs +0 -1048
- package/node_modules/yargs-parser/build/lib/index.js +0 -60
- package/node_modules/yargs-parser/build/lib/string-utils.js +0 -65
- package/node_modules/yargs-parser/build/lib/tokenize-arg-string.js +0 -40
- package/node_modules/yargs-parser/build/lib/yargs-parser-types.js +0 -12
- package/node_modules/yargs-parser/build/lib/yargs-parser.js +0 -1045
- package/node_modules/yargs-parser/package.json +0 -123
- package/src/clients/TrialAccount.js +0 -76
- package/src/commands/agent/index.js +0 -27
- package/src/commands/signup.js +0 -104
- package/test.sh +0 -2
- /package/src/commands/{agent → instances}/apps/install.js +0 -0
- /package/src/commands/{agent → instances}/ready.js +0 -0
|
@@ -1,2418 +0,0 @@
|
|
|
1
|
-
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.superagent = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Expose `Emitter`.
|
|
6
|
-
*/
|
|
7
|
-
if (typeof module !== 'undefined') {
|
|
8
|
-
module.exports = Emitter;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Initialize a new `Emitter`.
|
|
12
|
-
*
|
|
13
|
-
* @api public
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function Emitter(obj) {
|
|
18
|
-
if (obj) return mixin(obj);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
;
|
|
22
|
-
/**
|
|
23
|
-
* Mixin the emitter properties.
|
|
24
|
-
*
|
|
25
|
-
* @param {Object} obj
|
|
26
|
-
* @return {Object}
|
|
27
|
-
* @api private
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
function mixin(obj) {
|
|
31
|
-
for (var key in Emitter.prototype) {
|
|
32
|
-
obj[key] = Emitter.prototype[key];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return obj;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Listen on the given `event` with `fn`.
|
|
39
|
-
*
|
|
40
|
-
* @param {String} event
|
|
41
|
-
* @param {Function} fn
|
|
42
|
-
* @return {Emitter}
|
|
43
|
-
* @api public
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
|
|
48
|
-
this._callbacks = this._callbacks || {};
|
|
49
|
-
(this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
|
|
50
|
-
return this;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Adds an `event` listener that will be invoked a single
|
|
54
|
-
* time then automatically removed.
|
|
55
|
-
*
|
|
56
|
-
* @param {String} event
|
|
57
|
-
* @param {Function} fn
|
|
58
|
-
* @return {Emitter}
|
|
59
|
-
* @api public
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
Emitter.prototype.once = function (event, fn) {
|
|
64
|
-
function on() {
|
|
65
|
-
this.off(event, on);
|
|
66
|
-
fn.apply(this, arguments);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
on.fn = fn;
|
|
70
|
-
this.on(event, on);
|
|
71
|
-
return this;
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Remove the given callback for `event` or all
|
|
75
|
-
* registered callbacks.
|
|
76
|
-
*
|
|
77
|
-
* @param {String} event
|
|
78
|
-
* @param {Function} fn
|
|
79
|
-
* @return {Emitter}
|
|
80
|
-
* @api public
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
|
|
85
|
-
this._callbacks = this._callbacks || {}; // all
|
|
86
|
-
|
|
87
|
-
if (0 == arguments.length) {
|
|
88
|
-
this._callbacks = {};
|
|
89
|
-
return this;
|
|
90
|
-
} // specific event
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var callbacks = this._callbacks['$' + event];
|
|
94
|
-
if (!callbacks) return this; // remove all handlers
|
|
95
|
-
|
|
96
|
-
if (1 == arguments.length) {
|
|
97
|
-
delete this._callbacks['$' + event];
|
|
98
|
-
return this;
|
|
99
|
-
} // remove specific handler
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
var cb;
|
|
103
|
-
|
|
104
|
-
for (var i = 0; i < callbacks.length; i++) {
|
|
105
|
-
cb = callbacks[i];
|
|
106
|
-
|
|
107
|
-
if (cb === fn || cb.fn === fn) {
|
|
108
|
-
callbacks.splice(i, 1);
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
} // Remove event specific arrays for event types that no
|
|
112
|
-
// one is subscribed for to avoid memory leak.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (callbacks.length === 0) {
|
|
116
|
-
delete this._callbacks['$' + event];
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return this;
|
|
120
|
-
};
|
|
121
|
-
/**
|
|
122
|
-
* Emit `event` with the given args.
|
|
123
|
-
*
|
|
124
|
-
* @param {String} event
|
|
125
|
-
* @param {Mixed} ...
|
|
126
|
-
* @return {Emitter}
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
Emitter.prototype.emit = function (event) {
|
|
131
|
-
this._callbacks = this._callbacks || {};
|
|
132
|
-
var args = new Array(arguments.length - 1),
|
|
133
|
-
callbacks = this._callbacks['$' + event];
|
|
134
|
-
|
|
135
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
136
|
-
args[i - 1] = arguments[i];
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (callbacks) {
|
|
140
|
-
callbacks = callbacks.slice(0);
|
|
141
|
-
|
|
142
|
-
for (var i = 0, len = callbacks.length; i < len; ++i) {
|
|
143
|
-
callbacks[i].apply(this, args);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return this;
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Return array of callbacks for `event`.
|
|
151
|
-
*
|
|
152
|
-
* @param {String} event
|
|
153
|
-
* @return {Array}
|
|
154
|
-
* @api public
|
|
155
|
-
*/
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
Emitter.prototype.listeners = function (event) {
|
|
159
|
-
this._callbacks = this._callbacks || {};
|
|
160
|
-
return this._callbacks['$' + event] || [];
|
|
161
|
-
};
|
|
162
|
-
/**
|
|
163
|
-
* Check if this emitter has `event` handlers.
|
|
164
|
-
*
|
|
165
|
-
* @param {String} event
|
|
166
|
-
* @return {Boolean}
|
|
167
|
-
* @api public
|
|
168
|
-
*/
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
Emitter.prototype.hasListeners = function (event) {
|
|
172
|
-
return !!this.listeners(event).length;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
},{}],2:[function(require,module,exports){
|
|
176
|
-
"use strict";
|
|
177
|
-
|
|
178
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
179
|
-
|
|
180
|
-
module.exports = stringify;
|
|
181
|
-
stringify.default = stringify;
|
|
182
|
-
stringify.stable = deterministicStringify;
|
|
183
|
-
stringify.stableStringify = deterministicStringify;
|
|
184
|
-
var arr = [];
|
|
185
|
-
var replacerStack = []; // Regular stringify
|
|
186
|
-
|
|
187
|
-
function stringify(obj, replacer, spacer) {
|
|
188
|
-
decirc(obj, '', [], undefined);
|
|
189
|
-
var res;
|
|
190
|
-
|
|
191
|
-
if (replacerStack.length === 0) {
|
|
192
|
-
res = JSON.stringify(obj, replacer, spacer);
|
|
193
|
-
} else {
|
|
194
|
-
res = JSON.stringify(obj, replaceGetterValues(replacer), spacer);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
while (arr.length !== 0) {
|
|
198
|
-
var part = arr.pop();
|
|
199
|
-
|
|
200
|
-
if (part.length === 4) {
|
|
201
|
-
Object.defineProperty(part[0], part[1], part[3]);
|
|
202
|
-
} else {
|
|
203
|
-
part[0][part[1]] = part[2];
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return res;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
function decirc(val, k, stack, parent) {
|
|
211
|
-
var i;
|
|
212
|
-
|
|
213
|
-
if (_typeof(val) === 'object' && val !== null) {
|
|
214
|
-
for (i = 0; i < stack.length; i++) {
|
|
215
|
-
if (stack[i] === val) {
|
|
216
|
-
var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
|
|
217
|
-
|
|
218
|
-
if (propertyDescriptor.get !== undefined) {
|
|
219
|
-
if (propertyDescriptor.configurable) {
|
|
220
|
-
Object.defineProperty(parent, k, {
|
|
221
|
-
value: '[Circular]'
|
|
222
|
-
});
|
|
223
|
-
arr.push([parent, k, val, propertyDescriptor]);
|
|
224
|
-
} else {
|
|
225
|
-
replacerStack.push([val, k]);
|
|
226
|
-
}
|
|
227
|
-
} else {
|
|
228
|
-
parent[k] = '[Circular]';
|
|
229
|
-
arr.push([parent, k, val]);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
stack.push(val); // Optimize for Arrays. Big arrays could kill the performance otherwise!
|
|
237
|
-
|
|
238
|
-
if (Array.isArray(val)) {
|
|
239
|
-
for (i = 0; i < val.length; i++) {
|
|
240
|
-
decirc(val[i], i, stack, val);
|
|
241
|
-
}
|
|
242
|
-
} else {
|
|
243
|
-
var keys = Object.keys(val);
|
|
244
|
-
|
|
245
|
-
for (i = 0; i < keys.length; i++) {
|
|
246
|
-
var key = keys[i];
|
|
247
|
-
decirc(val[key], key, stack, val);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
stack.pop();
|
|
252
|
-
}
|
|
253
|
-
} // Stable-stringify
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
function compareFunction(a, b) {
|
|
257
|
-
if (a < b) {
|
|
258
|
-
return -1;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
if (a > b) {
|
|
262
|
-
return 1;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
return 0;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
function deterministicStringify(obj, replacer, spacer) {
|
|
269
|
-
var tmp = deterministicDecirc(obj, '', [], undefined) || obj;
|
|
270
|
-
var res;
|
|
271
|
-
|
|
272
|
-
if (replacerStack.length === 0) {
|
|
273
|
-
res = JSON.stringify(tmp, replacer, spacer);
|
|
274
|
-
} else {
|
|
275
|
-
res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
while (arr.length !== 0) {
|
|
279
|
-
var part = arr.pop();
|
|
280
|
-
|
|
281
|
-
if (part.length === 4) {
|
|
282
|
-
Object.defineProperty(part[0], part[1], part[3]);
|
|
283
|
-
} else {
|
|
284
|
-
part[0][part[1]] = part[2];
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
return res;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function deterministicDecirc(val, k, stack, parent) {
|
|
292
|
-
var i;
|
|
293
|
-
|
|
294
|
-
if (_typeof(val) === 'object' && val !== null) {
|
|
295
|
-
for (i = 0; i < stack.length; i++) {
|
|
296
|
-
if (stack[i] === val) {
|
|
297
|
-
var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
|
|
298
|
-
|
|
299
|
-
if (propertyDescriptor.get !== undefined) {
|
|
300
|
-
if (propertyDescriptor.configurable) {
|
|
301
|
-
Object.defineProperty(parent, k, {
|
|
302
|
-
value: '[Circular]'
|
|
303
|
-
});
|
|
304
|
-
arr.push([parent, k, val, propertyDescriptor]);
|
|
305
|
-
} else {
|
|
306
|
-
replacerStack.push([val, k]);
|
|
307
|
-
}
|
|
308
|
-
} else {
|
|
309
|
-
parent[k] = '[Circular]';
|
|
310
|
-
arr.push([parent, k, val]);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
if (typeof val.toJSON === 'function') {
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
stack.push(val); // Optimize for Arrays. Big arrays could kill the performance otherwise!
|
|
322
|
-
|
|
323
|
-
if (Array.isArray(val)) {
|
|
324
|
-
for (i = 0; i < val.length; i++) {
|
|
325
|
-
deterministicDecirc(val[i], i, stack, val);
|
|
326
|
-
}
|
|
327
|
-
} else {
|
|
328
|
-
// Create a temporary object in the required way
|
|
329
|
-
var tmp = {};
|
|
330
|
-
var keys = Object.keys(val).sort(compareFunction);
|
|
331
|
-
|
|
332
|
-
for (i = 0; i < keys.length; i++) {
|
|
333
|
-
var key = keys[i];
|
|
334
|
-
deterministicDecirc(val[key], key, stack, val);
|
|
335
|
-
tmp[key] = val[key];
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
if (parent !== undefined) {
|
|
339
|
-
arr.push([parent, k, val]);
|
|
340
|
-
parent[k] = tmp;
|
|
341
|
-
} else {
|
|
342
|
-
return tmp;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
stack.pop();
|
|
347
|
-
}
|
|
348
|
-
} // wraps replacer function to handle values we couldn't replace
|
|
349
|
-
// and mark them as [Circular]
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
function replaceGetterValues(replacer) {
|
|
353
|
-
replacer = replacer !== undefined ? replacer : function (k, v) {
|
|
354
|
-
return v;
|
|
355
|
-
};
|
|
356
|
-
return function (key, val) {
|
|
357
|
-
if (replacerStack.length > 0) {
|
|
358
|
-
for (var i = 0; i < replacerStack.length; i++) {
|
|
359
|
-
var part = replacerStack[i];
|
|
360
|
-
|
|
361
|
-
if (part[1] === key && part[0] === val) {
|
|
362
|
-
val = '[Circular]';
|
|
363
|
-
replacerStack.splice(i, 1);
|
|
364
|
-
break;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
return replacer.call(this, key, val);
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
},{}],3:[function(require,module,exports){
|
|
374
|
-
"use strict";
|
|
375
|
-
|
|
376
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
377
|
-
|
|
378
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
379
|
-
|
|
380
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
381
|
-
|
|
382
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
383
|
-
|
|
384
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
385
|
-
|
|
386
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
387
|
-
|
|
388
|
-
function Agent() {
|
|
389
|
-
this._defaults = [];
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
['use', 'on', 'once', 'set', 'query', 'type', 'accept', 'auth', 'withCredentials', 'sortQuery', 'retry', 'ok', 'redirects', 'timeout', 'buffer', 'serialize', 'parse', 'ca', 'key', 'pfx', 'cert', 'disableTLSCerts'].forEach(function (fn) {
|
|
393
|
-
// Default setting for all requests from this agent
|
|
394
|
-
Agent.prototype[fn] = function () {
|
|
395
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
396
|
-
args[_key] = arguments[_key];
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
this._defaults.push({
|
|
400
|
-
fn: fn,
|
|
401
|
-
args: args
|
|
402
|
-
});
|
|
403
|
-
|
|
404
|
-
return this;
|
|
405
|
-
};
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
Agent.prototype._setDefaults = function (req) {
|
|
409
|
-
this._defaults.forEach(function (def) {
|
|
410
|
-
req[def.fn].apply(req, _toConsumableArray(def.args));
|
|
411
|
-
});
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
module.exports = Agent;
|
|
415
|
-
|
|
416
|
-
},{}],4:[function(require,module,exports){
|
|
417
|
-
"use strict";
|
|
418
|
-
|
|
419
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* Check if `obj` is an object.
|
|
423
|
-
*
|
|
424
|
-
* @param {Object} obj
|
|
425
|
-
* @return {Boolean}
|
|
426
|
-
* @api private
|
|
427
|
-
*/
|
|
428
|
-
function isObject(obj) {
|
|
429
|
-
return obj !== null && _typeof(obj) === 'object';
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
module.exports = isObject;
|
|
433
|
-
|
|
434
|
-
},{}],5:[function(require,module,exports){
|
|
435
|
-
"use strict";
|
|
436
|
-
|
|
437
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Root reference for iframes.
|
|
441
|
-
*/
|
|
442
|
-
var root;
|
|
443
|
-
|
|
444
|
-
if (typeof window !== 'undefined') {
|
|
445
|
-
// Browser window
|
|
446
|
-
root = window;
|
|
447
|
-
} else if (typeof self === 'undefined') {
|
|
448
|
-
// Other environments
|
|
449
|
-
console.warn('Using browser-only version of superagent in non-browser environment');
|
|
450
|
-
root = void 0;
|
|
451
|
-
} else {
|
|
452
|
-
// Web Worker
|
|
453
|
-
root = self;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
var Emitter = require('component-emitter');
|
|
457
|
-
|
|
458
|
-
var safeStringify = require('fast-safe-stringify');
|
|
459
|
-
|
|
460
|
-
var RequestBase = require('./request-base');
|
|
461
|
-
|
|
462
|
-
var isObject = require('./is-object');
|
|
463
|
-
|
|
464
|
-
var ResponseBase = require('./response-base');
|
|
465
|
-
|
|
466
|
-
var Agent = require('./agent-base');
|
|
467
|
-
/**
|
|
468
|
-
* Noop.
|
|
469
|
-
*/
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
function noop() {}
|
|
473
|
-
/**
|
|
474
|
-
* Expose `request`.
|
|
475
|
-
*/
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
module.exports = function (method, url) {
|
|
479
|
-
// callback
|
|
480
|
-
if (typeof url === 'function') {
|
|
481
|
-
return new exports.Request('GET', method).end(url);
|
|
482
|
-
} // url first
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
if (arguments.length === 1) {
|
|
486
|
-
return new exports.Request('GET', method);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
return new exports.Request(method, url);
|
|
490
|
-
};
|
|
491
|
-
|
|
492
|
-
exports = module.exports;
|
|
493
|
-
var request = exports;
|
|
494
|
-
exports.Request = Request;
|
|
495
|
-
/**
|
|
496
|
-
* Determine XHR.
|
|
497
|
-
*/
|
|
498
|
-
|
|
499
|
-
request.getXHR = function () {
|
|
500
|
-
if (root.XMLHttpRequest && (!root.location || root.location.protocol !== 'file:' || !root.ActiveXObject)) {
|
|
501
|
-
return new XMLHttpRequest();
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
try {
|
|
505
|
-
return new ActiveXObject('Microsoft.XMLHTTP');
|
|
506
|
-
} catch (_unused) {}
|
|
507
|
-
|
|
508
|
-
try {
|
|
509
|
-
return new ActiveXObject('Msxml2.XMLHTTP.6.0');
|
|
510
|
-
} catch (_unused2) {}
|
|
511
|
-
|
|
512
|
-
try {
|
|
513
|
-
return new ActiveXObject('Msxml2.XMLHTTP.3.0');
|
|
514
|
-
} catch (_unused3) {}
|
|
515
|
-
|
|
516
|
-
try {
|
|
517
|
-
return new ActiveXObject('Msxml2.XMLHTTP');
|
|
518
|
-
} catch (_unused4) {}
|
|
519
|
-
|
|
520
|
-
throw new Error('Browser-only version of superagent could not find XHR');
|
|
521
|
-
};
|
|
522
|
-
/**
|
|
523
|
-
* Removes leading and trailing whitespace, added to support IE.
|
|
524
|
-
*
|
|
525
|
-
* @param {String} s
|
|
526
|
-
* @return {String}
|
|
527
|
-
* @api private
|
|
528
|
-
*/
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
var trim = ''.trim ? function (s) {
|
|
532
|
-
return s.trim();
|
|
533
|
-
} : function (s) {
|
|
534
|
-
return s.replace(/(^\s*|\s*$)/g, '');
|
|
535
|
-
};
|
|
536
|
-
/**
|
|
537
|
-
* Serialize the given `obj`.
|
|
538
|
-
*
|
|
539
|
-
* @param {Object} obj
|
|
540
|
-
* @return {String}
|
|
541
|
-
* @api private
|
|
542
|
-
*/
|
|
543
|
-
|
|
544
|
-
function serialize(obj) {
|
|
545
|
-
if (!isObject(obj)) return obj;
|
|
546
|
-
var pairs = [];
|
|
547
|
-
|
|
548
|
-
for (var key in obj) {
|
|
549
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) pushEncodedKeyValuePair(pairs, key, obj[key]);
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
return pairs.join('&');
|
|
553
|
-
}
|
|
554
|
-
/**
|
|
555
|
-
* Helps 'serialize' with serializing arrays.
|
|
556
|
-
* Mutates the pairs array.
|
|
557
|
-
*
|
|
558
|
-
* @param {Array} pairs
|
|
559
|
-
* @param {String} key
|
|
560
|
-
* @param {Mixed} val
|
|
561
|
-
*/
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
function pushEncodedKeyValuePair(pairs, key, val) {
|
|
565
|
-
if (val === undefined) return;
|
|
566
|
-
|
|
567
|
-
if (val === null) {
|
|
568
|
-
pairs.push(encodeURI(key));
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
if (Array.isArray(val)) {
|
|
573
|
-
val.forEach(function (v) {
|
|
574
|
-
pushEncodedKeyValuePair(pairs, key, v);
|
|
575
|
-
});
|
|
576
|
-
} else if (isObject(val)) {
|
|
577
|
-
for (var subkey in val) {
|
|
578
|
-
if (Object.prototype.hasOwnProperty.call(val, subkey)) pushEncodedKeyValuePair(pairs, "".concat(key, "[").concat(subkey, "]"), val[subkey]);
|
|
579
|
-
}
|
|
580
|
-
} else {
|
|
581
|
-
pairs.push(encodeURI(key) + '=' + encodeURIComponent(val));
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
/**
|
|
585
|
-
* Expose serialization method.
|
|
586
|
-
*/
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
request.serializeObject = serialize;
|
|
590
|
-
/**
|
|
591
|
-
* Parse the given x-www-form-urlencoded `str`.
|
|
592
|
-
*
|
|
593
|
-
* @param {String} str
|
|
594
|
-
* @return {Object}
|
|
595
|
-
* @api private
|
|
596
|
-
*/
|
|
597
|
-
|
|
598
|
-
function parseString(str) {
|
|
599
|
-
var obj = {};
|
|
600
|
-
var pairs = str.split('&');
|
|
601
|
-
var pair;
|
|
602
|
-
var pos;
|
|
603
|
-
|
|
604
|
-
for (var i = 0, len = pairs.length; i < len; ++i) {
|
|
605
|
-
pair = pairs[i];
|
|
606
|
-
pos = pair.indexOf('=');
|
|
607
|
-
|
|
608
|
-
if (pos === -1) {
|
|
609
|
-
obj[decodeURIComponent(pair)] = '';
|
|
610
|
-
} else {
|
|
611
|
-
obj[decodeURIComponent(pair.slice(0, pos))] = decodeURIComponent(pair.slice(pos + 1));
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
return obj;
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
* Expose parser.
|
|
619
|
-
*/
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
request.parseString = parseString;
|
|
623
|
-
/**
|
|
624
|
-
* Default MIME type map.
|
|
625
|
-
*
|
|
626
|
-
* superagent.types.xml = 'application/xml';
|
|
627
|
-
*
|
|
628
|
-
*/
|
|
629
|
-
|
|
630
|
-
request.types = {
|
|
631
|
-
html: 'text/html',
|
|
632
|
-
json: 'application/json',
|
|
633
|
-
xml: 'text/xml',
|
|
634
|
-
urlencoded: 'application/x-www-form-urlencoded',
|
|
635
|
-
form: 'application/x-www-form-urlencoded',
|
|
636
|
-
'form-data': 'application/x-www-form-urlencoded'
|
|
637
|
-
};
|
|
638
|
-
/**
|
|
639
|
-
* Default serialization map.
|
|
640
|
-
*
|
|
641
|
-
* superagent.serialize['application/xml'] = function(obj){
|
|
642
|
-
* return 'generated xml here';
|
|
643
|
-
* };
|
|
644
|
-
*
|
|
645
|
-
*/
|
|
646
|
-
|
|
647
|
-
request.serialize = {
|
|
648
|
-
'application/x-www-form-urlencoded': serialize,
|
|
649
|
-
'application/json': safeStringify
|
|
650
|
-
};
|
|
651
|
-
/**
|
|
652
|
-
* Default parsers.
|
|
653
|
-
*
|
|
654
|
-
* superagent.parse['application/xml'] = function(str){
|
|
655
|
-
* return { object parsed from str };
|
|
656
|
-
* };
|
|
657
|
-
*
|
|
658
|
-
*/
|
|
659
|
-
|
|
660
|
-
request.parse = {
|
|
661
|
-
'application/x-www-form-urlencoded': parseString,
|
|
662
|
-
'application/json': JSON.parse
|
|
663
|
-
};
|
|
664
|
-
/**
|
|
665
|
-
* Parse the given header `str` into
|
|
666
|
-
* an object containing the mapped fields.
|
|
667
|
-
*
|
|
668
|
-
* @param {String} str
|
|
669
|
-
* @return {Object}
|
|
670
|
-
* @api private
|
|
671
|
-
*/
|
|
672
|
-
|
|
673
|
-
function parseHeader(str) {
|
|
674
|
-
var lines = str.split(/\r?\n/);
|
|
675
|
-
var fields = {};
|
|
676
|
-
var index;
|
|
677
|
-
var line;
|
|
678
|
-
var field;
|
|
679
|
-
var val;
|
|
680
|
-
|
|
681
|
-
for (var i = 0, len = lines.length; i < len; ++i) {
|
|
682
|
-
line = lines[i];
|
|
683
|
-
index = line.indexOf(':');
|
|
684
|
-
|
|
685
|
-
if (index === -1) {
|
|
686
|
-
// could be empty line, just skip it
|
|
687
|
-
continue;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
field = line.slice(0, index).toLowerCase();
|
|
691
|
-
val = trim(line.slice(index + 1));
|
|
692
|
-
fields[field] = val;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
return fields;
|
|
696
|
-
}
|
|
697
|
-
/**
|
|
698
|
-
* Check if `mime` is json or has +json structured syntax suffix.
|
|
699
|
-
*
|
|
700
|
-
* @param {String} mime
|
|
701
|
-
* @return {Boolean}
|
|
702
|
-
* @api private
|
|
703
|
-
*/
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
function isJSON(mime) {
|
|
707
|
-
// should match /json or +json
|
|
708
|
-
// but not /json-seq
|
|
709
|
-
return /[/+]json($|[^-\w])/.test(mime);
|
|
710
|
-
}
|
|
711
|
-
/**
|
|
712
|
-
* Initialize a new `Response` with the given `xhr`.
|
|
713
|
-
*
|
|
714
|
-
* - set flags (.ok, .error, etc)
|
|
715
|
-
* - parse header
|
|
716
|
-
*
|
|
717
|
-
* Examples:
|
|
718
|
-
*
|
|
719
|
-
* Aliasing `superagent` as `request` is nice:
|
|
720
|
-
*
|
|
721
|
-
* request = superagent;
|
|
722
|
-
*
|
|
723
|
-
* We can use the promise-like API, or pass callbacks:
|
|
724
|
-
*
|
|
725
|
-
* request.get('/').end(function(res){});
|
|
726
|
-
* request.get('/', function(res){});
|
|
727
|
-
*
|
|
728
|
-
* Sending data can be chained:
|
|
729
|
-
*
|
|
730
|
-
* request
|
|
731
|
-
* .post('/user')
|
|
732
|
-
* .send({ name: 'tj' })
|
|
733
|
-
* .end(function(res){});
|
|
734
|
-
*
|
|
735
|
-
* Or passed to `.send()`:
|
|
736
|
-
*
|
|
737
|
-
* request
|
|
738
|
-
* .post('/user')
|
|
739
|
-
* .send({ name: 'tj' }, function(res){});
|
|
740
|
-
*
|
|
741
|
-
* Or passed to `.post()`:
|
|
742
|
-
*
|
|
743
|
-
* request
|
|
744
|
-
* .post('/user', { name: 'tj' })
|
|
745
|
-
* .end(function(res){});
|
|
746
|
-
*
|
|
747
|
-
* Or further reduced to a single call for simple cases:
|
|
748
|
-
*
|
|
749
|
-
* request
|
|
750
|
-
* .post('/user', { name: 'tj' }, function(res){});
|
|
751
|
-
*
|
|
752
|
-
* @param {XMLHTTPRequest} xhr
|
|
753
|
-
* @param {Object} options
|
|
754
|
-
* @api private
|
|
755
|
-
*/
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
function Response(req) {
|
|
759
|
-
this.req = req;
|
|
760
|
-
this.xhr = this.req.xhr; // responseText is accessible only if responseType is '' or 'text' and on older browsers
|
|
761
|
-
|
|
762
|
-
this.text = this.req.method !== 'HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text') || typeof this.xhr.responseType === 'undefined' ? this.xhr.responseText : null;
|
|
763
|
-
this.statusText = this.req.xhr.statusText;
|
|
764
|
-
var status = this.xhr.status; // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
|
|
765
|
-
|
|
766
|
-
if (status === 1223) {
|
|
767
|
-
status = 204;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
this._setStatusProperties(status);
|
|
771
|
-
|
|
772
|
-
this.headers = parseHeader(this.xhr.getAllResponseHeaders());
|
|
773
|
-
this.header = this.headers; // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but
|
|
774
|
-
// getResponseHeader still works. so we get content-type even if getting
|
|
775
|
-
// other headers fails.
|
|
776
|
-
|
|
777
|
-
this.header['content-type'] = this.xhr.getResponseHeader('content-type');
|
|
778
|
-
|
|
779
|
-
this._setHeaderProperties(this.header);
|
|
780
|
-
|
|
781
|
-
if (this.text === null && req._responseType) {
|
|
782
|
-
this.body = this.xhr.response;
|
|
783
|
-
} else {
|
|
784
|
-
this.body = this.req.method === 'HEAD' ? null : this._parseBody(this.text ? this.text : this.xhr.response);
|
|
785
|
-
}
|
|
786
|
-
} // eslint-disable-next-line new-cap
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
ResponseBase(Response.prototype);
|
|
790
|
-
/**
|
|
791
|
-
* Parse the given body `str`.
|
|
792
|
-
*
|
|
793
|
-
* Used for auto-parsing of bodies. Parsers
|
|
794
|
-
* are defined on the `superagent.parse` object.
|
|
795
|
-
*
|
|
796
|
-
* @param {String} str
|
|
797
|
-
* @return {Mixed}
|
|
798
|
-
* @api private
|
|
799
|
-
*/
|
|
800
|
-
|
|
801
|
-
Response.prototype._parseBody = function (str) {
|
|
802
|
-
var parse = request.parse[this.type];
|
|
803
|
-
|
|
804
|
-
if (this.req._parser) {
|
|
805
|
-
return this.req._parser(this, str);
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
if (!parse && isJSON(this.type)) {
|
|
809
|
-
parse = request.parse['application/json'];
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
return parse && str && (str.length > 0 || str instanceof Object) ? parse(str) : null;
|
|
813
|
-
};
|
|
814
|
-
/**
|
|
815
|
-
* Return an `Error` representative of this response.
|
|
816
|
-
*
|
|
817
|
-
* @return {Error}
|
|
818
|
-
* @api public
|
|
819
|
-
*/
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
Response.prototype.toError = function () {
|
|
823
|
-
var req = this.req;
|
|
824
|
-
var method = req.method;
|
|
825
|
-
var url = req.url;
|
|
826
|
-
var msg = "cannot ".concat(method, " ").concat(url, " (").concat(this.status, ")");
|
|
827
|
-
var err = new Error(msg);
|
|
828
|
-
err.status = this.status;
|
|
829
|
-
err.method = method;
|
|
830
|
-
err.url = url;
|
|
831
|
-
return err;
|
|
832
|
-
};
|
|
833
|
-
/**
|
|
834
|
-
* Expose `Response`.
|
|
835
|
-
*/
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
request.Response = Response;
|
|
839
|
-
/**
|
|
840
|
-
* Initialize a new `Request` with the given `method` and `url`.
|
|
841
|
-
*
|
|
842
|
-
* @param {String} method
|
|
843
|
-
* @param {String} url
|
|
844
|
-
* @api public
|
|
845
|
-
*/
|
|
846
|
-
|
|
847
|
-
function Request(method, url) {
|
|
848
|
-
var self = this;
|
|
849
|
-
this._query = this._query || [];
|
|
850
|
-
this.method = method;
|
|
851
|
-
this.url = url;
|
|
852
|
-
this.header = {}; // preserves header name case
|
|
853
|
-
|
|
854
|
-
this._header = {}; // coerces header names to lowercase
|
|
855
|
-
|
|
856
|
-
this.on('end', function () {
|
|
857
|
-
var err = null;
|
|
858
|
-
var res = null;
|
|
859
|
-
|
|
860
|
-
try {
|
|
861
|
-
res = new Response(self);
|
|
862
|
-
} catch (err_) {
|
|
863
|
-
err = new Error('Parser is unable to parse the response');
|
|
864
|
-
err.parse = true;
|
|
865
|
-
err.original = err_; // issue #675: return the raw response if the response parsing fails
|
|
866
|
-
|
|
867
|
-
if (self.xhr) {
|
|
868
|
-
// ie9 doesn't have 'response' property
|
|
869
|
-
err.rawResponse = typeof self.xhr.responseType === 'undefined' ? self.xhr.responseText : self.xhr.response; // issue #876: return the http status code if the response parsing fails
|
|
870
|
-
|
|
871
|
-
err.status = self.xhr.status ? self.xhr.status : null;
|
|
872
|
-
err.statusCode = err.status; // backwards-compat only
|
|
873
|
-
} else {
|
|
874
|
-
err.rawResponse = null;
|
|
875
|
-
err.status = null;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
return self.callback(err);
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
self.emit('response', res);
|
|
882
|
-
var new_err;
|
|
883
|
-
|
|
884
|
-
try {
|
|
885
|
-
if (!self._isResponseOK(res)) {
|
|
886
|
-
new_err = new Error(res.statusText || res.text || 'Unsuccessful HTTP response');
|
|
887
|
-
}
|
|
888
|
-
} catch (err_) {
|
|
889
|
-
new_err = err_; // ok() callback can throw
|
|
890
|
-
} // #1000 don't catch errors from the callback to avoid double calling it
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
if (new_err) {
|
|
894
|
-
new_err.original = err;
|
|
895
|
-
new_err.response = res;
|
|
896
|
-
new_err.status = res.status;
|
|
897
|
-
self.callback(new_err, res);
|
|
898
|
-
} else {
|
|
899
|
-
self.callback(null, res);
|
|
900
|
-
}
|
|
901
|
-
});
|
|
902
|
-
}
|
|
903
|
-
/**
|
|
904
|
-
* Mixin `Emitter` and `RequestBase`.
|
|
905
|
-
*/
|
|
906
|
-
// eslint-disable-next-line new-cap
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
Emitter(Request.prototype); // eslint-disable-next-line new-cap
|
|
910
|
-
|
|
911
|
-
RequestBase(Request.prototype);
|
|
912
|
-
/**
|
|
913
|
-
* Set Content-Type to `type`, mapping values from `request.types`.
|
|
914
|
-
*
|
|
915
|
-
* Examples:
|
|
916
|
-
*
|
|
917
|
-
* superagent.types.xml = 'application/xml';
|
|
918
|
-
*
|
|
919
|
-
* request.post('/')
|
|
920
|
-
* .type('xml')
|
|
921
|
-
* .send(xmlstring)
|
|
922
|
-
* .end(callback);
|
|
923
|
-
*
|
|
924
|
-
* request.post('/')
|
|
925
|
-
* .type('application/xml')
|
|
926
|
-
* .send(xmlstring)
|
|
927
|
-
* .end(callback);
|
|
928
|
-
*
|
|
929
|
-
* @param {String} type
|
|
930
|
-
* @return {Request} for chaining
|
|
931
|
-
* @api public
|
|
932
|
-
*/
|
|
933
|
-
|
|
934
|
-
Request.prototype.type = function (type) {
|
|
935
|
-
this.set('Content-Type', request.types[type] || type);
|
|
936
|
-
return this;
|
|
937
|
-
};
|
|
938
|
-
/**
|
|
939
|
-
* Set Accept to `type`, mapping values from `request.types`.
|
|
940
|
-
*
|
|
941
|
-
* Examples:
|
|
942
|
-
*
|
|
943
|
-
* superagent.types.json = 'application/json';
|
|
944
|
-
*
|
|
945
|
-
* request.get('/agent')
|
|
946
|
-
* .accept('json')
|
|
947
|
-
* .end(callback);
|
|
948
|
-
*
|
|
949
|
-
* request.get('/agent')
|
|
950
|
-
* .accept('application/json')
|
|
951
|
-
* .end(callback);
|
|
952
|
-
*
|
|
953
|
-
* @param {String} accept
|
|
954
|
-
* @return {Request} for chaining
|
|
955
|
-
* @api public
|
|
956
|
-
*/
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
Request.prototype.accept = function (type) {
|
|
960
|
-
this.set('Accept', request.types[type] || type);
|
|
961
|
-
return this;
|
|
962
|
-
};
|
|
963
|
-
/**
|
|
964
|
-
* Set Authorization field value with `user` and `pass`.
|
|
965
|
-
*
|
|
966
|
-
* @param {String} user
|
|
967
|
-
* @param {String} [pass] optional in case of using 'bearer' as type
|
|
968
|
-
* @param {Object} options with 'type' property 'auto', 'basic' or 'bearer' (default 'basic')
|
|
969
|
-
* @return {Request} for chaining
|
|
970
|
-
* @api public
|
|
971
|
-
*/
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
Request.prototype.auth = function (user, pass, options) {
|
|
975
|
-
if (arguments.length === 1) pass = '';
|
|
976
|
-
|
|
977
|
-
if (_typeof(pass) === 'object' && pass !== null) {
|
|
978
|
-
// pass is optional and can be replaced with options
|
|
979
|
-
options = pass;
|
|
980
|
-
pass = '';
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
if (!options) {
|
|
984
|
-
options = {
|
|
985
|
-
type: typeof btoa === 'function' ? 'basic' : 'auto'
|
|
986
|
-
};
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
var encoder = function encoder(string) {
|
|
990
|
-
if (typeof btoa === 'function') {
|
|
991
|
-
return btoa(string);
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
throw new Error('Cannot use basic auth, btoa is not a function');
|
|
995
|
-
};
|
|
996
|
-
|
|
997
|
-
return this._auth(user, pass, options, encoder);
|
|
998
|
-
};
|
|
999
|
-
/**
|
|
1000
|
-
* Add query-string `val`.
|
|
1001
|
-
*
|
|
1002
|
-
* Examples:
|
|
1003
|
-
*
|
|
1004
|
-
* request.get('/shoes')
|
|
1005
|
-
* .query('size=10')
|
|
1006
|
-
* .query({ color: 'blue' })
|
|
1007
|
-
*
|
|
1008
|
-
* @param {Object|String} val
|
|
1009
|
-
* @return {Request} for chaining
|
|
1010
|
-
* @api public
|
|
1011
|
-
*/
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
Request.prototype.query = function (val) {
|
|
1015
|
-
if (typeof val !== 'string') val = serialize(val);
|
|
1016
|
-
if (val) this._query.push(val);
|
|
1017
|
-
return this;
|
|
1018
|
-
};
|
|
1019
|
-
/**
|
|
1020
|
-
* Queue the given `file` as an attachment to the specified `field`,
|
|
1021
|
-
* with optional `options` (or filename).
|
|
1022
|
-
*
|
|
1023
|
-
* ``` js
|
|
1024
|
-
* request.post('/upload')
|
|
1025
|
-
* .attach('content', new Blob(['<a id="a"><b id="b">hey!</b></a>'], { type: "text/html"}))
|
|
1026
|
-
* .end(callback);
|
|
1027
|
-
* ```
|
|
1028
|
-
*
|
|
1029
|
-
* @param {String} field
|
|
1030
|
-
* @param {Blob|File} file
|
|
1031
|
-
* @param {String|Object} options
|
|
1032
|
-
* @return {Request} for chaining
|
|
1033
|
-
* @api public
|
|
1034
|
-
*/
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
Request.prototype.attach = function (field, file, options) {
|
|
1038
|
-
if (file) {
|
|
1039
|
-
if (this._data) {
|
|
1040
|
-
throw new Error("superagent can't mix .send() and .attach()");
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
this._getFormData().append(field, file, options || file.name);
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
return this;
|
|
1047
|
-
};
|
|
1048
|
-
|
|
1049
|
-
Request.prototype._getFormData = function () {
|
|
1050
|
-
if (!this._formData) {
|
|
1051
|
-
this._formData = new root.FormData();
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
return this._formData;
|
|
1055
|
-
};
|
|
1056
|
-
/**
|
|
1057
|
-
* Invoke the callback with `err` and `res`
|
|
1058
|
-
* and handle arity check.
|
|
1059
|
-
*
|
|
1060
|
-
* @param {Error} err
|
|
1061
|
-
* @param {Response} res
|
|
1062
|
-
* @api private
|
|
1063
|
-
*/
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
Request.prototype.callback = function (err, res) {
|
|
1067
|
-
if (this._shouldRetry(err, res)) {
|
|
1068
|
-
return this._retry();
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
var fn = this._callback;
|
|
1072
|
-
this.clearTimeout();
|
|
1073
|
-
|
|
1074
|
-
if (err) {
|
|
1075
|
-
if (this._maxRetries) err.retries = this._retries - 1;
|
|
1076
|
-
this.emit('error', err);
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
fn(err, res);
|
|
1080
|
-
};
|
|
1081
|
-
/**
|
|
1082
|
-
* Invoke callback with x-domain error.
|
|
1083
|
-
*
|
|
1084
|
-
* @api private
|
|
1085
|
-
*/
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
Request.prototype.crossDomainError = function () {
|
|
1089
|
-
var err = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');
|
|
1090
|
-
err.crossDomain = true;
|
|
1091
|
-
err.status = this.status;
|
|
1092
|
-
err.method = this.method;
|
|
1093
|
-
err.url = this.url;
|
|
1094
|
-
this.callback(err);
|
|
1095
|
-
}; // This only warns, because the request is still likely to work
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
Request.prototype.agent = function () {
|
|
1099
|
-
console.warn('This is not supported in browser version of superagent');
|
|
1100
|
-
return this;
|
|
1101
|
-
};
|
|
1102
|
-
|
|
1103
|
-
Request.prototype.ca = Request.prototype.agent;
|
|
1104
|
-
Request.prototype.buffer = Request.prototype.ca; // This throws, because it can't send/receive data as expected
|
|
1105
|
-
|
|
1106
|
-
Request.prototype.write = function () {
|
|
1107
|
-
throw new Error('Streaming is not supported in browser version of superagent');
|
|
1108
|
-
};
|
|
1109
|
-
|
|
1110
|
-
Request.prototype.pipe = Request.prototype.write;
|
|
1111
|
-
/**
|
|
1112
|
-
* Check if `obj` is a host object,
|
|
1113
|
-
* we don't want to serialize these :)
|
|
1114
|
-
*
|
|
1115
|
-
* @param {Object} obj host object
|
|
1116
|
-
* @return {Boolean} is a host object
|
|
1117
|
-
* @api private
|
|
1118
|
-
*/
|
|
1119
|
-
|
|
1120
|
-
Request.prototype._isHost = function (obj) {
|
|
1121
|
-
// Native objects stringify to [object File], [object Blob], [object FormData], etc.
|
|
1122
|
-
return obj && _typeof(obj) === 'object' && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== '[object Object]';
|
|
1123
|
-
};
|
|
1124
|
-
/**
|
|
1125
|
-
* Initiate request, invoking callback `fn(res)`
|
|
1126
|
-
* with an instanceof `Response`.
|
|
1127
|
-
*
|
|
1128
|
-
* @param {Function} fn
|
|
1129
|
-
* @return {Request} for chaining
|
|
1130
|
-
* @api public
|
|
1131
|
-
*/
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
Request.prototype.end = function (fn) {
|
|
1135
|
-
if (this._endCalled) {
|
|
1136
|
-
console.warn('Warning: .end() was called twice. This is not supported in superagent');
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
this._endCalled = true; // store callback
|
|
1140
|
-
|
|
1141
|
-
this._callback = fn || noop; // querystring
|
|
1142
|
-
|
|
1143
|
-
this._finalizeQueryString();
|
|
1144
|
-
|
|
1145
|
-
this._end();
|
|
1146
|
-
};
|
|
1147
|
-
|
|
1148
|
-
Request.prototype._setUploadTimeout = function () {
|
|
1149
|
-
var self = this; // upload timeout it's wokrs only if deadline timeout is off
|
|
1150
|
-
|
|
1151
|
-
if (this._uploadTimeout && !this._uploadTimeoutTimer) {
|
|
1152
|
-
this._uploadTimeoutTimer = setTimeout(function () {
|
|
1153
|
-
self._timeoutError('Upload timeout of ', self._uploadTimeout, 'ETIMEDOUT');
|
|
1154
|
-
}, this._uploadTimeout);
|
|
1155
|
-
}
|
|
1156
|
-
}; // eslint-disable-next-line complexity
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
Request.prototype._end = function () {
|
|
1160
|
-
if (this._aborted) return this.callback(new Error('The request has been aborted even before .end() was called'));
|
|
1161
|
-
var self = this;
|
|
1162
|
-
this.xhr = request.getXHR();
|
|
1163
|
-
var xhr = this.xhr;
|
|
1164
|
-
var data = this._formData || this._data;
|
|
1165
|
-
|
|
1166
|
-
this._setTimeouts(); // state change
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
xhr.onreadystatechange = function () {
|
|
1170
|
-
var readyState = xhr.readyState;
|
|
1171
|
-
|
|
1172
|
-
if (readyState >= 2 && self._responseTimeoutTimer) {
|
|
1173
|
-
clearTimeout(self._responseTimeoutTimer);
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
if (readyState !== 4) {
|
|
1177
|
-
return;
|
|
1178
|
-
} // In IE9, reads to any property (e.g. status) off of an aborted XHR will
|
|
1179
|
-
// result in the error "Could not complete the operation due to error c00c023f"
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
var status;
|
|
1183
|
-
|
|
1184
|
-
try {
|
|
1185
|
-
status = xhr.status;
|
|
1186
|
-
} catch (_unused5) {
|
|
1187
|
-
status = 0;
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
if (!status) {
|
|
1191
|
-
if (self.timedout || self._aborted) return;
|
|
1192
|
-
return self.crossDomainError();
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
self.emit('end');
|
|
1196
|
-
}; // progress
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
var handleProgress = function handleProgress(direction, e) {
|
|
1200
|
-
if (e.total > 0) {
|
|
1201
|
-
e.percent = e.loaded / e.total * 100;
|
|
1202
|
-
|
|
1203
|
-
if (e.percent === 100) {
|
|
1204
|
-
clearTimeout(self._uploadTimeoutTimer);
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
e.direction = direction;
|
|
1209
|
-
self.emit('progress', e);
|
|
1210
|
-
};
|
|
1211
|
-
|
|
1212
|
-
if (this.hasListeners('progress')) {
|
|
1213
|
-
try {
|
|
1214
|
-
xhr.addEventListener('progress', handleProgress.bind(null, 'download'));
|
|
1215
|
-
|
|
1216
|
-
if (xhr.upload) {
|
|
1217
|
-
xhr.upload.addEventListener('progress', handleProgress.bind(null, 'upload'));
|
|
1218
|
-
}
|
|
1219
|
-
} catch (_unused6) {// Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.
|
|
1220
|
-
// Reported here:
|
|
1221
|
-
// https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
if (xhr.upload) {
|
|
1226
|
-
this._setUploadTimeout();
|
|
1227
|
-
} // initiate request
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
try {
|
|
1231
|
-
if (this.username && this.password) {
|
|
1232
|
-
xhr.open(this.method, this.url, true, this.username, this.password);
|
|
1233
|
-
} else {
|
|
1234
|
-
xhr.open(this.method, this.url, true);
|
|
1235
|
-
}
|
|
1236
|
-
} catch (err) {
|
|
1237
|
-
// see #1149
|
|
1238
|
-
return this.callback(err);
|
|
1239
|
-
} // CORS
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
if (this._withCredentials) xhr.withCredentials = true; // body
|
|
1243
|
-
|
|
1244
|
-
if (!this._formData && this.method !== 'GET' && this.method !== 'HEAD' && typeof data !== 'string' && !this._isHost(data)) {
|
|
1245
|
-
// serialize stuff
|
|
1246
|
-
var contentType = this._header['content-type'];
|
|
1247
|
-
|
|
1248
|
-
var _serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];
|
|
1249
|
-
|
|
1250
|
-
if (!_serialize && isJSON(contentType)) {
|
|
1251
|
-
_serialize = request.serialize['application/json'];
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
if (_serialize) data = _serialize(data);
|
|
1255
|
-
} // set header fields
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
for (var field in this.header) {
|
|
1259
|
-
if (this.header[field] === null) continue;
|
|
1260
|
-
if (Object.prototype.hasOwnProperty.call(this.header, field)) xhr.setRequestHeader(field, this.header[field]);
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
if (this._responseType) {
|
|
1264
|
-
xhr.responseType = this._responseType;
|
|
1265
|
-
} // send stuff
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
this.emit('request', this); // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)
|
|
1269
|
-
// We need null here if data is undefined
|
|
1270
|
-
|
|
1271
|
-
xhr.send(typeof data === 'undefined' ? null : data);
|
|
1272
|
-
};
|
|
1273
|
-
|
|
1274
|
-
request.agent = function () {
|
|
1275
|
-
return new Agent();
|
|
1276
|
-
};
|
|
1277
|
-
|
|
1278
|
-
['GET', 'POST', 'OPTIONS', 'PATCH', 'PUT', 'DELETE'].forEach(function (method) {
|
|
1279
|
-
Agent.prototype[method.toLowerCase()] = function (url, fn) {
|
|
1280
|
-
var req = new request.Request(method, url);
|
|
1281
|
-
|
|
1282
|
-
this._setDefaults(req);
|
|
1283
|
-
|
|
1284
|
-
if (fn) {
|
|
1285
|
-
req.end(fn);
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
return req;
|
|
1289
|
-
};
|
|
1290
|
-
});
|
|
1291
|
-
Agent.prototype.del = Agent.prototype.delete;
|
|
1292
|
-
/**
|
|
1293
|
-
* GET `url` with optional callback `fn(res)`.
|
|
1294
|
-
*
|
|
1295
|
-
* @param {String} url
|
|
1296
|
-
* @param {Mixed|Function} [data] or fn
|
|
1297
|
-
* @param {Function} [fn]
|
|
1298
|
-
* @return {Request}
|
|
1299
|
-
* @api public
|
|
1300
|
-
*/
|
|
1301
|
-
|
|
1302
|
-
request.get = function (url, data, fn) {
|
|
1303
|
-
var req = request('GET', url);
|
|
1304
|
-
|
|
1305
|
-
if (typeof data === 'function') {
|
|
1306
|
-
fn = data;
|
|
1307
|
-
data = null;
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
if (data) req.query(data);
|
|
1311
|
-
if (fn) req.end(fn);
|
|
1312
|
-
return req;
|
|
1313
|
-
};
|
|
1314
|
-
/**
|
|
1315
|
-
* HEAD `url` with optional callback `fn(res)`.
|
|
1316
|
-
*
|
|
1317
|
-
* @param {String} url
|
|
1318
|
-
* @param {Mixed|Function} [data] or fn
|
|
1319
|
-
* @param {Function} [fn]
|
|
1320
|
-
* @return {Request}
|
|
1321
|
-
* @api public
|
|
1322
|
-
*/
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
request.head = function (url, data, fn) {
|
|
1326
|
-
var req = request('HEAD', url);
|
|
1327
|
-
|
|
1328
|
-
if (typeof data === 'function') {
|
|
1329
|
-
fn = data;
|
|
1330
|
-
data = null;
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
if (data) req.query(data);
|
|
1334
|
-
if (fn) req.end(fn);
|
|
1335
|
-
return req;
|
|
1336
|
-
};
|
|
1337
|
-
/**
|
|
1338
|
-
* OPTIONS query to `url` with optional callback `fn(res)`.
|
|
1339
|
-
*
|
|
1340
|
-
* @param {String} url
|
|
1341
|
-
* @param {Mixed|Function} [data] or fn
|
|
1342
|
-
* @param {Function} [fn]
|
|
1343
|
-
* @return {Request}
|
|
1344
|
-
* @api public
|
|
1345
|
-
*/
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
request.options = function (url, data, fn) {
|
|
1349
|
-
var req = request('OPTIONS', url);
|
|
1350
|
-
|
|
1351
|
-
if (typeof data === 'function') {
|
|
1352
|
-
fn = data;
|
|
1353
|
-
data = null;
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
if (data) req.send(data);
|
|
1357
|
-
if (fn) req.end(fn);
|
|
1358
|
-
return req;
|
|
1359
|
-
};
|
|
1360
|
-
/**
|
|
1361
|
-
* DELETE `url` with optional `data` and callback `fn(res)`.
|
|
1362
|
-
*
|
|
1363
|
-
* @param {String} url
|
|
1364
|
-
* @param {Mixed} [data]
|
|
1365
|
-
* @param {Function} [fn]
|
|
1366
|
-
* @return {Request}
|
|
1367
|
-
* @api public
|
|
1368
|
-
*/
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
function del(url, data, fn) {
|
|
1372
|
-
var req = request('DELETE', url);
|
|
1373
|
-
|
|
1374
|
-
if (typeof data === 'function') {
|
|
1375
|
-
fn = data;
|
|
1376
|
-
data = null;
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
if (data) req.send(data);
|
|
1380
|
-
if (fn) req.end(fn);
|
|
1381
|
-
return req;
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
request.del = del;
|
|
1385
|
-
request.delete = del;
|
|
1386
|
-
/**
|
|
1387
|
-
* PATCH `url` with optional `data` and callback `fn(res)`.
|
|
1388
|
-
*
|
|
1389
|
-
* @param {String} url
|
|
1390
|
-
* @param {Mixed} [data]
|
|
1391
|
-
* @param {Function} [fn]
|
|
1392
|
-
* @return {Request}
|
|
1393
|
-
* @api public
|
|
1394
|
-
*/
|
|
1395
|
-
|
|
1396
|
-
request.patch = function (url, data, fn) {
|
|
1397
|
-
var req = request('PATCH', url);
|
|
1398
|
-
|
|
1399
|
-
if (typeof data === 'function') {
|
|
1400
|
-
fn = data;
|
|
1401
|
-
data = null;
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
if (data) req.send(data);
|
|
1405
|
-
if (fn) req.end(fn);
|
|
1406
|
-
return req;
|
|
1407
|
-
};
|
|
1408
|
-
/**
|
|
1409
|
-
* POST `url` with optional `data` and callback `fn(res)`.
|
|
1410
|
-
*
|
|
1411
|
-
* @param {String} url
|
|
1412
|
-
* @param {Mixed} [data]
|
|
1413
|
-
* @param {Function} [fn]
|
|
1414
|
-
* @return {Request}
|
|
1415
|
-
* @api public
|
|
1416
|
-
*/
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
request.post = function (url, data, fn) {
|
|
1420
|
-
var req = request('POST', url);
|
|
1421
|
-
|
|
1422
|
-
if (typeof data === 'function') {
|
|
1423
|
-
fn = data;
|
|
1424
|
-
data = null;
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
|
-
if (data) req.send(data);
|
|
1428
|
-
if (fn) req.end(fn);
|
|
1429
|
-
return req;
|
|
1430
|
-
};
|
|
1431
|
-
/**
|
|
1432
|
-
* PUT `url` with optional `data` and callback `fn(res)`.
|
|
1433
|
-
*
|
|
1434
|
-
* @param {String} url
|
|
1435
|
-
* @param {Mixed|Function} [data] or fn
|
|
1436
|
-
* @param {Function} [fn]
|
|
1437
|
-
* @return {Request}
|
|
1438
|
-
* @api public
|
|
1439
|
-
*/
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
request.put = function (url, data, fn) {
|
|
1443
|
-
var req = request('PUT', url);
|
|
1444
|
-
|
|
1445
|
-
if (typeof data === 'function') {
|
|
1446
|
-
fn = data;
|
|
1447
|
-
data = null;
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
if (data) req.send(data);
|
|
1451
|
-
if (fn) req.end(fn);
|
|
1452
|
-
return req;
|
|
1453
|
-
};
|
|
1454
|
-
|
|
1455
|
-
},{"./agent-base":3,"./is-object":4,"./request-base":6,"./response-base":7,"component-emitter":1,"fast-safe-stringify":2}],6:[function(require,module,exports){
|
|
1456
|
-
"use strict";
|
|
1457
|
-
|
|
1458
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
1459
|
-
|
|
1460
|
-
/**
|
|
1461
|
-
* Module of mixed-in functions shared between node and client code
|
|
1462
|
-
*/
|
|
1463
|
-
var isObject = require('./is-object');
|
|
1464
|
-
/**
|
|
1465
|
-
* Expose `RequestBase`.
|
|
1466
|
-
*/
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
module.exports = RequestBase;
|
|
1470
|
-
/**
|
|
1471
|
-
* Initialize a new `RequestBase`.
|
|
1472
|
-
*
|
|
1473
|
-
* @api public
|
|
1474
|
-
*/
|
|
1475
|
-
|
|
1476
|
-
function RequestBase(obj) {
|
|
1477
|
-
if (obj) return mixin(obj);
|
|
1478
|
-
}
|
|
1479
|
-
/**
|
|
1480
|
-
* Mixin the prototype properties.
|
|
1481
|
-
*
|
|
1482
|
-
* @param {Object} obj
|
|
1483
|
-
* @return {Object}
|
|
1484
|
-
* @api private
|
|
1485
|
-
*/
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
function mixin(obj) {
|
|
1489
|
-
for (var key in RequestBase.prototype) {
|
|
1490
|
-
if (Object.prototype.hasOwnProperty.call(RequestBase.prototype, key)) obj[key] = RequestBase.prototype[key];
|
|
1491
|
-
}
|
|
1492
|
-
|
|
1493
|
-
return obj;
|
|
1494
|
-
}
|
|
1495
|
-
/**
|
|
1496
|
-
* Clear previous timeout.
|
|
1497
|
-
*
|
|
1498
|
-
* @return {Request} for chaining
|
|
1499
|
-
* @api public
|
|
1500
|
-
*/
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
RequestBase.prototype.clearTimeout = function () {
|
|
1504
|
-
clearTimeout(this._timer);
|
|
1505
|
-
clearTimeout(this._responseTimeoutTimer);
|
|
1506
|
-
clearTimeout(this._uploadTimeoutTimer);
|
|
1507
|
-
delete this._timer;
|
|
1508
|
-
delete this._responseTimeoutTimer;
|
|
1509
|
-
delete this._uploadTimeoutTimer;
|
|
1510
|
-
return this;
|
|
1511
|
-
};
|
|
1512
|
-
/**
|
|
1513
|
-
* Override default response body parser
|
|
1514
|
-
*
|
|
1515
|
-
* This function will be called to convert incoming data into request.body
|
|
1516
|
-
*
|
|
1517
|
-
* @param {Function}
|
|
1518
|
-
* @api public
|
|
1519
|
-
*/
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
RequestBase.prototype.parse = function (fn) {
|
|
1523
|
-
this._parser = fn;
|
|
1524
|
-
return this;
|
|
1525
|
-
};
|
|
1526
|
-
/**
|
|
1527
|
-
* Set format of binary response body.
|
|
1528
|
-
* In browser valid formats are 'blob' and 'arraybuffer',
|
|
1529
|
-
* which return Blob and ArrayBuffer, respectively.
|
|
1530
|
-
*
|
|
1531
|
-
* In Node all values result in Buffer.
|
|
1532
|
-
*
|
|
1533
|
-
* Examples:
|
|
1534
|
-
*
|
|
1535
|
-
* req.get('/')
|
|
1536
|
-
* .responseType('blob')
|
|
1537
|
-
* .end(callback);
|
|
1538
|
-
*
|
|
1539
|
-
* @param {String} val
|
|
1540
|
-
* @return {Request} for chaining
|
|
1541
|
-
* @api public
|
|
1542
|
-
*/
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
RequestBase.prototype.responseType = function (val) {
|
|
1546
|
-
this._responseType = val;
|
|
1547
|
-
return this;
|
|
1548
|
-
};
|
|
1549
|
-
/**
|
|
1550
|
-
* Override default request body serializer
|
|
1551
|
-
*
|
|
1552
|
-
* This function will be called to convert data set via .send or .attach into payload to send
|
|
1553
|
-
*
|
|
1554
|
-
* @param {Function}
|
|
1555
|
-
* @api public
|
|
1556
|
-
*/
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
RequestBase.prototype.serialize = function (fn) {
|
|
1560
|
-
this._serializer = fn;
|
|
1561
|
-
return this;
|
|
1562
|
-
};
|
|
1563
|
-
/**
|
|
1564
|
-
* Set timeouts.
|
|
1565
|
-
*
|
|
1566
|
-
* - response timeout is time between sending request and receiving the first byte of the response. Includes DNS and connection time.
|
|
1567
|
-
* - deadline is the time from start of the request to receiving response body in full. If the deadline is too short large files may not load at all on slow connections.
|
|
1568
|
-
* - upload is the time since last bit of data was sent or received. This timeout works only if deadline timeout is off
|
|
1569
|
-
*
|
|
1570
|
-
* Value of 0 or false means no timeout.
|
|
1571
|
-
*
|
|
1572
|
-
* @param {Number|Object} ms or {response, deadline}
|
|
1573
|
-
* @return {Request} for chaining
|
|
1574
|
-
* @api public
|
|
1575
|
-
*/
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
RequestBase.prototype.timeout = function (options) {
|
|
1579
|
-
if (!options || _typeof(options) !== 'object') {
|
|
1580
|
-
this._timeout = options;
|
|
1581
|
-
this._responseTimeout = 0;
|
|
1582
|
-
this._uploadTimeout = 0;
|
|
1583
|
-
return this;
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
for (var option in options) {
|
|
1587
|
-
if (Object.prototype.hasOwnProperty.call(options, option)) {
|
|
1588
|
-
switch (option) {
|
|
1589
|
-
case 'deadline':
|
|
1590
|
-
this._timeout = options.deadline;
|
|
1591
|
-
break;
|
|
1592
|
-
|
|
1593
|
-
case 'response':
|
|
1594
|
-
this._responseTimeout = options.response;
|
|
1595
|
-
break;
|
|
1596
|
-
|
|
1597
|
-
case 'upload':
|
|
1598
|
-
this._uploadTimeout = options.upload;
|
|
1599
|
-
break;
|
|
1600
|
-
|
|
1601
|
-
default:
|
|
1602
|
-
console.warn('Unknown timeout option', option);
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
return this;
|
|
1608
|
-
};
|
|
1609
|
-
/**
|
|
1610
|
-
* Set number of retry attempts on error.
|
|
1611
|
-
*
|
|
1612
|
-
* Failed requests will be retried 'count' times if timeout or err.code >= 500.
|
|
1613
|
-
*
|
|
1614
|
-
* @param {Number} count
|
|
1615
|
-
* @param {Function} [fn]
|
|
1616
|
-
* @return {Request} for chaining
|
|
1617
|
-
* @api public
|
|
1618
|
-
*/
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
RequestBase.prototype.retry = function (count, fn) {
|
|
1622
|
-
// Default to 1 if no count passed or true
|
|
1623
|
-
if (arguments.length === 0 || count === true) count = 1;
|
|
1624
|
-
if (count <= 0) count = 0;
|
|
1625
|
-
this._maxRetries = count;
|
|
1626
|
-
this._retries = 0;
|
|
1627
|
-
this._retryCallback = fn;
|
|
1628
|
-
return this;
|
|
1629
|
-
};
|
|
1630
|
-
|
|
1631
|
-
var ERROR_CODES = ['ECONNRESET', 'ETIMEDOUT', 'EADDRINFO', 'ESOCKETTIMEDOUT'];
|
|
1632
|
-
/**
|
|
1633
|
-
* Determine if a request should be retried.
|
|
1634
|
-
* (Borrowed from segmentio/superagent-retry)
|
|
1635
|
-
*
|
|
1636
|
-
* @param {Error} err an error
|
|
1637
|
-
* @param {Response} [res] response
|
|
1638
|
-
* @returns {Boolean} if segment should be retried
|
|
1639
|
-
*/
|
|
1640
|
-
|
|
1641
|
-
RequestBase.prototype._shouldRetry = function (err, res) {
|
|
1642
|
-
if (!this._maxRetries || this._retries++ >= this._maxRetries) {
|
|
1643
|
-
return false;
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
if (this._retryCallback) {
|
|
1647
|
-
try {
|
|
1648
|
-
var override = this._retryCallback(err, res);
|
|
1649
|
-
|
|
1650
|
-
if (override === true) return true;
|
|
1651
|
-
if (override === false) return false; // undefined falls back to defaults
|
|
1652
|
-
} catch (err_) {
|
|
1653
|
-
console.error(err_);
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
if (res && res.status && res.status >= 500 && res.status !== 501) return true;
|
|
1658
|
-
|
|
1659
|
-
if (err) {
|
|
1660
|
-
if (err.code && ERROR_CODES.includes(err.code)) return true; // Superagent timeout
|
|
1661
|
-
|
|
1662
|
-
if (err.timeout && err.code === 'ECONNABORTED') return true;
|
|
1663
|
-
if (err.crossDomain) return true;
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
return false;
|
|
1667
|
-
};
|
|
1668
|
-
/**
|
|
1669
|
-
* Retry request
|
|
1670
|
-
*
|
|
1671
|
-
* @return {Request} for chaining
|
|
1672
|
-
* @api private
|
|
1673
|
-
*/
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
RequestBase.prototype._retry = function () {
|
|
1677
|
-
this.clearTimeout(); // node
|
|
1678
|
-
|
|
1679
|
-
if (this.req) {
|
|
1680
|
-
this.req = null;
|
|
1681
|
-
this.req = this.request();
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
this._aborted = false;
|
|
1685
|
-
this.timedout = false;
|
|
1686
|
-
this.timedoutError = null;
|
|
1687
|
-
return this._end();
|
|
1688
|
-
};
|
|
1689
|
-
/**
|
|
1690
|
-
* Promise support
|
|
1691
|
-
*
|
|
1692
|
-
* @param {Function} resolve
|
|
1693
|
-
* @param {Function} [reject]
|
|
1694
|
-
* @return {Request}
|
|
1695
|
-
*/
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
RequestBase.prototype.then = function (resolve, reject) {
|
|
1699
|
-
var _this = this;
|
|
1700
|
-
|
|
1701
|
-
if (!this._fullfilledPromise) {
|
|
1702
|
-
var self = this;
|
|
1703
|
-
|
|
1704
|
-
if (this._endCalled) {
|
|
1705
|
-
console.warn('Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises');
|
|
1706
|
-
}
|
|
1707
|
-
|
|
1708
|
-
this._fullfilledPromise = new Promise(function (resolve, reject) {
|
|
1709
|
-
self.on('abort', function () {
|
|
1710
|
-
if (_this._maxRetries && _this._maxRetries > _this._retries) {
|
|
1711
|
-
return;
|
|
1712
|
-
}
|
|
1713
|
-
|
|
1714
|
-
if (_this.timedout && _this.timedoutError) {
|
|
1715
|
-
reject(_this.timedoutError);
|
|
1716
|
-
return;
|
|
1717
|
-
}
|
|
1718
|
-
|
|
1719
|
-
var err = new Error('Aborted');
|
|
1720
|
-
err.code = 'ABORTED';
|
|
1721
|
-
err.status = _this.status;
|
|
1722
|
-
err.method = _this.method;
|
|
1723
|
-
err.url = _this.url;
|
|
1724
|
-
reject(err);
|
|
1725
|
-
});
|
|
1726
|
-
self.end(function (err, res) {
|
|
1727
|
-
if (err) reject(err);else resolve(res);
|
|
1728
|
-
});
|
|
1729
|
-
});
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1732
|
-
return this._fullfilledPromise.then(resolve, reject);
|
|
1733
|
-
};
|
|
1734
|
-
|
|
1735
|
-
RequestBase.prototype.catch = function (cb) {
|
|
1736
|
-
return this.then(undefined, cb);
|
|
1737
|
-
};
|
|
1738
|
-
/**
|
|
1739
|
-
* Allow for extension
|
|
1740
|
-
*/
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
RequestBase.prototype.use = function (fn) {
|
|
1744
|
-
fn(this);
|
|
1745
|
-
return this;
|
|
1746
|
-
};
|
|
1747
|
-
|
|
1748
|
-
RequestBase.prototype.ok = function (cb) {
|
|
1749
|
-
if (typeof cb !== 'function') throw new Error('Callback required');
|
|
1750
|
-
this._okCallback = cb;
|
|
1751
|
-
return this;
|
|
1752
|
-
};
|
|
1753
|
-
|
|
1754
|
-
RequestBase.prototype._isResponseOK = function (res) {
|
|
1755
|
-
if (!res) {
|
|
1756
|
-
return false;
|
|
1757
|
-
}
|
|
1758
|
-
|
|
1759
|
-
if (this._okCallback) {
|
|
1760
|
-
return this._okCallback(res);
|
|
1761
|
-
}
|
|
1762
|
-
|
|
1763
|
-
return res.status >= 200 && res.status < 300;
|
|
1764
|
-
};
|
|
1765
|
-
/**
|
|
1766
|
-
* Get request header `field`.
|
|
1767
|
-
* Case-insensitive.
|
|
1768
|
-
*
|
|
1769
|
-
* @param {String} field
|
|
1770
|
-
* @return {String}
|
|
1771
|
-
* @api public
|
|
1772
|
-
*/
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
RequestBase.prototype.get = function (field) {
|
|
1776
|
-
return this._header[field.toLowerCase()];
|
|
1777
|
-
};
|
|
1778
|
-
/**
|
|
1779
|
-
* Get case-insensitive header `field` value.
|
|
1780
|
-
* This is a deprecated internal API. Use `.get(field)` instead.
|
|
1781
|
-
*
|
|
1782
|
-
* (getHeader is no longer used internally by the superagent code base)
|
|
1783
|
-
*
|
|
1784
|
-
* @param {String} field
|
|
1785
|
-
* @return {String}
|
|
1786
|
-
* @api private
|
|
1787
|
-
* @deprecated
|
|
1788
|
-
*/
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
RequestBase.prototype.getHeader = RequestBase.prototype.get;
|
|
1792
|
-
/**
|
|
1793
|
-
* Set header `field` to `val`, or multiple fields with one object.
|
|
1794
|
-
* Case-insensitive.
|
|
1795
|
-
*
|
|
1796
|
-
* Examples:
|
|
1797
|
-
*
|
|
1798
|
-
* req.get('/')
|
|
1799
|
-
* .set('Accept', 'application/json')
|
|
1800
|
-
* .set('X-API-Key', 'foobar')
|
|
1801
|
-
* .end(callback);
|
|
1802
|
-
*
|
|
1803
|
-
* req.get('/')
|
|
1804
|
-
* .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
|
|
1805
|
-
* .end(callback);
|
|
1806
|
-
*
|
|
1807
|
-
* @param {String|Object} field
|
|
1808
|
-
* @param {String} val
|
|
1809
|
-
* @return {Request} for chaining
|
|
1810
|
-
* @api public
|
|
1811
|
-
*/
|
|
1812
|
-
|
|
1813
|
-
RequestBase.prototype.set = function (field, val) {
|
|
1814
|
-
if (isObject(field)) {
|
|
1815
|
-
for (var key in field) {
|
|
1816
|
-
if (Object.prototype.hasOwnProperty.call(field, key)) this.set(key, field[key]);
|
|
1817
|
-
}
|
|
1818
|
-
|
|
1819
|
-
return this;
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
|
-
this._header[field.toLowerCase()] = val;
|
|
1823
|
-
this.header[field] = val;
|
|
1824
|
-
return this;
|
|
1825
|
-
};
|
|
1826
|
-
/**
|
|
1827
|
-
* Remove header `field`.
|
|
1828
|
-
* Case-insensitive.
|
|
1829
|
-
*
|
|
1830
|
-
* Example:
|
|
1831
|
-
*
|
|
1832
|
-
* req.get('/')
|
|
1833
|
-
* .unset('User-Agent')
|
|
1834
|
-
* .end(callback);
|
|
1835
|
-
*
|
|
1836
|
-
* @param {String} field field name
|
|
1837
|
-
*/
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
RequestBase.prototype.unset = function (field) {
|
|
1841
|
-
delete this._header[field.toLowerCase()];
|
|
1842
|
-
delete this.header[field];
|
|
1843
|
-
return this;
|
|
1844
|
-
};
|
|
1845
|
-
/**
|
|
1846
|
-
* Write the field `name` and `val`, or multiple fields with one object
|
|
1847
|
-
* for "multipart/form-data" request bodies.
|
|
1848
|
-
*
|
|
1849
|
-
* ``` js
|
|
1850
|
-
* request.post('/upload')
|
|
1851
|
-
* .field('foo', 'bar')
|
|
1852
|
-
* .end(callback);
|
|
1853
|
-
*
|
|
1854
|
-
* request.post('/upload')
|
|
1855
|
-
* .field({ foo: 'bar', baz: 'qux' })
|
|
1856
|
-
* .end(callback);
|
|
1857
|
-
* ```
|
|
1858
|
-
*
|
|
1859
|
-
* @param {String|Object} name name of field
|
|
1860
|
-
* @param {String|Blob|File|Buffer|fs.ReadStream} val value of field
|
|
1861
|
-
* @return {Request} for chaining
|
|
1862
|
-
* @api public
|
|
1863
|
-
*/
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
RequestBase.prototype.field = function (name, val) {
|
|
1867
|
-
// name should be either a string or an object.
|
|
1868
|
-
if (name === null || undefined === name) {
|
|
1869
|
-
throw new Error('.field(name, val) name can not be empty');
|
|
1870
|
-
}
|
|
1871
|
-
|
|
1872
|
-
if (this._data) {
|
|
1873
|
-
throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");
|
|
1874
|
-
}
|
|
1875
|
-
|
|
1876
|
-
if (isObject(name)) {
|
|
1877
|
-
for (var key in name) {
|
|
1878
|
-
if (Object.prototype.hasOwnProperty.call(name, key)) this.field(key, name[key]);
|
|
1879
|
-
}
|
|
1880
|
-
|
|
1881
|
-
return this;
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
if (Array.isArray(val)) {
|
|
1885
|
-
for (var i in val) {
|
|
1886
|
-
if (Object.prototype.hasOwnProperty.call(val, i)) this.field(name, val[i]);
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
return this;
|
|
1890
|
-
} // val should be defined now
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
if (val === null || undefined === val) {
|
|
1894
|
-
throw new Error('.field(name, val) val can not be empty');
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
if (typeof val === 'boolean') {
|
|
1898
|
-
val = String(val);
|
|
1899
|
-
}
|
|
1900
|
-
|
|
1901
|
-
this._getFormData().append(name, val);
|
|
1902
|
-
|
|
1903
|
-
return this;
|
|
1904
|
-
};
|
|
1905
|
-
/**
|
|
1906
|
-
* Abort the request, and clear potential timeout.
|
|
1907
|
-
*
|
|
1908
|
-
* @return {Request} request
|
|
1909
|
-
* @api public
|
|
1910
|
-
*/
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
RequestBase.prototype.abort = function () {
|
|
1914
|
-
if (this._aborted) {
|
|
1915
|
-
return this;
|
|
1916
|
-
}
|
|
1917
|
-
|
|
1918
|
-
this._aborted = true;
|
|
1919
|
-
if (this.xhr) this.xhr.abort(); // browser
|
|
1920
|
-
|
|
1921
|
-
if (this.req) this.req.abort(); // node
|
|
1922
|
-
|
|
1923
|
-
this.clearTimeout();
|
|
1924
|
-
this.emit('abort');
|
|
1925
|
-
return this;
|
|
1926
|
-
};
|
|
1927
|
-
|
|
1928
|
-
RequestBase.prototype._auth = function (user, pass, options, base64Encoder) {
|
|
1929
|
-
switch (options.type) {
|
|
1930
|
-
case 'basic':
|
|
1931
|
-
this.set('Authorization', "Basic ".concat(base64Encoder("".concat(user, ":").concat(pass))));
|
|
1932
|
-
break;
|
|
1933
|
-
|
|
1934
|
-
case 'auto':
|
|
1935
|
-
this.username = user;
|
|
1936
|
-
this.password = pass;
|
|
1937
|
-
break;
|
|
1938
|
-
|
|
1939
|
-
case 'bearer':
|
|
1940
|
-
// usage would be .auth(accessToken, { type: 'bearer' })
|
|
1941
|
-
this.set('Authorization', "Bearer ".concat(user));
|
|
1942
|
-
break;
|
|
1943
|
-
|
|
1944
|
-
default:
|
|
1945
|
-
break;
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
return this;
|
|
1949
|
-
};
|
|
1950
|
-
/**
|
|
1951
|
-
* Enable transmission of cookies with x-domain requests.
|
|
1952
|
-
*
|
|
1953
|
-
* Note that for this to work the origin must not be
|
|
1954
|
-
* using "Access-Control-Allow-Origin" with a wildcard,
|
|
1955
|
-
* and also must set "Access-Control-Allow-Credentials"
|
|
1956
|
-
* to "true".
|
|
1957
|
-
*
|
|
1958
|
-
* @api public
|
|
1959
|
-
*/
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
RequestBase.prototype.withCredentials = function (on) {
|
|
1963
|
-
// This is browser-only functionality. Node side is no-op.
|
|
1964
|
-
if (on === undefined) on = true;
|
|
1965
|
-
this._withCredentials = on;
|
|
1966
|
-
return this;
|
|
1967
|
-
};
|
|
1968
|
-
/**
|
|
1969
|
-
* Set the max redirects to `n`. Does nothing in browser XHR implementation.
|
|
1970
|
-
*
|
|
1971
|
-
* @param {Number} n
|
|
1972
|
-
* @return {Request} for chaining
|
|
1973
|
-
* @api public
|
|
1974
|
-
*/
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
RequestBase.prototype.redirects = function (n) {
|
|
1978
|
-
this._maxRedirects = n;
|
|
1979
|
-
return this;
|
|
1980
|
-
};
|
|
1981
|
-
/**
|
|
1982
|
-
* Maximum size of buffered response body, in bytes. Counts uncompressed size.
|
|
1983
|
-
* Default 200MB.
|
|
1984
|
-
*
|
|
1985
|
-
* @param {Number} n number of bytes
|
|
1986
|
-
* @return {Request} for chaining
|
|
1987
|
-
*/
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
RequestBase.prototype.maxResponseSize = function (n) {
|
|
1991
|
-
if (typeof n !== 'number') {
|
|
1992
|
-
throw new TypeError('Invalid argument');
|
|
1993
|
-
}
|
|
1994
|
-
|
|
1995
|
-
this._maxResponseSize = n;
|
|
1996
|
-
return this;
|
|
1997
|
-
};
|
|
1998
|
-
/**
|
|
1999
|
-
* Convert to a plain javascript object (not JSON string) of scalar properties.
|
|
2000
|
-
* Note as this method is designed to return a useful non-this value,
|
|
2001
|
-
* it cannot be chained.
|
|
2002
|
-
*
|
|
2003
|
-
* @return {Object} describing method, url, and data of this request
|
|
2004
|
-
* @api public
|
|
2005
|
-
*/
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
RequestBase.prototype.toJSON = function () {
|
|
2009
|
-
return {
|
|
2010
|
-
method: this.method,
|
|
2011
|
-
url: this.url,
|
|
2012
|
-
data: this._data,
|
|
2013
|
-
headers: this._header
|
|
2014
|
-
};
|
|
2015
|
-
};
|
|
2016
|
-
/**
|
|
2017
|
-
* Send `data` as the request body, defaulting the `.type()` to "json" when
|
|
2018
|
-
* an object is given.
|
|
2019
|
-
*
|
|
2020
|
-
* Examples:
|
|
2021
|
-
*
|
|
2022
|
-
* // manual json
|
|
2023
|
-
* request.post('/user')
|
|
2024
|
-
* .type('json')
|
|
2025
|
-
* .send('{"name":"tj"}')
|
|
2026
|
-
* .end(callback)
|
|
2027
|
-
*
|
|
2028
|
-
* // auto json
|
|
2029
|
-
* request.post('/user')
|
|
2030
|
-
* .send({ name: 'tj' })
|
|
2031
|
-
* .end(callback)
|
|
2032
|
-
*
|
|
2033
|
-
* // manual x-www-form-urlencoded
|
|
2034
|
-
* request.post('/user')
|
|
2035
|
-
* .type('form')
|
|
2036
|
-
* .send('name=tj')
|
|
2037
|
-
* .end(callback)
|
|
2038
|
-
*
|
|
2039
|
-
* // auto x-www-form-urlencoded
|
|
2040
|
-
* request.post('/user')
|
|
2041
|
-
* .type('form')
|
|
2042
|
-
* .send({ name: 'tj' })
|
|
2043
|
-
* .end(callback)
|
|
2044
|
-
*
|
|
2045
|
-
* // defaults to x-www-form-urlencoded
|
|
2046
|
-
* request.post('/user')
|
|
2047
|
-
* .send('name=tobi')
|
|
2048
|
-
* .send('species=ferret')
|
|
2049
|
-
* .end(callback)
|
|
2050
|
-
*
|
|
2051
|
-
* @param {String|Object} data
|
|
2052
|
-
* @return {Request} for chaining
|
|
2053
|
-
* @api public
|
|
2054
|
-
*/
|
|
2055
|
-
// eslint-disable-next-line complexity
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
RequestBase.prototype.send = function (data) {
|
|
2059
|
-
var isObj = isObject(data);
|
|
2060
|
-
var type = this._header['content-type'];
|
|
2061
|
-
|
|
2062
|
-
if (this._formData) {
|
|
2063
|
-
throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");
|
|
2064
|
-
}
|
|
2065
|
-
|
|
2066
|
-
if (isObj && !this._data) {
|
|
2067
|
-
if (Array.isArray(data)) {
|
|
2068
|
-
this._data = [];
|
|
2069
|
-
} else if (!this._isHost(data)) {
|
|
2070
|
-
this._data = {};
|
|
2071
|
-
}
|
|
2072
|
-
} else if (data && this._data && this._isHost(this._data)) {
|
|
2073
|
-
throw new Error("Can't merge these send calls");
|
|
2074
|
-
} // merge
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
if (isObj && isObject(this._data)) {
|
|
2078
|
-
for (var key in data) {
|
|
2079
|
-
if (Object.prototype.hasOwnProperty.call(data, key)) this._data[key] = data[key];
|
|
2080
|
-
}
|
|
2081
|
-
} else if (typeof data === 'string') {
|
|
2082
|
-
// default to x-www-form-urlencoded
|
|
2083
|
-
if (!type) this.type('form');
|
|
2084
|
-
type = this._header['content-type'];
|
|
2085
|
-
|
|
2086
|
-
if (type === 'application/x-www-form-urlencoded') {
|
|
2087
|
-
this._data = this._data ? "".concat(this._data, "&").concat(data) : data;
|
|
2088
|
-
} else {
|
|
2089
|
-
this._data = (this._data || '') + data;
|
|
2090
|
-
}
|
|
2091
|
-
} else {
|
|
2092
|
-
this._data = data;
|
|
2093
|
-
}
|
|
2094
|
-
|
|
2095
|
-
if (!isObj || this._isHost(data)) {
|
|
2096
|
-
return this;
|
|
2097
|
-
} // default to json
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
if (!type) this.type('json');
|
|
2101
|
-
return this;
|
|
2102
|
-
};
|
|
2103
|
-
/**
|
|
2104
|
-
* Sort `querystring` by the sort function
|
|
2105
|
-
*
|
|
2106
|
-
*
|
|
2107
|
-
* Examples:
|
|
2108
|
-
*
|
|
2109
|
-
* // default order
|
|
2110
|
-
* request.get('/user')
|
|
2111
|
-
* .query('name=Nick')
|
|
2112
|
-
* .query('search=Manny')
|
|
2113
|
-
* .sortQuery()
|
|
2114
|
-
* .end(callback)
|
|
2115
|
-
*
|
|
2116
|
-
* // customized sort function
|
|
2117
|
-
* request.get('/user')
|
|
2118
|
-
* .query('name=Nick')
|
|
2119
|
-
* .query('search=Manny')
|
|
2120
|
-
* .sortQuery(function(a, b){
|
|
2121
|
-
* return a.length - b.length;
|
|
2122
|
-
* })
|
|
2123
|
-
* .end(callback)
|
|
2124
|
-
*
|
|
2125
|
-
*
|
|
2126
|
-
* @param {Function} sort
|
|
2127
|
-
* @return {Request} for chaining
|
|
2128
|
-
* @api public
|
|
2129
|
-
*/
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
RequestBase.prototype.sortQuery = function (sort) {
|
|
2133
|
-
// _sort default to true but otherwise can be a function or boolean
|
|
2134
|
-
this._sort = typeof sort === 'undefined' ? true : sort;
|
|
2135
|
-
return this;
|
|
2136
|
-
};
|
|
2137
|
-
/**
|
|
2138
|
-
* Compose querystring to append to req.url
|
|
2139
|
-
*
|
|
2140
|
-
* @api private
|
|
2141
|
-
*/
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
RequestBase.prototype._finalizeQueryString = function () {
|
|
2145
|
-
var query = this._query.join('&');
|
|
2146
|
-
|
|
2147
|
-
if (query) {
|
|
2148
|
-
this.url += (this.url.includes('?') ? '&' : '?') + query;
|
|
2149
|
-
}
|
|
2150
|
-
|
|
2151
|
-
this._query.length = 0; // Makes the call idempotent
|
|
2152
|
-
|
|
2153
|
-
if (this._sort) {
|
|
2154
|
-
var index = this.url.indexOf('?');
|
|
2155
|
-
|
|
2156
|
-
if (index >= 0) {
|
|
2157
|
-
var queryArr = this.url.slice(index + 1).split('&');
|
|
2158
|
-
|
|
2159
|
-
if (typeof this._sort === 'function') {
|
|
2160
|
-
queryArr.sort(this._sort);
|
|
2161
|
-
} else {
|
|
2162
|
-
queryArr.sort();
|
|
2163
|
-
}
|
|
2164
|
-
|
|
2165
|
-
this.url = this.url.slice(0, index) + '?' + queryArr.join('&');
|
|
2166
|
-
}
|
|
2167
|
-
}
|
|
2168
|
-
}; // For backwards compat only
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
RequestBase.prototype._appendQueryString = function () {
|
|
2172
|
-
console.warn('Unsupported');
|
|
2173
|
-
};
|
|
2174
|
-
/**
|
|
2175
|
-
* Invoke callback with timeout error.
|
|
2176
|
-
*
|
|
2177
|
-
* @api private
|
|
2178
|
-
*/
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
RequestBase.prototype._timeoutError = function (reason, timeout, errno) {
|
|
2182
|
-
if (this._aborted) {
|
|
2183
|
-
return;
|
|
2184
|
-
}
|
|
2185
|
-
|
|
2186
|
-
var err = new Error("".concat(reason + timeout, "ms exceeded"));
|
|
2187
|
-
err.timeout = timeout;
|
|
2188
|
-
err.code = 'ECONNABORTED';
|
|
2189
|
-
err.errno = errno;
|
|
2190
|
-
this.timedout = true;
|
|
2191
|
-
this.timedoutError = err;
|
|
2192
|
-
this.abort();
|
|
2193
|
-
this.callback(err);
|
|
2194
|
-
};
|
|
2195
|
-
|
|
2196
|
-
RequestBase.prototype._setTimeouts = function () {
|
|
2197
|
-
var self = this; // deadline
|
|
2198
|
-
|
|
2199
|
-
if (this._timeout && !this._timer) {
|
|
2200
|
-
this._timer = setTimeout(function () {
|
|
2201
|
-
self._timeoutError('Timeout of ', self._timeout, 'ETIME');
|
|
2202
|
-
}, this._timeout);
|
|
2203
|
-
} // response timeout
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
if (this._responseTimeout && !this._responseTimeoutTimer) {
|
|
2207
|
-
this._responseTimeoutTimer = setTimeout(function () {
|
|
2208
|
-
self._timeoutError('Response timeout of ', self._responseTimeout, 'ETIMEDOUT');
|
|
2209
|
-
}, this._responseTimeout);
|
|
2210
|
-
}
|
|
2211
|
-
};
|
|
2212
|
-
|
|
2213
|
-
},{"./is-object":4}],7:[function(require,module,exports){
|
|
2214
|
-
"use strict";
|
|
2215
|
-
|
|
2216
|
-
/**
|
|
2217
|
-
* Module dependencies.
|
|
2218
|
-
*/
|
|
2219
|
-
var utils = require('./utils');
|
|
2220
|
-
/**
|
|
2221
|
-
* Expose `ResponseBase`.
|
|
2222
|
-
*/
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
module.exports = ResponseBase;
|
|
2226
|
-
/**
|
|
2227
|
-
* Initialize a new `ResponseBase`.
|
|
2228
|
-
*
|
|
2229
|
-
* @api public
|
|
2230
|
-
*/
|
|
2231
|
-
|
|
2232
|
-
function ResponseBase(obj) {
|
|
2233
|
-
if (obj) return mixin(obj);
|
|
2234
|
-
}
|
|
2235
|
-
/**
|
|
2236
|
-
* Mixin the prototype properties.
|
|
2237
|
-
*
|
|
2238
|
-
* @param {Object} obj
|
|
2239
|
-
* @return {Object}
|
|
2240
|
-
* @api private
|
|
2241
|
-
*/
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
function mixin(obj) {
|
|
2245
|
-
for (var key in ResponseBase.prototype) {
|
|
2246
|
-
if (Object.prototype.hasOwnProperty.call(ResponseBase.prototype, key)) obj[key] = ResponseBase.prototype[key];
|
|
2247
|
-
}
|
|
2248
|
-
|
|
2249
|
-
return obj;
|
|
2250
|
-
}
|
|
2251
|
-
/**
|
|
2252
|
-
* Get case-insensitive `field` value.
|
|
2253
|
-
*
|
|
2254
|
-
* @param {String} field
|
|
2255
|
-
* @return {String}
|
|
2256
|
-
* @api public
|
|
2257
|
-
*/
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
ResponseBase.prototype.get = function (field) {
|
|
2261
|
-
return this.header[field.toLowerCase()];
|
|
2262
|
-
};
|
|
2263
|
-
/**
|
|
2264
|
-
* Set header related properties:
|
|
2265
|
-
*
|
|
2266
|
-
* - `.type` the content type without params
|
|
2267
|
-
*
|
|
2268
|
-
* A response of "Content-Type: text/plain; charset=utf-8"
|
|
2269
|
-
* will provide you with a `.type` of "text/plain".
|
|
2270
|
-
*
|
|
2271
|
-
* @param {Object} header
|
|
2272
|
-
* @api private
|
|
2273
|
-
*/
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
ResponseBase.prototype._setHeaderProperties = function (header) {
|
|
2277
|
-
// TODO: moar!
|
|
2278
|
-
// TODO: make this a util
|
|
2279
|
-
// content-type
|
|
2280
|
-
var ct = header['content-type'] || '';
|
|
2281
|
-
this.type = utils.type(ct); // params
|
|
2282
|
-
|
|
2283
|
-
var params = utils.params(ct);
|
|
2284
|
-
|
|
2285
|
-
for (var key in params) {
|
|
2286
|
-
if (Object.prototype.hasOwnProperty.call(params, key)) this[key] = params[key];
|
|
2287
|
-
}
|
|
2288
|
-
|
|
2289
|
-
this.links = {}; // links
|
|
2290
|
-
|
|
2291
|
-
try {
|
|
2292
|
-
if (header.link) {
|
|
2293
|
-
this.links = utils.parseLinks(header.link);
|
|
2294
|
-
}
|
|
2295
|
-
} catch (_unused) {// ignore
|
|
2296
|
-
}
|
|
2297
|
-
};
|
|
2298
|
-
/**
|
|
2299
|
-
* Set flags such as `.ok` based on `status`.
|
|
2300
|
-
*
|
|
2301
|
-
* For example a 2xx response will give you a `.ok` of __true__
|
|
2302
|
-
* whereas 5xx will be __false__ and `.error` will be __true__. The
|
|
2303
|
-
* `.clientError` and `.serverError` are also available to be more
|
|
2304
|
-
* specific, and `.statusType` is the class of error ranging from 1..5
|
|
2305
|
-
* sometimes useful for mapping respond colors etc.
|
|
2306
|
-
*
|
|
2307
|
-
* "sugar" properties are also defined for common cases. Currently providing:
|
|
2308
|
-
*
|
|
2309
|
-
* - .noContent
|
|
2310
|
-
* - .badRequest
|
|
2311
|
-
* - .unauthorized
|
|
2312
|
-
* - .notAcceptable
|
|
2313
|
-
* - .notFound
|
|
2314
|
-
*
|
|
2315
|
-
* @param {Number} status
|
|
2316
|
-
* @api private
|
|
2317
|
-
*/
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
ResponseBase.prototype._setStatusProperties = function (status) {
|
|
2321
|
-
var type = status / 100 | 0; // status / class
|
|
2322
|
-
|
|
2323
|
-
this.statusCode = status;
|
|
2324
|
-
this.status = this.statusCode;
|
|
2325
|
-
this.statusType = type; // basics
|
|
2326
|
-
|
|
2327
|
-
this.info = type === 1;
|
|
2328
|
-
this.ok = type === 2;
|
|
2329
|
-
this.redirect = type === 3;
|
|
2330
|
-
this.clientError = type === 4;
|
|
2331
|
-
this.serverError = type === 5;
|
|
2332
|
-
this.error = type === 4 || type === 5 ? this.toError() : false; // sugar
|
|
2333
|
-
|
|
2334
|
-
this.created = status === 201;
|
|
2335
|
-
this.accepted = status === 202;
|
|
2336
|
-
this.noContent = status === 204;
|
|
2337
|
-
this.badRequest = status === 400;
|
|
2338
|
-
this.unauthorized = status === 401;
|
|
2339
|
-
this.notAcceptable = status === 406;
|
|
2340
|
-
this.forbidden = status === 403;
|
|
2341
|
-
this.notFound = status === 404;
|
|
2342
|
-
this.unprocessableEntity = status === 422;
|
|
2343
|
-
};
|
|
2344
|
-
|
|
2345
|
-
},{"./utils":8}],8:[function(require,module,exports){
|
|
2346
|
-
"use strict";
|
|
2347
|
-
|
|
2348
|
-
/**
|
|
2349
|
-
* Return the mime type for the given `str`.
|
|
2350
|
-
*
|
|
2351
|
-
* @param {String} str
|
|
2352
|
-
* @return {String}
|
|
2353
|
-
* @api private
|
|
2354
|
-
*/
|
|
2355
|
-
exports.type = function (str) {
|
|
2356
|
-
return str.split(/ *; */).shift();
|
|
2357
|
-
};
|
|
2358
|
-
/**
|
|
2359
|
-
* Return header field parameters.
|
|
2360
|
-
*
|
|
2361
|
-
* @param {String} str
|
|
2362
|
-
* @return {Object}
|
|
2363
|
-
* @api private
|
|
2364
|
-
*/
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
exports.params = function (str) {
|
|
2368
|
-
return str.split(/ *; */).reduce(function (obj, str) {
|
|
2369
|
-
var parts = str.split(/ *= */);
|
|
2370
|
-
var key = parts.shift();
|
|
2371
|
-
var val = parts.shift();
|
|
2372
|
-
if (key && val) obj[key] = val;
|
|
2373
|
-
return obj;
|
|
2374
|
-
}, {});
|
|
2375
|
-
};
|
|
2376
|
-
/**
|
|
2377
|
-
* Parse Link header fields.
|
|
2378
|
-
*
|
|
2379
|
-
* @param {String} str
|
|
2380
|
-
* @return {Object}
|
|
2381
|
-
* @api private
|
|
2382
|
-
*/
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
exports.parseLinks = function (str) {
|
|
2386
|
-
return str.split(/ *, */).reduce(function (obj, str) {
|
|
2387
|
-
var parts = str.split(/ *; */);
|
|
2388
|
-
var url = parts[0].slice(1, -1);
|
|
2389
|
-
var rel = parts[1].split(/ *= */)[1].slice(1, -1);
|
|
2390
|
-
obj[rel] = url;
|
|
2391
|
-
return obj;
|
|
2392
|
-
}, {});
|
|
2393
|
-
};
|
|
2394
|
-
/**
|
|
2395
|
-
* Strip content related fields from `header`.
|
|
2396
|
-
*
|
|
2397
|
-
* @param {Object} header
|
|
2398
|
-
* @return {Object} header
|
|
2399
|
-
* @api private
|
|
2400
|
-
*/
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
exports.cleanHeader = function (header, changesOrigin) {
|
|
2404
|
-
delete header['content-type'];
|
|
2405
|
-
delete header['content-length'];
|
|
2406
|
-
delete header['transfer-encoding'];
|
|
2407
|
-
delete header.host; // secuirty
|
|
2408
|
-
|
|
2409
|
-
if (changesOrigin) {
|
|
2410
|
-
delete header.authorization;
|
|
2411
|
-
delete header.cookie;
|
|
2412
|
-
}
|
|
2413
|
-
|
|
2414
|
-
return header;
|
|
2415
|
-
};
|
|
2416
|
-
|
|
2417
|
-
},{}]},{},[5])(5)
|
|
2418
|
-
});
|