From 475fd6b4c36117b686bacb9c3f64f1d750c4251c Mon Sep 17 00:00:00 2001 From: souhail-kaci Date: Mon, 14 Feb 2022 14:35:53 +0100 Subject: [PATCH] Add server to communicate with arduino --- .gitignore | 1 + .idea/.gitignore | 5 + .idea/Arduino-Iot.iml | 12 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + chute.ino => chute/chute.ino | 7 +- server/index.js | 53 + server/node_modules/.bin/detect-libc | 1 + server/node_modules/.bin/is-ci | 1 + server/node_modules/.bin/mime | 1 + server/node_modules/.bin/nodemon | 1 + server/node_modules/.bin/nodetouch | 1 + server/node_modules/.bin/nopt | 1 + server/node_modules/.bin/prebuild-install | 1 + server/node_modules/.bin/rc | 1 + server/node_modules/.bin/semver | 1 + server/node_modules/.package-lock.json | 2436 +++++ .../@serialport/binding-abstract/CHANGELOG.md | 59 + .../@serialport/binding-abstract/LICENSE | 21 + .../@serialport/binding-abstract/README.md | 14 + .../@serialport/binding-abstract/lib/index.js | 222 + .../node_modules/debug/LICENSE | 20 + .../node_modules/debug/README.md | 478 + .../node_modules/debug/package.json | 101 + .../node_modules/debug/src/browser.js | 269 + .../node_modules/debug/src/common.js | 274 + .../node_modules/debug/src/index.js | 10 + .../node_modules/debug/src/node.js | 263 + .../binding-abstract/node_modules/ms/index.js | 162 + .../node_modules/ms/license.md | 21 + .../node_modules/ms/package.json | 69 + .../node_modules/ms/readme.md | 60 + .../@serialport/binding-abstract/package.json | 56 + .../@serialport/binding-mock/CHANGELOG.md | 67 + .../@serialport/binding-mock/LICENSE | 21 + .../@serialport/binding-mock/README.md | 11 + .../@serialport/binding-mock/lib/index.js | 233 + .../@serialport/binding-mock/lib/legacy.js | 26 + .../binding-mock/node_modules/debug/LICENSE | 20 + .../binding-mock/node_modules/debug/README.md | 478 + .../node_modules/debug/package.json | 101 + .../node_modules/debug/src/browser.js | 269 + .../node_modules/debug/src/common.js | 274 + .../node_modules/debug/src/index.js | 10 + .../node_modules/debug/src/node.js | 263 + .../binding-mock/node_modules/ms/index.js | 162 + .../binding-mock/node_modules/ms/license.md | 21 + .../binding-mock/node_modules/ms/package.json | 69 + .../binding-mock/node_modules/ms/readme.md | 60 + .../@serialport/binding-mock/package.json | 56 + .../@serialport/bindings/.prebuild-installrc | 3 + .../node_modules/@serialport/bindings/LICENSE | 21 + .../@serialport/bindings/README.md | 13 + .../@serialport/bindings/binding.gyp | 68 + .../bindings/build/Release/bindings.node | Bin 0 -> 68760 bytes .../@serialport/bindings/lib/darwin.js | 110 + .../@serialport/bindings/lib/index.js | 15 + .../@serialport/bindings/lib/legacy.js | 26 + .../@serialport/bindings/lib/linux-list.js | 100 + .../@serialport/bindings/lib/linux.js | 110 + .../@serialport/bindings/lib/poller.js | 111 + .../@serialport/bindings/lib/unix-read.js | 57 + .../@serialport/bindings/lib/unix-write.js | 57 + .../bindings/lib/win32-sn-parser.js | 14 + .../@serialport/bindings/lib/win32.js | 123 + .../bindings/node_modules/debug/LICENSE | 20 + .../bindings/node_modules/debug/README.md | 478 + .../bindings/node_modules/debug/package.json | 101 + .../node_modules/debug/src/browser.js | 269 + .../bindings/node_modules/debug/src/common.js | 274 + .../bindings/node_modules/debug/src/index.js | 10 + .../bindings/node_modules/debug/src/node.js | 263 + .../bindings/node_modules/ms/index.js | 162 + .../bindings/node_modules/ms/license.md | 21 + .../bindings/node_modules/ms/package.json | 69 + .../bindings/node_modules/ms/readme.md | 60 + .../@serialport/bindings/package.json | 84 + .../@serialport/bindings/src/darwin_list.cpp | 355 + .../@serialport/bindings/src/darwin_list.h | 46 + .../@serialport/bindings/src/poller.cpp | 142 + .../@serialport/bindings/src/poller.h | 34 + .../@serialport/bindings/src/serialport.cpp | 486 + .../@serialport/bindings/src/serialport.h | 147 + .../bindings/src/serialport_linux.cpp | 76 + .../bindings/src/serialport_linux.h | 10 + .../bindings/src/serialport_unix.cpp | 426 + .../bindings/src/serialport_unix.h | 7 + .../bindings/src/serialport_win.cpp | 954 ++ .../@serialport/bindings/src/serialport_win.h | 74 + .../parser-byte-length/CHANGELOG.md | 40 + .../@serialport/parser-byte-length/LICENSE | 21 + .../@serialport/parser-byte-length/README.md | 1 + .../parser-byte-length/lib/index.js | 55 + .../parser-byte-length/package.json | 49 + .../@serialport/parser-cctalk/CHANGELOG.md | 40 + .../@serialport/parser-cctalk/LICENSE | 21 + .../@serialport/parser-cctalk/README.md | 1 + .../@serialport/parser-cctalk/lib/index.js | 52 + .../@serialport/parser-cctalk/package.json | 49 + .../@serialport/parser-delimiter/CHANGELOG.md | 40 + .../@serialport/parser-delimiter/LICENSE | 21 + .../@serialport/parser-delimiter/README.md | 1 + .../@serialport/parser-delimiter/lib/index.js | 49 + .../@serialport/parser-delimiter/package.json | 50 + .../parser-inter-byte-timeout/CHANGELOG.md | 40 + .../parser-inter-byte-timeout/LICENSE | 21 + .../parser-inter-byte-timeout/README.md | 1 + .../parser-inter-byte-timeout/lib/index.js | 71 + .../parser-inter-byte-timeout/package.json | 49 + .../@serialport/parser-readline/CHANGELOG.md | 40 + .../@serialport/parser-readline/LICENSE | 21 + .../@serialport/parser-readline/README.md | 1 + .../@serialport/parser-readline/lib/index.js | 30 + .../@serialport/parser-readline/package.json | 53 + .../@serialport/parser-ready/CHANGELOG.md | 40 + .../@serialport/parser-ready/LICENSE | 21 + .../@serialport/parser-ready/README.md | 1 + .../@serialport/parser-ready/lib/index.js | 63 + .../@serialport/parser-ready/package.json | 49 + .../@serialport/parser-regex/CHANGELOG.md | 40 + .../@serialport/parser-regex/LICENSE | 21 + .../@serialport/parser-regex/README.md | 1 + .../@serialport/parser-regex/lib/index.js | 53 + .../@serialport/parser-regex/package.json | 49 + .../@serialport/stream/CHANGELOG.md | 68 + .../node_modules/@serialport/stream/LICENSE | 21 + .../node_modules/@serialport/stream/README.md | 16 + .../@serialport/stream/lib/index.js | 656 ++ .../stream/node_modules/debug/LICENSE | 20 + .../stream/node_modules/debug/README.md | 478 + .../stream/node_modules/debug/package.json | 101 + .../stream/node_modules/debug/src/browser.js | 269 + .../stream/node_modules/debug/src/common.js | 274 + .../stream/node_modules/debug/src/index.js | 10 + .../stream/node_modules/debug/src/node.js | 263 + .../stream/node_modules/ms/index.js | 162 + .../stream/node_modules/ms/license.md | 21 + .../stream/node_modules/ms/package.json | 69 + .../stream/node_modules/ms/readme.md | 60 + .../@serialport/stream/package.json | 55 + .../@sindresorhus/is/dist/index.d.ts | 132 + .../@sindresorhus/is/dist/index.js | 245 + .../@sindresorhus/is/dist/index.js.map | 1 + server/node_modules/@sindresorhus/is/license | 9 + .../@sindresorhus/is/package.json | 96 + .../node_modules/@sindresorhus/is/readme.md | 451 + .../@szmarczak/http-timer/LICENSE | 21 + .../@szmarczak/http-timer/README.md | 70 + .../@szmarczak/http-timer/package.json | 75 + .../@szmarczak/http-timer/source/index.js | 99 + server/node_modules/abbrev/LICENSE | 46 + server/node_modules/abbrev/README.md | 23 + server/node_modules/abbrev/abbrev.js | 61 + server/node_modules/abbrev/package.json | 56 + server/node_modules/accepts/HISTORY.md | 236 + server/node_modules/accepts/LICENSE | 23 + server/node_modules/accepts/README.md | 142 + server/node_modules/accepts/index.js | 238 + server/node_modules/accepts/package.json | 86 + server/node_modules/ansi-align/CHANGELOG.md | 58 + server/node_modules/ansi-align/LICENSE | 13 + server/node_modules/ansi-align/README.md | 80 + server/node_modules/ansi-align/index.js | 61 + server/node_modules/ansi-align/package.json | 70 + server/node_modules/ansi-regex/index.d.ts | 37 + server/node_modules/ansi-regex/index.js | 10 + server/node_modules/ansi-regex/license | 9 + server/node_modules/ansi-regex/package.json | 87 + server/node_modules/ansi-regex/readme.md | 78 + server/node_modules/ansi-styles/index.d.ts | 345 + server/node_modules/ansi-styles/index.js | 163 + server/node_modules/ansi-styles/license | 9 + server/node_modules/ansi-styles/package.json | 89 + server/node_modules/ansi-styles/readme.md | 152 + server/node_modules/anymatch/LICENSE | 15 + server/node_modules/anymatch/README.md | 87 + server/node_modules/anymatch/index.d.ts | 19 + server/node_modules/anymatch/index.js | 104 + server/node_modules/anymatch/package.json | 76 + server/node_modules/aproba/LICENSE | 14 + server/node_modules/aproba/README.md | 94 + server/node_modules/aproba/index.js | 105 + server/node_modules/aproba/package.json | 62 + .../node_modules/are-we-there-yet/CHANGES.md | 37 + server/node_modules/are-we-there-yet/LICENSE | 5 + .../node_modules/are-we-there-yet/README.md | 195 + server/node_modules/are-we-there-yet/index.js | 4 + .../are-we-there-yet/package.json | 63 + .../are-we-there-yet/tracker-base.js | 11 + .../are-we-there-yet/tracker-group.js | 107 + .../are-we-there-yet/tracker-stream.js | 36 + .../node_modules/are-we-there-yet/tracker.js | 30 + server/node_modules/array-flatten/LICENSE | 21 + server/node_modules/array-flatten/README.md | 43 + .../array-flatten/array-flatten.js | 64 + .../node_modules/array-flatten/package.json | 64 + .../balanced-match/.github/FUNDING.yml | 2 + server/node_modules/balanced-match/LICENSE.md | 21 + server/node_modules/balanced-match/README.md | 97 + server/node_modules/balanced-match/index.js | 62 + .../node_modules/balanced-match/package.json | 76 + server/node_modules/base64-js/LICENSE | 21 + server/node_modules/base64-js/README.md | 34 + server/node_modules/base64-js/base64js.min.js | 1 + server/node_modules/base64-js/index.d.ts | 3 + server/node_modules/base64-js/index.js | 150 + server/node_modules/base64-js/package.json | 75 + .../binary-extensions/binary-extensions.json | 260 + .../binary-extensions.json.d.ts | 3 + .../node_modules/binary-extensions/index.d.ts | 14 + .../node_modules/binary-extensions/index.js | 1 + server/node_modules/binary-extensions/license | 9 + .../binary-extensions/package.json | 70 + .../node_modules/binary-extensions/readme.md | 41 + server/node_modules/bindings/LICENSE.md | 22 + server/node_modules/bindings/README.md | 98 + server/node_modules/bindings/bindings.js | 221 + server/node_modules/bindings/package.json | 57 + server/node_modules/bl/.travis.yml | 17 + server/node_modules/bl/BufferList.js | 396 + server/node_modules/bl/LICENSE.md | 13 + server/node_modules/bl/README.md | 247 + server/node_modules/bl/bl.js | 84 + .../readable-stream/CONTRIBUTING.md | 38 + .../readable-stream/GOVERNANCE.md | 136 + .../bl/node_modules/readable-stream/LICENSE | 47 + .../bl/node_modules/readable-stream/README.md | 106 + .../readable-stream/errors-browser.js | 127 + .../bl/node_modules/readable-stream/errors.js | 116 + .../readable-stream/experimentalWarning.js | 17 + .../readable-stream/lib/_stream_duplex.js | 139 + .../lib/_stream_passthrough.js | 39 + .../readable-stream/lib/_stream_readable.js | 1124 +++ .../readable-stream/lib/_stream_transform.js | 201 + .../readable-stream/lib/_stream_writable.js | 697 ++ .../lib/internal/streams/async_iterator.js | 207 + .../lib/internal/streams/buffer_list.js | 210 + .../lib/internal/streams/destroy.js | 105 + .../lib/internal/streams/end-of-stream.js | 104 + .../lib/internal/streams/from-browser.js | 3 + .../lib/internal/streams/from.js | 64 + .../lib/internal/streams/pipeline.js | 97 + .../lib/internal/streams/state.js | 27 + .../lib/internal/streams/stream-browser.js | 1 + .../lib/internal/streams/stream.js | 1 + .../node_modules/readable-stream/package.json | 97 + .../readable-stream/readable-browser.js | 9 + .../node_modules/readable-stream/readable.js | 16 + server/node_modules/bl/package.json | 69 + server/node_modules/bl/test/convert.js | 21 + server/node_modules/bl/test/indexOf.js | 492 + server/node_modules/bl/test/isBufferList.js | 32 + server/node_modules/bl/test/test.js | 869 ++ server/node_modules/body-parser/HISTORY.md | 624 ++ server/node_modules/body-parser/LICENSE | 23 + server/node_modules/body-parser/README.md | 456 + server/node_modules/body-parser/index.js | 157 + server/node_modules/body-parser/lib/read.js | 181 + .../body-parser/lib/types/json.js | 230 + .../node_modules/body-parser/lib/types/raw.js | 101 + .../body-parser/lib/types/text.js | 121 + .../body-parser/lib/types/urlencoded.js | 284 + server/node_modules/body-parser/package.json | 91 + server/node_modules/boxen/index.d.ts | 200 + server/node_modules/boxen/index.js | 279 + server/node_modules/boxen/license | 9 + server/node_modules/boxen/package.json | 83 + server/node_modules/boxen/readme.md | 244 + server/node_modules/brace-expansion/LICENSE | 21 + server/node_modules/brace-expansion/README.md | 129 + server/node_modules/brace-expansion/index.js | 201 + .../node_modules/brace-expansion/package.json | 75 + server/node_modules/braces/CHANGELOG.md | 184 + server/node_modules/braces/LICENSE | 21 + server/node_modules/braces/README.md | 593 ++ server/node_modules/braces/index.js | 170 + server/node_modules/braces/lib/compile.js | 57 + server/node_modules/braces/lib/constants.js | 57 + server/node_modules/braces/lib/expand.js | 113 + server/node_modules/braces/lib/parse.js | 333 + server/node_modules/braces/lib/stringify.js | 32 + server/node_modules/braces/lib/utils.js | 112 + server/node_modules/braces/package.json | 123 + server/node_modules/buffer/AUTHORS.md | 70 + server/node_modules/buffer/LICENSE | 21 + server/node_modules/buffer/README.md | 410 + server/node_modules/buffer/index.d.ts | 186 + server/node_modules/buffer/index.js | 1817 ++++ server/node_modules/buffer/package.json | 127 + server/node_modules/bytes/History.md | 92 + server/node_modules/bytes/LICENSE | 23 + server/node_modules/bytes/Readme.md | 152 + server/node_modules/bytes/index.js | 166 + server/node_modules/bytes/package.json | 85 + server/node_modules/cacheable-request/LICENSE | 21 + .../node_modules/cacheable-request/README.md | 206 + .../node_modules/get-stream/buffer-stream.js | 52 + .../node_modules/get-stream/index.d.ts | 108 + .../node_modules/get-stream/index.js | 60 + .../node_modules/get-stream/license | 9 + .../node_modules/get-stream/package.json | 82 + .../node_modules/get-stream/readme.md | 124 + .../node_modules/lowercase-keys/index.d.ts | 16 + .../node_modules/lowercase-keys/index.js | 10 + .../node_modules/lowercase-keys/license | 9 + .../node_modules/lowercase-keys/package.json | 70 + .../node_modules/lowercase-keys/readme.md | 32 + .../cacheable-request/package.json | 94 + .../cacheable-request/src/index.js | 251 + server/node_modules/camelcase/index.d.ts | 103 + server/node_modules/camelcase/index.js | 113 + server/node_modules/camelcase/license | 9 + server/node_modules/camelcase/package.json | 76 + server/node_modules/camelcase/readme.md | 144 + server/node_modules/chalk/index.d.ts | 415 + server/node_modules/chalk/license | 9 + .../chalk/node_modules/has-flag/index.d.ts | 39 + .../chalk/node_modules/has-flag/index.js | 8 + .../chalk/node_modules/has-flag/license | 9 + .../chalk/node_modules/has-flag/package.json | 78 + .../chalk/node_modules/has-flag/readme.md | 89 + .../node_modules/supports-color/browser.js | 5 + .../node_modules/supports-color/index.js | 135 + .../chalk/node_modules/supports-color/license | 9 + .../node_modules/supports-color/package.json | 85 + .../node_modules/supports-color/readme.md | 76 + server/node_modules/chalk/package.json | 101 + server/node_modules/chalk/readme.md | 341 + server/node_modules/chalk/source/index.js | 229 + server/node_modules/chalk/source/templates.js | 134 + server/node_modules/chalk/source/util.js | 39 + server/node_modules/chokidar/LICENSE | 21 + server/node_modules/chokidar/README.md | 308 + server/node_modules/chokidar/index.js | 973 ++ server/node_modules/chokidar/lib/constants.js | 65 + .../chokidar/lib/fsevents-handler.js | 524 + .../chokidar/lib/nodefs-handler.js | 654 ++ server/node_modules/chokidar/package.json | 119 + server/node_modules/chokidar/types/index.d.ts | 188 + server/node_modules/chownr/LICENSE | 15 + server/node_modules/chownr/README.md | 3 + server/node_modules/chownr/chownr.js | 167 + server/node_modules/chownr/package.json | 62 + server/node_modules/ci-info/CHANGELOG.md | 78 + server/node_modules/ci-info/LICENSE | 21 + server/node_modules/ci-info/README.md | 108 + server/node_modules/ci-info/index.js | 66 + server/node_modules/ci-info/package.json | 65 + server/node_modules/ci-info/vendors.json | 153 + server/node_modules/cli-boxes/boxes.json | 58 + server/node_modules/cli-boxes/index.d.ts | 113 + server/node_modules/cli-boxes/index.js | 6 + server/node_modules/cli-boxes/license | 9 + server/node_modules/cli-boxes/package.json | 74 + server/node_modules/cli-boxes/readme.md | 105 + server/node_modules/clone-response/LICENSE | 21 + server/node_modules/clone-response/README.md | 62 + .../node_modules/clone-response/package.json | 73 + .../node_modules/clone-response/src/index.js | 17 + server/node_modules/code-point-at/index.js | 32 + server/node_modules/code-point-at/license | 21 + .../node_modules/code-point-at/package.json | 70 + server/node_modules/code-point-at/readme.md | 32 + .../node_modules/color-convert/CHANGELOG.md | 54 + server/node_modules/color-convert/LICENSE | 21 + server/node_modules/color-convert/README.md | 68 + .../node_modules/color-convert/conversions.js | 839 ++ server/node_modules/color-convert/index.js | 81 + .../node_modules/color-convert/package.json | 83 + server/node_modules/color-convert/route.js | 97 + server/node_modules/color-name/LICENSE | 8 + server/node_modules/color-name/README.md | 11 + server/node_modules/color-name/index.js | 152 + server/node_modules/color-name/package.json | 56 + server/node_modules/concat-map/.travis.yml | 4 + server/node_modules/concat-map/LICENSE | 18 + .../node_modules/concat-map/README.markdown | 62 + server/node_modules/concat-map/example/map.js | 6 + server/node_modules/concat-map/index.js | 13 + server/node_modules/concat-map/package.json | 88 + server/node_modules/concat-map/test/map.js | 39 + server/node_modules/configstore/index.js | 109 + server/node_modules/configstore/license | 25 + server/node_modules/configstore/package.json | 78 + server/node_modules/configstore/readme.md | 141 + .../console-control-strings/LICENSE | 13 + .../console-control-strings/README.md | 145 + .../console-control-strings/README.md~ | 140 + .../console-control-strings/index.js | 125 + .../console-control-strings/package.json | 61 + .../content-disposition/HISTORY.md | 60 + .../node_modules/content-disposition/LICENSE | 22 + .../content-disposition/README.md | 142 + .../node_modules/content-disposition/index.js | 458 + .../content-disposition/package.json | 79 + server/node_modules/content-type/HISTORY.md | 24 + server/node_modules/content-type/LICENSE | 22 + server/node_modules/content-type/README.md | 92 + server/node_modules/content-type/index.js | 222 + server/node_modules/content-type/package.json | 76 + .../node_modules/cookie-signature/.npmignore | 4 + .../node_modules/cookie-signature/History.md | 38 + .../node_modules/cookie-signature/Readme.md | 42 + server/node_modules/cookie-signature/index.js | 51 + .../cookie-signature/package.json | 57 + server/node_modules/cookie/HISTORY.md | 128 + server/node_modules/cookie/LICENSE | 24 + server/node_modules/cookie/README.md | 257 + server/node_modules/cookie/index.js | 202 + server/node_modules/cookie/package.json | 78 + server/node_modules/core-util-is/LICENSE | 19 + server/node_modules/core-util-is/README.md | 3 + server/node_modules/core-util-is/lib/util.js | 107 + server/node_modules/core-util-is/package.json | 68 + .../crypto-random-string/index.d.ts | 17 + .../crypto-random-string/index.js | 10 + .../node_modules/crypto-random-string/license | 9 + .../crypto-random-string/package.json | 72 + .../crypto-random-string/readme.md | 51 + server/node_modules/debug/.coveralls.yml | 1 + server/node_modules/debug/.eslintrc | 11 + server/node_modules/debug/.npmignore | 9 + server/node_modules/debug/.travis.yml | 14 + server/node_modules/debug/CHANGELOG.md | 362 + server/node_modules/debug/LICENSE | 19 + server/node_modules/debug/Makefile | 50 + server/node_modules/debug/README.md | 312 + server/node_modules/debug/component.json | 19 + server/node_modules/debug/karma.conf.js | 70 + server/node_modules/debug/node.js | 1 + server/node_modules/debug/package.json | 91 + server/node_modules/debug/src/browser.js | 185 + server/node_modules/debug/src/debug.js | 202 + server/node_modules/debug/src/index.js | 10 + .../node_modules/debug/src/inspector-log.js | 15 + server/node_modules/debug/src/node.js | 248 + .../node_modules/decompress-response/index.js | 29 + .../node_modules/decompress-response/license | 21 + .../decompress-response/package.json | 85 + .../decompress-response/readme.md | 31 + server/node_modules/deep-extend/CHANGELOG.md | 46 + server/node_modules/deep-extend/LICENSE | 20 + server/node_modules/deep-extend/README.md | 91 + server/node_modules/deep-extend/index.js | 1 + .../deep-extend/lib/deep-extend.js | 150 + server/node_modules/deep-extend/package.json | 92 + server/node_modules/defer-to-connect/LICENSE | 21 + .../node_modules/defer-to-connect/README.md | 38 + .../defer-to-connect/dist/index.d.ts | 10 + .../defer-to-connect/dist/index.js | 45 + .../defer-to-connect/package.json | 101 + server/node_modules/delegates/.npmignore | 1 + server/node_modules/delegates/History.md | 22 + server/node_modules/delegates/License | 20 + server/node_modules/delegates/Makefile | 8 + server/node_modules/delegates/Readme.md | 94 + server/node_modules/delegates/index.js | 121 + server/node_modules/delegates/package.json | 48 + server/node_modules/delegates/test/index.js | 94 + server/node_modules/depd/History.md | 96 + server/node_modules/depd/LICENSE | 22 + server/node_modules/depd/Readme.md | 280 + server/node_modules/depd/index.js | 522 + server/node_modules/depd/lib/browser/index.js | 77 + .../depd/lib/compat/callsite-tostring.js | 103 + .../depd/lib/compat/event-listener-count.js | 22 + server/node_modules/depd/lib/compat/index.js | 79 + server/node_modules/depd/package.json | 79 + server/node_modules/destroy/LICENSE | 22 + server/node_modules/destroy/README.md | 60 + server/node_modules/destroy/index.js | 75 + server/node_modules/destroy/package.json | 71 + server/node_modules/detect-libc/.npmignore | 7 + server/node_modules/detect-libc/LICENSE | 201 + server/node_modules/detect-libc/README.md | 78 + .../detect-libc/bin/detect-libc.js | 18 + .../detect-libc/lib/detect-libc.js | 92 + server/node_modules/detect-libc/package.json | 70 + server/node_modules/dot-prop/index.d.ts | 101 + server/node_modules/dot-prop/index.js | 142 + server/node_modules/dot-prop/license | 9 + server/node_modules/dot-prop/package.json | 77 + server/node_modules/dot-prop/readme.md | 117 + server/node_modules/duplexer3/LICENSE.md | 26 + server/node_modules/duplexer3/README.md | 115 + server/node_modules/duplexer3/index.js | 76 + server/node_modules/duplexer3/package.json | 64 + server/node_modules/ee-first/LICENSE | 22 + server/node_modules/ee-first/README.md | 80 + server/node_modules/ee-first/index.js | 95 + server/node_modules/ee-first/package.json | 63 + .../node_modules/emoji-regex/LICENSE-MIT.txt | 20 + server/node_modules/emoji-regex/README.md | 73 + .../node_modules/emoji-regex/es2015/index.js | 6 + .../node_modules/emoji-regex/es2015/text.js | 6 + server/node_modules/emoji-regex/index.d.ts | 23 + server/node_modules/emoji-regex/index.js | 6 + server/node_modules/emoji-regex/package.json | 77 + server/node_modules/emoji-regex/text.js | 6 + server/node_modules/encodeurl/HISTORY.md | 14 + server/node_modules/encodeurl/LICENSE | 22 + server/node_modules/encodeurl/README.md | 128 + server/node_modules/encodeurl/index.js | 60 + server/node_modules/encodeurl/package.json | 78 + server/node_modules/end-of-stream/LICENSE | 21 + server/node_modules/end-of-stream/README.md | 54 + server/node_modules/end-of-stream/index.js | 94 + .../node_modules/end-of-stream/package.json | 65 + server/node_modules/escape-goat/index.d.ts | 62 + server/node_modules/escape-goat/index.js | 33 + server/node_modules/escape-goat/license | 9 + server/node_modules/escape-goat/package.json | 77 + server/node_modules/escape-goat/readme.md | 76 + server/node_modules/escape-html/LICENSE | 24 + server/node_modules/escape-html/Readme.md | 43 + server/node_modules/escape-html/index.js | 78 + server/node_modules/escape-html/package.json | 59 + server/node_modules/etag/HISTORY.md | 83 + server/node_modules/etag/LICENSE | 22 + server/node_modules/etag/README.md | 159 + server/node_modules/etag/index.js | 131 + server/node_modules/etag/package.json | 86 + .../node_modules/expand-template/.travis.yml | 6 + server/node_modules/expand-template/LICENSE | 21 + server/node_modules/expand-template/README.md | 43 + server/node_modules/expand-template/index.js | 26 + .../node_modules/expand-template/package.json | 60 + server/node_modules/expand-template/test.js | 67 + server/node_modules/express/History.md | 3510 +++++++ server/node_modules/express/LICENSE | 24 + server/node_modules/express/Readme.md | 158 + server/node_modules/express/index.js | 11 + .../node_modules/express/lib/application.js | 644 ++ server/node_modules/express/lib/express.js | 116 + .../express/lib/middleware/init.js | 43 + .../express/lib/middleware/query.js | 47 + server/node_modules/express/lib/request.js | 525 + server/node_modules/express/lib/response.js | 1147 +++ .../node_modules/express/lib/router/index.js | 668 ++ .../node_modules/express/lib/router/layer.js | 181 + .../node_modules/express/lib/router/route.js | 216 + server/node_modules/express/lib/utils.js | 302 + server/node_modules/express/lib/view.js | 182 + server/node_modules/express/package.json | 155 + .../node_modules/file-uri-to-path/.npmignore | 1 + .../node_modules/file-uri-to-path/.travis.yml | 30 + .../node_modules/file-uri-to-path/History.md | 21 + server/node_modules/file-uri-to-path/LICENSE | 20 + .../node_modules/file-uri-to-path/README.md | 74 + .../node_modules/file-uri-to-path/index.d.ts | 2 + server/node_modules/file-uri-to-path/index.js | 66 + .../file-uri-to-path/package.json | 61 + .../file-uri-to-path/test/test.js | 24 + .../file-uri-to-path/test/tests.json | 13 + server/node_modules/fill-range/LICENSE | 21 + server/node_modules/fill-range/README.md | 237 + server/node_modules/fill-range/index.js | 249 + server/node_modules/fill-range/package.json | 114 + server/node_modules/finalhandler/HISTORY.md | 187 + server/node_modules/finalhandler/LICENSE | 22 + server/node_modules/finalhandler/README.md | 148 + server/node_modules/finalhandler/index.js | 331 + server/node_modules/finalhandler/package.json | 80 + server/node_modules/forwarded/HISTORY.md | 21 + server/node_modules/forwarded/LICENSE | 22 + server/node_modules/forwarded/README.md | 57 + server/node_modules/forwarded/index.js | 90 + server/node_modules/forwarded/package.json | 80 + server/node_modules/fresh/HISTORY.md | 70 + server/node_modules/fresh/LICENSE | 23 + server/node_modules/fresh/README.md | 119 + server/node_modules/fresh/index.js | 137 + server/node_modules/fresh/package.json | 90 + server/node_modules/fs-constants/LICENSE | 21 + server/node_modules/fs-constants/README.md | 26 + server/node_modules/fs-constants/browser.js | 1 + server/node_modules/fs-constants/index.js | 1 + server/node_modules/fs-constants/package.json | 47 + server/node_modules/gauge/CHANGELOG.md | 160 + server/node_modules/gauge/LICENSE | 13 + server/node_modules/gauge/README.md | 399 + server/node_modules/gauge/base-theme.js | 14 + server/node_modules/gauge/error.js | 24 + server/node_modules/gauge/has-color.js | 12 + server/node_modules/gauge/index.js | 233 + .../gauge/node_modules/ansi-regex/index.js | 4 + .../gauge/node_modules/ansi-regex/license | 21 + .../node_modules/ansi-regex/package.json | 108 + .../gauge/node_modules/ansi-regex/readme.md | 39 + .../is-fullwidth-code-point/index.js | 46 + .../is-fullwidth-code-point/license | 21 + .../is-fullwidth-code-point/package.json | 77 + .../is-fullwidth-code-point/readme.md | 39 + .../gauge/node_modules/string-width/index.js | 37 + .../gauge/node_modules/string-width/license | 21 + .../node_modules/string-width/package.json | 88 + .../gauge/node_modules/string-width/readme.md | 42 + .../gauge/node_modules/strip-ansi/index.js | 6 + .../gauge/node_modules/strip-ansi/license | 21 + .../node_modules/strip-ansi/package.json | 102 + .../gauge/node_modules/strip-ansi/readme.md | 33 + server/node_modules/gauge/package.json | 94 + server/node_modules/gauge/plumbing.js | 48 + server/node_modules/gauge/process.js | 3 + server/node_modules/gauge/progress-bar.js | 35 + server/node_modules/gauge/render-template.js | 181 + server/node_modules/gauge/set-immediate.js | 7 + server/node_modules/gauge/set-interval.js | 3 + server/node_modules/gauge/spin.js | 5 + server/node_modules/gauge/template-item.js | 73 + server/node_modules/gauge/theme-set.js | 115 + server/node_modules/gauge/themes.js | 54 + server/node_modules/gauge/wide-truncate.js | 25 + .../node_modules/get-stream/buffer-stream.js | 51 + server/node_modules/get-stream/index.js | 50 + server/node_modules/get-stream/license | 9 + server/node_modules/get-stream/package.json | 78 + server/node_modules/get-stream/readme.md | 123 + .../github-from-package/.travis.yml | 4 + .../node_modules/github-from-package/LICENSE | 18 + .../github-from-package/example/package.json | 8 + .../github-from-package/example/url.js | 3 + .../node_modules/github-from-package/index.js | 17 + .../github-from-package/package.json | 58 + .../github-from-package/readme.markdown | 53 + .../github-from-package/test/a.json | 8 + .../github-from-package/test/b.json | 5 + .../github-from-package/test/c.json | 5 + .../github-from-package/test/d.json | 7 + .../github-from-package/test/e.json | 5 + .../github-from-package/test/url.js | 19 + server/node_modules/glob-parent/CHANGELOG.md | 110 + server/node_modules/glob-parent/LICENSE | 15 + server/node_modules/glob-parent/README.md | 137 + server/node_modules/glob-parent/index.js | 42 + server/node_modules/glob-parent/package.json | 90 + server/node_modules/global-dirs/index.d.ts | 60 + server/node_modules/global-dirs/index.js | 120 + server/node_modules/global-dirs/license | 9 + server/node_modules/global-dirs/package.json | 88 + server/node_modules/global-dirs/readme.md | 72 + server/node_modules/got/license | 9 + server/node_modules/got/package.json | 106 + server/node_modules/got/readme.md | 1237 +++ server/node_modules/got/source/as-promise.js | 108 + server/node_modules/got/source/as-stream.js | 93 + server/node_modules/got/source/create.js | 79 + server/node_modules/got/source/errors.js | 107 + .../node_modules/got/source/get-response.js | 31 + server/node_modules/got/source/index.js | 60 + .../got/source/known-hook-events.js | 10 + server/node_modules/got/source/merge.js | 73 + .../got/source/normalize-arguments.js | 265 + server/node_modules/got/source/progress.js | 96 + .../got/source/request-as-event-emitter.js | 312 + .../got/source/utils/deep-freeze.js | 12 + .../got/source/utils/get-body-size.js | 32 + .../got/source/utils/is-form-data.js | 4 + .../got/source/utils/timed-out.js | 160 + .../got/source/utils/url-to-options.js | 25 + server/node_modules/graceful-fs/LICENSE | 15 + server/node_modules/graceful-fs/README.md | 143 + server/node_modules/graceful-fs/clone.js | 23 + .../node_modules/graceful-fs/graceful-fs.js | 429 + .../graceful-fs/legacy-streams.js | 118 + server/node_modules/graceful-fs/package.json | 79 + server/node_modules/graceful-fs/polyfills.js | 348 + server/node_modules/has-flag/index.js | 8 + server/node_modules/has-flag/license | 9 + server/node_modules/has-flag/package.json | 76 + server/node_modules/has-flag/readme.md | 70 + server/node_modules/has-unicode/LICENSE | 14 + server/node_modules/has-unicode/README.md | 43 + server/node_modules/has-unicode/index.js | 16 + server/node_modules/has-unicode/package.json | 58 + server/node_modules/has-yarn/index.d.ts | 16 + server/node_modules/has-yarn/index.js | 9 + server/node_modules/has-yarn/license | 9 + server/node_modules/has-yarn/package.json | 71 + server/node_modules/has-yarn/readme.md | 60 + .../node_modules/http-cache-semantics/LICENSE | 9 + .../http-cache-semantics/README.md | 203 + .../http-cache-semantics/index.js | 673 ++ .../http-cache-semantics/package.json | 60 + server/node_modules/http-errors/HISTORY.md | 165 + server/node_modules/http-errors/LICENSE | 23 + server/node_modules/http-errors/README.md | 169 + server/node_modules/http-errors/index.js | 299 + server/node_modules/http-errors/package.json | 93 + server/node_modules/iconv-lite/Changelog.md | 162 + server/node_modules/iconv-lite/LICENSE | 21 + server/node_modules/iconv-lite/README.md | 156 + .../iconv-lite/encodings/dbcs-codec.js | 555 ++ .../iconv-lite/encodings/dbcs-data.js | 176 + .../iconv-lite/encodings/index.js | 22 + .../iconv-lite/encodings/internal.js | 188 + .../iconv-lite/encodings/sbcs-codec.js | 72 + .../encodings/sbcs-data-generated.js | 451 + .../iconv-lite/encodings/sbcs-data.js | 174 + .../encodings/tables/big5-added.json | 122 + .../iconv-lite/encodings/tables/cp936.json | 264 + .../iconv-lite/encodings/tables/cp949.json | 273 + .../iconv-lite/encodings/tables/cp950.json | 177 + .../iconv-lite/encodings/tables/eucjp.json | 182 + .../encodings/tables/gb18030-ranges.json | 1 + .../encodings/tables/gbk-added.json | 55 + .../iconv-lite/encodings/tables/shiftjis.json | 125 + .../iconv-lite/encodings/utf16.js | 177 + .../node_modules/iconv-lite/encodings/utf7.js | 290 + .../iconv-lite/lib/bom-handling.js | 52 + .../iconv-lite/lib/extend-node.js | 217 + server/node_modules/iconv-lite/lib/index.d.ts | 24 + server/node_modules/iconv-lite/lib/index.js | 153 + server/node_modules/iconv-lite/lib/streams.js | 121 + server/node_modules/iconv-lite/package.json | 77 + server/node_modules/ieee754/LICENSE | 11 + server/node_modules/ieee754/README.md | 51 + server/node_modules/ieee754/index.d.ts | 10 + server/node_modules/ieee754/index.js | 85 + server/node_modules/ieee754/package.json | 84 + server/node_modules/ignore-by-default/LICENSE | 14 + .../node_modules/ignore-by-default/README.md | 26 + .../node_modules/ignore-by-default/index.js | 12 + .../ignore-by-default/package.json | 62 + server/node_modules/import-lazy/index.js | 53 + server/node_modules/import-lazy/license | 21 + server/node_modules/import-lazy/package.json | 76 + server/node_modules/import-lazy/readme.md | 64 + server/node_modules/imurmurhash/README.md | 122 + .../node_modules/imurmurhash/imurmurhash.js | 138 + .../imurmurhash/imurmurhash.min.js | 12 + server/node_modules/imurmurhash/package.json | 63 + server/node_modules/inherits/LICENSE | 16 + server/node_modules/inherits/README.md | 42 + server/node_modules/inherits/inherits.js | 9 + .../node_modules/inherits/inherits_browser.js | 27 + server/node_modules/inherits/package.json | 61 + server/node_modules/ini/LICENSE | 15 + server/node_modules/ini/README.md | 102 + server/node_modules/ini/ini.js | 206 + server/node_modules/ini/package.json | 69 + server/node_modules/ipaddr.js/LICENSE | 19 + server/node_modules/ipaddr.js/README.md | 233 + server/node_modules/ipaddr.js/ipaddr.min.js | 1 + server/node_modules/ipaddr.js/lib/ipaddr.js | 673 ++ .../node_modules/ipaddr.js/lib/ipaddr.js.d.ts | 68 + server/node_modules/ipaddr.js/package.json | 70 + server/node_modules/is-binary-path/index.d.ts | 17 + server/node_modules/is-binary-path/index.js | 7 + server/node_modules/is-binary-path/license | 9 + .../node_modules/is-binary-path/package.json | 72 + server/node_modules/is-binary-path/readme.md | 34 + server/node_modules/is-ci/CHANGELOG.md | 14 + server/node_modules/is-ci/LICENSE | 21 + server/node_modules/is-ci/README.md | 50 + server/node_modules/is-ci/bin.js | 4 + server/node_modules/is-ci/index.js | 3 + server/node_modules/is-ci/package.json | 69 + server/node_modules/is-extglob/LICENSE | 21 + server/node_modules/is-extglob/README.md | 107 + server/node_modules/is-extglob/index.js | 20 + server/node_modules/is-extglob/package.json | 100 + .../is-fullwidth-code-point/index.d.ts | 17 + .../is-fullwidth-code-point/index.js | 50 + .../is-fullwidth-code-point/license | 9 + .../is-fullwidth-code-point/package.json | 74 + .../is-fullwidth-code-point/readme.md | 39 + server/node_modules/is-glob/LICENSE | 21 + server/node_modules/is-glob/README.md | 206 + server/node_modules/is-glob/index.js | 150 + server/node_modules/is-glob/package.json | 122 + .../is-installed-globally/index.d.ts | 19 + .../is-installed-globally/index.js | 15 + .../is-installed-globally/license | 9 + .../is-installed-globally/package.json | 86 + .../is-installed-globally/readme.md | 31 + server/node_modules/is-npm/index.d.ts | 41 + server/node_modules/is-npm/index.js | 11 + server/node_modules/is-npm/license | 9 + server/node_modules/is-npm/package.json | 71 + server/node_modules/is-npm/readme.md | 60 + server/node_modules/is-number/LICENSE | 21 + server/node_modules/is-number/README.md | 187 + server/node_modules/is-number/index.js | 18 + server/node_modules/is-number/package.json | 122 + server/node_modules/is-obj/index.d.ts | 22 + server/node_modules/is-obj/index.js | 6 + server/node_modules/is-obj/license | 9 + server/node_modules/is-obj/package.json | 66 + server/node_modules/is-obj/readme.md | 39 + server/node_modules/is-path-inside/index.d.ts | 27 + server/node_modules/is-path-inside/index.js | 12 + server/node_modules/is-path-inside/license | 9 + .../node_modules/is-path-inside/package.json | 68 + server/node_modules/is-path-inside/readme.md | 63 + server/node_modules/is-typedarray/LICENSE.md | 18 + server/node_modules/is-typedarray/README.md | 16 + server/node_modules/is-typedarray/index.js | 41 + .../node_modules/is-typedarray/package.json | 60 + server/node_modules/is-typedarray/test.js | 34 + .../node_modules/is-yarn-global/.travis.yml | 4 + server/node_modules/is-yarn-global/LICENSE | 21 + server/node_modules/is-yarn-global/README.md | 28 + server/node_modules/is-yarn-global/index.js | 12 + .../node_modules/is-yarn-global/package.json | 50 + server/node_modules/isarray/.npmignore | 1 + server/node_modules/isarray/.travis.yml | 4 + server/node_modules/isarray/Makefile | 6 + server/node_modules/isarray/README.md | 60 + server/node_modules/isarray/component.json | 19 + server/node_modules/isarray/index.js | 5 + server/node_modules/isarray/package.json | 73 + server/node_modules/isarray/test.js | 20 + server/node_modules/json-buffer/.npmignore | 3 + server/node_modules/json-buffer/.travis.yml | 3 + server/node_modules/json-buffer/LICENSE | 22 + server/node_modules/json-buffer/README.md | 24 + server/node_modules/json-buffer/index.js | 58 + server/node_modules/json-buffer/package.json | 66 + server/node_modules/json-buffer/test/index.js | 63 + server/node_modules/keyv/LICENSE | 21 + server/node_modules/keyv/README.md | 276 + server/node_modules/keyv/package.json | 78 + server/node_modules/keyv/src/index.js | 103 + server/node_modules/latest-version/index.d.ts | 42 + server/node_modules/latest-version/index.js | 11 + server/node_modules/latest-version/license | 9 + .../node_modules/latest-version/package.json | 74 + server/node_modules/latest-version/readme.md | 42 + server/node_modules/lowercase-keys/index.js | 11 + server/node_modules/lowercase-keys/license | 21 + .../node_modules/lowercase-keys/package.json | 68 + server/node_modules/lowercase-keys/readme.md | 33 + server/node_modules/lru-cache/LICENSE | 15 + server/node_modules/lru-cache/README.md | 166 + server/node_modules/lru-cache/index.js | 334 + server/node_modules/lru-cache/package.json | 69 + server/node_modules/make-dir/index.d.ts | 66 + server/node_modules/make-dir/index.js | 156 + server/node_modules/make-dir/license | 9 + .../make-dir/node_modules/.bin/semver | 1 + .../make-dir/node_modules/semver/CHANGELOG.md | 70 + .../make-dir/node_modules/semver/LICENSE | 15 + .../make-dir/node_modules/semver/README.md | 443 + .../node_modules/semver/bin/semver.js | 174 + .../make-dir/node_modules/semver/package.json | 60 + .../make-dir/node_modules/semver/range.bnf | 16 + .../make-dir/node_modules/semver/semver.js | 1596 ++++ server/node_modules/make-dir/package.json | 91 + server/node_modules/make-dir/readme.md | 125 + server/node_modules/media-typer/HISTORY.md | 22 + server/node_modules/media-typer/LICENSE | 22 + server/node_modules/media-typer/README.md | 81 + server/node_modules/media-typer/index.js | 270 + server/node_modules/media-typer/package.json | 61 + .../node_modules/merge-descriptors/HISTORY.md | 21 + server/node_modules/merge-descriptors/LICENSE | 23 + .../node_modules/merge-descriptors/README.md | 48 + .../node_modules/merge-descriptors/index.js | 60 + .../merge-descriptors/package.json | 69 + server/node_modules/methods/HISTORY.md | 29 + server/node_modules/methods/LICENSE | 24 + server/node_modules/methods/README.md | 51 + server/node_modules/methods/index.js | 69 + server/node_modules/methods/package.json | 79 + server/node_modules/mime-db/HISTORY.md | 499 + server/node_modules/mime-db/LICENSE | 22 + server/node_modules/mime-db/README.md | 100 + server/node_modules/mime-db/db.json | 8471 +++++++++++++++++ server/node_modules/mime-db/index.js | 11 + server/node_modules/mime-db/package.json | 102 + server/node_modules/mime-types/HISTORY.md | 388 + server/node_modules/mime-types/LICENSE | 23 + server/node_modules/mime-types/README.md | 113 + server/node_modules/mime-types/index.js | 188 + server/node_modules/mime-types/package.json | 88 + server/node_modules/mime/.npmignore | 0 server/node_modules/mime/CHANGELOG.md | 164 + server/node_modules/mime/LICENSE | 21 + server/node_modules/mime/README.md | 90 + server/node_modules/mime/cli.js | 8 + server/node_modules/mime/mime.js | 108 + server/node_modules/mime/package.json | 73 + server/node_modules/mime/src/build.js | 53 + server/node_modules/mime/src/test.js | 60 + server/node_modules/mime/types.json | 1 + server/node_modules/mimic-response/index.js | 32 + server/node_modules/mimic-response/license | 9 + .../node_modules/mimic-response/package.json | 71 + server/node_modules/mimic-response/readme.md | 54 + server/node_modules/minimatch/LICENSE | 15 + server/node_modules/minimatch/README.md | 209 + server/node_modules/minimatch/minimatch.js | 923 ++ server/node_modules/minimatch/package.json | 63 + server/node_modules/minimist/.travis.yml | 8 + server/node_modules/minimist/LICENSE | 18 + server/node_modules/minimist/example/parse.js | 2 + server/node_modules/minimist/index.js | 245 + server/node_modules/minimist/package.json | 73 + server/node_modules/minimist/readme.markdown | 95 + server/node_modules/minimist/test/all_bool.js | 32 + server/node_modules/minimist/test/bool.js | 178 + server/node_modules/minimist/test/dash.js | 31 + .../minimist/test/default_bool.js | 35 + server/node_modules/minimist/test/dotted.js | 22 + server/node_modules/minimist/test/kv_short.js | 16 + server/node_modules/minimist/test/long.js | 31 + server/node_modules/minimist/test/num.js | 36 + server/node_modules/minimist/test/parse.js | 197 + .../minimist/test/parse_modified.js | 9 + server/node_modules/minimist/test/proto.js | 44 + server/node_modules/minimist/test/short.js | 67 + .../node_modules/minimist/test/stop_early.js | 15 + server/node_modules/minimist/test/unknown.js | 102 + .../node_modules/minimist/test/whitespace.js | 8 + server/node_modules/mkdirp-classic/LICENSE | 21 + server/node_modules/mkdirp-classic/README.md | 18 + server/node_modules/mkdirp-classic/index.js | 98 + .../node_modules/mkdirp-classic/package.json | 47 + server/node_modules/ms/index.js | 152 + server/node_modules/ms/license.md | 21 + server/node_modules/ms/package.json | 69 + server/node_modules/ms/readme.md | 51 + server/node_modules/nan/CHANGELOG.md | 541 ++ server/node_modules/nan/LICENSE.md | 13 + server/node_modules/nan/README.md | 456 + server/node_modules/nan/doc/asyncworker.md | 146 + server/node_modules/nan/doc/buffers.md | 54 + server/node_modules/nan/doc/callback.md | 76 + server/node_modules/nan/doc/converters.md | 41 + server/node_modules/nan/doc/errors.md | 226 + server/node_modules/nan/doc/json.md | 62 + server/node_modules/nan/doc/maybe_types.md | 583 ++ server/node_modules/nan/doc/methods.md | 664 ++ server/node_modules/nan/doc/new.md | 147 + server/node_modules/nan/doc/node_misc.md | 123 + .../node_modules/nan/doc/object_wrappers.md | 263 + server/node_modules/nan/doc/persistent.md | 296 + server/node_modules/nan/doc/scopes.md | 73 + server/node_modules/nan/doc/script.md | 58 + server/node_modules/nan/doc/string_bytes.md | 62 + server/node_modules/nan/doc/v8_internals.md | 199 + server/node_modules/nan/doc/v8_misc.md | 85 + server/node_modules/nan/include_dirs.js | 1 + server/node_modules/nan/nan.h | 2904 ++++++ server/node_modules/nan/nan_callbacks.h | 88 + .../node_modules/nan/nan_callbacks_12_inl.h | 514 + .../nan/nan_callbacks_pre_12_inl.h | 520 + server/node_modules/nan/nan_converters.h | 72 + .../node_modules/nan/nan_converters_43_inl.h | 68 + .../nan/nan_converters_pre_43_inl.h | 42 + .../nan/nan_define_own_property_helper.h | 29 + .../nan/nan_implementation_12_inl.h | 430 + .../nan/nan_implementation_pre_12_inl.h | 263 + server/node_modules/nan/nan_json.h | 166 + server/node_modules/nan/nan_maybe_43_inl.h | 356 + .../node_modules/nan/nan_maybe_pre_43_inl.h | 268 + server/node_modules/nan/nan_new.h | 340 + server/node_modules/nan/nan_object_wrap.h | 156 + .../node_modules/nan/nan_persistent_12_inl.h | 132 + .../nan/nan_persistent_pre_12_inl.h | 242 + server/node_modules/nan/nan_private.h | 73 + server/node_modules/nan/nan_scriptorigin.h | 76 + server/node_modules/nan/nan_string_bytes.h | 305 + .../nan/nan_typedarray_contents.h | 96 + server/node_modules/nan/nan_weak.h | 437 + server/node_modules/nan/package.json | 98 + server/node_modules/nan/tools/1to2.js | 412 + server/node_modules/nan/tools/README.md | 14 + server/node_modules/nan/tools/package.json | 19 + server/node_modules/napi-build-utils/LICENSE | 21 + .../node_modules/napi-build-utils/README.md | 48 + server/node_modules/napi-build-utils/index.js | 213 + server/node_modules/napi-build-utils/index.md | 81 + .../napi-build-utils/package.json | 68 + server/node_modules/negotiator/HISTORY.md | 103 + server/node_modules/negotiator/LICENSE | 24 + server/node_modules/negotiator/README.md | 203 + server/node_modules/negotiator/index.js | 124 + server/node_modules/negotiator/lib/charset.js | 169 + .../node_modules/negotiator/lib/encoding.js | 184 + .../node_modules/negotiator/lib/language.js | 179 + .../node_modules/negotiator/lib/mediaType.js | 294 + server/node_modules/negotiator/package.json | 84 + .../node-abi/.circleci/config.yml | 63 + .../node-abi/.github/workflows/update-abi.yml | 41 + server/node_modules/node-abi/.releaserc.json | 9 + .../node_modules/node-abi/CODE_OF_CONDUCT.md | 73 + server/node_modules/node-abi/CONTRIBUTING.md | 53 + server/node_modules/node-abi/LICENSE | 21 + server/node_modules/node-abi/README.md | 50 + .../node_modules/node-abi/abi_registry.json | 172 + server/node_modules/node-abi/index.js | 179 + .../node-abi/node_modules/.bin/semver | 1 + .../node-abi/node_modules/semver/CHANGELOG.md | 111 + .../node-abi/node_modules/semver/LICENSE | 15 + .../node-abi/node_modules/semver/README.md | 566 ++ .../node_modules/semver/bin/semver.js | 173 + .../node_modules/semver/classes/comparator.js | 135 + .../node_modules/semver/classes/index.js | 5 + .../node_modules/semver/classes/range.js | 510 + .../node_modules/semver/classes/semver.js | 287 + .../node_modules/semver/functions/clean.js | 6 + .../node_modules/semver/functions/cmp.js | 48 + .../node_modules/semver/functions/coerce.js | 51 + .../semver/functions/compare-build.js | 7 + .../semver/functions/compare-loose.js | 3 + .../node_modules/semver/functions/compare.js | 5 + .../node_modules/semver/functions/diff.js | 23 + .../node_modules/semver/functions/eq.js | 3 + .../node_modules/semver/functions/gt.js | 3 + .../node_modules/semver/functions/gte.js | 3 + .../node_modules/semver/functions/inc.js | 15 + .../node_modules/semver/functions/lt.js | 3 + .../node_modules/semver/functions/lte.js | 3 + .../node_modules/semver/functions/major.js | 3 + .../node_modules/semver/functions/minor.js | 3 + .../node_modules/semver/functions/neq.js | 3 + .../node_modules/semver/functions/parse.js | 33 + .../node_modules/semver/functions/patch.js | 3 + .../semver/functions/prerelease.js | 6 + .../node_modules/semver/functions/rcompare.js | 3 + .../node_modules/semver/functions/rsort.js | 3 + .../semver/functions/satisfies.js | 10 + .../node_modules/semver/functions/sort.js | 3 + .../node_modules/semver/functions/valid.js | 6 + .../node-abi/node_modules/semver/index.js | 48 + .../node_modules/semver/internal/constants.js | 17 + .../node_modules/semver/internal/debug.js | 9 + .../semver/internal/identifiers.js | 23 + .../semver/internal/parse-options.js | 11 + .../node_modules/semver/internal/re.js | 182 + .../node-abi/node_modules/semver/package.json | 73 + .../node-abi/node_modules/semver/preload.js | 2 + .../node-abi/node_modules/semver/range.bnf | 16 + .../node_modules/semver/ranges/gtr.js | 4 + .../node_modules/semver/ranges/intersects.js | 7 + .../node_modules/semver/ranges/ltr.js | 4 + .../semver/ranges/max-satisfying.js | 25 + .../semver/ranges/min-satisfying.js | 24 + .../node_modules/semver/ranges/min-version.js | 60 + .../node_modules/semver/ranges/outside.js | 80 + .../node_modules/semver/ranges/simplify.js | 44 + .../node_modules/semver/ranges/subset.js | 222 + .../semver/ranges/to-comparators.js | 8 + .../node_modules/semver/ranges/valid.js | 11 + server/node_modules/node-abi/package.json | 68 + .../node-abi/scripts/update-abi-registry.js | 119 + server/node_modules/node-abi/test/index.js | 166 + server/node_modules/nodemon/.eslintrc.json | 19 + server/node_modules/nodemon/.jshintrc | 16 + server/node_modules/nodemon/.releaserc | 3 + server/node_modules/nodemon/.travis.yml | 17 + server/node_modules/nodemon/LICENSE | 21 + server/node_modules/nodemon/README.md | 379 + server/node_modules/nodemon/bin/nodemon.js | 16 + .../node_modules/nodemon/bin/postinstall.js | 31 + .../node_modules/nodemon/bin/windows-kill.exe | Bin 0 -> 80384 bytes .../node_modules/nodemon/commitlint.config.js | 3 + .../node_modules/nodemon/doc/cli/authors.txt | 8 + .../node_modules/nodemon/doc/cli/config.txt | 44 + server/node_modules/nodemon/doc/cli/help.txt | 29 + server/node_modules/nodemon/doc/cli/logo.txt | 20 + .../node_modules/nodemon/doc/cli/options.txt | 36 + .../node_modules/nodemon/doc/cli/topics.txt | 8 + server/node_modules/nodemon/doc/cli/usage.txt | 3 + .../node_modules/nodemon/doc/cli/whoami.txt | 9 + server/node_modules/nodemon/lib/cli/index.js | 49 + server/node_modules/nodemon/lib/cli/parse.js | 230 + .../nodemon/lib/config/command.js | 43 + .../nodemon/lib/config/defaults.js | 28 + .../node_modules/nodemon/lib/config/exec.js | 225 + .../node_modules/nodemon/lib/config/index.js | 93 + .../node_modules/nodemon/lib/config/load.js | 256 + server/node_modules/nodemon/lib/help/index.js | 27 + server/node_modules/nodemon/lib/index.js | 1 + .../node_modules/nodemon/lib/monitor/index.js | 4 + .../node_modules/nodemon/lib/monitor/match.js | 276 + .../node_modules/nodemon/lib/monitor/run.js | 541 ++ .../nodemon/lib/monitor/signals.js | 34 + .../node_modules/nodemon/lib/monitor/watch.js | 239 + server/node_modules/nodemon/lib/nodemon.js | 311 + server/node_modules/nodemon/lib/rules/add.js | 89 + .../node_modules/nodemon/lib/rules/index.js | 53 + .../node_modules/nodemon/lib/rules/parse.js | 43 + server/node_modules/nodemon/lib/spawn.js | 73 + server/node_modules/nodemon/lib/utils/bus.js | 44 + .../node_modules/nodemon/lib/utils/clone.js | 40 + .../node_modules/nodemon/lib/utils/colour.js | 26 + .../node_modules/nodemon/lib/utils/index.js | 102 + server/node_modules/nodemon/lib/utils/log.js | 82 + .../node_modules/nodemon/lib/utils/merge.js | 47 + server/node_modules/nodemon/lib/version.js | 100 + .../nodemon/node_modules/debug/CHANGELOG.md | 395 + .../nodemon/node_modules/debug/LICENSE | 19 + .../nodemon/node_modules/debug/README.md | 437 + .../nodemon/node_modules/debug/node.js | 1 + .../nodemon/node_modules/debug/package.json | 90 + .../nodemon/node_modules/debug/src/browser.js | 180 + .../nodemon/node_modules/debug/src/common.js | 249 + .../nodemon/node_modules/debug/src/index.js | 12 + .../nodemon/node_modules/debug/src/node.js | 177 + .../nodemon/node_modules/ms/index.js | 162 + .../nodemon/node_modules/ms/license.md | 21 + .../nodemon/node_modules/ms/package.json | 70 + .../nodemon/node_modules/ms/readme.md | 59 + server/node_modules/nodemon/package.json | 105 + server/node_modules/nopt/.npmignore | 0 server/node_modules/nopt/LICENSE | 23 + server/node_modules/nopt/README.md | 208 + server/node_modules/nopt/bin/nopt.js | 44 + .../node_modules/nopt/examples/my-program.js | 30 + server/node_modules/nopt/lib/nopt.js | 552 ++ server/node_modules/nopt/package.json | 60 + server/node_modules/normalize-path/LICENSE | 21 + server/node_modules/normalize-path/README.md | 127 + server/node_modules/normalize-path/index.js | 35 + .../node_modules/normalize-path/package.json | 115 + server/node_modules/normalize-url/index.d.ts | 216 + server/node_modules/normalize-url/index.js | 221 + server/node_modules/normalize-url/license | 9 + .../node_modules/normalize-url/package.json | 76 + server/node_modules/normalize-url/readme.md | 232 + server/node_modules/npmlog/CHANGELOG.md | 49 + server/node_modules/npmlog/LICENSE | 15 + server/node_modules/npmlog/README.md | 216 + server/node_modules/npmlog/log.js | 309 + server/node_modules/npmlog/package.json | 61 + server/node_modules/number-is-nan/index.js | 4 + server/node_modules/number-is-nan/license | 21 + .../node_modules/number-is-nan/package.json | 67 + server/node_modules/number-is-nan/readme.md | 28 + server/node_modules/object-assign/index.js | 90 + server/node_modules/object-assign/license | 21 + .../node_modules/object-assign/package.json | 74 + server/node_modules/object-assign/readme.md | 61 + server/node_modules/on-finished/HISTORY.md | 88 + server/node_modules/on-finished/LICENSE | 23 + server/node_modules/on-finished/README.md | 154 + server/node_modules/on-finished/index.js | 196 + server/node_modules/on-finished/package.json | 73 + server/node_modules/once/LICENSE | 15 + server/node_modules/once/README.md | 79 + server/node_modules/once/once.js | 42 + server/node_modules/once/package.json | 67 + server/node_modules/p-cancelable/index.d.ts | 168 + server/node_modules/p-cancelable/index.js | 103 + server/node_modules/p-cancelable/license | 9 + server/node_modules/p-cancelable/package.json | 81 + server/node_modules/p-cancelable/readme.md | 155 + server/node_modules/package-json/index.d.ts | 199 + server/node_modules/package-json/index.js | 115 + server/node_modules/package-json/license | 9 + .../package-json/node_modules/.bin/semver | 1 + .../node_modules/semver/CHANGELOG.md | 70 + .../package-json/node_modules/semver/LICENSE | 15 + .../node_modules/semver/README.md | 443 + .../node_modules/semver/bin/semver.js | 174 + .../node_modules/semver/package.json | 60 + .../node_modules/semver/range.bnf | 16 + .../node_modules/semver/semver.js | 1596 ++++ server/node_modules/package-json/package.json | 78 + server/node_modules/package-json/readme.md | 118 + server/node_modules/parseurl/HISTORY.md | 58 + server/node_modules/parseurl/LICENSE | 24 + server/node_modules/parseurl/README.md | 133 + server/node_modules/parseurl/index.js | 158 + server/node_modules/parseurl/package.json | 81 + server/node_modules/path-to-regexp/History.md | 36 + server/node_modules/path-to-regexp/LICENSE | 21 + server/node_modules/path-to-regexp/Readme.md | 35 + server/node_modules/path-to-regexp/index.js | 129 + .../node_modules/path-to-regexp/package.json | 59 + server/node_modules/picomatch/CHANGELOG.md | 136 + server/node_modules/picomatch/LICENSE | 21 + server/node_modules/picomatch/README.md | 708 ++ server/node_modules/picomatch/index.js | 3 + .../node_modules/picomatch/lib/constants.js | 179 + server/node_modules/picomatch/lib/parse.js | 1091 +++ .../node_modules/picomatch/lib/picomatch.js | 342 + server/node_modules/picomatch/lib/scan.js | 391 + server/node_modules/picomatch/lib/utils.js | 64 + server/node_modules/picomatch/package.json | 113 + .../prebuild-install/CHANGELOG.md | 90 + .../prebuild-install/CONTRIBUTING.md | 6 + server/node_modules/prebuild-install/LICENSE | 21 + .../node_modules/prebuild-install/README.md | 139 + server/node_modules/prebuild-install/asset.js | 44 + server/node_modules/prebuild-install/bin.js | 78 + .../node_modules/prebuild-install/download.js | 142 + server/node_modules/prebuild-install/error.js | 14 + server/node_modules/prebuild-install/help.txt | 16 + server/node_modules/prebuild-install/index.js | 1 + server/node_modules/prebuild-install/log.js | 25 + .../prebuild-install/package.json | 126 + server/node_modules/prebuild-install/proxy.js | 35 + server/node_modules/prebuild-install/rc.js | 60 + server/node_modules/prebuild-install/util.js | 143 + server/node_modules/prepend-http/index.js | 15 + server/node_modules/prepend-http/license | 9 + server/node_modules/prepend-http/package.json | 67 + server/node_modules/prepend-http/readme.md | 56 + .../process-nextick-args/index.js | 45 + .../process-nextick-args/license.md | 19 + .../process-nextick-args/package.json | 50 + .../process-nextick-args/readme.md | 18 + server/node_modules/proxy-addr/HISTORY.md | 161 + server/node_modules/proxy-addr/LICENSE | 22 + server/node_modules/proxy-addr/README.md | 139 + server/node_modules/proxy-addr/index.js | 327 + server/node_modules/proxy-addr/package.json | 82 + server/node_modules/pstree.remy/.travis.yml | 8 + server/node_modules/pstree.remy/LICENSE | 7 + server/node_modules/pstree.remy/README.md | 26 + server/node_modules/pstree.remy/lib/index.js | 37 + server/node_modules/pstree.remy/lib/tree.js | 37 + server/node_modules/pstree.remy/lib/utils.js | 53 + server/node_modules/pstree.remy/package.json | 64 + .../pstree.remy/tests/fixtures/index.js | 13 + .../pstree.remy/tests/fixtures/out1 | 10 + .../pstree.remy/tests/fixtures/out2 | 29 + .../pstree.remy/tests/index.test.js | 51 + server/node_modules/pump/.travis.yml | 5 + server/node_modules/pump/LICENSE | 21 + server/node_modules/pump/README.md | 65 + server/node_modules/pump/index.js | 82 + server/node_modules/pump/package.json | 60 + server/node_modules/pump/test-browser.js | 66 + server/node_modules/pump/test-node.js | 53 + server/node_modules/pupa/index.d.ts | 32 + server/node_modules/pupa/index.js | 39 + server/node_modules/pupa/license | 9 + server/node_modules/pupa/package.json | 79 + server/node_modules/pupa/readme.md | 63 + server/node_modules/qs/.editorconfig | 39 + server/node_modules/qs/.eslintignore | 2 + server/node_modules/qs/.eslintrc | 35 + server/node_modules/qs/.github/FUNDING.yml | 12 + server/node_modules/qs/.nycrc | 13 + server/node_modules/qs/CHANGELOG.md | 359 + server/node_modules/qs/LICENSE.md | 29 + server/node_modules/qs/README.md | 604 ++ server/node_modules/qs/dist/qs.js | 832 ++ server/node_modules/qs/lib/formats.js | 23 + server/node_modules/qs/lib/index.js | 11 + server/node_modules/qs/lib/parse.js | 257 + server/node_modules/qs/lib/stringify.js | 278 + server/node_modules/qs/lib/utils.js | 251 + server/node_modules/qs/package.json | 98 + server/node_modules/qs/test/parse.js | 772 ++ server/node_modules/qs/test/stringify.js | 793 ++ server/node_modules/qs/test/utils.js | 136 + server/node_modules/range-parser/HISTORY.md | 56 + server/node_modules/range-parser/LICENSE | 23 + server/node_modules/range-parser/README.md | 84 + server/node_modules/range-parser/index.js | 162 + server/node_modules/range-parser/package.json | 91 + server/node_modules/raw-body/HISTORY.md | 284 + server/node_modules/raw-body/LICENSE | 22 + server/node_modules/raw-body/README.md | 217 + server/node_modules/raw-body/index.d.ts | 87 + server/node_modules/raw-body/index.js | 286 + server/node_modules/raw-body/package.json | 90 + server/node_modules/rc/LICENSE.APACHE2 | 15 + server/node_modules/rc/LICENSE.BSD | 26 + server/node_modules/rc/LICENSE.MIT | 24 + server/node_modules/rc/README.md | 227 + server/node_modules/rc/browser.js | 7 + server/node_modules/rc/cli.js | 4 + server/node_modules/rc/index.js | 53 + server/node_modules/rc/lib/utils.js | 104 + .../node_modules/rc/node_modules/ini/LICENSE | 15 + .../rc/node_modules/ini/README.md | 102 + .../node_modules/rc/node_modules/ini/ini.js | 206 + .../rc/node_modules/ini/package.json | 66 + server/node_modules/rc/package.json | 65 + server/node_modules/rc/test/ini.js | 16 + .../node_modules/rc/test/nested-env-vars.js | 50 + server/node_modules/rc/test/test.js | 59 + .../node_modules/readable-stream/.travis.yml | 34 + .../readable-stream/CONTRIBUTING.md | 38 + .../readable-stream/GOVERNANCE.md | 136 + server/node_modules/readable-stream/LICENSE | 47 + server/node_modules/readable-stream/README.md | 58 + .../doc/wg-meetings/2015-01-30.md | 60 + .../readable-stream/duplex-browser.js | 1 + server/node_modules/readable-stream/duplex.js | 1 + .../readable-stream/lib/_stream_duplex.js | 131 + .../lib/_stream_passthrough.js | 47 + .../readable-stream/lib/_stream_readable.js | 1019 ++ .../readable-stream/lib/_stream_transform.js | 214 + .../readable-stream/lib/_stream_writable.js | 687 ++ .../lib/internal/streams/BufferList.js | 79 + .../lib/internal/streams/destroy.js | 74 + .../lib/internal/streams/stream-browser.js | 1 + .../lib/internal/streams/stream.js | 1 + .../node_modules/safe-buffer/LICENSE | 21 + .../node_modules/safe-buffer/README.md | 584 ++ .../node_modules/safe-buffer/index.d.ts | 187 + .../node_modules/safe-buffer/index.js | 62 + .../node_modules/safe-buffer/package.json | 62 + .../node_modules/readable-stream/package.json | 81 + .../readable-stream/passthrough.js | 1 + .../readable-stream/readable-browser.js | 7 + .../node_modules/readable-stream/readable.js | 19 + .../node_modules/readable-stream/transform.js | 1 + .../readable-stream/writable-browser.js | 1 + .../node_modules/readable-stream/writable.js | 8 + server/node_modules/readdirp/LICENSE | 21 + server/node_modules/readdirp/README.md | 122 + server/node_modules/readdirp/index.d.ts | 43 + server/node_modules/readdirp/index.js | 287 + server/node_modules/readdirp/package.json | 158 + .../registry-auth-token/CHANGELOG.md | 134 + .../node_modules/registry-auth-token/LICENSE | 21 + .../registry-auth-token/README.md | 65 + .../registry-auth-token/base64.js | 12 + .../node_modules/registry-auth-token/index.js | 142 + .../registry-auth-token/package.json | 76 + .../registry-auth-token/registry-url.js | 5 + server/node_modules/registry-url/index.d.ts | 33 + server/node_modules/registry-url/index.js | 12 + server/node_modules/registry-url/license | 9 + server/node_modules/registry-url/package.json | 76 + server/node_modules/registry-url/readme.md | 50 + server/node_modules/responselike/LICENSE | 19 + server/node_modules/responselike/README.md | 77 + server/node_modules/responselike/package.json | 69 + server/node_modules/responselike/src/index.js | 34 + server/node_modules/safe-buffer/LICENSE | 21 + server/node_modules/safe-buffer/README.md | 584 ++ server/node_modules/safe-buffer/index.d.ts | 187 + server/node_modules/safe-buffer/index.js | 65 + server/node_modules/safe-buffer/package.json | 77 + server/node_modules/safer-buffer/LICENSE | 21 + .../safer-buffer/Porting-Buffer.md | 268 + server/node_modules/safer-buffer/Readme.md | 156 + server/node_modules/safer-buffer/dangerous.js | 58 + server/node_modules/safer-buffer/package.json | 60 + server/node_modules/safer-buffer/safer.js | 77 + server/node_modules/safer-buffer/tests.js | 406 + server/node_modules/semver-diff/index.d.ts | 58 + server/node_modules/semver-diff/index.js | 13 + server/node_modules/semver-diff/license | 9 + .../semver-diff/node_modules/.bin/semver | 1 + .../node_modules/semver/CHANGELOG.md | 70 + .../semver-diff/node_modules/semver/LICENSE | 15 + .../semver-diff/node_modules/semver/README.md | 443 + .../node_modules/semver/bin/semver.js | 174 + .../node_modules/semver/package.json | 60 + .../semver-diff/node_modules/semver/range.bnf | 16 + .../semver-diff/node_modules/semver/semver.js | 1596 ++++ server/node_modules/semver-diff/package.json | 69 + server/node_modules/semver-diff/readme.md | 77 + server/node_modules/semver/CHANGELOG.md | 39 + server/node_modules/semver/LICENSE | 15 + server/node_modules/semver/README.md | 412 + server/node_modules/semver/bin/semver | 160 + server/node_modules/semver/package.json | 60 + server/node_modules/semver/range.bnf | 16 + server/node_modules/semver/semver.js | 1483 +++ server/node_modules/send/HISTORY.md | 506 + server/node_modules/send/LICENSE | 23 + server/node_modules/send/README.md | 327 + server/node_modules/send/index.js | 1133 +++ .../send/node_modules/ms/index.js | 162 + .../send/node_modules/ms/license.md | 21 + .../send/node_modules/ms/package.json | 70 + .../send/node_modules/ms/readme.md | 59 + server/node_modules/send/package.json | 106 + server/node_modules/serialport/LICENSE | 21 + server/node_modules/serialport/README.md | 91 + server/node_modules/serialport/lib/index.js | 15 + server/node_modules/serialport/lib/parsers.js | 9 + .../serialport/node_modules/debug/LICENSE | 20 + .../serialport/node_modules/debug/README.md | 478 + .../node_modules/debug/package.json | 101 + .../node_modules/debug/src/browser.js | 269 + .../node_modules/debug/src/common.js | 274 + .../node_modules/debug/src/index.js | 10 + .../serialport/node_modules/debug/src/node.js | 263 + .../serialport/node_modules/ms/index.js | 162 + .../serialport/node_modules/ms/license.md | 21 + .../serialport/node_modules/ms/package.json | 69 + .../serialport/node_modules/ms/readme.md | 60 + server/node_modules/serialport/package.json | 97 + server/node_modules/serialport/test.js | 8 + server/node_modules/serve-static/HISTORY.md | 459 + server/node_modules/serve-static/LICENSE | 25 + server/node_modules/serve-static/README.md | 257 + server/node_modules/serve-static/index.js | 210 + server/node_modules/serve-static/package.json | 77 + server/node_modules/set-blocking/CHANGELOG.md | 26 + server/node_modules/set-blocking/LICENSE.txt | 14 + server/node_modules/set-blocking/README.md | 31 + server/node_modules/set-blocking/index.js | 7 + server/node_modules/set-blocking/package.json | 70 + server/node_modules/setprototypeof/LICENSE | 13 + server/node_modules/setprototypeof/README.md | 31 + server/node_modules/setprototypeof/index.d.ts | 2 + server/node_modules/setprototypeof/index.js | 17 + .../node_modules/setprototypeof/package.json | 66 + .../node_modules/setprototypeof/test/index.js | 24 + server/node_modules/signal-exit/LICENSE.txt | 16 + server/node_modules/signal-exit/README.md | 39 + server/node_modules/signal-exit/index.js | 200 + server/node_modules/signal-exit/package.json | 66 + server/node_modules/signal-exit/signals.js | 53 + server/node_modules/simple-concat/.travis.yml | 3 + server/node_modules/simple-concat/LICENSE | 20 + server/node_modules/simple-concat/README.md | 44 + server/node_modules/simple-concat/index.js | 15 + .../node_modules/simple-concat/package.json | 72 + .../node_modules/simple-concat/test/basic.js | 41 + server/node_modules/simple-get/LICENSE | 20 + server/node_modules/simple-get/README.md | 319 + server/node_modules/simple-get/index.js | 100 + .../decompress-response/index.d.ts | 22 + .../node_modules/decompress-response/index.js | 58 + .../node_modules/decompress-response/license | 9 + .../decompress-response/package.json | 88 + .../decompress-response/readme.md | 48 + .../node_modules/mimic-response/index.d.ts | 17 + .../node_modules/mimic-response/index.js | 77 + .../node_modules/mimic-response/license | 9 + .../node_modules/mimic-response/package.json | 74 + .../node_modules/mimic-response/readme.md | 78 + server/node_modules/simple-get/package.json | 92 + server/node_modules/statuses/HISTORY.md | 65 + server/node_modules/statuses/LICENSE | 23 + server/node_modules/statuses/README.md | 127 + server/node_modules/statuses/codes.json | 66 + server/node_modules/statuses/index.js | 113 + server/node_modules/statuses/package.json | 90 + server/node_modules/string-width/index.d.ts | 29 + server/node_modules/string-width/index.js | 47 + server/node_modules/string-width/license | 9 + server/node_modules/string-width/package.json | 91 + server/node_modules/string-width/readme.md | 50 + .../node_modules/string_decoder/.travis.yml | 50 + server/node_modules/string_decoder/LICENSE | 48 + server/node_modules/string_decoder/README.md | 47 + .../string_decoder/lib/string_decoder.js | 296 + .../node_modules/safe-buffer/LICENSE | 21 + .../node_modules/safe-buffer/README.md | 584 ++ .../node_modules/safe-buffer/index.d.ts | 187 + .../node_modules/safe-buffer/index.js | 62 + .../node_modules/safe-buffer/package.json | 62 + .../node_modules/string_decoder/package.json | 61 + server/node_modules/strip-ansi/index.d.ts | 17 + server/node_modules/strip-ansi/index.js | 4 + server/node_modules/strip-ansi/license | 9 + server/node_modules/strip-ansi/package.json | 87 + server/node_modules/strip-ansi/readme.md | 46 + .../node_modules/strip-json-comments/index.js | 70 + .../node_modules/strip-json-comments/license | 21 + .../strip-json-comments/package.json | 74 + .../strip-json-comments/readme.md | 64 + server/node_modules/supports-color/browser.js | 5 + server/node_modules/supports-color/index.js | 131 + server/node_modules/supports-color/license | 9 + .../node_modules/supports-color/package.json | 85 + server/node_modules/supports-color/readme.md | 66 + server/node_modules/tar-fs/.travis.yml | 6 + server/node_modules/tar-fs/LICENSE | 21 + server/node_modules/tar-fs/README.md | 165 + server/node_modules/tar-fs/index.js | 351 + server/node_modules/tar-fs/package.json | 68 + .../tar-fs/test/fixtures/a/hello.txt | 1 + .../tar-fs/test/fixtures/b/a/test.txt | 1 + .../node_modules/tar-fs/test/fixtures/d/file1 | 0 .../node_modules/tar-fs/test/fixtures/d/file2 | 0 .../tar-fs/test/fixtures/d/sub-dir/file5 | 0 .../tar-fs/test/fixtures/d/sub-files/file3 | 0 .../tar-fs/test/fixtures/d/sub-files/file4 | 0 .../tar-fs/test/fixtures/e/directory/.ignore | 0 .../node_modules/tar-fs/test/fixtures/e/file | 0 .../tar-fs/test/fixtures/invalid.tar | Bin 0 -> 2560 bytes server/node_modules/tar-fs/test/index.js | 346 + server/node_modules/tar-stream/LICENSE | 21 + server/node_modules/tar-stream/README.md | 168 + server/node_modules/tar-stream/extract.js | 257 + server/node_modules/tar-stream/headers.js | 295 + server/node_modules/tar-stream/index.js | 2 + .../readable-stream/CONTRIBUTING.md | 38 + .../readable-stream/GOVERNANCE.md | 136 + .../node_modules/readable-stream/LICENSE | 47 + .../node_modules/readable-stream/README.md | 106 + .../readable-stream/errors-browser.js | 127 + .../node_modules/readable-stream/errors.js | 116 + .../readable-stream/experimentalWarning.js | 17 + .../readable-stream/lib/_stream_duplex.js | 139 + .../lib/_stream_passthrough.js | 39 + .../readable-stream/lib/_stream_readable.js | 1124 +++ .../readable-stream/lib/_stream_transform.js | 201 + .../readable-stream/lib/_stream_writable.js | 697 ++ .../lib/internal/streams/async_iterator.js | 207 + .../lib/internal/streams/buffer_list.js | 210 + .../lib/internal/streams/destroy.js | 105 + .../lib/internal/streams/end-of-stream.js | 104 + .../lib/internal/streams/from-browser.js | 3 + .../lib/internal/streams/from.js | 64 + .../lib/internal/streams/pipeline.js | 97 + .../lib/internal/streams/state.js | 27 + .../lib/internal/streams/stream-browser.js | 1 + .../lib/internal/streams/stream.js | 1 + .../node_modules/readable-stream/package.json | 97 + .../readable-stream/readable-browser.js | 9 + .../node_modules/readable-stream/readable.js | 16 + server/node_modules/tar-stream/pack.js | 255 + server/node_modules/tar-stream/package.json | 90 + server/node_modules/tar-stream/sandbox.js | 11 + .../node_modules/to-readable-stream/index.js | 11 + .../node_modules/to-readable-stream/license | 9 + .../to-readable-stream/package.json | 72 + .../node_modules/to-readable-stream/readme.md | 42 + server/node_modules/to-regex-range/LICENSE | 21 + server/node_modules/to-regex-range/README.md | 305 + server/node_modules/to-regex-range/index.js | 288 + .../node_modules/to-regex-range/package.json | 125 + server/node_modules/toidentifier/HISTORY.md | 9 + server/node_modules/toidentifier/LICENSE | 21 + server/node_modules/toidentifier/README.md | 61 + server/node_modules/toidentifier/index.js | 32 + server/node_modules/toidentifier/package.json | 80 + server/node_modules/touch/LICENSE | 15 + server/node_modules/touch/README.md | 52 + server/node_modules/touch/bin/nodetouch.js | 112 + server/node_modules/touch/index.js | 224 + server/node_modules/touch/package.json | 64 + server/node_modules/tunnel-agent/LICENSE | 55 + server/node_modules/tunnel-agent/README.md | 4 + server/node_modules/tunnel-agent/index.js | 244 + server/node_modules/tunnel-agent/package.json | 55 + server/node_modules/type-fest/base.d.ts | 38 + server/node_modules/type-fest/index.d.ts | 2 + server/node_modules/type-fest/license | 9 + server/node_modules/type-fest/package.json | 90 + server/node_modules/type-fest/readme.md | 658 ++ .../type-fest/source/async-return-type.d.ts | 23 + .../type-fest/source/asyncify.d.ts | 31 + .../node_modules/type-fest/source/basic.d.ts | 67 + .../type-fest/source/conditional-except.d.ts | 43 + .../type-fest/source/conditional-keys.d.ts | 43 + .../type-fest/source/conditional-pick.d.ts | 42 + .../type-fest/source/entries.d.ts | 57 + .../node_modules/type-fest/source/entry.d.ts | 60 + .../node_modules/type-fest/source/except.d.ts | 22 + .../type-fest/source/fixed-length-array.d.ts | 38 + .../type-fest/source/iterable-element.d.ts | 46 + .../type-fest/source/literal-union.d.ts | 33 + .../type-fest/source/merge-exclusive.d.ts | 39 + .../node_modules/type-fest/source/merge.d.ts | 22 + .../type-fest/source/mutable.d.ts | 22 + .../node_modules/type-fest/source/opaque.d.ts | 65 + .../type-fest/source/package-json.d.ts | 611 ++ .../type-fest/source/partial-deep.d.ts | 72 + .../type-fest/source/promisable.d.ts | 23 + .../type-fest/source/promise-value.d.ts | 27 + .../type-fest/source/readonly-deep.d.ts | 59 + .../source/require-at-least-one.d.ts | 33 + .../type-fest/source/require-exactly-one.d.ts | 35 + .../type-fest/source/set-optional.d.ts | 34 + .../type-fest/source/set-required.d.ts | 34 + .../type-fest/source/set-return-type.d.ts | 29 + .../type-fest/source/stringified.d.ts | 21 + .../type-fest/source/tsconfig-json.d.ts | 870 ++ .../source/union-to-intersection.d.ts | 58 + .../type-fest/source/utilities.d.ts | 3 + .../type-fest/source/value-of.d.ts | 40 + .../type-fest/ts41/camel-case.d.ts | 72 + .../type-fest/ts41/delimiter-case.d.ts | 85 + server/node_modules/type-fest/ts41/index.d.ts | 9 + .../type-fest/ts41/kebab-case.d.ts | 36 + .../type-fest/ts41/pascal-case.d.ts | 36 + .../type-fest/ts41/snake-case.d.ts | 35 + server/node_modules/type-is/HISTORY.md | 259 + server/node_modules/type-is/LICENSE | 23 + server/node_modules/type-is/README.md | 170 + server/node_modules/type-is/index.js | 266 + server/node_modules/type-is/package.json | 85 + .../typedarray-to-buffer/.airtap.yml | 15 + .../typedarray-to-buffer/.travis.yml | 11 + .../node_modules/typedarray-to-buffer/LICENSE | 21 + .../typedarray-to-buffer/README.md | 85 + .../typedarray-to-buffer/index.js | 25 + .../typedarray-to-buffer/package.json | 75 + .../typedarray-to-buffer/test/basic.js | 50 + .../undefsafe/.github/workflows/release.yml | 25 + server/node_modules/undefsafe/.jscsrc | 13 + server/node_modules/undefsafe/.jshintrc | 16 + server/node_modules/undefsafe/.travis.yml | 18 + server/node_modules/undefsafe/LICENSE | 22 + server/node_modules/undefsafe/README.md | 63 + server/node_modules/undefsafe/example.js | 14 + .../node_modules/undefsafe/lib/undefsafe.js | 125 + server/node_modules/undefsafe/package.json | 65 + server/node_modules/unique-string/index.d.ts | 16 + server/node_modules/unique-string/index.js | 4 + server/node_modules/unique-string/license | 9 + .../node_modules/unique-string/package.json | 72 + server/node_modules/unique-string/readme.md | 32 + server/node_modules/unpipe/HISTORY.md | 4 + server/node_modules/unpipe/LICENSE | 22 + server/node_modules/unpipe/README.md | 43 + server/node_modules/unpipe/index.js | 69 + server/node_modules/unpipe/package.json | 63 + server/node_modules/update-notifier/check.js | 28 + server/node_modules/update-notifier/index.js | 188 + server/node_modules/update-notifier/license | 9 + .../update-notifier/node_modules/.bin/semver | 1 + .../node_modules/semver/CHANGELOG.md | 111 + .../node_modules/semver/LICENSE | 15 + .../node_modules/semver/README.md | 566 ++ .../node_modules/semver/bin/semver.js | 173 + .../node_modules/semver/classes/comparator.js | 135 + .../node_modules/semver/classes/index.js | 5 + .../node_modules/semver/classes/range.js | 510 + .../node_modules/semver/classes/semver.js | 287 + .../node_modules/semver/functions/clean.js | 6 + .../node_modules/semver/functions/cmp.js | 48 + .../node_modules/semver/functions/coerce.js | 51 + .../semver/functions/compare-build.js | 7 + .../semver/functions/compare-loose.js | 3 + .../node_modules/semver/functions/compare.js | 5 + .../node_modules/semver/functions/diff.js | 23 + .../node_modules/semver/functions/eq.js | 3 + .../node_modules/semver/functions/gt.js | 3 + .../node_modules/semver/functions/gte.js | 3 + .../node_modules/semver/functions/inc.js | 15 + .../node_modules/semver/functions/lt.js | 3 + .../node_modules/semver/functions/lte.js | 3 + .../node_modules/semver/functions/major.js | 3 + .../node_modules/semver/functions/minor.js | 3 + .../node_modules/semver/functions/neq.js | 3 + .../node_modules/semver/functions/parse.js | 33 + .../node_modules/semver/functions/patch.js | 3 + .../semver/functions/prerelease.js | 6 + .../node_modules/semver/functions/rcompare.js | 3 + .../node_modules/semver/functions/rsort.js | 3 + .../semver/functions/satisfies.js | 10 + .../node_modules/semver/functions/sort.js | 3 + .../node_modules/semver/functions/valid.js | 6 + .../node_modules/semver/index.js | 48 + .../node_modules/semver/internal/constants.js | 17 + .../node_modules/semver/internal/debug.js | 9 + .../semver/internal/identifiers.js | 23 + .../semver/internal/parse-options.js | 11 + .../node_modules/semver/internal/re.js | 182 + .../node_modules/semver/package.json | 73 + .../node_modules/semver/preload.js | 2 + .../node_modules/semver/range.bnf | 16 + .../node_modules/semver/ranges/gtr.js | 4 + .../node_modules/semver/ranges/intersects.js | 7 + .../node_modules/semver/ranges/ltr.js | 4 + .../semver/ranges/max-satisfying.js | 25 + .../semver/ranges/min-satisfying.js | 24 + .../node_modules/semver/ranges/min-version.js | 60 + .../node_modules/semver/ranges/outside.js | 80 + .../node_modules/semver/ranges/simplify.js | 44 + .../node_modules/semver/ranges/subset.js | 222 + .../semver/ranges/to-comparators.js | 8 + .../node_modules/semver/ranges/valid.js | 11 + .../node_modules/update-notifier/package.json | 94 + server/node_modules/update-notifier/readme.md | 223 + server/node_modules/url-parse-lax/index.js | 12 + server/node_modules/url-parse-lax/license | 9 + .../node_modules/url-parse-lax/package.json | 74 + server/node_modules/url-parse-lax/readme.md | 127 + server/node_modules/util-deprecate/History.md | 16 + server/node_modules/util-deprecate/LICENSE | 24 + server/node_modules/util-deprecate/README.md | 53 + server/node_modules/util-deprecate/browser.js | 67 + server/node_modules/util-deprecate/node.js | 6 + .../node_modules/util-deprecate/package.json | 58 + server/node_modules/utils-merge/.npmignore | 9 + server/node_modules/utils-merge/LICENSE | 20 + server/node_modules/utils-merge/README.md | 34 + server/node_modules/utils-merge/index.js | 23 + server/node_modules/utils-merge/package.json | 66 + server/node_modules/vary/HISTORY.md | 39 + server/node_modules/vary/LICENSE | 22 + server/node_modules/vary/README.md | 101 + server/node_modules/vary/index.js | 149 + server/node_modules/vary/package.json | 78 + server/node_modules/wide-align/LICENSE | 14 + server/node_modules/wide-align/README.md | 47 + server/node_modules/wide-align/align.js | 65 + server/node_modules/wide-align/package.json | 66 + server/node_modules/widest-line/index.d.ts | 21 + server/node_modules/widest-line/index.js | 16 + server/node_modules/widest-line/license | 9 + server/node_modules/widest-line/package.json | 86 + server/node_modules/widest-line/readme.md | 34 + server/node_modules/wrap-ansi/index.js | 216 + server/node_modules/wrap-ansi/license | 9 + server/node_modules/wrap-ansi/package.json | 94 + server/node_modules/wrap-ansi/readme.md | 91 + server/node_modules/wrappy/LICENSE | 15 + server/node_modules/wrappy/README.md | 36 + server/node_modules/wrappy/package.json | 58 + server/node_modules/wrappy/wrappy.js | 33 + .../write-file-atomic/CHANGELOG.md | 32 + server/node_modules/write-file-atomic/LICENSE | 6 + .../node_modules/write-file-atomic/README.md | 72 + .../node_modules/write-file-atomic/index.js | 259 + .../write-file-atomic/package.json | 77 + server/node_modules/ws/LICENSE | 19 + server/node_modules/ws/README.md | 489 + server/node_modules/ws/browser.js | 8 + server/node_modules/ws/index.js | 13 + server/node_modules/ws/lib/buffer-util.js | 126 + server/node_modules/ws/lib/constants.js | 12 + server/node_modules/ws/lib/event-target.js | 266 + server/node_modules/ws/lib/extension.js | 203 + server/node_modules/ws/lib/limiter.js | 55 + .../node_modules/ws/lib/permessage-deflate.js | 511 + server/node_modules/ws/lib/receiver.js | 618 ++ server/node_modules/ws/lib/sender.js | 478 + server/node_modules/ws/lib/stream.js | 159 + server/node_modules/ws/lib/subprotocol.js | 62 + server/node_modules/ws/lib/validation.js | 124 + .../node_modules/ws/lib/websocket-server.js | 485 + server/node_modules/ws/lib/websocket.js | 1225 +++ server/node_modules/ws/package.json | 61 + server/node_modules/ws/wrapper.mjs | 8 + server/node_modules/xdg-basedir/index.d.ts | 81 + server/node_modules/xdg-basedir/index.js | 28 + server/node_modules/xdg-basedir/license | 9 + server/node_modules/xdg-basedir/package.json | 74 + server/node_modules/xdg-basedir/readme.md | 60 + server/node_modules/yallist/LICENSE | 15 + server/node_modules/yallist/README.md | 204 + server/node_modules/yallist/iterator.js | 8 + server/node_modules/yallist/package.json | 62 + server/node_modules/yallist/yallist.js | 426 + server/package-lock.json | 4231 ++++++++ server/package.json | 21 + 1738 files changed, 200760 insertions(+), 4 deletions(-) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/Arduino-Iot.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml rename chute.ino => chute/chute.ino (98%) create mode 100644 server/index.js create mode 120000 server/node_modules/.bin/detect-libc create mode 120000 server/node_modules/.bin/is-ci create mode 120000 server/node_modules/.bin/mime create mode 120000 server/node_modules/.bin/nodemon create mode 120000 server/node_modules/.bin/nodetouch create mode 120000 server/node_modules/.bin/nopt create mode 120000 server/node_modules/.bin/prebuild-install create mode 120000 server/node_modules/.bin/rc create mode 120000 server/node_modules/.bin/semver create mode 100644 server/node_modules/.package-lock.json create mode 100644 server/node_modules/@serialport/binding-abstract/CHANGELOG.md create mode 100644 server/node_modules/@serialport/binding-abstract/LICENSE create mode 100644 server/node_modules/@serialport/binding-abstract/README.md create mode 100644 server/node_modules/@serialport/binding-abstract/lib/index.js create mode 100644 server/node_modules/@serialport/binding-abstract/node_modules/debug/LICENSE create mode 100644 server/node_modules/@serialport/binding-abstract/node_modules/debug/README.md create mode 100644 server/node_modules/@serialport/binding-abstract/node_modules/debug/package.json create mode 100644 server/node_modules/@serialport/binding-abstract/node_modules/debug/src/browser.js create mode 100644 server/node_modules/@serialport/binding-abstract/node_modules/debug/src/common.js create mode 100644 server/node_modules/@serialport/binding-abstract/node_modules/debug/src/index.js create mode 100644 server/node_modules/@serialport/binding-abstract/node_modules/debug/src/node.js create mode 100644 server/node_modules/@serialport/binding-abstract/node_modules/ms/index.js create mode 100644 server/node_modules/@serialport/binding-abstract/node_modules/ms/license.md create mode 100644 server/node_modules/@serialport/binding-abstract/node_modules/ms/package.json create mode 100644 server/node_modules/@serialport/binding-abstract/node_modules/ms/readme.md create mode 100644 server/node_modules/@serialport/binding-abstract/package.json create mode 100644 server/node_modules/@serialport/binding-mock/CHANGELOG.md create mode 100644 server/node_modules/@serialport/binding-mock/LICENSE create mode 100644 server/node_modules/@serialport/binding-mock/README.md create mode 100644 server/node_modules/@serialport/binding-mock/lib/index.js create mode 100644 server/node_modules/@serialport/binding-mock/lib/legacy.js create mode 100644 server/node_modules/@serialport/binding-mock/node_modules/debug/LICENSE create mode 100644 server/node_modules/@serialport/binding-mock/node_modules/debug/README.md create mode 100644 server/node_modules/@serialport/binding-mock/node_modules/debug/package.json create mode 100644 server/node_modules/@serialport/binding-mock/node_modules/debug/src/browser.js create mode 100644 server/node_modules/@serialport/binding-mock/node_modules/debug/src/common.js create mode 100644 server/node_modules/@serialport/binding-mock/node_modules/debug/src/index.js create mode 100644 server/node_modules/@serialport/binding-mock/node_modules/debug/src/node.js create mode 100644 server/node_modules/@serialport/binding-mock/node_modules/ms/index.js create mode 100644 server/node_modules/@serialport/binding-mock/node_modules/ms/license.md create mode 100644 server/node_modules/@serialport/binding-mock/node_modules/ms/package.json create mode 100644 server/node_modules/@serialport/binding-mock/node_modules/ms/readme.md create mode 100644 server/node_modules/@serialport/binding-mock/package.json create mode 100644 server/node_modules/@serialport/bindings/.prebuild-installrc create mode 100644 server/node_modules/@serialport/bindings/LICENSE create mode 100644 server/node_modules/@serialport/bindings/README.md create mode 100644 server/node_modules/@serialport/bindings/binding.gyp create mode 100755 server/node_modules/@serialport/bindings/build/Release/bindings.node create mode 100644 server/node_modules/@serialport/bindings/lib/darwin.js create mode 100644 server/node_modules/@serialport/bindings/lib/index.js create mode 100644 server/node_modules/@serialport/bindings/lib/legacy.js create mode 100644 server/node_modules/@serialport/bindings/lib/linux-list.js create mode 100644 server/node_modules/@serialport/bindings/lib/linux.js create mode 100644 server/node_modules/@serialport/bindings/lib/poller.js create mode 100644 server/node_modules/@serialport/bindings/lib/unix-read.js create mode 100644 server/node_modules/@serialport/bindings/lib/unix-write.js create mode 100644 server/node_modules/@serialport/bindings/lib/win32-sn-parser.js create mode 100644 server/node_modules/@serialport/bindings/lib/win32.js create mode 100644 server/node_modules/@serialport/bindings/node_modules/debug/LICENSE create mode 100644 server/node_modules/@serialport/bindings/node_modules/debug/README.md create mode 100644 server/node_modules/@serialport/bindings/node_modules/debug/package.json create mode 100644 server/node_modules/@serialport/bindings/node_modules/debug/src/browser.js create mode 100644 server/node_modules/@serialport/bindings/node_modules/debug/src/common.js create mode 100644 server/node_modules/@serialport/bindings/node_modules/debug/src/index.js create mode 100644 server/node_modules/@serialport/bindings/node_modules/debug/src/node.js create mode 100644 server/node_modules/@serialport/bindings/node_modules/ms/index.js create mode 100644 server/node_modules/@serialport/bindings/node_modules/ms/license.md create mode 100644 server/node_modules/@serialport/bindings/node_modules/ms/package.json create mode 100644 server/node_modules/@serialport/bindings/node_modules/ms/readme.md create mode 100644 server/node_modules/@serialport/bindings/package.json create mode 100644 server/node_modules/@serialport/bindings/src/darwin_list.cpp create mode 100644 server/node_modules/@serialport/bindings/src/darwin_list.h create mode 100644 server/node_modules/@serialport/bindings/src/poller.cpp create mode 100644 server/node_modules/@serialport/bindings/src/poller.h create mode 100644 server/node_modules/@serialport/bindings/src/serialport.cpp create mode 100644 server/node_modules/@serialport/bindings/src/serialport.h create mode 100755 server/node_modules/@serialport/bindings/src/serialport_linux.cpp create mode 100755 server/node_modules/@serialport/bindings/src/serialport_linux.h create mode 100644 server/node_modules/@serialport/bindings/src/serialport_unix.cpp create mode 100644 server/node_modules/@serialport/bindings/src/serialport_unix.h create mode 100644 server/node_modules/@serialport/bindings/src/serialport_win.cpp create mode 100644 server/node_modules/@serialport/bindings/src/serialport_win.h create mode 100644 server/node_modules/@serialport/parser-byte-length/CHANGELOG.md create mode 100644 server/node_modules/@serialport/parser-byte-length/LICENSE create mode 100644 server/node_modules/@serialport/parser-byte-length/README.md create mode 100644 server/node_modules/@serialport/parser-byte-length/lib/index.js create mode 100644 server/node_modules/@serialport/parser-byte-length/package.json create mode 100644 server/node_modules/@serialport/parser-cctalk/CHANGELOG.md create mode 100644 server/node_modules/@serialport/parser-cctalk/LICENSE create mode 100644 server/node_modules/@serialport/parser-cctalk/README.md create mode 100644 server/node_modules/@serialport/parser-cctalk/lib/index.js create mode 100644 server/node_modules/@serialport/parser-cctalk/package.json create mode 100644 server/node_modules/@serialport/parser-delimiter/CHANGELOG.md create mode 100644 server/node_modules/@serialport/parser-delimiter/LICENSE create mode 100644 server/node_modules/@serialport/parser-delimiter/README.md create mode 100644 server/node_modules/@serialport/parser-delimiter/lib/index.js create mode 100644 server/node_modules/@serialport/parser-delimiter/package.json create mode 100644 server/node_modules/@serialport/parser-inter-byte-timeout/CHANGELOG.md create mode 100644 server/node_modules/@serialport/parser-inter-byte-timeout/LICENSE create mode 100644 server/node_modules/@serialport/parser-inter-byte-timeout/README.md create mode 100644 server/node_modules/@serialport/parser-inter-byte-timeout/lib/index.js create mode 100644 server/node_modules/@serialport/parser-inter-byte-timeout/package.json create mode 100644 server/node_modules/@serialport/parser-readline/CHANGELOG.md create mode 100644 server/node_modules/@serialport/parser-readline/LICENSE create mode 100644 server/node_modules/@serialport/parser-readline/README.md create mode 100644 server/node_modules/@serialport/parser-readline/lib/index.js create mode 100644 server/node_modules/@serialport/parser-readline/package.json create mode 100644 server/node_modules/@serialport/parser-ready/CHANGELOG.md create mode 100644 server/node_modules/@serialport/parser-ready/LICENSE create mode 100644 server/node_modules/@serialport/parser-ready/README.md create mode 100644 server/node_modules/@serialport/parser-ready/lib/index.js create mode 100644 server/node_modules/@serialport/parser-ready/package.json create mode 100644 server/node_modules/@serialport/parser-regex/CHANGELOG.md create mode 100644 server/node_modules/@serialport/parser-regex/LICENSE create mode 100644 server/node_modules/@serialport/parser-regex/README.md create mode 100644 server/node_modules/@serialport/parser-regex/lib/index.js create mode 100644 server/node_modules/@serialport/parser-regex/package.json create mode 100644 server/node_modules/@serialport/stream/CHANGELOG.md create mode 100644 server/node_modules/@serialport/stream/LICENSE create mode 100644 server/node_modules/@serialport/stream/README.md create mode 100644 server/node_modules/@serialport/stream/lib/index.js create mode 100644 server/node_modules/@serialport/stream/node_modules/debug/LICENSE create mode 100644 server/node_modules/@serialport/stream/node_modules/debug/README.md create mode 100644 server/node_modules/@serialport/stream/node_modules/debug/package.json create mode 100644 server/node_modules/@serialport/stream/node_modules/debug/src/browser.js create mode 100644 server/node_modules/@serialport/stream/node_modules/debug/src/common.js create mode 100644 server/node_modules/@serialport/stream/node_modules/debug/src/index.js create mode 100644 server/node_modules/@serialport/stream/node_modules/debug/src/node.js create mode 100644 server/node_modules/@serialport/stream/node_modules/ms/index.js create mode 100644 server/node_modules/@serialport/stream/node_modules/ms/license.md create mode 100644 server/node_modules/@serialport/stream/node_modules/ms/package.json create mode 100644 server/node_modules/@serialport/stream/node_modules/ms/readme.md create mode 100644 server/node_modules/@serialport/stream/package.json create mode 100644 server/node_modules/@sindresorhus/is/dist/index.d.ts create mode 100644 server/node_modules/@sindresorhus/is/dist/index.js create mode 100644 server/node_modules/@sindresorhus/is/dist/index.js.map create mode 100644 server/node_modules/@sindresorhus/is/license create mode 100644 server/node_modules/@sindresorhus/is/package.json create mode 100644 server/node_modules/@sindresorhus/is/readme.md create mode 100755 server/node_modules/@szmarczak/http-timer/LICENSE create mode 100755 server/node_modules/@szmarczak/http-timer/README.md create mode 100755 server/node_modules/@szmarczak/http-timer/package.json create mode 100755 server/node_modules/@szmarczak/http-timer/source/index.js create mode 100644 server/node_modules/abbrev/LICENSE create mode 100644 server/node_modules/abbrev/README.md create mode 100644 server/node_modules/abbrev/abbrev.js create mode 100644 server/node_modules/abbrev/package.json create mode 100644 server/node_modules/accepts/HISTORY.md create mode 100644 server/node_modules/accepts/LICENSE create mode 100644 server/node_modules/accepts/README.md create mode 100644 server/node_modules/accepts/index.js create mode 100644 server/node_modules/accepts/package.json create mode 100644 server/node_modules/ansi-align/CHANGELOG.md create mode 100644 server/node_modules/ansi-align/LICENSE create mode 100644 server/node_modules/ansi-align/README.md create mode 100644 server/node_modules/ansi-align/index.js create mode 100644 server/node_modules/ansi-align/package.json create mode 100644 server/node_modules/ansi-regex/index.d.ts create mode 100644 server/node_modules/ansi-regex/index.js create mode 100644 server/node_modules/ansi-regex/license create mode 100644 server/node_modules/ansi-regex/package.json create mode 100644 server/node_modules/ansi-regex/readme.md create mode 100644 server/node_modules/ansi-styles/index.d.ts create mode 100644 server/node_modules/ansi-styles/index.js create mode 100644 server/node_modules/ansi-styles/license create mode 100644 server/node_modules/ansi-styles/package.json create mode 100644 server/node_modules/ansi-styles/readme.md create mode 100644 server/node_modules/anymatch/LICENSE create mode 100644 server/node_modules/anymatch/README.md create mode 100644 server/node_modules/anymatch/index.d.ts create mode 100644 server/node_modules/anymatch/index.js create mode 100644 server/node_modules/anymatch/package.json create mode 100644 server/node_modules/aproba/LICENSE create mode 100644 server/node_modules/aproba/README.md create mode 100644 server/node_modules/aproba/index.js create mode 100644 server/node_modules/aproba/package.json create mode 100644 server/node_modules/are-we-there-yet/CHANGES.md create mode 100644 server/node_modules/are-we-there-yet/LICENSE create mode 100644 server/node_modules/are-we-there-yet/README.md create mode 100644 server/node_modules/are-we-there-yet/index.js create mode 100644 server/node_modules/are-we-there-yet/package.json create mode 100644 server/node_modules/are-we-there-yet/tracker-base.js create mode 100644 server/node_modules/are-we-there-yet/tracker-group.js create mode 100644 server/node_modules/are-we-there-yet/tracker-stream.js create mode 100644 server/node_modules/are-we-there-yet/tracker.js create mode 100644 server/node_modules/array-flatten/LICENSE create mode 100644 server/node_modules/array-flatten/README.md create mode 100644 server/node_modules/array-flatten/array-flatten.js create mode 100644 server/node_modules/array-flatten/package.json create mode 100644 server/node_modules/balanced-match/.github/FUNDING.yml create mode 100644 server/node_modules/balanced-match/LICENSE.md create mode 100644 server/node_modules/balanced-match/README.md create mode 100644 server/node_modules/balanced-match/index.js create mode 100644 server/node_modules/balanced-match/package.json create mode 100644 server/node_modules/base64-js/LICENSE create mode 100644 server/node_modules/base64-js/README.md create mode 100644 server/node_modules/base64-js/base64js.min.js create mode 100644 server/node_modules/base64-js/index.d.ts create mode 100644 server/node_modules/base64-js/index.js create mode 100644 server/node_modules/base64-js/package.json create mode 100644 server/node_modules/binary-extensions/binary-extensions.json create mode 100644 server/node_modules/binary-extensions/binary-extensions.json.d.ts create mode 100644 server/node_modules/binary-extensions/index.d.ts create mode 100644 server/node_modules/binary-extensions/index.js create mode 100644 server/node_modules/binary-extensions/license create mode 100644 server/node_modules/binary-extensions/package.json create mode 100644 server/node_modules/binary-extensions/readme.md create mode 100644 server/node_modules/bindings/LICENSE.md create mode 100644 server/node_modules/bindings/README.md create mode 100644 server/node_modules/bindings/bindings.js create mode 100644 server/node_modules/bindings/package.json create mode 100644 server/node_modules/bl/.travis.yml create mode 100644 server/node_modules/bl/BufferList.js create mode 100644 server/node_modules/bl/LICENSE.md create mode 100644 server/node_modules/bl/README.md create mode 100644 server/node_modules/bl/bl.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/CONTRIBUTING.md create mode 100644 server/node_modules/bl/node_modules/readable-stream/GOVERNANCE.md create mode 100644 server/node_modules/bl/node_modules/readable-stream/LICENSE create mode 100644 server/node_modules/bl/node_modules/readable-stream/README.md create mode 100644 server/node_modules/bl/node_modules/readable-stream/errors-browser.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/errors.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/experimentalWarning.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/async_iterator.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/buffer_list.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/destroy.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/end-of-stream.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/from-browser.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/from.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/pipeline.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/state.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/stream-browser.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/stream.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/package.json create mode 100644 server/node_modules/bl/node_modules/readable-stream/readable-browser.js create mode 100644 server/node_modules/bl/node_modules/readable-stream/readable.js create mode 100644 server/node_modules/bl/package.json create mode 100644 server/node_modules/bl/test/convert.js create mode 100644 server/node_modules/bl/test/indexOf.js create mode 100644 server/node_modules/bl/test/isBufferList.js create mode 100644 server/node_modules/bl/test/test.js create mode 100644 server/node_modules/body-parser/HISTORY.md create mode 100644 server/node_modules/body-parser/LICENSE create mode 100644 server/node_modules/body-parser/README.md create mode 100644 server/node_modules/body-parser/index.js create mode 100644 server/node_modules/body-parser/lib/read.js create mode 100644 server/node_modules/body-parser/lib/types/json.js create mode 100644 server/node_modules/body-parser/lib/types/raw.js create mode 100644 server/node_modules/body-parser/lib/types/text.js create mode 100644 server/node_modules/body-parser/lib/types/urlencoded.js create mode 100644 server/node_modules/body-parser/package.json create mode 100644 server/node_modules/boxen/index.d.ts create mode 100644 server/node_modules/boxen/index.js create mode 100644 server/node_modules/boxen/license create mode 100644 server/node_modules/boxen/package.json create mode 100644 server/node_modules/boxen/readme.md create mode 100644 server/node_modules/brace-expansion/LICENSE create mode 100644 server/node_modules/brace-expansion/README.md create mode 100644 server/node_modules/brace-expansion/index.js create mode 100644 server/node_modules/brace-expansion/package.json create mode 100644 server/node_modules/braces/CHANGELOG.md create mode 100644 server/node_modules/braces/LICENSE create mode 100644 server/node_modules/braces/README.md create mode 100644 server/node_modules/braces/index.js create mode 100644 server/node_modules/braces/lib/compile.js create mode 100644 server/node_modules/braces/lib/constants.js create mode 100644 server/node_modules/braces/lib/expand.js create mode 100644 server/node_modules/braces/lib/parse.js create mode 100644 server/node_modules/braces/lib/stringify.js create mode 100644 server/node_modules/braces/lib/utils.js create mode 100644 server/node_modules/braces/package.json create mode 100644 server/node_modules/buffer/AUTHORS.md create mode 100644 server/node_modules/buffer/LICENSE create mode 100644 server/node_modules/buffer/README.md create mode 100644 server/node_modules/buffer/index.d.ts create mode 100644 server/node_modules/buffer/index.js create mode 100644 server/node_modules/buffer/package.json create mode 100644 server/node_modules/bytes/History.md create mode 100644 server/node_modules/bytes/LICENSE create mode 100644 server/node_modules/bytes/Readme.md create mode 100644 server/node_modules/bytes/index.js create mode 100644 server/node_modules/bytes/package.json create mode 100644 server/node_modules/cacheable-request/LICENSE create mode 100644 server/node_modules/cacheable-request/README.md create mode 100644 server/node_modules/cacheable-request/node_modules/get-stream/buffer-stream.js create mode 100644 server/node_modules/cacheable-request/node_modules/get-stream/index.d.ts create mode 100644 server/node_modules/cacheable-request/node_modules/get-stream/index.js create mode 100644 server/node_modules/cacheable-request/node_modules/get-stream/license create mode 100644 server/node_modules/cacheable-request/node_modules/get-stream/package.json create mode 100644 server/node_modules/cacheable-request/node_modules/get-stream/readme.md create mode 100644 server/node_modules/cacheable-request/node_modules/lowercase-keys/index.d.ts create mode 100644 server/node_modules/cacheable-request/node_modules/lowercase-keys/index.js create mode 100644 server/node_modules/cacheable-request/node_modules/lowercase-keys/license create mode 100644 server/node_modules/cacheable-request/node_modules/lowercase-keys/package.json create mode 100644 server/node_modules/cacheable-request/node_modules/lowercase-keys/readme.md create mode 100644 server/node_modules/cacheable-request/package.json create mode 100644 server/node_modules/cacheable-request/src/index.js create mode 100644 server/node_modules/camelcase/index.d.ts create mode 100644 server/node_modules/camelcase/index.js create mode 100644 server/node_modules/camelcase/license create mode 100644 server/node_modules/camelcase/package.json create mode 100644 server/node_modules/camelcase/readme.md create mode 100644 server/node_modules/chalk/index.d.ts create mode 100644 server/node_modules/chalk/license create mode 100644 server/node_modules/chalk/node_modules/has-flag/index.d.ts create mode 100644 server/node_modules/chalk/node_modules/has-flag/index.js create mode 100644 server/node_modules/chalk/node_modules/has-flag/license create mode 100644 server/node_modules/chalk/node_modules/has-flag/package.json create mode 100644 server/node_modules/chalk/node_modules/has-flag/readme.md create mode 100644 server/node_modules/chalk/node_modules/supports-color/browser.js create mode 100644 server/node_modules/chalk/node_modules/supports-color/index.js create mode 100644 server/node_modules/chalk/node_modules/supports-color/license create mode 100644 server/node_modules/chalk/node_modules/supports-color/package.json create mode 100644 server/node_modules/chalk/node_modules/supports-color/readme.md create mode 100644 server/node_modules/chalk/package.json create mode 100644 server/node_modules/chalk/readme.md create mode 100644 server/node_modules/chalk/source/index.js create mode 100644 server/node_modules/chalk/source/templates.js create mode 100644 server/node_modules/chalk/source/util.js create mode 100644 server/node_modules/chokidar/LICENSE create mode 100644 server/node_modules/chokidar/README.md create mode 100644 server/node_modules/chokidar/index.js create mode 100644 server/node_modules/chokidar/lib/constants.js create mode 100644 server/node_modules/chokidar/lib/fsevents-handler.js create mode 100644 server/node_modules/chokidar/lib/nodefs-handler.js create mode 100644 server/node_modules/chokidar/package.json create mode 100644 server/node_modules/chokidar/types/index.d.ts create mode 100644 server/node_modules/chownr/LICENSE create mode 100644 server/node_modules/chownr/README.md create mode 100644 server/node_modules/chownr/chownr.js create mode 100644 server/node_modules/chownr/package.json create mode 100644 server/node_modules/ci-info/CHANGELOG.md create mode 100644 server/node_modules/ci-info/LICENSE create mode 100644 server/node_modules/ci-info/README.md create mode 100644 server/node_modules/ci-info/index.js create mode 100644 server/node_modules/ci-info/package.json create mode 100644 server/node_modules/ci-info/vendors.json create mode 100644 server/node_modules/cli-boxes/boxes.json create mode 100644 server/node_modules/cli-boxes/index.d.ts create mode 100644 server/node_modules/cli-boxes/index.js create mode 100644 server/node_modules/cli-boxes/license create mode 100644 server/node_modules/cli-boxes/package.json create mode 100644 server/node_modules/cli-boxes/readme.md create mode 100644 server/node_modules/clone-response/LICENSE create mode 100644 server/node_modules/clone-response/README.md create mode 100644 server/node_modules/clone-response/package.json create mode 100644 server/node_modules/clone-response/src/index.js create mode 100644 server/node_modules/code-point-at/index.js create mode 100644 server/node_modules/code-point-at/license create mode 100644 server/node_modules/code-point-at/package.json create mode 100644 server/node_modules/code-point-at/readme.md create mode 100644 server/node_modules/color-convert/CHANGELOG.md create mode 100644 server/node_modules/color-convert/LICENSE create mode 100644 server/node_modules/color-convert/README.md create mode 100644 server/node_modules/color-convert/conversions.js create mode 100644 server/node_modules/color-convert/index.js create mode 100644 server/node_modules/color-convert/package.json create mode 100644 server/node_modules/color-convert/route.js create mode 100644 server/node_modules/color-name/LICENSE create mode 100644 server/node_modules/color-name/README.md create mode 100644 server/node_modules/color-name/index.js create mode 100644 server/node_modules/color-name/package.json create mode 100644 server/node_modules/concat-map/.travis.yml create mode 100644 server/node_modules/concat-map/LICENSE create mode 100644 server/node_modules/concat-map/README.markdown create mode 100644 server/node_modules/concat-map/example/map.js create mode 100644 server/node_modules/concat-map/index.js create mode 100644 server/node_modules/concat-map/package.json create mode 100644 server/node_modules/concat-map/test/map.js create mode 100644 server/node_modules/configstore/index.js create mode 100644 server/node_modules/configstore/license create mode 100644 server/node_modules/configstore/package.json create mode 100644 server/node_modules/configstore/readme.md create mode 100644 server/node_modules/console-control-strings/LICENSE create mode 100644 server/node_modules/console-control-strings/README.md create mode 100644 server/node_modules/console-control-strings/README.md~ create mode 100644 server/node_modules/console-control-strings/index.js create mode 100644 server/node_modules/console-control-strings/package.json create mode 100644 server/node_modules/content-disposition/HISTORY.md create mode 100644 server/node_modules/content-disposition/LICENSE create mode 100644 server/node_modules/content-disposition/README.md create mode 100644 server/node_modules/content-disposition/index.js create mode 100644 server/node_modules/content-disposition/package.json create mode 100644 server/node_modules/content-type/HISTORY.md create mode 100644 server/node_modules/content-type/LICENSE create mode 100644 server/node_modules/content-type/README.md create mode 100644 server/node_modules/content-type/index.js create mode 100644 server/node_modules/content-type/package.json create mode 100644 server/node_modules/cookie-signature/.npmignore create mode 100644 server/node_modules/cookie-signature/History.md create mode 100644 server/node_modules/cookie-signature/Readme.md create mode 100644 server/node_modules/cookie-signature/index.js create mode 100644 server/node_modules/cookie-signature/package.json create mode 100644 server/node_modules/cookie/HISTORY.md create mode 100644 server/node_modules/cookie/LICENSE create mode 100644 server/node_modules/cookie/README.md create mode 100644 server/node_modules/cookie/index.js create mode 100644 server/node_modules/cookie/package.json create mode 100644 server/node_modules/core-util-is/LICENSE create mode 100644 server/node_modules/core-util-is/README.md create mode 100644 server/node_modules/core-util-is/lib/util.js create mode 100644 server/node_modules/core-util-is/package.json create mode 100644 server/node_modules/crypto-random-string/index.d.ts create mode 100644 server/node_modules/crypto-random-string/index.js create mode 100644 server/node_modules/crypto-random-string/license create mode 100644 server/node_modules/crypto-random-string/package.json create mode 100644 server/node_modules/crypto-random-string/readme.md create mode 100644 server/node_modules/debug/.coveralls.yml create mode 100644 server/node_modules/debug/.eslintrc create mode 100644 server/node_modules/debug/.npmignore create mode 100644 server/node_modules/debug/.travis.yml create mode 100644 server/node_modules/debug/CHANGELOG.md create mode 100644 server/node_modules/debug/LICENSE create mode 100644 server/node_modules/debug/Makefile create mode 100644 server/node_modules/debug/README.md create mode 100644 server/node_modules/debug/component.json create mode 100644 server/node_modules/debug/karma.conf.js create mode 100644 server/node_modules/debug/node.js create mode 100644 server/node_modules/debug/package.json create mode 100644 server/node_modules/debug/src/browser.js create mode 100644 server/node_modules/debug/src/debug.js create mode 100644 server/node_modules/debug/src/index.js create mode 100644 server/node_modules/debug/src/inspector-log.js create mode 100644 server/node_modules/debug/src/node.js create mode 100644 server/node_modules/decompress-response/index.js create mode 100644 server/node_modules/decompress-response/license create mode 100644 server/node_modules/decompress-response/package.json create mode 100644 server/node_modules/decompress-response/readme.md create mode 100644 server/node_modules/deep-extend/CHANGELOG.md create mode 100644 server/node_modules/deep-extend/LICENSE create mode 100644 server/node_modules/deep-extend/README.md create mode 100644 server/node_modules/deep-extend/index.js create mode 100644 server/node_modules/deep-extend/lib/deep-extend.js create mode 100644 server/node_modules/deep-extend/package.json create mode 100644 server/node_modules/defer-to-connect/LICENSE create mode 100644 server/node_modules/defer-to-connect/README.md create mode 100644 server/node_modules/defer-to-connect/dist/index.d.ts create mode 100644 server/node_modules/defer-to-connect/dist/index.js create mode 100644 server/node_modules/defer-to-connect/package.json create mode 100644 server/node_modules/delegates/.npmignore create mode 100644 server/node_modules/delegates/History.md create mode 100644 server/node_modules/delegates/License create mode 100644 server/node_modules/delegates/Makefile create mode 100644 server/node_modules/delegates/Readme.md create mode 100644 server/node_modules/delegates/index.js create mode 100644 server/node_modules/delegates/package.json create mode 100644 server/node_modules/delegates/test/index.js create mode 100644 server/node_modules/depd/History.md create mode 100644 server/node_modules/depd/LICENSE create mode 100644 server/node_modules/depd/Readme.md create mode 100644 server/node_modules/depd/index.js create mode 100644 server/node_modules/depd/lib/browser/index.js create mode 100644 server/node_modules/depd/lib/compat/callsite-tostring.js create mode 100644 server/node_modules/depd/lib/compat/event-listener-count.js create mode 100644 server/node_modules/depd/lib/compat/index.js create mode 100644 server/node_modules/depd/package.json create mode 100644 server/node_modules/destroy/LICENSE create mode 100644 server/node_modules/destroy/README.md create mode 100644 server/node_modules/destroy/index.js create mode 100644 server/node_modules/destroy/package.json create mode 100644 server/node_modules/detect-libc/.npmignore create mode 100644 server/node_modules/detect-libc/LICENSE create mode 100644 server/node_modules/detect-libc/README.md create mode 100755 server/node_modules/detect-libc/bin/detect-libc.js create mode 100644 server/node_modules/detect-libc/lib/detect-libc.js create mode 100644 server/node_modules/detect-libc/package.json create mode 100644 server/node_modules/dot-prop/index.d.ts create mode 100644 server/node_modules/dot-prop/index.js create mode 100644 server/node_modules/dot-prop/license create mode 100644 server/node_modules/dot-prop/package.json create mode 100644 server/node_modules/dot-prop/readme.md create mode 100644 server/node_modules/duplexer3/LICENSE.md create mode 100644 server/node_modules/duplexer3/README.md create mode 100644 server/node_modules/duplexer3/index.js create mode 100644 server/node_modules/duplexer3/package.json create mode 100644 server/node_modules/ee-first/LICENSE create mode 100644 server/node_modules/ee-first/README.md create mode 100644 server/node_modules/ee-first/index.js create mode 100644 server/node_modules/ee-first/package.json create mode 100644 server/node_modules/emoji-regex/LICENSE-MIT.txt create mode 100644 server/node_modules/emoji-regex/README.md create mode 100644 server/node_modules/emoji-regex/es2015/index.js create mode 100644 server/node_modules/emoji-regex/es2015/text.js create mode 100644 server/node_modules/emoji-regex/index.d.ts create mode 100644 server/node_modules/emoji-regex/index.js create mode 100644 server/node_modules/emoji-regex/package.json create mode 100644 server/node_modules/emoji-regex/text.js create mode 100644 server/node_modules/encodeurl/HISTORY.md create mode 100644 server/node_modules/encodeurl/LICENSE create mode 100644 server/node_modules/encodeurl/README.md create mode 100644 server/node_modules/encodeurl/index.js create mode 100644 server/node_modules/encodeurl/package.json create mode 100644 server/node_modules/end-of-stream/LICENSE create mode 100644 server/node_modules/end-of-stream/README.md create mode 100644 server/node_modules/end-of-stream/index.js create mode 100644 server/node_modules/end-of-stream/package.json create mode 100644 server/node_modules/escape-goat/index.d.ts create mode 100644 server/node_modules/escape-goat/index.js create mode 100644 server/node_modules/escape-goat/license create mode 100644 server/node_modules/escape-goat/package.json create mode 100644 server/node_modules/escape-goat/readme.md create mode 100644 server/node_modules/escape-html/LICENSE create mode 100644 server/node_modules/escape-html/Readme.md create mode 100644 server/node_modules/escape-html/index.js create mode 100644 server/node_modules/escape-html/package.json create mode 100644 server/node_modules/etag/HISTORY.md create mode 100644 server/node_modules/etag/LICENSE create mode 100644 server/node_modules/etag/README.md create mode 100644 server/node_modules/etag/index.js create mode 100644 server/node_modules/etag/package.json create mode 100644 server/node_modules/expand-template/.travis.yml create mode 100644 server/node_modules/expand-template/LICENSE create mode 100644 server/node_modules/expand-template/README.md create mode 100644 server/node_modules/expand-template/index.js create mode 100644 server/node_modules/expand-template/package.json create mode 100644 server/node_modules/expand-template/test.js create mode 100644 server/node_modules/express/History.md create mode 100644 server/node_modules/express/LICENSE create mode 100644 server/node_modules/express/Readme.md create mode 100644 server/node_modules/express/index.js create mode 100644 server/node_modules/express/lib/application.js create mode 100644 server/node_modules/express/lib/express.js create mode 100644 server/node_modules/express/lib/middleware/init.js create mode 100644 server/node_modules/express/lib/middleware/query.js create mode 100644 server/node_modules/express/lib/request.js create mode 100644 server/node_modules/express/lib/response.js create mode 100644 server/node_modules/express/lib/router/index.js create mode 100644 server/node_modules/express/lib/router/layer.js create mode 100644 server/node_modules/express/lib/router/route.js create mode 100644 server/node_modules/express/lib/utils.js create mode 100644 server/node_modules/express/lib/view.js create mode 100644 server/node_modules/express/package.json create mode 100644 server/node_modules/file-uri-to-path/.npmignore create mode 100644 server/node_modules/file-uri-to-path/.travis.yml create mode 100644 server/node_modules/file-uri-to-path/History.md create mode 100644 server/node_modules/file-uri-to-path/LICENSE create mode 100644 server/node_modules/file-uri-to-path/README.md create mode 100644 server/node_modules/file-uri-to-path/index.d.ts create mode 100644 server/node_modules/file-uri-to-path/index.js create mode 100644 server/node_modules/file-uri-to-path/package.json create mode 100644 server/node_modules/file-uri-to-path/test/test.js create mode 100644 server/node_modules/file-uri-to-path/test/tests.json create mode 100644 server/node_modules/fill-range/LICENSE create mode 100644 server/node_modules/fill-range/README.md create mode 100644 server/node_modules/fill-range/index.js create mode 100644 server/node_modules/fill-range/package.json create mode 100644 server/node_modules/finalhandler/HISTORY.md create mode 100644 server/node_modules/finalhandler/LICENSE create mode 100644 server/node_modules/finalhandler/README.md create mode 100644 server/node_modules/finalhandler/index.js create mode 100644 server/node_modules/finalhandler/package.json create mode 100644 server/node_modules/forwarded/HISTORY.md create mode 100644 server/node_modules/forwarded/LICENSE create mode 100644 server/node_modules/forwarded/README.md create mode 100644 server/node_modules/forwarded/index.js create mode 100644 server/node_modules/forwarded/package.json create mode 100644 server/node_modules/fresh/HISTORY.md create mode 100644 server/node_modules/fresh/LICENSE create mode 100644 server/node_modules/fresh/README.md create mode 100644 server/node_modules/fresh/index.js create mode 100644 server/node_modules/fresh/package.json create mode 100644 server/node_modules/fs-constants/LICENSE create mode 100644 server/node_modules/fs-constants/README.md create mode 100644 server/node_modules/fs-constants/browser.js create mode 100644 server/node_modules/fs-constants/index.js create mode 100644 server/node_modules/fs-constants/package.json create mode 100644 server/node_modules/gauge/CHANGELOG.md create mode 100644 server/node_modules/gauge/LICENSE create mode 100644 server/node_modules/gauge/README.md create mode 100644 server/node_modules/gauge/base-theme.js create mode 100644 server/node_modules/gauge/error.js create mode 100644 server/node_modules/gauge/has-color.js create mode 100644 server/node_modules/gauge/index.js create mode 100644 server/node_modules/gauge/node_modules/ansi-regex/index.js create mode 100644 server/node_modules/gauge/node_modules/ansi-regex/license create mode 100644 server/node_modules/gauge/node_modules/ansi-regex/package.json create mode 100644 server/node_modules/gauge/node_modules/ansi-regex/readme.md create mode 100644 server/node_modules/gauge/node_modules/is-fullwidth-code-point/index.js create mode 100644 server/node_modules/gauge/node_modules/is-fullwidth-code-point/license create mode 100644 server/node_modules/gauge/node_modules/is-fullwidth-code-point/package.json create mode 100644 server/node_modules/gauge/node_modules/is-fullwidth-code-point/readme.md create mode 100644 server/node_modules/gauge/node_modules/string-width/index.js create mode 100644 server/node_modules/gauge/node_modules/string-width/license create mode 100644 server/node_modules/gauge/node_modules/string-width/package.json create mode 100644 server/node_modules/gauge/node_modules/string-width/readme.md create mode 100644 server/node_modules/gauge/node_modules/strip-ansi/index.js create mode 100644 server/node_modules/gauge/node_modules/strip-ansi/license create mode 100644 server/node_modules/gauge/node_modules/strip-ansi/package.json create mode 100644 server/node_modules/gauge/node_modules/strip-ansi/readme.md create mode 100644 server/node_modules/gauge/package.json create mode 100644 server/node_modules/gauge/plumbing.js create mode 100644 server/node_modules/gauge/process.js create mode 100644 server/node_modules/gauge/progress-bar.js create mode 100644 server/node_modules/gauge/render-template.js create mode 100644 server/node_modules/gauge/set-immediate.js create mode 100644 server/node_modules/gauge/set-interval.js create mode 100644 server/node_modules/gauge/spin.js create mode 100644 server/node_modules/gauge/template-item.js create mode 100644 server/node_modules/gauge/theme-set.js create mode 100644 server/node_modules/gauge/themes.js create mode 100644 server/node_modules/gauge/wide-truncate.js create mode 100644 server/node_modules/get-stream/buffer-stream.js create mode 100644 server/node_modules/get-stream/index.js create mode 100644 server/node_modules/get-stream/license create mode 100644 server/node_modules/get-stream/package.json create mode 100644 server/node_modules/get-stream/readme.md create mode 100644 server/node_modules/github-from-package/.travis.yml create mode 100644 server/node_modules/github-from-package/LICENSE create mode 100644 server/node_modules/github-from-package/example/package.json create mode 100644 server/node_modules/github-from-package/example/url.js create mode 100644 server/node_modules/github-from-package/index.js create mode 100644 server/node_modules/github-from-package/package.json create mode 100644 server/node_modules/github-from-package/readme.markdown create mode 100644 server/node_modules/github-from-package/test/a.json create mode 100644 server/node_modules/github-from-package/test/b.json create mode 100644 server/node_modules/github-from-package/test/c.json create mode 100644 server/node_modules/github-from-package/test/d.json create mode 100644 server/node_modules/github-from-package/test/e.json create mode 100644 server/node_modules/github-from-package/test/url.js create mode 100644 server/node_modules/glob-parent/CHANGELOG.md create mode 100644 server/node_modules/glob-parent/LICENSE create mode 100644 server/node_modules/glob-parent/README.md create mode 100644 server/node_modules/glob-parent/index.js create mode 100644 server/node_modules/glob-parent/package.json create mode 100644 server/node_modules/global-dirs/index.d.ts create mode 100644 server/node_modules/global-dirs/index.js create mode 100644 server/node_modules/global-dirs/license create mode 100644 server/node_modules/global-dirs/package.json create mode 100644 server/node_modules/global-dirs/readme.md create mode 100644 server/node_modules/got/license create mode 100644 server/node_modules/got/package.json create mode 100644 server/node_modules/got/readme.md create mode 100644 server/node_modules/got/source/as-promise.js create mode 100644 server/node_modules/got/source/as-stream.js create mode 100644 server/node_modules/got/source/create.js create mode 100644 server/node_modules/got/source/errors.js create mode 100644 server/node_modules/got/source/get-response.js create mode 100644 server/node_modules/got/source/index.js create mode 100644 server/node_modules/got/source/known-hook-events.js create mode 100644 server/node_modules/got/source/merge.js create mode 100644 server/node_modules/got/source/normalize-arguments.js create mode 100644 server/node_modules/got/source/progress.js create mode 100644 server/node_modules/got/source/request-as-event-emitter.js create mode 100644 server/node_modules/got/source/utils/deep-freeze.js create mode 100644 server/node_modules/got/source/utils/get-body-size.js create mode 100644 server/node_modules/got/source/utils/is-form-data.js create mode 100644 server/node_modules/got/source/utils/timed-out.js create mode 100644 server/node_modules/got/source/utils/url-to-options.js create mode 100644 server/node_modules/graceful-fs/LICENSE create mode 100644 server/node_modules/graceful-fs/README.md create mode 100644 server/node_modules/graceful-fs/clone.js create mode 100644 server/node_modules/graceful-fs/graceful-fs.js create mode 100644 server/node_modules/graceful-fs/legacy-streams.js create mode 100644 server/node_modules/graceful-fs/package.json create mode 100644 server/node_modules/graceful-fs/polyfills.js create mode 100644 server/node_modules/has-flag/index.js create mode 100644 server/node_modules/has-flag/license create mode 100644 server/node_modules/has-flag/package.json create mode 100644 server/node_modules/has-flag/readme.md create mode 100644 server/node_modules/has-unicode/LICENSE create mode 100644 server/node_modules/has-unicode/README.md create mode 100644 server/node_modules/has-unicode/index.js create mode 100644 server/node_modules/has-unicode/package.json create mode 100644 server/node_modules/has-yarn/index.d.ts create mode 100644 server/node_modules/has-yarn/index.js create mode 100644 server/node_modules/has-yarn/license create mode 100644 server/node_modules/has-yarn/package.json create mode 100644 server/node_modules/has-yarn/readme.md create mode 100644 server/node_modules/http-cache-semantics/LICENSE create mode 100644 server/node_modules/http-cache-semantics/README.md create mode 100644 server/node_modules/http-cache-semantics/index.js create mode 100644 server/node_modules/http-cache-semantics/package.json create mode 100644 server/node_modules/http-errors/HISTORY.md create mode 100644 server/node_modules/http-errors/LICENSE create mode 100644 server/node_modules/http-errors/README.md create mode 100644 server/node_modules/http-errors/index.js create mode 100644 server/node_modules/http-errors/package.json create mode 100644 server/node_modules/iconv-lite/Changelog.md create mode 100644 server/node_modules/iconv-lite/LICENSE create mode 100644 server/node_modules/iconv-lite/README.md create mode 100644 server/node_modules/iconv-lite/encodings/dbcs-codec.js create mode 100644 server/node_modules/iconv-lite/encodings/dbcs-data.js create mode 100644 server/node_modules/iconv-lite/encodings/index.js create mode 100644 server/node_modules/iconv-lite/encodings/internal.js create mode 100644 server/node_modules/iconv-lite/encodings/sbcs-codec.js create mode 100644 server/node_modules/iconv-lite/encodings/sbcs-data-generated.js create mode 100644 server/node_modules/iconv-lite/encodings/sbcs-data.js create mode 100644 server/node_modules/iconv-lite/encodings/tables/big5-added.json create mode 100644 server/node_modules/iconv-lite/encodings/tables/cp936.json create mode 100644 server/node_modules/iconv-lite/encodings/tables/cp949.json create mode 100644 server/node_modules/iconv-lite/encodings/tables/cp950.json create mode 100644 server/node_modules/iconv-lite/encodings/tables/eucjp.json create mode 100644 server/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json create mode 100644 server/node_modules/iconv-lite/encodings/tables/gbk-added.json create mode 100644 server/node_modules/iconv-lite/encodings/tables/shiftjis.json create mode 100644 server/node_modules/iconv-lite/encodings/utf16.js create mode 100644 server/node_modules/iconv-lite/encodings/utf7.js create mode 100644 server/node_modules/iconv-lite/lib/bom-handling.js create mode 100644 server/node_modules/iconv-lite/lib/extend-node.js create mode 100644 server/node_modules/iconv-lite/lib/index.d.ts create mode 100644 server/node_modules/iconv-lite/lib/index.js create mode 100644 server/node_modules/iconv-lite/lib/streams.js create mode 100644 server/node_modules/iconv-lite/package.json create mode 100644 server/node_modules/ieee754/LICENSE create mode 100644 server/node_modules/ieee754/README.md create mode 100644 server/node_modules/ieee754/index.d.ts create mode 100644 server/node_modules/ieee754/index.js create mode 100644 server/node_modules/ieee754/package.json create mode 100644 server/node_modules/ignore-by-default/LICENSE create mode 100644 server/node_modules/ignore-by-default/README.md create mode 100644 server/node_modules/ignore-by-default/index.js create mode 100644 server/node_modules/ignore-by-default/package.json create mode 100644 server/node_modules/import-lazy/index.js create mode 100644 server/node_modules/import-lazy/license create mode 100644 server/node_modules/import-lazy/package.json create mode 100644 server/node_modules/import-lazy/readme.md create mode 100644 server/node_modules/imurmurhash/README.md create mode 100644 server/node_modules/imurmurhash/imurmurhash.js create mode 100644 server/node_modules/imurmurhash/imurmurhash.min.js create mode 100644 server/node_modules/imurmurhash/package.json create mode 100644 server/node_modules/inherits/LICENSE create mode 100644 server/node_modules/inherits/README.md create mode 100644 server/node_modules/inherits/inherits.js create mode 100644 server/node_modules/inherits/inherits_browser.js create mode 100644 server/node_modules/inherits/package.json create mode 100644 server/node_modules/ini/LICENSE create mode 100644 server/node_modules/ini/README.md create mode 100644 server/node_modules/ini/ini.js create mode 100644 server/node_modules/ini/package.json create mode 100644 server/node_modules/ipaddr.js/LICENSE create mode 100644 server/node_modules/ipaddr.js/README.md create mode 100644 server/node_modules/ipaddr.js/ipaddr.min.js create mode 100644 server/node_modules/ipaddr.js/lib/ipaddr.js create mode 100644 server/node_modules/ipaddr.js/lib/ipaddr.js.d.ts create mode 100644 server/node_modules/ipaddr.js/package.json create mode 100644 server/node_modules/is-binary-path/index.d.ts create mode 100644 server/node_modules/is-binary-path/index.js create mode 100644 server/node_modules/is-binary-path/license create mode 100644 server/node_modules/is-binary-path/package.json create mode 100644 server/node_modules/is-binary-path/readme.md create mode 100644 server/node_modules/is-ci/CHANGELOG.md create mode 100644 server/node_modules/is-ci/LICENSE create mode 100644 server/node_modules/is-ci/README.md create mode 100755 server/node_modules/is-ci/bin.js create mode 100644 server/node_modules/is-ci/index.js create mode 100644 server/node_modules/is-ci/package.json create mode 100644 server/node_modules/is-extglob/LICENSE create mode 100644 server/node_modules/is-extglob/README.md create mode 100644 server/node_modules/is-extglob/index.js create mode 100644 server/node_modules/is-extglob/package.json create mode 100644 server/node_modules/is-fullwidth-code-point/index.d.ts create mode 100644 server/node_modules/is-fullwidth-code-point/index.js create mode 100644 server/node_modules/is-fullwidth-code-point/license create mode 100644 server/node_modules/is-fullwidth-code-point/package.json create mode 100644 server/node_modules/is-fullwidth-code-point/readme.md create mode 100644 server/node_modules/is-glob/LICENSE create mode 100644 server/node_modules/is-glob/README.md create mode 100644 server/node_modules/is-glob/index.js create mode 100644 server/node_modules/is-glob/package.json create mode 100644 server/node_modules/is-installed-globally/index.d.ts create mode 100644 server/node_modules/is-installed-globally/index.js create mode 100644 server/node_modules/is-installed-globally/license create mode 100644 server/node_modules/is-installed-globally/package.json create mode 100644 server/node_modules/is-installed-globally/readme.md create mode 100644 server/node_modules/is-npm/index.d.ts create mode 100644 server/node_modules/is-npm/index.js create mode 100644 server/node_modules/is-npm/license create mode 100644 server/node_modules/is-npm/package.json create mode 100644 server/node_modules/is-npm/readme.md create mode 100644 server/node_modules/is-number/LICENSE create mode 100644 server/node_modules/is-number/README.md create mode 100644 server/node_modules/is-number/index.js create mode 100644 server/node_modules/is-number/package.json create mode 100644 server/node_modules/is-obj/index.d.ts create mode 100644 server/node_modules/is-obj/index.js create mode 100644 server/node_modules/is-obj/license create mode 100644 server/node_modules/is-obj/package.json create mode 100644 server/node_modules/is-obj/readme.md create mode 100644 server/node_modules/is-path-inside/index.d.ts create mode 100644 server/node_modules/is-path-inside/index.js create mode 100644 server/node_modules/is-path-inside/license create mode 100644 server/node_modules/is-path-inside/package.json create mode 100644 server/node_modules/is-path-inside/readme.md create mode 100644 server/node_modules/is-typedarray/LICENSE.md create mode 100644 server/node_modules/is-typedarray/README.md create mode 100644 server/node_modules/is-typedarray/index.js create mode 100644 server/node_modules/is-typedarray/package.json create mode 100644 server/node_modules/is-typedarray/test.js create mode 100644 server/node_modules/is-yarn-global/.travis.yml create mode 100644 server/node_modules/is-yarn-global/LICENSE create mode 100644 server/node_modules/is-yarn-global/README.md create mode 100644 server/node_modules/is-yarn-global/index.js create mode 100644 server/node_modules/is-yarn-global/package.json create mode 100644 server/node_modules/isarray/.npmignore create mode 100644 server/node_modules/isarray/.travis.yml create mode 100644 server/node_modules/isarray/Makefile create mode 100644 server/node_modules/isarray/README.md create mode 100644 server/node_modules/isarray/component.json create mode 100644 server/node_modules/isarray/index.js create mode 100644 server/node_modules/isarray/package.json create mode 100644 server/node_modules/isarray/test.js create mode 100644 server/node_modules/json-buffer/.npmignore create mode 100644 server/node_modules/json-buffer/.travis.yml create mode 100644 server/node_modules/json-buffer/LICENSE create mode 100644 server/node_modules/json-buffer/README.md create mode 100644 server/node_modules/json-buffer/index.js create mode 100644 server/node_modules/json-buffer/package.json create mode 100644 server/node_modules/json-buffer/test/index.js create mode 100644 server/node_modules/keyv/LICENSE create mode 100644 server/node_modules/keyv/README.md create mode 100644 server/node_modules/keyv/package.json create mode 100644 server/node_modules/keyv/src/index.js create mode 100644 server/node_modules/latest-version/index.d.ts create mode 100644 server/node_modules/latest-version/index.js create mode 100644 server/node_modules/latest-version/license create mode 100644 server/node_modules/latest-version/package.json create mode 100644 server/node_modules/latest-version/readme.md create mode 100644 server/node_modules/lowercase-keys/index.js create mode 100644 server/node_modules/lowercase-keys/license create mode 100644 server/node_modules/lowercase-keys/package.json create mode 100644 server/node_modules/lowercase-keys/readme.md create mode 100644 server/node_modules/lru-cache/LICENSE create mode 100644 server/node_modules/lru-cache/README.md create mode 100644 server/node_modules/lru-cache/index.js create mode 100644 server/node_modules/lru-cache/package.json create mode 100644 server/node_modules/make-dir/index.d.ts create mode 100644 server/node_modules/make-dir/index.js create mode 100644 server/node_modules/make-dir/license create mode 120000 server/node_modules/make-dir/node_modules/.bin/semver create mode 100644 server/node_modules/make-dir/node_modules/semver/CHANGELOG.md create mode 100644 server/node_modules/make-dir/node_modules/semver/LICENSE create mode 100644 server/node_modules/make-dir/node_modules/semver/README.md create mode 100755 server/node_modules/make-dir/node_modules/semver/bin/semver.js create mode 100644 server/node_modules/make-dir/node_modules/semver/package.json create mode 100644 server/node_modules/make-dir/node_modules/semver/range.bnf create mode 100644 server/node_modules/make-dir/node_modules/semver/semver.js create mode 100644 server/node_modules/make-dir/package.json create mode 100644 server/node_modules/make-dir/readme.md create mode 100644 server/node_modules/media-typer/HISTORY.md create mode 100644 server/node_modules/media-typer/LICENSE create mode 100644 server/node_modules/media-typer/README.md create mode 100644 server/node_modules/media-typer/index.js create mode 100644 server/node_modules/media-typer/package.json create mode 100644 server/node_modules/merge-descriptors/HISTORY.md create mode 100644 server/node_modules/merge-descriptors/LICENSE create mode 100644 server/node_modules/merge-descriptors/README.md create mode 100644 server/node_modules/merge-descriptors/index.js create mode 100644 server/node_modules/merge-descriptors/package.json create mode 100644 server/node_modules/methods/HISTORY.md create mode 100644 server/node_modules/methods/LICENSE create mode 100644 server/node_modules/methods/README.md create mode 100644 server/node_modules/methods/index.js create mode 100644 server/node_modules/methods/package.json create mode 100644 server/node_modules/mime-db/HISTORY.md create mode 100644 server/node_modules/mime-db/LICENSE create mode 100644 server/node_modules/mime-db/README.md create mode 100644 server/node_modules/mime-db/db.json create mode 100644 server/node_modules/mime-db/index.js create mode 100644 server/node_modules/mime-db/package.json create mode 100644 server/node_modules/mime-types/HISTORY.md create mode 100644 server/node_modules/mime-types/LICENSE create mode 100644 server/node_modules/mime-types/README.md create mode 100644 server/node_modules/mime-types/index.js create mode 100644 server/node_modules/mime-types/package.json create mode 100644 server/node_modules/mime/.npmignore create mode 100644 server/node_modules/mime/CHANGELOG.md create mode 100644 server/node_modules/mime/LICENSE create mode 100644 server/node_modules/mime/README.md create mode 100755 server/node_modules/mime/cli.js create mode 100644 server/node_modules/mime/mime.js create mode 100644 server/node_modules/mime/package.json create mode 100755 server/node_modules/mime/src/build.js create mode 100644 server/node_modules/mime/src/test.js create mode 100644 server/node_modules/mime/types.json create mode 100644 server/node_modules/mimic-response/index.js create mode 100644 server/node_modules/mimic-response/license create mode 100644 server/node_modules/mimic-response/package.json create mode 100644 server/node_modules/mimic-response/readme.md create mode 100644 server/node_modules/minimatch/LICENSE create mode 100644 server/node_modules/minimatch/README.md create mode 100644 server/node_modules/minimatch/minimatch.js create mode 100644 server/node_modules/minimatch/package.json create mode 100644 server/node_modules/minimist/.travis.yml create mode 100644 server/node_modules/minimist/LICENSE create mode 100644 server/node_modules/minimist/example/parse.js create mode 100644 server/node_modules/minimist/index.js create mode 100644 server/node_modules/minimist/package.json create mode 100644 server/node_modules/minimist/readme.markdown create mode 100644 server/node_modules/minimist/test/all_bool.js create mode 100644 server/node_modules/minimist/test/bool.js create mode 100644 server/node_modules/minimist/test/dash.js create mode 100644 server/node_modules/minimist/test/default_bool.js create mode 100644 server/node_modules/minimist/test/dotted.js create mode 100644 server/node_modules/minimist/test/kv_short.js create mode 100644 server/node_modules/minimist/test/long.js create mode 100644 server/node_modules/minimist/test/num.js create mode 100644 server/node_modules/minimist/test/parse.js create mode 100644 server/node_modules/minimist/test/parse_modified.js create mode 100644 server/node_modules/minimist/test/proto.js create mode 100644 server/node_modules/minimist/test/short.js create mode 100644 server/node_modules/minimist/test/stop_early.js create mode 100644 server/node_modules/minimist/test/unknown.js create mode 100644 server/node_modules/minimist/test/whitespace.js create mode 100644 server/node_modules/mkdirp-classic/LICENSE create mode 100644 server/node_modules/mkdirp-classic/README.md create mode 100644 server/node_modules/mkdirp-classic/index.js create mode 100644 server/node_modules/mkdirp-classic/package.json create mode 100644 server/node_modules/ms/index.js create mode 100644 server/node_modules/ms/license.md create mode 100644 server/node_modules/ms/package.json create mode 100644 server/node_modules/ms/readme.md create mode 100644 server/node_modules/nan/CHANGELOG.md create mode 100644 server/node_modules/nan/LICENSE.md create mode 100644 server/node_modules/nan/README.md create mode 100644 server/node_modules/nan/doc/asyncworker.md create mode 100644 server/node_modules/nan/doc/buffers.md create mode 100644 server/node_modules/nan/doc/callback.md create mode 100644 server/node_modules/nan/doc/converters.md create mode 100644 server/node_modules/nan/doc/errors.md create mode 100644 server/node_modules/nan/doc/json.md create mode 100644 server/node_modules/nan/doc/maybe_types.md create mode 100644 server/node_modules/nan/doc/methods.md create mode 100644 server/node_modules/nan/doc/new.md create mode 100644 server/node_modules/nan/doc/node_misc.md create mode 100644 server/node_modules/nan/doc/object_wrappers.md create mode 100644 server/node_modules/nan/doc/persistent.md create mode 100644 server/node_modules/nan/doc/scopes.md create mode 100644 server/node_modules/nan/doc/script.md create mode 100644 server/node_modules/nan/doc/string_bytes.md create mode 100644 server/node_modules/nan/doc/v8_internals.md create mode 100644 server/node_modules/nan/doc/v8_misc.md create mode 100644 server/node_modules/nan/include_dirs.js create mode 100644 server/node_modules/nan/nan.h create mode 100644 server/node_modules/nan/nan_callbacks.h create mode 100644 server/node_modules/nan/nan_callbacks_12_inl.h create mode 100644 server/node_modules/nan/nan_callbacks_pre_12_inl.h create mode 100644 server/node_modules/nan/nan_converters.h create mode 100644 server/node_modules/nan/nan_converters_43_inl.h create mode 100644 server/node_modules/nan/nan_converters_pre_43_inl.h create mode 100644 server/node_modules/nan/nan_define_own_property_helper.h create mode 100644 server/node_modules/nan/nan_implementation_12_inl.h create mode 100644 server/node_modules/nan/nan_implementation_pre_12_inl.h create mode 100644 server/node_modules/nan/nan_json.h create mode 100644 server/node_modules/nan/nan_maybe_43_inl.h create mode 100644 server/node_modules/nan/nan_maybe_pre_43_inl.h create mode 100644 server/node_modules/nan/nan_new.h create mode 100644 server/node_modules/nan/nan_object_wrap.h create mode 100644 server/node_modules/nan/nan_persistent_12_inl.h create mode 100644 server/node_modules/nan/nan_persistent_pre_12_inl.h create mode 100644 server/node_modules/nan/nan_private.h create mode 100644 server/node_modules/nan/nan_scriptorigin.h create mode 100644 server/node_modules/nan/nan_string_bytes.h create mode 100644 server/node_modules/nan/nan_typedarray_contents.h create mode 100644 server/node_modules/nan/nan_weak.h create mode 100644 server/node_modules/nan/package.json create mode 100755 server/node_modules/nan/tools/1to2.js create mode 100644 server/node_modules/nan/tools/README.md create mode 100644 server/node_modules/nan/tools/package.json create mode 100644 server/node_modules/napi-build-utils/LICENSE create mode 100644 server/node_modules/napi-build-utils/README.md create mode 100644 server/node_modules/napi-build-utils/index.js create mode 100644 server/node_modules/napi-build-utils/index.md create mode 100644 server/node_modules/napi-build-utils/package.json create mode 100644 server/node_modules/negotiator/HISTORY.md create mode 100644 server/node_modules/negotiator/LICENSE create mode 100644 server/node_modules/negotiator/README.md create mode 100644 server/node_modules/negotiator/index.js create mode 100644 server/node_modules/negotiator/lib/charset.js create mode 100644 server/node_modules/negotiator/lib/encoding.js create mode 100644 server/node_modules/negotiator/lib/language.js create mode 100644 server/node_modules/negotiator/lib/mediaType.js create mode 100644 server/node_modules/negotiator/package.json create mode 100644 server/node_modules/node-abi/.circleci/config.yml create mode 100644 server/node_modules/node-abi/.github/workflows/update-abi.yml create mode 100644 server/node_modules/node-abi/.releaserc.json create mode 100644 server/node_modules/node-abi/CODE_OF_CONDUCT.md create mode 100644 server/node_modules/node-abi/CONTRIBUTING.md create mode 100644 server/node_modules/node-abi/LICENSE create mode 100644 server/node_modules/node-abi/README.md create mode 100644 server/node_modules/node-abi/abi_registry.json create mode 100644 server/node_modules/node-abi/index.js create mode 120000 server/node_modules/node-abi/node_modules/.bin/semver create mode 100644 server/node_modules/node-abi/node_modules/semver/CHANGELOG.md create mode 100644 server/node_modules/node-abi/node_modules/semver/LICENSE create mode 100644 server/node_modules/node-abi/node_modules/semver/README.md create mode 100755 server/node_modules/node-abi/node_modules/semver/bin/semver.js create mode 100644 server/node_modules/node-abi/node_modules/semver/classes/comparator.js create mode 100644 server/node_modules/node-abi/node_modules/semver/classes/index.js create mode 100644 server/node_modules/node-abi/node_modules/semver/classes/range.js create mode 100644 server/node_modules/node-abi/node_modules/semver/classes/semver.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/clean.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/cmp.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/coerce.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/compare-build.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/compare-loose.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/compare.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/diff.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/eq.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/gt.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/gte.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/inc.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/lt.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/lte.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/major.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/minor.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/neq.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/parse.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/patch.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/prerelease.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/rcompare.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/rsort.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/satisfies.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/sort.js create mode 100644 server/node_modules/node-abi/node_modules/semver/functions/valid.js create mode 100644 server/node_modules/node-abi/node_modules/semver/index.js create mode 100644 server/node_modules/node-abi/node_modules/semver/internal/constants.js create mode 100644 server/node_modules/node-abi/node_modules/semver/internal/debug.js create mode 100644 server/node_modules/node-abi/node_modules/semver/internal/identifiers.js create mode 100644 server/node_modules/node-abi/node_modules/semver/internal/parse-options.js create mode 100644 server/node_modules/node-abi/node_modules/semver/internal/re.js create mode 100644 server/node_modules/node-abi/node_modules/semver/package.json create mode 100644 server/node_modules/node-abi/node_modules/semver/preload.js create mode 100644 server/node_modules/node-abi/node_modules/semver/range.bnf create mode 100644 server/node_modules/node-abi/node_modules/semver/ranges/gtr.js create mode 100644 server/node_modules/node-abi/node_modules/semver/ranges/intersects.js create mode 100644 server/node_modules/node-abi/node_modules/semver/ranges/ltr.js create mode 100644 server/node_modules/node-abi/node_modules/semver/ranges/max-satisfying.js create mode 100644 server/node_modules/node-abi/node_modules/semver/ranges/min-satisfying.js create mode 100644 server/node_modules/node-abi/node_modules/semver/ranges/min-version.js create mode 100644 server/node_modules/node-abi/node_modules/semver/ranges/outside.js create mode 100644 server/node_modules/node-abi/node_modules/semver/ranges/simplify.js create mode 100644 server/node_modules/node-abi/node_modules/semver/ranges/subset.js create mode 100644 server/node_modules/node-abi/node_modules/semver/ranges/to-comparators.js create mode 100644 server/node_modules/node-abi/node_modules/semver/ranges/valid.js create mode 100644 server/node_modules/node-abi/package.json create mode 100644 server/node_modules/node-abi/scripts/update-abi-registry.js create mode 100644 server/node_modules/node-abi/test/index.js create mode 100644 server/node_modules/nodemon/.eslintrc.json create mode 100644 server/node_modules/nodemon/.jshintrc create mode 100644 server/node_modules/nodemon/.releaserc create mode 100644 server/node_modules/nodemon/.travis.yml create mode 100644 server/node_modules/nodemon/LICENSE create mode 100644 server/node_modules/nodemon/README.md create mode 100755 server/node_modules/nodemon/bin/nodemon.js create mode 100755 server/node_modules/nodemon/bin/postinstall.js create mode 100644 server/node_modules/nodemon/bin/windows-kill.exe create mode 100644 server/node_modules/nodemon/commitlint.config.js create mode 100644 server/node_modules/nodemon/doc/cli/authors.txt create mode 100644 server/node_modules/nodemon/doc/cli/config.txt create mode 100644 server/node_modules/nodemon/doc/cli/help.txt create mode 100644 server/node_modules/nodemon/doc/cli/logo.txt create mode 100644 server/node_modules/nodemon/doc/cli/options.txt create mode 100644 server/node_modules/nodemon/doc/cli/topics.txt create mode 100644 server/node_modules/nodemon/doc/cli/usage.txt create mode 100644 server/node_modules/nodemon/doc/cli/whoami.txt create mode 100644 server/node_modules/nodemon/lib/cli/index.js create mode 100644 server/node_modules/nodemon/lib/cli/parse.js create mode 100644 server/node_modules/nodemon/lib/config/command.js create mode 100644 server/node_modules/nodemon/lib/config/defaults.js create mode 100644 server/node_modules/nodemon/lib/config/exec.js create mode 100644 server/node_modules/nodemon/lib/config/index.js create mode 100644 server/node_modules/nodemon/lib/config/load.js create mode 100644 server/node_modules/nodemon/lib/help/index.js create mode 100644 server/node_modules/nodemon/lib/index.js create mode 100644 server/node_modules/nodemon/lib/monitor/index.js create mode 100644 server/node_modules/nodemon/lib/monitor/match.js create mode 100644 server/node_modules/nodemon/lib/monitor/run.js create mode 100644 server/node_modules/nodemon/lib/monitor/signals.js create mode 100644 server/node_modules/nodemon/lib/monitor/watch.js create mode 100644 server/node_modules/nodemon/lib/nodemon.js create mode 100644 server/node_modules/nodemon/lib/rules/add.js create mode 100644 server/node_modules/nodemon/lib/rules/index.js create mode 100644 server/node_modules/nodemon/lib/rules/parse.js create mode 100644 server/node_modules/nodemon/lib/spawn.js create mode 100644 server/node_modules/nodemon/lib/utils/bus.js create mode 100644 server/node_modules/nodemon/lib/utils/clone.js create mode 100644 server/node_modules/nodemon/lib/utils/colour.js create mode 100644 server/node_modules/nodemon/lib/utils/index.js create mode 100644 server/node_modules/nodemon/lib/utils/log.js create mode 100644 server/node_modules/nodemon/lib/utils/merge.js create mode 100644 server/node_modules/nodemon/lib/version.js create mode 100644 server/node_modules/nodemon/node_modules/debug/CHANGELOG.md create mode 100644 server/node_modules/nodemon/node_modules/debug/LICENSE create mode 100644 server/node_modules/nodemon/node_modules/debug/README.md create mode 100644 server/node_modules/nodemon/node_modules/debug/node.js create mode 100644 server/node_modules/nodemon/node_modules/debug/package.json create mode 100644 server/node_modules/nodemon/node_modules/debug/src/browser.js create mode 100644 server/node_modules/nodemon/node_modules/debug/src/common.js create mode 100644 server/node_modules/nodemon/node_modules/debug/src/index.js create mode 100644 server/node_modules/nodemon/node_modules/debug/src/node.js create mode 100644 server/node_modules/nodemon/node_modules/ms/index.js create mode 100644 server/node_modules/nodemon/node_modules/ms/license.md create mode 100644 server/node_modules/nodemon/node_modules/ms/package.json create mode 100644 server/node_modules/nodemon/node_modules/ms/readme.md create mode 100644 server/node_modules/nodemon/package.json create mode 100644 server/node_modules/nopt/.npmignore create mode 100644 server/node_modules/nopt/LICENSE create mode 100644 server/node_modules/nopt/README.md create mode 100755 server/node_modules/nopt/bin/nopt.js create mode 100755 server/node_modules/nopt/examples/my-program.js create mode 100644 server/node_modules/nopt/lib/nopt.js create mode 100644 server/node_modules/nopt/package.json create mode 100644 server/node_modules/normalize-path/LICENSE create mode 100644 server/node_modules/normalize-path/README.md create mode 100644 server/node_modules/normalize-path/index.js create mode 100644 server/node_modules/normalize-path/package.json create mode 100644 server/node_modules/normalize-url/index.d.ts create mode 100644 server/node_modules/normalize-url/index.js create mode 100644 server/node_modules/normalize-url/license create mode 100644 server/node_modules/normalize-url/package.json create mode 100644 server/node_modules/normalize-url/readme.md create mode 100644 server/node_modules/npmlog/CHANGELOG.md create mode 100644 server/node_modules/npmlog/LICENSE create mode 100644 server/node_modules/npmlog/README.md create mode 100644 server/node_modules/npmlog/log.js create mode 100644 server/node_modules/npmlog/package.json create mode 100644 server/node_modules/number-is-nan/index.js create mode 100644 server/node_modules/number-is-nan/license create mode 100644 server/node_modules/number-is-nan/package.json create mode 100644 server/node_modules/number-is-nan/readme.md create mode 100644 server/node_modules/object-assign/index.js create mode 100644 server/node_modules/object-assign/license create mode 100644 server/node_modules/object-assign/package.json create mode 100644 server/node_modules/object-assign/readme.md create mode 100644 server/node_modules/on-finished/HISTORY.md create mode 100644 server/node_modules/on-finished/LICENSE create mode 100644 server/node_modules/on-finished/README.md create mode 100644 server/node_modules/on-finished/index.js create mode 100644 server/node_modules/on-finished/package.json create mode 100644 server/node_modules/once/LICENSE create mode 100644 server/node_modules/once/README.md create mode 100644 server/node_modules/once/once.js create mode 100644 server/node_modules/once/package.json create mode 100644 server/node_modules/p-cancelable/index.d.ts create mode 100644 server/node_modules/p-cancelable/index.js create mode 100644 server/node_modules/p-cancelable/license create mode 100644 server/node_modules/p-cancelable/package.json create mode 100644 server/node_modules/p-cancelable/readme.md create mode 100644 server/node_modules/package-json/index.d.ts create mode 100644 server/node_modules/package-json/index.js create mode 100644 server/node_modules/package-json/license create mode 120000 server/node_modules/package-json/node_modules/.bin/semver create mode 100644 server/node_modules/package-json/node_modules/semver/CHANGELOG.md create mode 100644 server/node_modules/package-json/node_modules/semver/LICENSE create mode 100644 server/node_modules/package-json/node_modules/semver/README.md create mode 100755 server/node_modules/package-json/node_modules/semver/bin/semver.js create mode 100644 server/node_modules/package-json/node_modules/semver/package.json create mode 100644 server/node_modules/package-json/node_modules/semver/range.bnf create mode 100644 server/node_modules/package-json/node_modules/semver/semver.js create mode 100644 server/node_modules/package-json/package.json create mode 100644 server/node_modules/package-json/readme.md create mode 100644 server/node_modules/parseurl/HISTORY.md create mode 100644 server/node_modules/parseurl/LICENSE create mode 100644 server/node_modules/parseurl/README.md create mode 100644 server/node_modules/parseurl/index.js create mode 100644 server/node_modules/parseurl/package.json create mode 100644 server/node_modules/path-to-regexp/History.md create mode 100644 server/node_modules/path-to-regexp/LICENSE create mode 100644 server/node_modules/path-to-regexp/Readme.md create mode 100644 server/node_modules/path-to-regexp/index.js create mode 100644 server/node_modules/path-to-regexp/package.json create mode 100644 server/node_modules/picomatch/CHANGELOG.md create mode 100644 server/node_modules/picomatch/LICENSE create mode 100644 server/node_modules/picomatch/README.md create mode 100644 server/node_modules/picomatch/index.js create mode 100644 server/node_modules/picomatch/lib/constants.js create mode 100644 server/node_modules/picomatch/lib/parse.js create mode 100644 server/node_modules/picomatch/lib/picomatch.js create mode 100644 server/node_modules/picomatch/lib/scan.js create mode 100644 server/node_modules/picomatch/lib/utils.js create mode 100644 server/node_modules/picomatch/package.json create mode 100644 server/node_modules/prebuild-install/CHANGELOG.md create mode 100644 server/node_modules/prebuild-install/CONTRIBUTING.md create mode 100644 server/node_modules/prebuild-install/LICENSE create mode 100644 server/node_modules/prebuild-install/README.md create mode 100644 server/node_modules/prebuild-install/asset.js create mode 100755 server/node_modules/prebuild-install/bin.js create mode 100644 server/node_modules/prebuild-install/download.js create mode 100644 server/node_modules/prebuild-install/error.js create mode 100644 server/node_modules/prebuild-install/help.txt create mode 100644 server/node_modules/prebuild-install/index.js create mode 100644 server/node_modules/prebuild-install/log.js create mode 100644 server/node_modules/prebuild-install/package.json create mode 100644 server/node_modules/prebuild-install/proxy.js create mode 100644 server/node_modules/prebuild-install/rc.js create mode 100644 server/node_modules/prebuild-install/util.js create mode 100644 server/node_modules/prepend-http/index.js create mode 100644 server/node_modules/prepend-http/license create mode 100644 server/node_modules/prepend-http/package.json create mode 100644 server/node_modules/prepend-http/readme.md create mode 100644 server/node_modules/process-nextick-args/index.js create mode 100644 server/node_modules/process-nextick-args/license.md create mode 100644 server/node_modules/process-nextick-args/package.json create mode 100644 server/node_modules/process-nextick-args/readme.md create mode 100644 server/node_modules/proxy-addr/HISTORY.md create mode 100644 server/node_modules/proxy-addr/LICENSE create mode 100644 server/node_modules/proxy-addr/README.md create mode 100644 server/node_modules/proxy-addr/index.js create mode 100644 server/node_modules/proxy-addr/package.json create mode 100644 server/node_modules/pstree.remy/.travis.yml create mode 100644 server/node_modules/pstree.remy/LICENSE create mode 100644 server/node_modules/pstree.remy/README.md create mode 100644 server/node_modules/pstree.remy/lib/index.js create mode 100644 server/node_modules/pstree.remy/lib/tree.js create mode 100644 server/node_modules/pstree.remy/lib/utils.js create mode 100644 server/node_modules/pstree.remy/package.json create mode 100644 server/node_modules/pstree.remy/tests/fixtures/index.js create mode 100644 server/node_modules/pstree.remy/tests/fixtures/out1 create mode 100644 server/node_modules/pstree.remy/tests/fixtures/out2 create mode 100644 server/node_modules/pstree.remy/tests/index.test.js create mode 100644 server/node_modules/pump/.travis.yml create mode 100644 server/node_modules/pump/LICENSE create mode 100644 server/node_modules/pump/README.md create mode 100644 server/node_modules/pump/index.js create mode 100644 server/node_modules/pump/package.json create mode 100644 server/node_modules/pump/test-browser.js create mode 100644 server/node_modules/pump/test-node.js create mode 100644 server/node_modules/pupa/index.d.ts create mode 100644 server/node_modules/pupa/index.js create mode 100644 server/node_modules/pupa/license create mode 100644 server/node_modules/pupa/package.json create mode 100644 server/node_modules/pupa/readme.md create mode 100644 server/node_modules/qs/.editorconfig create mode 100644 server/node_modules/qs/.eslintignore create mode 100644 server/node_modules/qs/.eslintrc create mode 100644 server/node_modules/qs/.github/FUNDING.yml create mode 100644 server/node_modules/qs/.nycrc create mode 100644 server/node_modules/qs/CHANGELOG.md create mode 100644 server/node_modules/qs/LICENSE.md create mode 100644 server/node_modules/qs/README.md create mode 100644 server/node_modules/qs/dist/qs.js create mode 100644 server/node_modules/qs/lib/formats.js create mode 100644 server/node_modules/qs/lib/index.js create mode 100644 server/node_modules/qs/lib/parse.js create mode 100644 server/node_modules/qs/lib/stringify.js create mode 100644 server/node_modules/qs/lib/utils.js create mode 100644 server/node_modules/qs/package.json create mode 100644 server/node_modules/qs/test/parse.js create mode 100644 server/node_modules/qs/test/stringify.js create mode 100644 server/node_modules/qs/test/utils.js create mode 100644 server/node_modules/range-parser/HISTORY.md create mode 100644 server/node_modules/range-parser/LICENSE create mode 100644 server/node_modules/range-parser/README.md create mode 100644 server/node_modules/range-parser/index.js create mode 100644 server/node_modules/range-parser/package.json create mode 100644 server/node_modules/raw-body/HISTORY.md create mode 100644 server/node_modules/raw-body/LICENSE create mode 100644 server/node_modules/raw-body/README.md create mode 100644 server/node_modules/raw-body/index.d.ts create mode 100644 server/node_modules/raw-body/index.js create mode 100644 server/node_modules/raw-body/package.json create mode 100644 server/node_modules/rc/LICENSE.APACHE2 create mode 100644 server/node_modules/rc/LICENSE.BSD create mode 100644 server/node_modules/rc/LICENSE.MIT create mode 100644 server/node_modules/rc/README.md create mode 100644 server/node_modules/rc/browser.js create mode 100755 server/node_modules/rc/cli.js create mode 100755 server/node_modules/rc/index.js create mode 100644 server/node_modules/rc/lib/utils.js create mode 100644 server/node_modules/rc/node_modules/ini/LICENSE create mode 100644 server/node_modules/rc/node_modules/ini/README.md create mode 100644 server/node_modules/rc/node_modules/ini/ini.js create mode 100644 server/node_modules/rc/node_modules/ini/package.json create mode 100644 server/node_modules/rc/package.json create mode 100644 server/node_modules/rc/test/ini.js create mode 100644 server/node_modules/rc/test/nested-env-vars.js create mode 100644 server/node_modules/rc/test/test.js create mode 100644 server/node_modules/readable-stream/.travis.yml create mode 100644 server/node_modules/readable-stream/CONTRIBUTING.md create mode 100644 server/node_modules/readable-stream/GOVERNANCE.md create mode 100644 server/node_modules/readable-stream/LICENSE create mode 100644 server/node_modules/readable-stream/README.md create mode 100644 server/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md create mode 100644 server/node_modules/readable-stream/duplex-browser.js create mode 100644 server/node_modules/readable-stream/duplex.js create mode 100644 server/node_modules/readable-stream/lib/_stream_duplex.js create mode 100644 server/node_modules/readable-stream/lib/_stream_passthrough.js create mode 100644 server/node_modules/readable-stream/lib/_stream_readable.js create mode 100644 server/node_modules/readable-stream/lib/_stream_transform.js create mode 100644 server/node_modules/readable-stream/lib/_stream_writable.js create mode 100644 server/node_modules/readable-stream/lib/internal/streams/BufferList.js create mode 100644 server/node_modules/readable-stream/lib/internal/streams/destroy.js create mode 100644 server/node_modules/readable-stream/lib/internal/streams/stream-browser.js create mode 100644 server/node_modules/readable-stream/lib/internal/streams/stream.js create mode 100644 server/node_modules/readable-stream/node_modules/safe-buffer/LICENSE create mode 100644 server/node_modules/readable-stream/node_modules/safe-buffer/README.md create mode 100644 server/node_modules/readable-stream/node_modules/safe-buffer/index.d.ts create mode 100644 server/node_modules/readable-stream/node_modules/safe-buffer/index.js create mode 100644 server/node_modules/readable-stream/node_modules/safe-buffer/package.json create mode 100644 server/node_modules/readable-stream/package.json create mode 100644 server/node_modules/readable-stream/passthrough.js create mode 100644 server/node_modules/readable-stream/readable-browser.js create mode 100644 server/node_modules/readable-stream/readable.js create mode 100644 server/node_modules/readable-stream/transform.js create mode 100644 server/node_modules/readable-stream/writable-browser.js create mode 100644 server/node_modules/readable-stream/writable.js create mode 100644 server/node_modules/readdirp/LICENSE create mode 100644 server/node_modules/readdirp/README.md create mode 100644 server/node_modules/readdirp/index.d.ts create mode 100644 server/node_modules/readdirp/index.js create mode 100644 server/node_modules/readdirp/package.json create mode 100644 server/node_modules/registry-auth-token/CHANGELOG.md create mode 100644 server/node_modules/registry-auth-token/LICENSE create mode 100644 server/node_modules/registry-auth-token/README.md create mode 100644 server/node_modules/registry-auth-token/base64.js create mode 100644 server/node_modules/registry-auth-token/index.js create mode 100644 server/node_modules/registry-auth-token/package.json create mode 100644 server/node_modules/registry-auth-token/registry-url.js create mode 100644 server/node_modules/registry-url/index.d.ts create mode 100644 server/node_modules/registry-url/index.js create mode 100644 server/node_modules/registry-url/license create mode 100644 server/node_modules/registry-url/package.json create mode 100644 server/node_modules/registry-url/readme.md create mode 100644 server/node_modules/responselike/LICENSE create mode 100644 server/node_modules/responselike/README.md create mode 100644 server/node_modules/responselike/package.json create mode 100644 server/node_modules/responselike/src/index.js create mode 100644 server/node_modules/safe-buffer/LICENSE create mode 100644 server/node_modules/safe-buffer/README.md create mode 100644 server/node_modules/safe-buffer/index.d.ts create mode 100644 server/node_modules/safe-buffer/index.js create mode 100644 server/node_modules/safe-buffer/package.json create mode 100644 server/node_modules/safer-buffer/LICENSE create mode 100644 server/node_modules/safer-buffer/Porting-Buffer.md create mode 100644 server/node_modules/safer-buffer/Readme.md create mode 100644 server/node_modules/safer-buffer/dangerous.js create mode 100644 server/node_modules/safer-buffer/package.json create mode 100644 server/node_modules/safer-buffer/safer.js create mode 100644 server/node_modules/safer-buffer/tests.js create mode 100644 server/node_modules/semver-diff/index.d.ts create mode 100644 server/node_modules/semver-diff/index.js create mode 100644 server/node_modules/semver-diff/license create mode 120000 server/node_modules/semver-diff/node_modules/.bin/semver create mode 100644 server/node_modules/semver-diff/node_modules/semver/CHANGELOG.md create mode 100644 server/node_modules/semver-diff/node_modules/semver/LICENSE create mode 100644 server/node_modules/semver-diff/node_modules/semver/README.md create mode 100755 server/node_modules/semver-diff/node_modules/semver/bin/semver.js create mode 100644 server/node_modules/semver-diff/node_modules/semver/package.json create mode 100644 server/node_modules/semver-diff/node_modules/semver/range.bnf create mode 100644 server/node_modules/semver-diff/node_modules/semver/semver.js create mode 100644 server/node_modules/semver-diff/package.json create mode 100644 server/node_modules/semver-diff/readme.md create mode 100644 server/node_modules/semver/CHANGELOG.md create mode 100644 server/node_modules/semver/LICENSE create mode 100644 server/node_modules/semver/README.md create mode 100755 server/node_modules/semver/bin/semver create mode 100644 server/node_modules/semver/package.json create mode 100644 server/node_modules/semver/range.bnf create mode 100644 server/node_modules/semver/semver.js create mode 100644 server/node_modules/send/HISTORY.md create mode 100644 server/node_modules/send/LICENSE create mode 100644 server/node_modules/send/README.md create mode 100644 server/node_modules/send/index.js create mode 100644 server/node_modules/send/node_modules/ms/index.js create mode 100644 server/node_modules/send/node_modules/ms/license.md create mode 100644 server/node_modules/send/node_modules/ms/package.json create mode 100644 server/node_modules/send/node_modules/ms/readme.md create mode 100644 server/node_modules/send/package.json create mode 100644 server/node_modules/serialport/LICENSE create mode 100644 server/node_modules/serialport/README.md create mode 100644 server/node_modules/serialport/lib/index.js create mode 100644 server/node_modules/serialport/lib/parsers.js create mode 100644 server/node_modules/serialport/node_modules/debug/LICENSE create mode 100644 server/node_modules/serialport/node_modules/debug/README.md create mode 100644 server/node_modules/serialport/node_modules/debug/package.json create mode 100644 server/node_modules/serialport/node_modules/debug/src/browser.js create mode 100644 server/node_modules/serialport/node_modules/debug/src/common.js create mode 100644 server/node_modules/serialport/node_modules/debug/src/index.js create mode 100644 server/node_modules/serialport/node_modules/debug/src/node.js create mode 100644 server/node_modules/serialport/node_modules/ms/index.js create mode 100644 server/node_modules/serialport/node_modules/ms/license.md create mode 100644 server/node_modules/serialport/node_modules/ms/package.json create mode 100644 server/node_modules/serialport/node_modules/ms/readme.md create mode 100644 server/node_modules/serialport/package.json create mode 100644 server/node_modules/serialport/test.js create mode 100644 server/node_modules/serve-static/HISTORY.md create mode 100644 server/node_modules/serve-static/LICENSE create mode 100644 server/node_modules/serve-static/README.md create mode 100644 server/node_modules/serve-static/index.js create mode 100644 server/node_modules/serve-static/package.json create mode 100644 server/node_modules/set-blocking/CHANGELOG.md create mode 100644 server/node_modules/set-blocking/LICENSE.txt create mode 100644 server/node_modules/set-blocking/README.md create mode 100644 server/node_modules/set-blocking/index.js create mode 100644 server/node_modules/set-blocking/package.json create mode 100644 server/node_modules/setprototypeof/LICENSE create mode 100644 server/node_modules/setprototypeof/README.md create mode 100644 server/node_modules/setprototypeof/index.d.ts create mode 100644 server/node_modules/setprototypeof/index.js create mode 100644 server/node_modules/setprototypeof/package.json create mode 100644 server/node_modules/setprototypeof/test/index.js create mode 100644 server/node_modules/signal-exit/LICENSE.txt create mode 100644 server/node_modules/signal-exit/README.md create mode 100644 server/node_modules/signal-exit/index.js create mode 100644 server/node_modules/signal-exit/package.json create mode 100644 server/node_modules/signal-exit/signals.js create mode 100644 server/node_modules/simple-concat/.travis.yml create mode 100644 server/node_modules/simple-concat/LICENSE create mode 100644 server/node_modules/simple-concat/README.md create mode 100644 server/node_modules/simple-concat/index.js create mode 100644 server/node_modules/simple-concat/package.json create mode 100644 server/node_modules/simple-concat/test/basic.js create mode 100644 server/node_modules/simple-get/LICENSE create mode 100644 server/node_modules/simple-get/README.md create mode 100644 server/node_modules/simple-get/index.js create mode 100644 server/node_modules/simple-get/node_modules/decompress-response/index.d.ts create mode 100644 server/node_modules/simple-get/node_modules/decompress-response/index.js create mode 100644 server/node_modules/simple-get/node_modules/decompress-response/license create mode 100644 server/node_modules/simple-get/node_modules/decompress-response/package.json create mode 100644 server/node_modules/simple-get/node_modules/decompress-response/readme.md create mode 100644 server/node_modules/simple-get/node_modules/mimic-response/index.d.ts create mode 100644 server/node_modules/simple-get/node_modules/mimic-response/index.js create mode 100644 server/node_modules/simple-get/node_modules/mimic-response/license create mode 100644 server/node_modules/simple-get/node_modules/mimic-response/package.json create mode 100644 server/node_modules/simple-get/node_modules/mimic-response/readme.md create mode 100644 server/node_modules/simple-get/package.json create mode 100644 server/node_modules/statuses/HISTORY.md create mode 100644 server/node_modules/statuses/LICENSE create mode 100644 server/node_modules/statuses/README.md create mode 100644 server/node_modules/statuses/codes.json create mode 100644 server/node_modules/statuses/index.js create mode 100644 server/node_modules/statuses/package.json create mode 100644 server/node_modules/string-width/index.d.ts create mode 100644 server/node_modules/string-width/index.js create mode 100644 server/node_modules/string-width/license create mode 100644 server/node_modules/string-width/package.json create mode 100644 server/node_modules/string-width/readme.md create mode 100644 server/node_modules/string_decoder/.travis.yml create mode 100644 server/node_modules/string_decoder/LICENSE create mode 100644 server/node_modules/string_decoder/README.md create mode 100644 server/node_modules/string_decoder/lib/string_decoder.js create mode 100644 server/node_modules/string_decoder/node_modules/safe-buffer/LICENSE create mode 100644 server/node_modules/string_decoder/node_modules/safe-buffer/README.md create mode 100644 server/node_modules/string_decoder/node_modules/safe-buffer/index.d.ts create mode 100644 server/node_modules/string_decoder/node_modules/safe-buffer/index.js create mode 100644 server/node_modules/string_decoder/node_modules/safe-buffer/package.json create mode 100644 server/node_modules/string_decoder/package.json create mode 100644 server/node_modules/strip-ansi/index.d.ts create mode 100644 server/node_modules/strip-ansi/index.js create mode 100644 server/node_modules/strip-ansi/license create mode 100644 server/node_modules/strip-ansi/package.json create mode 100644 server/node_modules/strip-ansi/readme.md create mode 100644 server/node_modules/strip-json-comments/index.js create mode 100644 server/node_modules/strip-json-comments/license create mode 100644 server/node_modules/strip-json-comments/package.json create mode 100644 server/node_modules/strip-json-comments/readme.md create mode 100644 server/node_modules/supports-color/browser.js create mode 100644 server/node_modules/supports-color/index.js create mode 100644 server/node_modules/supports-color/license create mode 100644 server/node_modules/supports-color/package.json create mode 100644 server/node_modules/supports-color/readme.md create mode 100644 server/node_modules/tar-fs/.travis.yml create mode 100644 server/node_modules/tar-fs/LICENSE create mode 100644 server/node_modules/tar-fs/README.md create mode 100644 server/node_modules/tar-fs/index.js create mode 100644 server/node_modules/tar-fs/package.json create mode 100644 server/node_modules/tar-fs/test/fixtures/a/hello.txt create mode 100644 server/node_modules/tar-fs/test/fixtures/b/a/test.txt create mode 100644 server/node_modules/tar-fs/test/fixtures/d/file1 create mode 100644 server/node_modules/tar-fs/test/fixtures/d/file2 create mode 100644 server/node_modules/tar-fs/test/fixtures/d/sub-dir/file5 create mode 100644 server/node_modules/tar-fs/test/fixtures/d/sub-files/file3 create mode 100644 server/node_modules/tar-fs/test/fixtures/d/sub-files/file4 create mode 100644 server/node_modules/tar-fs/test/fixtures/e/directory/.ignore create mode 100644 server/node_modules/tar-fs/test/fixtures/e/file create mode 100644 server/node_modules/tar-fs/test/fixtures/invalid.tar create mode 100644 server/node_modules/tar-fs/test/index.js create mode 100644 server/node_modules/tar-stream/LICENSE create mode 100644 server/node_modules/tar-stream/README.md create mode 100644 server/node_modules/tar-stream/extract.js create mode 100644 server/node_modules/tar-stream/headers.js create mode 100644 server/node_modules/tar-stream/index.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/CONTRIBUTING.md create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/GOVERNANCE.md create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/LICENSE create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/README.md create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/errors-browser.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/errors.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/experimentalWarning.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_duplex.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_passthrough.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_readable.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_transform.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_writable.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/async_iterator.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/buffer_list.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/destroy.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/end-of-stream.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/from-browser.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/from.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/pipeline.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/state.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/stream-browser.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/stream.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/package.json create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/readable-browser.js create mode 100644 server/node_modules/tar-stream/node_modules/readable-stream/readable.js create mode 100644 server/node_modules/tar-stream/pack.js create mode 100644 server/node_modules/tar-stream/package.json create mode 100644 server/node_modules/tar-stream/sandbox.js create mode 100644 server/node_modules/to-readable-stream/index.js create mode 100644 server/node_modules/to-readable-stream/license create mode 100644 server/node_modules/to-readable-stream/package.json create mode 100644 server/node_modules/to-readable-stream/readme.md create mode 100644 server/node_modules/to-regex-range/LICENSE create mode 100644 server/node_modules/to-regex-range/README.md create mode 100644 server/node_modules/to-regex-range/index.js create mode 100644 server/node_modules/to-regex-range/package.json create mode 100644 server/node_modules/toidentifier/HISTORY.md create mode 100644 server/node_modules/toidentifier/LICENSE create mode 100644 server/node_modules/toidentifier/README.md create mode 100644 server/node_modules/toidentifier/index.js create mode 100644 server/node_modules/toidentifier/package.json create mode 100644 server/node_modules/touch/LICENSE create mode 100644 server/node_modules/touch/README.md create mode 100755 server/node_modules/touch/bin/nodetouch.js create mode 100644 server/node_modules/touch/index.js create mode 100644 server/node_modules/touch/package.json create mode 100644 server/node_modules/tunnel-agent/LICENSE create mode 100644 server/node_modules/tunnel-agent/README.md create mode 100644 server/node_modules/tunnel-agent/index.js create mode 100644 server/node_modules/tunnel-agent/package.json create mode 100644 server/node_modules/type-fest/base.d.ts create mode 100644 server/node_modules/type-fest/index.d.ts create mode 100644 server/node_modules/type-fest/license create mode 100644 server/node_modules/type-fest/package.json create mode 100644 server/node_modules/type-fest/readme.md create mode 100644 server/node_modules/type-fest/source/async-return-type.d.ts create mode 100644 server/node_modules/type-fest/source/asyncify.d.ts create mode 100644 server/node_modules/type-fest/source/basic.d.ts create mode 100644 server/node_modules/type-fest/source/conditional-except.d.ts create mode 100644 server/node_modules/type-fest/source/conditional-keys.d.ts create mode 100644 server/node_modules/type-fest/source/conditional-pick.d.ts create mode 100644 server/node_modules/type-fest/source/entries.d.ts create mode 100644 server/node_modules/type-fest/source/entry.d.ts create mode 100644 server/node_modules/type-fest/source/except.d.ts create mode 100644 server/node_modules/type-fest/source/fixed-length-array.d.ts create mode 100644 server/node_modules/type-fest/source/iterable-element.d.ts create mode 100644 server/node_modules/type-fest/source/literal-union.d.ts create mode 100644 server/node_modules/type-fest/source/merge-exclusive.d.ts create mode 100644 server/node_modules/type-fest/source/merge.d.ts create mode 100644 server/node_modules/type-fest/source/mutable.d.ts create mode 100644 server/node_modules/type-fest/source/opaque.d.ts create mode 100644 server/node_modules/type-fest/source/package-json.d.ts create mode 100644 server/node_modules/type-fest/source/partial-deep.d.ts create mode 100644 server/node_modules/type-fest/source/promisable.d.ts create mode 100644 server/node_modules/type-fest/source/promise-value.d.ts create mode 100644 server/node_modules/type-fest/source/readonly-deep.d.ts create mode 100644 server/node_modules/type-fest/source/require-at-least-one.d.ts create mode 100644 server/node_modules/type-fest/source/require-exactly-one.d.ts create mode 100644 server/node_modules/type-fest/source/set-optional.d.ts create mode 100644 server/node_modules/type-fest/source/set-required.d.ts create mode 100644 server/node_modules/type-fest/source/set-return-type.d.ts create mode 100644 server/node_modules/type-fest/source/stringified.d.ts create mode 100644 server/node_modules/type-fest/source/tsconfig-json.d.ts create mode 100644 server/node_modules/type-fest/source/union-to-intersection.d.ts create mode 100644 server/node_modules/type-fest/source/utilities.d.ts create mode 100644 server/node_modules/type-fest/source/value-of.d.ts create mode 100644 server/node_modules/type-fest/ts41/camel-case.d.ts create mode 100644 server/node_modules/type-fest/ts41/delimiter-case.d.ts create mode 100644 server/node_modules/type-fest/ts41/index.d.ts create mode 100644 server/node_modules/type-fest/ts41/kebab-case.d.ts create mode 100644 server/node_modules/type-fest/ts41/pascal-case.d.ts create mode 100644 server/node_modules/type-fest/ts41/snake-case.d.ts create mode 100644 server/node_modules/type-is/HISTORY.md create mode 100644 server/node_modules/type-is/LICENSE create mode 100644 server/node_modules/type-is/README.md create mode 100644 server/node_modules/type-is/index.js create mode 100644 server/node_modules/type-is/package.json create mode 100644 server/node_modules/typedarray-to-buffer/.airtap.yml create mode 100644 server/node_modules/typedarray-to-buffer/.travis.yml create mode 100644 server/node_modules/typedarray-to-buffer/LICENSE create mode 100644 server/node_modules/typedarray-to-buffer/README.md create mode 100644 server/node_modules/typedarray-to-buffer/index.js create mode 100644 server/node_modules/typedarray-to-buffer/package.json create mode 100644 server/node_modules/typedarray-to-buffer/test/basic.js create mode 100644 server/node_modules/undefsafe/.github/workflows/release.yml create mode 100644 server/node_modules/undefsafe/.jscsrc create mode 100644 server/node_modules/undefsafe/.jshintrc create mode 100644 server/node_modules/undefsafe/.travis.yml create mode 100644 server/node_modules/undefsafe/LICENSE create mode 100644 server/node_modules/undefsafe/README.md create mode 100644 server/node_modules/undefsafe/example.js create mode 100644 server/node_modules/undefsafe/lib/undefsafe.js create mode 100644 server/node_modules/undefsafe/package.json create mode 100644 server/node_modules/unique-string/index.d.ts create mode 100644 server/node_modules/unique-string/index.js create mode 100644 server/node_modules/unique-string/license create mode 100644 server/node_modules/unique-string/package.json create mode 100644 server/node_modules/unique-string/readme.md create mode 100644 server/node_modules/unpipe/HISTORY.md create mode 100644 server/node_modules/unpipe/LICENSE create mode 100644 server/node_modules/unpipe/README.md create mode 100644 server/node_modules/unpipe/index.js create mode 100644 server/node_modules/unpipe/package.json create mode 100644 server/node_modules/update-notifier/check.js create mode 100644 server/node_modules/update-notifier/index.js create mode 100644 server/node_modules/update-notifier/license create mode 120000 server/node_modules/update-notifier/node_modules/.bin/semver create mode 100644 server/node_modules/update-notifier/node_modules/semver/CHANGELOG.md create mode 100644 server/node_modules/update-notifier/node_modules/semver/LICENSE create mode 100644 server/node_modules/update-notifier/node_modules/semver/README.md create mode 100755 server/node_modules/update-notifier/node_modules/semver/bin/semver.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/classes/comparator.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/classes/index.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/classes/range.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/classes/semver.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/clean.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/cmp.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/coerce.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/compare-build.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/compare-loose.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/compare.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/diff.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/eq.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/gt.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/gte.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/inc.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/lt.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/lte.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/major.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/minor.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/neq.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/parse.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/patch.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/prerelease.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/rcompare.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/rsort.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/satisfies.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/sort.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/functions/valid.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/index.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/internal/constants.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/internal/debug.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/internal/identifiers.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/internal/parse-options.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/internal/re.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/package.json create mode 100644 server/node_modules/update-notifier/node_modules/semver/preload.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/range.bnf create mode 100644 server/node_modules/update-notifier/node_modules/semver/ranges/gtr.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/ranges/intersects.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/ranges/ltr.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/ranges/max-satisfying.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/ranges/min-satisfying.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/ranges/min-version.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/ranges/outside.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/ranges/simplify.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/ranges/subset.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/ranges/to-comparators.js create mode 100644 server/node_modules/update-notifier/node_modules/semver/ranges/valid.js create mode 100644 server/node_modules/update-notifier/package.json create mode 100644 server/node_modules/update-notifier/readme.md create mode 100644 server/node_modules/url-parse-lax/index.js create mode 100644 server/node_modules/url-parse-lax/license create mode 100644 server/node_modules/url-parse-lax/package.json create mode 100644 server/node_modules/url-parse-lax/readme.md create mode 100644 server/node_modules/util-deprecate/History.md create mode 100644 server/node_modules/util-deprecate/LICENSE create mode 100644 server/node_modules/util-deprecate/README.md create mode 100644 server/node_modules/util-deprecate/browser.js create mode 100644 server/node_modules/util-deprecate/node.js create mode 100644 server/node_modules/util-deprecate/package.json create mode 100644 server/node_modules/utils-merge/.npmignore create mode 100644 server/node_modules/utils-merge/LICENSE create mode 100644 server/node_modules/utils-merge/README.md create mode 100644 server/node_modules/utils-merge/index.js create mode 100644 server/node_modules/utils-merge/package.json create mode 100644 server/node_modules/vary/HISTORY.md create mode 100644 server/node_modules/vary/LICENSE create mode 100644 server/node_modules/vary/README.md create mode 100644 server/node_modules/vary/index.js create mode 100644 server/node_modules/vary/package.json create mode 100755 server/node_modules/wide-align/LICENSE create mode 100755 server/node_modules/wide-align/README.md create mode 100755 server/node_modules/wide-align/align.js create mode 100755 server/node_modules/wide-align/package.json create mode 100644 server/node_modules/widest-line/index.d.ts create mode 100644 server/node_modules/widest-line/index.js create mode 100644 server/node_modules/widest-line/license create mode 100644 server/node_modules/widest-line/package.json create mode 100644 server/node_modules/widest-line/readme.md create mode 100755 server/node_modules/wrap-ansi/index.js create mode 100644 server/node_modules/wrap-ansi/license create mode 100644 server/node_modules/wrap-ansi/package.json create mode 100644 server/node_modules/wrap-ansi/readme.md create mode 100644 server/node_modules/wrappy/LICENSE create mode 100644 server/node_modules/wrappy/README.md create mode 100644 server/node_modules/wrappy/package.json create mode 100644 server/node_modules/wrappy/wrappy.js create mode 100644 server/node_modules/write-file-atomic/CHANGELOG.md create mode 100644 server/node_modules/write-file-atomic/LICENSE create mode 100644 server/node_modules/write-file-atomic/README.md create mode 100644 server/node_modules/write-file-atomic/index.js create mode 100644 server/node_modules/write-file-atomic/package.json create mode 100644 server/node_modules/ws/LICENSE create mode 100644 server/node_modules/ws/README.md create mode 100644 server/node_modules/ws/browser.js create mode 100644 server/node_modules/ws/index.js create mode 100644 server/node_modules/ws/lib/buffer-util.js create mode 100644 server/node_modules/ws/lib/constants.js create mode 100644 server/node_modules/ws/lib/event-target.js create mode 100644 server/node_modules/ws/lib/extension.js create mode 100644 server/node_modules/ws/lib/limiter.js create mode 100644 server/node_modules/ws/lib/permessage-deflate.js create mode 100644 server/node_modules/ws/lib/receiver.js create mode 100644 server/node_modules/ws/lib/sender.js create mode 100644 server/node_modules/ws/lib/stream.js create mode 100644 server/node_modules/ws/lib/subprotocol.js create mode 100644 server/node_modules/ws/lib/validation.js create mode 100644 server/node_modules/ws/lib/websocket-server.js create mode 100644 server/node_modules/ws/lib/websocket.js create mode 100644 server/node_modules/ws/package.json create mode 100644 server/node_modules/ws/wrapper.mjs create mode 100644 server/node_modules/xdg-basedir/index.d.ts create mode 100644 server/node_modules/xdg-basedir/index.js create mode 100644 server/node_modules/xdg-basedir/license create mode 100644 server/node_modules/xdg-basedir/package.json create mode 100644 server/node_modules/xdg-basedir/readme.md create mode 100644 server/node_modules/yallist/LICENSE create mode 100644 server/node_modules/yallist/README.md create mode 100644 server/node_modules/yallist/iterator.js create mode 100644 server/node_modules/yallist/package.json create mode 100644 server/node_modules/yallist/yallist.js create mode 100644 server/package-lock.json create mode 100644 server/package.json diff --git a/ .gitignore b/ .gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/ .gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/Arduino-Iot.iml b/.idea/Arduino-Iot.iml new file mode 100644 index 0000000..0c8867d --- /dev/null +++ b/.idea/Arduino-Iot.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..4f6b5b2 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/chute.ino b/chute/chute.ino similarity index 98% rename from chute.ino rename to chute/chute.ino index 88e7abc..5260b7f 100644 --- a/chute.ino +++ b/chute/chute.ino @@ -1,3 +1,6 @@ + +#include + const int xInput = A0; const int yInput = A1; const int zInput = A2; @@ -76,7 +79,3 @@ bool detectChute(float x,float y,float z){ void enregistrementData() { } - - -A - diff --git a/server/index.js b/server/index.js new file mode 100644 index 0000000..596b130 --- /dev/null +++ b/server/index.js @@ -0,0 +1,53 @@ +const express = require("express"); +const SerialPortLib = require("serialport"); +const Readline = require("@serialport/parser-readline"); + +const portArduino = new SerialPortLib("/dev/ttyACM0", { baudRate: 9600 }); +const parser = portArduino.pipe(new Readline({ delimiter: "\n" })); + +let cuurentDate; +let lastDate = new Date(); + +portArduino.on("open", () => { + console.log("Serial port ouvert"); +}); + +parser.on("data", (data) => { + cuurentDate = new Date(); + if (cuurentDate.getTime() - lastDate.getTime() > 2000) { + console.log(data); + lastDate = cuurentDate; + } +}); + +const http = require("http"), + WebSocketServer = require("ws").Server, + port = 8080; + +const server = http.createServer(); +// create a WebSocket Server on top of the HTTP server to deal with the WebSocket protocol +const wss = new WebSocketServer({ + server, +}); + +wss.on("connection", (client) => { + console.log("Client connected"); + + console.log("client " + ++count); + // Register a listener on each message of each connection + client.on("message", (message) => { + console.log(message.toString()); + console.log("message from"); + }); +}); + +// http sever starts listening on given host and port. +server.listen(port, () => { + console.log( + "Listening on " + server.address().address + ":" + server.address().port + ); +}); + +process.on("SIGINT", () => { + process.exit(0); +}); diff --git a/server/node_modules/.bin/detect-libc b/server/node_modules/.bin/detect-libc new file mode 120000 index 0000000..b4c4b76 --- /dev/null +++ b/server/node_modules/.bin/detect-libc @@ -0,0 +1 @@ +../detect-libc/bin/detect-libc.js \ No newline at end of file diff --git a/server/node_modules/.bin/is-ci b/server/node_modules/.bin/is-ci new file mode 120000 index 0000000..fe6aca6 --- /dev/null +++ b/server/node_modules/.bin/is-ci @@ -0,0 +1 @@ +../is-ci/bin.js \ No newline at end of file diff --git a/server/node_modules/.bin/mime b/server/node_modules/.bin/mime new file mode 120000 index 0000000..fbb7ee0 --- /dev/null +++ b/server/node_modules/.bin/mime @@ -0,0 +1 @@ +../mime/cli.js \ No newline at end of file diff --git a/server/node_modules/.bin/nodemon b/server/node_modules/.bin/nodemon new file mode 120000 index 0000000..1056ddc --- /dev/null +++ b/server/node_modules/.bin/nodemon @@ -0,0 +1 @@ +../nodemon/bin/nodemon.js \ No newline at end of file diff --git a/server/node_modules/.bin/nodetouch b/server/node_modules/.bin/nodetouch new file mode 120000 index 0000000..3409fdb --- /dev/null +++ b/server/node_modules/.bin/nodetouch @@ -0,0 +1 @@ +../touch/bin/nodetouch.js \ No newline at end of file diff --git a/server/node_modules/.bin/nopt b/server/node_modules/.bin/nopt new file mode 120000 index 0000000..6b6566e --- /dev/null +++ b/server/node_modules/.bin/nopt @@ -0,0 +1 @@ +../nopt/bin/nopt.js \ No newline at end of file diff --git a/server/node_modules/.bin/prebuild-install b/server/node_modules/.bin/prebuild-install new file mode 120000 index 0000000..12a458d --- /dev/null +++ b/server/node_modules/.bin/prebuild-install @@ -0,0 +1 @@ +../prebuild-install/bin.js \ No newline at end of file diff --git a/server/node_modules/.bin/rc b/server/node_modules/.bin/rc new file mode 120000 index 0000000..48b3cda --- /dev/null +++ b/server/node_modules/.bin/rc @@ -0,0 +1 @@ +../rc/cli.js \ No newline at end of file diff --git a/server/node_modules/.bin/semver b/server/node_modules/.bin/semver new file mode 120000 index 0000000..317eb29 --- /dev/null +++ b/server/node_modules/.bin/semver @@ -0,0 +1 @@ +../semver/bin/semver \ No newline at end of file diff --git a/server/node_modules/.package-lock.json b/server/node_modules/.package-lock.json new file mode 100644 index 0000000..db31ba3 --- /dev/null +++ b/server/node_modules/.package-lock.json @@ -0,0 +1,2436 @@ +{ + "name": "arduino-iot", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "node_modules/@serialport/binding-abstract": { + "version": "9.2.3", + "resolved": "https://registry.npmjs.org/@serialport/binding-abstract/-/binding-abstract-9.2.3.tgz", + "integrity": "sha512-cQs9tbIlG3P0IrOWyVirqlhWuJ7Ms2Zh9m2108z6Y5UW/iVj6wEOiW8EmK9QX9jmJXYllE7wgGgvVozP5oCj3w==", + "dependencies": { + "debug": "^4.3.2" + }, + "engines": { + "node": ">=10.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/binding-abstract/node_modules/debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@serialport/binding-abstract/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/@serialport/binding-mock": { + "version": "9.2.4", + "resolved": "https://registry.npmjs.org/@serialport/binding-mock/-/binding-mock-9.2.4.tgz", + "integrity": "sha512-dpEhACCs44oQhh6ajJfJdvQdK38Vq0N4W6iD/gdplglDCK7qXRQCMUjJIeKdS/HSEiWkC3bwumUhUufdsOyT4g==", + "dependencies": { + "@serialport/binding-abstract": "9.2.3", + "debug": "^4.3.2" + }, + "engines": { + "node": ">=10.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/binding-mock/node_modules/debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@serialport/binding-mock/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/@serialport/bindings": { + "version": "9.2.8", + "resolved": "https://registry.npmjs.org/@serialport/bindings/-/bindings-9.2.8.tgz", + "integrity": "sha512-hSLxTe0tADZ3LMMGwvEJWOC/TaFQTyPeFalUCsJ1lSQ0k6bPF04JwrtB/C81GetmDBTNRY0GlD0SNtKCc7Dr5g==", + "hasInstallScript": true, + "dependencies": { + "@serialport/binding-abstract": "9.2.3", + "@serialport/parser-readline": "9.2.4", + "bindings": "^1.5.0", + "debug": "^4.3.2", + "nan": "^2.15.0", + "prebuild-install": "^7.0.0" + }, + "engines": { + "node": ">=10.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/bindings/node_modules/debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@serialport/bindings/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/@serialport/parser-byte-length": { + "version": "9.2.4", + "resolved": "https://registry.npmjs.org/@serialport/parser-byte-length/-/parser-byte-length-9.2.4.tgz", + "integrity": "sha512-sQD/iw4ZMU3xW9PLi0/GlvU6Y623jGeWecbMkO7izUo/6P7gtfv1c9ikd5h0kwL8AoAOpQA1lxdHIKox+umBUg==", + "engines": { + "node": ">=10.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/parser-cctalk": { + "version": "9.2.4", + "resolved": "https://registry.npmjs.org/@serialport/parser-cctalk/-/parser-cctalk-9.2.4.tgz", + "integrity": "sha512-T4TU5vQMwmo9AB3gQLFDWbfJXlW5jd9guEsB/nqKjFHTv0FXPdZ7DQ2TpSp8RnHWxU3GX6kYTaDO20BKzc8GPQ==", + "engines": { + "node": ">=10.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/parser-delimiter": { + "version": "9.2.4", + "resolved": "https://registry.npmjs.org/@serialport/parser-delimiter/-/parser-delimiter-9.2.4.tgz", + "integrity": "sha512-4nvTAoYAgkxFiXrkI+3CA49Yd43CODjeszh89EK+I9c8wOZ+etZduRCzINYPiy26g7zO+GRAb9FoPCsY+sYcbQ==", + "engines": { + "node": ">=10.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/parser-inter-byte-timeout": { + "version": "9.2.4", + "resolved": "https://registry.npmjs.org/@serialport/parser-inter-byte-timeout/-/parser-inter-byte-timeout-9.2.4.tgz", + "integrity": "sha512-SOAdvr0oBQIOCXX198hiTlxs4JTKg9j5piapw5tNq52fwDOWdbYrFneT/wN04UTMKaDrJuEvXq6T4rv4j7nJ5A==", + "engines": { + "node": ">=10.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/parser-readline": { + "version": "9.2.4", + "resolved": "https://registry.npmjs.org/@serialport/parser-readline/-/parser-readline-9.2.4.tgz", + "integrity": "sha512-Z1/qrZTQUVhNSJP1hd9YfDvq0o7d87rNwAjjRKbVpa7Qi51tG5BnKt43IV3NFMyBlVcRe0rnIb3tJu57E0SOwg==", + "dependencies": { + "@serialport/parser-delimiter": "9.2.4" + }, + "engines": { + "node": ">=10.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/parser-ready": { + "version": "9.2.4", + "resolved": "https://registry.npmjs.org/@serialport/parser-ready/-/parser-ready-9.2.4.tgz", + "integrity": "sha512-Pyi94Itjl6qAURwIZr/gmZpMAyTmKXThm6vL5DoAWGQjcRHWB0gwv2TY2v7N+mQLJYUKU3cMnvnATXxHm7xjxw==", + "engines": { + "node": ">=10.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/parser-regex": { + "version": "9.2.4", + "resolved": "https://registry.npmjs.org/@serialport/parser-regex/-/parser-regex-9.2.4.tgz", + "integrity": "sha512-sI/cVvPOYz+Dbv4ZdnW16qAwvXiFf/1pGASQdbveRTlgJDdz7sRNlCBifzfTN2xljwvCTZYqiudKvDdC1TepRQ==", + "engines": { + "node": ">=10.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/stream": { + "version": "9.2.4", + "resolved": "https://registry.npmjs.org/@serialport/stream/-/stream-9.2.4.tgz", + "integrity": "sha512-bLye8Ub4vUFQGmkh8qEqehr7SE7EJs2yDs0h9jzuL5oKi+F34CFmWkEErO8GAOQ8YNn7p6b3GxUgs+0BrHHDZQ==", + "dependencies": { + "debug": "^4.3.2" + }, + "engines": { + "node": ">=10.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/stream/node_modules/debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@serialport/stream/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dependencies": { + "defer-to-connect": "^1.0.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + }, + "node_modules/accepts": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "dependencies": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dependencies": { + "string-width": "^4.1.0" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" + }, + "node_modules/are-we-there-yet": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz", + "integrity": "sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bl/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/body-parser": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.1.tgz", + "integrity": "sha512-8ljfQi5eBk8EJfECMrgqNGWPEY5jWP+1IzkzkGdFFEwFQZZyaZ21UqdaHktgiMlH0xLHqIFtE/u2OYE5dOtViA==", + "dependencies": { + "bytes": "3.1.1", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "1.8.1", + "iconv-lite": "0.4.24", + "on-finished": "~2.3.0", + "qs": "6.9.6", + "raw-body": "2.4.2", + "type-is": "~1.6.18" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dependencies": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/bytes": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.1.tgz", + "integrity": "sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cacheable-request/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cacheable-request/node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, + "node_modules/ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==" + }, + "node_modules/cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dependencies": { + "mimic-response": "^1.0.0" + } + }, + "node_modules/code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "node_modules/configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "dependencies": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, + "node_modules/crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dependencies": { + "mimic-response": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==" + }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + }, + "node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/express": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.2.tgz", + "integrity": "sha512-oxlxJxcQlYwqPWKVJJtvQiwHgosH/LrLSPA+H4UxpyvSS6jC5aH+5MoHFM+KABgTOt0APue4w66Ha8jCUo9QGg==", + "dependencies": { + "accepts": "~1.3.7", + "array-flatten": "1.1.1", + "body-parser": "1.19.1", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.4.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.1.2", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.9.6", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.17.2", + "serve-static": "1.14.2", + "setprototypeof": "1.2.0", + "statuses": "~1.5.0", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", + "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + }, + "node_modules/gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dependencies": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "node_modules/gauge/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gauge/node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gauge/node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gauge/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=" + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/global-dirs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", + "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", + "dependencies": { + "ini": "2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dependencies": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==" + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "engines": { + "node": ">=4" + } + }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" + }, + "node_modules/has-yarn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==" + }, + "node_modules/http-errors": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=" + }, + "node_modules/import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "engines": { + "node": ">=4" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ini": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", + "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dependencies": { + "ci-info": "^2.0.0" + }, + "bin": { + "is-ci": "bin.js" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-installed-globally": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", + "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", + "dependencies": { + "global-dirs": "^3.0.0", + "is-path-inside": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-npm": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", + "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "node_modules/is-yarn-global": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==" + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "node_modules/json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" + }, + "node_modules/keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dependencies": { + "json-buffer": "3.0.0" + } + }, + "node_modules/latest-version": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", + "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", + "dependencies": { + "package-json": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", + "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.34", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", + "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", + "dependencies": { + "mime-db": "1.51.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "node_modules/nan": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==" + }, + "node_modules/napi-build-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", + "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==" + }, + "node_modules/negotiator": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-abi": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.5.0.tgz", + "integrity": "sha512-LtHvNIBgOy5mO8mPEUtkCW/YCRWYEKshIvqhe1GHHyXEHEB5mgICyYnAcl4qan3uFeRROErKGzatFHPf6kDxWw==", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-abi/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/nodemon": { + "version": "2.0.15", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.15.tgz", + "integrity": "sha512-gdHMNx47Gw7b3kWxJV64NI+Q5nfl0y5DgDbiVtShiwa7Z0IZ07Ll4RLFo6AjrhzMtoEZn5PDE3/c2AbVsiCkpA==", + "hasInstallScript": true, + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.0.4", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5", + "update-notifier": "^5.1.0" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/nodemon/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-url": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dependencies": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "node_modules/number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "dependencies": { + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/package-json/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prebuild-install": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.0.0.tgz", + "integrity": "sha512-IvSenf33K7JcgddNz2D5w521EgO+4aMMjFt73Uk9FRzQ7P+QZPKrp7qPsDydsSwjGt3T5xRNnM1bj1zMTD5fTA==", + "dependencies": { + "detect-libc": "^1.0.3", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^1.0.1", + "node-abi": "^3.3.0", + "npmlog": "^4.0.1", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "engines": { + "node": ">=4" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==" + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/pupa": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", + "dependencies": { + "escape-goat": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/qs": { + "version": "6.9.6", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz", + "integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==", + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.2.tgz", + "integrity": "sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ==", + "dependencies": { + "bytes": "3.1.1", + "http-errors": "1.8.1", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/rc/node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, + "node_modules/readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/registry-auth-token": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", + "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", + "dependencies": { + "rc": "^1.2.8" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/registry-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", + "dependencies": { + "rc": "^1.2.8" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dependencies": { + "lowercase-keys": "^1.0.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/semver-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", + "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", + "dependencies": { + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/semver-diff/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/send": { + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", + "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", + "dependencies": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "1.8.1", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "~2.3.0", + "range-parser": "~1.2.1", + "statuses": "~1.5.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serialport": { + "version": "9.2.8", + "resolved": "https://registry.npmjs.org/serialport/-/serialport-9.2.8.tgz", + "integrity": "sha512-FsWpMQgSJxi93JgWl5xM1f9/Z8IjRJuaUEoHqLf8FPBLw7gMhInuHOBhI2onQufWIYPGTz3H3oGcu1nCaK1EfA==", + "dependencies": { + "@serialport/binding-mock": "9.2.4", + "@serialport/bindings": "9.2.8", + "@serialport/parser-byte-length": "9.2.4", + "@serialport/parser-cctalk": "9.2.4", + "@serialport/parser-delimiter": "9.2.4", + "@serialport/parser-inter-byte-timeout": "9.2.4", + "@serialport/parser-readline": "9.2.4", + "@serialport/parser-ready": "9.2.4", + "@serialport/parser-regex": "9.2.4", + "@serialport/stream": "9.2.4", + "debug": "^4.3.2" + }, + "engines": { + "node": ">=10.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/serialport/node_modules/debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/serialport/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/serve-static": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", + "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.17.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/signal-exit": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz", + "integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==" + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/simple-get": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.0.tgz", + "integrity": "sha512-ZalZGexYr3TA0SwySsr5HlgOOinS4Jsa8YB2GJ6lUNAazyAu4KG/VmzMTwAt2YVXzzVj8QmefmAonZIK2BSGcQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/simple-get/node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/simple-get/node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tar-stream/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", + "engines": { + "node": ">=6" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dependencies": { + "nopt": "~1.0.10" + }, + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==" + }, + "node_modules/unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dependencies": { + "crypto-random-string": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/update-notifier": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", + "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", + "dependencies": { + "boxen": "^5.0.0", + "chalk": "^4.1.0", + "configstore": "^5.0.1", + "has-yarn": "^2.1.0", + "import-lazy": "^2.1.0", + "is-ci": "^2.0.0", + "is-installed-globally": "^0.4.0", + "is-npm": "^5.0.0", + "is-yarn-global": "^0.3.0", + "latest-version": "^5.1.0", + "pupa": "^2.1.1", + "semver": "^7.3.4", + "semver-diff": "^3.1.1", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/yeoman/update-notifier?sponsor=1" + } + }, + "node_modules/update-notifier/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dependencies": { + "prepend-http": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "node_modules/widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dependencies": { + "string-width": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "node_modules/write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dependencies": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "node_modules/ws": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.2.tgz", + "integrity": "sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } +} diff --git a/server/node_modules/@serialport/binding-abstract/CHANGELOG.md b/server/node_modules/@serialport/binding-abstract/CHANGELOG.md new file mode 100644 index 0000000..a25aa06 --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/CHANGELOG.md @@ -0,0 +1,59 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [9.2.3](https://github.com/serialport/node-serialport/compare/v9.2.1...v9.2.3) (2021-09-24) + +**Note:** Version bump only for package @serialport/binding-abstract + + + + + +## [9.2.2](https://github.com/serialport/node-serialport/compare/v9.2.1...v9.2.2) (2021-09-24) + +**Note:** Version bump only for package @serialport/binding-abstract + + + + + +## [9.0.7](https://github.com/serialport/node-serialport/compare/v9.0.6...v9.0.7) (2021-02-22) + +**Note:** Version bump only for package @serialport/binding-abstract + + + + + +## [9.0.2](https://github.com/serialport/node-serialport/compare/v9.0.1...v9.0.2) (2020-10-16) + + +### Bug Fixes + +* while validating for offset, check for offset's value for NaN instead length ([#2124](https://github.com/serialport/node-serialport/issues/2124)) ([4215122](https://github.com/serialport/node-serialport/commit/42151228240c5c818ac5327d6ff5c01398805564)) + + + + + +## [9.0.1](https://github.com/serialport/node-serialport/compare/v9.0.0...v9.0.1) (2020-08-08) + +**Note:** Version bump only for package @serialport/binding-abstract + + + + + +# [9.0.0](https://github.com/serialport/node-serialport/compare/v8.0.8...v9.0.0) (2020-05-10) + +**Note:** Version bump only for package @serialport/binding-abstract + + + + + +## [8.0.6](https://github.com/serialport/node-serialport/compare/v8.0.5...v8.0.6) (2019-12-25) + +**Note:** Version bump only for package @serialport/binding-abstract diff --git a/server/node_modules/@serialport/binding-abstract/LICENSE b/server/node_modules/@serialport/binding-abstract/LICENSE new file mode 100644 index 0000000..800d776 --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright 2010 Christopher Williams. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/binding-abstract/README.md b/server/node_modules/@serialport/binding-abstract/README.md new file mode 100644 index 0000000..df7bda1 --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/README.md @@ -0,0 +1,14 @@ +# @serialport/BindingAbstract + +This Abstract binding class is the base for all serialport bindings. You wouldn't use this class directly but instead extend it to make a new binding for a different platform or underling technology. + +This is currently used for the win32, linux, darwin and mock bindings. + +This is how you use it. +```js +class MockBinding extends AbstractBinding { + constructor(opt) { + super(opt) + } +} +``` diff --git a/server/node_modules/@serialport/binding-abstract/lib/index.js b/server/node_modules/@serialport/binding-abstract/lib/index.js new file mode 100644 index 0000000..7095716 --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/lib/index.js @@ -0,0 +1,222 @@ +const debug = require('debug')('serialport/binding-abstract') + +/** + * @name Binding + * @type {AbstractBinding} + * @since 5.0.0 + * @description The `Binding` is how Node-SerialPort talks to the underlying system. By default, we auto detect Windows, Linux and OS X, and load the appropriate module for your system. You can assign `SerialPort.Binding` to any binding you like. Find more by searching at [npm](https://npmjs.org/). + Prevent auto loading the default bindings by requiring SerialPort with: + ```js + var SerialPort = require('@serialport/stream'); + SerialPort.Binding = MyBindingClass; + ``` + */ + +/** + * You never have to use `Binding` objects directly. SerialPort uses them to access the underlying hardware. This documentation is geared towards people who are making bindings for different platforms. This class can be inherited from to get type checking for each method. + * @class AbstractBinding + * @param {object} options options for the binding + * @property {boolean} isOpen Required property. `true` if the port is open, `false` otherwise. Should be read-only. + * @throws {TypeError} When given invalid arguments, a `TypeError` is thrown. + * @since 5.0.0 + */ +class AbstractBinding { + /** + * Retrieves a list of available serial ports with metadata. The `path` must be guaranteed, and all other fields should be undefined if unavailable. The `path` is either the path or an identifier (eg `COM1`) used to open the serialport. + * @returns {Promise} resolves to an array of port [info objects](#module_serialport--SerialPort.list). + */ + static async list() { + debug('list') + } + + constructor(opt = {}) { + if (typeof opt !== 'object') { + throw new TypeError('"options" is not an object') + } + } + + /** + * Opens a connection to the serial port referenced by the path. + * @param {string} path the path or com port to open + * @param {openOptions} options openOptions for the serialport + * @returns {Promise} Resolves after the port is opened and configured. + * @rejects {TypeError} When given invalid arguments, a `TypeError` is rejected. + */ + async open(path, options) { + if (!path) { + throw new TypeError('"path" is not a valid port') + } + + if (typeof options !== 'object') { + throw new TypeError('"options" is not an object') + } + debug('open') + + if (this.isOpen) { + throw new Error('Already open') + } + } + + /** + * Closes an open connection + * @returns {Promise} Resolves once the connection is closed. + * @rejects {TypeError} When given invalid arguments, a `TypeError` is rejected. + */ + async close() { + debug('close') + if (!this.isOpen) { + throw new Error('Port is not open') + } + } + + /** + * Request a number of bytes from the SerialPort. This function is similar to Node's [`fs.read`](http://nodejs.org/api/fs.html#fs_fs_read_fd_buffer_offset_length_position_callback) except it will always return at least one byte. + +The in progress reads must error when the port is closed with an error object that has the property `canceled` equal to `true`. Any other error will cause a disconnection. + + * @param {buffer} buffer Accepts a [`Buffer`](http://nodejs.org/api/buffer.html) object. + * @param {integer} offset The offset in the buffer to start writing at. + * @param {integer} length Specifies the maximum number of bytes to read. + * @returns {Promise} Resolves with the number of bytes read after a read operation. + * @rejects {TypeError} When given invalid arguments, a `TypeError` is rejected. + */ + async read(buffer, offset, length) { + if (!Buffer.isBuffer(buffer)) { + throw new TypeError('"buffer" is not a Buffer') + } + + if (typeof offset !== 'number' || isNaN(offset)) { + throw new TypeError(`"offset" is not an integer got "${isNaN(offset) ? 'NaN' : typeof offset}"`) + } + + if (typeof length !== 'number' || isNaN(length)) { + throw new TypeError(`"length" is not an integer got "${isNaN(length) ? 'NaN' : typeof length}"`) + } + + debug('read') + if (buffer.length < offset + length) { + throw new Error('buffer is too small') + } + + if (!this.isOpen) { + throw new Error('Port is not open') + } + } + + /** + * Write bytes to the SerialPort. Only called when there is no pending write operation. + +The in progress writes must error when the port is closed with an error object that has the property `canceled` equal to `true`. Any other error will cause a disconnection. + + * @param {buffer} buffer - Accepts a [`Buffer`](http://nodejs.org/api/buffer.html) object. + * @returns {Promise} Resolves after the data is passed to the operating system for writing. + * @rejects {TypeError} When given invalid arguments, a `TypeError` is rejected. + */ + async write(buffer) { + if (!Buffer.isBuffer(buffer)) { + throw new TypeError('"buffer" is not a Buffer') + } + + debug('write', buffer.length, 'bytes') + if (!this.isOpen) { + debug('write', 'error port is not open') + + throw new Error('Port is not open') + } + } + + /** + * Changes connection settings on an open port. Only `baudRate` is supported. + * @param {object=} options Only supports `baudRate`. + * @param {number=} [options.baudRate] If provided a baud rate that the bindings do not support, it should reject. + * @returns {Promise} Resolves once the port's baud rate changes. + * @rejects {TypeError} When given invalid arguments, a `TypeError` is rejected. + */ + async update(options) { + if (typeof options !== 'object') { + throw TypeError('"options" is not an object') + } + + if (typeof options.baudRate !== 'number') { + throw new TypeError('"options.baudRate" is not a number') + } + + debug('update') + if (!this.isOpen) { + throw new Error('Port is not open') + } + } + + /** + * Set control flags on an open port. + * @param {object=} options All options are operating system default when the port is opened. Every flag is set on each call to the provided or default values. All options are always provided. + * @param {Boolean} [options.brk=false] flag for brk + * @param {Boolean} [options.cts=false] flag for cts + * @param {Boolean} [options.dsr=false] flag for dsr + * @param {Boolean} [options.dtr=true] flag for dtr + * @param {Boolean} [options.rts=true] flag for rts + * @param {Boolean} [options.lowLatency=false] flag for lowLatency mode on Linux + * @returns {Promise} Resolves once the port's flags are set. + * @rejects {TypeError} When given invalid arguments, a `TypeError` is rejected. + */ + async set(options) { + if (typeof options !== 'object') { + throw new TypeError('"options" is not an object') + } + debug('set') + if (!this.isOpen) { + throw new Error('Port is not open') + } + } + + /** + * Get the control flags (CTS, DSR, DCD) on the open port. + * @returns {Promise} Resolves with the retrieved flags. + * @rejects {TypeError} When given invalid arguments, a `TypeError` is rejected. + */ + async get() { + debug('get') + if (!this.isOpen) { + throw new Error('Port is not open') + } + } + + /** + * Get the OS reported baud rate for the open port. + * Used mostly for debugging custom baud rates. + * @returns {Promise} Resolves with the current baud rate. + * @rejects {TypeError} When given invalid arguments, a `TypeError` is rejected. + */ + async getBaudRate() { + debug('getbaudRate') + if (!this.isOpen) { + throw new Error('Port is not open') + } + } + + /** + * Flush (discard) data received but not read, and written but not transmitted. + * @returns {Promise} Resolves once the flush operation finishes. + * @rejects {TypeError} When given invalid arguments, a `TypeError` is rejected. + */ + async flush() { + debug('flush') + if (!this.isOpen) { + throw new Error('Port is not open') + } + } + + /** + * Drain waits until all output data is transmitted to the serial port. An in progress write should be completed before this returns. + * @returns {Promise} Resolves once the drain operation finishes. + * @rejects {TypeError} When given invalid arguments, a `TypeError` is rejected. + */ + async drain() { + debug('drain') + if (!this.isOpen) { + throw new Error('Port is not open') + } + } +} + +module.exports = AbstractBinding diff --git a/server/node_modules/@serialport/binding-abstract/node_modules/debug/LICENSE b/server/node_modules/@serialport/binding-abstract/node_modules/debug/LICENSE new file mode 100644 index 0000000..1a9820e --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/node_modules/debug/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/server/node_modules/@serialport/binding-abstract/node_modules/debug/README.md b/server/node_modules/@serialport/binding-abstract/node_modules/debug/README.md new file mode 100644 index 0000000..5ea4cd2 --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/node_modules/debug/README.md @@ -0,0 +1,478 @@ +# debug +[![Build Status](https://travis-ci.org/debug-js/debug.svg?branch=master)](https://travis-ci.org/debug-js/debug) [![Coverage Status](https://coveralls.io/repos/github/debug-js/debug/badge.svg?branch=master)](https://coveralls.io/github/debug-js/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + +## Usage in child processes + +Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process. +For example: + +```javascript +worker = fork(WORKER_WRAP_PATH, [workerPath], { + stdio: [ + /* stdin: */ 0, + /* stdout: */ 'pipe', + /* stderr: */ 'pipe', + 'ipc', + ], + env: Object.assign({}, process.env, { + DEBUG_COLORS: 1 // without this settings, colors won't be shown + }), +}); + +worker.stderr.pipe(process.stderr, { end: false }); +``` + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + - Josh Junon + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/binding-abstract/node_modules/debug/package.json b/server/node_modules/@serialport/binding-abstract/node_modules/debug/package.json new file mode 100644 index 0000000..0b269fc --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/node_modules/debug/package.json @@ -0,0 +1,101 @@ +{ + "_from": "debug@^4.3.2", + "_id": "debug@4.3.3", + "_inBundle": false, + "_integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "_location": "/@serialport/binding-abstract/debug", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "debug@^4.3.2", + "name": "debug", + "escapedName": "debug", + "rawSpec": "^4.3.2", + "saveSpec": null, + "fetchSpec": "^4.3.2" + }, + "_requiredBy": [ + "/@serialport/binding-abstract" + ], + "_resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "_shasum": "04266e0b70a98d4462e6e288e38259213332b664", + "_spec": "debug@^4.3.2", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/@serialport/binding-abstract", + "author": { + "name": "Josh Junon", + "email": "josh.junon@protonmail.com" + }, + "browser": "./src/browser.js", + "bugs": { + "url": "https://github.com/debug-js/debug/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + }, + { + "name": "Andrew Rhyne", + "email": "rhyneandrew@gmail.com" + } + ], + "dependencies": { + "ms": "2.1.2" + }, + "deprecated": false, + "description": "Lightweight debugging utility for Node.js and the browser", + "devDependencies": { + "brfs": "^2.0.1", + "browserify": "^16.2.3", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "xo": "^0.23.0" + }, + "engines": { + "node": ">=6.0" + }, + "files": [ + "src", + "LICENSE", + "README.md" + ], + "homepage": "https://github.com/debug-js/debug#readme", + "keywords": [ + "debug", + "log", + "debugger" + ], + "license": "MIT", + "main": "./src/index.js", + "name": "debug", + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, + "repository": { + "type": "git", + "url": "git://github.com/debug-js/debug.git" + }, + "scripts": { + "lint": "xo", + "test": "npm run test:node && npm run test:browser && npm run lint", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls", + "test:node": "istanbul cover _mocha -- test.js" + }, + "version": "4.3.3" +} diff --git a/server/node_modules/@serialport/binding-abstract/node_modules/debug/src/browser.js b/server/node_modules/@serialport/binding-abstract/node_modules/debug/src/browser.js new file mode 100644 index 0000000..3bf30ea --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/node_modules/debug/src/browser.js @@ -0,0 +1,269 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('debug/src/common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/server/node_modules/@serialport/binding-abstract/node_modules/debug/src/common.js b/server/node_modules/@serialport/binding-abstract/node_modules/debug/src/common.js new file mode 100644 index 0000000..6d571d2 --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/node_modules/debug/src/common.js @@ -0,0 +1,274 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/server/node_modules/@serialport/binding-abstract/node_modules/debug/src/index.js b/server/node_modules/@serialport/binding-abstract/node_modules/debug/src/index.js new file mode 100644 index 0000000..d0b8579 --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('debug/src/browser.js'); +} else { + module.exports = require('debug/src/node.js'); +} diff --git a/server/node_modules/@serialport/binding-abstract/node_modules/debug/src/node.js b/server/node_modules/@serialport/binding-abstract/node_modules/debug/src/node.js new file mode 100644 index 0000000..3044efc --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/node_modules/debug/src/node.js @@ -0,0 +1,263 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('debug/src/common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/server/node_modules/@serialport/binding-abstract/node_modules/ms/index.js b/server/node_modules/@serialport/binding-abstract/node_modules/ms/index.js new file mode 100644 index 0000000..c4498bc --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/server/node_modules/@serialport/binding-abstract/node_modules/ms/license.md b/server/node_modules/@serialport/binding-abstract/node_modules/ms/license.md new file mode 100644 index 0000000..69b6125 --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/server/node_modules/@serialport/binding-abstract/node_modules/ms/package.json b/server/node_modules/@serialport/binding-abstract/node_modules/ms/package.json new file mode 100644 index 0000000..f717ff7 --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/node_modules/ms/package.json @@ -0,0 +1,69 @@ +{ + "_from": "ms@2.1.2", + "_id": "ms@2.1.2", + "_inBundle": false, + "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "_location": "/@serialport/binding-abstract/ms", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "ms@2.1.2", + "name": "ms", + "escapedName": "ms", + "rawSpec": "2.1.2", + "saveSpec": null, + "fetchSpec": "2.1.2" + }, + "_requiredBy": [ + "/@serialport/binding-abstract/debug" + ], + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009", + "_spec": "ms@2.1.2", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/@serialport/binding-abstract/node_modules/debug", + "bugs": { + "url": "https://github.com/zeit/ms/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tiny millisecond conversion utility", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/zeit/ms#readme", + "license": "MIT", + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "main": "./index", + "name": "ms", + "repository": { + "type": "git", + "url": "git+https://github.com/zeit/ms.git" + }, + "scripts": { + "lint": "eslint lib/* bin/*", + "precommit": "lint-staged", + "test": "mocha tests.js" + }, + "version": "2.1.2" +} diff --git a/server/node_modules/@serialport/binding-abstract/node_modules/ms/readme.md b/server/node_modules/@serialport/binding-abstract/node_modules/ms/readme.md new file mode 100644 index 0000000..9a1996b --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/server/node_modules/@serialport/binding-abstract/package.json b/server/node_modules/@serialport/binding-abstract/package.json new file mode 100644 index 0000000..399dae6 --- /dev/null +++ b/server/node_modules/@serialport/binding-abstract/package.json @@ -0,0 +1,56 @@ +{ + "_from": "@serialport/binding-abstract@9.2.3", + "_id": "@serialport/binding-abstract@9.2.3", + "_inBundle": false, + "_integrity": "sha512-cQs9tbIlG3P0IrOWyVirqlhWuJ7Ms2Zh9m2108z6Y5UW/iVj6wEOiW8EmK9QX9jmJXYllE7wgGgvVozP5oCj3w==", + "_location": "/@serialport/binding-abstract", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@serialport/binding-abstract@9.2.3", + "name": "@serialport/binding-abstract", + "escapedName": "@serialport%2fbinding-abstract", + "scope": "@serialport", + "rawSpec": "9.2.3", + "saveSpec": null, + "fetchSpec": "9.2.3" + }, + "_requiredBy": [ + "/@serialport/binding-mock", + "/@serialport/bindings" + ], + "_resolved": "https://registry.npmjs.org/@serialport/binding-abstract/-/binding-abstract-9.2.3.tgz", + "_shasum": "e7dd273357b6a698af7ad58db6f57f62443a0acb", + "_spec": "@serialport/binding-abstract@9.2.3", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/@serialport/binding-mock", + "bugs": { + "url": "https://github.com/serialport/node-serialport/issues" + }, + "bundleDependencies": false, + "dependencies": { + "debug": "^4.3.2" + }, + "deprecated": false, + "description": "This Abstract binding class is the base for all serialport bindings. You wouldn't use this class directly but instead extend it to make a new binding for a different platform or underling technology.", + "engines": { + "node": ">=10.0.0" + }, + "funding": "https://opencollective.com/serialport/donate", + "gitHead": "176149a820d89bdcab2a3900b3113fc66140e67d", + "homepage": "https://github.com/serialport/node-serialport#readme", + "keywords": [ + "serialport-binding" + ], + "license": "MIT", + "main": "lib", + "name": "@serialport/binding-abstract", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git://github.com/serialport/node-serialport.git" + }, + "version": "9.2.3" +} diff --git a/server/node_modules/@serialport/binding-mock/CHANGELOG.md b/server/node_modules/@serialport/binding-mock/CHANGELOG.md new file mode 100644 index 0000000..8a0ed0c --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/CHANGELOG.md @@ -0,0 +1,67 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [9.2.4](https://github.com/serialport/node-serialport/compare/v9.2.3...v9.2.4) (2021-09-28) + +**Note:** Version bump only for package @serialport/binding-mock + + + + + +## [9.2.3](https://github.com/serialport/node-serialport/compare/v9.2.1...v9.2.3) (2021-09-24) + +**Note:** Version bump only for package @serialport/binding-mock + + + + + +## [9.2.2](https://github.com/serialport/node-serialport/compare/v9.2.1...v9.2.2) (2021-09-24) + +**Note:** Version bump only for package @serialport/binding-mock + + + + + +## [9.0.7](https://github.com/serialport/node-serialport/compare/v9.0.6...v9.0.7) (2021-02-22) + +**Note:** Version bump only for package @serialport/binding-mock + + + + + +## [9.0.2](https://github.com/serialport/node-serialport/compare/v9.0.1...v9.0.2) (2020-10-16) + +**Note:** Version bump only for package @serialport/binding-mock + + + + + +## [9.0.1](https://github.com/serialport/node-serialport/compare/v9.0.0...v9.0.1) (2020-08-08) + +**Note:** Version bump only for package @serialport/binding-mock + + + + + +# [9.0.0](https://github.com/serialport/node-serialport/compare/v8.0.8...v9.0.0) (2020-05-10) + +**Note:** Version bump only for package @serialport/binding-mock + + + + + +## [8.0.6](https://github.com/serialport/node-serialport/compare/v8.0.5...v8.0.6) (2019-12-25) + + +### Bug Fixes + +* bindings.close() should cause a canceled read error ([#1972](https://github.com/serialport/node-serialport/issues/1972)) ([50f967e](https://github.com/serialport/node-serialport/commit/50f967e788f362da57d782829712542c8f15f8c8)) diff --git a/server/node_modules/@serialport/binding-mock/LICENSE b/server/node_modules/@serialport/binding-mock/LICENSE new file mode 100644 index 0000000..800d776 --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright 2010 Christopher Williams. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/binding-mock/README.md b/server/node_modules/@serialport/binding-mock/README.md new file mode 100644 index 0000000..ada6993 --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/README.md @@ -0,0 +1,11 @@ +# @serialport/BindingMock + +This stream does some neat stuff. + +This is why you'd use it. + +This is how you use it. +```js +const bindingMock = new BindingMock() + +``` diff --git a/server/node_modules/@serialport/binding-mock/lib/index.js b/server/node_modules/@serialport/binding-mock/lib/index.js new file mode 100644 index 0000000..d5b9a64 --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/lib/index.js @@ -0,0 +1,233 @@ +const AbstractBinding = require('@serialport/binding-abstract') +const debug = require('debug')('serialport/binding-mock') +const { wrapWithHiddenComName } = require('@serialport/binding-mock/lib/legacy') + +let ports = {} +let serialNumber = 0 + +function resolveNextTick(value) { + return new Promise(resolve => process.nextTick(() => resolve(value))) +} + +const cancelError = message => { + const err = new Error(message) + err.canceled = true + return err +} + +/** + * Mock bindings for pretend serialport access + */ +class MockBinding extends AbstractBinding { + constructor(opt = {}) { + super(opt) + this.pendingRead = null // thunk for a promise or null + this.isOpen = false + this.port = null + this.lastWrite = null + this.recording = Buffer.alloc(0) + this.writeOperation = null // in flight promise or null + } + + // Reset mocks + static reset() { + ports = {} + serialNumber = 0 + } + + // Create a mock port + static createPort(path, opt) { + serialNumber++ + opt = { + echo: false, + record: false, + readyData: Buffer.from('READY'), + manufacturer: 'The J5 Robotics Company', + vendorId: undefined, + productId: undefined, + ...opt, + } + + ports[path] = { + data: Buffer.alloc(0), + echo: opt.echo, + record: opt.record, + readyData: Buffer.from(opt.readyData), + info: { + path, + manufacturer: opt.manufacturer, + serialNumber, + pnpId: undefined, + locationId: undefined, + vendorId: opt.vendorId, + productId: opt.productId, + }, + } + debug(serialNumber, 'created port', JSON.stringify({ path, opt })) + } + + static async list() { + return wrapWithHiddenComName(Object.values(ports).map(port => port.info)) + } + + // Emit data on a mock port + emitData(data) { + if (!this.isOpen) { + throw new Error('Port must be open to pretend to receive data') + } + if (!Buffer.isBuffer(data)) { + data = Buffer.from(data) + } + debug(this.serialNumber, 'emitting data - pending read:', Boolean(this.pendingRead)) + this.port.data = Buffer.concat([this.port.data, data]) + if (this.pendingRead) { + process.nextTick(this.pendingRead) + this.pendingRead = null + } + } + + async open(path, opt) { + debug(null, `opening path ${path}`) + const port = (this.port = ports[path]) + await super.open(path, opt) + await resolveNextTick() + if (!port) { + throw new Error(`Port does not exist - please call MockBinding.createPort('${path}') first`) + } + this.serialNumber = port.info.serialNumber + + if (port.openOpt && port.openOpt.lock) { + throw new Error('Port is locked cannot open') + } + + if (this.isOpen) { + throw new Error('Open: binding is already open') + } + + port.openOpt = { ...opt } + this.isOpen = true + debug(this.serialNumber, 'port is open') + if (port.echo) { + process.nextTick(() => { + if (this.isOpen) { + debug(this.serialNumber, 'emitting ready data') + this.emitData(port.readyData) + } + }) + } + } + + async close() { + const port = this.port + debug(this.serialNumber, 'closing port') + if (!port) { + throw new Error('already closed') + } + + await super.close() + delete port.openOpt + // reset data on close + port.data = Buffer.alloc(0) + debug(this.serialNumber, 'port is closed') + delete this.port + delete this.serialNumber + this.isOpen = false + if (this.pendingRead) { + this.pendingRead(cancelError('port is closed')) + } + } + + async read(buffer, offset, length) { + debug(this.serialNumber, 'reading', length, 'bytes') + await super.read(buffer, offset, length) + await resolveNextTick() + if (!this.isOpen) { + throw cancelError('Read canceled') + } + if (this.port.data.length <= 0) { + return new Promise((resolve, reject) => { + this.pendingRead = err => { + if (err) { + return reject(err) + } + this.read(buffer, offset, length).then(resolve, reject) + } + }) + } + const data = this.port.data.slice(0, length) + const bytesRead = data.copy(buffer, offset) + this.port.data = this.port.data.slice(length) + debug(this.serialNumber, 'read', bytesRead, 'bytes') + return { bytesRead, buffer } + } + + async write(buffer) { + debug(this.serialNumber, 'writing') + if (this.writeOperation) { + throw new Error('Overlapping writes are not supported and should be queued by the serialport object') + } + this.writeOperation = super.write(buffer).then(async () => { + await resolveNextTick() + if (!this.isOpen) { + throw new Error('Write canceled') + } + const data = (this.lastWrite = Buffer.from(buffer)) // copy + if (this.port.record) { + this.recording = Buffer.concat([this.recording, data]) + } + if (this.port.echo) { + process.nextTick(() => { + if (this.isOpen) { + this.emitData(data) + } + }) + } + this.writeOperation = null + debug(this.serialNumber, 'writing finished') + }) + return this.writeOperation + } + + async update(opt) { + await super.update(opt) + await resolveNextTick() + this.port.openOpt.baudRate = opt.baudRate + } + + async set(opt) { + await super.set(opt) + await resolveNextTick() + } + + async get() { + await super.get() + await resolveNextTick() + return { + cts: true, + dsr: false, + dcd: false, + } + } + + async getBaudRate() { + await super.getBaudRate() + await resolveNextTick() + return { + baudRate: this.port.openOpt.baudRate, + } + } + + async flush() { + await super.flush() + await resolveNextTick() + this.port.data = Buffer.alloc(0) + } + + async drain() { + await super.drain() + await this.writeOperation + await resolveNextTick() + } +} + +module.exports = MockBinding diff --git a/server/node_modules/@serialport/binding-mock/lib/legacy.js b/server/node_modules/@serialport/binding-mock/lib/legacy.js new file mode 100644 index 0000000..9cd2b70 --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/lib/legacy.js @@ -0,0 +1,26 @@ +let warningSent = false + +const wrapWithHiddenComName = async portsPromise => { + const ports = await portsPromise + return ports.map(port => { + const newPort = { ...port } + return Object.defineProperties(newPort, { + comName: { + get() { + if (!warningSent) { + warningSent = true + console.warn( + `"PortInfo.comName" has been deprecated. You should now use "PortInfo.path". The property will be removed in the next major release.` + ) + } + return newPort.path + }, + enumerable: false, + }, + }) + }) +} + +module.exports = { + wrapWithHiddenComName, +} diff --git a/server/node_modules/@serialport/binding-mock/node_modules/debug/LICENSE b/server/node_modules/@serialport/binding-mock/node_modules/debug/LICENSE new file mode 100644 index 0000000..1a9820e --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/node_modules/debug/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/server/node_modules/@serialport/binding-mock/node_modules/debug/README.md b/server/node_modules/@serialport/binding-mock/node_modules/debug/README.md new file mode 100644 index 0000000..5ea4cd2 --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/node_modules/debug/README.md @@ -0,0 +1,478 @@ +# debug +[![Build Status](https://travis-ci.org/debug-js/debug.svg?branch=master)](https://travis-ci.org/debug-js/debug) [![Coverage Status](https://coveralls.io/repos/github/debug-js/debug/badge.svg?branch=master)](https://coveralls.io/github/debug-js/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + +## Usage in child processes + +Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process. +For example: + +```javascript +worker = fork(WORKER_WRAP_PATH, [workerPath], { + stdio: [ + /* stdin: */ 0, + /* stdout: */ 'pipe', + /* stderr: */ 'pipe', + 'ipc', + ], + env: Object.assign({}, process.env, { + DEBUG_COLORS: 1 // without this settings, colors won't be shown + }), +}); + +worker.stderr.pipe(process.stderr, { end: false }); +``` + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + - Josh Junon + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/binding-mock/node_modules/debug/package.json b/server/node_modules/@serialport/binding-mock/node_modules/debug/package.json new file mode 100644 index 0000000..c1d2adf --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/node_modules/debug/package.json @@ -0,0 +1,101 @@ +{ + "_from": "debug@^4.3.2", + "_id": "debug@4.3.3", + "_inBundle": false, + "_integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "_location": "/@serialport/binding-mock/debug", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "debug@^4.3.2", + "name": "debug", + "escapedName": "debug", + "rawSpec": "^4.3.2", + "saveSpec": null, + "fetchSpec": "^4.3.2" + }, + "_requiredBy": [ + "/@serialport/binding-mock" + ], + "_resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "_shasum": "04266e0b70a98d4462e6e288e38259213332b664", + "_spec": "debug@^4.3.2", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/@serialport/binding-mock", + "author": { + "name": "Josh Junon", + "email": "josh.junon@protonmail.com" + }, + "browser": "./src/browser.js", + "bugs": { + "url": "https://github.com/debug-js/debug/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + }, + { + "name": "Andrew Rhyne", + "email": "rhyneandrew@gmail.com" + } + ], + "dependencies": { + "ms": "2.1.2" + }, + "deprecated": false, + "description": "Lightweight debugging utility for Node.js and the browser", + "devDependencies": { + "brfs": "^2.0.1", + "browserify": "^16.2.3", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "xo": "^0.23.0" + }, + "engines": { + "node": ">=6.0" + }, + "files": [ + "src", + "LICENSE", + "README.md" + ], + "homepage": "https://github.com/debug-js/debug#readme", + "keywords": [ + "debug", + "log", + "debugger" + ], + "license": "MIT", + "main": "./src/index.js", + "name": "debug", + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, + "repository": { + "type": "git", + "url": "git://github.com/debug-js/debug.git" + }, + "scripts": { + "lint": "xo", + "test": "npm run test:node && npm run test:browser && npm run lint", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls", + "test:node": "istanbul cover _mocha -- test.js" + }, + "version": "4.3.3" +} diff --git a/server/node_modules/@serialport/binding-mock/node_modules/debug/src/browser.js b/server/node_modules/@serialport/binding-mock/node_modules/debug/src/browser.js new file mode 100644 index 0000000..3bf30ea --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/node_modules/debug/src/browser.js @@ -0,0 +1,269 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('debug/src/common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/server/node_modules/@serialport/binding-mock/node_modules/debug/src/common.js b/server/node_modules/@serialport/binding-mock/node_modules/debug/src/common.js new file mode 100644 index 0000000..6d571d2 --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/node_modules/debug/src/common.js @@ -0,0 +1,274 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/server/node_modules/@serialport/binding-mock/node_modules/debug/src/index.js b/server/node_modules/@serialport/binding-mock/node_modules/debug/src/index.js new file mode 100644 index 0000000..d0b8579 --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('debug/src/browser.js'); +} else { + module.exports = require('debug/src/node.js'); +} diff --git a/server/node_modules/@serialport/binding-mock/node_modules/debug/src/node.js b/server/node_modules/@serialport/binding-mock/node_modules/debug/src/node.js new file mode 100644 index 0000000..3044efc --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/node_modules/debug/src/node.js @@ -0,0 +1,263 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('debug/src/common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/server/node_modules/@serialport/binding-mock/node_modules/ms/index.js b/server/node_modules/@serialport/binding-mock/node_modules/ms/index.js new file mode 100644 index 0000000..c4498bc --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/server/node_modules/@serialport/binding-mock/node_modules/ms/license.md b/server/node_modules/@serialport/binding-mock/node_modules/ms/license.md new file mode 100644 index 0000000..69b6125 --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/server/node_modules/@serialport/binding-mock/node_modules/ms/package.json b/server/node_modules/@serialport/binding-mock/node_modules/ms/package.json new file mode 100644 index 0000000..30c94de --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/node_modules/ms/package.json @@ -0,0 +1,69 @@ +{ + "_from": "ms@2.1.2", + "_id": "ms@2.1.2", + "_inBundle": false, + "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "_location": "/@serialport/binding-mock/ms", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "ms@2.1.2", + "name": "ms", + "escapedName": "ms", + "rawSpec": "2.1.2", + "saveSpec": null, + "fetchSpec": "2.1.2" + }, + "_requiredBy": [ + "/@serialport/binding-mock/debug" + ], + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009", + "_spec": "ms@2.1.2", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/@serialport/binding-mock/node_modules/debug", + "bugs": { + "url": "https://github.com/zeit/ms/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tiny millisecond conversion utility", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/zeit/ms#readme", + "license": "MIT", + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "main": "./index", + "name": "ms", + "repository": { + "type": "git", + "url": "git+https://github.com/zeit/ms.git" + }, + "scripts": { + "lint": "eslint lib/* bin/*", + "precommit": "lint-staged", + "test": "mocha tests.js" + }, + "version": "2.1.2" +} diff --git a/server/node_modules/@serialport/binding-mock/node_modules/ms/readme.md b/server/node_modules/@serialport/binding-mock/node_modules/ms/readme.md new file mode 100644 index 0000000..9a1996b --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/server/node_modules/@serialport/binding-mock/package.json b/server/node_modules/@serialport/binding-mock/package.json new file mode 100644 index 0000000..3c83593 --- /dev/null +++ b/server/node_modules/@serialport/binding-mock/package.json @@ -0,0 +1,56 @@ +{ + "_from": "@serialport/binding-mock@9.2.4", + "_id": "@serialport/binding-mock@9.2.4", + "_inBundle": false, + "_integrity": "sha512-dpEhACCs44oQhh6ajJfJdvQdK38Vq0N4W6iD/gdplglDCK7qXRQCMUjJIeKdS/HSEiWkC3bwumUhUufdsOyT4g==", + "_location": "/@serialport/binding-mock", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@serialport/binding-mock@9.2.4", + "name": "@serialport/binding-mock", + "escapedName": "@serialport%2fbinding-mock", + "scope": "@serialport", + "rawSpec": "9.2.4", + "saveSpec": null, + "fetchSpec": "9.2.4" + }, + "_requiredBy": [ + "/serialport" + ], + "_resolved": "https://registry.npmjs.org/@serialport/binding-mock/-/binding-mock-9.2.4.tgz", + "_shasum": "8adf34742abcee80919e19f1266423ce1c9407e2", + "_spec": "@serialport/binding-mock@9.2.4", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/serialport", + "bugs": { + "url": "https://github.com/serialport/node-serialport/issues" + }, + "bundleDependencies": false, + "dependencies": { + "@serialport/binding-abstract": "9.2.3", + "debug": "^4.3.2" + }, + "deprecated": false, + "description": "This stream does some neat stuff.", + "engines": { + "node": ">=10.0.0" + }, + "funding": "https://opencollective.com/serialport/donate", + "gitHead": "494fd0f097e25fd5475e543f80bf23cc05ea6abc", + "homepage": "https://github.com/serialport/node-serialport#readme", + "keywords": [ + "serialport-binding" + ], + "license": "MIT", + "main": "lib", + "name": "@serialport/binding-mock", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git://github.com/serialport/node-serialport.git" + }, + "version": "9.2.4" +} diff --git a/server/node_modules/@serialport/bindings/.prebuild-installrc b/server/node_modules/@serialport/bindings/.prebuild-installrc new file mode 100644 index 0000000..dc9ece4 --- /dev/null +++ b/server/node_modules/@serialport/bindings/.prebuild-installrc @@ -0,0 +1,3 @@ +{ + "tag-prefix": "@serialport/bindings@" +} diff --git a/server/node_modules/@serialport/bindings/LICENSE b/server/node_modules/@serialport/bindings/LICENSE new file mode 100644 index 0000000..800d776 --- /dev/null +++ b/server/node_modules/@serialport/bindings/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright 2010 Christopher Williams. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/bindings/README.md b/server/node_modules/@serialport/bindings/README.md new file mode 100644 index 0000000..f559f07 --- /dev/null +++ b/server/node_modules/@serialport/bindings/README.md @@ -0,0 +1,13 @@ +# @serialport/Bindings + +The `Binding` is how Node-SerialPort talks to the underlying system. By default, we auto detect Windows, Linux and OS X, and load the appropriate module for your system. You can assign `SerialPort.Binding` to any binding you like. Find more by searching ["serialport-binding" at npm](https://www.npmjs.com/search?q=serialport-binding). + +Learn more at our [bindings documentation](https://serialport.io/docs/api-bindings) page. + +# Android users + +When using termux there is a way to compile serialport to be used under Android + +```sh +CFLAGS=-fPIC CXXFLAGS=-fPIC yarn rebuild +``` diff --git a/server/node_modules/@serialport/bindings/binding.gyp b/server/node_modules/@serialport/bindings/binding.gyp new file mode 100644 index 0000000..c8001c3 --- /dev/null +++ b/server/node_modules/@serialport/bindings/binding.gyp @@ -0,0 +1,68 @@ +{ + 'targets': [{ + 'target_name': 'bindings', + 'sources': [ + 'src/serialport.cpp' + ], + 'include_dirs': [ + 'vEhTyfmu0t5mHIy%BQj*Oy$gHk=9ATFQ+{r%3Vy0@!ux?Se|-tYfB|HsyF z`a4Zhy0@3QvnF&%Na$#&PeRQ}hxzR@6I^Qzb5_I4aye3ID2FXZ&tB662tCO*YVP5U^HmiE} zYhP8*yiyzVnev&h;J;}vTh%*3NIv#!CnbkhV2OI&|#dPVCUZIH6O9 zG2ZyokmP~MT~j-yp6qeXtm)LdnRpf9uNZ%G@mGSsQv6+qze@a7;cq_v7UFLa{;tR0 z4ftD%zZ(4Aguhz+)#0xmf97WyzTASpTNQ%R;V%5$jlX;G_aOcr!r#OAdjx-v;_os1 zJ&wQY2A779JeJ&}_x1ycJx|-#dhab?>}gE@=;f1!e0$=Tdq29dXtD3AW45LYI$^?y zq$w{pf3SbAF=@s<%MT_@SpPxqGoCt7)hA`qfM-tn^D)V1ocrni8!uXS^48~X9Jl_1 z%t!w5%qw@i z()_{FH&~DEbLYH% zdCGhK=Q|udb?fsfLwC-;fAH?j&k18v|M7zcY`N?Es~gTtT6C8`@Nje5`VSWMJN^1j zl`HbnF8(O>^K0`5)jWFRr{_%?Hhf91tON?#lpA6pDv}3ey)z=M`xV=?XEcfIwp=hUE;*y;y8TniX;EcaqRh4oPPDeIQF~= z!5PawXT*_zM;!alML!dZPi>rjwPPH64vnMN$#LjUilZ;d;>4f*b5WfBb7>s@E93OT zFUILt?~gN%7studnQ{F4S)Bg4YaBU29#h}*d+p2-dA|%MhQQN{G`uN9;bR3jaN&!J7D^}jP|MB@~IMDqvZS# z$3qWe<{F9LE-ywJlqGuO&k}L6!l$zzLBB;JrYroNh<~E5en}$wA`j_vGw9C*zWFT) zD{+k8@XHxSFQZ(oM^j|6QN#Y~VKlrT5icwJTxFkRWuG>MKNtNWwVS$DB2H254pa2| z|03}-75!C8FQ?M$6=jEuV26i{Q;d`oBtn_fI3Mzm{3(Bv3??c*>y@0@FG|F@3jZGB zkmSj3kchGHH+|ky_D{J&!UzxkG$=bX+U!t>xS)1Z-X&i5*RIqM~#cNCu!aV7p+vL*gKh5uUFGu39#o=V?rg`cGKy-(4v zzFhJ#(n^%DQ6ycqW>d+vBb zB2@YsgA|{J$0WW`$!Wxiw^GCr*&$ikxlHlD6mk)M^-PI)5PH(*pK{s&lQ}Udx^1b;TNpHsC!-`Mp0*N={@GmMa?D;!U;j^EY^k#qZg0kBV)h^7% zpSj8}4fjacjKe>vxLVyL@z22D^vP3l&Qx+vm1tv&YPVYD=|P1r2A=Y(`fn1U!pnF^ z<;9M-CElaxzf}I(ul#tGvRjRc+iDdEMT*|Y&7D23tTeaMmsjD-%{6i}r%uW(@K$(d z7gzec6;mgrmz0%yr{>Kn@yfE;CAs+v^KuJ|OY=&KuLt4u$wTIk8gc2YIo^EVkd!GU zWeX;HeVL_T2#N{C-jV`$F;QItvQh4Z5^YXp2756+<&E@jsl@^qEr{tHFdtF1)E4-*FQSR)?Q*te~ zBNbPwN$Tg%&CM^Gn_HMyTmn|E;qJ^!bJGeT+O+Zlu*e==H9vPjS;gGkO4X9dz?A~! z(yJ;eyrn)%`Y18dUEH);!L1mKnBuD_E}iXiP4+Gz-KO~pM@186Uy=`zT|+@2X{RnK z_e#^ja--b~^S$N1;dKFN2X6M#LVe z5F;j*l+DU3vD6uo;;zikE2l8f%o|IuVWnjSu=}LEx!&}=l9E}lD|CXiX7i9TB_d`@ zt_l;#IeE&^Tu7dhJ8D8zX+G%%WHFqk&?-QP5H`uHTvVE$o39j5CXFrU2o~P!&W;%* z8ABp!UNOowG^4n(ysXlzEFkMhtwy-#75mbt-3)J~ucB;GJI!LrRZx;WKX${esD_73 zEo0}o=au^wafxe)6@*i~zUT;a4YSISqLsGz)Ji9mR84y%94oow~WMsl)W}+c1$LCcQTplyqRG74HlRQuT zh-`8+H%Zd{RHIt=G!&MNOFDUqiy|`Dio7Yq(M3+z`~sPytv8&#arq^ahfdBb9g<>3 zvY88+rG;gg)V#$qT7G1SG#Ph;5xra~nUy9lj*Zd<98)qdhgyM|Sz7FC7nMJkZ;`H| zz>UtMXQPxq~GUqI$Q{-0S_C9&XswqKdKwR`(d~U)}P0E-aUuF(>BzX4URH%sg!2eCu+#HUky(n-ip(C> zY;;ypRR78tM03_q++M|OGX_*1x<=R~cNa&=qg$B_+}>8b7}Z_qG^|#ljAnBp=zg6OUBue# zLw{Y>Vbs_Ex+){&%;?uu8qVX+uNr|^&825-#DXz~stp1KCpXg<2 zypj{qpYRO#VzGu!o;7Mdh#nh8Qs;-#Xe={}HA;_~?e(!JG&z)gP?R1~QzzfZTuj0j zx?HXyv+^p7^D(8R$z^8#6ranLUzAso>%&m*tIW)IPszhS+`ZA%M8&B&zCt`Lw_pP; zCff~%RCmg+Zh3U>q}+U-m%A^YH_w>ootIy}2&^FK=-gZ%b=?>)WnkWq5~Uyf(pYg5Z)OK~j@ z@m-@KP)1o5mNow`42j{pYThhw#n1LHtcMy(Mr3(QXZwmU>6?f3R2gzX&UaPu=qoFV zecl*L$Nb{#;$ow+v>e@luh2kuP~t76OKE;yr8j?Gxlvf*rM3Df>Xqy>eOkrk&MPaZ zD)Hu;OMWugFvJ4p=sc$8mHKF+;zAx|s$=rKym(0kZT$b;n{eVcLS!D~dFbgcrUo;6eDxMW7oapu03bUh2r!2yrN<`l5V(3*s3o!8D z^@1xU+gnjdJ1?a^UL{0U!qoQ;89BMEG`*~R5v{``lv8ELK4l2zL2h$3OUsY{8|>5? zRkD-a-IW!2<*p%Ddh_O*s~R`PW}f5eNM7n-H7_U9b_TI3pe#7`3gwarE1nYC70FN* zQuB?G@DQ!X-PtY|mNiAZ8723O+SN>va;chDy9%b&Q#s}^7|F480+3I9Nn*1?bjumh z>_!%-J&IpBZ;Fgpu2C_TCieNlD7CwnR)UGQw;;O=y^Xhmdef-Na!I2EPagu%)Q(nQ z1fXZ);a*b^`%AnMQq_3D@Ly{)lxFSGQf8LgWaQb<#49WdW9AfDJh-WzUL|5rLf`EVEob5z(%%zwviIOm3y-7(f$ zBh1yZwHP-8II>b~zYvX@&$Z_&C(p9SGZ%6uf7i(DiZWlB4;!^6%93xCiD|#-G>n&$ z)UQcr4`YAGevUYnWAeKw4MSz|tSX<^ZIl$xs`M4)pLgEi%Cf;D2rS3M8T;Y{rx2Vk zOJ)_97GNDvIhaOtV`5h3`1G8d+@XVq4Ibh$@HK6GX0B`S(7~hiGOa+ObB7EbGRpco z%=+evd<9DjJ!J53++Q$n6`8jh=oBgaM<4UwPJGf--J}2>w~z3_%}GTeF%m0JlbR*R zSQK2vf+B4YKEhe2l33gtQZjbstGaa-Rm;>N0VlBkzx_|jpMVp(O()5F{B$qqx?sA)B=+{shbN4pzB& zE*wJgr}0vGovH3Kn|Sk_e31=5Q_(jcpTHGOdK2Dn!}r)J`6t=#>-JUnYQ>+p(U~Fh zvs}YJVj^*E(D3HHR4Q(cgI}rPtBFv3HpjuQ*6!xw4zZ5p1=P@A6}8XkdWeT0UmbJON$zlN_dk+>ex@HcCC!x52R-BRV! zBn>}DqfgfG4H~|;hM%Y5of`gO4c}kG`!sxth7W4^Q5t@shELV-^EJFj!{4sqvo-tz z4WFaoOEvsV4X=*caA}c-|Gh?EuHo;{@C!BkN)2DF;mv#KRJ>fn*J<<(8opM;uhj6j zY4}DBAJFitH2j?!ezk_5rs113{NozFS;PNP!*AB`4{7)<8h);Z-=^W0X!so(UL9@W zQla7f8vT9^pR3^yY4|)Hulg&>f?^HdJ6Yxhjg0b}EOcskbF8A0{u=%|Ny`7GXn1{W z9HrrxY4oWYUL9fJQjdnO(CD)@d}KVu^FSK@7L9(UhBrrfDlXFSq_g=c*YIXvPh|@= z{7oh?uGJbI1C#YxuHk7OV161jym=!o^%rr~ik#ro{f@HkpyeT0U`(HHBpU&CWq zw?2n7yc+stS6mKUc%A((vbL_|+PIpoVYK@PjmbvxXn6;Wume^ELby z4WFXnw`q8nhToy#hiG`A;fHGY{ThClhCig?Y3*Zuj*GnTAi%@bqk(`5C3*$CyZ5Q#Jer8s4Mf$7=X&4L?r9=VY z*6^7czDdJhtl^tA{3RNGvxdJSsH$uhM%P2cW8KheIYdbWQ~5mhF423EQtn zhHupH9u0q`hR@dUIT}7k!(XN0XKMIAY4{=yKV8F@Yxt`*{6Y2i(hX4P|*RLI?{otwHo8$>3?tI5E zJoU}K4&g1H+KovqtYUchr$8SF_xm?4j?)dI=k@r3(9Uo;+`upmB?m%VEw}^2>n*q= z!_QeTP1p~F9hHtmv&J5RBFeT}M&~+9}6YK+_JPW1?^nuW27EBZ81EDkv?#i&s zf@uPMAasTW)5Q5esHX+fg!w=y!GawOe|6Nn)fjyaz(h zSujm>p}z&w1ouGbb_=G7?SW8@1=EBU`dctfWTC$W(*zd!TQE&rp}z&w#PmSOWx+Hd zh5i;y6H(}I!88Gd{uWFV&jX>aj+pv88Qy8ZG;xIf7JMed>n->!hM%)wnjk`d3#N%7 z^ta%%8LqKlng~LF3#JJm^tWJ|_(6XQrU@VPw_uv+L4OOT2_E#fV4B!Le+#Aw9rU;0 z^BMl?u&F;y;NX7?rimN$w_uvE!T%Oa6E*nXf@y*V{VkX#X3*b)X+j47TQE(;puYvv z1PuCHFipImzXj7o3Hn@{Zkp9Etm#k=x@O^07HKZ zrhymwTW~JJUwv=tKa=5|7M#cMRtu(q82VdqKEuyhFb%xW--2nth5s#>23qKE!Lu2@ z&Vp$Gg8mj<%l3!clc%YsW7KEs0NG2GLFOBqhE;4+54I%Mik6EyhWg0EwE zs|8muyxxK<8Gg=!eGETj!WdnrwbAH`yrA(E@RH5ZaFq?7XM?>qc!mw0W`if$V7Cn( zXM=~^;6XOHpAA0M2KTbT-EDB94L)MC$G0~43mg2I4gSamzh{Hrw!xch@ERNZq78o9 z20vG=&Hpy|3mg2I4gN@nJ;8C`0uEJU zLWl1I(3U5dcqUy&AM*9W()Y1ux%53Iyu)#NwSiBIx`O_D)b#|1AE3*CqaOc$&-yPf z@~l79(UZ{X*?QD>0vJ547$k*v6!JK3)~E5jdfbbsYgC;#%~LyW&N_Vc_&@V?^906S z2)y|IU^pxau-I%(3<6G=fx1@vR6n!;g-RZRr=fb<6=~DbrcUwrf5hrNB`Ywpz!T`y zuRrs4Z*w(g25xjt3YI!Ofr(+q%c))c8wNQ$;Z8s6*~i}|mSf^i^)vk&+gG1IiL3f1xV}S0u^p2{kKf%?=y8;`c!Eos9Vfb*90T0V zY2kl(0`6@Eo}p5#s>`sckaBg}HEA=_t|b-g&?FiUl$|7Y%Z9W3Uy9c;=^}o6o{@IU z3d}xTw3+3fi~G5}Ep#PJA}&JXg@uDnUXIgKdH%%qxiamFtl*OBv}u|CBV?%By+yi- zHoKZdBMhJAM{}(r5o{*~yoRUE-ArPoRgdj!IO-`m0)!<=-b^@Yb@zmO#F2Rh;8_776~^(Yg` zfHMPk_3bSydg}k~>*@&%5v!Q{29N*la;h7m)&nmRp97BMOOmpJ?q*Mb%g_wJkl{d@ zBe{+R5FfIvt+cU|l;uAt&V$Y9`Y<>4x@@dI>`N49pc!#1$eC+|1WghTE=NuFtLP3o=%c(D7BiIf-{UrJKpX7J zE5Kc>hYFIX$qW)_!4PXxlp`MmndQhkSfWqFxs=gSj!bXo$W%k*lYt_B{LJRZ0_Gz9 z*i3%B6YSOgp_!jQ=Rbpe!2a_>KfC{&rvJ8mE&b=z{I~Id&3~254E}op)TaNgg@4G8 z^C=nNzuQnI{6rxA_a*RR5wW-X?*w*)<-cj5`6d3F1UlV+55OvvJ-r}ZX29~_Jpe_5 z#Z&X&t!URu#7{tG`S0(n;3r}ZLgE+r?_n}feE&VdTr~f^3--!?p^@xt>H)aF4V@DW zoBqx8AC-et@B!+$kfICiUGS;wCU)^nP_W%BW{e-J)2eUin+y+MLdo~tSJK1D znukB#Po|U^N^czzw}V$!a9#uYmDOS+YIqVGAt8+>;za`C=y`A`UF#`daD4!Hu@e8F zE2Dnm2=HP#VCsjHZT+y5oku<|qMXeGnd$SR$l2AVn*v;pW?rFf23<$2w*a~rF6>$Nulb~IXEdP?GP$fqSjRWbZzh@7eB^w#W;;*3wLqn*)$cF^B z{vs>5rX1x~Sk>%Z4h`)g_2xcmn=CHQr?#U*iaHGsMa#n=qfTG%G**1c(ZQYm1@N7? zkW@EA>N?cWLTVO)Q2P|_3EIREj*b>_G4R5Tf0Qk#zY)U$x9dZ;fV;^o2HXcSE0}I0ebF7AO?^pp zFwKS0JT)81;!*K*wX~V&2&NQQG)XX>dJ)RBpjyp>*UzNn>5C#ZPzyO~nF`{+QQQQW zLIu^>FBDy?xDGAID&li$wEja!-P4p{+d$*`J9iD3r=MF-07$rHL9|A>6F^xwrl^fu!kW{MmCAZr)@ zdq^SKrP2$c#D!!lEB?u#iH&SZbg8r0zKDPJ9pay(8SxLiaN{5LRjYV{;&3?N_VLg5 zi^M-@eo_2`E-L<&PquO!k@yF9u?8BokAIjY68|8J#6Rgv@sCim#s6a1BWCUO+jCP0fAPX)mS?t~MYVKsN%7am8(7IXMG6XlVpU2>C*+HU_L_?e2su?wtp|TdaE64>ZUIRgnUOD~!C($8nCxal(@zSk*&p?(gXA1ELaCN*SsdaJd z-q5A>fhr>HyERhUYeNxf$48_U6WU4o2(;BC{R}>fDd|8Z=_4RuNzaT(x*x6myrge} zDkAA1CFu(yBI!cv%2aP~Kd7T^`UA->`ylEKE{G@TO{5WQ`U4!#lAaZjbiyx^)EOn| z&DGMT$7+&3!^tN5tpmVEOPU=m>Fp52qug$GTAxtwx=ngRWP?CF$?T&#ExIviuA$9- z>k(!q`>k)W%F)WX&#dEe*3nF8R*ov zc42aY!P_B=`Y1hSLs|L$1vJu8GAmW4@~ zO7myX3~x{PH}Uv-P;^sKJeBhfnzf3npa8_8uSYpM4w9agz_OCZLVAk(m?g4#(tEF~2DNAd)hnbr zcA#9%*m5An{C)b0k12Qq-5-34T-7TT7qugkNZyH_u#}KEwHrO!Yz6US3x#oL7k;kq zO;gT>&&WFS8rd}a#8)U2Hvk7Igb!D9@ev&U-4f~5Yj>ep9x#3L#dQE6E7|Qa{<=?m zj35co)*c3X72oiNcpuVIt4k@cPl;}IF}2!RwR#kMBCVF+AX^pxHe0Q_#p7SHQXE7x zp1_iop@p)k4A=$jgt~EJkx2o=E6;)*dj$u6q)Qz2#h?kz$3JpDA_7E%_#O%$fF?AM zlN)*MUMW^^JJVK%E(B81FD4cDk|NJRay}0v*MFJ*Fm1uTNZm!+G}yH|ZE9A~+c?Ej zvzG=%TgHmxxZze$us#(v$g2MOQTQf`VGQvNbXGxm6~Vh0rZpSLQiyCk^^bwO={s#r zzMtj4yFcOI1mCrYS*QS(E#eO_zIc?YldsI`9l1KQqHaHf0!j{^|DqD<*Ds+We{B)@ zByRnOXpvfR)OExmAx~g<-4hg()Hn+@h~nM<3Gc6BSQl@98V=8aGo+Yr%rVkncBzbsf9!;nbJDId=MH!EApAdB z1!;#4WVWYKS?Xfy-4zmIxFcyv?<^>*^mdubwubt`_qnjR=tp*v{=S9VWPgVtwfF%nBL3c`dY)aMgu~b7n%?eA!bExd1Txw>RE_rb zspQCrKdyzUO6zn})mD*Yer*v;Ac5}fHQlHo>FvCB+}DwnBis$*Zuj;jGDbuThtxsw z8m{6*X2srKOgeXFSkLYPk|~C__kvRQ_Upv14aSMqyB}A#yj=(?rT34fvaKSSoxo9E z54O6uKkLfg{^O%j-o6wSbZ_tb_-DO67B&$h$xhPS_p>?J+da{y=myavJ^oAc$=q$? zyN{@$4LMigo`9onAqf-Z?X$^fThV&7*5{K#5r33JRi*Vb=>;0APBFi>h!tpD_xAbR zko0zCJMLS_$`S6|f7`u1gB`hByvL?JDBi|Z^k-J=?I3uF-VE#Bo=-Bx@b*zq>fZhv zvHKT{6Rr11u5NjIA*htz-B}Lm2gI4|1ormt!B+S7mB+HTS3eTv?L1V_y`6w|qx$mp zxjh*c7nx)y>FsCO9PI70(55&IEF!u651b1kZzpX>Uw$?Do82A4@z!W}k0h&o3aV(e zQ%R$ULuz0JrFNlo1F3zU`L#tfQdDVOc_TL@-Cfs?`=?~)2=}vyyWQQT?8)8YbGGe4 z@iDGqG_zuN{}DXI0ETsU-%K*aaJK{Gy1PFicK`X%uD6G)TkiIQO6h$X%fap*%3ff1 zuYv%&yEiAXyA%Et)1~1JkluQkUzl+O6{Aa8_3;R=GPXn9vpOc*KkA9-H$?s=wRwdUW#zfAntZ|uV7E^ z7G1~zn5l&+E~hgqcK158C@yALcQ@r*EO)1XTz9ttwxVl0$%?tUpGet@$RcuP zK9#+|?tTLtba($bk=^~n15xh26BTrK4}IU}?)JTTHOaS_{X*)A9c&Ix?`ddLWP`;k zVSHSF$2>k;_2yTh1{t?BKtBurFt&mp7rLe*%0RFXmwf4l%AC~w~@y+9INYkqAJ z?}CHw?XR&XV9wNDh6vHzdy$nR+^-<+c5go4TCj;E_#|3rGl-~Ienl1WF>3Rs%nWcBTc}-5 z2UEzwWZsCI%Q##@h-|g=S}V;jMsUGFF_^DmQ3$@cYcUG3EKUK=wzcv-meZb~cU#of zN*$Kiq@rB-77!;H1)W%tGL>zq&O~r1zwLhZj_tnbjCaqa+^6#YaufiP& zv)t5t7dc$<|1_#x%C}J~KM(g_%=#w(N5~VZen;F5Gs}@uEPtI=zdS~HfmZ&CR&Mgo z(D>i}ZF~NGwff;0<(;&0&v%jfCjVU&BuaidXB3fNhVMp{oAy}|RW9|Tcr(klY2_yW zI*tG8L+$w&X!TF~UN4vYGqm#ATDi%;ug0H_dD-Rfq}6{as$BBlh2%2j|5htE`ENwI zX`i=$jPMsvaseADly#U2swu9;oxq3g1wy>>uC|{SeICi$j~->)-HPl-A5Xaxy&t_9 z*+!eq^xI*P{oC8NVgr-5@x-AmkTqDfT6PlD6<_gpVEp^i*05+RIg8Q1wTd8Q0|AXT z>wj?8HD@^7{}DMTk8IQaAh&7t4e^m%r2yZcNbYvK(E#oCEJ4#WXXyvNbUpRP zRR5i$E)(L4Yk-LKfO}`tpwlKMyhGLGU92%6quuV~=2Gtf>An+>Q*pc9ZgXFFz#-b+ z*0#E%_PDX_josi3|6Fb7`S(&K-sAi$@s6?coDLn$7WAFx0E=qwJWm2u%$?@~GDx8N z-FK7sdL6|@?K}s#Ks)#5sGm;a)NUN5b&uNqFZ)z&$cLOqDZ(;{DIC2HR;GR7gGUf% z9UvHaodnqkwBd1VWeaqXB5kpLUb5#-cg;$ABFd$%Gc-5Y( zwD#2013eP zM+Y;+CbmY4IP#XX%A@cK<=+>8qw;S%5Rv>_=9Q7q`d6wJoqu=0dn*6VA+G=9{A;VF zn^E+MC>PW+F^yV@k%_NB+gO>HK=ghy6I(zPGZR1HVCw$v9h5Y^GH_9um;f8uCMwzO zGtoTP9f-<9y8jc&!;$bJ<;Fe=x9ed`Ee}70l%fzg%EN1MjpX5$SDMdjb`!O#;h^Y0Bv_r!Kk()84{%ieT?0fU z|N7=h4^7xi)uZ$8xB@Hx9;f2}_552;t;EQ`(d21$Ls=gQYglMA|I$GfGykTOX#(9p zyp8kkFfJXS)?`2rq%D*4lr1#Z0cr^?zJ_nBS?_*pe`H_w1RA~s=+zJWx z{Cl5z99#aSLt88V?x8kh{{0BNSf=>j7{%Y1Dft&!{E>f)0hr?-f5rF*@uTu@B-s31 z{vA&=H2!gfMd#m1EWeq5nV^W9f9i>l`18-NWe=@S|2%LUg@1^PI?Ce%x6yf?tU!5^ zSVU?C=VAJ}k$tdFyboESbK2|F`HPdyoNE<5AR6z5MW&yhihprjbmUVOD>}6weqRB9 zYW}EfUeaYqx~xDE4litKL_2a~`V^a~MeN!n&2=l>MTz+jz-D6hMqSYYL?kh%%#f~o zdLvbniAmFKnwTz{Ng<3|#$nNexSEN{Cobq129m`I0dNlEmrP9alf^`0LzxGQ@v(W!fGTFn?dJIDo^mUvTmmjC<$6%cMjv}{lNF;UpZt6U%`bD| z9*X&s(Cv#q!4%|H<_royVoXi-akd;jY;8o1(6cshE0#L4pt_7yBfdi=ai=@yRIiD0yf)!Ps0)1(mdspIlp7|`- zMV@^|1OHA)pq*!kdfsF;&K%`r1x92A3X|+hJ^zfxEdTzjgdM(Pc%3u_9?9~1t21j4 zI~+HE4Kv_df}?&bzTx0l=jCqrU>hh_jc@JbM9z6vW!7M!8D8qRnI1jK3RE?UZ=h?2 zeY2vBE!1C&1A1a6 zSXJ%%ySR!|*xg8>6mVC=@~c^(@5K3N7wT67-5AG5%n~RH>z>)IFp5IGm@5{72cl;=X2%J8>2q2q#b%0pr&r)~G{xo1MVh ztACdSRJuT>1-WJ~u@oK#=p(z)1R^bdB~Iosx#niZY^n#`9hF7v|7NsBNa; zAy33_CXSwc<44yJB6MKwE)qDv7&x%KFBP@8hO|&FRrH|{JZtXfhzp=`XsGn(z8v`K z2N+0rrNhkD_dH?J+t+()yt6-864`H=(h<5v@3-W@oHXEMa*;XS-2sSt3*lb}krArW zH8i2#4Ux#!=d+j8w38fj8pPD6oBl0nj*Ly}8NZzrlL0mEz13cfuV5Myqg9Hb#z!ov zAg+FB@B6jfh>Db}DMuj7!yFTwxlR0)gJzNxh$3YJ)Zj?T1WWM(m_&Ne&UnKJb%K9f zL%}Eyd=DYApxG90NADv`;B?+dZr}$rOG;CcrR2u>iwSv|3%w%TpMm(wb6?VJu7;D?IL!jnT z8i@ydU$fo-jobx7DFO5m??M$)X)&aON}`2TYsRA|j=I@kfq?0}|0S|b#x|<9Y{%!76xRGk$n0e1-BtLzb zgr_p+txof^e4eIR>gOXNuz6N9%TEUl@ubpp5}XrwStr!a8odvl_@gkDX~Y#X*`kOE z9O2sw5i$d7iA(g^%4Cs;I$8tpz3({86Uc#&Q7u2Wy{?+9MIs zzLuQWYZ)$Ts_`%iLOW4c?$_{sl|x2w{mX}8*vrW{NE?I*<;?R?OI*n9ZWJSMjYQun zybp(r?tG11M*CHj9zQ>8CI)iv#ozZ_E6;245H9C{pIyiwU2flEQz45 z9|Ot6G*?ImG${g)2=P>JOu}P#rg!DuZhU)m6b&yEmEkn~^^Cv=tZn z3;ux|B7pn~Jq@8`9B{scHd-+5zi^smfE6`J@v0IFSs9vd$_=_AO2@HahkbhbuE;_+ zgGLmfp7lKU|7^UbC$uB;uXho`a=iXCzWw}oy{C!n*(xewxyX3^9zu!6r}06+mb z;2lzy$8zEEov5DRLiP`F&zx>SjTx6dl2fAbga+2M+ zGrD2``ZC)H{SpjGBgN@l)G-4~Qa4V%-8P>(NLrJA_A<{2c1b^CVRYXt2RU04Pl zoBQxr9ygzpf#Ej2a3rLM0js$^U97 z+yyGEln45^xm|ClMKUj#%|&uw)NwVdl{1EGEPwm5OWJDtpol*F_yXU|sZ4IGr3&;Z z%i%)(HOQQc^DKW~T*#0?3#yp~$a8oe9C?qJ~7Rp8);SX-F{ZxmwlL`L|kzfio$SugKn zybJ`Cr`}>Of88zUT@a!CNdL-n^2k2MVzg}CFW`NQv!FW3^f!`e0?8z2%TK-lc!ZK? zaFjg8Bq>kth&*Z^L(YZh(PZ;o7&$CTs$3Y*yr709fHl?Rx)Q9Z{eM#Xtx^k8=sarw zCBS5lXK;RKeZlzi`24>^WVeg=J+k11fx(o0s!NEZYCT#2Q>uC z?~jc4(d+U5+5GIXsQK9*DEVvlQ!aT{`s-a>BmNrB-rFsfu#(}T?j7kbUbo?Ed$ zsWyx3{v1Xj^$X^0he>UlKmP@P!g~)*g!i68xi|@m;Pji>)}GfR{b~FCl$yPV=v;81 z3zlTP4`SCbkeZCyTQ~J`sY#n%Z@961STP=B0{4p6EQIc{Vd-4^X-7}(4+&KcParj1 zSi7+6MUG|lu!u-`2C@bpoe8F@v%Za_I~i!|oO6`){vSFL}@hPH~o%Km*QXKm< zJDU2oi}>qqu>gIaExYQvqI%6nQbqSsgC|(O8trEVpQck$ZS{@#7qX$LdV2j5E~{`6 z^^r#Y1F=LEV3KAKT2dYR9WW~O4)lJ3-!q3caV>Be!5dN&GV{Zp8YB_z;T|PJ)r4uM zV*V&`ANm*73hjJg?Ry?JF4w?UuPy=whN+%zx{Mo&iwL4!x!w)D$b#*KIkNl*a9lCN z|2=Gw_6iNn)HTf_#(}$u%Fk+fR<`193&LGo$-PfKc@rL!kGtNO>0mC_0uhbsG7V9lmRlD+WIDt6>(Drimh3V5eX5}Oas%8L>ye)+y4Qc(Zd!L-2%!A@*}sd z?*{z9b685|;4S>R81=}mC)n!|xD?Ok(vA>)i_bS<6C z=aT6CE?2nF|NKCdt)*Zp^uIO=-!UP_Q{UuvN6*^cK(y8NSJhi<2h%q(k&TZBjgLmQ zqO$x?lbQ%cQq$8`--HWMx7KgQH$!Y7#RF^$f2|WGa%ZY58eD&t*L1&}sco!~^^U!yEAwr0|92XpDhq(9P zn<0*ejvz_`Alm+n@4;XyQTpFOe0uyrg9=VVgAkTfZL25s$;e_Q$W>AwAwg@`5EsKy z_cE1UPs|WCL#TlO7g67HC&eJ;z8tLE%(kxvKA4r7;K~2q>H!YZ$$QxY;LIU0cijAA zB5;AbNfewZ70}He{09HxfFkSAk%W@ObT&D_BmpMT(*Auhm;535_*o@0?RSfrNQnm0|`-i5G83a|u`_&EMRFaoC`)y>11*fG5d;3h&AaV!a}x6%@#P zB@vPr70DkJ2{tU5Br`(tdquKXkx=Xtm$M@z3l&KYNbsVzo{NWpf4WNw4%;ac2p-aZ*5$}NOc_C zujW7Eibtv1Yt*4zyYkJnX>l6%T4>l68^IX!IUa%|JwIlPYLC86bRZsn9u#62aQ?hv z)0MgxPUVKVlU`oSqXFMOD5Tc(u35TrzOQ(mG@v(z0k=M)=|0-h{S@$$tNRpui@Ca= z$mZ$3V-8uQ*H^fx)qSb-$tvndE?7eoEJxiGB%(+}K`4{DJFG85E#J~Cry9;Ai)v$k zXckqW^Rcw+ms$H|QfMh-BvI|Yr zVO%4#&9}#)X>{_zKamsUZ1a7HBkl(Rvl{C0xANEB;uzV4u2lVbnCgWVp*_+^OayN; z9C#m{V!=_r{|JbB@M6o5oxKQhSa46P`gYoKN_aE++-$FWkammadzsvkgWJ2|x%Yh_PBQOQ4lQrOT$9fhOrLZnn^82%B9 z!H_I-7L11mLaX33x(`r`s-X)3SnGQpwn~^ID-?Q!JbfQURj~VZNb)Le-_kzJ7`lv0 z$3;8^_L0>{A>W_JNQoDAIqI^JVM`~}ga=|^!d5IG$8GmRyqfS#%-S4vTY$f@xCzg` z16AG6Fnm{|>Ln6mfg^avF=P|!ltRTQs=621d9;iN8jrSFI)ntr!LG^h=iI_f5pU>7t|?^F|} zcaQlt)Py(VT6JO*b?Ysz=9+L0>2p_eFrzul@G=xITpe!V5u`Re#CJ<=_>!tqc%*5m z2{#`HBX$EFHc{Y(j18!Wz`DEn;5I649b~-P9gYoey;} zUQN_-O&uhg4GCbg5dn{ibsdeW&P^Q^o1IW3L9b%&KQv+8rrVR_QL}GTH{uYncT*=D zoMeOHr6_v5rbCBm{TsaU$Mw5A1t+eq{h{N!6qGyC+hCk(e6zhzxC-wRrUN7V*5#bQ zx=x4%+no(@F(Nu6@EXm~u^pS{-;{xaWsf2OYY(CK!`Uq(t@cRRcP+gb54X-=N30ma zjdF<)(;rmN$x*#=+t;4BDza zbkuj1YRy3!IoOGk`oUR1R%F3O467TJ_1lp1?(+Z%}CMFIw-TB$TsQ!Qxc|@qB)l$Od=OH* zSGKtuU$OAlYnD1~XvOv^9{5qH3G<;$}zvc~B2gwIjnX)aD7jy}24~K)gOA9y+15old}7 z6AD7Z&@^HaT$~(f1RE5A05A1|iL*zkC94R+n|p2-C*Ehaj2H<4;DAGYPfZIQZJ1*E z7FtY1Rm^w-%5Z9(H70KNn76lGKnvR#6k5js2(yvt4ONf>Iixw zta`t8$GSaTt9Km*V$Yh|&8hwkHE&jfP4#Oue>D8l$Vt`E6$Fl#d45H&7CHbYx4G{k za}=&`PHJ=0phUMy9urR^%&K4GRk!ctwba*BlypIMn^E)!;MUQmfY=E=JVETh&}IN} z!0WDX6sB4~@Pd_J^cH~I{}?4DdX4}u%5lVmllKHLlTG+~uO;@>x2%EN4e<(!LZ=`v z*dqS#UL^+N`9GkWQH0_iBH^cwZn&4zZ5m1~f5M7AN0M~W`L-T3p$$inZ!e>|-e0cENB+BwucZ|6zVLZO|)Y z&wOwAzgMzguR}gFSU8xudxC`i5tN;gKoMs`JUn}A<3li9!eKol^hd~{y<8mg8f!lk zy?o&Gz~W?ay^^&%s_sWU5-8OWQy@=9AU_!a+&?0dQ_4iW99{|$Onh$`GO2An!Y|C- zl(-eNER|#>&m*qwH5FvA*3>DuleG({A)#V2+Sj`y;c6yvo`kIf?p^(8lehY{zAz}F zbC<7k?dDFnR=-9!6%7KN4AOl<20JiFxBdWf((H2m9la4Dz}Hs_r=0^a#KmZUJW&cP zz1ZT@wY>>FRH3hQy!1TX`XgDM1rD7T^X$RhU=ZABfGI+cBD5amcHpsJo^06=w{(w1fEbQN{?tdHp4eS4t zSo>+h@;jZd3?R{Y{eO~bcO($5mfvT2C%u1Dq(C&sOYVO!uccQ+CG_2M8>KQF! z&)uxwM$p16PBsQ?^QKfHsy|PGj(eKK0Mg2wPnq!yRjT5s(&pYp@ktKtp`1Jb8e!9~ zomBKDc#=vR?=O+^^|i@2bx8XTqX9H~o)La{FIqnJT7b{!O^$fwJ*Qnd(wD-p2bxSm zljeNj!@JlXFQ8c}A)CM)TV-=st6bB~G9%QR?5y6u7qLgADWRI`YBiN=h)UT`R&+Zx zKh@4^(DHl(3xCJjnF#sNIJku4)RfZ|v1w;v}0)rT7da4kuoetKjGHccdz( zir#QFBgtK9Kawti#VL5lL^YU+J$E3es~ha`#ZQ7$IEz=w!iZFC zLag;bUW_22v%y`io2_`5Dr3J(R=|l}Ax9m}DNscOK#D!t+nxlR891S@Coo?Apv!vm z2VLfODXjTExl`5DtiY_3=tl&SNv$5@GN_f=mVvkEb5-1%3-+3UM5o=5Kx&d_^p+}@ zVE@~sTaJpRJ|K2|C$4}FxYxDkp$5_f8iaRXO}`3jrB_b}bFAsNpHG)@7r9`PZ7>On z{Z#Cf#cO17D^TJU6t}k*|6a?2-k31>zl|)h^Z^h**#Zw%=3v%2k)~%DSSPY>(wSYv zmfO)Te7%qq$DE=WFy9V>IenN4iD!X`+zxsa!Vvkr4OC6u4)TJGZU=b>lJ#+R7VjUT z;y~h)SMq_S^xo7O9r2xvBfeD)6hv+5m}6oiGCkF3OV6OM!i|QI|~qQ z9-fa@6VQ^VioSBtY*J>FD%4S1T;eT_IJIcU5JRidVhZ*c*c5B2{I_TU^^ zfO!j@XZ5?6i;Gz1Y0E=?ASFHH&td$M<$LZC*Pxo#L)f0j`H4V5KamtD$0X{q{vQAP zwYzaoI?VT^ug5*Po+U6}Q2aRflOP3< za2@p-;zjV!@P7wGl6OYlrq%xoE!OCX0X(|!Hxy70FiJf$$9I^iFL0wi^#vTLxIgMk z=9`@d#jRAsj{?ZU2d!&2VV{+MdZYd;a3Q$lnJ4+AN#Rqf%ZFrU%u zA+|$wtJ6_!^k;E528r?H7I?f95WE|h?jvQyFH7mifVLOuOr7vihFP62&J2O^)7O~ zf5~$32+|A3cb11v2L|ocUVmPqqyBBIb|_>DIYQ8f;+$OVQ7o|evBp}FlojZA2d1^a zH{qyJr@rJxKHm};bomtcaS$Zn-?5>))VqA$G6OhsznOiokvtGwf+yBeL}yZhp2gzF zFp6XhiPdDT;H1^B!Xh*_Q15aBmm$OOek6`Td~Fe}sLyX5I!T6drhh{3&?7KUtrv=rrfWF^fFver)D@@@r0fXAxC{S1PWb?e|X;H38W=?5*ty2Y#q8E&B^-# z7#g!l_rRd}Ou*y~+9@do*9^c z*oAR!CNu0Kvjw|*&c(nroSF;{?=*lewMoUF_2=R*sdy)u#S)i) zE?e$r^ZStb_u4SVBhh;8hQ#{FhMlHk7G%)GMjS>P=+^t&c4Tg)=I~Uf`SWSke1!V* zs%G&mhtMYR_ATTI9(RU-lUM_o9Qh)yR)78_Mg7BmNXvIRd}oQ504N9U;jah9S%{|4 ze5)U)h!!h=LsB&D`J31X?os<`*28pAQP+(}ZEIHZ2g1Q`d@hdX@_iZp&&5KN+d8Q|)O_?)w`x3#x}POJ zQdxHy3@e;UB<`vXiW>MxbOVkY)(O{0=8dK>gVVme*>c)sk+9ry+6ex7P?W+Np*-od zI*3GO!+XHPoHf-1)Be?Nu?%9+&73DuV2!)0#IvXl|E}8eFv9%Jvm>*+qqw<(EXX?t zhWr6-iA|6dG>;LD6Ks(RA4r;i110_m8p+q1-)ix{G(`^(+Gc$W@*wKZv_<_g;;cnI z`e7CCiEshk?)nG@QSm+=787p+Ci88=H9Fp(UuK!^EYS);#ru!^^`ICE5kfaa$NPi8 zsd)bfxJSi%^nBennauhLi0Yef%!?DwYMzeYi@g3Ms73SWP!^gezNn5t^-JnP{B3)7 z!nPN~p62ZO#=dO-oj{4}DF%Yw&!b{x`dnFDM8#L5xFNDW=k+K$mQXq@)}ZxAJl|eZ z4u#dvu%-FGnc{yJJ(T@fO0kel#A6KEn@&4T3d}R;SGwF7#7bz3)2BKb(#JA9pYR@2 zZyMfFw+wkHLc}iU#nc&3zx83>`>Za$Nt_EK(h08mN8x?fheR3rBfiRb5_`aoYn#7a zwpwfh%KtIt$7HgNda`H(5%P&M8rJ$kKAN7EP|^qLi=a2BU7Przj_HWVfu>~@Q3ttj zNUh2t{(u@0d!_}dG7i4Wv!JS`Gd>n2i1f_hjNW33R8w@7E)-{h7lt%(0q|mkl!e;3 z4|s7lV3=?eWTwd&rU6xkSdS(trjJ1()*v0}FhBjO82!d02>Hjvvi$$ya&V%VI4vs0 zRSrhi)hn-1&rt4YyxCa3>={W*OJ^LnP&2)N2 zGkL*L_jqS+87Bv4f<~-le*44@m{Ps@ANSA6?}Nck4KjBU`_mZa@%UZvMCj%agD#9F zfq?N4#!GSq?xyeNj~k>C{tHl=_N0m58W>M(1}oS|t9~|DXI3~aC}v9&lRXc!!aSAi z330hvi&zG>@}-*8ilgrHM7HqhnWX3YIHJZvWupQ-W&OCp{u-O1mBe`8By8B>3s47w zq#$^Rq3m=vy0jO*wutU%SR|1tg2VI9h%)+tY8ah=;XoR_0y6QO^+mQ>M-n-}-|;{a zT7;hOKskk@h%&gzuu>^cL@KNiZ*y>U7zZ7?Vb1A+k z`uRa1T0BTcTu%bq95I2klsIz40&Wn$PXJqpQ_zHR#8PVVSccgV>(Gwrh_CToP0CbG zTt>3SaKyjBKzGESsg)PFy6%YMxVq&C*?)gRju31F&WR%|DLbM9Y;{Lm&iewxKXgYq zVl0KBmJ{1={3%C#86vw_jyN6qtJzGQ>5~@mJwzAZfKO!WD*H6*dE3OtOL&mUna<~_ zcVJye9pE8U;2gjRLR6bsAAJ2p9FfMB{c~XW=MbJAiJ=+vc%Cz#`eX)%=w)b)ds%cq zu!odIq%a>|CH6Ay(keb+q4{L@rD&KXxsb;BG%)c5EH7G@tE9DeGl(n7CeN=Ks* z1?mnWdlF=F03mMOArnb5je8Fs%JAv|jIvbN$c4K_Z!V15lvql}ihcvGoS)DfqX`Ol z0;lGs%XR59M>V|!?|HM)vKG zpj;(asKXDDaQt?z2>+6-s{S?RvA(O?Kpr}nxN+6wae+^BoCSEfnuWpi8KJiLoUNSz+^<0Es z;?7hUhwrD*y&2|yve|QeT|s zGW9);_95|>D!aaOR6`d8+>MTx-u17q*=aZpWAs+vIsOgRyFOWaIx4~d)qiu=edus+ zAnUmsA)!lE>_fuMAiewa!@h)3bsU6~HyLKMG@(-p@A*VL0(aTs@9VWJQgB+MT`blg zijn@^1Mb!9F%R64uso&}a_FY`1aOyU^T3L;wgrOx_W8{Mzggfn3;bq*-z@N(1%9)@ zZx;B?0>4?{Hw*k`f!{3fn+0N9z^I4Wu?Y!uW!71>8Vjx z?kzQ{%JI$!uaRF;R_Se5Zz54sH9Ny8X2IaW=Tlkkyt0C-5^v@CrFo_FH@L_s@s>Kr zj&o*Co|-!;Eyt+zRpdI)80SoB$LmsvVYX80HN5j7)x5llxkgz*fl*nWm+v*uN@Yd< z`4No<=a-io5fD!%dGpIk3t||=Sy)w??<(eSI+Gx7T-Ua=+Wv3M7Y#eCfPaM1F zqU{ndg#^SYE6sHc$t^A|fj1y)m3MGu@%7&R12nfd&pz9Erey8(m6bV5%1USBp6XB7 zv(#BOYmS%Rr^lZ&%|JcVior^+&sheta+07jn%tOLR9x{3+|({e(#uLq(JDAzD)}mJ z#mfU_FM}O2%~v=|ntsff$oKx_k*u=(yb`wg6=b0cP5Vmi_OC1C&vzI7;a>WDf00r< z)m>3hRx!reuhI#1eFzd~K2or3o|Ek1tUx$9%L<+S%LNmTHCnvYFuppK^1D*MKr4-HR8Q}f} z&JxI8O79qqmcybW_x=((;%6Dd$Smb-ancKFoU`zX56f<_5erSWOqZfi#{|%-M6aFk zEz)b4?C6CdKg*8ZDdD7kFyaME8?!0RZpt3eGX_1hih(UGsj4iBfiI}YE0!IP>L2E# zBbGUTDQD4@6?y0@uJq>3P0uSSnU$A6SEW0}rjE`;V2tHpj#Ru5y+OQwKqhJK0`N!n z(`C?w72d+iT<19IgN^yc6~3yx5@&3Irj>%W{{Z8Ra&JXtaU}x6*MGp^%u4sXa^IpD zc#;%o*}#QA&;N4fP64LuGWFc{R+&~xV%xG*YJcGX=hX{}eMQcx&T-D{vXT;S1>GOP zN9sN3!pu_SRB2wxgko<=L3&vgDd1$uBwcL1$sKVTG|rH$H7nT1l5!TrK%Uu# zOk_Nwfev|Kqm|ki#0$nLD>n+f=%33d9}|Ap@d5+)lBpBwhQk$o@Vz7#2hef70oQAA zeXB4WUWj8a_s_;_bpXF!6b?7ydjFhocnhxAlwgOxqha(Z4Tn>39f)fNu48e{!Sz<0 zJX=mzJSsrX_}{+}cl4+nHyP+DQ98Gsh3iu|^LzurcqHH{g6|E7x8vIFfpEARPJnFx zV>nE|se6B8I9!D5t&fGnD{&pWDjeR3>kZF@!{6XKaCJEBguHv717BQkSQ`%CN^mpe z#Mw6U=a>C<9dP&UnAlA%Z-GE$qB#f)+MO{ zH@*7;k0-zlF)bXP34M(o$rF0?zSz-qK~lAG(J5oj9oqLys!H`U@aLQn4)a4ggv5vN z*Wj-=@Yz&fefr}{W4+TG4%15w40n&@WgXJHcb<4#$6%*h6KgwnXgU@$WI{Ha+cz5V zcS2z}{GLvmv7+N`ohAemFTS;NZI_NWCQyY5U73Ch=rBz z_PY@`b|>BKItMkF?9JojovP-wtF(ij@?Q z&~GdCL9XsTPNN^cqNDq^PMK`UEL3^hVY-TKpM^TxZV87M#BHMow{fx3`3BI_Gb8co zdo#U9(LV+Hg*eRrOX;_Rels4y$<^h_G*<-y?19t zD}Ni@@lm7k#Zv9KCfXsRm2v#o#~8;}hT4&7_IKR46)6_cI6bF zd*irC5?dKI`Hp?ODPfZIrA8ZsrZ{QWdz6h&G>vrarvuK(_kXj zYqgf+><&r#T3f^D~0bpHqE(HEl zM*ajg=vU9~%ZLD1ri)GQL+Ad2cS-^s+R;;tk6EdSbsn0n&;H_e14X{6m+@gsae2%aWsmHui;oZO_t0)fKG4d!F<@m9?`>$hTCNKj-!$HV zmUtCtk3fq*QE!d6C6LLMc53%Py9e4m(C&eD543xr-2=C+2g=XbP_?HmJ(h1<1xo~4 zM*HdeY(~rHBIS!LucH1k%PTc*+GcdU_;uBm_5NUVrHy<)^|Hp4wARAOal5SLCCQRe z(zRRm*00WcS-m$pCchX%!fl92Kg!x03BTeq=>>Vo9ZA-Ul30{qvD(yS+rzNV4LUNc zgC)I5+)XFF$(Gf=<`G-gcCKT?u#7ZG>%;5a=GJvMY3&V`wH5{Yh;~t23bGpk|{DxW=N0p$pTp-%j5!CA**DKtdq_V>nB|@MW)FN z>5)EJxp$cju*6S%=}=2rb-AS&6uOtN5B2pu>8^Wr91k|<+$WNcB~u$VK0arP8xK92 zN~ShFY|W07oXOz{;%s)@N#Z&GL~?TPT++|u!FL}2;-zUCpPSmVYXe?rF@jtc544lJ z4(^>fIBhwbw_EnhBVoKwV`MChVOxG;PgWe5^Y_d;$*H|l_=#+Cavw7@6FZ&c?8E^S zcVjcu`{bPfCpnQD+nvu&PmJYuA)1zKjInG!pG9NEL-XP#l_G#?V0L;6kx`G-2a5?h zJ~QJackY{(H)4W5{Vy4r=U3npV~`WfC|%kWI&W(ke<0lAf1duzZWWRpkutu=&$*7d zTkF^Lic+2%Nm9RP{ZC<=?1TF2dPZ5fTf7}-IX)6f{dJuo!&4j|_1E>0QrAO}n8fC2 zQT_{nBWn}&*Y$`p6KTKdl%w#MwT_l`y`$uE(6nFLsqNPWOd=zFqyD8m)b*YCi;vc?{;$C%yV!}3N$FPVx|P=8IBI!6GGTu=ZMP^rIXOc~*T2fc z*cSFLaJ*8gPD5x}`9{RQM1N)Y*|Ee>Kjm8yf4vV;{v-_yCG}I&yU2vwuj_xM-WRA| zkE524(_fFjQ{xu$9z9?*M~cpeuuJ{wzxs+5D&-63!YNw+=hztbU-P?FD;ITP&mhtI z&%iGCMsjXT()*p!o3aX`hIr^*4Mr)qGYQKmL(th>#xlZ-z@2MlH zerjGsM$Ucp*L7}{{&fkCB;$`H_1FD63R}4T$|~znxn<-|n*O%b^w&6lMEo7zpV_E* zuAvQM0QFN|kNE36Uy0j_J^CqJ&5*L25=*ObS6e@~!&1iyb<=vaybLl?rqn>H|N4mC WM%BG*?Yppag!SL44%`?iI{yH6pU=er literal 0 HcmV?d00001 diff --git a/server/node_modules/@serialport/bindings/lib/darwin.js b/server/node_modules/@serialport/bindings/lib/darwin.js new file mode 100644 index 0000000..246a817 --- /dev/null +++ b/server/node_modules/@serialport/bindings/lib/darwin.js @@ -0,0 +1,110 @@ +const { promisify } = require('util') +const binding = require('bindings')('bindings.node') +const AbstractBinding = require('@serialport/binding-abstract') +const Poller = require('@serialport/bindings/lib/poller') +const unixRead = require('@serialport/bindings/lib/unix-read') +const unixWrite = require('@serialport/bindings/lib/unix-write') +const { wrapWithHiddenComName } = require('@serialport/bindings/lib/legacy') + +const defaultBindingOptions = Object.freeze({ + vmin: 1, + vtime: 0, +}) + +const asyncList = promisify(binding.list) +const asyncOpen = promisify(binding.open) +const asyncClose = promisify(binding.close) +const asyncUpdate = promisify(binding.update) +const asyncSet = promisify(binding.set) +const asyncGet = promisify(binding.get) +const asyncGetBaudRate = promisify(binding.getBaudRate) +const asyncDrain = promisify(binding.drain) +const asyncFlush = promisify(binding.flush) + +/** + * The Darwin binding layer for OSX + */ +class DarwinBinding extends AbstractBinding { + static list() { + return wrapWithHiddenComName(asyncList()) + } + + constructor(opt = {}) { + super(opt) + this.bindingOptions = { ...defaultBindingOptions, ...opt.bindingOptions } + this.fd = null + this.writeOperation = null + } + + get isOpen() { + return this.fd !== null + } + + async open(path, options) { + await super.open(path, options) + this.openOptions = { ...this.bindingOptions, ...options } + const fd = await asyncOpen(path, this.openOptions) + this.fd = fd + this.poller = new Poller(fd) + } + + async close() { + await super.close() + const fd = this.fd + this.poller.stop() + this.poller.destroy() + this.poller = null + this.openOptions = null + this.fd = null + return asyncClose(fd) + } + + async read(buffer, offset, length) { + await super.read(buffer, offset, length) + return unixRead({ binding: this, buffer, offset, length }) + } + + async write(buffer) { + this.writeOperation = super.write(buffer).then(async () => { + if (buffer.length === 0) { + return + } + await unixWrite({ binding: this, buffer }) + this.writeOperation = null + }) + return this.writeOperation + } + + async update(options) { + await super.update(options) + return asyncUpdate(this.fd, options) + } + + async set(options) { + await super.set(options) + return asyncSet(this.fd, options) + } + + async get() { + await super.get() + return asyncGet(this.fd) + } + + async getBaudRate() { + await super.get() + return asyncGetBaudRate(this.fd) + } + + async drain() { + await super.drain() + await this.writeOperation + return asyncDrain(this.fd) + } + + async flush() { + await super.flush() + return asyncFlush(this.fd) + } +} + +module.exports = DarwinBinding diff --git a/server/node_modules/@serialport/bindings/lib/index.js b/server/node_modules/@serialport/bindings/lib/index.js new file mode 100644 index 0000000..b3725e3 --- /dev/null +++ b/server/node_modules/@serialport/bindings/lib/index.js @@ -0,0 +1,15 @@ +const debug = require('debug')('serialport/bindings') + +switch (process.platform) { + case 'win32': + debug('loading WindowsBinding') + module.exports = require('@serialport/bindings/lib/win32') + break + case 'darwin': + debug('loading DarwinBinding') + module.exports = require('@serialport/bindings/lib/darwin') + break + default: + debug('loading LinuxBinding') + module.exports = require('@serialport/bindings/lib/linux') +} diff --git a/server/node_modules/@serialport/bindings/lib/legacy.js b/server/node_modules/@serialport/bindings/lib/legacy.js new file mode 100644 index 0000000..9cd2b70 --- /dev/null +++ b/server/node_modules/@serialport/bindings/lib/legacy.js @@ -0,0 +1,26 @@ +let warningSent = false + +const wrapWithHiddenComName = async portsPromise => { + const ports = await portsPromise + return ports.map(port => { + const newPort = { ...port } + return Object.defineProperties(newPort, { + comName: { + get() { + if (!warningSent) { + warningSent = true + console.warn( + `"PortInfo.comName" has been deprecated. You should now use "PortInfo.path". The property will be removed in the next major release.` + ) + } + return newPort.path + }, + enumerable: false, + }, + }) + }) +} + +module.exports = { + wrapWithHiddenComName, +} diff --git a/server/node_modules/@serialport/bindings/lib/linux-list.js b/server/node_modules/@serialport/bindings/lib/linux-list.js new file mode 100644 index 0000000..63cb95a --- /dev/null +++ b/server/node_modules/@serialport/bindings/lib/linux-list.js @@ -0,0 +1,100 @@ +const childProcess = require('child_process') +const Readline = require('@serialport/parser-readline') + +// get only serial port names +function checkPathOfDevice(path) { + return /(tty(S|WCH|ACM|USB|AMA|MFD|O|XRUSB)|rfcomm)/.test(path) && path +} + +function propName(name) { + return { + DEVNAME: 'path', + ID_VENDOR_ENC: 'manufacturer', + ID_SERIAL_SHORT: 'serialNumber', + ID_VENDOR_ID: 'vendorId', + ID_MODEL_ID: 'productId', + DEVLINKS: 'pnpId', + }[name.toUpperCase()] +} + +function decodeHexEscape(str) { + return str.replace(/\\x([a-fA-F0-9]{2})/g, (a, b) => { + return String.fromCharCode(parseInt(b, 16)) + }) +} + +function propVal(name, val) { + if (name === 'pnpId') { + const match = val.match(/\/by-id\/([^\s]+)/) + return (match && match[1]) || undefined + } + if (name === 'manufacturer') { + return decodeHexEscape(val) + } + if (/^0x/.test(val)) { + return val.substr(2) + } + return val +} + +function listLinux() { + return new Promise((resolve, reject) => { + const ports = [] + const ude = childProcess.spawn('udevadm', ['info', '-e']) + const lines = ude.stdout.pipe(new Readline()) + ude.on('close', code => code && reject(new Error(`Error listing ports udevadm exited with error code: ${code}`))) + ude.on('error', reject) + lines.on('error', reject) + + let port = {} + let skipPort = false + lines.on('data', line => { + const lineType = line.slice(0, 1) + const data = line.slice(3) + // new port entry + if (lineType === 'P') { + port = { + manufacturer: undefined, + serialNumber: undefined, + pnpId: undefined, + locationId: undefined, + vendorId: undefined, + productId: undefined, + } + skipPort = false + return + } + + if (skipPort) { + return + } + + // Check dev name and save port if it matches flag to skip the rest of the data if not + if (lineType === 'N') { + if (checkPathOfDevice(data)) { + ports.push(port) + } else { + skipPort = true + } + return + } + + // parse data about each port + if (lineType === 'E') { + const keyValue = data.match(/^(.+)=(.*)/) + if (!keyValue) { + return + } + const key = propName(keyValue[1]) + if (!key) { + return + } + port[key] = propVal(key, keyValue[2]) + } + }) + + lines.on('finish', () => resolve(ports)) + }) +} + +module.exports = listLinux diff --git a/server/node_modules/@serialport/bindings/lib/linux.js b/server/node_modules/@serialport/bindings/lib/linux.js new file mode 100644 index 0000000..62268d3 --- /dev/null +++ b/server/node_modules/@serialport/bindings/lib/linux.js @@ -0,0 +1,110 @@ +const { promisify } = require('util') +const binding = require('bindings')('bindings.node') +const AbstractBinding = require('@serialport/binding-abstract') +const linuxList = require('@serialport/bindings/lib/linux-list') +const Poller = require('@serialport/bindings/lib/poller') +const unixRead = require('@serialport/bindings/lib/unix-read') +const unixWrite = require('@serialport/bindings/lib/unix-write') +const { wrapWithHiddenComName } = require('@serialport/bindings/lib/legacy') + +const defaultBindingOptions = Object.freeze({ + vmin: 1, + vtime: 0, +}) + +const asyncOpen = promisify(binding.open) +const asyncClose = promisify(binding.close) +const asyncUpdate = promisify(binding.update) +const asyncSet = promisify(binding.set) +const asyncGet = promisify(binding.get) +const asyncGetBaudRate = promisify(binding.getBaudRate) +const asyncDrain = promisify(binding.drain) +const asyncFlush = promisify(binding.flush) + +/** + * The linux binding layer + */ +class LinuxBinding extends AbstractBinding { + static list() { + return wrapWithHiddenComName(linuxList()) + } + + constructor(opt = {}) { + super(opt) + this.bindingOptions = { ...defaultBindingOptions, ...opt.bindingOptions } + this.fd = null + this.writeOperation = null + } + + get isOpen() { + return this.fd !== null + } + + async open(path, options) { + await super.open(path, options) + this.openOptions = { ...this.bindingOptions, ...options } + const fd = await asyncOpen(path, this.openOptions) + this.fd = fd + this.poller = new Poller(fd) + } + + async close() { + await super.close() + const fd = this.fd + this.poller.stop() + this.poller.destroy() + this.poller = null + this.openOptions = null + this.fd = null + return asyncClose(fd) + } + + async read(buffer, offset, length) { + await super.read(buffer, offset, length) + return unixRead({ binding: this, buffer, offset, length }) + } + + async write(buffer) { + this.writeOperation = super.write(buffer).then(async () => { + if (buffer.length === 0) { + return + } + await unixWrite({ binding: this, buffer }) + this.writeOperation = null + }) + return this.writeOperation + } + + async update(options) { + await super.update(options) + return asyncUpdate(this.fd, options) + } + + async set(options) { + await super.set(options) + return asyncSet(this.fd, options) + } + + async get() { + await super.get() + return asyncGet(this.fd) + } + + async getBaudRate() { + await super.get() + return asyncGetBaudRate(this.fd) + } + + async drain() { + await super.drain() + await this.writeOperation + return asyncDrain(this.fd) + } + + async flush() { + await super.flush() + return asyncFlush(this.fd) + } +} + +module.exports = LinuxBinding diff --git a/server/node_modules/@serialport/bindings/lib/poller.js b/server/node_modules/@serialport/bindings/lib/poller.js new file mode 100644 index 0000000..085ac02 --- /dev/null +++ b/server/node_modules/@serialport/bindings/lib/poller.js @@ -0,0 +1,111 @@ +const debug = require('debug') +const logger = debug('serialport/bindings/poller') +const EventEmitter = require('events') +const PollerBindings = require('bindings')('bindings.node').Poller + +const EVENTS = { + UV_READABLE: 0b0001, + UV_WRITABLE: 0b0010, + UV_DISCONNECT: 0b0100, +} + +function handleEvent(error, eventFlag) { + if (error) { + logger('error', error) + this.emit('readable', error) + this.emit('writable', error) + this.emit('disconnect', error) + return + } + if (eventFlag & EVENTS.UV_READABLE) { + logger('received "readable"') + this.emit('readable', null) + } + if (eventFlag & EVENTS.UV_WRITABLE) { + logger('received "writable"') + this.emit('writable', null) + } + if (eventFlag & EVENTS.UV_DISCONNECT) { + logger('received "disconnect"') + this.emit('disconnect', null) + } +} + +/** + * Polls unix systems for readable or writable states of a file or serialport + */ +class Poller extends EventEmitter { + constructor(fd, FDPoller = PollerBindings) { + logger('Creating poller') + super() + this.poller = new FDPoller(fd, handleEvent.bind(this)) + } + /** + * Wait for the next event to occur + * @param {string} event ('readable'|'writable'|'disconnect') + * @returns {Poller} returns itself + */ + once(event, callback) { + switch (event) { + case 'readable': + this.poll(EVENTS.UV_READABLE) + break + case 'writable': + this.poll(EVENTS.UV_WRITABLE) + break + case 'disconnect': + this.poll(EVENTS.UV_DISCONNECT) + break + } + return super.once(event, callback) + } + + /** + * Ask the bindings to listen for an event, it is recommend to use `.once()` for easy use + * @param {EVENTS} eventFlag polls for an event or group of events based upon a flag. + * @returns {undefined} + */ + poll(eventFlag) { + eventFlag = eventFlag || 0 + + if (eventFlag & EVENTS.UV_READABLE) { + logger('Polling for "readable"') + } + if (eventFlag & EVENTS.UV_WRITABLE) { + logger('Polling for "writable"') + } + if (eventFlag & EVENTS.UV_DISCONNECT) { + logger('Polling for "disconnect"') + } + + this.poller.poll(eventFlag) + } + + /** + * Stop listening for events and cancel all outstanding listening with an error + * @returns {undefined} + */ + stop() { + logger('Stopping poller') + this.poller.stop() + this.emitCanceled() + } + + destroy() { + logger('Destroying poller') + this.poller.destroy() + this.emitCanceled() + } + + emitCanceled() { + const err = new Error('Canceled') + err.canceled = true + this.emit('readable', err) + this.emit('writable', err) + this.emit('disconnect', err) + } +} + +Poller.EVENTS = EVENTS + +module.exports = Poller diff --git a/server/node_modules/@serialport/bindings/lib/unix-read.js b/server/node_modules/@serialport/bindings/lib/unix-read.js new file mode 100644 index 0000000..ea3107d --- /dev/null +++ b/server/node_modules/@serialport/bindings/lib/unix-read.js @@ -0,0 +1,57 @@ +const fs = require('fs') +const debug = require('debug') +const logger = debug('serialport/bindings/unixRead') +const { promisify } = require('util') + +const readAsync = promisify(fs.read) + +const readable = binding => { + return new Promise((resolve, reject) => { + binding.poller.once('readable', err => (err ? reject(err) : resolve())) + }) +} + +const unixRead = async ({ binding, buffer, offset, length, fsReadAsync = readAsync }) => { + logger('Starting read') + if (!binding.isOpen) { + const err = new Error('Port is not open') + err.canceled = true + throw err + } + + try { + const { bytesRead } = await fsReadAsync(binding.fd, buffer, offset, length, null) + if (bytesRead === 0) { + return unixRead({ binding, buffer, offset, length, fsReadAsync }) + } + logger('Finished read', bytesRead, 'bytes') + return { bytesRead, buffer } + } catch (err) { + logger('read error', err) + if (err.code === 'EAGAIN' || err.code === 'EWOULDBLOCK' || err.code === 'EINTR') { + if (!binding.isOpen) { + const err = new Error('Port is not open') + err.canceled = true + throw err + } + logger('waiting for readable because of code:', err.code) + await readable(binding) + return unixRead({ binding, buffer, offset, length, fsReadAsync }) + } + + const disconnectError = + err.code === 'EBADF' || // Bad file number means we got closed + err.code === 'ENXIO' || // No such device or address probably usb disconnect + err.code === 'UNKNOWN' || + err.errno === -1 // generic error + + if (disconnectError) { + err.disconnect = true + logger('disconnecting', err) + } + + throw err + } +} + +module.exports = unixRead diff --git a/server/node_modules/@serialport/bindings/lib/unix-write.js b/server/node_modules/@serialport/bindings/lib/unix-write.js new file mode 100644 index 0000000..dd8cd34 --- /dev/null +++ b/server/node_modules/@serialport/bindings/lib/unix-write.js @@ -0,0 +1,57 @@ +const fs = require('fs') +const debug = require('debug') +const logger = debug('serialport/bindings/unixWrite') +const { promisify } = require('util') + +const writeAsync = promisify(fs.write) + +const writable = binding => { + return new Promise((resolve, reject) => { + binding.poller.once('writable', err => (err ? reject(err) : resolve())) + }) +} + +const unixWrite = async ({ binding, buffer, offset = 0, fsWriteAsync = writeAsync }) => { + const bytesToWrite = buffer.length - offset + logger('Starting write', buffer.length, 'bytes offset', offset, 'bytesToWrite', bytesToWrite) + if (!binding.isOpen) { + throw new Error('Port is not open') + } + try { + const { bytesWritten } = await fsWriteAsync(binding.fd, buffer, offset, bytesToWrite) + logger('write returned: wrote', bytesWritten, 'bytes') + if (bytesWritten + offset < buffer.length) { + if (!binding.isOpen) { + throw new Error('Port is not open') + } + return unixWrite({ binding, buffer, offset: bytesWritten + offset, fsWriteAsync }) + } + + logger('Finished writing', bytesWritten + offset, 'bytes') + } catch (err) { + logger('write errored', err) + if (err.code === 'EAGAIN' || err.code === 'EWOULDBLOCK' || err.code === 'EINTR') { + if (!binding.isOpen) { + throw new Error('Port is not open') + } + logger('waiting for writable because of code:', err.code) + await writable(binding) + return unixWrite({ binding, buffer, offset, fsWriteAsync }) + } + + const disconnectError = + err.code === 'EBADF' || // Bad file number means we got closed + err.code === 'ENXIO' || // No such device or address probably usb disconnect + err.code === 'UNKNOWN' || + err.errno === -1 // generic error + + if (disconnectError) { + err.disconnect = true + logger('disconnecting', err) + } + + logger('error', err) + throw err + } +} +module.exports = unixWrite diff --git a/server/node_modules/@serialport/bindings/lib/win32-sn-parser.js b/server/node_modules/@serialport/bindings/lib/win32-sn-parser.js new file mode 100644 index 0000000..6322f6b --- /dev/null +++ b/server/node_modules/@serialport/bindings/lib/win32-sn-parser.js @@ -0,0 +1,14 @@ +const PARSERS = [/USB\\(?:.+)\\(.+)/, /FTDIBUS\\(?:.+)\+(.+?)A?\\.+/] + +module.exports = pnpId => { + if (!pnpId) { + return null + } + for (const parser of PARSERS) { + const sn = pnpId.match(parser) + if (sn) { + return sn[1] + } + } + return null +} diff --git a/server/node_modules/@serialport/bindings/lib/win32.js b/server/node_modules/@serialport/bindings/lib/win32.js new file mode 100644 index 0000000..d969c10 --- /dev/null +++ b/server/node_modules/@serialport/bindings/lib/win32.js @@ -0,0 +1,123 @@ +const binding = require('bindings')('bindings.node') +const AbstractBinding = require('@serialport/binding-abstract') +const { promisify } = require('util') +const serialNumParser = require('@serialport/bindings/lib/win32-sn-parser') + +const asyncList = promisify(binding.list) +const asyncOpen = promisify(binding.open) +const asyncClose = promisify(binding.close) +const asyncRead = promisify(binding.read) +const asyncWrite = promisify(binding.write) +const asyncUpdate = promisify(binding.update) +const asyncSet = promisify(binding.set) +const asyncGet = promisify(binding.get) +const asyncGetBaudRate = promisify(binding.getBaudRate) +const asyncDrain = promisify(binding.drain) +const asyncFlush = promisify(binding.flush) +const { wrapWithHiddenComName } = require('@serialport/bindings/lib/legacy') + +/** + * The Windows binding layer + */ +class WindowsBinding extends AbstractBinding { + static async list() { + const ports = await asyncList() + // Grab the serial number from the pnp id + return wrapWithHiddenComName( + ports.map(port => { + if (port.pnpId && !port.serialNumber) { + const serialNumber = serialNumParser(port.pnpId) + if (serialNumber) { + return { + ...port, + serialNumber, + } + } + } + return port + }) + ) + } + + constructor(opt = {}) { + super(opt) + this.bindingOptions = { ...opt.bindingOptions } + this.fd = null + this.writeOperation = null + } + + get isOpen() { + return this.fd !== null + } + + async open(path, options) { + await super.open(path, options) + this.openOptions = { ...this.bindingOptions, ...options } + const fd = await asyncOpen(path, this.openOptions) + this.fd = fd + } + + async close() { + await super.close() + const fd = this.fd + this.fd = null + return asyncClose(fd) + } + + async read(buffer, offset, length) { + await super.read(buffer, offset, length) + try { + const bytesRead = await asyncRead(this.fd, buffer, offset, length) + return { bytesRead, buffer } + } catch (err) { + if (!this.isOpen) { + err.canceled = true + } + throw err + } + } + + async write(buffer) { + this.writeOperation = super.write(buffer).then(async () => { + if (buffer.length === 0) { + return + } + await asyncWrite(this.fd, buffer) + this.writeOperation = null + }) + return this.writeOperation + } + + async update(options) { + await super.update(options) + return asyncUpdate(this.fd, options) + } + + async set(options) { + await super.set(options) + return asyncSet(this.fd, options) + } + + async get() { + await super.get() + return asyncGet(this.fd) + } + + async getBaudRate() { + await super.get() + return asyncGetBaudRate(this.fd) + } + + async drain() { + await super.drain() + await this.writeOperation + return asyncDrain(this.fd) + } + + async flush() { + await super.flush() + return asyncFlush(this.fd) + } +} + +module.exports = WindowsBinding diff --git a/server/node_modules/@serialport/bindings/node_modules/debug/LICENSE b/server/node_modules/@serialport/bindings/node_modules/debug/LICENSE new file mode 100644 index 0000000..1a9820e --- /dev/null +++ b/server/node_modules/@serialport/bindings/node_modules/debug/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/server/node_modules/@serialport/bindings/node_modules/debug/README.md b/server/node_modules/@serialport/bindings/node_modules/debug/README.md new file mode 100644 index 0000000..5ea4cd2 --- /dev/null +++ b/server/node_modules/@serialport/bindings/node_modules/debug/README.md @@ -0,0 +1,478 @@ +# debug +[![Build Status](https://travis-ci.org/debug-js/debug.svg?branch=master)](https://travis-ci.org/debug-js/debug) [![Coverage Status](https://coveralls.io/repos/github/debug-js/debug/badge.svg?branch=master)](https://coveralls.io/github/debug-js/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + +## Usage in child processes + +Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process. +For example: + +```javascript +worker = fork(WORKER_WRAP_PATH, [workerPath], { + stdio: [ + /* stdin: */ 0, + /* stdout: */ 'pipe', + /* stderr: */ 'pipe', + 'ipc', + ], + env: Object.assign({}, process.env, { + DEBUG_COLORS: 1 // without this settings, colors won't be shown + }), +}); + +worker.stderr.pipe(process.stderr, { end: false }); +``` + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + - Josh Junon + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/bindings/node_modules/debug/package.json b/server/node_modules/@serialport/bindings/node_modules/debug/package.json new file mode 100644 index 0000000..e2c178a --- /dev/null +++ b/server/node_modules/@serialport/bindings/node_modules/debug/package.json @@ -0,0 +1,101 @@ +{ + "_from": "debug@^4.3.2", + "_id": "debug@4.3.3", + "_inBundle": false, + "_integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "_location": "/@serialport/bindings/debug", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "debug@^4.3.2", + "name": "debug", + "escapedName": "debug", + "rawSpec": "^4.3.2", + "saveSpec": null, + "fetchSpec": "^4.3.2" + }, + "_requiredBy": [ + "/@serialport/bindings" + ], + "_resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "_shasum": "04266e0b70a98d4462e6e288e38259213332b664", + "_spec": "debug@^4.3.2", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/@serialport/bindings", + "author": { + "name": "Josh Junon", + "email": "josh.junon@protonmail.com" + }, + "browser": "./src/browser.js", + "bugs": { + "url": "https://github.com/debug-js/debug/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + }, + { + "name": "Andrew Rhyne", + "email": "rhyneandrew@gmail.com" + } + ], + "dependencies": { + "ms": "2.1.2" + }, + "deprecated": false, + "description": "Lightweight debugging utility for Node.js and the browser", + "devDependencies": { + "brfs": "^2.0.1", + "browserify": "^16.2.3", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "xo": "^0.23.0" + }, + "engines": { + "node": ">=6.0" + }, + "files": [ + "src", + "LICENSE", + "README.md" + ], + "homepage": "https://github.com/debug-js/debug#readme", + "keywords": [ + "debug", + "log", + "debugger" + ], + "license": "MIT", + "main": "./src/index.js", + "name": "debug", + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, + "repository": { + "type": "git", + "url": "git://github.com/debug-js/debug.git" + }, + "scripts": { + "lint": "xo", + "test": "npm run test:node && npm run test:browser && npm run lint", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls", + "test:node": "istanbul cover _mocha -- test.js" + }, + "version": "4.3.3" +} diff --git a/server/node_modules/@serialport/bindings/node_modules/debug/src/browser.js b/server/node_modules/@serialport/bindings/node_modules/debug/src/browser.js new file mode 100644 index 0000000..3bf30ea --- /dev/null +++ b/server/node_modules/@serialport/bindings/node_modules/debug/src/browser.js @@ -0,0 +1,269 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('debug/src/common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/server/node_modules/@serialport/bindings/node_modules/debug/src/common.js b/server/node_modules/@serialport/bindings/node_modules/debug/src/common.js new file mode 100644 index 0000000..6d571d2 --- /dev/null +++ b/server/node_modules/@serialport/bindings/node_modules/debug/src/common.js @@ -0,0 +1,274 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/server/node_modules/@serialport/bindings/node_modules/debug/src/index.js b/server/node_modules/@serialport/bindings/node_modules/debug/src/index.js new file mode 100644 index 0000000..d0b8579 --- /dev/null +++ b/server/node_modules/@serialport/bindings/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('debug/src/browser.js'); +} else { + module.exports = require('debug/src/node.js'); +} diff --git a/server/node_modules/@serialport/bindings/node_modules/debug/src/node.js b/server/node_modules/@serialport/bindings/node_modules/debug/src/node.js new file mode 100644 index 0000000..3044efc --- /dev/null +++ b/server/node_modules/@serialport/bindings/node_modules/debug/src/node.js @@ -0,0 +1,263 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('debug/src/common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/server/node_modules/@serialport/bindings/node_modules/ms/index.js b/server/node_modules/@serialport/bindings/node_modules/ms/index.js new file mode 100644 index 0000000..c4498bc --- /dev/null +++ b/server/node_modules/@serialport/bindings/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/server/node_modules/@serialport/bindings/node_modules/ms/license.md b/server/node_modules/@serialport/bindings/node_modules/ms/license.md new file mode 100644 index 0000000..69b6125 --- /dev/null +++ b/server/node_modules/@serialport/bindings/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/server/node_modules/@serialport/bindings/node_modules/ms/package.json b/server/node_modules/@serialport/bindings/node_modules/ms/package.json new file mode 100644 index 0000000..c397a8f --- /dev/null +++ b/server/node_modules/@serialport/bindings/node_modules/ms/package.json @@ -0,0 +1,69 @@ +{ + "_from": "ms@2.1.2", + "_id": "ms@2.1.2", + "_inBundle": false, + "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "_location": "/@serialport/bindings/ms", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "ms@2.1.2", + "name": "ms", + "escapedName": "ms", + "rawSpec": "2.1.2", + "saveSpec": null, + "fetchSpec": "2.1.2" + }, + "_requiredBy": [ + "/@serialport/bindings/debug" + ], + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009", + "_spec": "ms@2.1.2", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/@serialport/bindings/node_modules/debug", + "bugs": { + "url": "https://github.com/zeit/ms/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tiny millisecond conversion utility", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/zeit/ms#readme", + "license": "MIT", + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "main": "./index", + "name": "ms", + "repository": { + "type": "git", + "url": "git+https://github.com/zeit/ms.git" + }, + "scripts": { + "lint": "eslint lib/* bin/*", + "precommit": "lint-staged", + "test": "mocha tests.js" + }, + "version": "2.1.2" +} diff --git a/server/node_modules/@serialport/bindings/node_modules/ms/readme.md b/server/node_modules/@serialport/bindings/node_modules/ms/readme.md new file mode 100644 index 0000000..9a1996b --- /dev/null +++ b/server/node_modules/@serialport/bindings/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/server/node_modules/@serialport/bindings/package.json b/server/node_modules/@serialport/bindings/package.json new file mode 100644 index 0000000..31bc1f3 --- /dev/null +++ b/server/node_modules/@serialport/bindings/package.json @@ -0,0 +1,84 @@ +{ + "_from": "@serialport/bindings@9.2.8", + "_id": "@serialport/bindings@9.2.8", + "_inBundle": false, + "_integrity": "sha512-hSLxTe0tADZ3LMMGwvEJWOC/TaFQTyPeFalUCsJ1lSQ0k6bPF04JwrtB/C81GetmDBTNRY0GlD0SNtKCc7Dr5g==", + "_location": "/@serialport/bindings", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@serialport/bindings@9.2.8", + "name": "@serialport/bindings", + "escapedName": "@serialport%2fbindings", + "scope": "@serialport", + "rawSpec": "9.2.8", + "saveSpec": null, + "fetchSpec": "9.2.8" + }, + "_requiredBy": [ + "/serialport" + ], + "_resolved": "https://registry.npmjs.org/@serialport/bindings/-/bindings-9.2.8.tgz", + "_shasum": "59c2be09d91df922d56de31cb9e21c6736004e39", + "_spec": "@serialport/bindings@9.2.8", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/serialport", + "bugs": { + "url": "https://github.com/serialport/node-serialport/issues" + }, + "bundleDependencies": false, + "cc": { + "filter": [ + "legal/copyright", + "build/include" + ], + "files": [ + "src/*.cpp", + "src/*.h" + ], + "linelength": "120" + }, + "dependencies": { + "@serialport/binding-abstract": "9.2.3", + "@serialport/parser-readline": "9.2.4", + "bindings": "^1.5.0", + "debug": "^4.3.2", + "nan": "^2.15.0", + "prebuild-install": "^7.0.0" + }, + "deprecated": false, + "description": "The `Binding` is how Node-SerialPort talks to the underlying system. By default, we auto detect Windows, Linux and OS X, and load the appropriate module for your system. You can assign `SerialPort.Binding` to any binding you like. Find more by searching [\"serialport-binding\" at npm](https://www.npmjs.com/search?q=serialport-binding).", + "devDependencies": { + "@serialport/binding-mock": "9.2.4", + "node-abi": "3.5.0" + }, + "engines": { + "node": ">=10.0.0" + }, + "funding": "https://opencollective.com/serialport/donate", + "gitHead": "e90a43225655bf390735eb77bd3ba17f205eae08", + "gypfile": true, + "homepage": "https://github.com/serialport/node-serialport#readme", + "keywords": [ + "serialport-binding" + ], + "license": "MIT", + "main": "lib", + "name": "@serialport/bindings", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git://github.com/serialport/node-serialport.git" + }, + "scripts": { + "install": "prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild", + "lint": "cc --verbose", + "prebuild": "npm run prebuild-node && npm run prebuild-electron", + "prebuild-electron": "prebuild --force --strip --verbose --tag-prefix @serialport/bindings@ -r electron -t 13.0.0 -t 14.0.0 -t 15.0.0 -t 16.0.0", + "prebuild-node": "prebuild --force --strip --verbose --tag-prefix @serialport/bindings@ -t 12.0.0 -t 14.0.0 -t 16.0.0", + "rebuild": "node-gyp rebuild" + }, + "version": "9.2.8" +} diff --git a/server/node_modules/@serialport/bindings/src/darwin_list.cpp b/server/node_modules/@serialport/bindings/src/darwin_list.cpp new file mode 100644 index 0000000..6e1a849 --- /dev/null +++ b/server/node_modules/@serialport/bindings/src/darwin_list.cpp @@ -0,0 +1,355 @@ +#include "./darwin_list.h" + +#include +#include +#include +#include + +#if defined(MAC_OS_X_VERSION_10_4) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4) +#include +#include +#endif + +#include +#include + +uv_mutex_t list_mutex; +Boolean lockInitialised = FALSE; + +NAN_METHOD(List) { + // callback + if (!info[0]->IsFunction()) { + Nan::ThrowTypeError("First argument must be a function"); + return; + } + + ListBaton* baton = new ListBaton(); + snprintf(baton->errorString, sizeof(baton->errorString), ""); + baton->callback.Reset(info[0].As()); + + uv_work_t* req = new uv_work_t(); + req->data = baton; + uv_queue_work(uv_default_loop(), req, EIO_List, (uv_after_work_cb)EIO_AfterList); +} + +void setIfNotEmpty(v8::Local item, std::string key, const char *value) { + v8::Local v8key = Nan::New(key).ToLocalChecked(); + if (strlen(value) > 0) { + Nan::Set(item, v8key, Nan::New(value).ToLocalChecked()); + } else { + Nan::Set(item, v8key, Nan::Undefined()); + } +} + + +// Function prototypes +static kern_return_t FindModems(io_iterator_t *matchingServices); +static io_service_t GetUsbDevice(io_service_t service); +static stDeviceListItem* GetSerialDevices(); + + +static kern_return_t FindModems(io_iterator_t *matchingServices) { + kern_return_t kernResult; + CFMutableDictionaryRef classesToMatch; + classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue); + if (classesToMatch != NULL) { + CFDictionarySetValue(classesToMatch, + CFSTR(kIOSerialBSDTypeKey), + CFSTR(kIOSerialBSDAllTypes)); + } + + kernResult = IOServiceGetMatchingServices(kIOMasterPortDefault, classesToMatch, matchingServices); + + return kernResult; +} + +static io_service_t GetUsbDevice(io_service_t service) { + IOReturn status; + io_iterator_t iterator = 0; + io_service_t device = 0; + + if (!service) { + return device; + } + + status = IORegistryEntryCreateIterator(service, + kIOServicePlane, + (kIORegistryIterateParents | kIORegistryIterateRecursively), + &iterator); + + if (status == kIOReturnSuccess) { + io_service_t currentService; + while ((currentService = IOIteratorNext(iterator)) && device == 0) { + io_name_t serviceName; + status = IORegistryEntryGetNameInPlane(currentService, kIOServicePlane, serviceName); + if (status == kIOReturnSuccess && IOObjectConformsTo(currentService, kIOUSBDeviceClassName)) { + device = currentService; + } else { + // Release the service object which is no longer needed + (void) IOObjectRelease(currentService); + } + } + + // Release the iterator + (void) IOObjectRelease(iterator); + } + + return device; +} + +static void ExtractUsbInformation(stSerialDevice *serialDevice, IOUSBDeviceInterface **deviceInterface) { + kern_return_t kernResult; + UInt32 locationID; + kernResult = (*deviceInterface)->GetLocationID(deviceInterface, &locationID); + if (KERN_SUCCESS == kernResult) { + snprintf(serialDevice->locationId, sizeof(serialDevice->locationId), "%08x", locationID); + } + + UInt16 vendorID; + kernResult = (*deviceInterface)->GetDeviceVendor(deviceInterface, &vendorID); + if (KERN_SUCCESS == kernResult) { + snprintf(serialDevice->vendorId, sizeof(serialDevice->vendorId), "%04x", vendorID); + } + + UInt16 productID; + kernResult = (*deviceInterface)->GetDeviceProduct(deviceInterface, &productID); + if (KERN_SUCCESS == kernResult) { + snprintf(serialDevice->productId, sizeof(serialDevice->productId), "%04x", productID); + } +} + +static stDeviceListItem* GetSerialDevices() { + char bsdPath[MAXPATHLEN]; + + io_iterator_t serialPortIterator; + FindModems(&serialPortIterator); + + kern_return_t kernResult = KERN_FAILURE; + Boolean modemFound = false; + + // Initialize the returned path + *bsdPath = '\0'; + + stDeviceListItem* devices = NULL; + stDeviceListItem* lastDevice = NULL; + int length = 0; + + io_service_t modemService; + while ((modemService = IOIteratorNext(serialPortIterator))) { + CFTypeRef bsdPathAsCFString; + bsdPathAsCFString = IORegistryEntrySearchCFProperty( + modemService, + kIOServicePlane, + CFSTR(kIODialinDeviceKey), + kCFAllocatorDefault, + kIORegistryIterateRecursively); + + if (bsdPathAsCFString) { + Boolean result; + + // Convert the path from a CFString to a C (NUL-terminated) + result = CFStringGetCString((CFStringRef) bsdPathAsCFString, + bsdPath, + sizeof(bsdPath), + kCFStringEncodingUTF8); + CFRelease(bsdPathAsCFString); + + if (result) { + stDeviceListItem *deviceListItem = reinterpret_cast( malloc(sizeof(stDeviceListItem))); + stSerialDevice *serialDevice = &(deviceListItem->value); + snprintf(serialDevice->port, sizeof(serialDevice->port), "%s", bsdPath); + memset(serialDevice->locationId, 0, sizeof(serialDevice->locationId)); + memset(serialDevice->vendorId, 0, sizeof(serialDevice->vendorId)); + memset(serialDevice->productId, 0, sizeof(serialDevice->productId)); + serialDevice->manufacturer[0] = '\0'; + serialDevice->serialNumber[0] = '\0'; + deviceListItem->next = NULL; + deviceListItem->length = &length; + + if (devices == NULL) { + devices = deviceListItem; + } else { + lastDevice->next = deviceListItem; + } + + lastDevice = deviceListItem; + length++; + + modemFound = true; + kernResult = KERN_SUCCESS; + + uv_mutex_lock(&list_mutex); + + io_service_t device = GetUsbDevice(modemService); + + if (device) { + CFStringRef manufacturerAsCFString = (CFStringRef) IORegistryEntryCreateCFProperty(device, + CFSTR(kUSBVendorString), + kCFAllocatorDefault, + 0); + + if (manufacturerAsCFString) { + Boolean result; + char manufacturer[MAXPATHLEN]; + + // Convert from a CFString to a C (NUL-terminated) + result = CFStringGetCString(manufacturerAsCFString, + manufacturer, + sizeof(manufacturer), + kCFStringEncodingUTF8); + + if (result) { + snprintf(serialDevice->manufacturer, sizeof(serialDevice->manufacturer), "%s", manufacturer); + } + + CFRelease(manufacturerAsCFString); + } + + CFStringRef serialNumberAsCFString = (CFStringRef) IORegistryEntrySearchCFProperty(device, + kIOServicePlane, + CFSTR(kUSBSerialNumberString), + kCFAllocatorDefault, + kIORegistryIterateRecursively); + + if (serialNumberAsCFString) { + Boolean result; + char serialNumber[MAXPATHLEN]; + + // Convert from a CFString to a C (NUL-terminated) + result = CFStringGetCString(serialNumberAsCFString, + serialNumber, + sizeof(serialNumber), + kCFStringEncodingUTF8); + + if (result) { + snprintf(serialDevice->serialNumber, sizeof(serialDevice->serialNumber), "%s", serialNumber); + } + + CFRelease(serialNumberAsCFString); + } + + IOCFPlugInInterface **plugInInterface = NULL; + SInt32 score; + HRESULT res; + + IOUSBDeviceInterface **deviceInterface = NULL; + + kernResult = IOCreatePlugInInterfaceForService(device, kIOUSBDeviceUserClientTypeID, kIOCFPlugInInterfaceID, + &plugInInterface, &score); + + if ((kIOReturnSuccess == kernResult) && plugInInterface) { + // Use the plugin interface to retrieve the device interface. + res = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID), + reinterpret_cast (&deviceInterface)); + + // Now done with the plugin interface. + (*plugInInterface)->Release(plugInInterface); + + if (!res && deviceInterface != NULL) { + // Extract the desired Information + ExtractUsbInformation(serialDevice, deviceInterface); + + // Release the Interface + (*deviceInterface)->Release(deviceInterface); + } + } + + // Release the device + (void) IOObjectRelease(device); + } + + uv_mutex_unlock(&list_mutex); + } + } + + // Release the io_service_t now that we are done with it. + (void) IOObjectRelease(modemService); + } + + IOObjectRelease(serialPortIterator); // Release the iterator. + + return devices; +} + +void EIO_List(uv_work_t* req) { + ListBaton* data = static_cast(req->data); + + if (!lockInitialised) { + uv_mutex_init(&list_mutex); + lockInitialised = TRUE; + } + + stDeviceListItem* devices = GetSerialDevices(); + if (devices != NULL && *(devices->length) > 0) { + stDeviceListItem* next = devices; + + for (int i = 0, len = *(devices->length); i < len; i++) { + stSerialDevice device = (* next).value; + + ListResultItem* resultItem = new ListResultItem(); + resultItem->path = device.port; + + if (*device.locationId) { + resultItem->locationId = device.locationId; + } + if (*device.vendorId) { + resultItem->vendorId = device.vendorId; + } + if (*device.productId) { + resultItem->productId = device.productId; + } + if (*device.manufacturer) { + resultItem->manufacturer = device.manufacturer; + } + if (*device.serialNumber) { + resultItem->serialNumber = device.serialNumber; + } + data->results.push_back(resultItem); + + stDeviceListItem* current = next; + + if (next->next != NULL) { + next = next->next; + } + + free(current); + } + } +} + +void EIO_AfterList(uv_work_t* req) { + Nan::HandleScope scope; + + ListBaton* data = static_cast(req->data); + + v8::Local argv[2]; + if (data->errorString[0]) { + argv[0] = v8::Exception::Error(Nan::New(data->errorString).ToLocalChecked()); + argv[1] = Nan::Undefined(); + } else { + v8::Local results = Nan::New(); + int i = 0; + for (std::list::iterator it = data->results.begin(); it != data->results.end(); ++it, i++) { + v8::Local item = Nan::New(); + + setIfNotEmpty(item, "path", (*it)->path.c_str()); + setIfNotEmpty(item, "manufacturer", (*it)->manufacturer.c_str()); + setIfNotEmpty(item, "serialNumber", (*it)->serialNumber.c_str()); + setIfNotEmpty(item, "pnpId", (*it)->pnpId.c_str()); + setIfNotEmpty(item, "locationId", (*it)->locationId.c_str()); + setIfNotEmpty(item, "vendorId", (*it)->vendorId.c_str()); + setIfNotEmpty(item, "productId", (*it)->productId.c_str()); + + Nan::Set(results, i, item); + } + argv[0] = Nan::Null(); + argv[1] = results; + } + data->callback.Call(2, argv, data); + + for (std::list::iterator it = data->results.begin(); it != data->results.end(); ++it) { + delete *it; + } + delete data; + delete req; +} diff --git a/server/node_modules/@serialport/bindings/src/darwin_list.h b/server/node_modules/@serialport/bindings/src/darwin_list.h new file mode 100644 index 0000000..2459a88 --- /dev/null +++ b/server/node_modules/@serialport/bindings/src/darwin_list.h @@ -0,0 +1,46 @@ +#ifndef PACKAGES_SERIALPORT_SRC_DARWIN_LIST_H_ +#define PACKAGES_SERIALPORT_SRC_DARWIN_LIST_H_ +#include // For MAXPATHLEN +#include +#include +#include + +#define ERROR_STRING_SIZE 1024 + +NAN_METHOD(List); +void EIO_List(uv_work_t* req); +void EIO_AfterList(uv_work_t* req); + +struct ListResultItem { + std::string path; + std::string manufacturer; + std::string serialNumber; + std::string pnpId; + std::string locationId; + std::string vendorId; + std::string productId; +}; + +struct ListBaton : public Nan::AsyncResource { + ListBaton() : AsyncResource("node-serialport:ListBaton"), errorString() {} + Nan::Callback callback; + std::list results; + char errorString[ERROR_STRING_SIZE]; +}; + +typedef struct SerialDevice { + char port[MAXPATHLEN]; + char locationId[MAXPATHLEN]; + char vendorId[MAXPATHLEN]; + char productId[MAXPATHLEN]; + char manufacturer[MAXPATHLEN]; + char serialNumber[MAXPATHLEN]; +} stSerialDevice; + +typedef struct DeviceListItem { + struct SerialDevice value; + struct DeviceListItem *next; + int* length; +} stDeviceListItem; + +#endif // PACKAGES_SERIALPORT_SRC_DARWIN_LIST_H_ diff --git a/server/node_modules/@serialport/bindings/src/poller.cpp b/server/node_modules/@serialport/bindings/src/poller.cpp new file mode 100644 index 0000000..e2d9201 --- /dev/null +++ b/server/node_modules/@serialport/bindings/src/poller.cpp @@ -0,0 +1,142 @@ +#include +#include "./poller.h" + +Poller::Poller(int fd) : AsyncResource("node-serialport:poller") { + Nan::HandleScope scope; + this->fd = fd; + this->poll_handle = new uv_poll_t(); + memset(this->poll_handle, 0, sizeof(uv_poll_t)); + poll_handle->data = this; + int status = uv_poll_init(uv_default_loop(), poll_handle, fd); + if (0 != status) { + Nan::ThrowError(uv_strerror(status)); + return; + } + uv_poll_init_success = true; +} + +Poller::~Poller() { + // if we call uv_poll_stop after uv_poll_init failed we segfault + if (uv_poll_init_success) { + uv_poll_stop(poll_handle); + uv_close(reinterpret_cast (poll_handle), Poller::onClose); + } else { + delete poll_handle; + } +} + +void Poller::onClose(uv_handle_t* poll_handle) { + // fprintf(stdout, "~Poller is closed\n"); + delete poll_handle; +} + +// Events can be UV_READABLE | UV_WRITABLE | UV_DISCONNECT +void Poller::poll(int events) { + // fprintf(stdout, "Poller:poll for %d\n", events); + this->events = this->events | events; + int status = uv_poll_start(poll_handle, events, Poller::onData); + if (0 != status) { + Nan::ThrowTypeError(uv_strerror(status)); + return; + } +} + +void Poller::stop() { + int status = uv_poll_stop(poll_handle); + if (0 != status) { + Nan::ThrowTypeError(uv_strerror(status)); + return; + } +} + +int Poller::_stop() { + return uv_poll_stop(poll_handle); +} + +void Poller::onData(uv_poll_t* handle, int status, int events) { + Nan::HandleScope scope; + Poller* obj = static_cast(handle->data); + v8::Local argv[2]; + + // if Error + if (0 != status) { + // fprintf(stdout, "OnData Error status=%s events=%d\n", uv_strerror(status), events); + argv[0] = v8::Exception::Error(Nan::New(uv_strerror(status)).ToLocalChecked()); + argv[1] = Nan::Undefined(); + obj->_stop(); // doesn't matter if this errors + } else { + // fprintf(stdout, "OnData status=%d events=%d subscribed=%d\n", status, events, obj->events); + argv[0] = Nan::Null(); + argv[1] = Nan::New(events); + // remove triggered events from the poll + int newEvents = obj->events & ~events; + obj->poll(newEvents); + } + + obj->callback.Call(2, argv, obj); +} + +NAN_MODULE_INIT(Poller::Init) { + v8::Local tpl = Nan::New(New); + tpl->SetClassName(Nan::New("Poller").ToLocalChecked()); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + Nan::SetPrototypeMethod(tpl, "poll", poll); + Nan::SetPrototypeMethod(tpl, "stop", stop); + Nan::SetPrototypeMethod(tpl, "destroy", destroy); + + constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); + Nan::Set(target, Nan::New("Poller").ToLocalChecked(), Nan::GetFunction(tpl).ToLocalChecked()); +} + +NAN_METHOD(Poller::New) { + if (!info.IsConstructCall()) { + const int argc = 2; + v8::Local argv[argc] = {info[0], info[1]}; + v8::Local cons = Nan::New(constructor()); + info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); + return; + } + + if (!info[0]->IsInt32()) { + Nan::ThrowTypeError("fd must be an int"); + return; + } + int fd = Nan::To(info[0]).FromJust(); + + if (!info[1]->IsFunction()) { + Nan::ThrowTypeError("cb must be a function"); + return; + } + + Poller *obj = new Poller(fd); + obj->callback.Reset(info[1].As()); + obj->Wrap(info.This()); + info.GetReturnValue().Set(info.This()); +} + +NAN_METHOD(Poller::poll) { + Poller* obj = Nan::ObjectWrap::Unwrap(info.Holder()); + if (!info[0]->IsInt32()) { + Nan::ThrowTypeError("events must be an int"); + return; + } + int events = Nan::To(info[0]).FromJust(); + obj->poll(events); +} + +NAN_METHOD(Poller::stop) { + Poller* obj = Nan::ObjectWrap::Unwrap(info.Holder()); + obj->stop(); +} + +NAN_METHOD(Poller::destroy) { + Poller* obj = Nan::ObjectWrap::Unwrap(info.Holder()); + obj->persistent().Reset(); + delete obj; +} + +inline Nan::Persistent & Poller::constructor() { + static Nan::Persistent my_constructor; + return my_constructor; +} diff --git a/server/node_modules/@serialport/bindings/src/poller.h b/server/node_modules/@serialport/bindings/src/poller.h new file mode 100644 index 0000000..3b15a2d --- /dev/null +++ b/server/node_modules/@serialport/bindings/src/poller.h @@ -0,0 +1,34 @@ +#ifndef PACKAGES_SERIALPORT_SRC_POLLER_H_ +#define PACKAGES_SERIALPORT_SRC_POLLER_H_ + +#include + +class Poller : public Nan::ObjectWrap, public Nan::AsyncResource { + public: + static NAN_MODULE_INIT(Init); + static void onData(uv_poll_t* handle, int status, int events); + static void onClose(uv_handle_t* poll_handle); + + private: + int fd; + uv_poll_t* poll_handle; + Nan::Callback callback; + bool uv_poll_init_success = false; + + // can this be read off of poll_handle? + int events = 0; + + explicit Poller(int fd); + ~Poller(); + void poll(int events); + void stop(); + int _stop(); + + static NAN_METHOD(New); + static NAN_METHOD(poll); + static NAN_METHOD(stop); + static NAN_METHOD(destroy); + static inline Nan::Persistent & constructor(); +}; + +#endif // PACKAGES_SERIALPORT_SRC_POLLER_H_ diff --git a/server/node_modules/@serialport/bindings/src/serialport.cpp b/server/node_modules/@serialport/bindings/src/serialport.cpp new file mode 100644 index 0000000..dfe908b --- /dev/null +++ b/server/node_modules/@serialport/bindings/src/serialport.cpp @@ -0,0 +1,486 @@ +#include "./serialport.h" + +#ifdef __APPLE__ + #include "./darwin_list.h" +#endif + +#ifdef WIN32 + #define strncasecmp strnicmp + #include "./serialport_win.h" +#else + #include "./poller.h" +#endif + +v8::Local getValueFromObject(v8::Local options, std::string key) { + v8::Local v8str = Nan::New(key).ToLocalChecked(); + return Nan::Get(options, v8str).ToLocalChecked(); +} + +int getIntFromObject(v8::Local options, std::string key) { + return Nan::To(getValueFromObject(options, key)).ToLocalChecked()->Value(); +} + +bool getBoolFromObject(v8::Local options, std::string key) { + return Nan::To(getValueFromObject(options, key)).ToLocalChecked()->Value(); +} + +v8::Local getStringFromObj(v8::Local options, std::string key) { + return Nan::To(getValueFromObject(options, key)).ToLocalChecked(); +} + +double getDoubleFromObject(v8::Local options, std::string key) { + return Nan::To(getValueFromObject(options, key)).FromMaybe(0); +} + +NAN_METHOD(Open) { + // path + if (!info[0]->IsString()) { + Nan::ThrowTypeError("First argument must be a string"); + return; + } + Nan::Utf8String path(info[0]); + + // options + if (!info[1]->IsObject()) { + Nan::ThrowTypeError("Second argument must be an object"); + return; + } + v8::Local options = Nan::To(info[1]).ToLocalChecked(); + + // callback + if (!info[2]->IsFunction()) { + Nan::ThrowTypeError("Third argument must be a function"); + return; + } + + OpenBaton* baton = new OpenBaton(); + snprintf(baton->path, sizeof(baton->path), "%s", *path); + baton->baudRate = getIntFromObject(options, "baudRate"); + baton->dataBits = getIntFromObject(options, "dataBits"); + baton->parity = ToParityEnum(getStringFromObj(options, "parity")); + baton->stopBits = ToStopBitEnum(getDoubleFromObject(options, "stopBits")); + baton->rtscts = getBoolFromObject(options, "rtscts"); + baton->xon = getBoolFromObject(options, "xon"); + baton->xoff = getBoolFromObject(options, "xoff"); + baton->xany = getBoolFromObject(options, "xany"); + baton->hupcl = getBoolFromObject(options, "hupcl"); + baton->lock = getBoolFromObject(options, "lock"); + baton->callback.Reset(info[2].As()); + + #ifndef WIN32 + baton->vmin = getIntFromObject(options, "vmin"); + baton->vtime = getIntFromObject(options, "vtime"); + #endif + + uv_work_t* req = new uv_work_t(); + req->data = baton; + + uv_queue_work(uv_default_loop(), req, EIO_Open, (uv_after_work_cb)EIO_AfterOpen); +} + +void EIO_AfterOpen(uv_work_t* req) { + Nan::HandleScope scope; + + OpenBaton* data = static_cast(req->data); + + v8::Local argv[2]; + if (data->errorString[0]) { + argv[0] = v8::Exception::Error(Nan::New(data->errorString).ToLocalChecked()); + argv[1] = Nan::Undefined(); + } else { + argv[0] = Nan::Null(); + argv[1] = Nan::New(data->result); + } + + data->callback.Call(2, argv, data); + delete data; + delete req; +} + +NAN_METHOD(Update) { + // file descriptor + if (!info[0]->IsInt32()) { + Nan::ThrowTypeError("First argument must be an int"); + return; + } + int fd = Nan::To(info[0]).FromJust(); + + // options + if (!info[1]->IsObject()) { + Nan::ThrowTypeError("Second argument must be an object"); + return; + } + v8::Local options = Nan::To(info[1]).ToLocalChecked(); + + if (!Nan::Has(options, Nan::New("baudRate").ToLocalChecked()).FromMaybe(false)) { + Nan::ThrowTypeError("\"baudRate\" must be set on options object"); + return; + } + + // callback + if (!info[2]->IsFunction()) { + Nan::ThrowTypeError("Third argument must be a function"); + return; + } + + ConnectionOptionsBaton* baton = new ConnectionOptionsBaton(); + + baton->fd = fd; + baton->baudRate = getIntFromObject(options, "baudRate"); + baton->callback.Reset(info[2].As()); + + uv_work_t* req = new uv_work_t(); + req->data = baton; + + uv_queue_work(uv_default_loop(), req, EIO_Update, (uv_after_work_cb)EIO_AfterUpdate); +} + +void EIO_AfterUpdate(uv_work_t* req) { + Nan::HandleScope scope; + + ConnectionOptionsBaton* data = static_cast(req->data); + + v8::Local argv[1]; + if (data->errorString[0]) { + argv[0] = v8::Exception::Error(Nan::New(data->errorString).ToLocalChecked()); + } else { + argv[0] = Nan::Null(); + } + + data->callback.Call(1, argv, data); + + delete data; + delete req; +} + +NAN_METHOD(Close) { + // file descriptor + if (!info[0]->IsInt32()) { + Nan::ThrowTypeError("First argument must be an int"); + return; + } + + // callback + if (!info[1]->IsFunction()) { + Nan::ThrowTypeError("Second argument must be a function"); + return; + } + + VoidBaton* baton = new VoidBaton(); + baton->fd = Nan::To(info[0]).ToLocalChecked()->Value(); + baton->callback.Reset(info[1].As()); + + uv_work_t* req = new uv_work_t(); + req->data = baton; + uv_queue_work(uv_default_loop(), req, EIO_Close, (uv_after_work_cb)EIO_AfterClose); +} + +void EIO_AfterClose(uv_work_t* req) { + Nan::HandleScope scope; + VoidBaton* data = static_cast(req->data); + + v8::Local argv[1]; + if (data->errorString[0]) { + argv[0] = v8::Exception::Error(Nan::New(data->errorString).ToLocalChecked()); + } else { + argv[0] = Nan::Null(); + } + data->callback.Call(1, argv, data); + + delete data; + delete req; +} + +NAN_METHOD(Flush) { + // file descriptor + if (!info[0]->IsInt32()) { + Nan::ThrowTypeError("First argument must be an int"); + return; + } + int fd = Nan::To(info[0]).FromJust(); + + // callback + if (!info[1]->IsFunction()) { + Nan::ThrowTypeError("Second argument must be a function"); + return; + } + v8::Local callback = info[1].As(); + + VoidBaton* baton = new VoidBaton(); + baton->fd = fd; + baton->callback.Reset(callback); + + uv_work_t* req = new uv_work_t(); + req->data = baton; + uv_queue_work(uv_default_loop(), req, EIO_Flush, (uv_after_work_cb)EIO_AfterFlush); +} + +void EIO_AfterFlush(uv_work_t* req) { + Nan::HandleScope scope; + + VoidBaton* data = static_cast(req->data); + + v8::Local argv[1]; + + if (data->errorString[0]) { + argv[0] = v8::Exception::Error(Nan::New(data->errorString).ToLocalChecked()); + } else { + argv[0] = Nan::Null(); + } + + data->callback.Call(1, argv, data); + + delete data; + delete req; +} + +NAN_METHOD(Set) { + // file descriptor + if (!info[0]->IsInt32()) { + Nan::ThrowTypeError("First argument must be an int"); + return; + } + int fd = Nan::To(info[0]).FromJust(); + + // options + if (!info[1]->IsObject()) { + Nan::ThrowTypeError("Second argument must be an object"); + return; + } + v8::Local options = Nan::To(info[1]).ToLocalChecked(); + + // callback + if (!info[2]->IsFunction()) { + Nan::ThrowTypeError("Third argument must be a function"); + return; + } + v8::Local callback = info[2].As(); + + SetBaton* baton = new SetBaton(); + baton->fd = fd; + baton->callback.Reset(callback); + baton->brk = getBoolFromObject(options, "brk"); + baton->rts = getBoolFromObject(options, "rts"); + baton->cts = getBoolFromObject(options, "cts"); + baton->dtr = getBoolFromObject(options, "dtr"); + baton->dsr = getBoolFromObject(options, "dsr"); + baton->lowLatency = getBoolFromObject(options, "lowLatency"); + + uv_work_t* req = new uv_work_t(); + req->data = baton; + uv_queue_work(uv_default_loop(), req, EIO_Set, (uv_after_work_cb)EIO_AfterSet); +} + +void EIO_AfterSet(uv_work_t* req) { + Nan::HandleScope scope; + + SetBaton* data = static_cast(req->data); + + v8::Local argv[1]; + + if (data->errorString[0]) { + argv[0] = v8::Exception::Error(Nan::New(data->errorString).ToLocalChecked()); + } else { + argv[0] = Nan::Null(); + } + data->callback.Call(1, argv, data); + + delete data; + delete req; +} + +NAN_METHOD(Get) { + // file descriptor + if (!info[0]->IsInt32()) { + Nan::ThrowTypeError("First argument must be an int"); + return; + } + int fd = Nan::To(info[0]).FromJust(); + + // callback + if (!info[1]->IsFunction()) { + Nan::ThrowTypeError("Second argument must be a function"); + return; + } + + GetBaton* baton = new GetBaton(); + baton->fd = fd; + baton->cts = false; + baton->dsr = false; + baton->dcd = false; + baton->lowLatency = false; + baton->callback.Reset(info[1].As()); + + uv_work_t* req = new uv_work_t(); + req->data = baton; + uv_queue_work(uv_default_loop(), req, EIO_Get, (uv_after_work_cb)EIO_AfterGet); +} + +void EIO_AfterGet(uv_work_t* req) { + Nan::HandleScope scope; + + GetBaton* data = static_cast(req->data); + + v8::Local argv[2]; + + if (data->errorString[0]) { + argv[0] = v8::Exception::Error(Nan::New(data->errorString).ToLocalChecked()); + argv[1] = Nan::Undefined(); + } else { + v8::Local results = Nan::New(); + Nan::Set(results, Nan::New("cts").ToLocalChecked(), Nan::New(data->cts)); + Nan::Set(results, Nan::New("dsr").ToLocalChecked(), Nan::New(data->dsr)); + Nan::Set(results, Nan::New("dcd").ToLocalChecked(), Nan::New(data->dcd)); + Nan::Set(results, Nan::New("lowLatency").ToLocalChecked(), Nan::New(data->lowLatency)); + + argv[0] = Nan::Null(); + argv[1] = results; + } + data->callback.Call(2, argv, data); + + delete data; + delete req; +} + +NAN_METHOD(GetBaudRate) { + // file descriptor + if (!info[0]->IsInt32()) { + Nan::ThrowTypeError("First argument must be an int"); + return; + } + int fd = Nan::To(info[0]).FromJust(); + + // callback + if (!info[1]->IsFunction()) { + Nan::ThrowTypeError("Second argument must be a function"); + return; + } + + GetBaudRateBaton* baton = new GetBaudRateBaton(); + baton->fd = fd; + baton->baudRate = 0; + baton->callback.Reset(info[1].As()); + + uv_work_t* req = new uv_work_t(); + req->data = baton; + uv_queue_work(uv_default_loop(), req, EIO_GetBaudRate, (uv_after_work_cb)EIO_AfterGetBaudRate); +} + +void EIO_AfterGetBaudRate(uv_work_t* req) { + Nan::HandleScope scope; + + GetBaudRateBaton* data = static_cast(req->data); + + v8::Local argv[2]; + + if (data->errorString[0]) { + argv[0] = v8::Exception::Error(Nan::New(data->errorString).ToLocalChecked()); + argv[1] = Nan::Undefined(); + } else { + v8::Local results = Nan::New(); + Nan::Set(results, Nan::New("baudRate").ToLocalChecked(), Nan::New(data->baudRate)); + + argv[0] = Nan::Null(); + argv[1] = results; + } + data->callback.Call(2, argv, data); + + delete data; + delete req; +} + +NAN_METHOD(Drain) { + // file descriptor + if (!info[0]->IsInt32()) { + Nan::ThrowTypeError("First argument must be an int"); + return; + } + int fd = Nan::To(info[0]).FromJust(); + + // callback + if (!info[1]->IsFunction()) { + Nan::ThrowTypeError("Second argument must be a function"); + return; + } + + VoidBaton* baton = new VoidBaton(); + baton->fd = fd; + baton->callback.Reset(info[1].As()); + + uv_work_t* req = new uv_work_t(); + req->data = baton; + uv_queue_work(uv_default_loop(), req, EIO_Drain, (uv_after_work_cb)EIO_AfterDrain); +} + +void EIO_AfterDrain(uv_work_t* req) { + Nan::HandleScope scope; + + VoidBaton* data = static_cast(req->data); + + v8::Local argv[1]; + + if (data->errorString[0]) { + argv[0] = v8::Exception::Error(Nan::New(data->errorString).ToLocalChecked()); + } else { + argv[0] = Nan::Null(); + } + data->callback.Call(1, argv, data); + + delete data; + delete req; +} + +SerialPortParity NAN_INLINE(ToParityEnum(const v8::Local& v8str)) { + Nan::HandleScope scope; + Nan::Utf8String str(v8str); + size_t count = strlen(*str); + SerialPortParity parity = SERIALPORT_PARITY_NONE; + if (!strncasecmp(*str, "none", count)) { + parity = SERIALPORT_PARITY_NONE; + } else if (!strncasecmp(*str, "even", count)) { + parity = SERIALPORT_PARITY_EVEN; + } else if (!strncasecmp(*str, "mark", count)) { + parity = SERIALPORT_PARITY_MARK; + } else if (!strncasecmp(*str, "odd", count)) { + parity = SERIALPORT_PARITY_ODD; + } else if (!strncasecmp(*str, "space", count)) { + parity = SERIALPORT_PARITY_SPACE; + } + return parity; +} + +SerialPortStopBits NAN_INLINE(ToStopBitEnum(double stopBits)) { + if (stopBits > 1.4 && stopBits < 1.6) { + return SERIALPORT_STOPBITS_ONE_FIVE; + } + if (stopBits == 2) { + return SERIALPORT_STOPBITS_TWO; + } + return SERIALPORT_STOPBITS_ONE; +} + +NAN_MODULE_INIT(init) { + Nan::HandleScope scope; + Nan::SetMethod(target, "set", Set); + Nan::SetMethod(target, "get", Get); + Nan::SetMethod(target, "getBaudRate", GetBaudRate); + Nan::SetMethod(target, "open", Open); + Nan::SetMethod(target, "update", Update); + Nan::SetMethod(target, "close", Close); + Nan::SetMethod(target, "flush", Flush); + Nan::SetMethod(target, "drain", Drain); + + #ifdef __APPLE__ + Nan::SetMethod(target, "list", List); + #endif + + #ifdef WIN32 + Nan::SetMethod(target, "write", Write); + Nan::SetMethod(target, "read", Read); + Nan::SetMethod(target, "list", List); + #else + Poller::Init(target); + #endif +} + +NODE_MODULE(serialport, init); diff --git a/server/node_modules/@serialport/bindings/src/serialport.h b/server/node_modules/@serialport/bindings/src/serialport.h new file mode 100644 index 0000000..5397d4d --- /dev/null +++ b/server/node_modules/@serialport/bindings/src/serialport.h @@ -0,0 +1,147 @@ +#ifndef PACKAGES_SERIALPORT_SRC_SERIALPORT_H_ +#define PACKAGES_SERIALPORT_SRC_SERIALPORT_H_ + +// Workaround for electron 11 abi issue https://github.com/serialport/node-serialport/issues/2191 +#include +#if CHECK_NODE_MODULE_VERSION && NODE_MODULE_VERSION == 85 +#define V8_REVERSE_JSARGS +#endif + +#include +#include +#include +#include +#include + +#define ERROR_STRING_SIZE 1024 + +NAN_METHOD(Open); +void EIO_Open(uv_work_t* req); +void EIO_AfterOpen(uv_work_t* req); + +NAN_METHOD(Update); +void EIO_Update(uv_work_t* req); +void EIO_AfterUpdate(uv_work_t* req); + +NAN_METHOD(Close); +void EIO_Close(uv_work_t* req); +void EIO_AfterClose(uv_work_t* req); + +NAN_METHOD(Flush); +void EIO_Flush(uv_work_t* req); +void EIO_AfterFlush(uv_work_t* req); + +NAN_METHOD(Set); +void EIO_Set(uv_work_t* req); +void EIO_AfterSet(uv_work_t* req); + +NAN_METHOD(Get); +void EIO_Get(uv_work_t* req); +void EIO_AfterGet(uv_work_t* req); + +NAN_METHOD(GetBaudRate); +void EIO_GetBaudRate(uv_work_t* req); +void EIO_AfterGetBaudRate(uv_work_t* req); + +NAN_METHOD(Drain); +void EIO_Drain(uv_work_t* req); +void EIO_AfterDrain(uv_work_t* req); + +enum SerialPortParity { + SERIALPORT_PARITY_NONE = 1, + SERIALPORT_PARITY_MARK = 2, + SERIALPORT_PARITY_EVEN = 3, + SERIALPORT_PARITY_ODD = 4, + SERIALPORT_PARITY_SPACE = 5 +}; + +enum SerialPortStopBits { + SERIALPORT_STOPBITS_ONE = 1, + SERIALPORT_STOPBITS_ONE_FIVE = 2, + SERIALPORT_STOPBITS_TWO = 3 +}; + +SerialPortParity ToParityEnum(const v8::Local& str); +SerialPortStopBits ToStopBitEnum(double stopBits); + +struct OpenBaton : public Nan::AsyncResource { + OpenBaton() : + AsyncResource("node-serialport:OpenBaton"), errorString(), path() {} + char errorString[ERROR_STRING_SIZE]; + Nan::Callback callback; + char path[1024]; + int fd = 0; + int result = 0; + int baudRate = 0; + int dataBits = 0; + bool rtscts = false; + bool xon = false; + bool xoff = false; + bool xany = false; + bool dsrdtr = false; + bool hupcl = false; + bool lock = false; + SerialPortParity parity; + SerialPortStopBits stopBits; +#ifndef WIN32 + uint8_t vmin = 0; + uint8_t vtime = 0; +#endif +}; + +struct ConnectionOptions { + ConnectionOptions() : errorString() {} + char errorString[ERROR_STRING_SIZE]; + int fd = 0; + int baudRate = 0; +}; +struct ConnectionOptionsBaton : ConnectionOptions, Nan::AsyncResource { + ConnectionOptionsBaton() : + AsyncResource("node-serialport:ConnectionOptionsBaton") {} + Nan::Callback callback; +}; + +struct SetBaton : public Nan::AsyncResource { + SetBaton() : AsyncResource("node-serialport:SetBaton"), errorString() {} + int fd = 0; + Nan::Callback callback; + int result = 0; + char errorString[ERROR_STRING_SIZE]; + bool rts = false; + bool cts = false; + bool dtr = false; + bool dsr = false; + bool brk = false; + bool lowLatency = false; +}; + +struct GetBaton : public Nan::AsyncResource { + GetBaton() : AsyncResource("node-serialport:GetBaton"), errorString() {} + int fd = 0; + Nan::Callback callback; + char errorString[ERROR_STRING_SIZE]; + bool cts = false; + bool dsr = false; + bool dcd = false; + bool lowLatency = false; +}; + +struct GetBaudRateBaton : public Nan::AsyncResource { + GetBaudRateBaton() : + AsyncResource("node-serialport:GetBaudRateBaton"), errorString() {} + int fd = 0; + Nan::Callback callback; + char errorString[ERROR_STRING_SIZE]; + int baudRate = 0; +}; + +struct VoidBaton : public Nan::AsyncResource { + VoidBaton() : AsyncResource("node-serialport:VoidBaton"), errorString() {} + int fd = 0; + Nan::Callback callback; + char errorString[ERROR_STRING_SIZE]; +}; + +int setup(int fd, OpenBaton *data); +int setBaudRate(ConnectionOptions *data); +#endif // PACKAGES_SERIALPORT_SRC_SERIALPORT_H_ diff --git a/server/node_modules/@serialport/bindings/src/serialport_linux.cpp b/server/node_modules/@serialport/bindings/src/serialport_linux.cpp new file mode 100755 index 0000000..b53ed13 --- /dev/null +++ b/server/node_modules/@serialport/bindings/src/serialport_linux.cpp @@ -0,0 +1,76 @@ +#if defined(__linux__) + +#include +#include +#include +#include + +// Uses the termios2 interface to set nonstandard baud rates +int linuxSetCustomBaudRate(const int fd, const unsigned int baudrate) { + struct termios2 t; + + if (ioctl(fd, TCGETS2, &t) == -1) { + return -1; + } + + t.c_cflag &= ~CBAUD; + t.c_cflag |= BOTHER; + t.c_ospeed = t.c_ispeed = baudrate; + + if (ioctl(fd, TCSETS2, &t) == -1) { + return -2; + } + + return 0; +} + +// Uses termios2 interface to retrieve system reported baud rate +int linuxGetSystemBaudRate(const int fd, int* const outbaud) { + struct termios2 t; + + if (ioctl(fd, TCGETS2, &t) == -1) { + return -1; + } + + *outbaud = static_cast(t.c_ospeed); + + return 0; +} + +int linuxSetLowLatencyMode(const int fd, const bool enable) { + struct serial_struct ss; + + if (ioctl(fd, TIOCGSERIAL, &ss) == -1) { + return -1; + } + + if ((ss.flags & ASYNC_LOW_LATENCY) == enable) { + return 0; + } + + if (enable) { + ss.flags |= ASYNC_LOW_LATENCY; + } else { + ss.flags &= ~ASYNC_LOW_LATENCY; + } + + if (ioctl(fd, TIOCSSERIAL, &ss) == -1) { + return -2; + } + + return 0; +} + +int linuxGetLowLatencyMode(const int fd, bool* const enabled) { + struct serial_struct ss; + + if (ioctl(fd, TIOCGSERIAL, &ss) == -1) { + return -1; + } + + *enabled = ss.flags & ASYNC_LOW_LATENCY; + + return 0; +} + +#endif diff --git a/server/node_modules/@serialport/bindings/src/serialport_linux.h b/server/node_modules/@serialport/bindings/src/serialport_linux.h new file mode 100755 index 0000000..f6eb928 --- /dev/null +++ b/server/node_modules/@serialport/bindings/src/serialport_linux.h @@ -0,0 +1,10 @@ +#ifndef PACKAGES_SERIALPORT_SRC_SERIALPORT_LINUX_H_ +#define PACKAGES_SERIALPORT_SRC_SERIALPORT_LINUX_H_ + +int linuxSetCustomBaudRate(const int fd, const unsigned int baudrate); +int linuxGetSystemBaudRate(const int fd, int* const outbaud); +int linuxSetLowLatencyMode(const int fd, const bool enable); +int linuxGetLowLatencyMode(const int fd, bool* const enabled); + +#endif // PACKAGES_SERIALPORT_SRC_SERIALPORT_LINUX_H_ + diff --git a/server/node_modules/@serialport/bindings/src/serialport_unix.cpp b/server/node_modules/@serialport/bindings/src/serialport_unix.cpp new file mode 100644 index 0000000..25fc698 --- /dev/null +++ b/server/node_modules/@serialport/bindings/src/serialport_unix.cpp @@ -0,0 +1,426 @@ +#include "serialport_unix.h" +#include "serialport.h" + +#include +#include +#include +#include +#include + +#ifdef __APPLE__ +#include +#include +#endif + +#if defined(MAC_OS_X_VERSION_10_4) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4) +#include +#include + +#elif defined(__NetBSD__) +#include + +#elif defined(__OpenBSD__) +#include + +#elif defined(__linux__) +#include +#include +#include "serialport_linux.h" +#endif + +int ToStopBitsConstant(SerialPortStopBits stopBits); + +int ToBaudConstant(int baudRate) { + switch (baudRate) { + case 0: return B0; + case 50: return B50; + case 75: return B75; + case 110: return B110; + case 134: return B134; + case 150: return B150; + case 200: return B200; + case 300: return B300; + case 600: return B600; + case 1200: return B1200; + case 1800: return B1800; + case 2400: return B2400; + case 4800: return B4800; + case 9600: return B9600; + case 19200: return B19200; + case 38400: return B38400; + case 57600: return B57600; + case 115200: return B115200; + case 230400: return B230400; +#if defined(__linux__) + case 460800: return B460800; + case 500000: return B500000; + case 576000: return B576000; + case 921600: return B921600; + case 1000000: return B1000000; + case 1152000: return B1152000; + case 1500000: return B1500000; + case 2000000: return B2000000; + case 2500000: return B2500000; + case 3000000: return B3000000; + case 3500000: return B3500000; + case 4000000: return B4000000; +#endif + } + return -1; +} + +int ToDataBitsConstant(int dataBits) { + switch (dataBits) { + case 8: default: return CS8; + case 7: return CS7; + case 6: return CS6; + case 5: return CS5; + } + return -1; +} + +void EIO_Open(uv_work_t* req) { + OpenBaton* data = static_cast(req->data); + + int flags = (O_RDWR | O_NOCTTY | O_NONBLOCK | O_CLOEXEC | O_SYNC); + int fd = open(data->path, flags); + + if (-1 == fd) { + snprintf(data->errorString, sizeof(data->errorString), "Error: %s, cannot open %s", strerror(errno), data->path); + return; + } + + if (-1 == setup(fd, data)) { + close(fd); + return; + } + + data->result = fd; +} + +int setBaudRate(ConnectionOptions *data) { + // lookup the standard baudrates from the table + int baudRate = ToBaudConstant(data->baudRate); + int fd = data->fd; + + // get port options + struct termios options; + if (-1 == tcgetattr(fd, &options)) { + snprintf(data->errorString, sizeof(data->errorString), + "Error: %s setting custom baud rate of %d", strerror(errno), data->baudRate); + return -1; + } + + // If there is a custom baud rate on linux you can do the following trick with B38400 + #if defined(__linux__) && defined(ASYNC_SPD_CUST) + if (baudRate == -1) { + int err = linuxSetCustomBaudRate(fd, data->baudRate); + + if (err == -1) { + snprintf(data->errorString, sizeof(data->errorString), + "Error: %s || while retrieving termios2 info", strerror(errno)); + return -1; + } else if (err == -2) { + snprintf(data->errorString, sizeof(data->errorString), + "Error: %s || while setting custom baud rate of %d", strerror(errno), data->baudRate); + return -1; + } + + return 1; + } + #endif + + // On OS X, starting with Tiger, we can set a custom baud rate with ioctl + #if defined(MAC_OS_X_VERSION_10_4) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4) + if (-1 == baudRate) { + speed_t speed = data->baudRate; + if (-1 == ioctl(fd, IOSSIOSPEED, &speed)) { + snprintf(data->errorString, sizeof(data->errorString), + "Error: %s calling ioctl(.., IOSSIOSPEED, %ld )", strerror(errno), speed); + return -1; + } else { + tcflush(fd, TCIOFLUSH); + return 1; + } + } + #endif + + if (-1 == baudRate) { + snprintf(data->errorString, sizeof(data->errorString), + "Error baud rate of %d is not supported on your platform", data->baudRate); + return -1; + } + + // If we have a good baud rate set it and lets go + cfsetospeed(&options, baudRate); + cfsetispeed(&options, baudRate); + // throw away all the buffered data + tcflush(fd, TCIOFLUSH); + // make the changes now + tcsetattr(fd, TCSANOW, &options); + return 1; +} + +void EIO_Update(uv_work_t* req) { + ConnectionOptionsBaton* data = static_cast(req->data); + setBaudRate(data); +} + +int setup(int fd, OpenBaton *data) { + int dataBits = ToDataBitsConstant(data->dataBits); + if (-1 == dataBits) { + snprintf(data->errorString, sizeof(data->errorString), + "Invalid data bits setting %d", data->dataBits); + return -1; + } + + // Snow Leopard doesn't have O_CLOEXEC + if (-1 == fcntl(fd, F_SETFD, FD_CLOEXEC)) { + snprintf(data->errorString, sizeof(data->errorString), "Error %s Cannot open %s", strerror(errno), data->path); + return -1; + } + + // Get port configuration for modification + struct termios options; + tcgetattr(fd, &options); + + // IGNPAR: ignore bytes with parity errors + options.c_iflag = IGNPAR; + + // ICRNL: map CR to NL (otherwise a CR input on the other computer will not terminate input) + // Future potential option + // options.c_iflag = ICRNL; + // otherwise make device raw (no other input processing) + + // Specify data bits + options.c_cflag &= ~CSIZE; + options.c_cflag |= dataBits; + + options.c_cflag &= ~(CRTSCTS); + + if (data->rtscts) { + options.c_cflag |= CRTSCTS; + // evaluate specific flow control options + } + + options.c_iflag &= ~(IXON | IXOFF | IXANY); + + if (data->xon) { + options.c_iflag |= IXON; + } + + if (data->xoff) { + options.c_iflag |= IXOFF; + } + + if (data->xany) { + options.c_iflag |= IXANY; + } + + switch (data->parity) { + case SERIALPORT_PARITY_NONE: + options.c_cflag &= ~PARENB; + // options.c_cflag &= ~CSTOPB; + // options.c_cflag &= ~CSIZE; + // options.c_cflag |= CS8; + break; + case SERIALPORT_PARITY_ODD: + options.c_cflag |= PARENB; + options.c_cflag |= PARODD; + // options.c_cflag &= ~CSTOPB; + // options.c_cflag &= ~CSIZE; + // options.c_cflag |= CS7; + break; + case SERIALPORT_PARITY_EVEN: + options.c_cflag |= PARENB; + options.c_cflag &= ~PARODD; + // options.c_cflag &= ~CSTOPB; + // options.c_cflag &= ~CSIZE; + // options.c_cflag |= CS7; + break; + default: + snprintf(data->errorString, sizeof(data->errorString), "Invalid parity setting %d", data->parity); + return -1; + } + + switch (data->stopBits) { + case SERIALPORT_STOPBITS_ONE: + options.c_cflag &= ~CSTOPB; + break; + case SERIALPORT_STOPBITS_TWO: + options.c_cflag |= CSTOPB; + break; + default: + snprintf(data->errorString, sizeof(data->errorString), "Invalid stop bits setting %d", data->stopBits); + return -1; + } + + options.c_cflag |= CLOCAL; // ignore status lines + options.c_cflag |= CREAD; // enable receiver + if (data->hupcl) { + options.c_cflag |= HUPCL; // drop DTR (i.e. hangup) on close + } + + // Raw output + options.c_oflag = 0; + + // ICANON makes partial lines not readable. It should be optional. + // It works with ICRNL. + options.c_lflag = 0; // ICANON; + options.c_cc[VMIN]= data->vmin; + options.c_cc[VTIME]= data->vtime; + + // Note that tcsetattr() returns success if any of the requested changes could be successfully carried out. + // Therefore, when making multiple changes it may be necessary to follow this call with a further call to + // tcgetattr() to check that all changes have been performed successfully. + // This also fails on OSX + tcsetattr(fd, TCSANOW, &options); + + if (data->lock) { + if (-1 == flock(fd, LOCK_EX | LOCK_NB)) { + snprintf(data->errorString, sizeof(data->errorString), "Error %s Cannot lock port", strerror(errno)); + return -1; + } + } + + // Copy the connection options into the ConnectionOptionsBaton to set the baud rate + ConnectionOptions* connectionOptions = new ConnectionOptions(); + connectionOptions->fd = fd; + connectionOptions->baudRate = data->baudRate; + + if (-1 == setBaudRate(connectionOptions)) { + strncpy(data->errorString, connectionOptions->errorString, sizeof(data->errorString)); + delete(connectionOptions); + return -1; + } + delete(connectionOptions); + + // flush all unread and wrote data up to this point because it could have been received or sent with bad settings + // Not needed since setBaudRate does this for us + // tcflush(fd, TCIOFLUSH); + + return 1; +} + +void EIO_Close(uv_work_t* req) { + VoidBaton* data = static_cast(req->data); + + if (-1 == close(data->fd)) { + snprintf(data->errorString, sizeof(data->errorString), + "Error: %s, unable to close fd %d", strerror(errno), data->fd); + } +} + +void EIO_Set(uv_work_t* req) { + SetBaton* data = static_cast(req->data); + + int bits; + ioctl(data->fd, TIOCMGET, &bits); + + bits &= ~(TIOCM_RTS | TIOCM_CTS | TIOCM_DTR | TIOCM_DSR); + + if (data->rts) { + bits |= TIOCM_RTS; + } + + if (data->cts) { + bits |= TIOCM_CTS; + } + + if (data->dtr) { + bits |= TIOCM_DTR; + } + + if (data->dsr) { + bits |= TIOCM_DSR; + } + + int result = 0; + if (data->brk) { + result = ioctl(data->fd, TIOCSBRK, NULL); + } else { + result = ioctl(data->fd, TIOCCBRK, NULL); + } + + if (-1 == result) { + snprintf(data->errorString, sizeof(data->errorString), "Error: %s, cannot set", strerror(errno)); + return; + } + + if (-1 == ioctl(data->fd, TIOCMSET, &bits)) { + snprintf(data->errorString, sizeof(data->errorString), "Error: %s, cannot set", strerror(errno)); + return; + } + + #if defined(__linux__) + int err = linuxSetLowLatencyMode(data->fd, data->lowLatency); + // Only report errors when the lowLatency is being set to true. Attempting to set as false can error, since the default is false + if (data->lowLatency) { + if (err == -1) { + snprintf(data->errorString, sizeof(data->errorString), "Error: %s, cannot get low latency", strerror(errno)); + return; + } else if(err == -2) { + snprintf(data->errorString, sizeof(data->errorString), "Error: %s, cannot set low latency", strerror(errno)); + return; + } + } + #endif +} + +void EIO_Get(uv_work_t* req) { + GetBaton* data = static_cast(req->data); + + int bits; + if (-1 == ioctl(data->fd, TIOCMGET, &bits)) { + snprintf(data->errorString, sizeof(data->errorString), "Error: %s, cannot get", strerror(errno)); + return; + } + + data->cts = bits & TIOCM_CTS; + data->dsr = bits & TIOCM_DSR; + data->dcd = bits & TIOCM_CD; + + #if defined(__linux__) && defined(ASYNC_LOW_LATENCY) + bool lowlatency = false; + // Try to get low latency info, but we don't care if fails (a failure state will still return lowlatency = false) + linuxGetLowLatencyMode(data->fd, &lowlatency); + data->lowLatency = lowlatency; + #else + data->lowLatency = false; + #endif +} + +void EIO_GetBaudRate(uv_work_t* req) { + GetBaudRateBaton* data = static_cast(req->data); + int outbaud = -1; + + #if defined(__linux__) && defined(ASYNC_SPD_CUST) + if (-1 == linuxGetSystemBaudRate(data->fd, &outbaud)) { + snprintf(data->errorString, sizeof(data->errorString), "Error: %s, cannot get baud rate", strerror(errno)); + return; + } + #else + snprintf(data->errorString, sizeof(data->errorString), "Error: System baud rate check not implemented on this platform"); + return; + #endif + + data->baudRate = outbaud; +} + +void EIO_Flush(uv_work_t* req) { + VoidBaton* data = static_cast(req->data); + + if (-1 == tcflush(data->fd, TCIOFLUSH)) { + snprintf(data->errorString, sizeof(data->errorString), "Error: %s, cannot flush", strerror(errno)); + return; + } +} + +void EIO_Drain(uv_work_t* req) { + VoidBaton* data = static_cast(req->data); + + if (-1 == tcdrain(data->fd)) { + snprintf(data->errorString, sizeof(data->errorString), "Error: %s, cannot drain", strerror(errno)); + return; + } +} diff --git a/server/node_modules/@serialport/bindings/src/serialport_unix.h b/server/node_modules/@serialport/bindings/src/serialport_unix.h new file mode 100644 index 0000000..08b11e0 --- /dev/null +++ b/server/node_modules/@serialport/bindings/src/serialport_unix.h @@ -0,0 +1,7 @@ +#ifndef PACKAGES_SERIALPORT_SRC_SERIALPORT_UNIX_H_ +#define PACKAGES_SERIALPORT_SRC_SERIALPORT_UNIX_H_ + +int ToBaudConstant(int baudRate); +int ToDataBitsConstant(int dataBits); + +#endif // PACKAGES_SERIALPORT_SRC_SERIALPORT_UNIX_H_ diff --git a/server/node_modules/@serialport/bindings/src/serialport_win.cpp b/server/node_modules/@serialport/bindings/src/serialport_win.cpp new file mode 100644 index 0000000..9634834 --- /dev/null +++ b/server/node_modules/@serialport/bindings/src/serialport_win.cpp @@ -0,0 +1,954 @@ +#include "./serialport.h" +#include "./serialport_win.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#pragma comment(lib, "setupapi.lib") + +#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0])) + +#define MAX_BUFFER_SIZE 1000 + +// As per https://msdn.microsoft.com/en-us/library/windows/desktop/ms724872(v=vs.85).aspx +#define MAX_REGISTRY_KEY_SIZE 255 + +// Declare type of pointer to CancelIoEx function +typedef BOOL (WINAPI *CancelIoExType)(HANDLE hFile, LPOVERLAPPED lpOverlapped); + +static inline HANDLE int2handle(int ptr) { + return reinterpret_cast(static_cast(ptr)); +} + +std::list g_closingHandles; + +void ErrorCodeToString(const char* prefix, int errorCode, char *errorStr) { + switch (errorCode) { + case ERROR_FILE_NOT_FOUND: + _snprintf_s(errorStr, ERROR_STRING_SIZE, _TRUNCATE, "%s: File not found", prefix); + break; + case ERROR_INVALID_HANDLE: + _snprintf_s(errorStr, ERROR_STRING_SIZE, _TRUNCATE, "%s: Invalid handle", prefix); + break; + case ERROR_ACCESS_DENIED: + _snprintf_s(errorStr, ERROR_STRING_SIZE, _TRUNCATE, "%s: Access denied", prefix); + break; + case ERROR_OPERATION_ABORTED: + _snprintf_s(errorStr, ERROR_STRING_SIZE, _TRUNCATE, "%s: Operation aborted", prefix); + break; + case ERROR_INVALID_PARAMETER: + _snprintf_s(errorStr, ERROR_STRING_SIZE, _TRUNCATE, "%s: The parameter is incorrect", prefix); + break; + default: + _snprintf_s(errorStr, ERROR_STRING_SIZE, _TRUNCATE, "%s: Unknown error code %d", prefix, errorCode); + break; + } +} + +void AsyncCloseCallback(uv_handle_t* handle) { + uv_async_t* async = reinterpret_cast(handle); + delete async; +} + +void EIO_Open(uv_work_t* req) { + OpenBaton* data = static_cast(req->data); + + char originalPath[1024]; + strncpy_s(originalPath, sizeof(originalPath), data->path, _TRUNCATE); + // data->path is char[1024] but on Windows it has the form "COMx\0" or "COMxx\0" + // We want to prepend "\\\\.\\" to it before we call CreateFile + strncpy(data->path + 20, data->path, 10); + strncpy(data->path, "\\\\.\\", 4); + strncpy(data->path + 4, data->path + 20, 10); + + int shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; + if (data->lock) { + shareMode = 0; + } + + HANDLE file = CreateFile( + data->path, + GENERIC_READ | GENERIC_WRITE, + shareMode, // dwShareMode 0 Prevents other processes from opening if they request delete, read, or write access + NULL, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED, // allows for reading and writing at the same time and sets the handle for asynchronous I/O + NULL); + + if (file == INVALID_HANDLE_VALUE) { + DWORD errorCode = GetLastError(); + char temp[100]; + _snprintf_s(temp, sizeof(temp), _TRUNCATE, "Opening %s", originalPath); + ErrorCodeToString(temp, errorCode, data->errorString); + return; + } + + DCB dcb = { 0 }; + SecureZeroMemory(&dcb, sizeof(DCB)); + dcb.DCBlength = sizeof(DCB); + + if (!GetCommState(file, &dcb)) { + ErrorCodeToString("Open (GetCommState)", GetLastError(), data->errorString); + CloseHandle(file); + return; + } + + if (data->hupcl) { + dcb.fDtrControl = DTR_CONTROL_ENABLE; + } else { + dcb.fDtrControl = DTR_CONTROL_DISABLE; // disable DTR to avoid reset + } + + dcb.Parity = NOPARITY; + dcb.ByteSize = 8; + dcb.StopBits = ONESTOPBIT; + + + dcb.fOutxDsrFlow = FALSE; + dcb.fOutxCtsFlow = FALSE; + + if (data->xon) { + dcb.fOutX = TRUE; + } else { + dcb.fOutX = FALSE; + } + + if (data->xoff) { + dcb.fInX = TRUE; + } else { + dcb.fInX = FALSE; + } + + if (data->rtscts) { + dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; + dcb.fOutxCtsFlow = TRUE; + } else { + dcb.fRtsControl = RTS_CONTROL_DISABLE; + } + + dcb.fBinary = true; + dcb.BaudRate = data->baudRate; + dcb.ByteSize = data->dataBits; + + switch (data->parity) { + case SERIALPORT_PARITY_NONE: + dcb.Parity = NOPARITY; + break; + case SERIALPORT_PARITY_MARK: + dcb.Parity = MARKPARITY; + break; + case SERIALPORT_PARITY_EVEN: + dcb.Parity = EVENPARITY; + break; + case SERIALPORT_PARITY_ODD: + dcb.Parity = ODDPARITY; + break; + case SERIALPORT_PARITY_SPACE: + dcb.Parity = SPACEPARITY; + break; + } + + switch (data->stopBits) { + case SERIALPORT_STOPBITS_ONE: + dcb.StopBits = ONESTOPBIT; + break; + case SERIALPORT_STOPBITS_ONE_FIVE: + dcb.StopBits = ONE5STOPBITS; + break; + case SERIALPORT_STOPBITS_TWO: + dcb.StopBits = TWOSTOPBITS; + break; + } + + if (!SetCommState(file, &dcb)) { + ErrorCodeToString("Open (SetCommState)", GetLastError(), data->errorString); + CloseHandle(file); + return; + } + + // Set the timeouts for read and write operations. + // Read operation will wait for at least 1 byte to be received. + COMMTIMEOUTS commTimeouts = {}; + commTimeouts.ReadIntervalTimeout = 0; // Never timeout, always wait for data. + commTimeouts.ReadTotalTimeoutMultiplier = 0; // Do not allow big read timeout when big read buffer used + commTimeouts.ReadTotalTimeoutConstant = 0; // Total read timeout (period of read loop) + commTimeouts.WriteTotalTimeoutConstant = 0; // Const part of write timeout + commTimeouts.WriteTotalTimeoutMultiplier = 0; // Variable part of write timeout (per byte) + + if (!SetCommTimeouts(file, &commTimeouts)) { + ErrorCodeToString("Open (SetCommTimeouts)", GetLastError(), data->errorString); + CloseHandle(file); + return; + } + + // Remove garbage data in RX/TX queues + PurgeComm(file, PURGE_RXCLEAR); + PurgeComm(file, PURGE_TXCLEAR); + + data->result = static_cast(reinterpret_cast(file)); +} + +void EIO_Update(uv_work_t* req) { + ConnectionOptionsBaton* data = static_cast(req->data); + + DCB dcb = { 0 }; + SecureZeroMemory(&dcb, sizeof(DCB)); + dcb.DCBlength = sizeof(DCB); + + if (!GetCommState(int2handle(data->fd), &dcb)) { + ErrorCodeToString("Update (GetCommState)", GetLastError(), data->errorString); + return; + } + + dcb.BaudRate = data->baudRate; + + if (!SetCommState(int2handle(data->fd), &dcb)) { + ErrorCodeToString("Update (SetCommState)", GetLastError(), data->errorString); + return; + } +} + +void EIO_Set(uv_work_t* req) { + SetBaton* data = static_cast(req->data); + + if (data->rts) { + EscapeCommFunction(int2handle(data->fd), SETRTS); + } else { + EscapeCommFunction(int2handle(data->fd), CLRRTS); + } + + if (data->dtr) { + EscapeCommFunction(int2handle(data->fd), SETDTR); + } else { + EscapeCommFunction(int2handle(data->fd), CLRDTR); + } + + if (data->brk) { + EscapeCommFunction(int2handle(data->fd), SETBREAK); + } else { + EscapeCommFunction(int2handle(data->fd), CLRBREAK); + } + + DWORD bits = 0; + + GetCommMask(int2handle(data->fd), &bits); + + bits &= ~(EV_CTS | EV_DSR); + + if (data->cts) { + bits |= EV_CTS; + } + + if (data->dsr) { + bits |= EV_DSR; + } + + if (!SetCommMask(int2handle(data->fd), bits)) { + ErrorCodeToString("Setting options on COM port (SetCommMask)", GetLastError(), data->errorString); + return; + } +} + +void EIO_Get(uv_work_t* req) { + GetBaton* data = static_cast(req->data); + + DWORD bits = 0; + if (!GetCommModemStatus(int2handle(data->fd), &bits)) { + ErrorCodeToString("Getting control settings on COM port (GetCommModemStatus)", GetLastError(), data->errorString); + return; + } + + data->cts = bits & MS_CTS_ON; + data->dsr = bits & MS_DSR_ON; + data->dcd = bits & MS_RLSD_ON; +} + +void EIO_GetBaudRate(uv_work_t* req) { + GetBaudRateBaton* data = static_cast(req->data); + + DCB dcb = { 0 }; + SecureZeroMemory(&dcb, sizeof(DCB)); + dcb.DCBlength = sizeof(DCB); + + if (!GetCommState(int2handle(data->fd), &dcb)) { + ErrorCodeToString("Getting baud rate (GetCommState)", GetLastError(), data->errorString); + return; + } + + data->baudRate = static_cast(dcb.BaudRate); +} + +bool IsClosingHandle(int fd) { + for (std::list::iterator it = g_closingHandles.begin(); it != g_closingHandles.end(); ++it) { + if (fd == *it) { + g_closingHandles.remove(fd); + return true; + } + } + return false; +} + +NAN_METHOD(Write) { + // file descriptor + if (!info[0]->IsInt32()) { + Nan::ThrowTypeError("First argument must be an int"); + return; + } + int fd = Nan::To(info[0]).FromJust(); + + // buffer + if (!info[1]->IsObject() || !node::Buffer::HasInstance(info[1])) { + Nan::ThrowTypeError("Second argument must be a buffer"); + return; + } + v8::Local buffer = Nan::To(info[1]).ToLocalChecked(); + char* bufferData = node::Buffer::Data(buffer); + size_t bufferLength = node::Buffer::Length(buffer); + + // callback + if (!info[2]->IsFunction()) { + Nan::ThrowTypeError("Third argument must be a function"); + return; + } + + WriteBaton* baton = new WriteBaton(); + baton->fd = fd; + baton->buffer.Reset(buffer); + baton->bufferData = bufferData; + baton->bufferLength = bufferLength; + baton->offset = 0; + baton->callback.Reset(info[2].As()); + baton->complete = false; + + uv_async_t* async = new uv_async_t; + uv_async_init(uv_default_loop(), async, EIO_AfterWrite); + async->data = baton; + // WriteFileEx requires a thread that can block. Create a new thread to + // run the write operation, saving the handle so it can be deallocated later. + baton->hThread = CreateThread(NULL, 0, WriteThread, async, 0, NULL); +} + +void __stdcall WriteIOCompletion(DWORD errorCode, DWORD bytesTransferred, OVERLAPPED* ov) { + WriteBaton* baton = static_cast(ov->hEvent); + DWORD bytesWritten; + if (!GetOverlappedResult(int2handle(baton->fd), ov, &bytesWritten, TRUE)) { + errorCode = GetLastError(); + ErrorCodeToString("Writing to COM port (GetOverlappedResult)", errorCode, baton->errorString); + baton->complete = true; + return; + } + if (bytesWritten) { + baton->offset += bytesWritten; + if (baton->offset >= baton->bufferLength) { + baton->complete = true; + } + } +} + +DWORD __stdcall WriteThread(LPVOID param) { + uv_async_t* async = static_cast(param); + WriteBaton* baton = static_cast(async->data); + + OVERLAPPED* ov = new OVERLAPPED; + memset(ov, 0, sizeof(OVERLAPPED)); + ov->hEvent = static_cast(baton); + + while (!baton->complete) { + char* offsetPtr = baton->bufferData + baton->offset; + // WriteFileEx requires calling GetLastError even upon success. Clear the error beforehand. + SetLastError(0); + WriteFileEx(int2handle(baton->fd), offsetPtr, + static_cast(baton->bufferLength - baton->offset), ov, WriteIOCompletion); + // Error codes when call is successful, such as ERROR_MORE_DATA. + DWORD lastError = GetLastError(); + if (lastError != ERROR_SUCCESS) { + ErrorCodeToString("Writing to COM port (WriteFileEx)", lastError, baton->errorString); + break; + } + // IOCompletion routine is only called once this thread is in an alertable wait state. + SleepEx(INFINITE, TRUE); + } + delete ov; + // Signal the main thread to run the callback. + uv_async_send(async); + ExitThread(0); +} + +void EIO_AfterWrite(uv_async_t* req) { + Nan::HandleScope scope; + WriteBaton* baton = static_cast(req->data); + WaitForSingleObject(baton->hThread, INFINITE); + CloseHandle(baton->hThread); + uv_close(reinterpret_cast(req), AsyncCloseCallback); + + v8::Local argv[1]; + if (baton->errorString[0]) { + argv[0] = v8::Exception::Error(Nan::New(baton->errorString).ToLocalChecked()); + } else { + argv[0] = Nan::Null(); + } + baton->callback.Call(1, argv, baton); + baton->buffer.Reset(); + delete baton; +} + +NAN_METHOD(Read) { + // file descriptor + if (!info[0]->IsInt32()) { + Nan::ThrowTypeError("First argument must be a fd"); + return; + } + int fd = Nan::To(info[0]).FromJust(); + + // buffer + if (!info[1]->IsObject() || !node::Buffer::HasInstance(info[1])) { + Nan::ThrowTypeError("Second argument must be a buffer"); + return; + } + v8::Local buffer = Nan::To(info[1]).ToLocalChecked(); + size_t bufferLength = node::Buffer::Length(buffer); + + // offset + if (!info[2]->IsInt32()) { + Nan::ThrowTypeError("Third argument must be an int"); + return; + } + int offset = Nan::To(info[2]).ToLocalChecked()->Value(); + + // bytes to read + if (!info[3]->IsInt32()) { + Nan::ThrowTypeError("Fourth argument must be an int"); + return; + } + size_t bytesToRead = Nan::To(info[3]).ToLocalChecked()->Value(); + + if ((bytesToRead + offset) > bufferLength) { + Nan::ThrowTypeError("'bytesToRead' + 'offset' cannot be larger than the buffer's length"); + return; + } + + // callback + if (!info[4]->IsFunction()) { + Nan::ThrowTypeError("Fifth argument must be a function"); + return; + } + + ReadBaton* baton = new ReadBaton(); + baton->fd = fd; + baton->offset = offset; + baton->bytesToRead = bytesToRead; + baton->bufferLength = bufferLength; + baton->bufferData = node::Buffer::Data(buffer); + baton->callback.Reset(info[4].As()); + baton->complete = false; + + uv_async_t* async = new uv_async_t; + uv_async_init(uv_default_loop(), async, EIO_AfterRead); + async->data = baton; + // ReadFileEx requires a thread that can block. Create a new thread to + // run the read operation, saving the handle so it can be deallocated later. + baton->hThread = CreateThread(NULL, 0, ReadThread, async, 0, NULL); +} + +void __stdcall ReadIOCompletion(DWORD errorCode, DWORD bytesTransferred, OVERLAPPED* ov) { + ReadBaton* baton = static_cast(ov->hEvent); + + if (errorCode) { + ErrorCodeToString("Reading from COM port (ReadIOCompletion)", errorCode, baton->errorString); + baton->complete = true; + return; + } + + DWORD lastError; + if (!GetOverlappedResult(int2handle(baton->fd), ov, &bytesTransferred, TRUE)) { + lastError = GetLastError(); + ErrorCodeToString("Reading from COM port (GetOverlappedResult)", lastError, baton->errorString); + baton->complete = true; + return; + } + if (bytesTransferred) { + baton->bytesToRead -= bytesTransferred; + baton->bytesRead += bytesTransferred; + baton->offset += bytesTransferred; + } + + // ReadFileEx and GetOverlappedResult retrieved only 1 byte. Read any additional data in the input + // buffer. Set the timeout to MAXDWORD in order to disable timeouts, so the read operation will + // return immediately no matter how much data is available. + COMMTIMEOUTS commTimeouts = {}; + commTimeouts.ReadIntervalTimeout = MAXDWORD; + if (!SetCommTimeouts(int2handle(baton->fd), &commTimeouts)) { + lastError = GetLastError(); + ErrorCodeToString("Setting COM timeout (SetCommTimeouts)", lastError, baton->errorString); + baton->complete = true; + return; + } + + // Store additional data after whatever data has already been read. + char* offsetPtr = baton->bufferData + baton->offset; + + // ReadFile, unlike ReadFileEx, needs an event in the overlapped structure. + memset(ov, 0, sizeof(OVERLAPPED)); + ov->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + if (!ReadFile(int2handle(baton->fd), offsetPtr, baton->bytesToRead, &bytesTransferred, ov)) { + errorCode = GetLastError(); + + if (errorCode != ERROR_IO_PENDING) { + ErrorCodeToString("Reading from COM port (ReadFile)", errorCode, baton->errorString); + baton->complete = true; + CloseHandle(ov->hEvent); + return; + } + + if (!GetOverlappedResult(int2handle(baton->fd), ov, &bytesTransferred, TRUE)) { + lastError = GetLastError(); + ErrorCodeToString("Reading from COM port (GetOverlappedResult)", lastError, baton->errorString); + baton->complete = true; + CloseHandle(ov->hEvent); + return; + } + } + CloseHandle(ov->hEvent); + + baton->bytesToRead -= bytesTransferred; + baton->bytesRead += bytesTransferred; + baton->complete = true; +} + +DWORD __stdcall ReadThread(LPVOID param) { + uv_async_t* async = static_cast(param); + ReadBaton* baton = static_cast(async->data); + DWORD lastError; + + OVERLAPPED* ov = new OVERLAPPED; + memset(ov, 0, sizeof(OVERLAPPED)); + ov->hEvent = static_cast(baton); + + while (!baton->complete) { + // Reset the read timeout to 0, so that it will block until more data arrives. + COMMTIMEOUTS commTimeouts = {}; + commTimeouts.ReadIntervalTimeout = 0; + if (!SetCommTimeouts(int2handle(baton->fd), &commTimeouts)) { + lastError = GetLastError(); + ErrorCodeToString("Setting COM timeout (SetCommTimeouts)", lastError, baton->errorString); + break; + } + // ReadFileEx doesn't use overlapped's hEvent, so it is reserved for user data. + ov->hEvent = static_cast(baton); + char* offsetPtr = baton->bufferData + baton->offset; + // ReadFileEx requires calling GetLastError even upon success. Clear the error beforehand. + SetLastError(0); + // Only read 1 byte, so that the callback will be triggered once any data arrives. + ReadFileEx(int2handle(baton->fd), offsetPtr, 1, ov, ReadIOCompletion); + // Error codes when call is successful, such as ERROR_MORE_DATA. + lastError = GetLastError(); + if (lastError != ERROR_SUCCESS) { + ErrorCodeToString("Reading from COM port (ReadFileEx)", lastError, baton->errorString); + break; + } + // IOCompletion routine is only called once this thread is in an alertable wait state. + SleepEx(INFINITE, TRUE); + } + delete ov; + // Signal the main thread to run the callback. + uv_async_send(async); + ExitThread(0); +} + +void EIO_AfterRead(uv_async_t* req) { + Nan::HandleScope scope; + ReadBaton* baton = static_cast(req->data); + WaitForSingleObject(baton->hThread, INFINITE); + CloseHandle(baton->hThread); + uv_close(reinterpret_cast(req), AsyncCloseCallback); + + v8::Local argv[2]; + if (baton->errorString[0]) { + argv[0] = Nan::Error(baton->errorString); + argv[1] = Nan::Undefined(); + } else { + argv[0] = Nan::Null(); + argv[1] = Nan::New(static_cast(baton->bytesRead)); + } + + baton->callback.Call(2, argv, baton); + delete baton; +} + +void EIO_Close(uv_work_t* req) { + VoidBaton* data = static_cast(req->data); + + g_closingHandles.push_back(data->fd); + + HMODULE hKernel32 = LoadLibrary("kernel32.dll"); + // Look up function address + CancelIoExType pCancelIoEx = (CancelIoExType)GetProcAddress(hKernel32, "CancelIoEx"); + // Do something with it + if (pCancelIoEx) { + // Function exists so call it + // Cancel all pending IO Requests for the current device + pCancelIoEx(int2handle(data->fd), NULL); + } + if (!CloseHandle(int2handle(data->fd))) { + ErrorCodeToString("Closing connection (CloseHandle)", GetLastError(), data->errorString); + return; + } +} + +char *copySubstring(char *someString, int n) { + char *new_ = reinterpret_cast(malloc(sizeof(char)*n + 1)); + strncpy_s(new_, n + 1, someString, n); + new_[n] = '\0'; + return new_; +} + +NAN_METHOD(List) { + // callback + if (!info[0]->IsFunction()) { + Nan::ThrowTypeError("First argument must be a function"); + return; + } + + ListBaton* baton = new ListBaton(); + snprintf(baton->errorString, sizeof(baton->errorString), ""); + baton->callback.Reset(info[0].As()); + + uv_work_t* req = new uv_work_t(); + req->data = baton; + uv_queue_work(uv_default_loop(), req, EIO_List, (uv_after_work_cb)EIO_AfterList); +} + +// It's possible that the s/n is a construct and not the s/n of the parent USB +// composite device. This performs some convoluted registry lookups to fetch the USB s/n. +void getSerialNumber(const char *vid, + const char *pid, + const HDEVINFO hDevInfo, + SP_DEVINFO_DATA deviceInfoData, + const unsigned int maxSerialNumberLength, + char* serialNumber) { + _snprintf_s(serialNumber, maxSerialNumberLength, _TRUNCATE, ""); + if (vid == NULL || pid == NULL) { + return; + } + + DWORD dwSize; + WCHAR szWUuidBuffer[MAX_BUFFER_SIZE]; + WCHAR containerUuid[MAX_BUFFER_SIZE]; + + + // Fetch the "Container ID" for this device node. In USB context, this "Container + // ID" refers to the composite USB device, i.e. the USB device as a whole, not + // just one of its interfaces with a serial port driver attached. + + // From https://stackoverflow.com/questions/3438366/setupdigetdeviceproperty-usage-example: + // Because this is not compiled with UNICODE defined, the call to SetupDiGetDevicePropertyW + // has to be setup manually. + DEVPROPTYPE ulPropertyType; + typedef BOOL (WINAPI *FN_SetupDiGetDevicePropertyW)( + __in HDEVINFO DeviceInfoSet, + __in PSP_DEVINFO_DATA DeviceInfoData, + __in const DEVPROPKEY *PropertyKey, + __out DEVPROPTYPE *PropertyType, + __out_opt PBYTE PropertyBuffer, + __in DWORD PropertyBufferSize, + __out_opt PDWORD RequiredSize, + __in DWORD Flags); + + FN_SetupDiGetDevicePropertyW fn_SetupDiGetDevicePropertyW = (FN_SetupDiGetDevicePropertyW) + GetProcAddress(GetModuleHandle(TEXT("Setupapi.dll")), "SetupDiGetDevicePropertyW"); + + if (fn_SetupDiGetDevicePropertyW ( + hDevInfo, + &deviceInfoData, + &DEVPKEY_Device_ContainerId, + &ulPropertyType, + reinterpret_cast(szWUuidBuffer), + sizeof(szWUuidBuffer), + &dwSize, + 0)) { + szWUuidBuffer[dwSize] = '\0'; + + // Given the UUID bytes, build up a (widechar) string from it. There's some mangling + // going on. + StringFromGUID2((REFGUID)szWUuidBuffer, containerUuid, ARRAY_SIZE(containerUuid)); + } else { + // Container UUID could not be fetched, return empty serial number. + return; + } + + // NOTE: Devices might have a containerUuid like {00000000-0000-0000-FFFF-FFFFFFFFFFFF} + // This means they're non-removable, and are not handled (yet). + // Maybe they should inherit the s/n from somewhere else. + + // Sanitize input - for whatever reason, StringFromGUID2() returns a WCHAR* but + // the comparisons later need a plain old char*, in lowercase ASCII. + char wantedUuid[MAX_BUFFER_SIZE]; + _snprintf_s(wantedUuid, MAX_BUFFER_SIZE, _TRUNCATE, "%ws", containerUuid); + strlwr(wantedUuid); + + // Iterate through all the USB devices with the given VendorID/ProductID + + HKEY vendorProductHKey; + DWORD retCode; + char hkeyPath[MAX_BUFFER_SIZE]; + + _snprintf_s(hkeyPath, MAX_BUFFER_SIZE, _TRUNCATE, "SYSTEM\\CurrentControlSet\\Enum\\USB\\VID_%s&PID_%s", vid, pid); + + retCode = RegOpenKeyEx( + HKEY_LOCAL_MACHINE, + hkeyPath, + 0, + KEY_READ, + &vendorProductHKey); + + if (retCode == ERROR_SUCCESS) { + DWORD serialNumbersCount = 0; // number of subkeys + + // Fetch how many subkeys there are for this VendorID/ProductID pair. + // That's the number of devices for this VendorID/ProductID known to this machine. + + retCode = RegQueryInfoKey( + vendorProductHKey, // hkey handle + NULL, // buffer for class name + NULL, // size of class string + NULL, // reserved + &serialNumbersCount, // number of subkeys + NULL, // longest subkey size + NULL, // longest class string + NULL, // number of values for this key + NULL, // longest value name + NULL, // longest value data + NULL, // security descriptor + NULL); // last write time + + if (retCode == ERROR_SUCCESS && serialNumbersCount > 0) { + for (unsigned int i=0; i < serialNumbersCount; i++) { + // Each of the subkeys here is the serial number of a USB device with the + // given VendorId/ProductId. Now fetch the string for the S/N. + DWORD serialNumberLength = maxSerialNumberLength; + retCode = RegEnumKeyEx(vendorProductHKey, + i, + serialNumber, + &serialNumberLength, + NULL, + NULL, + NULL, + NULL); + + if (retCode == ERROR_SUCCESS) { + // Lookup info for VID_(vendorId)&PID_(productId)\(serialnumber) + + _snprintf_s(hkeyPath, MAX_BUFFER_SIZE, _TRUNCATE, + "SYSTEM\\CurrentControlSet\\Enum\\USB\\VID_%s&PID_%s\\%s", + vid, pid, serialNumber); + + HKEY deviceHKey; + + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, hkeyPath, 0, KEY_READ, &deviceHKey) == ERROR_SUCCESS) { + char readUuid[MAX_BUFFER_SIZE]; + DWORD readSize = sizeof(readUuid); + + // Query VID_(vendorId)&PID_(productId)\(serialnumber)\ContainerID + DWORD retCode = RegQueryValueEx(deviceHKey, "ContainerID", NULL, NULL, (LPBYTE)&readUuid, &readSize); + if (retCode == ERROR_SUCCESS) { + readUuid[readSize] = '\0'; + if (strcmp(wantedUuid, readUuid) == 0) { + // The ContainerID UUIDs match, return now that serialNumber has + // the right value. + RegCloseKey(deviceHKey); + RegCloseKey(vendorProductHKey); + return; + } + } + } + RegCloseKey(deviceHKey); + } + } + } + + /* In case we did not obtain the path, for whatever reason, we close the key and return an empty string. */ + RegCloseKey(vendorProductHKey); + } + + _snprintf_s(serialNumber, maxSerialNumberLength, _TRUNCATE, ""); + return; +} + +void EIO_List(uv_work_t* req) { + ListBaton* data = static_cast(req->data); + + GUID *guidDev = (GUID*)& GUID_DEVCLASS_PORTS; // NOLINT + HDEVINFO hDevInfo = SetupDiGetClassDevs(guidDev, NULL, NULL, DIGCF_PRESENT | DIGCF_PROFILE); + SP_DEVINFO_DATA deviceInfoData; + + int memberIndex = 0; + DWORD dwSize, dwPropertyRegDataType; + char szBuffer[MAX_BUFFER_SIZE]; + char *pnpId; + char *vendorId; + char *productId; + char *name; + char *manufacturer; + char *locationId; + char serialNumber[MAX_REGISTRY_KEY_SIZE]; + bool isCom; + while (true) { + isCom = false; + pnpId = NULL; + vendorId = NULL; + productId = NULL; + name = NULL; + manufacturer = NULL; + locationId = NULL; + + ZeroMemory(&deviceInfoData, sizeof(SP_DEVINFO_DATA)); + deviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); + + if (SetupDiEnumDeviceInfo(hDevInfo, memberIndex, &deviceInfoData) == FALSE) { + if (GetLastError() == ERROR_NO_MORE_ITEMS) { + break; + } + } + + dwSize = sizeof(szBuffer); + SetupDiGetDeviceInstanceId(hDevInfo, &deviceInfoData, szBuffer, dwSize, &dwSize); + szBuffer[dwSize] = '\0'; + pnpId = strdup(szBuffer); + + vendorId = strstr(szBuffer, "VID_"); + if (vendorId) { + vendorId += 4; + vendorId = copySubstring(vendorId, 4); + } + productId = strstr(szBuffer, "PID_"); + if (productId) { + productId += 4; + productId = copySubstring(productId, 4); + } + + getSerialNumber(vendorId, productId, hDevInfo, deviceInfoData, MAX_REGISTRY_KEY_SIZE, serialNumber); + + if (SetupDiGetDeviceRegistryProperty(hDevInfo, &deviceInfoData, + SPDRP_LOCATION_INFORMATION, &dwPropertyRegDataType, + reinterpret_cast(szBuffer), + sizeof(szBuffer), &dwSize)) { + locationId = strdup(szBuffer); + } + if (SetupDiGetDeviceRegistryProperty(hDevInfo, &deviceInfoData, + SPDRP_MFG, &dwPropertyRegDataType, + reinterpret_cast(szBuffer), + sizeof(szBuffer), &dwSize)) { + manufacturer = strdup(szBuffer); + } + + HKEY hkey = SetupDiOpenDevRegKey(hDevInfo, &deviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ); + if (hkey != INVALID_HANDLE_VALUE) { + dwSize = sizeof(szBuffer); + if (RegQueryValueEx(hkey, "PortName", NULL, NULL, (LPBYTE)&szBuffer, &dwSize) == ERROR_SUCCESS) { + szBuffer[dwSize] = '\0'; + name = strdup(szBuffer); + isCom = strstr(szBuffer, "COM") != NULL; + } + } + if (isCom) { + ListResultItem* resultItem = new ListResultItem(); + resultItem->path = name; + resultItem->manufacturer = manufacturer; + resultItem->pnpId = pnpId; + if (vendorId) { + resultItem->vendorId = vendorId; + } + if (productId) { + resultItem->productId = productId; + } + resultItem->serialNumber = serialNumber; + if (locationId) { + resultItem->locationId = locationId; + } + data->results.push_back(resultItem); + } + free(pnpId); + free(vendorId); + free(productId); + free(locationId); + free(manufacturer); + free(name); + + RegCloseKey(hkey); + memberIndex++; + } + if (hDevInfo) { + SetupDiDestroyDeviceInfoList(hDevInfo); + } +} + +void setIfNotEmpty(v8::Local item, std::string key, const char *value) { + v8::Local v8key = Nan::New(key).ToLocalChecked(); + if (strlen(value) > 0) { + Nan::Set(item, v8key, Nan::New(value).ToLocalChecked()); + } else { + Nan::Set(item, v8key, Nan::Undefined()); + } +} + +void EIO_AfterList(uv_work_t* req) { + Nan::HandleScope scope; + + ListBaton* data = static_cast(req->data); + + v8::Local argv[2]; + if (data->errorString[0]) { + argv[0] = v8::Exception::Error(Nan::New(data->errorString).ToLocalChecked()); + argv[1] = Nan::Undefined(); + } else { + v8::Local results = Nan::New(); + int i = 0; + for (std::list::iterator it = data->results.begin(); it != data->results.end(); ++it, i++) { + v8::Local item = Nan::New(); + + setIfNotEmpty(item, "path", (*it)->path.c_str()); + setIfNotEmpty(item, "manufacturer", (*it)->manufacturer.c_str()); + setIfNotEmpty(item, "serialNumber", (*it)->serialNumber.c_str()); + setIfNotEmpty(item, "pnpId", (*it)->pnpId.c_str()); + setIfNotEmpty(item, "locationId", (*it)->locationId.c_str()); + setIfNotEmpty(item, "vendorId", (*it)->vendorId.c_str()); + setIfNotEmpty(item, "productId", (*it)->productId.c_str()); + + Nan::Set(results, i, item); + } + argv[0] = Nan::Null(); + argv[1] = results; + } + data->callback.Call(2, argv, data); + + for (std::list::iterator it = data->results.begin(); it != data->results.end(); ++it) { + delete *it; + } + delete data; + delete req; +} + + +void EIO_Flush(uv_work_t* req) { + VoidBaton* data = static_cast(req->data); + + DWORD purge_all = PURGE_RXCLEAR | PURGE_TXABORT | PURGE_TXCLEAR; + if (!PurgeComm(int2handle(data->fd), purge_all)) { + ErrorCodeToString("Flushing connection (PurgeComm)", GetLastError(), data->errorString); + return; + } +} + +void EIO_Drain(uv_work_t* req) { + VoidBaton* data = static_cast(req->data); + + if (!FlushFileBuffers(int2handle(data->fd))) { + ErrorCodeToString("Draining connection (FlushFileBuffers)", GetLastError(), data->errorString); + return; + } +} diff --git a/server/node_modules/@serialport/bindings/src/serialport_win.h b/server/node_modules/@serialport/bindings/src/serialport_win.h new file mode 100644 index 0000000..503134f --- /dev/null +++ b/server/node_modules/@serialport/bindings/src/serialport_win.h @@ -0,0 +1,74 @@ +#ifndef PACKAGES_SERIALPORT_SRC_SERIALPORT_WIN_H_ +#define PACKAGES_SERIALPORT_SRC_SERIALPORT_WIN_H_ +// #include +// #include +// #include +#include +#include +#include + +#define ERROR_STRING_SIZE 1024 + +struct WriteBaton : public Nan::AsyncResource { + WriteBaton() : AsyncResource("node-serialport:WriteBaton"), bufferData(), errorString() {} + int fd = 0; + char* bufferData = nullptr; + size_t bufferLength = 0; + size_t offset = 0; + size_t bytesWritten = 0; + void* hThread = nullptr; + bool complete = false; + Nan::Persistent buffer; + Nan::Callback callback; + int result = 0; + char errorString[ERROR_STRING_SIZE]; +}; + +NAN_METHOD(Write); +void EIO_Write(uv_work_t* req); +void EIO_AfterWrite(uv_async_t* req); +DWORD __stdcall WriteThread(LPVOID param); + + +struct ReadBaton : public Nan::AsyncResource { + ReadBaton() : AsyncResource("node-serialport:ReadBaton"), errorString() {} + int fd = 0; + char* bufferData = nullptr; + size_t bufferLength = 0; + size_t bytesRead = 0; + size_t bytesToRead = 0; + size_t offset = 0; + void* hThread = nullptr; + bool complete = false; + char errorString[ERROR_STRING_SIZE]; + Nan::Callback callback; +}; + +NAN_METHOD(Read); +void EIO_Read(uv_work_t* req); +void EIO_AfterRead(uv_async_t* req); +DWORD __stdcall ReadThread(LPVOID param); + + +NAN_METHOD(List); +void EIO_List(uv_work_t* req); +void EIO_AfterList(uv_work_t* req); + +struct ListResultItem { + std::string path; + std::string manufacturer; + std::string serialNumber; + std::string pnpId; + std::string locationId; + std::string vendorId; + std::string productId; +}; + +struct ListBaton : public Nan::AsyncResource { + ListBaton() : AsyncResource("node-serialport:ListBaton") {} + Nan::Callback callback; + std::list results; + char errorString[ERROR_STRING_SIZE] = ""; +}; + +#endif // PACKAGES_SERIALPORT_SRC_SERIALPORT_WIN_H_ diff --git a/server/node_modules/@serialport/parser-byte-length/CHANGELOG.md b/server/node_modules/@serialport/parser-byte-length/CHANGELOG.md new file mode 100644 index 0000000..8e7eb48 --- /dev/null +++ b/server/node_modules/@serialport/parser-byte-length/CHANGELOG.md @@ -0,0 +1,40 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [9.2.4](https://github.com/serialport/node-serialport/compare/v9.2.3...v9.2.4) (2021-09-28) + +**Note:** Version bump only for package @serialport/parser-byte-length + + + + + +## [9.0.7](https://github.com/serialport/node-serialport/compare/v9.0.6...v9.0.7) (2021-02-22) + +**Note:** Version bump only for package @serialport/parser-byte-length + + + + + +## [9.0.1](https://github.com/serialport/node-serialport/compare/v9.0.0...v9.0.1) (2020-08-08) + +**Note:** Version bump only for package @serialport/parser-byte-length + + + + + +# [9.0.0](https://github.com/serialport/node-serialport/compare/v8.0.8...v9.0.0) (2020-05-10) + +**Note:** Version bump only for package @serialport/parser-byte-length + + + + + +## [8.0.6](https://github.com/serialport/node-serialport/compare/v8.0.5...v8.0.6) (2019-12-25) + +**Note:** Version bump only for package @serialport/parser-byte-length diff --git a/server/node_modules/@serialport/parser-byte-length/LICENSE b/server/node_modules/@serialport/parser-byte-length/LICENSE new file mode 100644 index 0000000..800d776 --- /dev/null +++ b/server/node_modules/@serialport/parser-byte-length/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright 2010 Christopher Williams. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/parser-byte-length/README.md b/server/node_modules/@serialport/parser-byte-length/README.md new file mode 100644 index 0000000..3a83f47 --- /dev/null +++ b/server/node_modules/@serialport/parser-byte-length/README.md @@ -0,0 +1 @@ +See our api docs https://serialport.io/docs/api-parser-byte-length diff --git a/server/node_modules/@serialport/parser-byte-length/lib/index.js b/server/node_modules/@serialport/parser-byte-length/lib/index.js new file mode 100644 index 0000000..a54e192 --- /dev/null +++ b/server/node_modules/@serialport/parser-byte-length/lib/index.js @@ -0,0 +1,55 @@ +const { Transform } = require('stream') + +/** + * Emit data every number of bytes + * @extends Transform + * @param {Object} options parser options object + * @param {Number} options.length the number of bytes on each data event + * @summary A transform stream that emits data as a buffer after a specific number of bytes are received. Runs in O(n) time. + * @example +const SerialPort = require('serialport') +const ByteLength = require('@serialport/parser-byte-length') +const port = new SerialPort('/dev/tty-usbserial1') +const parser = port.pipe(new ByteLength({length: 8})) +parser.on('data', console.log) // will have 8 bytes per data event + */ +class ByteLengthParser extends Transform { + constructor(options = {}) { + super(options) + + if (typeof options.length !== 'number') { + throw new TypeError('"length" is not a number') + } + + if (options.length < 1) { + throw new TypeError('"length" is not greater than 0') + } + + this.length = options.length + this.position = 0 + this.buffer = Buffer.alloc(this.length) + } + + _transform(chunk, encoding, cb) { + let cursor = 0 + while (cursor < chunk.length) { + this.buffer[this.position] = chunk[cursor] + cursor++ + this.position++ + if (this.position === this.length) { + this.push(this.buffer) + this.buffer = Buffer.alloc(this.length) + this.position = 0 + } + } + cb() + } + + _flush(cb) { + this.push(this.buffer.slice(0, this.position)) + this.buffer = Buffer.alloc(this.length) + cb() + } +} + +module.exports = ByteLengthParser diff --git a/server/node_modules/@serialport/parser-byte-length/package.json b/server/node_modules/@serialport/parser-byte-length/package.json new file mode 100644 index 0000000..a5dc3d1 --- /dev/null +++ b/server/node_modules/@serialport/parser-byte-length/package.json @@ -0,0 +1,49 @@ +{ + "_from": "@serialport/parser-byte-length@9.2.4", + "_id": "@serialport/parser-byte-length@9.2.4", + "_inBundle": false, + "_integrity": "sha512-sQD/iw4ZMU3xW9PLi0/GlvU6Y623jGeWecbMkO7izUo/6P7gtfv1c9ikd5h0kwL8AoAOpQA1lxdHIKox+umBUg==", + "_location": "/@serialport/parser-byte-length", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@serialport/parser-byte-length@9.2.4", + "name": "@serialport/parser-byte-length", + "escapedName": "@serialport%2fparser-byte-length", + "scope": "@serialport", + "rawSpec": "9.2.4", + "saveSpec": null, + "fetchSpec": "9.2.4" + }, + "_requiredBy": [ + "/serialport" + ], + "_resolved": "https://registry.npmjs.org/@serialport/parser-byte-length/-/parser-byte-length-9.2.4.tgz", + "_shasum": "cccdf3a95018d838cee9e7aa86ab3b5ad9e6c00f", + "_spec": "@serialport/parser-byte-length@9.2.4", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/serialport", + "bugs": { + "url": "https://github.com/serialport/node-serialport/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "See our api docs https://serialport.io/docs/api-parser-byte-length", + "engines": { + "node": ">=10.0.0" + }, + "funding": "https://opencollective.com/serialport/donate", + "gitHead": "494fd0f097e25fd5475e543f80bf23cc05ea6abc", + "homepage": "https://github.com/serialport/node-serialport#readme", + "license": "MIT", + "main": "lib", + "name": "@serialport/parser-byte-length", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git://github.com/serialport/node-serialport.git" + }, + "version": "9.2.4" +} diff --git a/server/node_modules/@serialport/parser-cctalk/CHANGELOG.md b/server/node_modules/@serialport/parser-cctalk/CHANGELOG.md new file mode 100644 index 0000000..02b4675 --- /dev/null +++ b/server/node_modules/@serialport/parser-cctalk/CHANGELOG.md @@ -0,0 +1,40 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [9.2.4](https://github.com/serialport/node-serialport/compare/v9.2.3...v9.2.4) (2021-09-28) + +**Note:** Version bump only for package @serialport/parser-cctalk + + + + + +## [9.0.7](https://github.com/serialport/node-serialport/compare/v9.0.6...v9.0.7) (2021-02-22) + +**Note:** Version bump only for package @serialport/parser-cctalk + + + + + +## [9.0.1](https://github.com/serialport/node-serialport/compare/v9.0.0...v9.0.1) (2020-08-08) + +**Note:** Version bump only for package @serialport/parser-cctalk + + + + + +# [9.0.0](https://github.com/serialport/node-serialport/compare/v8.0.8...v9.0.0) (2020-05-10) + +**Note:** Version bump only for package @serialport/parser-cctalk + + + + + +## [8.0.6](https://github.com/serialport/node-serialport/compare/v8.0.5...v8.0.6) (2019-12-25) + +**Note:** Version bump only for package @serialport/parser-cctalk diff --git a/server/node_modules/@serialport/parser-cctalk/LICENSE b/server/node_modules/@serialport/parser-cctalk/LICENSE new file mode 100644 index 0000000..800d776 --- /dev/null +++ b/server/node_modules/@serialport/parser-cctalk/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright 2010 Christopher Williams. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/parser-cctalk/README.md b/server/node_modules/@serialport/parser-cctalk/README.md new file mode 100644 index 0000000..a6bb54a --- /dev/null +++ b/server/node_modules/@serialport/parser-cctalk/README.md @@ -0,0 +1 @@ +See our api docs https://node-serialport.github.io/node-serialport/CCTalkParser.html diff --git a/server/node_modules/@serialport/parser-cctalk/lib/index.js b/server/node_modules/@serialport/parser-cctalk/lib/index.js new file mode 100644 index 0000000..bfea1eb --- /dev/null +++ b/server/node_modules/@serialport/parser-cctalk/lib/index.js @@ -0,0 +1,52 @@ +const { Transform } = require('stream') + +/** + * Parse the CCTalk protocol + * @extends Transform + * @summary A transform stream that emits CCTalk packets as they are received. + * @example +const SerialPort = require('serialport') +const CCTalk = require('@serialport/parser-cctalk') +const port = new SerialPort('/dev/ttyUSB0') +const parser = port.pipe(new CCtalk()) +parser.on('data', console.log) + */ +class CCTalkParser extends Transform { + constructor(maxDelayBetweenBytesMs = 50) { + super() + this.array = [] + this.cursor = 0 + this.lastByteFetchTime = 0 + this.maxDelayBetweenBytesMs = maxDelayBetweenBytesMs + } + _transform(buffer, _, cb) { + if (this.maxDelayBetweenBytesMs > 0) { + const now = Date.now() + if (now - this.lastByteFetchTime > this.maxDelayBetweenBytesMs) { + this.array = [] + this.cursor = 0 + } + this.lastByteFetchTime = now + } + + this.cursor += buffer.length + // TODO: Better Faster es7 no supported by node 4 + // ES7 allows directly push [...buffer] + // this.array = this.array.concat(Array.from(buffer)) //Slower ?!? + Array.from(buffer).map(byte => this.array.push(byte)) + while (this.cursor > 1 && this.cursor >= this.array[1] + 5) { + // full frame accumulated + // copy command from the array + const FullMsgLength = this.array[1] + 5 + + const frame = Buffer.from(this.array.slice(0, FullMsgLength)) + // Preserve Extra Data + this.array = this.array.slice(frame.length, this.array.length) + this.cursor -= FullMsgLength + this.push(frame) + } + cb() + } +} + +module.exports = CCTalkParser diff --git a/server/node_modules/@serialport/parser-cctalk/package.json b/server/node_modules/@serialport/parser-cctalk/package.json new file mode 100644 index 0000000..d147f13 --- /dev/null +++ b/server/node_modules/@serialport/parser-cctalk/package.json @@ -0,0 +1,49 @@ +{ + "_from": "@serialport/parser-cctalk@9.2.4", + "_id": "@serialport/parser-cctalk@9.2.4", + "_inBundle": false, + "_integrity": "sha512-T4TU5vQMwmo9AB3gQLFDWbfJXlW5jd9guEsB/nqKjFHTv0FXPdZ7DQ2TpSp8RnHWxU3GX6kYTaDO20BKzc8GPQ==", + "_location": "/@serialport/parser-cctalk", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@serialport/parser-cctalk@9.2.4", + "name": "@serialport/parser-cctalk", + "escapedName": "@serialport%2fparser-cctalk", + "scope": "@serialport", + "rawSpec": "9.2.4", + "saveSpec": null, + "fetchSpec": "9.2.4" + }, + "_requiredBy": [ + "/serialport" + ], + "_resolved": "https://registry.npmjs.org/@serialport/parser-cctalk/-/parser-cctalk-9.2.4.tgz", + "_shasum": "441533e6afc789e8cc5a017697632217bb33a861", + "_spec": "@serialport/parser-cctalk@9.2.4", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/serialport", + "bugs": { + "url": "https://github.com/serialport/node-serialport/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "See our api docs https://node-serialport.github.io/node-serialport/CCTalkParser.html", + "engines": { + "node": ">=10.0.0" + }, + "funding": "https://opencollective.com/serialport/donate", + "gitHead": "494fd0f097e25fd5475e543f80bf23cc05ea6abc", + "homepage": "https://github.com/serialport/node-serialport#readme", + "license": "MIT", + "main": "lib", + "name": "@serialport/parser-cctalk", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git://github.com/serialport/node-serialport.git" + }, + "version": "9.2.4" +} diff --git a/server/node_modules/@serialport/parser-delimiter/CHANGELOG.md b/server/node_modules/@serialport/parser-delimiter/CHANGELOG.md new file mode 100644 index 0000000..0d73894 --- /dev/null +++ b/server/node_modules/@serialport/parser-delimiter/CHANGELOG.md @@ -0,0 +1,40 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [9.2.4](https://github.com/serialport/node-serialport/compare/v9.2.3...v9.2.4) (2021-09-28) + +**Note:** Version bump only for package @serialport/parser-delimiter + + + + + +## [9.0.7](https://github.com/serialport/node-serialport/compare/v9.0.6...v9.0.7) (2021-02-22) + +**Note:** Version bump only for package @serialport/parser-delimiter + + + + + +## [9.0.1](https://github.com/serialport/node-serialport/compare/v9.0.0...v9.0.1) (2020-08-08) + +**Note:** Version bump only for package @serialport/parser-delimiter + + + + + +# [9.0.0](https://github.com/serialport/node-serialport/compare/v8.0.8...v9.0.0) (2020-05-10) + +**Note:** Version bump only for package @serialport/parser-delimiter + + + + + +## [8.0.6](https://github.com/serialport/node-serialport/compare/v8.0.5...v8.0.6) (2019-12-25) + +**Note:** Version bump only for package @serialport/parser-delimiter diff --git a/server/node_modules/@serialport/parser-delimiter/LICENSE b/server/node_modules/@serialport/parser-delimiter/LICENSE new file mode 100644 index 0000000..800d776 --- /dev/null +++ b/server/node_modules/@serialport/parser-delimiter/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright 2010 Christopher Williams. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/parser-delimiter/README.md b/server/node_modules/@serialport/parser-delimiter/README.md new file mode 100644 index 0000000..b60cf12 --- /dev/null +++ b/server/node_modules/@serialport/parser-delimiter/README.md @@ -0,0 +1 @@ +See our api docs https://serialport.io/docs/api-parser-delimiter diff --git a/server/node_modules/@serialport/parser-delimiter/lib/index.js b/server/node_modules/@serialport/parser-delimiter/lib/index.js new file mode 100644 index 0000000..1d10148 --- /dev/null +++ b/server/node_modules/@serialport/parser-delimiter/lib/index.js @@ -0,0 +1,49 @@ +const { Transform } = require('stream') + +/** + * A transform stream that emits data each time a byte sequence is received. + * @extends Transform + * @summary To use the `Delimiter` parser, provide a delimiter as a string, buffer, or array of bytes. Runs in O(n) time. + * @example +const SerialPort = require('serialport') +const Delimiter = require('@serialport/parser-delimiter') +const port = new SerialPort('/dev/tty-usbserial1') +const parser = port.pipe(new Delimiter({ delimiter: '\n' })) +parser.on('data', console.log) + */ +class DelimiterParser extends Transform { + constructor(options = {}) { + super(options) + + if (options.delimiter === undefined) { + throw new TypeError('"delimiter" is not a bufferable object') + } + + if (options.delimiter.length === 0) { + throw new TypeError('"delimiter" has a 0 or undefined length') + } + + this.includeDelimiter = options.includeDelimiter !== undefined ? options.includeDelimiter : false + this.delimiter = Buffer.from(options.delimiter) + this.buffer = Buffer.alloc(0) + } + + _transform(chunk, encoding, cb) { + let data = Buffer.concat([this.buffer, chunk]) + let position + while ((position = data.indexOf(this.delimiter)) !== -1) { + this.push(data.slice(0, position + (this.includeDelimiter ? this.delimiter.length : 0))) + data = data.slice(position + this.delimiter.length) + } + this.buffer = data + cb() + } + + _flush(cb) { + this.push(this.buffer) + this.buffer = Buffer.alloc(0) + cb() + } +} + +module.exports = DelimiterParser diff --git a/server/node_modules/@serialport/parser-delimiter/package.json b/server/node_modules/@serialport/parser-delimiter/package.json new file mode 100644 index 0000000..fb94ac9 --- /dev/null +++ b/server/node_modules/@serialport/parser-delimiter/package.json @@ -0,0 +1,50 @@ +{ + "_from": "@serialport/parser-delimiter@9.2.4", + "_id": "@serialport/parser-delimiter@9.2.4", + "_inBundle": false, + "_integrity": "sha512-4nvTAoYAgkxFiXrkI+3CA49Yd43CODjeszh89EK+I9c8wOZ+etZduRCzINYPiy26g7zO+GRAb9FoPCsY+sYcbQ==", + "_location": "/@serialport/parser-delimiter", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@serialport/parser-delimiter@9.2.4", + "name": "@serialport/parser-delimiter", + "escapedName": "@serialport%2fparser-delimiter", + "scope": "@serialport", + "rawSpec": "9.2.4", + "saveSpec": null, + "fetchSpec": "9.2.4" + }, + "_requiredBy": [ + "/@serialport/parser-readline", + "/serialport" + ], + "_resolved": "https://registry.npmjs.org/@serialport/parser-delimiter/-/parser-delimiter-9.2.4.tgz", + "_shasum": "7906162ab5601b52abe7bb011678248f0b50f6c0", + "_spec": "@serialport/parser-delimiter@9.2.4", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/serialport", + "bugs": { + "url": "https://github.com/serialport/node-serialport/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "See our api docs https://serialport.io/docs/api-parser-delimiter", + "engines": { + "node": ">=10.0.0" + }, + "funding": "https://opencollective.com/serialport/donate", + "gitHead": "494fd0f097e25fd5475e543f80bf23cc05ea6abc", + "homepage": "https://github.com/serialport/node-serialport#readme", + "license": "MIT", + "main": "lib", + "name": "@serialport/parser-delimiter", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git://github.com/serialport/node-serialport.git" + }, + "version": "9.2.4" +} diff --git a/server/node_modules/@serialport/parser-inter-byte-timeout/CHANGELOG.md b/server/node_modules/@serialport/parser-inter-byte-timeout/CHANGELOG.md new file mode 100644 index 0000000..6a68a93 --- /dev/null +++ b/server/node_modules/@serialport/parser-inter-byte-timeout/CHANGELOG.md @@ -0,0 +1,40 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [9.2.4](https://github.com/serialport/node-serialport/compare/v9.2.3...v9.2.4) (2021-09-28) + +**Note:** Version bump only for package @serialport/parser-inter-byte-timeout + + + + + +## [9.0.7](https://github.com/serialport/node-serialport/compare/v9.0.6...v9.0.7) (2021-02-22) + +**Note:** Version bump only for package @serialport/parser-inter-byte-timeout + + + + + +## [9.0.1](https://github.com/serialport/node-serialport/compare/v9.0.0...v9.0.1) (2020-08-08) + +**Note:** Version bump only for package @serialport/parser-inter-byte-timeout + + + + + +# [9.0.0](https://github.com/serialport/node-serialport/compare/v8.0.8...v9.0.0) (2020-05-10) + +**Note:** Version bump only for package @serialport/parser-inter-byte-timeout + + + + + +## [8.0.6](https://github.com/serialport/node-serialport/compare/v8.0.5...v8.0.6) (2019-12-25) + +**Note:** Version bump only for package @serialport/parser-inter-byte-timeout diff --git a/server/node_modules/@serialport/parser-inter-byte-timeout/LICENSE b/server/node_modules/@serialport/parser-inter-byte-timeout/LICENSE new file mode 100644 index 0000000..800d776 --- /dev/null +++ b/server/node_modules/@serialport/parser-inter-byte-timeout/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright 2010 Christopher Williams. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/parser-inter-byte-timeout/README.md b/server/node_modules/@serialport/parser-inter-byte-timeout/README.md new file mode 100644 index 0000000..b511073 --- /dev/null +++ b/server/node_modules/@serialport/parser-inter-byte-timeout/README.md @@ -0,0 +1 @@ +See our api docs https://serialport.io/docs/api-parser-inter-byte-timeout diff --git a/server/node_modules/@serialport/parser-inter-byte-timeout/lib/index.js b/server/node_modules/@serialport/parser-inter-byte-timeout/lib/index.js new file mode 100644 index 0000000..0183fe8 --- /dev/null +++ b/server/node_modules/@serialport/parser-inter-byte-timeout/lib/index.js @@ -0,0 +1,71 @@ +const { Transform } = require('stream') + +/** + * Emits data if there is a pause between packets for the specified amount of time. + * @extends Transform + * @param {Object} options parser options object + * @param {Number} options.interval the period of silence in milliseconds after which data is emited + * @param {Number} options.maxBufferSize the maximum number of bytes after which data will be emited. Defaults to 65536. + * @summary A transform stream that emits data as a buffer after not receiving any bytes for the specified amount of time. + * @example +const SerialPort = require('serialport') +const InterByteTimeout = require('@serialport/parser-inter-byte-timeout') +const port = new SerialPort('/dev/tty-usbserial1') +const parser = port.pipe(new InterByteTimeout({interval: 30})) +parser.on('data', console.log) // will emit data if there is a pause between packets greater than 30ms + */ + +class InterByteTimeoutParser extends Transform { + constructor(options) { + super() + options = { maxBufferSize: 65536, ...options } + if (!options.interval) { + throw new TypeError('"interval" is required') + } + + if (typeof options.interval !== 'number' || Number.isNaN(options.interval)) { + throw new TypeError('"interval" is not a number') + } + + if (options.interval < 1) { + throw new TypeError('"interval" is not greater than 0') + } + + if (typeof options.maxBufferSize !== 'number' || Number.isNaN(options.maxBufferSize)) { + throw new TypeError('"maxBufferSize" is not a number') + } + + if (options.maxBufferSize < 1) { + throw new TypeError('"maxBufferSize" is not greater than 0') + } + + this.maxBufferSize = options.maxBufferSize + this.currentPacket = [] + this.interval = options.interval + this.intervalID = -1 + } + _transform(chunk, encoding, cb) { + clearTimeout(this.intervalID) + for (let offset = 0; offset < chunk.length; offset++) { + this.currentPacket.push(chunk[offset]) + if (this.currentPacket.length >= this.maxBufferSize) { + this.emitPacket() + } + } + this.intervalID = setTimeout(this.emitPacket.bind(this), this.interval) + cb() + } + emitPacket() { + clearTimeout(this.intervalID) + if (this.currentPacket.length > 0) { + this.push(Buffer.from(this.currentPacket)) + } + this.currentPacket = [] + } + _flush(cb) { + this.emitPacket() + cb() + } +} + +module.exports = InterByteTimeoutParser diff --git a/server/node_modules/@serialport/parser-inter-byte-timeout/package.json b/server/node_modules/@serialport/parser-inter-byte-timeout/package.json new file mode 100644 index 0000000..53dbbdb --- /dev/null +++ b/server/node_modules/@serialport/parser-inter-byte-timeout/package.json @@ -0,0 +1,49 @@ +{ + "_from": "@serialport/parser-inter-byte-timeout@9.2.4", + "_id": "@serialport/parser-inter-byte-timeout@9.2.4", + "_inBundle": false, + "_integrity": "sha512-SOAdvr0oBQIOCXX198hiTlxs4JTKg9j5piapw5tNq52fwDOWdbYrFneT/wN04UTMKaDrJuEvXq6T4rv4j7nJ5A==", + "_location": "/@serialport/parser-inter-byte-timeout", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@serialport/parser-inter-byte-timeout@9.2.4", + "name": "@serialport/parser-inter-byte-timeout", + "escapedName": "@serialport%2fparser-inter-byte-timeout", + "scope": "@serialport", + "rawSpec": "9.2.4", + "saveSpec": null, + "fetchSpec": "9.2.4" + }, + "_requiredBy": [ + "/serialport" + ], + "_resolved": "https://registry.npmjs.org/@serialport/parser-inter-byte-timeout/-/parser-inter-byte-timeout-9.2.4.tgz", + "_shasum": "0ffb7f1449636f6363e894127d1f819b38e91c3c", + "_spec": "@serialport/parser-inter-byte-timeout@9.2.4", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/serialport", + "bugs": { + "url": "https://github.com/serialport/node-serialport/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "See our api docs https://serialport.io/docs/api-parser-inter-byte-timeout", + "engines": { + "node": ">=10.0.0" + }, + "funding": "https://opencollective.com/serialport/donate", + "gitHead": "494fd0f097e25fd5475e543f80bf23cc05ea6abc", + "homepage": "https://github.com/serialport/node-serialport#readme", + "license": "MIT", + "main": "lib", + "name": "@serialport/parser-inter-byte-timeout", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git://github.com/serialport/node-serialport.git" + }, + "version": "9.2.4" +} diff --git a/server/node_modules/@serialport/parser-readline/CHANGELOG.md b/server/node_modules/@serialport/parser-readline/CHANGELOG.md new file mode 100644 index 0000000..f9edd74 --- /dev/null +++ b/server/node_modules/@serialport/parser-readline/CHANGELOG.md @@ -0,0 +1,40 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [9.2.4](https://github.com/serialport/node-serialport/compare/v9.2.3...v9.2.4) (2021-09-28) + +**Note:** Version bump only for package @serialport/parser-readline + + + + + +## [9.0.7](https://github.com/serialport/node-serialport/compare/v9.0.6...v9.0.7) (2021-02-22) + +**Note:** Version bump only for package @serialport/parser-readline + + + + + +## [9.0.1](https://github.com/serialport/node-serialport/compare/v9.0.0...v9.0.1) (2020-08-08) + +**Note:** Version bump only for package @serialport/parser-readline + + + + + +# [9.0.0](https://github.com/serialport/node-serialport/compare/v8.0.8...v9.0.0) (2020-05-10) + +**Note:** Version bump only for package @serialport/parser-readline + + + + + +## [8.0.6](https://github.com/serialport/node-serialport/compare/v8.0.5...v8.0.6) (2019-12-25) + +**Note:** Version bump only for package @serialport/parser-readline diff --git a/server/node_modules/@serialport/parser-readline/LICENSE b/server/node_modules/@serialport/parser-readline/LICENSE new file mode 100644 index 0000000..800d776 --- /dev/null +++ b/server/node_modules/@serialport/parser-readline/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright 2010 Christopher Williams. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/parser-readline/README.md b/server/node_modules/@serialport/parser-readline/README.md new file mode 100644 index 0000000..6c9669c --- /dev/null +++ b/server/node_modules/@serialport/parser-readline/README.md @@ -0,0 +1 @@ +See our api docs See our api docs https://serialport.io/docs/api-parser-readline diff --git a/server/node_modules/@serialport/parser-readline/lib/index.js b/server/node_modules/@serialport/parser-readline/lib/index.js new file mode 100644 index 0000000..795f608 --- /dev/null +++ b/server/node_modules/@serialport/parser-readline/lib/index.js @@ -0,0 +1,30 @@ +const DelimiterParser = require('@serialport/parser-delimiter') + +/** + * A transform stream that emits data after a newline delimiter is received. + * @summary To use the `Readline` parser, provide a delimiter (defaults to `\n`). Data is emitted as string controllable by the `encoding` option (defaults to `utf8`). + * @extends DelimiterParser + * @example +const SerialPort = require('serialport') +const Readline = require('@serialport/parser-readline') +const port = new SerialPort('/dev/tty-usbserial1') +const parser = port.pipe(new Readline({ delimiter: '\r\n' })) +parser.on('data', console.log) +*/ +class ReadLineParser extends DelimiterParser { + constructor(options) { + const opts = { + delimiter: Buffer.from('\n', 'utf8'), + encoding: 'utf8', + ...options, + } + + if (typeof opts.delimiter === 'string') { + opts.delimiter = Buffer.from(opts.delimiter, opts.encoding) + } + + super(opts) + } +} + +module.exports = ReadLineParser diff --git a/server/node_modules/@serialport/parser-readline/package.json b/server/node_modules/@serialport/parser-readline/package.json new file mode 100644 index 0000000..5294699 --- /dev/null +++ b/server/node_modules/@serialport/parser-readline/package.json @@ -0,0 +1,53 @@ +{ + "_from": "@serialport/parser-readline@9.2.4", + "_id": "@serialport/parser-readline@9.2.4", + "_inBundle": false, + "_integrity": "sha512-Z1/qrZTQUVhNSJP1hd9YfDvq0o7d87rNwAjjRKbVpa7Qi51tG5BnKt43IV3NFMyBlVcRe0rnIb3tJu57E0SOwg==", + "_location": "/@serialport/parser-readline", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@serialport/parser-readline@9.2.4", + "name": "@serialport/parser-readline", + "escapedName": "@serialport%2fparser-readline", + "scope": "@serialport", + "rawSpec": "9.2.4", + "saveSpec": null, + "fetchSpec": "9.2.4" + }, + "_requiredBy": [ + "/@serialport/bindings", + "/serialport" + ], + "_resolved": "https://registry.npmjs.org/@serialport/parser-readline/-/parser-readline-9.2.4.tgz", + "_shasum": "15a4ec7e86ddc33ac84faac7bffd4560e4544ccb", + "_spec": "@serialport/parser-readline@9.2.4", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/serialport", + "bugs": { + "url": "https://github.com/serialport/node-serialport/issues" + }, + "bundleDependencies": false, + "dependencies": { + "@serialport/parser-delimiter": "9.2.4" + }, + "deprecated": false, + "description": "See our api docs See our api docs https://serialport.io/docs/api-parser-readline", + "engines": { + "node": ">=10.0.0" + }, + "funding": "https://opencollective.com/serialport/donate", + "gitHead": "494fd0f097e25fd5475e543f80bf23cc05ea6abc", + "homepage": "https://github.com/serialport/node-serialport#readme", + "license": "MIT", + "main": "lib", + "name": "@serialport/parser-readline", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git://github.com/serialport/node-serialport.git" + }, + "version": "9.2.4" +} diff --git a/server/node_modules/@serialport/parser-ready/CHANGELOG.md b/server/node_modules/@serialport/parser-ready/CHANGELOG.md new file mode 100644 index 0000000..5b2ffa0 --- /dev/null +++ b/server/node_modules/@serialport/parser-ready/CHANGELOG.md @@ -0,0 +1,40 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [9.2.4](https://github.com/serialport/node-serialport/compare/v9.2.3...v9.2.4) (2021-09-28) + +**Note:** Version bump only for package @serialport/parser-ready + + + + + +## [9.0.7](https://github.com/serialport/node-serialport/compare/v9.0.6...v9.0.7) (2021-02-22) + +**Note:** Version bump only for package @serialport/parser-ready + + + + + +## [9.0.1](https://github.com/serialport/node-serialport/compare/v9.0.0...v9.0.1) (2020-08-08) + +**Note:** Version bump only for package @serialport/parser-ready + + + + + +# [9.0.0](https://github.com/serialport/node-serialport/compare/v8.0.8...v9.0.0) (2020-05-10) + +**Note:** Version bump only for package @serialport/parser-ready + + + + + +## [8.0.6](https://github.com/serialport/node-serialport/compare/v8.0.5...v8.0.6) (2019-12-25) + +**Note:** Version bump only for package @serialport/parser-ready diff --git a/server/node_modules/@serialport/parser-ready/LICENSE b/server/node_modules/@serialport/parser-ready/LICENSE new file mode 100644 index 0000000..800d776 --- /dev/null +++ b/server/node_modules/@serialport/parser-ready/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright 2010 Christopher Williams. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/parser-ready/README.md b/server/node_modules/@serialport/parser-ready/README.md new file mode 100644 index 0000000..a868a08 --- /dev/null +++ b/server/node_modules/@serialport/parser-ready/README.md @@ -0,0 +1 @@ +See our api docs https://serialport.io/docs/api-parser-ready diff --git a/server/node_modules/@serialport/parser-ready/lib/index.js b/server/node_modules/@serialport/parser-ready/lib/index.js new file mode 100644 index 0000000..2f74158 --- /dev/null +++ b/server/node_modules/@serialport/parser-ready/lib/index.js @@ -0,0 +1,63 @@ +const { Transform } = require('stream') + +/** + * A transform stream that waits for a sequence of "ready" bytes before emitting a ready event and emitting data events + * @summary To use the `Ready` parser provide a byte start sequence. After the bytes have been received a ready event is fired and data events are passed through. + * @extends Transform + * @example +const SerialPort = require('serialport') +const Ready = require('@serialport/parser-ready') +const port = new SerialPort('/dev/tty-usbserial1') +const parser = port.pipe(new Ready({ delimiter: 'READY' })) +parser.on('ready', () => console.log('the ready byte sequence has been received')) +parser.on('data', console.log) // all data after READY is received + */ +class ReadyParser extends Transform { + /** + * + * @param {object} options options for the parser + * @param {string|Buffer|array} options.delimiter data to look for before emitted "ready" + */ + constructor(options = {}) { + if (options.delimiter === undefined) { + throw new TypeError('"delimiter" is not a bufferable object') + } + + if (options.delimiter.length === 0) { + throw new TypeError('"delimiter" has a 0 or undefined length') + } + + super(options) + this.delimiter = Buffer.from(options.delimiter) + this.readOffset = 0 + this.ready = false + } + + _transform(chunk, encoding, cb) { + if (this.ready) { + this.push(chunk) + return cb() + } + const delimiter = this.delimiter + let chunkOffset = 0 + while (this.readOffset < delimiter.length && chunkOffset < chunk.length) { + if (delimiter[this.readOffset] === chunk[chunkOffset]) { + this.readOffset++ + } else { + this.readOffset = 0 + } + chunkOffset++ + } + if (this.readOffset === delimiter.length) { + this.ready = true + this.emit('ready') + const chunkRest = chunk.slice(chunkOffset) + if (chunkRest.length > 0) { + this.push(chunkRest) + } + } + cb() + } +} + +module.exports = ReadyParser diff --git a/server/node_modules/@serialport/parser-ready/package.json b/server/node_modules/@serialport/parser-ready/package.json new file mode 100644 index 0000000..fa20a4f --- /dev/null +++ b/server/node_modules/@serialport/parser-ready/package.json @@ -0,0 +1,49 @@ +{ + "_from": "@serialport/parser-ready@9.2.4", + "_id": "@serialport/parser-ready@9.2.4", + "_inBundle": false, + "_integrity": "sha512-Pyi94Itjl6qAURwIZr/gmZpMAyTmKXThm6vL5DoAWGQjcRHWB0gwv2TY2v7N+mQLJYUKU3cMnvnATXxHm7xjxw==", + "_location": "/@serialport/parser-ready", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@serialport/parser-ready@9.2.4", + "name": "@serialport/parser-ready", + "escapedName": "@serialport%2fparser-ready", + "scope": "@serialport", + "rawSpec": "9.2.4", + "saveSpec": null, + "fetchSpec": "9.2.4" + }, + "_requiredBy": [ + "/serialport" + ], + "_resolved": "https://registry.npmjs.org/@serialport/parser-ready/-/parser-ready-9.2.4.tgz", + "_shasum": "e1fc93b9e3057972104db3f9311263397f420f25", + "_spec": "@serialport/parser-ready@9.2.4", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/serialport", + "bugs": { + "url": "https://github.com/serialport/node-serialport/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "See our api docs https://serialport.io/docs/api-parser-ready", + "engines": { + "node": ">=10.0.0" + }, + "funding": "https://opencollective.com/serialport/donate", + "gitHead": "494fd0f097e25fd5475e543f80bf23cc05ea6abc", + "homepage": "https://github.com/serialport/node-serialport#readme", + "license": "MIT", + "main": "lib", + "name": "@serialport/parser-ready", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git://github.com/serialport/node-serialport.git" + }, + "version": "9.2.4" +} diff --git a/server/node_modules/@serialport/parser-regex/CHANGELOG.md b/server/node_modules/@serialport/parser-regex/CHANGELOG.md new file mode 100644 index 0000000..567789d --- /dev/null +++ b/server/node_modules/@serialport/parser-regex/CHANGELOG.md @@ -0,0 +1,40 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [9.2.4](https://github.com/serialport/node-serialport/compare/v9.2.3...v9.2.4) (2021-09-28) + +**Note:** Version bump only for package @serialport/parser-regex + + + + + +## [9.0.7](https://github.com/serialport/node-serialport/compare/v9.0.6...v9.0.7) (2021-02-22) + +**Note:** Version bump only for package @serialport/parser-regex + + + + + +## [9.0.1](https://github.com/serialport/node-serialport/compare/v9.0.0...v9.0.1) (2020-08-08) + +**Note:** Version bump only for package @serialport/parser-regex + + + + + +# [9.0.0](https://github.com/serialport/node-serialport/compare/v8.0.8...v9.0.0) (2020-05-10) + +**Note:** Version bump only for package @serialport/parser-regex + + + + + +## [8.0.6](https://github.com/serialport/node-serialport/compare/v8.0.5...v8.0.6) (2019-12-25) + +**Note:** Version bump only for package @serialport/parser-regex diff --git a/server/node_modules/@serialport/parser-regex/LICENSE b/server/node_modules/@serialport/parser-regex/LICENSE new file mode 100644 index 0000000..800d776 --- /dev/null +++ b/server/node_modules/@serialport/parser-regex/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright 2010 Christopher Williams. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/parser-regex/README.md b/server/node_modules/@serialport/parser-regex/README.md new file mode 100644 index 0000000..bba891c --- /dev/null +++ b/server/node_modules/@serialport/parser-regex/README.md @@ -0,0 +1 @@ +See our api docs https://serialport.io/docs/api-parser-regex diff --git a/server/node_modules/@serialport/parser-regex/lib/index.js b/server/node_modules/@serialport/parser-regex/lib/index.js new file mode 100644 index 0000000..ad7175e --- /dev/null +++ b/server/node_modules/@serialport/parser-regex/lib/index.js @@ -0,0 +1,53 @@ +const { Transform } = require('stream') + +/** + * A transform stream that uses a regular expression to split the incoming text upon. + * + * To use the `Regex` parser provide a regular expression to split the incoming text upon. Data is emitted as string controllable by the `encoding` option (defaults to `utf8`). + * @extends Transform + * @example +const SerialPort = require('serialport') +const Regex = require('@serialport/parser-regex') +const port = new SerialPort('/dev/tty-usbserial1') +const parser = port.pipe(new Regex({ regex: /[\r\n]+/ })) +parser.on('data', console.log) + */ +class RegexParser extends Transform { + constructor(options) { + const opts = { + encoding: 'utf8', + ...options, + } + + if (opts.regex === undefined) { + throw new TypeError('"options.regex" must be a regular expression pattern or object') + } + + if (!(opts.regex instanceof RegExp)) { + opts.regex = new RegExp(opts.regex) + } + super(opts) + + this.regex = opts.regex + this.data = '' + } + + _transform(chunk, encoding, cb) { + const data = this.data + chunk + const parts = data.split(this.regex) + this.data = parts.pop() + + parts.forEach(part => { + this.push(part) + }) + cb() + } + + _flush(cb) { + this.push(this.data) + this.data = '' + cb() + } +} + +module.exports = RegexParser diff --git a/server/node_modules/@serialport/parser-regex/package.json b/server/node_modules/@serialport/parser-regex/package.json new file mode 100644 index 0000000..34728db --- /dev/null +++ b/server/node_modules/@serialport/parser-regex/package.json @@ -0,0 +1,49 @@ +{ + "_from": "@serialport/parser-regex@9.2.4", + "_id": "@serialport/parser-regex@9.2.4", + "_inBundle": false, + "_integrity": "sha512-sI/cVvPOYz+Dbv4ZdnW16qAwvXiFf/1pGASQdbveRTlgJDdz7sRNlCBifzfTN2xljwvCTZYqiudKvDdC1TepRQ==", + "_location": "/@serialport/parser-regex", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@serialport/parser-regex@9.2.4", + "name": "@serialport/parser-regex", + "escapedName": "@serialport%2fparser-regex", + "scope": "@serialport", + "rawSpec": "9.2.4", + "saveSpec": null, + "fetchSpec": "9.2.4" + }, + "_requiredBy": [ + "/serialport" + ], + "_resolved": "https://registry.npmjs.org/@serialport/parser-regex/-/parser-regex-9.2.4.tgz", + "_shasum": "e232a84e00f3e8c366fc65ce20f8f4ac14960448", + "_spec": "@serialport/parser-regex@9.2.4", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/serialport", + "bugs": { + "url": "https://github.com/serialport/node-serialport/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "See our api docs https://serialport.io/docs/api-parser-regex", + "engines": { + "node": ">=10.0.0" + }, + "funding": "https://opencollective.com/serialport/donate", + "gitHead": "494fd0f097e25fd5475e543f80bf23cc05ea6abc", + "homepage": "https://github.com/serialport/node-serialport#readme", + "license": "MIT", + "main": "lib", + "name": "@serialport/parser-regex", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git://github.com/serialport/node-serialport.git" + }, + "version": "9.2.4" +} diff --git a/server/node_modules/@serialport/stream/CHANGELOG.md b/server/node_modules/@serialport/stream/CHANGELOG.md new file mode 100644 index 0000000..6f22f5a --- /dev/null +++ b/server/node_modules/@serialport/stream/CHANGELOG.md @@ -0,0 +1,68 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [9.2.4](https://github.com/serialport/node-serialport/compare/v9.2.3...v9.2.4) (2021-09-28) + +**Note:** Version bump only for package @serialport/stream + + + + + +## [9.2.3](https://github.com/serialport/node-serialport/compare/v9.2.1...v9.2.3) (2021-09-24) + +**Note:** Version bump only for package @serialport/stream + + + + + +## [9.2.2](https://github.com/serialport/node-serialport/compare/v9.2.1...v9.2.2) (2021-09-24) + +**Note:** Version bump only for package @serialport/stream + + + + + +## [9.0.7](https://github.com/serialport/node-serialport/compare/v9.0.6...v9.0.7) (2021-02-22) + +**Note:** Version bump only for package @serialport/stream + + + + + +## [9.0.2](https://github.com/serialport/node-serialport/compare/v9.0.1...v9.0.2) (2020-10-16) + +**Note:** Version bump only for package @serialport/stream + + + + + +## [9.0.1](https://github.com/serialport/node-serialport/compare/v9.0.0...v9.0.1) (2020-08-08) + +**Note:** Version bump only for package @serialport/stream + + + + + +# [9.0.0](https://github.com/serialport/node-serialport/compare/v8.0.8...v9.0.0) (2020-05-10) + +**Note:** Version bump only for package @serialport/stream + + + + + +## [8.0.6](https://github.com/serialport/node-serialport/compare/v8.0.5...v8.0.6) (2019-12-25) + + +### Bug Fixes + +* bindings.close() should cause a canceled read error ([#1972](https://github.com/serialport/node-serialport/issues/1972)) ([50f967e](https://github.com/serialport/node-serialport/commit/50f967e788f362da57d782829712542c8f15f8c8)) +* stream required bindings-mock as a dep ([#1970](https://github.com/serialport/node-serialport/issues/1970)) ([e978b7e](https://github.com/serialport/node-serialport/commit/e978b7eb244b87a6be2ae914965adeb1f4562935)) diff --git a/server/node_modules/@serialport/stream/LICENSE b/server/node_modules/@serialport/stream/LICENSE new file mode 100644 index 0000000..800d776 --- /dev/null +++ b/server/node_modules/@serialport/stream/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright 2010 Christopher Williams. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/stream/README.md b/server/node_modules/@serialport/stream/README.md new file mode 100644 index 0000000..d568e96 --- /dev/null +++ b/server/node_modules/@serialport/stream/README.md @@ -0,0 +1,16 @@ +# @serialport/Stream + +The serialport stream interface. This package requires bindings to work. + +You'd use this if you want to keep your package size down by requiring only the parts of serialport that you want to use. It is used internally in the `serialport` package. + +This is how you use it. +```js + +const SerialPort = require('@serialport/stream') +const Binding = require('@serialport/bindings') +SerialPort.Binding = Binding +const port = new Serialport('/dev/ttyay') +``` + +Learn more at our [stream documentation](https://serialport.io/docs/api-stream) page. diff --git a/server/node_modules/@serialport/stream/lib/index.js b/server/node_modules/@serialport/stream/lib/index.js new file mode 100644 index 0000000..92b042c --- /dev/null +++ b/server/node_modules/@serialport/stream/lib/index.js @@ -0,0 +1,656 @@ +const stream = require('stream') +const util = require('util') +const debug = require('debug')('serialport/stream') + +// VALIDATION +const DATABITS = Object.freeze([5, 6, 7, 8]) +const STOPBITS = Object.freeze([1, 1.5, 2]) +const PARITY = Object.freeze(['none', 'even', 'mark', 'odd', 'space']) +const FLOWCONTROLS = Object.freeze(['xon', 'xoff', 'xany', 'rtscts']) + +const defaultSettings = Object.freeze({ + autoOpen: true, + endOnClose: false, + baudRate: 9600, + dataBits: 8, + hupcl: true, + lock: true, + parity: 'none', + rtscts: false, + stopBits: 1, + xany: false, + xoff: false, + xon: false, + highWaterMark: 64 * 1024, +}) + +const defaultSetFlags = Object.freeze({ + brk: false, + cts: false, + dtr: true, + dts: false, + rts: true, +}) + +function allocNewReadPool(poolSize) { + const pool = Buffer.allocUnsafe(poolSize) + pool.used = 0 + return pool +} + +/** + * A callback called with an error or null. + * @typedef {function} errorCallback + * @param {?error} error + */ + +/** + * A callback called with an error or an object with the modem line values (cts, dsr, dcd). + * @typedef {function} modemBitsCallback + * @param {?error} error + * @param {?object} status + * @param {boolean} [status.cts=false] + * @param {boolean} [status.dsr=false] + * @param {boolean} [status.dcd=false] + */ + +/** + * @typedef {Object} openOptions + * @property {boolean} [autoOpen=true] Automatically opens the port on `nextTick`. + * @property {number=} [baudRate=9600] The baud rate of the port to be opened. This should match one of the commonly available baud rates, such as 110, 300, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, or 115200. Custom rates are supported best effort per platform. The device connected to the serial port is not guaranteed to support the requested baud rate, even if the port itself supports that baud rate. + * @property {number} [dataBits=8] Must be one of these: 8, 7, 6, or 5. + * @property {number} [highWaterMark=65536] The size of the read and write buffers defaults to 64k. + * @property {boolean} [lock=true] Prevent other processes from opening the port. Windows does not currently support `false`. + * @property {number} [stopBits=1] Must be one of these: 1 or 2. + * @property {string} [parity=none] Must be one of these: 'none', 'even', 'mark', 'odd', 'space'. + * @property {boolean} [rtscts=false] flow control setting + * @property {boolean} [xon=false] flow control setting + * @property {boolean} [xoff=false] flow control setting + * @property {boolean} [xany=false] flow control setting + * @property {object=} bindingOptions sets binding-specific options + * @property {Binding=} binding The hardware access binding. `Bindings` are how Node-Serialport talks to the underlying system. By default we auto detect Windows (`WindowsBinding`), Linux (`LinuxBinding`) and OS X (`DarwinBinding`) and load the appropriate module for your system. + * @property {number} [bindingOptions.vmin=1] see [`man termios`](http://linux.die.net/man/3/termios) LinuxBinding and DarwinBinding + * @property {number} [bindingOptions.vtime=0] see [`man termios`](http://linux.die.net/man/3/termios) LinuxBinding and DarwinBinding + */ + +/** + * Create a new serial port object for the `path`. In the case of invalid arguments or invalid options, when constructing a new SerialPort it will throw an error. The port will open automatically by default, which is the equivalent of calling `port.open(openCallback)` in the next tick. You can disable this by setting the option `autoOpen` to `false`. + * @class SerialPort + * @param {string} path - The system path of the serial port you want to open. For example, `/dev/tty.XXX` on Mac/Linux, or `COM1` on Windows. + * @param {openOptions=} options - Port configuration options + * @param {errorCallback=} openCallback - Called after a connection is opened. If this is not provided and an error occurs, it will be emitted on the port's `error` event. The callback will NOT be called if `autoOpen` is set to `false` in the `openOptions` as the open will not be performed. + * @property {number} baudRate The port's baudRate. Use `.update` to change it. Read-only. + * @property {object} binding The binding object backing the port. Read-only. + * @property {boolean} isOpen `true` if the port is open, `false` otherwise. Read-only. (`since 5.0.0`) + * @property {string} path The system path or name of the serial port. Read-only. + * @throws {TypeError} When given invalid arguments, a `TypeError` will be thrown. + * @emits open + * @emits data + * @emits close + * @emits error + * @alias module:serialport + */ +function SerialPort(path, options, openCallback) { + if (!(this instanceof SerialPort)) { + return new SerialPort(path, options, openCallback) + } + + if (options instanceof Function) { + openCallback = options + options = {} + } + + const settings = { ...defaultSettings, ...options } + + stream.Duplex.call(this, { + highWaterMark: settings.highWaterMark, + }) + + const Binding = settings.binding || SerialPort.Binding + + if (!Binding) { + throw new TypeError('"Bindings" is invalid pass it as `options.binding` or set it on `SerialPort.Binding`') + } + + if (!path) { + throw new TypeError(`"path" is not defined: ${path}`) + } + + if (settings.baudrate) { + throw new TypeError(`"baudrate" is an unknown option, did you mean "baudRate"?`) + } + + if (typeof settings.baudRate !== 'number') { + throw new TypeError(`"baudRate" must be a number: ${settings.baudRate}`) + } + + if (DATABITS.indexOf(settings.dataBits) === -1) { + throw new TypeError(`"databits" is invalid: ${settings.dataBits}`) + } + + if (STOPBITS.indexOf(settings.stopBits) === -1) { + throw new TypeError(`"stopbits" is invalid: ${settings.stopbits}`) + } + + if (PARITY.indexOf(settings.parity) === -1) { + throw new TypeError(`"parity" is invalid: ${settings.parity}`) + } + + FLOWCONTROLS.forEach(control => { + if (typeof settings[control] !== 'boolean') { + throw new TypeError(`"${control}" is not boolean: ${settings[control]}`) + } + }) + + const binding = new Binding({ + bindingOptions: settings.bindingOptions, + }) + + Object.defineProperties(this, { + binding: { + enumerable: true, + value: binding, + }, + path: { + enumerable: true, + value: path, + }, + settings: { + enumerable: true, + value: settings, + }, + }) + + this.opening = false + this.closing = false + this._pool = allocNewReadPool(this.settings.highWaterMark) + this._kMinPoolSpace = 128 + + if (this.settings.autoOpen) { + this.open(openCallback) + } +} + +util.inherits(SerialPort, stream.Duplex) + +Object.defineProperties(SerialPort.prototype, { + isOpen: { + enumerable: true, + get() { + return this.binding.isOpen && !this.closing + }, + }, + baudRate: { + enumerable: true, + get() { + return this.settings.baudRate + }, + }, +}) + +/** + * The `error` event's callback is called with an error object whenever there is an error. + * @event error + */ + +SerialPort.prototype._error = function (error, callback) { + if (callback) { + callback.call(this, error) + } else { + this.emit('error', error) + } +} + +SerialPort.prototype._asyncError = function (error, callback) { + process.nextTick(() => this._error(error, callback)) +} + +/** + * The `open` event's callback is called with no arguments when the port is opened and ready for writing. This happens if you have the constructor open immediately (which opens in the next tick) or if you open the port manually with `open()`. See [Useage/Opening a Port](#opening-a-port) for more information. + * @event open + */ + +/** + * Opens a connection to the given serial port. + * @param {errorCallback=} openCallback - Called after a connection is opened. If this is not provided and an error occurs, it will be emitted on the port's `error` event. + * @emits open + * @returns {undefined} + */ +SerialPort.prototype.open = function (openCallback) { + if (this.isOpen) { + return this._asyncError(new Error('Port is already open'), openCallback) + } + + if (this.opening) { + return this._asyncError(new Error('Port is opening'), openCallback) + } + + this.opening = true + debug('opening', `path: ${this.path}`) + this.binding.open(this.path, this.settings).then( + () => { + debug('opened', `path: ${this.path}`) + this.opening = false + this.emit('open') + if (openCallback) { + openCallback.call(this, null) + } + }, + err => { + this.opening = false + debug('Binding #open had an error', err) + this._error(err, openCallback) + } + ) +} + +/** + * Changes the baud rate for an open port. Throws if you provide a bad argument. Emits an error or calls the callback if the baud rate isn't supported. + * @param {object=} options Only supports `baudRate`. + * @param {number=} [options.baudRate] The baud rate of the port to be opened. This should match one of the commonly available baud rates, such as 110, 300, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, or 115200. Custom rates are supported best effort per platform. The device connected to the serial port is not guaranteed to support the requested baud rate, even if the port itself supports that baud rate. + * @param {errorCallback=} [callback] Called once the port's baud rate changes. If `.update` is called without a callback, and there is an error, an error event is emitted. + * @returns {undefined} + */ +SerialPort.prototype.update = function (options, callback) { + if (typeof options !== 'object') { + throw TypeError('"options" is not an object') + } + + if (!this.isOpen) { + debug('update attempted, but port is not open') + return this._asyncError(new Error('Port is not open'), callback) + } + + const settings = { ...defaultSettings, ...options } + this.settings.baudRate = settings.baudRate + + debug('update', `baudRate: ${settings.baudRate}`) + this.binding.update(this.settings).then( + () => { + debug('binding.update', 'finished') + if (callback) { + callback.call(this, null) + } + }, + err => { + debug('binding.update', 'error', err) + return this._error(err, callback) + } + ) +} + +/** + * Writes data to the given serial port. Buffers written data if the port is not open. + +The write operation is non-blocking. When it returns, data might still not have been written to the serial port. See `drain()`. + +Some devices, like the Arduino, reset when you open a connection to them. In such cases, immediately writing to the device will cause lost data as they wont be ready to receive the data. This is often worked around by having the Arduino send a "ready" byte that your Node program waits for before writing. You can also often get away with waiting around 400ms. + +If a port is disconnected during a write, the write will error in addition to the `close` event. + +From the [stream docs](https://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback) write errors don't always provide the error in the callback, sometimes they use the error event. +> If an error occurs, the callback may or may not be called with the error as its first argument. To reliably detect write errors, add a listener for the 'error' event. + +In addition to the usual `stream.write` arguments (`String` and `Buffer`), `write()` can accept arrays of bytes (positive numbers under 256) which is passed to `Buffer.from([])` for conversion. This extra functionality is pretty sweet. + * @method SerialPort.prototype.write + * @param {(string|array|buffer)} data Accepts a [`Buffer`](http://nodejs.org/api/buffer.html) object, or a type that is accepted by the `Buffer` constructor (e.g. an array of bytes or a string). + * @param {string=} encoding The encoding, if chunk is a string. Defaults to `'utf8'`. Also accepts `'ascii'`, `'base64'`, `'binary'`, and `'hex'` See [Buffers and Character Encodings](https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings) for all available options. + * @param {function=} callback Called once the write operation finishes. Data may not yet be flushed to the underlying port. No arguments. + * @returns {boolean} `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + * @since 5.0.0 + */ +const superWrite = SerialPort.prototype.write +SerialPort.prototype.write = function (data, encoding, callback) { + if (Array.isArray(data)) { + data = Buffer.from(data) + } + return superWrite.call(this, data, encoding, callback) +} + +SerialPort.prototype._write = function (data, encoding, callback) { + if (!this.isOpen) { + return this.once('open', function afterOpenWrite() { + this._write(data, encoding, callback) + }) + } + debug('_write', `${data.length} bytes of data`) + this.binding.write(data).then( + () => { + debug('binding.write', 'write finished') + callback(null) + }, + err => { + debug('binding.write', 'error', err) + if (!err.canceled) { + this._disconnected(err) + } + callback(err) + } + ) +} + +SerialPort.prototype._writev = function (data, callback) { + debug('_writev', `${data.length} chunks of data`) + const dataV = data.map(write => write.chunk) + this._write(Buffer.concat(dataV), null, callback) +} + +/** + * Request a number of bytes from the SerialPort. The `read()` method pulls some data out of the internal buffer and returns it. If no data is available to be read, null is returned. By default, the data is returned as a `Buffer` object unless an encoding has been specified using the `.setEncoding()` method. + * @method SerialPort.prototype.read + * @param {number=} size Specify how many bytes of data to return, if available + * @returns {(string|Buffer|null)} The data from internal buffers + * @since 5.0.0 + */ + +/** + * Listening for the `data` event puts the port in flowing mode. Data is emitted as soon as it's received. Data is a `Buffer` object with a varying amount of data in it. The `readLine` parser converts the data into string lines. See the [parsers](https://serialport.io/docs/api-parsers-overview) section for more information on parsers, and the [Node.js stream documentation](https://nodejs.org/api/stream.html#stream_event_data) for more information on the data event. + * @event data + */ + +SerialPort.prototype._read = function (bytesToRead) { + if (!this.isOpen) { + debug('_read', 'queueing _read for after open') + this.once('open', () => { + this._read(bytesToRead) + }) + return + } + + if (!this._pool || this._pool.length - this._pool.used < this._kMinPoolSpace) { + debug('_read', 'discarding the read buffer pool because it is below kMinPoolSpace') + this._pool = allocNewReadPool(this.settings.highWaterMark) + } + + // Grab another reference to the pool in the case that while we're + // in the thread pool another read() finishes up the pool, and + // allocates a new one. + const pool = this._pool + // Read the smaller of rest of the pool or however many bytes we want + const toRead = Math.min(pool.length - pool.used, bytesToRead) + const start = pool.used + + // the actual read. + debug('_read', `reading`, { start, toRead }) + this.binding.read(pool, start, toRead).then( + ({ bytesRead }) => { + debug('binding.read', `finished`, { bytesRead }) + // zero bytes means read means we've hit EOF? Maybe this should be an error + if (bytesRead === 0) { + debug('binding.read', 'Zero bytes read closing readable stream') + this.push(null) + return + } + pool.used += bytesRead + this.push(pool.slice(start, start + bytesRead)) + }, + err => { + debug('binding.read', `error`, err) + if (!err.canceled) { + this._disconnected(err) + } + this._read(bytesToRead) // prime to read more once we're reconnected + } + ) +} + +SerialPort.prototype._disconnected = function (err) { + if (!this.isOpen) { + debug('disconnected aborted because already closed', err) + return + } + debug('disconnected', err) + err.disconnected = true + this.close(null, err) +} + +/** + * The `close` event's callback is called with no arguments when the port is closed. In the case of a disconnect it will be called with a Disconnect Error object (`err.disconnected == true`). In the event of a close error (unlikely), an error event is triggered. + * @event close + */ + +/** + * Closes an open connection. + * + * If there are in progress writes when the port is closed the writes will error. + * @param {errorCallback} callback Called once a connection is closed. + * @param {Error} disconnectError used internally to propagate a disconnect error + * @emits close + * @returns {undefined} + */ +SerialPort.prototype.close = function (callback, disconnectError) { + disconnectError = disconnectError || null + + if (!this.isOpen) { + debug('close attempted, but port is not open') + return this._asyncError(new Error('Port is not open'), callback) + } + + this.closing = true + debug('#close') + this.binding.close().then( + () => { + this.closing = false + debug('binding.close', 'finished') + this.emit('close', disconnectError) + if (this.settings.endOnClose) { + this.emit('end') + } + if (callback) { + callback.call(this, disconnectError) + } + }, + err => { + this.closing = false + debug('binding.close', 'had an error', err) + return this._error(err, callback) + } + ) +} + +/** + * Set control flags on an open port. Uses [`SetCommMask`](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363257(v=vs.85).aspx) for Windows and [`ioctl`](http://linux.die.net/man/4/tty_ioctl) for OS X and Linux. + * @param {object=} options All options are operating system default when the port is opened. Every flag is set on each call to the provided or default values. If options isn't provided default options is used. + * @param {Boolean} [options.brk=false] sets the brk flag + * @param {Boolean} [options.cts=false] sets the cts flag + * @param {Boolean} [options.dsr=false] sets the dsr flag + * @param {Boolean} [options.dtr=true] sets the dtr flag + * @param {Boolean} [options.rts=true] sets the rts flag + * @param {errorCallback=} callback Called once the port's flags have been set. + * @since 5.0.0 + * @returns {undefined} + */ +SerialPort.prototype.set = function (options, callback) { + if (typeof options !== 'object') { + throw TypeError('"options" is not an object') + } + + if (!this.isOpen) { + debug('set attempted, but port is not open') + return this._asyncError(new Error('Port is not open'), callback) + } + + const settings = { ...defaultSetFlags, ...options } + debug('#set', settings) + this.binding.set(settings).then( + () => { + debug('binding.set', 'finished') + if (callback) { + callback.call(this, null) + } + }, + err => { + debug('binding.set', 'had an error', err) + return this._error(err, callback) + } + ) +} + +/** + * Returns the control flags (CTS, DSR, DCD) on the open port. + * Uses [`GetCommModemStatus`](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363258(v=vs.85).aspx) for Windows and [`ioctl`](http://linux.die.net/man/4/tty_ioctl) for mac and linux. + * @param {modemBitsCallback=} callback Called once the modem bits are retrieved. + * @returns {undefined} + */ +SerialPort.prototype.get = function (callback) { + if (!this.isOpen) { + debug('get attempted, but port is not open') + return this._asyncError(new Error('Port is not open'), callback) + } + + debug('#get') + this.binding.get().then( + status => { + debug('binding.get', 'finished') + if (callback) { + callback.call(this, null, status) + } + }, + err => { + debug('binding.get', 'had an error', err) + return this._error(err, callback) + } + ) +} + +/** + * Flush discards data received but not read, and written but not transmitted by the operating system. For more technical details, see [`tcflush(fd, TCIOFLUSH)`](http://linux.die.net/man/3/tcflush) for Mac/Linux and [`FlushFileBuffers`](http://msdn.microsoft.com/en-us/library/windows/desktop/aa364439) for Windows. + * @param {errorCallback=} callback Called once the flush operation finishes. + * @returns {undefined} + */ +SerialPort.prototype.flush = function (callback) { + if (!this.isOpen) { + debug('flush attempted, but port is not open') + return this._asyncError(new Error('Port is not open'), callback) + } + + debug('#flush') + this.binding.flush().then( + () => { + debug('binding.flush', 'finished') + if (callback) { + callback.call(this, null) + } + }, + err => { + debug('binding.flush', 'had an error', err) + return this._error(err, callback) + } + ) +} + +/** + * Waits until all output data is transmitted to the serial port. After any pending write has completed it calls [`tcdrain()`](http://linux.die.net/man/3/tcdrain) or [FlushFileBuffers()](https://msdn.microsoft.com/en-us/library/windows/desktop/aa364439(v=vs.85).aspx) to ensure it has been written to the device. + * @param {errorCallback=} callback Called once the drain operation returns. + * @returns {undefined} + * @example +Write the `data` and wait until it has finished transmitting to the target serial port before calling the callback. This will queue until the port is open and writes are finished. + +```js +function writeAndDrain (data, callback) { + port.write(data); + port.drain(callback); +} +``` + */ +SerialPort.prototype.drain = function (callback) { + debug('drain') + if (!this.isOpen) { + debug('drain queuing on port open') + return this.once('open', () => { + this.drain(callback) + }) + } + this.binding.drain().then( + () => { + debug('binding.drain', 'finished') + if (callback) { + callback.call(this, null) + } + }, + err => { + debug('binding.drain', 'had an error', err) + return this._error(err, callback) + } + ) +} + +/** + * The `pause()` method causes a stream in flowing mode to stop emitting 'data' events, switching out of flowing mode. Any data that becomes available remains in the internal buffer. + * @method SerialPort.prototype.pause + * @see resume + * @since 5.0.0 + * @returns `this` + */ + +/** + * The `resume()` method causes an explicitly paused, `Readable` stream to resume emitting 'data' events, switching the stream into flowing mode. + * @method SerialPort.prototype.resume + * @see pause + * @since 5.0.0 + * @returns `this` + */ + +/** + * Retrieves a list of available serial ports with metadata. Only the `path` is guaranteed. If unavailable the other fields will be undefined. The `path` is either the path or an identifier (eg `COM1`) used to open the SerialPort. + * + * We make an effort to identify the hardware attached and have consistent results between systems. Linux and OS X are mostly consistent. Windows relies on 3rd party device drivers for the information and is unable to guarantee the information. On windows If you have a USB connected device can we provide a serial number otherwise it will be `undefined`. The `pnpId` and `locationId` are not the same or present on all systems. The examples below were run with the same Arduino Uno. + * @type {function} + * @returns {Promise} Resolves with the list of available serial ports. + * @example +```js +// OSX example port +{ + path: '/dev/tty.usbmodem1421', + manufacturer: 'Arduino (www.arduino.cc)', + serialNumber: '752303138333518011C1', + pnpId: undefined, + locationId: '14500000', + productId: '0043', + vendorId: '2341' +} + +// Linux example port +{ + path: '/dev/ttyACM0', + manufacturer: 'Arduino (www.arduino.cc)', + serialNumber: '752303138333518011C1', + pnpId: 'usb-Arduino__www.arduino.cc__0043_752303138333518011C1-if00', + locationId: undefined, + productId: '0043', + vendorId: '2341' +} + +// Windows example port +{ + path: 'COM3', + manufacturer: 'Arduino LLC (www.arduino.cc)', + serialNumber: '752303138333518011C1', + pnpId: 'USB\\VID_2341&PID_0043\\752303138333518011C1', + locationId: 'Port_#0003.Hub_#0001', + productId: '0043', + vendorId: '2341' +} +``` + +```js +var SerialPort = require('serialport'); + +// promise approach +SerialPort.list() + .then(ports) {...}); + .catch(err) {...}); +``` + */ +SerialPort.list = async function (callback) { + debug('.list') + if (!SerialPort.Binding) { + throw new TypeError('No Binding set on `SerialPort.Binding`') + } + if (callback) { + throw new TypeError('SerialPort.list no longer takes a callback and only returns a promise') + } + return SerialPort.Binding.list() +} + +module.exports = SerialPort diff --git a/server/node_modules/@serialport/stream/node_modules/debug/LICENSE b/server/node_modules/@serialport/stream/node_modules/debug/LICENSE new file mode 100644 index 0000000..1a9820e --- /dev/null +++ b/server/node_modules/@serialport/stream/node_modules/debug/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/server/node_modules/@serialport/stream/node_modules/debug/README.md b/server/node_modules/@serialport/stream/node_modules/debug/README.md new file mode 100644 index 0000000..5ea4cd2 --- /dev/null +++ b/server/node_modules/@serialport/stream/node_modules/debug/README.md @@ -0,0 +1,478 @@ +# debug +[![Build Status](https://travis-ci.org/debug-js/debug.svg?branch=master)](https://travis-ci.org/debug-js/debug) [![Coverage Status](https://coveralls.io/repos/github/debug-js/debug/badge.svg?branch=master)](https://coveralls.io/github/debug-js/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + +## Usage in child processes + +Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process. +For example: + +```javascript +worker = fork(WORKER_WRAP_PATH, [workerPath], { + stdio: [ + /* stdin: */ 0, + /* stdout: */ 'pipe', + /* stderr: */ 'pipe', + 'ipc', + ], + env: Object.assign({}, process.env, { + DEBUG_COLORS: 1 // without this settings, colors won't be shown + }), +}); + +worker.stderr.pipe(process.stderr, { end: false }); +``` + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + - Josh Junon + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/@serialport/stream/node_modules/debug/package.json b/server/node_modules/@serialport/stream/node_modules/debug/package.json new file mode 100644 index 0000000..3e65caf --- /dev/null +++ b/server/node_modules/@serialport/stream/node_modules/debug/package.json @@ -0,0 +1,101 @@ +{ + "_from": "debug@^4.3.2", + "_id": "debug@4.3.3", + "_inBundle": false, + "_integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "_location": "/@serialport/stream/debug", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "debug@^4.3.2", + "name": "debug", + "escapedName": "debug", + "rawSpec": "^4.3.2", + "saveSpec": null, + "fetchSpec": "^4.3.2" + }, + "_requiredBy": [ + "/@serialport/stream" + ], + "_resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "_shasum": "04266e0b70a98d4462e6e288e38259213332b664", + "_spec": "debug@^4.3.2", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/@serialport/stream", + "author": { + "name": "Josh Junon", + "email": "josh.junon@protonmail.com" + }, + "browser": "./src/browser.js", + "bugs": { + "url": "https://github.com/debug-js/debug/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + }, + { + "name": "Andrew Rhyne", + "email": "rhyneandrew@gmail.com" + } + ], + "dependencies": { + "ms": "2.1.2" + }, + "deprecated": false, + "description": "Lightweight debugging utility for Node.js and the browser", + "devDependencies": { + "brfs": "^2.0.1", + "browserify": "^16.2.3", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "xo": "^0.23.0" + }, + "engines": { + "node": ">=6.0" + }, + "files": [ + "src", + "LICENSE", + "README.md" + ], + "homepage": "https://github.com/debug-js/debug#readme", + "keywords": [ + "debug", + "log", + "debugger" + ], + "license": "MIT", + "main": "./src/index.js", + "name": "debug", + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, + "repository": { + "type": "git", + "url": "git://github.com/debug-js/debug.git" + }, + "scripts": { + "lint": "xo", + "test": "npm run test:node && npm run test:browser && npm run lint", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls", + "test:node": "istanbul cover _mocha -- test.js" + }, + "version": "4.3.3" +} diff --git a/server/node_modules/@serialport/stream/node_modules/debug/src/browser.js b/server/node_modules/@serialport/stream/node_modules/debug/src/browser.js new file mode 100644 index 0000000..3bf30ea --- /dev/null +++ b/server/node_modules/@serialport/stream/node_modules/debug/src/browser.js @@ -0,0 +1,269 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('debug/src/common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/server/node_modules/@serialport/stream/node_modules/debug/src/common.js b/server/node_modules/@serialport/stream/node_modules/debug/src/common.js new file mode 100644 index 0000000..6d571d2 --- /dev/null +++ b/server/node_modules/@serialport/stream/node_modules/debug/src/common.js @@ -0,0 +1,274 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/server/node_modules/@serialport/stream/node_modules/debug/src/index.js b/server/node_modules/@serialport/stream/node_modules/debug/src/index.js new file mode 100644 index 0000000..d0b8579 --- /dev/null +++ b/server/node_modules/@serialport/stream/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('debug/src/browser.js'); +} else { + module.exports = require('debug/src/node.js'); +} diff --git a/server/node_modules/@serialport/stream/node_modules/debug/src/node.js b/server/node_modules/@serialport/stream/node_modules/debug/src/node.js new file mode 100644 index 0000000..3044efc --- /dev/null +++ b/server/node_modules/@serialport/stream/node_modules/debug/src/node.js @@ -0,0 +1,263 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('debug/src/common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/server/node_modules/@serialport/stream/node_modules/ms/index.js b/server/node_modules/@serialport/stream/node_modules/ms/index.js new file mode 100644 index 0000000..c4498bc --- /dev/null +++ b/server/node_modules/@serialport/stream/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/server/node_modules/@serialport/stream/node_modules/ms/license.md b/server/node_modules/@serialport/stream/node_modules/ms/license.md new file mode 100644 index 0000000..69b6125 --- /dev/null +++ b/server/node_modules/@serialport/stream/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/server/node_modules/@serialport/stream/node_modules/ms/package.json b/server/node_modules/@serialport/stream/node_modules/ms/package.json new file mode 100644 index 0000000..6ddf30a --- /dev/null +++ b/server/node_modules/@serialport/stream/node_modules/ms/package.json @@ -0,0 +1,69 @@ +{ + "_from": "ms@2.1.2", + "_id": "ms@2.1.2", + "_inBundle": false, + "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "_location": "/@serialport/stream/ms", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "ms@2.1.2", + "name": "ms", + "escapedName": "ms", + "rawSpec": "2.1.2", + "saveSpec": null, + "fetchSpec": "2.1.2" + }, + "_requiredBy": [ + "/@serialport/stream/debug" + ], + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009", + "_spec": "ms@2.1.2", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/@serialport/stream/node_modules/debug", + "bugs": { + "url": "https://github.com/zeit/ms/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tiny millisecond conversion utility", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/zeit/ms#readme", + "license": "MIT", + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "main": "./index", + "name": "ms", + "repository": { + "type": "git", + "url": "git+https://github.com/zeit/ms.git" + }, + "scripts": { + "lint": "eslint lib/* bin/*", + "precommit": "lint-staged", + "test": "mocha tests.js" + }, + "version": "2.1.2" +} diff --git a/server/node_modules/@serialport/stream/node_modules/ms/readme.md b/server/node_modules/@serialport/stream/node_modules/ms/readme.md new file mode 100644 index 0000000..9a1996b --- /dev/null +++ b/server/node_modules/@serialport/stream/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/server/node_modules/@serialport/stream/package.json b/server/node_modules/@serialport/stream/package.json new file mode 100644 index 0000000..4c888df --- /dev/null +++ b/server/node_modules/@serialport/stream/package.json @@ -0,0 +1,55 @@ +{ + "_from": "@serialport/stream@9.2.4", + "_id": "@serialport/stream@9.2.4", + "_inBundle": false, + "_integrity": "sha512-bLye8Ub4vUFQGmkh8qEqehr7SE7EJs2yDs0h9jzuL5oKi+F34CFmWkEErO8GAOQ8YNn7p6b3GxUgs+0BrHHDZQ==", + "_location": "/@serialport/stream", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@serialport/stream@9.2.4", + "name": "@serialport/stream", + "escapedName": "@serialport%2fstream", + "scope": "@serialport", + "rawSpec": "9.2.4", + "saveSpec": null, + "fetchSpec": "9.2.4" + }, + "_requiredBy": [ + "/serialport" + ], + "_resolved": "https://registry.npmjs.org/@serialport/stream/-/stream-9.2.4.tgz", + "_shasum": "9fce093d0b46ed4599953b4fae81718e050d2b33", + "_spec": "@serialport/stream@9.2.4", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/serialport", + "bugs": { + "url": "https://github.com/serialport/node-serialport/issues" + }, + "bundleDependencies": false, + "dependencies": { + "debug": "^4.3.2" + }, + "deprecated": false, + "description": "The serialport stream interface. This package requires bindings to work.", + "devDependencies": { + "@serialport/binding-mock": "9.2.4" + }, + "engines": { + "node": ">=10.0.0" + }, + "funding": "https://opencollective.com/serialport/donate", + "gitHead": "494fd0f097e25fd5475e543f80bf23cc05ea6abc", + "homepage": "https://github.com/serialport/node-serialport#readme", + "license": "MIT", + "main": "lib", + "name": "@serialport/stream", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git://github.com/serialport/node-serialport.git" + }, + "version": "9.2.4" +} diff --git a/server/node_modules/@sindresorhus/is/dist/index.d.ts b/server/node_modules/@sindresorhus/is/dist/index.d.ts new file mode 100644 index 0000000..e94d30b --- /dev/null +++ b/server/node_modules/@sindresorhus/is/dist/index.d.ts @@ -0,0 +1,132 @@ +/// +/// +/// +/// +/// +declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array; +declare type Primitive = null | undefined | string | number | boolean | Symbol; +export interface ArrayLike { + length: number; +} +export interface Class { + new (...args: any[]): T; +} +declare type DomElement = object & { + nodeType: 1; + nodeName: string; +}; +declare type NodeStream = object & { + pipe: Function; +}; +export declare const enum TypeName { + null = "null", + boolean = "boolean", + undefined = "undefined", + string = "string", + number = "number", + symbol = "symbol", + Function = "Function", + GeneratorFunction = "GeneratorFunction", + AsyncFunction = "AsyncFunction", + Observable = "Observable", + Array = "Array", + Buffer = "Buffer", + Object = "Object", + RegExp = "RegExp", + Date = "Date", + Error = "Error", + Map = "Map", + Set = "Set", + WeakMap = "WeakMap", + WeakSet = "WeakSet", + Int8Array = "Int8Array", + Uint8Array = "Uint8Array", + Uint8ClampedArray = "Uint8ClampedArray", + Int16Array = "Int16Array", + Uint16Array = "Uint16Array", + Int32Array = "Int32Array", + Uint32Array = "Uint32Array", + Float32Array = "Float32Array", + Float64Array = "Float64Array", + ArrayBuffer = "ArrayBuffer", + SharedArrayBuffer = "SharedArrayBuffer", + DataView = "DataView", + Promise = "Promise", + URL = "URL" +} +declare function is(value: unknown): TypeName; +declare namespace is { + const undefined: (value: unknown) => value is undefined; + const string: (value: unknown) => value is string; + const number: (value: unknown) => value is number; + const function_: (value: unknown) => value is Function; + const null_: (value: unknown) => value is null; + const class_: (value: unknown) => value is Class; + const boolean: (value: unknown) => value is boolean; + const symbol: (value: unknown) => value is Symbol; + const numericString: (value: unknown) => boolean; + const array: (arg: any) => arg is any[]; + const buffer: (input: unknown) => input is Buffer; + const nullOrUndefined: (value: unknown) => value is null | undefined; + const object: (value: unknown) => value is object; + const iterable: (value: unknown) => value is IterableIterator; + const asyncIterable: (value: unknown) => value is AsyncIterableIterator; + const generator: (value: unknown) => value is Generator; + const nativePromise: (value: unknown) => value is Promise; + const promise: (value: unknown) => value is Promise; + const generatorFunction: (value: unknown) => value is GeneratorFunction; + const asyncFunction: (value: unknown) => value is Function; + const boundFunction: (value: unknown) => value is Function; + const regExp: (value: unknown) => value is RegExp; + const date: (value: unknown) => value is Date; + const error: (value: unknown) => value is Error; + const map: (value: unknown) => value is Map; + const set: (value: unknown) => value is Set; + const weakMap: (value: unknown) => value is WeakMap; + const weakSet: (value: unknown) => value is WeakSet; + const int8Array: (value: unknown) => value is Int8Array; + const uint8Array: (value: unknown) => value is Uint8Array; + const uint8ClampedArray: (value: unknown) => value is Uint8ClampedArray; + const int16Array: (value: unknown) => value is Int16Array; + const uint16Array: (value: unknown) => value is Uint16Array; + const int32Array: (value: unknown) => value is Int32Array; + const uint32Array: (value: unknown) => value is Uint32Array; + const float32Array: (value: unknown) => value is Float32Array; + const float64Array: (value: unknown) => value is Float64Array; + const arrayBuffer: (value: unknown) => value is ArrayBuffer; + const sharedArrayBuffer: (value: unknown) => value is SharedArrayBuffer; + const dataView: (value: unknown) => value is DataView; + const directInstanceOf: (instance: unknown, klass: Class) => instance is T; + const urlInstance: (value: unknown) => value is URL; + const urlString: (value: unknown) => boolean; + const truthy: (value: unknown) => boolean; + const falsy: (value: unknown) => boolean; + const nan: (value: unknown) => boolean; + const primitive: (value: unknown) => value is Primitive; + const integer: (value: unknown) => value is number; + const safeInteger: (value: unknown) => value is number; + const plainObject: (value: unknown) => boolean; + const typedArray: (value: unknown) => value is TypedArray; + const arrayLike: (value: unknown) => value is ArrayLike; + const inRange: (value: number, range: number | number[]) => boolean; + const domElement: (value: unknown) => value is DomElement; + const observable: (value: unknown) => boolean; + const nodeStream: (value: unknown) => value is NodeStream; + const infinite: (value: unknown) => boolean; + const even: (value: number) => boolean; + const odd: (value: number) => boolean; + const emptyArray: (value: unknown) => boolean; + const nonEmptyArray: (value: unknown) => boolean; + const emptyString: (value: unknown) => boolean; + const nonEmptyString: (value: unknown) => boolean; + const emptyStringOrWhitespace: (value: unknown) => boolean; + const emptyObject: (value: unknown) => boolean; + const nonEmptyObject: (value: unknown) => boolean; + const emptySet: (value: unknown) => boolean; + const nonEmptySet: (value: unknown) => boolean; + const emptyMap: (value: unknown) => boolean; + const nonEmptyMap: (value: unknown) => boolean; + const any: (predicate: unknown, ...values: unknown[]) => boolean; + const all: (predicate: unknown, ...values: unknown[]) => boolean; +} +export default is; diff --git a/server/node_modules/@sindresorhus/is/dist/index.js b/server/node_modules/@sindresorhus/is/dist/index.js new file mode 100644 index 0000000..3cbafae --- /dev/null +++ b/server/node_modules/@sindresorhus/is/dist/index.js @@ -0,0 +1,245 @@ +"use strict"; +/// +/// +/// +/// +Object.defineProperty(exports, "__esModule", { value: true }); +// TODO: Use the `URL` global when targeting Node.js 10 +// tslint:disable-next-line +const URLGlobal = typeof URL === 'undefined' ? require('url').URL : URL; +const toString = Object.prototype.toString; +const isOfType = (type) => (value) => typeof value === type; +const isBuffer = (input) => !is.nullOrUndefined(input) && !is.nullOrUndefined(input.constructor) && is.function_(input.constructor.isBuffer) && input.constructor.isBuffer(input); +const getObjectType = (value) => { + const objectName = toString.call(value).slice(8, -1); + if (objectName) { + return objectName; + } + return null; +}; +const isObjectOfType = (type) => (value) => getObjectType(value) === type; +function is(value) { + switch (value) { + case null: + return "null" /* null */; + case true: + case false: + return "boolean" /* boolean */; + default: + } + switch (typeof value) { + case 'undefined': + return "undefined" /* undefined */; + case 'string': + return "string" /* string */; + case 'number': + return "number" /* number */; + case 'symbol': + return "symbol" /* symbol */; + default: + } + if (is.function_(value)) { + return "Function" /* Function */; + } + if (is.observable(value)) { + return "Observable" /* Observable */; + } + if (Array.isArray(value)) { + return "Array" /* Array */; + } + if (isBuffer(value)) { + return "Buffer" /* Buffer */; + } + const tagType = getObjectType(value); + if (tagType) { + return tagType; + } + if (value instanceof String || value instanceof Boolean || value instanceof Number) { + throw new TypeError('Please don\'t use object wrappers for primitive types'); + } + return "Object" /* Object */; +} +(function (is) { + // tslint:disable-next-line:strict-type-predicates + const isObject = (value) => typeof value === 'object'; + // tslint:disable:variable-name + is.undefined = isOfType('undefined'); + is.string = isOfType('string'); + is.number = isOfType('number'); + is.function_ = isOfType('function'); + // tslint:disable-next-line:strict-type-predicates + is.null_ = (value) => value === null; + is.class_ = (value) => is.function_(value) && value.toString().startsWith('class '); + is.boolean = (value) => value === true || value === false; + is.symbol = isOfType('symbol'); + // tslint:enable:variable-name + is.numericString = (value) => is.string(value) && value.length > 0 && !Number.isNaN(Number(value)); + is.array = Array.isArray; + is.buffer = isBuffer; + is.nullOrUndefined = (value) => is.null_(value) || is.undefined(value); + is.object = (value) => !is.nullOrUndefined(value) && (is.function_(value) || isObject(value)); + is.iterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.iterator]); + is.asyncIterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.asyncIterator]); + is.generator = (value) => is.iterable(value) && is.function_(value.next) && is.function_(value.throw); + is.nativePromise = (value) => isObjectOfType("Promise" /* Promise */)(value); + const hasPromiseAPI = (value) => !is.null_(value) && + isObject(value) && + is.function_(value.then) && + is.function_(value.catch); + is.promise = (value) => is.nativePromise(value) || hasPromiseAPI(value); + is.generatorFunction = isObjectOfType("GeneratorFunction" /* GeneratorFunction */); + is.asyncFunction = isObjectOfType("AsyncFunction" /* AsyncFunction */); + is.boundFunction = (value) => is.function_(value) && !value.hasOwnProperty('prototype'); + is.regExp = isObjectOfType("RegExp" /* RegExp */); + is.date = isObjectOfType("Date" /* Date */); + is.error = isObjectOfType("Error" /* Error */); + is.map = (value) => isObjectOfType("Map" /* Map */)(value); + is.set = (value) => isObjectOfType("Set" /* Set */)(value); + is.weakMap = (value) => isObjectOfType("WeakMap" /* WeakMap */)(value); + is.weakSet = (value) => isObjectOfType("WeakSet" /* WeakSet */)(value); + is.int8Array = isObjectOfType("Int8Array" /* Int8Array */); + is.uint8Array = isObjectOfType("Uint8Array" /* Uint8Array */); + is.uint8ClampedArray = isObjectOfType("Uint8ClampedArray" /* Uint8ClampedArray */); + is.int16Array = isObjectOfType("Int16Array" /* Int16Array */); + is.uint16Array = isObjectOfType("Uint16Array" /* Uint16Array */); + is.int32Array = isObjectOfType("Int32Array" /* Int32Array */); + is.uint32Array = isObjectOfType("Uint32Array" /* Uint32Array */); + is.float32Array = isObjectOfType("Float32Array" /* Float32Array */); + is.float64Array = isObjectOfType("Float64Array" /* Float64Array */); + is.arrayBuffer = isObjectOfType("ArrayBuffer" /* ArrayBuffer */); + is.sharedArrayBuffer = isObjectOfType("SharedArrayBuffer" /* SharedArrayBuffer */); + is.dataView = isObjectOfType("DataView" /* DataView */); + is.directInstanceOf = (instance, klass) => Object.getPrototypeOf(instance) === klass.prototype; + is.urlInstance = (value) => isObjectOfType("URL" /* URL */)(value); + is.urlString = (value) => { + if (!is.string(value)) { + return false; + } + try { + new URLGlobal(value); // tslint:disable-line no-unused-expression + return true; + } + catch (_a) { + return false; + } + }; + is.truthy = (value) => Boolean(value); + is.falsy = (value) => !value; + is.nan = (value) => Number.isNaN(value); + const primitiveTypes = new Set([ + 'undefined', + 'string', + 'number', + 'boolean', + 'symbol' + ]); + is.primitive = (value) => is.null_(value) || primitiveTypes.has(typeof value); + is.integer = (value) => Number.isInteger(value); + is.safeInteger = (value) => Number.isSafeInteger(value); + is.plainObject = (value) => { + // From: https://github.com/sindresorhus/is-plain-obj/blob/master/index.js + let prototype; + return getObjectType(value) === "Object" /* Object */ && + (prototype = Object.getPrototypeOf(value), prototype === null || // tslint:disable-line:ban-comma-operator + prototype === Object.getPrototypeOf({})); + }; + const typedArrayTypes = new Set([ + "Int8Array" /* Int8Array */, + "Uint8Array" /* Uint8Array */, + "Uint8ClampedArray" /* Uint8ClampedArray */, + "Int16Array" /* Int16Array */, + "Uint16Array" /* Uint16Array */, + "Int32Array" /* Int32Array */, + "Uint32Array" /* Uint32Array */, + "Float32Array" /* Float32Array */, + "Float64Array" /* Float64Array */ + ]); + is.typedArray = (value) => { + const objectType = getObjectType(value); + if (objectType === null) { + return false; + } + return typedArrayTypes.has(objectType); + }; + const isValidLength = (value) => is.safeInteger(value) && value > -1; + is.arrayLike = (value) => !is.nullOrUndefined(value) && !is.function_(value) && isValidLength(value.length); + is.inRange = (value, range) => { + if (is.number(range)) { + return value >= Math.min(0, range) && value <= Math.max(range, 0); + } + if (is.array(range) && range.length === 2) { + return value >= Math.min(...range) && value <= Math.max(...range); + } + throw new TypeError(`Invalid range: ${JSON.stringify(range)}`); + }; + const NODE_TYPE_ELEMENT = 1; + const DOM_PROPERTIES_TO_CHECK = [ + 'innerHTML', + 'ownerDocument', + 'style', + 'attributes', + 'nodeValue' + ]; + is.domElement = (value) => is.object(value) && value.nodeType === NODE_TYPE_ELEMENT && is.string(value.nodeName) && + !is.plainObject(value) && DOM_PROPERTIES_TO_CHECK.every(property => property in value); + is.observable = (value) => { + if (!value) { + return false; + } + if (value[Symbol.observable] && value === value[Symbol.observable]()) { + return true; + } + if (value['@@observable'] && value === value['@@observable']()) { + return true; + } + return false; + }; + is.nodeStream = (value) => !is.nullOrUndefined(value) && isObject(value) && is.function_(value.pipe) && !is.observable(value); + is.infinite = (value) => value === Infinity || value === -Infinity; + const isAbsoluteMod2 = (rem) => (value) => is.integer(value) && Math.abs(value % 2) === rem; + is.even = isAbsoluteMod2(0); + is.odd = isAbsoluteMod2(1); + const isWhiteSpaceString = (value) => is.string(value) && /\S/.test(value) === false; + is.emptyArray = (value) => is.array(value) && value.length === 0; + is.nonEmptyArray = (value) => is.array(value) && value.length > 0; + is.emptyString = (value) => is.string(value) && value.length === 0; + is.nonEmptyString = (value) => is.string(value) && value.length > 0; + is.emptyStringOrWhitespace = (value) => is.emptyString(value) || isWhiteSpaceString(value); + is.emptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length === 0; + is.nonEmptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length > 0; + is.emptySet = (value) => is.set(value) && value.size === 0; + is.nonEmptySet = (value) => is.set(value) && value.size > 0; + is.emptyMap = (value) => is.map(value) && value.size === 0; + is.nonEmptyMap = (value) => is.map(value) && value.size > 0; + const predicateOnArray = (method, predicate, values) => { + if (is.function_(predicate) === false) { + throw new TypeError(`Invalid predicate: ${JSON.stringify(predicate)}`); + } + if (values.length === 0) { + throw new TypeError('Invalid number of values'); + } + return method.call(values, predicate); + }; + // tslint:disable variable-name + is.any = (predicate, ...values) => predicateOnArray(Array.prototype.some, predicate, values); + is.all = (predicate, ...values) => predicateOnArray(Array.prototype.every, predicate, values); + // tslint:enable variable-name +})(is || (is = {})); +// Some few keywords are reserved, but we'll populate them for Node.js users +// See https://github.com/Microsoft/TypeScript/issues/2536 +Object.defineProperties(is, { + class: { + value: is.class_ + }, + function: { + value: is.function_ + }, + null: { + value: is.null_ + } +}); +exports.default = is; +// For CommonJS default export support +module.exports = is; +module.exports.default = is; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/server/node_modules/@sindresorhus/is/dist/index.js.map b/server/node_modules/@sindresorhus/is/dist/index.js.map new file mode 100644 index 0000000..cd827fc --- /dev/null +++ b/server/node_modules/@sindresorhus/is/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,0CAA0C;AAC1C,2CAA2C;AAC3C,0BAA0B;;AAE1B,uDAAuD;AACvD,2BAA2B;AAC3B,MAAM,SAAS,GAAG,OAAO,GAAG,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAqDxE,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;AAC3C,MAAM,QAAQ,GAAG,CAAI,IAAY,EAAE,EAAE,CAAC,CAAC,KAAc,EAAc,EAAE,CAAC,OAAO,KAAK,KAAK,IAAI,CAAC;AAC5F,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAmB,EAAE,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,eAAe,CAAE,KAAgB,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,SAAS,CAAE,KAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAK,KAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAEhP,MAAM,aAAa,GAAG,CAAC,KAAc,EAAmB,EAAE;IACzD,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAErD,IAAI,UAAU,EAAE;QACf,OAAO,UAAsB,CAAC;KAC9B;IAED,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAI,IAAc,EAAE,EAAE,CAAC,CAAC,KAAc,EAAc,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;AAE5G,SAAS,EAAE,CAAC,KAAc;IACzB,QAAQ,KAAK,EAAE;QACd,KAAK,IAAI;YACR,yBAAqB;QACtB,KAAK,IAAI,CAAC;QACV,KAAK,KAAK;YACT,+BAAwB;QACzB,QAAQ;KACR;IAED,QAAQ,OAAO,KAAK,EAAE;QACrB,KAAK,WAAW;YACf,mCAA0B;QAC3B,KAAK,QAAQ;YACZ,6BAAuB;QACxB,KAAK,QAAQ;YACZ,6BAAuB;QACxB,KAAK,QAAQ;YACZ,6BAAuB;QACxB,QAAQ;KACR;IAED,IAAI,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;QACxB,iCAAyB;KACzB;IAED,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QACzB,qCAA2B;KAC3B;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACzB,2BAAsB;KACtB;IAED,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;QACpB,6BAAuB;KACvB;IAED,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACrC,IAAI,OAAO,EAAE;QACZ,OAAO,OAAO,CAAC;KACf;IAED,IAAI,KAAK,YAAY,MAAM,IAAI,KAAK,YAAY,OAAO,IAAI,KAAK,YAAY,MAAM,EAAE;QACnF,MAAM,IAAI,SAAS,CAAC,uDAAuD,CAAC,CAAC;KAC7E;IAED,6BAAuB;AACxB,CAAC;AAED,WAAU,EAAE;IACX,kDAAkD;IAClD,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;IAEhF,+BAA+B;IAClB,YAAS,GAAG,QAAQ,CAAY,WAAW,CAAC,CAAC;IAC7C,SAAM,GAAG,QAAQ,CAAS,QAAQ,CAAC,CAAC;IACpC,SAAM,GAAG,QAAQ,CAAS,QAAQ,CAAC,CAAC;IACpC,YAAS,GAAG,QAAQ,CAAW,UAAU,CAAC,CAAC;IACxD,kDAAkD;IACrC,QAAK,GAAG,CAAC,KAAc,EAAiB,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC;IAC1D,SAAM,GAAG,CAAC,KAAc,EAAkB,EAAE,CAAC,GAAA,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACvG,UAAO,GAAG,CAAC,KAAc,EAAoB,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,KAAK,CAAC;IAClF,SAAM,GAAG,QAAQ,CAAS,QAAQ,CAAC,CAAC;IACjD,8BAA8B;IAEjB,gBAAa,GAAG,CAAC,KAAc,EAAW,EAAE,CACxD,GAAA,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAEtD,QAAK,GAAG,KAAK,CAAC,OAAO,CAAC;IACtB,SAAM,GAAG,QAAQ,CAAC;IAElB,kBAAe,GAAG,CAAC,KAAc,EAA6B,EAAE,CAAC,GAAA,KAAK,CAAC,KAAK,CAAC,IAAI,GAAA,SAAS,CAAC,KAAK,CAAC,CAAC;IAClG,SAAM,GAAG,CAAC,KAAc,EAAmB,EAAE,CAAC,CAAC,GAAA,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,GAAA,SAAS,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/G,WAAQ,GAAG,CAAC,KAAc,EAAsC,EAAE,CAAC,CAAC,GAAA,eAAe,CAAC,KAAK,CAAC,IAAI,GAAA,SAAS,CAAE,KAAmC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/J,gBAAa,GAAG,CAAC,KAAc,EAA2C,EAAE,CAAC,CAAC,GAAA,eAAe,CAAC,KAAK,CAAC,IAAI,GAAA,SAAS,CAAE,KAAwC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;IACnL,YAAS,GAAG,CAAC,KAAc,EAAsB,EAAE,CAAC,GAAA,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAA,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAA,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEvH,gBAAa,GAAG,CAAC,KAAc,EAA6B,EAAE,CAC1E,cAAc,yBAAoC,CAAC,KAAK,CAAC,CAAC;IAE3D,MAAM,aAAa,GAAG,CAAC,KAAc,EAA6B,EAAE,CACnE,CAAC,GAAA,KAAK,CAAC,KAAK,CAAC;QACb,QAAQ,CAAC,KAAK,CAAY;QAC1B,GAAA,SAAS,CAAE,KAA0B,CAAC,IAAI,CAAC;QAC3C,GAAA,SAAS,CAAE,KAA0B,CAAC,KAAK,CAAC,CAAC;IAEjC,UAAO,GAAG,CAAC,KAAc,EAA6B,EAAE,CAAC,GAAA,aAAa,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;IAEtG,oBAAiB,GAAG,cAAc,6CAA+C,CAAC;IAClF,gBAAa,GAAG,cAAc,qCAAkC,CAAC;IACjE,gBAAa,GAAG,CAAC,KAAc,EAAqB,EAAE,CAAC,GAAA,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAE9G,SAAM,GAAG,cAAc,uBAAyB,CAAC;IACjD,OAAI,GAAG,cAAc,mBAAqB,CAAC;IAC3C,QAAK,GAAG,cAAc,qBAAuB,CAAC;IAC9C,MAAG,GAAG,CAAC,KAAc,EAAkC,EAAE,CAAC,cAAc,iBAAqC,CAAC,KAAK,CAAC,CAAC;IACrH,MAAG,GAAG,CAAC,KAAc,EAAyB,EAAE,CAAC,cAAc,iBAA4B,CAAC,KAAK,CAAC,CAAC;IACnG,UAAO,GAAG,CAAC,KAAc,EAAqC,EAAE,CAAC,cAAc,yBAA4C,CAAC,KAAK,CAAC,CAAC;IACnI,UAAO,GAAG,CAAC,KAAc,EAA4B,EAAE,CAAC,cAAc,yBAAmC,CAAC,KAAK,CAAC,CAAC;IAEjH,YAAS,GAAG,cAAc,6BAA+B,CAAC;IAC1D,aAAU,GAAG,cAAc,+BAAiC,CAAC;IAC7D,oBAAiB,GAAG,cAAc,6CAA+C,CAAC;IAClF,aAAU,GAAG,cAAc,+BAAiC,CAAC;IAC7D,cAAW,GAAG,cAAc,iCAAmC,CAAC;IAChE,aAAU,GAAG,cAAc,+BAAiC,CAAC;IAC7D,cAAW,GAAG,cAAc,iCAAmC,CAAC;IAChE,eAAY,GAAG,cAAc,mCAAqC,CAAC;IACnE,eAAY,GAAG,cAAc,mCAAqC,CAAC;IAEnE,cAAW,GAAG,cAAc,iCAAmC,CAAC;IAChE,oBAAiB,GAAG,cAAc,6CAA+C,CAAC;IAClF,WAAQ,GAAG,cAAc,2BAA6B,CAAC;IAEvD,mBAAgB,GAAG,CAAI,QAAiB,EAAE,KAAe,EAAiB,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IACjI,cAAW,GAAG,CAAC,KAAc,EAAgB,EAAE,CAAC,cAAc,iBAAmB,CAAC,KAAK,CAAC,CAAC;IAEzF,YAAS,GAAG,CAAC,KAAc,EAAE,EAAE;QAC3C,IAAI,CAAC,GAAA,MAAM,CAAC,KAAK,CAAC,EAAE;YACnB,OAAO,KAAK,CAAC;SACb;QAED,IAAI;YACH,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,2CAA2C;YACjE,OAAO,IAAI,CAAC;SACZ;QAAC,WAAM;YACP,OAAO,KAAK,CAAC;SACb;IACF,CAAC,CAAC;IAEW,SAAM,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5C,QAAK,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC;IAEnC,MAAG,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAe,CAAC,CAAC;IAErE,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;QAC9B,WAAW;QACX,QAAQ;QACR,QAAQ;QACR,SAAS;QACT,QAAQ;KACR,CAAC,CAAC;IAEU,YAAS,GAAG,CAAC,KAAc,EAAsB,EAAE,CAAC,GAAA,KAAK,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC;IAErG,UAAO,GAAG,CAAC,KAAc,EAAmB,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,KAAe,CAAC,CAAC;IACjF,cAAW,GAAG,CAAC,KAAc,EAAmB,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,KAAe,CAAC,CAAC;IAEzF,cAAW,GAAG,CAAC,KAAc,EAAE,EAAE;QAC7C,0EAA0E;QAC1E,IAAI,SAAS,CAAC;QAEd,OAAO,aAAa,CAAC,KAAK,CAAC,0BAAoB;YAC9C,CAAC,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,SAAS,KAAK,IAAI,IAAI,yCAAyC;gBACzG,SAAS,KAAK,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC;IAEF,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;;;;;;;;;;KAU/B,CAAC,CAAC;IACU,aAAU,GAAG,CAAC,KAAc,EAAuB,EAAE;QACjE,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QAExC,IAAI,UAAU,KAAK,IAAI,EAAE;YACxB,OAAO,KAAK,CAAC;SACb;QAED,OAAO,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,GAAA,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;IAC9D,YAAS,GAAG,CAAC,KAAc,EAAsB,EAAE,CAAC,CAAC,GAAA,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,GAAA,SAAS,CAAC,KAAK,CAAC,IAAI,aAAa,CAAE,KAAmB,CAAC,MAAM,CAAC,CAAC;IAE/I,UAAO,GAAG,CAAC,KAAa,EAAE,KAAwB,EAAE,EAAE;QAClE,IAAI,GAAA,MAAM,CAAC,KAAK,CAAC,EAAE;YAClB,OAAO,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SAClE;QAED,IAAI,GAAA,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACvC,OAAO,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;SAClE;QAED,MAAM,IAAI,SAAS,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAChE,CAAC,CAAC;IAEF,MAAM,iBAAiB,GAAG,CAAC,CAAC;IAC5B,MAAM,uBAAuB,GAAG;QAC/B,WAAW;QACX,eAAe;QACf,OAAO;QACP,YAAY;QACZ,WAAW;KACX,CAAC;IAEW,aAAU,GAAG,CAAC,KAAc,EAAuB,EAAE,CAAC,GAAA,MAAM,CAAC,KAAK,CAAC,IAAK,KAAoB,CAAC,QAAQ,KAAK,iBAAiB,IAAI,GAAA,MAAM,CAAE,KAAoB,CAAC,QAAQ,CAAC;QACjL,CAAC,GAAA,WAAW,CAAC,KAAK,CAAC,IAAI,uBAAuB,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,IAAK,KAAoB,CAAC,CAAC;IAExF,aAAU,GAAG,CAAC,KAAc,EAAE,EAAE;QAC5C,IAAI,CAAC,KAAK,EAAE;YACX,OAAO,KAAK,CAAC;SACb;QAED,IAAK,KAAa,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,KAAK,KAAM,KAAa,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE;YACvF,OAAO,IAAI,CAAC;SACZ;QAED,IAAK,KAAa,CAAC,cAAc,CAAC,IAAI,KAAK,KAAM,KAAa,CAAC,cAAc,CAAC,EAAE,EAAE;YACjF,OAAO,IAAI,CAAC;SACZ;QAED,OAAO,KAAK,CAAC;IACd,CAAC,CAAC;IAEW,aAAU,GAAG,CAAC,KAAc,EAAuB,EAAE,CAAC,CAAC,GAAA,eAAe,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAY,IAAI,GAAA,SAAS,CAAE,KAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAA,UAAU,CAAC,KAAK,CAAC,CAAC;IAE3K,WAAQ,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,CAAC,QAAQ,CAAC;IAEtF,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,GAAA,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC;IAC5F,OAAI,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IACzB,MAAG,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IAErC,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,GAAA,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;IAE9E,aAAU,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,GAAA,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IACpE,gBAAa,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,GAAA,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAErE,cAAW,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,GAAA,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IACtE,iBAAc,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,GAAA,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACvE,0BAAuB,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,GAAA,WAAW,CAAC,KAAK,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAE9F,cAAW,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,GAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAA,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAA,GAAG,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IACjH,iBAAc,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,GAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAA,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAA,GAAG,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAElH,WAAQ,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,GAAA,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC;IAC9D,cAAW,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,GAAA,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;IAE/D,WAAQ,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,GAAA,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC;IAC9D,cAAW,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,GAAA,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;IAG5E,MAAM,gBAAgB,GAAG,CAAC,MAAmB,EAAE,SAAkB,EAAE,MAAiB,EAAE,EAAE;QACvF,IAAI,GAAA,SAAS,CAAC,SAAS,CAAC,KAAK,KAAK,EAAE;YACnC,MAAM,IAAI,SAAS,CAAC,sBAAsB,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;SACvE;QAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,MAAM,IAAI,SAAS,CAAC,0BAA0B,CAAC,CAAC;SAChD;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,SAAgB,CAAC,CAAC;IAC9C,CAAC,CAAC;IAEF,+BAA+B;IAClB,MAAG,GAAG,CAAC,SAAkB,EAAE,GAAG,MAAiB,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC9G,MAAG,GAAG,CAAC,SAAkB,EAAE,GAAG,MAAiB,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC5H,8BAA8B;AAC/B,CAAC,EAvNS,EAAE,KAAF,EAAE,QAuNX;AAED,4EAA4E;AAC5E,0DAA0D;AAC1D,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE;IAC3B,KAAK,EAAE;QACN,KAAK,EAAE,EAAE,CAAC,MAAM;KAChB;IACD,QAAQ,EAAE;QACT,KAAK,EAAE,EAAE,CAAC,SAAS;KACnB;IACD,IAAI,EAAE;QACL,KAAK,EAAE,EAAE,CAAC,KAAK;KACf;CACD,CAAC,CAAC;AAEH,kBAAe,EAAE,CAAC;AAElB,sCAAsC;AACtC,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;AACpB,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC"} \ No newline at end of file diff --git a/server/node_modules/@sindresorhus/is/license b/server/node_modules/@sindresorhus/is/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/server/node_modules/@sindresorhus/is/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/@sindresorhus/is/package.json b/server/node_modules/@sindresorhus/is/package.json new file mode 100644 index 0000000..ccf100e --- /dev/null +++ b/server/node_modules/@sindresorhus/is/package.json @@ -0,0 +1,96 @@ +{ + "_from": "@sindresorhus/is@^0.14.0", + "_id": "@sindresorhus/is@0.14.0", + "_inBundle": false, + "_integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "_location": "/@sindresorhus/is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@sindresorhus/is@^0.14.0", + "name": "@sindresorhus/is", + "escapedName": "@sindresorhus%2fis", + "scope": "@sindresorhus", + "rawSpec": "^0.14.0", + "saveSpec": null, + "fetchSpec": "^0.14.0" + }, + "_requiredBy": [ + "/got" + ], + "_resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "_shasum": "9fb3a3cf3132328151f353de4632e01e52102bea", + "_spec": "@sindresorhus/is@^0.14.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/got", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/is/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Type check values: `is.string('🦄') //=> true`", + "devDependencies": { + "@sindresorhus/tsconfig": "^0.1.0", + "@types/jsdom": "^11.12.0", + "@types/node": "^10.12.10", + "@types/tempy": "^0.2.0", + "@types/zen-observable": "^0.8.0", + "ava": "^0.25.0", + "del-cli": "^1.1.0", + "jsdom": "^11.6.2", + "rxjs": "^6.3.3", + "tempy": "^0.2.1", + "tslint": "^5.9.1", + "tslint-xo": "^0.10.0", + "typescript": "^3.2.1", + "zen-observable": "^0.8.8" + }, + "engines": { + "node": ">=6" + }, + "files": [ + "dist" + ], + "homepage": "https://github.com/sindresorhus/is#readme", + "keywords": [ + "type", + "types", + "is", + "check", + "checking", + "validate", + "validation", + "utility", + "util", + "typeof", + "instanceof", + "object", + "assert", + "assertion", + "test", + "kind", + "primitive", + "verify", + "compare" + ], + "license": "MIT", + "main": "dist/index.js", + "name": "@sindresorhus/is", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/is.git" + }, + "scripts": { + "build": "del dist && tsc", + "lint": "tslint --format stylish --project ", + "prepublish": "npm run build && del dist/tests", + "test": "npm run lint && npm run build && ava dist/tests" + }, + "types": "dist/index.d.ts", + "version": "0.14.0" +} diff --git a/server/node_modules/@sindresorhus/is/readme.md b/server/node_modules/@sindresorhus/is/readme.md new file mode 100644 index 0000000..97c023b --- /dev/null +++ b/server/node_modules/@sindresorhus/is/readme.md @@ -0,0 +1,451 @@ +# is [![Build Status](https://travis-ci.org/sindresorhus/is.svg?branch=master)](https://travis-ci.org/sindresorhus/is) + +> Type check values: `is.string('🦄') //=> true` + + + + +## Install + +``` +$ npm install @sindresorhus/is +``` + + +## Usage + +```js +const is = require('@sindresorhus/is'); + +is('🦄'); +//=> 'string' + +is(new Map()); +//=> 'Map' + +is.number(6); +//=> true +``` + +When using `is` together with TypeScript, [type guards](http://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types) are being used to infer the correct type inside if-else statements. + +```ts +import is from '@sindresorhus/is'; + +const padLeft = (value: string, padding: string | number) => { + if (is.number(padding)) { + // `padding` is typed as `number` + return Array(padding + 1).join(' ') + value; + } + + if (is.string(padding)) { + // `padding` is typed as `string` + return padding + value; + } + + throw new TypeError(`Expected 'padding' to be of type 'string' or 'number', got '${is(padding)}'.`); +} + +padLeft('🦄', 3); +//=> ' 🦄' + +padLeft('🦄', '🌈'); +//=> '🌈🦄' +``` + + +## API + +### is(value) + +Returns the type of `value`. + +Primitives are lowercase and object types are camelcase. + +Example: + +- `'undefined'` +- `'null'` +- `'string'` +- `'symbol'` +- `'Array'` +- `'Function'` +- `'Object'` + +Note: It will throw an error if you try to feed it object-wrapped primitives, as that's a bad practice. For example `new String('foo')`. + +### is.{method} + +All the below methods accept a value and returns a boolean for whether the value is of the desired type. + +#### Primitives + +##### .undefined(value) +##### .null(value) +##### .string(value) +##### .number(value) +##### .boolean(value) +##### .symbol(value) + +#### Built-in types + +##### .array(value) +##### .function(value) +##### .buffer(value) +##### .object(value) + +Keep in mind that [functions are objects too](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions). + +##### .numericString(value) + +Returns `true` for a string that represents a number. For example, `'42'` and `'-8'`. + +Note: `'NaN'` returns `false`, but `'Infinity'` and `'-Infinity'` return `true`. + +##### .regExp(value) +##### .date(value) +##### .error(value) +##### .nativePromise(value) +##### .promise(value) + +Returns `true` for any object with a `.then()` and `.catch()` method. Prefer this one over `.nativePromise()` as you usually want to allow userland promise implementations too. + +##### .generator(value) + +Returns `true` for any object that implements its own `.next()` and `.throw()` methods and has a function definition for `Symbol.iterator`. + +##### .generatorFunction(value) + +##### .asyncFunction(value) + +Returns `true` for any `async` function that can be called with the `await` operator. + +```js +is.asyncFunction(async () => {}); +// => true + +is.asyncFunction(() => {}); +// => false +``` + +##### .boundFunction(value) + +Returns `true` for any `bound` function. + +```js +is.boundFunction(() => {}); +// => true + +is.boundFunction(function () {}.bind(null)); +// => true + +is.boundFunction(function () {}); +// => false +``` + +##### .map(value) +##### .set(value) +##### .weakMap(value) +##### .weakSet(value) + +#### Typed arrays + +##### .int8Array(value) +##### .uint8Array(value) +##### .uint8ClampedArray(value) +##### .int16Array(value) +##### .uint16Array(value) +##### .int32Array(value) +##### .uint32Array(value) +##### .float32Array(value) +##### .float64Array(value) + +#### Structured data + +##### .arrayBuffer(value) +##### .sharedArrayBuffer(value) +##### .dataView(value) + +#### Emptiness + +##### .emptyString(value) + +Returns `true` if the value is a `string` and the `.length` is 0. + +##### .nonEmptyString(value) + +Returns `true` if the value is a `string` and the `.length` is more than 0. + +##### .emptyStringOrWhitespace(value) + +Returns `true` if `is.emptyString(value)` or if it's a `string` that is all whitespace. + +##### .emptyArray(value) + +Returns `true` if the value is an `Array` and the `.length` is 0. + +##### .nonEmptyArray(value) + +Returns `true` if the value is an `Array` and the `.length` is more than 0. + +##### .emptyObject(value) + +Returns `true` if the value is an `Object` and `Object.keys(value).length` is 0. + +Please note that `Object.keys` returns only own enumerable properties. Hence something like this can happen: + +```js +const object1 = {}; + +Object.defineProperty(object1, 'property1', { + value: 42, + writable: true, + enumerable: false, + configurable: true +}); + +is.emptyObject(object1); +// => true +``` + +##### .nonEmptyObject(value) + +Returns `true` if the value is an `Object` and `Object.keys(value).length` is more than 0. + +##### .emptySet(value) + +Returns `true` if the value is a `Set` and the `.size` is 0. + +##### .nonEmptySet(Value) + +Returns `true` if the value is a `Set` and the `.size` is more than 0. + +##### .emptyMap(value) + +Returns `true` if the value is a `Map` and the `.size` is 0. + +##### .nonEmptyMap(value) + +Returns `true` if the value is a `Map` and the `.size` is more than 0. + +#### Miscellaneous + +##### .directInstanceOf(value, class) + +Returns `true` if `value` is a direct instance of `class`. + +```js +is.directInstanceOf(new Error(), Error); +//=> true + +class UnicornError extends Error {} + +is.directInstanceOf(new UnicornError(), Error); +//=> false +``` + +##### .urlInstance(value) + +Returns `true` if `value` is an instance of the [`URL` class](https://developer.mozilla.org/en-US/docs/Web/API/URL). + +```js +const url = new URL('https://example.com'); + +is.urlInstance(url); +//=> true +``` + +### .url(value) + +Returns `true` if `value` is a URL string. + +Note: this only does basic checking using the [`URL` class](https://developer.mozilla.org/en-US/docs/Web/API/URL) constructor. + +```js +const url = 'https://example.com'; + +is.url(url); +//=> true + +is.url(new URL(url)); +//=> false +``` + +##### .truthy(value) + +Returns `true` for all values that evaluate to true in a boolean context: + +```js +is.truthy('🦄'); +//=> true + +is.truthy(undefined); +//=> false +``` + +##### .falsy(value) + +Returns `true` if `value` is one of: `false`, `0`, `''`, `null`, `undefined`, `NaN`. + +##### .nan(value) +##### .nullOrUndefined(value) +##### .primitive(value) + +JavaScript primitives are as follows: `null`, `undefined`, `string`, `number`, `boolean`, `symbol`. + +##### .integer(value) + +##### .safeInteger(value) + +Returns `true` if `value` is a [safe integer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger). + +##### .plainObject(value) + +An object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`. + +##### .iterable(value) +##### .asyncIterable(value) +##### .class(value) + +Returns `true` for instances created by a class. + +##### .typedArray(value) + +##### .arrayLike(value) + +A `value` is array-like if it is not a function and has a `value.length` that is a safe integer greater than or equal to 0. + +```js +is.arrayLike(document.forms); +//=> true + +function foo() { + is.arrayLike(arguments); + //=> true +} +foo(); +``` + +##### .inRange(value, range) + +Check if `value` (number) is in the given `range`. The range is an array of two values, lower bound and upper bound, in no specific order. + +```js +is.inRange(3, [0, 5]); +is.inRange(3, [5, 0]); +is.inRange(0, [-2, 2]); +``` + +##### .inRange(value, upperBound) + +Check if `value` (number) is in the range of `0` to `upperBound`. + +```js +is.inRange(3, 10); +``` + +##### .domElement(value) + +Returns `true` if `value` is a DOM Element. + +##### .nodeStream(value) + +Returns `true` if `value` is a Node.js [stream](https://nodejs.org/api/stream.html). + +```js +const fs = require('fs'); + +is.nodeStream(fs.createReadStream('unicorn.png')); +//=> true +``` + +##### .observable(value) + +Returns `true` if `value` is an `Observable`. + +```js +const {Observable} = require('rxjs'); + +is.observable(new Observable()); +//=> true +``` + +##### .infinite(value) + +Check if `value` is `Infinity` or `-Infinity`. + +##### .even(value) + +Returns `true` if `value` is an even integer. + +##### .odd(value) + +Returns `true` if `value` is an odd integer. + +##### .any(predicate, ...values) + +Returns `true` if **any** of the input `values` returns true in the `predicate`: + +```js +is.any(is.string, {}, true, '🦄'); +//=> true + +is.any(is.boolean, 'unicorns', [], new Map()); +//=> false +``` + +##### .all(predicate, ...values) + +Returns `true` if **all** of the input `values` returns true in the `predicate`: + +```js +is.all(is.object, {}, new Map(), new Set()); +//=> true + +is.all(is.string, '🦄', [], 'unicorns'); +//=> false +``` + + +## FAQ + +### Why yet another type checking module? + +There are hundreds of type checking modules on npm, unfortunately, I couldn't find any that fit my needs: + +- Includes both type methods and ability to get the type +- Types of primitives returned as lowercase and object types as camelcase +- Covers all built-ins +- Unsurprising behavior +- Well-maintained +- Comprehensive test suite + +For the ones I found, pick 3 of these. + +The most common mistakes I noticed in these modules was using `instanceof` for type checking, forgetting that functions are objects, and omitting `symbol` as a primitive. + + +## Related + +- [ow](https://github.com/sindresorhus/ow) - Function argument validation for humans +- [is-stream](https://github.com/sindresorhus/is-stream) - Check if something is a Node.js stream +- [is-observable](https://github.com/sindresorhus/is-observable) - Check if a value is an Observable +- [file-type](https://github.com/sindresorhus/file-type) - Detect the file type of a Buffer/Uint8Array +- [is-ip](https://github.com/sindresorhus/is-ip) - Check if a string is an IP address +- [is-array-sorted](https://github.com/sindresorhus/is-array-sorted) - Check if an Array is sorted +- [is-error-constructor](https://github.com/sindresorhus/is-error-constructor) - Check if a value is an error constructor +- [is-empty-iterable](https://github.com/sindresorhus/is-empty-iterable) - Check if an Iterable is empty +- [is-blob](https://github.com/sindresorhus/is-blob) - Check if a value is a Blob - File-like object of immutable, raw data +- [has-emoji](https://github.com/sindresorhus/has-emoji) - Check whether a string has any emoji + + +## Created by + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Giora Guttsait](https://github.com/gioragutt) +- [Brandon Smith](https://github.com/brandon93s) + + +## License + +MIT diff --git a/server/node_modules/@szmarczak/http-timer/LICENSE b/server/node_modules/@szmarczak/http-timer/LICENSE new file mode 100755 index 0000000..15ad2e8 --- /dev/null +++ b/server/node_modules/@szmarczak/http-timer/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Szymon Marczak + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/server/node_modules/@szmarczak/http-timer/README.md b/server/node_modules/@szmarczak/http-timer/README.md new file mode 100755 index 0000000..13279ed --- /dev/null +++ b/server/node_modules/@szmarczak/http-timer/README.md @@ -0,0 +1,70 @@ +# http-timer +> Timings for HTTP requests + +[![Build Status](https://travis-ci.org/szmarczak/http-timer.svg?branch=master)](https://travis-ci.org/szmarczak/http-timer) +[![Coverage Status](https://coveralls.io/repos/github/szmarczak/http-timer/badge.svg?branch=master)](https://coveralls.io/github/szmarczak/http-timer?branch=master) +[![install size](https://packagephobia.now.sh/badge?p=@szmarczak/http-timer)](https://packagephobia.now.sh/result?p=@szmarczak/http-timer) + +Inspired by the [`request` package](https://github.com/request/request). + +## Usage +```js +'use strict'; +const https = require('https'); +const timer = require('@szmarczak/http-timer'); + +const request = https.get('https://httpbin.org/anything'); +const timings = timer(request); + +request.on('response', response => { + response.on('data', () => {}); // Consume the data somehow + response.on('end', () => { + console.log(timings); + }); +}); + +// { start: 1535708511443, +// socket: 1535708511444, +// lookup: 1535708511444, +// connect: 1535708511582, +// upload: 1535708511887, +// response: 1535708512037, +// end: 1535708512040, +// phases: +// { wait: 1, +// dns: 0, +// tcp: 138, +// request: 305, +// firstByte: 150, +// download: 3, +// total: 597 } } +``` + +## API + +### timer(request) + +Returns: `Object` + +- `start` - Time when the request started. +- `socket` - Time when a socket was assigned to the request. +- `lookup` - Time when the DNS lookup finished. +- `connect` - Time when the socket successfully connected. +- `upload` - Time when the request finished uploading. +- `response` - Time when the request fired the `response` event. +- `end` - Time when the response fired the `end` event. +- `error` - Time when the request fired the `error` event. +- `phases` + - `wait` - `timings.socket - timings.start` + - `dns` - `timings.lookup - timings.socket` + - `tcp` - `timings.connect - timings.lookup` + - `request` - `timings.upload - timings.connect` + - `firstByte` - `timings.response - timings.upload` + - `download` - `timings.end - timings.response` + - `total` - `timings.end - timings.start` or `timings.error - timings.start` + +**Note**: The time is a `number` representing the milliseconds elapsed since the UNIX epoch. + +## License + +MIT diff --git a/server/node_modules/@szmarczak/http-timer/package.json b/server/node_modules/@szmarczak/http-timer/package.json new file mode 100755 index 0000000..2c3c16a --- /dev/null +++ b/server/node_modules/@szmarczak/http-timer/package.json @@ -0,0 +1,75 @@ +{ + "_from": "@szmarczak/http-timer@^1.1.2", + "_id": "@szmarczak/http-timer@1.1.2", + "_inBundle": false, + "_integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "_location": "/@szmarczak/http-timer", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@szmarczak/http-timer@^1.1.2", + "name": "@szmarczak/http-timer", + "escapedName": "@szmarczak%2fhttp-timer", + "scope": "@szmarczak", + "rawSpec": "^1.1.2", + "saveSpec": null, + "fetchSpec": "^1.1.2" + }, + "_requiredBy": [ + "/got" + ], + "_resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "_shasum": "b1665e2c461a2cd92f4c1bbf50d5454de0d4b421", + "_spec": "@szmarczak/http-timer@^1.1.2", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/got", + "author": { + "name": "Szymon Marczak" + }, + "bugs": { + "url": "https://github.com/szmarczak/http-timer/issues" + }, + "bundleDependencies": false, + "dependencies": { + "defer-to-connect": "^1.0.1" + }, + "deprecated": false, + "description": "Timings for HTTP requests", + "devDependencies": { + "ava": "^0.25.0", + "coveralls": "^3.0.2", + "nyc": "^12.0.2", + "p-event": "^2.1.0", + "xo": "^0.22.0" + }, + "engines": { + "node": ">=6" + }, + "files": [ + "source" + ], + "homepage": "https://github.com/szmarczak/http-timer#readme", + "keywords": [ + "http", + "https", + "timer", + "timings" + ], + "license": "MIT", + "main": "source", + "name": "@szmarczak/http-timer", + "repository": { + "type": "git", + "url": "git+https://github.com/szmarczak/http-timer.git" + }, + "scripts": { + "coveralls": "nyc report --reporter=text-lcov | coveralls", + "test": "xo && nyc ava" + }, + "version": "1.1.2", + "xo": { + "rules": { + "unicorn/filename-case": "camelCase" + } + } +} diff --git a/server/node_modules/@szmarczak/http-timer/source/index.js b/server/node_modules/@szmarczak/http-timer/source/index.js new file mode 100755 index 0000000..e294580 --- /dev/null +++ b/server/node_modules/@szmarczak/http-timer/source/index.js @@ -0,0 +1,99 @@ +'use strict'; +const deferToConnect = require('defer-to-connect'); + +module.exports = request => { + const timings = { + start: Date.now(), + socket: null, + lookup: null, + connect: null, + upload: null, + response: null, + end: null, + error: null, + phases: { + wait: null, + dns: null, + tcp: null, + request: null, + firstByte: null, + download: null, + total: null + } + }; + + const handleError = origin => { + const emit = origin.emit.bind(origin); + origin.emit = (event, ...args) => { + // Catches the `error` event + if (event === 'error') { + timings.error = Date.now(); + timings.phases.total = timings.error - timings.start; + + origin.emit = emit; + } + + // Saves the original behavior + return emit(event, ...args); + }; + }; + + let uploadFinished = false; + const onUpload = () => { + timings.upload = Date.now(); + timings.phases.request = timings.upload - timings.connect; + }; + + handleError(request); + + request.once('socket', socket => { + timings.socket = Date.now(); + timings.phases.wait = timings.socket - timings.start; + + const lookupListener = () => { + timings.lookup = Date.now(); + timings.phases.dns = timings.lookup - timings.socket; + }; + + socket.once('lookup', lookupListener); + + deferToConnect(socket, () => { + timings.connect = Date.now(); + + if (timings.lookup === null) { + socket.removeListener('lookup', lookupListener); + timings.lookup = timings.connect; + timings.phases.dns = timings.lookup - timings.socket; + } + + timings.phases.tcp = timings.connect - timings.lookup; + + if (uploadFinished && !timings.upload) { + onUpload(); + } + }); + }); + + request.once('finish', () => { + uploadFinished = true; + + if (timings.connect) { + onUpload(); + } + }); + + request.once('response', response => { + timings.response = Date.now(); + timings.phases.firstByte = timings.response - timings.upload; + + handleError(response); + + response.once('end', () => { + timings.end = Date.now(); + timings.phases.download = timings.end - timings.response; + timings.phases.total = timings.end - timings.start; + }); + }); + + return timings; +}; diff --git a/server/node_modules/abbrev/LICENSE b/server/node_modules/abbrev/LICENSE new file mode 100644 index 0000000..9bcfa9d --- /dev/null +++ b/server/node_modules/abbrev/LICENSE @@ -0,0 +1,46 @@ +This software is dual-licensed under the ISC and MIT licenses. +You may use this software under EITHER of the following licenses. + +---------- + +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +---------- + +Copyright Isaac Z. Schlueter and Contributors +All rights reserved. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/abbrev/README.md b/server/node_modules/abbrev/README.md new file mode 100644 index 0000000..99746fe --- /dev/null +++ b/server/node_modules/abbrev/README.md @@ -0,0 +1,23 @@ +# abbrev-js + +Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev). + +Usage: + + var abbrev = require("abbrev"); + abbrev("foo", "fool", "folding", "flop"); + + // returns: + { fl: 'flop' + , flo: 'flop' + , flop: 'flop' + , fol: 'folding' + , fold: 'folding' + , foldi: 'folding' + , foldin: 'folding' + , folding: 'folding' + , foo: 'foo' + , fool: 'fool' + } + +This is handy for command-line scripts, or other cases where you want to be able to accept shorthands. diff --git a/server/node_modules/abbrev/abbrev.js b/server/node_modules/abbrev/abbrev.js new file mode 100644 index 0000000..7b1dc5d --- /dev/null +++ b/server/node_modules/abbrev/abbrev.js @@ -0,0 +1,61 @@ +module.exports = exports = abbrev.abbrev = abbrev + +abbrev.monkeyPatch = monkeyPatch + +function monkeyPatch () { + Object.defineProperty(Array.prototype, 'abbrev', { + value: function () { return abbrev(this) }, + enumerable: false, configurable: true, writable: true + }) + + Object.defineProperty(Object.prototype, 'abbrev', { + value: function () { return abbrev(Object.keys(this)) }, + enumerable: false, configurable: true, writable: true + }) +} + +function abbrev (list) { + if (arguments.length !== 1 || !Array.isArray(list)) { + list = Array.prototype.slice.call(arguments, 0) + } + for (var i = 0, l = list.length, args = [] ; i < l ; i ++) { + args[i] = typeof list[i] === "string" ? list[i] : String(list[i]) + } + + // sort them lexicographically, so that they're next to their nearest kin + args = args.sort(lexSort) + + // walk through each, seeing how much it has in common with the next and previous + var abbrevs = {} + , prev = "" + for (var i = 0, l = args.length ; i < l ; i ++) { + var current = args[i] + , next = args[i + 1] || "" + , nextMatches = true + , prevMatches = true + if (current === next) continue + for (var j = 0, cl = current.length ; j < cl ; j ++) { + var curChar = current.charAt(j) + nextMatches = nextMatches && curChar === next.charAt(j) + prevMatches = prevMatches && curChar === prev.charAt(j) + if (!nextMatches && !prevMatches) { + j ++ + break + } + } + prev = current + if (j === cl) { + abbrevs[current] = current + continue + } + for (var a = current.substr(0, j) ; j <= cl ; j ++) { + abbrevs[a] = current + a += current.charAt(j) + } + } + return abbrevs +} + +function lexSort (a, b) { + return a === b ? 0 : a > b ? 1 : -1 +} diff --git a/server/node_modules/abbrev/package.json b/server/node_modules/abbrev/package.json new file mode 100644 index 0000000..a05f7b9 --- /dev/null +++ b/server/node_modules/abbrev/package.json @@ -0,0 +1,56 @@ +{ + "_from": "abbrev@1", + "_id": "abbrev@1.1.1", + "_inBundle": false, + "_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "_location": "/abbrev", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "abbrev@1", + "name": "abbrev", + "escapedName": "abbrev", + "rawSpec": "1", + "saveSpec": null, + "fetchSpec": "1" + }, + "_requiredBy": [ + "/nopt" + ], + "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "_shasum": "f8f2c887ad10bf67f634f005b6987fed3179aac8", + "_spec": "abbrev@1", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/nopt", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me" + }, + "bugs": { + "url": "https://github.com/isaacs/abbrev-js/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Like ruby's abbrev module, but in js", + "devDependencies": { + "tap": "^10.1" + }, + "files": [ + "abbrev.js" + ], + "homepage": "https://github.com/isaacs/abbrev-js#readme", + "license": "ISC", + "main": "abbrev.js", + "name": "abbrev", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/isaacs/abbrev-js.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test.js --100" + }, + "version": "1.1.1" +} diff --git a/server/node_modules/accepts/HISTORY.md b/server/node_modules/accepts/HISTORY.md new file mode 100644 index 0000000..0bf0417 --- /dev/null +++ b/server/node_modules/accepts/HISTORY.md @@ -0,0 +1,236 @@ +1.3.7 / 2019-04-29 +================== + + * deps: negotiator@0.6.2 + - Fix sorting charset, encoding, and language with extra parameters + +1.3.6 / 2019-04-28 +================== + + * deps: mime-types@~2.1.24 + - deps: mime-db@~1.40.0 + +1.3.5 / 2018-02-28 +================== + + * deps: mime-types@~2.1.18 + - deps: mime-db@~1.33.0 + +1.3.4 / 2017-08-22 +================== + + * deps: mime-types@~2.1.16 + - deps: mime-db@~1.29.0 + +1.3.3 / 2016-05-02 +================== + + * deps: mime-types@~2.1.11 + - deps: mime-db@~1.23.0 + * deps: negotiator@0.6.1 + - perf: improve `Accept` parsing speed + - perf: improve `Accept-Charset` parsing speed + - perf: improve `Accept-Encoding` parsing speed + - perf: improve `Accept-Language` parsing speed + +1.3.2 / 2016-03-08 +================== + + * deps: mime-types@~2.1.10 + - Fix extension of `application/dash+xml` + - Update primary extension for `audio/mp4` + - deps: mime-db@~1.22.0 + +1.3.1 / 2016-01-19 +================== + + * deps: mime-types@~2.1.9 + - deps: mime-db@~1.21.0 + +1.3.0 / 2015-09-29 +================== + + * deps: mime-types@~2.1.7 + - deps: mime-db@~1.19.0 + * deps: negotiator@0.6.0 + - Fix including type extensions in parameters in `Accept` parsing + - Fix parsing `Accept` parameters with quoted equals + - Fix parsing `Accept` parameters with quoted semicolons + - Lazy-load modules from main entry point + - perf: delay type concatenation until needed + - perf: enable strict mode + - perf: hoist regular expressions + - perf: remove closures getting spec properties + - perf: remove a closure from media type parsing + - perf: remove property delete from media type parsing + +1.2.13 / 2015-09-06 +=================== + + * deps: mime-types@~2.1.6 + - deps: mime-db@~1.18.0 + +1.2.12 / 2015-07-30 +=================== + + * deps: mime-types@~2.1.4 + - deps: mime-db@~1.16.0 + +1.2.11 / 2015-07-16 +=================== + + * deps: mime-types@~2.1.3 + - deps: mime-db@~1.15.0 + +1.2.10 / 2015-07-01 +=================== + + * deps: mime-types@~2.1.2 + - deps: mime-db@~1.14.0 + +1.2.9 / 2015-06-08 +================== + + * deps: mime-types@~2.1.1 + - perf: fix deopt during mapping + +1.2.8 / 2015-06-07 +================== + + * deps: mime-types@~2.1.0 + - deps: mime-db@~1.13.0 + * perf: avoid argument reassignment & argument slice + * perf: avoid negotiator recursive construction + * perf: enable strict mode + * perf: remove unnecessary bitwise operator + +1.2.7 / 2015-05-10 +================== + + * deps: negotiator@0.5.3 + - Fix media type parameter matching to be case-insensitive + +1.2.6 / 2015-05-07 +================== + + * deps: mime-types@~2.0.11 + - deps: mime-db@~1.9.1 + * deps: negotiator@0.5.2 + - Fix comparing media types with quoted values + - Fix splitting media types with quoted commas + +1.2.5 / 2015-03-13 +================== + + * deps: mime-types@~2.0.10 + - deps: mime-db@~1.8.0 + +1.2.4 / 2015-02-14 +================== + + * Support Node.js 0.6 + * deps: mime-types@~2.0.9 + - deps: mime-db@~1.7.0 + * deps: negotiator@0.5.1 + - Fix preference sorting to be stable for long acceptable lists + +1.2.3 / 2015-01-31 +================== + + * deps: mime-types@~2.0.8 + - deps: mime-db@~1.6.0 + +1.2.2 / 2014-12-30 +================== + + * deps: mime-types@~2.0.7 + - deps: mime-db@~1.5.0 + +1.2.1 / 2014-12-30 +================== + + * deps: mime-types@~2.0.5 + - deps: mime-db@~1.3.1 + +1.2.0 / 2014-12-19 +================== + + * deps: negotiator@0.5.0 + - Fix list return order when large accepted list + - Fix missing identity encoding when q=0 exists + - Remove dynamic building of Negotiator class + +1.1.4 / 2014-12-10 +================== + + * deps: mime-types@~2.0.4 + - deps: mime-db@~1.3.0 + +1.1.3 / 2014-11-09 +================== + + * deps: mime-types@~2.0.3 + - deps: mime-db@~1.2.0 + +1.1.2 / 2014-10-14 +================== + + * deps: negotiator@0.4.9 + - Fix error when media type has invalid parameter + +1.1.1 / 2014-09-28 +================== + + * deps: mime-types@~2.0.2 + - deps: mime-db@~1.1.0 + * deps: negotiator@0.4.8 + - Fix all negotiations to be case-insensitive + - Stable sort preferences of same quality according to client order + +1.1.0 / 2014-09-02 +================== + + * update `mime-types` + +1.0.7 / 2014-07-04 +================== + + * Fix wrong type returned from `type` when match after unknown extension + +1.0.6 / 2014-06-24 +================== + + * deps: negotiator@0.4.7 + +1.0.5 / 2014-06-20 +================== + + * fix crash when unknown extension given + +1.0.4 / 2014-06-19 +================== + + * use `mime-types` + +1.0.3 / 2014-06-11 +================== + + * deps: negotiator@0.4.6 + - Order by specificity when quality is the same + +1.0.2 / 2014-05-29 +================== + + * Fix interpretation when header not in request + * deps: pin negotiator@0.4.5 + +1.0.1 / 2014-01-18 +================== + + * Identity encoding isn't always acceptable + * deps: negotiator@~0.4.0 + +1.0.0 / 2013-12-27 +================== + + * Genesis diff --git a/server/node_modules/accepts/LICENSE b/server/node_modules/accepts/LICENSE new file mode 100644 index 0000000..0616607 --- /dev/null +++ b/server/node_modules/accepts/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/accepts/README.md b/server/node_modules/accepts/README.md new file mode 100644 index 0000000..66a2f54 --- /dev/null +++ b/server/node_modules/accepts/README.md @@ -0,0 +1,142 @@ +# accepts + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator). +Extracted from [koa](https://www.npmjs.com/package/koa) for general use. + +In addition to negotiator, it allows: + +- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])` + as well as `('text/html', 'application/json')`. +- Allows type shorthands such as `json`. +- Returns `false` when no types match +- Treats non-existent headers as `*` + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install accepts +``` + +## API + + + +```js +var accepts = require('accepts') +``` + +### accepts(req) + +Create a new `Accepts` object for the given `req`. + +#### .charset(charsets) + +Return the first accepted charset. If nothing in `charsets` is accepted, +then `false` is returned. + +#### .charsets() + +Return the charsets that the request accepts, in the order of the client's +preference (most preferred first). + +#### .encoding(encodings) + +Return the first accepted encoding. If nothing in `encodings` is accepted, +then `false` is returned. + +#### .encodings() + +Return the encodings that the request accepts, in the order of the client's +preference (most preferred first). + +#### .language(languages) + +Return the first accepted language. If nothing in `languages` is accepted, +then `false` is returned. + +#### .languages() + +Return the languages that the request accepts, in the order of the client's +preference (most preferred first). + +#### .type(types) + +Return the first accepted type (and it is returned as the same text as what +appears in the `types` array). If nothing in `types` is accepted, then `false` +is returned. + +The `types` array can contain full MIME types or file extensions. Any value +that is not a full MIME types is passed to `require('mime-types').lookup`. + +#### .types() + +Return the types that the request accepts, in the order of the client's +preference (most preferred first). + +## Examples + +### Simple type negotiation + +This simple example shows how to use `accepts` to return a different typed +respond body based on what the client wants to accept. The server lists it's +preferences in order and will get back the best match between the client and +server. + +```js +var accepts = require('accepts') +var http = require('http') + +function app (req, res) { + var accept = accepts(req) + + // the order of this list is significant; should be server preferred order + switch (accept.type(['json', 'html'])) { + case 'json': + res.setHeader('Content-Type', 'application/json') + res.write('{"hello":"world!"}') + break + case 'html': + res.setHeader('Content-Type', 'text/html') + res.write('hello, world!') + break + default: + // the fallback is text/plain, so no need to specify it above + res.setHeader('Content-Type', 'text/plain') + res.write('hello, world!') + break + } + + res.end() +} + +http.createServer(app).listen(3000) +``` + +You can test this out with the cURL program: +```sh +curl -I -H'Accept: text/html' http://localhost:3000/ +``` + +## License + +[MIT](LICENSE) + +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master +[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master +[node-version-image]: https://badgen.net/npm/node/accepts +[node-version-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/accepts +[npm-url]: https://npmjs.org/package/accepts +[npm-version-image]: https://badgen.net/npm/v/accepts +[travis-image]: https://badgen.net/travis/jshttp/accepts/master +[travis-url]: https://travis-ci.org/jshttp/accepts diff --git a/server/node_modules/accepts/index.js b/server/node_modules/accepts/index.js new file mode 100644 index 0000000..e9b2f63 --- /dev/null +++ b/server/node_modules/accepts/index.js @@ -0,0 +1,238 @@ +/*! + * accepts + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var Negotiator = require('negotiator') +var mime = require('mime-types') + +/** + * Module exports. + * @public + */ + +module.exports = Accepts + +/** + * Create a new Accepts object for the given req. + * + * @param {object} req + * @public + */ + +function Accepts (req) { + if (!(this instanceof Accepts)) { + return new Accepts(req) + } + + this.headers = req.headers + this.negotiator = new Negotiator(req) +} + +/** + * Check if the given `type(s)` is acceptable, returning + * the best match when true, otherwise `undefined`, in which + * case you should respond with 406 "Not Acceptable". + * + * The `type` value may be a single mime type string + * such as "application/json", the extension name + * such as "json" or an array `["json", "html", "text/plain"]`. When a list + * or array is given the _best_ match, if any is returned. + * + * Examples: + * + * // Accept: text/html + * this.types('html'); + * // => "html" + * + * // Accept: text/*, application/json + * this.types('html'); + * // => "html" + * this.types('text/html'); + * // => "text/html" + * this.types('json', 'text'); + * // => "json" + * this.types('application/json'); + * // => "application/json" + * + * // Accept: text/*, application/json + * this.types('image/png'); + * this.types('png'); + * // => undefined + * + * // Accept: text/*;q=.5, application/json + * this.types(['html', 'json']); + * this.types('html', 'json'); + * // => "json" + * + * @param {String|Array} types... + * @return {String|Array|Boolean} + * @public + */ + +Accepts.prototype.type = +Accepts.prototype.types = function (types_) { + var types = types_ + + // support flattened arguments + if (types && !Array.isArray(types)) { + types = new Array(arguments.length) + for (var i = 0; i < types.length; i++) { + types[i] = arguments[i] + } + } + + // no types, return all requested types + if (!types || types.length === 0) { + return this.negotiator.mediaTypes() + } + + // no accept header, return first given type + if (!this.headers.accept) { + return types[0] + } + + var mimes = types.map(extToMime) + var accepts = this.negotiator.mediaTypes(mimes.filter(validMime)) + var first = accepts[0] + + return first + ? types[mimes.indexOf(first)] + : false +} + +/** + * Return accepted encodings or best fit based on `encodings`. + * + * Given `Accept-Encoding: gzip, deflate` + * an array sorted by quality is returned: + * + * ['gzip', 'deflate'] + * + * @param {String|Array} encodings... + * @return {String|Array} + * @public + */ + +Accepts.prototype.encoding = +Accepts.prototype.encodings = function (encodings_) { + var encodings = encodings_ + + // support flattened arguments + if (encodings && !Array.isArray(encodings)) { + encodings = new Array(arguments.length) + for (var i = 0; i < encodings.length; i++) { + encodings[i] = arguments[i] + } + } + + // no encodings, return all requested encodings + if (!encodings || encodings.length === 0) { + return this.negotiator.encodings() + } + + return this.negotiator.encodings(encodings)[0] || false +} + +/** + * Return accepted charsets or best fit based on `charsets`. + * + * Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5` + * an array sorted by quality is returned: + * + * ['utf-8', 'utf-7', 'iso-8859-1'] + * + * @param {String|Array} charsets... + * @return {String|Array} + * @public + */ + +Accepts.prototype.charset = +Accepts.prototype.charsets = function (charsets_) { + var charsets = charsets_ + + // support flattened arguments + if (charsets && !Array.isArray(charsets)) { + charsets = new Array(arguments.length) + for (var i = 0; i < charsets.length; i++) { + charsets[i] = arguments[i] + } + } + + // no charsets, return all requested charsets + if (!charsets || charsets.length === 0) { + return this.negotiator.charsets() + } + + return this.negotiator.charsets(charsets)[0] || false +} + +/** + * Return accepted languages or best fit based on `langs`. + * + * Given `Accept-Language: en;q=0.8, es, pt` + * an array sorted by quality is returned: + * + * ['es', 'pt', 'en'] + * + * @param {String|Array} langs... + * @return {Array|String} + * @public + */ + +Accepts.prototype.lang = +Accepts.prototype.langs = +Accepts.prototype.language = +Accepts.prototype.languages = function (languages_) { + var languages = languages_ + + // support flattened arguments + if (languages && !Array.isArray(languages)) { + languages = new Array(arguments.length) + for (var i = 0; i < languages.length; i++) { + languages[i] = arguments[i] + } + } + + // no languages, return all requested languages + if (!languages || languages.length === 0) { + return this.negotiator.languages() + } + + return this.negotiator.languages(languages)[0] || false +} + +/** + * Convert extnames to mime. + * + * @param {String} type + * @return {String} + * @private + */ + +function extToMime (type) { + return type.indexOf('/') === -1 + ? mime.lookup(type) + : type +} + +/** + * Check if mime is valid. + * + * @param {String} type + * @return {String} + * @private + */ + +function validMime (type) { + return typeof type === 'string' +} diff --git a/server/node_modules/accepts/package.json b/server/node_modules/accepts/package.json new file mode 100644 index 0000000..c5dbae8 --- /dev/null +++ b/server/node_modules/accepts/package.json @@ -0,0 +1,86 @@ +{ + "_from": "accepts@~1.3.7", + "_id": "accepts@1.3.7", + "_inBundle": false, + "_integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "_location": "/accepts", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "accepts@~1.3.7", + "name": "accepts", + "escapedName": "accepts", + "rawSpec": "~1.3.7", + "saveSpec": null, + "fetchSpec": "~1.3.7" + }, + "_requiredBy": [ + "/express" + ], + "_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "_shasum": "531bc726517a3b2b41f850021c6cc15eaab507cd", + "_spec": "accepts@~1.3.7", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/express", + "bugs": { + "url": "https://github.com/jshttp/accepts/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com" + } + ], + "dependencies": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + }, + "deprecated": false, + "description": "Higher-level content negotiation", + "devDependencies": { + "deep-equal": "1.0.1", + "eslint": "5.16.0", + "eslint-config-standard": "12.0.0", + "eslint-plugin-import": "2.17.2", + "eslint-plugin-markdown": "1.0.0", + "eslint-plugin-node": "8.0.1", + "eslint-plugin-promise": "4.1.1", + "eslint-plugin-standard": "4.0.0", + "mocha": "6.1.4", + "nyc": "14.0.0" + }, + "engines": { + "node": ">= 0.6" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "index.js" + ], + "homepage": "https://github.com/jshttp/accepts#readme", + "keywords": [ + "content", + "negotiation", + "accept", + "accepts" + ], + "license": "MIT", + "name": "accepts", + "repository": { + "type": "git", + "url": "git+https://github.com/jshttp/accepts.git" + }, + "scripts": { + "lint": "eslint --plugin markdown --ext js,md ", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "test-travis": "nyc --reporter=text npm test" + }, + "version": "1.3.7" +} diff --git a/server/node_modules/ansi-align/CHANGELOG.md b/server/node_modules/ansi-align/CHANGELOG.md new file mode 100644 index 0000000..36eeb52 --- /dev/null +++ b/server/node_modules/ansi-align/CHANGELOG.md @@ -0,0 +1,58 @@ +# Changelog + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +### [3.0.1](https://github.com/nexdrew/ansi-align/compare/v3.0.0...v3.0.1) (2021-09-27) + + +### Bug Fixes + +* **package:** update string-width to version 4.1.0 ([#52](https://github.com/nexdrew/ansi-align/issues/52)) ([ab5b733](https://github.com/nexdrew/ansi-align/commit/ab5b733b1c30eef87b75e15459f2216db28d7ed3)) + + +# [3.0.0](https://github.com/nexdrew/ansi-align/compare/v2.0.0...v3.0.0) (2018-12-17) + + +### Bug Fixes + +* **package:** update string-width to version 3.0.0 ([#50](https://github.com/nexdrew/ansi-align/issues/50)) ([67f0d8f](https://github.com/nexdrew/ansi-align/commit/67f0d8f)) + + +### BREAKING CHANGES + +* **package:** Node 4 no longer supported, please update to Node 6+ or use ansi-align@2.0.0 + + + + +# [2.0.0](https://github.com/nexdrew/ansi-align/compare/v1.1.0...v2.0.0) (2017-05-01) + + +### Features + +* ES2015ify, dropping support for Node <4 ([#30](https://github.com/nexdrew/ansi-align/issues/30)) ([7b43f48](https://github.com/nexdrew/ansi-align/commit/7b43f48)) + + +### BREAKING CHANGES + +* Node 0.10 or 0.12 no longer supported, please update to Node 4+ or use ansi-align@1.1.0 + + + + +# [1.1.0](https://github.com/nexdrew/ansi-align/compare/v1.0.0...v1.1.0) (2016-06-06) + + +### Features + +* support left-alignment as no-op ([#3](https://github.com/nexdrew/ansi-align/issues/3)) ([e581db6](https://github.com/nexdrew/ansi-align/commit/e581db6)) + + + + +# 1.0.0 (2016-04-30) + + +### Features + +* initial commit ([1914d90](https://github.com/nexdrew/ansi-align/commit/1914d90)) diff --git a/server/node_modules/ansi-align/LICENSE b/server/node_modules/ansi-align/LICENSE new file mode 100644 index 0000000..ab601b6 --- /dev/null +++ b/server/node_modules/ansi-align/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2016, Contributors + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/server/node_modules/ansi-align/README.md b/server/node_modules/ansi-align/README.md new file mode 100644 index 0000000..5e51682 --- /dev/null +++ b/server/node_modules/ansi-align/README.md @@ -0,0 +1,80 @@ +# ansi-align + +> align-text with ANSI support for CLIs + +[![Build Status](https://travis-ci.org/nexdrew/ansi-align.svg?branch=master)](https://travis-ci.org/nexdrew/ansi-align) +[![Coverage Status](https://coveralls.io/repos/github/nexdrew/ansi-align/badge.svg?branch=master)](https://coveralls.io/github/nexdrew/ansi-align?branch=master) +[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version) +[![Greenkeeper badge](https://badges.greenkeeper.io/nexdrew/ansi-align.svg)](https://greenkeeper.io/) + +Easily center- or right- align a block of text, carefully ignoring ANSI escape codes. + +E.g. turn this: + +ansi text block no alignment :( + +Into this: + +ansi text block center aligned! + +## Install + +```sh +npm install --save ansi-align +``` + +```js +var ansiAlign = require('ansi-align') +``` + +## API + +### `ansiAlign(text, [opts])` + +Align the given text per the line with the greatest [`string-width`](https://github.com/sindresorhus/string-width), returning a new string (or array). + +#### Arguments + +- `text`: required, string or array + + The text to align. If a string is given, it will be split using either the `opts.split` value or `'\n'` by default. If an array is given, a different array of modified strings will be returned. + +- `opts`: optional, object + + Options to change behavior, see below. + +#### Options + +- `opts.align`: string, default `'center'` + + The alignment mode. Use `'center'` for center-alignment, `'right'` for right-alignment, or `'left'` for left-alignment. Note that the given `text` is assumed to be left-aligned already, so specifying `align: 'left'` just returns the `text` as is (no-op). + +- `opts.split`: string or RegExp, default `'\n'` + + The separator to use when splitting the text. Only used if text is given as a string. + +- `opts.pad`: string, default `' '` + + The value used to left-pad (prepend to) lines of lesser width. Will be repeated as necessary to adjust alignment to the line with the greatest width. + +### `ansiAlign.center(text)` + +Alias for `ansiAlign(text, { align: 'center' })`. + +### `ansiAlign.right(text)` + +Alias for `ansiAlign(text, { align: 'right' })`. + +### `ansiAlign.left(text)` + +Alias for `ansiAlign(text, { align: 'left' })`, which is a no-op. + +## Similar Packages + +- [`center-align`](https://github.com/jonschlinkert/center-align): Very close to this package, except it doesn't support ANSI codes. +- [`left-pad`](https://github.com/camwest/left-pad): Great for left-padding but does not support center alignment or ANSI codes. +- Pretty much anything by the [chalk](https://github.com/chalk) team + +## License + +ISC © Contributors diff --git a/server/node_modules/ansi-align/index.js b/server/node_modules/ansi-align/index.js new file mode 100644 index 0000000..67fa826 --- /dev/null +++ b/server/node_modules/ansi-align/index.js @@ -0,0 +1,61 @@ +'use strict' + +const stringWidth = require('string-width') + +function ansiAlign (text, opts) { + if (!text) return text + + opts = opts || {} + const align = opts.align || 'center' + + // short-circuit `align: 'left'` as no-op + if (align === 'left') return text + + const split = opts.split || '\n' + const pad = opts.pad || ' ' + const widthDiffFn = align !== 'right' ? halfDiff : fullDiff + + let returnString = false + if (!Array.isArray(text)) { + returnString = true + text = String(text).split(split) + } + + let width + let maxWidth = 0 + text = text.map(function (str) { + str = String(str) + width = stringWidth(str) + maxWidth = Math.max(width, maxWidth) + return { + str, + width + } + }).map(function (obj) { + return new Array(widthDiffFn(maxWidth, obj.width) + 1).join(pad) + obj.str + }) + + return returnString ? text.join(split) : text +} + +ansiAlign.left = function left (text) { + return ansiAlign(text, { align: 'left' }) +} + +ansiAlign.center = function center (text) { + return ansiAlign(text, { align: 'center' }) +} + +ansiAlign.right = function right (text) { + return ansiAlign(text, { align: 'right' }) +} + +module.exports = ansiAlign + +function halfDiff (maxWidth, curWidth) { + return Math.floor((maxWidth - curWidth) / 2) +} + +function fullDiff (maxWidth, curWidth) { + return maxWidth - curWidth +} diff --git a/server/node_modules/ansi-align/package.json b/server/node_modules/ansi-align/package.json new file mode 100644 index 0000000..ee1aaa1 --- /dev/null +++ b/server/node_modules/ansi-align/package.json @@ -0,0 +1,70 @@ +{ + "_from": "ansi-align@^3.0.0", + "_id": "ansi-align@3.0.1", + "_inBundle": false, + "_integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "_location": "/ansi-align", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ansi-align@^3.0.0", + "name": "ansi-align", + "escapedName": "ansi-align", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/boxen" + ], + "_resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "_shasum": "0cdf12e111ace773a86e9a1fad1225c43cb19a59", + "_spec": "ansi-align@^3.0.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/boxen", + "author": { + "name": "nexdrew" + }, + "bugs": { + "url": "https://github.com/nexdrew/ansi-align/issues" + }, + "bundleDependencies": false, + "dependencies": { + "string-width": "^4.1.0" + }, + "deprecated": false, + "description": "align-text with ANSI support for CLIs", + "devDependencies": { + "ava": "^2.0.0", + "chalk": "^2.4.2", + "coveralls": "^3.0.3", + "nyc": "^14.0.0", + "standard": "^14.0.0", + "standard-version": "^7.0.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/nexdrew/ansi-align#readme", + "keywords": [ + "ansi", + "align", + "cli", + "center", + "pad" + ], + "license": "ISC", + "main": "index.js", + "name": "ansi-align", + "repository": { + "type": "git", + "url": "git+https://github.com/nexdrew/ansi-align.git" + }, + "scripts": { + "coverage": "nyc report --reporter=text-lcov | coveralls", + "pretest": "standard", + "release": "standard-version", + "test": "nyc ava" + }, + "version": "3.0.1" +} diff --git a/server/node_modules/ansi-regex/index.d.ts b/server/node_modules/ansi-regex/index.d.ts new file mode 100644 index 0000000..2dbf6af --- /dev/null +++ b/server/node_modules/ansi-regex/index.d.ts @@ -0,0 +1,37 @@ +declare namespace ansiRegex { + interface Options { + /** + Match only the first ANSI escape. + + @default false + */ + onlyFirst: boolean; + } +} + +/** +Regular expression for matching ANSI escape codes. + +@example +``` +import ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` +*/ +declare function ansiRegex(options?: ansiRegex.Options): RegExp; + +export = ansiRegex; diff --git a/server/node_modules/ansi-regex/index.js b/server/node_modules/ansi-regex/index.js new file mode 100644 index 0000000..616ff83 --- /dev/null +++ b/server/node_modules/ansi-regex/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = ({onlyFirst = false} = {}) => { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' + ].join('|'); + + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +}; diff --git a/server/node_modules/ansi-regex/license b/server/node_modules/ansi-regex/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/server/node_modules/ansi-regex/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/ansi-regex/package.json b/server/node_modules/ansi-regex/package.json new file mode 100644 index 0000000..cd21a32 --- /dev/null +++ b/server/node_modules/ansi-regex/package.json @@ -0,0 +1,87 @@ +{ + "_from": "ansi-regex@^5.0.1", + "_id": "ansi-regex@5.0.1", + "_inBundle": false, + "_integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "_location": "/ansi-regex", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ansi-regex@^5.0.1", + "name": "ansi-regex", + "escapedName": "ansi-regex", + "rawSpec": "^5.0.1", + "saveSpec": null, + "fetchSpec": "^5.0.1" + }, + "_requiredBy": [ + "/strip-ansi" + ], + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "_shasum": "082cb2c89c9fe8659a311a53bd6a4dc5301db304", + "_spec": "ansi-regex@^5.0.1", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/strip-ansi", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/chalk/ansi-regex/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Regular expression for matching ANSI escape codes", + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.9.0", + "xo": "^0.25.3" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "homepage": "https://github.com/chalk/ansi-regex#readme", + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "license": "MIT", + "name": "ansi-regex", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/ansi-regex.git" + }, + "scripts": { + "test": "xo && ava && tsd", + "view-supported": "node fixtures/view-codes.js" + }, + "version": "5.0.1" +} diff --git a/server/node_modules/ansi-regex/readme.md b/server/node_modules/ansi-regex/readme.md new file mode 100644 index 0000000..4d848bc --- /dev/null +++ b/server/node_modules/ansi-regex/readme.md @@ -0,0 +1,78 @@ +# ansi-regex + +> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install ansi-regex +``` + + +## Usage + +```js +const ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` + + +## API + +### ansiRegex(options?) + +Returns a regex for matching ANSI escape codes. + +#### options + +Type: `object` + +##### onlyFirst + +Type: `boolean`
+Default: `false` *(Matches any ANSI escape codes in a string)* + +Match only the first ANSI escape. + + +## FAQ + +### Why do you test for codes not in the ECMA 48 standard? + +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. + +On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/server/node_modules/ansi-styles/index.d.ts b/server/node_modules/ansi-styles/index.d.ts new file mode 100644 index 0000000..44a907e --- /dev/null +++ b/server/node_modules/ansi-styles/index.d.ts @@ -0,0 +1,345 @@ +declare type CSSColor = + | 'aliceblue' + | 'antiquewhite' + | 'aqua' + | 'aquamarine' + | 'azure' + | 'beige' + | 'bisque' + | 'black' + | 'blanchedalmond' + | 'blue' + | 'blueviolet' + | 'brown' + | 'burlywood' + | 'cadetblue' + | 'chartreuse' + | 'chocolate' + | 'coral' + | 'cornflowerblue' + | 'cornsilk' + | 'crimson' + | 'cyan' + | 'darkblue' + | 'darkcyan' + | 'darkgoldenrod' + | 'darkgray' + | 'darkgreen' + | 'darkgrey' + | 'darkkhaki' + | 'darkmagenta' + | 'darkolivegreen' + | 'darkorange' + | 'darkorchid' + | 'darkred' + | 'darksalmon' + | 'darkseagreen' + | 'darkslateblue' + | 'darkslategray' + | 'darkslategrey' + | 'darkturquoise' + | 'darkviolet' + | 'deeppink' + | 'deepskyblue' + | 'dimgray' + | 'dimgrey' + | 'dodgerblue' + | 'firebrick' + | 'floralwhite' + | 'forestgreen' + | 'fuchsia' + | 'gainsboro' + | 'ghostwhite' + | 'gold' + | 'goldenrod' + | 'gray' + | 'green' + | 'greenyellow' + | 'grey' + | 'honeydew' + | 'hotpink' + | 'indianred' + | 'indigo' + | 'ivory' + | 'khaki' + | 'lavender' + | 'lavenderblush' + | 'lawngreen' + | 'lemonchiffon' + | 'lightblue' + | 'lightcoral' + | 'lightcyan' + | 'lightgoldenrodyellow' + | 'lightgray' + | 'lightgreen' + | 'lightgrey' + | 'lightpink' + | 'lightsalmon' + | 'lightseagreen' + | 'lightskyblue' + | 'lightslategray' + | 'lightslategrey' + | 'lightsteelblue' + | 'lightyellow' + | 'lime' + | 'limegreen' + | 'linen' + | 'magenta' + | 'maroon' + | 'mediumaquamarine' + | 'mediumblue' + | 'mediumorchid' + | 'mediumpurple' + | 'mediumseagreen' + | 'mediumslateblue' + | 'mediumspringgreen' + | 'mediumturquoise' + | 'mediumvioletred' + | 'midnightblue' + | 'mintcream' + | 'mistyrose' + | 'moccasin' + | 'navajowhite' + | 'navy' + | 'oldlace' + | 'olive' + | 'olivedrab' + | 'orange' + | 'orangered' + | 'orchid' + | 'palegoldenrod' + | 'palegreen' + | 'paleturquoise' + | 'palevioletred' + | 'papayawhip' + | 'peachpuff' + | 'peru' + | 'pink' + | 'plum' + | 'powderblue' + | 'purple' + | 'rebeccapurple' + | 'red' + | 'rosybrown' + | 'royalblue' + | 'saddlebrown' + | 'salmon' + | 'sandybrown' + | 'seagreen' + | 'seashell' + | 'sienna' + | 'silver' + | 'skyblue' + | 'slateblue' + | 'slategray' + | 'slategrey' + | 'snow' + | 'springgreen' + | 'steelblue' + | 'tan' + | 'teal' + | 'thistle' + | 'tomato' + | 'turquoise' + | 'violet' + | 'wheat' + | 'white' + | 'whitesmoke' + | 'yellow' + | 'yellowgreen'; + +declare namespace ansiStyles { + interface ColorConvert { + /** + The RGB color space. + + @param red - (`0`-`255`) + @param green - (`0`-`255`) + @param blue - (`0`-`255`) + */ + rgb(red: number, green: number, blue: number): string; + + /** + The RGB HEX color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hex(hex: string): string; + + /** + @param keyword - A CSS color name. + */ + keyword(keyword: CSSColor): string; + + /** + The HSL color space. + + @param hue - (`0`-`360`) + @param saturation - (`0`-`100`) + @param lightness - (`0`-`100`) + */ + hsl(hue: number, saturation: number, lightness: number): string; + + /** + The HSV color space. + + @param hue - (`0`-`360`) + @param saturation - (`0`-`100`) + @param value - (`0`-`100`) + */ + hsv(hue: number, saturation: number, value: number): string; + + /** + The HSV color space. + + @param hue - (`0`-`360`) + @param whiteness - (`0`-`100`) + @param blackness - (`0`-`100`) + */ + hwb(hue: number, whiteness: number, blackness: number): string; + + /** + Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color. + */ + ansi(ansi: number): string; + + /** + Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color. + */ + ansi256(ansi: number): string; + } + + interface CSPair { + /** + The ANSI terminal control sequence for starting this style. + */ + readonly open: string; + + /** + The ANSI terminal control sequence for ending this style. + */ + readonly close: string; + } + + interface ColorBase { + readonly ansi: ColorConvert; + readonly ansi256: ColorConvert; + readonly ansi16m: ColorConvert; + + /** + The ANSI terminal control sequence for ending this color. + */ + readonly close: string; + } + + interface Modifier { + /** + Resets the current color chain. + */ + readonly reset: CSPair; + + /** + Make text bold. + */ + readonly bold: CSPair; + + /** + Emitting only a small amount of light. + */ + readonly dim: CSPair; + + /** + Make text italic. (Not widely supported) + */ + readonly italic: CSPair; + + /** + Make text underline. (Not widely supported) + */ + readonly underline: CSPair; + + /** + Inverse background and foreground colors. + */ + readonly inverse: CSPair; + + /** + Prints the text, but makes it invisible. + */ + readonly hidden: CSPair; + + /** + Puts a horizontal line through the center of the text. (Not widely supported) + */ + readonly strikethrough: CSPair; + } + + interface ForegroundColor { + readonly black: CSPair; + readonly red: CSPair; + readonly green: CSPair; + readonly yellow: CSPair; + readonly blue: CSPair; + readonly cyan: CSPair; + readonly magenta: CSPair; + readonly white: CSPair; + + /** + Alias for `blackBright`. + */ + readonly gray: CSPair; + + /** + Alias for `blackBright`. + */ + readonly grey: CSPair; + + readonly blackBright: CSPair; + readonly redBright: CSPair; + readonly greenBright: CSPair; + readonly yellowBright: CSPair; + readonly blueBright: CSPair; + readonly cyanBright: CSPair; + readonly magentaBright: CSPair; + readonly whiteBright: CSPair; + } + + interface BackgroundColor { + readonly bgBlack: CSPair; + readonly bgRed: CSPair; + readonly bgGreen: CSPair; + readonly bgYellow: CSPair; + readonly bgBlue: CSPair; + readonly bgCyan: CSPair; + readonly bgMagenta: CSPair; + readonly bgWhite: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGray: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGrey: CSPair; + + readonly bgBlackBright: CSPair; + readonly bgRedBright: CSPair; + readonly bgGreenBright: CSPair; + readonly bgYellowBright: CSPair; + readonly bgBlueBright: CSPair; + readonly bgCyanBright: CSPair; + readonly bgMagentaBright: CSPair; + readonly bgWhiteBright: CSPair; + } +} + +declare const ansiStyles: { + readonly modifier: ansiStyles.Modifier; + readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase; + readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase; + readonly codes: ReadonlyMap; +} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier; + +export = ansiStyles; diff --git a/server/node_modules/ansi-styles/index.js b/server/node_modules/ansi-styles/index.js new file mode 100644 index 0000000..5d82581 --- /dev/null +++ b/server/node_modules/ansi-styles/index.js @@ -0,0 +1,163 @@ +'use strict'; + +const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${code + offset}m`; +}; + +const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${38 + offset};5;${code}m`; +}; + +const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; + +const ansi2ansi = n => n; +const rgb2rgb = (r, g, b) => [r, g, b]; + +const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); + + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); + + return value; + }, + enumerable: true, + configurable: true + }); +}; + +/** @type {typeof import('color-convert')} */ +let colorConvert; +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = require('color-convert'); + } + + const offset = isBackground ? 10 : 0; + const styles = {}; + + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } + + return styles; +}; + +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; + + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); + + return styles; +} + +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); diff --git a/server/node_modules/ansi-styles/license b/server/node_modules/ansi-styles/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/server/node_modules/ansi-styles/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/ansi-styles/package.json b/server/node_modules/ansi-styles/package.json new file mode 100644 index 0000000..d0cc3c2 --- /dev/null +++ b/server/node_modules/ansi-styles/package.json @@ -0,0 +1,89 @@ +{ + "_from": "ansi-styles@^4.1.0", + "_id": "ansi-styles@4.3.0", + "_inBundle": false, + "_integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "_location": "/ansi-styles", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ansi-styles@^4.1.0", + "name": "ansi-styles", + "escapedName": "ansi-styles", + "rawSpec": "^4.1.0", + "saveSpec": null, + "fetchSpec": "^4.1.0" + }, + "_requiredBy": [ + "/chalk", + "/wrap-ansi" + ], + "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "_shasum": "edd803628ae71c04c85ae7a0906edad34b648937", + "_spec": "ansi-styles@^4.1.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/chalk", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/chalk/ansi-styles/issues" + }, + "bundleDependencies": false, + "dependencies": { + "color-convert": "^2.0.1" + }, + "deprecated": false, + "description": "ANSI escape codes for styling strings in the terminal", + "devDependencies": { + "@types/color-convert": "^1.9.0", + "ava": "^2.3.0", + "svg-term-cli": "^2.1.1", + "tsd": "^0.11.0", + "xo": "^0.25.3" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "funding": "https://github.com/chalk/ansi-styles?sponsor=1", + "homepage": "https://github.com/chalk/ansi-styles#readme", + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "license": "MIT", + "name": "ansi-styles", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/ansi-styles.git" + }, + "scripts": { + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor", + "test": "xo && ava && tsd" + }, + "version": "4.3.0" +} diff --git a/server/node_modules/ansi-styles/readme.md b/server/node_modules/ansi-styles/readme.md new file mode 100644 index 0000000..24883de --- /dev/null +++ b/server/node_modules/ansi-styles/readme.md @@ -0,0 +1,152 @@ +# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles) + +> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal + +You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. + + + +## Install + +``` +$ npm install ansi-styles +``` + +## Usage + +```js +const style = require('ansi-styles'); + +console.log(`${style.green.open}Hello world!${style.green.close}`); + + +// Color conversion between 16/256/truecolor +// NOTE: If conversion goes to 16 colors or 256 colors, the original color +// may be degraded to fit that color palette. This means terminals +// that do not support 16 million colors will best-match the +// original color. +console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close); +console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close); +console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close); +``` + +## API + +Each style has an `open` and `close` property. + +## Styles + +### Modifiers + +- `reset` +- `bold` +- `dim` +- `italic` *(Not widely supported)* +- `underline` +- `inverse` +- `hidden` +- `strikethrough` *(Not widely supported)* + +### Colors + +- `black` +- `red` +- `green` +- `yellow` +- `blue` +- `magenta` +- `cyan` +- `white` +- `blackBright` (alias: `gray`, `grey`) +- `redBright` +- `greenBright` +- `yellowBright` +- `blueBright` +- `magentaBright` +- `cyanBright` +- `whiteBright` + +### Background colors + +- `bgBlack` +- `bgRed` +- `bgGreen` +- `bgYellow` +- `bgBlue` +- `bgMagenta` +- `bgCyan` +- `bgWhite` +- `bgBlackBright` (alias: `bgGray`, `bgGrey`) +- `bgRedBright` +- `bgGreenBright` +- `bgYellowBright` +- `bgBlueBright` +- `bgMagentaBright` +- `bgCyanBright` +- `bgWhiteBright` + +## Advanced usage + +By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. + +- `style.modifier` +- `style.color` +- `style.bgColor` + +###### Example + +```js +console.log(style.color.green.open); +``` + +Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values. + +###### Example + +```js +console.log(style.codes.get(36)); +//=> 39 +``` + +## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728) + +`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors. + +The following color spaces from `color-convert` are supported: + +- `rgb` +- `hex` +- `keyword` +- `hsl` +- `hsv` +- `hwb` +- `ansi` +- `ansi256` + +To use these, call the associated conversion function with the intended output, for example: + +```js +style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code +style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code + +style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code +style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code + +style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code +style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code +``` + +## Related + +- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + +## For enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/server/node_modules/anymatch/LICENSE b/server/node_modules/anymatch/LICENSE new file mode 100644 index 0000000..491766c --- /dev/null +++ b/server/node_modules/anymatch/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com) + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/server/node_modules/anymatch/README.md b/server/node_modules/anymatch/README.md new file mode 100644 index 0000000..1dd67f5 --- /dev/null +++ b/server/node_modules/anymatch/README.md @@ -0,0 +1,87 @@ +anymatch [![Build Status](https://travis-ci.org/micromatch/anymatch.svg?branch=master)](https://travis-ci.org/micromatch/anymatch) [![Coverage Status](https://img.shields.io/coveralls/micromatch/anymatch.svg?branch=master)](https://coveralls.io/r/micromatch/anymatch?branch=master) +====== +Javascript module to match a string against a regular expression, glob, string, +or function that takes the string as an argument and returns a truthy or falsy +value. The matcher can also be an array of any or all of these. Useful for +allowing a very flexible user-defined config to define things like file paths. + +__Note: This module has Bash-parity, please be aware that Windows-style backslashes are not supported as separators. See https://github.com/micromatch/micromatch#backslashes for more information.__ + + +Usage +----- +```sh +npm install anymatch +``` + +#### anymatch(matchers, testString, [returnIndex], [options]) +* __matchers__: (_Array|String|RegExp|Function_) +String to be directly matched, string with glob patterns, regular expression +test, function that takes the testString as an argument and returns a truthy +value if it should be matched, or an array of any number and mix of these types. +* __testString__: (_String|Array_) The string to test against the matchers. If +passed as an array, the first element of the array will be used as the +`testString` for non-function matchers, while the entire array will be applied +as the arguments for function matchers. +* __options__: (_Object_ [optional]_) Any of the [picomatch](https://github.com/micromatch/picomatch#options) options. + * __returnIndex__: (_Boolean [optional]_) If true, return the array index of +the first matcher that that testString matched, or -1 if no match, instead of a +boolean result. + +```js +const anymatch = require('anymatch'); + +const matchers = [ 'path/to/file.js', 'path/anyjs/**/*.js', /foo.js$/, string => string.includes('bar') && string.length > 10 ] ; + +anymatch(matchers, 'path/to/file.js'); // true +anymatch(matchers, 'path/anyjs/baz.js'); // true +anymatch(matchers, 'path/to/foo.js'); // true +anymatch(matchers, 'path/to/bar.js'); // true +anymatch(matchers, 'bar.js'); // false + +// returnIndex = true +anymatch(matchers, 'foo.js', {returnIndex: true}); // 2 +anymatch(matchers, 'path/anyjs/foo.js', {returnIndex: true}); // 1 + +// any picomatc + +// using globs to match directories and their children +anymatch('node_modules', 'node_modules'); // true +anymatch('node_modules', 'node_modules/somelib/index.js'); // false +anymatch('node_modules/**', 'node_modules/somelib/index.js'); // true +anymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // false +anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true + +const matcher = anymatch(matchers); +['foo.js', 'bar.js'].filter(matcher); // [ 'foo.js' ] +anymatch master* ❯ + +``` + +#### anymatch(matchers) +You can also pass in only your matcher(s) to get a curried function that has +already been bound to the provided matching criteria. This can be used as an +`Array#filter` callback. + +```js +var matcher = anymatch(matchers); + +matcher('path/to/file.js'); // true +matcher('path/anyjs/baz.js', true); // 1 + +['foo.js', 'bar.js'].filter(matcher); // ['foo.js'] +``` + +Changelog +---------- +[See release notes page on GitHub](https://github.com/micromatch/anymatch/releases) + +- **v3.0:** Removed `startIndex` and `endIndex` arguments. Node 8.x-only. +- **v2.0:** [micromatch](https://github.com/jonschlinkert/micromatch) moves away from minimatch-parity and inline with Bash. This includes handling backslashes differently (see https://github.com/micromatch/micromatch#backslashes for more information). +- **v1.2:** anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch) +for glob pattern matching. Issues with glob pattern matching should be +reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues). + +License +------- +[ISC](https://raw.github.com/micromatch/anymatch/master/LICENSE) diff --git a/server/node_modules/anymatch/index.d.ts b/server/node_modules/anymatch/index.d.ts new file mode 100644 index 0000000..196d061 --- /dev/null +++ b/server/node_modules/anymatch/index.d.ts @@ -0,0 +1,19 @@ +type AnymatchFn = (testString: string) => boolean; +type AnymatchPattern = string|RegExp|AnymatchFn; +type AnymatchMatcher = AnymatchPattern|AnymatchPattern[] +type AnymatchTester = { + (testString: string|any[], returnIndex: true): number; + (testString: string|any[]): boolean; +} + +type PicomatchOptions = {dot: boolean}; + +declare const anymatch: { + (matchers: AnymatchMatcher): AnymatchTester; + (matchers: AnymatchMatcher, testString: string|any[], returnIndex: true | PicomatchOptions): number; + (matchers: AnymatchMatcher, testString: string|any[]): boolean; +} + +export {AnymatchMatcher as Matcher} +export {AnymatchTester as Tester} +export default anymatch diff --git a/server/node_modules/anymatch/index.js b/server/node_modules/anymatch/index.js new file mode 100644 index 0000000..9fb3ebb --- /dev/null +++ b/server/node_modules/anymatch/index.js @@ -0,0 +1,104 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { value: true }); + +const picomatch = require('picomatch'); +const normalizePath = require('normalize-path'); + +/** + * @typedef {(testString: string) => boolean} AnymatchFn + * @typedef {string|RegExp|AnymatchFn} AnymatchPattern + * @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher + */ +const BANG = '!'; +const DEFAULT_OPTIONS = {returnIndex: false}; +const arrify = (item) => Array.isArray(item) ? item : [item]; + +/** + * @param {AnymatchPattern} matcher + * @param {object} options + * @returns {AnymatchFn} + */ +const createPattern = (matcher, options) => { + if (typeof matcher === 'function') { + return matcher; + } + if (typeof matcher === 'string') { + const glob = picomatch(matcher, options); + return (string) => matcher === string || glob(string); + } + if (matcher instanceof RegExp) { + return (string) => matcher.test(string); + } + return (string) => false; +}; + +/** + * @param {Array} patterns + * @param {Array} negPatterns + * @param {String|Array} args + * @param {Boolean} returnIndex + * @returns {boolean|number} + */ +const matchPatterns = (patterns, negPatterns, args, returnIndex) => { + const isList = Array.isArray(args); + const _path = isList ? args[0] : args; + if (!isList && typeof _path !== 'string') { + throw new TypeError('anymatch: second argument must be a string: got ' + + Object.prototype.toString.call(_path)) + } + const path = normalizePath(_path); + + for (let index = 0; index < negPatterns.length; index++) { + const nglob = negPatterns[index]; + if (nglob(path)) { + return returnIndex ? -1 : false; + } + } + + const applied = isList && [path].concat(args.slice(1)); + for (let index = 0; index < patterns.length; index++) { + const pattern = patterns[index]; + if (isList ? pattern(...applied) : pattern(path)) { + return returnIndex ? index : true; + } + } + + return returnIndex ? -1 : false; +}; + +/** + * @param {AnymatchMatcher} matchers + * @param {Array|string} testString + * @param {object} options + * @returns {boolean|number|Function} + */ +const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => { + if (matchers == null) { + throw new TypeError('anymatch: specify first argument'); + } + const opts = typeof options === 'boolean' ? {returnIndex: options} : options; + const returnIndex = opts.returnIndex || false; + + // Early cache for matchers. + const mtchers = arrify(matchers); + const negatedGlobs = mtchers + .filter(item => typeof item === 'string' && item.charAt(0) === BANG) + .map(item => item.slice(1)) + .map(item => picomatch(item, opts)); + const patterns = mtchers + .filter(item => typeof item !== 'string' || (typeof item === 'string' && item.charAt(0) !== BANG)) + .map(matcher => createPattern(matcher, opts)); + + if (testString == null) { + return (testString, ri = false) => { + const returnIndex = typeof ri === 'boolean' ? ri : false; + return matchPatterns(patterns, negatedGlobs, testString, returnIndex); + } + } + + return matchPatterns(patterns, negatedGlobs, testString, returnIndex); +}; + +anymatch.default = anymatch; +module.exports = anymatch; diff --git a/server/node_modules/anymatch/package.json b/server/node_modules/anymatch/package.json new file mode 100644 index 0000000..28875ae --- /dev/null +++ b/server/node_modules/anymatch/package.json @@ -0,0 +1,76 @@ +{ + "_from": "anymatch@~3.1.2", + "_id": "anymatch@3.1.2", + "_inBundle": false, + "_integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "_location": "/anymatch", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "anymatch@~3.1.2", + "name": "anymatch", + "escapedName": "anymatch", + "rawSpec": "~3.1.2", + "saveSpec": null, + "fetchSpec": "~3.1.2" + }, + "_requiredBy": [ + "/chokidar" + ], + "_resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "_shasum": "c0557c096af32f106198f4f4e2a383537e378716", + "_spec": "anymatch@~3.1.2", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/chokidar", + "author": { + "name": "Elan Shanker", + "url": "https://github.com/es128" + }, + "bugs": { + "url": "https://github.com/micromatch/anymatch/issues" + }, + "bundleDependencies": false, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "deprecated": false, + "description": "Matches strings against configurable strings, globs, regular expressions, and/or functions", + "devDependencies": { + "mocha": "^6.1.3", + "nyc": "^14.0.0" + }, + "engines": { + "node": ">= 8" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "homepage": "https://github.com/micromatch/anymatch", + "keywords": [ + "match", + "any", + "string", + "file", + "fs", + "list", + "glob", + "regex", + "regexp", + "regular", + "expression", + "function" + ], + "license": "ISC", + "name": "anymatch", + "repository": { + "type": "git", + "url": "git+https://github.com/micromatch/anymatch.git" + }, + "scripts": { + "mocha": "mocha", + "test": "nyc mocha" + }, + "version": "3.1.2" +} diff --git a/server/node_modules/aproba/LICENSE b/server/node_modules/aproba/LICENSE new file mode 100644 index 0000000..f4be44d --- /dev/null +++ b/server/node_modules/aproba/LICENSE @@ -0,0 +1,14 @@ +Copyright (c) 2015, Rebecca Turner + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + diff --git a/server/node_modules/aproba/README.md b/server/node_modules/aproba/README.md new file mode 100644 index 0000000..0bfc594 --- /dev/null +++ b/server/node_modules/aproba/README.md @@ -0,0 +1,94 @@ +aproba +====== + +A ridiculously light-weight function argument validator + +``` +var validate = require("aproba") + +function myfunc(a, b, c) { + // `a` must be a string, `b` a number, `c` a function + validate('SNF', arguments) // [a,b,c] is also valid +} + +myfunc('test', 23, function () {}) // ok +myfunc(123, 23, function () {}) // type error +myfunc('test', 23) // missing arg error +myfunc('test', 23, function () {}, true) // too many args error + +``` + +Valid types are: + +| type | description +| :--: | :---------- +| * | matches any type +| A | `Array.isArray` OR an `arguments` object +| S | typeof == string +| N | typeof == number +| F | typeof == function +| O | typeof == object and not type A and not type E +| B | typeof == boolean +| E | `instanceof Error` OR `null` **(special: see below)** +| Z | == `null` + +Validation failures throw one of three exception types, distinguished by a +`code` property of `EMISSINGARG`, `EINVALIDTYPE` or `ETOOMANYARGS`. + +If you pass in an invalid type then it will throw with a code of +`EUNKNOWNTYPE`. + +If an **error** argument is found and is not null then the remaining +arguments are optional. That is, if you say `ESO` then that's like using a +non-magical `E` in: `E|ESO|ZSO`. + +### But I have optional arguments?! + +You can provide more than one signature by separating them with pipes `|`. +If any signature matches the arguments then they'll be considered valid. + +So for example, say you wanted to write a signature for +`fs.createWriteStream`. The docs for it describe it thusly: + +``` +fs.createWriteStream(path[, options]) +``` + +This would be a signature of `SO|S`. That is, a string and and object, or +just a string. + +Now, if you read the full `fs` docs, you'll see that actually path can ALSO +be a buffer. And options can be a string, that is: +``` +path | +options | +``` + +To reproduce this you have to fully enumerate all of the possible +combinations and that implies a signature of `SO|SS|OO|OS|S|O`. The +awkwardness is a feature: It reminds you of the complexity you're adding to +your API when you do this sort of thing. + + +### Browser support + +This has no dependencies and should work in browsers, though you'll have +noisier stack traces. + +### Why this exists + +I wanted a very simple argument validator. It needed to do two things: + +1. Be more concise and easier to use than assertions + +2. Not encourage an infinite bikeshed of DSLs + +This is why types are specified by a single character and there's no such +thing as an optional argument. + +This is not intended to validate user data. This is specifically about +asserting the interface of your functions. + +If you need greater validation, I encourage you to write them by hand or +look elsewhere. + diff --git a/server/node_modules/aproba/index.js b/server/node_modules/aproba/index.js new file mode 100644 index 0000000..6f3f797 --- /dev/null +++ b/server/node_modules/aproba/index.js @@ -0,0 +1,105 @@ +'use strict' + +function isArguments (thingy) { + return thingy != null && typeof thingy === 'object' && thingy.hasOwnProperty('callee') +} + +var types = { + '*': {label: 'any', check: function () { return true }}, + A: {label: 'array', check: function (thingy) { return Array.isArray(thingy) || isArguments(thingy) }}, + S: {label: 'string', check: function (thingy) { return typeof thingy === 'string' }}, + N: {label: 'number', check: function (thingy) { return typeof thingy === 'number' }}, + F: {label: 'function', check: function (thingy) { return typeof thingy === 'function' }}, + O: {label: 'object', check: function (thingy) { return typeof thingy === 'object' && thingy != null && !types.A.check(thingy) && !types.E.check(thingy) }}, + B: {label: 'boolean', check: function (thingy) { return typeof thingy === 'boolean' }}, + E: {label: 'error', check: function (thingy) { return thingy instanceof Error }}, + Z: {label: 'null', check: function (thingy) { return thingy == null }} +} + +function addSchema (schema, arity) { + var group = arity[schema.length] = arity[schema.length] || [] + if (group.indexOf(schema) === -1) group.push(schema) +} + +var validate = module.exports = function (rawSchemas, args) { + if (arguments.length !== 2) throw wrongNumberOfArgs(['SA'], arguments.length) + if (!rawSchemas) throw missingRequiredArg(0, 'rawSchemas') + if (!args) throw missingRequiredArg(1, 'args') + if (!types.S.check(rawSchemas)) throw invalidType(0, ['string'], rawSchemas) + if (!types.A.check(args)) throw invalidType(1, ['array'], args) + var schemas = rawSchemas.split('|') + var arity = {} + + schemas.forEach(function (schema) { + for (var ii = 0; ii < schema.length; ++ii) { + var type = schema[ii] + if (!types[type]) throw unknownType(ii, type) + } + if (/E.*E/.test(schema)) throw moreThanOneError(schema) + addSchema(schema, arity) + if (/E/.test(schema)) { + addSchema(schema.replace(/E.*$/, 'E'), arity) + addSchema(schema.replace(/E/, 'Z'), arity) + if (schema.length === 1) addSchema('', arity) + } + }) + var matching = arity[args.length] + if (!matching) { + throw wrongNumberOfArgs(Object.keys(arity), args.length) + } + for (var ii = 0; ii < args.length; ++ii) { + var newMatching = matching.filter(function (schema) { + var type = schema[ii] + var typeCheck = types[type].check + return typeCheck(args[ii]) + }) + if (!newMatching.length) { + var labels = matching.map(function (schema) { + return types[schema[ii]].label + }).filter(function (schema) { return schema != null }) + throw invalidType(ii, labels, args[ii]) + } + matching = newMatching + } +} + +function missingRequiredArg (num) { + return newException('EMISSINGARG', 'Missing required argument #' + (num + 1)) +} + +function unknownType (num, type) { + return newException('EUNKNOWNTYPE', 'Unknown type ' + type + ' in argument #' + (num + 1)) +} + +function invalidType (num, expectedTypes, value) { + var valueType + Object.keys(types).forEach(function (typeCode) { + if (types[typeCode].check(value)) valueType = types[typeCode].label + }) + return newException('EINVALIDTYPE', 'Argument #' + (num + 1) + ': Expected ' + + englishList(expectedTypes) + ' but got ' + valueType) +} + +function englishList (list) { + return list.join(', ').replace(/, ([^,]+)$/, ' or $1') +} + +function wrongNumberOfArgs (expected, got) { + var english = englishList(expected) + var args = expected.every(function (ex) { return ex.length === 1 }) + ? 'argument' + : 'arguments' + return newException('EWRONGARGCOUNT', 'Expected ' + english + ' ' + args + ' but got ' + got) +} + +function moreThanOneError (schema) { + return newException('ETOOMANYERRORTYPES', + 'Only one error type per argument signature is allowed, more than one found in "' + schema + '"') +} + +function newException (code, msg) { + var e = new Error(msg) + e.code = code + if (Error.captureStackTrace) Error.captureStackTrace(e, validate) + return e +} diff --git a/server/node_modules/aproba/package.json b/server/node_modules/aproba/package.json new file mode 100644 index 0000000..9b6d589 --- /dev/null +++ b/server/node_modules/aproba/package.json @@ -0,0 +1,62 @@ +{ + "_from": "aproba@^1.0.3", + "_id": "aproba@1.2.0", + "_inBundle": false, + "_integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "_location": "/aproba", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "aproba@^1.0.3", + "name": "aproba", + "escapedName": "aproba", + "rawSpec": "^1.0.3", + "saveSpec": null, + "fetchSpec": "^1.0.3" + }, + "_requiredBy": [ + "/gauge" + ], + "_resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "_shasum": "6802e6264efd18c790a1b0d517f0f2627bf2c94a", + "_spec": "aproba@^1.0.3", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/gauge", + "author": { + "name": "Rebecca Turner", + "email": "me@re-becca.org" + }, + "bugs": { + "url": "https://github.com/iarna/aproba/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "A ridiculously light-weight argument validator (now browser friendly)", + "devDependencies": { + "standard": "^10.0.3", + "tap": "^10.0.2" + }, + "directories": { + "test": "test" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/iarna/aproba", + "keywords": [ + "argument", + "validate" + ], + "license": "ISC", + "main": "index.js", + "name": "aproba", + "repository": { + "type": "git", + "url": "git+https://github.com/iarna/aproba.git" + }, + "scripts": { + "test": "standard && tap -j3 test/*.js" + }, + "version": "1.2.0" +} diff --git a/server/node_modules/are-we-there-yet/CHANGES.md b/server/node_modules/are-we-there-yet/CHANGES.md new file mode 100644 index 0000000..21f3b1c --- /dev/null +++ b/server/node_modules/are-we-there-yet/CHANGES.md @@ -0,0 +1,37 @@ +Hi, figured we could actually use a changelog now: + +## 1.1.5 2018-05-24 + +* [#92](https://github.com/iarna/are-we-there-yet/pull/92) Fix bug where + `finish` would throw errors when including `TrackerStream` objects in + `TrackerGroup` collections. (@brianloveswords) + +## 1.1.4 2017-04-21 + +* Fix typo in package.json + +## 1.1.3 2017-04-21 + +* Improve documentation and limit files included in the distribution. + +## 1.1.2 2016-03-15 + +* Add tracker group cycle detection and tests for it + +## 1.1.1 2016-01-29 + +* Fix a typo in stream completion tracker + +## 1.1.0 2016-01-29 + +* Rewrote completion percent computation to be low impact– no more walking a + tree of completion groups every time we need this info. Previously, with + medium sized tree of completion groups, even a relatively modest number of + calls to the top level `completed()` method would result in absurd numbers + of calls overall as it walked down the tree. We now, instead, keep track as + we bubble up changes, so the computation is limited to when data changes and + to the depth of that one branch, instead of _every_ node. (Plus, we were already + incurring _this_ cost, since we already bubbled out changes.) +* Moved different tracker types out to their own files. +* Made tests test for TOO MANY events too. +* Standarized the source code formatting diff --git a/server/node_modules/are-we-there-yet/LICENSE b/server/node_modules/are-we-there-yet/LICENSE new file mode 100644 index 0000000..af45880 --- /dev/null +++ b/server/node_modules/are-we-there-yet/LICENSE @@ -0,0 +1,5 @@ +Copyright (c) 2015, Rebecca Turner + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/server/node_modules/are-we-there-yet/README.md b/server/node_modules/are-we-there-yet/README.md new file mode 100644 index 0000000..7e2b42d --- /dev/null +++ b/server/node_modules/are-we-there-yet/README.md @@ -0,0 +1,195 @@ +are-we-there-yet +---------------- + +Track complex hiearchies of asynchronous task completion statuses. This is +intended to give you a way of recording and reporting the progress of the big +recursive fan-out and gather type workflows that are so common in async. + +What you do with this completion data is up to you, but the most common use case is to +feed it to one of the many progress bar modules. + +Most progress bar modules include a rudamentary version of this, but my +needs were more complex. + +Usage +===== + +```javascript +var TrackerGroup = require("are-we-there-yet").TrackerGroup + +var top = new TrackerGroup("program") + +var single = top.newItem("one thing", 100) +single.completeWork(20) + +console.log(top.completed()) // 0.2 + +fs.stat("file", function(er, stat) { + if (er) throw er + var stream = top.newStream("file", stat.size) + console.log(top.completed()) // now 0.1 as single is 50% of the job and is 20% complete + // and 50% * 20% == 10% + fs.createReadStream("file").pipe(stream).on("data", function (chunk) { + // do stuff with chunk + }) + top.on("change", function (name) { + // called each time a chunk is read from "file" + // top.completed() will start at 0.1 and fill up to 0.6 as the file is read + }) +}) +``` + +Shared Methods +============== + +* var completed = tracker.completed() + +Implemented in: `Tracker`, `TrackerGroup`, `TrackerStream` + +Returns the ratio of completed work to work to be done. Range of 0 to 1. + +* tracker.finish() + +Implemented in: `Tracker`, `TrackerGroup` + +Marks the tracker as completed. With a TrackerGroup this marks all of its +components as completed. + +Marks all of the components of this tracker as finished, which in turn means +that `tracker.completed()` for this will now be 1. + +This will result in one or more `change` events being emitted. + +Events +====== + +All tracker objects emit `change` events with the following arguments: + +``` +function (name, completed, tracker) +``` + +`name` is the name of the tracker that originally emitted the event, +or if it didn't have one, the first containing tracker group that had one. + +`completed` is the percent complete (as returned by `tracker.completed()` method). + +`tracker` is the tracker object that you are listening for events on. + +TrackerGroup +============ + +* var tracker = new TrackerGroup(**name**) + + * **name** *(optional)* - The name of this tracker group, used in change + notifications if the component updating didn't have a name. Defaults to undefined. + +Creates a new empty tracker aggregation group. These are trackers whose +completion status is determined by the completion status of other trackers. + +* tracker.addUnit(**otherTracker**, **weight**) + + * **otherTracker** - Any of the other are-we-there-yet tracker objects + * **weight** *(optional)* - The weight to give the tracker, defaults to 1. + +Adds the **otherTracker** to this aggregation group. The weight determines +how long you expect this tracker to take to complete in proportion to other +units. So for instance, if you add one tracker with a weight of 1 and +another with a weight of 2, you're saying the second will take twice as long +to complete as the first. As such, the first will account for 33% of the +completion of this tracker and the second will account for the other 67%. + +Returns **otherTracker**. + +* var subGroup = tracker.newGroup(**name**, **weight**) + +The above is exactly equivalent to: + +```javascript + var subGroup = tracker.addUnit(new TrackerGroup(name), weight) +``` + +* var subItem = tracker.newItem(**name**, **todo**, **weight**) + +The above is exactly equivalent to: + +```javascript + var subItem = tracker.addUnit(new Tracker(name, todo), weight) +``` + +* var subStream = tracker.newStream(**name**, **todo**, **weight**) + +The above is exactly equivalent to: + +```javascript + var subStream = tracker.addUnit(new TrackerStream(name, todo), weight) +``` + +* console.log( tracker.debug() ) + +Returns a tree showing the completion of this tracker group and all of its +children, including recursively entering all of the children. + +Tracker +======= + +* var tracker = new Tracker(**name**, **todo**) + + * **name** *(optional)* The name of this counter to report in change + events. Defaults to undefined. + * **todo** *(optional)* The amount of work todo (a number). Defaults to 0. + +Ordinarily these are constructed as a part of a tracker group (via +`newItem`). + +* var completed = tracker.completed() + +Returns the ratio of completed work to work to be done. Range of 0 to 1. If +total work to be done is 0 then it will return 0. + +* tracker.addWork(**todo**) + + * **todo** A number to add to the amount of work to be done. + +Increases the amount of work to be done, thus decreasing the completion +percentage. Triggers a `change` event. + +* tracker.completeWork(**completed**) + + * **completed** A number to add to the work complete + +Increase the amount of work complete, thus increasing the completion percentage. +Will never increase the work completed past the amount of work todo. That is, +percentages > 100% are not allowed. Triggers a `change` event. + +* tracker.finish() + +Marks this tracker as finished, tracker.completed() will now be 1. Triggers +a `change` event. + +TrackerStream +============= + +* var tracker = new TrackerStream(**name**, **size**, **options**) + + * **name** *(optional)* The name of this counter to report in change + events. Defaults to undefined. + * **size** *(optional)* The number of bytes being sent through this stream. + * **options** *(optional)* A hash of stream options + +The tracker stream object is a pass through stream that updates an internal +tracker object each time a block passes through. It's intended to track +downloads, file extraction and other related activities. You use it by piping +your data source into it and then using it as your data source. + +If your data has a length attribute then that's used as the amount of work +completed when the chunk is passed through. If it does not (eg, object +streams) then each chunk counts as completing 1 unit of work, so your size +should be the total number of objects being streamed. + +* tracker.addWork(**todo**) + + * **todo** Increase the expected overall size by **todo** bytes. + +Increases the amount of work to be done, thus decreasing the completion +percentage. Triggers a `change` event. diff --git a/server/node_modules/are-we-there-yet/index.js b/server/node_modules/are-we-there-yet/index.js new file mode 100644 index 0000000..f884d08 --- /dev/null +++ b/server/node_modules/are-we-there-yet/index.js @@ -0,0 +1,4 @@ +'use strict' +exports.TrackerGroup = require('are-we-there-yet/tracker-group.js') +exports.Tracker = require('are-we-there-yet/tracker.js') +exports.TrackerStream = require('are-we-there-yet/tracker-stream.js') diff --git a/server/node_modules/are-we-there-yet/package.json b/server/node_modules/are-we-there-yet/package.json new file mode 100644 index 0000000..28e8bb2 --- /dev/null +++ b/server/node_modules/are-we-there-yet/package.json @@ -0,0 +1,63 @@ +{ + "_from": "are-we-there-yet@~1.1.2", + "_id": "are-we-there-yet@1.1.7", + "_inBundle": false, + "_integrity": "sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==", + "_location": "/are-we-there-yet", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "are-we-there-yet@~1.1.2", + "name": "are-we-there-yet", + "escapedName": "are-we-there-yet", + "rawSpec": "~1.1.2", + "saveSpec": null, + "fetchSpec": "~1.1.2" + }, + "_requiredBy": [ + "/npmlog" + ], + "_resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz", + "_shasum": "b15474a932adab4ff8a50d9adfa7e4e926f21146", + "_spec": "are-we-there-yet@~1.1.2", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/npmlog", + "author": { + "name": "Rebecca Turner", + "url": "http://re-becca.org" + }, + "bugs": { + "url": "https://github.com/iarna/are-we-there-yet/issues" + }, + "bundleDependencies": false, + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + }, + "deprecated": false, + "description": "Keep track of the overall completion of many disparate processes", + "devDependencies": { + "standard": "^11.0.1", + "tap": "^12.0.1" + }, + "files": [ + "index.js", + "tracker-base.js", + "tracker-group.js", + "tracker-stream.js", + "tracker.js", + "CHANGES.md" + ], + "homepage": "https://github.com/iarna/are-we-there-yet", + "license": "ISC", + "main": "index.js", + "name": "are-we-there-yet", + "repository": { + "type": "git", + "url": "git+https://github.com/iarna/are-we-there-yet.git" + }, + "scripts": { + "test": "standard && tap test/*.js" + }, + "version": "1.1.7" +} diff --git a/server/node_modules/are-we-there-yet/tracker-base.js b/server/node_modules/are-we-there-yet/tracker-base.js new file mode 100644 index 0000000..6f43687 --- /dev/null +++ b/server/node_modules/are-we-there-yet/tracker-base.js @@ -0,0 +1,11 @@ +'use strict' +var EventEmitter = require('events').EventEmitter +var util = require('util') + +var trackerId = 0 +var TrackerBase = module.exports = function (name) { + EventEmitter.call(this) + this.id = ++trackerId + this.name = name +} +util.inherits(TrackerBase, EventEmitter) diff --git a/server/node_modules/are-we-there-yet/tracker-group.js b/server/node_modules/are-we-there-yet/tracker-group.js new file mode 100644 index 0000000..03a2e4e --- /dev/null +++ b/server/node_modules/are-we-there-yet/tracker-group.js @@ -0,0 +1,107 @@ +'use strict' +var util = require('util') +var TrackerBase = require('are-we-there-yet/tracker-base.js') +var Tracker = require('are-we-there-yet/tracker.js') +var TrackerStream = require('are-we-there-yet/tracker-stream.js') + +var TrackerGroup = module.exports = function (name) { + TrackerBase.call(this, name) + this.parentGroup = null + this.trackers = [] + this.completion = {} + this.weight = {} + this.totalWeight = 0 + this.finished = false + this.bubbleChange = bubbleChange(this) +} +util.inherits(TrackerGroup, TrackerBase) + +function bubbleChange (trackerGroup) { + return function (name, completed, tracker) { + trackerGroup.completion[tracker.id] = completed + if (trackerGroup.finished) return + trackerGroup.emit('change', name || trackerGroup.name, trackerGroup.completed(), trackerGroup) + } +} + +TrackerGroup.prototype.nameInTree = function () { + var names = [] + var from = this + while (from) { + names.unshift(from.name) + from = from.parentGroup + } + return names.join('/') +} + +TrackerGroup.prototype.addUnit = function (unit, weight) { + if (unit.addUnit) { + var toTest = this + while (toTest) { + if (unit === toTest) { + throw new Error( + 'Attempted to add tracker group ' + + unit.name + ' to tree that already includes it ' + + this.nameInTree(this)) + } + toTest = toTest.parentGroup + } + unit.parentGroup = this + } + this.weight[unit.id] = weight || 1 + this.totalWeight += this.weight[unit.id] + this.trackers.push(unit) + this.completion[unit.id] = unit.completed() + unit.on('change', this.bubbleChange) + if (!this.finished) this.emit('change', unit.name, this.completion[unit.id], unit) + return unit +} + +TrackerGroup.prototype.completed = function () { + if (this.trackers.length === 0) return 0 + var valPerWeight = 1 / this.totalWeight + var completed = 0 + for (var ii = 0; ii < this.trackers.length; ii++) { + var trackerId = this.trackers[ii].id + completed += valPerWeight * this.weight[trackerId] * this.completion[trackerId] + } + return completed +} + +TrackerGroup.prototype.newGroup = function (name, weight) { + return this.addUnit(new TrackerGroup(name), weight) +} + +TrackerGroup.prototype.newItem = function (name, todo, weight) { + return this.addUnit(new Tracker(name, todo), weight) +} + +TrackerGroup.prototype.newStream = function (name, todo, weight) { + return this.addUnit(new TrackerStream(name, todo), weight) +} + +TrackerGroup.prototype.finish = function () { + this.finished = true + if (!this.trackers.length) this.addUnit(new Tracker(), 1, true) + for (var ii = 0; ii < this.trackers.length; ii++) { + var tracker = this.trackers[ii] + tracker.finish() + tracker.removeListener('change', this.bubbleChange) + } + this.emit('change', this.name, 1, this) +} + +var buffer = ' ' +TrackerGroup.prototype.debug = function (depth) { + depth = depth || 0 + var indent = depth ? buffer.substr(0, depth) : '' + var output = indent + (this.name || 'top') + ': ' + this.completed() + '\n' + this.trackers.forEach(function (tracker) { + if (tracker instanceof TrackerGroup) { + output += tracker.debug(depth + 1) + } else { + output += indent + ' ' + tracker.name + ': ' + tracker.completed() + '\n' + } + }) + return output +} diff --git a/server/node_modules/are-we-there-yet/tracker-stream.js b/server/node_modules/are-we-there-yet/tracker-stream.js new file mode 100644 index 0000000..41c4729 --- /dev/null +++ b/server/node_modules/are-we-there-yet/tracker-stream.js @@ -0,0 +1,36 @@ +'use strict' +var util = require('util') +var stream = require('readable-stream') +var delegate = require('delegates') +var Tracker = require('are-we-there-yet/tracker.js') + +var TrackerStream = module.exports = function (name, size, options) { + stream.Transform.call(this, options) + this.tracker = new Tracker(name, size) + this.name = name + this.id = this.tracker.id + this.tracker.on('change', delegateChange(this)) +} +util.inherits(TrackerStream, stream.Transform) + +function delegateChange (trackerStream) { + return function (name, completion, tracker) { + trackerStream.emit('change', name, completion, trackerStream) + } +} + +TrackerStream.prototype._transform = function (data, encoding, cb) { + this.tracker.completeWork(data.length ? data.length : 1) + this.push(data) + cb() +} + +TrackerStream.prototype._flush = function (cb) { + this.tracker.finish() + cb() +} + +delegate(TrackerStream.prototype, 'tracker') + .method('completed') + .method('addWork') + .method('finish') diff --git a/server/node_modules/are-we-there-yet/tracker.js b/server/node_modules/are-we-there-yet/tracker.js new file mode 100644 index 0000000..e319c9f --- /dev/null +++ b/server/node_modules/are-we-there-yet/tracker.js @@ -0,0 +1,30 @@ +'use strict' +var util = require('util') +var TrackerBase = require('are-we-there-yet/tracker-base.js') + +var Tracker = module.exports = function (name, todo) { + TrackerBase.call(this, name) + this.workDone = 0 + this.workTodo = todo || 0 +} +util.inherits(Tracker, TrackerBase) + +Tracker.prototype.completed = function () { + return this.workTodo === 0 ? 0 : this.workDone / this.workTodo +} + +Tracker.prototype.addWork = function (work) { + this.workTodo += work + this.emit('change', this.name, this.completed(), this) +} + +Tracker.prototype.completeWork = function (work) { + this.workDone += work + if (this.workDone > this.workTodo) this.workDone = this.workTodo + this.emit('change', this.name, this.completed(), this) +} + +Tracker.prototype.finish = function () { + this.workTodo = this.workDone = 1 + this.emit('change', this.name, 1, this) +} diff --git a/server/node_modules/array-flatten/LICENSE b/server/node_modules/array-flatten/LICENSE new file mode 100644 index 0000000..983fbe8 --- /dev/null +++ b/server/node_modules/array-flatten/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/server/node_modules/array-flatten/README.md b/server/node_modules/array-flatten/README.md new file mode 100644 index 0000000..91fa5b6 --- /dev/null +++ b/server/node_modules/array-flatten/README.md @@ -0,0 +1,43 @@ +# Array Flatten + +[![NPM version][npm-image]][npm-url] +[![NPM downloads][downloads-image]][downloads-url] +[![Build status][travis-image]][travis-url] +[![Test coverage][coveralls-image]][coveralls-url] + +> Flatten an array of nested arrays into a single flat array. Accepts an optional depth. + +## Installation + +``` +npm install array-flatten --save +``` + +## Usage + +```javascript +var flatten = require('array-flatten') + +flatten([1, [2, [3, [4, [5], 6], 7], 8], 9]) +//=> [1, 2, 3, 4, 5, 6, 7, 8, 9] + +flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2) +//=> [1, 2, 3, [4, [5], 6], 7, 8, 9] + +(function () { + flatten(arguments) //=> [1, 2, 3] +})(1, [2, 3]) +``` + +## License + +MIT + +[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat +[npm-url]: https://npmjs.org/package/array-flatten +[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat +[downloads-url]: https://npmjs.org/package/array-flatten +[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat +[travis-url]: https://travis-ci.org/blakeembrey/array-flatten +[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat +[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master diff --git a/server/node_modules/array-flatten/array-flatten.js b/server/node_modules/array-flatten/array-flatten.js new file mode 100644 index 0000000..089117b --- /dev/null +++ b/server/node_modules/array-flatten/array-flatten.js @@ -0,0 +1,64 @@ +'use strict' + +/** + * Expose `arrayFlatten`. + */ +module.exports = arrayFlatten + +/** + * Recursive flatten function with depth. + * + * @param {Array} array + * @param {Array} result + * @param {Number} depth + * @return {Array} + */ +function flattenWithDepth (array, result, depth) { + for (var i = 0; i < array.length; i++) { + var value = array[i] + + if (depth > 0 && Array.isArray(value)) { + flattenWithDepth(value, result, depth - 1) + } else { + result.push(value) + } + } + + return result +} + +/** + * Recursive flatten function. Omitting depth is slightly faster. + * + * @param {Array} array + * @param {Array} result + * @return {Array} + */ +function flattenForever (array, result) { + for (var i = 0; i < array.length; i++) { + var value = array[i] + + if (Array.isArray(value)) { + flattenForever(value, result) + } else { + result.push(value) + } + } + + return result +} + +/** + * Flatten an array, with the ability to define a depth. + * + * @param {Array} array + * @param {Number} depth + * @return {Array} + */ +function arrayFlatten (array, depth) { + if (depth == null) { + return flattenForever(array, []) + } + + return flattenWithDepth(array, [], depth) +} diff --git a/server/node_modules/array-flatten/package.json b/server/node_modules/array-flatten/package.json new file mode 100644 index 0000000..c8c1b23 --- /dev/null +++ b/server/node_modules/array-flatten/package.json @@ -0,0 +1,64 @@ +{ + "_from": "array-flatten@1.1.1", + "_id": "array-flatten@1.1.1", + "_inBundle": false, + "_integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", + "_location": "/array-flatten", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "array-flatten@1.1.1", + "name": "array-flatten", + "escapedName": "array-flatten", + "rawSpec": "1.1.1", + "saveSpec": null, + "fetchSpec": "1.1.1" + }, + "_requiredBy": [ + "/express" + ], + "_resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "_shasum": "9a5f699051b1e7073328f2a008968b64ea2955d2", + "_spec": "array-flatten@1.1.1", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/express", + "author": { + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + }, + "bugs": { + "url": "https://github.com/blakeembrey/array-flatten/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Flatten an array of nested arrays into a single flat array", + "devDependencies": { + "istanbul": "^0.3.13", + "mocha": "^2.2.4", + "pre-commit": "^1.0.7", + "standard": "^3.7.3" + }, + "files": [ + "array-flatten.js", + "LICENSE" + ], + "homepage": "https://github.com/blakeembrey/array-flatten", + "keywords": [ + "array", + "flatten", + "arguments", + "depth" + ], + "license": "MIT", + "main": "array-flatten.js", + "name": "array-flatten", + "repository": { + "type": "git", + "url": "git://github.com/blakeembrey/array-flatten.git" + }, + "scripts": { + "test": "istanbul cover _mocha -- -R spec" + }, + "version": "1.1.1" +} diff --git a/server/node_modules/balanced-match/.github/FUNDING.yml b/server/node_modules/balanced-match/.github/FUNDING.yml new file mode 100644 index 0000000..cea8b16 --- /dev/null +++ b/server/node_modules/balanced-match/.github/FUNDING.yml @@ -0,0 +1,2 @@ +tidelift: "npm/balanced-match" +patreon: juliangruber diff --git a/server/node_modules/balanced-match/LICENSE.md b/server/node_modules/balanced-match/LICENSE.md new file mode 100644 index 0000000..2cdc8e4 --- /dev/null +++ b/server/node_modules/balanced-match/LICENSE.md @@ -0,0 +1,21 @@ +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/server/node_modules/balanced-match/README.md b/server/node_modules/balanced-match/README.md new file mode 100644 index 0000000..d2a48b6 --- /dev/null +++ b/server/node_modules/balanced-match/README.md @@ -0,0 +1,97 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. + +### var r = balanced.range(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +array with indexes: `[ , ]`. + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/server/node_modules/balanced-match/index.js b/server/node_modules/balanced-match/index.js new file mode 100644 index 0000000..c67a646 --- /dev/null +++ b/server/node_modules/balanced-match/index.js @@ -0,0 +1,62 @@ +'use strict'; +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} diff --git a/server/node_modules/balanced-match/package.json b/server/node_modules/balanced-match/package.json new file mode 100644 index 0000000..f3dd350 --- /dev/null +++ b/server/node_modules/balanced-match/package.json @@ -0,0 +1,76 @@ +{ + "_from": "balanced-match@^1.0.0", + "_id": "balanced-match@1.0.2", + "_inBundle": false, + "_integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "_location": "/balanced-match", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "balanced-match@^1.0.0", + "name": "balanced-match", + "escapedName": "balanced-match", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/brace-expansion" + ], + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "_shasum": "e83e3a7e3f300b34cb9d87f615fa0cbf357690ee", + "_spec": "balanced-match@^1.0.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/brace-expansion", + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "bugs": { + "url": "https://github.com/juliangruber/balanced-match/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "license": "MIT", + "main": "index.js", + "name": "balanced-match", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "scripts": { + "bench": "matcha test/bench.js", + "test": "tape test/test.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "version": "1.0.2" +} diff --git a/server/node_modules/base64-js/LICENSE b/server/node_modules/base64-js/LICENSE new file mode 100644 index 0000000..6d52b8a --- /dev/null +++ b/server/node_modules/base64-js/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Jameson Little + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/server/node_modules/base64-js/README.md b/server/node_modules/base64-js/README.md new file mode 100644 index 0000000..b42a48f --- /dev/null +++ b/server/node_modules/base64-js/README.md @@ -0,0 +1,34 @@ +base64-js +========= + +`base64-js` does basic base64 encoding/decoding in pure JS. + +[![build status](https://secure.travis-ci.org/beatgammit/base64-js.png)](http://travis-ci.org/beatgammit/base64-js) + +Many browsers already have base64 encoding/decoding functionality, but it is for text data, not all-purpose binary data. + +Sometimes encoding/decoding binary data in the browser is useful, and that is what this module does. + +## install + +With [npm](https://npmjs.org) do: + +`npm install base64-js` and `var base64js = require('base64-js')` + +For use in web browsers do: + +`` + +[Get supported base64-js with the Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-base64-js?utm_source=npm-base64-js&utm_medium=referral&utm_campaign=readme) + +## methods + +`base64js` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument. + +* `byteLength` - Takes a base64 string and returns length of byte array +* `toByteArray` - Takes a base64 string and returns a byte array +* `fromByteArray` - Takes a byte array and returns a base64 string + +## license + +MIT diff --git a/server/node_modules/base64-js/base64js.min.js b/server/node_modules/base64-js/base64js.min.js new file mode 100644 index 0000000..908ac83 --- /dev/null +++ b/server/node_modules/base64-js/base64js.min.js @@ -0,0 +1 @@ +(function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,b.base64js=a()}})(function(){return function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c>16,j[k++]=255&b>>8,j[k++]=255&b;return 2===h&&(b=l[a.charCodeAt(c)]<<2|l[a.charCodeAt(c+1)]>>4,j[k++]=255&b),1===h&&(b=l[a.charCodeAt(c)]<<10|l[a.charCodeAt(c+1)]<<4|l[a.charCodeAt(c+2)]>>2,j[k++]=255&b>>8,j[k++]=255&b),j}function g(a){return k[63&a>>18]+k[63&a>>12]+k[63&a>>6]+k[63&a]}function h(a,b,c){for(var d,e=[],f=b;fj?j:g+f));return 1===d?(b=a[c-1],e.push(k[b>>2]+k[63&b<<4]+"==")):2===d&&(b=(a[c-2]<<8)+a[c-1],e.push(k[b>>10]+k[63&b>>4]+k[63&b<<2]+"=")),e.join("")}c.byteLength=function(a){var b=d(a),c=b[0],e=b[1];return 3*(c+e)/4-e},c.toByteArray=f,c.fromByteArray=j;for(var k=[],l=[],m="undefined"==typeof Uint8Array?Array:Uint8Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,p=n.length;o 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len + + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) + + return [validLen, placeHoldersLen] +} + +// base64 is 4/3 + up to two characters of the original data +function byteLength (b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function _byteLength (b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function toByteArray (b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) + + var curByte = 0 + + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen + + var i + for (i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + return arr +} + +function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + + lookup[num >> 12 & 0x3F] + + lookup[num >> 6 & 0x3F] + + lookup[num & 0x3F] +} + +function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + output.push(tripletToBase64(tmp)) + } + return output.join('') +} + +function fromByteArray (uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) + } + + return parts.join('') +} diff --git a/server/node_modules/base64-js/package.json b/server/node_modules/base64-js/package.json new file mode 100644 index 0000000..d863ff9 --- /dev/null +++ b/server/node_modules/base64-js/package.json @@ -0,0 +1,75 @@ +{ + "_from": "base64-js@^1.3.1", + "_id": "base64-js@1.5.1", + "_inBundle": false, + "_integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "_location": "/base64-js", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "base64-js@^1.3.1", + "name": "base64-js", + "escapedName": "base64-js", + "rawSpec": "^1.3.1", + "saveSpec": null, + "fetchSpec": "^1.3.1" + }, + "_requiredBy": [ + "/buffer" + ], + "_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "_shasum": "1b1b440160a5bf7ad40b650f095963481903930a", + "_spec": "base64-js@^1.3.1", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/buffer", + "author": { + "name": "T. Jameson Little", + "email": "t.jameson.little@gmail.com" + }, + "bugs": { + "url": "https://github.com/beatgammit/base64-js/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Base64 encoding/decoding in pure JS", + "devDependencies": { + "babel-minify": "^0.5.1", + "benchmark": "^2.1.4", + "browserify": "^16.3.0", + "standard": "*", + "tape": "4.x" + }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "homepage": "https://github.com/beatgammit/base64-js", + "keywords": [ + "base64" + ], + "license": "MIT", + "main": "index.js", + "name": "base64-js", + "repository": { + "type": "git", + "url": "git://github.com/beatgammit/base64-js.git" + }, + "scripts": { + "build": "browserify -s base64js -r | minify > base64js.min.js", + "lint": "standard", + "test": "npm run lint && npm run unit", + "unit": "tape test/*.js" + }, + "typings": "index.d.ts", + "version": "1.5.1" +} diff --git a/server/node_modules/binary-extensions/binary-extensions.json b/server/node_modules/binary-extensions/binary-extensions.json new file mode 100644 index 0000000..4aab383 --- /dev/null +++ b/server/node_modules/binary-extensions/binary-extensions.json @@ -0,0 +1,260 @@ +[ + "3dm", + "3ds", + "3g2", + "3gp", + "7z", + "a", + "aac", + "adp", + "ai", + "aif", + "aiff", + "alz", + "ape", + "apk", + "appimage", + "ar", + "arj", + "asf", + "au", + "avi", + "bak", + "baml", + "bh", + "bin", + "bk", + "bmp", + "btif", + "bz2", + "bzip2", + "cab", + "caf", + "cgm", + "class", + "cmx", + "cpio", + "cr2", + "cur", + "dat", + "dcm", + "deb", + "dex", + "djvu", + "dll", + "dmg", + "dng", + "doc", + "docm", + "docx", + "dot", + "dotm", + "dra", + "DS_Store", + "dsk", + "dts", + "dtshd", + "dvb", + "dwg", + "dxf", + "ecelp4800", + "ecelp7470", + "ecelp9600", + "egg", + "eol", + "eot", + "epub", + "exe", + "f4v", + "fbs", + "fh", + "fla", + "flac", + "flatpak", + "fli", + "flv", + "fpx", + "fst", + "fvt", + "g3", + "gh", + "gif", + "graffle", + "gz", + "gzip", + "h261", + "h263", + "h264", + "icns", + "ico", + "ief", + "img", + "ipa", + "iso", + "jar", + "jpeg", + "jpg", + "jpgv", + "jpm", + "jxr", + "key", + "ktx", + "lha", + "lib", + "lvp", + "lz", + "lzh", + "lzma", + "lzo", + "m3u", + "m4a", + "m4v", + "mar", + "mdi", + "mht", + "mid", + "midi", + "mj2", + "mka", + "mkv", + "mmr", + "mng", + "mobi", + "mov", + "movie", + "mp3", + "mp4", + "mp4a", + "mpeg", + "mpg", + "mpga", + "mxu", + "nef", + "npx", + "numbers", + "nupkg", + "o", + "odp", + "ods", + "odt", + "oga", + "ogg", + "ogv", + "otf", + "ott", + "pages", + "pbm", + "pcx", + "pdb", + "pdf", + "pea", + "pgm", + "pic", + "png", + "pnm", + "pot", + "potm", + "potx", + "ppa", + "ppam", + "ppm", + "pps", + "ppsm", + "ppsx", + "ppt", + "pptm", + "pptx", + "psd", + "pya", + "pyc", + "pyo", + "pyv", + "qt", + "rar", + "ras", + "raw", + "resources", + "rgb", + "rip", + "rlc", + "rmf", + "rmvb", + "rpm", + "rtf", + "rz", + "s3m", + "s7z", + "scpt", + "sgi", + "shar", + "snap", + "sil", + "sketch", + "slk", + "smv", + "snk", + "so", + "stl", + "suo", + "sub", + "swf", + "tar", + "tbz", + "tbz2", + "tga", + "tgz", + "thmx", + "tif", + "tiff", + "tlz", + "ttc", + "ttf", + "txz", + "udf", + "uvh", + "uvi", + "uvm", + "uvp", + "uvs", + "uvu", + "viv", + "vob", + "war", + "wav", + "wax", + "wbmp", + "wdp", + "weba", + "webm", + "webp", + "whl", + "wim", + "wm", + "wma", + "wmv", + "wmx", + "woff", + "woff2", + "wrm", + "wvx", + "xbm", + "xif", + "xla", + "xlam", + "xls", + "xlsb", + "xlsm", + "xlsx", + "xlt", + "xltm", + "xltx", + "xm", + "xmind", + "xpi", + "xpm", + "xwd", + "xz", + "z", + "zip", + "zipx" +] diff --git a/server/node_modules/binary-extensions/binary-extensions.json.d.ts b/server/node_modules/binary-extensions/binary-extensions.json.d.ts new file mode 100644 index 0000000..94a248c --- /dev/null +++ b/server/node_modules/binary-extensions/binary-extensions.json.d.ts @@ -0,0 +1,3 @@ +declare const binaryExtensionsJson: readonly string[]; + +export = binaryExtensionsJson; diff --git a/server/node_modules/binary-extensions/index.d.ts b/server/node_modules/binary-extensions/index.d.ts new file mode 100644 index 0000000..f469ac5 --- /dev/null +++ b/server/node_modules/binary-extensions/index.d.ts @@ -0,0 +1,14 @@ +/** +List of binary file extensions. + +@example +``` +import binaryExtensions = require('binary-extensions'); + +console.log(binaryExtensions); +//=> ['3ds', '3g2', …] +``` +*/ +declare const binaryExtensions: readonly string[]; + +export = binaryExtensions; diff --git a/server/node_modules/binary-extensions/index.js b/server/node_modules/binary-extensions/index.js new file mode 100644 index 0000000..b8922c4 --- /dev/null +++ b/server/node_modules/binary-extensions/index.js @@ -0,0 +1 @@ +module.exports = require('binary-extensions/binary-extensions.json'); diff --git a/server/node_modules/binary-extensions/license b/server/node_modules/binary-extensions/license new file mode 100644 index 0000000..401b1c7 --- /dev/null +++ b/server/node_modules/binary-extensions/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2019 Sindre Sorhus (https://sindresorhus.com), Paul Miller (https://paulmillr.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/binary-extensions/package.json b/server/node_modules/binary-extensions/package.json new file mode 100644 index 0000000..9a0d713 --- /dev/null +++ b/server/node_modules/binary-extensions/package.json @@ -0,0 +1,70 @@ +{ + "_from": "binary-extensions@^2.0.0", + "_id": "binary-extensions@2.2.0", + "_inBundle": false, + "_integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "_location": "/binary-extensions", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "binary-extensions@^2.0.0", + "name": "binary-extensions", + "escapedName": "binary-extensions", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/is-binary-path" + ], + "_resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "_shasum": "75f502eeaf9ffde42fc98829645be4ea76bd9e2d", + "_spec": "binary-extensions@^2.0.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/is-binary-path", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/binary-extensions/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "List of binary file extensions", + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "index.d.ts", + "binary-extensions.json", + "binary-extensions.json.d.ts" + ], + "homepage": "https://github.com/sindresorhus/binary-extensions#readme", + "keywords": [ + "binary", + "extensions", + "extension", + "file", + "json", + "list", + "array" + ], + "license": "MIT", + "name": "binary-extensions", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/binary-extensions.git" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "version": "2.2.0" +} diff --git a/server/node_modules/binary-extensions/readme.md b/server/node_modules/binary-extensions/readme.md new file mode 100644 index 0000000..3e25dd8 --- /dev/null +++ b/server/node_modules/binary-extensions/readme.md @@ -0,0 +1,41 @@ +# binary-extensions + +> List of binary file extensions + +The list is just a [JSON file](binary-extensions.json) and can be used anywhere. + + +## Install + +``` +$ npm install binary-extensions +``` + + +## Usage + +```js +const binaryExtensions = require('binary-extensions'); + +console.log(binaryExtensions); +//=> ['3ds', '3g2', …] +``` + + +## Related + +- [is-binary-path](https://github.com/sindresorhus/is-binary-path) - Check if a filepath is a binary file +- [text-extensions](https://github.com/sindresorhus/text-extensions) - List of text file extensions + + +--- + + diff --git a/server/node_modules/bindings/LICENSE.md b/server/node_modules/bindings/LICENSE.md new file mode 100644 index 0000000..5a92289 --- /dev/null +++ b/server/node_modules/bindings/LICENSE.md @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/bindings/README.md b/server/node_modules/bindings/README.md new file mode 100644 index 0000000..5b3e7a8 --- /dev/null +++ b/server/node_modules/bindings/README.md @@ -0,0 +1,98 @@ +node-bindings +============= +### Helper module for loading your native module's `.node` file + +This is a helper module for authors of Node.js native addon modules. +It is basically the "swiss army knife" of `require()`ing your native module's +`.node` file. + +Throughout the course of Node's native addon history, addons have ended up being +compiled in a variety of different places, depending on which build tool and which +version of node was used. To make matters worse, now the `gyp` build tool can +produce either a __Release__ or __Debug__ build, each being built into different +locations. + +This module checks _all_ the possible locations that a native addon would be built +at, and returns the first one that loads successfully. + + +Installation +------------ + +Install with `npm`: + +``` bash +$ npm install --save bindings +``` + +Or add it to the `"dependencies"` section of your `package.json` file. + + +Example +------- + +`require()`ing the proper bindings file for the current node version, platform +and architecture is as simple as: + +``` js +var bindings = require('bindings')('binding.node') + +// Use your bindings defined in your C files +bindings.your_c_function() +``` + + +Nice Error Output +----------------- + +When the `.node` file could not be loaded, `node-bindings` throws an Error with +a nice error message telling you exactly what was tried. You can also check the +`err.tries` Array property. + +``` +Error: Could not load the bindings file. Tried: + → /Users/nrajlich/ref/build/binding.node + → /Users/nrajlich/ref/build/Debug/binding.node + → /Users/nrajlich/ref/build/Release/binding.node + → /Users/nrajlich/ref/out/Debug/binding.node + → /Users/nrajlich/ref/Debug/binding.node + → /Users/nrajlich/ref/out/Release/binding.node + → /Users/nrajlich/ref/Release/binding.node + → /Users/nrajlich/ref/build/default/binding.node + → /Users/nrajlich/ref/compiled/0.8.2/darwin/x64/binding.node + at bindings (/Users/nrajlich/ref/node_modules/bindings/bindings.js:84:13) + at Object. (/Users/nrajlich/ref/lib/ref.js:5:47) + at Module._compile (module.js:449:26) + at Object.Module._extensions..js (module.js:467:10) + at Module.load (module.js:356:32) + at Function.Module._load (module.js:312:12) + ... +``` + +The searching for the `.node` file will originate from the first directory in which has a `package.json` file is found. + +License +------- + +(The MIT License) + +Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/bindings/bindings.js b/server/node_modules/bindings/bindings.js new file mode 100644 index 0000000..727413a --- /dev/null +++ b/server/node_modules/bindings/bindings.js @@ -0,0 +1,221 @@ +/** + * Module dependencies. + */ + +var fs = require('fs'), + path = require('path'), + fileURLToPath = require('file-uri-to-path'), + join = path.join, + dirname = path.dirname, + exists = + (fs.accessSync && + function(path) { + try { + fs.accessSync(path); + } catch (e) { + return false; + } + return true; + }) || + fs.existsSync || + path.existsSync, + defaults = { + arrow: process.env.NODE_BINDINGS_ARROW || ' → ', + compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled', + platform: process.platform, + arch: process.arch, + nodePreGyp: + 'node-v' + + process.versions.modules + + '-' + + process.platform + + '-' + + process.arch, + version: process.versions.node, + bindings: 'bindings.node', + try: [ + // node-gyp's linked version in the "build" dir + ['module_root', 'build', 'bindings'], + // node-waf and gyp_addon (a.k.a node-gyp) + ['module_root', 'build', 'Debug', 'bindings'], + ['module_root', 'build', 'Release', 'bindings'], + // Debug files, for development (legacy behavior, remove for node v0.9) + ['module_root', 'out', 'Debug', 'bindings'], + ['module_root', 'Debug', 'bindings'], + // Release files, but manually compiled (legacy behavior, remove for node v0.9) + ['module_root', 'out', 'Release', 'bindings'], + ['module_root', 'Release', 'bindings'], + // Legacy from node-waf, node <= 0.4.x + ['module_root', 'build', 'default', 'bindings'], + // Production "Release" buildtype binary (meh...) + ['module_root', 'compiled', 'version', 'platform', 'arch', 'bindings'], + // node-qbs builds + ['module_root', 'addon-build', 'release', 'install-root', 'bindings'], + ['module_root', 'addon-build', 'debug', 'install-root', 'bindings'], + ['module_root', 'addon-build', 'default', 'install-root', 'bindings'], + // node-pre-gyp path ./lib/binding/{node_abi}-{platform}-{arch} + ['module_root', 'lib', 'binding', 'nodePreGyp', 'bindings'] + ] + }; + +/** + * The main `bindings()` function loads the compiled bindings for a given module. + * It uses V8's Error API to determine the parent filename that this function is + * being invoked from, which is then used to find the root directory. + */ + +function bindings(opts) { + // Argument surgery + if (typeof opts == 'string') { + opts = { bindings: opts }; + } else if (!opts) { + opts = {}; + } + + // maps `defaults` onto `opts` object + Object.keys(defaults).map(function(i) { + if (!(i in opts)) opts[i] = defaults[i]; + }); + + // Get the module root + if (!opts.module_root) { + opts.module_root = exports.getRoot(exports.getFileName()); + } + + // Ensure the given bindings name ends with .node + if (path.extname(opts.bindings) != '.node') { + opts.bindings += '.node'; + } + + // https://github.com/webpack/webpack/issues/4175#issuecomment-342931035 + var requireFunc = + typeof __webpack_require__ === 'function' + ? __non_webpack_require__ + : require; + + var tries = [], + i = 0, + l = opts.try.length, + n, + b, + err; + + for (; i < l; i++) { + n = join.apply( + null, + opts.try[i].map(function(p) { + return opts[p] || p; + }) + ); + tries.push(n); + try { + b = opts.path ? requireFunc.resolve(n) : requireFunc(n); + if (!opts.path) { + b.path = n; + } + return b; + } catch (e) { + if (e.code !== 'MODULE_NOT_FOUND' && + e.code !== 'QUALIFIED_PATH_RESOLUTION_FAILED' && + !/not find/i.test(e.message)) { + throw e; + } + } + } + + err = new Error( + 'Could not locate the bindings file. Tried:\n' + + tries + .map(function(a) { + return opts.arrow + a; + }) + .join('\n') + ); + err.tries = tries; + throw err; +} +module.exports = exports = bindings; + +/** + * Gets the filename of the JavaScript file that invokes this function. + * Used to help find the root directory of a module. + * Optionally accepts an filename argument to skip when searching for the invoking filename + */ + +exports.getFileName = function getFileName(calling_file) { + var origPST = Error.prepareStackTrace, + origSTL = Error.stackTraceLimit, + dummy = {}, + fileName; + + Error.stackTraceLimit = 10; + + Error.prepareStackTrace = function(e, st) { + for (var i = 0, l = st.length; i < l; i++) { + fileName = st[i].getFileName(); + if (fileName !== __filename) { + if (calling_file) { + if (fileName !== calling_file) { + return; + } + } else { + return; + } + } + } + }; + + // run the 'prepareStackTrace' function above + Error.captureStackTrace(dummy); + dummy.stack; + + // cleanup + Error.prepareStackTrace = origPST; + Error.stackTraceLimit = origSTL; + + // handle filename that starts with "file://" + var fileSchema = 'file://'; + if (fileName.indexOf(fileSchema) === 0) { + fileName = fileURLToPath(fileName); + } + + return fileName; +}; + +/** + * Gets the root directory of a module, given an arbitrary filename + * somewhere in the module tree. The "root directory" is the directory + * containing the `package.json` file. + * + * In: /home/nate/node-native-module/lib/index.js + * Out: /home/nate/node-native-module + */ + +exports.getRoot = function getRoot(file) { + var dir = dirname(file), + prev; + while (true) { + if (dir === '.') { + // Avoids an infinite loop in rare cases, like the REPL + dir = process.cwd(); + } + if ( + exists(join(dir, 'package.json')) || + exists(join(dir, 'node_modules')) + ) { + // Found the 'package.json' file or 'node_modules' dir; we're done + return dir; + } + if (prev === dir) { + // Got to the top + throw new Error( + 'Could not find module root given file: "' + + file + + '". Do you have a `package.json` file? ' + ); + } + // Try the parent dir next + prev = dir; + dir = join(dir, '..'); + } +}; diff --git a/server/node_modules/bindings/package.json b/server/node_modules/bindings/package.json new file mode 100644 index 0000000..f210cff --- /dev/null +++ b/server/node_modules/bindings/package.json @@ -0,0 +1,57 @@ +{ + "_from": "bindings@^1.5.0", + "_id": "bindings@1.5.0", + "_inBundle": false, + "_integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "_location": "/bindings", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "bindings@^1.5.0", + "name": "bindings", + "escapedName": "bindings", + "rawSpec": "^1.5.0", + "saveSpec": null, + "fetchSpec": "^1.5.0" + }, + "_requiredBy": [ + "/@serialport/bindings" + ], + "_resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "_shasum": "10353c9e945334bc0511a6d90b38fbc7c9c504df", + "_spec": "bindings@^1.5.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/@serialport/bindings", + "author": { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://tootallnate.net" + }, + "bugs": { + "url": "https://github.com/TooTallNate/node-bindings/issues" + }, + "bundleDependencies": false, + "dependencies": { + "file-uri-to-path": "1.0.0" + }, + "deprecated": false, + "description": "Helper module for loading your native module's .node file", + "homepage": "https://github.com/TooTallNate/node-bindings", + "keywords": [ + "native", + "addon", + "bindings", + "gyp", + "waf", + "c", + "c++" + ], + "license": "MIT", + "main": "./bindings.js", + "name": "bindings", + "repository": { + "type": "git", + "url": "git://github.com/TooTallNate/node-bindings.git" + }, + "version": "1.5.0" +} diff --git a/server/node_modules/bl/.travis.yml b/server/node_modules/bl/.travis.yml new file mode 100644 index 0000000..016eaf5 --- /dev/null +++ b/server/node_modules/bl/.travis.yml @@ -0,0 +1,17 @@ +sudo: false +arch: + - amd64 + - ppc64le +language: node_js +node_js: + - '6' + - '8' + - '10' + - '12' + - '14' + - '15' + - lts/* +notifications: + email: + - rod@vagg.org + - matteo.collina@gmail.com diff --git a/server/node_modules/bl/BufferList.js b/server/node_modules/bl/BufferList.js new file mode 100644 index 0000000..471ee77 --- /dev/null +++ b/server/node_modules/bl/BufferList.js @@ -0,0 +1,396 @@ +'use strict' + +const { Buffer } = require('buffer') +const symbol = Symbol.for('BufferList') + +function BufferList (buf) { + if (!(this instanceof BufferList)) { + return new BufferList(buf) + } + + BufferList._init.call(this, buf) +} + +BufferList._init = function _init (buf) { + Object.defineProperty(this, symbol, { value: true }) + + this._bufs = [] + this.length = 0 + + if (buf) { + this.append(buf) + } +} + +BufferList.prototype._new = function _new (buf) { + return new BufferList(buf) +} + +BufferList.prototype._offset = function _offset (offset) { + if (offset === 0) { + return [0, 0] + } + + let tot = 0 + + for (let i = 0; i < this._bufs.length; i++) { + const _t = tot + this._bufs[i].length + if (offset < _t || i === this._bufs.length - 1) { + return [i, offset - tot] + } + tot = _t + } +} + +BufferList.prototype._reverseOffset = function (blOffset) { + const bufferId = blOffset[0] + let offset = blOffset[1] + + for (let i = 0; i < bufferId; i++) { + offset += this._bufs[i].length + } + + return offset +} + +BufferList.prototype.get = function get (index) { + if (index > this.length || index < 0) { + return undefined + } + + const offset = this._offset(index) + + return this._bufs[offset[0]][offset[1]] +} + +BufferList.prototype.slice = function slice (start, end) { + if (typeof start === 'number' && start < 0) { + start += this.length + } + + if (typeof end === 'number' && end < 0) { + end += this.length + } + + return this.copy(null, 0, start, end) +} + +BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) { + if (typeof srcStart !== 'number' || srcStart < 0) { + srcStart = 0 + } + + if (typeof srcEnd !== 'number' || srcEnd > this.length) { + srcEnd = this.length + } + + if (srcStart >= this.length) { + return dst || Buffer.alloc(0) + } + + if (srcEnd <= 0) { + return dst || Buffer.alloc(0) + } + + const copy = !!dst + const off = this._offset(srcStart) + const len = srcEnd - srcStart + let bytes = len + let bufoff = (copy && dstStart) || 0 + let start = off[1] + + // copy/slice everything + if (srcStart === 0 && srcEnd === this.length) { + if (!copy) { + // slice, but full concat if multiple buffers + return this._bufs.length === 1 + ? this._bufs[0] + : Buffer.concat(this._bufs, this.length) + } + + // copy, need to copy individual buffers + for (let i = 0; i < this._bufs.length; i++) { + this._bufs[i].copy(dst, bufoff) + bufoff += this._bufs[i].length + } + + return dst + } + + // easy, cheap case where it's a subset of one of the buffers + if (bytes <= this._bufs[off[0]].length - start) { + return copy + ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) + : this._bufs[off[0]].slice(start, start + bytes) + } + + if (!copy) { + // a slice, we need something to copy in to + dst = Buffer.allocUnsafe(len) + } + + for (let i = off[0]; i < this._bufs.length; i++) { + const l = this._bufs[i].length - start + + if (bytes > l) { + this._bufs[i].copy(dst, bufoff, start) + bufoff += l + } else { + this._bufs[i].copy(dst, bufoff, start, start + bytes) + bufoff += l + break + } + + bytes -= l + + if (start) { + start = 0 + } + } + + // safeguard so that we don't return uninitialized memory + if (dst.length > bufoff) return dst.slice(0, bufoff) + + return dst +} + +BufferList.prototype.shallowSlice = function shallowSlice (start, end) { + start = start || 0 + end = typeof end !== 'number' ? this.length : end + + if (start < 0) { + start += this.length + } + + if (end < 0) { + end += this.length + } + + if (start === end) { + return this._new() + } + + const startOffset = this._offset(start) + const endOffset = this._offset(end) + const buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1) + + if (endOffset[1] === 0) { + buffers.pop() + } else { + buffers[buffers.length - 1] = buffers[buffers.length - 1].slice(0, endOffset[1]) + } + + if (startOffset[1] !== 0) { + buffers[0] = buffers[0].slice(startOffset[1]) + } + + return this._new(buffers) +} + +BufferList.prototype.toString = function toString (encoding, start, end) { + return this.slice(start, end).toString(encoding) +} + +BufferList.prototype.consume = function consume (bytes) { + // first, normalize the argument, in accordance with how Buffer does it + bytes = Math.trunc(bytes) + // do nothing if not a positive number + if (Number.isNaN(bytes) || bytes <= 0) return this + + while (this._bufs.length) { + if (bytes >= this._bufs[0].length) { + bytes -= this._bufs[0].length + this.length -= this._bufs[0].length + this._bufs.shift() + } else { + this._bufs[0] = this._bufs[0].slice(bytes) + this.length -= bytes + break + } + } + + return this +} + +BufferList.prototype.duplicate = function duplicate () { + const copy = this._new() + + for (let i = 0; i < this._bufs.length; i++) { + copy.append(this._bufs[i]) + } + + return copy +} + +BufferList.prototype.append = function append (buf) { + if (buf == null) { + return this + } + + if (buf.buffer) { + // append a view of the underlying ArrayBuffer + this._appendBuffer(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)) + } else if (Array.isArray(buf)) { + for (let i = 0; i < buf.length; i++) { + this.append(buf[i]) + } + } else if (this._isBufferList(buf)) { + // unwrap argument into individual BufferLists + for (let i = 0; i < buf._bufs.length; i++) { + this.append(buf._bufs[i]) + } + } else { + // coerce number arguments to strings, since Buffer(number) does + // uninitialized memory allocation + if (typeof buf === 'number') { + buf = buf.toString() + } + + this._appendBuffer(Buffer.from(buf)) + } + + return this +} + +BufferList.prototype._appendBuffer = function appendBuffer (buf) { + this._bufs.push(buf) + this.length += buf.length +} + +BufferList.prototype.indexOf = function (search, offset, encoding) { + if (encoding === undefined && typeof offset === 'string') { + encoding = offset + offset = undefined + } + + if (typeof search === 'function' || Array.isArray(search)) { + throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.') + } else if (typeof search === 'number') { + search = Buffer.from([search]) + } else if (typeof search === 'string') { + search = Buffer.from(search, encoding) + } else if (this._isBufferList(search)) { + search = search.slice() + } else if (Array.isArray(search.buffer)) { + search = Buffer.from(search.buffer, search.byteOffset, search.byteLength) + } else if (!Buffer.isBuffer(search)) { + search = Buffer.from(search) + } + + offset = Number(offset || 0) + + if (isNaN(offset)) { + offset = 0 + } + + if (offset < 0) { + offset = this.length + offset + } + + if (offset < 0) { + offset = 0 + } + + if (search.length === 0) { + return offset > this.length ? this.length : offset + } + + const blOffset = this._offset(offset) + let blIndex = blOffset[0] // index of which internal buffer we're working on + let buffOffset = blOffset[1] // offset of the internal buffer we're working on + + // scan over each buffer + for (; blIndex < this._bufs.length; blIndex++) { + const buff = this._bufs[blIndex] + + while (buffOffset < buff.length) { + const availableWindow = buff.length - buffOffset + + if (availableWindow >= search.length) { + const nativeSearchResult = buff.indexOf(search, buffOffset) + + if (nativeSearchResult !== -1) { + return this._reverseOffset([blIndex, nativeSearchResult]) + } + + buffOffset = buff.length - search.length + 1 // end of native search window + } else { + const revOffset = this._reverseOffset([blIndex, buffOffset]) + + if (this._match(revOffset, search)) { + return revOffset + } + + buffOffset++ + } + } + + buffOffset = 0 + } + + return -1 +} + +BufferList.prototype._match = function (offset, search) { + if (this.length - offset < search.length) { + return false + } + + for (let searchOffset = 0; searchOffset < search.length; searchOffset++) { + if (this.get(offset + searchOffset) !== search[searchOffset]) { + return false + } + } + return true +} + +;(function () { + const methods = { + readDoubleBE: 8, + readDoubleLE: 8, + readFloatBE: 4, + readFloatLE: 4, + readInt32BE: 4, + readInt32LE: 4, + readUInt32BE: 4, + readUInt32LE: 4, + readInt16BE: 2, + readInt16LE: 2, + readUInt16BE: 2, + readUInt16LE: 2, + readInt8: 1, + readUInt8: 1, + readIntBE: null, + readIntLE: null, + readUIntBE: null, + readUIntLE: null + } + + for (const m in methods) { + (function (m) { + if (methods[m] === null) { + BufferList.prototype[m] = function (offset, byteLength) { + return this.slice(offset, offset + byteLength)[m](0, byteLength) + } + } else { + BufferList.prototype[m] = function (offset = 0) { + return this.slice(offset, offset + methods[m])[m](0) + } + } + }(m)) + } +}()) + +// Used internally by the class and also as an indicator of this object being +// a `BufferList`. It's not possible to use `instanceof BufferList` in a browser +// environment because there could be multiple different copies of the +// BufferList class and some `BufferList`s might be `BufferList`s. +BufferList.prototype._isBufferList = function _isBufferList (b) { + return b instanceof BufferList || BufferList.isBufferList(b) +} + +BufferList.isBufferList = function isBufferList (b) { + return b != null && b[symbol] +} + +module.exports = BufferList diff --git a/server/node_modules/bl/LICENSE.md b/server/node_modules/bl/LICENSE.md new file mode 100644 index 0000000..ecbe516 --- /dev/null +++ b/server/node_modules/bl/LICENSE.md @@ -0,0 +1,13 @@ +The MIT License (MIT) +===================== + +Copyright (c) 2013-2019 bl contributors +---------------------------------- + +*bl contributors listed at * + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/bl/README.md b/server/node_modules/bl/README.md new file mode 100644 index 0000000..9680b1d --- /dev/null +++ b/server/node_modules/bl/README.md @@ -0,0 +1,247 @@ +# bl *(BufferList)* + +[![Build Status](https://api.travis-ci.com/rvagg/bl.svg?branch=master)](https://travis-ci.com/rvagg/bl/) + +**A Node.js Buffer list collector, reader and streamer thingy.** + +[![NPM](https://nodei.co/npm/bl.svg)](https://nodei.co/npm/bl/) + +**bl** is a storage object for collections of Node Buffers, exposing them with the main Buffer readable API. Also works as a duplex stream so you can collect buffers from a stream that emits them and emit buffers to a stream that consumes them! + +The original buffers are kept intact and copies are only done as necessary. Any reads that require the use of a single original buffer will return a slice of that buffer only (which references the same memory as the original buffer). Reads that span buffers perform concatenation as required and return the results transparently. + +```js +const { BufferList } = require('bl') + +const bl = new BufferList() +bl.append(Buffer.from('abcd')) +bl.append(Buffer.from('efg')) +bl.append('hi') // bl will also accept & convert Strings +bl.append(Buffer.from('j')) +bl.append(Buffer.from([ 0x3, 0x4 ])) + +console.log(bl.length) // 12 + +console.log(bl.slice(0, 10).toString('ascii')) // 'abcdefghij' +console.log(bl.slice(3, 10).toString('ascii')) // 'defghij' +console.log(bl.slice(3, 6).toString('ascii')) // 'def' +console.log(bl.slice(3, 8).toString('ascii')) // 'defgh' +console.log(bl.slice(5, 10).toString('ascii')) // 'fghij' + +console.log(bl.indexOf('def')) // 3 +console.log(bl.indexOf('asdf')) // -1 + +// or just use toString! +console.log(bl.toString()) // 'abcdefghij\u0003\u0004' +console.log(bl.toString('ascii', 3, 8)) // 'defgh' +console.log(bl.toString('ascii', 5, 10)) // 'fghij' + +// other standard Buffer readables +console.log(bl.readUInt16BE(10)) // 0x0304 +console.log(bl.readUInt16LE(10)) // 0x0403 +``` + +Give it a callback in the constructor and use it just like **[concat-stream](https://github.com/maxogden/node-concat-stream)**: + +```js +const { BufferListStream } = require('bl') +const fs = require('fs') + +fs.createReadStream('README.md') + .pipe(BufferListStream((err, data) => { // note 'new' isn't strictly required + // `data` is a complete Buffer object containing the full data + console.log(data.toString()) + })) +``` + +Note that when you use the *callback* method like this, the resulting `data` parameter is a concatenation of all `Buffer` objects in the list. If you want to avoid the overhead of this concatenation (in cases of extreme performance consciousness), then avoid the *callback* method and just listen to `'end'` instead, like a standard Stream. + +Or to fetch a URL using [hyperquest](https://github.com/substack/hyperquest) (should work with [request](http://github.com/mikeal/request) and even plain Node http too!): + +```js +const hyperquest = require('hyperquest') +const { BufferListStream } = require('bl') + +const url = 'https://raw.github.com/rvagg/bl/master/README.md' + +hyperquest(url).pipe(BufferListStream((err, data) => { + console.log(data.toString()) +})) +``` + +Or, use it as a readable stream to recompose a list of Buffers to an output source: + +```js +const { BufferListStream } = require('bl') +const fs = require('fs') + +var bl = new BufferListStream() +bl.append(Buffer.from('abcd')) +bl.append(Buffer.from('efg')) +bl.append(Buffer.from('hi')) +bl.append(Buffer.from('j')) + +bl.pipe(fs.createWriteStream('gibberish.txt')) +``` + +## API + + * new BufferList([ buf ]) + * BufferList.isBufferList(obj) + * bl.length + * bl.append(buffer) + * bl.get(index) + * bl.indexOf(value[, byteOffset][, encoding]) + * bl.slice([ start[, end ] ]) + * bl.shallowSlice([ start[, end ] ]) + * bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ]) + * bl.duplicate() + * bl.consume(bytes) + * bl.toString([encoding, [ start, [ end ]]]) + * bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8() + * new BufferListStream([ callback ]) + +-------------------------------------------------------- + +### new BufferList([ Buffer | Buffer array | BufferList | BufferList array | String ]) +No arguments are _required_ for the constructor, but you can initialise the list by passing in a single `Buffer` object or an array of `Buffer` objects. + +`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with: + +```js +const { BufferList } = require('bl') +const bl = BufferList() + +// equivalent to: + +const { BufferList } = require('bl') +const bl = new BufferList() +``` + +-------------------------------------------------------- + +### BufferList.isBufferList(obj) +Determines if the passed object is a `BufferList`. It will return `true` if the passed object is an instance of `BufferList` **or** `BufferListStream` and `false` otherwise. + +N.B. this won't return `true` for `BufferList` or `BufferListStream` instances created by versions of this library before this static method was added. + +-------------------------------------------------------- + +### bl.length +Get the length of the list in bytes. This is the sum of the lengths of all of the buffers contained in the list, minus any initial offset for a semi-consumed buffer at the beginning. Should accurately represent the total number of bytes that can be read from the list. + +-------------------------------------------------------- + +### bl.append(Buffer | Buffer array | BufferList | BufferList array | String) +`append(buffer)` adds an additional buffer or BufferList to the internal list. `this` is returned so it can be chained. + +-------------------------------------------------------- + +### bl.get(index) +`get()` will return the byte at the specified index. + +-------------------------------------------------------- + +### bl.indexOf(value[, byteOffset][, encoding]) +`get()` will return the byte at the specified index. +`indexOf()` method returns the first index at which a given element can be found in the BufferList, or -1 if it is not present. + +-------------------------------------------------------- + +### bl.slice([ start, [ end ] ]) +`slice()` returns a new `Buffer` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively. + +If the requested range spans a single internal buffer then a slice of that buffer will be returned which shares the original memory range of that Buffer. If the range spans multiple buffers then copy operations will likely occur to give you a uniform Buffer. + +-------------------------------------------------------- + +### bl.shallowSlice([ start, [ end ] ]) +`shallowSlice()` returns a new `BufferList` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively. + +No copies will be performed. All buffers in the result share memory with the original list. + +-------------------------------------------------------- + +### bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ]) +`copy()` copies the content of the list in the `dest` buffer, starting from `destStart` and containing the bytes within the range specified with `srcStart` to `srcEnd`. `destStart`, `start` and `end` are optional and will default to the beginning of the `dest` buffer, and the beginning and end of the list respectively. + +-------------------------------------------------------- + +### bl.duplicate() +`duplicate()` performs a **shallow-copy** of the list. The internal Buffers remains the same, so if you change the underlying Buffers, the change will be reflected in both the original and the duplicate. This method is needed if you want to call `consume()` or `pipe()` and still keep the original list.Example: + +```js +var bl = new BufferListStream() + +bl.append('hello') +bl.append(' world') +bl.append('\n') + +bl.duplicate().pipe(process.stdout, { end: false }) + +console.log(bl.toString()) +``` + +-------------------------------------------------------- + +### bl.consume(bytes) +`consume()` will shift bytes *off the start of the list*. The number of bytes consumed don't need to line up with the sizes of the internal Buffers—initial offsets will be calculated accordingly in order to give you a consistent view of the data. + +-------------------------------------------------------- + +### bl.toString([encoding, [ start, [ end ]]]) +`toString()` will return a string representation of the buffer. The optional `start` and `end` arguments are passed on to `slice()`, while the `encoding` is passed on to `toString()` of the resulting Buffer. See the [Buffer#toString()](http://nodejs.org/docs/latest/api/buffer.html#buffer_buf_tostring_encoding_start_end) documentation for more information. + +-------------------------------------------------------- + +### bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8() + +All of the standard byte-reading methods of the `Buffer` interface are implemented and will operate across internal Buffer boundaries transparently. + +See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work. + +-------------------------------------------------------- + +### new BufferListStream([ callback | Buffer | Buffer array | BufferList | BufferList array | String ]) +**BufferListStream** is a Node **[Duplex Stream](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_duplex)**, so it can be read from and written to like a standard Node stream. You can also `pipe()` to and from a **BufferListStream** instance. + +The constructor takes an optional callback, if supplied, the callback will be called with an error argument followed by a reference to the **bl** instance, when `bl.end()` is called (i.e. from a piped stream). This is a convenient method of collecting the entire contents of a stream, particularly when the stream is *chunky*, such as a network stream. + +Normally, no arguments are required for the constructor, but you can initialise the list by passing in a single `Buffer` object or an array of `Buffer` object. + +`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with: + +```js +const { BufferListStream } = require('bl') +const bl = BufferListStream() + +// equivalent to: + +const { BufferListStream } = require('bl') +const bl = new BufferListStream() +``` + +N.B. For backwards compatibility reasons, `BufferListStream` is the **default** export when you `require('bl')`: + +```js +const { BufferListStream } = require('bl') +// equivalent to: +const BufferListStream = require('bl') +``` + +-------------------------------------------------------- + +## Contributors + +**bl** is brought to you by the following hackers: + + * [Rod Vagg](https://github.com/rvagg) + * [Matteo Collina](https://github.com/mcollina) + * [Jarett Cruger](https://github.com/jcrugzz) + + +## License & copyright + +Copyright (c) 2013-2019 bl contributors (listed above). + +bl is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details. diff --git a/server/node_modules/bl/bl.js b/server/node_modules/bl/bl.js new file mode 100644 index 0000000..f4e437b --- /dev/null +++ b/server/node_modules/bl/bl.js @@ -0,0 +1,84 @@ +'use strict' + +const DuplexStream = require('readable-stream').Duplex +const inherits = require('inherits') +const BufferList = require('bl/BufferList') + +function BufferListStream (callback) { + if (!(this instanceof BufferListStream)) { + return new BufferListStream(callback) + } + + if (typeof callback === 'function') { + this._callback = callback + + const piper = function piper (err) { + if (this._callback) { + this._callback(err) + this._callback = null + } + }.bind(this) + + this.on('pipe', function onPipe (src) { + src.on('error', piper) + }) + this.on('unpipe', function onUnpipe (src) { + src.removeListener('error', piper) + }) + + callback = null + } + + BufferList._init.call(this, callback) + DuplexStream.call(this) +} + +inherits(BufferListStream, DuplexStream) +Object.assign(BufferListStream.prototype, BufferList.prototype) + +BufferListStream.prototype._new = function _new (callback) { + return new BufferListStream(callback) +} + +BufferListStream.prototype._write = function _write (buf, encoding, callback) { + this._appendBuffer(buf) + + if (typeof callback === 'function') { + callback() + } +} + +BufferListStream.prototype._read = function _read (size) { + if (!this.length) { + return this.push(null) + } + + size = Math.min(size, this.length) + this.push(this.slice(0, size)) + this.consume(size) +} + +BufferListStream.prototype.end = function end (chunk) { + DuplexStream.prototype.end.call(this, chunk) + + if (this._callback) { + this._callback(null, this.slice()) + this._callback = null + } +} + +BufferListStream.prototype._destroy = function _destroy (err, cb) { + this._bufs.length = 0 + this.length = 0 + cb(err) +} + +BufferListStream.prototype._isBufferList = function _isBufferList (b) { + return b instanceof BufferListStream || b instanceof BufferList || BufferListStream.isBufferList(b) +} + +BufferListStream.isBufferList = BufferList.isBufferList + +module.exports = BufferListStream +module.exports.BufferListStream = BufferListStream +module.exports.BufferList = BufferList diff --git a/server/node_modules/bl/node_modules/readable-stream/CONTRIBUTING.md b/server/node_modules/bl/node_modules/readable-stream/CONTRIBUTING.md new file mode 100644 index 0000000..f478d58 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/CONTRIBUTING.md @@ -0,0 +1,38 @@ +# Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +* (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +* (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +* (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +* (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. + +## Moderation Policy + +The [Node.js Moderation Policy] applies to this WG. + +## Code of Conduct + +The [Node.js Code of Conduct][] applies to this WG. + +[Node.js Code of Conduct]: +https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md +[Node.js Moderation Policy]: +https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md diff --git a/server/node_modules/bl/node_modules/readable-stream/GOVERNANCE.md b/server/node_modules/bl/node_modules/readable-stream/GOVERNANCE.md new file mode 100644 index 0000000..623a922 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/GOVERNANCE.md @@ -0,0 +1,136 @@ +### Streams Working Group + +The Node.js Streams is jointly governed by a Working Group +(WG) +that is responsible for high-level guidance of the project. + +The WG has final authority over this project including: + +* Technical direction +* Project governance and process (including this policy) +* Contribution policy +* GitHub repository hosting +* Conduct guidelines +* Maintaining the list of additional Collaborators + +For the current list of WG members, see the project +[README.md](README.md#current-project-team-members). + +### Collaborators + +The readable-stream GitHub repository is +maintained by the WG and additional Collaborators who are added by the +WG on an ongoing basis. + +Individuals making significant and valuable contributions are made +Collaborators and given commit-access to the project. These +individuals are identified by the WG and their addition as +Collaborators is discussed during the WG meeting. + +_Note:_ If you make a significant contribution and are not considered +for commit-access log an issue or contact a WG member directly and it +will be brought up in the next WG meeting. + +Modifications of the contents of the readable-stream repository are +made on +a collaborative basis. Anybody with a GitHub account may propose a +modification via pull request and it will be considered by the project +Collaborators. All pull requests must be reviewed and accepted by a +Collaborator with sufficient expertise who is able to take full +responsibility for the change. In the case of pull requests proposed +by an existing Collaborator, an additional Collaborator is required +for sign-off. Consensus should be sought if additional Collaborators +participate and there is disagreement around a particular +modification. See _Consensus Seeking Process_ below for further detail +on the consensus model used for governance. + +Collaborators may opt to elevate significant or controversial +modifications, or modifications that have not found consensus to the +WG for discussion by assigning the ***WG-agenda*** tag to a pull +request or issue. The WG should serve as the final arbiter where +required. + +For the current list of Collaborators, see the project +[README.md](README.md#members). + +### WG Membership + +WG seats are not time-limited. There is no fixed size of the WG. +However, the expected target is between 6 and 12, to ensure adequate +coverage of important areas of expertise, balanced with the ability to +make decisions efficiently. + +There is no specific set of requirements or qualifications for WG +membership beyond these rules. + +The WG may add additional members to the WG by unanimous consensus. + +A WG member may be removed from the WG by voluntary resignation, or by +unanimous consensus of all other WG members. + +Changes to WG membership should be posted in the agenda, and may be +suggested as any other agenda item (see "WG Meetings" below). + +If an addition or removal is proposed during a meeting, and the full +WG is not in attendance to participate, then the addition or removal +is added to the agenda for the subsequent meeting. This is to ensure +that all members are given the opportunity to participate in all +membership decisions. If a WG member is unable to attend a meeting +where a planned membership decision is being made, then their consent +is assumed. + +No more than 1/3 of the WG members may be affiliated with the same +employer. If removal or resignation of a WG member, or a change of +employment by a WG member, creates a situation where more than 1/3 of +the WG membership shares an employer, then the situation must be +immediately remedied by the resignation or removal of one or more WG +members affiliated with the over-represented employer(s). + +### WG Meetings + +The WG meets occasionally on a Google Hangout On Air. A designated moderator +approved by the WG runs the meeting. Each meeting should be +published to YouTube. + +Items are added to the WG agenda that are considered contentious or +are modifications of governance, contribution policy, WG membership, +or release process. + +The intention of the agenda is not to approve or review all patches; +that should happen continuously on GitHub and be handled by the larger +group of Collaborators. + +Any community member or contributor can ask that something be added to +the next meeting's agenda by logging a GitHub Issue. Any Collaborator, +WG member or the moderator can add the item to the agenda by adding +the ***WG-agenda*** tag to the issue. + +Prior to each WG meeting the moderator will share the Agenda with +members of the WG. WG members can add any items they like to the +agenda at the beginning of each meeting. The moderator and the WG +cannot veto or remove items. + +The WG may invite persons or representatives from certain projects to +participate in a non-voting capacity. + +The moderator is responsible for summarizing the discussion of each +agenda item and sends it as a pull request after the meeting. + +### Consensus Seeking Process + +The WG follows a +[Consensus +Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making) +decision-making model. + +When an agenda item has appeared to reach a consensus the moderator +will ask "Does anyone object?" as a final call for dissent from the +consensus. + +If an agenda item cannot reach a consensus a WG member can call for +either a closing vote or a vote to table the issue to the next +meeting. The call for a vote must be seconded by a majority of the WG +or else the discussion will continue. Simple majority wins. + +Note that changes to WG membership require a majority consensus. See +"WG Membership" above. diff --git a/server/node_modules/bl/node_modules/readable-stream/LICENSE b/server/node_modules/bl/node_modules/readable-stream/LICENSE new file mode 100644 index 0000000..2873b3b --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/LICENSE @@ -0,0 +1,47 @@ +Node.js is licensed for use as follows: + +""" +Copyright Node.js contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" + +This license applies to parts of Node.js originating from the +https://github.com/joyent/node repository: + +""" +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" diff --git a/server/node_modules/bl/node_modules/readable-stream/README.md b/server/node_modules/bl/node_modules/readable-stream/README.md new file mode 100644 index 0000000..6f035ab --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/README.md @@ -0,0 +1,106 @@ +# readable-stream + +***Node.js core streams for userland*** [![Build Status](https://travis-ci.com/nodejs/readable-stream.svg?branch=master)](https://travis-ci.com/nodejs/readable-stream) + + +[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) +[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/) + + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/readabe-stream.svg)](https://saucelabs.com/u/readabe-stream) + +```bash +npm install --save readable-stream +``` + +This package is a mirror of the streams implementations in Node.js. + +Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v10.19.0/docs/api/stream.html). + +If you want to guarantee a stable streams base, regardless of what version of +Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html). + +As of version 2.0.0 **readable-stream** uses semantic versioning. + +## Version 3.x.x + +v3.x.x of `readable-stream` is a cut from Node 10. This version supports Node 6, 8, and 10, as well as evergreen browsers, IE 11 and latest Safari. The breaking changes introduced by v3 are composed by the combined breaking changes in [Node v9](https://nodejs.org/en/blog/release/v9.0.0/) and [Node v10](https://nodejs.org/en/blog/release/v10.0.0/), as follows: + +1. Error codes: https://github.com/nodejs/node/pull/13310, + https://github.com/nodejs/node/pull/13291, + https://github.com/nodejs/node/pull/16589, + https://github.com/nodejs/node/pull/15042, + https://github.com/nodejs/node/pull/15665, + https://github.com/nodejs/readable-stream/pull/344 +2. 'readable' have precedence over flowing + https://github.com/nodejs/node/pull/18994 +3. make virtual methods errors consistent + https://github.com/nodejs/node/pull/18813 +4. updated streams error handling + https://github.com/nodejs/node/pull/18438 +5. writable.end should return this. + https://github.com/nodejs/node/pull/18780 +6. readable continues to read when push('') + https://github.com/nodejs/node/pull/18211 +7. add custom inspect to BufferList + https://github.com/nodejs/node/pull/17907 +8. always defer 'readable' with nextTick + https://github.com/nodejs/node/pull/17979 + +## Version 2.x.x +v2.x.x of `readable-stream` is a cut of the stream module from Node 8 (there have been no semver-major changes from Node 4 to 8). This version supports all Node.js versions from 0.8, as well as evergreen browsers and IE 10 & 11. + +### Big Thanks + +Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs][sauce] + +# Usage + +You can swap your `require('stream')` with `require('readable-stream')` +without any changes, if you are just using one of the main classes and +functions. + +```js +const { + Readable, + Writable, + Transform, + Duplex, + pipeline, + finished +} = require('readable-stream') +```` + +Note that `require('stream')` will return `Stream`, while +`require('readable-stream')` will return `Readable`. We discourage using +whatever is exported directly, but rather use one of the properties as +shown in the example above. + +# Streams Working Group + +`readable-stream` is maintained by the Streams Working Group, which +oversees the development and maintenance of the Streams API within +Node.js. The responsibilities of the Streams Working Group include: + +* Addressing stream issues on the Node.js issue tracker. +* Authoring and editing stream documentation within the Node.js project. +* Reviewing changes to stream subclasses within the Node.js project. +* Redirecting changes to streams from the Node.js project to this + project. +* Assisting in the implementation of stream providers within Node.js. +* Recommending versions of `readable-stream` to be included in Node.js. +* Messaging about the future of streams to give the community advance + notice of changes. + + +## Team Members + +* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com> + - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242 +* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com> +* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com> + - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E +* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) <shestak.irina@gmail.com> +* **Yoshua Wyuts** ([@yoshuawuyts](https://github.com/yoshuawuyts)) <yoshuawuyts@gmail.com> + +[sauce]: https://saucelabs.com diff --git a/server/node_modules/bl/node_modules/readable-stream/errors-browser.js b/server/node_modules/bl/node_modules/readable-stream/errors-browser.js new file mode 100644 index 0000000..fb8e73e --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/errors-browser.js @@ -0,0 +1,127 @@ +'use strict'; + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } + + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); + } + } + + var NodeError = + /*#__PURE__*/ + function (_Base) { + _inheritsLoose(NodeError, _Base); + + function NodeError(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } + + return NodeError; + }(Base); + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; +} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js + + +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); + + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); + } + } else { + return "of ".concat(thing, " ").concat(String(expected)); + } +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith + + +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith + + +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + + return str.substring(this_len - search.length, this_len) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes + + +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + var determiner; + + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + var msg; + + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } else { + var type = includes(name, '.') ? 'property' : 'argument'; + msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } + + msg += ". Received type ".concat(typeof actual); + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented'; +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg; +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); +module.exports.codes = codes; diff --git a/server/node_modules/bl/node_modules/readable-stream/errors.js b/server/node_modules/bl/node_modules/readable-stream/errors.js new file mode 100644 index 0000000..8471526 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/errors.js @@ -0,0 +1,116 @@ +'use strict'; + +const codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error + } + + function getMessage (arg1, arg2, arg3) { + if (typeof message === 'string') { + return message + } else { + return message(arg1, arg2, arg3) + } + } + + class NodeError extends Base { + constructor (arg1, arg2, arg3) { + super(getMessage(arg1, arg2, arg3)); + } + } + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + + codes[code] = NodeError; +} + +// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + const len = expected.length; + expected = expected.map((i) => String(i)); + if (len > 2) { + return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` + + expected[len - 1]; + } else if (len === 2) { + return `one of ${thing} ${expected[0]} or ${expected[1]}`; + } else { + return `of ${thing} ${expected[0]}`; + } + } else { + return `of ${thing} ${String(expected)}`; + } +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + return str.substring(this_len - search.length, this_len) === search; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"' +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + let determiner; + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + let msg; + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`; + } else { + const type = includes(name, '.') ? 'property' : 'argument'; + msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`; + } + + msg += `. Received type ${typeof actual}`; + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented' +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); + +module.exports.codes = codes; diff --git a/server/node_modules/bl/node_modules/readable-stream/experimentalWarning.js b/server/node_modules/bl/node_modules/readable-stream/experimentalWarning.js new file mode 100644 index 0000000..78e8414 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/experimentalWarning.js @@ -0,0 +1,17 @@ +'use strict' + +var experimentalWarnings = new Set(); + +function emitExperimentalWarning(feature) { + if (experimentalWarnings.has(feature)) return; + var msg = feature + ' is an experimental feature. This feature could ' + + 'change at any time'; + experimentalWarnings.add(feature); + process.emitWarning(msg, 'ExperimentalWarning'); +} + +function noop() {} + +module.exports.emitExperimentalWarning = process.emitWarning + ? emitExperimentalWarning + : noop; diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js b/server/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js new file mode 100644 index 0000000..cbe41e1 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js @@ -0,0 +1,139 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. +'use strict'; +/**/ + +var objectKeys = Object.keys || function (obj) { + var keys = []; + + for (var key in obj) { + keys.push(key); + } + + return keys; +}; +/**/ + + +module.exports = Duplex; + +var Readable = require('readable-stream/lib/_stream_readable'); + +var Writable = require('readable-stream/lib/_stream_writable'); + +require('inherits')(Duplex, Readable); + +{ + // Allow the keys array to be GC'ed. + var keys = objectKeys(Writable.prototype); + + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} + +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; + + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); + } + } +} + +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); +Object.defineProperty(Duplex.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +Object.defineProperty(Duplex.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); // the no-half-open enforcer + +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; // no more data can be written. + // But allow more writes to happen in this tick. + + process.nextTick(onEndNT, this); +} + +function onEndNT(self) { + self.end(); +} + +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed + + + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); \ No newline at end of file diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js b/server/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js new file mode 100644 index 0000000..bb8f462 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js @@ -0,0 +1,39 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. +'use strict'; + +module.exports = PassThrough; + +var Transform = require('readable-stream/lib/_stream_transform'); + +require('inherits')(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + Transform.call(this, options); +} + +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; \ No newline at end of file diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js b/server/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js new file mode 100644 index 0000000..9368fa1 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js @@ -0,0 +1,1124 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +'use strict'; + +module.exports = Readable; +/**/ + +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; +/**/ + +var EE = require('events').EventEmitter; + +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ + + +var Stream = require('readable-stream/lib/internal/streams/stream'); +/**/ + + +var Buffer = require('buffer').Buffer; + +var OurUint8Array = global.Uint8Array || function () {}; + +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} + +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} +/**/ + + +var debugUtil = require('util'); + +var debug; + +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function debug() {}; +} +/**/ + + +var BufferList = require('readable-stream/lib/internal/streams/buffer_list'); + +var destroyImpl = require('readable-stream/lib/internal/streams/destroy'); + +var _require = require('readable-stream/lib/internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; + +var _require$codes = require('readable-stream/errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance. + + +var StringDecoder; +var createReadableStreamAsyncIterator; +var from; + +require('inherits')(Readable, Stream); + +var errorOrDestroy = destroyImpl.errorOrDestroy; +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; + +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} + +function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || require('readable-stream/lib/_stream_duplex'); + options = options || {}; // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + + this.sync = true; // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; // Should close be emitted on destroy. Defaults to true. + + this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish') + + this.autoDestroy = !!options.autoDestroy; // has it been destroyed + + this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + + this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s + + this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled + + this.readingMore = false; + this.decoder = null; + this.encoding = null; + + if (options.encoding) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + Duplex = Duplex || require('readable-stream/lib/_stream_duplex'); + if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 + + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); // legacy + + this.readable = true; + + if (options) { + if (typeof options.read === 'function') this._read = options.read; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + + Stream.call(this); +} + +Object.defineProperty(Readable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined) { + return false; + } + + return this._readableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed + + + this._readableState.destroyed = value; + } +}); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; + +Readable.prototype._destroy = function (err, cb) { + cb(err); +}; // Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. + + +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; // Unshift should *always* be something directly out of read() + + +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; + +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug('readableAddChunk', chunk); + var state = stream._readableState; + + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; + } else { + state.reading = false; + + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); + } + } // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. + + + return !state.ended && (state.length < state.highWaterMark || state.length === 0); +} + +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit('data', chunk); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (state.needReadable) emitReadable(stream); + } + + maybeReadMore(stream, state); +} + +function chunkInvalid(state, chunk) { + var er; + + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + } + + return er; +} + +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; // backwards compatibility. + + +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8 + + this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers: + + var p = this._readableState.buffer.head; + var content = ''; + + while (p !== null) { + content += decoder.write(p.data); + p = p.next; + } + + this._readableState.buffer.clear(); + + if (content !== '') this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; +}; // Don't raise the hwm > 1GB + + +var MAX_HWM = 0x40000000; + +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + + return n; +} // This function is designed to be inlinable, so please take care when making +// changes to the function body. + + +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } // If we're asking for more than the current hwm, then raise the hwm. + + + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; // Don't have enough + + if (!state.ended) { + state.needReadable = true; + return 0; + } + + return state.length; +} // you can override either this method, or the async _read(n) below. + + +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. + + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + // if we need a readable event, then we need to do some reading. + + + var doRead = state.needReadable; + debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some + + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + + + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; // if the length is currently zero, then we *need* a readable event. + + if (state.length === 0) state.needReadable = true; // call internal read method + + this._read(state.highWaterMark); + + state.sync = false; // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + + if (!state.reading) n = howMuchToRead(nOrig, state); + } + + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; + } + + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick. + + if (nOrig !== n && state.ended) endReadable(this); + } + + if (ret !== null) this.emit('data', ret); + return ret; +}; + +function onEofChunk(stream, state) { + debug('onEofChunk'); + if (state.ended) return; + + if (state.decoder) { + var chunk = state.decoder.end(); + + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + + state.ended = true; + + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; + + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); + } + } +} // Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. + + +function emitReadable(stream) { + var state = stream._readableState; + debug('emitReadable', state.needReadable, state.emittedReadable); + state.needReadable = false; + + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); + } +} + +function emitReadable_(stream) { + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); + + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. + + + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); +} // at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. + + +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(maybeReadMore_, stream, state); + } +} + +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) // didn't get any data, stop spinning. + break; + } + + state.readingMore = false; +} // abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. + + +Readable.prototype._read = function (n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); +}; + +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + + case 1: + state.pipes = [state.pipes, dest]; + break; + + default: + state.pipes.push(dest); + break; + } + + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); + dest.on('unpipe', onunpipe); + + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + + function onend() { + debug('onend'); + dest.end(); + } // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + + + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + var cleanedUp = false; + + function cleanup() { + debug('cleanup'); // cleanup event handlers once the pipe is broken + + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + cleanedUp = true; // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + + src.on('data', ondata); + + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + debug('dest.write', ret); + + if (ret === false) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', state.awaitDrain); + state.awaitDrain++; + } + + src.pause(); + } + } // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + + + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } // Make sure our error handler is attached before userland ones. + + + prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. + + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + + dest.once('close', onclose); + + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + + dest.once('finish', onfinish); + + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } // tell the dest that it's being piped to + + + dest.emit('pipe', src); // start the flow if it hasn't been started already. + + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} + +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; // if we're not piping anywhere, then do nothing. + + if (state.pipesCount === 0) return this; // just one destination. most common case. + + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + if (!dest) dest = state.pipes; // got a match. + + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } // slow case. multiple pipe destinations. + + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + + for (var i = 0; i < len; i++) { + dests[i].emit('unpipe', this, { + hasUnpiped: false + }); + } + + return this; + } // try to find the right one. + + + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + dest.emit('unpipe', this, unpipeInfo); + return this; +}; // set up data events if they are asked for +// Ensure readable listeners eventually get something + + +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; + + if (ev === 'data') { + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused + + if (state.flowing !== false) this.resume(); + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug('on readable', state.length, state.reading); + + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); + } + } + } + + return res; +}; + +Readable.prototype.addListener = Readable.prototype.on; + +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + + return res; +}; + +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + + return res; +}; + +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; + + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); + } +} + +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} // pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. + + +Readable.prototype.resume = function () { + var state = this._readableState; + + if (!state.flowing) { + debug('resume'); // we flow only if there is no one listening + // for readable, but we still have to call + // resume() + + state.flowing = !state.readableListening; + resume(this, state); + } + + state.paused = false; + return this; +}; + +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); + } +} + +function resume_(stream, state) { + debug('resume', state.reading); + + if (!state.reading) { + stream.read(0); + } + + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} + +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + + if (this._readableState.flowing !== false) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + + this._readableState.paused = true; + return this; +}; + +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + + while (state.flowing && stream.read() !== null) { + ; + } +} // wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. + + +Readable.prototype.wrap = function (stream) { + var _this = this; + + var state = this._readableState; + var paused = false; + stream.on('end', function () { + debug('wrapped end'); + + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } + + _this.push(null); + }); + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode + + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + + var ret = _this.push(chunk); + + if (!ret) { + paused = true; + stream.pause(); + } + }); // proxy all the other methods. + // important when wrapping filters and duplexes. + + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } // proxy certain important events. + + + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } // when we try to consume some more bytes, simply unpause the + // underlying stream. + + + this._read = function (n) { + debug('wrapped _read', n); + + if (paused) { + paused = false; + stream.resume(); + } + }; + + return this; +}; + +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = require('readable-stream/lib/internal/streams/async_iterator'); + } + + return createReadableStreamAsyncIterator(this); + }; +} + +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } +}); +Object.defineProperty(Readable.prototype, 'readableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState && this._readableState.buffer; + } +}); +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; + } + } +}); // exposed for testing purposes only. + +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); // Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. + +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = state.buffer.consume(n, state.decoder); + } + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + debug('endReadable', state.endEmitted); + + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } +} + +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift. + + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); + } + } + } +} + +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = require('readable-stream/lib/internal/streams/from'); + } + + return from(Readable, iterable, opts); + }; +} + +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + + return -1; +} \ No newline at end of file diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js b/server/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js new file mode 100644 index 0000000..aff79fa --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js @@ -0,0 +1,201 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. +'use strict'; + +module.exports = Transform; + +var _require$codes = require('readable-stream/errors').codes, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; + +var Duplex = require('readable-stream/lib/_stream_duplex'); + +require('inherits')(Transform, Duplex); + +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + + if (cb === null) { + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); + } + + ts.writechunk = null; + ts.writecb = null; + if (data != null) // single equals check for both `null` and `undefined` + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} + +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; // start out asking for a readable event once data is transformed. + + this._readableState.needReadable = true; // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + + this._readableState.sync = false; + + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + if (typeof options.flush === 'function') this._flush = options.flush; + } // When the writable side finishes, then flush out anything remaining. + + + this.on('prefinish', prefinish); +} + +function prefinish() { + var _this = this; + + if (typeof this._flush === 'function' && !this._readableState.destroyed) { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} + +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; // This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. + + +Transform.prototype._transform = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); +}; + +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; // Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. + + +Transform.prototype._read = function (n) { + var ts = this._transformState; + + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; + + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + +Transform.prototype._destroy = function (err, cb) { + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + }); +}; + +function done(stream, er, data) { + if (er) return stream.emit('error', er); + if (data != null) // single equals check for both `null` and `undefined` + stream.push(data); // TODO(BridgeAR): Write a test for these two error cases + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + + if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); +} \ No newline at end of file diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js b/server/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js new file mode 100644 index 0000000..941cf59 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js @@ -0,0 +1,697 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. +'use strict'; + +module.exports = Writable; +/* */ + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} // It seems a linked list but it is not +// there will be only 2 of these for each stream + + +function CorkedRequest(state) { + var _this = this; + + this.next = null; + this.entry = null; + + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ + + +var Duplex; +/**/ + +Writable.WritableState = WritableState; +/**/ + +var internalUtil = { + deprecate: require('util-deprecate') +}; +/**/ + +/**/ + +var Stream = require('readable-stream/lib/internal/streams/stream'); +/**/ + + +var Buffer = require('buffer').Buffer; + +var OurUint8Array = global.Uint8Array || function () {}; + +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} + +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +var destroyImpl = require('readable-stream/lib/internal/streams/destroy'); + +var _require = require('readable-stream/lib/internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; + +var _require$codes = require('readable-stream/errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; + +var errorOrDestroy = destroyImpl.errorOrDestroy; + +require('inherits')(Writable, Stream); + +function nop() {} + +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || require('readable-stream/lib/_stream_duplex'); + options = options || {}; // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream + // contains buffers or objects. + + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called + + this.finalCalled = false; // drain event flag. + + this.needDrain = false; // at the start of calling end() + + this.ending = false; // when end() has been called, and returned + + this.ended = false; // when 'finish' is emitted + + this.finished = false; // has it been destroyed + + this.destroyed = false; // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + + this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + + this.length = 0; // a flag to see when we're in the middle of a write. + + this.writing = false; // when true all writes will be buffered until .uncork() call + + this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + + this.sync = true; // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + + this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb) + + this.onwrite = function (er) { + onwrite(stream, er); + }; // the callback that the user supplies to write(chunk,encoding,cb) + + + this.writecb = null; // the amount that is being written when _write is called. + + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + + this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + + this.prefinished = false; // True if the error was already emitted and should not be thrown again + + this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true. + + this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end') + + this.autoDestroy = !!options.autoDestroy; // count buffered requests + + this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + + this.corkedRequestsFree = new CorkedRequest(this); +} + +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + + while (current) { + out.push(current); + current = current.next; + } + + return out; +}; + +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); // Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. + + +var realHasInstance; + +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function realHasInstance(object) { + return object instanceof this; + }; +} + +function Writable(options) { + Duplex = Duplex || require('readable-stream/lib/_stream_duplex'); // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 + + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); // legacy. + + this.writable = true; + + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; + } + + Stream.call(this); +} // Otherwise people can pipe Writable streams, which is just wrong. + + +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); +}; + +function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb + + errorOrDestroy(stream, er); + process.nextTick(cb, er); +} // Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. + + +function validChunk(stream, state, chunk, cb) { + var er; + + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); + } + + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; + } + + return true; +} + +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + + var isBuf = !state.objectMode && _isUint8Array(chunk); + + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (typeof cb !== 'function') cb = nop; + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + return ret; +}; + +Writable.prototype.cork = function () { + this._writableState.corked++; +}; + +Writable.prototype.uncork = function () { + var state = this._writableState; + + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; + +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; + +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + + return chunk; +} + +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); // if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. + +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false. + + if (!ret) state.needDrain = true; + + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + + return ret; +} + +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); // this can emit finish, and it will always happen + // after error + + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); // this can emit finish, but finish must + // always follow error + + finishMaybe(stream, state); + } +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state) || stream.destroyed; + + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} // Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. + + +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} // if there's something in the buffer waiting, then process it + + +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + + state.pendingcb++; + state.lastBufferedRequest = null; + + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + + if (state.writing) { + break; + } + } + + if (entry === null) state.lastBufferedRequest = null; + } + + state.bufferedRequest = entry; + state.bufferProcessing = false; +} + +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); +}; + +Writable.prototype._writev = null; + +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks + + if (state.corked) { + state.corked = 1; + this.uncork(); + } // ignore unnecessary end() calls. + + + if (!state.ending) endWritable(this, state, cb); + return this; +}; + +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); + +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} + +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + + if (err) { + errorOrDestroy(stream, err); + } + + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} + +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} + +function finishMaybe(stream, state) { + var need = needFinish(state); + + if (need) { + prefinish(stream, state); + + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } + } + + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + + if (cb) { + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); + } + + state.ended = true; + stream.writable = false; +} + +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } // reuse the free corkReq. + + + state.corkedRequestsFree.next = corkReq; +} + +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; + } + + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed + + + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; + +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; \ No newline at end of file diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/async_iterator.js b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/async_iterator.js new file mode 100644 index 0000000..8b83da1 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/async_iterator.js @@ -0,0 +1,207 @@ +'use strict'; + +var _Object$setPrototypeO; + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var finished = require('readable-stream/lib/internal/streams/end-of-stream'); + +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); + +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} + +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; + + if (resolve !== null) { + var data = iter[kStream].read(); // we defer if data is null + // we can be expecting either 'end' or + // 'error' + + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); + } + } +} + +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + process.nextTick(readAndResolve, iter); +} + +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } + + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} + +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + + next: function next() { + var _this = this; + + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; + + if (error !== null) { + return Promise.reject(error); + } + + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } + + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + process.nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); + } // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time + + + var lastPromise = this[kLastPromise]; + var promise; + + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); + } else { + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); + + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + + promise = new Promise(this[kHandlePromise]); + } + + this[kLastPromise] = promise; + return promise; + } +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } + + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); + +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); + + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise + // returned by next() and store the error + + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); + } + + iterator[kError] = err; + return; + } + + var resolve = iterator[kLastResolve]; + + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); + } + + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; + +module.exports = createReadableStreamAsyncIterator; \ No newline at end of file diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/buffer_list.js b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/buffer_list.js new file mode 100644 index 0000000..cdea425 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/buffer_list.js @@ -0,0 +1,210 @@ +'use strict'; + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var _require = require('buffer'), + Buffer = _require.Buffer; + +var _require2 = require('util'), + inspect = _require2.inspect; + +var custom = inspect && inspect.custom || 'inspect'; + +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); +} + +module.exports = +/*#__PURE__*/ +function () { + function BufferList() { + _classCallCheck(this, BufferList); + + this.head = null; + this.tail = null; + this.length = 0; + } + + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + + while (p = p.next) { + ret += s + p.data; + } + + return ret; + } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + + return ret; + } // Consumes a specified amount of bytes or characters from the buffered data. + + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + + return ret; + } + }, { + key: "first", + value: function first() { + return this.head.data; + } // Consumes a specified amount of characters from the buffered data. + + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + + break; + } + + ++c; + } + + this.length -= c; + return ret; + } // Consumes a specified amount of bytes from the buffered data. + + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } + + break; + } + + ++c; + } + + this.length -= c; + return ret; + } // Make sure the linked list only shows the minimal necessary information. + + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread({}, options, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); + } + }]); + + return BufferList; +}(); \ No newline at end of file diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/destroy.js b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/destroy.js new file mode 100644 index 0000000..3268a16 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/destroy.js @@ -0,0 +1,105 @@ +'use strict'; // undocumented cb() API, needed for core, not for public API + +function destroy(err, cb) { + var _this = this; + + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } + } + + return this; + } // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + + if (this._readableState) { + this._readableState.destroyed = true; + } // if this is a duplex stream mark the writable part as destroyed as well + + + if (this._writableState) { + this._writableState.destroyed = true; + } + + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); + } + }); + + return this; +} + +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} + +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} + +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} + +function emitErrorNT(self, err) { + self.emit('error', err); +} + +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} + +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; \ No newline at end of file diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/end-of-stream.js b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/end-of-stream.js new file mode 100644 index 0000000..59ee16a --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/end-of-stream.js @@ -0,0 +1,104 @@ +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). +'use strict'; + +var ERR_STREAM_PREMATURE_CLOSE = require('readable-stream/errors').codes.ERR_STREAM_PREMATURE_CLOSE; + +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + callback.apply(this, args); + }; +} + +function noop() {} + +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} + +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; + + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + + var writableEnded = stream._writableState && stream._writableState.finished; + + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + + var readableEnded = stream._readableState && stream._readableState.endEmitted; + + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + + var onerror = function onerror(err) { + callback.call(stream, err); + }; + + var onclose = function onclose() { + var err; + + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; + + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +} + +module.exports = eos; \ No newline at end of file diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/from-browser.js b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/from-browser.js new file mode 100644 index 0000000..a4ce56f --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/from-browser.js @@ -0,0 +1,3 @@ +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/from.js b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/from.js new file mode 100644 index 0000000..c584a0c --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/from.js @@ -0,0 +1,64 @@ +'use strict'; + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var ERR_INVALID_ARG_TYPE = require('readable-stream/errors').codes.ERR_INVALID_ARG_TYPE; + +function from(Readable, iterable, opts) { + var iterator; + + if (iterable && typeof iterable.next === 'function') { + iterator = iterable; + } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable); + + var readable = new Readable(_objectSpread({ + objectMode: true + }, opts)); // Reading boolean to protect against _read + // being called before last iteration completion. + + var reading = false; + + readable._read = function () { + if (!reading) { + reading = true; + next(); + } + }; + + function next() { + return _next2.apply(this, arguments); + } + + function _next2() { + _next2 = _asyncToGenerator(function* () { + try { + var _ref = yield iterator.next(), + value = _ref.value, + done = _ref.done; + + if (done) { + readable.push(null); + } else if (readable.push((yield value))) { + next(); + } else { + reading = false; + } + } catch (err) { + readable.destroy(err); + } + }); + return _next2.apply(this, arguments); + } + + return readable; +} + +module.exports = from; \ No newline at end of file diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/pipeline.js b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/pipeline.js new file mode 100644 index 0000000..af783b5 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/pipeline.js @@ -0,0 +1,97 @@ +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). +'use strict'; + +var eos; + +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; +} + +var _require$codes = require('readable-stream/errors').codes, + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; + +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} + +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} + +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = require('readable-stream/lib/internal/streams/end-of-stream'); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; // request.destroy just do .end - .abort is what we want + + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} + +function call(fn) { + fn(); +} + +function pipe(from, to) { + return from.pipe(to); +} + +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} + +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; + + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } + + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); +} + +module.exports = pipeline; \ No newline at end of file diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/state.js b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/state.js new file mode 100644 index 0000000..c025fa9 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/state.js @@ -0,0 +1,27 @@ +'use strict'; + +var ERR_INVALID_OPT_VALUE = require('readable-stream/errors').codes.ERR_INVALID_OPT_VALUE; + +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; +} + +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); + } + + return Math.floor(hwm); + } // Default value + + + return state.objectMode ? 16 : 16 * 1024; +} + +module.exports = { + getHighWaterMark: getHighWaterMark +}; \ No newline at end of file diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/stream-browser.js b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/stream-browser.js new file mode 100644 index 0000000..9332a3f --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/stream-browser.js @@ -0,0 +1 @@ +module.exports = require('events').EventEmitter; diff --git a/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/stream.js b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/stream.js new file mode 100644 index 0000000..ce2ad5b --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/lib/internal/streams/stream.js @@ -0,0 +1 @@ +module.exports = require('stream'); diff --git a/server/node_modules/bl/node_modules/readable-stream/package.json b/server/node_modules/bl/node_modules/readable-stream/package.json new file mode 100644 index 0000000..65524d8 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/package.json @@ -0,0 +1,97 @@ +{ + "_from": "readable-stream@^3.4.0", + "_id": "readable-stream@3.6.0", + "_inBundle": false, + "_integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "_location": "/bl/readable-stream", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "readable-stream@^3.4.0", + "name": "readable-stream", + "escapedName": "readable-stream", + "rawSpec": "^3.4.0", + "saveSpec": null, + "fetchSpec": "^3.4.0" + }, + "_requiredBy": [ + "/bl" + ], + "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "_shasum": "337bbda3adc0706bd3e024426a286d4b4b2c9198", + "_spec": "readable-stream@^3.4.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/bl", + "browser": { + "util": false, + "worker_threads": false, + "./errors": "./errors-browser.js", + "./readable.js": "./readable-browser.js", + "./lib/internal/streams/from.js": "./lib/internal/streams/from-browser.js", + "./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js" + }, + "bugs": { + "url": "https://github.com/nodejs/readable-stream/issues" + }, + "bundleDependencies": false, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "deprecated": false, + "description": "Streams3, a user-land copy of the stream library from Node.js", + "devDependencies": { + "@babel/cli": "^7.2.0", + "@babel/core": "^7.2.0", + "@babel/polyfill": "^7.0.0", + "@babel/preset-env": "^7.2.0", + "airtap": "0.0.9", + "assert": "^1.4.0", + "bl": "^2.0.0", + "deep-strict-equal": "^0.2.0", + "events.once": "^2.0.2", + "glob": "^7.1.2", + "gunzip-maybe": "^1.4.1", + "hyperquest": "^2.1.3", + "lolex": "^2.6.0", + "nyc": "^11.0.0", + "pump": "^3.0.0", + "rimraf": "^2.6.2", + "tap": "^12.0.0", + "tape": "^4.9.0", + "tar-fs": "^1.16.2", + "util-promisify": "^2.1.0" + }, + "engines": { + "node": ">= 6" + }, + "homepage": "https://github.com/nodejs/readable-stream#readme", + "keywords": [ + "readable", + "stream", + "pipe" + ], + "license": "MIT", + "main": "readable.js", + "name": "readable-stream", + "nyc": { + "include": [ + "lib/**.js" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/nodejs/readable-stream.git" + }, + "scripts": { + "ci": "TAP=1 tap --no-esm test/parallel/*.js test/ours/*.js | tee test.tap", + "cover": "nyc npm test", + "report": "nyc report --reporter=lcov", + "test": "tap -J --no-esm test/parallel/*.js test/ours/*.js", + "test-browser-local": "airtap --open --local -- test/browser.js", + "test-browsers": "airtap --sauce-connect --loopback airtap.local -- test/browser.js", + "update-browser-errors": "babel -o errors-browser.js errors.js" + }, + "version": "3.6.0" +} diff --git a/server/node_modules/bl/node_modules/readable-stream/readable-browser.js b/server/node_modules/bl/node_modules/readable-stream/readable-browser.js new file mode 100644 index 0000000..2f63d09 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/readable-browser.js @@ -0,0 +1,9 @@ +exports = module.exports = require('readable-stream/lib/_stream_readable.js'); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = require('readable-stream/lib/_stream_writable.js'); +exports.Duplex = require('readable-stream/lib/_stream_duplex.js'); +exports.Transform = require('readable-stream/lib/_stream_transform.js'); +exports.PassThrough = require('readable-stream/lib/_stream_passthrough.js'); +exports.finished = require('readable-stream/lib/internal/streams/end-of-stream.js'); +exports.pipeline = require('readable-stream/lib/internal/streams/pipeline.js'); diff --git a/server/node_modules/bl/node_modules/readable-stream/readable.js b/server/node_modules/bl/node_modules/readable-stream/readable.js new file mode 100644 index 0000000..b8bb3b6 --- /dev/null +++ b/server/node_modules/bl/node_modules/readable-stream/readable.js @@ -0,0 +1,16 @@ +var Stream = require('stream'); +if (process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream.Readable; + Object.assign(module.exports, Stream); + module.exports.Stream = Stream; +} else { + exports = module.exports = require('readable-stream/lib/_stream_readable.js'); + exports.Stream = Stream || exports; + exports.Readable = exports; + exports.Writable = require('readable-stream/lib/_stream_writable.js'); + exports.Duplex = require('readable-stream/lib/_stream_duplex.js'); + exports.Transform = require('readable-stream/lib/_stream_transform.js'); + exports.PassThrough = require('readable-stream/lib/_stream_passthrough.js'); + exports.finished = require('readable-stream/lib/internal/streams/end-of-stream.js'); + exports.pipeline = require('readable-stream/lib/internal/streams/pipeline.js'); +} diff --git a/server/node_modules/bl/package.json b/server/node_modules/bl/package.json new file mode 100644 index 0000000..206dcd5 --- /dev/null +++ b/server/node_modules/bl/package.json @@ -0,0 +1,69 @@ +{ + "_from": "bl@^4.0.3", + "_id": "bl@4.1.0", + "_inBundle": false, + "_integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "_location": "/bl", + "_phantomChildren": { + "inherits": "2.0.4", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "bl@^4.0.3", + "name": "bl", + "escapedName": "bl", + "rawSpec": "^4.0.3", + "saveSpec": null, + "fetchSpec": "^4.0.3" + }, + "_requiredBy": [ + "/tar-stream" + ], + "_resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "_shasum": "451535264182bec2fbbc83a62ab98cf11d9f7b3a", + "_spec": "bl@^4.0.3", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/tar-stream", + "authors": [ + "Rod Vagg (https://github.com/rvagg)", + "Matteo Collina (https://github.com/mcollina)", + "Jarett Cruger (https://github.com/jcrugzz)" + ], + "bugs": { + "url": "https://github.com/rvagg/bl/issues" + }, + "bundleDependencies": false, + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + }, + "deprecated": false, + "description": "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!", + "devDependencies": { + "faucet": "~0.0.1", + "standard": "^14.3.0", + "tape": "^4.11.0" + }, + "homepage": "https://github.com/rvagg/bl", + "keywords": [ + "buffer", + "buffers", + "stream", + "awesomesauce" + ], + "license": "MIT", + "main": "bl.js", + "name": "bl", + "repository": { + "type": "git", + "url": "git+https://github.com/rvagg/bl.git" + }, + "scripts": { + "lint": "standard *.js test/*.js", + "test": "npm run lint && node test/test.js | faucet" + }, + "version": "4.1.0" +} diff --git a/server/node_modules/bl/test/convert.js b/server/node_modules/bl/test/convert.js new file mode 100644 index 0000000..8dfcfd1 --- /dev/null +++ b/server/node_modules/bl/test/convert.js @@ -0,0 +1,21 @@ +'use strict' + +const tape = require('tape') +const { BufferList, BufferListStream } = require('bl') +const { Buffer } = require('buffer') + +tape('convert from BufferList to BufferListStream', (t) => { + const data = Buffer.from(`TEST-${Date.now()}`) + const bl = new BufferList(data) + const bls = new BufferListStream(bl) + t.ok(bl.slice().equals(bls.slice())) + t.end() +}) + +tape('convert from BufferListStream to BufferList', (t) => { + const data = Buffer.from(`TEST-${Date.now()}`) + const bls = new BufferListStream(data) + const bl = new BufferList(bls) + t.ok(bl.slice().equals(bls.slice())) + t.end() +}) diff --git a/server/node_modules/bl/test/indexOf.js b/server/node_modules/bl/test/indexOf.js new file mode 100644 index 0000000..f1027c9 --- /dev/null +++ b/server/node_modules/bl/test/indexOf.js @@ -0,0 +1,492 @@ +'use strict' + +const tape = require('tape') +const BufferList = require('bl') +const { Buffer } = require('buffer') + +tape('indexOf single byte needle', (t) => { + const bl = new BufferList(['abcdefg', 'abcdefg', '12345']) + + t.equal(bl.indexOf('e'), 4) + t.equal(bl.indexOf('e', 5), 11) + t.equal(bl.indexOf('e', 12), -1) + t.equal(bl.indexOf('5'), 18) + + t.end() +}) + +tape('indexOf multiple byte needle', (t) => { + const bl = new BufferList(['abcdefg', 'abcdefg']) + + t.equal(bl.indexOf('ef'), 4) + t.equal(bl.indexOf('ef', 5), 11) + + t.end() +}) + +tape('indexOf multiple byte needles across buffer boundaries', (t) => { + const bl = new BufferList(['abcdefg', 'abcdefg']) + + t.equal(bl.indexOf('fgabc'), 5) + + t.end() +}) + +tape('indexOf takes a Uint8Array search', (t) => { + const bl = new BufferList(['abcdefg', 'abcdefg']) + const search = new Uint8Array([102, 103, 97, 98, 99]) // fgabc + + t.equal(bl.indexOf(search), 5) + + t.end() +}) + +tape('indexOf takes a buffer list search', (t) => { + const bl = new BufferList(['abcdefg', 'abcdefg']) + const search = new BufferList('fgabc') + + t.equal(bl.indexOf(search), 5) + + t.end() +}) + +tape('indexOf a zero byte needle', (t) => { + const b = new BufferList('abcdef') + const bufEmpty = Buffer.from('') + + t.equal(b.indexOf(''), 0) + t.equal(b.indexOf('', 1), 1) + t.equal(b.indexOf('', b.length + 1), b.length) + t.equal(b.indexOf('', Infinity), b.length) + t.equal(b.indexOf(bufEmpty), 0) + t.equal(b.indexOf(bufEmpty, 1), 1) + t.equal(b.indexOf(bufEmpty, b.length + 1), b.length) + t.equal(b.indexOf(bufEmpty, Infinity), b.length) + + t.end() +}) + +tape('indexOf buffers smaller and larger than the needle', (t) => { + const bl = new BufferList(['abcdefg', 'a', 'bcdefg', 'a', 'bcfgab']) + + t.equal(bl.indexOf('fgabc'), 5) + t.equal(bl.indexOf('fgabc', 6), 12) + t.equal(bl.indexOf('fgabc', 13), -1) + + t.end() +}) + +// only present in node 6+ +;(process.version.substr(1).split('.')[0] >= 6) && tape('indexOf latin1 and binary encoding', (t) => { + const b = new BufferList('abcdef') + + // test latin1 encoding + t.equal( + new BufferList(Buffer.from(b.toString('latin1'), 'latin1')) + .indexOf('d', 0, 'latin1'), + 3 + ) + t.equal( + new BufferList(Buffer.from(b.toString('latin1'), 'latin1')) + .indexOf(Buffer.from('d', 'latin1'), 0, 'latin1'), + 3 + ) + t.equal( + new BufferList(Buffer.from('aa\u00e8aa', 'latin1')) + .indexOf('\u00e8', 'latin1'), + 2 + ) + t.equal( + new BufferList(Buffer.from('\u00e8', 'latin1')) + .indexOf('\u00e8', 'latin1'), + 0 + ) + t.equal( + new BufferList(Buffer.from('\u00e8', 'latin1')) + .indexOf(Buffer.from('\u00e8', 'latin1'), 'latin1'), + 0 + ) + + // test binary encoding + t.equal( + new BufferList(Buffer.from(b.toString('binary'), 'binary')) + .indexOf('d', 0, 'binary'), + 3 + ) + t.equal( + new BufferList(Buffer.from(b.toString('binary'), 'binary')) + .indexOf(Buffer.from('d', 'binary'), 0, 'binary'), + 3 + ) + t.equal( + new BufferList(Buffer.from('aa\u00e8aa', 'binary')) + .indexOf('\u00e8', 'binary'), + 2 + ) + t.equal( + new BufferList(Buffer.from('\u00e8', 'binary')) + .indexOf('\u00e8', 'binary'), + 0 + ) + t.equal( + new BufferList(Buffer.from('\u00e8', 'binary')) + .indexOf(Buffer.from('\u00e8', 'binary'), 'binary'), + 0 + ) + + t.end() +}) + +tape('indexOf the entire nodejs10 buffer test suite', (t) => { + const b = new BufferList('abcdef') + const bufA = Buffer.from('a') + const bufBc = Buffer.from('bc') + const bufF = Buffer.from('f') + const bufZ = Buffer.from('z') + + const stringComparison = 'abcdef' + + t.equal(b.indexOf('a'), 0) + t.equal(b.indexOf('a', 1), -1) + t.equal(b.indexOf('a', -1), -1) + t.equal(b.indexOf('a', -4), -1) + t.equal(b.indexOf('a', -b.length), 0) + t.equal(b.indexOf('a', NaN), 0) + t.equal(b.indexOf('a', -Infinity), 0) + t.equal(b.indexOf('a', Infinity), -1) + t.equal(b.indexOf('bc'), 1) + t.equal(b.indexOf('bc', 2), -1) + t.equal(b.indexOf('bc', -1), -1) + t.equal(b.indexOf('bc', -3), -1) + t.equal(b.indexOf('bc', -5), 1) + t.equal(b.indexOf('bc', NaN), 1) + t.equal(b.indexOf('bc', -Infinity), 1) + t.equal(b.indexOf('bc', Infinity), -1) + t.equal(b.indexOf('f'), b.length - 1) + t.equal(b.indexOf('z'), -1) + + // empty search tests + t.equal(b.indexOf(bufA), 0) + t.equal(b.indexOf(bufA, 1), -1) + t.equal(b.indexOf(bufA, -1), -1) + t.equal(b.indexOf(bufA, -4), -1) + t.equal(b.indexOf(bufA, -b.length), 0) + t.equal(b.indexOf(bufA, NaN), 0) + t.equal(b.indexOf(bufA, -Infinity), 0) + t.equal(b.indexOf(bufA, Infinity), -1) + t.equal(b.indexOf(bufBc), 1) + t.equal(b.indexOf(bufBc, 2), -1) + t.equal(b.indexOf(bufBc, -1), -1) + t.equal(b.indexOf(bufBc, -3), -1) + t.equal(b.indexOf(bufBc, -5), 1) + t.equal(b.indexOf(bufBc, NaN), 1) + t.equal(b.indexOf(bufBc, -Infinity), 1) + t.equal(b.indexOf(bufBc, Infinity), -1) + t.equal(b.indexOf(bufF), b.length - 1) + t.equal(b.indexOf(bufZ), -1) + t.equal(b.indexOf(0x61), 0) + t.equal(b.indexOf(0x61, 1), -1) + t.equal(b.indexOf(0x61, -1), -1) + t.equal(b.indexOf(0x61, -4), -1) + t.equal(b.indexOf(0x61, -b.length), 0) + t.equal(b.indexOf(0x61, NaN), 0) + t.equal(b.indexOf(0x61, -Infinity), 0) + t.equal(b.indexOf(0x61, Infinity), -1) + t.equal(b.indexOf(0x0), -1) + + // test offsets + t.equal(b.indexOf('d', 2), 3) + t.equal(b.indexOf('f', 5), 5) + t.equal(b.indexOf('f', -1), 5) + t.equal(b.indexOf('f', 6), -1) + + t.equal(b.indexOf(Buffer.from('d'), 2), 3) + t.equal(b.indexOf(Buffer.from('f'), 5), 5) + t.equal(b.indexOf(Buffer.from('f'), -1), 5) + t.equal(b.indexOf(Buffer.from('f'), 6), -1) + + t.equal(Buffer.from('ff').indexOf(Buffer.from('f'), 1, 'ucs2'), -1) + + // test invalid and uppercase encoding + t.equal(b.indexOf('b', 'utf8'), 1) + t.equal(b.indexOf('b', 'UTF8'), 1) + t.equal(b.indexOf('62', 'HEX'), 1) + t.throws(() => b.indexOf('bad', 'enc'), TypeError) + + // test hex encoding + t.equal( + Buffer.from(b.toString('hex'), 'hex') + .indexOf('64', 0, 'hex'), + 3 + ) + t.equal( + Buffer.from(b.toString('hex'), 'hex') + .indexOf(Buffer.from('64', 'hex'), 0, 'hex'), + 3 + ) + + // test base64 encoding + t.equal( + Buffer.from(b.toString('base64'), 'base64') + .indexOf('ZA==', 0, 'base64'), + 3 + ) + t.equal( + Buffer.from(b.toString('base64'), 'base64') + .indexOf(Buffer.from('ZA==', 'base64'), 0, 'base64'), + 3 + ) + + // test ascii encoding + t.equal( + Buffer.from(b.toString('ascii'), 'ascii') + .indexOf('d', 0, 'ascii'), + 3 + ) + t.equal( + Buffer.from(b.toString('ascii'), 'ascii') + .indexOf(Buffer.from('d', 'ascii'), 0, 'ascii'), + 3 + ) + + // test optional offset with passed encoding + t.equal(Buffer.from('aaaa0').indexOf('30', 'hex'), 4) + t.equal(Buffer.from('aaaa00a').indexOf('3030', 'hex'), 4) + + { + // test usc2 encoding + const twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2') + + t.equal(8, twoByteString.indexOf('\u0395', 4, 'ucs2')) + t.equal(6, twoByteString.indexOf('\u03a3', -4, 'ucs2')) + t.equal(4, twoByteString.indexOf('\u03a3', -6, 'ucs2')) + t.equal(4, twoByteString.indexOf( + Buffer.from('\u03a3', 'ucs2'), -6, 'ucs2')) + t.equal(-1, twoByteString.indexOf('\u03a3', -2, 'ucs2')) + } + + const mixedByteStringUcs2 = + Buffer.from('\u039a\u0391abc\u03a3\u03a3\u0395', 'ucs2') + + t.equal(6, mixedByteStringUcs2.indexOf('bc', 0, 'ucs2')) + t.equal(10, mixedByteStringUcs2.indexOf('\u03a3', 0, 'ucs2')) + t.equal(-1, mixedByteStringUcs2.indexOf('\u0396', 0, 'ucs2')) + + t.equal( + 6, mixedByteStringUcs2.indexOf(Buffer.from('bc', 'ucs2'), 0, 'ucs2')) + t.equal( + 10, mixedByteStringUcs2.indexOf(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2')) + t.equal( + -1, mixedByteStringUcs2.indexOf(Buffer.from('\u0396', 'ucs2'), 0, 'ucs2')) + + { + const twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2') + + // Test single char pattern + t.equal(0, twoByteString.indexOf('\u039a', 0, 'ucs2')) + let index = twoByteString.indexOf('\u0391', 0, 'ucs2') + t.equal(2, index, `Alpha - at index ${index}`) + index = twoByteString.indexOf('\u03a3', 0, 'ucs2') + t.equal(4, index, `First Sigma - at index ${index}`) + index = twoByteString.indexOf('\u03a3', 6, 'ucs2') + t.equal(6, index, `Second Sigma - at index ${index}`) + index = twoByteString.indexOf('\u0395', 0, 'ucs2') + t.equal(8, index, `Epsilon - at index ${index}`) + index = twoByteString.indexOf('\u0392', 0, 'ucs2') + t.equal(-1, index, `Not beta - at index ${index}`) + + // Test multi-char pattern + index = twoByteString.indexOf('\u039a\u0391', 0, 'ucs2') + t.equal(0, index, `Lambda Alpha - at index ${index}`) + index = twoByteString.indexOf('\u0391\u03a3', 0, 'ucs2') + t.equal(2, index, `Alpha Sigma - at index ${index}`) + index = twoByteString.indexOf('\u03a3\u03a3', 0, 'ucs2') + t.equal(4, index, `Sigma Sigma - at index ${index}`) + index = twoByteString.indexOf('\u03a3\u0395', 0, 'ucs2') + t.equal(6, index, `Sigma Epsilon - at index ${index}`) + } + + const mixedByteStringUtf8 = Buffer.from('\u039a\u0391abc\u03a3\u03a3\u0395') + + t.equal(5, mixedByteStringUtf8.indexOf('bc')) + t.equal(5, mixedByteStringUtf8.indexOf('bc', 5)) + t.equal(5, mixedByteStringUtf8.indexOf('bc', -8)) + t.equal(7, mixedByteStringUtf8.indexOf('\u03a3')) + t.equal(-1, mixedByteStringUtf8.indexOf('\u0396')) + + // Test complex string indexOf algorithms. Only trigger for long strings. + // Long string that isn't a simple repeat of a shorter string. + let longString = 'A' + for (let i = 66; i < 76; i++) { // from 'B' to 'K' + longString = longString + String.fromCharCode(i) + longString + } + + const longBufferString = Buffer.from(longString) + + // pattern of 15 chars, repeated every 16 chars in long + let pattern = 'ABACABADABACABA' + for (let i = 0; i < longBufferString.length - pattern.length; i += 7) { + const index = longBufferString.indexOf(pattern, i) + t.equal((i + 15) & ~0xf, index, + `Long ABACABA...-string at index ${i}`) + } + + let index = longBufferString.indexOf('AJABACA') + t.equal(510, index, `Long AJABACA, First J - at index ${index}`) + index = longBufferString.indexOf('AJABACA', 511) + t.equal(1534, index, `Long AJABACA, Second J - at index ${index}`) + + pattern = 'JABACABADABACABA' + index = longBufferString.indexOf(pattern) + t.equal(511, index, `Long JABACABA..., First J - at index ${index}`) + index = longBufferString.indexOf(pattern, 512) + t.equal( + 1535, index, `Long JABACABA..., Second J - at index ${index}`) + + // Search for a non-ASCII string in a pure ASCII string. + const asciiString = Buffer.from( + 'somethingnotatallsinisterwhichalsoworks') + t.equal(-1, asciiString.indexOf('\x2061')) + t.equal(3, asciiString.indexOf('eth', 0)) + + // Search in string containing many non-ASCII chars. + const allCodePoints = [] + for (let i = 0; i < 65536; i++) { + allCodePoints[i] = i + } + + const allCharsString = String.fromCharCode.apply(String, allCodePoints) + const allCharsBufferUtf8 = Buffer.from(allCharsString) + const allCharsBufferUcs2 = Buffer.from(allCharsString, 'ucs2') + + // Search for string long enough to trigger complex search with ASCII pattern + // and UC16 subject. + t.equal(-1, allCharsBufferUtf8.indexOf('notfound')) + t.equal(-1, allCharsBufferUcs2.indexOf('notfound')) + + // Needle is longer than haystack, but only because it's encoded as UTF-16 + t.equal(Buffer.from('aaaa').indexOf('a'.repeat(4), 'ucs2'), -1) + + t.equal(Buffer.from('aaaa').indexOf('a'.repeat(4), 'utf8'), 0) + t.equal(Buffer.from('aaaa').indexOf('你好', 'ucs2'), -1) + + // Haystack has odd length, but the needle is UCS2. + t.equal(Buffer.from('aaaaa').indexOf('b', 'ucs2'), -1) + + { + // Find substrings in Utf8. + const lengths = [1, 3, 15] // Single char, simple and complex. + const indices = [0x5, 0x60, 0x400, 0x680, 0x7ee, 0xFF02, 0x16610, 0x2f77b] + for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) { + for (let i = 0; i < indices.length; i++) { + const index = indices[i] + let length = lengths[lengthIndex] + + if (index + length > 0x7F) { + length = 2 * length + } + + if (index + length > 0x7FF) { + length = 3 * length + } + + if (index + length > 0xFFFF) { + length = 4 * length + } + + const patternBufferUtf8 = allCharsBufferUtf8.slice(index, index + length) + t.equal(index, allCharsBufferUtf8.indexOf(patternBufferUtf8)) + + const patternStringUtf8 = patternBufferUtf8.toString() + t.equal(index, allCharsBufferUtf8.indexOf(patternStringUtf8)) + } + } + } + + { + // Find substrings in Usc2. + const lengths = [2, 4, 16] // Single char, simple and complex. + const indices = [0x5, 0x65, 0x105, 0x205, 0x285, 0x2005, 0x2085, 0xfff0] + + for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) { + for (let i = 0; i < indices.length; i++) { + const index = indices[i] * 2 + const length = lengths[lengthIndex] + + const patternBufferUcs2 = + allCharsBufferUcs2.slice(index, index + length) + t.equal( + index, allCharsBufferUcs2.indexOf(patternBufferUcs2, 0, 'ucs2')) + + const patternStringUcs2 = patternBufferUcs2.toString('ucs2') + t.equal( + index, allCharsBufferUcs2.indexOf(patternStringUcs2, 0, 'ucs2')) + } + } + } + + [ + () => {}, + {}, + [] + ].forEach((val) => { + t.throws(() => b.indexOf(val), TypeError, `"${JSON.stringify(val)}" should throw`) + }) + + // Test weird offset arguments. + // The following offsets coerce to NaN or 0, searching the whole Buffer + t.equal(b.indexOf('b', undefined), 1) + t.equal(b.indexOf('b', {}), 1) + t.equal(b.indexOf('b', 0), 1) + t.equal(b.indexOf('b', null), 1) + t.equal(b.indexOf('b', []), 1) + + // The following offset coerces to 2, in other words +[2] === 2 + t.equal(b.indexOf('b', [2]), -1) + + // Behavior should match String.indexOf() + t.equal( + b.indexOf('b', undefined), + stringComparison.indexOf('b', undefined)) + t.equal( + b.indexOf('b', {}), + stringComparison.indexOf('b', {})) + t.equal( + b.indexOf('b', 0), + stringComparison.indexOf('b', 0)) + t.equal( + b.indexOf('b', null), + stringComparison.indexOf('b', null)) + t.equal( + b.indexOf('b', []), + stringComparison.indexOf('b', [])) + t.equal( + b.indexOf('b', [2]), + stringComparison.indexOf('b', [2])) + + // test truncation of Number arguments to uint8 + { + const buf = Buffer.from('this is a test') + + t.equal(buf.indexOf(0x6973), 3) + t.equal(buf.indexOf(0x697320), 4) + t.equal(buf.indexOf(0x69732069), 2) + t.equal(buf.indexOf(0x697374657374), 0) + t.equal(buf.indexOf(0x69737374), 0) + t.equal(buf.indexOf(0x69737465), 11) + t.equal(buf.indexOf(0x69737465), 11) + t.equal(buf.indexOf(-140), 0) + t.equal(buf.indexOf(-152), 1) + t.equal(buf.indexOf(0xff), -1) + t.equal(buf.indexOf(0xffff), -1) + } + + // Test that Uint8Array arguments are okay. + { + const needle = new Uint8Array([0x66, 0x6f, 0x6f]) + const haystack = new BufferList(Buffer.from('a foo b foo')) + t.equal(haystack.indexOf(needle), 2) + } + + t.end() +}) diff --git a/server/node_modules/bl/test/isBufferList.js b/server/node_modules/bl/test/isBufferList.js new file mode 100644 index 0000000..dbdbe29 --- /dev/null +++ b/server/node_modules/bl/test/isBufferList.js @@ -0,0 +1,32 @@ +'use strict' + +const tape = require('tape') +const { BufferList, BufferListStream } = require('bl') +const { Buffer } = require('buffer') + +tape('isBufferList positives', (t) => { + t.ok(BufferList.isBufferList(new BufferList())) + t.ok(BufferList.isBufferList(new BufferListStream())) + + t.end() +}) + +tape('isBufferList negatives', (t) => { + const types = [ + null, + undefined, + NaN, + true, + false, + {}, + [], + Buffer.alloc(0), + [Buffer.alloc(0)] + ] + + for (const obj of types) { + t.notOk(BufferList.isBufferList(obj)) + } + + t.end() +}) diff --git a/server/node_modules/bl/test/test.js b/server/node_modules/bl/test/test.js new file mode 100644 index 0000000..7f2b0dc --- /dev/null +++ b/server/node_modules/bl/test/test.js @@ -0,0 +1,869 @@ +'use strict' + +const tape = require('tape') +const crypto = require('crypto') +const fs = require('fs') +const path = require('path') +const BufferList = require('bl') +const { Buffer } = require('buffer') + +const encodings = + ('hex utf8 utf-8 ascii binary base64' + + (process.browser ? '' : ' ucs2 ucs-2 utf16le utf-16le')).split(' ') + +require('bl/test/indexOf') +require('bl/test/isBufferList') +require('bl/test/convert') + +tape('single bytes from single buffer', function (t) { + const bl = new BufferList() + + bl.append(Buffer.from('abcd')) + + t.equal(bl.length, 4) + t.equal(bl.get(-1), undefined) + t.equal(bl.get(0), 97) + t.equal(bl.get(1), 98) + t.equal(bl.get(2), 99) + t.equal(bl.get(3), 100) + t.equal(bl.get(4), undefined) + + t.end() +}) + +tape('single bytes from multiple buffers', function (t) { + const bl = new BufferList() + + bl.append(Buffer.from('abcd')) + bl.append(Buffer.from('efg')) + bl.append(Buffer.from('hi')) + bl.append(Buffer.from('j')) + + t.equal(bl.length, 10) + + t.equal(bl.get(0), 97) + t.equal(bl.get(1), 98) + t.equal(bl.get(2), 99) + t.equal(bl.get(3), 100) + t.equal(bl.get(4), 101) + t.equal(bl.get(5), 102) + t.equal(bl.get(6), 103) + t.equal(bl.get(7), 104) + t.equal(bl.get(8), 105) + t.equal(bl.get(9), 106) + + t.end() +}) + +tape('multi bytes from single buffer', function (t) { + const bl = new BufferList() + + bl.append(Buffer.from('abcd')) + + t.equal(bl.length, 4) + + t.equal(bl.slice(0, 4).toString('ascii'), 'abcd') + t.equal(bl.slice(0, 3).toString('ascii'), 'abc') + t.equal(bl.slice(1, 4).toString('ascii'), 'bcd') + t.equal(bl.slice(-4, -1).toString('ascii'), 'abc') + + t.end() +}) + +tape('multi bytes from single buffer (negative indexes)', function (t) { + const bl = new BufferList() + + bl.append(Buffer.from('buffer')) + + t.equal(bl.length, 6) + + t.equal(bl.slice(-6, -1).toString('ascii'), 'buffe') + t.equal(bl.slice(-6, -2).toString('ascii'), 'buff') + t.equal(bl.slice(-5, -2).toString('ascii'), 'uff') + + t.end() +}) + +tape('multiple bytes from multiple buffers', function (t) { + const bl = new BufferList() + + bl.append(Buffer.from('abcd')) + bl.append(Buffer.from('efg')) + bl.append(Buffer.from('hi')) + bl.append(Buffer.from('j')) + + t.equal(bl.length, 10) + + t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij') + t.equal(bl.slice(3, 10).toString('ascii'), 'defghij') + t.equal(bl.slice(3, 6).toString('ascii'), 'def') + t.equal(bl.slice(3, 8).toString('ascii'), 'defgh') + t.equal(bl.slice(5, 10).toString('ascii'), 'fghij') + t.equal(bl.slice(-7, -4).toString('ascii'), 'def') + + t.end() +}) + +tape('multiple bytes from multiple buffer lists', function (t) { + const bl = new BufferList() + + bl.append(new BufferList([Buffer.from('abcd'), Buffer.from('efg')])) + bl.append(new BufferList([Buffer.from('hi'), Buffer.from('j')])) + + t.equal(bl.length, 10) + + t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij') + + t.equal(bl.slice(3, 10).toString('ascii'), 'defghij') + t.equal(bl.slice(3, 6).toString('ascii'), 'def') + t.equal(bl.slice(3, 8).toString('ascii'), 'defgh') + t.equal(bl.slice(5, 10).toString('ascii'), 'fghij') + + t.end() +}) + +// same data as previous test, just using nested constructors +tape('multiple bytes from crazy nested buffer lists', function (t) { + const bl = new BufferList() + + bl.append(new BufferList([ + new BufferList([ + new BufferList(Buffer.from('abc')), + Buffer.from('d'), + new BufferList(Buffer.from('efg')) + ]), + new BufferList([Buffer.from('hi')]), + new BufferList(Buffer.from('j')) + ])) + + t.equal(bl.length, 10) + + t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij') + + t.equal(bl.slice(3, 10).toString('ascii'), 'defghij') + t.equal(bl.slice(3, 6).toString('ascii'), 'def') + t.equal(bl.slice(3, 8).toString('ascii'), 'defgh') + t.equal(bl.slice(5, 10).toString('ascii'), 'fghij') + + t.end() +}) + +tape('append accepts arrays of Buffers', function (t) { + const bl = new BufferList() + + bl.append(Buffer.from('abc')) + bl.append([Buffer.from('def')]) + bl.append([Buffer.from('ghi'), Buffer.from('jkl')]) + bl.append([Buffer.from('mnop'), Buffer.from('qrstu'), Buffer.from('vwxyz')]) + t.equal(bl.length, 26) + t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz') + + t.end() +}) + +tape('append accepts arrays of Uint8Arrays', function (t) { + const bl = new BufferList() + + bl.append(new Uint8Array([97, 98, 99])) + bl.append([Uint8Array.from([100, 101, 102])]) + bl.append([new Uint8Array([103, 104, 105]), new Uint8Array([106, 107, 108])]) + bl.append([new Uint8Array([109, 110, 111, 112]), new Uint8Array([113, 114, 115, 116, 117]), new Uint8Array([118, 119, 120, 121, 122])]) + t.equal(bl.length, 26) + t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz') + + t.end() +}) + +tape('append accepts arrays of BufferLists', function (t) { + const bl = new BufferList() + + bl.append(Buffer.from('abc')) + bl.append([new BufferList('def')]) + bl.append(new BufferList([Buffer.from('ghi'), new BufferList('jkl')])) + bl.append([Buffer.from('mnop'), new BufferList([Buffer.from('qrstu'), Buffer.from('vwxyz')])]) + t.equal(bl.length, 26) + t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz') + + t.end() +}) + +tape('append chainable', function (t) { + const bl = new BufferList() + + t.ok(bl.append(Buffer.from('abcd')) === bl) + t.ok(bl.append([Buffer.from('abcd')]) === bl) + t.ok(bl.append(new BufferList(Buffer.from('abcd'))) === bl) + t.ok(bl.append([new BufferList(Buffer.from('abcd'))]) === bl) + + t.end() +}) + +tape('append chainable (test results)', function (t) { + const bl = new BufferList('abc') + .append([new BufferList('def')]) + .append(new BufferList([Buffer.from('ghi'), new BufferList('jkl')])) + .append([Buffer.from('mnop'), new BufferList([Buffer.from('qrstu'), Buffer.from('vwxyz')])]) + + t.equal(bl.length, 26) + t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz') + + t.end() +}) + +tape('consuming from multiple buffers', function (t) { + const bl = new BufferList() + + bl.append(Buffer.from('abcd')) + bl.append(Buffer.from('efg')) + bl.append(Buffer.from('hi')) + bl.append(Buffer.from('j')) + + t.equal(bl.length, 10) + + t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij') + + bl.consume(3) + t.equal(bl.length, 7) + t.equal(bl.slice(0, 7).toString('ascii'), 'defghij') + + bl.consume(2) + t.equal(bl.length, 5) + t.equal(bl.slice(0, 5).toString('ascii'), 'fghij') + + bl.consume(1) + t.equal(bl.length, 4) + t.equal(bl.slice(0, 4).toString('ascii'), 'ghij') + + bl.consume(1) + t.equal(bl.length, 3) + t.equal(bl.slice(0, 3).toString('ascii'), 'hij') + + bl.consume(2) + t.equal(bl.length, 1) + t.equal(bl.slice(0, 1).toString('ascii'), 'j') + + t.end() +}) + +tape('complete consumption', function (t) { + const bl = new BufferList() + + bl.append(Buffer.from('a')) + bl.append(Buffer.from('b')) + + bl.consume(2) + + t.equal(bl.length, 0) + t.equal(bl._bufs.length, 0) + + t.end() +}) + +tape('test readUInt8 / readInt8', function (t) { + const buf1 = Buffer.alloc(1) + const buf2 = Buffer.alloc(3) + const buf3 = Buffer.alloc(3) + const bl = new BufferList() + + buf1[0] = 0x1 + buf2[1] = 0x3 + buf2[2] = 0x4 + buf3[0] = 0x23 + buf3[1] = 0x42 + + bl.append(buf1) + bl.append(buf2) + bl.append(buf3) + + t.equal(bl.readUInt8(), 0x1) + t.equal(bl.readUInt8(2), 0x3) + t.equal(bl.readInt8(2), 0x3) + t.equal(bl.readUInt8(3), 0x4) + t.equal(bl.readInt8(3), 0x4) + t.equal(bl.readUInt8(4), 0x23) + t.equal(bl.readInt8(4), 0x23) + t.equal(bl.readUInt8(5), 0x42) + t.equal(bl.readInt8(5), 0x42) + + t.end() +}) + +tape('test readUInt16LE / readUInt16BE / readInt16LE / readInt16BE', function (t) { + const buf1 = Buffer.alloc(1) + const buf2 = Buffer.alloc(3) + const buf3 = Buffer.alloc(3) + const bl = new BufferList() + + buf1[0] = 0x1 + buf2[1] = 0x3 + buf2[2] = 0x4 + buf3[0] = 0x23 + buf3[1] = 0x42 + + bl.append(buf1) + bl.append(buf2) + bl.append(buf3) + + t.equal(bl.readUInt16BE(), 0x0100) + t.equal(bl.readUInt16LE(), 0x0001) + t.equal(bl.readUInt16BE(2), 0x0304) + t.equal(bl.readUInt16LE(2), 0x0403) + t.equal(bl.readInt16BE(2), 0x0304) + t.equal(bl.readInt16LE(2), 0x0403) + t.equal(bl.readUInt16BE(3), 0x0423) + t.equal(bl.readUInt16LE(3), 0x2304) + t.equal(bl.readInt16BE(3), 0x0423) + t.equal(bl.readInt16LE(3), 0x2304) + t.equal(bl.readUInt16BE(4), 0x2342) + t.equal(bl.readUInt16LE(4), 0x4223) + t.equal(bl.readInt16BE(4), 0x2342) + t.equal(bl.readInt16LE(4), 0x4223) + + t.end() +}) + +tape('test readUInt32LE / readUInt32BE / readInt32LE / readInt32BE', function (t) { + const buf1 = Buffer.alloc(1) + const buf2 = Buffer.alloc(3) + const buf3 = Buffer.alloc(3) + const bl = new BufferList() + + buf1[0] = 0x1 + buf2[1] = 0x3 + buf2[2] = 0x4 + buf3[0] = 0x23 + buf3[1] = 0x42 + + bl.append(buf1) + bl.append(buf2) + bl.append(buf3) + + t.equal(bl.readUInt32BE(), 0x01000304) + t.equal(bl.readUInt32LE(), 0x04030001) + t.equal(bl.readUInt32BE(2), 0x03042342) + t.equal(bl.readUInt32LE(2), 0x42230403) + t.equal(bl.readInt32BE(2), 0x03042342) + t.equal(bl.readInt32LE(2), 0x42230403) + + t.end() +}) + +tape('test readUIntLE / readUIntBE / readIntLE / readIntBE', function (t) { + const buf1 = Buffer.alloc(1) + const buf2 = Buffer.alloc(3) + const buf3 = Buffer.alloc(3) + const bl = new BufferList() + + buf2[0] = 0x2 + buf2[1] = 0x3 + buf2[2] = 0x4 + buf3[0] = 0x23 + buf3[1] = 0x42 + buf3[2] = 0x61 + + bl.append(buf1) + bl.append(buf2) + bl.append(buf3) + + t.equal(bl.readUIntBE(1, 1), 0x02) + t.equal(bl.readUIntBE(1, 2), 0x0203) + t.equal(bl.readUIntBE(1, 3), 0x020304) + t.equal(bl.readUIntBE(1, 4), 0x02030423) + t.equal(bl.readUIntBE(1, 5), 0x0203042342) + t.equal(bl.readUIntBE(1, 6), 0x020304234261) + t.equal(bl.readUIntLE(1, 1), 0x02) + t.equal(bl.readUIntLE(1, 2), 0x0302) + t.equal(bl.readUIntLE(1, 3), 0x040302) + t.equal(bl.readUIntLE(1, 4), 0x23040302) + t.equal(bl.readUIntLE(1, 5), 0x4223040302) + t.equal(bl.readUIntLE(1, 6), 0x614223040302) + t.equal(bl.readIntBE(1, 1), 0x02) + t.equal(bl.readIntBE(1, 2), 0x0203) + t.equal(bl.readIntBE(1, 3), 0x020304) + t.equal(bl.readIntBE(1, 4), 0x02030423) + t.equal(bl.readIntBE(1, 5), 0x0203042342) + t.equal(bl.readIntBE(1, 6), 0x020304234261) + t.equal(bl.readIntLE(1, 1), 0x02) + t.equal(bl.readIntLE(1, 2), 0x0302) + t.equal(bl.readIntLE(1, 3), 0x040302) + t.equal(bl.readIntLE(1, 4), 0x23040302) + t.equal(bl.readIntLE(1, 5), 0x4223040302) + t.equal(bl.readIntLE(1, 6), 0x614223040302) + + t.end() +}) + +tape('test readFloatLE / readFloatBE', function (t) { + const buf1 = Buffer.alloc(1) + const buf2 = Buffer.alloc(3) + const buf3 = Buffer.alloc(3) + const bl = new BufferList() + + buf1[0] = 0x01 + buf2[1] = 0x00 + buf2[2] = 0x00 + buf3[0] = 0x80 + buf3[1] = 0x3f + + bl.append(buf1) + bl.append(buf2) + bl.append(buf3) + + const canonical = Buffer.concat([buf1, buf2, buf3]) + t.equal(bl.readFloatLE(), canonical.readFloatLE()) + t.equal(bl.readFloatBE(), canonical.readFloatBE()) + t.equal(bl.readFloatLE(2), canonical.readFloatLE(2)) + t.equal(bl.readFloatBE(2), canonical.readFloatBE(2)) + + t.end() +}) + +tape('test readDoubleLE / readDoubleBE', function (t) { + const buf1 = Buffer.alloc(1) + const buf2 = Buffer.alloc(3) + const buf3 = Buffer.alloc(10) + const bl = new BufferList() + + buf1[0] = 0x01 + buf2[1] = 0x55 + buf2[2] = 0x55 + buf3[0] = 0x55 + buf3[1] = 0x55 + buf3[2] = 0x55 + buf3[3] = 0x55 + buf3[4] = 0xd5 + buf3[5] = 0x3f + + bl.append(buf1) + bl.append(buf2) + bl.append(buf3) + + const canonical = Buffer.concat([buf1, buf2, buf3]) + t.equal(bl.readDoubleBE(), canonical.readDoubleBE()) + t.equal(bl.readDoubleLE(), canonical.readDoubleLE()) + t.equal(bl.readDoubleBE(2), canonical.readDoubleBE(2)) + t.equal(bl.readDoubleLE(2), canonical.readDoubleLE(2)) + + t.end() +}) + +tape('test toString', function (t) { + const bl = new BufferList() + + bl.append(Buffer.from('abcd')) + bl.append(Buffer.from('efg')) + bl.append(Buffer.from('hi')) + bl.append(Buffer.from('j')) + + t.equal(bl.toString('ascii', 0, 10), 'abcdefghij') + t.equal(bl.toString('ascii', 3, 10), 'defghij') + t.equal(bl.toString('ascii', 3, 6), 'def') + t.equal(bl.toString('ascii', 3, 8), 'defgh') + t.equal(bl.toString('ascii', 5, 10), 'fghij') + + t.end() +}) + +tape('test toString encoding', function (t) { + const bl = new BufferList() + const b = Buffer.from('abcdefghij\xff\x00') + + bl.append(Buffer.from('abcd')) + bl.append(Buffer.from('efg')) + bl.append(Buffer.from('hi')) + bl.append(Buffer.from('j')) + bl.append(Buffer.from('\xff\x00')) + + encodings.forEach(function (enc) { + t.equal(bl.toString(enc), b.toString(enc), enc) + }) + + t.end() +}) + +tape('uninitialized memory', function (t) { + const secret = crypto.randomBytes(256) + for (let i = 0; i < 1e6; i++) { + const clone = Buffer.from(secret) + const bl = new BufferList() + bl.append(Buffer.from('a')) + bl.consume(-1024) + const buf = bl.slice(1) + if (buf.indexOf(clone) !== -1) { + t.fail(`Match (at ${i})`) + break + } + } + t.end() +}) + +!process.browser && tape('test stream', function (t) { + const random = crypto.randomBytes(65534) + + const bl = new BufferList((err, buf) => { + t.ok(Buffer.isBuffer(buf)) + t.ok(err === null) + t.ok(random.equals(bl.slice())) + t.ok(random.equals(buf.slice())) + + bl.pipe(fs.createWriteStream('/tmp/bl_test_rnd_out.dat')) + .on('close', function () { + const rndhash = crypto.createHash('md5').update(random).digest('hex') + const md5sum = crypto.createHash('md5') + const s = fs.createReadStream('/tmp/bl_test_rnd_out.dat') + + s.on('data', md5sum.update.bind(md5sum)) + s.on('end', function () { + t.equal(rndhash, md5sum.digest('hex'), 'woohoo! correct hash!') + t.end() + }) + }) + }) + + fs.writeFileSync('/tmp/bl_test_rnd.dat', random) + fs.createReadStream('/tmp/bl_test_rnd.dat').pipe(bl) +}) + +tape('instantiation with Buffer', function (t) { + const buf = crypto.randomBytes(1024) + const buf2 = crypto.randomBytes(1024) + let b = BufferList(buf) + + t.equal(buf.toString('hex'), b.slice().toString('hex'), 'same buffer') + b = BufferList([buf, buf2]) + t.equal(b.slice().toString('hex'), Buffer.concat([buf, buf2]).toString('hex'), 'same buffer') + + t.end() +}) + +tape('test String appendage', function (t) { + const bl = new BufferList() + const b = Buffer.from('abcdefghij\xff\x00') + + bl.append('abcd') + bl.append('efg') + bl.append('hi') + bl.append('j') + bl.append('\xff\x00') + + encodings.forEach(function (enc) { + t.equal(bl.toString(enc), b.toString(enc)) + }) + + t.end() +}) + +tape('test Number appendage', function (t) { + const bl = new BufferList() + const b = Buffer.from('1234567890') + + bl.append(1234) + bl.append(567) + bl.append(89) + bl.append(0) + + encodings.forEach(function (enc) { + t.equal(bl.toString(enc), b.toString(enc)) + }) + + t.end() +}) + +tape('write nothing, should get empty buffer', function (t) { + t.plan(3) + BufferList(function (err, data) { + t.notOk(err, 'no error') + t.ok(Buffer.isBuffer(data), 'got a buffer') + t.equal(0, data.length, 'got a zero-length buffer') + t.end() + }).end() +}) + +tape('unicode string', function (t) { + t.plan(2) + + const inp1 = '\u2600' + const inp2 = '\u2603' + const exp = inp1 + ' and ' + inp2 + const bl = BufferList() + + bl.write(inp1) + bl.write(' and ') + bl.write(inp2) + t.equal(exp, bl.toString()) + t.equal(Buffer.from(exp).toString('hex'), bl.toString('hex')) +}) + +tape('should emit finish', function (t) { + const source = BufferList() + const dest = BufferList() + + source.write('hello') + source.pipe(dest) + + dest.on('finish', function () { + t.equal(dest.toString('utf8'), 'hello') + t.end() + }) +}) + +tape('basic copy', function (t) { + const buf = crypto.randomBytes(1024) + const buf2 = Buffer.alloc(1024) + const b = BufferList(buf) + + b.copy(buf2) + t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer') + + t.end() +}) + +tape('copy after many appends', function (t) { + const buf = crypto.randomBytes(512) + const buf2 = Buffer.alloc(1024) + const b = BufferList(buf) + + b.append(buf) + b.copy(buf2) + t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer') + + t.end() +}) + +tape('copy at a precise position', function (t) { + const buf = crypto.randomBytes(1004) + const buf2 = Buffer.alloc(1024) + const b = BufferList(buf) + + b.copy(buf2, 20) + t.equal(b.slice().toString('hex'), buf2.slice(20).toString('hex'), 'same buffer') + + t.end() +}) + +tape('copy starting from a precise location', function (t) { + const buf = crypto.randomBytes(10) + const buf2 = Buffer.alloc(5) + const b = BufferList(buf) + + b.copy(buf2, 0, 5) + t.equal(b.slice(5).toString('hex'), buf2.toString('hex'), 'same buffer') + + t.end() +}) + +tape('copy in an interval', function (t) { + const rnd = crypto.randomBytes(10) + const b = BufferList(rnd) // put the random bytes there + const actual = Buffer.alloc(3) + const expected = Buffer.alloc(3) + + rnd.copy(expected, 0, 5, 8) + b.copy(actual, 0, 5, 8) + + t.equal(actual.toString('hex'), expected.toString('hex'), 'same buffer') + + t.end() +}) + +tape('copy an interval between two buffers', function (t) { + const buf = crypto.randomBytes(10) + const buf2 = Buffer.alloc(10) + const b = BufferList(buf) + + b.append(buf) + b.copy(buf2, 0, 5, 15) + + t.equal(b.slice(5, 15).toString('hex'), buf2.toString('hex'), 'same buffer') + + t.end() +}) + +tape('shallow slice across buffer boundaries', function (t) { + const bl = new BufferList(['First', 'Second', 'Third']) + + t.equal(bl.shallowSlice(3, 13).toString(), 'stSecondTh') + + t.end() +}) + +tape('shallow slice within single buffer', function (t) { + t.plan(2) + + const bl = new BufferList(['First', 'Second', 'Third']) + + t.equal(bl.shallowSlice(5, 10).toString(), 'Secon') + t.equal(bl.shallowSlice(7, 10).toString(), 'con') + + t.end() +}) + +tape('shallow slice single buffer', function (t) { + t.plan(3) + + const bl = new BufferList(['First', 'Second', 'Third']) + + t.equal(bl.shallowSlice(0, 5).toString(), 'First') + t.equal(bl.shallowSlice(5, 11).toString(), 'Second') + t.equal(bl.shallowSlice(11, 16).toString(), 'Third') +}) + +tape('shallow slice with negative or omitted indices', function (t) { + t.plan(4) + + const bl = new BufferList(['First', 'Second', 'Third']) + + t.equal(bl.shallowSlice().toString(), 'FirstSecondThird') + t.equal(bl.shallowSlice(5).toString(), 'SecondThird') + t.equal(bl.shallowSlice(5, -3).toString(), 'SecondTh') + t.equal(bl.shallowSlice(-8).toString(), 'ondThird') +}) + +tape('shallow slice does not make a copy', function (t) { + t.plan(1) + + const buffers = [Buffer.from('First'), Buffer.from('Second'), Buffer.from('Third')] + const bl = (new BufferList(buffers)).shallowSlice(5, -3) + + buffers[1].fill('h') + buffers[2].fill('h') + + t.equal(bl.toString(), 'hhhhhhhh') +}) + +tape('shallow slice with 0 length', function (t) { + t.plan(1) + + const buffers = [Buffer.from('First'), Buffer.from('Second'), Buffer.from('Third')] + const bl = (new BufferList(buffers)).shallowSlice(0, 0) + + t.equal(bl.length, 0) +}) + +tape('shallow slice with 0 length from middle', function (t) { + t.plan(1) + + const buffers = [Buffer.from('First'), Buffer.from('Second'), Buffer.from('Third')] + const bl = (new BufferList(buffers)).shallowSlice(10, 10) + + t.equal(bl.length, 0) +}) + +tape('duplicate', function (t) { + t.plan(2) + + const bl = new BufferList('abcdefghij\xff\x00') + const dup = bl.duplicate() + + t.equal(bl.prototype, dup.prototype) + t.equal(bl.toString('hex'), dup.toString('hex')) +}) + +tape('destroy no pipe', function (t) { + t.plan(2) + + const bl = new BufferList('alsdkfja;lsdkfja;lsdk') + + bl.destroy() + + t.equal(bl._bufs.length, 0) + t.equal(bl.length, 0) +}) + +tape('destroy with error', function (t) { + t.plan(3) + + const bl = new BufferList('alsdkfja;lsdkfja;lsdk') + const err = new Error('kaboom') + + bl.destroy(err) + bl.on('error', function (_err) { + t.equal(_err, err) + }) + + t.equal(bl._bufs.length, 0) + t.equal(bl.length, 0) +}) + +!process.browser && tape('destroy with pipe before read end', function (t) { + t.plan(2) + + const bl = new BufferList() + fs.createReadStream(path.join(__dirname, '/test.js')) + .pipe(bl) + + bl.destroy() + + t.equal(bl._bufs.length, 0) + t.equal(bl.length, 0) +}) + +!process.browser && tape('destroy with pipe before read end with race', function (t) { + t.plan(2) + + const bl = new BufferList() + + fs.createReadStream(path.join(__dirname, '/test.js')) + .pipe(bl) + + setTimeout(function () { + bl.destroy() + setTimeout(function () { + t.equal(bl._bufs.length, 0) + t.equal(bl.length, 0) + }, 500) + }, 500) +}) + +!process.browser && tape('destroy with pipe after read end', function (t) { + t.plan(2) + + const bl = new BufferList() + + fs.createReadStream(path.join(__dirname, '/test.js')) + .on('end', onEnd) + .pipe(bl) + + function onEnd () { + bl.destroy() + + t.equal(bl._bufs.length, 0) + t.equal(bl.length, 0) + } +}) + +!process.browser && tape('destroy with pipe while writing to a destination', function (t) { + t.plan(4) + + const bl = new BufferList() + const ds = new BufferList() + + fs.createReadStream(path.join(__dirname, '/test.js')) + .on('end', onEnd) + .pipe(bl) + + function onEnd () { + bl.pipe(ds) + + setTimeout(function () { + bl.destroy() + + t.equals(bl._bufs.length, 0) + t.equals(bl.length, 0) + + ds.destroy() + + t.equals(bl._bufs.length, 0) + t.equals(bl.length, 0) + }, 100) + } +}) + +!process.browser && tape('handle error', function (t) { + t.plan(2) + + fs.createReadStream('/does/not/exist').pipe(BufferList(function (err, data) { + t.ok(err instanceof Error, 'has error') + t.notOk(data, 'no data') + })) +}) diff --git a/server/node_modules/body-parser/HISTORY.md b/server/node_modules/body-parser/HISTORY.md new file mode 100644 index 0000000..34e0d4c --- /dev/null +++ b/server/node_modules/body-parser/HISTORY.md @@ -0,0 +1,624 @@ +1.19.1 / 2021-12-10 +=================== + + * deps: bytes@3.1.1 + * deps: http-errors@1.8.1 + - deps: inherits@2.0.4 + - deps: toidentifier@1.0.1 + - deps: setprototypeof@1.2.0 + * deps: qs@6.9.6 + * deps: raw-body@2.4.2 + - deps: bytes@3.1.1 + - deps: http-errors@1.8.1 + * deps: safe-buffer@5.2.1 + * deps: type-is@~1.6.18 + +1.19.0 / 2019-04-25 +=================== + + * deps: bytes@3.1.0 + - Add petabyte (`pb`) support + * deps: http-errors@1.7.2 + - Set constructor name when possible + - deps: setprototypeof@1.1.1 + - deps: statuses@'>= 1.5.0 < 2' + * deps: iconv-lite@0.4.24 + - Added encoding MIK + * deps: qs@6.7.0 + - Fix parsing array brackets after index + * deps: raw-body@2.4.0 + - deps: bytes@3.1.0 + - deps: http-errors@1.7.2 + - deps: iconv-lite@0.4.24 + * deps: type-is@~1.6.17 + - deps: mime-types@~2.1.24 + - perf: prevent internal `throw` on invalid type + +1.18.3 / 2018-05-14 +=================== + + * Fix stack trace for strict json parse error + * deps: depd@~1.1.2 + - perf: remove argument reassignment + * deps: http-errors@~1.6.3 + - deps: depd@~1.1.2 + - deps: setprototypeof@1.1.0 + - deps: statuses@'>= 1.3.1 < 2' + * deps: iconv-lite@0.4.23 + - Fix loading encoding with year appended + - Fix deprecation warnings on Node.js 10+ + * deps: qs@6.5.2 + * deps: raw-body@2.3.3 + - deps: http-errors@1.6.3 + - deps: iconv-lite@0.4.23 + * deps: type-is@~1.6.16 + - deps: mime-types@~2.1.18 + +1.18.2 / 2017-09-22 +=================== + + * deps: debug@2.6.9 + * perf: remove argument reassignment + +1.18.1 / 2017-09-12 +=================== + + * deps: content-type@~1.0.4 + - perf: remove argument reassignment + - perf: skip parameter parsing when no parameters + * deps: iconv-lite@0.4.19 + - Fix ISO-8859-1 regression + - Update Windows-1255 + * deps: qs@6.5.1 + - Fix parsing & compacting very deep objects + * deps: raw-body@2.3.2 + - deps: iconv-lite@0.4.19 + +1.18.0 / 2017-09-08 +=================== + + * Fix JSON strict violation error to match native parse error + * Include the `body` property on verify errors + * Include the `type` property on all generated errors + * Use `http-errors` to set status code on errors + * deps: bytes@3.0.0 + * deps: debug@2.6.8 + * deps: depd@~1.1.1 + - Remove unnecessary `Buffer` loading + * deps: http-errors@~1.6.2 + - deps: depd@1.1.1 + * deps: iconv-lite@0.4.18 + - Add support for React Native + - Add a warning if not loaded as utf-8 + - Fix CESU-8 decoding in Node.js 8 + - Improve speed of ISO-8859-1 encoding + * deps: qs@6.5.0 + * deps: raw-body@2.3.1 + - Use `http-errors` for standard emitted errors + - deps: bytes@3.0.0 + - deps: iconv-lite@0.4.18 + - perf: skip buffer decoding on overage chunk + * perf: prevent internal `throw` when missing charset + +1.17.2 / 2017-05-17 +=================== + + * deps: debug@2.6.7 + - Fix `DEBUG_MAX_ARRAY_LENGTH` + - deps: ms@2.0.0 + * deps: type-is@~1.6.15 + - deps: mime-types@~2.1.15 + +1.17.1 / 2017-03-06 +=================== + + * deps: qs@6.4.0 + - Fix regression parsing keys starting with `[` + +1.17.0 / 2017-03-01 +=================== + + * deps: http-errors@~1.6.1 + - Make `message` property enumerable for `HttpError`s + - deps: setprototypeof@1.0.3 + * deps: qs@6.3.1 + - Fix compacting nested arrays + +1.16.1 / 2017-02-10 +=================== + + * deps: debug@2.6.1 + - Fix deprecation messages in WebStorm and other editors + - Undeprecate `DEBUG_FD` set to `1` or `2` + +1.16.0 / 2017-01-17 +=================== + + * deps: debug@2.6.0 + - Allow colors in workers + - Deprecated `DEBUG_FD` environment variable + - Fix error when running under React Native + - Use same color for same namespace + - deps: ms@0.7.2 + * deps: http-errors@~1.5.1 + - deps: inherits@2.0.3 + - deps: setprototypeof@1.0.2 + - deps: statuses@'>= 1.3.1 < 2' + * deps: iconv-lite@0.4.15 + - Added encoding MS-31J + - Added encoding MS-932 + - Added encoding MS-936 + - Added encoding MS-949 + - Added encoding MS-950 + - Fix GBK/GB18030 handling of Euro character + * deps: qs@6.2.1 + - Fix array parsing from skipping empty values + * deps: raw-body@~2.2.0 + - deps: iconv-lite@0.4.15 + * deps: type-is@~1.6.14 + - deps: mime-types@~2.1.13 + +1.15.2 / 2016-06-19 +=================== + + * deps: bytes@2.4.0 + * deps: content-type@~1.0.2 + - perf: enable strict mode + * deps: http-errors@~1.5.0 + - Use `setprototypeof` module to replace `__proto__` setting + - deps: statuses@'>= 1.3.0 < 2' + - perf: enable strict mode + * deps: qs@6.2.0 + * deps: raw-body@~2.1.7 + - deps: bytes@2.4.0 + - perf: remove double-cleanup on happy path + * deps: type-is@~1.6.13 + - deps: mime-types@~2.1.11 + +1.15.1 / 2016-05-05 +=================== + + * deps: bytes@2.3.0 + - Drop partial bytes on all parsed units + - Fix parsing byte string that looks like hex + * deps: raw-body@~2.1.6 + - deps: bytes@2.3.0 + * deps: type-is@~1.6.12 + - deps: mime-types@~2.1.10 + +1.15.0 / 2016-02-10 +=================== + + * deps: http-errors@~1.4.0 + - Add `HttpError` export, for `err instanceof createError.HttpError` + - deps: inherits@2.0.1 + - deps: statuses@'>= 1.2.1 < 2' + * deps: qs@6.1.0 + * deps: type-is@~1.6.11 + - deps: mime-types@~2.1.9 + +1.14.2 / 2015-12-16 +=================== + + * deps: bytes@2.2.0 + * deps: iconv-lite@0.4.13 + * deps: qs@5.2.0 + * deps: raw-body@~2.1.5 + - deps: bytes@2.2.0 + - deps: iconv-lite@0.4.13 + * deps: type-is@~1.6.10 + - deps: mime-types@~2.1.8 + +1.14.1 / 2015-09-27 +=================== + + * Fix issue where invalid charset results in 400 when `verify` used + * deps: iconv-lite@0.4.12 + - Fix CESU-8 decoding in Node.js 4.x + * deps: raw-body@~2.1.4 + - Fix masking critical errors from `iconv-lite` + - deps: iconv-lite@0.4.12 + * deps: type-is@~1.6.9 + - deps: mime-types@~2.1.7 + +1.14.0 / 2015-09-16 +=================== + + * Fix JSON strict parse error to match syntax errors + * Provide static `require` analysis in `urlencoded` parser + * deps: depd@~1.1.0 + - Support web browser loading + * deps: qs@5.1.0 + * deps: raw-body@~2.1.3 + - Fix sync callback when attaching data listener causes sync read + * deps: type-is@~1.6.8 + - Fix type error when given invalid type to match against + - deps: mime-types@~2.1.6 + +1.13.3 / 2015-07-31 +=================== + + * deps: type-is@~1.6.6 + - deps: mime-types@~2.1.4 + +1.13.2 / 2015-07-05 +=================== + + * deps: iconv-lite@0.4.11 + * deps: qs@4.0.0 + - Fix dropping parameters like `hasOwnProperty` + - Fix user-visible incompatibilities from 3.1.0 + - Fix various parsing edge cases + * deps: raw-body@~2.1.2 + - Fix error stack traces to skip `makeError` + - deps: iconv-lite@0.4.11 + * deps: type-is@~1.6.4 + - deps: mime-types@~2.1.2 + - perf: enable strict mode + - perf: remove argument reassignment + +1.13.1 / 2015-06-16 +=================== + + * deps: qs@2.4.2 + - Downgraded from 3.1.0 because of user-visible incompatibilities + +1.13.0 / 2015-06-14 +=================== + + * Add `statusCode` property on `Error`s, in addition to `status` + * Change `type` default to `application/json` for JSON parser + * Change `type` default to `application/x-www-form-urlencoded` for urlencoded parser + * Provide static `require` analysis + * Use the `http-errors` module to generate errors + * deps: bytes@2.1.0 + - Slight optimizations + * deps: iconv-lite@0.4.10 + - The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails + - Leading BOM is now removed when decoding + * deps: on-finished@~2.3.0 + - Add defined behavior for HTTP `CONNECT` requests + - Add defined behavior for HTTP `Upgrade` requests + - deps: ee-first@1.1.1 + * deps: qs@3.1.0 + - Fix dropping parameters like `hasOwnProperty` + - Fix various parsing edge cases + - Parsed object now has `null` prototype + * deps: raw-body@~2.1.1 + - Use `unpipe` module for unpiping requests + - deps: iconv-lite@0.4.10 + * deps: type-is@~1.6.3 + - deps: mime-types@~2.1.1 + - perf: reduce try block size + - perf: remove bitwise operations + * perf: enable strict mode + * perf: remove argument reassignment + * perf: remove delete call + +1.12.4 / 2015-05-10 +=================== + + * deps: debug@~2.2.0 + * deps: qs@2.4.2 + - Fix allowing parameters like `constructor` + * deps: on-finished@~2.2.1 + * deps: raw-body@~2.0.1 + - Fix a false-positive when unpiping in Node.js 0.8 + - deps: bytes@2.0.1 + * deps: type-is@~1.6.2 + - deps: mime-types@~2.0.11 + +1.12.3 / 2015-04-15 +=================== + + * Slight efficiency improvement when not debugging + * deps: depd@~1.0.1 + * deps: iconv-lite@0.4.8 + - Add encoding alias UNICODE-1-1-UTF-7 + * deps: raw-body@1.3.4 + - Fix hanging callback if request aborts during read + - deps: iconv-lite@0.4.8 + +1.12.2 / 2015-03-16 +=================== + + * deps: qs@2.4.1 + - Fix error when parameter `hasOwnProperty` is present + +1.12.1 / 2015-03-15 +=================== + + * deps: debug@~2.1.3 + - Fix high intensity foreground color for bold + - deps: ms@0.7.0 + * deps: type-is@~1.6.1 + - deps: mime-types@~2.0.10 + +1.12.0 / 2015-02-13 +=================== + + * add `debug` messages + * accept a function for the `type` option + * use `content-type` to parse `Content-Type` headers + * deps: iconv-lite@0.4.7 + - Gracefully support enumerables on `Object.prototype` + * deps: raw-body@1.3.3 + - deps: iconv-lite@0.4.7 + * deps: type-is@~1.6.0 + - fix argument reassignment + - fix false-positives in `hasBody` `Transfer-Encoding` check + - support wildcard for both type and subtype (`*/*`) + - deps: mime-types@~2.0.9 + +1.11.0 / 2015-01-30 +=================== + + * make internal `extended: true` depth limit infinity + * deps: type-is@~1.5.6 + - deps: mime-types@~2.0.8 + +1.10.2 / 2015-01-20 +=================== + + * deps: iconv-lite@0.4.6 + - Fix rare aliases of single-byte encodings + * deps: raw-body@1.3.2 + - deps: iconv-lite@0.4.6 + +1.10.1 / 2015-01-01 +=================== + + * deps: on-finished@~2.2.0 + * deps: type-is@~1.5.5 + - deps: mime-types@~2.0.7 + +1.10.0 / 2014-12-02 +=================== + + * make internal `extended: true` array limit dynamic + +1.9.3 / 2014-11-21 +================== + + * deps: iconv-lite@0.4.5 + - Fix Windows-31J and X-SJIS encoding support + * deps: qs@2.3.3 + - Fix `arrayLimit` behavior + * deps: raw-body@1.3.1 + - deps: iconv-lite@0.4.5 + * deps: type-is@~1.5.3 + - deps: mime-types@~2.0.3 + +1.9.2 / 2014-10-27 +================== + + * deps: qs@2.3.2 + - Fix parsing of mixed objects and values + +1.9.1 / 2014-10-22 +================== + + * deps: on-finished@~2.1.1 + - Fix handling of pipelined requests + * deps: qs@2.3.0 + - Fix parsing of mixed implicit and explicit arrays + * deps: type-is@~1.5.2 + - deps: mime-types@~2.0.2 + +1.9.0 / 2014-09-24 +================== + + * include the charset in "unsupported charset" error message + * include the encoding in "unsupported content encoding" error message + * deps: depd@~1.0.0 + +1.8.4 / 2014-09-23 +================== + + * fix content encoding to be case-insensitive + +1.8.3 / 2014-09-19 +================== + + * deps: qs@2.2.4 + - Fix issue with object keys starting with numbers truncated + +1.8.2 / 2014-09-15 +================== + + * deps: depd@0.4.5 + +1.8.1 / 2014-09-07 +================== + + * deps: media-typer@0.3.0 + * deps: type-is@~1.5.1 + +1.8.0 / 2014-09-05 +================== + + * make empty-body-handling consistent between chunked requests + - empty `json` produces `{}` + - empty `raw` produces `new Buffer(0)` + - empty `text` produces `''` + - empty `urlencoded` produces `{}` + * deps: qs@2.2.3 + - Fix issue where first empty value in array is discarded + * deps: type-is@~1.5.0 + - fix `hasbody` to be true for `content-length: 0` + +1.7.0 / 2014-09-01 +================== + + * add `parameterLimit` option to `urlencoded` parser + * change `urlencoded` extended array limit to 100 + * respond with 413 when over `parameterLimit` in `urlencoded` + +1.6.7 / 2014-08-29 +================== + + * deps: qs@2.2.2 + - Remove unnecessary cloning + +1.6.6 / 2014-08-27 +================== + + * deps: qs@2.2.0 + - Array parsing fix + - Performance improvements + +1.6.5 / 2014-08-16 +================== + + * deps: on-finished@2.1.0 + +1.6.4 / 2014-08-14 +================== + + * deps: qs@1.2.2 + +1.6.3 / 2014-08-10 +================== + + * deps: qs@1.2.1 + +1.6.2 / 2014-08-07 +================== + + * deps: qs@1.2.0 + - Fix parsing array of objects + +1.6.1 / 2014-08-06 +================== + + * deps: qs@1.1.0 + - Accept urlencoded square brackets + - Accept empty values in implicit array notation + +1.6.0 / 2014-08-05 +================== + + * deps: qs@1.0.2 + - Complete rewrite + - Limits array length to 20 + - Limits object depth to 5 + - Limits parameters to 1,000 + +1.5.2 / 2014-07-27 +================== + + * deps: depd@0.4.4 + - Work-around v8 generating empty stack traces + +1.5.1 / 2014-07-26 +================== + + * deps: depd@0.4.3 + - Fix exception when global `Error.stackTraceLimit` is too low + +1.5.0 / 2014-07-20 +================== + + * deps: depd@0.4.2 + - Add `TRACE_DEPRECATION` environment variable + - Remove non-standard grey color from color output + - Support `--no-deprecation` argument + - Support `--trace-deprecation` argument + * deps: iconv-lite@0.4.4 + - Added encoding UTF-7 + * deps: raw-body@1.3.0 + - deps: iconv-lite@0.4.4 + - Added encoding UTF-7 + - Fix `Cannot switch to old mode now` error on Node.js 0.10+ + * deps: type-is@~1.3.2 + +1.4.3 / 2014-06-19 +================== + + * deps: type-is@1.3.1 + - fix global variable leak + +1.4.2 / 2014-06-19 +================== + + * deps: type-is@1.3.0 + - improve type parsing + +1.4.1 / 2014-06-19 +================== + + * fix urlencoded extended deprecation message + +1.4.0 / 2014-06-19 +================== + + * add `text` parser + * add `raw` parser + * check accepted charset in content-type (accepts utf-8) + * check accepted encoding in content-encoding (accepts identity) + * deprecate `bodyParser()` middleware; use `.json()` and `.urlencoded()` as needed + * deprecate `urlencoded()` without provided `extended` option + * lazy-load urlencoded parsers + * parsers split into files for reduced mem usage + * support gzip and deflate bodies + - set `inflate: false` to turn off + * deps: raw-body@1.2.2 + - Support all encodings from `iconv-lite` + +1.3.1 / 2014-06-11 +================== + + * deps: type-is@1.2.1 + - Switch dependency from mime to mime-types@1.0.0 + +1.3.0 / 2014-05-31 +================== + + * add `extended` option to urlencoded parser + +1.2.2 / 2014-05-27 +================== + + * deps: raw-body@1.1.6 + - assert stream encoding on node.js 0.8 + - assert stream encoding on node.js < 0.10.6 + - deps: bytes@1 + +1.2.1 / 2014-05-26 +================== + + * invoke `next(err)` after request fully read + - prevents hung responses and socket hang ups + +1.2.0 / 2014-05-11 +================== + + * add `verify` option + * deps: type-is@1.2.0 + - support suffix matching + +1.1.2 / 2014-05-11 +================== + + * improve json parser speed + +1.1.1 / 2014-05-11 +================== + + * fix repeated limit parsing with every request + +1.1.0 / 2014-05-10 +================== + + * add `type` option + * deps: pin for safety and consistency + +1.0.2 / 2014-04-14 +================== + + * use `type-is` module + +1.0.1 / 2014-03-20 +================== + + * lower default limits to 100kb diff --git a/server/node_modules/body-parser/LICENSE b/server/node_modules/body-parser/LICENSE new file mode 100644 index 0000000..386b7b6 --- /dev/null +++ b/server/node_modules/body-parser/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2014-2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/body-parser/README.md b/server/node_modules/body-parser/README.md new file mode 100644 index 0000000..7d7fa88 --- /dev/null +++ b/server/node_modules/body-parser/README.md @@ -0,0 +1,456 @@ +# body-parser + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Build Status][github-actions-ci-image]][github-actions-ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Node.js body parsing middleware. + +Parse incoming request bodies in a middleware before your handlers, available +under the `req.body` property. + +**Note** As `req.body`'s shape is based on user-controlled input, all +properties and values in this object are untrusted and should be validated +before trusting. For example, `req.body.foo.toString()` may fail in multiple +ways, for example the `foo` property may not be there or may not be a string, +and `toString` may not be a function and instead a string or other user input. + +[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/). + +_This does not handle multipart bodies_, due to their complex and typically +large nature. For multipart bodies, you may be interested in the following +modules: + + * [busboy](https://www.npmjs.org/package/busboy#readme) and + [connect-busboy](https://www.npmjs.org/package/connect-busboy#readme) + * [multiparty](https://www.npmjs.org/package/multiparty#readme) and + [connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme) + * [formidable](https://www.npmjs.org/package/formidable#readme) + * [multer](https://www.npmjs.org/package/multer#readme) + +This module provides the following parsers: + + * [JSON body parser](#bodyparserjsonoptions) + * [Raw body parser](#bodyparserrawoptions) + * [Text body parser](#bodyparsertextoptions) + * [URL-encoded form body parser](#bodyparserurlencodedoptions) + +Other body parsers you might be interested in: + +- [body](https://www.npmjs.org/package/body#readme) +- [co-body](https://www.npmjs.org/package/co-body#readme) + +## Installation + +```sh +$ npm install body-parser +``` + +## API + +```js +var bodyParser = require('body-parser') +``` + +The `bodyParser` object exposes various factories to create middlewares. All +middlewares will populate the `req.body` property with the parsed body when +the `Content-Type` request header matches the `type` option, or an empty +object (`{}`) if there was no body to parse, the `Content-Type` was not matched, +or an error occurred. + +The various errors returned by this module are described in the +[errors section](#errors). + +### bodyParser.json([options]) + +Returns middleware that only parses `json` and only looks at requests where +the `Content-Type` header matches the `type` option. This parser accepts any +Unicode encoding of the body and supports automatic inflation of `gzip` and +`deflate` encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). + +#### Options + +The `json` function takes an optional `options` object that may contain any of +the following keys: + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### reviver + +The `reviver` option is passed directly to `JSON.parse` as the second +argument. You can find more information on this argument +[in the MDN documentation about JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter). + +##### strict + +When set to `true`, will only accept arrays and objects; when `false` will +accept anything `JSON.parse` accepts. Defaults to `true`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. If not a +function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this can +be an extension name (like `json`), a mime type (like `application/json`), or +a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type` +option is called as `fn(req)` and the request is parsed if it returns a truthy +value. Defaults to `application/json`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.raw([options]) + +Returns middleware that parses all bodies as a `Buffer` and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser supports automatic inflation of `gzip` and `deflate` encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This will be a `Buffer` object +of the body. + +#### Options + +The `raw` function takes an optional `options` object that may contain any of +the following keys: + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. +If not a function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this +can be an extension name (like `bin`), a mime type (like +`application/octet-stream`), or a mime type with a wildcard (like `*/*` or +`application/*`). If a function, the `type` option is called as `fn(req)` +and the request is parsed if it returns a truthy value. Defaults to +`application/octet-stream`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.text([options]) + +Returns middleware that parses all bodies as a string and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser supports automatic inflation of `gzip` and `deflate` encodings. + +A new `body` string containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This will be a string of the +body. + +#### Options + +The `text` function takes an optional `options` object that may contain any of +the following keys: + +##### defaultCharset + +Specify the default character set for the text content if the charset is not +specified in the `Content-Type` header of the request. Defaults to `utf-8`. + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. If not +a function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this can +be an extension name (like `txt`), a mime type (like `text/plain`), or a mime +type with a wildcard (like `*/*` or `text/*`). If a function, the `type` +option is called as `fn(req)` and the request is parsed if it returns a +truthy value. Defaults to `text/plain`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.urlencoded([options]) + +Returns middleware that only parses `urlencoded` bodies and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser accepts only UTF-8 encoding of the body and supports automatic +inflation of `gzip` and `deflate` encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This object will contain +key-value pairs, where the value can be a string or array (when `extended` is +`false`), or any type (when `extended` is `true`). + +#### Options + +The `urlencoded` function takes an optional `options` object that may contain +any of the following keys: + +##### extended + +The `extended` option allows to choose between parsing the URL-encoded data +with the `querystring` library (when `false`) or the `qs` library (when +`true`). The "extended" syntax allows for rich objects and arrays to be +encoded into the URL-encoded format, allowing for a JSON-like experience +with URL-encoded. For more information, please +[see the qs library](https://www.npmjs.org/package/qs#readme). + +Defaults to `true`, but using the default has been deprecated. Please +research into the difference between `qs` and `querystring` and choose the +appropriate setting. + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### parameterLimit + +The `parameterLimit` option controls the maximum number of parameters that +are allowed in the URL-encoded data. If a request contains more parameters +than this value, a 413 will be returned to the client. Defaults to `1000`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. If not +a function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this can +be an extension name (like `urlencoded`), a mime type (like +`application/x-www-form-urlencoded`), or a mime type with a wildcard (like +`*/x-www-form-urlencoded`). If a function, the `type` option is called as +`fn(req)` and the request is parsed if it returns a truthy value. Defaults +to `application/x-www-form-urlencoded`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +## Errors + +The middlewares provided by this module create errors using the +[`http-errors` module](https://www.npmjs.com/package/http-errors). The errors +will typically have a `status`/`statusCode` property that contains the suggested +HTTP response code, an `expose` property to determine if the `message` property +should be displayed to the client, a `type` property to determine the type of +error without matching against the `message`, and a `body` property containing +the read body, if available. + +The following are the common errors created, though any error can come through +for various reasons. + +### content encoding unsupported + +This error will occur when the request had a `Content-Encoding` header that +contained an encoding but the "inflation" option was set to `false`. The +`status` property is set to `415`, the `type` property is set to +`'encoding.unsupported'`, and the `charset` property will be set to the +encoding that is unsupported. + +### entity parse failed + +This error will occur when the request contained an entity that could not be +parsed by the middleware. The `status` property is set to `400`, the `type` +property is set to `'entity.parse.failed'`, and the `body` property is set to +the entity value that failed parsing. + +### entity verify failed + +This error will occur when the request contained an entity that could not be +failed verification by the defined `verify` option. The `status` property is +set to `403`, the `type` property is set to `'entity.verify.failed'`, and the +`body` property is set to the entity value that failed verification. + +### request aborted + +This error will occur when the request is aborted by the client before reading +the body has finished. The `received` property will be set to the number of +bytes received before the request was aborted and the `expected` property is +set to the number of expected bytes. The `status` property is set to `400` +and `type` property is set to `'request.aborted'`. + +### request entity too large + +This error will occur when the request body's size is larger than the "limit" +option. The `limit` property will be set to the byte limit and the `length` +property will be set to the request body's length. The `status` property is +set to `413` and the `type` property is set to `'entity.too.large'`. + +### request size did not match content length + +This error will occur when the request's length did not match the length from +the `Content-Length` header. This typically occurs when the request is malformed, +typically when the `Content-Length` header was calculated based on characters +instead of bytes. The `status` property is set to `400` and the `type` property +is set to `'request.size.invalid'`. + +### stream encoding should not be set + +This error will occur when something called the `req.setEncoding` method prior +to this middleware. This module operates directly on bytes only and you cannot +call `req.setEncoding` when using this module. The `status` property is set to +`500` and the `type` property is set to `'stream.encoding.set'`. + +### too many parameters + +This error will occur when the content of the request exceeds the configured +`parameterLimit` for the `urlencoded` parser. The `status` property is set to +`413` and the `type` property is set to `'parameters.too.many'`. + +### unsupported charset "BOGUS" + +This error will occur when the request had a charset parameter in the +`Content-Type` header, but the `iconv-lite` module does not support it OR the +parser does not support it. The charset is contained in the message as well +as in the `charset` property. The `status` property is set to `415`, the +`type` property is set to `'charset.unsupported'`, and the `charset` property +is set to the charset that is unsupported. + +### unsupported content encoding "bogus" + +This error will occur when the request had a `Content-Encoding` header that +contained an unsupported encoding. The encoding is contained in the message +as well as in the `encoding` property. The `status` property is set to `415`, +the `type` property is set to `'encoding.unsupported'`, and the `encoding` +property is set to the encoding that is unsupported. + +## Examples + +### Express/Connect top-level generic + +This example demonstrates adding a generic JSON and URL-encoded parser as a +top-level middleware, which will parse the bodies of all incoming requests. +This is the simplest setup. + +```js +var express = require('express') +var bodyParser = require('body-parser') + +var app = express() + +// parse application/x-www-form-urlencoded +app.use(bodyParser.urlencoded({ extended: false })) + +// parse application/json +app.use(bodyParser.json()) + +app.use(function (req, res) { + res.setHeader('Content-Type', 'text/plain') + res.write('you posted:\n') + res.end(JSON.stringify(req.body, null, 2)) +}) +``` + +### Express route-specific + +This example demonstrates adding body parsers specifically to the routes that +need them. In general, this is the most recommended way to use body-parser with +Express. + +```js +var express = require('express') +var bodyParser = require('body-parser') + +var app = express() + +// create application/json parser +var jsonParser = bodyParser.json() + +// create application/x-www-form-urlencoded parser +var urlencodedParser = bodyParser.urlencoded({ extended: false }) + +// POST /login gets urlencoded bodies +app.post('/login', urlencodedParser, function (req, res) { + res.send('welcome, ' + req.body.username) +}) + +// POST /api/users gets JSON bodies +app.post('/api/users', jsonParser, function (req, res) { + // create user in req.body +}) +``` + +### Change accepted type for parsers + +All the parsers accept a `type` option which allows you to change the +`Content-Type` that the middleware will parse. + +```js +var express = require('express') +var bodyParser = require('body-parser') + +var app = express() + +// parse various different custom JSON types as JSON +app.use(bodyParser.json({ type: 'application/*+json' })) + +// parse some custom thing into a Buffer +app.use(bodyParser.raw({ type: 'application/vnd.custom-type' })) + +// parse an HTML body into a string +app.use(bodyParser.text({ type: 'text/html' })) +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/body-parser.svg +[npm-url]: https://npmjs.org/package/body-parser +[coveralls-image]: https://img.shields.io/coveralls/expressjs/body-parser/master.svg +[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master +[downloads-image]: https://img.shields.io/npm/dm/body-parser.svg +[downloads-url]: https://npmjs.org/package/body-parser +[github-actions-ci-image]: https://img.shields.io/github/workflow/status/expressjs/body-parser/ci/master?label=ci +[github-actions-ci-url]: https://github.com/expressjs/body-parser?query=workflow%3Aci diff --git a/server/node_modules/body-parser/index.js b/server/node_modules/body-parser/index.js new file mode 100644 index 0000000..9acc235 --- /dev/null +++ b/server/node_modules/body-parser/index.js @@ -0,0 +1,157 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var deprecate = require('depd')('body-parser') + +/** + * Cache of loaded parsers. + * @private + */ + +var parsers = Object.create(null) + +/** + * @typedef Parsers + * @type {function} + * @property {function} json + * @property {function} raw + * @property {function} text + * @property {function} urlencoded + */ + +/** + * Module exports. + * @type {Parsers} + */ + +exports = module.exports = deprecate.function(bodyParser, + 'bodyParser: use individual json/urlencoded middlewares') + +/** + * JSON parser. + * @public + */ + +Object.defineProperty(exports, 'json', { + configurable: true, + enumerable: true, + get: createParserGetter('json') +}) + +/** + * Raw parser. + * @public + */ + +Object.defineProperty(exports, 'raw', { + configurable: true, + enumerable: true, + get: createParserGetter('raw') +}) + +/** + * Text parser. + * @public + */ + +Object.defineProperty(exports, 'text', { + configurable: true, + enumerable: true, + get: createParserGetter('text') +}) + +/** + * URL-encoded parser. + * @public + */ + +Object.defineProperty(exports, 'urlencoded', { + configurable: true, + enumerable: true, + get: createParserGetter('urlencoded') +}) + +/** + * Create a middleware to parse json and urlencoded bodies. + * + * @param {object} [options] + * @return {function} + * @deprecated + * @public + */ + +function bodyParser (options) { + var opts = {} + + // exclude type option + if (options) { + for (var prop in options) { + if (prop !== 'type') { + opts[prop] = options[prop] + } + } + } + + var _urlencoded = exports.urlencoded(opts) + var _json = exports.json(opts) + + return function bodyParser (req, res, next) { + _json(req, res, function (err) { + if (err) return next(err) + _urlencoded(req, res, next) + }) + } +} + +/** + * Create a getter for loading a parser. + * @private + */ + +function createParserGetter (name) { + return function get () { + return loadParser(name) + } +} + +/** + * Load a parser module. + * @private + */ + +function loadParser (parserName) { + var parser = parsers[parserName] + + if (parser !== undefined) { + return parser + } + + // this uses a switch for static require analysis + switch (parserName) { + case 'json': + parser = require('body-parser/lib/types/json') + break + case 'raw': + parser = require('body-parser/lib/types/raw') + break + case 'text': + parser = require('body-parser/lib/types/text') + break + case 'urlencoded': + parser = require('body-parser/lib/types/urlencoded') + break + } + + // store to prevent invoking require() + return (parsers[parserName] = parser) +} diff --git a/server/node_modules/body-parser/lib/read.js b/server/node_modules/body-parser/lib/read.js new file mode 100644 index 0000000..c102609 --- /dev/null +++ b/server/node_modules/body-parser/lib/read.js @@ -0,0 +1,181 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var createError = require('http-errors') +var getBody = require('raw-body') +var iconv = require('iconv-lite') +var onFinished = require('on-finished') +var zlib = require('zlib') + +/** + * Module exports. + */ + +module.exports = read + +/** + * Read a request into a buffer and parse. + * + * @param {object} req + * @param {object} res + * @param {function} next + * @param {function} parse + * @param {function} debug + * @param {object} options + * @private + */ + +function read (req, res, next, parse, debug, options) { + var length + var opts = options + var stream + + // flag as parsed + req._body = true + + // read options + var encoding = opts.encoding !== null + ? opts.encoding + : null + var verify = opts.verify + + try { + // get the content stream + stream = contentstream(req, debug, opts.inflate) + length = stream.length + stream.length = undefined + } catch (err) { + return next(err) + } + + // set raw-body options + opts.length = length + opts.encoding = verify + ? null + : encoding + + // assert charset is supported + if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) { + return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', { + charset: encoding.toLowerCase(), + type: 'charset.unsupported' + })) + } + + // read body + debug('read body') + getBody(stream, opts, function (error, body) { + if (error) { + var _error + + if (error.type === 'encoding.unsupported') { + // echo back charset + _error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', { + charset: encoding.toLowerCase(), + type: 'charset.unsupported' + }) + } else { + // set status code on error + _error = createError(400, error) + } + + // read off entire request + stream.resume() + onFinished(req, function onfinished () { + next(createError(400, _error)) + }) + return + } + + // verify + if (verify) { + try { + debug('verify body') + verify(req, res, body, encoding) + } catch (err) { + next(createError(403, err, { + body: body, + type: err.type || 'entity.verify.failed' + })) + return + } + } + + // parse + var str = body + try { + debug('parse body') + str = typeof body !== 'string' && encoding !== null + ? iconv.decode(body, encoding) + : body + req.body = parse(str) + } catch (err) { + next(createError(400, err, { + body: str, + type: err.type || 'entity.parse.failed' + })) + return + } + + next() + }) +} + +/** + * Get the content stream of the request. + * + * @param {object} req + * @param {function} debug + * @param {boolean} [inflate=true] + * @return {object} + * @api private + */ + +function contentstream (req, debug, inflate) { + var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase() + var length = req.headers['content-length'] + var stream + + debug('content-encoding "%s"', encoding) + + if (inflate === false && encoding !== 'identity') { + throw createError(415, 'content encoding unsupported', { + encoding: encoding, + type: 'encoding.unsupported' + }) + } + + switch (encoding) { + case 'deflate': + stream = zlib.createInflate() + debug('inflate body') + req.pipe(stream) + break + case 'gzip': + stream = zlib.createGunzip() + debug('gunzip body') + req.pipe(stream) + break + case 'identity': + stream = req + stream.length = length + break + default: + throw createError(415, 'unsupported content encoding "' + encoding + '"', { + encoding: encoding, + type: 'encoding.unsupported' + }) + } + + return stream +} diff --git a/server/node_modules/body-parser/lib/types/json.js b/server/node_modules/body-parser/lib/types/json.js new file mode 100644 index 0000000..52f44b1 --- /dev/null +++ b/server/node_modules/body-parser/lib/types/json.js @@ -0,0 +1,230 @@ +/*! + * body-parser + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var bytes = require('bytes') +var contentType = require('content-type') +var createError = require('http-errors') +var debug = require('debug')('body-parser:json') +var read = require('body-parser/lib/read') +var typeis = require('type-is') + +/** + * Module exports. + */ + +module.exports = json + +/** + * RegExp to match the first non-space in a string. + * + * Allowed whitespace is defined in RFC 7159: + * + * ws = *( + * %x20 / ; Space + * %x09 / ; Horizontal tab + * %x0A / ; Line feed or New line + * %x0D ) ; Carriage return + */ + +var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*(.)/ // eslint-disable-line no-control-regex + +/** + * Create a middleware to parse JSON bodies. + * + * @param {object} [options] + * @return {function} + * @public + */ + +function json (options) { + var opts = options || {} + + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var inflate = opts.inflate !== false + var reviver = opts.reviver + var strict = opts.strict !== false + var type = opts.type || 'application/json' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (body) { + if (body.length === 0) { + // special-case empty json body, as it's a common client-side mistake + // TODO: maybe make this configurable or part of "strict" option + return {} + } + + if (strict) { + var first = firstchar(body) + + if (first !== '{' && first !== '[') { + debug('strict violation') + throw createStrictSyntaxError(body, first) + } + } + + try { + debug('parse json') + return JSON.parse(body, reviver) + } catch (e) { + throw normalizeJsonSyntaxError(e, { + message: e.message, + stack: e.stack + }) + } + } + + return function jsonParser (req, res, next) { + if (req._body) { + debug('body already parsed') + next() + return + } + + req.body = req.body || {} + + // skip requests without bodies + if (!typeis.hasBody(req)) { + debug('skip empty body') + next() + return + } + + debug('content-type %j', req.headers['content-type']) + + // determine if request should be parsed + if (!shouldParse(req)) { + debug('skip parsing') + next() + return + } + + // assert charset per RFC 7159 sec 8.1 + var charset = getCharset(req) || 'utf-8' + if (charset.substr(0, 4) !== 'utf-') { + debug('invalid charset') + next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', { + charset: charset, + type: 'charset.unsupported' + })) + return + } + + // read + read(req, res, next, parse, debug, { + encoding: charset, + inflate: inflate, + limit: limit, + verify: verify + }) + } +} + +/** + * Create strict violation syntax error matching native error. + * + * @param {string} str + * @param {string} char + * @return {Error} + * @private + */ + +function createStrictSyntaxError (str, char) { + var index = str.indexOf(char) + var partial = str.substring(0, index) + '#' + + try { + JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation') + } catch (e) { + return normalizeJsonSyntaxError(e, { + message: e.message.replace('#', char), + stack: e.stack + }) + } +} + +/** + * Get the first non-whitespace character in a string. + * + * @param {string} str + * @return {function} + * @private + */ + +function firstchar (str) { + return FIRST_CHAR_REGEXP.exec(str)[1] +} + +/** + * Get the charset of a request. + * + * @param {object} req + * @api private + */ + +function getCharset (req) { + try { + return (contentType.parse(req).parameters.charset || '').toLowerCase() + } catch (e) { + return undefined + } +} + +/** + * Normalize a SyntaxError for JSON.parse. + * + * @param {SyntaxError} error + * @param {object} obj + * @return {SyntaxError} + */ + +function normalizeJsonSyntaxError (error, obj) { + var keys = Object.getOwnPropertyNames(error) + + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + if (key !== 'stack' && key !== 'message') { + delete error[key] + } + } + + // replace stack before message for Node.js 0.10 and below + error.stack = obj.stack.replace(error.message, obj.message) + error.message = obj.message + + return error +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/server/node_modules/body-parser/lib/types/raw.js b/server/node_modules/body-parser/lib/types/raw.js new file mode 100644 index 0000000..7b3a366 --- /dev/null +++ b/server/node_modules/body-parser/lib/types/raw.js @@ -0,0 +1,101 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + */ + +var bytes = require('bytes') +var debug = require('debug')('body-parser:raw') +var read = require('body-parser/lib/read') +var typeis = require('type-is') + +/** + * Module exports. + */ + +module.exports = raw + +/** + * Create a middleware to parse raw bodies. + * + * @param {object} [options] + * @return {function} + * @api public + */ + +function raw (options) { + var opts = options || {} + + var inflate = opts.inflate !== false + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var type = opts.type || 'application/octet-stream' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (buf) { + return buf + } + + return function rawParser (req, res, next) { + if (req._body) { + debug('body already parsed') + next() + return + } + + req.body = req.body || {} + + // skip requests without bodies + if (!typeis.hasBody(req)) { + debug('skip empty body') + next() + return + } + + debug('content-type %j', req.headers['content-type']) + + // determine if request should be parsed + if (!shouldParse(req)) { + debug('skip parsing') + next() + return + } + + // read + read(req, res, next, parse, debug, { + encoding: null, + inflate: inflate, + limit: limit, + verify: verify + }) + } +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/server/node_modules/body-parser/lib/types/text.js b/server/node_modules/body-parser/lib/types/text.js new file mode 100644 index 0000000..6fe6a78 --- /dev/null +++ b/server/node_modules/body-parser/lib/types/text.js @@ -0,0 +1,121 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + */ + +var bytes = require('bytes') +var contentType = require('content-type') +var debug = require('debug')('body-parser:text') +var read = require('body-parser/lib/read') +var typeis = require('type-is') + +/** + * Module exports. + */ + +module.exports = text + +/** + * Create a middleware to parse text bodies. + * + * @param {object} [options] + * @return {function} + * @api public + */ + +function text (options) { + var opts = options || {} + + var defaultCharset = opts.defaultCharset || 'utf-8' + var inflate = opts.inflate !== false + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var type = opts.type || 'text/plain' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (buf) { + return buf + } + + return function textParser (req, res, next) { + if (req._body) { + debug('body already parsed') + next() + return + } + + req.body = req.body || {} + + // skip requests without bodies + if (!typeis.hasBody(req)) { + debug('skip empty body') + next() + return + } + + debug('content-type %j', req.headers['content-type']) + + // determine if request should be parsed + if (!shouldParse(req)) { + debug('skip parsing') + next() + return + } + + // get charset + var charset = getCharset(req) || defaultCharset + + // read + read(req, res, next, parse, debug, { + encoding: charset, + inflate: inflate, + limit: limit, + verify: verify + }) + } +} + +/** + * Get the charset of a request. + * + * @param {object} req + * @api private + */ + +function getCharset (req) { + try { + return (contentType.parse(req).parameters.charset || '').toLowerCase() + } catch (e) { + return undefined + } +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/server/node_modules/body-parser/lib/types/urlencoded.js b/server/node_modules/body-parser/lib/types/urlencoded.js new file mode 100644 index 0000000..6c0fc14 --- /dev/null +++ b/server/node_modules/body-parser/lib/types/urlencoded.js @@ -0,0 +1,284 @@ +/*! + * body-parser + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var bytes = require('bytes') +var contentType = require('content-type') +var createError = require('http-errors') +var debug = require('debug')('body-parser:urlencoded') +var deprecate = require('depd')('body-parser') +var read = require('body-parser/lib/read') +var typeis = require('type-is') + +/** + * Module exports. + */ + +module.exports = urlencoded + +/** + * Cache of parser modules. + */ + +var parsers = Object.create(null) + +/** + * Create a middleware to parse urlencoded bodies. + * + * @param {object} [options] + * @return {function} + * @public + */ + +function urlencoded (options) { + var opts = options || {} + + // notice because option default will flip in next major + if (opts.extended === undefined) { + deprecate('undefined extended: provide extended option') + } + + var extended = opts.extended !== false + var inflate = opts.inflate !== false + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var type = opts.type || 'application/x-www-form-urlencoded' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate query parser + var queryparse = extended + ? extendedparser(opts) + : simpleparser(opts) + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (body) { + return body.length + ? queryparse(body) + : {} + } + + return function urlencodedParser (req, res, next) { + if (req._body) { + debug('body already parsed') + next() + return + } + + req.body = req.body || {} + + // skip requests without bodies + if (!typeis.hasBody(req)) { + debug('skip empty body') + next() + return + } + + debug('content-type %j', req.headers['content-type']) + + // determine if request should be parsed + if (!shouldParse(req)) { + debug('skip parsing') + next() + return + } + + // assert charset + var charset = getCharset(req) || 'utf-8' + if (charset !== 'utf-8') { + debug('invalid charset') + next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', { + charset: charset, + type: 'charset.unsupported' + })) + return + } + + // read + read(req, res, next, parse, debug, { + debug: debug, + encoding: charset, + inflate: inflate, + limit: limit, + verify: verify + }) + } +} + +/** + * Get the extended query parser. + * + * @param {object} options + */ + +function extendedparser (options) { + var parameterLimit = options.parameterLimit !== undefined + ? options.parameterLimit + : 1000 + var parse = parser('qs') + + if (isNaN(parameterLimit) || parameterLimit < 1) { + throw new TypeError('option parameterLimit must be a positive number') + } + + if (isFinite(parameterLimit)) { + parameterLimit = parameterLimit | 0 + } + + return function queryparse (body) { + var paramCount = parameterCount(body, parameterLimit) + + if (paramCount === undefined) { + debug('too many parameters') + throw createError(413, 'too many parameters', { + type: 'parameters.too.many' + }) + } + + var arrayLimit = Math.max(100, paramCount) + + debug('parse extended urlencoding') + return parse(body, { + allowPrototypes: true, + arrayLimit: arrayLimit, + depth: Infinity, + parameterLimit: parameterLimit + }) + } +} + +/** + * Get the charset of a request. + * + * @param {object} req + * @api private + */ + +function getCharset (req) { + try { + return (contentType.parse(req).parameters.charset || '').toLowerCase() + } catch (e) { + return undefined + } +} + +/** + * Count the number of parameters, stopping once limit reached + * + * @param {string} body + * @param {number} limit + * @api private + */ + +function parameterCount (body, limit) { + var count = 0 + var index = 0 + + while ((index = body.indexOf('&', index)) !== -1) { + count++ + index++ + + if (count === limit) { + return undefined + } + } + + return count +} + +/** + * Get parser for module name dynamically. + * + * @param {string} name + * @return {function} + * @api private + */ + +function parser (name) { + var mod = parsers[name] + + if (mod !== undefined) { + return mod.parse + } + + // this uses a switch for static require analysis + switch (name) { + case 'qs': + mod = require('qs') + break + case 'querystring': + mod = require('querystring') + break + } + + // store to prevent invoking require() + parsers[name] = mod + + return mod.parse +} + +/** + * Get the simple query parser. + * + * @param {object} options + */ + +function simpleparser (options) { + var parameterLimit = options.parameterLimit !== undefined + ? options.parameterLimit + : 1000 + var parse = parser('querystring') + + if (isNaN(parameterLimit) || parameterLimit < 1) { + throw new TypeError('option parameterLimit must be a positive number') + } + + if (isFinite(parameterLimit)) { + parameterLimit = parameterLimit | 0 + } + + return function queryparse (body) { + var paramCount = parameterCount(body, parameterLimit) + + if (paramCount === undefined) { + debug('too many parameters') + throw createError(413, 'too many parameters', { + type: 'parameters.too.many' + }) + } + + debug('parse urlencoding') + return parse(body, undefined, undefined, { maxKeys: parameterLimit }) + } +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/server/node_modules/body-parser/package.json b/server/node_modules/body-parser/package.json new file mode 100644 index 0000000..f78fe05 --- /dev/null +++ b/server/node_modules/body-parser/package.json @@ -0,0 +1,91 @@ +{ + "_from": "body-parser@1.19.1", + "_id": "body-parser@1.19.1", + "_inBundle": false, + "_integrity": "sha512-8ljfQi5eBk8EJfECMrgqNGWPEY5jWP+1IzkzkGdFFEwFQZZyaZ21UqdaHktgiMlH0xLHqIFtE/u2OYE5dOtViA==", + "_location": "/body-parser", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "body-parser@1.19.1", + "name": "body-parser", + "escapedName": "body-parser", + "rawSpec": "1.19.1", + "saveSpec": null, + "fetchSpec": "1.19.1" + }, + "_requiredBy": [ + "/express" + ], + "_resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.1.tgz", + "_shasum": "1499abbaa9274af3ecc9f6f10396c995943e31d4", + "_spec": "body-parser@1.19.1", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/express", + "bugs": { + "url": "https://github.com/expressjs/body-parser/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com" + } + ], + "dependencies": { + "bytes": "3.1.1", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "1.8.1", + "iconv-lite": "0.4.24", + "on-finished": "~2.3.0", + "qs": "6.9.6", + "raw-body": "2.4.2", + "type-is": "~1.6.18" + }, + "deprecated": false, + "description": "Node.js body parsing middleware", + "devDependencies": { + "eslint": "7.32.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.25.3", + "eslint-plugin-markdown": "2.2.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "5.2.0", + "eslint-plugin-standard": "4.1.0", + "methods": "1.1.2", + "mocha": "9.1.3", + "nyc": "15.1.0", + "safe-buffer": "5.2.1", + "supertest": "6.1.6" + }, + "engines": { + "node": ">= 0.8" + }, + "files": [ + "lib/", + "LICENSE", + "HISTORY.md", + "index.js" + ], + "homepage": "https://github.com/expressjs/body-parser#readme", + "license": "MIT", + "name": "body-parser", + "repository": { + "type": "git", + "url": "git+https://github.com/expressjs/body-parser.git" + }, + "scripts": { + "lint": "eslint ", + "test": "mocha --require test/support/env --reporter spec --check-leaks --bail test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + }, + "version": "1.19.1" +} diff --git a/server/node_modules/boxen/index.d.ts b/server/node_modules/boxen/index.d.ts new file mode 100644 index 0000000..69ebd42 --- /dev/null +++ b/server/node_modules/boxen/index.d.ts @@ -0,0 +1,200 @@ +import {LiteralUnion} from 'type-fest'; +import {BoxStyle, Boxes} from 'cli-boxes'; + +declare namespace boxen { + /** + Characters used for custom border. + + @example + ``` + // affffb + // e e + // dffffc + + const border: CustomBorderStyle = { + topLeft: 'a', + topRight: 'b', + bottomRight: 'c', + bottomLeft: 'd', + vertical: 'e', + horizontal: 'f' + }; + ``` + */ + interface CustomBorderStyle extends BoxStyle {} + + /** + Spacing used for `padding` and `margin`. + */ + interface Spacing { + readonly top: number; + readonly right: number; + readonly bottom: number; + readonly left: number; + } + + interface Options { + /** + Color of the box border. + */ + readonly borderColor?: LiteralUnion< + | 'black' + | 'red' + | 'green' + | 'yellow' + | 'blue' + | 'magenta' + | 'cyan' + | 'white' + | 'gray' + | 'grey' + | 'blackBright' + | 'redBright' + | 'greenBright' + | 'yellowBright' + | 'blueBright' + | 'magentaBright' + | 'cyanBright' + | 'whiteBright', + string + >; + + /** + Style of the box border. + + @default 'single' + */ + readonly borderStyle?: keyof Boxes | CustomBorderStyle; + + /** + Reduce opacity of the border. + + @default false + */ + readonly dimBorder?: boolean; + + /** + Space between the text and box border. + + @default 0 + */ + readonly padding?: number | Spacing; + + /** + Space around the box. + + @default 0 + */ + readonly margin?: number | Spacing; + + /** + Float the box on the available terminal screen space. + + @default 'left' + */ + readonly float?: 'left' | 'right' | 'center'; + + /** + Color of the background. + */ + readonly backgroundColor?: LiteralUnion< + | 'black' + | 'red' + | 'green' + | 'yellow' + | 'blue' + | 'magenta' + | 'cyan' + | 'white' + | 'blackBright' + | 'redBright' + | 'greenBright' + | 'yellowBright' + | 'blueBright' + | 'magentaBright' + | 'cyanBright' + | 'whiteBright', + string + >; + + /** + Align the text in the box based on the widest line. + + @default 'left' + @deprecated Use `textAlignment` instead. + */ + readonly align?: 'left' | 'right' | 'center'; + + /** + Align the text in the box based on the widest line. + + @default 'left' + */ + readonly textAlignment?: 'left' | 'right' | 'center'; + + /** + Display a title at the top of the box. + If needed, the box will horizontally expand to fit the title. + + @example + ``` + console.log(boxen('foo bar', {title: 'example'})); + // ┌ example ┐ + // │foo bar │ + // └─────────┘ + ``` + */ + readonly title?: string; + + /** + Align the title in the top bar. + + @default 'left' + + @example + ``` + console.log(boxen('foo bar foo bar', {title: 'example', titleAlignment: 'center'})); + // ┌─── example ───┐ + // │foo bar foo bar│ + // └───────────────┘ + + console.log(boxen('foo bar foo bar', {title: 'example', titleAlignment: 'right'})); + // ┌────── example ┐ + // │foo bar foo bar│ + // └───────────────┘ + ``` + */ + readonly titleAlignment?: 'left' | 'right' | 'center'; + } +} + +/** +Creates a box in the terminal. + +@param text - The text inside the box. +@returns The box. + +@example +``` +import boxen = require('boxen'); + +console.log(boxen('unicorn', {padding: 1})); +// ┌─────────────┐ +// │ │ +// │ unicorn │ +// │ │ +// └─────────────┘ + +console.log(boxen('unicorn', {padding: 1, margin: 1, borderStyle: 'double'})); +// +// ╔═════════════╗ +// ║ ║ +// ║ unicorn ║ +// ║ ║ +// ╚═════════════╝ +// +``` +*/ +declare const boxen: (text: string, options?: boxen.Options) => string; + +export = boxen; diff --git a/server/node_modules/boxen/index.js b/server/node_modules/boxen/index.js new file mode 100644 index 0000000..d6bc693 --- /dev/null +++ b/server/node_modules/boxen/index.js @@ -0,0 +1,279 @@ +'use strict'; +const stringWidth = require('string-width'); +const chalk = require('chalk'); +const widestLine = require('widest-line'); +const cliBoxes = require('cli-boxes'); +const camelCase = require('camelcase'); +const ansiAlign = require('ansi-align'); +const wrapAnsi = require('wrap-ansi'); + +const NL = '\n'; +const PAD = ' '; + +const terminalColumns = () => { + const {env, stdout, stderr} = process; + + if (stdout && stdout.columns) { + return stdout.columns; + } + + if (stderr && stderr.columns) { + return stderr.columns; + } + + if (env.COLUMNS) { + return Number.parseInt(env.COLUMNS, 10); + } + + return 80; +}; + +const getObject = detail => { + return typeof detail === 'number' ? { + top: detail, + right: detail * 3, + bottom: detail, + left: detail * 3 + } : { + top: 0, + right: 0, + bottom: 0, + left: 0, + ...detail + }; +}; + +const getBorderChars = borderStyle => { + const sides = [ + 'topLeft', + 'topRight', + 'bottomRight', + 'bottomLeft', + 'vertical', + 'horizontal' + ]; + + let chararacters; + + if (typeof borderStyle === 'string') { + chararacters = cliBoxes[borderStyle]; + + if (!chararacters) { + throw new TypeError(`Invalid border style: ${borderStyle}`); + } + } else { + for (const side of sides) { + if (!borderStyle[side] || typeof borderStyle[side] !== 'string') { + throw new TypeError(`Invalid border style: ${side}`); + } + } + + chararacters = borderStyle; + } + + return chararacters; +}; + +const makeTitle = (text, horizontal, alignement) => { + let title = ''; + + const textWidth = stringWidth(text); + + switch (alignement) { + case 'left': + title = text + horizontal.slice(textWidth); + break; + case 'right': + title = horizontal.slice(textWidth) + text; + break; + default: + horizontal = horizontal.slice(textWidth); + + if (horizontal.length % 2 === 1) { // This is needed in case the length is odd + horizontal = horizontal.slice(Math.floor(horizontal.length / 2)); + title = horizontal.slice(1) + text + horizontal; // We reduce the left part of one character to avoid the bar to go beyond its limit + } else { + horizontal = horizontal.slice(horizontal.length / 2); + title = horizontal + text + horizontal; + } + + break; + } + + return title; +}; + +const makeContentText = (text, padding, columns, align) => { + text = ansiAlign(text, {align}); + let lines = text.split(NL); + const textWidth = widestLine(text); + + const max = columns - padding.left - padding.right; + + if (textWidth > max) { + const newLines = []; + for (const line of lines) { + const createdLines = wrapAnsi(line, max, {hard: true}); + const alignedLines = ansiAlign(createdLines, {align}); + const alignedLinesArray = alignedLines.split('\n'); + const longestLength = Math.max(...alignedLinesArray.map(s => stringWidth(s))); + + for (const alignedLine of alignedLinesArray) { + let paddedLine; + switch (align) { + case 'center': + paddedLine = PAD.repeat((max - longestLength) / 2) + alignedLine; + break; + case 'right': + paddedLine = PAD.repeat(max - longestLength) + alignedLine; + break; + default: + paddedLine = alignedLine; + break; + } + + newLines.push(paddedLine); + } + } + + lines = newLines; + } + + if (align === 'center' && textWidth < max) { + lines = lines.map(line => PAD.repeat((max - textWidth) / 2) + line); + } else if (align === 'right' && textWidth < max) { + lines = lines.map(line => PAD.repeat(max - textWidth) + line); + } + + const paddingLeft = PAD.repeat(padding.left); + const paddingRight = PAD.repeat(padding.right); + + lines = lines.map(line => paddingLeft + line + paddingRight); + + lines = lines.map(line => { + if (columns - stringWidth(line) > 0) { + switch (align) { + case 'center': + return line + PAD.repeat(columns - stringWidth(line)); + case 'right': + return line + PAD.repeat(columns - stringWidth(line)); + default: + return line + PAD.repeat(columns - stringWidth(line)); + } + } + + return line; + }); + + if (padding.top > 0) { + lines = new Array(padding.top).fill(PAD.repeat(columns)).concat(lines); + } + + if (padding.bottom > 0) { + lines = lines.concat(new Array(padding.bottom).fill(PAD.repeat(columns))); + } + + return lines.join(NL); +}; + +const isHex = color => color.match(/^#(?:[0-f]{3}){1,2}$/i); +const isColorValid = color => typeof color === 'string' && ((chalk[color]) || isHex(color)); +const getColorFn = color => isHex(color) ? chalk.hex(color) : chalk[color]; +const getBGColorFn = color => isHex(color) ? chalk.bgHex(color) : chalk[camelCase(['bg', color])]; + +module.exports = (text, options) => { + options = { + padding: 0, + borderStyle: 'single', + dimBorder: false, + textAlignment: 'left', + float: 'left', + titleAlignment: 'left', + ...options + }; + + // This option is deprecated + if (options.align) { + options.textAlignment = options.align; + } + + const BORDERS_WIDTH = 2; + + if (options.borderColor && !isColorValid(options.borderColor)) { + throw new Error(`${options.borderColor} is not a valid borderColor`); + } + + if (options.backgroundColor && !isColorValid(options.backgroundColor)) { + throw new Error(`${options.backgroundColor} is not a valid backgroundColor`); + } + + const chars = getBorderChars(options.borderStyle); + const padding = getObject(options.padding); + const margin = getObject(options.margin); + + const colorizeBorder = border => { + const newBorder = options.borderColor ? getColorFn(options.borderColor)(border) : border; + return options.dimBorder ? chalk.dim(newBorder) : newBorder; + }; + + const colorizeContent = content => options.backgroundColor ? getBGColorFn(options.backgroundColor)(content) : content; + + const columns = terminalColumns(); + + let contentWidth = widestLine(wrapAnsi(text, columns - BORDERS_WIDTH, {hard: true, trim: false})) + padding.left + padding.right; + + // This prevents the title bar to exceed the console's width + let title = options.title && options.title.slice(0, columns - 4 - margin.left - margin.right); + + if (title) { + title = ` ${title} `; + // Make the box larger to fit a larger title + if (stringWidth(title) > contentWidth) { + contentWidth = stringWidth(title); + } + } + + if ((margin.left && margin.right) && contentWidth + BORDERS_WIDTH + margin.left + margin.right > columns) { + // Let's assume we have margins: left = 3, right = 5, in total = 8 + const spaceForMargins = columns - contentWidth - BORDERS_WIDTH; + // Let's assume we have space = 4 + const multiplier = spaceForMargins / (margin.left + margin.right); + // Here: multiplier = 4/8 = 0.5 + margin.left = Math.max(0, Math.floor(margin.left * multiplier)); + margin.right = Math.max(0, Math.floor(margin.right * multiplier)); + // Left: 3 * 0.5 = 1.5 -> 1 + // Right: 6 * 0.5 = 3 + } + + // Prevent content from exceeding the console's width + contentWidth = Math.min(contentWidth, columns - BORDERS_WIDTH - margin.left - margin.right); + + text = makeContentText(text, padding, contentWidth, options.textAlignment); + + let marginLeft = PAD.repeat(margin.left); + + if (options.float === 'center') { + const marginWidth = Math.max((columns - contentWidth - BORDERS_WIDTH) / 2, 0); + marginLeft = PAD.repeat(marginWidth); + } else if (options.float === 'right') { + const marginWidth = Math.max(columns - contentWidth - margin.right - BORDERS_WIDTH, 0); + marginLeft = PAD.repeat(marginWidth); + } + + const horizontal = chars.horizontal.repeat(contentWidth); + const top = colorizeBorder(NL.repeat(margin.top) + marginLeft + chars.topLeft + (title ? makeTitle(title, horizontal, options.titleAlignment) : horizontal) + chars.topRight); + const bottom = colorizeBorder(marginLeft + chars.bottomLeft + horizontal + chars.bottomRight + NL.repeat(margin.bottom)); + const side = colorizeBorder(chars.vertical); + + const LINE_SEPARATOR = (contentWidth + BORDERS_WIDTH + margin.left >= columns) ? '' : NL; + + const lines = text.split(NL); + + const middle = lines.map(line => { + return marginLeft + side + colorizeContent(line) + side; + }).join(LINE_SEPARATOR); + + return top + LINE_SEPARATOR + middle + LINE_SEPARATOR + bottom; +}; + +module.exports._borderStyles = cliBoxes; diff --git a/server/node_modules/boxen/license b/server/node_modules/boxen/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/server/node_modules/boxen/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/boxen/package.json b/server/node_modules/boxen/package.json new file mode 100644 index 0000000..77f248c --- /dev/null +++ b/server/node_modules/boxen/package.json @@ -0,0 +1,83 @@ +{ + "_from": "boxen@^5.0.0", + "_id": "boxen@5.1.2", + "_inBundle": false, + "_integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "_location": "/boxen", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "boxen@^5.0.0", + "name": "boxen", + "escapedName": "boxen", + "rawSpec": "^5.0.0", + "saveSpec": null, + "fetchSpec": "^5.0.0" + }, + "_requiredBy": [ + "/update-notifier" + ], + "_resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "_shasum": "788cb686fc83c1f486dfa8a40c68fc2b831d2b50", + "_spec": "boxen@^5.0.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/update-notifier", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/boxen/issues" + }, + "bundleDependencies": false, + "dependencies": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + }, + "deprecated": false, + "description": "Create boxes in the terminal", + "devDependencies": { + "ava": "^2.4.0", + "nyc": "^15.1.0", + "tsd": "^0.14.0", + "xo": "^0.36.1" + }, + "engines": { + "node": ">=10" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "funding": "https://github.com/sponsors/sindresorhus", + "homepage": "https://github.com/sindresorhus/boxen#readme", + "keywords": [ + "cli", + "box", + "boxes", + "terminal", + "term", + "console", + "ascii", + "unicode", + "border", + "text" + ], + "license": "MIT", + "name": "boxen", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/boxen.git" + }, + "scripts": { + "test": "xo && nyc ava && tsd" + }, + "version": "5.1.2" +} diff --git a/server/node_modules/boxen/readme.md b/server/node_modules/boxen/readme.md new file mode 100644 index 0000000..c7ed496 --- /dev/null +++ b/server/node_modules/boxen/readme.md @@ -0,0 +1,244 @@ +# boxen + +> Create boxes in the terminal + +![](screenshot.png) + +## Install + +``` +$ npm install boxen +``` + +## Usage + +```js +const boxen = require('boxen'); + +console.log(boxen('unicorn', {padding: 1})); +/* +┌─────────────┐ +│ │ +│ unicorn │ +│ │ +└─────────────┘ +*/ + +console.log(boxen('unicorn', {padding: 1, margin: 1, borderStyle: 'double'})); +/* + + ╔═════════════╗ + ║ ║ + ║ unicorn ║ + ║ ║ + ╚═════════════╝ + +*/ + +console.log(boxen('unicorns love rainbows', {title: 'magical', titleAlignment: 'center'})); +/* +┌────── magical ───────┐ +│unicorns love rainbows│ +└──────────────────────┘ +*/ +``` + +## API + +### boxen(text, options?) + +#### text + +Type: `string` + +Text inside the box. + +#### options + +Type: `object` + +##### borderColor + +Type: `string`\ +Values: `'black'` `'red'` `'green'` `'yellow'` `'blue'` `'magenta'` `'cyan'` `'white'` `'gray'` or a hex value like `'#ff0000'` + +Color of the box border. + +##### borderStyle + +Type: `string | object`\ +Default: `'single'`\ +Values: +- `'single'` +``` +┌───┐ +│foo│ +└───┘ +``` +- `'double'` +``` +╔═══╗ +║foo║ +╚═══╝ +``` +- `'round'` (`'single'` sides with round corners) +``` +╭───╮ +│foo│ +╰───╯ +``` +- `'bold'` +``` +┏━━━┓ +┃foo┃ +┗━━━┛ +``` +- `'singleDouble'` (`'single'` on top and bottom, `'double'` on right and left) +``` +╓───╖ +║foo║ +╙───╜ +``` +- `'doubleSingle'` (`'double'` on top and bottom, `'single'` on right and left) +``` +╒═══╕ +│foo│ +╘═══╛ +``` +- `'classic'` +``` ++---+ +|foo| ++---+ +``` + +Style of the box border. + +Can be any of the above predefined styles or an object with the following keys: + +```js +{ + topLeft: '+', + topRight: '+', + bottomLeft: '+', + bottomRight: '+', + horizontal: '-', + vertical: '|' +} +``` + +##### dimBorder + +Type: `boolean`\ +Default: `false` + +Reduce opacity of the border. + +##### title + +Type: `string` + +Display a title at the top of the box. +If needed, the box will horizontally expand to fit the title. + +Example: +```js +console.log(boxen('foo bar', {title: 'example'})); +/* +┌ example ┐ +│foo bar │ +└─────────┘ +*/ +``` + +##### titleAlignment + +Type: `string`\ +Default: `'left'` + +Align the title in the top bar. + +Values: +- `'left'` +```js +/* +┌ example ──────┐ +│foo bar foo bar│ +└───────────────┘ +*/ +``` +- `'center'` +```js +/* +┌─── example ───┐ +│foo bar foo bar│ +└───────────────┘ +*/ +``` +- `'right'` +```js +/* +┌────── example ┐ +│foo bar foo bar│ +└───────────────┘ +*/ +``` + +##### padding + +Type: `number | object`\ +Default: `0` + +Space between the text and box border. + +Accepts a number or an object with any of the `top`, `right`, `bottom`, `left` properties. When a number is specified, the left/right padding is 3 times the top/bottom to make it look nice. + +##### margin + +Type: `number | object`\ +Default: `0` + +Space around the box. + +Accepts a number or an object with any of the `top`, `right`, `bottom`, `left` properties. When a number is specified, the left/right margin is 3 times the top/bottom to make it look nice. + +##### float + +Type: `string`\ +Default: `'left'`\ +Values: `'right'` `'center'` `'left'` + +Float the box on the available terminal screen space. + +##### backgroundColor + +Type: `string`\ +Values: `'black'` `'red'` `'green'` `'yellow'` `'blue'` `'magenta'` `'cyan'` `'white'` `'gray'` or a hex value like `'#ff0000'` + +Color of the background. + +##### textAlignment + +Type: `string`\ +Default: `'left'`\ +Values: `'left'` `'center'` `'right'` + +Align the text in the box based on the widest line. + +## Related + +- [boxen-cli](https://github.com/sindresorhus/boxen-cli) - CLI for this module +- [cli-boxes](https://github.com/sindresorhus/cli-boxes) - Boxes for use in the terminal +- [ink-box](https://github.com/sindresorhus/ink-box) - Box component for Ink that uses this package + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/server/node_modules/brace-expansion/LICENSE b/server/node_modules/brace-expansion/LICENSE new file mode 100644 index 0000000..de32266 --- /dev/null +++ b/server/node_modules/brace-expansion/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 Julian Gruber + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/server/node_modules/brace-expansion/README.md b/server/node_modules/brace-expansion/README.md new file mode 100644 index 0000000..6b4e0e1 --- /dev/null +++ b/server/node_modules/brace-expansion/README.md @@ -0,0 +1,129 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) +[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/server/node_modules/brace-expansion/index.js b/server/node_modules/brace-expansion/index.js new file mode 100644 index 0000000..0478be8 --- /dev/null +++ b/server/node_modules/brace-expansion/index.js @@ -0,0 +1,201 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + diff --git a/server/node_modules/brace-expansion/package.json b/server/node_modules/brace-expansion/package.json new file mode 100644 index 0000000..9155a27 --- /dev/null +++ b/server/node_modules/brace-expansion/package.json @@ -0,0 +1,75 @@ +{ + "_from": "brace-expansion@^1.1.7", + "_id": "brace-expansion@1.1.11", + "_inBundle": false, + "_integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "_location": "/brace-expansion", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "brace-expansion@^1.1.7", + "name": "brace-expansion", + "escapedName": "brace-expansion", + "rawSpec": "^1.1.7", + "saveSpec": null, + "fetchSpec": "^1.1.7" + }, + "_requiredBy": [ + "/minimatch" + ], + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "_shasum": "3c7fcbf529d87226f3d2f52b966ff5271eb441dd", + "_spec": "brace-expansion@^1.1.7", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/minimatch", + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "bugs": { + "url": "https://github.com/juliangruber/brace-expansion/issues" + }, + "bundleDependencies": false, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "deprecated": false, + "description": "Brace expansion as known from sh/bash", + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "keywords": [], + "license": "MIT", + "main": "index.js", + "name": "brace-expansion", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "scripts": { + "bench": "matcha test/perf/bench.js", + "gentest": "bash test/generate.sh", + "test": "tape test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "version": "1.1.11" +} diff --git a/server/node_modules/braces/CHANGELOG.md b/server/node_modules/braces/CHANGELOG.md new file mode 100644 index 0000000..36f798b --- /dev/null +++ b/server/node_modules/braces/CHANGELOG.md @@ -0,0 +1,184 @@ +# Release history + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +
+ Guiding Principles + +- Changelogs are for humans, not machines. +- There should be an entry for every single version. +- The same types of changes should be grouped. +- Versions and sections should be linkable. +- The latest version comes first. +- The release date of each versions is displayed. +- Mention whether you follow Semantic Versioning. + +
+ +
+ Types of changes + +Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_): + +- `Added` for new features. +- `Changed` for changes in existing functionality. +- `Deprecated` for soon-to-be removed features. +- `Removed` for now removed features. +- `Fixed` for any bug fixes. +- `Security` in case of vulnerabilities. + +
+ +## [3.0.0] - 2018-04-08 + +v3.0 is a complete refactor, resulting in a faster, smaller codebase, with fewer deps, and a more accurate parser and compiler. + +**Breaking Changes** + +- The undocumented `.makeRe` method was removed + +**Non-breaking changes** + +- Caching was removed + +## [2.3.2] - 2018-04-08 + +- start refactoring +- cover sets +- better range handling + +## [2.3.1] - 2018-02-17 + +- Remove unnecessary escape in Regex. (#14) + +## [2.3.0] - 2017-10-19 + +- minor code reorganization +- optimize regex +- expose `maxLength` option + +## [2.2.1] - 2017-05-30 + +- don't condense when braces contain extglobs + +## [2.2.0] - 2017-05-28 + +- ensure word boundaries are preserved +- fixes edge case where extglob characters precede a brace pattern + +## [2.1.1] - 2017-04-27 + +- use snapdragon-node +- handle edge case +- optimizations, lint + +## [2.0.4] - 2017-04-11 + +- pass opts to compiler +- minor optimization in create method +- re-write parser handlers to remove negation regex + +## [2.0.3] - 2016-12-10 + +- use split-string +- clear queue at the end +- adds sequences example +- add unit tests + +## [2.0.2] - 2016-10-21 + +- fix comma handling in nested extglobs + +## [2.0.1] - 2016-10-20 + +- add comments +- more tests, ensure quotes are stripped + +## [2.0.0] - 2016-10-19 + +- don't expand braces inside character classes +- add quantifier pattern + +## [1.8.5] - 2016-05-21 + +- Refactor (#10) + +## [1.8.4] - 2016-04-20 + +- fixes https://github.com/jonschlinkert/micromatch/issues/66 + +## [1.8.0] - 2015-03-18 + +- adds exponent examples, tests +- fixes the first example in https://github.com/jonschlinkert/micromatch/issues/38 + +## [1.6.0] - 2015-01-30 + +- optimizations, `bash` mode: +- improve path escaping + +## [1.5.0] - 2015-01-28 + +- Merge pull request #5 from eush77/lib-files + +## [1.4.0] - 2015-01-24 + +- add extglob tests +- externalize exponent function +- better whitespace handling + +## [1.3.0] - 2015-01-24 + +- make regex patterns explicity + +## [1.1.0] - 2015-01-11 + +- don't create a match group with `makeRe` + +## [1.0.0] - 2014-12-23 + +- Merge commit '97b05f5544f8348736a8efaecf5c32bbe3e2ad6e' +- support empty brace syntax +- better bash coverage +- better support for regex strings + +## [0.1.4] - 2014-11-14 + +- improve recognition of bad args, recognize mismatched argument types +- support escaping +- remove pathname-expansion +- support whitespace in patterns + +## [0.1.0] + +- first commit + +[2.3.2]: https://github.com/micromatch/braces/compare/2.3.1...2.3.2 +[2.3.1]: https://github.com/micromatch/braces/compare/2.3.0...2.3.1 +[2.3.0]: https://github.com/micromatch/braces/compare/2.2.1...2.3.0 +[2.2.1]: https://github.com/micromatch/braces/compare/2.2.0...2.2.1 +[2.2.0]: https://github.com/micromatch/braces/compare/2.1.1...2.2.0 +[2.1.1]: https://github.com/micromatch/braces/compare/2.1.0...2.1.1 +[2.1.0]: https://github.com/micromatch/braces/compare/2.0.4...2.1.0 +[2.0.4]: https://github.com/micromatch/braces/compare/2.0.3...2.0.4 +[2.0.3]: https://github.com/micromatch/braces/compare/2.0.2...2.0.3 +[2.0.2]: https://github.com/micromatch/braces/compare/2.0.1...2.0.2 +[2.0.1]: https://github.com/micromatch/braces/compare/2.0.0...2.0.1 +[2.0.0]: https://github.com/micromatch/braces/compare/1.8.5...2.0.0 +[1.8.5]: https://github.com/micromatch/braces/compare/1.8.4...1.8.5 +[1.8.4]: https://github.com/micromatch/braces/compare/1.8.0...1.8.4 +[1.8.0]: https://github.com/micromatch/braces/compare/1.6.0...1.8.0 +[1.6.0]: https://github.com/micromatch/braces/compare/1.5.0...1.6.0 +[1.5.0]: https://github.com/micromatch/braces/compare/1.4.0...1.5.0 +[1.4.0]: https://github.com/micromatch/braces/compare/1.3.0...1.4.0 +[1.3.0]: https://github.com/micromatch/braces/compare/1.2.0...1.3.0 +[1.2.0]: https://github.com/micromatch/braces/compare/1.1.0...1.2.0 +[1.1.0]: https://github.com/micromatch/braces/compare/1.0.0...1.1.0 +[1.0.0]: https://github.com/micromatch/braces/compare/0.1.4...1.0.0 +[0.1.4]: https://github.com/micromatch/braces/compare/0.1.0...0.1.4 + +[Unreleased]: https://github.com/micromatch/braces/compare/0.1.0...HEAD +[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog \ No newline at end of file diff --git a/server/node_modules/braces/LICENSE b/server/node_modules/braces/LICENSE new file mode 100644 index 0000000..d32ab44 --- /dev/null +++ b/server/node_modules/braces/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2018, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/server/node_modules/braces/README.md b/server/node_modules/braces/README.md new file mode 100644 index 0000000..cba2f60 --- /dev/null +++ b/server/node_modules/braces/README.md @@ -0,0 +1,593 @@ +# braces [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/braces.svg?style=flat)](https://www.npmjs.com/package/braces) [![NPM monthly downloads](https://img.shields.io/npm/dm/braces.svg?style=flat)](https://npmjs.org/package/braces) [![NPM total downloads](https://img.shields.io/npm/dt/braces.svg?style=flat)](https://npmjs.org/package/braces) [![Linux Build Status](https://img.shields.io/travis/micromatch/braces.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/braces) + +> Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save braces +``` + +## v3.0.0 Released!! + +See the [changelog](CHANGELOG.md) for details. + +## Why use braces? + +Brace patterns make globs more powerful by adding the ability to match specific ranges and sequences of characters. + +* **Accurate** - complete support for the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/) specification (passes all of the Bash braces tests) +* **[fast and performant](#benchmarks)** - Starts fast, runs fast and [scales well](#performance) as patterns increase in complexity. +* **Organized code base** - The parser and compiler are easy to maintain and update when edge cases crop up. +* **Well-tested** - Thousands of test assertions, and passes all of the Bash, minimatch, and [brace-expansion](https://github.com/juliangruber/brace-expansion) unit tests (as of the date this was written). +* **Safer** - You shouldn't have to worry about users defining aggressive or malicious brace patterns that can break your application. Braces takes measures to prevent malicious regex that can be used for DDoS attacks (see [catastrophic backtracking](https://www.regular-expressions.info/catastrophic.html)). +* [Supports lists](#lists) - (aka "sets") `a/{b,c}/d` => `['a/b/d', 'a/c/d']` +* [Supports sequences](#sequences) - (aka "ranges") `{01..03}` => `['01', '02', '03']` +* [Supports steps](#steps) - (aka "increments") `{2..10..2}` => `['2', '4', '6', '8', '10']` +* [Supports escaping](#escaping) - To prevent evaluation of special characters. + +## Usage + +The main export is a function that takes one or more brace `patterns` and `options`. + +```js +const braces = require('braces'); +// braces(patterns[, options]); + +console.log(braces(['{01..05}', '{a..e}'])); +//=> ['(0[1-5])', '([a-e])'] + +console.log(braces(['{01..05}', '{a..e}'], { expand: true })); +//=> ['01', '02', '03', '04', '05', 'a', 'b', 'c', 'd', 'e'] +``` + +### Brace Expansion vs. Compilation + +By default, brace patterns are compiled into strings that are optimized for creating regular expressions and matching. + +**Compiled** + +```js +console.log(braces('a/{x,y,z}/b')); +//=> ['a/(x|y|z)/b'] +console.log(braces(['a/{01..20}/b', 'a/{1..5}/b'])); +//=> [ 'a/(0[1-9]|1[0-9]|20)/b', 'a/([1-5])/b' ] +``` + +**Expanded** + +Enable brace expansion by setting the `expand` option to true, or by using [braces.expand()](#expand) (returns an array similar to what you'd expect from Bash, or `echo {1..5}`, or [minimatch](https://github.com/isaacs/minimatch)): + +```js +console.log(braces('a/{x,y,z}/b', { expand: true })); +//=> ['a/x/b', 'a/y/b', 'a/z/b'] + +console.log(braces.expand('{01..10}')); +//=> ['01','02','03','04','05','06','07','08','09','10'] +``` + +### Lists + +Expand lists (like Bash "sets"): + +```js +console.log(braces('a/{foo,bar,baz}/*.js')); +//=> ['a/(foo|bar|baz)/*.js'] + +console.log(braces.expand('a/{foo,bar,baz}/*.js')); +//=> ['a/foo/*.js', 'a/bar/*.js', 'a/baz/*.js'] +``` + +### Sequences + +Expand ranges of characters (like Bash "sequences"): + +```js +console.log(braces.expand('{1..3}')); // ['1', '2', '3'] +console.log(braces.expand('a/{1..3}/b')); // ['a/1/b', 'a/2/b', 'a/3/b'] +console.log(braces('{a..c}', { expand: true })); // ['a', 'b', 'c'] +console.log(braces('foo/{a..c}', { expand: true })); // ['foo/a', 'foo/b', 'foo/c'] + +// supports zero-padded ranges +console.log(braces('a/{01..03}/b')); //=> ['a/(0[1-3])/b'] +console.log(braces('a/{001..300}/b')); //=> ['a/(0{2}[1-9]|0[1-9][0-9]|[12][0-9]{2}|300)/b'] +``` + +See [fill-range](https://github.com/jonschlinkert/fill-range) for all available range-expansion options. + +### Steppped ranges + +Steps, or increments, may be used with ranges: + +```js +console.log(braces.expand('{2..10..2}')); +//=> ['2', '4', '6', '8', '10'] + +console.log(braces('{2..10..2}')); +//=> ['(2|4|6|8|10)'] +``` + +When the [.optimize](#optimize) method is used, or [options.optimize](#optionsoptimize) is set to true, sequences are passed to [to-regex-range](https://github.com/jonschlinkert/to-regex-range) for expansion. + +### Nesting + +Brace patterns may be nested. The results of each expanded string are not sorted, and left to right order is preserved. + +**"Expanded" braces** + +```js +console.log(braces.expand('a{b,c,/{x,y}}/e')); +//=> ['ab/e', 'ac/e', 'a/x/e', 'a/y/e'] + +console.log(braces.expand('a/{x,{1..5},y}/c')); +//=> ['a/x/c', 'a/1/c', 'a/2/c', 'a/3/c', 'a/4/c', 'a/5/c', 'a/y/c'] +``` + +**"Optimized" braces** + +```js +console.log(braces('a{b,c,/{x,y}}/e')); +//=> ['a(b|c|/(x|y))/e'] + +console.log(braces('a/{x,{1..5},y}/c')); +//=> ['a/(x|([1-5])|y)/c'] +``` + +### Escaping + +**Escaping braces** + +A brace pattern will not be expanded or evaluted if _either the opening or closing brace is escaped_: + +```js +console.log(braces.expand('a\\{d,c,b}e')); +//=> ['a{d,c,b}e'] + +console.log(braces.expand('a{d,c,b\\}e')); +//=> ['a{d,c,b}e'] +``` + +**Escaping commas** + +Commas inside braces may also be escaped: + +```js +console.log(braces.expand('a{b\\,c}d')); +//=> ['a{b,c}d'] + +console.log(braces.expand('a{d\\,c,b}e')); +//=> ['ad,ce', 'abe'] +``` + +**Single items** + +Following bash conventions, a brace pattern is also not expanded when it contains a single character: + +```js +console.log(braces.expand('a{b}c')); +//=> ['a{b}c'] +``` + +## Options + +### options.maxLength + +**Type**: `Number` + +**Default**: `65,536` + +**Description**: Limit the length of the input string. Useful when the input string is generated or your application allows users to pass a string, et cetera. + +```js +console.log(braces('a/{b,c}/d', { maxLength: 3 })); //=> throws an error +``` + +### options.expand + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: Generate an "expanded" brace pattern (alternatively you can use the `braces.expand()` method, which does the same thing). + +```js +console.log(braces('a/{b,c}/d', { expand: true })); +//=> [ 'a/b/d', 'a/c/d' ] +``` + +### options.nodupes + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: Remove duplicates from the returned array. + +### options.rangeLimit + +**Type**: `Number` + +**Default**: `1000` + +**Description**: To prevent malicious patterns from being passed by users, an error is thrown when `braces.expand()` is used or `options.expand` is true and the generated range will exceed the `rangeLimit`. + +You can customize `options.rangeLimit` or set it to `Inifinity` to disable this altogether. + +**Examples** + +```js +// pattern exceeds the "rangeLimit", so it's optimized automatically +console.log(braces.expand('{1..1000}')); +//=> ['([1-9]|[1-9][0-9]{1,2}|1000)'] + +// pattern does not exceed "rangeLimit", so it's NOT optimized +console.log(braces.expand('{1..100}')); +//=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100'] +``` + +### options.transform + +**Type**: `Function` + +**Default**: `undefined` + +**Description**: Customize range expansion. + +**Example: Transforming non-numeric values** + +```js +const alpha = braces.expand('x/{a..e}/y', { + transform(value, index) { + // When non-numeric values are passed, "value" is a character code. + return 'foo/' + String.fromCharCode(value) + '-' + index; + } +}); +console.log(alpha); +//=> [ 'x/foo/a-0/y', 'x/foo/b-1/y', 'x/foo/c-2/y', 'x/foo/d-3/y', 'x/foo/e-4/y' ] +``` + +**Example: Transforming numeric values** + +```js +const numeric = braces.expand('{1..5}', { + transform(value) { + // when numeric values are passed, "value" is a number + return 'foo/' + value * 2; + } +}); +console.log(numeric); +//=> [ 'foo/2', 'foo/4', 'foo/6', 'foo/8', 'foo/10' ] +``` + +### options.quantifiers + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. For example, `a{1,3}` will match the letter `a` one to three times. + +Unfortunately, regex quantifiers happen to share the same syntax as [Bash lists](#lists) + +The `quantifiers` option tells braces to detect when [regex quantifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#quantifiers) are defined in the given pattern, and not to try to expand them as lists. + +**Examples** + +```js +const braces = require('braces'); +console.log(braces('a/b{1,3}/{x,y,z}')); +//=> [ 'a/b(1|3)/(x|y|z)' ] +console.log(braces('a/b{1,3}/{x,y,z}', {quantifiers: true})); +//=> [ 'a/b{1,3}/(x|y|z)' ] +console.log(braces('a/b{1,3}/{x,y,z}', {quantifiers: true, expand: true})); +//=> [ 'a/b{1,3}/x', 'a/b{1,3}/y', 'a/b{1,3}/z' ] +``` + +### options.unescape + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: Strip backslashes that were used for escaping from the result. + +## What is "brace expansion"? + +Brace expansion is a type of parameter expansion that was made popular by unix shells for generating lists of strings, as well as regex-like matching when used alongside wildcards (globs). + +In addition to "expansion", braces are also used for matching. In other words: + +* [brace expansion](#brace-expansion) is for generating new lists +* [brace matching](#brace-matching) is for filtering existing lists + +
+More about brace expansion (click to expand) + +There are two main types of brace expansion: + +1. **lists**: which are defined using comma-separated values inside curly braces: `{a,b,c}` +2. **sequences**: which are defined using a starting value and an ending value, separated by two dots: `a{1..3}b`. Optionally, a third argument may be passed to define a "step" or increment to use: `a{1..100..10}b`. These are also sometimes referred to as "ranges". + +Here are some example brace patterns to illustrate how they work: + +**Sets** + +``` +{a,b,c} => a b c +{a,b,c}{1,2} => a1 a2 b1 b2 c1 c2 +``` + +**Sequences** + +``` +{1..9} => 1 2 3 4 5 6 7 8 9 +{4..-4} => 4 3 2 1 0 -1 -2 -3 -4 +{1..20..3} => 1 4 7 10 13 16 19 +{a..j} => a b c d e f g h i j +{j..a} => j i h g f e d c b a +{a..z..3} => a d g j m p s v y +``` + +**Combination** + +Sets and sequences can be mixed together or used along with any other strings. + +``` +{a,b,c}{1..3} => a1 a2 a3 b1 b2 b3 c1 c2 c3 +foo/{a,b,c}/bar => foo/a/bar foo/b/bar foo/c/bar +``` + +The fact that braces can be "expanded" from relatively simple patterns makes them ideal for quickly generating test fixtures, file paths, and similar use cases. + +## Brace matching + +In addition to _expansion_, brace patterns are also useful for performing regular-expression-like matching. + +For example, the pattern `foo/{1..3}/bar` would match any of following strings: + +``` +foo/1/bar +foo/2/bar +foo/3/bar +``` + +But not: + +``` +baz/1/qux +baz/2/qux +baz/3/qux +``` + +Braces can also be combined with [glob patterns](https://github.com/jonschlinkert/micromatch) to perform more advanced wildcard matching. For example, the pattern `*/{1..3}/*` would match any of following strings: + +``` +foo/1/bar +foo/2/bar +foo/3/bar +baz/1/qux +baz/2/qux +baz/3/qux +``` + +## Brace matching pitfalls + +Although brace patterns offer a user-friendly way of matching ranges or sets of strings, there are also some major disadvantages and potential risks you should be aware of. + +### tldr + +**"brace bombs"** + +* brace expansion can eat up a huge amount of processing resources +* as brace patterns increase _linearly in size_, the system resources required to expand the pattern increase exponentially +* users can accidentally (or intentially) exhaust your system's resources resulting in the equivalent of a DoS attack (bonus: no programming knowledge is required!) + +For a more detailed explanation with examples, see the [geometric complexity](#geometric-complexity) section. + +### The solution + +Jump to the [performance section](#performance) to see how Braces solves this problem in comparison to other libraries. + +### Geometric complexity + +At minimum, brace patterns with sets limited to two elements have quadradic or `O(n^2)` complexity. But the complexity of the algorithm increases exponentially as the number of sets, _and elements per set_, increases, which is `O(n^c)`. + +For example, the following sets demonstrate quadratic (`O(n^2)`) complexity: + +``` +{1,2}{3,4} => (2X2) => 13 14 23 24 +{1,2}{3,4}{5,6} => (2X2X2) => 135 136 145 146 235 236 245 246 +``` + +But add an element to a set, and we get a n-fold Cartesian product with `O(n^c)` complexity: + +``` +{1,2,3}{4,5,6}{7,8,9} => (3X3X3) => 147 148 149 157 158 159 167 168 169 247 248 + 249 257 258 259 267 268 269 347 348 349 357 + 358 359 367 368 369 +``` + +Now, imagine how this complexity grows given that each element is a n-tuple: + +``` +{1..100}{1..100} => (100X100) => 10,000 elements (38.4 kB) +{1..100}{1..100}{1..100} => (100X100X100) => 1,000,000 elements (5.76 MB) +``` + +Although these examples are clearly contrived, they demonstrate how brace patterns can quickly grow out of control. + +**More information** + +Interested in learning more about brace expansion? + +* [linuxjournal/bash-brace-expansion](http://www.linuxjournal.com/content/bash-brace-expansion) +* [rosettacode/Brace_expansion](https://rosettacode.org/wiki/Brace_expansion) +* [cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) + +
+ +## Performance + +Braces is not only screaming fast, it's also more accurate the other brace expansion libraries. + +### Better algorithms + +Fortunately there is a solution to the ["brace bomb" problem](#brace-matching-pitfalls): _don't expand brace patterns into an array when they're used for matching_. + +Instead, convert the pattern into an optimized regular expression. This is easier said than done, and braces is the only library that does this currently. + +**The proof is in the numbers** + +Minimatch gets exponentially slower as patterns increase in complexity, braces does not. The following results were generated using `braces()` and `minimatch.braceExpand()`, respectively. + +| **Pattern** | **braces** | **[minimatch][]** | +| --- | --- | --- | +| `{1..9007199254740991}`[^1] | `298 B` (5ms 459μs)| N/A (freezes) | +| `{1..1000000000000000}` | `41 B` (1ms 15μs) | N/A (freezes) | +| `{1..100000000000000}` | `40 B` (890μs) | N/A (freezes) | +| `{1..10000000000000}` | `39 B` (2ms 49μs) | N/A (freezes) | +| `{1..1000000000000}` | `38 B` (608μs) | N/A (freezes) | +| `{1..100000000000}` | `37 B` (397μs) | N/A (freezes) | +| `{1..10000000000}` | `35 B` (983μs) | N/A (freezes) | +| `{1..1000000000}` | `34 B` (798μs) | N/A (freezes) | +| `{1..100000000}` | `33 B` (733μs) | N/A (freezes) | +| `{1..10000000}` | `32 B` (5ms 632μs) | `78.89 MB` (16s 388ms 569μs) | +| `{1..1000000}` | `31 B` (1ms 381μs) | `6.89 MB` (1s 496ms 887μs) | +| `{1..100000}` | `30 B` (950μs) | `588.89 kB` (146ms 921μs) | +| `{1..10000}` | `29 B` (1ms 114μs) | `48.89 kB` (14ms 187μs) | +| `{1..1000}` | `28 B` (760μs) | `3.89 kB` (1ms 453μs) | +| `{1..100}` | `22 B` (345μs) | `291 B` (196μs) | +| `{1..10}` | `10 B` (533μs) | `20 B` (37μs) | +| `{1..3}` | `7 B` (190μs) | `5 B` (27μs) | + +### Faster algorithms + +When you need expansion, braces is still much faster. + +_(the following results were generated using `braces.expand()` and `minimatch.braceExpand()`, respectively)_ + +| **Pattern** | **braces** | **[minimatch][]** | +| --- | --- | --- | +| `{1..10000000}` | `78.89 MB` (2s 698ms 642μs) | `78.89 MB` (18s 601ms 974μs) | +| `{1..1000000}` | `6.89 MB` (458ms 576μs) | `6.89 MB` (1s 491ms 621μs) | +| `{1..100000}` | `588.89 kB` (20ms 728μs) | `588.89 kB` (156ms 919μs) | +| `{1..10000}` | `48.89 kB` (2ms 202μs) | `48.89 kB` (13ms 641μs) | +| `{1..1000}` | `3.89 kB` (1ms 796μs) | `3.89 kB` (1ms 958μs) | +| `{1..100}` | `291 B` (424μs) | `291 B` (211μs) | +| `{1..10}` | `20 B` (487μs) | `20 B` (72μs) | +| `{1..3}` | `5 B` (166μs) | `5 B` (27μs) | + +If you'd like to run these comparisons yourself, see [test/support/generate.js](test/support/generate.js). + +## Benchmarks + +### Running benchmarks + +Install dev dependencies: + +```bash +npm i -d && npm benchmark +``` + +### Latest results + +Braces is more accurate, without sacrificing performance. + +```bash +# range (expanded) + braces x 29,040 ops/sec ±3.69% (91 runs sampled)) + minimatch x 4,735 ops/sec ±1.28% (90 runs sampled) + +# range (optimized for regex) + braces x 382,878 ops/sec ±0.56% (94 runs sampled) + minimatch x 1,040 ops/sec ±0.44% (93 runs sampled) + +# nested ranges (expanded) + braces x 19,744 ops/sec ±2.27% (92 runs sampled)) + minimatch x 4,579 ops/sec ±0.50% (93 runs sampled) + +# nested ranges (optimized for regex) + braces x 246,019 ops/sec ±2.02% (93 runs sampled) + minimatch x 1,028 ops/sec ±0.39% (94 runs sampled) + +# set (expanded) + braces x 138,641 ops/sec ±0.53% (95 runs sampled) + minimatch x 219,582 ops/sec ±0.98% (94 runs sampled) + +# set (optimized for regex) + braces x 388,408 ops/sec ±0.41% (95 runs sampled) + minimatch x 44,724 ops/sec ±0.91% (89 runs sampled) + +# nested sets (expanded) + braces x 84,966 ops/sec ±0.48% (94 runs sampled) + minimatch x 140,720 ops/sec ±0.37% (95 runs sampled) + +# nested sets (optimized for regex) + braces x 263,340 ops/sec ±2.06% (92 runs sampled) + minimatch x 28,714 ops/sec ±0.40% (90 runs sampled) +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 197 | [jonschlinkert](https://github.com/jonschlinkert) | +| 4 | [doowb](https://github.com/doowb) | +| 1 | [es128](https://github.com/es128) | +| 1 | [eush77](https://github.com/eush77) | +| 1 | [hemanth](https://github.com/hemanth) | +| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 08, 2019._ \ No newline at end of file diff --git a/server/node_modules/braces/index.js b/server/node_modules/braces/index.js new file mode 100644 index 0000000..e560d3c --- /dev/null +++ b/server/node_modules/braces/index.js @@ -0,0 +1,170 @@ +'use strict'; + +const stringify = require('braces/lib/stringify'); +const compile = require('braces/lib/compile'); +const expand = require('braces/lib/expand'); +const parse = require('braces/lib/parse'); + +/** + * Expand the given pattern or create a regex-compatible string. + * + * ```js + * const braces = require('braces'); + * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)'] + * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c'] + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {String} + * @api public + */ + +const braces = (input, options = {}) => { + let output = []; + + if (Array.isArray(input)) { + for (let pattern of input) { + let result = braces.create(pattern, options); + if (Array.isArray(result)) { + output.push(...result); + } else { + output.push(result); + } + } + } else { + output = [].concat(braces.create(input, options)); + } + + if (options && options.expand === true && options.nodupes === true) { + output = [...new Set(output)]; + } + return output; +}; + +/** + * Parse the given `str` with the given `options`. + * + * ```js + * // braces.parse(pattern, [, options]); + * const ast = braces.parse('a/{b,c}/d'); + * console.log(ast); + * ``` + * @param {String} pattern Brace pattern to parse + * @param {Object} options + * @return {Object} Returns an AST + * @api public + */ + +braces.parse = (input, options = {}) => parse(input, options); + +/** + * Creates a braces string from an AST, or an AST node. + * + * ```js + * const braces = require('braces'); + * let ast = braces.parse('foo/{a,b}/bar'); + * console.log(stringify(ast.nodes[2])); //=> '{a,b}' + * ``` + * @param {String} `input` Brace pattern or AST. + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.stringify = (input, options = {}) => { + if (typeof input === 'string') { + return stringify(braces.parse(input, options), options); + } + return stringify(input, options); +}; + +/** + * Compiles a brace pattern into a regex-compatible, optimized string. + * This method is called by the main [braces](#braces) function by default. + * + * ```js + * const braces = require('braces'); + * console.log(braces.compile('a/{b,c}/d')); + * //=> ['a/(b|c)/d'] + * ``` + * @param {String} `input` Brace pattern or AST. + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.compile = (input, options = {}) => { + if (typeof input === 'string') { + input = braces.parse(input, options); + } + return compile(input, options); +}; + +/** + * Expands a brace pattern into an array. This method is called by the + * main [braces](#braces) function when `options.expand` is true. Before + * using this method it's recommended that you read the [performance notes](#performance)) + * and advantages of using [.compile](#compile) instead. + * + * ```js + * const braces = require('braces'); + * console.log(braces.expand('a/{b,c}/d')); + * //=> ['a/b/d', 'a/c/d']; + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.expand = (input, options = {}) => { + if (typeof input === 'string') { + input = braces.parse(input, options); + } + + let result = expand(input, options); + + // filter out empty strings if specified + if (options.noempty === true) { + result = result.filter(Boolean); + } + + // filter out duplicates if specified + if (options.nodupes === true) { + result = [...new Set(result)]; + } + + return result; +}; + +/** + * Processes a brace pattern and returns either an expanded array + * (if `options.expand` is true), a highly optimized regex-compatible string. + * This method is called by the main [braces](#braces) function. + * + * ```js + * const braces = require('braces'); + * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}')) + * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)' + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.create = (input, options = {}) => { + if (input === '' || input.length < 3) { + return [input]; + } + + return options.expand !== true + ? braces.compile(input, options) + : braces.expand(input, options); +}; + +/** + * Expose "braces" + */ + +module.exports = braces; diff --git a/server/node_modules/braces/lib/compile.js b/server/node_modules/braces/lib/compile.js new file mode 100644 index 0000000..bd8e18b --- /dev/null +++ b/server/node_modules/braces/lib/compile.js @@ -0,0 +1,57 @@ +'use strict'; + +const fill = require('fill-range'); +const utils = require('braces/lib/utils'); + +const compile = (ast, options = {}) => { + let walk = (node, parent = {}) => { + let invalidBlock = utils.isInvalidBrace(parent); + let invalidNode = node.invalid === true && options.escapeInvalid === true; + let invalid = invalidBlock === true || invalidNode === true; + let prefix = options.escapeInvalid === true ? '\\' : ''; + let output = ''; + + if (node.isOpen === true) { + return prefix + node.value; + } + if (node.isClose === true) { + return prefix + node.value; + } + + if (node.type === 'open') { + return invalid ? (prefix + node.value) : '('; + } + + if (node.type === 'close') { + return invalid ? (prefix + node.value) : ')'; + } + + if (node.type === 'comma') { + return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|'); + } + + if (node.value) { + return node.value; + } + + if (node.nodes && node.ranges > 0) { + let args = utils.reduce(node.nodes); + let range = fill(...args, { ...options, wrap: false, toRegex: true }); + + if (range.length !== 0) { + return args.length > 1 && range.length > 1 ? `(${range})` : range; + } + } + + if (node.nodes) { + for (let child of node.nodes) { + output += walk(child, node); + } + } + return output; + }; + + return walk(ast); +}; + +module.exports = compile; diff --git a/server/node_modules/braces/lib/constants.js b/server/node_modules/braces/lib/constants.js new file mode 100644 index 0000000..a937943 --- /dev/null +++ b/server/node_modules/braces/lib/constants.js @@ -0,0 +1,57 @@ +'use strict'; + +module.exports = { + MAX_LENGTH: 1024 * 64, + + // Digits + CHAR_0: '0', /* 0 */ + CHAR_9: '9', /* 9 */ + + // Alphabet chars. + CHAR_UPPERCASE_A: 'A', /* A */ + CHAR_LOWERCASE_A: 'a', /* a */ + CHAR_UPPERCASE_Z: 'Z', /* Z */ + CHAR_LOWERCASE_Z: 'z', /* z */ + + CHAR_LEFT_PARENTHESES: '(', /* ( */ + CHAR_RIGHT_PARENTHESES: ')', /* ) */ + + CHAR_ASTERISK: '*', /* * */ + + // Non-alphabetic chars. + CHAR_AMPERSAND: '&', /* & */ + CHAR_AT: '@', /* @ */ + CHAR_BACKSLASH: '\\', /* \ */ + CHAR_BACKTICK: '`', /* ` */ + CHAR_CARRIAGE_RETURN: '\r', /* \r */ + CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */ + CHAR_COLON: ':', /* : */ + CHAR_COMMA: ',', /* , */ + CHAR_DOLLAR: '$', /* . */ + CHAR_DOT: '.', /* . */ + CHAR_DOUBLE_QUOTE: '"', /* " */ + CHAR_EQUAL: '=', /* = */ + CHAR_EXCLAMATION_MARK: '!', /* ! */ + CHAR_FORM_FEED: '\f', /* \f */ + CHAR_FORWARD_SLASH: '/', /* / */ + CHAR_HASH: '#', /* # */ + CHAR_HYPHEN_MINUS: '-', /* - */ + CHAR_LEFT_ANGLE_BRACKET: '<', /* < */ + CHAR_LEFT_CURLY_BRACE: '{', /* { */ + CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */ + CHAR_LINE_FEED: '\n', /* \n */ + CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */ + CHAR_PERCENT: '%', /* % */ + CHAR_PLUS: '+', /* + */ + CHAR_QUESTION_MARK: '?', /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */ + CHAR_RIGHT_CURLY_BRACE: '}', /* } */ + CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */ + CHAR_SEMICOLON: ';', /* ; */ + CHAR_SINGLE_QUOTE: '\'', /* ' */ + CHAR_SPACE: ' ', /* */ + CHAR_TAB: '\t', /* \t */ + CHAR_UNDERSCORE: '_', /* _ */ + CHAR_VERTICAL_LINE: '|', /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */ +}; diff --git a/server/node_modules/braces/lib/expand.js b/server/node_modules/braces/lib/expand.js new file mode 100644 index 0000000..a7a3d7a --- /dev/null +++ b/server/node_modules/braces/lib/expand.js @@ -0,0 +1,113 @@ +'use strict'; + +const fill = require('fill-range'); +const stringify = require('braces/lib/stringify'); +const utils = require('braces/lib/utils'); + +const append = (queue = '', stash = '', enclose = false) => { + let result = []; + + queue = [].concat(queue); + stash = [].concat(stash); + + if (!stash.length) return queue; + if (!queue.length) { + return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; + } + + for (let item of queue) { + if (Array.isArray(item)) { + for (let value of item) { + result.push(append(value, stash, enclose)); + } + } else { + for (let ele of stash) { + if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; + result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele)); + } + } + } + return utils.flatten(result); +}; + +const expand = (ast, options = {}) => { + let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit; + + let walk = (node, parent = {}) => { + node.queue = []; + + let p = parent; + let q = parent.queue; + + while (p.type !== 'brace' && p.type !== 'root' && p.parent) { + p = p.parent; + q = p.queue; + } + + if (node.invalid || node.dollar) { + q.push(append(q.pop(), stringify(node, options))); + return; + } + + if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { + q.push(append(q.pop(), ['{}'])); + return; + } + + if (node.nodes && node.ranges > 0) { + let args = utils.reduce(node.nodes); + + if (utils.exceedsLimit(...args, options.step, rangeLimit)) { + throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); + } + + let range = fill(...args, options); + if (range.length === 0) { + range = stringify(node, options); + } + + q.push(append(q.pop(), range)); + node.nodes = []; + return; + } + + let enclose = utils.encloseBrace(node); + let queue = node.queue; + let block = node; + + while (block.type !== 'brace' && block.type !== 'root' && block.parent) { + block = block.parent; + queue = block.queue; + } + + for (let i = 0; i < node.nodes.length; i++) { + let child = node.nodes[i]; + + if (child.type === 'comma' && node.type === 'brace') { + if (i === 1) queue.push(''); + queue.push(''); + continue; + } + + if (child.type === 'close') { + q.push(append(q.pop(), queue, enclose)); + continue; + } + + if (child.value && child.type !== 'open') { + queue.push(append(queue.pop(), child.value)); + continue; + } + + if (child.nodes) { + walk(child, node); + } + } + + return queue; + }; + + return utils.flatten(walk(ast)); +}; + +module.exports = expand; diff --git a/server/node_modules/braces/lib/parse.js b/server/node_modules/braces/lib/parse.js new file mode 100644 index 0000000..653a5ac --- /dev/null +++ b/server/node_modules/braces/lib/parse.js @@ -0,0 +1,333 @@ +'use strict'; + +const stringify = require('braces/lib/stringify'); + +/** + * Constants + */ + +const { + MAX_LENGTH, + CHAR_BACKSLASH, /* \ */ + CHAR_BACKTICK, /* ` */ + CHAR_COMMA, /* , */ + CHAR_DOT, /* . */ + CHAR_LEFT_PARENTHESES, /* ( */ + CHAR_RIGHT_PARENTHESES, /* ) */ + CHAR_LEFT_CURLY_BRACE, /* { */ + CHAR_RIGHT_CURLY_BRACE, /* } */ + CHAR_LEFT_SQUARE_BRACKET, /* [ */ + CHAR_RIGHT_SQUARE_BRACKET, /* ] */ + CHAR_DOUBLE_QUOTE, /* " */ + CHAR_SINGLE_QUOTE, /* ' */ + CHAR_NO_BREAK_SPACE, + CHAR_ZERO_WIDTH_NOBREAK_SPACE +} = require('braces/lib/constants'); + +/** + * parse + */ + +const parse = (input, options = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } + + let opts = options || {}; + let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + if (input.length > max) { + throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); + } + + let ast = { type: 'root', input, nodes: [] }; + let stack = [ast]; + let block = ast; + let prev = ast; + let brackets = 0; + let length = input.length; + let index = 0; + let depth = 0; + let value; + let memo = {}; + + /** + * Helpers + */ + + const advance = () => input[index++]; + const push = node => { + if (node.type === 'text' && prev.type === 'dot') { + prev.type = 'text'; + } + + if (prev && prev.type === 'text' && node.type === 'text') { + prev.value += node.value; + return; + } + + block.nodes.push(node); + node.parent = block; + node.prev = prev; + prev = node; + return node; + }; + + push({ type: 'bos' }); + + while (index < length) { + block = stack[stack.length - 1]; + value = advance(); + + /** + * Invalid chars + */ + + if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { + continue; + } + + /** + * Escaped chars + */ + + if (value === CHAR_BACKSLASH) { + push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); + continue; + } + + /** + * Right square bracket (literal): ']' + */ + + if (value === CHAR_RIGHT_SQUARE_BRACKET) { + push({ type: 'text', value: '\\' + value }); + continue; + } + + /** + * Left square bracket: '[' + */ + + if (value === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; + + let closed = true; + let next; + + while (index < length && (next = advance())) { + value += next; + + if (next === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; + continue; + } + + if (next === CHAR_BACKSLASH) { + value += advance(); + continue; + } + + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + brackets--; + + if (brackets === 0) { + break; + } + } + } + + push({ type: 'text', value }); + continue; + } + + /** + * Parentheses + */ + + if (value === CHAR_LEFT_PARENTHESES) { + block = push({ type: 'paren', nodes: [] }); + stack.push(block); + push({ type: 'text', value }); + continue; + } + + if (value === CHAR_RIGHT_PARENTHESES) { + if (block.type !== 'paren') { + push({ type: 'text', value }); + continue; + } + block = stack.pop(); + push({ type: 'text', value }); + block = stack[stack.length - 1]; + continue; + } + + /** + * Quotes: '|"|` + */ + + if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { + let open = value; + let next; + + if (options.keepQuotes !== true) { + value = ''; + } + + while (index < length && (next = advance())) { + if (next === CHAR_BACKSLASH) { + value += next + advance(); + continue; + } + + if (next === open) { + if (options.keepQuotes === true) value += next; + break; + } + + value += next; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Left curly brace: '{' + */ + + if (value === CHAR_LEFT_CURLY_BRACE) { + depth++; + + let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; + let brace = { + type: 'brace', + open: true, + close: false, + dollar, + depth, + commas: 0, + ranges: 0, + nodes: [] + }; + + block = push(brace); + stack.push(block); + push({ type: 'open', value }); + continue; + } + + /** + * Right curly brace: '}' + */ + + if (value === CHAR_RIGHT_CURLY_BRACE) { + if (block.type !== 'brace') { + push({ type: 'text', value }); + continue; + } + + let type = 'close'; + block = stack.pop(); + block.close = true; + + push({ type, value }); + depth--; + + block = stack[stack.length - 1]; + continue; + } + + /** + * Comma: ',' + */ + + if (value === CHAR_COMMA && depth > 0) { + if (block.ranges > 0) { + block.ranges = 0; + let open = block.nodes.shift(); + block.nodes = [open, { type: 'text', value: stringify(block) }]; + } + + push({ type: 'comma', value }); + block.commas++; + continue; + } + + /** + * Dot: '.' + */ + + if (value === CHAR_DOT && depth > 0 && block.commas === 0) { + let siblings = block.nodes; + + if (depth === 0 || siblings.length === 0) { + push({ type: 'text', value }); + continue; + } + + if (prev.type === 'dot') { + block.range = []; + prev.value += value; + prev.type = 'range'; + + if (block.nodes.length !== 3 && block.nodes.length !== 5) { + block.invalid = true; + block.ranges = 0; + prev.type = 'text'; + continue; + } + + block.ranges++; + block.args = []; + continue; + } + + if (prev.type === 'range') { + siblings.pop(); + + let before = siblings[siblings.length - 1]; + before.value += prev.value + value; + prev = before; + block.ranges--; + continue; + } + + push({ type: 'dot', value }); + continue; + } + + /** + * Text + */ + + push({ type: 'text', value }); + } + + // Mark imbalanced braces and brackets as invalid + do { + block = stack.pop(); + + if (block.type !== 'root') { + block.nodes.forEach(node => { + if (!node.nodes) { + if (node.type === 'open') node.isOpen = true; + if (node.type === 'close') node.isClose = true; + if (!node.nodes) node.type = 'text'; + node.invalid = true; + } + }); + + // get the location of the block on parent.nodes (block's siblings) + let parent = stack[stack.length - 1]; + let index = parent.nodes.indexOf(block); + // replace the (invalid) block with it's nodes + parent.nodes.splice(index, 1, ...block.nodes); + } + } while (stack.length > 0); + + push({ type: 'eos' }); + return ast; +}; + +module.exports = parse; diff --git a/server/node_modules/braces/lib/stringify.js b/server/node_modules/braces/lib/stringify.js new file mode 100644 index 0000000..2b1eab0 --- /dev/null +++ b/server/node_modules/braces/lib/stringify.js @@ -0,0 +1,32 @@ +'use strict'; + +const utils = require('braces/lib/utils'); + +module.exports = (ast, options = {}) => { + let stringify = (node, parent = {}) => { + let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent); + let invalidNode = node.invalid === true && options.escapeInvalid === true; + let output = ''; + + if (node.value) { + if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) { + return '\\' + node.value; + } + return node.value; + } + + if (node.value) { + return node.value; + } + + if (node.nodes) { + for (let child of node.nodes) { + output += stringify(child); + } + } + return output; + }; + + return stringify(ast); +}; + diff --git a/server/node_modules/braces/lib/utils.js b/server/node_modules/braces/lib/utils.js new file mode 100644 index 0000000..e3551a6 --- /dev/null +++ b/server/node_modules/braces/lib/utils.js @@ -0,0 +1,112 @@ +'use strict'; + +exports.isInteger = num => { + if (typeof num === 'number') { + return Number.isInteger(num); + } + if (typeof num === 'string' && num.trim() !== '') { + return Number.isInteger(Number(num)); + } + return false; +}; + +/** + * Find a node of the given type + */ + +exports.find = (node, type) => node.nodes.find(node => node.type === type); + +/** + * Find a node of the given type + */ + +exports.exceedsLimit = (min, max, step = 1, limit) => { + if (limit === false) return false; + if (!exports.isInteger(min) || !exports.isInteger(max)) return false; + return ((Number(max) - Number(min)) / Number(step)) >= limit; +}; + +/** + * Escape the given node with '\\' before node.value + */ + +exports.escapeNode = (block, n = 0, type) => { + let node = block.nodes[n]; + if (!node) return; + + if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { + if (node.escaped !== true) { + node.value = '\\' + node.value; + node.escaped = true; + } + } +}; + +/** + * Returns true if the given brace node should be enclosed in literal braces + */ + +exports.encloseBrace = node => { + if (node.type !== 'brace') return false; + if ((node.commas >> 0 + node.ranges >> 0) === 0) { + node.invalid = true; + return true; + } + return false; +}; + +/** + * Returns true if a brace node is invalid. + */ + +exports.isInvalidBrace = block => { + if (block.type !== 'brace') return false; + if (block.invalid === true || block.dollar) return true; + if ((block.commas >> 0 + block.ranges >> 0) === 0) { + block.invalid = true; + return true; + } + if (block.open !== true || block.close !== true) { + block.invalid = true; + return true; + } + return false; +}; + +/** + * Returns true if a node is an open or close node + */ + +exports.isOpenOrClose = node => { + if (node.type === 'open' || node.type === 'close') { + return true; + } + return node.open === true || node.close === true; +}; + +/** + * Reduce an array of text nodes. + */ + +exports.reduce = nodes => nodes.reduce((acc, node) => { + if (node.type === 'text') acc.push(node.value); + if (node.type === 'range') node.type = 'text'; + return acc; +}, []); + +/** + * Flatten an array + */ + +exports.flatten = (...args) => { + const result = []; + const flat = arr => { + for (let i = 0; i < arr.length; i++) { + let ele = arr[i]; + Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele); + } + return result; + }; + flat(args); + return result; +}; diff --git a/server/node_modules/braces/package.json b/server/node_modules/braces/package.json new file mode 100644 index 0000000..25ca951 --- /dev/null +++ b/server/node_modules/braces/package.json @@ -0,0 +1,123 @@ +{ + "_from": "braces@~3.0.2", + "_id": "braces@3.0.2", + "_inBundle": false, + "_integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "_location": "/braces", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "braces@~3.0.2", + "name": "braces", + "escapedName": "braces", + "rawSpec": "~3.0.2", + "saveSpec": null, + "fetchSpec": "~3.0.2" + }, + "_requiredBy": [ + "/chokidar" + ], + "_resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "_shasum": "3454e1a462ee8d599e236df336cd9ea4f8afe107", + "_spec": "braces@~3.0.2", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/chokidar", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/micromatch/braces/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Elan Shanker", + "url": "https://github.com/es128" + }, + { + "name": "Eugene Sharygin", + "url": "https://github.com/eush77" + }, + { + "name": "hemanth.hm", + "url": "http://h3manth.com" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + } + ], + "dependencies": { + "fill-range": "^7.0.1" + }, + "deprecated": false, + "description": "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.", + "devDependencies": { + "ansi-colors": "^3.2.4", + "bash-path": "^2.0.1", + "gulp-format-md": "^2.0.0", + "mocha": "^6.1.1" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "lib" + ], + "homepage": "https://github.com/micromatch/braces", + "keywords": [ + "alpha", + "alphabetical", + "bash", + "brace", + "braces", + "expand", + "expansion", + "filepath", + "fill", + "fs", + "glob", + "globbing", + "letter", + "match", + "matches", + "matching", + "number", + "numerical", + "path", + "range", + "ranges", + "sh" + ], + "license": "MIT", + "main": "index.js", + "name": "braces", + "repository": { + "type": "git", + "url": "git+https://github.com/micromatch/braces.git" + }, + "scripts": { + "benchmark": "node benchmark", + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "lint": { + "reflinks": true + }, + "plugins": [ + "gulp-format-md" + ] + }, + "version": "3.0.2" +} diff --git a/server/node_modules/buffer/AUTHORS.md b/server/node_modules/buffer/AUTHORS.md new file mode 100644 index 0000000..22eb171 --- /dev/null +++ b/server/node_modules/buffer/AUTHORS.md @@ -0,0 +1,70 @@ +# Authors + +#### Ordered by first contribution. + +- Romain Beauxis (toots@rastageeks.org) +- Tobias Koppers (tobias.koppers@googlemail.com) +- Janus (ysangkok@gmail.com) +- Rainer Dreyer (rdrey1@gmail.com) +- Tõnis Tiigi (tonistiigi@gmail.com) +- James Halliday (mail@substack.net) +- Michael Williamson (mike@zwobble.org) +- elliottcable (github@elliottcable.name) +- rafael (rvalle@livelens.net) +- Andrew Kelley (superjoe30@gmail.com) +- Andreas Madsen (amwebdk@gmail.com) +- Mike Brevoort (mike.brevoort@pearson.com) +- Brian White (mscdex@mscdex.net) +- Feross Aboukhadijeh (feross@feross.org) +- Ruben Verborgh (ruben@verborgh.org) +- eliang (eliang.cs@gmail.com) +- Jesse Tane (jesse.tane@gmail.com) +- Alfonso Boza (alfonso@cloud.com) +- Mathias Buus (mathiasbuus@gmail.com) +- Devon Govett (devongovett@gmail.com) +- Daniel Cousens (github@dcousens.com) +- Joseph Dykstra (josephdykstra@gmail.com) +- Parsha Pourkhomami (parshap+git@gmail.com) +- Damjan Košir (damjan.kosir@gmail.com) +- daverayment (dave.rayment@gmail.com) +- kawanet (u-suke@kawa.net) +- Linus Unnebäck (linus@folkdatorn.se) +- Nolan Lawson (nolan.lawson@gmail.com) +- Calvin Metcalf (calvin.metcalf@gmail.com) +- Koki Takahashi (hakatasiloving@gmail.com) +- Guy Bedford (guybedford@gmail.com) +- Jan Schär (jscissr@gmail.com) +- RaulTsc (tomescu.raul@gmail.com) +- Matthieu Monsch (monsch@alum.mit.edu) +- Dan Ehrenberg (littledan@chromium.org) +- Kirill Fomichev (fanatid@ya.ru) +- Yusuke Kawasaki (u-suke@kawa.net) +- DC (dcposch@dcpos.ch) +- John-David Dalton (john.david.dalton@gmail.com) +- adventure-yunfei (adventure030@gmail.com) +- Emil Bay (github@tixz.dk) +- Sam Sudar (sudar.sam@gmail.com) +- Volker Mische (volker.mische@gmail.com) +- David Walton (support@geekstocks.com) +- Сковорода Никита Андреевич (chalkerx@gmail.com) +- greenkeeper[bot] (greenkeeper[bot]@users.noreply.github.com) +- ukstv (sergey.ukustov@machinomy.com) +- Renée Kooi (renee@kooi.me) +- ranbochen (ranbochen@qq.com) +- Vladimir Borovik (bobahbdb@gmail.com) +- greenkeeper[bot] (23040076+greenkeeper[bot]@users.noreply.github.com) +- kumavis (aaron@kumavis.me) +- Sergey Ukustov (sergey.ukustov@machinomy.com) +- Fei Liu (liu.feiwood@gmail.com) +- Blaine Bublitz (blaine.bublitz@gmail.com) +- clement (clement@seald.io) +- Koushik Dutta (koushd@gmail.com) +- Jordan Harband (ljharb@gmail.com) +- Niklas Mischkulnig (mischnic@users.noreply.github.com) +- Nikolai Vavilov (vvnicholas@gmail.com) +- Fedor Nezhivoi (gyzerok@users.noreply.github.com) +- Peter Newman (peternewman@users.noreply.github.com) +- mathmakgakpak (44949126+mathmakgakpak@users.noreply.github.com) +- jkkang (jkkang@smartauth.kr) + +#### Generated by bin/update-authors.sh. diff --git a/server/node_modules/buffer/LICENSE b/server/node_modules/buffer/LICENSE new file mode 100644 index 0000000..d6bf75d --- /dev/null +++ b/server/node_modules/buffer/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh, and other contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/server/node_modules/buffer/README.md b/server/node_modules/buffer/README.md new file mode 100644 index 0000000..9a23d7c --- /dev/null +++ b/server/node_modules/buffer/README.md @@ -0,0 +1,410 @@ +# buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] + +[travis-image]: https://img.shields.io/travis/feross/buffer/master.svg +[travis-url]: https://travis-ci.org/feross/buffer +[npm-image]: https://img.shields.io/npm/v/buffer.svg +[npm-url]: https://npmjs.org/package/buffer +[downloads-image]: https://img.shields.io/npm/dm/buffer.svg +[downloads-url]: https://npmjs.org/package/buffer +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com + +#### The buffer module from [node.js](https://nodejs.org/), for the browser. + +[![saucelabs][saucelabs-image]][saucelabs-url] + +[saucelabs-image]: https://saucelabs.com/browser-matrix/buffer.svg +[saucelabs-url]: https://saucelabs.com/u/buffer + +With [browserify](http://browserify.org), simply `require('buffer')` or use the `Buffer` global and you will get this module. + +The goal is to provide an API that is 100% identical to +[node's Buffer API](https://nodejs.org/api/buffer.html). Read the +[official docs](https://nodejs.org/api/buffer.html) for the full list of properties, +instance methods, and class methods that are supported. + +## features + +- Manipulate binary data like a boss, in all browsers! +- Super fast. Backed by Typed Arrays (`Uint8Array`/`ArrayBuffer`, not `Object`) +- Extremely small bundle size (**6.75KB minified + gzipped**, 51.9KB with comments) +- Excellent browser support (Chrome, Firefox, Edge, Safari 9+, IE 11, iOS 9+, Android, etc.) +- Preserves Node API exactly, with one minor difference (see below) +- Square-bracket `buf[4]` notation works! +- Does not modify any browser prototypes or put anything on `window` +- Comprehensive test suite (including all buffer tests from node.js core) + +## install + +To use this module directly (without browserify), install it: + +```bash +npm install buffer +``` + +This module was previously called **native-buffer-browserify**, but please use **buffer** +from now on. + +If you do not use a bundler, you can use the [standalone script](https://bundle.run/buffer). + +## usage + +The module's API is identical to node's `Buffer` API. Read the +[official docs](https://nodejs.org/api/buffer.html) for the full list of properties, +instance methods, and class methods that are supported. + +As mentioned above, `require('buffer')` or use the `Buffer` global with +[browserify](http://browserify.org) and this module will automatically be included +in your bundle. Almost any npm module will work in the browser, even if it assumes that +the node `Buffer` API will be available. + +To depend on this module explicitly (without browserify), require it like this: + +```js +var Buffer = require('buffer/').Buffer // note: the trailing slash is important! +``` + +To require this module explicitly, use `require('buffer/')` which tells the node.js module +lookup algorithm (also used by browserify) to use the **npm module** named `buffer` +instead of the **node.js core** module named `buffer`! + + +## how does it work? + +The Buffer constructor returns instances of `Uint8Array` that have their prototype +changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of `Uint8Array`, +so the returned instances will have all the node `Buffer` methods and the +`Uint8Array` methods. Square bracket notation works as expected -- it returns a +single octet. + +The `Uint8Array` prototype remains unmodified. + + +## tracking the latest node api + +This module tracks the Buffer API in the latest (unstable) version of node.js. The Buffer +API is considered **stable** in the +[node stability index](https://nodejs.org/docs/latest/api/documentation.html#documentation_stability_index), +so it is unlikely that there will ever be breaking changes. +Nonetheless, when/if the Buffer API changes in node, this module's API will change +accordingly. + +## related packages + +- [`buffer-reverse`](https://www.npmjs.com/package/buffer-reverse) - Reverse a buffer +- [`buffer-xor`](https://www.npmjs.com/package/buffer-xor) - Bitwise xor a buffer +- [`is-buffer`](https://www.npmjs.com/package/is-buffer) - Determine if an object is a Buffer without including the whole `Buffer` package + +## conversion packages + +### convert typed array to buffer + +Use [`typedarray-to-buffer`](https://www.npmjs.com/package/typedarray-to-buffer) to convert any kind of typed array to a `Buffer`. Does not perform a copy, so it's super fast. + +### convert buffer to typed array + +`Buffer` is a subclass of `Uint8Array` (which is a typed array). So there is no need to explicitly convert to typed array. Just use the buffer as a `Uint8Array`. + +### convert blob to buffer + +Use [`blob-to-buffer`](https://www.npmjs.com/package/blob-to-buffer) to convert a `Blob` to a `Buffer`. + +### convert buffer to blob + +To convert a `Buffer` to a `Blob`, use the `Blob` constructor: + +```js +var blob = new Blob([ buffer ]) +``` + +Optionally, specify a mimetype: + +```js +var blob = new Blob([ buffer ], { type: 'text/html' }) +``` + +### convert arraybuffer to buffer + +To convert an `ArrayBuffer` to a `Buffer`, use the `Buffer.from` function. Does not perform a copy, so it's super fast. + +```js +var buffer = Buffer.from(arrayBuffer) +``` + +### convert buffer to arraybuffer + +To convert a `Buffer` to an `ArrayBuffer`, use the `.buffer` property (which is present on all `Uint8Array` objects): + +```js +var arrayBuffer = buffer.buffer.slice( + buffer.byteOffset, buffer.byteOffset + buffer.byteLength +) +``` + +Alternatively, use the [`to-arraybuffer`](https://www.npmjs.com/package/to-arraybuffer) module. + +## performance + +See perf tests in `/perf`. + +`BrowserBuffer` is the browser `buffer` module (this repo). `Uint8Array` is included as a +sanity check (since `BrowserBuffer` uses `Uint8Array` under the hood, `Uint8Array` will +always be at least a bit faster). Finally, `NodeBuffer` is the node.js buffer module, +which is included to compare against. + +NOTE: Performance has improved since these benchmarks were taken. PR welcome to update the README. + +### Chrome 38 + +| Method | Operations | Accuracy | Sampled | Fastest | +|:-------|:-----------|:---------|:--------|:-------:| +| BrowserBuffer#bracket-notation | 11,457,464 ops/sec | ±0.86% | 66 | ✓ | +| Uint8Array#bracket-notation | 10,824,332 ops/sec | ±0.74% | 65 | | +| | | | | +| BrowserBuffer#concat | 450,532 ops/sec | ±0.76% | 68 | | +| Uint8Array#concat | 1,368,911 ops/sec | ±1.50% | 62 | ✓ | +| | | | | +| BrowserBuffer#copy(16000) | 903,001 ops/sec | ±0.96% | 67 | | +| Uint8Array#copy(16000) | 1,422,441 ops/sec | ±1.04% | 66 | ✓ | +| | | | | +| BrowserBuffer#copy(16) | 11,431,358 ops/sec | ±0.46% | 69 | | +| Uint8Array#copy(16) | 13,944,163 ops/sec | ±1.12% | 68 | ✓ | +| | | | | +| BrowserBuffer#new(16000) | 106,329 ops/sec | ±6.70% | 44 | | +| Uint8Array#new(16000) | 131,001 ops/sec | ±2.85% | 31 | ✓ | +| | | | | +| BrowserBuffer#new(16) | 1,554,491 ops/sec | ±1.60% | 65 | | +| Uint8Array#new(16) | 6,623,930 ops/sec | ±1.66% | 65 | ✓ | +| | | | | +| BrowserBuffer#readDoubleBE | 112,830 ops/sec | ±0.51% | 69 | ✓ | +| DataView#getFloat64 | 93,500 ops/sec | ±0.57% | 68 | | +| | | | | +| BrowserBuffer#readFloatBE | 146,678 ops/sec | ±0.95% | 68 | ✓ | +| DataView#getFloat32 | 99,311 ops/sec | ±0.41% | 67 | | +| | | | | +| BrowserBuffer#readUInt32LE | 843,214 ops/sec | ±0.70% | 69 | ✓ | +| DataView#getUint32 | 103,024 ops/sec | ±0.64% | 67 | | +| | | | | +| BrowserBuffer#slice | 1,013,941 ops/sec | ±0.75% | 67 | | +| Uint8Array#subarray | 1,903,928 ops/sec | ±0.53% | 67 | ✓ | +| | | | | +| BrowserBuffer#writeFloatBE | 61,387 ops/sec | ±0.90% | 67 | | +| DataView#setFloat32 | 141,249 ops/sec | ±0.40% | 66 | ✓ | + + +### Firefox 33 + +| Method | Operations | Accuracy | Sampled | Fastest | +|:-------|:-----------|:---------|:--------|:-------:| +| BrowserBuffer#bracket-notation | 20,800,421 ops/sec | ±1.84% | 60 | | +| Uint8Array#bracket-notation | 20,826,235 ops/sec | ±2.02% | 61 | ✓ | +| | | | | +| BrowserBuffer#concat | 153,076 ops/sec | ±2.32% | 61 | | +| Uint8Array#concat | 1,255,674 ops/sec | ±8.65% | 52 | ✓ | +| | | | | +| BrowserBuffer#copy(16000) | 1,105,312 ops/sec | ±1.16% | 63 | | +| Uint8Array#copy(16000) | 1,615,911 ops/sec | ±0.55% | 66 | ✓ | +| | | | | +| BrowserBuffer#copy(16) | 16,357,599 ops/sec | ±0.73% | 68 | | +| Uint8Array#copy(16) | 31,436,281 ops/sec | ±1.05% | 68 | ✓ | +| | | | | +| BrowserBuffer#new(16000) | 52,995 ops/sec | ±6.01% | 35 | | +| Uint8Array#new(16000) | 87,686 ops/sec | ±5.68% | 45 | ✓ | +| | | | | +| BrowserBuffer#new(16) | 252,031 ops/sec | ±1.61% | 66 | | +| Uint8Array#new(16) | 8,477,026 ops/sec | ±0.49% | 68 | ✓ | +| | | | | +| BrowserBuffer#readDoubleBE | 99,871 ops/sec | ±0.41% | 69 | | +| DataView#getFloat64 | 285,663 ops/sec | ±0.70% | 68 | ✓ | +| | | | | +| BrowserBuffer#readFloatBE | 115,540 ops/sec | ±0.42% | 69 | | +| DataView#getFloat32 | 288,722 ops/sec | ±0.82% | 68 | ✓ | +| | | | | +| BrowserBuffer#readUInt32LE | 633,926 ops/sec | ±1.08% | 67 | ✓ | +| DataView#getUint32 | 294,808 ops/sec | ±0.79% | 64 | | +| | | | | +| BrowserBuffer#slice | 349,425 ops/sec | ±0.46% | 69 | | +| Uint8Array#subarray | 5,965,819 ops/sec | ±0.60% | 65 | ✓ | +| | | | | +| BrowserBuffer#writeFloatBE | 59,980 ops/sec | ±0.41% | 67 | | +| DataView#setFloat32 | 317,634 ops/sec | ±0.63% | 68 | ✓ | + +### Safari 8 + +| Method | Operations | Accuracy | Sampled | Fastest | +|:-------|:-----------|:---------|:--------|:-------:| +| BrowserBuffer#bracket-notation | 10,279,729 ops/sec | ±2.25% | 56 | ✓ | +| Uint8Array#bracket-notation | 10,030,767 ops/sec | ±2.23% | 59 | | +| | | | | +| BrowserBuffer#concat | 144,138 ops/sec | ±1.38% | 65 | | +| Uint8Array#concat | 4,950,764 ops/sec | ±1.70% | 63 | ✓ | +| | | | | +| BrowserBuffer#copy(16000) | 1,058,548 ops/sec | ±1.51% | 64 | | +| Uint8Array#copy(16000) | 1,409,666 ops/sec | ±1.17% | 65 | ✓ | +| | | | | +| BrowserBuffer#copy(16) | 6,282,529 ops/sec | ±1.88% | 58 | | +| Uint8Array#copy(16) | 11,907,128 ops/sec | ±2.87% | 58 | ✓ | +| | | | | +| BrowserBuffer#new(16000) | 101,663 ops/sec | ±3.89% | 57 | | +| Uint8Array#new(16000) | 22,050,818 ops/sec | ±6.51% | 46 | ✓ | +| | | | | +| BrowserBuffer#new(16) | 176,072 ops/sec | ±2.13% | 64 | | +| Uint8Array#new(16) | 24,385,731 ops/sec | ±5.01% | 51 | ✓ | +| | | | | +| BrowserBuffer#readDoubleBE | 41,341 ops/sec | ±1.06% | 67 | | +| DataView#getFloat64 | 322,280 ops/sec | ±0.84% | 68 | ✓ | +| | | | | +| BrowserBuffer#readFloatBE | 46,141 ops/sec | ±1.06% | 65 | | +| DataView#getFloat32 | 337,025 ops/sec | ±0.43% | 69 | ✓ | +| | | | | +| BrowserBuffer#readUInt32LE | 151,551 ops/sec | ±1.02% | 66 | | +| DataView#getUint32 | 308,278 ops/sec | ±0.94% | 67 | ✓ | +| | | | | +| BrowserBuffer#slice | 197,365 ops/sec | ±0.95% | 66 | | +| Uint8Array#subarray | 9,558,024 ops/sec | ±3.08% | 58 | ✓ | +| | | | | +| BrowserBuffer#writeFloatBE | 17,518 ops/sec | ±1.03% | 63 | | +| DataView#setFloat32 | 319,751 ops/sec | ±0.48% | 68 | ✓ | + + +### Node 0.11.14 + +| Method | Operations | Accuracy | Sampled | Fastest | +|:-------|:-----------|:---------|:--------|:-------:| +| BrowserBuffer#bracket-notation | 10,489,828 ops/sec | ±3.25% | 90 | | +| Uint8Array#bracket-notation | 10,534,884 ops/sec | ±0.81% | 92 | ✓ | +| NodeBuffer#bracket-notation | 10,389,910 ops/sec | ±0.97% | 87 | | +| | | | | +| BrowserBuffer#concat | 487,830 ops/sec | ±2.58% | 88 | | +| Uint8Array#concat | 1,814,327 ops/sec | ±1.28% | 88 | ✓ | +| NodeBuffer#concat | 1,636,523 ops/sec | ±1.88% | 73 | | +| | | | | +| BrowserBuffer#copy(16000) | 1,073,665 ops/sec | ±0.77% | 90 | | +| Uint8Array#copy(16000) | 1,348,517 ops/sec | ±0.84% | 89 | ✓ | +| NodeBuffer#copy(16000) | 1,289,533 ops/sec | ±0.82% | 93 | | +| | | | | +| BrowserBuffer#copy(16) | 12,782,706 ops/sec | ±0.74% | 85 | | +| Uint8Array#copy(16) | 14,180,427 ops/sec | ±0.93% | 92 | ✓ | +| NodeBuffer#copy(16) | 11,083,134 ops/sec | ±1.06% | 89 | | +| | | | | +| BrowserBuffer#new(16000) | 141,678 ops/sec | ±3.30% | 67 | | +| Uint8Array#new(16000) | 161,491 ops/sec | ±2.96% | 60 | | +| NodeBuffer#new(16000) | 292,699 ops/sec | ±3.20% | 55 | ✓ | +| | | | | +| BrowserBuffer#new(16) | 1,655,466 ops/sec | ±2.41% | 82 | | +| Uint8Array#new(16) | 14,399,926 ops/sec | ±0.91% | 94 | ✓ | +| NodeBuffer#new(16) | 3,894,696 ops/sec | ±0.88% | 92 | | +| | | | | +| BrowserBuffer#readDoubleBE | 109,582 ops/sec | ±0.75% | 93 | ✓ | +| DataView#getFloat64 | 91,235 ops/sec | ±0.81% | 90 | | +| NodeBuffer#readDoubleBE | 88,593 ops/sec | ±0.96% | 81 | | +| | | | | +| BrowserBuffer#readFloatBE | 139,854 ops/sec | ±1.03% | 85 | ✓ | +| DataView#getFloat32 | 98,744 ops/sec | ±0.80% | 89 | | +| NodeBuffer#readFloatBE | 92,769 ops/sec | ±0.94% | 93 | | +| | | | | +| BrowserBuffer#readUInt32LE | 710,861 ops/sec | ±0.82% | 92 | | +| DataView#getUint32 | 117,893 ops/sec | ±0.84% | 91 | | +| NodeBuffer#readUInt32LE | 851,412 ops/sec | ±0.72% | 93 | ✓ | +| | | | | +| BrowserBuffer#slice | 1,673,877 ops/sec | ±0.73% | 94 | | +| Uint8Array#subarray | 6,919,243 ops/sec | ±0.67% | 90 | ✓ | +| NodeBuffer#slice | 4,617,604 ops/sec | ±0.79% | 93 | | +| | | | | +| BrowserBuffer#writeFloatBE | 66,011 ops/sec | ±0.75% | 93 | | +| DataView#setFloat32 | 127,760 ops/sec | ±0.72% | 93 | ✓ | +| NodeBuffer#writeFloatBE | 103,352 ops/sec | ±0.83% | 93 | | + +### iojs 1.8.1 + +| Method | Operations | Accuracy | Sampled | Fastest | +|:-------|:-----------|:---------|:--------|:-------:| +| BrowserBuffer#bracket-notation | 10,990,488 ops/sec | ±1.11% | 91 | | +| Uint8Array#bracket-notation | 11,268,757 ops/sec | ±0.65% | 97 | | +| NodeBuffer#bracket-notation | 11,353,260 ops/sec | ±0.83% | 94 | ✓ | +| | | | | +| BrowserBuffer#concat | 378,954 ops/sec | ±0.74% | 94 | | +| Uint8Array#concat | 1,358,288 ops/sec | ±0.97% | 87 | | +| NodeBuffer#concat | 1,934,050 ops/sec | ±1.11% | 78 | ✓ | +| | | | | +| BrowserBuffer#copy(16000) | 894,538 ops/sec | ±0.56% | 84 | | +| Uint8Array#copy(16000) | 1,442,656 ops/sec | ±0.71% | 96 | | +| NodeBuffer#copy(16000) | 1,457,898 ops/sec | ±0.53% | 92 | ✓ | +| | | | | +| BrowserBuffer#copy(16) | 12,870,457 ops/sec | ±0.67% | 95 | | +| Uint8Array#copy(16) | 16,643,989 ops/sec | ±0.61% | 93 | ✓ | +| NodeBuffer#copy(16) | 14,885,848 ops/sec | ±0.74% | 94 | | +| | | | | +| BrowserBuffer#new(16000) | 109,264 ops/sec | ±4.21% | 63 | | +| Uint8Array#new(16000) | 138,916 ops/sec | ±1.87% | 61 | | +| NodeBuffer#new(16000) | 281,449 ops/sec | ±3.58% | 51 | ✓ | +| | | | | +| BrowserBuffer#new(16) | 1,362,935 ops/sec | ±0.56% | 99 | | +| Uint8Array#new(16) | 6,193,090 ops/sec | ±0.64% | 95 | ✓ | +| NodeBuffer#new(16) | 4,745,425 ops/sec | ±1.56% | 90 | | +| | | | | +| BrowserBuffer#readDoubleBE | 118,127 ops/sec | ±0.59% | 93 | ✓ | +| DataView#getFloat64 | 107,332 ops/sec | ±0.65% | 91 | | +| NodeBuffer#readDoubleBE | 116,274 ops/sec | ±0.94% | 95 | | +| | | | | +| BrowserBuffer#readFloatBE | 150,326 ops/sec | ±0.58% | 95 | ✓ | +| DataView#getFloat32 | 110,541 ops/sec | ±0.57% | 98 | | +| NodeBuffer#readFloatBE | 121,599 ops/sec | ±0.60% | 87 | | +| | | | | +| BrowserBuffer#readUInt32LE | 814,147 ops/sec | ±0.62% | 93 | | +| DataView#getUint32 | 137,592 ops/sec | ±0.64% | 90 | | +| NodeBuffer#readUInt32LE | 931,650 ops/sec | ±0.71% | 96 | ✓ | +| | | | | +| BrowserBuffer#slice | 878,590 ops/sec | ±0.68% | 93 | | +| Uint8Array#subarray | 2,843,308 ops/sec | ±1.02% | 90 | | +| NodeBuffer#slice | 4,998,316 ops/sec | ±0.68% | 90 | ✓ | +| | | | | +| BrowserBuffer#writeFloatBE | 65,927 ops/sec | ±0.74% | 93 | | +| DataView#setFloat32 | 139,823 ops/sec | ±0.97% | 89 | ✓ | +| NodeBuffer#writeFloatBE | 135,763 ops/sec | ±0.65% | 96 | | +| | | | | + +## Testing the project + +First, install the project: + + npm install + +Then, to run tests in Node.js, run: + + npm run test-node + +To test locally in a browser, you can run: + + npm run test-browser-es5-local # For ES5 browsers that don't support ES6 + npm run test-browser-es6-local # For ES6 compliant browsers + +This will print out a URL that you can then open in a browser to run the tests, using [airtap](https://www.npmjs.com/package/airtap). + +To run automated browser tests using Saucelabs, ensure that your `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables are set, then run: + + npm test + +This is what's run in Travis, to check against various browsers. The list of browsers is kept in the `bin/airtap-es5.yml` and `bin/airtap-es6.yml` files. + +## JavaScript Standard Style + +This module uses [JavaScript Standard Style](https://github.com/feross/standard). + +[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) + +To test that the code conforms to the style, `npm install` and run: + + ./node_modules/.bin/standard + +## credit + +This was originally forked from [buffer-browserify](https://github.com/toots/buffer-browserify). + +## Security Policies and Procedures + +The `buffer` team and community take all security bugs in `buffer` seriously. Please see our [security policies and procedures](https://github.com/feross/security) document to learn how to report issues. + +## license + +MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org), and other contributors. Originally forked from an MIT-licensed module by Romain Beauxis. diff --git a/server/node_modules/buffer/index.d.ts b/server/node_modules/buffer/index.d.ts new file mode 100644 index 0000000..5d1a804 --- /dev/null +++ b/server/node_modules/buffer/index.d.ts @@ -0,0 +1,186 @@ +export class Buffer extends Uint8Array { + length: number + write(string: string, offset?: number, length?: number, encoding?: string): number; + toString(encoding?: string, start?: number, end?: number): string; + toJSON(): { type: 'Buffer', data: any[] }; + equals(otherBuffer: Buffer): boolean; + compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number; + copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + slice(start?: number, end?: number): Buffer; + writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readUInt8(offset: number, noAssert?: boolean): number; + readUInt16LE(offset: number, noAssert?: boolean): number; + readUInt16BE(offset: number, noAssert?: boolean): number; + readUInt32LE(offset: number, noAssert?: boolean): number; + readUInt32BE(offset: number, noAssert?: boolean): number; + readInt8(offset: number, noAssert?: boolean): number; + readInt16LE(offset: number, noAssert?: boolean): number; + readInt16BE(offset: number, noAssert?: boolean): number; + readInt32LE(offset: number, noAssert?: boolean): number; + readInt32BE(offset: number, noAssert?: boolean): number; + readFloatLE(offset: number, noAssert?: boolean): number; + readFloatBE(offset: number, noAssert?: boolean): number; + readDoubleLE(offset: number, noAssert?: boolean): number; + readDoubleBE(offset: number, noAssert?: boolean): number; + reverse(): this; + swap16(): Buffer; + swap32(): Buffer; + swap64(): Buffer; + writeUInt8(value: number, offset: number, noAssert?: boolean): number; + writeUInt16LE(value: number, offset: number, noAssert?: boolean): number; + writeUInt16BE(value: number, offset: number, noAssert?: boolean): number; + writeUInt32LE(value: number, offset: number, noAssert?: boolean): number; + writeUInt32BE(value: number, offset: number, noAssert?: boolean): number; + writeInt8(value: number, offset: number, noAssert?: boolean): number; + writeInt16LE(value: number, offset: number, noAssert?: boolean): number; + writeInt16BE(value: number, offset: number, noAssert?: boolean): number; + writeInt32LE(value: number, offset: number, noAssert?: boolean): number; + writeInt32BE(value: number, offset: number, noAssert?: boolean): number; + writeFloatLE(value: number, offset: number, noAssert?: boolean): number; + writeFloatBE(value: number, offset: number, noAssert?: boolean): number; + writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; + writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; + fill(value: any, offset?: number, end?: number): this; + indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; + lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; + includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean; + + /** + * Allocates a new buffer containing the given {str}. + * + * @param str String to store in buffer. + * @param encoding encoding to use, optional. Default is 'utf8' + */ + constructor (str: string, encoding?: string); + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + */ + constructor (size: number); + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + constructor (array: Uint8Array); + /** + * Produces a Buffer backed by the same allocated memory as + * the given {ArrayBuffer}. + * + * + * @param arrayBuffer The ArrayBuffer with which to share memory. + */ + constructor (arrayBuffer: ArrayBuffer); + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + constructor (array: any[]); + /** + * Copies the passed {buffer} data onto a new {Buffer} instance. + * + * @param buffer The buffer to copy. + */ + constructor (buffer: Buffer); + prototype: Buffer; + /** + * Allocates a new Buffer using an {array} of octets. + * + * @param array + */ + static from(array: any[]): Buffer; + /** + * When passed a reference to the .buffer property of a TypedArray instance, + * the newly created Buffer will share the same allocated memory as the TypedArray. + * The optional {byteOffset} and {length} arguments specify a memory range + * within the {arrayBuffer} that will be shared by the Buffer. + * + * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer() + * @param byteOffset + * @param length + */ + static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer; + /** + * Copies the passed {buffer} data onto a new Buffer instance. + * + * @param buffer + */ + static from(buffer: Buffer | Uint8Array): Buffer; + /** + * Creates a new Buffer containing the given JavaScript string {str}. + * If provided, the {encoding} parameter identifies the character encoding. + * If not provided, {encoding} defaults to 'utf8'. + * + * @param str + */ + static from(str: string, encoding?: string): Buffer; + /** + * Returns true if {obj} is a Buffer + * + * @param obj object to test. + */ + static isBuffer(obj: any): obj is Buffer; + /** + * Returns true if {encoding} is a valid encoding argument. + * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' + * + * @param encoding string to test. + */ + static isEncoding(encoding: string): boolean; + /** + * Gives the actual byte length of a string. encoding defaults to 'utf8'. + * This is not the same as String.prototype.length since that returns the number of characters in a string. + * + * @param string string to test. + * @param encoding encoding used to evaluate (defaults to 'utf8') + */ + static byteLength(string: string, encoding?: string): number; + /** + * Returns a buffer which is the result of concatenating all the buffers in the list together. + * + * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. + * If the list has exactly one item, then the first item of the list is returned. + * If the list has more than one item, then a new Buffer is created. + * + * @param list An array of Buffer objects to concatenate + * @param totalLength Total length of the buffers when concatenated. + * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. + */ + static concat(list: Buffer[], totalLength?: number): Buffer; + /** + * The same as buf1.compare(buf2). + */ + static compare(buf1: Buffer, buf2: Buffer): number; + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + * @param fill if specified, buffer will be initialized by calling buf.fill(fill). + * If parameter is omitted, buffer will be filled with zeros. + * @param encoding encoding used for call to buf.fill while initializing + */ + static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer; + /** + * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents + * of the newly created Buffer are unknown and may contain sensitive data. + * + * @param size count of octets to allocate + */ + static allocUnsafe(size: number): Buffer; + /** + * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents + * of the newly created Buffer are unknown and may contain sensitive data. + * + * @param size count of octets to allocate + */ + static allocUnsafeSlow(size: number): Buffer; +} diff --git a/server/node_modules/buffer/index.js b/server/node_modules/buffer/index.js new file mode 100644 index 0000000..609cf31 --- /dev/null +++ b/server/node_modules/buffer/index.js @@ -0,0 +1,1817 @@ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ + +'use strict' + +var base64 = require('base64-js') +var ieee754 = require('ieee754') +var customInspectSymbol = + (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation + ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation + : null + +exports.Buffer = Buffer +exports.SlowBuffer = SlowBuffer +exports.INSPECT_MAX_BYTES = 50 + +var K_MAX_LENGTH = 0x7fffffff +exports.kMaxLength = K_MAX_LENGTH + +/** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Print warning and recommend using `buffer` v4.x which has an Object + * implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * We report that the browser does not support typed arrays if the are not subclassable + * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` + * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support + * for __proto__ and has a buggy typed array implementation. + */ +Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() + +if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && + typeof console.error === 'function') { + console.error( + 'This browser lacks typed array (Uint8Array) support which is required by ' + + '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' + ) +} + +function typedArraySupport () { + // Can typed array instances can be augmented? + try { + var arr = new Uint8Array(1) + var proto = { foo: function () { return 42 } } + Object.setPrototypeOf(proto, Uint8Array.prototype) + Object.setPrototypeOf(arr, proto) + return arr.foo() === 42 + } catch (e) { + return false + } +} + +Object.defineProperty(Buffer.prototype, 'parent', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.buffer + } +}) + +Object.defineProperty(Buffer.prototype, 'offset', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.byteOffset + } +}) + +function createBuffer (length) { + if (length > K_MAX_LENGTH) { + throw new RangeError('The value "' + length + '" is invalid for option "size"') + } + // Return an augmented `Uint8Array` instance + var buf = new Uint8Array(length) + Object.setPrototypeOf(buf, Buffer.prototype) + return buf +} + +/** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ + +function Buffer (arg, encodingOrOffset, length) { + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new TypeError( + 'The "string" argument must be of type string. Received type number' + ) + } + return allocUnsafe(arg) + } + return from(arg, encodingOrOffset, length) +} + +Buffer.poolSize = 8192 // not used by this implementation + +function from (value, encodingOrOffset, length) { + if (typeof value === 'string') { + return fromString(value, encodingOrOffset) + } + + if (ArrayBuffer.isView(value)) { + return fromArrayView(value) + } + + if (value == null) { + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) + } + + if (isInstance(value, ArrayBuffer) || + (value && isInstance(value.buffer, ArrayBuffer))) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof SharedArrayBuffer !== 'undefined' && + (isInstance(value, SharedArrayBuffer) || + (value && isInstance(value.buffer, SharedArrayBuffer)))) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof value === 'number') { + throw new TypeError( + 'The "value" argument must not be of type number. Received type number' + ) + } + + var valueOf = value.valueOf && value.valueOf() + if (valueOf != null && valueOf !== value) { + return Buffer.from(valueOf, encodingOrOffset, length) + } + + var b = fromObject(value) + if (b) return b + + if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && + typeof value[Symbol.toPrimitive] === 'function') { + return Buffer.from( + value[Symbol.toPrimitive]('string'), encodingOrOffset, length + ) + } + + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) +} + +/** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ +Buffer.from = function (value, encodingOrOffset, length) { + return from(value, encodingOrOffset, length) +} + +// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: +// https://github.com/feross/buffer/pull/148 +Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype) +Object.setPrototypeOf(Buffer, Uint8Array) + +function assertSize (size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be of type number') + } else if (size < 0) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } +} + +function alloc (size, fill, encoding) { + assertSize(size) + if (size <= 0) { + return createBuffer(size) + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpreted as a start offset. + return typeof encoding === 'string' + ? createBuffer(size).fill(fill, encoding) + : createBuffer(size).fill(fill) + } + return createBuffer(size) +} + +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(size, fill, encoding) +} + +function allocUnsafe (size) { + assertSize(size) + return createBuffer(size < 0 ? 0 : checked(size) | 0) +} + +/** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ +Buffer.allocUnsafe = function (size) { + return allocUnsafe(size) +} +/** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ +Buffer.allocUnsafeSlow = function (size) { + return allocUnsafe(size) +} + +function fromString (string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + + var length = byteLength(string, encoding) | 0 + var buf = createBuffer(length) + + var actual = buf.write(string, encoding) + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + buf = buf.slice(0, actual) + } + + return buf +} + +function fromArrayLike (array) { + var length = array.length < 0 ? 0 : checked(array.length) | 0 + var buf = createBuffer(length) + for (var i = 0; i < length; i += 1) { + buf[i] = array[i] & 255 + } + return buf +} + +function fromArrayView (arrayView) { + if (isInstance(arrayView, Uint8Array)) { + var copy = new Uint8Array(arrayView) + return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength) + } + return fromArrayLike(arrayView) +} + +function fromArrayBuffer (array, byteOffset, length) { + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('"offset" is outside of buffer bounds') + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('"length" is outside of buffer bounds') + } + + var buf + if (byteOffset === undefined && length === undefined) { + buf = new Uint8Array(array) + } else if (length === undefined) { + buf = new Uint8Array(array, byteOffset) + } else { + buf = new Uint8Array(array, byteOffset, length) + } + + // Return an augmented `Uint8Array` instance + Object.setPrototypeOf(buf, Buffer.prototype) + + return buf +} + +function fromObject (obj) { + if (Buffer.isBuffer(obj)) { + var len = checked(obj.length) | 0 + var buf = createBuffer(len) + + if (buf.length === 0) { + return buf + } + + obj.copy(buf, 0, 0, len) + return buf + } + + if (obj.length !== undefined) { + if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { + return createBuffer(0) + } + return fromArrayLike(obj) + } + + if (obj.type === 'Buffer' && Array.isArray(obj.data)) { + return fromArrayLike(obj.data) + } +} + +function checked (length) { + // Note: cannot use `length < K_MAX_LENGTH` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= K_MAX_LENGTH) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') + } + return length | 0 +} + +function SlowBuffer (length) { + if (+length != length) { // eslint-disable-line eqeqeq + length = 0 + } + return Buffer.alloc(+length) +} + +Buffer.isBuffer = function isBuffer (b) { + return b != null && b._isBuffer === true && + b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false +} + +Buffer.compare = function compare (a, b) { + if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) + if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError( + 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' + ) + } + + if (a === b) return 0 + + var x = a.length + var y = b.length + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i] + y = b[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +Buffer.isEncoding = function isEncoding (encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'latin1': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true + default: + return false + } +} + +Buffer.concat = function concat (list, length) { + if (!Array.isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + + if (list.length === 0) { + return Buffer.alloc(0) + } + + var i + if (length === undefined) { + length = 0 + for (i = 0; i < list.length; ++i) { + length += list[i].length + } + } + + var buffer = Buffer.allocUnsafe(length) + var pos = 0 + for (i = 0; i < list.length; ++i) { + var buf = list[i] + if (isInstance(buf, Uint8Array)) { + if (pos + buf.length > buffer.length) { + Buffer.from(buf).copy(buffer, pos) + } else { + Uint8Array.prototype.set.call( + buffer, + buf, + pos + ) + } + } else if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } else { + buf.copy(buffer, pos) + } + pos += buf.length + } + return buffer +} + +function byteLength (string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length + } + if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + throw new TypeError( + 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + + 'Received type ' + typeof string + ) + } + + var len = string.length + var mustMatch = (arguments.length > 2 && arguments[2] === true) + if (!mustMatch && len === 0) return 0 + + // Use a for loop to avoid recursion + var loweredCase = false + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len + case 'utf8': + case 'utf-8': + return utf8ToBytes(string).length + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2 + case 'hex': + return len >>> 1 + case 'base64': + return base64ToBytes(string).length + default: + if (loweredCase) { + return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 + } + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} +Buffer.byteLength = byteLength + +function slowToString (encoding, start, end) { + var loweredCase = false + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0 + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return '' + } + + if (end === undefined || end > this.length) { + end = this.length + } + + if (end <= 0) { + return '' + } + + // Force coercion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0 + start >>>= 0 + + if (end <= start) { + return '' + } + + if (!encoding) encoding = 'utf8' + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end) + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end) + + case 'ascii': + return asciiSlice(this, start, end) + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end) + + case 'base64': + return base64Slice(this, start, end) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = (encoding + '').toLowerCase() + loweredCase = true + } + } +} + +// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) +// to detect a Buffer instance. It's not possible to use `instanceof Buffer` +// reliably in a browserify context because there could be multiple different +// copies of the 'buffer' package in use. This method works even for Buffer +// instances that were created from another copy of the `buffer` package. +// See: https://github.com/feross/buffer/issues/154 +Buffer.prototype._isBuffer = true + +function swap (b, n, m) { + var i = b[n] + b[n] = b[m] + b[m] = i +} + +Buffer.prototype.swap16 = function swap16 () { + var len = this.length + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits') + } + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1) + } + return this +} + +Buffer.prototype.swap32 = function swap32 () { + var len = this.length + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits') + } + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3) + swap(this, i + 1, i + 2) + } + return this +} + +Buffer.prototype.swap64 = function swap64 () { + var len = this.length + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits') + } + for (var i = 0; i < len; i += 8) { + swap(this, i, i + 7) + swap(this, i + 1, i + 6) + swap(this, i + 2, i + 5) + swap(this, i + 3, i + 4) + } + return this +} + +Buffer.prototype.toString = function toString () { + var length = this.length + if (length === 0) return '' + if (arguments.length === 0) return utf8Slice(this, 0, length) + return slowToString.apply(this, arguments) +} + +Buffer.prototype.toLocaleString = Buffer.prototype.toString + +Buffer.prototype.equals = function equals (b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') + if (this === b) return true + return Buffer.compare(this, b) === 0 +} + +Buffer.prototype.inspect = function inspect () { + var str = '' + var max = exports.INSPECT_MAX_BYTES + str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() + if (this.length > max) str += ' ... ' + return '' +} +if (customInspectSymbol) { + Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect +} + +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (isInstance(target, Uint8Array)) { + target = Buffer.from(target, target.offset, target.byteLength) + } + if (!Buffer.isBuffer(target)) { + throw new TypeError( + 'The "target" argument must be one of type Buffer or Uint8Array. ' + + 'Received type ' + (typeof target) + ) + } + + if (start === undefined) { + start = 0 + } + if (end === undefined) { + end = target ? target.length : 0 + } + if (thisStart === undefined) { + thisStart = 0 + } + if (thisEnd === undefined) { + thisEnd = this.length + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') + } + + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 + } + + start >>>= 0 + end >>>= 0 + thisStart >>>= 0 + thisEnd >>>= 0 + + if (this === target) return 0 + + var x = thisEnd - thisStart + var y = end - start + var len = Math.min(x, y) + + var thisCopy = this.slice(thisStart, thisEnd) + var targetCopy = target.slice(start, end) + + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i] + y = targetCopy[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, +// OR the last index of `val` in `buffer` at offset <= `byteOffset`. +// +// Arguments: +// - buffer - a Buffer to search +// - val - a string, Buffer, or number +// - byteOffset - an index into `buffer`; will be clamped to an int32 +// - encoding - an optional encoding, relevant is val is a string +// - dir - true for indexOf, false for lastIndexOf +function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1 + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset + byteOffset = 0 + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000 + } + byteOffset = +byteOffset // Coerce to Number. + if (numberIsNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : (buffer.length - 1) + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset + if (byteOffset >= buffer.length) { + if (dir) return -1 + else byteOffset = buffer.length - 1 + } else if (byteOffset < 0) { + if (dir) byteOffset = 0 + else return -1 + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding) + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1 + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir) + } else if (typeof val === 'number') { + val = val & 0xFF // Search for a byte value [0-255] + if (typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) + } + } + return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) + } + + throw new TypeError('val must be string, number or Buffer') +} + +function arrayIndexOf (arr, val, byteOffset, encoding, dir) { + var indexSize = 1 + var arrLength = arr.length + var valLength = val.length + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase() + if (encoding === 'ucs2' || encoding === 'ucs-2' || + encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1 + } + indexSize = 2 + arrLength /= 2 + valLength /= 2 + byteOffset /= 2 + } + } + + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } + } + + var i + if (dir) { + var foundIndex = -1 + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize + } else { + if (foundIndex !== -1) i -= i - foundIndex + foundIndex = -1 + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength + for (i = byteOffset; i >= 0; i--) { + var found = true + for (var j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false + break + } + } + if (found) return i + } + } + + return -1 +} + +Buffer.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 +} + +Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +} + +Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +} + +function hexWrite (buf, string, offset, length) { + offset = Number(offset) || 0 + var remaining = buf.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + + var strLen = string.length + + if (length > strLen / 2) { + length = strLen / 2 + } + for (var i = 0; i < length; ++i) { + var parsed = parseInt(string.substr(i * 2, 2), 16) + if (numberIsNaN(parsed)) return i + buf[offset + i] = parsed + } + return i +} + +function utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) +} + +function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) +} + +function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) +} + +function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) +} + +Buffer.prototype.write = function write (string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8' + length = this.length + offset = 0 + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset + length = this.length + offset = 0 + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset >>> 0 + if (isFinite(length)) { + length = length >>> 0 + if (encoding === undefined) encoding = 'utf8' + } else { + encoding = length + length = undefined + } + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' + ) + } + + var remaining = this.length - offset + if (length === undefined || length > remaining) length = remaining + + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') + } + + if (!encoding) encoding = 'utf8' + + var loweredCase = false + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length) + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length) + + case 'ascii': + case 'latin1': + case 'binary': + return asciiWrite(this, string, offset, length) + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} + +Buffer.prototype.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } +} + +function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) + } +} + +function utf8Slice (buf, start, end) { + end = Math.min(buf.length, end) + var res = [] + + var i = start + while (i < end) { + var firstByte = buf[i] + var codePoint = null + var bytesPerSequence = (firstByte > 0xEF) + ? 4 + : (firstByte > 0xDF) + ? 3 + : (firstByte > 0xBF) + ? 2 + : 1 + + if (i + bytesPerSequence <= end) { + var secondByte, thirdByte, fourthByte, tempCodePoint + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte + } + break + case 2: + secondByte = buf[i + 1] + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint + } + } + break + case 3: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint + } + } + break + case 4: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + fourthByte = buf[i + 3] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD + bytesPerSequence = 1 + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000 + res.push(codePoint >>> 10 & 0x3FF | 0xD800) + codePoint = 0xDC00 | codePoint & 0x3FF + } + + res.push(codePoint) + i += bytesPerSequence + } + + return decodeCodePointsArray(res) +} + +// Based on http://stackoverflow.com/a/22747272/680742, the browser with +// the lowest limit is Chrome, with 0x10000 args. +// We go 1 magnitude less, for safety +var MAX_ARGUMENTS_LENGTH = 0x1000 + +function decodeCodePointsArray (codePoints) { + var len = codePoints.length + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + } + + // Decode in chunks to avoid "call stack size exceeded". + var res = '' + var i = 0 + while (i < len) { + res += String.fromCharCode.apply( + String, + codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) + ) + } + return res +} + +function asciiSlice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F) + } + return ret +} + +function latin1Slice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]) + } + return ret +} + +function hexSlice (buf, start, end) { + var len = buf.length + + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len + + var out = '' + for (var i = start; i < end; ++i) { + out += hexSliceLookupTable[buf[i]] + } + return out +} + +function utf16leSlice (buf, start, end) { + var bytes = buf.slice(start, end) + var res = '' + // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) + for (var i = 0; i < bytes.length - 1; i += 2) { + res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) + } + return res +} + +Buffer.prototype.slice = function slice (start, end) { + var len = this.length + start = ~~start + end = end === undefined ? len : ~~end + + if (start < 0) { + start += len + if (start < 0) start = 0 + } else if (start > len) { + start = len + } + + if (end < 0) { + end += len + if (end < 0) end = 0 + } else if (end > len) { + end = len + } + + if (end < start) end = start + + var newBuf = this.subarray(start, end) + // Return an augmented `Uint8Array` instance + Object.setPrototypeOf(newBuf, Buffer.prototype) + + return newBuf +} + +/* + * Need to make sure that buffer isn't trying to write out of bounds. + */ +function checkOffset (offset, ext, length) { + if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') +} + +Buffer.prototype.readUintLE = +Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + + return val +} + +Buffer.prototype.readUintBE = +Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + checkOffset(offset, byteLength, this.length) + } + + var val = this[offset + --byteLength] + var mul = 1 + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul + } + + return val +} + +Buffer.prototype.readUint8 = +Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + return this[offset] +} + +Buffer.prototype.readUint16LE = +Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return this[offset] | (this[offset + 1] << 8) +} + +Buffer.prototype.readUint16BE = +Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return (this[offset] << 8) | this[offset + 1] +} + +Buffer.prototype.readUint32LE = +Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return ((this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16)) + + (this[offset + 3] * 0x1000000) +} + +Buffer.prototype.readUint32BE = +Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] * 0x1000000) + + ((this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3]) +} + +Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var i = byteLength + var mul = 1 + var val = this[offset + --i] + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + if (!(this[offset] & 0x80)) return (this[offset]) + return ((0xff - this[offset] + 1) * -1) +} + +Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + var val = this[offset] | (this[offset + 1] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + var val = this[offset + 1] | (this[offset] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) +} + +Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + (this[offset + 3]) +} + +Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, true, 23, 4) +} + +Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, false, 23, 4) +} + +Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, true, 52, 8) +} + +Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, false, 52, 8) +} + +function checkInt (buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') + if (offset + ext > buf.length) throw new RangeError('Index out of range') +} + +Buffer.prototype.writeUintLE = +Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + var mul = 1 + var i = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUintBE = +Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + var i = byteLength - 1 + var mul = 1 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUint8 = +Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeUint16LE = +Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + return offset + 2 +} + +Buffer.prototype.writeUint16BE = +Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + return offset + 2 +} + +Buffer.prototype.writeUint32LE = +Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + this[offset + 3] = (value >>> 24) + this[offset + 2] = (value >>> 16) + this[offset + 1] = (value >>> 8) + this[offset] = (value & 0xff) + return offset + 4 +} + +Buffer.prototype.writeUint32BE = +Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + return offset + 4 +} + +Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + var limit = Math.pow(2, (8 * byteLength) - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + var i = 0 + var mul = 1 + var sub = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + var limit = Math.pow(2, (8 * byteLength) - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + var i = byteLength - 1 + var mul = 1 + var sub = 0 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) + if (value < 0) value = 0xff + value + 1 + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + return offset + 2 +} + +Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + return offset + 2 +} + +Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + this[offset + 2] = (value >>> 16) + this[offset + 3] = (value >>> 24) + return offset + 4 +} + +Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (value < 0) value = 0xffffffff + value + 1 + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + return offset + 4 +} + +function checkIEEE754 (buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range') + if (offset < 0) throw new RangeError('Index out of range') +} + +function writeFloat (buf, value, offset, littleEndian, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) + } + ieee754.write(buf, value, offset, littleEndian, 23, 4) + return offset + 4 +} + +Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert) +} + +function writeDouble (buf, value, offset, littleEndian, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) + } + ieee754.write(buf, value, offset, littleEndian, 52, 8) + return offset + 8 +} + +Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert) +} + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function copy (target, targetStart, start, end) { + if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') + if (!start) start = 0 + if (!end && end !== 0) end = this.length + if (targetStart >= target.length) targetStart = target.length + if (!targetStart) targetStart = 0 + if (end > 0 && end < start) end = start + + // Copy 0 bytes; we're done + if (end === start) return 0 + if (target.length === 0 || this.length === 0) return 0 + + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds') + } + if (start < 0 || start >= this.length) throw new RangeError('Index out of range') + if (end < 0) throw new RangeError('sourceEnd out of bounds') + + // Are we oob? + if (end > this.length) end = this.length + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start + } + + var len = end - start + + if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { + // Use built-in when available, missing from IE11 + this.copyWithin(targetStart, start, end) + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, end), + targetStart + ) + } + + return len +} + +// Usage: +// buffer.fill(number[, offset[, end]]) +// buffer.fill(buffer[, offset[, end]]) +// buffer.fill(string[, offset[, end]][, encoding]) +Buffer.prototype.fill = function fill (val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start + start = 0 + end = this.length + } else if (typeof end === 'string') { + encoding = end + end = this.length + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string') + } + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + if (val.length === 1) { + var code = val.charCodeAt(0) + if ((encoding === 'utf8' && code < 128) || + encoding === 'latin1') { + // Fast path: If `val` fits into a single byte, use that numeric value. + val = code + } + } + } else if (typeof val === 'number') { + val = val & 255 + } else if (typeof val === 'boolean') { + val = Number(val) + } + + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index') + } + + if (end <= start) { + return this + } + + start = start >>> 0 + end = end === undefined ? this.length : end >>> 0 + + if (!val) val = 0 + + var i + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val + } + } else { + var bytes = Buffer.isBuffer(val) + ? val + : Buffer.from(val, encoding) + var len = bytes.length + if (len === 0) { + throw new TypeError('The value "' + val + + '" is invalid for argument "value"') + } + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len] + } + } + + return this +} + +// HELPER FUNCTIONS +// ================ + +var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g + +function base64clean (str) { + // Node takes equal signs as end of the Base64 encoding + str = str.split('=')[0] + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = str.trim().replace(INVALID_BASE64_RE, '') + // Node converts strings with length < 2 to '' + if (str.length < 2) return '' + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '=' + } + return str +} + +function utf8ToBytes (string, units) { + units = units || Infinity + var codePoint + var length = string.length + var leadSurrogate = null + var bytes = [] + + for (var i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i) + + // is surrogate component + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } + + // valid lead + leadSurrogate = codePoint + + continue + } + + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + leadSurrogate = codePoint + continue + } + + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + } + + leadSurrogate = null + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break + bytes.push(codePoint) + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break + bytes.push( + codePoint >> 0x6 | 0xC0, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break + bytes.push( + codePoint >> 0xC | 0xE0, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break + bytes.push( + codePoint >> 0x12 | 0xF0, + codePoint >> 0xC & 0x3F | 0x80, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else { + throw new Error('Invalid code point') + } + } + + return bytes +} + +function asciiToBytes (str) { + var byteArray = [] + for (var i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF) + } + return byteArray +} + +function utf16leToBytes (str, units) { + var c, hi, lo + var byteArray = [] + for (var i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break + + c = str.charCodeAt(i) + hi = c >> 8 + lo = c % 256 + byteArray.push(lo) + byteArray.push(hi) + } + + return byteArray +} + +function base64ToBytes (str) { + return base64.toByteArray(base64clean(str)) +} + +function blitBuffer (src, dst, offset, length) { + for (var i = 0; i < length; ++i) { + if ((i + offset >= dst.length) || (i >= src.length)) break + dst[i + offset] = src[i] + } + return i +} + +// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass +// the `instanceof` check but they should be treated as of that type. +// See: https://github.com/feross/buffer/issues/166 +function isInstance (obj, type) { + return obj instanceof type || + (obj != null && obj.constructor != null && obj.constructor.name != null && + obj.constructor.name === type.name) +} +function numberIsNaN (obj) { + // For IE11 support + return obj !== obj // eslint-disable-line no-self-compare +} + +// Create lookup table for `toString('hex')` +// See: https://github.com/feross/buffer/issues/219 +var hexSliceLookupTable = (function () { + var alphabet = '0123456789abcdef' + var table = new Array(256) + for (var i = 0; i < 16; ++i) { + var i16 = i * 16 + for (var j = 0; j < 16; ++j) { + table[i16 + j] = alphabet[i] + alphabet[j] + } + } + return table +})() diff --git a/server/node_modules/buffer/package.json b/server/node_modules/buffer/package.json new file mode 100644 index 0000000..85ca143 --- /dev/null +++ b/server/node_modules/buffer/package.json @@ -0,0 +1,127 @@ +{ + "_from": "buffer@^5.5.0", + "_id": "buffer@5.7.1", + "_inBundle": false, + "_integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "_location": "/buffer", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "buffer@^5.5.0", + "name": "buffer", + "escapedName": "buffer", + "rawSpec": "^5.5.0", + "saveSpec": null, + "fetchSpec": "^5.5.0" + }, + "_requiredBy": [ + "/bl" + ], + "_resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "_shasum": "ba62e7c13133053582197160851a8f648e99eed0", + "_spec": "buffer@^5.5.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/bl", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "https://feross.org" + }, + "bugs": { + "url": "https://github.com/feross/buffer/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Romain Beauxis", + "email": "toots@rastageeks.org" + }, + { + "name": "James Halliday", + "email": "mail@substack.net" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + }, + "deprecated": false, + "description": "Node.js Buffer API, for the browser", + "devDependencies": { + "airtap": "^3.0.0", + "benchmark": "^2.1.4", + "browserify": "^17.0.0", + "concat-stream": "^2.0.0", + "hyperquest": "^2.1.3", + "is-buffer": "^2.0.4", + "is-nan": "^1.3.0", + "split": "^1.0.1", + "standard": "*", + "tape": "^5.0.1", + "through2": "^4.0.2", + "uglify-js": "^3.11.3" + }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "homepage": "https://github.com/feross/buffer", + "jspm": { + "map": { + "./index.js": { + "node": "@node/buffer" + } + } + }, + "keywords": [ + "arraybuffer", + "browser", + "browserify", + "buffer", + "compatible", + "dataview", + "uint8array" + ], + "license": "MIT", + "main": "index.js", + "name": "buffer", + "repository": { + "type": "git", + "url": "git://github.com/feross/buffer.git" + }, + "scripts": { + "perf": "browserify --debug perf/bracket-notation.js > perf/bundle.js && open perf/index.html", + "perf-node": "node perf/bracket-notation.js && node perf/concat.js && node perf/copy-big.js && node perf/copy.js && node perf/new-big.js && node perf/new.js && node perf/readDoubleBE.js && node perf/readFloatBE.js && node perf/readUInt32LE.js && node perf/slice.js && node perf/writeFloatBE.js", + "size": "browserify -r | uglifyjs -c -m | gzip | wc -c", + "test": "standard && node ./bin/test.js", + "test-browser-es5": "airtap -- test/*.js", + "test-browser-es5-local": "airtap --local -- test/*.js", + "test-browser-es6": "airtap -- test/*.js test/node/*.js", + "test-browser-es6-local": "airtap --local -- test/*.js test/node/*.js", + "test-node": "tape test/*.js test/node/*.js", + "update-authors": "./bin/update-authors.sh" + }, + "standard": { + "ignore": [ + "test/node/**/*.js", + "test/common.js", + "test/_polyfill.js", + "perf/**/*.js" + ], + "globals": [ + "SharedArrayBuffer" + ] + }, + "types": "index.d.ts", + "version": "5.7.1" +} diff --git a/server/node_modules/bytes/History.md b/server/node_modules/bytes/History.md new file mode 100644 index 0000000..7727fb3 --- /dev/null +++ b/server/node_modules/bytes/History.md @@ -0,0 +1,92 @@ +3.1.1 / 2021-11-15 +================== + + * Fix "thousandsSeparator" incorrecting formatting fractional part + +3.1.0 / 2019-01-22 +================== + + * Add petabyte (`pb`) support + +3.0.0 / 2017-08-31 +================== + + * Change "kB" to "KB" in format output + * Remove support for Node.js 0.6 + * Remove support for ComponentJS + +2.5.0 / 2017-03-24 +================== + + * Add option "unit" + +2.4.0 / 2016-06-01 +================== + + * Add option "unitSeparator" + +2.3.0 / 2016-02-15 +================== + + * Drop partial bytes on all parsed units + * Fix non-finite numbers to `.format` to return `null` + * Fix parsing byte string that looks like hex + * perf: hoist regular expressions + +2.2.0 / 2015-11-13 +================== + + * add option "decimalPlaces" + * add option "fixedDecimals" + +2.1.0 / 2015-05-21 +================== + + * add `.format` export + * add `.parse` export + +2.0.2 / 2015-05-20 +================== + + * remove map recreation + * remove unnecessary object construction + +2.0.1 / 2015-05-07 +================== + + * fix browserify require + * remove node.extend dependency + +2.0.0 / 2015-04-12 +================== + + * add option "case" + * add option "thousandsSeparator" + * return "null" on invalid parse input + * support proper round-trip: bytes(bytes(num)) === num + * units no longer case sensitive when parsing + +1.0.0 / 2014-05-05 +================== + + * add negative support. fixes #6 + +0.3.0 / 2014-03-19 +================== + + * added terabyte support + +0.2.1 / 2013-04-01 +================== + + * add .component + +0.2.0 / 2012-10-28 +================== + + * bytes(200).should.eql('200b') + +0.1.0 / 2012-07-04 +================== + + * add bytes to string conversion [yields] diff --git a/server/node_modules/bytes/LICENSE b/server/node_modules/bytes/LICENSE new file mode 100644 index 0000000..63e95a9 --- /dev/null +++ b/server/node_modules/bytes/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2012-2014 TJ Holowaychuk +Copyright (c) 2015 Jed Watson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/bytes/Readme.md b/server/node_modules/bytes/Readme.md new file mode 100644 index 0000000..5790e23 --- /dev/null +++ b/server/node_modules/bytes/Readme.md @@ -0,0 +1,152 @@ +# Bytes utility + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Build Status][ci-image]][ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa. + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```bash +$ npm install bytes +``` + +## Usage + +```js +var bytes = require('bytes'); +``` + +#### bytes(number|string value, [options]): number|string|null + +Default export function. Delegates to either `bytes.format` or `bytes.parse` based on the type of `value`. + +**Arguments** + +| Name | Type | Description | +|---------|----------|--------------------| +| value | `number`|`string` | Number value to format or string value to parse | +| options | `Object` | Conversion options for `format` | + +**Returns** + +| Name | Type | Description | +|---------|------------------|-------------------------------------------------| +| results | `string`|`number`|`null` | Return null upon error. Numeric value in bytes, or string value otherwise. | + +**Example** + +```js +bytes(1024); +// output: '1KB' + +bytes('1KB'); +// output: 1024 +``` + +#### bytes.format(number value, [options]): string|null + +Format the given value in bytes into a string. If the value is negative, it is kept as such. If it is a float, it is + rounded. + +**Arguments** + +| Name | Type | Description | +|---------|----------|--------------------| +| value | `number` | Value in bytes | +| options | `Object` | Conversion options | + +**Options** + +| Property | Type | Description | +|-------------------|--------|-----------------------------------------------------------------------------------------| +| decimalPlaces | `number`|`null` | Maximum number of decimal places to include in output. Default value to `2`. | +| fixedDecimals | `boolean`|`null` | Whether to always display the maximum number of decimal places. Default value to `false` | +| thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `'.'`... Default value to `''`. | +| unit | `string`|`null` | The unit in which the result will be returned (B/KB/MB/GB/TB). Default value to `''` (which means auto detect). | +| unitSeparator | `string`|`null` | Separator to use between number and unit. Default value to `''`. | + +**Returns** + +| Name | Type | Description | +|---------|------------------|-------------------------------------------------| +| results | `string`|`null` | Return null upon error. String value otherwise. | + +**Example** + +```js +bytes.format(1024); +// output: '1KB' + +bytes.format(1000); +// output: '1000B' + +bytes.format(1000, {thousandsSeparator: ' '}); +// output: '1 000B' + +bytes.format(1024 * 1.7, {decimalPlaces: 0}); +// output: '2KB' + +bytes.format(1024, {unitSeparator: ' '}); +// output: '1 KB' +``` + +#### bytes.parse(string|number value): number|null + +Parse the string value into an integer in bytes. If no unit is given, or `value` +is a number, it is assumed the value is in bytes. + +Supported units and abbreviations are as follows and are case-insensitive: + + * `b` for bytes + * `kb` for kilobytes + * `mb` for megabytes + * `gb` for gigabytes + * `tb` for terabytes + * `pb` for petabytes + +The units are in powers of two, not ten. This means 1kb = 1024b according to this parser. + +**Arguments** + +| Name | Type | Description | +|---------------|--------|--------------------| +| value | `string`|`number` | String to parse, or number in bytes. | + +**Returns** + +| Name | Type | Description | +|---------|-------------|-------------------------| +| results | `number`|`null` | Return null upon error. Value in bytes otherwise. | + +**Example** + +```js +bytes.parse('1KB'); +// output: 1024 + +bytes.parse('1024'); +// output: 1024 + +bytes.parse(1024); +// output: 1024 +``` + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/visionmedia/bytes.js/master?label=ci +[ci-url]: https://github.com/visionmedia/bytes.js/actions?query=workflow%3Aci +[coveralls-image]: https://badgen.net/coveralls/c/github/visionmedia/bytes.js/master +[coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master +[downloads-image]: https://badgen.net/npm/dm/bytes +[downloads-url]: https://npmjs.org/package/bytes +[npm-image]: https://badgen.net/npm/v/bytes +[npm-url]: https://npmjs.org/package/bytes diff --git a/server/node_modules/bytes/index.js b/server/node_modules/bytes/index.js new file mode 100644 index 0000000..e110f47 --- /dev/null +++ b/server/node_modules/bytes/index.js @@ -0,0 +1,166 @@ +/*! + * bytes + * Copyright(c) 2012-2014 TJ Holowaychuk + * Copyright(c) 2015 Jed Watson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +module.exports = bytes; +module.exports.format = format; +module.exports.parse = parse; + +/** + * Module variables. + * @private + */ + +var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g; + +var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/; + +var map = { + b: 1, + kb: 1 << 10, + mb: 1 << 20, + gb: 1 << 30, + tb: Math.pow(1024, 4), + pb: Math.pow(1024, 5), +}; + +var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i; + +/** + * Convert the given value in bytes into a string or parse to string to an integer in bytes. + * + * @param {string|number} value + * @param {{ + * case: [string], + * decimalPlaces: [number] + * fixedDecimals: [boolean] + * thousandsSeparator: [string] + * unitSeparator: [string] + * }} [options] bytes options. + * + * @returns {string|number|null} + */ + +function bytes(value, options) { + if (typeof value === 'string') { + return parse(value); + } + + if (typeof value === 'number') { + return format(value, options); + } + + return null; +} + +/** + * Format the given value in bytes into a string. + * + * If the value is negative, it is kept as such. If it is a float, + * it is rounded. + * + * @param {number} value + * @param {object} [options] + * @param {number} [options.decimalPlaces=2] + * @param {number} [options.fixedDecimals=false] + * @param {string} [options.thousandsSeparator=] + * @param {string} [options.unit=] + * @param {string} [options.unitSeparator=] + * + * @returns {string|null} + * @public + */ + +function format(value, options) { + if (!Number.isFinite(value)) { + return null; + } + + var mag = Math.abs(value); + var thousandsSeparator = (options && options.thousandsSeparator) || ''; + var unitSeparator = (options && options.unitSeparator) || ''; + var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2; + var fixedDecimals = Boolean(options && options.fixedDecimals); + var unit = (options && options.unit) || ''; + + if (!unit || !map[unit.toLowerCase()]) { + if (mag >= map.pb) { + unit = 'PB'; + } else if (mag >= map.tb) { + unit = 'TB'; + } else if (mag >= map.gb) { + unit = 'GB'; + } else if (mag >= map.mb) { + unit = 'MB'; + } else if (mag >= map.kb) { + unit = 'KB'; + } else { + unit = 'B'; + } + } + + var val = value / map[unit.toLowerCase()]; + var str = val.toFixed(decimalPlaces); + + if (!fixedDecimals) { + str = str.replace(formatDecimalsRegExp, '$1'); + } + + if (thousandsSeparator) { + str = str.split('.').map(function (s, i) { + return i === 0 + ? s.replace(formatThousandsRegExp, thousandsSeparator) + : s + }).join('.'); + } + + return str + unitSeparator + unit; +} + +/** + * Parse the string value into an integer in bytes. + * + * If no unit is given, it is assumed the value is in bytes. + * + * @param {number|string} val + * + * @returns {number|null} + * @public + */ + +function parse(val) { + if (typeof val === 'number' && !isNaN(val)) { + return val; + } + + if (typeof val !== 'string') { + return null; + } + + // Test if the string passed is valid + var results = parseRegExp.exec(val); + var floatValue; + var unit = 'b'; + + if (!results) { + // Nothing could be extracted from the given string + floatValue = parseInt(val, 10); + unit = 'b' + } else { + // Retrieve the value and the unit + floatValue = parseFloat(results[1]); + unit = results[4].toLowerCase(); + } + + return Math.floor(map[unit] * floatValue); +} diff --git a/server/node_modules/bytes/package.json b/server/node_modules/bytes/package.json new file mode 100644 index 0000000..79e2c24 --- /dev/null +++ b/server/node_modules/bytes/package.json @@ -0,0 +1,85 @@ +{ + "_from": "bytes@3.1.1", + "_id": "bytes@3.1.1", + "_inBundle": false, + "_integrity": "sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg==", + "_location": "/bytes", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "bytes@3.1.1", + "name": "bytes", + "escapedName": "bytes", + "rawSpec": "3.1.1", + "saveSpec": null, + "fetchSpec": "3.1.1" + }, + "_requiredBy": [ + "/body-parser", + "/raw-body" + ], + "_resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.1.tgz", + "_shasum": "3f018291cb4cbad9accb6e6970bca9c8889e879a", + "_spec": "bytes@3.1.1", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/body-parser", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca", + "url": "http://tjholowaychuk.com" + }, + "bugs": { + "url": "https://github.com/visionmedia/bytes.js/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Jed Watson", + "email": "jed.watson@me.com" + }, + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "deprecated": false, + "description": "Utility to parse a string bytes to bytes and vice-versa", + "devDependencies": { + "eslint": "7.32.0", + "eslint-plugin-markdown": "2.2.1", + "mocha": "9.1.3", + "nyc": "15.1.0" + }, + "engines": { + "node": ">= 0.8" + }, + "files": [ + "History.md", + "LICENSE", + "Readme.md", + "index.js" + ], + "homepage": "https://github.com/visionmedia/bytes.js#readme", + "keywords": [ + "byte", + "bytes", + "utility", + "parse", + "parser", + "convert", + "converter" + ], + "license": "MIT", + "name": "bytes", + "repository": { + "type": "git", + "url": "git+https://github.com/visionmedia/bytes.js.git" + }, + "scripts": { + "lint": "eslint ", + "test": "mocha --check-leaks --reporter spec", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + }, + "version": "3.1.1" +} diff --git a/server/node_modules/cacheable-request/LICENSE b/server/node_modules/cacheable-request/LICENSE new file mode 100644 index 0000000..f27ee9b --- /dev/null +++ b/server/node_modules/cacheable-request/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Luke Childs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/server/node_modules/cacheable-request/README.md b/server/node_modules/cacheable-request/README.md new file mode 100644 index 0000000..725e7e0 --- /dev/null +++ b/server/node_modules/cacheable-request/README.md @@ -0,0 +1,206 @@ +# cacheable-request + +> Wrap native HTTP requests with RFC compliant cache support + +[![Build Status](https://travis-ci.org/lukechilds/cacheable-request.svg?branch=master)](https://travis-ci.org/lukechilds/cacheable-request) +[![Coverage Status](https://coveralls.io/repos/github/lukechilds/cacheable-request/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/cacheable-request?branch=master) +[![npm](https://img.shields.io/npm/dm/cacheable-request.svg)](https://www.npmjs.com/package/cacheable-request) +[![npm](https://img.shields.io/npm/v/cacheable-request.svg)](https://www.npmjs.com/package/cacheable-request) + +[RFC 7234](http://httpwg.org/specs/rfc7234.html) compliant HTTP caching for native Node.js HTTP/HTTPS requests. Caching works out of the box in memory or is easily pluggable with a wide range of storage adapters. + +**Note:** This is a low level wrapper around the core HTTP modules, it's not a high level request library. + +## Features + +- Only stores cacheable responses as defined by RFC 7234 +- Fresh cache entries are served directly from cache +- Stale cache entries are revalidated with `If-None-Match`/`If-Modified-Since` headers +- 304 responses from revalidation requests use cached body +- Updates `Age` header on cached responses +- Can completely bypass cache on a per request basis +- In memory cache by default +- Official support for Redis, MongoDB, SQLite, PostgreSQL and MySQL storage adapters +- Easily plug in your own or third-party storage adapters +- If DB connection fails, cache is automatically bypassed ([disabled by default](#optsautomaticfailover)) +- Adds cache support to any existing HTTP code with minimal changes +- Uses [http-cache-semantics](https://github.com/pornel/http-cache-semantics) internally for HTTP RFC 7234 compliance + +## Install + +```shell +npm install cacheable-request +``` + +## Usage + +```js +const http = require('http'); +const CacheableRequest = require('cacheable-request'); + +// Then instead of +const req = http.request('http://example.com', cb); +req.end(); + +// You can do +const cacheableRequest = new CacheableRequest(http.request); +const cacheReq = cacheableRequest('http://example.com', cb); +cacheReq.on('request', req => req.end()); +// Future requests to 'example.com' will be returned from cache if still valid + +// You pass in any other http.request API compatible method to be wrapped with cache support: +const cacheableRequest = new CacheableRequest(https.request); +const cacheableRequest = new CacheableRequest(electron.net); +``` + +## Storage Adapters + +`cacheable-request` uses [Keyv](https://github.com/lukechilds/keyv) to support a wide range of storage adapters. + +For example, to use Redis as a cache backend, you just need to install the official Redis Keyv storage adapter: + +``` +npm install @keyv/redis +``` + +And then you can pass `CacheableRequest` your connection string: + +```js +const cacheableRequest = new CacheableRequest(http.request, 'redis://user:pass@localhost:6379'); +``` + +[View all official Keyv storage adapters.](https://github.com/lukechilds/keyv#official-storage-adapters) + +Keyv also supports anything that follows the Map API so it's easy to write your own storage adapter or use a third-party solution. + +e.g The following are all valid storage adapters + +```js +const storageAdapter = new Map(); +// or +const storageAdapter = require('./my-storage-adapter'); +// or +const QuickLRU = require('quick-lru'); +const storageAdapter = new QuickLRU({ maxSize: 1000 }); + +const cacheableRequest = new CacheableRequest(http.request, storageAdapter); +``` + +View the [Keyv docs](https://github.com/lukechilds/keyv) for more information on how to use storage adapters. + +## API + +### new cacheableRequest(request, [storageAdapter]) + +Returns the provided request function wrapped with cache support. + +#### request + +Type: `function` + +Request function to wrap with cache support. Should be [`http.request`](https://nodejs.org/api/http.html#http_http_request_options_callback) or a similar API compatible request function. + +#### storageAdapter + +Type: `Keyv storage adapter`
+Default: `new Map()` + +A [Keyv](https://github.com/lukechilds/keyv) storage adapter instance, or connection string if using with an official Keyv storage adapter. + +### Instance + +#### cacheableRequest(opts, [cb]) + +Returns an event emitter. + +##### opts + +Type: `object`, `string` + +- Any of the default request functions options. +- Any [`http-cache-semantics`](https://github.com/kornelski/http-cache-semantics#constructor-options) options. +- Any of the following: + +###### opts.cache + +Type: `boolean`
+Default: `true` + +If the cache should be used. Setting this to false will completely bypass the cache for the current request. + +###### opts.strictTtl + +Type: `boolean`
+Default: `false` + +If set to `true` once a cached resource has expired it is deleted and will have to be re-requested. + +If set to `false` (default), after a cached resource's TTL expires it is kept in the cache and will be revalidated on the next request with `If-None-Match`/`If-Modified-Since` headers. + +###### opts.maxTtl + +Type: `number`
+Default: `undefined` + +Limits TTL. The `number` represents milliseconds. + +###### opts.automaticFailover + +Type: `boolean`
+Default: `false` + +When set to `true`, if the DB connection fails we will automatically fallback to a network request. DB errors will still be emitted to notify you of the problem even though the request callback may succeed. + +###### opts.forceRefresh + +Type: `boolean`
+Default: `false` + +Forces refreshing the cache. If the response could be retrieved from the cache, it will perform a new request and override the cache instead. + +##### cb + +Type: `function` + +The callback function which will receive the response as an argument. + +The response can be either a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage) or a [responselike object](https://github.com/lukechilds/responselike). The response will also have a `fromCache` property set with a boolean value. + +##### .on('request', request) + +`request` event to get the request object of the request. + +**Note:** This event will only fire if an HTTP request is actually made, not when a response is retrieved from cache. However, you should always handle the `request` event to end the request and handle any potential request errors. + +##### .on('response', response) + +`response` event to get the response object from the HTTP request or cache. + +##### .on('error', error) + +`error` event emitted in case of an error with the cache. + +Errors emitted here will be an instance of `CacheableRequest.RequestError` or `CacheableRequest.CacheError`. You will only ever receive a `RequestError` if the request function throws (normally caused by invalid user input). Normal request errors should be handled inside the `request` event. + +To properly handle all error scenarios you should use the following pattern: + +```js +cacheableRequest('example.com', cb) + .on('error', err => { + if (err instanceof CacheableRequest.CacheError) { + handleCacheError(err); // Cache error + } else if (err instanceof CacheableRequest.RequestError) { + handleRequestError(err); // Request function thrown + } + }) + .on('request', req => { + req.on('error', handleRequestError); // Request error emitted + req.end(); + }); +``` + +**Note:** Database connection errors are emitted here, however `cacheable-request` will attempt to re-request the resource and bypass the cache on a connection error. Therefore a database connection error doesn't necessarily mean the request won't be fulfilled. + +## License + +MIT © Luke Childs diff --git a/server/node_modules/cacheable-request/node_modules/get-stream/buffer-stream.js b/server/node_modules/cacheable-request/node_modules/get-stream/buffer-stream.js new file mode 100644 index 0000000..2dd7574 --- /dev/null +++ b/server/node_modules/cacheable-request/node_modules/get-stream/buffer-stream.js @@ -0,0 +1,52 @@ +'use strict'; +const {PassThrough: PassThroughStream} = require('stream'); + +module.exports = options => { + options = {...options}; + + const {array} = options; + let {encoding} = options; + const isBuffer = encoding === 'buffer'; + let objectMode = false; + + if (array) { + objectMode = !(encoding || isBuffer); + } else { + encoding = encoding || 'utf8'; + } + + if (isBuffer) { + encoding = null; + } + + const stream = new PassThroughStream({objectMode}); + + if (encoding) { + stream.setEncoding(encoding); + } + + let length = 0; + const chunks = []; + + stream.on('data', chunk => { + chunks.push(chunk); + + if (objectMode) { + length = chunks.length; + } else { + length += chunk.length; + } + }); + + stream.getBufferedValue = () => { + if (array) { + return chunks; + } + + return isBuffer ? Buffer.concat(chunks, length) : chunks.join(''); + }; + + stream.getBufferedLength = () => length; + + return stream; +}; diff --git a/server/node_modules/cacheable-request/node_modules/get-stream/index.d.ts b/server/node_modules/cacheable-request/node_modules/get-stream/index.d.ts new file mode 100644 index 0000000..7b98134 --- /dev/null +++ b/server/node_modules/cacheable-request/node_modules/get-stream/index.d.ts @@ -0,0 +1,108 @@ +/// +import {Stream} from 'stream'; + +declare class MaxBufferErrorClass extends Error { + readonly name: 'MaxBufferError'; + constructor(); +} + +declare namespace getStream { + interface Options { + /** + Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected with a `MaxBufferError` error. + + @default Infinity + */ + readonly maxBuffer?: number; + } + + interface OptionsWithEncoding extends Options { + /** + [Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream. + + @default 'utf8' + */ + readonly encoding?: EncodingType; + } + + type MaxBufferError = MaxBufferErrorClass; +} + +declare const getStream: { + /** + Get the `stream` as a string. + + @returns A promise that resolves when the end event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode. + + @example + ``` + import * as fs from 'fs'; + import getStream = require('get-stream'); + + (async () => { + const stream = fs.createReadStream('unicorn.txt'); + + console.log(await getStream(stream)); + // ,,))))))));, + // __)))))))))))))), + // \|/ -\(((((''''((((((((. + // -*-==//////(('' . `)))))), + // /|\ ))| o ;-. '((((( ,(, + // ( `| / ) ;))))' ,_))^;(~ + // | | | ,))((((_ _____------~~~-. %,;(;(>';'~ + // o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~ + // ; ''''```` `: `:::|\,__,%% );`'; ~ + // | _ ) / `:|`----' `-' + // ______/\/~ | / / + // /~;;.____/;;' / ___--,-( `;;;/ + // / // _;______;'------~~~~~ /;;/\ / + // // | | / ; \;;,\ + // (<_ | ; /',/-----' _> + // \_| ||_ //~;~~~~~~~~~ + // `\_| (,~~ + // \~\ + // ~~ + })(); + ``` + */ + (stream: Stream, options?: getStream.OptionsWithEncoding): Promise; + + /** + Get the `stream` as a buffer. + + It honors the `maxBuffer` option as above, but it refers to byte length rather than string length. + */ + buffer( + stream: Stream, + options?: getStream.OptionsWithEncoding + ): Promise; + + /** + Get the `stream` as an array of values. + + It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen: + + - When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) and collects values emitted from `stream` unmodified. In this case `maxBuffer` refers to the number of items in the array (not the sum of their sizes). + - When `encoding` is set to `buffer`, it collects an array of buffers. `maxBuffer` refers to the summed byte lengths of every buffer in the array. + - When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array. + */ + array( + stream: Stream, + options?: getStream.Options + ): Promise; + array( + stream: Stream, + options: getStream.OptionsWithEncoding<'buffer'> + ): Promise; + array( + stream: Stream, + options: getStream.OptionsWithEncoding + ): Promise; + + MaxBufferError: typeof MaxBufferErrorClass; + + // TODO: Remove this for the next major release + default: typeof getStream; +}; + +export = getStream; diff --git a/server/node_modules/cacheable-request/node_modules/get-stream/index.js b/server/node_modules/cacheable-request/node_modules/get-stream/index.js new file mode 100644 index 0000000..74fc193 --- /dev/null +++ b/server/node_modules/cacheable-request/node_modules/get-stream/index.js @@ -0,0 +1,60 @@ +'use strict'; +const {constants: BufferConstants} = require('buffer'); +const pump = require('pump'); +const bufferStream = require('get-stream/buffer-stream'); + +class MaxBufferError extends Error { + constructor() { + super('maxBuffer exceeded'); + this.name = 'MaxBufferError'; + } +} + +async function getStream(inputStream, options) { + if (!inputStream) { + return Promise.reject(new Error('Expected a stream')); + } + + options = { + maxBuffer: Infinity, + ...options + }; + + const {maxBuffer} = options; + + let stream; + await new Promise((resolve, reject) => { + const rejectPromise = error => { + // Don't retrieve an oversized buffer. + if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) { + error.bufferedData = stream.getBufferedValue(); + } + + reject(error); + }; + + stream = pump(inputStream, bufferStream(options), error => { + if (error) { + rejectPromise(error); + return; + } + + resolve(); + }); + + stream.on('data', () => { + if (stream.getBufferedLength() > maxBuffer) { + rejectPromise(new MaxBufferError()); + } + }); + }); + + return stream.getBufferedValue(); +} + +module.exports = getStream; +// TODO: Remove this for the next major release +module.exports.default = getStream; +module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'}); +module.exports.array = (stream, options) => getStream(stream, {...options, array: true}); +module.exports.MaxBufferError = MaxBufferError; diff --git a/server/node_modules/cacheable-request/node_modules/get-stream/license b/server/node_modules/cacheable-request/node_modules/get-stream/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/server/node_modules/cacheable-request/node_modules/get-stream/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/cacheable-request/node_modules/get-stream/package.json b/server/node_modules/cacheable-request/node_modules/get-stream/package.json new file mode 100644 index 0000000..e3dfeaf --- /dev/null +++ b/server/node_modules/cacheable-request/node_modules/get-stream/package.json @@ -0,0 +1,82 @@ +{ + "_from": "get-stream@^5.1.0", + "_id": "get-stream@5.2.0", + "_inBundle": false, + "_integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "_location": "/cacheable-request/get-stream", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "get-stream@^5.1.0", + "name": "get-stream", + "escapedName": "get-stream", + "rawSpec": "^5.1.0", + "saveSpec": null, + "fetchSpec": "^5.1.0" + }, + "_requiredBy": [ + "/cacheable-request" + ], + "_resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "_shasum": "4966a1795ee5ace65e706c4b7beb71257d6e22d3", + "_spec": "get-stream@^5.1.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/cacheable-request", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/get-stream/issues" + }, + "bundleDependencies": false, + "dependencies": { + "pump": "^3.0.0" + }, + "deprecated": false, + "description": "Get a stream as a string, buffer, or array", + "devDependencies": { + "@types/node": "^12.0.7", + "ava": "^2.0.0", + "into-stream": "^5.0.0", + "tsd": "^0.7.2", + "xo": "^0.24.0" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "index.d.ts", + "buffer-stream.js" + ], + "funding": "https://github.com/sponsors/sindresorhus", + "homepage": "https://github.com/sindresorhus/get-stream#readme", + "keywords": [ + "get", + "stream", + "promise", + "concat", + "string", + "text", + "buffer", + "read", + "data", + "consume", + "readable", + "readablestream", + "array", + "object" + ], + "license": "MIT", + "name": "get-stream", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/get-stream.git" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "version": "5.2.0" +} diff --git a/server/node_modules/cacheable-request/node_modules/get-stream/readme.md b/server/node_modules/cacheable-request/node_modules/get-stream/readme.md new file mode 100644 index 0000000..7d7565d --- /dev/null +++ b/server/node_modules/cacheable-request/node_modules/get-stream/readme.md @@ -0,0 +1,124 @@ +# get-stream [![Build Status](https://travis-ci.com/sindresorhus/get-stream.svg?branch=master)](https://travis-ci.com/github/sindresorhus/get-stream) + +> Get a stream as a string, buffer, or array + +## Install + +``` +$ npm install get-stream +``` + +## Usage + +```js +const fs = require('fs'); +const getStream = require('get-stream'); + +(async () => { + const stream = fs.createReadStream('unicorn.txt'); + + console.log(await getStream(stream)); + /* + ,,))))))));, + __)))))))))))))), + \|/ -\(((((''''((((((((. + -*-==//////(('' . `)))))), + /|\ ))| o ;-. '((((( ,(, + ( `| / ) ;))))' ,_))^;(~ + | | | ,))((((_ _____------~~~-. %,;(;(>';'~ + o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~ + ; ''''```` `: `:::|\,__,%% );`'; ~ + | _ ) / `:|`----' `-' + ______/\/~ | / / + /~;;.____/;;' / ___--,-( `;;;/ + / // _;______;'------~~~~~ /;;/\ / + // | | / ; \;;,\ + (<_ | ; /',/-----' _> + \_| ||_ //~;~~~~~~~~~ + `\_| (,~~ + \~\ + ~~ + */ +})(); +``` + +## API + +The methods returns a promise that resolves when the `end` event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode. + +### getStream(stream, options?) + +Get the `stream` as a string. + +#### options + +Type: `object` + +##### encoding + +Type: `string`\ +Default: `'utf8'` + +[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream. + +##### maxBuffer + +Type: `number`\ +Default: `Infinity` + +Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected with a `getStream.MaxBufferError` error. + +### getStream.buffer(stream, options?) + +Get the `stream` as a buffer. + +It honors the `maxBuffer` option as above, but it refers to byte length rather than string length. + +### getStream.array(stream, options?) + +Get the `stream` as an array of values. + +It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen: + +- When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) and collects values emitted from `stream` unmodified. In this case `maxBuffer` refers to the number of items in the array (not the sum of their sizes). + +- When `encoding` is set to `buffer`, it collects an array of buffers. `maxBuffer` refers to the summed byte lengths of every buffer in the array. + +- When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array. + +## Errors + +If the input stream emits an `error` event, the promise will be rejected with the error. The buffered data will be attached to the `bufferedData` property of the error. + +```js +(async () => { + try { + await getStream(streamThatErrorsAtTheEnd('unicorn')); + } catch (error) { + console.log(error.bufferedData); + //=> 'unicorn' + } +})() +``` + +## FAQ + +### How is this different from [`concat-stream`](https://github.com/maxogden/concat-stream)? + +This module accepts a stream instead of being one and returns a promise instead of using a callback. The API is simpler and it only supports returning a string, buffer, or array. It doesn't have a fragile type inference. You explicitly choose what you want. And it doesn't depend on the huge `readable-stream` package. + +## Related + +- [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/server/node_modules/cacheable-request/node_modules/lowercase-keys/index.d.ts b/server/node_modules/cacheable-request/node_modules/lowercase-keys/index.d.ts new file mode 100644 index 0000000..dc90a75 --- /dev/null +++ b/server/node_modules/cacheable-request/node_modules/lowercase-keys/index.d.ts @@ -0,0 +1,16 @@ +/** +Lowercase the keys of an object. + +@returns A new object with the keys lowercased. + +@example +``` +import lowercaseKeys = require('lowercase-keys'); + +lowercaseKeys({FOO: true, bAr: false}); +//=> {foo: true, bar: false} +``` +*/ +declare function lowercaseKeys(object: {[key: string]: T}): {[key: string]: T}; + +export = lowercaseKeys; diff --git a/server/node_modules/cacheable-request/node_modules/lowercase-keys/index.js b/server/node_modules/cacheable-request/node_modules/lowercase-keys/index.js new file mode 100644 index 0000000..357fb8f --- /dev/null +++ b/server/node_modules/cacheable-request/node_modules/lowercase-keys/index.js @@ -0,0 +1,10 @@ +'use strict'; +module.exports = object => { + const result = {}; + + for (const [key, value] of Object.entries(object)) { + result[key.toLowerCase()] = value; + } + + return result; +}; diff --git a/server/node_modules/cacheable-request/node_modules/lowercase-keys/license b/server/node_modules/cacheable-request/node_modules/lowercase-keys/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/server/node_modules/cacheable-request/node_modules/lowercase-keys/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/cacheable-request/node_modules/lowercase-keys/package.json b/server/node_modules/cacheable-request/node_modules/lowercase-keys/package.json new file mode 100644 index 0000000..4ed4504 --- /dev/null +++ b/server/node_modules/cacheable-request/node_modules/lowercase-keys/package.json @@ -0,0 +1,70 @@ +{ + "_from": "lowercase-keys@^2.0.0", + "_id": "lowercase-keys@2.0.0", + "_inBundle": false, + "_integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "_location": "/cacheable-request/lowercase-keys", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "lowercase-keys@^2.0.0", + "name": "lowercase-keys", + "escapedName": "lowercase-keys", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/cacheable-request" + ], + "_resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "_shasum": "2603e78b7b4b0006cbca2fbcc8a3202558ac9479", + "_spec": "lowercase-keys@^2.0.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/cacheable-request", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/lowercase-keys/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Lowercase the keys of an object", + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "homepage": "https://github.com/sindresorhus/lowercase-keys#readme", + "keywords": [ + "object", + "assign", + "extend", + "properties", + "lowercase", + "lower-case", + "case", + "keys", + "key" + ], + "license": "MIT", + "name": "lowercase-keys", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/lowercase-keys.git" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "version": "2.0.0" +} diff --git a/server/node_modules/cacheable-request/node_modules/lowercase-keys/readme.md b/server/node_modules/cacheable-request/node_modules/lowercase-keys/readme.md new file mode 100644 index 0000000..b1ed061 --- /dev/null +++ b/server/node_modules/cacheable-request/node_modules/lowercase-keys/readme.md @@ -0,0 +1,32 @@ +# lowercase-keys [![Build Status](https://travis-ci.org/sindresorhus/lowercase-keys.svg?branch=master)](https://travis-ci.org/sindresorhus/lowercase-keys) + +> Lowercase the keys of an object + + +## Install + +``` +$ npm install lowercase-keys +``` + + +## Usage + +```js +const lowercaseKeys = require('lowercase-keys'); + +lowercaseKeys({FOO: true, bAr: false}); +//=> {foo: true, bar: false} +``` + + +## API + +### lowercaseKeys(object) + +Returns a new object with the keys lowercased. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/server/node_modules/cacheable-request/package.json b/server/node_modules/cacheable-request/package.json new file mode 100644 index 0000000..e9f95f5 --- /dev/null +++ b/server/node_modules/cacheable-request/package.json @@ -0,0 +1,94 @@ +{ + "_from": "cacheable-request@^6.0.0", + "_id": "cacheable-request@6.1.0", + "_inBundle": false, + "_integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "_location": "/cacheable-request", + "_phantomChildren": { + "pump": "3.0.0" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "cacheable-request@^6.0.0", + "name": "cacheable-request", + "escapedName": "cacheable-request", + "rawSpec": "^6.0.0", + "saveSpec": null, + "fetchSpec": "^6.0.0" + }, + "_requiredBy": [ + "/got" + ], + "_resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "_shasum": "20ffb8bd162ba4be11e9567d823db651052ca912", + "_spec": "cacheable-request@^6.0.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/got", + "author": { + "name": "Luke Childs", + "email": "lukechilds123@gmail.com", + "url": "http://lukechilds.co.uk" + }, + "bugs": { + "url": "https://github.com/lukechilds/cacheable-request/issues" + }, + "bundleDependencies": false, + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "deprecated": false, + "description": "Wrap native HTTP requests with RFC compliant cache support", + "devDependencies": { + "@keyv/sqlite": "^2.0.0", + "ava": "^1.1.0", + "coveralls": "^3.0.0", + "create-test-server": "3.0.0", + "delay": "^4.0.0", + "eslint-config-xo-lukechilds": "^1.0.0", + "nyc": "^14.1.1", + "pify": "^4.0.0", + "sqlite3": "^4.0.2", + "this": "^1.0.2", + "xo": "^0.23.0" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "src" + ], + "homepage": "https://github.com/lukechilds/cacheable-request#readme", + "keywords": [ + "HTTP", + "HTTPS", + "cache", + "caching", + "layer", + "cacheable", + "RFC 7234", + "RFC", + "7234", + "compliant" + ], + "license": "MIT", + "main": "src/index.js", + "name": "cacheable-request", + "repository": { + "type": "git", + "url": "git+https://github.com/lukechilds/cacheable-request.git" + }, + "scripts": { + "coverage": "nyc report --reporter=text-lcov | coveralls", + "test": "xo && nyc ava" + }, + "version": "6.1.0", + "xo": { + "extends": "xo-lukechilds" + } +} diff --git a/server/node_modules/cacheable-request/src/index.js b/server/node_modules/cacheable-request/src/index.js new file mode 100644 index 0000000..3fcea3f --- /dev/null +++ b/server/node_modules/cacheable-request/src/index.js @@ -0,0 +1,251 @@ +'use strict'; + +const EventEmitter = require('events'); +const urlLib = require('url'); +const normalizeUrl = require('normalize-url'); +const getStream = require('get-stream'); +const CachePolicy = require('http-cache-semantics'); +const Response = require('responselike'); +const lowercaseKeys = require('lowercase-keys'); +const cloneResponse = require('clone-response'); +const Keyv = require('keyv'); + +class CacheableRequest { + constructor(request, cacheAdapter) { + if (typeof request !== 'function') { + throw new TypeError('Parameter `request` must be a function'); + } + + this.cache = new Keyv({ + uri: typeof cacheAdapter === 'string' && cacheAdapter, + store: typeof cacheAdapter !== 'string' && cacheAdapter, + namespace: 'cacheable-request' + }); + + return this.createCacheableRequest(request); + } + + createCacheableRequest(request) { + return (opts, cb) => { + let url; + if (typeof opts === 'string') { + url = normalizeUrlObject(urlLib.parse(opts)); + opts = {}; + } else if (opts instanceof urlLib.URL) { + url = normalizeUrlObject(urlLib.parse(opts.toString())); + opts = {}; + } else { + const [pathname, ...searchParts] = (opts.path || '').split('?'); + const search = searchParts.length > 0 ? + `?${searchParts.join('?')}` : + ''; + url = normalizeUrlObject({ ...opts, pathname, search }); + } + + opts = { + headers: {}, + method: 'GET', + cache: true, + strictTtl: false, + automaticFailover: false, + ...opts, + ...urlObjectToRequestOptions(url) + }; + opts.headers = lowercaseKeys(opts.headers); + + const ee = new EventEmitter(); + const normalizedUrlString = normalizeUrl( + urlLib.format(url), + { + stripWWW: false, + removeTrailingSlash: false, + stripAuthentication: false + } + ); + const key = `${opts.method}:${normalizedUrlString}`; + let revalidate = false; + let madeRequest = false; + + const makeRequest = opts => { + madeRequest = true; + let requestErrored = false; + let requestErrorCallback; + + const requestErrorPromise = new Promise(resolve => { + requestErrorCallback = () => { + if (!requestErrored) { + requestErrored = true; + resolve(); + } + }; + }); + + const handler = response => { + if (revalidate && !opts.forceRefresh) { + response.status = response.statusCode; + const revalidatedPolicy = CachePolicy.fromObject(revalidate.cachePolicy).revalidatedPolicy(opts, response); + if (!revalidatedPolicy.modified) { + const headers = revalidatedPolicy.policy.responseHeaders(); + response = new Response(revalidate.statusCode, headers, revalidate.body, revalidate.url); + response.cachePolicy = revalidatedPolicy.policy; + response.fromCache = true; + } + } + + if (!response.fromCache) { + response.cachePolicy = new CachePolicy(opts, response, opts); + response.fromCache = false; + } + + let clonedResponse; + if (opts.cache && response.cachePolicy.storable()) { + clonedResponse = cloneResponse(response); + + (async () => { + try { + const bodyPromise = getStream.buffer(response); + + await Promise.race([ + requestErrorPromise, + new Promise(resolve => response.once('end', resolve)) + ]); + + if (requestErrored) { + return; + } + + const body = await bodyPromise; + + const value = { + cachePolicy: response.cachePolicy.toObject(), + url: response.url, + statusCode: response.fromCache ? revalidate.statusCode : response.statusCode, + body + }; + + let ttl = opts.strictTtl ? response.cachePolicy.timeToLive() : undefined; + if (opts.maxTtl) { + ttl = ttl ? Math.min(ttl, opts.maxTtl) : opts.maxTtl; + } + + await this.cache.set(key, value, ttl); + } catch (error) { + ee.emit('error', new CacheableRequest.CacheError(error)); + } + })(); + } else if (opts.cache && revalidate) { + (async () => { + try { + await this.cache.delete(key); + } catch (error) { + ee.emit('error', new CacheableRequest.CacheError(error)); + } + })(); + } + + ee.emit('response', clonedResponse || response); + if (typeof cb === 'function') { + cb(clonedResponse || response); + } + }; + + try { + const req = request(opts, handler); + req.once('error', requestErrorCallback); + req.once('abort', requestErrorCallback); + ee.emit('request', req); + } catch (error) { + ee.emit('error', new CacheableRequest.RequestError(error)); + } + }; + + (async () => { + const get = async opts => { + await Promise.resolve(); + + const cacheEntry = opts.cache ? await this.cache.get(key) : undefined; + if (typeof cacheEntry === 'undefined') { + return makeRequest(opts); + } + + const policy = CachePolicy.fromObject(cacheEntry.cachePolicy); + if (policy.satisfiesWithoutRevalidation(opts) && !opts.forceRefresh) { + const headers = policy.responseHeaders(); + const response = new Response(cacheEntry.statusCode, headers, cacheEntry.body, cacheEntry.url); + response.cachePolicy = policy; + response.fromCache = true; + + ee.emit('response', response); + if (typeof cb === 'function') { + cb(response); + } + } else { + revalidate = cacheEntry; + opts.headers = policy.revalidationHeaders(opts); + makeRequest(opts); + } + }; + + const errorHandler = error => ee.emit('error', new CacheableRequest.CacheError(error)); + this.cache.once('error', errorHandler); + ee.on('response', () => this.cache.removeListener('error', errorHandler)); + + try { + await get(opts); + } catch (error) { + if (opts.automaticFailover && !madeRequest) { + makeRequest(opts); + } + + ee.emit('error', new CacheableRequest.CacheError(error)); + } + })(); + + return ee; + }; + } +} + +function urlObjectToRequestOptions(url) { + const options = { ...url }; + options.path = `${url.pathname || '/'}${url.search || ''}`; + delete options.pathname; + delete options.search; + return options; +} + +function normalizeUrlObject(url) { + // If url was parsed by url.parse or new URL: + // - hostname will be set + // - host will be hostname[:port] + // - port will be set if it was explicit in the parsed string + // Otherwise, url was from request options: + // - hostname or host may be set + // - host shall not have port encoded + return { + protocol: url.protocol, + auth: url.auth, + hostname: url.hostname || url.host || 'localhost', + port: url.port, + pathname: url.pathname, + search: url.search + }; +} + +CacheableRequest.RequestError = class extends Error { + constructor(error) { + super(error.message); + this.name = 'RequestError'; + Object.assign(this, error); + } +}; + +CacheableRequest.CacheError = class extends Error { + constructor(error) { + super(error.message); + this.name = 'CacheError'; + Object.assign(this, error); + } +}; + +module.exports = CacheableRequest; diff --git a/server/node_modules/camelcase/index.d.ts b/server/node_modules/camelcase/index.d.ts new file mode 100644 index 0000000..9db94e5 --- /dev/null +++ b/server/node_modules/camelcase/index.d.ts @@ -0,0 +1,103 @@ +declare namespace camelcase { + interface Options { + /** + Uppercase the first character: `foo-bar` → `FooBar`. + + @default false + */ + readonly pascalCase?: boolean; + + /** + Preserve the consecutive uppercase characters: `foo-BAR` → `FooBAR`. + + @default false + */ + readonly preserveConsecutiveUppercase?: boolean; + + /** + The locale parameter indicates the locale to be used to convert to upper/lower case according to any locale-specific case mappings. If multiple locales are given in an array, the best available locale is used. + + Setting `locale: false` ignores the platform locale and uses the [Unicode Default Case Conversion](https://unicode-org.github.io/icu/userguide/transforms/casemappings.html#simple-single-character-case-mapping) algorithm. + + Default: The host environment’s current locale. + + @example + ``` + import camelCase = require('camelcase'); + + camelCase('lorem-ipsum', {locale: 'en-US'}); + //=> 'loremIpsum' + camelCase('lorem-ipsum', {locale: 'tr-TR'}); + //=> 'loremİpsum' + camelCase('lorem-ipsum', {locale: ['en-US', 'en-GB']}); + //=> 'loremIpsum' + camelCase('lorem-ipsum', {locale: ['tr', 'TR', 'tr-TR']}); + //=> 'loremİpsum' + ``` + */ + readonly locale?: false | string | readonly string[]; + } +} + +/** +Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`. + +Correctly handles Unicode strings. + +@param input - String to convert to camel case. + +@example +``` +import camelCase = require('camelcase'); + +camelCase('foo-bar'); +//=> 'fooBar' + +camelCase('foo_bar'); +//=> 'fooBar' + +camelCase('Foo-Bar'); +//=> 'fooBar' + +camelCase('розовый_пушистый_единорог'); +//=> 'розовыйПушистыйЕдинорог' + +camelCase('Foo-Bar', {pascalCase: true}); +//=> 'FooBar' + +camelCase('--foo.bar', {pascalCase: false}); +//=> 'fooBar' + +camelCase('Foo-BAR', {preserveConsecutiveUppercase: true}); +//=> 'fooBAR' + +camelCase('fooBAR', {pascalCase: true, preserveConsecutiveUppercase: true})); +//=> 'FooBAR' + +camelCase('foo bar'); +//=> 'fooBar' + +console.log(process.argv[3]); +//=> '--foo-bar' +camelCase(process.argv[3]); +//=> 'fooBar' + +camelCase(['foo', 'bar']); +//=> 'fooBar' + +camelCase(['__foo__', '--bar'], {pascalCase: true}); +//=> 'FooBar' + +camelCase(['foo', 'BAR'], {pascalCase: true, preserveConsecutiveUppercase: true}) +//=> 'FooBAR' + +camelCase('lorem-ipsum', {locale: 'en-US'}); +//=> 'loremIpsum' +``` +*/ +declare function camelcase( + input: string | readonly string[], + options?: camelcase.Options +): string; + +export = camelcase; diff --git a/server/node_modules/camelcase/index.js b/server/node_modules/camelcase/index.js new file mode 100644 index 0000000..6ff4ee8 --- /dev/null +++ b/server/node_modules/camelcase/index.js @@ -0,0 +1,113 @@ +'use strict'; + +const UPPERCASE = /[\p{Lu}]/u; +const LOWERCASE = /[\p{Ll}]/u; +const LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu; +const IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u; +const SEPARATORS = /[_.\- ]+/; + +const LEADING_SEPARATORS = new RegExp('^' + SEPARATORS.source); +const SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, 'gu'); +const NUMBERS_AND_IDENTIFIER = new RegExp('\\d+' + IDENTIFIER.source, 'gu'); + +const preserveCamelCase = (string, toLowerCase, toUpperCase) => { + let isLastCharLower = false; + let isLastCharUpper = false; + let isLastLastCharUpper = false; + + for (let i = 0; i < string.length; i++) { + const character = string[i]; + + if (isLastCharLower && UPPERCASE.test(character)) { + string = string.slice(0, i) + '-' + string.slice(i); + isLastCharLower = false; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = true; + i++; + } else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character)) { + string = string.slice(0, i - 1) + '-' + string.slice(i - 1); + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = false; + isLastCharLower = true; + } else { + isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character; + } + } + + return string; +}; + +const preserveConsecutiveUppercase = (input, toLowerCase) => { + LEADING_CAPITAL.lastIndex = 0; + + return input.replace(LEADING_CAPITAL, m1 => toLowerCase(m1)); +}; + +const postProcess = (input, toUpperCase) => { + SEPARATORS_AND_IDENTIFIER.lastIndex = 0; + NUMBERS_AND_IDENTIFIER.lastIndex = 0; + + return input.replace(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier)) + .replace(NUMBERS_AND_IDENTIFIER, m => toUpperCase(m)); +}; + +const camelCase = (input, options) => { + if (!(typeof input === 'string' || Array.isArray(input))) { + throw new TypeError('Expected the input to be `string | string[]`'); + } + + options = { + pascalCase: false, + preserveConsecutiveUppercase: false, + ...options + }; + + if (Array.isArray(input)) { + input = input.map(x => x.trim()) + .filter(x => x.length) + .join('-'); + } else { + input = input.trim(); + } + + if (input.length === 0) { + return ''; + } + + const toLowerCase = options.locale === false ? + string => string.toLowerCase() : + string => string.toLocaleLowerCase(options.locale); + const toUpperCase = options.locale === false ? + string => string.toUpperCase() : + string => string.toLocaleUpperCase(options.locale); + + if (input.length === 1) { + return options.pascalCase ? toUpperCase(input) : toLowerCase(input); + } + + const hasUpperCase = input !== toLowerCase(input); + + if (hasUpperCase) { + input = preserveCamelCase(input, toLowerCase, toUpperCase); + } + + input = input.replace(LEADING_SEPARATORS, ''); + + if (options.preserveConsecutiveUppercase) { + input = preserveConsecutiveUppercase(input, toLowerCase); + } else { + input = toLowerCase(input); + } + + if (options.pascalCase) { + input = toUpperCase(input.charAt(0)) + input.slice(1); + } + + return postProcess(input, toUpperCase); +}; + +module.exports = camelCase; +// TODO: Remove this for the next major release +module.exports.default = camelCase; diff --git a/server/node_modules/camelcase/license b/server/node_modules/camelcase/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/server/node_modules/camelcase/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/camelcase/package.json b/server/node_modules/camelcase/package.json new file mode 100644 index 0000000..b1ff287 --- /dev/null +++ b/server/node_modules/camelcase/package.json @@ -0,0 +1,76 @@ +{ + "_from": "camelcase@^6.2.0", + "_id": "camelcase@6.3.0", + "_inBundle": false, + "_integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "_location": "/camelcase", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "camelcase@^6.2.0", + "name": "camelcase", + "escapedName": "camelcase", + "rawSpec": "^6.2.0", + "saveSpec": null, + "fetchSpec": "^6.2.0" + }, + "_requiredBy": [ + "/boxen" + ], + "_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "_shasum": "5685b95eb209ac9c0c177467778c9c84df58ba9a", + "_spec": "camelcase@^6.2.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/boxen", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/camelcase/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`", + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.11.0", + "xo": "^0.28.3" + }, + "engines": { + "node": ">=10" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "funding": "https://github.com/sponsors/sindresorhus", + "homepage": "https://github.com/sindresorhus/camelcase#readme", + "keywords": [ + "camelcase", + "camel-case", + "camel", + "case", + "dash", + "hyphen", + "dot", + "underscore", + "separator", + "string", + "text", + "convert", + "pascalcase", + "pascal-case" + ], + "license": "MIT", + "name": "camelcase", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/camelcase.git" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "version": "6.3.0" +} diff --git a/server/node_modules/camelcase/readme.md b/server/node_modules/camelcase/readme.md new file mode 100644 index 0000000..0ff8f9e --- /dev/null +++ b/server/node_modules/camelcase/readme.md @@ -0,0 +1,144 @@ +# camelcase + +> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar` + +Correctly handles Unicode strings. + +If you use this on untrusted user input, don't forget to limit the length to something reasonable. + +## Install + +``` +$ npm install camelcase +``` + +*If you need to support Firefox < 78, stay on version 5 as version 6 uses regex features not available in Firefox < 78.* + +## Usage + +```js +const camelCase = require('camelcase'); + +camelCase('foo-bar'); +//=> 'fooBar' + +camelCase('foo_bar'); +//=> 'fooBar' + +camelCase('Foo-Bar'); +//=> 'fooBar' + +camelCase('розовый_пушистый_единорог'); +//=> 'розовыйПушистыйЕдинорог' + +camelCase('Foo-Bar', {pascalCase: true}); +//=> 'FooBar' + +camelCase('--foo.bar', {pascalCase: false}); +//=> 'fooBar' + +camelCase('Foo-BAR', {preserveConsecutiveUppercase: true}); +//=> 'fooBAR' + +camelCase('fooBAR', {pascalCase: true, preserveConsecutiveUppercase: true})); +//=> 'FooBAR' + +camelCase('foo bar'); +//=> 'fooBar' + +console.log(process.argv[3]); +//=> '--foo-bar' +camelCase(process.argv[3]); +//=> 'fooBar' + +camelCase(['foo', 'bar']); +//=> 'fooBar' + +camelCase(['__foo__', '--bar'], {pascalCase: true}); +//=> 'FooBar' + +camelCase(['foo', 'BAR'], {pascalCase: true, preserveConsecutiveUppercase: true}) +//=> 'FooBAR' + +camelCase('lorem-ipsum', {locale: 'en-US'}); +//=> 'loremIpsum' +``` + +## API + +### camelCase(input, options?) + +#### input + +Type: `string | string[]` + +String to convert to camel case. + +#### options + +Type: `object` + +##### pascalCase + +Type: `boolean`\ +Default: `false` + +Uppercase the first character: `foo-bar` → `FooBar` + +##### preserveConsecutiveUppercase + +Type: `boolean`\ +Default: `false` + +Preserve the consecutive uppercase characters: `foo-BAR` → `FooBAR`. + +##### locale + +Type: `false | string | string[]`\ +Default: The host environment’s current locale. + +The locale parameter indicates the locale to be used to convert to upper/lower case according to any locale-specific case mappings. If multiple locales are given in an array, the best available locale is used. + +```js +const camelCase = require('camelcase'); + +camelCase('lorem-ipsum', {locale: 'en-US'}); +//=> 'loremIpsum' + +camelCase('lorem-ipsum', {locale: 'tr-TR'}); +//=> 'loremİpsum' + +camelCase('lorem-ipsum', {locale: ['en-US', 'en-GB']}); +//=> 'loremIpsum' + +camelCase('lorem-ipsum', {locale: ['tr', 'TR', 'tr-TR']}); +//=> 'loremİpsum' +``` + +Setting `locale: false` ignores the platform locale and uses the [Unicode Default Case Conversion](https://unicode-org.github.io/icu/userguide/transforms/casemappings.html#simple-single-character-case-mapping) algorithm: + +```js +const camelCase = require('camelcase'); + +// On a platform with 'tr-TR' + +camelCase('lorem-ipsum'); +//=> 'loremİpsum' + +camelCase('lorem-ipsum', {locale: false}); +//=> 'loremIpsum' +``` + +## camelcase for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of camelcase and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-camelcase?utm_source=npm-camelcase&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + +## Related + +- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module +- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase +- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string +- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one +- [camelcase-keys](https://github.com/sindresorhus/camelcase-keys) - Convert object keys to camel case diff --git a/server/node_modules/chalk/index.d.ts b/server/node_modules/chalk/index.d.ts new file mode 100644 index 0000000..9cd88f3 --- /dev/null +++ b/server/node_modules/chalk/index.d.ts @@ -0,0 +1,415 @@ +/** +Basic foreground colors. + +[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) +*/ +declare type ForegroundColor = + | 'black' + | 'red' + | 'green' + | 'yellow' + | 'blue' + | 'magenta' + | 'cyan' + | 'white' + | 'gray' + | 'grey' + | 'blackBright' + | 'redBright' + | 'greenBright' + | 'yellowBright' + | 'blueBright' + | 'magentaBright' + | 'cyanBright' + | 'whiteBright'; + +/** +Basic background colors. + +[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) +*/ +declare type BackgroundColor = + | 'bgBlack' + | 'bgRed' + | 'bgGreen' + | 'bgYellow' + | 'bgBlue' + | 'bgMagenta' + | 'bgCyan' + | 'bgWhite' + | 'bgGray' + | 'bgGrey' + | 'bgBlackBright' + | 'bgRedBright' + | 'bgGreenBright' + | 'bgYellowBright' + | 'bgBlueBright' + | 'bgMagentaBright' + | 'bgCyanBright' + | 'bgWhiteBright'; + +/** +Basic colors. + +[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) +*/ +declare type Color = ForegroundColor | BackgroundColor; + +declare type Modifiers = + | 'reset' + | 'bold' + | 'dim' + | 'italic' + | 'underline' + | 'inverse' + | 'hidden' + | 'strikethrough' + | 'visible'; + +declare namespace chalk { + /** + Levels: + - `0` - All colors disabled. + - `1` - Basic 16 colors support. + - `2` - ANSI 256 colors support. + - `3` - Truecolor 16 million colors support. + */ + type Level = 0 | 1 | 2 | 3; + + interface Options { + /** + Specify the color support for Chalk. + + By default, color support is automatically detected based on the environment. + + Levels: + - `0` - All colors disabled. + - `1` - Basic 16 colors support. + - `2` - ANSI 256 colors support. + - `3` - Truecolor 16 million colors support. + */ + level?: Level; + } + + /** + Return a new Chalk instance. + */ + type Instance = new (options?: Options) => Chalk; + + /** + Detect whether the terminal supports color. + */ + interface ColorSupport { + /** + The color level used by Chalk. + */ + level: Level; + + /** + Return whether Chalk supports basic 16 colors. + */ + hasBasic: boolean; + + /** + Return whether Chalk supports ANSI 256 colors. + */ + has256: boolean; + + /** + Return whether Chalk supports Truecolor 16 million colors. + */ + has16m: boolean; + } + + interface ChalkFunction { + /** + Use a template string. + + @remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341)) + + @example + ``` + import chalk = require('chalk'); + + log(chalk` + CPU: {red ${cpu.totalPercent}%} + RAM: {green ${ram.used / ram.total * 100}%} + DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} + `); + ``` + + @example + ``` + import chalk = require('chalk'); + + log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`) + ``` + */ + (text: TemplateStringsArray, ...placeholders: unknown[]): string; + + (...text: unknown[]): string; + } + + interface Chalk extends ChalkFunction { + /** + Return a new Chalk instance. + */ + Instance: Instance; + + /** + The color support for Chalk. + + By default, color support is automatically detected based on the environment. + + Levels: + - `0` - All colors disabled. + - `1` - Basic 16 colors support. + - `2` - ANSI 256 colors support. + - `3` - Truecolor 16 million colors support. + */ + level: Level; + + /** + Use HEX value to set text color. + + @param color - Hexadecimal value representing the desired color. + + @example + ``` + import chalk = require('chalk'); + + chalk.hex('#DEADED'); + ``` + */ + hex(color: string): Chalk; + + /** + Use keyword color value to set text color. + + @param color - Keyword value representing the desired color. + + @example + ``` + import chalk = require('chalk'); + + chalk.keyword('orange'); + ``` + */ + keyword(color: string): Chalk; + + /** + Use RGB values to set text color. + */ + rgb(red: number, green: number, blue: number): Chalk; + + /** + Use HSL values to set text color. + */ + hsl(hue: number, saturation: number, lightness: number): Chalk; + + /** + Use HSV values to set text color. + */ + hsv(hue: number, saturation: number, value: number): Chalk; + + /** + Use HWB values to set text color. + */ + hwb(hue: number, whiteness: number, blackness: number): Chalk; + + /** + Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color. + + 30 <= code && code < 38 || 90 <= code && code < 98 + For example, 31 for red, 91 for redBright. + */ + ansi(code: number): Chalk; + + /** + Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color. + */ + ansi256(index: number): Chalk; + + /** + Use HEX value to set background color. + + @param color - Hexadecimal value representing the desired color. + + @example + ``` + import chalk = require('chalk'); + + chalk.bgHex('#DEADED'); + ``` + */ + bgHex(color: string): Chalk; + + /** + Use keyword color value to set background color. + + @param color - Keyword value representing the desired color. + + @example + ``` + import chalk = require('chalk'); + + chalk.bgKeyword('orange'); + ``` + */ + bgKeyword(color: string): Chalk; + + /** + Use RGB values to set background color. + */ + bgRgb(red: number, green: number, blue: number): Chalk; + + /** + Use HSL values to set background color. + */ + bgHsl(hue: number, saturation: number, lightness: number): Chalk; + + /** + Use HSV values to set background color. + */ + bgHsv(hue: number, saturation: number, value: number): Chalk; + + /** + Use HWB values to set background color. + */ + bgHwb(hue: number, whiteness: number, blackness: number): Chalk; + + /** + Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color. + + 30 <= code && code < 38 || 90 <= code && code < 98 + For example, 31 for red, 91 for redBright. + Use the foreground code, not the background code (for example, not 41, nor 101). + */ + bgAnsi(code: number): Chalk; + + /** + Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color. + */ + bgAnsi256(index: number): Chalk; + + /** + Modifier: Resets the current color chain. + */ + readonly reset: Chalk; + + /** + Modifier: Make text bold. + */ + readonly bold: Chalk; + + /** + Modifier: Emitting only a small amount of light. + */ + readonly dim: Chalk; + + /** + Modifier: Make text italic. (Not widely supported) + */ + readonly italic: Chalk; + + /** + Modifier: Make text underline. (Not widely supported) + */ + readonly underline: Chalk; + + /** + Modifier: Inverse background and foreground colors. + */ + readonly inverse: Chalk; + + /** + Modifier: Prints the text, but makes it invisible. + */ + readonly hidden: Chalk; + + /** + Modifier: Puts a horizontal line through the center of the text. (Not widely supported) + */ + readonly strikethrough: Chalk; + + /** + Modifier: Prints the text only when Chalk has a color support level > 0. + Can be useful for things that are purely cosmetic. + */ + readonly visible: Chalk; + + readonly black: Chalk; + readonly red: Chalk; + readonly green: Chalk; + readonly yellow: Chalk; + readonly blue: Chalk; + readonly magenta: Chalk; + readonly cyan: Chalk; + readonly white: Chalk; + + /* + Alias for `blackBright`. + */ + readonly gray: Chalk; + + /* + Alias for `blackBright`. + */ + readonly grey: Chalk; + + readonly blackBright: Chalk; + readonly redBright: Chalk; + readonly greenBright: Chalk; + readonly yellowBright: Chalk; + readonly blueBright: Chalk; + readonly magentaBright: Chalk; + readonly cyanBright: Chalk; + readonly whiteBright: Chalk; + + readonly bgBlack: Chalk; + readonly bgRed: Chalk; + readonly bgGreen: Chalk; + readonly bgYellow: Chalk; + readonly bgBlue: Chalk; + readonly bgMagenta: Chalk; + readonly bgCyan: Chalk; + readonly bgWhite: Chalk; + + /* + Alias for `bgBlackBright`. + */ + readonly bgGray: Chalk; + + /* + Alias for `bgBlackBright`. + */ + readonly bgGrey: Chalk; + + readonly bgBlackBright: Chalk; + readonly bgRedBright: Chalk; + readonly bgGreenBright: Chalk; + readonly bgYellowBright: Chalk; + readonly bgBlueBright: Chalk; + readonly bgMagentaBright: Chalk; + readonly bgCyanBright: Chalk; + readonly bgWhiteBright: Chalk; + } +} + +/** +Main Chalk object that allows to chain styles together. +Call the last one as a method with a string argument. +Order doesn't matter, and later styles take precedent in case of a conflict. +This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`. +*/ +declare const chalk: chalk.Chalk & chalk.ChalkFunction & { + supportsColor: chalk.ColorSupport | false; + Level: chalk.Level; + Color: Color; + ForegroundColor: ForegroundColor; + BackgroundColor: BackgroundColor; + Modifiers: Modifiers; + stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false}; +}; + +export = chalk; diff --git a/server/node_modules/chalk/license b/server/node_modules/chalk/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/server/node_modules/chalk/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/chalk/node_modules/has-flag/index.d.ts b/server/node_modules/chalk/node_modules/has-flag/index.d.ts new file mode 100644 index 0000000..a0a48c8 --- /dev/null +++ b/server/node_modules/chalk/node_modules/has-flag/index.d.ts @@ -0,0 +1,39 @@ +/** +Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag. + +@param flag - CLI flag to look for. The `--` prefix is optional. +@param argv - CLI arguments. Default: `process.argv`. +@returns Whether the flag exists. + +@example +``` +// $ ts-node foo.ts -f --unicorn --foo=bar -- --rainbow + +// foo.ts +import hasFlag = require('has-flag'); + +hasFlag('unicorn'); +//=> true + +hasFlag('--unicorn'); +//=> true + +hasFlag('f'); +//=> true + +hasFlag('-f'); +//=> true + +hasFlag('foo=bar'); +//=> true + +hasFlag('foo'); +//=> false + +hasFlag('rainbow'); +//=> false +``` +*/ +declare function hasFlag(flag: string, argv?: string[]): boolean; + +export = hasFlag; diff --git a/server/node_modules/chalk/node_modules/has-flag/index.js b/server/node_modules/chalk/node_modules/has-flag/index.js new file mode 100644 index 0000000..b6f80b1 --- /dev/null +++ b/server/node_modules/chalk/node_modules/has-flag/index.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = (flag, argv = process.argv) => { + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf('--'); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); +}; diff --git a/server/node_modules/chalk/node_modules/has-flag/license b/server/node_modules/chalk/node_modules/has-flag/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/server/node_modules/chalk/node_modules/has-flag/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/chalk/node_modules/has-flag/package.json b/server/node_modules/chalk/node_modules/has-flag/package.json new file mode 100644 index 0000000..f9981ee --- /dev/null +++ b/server/node_modules/chalk/node_modules/has-flag/package.json @@ -0,0 +1,78 @@ +{ + "_from": "has-flag@^4.0.0", + "_id": "has-flag@4.0.0", + "_inBundle": false, + "_integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "_location": "/chalk/has-flag", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "has-flag@^4.0.0", + "name": "has-flag", + "escapedName": "has-flag", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/chalk/supports-color" + ], + "_resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "_shasum": "944771fd9c81c81265c4d6941860da06bb59479b", + "_spec": "has-flag@^4.0.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/chalk/node_modules/supports-color", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/has-flag/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Check if argv has a specific flag", + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "homepage": "https://github.com/sindresorhus/has-flag#readme", + "keywords": [ + "has", + "check", + "detect", + "contains", + "find", + "flag", + "cli", + "command-line", + "argv", + "process", + "arg", + "args", + "argument", + "arguments", + "getopt", + "minimist", + "optimist" + ], + "license": "MIT", + "name": "has-flag", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/has-flag.git" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "version": "4.0.0" +} diff --git a/server/node_modules/chalk/node_modules/has-flag/readme.md b/server/node_modules/chalk/node_modules/has-flag/readme.md new file mode 100644 index 0000000..3f72dff --- /dev/null +++ b/server/node_modules/chalk/node_modules/has-flag/readme.md @@ -0,0 +1,89 @@ +# has-flag [![Build Status](https://travis-ci.org/sindresorhus/has-flag.svg?branch=master)](https://travis-ci.org/sindresorhus/has-flag) + +> Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag + +Correctly stops looking after an `--` argument terminator. + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
+ +--- + + +## Install + +``` +$ npm install has-flag +``` + + +## Usage + +```js +// foo.js +const hasFlag = require('has-flag'); + +hasFlag('unicorn'); +//=> true + +hasFlag('--unicorn'); +//=> true + +hasFlag('f'); +//=> true + +hasFlag('-f'); +//=> true + +hasFlag('foo=bar'); +//=> true + +hasFlag('foo'); +//=> false + +hasFlag('rainbow'); +//=> false +``` + +``` +$ node foo.js -f --unicorn --foo=bar -- --rainbow +``` + + +## API + +### hasFlag(flag, [argv]) + +Returns a boolean for whether the flag exists. + +#### flag + +Type: `string` + +CLI flag to look for. The `--` prefix is optional. + +#### argv + +Type: `string[]`
+Default: `process.argv` + +CLI arguments. + + +## Security + +To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/server/node_modules/chalk/node_modules/supports-color/browser.js b/server/node_modules/chalk/node_modules/supports-color/browser.js new file mode 100644 index 0000000..62afa3a --- /dev/null +++ b/server/node_modules/chalk/node_modules/supports-color/browser.js @@ -0,0 +1,5 @@ +'use strict'; +module.exports = { + stdout: false, + stderr: false +}; diff --git a/server/node_modules/chalk/node_modules/supports-color/index.js b/server/node_modules/chalk/node_modules/supports-color/index.js new file mode 100644 index 0000000..6fada39 --- /dev/null +++ b/server/node_modules/chalk/node_modules/supports-color/index.js @@ -0,0 +1,135 @@ +'use strict'; +const os = require('os'); +const tty = require('tty'); +const hasFlag = require('has-flag'); + +const {env} = process; + +let forceColor; +if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false') || + hasFlag('color=never')) { + forceColor = 0; +} else if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + forceColor = 1; +} + +if ('FORCE_COLOR' in env) { + if (env.FORCE_COLOR === 'true') { + forceColor = 1; + } else if (env.FORCE_COLOR === 'false') { + forceColor = 0; + } else { + forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); + } +} + +function translateLevel(level) { + if (level === 0) { + return false; + } + + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} + +function supportsColor(haveStream, streamIsTTY) { + if (forceColor === 0) { + return 0; + } + + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + + if (haveStream && !streamIsTTY && forceColor === undefined) { + return 0; + } + + const min = forceColor || 0; + + if (env.TERM === 'dumb') { + return min; + } + + if (process.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } + + if (env.COLORTERM === 'truecolor') { + return 3; + } + + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } + + if ('COLORTERM' in env) { + return 1; + } + + return min; +} + +function getSupportLevel(stream) { + const level = supportsColor(stream, stream && stream.isTTY); + return translateLevel(level); +} + +module.exports = { + supportsColor: getSupportLevel, + stdout: translateLevel(supportsColor(true, tty.isatty(1))), + stderr: translateLevel(supportsColor(true, tty.isatty(2))) +}; diff --git a/server/node_modules/chalk/node_modules/supports-color/license b/server/node_modules/chalk/node_modules/supports-color/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/server/node_modules/chalk/node_modules/supports-color/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/chalk/node_modules/supports-color/package.json b/server/node_modules/chalk/node_modules/supports-color/package.json new file mode 100644 index 0000000..8306ec1 --- /dev/null +++ b/server/node_modules/chalk/node_modules/supports-color/package.json @@ -0,0 +1,85 @@ +{ + "_from": "supports-color@^7.1.0", + "_id": "supports-color@7.2.0", + "_inBundle": false, + "_integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "_location": "/chalk/supports-color", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "supports-color@^7.1.0", + "name": "supports-color", + "escapedName": "supports-color", + "rawSpec": "^7.1.0", + "saveSpec": null, + "fetchSpec": "^7.1.0" + }, + "_requiredBy": [ + "/chalk" + ], + "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "_shasum": "1b7dcdcb32b8138801b3e478ba6a51caa89648da", + "_spec": "supports-color@^7.1.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/chalk", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "browser": "browser.js", + "bugs": { + "url": "https://github.com/chalk/supports-color/issues" + }, + "bundleDependencies": false, + "dependencies": { + "has-flag": "^4.0.0" + }, + "deprecated": false, + "description": "Detect whether a terminal supports color", + "devDependencies": { + "ava": "^1.4.1", + "import-fresh": "^3.0.0", + "xo": "^0.24.0" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "browser.js" + ], + "homepage": "https://github.com/chalk/supports-color#readme", + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "ansi", + "styles", + "tty", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "support", + "supports", + "capability", + "detect", + "truecolor", + "16m" + ], + "license": "MIT", + "name": "supports-color", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/supports-color.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "7.2.0" +} diff --git a/server/node_modules/chalk/node_modules/supports-color/readme.md b/server/node_modules/chalk/node_modules/supports-color/readme.md new file mode 100644 index 0000000..3654228 --- /dev/null +++ b/server/node_modules/chalk/node_modules/supports-color/readme.md @@ -0,0 +1,76 @@ +# supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color) + +> Detect whether a terminal supports color + + +## Install + +``` +$ npm install supports-color +``` + + +## Usage + +```js +const supportsColor = require('supports-color'); + +if (supportsColor.stdout) { + console.log('Terminal stdout supports color'); +} + +if (supportsColor.stdout.has256) { + console.log('Terminal stdout supports 256 colors'); +} + +if (supportsColor.stderr.has16m) { + console.log('Terminal stderr supports 16 million colors (truecolor)'); +} +``` + + +## API + +Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported. + +The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag: + +- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors) +- `.level = 2` and `.has256 = true`: 256 color support +- `.level = 3` and `.has16m = true`: Truecolor support (16 million colors) + + +## Info + +It obeys the `--color` and `--no-color` CLI flags. + +For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks. + +Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively. + + +## Related + +- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
+ +--- diff --git a/server/node_modules/chalk/package.json b/server/node_modules/chalk/package.json new file mode 100644 index 0000000..f643005 --- /dev/null +++ b/server/node_modules/chalk/package.json @@ -0,0 +1,101 @@ +{ + "_from": "chalk@^4.1.0", + "_id": "chalk@4.1.2", + "_inBundle": false, + "_integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "_location": "/chalk", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "chalk@^4.1.0", + "name": "chalk", + "escapedName": "chalk", + "rawSpec": "^4.1.0", + "saveSpec": null, + "fetchSpec": "^4.1.0" + }, + "_requiredBy": [ + "/boxen", + "/update-notifier" + ], + "_resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "_shasum": "aac4e2b7734a740867aeb16bf02aad556a1e7a01", + "_spec": "chalk@^4.1.0", + "_where": "/home/souhail/M2-IWOCS/IOT/Arduino-Iot/node_modules/update-notifier", + "bugs": { + "url": "https://github.com/chalk/chalk/issues" + }, + "bundleDependencies": false, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "deprecated": false, + "description": "Terminal string styling done right", + "devDependencies": { + "ava": "^2.4.0", + "coveralls": "^3.0.7", + "execa": "^4.0.0", + "import-fresh": "^3.1.0", + "matcha": "^0.7.0", + "nyc": "^15.0.0", + "resolve-from": "^5.0.0", + "tsd": "^0.7.4", + "xo": "^0.28.2" + }, + "engines": { + "node": ">=10" + }, + "files": [ + "source", + "index.d.ts" + ], + "funding": "https://github.com/chalk/chalk?sponsor=1", + "homepage": "https://github.com/chalk/chalk#readme", + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "str", + "ansi", + "style", + "styles", + "tty", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "license": "MIT", + "main": "source", + "name": "chalk", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/chalk.git" + }, + "scripts": { + "bench": "matcha benchmark.js", + "test": "xo && nyc ava && tsd" + }, + "version": "4.1.2", + "xo": { + "rules": { + "unicorn/prefer-string-slice": "off", + "unicorn/prefer-includes": "off", + "@typescript-eslint/member-ordering": "off", + "no-redeclare": "off", + "unicorn/string-content": "off", + "unicorn/better-regex": "off" + } + } +} diff --git a/server/node_modules/chalk/readme.md b/server/node_modules/chalk/readme.md new file mode 100644 index 0000000..a055d21 --- /dev/null +++ b/server/node_modules/chalk/readme.md @@ -0,0 +1,341 @@ +

+
+
+ Chalk +
+
+
+

+ +> Terminal string styling done right + +[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg) [![run on repl.it](https://repl.it/badge/github/chalk/chalk)](https://repl.it/github/chalk/chalk) + + + +
+ +--- + + + +--- + +
+ +## Highlights + +- Expressive API +- Highly performant +- Ability to nest styles +- [256/Truecolor color support](#256-and-truecolor-color-support) +- Auto-detects color support +- Doesn't extend `String.prototype` +- Clean and focused +- Actively maintained +- [Used by ~50,000 packages](https://www.npmjs.com/browse/depended/chalk) as of January 1, 2020 + +## Install + +```console +$ npm install chalk +``` + +## Usage + +```js +const chalk = require('chalk'); + +console.log(chalk.blue('Hello world!')); +``` + +Chalk comes with an easy to use composable API where you just chain and nest the styles you want. + +```js +const chalk = require('chalk'); +const log = console.log; + +// Combine styled and normal strings +log(chalk.blue('Hello') + ' World' + chalk.red('!')); + +// Compose multiple styles using the chainable API +log(chalk.blue.bgRed.bold('Hello world!')); + +// Pass in multiple arguments +log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); + +// Nest styles +log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!')); + +// Nest styles of the same type even (color, underline, background) +log(chalk.green( + 'I am a green line ' + + chalk.blue.underline.bold('with a blue substring') + + ' that becomes green again!' +)); + +// ES2015 template literal +log(` +CPU: ${chalk.red('90%')} +RAM: ${chalk.green('40%')} +DISK: ${chalk.yellow('70%')} +`); + +// ES2015 tagged template literal +log(chalk` +CPU: {red ${cpu.totalPercent}%} +RAM: {green ${ram.used / ram.total * 100}%} +DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} +`); + +// Use RGB colors in terminal emulators that support it. +log(chalk.keyword('orange')('Yay for orange colored text!')); +log(chalk.rgb(123, 45, 67).underline('Underlined reddish color')); +log(chalk.hex('#DEADED').bold('Bold gray!')); +``` + +Easily define your own themes: + +```js +const chalk = require('chalk'); + +const error = chalk.bold.red; +const warning = chalk.keyword('orange'); + +console.log(error('Error!')); +console.log(warning('Warning!')); +``` + +Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args): + +```js +const name = 'Sindre'; +console.log(chalk.green('Hello %s'), name); +//=> 'Hello Sindre' +``` + +## API + +### chalk.`
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+