diff --git a/server/node_modules/.bin/node-gyp-build b/server/node_modules/.bin/node-gyp-build deleted file mode 100644 index b804ba98..00000000 --- a/server/node_modules/.bin/node-gyp-build +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../node-gyp-build/bin.js" "$@" -else - exec node "$basedir/../node-gyp-build/bin.js" "$@" -fi diff --git a/server/node_modules/.bin/node-gyp-build-optional b/server/node_modules/.bin/node-gyp-build-optional deleted file mode 100644 index cb670aab..00000000 --- a/server/node_modules/.bin/node-gyp-build-optional +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../node-gyp-build/optional.js" "$@" -else - exec node "$basedir/../node-gyp-build/optional.js" "$@" -fi diff --git a/server/node_modules/.bin/node-gyp-build-optional.cmd b/server/node_modules/.bin/node-gyp-build-optional.cmd deleted file mode 100644 index 74d85f27..00000000 --- a/server/node_modules/.bin/node-gyp-build-optional.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\node-gyp-build\optional.js" %* diff --git a/server/node_modules/.bin/node-gyp-build-optional.ps1 b/server/node_modules/.bin/node-gyp-build-optional.ps1 deleted file mode 100644 index 45995c36..00000000 --- a/server/node_modules/.bin/node-gyp-build-optional.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../node-gyp-build/optional.js" $args - } else { - & "$basedir/node$exe" "$basedir/../node-gyp-build/optional.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../node-gyp-build/optional.js" $args - } else { - & "node$exe" "$basedir/../node-gyp-build/optional.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/server/node_modules/.bin/node-gyp-build-test b/server/node_modules/.bin/node-gyp-build-test deleted file mode 100644 index bdf6dca4..00000000 --- a/server/node_modules/.bin/node-gyp-build-test +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../node-gyp-build/build-test.js" "$@" -else - exec node "$basedir/../node-gyp-build/build-test.js" "$@" -fi diff --git a/server/node_modules/.bin/node-gyp-build-test.cmd b/server/node_modules/.bin/node-gyp-build-test.cmd deleted file mode 100644 index 182a7578..00000000 --- a/server/node_modules/.bin/node-gyp-build-test.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\node-gyp-build\build-test.js" %* diff --git a/server/node_modules/.bin/node-gyp-build-test.ps1 b/server/node_modules/.bin/node-gyp-build-test.ps1 deleted file mode 100644 index 6cb0b9bd..00000000 --- a/server/node_modules/.bin/node-gyp-build-test.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../node-gyp-build/build-test.js" $args - } else { - & "$basedir/node$exe" "$basedir/../node-gyp-build/build-test.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../node-gyp-build/build-test.js" $args - } else { - & "node$exe" "$basedir/../node-gyp-build/build-test.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/server/node_modules/.bin/node-gyp-build.cmd b/server/node_modules/.bin/node-gyp-build.cmd deleted file mode 100644 index ac854a69..00000000 --- a/server/node_modules/.bin/node-gyp-build.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\node-gyp-build\bin.js" %* diff --git a/server/node_modules/.bin/node-gyp-build.ps1 b/server/node_modules/.bin/node-gyp-build.ps1 deleted file mode 100644 index c1f9a9aa..00000000 --- a/server/node_modules/.bin/node-gyp-build.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../node-gyp-build/bin.js" $args - } else { - & "$basedir/node$exe" "$basedir/../node-gyp-build/bin.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../node-gyp-build/bin.js" $args - } else { - & "node$exe" "$basedir/../node-gyp-build/bin.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/server/node_modules/.bin/nodemon b/server/node_modules/.bin/nodemon deleted file mode 100644 index c477a189..00000000 --- a/server/node_modules/.bin/nodemon +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../nodemon/bin/nodemon.js" "$@" -else - exec node "$basedir/../nodemon/bin/nodemon.js" "$@" -fi diff --git a/server/node_modules/.bin/nodemon.cmd b/server/node_modules/.bin/nodemon.cmd deleted file mode 100644 index 55acf8a4..00000000 --- a/server/node_modules/.bin/nodemon.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nodemon\bin\nodemon.js" %* diff --git a/server/node_modules/.bin/nodemon.ps1 b/server/node_modules/.bin/nodemon.ps1 deleted file mode 100644 index d4e3f5d4..00000000 --- a/server/node_modules/.bin/nodemon.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../nodemon/bin/nodemon.js" $args - } else { - & "$basedir/node$exe" "$basedir/../nodemon/bin/nodemon.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../nodemon/bin/nodemon.js" $args - } else { - & "node$exe" "$basedir/../nodemon/bin/nodemon.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/server/node_modules/.bin/nodetouch b/server/node_modules/.bin/nodetouch deleted file mode 100644 index 3e146b41..00000000 --- a/server/node_modules/.bin/nodetouch +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../touch/bin/nodetouch.js" "$@" -else - exec node "$basedir/../touch/bin/nodetouch.js" "$@" -fi diff --git a/server/node_modules/.bin/nodetouch.cmd b/server/node_modules/.bin/nodetouch.cmd deleted file mode 100644 index 8298b918..00000000 --- a/server/node_modules/.bin/nodetouch.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\touch\bin\nodetouch.js" %* diff --git a/server/node_modules/.bin/nodetouch.ps1 b/server/node_modules/.bin/nodetouch.ps1 deleted file mode 100644 index 5f68b4cb..00000000 --- a/server/node_modules/.bin/nodetouch.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../touch/bin/nodetouch.js" $args - } else { - & "$basedir/node$exe" "$basedir/../touch/bin/nodetouch.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../touch/bin/nodetouch.js" $args - } else { - & "node$exe" "$basedir/../touch/bin/nodetouch.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/server/node_modules/.bin/semver b/server/node_modules/.bin/semver deleted file mode 100644 index 97c53279..00000000 --- a/server/node_modules/.bin/semver +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) - if command -v cygpath > /dev/null 2>&1; then - basedir=`cygpath -w "$basedir"` - fi - ;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@" -else - exec node "$basedir/../semver/bin/semver.js" "$@" -fi diff --git a/server/node_modules/.bin/semver.cmd b/server/node_modules/.bin/semver.cmd deleted file mode 100644 index 9913fa9d..00000000 --- a/server/node_modules/.bin/semver.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %* diff --git a/server/node_modules/.bin/semver.ps1 b/server/node_modules/.bin/semver.ps1 deleted file mode 100644 index 314717ad..00000000 --- a/server/node_modules/.bin/semver.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args - } else { - & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../semver/bin/semver.js" $args - } else { - & "node$exe" "$basedir/../semver/bin/semver.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/server/node_modules/.package-lock.json b/server/node_modules/.package-lock.json deleted file mode 100644 index 907a71eb..00000000 --- a/server/node_modules/.package-lock.json +++ /dev/null @@ -1,1432 +0,0 @@ -{ - "name": "server", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "node_modules/@mongodb-js/saslprep": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.3.0.tgz", - "integrity": "sha512-zlayKCsIjYb7/IdfqxorK5+xUMyi4vOKcFy10wKJYc63NSdKI8mNME+uJqfatkPmOSMMUiojrL58IePKBm3gvQ==", - "dependencies": { - "sparse-bitfield": "^3.0.3" - } - }, - "node_modules/@types/webidl-conversions": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", - "integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==" - }, - "node_modules/@types/whatwg-url": { - "version": "11.0.5", - "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.5.tgz", - "integrity": "sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==", - "dependencies": { - "@types/webidl-conversions": "*" - } - }, - "node_modules/accepts": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", - "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", - "dependencies": { - "mime-types": "^3.0.0", - "negotiator": "^1.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "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==", - "license": "MIT" - }, - "node_modules/bcrypt": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-6.0.0.tgz", - "integrity": "sha512-cU8v/EGSrnH+HnxV2z0J7/blxH8gq7Xh2JFT6Aroax7UohdmiJJlxApMxtKfuI7z68NvvVcmR78k2LbT6efhRg==", - "hasInstallScript": true, - "dependencies": { - "node-addon-api": "^8.3.0", - "node-gyp-build": "^4.8.4" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/body-parser": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.1.tgz", - "integrity": "sha512-nfDwkulwiZYQIGwxdy0RUmowMhKcFVcYXUU7m4QlKYim1rUtg83xm2yjZ40QjDuc291AJjjeSc9b++AWHSgSHw==", - "license": "MIT", - "dependencies": { - "bytes": "^3.1.2", - "content-type": "^1.0.5", - "debug": "^4.4.3", - "http-errors": "^2.0.0", - "iconv-lite": "^0.7.0", - "on-finished": "^2.4.1", - "qs": "^6.14.0", - "raw-body": "^3.0.1", - "type-is": "^2.0.1" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "license": "MIT", - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/bson": { - "version": "6.10.4", - "resolved": "https://registry.npmjs.org/bson/-/bson-6.10.4.tgz", - "integrity": "sha512-WIsKqkSC0ABoBJuT1LEX+2HEvNmNKKgnTAyd0fL8qzK4SH2i9NXg+t08YtdZp/V9IZ33cxe3iV4yM0qg8lMQng==", - "engines": { - "node": ">=16.20.1" - } - }, - "node_modules/buffer-equal-constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" - }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/call-bind-apply-helpers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", - "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/call-bound": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", - "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "get-intrinsic": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "license": "MIT", - "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" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "license": "MIT" - }, - "node_modules/content-disposition": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.0.tgz", - "integrity": "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==", - "dependencies": { - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", - "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-parser": { - "version": "1.4.7", - "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.7.tgz", - "integrity": "sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw==", - "dependencies": { - "cookie": "0.7.2", - "cookie-signature": "1.0.6" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" - }, - "node_modules/cors": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", - "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", - "dependencies": { - "object-assign": "^4", - "vary": "^1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/dotenv": { - "version": "17.2.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.1.tgz", - "integrity": "sha512-kQhDYKZecqnM0fCnzI5eIv5L4cAe/iRI+HqMbO/hbRdTAeXDG+M9FjipUxNfbARuEg4iHIbhnhs78BCHNbSxEQ==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://dotenvx.com" - } - }, - "node_modules/dunder-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", - "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", - "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "es-errors": "^1.3.0", - "gopd": "^1.2.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/ecdsa-sig-formatter": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", - "dependencies": { - "safe-buffer": "^5.0.1" - } - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" - }, - "node_modules/encodeurl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", - "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/es-define-property": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", - "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-object-atoms": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", - "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", - "dependencies": { - "es-errors": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/express": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz", - "integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==", - "dependencies": { - "accepts": "^2.0.0", - "body-parser": "^2.2.0", - "content-disposition": "^1.0.0", - "content-type": "^1.0.5", - "cookie": "^0.7.1", - "cookie-signature": "^1.2.1", - "debug": "^4.4.0", - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "etag": "^1.8.1", - "finalhandler": "^2.1.0", - "fresh": "^2.0.0", - "http-errors": "^2.0.0", - "merge-descriptors": "^2.0.0", - "mime-types": "^3.0.0", - "on-finished": "^2.4.1", - "once": "^1.4.0", - "parseurl": "^1.3.3", - "proxy-addr": "^2.0.7", - "qs": "^6.14.0", - "range-parser": "^1.2.1", - "router": "^2.2.0", - "send": "^1.1.0", - "serve-static": "^2.2.0", - "statuses": "^2.0.1", - "type-is": "^2.0.1", - "vary": "^1.1.2" - }, - "engines": { - "node": ">= 18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/express/node_modules/cookie-signature": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", - "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", - "engines": { - "node": ">=6.6.0" - } - }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/finalhandler": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz", - "integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==", - "dependencies": { - "debug": "^4.4.0", - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "on-finished": "^2.4.1", - "parseurl": "^1.3.3", - "statuses": "^2.0.1" - }, - "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": "2.0.0", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", - "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-intrinsic": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", - "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.1", - "function-bind": "^1.1.2", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "math-intrinsics": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", - "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", - "dependencies": { - "dunder-proto": "^1.0.1", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "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==", - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/gopd": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", - "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/has-symbols": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", - "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/helmet": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/helmet/-/helmet-8.1.0.tgz", - "integrity": "sha512-jOiHyAZsmnr8LqoPGmCjYAaiuWwjAPLgY8ZX2XrmHawt99/u1y6RgrZMTeoPfpUbV96HOalYgz1qzkRbw54Pmg==", - "engines": { - "node": ">=18.0.0" - } - }, - "node_modules/http-errors": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", - "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", - "license": "MIT", - "dependencies": { - "depd": "~2.0.0", - "inherits": "~2.0.4", - "setprototypeof": "~1.2.0", - "statuses": "~2.0.2", - "toidentifier": "~1.0.1" - }, - "engines": { - "node": ">= 0.8" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/iconv-lite": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.1.tgz", - "integrity": "sha512-2Tth85cXwGFHfvRgZWszZSvdo+0Xsqmw8k8ZwxScfcBneNUraK+dxRxRm24nszx80Y0TVio8kKLt5sLE7ZCLlw==", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "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": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", - "license": "ISC" - }, - "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/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==", - "license": "MIT", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "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==", - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "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==", - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-promise": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", - "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==" - }, - "node_modules/jsonwebtoken": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", - "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", - "dependencies": { - "jws": "^3.2.2", - "lodash.includes": "^4.3.0", - "lodash.isboolean": "^3.0.3", - "lodash.isinteger": "^4.0.4", - "lodash.isnumber": "^3.0.3", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.once": "^4.0.0", - "ms": "^2.1.1", - "semver": "^7.5.4" - }, - "engines": { - "node": ">=12", - "npm": ">=6" - } - }, - "node_modules/jwa": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.2.tgz", - "integrity": "sha512-eeH5JO+21J78qMvTIDdBXidBd6nG2kZjg5Ohz/1fpa28Z4CcsWUzJ1ZZyFq/3z3N17aZy+ZuBoHljASbL1WfOw==", - "dependencies": { - "buffer-equal-constant-time": "^1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/jws": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.3.tgz", - "integrity": "sha512-byiJ0FLRdLdSVSReO/U4E7RoEyOCKnEnEPMjq3HxWtvzLsV08/i5RQKsFVNkCldrCaPr2vDNAOMsfs8T/Hze7g==", - "license": "MIT", - "dependencies": { - "jwa": "^1.4.2", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/kareem": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.6.3.tgz", - "integrity": "sha512-C3iHfuGUXK2u8/ipq9LfjFfXFxAZMQJJq7vLS45r3D9Y2xQ/m4S8zaR4zMLFWh9AsNPXmcFfUDhTEO8UIC/V6Q==", - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/lodash.includes": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" - }, - "node_modules/lodash.isboolean": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" - }, - "node_modules/lodash.isinteger": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" - }, - "node_modules/lodash.isnumber": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" - }, - "node_modules/lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" - }, - "node_modules/lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" - }, - "node_modules/lodash.once": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" - }, - "node_modules/math-intrinsics": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", - "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/media-typer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", - "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/memory-pager": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", - "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==" - }, - "node_modules/merge-descriptors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", - "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/mime-db": { - "version": "1.54.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", - "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz", - "integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==", - "dependencies": { - "mime-db": "^1.54.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/mongodb": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.18.0.tgz", - "integrity": "sha512-fO5ttN9VC8P0F5fqtQmclAkgXZxbIkYRTUi1j8JO6IYwvamkhtYDilJr35jOPELR49zqCJgXZWwCtW7B+TM8vQ==", - "dependencies": { - "@mongodb-js/saslprep": "^1.1.9", - "bson": "^6.10.4", - "mongodb-connection-string-url": "^3.0.0" - }, - "engines": { - "node": ">=16.20.1" - }, - "peerDependencies": { - "@aws-sdk/credential-providers": "^3.188.0", - "@mongodb-js/zstd": "^1.1.0 || ^2.0.0", - "gcp-metadata": "^5.2.0", - "kerberos": "^2.0.1", - "mongodb-client-encryption": ">=6.0.0 <7", - "snappy": "^7.2.2", - "socks": "^2.7.1" - }, - "peerDependenciesMeta": { - "@aws-sdk/credential-providers": { - "optional": true - }, - "@mongodb-js/zstd": { - "optional": true - }, - "gcp-metadata": { - "optional": true - }, - "kerberos": { - "optional": true - }, - "mongodb-client-encryption": { - "optional": true - }, - "snappy": { - "optional": true - }, - "socks": { - "optional": true - } - } - }, - "node_modules/mongodb-connection-string-url": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.2.tgz", - "integrity": "sha512-rMO7CGo/9BFwyZABcKAWL8UJwH/Kc2x0g72uhDWzG48URRax5TCIcJ7Rc3RZqffZzO/Gwff/jyKwCU9TN8gehA==", - "dependencies": { - "@types/whatwg-url": "^11.0.2", - "whatwg-url": "^14.1.0 || ^13.0.0" - } - }, - "node_modules/mongoose": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.18.0.tgz", - "integrity": "sha512-3TixPihQKBdyaYDeJqRjzgb86KbilEH07JmzV8SoSjgoskNTpa6oTBmDxeoF9p8YnWQoz7shnCyPkSV/48y3yw==", - "dependencies": { - "bson": "^6.10.4", - "kareem": "2.6.3", - "mongodb": "~6.18.0", - "mpath": "0.9.0", - "mquery": "5.0.0", - "ms": "2.1.3", - "sift": "17.1.3" - }, - "engines": { - "node": ">=16.20.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mongoose" - } - }, - "node_modules/mpath": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", - "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mquery": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz", - "integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==", - "dependencies": { - "debug": "4.x" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "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/negotiator": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", - "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/node-addon-api": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.5.0.tgz", - "integrity": "sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A==", - "engines": { - "node": "^18 || ^20 || >= 21" - } - }, - "node_modules/node-gyp-build": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", - "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, - "node_modules/nodemon": { - "version": "3.1.11", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.11.tgz", - "integrity": "sha512-is96t8F/1//UHAjNPHpbsNY46ELPpftGUoSVNXwUfMk/qdjSylYrWSu1XavVTBOn526kFiOR733ATgNBCQyH0g==", - "license": "MIT", - "dependencies": { - "chokidar": "^3.5.2", - "debug": "^4", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.1.2", - "pstree.remy": "^1.1.8", - "semver": "^7.5.3", - "simple-update-notifier": "^2.0.0", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5" - }, - "bin": { - "nodemon": "bin/nodemon.js" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/nodemon" - } - }, - "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==", - "license": "MIT", - "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": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-inspect": { - "version": "1.13.4", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", - "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "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": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dependencies": { - "wrappy": "1" - } - }, - "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": "8.2.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz", - "integrity": "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==", - "engines": { - "node": ">=16" - } - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "license": "MIT", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "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==", - "license": "MIT" - }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "engines": { - "node": ">=6" - } - }, - "node_modules/qs": { - "version": "6.14.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz", - "integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==", - "license": "BSD-3-Clause", - "dependencies": { - "side-channel": "^1.1.0" - }, - "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": "3.0.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", - "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", - "license": "MIT", - "dependencies": { - "bytes": "~3.1.2", - "http-errors": "~2.0.1", - "iconv-lite": "~0.7.0", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "license": "MIT", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/router": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", - "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", - "dependencies": { - "debug": "^4.4.0", - "depd": "^2.0.0", - "is-promise": "^4.0.0", - "parseurl": "^1.3.3", - "path-to-regexp": "^8.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "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==", - "license": "MIT" - }, - "node_modules/semver": { - "version": "7.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", - "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/send": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz", - "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==", - "dependencies": { - "debug": "^4.3.5", - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "etag": "^1.8.1", - "fresh": "^2.0.0", - "http-errors": "^2.0.0", - "mime-types": "^3.0.1", - "ms": "^2.1.3", - "on-finished": "^2.4.1", - "range-parser": "^1.2.1", - "statuses": "^2.0.1" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/serve-static": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz", - "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==", - "dependencies": { - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "parseurl": "^1.3.3", - "send": "^1.2.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, - "node_modules/side-channel": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", - "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", - "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3", - "side-channel-list": "^1.0.0", - "side-channel-map": "^1.0.1", - "side-channel-weakmap": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-list": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", - "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", - "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-map": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", - "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-weakmap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", - "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3", - "side-channel-map": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/sift": { - "version": "17.1.3", - "resolved": "https://registry.npmjs.org/sift/-/sift-17.1.3.tgz", - "integrity": "sha512-Rtlj66/b0ICeFzYTuNvX/EF1igRbbnGSvEyT79McoZa/DeGhMyC5pWKOEsZKnpkqtSeovd5FL/bjHWC3CIIvCQ==" - }, - "node_modules/simple-update-notifier": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", - "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", - "license": "MIT", - "dependencies": { - "semver": "^7.5.3" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/sparse-bitfield": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", - "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", - "dependencies": { - "memory-pager": "^1.0.2" - } - }, - "node_modules/statuses": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", - "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", - "engines": { - "node": ">= 0.8" - } - }, - "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==", - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "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==", - "license": "MIT", - "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.1", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", - "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", - "license": "ISC", - "bin": { - "nodetouch": "bin/nodetouch.js" - } - }, - "node_modules/tr46": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", - "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==", - "dependencies": { - "punycode": "^2.3.1" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/type-is": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", - "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", - "dependencies": { - "content-type": "^1.0.5", - "media-typer": "^1.1.0", - "mime-types": "^3.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/undefsafe": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", - "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", - "license": "MIT" - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/webidl-conversions": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", - "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", - "engines": { - "node": ">=12" - } - }, - "node_modules/whatwg-url": { - "version": "14.2.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz", - "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==", - "dependencies": { - "tr46": "^5.1.0", - "webidl-conversions": "^7.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" - } - } -} diff --git a/server/node_modules/@mongodb-js/saslprep/LICENSE b/server/node_modules/@mongodb-js/saslprep/LICENSE deleted file mode 100644 index 481c7a50..00000000 --- a/server/node_modules/@mongodb-js/saslprep/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2014 Dmitry Tsvettsikh - -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. \ No newline at end of file diff --git a/server/node_modules/@mongodb-js/saslprep/package.json b/server/node_modules/@mongodb-js/saslprep/package.json deleted file mode 100644 index 7b3a83d5..00000000 --- a/server/node_modules/@mongodb-js/saslprep/package.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "name": "@mongodb-js/saslprep", - "description": "SASLprep: Stringprep Profile for User Names and Passwords, rfc4013", - "keywords": [ - "sasl", - "saslprep", - "stringprep", - "rfc4013", - "4013" - ], - "author": "Dmitry Tsvettsikh ", - "publishConfig": { - "access": "public" - }, - "main": "dist/node.js", - "bugs": { - "url": "https://jira.mongodb.org/projects/COMPASS/issues", - "email": "compass@mongodb.com" - }, - "homepage": "https://github.com/mongodb-js/devtools-shared/tree/main/packages/saslprep", - "version": "1.3.0", - "repository": { - "type": "git", - "url": "https://github.com/mongodb-js/devtools-shared.git" - }, - "files": [ - "dist" - ], - "license": "MIT", - "exports": { - "browser": { - "types": "./dist/browser.d.ts", - "default": "./dist/browser.js" - }, - "import": { - "types": "./dist/node.d.ts", - "default": "./dist/.esm-wrapper.mjs" - }, - "require": { - "types": "./dist/node.d.ts", - "default": "./dist/node.js" - } - }, - "types": "./dist/node.d.ts", - "scripts": { - "gen-code-points": "ts-node src/generate-code-points.ts src/code-points-data.ts src/code-points-data-browser.ts", - "bootstrap": "npm run compile", - "prepublishOnly": "npm run compile", - "compile": "npm run gen-code-points && tsc -p tsconfig.json && gen-esm-wrapper . ./dist/.esm-wrapper.mjs", - "typecheck": "tsc --noEmit", - "eslint": "eslint", - "prettier": "prettier", - "lint": "npm run eslint . && npm run prettier -- --check .", - "depcheck": "depcheck", - "check": "npm run typecheck && npm run lint && npm run depcheck", - "check-ci": "npm run check", - "test": "mocha", - "test-cov": "nyc -x \"**/*.spec.*\" --reporter=lcov --reporter=text --reporter=html npm run test", - "test-watch": "npm run test -- --watch", - "test-ci": "npm run test-cov", - "reformat": "npm run prettier -- --write ." - }, - "dependencies": { - "sparse-bitfield": "^3.0.3" - }, - "devDependencies": { - "@mongodb-js/eslint-config-devtools": "0.9.11", - "@mongodb-js/mocha-config-devtools": "^1.0.5", - "@mongodb-js/prettier-config-devtools": "^1.0.2", - "@mongodb-js/tsconfig-devtools": "^1.0.3", - "@types/chai": "^4.2.21", - "@types/mocha": "^9.1.1", - "@types/node": "^22.15.30", - "@types/sinon-chai": "^3.2.5", - "@types/sparse-bitfield": "^3.0.1", - "chai": "^4.5.0", - "depcheck": "^1.4.7", - "eslint": "^7.25.0", - "gen-esm-wrapper": "^1.1.3", - "mocha": "^8.4.0", - "nyc": "^15.1.0", - "prettier": "^3.5.3", - "sinon": "^9.2.3", - "typescript": "^5.0.4" - }, - "gitHead": "005f6263e3a329d916f6936c9adcf35db47cfe9f" -} diff --git a/server/node_modules/@mongodb-js/saslprep/readme.md b/server/node_modules/@mongodb-js/saslprep/readme.md deleted file mode 100644 index 28539eda..00000000 --- a/server/node_modules/@mongodb-js/saslprep/readme.md +++ /dev/null @@ -1,29 +0,0 @@ -# saslprep - -_Note: This is a fork of the original [`saslprep`](https://www.npmjs.com/package/saslprep) npm package -and provides equivalent functionality._ - -Stringprep Profile for User Names and Passwords, [rfc4013](https://tools.ietf.org/html/rfc4013) - -### Usage - -```js -const saslprep = require('@mongodb-js/saslprep'); - -saslprep('password\u00AD'); // password -saslprep('password\u0007'); // Error: prohibited character -``` - -### API - -##### `saslprep(input: String, opts: Options): String` - -Normalize user name or password. - -##### `Options.allowUnassigned: bool` - -A special behavior for unassigned code points, see https://tools.ietf.org/html/rfc4013#section-2.5. Disabled by default. - -## License - -MIT, 2017-2019 (c) Dmitriy Tsvettsikh diff --git a/server/node_modules/@types/webidl-conversions/LICENSE b/server/node_modules/@types/webidl-conversions/LICENSE deleted file mode 100644 index 9e841e7a..00000000 --- a/server/node_modules/@types/webidl-conversions/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - 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/@types/webidl-conversions/README.md b/server/node_modules/@types/webidl-conversions/README.md deleted file mode 100644 index a0f3f9de..00000000 --- a/server/node_modules/@types/webidl-conversions/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Installation -> `npm install --save @types/webidl-conversions` - -# Summary -This package contains type definitions for webidl-conversions (https://github.com/jsdom/webidl-conversions#readme). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webidl-conversions. - -### Additional Details - * Last updated: Tue, 07 Nov 2023 15:11:36 GMT - * Dependencies: none - -# Credits -These definitions were written by [ExE Boss](https://github.com/ExE-Boss), and [BendingBender](https://github.com/BendingBender). diff --git a/server/node_modules/@types/webidl-conversions/index.d.ts b/server/node_modules/@types/webidl-conversions/index.d.ts deleted file mode 100644 index bcf395ab..00000000 --- a/server/node_modules/@types/webidl-conversions/index.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -declare namespace WebIDLConversions { - interface Globals { - [key: string]: unknown; - - Number: (value?: unknown) => number; - String: (value?: unknown) => string; - TypeError: new(message?: string) => TypeError; - } - - interface Options { - context?: string | undefined; - globals?: Globals | undefined; - } - - interface IntegerOptions extends Options { - enforceRange?: boolean | undefined; - clamp?: boolean | undefined; - } - - interface StringOptions extends Options { - treatNullAsEmptyString?: boolean | undefined; - } - - interface BufferSourceOptions extends Options { - allowShared?: boolean | undefined; - } - - type IntegerConversion = (V: unknown, opts?: IntegerOptions) => number; - type StringConversion = (V: unknown, opts?: StringOptions) => string; - type NumberConversion = (V: unknown, opts?: Options) => number; -} - -declare const WebIDLConversions: { - any(V: V, opts?: WebIDLConversions.Options): V; - undefined(V?: unknown, opts?: WebIDLConversions.Options): void; - boolean(V: unknown, opts?: WebIDLConversions.Options): boolean; - - byte(V: unknown, opts?: WebIDLConversions.IntegerOptions): number; - octet(V: unknown, opts?: WebIDLConversions.IntegerOptions): number; - - short(V: unknown, opts?: WebIDLConversions.IntegerOptions): number; - ["unsigned short"](V: unknown, opts?: WebIDLConversions.IntegerOptions): number; - - long(V: unknown, opts?: WebIDLConversions.IntegerOptions): number; - ["unsigned long"](V: unknown, opts?: WebIDLConversions.IntegerOptions): number; - - ["long long"](V: unknown, opts?: WebIDLConversions.IntegerOptions): number; - ["unsigned long long"](V: unknown, opts?: WebIDLConversions.IntegerOptions): number; - - double(V: unknown, opts?: WebIDLConversions.Options): number; - ["unrestricted double"](V: unknown, opts?: WebIDLConversions.Options): number; - - float(V: unknown, opts?: WebIDLConversions.Options): number; - ["unrestricted float"](V: unknown, opts?: WebIDLConversions.Options): number; - - DOMString(V: unknown, opts?: WebIDLConversions.StringOptions): string; - ByteString(V: unknown, opts?: WebIDLConversions.StringOptions): string; - USVString(V: unknown, opts?: WebIDLConversions.StringOptions): string; - - object(V: V, opts?: WebIDLConversions.Options): V extends object ? V : V & object; - ArrayBuffer( - V: unknown, - opts?: WebIDLConversions.BufferSourceOptions & { allowShared?: false | undefined }, - ): ArrayBuffer; - ArrayBuffer(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): ArrayBufferLike; - DataView(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): DataView; - - Int8Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Int8Array; - Int16Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Int16Array; - Int32Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Int32Array; - - Uint8Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Uint8Array; - Uint16Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Uint16Array; - Uint32Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Uint32Array; - Uint8ClampedArray(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Uint8ClampedArray; - - Float32Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Float32Array; - Float64Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Float64Array; - - ArrayBufferView(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): ArrayBufferView; - BufferSource( - V: unknown, - opts?: WebIDLConversions.BufferSourceOptions & { allowShared?: false | undefined }, - ): ArrayBuffer | ArrayBufferView; - BufferSource(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): ArrayBufferLike | ArrayBufferView; - - DOMTimeStamp(V: unknown, opts?: WebIDLConversions.Options): number; -}; - -// This can't use ES6 style exports, as those can't have spaces in export names. -export = WebIDLConversions; diff --git a/server/node_modules/@types/webidl-conversions/package.json b/server/node_modules/@types/webidl-conversions/package.json deleted file mode 100644 index 21fdb958..00000000 --- a/server/node_modules/@types/webidl-conversions/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "@types/webidl-conversions", - "version": "7.0.3", - "description": "TypeScript definitions for webidl-conversions", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webidl-conversions", - "license": "MIT", - "contributors": [ - { - "name": "ExE Boss", - "githubUsername": "ExE-Boss", - "url": "https://github.com/ExE-Boss" - }, - { - "name": "BendingBender", - "githubUsername": "BendingBender", - "url": "https://github.com/BendingBender" - } - ], - "main": "", - "types": "index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/webidl-conversions" - }, - "scripts": {}, - "dependencies": {}, - "typesPublisherContentHash": "ff1514e10869784e8b7cca9c4099a4213d3f14b48c198b1bf116300df94bf608", - "typeScriptVersion": "4.5" -} \ No newline at end of file diff --git a/server/node_modules/@types/whatwg-url/LICENSE b/server/node_modules/@types/whatwg-url/LICENSE deleted file mode 100644 index 9e841e7a..00000000 --- a/server/node_modules/@types/whatwg-url/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - 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/@types/whatwg-url/README.md b/server/node_modules/@types/whatwg-url/README.md deleted file mode 100644 index 75b056cf..00000000 --- a/server/node_modules/@types/whatwg-url/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Installation -> `npm install --save @types/whatwg-url` - -# Summary -This package contains type definitions for whatwg-url (https://github.com/jsdom/whatwg-url#readme). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/whatwg-url. - -### Additional Details - * Last updated: Sat, 18 May 2024 21:06:54 GMT - * Dependencies: [@types/webidl-conversions](https://npmjs.com/package/@types/webidl-conversions) - -# Credits -These definitions were written by [Alexander Marks](https://github.com/aomarks), [ExE Boss](https://github.com/ExE-Boss), and [BendingBender](https://github.com/BendingBender). diff --git a/server/node_modules/@types/whatwg-url/index.d.ts b/server/node_modules/@types/whatwg-url/index.d.ts deleted file mode 100644 index 7c554cca..00000000 --- a/server/node_modules/@types/whatwg-url/index.d.ts +++ /dev/null @@ -1,169 +0,0 @@ -/// -/** https://url.spec.whatwg.org/#url-representation */ -export interface URLRecord { - scheme: string; - username: string; - password: string; - host: string | number | IPv6Address | null; - port: number | null; - path: string | string[]; - query: string | null; - fragment: string | null; -} - -/** https://url.spec.whatwg.org/#concept-ipv6 */ -export type IPv6Address = [number, number, number, number, number, number, number, number]; - -/** https://url.spec.whatwg.org/#url-class */ -export class URL { - constructor(url: string, base?: string | URL); - - get href(): string; - set href(V: string); - - get origin(): string; - - get protocol(): string; - set protocol(V: string); - - get username(): string; - set username(V: string); - - get password(): string; - set password(V: string); - - get host(): string; - set host(V: string); - - get hostname(): string; - set hostname(V: string); - - get port(): string; - set port(V: string); - - get pathname(): string; - set pathname(V: string); - - get search(): string; - set search(V: string); - - get searchParams(): URLSearchParams; - - get hash(): string; - set hash(V: string); - - toJSON(): string; - - readonly [Symbol.toStringTag]: "URL"; -} - -/** https://url.spec.whatwg.org/#interface-urlsearchparams */ -export class URLSearchParams { - constructor( - init?: - | ReadonlyArray - | Iterable - | { readonly [name: string]: string } - | string, - ); - - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - - keys(): IterableIterator; - values(): IterableIterator; - entries(): IterableIterator<[name: string, value: string]>; - forEach( - callback: (this: THIS_ARG, value: string, name: string, searchParams: this) => void, - thisArg?: THIS_ARG, - ): void; - - readonly [Symbol.toStringTag]: "URLSearchParams"; - [Symbol.iterator](): IterableIterator<[name: string, value: string]>; -} - -/** https://url.spec.whatwg.org/#concept-url-parser */ -export function parseURL(input: string, options?: { readonly baseURL?: URLRecord | undefined }): URLRecord | null; - -/** https://url.spec.whatwg.org/#concept-basic-url-parser */ -export function basicURLParse( - input: string, - options?: { - baseURL?: URLRecord | undefined; - url?: URLRecord | undefined; - stateOverride?: StateOverride | undefined; - }, -): URLRecord | null; - -/** https://url.spec.whatwg.org/#scheme-start-state */ -export type StateOverride = - | "scheme start" - | "scheme" - | "no scheme" - | "special relative or authority" - | "path or authority" - | "relative" - | "relative slash" - | "special authority slashes" - | "special authority ignore slashes" - | "authority" - | "host" - | "hostname" - | "port" - | "file" - | "file slash" - | "file host" - | "path start" - | "path" - | "opaque path" - | "query" - | "fragment"; - -/** https://url.spec.whatwg.org/#concept-url-serializer */ -export function serializeURL(urlRecord: URLRecord, excludeFragment?: boolean): string; - -/** https://url.spec.whatwg.org/#concept-host-serializer */ -export function serializeHost(host: string | number | IPv6Address): string; - -/** https://url.spec.whatwg.org/#url-path-serializer */ -export function serializePath(urlRecord: URLRecord): string; - -/** https://url.spec.whatwg.org/#serialize-an-integer */ -export function serializeInteger(number: number): string; - -/** https://html.spec.whatwg.org#ascii-serialisation-of-an-origin */ -export function serializeURLOrigin(urlRecord: URLRecord): string; - -/** https://url.spec.whatwg.org/#set-the-username */ -export function setTheUsername(urlRecord: URLRecord, username: string): void; - -/** https://url.spec.whatwg.org/#set-the-password */ -export function setThePassword(urlRecord: URLRecord, password: string): void; - -/** https://url.spec.whatwg.org/#url-opaque-path */ -export function hasAnOpaquePath(urlRecord: URLRecord): boolean; - -/** https://url.spec.whatwg.org/#cannot-have-a-username-password-port */ -export function cannotHaveAUsernamePasswordPort(urlRecord: URLRecord): boolean; - -/** https://url.spec.whatwg.org/#percent-decode */ -export function percentDecodeBytes(buffer: TypedArray): Uint8Array; - -/** https://url.spec.whatwg.org/#string-percent-decode */ -export function percentDecodeString(string: string): Uint8Array; - -export type TypedArray = - | Uint8Array - | Uint8ClampedArray - | Uint16Array - | Uint32Array - | Int8Array - | Int16Array - | Int32Array - | Float32Array - | Float64Array; diff --git a/server/node_modules/@types/whatwg-url/package.json b/server/node_modules/@types/whatwg-url/package.json deleted file mode 100644 index 418e8b67..00000000 --- a/server/node_modules/@types/whatwg-url/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "@types/whatwg-url", - "version": "11.0.5", - "description": "TypeScript definitions for whatwg-url", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/whatwg-url", - "license": "MIT", - "contributors": [ - { - "name": "Alexander Marks", - "githubUsername": "aomarks", - "url": "https://github.com/aomarks" - }, - { - "name": "ExE Boss", - "githubUsername": "ExE-Boss", - "url": "https://github.com/ExE-Boss" - }, - { - "name": "BendingBender", - "githubUsername": "BendingBender", - "url": "https://github.com/BendingBender" - } - ], - "main": "", - "types": "index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/whatwg-url" - }, - "scripts": {}, - "dependencies": { - "@types/webidl-conversions": "*" - }, - "typesPublisherContentHash": "c6cfac1bbd7b2ef315fdad11fc9bdb6a8f0ae2b1c3ff057cfca7bc9880eeaa9d", - "typeScriptVersion": "4.7" -} \ No newline at end of file diff --git a/server/node_modules/@types/whatwg-url/webidl2js-wrapper.d.ts b/server/node_modules/@types/whatwg-url/webidl2js-wrapper.d.ts deleted file mode 100644 index 96029b76..00000000 --- a/server/node_modules/@types/whatwg-url/webidl2js-wrapper.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import * as URL from "./lib/URL"; -import * as URLSearchParams from "./lib/URLSearchParams"; - -export { URL, URLSearchParams }; diff --git a/server/node_modules/accepts/HISTORY.md b/server/node_modules/accepts/HISTORY.md deleted file mode 100644 index 627a81d0..00000000 --- a/server/node_modules/accepts/HISTORY.md +++ /dev/null @@ -1,250 +0,0 @@ -2.0.0 / 2024-08-31 -================== - - * Drop node <18 support - * deps: mime-types@^3.0.0 - * deps: negotiator@^1.0.0 - -1.3.8 / 2022-02-02 -================== - - * deps: mime-types@~2.1.34 - - deps: mime-db@~1.51.0 - * deps: negotiator@0.6.3 - -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 deleted file mode 100644 index 06166077..00000000 --- a/server/node_modules/accepts/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -(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 deleted file mode 100644 index f3f10c4a..00000000 --- a/server/node_modules/accepts/README.md +++ /dev/null @@ -1,140 +0,0 @@ -# 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][github-actions-ci-image]][github-actions-ci-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 type 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 -[github-actions-ci-image]: https://badgen.net/github/checks/jshttp/accepts/master?label=ci -[github-actions-ci-url]: https://github.com/jshttp/accepts/actions/workflows/ci.yml -[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 diff --git a/server/node_modules/accepts/index.js b/server/node_modules/accepts/index.js deleted file mode 100644 index 4f2840c0..00000000 --- a/server/node_modules/accepts/index.js +++ /dev/null @@ -1,238 +0,0 @@ -/*! - * 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 {Boolean} - * @private - */ - -function validMime (type) { - return typeof type === 'string' -} diff --git a/server/node_modules/accepts/package.json b/server/node_modules/accepts/package.json deleted file mode 100644 index b35b262d..00000000 --- a/server/node_modules/accepts/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "accepts", - "description": "Higher-level content negotiation", - "version": "2.0.0", - "contributors": [ - "Douglas Christopher Wilson ", - "Jonathan Ong (http://jongleberry.com)" - ], - "license": "MIT", - "repository": "jshttp/accepts", - "dependencies": { - "mime-types": "^3.0.0", - "negotiator": "^1.0.0" - }, - "devDependencies": { - "deep-equal": "1.0.1", - "eslint": "7.32.0", - "eslint-config-standard": "14.1.1", - "eslint-plugin-import": "2.25.4", - "eslint-plugin-markdown": "2.2.1", - "eslint-plugin-node": "11.1.0", - "eslint-plugin-promise": "4.3.1", - "eslint-plugin-standard": "4.1.0", - "mocha": "9.2.0", - "nyc": "15.1.0" - }, - "files": [ - "LICENSE", - "HISTORY.md", - "index.js" - ], - "engines": { - "node": ">= 0.6" - }, - "scripts": { - "lint": "eslint .", - "test": "mocha --reporter spec --check-leaks --bail test/", - "test-ci": "nyc --reporter=lcov --reporter=text npm test", - "test-cov": "nyc --reporter=html --reporter=text npm test" - }, - "keywords": [ - "content", - "negotiation", - "accept", - "accepts" - ] -} diff --git a/server/node_modules/anymatch/LICENSE b/server/node_modules/anymatch/LICENSE deleted file mode 100644 index 491766ca..00000000 --- a/server/node_modules/anymatch/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 1dd67f53..00000000 --- a/server/node_modules/anymatch/README.md +++ /dev/null @@ -1,87 +0,0 @@ -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 deleted file mode 100644 index 3ef7eaad..00000000 --- a/server/node_modules/anymatch/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -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: null, returnIndex: true | PicomatchOptions): 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 deleted file mode 100644 index 8eb73e9c..00000000 --- a/server/node_modules/anymatch/index.js +++ /dev/null @@ -1,104 +0,0 @@ -'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, false); - - 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 deleted file mode 100644 index 2cb2307e..00000000 --- a/server/node_modules/anymatch/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "anymatch", - "version": "3.1.3", - "description": "Matches strings against configurable strings, globs, regular expressions, and/or functions", - "files": [ - "index.js", - "index.d.ts" - ], - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "author": { - "name": "Elan Shanker", - "url": "https://github.com/es128" - }, - "license": "ISC", - "homepage": "https://github.com/micromatch/anymatch", - "repository": { - "type": "git", - "url": "https://github.com/micromatch/anymatch" - }, - "keywords": [ - "match", - "any", - "string", - "file", - "fs", - "list", - "glob", - "regex", - "regexp", - "regular", - "expression", - "function" - ], - "scripts": { - "test": "nyc mocha", - "mocha": "mocha" - }, - "devDependencies": { - "mocha": "^6.1.3", - "nyc": "^14.0.0" - }, - "engines": { - "node": ">= 8" - } -} diff --git a/server/node_modules/balanced-match/.github/FUNDING.yml b/server/node_modules/balanced-match/.github/FUNDING.yml deleted file mode 100644 index cea8b16e..00000000 --- a/server/node_modules/balanced-match/.github/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ -tidelift: "npm/balanced-match" -patreon: juliangruber diff --git a/server/node_modules/balanced-match/LICENSE.md b/server/node_modules/balanced-match/LICENSE.md deleted file mode 100644 index 2cdc8e41..00000000 --- a/server/node_modules/balanced-match/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -(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 deleted file mode 100644 index d2a48b6b..00000000 --- a/server/node_modules/balanced-match/README.md +++ /dev/null @@ -1,97 +0,0 @@ -# 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 deleted file mode 100644 index c67a6460..00000000 --- a/server/node_modules/balanced-match/index.js +++ /dev/null @@ -1,62 +0,0 @@ -'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 deleted file mode 100644 index ce6073e0..00000000 --- a/server/node_modules/balanced-match/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "balanced-match", - "description": "Match balanced character pairs, like \"{\" and \"}\"", - "version": "1.0.2", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/balanced-match.git" - }, - "homepage": "https://github.com/juliangruber/balanced-match", - "main": "index.js", - "scripts": { - "test": "tape test/test.js", - "bench": "matcha test/bench.js" - }, - "devDependencies": { - "matcha": "^0.7.0", - "tape": "^4.6.0" - }, - "keywords": [ - "match", - "regexp", - "test", - "balanced", - "parse" - ], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT", - "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" - ] - } -} diff --git a/server/node_modules/bcrypt/.dockerignore b/server/node_modules/bcrypt/.dockerignore deleted file mode 100644 index 01f4eb7a..00000000 --- a/server/node_modules/bcrypt/.dockerignore +++ /dev/null @@ -1,6 +0,0 @@ -.git/ -.vscode/ -Dockerfile* -prebuilds/ -node_modules/ -build*/ diff --git a/server/node_modules/bcrypt/.editorconfig b/server/node_modules/bcrypt/.editorconfig deleted file mode 100644 index 4e12f93b..00000000 --- a/server/node_modules/bcrypt/.editorconfig +++ /dev/null @@ -1,19 +0,0 @@ -root = true - -[*] -indent_style = space -indent_size = 4 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[{package.json,*.yml}] -indent_style = space -indent_size = 2 - -[appveyor.yml] -end_of_line = crlf - -[*.md] -trim_trailing_whitespace = false diff --git a/server/node_modules/bcrypt/.github/workflows/build-pack-publish.yml b/server/node_modules/bcrypt/.github/workflows/build-pack-publish.yml deleted file mode 100644 index 9b14ee12..00000000 --- a/server/node_modules/bcrypt/.github/workflows/build-pack-publish.yml +++ /dev/null @@ -1,110 +0,0 @@ -name: Prebuildify, package, publish - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - release: - types: [ prereleased, released ] - -jobs: - build-linux: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - # This is unsafe, but we really don't use any other native dependencies - - run: npm ci - - run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/almalinux-devtoolset11 npx prebuildify --napi --tag-libc --strip --target=node@18.0.0 - - run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/alpine npx prebuildify --napi --tag-libc --strip --target=node@18.0.0 - - run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/linux-armv7 npx prebuildify --napi --tag-libc --strip --target=node@18.0.0 - - run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/linux-armv7l-musl npx prebuildify --napi --tag-libc --strip --target=node@18.0.0 - - run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/linux-arm64 npx prebuildify --napi --tag-libc --strip --target=node@18.0.0 - - run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/linux-arm64-musl npx prebuildify --napi --tag-libc --strip --target=node@18.0.0 - - run: find prebuilds - - uses: actions/upload-artifact@v4 - with: - name: prebuild-linux - path: ./prebuilds/ - - build-windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - registry-url: 'https://registry.npmjs.org' - - run: npm ci - - run: npx prebuildify --napi --strip --arch=x64 --target=node@18.0.0 - - run: npx prebuildify --napi --strip --arch=arm64 --target=node@20.0.0 - - run: dir prebuilds - - uses: actions/upload-artifact@v4 - with: - name: prebuild-windows - path: ./prebuilds/ - - build-macos: - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - registry-url: 'https://registry.npmjs.org' - - run: npm ci - - run: npx prebuildify --napi --strip --arch=arm64 --target=node@18.0.0 - - run: npx prebuildify --napi --strip --arch=x64 --target=node@18.0.0 - - run: find prebuilds - - uses: actions/upload-artifact@v4 - with: - name: prebuild-macos - path: ./prebuilds/ - - pack: - needs: - - build-linux - - build-windows - - build-macos - runs-on: ubuntu-latest - outputs: - PACK_FILE: ${{ steps.pack.outputs.PACK_FILE }} - steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 - with: - path: /tmp/prebuilds/ - - name: Coalesce prebuilds from build matrix - run: | - mkdir prebuilds - for d in /tmp/prebuilds/*; do - cp -Rav $d/* prebuilds/ - done - - run: chmod a+x prebuilds/*/*.node && find prebuilds -executable -type f - - id: pack - name: Prepare NPM package - run: | - echo "PACK_FILE=$(npm pack)" >> "$GITHUB_OUTPUT" - - uses: actions/upload-artifact@v4 - with: - name: package-tgz - path: ${{ steps.pack.outputs.PACK_FILE }} - if-no-files-found: 'error' - - test-package: - needs: pack - strategy: - matrix: - node-version: [ 18, 20, 22, 23 ] - os: [ ubuntu-latest, windows-latest, macos-latest ] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - registry-url: 'https://registry.npmjs.org' - - uses: actions/download-artifact@v4 - with: - name: package-tgz - - run: npm install ${{ needs.pack.outputs.PACK_FILE }} - - run: node -e "const b = require('bcrypt'); const h = b.hashSync('hello', 10); console.log(h, b.compareSync('hello', h))" diff --git a/server/node_modules/bcrypt/.github/workflows/ci.yaml b/server/node_modules/bcrypt/.github/workflows/ci.yaml deleted file mode 100644 index 77c4e5a9..00000000 --- a/server/node_modules/bcrypt/.github/workflows/ci.yaml +++ /dev/null @@ -1,42 +0,0 @@ -name: ci - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - run: npm ci - - name: Test - run: npm test - - build-alpine: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18, 20, 22] - container: - image: node:${{ matrix.node-version }}-alpine - steps: - - uses: actions/checkout@v4 - - name: Install dependencies - run: | - apk add make g++ python3 - - run: npm ci - - name: Test - run: | - npm test --unsafe-perm diff --git a/server/node_modules/bcrypt/CHANGELOG.md b/server/node_modules/bcrypt/CHANGELOG.md deleted file mode 100644 index eab713b4..00000000 --- a/server/node_modules/bcrypt/CHANGELOG.md +++ /dev/null @@ -1,184 +0,0 @@ -# 6.0.0 (2025-02-28) - * Drop support for NodeJS <= 16 - * Remove `node-pre-gyp` in favor of `prebuildify`, prebuilt binaries are now shipped with the package - * Update `node-addon-api` to 8.3.0 - * Update JS code to newer ES syntax - -# 5.1.0 (2022-10-06) - * Update `node-pre-gyp` to 1.0.11 - -# 5.1.0 (2022-10-06) - * Update `node-pre-gyp` to 1.0.10 - * Replace `nodeunit` with `jest` as the testing library - -# 5.0.1 (2021-02-22) - - * Update `node-pre-gyp` to 1.0.0 - -# 5.0.0 (2020-06-02) - - * Fix the bcrypt "wrap-around" bug. It affects passwords with lengths >= 255. - It is uncommon but it's a bug nevertheless. Previous attempts to fix the bug - was unsuccessful. - * Experimental support for z/OS - * Fix a bug related to NUL in password input - * Update `node-pre-gyp` to 0.15.0 - -# 4.0.1 (2020-02-27) - - * Fix compilation errors in Alpine linux - -# 4.0.0 (2020-02-17) - - * Switch to NAPI bcrypt - * Drop support for NodeJS 8 - -# 3.0.8 (2019-12-31) - - * Update `node-pre-gyp` to 0.14 - * Pre-built binaries for NodeJS 13 - -# 3.0.7 (2019-10-18) - - * Update `nan` to 2.14.0 - * Update `node-pre-gyp` to 0.13 - -# 3.0.6 (2019-04-11) - - * Update `nan` to 2.13.2 - -# 3.0.5 (2019-03-19) - - * Update `nan` to 2.13.1 - * NodeJS 12 compatibility - * Remove `node-pre-gyp` from bundled dependencies - -# 3.0.4-napi (2019-03-08) - - * Sync N-API bcrypt with NAN bcrypt - -# 3.0.4 (2019-02-07) - - * Fix GCC, NAN and V8 deprecation warnings - -# 3.0.3 (2018-12-19) - - * Update `nan` to 2.12.1 - -# 3.0.2 (2018-10-18) - - * Update `nan` to 2.11.1 - -# 3.0.1 (2018-09-20) - - * Update `nan` to 2.11.0 - -# 3.0.0 (2018-07-06) - - * Drop support for NodeJS <= 4 - -# 2.0.1 (2018-04-20) - - * Update `node-pre-gyp` to allow downloading prebuilt modules - -# 2.0.0 (2018-04-07) - - * Make `2b` the default bcrypt version - -# 1.1.0-napi (2018-01-21) - - * Initial support for [N-API](https://nodejs.org/api/n-api.html) - -# 1.0.3 (2016-08-23) - - * update to nan v2.6.2 for NodeJS 8 support - * Fix: use npm scripts instead of node-gyp directly. - -# 1.0.2 (2016-12-31) - - * Fix `compare` promise rejection with invalid arguments - -# 1.0.1 (2016-12-07) - - * Fix destructuring imports with promises - -# 1.0.0 (2016-12-04) - - * add Promise support (commit 2488473) - -# 0.8.7 (2016-06-09) - - * update nan to 2.3.5 for improved node v6 support - -# 0.8.6 (2016-04-20) - - * update nan for node v6 support - -# 0.8.5 (2015-08-12) - - * update to nan v2 (adds support for iojs 3) - -# 0.8.4 (2015-07-24) - - * fix deprecation warning for the Encode API - -# 0.8.3 (2015-05-06) - - * update nan to 1.8.4 for iojs 2.x support - -# 0.8.2 (2015-03-28) - - * always use callback for generating random bytes to avoid blocking - -# 0.8.1 (2015-01-18) - * update NaN to 1.5.0 for iojs support - -# 0.8.0 (2014-08-03) - * migrate to NAN for bindings - -# v0.5.0 - * Fix for issue around empty string params throwing Errors. - * Method deprecation. - * Upgrade from libeio/ev to libuv. (shtylman) - ** --- NOTE --- Breaks 0.4.x compatability - * EV_MULTIPLICITY compile flag. - -# v0.4.1 - * Thread safety fix around OpenSSL (GH-32). (bnoordhuis - through node) - * C++ code changes using delete and new instead of malloc and free. (shtylman) - * Compile options for speed, zoom. (shtylman) - * Move much of the type and variable checking to the JS. (shtylman) - -# v0.4.0 - * Added getRounds function that will tell you the number of rounds within a hash/salt - -# v0.3.2 - * Fix api issue with async salt gen first param - -# v0.3.1 - * Compile under node 0.5.x - -# v0.3.0 - * Internal Refactoring - * Remove pthread dependencies and locking - * Fix compiler warnings and a memory bug - -# v0.2.4 - * Use threadsafe functions instead of pthread mutexes - * salt validation to make sure the salt is of the correct size and format - -# v0.2.3 - * cygwin support - -# v0.2.2 - * Remove dependency on libbsd, use libssl instead - -# v0.2.0 - * Added async functionality - * API changes - * hashpw -> encrypt - * all old sync methods now end with _sync - * Removed libbsd(arc4random) dependency...now uses openssl which is more widely spread - -# v0.1.2 - * Security fix. Wasn't reading rounds in properly and was always only using 4 rounds diff --git a/server/node_modules/bcrypt/Dockerfile b/server/node_modules/bcrypt/Dockerfile deleted file mode 100644 index 2802bafa..00000000 --- a/server/node_modules/bcrypt/Dockerfile +++ /dev/null @@ -1,57 +0,0 @@ -# Usage: -# -# docker build -t bcryptjs-builder . -# CONTAINER=$(docker create bcryptjs-builder) -# # Then copy the artifact to your host: -# docker cp "$CONTAINER:/usr/local/opt/bcrypt-js/prebuilds" . -# docker rm "$CONTAINER" -# -# Use --platform to build cross-platform i.e. for ARM: -# -# docker build -t bcryptjs-builder --platform "linux/arm64/v8" . -# CONTAINER=$docker create --platform "linux/arm64/v8" bcryptjs-builder) -# # this copies the prebuilds/linux-arm artifacts -# docker cp "$CONTAINER:/usr/local/opt/bcrypt-js/prebuilds" . -# docker rm "$CONTAINER" - - -ARG FROM_IMAGE=node:18-bullseye -#ARG FROM_IMAGE=arm32v7/node:16-bullseye -#ARG FROM_IMAGE=arm64v8/node:16-bullseye -FROM ${FROM_IMAGE} - -ENV project bcrypt-js -ENV DEBIAN_FRONTEND noninteractive -ENV LC_ALL en_US.UTF-8 -ENV LANG ${LC_ALL} - -RUN echo "#log: ${project}: Setup system" \ - && set -x \ - && apt-get update -y \ - && apt-get install -y \ - build-essential \ - python3 \ - && apt-get clean \ - && update-alternatives --install /usr/local/bin/python python /usr/bin/python3 20 \ - && npm i -g prebuildify@5 node-gyp@9 \ - && sync - -ADD . /usr/local/opt/${project} -WORKDIR /usr/local/opt/${project} - -RUN echo "#log: ${project}: Running build" \ - && set -x \ - && npm ci \ - && npm run build - -ARG RUN_TESTS=true -ARG TEST_TIMEOUT_SECONDS= - -RUN if "${RUN_TESTS}"; then \ - echo "#log ${project}: Running tests" \ - && npm test; \ - else \ - echo "#log ${project}: Tests were skipped!"; \ - fi - -CMD /bin/bash -l diff --git a/server/node_modules/bcrypt/Dockerfile-alpine b/server/node_modules/bcrypt/Dockerfile-alpine deleted file mode 100644 index 7570cfe8..00000000 --- a/server/node_modules/bcrypt/Dockerfile-alpine +++ /dev/null @@ -1,41 +0,0 @@ -# Usage: -# -# docker build -t bcryptjs-linux-alpine-builder -f Dockerfile-alpine . -# CONTAINER=$(docker create bcryptjs-linux-alpine-builder) -# # Then copy the artifact to your host: -# docker cp "$CONTAINER:/usr/local/opt/bcrypt-js/prebuilds" . -# docker rm "$CONTAINER" - -ARG FROM_IMAGE=node:18-alpine -FROM ${FROM_IMAGE} - -ENV project bcrypt-js -ENV DEBIAN_FRONTEND noninteractive -ENV LC_ALL en_US.UTF-8 -ENV LANG ${LC_ALL} - -RUN echo "#log: ${project}: Setup system" \ - && set -x \ - && apk add --update build-base python3 \ - && npm i -g prebuildify@5 node-gyp@9 \ - && sync - -ADD . /usr/local/opt/${project} -WORKDIR /usr/local/opt/${project} - -RUN echo "#log: ${project}: Running build" \ - && set -x \ - && npm ci \ - && npm run build - -ARG RUN_TESTS=true -ARG TEST_TIMEOUT_SECONDS= - -RUN if "${RUN_TESTS}"; then \ - echo "#log ${project}: Running tests" \ - && npm test; \ - else \ - echo "#log ${project}: Tests were skipped!"; \ - fi - -CMD /bin/bash -l diff --git a/server/node_modules/bcrypt/ISSUE_TEMPLATE.md b/server/node_modules/bcrypt/ISSUE_TEMPLATE.md deleted file mode 100644 index b4baa008..00000000 --- a/server/node_modules/bcrypt/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,18 +0,0 @@ -Thanks for reporting a new issue with the node bcrypt module! - -To help you resolve your issue faster please make sure you have done the following: - -* Searched existing issues (even closed ones) for your same problem -* Make sure you have installed the required dependencies listed on the readme -* Read your npm error log for lines telling you what failed, usually it is a problem with not having the correct dependencies installed to build the native module - -Once you have done the above and are still confident that the issue is with the module, please describe it below. Some things that really help get your issue resolved faster are: - -* What went wrong? -* What did you expect to happen? -* Which version of nodejs and OS? -* If you find a bug, please write a failing test. - -Thanks! - -P.S. If it doesn't look like you read the above then your issue will likely be closed without further explanation. Sorry, but there are just too many issues opened with no useful information or questions which have been previously addressed. diff --git a/server/node_modules/bcrypt/LICENSE b/server/node_modules/bcrypt/LICENSE deleted file mode 100644 index 94e2ba5f..00000000 --- a/server/node_modules/bcrypt/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Nicholas Campbell - -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. \ No newline at end of file diff --git a/server/node_modules/bcrypt/Makefile b/server/node_modules/bcrypt/Makefile deleted file mode 100644 index cb222526..00000000 --- a/server/node_modules/bcrypt/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -TESTS = test/*.js - -all: test - -build: clean compile - -compile: - npm install . - npm run install - -test: build - @./node_modules/.bin/jest \ - $(TESTS) - -clean: - rm -Rf lib/bindings/ - - -.PHONY: clean test build diff --git a/server/node_modules/bcrypt/README.md b/server/node_modules/bcrypt/README.md deleted file mode 100644 index e9231081..00000000 --- a/server/node_modules/bcrypt/README.md +++ /dev/null @@ -1,388 +0,0 @@ -# node.bcrypt.js - -[![ci](https://github.com/kelektiv/node.bcrypt.js/actions/workflows/ci.yaml/badge.svg)](https://github.com/kelektiv/node.bcrypt.js/actions/workflows/ci.yaml) - -[![Build Status](https://ci.appveyor.com/api/projects/status/github/kelektiv/node.bcrypt.js)](https://ci.appveyor.com/project/defunctzombie/node-bcrypt-js-pgo26/branch/master) - -A library to help you hash passwords. - -You can read about [bcrypt in Wikipedia][bcryptwiki] as well as in the following article: -[How To Safely Store A Password][codahale] - -## If You Are Submitting Bugs or Issues - -Please verify that the NodeJS version you are using is a _stable_ version; Unstable versions are currently not supported and issues created while using an unstable version will be closed. - -If you are on a stable version of NodeJS, please provide a sufficient code snippet or log files for installation issues. The code snippet does not require you to include confidential information. However, it must provide enough information so the problem can be replicable, or it may be closed without an explanation. - - -## Version Compatibility - -_Please upgrade to atleast v5.0.0 to avoid security issues mentioned below._ - -| Node Version | Bcrypt Version | -| -------------- | ------------------| -| 0.4 | <= 0.4 | -| 0.6, 0.8, 0.10 | >= 0.5 | -| 0.11 | >= 0.8 | -| 4 | <= 2.1.0 | -| 8 | >= 1.0.3 < 4.0.0 | -| 10, 11 | >= 3 | -| 12 onwards | >= 3.0.6 | - -`node-gyp` only works with stable/released versions of node. Since the `bcrypt` module uses `node-gyp` to build and install, you'll need a stable version of node to use bcrypt. If you do not, you'll likely see an error that starts with: - -``` -gyp ERR! stack Error: "pre" versions of node cannot be installed, use the --nodedir flag instead -``` - -## Security Issues And Concerns - -> Per bcrypt implementation, only the first 72 bytes of a string are used. Any extra bytes are ignored when matching passwords. Note that this is not the first 72 *characters*. It is possible for a string to contain less than 72 characters, while taking up more than 72 bytes (e.g. a UTF-8 encoded string containing emojis). If a string is provided, it will be encoded using UTF-8. - -As should be the case with any security tool, anyone using this library should scrutinise it. If you find or suspect an issue with the code, please bring it to the maintainers' attention. We will spend some time ensuring that this library is as secure as possible. - -Here is a list of BCrypt-related security issues/concerns that have come up over the years. - -* An [issue with passwords][jtr] was found with a version of the Blowfish algorithm developed for John the Ripper. This is not present in the OpenBSD version and is thus not a problem for this module. HT [zooko][zooko]. -* Versions `< 5.0.0` suffer from bcrypt wrap-around bug and _will truncate passwords >= 255 characters leading to severely weakened passwords_. Please upgrade at earliest. See [this wiki page][wrap-around-bug] for more details. -* Versions `< 5.0.0` _do not handle NUL characters inside passwords properly leading to all subsequent characters being dropped and thus resulting in severely weakened passwords_. Please upgrade at earliest. See [this wiki page][improper-nuls] for more details. - -## Compatibility Note - -This library supports `$2a$` and `$2b$` prefix bcrypt hashes. `$2x$` and `$2y$` hashes are specific to bcrypt implementation developed for John the Ripper. In theory, they should be compatible with `$2b$` prefix. - -Compatibility with hashes generated by other languages is not 100% guaranteed due to difference in character encodings. However, it should not be an issue for most cases. - -### Migrating from v1.0.x - -Hashes generated in earlier version of `bcrypt` remain 100% supported in `v2.x.x` and later versions. In most cases, the migration should be a bump in the `package.json`. - -Hashes generated in `v2.x.x` using the defaults parameters will not work in earlier versions. - -## Dependencies - -* NodeJS -* `node-gyp` - * Please check the dependencies for this tool at: https://github.com/nodejs/node-gyp - * Windows users will need the options for c# and c++ installed with their visual studio instance. - * Python 2.x/3.x -* `OpenSSL` - This is only required to build the `bcrypt` project if you are using versions <= 0.7.7. Otherwise, we're using the builtin node crypto bindings for seed data (which use the same OpenSSL code paths we were, but don't have the external dependency). - -## Install via NPM - -``` -npm install bcrypt -``` -***Note:*** OS X users using Xcode 4.3.1 or above may need to run the following command in their terminal prior to installing if errors occur regarding xcodebuild: ```sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer``` - -_Pre-built binaries for various NodeJS versions are made available on a best-effort basis._ - -Only the current stable and supported LTS releases are actively tested against. - -_There may be an interval between the release of the module and the availabilty of the compiled modules._ - -Currently, we have pre-built binaries that support the following platforms: - -1. Windows x32 and x64 -2. Linux x64 (GlibC and musl) -3. macOS - -If you face an error like this: - -``` -node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-linux-x64.tar.gz -``` - -make sure you have the appropriate dependencies installed and configured for your platform. You can find installation instructions for the dependencies for some common platforms [in this page][depsinstall]. - -## Usage - -### async (recommended) - -```javascript -const bcrypt = require('bcrypt'); -const saltRounds = 10; -const myPlaintextPassword = 's0/\/\P4$$w0rD'; -const someOtherPlaintextPassword = 'not_bacon'; -``` - -#### To hash a password: - -Technique 1 (generate a salt and hash on separate function calls): - -```javascript -bcrypt.genSalt(saltRounds, function(err, salt) { - bcrypt.hash(myPlaintextPassword, salt, function(err, hash) { - // Store hash in your password DB. - }); -}); -``` - -Technique 2 (auto-gen a salt and hash): - -```javascript -bcrypt.hash(myPlaintextPassword, saltRounds, function(err, hash) { - // Store hash in your password DB. -}); -``` - -Note that both techniques achieve the same end-result. - -#### To check a password: - -```javascript -// Load hash from your password DB. -bcrypt.compare(myPlaintextPassword, hash, function(err, result) { - // result == true -}); -bcrypt.compare(someOtherPlaintextPassword, hash, function(err, result) { - // result == false -}); -``` - -[A Note on Timing Attacks](#a-note-on-timing-attacks) - -### with promises - -bcrypt uses whatever `Promise` implementation is available in `global.Promise`. NodeJS >= 0.12 has a native `Promise` implementation built in. However, this should work in any Promises/A+ compliant implementation. - -Async methods that accept a callback, return a `Promise` when callback is not specified if Promise support is available. - -```javascript -bcrypt.hash(myPlaintextPassword, saltRounds).then(function(hash) { - // Store hash in your password DB. -}); -``` -```javascript -// Load hash from your password DB. -bcrypt.compare(myPlaintextPassword, hash).then(function(result) { - // result == true -}); -bcrypt.compare(someOtherPlaintextPassword, hash).then(function(result) { - // result == false -}); -``` - -This is also compatible with `async/await` - -```javascript -async function checkUser(username, password) { - //... fetch user from a db etc. - - const match = await bcrypt.compare(password, user.passwordHash); - - if(match) { - //login - } - - //... -} -``` - -### ESM import -```javascript -import bcrypt from "bcrypt"; - -// later -await bcrypt.compare(password, hash); -``` - -### sync - -```javascript -const bcrypt = require('bcrypt'); -const saltRounds = 10; -const myPlaintextPassword = 's0/\/\P4$$w0rD'; -const someOtherPlaintextPassword = 'not_bacon'; -``` - -#### To hash a password: - -Technique 1 (generate a salt and hash on separate function calls): - -```javascript -const salt = bcrypt.genSaltSync(saltRounds); -const hash = bcrypt.hashSync(myPlaintextPassword, salt); -// Store hash in your password DB. -``` - -Technique 2 (auto-gen a salt and hash): - -```javascript -const hash = bcrypt.hashSync(myPlaintextPassword, saltRounds); -// Store hash in your password DB. -``` - -As with async, both techniques achieve the same end-result. - -#### To check a password: - -```javascript -// Load hash from your password DB. -bcrypt.compareSync(myPlaintextPassword, hash); // true -bcrypt.compareSync(someOtherPlaintextPassword, hash); // false -``` - -[A Note on Timing Attacks](#a-note-on-timing-attacks) - -### Why is async mode recommended over sync mode? -We recommend using async API if you use `bcrypt` on a server. Bcrypt hashing is CPU intensive which will cause the sync APIs to block the event loop and prevent your application from servicing any inbound requests or events. The async version uses a thread pool which does not block the main event loop. - -## API - -`BCrypt.` - - * `genSaltSync(rounds, minor)` - * `rounds` - [OPTIONAL] - the cost of processing the data. (default - 10) - * `minor` - [OPTIONAL] - minor version of bcrypt to use. (default - b) - * `genSalt(rounds, minor, cb)` - * `rounds` - [OPTIONAL] - the cost of processing the data. (default - 10) - * `minor` - [OPTIONAL] - minor version of bcrypt to use. (default - b) - * `cb` - [OPTIONAL] - a callback to be fired once the salt has been generated. uses eio making it asynchronous. If `cb` is not specified, a `Promise` is returned if Promise support is available. - * `err` - First parameter to the callback detailing any errors. - * `salt` - Second parameter to the callback providing the generated salt. - * `hashSync(data, salt)` - * `data` - [REQUIRED] - the data to be encrypted. - * `salt` - [REQUIRED] - the salt to be used to hash the password. if specified as a number then a salt will be generated with the specified number of rounds and used (see example under **Usage**). - * `hash(data, salt, cb)` - * `data` - [REQUIRED] - the data to be encrypted. - * `salt` - [REQUIRED] - the salt to be used to hash the password. if specified as a number then a salt will be generated with the specified number of rounds and used (see example under **Usage**). - * `cb` - [OPTIONAL] - a callback to be fired once the data has been encrypted. uses eio making it asynchronous. If `cb` is not specified, a `Promise` is returned if Promise support is available. - * `err` - First parameter to the callback detailing any errors. - * `encrypted` - Second parameter to the callback providing the encrypted form. - * `compareSync(data, encrypted)` - * `data` - [REQUIRED] - data to compare. - * `encrypted` - [REQUIRED] - data to be compared to. - * `compare(data, encrypted, cb)` - * `data` - [REQUIRED] - data to compare. - * `encrypted` - [REQUIRED] - data to be compared to. - * `cb` - [OPTIONAL] - a callback to be fired once the data has been compared. uses eio making it asynchronous. If `cb` is not specified, a `Promise` is returned if Promise support is available. - * `err` - First parameter to the callback detailing any errors. - * `same` - Second parameter to the callback providing whether the data and encrypted forms match [true | false]. - * `getRounds(encrypted)` - return the number of rounds used to encrypt a given hash - * `encrypted` - [REQUIRED] - hash from which the number of rounds used should be extracted. - -## A Note on Rounds - -A note about the cost: when you are hashing your data, the module will go through a series of rounds to give you a secure hash. The value you submit is not just the number of rounds the module will go through to hash your data. The module will use the value you enter and go through `2^rounds` hashing iterations. - -From @garthk, on a 2GHz core you can roughly expect: - - rounds=8 : ~40 hashes/sec - rounds=9 : ~20 hashes/sec - rounds=10: ~10 hashes/sec - rounds=11: ~5 hashes/sec - rounds=12: 2-3 hashes/sec - rounds=13: ~1 sec/hash - rounds=14: ~1.5 sec/hash - rounds=15: ~3 sec/hash - rounds=25: ~1 hour/hash - rounds=31: 2-3 days/hash - - -## A Note on Timing Attacks - -Because it's come up multiple times in this project and other bcrypt projects, it needs to be said. The `bcrypt` library is not susceptible to timing attacks. From codahale/bcrypt-ruby#42: - -> One of the desired properties of a cryptographic hash function is preimage attack resistance, which means there is no shortcut for generating a message which, when hashed, produces a specific digest. - -A great thread on this, in much more detail can be found @ codahale/bcrypt-ruby#43 - -If you're unfamiliar with timing attacks and want to learn more you can find a great writeup @ [A Lesson In Timing Attacks][timingatk] - -However, timing attacks are real. And the comparison function is _not_ time safe. That means that it may exit the function early in the comparison process. Timing attacks happen because of the above. We don't need to be careful that an attacker will learn anything, and our comparison function provides a comparison of hashes. It is a utility to the overall purpose of the library. If you end up using it for something else, we cannot guarantee the security of the comparator. Keep that in mind as you use the library. - -## Hash Info - -The characters that comprise the resultant hash are `./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789$`. - -Resultant hashes will be 60 characters long and they will include the salt among other parameters, as follows: - -`$[algorithm]$[cost]$[salt][hash]` - -- 2 chars hash algorithm identifier prefix. `"$2a$" or "$2b$"` indicates BCrypt -- Cost-factor (n). Represents the exponent used to determine how many iterations 2^n -- 16-byte (128-bit) salt, base64 encoded to 22 characters -- 24-byte (192-bit) hash, base64 encoded to 31 characters - -Example: -``` -$2b$10$nOUIs5kJ7naTuTFkBy1veuK0kSxUFXfuaOKdOKf9xYT0KKIGSJwFa - | | | | - | | | hash-value = K0kSxUFXfuaOKdOKf9xYT0KKIGSJwFa - | | | - | | salt = nOUIs5kJ7naTuTFkBy1veu - | | - | cost-factor => 10 = 2^10 rounds - | - hash-algorithm identifier => 2b = BCrypt -``` - -## Testing - -If you create a pull request, tests better pass :) - -``` -npm install -npm test -``` - -## Credits - -The code for this comes from a few sources: - -* blowfish.cc - OpenBSD -* bcrypt.cc - OpenBSD -* bcrypt::gen_salt - [gen_salt inclusion to bcrypt][bcryptgs] -* bcrypt_node.cc - me - -## Contributors - -* [Antonio Salazar Cardozo][shadowfiend] - Early MacOS X support (when we used libbsd) -* [Ben Glow][pixelglow] - Fixes for thread safety with async calls -* [Van Nguyen][thegoleffect] - Found a timing attack in the comparator -* [NewITFarmer][newitfarmer] - Initial Cygwin support -* [David Trejo][dtrejo] - packaging fixes -* [Alfred Westerveld][alfredwesterveld] - packaging fixes -* [Vincent Côté-Roy][vincentr] - Testing around concurrency issues -* [Lloyd Hilaiel][lloyd] - Documentation fixes -* [Roman Shtylman][shtylman] - Code refactoring, general rot reduction, compile options, better memory management with delete and new, and an upgrade to libuv over eio/ev. -* [Vadim Graboys][vadimg] - Code changes to support 0.5.5+ -* [Ben Noordhuis][bnoordhuis] - Fixed a thread safety issue in nodejs that was perfectly mappable to this module. -* [Nate Rajlich][tootallnate] - Bindings and build process. -* [Sean McArthur][seanmonstar] - Windows Support -* [Fanie Oosthuysen][weareu] - Windows Support -* [Amitosh Swain Mahapatra][recrsn] - $2b$ hash support, ES6 Promise support -* [Nicola Del Gobbo][NickNaso] - Initial implementation with N-API - -## License -Unless stated elsewhere, file headers or otherwise, the license as stated in the LICENSE file. - -[bcryptwiki]: https://en.wikipedia.org/wiki/Bcrypt -[bcryptgs]: http://mail-index.netbsd.org/tech-crypto/2002/05/24/msg000204.html -[codahale]: http://codahale.com/how-to-safely-store-a-password/ -[gh13]: https://github.com/ncb000gt/node.bcrypt.js/issues/13 -[jtr]: http://www.openwall.com/lists/oss-security/2011/06/20/2 -[depsinstall]: https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions -[timingatk]: https://codahale.com/a-lesson-in-timing-attacks/ -[wrap-around-bug]: https://github.com/kelektiv/node.bcrypt.js/wiki/Security-Issues-and-Concerns#bcrypt-wrap-around-bug-medium-severity -[improper-nuls]: https://github.com/kelektiv/node.bcrypt.js/wiki/Security-Issues-and-Concerns#improper-nul-handling-medium-severity - -[shadowfiend]:https://github.com/Shadowfiend -[thegoleffect]:https://github.com/thegoleffect -[pixelglow]:https://github.com/pixelglow -[dtrejo]:https://github.com/dtrejo -[alfredwesterveld]:https://github.com/alfredwesterveld -[newitfarmer]:https://github.com/newitfarmer -[zooko]:https://twitter.com/zooko -[vincentr]:https://twitter.com/vincentcr -[lloyd]:https://github.com/lloyd -[shtylman]:https://github.com/shtylman -[vadimg]:https://github.com/vadimg -[bnoordhuis]:https://github.com/bnoordhuis -[tootallnate]:https://github.com/tootallnate -[seanmonstar]:https://github.com/seanmonstar -[weareu]:https://github.com/weareu -[recrsn]:https://github.com/recrsn -[NickNaso]: https://github.com/NickNaso diff --git a/server/node_modules/bcrypt/SECURITY.md b/server/node_modules/bcrypt/SECURITY.md deleted file mode 100644 index c132dc86..00000000 --- a/server/node_modules/bcrypt/SECURITY.md +++ /dev/null @@ -1,15 +0,0 @@ -# Security Policy - -As with any software, `bcrypt` is likely to have bugs. Please report any security vulnerabilities responsibly - -## Supported Versions - -| Version | Supported | -| ------- | ------------------ | -| 5.0.x | :white_check_mark: | -| < 5.0 | :x: | - -## Reporting a Vulnerability - -If you are reporting a security vulnerability, please refrain from opening a GitHub issue and instead mail it to -one of the maintainers listed in the README. diff --git a/server/node_modules/bcrypt/bcrypt.js b/server/node_modules/bcrypt/bcrypt.js deleted file mode 100644 index 62da5252..00000000 --- a/server/node_modules/bcrypt/bcrypt.js +++ /dev/null @@ -1,242 +0,0 @@ -const path = require('path'); -const bindings = require('node-gyp-build')(path.resolve(__dirname)); - -const crypto = require('crypto'); - -const promises = require('./promises'); - -/// generate a salt (sync) -/// @param {Number} [rounds] number of rounds (default 10) -/// @return {String} salt -function genSaltSync(rounds, minor) { - // default 10 rounds - if (!rounds) { - rounds = 10; - } else if (typeof rounds !== 'number') { - throw new Error('rounds must be a number'); - } - - if (!minor) { - minor = 'b'; - } else if (minor !== 'b' && minor !== 'a') { - throw new Error('minor must be either "a" or "b"'); - } - - return bindings.gen_salt_sync(minor, rounds, crypto.randomBytes(16)); -} - -/// generate a salt -/// @param {Number} [rounds] number of rounds (default 10) -/// @param {Function} cb callback(err, salt) -function genSalt(rounds, minor, cb) { - let error; - - // if callback is first argument, then use defaults for others - if (typeof arguments[0] === 'function') { - // have to set callback first otherwise arguments are overridden - cb = arguments[0]; - rounds = 10; - minor = 'b'; - // callback is second argument - } else if (typeof arguments[1] === 'function') { - // have to set callback first otherwise arguments are overridden - cb = arguments[1]; - minor = 'b'; - } - - if (!cb) { - return promises.promise(genSalt, this, [rounds, minor]); - } - - // default 10 rounds - if (!rounds) { - rounds = 10; - } else if (typeof rounds !== 'number') { - // callback error asynchronously - error = new Error('rounds must be a number'); - return process.nextTick(function () { - cb(error); - }); - } - - if (!minor) { - minor = 'b' - } else if (minor !== 'b' && minor !== 'a') { - error = new Error('minor must be either "a" or "b"'); - return process.nextTick(function () { - cb(error); - }); - } - - crypto.randomBytes(16, function (error, randomBytes) { - if (error) { - cb(error); - return; - } - - bindings.gen_salt(minor, rounds, randomBytes, cb); - }); -} - -/// hash data using a salt -/// @param {String|Buffer} data the data to encrypt -/// @param {String} salt the salt to use when hashing -/// @return {String} hash -function hashSync(data, salt) { - if (data == null || salt == null) { - throw new Error('data and salt arguments required'); - } - - if (!(typeof data === 'string' || data instanceof Buffer) || (typeof salt !== 'string' && typeof salt !== 'number')) { - throw new Error('data must be a string or Buffer and salt must either be a salt string or a number of rounds'); - } - - if (typeof salt === 'number') { - salt = module.exports.genSaltSync(salt); - } - - return bindings.encrypt_sync(data, salt); -} - -/// hash data using a salt -/// @param {String|Buffer} data the data to encrypt -/// @param {String} salt the salt to use when hashing -/// @param {Function} cb callback(err, hash) -function hash(data, salt, cb) { - let error; - - if (typeof data === 'function') { - error = new Error('data must be a string or Buffer and salt must either be a salt string or a number of rounds'); - return process.nextTick(function () { - data(error); - }); - } - - if (typeof salt === 'function') { - error = new Error('data must be a string or Buffer and salt must either be a salt string or a number of rounds'); - return process.nextTick(function () { - salt(error); - }); - } - - // cb exists but is not a function - // return a rejecting promise - if (cb && typeof cb !== 'function') { - return promises.reject(new Error('cb must be a function or null to return a Promise')); - } - - if (!cb) { - return promises.promise(hash, this, [data, salt]); - } - - if (data == null || salt == null) { - error = new Error('data and salt arguments required'); - return process.nextTick(function () { - cb(error); - }); - } - - if (!(typeof data === 'string' || data instanceof Buffer) || (typeof salt !== 'string' && typeof salt !== 'number')) { - error = new Error('data must be a string or Buffer and salt must either be a salt string or a number of rounds'); - return process.nextTick(function () { - cb(error); - }); - } - - - if (typeof salt === 'number') { - return module.exports.genSalt(salt, function (err, salt) { - return bindings.encrypt(data, salt, cb); - }); - } - - return bindings.encrypt(data, salt, cb); -} - -/// compare raw data to hash -/// @param {String|Buffer} data the data to hash and compare -/// @param {String} hash expected hash -/// @return {bool} true if hashed data matches hash -function compareSync(data, hash) { - if (data == null || hash == null) { - throw new Error('data and hash arguments required'); - } - - if (!(typeof data === 'string' || data instanceof Buffer) || typeof hash !== 'string') { - throw new Error('data must be a string or Buffer and hash must be a string'); - } - - return bindings.compare_sync(data, hash); -} - -/// compare raw data to hash -/// @param {String|Buffer} data the data to hash and compare -/// @param {String} hash expected hash -/// @param {Function} cb callback(err, matched) - matched is true if hashed data matches hash -function compare(data, hash, cb) { - let error; - - if (typeof data === 'function') { - error = new Error('data and hash arguments required'); - return process.nextTick(function () { - data(error); - }); - } - - if (typeof hash === 'function') { - error = new Error('data and hash arguments required'); - return process.nextTick(function () { - hash(error); - }); - } - - // cb exists but is not a function - // return a rejecting promise - if (cb && typeof cb !== 'function') { - return promises.reject(new Error('cb must be a function or null to return a Promise')); - } - - if (!cb) { - return promises.promise(compare, this, [data, hash]); - } - - if (data == null || hash == null) { - error = new Error('data and hash arguments required'); - return process.nextTick(function () { - cb(error); - }); - } - - if (!(typeof data === 'string' || data instanceof Buffer) || typeof hash !== 'string') { - error = new Error('data and hash must be strings'); - return process.nextTick(function () { - cb(error); - }); - } - - return bindings.compare(data, hash, cb); -} - -/// @param {String} hash extract rounds from this hash -/// @return {Number} the number of rounds used to encrypt a given hash -function getRounds(hash) { - if (hash == null) { - throw new Error('hash argument required'); - } - - if (typeof hash !== 'string') { - throw new Error('hash must be a string'); - } - - return bindings.get_rounds(hash); -} - -module.exports = { - genSaltSync, - genSalt, - hashSync, - hash, - compareSync, - compare, - getRounds, -} diff --git a/server/node_modules/bcrypt/binding.gyp b/server/node_modules/bcrypt/binding.gyp deleted file mode 100644 index 46428be7..00000000 --- a/server/node_modules/bcrypt/binding.gyp +++ /dev/null @@ -1,49 +0,0 @@ -{ - "variables": { - "NODE_VERSION%":" { - const start = Date.now(); - - // genSalt - const salt = await bcrypt.genSalt(10) - console.log('salt: ' + salt); - console.log('salt cb end: ' + (Date.now() - start) + 'ms'); - - // hash - const crypted = await bcrypt.hash('test', salt) - console.log('crypted: ' + crypted); - console.log('crypted cb end: ' + (Date.now() - start) + 'ms'); - console.log('rounds used from hash:', bcrypt.getRounds(crypted)); - - // compare - const res = await bcrypt.compare('test', crypted) - console.log('compared true: ' + res); - console.log('compared true cb end: ' + (Date.now() - start) + 'ms'); - - // compare - const res2 = await bcrypt.compare('bacon', crypted) - console.log('compared false: ' + res2); - console.log('compared false cb end: ' + (Date.now() - start) + 'ms'); - - console.log('end: ' + (Date.now() - start) + 'ms'); -})(); diff --git a/server/node_modules/bcrypt/examples/forever_gen_salt.js b/server/node_modules/bcrypt/examples/forever_gen_salt.js deleted file mode 100644 index 3f2ff2f4..00000000 --- a/server/node_modules/bcrypt/examples/forever_gen_salt.js +++ /dev/null @@ -1,8 +0,0 @@ -const bcrypt = require('../bcrypt'); - -(function printSalt() { - bcrypt.genSalt(10, (err, salt) => { - console.log('salt: ' + salt); - printSalt(); - }); -})() diff --git a/server/node_modules/bcrypt/package.json b/server/node_modules/bcrypt/package.json deleted file mode 100644 index c849897a..00000000 --- a/server/node_modules/bcrypt/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "bcrypt", - "description": "A bcrypt library for NodeJS.", - "keywords": [ - "bcrypt", - "password", - "auth", - "authentication", - "encryption", - "crypt", - "crypto" - ], - "main": "./bcrypt", - "version": "6.0.0", - "author": "Nick Campbell (https://github.com/ncb000gt)", - "engines": { - "node": ">= 18" - }, - "repository": { - "type": "git", - "url": "https://github.com/kelektiv/node.bcrypt.js.git" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/kelektiv/node.bcrypt.js/issues" - }, - "scripts": { - "test": "jest", - "install": "node-gyp-build", - "build": "prebuildify --napi --tag-libc --strip" - }, - "dependencies": { - "node-addon-api": "^8.3.0", - "node-gyp-build": "^4.8.4" - }, - "devDependencies": { - "jest": "^29.7.0", - "prebuildify": "^6.0.1" - }, - "contributors": [ - "Antonio Salazar Cardozo (https://github.com/Shadowfiend)", - "Van Nguyen (https://github.com/thegoleffect)", - "David Trejo (https://github.com/dtrejo)", - "Ben Glow (https://github.com/pixelglow)", - "NewITFarmer.com <> (https://github.com/newitfarmer)", - "Alfred Westerveld (https://github.com/alfredwesterveld)", - "Vincent Côté-Roy (https://github.com/vincentcr)", - "Lloyd Hilaiel (https://github.com/lloyd)", - "Roman Shtylman (https://github.com/shtylman)", - "Vadim Graboys (https://github.com/vadimg)", - "Ben Noorduis <> (https://github.com/bnoordhuis)", - "Nate Rajlich (https://github.com/tootallnate)", - "Sean McArthur (https://github.com/seanmonstar)", - "Fanie Oosthuysen (https://github.com/weareu)", - "Amitosh Swain Mahapatra (https://github.com/Agathver)", - "Corbin Crutchley (https://github.com/crutchcorn)", - "Nicola Del Gobbo (https://github.com/NickNaso)" - ], - "binary": { - "module_name": "bcrypt_lib" - } -} diff --git a/server/node_modules/bcrypt/prebuilds/darwin-arm64/bcrypt.node b/server/node_modules/bcrypt/prebuilds/darwin-arm64/bcrypt.node deleted file mode 100644 index 5160c6c3..00000000 Binary files a/server/node_modules/bcrypt/prebuilds/darwin-arm64/bcrypt.node and /dev/null differ diff --git a/server/node_modules/bcrypt/prebuilds/darwin-x64/bcrypt.node b/server/node_modules/bcrypt/prebuilds/darwin-x64/bcrypt.node deleted file mode 100644 index 8de9c5f7..00000000 Binary files a/server/node_modules/bcrypt/prebuilds/darwin-x64/bcrypt.node and /dev/null differ diff --git a/server/node_modules/bcrypt/prebuilds/linux-arm/bcrypt.glibc.node b/server/node_modules/bcrypt/prebuilds/linux-arm/bcrypt.glibc.node deleted file mode 100644 index 3deef80e..00000000 Binary files a/server/node_modules/bcrypt/prebuilds/linux-arm/bcrypt.glibc.node and /dev/null differ diff --git a/server/node_modules/bcrypt/prebuilds/linux-arm/bcrypt.musl.node b/server/node_modules/bcrypt/prebuilds/linux-arm/bcrypt.musl.node deleted file mode 100644 index be7ca5f1..00000000 Binary files a/server/node_modules/bcrypt/prebuilds/linux-arm/bcrypt.musl.node and /dev/null differ diff --git a/server/node_modules/bcrypt/prebuilds/linux-arm64/bcrypt.glibc.node b/server/node_modules/bcrypt/prebuilds/linux-arm64/bcrypt.glibc.node deleted file mode 100644 index 6b2c7a9e..00000000 Binary files a/server/node_modules/bcrypt/prebuilds/linux-arm64/bcrypt.glibc.node and /dev/null differ diff --git a/server/node_modules/bcrypt/prebuilds/linux-arm64/bcrypt.musl.node b/server/node_modules/bcrypt/prebuilds/linux-arm64/bcrypt.musl.node deleted file mode 100644 index 717cd145..00000000 Binary files a/server/node_modules/bcrypt/prebuilds/linux-arm64/bcrypt.musl.node and /dev/null differ diff --git a/server/node_modules/bcrypt/prebuilds/linux-x64/bcrypt.glibc.node b/server/node_modules/bcrypt/prebuilds/linux-x64/bcrypt.glibc.node deleted file mode 100644 index b58e7dc6..00000000 Binary files a/server/node_modules/bcrypt/prebuilds/linux-x64/bcrypt.glibc.node and /dev/null differ diff --git a/server/node_modules/bcrypt/prebuilds/linux-x64/bcrypt.musl.node b/server/node_modules/bcrypt/prebuilds/linux-x64/bcrypt.musl.node deleted file mode 100644 index e62ce92d..00000000 Binary files a/server/node_modules/bcrypt/prebuilds/linux-x64/bcrypt.musl.node and /dev/null differ diff --git a/server/node_modules/bcrypt/prebuilds/win32-arm64/bcrypt.node b/server/node_modules/bcrypt/prebuilds/win32-arm64/bcrypt.node deleted file mode 100644 index 3b308398..00000000 Binary files a/server/node_modules/bcrypt/prebuilds/win32-arm64/bcrypt.node and /dev/null differ diff --git a/server/node_modules/bcrypt/prebuilds/win32-x64/bcrypt.node b/server/node_modules/bcrypt/prebuilds/win32-x64/bcrypt.node deleted file mode 100644 index f7ef025e..00000000 Binary files a/server/node_modules/bcrypt/prebuilds/win32-x64/bcrypt.node and /dev/null differ diff --git a/server/node_modules/bcrypt/promises.js b/server/node_modules/bcrypt/promises.js deleted file mode 100644 index 6685cc25..00000000 --- a/server/node_modules/bcrypt/promises.js +++ /dev/null @@ -1,45 +0,0 @@ -let Promise = global.Promise; - -/// encapsulate a method with a node-style callback in a Promise -/// @param {object} 'this' of the encapsulated function -/// @param {function} function to be encapsulated -/// @param {Array-like} args to be passed to the called function -/// @return {Promise} a Promise encapsulating the function -function promise(fn, context, args) { - if (!Array.isArray(args)) { - args = Array.prototype.slice.call(args); - } - - if (typeof fn !== 'function') { - return Promise.reject(new Error('fn must be a function')); - } - - return new Promise((resolve, reject) => { - args.push((err, data) => { - if (err) { - reject(err); - } else { - resolve(data); - } - }); - - fn.apply(context, args); - }); -} - -/// @param {err} the error to be thrown -function reject(err) { - return Promise.reject(err); -} - -/// changes the promise implementation that bcrypt uses -/// @param {Promise} the implementation to use -function use(promise) { - Promise = promise; -} - -module.exports = { - promise, - reject, - use -} diff --git a/server/node_modules/bcrypt/src/bcrypt.cc b/server/node_modules/bcrypt/src/bcrypt.cc deleted file mode 100644 index bd8c5735..00000000 --- a/server/node_modules/bcrypt/src/bcrypt.cc +++ /dev/null @@ -1,315 +0,0 @@ -/* $OpenBSD: bcrypt.c,v 1.31 2014/03/22 23:02:03 tedu Exp $ */ - -/* - * Copyright (c) 1997 Niels Provos - * - * Permission to use, copy, modify, and 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. - */ - -/* This password hashing algorithm was designed by David Mazieres - * and works as follows: - * - * 1. state := InitState () - * 2. state := ExpandKey (state, salt, password) - * 3. REPEAT rounds: - * state := ExpandKey (state, 0, password) - * state := ExpandKey (state, 0, salt) - * 4. ctext := "OrpheanBeholderScryDoubt" - * 5. REPEAT 64: - * ctext := Encrypt_ECB (state, ctext); - * 6. RETURN Concatenate (salt, ctext); - * - */ - -#include -#include -#include -#include - -#include "node_blf.h" - -#ifdef _WIN32 -#define snprintf _snprintf -#endif - -//#if !defined(__APPLE__) && !defined(__MACH__) -//#include "bsd/stdlib.h" -//#endif - -/* This implementation is adaptable to current computing power. - * You can have up to 2^31 rounds which should be enough for some - * time to come. - */ - -static void encode_base64(u_int8_t *, u_int8_t *, u_int16_t); -static void decode_base64(u_int8_t *, u_int16_t, u_int8_t *); - -const static char* error = ":"; - -const static u_int8_t Base64Code[] = -"./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - -const static u_int8_t index_64[128] = { - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 0, 1, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 255, 255, - 255, 255, 255, 255, 255, 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, - 255, 255, 255, 255, 255, 255, 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, 255, 255, 255, 255, 255 -}; -#define CHAR64(c) ( (c) > 127 ? 255 : index_64[(c)]) - -static void -decode_base64(u_int8_t *buffer, u_int16_t len, u_int8_t *data) -{ - u_int8_t *bp = buffer; - u_int8_t *p = data; - u_int8_t c1, c2, c3, c4; - while (bp < buffer + len) { - c1 = CHAR64(*p); - c2 = CHAR64(*(p + 1)); - - /* Invalid data */ - if (c1 == 255 || c2 == 255) - break; - - *bp++ = (c1 << 2) | ((c2 & 0x30) >> 4); - if (bp >= buffer + len) - break; - - c3 = CHAR64(*(p + 2)); - if (c3 == 255) - break; - - *bp++ = ((c2 & 0x0f) << 4) | ((c3 & 0x3c) >> 2); - if (bp >= buffer + len) - break; - - c4 = CHAR64(*(p + 3)); - if (c4 == 255) - break; - *bp++ = ((c3 & 0x03) << 6) | c4; - - p += 4; - } -} - -void -encode_salt(char *salt, u_int8_t *csalt, char minor, u_int16_t clen, u_int8_t logr) -{ - salt[0] = '$'; - salt[1] = BCRYPT_VERSION; - salt[2] = minor; - salt[3] = '$'; - - // Max rounds are 31 - snprintf(salt + 4, 4, "%2.2u$", logr & 0x001F); - - encode_base64((u_int8_t *) salt + 7, csalt, clen); -} - - -/* Generates a salt for this version of crypt. - Since versions may change. Keeping this here - seems sensible. - from: http://mail-index.netbsd.org/tech-crypto/2002/05/24/msg000204.html -*/ -void -bcrypt_gensalt(char minor, u_int8_t log_rounds, u_int8_t *seed, char *gsalt) -{ - if (log_rounds < 4) - log_rounds = 4; - else if (log_rounds > 31) - log_rounds = 31; - - encode_salt(gsalt, seed, minor, BCRYPT_MAXSALT, log_rounds); -} - -/* We handle $Vers$log2(NumRounds)$salt+passwd$ - i.e. $2$04$iwouldntknowwhattosayetKdJ6iFtacBqJdKe6aW7ou */ - -void -bcrypt(const char *key, size_t key_len, const char *salt, char *encrypted) -{ - blf_ctx state; - u_int32_t rounds, i, k; - u_int16_t j; - u_int8_t salt_len, logr, minor; - u_int8_t ciphertext[4 * BCRYPT_BLOCKS+1] = "OrpheanBeholderScryDoubt"; - u_int8_t csalt[BCRYPT_MAXSALT]; - u_int32_t cdata[BCRYPT_BLOCKS]; - int n; - - /* Discard "$" identifier */ - salt++; - - if (*salt > BCRYPT_VERSION) { - /* How do I handle errors ? Return ':' */ - strcpy(encrypted, error); - return; - } - - /* Check for minor versions */ - if (salt[1] != '$') { - switch (salt[1]) { - case 'a': /* 'ab' should not yield the same as 'abab' */ - case 'b': /* cap input length at 72 bytes */ - minor = salt[1]; - salt++; - break; - default: - strcpy(encrypted, error); - return; - } - } else - minor = 0; - - /* Discard version + "$" identifier */ - salt += 2; - - if (salt[2] != '$') { - /* Out of sync with passwd entry */ - strcpy(encrypted, error); - return; - } - - /* Computer power doesn't increase linear, 2^x should be fine */ - n = atoi(salt); - if (n > 31 || n < 0) { - strcpy(encrypted, error); - return; - } - logr = (u_int8_t)n; - if ((rounds = (u_int32_t) 1 << logr) < BCRYPT_MINROUNDS) { - strcpy(encrypted, error); - return; - } - - /* Discard num rounds + "$" identifier */ - salt += 3; - - if (strlen(salt) * 3 / 4 < BCRYPT_MAXSALT) { - strcpy(encrypted, error); - return; - } - - /* We dont want the base64 salt but the raw data */ - decode_base64(csalt, BCRYPT_MAXSALT, (u_int8_t *) salt); - salt_len = BCRYPT_MAXSALT; - if (minor <= 'a') - key_len = (u_int8_t)(key_len + (minor >= 'a' ? 1 : 0)); - else - { - /* cap key_len at the actual maximum supported - * length here to avoid integer wraparound */ - if (key_len > 72) - key_len = 72; - key_len++; /* include the NUL */ - } - - - /* Setting up S-Boxes and Subkeys */ - Blowfish_initstate(&state); - Blowfish_expandstate(&state, csalt, salt_len, - (u_int8_t *) key, key_len); - for (k = 0; k < rounds; k++) { - Blowfish_expand0state(&state, (u_int8_t *) key, key_len); - Blowfish_expand0state(&state, csalt, salt_len); - } - - /* This can be precomputed later */ - j = 0; - for (i = 0; i < BCRYPT_BLOCKS; i++) - cdata[i] = Blowfish_stream2word(ciphertext, 4 * BCRYPT_BLOCKS, &j); - - /* Now do the encryption */ - for (k = 0; k < 64; k++) - blf_enc(&state, cdata, BCRYPT_BLOCKS / 2); - - for (i = 0; i < BCRYPT_BLOCKS; i++) { - ciphertext[4 * i + 3] = cdata[i] & 0xff; - cdata[i] = cdata[i] >> 8; - ciphertext[4 * i + 2] = cdata[i] & 0xff; - cdata[i] = cdata[i] >> 8; - ciphertext[4 * i + 1] = cdata[i] & 0xff; - cdata[i] = cdata[i] >> 8; - ciphertext[4 * i + 0] = cdata[i] & 0xff; - } - - i = 0; - encrypted[i++] = '$'; - encrypted[i++] = BCRYPT_VERSION; - if (minor) - encrypted[i++] = minor; - encrypted[i++] = '$'; - - snprintf(encrypted + i, 4, "%2.2u$", logr & 0x001F); - - encode_base64((u_int8_t *) encrypted + i + 3, csalt, BCRYPT_MAXSALT); - encode_base64((u_int8_t *) encrypted + strlen(encrypted), ciphertext, - 4 * BCRYPT_BLOCKS - 1); - memset(&state, 0, sizeof(state)); - memset(ciphertext, 0, sizeof(ciphertext)); - memset(csalt, 0, sizeof(csalt)); - memset(cdata, 0, sizeof(cdata)); -} - -u_int32_t bcrypt_get_rounds(const char * hash) -{ - /* skip past the leading "$" */ - if (!hash || *(hash++) != '$') return 0; - - /* skip past version */ - if (0 == (*hash++)) return 0; - if (*hash && *hash != '$') hash++; - if (*hash++ != '$') return 0; - - return atoi(hash); -} - -static void -encode_base64(u_int8_t *buffer, u_int8_t *data, u_int16_t len) -{ - u_int8_t *bp = buffer; - u_int8_t *p = data; - u_int8_t c1, c2; - while (p < data + len) { - c1 = *p++; - *bp++ = Base64Code[(c1 >> 2)]; - c1 = (c1 & 0x03) << 4; - if (p >= data + len) { - *bp++ = Base64Code[c1]; - break; - } - c2 = *p++; - c1 |= (c2 >> 4) & 0x0f; - *bp++ = Base64Code[c1]; - c1 = (c2 & 0x0f) << 2; - if (p >= data + len) { - *bp++ = Base64Code[c1]; - break; - } - c2 = *p++; - c1 |= (c2 >> 6) & 0x03; - *bp++ = Base64Code[c1]; - *bp++ = Base64Code[c2 & 0x3f]; - } - *bp = '\0'; -} diff --git a/server/node_modules/bcrypt/src/bcrypt_node.cc b/server/node_modules/bcrypt/src/bcrypt_node.cc deleted file mode 100644 index 2f072a4f..00000000 --- a/server/node_modules/bcrypt/src/bcrypt_node.cc +++ /dev/null @@ -1,288 +0,0 @@ -#define NAPI_VERSION 3 - -#include - -#include -#include -#include -#include // atoi - -#include "node_blf.h" - -#define NODE_LESS_THAN (!(NODE_VERSION_AT_LEAST(0, 5, 4))) - -namespace { - - bool ValidateSalt(const char* salt) { - - if (!salt || *salt != '$') { - return false; - } - - // discard $ - salt++; - - if (*salt > BCRYPT_VERSION) { - return false; - } - - if (salt[1] != '$') { - switch (salt[1]) { - case 'a': - case 'b': - salt++; - break; - default: - return false; - } - } - - // discard version + $ - salt += 2; - - if (salt[2] != '$') { - return false; - } - - int n = atoi(salt); - if (n > 31 || n < 0) { - return false; - } - - if (((uint8_t)1 << (uint8_t)n) < BCRYPT_MINROUNDS) { - return false; - } - - salt += 3; - if (strlen(salt) * 3 / 4 < BCRYPT_MAXSALT) { - return false; - } - - return true; - } - - inline char ToCharVersion(const std::string& str) { - return str[0]; - } - - /* SALT GENERATION */ - - class SaltAsyncWorker : public Napi::AsyncWorker { - public: - SaltAsyncWorker(const Napi::Function& callback, const std::string& seed, ssize_t rounds, char minor_ver) - : Napi::AsyncWorker(callback, "bcrypt:SaltAsyncWorker"), seed(seed), rounds(rounds), minor_ver(minor_ver) { - } - - ~SaltAsyncWorker() {} - - void Execute() { - bcrypt_gensalt(minor_ver, rounds, (u_int8_t *)&seed[0], salt); - } - - void OnOK() { - Napi::HandleScope scope(Env()); - Callback().Call({Env().Undefined(), Napi::String::New(Env(), salt)}); - } - - private: - std::string seed; - ssize_t rounds; - char minor_ver; - char salt[_SALT_LEN]; - }; - - Napi::Value GenerateSalt(const Napi::CallbackInfo& info) { - Napi::Env env = info.Env(); - if (info.Length() < 4) { - throw Napi::TypeError::New(env, "4 arguments expected"); - } - if (!info[0].IsString()) { - throw Napi::TypeError::New(env, "First argument must be a string"); - } - if (!info[2].IsBuffer() || (info[2].As>()).Length() != 16) { - throw Napi::TypeError::New(env, "Second argument must be a 16 byte Buffer"); - } - - const char minor_ver = ToCharVersion(info[0].As()); - const int32_t rounds = info[1].As(); - Napi::Buffer seed = info[2].As>(); - Napi::Function callback = info[3].As(); - SaltAsyncWorker* saltWorker = new SaltAsyncWorker(callback, std::string(seed.Data(), 16), rounds, minor_ver); - saltWorker->Queue(); - return env.Undefined(); - } - - Napi::Value GenerateSaltSync(const Napi::CallbackInfo& info) { - Napi::Env env = info.Env(); - if (info.Length() < 3) { - throw Napi::TypeError::New(env, "3 arguments expected"); - } - if (!info[0].IsString()) { - throw Napi::TypeError::New(env, "First argument must be a string"); - } - if (!info[2].IsBuffer() || (info[2].As>()).Length() != 16) { - throw Napi::TypeError::New(env, "Third argument must be a 16 byte Buffer"); - } - const char minor_ver = ToCharVersion(info[0].As()); - const int32_t rounds = info[1].As(); - Napi::Buffer buffer = info[2].As>(); - u_int8_t* seed = (u_int8_t*) buffer.Data(); - char salt[_SALT_LEN]; - bcrypt_gensalt(minor_ver, rounds, seed, salt); - return Napi::String::New(env, salt, strlen(salt)); - } - - inline std::string BufferToString(const Napi::Buffer &buf) { - return std::string(buf.Data(), buf.Length()); - } - - /* ENCRYPT DATA - USED TO BE HASHPW */ - - class EncryptAsyncWorker : public Napi::AsyncWorker { - public: - EncryptAsyncWorker(const Napi::Function& callback, const std::string& input, const std::string& salt) - : Napi::AsyncWorker(callback, "bcrypt:EncryptAsyncWorker"), input(input), salt(salt) { - } - - ~EncryptAsyncWorker() {} - - void Execute() { - if (!(ValidateSalt(salt.c_str()))) { - SetError("Invalid salt. Salt must be in the form of: $Vers$log2(NumRounds)$saltvalue"); - } - bcrypt(input.c_str(), input.length(), salt.c_str(), bcrypted); - } - - void OnOK() { - Napi::HandleScope scope(Env()); - Callback().Call({Env().Undefined(),Napi::String::New(Env(), bcrypted)}); - } - private: - std::string input; - std::string salt; - char bcrypted[_PASSWORD_LEN]; - }; - - Napi::Value Encrypt(const Napi::CallbackInfo& info) { - if (info.Length() < 3) { - throw Napi::TypeError::New(info.Env(), "3 arguments expected"); - } - std::string data = info[0].IsBuffer() - ? BufferToString(info[0].As>()) - : info[0].As(); - std::string salt = info[1].As(); - Napi::Function callback = info[2].As(); - EncryptAsyncWorker* encryptWorker = new EncryptAsyncWorker(callback, data, salt); - encryptWorker->Queue(); - return info.Env().Undefined(); - } - - Napi::Value EncryptSync(const Napi::CallbackInfo& info) { - Napi::Env env = info.Env(); - if (info.Length() < 2) { - throw Napi::TypeError::New(info.Env(), "2 arguments expected"); - } - std::string data = info[0].IsBuffer() - ? BufferToString(info[0].As>()) - : info[0].As(); - std::string salt = info[1].As(); - if (!(ValidateSalt(salt.c_str()))) { - throw Napi::Error::New(env, "Invalid salt. Salt must be in the form of: $Vers$log2(NumRounds)$saltvalue"); - } - char bcrypted[_PASSWORD_LEN]; - bcrypt(data.c_str(), data.length(), salt.c_str(), bcrypted); - return Napi::String::New(env, bcrypted, strlen(bcrypted)); - } - - /* COMPARATOR */ - inline bool CompareStrings(const char* s1, const char* s2) { - return strcmp(s1, s2) == 0; - } - - class CompareAsyncWorker : public Napi::AsyncWorker { - public: - CompareAsyncWorker(const Napi::Function& callback, const std::string& input, const std::string& encrypted) - : Napi::AsyncWorker(callback, "bcrypt:CompareAsyncWorker"), input(input), encrypted(encrypted) { - result = false; - } - - ~CompareAsyncWorker() {} - - void Execute() { - char bcrypted[_PASSWORD_LEN]; - if (ValidateSalt(encrypted.c_str())) { - bcrypt(input.c_str(), input.length(), encrypted.c_str(), bcrypted); - result = CompareStrings(bcrypted, encrypted.c_str()); - } - } - - void OnOK() { - Napi::HandleScope scope(Env()); - Callback().Call({Env().Undefined(), Napi::Boolean::New(Env(), result)}); - } - - private: - std::string input; - std::string encrypted; - bool result; - }; - - Napi::Value Compare(const Napi::CallbackInfo& info) { - if (info.Length() < 3) { - throw Napi::TypeError::New(info.Env(), "3 arguments expected"); - } - std::string input = info[0].IsBuffer() - ? BufferToString(info[0].As>()) - : info[0].As(); - std::string encrypted = info[1].As(); - Napi::Function callback = info[2].As(); - CompareAsyncWorker* compareWorker = new CompareAsyncWorker(callback, input, encrypted); - compareWorker->Queue(); - return info.Env().Undefined(); - } - - Napi::Value CompareSync(const Napi::CallbackInfo& info) { - Napi::Env env = info.Env(); - if (info.Length() < 2) { - throw Napi::TypeError::New(info.Env(), "2 arguments expected"); - } - std::string pw = info[0].IsBuffer() - ? BufferToString(info[0].As>()) - : info[0].As(); - std::string hash = info[1].As(); - char bcrypted[_PASSWORD_LEN]; - if (ValidateSalt(hash.c_str())) { - bcrypt(pw.c_str(), pw.length(), hash.c_str(), bcrypted); - return Napi::Boolean::New(env, CompareStrings(bcrypted, hash.c_str())); - } else { - return Napi::Boolean::New(env, false); - } - } - - Napi::Value GetRounds(const Napi::CallbackInfo& info) { - Napi::Env env = info.Env(); - if (info.Length() < 1) { - throw Napi::TypeError::New(env, "1 argument expected"); - } - std::string hash = info[0].As(); - u_int32_t rounds; - if (!(rounds = bcrypt_get_rounds(hash.c_str()))) { - throw Napi::Error::New(env, "invalid hash provided"); - } - return Napi::Number::New(env, rounds); - } - -} // anonymous namespace - -Napi::Object init(Napi::Env env, Napi::Object exports) { - exports.Set(Napi::String::New(env, "gen_salt_sync"), Napi::Function::New(env, GenerateSaltSync)); - exports.Set(Napi::String::New(env, "encrypt_sync"), Napi::Function::New(env, EncryptSync)); - exports.Set(Napi::String::New(env, "compare_sync"), Napi::Function::New(env, CompareSync)); - exports.Set(Napi::String::New(env, "get_rounds"), Napi::Function::New(env, GetRounds)); - exports.Set(Napi::String::New(env, "gen_salt"), Napi::Function::New(env, GenerateSalt)); - exports.Set(Napi::String::New(env, "encrypt"), Napi::Function::New(env, Encrypt)); - exports.Set(Napi::String::New(env, "compare"), Napi::Function::New(env, Compare)); - return exports; -} - -NODE_API_MODULE(NODE_GYP_MODULE_NAME, init) diff --git a/server/node_modules/bcrypt/src/blowfish.cc b/server/node_modules/bcrypt/src/blowfish.cc deleted file mode 100644 index 1fc6cf19..00000000 --- a/server/node_modules/bcrypt/src/blowfish.cc +++ /dev/null @@ -1,679 +0,0 @@ -/* $OpenBSD: blowfish.c,v 1.18 2004/11/02 17:23:26 hshoexer Exp $ */ -/* - * Blowfish block cipher for OpenBSD - * Copyright 1997 Niels Provos - * All rights reserved. - * - * Implementation advice by David Mazieres . - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Niels Provos. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This code is derived from section 14.3 and the given source - * in section V of Applied Cryptography, second edition. - * Blowfish is an unpatented fast block cipher designed by - * Bruce Schneier. - */ - -#include "node_blf.h" - -#undef inline -#ifdef __GNUC__ -#define inline __inline -#else /* !__GNUC__ */ -#define inline -#endif /* !__GNUC__ */ - -/* Function for Feistel Networks */ - -#define F(s, x) ((((s)[ (((x)>>24)&0xFF)] \ - + (s)[0x100 + (((x)>>16)&0xFF)]) \ - ^ (s)[0x200 + (((x)>> 8)&0xFF)]) \ - + (s)[0x300 + ( (x) &0xFF)]) - -#define BLFRND(s,p,i,j,n) (i ^= F(s,j) ^ (p)[n]) - -void -Blowfish_encipher(blf_ctx *c, u_int32_t *xl, u_int32_t *xr) -{ - u_int32_t Xl; - u_int32_t Xr; - u_int32_t *s = c->S[0]; - u_int32_t *p = c->P; - - Xl = *xl; - Xr = *xr; - - Xl ^= p[0]; - BLFRND(s, p, Xr, Xl, 1); BLFRND(s, p, Xl, Xr, 2); - BLFRND(s, p, Xr, Xl, 3); BLFRND(s, p, Xl, Xr, 4); - BLFRND(s, p, Xr, Xl, 5); BLFRND(s, p, Xl, Xr, 6); - BLFRND(s, p, Xr, Xl, 7); BLFRND(s, p, Xl, Xr, 8); - BLFRND(s, p, Xr, Xl, 9); BLFRND(s, p, Xl, Xr, 10); - BLFRND(s, p, Xr, Xl, 11); BLFRND(s, p, Xl, Xr, 12); - BLFRND(s, p, Xr, Xl, 13); BLFRND(s, p, Xl, Xr, 14); - BLFRND(s, p, Xr, Xl, 15); BLFRND(s, p, Xl, Xr, 16); - - *xl = Xr ^ p[17]; - *xr = Xl; -} - -void -Blowfish_decipher(blf_ctx *c, u_int32_t *xl, u_int32_t *xr) -{ - u_int32_t Xl; - u_int32_t Xr; - u_int32_t *s = c->S[0]; - u_int32_t *p = c->P; - - Xl = *xl; - Xr = *xr; - - Xl ^= p[17]; - BLFRND(s, p, Xr, Xl, 16); BLFRND(s, p, Xl, Xr, 15); - BLFRND(s, p, Xr, Xl, 14); BLFRND(s, p, Xl, Xr, 13); - BLFRND(s, p, Xr, Xl, 12); BLFRND(s, p, Xl, Xr, 11); - BLFRND(s, p, Xr, Xl, 10); BLFRND(s, p, Xl, Xr, 9); - BLFRND(s, p, Xr, Xl, 8); BLFRND(s, p, Xl, Xr, 7); - BLFRND(s, p, Xr, Xl, 6); BLFRND(s, p, Xl, Xr, 5); - BLFRND(s, p, Xr, Xl, 4); BLFRND(s, p, Xl, Xr, 3); - BLFRND(s, p, Xr, Xl, 2); BLFRND(s, p, Xl, Xr, 1); - - *xl = Xr ^ p[0]; - *xr = Xl; -} - -void -Blowfish_initstate(blf_ctx *c) -{ - /* P-box and S-box tables initialized with digits of Pi */ - - static const blf_ctx initstate = - { { - { - 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, - 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, - 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, - 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, - 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, - 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, - 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, - 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e, - 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, - 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, - 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, - 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, - 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, - 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677, - 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, - 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, - 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88, - 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, - 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, - 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0, - 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, - 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, - 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88, - 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, - 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, - 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, - 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, - 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, - 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba, - 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, - 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, - 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09, - 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, - 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, - 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279, - 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, - 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, - 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82, - 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, - 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, - 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, - 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, - 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, - 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8, - 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, - 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, - 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7, - 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, - 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, - 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1, - 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, - 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, - 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477, - 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, - 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, - 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, - 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, - 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, - 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, - 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, - 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, - 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, - 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, - 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a}, - { - 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, - 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, - 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, - 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, - 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, - 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, - 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, - 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1, - 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, - 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, - 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff, - 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, - 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, - 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7, - 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, - 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, - 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf, - 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, - 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, - 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87, - 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, - 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, - 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16, - 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, - 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, - 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509, - 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, - 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, - 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f, - 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, - 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, - 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, - 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, - 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, - 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802, - 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, - 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, - 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf, - 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, - 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, - 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50, - 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, - 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, - 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281, - 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, - 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, - 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128, - 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, - 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, - 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0, - 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, - 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, - 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, - 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, - 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, - 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061, - 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, - 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, - 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, - 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, - 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, - 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, - 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, - 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7}, - { - 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, - 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, - 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, - 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, - 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, - 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, - 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, - 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb, - 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, - 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, - 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42, - 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, - 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, - 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb, - 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, - 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, - 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33, - 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, - 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, - 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc, - 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, - 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, - 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, - 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, - 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, - 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728, - 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, - 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, - 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37, - 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, - 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, - 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b, - 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, - 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, - 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d, - 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, - 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, - 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, - 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, - 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, - 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d, - 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, - 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, - 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61, - 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, - 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, - 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2, - 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, - 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, - 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633, - 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, - 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, - 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, - 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, - 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, - 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62, - 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, - 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, - 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, - 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, - 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, - 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, - 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, - 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0}, - { - 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, - 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, - 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, - 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, - 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, - 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, - 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, - 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22, - 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, - 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, - 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9, - 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, - 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, - 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51, - 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, - 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, - 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b, - 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, - 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, - 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd, - 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, - 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, - 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb, - 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, - 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, - 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32, - 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, - 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, - 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, - 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, - 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, - 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47, - 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, - 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, - 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84, - 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, - 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, - 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd, - 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, - 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, - 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38, - 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, - 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, - 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525, - 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, - 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, - 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964, - 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, - 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, - 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d, - 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, - 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, - 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02, - 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, - 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, - 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a, - 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, - 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, - 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, - 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, - 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, - 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, - 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, - 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6} - }, - { - 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, - 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, - 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, - 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, - 0x9216d5d9, 0x8979fb1b - } }; - - *c = initstate; -} - -u_int32_t -Blowfish_stream2word(const u_int8_t *data, u_int16_t databytes, - u_int16_t *current) -{ - u_int8_t i; - u_int16_t j; - u_int32_t temp; - - temp = 0x00000000; - j = *current; - - for (i = 0; i < 4; i++, j++) { - if (j >= databytes) - j = 0; - temp = (temp << 8) | data[j]; - } - - *current = j; - return temp; -} - -void -Blowfish_expand0state(blf_ctx *c, const u_int8_t *key, u_int16_t keybytes) -{ - u_int16_t i; - u_int16_t j; - u_int16_t k; - u_int32_t temp; - u_int32_t datal; - u_int32_t datar; - - j = 0; - for (i = 0; i < BLF_N + 2; i++) { - /* Extract 4 int8 to 1 int32 from keystream */ - temp = Blowfish_stream2word(key, keybytes, &j); - c->P[i] = c->P[i] ^ temp; - } - - j = 0; - datal = 0x00000000; - datar = 0x00000000; - for (i = 0; i < BLF_N + 2; i += 2) { - Blowfish_encipher(c, &datal, &datar); - - c->P[i] = datal; - c->P[i + 1] = datar; - } - - for (i = 0; i < 4; i++) { - for (k = 0; k < 256; k += 2) { - Blowfish_encipher(c, &datal, &datar); - - c->S[i][k] = datal; - c->S[i][k + 1] = datar; - } - } -} - - -void -Blowfish_expandstate(blf_ctx *c, const u_int8_t *data, u_int16_t databytes, - const u_int8_t *key, u_int16_t keybytes) -{ - u_int16_t i; - u_int16_t j; - u_int16_t k; - u_int32_t temp; - u_int32_t datal; - u_int32_t datar; - - j = 0; - for (i = 0; i < BLF_N + 2; i++) { - /* Extract 4 int8 to 1 int32 from keystream */ - temp = Blowfish_stream2word(key, keybytes, &j); - c->P[i] = c->P[i] ^ temp; - } - - j = 0; - datal = 0x00000000; - datar = 0x00000000; - for (i = 0; i < BLF_N + 2; i += 2) { - datal ^= Blowfish_stream2word(data, databytes, &j); - datar ^= Blowfish_stream2word(data, databytes, &j); - Blowfish_encipher(c, &datal, &datar); - - c->P[i] = datal; - c->P[i + 1] = datar; - } - - for (i = 0; i < 4; i++) { - for (k = 0; k < 256; k += 2) { - datal ^= Blowfish_stream2word(data, databytes, &j); - datar ^= Blowfish_stream2word(data, databytes, &j); - Blowfish_encipher(c, &datal, &datar); - - c->S[i][k] = datal; - c->S[i][k + 1] = datar; - } - } - -} - -void -blf_key(blf_ctx *c, const u_int8_t *k, u_int16_t len) -{ - /* Initialize S-boxes and subkeys with Pi */ - Blowfish_initstate(c); - - /* Transform S-boxes and subkeys with key */ - Blowfish_expand0state(c, k, len); -} - -void -blf_enc(blf_ctx *c, u_int32_t *data, u_int16_t blocks) -{ - u_int32_t *d; - u_int16_t i; - - d = data; - for (i = 0; i < blocks; i++) { - Blowfish_encipher(c, d, d + 1); - d += 2; - } -} - -void -blf_dec(blf_ctx *c, u_int32_t *data, u_int16_t blocks) -{ - u_int32_t *d; - u_int16_t i; - - d = data; - for (i = 0; i < blocks; i++) { - Blowfish_decipher(c, d, d + 1); - d += 2; - } -} - -void -blf_ecb_encrypt(blf_ctx *c, u_int8_t *data, u_int32_t len) -{ - u_int32_t l, r; - u_int32_t i; - - for (i = 0; i < len; i += 8) { - l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]; - r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]; - Blowfish_encipher(c, &l, &r); - data[0] = l >> 24 & 0xff; - data[1] = l >> 16 & 0xff; - data[2] = l >> 8 & 0xff; - data[3] = l & 0xff; - data[4] = r >> 24 & 0xff; - data[5] = r >> 16 & 0xff; - data[6] = r >> 8 & 0xff; - data[7] = r & 0xff; - data += 8; - } -} - -void -blf_ecb_decrypt(blf_ctx *c, u_int8_t *data, u_int32_t len) -{ - u_int32_t l, r; - u_int32_t i; - - for (i = 0; i < len; i += 8) { - l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]; - r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]; - Blowfish_decipher(c, &l, &r); - data[0] = l >> 24 & 0xff; - data[1] = l >> 16 & 0xff; - data[2] = l >> 8 & 0xff; - data[3] = l & 0xff; - data[4] = r >> 24 & 0xff; - data[5] = r >> 16 & 0xff; - data[6] = r >> 8 & 0xff; - data[7] = r & 0xff; - data += 8; - } -} - -void -blf_cbc_encrypt(blf_ctx *c, u_int8_t *iv, u_int8_t *data, u_int32_t len) -{ - u_int32_t l, r; - u_int32_t i, j; - - for (i = 0; i < len; i += 8) { - for (j = 0; j < 8; j++) - data[j] ^= iv[j]; - l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]; - r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]; - Blowfish_encipher(c, &l, &r); - data[0] = l >> 24 & 0xff; - data[1] = l >> 16 & 0xff; - data[2] = l >> 8 & 0xff; - data[3] = l & 0xff; - data[4] = r >> 24 & 0xff; - data[5] = r >> 16 & 0xff; - data[6] = r >> 8 & 0xff; - data[7] = r & 0xff; - iv = data; - data += 8; - } -} - -void -blf_cbc_decrypt(blf_ctx *c, u_int8_t *iva, u_int8_t *data, u_int32_t len) -{ - u_int32_t l, r; - u_int8_t *iv; - u_int32_t i, j; - - iv = data + len - 16; - data = data + len - 8; - for (i = len - 8; i >= 8; i -= 8) { - l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]; - r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]; - Blowfish_decipher(c, &l, &r); - data[0] = l >> 24 & 0xff; - data[1] = l >> 16 & 0xff; - data[2] = l >> 8 & 0xff; - data[3] = l & 0xff; - data[4] = r >> 24 & 0xff; - data[5] = r >> 16 & 0xff; - data[6] = r >> 8 & 0xff; - data[7] = r & 0xff; - for (j = 0; j < 8; j++) - data[j] ^= iv[j]; - iv -= 8; - data -= 8; - } - l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]; - r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]; - Blowfish_decipher(c, &l, &r); - data[0] = l >> 24 & 0xff; - data[1] = l >> 16 & 0xff; - data[2] = l >> 8 & 0xff; - data[3] = l & 0xff; - data[4] = r >> 24 & 0xff; - data[5] = r >> 16 & 0xff; - data[6] = r >> 8 & 0xff; - data[7] = r & 0xff; - for (j = 0; j < 8; j++) - data[j] ^= iva[j]; -} - -#if 0 -void -report(u_int32_t data[], u_int16_t len) -{ - u_int16_t i; - for (i = 0; i < len; i += 2) - printf("Block %0hd: %08lx %08lx.\n", - i / 2, data[i], data[i + 1]); -} -void -main(void) -{ - - blf_ctx c; - char key[] = "AAAAA"; - char key2[] = "abcdefghijklmnopqrstuvwxyz"; - - u_int32_t data[10]; - u_int32_t data2[] = - {0x424c4f57l, 0x46495348l}; - - u_int16_t i; - - /* First test */ - for (i = 0; i < 10; i++) - data[i] = i; - - blf_key(&c, (u_int8_t *) key, 5); - blf_enc(&c, data, 5); - blf_dec(&c, data, 1); - blf_dec(&c, data + 2, 4); - printf("Should read as 0 - 9.\n"); - report(data, 10); - - /* Second test */ - blf_key(&c, (u_int8_t *) key2, strlen(key2)); - blf_enc(&c, data2, 1); - printf("\nShould read as: 0x324ed0fe 0xf413a203.\n"); - report(data2, 2); - blf_dec(&c, data2, 1); - report(data2, 2); -} -#endif diff --git a/server/node_modules/bcrypt/src/node_blf.h b/server/node_modules/bcrypt/src/node_blf.h deleted file mode 100644 index 2d50a39b..00000000 --- a/server/node_modules/bcrypt/src/node_blf.h +++ /dev/null @@ -1,132 +0,0 @@ -/* $OpenBSD: blf.h,v 1.7 2007/03/14 17:59:41 grunk Exp $ */ -/* - * Blowfish - a fast block cipher designed by Bruce Schneier - * - * Copyright 1997 Niels Provos - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Niels Provos. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _NODE_BLF_H_ -#define _NODE_BLF_H_ - -#include - -/* Solaris compatibility */ -#ifdef __sun -#define u_int8_t uint8_t -#define u_int16_t uint16_t -#define u_int32_t uint32_t -#define u_int64_t uint64_t -#endif - -#ifdef _WIN32 -#define u_int8_t unsigned __int8 -#define u_int16_t unsigned __int16 -#define u_int32_t unsigned __int32 -#define u_int64_t unsigned __int64 -#endif - -/* Windows ssize_t compatibility */ -#if defined(_WIN32) || defined(_WIN64) -# if defined(_WIN64) - typedef __int64 LONG_PTR; -# else - typedef long LONG_PTR; -# endif - typedef LONG_PTR SSIZE_T; - typedef SSIZE_T ssize_t; -#endif - -/* z/OS compatibility */ -#ifdef __MVS__ -typedef unsigned char u_int8_t; -typedef unsigned short u_int16_t; -typedef unsigned int u_int32_t; -typedef unsigned long long u_int64_t; -#endif - -#define BCRYPT_VERSION '2' -#define BCRYPT_MAXSALT 16 /* Precomputation is just so nice */ -#define BCRYPT_BLOCKS 6 /* Ciphertext blocks */ -#define BCRYPT_MINROUNDS 16 /* we have log2(rounds) in salt */ - -/* Schneier specifies a maximum key length of 56 bytes. - * This ensures that every key bit affects every cipher - * bit. However, the subkeys can hold up to 72 bytes. - * Warning: For normal blowfish encryption only 56 bytes - * of the key affect all cipherbits. - */ - -#define BLF_N 16 /* Number of Subkeys */ -#define BLF_MAXKEYLEN ((BLF_N-2)*4) /* 448 bits */ -#define BLF_MAXUTILIZED ((BLF_N+2)*4) /* 576 bits */ - -#define _PASSWORD_LEN 128 /* max length, not counting NUL */ -#define _SALT_LEN 32 /* max length */ - -/* Blowfish context */ -typedef struct BlowfishContext { - u_int32_t S[4][256]; /* S-Boxes */ - u_int32_t P[BLF_N + 2]; /* Subkeys */ -} blf_ctx; - -/* Raw access to customized Blowfish - * blf_key is just: - * Blowfish_initstate( state ) - * Blowfish_expand0state( state, key, keylen ) - */ - -void Blowfish_encipher(blf_ctx *, u_int32_t *, u_int32_t *); -void Blowfish_decipher(blf_ctx *, u_int32_t *, u_int32_t *); -void Blowfish_initstate(blf_ctx *); -void Blowfish_expand0state(blf_ctx *, const u_int8_t *, u_int16_t); -void Blowfish_expandstate -(blf_ctx *, const u_int8_t *, u_int16_t, const u_int8_t *, u_int16_t); - -/* Standard Blowfish */ - -void blf_key(blf_ctx *, const u_int8_t *, u_int16_t); -void blf_enc(blf_ctx *, u_int32_t *, u_int16_t); -void blf_dec(blf_ctx *, u_int32_t *, u_int16_t); - -void blf_ecb_encrypt(blf_ctx *, u_int8_t *, u_int32_t); -void blf_ecb_decrypt(blf_ctx *, u_int8_t *, u_int32_t); - -void blf_cbc_encrypt(blf_ctx *, u_int8_t *, u_int8_t *, u_int32_t); -void blf_cbc_decrypt(blf_ctx *, u_int8_t *, u_int8_t *, u_int32_t); - -/* Converts u_int8_t to u_int32_t */ -u_int32_t Blowfish_stream2word(const u_int8_t *, u_int16_t , u_int16_t *); - -/* bcrypt functions*/ -void bcrypt_gensalt(char, u_int8_t, u_int8_t*, char *); -void bcrypt(const char *, size_t key_len, const char *, char *); -void encode_salt(char *, u_int8_t *, char, u_int16_t, u_int8_t); -u_int32_t bcrypt_get_rounds(const char *); - -#endif diff --git a/server/node_modules/bcrypt/test/async.test.js b/server/node_modules/bcrypt/test/async.test.js deleted file mode 100644 index fb59367a..00000000 --- a/server/node_modules/bcrypt/test/async.test.js +++ /dev/null @@ -1,209 +0,0 @@ -const bcrypt = require('../bcrypt'); - -test('salt_length', done => { - expect.assertions(1); - bcrypt.genSalt(10, function (err, salt) { - expect(salt).toHaveLength(29); - done(); - }); -}) - -test('salt_only_cb', () => { - expect.assertions(1); - expect(() => { - bcrypt.genSalt((err, salt) => { - }); - }).not.toThrow(); -}) - -test('salt_rounds_is_string_number', done => { - expect.assertions(2); - bcrypt.genSalt('10', void 0, function (err, salt) { - expect(err instanceof Error).toBe(true) - expect(err.message).toBe('rounds must be a number') - done(); - }); -}) - -test('salt_rounds_is_string_non_number', done => { - expect.assertions(2); - bcrypt.genSalt('z', function (err, salt) { - expect(err instanceof Error).toBe(true) - expect(err.message).toBe('rounds must be a number') - done(); - }); -}) - -test('salt_minor', done => { - expect.assertions(3); - bcrypt.genSalt(10, 'a', function (err, value) { - expect(value).toHaveLength(29); - const [_, minor, salt] = value.split('$'); - expect(minor).toEqual('2a'); - expect(salt).toEqual('10'); - done(); - }); -}) - -test('salt_minor_b', done => { - expect.assertions(3); - bcrypt.genSalt(10, 'b', function (err, value) { - expect(value).toHaveLength(29); - const [_, minor, salt] = value.split('$'); - expect(minor).toEqual('2b'); - expect(salt).toEqual('10'); - done(); - }); -}) - -test('hash', done => { - expect.assertions(2); - bcrypt.genSalt(10, function (err, salt) { - bcrypt.hash('password', salt, function (err, res) { - expect(res).toBeDefined(); - expect(err).toBeUndefined(); - done(); - }); - }); -}) - -test('hash_rounds', done => { - expect.assertions(1); - bcrypt.hash('bacon', 8, function (err, hash) { - expect(bcrypt.getRounds(hash)).toEqual(8); - done(); - }); -}) - -test('hash_empty_strings', done => { - expect.assertions(1); - bcrypt.genSalt(10, function (err, salt) { - bcrypt.hash('', salt, function (err, res) { - expect(res).toBeDefined(); - done(); - }); - }); -}) - -test('hash_fails_with_empty_salt', done => { - expect.assertions(1); - bcrypt.hash('', '', function (err, res) { - expect(err.message).toBe('Invalid salt. Salt must be in the form of: $Vers$log2(NumRounds)$saltvalue') - done(); - }); -}) - -test('hash_no_params', done => { - expect.assertions(1); - bcrypt.hash(function (err, hash) { - expect(err.message).toBe('data must be a string or Buffer and salt must either be a salt string or a number of rounds') - done(); - }); -}) - -test('hash_one_param', done => { - expect.assertions(1); - bcrypt.hash('password', function (err, hash) { - expect(err.message).toBe('data must be a string or Buffer and salt must either be a salt string or a number of rounds'); - done(); - }); -}) - -test('hash_salt_validity', done => { - expect.assertions(2); - bcrypt.hash('password', '$2a$10$somesaltyvaluertsetrse', function (err, enc) { - expect(err).toBeUndefined(); - bcrypt.hash('password', 'some$value', function (err, enc) { - expect(err.message).toBe("Invalid salt. Salt must be in the form of: $Vers$log2(NumRounds)$saltvalue"); - done(); - }); - }); -}) - -test('verify_salt', done => { - expect.assertions(2); - bcrypt.genSalt(10, function (err, value) { - const [_, version, rounds] = value.split('$'); - expect(version).toEqual('2b'); - expect(rounds).toEqual('10'); - done(); - }); -}) - -test('verify_salt_min_rounds', done => { - expect.assertions(2); - bcrypt.genSalt(1, function (err, value) { - const [_, version, rounds] = value.split('$'); - expect(version).toEqual('2b'); - expect(rounds).toEqual('04'); - done(); - }); -}) - -test('verify_salt_max_rounds', done => { - expect.assertions(2); - bcrypt.genSalt(100, function (err, value) { - const [_, version, rounds] = value.split('$'); - expect(version).toEqual('2b'); - expect(rounds).toEqual('31'); - done(); - }); -}) - -test('hash_compare', done => { - expect.assertions(2); - bcrypt.genSalt(10, function (err, salt) { - bcrypt.hash("test", salt, function (err, hash) { - bcrypt.compare("test", hash, function (err, res) { - expect(hash).toBeDefined(); - bcrypt.compare("blah", hash, function (err, res) { - expect(res).toBe(false); - done(); - }); - }); - }); - }); -}) - -test('hash_compare_empty_strings', done => { - expect.assertions(2); - const hash = bcrypt.hashSync("test", bcrypt.genSaltSync(10)); - - bcrypt.compare("", hash, function (err, res) { - expect(res).toEqual(false) - bcrypt.compare("", "", function (err, res) { - expect(res).toEqual(false); - done(); - }); - }); -}) - -test('hash_compare_invalid_strings', done => { - expect.assertions(2); - const fullString = 'envy1362987212538'; - const hash = '$2a$10$XOPbrlUPQdwdJUpSrIF6X.LbE14qsMmKGhM1A8W9iqaG3vv1BD7WC'; - const wut = ':'; - bcrypt.compare(fullString, hash, function (err, res) { - expect(res).toBe(true); - bcrypt.compare(fullString, wut, function (err, res) { - expect(res).toBe(false); - done(); - }); - }); -}) - -test('compare_no_params', done => { - expect.assertions(1); - bcrypt.compare(function (err, hash) { - expect(err.message).toBe('data and hash arguments required'); - done(); - }); -}) - -test('hash_compare_one_param', done => { - expect.assertions(1); - bcrypt.compare('password', function (err, hash) { - expect(err.message).toBe('data and hash arguments required'); - done(); - }); -}) diff --git a/server/node_modules/bcrypt/test/implementation.test.js b/server/node_modules/bcrypt/test/implementation.test.js deleted file mode 100644 index 647f32a9..00000000 --- a/server/node_modules/bcrypt/test/implementation.test.js +++ /dev/null @@ -1,48 +0,0 @@ -const bcrypt = require('../bcrypt'); - -// some tests were adapted from https://github.com/riverrun/bcrypt_elixir/blob/master/test/base_test.exs -// which are under the BSD LICENSE - -test('openwall', () => { - expect(bcrypt.hashSync("U*U", "$2a$05$CCCCCCCCCCCCCCCCCCCCC.")).toStrictEqual("$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW"); - expect(bcrypt.hashSync("U*U*", "$2a$05$CCCCCCCCCCCCCCCCCCCCC.")).toStrictEqual("$2a$05$CCCCCCCCCCCCCCCCCCCCC.VGOzA784oUp/Z0DY336zx7pLYAy0lwK"); - expect(bcrypt.hashSync("U*U*U", "$2a$05$XXXXXXXXXXXXXXXXXXXXXO")).toStrictEqual("$2a$05$XXXXXXXXXXXXXXXXXXXXXOAcXxm9kjPGEMsLznoKqmqw7tc8WCx4a"); - expect(bcrypt.hashSync("", "$2a$05$CCCCCCCCCCCCCCCCCCCCC.")).toStrictEqual("$2a$05$CCCCCCCCCCCCCCCCCCCCC.7uG0VCzI2bS7j6ymqJi9CdcdxiRTWNy"); - expect(bcrypt.hashSync("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", "$2a$05$abcdefghijklmnopqrstuu")).toStrictEqual("$2a$05$abcdefghijklmnopqrstuu5s2v8.iXieOjg/.AySBTTZIIVFJeBui"); -}) - -test('openbsd', () => { - expect(bcrypt.hashSync("000000000000000000000000000000000000000000000000000000000000000000000000", "$2a$05$CCCCCCCCCCCCCCCCCCCCC.")).toStrictEqual("$2a$05$CCCCCCCCCCCCCCCCCCCCC.6.O1dLNbjod2uo0DVcW.jHucKbPDdHS") - expect(bcrypt.hashSync("000000000000000000000000000000000000000000000000000000000000000000000000", "$2b$05$CCCCCCCCCCCCCCCCCCCCC.")).toStrictEqual("$2b$05$CCCCCCCCCCCCCCCCCCCCC.6.O1dLNbjod2uo0DVcW.jHucKbPDdHS") -}) - -test('long_passwords', () => { - // bcrypt wrap-around bug in $2a$ - expect(bcrypt.hashSync("012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234", "$2a$05$CCCCCCCCCCCCCCCCCCCCC.")).toStrictEqual("$2a$05$CCCCCCCCCCCCCCCCCCCCC.6.O1dLNbjod2uo0DVcW.jHucKbPDdHS") - expect(bcrypt.hashSync("01XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "$2a$05$CCCCCCCCCCCCCCCCCCCCC.")).toStrictEqual("$2a$05$CCCCCCCCCCCCCCCCCCCCC.6.O1dLNbjod2uo0DVcW.jHucKbPDdHS") - - // tests for $2b$ which fixes wrap-around bugs - expect(bcrypt.hashSync("012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234", "$2b$05$CCCCCCCCCCCCCCCCCCCCC.")).toStrictEqual("$2b$05$CCCCCCCCCCCCCCCCCCCCC.XxrQqgBi/5Sxuq9soXzDtjIZ7w5pMfK") - expect(bcrypt.hashSync("0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345", "$2b$05$CCCCCCCCCCCCCCCCCCCCC.")).toStrictEqual("$2b$05$CCCCCCCCCCCCCCCCCCCCC.XxrQqgBi/5Sxuq9soXzDtjIZ7w5pMfK") -}) - -test('embedded_nulls', () => { - expect(bcrypt.hashSync("Passw\0rd123", "$2b$05$CCCCCCCCCCCCCCCCCCCCC.")).toStrictEqual("$2b$05$CCCCCCCCCCCCCCCCCCCCC.VHy/kzL4sCcX3Ib3wN5rNGiRt.TpfxS") - expect(bcrypt.hashSync("Passw\0 you can literally write anything after the NUL character", "$2b$05$CCCCCCCCCCCCCCCCCCCCC.")).toStrictEqual("$2b$05$CCCCCCCCCCCCCCCCCCCCC.4vJLJQ6nZ/70INTjjSZWQ0iyUek92tu") - expect(bcrypt.hashSync(Buffer.from("Passw\0 you can literally write anything after the NUL character"), "$2b$05$CCCCCCCCCCCCCCCCCCCCC.")).toStrictEqual("$2b$05$CCCCCCCCCCCCCCCCCCCCC.4vJLJQ6nZ/70INTjjSZWQ0iyUek92tu") -}) - -test('shorten_salt_to_128_bits', () => { - expect(bcrypt.hashSync("test", "$2a$10$1234567899123456789012")).toStrictEqual("$2a$10$123456789912345678901u.OtL1A1eGK5wmvBKUDYKvuVKI7h2XBu") - expect(bcrypt.hashSync("U*U*", "$2a$05$CCCCCCCCCCCCCCCCCCCCCh")).toStrictEqual("$2a$05$CCCCCCCCCCCCCCCCCCCCCeUQ7VjYZ2hd4bLYZdhuPpZMUpEUJDw1S") - expect(bcrypt.hashSync("U*U*", "$2a$05$CCCCCCCCCCCCCCCCCCCCCM")).toStrictEqual("$2a$05$CCCCCCCCCCCCCCCCCCCCC.VGOzA784oUp/Z0DY336zx7pLYAy0lwK") - expect(bcrypt.hashSync("U*U*", "$2a$05$CCCCCCCCCCCCCCCCCCCCCA")).toStrictEqual("$2a$05$CCCCCCCCCCCCCCCCCCCCC.VGOzA784oUp/Z0DY336zx7pLYAy0lwK") -}) - -test('consistency', () => { - expect(bcrypt.hashSync("ππππππππ", "$2a$10$.TtQJ4Jr6isd4Hp.mVfZeu")).toStrictEqual("$2a$10$.TtQJ4Jr6isd4Hp.mVfZeuh6Gws4rOQ/vdBczhDx.19NFK0Y84Dle") - expect(bcrypt.hashSync("p@5sw0rd", "$2b$12$zQ4CooEXdGqcwi0PHsgc8e")).toStrictEqual("$2b$12$zQ4CooEXdGqcwi0PHsgc8eAf0DLXE/XHoBE8kCSGQ97rXwuClaPam") - expect(bcrypt.hashSync("C'est bon, la vie!", "$2b$12$cbo7LZ.wxgW4yxAA5Vqlv.")).toStrictEqual("$2b$12$cbo7LZ.wxgW4yxAA5Vqlv.KR6QFPt4qCdc9RYJNXxa/rbUOp.1sw.") - expect(bcrypt.hashSync("ἓν οἶδα ὅτι οὐδὲν οἶδα", "$2b$12$LeHKWR2bmrazi/6P22Jpau")).toStrictEqual("$2b$12$LeHKWR2bmrazi/6P22JpauX5my/eKwwKpWqL7L5iEByBnxNc76FRW") - expect(bcrypt.hashSync(Buffer.from("ἓν οἶδα ὅτι οὐδὲν οἶδα"), "$2b$12$LeHKWR2bmrazi/6P22Jpau")).toStrictEqual("$2b$12$LeHKWR2bmrazi/6P22JpauX5my/eKwwKpWqL7L5iEByBnxNc76FRW") -}) diff --git a/server/node_modules/bcrypt/test/promise.test.js b/server/node_modules/bcrypt/test/promise.test.js deleted file mode 100644 index 01034182..00000000 --- a/server/node_modules/bcrypt/test/promise.test.js +++ /dev/null @@ -1,168 +0,0 @@ -const bcrypt = require('../bcrypt'); -const promises = require('../promises'); - -test('salt_returns_promise_on_no_args', () => { - // make sure test passes with non-native implementations such as bluebird - // http://stackoverflow.com/questions/27746304/how-do-i-tell-if-an-object-is-a-promise - expect(typeof bcrypt.genSalt().then).toEqual('function') -}) - -test('salt_returns_promise_on_null_callback', () => { - expect(typeof bcrypt.genSalt(13, null, null).then).toEqual('function') -}) - -test('salt_length', () => { - return expect(bcrypt.genSalt(10)).resolves.toHaveLength(29); -}) - -test('salt_rounds_is_string_number', () => { - return expect(bcrypt.genSalt('10')).rejects.toThrow('rounds must be a number'); -}) - -test('salt_rounds_is_string_non_number', () => { - return expect(bcrypt.genSalt('b')).rejects.toThrow('rounds must be a number'); -}) - -test('hash_returns_promise_on_null_callback', () => { - expect(typeof bcrypt.hash('password', 10, null).then).toStrictEqual('function') -}) - -test('hash', () => { - return expect(bcrypt.genSalt(10) - .then(salt => bcrypt.hash('password', salt))).resolves.toBeDefined() -}) - -test('hash_rounds', () => { - return bcrypt.hash('bacon', 8).then(hash => { - expect(bcrypt.getRounds(hash)).toStrictEqual(8) - }); -}) - -test('hash_empty_strings', () => { - expect.assertions(2); - return Promise.all([ - expect(bcrypt.genSalt(10) - .then(salt => bcrypt.hash('', salt))) - .resolves.toBeDefined(), - expect(bcrypt.hash('', '')).rejects.toThrow(''), - ]); -}) - -test('hash_no_params', () => { - expect.assertions(1); - return expect(bcrypt.hash()).rejects.toThrow('data and salt arguments required'); -}) - -test('hash_one_param', () => { - return expect(bcrypt.hash('password')).rejects.toThrow('data and salt arguments required'); -}) - -test('hash_salt_validity', () => { - expect.assertions(2); - return Promise.all( - [ - expect(bcrypt.hash('password', '$2a$10$somesaltyvaluertsetrse')).resolves.toBeDefined(), - expect(bcrypt.hash('password', 'some$value')).rejects.toThrow("Invalid salt. Salt must be in the form of: $Vers$log2(NumRounds)$saltvalue") - ]); -}) - -test('verify_salt', () => { - expect.assertions(2); - return bcrypt.genSalt(10).then(result => { - const [_, version, salt] = result.split('$'); - expect(version).toEqual('2b') - expect(salt).toEqual('10') - }); -}) - -test('verify_salt_min_rounds', () => { - expect.assertions(2); - return bcrypt.genSalt(1).then(value => { - const [_, version, rounds] = value.split('$'); - expect(version).toEqual('2b'); - expect(rounds).toEqual('04'); - }); -}) - -test('verify_salt_max_rounds', () => { - expect.assertions(2); - return bcrypt.genSalt(100).then(value => { - const [_, version, rounds] = value.split('$'); - expect(version).toEqual('2b'); - expect(rounds).toEqual('31'); - }); -}) - -test('hash_compare_returns_promise_on_null_callback', () => { - expect(typeof bcrypt.compare('password', 'something', null).then).toStrictEqual('function') -}) - -test('hash_compare', () => { - expect.assertions(3); - return bcrypt.genSalt(10).then(function (salt) { - expect(salt).toHaveLength(29); - return bcrypt.hash("test", salt); - }).then(hash => Promise.all( - [ - expect(bcrypt.compare("test", hash)).resolves.toEqual(true), - expect(bcrypt.compare("blah", hash)).resolves.toEqual(false) - ])); -}) - -test('hash_compare_empty_strings', () => { - expect.assertions(2); - const hash = bcrypt.hashSync("test", bcrypt.genSaltSync(10)); - return Promise.all([ - expect(bcrypt.compare("", hash)).resolves.toEqual(false), - expect(bcrypt.compare("", "")).resolves.toEqual(false) - ]); -}) - -test('hash_compare_invalid_strings', () => { - const fullString = 'envy1362987212538'; - const hash = '$2a$10$XOPbrlUPQdwdJUpSrIF6X.LbE14qsMmKGhM1A8W9iqaG3vv1BD7WC'; - const wut = ':'; - return Promise.all([ - expect(bcrypt.compare(fullString, hash)).resolves.toEqual(true), - expect(bcrypt.compare(fullString, wut)).resolves.toEqual(false), - ]); -}) - -test('hash_compare_no_params', () => { - expect.assertions(1); - return expect(bcrypt.compare()).rejects.toThrow('data and hash arguments required') -}) - -test('hash_compare_one_param', () => { - expect.assertions(1); - return expect(bcrypt.compare('password')).rejects.toThrow('data and hash arguments required') -}) - -test('change_promise_impl_reject', () => { - - promises.use({ - reject: function () { - return 'mock'; - } - }); - - expect(promises.reject()).toEqual('mock'); - - // need to reset the promise implementation because of require cache - promises.use(global.Promise); -}) - -test('change_promise_impl_promise', () => { - - promises.use({ - reject: function (err) { - expect(err.message).toEqual('fn must be a function'); - return 'mock'; - } - }); - - expect(promises.promise('', '', '')).toEqual('mock'); - - // need to reset the promise implementation because of require cache - promises.use(global.Promise); -}) diff --git a/server/node_modules/bcrypt/test/repetitions.test.js b/server/node_modules/bcrypt/test/repetitions.test.js deleted file mode 100644 index 63ff4077..00000000 --- a/server/node_modules/bcrypt/test/repetitions.test.js +++ /dev/null @@ -1,55 +0,0 @@ -const bcrypt = require('../bcrypt'); - -const EXPECTED = 2500; //number of times to iterate these tests.) -const { TEST_TIMEOUT_SECONDS } = process.env; -let timeout = 5e3; // default test timeout - -// it is necessary to increase the test timeout when emulating cross-architecture -// environments (i.e. arm64 from x86-64 host) which have significantly reduced performance: -if ( TEST_TIMEOUT_SECONDS ) - timeout = Number.parseInt(TEST_TIMEOUT_SECONDS, 10) * 1e3; - -jest.setTimeout(timeout); - -test('salt_length', () => { - expect.assertions(EXPECTED); - - return Promise.all(Array.from({length: EXPECTED}, - () => bcrypt.genSalt(10) - .then(salt => expect(salt).toHaveLength(29)))); -}) - -test('test_hash_length', () => { - expect.assertions(EXPECTED); - const SALT = '$2a$04$TnjywYklQbbZjdjBgBoA4e'; - return Promise.all(Array.from({length: EXPECTED}, - () => bcrypt.hash('test', SALT) - .then(hash => expect(hash).toHaveLength(60)))); -}) - -test('test_compare', () => { - expect.assertions(EXPECTED); - const HASH = '$2a$04$TnjywYklQbbZjdjBgBoA4e9G7RJt9blgMgsCvUvus4Iv4TENB5nHy'; - return Promise.all(Array.from({length: EXPECTED}, - () => bcrypt.compare('test', HASH) - .then(match => expect(match).toEqual(true)))); -}) - -test('test_hash_and_compare', () => { - expect.assertions(EXPECTED * 3); - const salt = bcrypt.genSaltSync(4) - - return Promise.all(Array.from({length: EXPECTED}, - () => { - const password = 'secret' + Math.random(); - return bcrypt.hash(password, salt) - .then(hash => { - expect(hash).toHaveLength(60); - const goodCompare = bcrypt.compare(password, hash).then(res => expect(res).toEqual(true)); - const badCompare = bcrypt.compare('bad' + password, hash).then(res => expect(res).toEqual(false)); - - return Promise.all([goodCompare, badCompare]); - }); - })); -}, timeout * 3); - diff --git a/server/node_modules/bcrypt/test/sync.test.js b/server/node_modules/bcrypt/test/sync.test.js deleted file mode 100644 index 2e6809af..00000000 --- a/server/node_modules/bcrypt/test/sync.test.js +++ /dev/null @@ -1,125 +0,0 @@ -const bcrypt = require('../bcrypt') - -test('salt_length', () => { - const salt = bcrypt.genSaltSync(13); - expect(salt).toHaveLength(29); - const [_, version, rounds] = salt.split('$'); - expect(version).toStrictEqual('2b') - expect(rounds).toStrictEqual('13') -}) - -test('salt_no_params', () => { - const salt = bcrypt.genSaltSync(); - const [_, version, rounds] = salt.split('$'); - expect(version).toStrictEqual('2b') - expect(rounds).toStrictEqual('10') -}) - -test('salt_rounds_is_string_number', () => { - expect(() => bcrypt.genSaltSync('10')).toThrowError('rounds must be a number'); -}) - -test('salt_rounds_is_NaN', () => { - expect(() => bcrypt.genSaltSync('b')).toThrowError("rounds must be a number"); -}) - -test('salt_minor_a', () => { - const salt = bcrypt.genSaltSync(10, 'a'); - const [_, version, rounds] = salt.split('$'); - expect(version).toStrictEqual('2a') - expect(rounds).toStrictEqual('10') -}) - -test('salt_minor_b', () => { - const salt = bcrypt.genSaltSync(10, 'b'); - const [_, version, rounds] = salt.split('$'); - expect(version).toStrictEqual('2b') - expect(rounds).toStrictEqual('10') -}) - -test('hash', () => { - expect(() => bcrypt.hashSync('password', bcrypt.genSaltSync(10))).not.toThrow() -}) - -test('hash_rounds', () => { - const hash = bcrypt.hashSync('password', 8); - expect(bcrypt.getRounds(hash)).toStrictEqual(8) -}) - -test('hash_empty_string', () => { - expect(() => bcrypt.hashSync('', bcrypt.genSaltSync(10))).not.toThrow(); - expect(() => bcrypt.hashSync('password', '')).toThrowError('Invalid salt. Salt must be in the form of: $Vers$log2(NumRounds)$saltvalue'); - expect(() => bcrypt.hashSync('', '')).toThrowError('Invalid salt. Salt must be in the form of: $Vers$log2(NumRounds)$saltvalue'); -}) - -test('hash_pw_no_params', () => { - expect(() => bcrypt.hashSync()).toThrow('data and salt arguments required'); -}) - -test('hash_pw_one_param', () => { - expect(() => bcrypt.hashSync('password')).toThrow('data and salt arguments required'); -}) - -test('hash_pw_not_hash_str', () => { - expect(() => bcrypt.hashSync('password', {})).toThrow("data must be a string or Buffer and salt must either be a salt string or a number of rounds") -}) - -test('hash_salt_validity', () => { - expect(2); - expect(bcrypt.hashSync('password', '$2a$10$somesaltyvaluertsetrse')).toBeDefined() - expect(() => bcrypt.hashSync('password', 'some$value')).toThrow('Invalid salt. Salt must be in the form of: $Vers$log2(NumRounds)$saltvalue') -}) - -test('verify_salt', () => { - const salt = bcrypt.genSaltSync(10); - const split_salt = salt.split('$'); - expect(split_salt[1]).toStrictEqual('2b') - expect(split_salt[2]).toStrictEqual('10') -}) - -test('verify_salt_min_rounds', () => { - const salt = bcrypt.genSaltSync(1); - const split_salt = salt.split('$'); - expect(split_salt[1]).toStrictEqual('2b') - expect(split_salt[2]).toStrictEqual('04') -}) - -test('verify_salt_max_rounds', () => { - const salt = bcrypt.genSaltSync(100); - const split_salt = salt.split('$'); - expect(split_salt[1]).toStrictEqual('2b') - expect(split_salt[2]).toStrictEqual('31') -}) - -test('hash_compare', () => { - const salt = bcrypt.genSaltSync(10); - expect(29).toStrictEqual(salt.length) - const hash = bcrypt.hashSync("test", salt); - expect(bcrypt.compareSync("test", hash)).toBeDefined() - expect(!(bcrypt.compareSync("blah", hash))).toBeDefined() -}) - -test('hash_compare_empty_strings', () => { - expect(!(bcrypt.compareSync("", "password"))).toBeDefined() - expect(!(bcrypt.compareSync("", ""))).toBeDefined() - expect(!(bcrypt.compareSync("password", ""))).toBeDefined() -}) - -test('hash_compare_invalid_strings', () => { - const fullString = 'envy1362987212538'; - const hash = '$2a$10$XOPbrlUPQdwdJUpSrIF6X.LbE14qsMmKGhM1A8W9iqaG3vv1BD7WC'; - const wut = ':'; - expect(bcrypt.compareSync(fullString, hash)).toBe(true); - expect(bcrypt.compareSync(fullString, wut)).toBe(false); -}) - -test('getRounds', () => { - const hash = bcrypt.hashSync("test", bcrypt.genSaltSync(9)); - expect(9).toStrictEqual(bcrypt.getRounds(hash)) -}) - -test('getRounds', () => { - const hash = bcrypt.hashSync("test", bcrypt.genSaltSync(9)); - expect(9).toStrictEqual(bcrypt.getRounds(hash)) - expect(() => bcrypt.getRounds('')).toThrow("invalid hash provided"); -}); diff --git a/server/node_modules/binary-extensions/binary-extensions.json b/server/node_modules/binary-extensions/binary-extensions.json deleted file mode 100644 index ac08048e..00000000 --- a/server/node_modules/binary-extensions/binary-extensions.json +++ /dev/null @@ -1,263 +0,0 @@ -[ - "3dm", - "3ds", - "3g2", - "3gp", - "7z", - "a", - "aac", - "adp", - "afdesign", - "afphoto", - "afpub", - "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 deleted file mode 100644 index 94a248c2..00000000 --- a/server/node_modules/binary-extensions/binary-extensions.json.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index f469ac5f..00000000 --- a/server/node_modules/binary-extensions/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** -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 deleted file mode 100644 index d46e4688..00000000 --- a/server/node_modules/binary-extensions/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./binary-extensions.json'); diff --git a/server/node_modules/binary-extensions/license b/server/node_modules/binary-extensions/license deleted file mode 100644 index 5493a1a6..00000000 --- a/server/node_modules/binary-extensions/license +++ /dev/null @@ -1,10 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (https://sindresorhus.com) -Copyright (c) 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 deleted file mode 100644 index 4710c339..00000000 --- a/server/node_modules/binary-extensions/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "binary-extensions", - "version": "2.3.0", - "description": "List of binary file extensions", - "license": "MIT", - "repository": "sindresorhus/binary-extensions", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "sideEffects": false, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts", - "binary-extensions.json", - "binary-extensions.json.d.ts" - ], - "keywords": [ - "binary", - "extensions", - "extension", - "file", - "json", - "list", - "array" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/server/node_modules/binary-extensions/readme.md b/server/node_modules/binary-extensions/readme.md deleted file mode 100644 index 88519b3a..00000000 --- a/server/node_modules/binary-extensions/readme.md +++ /dev/null @@ -1,25 +0,0 @@ -# binary-extensions - -> List of binary file extensions - -The list is just a [JSON file](binary-extensions.json) and can be used anywhere. - -## Install - -```sh -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/body-parser/LICENSE b/server/node_modules/body-parser/LICENSE deleted file mode 100644 index 386b7b69..00000000 --- a/server/node_modules/body-parser/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -(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 deleted file mode 100644 index 31b66ce0..00000000 --- a/server/node_modules/body-parser/README.md +++ /dev/null @@ -1,494 +0,0 @@ -# body-parser - -[![NPM Version][npm-version-image]][npm-url] -[![NPM Downloads][npm-downloads-image]][npm-url] -[![Build Status][ci-image]][ci-url] -[![Test Coverage][coveralls-image]][coveralls-url] -[![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer] - -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 -const 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. - -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`, -`br` (brotli) 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: - -##### defaultCharset - -Specify the default character set for the json 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'`. - -##### 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`, `br` (brotli) 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`, `br` (brotli) 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`, `br` (brotli) 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" 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 `false`. - -##### 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. - -##### defaultCharset - -The default charset to parse as, if not specified in content-type. Must be -either `utf-8` or `iso-8859-1`. Defaults to `utf-8`. - -##### charsetSentinel - -Whether to let the value of the `utf8` parameter take precedence as the charset -selector. It requires the form to contain a parameter named `utf8` with a value -of `✓`. Defaults to `false`. - -##### interpretNumericEntities - -Whether to decode numeric entities such as `☺` when parsing an iso-8859-1 -form. Defaults to `false`. - - -##### depth - -The `depth` option is used to configure the maximum depth of the `qs` library when `extended` is `true`. This allows you to limit the amount of keys that are parsed and can be useful to prevent certain types of abuse. Defaults to `32`. It is recommended to keep this value as low as possible. - -## 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'`. - -### stream is not readable - -This error will occur when the request is no longer readable when this middleware -attempts to read it. This typically means something other than a middleware from -this module read the request body already and the middleware was also configured to -read the same request. The `status` property is set to `500` and the `type` -property is set to `'stream.not.readable'`. - -### 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. - -### The input exceeded the depth - -This error occurs when using `bodyParser.urlencoded` with the `extended` property set to `true` and the input exceeds the configured `depth` option. The `status` property is set to `400`. It is recommended to review the `depth` option and evaluate if it requires a higher value. When the `depth` option is set to `32` (default value), the error will not be thrown. - -## 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 -const express = require('express') -const bodyParser = require('body-parser') - -const app = express() - -// parse application/x-www-form-urlencoded -app.use(bodyParser.urlencoded()) - -// 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(String(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 -const express = require('express') -const bodyParser = require('body-parser') - -const app = express() - -// create application/json parser -const jsonParser = bodyParser.json() - -// create application/x-www-form-urlencoded parser -const urlencodedParser = bodyParser.urlencoded() - -// POST /login gets urlencoded bodies -app.post('/login', urlencodedParser, function (req, res) { - if (!req.body || !req.body.username) res.sendStatus(400) - res.send('welcome, ' + req.body.username) -}) - -// POST /api/users gets JSON bodies -app.post('/api/users', jsonParser, function (req, res) { - if (!req.body) res.sendStatus(400) - // 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 -const express = require('express') -const bodyParser = require('body-parser') - -const 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) - -[ci-image]: https://img.shields.io/github/actions/workflow/status/expressjs/body-parser/ci.yml?branch=master&label=ci -[ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml -[coveralls-image]: https://img.shields.io/coverallsCoverage/github/expressjs/body-parser?branch=master -[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master -[npm-downloads-image]: https://img.shields.io/npm/dm/body-parser -[npm-url]: https://npmjs.org/package/body-parser -[npm-version-image]: https://img.shields.io/npm/v/body-parser -[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/body-parser/badge -[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/body-parser \ No newline at end of file diff --git a/server/node_modules/body-parser/index.js b/server/node_modules/body-parser/index.js deleted file mode 100644 index d722d0b2..00000000 --- a/server/node_modules/body-parser/index.js +++ /dev/null @@ -1,80 +0,0 @@ -/*! - * body-parser - * Copyright(c) 2014-2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * @typedef Parsers - * @type {function} - * @property {function} json - * @property {function} raw - * @property {function} text - * @property {function} urlencoded - */ - -/** - * Module exports. - * @type {Parsers} - */ - -exports = module.exports = bodyParser - -/** - * JSON parser. - * @public - */ - -Object.defineProperty(exports, 'json', { - configurable: true, - enumerable: true, - get: () => require('./lib/types/json') -}) - -/** - * Raw parser. - * @public - */ - -Object.defineProperty(exports, 'raw', { - configurable: true, - enumerable: true, - get: () => require('./lib/types/raw') -}) - -/** - * Text parser. - * @public - */ - -Object.defineProperty(exports, 'text', { - configurable: true, - enumerable: true, - get: () => require('./lib/types/text') -}) - -/** - * URL-encoded parser. - * @public - */ - -Object.defineProperty(exports, 'urlencoded', { - configurable: true, - enumerable: true, - get: () => require('./lib/types/urlencoded') -}) - -/** - * Create a middleware to parse json and urlencoded bodies. - * - * @param {object} [options] - * @return {function} - * @deprecated - * @public - */ - -function bodyParser () { - throw new Error('The bodyParser() generic has been split into individual middleware to use instead.') -} diff --git a/server/node_modules/body-parser/package.json b/server/node_modules/body-parser/package.json deleted file mode 100644 index 596133cd..00000000 --- a/server/node_modules/body-parser/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "body-parser", - "description": "Node.js body parsing middleware", - "version": "2.2.1", - "contributors": [ - "Douglas Christopher Wilson ", - "Jonathan Ong (http://jongleberry.com)" - ], - "license": "MIT", - "repository": "expressjs/body-parser", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - }, - "dependencies": { - "bytes": "^3.1.2", - "content-type": "^1.0.5", - "debug": "^4.4.3", - "http-errors": "^2.0.0", - "iconv-lite": "^0.7.0", - "on-finished": "^2.4.1", - "qs": "^6.14.0", - "raw-body": "^3.0.1", - "type-is": "^2.0.1" - }, - "devDependencies": { - "eslint": "^8.57.1", - "eslint-config-standard": "^14.1.1", - "eslint-plugin-import": "^2.31.0", - "eslint-plugin-markdown": "^3.0.1", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^6.6.0", - "eslint-plugin-standard": "^4.1.0", - "mocha": "^11.1.0", - "nyc": "^17.1.0", - "supertest": "^7.0.0" - }, - "files": [ - "lib/", - "LICENSE", - "index.js" - ], - "engines": { - "node": ">=18" - }, - "scripts": { - "lint": "eslint .", - "test": "mocha --reporter spec --check-leaks test/", - "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", - "test-cov": "nyc --reporter=html --reporter=text npm test" - } -} diff --git a/server/node_modules/brace-expansion/LICENSE b/server/node_modules/brace-expansion/LICENSE deleted file mode 100644 index de322667..00000000 --- a/server/node_modules/brace-expansion/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index 6b4e0e16..00000000 --- a/server/node_modules/brace-expansion/README.md +++ /dev/null @@ -1,129 +0,0 @@ -# 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 deleted file mode 100644 index bd19fe68..00000000 --- a/server/node_modules/brace-expansion/index.js +++ /dev/null @@ -1,201 +0,0 @@ -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 deleted file mode 100644 index 34478881..00000000 --- a/server/node_modules/brace-expansion/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "brace-expansion", - "description": "Brace expansion as known from sh/bash", - "version": "1.1.12", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/brace-expansion.git" - }, - "homepage": "https://github.com/juliangruber/brace-expansion", - "main": "index.js", - "scripts": { - "test": "tape test/*.js", - "gentest": "bash test/generate.sh", - "bench": "matcha test/perf/bench.js" - }, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - }, - "devDependencies": { - "matcha": "^0.7.0", - "tape": "^4.6.0" - }, - "keywords": [], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT", - "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" - ] - }, - "publishConfig": { - "tag": "1.x" - } -} diff --git a/server/node_modules/braces/LICENSE b/server/node_modules/braces/LICENSE deleted file mode 100644 index 9af4a67d..00000000 --- a/server/node_modules/braces/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-present, 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 deleted file mode 100644 index f59dd604..00000000 --- a/server/node_modules/braces/README.md +++ /dev/null @@ -1,586 +0,0 @@ -# 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**: `10,000` - -**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.keepEscaping - -**Type**: `Boolean` - -**Default**: `undefined` - -**Description**: Do not 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 -● expand - range (expanded) - braces x 53,167 ops/sec ±0.12% (102 runs sampled) - minimatch x 11,378 ops/sec ±0.10% (102 runs sampled) -● expand - range (optimized for regex) - braces x 373,442 ops/sec ±0.04% (100 runs sampled) - minimatch x 3,262 ops/sec ±0.18% (100 runs sampled) -● expand - nested ranges (expanded) - braces x 33,921 ops/sec ±0.09% (99 runs sampled) - minimatch x 10,855 ops/sec ±0.28% (100 runs sampled) -● expand - nested ranges (optimized for regex) - braces x 287,479 ops/sec ±0.52% (98 runs sampled) - minimatch x 3,219 ops/sec ±0.28% (101 runs sampled) -● expand - set (expanded) - braces x 238,243 ops/sec ±0.19% (97 runs sampled) - minimatch x 538,268 ops/sec ±0.31% (96 runs sampled) -● expand - set (optimized for regex) - braces x 321,844 ops/sec ±0.10% (97 runs sampled) - minimatch x 140,600 ops/sec ±0.15% (100 runs sampled) -● expand - nested sets (expanded) - braces x 165,371 ops/sec ±0.42% (96 runs sampled) - minimatch x 337,720 ops/sec ±0.28% (100 runs sampled) -● expand - nested sets (optimized for regex) - braces x 242,948 ops/sec ±0.12% (99 runs sampled) - minimatch x 87,403 ops/sec ±0.79% (96 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._ diff --git a/server/node_modules/braces/index.js b/server/node_modules/braces/index.js deleted file mode 100644 index d222c13b..00000000 --- a/server/node_modules/braces/index.js +++ /dev/null @@ -1,170 +0,0 @@ -'use strict'; - -const stringify = require('./lib/stringify'); -const compile = require('./lib/compile'); -const expand = require('./lib/expand'); -const parse = require('./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 (const pattern of input) { - const 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/package.json b/server/node_modules/braces/package.json deleted file mode 100644 index c3c056e4..00000000 --- a/server/node_modules/braces/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "braces", - "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.", - "version": "3.0.3", - "homepage": "https://github.com/micromatch/braces", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Brian Woodward (https://twitter.com/doowb)", - "Elan Shanker (https://github.com/es128)", - "Eugene Sharygin (https://github.com/eush77)", - "hemanth.hm (http://h3manth.com)", - "Jon Schlinkert (http://twitter.com/jonschlinkert)" - ], - "repository": "micromatch/braces", - "bugs": { - "url": "https://github.com/micromatch/braces/issues" - }, - "license": "MIT", - "files": [ - "index.js", - "lib" - ], - "main": "index.js", - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "mocha", - "benchmark": "node benchmark" - }, - "dependencies": { - "fill-range": "^7.1.1" - }, - "devDependencies": { - "ansi-colors": "^3.2.4", - "bash-path": "^2.0.1", - "gulp-format-md": "^2.0.0", - "mocha": "^6.1.1" - }, - "keywords": [ - "alpha", - "alphabetical", - "bash", - "brace", - "braces", - "expand", - "expansion", - "filepath", - "fill", - "fs", - "glob", - "globbing", - "letter", - "match", - "matches", - "matching", - "number", - "numerical", - "path", - "range", - "ranges", - "sh" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "lint": { - "reflinks": true - }, - "plugins": [ - "gulp-format-md" - ] - } -} diff --git a/server/node_modules/bson/LICENSE.md b/server/node_modules/bson/LICENSE.md deleted file mode 100644 index 261eeb9e..00000000 --- a/server/node_modules/bson/LICENSE.md +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/server/node_modules/bson/README.md b/server/node_modules/bson/README.md deleted file mode 100644 index c658e092..00000000 --- a/server/node_modules/bson/README.md +++ /dev/null @@ -1,280 +0,0 @@ -# BSON parser - -BSON is short for "Binary JSON," and is the binary-encoded serialization of JSON-like documents. -You can learn more about it in [the specification](http://bsonspec.org). - -### Table of Contents - -- [Usage](#usage) -- [Bugs/Feature Requests](#bugs--feature-requests) -- [Installation](#installation) -- [Documentation](#documentation) -- [FAQ](#faq) - - -### Release Integrity - -Releases are created automatically and signed using the [Node team's GPG key](https://pgp.mongodb.com/node-driver.asc). This applies to the git tag as well as all release packages provided as part of a GitHub release. To verify the provided packages, download the key and import it using gpg: - -```shell -gpg --import node-driver.asc -``` - -The GitHub release contains a detached signature file for the NPM package (named -`bson-X.Y.Z.tgz.sig`). - -The following command returns the link npm package. -```shell -npm view bson@vX.Y.Z dist.tarball -``` - -Using the result of the above command, a `curl` command can return the official npm package for the release. - -To verify the integrity of the downloaded package, run the following command: -```shell -gpg --verify bson-X.Y.Z.tgz.sig bson-X.Y.Z.tgz -``` - ->[!Note] -No verification is done when using npm to install the package. The contents of the Github tarball and npm's tarball are identical. - -## Bugs / Feature Requests - -Think you've found a bug? Want to see a new feature in `bson`? Please open a case in our issue management tool, JIRA: - -1. Create an account and login: [jira.mongodb.org](https://jira.mongodb.org) -2. Navigate to the NODE project: [jira.mongodb.org/browse/NODE](https://jira.mongodb.org/browse/NODE) -3. Click **Create Issue** - Please provide as much information as possible about the issue and how to reproduce it. - -Bug reports in JIRA for the NODE driver project are **public**. - -## Usage - -To build a new version perform the following operations: - -``` -npm install -npm run build -``` - -### Node.js or Bundling Usage - -When using a bundler or Node.js you can import bson using the package name: - -```js -import { BSON, EJSON, ObjectId } from 'bson'; -// or: -// const { BSON, EJSON, ObjectId } = require('bson'); - -const bytes = BSON.serialize({ _id: new ObjectId() }); -console.log(bytes); -const doc = BSON.deserialize(bytes); -console.log(EJSON.stringify(doc)); -// {"_id":{"$oid":"..."}} -``` - -### Browser Usage - -If you are working directly in the browser without a bundler please use the `.mjs` bundle like so: - -```html - -``` - -## Installation - -```sh -npm install bson -``` - -### MongoDB Node.js Driver Version Compatibility - -Only the following version combinations with the [MongoDB Node.js Driver](https://github.com/mongodb/node-mongodb-native) are considered stable. - -| | `bson@1.x` | `bson@4.x` | `bson@5.x` | `bson@6.x` | -| ------------- | ---------- | ---------- | ---------- | ---------- | -| `mongodb@6.x` | N/A | N/A | N/A | ✓ | -| `mongodb@5.x` | N/A | N/A | ✓ | N/A | -| `mongodb@4.x` | N/A | ✓ | N/A | N/A | -| `mongodb@3.x` | ✓ | N/A | N/A | N/A | - -## Documentation - -### BSON - -[API documentation](https://mongodb.github.io/node-mongodb-native/Next/modules/BSON.html) - -
- -### EJSON - -- [EJSON](#EJSON) - - - [.parse(text, [options])](#EJSON.parse) - - - [.stringify(value, [replacer], [space], [options])](#EJSON.stringify) - - - [.serialize(bson, [options])](#EJSON.serialize) - - - [.deserialize(ejson, [options])](#EJSON.deserialize) - - - -#### _EJSON_.parse(text, [options]) - -| Param | Type | Default | Description | -| ----------------- | -------------------- | ----------------- | ---------------------------------------------------------------------------------- | -| text | string | | | -| [options] | object | | Optional settings | -| [options.relaxed] | boolean | true | Attempt to return native JS types where possible, rather than BSON types (if true) | - -Parse an Extended JSON string, constructing the JavaScript value or object described by that -string. - -**Example** - -```js -const { EJSON } = require('bson'); -const text = '{ "int32": { "$numberInt": "10" } }'; - -// prints { int32: { [String: '10'] _bsontype: 'Int32', value: '10' } } -console.log(EJSON.parse(text, { relaxed: false })); - -// prints { int32: 10 } -console.log(EJSON.parse(text)); -``` - - - -#### _EJSON_.stringify(value, [replacer], [space], [options]) - -| Param | Type | Default | Description | -| ----------------- | ------------------------------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| value | object | | The value to convert to extended JSON | -| [replacer] | function \| array | | A function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string | -| [space] | string \| number | | A String or Number object that's used to insert white space into the output JSON string for readability purposes. | -| [options] | object | | Optional settings | -| [options.relaxed] | boolean | true | Enabled Extended JSON's `relaxed` mode | -| [options.legacy] | boolean | true | Output in Extended JSON v1 | - -Converts a BSON document to an Extended JSON string, optionally replacing values if a replacer -function is specified or optionally including only the specified properties if a replacer array -is specified. - -**Example** - -```js -const { EJSON } = require('bson'); -const Int32 = require('mongodb').Int32; -const doc = { int32: new Int32(10) }; - -// prints '{"int32":{"$numberInt":"10"}}' -console.log(EJSON.stringify(doc, { relaxed: false })); - -// prints '{"int32":10}' -console.log(EJSON.stringify(doc)); -``` - - - -#### _EJSON_.serialize(bson, [options]) - -| Param | Type | Description | -| --------- | ------------------- | ---------------------------------------------------- | -| bson | object | The object to serialize | -| [options] | object | Optional settings passed to the `stringify` function | - -Serializes an object to an Extended JSON string, and reparse it as a JavaScript object. - - - -#### _EJSON_.deserialize(ejson, [options]) - -| Param | Type | Description | -| --------- | ------------------- | -------------------------------------------- | -| ejson | object | The Extended JSON object to deserialize | -| [options] | object | Optional settings passed to the parse method | - -Deserializes an Extended JSON object into a plain JavaScript object with native/BSON types - -## Error Handling - -It is our recommendation to use `BSONError.isBSONError()` checks on errors and to avoid relying on parsing `error.message` and `error.name` strings in your code. We guarantee `BSONError.isBSONError()` checks will pass according to semver guidelines, but errors may be sub-classed or their messages may change at any time, even patch releases, as we see fit to increase the helpfulness of the errors. - -Any new errors we add to the driver will directly extend an existing error class and no existing error will be moved to a different parent class outside of a major release. -This means `BSONError.isBSONError()` will always be able to accurately capture the errors that our BSON library throws. - -Hypothetical example: A collection in our Db has an issue with UTF-8 data: - -```ts -let documentCount = 0; -const cursor = collection.find({}, { utf8Validation: true }); -try { - for await (const doc of cursor) documentCount += 1; -} catch (error) { - if (BSONError.isBSONError(error)) { - console.log(`Found the troublemaker UTF-8!: ${documentCount} ${error.message}`); - return documentCount; - } - throw error; -} -``` - -## React Native - -BSON vendors the required polyfills for `TextEncoder`, `TextDecoder`, `atob`, `btoa` imported from React Native and therefore doesn't expect users to polyfill these. One additional polyfill, `crypto.getRandomValues` is recommended and can be installed with the following command: - -```sh -npm install --save react-native-get-random-values -``` - -The following snippet should be placed at the top of the entrypoint (by default this is the root `index.js` file) for React Native projects using the BSON library. These lines must be placed for any code that imports `BSON`. - -```typescript -// Required Polyfills For ReactNative -import 'react-native-get-random-values'; -``` - -Finally, import the `BSON` library like so: - -```typescript -import { BSON, EJSON } from 'bson'; -``` - -This will cause React Native to import the `node_modules/bson/lib/bson.rn.cjs` bundle (see the `"react-native"` setting we have in the `"exports"` section of our [package.json](./package.json).) - -### Technical Note about React Native module import - -The `"exports"` definition in our `package.json` will result in BSON's CommonJS bundle being imported in a React Native project instead of the ES module bundle. Importing the CommonJS bundle is necessary because BSON's ES module bundle of BSON uses top-level await, which is not supported syntax in [React Native's runtime hermes](https://hermesengine.dev/). - -## FAQ - -#### Why does `undefined` get converted to `null`? - -The `undefined` BSON type has been [deprecated for many years](http://bsonspec.org/spec.html), so this library has dropped support for it. Use the `ignoreUndefined` option (for example, from the [driver](http://mongodb.github.io/node-mongodb-native/2.2/api/MongoClient.html#connect) ) to instead remove `undefined` keys. - -#### How do I add custom serialization logic? - -This library looks for `toBSON()` functions on every path, and calls the `toBSON()` function to get the value to serialize. - -```javascript -const BSON = require('bson'); - -class CustomSerialize { - toBSON() { - return 42; - } -} - -const obj = { answer: new CustomSerialize() }; -// "{ answer: 42 }" -console.log(BSON.deserialize(BSON.serialize(obj))); -``` diff --git a/server/node_modules/bson/bson.d.ts b/server/node_modules/bson/bson.d.ts deleted file mode 100644 index 365e3a45..00000000 --- a/server/node_modules/bson/bson.d.ts +++ /dev/null @@ -1,1723 +0,0 @@ -/** - * A class representation of the BSON Binary type. - * @public - * @category BSONType - */ -export declare class Binary extends BSONValue { - get _bsontype(): 'Binary'; - /* Excluded from this release type: BSON_BINARY_SUBTYPE_DEFAULT */ - /** Initial buffer default size */ - static readonly BUFFER_SIZE = 256; - /** Default BSON type */ - static readonly SUBTYPE_DEFAULT = 0; - /** Function BSON type */ - static readonly SUBTYPE_FUNCTION = 1; - /** Byte Array BSON type */ - static readonly SUBTYPE_BYTE_ARRAY = 2; - /** Deprecated UUID BSON type @deprecated Please use SUBTYPE_UUID */ - static readonly SUBTYPE_UUID_OLD = 3; - /** UUID BSON type */ - static readonly SUBTYPE_UUID = 4; - /** MD5 BSON type */ - static readonly SUBTYPE_MD5 = 5; - /** Encrypted BSON type */ - static readonly SUBTYPE_ENCRYPTED = 6; - /** Column BSON type */ - static readonly SUBTYPE_COLUMN = 7; - /** Sensitive BSON type */ - static readonly SUBTYPE_SENSITIVE = 8; - /** Vector BSON type */ - static readonly SUBTYPE_VECTOR = 9; - /** User BSON type */ - static readonly SUBTYPE_USER_DEFINED = 128; - /** datatype of a Binary Vector (subtype: 9) */ - static readonly VECTOR_TYPE: Readonly<{ - readonly Int8: 3; - readonly Float32: 39; - readonly PackedBit: 16; - }>; - /** - * The bytes of the Binary value. - * - * The format of a Binary value in BSON is defined as: - * ```txt - * binary ::= int32 subtype (byte*) - * ``` - * - * This `buffer` is the "(byte*)" segment. - * - * Unless the value is subtype 2, then deserialize will read the first 4 bytes as an int32 and set this to the remaining bytes. - * - * ```txt - * binary ::= int32 unsigned_byte(2) int32 (byte*) - * ``` - * - * @see https://bsonspec.org/spec.html - */ - buffer: Uint8Array; - /** - * The binary subtype. - * - * Current defined values are: - * - * - `unsigned_byte(0)` Generic binary subtype - * - `unsigned_byte(1)` Function - * - `unsigned_byte(2)` Binary (Deprecated) - * - `unsigned_byte(3)` UUID (Deprecated) - * - `unsigned_byte(4)` UUID - * - `unsigned_byte(5)` MD5 - * - `unsigned_byte(6)` Encrypted BSON value - * - `unsigned_byte(7)` Compressed BSON column - * - `unsigned_byte(8)` Sensitive - * - `unsigned_byte(9)` Vector - * - `unsigned_byte(128)` - `unsigned_byte(255)` User defined - */ - sub_type: number; - /** - * The Binary's `buffer` can be larger than the Binary's content. - * This property is used to determine where the content ends in the buffer. - */ - position: number; - /** - * Create a new Binary instance. - * @param buffer - a buffer object containing the binary data. - * @param subType - the option binary type. - */ - constructor(buffer?: BinarySequence, subType?: number); - /** - * Updates this binary with byte_value. - * - * @param byteValue - a single byte we wish to write. - */ - put(byteValue: string | number | Uint8Array | number[]): void; - /** - * Writes a buffer to the binary. - * - * @param sequence - a string or buffer to be written to the Binary BSON object. - * @param offset - specify the binary of where to write the content. - */ - write(sequence: BinarySequence, offset: number): void; - /** - * Returns a view of **length** bytes starting at **position**. - * - * @param position - read from the given position in the Binary. - * @param length - the number of bytes to read. - */ - read(position: number, length: number): Uint8Array; - /** returns a view of the binary value as a Uint8Array */ - value(): Uint8Array; - /** the length of the binary sequence */ - length(): number; - toJSON(): string; - toString(encoding?: 'hex' | 'base64' | 'utf8' | 'utf-8'): string; - /* Excluded from this release type: toExtendedJSON */ - toUUID(): UUID; - /** Creates an Binary instance from a hex digit string */ - static createFromHexString(hex: string, subType?: number): Binary; - /** Creates an Binary instance from a base64 string */ - static createFromBase64(base64: string, subType?: number): Binary; - /* Excluded from this release type: fromExtendedJSON */ - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string; - /** - * If this Binary represents a Int8 Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.Int8`), - * returns a copy of the bytes in a new Int8Array. - * - * If the Binary is not a Vector, or the datatype is not Int8, an error is thrown. - */ - toInt8Array(): Int8Array; - /** - * If this Binary represents a Float32 Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.Float32`), - * returns a copy of the bytes in a new Float32Array. - * - * If the Binary is not a Vector, or the datatype is not Float32, an error is thrown. - */ - toFloat32Array(): Float32Array; - /** - * If this Binary represents packed bit Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.PackedBit`), - * returns a copy of the bytes that are packed bits. - * - * Use `toBits` to get the unpacked bits. - * - * If the Binary is not a Vector, or the datatype is not PackedBit, an error is thrown. - */ - toPackedBits(): Uint8Array; - /** - * If this Binary represents a Packed bit Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.PackedBit`), - * returns a copy of the bit unpacked into a new Int8Array. - * - * Use `toPackedBits` to get the bits still in packed form. - * - * If the Binary is not a Vector, or the datatype is not PackedBit, an error is thrown. - */ - toBits(): Int8Array; - /** - * Constructs a Binary representing an Int8 Vector. - * @param array - The array to store as a view on the Binary class - */ - static fromInt8Array(array: Int8Array): Binary; - /** Constructs a Binary representing an Float32 Vector. */ - static fromFloat32Array(array: Float32Array): Binary; - /** - * Constructs a Binary representing a packed bit Vector. - * - * Use `fromBits` to pack an array of 1s and 0s. - */ - static fromPackedBits(array: Uint8Array, padding?: number): Binary; - /** - * Constructs a Binary representing an Packed Bit Vector. - * @param array - The array of 1s and 0s to pack into the Binary instance - */ - static fromBits(bits: ArrayLike): Binary; -} - -/** @public */ -export declare interface BinaryExtended { - $binary: { - subType: string; - base64: string; - }; -} - -/** @public */ -export declare interface BinaryExtendedLegacy { - $type: string; - $binary: string; -} - -/** @public */ -export declare type BinarySequence = Uint8Array | number[]; - -declare namespace BSON { - export { - setInternalBufferSize, - serialize, - serializeWithBufferAndIndex, - deserialize, - calculateObjectSize, - deserializeStream, - UUIDExtended, - BinaryExtended, - BinaryExtendedLegacy, - BinarySequence, - CodeExtended, - DBRefLike, - Decimal128Extended, - DoubleExtended, - EJSONOptions, - Int32Extended, - LongExtended, - MaxKeyExtended, - MinKeyExtended, - ObjectIdExtended, - ObjectIdLike, - BSONRegExpExtended, - BSONRegExpExtendedLegacy, - BSONSymbolExtended, - LongWithoutOverrides, - TimestampExtended, - TimestampOverrides, - LongWithoutOverridesClass, - SerializeOptions, - DeserializeOptions, - Code, - BSONSymbol, - DBRef, - Binary, - ObjectId, - UUID, - Long, - Timestamp, - Double, - Int32, - MinKey, - MaxKey, - BSONRegExp, - Decimal128, - BSONValue, - BSONError, - BSONVersionError, - BSONRuntimeError, - BSONOffsetError, - BSONType, - EJSON, - onDemand, - OnDemand, - Document, - CalculateObjectSizeOptions - } -} -export { BSON } - -/* Excluded from this release type: BSON_MAJOR_VERSION */ - -/* Excluded from this release type: BSON_VERSION_SYMBOL */ - -/** - * @public - * @experimental - */ -declare type BSONElement = [ -type: number, -nameOffset: number, -nameLength: number, -offset: number, -length: number -]; - -/** - * @public - * @category Error - * - * `BSONError` objects are thrown when BSON encounters an error. - * - * This is the parent class for all the other errors thrown by this library. - */ -export declare class BSONError extends Error { - /* Excluded from this release type: bsonError */ - get name(): string; - constructor(message: string, options?: { - cause?: unknown; - }); - /** - * @public - * - * All errors thrown from the BSON library inherit from `BSONError`. - * This method can assist with determining if an error originates from the BSON library - * even if it does not pass an `instanceof` check against this class' constructor. - * - * @param value - any javascript value that needs type checking - */ - static isBSONError(value: unknown): value is BSONError; -} - -/** - * @public - * @category Error - * - * @experimental - * - * An error generated when BSON bytes are invalid. - * Reports the offset the parser was able to reach before encountering the error. - */ -export declare class BSONOffsetError extends BSONError { - get name(): 'BSONOffsetError'; - offset: number; - constructor(message: string, offset: number, options?: { - cause?: unknown; - }); -} - -/** - * A class representation of the BSON RegExp type. - * @public - * @category BSONType - */ -export declare class BSONRegExp extends BSONValue { - get _bsontype(): 'BSONRegExp'; - pattern: string; - options: string; - /** - * @param pattern - The regular expression pattern to match - * @param options - The regular expression options - */ - constructor(pattern: string, options?: string); - static parseOptions(options?: string): string; - /* Excluded from this release type: toExtendedJSON */ - /* Excluded from this release type: fromExtendedJSON */ - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string; -} - -/** @public */ -export declare interface BSONRegExpExtended { - $regularExpression: { - pattern: string; - options: string; - }; -} - -/** @public */ -export declare interface BSONRegExpExtendedLegacy { - $regex: string | BSONRegExp; - $options: string; -} - -/** - * @public - * @category Error - * - * An error generated when BSON functions encounter an unexpected input - * or reaches an unexpected/invalid internal state - * - */ -export declare class BSONRuntimeError extends BSONError { - get name(): 'BSONRuntimeError'; - constructor(message: string); -} - -/** - * A class representation of the BSON Symbol type. - * @public - * @category BSONType - */ -export declare class BSONSymbol extends BSONValue { - get _bsontype(): 'BSONSymbol'; - value: string; - /** - * @param value - the string representing the symbol. - */ - constructor(value: string); - /** Access the wrapped string value. */ - valueOf(): string; - toString(): string; - toJSON(): string; - /* Excluded from this release type: toExtendedJSON */ - /* Excluded from this release type: fromExtendedJSON */ - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string; -} - -/** @public */ -export declare interface BSONSymbolExtended { - $symbol: string; -} - -/** @public */ -export declare const BSONType: Readonly<{ - readonly double: 1; - readonly string: 2; - readonly object: 3; - readonly array: 4; - readonly binData: 5; - readonly undefined: 6; - readonly objectId: 7; - readonly bool: 8; - readonly date: 9; - readonly null: 10; - readonly regex: 11; - readonly dbPointer: 12; - readonly javascript: 13; - readonly symbol: 14; - readonly javascriptWithScope: 15; - readonly int: 16; - readonly timestamp: 17; - readonly long: 18; - readonly decimal: 19; - readonly minKey: -1; - readonly maxKey: 127; -}>; - -/** @public */ -export declare type BSONType = (typeof BSONType)[keyof typeof BSONType]; - -/** @public */ -export declare abstract class BSONValue { - /** @public */ - abstract get _bsontype(): string; - /* Excluded from this release type: [BSON_VERSION_SYMBOL] */ - /** - * @public - * Prints a human-readable string of BSON value information - * If invoked manually without node.js.inspect function, this will default to a modified JSON.stringify - */ - abstract inspect(depth?: number, options?: unknown, inspect?: InspectFn): string; - /* Excluded from this release type: toExtendedJSON */ -} - -/** - * @public - * @category Error - */ -export declare class BSONVersionError extends BSONError { - get name(): 'BSONVersionError'; - constructor(); -} - -/** - * @public - * @experimental - * - * A collection of functions that help work with data in a Uint8Array. - * ByteUtils is configured at load time to use Node.js or Web based APIs for the internal implementations. - */ -declare type ByteUtils = { - /** Transforms the input to an instance of Buffer if running on node, otherwise Uint8Array */ - toLocalBufferType: (buffer: Uint8Array | ArrayBufferView | ArrayBuffer) => Uint8Array; - /** Create empty space of size */ - allocate: (size: number) => Uint8Array; - /** Create empty space of size, use pooled memory when available */ - allocateUnsafe: (size: number) => Uint8Array; - /** Check if two Uint8Arrays are deep equal */ - equals: (a: Uint8Array, b: Uint8Array) => boolean; - /** Check if two Uint8Arrays are deep equal */ - fromNumberArray: (array: number[]) => Uint8Array; - /** Create a Uint8Array from a base64 string */ - fromBase64: (base64: string) => Uint8Array; - /** Create a base64 string from bytes */ - toBase64: (buffer: Uint8Array) => string; - /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */ - fromISO88591: (codePoints: string) => Uint8Array; - /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */ - toISO88591: (buffer: Uint8Array) => string; - /** Create a Uint8Array from a hex string */ - fromHex: (hex: string) => Uint8Array; - /** Create a lowercase hex string from bytes */ - toHex: (buffer: Uint8Array) => string; - /** Create a string from utf8 code units, fatal=true will throw an error if UTF-8 bytes are invalid, fatal=false will insert replacement characters */ - toUTF8: (buffer: Uint8Array, start: number, end: number, fatal: boolean) => string; - /** Get the utf8 code unit count from a string if it were to be transformed to utf8 */ - utf8ByteLength: (input: string) => number; - /** Encode UTF8 bytes generated from `source` string into `destination` at byteOffset. Returns the number of bytes encoded. */ - encodeUTF8Into: (destination: Uint8Array, source: string, byteOffset: number) => number; - /** Generate a Uint8Array filled with random bytes with byteLength */ - randomBytes: (byteLength: number) => Uint8Array; - /** Interprets `buffer` as an array of 32-bit values and swaps the byte order in-place. */ - swap32: (buffer: Uint8Array) => Uint8Array; -}; - -/* Excluded declaration from this release type: ByteUtils */ - -/** - * Calculate the bson size for a passed in Javascript object. - * - * @param object - the Javascript object to calculate the BSON byte size for - * @returns size of BSON object in bytes - * @public - */ -export declare function calculateObjectSize(object: Document, options?: CalculateObjectSizeOptions): number; - -/** @public */ -export declare type CalculateObjectSizeOptions = Pick; - -/** - * A class representation of the BSON Code type. - * @public - * @category BSONType - */ -export declare class Code extends BSONValue { - get _bsontype(): 'Code'; - code: string; - scope: Document | null; - /** - * @param code - a string or function. - * @param scope - an optional scope for the function. - */ - constructor(code: string | Function, scope?: Document | null); - toJSON(): { - code: string; - scope?: Document; - }; - /* Excluded from this release type: toExtendedJSON */ - /* Excluded from this release type: fromExtendedJSON */ - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string; -} - -/** @public */ -export declare interface CodeExtended { - $code: string; - $scope?: Document; -} - -/** - * A class representation of the BSON DBRef type. - * @public - * @category BSONType - */ -export declare class DBRef extends BSONValue { - get _bsontype(): 'DBRef'; - collection: string; - oid: ObjectId; - db?: string; - fields: Document; - /** - * @param collection - the collection name. - * @param oid - the reference ObjectId. - * @param db - optional db name, if omitted the reference is local to the current db. - */ - constructor(collection: string, oid: ObjectId, db?: string, fields?: Document); - /* Excluded from this release type: namespace */ - /* Excluded from this release type: namespace */ - toJSON(): DBRefLike & Document; - /* Excluded from this release type: toExtendedJSON */ - /* Excluded from this release type: fromExtendedJSON */ - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string; -} - -/** @public */ -export declare interface DBRefLike { - $ref: string; - $id: ObjectId; - $db?: string; -} - -/** - * A class representation of the BSON Decimal128 type. - * @public - * @category BSONType - */ -export declare class Decimal128 extends BSONValue { - get _bsontype(): 'Decimal128'; - readonly bytes: Uint8Array; - /** - * @param bytes - a buffer containing the raw Decimal128 bytes in little endian order, - * or a string representation as returned by .toString() - */ - constructor(bytes: Uint8Array | string); - /** - * Create a Decimal128 instance from a string representation - * - * @param representation - a numeric string representation. - */ - static fromString(representation: string): Decimal128; - /** - * Create a Decimal128 instance from a string representation, allowing for rounding to 34 - * significant digits - * - * @example Example of a number that will be rounded - * ```ts - * > let d = Decimal128.fromString('37.499999999999999196428571428571375') - * Uncaught: - * BSONError: "37.499999999999999196428571428571375" is not a valid Decimal128 string - inexact rounding - * at invalidErr (/home/wajames/js-bson/lib/bson.cjs:1402:11) - * at Decimal128.fromStringInternal (/home/wajames/js-bson/lib/bson.cjs:1633:25) - * at Decimal128.fromString (/home/wajames/js-bson/lib/bson.cjs:1424:27) - * - * > d = Decimal128.fromStringWithRounding('37.499999999999999196428571428571375') - * new Decimal128("37.49999999999999919642857142857138") - * ``` - * @param representation - a numeric string representation. - */ - static fromStringWithRounding(representation: string): Decimal128; - private static _fromString; - /** Create a string representation of the raw Decimal128 value */ - toString(): string; - toJSON(): Decimal128Extended; - /* Excluded from this release type: toExtendedJSON */ - /* Excluded from this release type: fromExtendedJSON */ - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string; -} - -/** @public */ -export declare interface Decimal128Extended { - $numberDecimal: string; -} - -/** - * Deserialize data as BSON. - * - * @param buffer - the buffer containing the serialized set of BSON documents. - * @returns returns the deserialized Javascript Object. - * @public - */ -export declare function deserialize(buffer: Uint8Array, options?: DeserializeOptions): Document; - -/** @public */ -export declare interface DeserializeOptions { - /** - * when deserializing a Long return as a BigInt. - * @defaultValue `false` - */ - useBigInt64?: boolean; - /** - * when deserializing a Long will fit it into a Number if it's smaller than 53 bits. - * @defaultValue `true` - */ - promoteLongs?: boolean; - /** - * when deserializing a Binary will return it as a node.js Buffer instance. - * @defaultValue `false` - */ - promoteBuffers?: boolean; - /** - * when deserializing will promote BSON values to their Node.js closest equivalent types. - * @defaultValue `true` - */ - promoteValues?: boolean; - /** - * allow to specify if there what fields we wish to return as unserialized raw buffer. - * @defaultValue `null` - */ - fieldsAsRaw?: Document; - /** - * return BSON regular expressions as BSONRegExp instances. - * @defaultValue `false` - */ - bsonRegExp?: boolean; - /** - * allows the buffer to be larger than the parsed BSON object. - * @defaultValue `false` - */ - allowObjectSmallerThanBufferSize?: boolean; - /** - * Offset into buffer to begin reading document from - * @defaultValue `0` - */ - index?: number; - raw?: boolean; - /** Allows for opt-out utf-8 validation for all keys or - * specified keys. Must be all true or all false. - * - * @example - * ```js - * // disables validation on all keys - * validation: { utf8: false } - * - * // enables validation only on specified keys a, b, and c - * validation: { utf8: { a: true, b: true, c: true } } - * - * // disables validation only on specified keys a, b - * validation: { utf8: { a: false, b: false } } - * ``` - */ - validation?: { - utf8: boolean | Record | Record; - }; -} - -/** - * Deserialize stream data as BSON documents. - * - * @param data - the buffer containing the serialized set of BSON documents. - * @param startIndex - the start index in the data Buffer where the deserialization is to start. - * @param numberOfDocuments - number of documents to deserialize. - * @param documents - an array where to store the deserialized documents. - * @param docStartIndex - the index in the documents array from where to start inserting documents. - * @param options - additional options used for the deserialization. - * @returns next index in the buffer after deserialization **x** numbers of documents. - * @public - */ -export declare function deserializeStream(data: Uint8Array | ArrayBuffer, startIndex: number, numberOfDocuments: number, documents: Document[], docStartIndex: number, options: DeserializeOptions): number; - -/** @public */ -export declare interface Document { - [key: string]: any; -} - -/** - * A class representation of the BSON Double type. - * @public - * @category BSONType - */ -export declare class Double extends BSONValue { - get _bsontype(): 'Double'; - value: number; - /** - * Create a Double type - * - * @param value - the number we want to represent as a double. - */ - constructor(value: number); - /** - * Attempt to create an double type from string. - * - * This method will throw a BSONError on any string input that is not representable as a IEEE-754 64-bit double. - * Notably, this method will also throw on the following string formats: - * - Strings in non-decimal and non-exponential formats (binary, hex, or octal digits) - * - Strings with characters other than numeric, floating point, or leading sign characters (Note: 'Infinity', '-Infinity', and 'NaN' input strings are still allowed) - * - Strings with leading and/or trailing whitespace - * - * Strings with leading zeros, however, are also allowed - * - * @param value - the string we want to represent as a double. - */ - static fromString(value: string): Double; - /** - * Access the number value. - * - * @returns returns the wrapped double number. - */ - valueOf(): number; - toJSON(): number; - toString(radix?: number): string; - /* Excluded from this release type: toExtendedJSON */ - /* Excluded from this release type: fromExtendedJSON */ - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string; -} - -/** @public */ -export declare interface DoubleExtended { - $numberDouble: string; -} - -/** @public */ -export declare const EJSON: { - parse: typeof parse; - stringify: typeof stringify; - serialize: typeof EJSONserialize; - deserialize: typeof EJSONdeserialize; -}; - -/** - * Deserializes an Extended JSON object into a plain JavaScript object with native/BSON types - * - * @param ejson - The Extended JSON object to deserialize - * @param options - Optional settings passed to the parse method - */ -declare function EJSONdeserialize(ejson: Document, options?: EJSONOptions): any; - -/** @public */ -export declare type EJSONOptions = { - /** - * Output using the Extended JSON v1 spec - * @defaultValue `false` - */ - legacy?: boolean; - /** - * Enable Extended JSON's `relaxed` mode, which attempts to return native JS types where possible, rather than BSON types - * @defaultValue `false` */ - relaxed?: boolean; - /** - * Enable native bigint support - * @defaultValue `false` - */ - useBigInt64?: boolean; -}; - -/** - * Serializes an object to an Extended JSON string, and reparse it as a JavaScript object. - * - * @param value - The object to serialize - * @param options - Optional settings passed to the `stringify` function - */ -declare function EJSONserialize(value: any, options?: EJSONOptions): Document; - -declare type InspectFn = (x: unknown, options?: unknown) => string; - -/** - * A class representation of a BSON Int32 type. - * @public - * @category BSONType - */ -export declare class Int32 extends BSONValue { - get _bsontype(): 'Int32'; - value: number; - /** - * Create an Int32 type - * - * @param value - the number we want to represent as an int32. - */ - constructor(value: number | string); - /** - * Attempt to create an Int32 type from string. - * - * This method will throw a BSONError on any string input that is not representable as an Int32. - * Notably, this method will also throw on the following string formats: - * - Strings in non-decimal formats (exponent notation, binary, hex, or octal digits) - * - Strings non-numeric and non-leading sign characters (ex: '2.0', '24,000') - * - Strings with leading and/or trailing whitespace - * - * Strings with leading zeros, however, are allowed. - * - * @param value - the string we want to represent as an int32. - */ - static fromString(value: string): Int32; - /** - * Access the number value. - * - * @returns returns the wrapped int32 number. - */ - valueOf(): number; - toString(radix?: number): string; - toJSON(): number; - /* Excluded from this release type: toExtendedJSON */ - /* Excluded from this release type: fromExtendedJSON */ - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string; -} - -/** @public */ -export declare interface Int32Extended { - $numberInt: string; -} - -/** - * A class representing a 64-bit integer - * @public - * @category BSONType - * @remarks - * The internal representation of a long is the two given signed, 32-bit values. - * We use 32-bit pieces because these are the size of integers on which - * Javascript performs bit-operations. For operations like addition and - * multiplication, we split each number into 16 bit pieces, which can easily be - * multiplied within Javascript's floating-point representation without overflow - * or change in sign. - * In the algorithms below, we frequently reduce the negative case to the - * positive case by negating the input(s) and then post-processing the result. - * Note that we must ALWAYS check specially whether those values are MIN_VALUE - * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as - * a positive number, it overflows back into a negative). Not handling this - * case would often result in infinite recursion. - * Common constant values ZERO, ONE, NEG_ONE, etc. are found as static properties on this class. - */ -export declare class Long extends BSONValue { - get _bsontype(): 'Long'; - /** An indicator used to reliably determine if an object is a Long or not. */ - get __isLong__(): boolean; - /** - * The high 32 bits as a signed value. - */ - high: number; - /** - * The low 32 bits as a signed value. - */ - low: number; - /** - * Whether unsigned or not. - */ - unsigned: boolean; - /** - * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers. - * - * @param low - The low (signed) 32 bits of the long - * @param high - The high (signed) 32 bits of the long - * @param unsigned - Whether unsigned or not, defaults to signed - */ - constructor(low: number, high?: number, unsigned?: boolean); - /** - * Constructs a 64 bit two's-complement integer, given a bigint representation. - * - * @param value - BigInt representation of the long value - * @param unsigned - Whether unsigned or not, defaults to signed - */ - constructor(value: bigint, unsigned?: boolean); - /** - * Constructs a 64 bit two's-complement integer, given a string representation. - * - * @param value - String representation of the long value - * @param unsigned - Whether unsigned or not, defaults to signed - */ - constructor(value: string, unsigned?: boolean); - static TWO_PWR_24: Long; - /** Maximum unsigned value. */ - static MAX_UNSIGNED_VALUE: Long; - /** Signed zero */ - static ZERO: Long; - /** Unsigned zero. */ - static UZERO: Long; - /** Signed one. */ - static ONE: Long; - /** Unsigned one. */ - static UONE: Long; - /** Signed negative one. */ - static NEG_ONE: Long; - /** Maximum signed value. */ - static MAX_VALUE: Long; - /** Minimum signed value. */ - static MIN_VALUE: Long; - /** - * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. - * Each is assumed to use 32 bits. - * @param lowBits - The low 32 bits - * @param highBits - The high 32 bits - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long; - /** - * Returns a Long representing the given 32 bit integer value. - * @param value - The 32 bit integer in question - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromInt(value: number, unsigned?: boolean): Long; - /** - * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. - * @param value - The number in question - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromNumber(value: number, unsigned?: boolean): Long; - /** - * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. - * @param value - The number in question - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromBigInt(value: bigint, unsigned?: boolean): Long; - /* Excluded from this release type: _fromString */ - /** - * Returns a signed Long representation of the given string, written using radix 10. - * Will throw an error if the given text is not exactly representable as a Long. - * Throws an error if any of the following conditions are true: - * - the string contains invalid characters for the radix 10 - * - the string contains whitespace - * - the value the string represents is too large or too small to be a Long - * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero - * @param str - The textual representation of the Long - * @returns The corresponding Long value - */ - static fromStringStrict(str: string): Long; - /** - * Returns a Long representation of the given string, written using the radix 10. - * Will throw an error if the given parameters are not exactly representable as a Long. - * Throws an error if any of the following conditions are true: - * - the string contains invalid characters for the given radix - * - the string contains whitespace - * - the value the string represents is too large or too small to be a Long - * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero - * @param str - The textual representation of the Long - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromStringStrict(str: string, unsigned?: boolean): Long; - /** - * Returns a signed Long representation of the given string, written using the specified radix. - * Will throw an error if the given parameters are not exactly representable as a Long. - * Throws an error if any of the following conditions are true: - * - the string contains invalid characters for the given radix - * - the string contains whitespace - * - the value the string represents is too large or too small to be a Long - * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero - * @param str - The textual representation of the Long - * @param radix - The radix in which the text is written (2-36), defaults to 10 - * @returns The corresponding Long value - */ - static fromStringStrict(str: string, radix?: boolean): Long; - /** - * Returns a Long representation of the given string, written using the specified radix. - * Will throw an error if the given parameters are not exactly representable as a Long. - * Throws an error if any of the following conditions are true: - * - the string contains invalid characters for the given radix - * - the string contains whitespace - * - the value the string represents is too large or too small to be a Long - * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero - * @param str - The textual representation of the Long - * @param unsigned - Whether unsigned or not, defaults to signed - * @param radix - The radix in which the text is written (2-36), defaults to 10 - * @returns The corresponding Long value - */ - static fromStringStrict(str: string, unsigned?: boolean, radix?: number): Long; - /** - * Returns a signed Long representation of the given string, written using radix 10. - * - * If the input string is empty, this function will throw a BSONError. - * - * If input string does not have valid signed 64-bit Long representation, this method will return a coerced value: - * - inputs that overflow 64-bit signed long will be coerced to Long.MAX_VALUE and Long.MIN_VALUE respectively - * - 'NaN' or '+/-Infinity' are coerced to Long.ZERO - * - other invalid characters sequences have variable behavior - * - * @param str - The textual representation of the Long - * @returns The corresponding Long value - */ - static fromString(str: string): Long; - /** - * Returns a signed Long representation of the given string, written using the provided radix. - * - * If the input string is empty or a provided radix is not within (2-36), this function will throw a BSONError. - * - * If input parameters do not have valid signed 64-bit Long representation, this method will return a coerced value: - * - inputs that overflow 64-bit signed long will be coerced to Long.MAX_VALUE and Long.MIN_VALUE respectively - * - if the radix is less than 24, 'NaN' is coerced to Long.ZERO - * - if the radix is less than 35, '+/-Infinity' inputs are coerced to Long.ZERO - * - other invalid characters sequences have variable behavior - * @param str - The textual representation of the Long - * @param radix - The radix in which the text is written (2-36), defaults to 10 - * @returns The corresponding Long value - */ - static fromString(str: string, radix?: number): Long; - /** - * Returns a Long representation of the given string, written using radix 10. - * - * If the input string is empty, this function will throw a BSONError. - * - * If input parameters do not have a valid 64-bit Long representation, this method will return a coerced value: - * - inputs that overflow 64-bit long will be coerced to max or min (if signed) values - * - if the radix is less than 24, 'NaN' is coerced to Long.ZERO - * - if the radix is less than 35, '+/-Infinity' inputs are coerced to Long.ZERO - * - other invalid characters sequences have variable behavior - * @param str - The textual representation of the Long - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromString(str: string, unsigned?: boolean): Long; - /** - * Returns a Long representation of the given string, written using the specified radix. - * - * If the input string is empty or a provided radix is not within (2-36), this function will throw a BSONError. - * - * If input parameters do not have a valid 64-bit Long representation, this method will return a coerced value: - * - inputs that overflow 64-bit long will be coerced to max or min (if signed) values - * - if the radix is less than 24, 'NaN' is coerced to Long.ZERO - * - if the radix is less than 35, '+/-Infinity' inputs are coerced to Long.ZERO - * - other invalid characters sequences have variable behavior - * @param str - The textual representation of the Long - * @param unsigned - Whether unsigned or not, defaults to signed - * @param radix - The radix in which the text is written (2-36), defaults to 10 - * @returns The corresponding Long value - */ - static fromString(str: string, unsigned?: boolean, radix?: number): Long; - /** - * Creates a Long from its byte representation. - * @param bytes - Byte representation - * @param unsigned - Whether unsigned or not, defaults to signed - * @param le - Whether little or big endian, defaults to big endian - * @returns The corresponding Long value - */ - static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long; - /** - * Creates a Long from its little endian byte representation. - * @param bytes - Little endian byte representation - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromBytesLE(bytes: number[], unsigned?: boolean): Long; - /** - * Creates a Long from its big endian byte representation. - * @param bytes - Big endian byte representation - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromBytesBE(bytes: number[], unsigned?: boolean): Long; - /** - * Tests if the specified object is a Long. - */ - static isLong(value: unknown): value is Long; - /** - * Converts the specified value to a Long. - * @param unsigned - Whether unsigned or not, defaults to signed - */ - static fromValue(val: number | string | { - low: number; - high: number; - unsigned?: boolean; - }, unsigned?: boolean): Long; - /** Returns the sum of this and the specified Long. */ - add(addend: string | number | Long | Timestamp): Long; - /** - * Returns the sum of this and the specified Long. - * @returns Sum - */ - and(other: string | number | Long | Timestamp): Long; - /** - * Compares this Long's value with the specified's. - * @returns 0 if they are the same, 1 if the this is greater and -1 if the given one is greater - */ - compare(other: string | number | Long | Timestamp): 0 | 1 | -1; - /** This is an alias of {@link Long.compare} */ - comp(other: string | number | Long | Timestamp): 0 | 1 | -1; - /** - * Returns this Long divided by the specified. The result is signed if this Long is signed or unsigned if this Long is unsigned. - * @returns Quotient - */ - divide(divisor: string | number | Long | Timestamp): Long; - /**This is an alias of {@link Long.divide} */ - div(divisor: string | number | Long | Timestamp): Long; - /** - * Tests if this Long's value equals the specified's. - * @param other - Other value - */ - equals(other: string | number | Long | Timestamp): boolean; - /** This is an alias of {@link Long.equals} */ - eq(other: string | number | Long | Timestamp): boolean; - /** Gets the high 32 bits as a signed integer. */ - getHighBits(): number; - /** Gets the high 32 bits as an unsigned integer. */ - getHighBitsUnsigned(): number; - /** Gets the low 32 bits as a signed integer. */ - getLowBits(): number; - /** Gets the low 32 bits as an unsigned integer. */ - getLowBitsUnsigned(): number; - /** Gets the number of bits needed to represent the absolute value of this Long. */ - getNumBitsAbs(): number; - /** Tests if this Long's value is greater than the specified's. */ - greaterThan(other: string | number | Long | Timestamp): boolean; - /** This is an alias of {@link Long.greaterThan} */ - gt(other: string | number | Long | Timestamp): boolean; - /** Tests if this Long's value is greater than or equal the specified's. */ - greaterThanOrEqual(other: string | number | Long | Timestamp): boolean; - /** This is an alias of {@link Long.greaterThanOrEqual} */ - gte(other: string | number | Long | Timestamp): boolean; - /** This is an alias of {@link Long.greaterThanOrEqual} */ - ge(other: string | number | Long | Timestamp): boolean; - /** Tests if this Long's value is even. */ - isEven(): boolean; - /** Tests if this Long's value is negative. */ - isNegative(): boolean; - /** Tests if this Long's value is odd. */ - isOdd(): boolean; - /** Tests if this Long's value is positive. */ - isPositive(): boolean; - /** Tests if this Long's value equals zero. */ - isZero(): boolean; - /** Tests if this Long's value is less than the specified's. */ - lessThan(other: string | number | Long | Timestamp): boolean; - /** This is an alias of {@link Long#lessThan}. */ - lt(other: string | number | Long | Timestamp): boolean; - /** Tests if this Long's value is less than or equal the specified's. */ - lessThanOrEqual(other: string | number | Long | Timestamp): boolean; - /** This is an alias of {@link Long.lessThanOrEqual} */ - lte(other: string | number | Long | Timestamp): boolean; - /** Returns this Long modulo the specified. */ - modulo(divisor: string | number | Long | Timestamp): Long; - /** This is an alias of {@link Long.modulo} */ - mod(divisor: string | number | Long | Timestamp): Long; - /** This is an alias of {@link Long.modulo} */ - rem(divisor: string | number | Long | Timestamp): Long; - /** - * Returns the product of this and the specified Long. - * @param multiplier - Multiplier - * @returns Product - */ - multiply(multiplier: string | number | Long | Timestamp): Long; - /** This is an alias of {@link Long.multiply} */ - mul(multiplier: string | number | Long | Timestamp): Long; - /** Returns the Negation of this Long's value. */ - negate(): Long; - /** This is an alias of {@link Long.negate} */ - neg(): Long; - /** Returns the bitwise NOT of this Long. */ - not(): Long; - /** Tests if this Long's value differs from the specified's. */ - notEquals(other: string | number | Long | Timestamp): boolean; - /** This is an alias of {@link Long.notEquals} */ - neq(other: string | number | Long | Timestamp): boolean; - /** This is an alias of {@link Long.notEquals} */ - ne(other: string | number | Long | Timestamp): boolean; - /** - * Returns the bitwise OR of this Long and the specified. - */ - or(other: number | string | Long): Long; - /** - * Returns this Long with bits shifted to the left by the given amount. - * @param numBits - Number of bits - * @returns Shifted Long - */ - shiftLeft(numBits: number | Long): Long; - /** This is an alias of {@link Long.shiftLeft} */ - shl(numBits: number | Long): Long; - /** - * Returns this Long with bits arithmetically shifted to the right by the given amount. - * @param numBits - Number of bits - * @returns Shifted Long - */ - shiftRight(numBits: number | Long): Long; - /** This is an alias of {@link Long.shiftRight} */ - shr(numBits: number | Long): Long; - /** - * Returns this Long with bits logically shifted to the right by the given amount. - * @param numBits - Number of bits - * @returns Shifted Long - */ - shiftRightUnsigned(numBits: Long | number): Long; - /** This is an alias of {@link Long.shiftRightUnsigned} */ - shr_u(numBits: number | Long): Long; - /** This is an alias of {@link Long.shiftRightUnsigned} */ - shru(numBits: number | Long): Long; - /** - * Returns the difference of this and the specified Long. - * @param subtrahend - Subtrahend - * @returns Difference - */ - subtract(subtrahend: string | number | Long | Timestamp): Long; - /** This is an alias of {@link Long.subtract} */ - sub(subtrahend: string | number | Long | Timestamp): Long; - /** Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. */ - toInt(): number; - /** Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). */ - toNumber(): number; - /** Converts the Long to a BigInt (arbitrary precision). */ - toBigInt(): bigint; - /** - * Converts this Long to its byte representation. - * @param le - Whether little or big endian, defaults to big endian - * @returns Byte representation - */ - toBytes(le?: boolean): number[]; - /** - * Converts this Long to its little endian byte representation. - * @returns Little endian byte representation - */ - toBytesLE(): number[]; - /** - * Converts this Long to its big endian byte representation. - * @returns Big endian byte representation - */ - toBytesBE(): number[]; - /** - * Converts this Long to signed. - */ - toSigned(): Long; - /** - * Converts the Long to a string written in the specified radix. - * @param radix - Radix (2-36), defaults to 10 - * @throws RangeError If `radix` is out of range - */ - toString(radix?: number): string; - /** Converts this Long to unsigned. */ - toUnsigned(): Long; - /** Returns the bitwise XOR of this Long and the given one. */ - xor(other: Long | number | string): Long; - /** This is an alias of {@link Long.isZero} */ - eqz(): boolean; - /** This is an alias of {@link Long.lessThanOrEqual} */ - le(other: string | number | Long | Timestamp): boolean; - toExtendedJSON(options?: EJSONOptions): number | LongExtended; - static fromExtendedJSON(doc: { - $numberLong: string; - }, options?: EJSONOptions): number | Long | bigint; - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string; -} - -/** @public */ -export declare interface LongExtended { - $numberLong: string; -} - -/** @public */ -export declare type LongWithoutOverrides = new (low: unknown, high?: number | boolean, unsigned?: boolean) => { - [P in Exclude]: Long[P]; -}; - -/** @public */ -export declare const LongWithoutOverridesClass: LongWithoutOverrides; - -/** - * A class representation of the BSON MaxKey type. - * @public - * @category BSONType - */ -export declare class MaxKey extends BSONValue { - get _bsontype(): 'MaxKey'; - /* Excluded from this release type: toExtendedJSON */ - /* Excluded from this release type: fromExtendedJSON */ - inspect(): string; -} - -/** @public */ -export declare interface MaxKeyExtended { - $maxKey: 1; -} - -/** - * A class representation of the BSON MinKey type. - * @public - * @category BSONType - */ -export declare class MinKey extends BSONValue { - get _bsontype(): 'MinKey'; - /* Excluded from this release type: toExtendedJSON */ - /* Excluded from this release type: fromExtendedJSON */ - inspect(): string; -} - -/** @public */ -export declare interface MinKeyExtended { - $minKey: 1; -} - -/** - * @experimental - * @public - * - * A collection of functions that get or set various numeric types and bit widths from a Uint8Array. - */ -declare type NumberUtils = { - /** Is true if the current system is big endian. */ - isBigEndian: boolean; - /** - * Parses a signed int32 at offset. Throws a `RangeError` if value is negative. - */ - getNonnegativeInt32LE: (source: Uint8Array, offset: number) => number; - getInt32LE: (source: Uint8Array, offset: number) => number; - getUint32LE: (source: Uint8Array, offset: number) => number; - getUint32BE: (source: Uint8Array, offset: number) => number; - getBigInt64LE: (source: Uint8Array, offset: number) => bigint; - getFloat64LE: (source: Uint8Array, offset: number) => number; - setInt32BE: (destination: Uint8Array, offset: number, value: number) => 4; - setInt32LE: (destination: Uint8Array, offset: number, value: number) => 4; - setBigInt64LE: (destination: Uint8Array, offset: number, value: bigint) => 8; - setFloat64LE: (destination: Uint8Array, offset: number, value: number) => 8; -}; - -/** - * Number parsing and serializing utilities. - * - * @experimental - * @public - */ -declare const NumberUtils: NumberUtils; - -/** - * A class representation of the BSON ObjectId type. - * @public - * @category BSONType - */ -export declare class ObjectId extends BSONValue { - get _bsontype(): 'ObjectId'; - /* Excluded from this release type: index */ - static cacheHexString: boolean; - /* Excluded from this release type: buffer */ - /** - * Create ObjectId from a number. - * - * @param inputId - A number. - * @deprecated Instead, use `static createFromTime()` to set a numeric value for the new ObjectId. - */ - constructor(inputId: number); - /** - * Create ObjectId from a 24 character hex string. - * - * @param inputId - A 24 character hex string. - */ - constructor(inputId: string); - /** - * Create ObjectId from the BSON ObjectId type. - * - * @param inputId - The BSON ObjectId type. - */ - constructor(inputId: ObjectId); - /** - * Create ObjectId from the object type that has the toHexString method. - * - * @param inputId - The ObjectIdLike type. - */ - constructor(inputId: ObjectIdLike); - /** - * Create ObjectId from a 12 byte binary Buffer. - * - * @param inputId - A 12 byte binary Buffer. - */ - constructor(inputId: Uint8Array); - /** To generate a new ObjectId, use ObjectId() with no argument. */ - constructor(); - /** - * Implementation overload. - * - * @param inputId - All input types that are used in the constructor implementation. - */ - constructor(inputId?: string | number | ObjectId | ObjectIdLike | Uint8Array); - /** - * The ObjectId bytes - * @readonly - */ - get id(): Uint8Array; - set id(value: Uint8Array); - /* Excluded from this release type: validateHexString */ - /** Returns the ObjectId id as a 24 lowercase character hex string representation */ - toHexString(): string; - /* Excluded from this release type: getInc */ - /** - * Generate a 12 byte id buffer used in ObjectId's - * - * @param time - pass in a second based timestamp. - */ - static generate(time?: number): Uint8Array; - /** - * Converts the id into a 24 character hex string for printing, unless encoding is provided. - * @param encoding - hex or base64 - */ - toString(encoding?: 'hex' | 'base64'): string; - /** Converts to its JSON the 24 character hex string representation. */ - toJSON(): string; - /* Excluded from this release type: is */ - /** - * Compares the equality of this ObjectId with `otherID`. - * - * @param otherId - ObjectId instance to compare against. - */ - equals(otherId: string | ObjectId | ObjectIdLike | undefined | null): boolean; - /** Returns the generation date (accurate up to the second) that this ID was generated. */ - getTimestamp(): Date; - /* Excluded from this release type: createPk */ - /* Excluded from this release type: serializeInto */ - /** - * Creates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId. - * - * @param time - an integer number representing a number of seconds. - */ - static createFromTime(time: number): ObjectId; - /** - * Creates an ObjectId from a hex string representation of an ObjectId. - * - * @param hexString - create a ObjectId from a passed in 24 character hexstring. - */ - static createFromHexString(hexString: string): ObjectId; - /** Creates an ObjectId instance from a base64 string */ - static createFromBase64(base64: string): ObjectId; - /** - * Checks if a value can be used to create a valid bson ObjectId - * @param id - any JS value - */ - static isValid(id: string | number | ObjectId | ObjectIdLike | Uint8Array): boolean; - /* Excluded from this release type: toExtendedJSON */ - /* Excluded from this release type: fromExtendedJSON */ - /* Excluded from this release type: isCached */ - /** - * Converts to a string representation of this Id. - * - * @returns return the 24 character hex string representation. - */ - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string; -} - -/** @public */ -export declare interface ObjectIdExtended { - $oid: string; -} - -/** @public */ -export declare interface ObjectIdLike { - id: string | Uint8Array; - __id?: string; - toHexString(): string; -} - -/** - * @experimental - * @public - * - * A new set of BSON APIs that are currently experimental and not intended for production use. - */ -export declare type OnDemand = { - parseToElements: (this: void, bytes: Uint8Array, startOffset?: number) => Iterable; - BSONElement: BSONElement; - ByteUtils: ByteUtils; - NumberUtils: NumberUtils; -}; - -/** - * @experimental - * @public - */ -export declare const onDemand: OnDemand; - -/** - * Parse an Extended JSON string, constructing the JavaScript value or object described by that - * string. - * - * @example - * ```js - * const { EJSON } = require('bson'); - * const text = '{ "int32": { "$numberInt": "10" } }'; - * - * // prints { int32: { [String: '10'] _bsontype: 'Int32', value: '10' } } - * console.log(EJSON.parse(text, { relaxed: false })); - * - * // prints { int32: 10 } - * console.log(EJSON.parse(text)); - * ``` - */ -declare function parse(text: string, options?: EJSONOptions): any; - -/** - * Serialize a Javascript object. - * - * @param object - the Javascript object to serialize. - * @returns Buffer object containing the serialized object. - * @public - */ -export declare function serialize(object: Document, options?: SerializeOptions): Uint8Array; - -/** @public */ -export declare interface SerializeOptions { - /** - * the serializer will check if keys are valid. - * @defaultValue `false` - */ - checkKeys?: boolean; - /** - * serialize the javascript functions - * @defaultValue `false` - */ - serializeFunctions?: boolean; - /** - * serialize will not emit undefined fields - * note that the driver sets this to `false` - * @defaultValue `true` - */ - ignoreUndefined?: boolean; - /* Excluded from this release type: minInternalBufferSize */ - /** - * the index in the buffer where we wish to start serializing into - * @defaultValue `0` - */ - index?: number; -} - -/** - * Serialize a Javascript object using a predefined Buffer and index into the buffer, - * useful when pre-allocating the space for serialization. - * - * @param object - the Javascript object to serialize. - * @param finalBuffer - the Buffer you pre-allocated to store the serialized BSON object. - * @returns the index pointing to the last written byte in the buffer. - * @public - */ -export declare function serializeWithBufferAndIndex(object: Document, finalBuffer: Uint8Array, options?: SerializeOptions): number; - -/** - * Sets the size of the internal serialization buffer. - * - * @param size - The desired size for the internal serialization buffer in bytes - * @public - */ -export declare function setInternalBufferSize(size: number): void; - -/** - * Converts a BSON document to an Extended JSON string, optionally replacing values if a replacer - * function is specified or optionally including only the specified properties if a replacer array - * is specified. - * - * @param value - The value to convert to extended JSON - * @param replacer - A function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string - * @param space - A String or Number object that's used to insert white space into the output JSON string for readability purposes. - * @param options - Optional settings - * - * @example - * ```js - * const { EJSON } = require('bson'); - * const Int32 = require('mongodb').Int32; - * const doc = { int32: new Int32(10) }; - * - * // prints '{"int32":{"$numberInt":"10"}}' - * console.log(EJSON.stringify(doc, { relaxed: false })); - * - * // prints '{"int32":10}' - * console.log(EJSON.stringify(doc)); - * ``` - */ -declare function stringify(value: any, replacer?: (number | string)[] | ((this: any, key: string, value: any) => any) | EJSONOptions, space?: string | number, options?: EJSONOptions): string; - -/** - * @public - * @category BSONType - * - * A special type for _internal_ MongoDB use and is **not** associated with the regular Date type. - */ -export declare class Timestamp extends LongWithoutOverridesClass { - get _bsontype(): 'Timestamp'; - static readonly MAX_VALUE: Long; - /** - * An incrementing ordinal for operations within a given second. - */ - get i(): number; - /** - * A `time_t` value measuring seconds since the Unix epoch - */ - get t(): number; - /** - * @param int - A 64-bit bigint representing the Timestamp. - */ - constructor(int: bigint); - /** - * @param long - A 64-bit Long representing the Timestamp. - */ - constructor(long: Long); - /** - * @param value - A pair of two values indicating timestamp and increment. - */ - constructor(value: { - t: number; - i: number; - }); - toJSON(): { - $timestamp: string; - }; - /** Returns a Timestamp represented by the given (32-bit) integer value. */ - static fromInt(value: number): Timestamp; - /** Returns a Timestamp representing the given number value, provided that it is a finite number. Otherwise, zero is returned. */ - static fromNumber(value: number): Timestamp; - /** - * Returns a Timestamp for the given high and low bits. Each is assumed to use 32 bits. - * - * @param lowBits - the low 32-bits. - * @param highBits - the high 32-bits. - */ - static fromBits(lowBits: number, highBits: number): Timestamp; - /** - * Returns a Timestamp from the given string, optionally using the given radix. - * - * @param str - the textual representation of the Timestamp. - * @param optRadix - the radix in which the text is written. - */ - static fromString(str: string, optRadix: number): Timestamp; - /* Excluded from this release type: toExtendedJSON */ - /* Excluded from this release type: fromExtendedJSON */ - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string; -} - -/** @public */ -export declare interface TimestampExtended { - $timestamp: { - t: number; - i: number; - }; -} - -/** @public */ -export declare type TimestampOverrides = '_bsontype' | 'toExtendedJSON' | 'fromExtendedJSON' | 'inspect'; - -/** - * A class representation of the BSON UUID type. - * @public - */ -export declare class UUID extends Binary { - /** - * Create a UUID type - * - * When the argument to the constructor is omitted a random v4 UUID will be generated. - * - * @param input - Can be a 32 or 36 character hex string (dashes excluded/included) or a 16 byte binary Buffer. - */ - constructor(input?: string | Uint8Array | UUID); - /** - * The UUID bytes - * @readonly - */ - get id(): Uint8Array; - set id(value: Uint8Array); - /** - * Returns the UUID id as a 32 or 36 character hex string representation, excluding/including dashes (defaults to 36 character dash separated) - * @param includeDashes - should the string exclude dash-separators. - */ - toHexString(includeDashes?: boolean): string; - /** - * Converts the id into a 36 character (dashes included) hex string, unless a encoding is specified. - */ - toString(encoding?: 'hex' | 'base64'): string; - /** - * Converts the id into its JSON string representation. - * A 36 character (dashes included) hex string in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - */ - toJSON(): string; - /** - * Compares the equality of this UUID with `otherID`. - * - * @param otherId - UUID instance to compare against. - */ - equals(otherId: string | Uint8Array | UUID): boolean; - /** - * Creates a Binary instance from the current UUID. - */ - toBinary(): Binary; - /** - * Generates a populated buffer containing a v4 uuid - */ - static generate(): Uint8Array; - /** - * Checks if a value is a valid bson UUID - * @param input - UUID, string or Buffer to validate. - */ - static isValid(input: string | Uint8Array | UUID | Binary): boolean; - /** - * Creates an UUID from a hex string representation of an UUID. - * @param hexString - 32 or 36 character hex string (dashes excluded/included). - */ - static createFromHexString(hexString: string): UUID; - /** Creates an UUID from a base64 string representation of an UUID. */ - static createFromBase64(base64: string): UUID; - /* Excluded from this release type: bytesFromString */ - /* Excluded from this release type: isValidUUIDString */ - /** - * Converts to a string representation of this Id. - * - * @returns return the 36 character hex string representation. - * - */ - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string; -} - -/** @public */ -export declare type UUIDExtended = { - $uuid: string; -}; - -export { } diff --git a/server/node_modules/bson/etc/prepare.js b/server/node_modules/bson/etc/prepare.js deleted file mode 100644 index 91e6f3a9..00000000 --- a/server/node_modules/bson/etc/prepare.js +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env node -var cp = require('child_process'); -var fs = require('fs'); - -var nodeMajorVersion = +process.version.match(/^v(\d+)\.\d+/)[1]; - -if (fs.existsSync('src') && nodeMajorVersion >= 10) { - cp.spawnSync('npm', ['run', 'build'], { stdio: 'inherit', shell: true }); -} else { - if (!fs.existsSync('lib')) { - console.warn('BSON: No compiled javascript present, the library is not installed correctly.'); - if (nodeMajorVersion < 10) { - console.warn( - 'This library can only be compiled in nodejs version 10 or later, currently running: ' + - nodeMajorVersion - ); - } - } -} diff --git a/server/node_modules/bson/package.json b/server/node_modules/bson/package.json deleted file mode 100644 index c6268abb..00000000 --- a/server/node_modules/bson/package.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "name": "bson", - "description": "A bson parser for node.js and the browser", - "keywords": [ - "mongodb", - "bson", - "parser" - ], - "files": [ - "lib", - "src", - "bson.d.ts", - "etc/prepare.js", - "vendor" - ], - "types": "bson.d.ts", - "version": "6.10.4", - "author": { - "name": "The MongoDB NodeJS Team", - "email": "dbx-node@mongodb.com" - }, - "license": "Apache-2.0", - "contributors": [], - "repository": "mongodb/js-bson", - "bugs": { - "url": "https://jira.mongodb.org/projects/NODE/issues/" - }, - "devDependencies": { - "@istanbuljs/nyc-config-typescript": "^1.0.2", - "@microsoft/api-extractor": "^7.52.5", - "@rollup/plugin-node-resolve": "^16.0.1", - "@rollup/plugin-typescript": "^12.1.2", - "@types/chai": "^4.3.17", - "@types/mocha": "^10.0.7", - "@types/node": "^22.15.3", - "@types/sinon": "^17.0.4", - "@types/sinon-chai": "^3.2.12", - "@typescript-eslint/eslint-plugin": "^8.31.1", - "@typescript-eslint/parser": "^8.31.1", - "benchmark": "^2.1.4", - "chai": "^4.4.1", - "chalk": "^5.3.0", - "dbx-js-tools": "github:mongodb-js/dbx-js-tools#main", - "eslint": "^9.25.1", - "eslint-config-prettier": "^10.1.2", - "eslint-plugin-no-bigint-usage": "file:etc/eslint/no-bigint-usage", - "eslint-plugin-prettier": "^5.2.6", - "eslint-plugin-tsdoc": "^0.4.0", - "magic-string": "^0.30.11", - "mocha": "^10.7.0", - "node-fetch": "^3.3.2", - "nyc": "^15.1.0", - "prettier": "^3.5.3", - "rollup": "^4.40.1", - "sinon": "^18.0.0", - "sinon-chai": "^3.7.0", - "source-map-support": "^0.5.21", - "tar": "^7.4.3", - "ts-node": "^10.9.2", - "tsd": "^0.31.1", - "typescript": "^5.8.3", - "typescript-cached-transpile": "0.0.6", - "uuid": "^11.1.0" - }, - "tsd": { - "directory": "test/types", - "compilerOptions": { - "strict": true, - "target": "esnext", - "module": "commonjs", - "moduleResolution": "node" - } - }, - "config": { - "native": false - }, - "main": "./lib/bson.cjs", - "module": "./lib/bson.node.mjs", - "exports": { - "browser": { - "types": "./bson.d.ts", - "default": "./lib/bson.mjs" - }, - "react-native": "./lib/bson.rn.cjs", - "default": { - "types": "./bson.d.ts", - "import": "./lib/bson.node.mjs", - "require": "./lib/bson.cjs" - } - }, - "compass:exports": { - "import": "./lib/bson.cjs", - "require": "./lib/bson.cjs" - }, - "engines": { - "node": ">=16.20.1" - }, - "scripts": { - "pretest": "npm run build", - "test": "npm run check:node && npm run check:web && npm run check:web-no-bigint", - "check:node": "WEB=false mocha test/node", - "check:tsd": "npm run build:dts && tsd", - "check:web": "WEB=true mocha test/node", - "check:web-no-bigint": "WEB=true NO_BIGINT=true mocha test/node", - "check:granular-bench": "npm run build:bench && npm run check:baseline-bench && node ./test/bench/etc/run_granular_benchmarks.js", - "check:spec-bench": "npm run build:bench && npm run check:baseline-bench && node ./test/bench/lib/spec/bsonBench.js", - "check:custom-bench": "npm run build && npm run check:baseline-bench && node ./test/bench/custom/main.mjs", - "check:baseline-bench": "node ./test/bench/etc/cpuBaseline.js", - "build:bench": "cd test/bench && npx tsc", - "build:ts": "node ./node_modules/typescript/bin/tsc", - "build:dts": "npm run build:ts && api-extractor run --typescript-compiler-folder node_modules/typescript --local && node etc/clean_definition_files.cjs", - "build:bundle": "rollup -c rollup.config.mjs", - "build": "npm run build:dts && npm run build:bundle", - "check:lint": "ESLINT_USE_FLAT_CONFIG=false eslint -v && ESLINT_USE_FLAT_CONFIG=false eslint --ext '.js,.ts' --max-warnings=0 src test && npm run build:dts && npm run check:tsd", - "format": "ESLINT_USE_FLAT_CONFIG=false eslint --ext '.js,.ts' src test --fix", - "check:coverage": "nyc --check-coverage npm run check:node", - "prepare": "node etc/prepare.js", - "release": "standard-version -i HISTORY.md" - } -} \ No newline at end of file diff --git a/server/node_modules/bson/src/binary.ts b/server/node_modules/bson/src/binary.ts deleted file mode 100644 index f7cd61b1..00000000 --- a/server/node_modules/bson/src/binary.ts +++ /dev/null @@ -1,748 +0,0 @@ -import { type InspectFn, defaultInspect, isAnyArrayBuffer, isUint8Array } from './parser/utils'; -import type { EJSONOptions } from './extended_json'; -import { BSONError } from './error'; -import { BSON_BINARY_SUBTYPE_UUID_NEW } from './constants'; -import { ByteUtils } from './utils/byte_utils'; -import { BSONValue } from './bson_value'; -import { NumberUtils } from './utils/number_utils'; - -/** @public */ -export type BinarySequence = Uint8Array | number[]; - -/** @public */ -export interface BinaryExtendedLegacy { - $type: string; - $binary: string; -} - -/** @public */ -export interface BinaryExtended { - $binary: { - subType: string; - base64: string; - }; -} - -/** - * A class representation of the BSON Binary type. - * @public - * @category BSONType - */ -export class Binary extends BSONValue { - get _bsontype(): 'Binary' { - return 'Binary'; - } - - /** - * Binary default subtype - * @internal - */ - private static readonly BSON_BINARY_SUBTYPE_DEFAULT = 0; - - /** Initial buffer default size */ - static readonly BUFFER_SIZE = 256; - /** Default BSON type */ - static readonly SUBTYPE_DEFAULT = 0; - /** Function BSON type */ - static readonly SUBTYPE_FUNCTION = 1; - /** Byte Array BSON type */ - static readonly SUBTYPE_BYTE_ARRAY = 2; - /** Deprecated UUID BSON type @deprecated Please use SUBTYPE_UUID */ - static readonly SUBTYPE_UUID_OLD = 3; - /** UUID BSON type */ - static readonly SUBTYPE_UUID = 4; - /** MD5 BSON type */ - static readonly SUBTYPE_MD5 = 5; - /** Encrypted BSON type */ - static readonly SUBTYPE_ENCRYPTED = 6; - /** Column BSON type */ - static readonly SUBTYPE_COLUMN = 7; - /** Sensitive BSON type */ - static readonly SUBTYPE_SENSITIVE = 8; - /** Vector BSON type */ - static readonly SUBTYPE_VECTOR = 9; - /** User BSON type */ - static readonly SUBTYPE_USER_DEFINED = 128; - - /** datatype of a Binary Vector (subtype: 9) */ - static readonly VECTOR_TYPE = Object.freeze({ - Int8: 0x03, - Float32: 0x27, - PackedBit: 0x10 - } as const); - - /** - * The bytes of the Binary value. - * - * The format of a Binary value in BSON is defined as: - * ```txt - * binary ::= int32 subtype (byte*) - * ``` - * - * This `buffer` is the "(byte*)" segment. - * - * Unless the value is subtype 2, then deserialize will read the first 4 bytes as an int32 and set this to the remaining bytes. - * - * ```txt - * binary ::= int32 unsigned_byte(2) int32 (byte*) - * ``` - * - * @see https://bsonspec.org/spec.html - */ - public buffer: Uint8Array; - /** - * The binary subtype. - * - * Current defined values are: - * - * - `unsigned_byte(0)` Generic binary subtype - * - `unsigned_byte(1)` Function - * - `unsigned_byte(2)` Binary (Deprecated) - * - `unsigned_byte(3)` UUID (Deprecated) - * - `unsigned_byte(4)` UUID - * - `unsigned_byte(5)` MD5 - * - `unsigned_byte(6)` Encrypted BSON value - * - `unsigned_byte(7)` Compressed BSON column - * - `unsigned_byte(8)` Sensitive - * - `unsigned_byte(9)` Vector - * - `unsigned_byte(128)` - `unsigned_byte(255)` User defined - */ - public sub_type: number; - /** - * The Binary's `buffer` can be larger than the Binary's content. - * This property is used to determine where the content ends in the buffer. - */ - public position: number; - - /** - * Create a new Binary instance. - * @param buffer - a buffer object containing the binary data. - * @param subType - the option binary type. - */ - constructor(buffer?: BinarySequence, subType?: number) { - super(); - if ( - !(buffer == null) && - typeof buffer === 'string' && - !ArrayBuffer.isView(buffer) && - !isAnyArrayBuffer(buffer) && - !Array.isArray(buffer) - ) { - throw new BSONError('Binary can only be constructed from Uint8Array or number[]'); - } - - this.sub_type = subType ?? Binary.BSON_BINARY_SUBTYPE_DEFAULT; - - if (buffer == null) { - // create an empty binary buffer - this.buffer = ByteUtils.allocate(Binary.BUFFER_SIZE); - this.position = 0; - } else { - this.buffer = Array.isArray(buffer) - ? ByteUtils.fromNumberArray(buffer) - : ByteUtils.toLocalBufferType(buffer); - this.position = this.buffer.byteLength; - } - } - - /** - * Updates this binary with byte_value. - * - * @param byteValue - a single byte we wish to write. - */ - put(byteValue: string | number | Uint8Array | number[]): void { - // If it's a string and a has more than one character throw an error - if (typeof byteValue === 'string' && byteValue.length !== 1) { - throw new BSONError('only accepts single character String'); - } else if (typeof byteValue !== 'number' && byteValue.length !== 1) - throw new BSONError('only accepts single character Uint8Array or Array'); - - // Decode the byte value once - let decodedByte: number; - if (typeof byteValue === 'string') { - decodedByte = byteValue.charCodeAt(0); - } else if (typeof byteValue === 'number') { - decodedByte = byteValue; - } else { - decodedByte = byteValue[0]; - } - - if (decodedByte < 0 || decodedByte > 255) { - throw new BSONError('only accepts number in a valid unsigned byte range 0-255'); - } - - if (this.buffer.byteLength > this.position) { - this.buffer[this.position++] = decodedByte; - } else { - const newSpace = ByteUtils.allocate(Binary.BUFFER_SIZE + this.buffer.length); - newSpace.set(this.buffer, 0); - this.buffer = newSpace; - this.buffer[this.position++] = decodedByte; - } - } - - /** - * Writes a buffer to the binary. - * - * @param sequence - a string or buffer to be written to the Binary BSON object. - * @param offset - specify the binary of where to write the content. - */ - write(sequence: BinarySequence, offset: number): void { - offset = typeof offset === 'number' ? offset : this.position; - - // If the buffer is to small let's extend the buffer - if (this.buffer.byteLength < offset + sequence.length) { - const newSpace = ByteUtils.allocate(this.buffer.byteLength + sequence.length); - newSpace.set(this.buffer, 0); - - // Assign the new buffer - this.buffer = newSpace; - } - - if (ArrayBuffer.isView(sequence)) { - this.buffer.set(ByteUtils.toLocalBufferType(sequence), offset); - this.position = - offset + sequence.byteLength > this.position ? offset + sequence.length : this.position; - } else if (typeof sequence === 'string') { - throw new BSONError('input cannot be string'); - } - } - - /** - * Returns a view of **length** bytes starting at **position**. - * - * @param position - read from the given position in the Binary. - * @param length - the number of bytes to read. - */ - read(position: number, length: number): Uint8Array { - length = length && length > 0 ? length : this.position; - const end = position + length; - return this.buffer.subarray(position, end > this.position ? this.position : end); - } - - /** returns a view of the binary value as a Uint8Array */ - value(): Uint8Array { - // Optimize to serialize for the situation where the data == size of buffer - return this.buffer.length === this.position - ? this.buffer - : this.buffer.subarray(0, this.position); - } - - /** the length of the binary sequence */ - length(): number { - return this.position; - } - - toJSON(): string { - return ByteUtils.toBase64(this.buffer.subarray(0, this.position)); - } - - toString(encoding?: 'hex' | 'base64' | 'utf8' | 'utf-8'): string { - if (encoding === 'hex') return ByteUtils.toHex(this.buffer.subarray(0, this.position)); - if (encoding === 'base64') return ByteUtils.toBase64(this.buffer.subarray(0, this.position)); - if (encoding === 'utf8' || encoding === 'utf-8') - return ByteUtils.toUTF8(this.buffer, 0, this.position, false); - return ByteUtils.toUTF8(this.buffer, 0, this.position, false); - } - - /** @internal */ - toExtendedJSON(options?: EJSONOptions): BinaryExtendedLegacy | BinaryExtended { - options = options || {}; - - if (this.sub_type === Binary.SUBTYPE_VECTOR) { - validateBinaryVector(this); - } - - const base64String = ByteUtils.toBase64(this.buffer); - - const subType = Number(this.sub_type).toString(16); - if (options.legacy) { - return { - $binary: base64String, - $type: subType.length === 1 ? '0' + subType : subType - }; - } - return { - $binary: { - base64: base64String, - subType: subType.length === 1 ? '0' + subType : subType - } - }; - } - - toUUID(): UUID { - if (this.sub_type === Binary.SUBTYPE_UUID) { - return new UUID(this.buffer.subarray(0, this.position)); - } - - throw new BSONError( - `Binary sub_type "${this.sub_type}" is not supported for converting to UUID. Only "${Binary.SUBTYPE_UUID}" is currently supported.` - ); - } - - /** Creates an Binary instance from a hex digit string */ - static createFromHexString(hex: string, subType?: number): Binary { - return new Binary(ByteUtils.fromHex(hex), subType); - } - - /** Creates an Binary instance from a base64 string */ - static createFromBase64(base64: string, subType?: number): Binary { - return new Binary(ByteUtils.fromBase64(base64), subType); - } - - /** @internal */ - static fromExtendedJSON( - doc: BinaryExtendedLegacy | BinaryExtended | UUIDExtended, - options?: EJSONOptions - ): Binary { - options = options || {}; - let data: Uint8Array | undefined; - let type; - if ('$binary' in doc) { - if (options.legacy && typeof doc.$binary === 'string' && '$type' in doc) { - type = doc.$type ? parseInt(doc.$type, 16) : 0; - data = ByteUtils.fromBase64(doc.$binary); - } else { - if (typeof doc.$binary !== 'string') { - type = doc.$binary.subType ? parseInt(doc.$binary.subType, 16) : 0; - data = ByteUtils.fromBase64(doc.$binary.base64); - } - } - } else if ('$uuid' in doc) { - type = 4; - data = UUID.bytesFromString(doc.$uuid); - } - if (!data) { - throw new BSONError(`Unexpected Binary Extended JSON format ${JSON.stringify(doc)}`); - } - return type === BSON_BINARY_SUBTYPE_UUID_NEW ? new UUID(data) : new Binary(data, type); - } - - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string { - inspect ??= defaultInspect; - const base64 = ByteUtils.toBase64(this.buffer.subarray(0, this.position)); - const base64Arg = inspect(base64, options); - const subTypeArg = inspect(this.sub_type, options); - return `Binary.createFromBase64(${base64Arg}, ${subTypeArg})`; - } - - /** - * If this Binary represents a Int8 Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.Int8`), - * returns a copy of the bytes in a new Int8Array. - * - * If the Binary is not a Vector, or the datatype is not Int8, an error is thrown. - */ - public toInt8Array(): Int8Array { - if (this.sub_type !== Binary.SUBTYPE_VECTOR) { - throw new BSONError('Binary sub_type is not Vector'); - } - - if (this.buffer[0] !== Binary.VECTOR_TYPE.Int8) { - throw new BSONError('Binary datatype field is not Int8'); - } - - validateBinaryVector(this); - - return new Int8Array( - this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position) - ); - } - - /** - * If this Binary represents a Float32 Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.Float32`), - * returns a copy of the bytes in a new Float32Array. - * - * If the Binary is not a Vector, or the datatype is not Float32, an error is thrown. - */ - public toFloat32Array(): Float32Array { - if (this.sub_type !== Binary.SUBTYPE_VECTOR) { - throw new BSONError('Binary sub_type is not Vector'); - } - - if (this.buffer[0] !== Binary.VECTOR_TYPE.Float32) { - throw new BSONError('Binary datatype field is not Float32'); - } - - validateBinaryVector(this); - - const floatBytes = new Uint8Array( - this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position) - ); - - if (NumberUtils.isBigEndian) ByteUtils.swap32(floatBytes); - - return new Float32Array(floatBytes.buffer); - } - - /** - * If this Binary represents packed bit Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.PackedBit`), - * returns a copy of the bytes that are packed bits. - * - * Use `toBits` to get the unpacked bits. - * - * If the Binary is not a Vector, or the datatype is not PackedBit, an error is thrown. - */ - public toPackedBits(): Uint8Array { - if (this.sub_type !== Binary.SUBTYPE_VECTOR) { - throw new BSONError('Binary sub_type is not Vector'); - } - - if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) { - throw new BSONError('Binary datatype field is not packed bit'); - } - - validateBinaryVector(this); - - return new Uint8Array( - this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position) - ); - } - - /** - * If this Binary represents a Packed bit Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.PackedBit`), - * returns a copy of the bit unpacked into a new Int8Array. - * - * Use `toPackedBits` to get the bits still in packed form. - * - * If the Binary is not a Vector, or the datatype is not PackedBit, an error is thrown. - */ - public toBits(): Int8Array { - if (this.sub_type !== Binary.SUBTYPE_VECTOR) { - throw new BSONError('Binary sub_type is not Vector'); - } - - if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) { - throw new BSONError('Binary datatype field is not packed bit'); - } - - validateBinaryVector(this); - - const byteCount = this.length() - 2; - const bitCount = byteCount * 8 - this.buffer[1]; - const bits = new Int8Array(bitCount); - - for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) { - const byteOffset = (bitOffset / 8) | 0; - const byte = this.buffer[byteOffset + 2]; - const shift = 7 - (bitOffset % 8); - const bit = (byte >> shift) & 1; - bits[bitOffset] = bit; - } - - return bits; - } - - /** - * Constructs a Binary representing an Int8 Vector. - * @param array - The array to store as a view on the Binary class - */ - public static fromInt8Array(array: Int8Array): Binary { - const buffer = ByteUtils.allocate(array.byteLength + 2); - buffer[0] = Binary.VECTOR_TYPE.Int8; - buffer[1] = 0; - const intBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength); - buffer.set(intBytes, 2); - const bin = new this(buffer, this.SUBTYPE_VECTOR); - validateBinaryVector(bin); - return bin; - } - - /** Constructs a Binary representing an Float32 Vector. */ - public static fromFloat32Array(array: Float32Array): Binary { - const binaryBytes = ByteUtils.allocate(array.byteLength + 2); - binaryBytes[0] = Binary.VECTOR_TYPE.Float32; - binaryBytes[1] = 0; - - const floatBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength); - binaryBytes.set(floatBytes, 2); - - if (NumberUtils.isBigEndian) ByteUtils.swap32(new Uint8Array(binaryBytes.buffer, 2)); - - const bin = new this(binaryBytes, this.SUBTYPE_VECTOR); - validateBinaryVector(bin); - return bin; - } - - /** - * Constructs a Binary representing a packed bit Vector. - * - * Use `fromBits` to pack an array of 1s and 0s. - */ - public static fromPackedBits(array: Uint8Array, padding = 0): Binary { - const buffer = ByteUtils.allocate(array.byteLength + 2); - buffer[0] = Binary.VECTOR_TYPE.PackedBit; - buffer[1] = padding; - buffer.set(array, 2); - const bin = new this(buffer, this.SUBTYPE_VECTOR); - validateBinaryVector(bin); - return bin; - } - - /** - * Constructs a Binary representing an Packed Bit Vector. - * @param array - The array of 1s and 0s to pack into the Binary instance - */ - public static fromBits(bits: ArrayLike): Binary { - const byteLength = (bits.length + 7) >>> 3; // ceil(bits.length / 8) - const bytes = new Uint8Array(byteLength + 2); - bytes[0] = Binary.VECTOR_TYPE.PackedBit; - - const remainder = bits.length % 8; - bytes[1] = remainder === 0 ? 0 : 8 - remainder; - - for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) { - const byteOffset = bitOffset >>> 3; // floor(bitOffset / 8) - const bit = bits[bitOffset]; - - if (bit !== 0 && bit !== 1) { - throw new BSONError( - `Invalid bit value at ${bitOffset}: must be 0 or 1, found ${bits[bitOffset]}` - ); - } - - if (bit === 0) continue; - - const shift = 7 - (bitOffset % 8); - bytes[byteOffset + 2] |= bit << shift; - } - - return new this(bytes, Binary.SUBTYPE_VECTOR); - } -} - -export function validateBinaryVector(vector: Binary): void { - if (vector.sub_type !== Binary.SUBTYPE_VECTOR) return; - - const size = vector.position; - - // NOTE: Validation is only applied to **KNOWN** vector types - // If a new datatype is introduced, a future version of the library will need to add validation - const datatype = vector.buffer[0]; - - // NOTE: We do not enable noUncheckedIndexedAccess so TS believes this is always number - // a Binary vector may be empty, in which case the padding is undefined - // this possible value is tolerable for our validation checks - const padding: number | undefined = vector.buffer[1]; - - if ( - (datatype === Binary.VECTOR_TYPE.Float32 || datatype === Binary.VECTOR_TYPE.Int8) && - padding !== 0 - ) { - throw new BSONError('Invalid Vector: padding must be zero for int8 and float32 vectors'); - } - - if (datatype === Binary.VECTOR_TYPE.Float32) { - if (size !== 0 && size - 2 !== 0 && (size - 2) % 4 !== 0) { - throw new BSONError('Invalid Vector: Float32 vector must contain a multiple of 4 bytes'); - } - } - - if (datatype === Binary.VECTOR_TYPE.PackedBit && padding !== 0 && size === 2) { - throw new BSONError( - 'Invalid Vector: padding must be zero for packed bit vectors that are empty' - ); - } - - if (datatype === Binary.VECTOR_TYPE.PackedBit && padding > 7) { - throw new BSONError( - `Invalid Vector: padding must be a value between 0 and 7. found: ${padding}` - ); - } -} - -/** @public */ -export type UUIDExtended = { - $uuid: string; -}; - -const UUID_BYTE_LENGTH = 16; -const UUID_WITHOUT_DASHES = /^[0-9A-F]{32}$/i; -const UUID_WITH_DASHES = /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i; - -/** - * A class representation of the BSON UUID type. - * @public - */ -export class UUID extends Binary { - /** - * Create a UUID type - * - * When the argument to the constructor is omitted a random v4 UUID will be generated. - * - * @param input - Can be a 32 or 36 character hex string (dashes excluded/included) or a 16 byte binary Buffer. - */ - constructor(input?: string | Uint8Array | UUID) { - let bytes: Uint8Array; - if (input == null) { - bytes = UUID.generate(); - } else if (input instanceof UUID) { - bytes = ByteUtils.toLocalBufferType(new Uint8Array(input.buffer)); - } else if (ArrayBuffer.isView(input) && input.byteLength === UUID_BYTE_LENGTH) { - bytes = ByteUtils.toLocalBufferType(input); - } else if (typeof input === 'string') { - bytes = UUID.bytesFromString(input); - } else { - throw new BSONError( - 'Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).' - ); - } - super(bytes, BSON_BINARY_SUBTYPE_UUID_NEW); - } - - /** - * The UUID bytes - * @readonly - */ - get id(): Uint8Array { - return this.buffer; - } - - set id(value: Uint8Array) { - this.buffer = value; - } - - /** - * Returns the UUID id as a 32 or 36 character hex string representation, excluding/including dashes (defaults to 36 character dash separated) - * @param includeDashes - should the string exclude dash-separators. - */ - toHexString(includeDashes = true): string { - if (includeDashes) { - return [ - ByteUtils.toHex(this.buffer.subarray(0, 4)), - ByteUtils.toHex(this.buffer.subarray(4, 6)), - ByteUtils.toHex(this.buffer.subarray(6, 8)), - ByteUtils.toHex(this.buffer.subarray(8, 10)), - ByteUtils.toHex(this.buffer.subarray(10, 16)) - ].join('-'); - } - return ByteUtils.toHex(this.buffer); - } - - /** - * Converts the id into a 36 character (dashes included) hex string, unless a encoding is specified. - */ - toString(encoding?: 'hex' | 'base64'): string { - if (encoding === 'hex') return ByteUtils.toHex(this.id); - if (encoding === 'base64') return ByteUtils.toBase64(this.id); - return this.toHexString(); - } - - /** - * Converts the id into its JSON string representation. - * A 36 character (dashes included) hex string in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - */ - toJSON(): string { - return this.toHexString(); - } - - /** - * Compares the equality of this UUID with `otherID`. - * - * @param otherId - UUID instance to compare against. - */ - equals(otherId: string | Uint8Array | UUID): boolean { - if (!otherId) { - return false; - } - - if (otherId instanceof UUID) { - return ByteUtils.equals(otherId.id, this.id); - } - - try { - return ByteUtils.equals(new UUID(otherId).id, this.id); - } catch { - return false; - } - } - - /** - * Creates a Binary instance from the current UUID. - */ - toBinary(): Binary { - return new Binary(this.id, Binary.SUBTYPE_UUID); - } - - /** - * Generates a populated buffer containing a v4 uuid - */ - static generate(): Uint8Array { - const bytes = ByteUtils.randomBytes(UUID_BYTE_LENGTH); - - // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - // Kindly borrowed from https://github.com/uuidjs/uuid/blob/master/src/v4.js - bytes[6] = (bytes[6] & 0x0f) | 0x40; - bytes[8] = (bytes[8] & 0x3f) | 0x80; - - return bytes; - } - - /** - * Checks if a value is a valid bson UUID - * @param input - UUID, string or Buffer to validate. - */ - static isValid(input: string | Uint8Array | UUID | Binary): boolean { - if (!input) { - return false; - } - - if (typeof input === 'string') { - return UUID.isValidUUIDString(input); - } - - if (isUint8Array(input)) { - return input.byteLength === UUID_BYTE_LENGTH; - } - - return ( - input._bsontype === 'Binary' && - input.sub_type === this.SUBTYPE_UUID && - input.buffer.byteLength === 16 - ); - } - - /** - * Creates an UUID from a hex string representation of an UUID. - * @param hexString - 32 or 36 character hex string (dashes excluded/included). - */ - static override createFromHexString(hexString: string): UUID { - const buffer = UUID.bytesFromString(hexString); - return new UUID(buffer); - } - - /** Creates an UUID from a base64 string representation of an UUID. */ - static override createFromBase64(base64: string): UUID { - return new UUID(ByteUtils.fromBase64(base64)); - } - - /** @internal */ - static bytesFromString(representation: string) { - if (!UUID.isValidUUIDString(representation)) { - throw new BSONError( - 'UUID string representation must be 32 hex digits or canonical hyphenated representation' - ); - } - return ByteUtils.fromHex(representation.replace(/-/g, '')); - } - - /** - * @internal - * - * Validates a string to be a hex digit sequence with or without dashes. - * The canonical hyphenated representation of a uuid is hex in 8-4-4-4-12 groups. - */ - static isValidUUIDString(representation: string) { - return UUID_WITHOUT_DASHES.test(representation) || UUID_WITH_DASHES.test(representation); - } - - /** - * Converts to a string representation of this Id. - * - * @returns return the 36 character hex string representation. - * - */ - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string { - inspect ??= defaultInspect; - return `new UUID(${inspect(this.toHexString(), options)})`; - } -} diff --git a/server/node_modules/bson/src/bson.ts b/server/node_modules/bson/src/bson.ts deleted file mode 100644 index 0dc8346e..00000000 --- a/server/node_modules/bson/src/bson.ts +++ /dev/null @@ -1,248 +0,0 @@ -import { Binary, UUID } from './binary'; -import { Code } from './code'; -import { DBRef } from './db_ref'; -import { Decimal128 } from './decimal128'; -import { Double } from './double'; -import { Int32 } from './int_32'; -import { Long } from './long'; -import { MaxKey } from './max_key'; -import { MinKey } from './min_key'; -import { ObjectId } from './objectid'; -import { internalCalculateObjectSize } from './parser/calculate_size'; -// Parts of the parser -import { internalDeserialize, type DeserializeOptions } from './parser/deserializer'; -import { serializeInto, type SerializeOptions } from './parser/serializer'; -import { BSONRegExp } from './regexp'; -import { BSONSymbol } from './symbol'; -import { Timestamp } from './timestamp'; -import { ByteUtils } from './utils/byte_utils'; -import { NumberUtils } from './utils/number_utils'; -export type { UUIDExtended, BinaryExtended, BinaryExtendedLegacy, BinarySequence } from './binary'; -export type { CodeExtended } from './code'; -export type { DBRefLike } from './db_ref'; -export type { Decimal128Extended } from './decimal128'; -export type { DoubleExtended } from './double'; -export type { EJSONOptions } from './extended_json'; -export type { Int32Extended } from './int_32'; -export type { LongExtended } from './long'; -export type { MaxKeyExtended } from './max_key'; -export type { MinKeyExtended } from './min_key'; -export type { ObjectIdExtended, ObjectIdLike } from './objectid'; -export type { BSONRegExpExtended, BSONRegExpExtendedLegacy } from './regexp'; -export type { BSONSymbolExtended } from './symbol'; -export type { LongWithoutOverrides, TimestampExtended, TimestampOverrides } from './timestamp'; -export type { LongWithoutOverridesClass } from './timestamp'; -export type { SerializeOptions, DeserializeOptions }; - -export { - Code, - BSONSymbol, - DBRef, - Binary, - ObjectId, - UUID, - Long, - Timestamp, - Double, - Int32, - MinKey, - MaxKey, - BSONRegExp, - Decimal128 -}; -export { BSONValue } from './bson_value'; -export { BSONError, BSONVersionError, BSONRuntimeError, BSONOffsetError } from './error'; -export { BSONType } from './constants'; -export { EJSON } from './extended_json'; -export { onDemand, type OnDemand } from './parser/on_demand/index'; - -/** @public */ -export interface Document { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - [key: string]: any; -} - -/** @internal */ -// Default Max Size -const MAXSIZE = 1024 * 1024 * 17; - -// Current Internal Temporary Serialization Buffer -let buffer = ByteUtils.allocate(MAXSIZE); - -/** - * Sets the size of the internal serialization buffer. - * - * @param size - The desired size for the internal serialization buffer in bytes - * @public - */ -export function setInternalBufferSize(size: number): void { - // Resize the internal serialization buffer if needed - if (buffer.length < size) { - buffer = ByteUtils.allocate(size); - } -} - -/** - * Serialize a Javascript object. - * - * @param object - the Javascript object to serialize. - * @returns Buffer object containing the serialized object. - * @public - */ -export function serialize(object: Document, options: SerializeOptions = {}): Uint8Array { - // Unpack the options - const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false; - const serializeFunctions = - typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false; - const ignoreUndefined = - typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true; - const minInternalBufferSize = - typeof options.minInternalBufferSize === 'number' ? options.minInternalBufferSize : MAXSIZE; - - // Resize the internal serialization buffer if needed - if (buffer.length < minInternalBufferSize) { - buffer = ByteUtils.allocate(minInternalBufferSize); - } - - // Attempt to serialize - const serializationIndex = serializeInto( - buffer, - object, - checkKeys, - 0, - 0, - serializeFunctions, - ignoreUndefined, - null - ); - - // Create the final buffer - const finishedBuffer = ByteUtils.allocateUnsafe(serializationIndex); - - // Copy into the finished buffer - finishedBuffer.set(buffer.subarray(0, serializationIndex), 0); - - // Return the buffer - return finishedBuffer; -} - -/** - * Serialize a Javascript object using a predefined Buffer and index into the buffer, - * useful when pre-allocating the space for serialization. - * - * @param object - the Javascript object to serialize. - * @param finalBuffer - the Buffer you pre-allocated to store the serialized BSON object. - * @returns the index pointing to the last written byte in the buffer. - * @public - */ -export function serializeWithBufferAndIndex( - object: Document, - finalBuffer: Uint8Array, - options: SerializeOptions = {} -): number { - // Unpack the options - const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false; - const serializeFunctions = - typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false; - const ignoreUndefined = - typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true; - const startIndex = typeof options.index === 'number' ? options.index : 0; - - // Attempt to serialize - const serializationIndex = serializeInto( - buffer, - object, - checkKeys, - 0, - 0, - serializeFunctions, - ignoreUndefined, - null - ); - - finalBuffer.set(buffer.subarray(0, serializationIndex), startIndex); - - // Return the index - return startIndex + serializationIndex - 1; -} - -/** - * Deserialize data as BSON. - * - * @param buffer - the buffer containing the serialized set of BSON documents. - * @returns returns the deserialized Javascript Object. - * @public - */ -export function deserialize(buffer: Uint8Array, options: DeserializeOptions = {}): Document { - return internalDeserialize(ByteUtils.toLocalBufferType(buffer), options); -} - -/** @public */ -export type CalculateObjectSizeOptions = Pick< - SerializeOptions, - 'serializeFunctions' | 'ignoreUndefined' ->; - -/** - * Calculate the bson size for a passed in Javascript object. - * - * @param object - the Javascript object to calculate the BSON byte size for - * @returns size of BSON object in bytes - * @public - */ -export function calculateObjectSize( - object: Document, - options: CalculateObjectSizeOptions = {} -): number { - options = options || {}; - - const serializeFunctions = - typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false; - const ignoreUndefined = - typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true; - - return internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined); -} - -/** - * Deserialize stream data as BSON documents. - * - * @param data - the buffer containing the serialized set of BSON documents. - * @param startIndex - the start index in the data Buffer where the deserialization is to start. - * @param numberOfDocuments - number of documents to deserialize. - * @param documents - an array where to store the deserialized documents. - * @param docStartIndex - the index in the documents array from where to start inserting documents. - * @param options - additional options used for the deserialization. - * @returns next index in the buffer after deserialization **x** numbers of documents. - * @public - */ -export function deserializeStream( - data: Uint8Array | ArrayBuffer, - startIndex: number, - numberOfDocuments: number, - documents: Document[], - docStartIndex: number, - options: DeserializeOptions -): number { - const internalOptions = Object.assign( - { allowObjectSmallerThanBufferSize: true, index: 0 }, - options - ); - const bufferData = ByteUtils.toLocalBufferType(data); - - let index = startIndex; - // Loop over all documents - for (let i = 0; i < numberOfDocuments; i++) { - // Find size of the document - const size = NumberUtils.getInt32LE(bufferData, index); - // Update options with index - internalOptions.index = index; - // Parse the document at this point - documents[docStartIndex + i] = internalDeserialize(bufferData, internalOptions); - // Adjust index by the document size - index = index + size; - } - - // Return object containing end index of parsing and list of documents - return index; -} diff --git a/server/node_modules/bson/src/bson_value.ts b/server/node_modules/bson/src/bson_value.ts deleted file mode 100644 index 10d50141..00000000 --- a/server/node_modules/bson/src/bson_value.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { BSON_MAJOR_VERSION } from './constants'; -import { type InspectFn } from './parser/utils'; -import { BSON_VERSION_SYMBOL } from './constants'; - -/** @public */ -export abstract class BSONValue { - /** @public */ - public abstract get _bsontype(): string; - - /** @internal */ - get [BSON_VERSION_SYMBOL](): typeof BSON_MAJOR_VERSION { - return BSON_MAJOR_VERSION; - } - - [Symbol.for('nodejs.util.inspect.custom')]( - depth?: number, - options?: unknown, - inspect?: InspectFn - ): string { - return this.inspect(depth, options, inspect); - } - - /** - * @public - * Prints a human-readable string of BSON value information - * If invoked manually without node.js.inspect function, this will default to a modified JSON.stringify - */ - public abstract inspect(depth?: number, options?: unknown, inspect?: InspectFn): string; - - /** @internal */ - abstract toExtendedJSON(): unknown; -} diff --git a/server/node_modules/bson/src/code.ts b/server/node_modules/bson/src/code.ts deleted file mode 100644 index 98b1ede9..00000000 --- a/server/node_modules/bson/src/code.ts +++ /dev/null @@ -1,69 +0,0 @@ -import type { Document } from './bson'; -import { BSONValue } from './bson_value'; -import { type InspectFn, defaultInspect } from './parser/utils'; - -/** @public */ -export interface CodeExtended { - $code: string; - $scope?: Document; -} - -/** - * A class representation of the BSON Code type. - * @public - * @category BSONType - */ -export class Code extends BSONValue { - get _bsontype(): 'Code' { - return 'Code'; - } - - code: string; - - // a code instance having a null scope is what determines whether - // it is BSONType 0x0D (just code) / 0x0F (code with scope) - scope: Document | null; - - /** - * @param code - a string or function. - * @param scope - an optional scope for the function. - */ - constructor(code: string | Function, scope?: Document | null) { - super(); - this.code = code.toString(); - this.scope = scope ?? null; - } - - toJSON(): { code: string; scope?: Document } { - if (this.scope != null) { - return { code: this.code, scope: this.scope }; - } - - return { code: this.code }; - } - - /** @internal */ - toExtendedJSON(): CodeExtended { - if (this.scope) { - return { $code: this.code, $scope: this.scope }; - } - - return { $code: this.code }; - } - - /** @internal */ - static fromExtendedJSON(doc: CodeExtended): Code { - return new Code(doc.$code, doc.$scope); - } - - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string { - inspect ??= defaultInspect; - let parametersString = inspect(this.code, options); - const multiLineFn = parametersString.includes('\n'); - if (this.scope != null) { - parametersString += `,${multiLineFn ? '\n' : ' '}${inspect(this.scope, options)}`; - } - const endingNewline = multiLineFn && this.scope === null; - return `new Code(${multiLineFn ? '\n' : ''}${parametersString}${endingNewline ? '\n' : ''})`; - } -} diff --git a/server/node_modules/bson/src/constants.ts b/server/node_modules/bson/src/constants.ts deleted file mode 100644 index c399fda3..00000000 --- a/server/node_modules/bson/src/constants.ts +++ /dev/null @@ -1,147 +0,0 @@ -/** @internal */ -export const BSON_MAJOR_VERSION = 6; - -/** @internal */ -export const BSON_VERSION_SYMBOL = Symbol.for('@@mdb.bson.version'); - -/** @internal */ -export const BSON_INT32_MAX = 0x7fffffff; -/** @internal */ -export const BSON_INT32_MIN = -0x80000000; -/** @internal */ -export const BSON_INT64_MAX = Math.pow(2, 63) - 1; -/** @internal */ -export const BSON_INT64_MIN = -Math.pow(2, 63); - -/** - * Any integer up to 2^53 can be precisely represented by a double. - * @internal - */ -export const JS_INT_MAX = Math.pow(2, 53); - -/** - * Any integer down to -2^53 can be precisely represented by a double. - * @internal - */ -export const JS_INT_MIN = -Math.pow(2, 53); - -/** Number BSON Type @internal */ -export const BSON_DATA_NUMBER = 1; - -/** String BSON Type @internal */ -export const BSON_DATA_STRING = 2; - -/** Object BSON Type @internal */ -export const BSON_DATA_OBJECT = 3; - -/** Array BSON Type @internal */ -export const BSON_DATA_ARRAY = 4; - -/** Binary BSON Type @internal */ -export const BSON_DATA_BINARY = 5; - -/** Binary BSON Type @internal */ -export const BSON_DATA_UNDEFINED = 6; - -/** ObjectId BSON Type @internal */ -export const BSON_DATA_OID = 7; - -/** Boolean BSON Type @internal */ -export const BSON_DATA_BOOLEAN = 8; - -/** Date BSON Type @internal */ -export const BSON_DATA_DATE = 9; - -/** null BSON Type @internal */ -export const BSON_DATA_NULL = 10; - -/** RegExp BSON Type @internal */ -export const BSON_DATA_REGEXP = 11; - -/** Code BSON Type @internal */ -export const BSON_DATA_DBPOINTER = 12; - -/** Code BSON Type @internal */ -export const BSON_DATA_CODE = 13; - -/** Symbol BSON Type @internal */ -export const BSON_DATA_SYMBOL = 14; - -/** Code with Scope BSON Type @internal */ -export const BSON_DATA_CODE_W_SCOPE = 15; - -/** 32 bit Integer BSON Type @internal */ -export const BSON_DATA_INT = 16; - -/** Timestamp BSON Type @internal */ -export const BSON_DATA_TIMESTAMP = 17; - -/** Long BSON Type @internal */ -export const BSON_DATA_LONG = 18; - -/** Decimal128 BSON Type @internal */ -export const BSON_DATA_DECIMAL128 = 19; - -/** MinKey BSON Type @internal */ -export const BSON_DATA_MIN_KEY = 0xff; - -/** MaxKey BSON Type @internal */ -export const BSON_DATA_MAX_KEY = 0x7f; - -/** Binary Default Type @internal */ -export const BSON_BINARY_SUBTYPE_DEFAULT = 0; - -/** Binary Function Type @internal */ -export const BSON_BINARY_SUBTYPE_FUNCTION = 1; - -/** Binary Byte Array Type @internal */ -export const BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; - -/** Binary Deprecated UUID Type @deprecated Please use BSON_BINARY_SUBTYPE_UUID_NEW @internal */ -export const BSON_BINARY_SUBTYPE_UUID = 3; - -/** Binary UUID Type @internal */ -export const BSON_BINARY_SUBTYPE_UUID_NEW = 4; - -/** Binary MD5 Type @internal */ -export const BSON_BINARY_SUBTYPE_MD5 = 5; - -/** Encrypted BSON type @internal */ -export const BSON_BINARY_SUBTYPE_ENCRYPTED = 6; - -/** Column BSON type @internal */ -export const BSON_BINARY_SUBTYPE_COLUMN = 7; - -/** Sensitive BSON type @internal */ -export const BSON_BINARY_SUBTYPE_SENSITIVE = 8; - -/** Binary User Defined Type @internal */ -export const BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -/** @public */ -export const BSONType = Object.freeze({ - double: 1, - string: 2, - object: 3, - array: 4, - binData: 5, - undefined: 6, - objectId: 7, - bool: 8, - date: 9, - null: 10, - regex: 11, - dbPointer: 12, - javascript: 13, - symbol: 14, - javascriptWithScope: 15, - int: 16, - timestamp: 17, - long: 18, - decimal: 19, - minKey: -1, - maxKey: 127 -} as const); - -/** @public */ -export type BSONType = (typeof BSONType)[keyof typeof BSONType]; diff --git a/server/node_modules/bson/src/db_ref.ts b/server/node_modules/bson/src/db_ref.ts deleted file mode 100644 index fbb751f8..00000000 --- a/server/node_modules/bson/src/db_ref.ts +++ /dev/null @@ -1,128 +0,0 @@ -import type { Document } from './bson'; -import { BSONValue } from './bson_value'; -import type { EJSONOptions } from './extended_json'; -import type { ObjectId } from './objectid'; -import { type InspectFn, defaultInspect } from './parser/utils'; - -/** @public */ -export interface DBRefLike { - $ref: string; - $id: ObjectId; - $db?: string; -} - -/** @internal */ -export function isDBRefLike(value: unknown): value is DBRefLike { - return ( - value != null && - typeof value === 'object' && - '$id' in value && - value.$id != null && - '$ref' in value && - typeof value.$ref === 'string' && - // If '$db' is defined it MUST be a string, otherwise it should be absent - (!('$db' in value) || ('$db' in value && typeof value.$db === 'string')) - ); -} - -/** - * A class representation of the BSON DBRef type. - * @public - * @category BSONType - */ -export class DBRef extends BSONValue { - get _bsontype(): 'DBRef' { - return 'DBRef'; - } - - collection!: string; - oid!: ObjectId; - db?: string; - fields!: Document; - - /** - * @param collection - the collection name. - * @param oid - the reference ObjectId. - * @param db - optional db name, if omitted the reference is local to the current db. - */ - constructor(collection: string, oid: ObjectId, db?: string, fields?: Document) { - super(); - // check if namespace has been provided - const parts = collection.split('.'); - if (parts.length === 2) { - db = parts.shift(); - collection = parts.shift()!; - } - - this.collection = collection; - this.oid = oid; - this.db = db; - this.fields = fields || {}; - } - - // Property provided for compatibility with the 1.x parser - // the 1.x parser used a "namespace" property, while 4.x uses "collection" - - /** @internal */ - get namespace(): string { - return this.collection; - } - - set namespace(value: string) { - this.collection = value; - } - - toJSON(): DBRefLike & Document { - const o = Object.assign( - { - $ref: this.collection, - $id: this.oid - }, - this.fields - ); - - if (this.db != null) o.$db = this.db; - return o; - } - - /** @internal */ - toExtendedJSON(options?: EJSONOptions): DBRefLike { - options = options || {}; - let o: DBRefLike = { - $ref: this.collection, - $id: this.oid - }; - - if (options.legacy) { - return o; - } - - if (this.db) o.$db = this.db; - o = Object.assign(o, this.fields); - return o; - } - - /** @internal */ - static fromExtendedJSON(doc: DBRefLike): DBRef { - const copy = Object.assign({}, doc) as Partial; - delete copy.$ref; - delete copy.$id; - delete copy.$db; - return new DBRef(doc.$ref, doc.$id, doc.$db, copy); - } - - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string { - inspect ??= defaultInspect; - - const args = [ - inspect(this.namespace, options), - inspect(this.oid, options), - ...(this.db ? [inspect(this.db, options)] : []), - ...(Object.keys(this.fields).length > 0 ? [inspect(this.fields, options)] : []) - ]; - - args[1] = inspect === defaultInspect ? `new ObjectId(${args[1]})` : args[1]; - - return `new DBRef(${args.join(', ')})`; - } -} diff --git a/server/node_modules/bson/src/decimal128.ts b/server/node_modules/bson/src/decimal128.ts deleted file mode 100644 index 8f491b3c..00000000 --- a/server/node_modules/bson/src/decimal128.ts +++ /dev/null @@ -1,855 +0,0 @@ -import { BSONValue } from './bson_value'; -import { BSONError } from './error'; -import { Long } from './long'; -import { type InspectFn, defaultInspect, isUint8Array } from './parser/utils'; -import { ByteUtils } from './utils/byte_utils'; - -const PARSE_STRING_REGEXP = /^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/; -const PARSE_INF_REGEXP = /^(\+|-)?(Infinity|inf)$/i; -const PARSE_NAN_REGEXP = /^(\+|-)?NaN$/i; - -const EXPONENT_MAX = 6111; -const EXPONENT_MIN = -6176; -const EXPONENT_BIAS = 6176; -const MAX_DIGITS = 34; - -// Nan value bits as 32 bit values (due to lack of longs) -const NAN_BUFFER = ByteUtils.fromNumberArray( - [ - 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - ].reverse() -); -// Infinity value bits 32 bit values (due to lack of longs) -const INF_NEGATIVE_BUFFER = ByteUtils.fromNumberArray( - [ - 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - ].reverse() -); -const INF_POSITIVE_BUFFER = ByteUtils.fromNumberArray( - [ - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - ].reverse() -); - -const EXPONENT_REGEX = /^([-+])?(\d+)?$/; - -// Extract least significant 5 bits -const COMBINATION_MASK = 0x1f; -// Extract least significant 14 bits -const EXPONENT_MASK = 0x3fff; -// Value of combination field for Inf -const COMBINATION_INFINITY = 30; -// Value of combination field for NaN -const COMBINATION_NAN = 31; - -// Detect if the value is a digit -function isDigit(value: string): boolean { - return !isNaN(parseInt(value, 10)); -} - -// Divide two uint128 values -function divideu128(value: { parts: [number, number, number, number] }) { - const DIVISOR = Long.fromNumber(1000 * 1000 * 1000); - let _rem = Long.fromNumber(0); - - if (!value.parts[0] && !value.parts[1] && !value.parts[2] && !value.parts[3]) { - return { quotient: value, rem: _rem }; - } - - for (let i = 0; i <= 3; i++) { - // Adjust remainder to match value of next dividend - _rem = _rem.shiftLeft(32); - // Add the divided to _rem - _rem = _rem.add(new Long(value.parts[i], 0)); - value.parts[i] = _rem.div(DIVISOR).low; - _rem = _rem.modulo(DIVISOR); - } - - return { quotient: value, rem: _rem }; -} - -// Multiply two Long values and return the 128 bit value -function multiply64x2(left: Long, right: Long): { high: Long; low: Long } { - if (!left && !right) { - return { high: Long.fromNumber(0), low: Long.fromNumber(0) }; - } - - const leftHigh = left.shiftRightUnsigned(32); - const leftLow = new Long(left.getLowBits(), 0); - const rightHigh = right.shiftRightUnsigned(32); - const rightLow = new Long(right.getLowBits(), 0); - - let productHigh = leftHigh.multiply(rightHigh); - let productMid = leftHigh.multiply(rightLow); - const productMid2 = leftLow.multiply(rightHigh); - let productLow = leftLow.multiply(rightLow); - - productHigh = productHigh.add(productMid.shiftRightUnsigned(32)); - productMid = new Long(productMid.getLowBits(), 0) - .add(productMid2) - .add(productLow.shiftRightUnsigned(32)); - - productHigh = productHigh.add(productMid.shiftRightUnsigned(32)); - productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0)); - - // Return the 128 bit result - return { high: productHigh, low: productLow }; -} - -function lessThan(left: Long, right: Long): boolean { - // Make values unsigned - const uhleft = left.high >>> 0; - const uhright = right.high >>> 0; - - // Compare high bits first - if (uhleft < uhright) { - return true; - } else if (uhleft === uhright) { - const ulleft = left.low >>> 0; - const ulright = right.low >>> 0; - if (ulleft < ulright) return true; - } - - return false; -} - -function invalidErr(string: string, message: string) { - throw new BSONError(`"${string}" is not a valid Decimal128 string - ${message}`); -} - -/** @public */ -export interface Decimal128Extended { - $numberDecimal: string; -} - -/** - * A class representation of the BSON Decimal128 type. - * @public - * @category BSONType - */ -export class Decimal128 extends BSONValue { - get _bsontype(): 'Decimal128' { - return 'Decimal128'; - } - - readonly bytes!: Uint8Array; - - /** - * @param bytes - a buffer containing the raw Decimal128 bytes in little endian order, - * or a string representation as returned by .toString() - */ - constructor(bytes: Uint8Array | string) { - super(); - if (typeof bytes === 'string') { - this.bytes = Decimal128.fromString(bytes).bytes; - } else if (bytes instanceof Uint8Array || isUint8Array(bytes)) { - if (bytes.byteLength !== 16) { - throw new BSONError('Decimal128 must take a Buffer of 16 bytes'); - } - this.bytes = bytes; - } else { - throw new BSONError('Decimal128 must take a Buffer or string'); - } - } - - /** - * Create a Decimal128 instance from a string representation - * - * @param representation - a numeric string representation. - */ - static fromString(representation: string): Decimal128 { - return Decimal128._fromString(representation, { allowRounding: false }); - } - - /** - * Create a Decimal128 instance from a string representation, allowing for rounding to 34 - * significant digits - * - * @example Example of a number that will be rounded - * ```ts - * > let d = Decimal128.fromString('37.499999999999999196428571428571375') - * Uncaught: - * BSONError: "37.499999999999999196428571428571375" is not a valid Decimal128 string - inexact rounding - * at invalidErr (/home/wajames/js-bson/lib/bson.cjs:1402:11) - * at Decimal128.fromStringInternal (/home/wajames/js-bson/lib/bson.cjs:1633:25) - * at Decimal128.fromString (/home/wajames/js-bson/lib/bson.cjs:1424:27) - * - * > d = Decimal128.fromStringWithRounding('37.499999999999999196428571428571375') - * new Decimal128("37.49999999999999919642857142857138") - * ``` - * @param representation - a numeric string representation. - */ - static fromStringWithRounding(representation: string): Decimal128 { - return Decimal128._fromString(representation, { allowRounding: true }); - } - - private static _fromString(representation: string, options: { allowRounding: boolean }) { - // Parse state tracking - let isNegative = false; - let sawSign = false; - let sawRadix = false; - let foundNonZero = false; - - // Total number of significant digits (no leading or trailing zero) - let significantDigits = 0; - // Total number of significand digits read - let nDigitsRead = 0; - // Total number of digits (no leading zeros) - let nDigits = 0; - // The number of the digits after radix - let radixPosition = 0; - // The index of the first non-zero in *str* - let firstNonZero = 0; - - // Digits Array - const digits = [0]; - // The number of digits in digits - let nDigitsStored = 0; - // Insertion pointer for digits - let digitsInsert = 0; - // The index of the last digit - let lastDigit = 0; - - // Exponent - let exponent = 0; - // The high 17 digits of the significand - let significandHigh = new Long(0, 0); - // The low 17 digits of the significand - let significandLow = new Long(0, 0); - // The biased exponent - let biasedExponent = 0; - - // Read index - let index = 0; - - // Naively prevent against REDOS attacks. - // TODO: implementing a custom parsing for this, or refactoring the regex would yield - // further gains. - if (representation.length >= 7000) { - throw new BSONError('' + representation + ' not a valid Decimal128 string'); - } - - // Results - const stringMatch = representation.match(PARSE_STRING_REGEXP); - const infMatch = representation.match(PARSE_INF_REGEXP); - const nanMatch = representation.match(PARSE_NAN_REGEXP); - - // Validate the string - if ((!stringMatch && !infMatch && !nanMatch) || representation.length === 0) { - throw new BSONError('' + representation + ' not a valid Decimal128 string'); - } - - if (stringMatch) { - // full_match = stringMatch[0] - // sign = stringMatch[1] - - const unsignedNumber = stringMatch[2]; - // stringMatch[3] is undefined if a whole number (ex "1", 12") - // but defined if a number w/ decimal in it (ex "1.0, 12.2") - - const e = stringMatch[4]; - const expSign = stringMatch[5]; - const expNumber = stringMatch[6]; - - // they provided e, but didn't give an exponent number. for ex "1e" - if (e && expNumber === undefined) invalidErr(representation, 'missing exponent power'); - - // they provided e, but didn't give a number before it. for ex "e1" - if (e && unsignedNumber === undefined) invalidErr(representation, 'missing exponent base'); - - if (e === undefined && (expSign || expNumber)) { - invalidErr(representation, 'missing e before exponent'); - } - } - - // Get the negative or positive sign - if (representation[index] === '+' || representation[index] === '-') { - sawSign = true; - isNegative = representation[index++] === '-'; - } - - // Check if user passed Infinity or NaN - if (!isDigit(representation[index]) && representation[index] !== '.') { - if (representation[index] === 'i' || representation[index] === 'I') { - return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER); - } else if (representation[index] === 'N') { - return new Decimal128(NAN_BUFFER); - } - } - - // Read all the digits - while (isDigit(representation[index]) || representation[index] === '.') { - if (representation[index] === '.') { - if (sawRadix) invalidErr(representation, 'contains multiple periods'); - - sawRadix = true; - index = index + 1; - continue; - } - - if (nDigitsStored < MAX_DIGITS) { - if (representation[index] !== '0' || foundNonZero) { - if (!foundNonZero) { - firstNonZero = nDigitsRead; - } - - foundNonZero = true; - - // Only store 34 digits - digits[digitsInsert++] = parseInt(representation[index], 10); - nDigitsStored = nDigitsStored + 1; - } - } - - if (foundNonZero) nDigits = nDigits + 1; - if (sawRadix) radixPosition = radixPosition + 1; - - nDigitsRead = nDigitsRead + 1; - index = index + 1; - } - - if (sawRadix && !nDigitsRead) - throw new BSONError('' + representation + ' not a valid Decimal128 string'); - - // Read exponent if exists - if (representation[index] === 'e' || representation[index] === 'E') { - // Read exponent digits - const match = representation.substr(++index).match(EXPONENT_REGEX); - - // No digits read - if (!match || !match[2]) return new Decimal128(NAN_BUFFER); - - // Get exponent - exponent = parseInt(match[0], 10); - - // Adjust the index - index = index + match[0].length; - } - - // Return not a number - if (representation[index]) return new Decimal128(NAN_BUFFER); - - // Done reading input - // Find first non-zero digit in digits - if (!nDigitsStored) { - digits[0] = 0; - nDigits = 1; - nDigitsStored = 1; - significantDigits = 0; - } else { - lastDigit = nDigitsStored - 1; - significantDigits = nDigits; - if (significantDigits !== 1) { - while ( - representation[ - firstNonZero + significantDigits - 1 + Number(sawSign) + Number(sawRadix) - ] === '0' - ) { - significantDigits = significantDigits - 1; - } - } - } - - // Normalization of exponent - // Correct exponent based on radix position, and shift significand as needed - // to represent user input - - // Overflow prevention - if (exponent <= radixPosition && radixPosition > exponent + (1 << 14)) { - exponent = EXPONENT_MIN; - } else { - exponent = exponent - radixPosition; - } - - // Attempt to normalize the exponent - while (exponent > EXPONENT_MAX) { - // Shift exponent to significand and decrease - lastDigit = lastDigit + 1; - if (lastDigit >= MAX_DIGITS) { - // Check if we have a zero then just hard clamp, otherwise fail - if (significantDigits === 0) { - exponent = EXPONENT_MAX; - break; - } - - invalidErr(representation, 'overflow'); - } - exponent = exponent - 1; - } - - if (options.allowRounding) { - while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) { - // Shift last digit. can only do this if < significant digits than # stored. - if (lastDigit === 0 && significantDigits < nDigitsStored) { - exponent = EXPONENT_MIN; - significantDigits = 0; - break; - } - - if (nDigitsStored < nDigits) { - // adjust to match digits not stored - nDigits = nDigits - 1; - } else { - // adjust to round - lastDigit = lastDigit - 1; - } - - if (exponent < EXPONENT_MAX) { - exponent = exponent + 1; - } else { - // Check if we have a zero then just hard clamp, otherwise fail - const digitsString = digits.join(''); - if (digitsString.match(/^0+$/)) { - exponent = EXPONENT_MAX; - break; - } - invalidErr(representation, 'overflow'); - } - } - - // Round - // We've normalized the exponent, but might still need to round. - if (lastDigit + 1 < significantDigits) { - let endOfString = nDigitsRead; - - // If we have seen a radix point, 'string' is 1 longer than we have - // documented with ndigits_read, so inc the position of the first nonzero - // digit and the position that digits are read to. - if (sawRadix) { - firstNonZero = firstNonZero + 1; - endOfString = endOfString + 1; - } - // if negative, we need to increment again to account for - sign at start. - if (sawSign) { - firstNonZero = firstNonZero + 1; - endOfString = endOfString + 1; - } - - const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10); - let roundBit = 0; - - if (roundDigit >= 5) { - roundBit = 1; - if (roundDigit === 5) { - roundBit = digits[lastDigit] % 2 === 1 ? 1 : 0; - for (let i = firstNonZero + lastDigit + 2; i < endOfString; i++) { - if (parseInt(representation[i], 10)) { - roundBit = 1; - break; - } - } - } - } - - if (roundBit) { - let dIdx = lastDigit; - - for (; dIdx >= 0; dIdx--) { - if (++digits[dIdx] > 9) { - digits[dIdx] = 0; - - // overflowed most significant digit - if (dIdx === 0) { - if (exponent < EXPONENT_MAX) { - exponent = exponent + 1; - digits[dIdx] = 1; - } else { - return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER); - } - } - } else { - break; - } - } - } - } - } else { - while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) { - // Shift last digit. can only do this if < significant digits than # stored. - if (lastDigit === 0) { - if (significantDigits === 0) { - exponent = EXPONENT_MIN; - break; - } - - invalidErr(representation, 'exponent underflow'); - } - - if (nDigitsStored < nDigits) { - if ( - representation[nDigits - 1 + Number(sawSign) + Number(sawRadix)] !== '0' && - significantDigits !== 0 - ) { - invalidErr(representation, 'inexact rounding'); - } - // adjust to match digits not stored - nDigits = nDigits - 1; - } else { - if (digits[lastDigit] !== 0) { - invalidErr(representation, 'inexact rounding'); - } - // adjust to round - lastDigit = lastDigit - 1; - } - - if (exponent < EXPONENT_MAX) { - exponent = exponent + 1; - } else { - invalidErr(representation, 'overflow'); - } - } - - // Round - // We've normalized the exponent, but might still need to round. - if (lastDigit + 1 < significantDigits) { - // If we have seen a radix point, 'string' is 1 longer than we have - // documented with ndigits_read, so inc the position of the first nonzero - // digit and the position that digits are read to. - if (sawRadix) { - firstNonZero = firstNonZero + 1; - } - // if saw sign, we need to increment again to account for - or + sign at start. - if (sawSign) { - firstNonZero = firstNonZero + 1; - } - - const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10); - - if (roundDigit !== 0) { - invalidErr(representation, 'inexact rounding'); - } - } - } - - // Encode significand - // The high 17 digits of the significand - significandHigh = Long.fromNumber(0); - // The low 17 digits of the significand - significandLow = Long.fromNumber(0); - - // read a zero - if (significantDigits === 0) { - significandHigh = Long.fromNumber(0); - significandLow = Long.fromNumber(0); - } else if (lastDigit < 17) { - let dIdx = 0; - significandLow = Long.fromNumber(digits[dIdx++]); - significandHigh = new Long(0, 0); - - for (; dIdx <= lastDigit; dIdx++) { - significandLow = significandLow.multiply(Long.fromNumber(10)); - significandLow = significandLow.add(Long.fromNumber(digits[dIdx])); - } - } else { - let dIdx = 0; - significandHigh = Long.fromNumber(digits[dIdx++]); - - for (; dIdx <= lastDigit - 17; dIdx++) { - significandHigh = significandHigh.multiply(Long.fromNumber(10)); - significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx])); - } - - significandLow = Long.fromNumber(digits[dIdx++]); - - for (; dIdx <= lastDigit; dIdx++) { - significandLow = significandLow.multiply(Long.fromNumber(10)); - significandLow = significandLow.add(Long.fromNumber(digits[dIdx])); - } - } - - const significand = multiply64x2(significandHigh, Long.fromString('100000000000000000')); - significand.low = significand.low.add(significandLow); - - if (lessThan(significand.low, significandLow)) { - significand.high = significand.high.add(Long.fromNumber(1)); - } - - // Biased exponent - biasedExponent = exponent + EXPONENT_BIAS; - const dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) }; - - // Encode combination, exponent, and significand. - if ( - significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber(1)) - ) { - // Encode '11' into bits 1 to 3 - dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61)); - dec.high = dec.high.or( - Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)) - ); - dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff))); - } else { - dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49)); - dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff))); - } - - dec.low = significand.low; - - // Encode sign - if (isNegative) { - dec.high = dec.high.or(Long.fromString('9223372036854775808')); - } - - // Encode into a buffer - const buffer = ByteUtils.allocateUnsafe(16); - index = 0; - - // Encode the low 64 bits of the decimal - // Encode low bits - buffer[index++] = dec.low.low & 0xff; - buffer[index++] = (dec.low.low >> 8) & 0xff; - buffer[index++] = (dec.low.low >> 16) & 0xff; - buffer[index++] = (dec.low.low >> 24) & 0xff; - // Encode high bits - buffer[index++] = dec.low.high & 0xff; - buffer[index++] = (dec.low.high >> 8) & 0xff; - buffer[index++] = (dec.low.high >> 16) & 0xff; - buffer[index++] = (dec.low.high >> 24) & 0xff; - - // Encode the high 64 bits of the decimal - // Encode low bits - buffer[index++] = dec.high.low & 0xff; - buffer[index++] = (dec.high.low >> 8) & 0xff; - buffer[index++] = (dec.high.low >> 16) & 0xff; - buffer[index++] = (dec.high.low >> 24) & 0xff; - // Encode high bits - buffer[index++] = dec.high.high & 0xff; - buffer[index++] = (dec.high.high >> 8) & 0xff; - buffer[index++] = (dec.high.high >> 16) & 0xff; - buffer[index++] = (dec.high.high >> 24) & 0xff; - - // Return the new Decimal128 - return new Decimal128(buffer); - } - /** Create a string representation of the raw Decimal128 value */ - toString(): string { - // Note: bits in this routine are referred to starting at 0, - // from the sign bit, towards the coefficient. - - // decoded biased exponent (14 bits) - let biased_exponent; - // the number of significand digits - let significand_digits = 0; - // the base-10 digits in the significand - const significand = new Array(36); - for (let i = 0; i < significand.length; i++) significand[i] = 0; - // read pointer into significand - let index = 0; - - // true if the number is zero - let is_zero = false; - - // the most significant significand bits (50-46) - let significand_msb; - // temporary storage for significand decoding - let significand128: { parts: [number, number, number, number] } = { parts: [0, 0, 0, 0] }; - // indexing variables - let j, k; - - // Output string - const string: string[] = []; - - // Unpack index - index = 0; - - // Buffer reference - const buffer = this.bytes; - - // Unpack the low 64bits into a long - // bits 96 - 127 - const low = - buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24); - // bits 64 - 95 - const midl = - buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24); - - // Unpack the high 64bits into a long - // bits 32 - 63 - const midh = - buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24); - // bits 0 - 31 - const high = - buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24); - - // Unpack index - index = 0; - - // Create the state of the decimal - const dec = { - low: new Long(low, midl), - high: new Long(midh, high) - }; - - if (dec.high.lessThan(Long.ZERO)) { - string.push('-'); - } - - // Decode combination field and exponent - // bits 1 - 5 - const combination = (high >> 26) & COMBINATION_MASK; - - if (combination >> 3 === 3) { - // Check for 'special' values - if (combination === COMBINATION_INFINITY) { - return string.join('') + 'Infinity'; - } else if (combination === COMBINATION_NAN) { - return 'NaN'; - } else { - biased_exponent = (high >> 15) & EXPONENT_MASK; - significand_msb = 0x08 + ((high >> 14) & 0x01); - } - } else { - significand_msb = (high >> 14) & 0x07; - biased_exponent = (high >> 17) & EXPONENT_MASK; - } - - // unbiased exponent - const exponent = biased_exponent - EXPONENT_BIAS; - - // Create string of significand digits - - // Convert the 114-bit binary number represented by - // (significand_high, significand_low) to at most 34 decimal - // digits through modulo and division. - significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14); - significand128.parts[1] = midh; - significand128.parts[2] = midl; - significand128.parts[3] = low; - - if ( - significand128.parts[0] === 0 && - significand128.parts[1] === 0 && - significand128.parts[2] === 0 && - significand128.parts[3] === 0 - ) { - is_zero = true; - } else { - for (k = 3; k >= 0; k--) { - let least_digits = 0; - // Perform the divide - const result = divideu128(significand128); - significand128 = result.quotient; - least_digits = result.rem.low; - - // We now have the 9 least significant digits (in base 2). - // Convert and output to string. - if (!least_digits) continue; - - for (j = 8; j >= 0; j--) { - // significand[k * 9 + j] = Math.round(least_digits % 10); - significand[k * 9 + j] = least_digits % 10; - // least_digits = Math.round(least_digits / 10); - least_digits = Math.floor(least_digits / 10); - } - } - } - - // Output format options: - // Scientific - [-]d.dddE(+/-)dd or [-]dE(+/-)dd - // Regular - ddd.ddd - - if (is_zero) { - significand_digits = 1; - significand[index] = 0; - } else { - significand_digits = 36; - while (!significand[index]) { - significand_digits = significand_digits - 1; - index = index + 1; - } - } - - // the exponent if scientific notation is used - const scientific_exponent = significand_digits - 1 + exponent; - - // The scientific exponent checks are dictated by the string conversion - // specification and are somewhat arbitrary cutoffs. - // - // We must check exponent > 0, because if this is the case, the number - // has trailing zeros. However, we *cannot* output these trailing zeros, - // because doing so would change the precision of the value, and would - // change stored data if the string converted number is round tripped. - if (scientific_exponent >= 34 || scientific_exponent <= -7 || exponent > 0) { - // Scientific format - - // if there are too many significant digits, we should just be treating numbers - // as + or - 0 and using the non-scientific exponent (this is for the "invalid - // representation should be treated as 0/-0" spec cases in decimal128-1.json) - if (significand_digits > 34) { - string.push(`${0}`); - if (exponent > 0) string.push(`E+${exponent}`); - else if (exponent < 0) string.push(`E${exponent}`); - return string.join(''); - } - - string.push(`${significand[index++]}`); - significand_digits = significand_digits - 1; - - if (significand_digits) { - string.push('.'); - } - - for (let i = 0; i < significand_digits; i++) { - string.push(`${significand[index++]}`); - } - - // Exponent - string.push('E'); - if (scientific_exponent > 0) { - string.push(`+${scientific_exponent}`); - } else { - string.push(`${scientific_exponent}`); - } - } else { - // Regular format with no decimal place - if (exponent >= 0) { - for (let i = 0; i < significand_digits; i++) { - string.push(`${significand[index++]}`); - } - } else { - let radix_position = significand_digits + exponent; - - // non-zero digits before radix - if (radix_position > 0) { - for (let i = 0; i < radix_position; i++) { - string.push(`${significand[index++]}`); - } - } else { - string.push('0'); - } - - string.push('.'); - // add leading zeros after radix - while (radix_position++ < 0) { - string.push('0'); - } - - for (let i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) { - string.push(`${significand[index++]}`); - } - } - } - - return string.join(''); - } - - toJSON(): Decimal128Extended { - return { $numberDecimal: this.toString() }; - } - - /** @internal */ - toExtendedJSON(): Decimal128Extended { - return { $numberDecimal: this.toString() }; - } - - /** @internal */ - static fromExtendedJSON(doc: Decimal128Extended): Decimal128 { - return Decimal128.fromString(doc.$numberDecimal); - } - - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string { - inspect ??= defaultInspect; - const d128string = inspect(this.toString(), options); - return `new Decimal128(${d128string})`; - } -} diff --git a/server/node_modules/bson/src/double.ts b/server/node_modules/bson/src/double.ts deleted file mode 100644 index 4a3d1298..00000000 --- a/server/node_modules/bson/src/double.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { BSONValue } from './bson_value'; -import { BSONError } from './error'; -import type { EJSONOptions } from './extended_json'; -import { type InspectFn, defaultInspect } from './parser/utils'; - -/** @public */ -export interface DoubleExtended { - $numberDouble: string; -} - -/** - * A class representation of the BSON Double type. - * @public - * @category BSONType - */ -export class Double extends BSONValue { - get _bsontype(): 'Double' { - return 'Double'; - } - - value!: number; - /** - * Create a Double type - * - * @param value - the number we want to represent as a double. - */ - constructor(value: number) { - super(); - if ((value as unknown) instanceof Number) { - value = value.valueOf(); - } - - this.value = +value; - } - - /** - * Attempt to create an double type from string. - * - * This method will throw a BSONError on any string input that is not representable as a IEEE-754 64-bit double. - * Notably, this method will also throw on the following string formats: - * - Strings in non-decimal and non-exponential formats (binary, hex, or octal digits) - * - Strings with characters other than numeric, floating point, or leading sign characters (Note: 'Infinity', '-Infinity', and 'NaN' input strings are still allowed) - * - Strings with leading and/or trailing whitespace - * - * Strings with leading zeros, however, are also allowed - * - * @param value - the string we want to represent as a double. - */ - static fromString(value: string): Double { - const coercedValue = Number(value); - - if (value === 'NaN') return new Double(NaN); - if (value === 'Infinity') return new Double(Infinity); - if (value === '-Infinity') return new Double(-Infinity); - - if (!Number.isFinite(coercedValue)) { - throw new BSONError(`Input: ${value} is not representable as a Double`); - } - if (value.trim() !== value) { - throw new BSONError(`Input: '${value}' contains whitespace`); - } - if (value === '') { - throw new BSONError(`Input is an empty string`); - } - if (/[^-0-9.+eE]/.test(value)) { - throw new BSONError(`Input: '${value}' is not in decimal or exponential notation`); - } - return new Double(coercedValue); - } - - /** - * Access the number value. - * - * @returns returns the wrapped double number. - */ - valueOf(): number { - return this.value; - } - - toJSON(): number { - return this.value; - } - - toString(radix?: number): string { - return this.value.toString(radix); - } - - /** @internal */ - toExtendedJSON(options?: EJSONOptions): number | DoubleExtended { - if (options && (options.legacy || (options.relaxed && isFinite(this.value)))) { - return this.value; - } - - if (Object.is(Math.sign(this.value), -0)) { - // NOTE: JavaScript has +0 and -0, apparently to model limit calculations. If a user - // explicitly provided `-0` then we need to ensure the sign makes it into the output - return { $numberDouble: '-0.0' }; - } - - return { - $numberDouble: Number.isInteger(this.value) ? this.value.toFixed(1) : this.value.toString() - }; - } - - /** @internal */ - static fromExtendedJSON(doc: DoubleExtended, options?: EJSONOptions): number | Double { - const doubleValue = parseFloat(doc.$numberDouble); - return options && options.relaxed ? doubleValue : new Double(doubleValue); - } - - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string { - inspect ??= defaultInspect; - return `new Double(${inspect(this.value, options)})`; - } -} diff --git a/server/node_modules/bson/src/error.ts b/server/node_modules/bson/src/error.ts deleted file mode 100644 index ef5184a4..00000000 --- a/server/node_modules/bson/src/error.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { BSON_MAJOR_VERSION } from './constants'; - -/** - * @public - * @category Error - * - * `BSONError` objects are thrown when BSON encounters an error. - * - * This is the parent class for all the other errors thrown by this library. - */ -export class BSONError extends Error { - /** - * @internal - * The underlying algorithm for isBSONError may change to improve how strict it is - * about determining if an input is a BSONError. But it must remain backwards compatible - * with previous minors & patches of the current major version. - */ - protected get bsonError(): true { - return true; - } - - override get name(): string { - return 'BSONError'; - } - - constructor(message: string, options?: { cause?: unknown }) { - super(message, options); - } - - /** - * @public - * - * All errors thrown from the BSON library inherit from `BSONError`. - * This method can assist with determining if an error originates from the BSON library - * even if it does not pass an `instanceof` check against this class' constructor. - * - * @param value - any javascript value that needs type checking - */ - public static isBSONError(value: unknown): value is BSONError { - return ( - value != null && - typeof value === 'object' && - 'bsonError' in value && - value.bsonError === true && - // Do not access the following properties, just check existence - 'name' in value && - 'message' in value && - 'stack' in value - ); - } -} - -/** - * @public - * @category Error - */ -export class BSONVersionError extends BSONError { - get name(): 'BSONVersionError' { - return 'BSONVersionError'; - } - - constructor() { - super(`Unsupported BSON version, bson types must be from bson ${BSON_MAJOR_VERSION}.x.x`); - } -} - -/** - * @public - * @category Error - * - * An error generated when BSON functions encounter an unexpected input - * or reaches an unexpected/invalid internal state - * - */ -export class BSONRuntimeError extends BSONError { - get name(): 'BSONRuntimeError' { - return 'BSONRuntimeError'; - } - - constructor(message: string) { - super(message); - } -} - -/** - * @public - * @category Error - * - * @experimental - * - * An error generated when BSON bytes are invalid. - * Reports the offset the parser was able to reach before encountering the error. - */ -export class BSONOffsetError extends BSONError { - public get name(): 'BSONOffsetError' { - return 'BSONOffsetError'; - } - - public offset: number; - - constructor(message: string, offset: number, options?: { cause?: unknown }) { - super(`${message}. offset: ${offset}`, options); - this.offset = offset; - } -} diff --git a/server/node_modules/bson/src/extended_json.ts b/server/node_modules/bson/src/extended_json.ts deleted file mode 100644 index 7727ce93..00000000 --- a/server/node_modules/bson/src/extended_json.ts +++ /dev/null @@ -1,516 +0,0 @@ -import { Binary } from './binary'; -import type { Document } from './bson'; -import { Code } from './code'; -import { - BSON_INT32_MAX, - BSON_INT32_MIN, - BSON_INT64_MAX, - BSON_INT64_MIN, - BSON_MAJOR_VERSION, - BSON_VERSION_SYMBOL -} from './constants'; -import { DBRef, isDBRefLike } from './db_ref'; -import { Decimal128 } from './decimal128'; -import { Double } from './double'; -import { BSONError, BSONRuntimeError, BSONVersionError } from './error'; -import { Int32 } from './int_32'; -import { Long } from './long'; -import { MaxKey } from './max_key'; -import { MinKey } from './min_key'; -import { ObjectId } from './objectid'; -import { isDate, isRegExp, isMap } from './parser/utils'; -import { BSONRegExp } from './regexp'; -import { BSONSymbol } from './symbol'; -import { Timestamp } from './timestamp'; - -/** @public */ -export type EJSONOptions = { - /** - * Output using the Extended JSON v1 spec - * @defaultValue `false` - */ - legacy?: boolean; - /** - * Enable Extended JSON's `relaxed` mode, which attempts to return native JS types where possible, rather than BSON types - * @defaultValue `false` */ - relaxed?: boolean; - /** - * Enable native bigint support - * @defaultValue `false` - */ - useBigInt64?: boolean; -}; - -/** @internal */ -type BSONType = - | Binary - | Code - | DBRef - | Decimal128 - | Double - | Int32 - | Long - | MaxKey - | MinKey - | ObjectId - | BSONRegExp - | BSONSymbol - | Timestamp; - -function isBSONType(value: unknown): value is BSONType { - return ( - value != null && - typeof value === 'object' && - '_bsontype' in value && - typeof value._bsontype === 'string' - ); -} - -// all the types where we don't need to do any special processing and can just pass the EJSON -//straight to type.fromExtendedJSON -const keysToCodecs = { - $oid: ObjectId, - $binary: Binary, - $uuid: Binary, - $symbol: BSONSymbol, - $numberInt: Int32, - $numberDecimal: Decimal128, - $numberDouble: Double, - $numberLong: Long, - $minKey: MinKey, - $maxKey: MaxKey, - $regex: BSONRegExp, - $regularExpression: BSONRegExp, - $timestamp: Timestamp -} as const; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function deserializeValue(value: any, options: EJSONOptions = {}) { - if (typeof value === 'number') { - // TODO(NODE-4377): EJSON js number handling diverges from BSON - const in32BitRange = value <= BSON_INT32_MAX && value >= BSON_INT32_MIN; - const in64BitRange = value <= BSON_INT64_MAX && value >= BSON_INT64_MIN; - - if (options.relaxed || options.legacy) { - return value; - } - - if (Number.isInteger(value) && !Object.is(value, -0)) { - // interpret as being of the smallest BSON integer type that can represent the number exactly - if (in32BitRange) { - return new Int32(value); - } - if (in64BitRange) { - if (options.useBigInt64) { - // eslint-disable-next-line no-restricted-globals -- This is allowed here as useBigInt64=true - return BigInt(value); - } - return Long.fromNumber(value); - } - } - - // If the number is a non-integer or out of integer range, should interpret as BSON Double. - return new Double(value); - } - - // from here on out we're looking for bson types, so bail if its not an object - if (value == null || typeof value !== 'object') return value; - - // upgrade deprecated undefined to null - if (value.$undefined) return null; - - const keys = Object.keys(value).filter( - k => k.startsWith('$') && value[k] != null - ) as (keyof typeof keysToCodecs)[]; - for (let i = 0; i < keys.length; i++) { - const c = keysToCodecs[keys[i]]; - if (c) return c.fromExtendedJSON(value, options); - } - - if (value.$date != null) { - const d = value.$date; - const date = new Date(); - - if (options.legacy) { - if (typeof d === 'number') date.setTime(d); - else if (typeof d === 'string') date.setTime(Date.parse(d)); - else if (typeof d === 'bigint') date.setTime(Number(d)); - else throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`); - } else { - if (typeof d === 'string') date.setTime(Date.parse(d)); - else if (Long.isLong(d)) date.setTime(d.toNumber()); - else if (typeof d === 'number' && options.relaxed) date.setTime(d); - else if (typeof d === 'bigint') date.setTime(Number(d)); - else throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`); - } - return date; - } - - if (value.$code != null) { - const copy = Object.assign({}, value); - if (value.$scope) { - copy.$scope = deserializeValue(value.$scope); - } - - return Code.fromExtendedJSON(value); - } - - if (isDBRefLike(value) || value.$dbPointer) { - const v = value.$ref ? value : value.$dbPointer; - - // we run into this in a "degenerate EJSON" case (with $id and $ref order flipped) - // because of the order JSON.parse goes through the document - if (v instanceof DBRef) return v; - - const dollarKeys = Object.keys(v).filter(k => k.startsWith('$')); - let valid = true; - dollarKeys.forEach(k => { - if (['$ref', '$id', '$db'].indexOf(k) === -1) valid = false; - }); - - // only make DBRef if $ keys are all valid - if (valid) return DBRef.fromExtendedJSON(v); - } - - return value; -} - -type EJSONSerializeOptions = EJSONOptions & { - seenObjects: { obj: unknown; propertyName: string }[]; -}; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function serializeArray(array: any[], options: EJSONSerializeOptions): any[] { - return array.map((v: unknown, index: number) => { - options.seenObjects.push({ propertyName: `index ${index}`, obj: null }); - try { - return serializeValue(v, options); - } finally { - options.seenObjects.pop(); - } - }); -} - -function getISOString(date: Date) { - const isoStr = date.toISOString(); - // we should only show milliseconds in timestamp if they're non-zero - return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z'; -} - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function serializeValue(value: any, options: EJSONSerializeOptions): any { - if (value instanceof Map || isMap(value)) { - const obj: Record = Object.create(null); - for (const [k, v] of value) { - if (typeof k !== 'string') { - throw new BSONError('Can only serialize maps with string keys'); - } - obj[k] = v; - } - - return serializeValue(obj, options); - } - - if ((typeof value === 'object' || typeof value === 'function') && value !== null) { - const index = options.seenObjects.findIndex(entry => entry.obj === value); - if (index !== -1) { - const props = options.seenObjects.map(entry => entry.propertyName); - const leadingPart = props - .slice(0, index) - .map(prop => `${prop} -> `) - .join(''); - const alreadySeen = props[index]; - const circularPart = - ' -> ' + - props - .slice(index + 1, props.length - 1) - .map(prop => `${prop} -> `) - .join(''); - const current = props[props.length - 1]; - const leadingSpace = ' '.repeat(leadingPart.length + alreadySeen.length / 2); - const dashes = '-'.repeat( - circularPart.length + (alreadySeen.length + current.length) / 2 - 1 - ); - - throw new BSONError( - 'Converting circular structure to EJSON:\n' + - ` ${leadingPart}${alreadySeen}${circularPart}${current}\n` + - ` ${leadingSpace}\\${dashes}/` - ); - } - options.seenObjects[options.seenObjects.length - 1].obj = value; - } - - if (Array.isArray(value)) return serializeArray(value, options); - - if (value === undefined) return null; - - if (value instanceof Date || isDate(value)) { - const dateNum = value.getTime(), - // is it in year range 1970-9999? - inRange = dateNum > -1 && dateNum < 253402318800000; - - if (options.legacy) { - return options.relaxed && inRange - ? { $date: value.getTime() } - : { $date: getISOString(value) }; - } - return options.relaxed && inRange - ? { $date: getISOString(value) } - : { $date: { $numberLong: value.getTime().toString() } }; - } - - if (typeof value === 'number' && (!options.relaxed || !isFinite(value))) { - if (Number.isInteger(value) && !Object.is(value, -0)) { - // interpret as being of the smallest BSON integer type that can represent the number exactly - if (value >= BSON_INT32_MIN && value <= BSON_INT32_MAX) { - return { $numberInt: value.toString() }; - } - if (value >= BSON_INT64_MIN && value <= BSON_INT64_MAX) { - // TODO(NODE-4377): EJSON js number handling diverges from BSON - return { $numberLong: value.toString() }; - } - } - return { $numberDouble: Object.is(value, -0) ? '-0.0' : value.toString() }; - } - - if (typeof value === 'bigint') { - /* eslint-disable no-restricted-globals -- This is allowed as we are accepting a bigint as input */ - if (!options.relaxed) { - return { $numberLong: BigInt.asIntN(64, value).toString() }; - } - return Number(BigInt.asIntN(64, value)); - /* eslint-enable */ - } - - if (value instanceof RegExp || isRegExp(value)) { - let flags = value.flags; - if (flags === undefined) { - const match = value.toString().match(/[gimuy]*$/); - if (match) { - flags = match[0]; - } - } - - const rx = new BSONRegExp(value.source, flags); - return rx.toExtendedJSON(options); - } - - if (value != null && typeof value === 'object') return serializeDocument(value, options); - return value; -} - -const BSON_TYPE_MAPPINGS = { - Binary: (o: Binary) => new Binary(o.value(), o.sub_type), - Code: (o: Code) => new Code(o.code, o.scope), - DBRef: (o: DBRef) => new DBRef(o.collection || o.namespace, o.oid, o.db, o.fields), // "namespace" for 1.x library backwards compat - Decimal128: (o: Decimal128) => new Decimal128(o.bytes), - Double: (o: Double) => new Double(o.value), - Int32: (o: Int32) => new Int32(o.value), - Long: ( - o: Long & { - low_: number; - high_: number; - unsigned_: boolean | undefined; - } - ) => - Long.fromBits( - // underscore variants for 1.x backwards compatibility - o.low != null ? o.low : o.low_, - o.low != null ? o.high : o.high_, - o.low != null ? o.unsigned : o.unsigned_ - ), - MaxKey: () => new MaxKey(), - MinKey: () => new MinKey(), - ObjectId: (o: ObjectId) => new ObjectId(o), - BSONRegExp: (o: BSONRegExp) => new BSONRegExp(o.pattern, o.options), - BSONSymbol: (o: BSONSymbol) => new BSONSymbol(o.value), - Timestamp: (o: Timestamp) => Timestamp.fromBits(o.low, o.high) -} as const; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function serializeDocument(doc: any, options: EJSONSerializeOptions) { - if (doc == null || typeof doc !== 'object') throw new BSONError('not an object instance'); - - const bsontype: BSONType['_bsontype'] = doc._bsontype; - if (typeof bsontype === 'undefined') { - // It's a regular object. Recursively serialize its property values. - const _doc: Document = {}; - for (const name of Object.keys(doc)) { - options.seenObjects.push({ propertyName: name, obj: null }); - try { - const value = serializeValue(doc[name], options); - if (name === '__proto__') { - Object.defineProperty(_doc, name, { - value, - writable: true, - enumerable: true, - configurable: true - }); - } else { - _doc[name] = value; - } - } finally { - options.seenObjects.pop(); - } - } - return _doc; - } else if ( - doc != null && - typeof doc === 'object' && - typeof doc._bsontype === 'string' && - doc[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION - ) { - throw new BSONVersionError(); - } else if (isBSONType(doc)) { - // the "document" is really just a BSON type object - // eslint-disable-next-line @typescript-eslint/no-explicit-any - let outDoc: any = doc; - if (typeof outDoc.toExtendedJSON !== 'function') { - // There's no EJSON serialization function on the object. It's probably an - // object created by a previous version of this library (or another library) - // that's duck-typing objects to look like they were generated by this library). - // Copy the object into this library's version of that type. - const mapper = BSON_TYPE_MAPPINGS[doc._bsontype]; - if (!mapper) { - throw new BSONError('Unrecognized or invalid _bsontype: ' + doc._bsontype); - } - outDoc = mapper(outDoc); - } - - // Two BSON types may have nested objects that may need to be serialized too - if (bsontype === 'Code' && outDoc.scope) { - outDoc = new Code(outDoc.code, serializeValue(outDoc.scope, options)); - } else if (bsontype === 'DBRef' && outDoc.oid) { - outDoc = new DBRef( - serializeValue(outDoc.collection, options), - serializeValue(outDoc.oid, options), - serializeValue(outDoc.db, options), - serializeValue(outDoc.fields, options) - ); - } - - return outDoc.toExtendedJSON(options); - } else { - throw new BSONError('_bsontype must be a string, but was: ' + typeof bsontype); - } -} - -/** - * Parse an Extended JSON string, constructing the JavaScript value or object described by that - * string. - * - * @example - * ```js - * const { EJSON } = require('bson'); - * const text = '{ "int32": { "$numberInt": "10" } }'; - * - * // prints { int32: { [String: '10'] _bsontype: 'Int32', value: '10' } } - * console.log(EJSON.parse(text, { relaxed: false })); - * - * // prints { int32: 10 } - * console.log(EJSON.parse(text)); - * ``` - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function parse(text: string, options?: EJSONOptions): any { - const ejsonOptions = { - useBigInt64: options?.useBigInt64 ?? false, - relaxed: options?.relaxed ?? true, - legacy: options?.legacy ?? false - }; - return JSON.parse(text, (key, value) => { - if (key.indexOf('\x00') !== -1) { - throw new BSONError( - `BSON Document field names cannot contain null bytes, found: ${JSON.stringify(key)}` - ); - } - return deserializeValue(value, ejsonOptions); - }); -} - -/** - * Converts a BSON document to an Extended JSON string, optionally replacing values if a replacer - * function is specified or optionally including only the specified properties if a replacer array - * is specified. - * - * @param value - The value to convert to extended JSON - * @param replacer - A function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string - * @param space - A String or Number object that's used to insert white space into the output JSON string for readability purposes. - * @param options - Optional settings - * - * @example - * ```js - * const { EJSON } = require('bson'); - * const Int32 = require('mongodb').Int32; - * const doc = { int32: new Int32(10) }; - * - * // prints '{"int32":{"$numberInt":"10"}}' - * console.log(EJSON.stringify(doc, { relaxed: false })); - * - * // prints '{"int32":10}' - * console.log(EJSON.stringify(doc)); - * ``` - */ -function stringify( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - value: any, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - replacer?: (number | string)[] | ((this: any, key: string, value: any) => any) | EJSONOptions, - space?: string | number, - options?: EJSONOptions -): string { - if (space != null && typeof space === 'object') { - options = space; - space = 0; - } - if (replacer != null && typeof replacer === 'object' && !Array.isArray(replacer)) { - options = replacer; - replacer = undefined; - space = 0; - } - const serializeOptions = Object.assign({ relaxed: true, legacy: false }, options, { - seenObjects: [{ propertyName: '(root)', obj: null }] - }); - - const doc = serializeValue(value, serializeOptions); - return JSON.stringify(doc, replacer as Parameters[1], space); -} - -/** - * Serializes an object to an Extended JSON string, and reparse it as a JavaScript object. - * - * @param value - The object to serialize - * @param options - Optional settings passed to the `stringify` function - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function EJSONserialize(value: any, options?: EJSONOptions): Document { - options = options || {}; - return JSON.parse(stringify(value, options)); -} - -/** - * Deserializes an Extended JSON object into a plain JavaScript object with native/BSON types - * - * @param ejson - The Extended JSON object to deserialize - * @param options - Optional settings passed to the parse method - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function EJSONdeserialize(ejson: Document, options?: EJSONOptions): any { - options = options || {}; - return parse(JSON.stringify(ejson), options); -} - -/** @public */ -const EJSON: { - parse: typeof parse; - stringify: typeof stringify; - serialize: typeof EJSONserialize; - deserialize: typeof EJSONdeserialize; -} = Object.create(null); -EJSON.parse = parse; -EJSON.stringify = stringify; -EJSON.serialize = EJSONserialize; -EJSON.deserialize = EJSONdeserialize; -Object.freeze(EJSON); -export { EJSON }; diff --git a/server/node_modules/bson/src/index.ts b/server/node_modules/bson/src/index.ts deleted file mode 100644 index 5ef41575..00000000 --- a/server/node_modules/bson/src/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -import * as BSON from './bson'; - -// Export all named properties from BSON to support -// import { ObjectId, serialize } from 'bson'; -// const { ObjectId, serialize } = require('bson'); -export * from './bson'; - -// Export BSON as a namespace to support: -// import { BSON } from 'bson'; -// const { BSON } = require('bson'); -export { BSON }; - -// BSON does **NOT** have a default export - -// The following will crash in es module environments -// import BSON from 'bson'; - -// The following will work as expected, BSON as a namespace of all the APIs (BSON.ObjectId, BSON.serialize) -// const BSON = require('bson'); diff --git a/server/node_modules/bson/src/int_32.ts b/server/node_modules/bson/src/int_32.ts deleted file mode 100644 index 7c95027c..00000000 --- a/server/node_modules/bson/src/int_32.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { BSONValue } from './bson_value'; -import { BSON_INT32_MAX, BSON_INT32_MIN } from './constants'; -import { BSONError } from './error'; -import type { EJSONOptions } from './extended_json'; -import { type InspectFn, defaultInspect } from './parser/utils'; -import { removeLeadingZerosAndExplicitPlus } from './utils/string_utils'; - -/** @public */ -export interface Int32Extended { - $numberInt: string; -} - -/** - * A class representation of a BSON Int32 type. - * @public - * @category BSONType - */ -export class Int32 extends BSONValue { - get _bsontype(): 'Int32' { - return 'Int32'; - } - - value!: number; - /** - * Create an Int32 type - * - * @param value - the number we want to represent as an int32. - */ - constructor(value: number | string) { - super(); - if ((value as unknown) instanceof Number) { - value = value.valueOf(); - } - - this.value = +value | 0; - } - - /** - * Attempt to create an Int32 type from string. - * - * This method will throw a BSONError on any string input that is not representable as an Int32. - * Notably, this method will also throw on the following string formats: - * - Strings in non-decimal formats (exponent notation, binary, hex, or octal digits) - * - Strings non-numeric and non-leading sign characters (ex: '2.0', '24,000') - * - Strings with leading and/or trailing whitespace - * - * Strings with leading zeros, however, are allowed. - * - * @param value - the string we want to represent as an int32. - */ - static fromString(value: string): Int32 { - const cleanedValue = removeLeadingZerosAndExplicitPlus(value); - - const coercedValue = Number(value); - - if (BSON_INT32_MAX < coercedValue) { - throw new BSONError(`Input: '${value}' is larger than the maximum value for Int32`); - } else if (BSON_INT32_MIN > coercedValue) { - throw new BSONError(`Input: '${value}' is smaller than the minimum value for Int32`); - } else if (!Number.isSafeInteger(coercedValue)) { - throw new BSONError(`Input: '${value}' is not a safe integer`); - } else if (coercedValue.toString() !== cleanedValue) { - // catch all case - throw new BSONError(`Input: '${value}' is not a valid Int32 string`); - } - return new Int32(coercedValue); - } - - /** - * Access the number value. - * - * @returns returns the wrapped int32 number. - */ - valueOf(): number { - return this.value; - } - - toString(radix?: number): string { - return this.value.toString(radix); - } - - toJSON(): number { - return this.value; - } - - /** @internal */ - toExtendedJSON(options?: EJSONOptions): number | Int32Extended { - if (options && (options.relaxed || options.legacy)) return this.value; - return { $numberInt: this.value.toString() }; - } - - /** @internal */ - static fromExtendedJSON(doc: Int32Extended, options?: EJSONOptions): number | Int32 { - return options && options.relaxed ? parseInt(doc.$numberInt, 10) : new Int32(doc.$numberInt); - } - - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string { - inspect ??= defaultInspect; - return `new Int32(${inspect(this.value, options)})`; - } -} diff --git a/server/node_modules/bson/src/long.ts b/server/node_modules/bson/src/long.ts deleted file mode 100644 index f12eb26f..00000000 --- a/server/node_modules/bson/src/long.ts +++ /dev/null @@ -1,1245 +0,0 @@ -import { BSONValue } from './bson_value'; -import { BSONError } from './error'; -import type { EJSONOptions } from './extended_json'; -import { type InspectFn, defaultInspect } from './parser/utils'; -import type { Timestamp } from './timestamp'; -import * as StringUtils from './utils/string_utils'; - -interface LongWASMHelpers { - /** Gets the high bits of the last operation performed */ - get_high(this: void): number; - div_u( - this: void, - lowBits: number, - highBits: number, - lowBitsDivisor: number, - highBitsDivisor: number - ): number; - div_s( - this: void, - lowBits: number, - highBits: number, - lowBitsDivisor: number, - highBitsDivisor: number - ): number; - rem_u( - this: void, - lowBits: number, - highBits: number, - lowBitsDivisor: number, - highBitsDivisor: number - ): number; - rem_s( - this: void, - lowBits: number, - highBits: number, - lowBitsDivisor: number, - highBitsDivisor: number - ): number; - mul( - this: void, - lowBits: number, - highBits: number, - lowBitsMultiplier: number, - highBitsMultiplier: number - ): number; -} - -/** - * wasm optimizations, to do native i64 multiplication and divide - */ -let wasm: LongWASMHelpers | undefined = undefined; - -/* We do not want to have to include DOM types just for this check */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -declare const WebAssembly: any; - -try { - wasm = new WebAssembly.Instance( - new WebAssembly.Module( - // prettier-ignore - new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11]) - ), - {} - ).exports as unknown as LongWASMHelpers; -} catch { - // no wasm support -} - -const TWO_PWR_16_DBL = 1 << 16; -const TWO_PWR_24_DBL = 1 << 24; -const TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL; -const TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL; -const TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2; - -/** A cache of the Long representations of small integer values. */ -const INT_CACHE: { [key: number]: Long } = {}; - -/** A cache of the Long representations of small unsigned integer values. */ -const UINT_CACHE: { [key: number]: Long } = {}; - -const MAX_INT64_STRING_LENGTH = 20; - -const DECIMAL_REG_EX = /^(\+?0|(\+|-)?[1-9][0-9]*)$/; - -/** @public */ -export interface LongExtended { - $numberLong: string; -} - -/** - * A class representing a 64-bit integer - * @public - * @category BSONType - * @remarks - * The internal representation of a long is the two given signed, 32-bit values. - * We use 32-bit pieces because these are the size of integers on which - * Javascript performs bit-operations. For operations like addition and - * multiplication, we split each number into 16 bit pieces, which can easily be - * multiplied within Javascript's floating-point representation without overflow - * or change in sign. - * In the algorithms below, we frequently reduce the negative case to the - * positive case by negating the input(s) and then post-processing the result. - * Note that we must ALWAYS check specially whether those values are MIN_VALUE - * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as - * a positive number, it overflows back into a negative). Not handling this - * case would often result in infinite recursion. - * Common constant values ZERO, ONE, NEG_ONE, etc. are found as static properties on this class. - */ -export class Long extends BSONValue { - get _bsontype(): 'Long' { - return 'Long'; - } - - /** An indicator used to reliably determine if an object is a Long or not. */ - get __isLong__(): boolean { - return true; - } - - /** - * The high 32 bits as a signed value. - */ - high: number; - - /** - * The low 32 bits as a signed value. - */ - low: number; - - /** - * Whether unsigned or not. - */ - unsigned: boolean; - - /** - * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers. - * - * @param low - The low (signed) 32 bits of the long - * @param high - The high (signed) 32 bits of the long - * @param unsigned - Whether unsigned or not, defaults to signed - */ - constructor(low: number, high?: number, unsigned?: boolean); - /** - * Constructs a 64 bit two's-complement integer, given a bigint representation. - * - * @param value - BigInt representation of the long value - * @param unsigned - Whether unsigned or not, defaults to signed - */ - constructor(value: bigint, unsigned?: boolean); - /** - * Constructs a 64 bit two's-complement integer, given a string representation. - * - * @param value - String representation of the long value - * @param unsigned - Whether unsigned or not, defaults to signed - */ - constructor(value: string, unsigned?: boolean); - constructor( - lowOrValue: number | bigint | string = 0, - highOrUnsigned?: number | boolean, - unsigned?: boolean - ) { - super(); - const unsignedBool = typeof highOrUnsigned === 'boolean' ? highOrUnsigned : Boolean(unsigned); - const high = typeof highOrUnsigned === 'number' ? highOrUnsigned : 0; - const res = - typeof lowOrValue === 'string' - ? Long.fromString(lowOrValue, unsignedBool) - : typeof lowOrValue === 'bigint' - ? Long.fromBigInt(lowOrValue, unsignedBool) - : { low: lowOrValue | 0, high: high | 0, unsigned: unsignedBool }; - this.low = res.low; - this.high = res.high; - this.unsigned = res.unsigned; - } - - static TWO_PWR_24 = Long.fromInt(TWO_PWR_24_DBL); - - /** Maximum unsigned value. */ - static MAX_UNSIGNED_VALUE = Long.fromBits(0xffffffff | 0, 0xffffffff | 0, true); - /** Signed zero */ - static ZERO = Long.fromInt(0); - /** Unsigned zero. */ - static UZERO = Long.fromInt(0, true); - /** Signed one. */ - static ONE = Long.fromInt(1); - /** Unsigned one. */ - static UONE = Long.fromInt(1, true); - /** Signed negative one. */ - static NEG_ONE = Long.fromInt(-1); - /** Maximum signed value. */ - static MAX_VALUE = Long.fromBits(0xffffffff | 0, 0x7fffffff | 0, false); - /** Minimum signed value. */ - static MIN_VALUE = Long.fromBits(0, 0x80000000 | 0, false); - - /** - * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. - * Each is assumed to use 32 bits. - * @param lowBits - The low 32 bits - * @param highBits - The high 32 bits - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long { - return new Long(lowBits, highBits, unsigned); - } - - /** - * Returns a Long representing the given 32 bit integer value. - * @param value - The 32 bit integer in question - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromInt(value: number, unsigned?: boolean): Long { - let obj, cachedObj, cache; - if (unsigned) { - value >>>= 0; - if ((cache = 0 <= value && value < 256)) { - cachedObj = UINT_CACHE[value]; - if (cachedObj) return cachedObj; - } - obj = Long.fromBits(value, (value | 0) < 0 ? -1 : 0, true); - if (cache) UINT_CACHE[value] = obj; - return obj; - } else { - value |= 0; - if ((cache = -128 <= value && value < 128)) { - cachedObj = INT_CACHE[value]; - if (cachedObj) return cachedObj; - } - obj = Long.fromBits(value, value < 0 ? -1 : 0, false); - if (cache) INT_CACHE[value] = obj; - return obj; - } - } - - /** - * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. - * @param value - The number in question - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromNumber(value: number, unsigned?: boolean): Long { - if (isNaN(value)) return unsigned ? Long.UZERO : Long.ZERO; - if (unsigned) { - if (value < 0) return Long.UZERO; - if (value >= TWO_PWR_64_DBL) return Long.MAX_UNSIGNED_VALUE; - } else { - if (value <= -TWO_PWR_63_DBL) return Long.MIN_VALUE; - if (value + 1 >= TWO_PWR_63_DBL) return Long.MAX_VALUE; - } - if (value < 0) return Long.fromNumber(-value, unsigned).neg(); - return Long.fromBits(value % TWO_PWR_32_DBL | 0, (value / TWO_PWR_32_DBL) | 0, unsigned); - } - - /** - * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. - * @param value - The number in question - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromBigInt(value: bigint, unsigned?: boolean): Long { - // eslint-disable-next-line no-restricted-globals - const FROM_BIGINT_BIT_MASK = BigInt(0xffffffff); - // eslint-disable-next-line no-restricted-globals - const FROM_BIGINT_BIT_SHIFT = BigInt(32); - return new Long( - Number(value & FROM_BIGINT_BIT_MASK), - Number((value >> FROM_BIGINT_BIT_SHIFT) & FROM_BIGINT_BIT_MASK), - unsigned - ); - } - - /** - * @internal - * Returns a Long representation of the given string, written using the specified radix. - * Throws an error if `throwsError` is set to true and any of the following conditions are true: - * - the string contains invalid characters for the given radix - * - the string contains whitespace - * @param str - The textual representation of the Long - * @param unsigned - Whether unsigned or not, defaults to signed - * @param radix - The radix in which the text is written (2-36), defaults to 10 - * @returns The corresponding Long value - */ - private static _fromString(str: string, unsigned: boolean, radix: number): Long { - if (str.length === 0) throw new BSONError('empty string'); - if (radix < 2 || 36 < radix) throw new BSONError('radix'); - - let p; - if ((p = str.indexOf('-')) > 0) throw new BSONError('interior hyphen'); - else if (p === 0) { - return Long._fromString(str.substring(1), unsigned, radix).neg(); - } - - // Do several (8) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - const radixToPower = Long.fromNumber(Math.pow(radix, 8)); - - let result = Long.ZERO; - for (let i = 0; i < str.length; i += 8) { - const size = Math.min(8, str.length - i), - value = parseInt(str.substring(i, i + size), radix); - if (size < 8) { - const power = Long.fromNumber(Math.pow(radix, size)); - result = result.mul(power).add(Long.fromNumber(value)); - } else { - result = result.mul(radixToPower); - result = result.add(Long.fromNumber(value)); - } - } - result.unsigned = unsigned; - return result; - } - - /** - * Returns a signed Long representation of the given string, written using radix 10. - * Will throw an error if the given text is not exactly representable as a Long. - * Throws an error if any of the following conditions are true: - * - the string contains invalid characters for the radix 10 - * - the string contains whitespace - * - the value the string represents is too large or too small to be a Long - * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero - * @param str - The textual representation of the Long - * @returns The corresponding Long value - */ - static fromStringStrict(str: string): Long; - /** - * Returns a Long representation of the given string, written using the radix 10. - * Will throw an error if the given parameters are not exactly representable as a Long. - * Throws an error if any of the following conditions are true: - * - the string contains invalid characters for the given radix - * - the string contains whitespace - * - the value the string represents is too large or too small to be a Long - * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero - * @param str - The textual representation of the Long - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromStringStrict(str: string, unsigned?: boolean): Long; - /** - * Returns a signed Long representation of the given string, written using the specified radix. - * Will throw an error if the given parameters are not exactly representable as a Long. - * Throws an error if any of the following conditions are true: - * - the string contains invalid characters for the given radix - * - the string contains whitespace - * - the value the string represents is too large or too small to be a Long - * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero - * @param str - The textual representation of the Long - * @param radix - The radix in which the text is written (2-36), defaults to 10 - * @returns The corresponding Long value - */ - static fromStringStrict(str: string, radix?: boolean): Long; - /** - * Returns a Long representation of the given string, written using the specified radix. - * Will throw an error if the given parameters are not exactly representable as a Long. - * Throws an error if any of the following conditions are true: - * - the string contains invalid characters for the given radix - * - the string contains whitespace - * - the value the string represents is too large or too small to be a Long - * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero - * @param str - The textual representation of the Long - * @param unsigned - Whether unsigned or not, defaults to signed - * @param radix - The radix in which the text is written (2-36), defaults to 10 - * @returns The corresponding Long value - */ - static fromStringStrict(str: string, unsigned?: boolean, radix?: number): Long; - static fromStringStrict(str: string, unsignedOrRadix?: boolean | number, radix?: number): Long { - let unsigned = false; - if (typeof unsignedOrRadix === 'number') { - // For goog.math.long compatibility - (radix = unsignedOrRadix), (unsignedOrRadix = false); - } else { - unsigned = !!unsignedOrRadix; - } - radix ??= 10; - - if (str.trim() !== str) { - throw new BSONError(`Input: '${str}' contains leading and/or trailing whitespace`); - } - if (!StringUtils.validateStringCharacters(str, radix)) { - throw new BSONError(`Input: '${str}' contains invalid characters for radix: ${radix}`); - } - - // remove leading zeros (for later string comparison and to make math faster) - const cleanedStr = StringUtils.removeLeadingZerosAndExplicitPlus(str); - - // check roundtrip result - const result = Long._fromString(cleanedStr, unsigned, radix); - if (result.toString(radix).toLowerCase() !== cleanedStr.toLowerCase()) { - throw new BSONError( - `Input: ${str} is not representable as ${result.unsigned ? 'an unsigned' : 'a signed'} 64-bit Long ${radix != null ? `with radix: ${radix}` : ''}` - ); - } - return result; - } - - /** - * Returns a signed Long representation of the given string, written using radix 10. - * - * If the input string is empty, this function will throw a BSONError. - * - * If input string does not have valid signed 64-bit Long representation, this method will return a coerced value: - * - inputs that overflow 64-bit signed long will be coerced to Long.MAX_VALUE and Long.MIN_VALUE respectively - * - 'NaN' or '+/-Infinity' are coerced to Long.ZERO - * - other invalid characters sequences have variable behavior - * - * @param str - The textual representation of the Long - * @returns The corresponding Long value - */ - static fromString(str: string): Long; - /** - * Returns a signed Long representation of the given string, written using the provided radix. - * - * If the input string is empty or a provided radix is not within (2-36), this function will throw a BSONError. - * - * If input parameters do not have valid signed 64-bit Long representation, this method will return a coerced value: - * - inputs that overflow 64-bit signed long will be coerced to Long.MAX_VALUE and Long.MIN_VALUE respectively - * - if the radix is less than 24, 'NaN' is coerced to Long.ZERO - * - if the radix is less than 35, '+/-Infinity' inputs are coerced to Long.ZERO - * - other invalid characters sequences have variable behavior - * @param str - The textual representation of the Long - * @param radix - The radix in which the text is written (2-36), defaults to 10 - * @returns The corresponding Long value - */ - static fromString(str: string, radix?: number): Long; - /** - * Returns a Long representation of the given string, written using radix 10. - * - * If the input string is empty, this function will throw a BSONError. - * - * If input parameters do not have a valid 64-bit Long representation, this method will return a coerced value: - * - inputs that overflow 64-bit long will be coerced to max or min (if signed) values - * - if the radix is less than 24, 'NaN' is coerced to Long.ZERO - * - if the radix is less than 35, '+/-Infinity' inputs are coerced to Long.ZERO - * - other invalid characters sequences have variable behavior - * @param str - The textual representation of the Long - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromString(str: string, unsigned?: boolean): Long; - /** - * Returns a Long representation of the given string, written using the specified radix. - * - * If the input string is empty or a provided radix is not within (2-36), this function will throw a BSONError. - * - * If input parameters do not have a valid 64-bit Long representation, this method will return a coerced value: - * - inputs that overflow 64-bit long will be coerced to max or min (if signed) values - * - if the radix is less than 24, 'NaN' is coerced to Long.ZERO - * - if the radix is less than 35, '+/-Infinity' inputs are coerced to Long.ZERO - * - other invalid characters sequences have variable behavior - * @param str - The textual representation of the Long - * @param unsigned - Whether unsigned or not, defaults to signed - * @param radix - The radix in which the text is written (2-36), defaults to 10 - * @returns The corresponding Long value - */ - static fromString(str: string, unsigned?: boolean, radix?: number): Long; - static fromString(str: string, unsignedOrRadix?: boolean | number, radix?: number): Long { - let unsigned = false; - if (typeof unsignedOrRadix === 'number') { - // For goog.math.long compatibility - (radix = unsignedOrRadix), (unsignedOrRadix = false); - } else { - unsigned = !!unsignedOrRadix; - } - radix ??= 10; - if (str === 'NaN' && radix < 24) { - // radix does not support n, so coerce to zero - return Long.ZERO; - } else if ((str === 'Infinity' || str === '+Infinity' || str === '-Infinity') && radix < 35) { - // radix does not support y, so coerce to zero - return Long.ZERO; - } - return Long._fromString(str, unsigned, radix); - } - - /** - * Creates a Long from its byte representation. - * @param bytes - Byte representation - * @param unsigned - Whether unsigned or not, defaults to signed - * @param le - Whether little or big endian, defaults to big endian - * @returns The corresponding Long value - */ - static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long { - return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned); - } - - /** - * Creates a Long from its little endian byte representation. - * @param bytes - Little endian byte representation - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromBytesLE(bytes: number[], unsigned?: boolean): Long { - return new Long( - bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24), - bytes[4] | (bytes[5] << 8) | (bytes[6] << 16) | (bytes[7] << 24), - unsigned - ); - } - - /** - * Creates a Long from its big endian byte representation. - * @param bytes - Big endian byte representation - * @param unsigned - Whether unsigned or not, defaults to signed - * @returns The corresponding Long value - */ - static fromBytesBE(bytes: number[], unsigned?: boolean): Long { - return new Long( - (bytes[4] << 24) | (bytes[5] << 16) | (bytes[6] << 8) | bytes[7], - (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3], - unsigned - ); - } - - /** - * Tests if the specified object is a Long. - */ - static isLong(value: unknown): value is Long { - return ( - value != null && - typeof value === 'object' && - '__isLong__' in value && - value.__isLong__ === true - ); - } - - /** - * Converts the specified value to a Long. - * @param unsigned - Whether unsigned or not, defaults to signed - */ - static fromValue( - val: number | string | { low: number; high: number; unsigned?: boolean }, - unsigned?: boolean - ): Long { - if (typeof val === 'number') return Long.fromNumber(val, unsigned); - if (typeof val === 'string') return Long.fromString(val, unsigned); - // Throws for non-objects, converts non-instanceof Long: - return Long.fromBits( - val.low, - val.high, - typeof unsigned === 'boolean' ? unsigned : val.unsigned - ); - } - - /** Returns the sum of this and the specified Long. */ - add(addend: string | number | Long | Timestamp): Long { - if (!Long.isLong(addend)) addend = Long.fromValue(addend); - - // Divide each number into 4 chunks of 16 bits, and then sum the chunks. - - const a48 = this.high >>> 16; - const a32 = this.high & 0xffff; - const a16 = this.low >>> 16; - const a00 = this.low & 0xffff; - - const b48 = addend.high >>> 16; - const b32 = addend.high & 0xffff; - const b16 = addend.low >>> 16; - const b00 = addend.low & 0xffff; - - let c48 = 0, - c32 = 0, - c16 = 0, - c00 = 0; - c00 += a00 + b00; - c16 += c00 >>> 16; - c00 &= 0xffff; - c16 += a16 + b16; - c32 += c16 >>> 16; - c16 &= 0xffff; - c32 += a32 + b32; - c48 += c32 >>> 16; - c32 &= 0xffff; - c48 += a48 + b48; - c48 &= 0xffff; - return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned); - } - - /** - * Returns the sum of this and the specified Long. - * @returns Sum - */ - and(other: string | number | Long | Timestamp): Long { - if (!Long.isLong(other)) other = Long.fromValue(other); - return Long.fromBits(this.low & other.low, this.high & other.high, this.unsigned); - } - - /** - * Compares this Long's value with the specified's. - * @returns 0 if they are the same, 1 if the this is greater and -1 if the given one is greater - */ - compare(other: string | number | Long | Timestamp): 0 | 1 | -1 { - if (!Long.isLong(other)) other = Long.fromValue(other); - if (this.eq(other)) return 0; - const thisNeg = this.isNegative(), - otherNeg = other.isNegative(); - if (thisNeg && !otherNeg) return -1; - if (!thisNeg && otherNeg) return 1; - // At this point the sign bits are the same - if (!this.unsigned) return this.sub(other).isNegative() ? -1 : 1; - // Both are positive if at least one is unsigned - return other.high >>> 0 > this.high >>> 0 || - (other.high === this.high && other.low >>> 0 > this.low >>> 0) - ? -1 - : 1; - } - - /** This is an alias of {@link Long.compare} */ - comp(other: string | number | Long | Timestamp): 0 | 1 | -1 { - return this.compare(other); - } - - /** - * Returns this Long divided by the specified. The result is signed if this Long is signed or unsigned if this Long is unsigned. - * @returns Quotient - */ - divide(divisor: string | number | Long | Timestamp): Long { - if (!Long.isLong(divisor)) divisor = Long.fromValue(divisor); - if (divisor.isZero()) throw new BSONError('division by zero'); - - // use wasm support if present - if (wasm) { - // guard against signed division overflow: the largest - // negative number / -1 would be 1 larger than the largest - // positive number, due to two's complement. - if ( - !this.unsigned && - this.high === -0x80000000 && - divisor.low === -1 && - divisor.high === -1 - ) { - // be consistent with non-wasm code path - return this; - } - const low = (this.unsigned ? wasm.div_u : wasm.div_s)( - this.low, - this.high, - divisor.low, - divisor.high - ); - return Long.fromBits(low, wasm.get_high(), this.unsigned); - } - - if (this.isZero()) return this.unsigned ? Long.UZERO : Long.ZERO; - let approx, rem, res; - if (!this.unsigned) { - // This section is only relevant for signed longs and is derived from the - // closure library as a whole. - if (this.eq(Long.MIN_VALUE)) { - if (divisor.eq(Long.ONE) || divisor.eq(Long.NEG_ONE)) return Long.MIN_VALUE; - // recall that -MIN_VALUE == MIN_VALUE - else if (divisor.eq(Long.MIN_VALUE)) return Long.ONE; - else { - // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. - const halfThis = this.shr(1); - approx = halfThis.div(divisor).shl(1); - if (approx.eq(Long.ZERO)) { - return divisor.isNegative() ? Long.ONE : Long.NEG_ONE; - } else { - rem = this.sub(divisor.mul(approx)); - res = approx.add(rem.div(divisor)); - return res; - } - } - } else if (divisor.eq(Long.MIN_VALUE)) return this.unsigned ? Long.UZERO : Long.ZERO; - if (this.isNegative()) { - if (divisor.isNegative()) return this.neg().div(divisor.neg()); - return this.neg().div(divisor).neg(); - } else if (divisor.isNegative()) return this.div(divisor.neg()).neg(); - res = Long.ZERO; - } else { - // The algorithm below has not been made for unsigned longs. It's therefore - // required to take special care of the MSB prior to running it. - if (!divisor.unsigned) divisor = divisor.toUnsigned(); - if (divisor.gt(this)) return Long.UZERO; - if (divisor.gt(this.shru(1))) - // 15 >>> 1 = 7 ; with divisor = 8 ; true - return Long.UONE; - res = Long.UZERO; - } - - // Repeat the following until the remainder is less than other: find a - // floating-point that approximates remainder / other *from below*, add this - // into the result, and subtract it from the remainder. It is critical that - // the approximate value is less than or equal to the real value so that the - // remainder never becomes negative. - // eslint-disable-next-line @typescript-eslint/no-this-alias - rem = this; - while (rem.gte(divisor)) { - // Approximate the result of division. This may be a little greater or - // smaller than the actual value. - approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber())); - - // We will tweak the approximate result by changing it in the 48-th digit or - // the smallest non-fractional digit, whichever is larger. - const log2 = Math.ceil(Math.log(approx) / Math.LN2); - const delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48); - // Decrease the approximation until it is smaller than the remainder. Note - // that if it is too large, the product overflows and is negative. - let approxRes = Long.fromNumber(approx); - let approxRem = approxRes.mul(divisor); - while (approxRem.isNegative() || approxRem.gt(rem)) { - approx -= delta; - approxRes = Long.fromNumber(approx, this.unsigned); - approxRem = approxRes.mul(divisor); - } - - // We know the answer can't be zero... and actually, zero would cause - // infinite recursion since we would make no progress. - if (approxRes.isZero()) approxRes = Long.ONE; - - res = res.add(approxRes); - rem = rem.sub(approxRem); - } - return res; - } - - /**This is an alias of {@link Long.divide} */ - div(divisor: string | number | Long | Timestamp): Long { - return this.divide(divisor); - } - - /** - * Tests if this Long's value equals the specified's. - * @param other - Other value - */ - equals(other: string | number | Long | Timestamp): boolean { - if (!Long.isLong(other)) other = Long.fromValue(other); - if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1) - return false; - return this.high === other.high && this.low === other.low; - } - - /** This is an alias of {@link Long.equals} */ - eq(other: string | number | Long | Timestamp): boolean { - return this.equals(other); - } - - /** Gets the high 32 bits as a signed integer. */ - getHighBits(): number { - return this.high; - } - - /** Gets the high 32 bits as an unsigned integer. */ - getHighBitsUnsigned(): number { - return this.high >>> 0; - } - - /** Gets the low 32 bits as a signed integer. */ - getLowBits(): number { - return this.low; - } - - /** Gets the low 32 bits as an unsigned integer. */ - getLowBitsUnsigned(): number { - return this.low >>> 0; - } - - /** Gets the number of bits needed to represent the absolute value of this Long. */ - getNumBitsAbs(): number { - if (this.isNegative()) { - // Unsigned Longs are never negative - return this.eq(Long.MIN_VALUE) ? 64 : this.neg().getNumBitsAbs(); - } - const val = this.high !== 0 ? this.high : this.low; - let bit: number; - for (bit = 31; bit > 0; bit--) if ((val & (1 << bit)) !== 0) break; - return this.high !== 0 ? bit + 33 : bit + 1; - } - - /** Tests if this Long's value is greater than the specified's. */ - greaterThan(other: string | number | Long | Timestamp): boolean { - return this.comp(other) > 0; - } - - /** This is an alias of {@link Long.greaterThan} */ - gt(other: string | number | Long | Timestamp): boolean { - return this.greaterThan(other); - } - - /** Tests if this Long's value is greater than or equal the specified's. */ - greaterThanOrEqual(other: string | number | Long | Timestamp): boolean { - return this.comp(other) >= 0; - } - - /** This is an alias of {@link Long.greaterThanOrEqual} */ - gte(other: string | number | Long | Timestamp): boolean { - return this.greaterThanOrEqual(other); - } - /** This is an alias of {@link Long.greaterThanOrEqual} */ - ge(other: string | number | Long | Timestamp): boolean { - return this.greaterThanOrEqual(other); - } - - /** Tests if this Long's value is even. */ - isEven(): boolean { - return (this.low & 1) === 0; - } - - /** Tests if this Long's value is negative. */ - isNegative(): boolean { - return !this.unsigned && this.high < 0; - } - - /** Tests if this Long's value is odd. */ - isOdd(): boolean { - return (this.low & 1) === 1; - } - - /** Tests if this Long's value is positive. */ - isPositive(): boolean { - return this.unsigned || this.high >= 0; - } - - /** Tests if this Long's value equals zero. */ - isZero(): boolean { - return this.high === 0 && this.low === 0; - } - - /** Tests if this Long's value is less than the specified's. */ - lessThan(other: string | number | Long | Timestamp): boolean { - return this.comp(other) < 0; - } - - /** This is an alias of {@link Long#lessThan}. */ - lt(other: string | number | Long | Timestamp): boolean { - return this.lessThan(other); - } - - /** Tests if this Long's value is less than or equal the specified's. */ - lessThanOrEqual(other: string | number | Long | Timestamp): boolean { - return this.comp(other) <= 0; - } - - /** This is an alias of {@link Long.lessThanOrEqual} */ - lte(other: string | number | Long | Timestamp): boolean { - return this.lessThanOrEqual(other); - } - - /** Returns this Long modulo the specified. */ - modulo(divisor: string | number | Long | Timestamp): Long { - if (!Long.isLong(divisor)) divisor = Long.fromValue(divisor); - - // use wasm support if present - if (wasm) { - const low = (this.unsigned ? wasm.rem_u : wasm.rem_s)( - this.low, - this.high, - divisor.low, - divisor.high - ); - return Long.fromBits(low, wasm.get_high(), this.unsigned); - } - - return this.sub(this.div(divisor).mul(divisor)); - } - - /** This is an alias of {@link Long.modulo} */ - mod(divisor: string | number | Long | Timestamp): Long { - return this.modulo(divisor); - } - /** This is an alias of {@link Long.modulo} */ - rem(divisor: string | number | Long | Timestamp): Long { - return this.modulo(divisor); - } - - /** - * Returns the product of this and the specified Long. - * @param multiplier - Multiplier - * @returns Product - */ - multiply(multiplier: string | number | Long | Timestamp): Long { - if (this.isZero()) return Long.ZERO; - if (!Long.isLong(multiplier)) multiplier = Long.fromValue(multiplier); - - // use wasm support if present - if (wasm) { - const low = wasm.mul(this.low, this.high, multiplier.low, multiplier.high); - return Long.fromBits(low, wasm.get_high(), this.unsigned); - } - - if (multiplier.isZero()) return Long.ZERO; - if (this.eq(Long.MIN_VALUE)) return multiplier.isOdd() ? Long.MIN_VALUE : Long.ZERO; - if (multiplier.eq(Long.MIN_VALUE)) return this.isOdd() ? Long.MIN_VALUE : Long.ZERO; - - if (this.isNegative()) { - if (multiplier.isNegative()) return this.neg().mul(multiplier.neg()); - else return this.neg().mul(multiplier).neg(); - } else if (multiplier.isNegative()) return this.mul(multiplier.neg()).neg(); - - // If both longs are small, use float multiplication - if (this.lt(Long.TWO_PWR_24) && multiplier.lt(Long.TWO_PWR_24)) - return Long.fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned); - - // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products. - // We can skip products that would overflow. - - const a48 = this.high >>> 16; - const a32 = this.high & 0xffff; - const a16 = this.low >>> 16; - const a00 = this.low & 0xffff; - - const b48 = multiplier.high >>> 16; - const b32 = multiplier.high & 0xffff; - const b16 = multiplier.low >>> 16; - const b00 = multiplier.low & 0xffff; - - let c48 = 0, - c32 = 0, - c16 = 0, - c00 = 0; - c00 += a00 * b00; - c16 += c00 >>> 16; - c00 &= 0xffff; - c16 += a16 * b00; - c32 += c16 >>> 16; - c16 &= 0xffff; - c16 += a00 * b16; - c32 += c16 >>> 16; - c16 &= 0xffff; - c32 += a32 * b00; - c48 += c32 >>> 16; - c32 &= 0xffff; - c32 += a16 * b16; - c48 += c32 >>> 16; - c32 &= 0xffff; - c32 += a00 * b32; - c48 += c32 >>> 16; - c32 &= 0xffff; - c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; - c48 &= 0xffff; - return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned); - } - - /** This is an alias of {@link Long.multiply} */ - mul(multiplier: string | number | Long | Timestamp): Long { - return this.multiply(multiplier); - } - - /** Returns the Negation of this Long's value. */ - negate(): Long { - if (!this.unsigned && this.eq(Long.MIN_VALUE)) return Long.MIN_VALUE; - return this.not().add(Long.ONE); - } - - /** This is an alias of {@link Long.negate} */ - neg(): Long { - return this.negate(); - } - - /** Returns the bitwise NOT of this Long. */ - not(): Long { - return Long.fromBits(~this.low, ~this.high, this.unsigned); - } - - /** Tests if this Long's value differs from the specified's. */ - notEquals(other: string | number | Long | Timestamp): boolean { - return !this.equals(other); - } - - /** This is an alias of {@link Long.notEquals} */ - neq(other: string | number | Long | Timestamp): boolean { - return this.notEquals(other); - } - /** This is an alias of {@link Long.notEquals} */ - ne(other: string | number | Long | Timestamp): boolean { - return this.notEquals(other); - } - - /** - * Returns the bitwise OR of this Long and the specified. - */ - or(other: number | string | Long): Long { - if (!Long.isLong(other)) other = Long.fromValue(other); - return Long.fromBits(this.low | other.low, this.high | other.high, this.unsigned); - } - - /** - * Returns this Long with bits shifted to the left by the given amount. - * @param numBits - Number of bits - * @returns Shifted Long - */ - shiftLeft(numBits: number | Long): Long { - if (Long.isLong(numBits)) numBits = numBits.toInt(); - if ((numBits &= 63) === 0) return this; - else if (numBits < 32) - return Long.fromBits( - this.low << numBits, - (this.high << numBits) | (this.low >>> (32 - numBits)), - this.unsigned - ); - else return Long.fromBits(0, this.low << (numBits - 32), this.unsigned); - } - - /** This is an alias of {@link Long.shiftLeft} */ - shl(numBits: number | Long): Long { - return this.shiftLeft(numBits); - } - - /** - * Returns this Long with bits arithmetically shifted to the right by the given amount. - * @param numBits - Number of bits - * @returns Shifted Long - */ - shiftRight(numBits: number | Long): Long { - if (Long.isLong(numBits)) numBits = numBits.toInt(); - if ((numBits &= 63) === 0) return this; - else if (numBits < 32) - return Long.fromBits( - (this.low >>> numBits) | (this.high << (32 - numBits)), - this.high >> numBits, - this.unsigned - ); - else return Long.fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned); - } - - /** This is an alias of {@link Long.shiftRight} */ - shr(numBits: number | Long): Long { - return this.shiftRight(numBits); - } - - /** - * Returns this Long with bits logically shifted to the right by the given amount. - * @param numBits - Number of bits - * @returns Shifted Long - */ - shiftRightUnsigned(numBits: Long | number): Long { - if (Long.isLong(numBits)) numBits = numBits.toInt(); - numBits &= 63; - if (numBits === 0) return this; - else { - const high = this.high; - if (numBits < 32) { - const low = this.low; - return Long.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >>> numBits, - this.unsigned - ); - } else if (numBits === 32) return Long.fromBits(high, 0, this.unsigned); - else return Long.fromBits(high >>> (numBits - 32), 0, this.unsigned); - } - } - - /** This is an alias of {@link Long.shiftRightUnsigned} */ - shr_u(numBits: number | Long): Long { - return this.shiftRightUnsigned(numBits); - } - /** This is an alias of {@link Long.shiftRightUnsigned} */ - shru(numBits: number | Long): Long { - return this.shiftRightUnsigned(numBits); - } - - /** - * Returns the difference of this and the specified Long. - * @param subtrahend - Subtrahend - * @returns Difference - */ - subtract(subtrahend: string | number | Long | Timestamp): Long { - if (!Long.isLong(subtrahend)) subtrahend = Long.fromValue(subtrahend); - return this.add(subtrahend.neg()); - } - - /** This is an alias of {@link Long.subtract} */ - sub(subtrahend: string | number | Long | Timestamp): Long { - return this.subtract(subtrahend); - } - - /** Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. */ - toInt(): number { - return this.unsigned ? this.low >>> 0 : this.low; - } - - /** Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). */ - toNumber(): number { - if (this.unsigned) return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0); - return this.high * TWO_PWR_32_DBL + (this.low >>> 0); - } - - /** Converts the Long to a BigInt (arbitrary precision). */ - toBigInt(): bigint { - // eslint-disable-next-line no-restricted-globals -- This is allowed here as it is explicitly requesting a bigint - return BigInt(this.toString()); - } - - /** - * Converts this Long to its byte representation. - * @param le - Whether little or big endian, defaults to big endian - * @returns Byte representation - */ - toBytes(le?: boolean): number[] { - return le ? this.toBytesLE() : this.toBytesBE(); - } - - /** - * Converts this Long to its little endian byte representation. - * @returns Little endian byte representation - */ - toBytesLE(): number[] { - const hi = this.high, - lo = this.low; - return [ - lo & 0xff, - (lo >>> 8) & 0xff, - (lo >>> 16) & 0xff, - lo >>> 24, - hi & 0xff, - (hi >>> 8) & 0xff, - (hi >>> 16) & 0xff, - hi >>> 24 - ]; - } - - /** - * Converts this Long to its big endian byte representation. - * @returns Big endian byte representation - */ - toBytesBE(): number[] { - const hi = this.high, - lo = this.low; - return [ - hi >>> 24, - (hi >>> 16) & 0xff, - (hi >>> 8) & 0xff, - hi & 0xff, - lo >>> 24, - (lo >>> 16) & 0xff, - (lo >>> 8) & 0xff, - lo & 0xff - ]; - } - - /** - * Converts this Long to signed. - */ - toSigned(): Long { - if (!this.unsigned) return this; - return Long.fromBits(this.low, this.high, false); - } - - /** - * Converts the Long to a string written in the specified radix. - * @param radix - Radix (2-36), defaults to 10 - * @throws RangeError If `radix` is out of range - */ - toString(radix?: number): string { - radix = radix || 10; - if (radix < 2 || 36 < radix) throw new BSONError('radix'); - if (this.isZero()) return '0'; - if (this.isNegative()) { - // Unsigned Longs are never negative - if (this.eq(Long.MIN_VALUE)) { - // We need to change the Long value before it can be negated, so we remove - // the bottom-most digit in this base and then recurse to do the rest. - const radixLong = Long.fromNumber(radix), - div = this.div(radixLong), - rem1 = div.mul(radixLong).sub(this); - return div.toString(radix) + rem1.toInt().toString(radix); - } else return '-' + this.neg().toString(radix); - } - - // Do several (6) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - const radixToPower = Long.fromNumber(Math.pow(radix, 6), this.unsigned); - // eslint-disable-next-line @typescript-eslint/no-this-alias - let rem: Long = this; - let result = ''; - while (true) { - const remDiv = rem.div(radixToPower); - const intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0; - let digits = intval.toString(radix); - rem = remDiv; - if (rem.isZero()) { - return digits + result; - } else { - while (digits.length < 6) digits = '0' + digits; - result = '' + digits + result; - } - } - } - - /** Converts this Long to unsigned. */ - toUnsigned(): Long { - if (this.unsigned) return this; - return Long.fromBits(this.low, this.high, true); - } - - /** Returns the bitwise XOR of this Long and the given one. */ - xor(other: Long | number | string): Long { - if (!Long.isLong(other)) other = Long.fromValue(other); - return Long.fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned); - } - - /** This is an alias of {@link Long.isZero} */ - eqz(): boolean { - return this.isZero(); - } - - /** This is an alias of {@link Long.lessThanOrEqual} */ - le(other: string | number | Long | Timestamp): boolean { - return this.lessThanOrEqual(other); - } - - /* - **************************************************************** - * BSON SPECIFIC ADDITIONS * - **************************************************************** - */ - toExtendedJSON(options?: EJSONOptions): number | LongExtended { - if (options && options.relaxed) return this.toNumber(); - return { $numberLong: this.toString() }; - } - static fromExtendedJSON( - doc: { $numberLong: string }, - options?: EJSONOptions - ): number | Long | bigint { - const { useBigInt64 = false, relaxed = true } = { ...options }; - - if (doc.$numberLong.length > MAX_INT64_STRING_LENGTH) { - throw new BSONError('$numberLong string is too long'); - } - - if (!DECIMAL_REG_EX.test(doc.$numberLong)) { - throw new BSONError(`$numberLong string "${doc.$numberLong}" is in an invalid format`); - } - - if (useBigInt64) { - /* eslint-disable no-restricted-globals -- Can use BigInt here as useBigInt64=true */ - const bigIntResult = BigInt(doc.$numberLong); - return BigInt.asIntN(64, bigIntResult); - /* eslint-enable */ - } - - const longResult = Long.fromString(doc.$numberLong); - if (relaxed) { - return longResult.toNumber(); - } - return longResult; - } - - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string { - inspect ??= defaultInspect; - const longVal = inspect(this.toString(), options); - const unsignedVal = this.unsigned ? `, ${inspect(this.unsigned, options)}` : ''; - return `new Long(${longVal}${unsignedVal})`; - } -} diff --git a/server/node_modules/bson/src/max_key.ts b/server/node_modules/bson/src/max_key.ts deleted file mode 100644 index 903f1d16..00000000 --- a/server/node_modules/bson/src/max_key.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { BSONValue } from './bson_value'; - -/** @public */ -export interface MaxKeyExtended { - $maxKey: 1; -} - -/** - * A class representation of the BSON MaxKey type. - * @public - * @category BSONType - */ -export class MaxKey extends BSONValue { - get _bsontype(): 'MaxKey' { - return 'MaxKey'; - } - - /** @internal */ - toExtendedJSON(): MaxKeyExtended { - return { $maxKey: 1 }; - } - - /** @internal */ - static fromExtendedJSON(): MaxKey { - return new MaxKey(); - } - - inspect(): string { - return 'new MaxKey()'; - } -} diff --git a/server/node_modules/bson/src/min_key.ts b/server/node_modules/bson/src/min_key.ts deleted file mode 100644 index 244e645a..00000000 --- a/server/node_modules/bson/src/min_key.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { BSONValue } from './bson_value'; - -/** @public */ -export interface MinKeyExtended { - $minKey: 1; -} - -/** - * A class representation of the BSON MinKey type. - * @public - * @category BSONType - */ -export class MinKey extends BSONValue { - get _bsontype(): 'MinKey' { - return 'MinKey'; - } - - /** @internal */ - toExtendedJSON(): MinKeyExtended { - return { $minKey: 1 }; - } - - /** @internal */ - static fromExtendedJSON(): MinKey { - return new MinKey(); - } - - inspect(): string { - return 'new MinKey()'; - } -} diff --git a/server/node_modules/bson/src/objectid.ts b/server/node_modules/bson/src/objectid.ts deleted file mode 100644 index a9abde9f..00000000 --- a/server/node_modules/bson/src/objectid.ts +++ /dev/null @@ -1,389 +0,0 @@ -import { BSONValue } from './bson_value'; -import { BSONError } from './error'; -import { type InspectFn, defaultInspect } from './parser/utils'; -import { ByteUtils } from './utils/byte_utils'; -import { NumberUtils } from './utils/number_utils'; - -// Unique sequence for the current process (initialized on first use) -let PROCESS_UNIQUE: Uint8Array | null = null; - -/** ObjectId hexString cache @internal */ -const __idCache = new WeakMap(); // TODO(NODE-6549): convert this to #__id private field when target updated to ES2022 - -/** @public */ -export interface ObjectIdLike { - id: string | Uint8Array; - __id?: string; - toHexString(): string; -} - -/** @public */ -export interface ObjectIdExtended { - $oid: string; -} - -/** - * A class representation of the BSON ObjectId type. - * @public - * @category BSONType - */ -export class ObjectId extends BSONValue { - get _bsontype(): 'ObjectId' { - return 'ObjectId'; - } - - /** @internal */ - private static index = Math.floor(Math.random() * 0xffffff); - - static cacheHexString: boolean; - - /** ObjectId Bytes @internal */ - private buffer!: Uint8Array; - - /** - * Create ObjectId from a number. - * - * @param inputId - A number. - * @deprecated Instead, use `static createFromTime()` to set a numeric value for the new ObjectId. - */ - constructor(inputId: number); - /** - * Create ObjectId from a 24 character hex string. - * - * @param inputId - A 24 character hex string. - */ - constructor(inputId: string); - /** - * Create ObjectId from the BSON ObjectId type. - * - * @param inputId - The BSON ObjectId type. - */ - constructor(inputId: ObjectId); - /** - * Create ObjectId from the object type that has the toHexString method. - * - * @param inputId - The ObjectIdLike type. - */ - constructor(inputId: ObjectIdLike); - /** - * Create ObjectId from a 12 byte binary Buffer. - * - * @param inputId - A 12 byte binary Buffer. - */ - constructor(inputId: Uint8Array); - /** To generate a new ObjectId, use ObjectId() with no argument. */ - constructor(); - /** - * Implementation overload. - * - * @param inputId - All input types that are used in the constructor implementation. - */ - constructor(inputId?: string | number | ObjectId | ObjectIdLike | Uint8Array); - /** - * Create a new ObjectId. - * - * @param inputId - An input value to create a new ObjectId from. - */ - constructor(inputId?: string | number | ObjectId | ObjectIdLike | Uint8Array) { - super(); - // workingId is set based on type of input and whether valid id exists for the input - let workingId; - if (typeof inputId === 'object' && inputId && 'id' in inputId) { - if (typeof inputId.id !== 'string' && !ArrayBuffer.isView(inputId.id)) { - throw new BSONError('Argument passed in must have an id that is of type string or Buffer'); - } - if ('toHexString' in inputId && typeof inputId.toHexString === 'function') { - workingId = ByteUtils.fromHex(inputId.toHexString()); - } else { - workingId = inputId.id; - } - } else { - workingId = inputId; - } - - // The following cases use workingId to construct an ObjectId - if (workingId == null || typeof workingId === 'number') { - // The most common use case (blank id, new objectId instance) - // Generate a new id - this.buffer = ObjectId.generate(typeof workingId === 'number' ? workingId : undefined); - } else if (ArrayBuffer.isView(workingId) && workingId.byteLength === 12) { - // If intstanceof matches we can escape calling ensure buffer in Node.js environments - this.buffer = ByteUtils.toLocalBufferType(workingId); - } else if (typeof workingId === 'string') { - if (ObjectId.validateHexString(workingId)) { - this.buffer = ByteUtils.fromHex(workingId); - // If we are caching the hex string - if (ObjectId.cacheHexString) { - __idCache.set(this, workingId); - } - } else { - throw new BSONError( - 'input must be a 24 character hex string, 12 byte Uint8Array, or an integer' - ); - } - } else { - throw new BSONError('Argument passed in does not match the accepted types'); - } - } - - /** - * The ObjectId bytes - * @readonly - */ - get id(): Uint8Array { - return this.buffer; - } - - set id(value: Uint8Array) { - this.buffer = value; - if (ObjectId.cacheHexString) { - __idCache.set(this, ByteUtils.toHex(value)); - } - } - - /** - * @internal - * Validates the input string is a valid hex representation of an ObjectId. - */ - private static validateHexString(string: string): boolean { - if (string?.length !== 24) return false; - for (let i = 0; i < 24; i++) { - const char = string.charCodeAt(i); - if ( - // Check for ASCII 0-9 - (char >= 48 && char <= 57) || - // Check for ASCII a-f - (char >= 97 && char <= 102) || - // Check for ASCII A-F - (char >= 65 && char <= 70) - ) { - continue; - } - return false; - } - return true; - } - - /** Returns the ObjectId id as a 24 lowercase character hex string representation */ - toHexString(): string { - if (ObjectId.cacheHexString) { - const __id = __idCache.get(this); - if (__id) return __id; - } - - const hexString = ByteUtils.toHex(this.id); - - if (ObjectId.cacheHexString) { - __idCache.set(this, hexString); - } - - return hexString; - } - - /** - * Update the ObjectId index - * @internal - */ - private static getInc(): number { - return (ObjectId.index = (ObjectId.index + 1) % 0xffffff); - } - - /** - * Generate a 12 byte id buffer used in ObjectId's - * - * @param time - pass in a second based timestamp. - */ - static generate(time?: number): Uint8Array { - if ('number' !== typeof time) { - time = Math.floor(Date.now() / 1000); - } - - const inc = ObjectId.getInc(); - const buffer = ByteUtils.allocateUnsafe(12); - - // 4-byte timestamp - NumberUtils.setInt32BE(buffer, 0, time); - - // set PROCESS_UNIQUE if yet not initialized - if (PROCESS_UNIQUE === null) { - PROCESS_UNIQUE = ByteUtils.randomBytes(5); - } - - // 5-byte process unique - buffer[4] = PROCESS_UNIQUE[0]; - buffer[5] = PROCESS_UNIQUE[1]; - buffer[6] = PROCESS_UNIQUE[2]; - buffer[7] = PROCESS_UNIQUE[3]; - buffer[8] = PROCESS_UNIQUE[4]; - - // 3-byte counter - buffer[11] = inc & 0xff; - buffer[10] = (inc >> 8) & 0xff; - buffer[9] = (inc >> 16) & 0xff; - - return buffer; - } - - /** - * Converts the id into a 24 character hex string for printing, unless encoding is provided. - * @param encoding - hex or base64 - */ - toString(encoding?: 'hex' | 'base64'): string { - // Is the id a buffer then use the buffer toString method to return the format - if (encoding === 'base64') return ByteUtils.toBase64(this.id); - if (encoding === 'hex') return this.toHexString(); - return this.toHexString(); - } - - /** Converts to its JSON the 24 character hex string representation. */ - toJSON(): string { - return this.toHexString(); - } - - /** @internal */ - private static is(variable: unknown): variable is ObjectId { - return ( - variable != null && - typeof variable === 'object' && - '_bsontype' in variable && - variable._bsontype === 'ObjectId' - ); - } - - /** - * Compares the equality of this ObjectId with `otherID`. - * - * @param otherId - ObjectId instance to compare against. - */ - equals(otherId: string | ObjectId | ObjectIdLike | undefined | null): boolean { - if (otherId === undefined || otherId === null) { - return false; - } - - if (ObjectId.is(otherId)) { - return ( - this.buffer[11] === otherId.buffer[11] && ByteUtils.equals(this.buffer, otherId.buffer) - ); - } - - if (typeof otherId === 'string') { - return otherId.toLowerCase() === this.toHexString(); - } - - if (typeof otherId === 'object' && typeof otherId.toHexString === 'function') { - const otherIdString = otherId.toHexString(); - const thisIdString = this.toHexString(); - return typeof otherIdString === 'string' && otherIdString.toLowerCase() === thisIdString; - } - - return false; - } - - /** Returns the generation date (accurate up to the second) that this ID was generated. */ - getTimestamp(): Date { - const timestamp = new Date(); - const time = NumberUtils.getUint32BE(this.buffer, 0); - timestamp.setTime(Math.floor(time) * 1000); - return timestamp; - } - - /** @internal */ - static createPk(): ObjectId { - return new ObjectId(); - } - - /** @internal */ - serializeInto(uint8array: Uint8Array, index: number): 12 { - uint8array[index] = this.buffer[0]; - uint8array[index + 1] = this.buffer[1]; - uint8array[index + 2] = this.buffer[2]; - uint8array[index + 3] = this.buffer[3]; - uint8array[index + 4] = this.buffer[4]; - uint8array[index + 5] = this.buffer[5]; - uint8array[index + 6] = this.buffer[6]; - uint8array[index + 7] = this.buffer[7]; - uint8array[index + 8] = this.buffer[8]; - uint8array[index + 9] = this.buffer[9]; - uint8array[index + 10] = this.buffer[10]; - uint8array[index + 11] = this.buffer[11]; - return 12; - } - - /** - * Creates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId. - * - * @param time - an integer number representing a number of seconds. - */ - static createFromTime(time: number): ObjectId { - const buffer = ByteUtils.allocate(12); - for (let i = 11; i >= 4; i--) buffer[i] = 0; - // Encode time into first 4 bytes - NumberUtils.setInt32BE(buffer, 0, time); - // Return the new objectId - return new ObjectId(buffer); - } - - /** - * Creates an ObjectId from a hex string representation of an ObjectId. - * - * @param hexString - create a ObjectId from a passed in 24 character hexstring. - */ - static createFromHexString(hexString: string): ObjectId { - if (hexString?.length !== 24) { - throw new BSONError('hex string must be 24 characters'); - } - - return new ObjectId(ByteUtils.fromHex(hexString)); - } - - /** Creates an ObjectId instance from a base64 string */ - static createFromBase64(base64: string): ObjectId { - if (base64?.length !== 16) { - throw new BSONError('base64 string must be 16 characters'); - } - - return new ObjectId(ByteUtils.fromBase64(base64)); - } - - /** - * Checks if a value can be used to create a valid bson ObjectId - * @param id - any JS value - */ - static isValid(id: string | number | ObjectId | ObjectIdLike | Uint8Array): boolean { - if (id == null) return false; - if (typeof id === 'string') return ObjectId.validateHexString(id); - - try { - new ObjectId(id); - return true; - } catch { - return false; - } - } - - /** @internal */ - toExtendedJSON(): ObjectIdExtended { - if (this.toHexString) return { $oid: this.toHexString() }; - return { $oid: this.toString('hex') }; - } - - /** @internal */ - static fromExtendedJSON(doc: ObjectIdExtended): ObjectId { - return new ObjectId(doc.$oid); - } - - /** @internal */ - private isCached(): boolean { - return ObjectId.cacheHexString && __idCache.has(this); - } - - /** - * Converts to a string representation of this Id. - * - * @returns return the 24 character hex string representation. - */ - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string { - inspect ??= defaultInspect; - return `new ObjectId(${inspect(this.toHexString(), options)})`; - } -} diff --git a/server/node_modules/bson/src/parse_utf8.ts b/server/node_modules/bson/src/parse_utf8.ts deleted file mode 100644 index 045a9080..00000000 --- a/server/node_modules/bson/src/parse_utf8.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { BSONError } from './error'; - -type TextDecoder = { - readonly encoding: string; - readonly fatal: boolean; - readonly ignoreBOM: boolean; - decode(input?: Uint8Array): string; -}; -type TextDecoderConstructor = { - new (label: 'utf8', options: { fatal: boolean; ignoreBOM?: boolean }): TextDecoder; -}; - -// parse utf8 globals -declare const TextDecoder: TextDecoderConstructor; -let TextDecoderFatal: TextDecoder; -let TextDecoderNonFatal: TextDecoder; - -/** - * Determines if the passed in bytes are valid utf8 - * @param bytes - An array of 8-bit bytes. Must be indexable and have length property - * @param start - The index to start validating - * @param end - The index to end validating - */ -export function parseUtf8(buffer: Uint8Array, start: number, end: number, fatal: boolean): string { - if (fatal) { - TextDecoderFatal ??= new TextDecoder('utf8', { fatal: true }); - try { - return TextDecoderFatal.decode(buffer.subarray(start, end)); - } catch (cause) { - throw new BSONError('Invalid UTF-8 string in BSON document', { cause }); - } - } - TextDecoderNonFatal ??= new TextDecoder('utf8', { fatal: false }); - return TextDecoderNonFatal.decode(buffer.subarray(start, end)); -} diff --git a/server/node_modules/bson/src/parser/calculate_size.ts b/server/node_modules/bson/src/parser/calculate_size.ts deleted file mode 100644 index 557d15a8..00000000 --- a/server/node_modules/bson/src/parser/calculate_size.ts +++ /dev/null @@ -1,218 +0,0 @@ -import { Binary } from '../binary'; -import type { Document } from '../bson'; -import { BSONError, BSONVersionError } from '../error'; -import * as constants from '../constants'; -import { ByteUtils } from '../utils/byte_utils'; -import { isAnyArrayBuffer, isDate, isRegExp } from './utils'; - -export function internalCalculateObjectSize( - object: Document, - serializeFunctions?: boolean, - ignoreUndefined?: boolean -): number { - let totalLength = 4 + 1; - - if (Array.isArray(object)) { - for (let i = 0; i < object.length; i++) { - totalLength += calculateElement( - i.toString(), - object[i], - serializeFunctions, - true, - ignoreUndefined - ); - } - } else { - // If we have toBSON defined, override the current object - - if (typeof object?.toBSON === 'function') { - object = object.toBSON(); - } - - // Calculate size - for (const key of Object.keys(object)) { - totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined); - } - } - - return totalLength; -} - -/** @internal */ -function calculateElement( - name: string, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - value: any, - serializeFunctions = false, - isArray = false, - ignoreUndefined = false -) { - // If we have toBSON defined, override the current object - if (typeof value?.toBSON === 'function') { - value = value.toBSON(); - } - - switch (typeof value) { - case 'string': - return 1 + ByteUtils.utf8ByteLength(name) + 1 + 4 + ByteUtils.utf8ByteLength(value) + 1; - case 'number': - if ( - Math.floor(value) === value && - value >= constants.JS_INT_MIN && - value <= constants.JS_INT_MAX - ) { - if (value >= constants.BSON_INT32_MIN && value <= constants.BSON_INT32_MAX) { - // 32 bit - return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (4 + 1); - } else { - return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1); - } - } else { - // 64 bit - return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1); - } - case 'undefined': - if (isArray || !ignoreUndefined) - return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1; - return 0; - case 'boolean': - return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 1); - case 'object': - if ( - value != null && - typeof value._bsontype === 'string' && - value[constants.BSON_VERSION_SYMBOL] !== constants.BSON_MAJOR_VERSION - ) { - throw new BSONVersionError(); - } else if (value == null || value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') { - return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1; - } else if (value._bsontype === 'ObjectId') { - return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (12 + 1); - } else if (value instanceof Date || isDate(value)) { - return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1); - } else if ( - ArrayBuffer.isView(value) || - value instanceof ArrayBuffer || - isAnyArrayBuffer(value) - ) { - return ( - (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 4 + 1) + value.byteLength - ); - } else if ( - value._bsontype === 'Long' || - value._bsontype === 'Double' || - value._bsontype === 'Timestamp' - ) { - return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1); - } else if (value._bsontype === 'Decimal128') { - return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (16 + 1); - } else if (value._bsontype === 'Code') { - // Calculate size depending on the availability of a scope - if (value.scope != null && Object.keys(value.scope).length > 0) { - return ( - (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + - 1 + - 4 + - 4 + - ByteUtils.utf8ByteLength(value.code.toString()) + - 1 + - internalCalculateObjectSize(value.scope, serializeFunctions, ignoreUndefined) - ); - } else { - return ( - (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + - 1 + - 4 + - ByteUtils.utf8ByteLength(value.code.toString()) + - 1 - ); - } - } else if (value._bsontype === 'Binary') { - const binary: Binary = value; - // Check what kind of subtype we have - if (binary.sub_type === Binary.SUBTYPE_BYTE_ARRAY) { - return ( - (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + - (binary.position + 1 + 4 + 1 + 4) - ); - } else { - return ( - (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (binary.position + 1 + 4 + 1) - ); - } - } else if (value._bsontype === 'Symbol') { - return ( - (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + - ByteUtils.utf8ByteLength(value.value) + - 4 + - 1 + - 1 - ); - } else if (value._bsontype === 'DBRef') { - // Set up correct object for serialization - const ordered_values = Object.assign( - { - $ref: value.collection, - $id: value.oid - }, - value.fields - ); - - // Add db reference if it exists - if (value.db != null) { - ordered_values['$db'] = value.db; - } - - return ( - (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + - 1 + - internalCalculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined) - ); - } else if (value instanceof RegExp || isRegExp(value)) { - return ( - (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + - 1 + - ByteUtils.utf8ByteLength(value.source) + - 1 + - (value.global ? 1 : 0) + - (value.ignoreCase ? 1 : 0) + - (value.multiline ? 1 : 0) + - 1 - ); - } else if (value._bsontype === 'BSONRegExp') { - return ( - (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + - 1 + - ByteUtils.utf8ByteLength(value.pattern) + - 1 + - ByteUtils.utf8ByteLength(value.options) + - 1 - ); - } else { - return ( - (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + - internalCalculateObjectSize(value, serializeFunctions, ignoreUndefined) + - 1 - ); - } - case 'function': - if (serializeFunctions) { - return ( - (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + - 1 + - 4 + - ByteUtils.utf8ByteLength(value.toString()) + - 1 - ); - } - return 0; - case 'bigint': - return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1); - case 'symbol': - return 0; - default: - throw new BSONError(`Unrecognized JS type: ${typeof value}`); - } - - return 0; -} diff --git a/server/node_modules/bson/src/parser/deserializer.ts b/server/node_modules/bson/src/parser/deserializer.ts deleted file mode 100644 index 97bdd6bf..00000000 --- a/server/node_modules/bson/src/parser/deserializer.ts +++ /dev/null @@ -1,627 +0,0 @@ -import { Binary, UUID } from '../binary'; -import type { Document } from '../bson'; -import { Code } from '../code'; -import * as constants from '../constants'; -import { DBRef, type DBRefLike, isDBRefLike } from '../db_ref'; -import { Decimal128 } from '../decimal128'; -import { Double } from '../double'; -import { BSONError } from '../error'; -import { Int32 } from '../int_32'; -import { Long } from '../long'; -import { MaxKey } from '../max_key'; -import { MinKey } from '../min_key'; -import { ObjectId } from '../objectid'; -import { BSONRegExp } from '../regexp'; -import { BSONSymbol } from '../symbol'; -import { Timestamp } from '../timestamp'; -import { ByteUtils } from '../utils/byte_utils'; -import { NumberUtils } from '../utils/number_utils'; - -/** @public */ -export interface DeserializeOptions { - /** - * when deserializing a Long return as a BigInt. - * @defaultValue `false` - */ - useBigInt64?: boolean; - /** - * when deserializing a Long will fit it into a Number if it's smaller than 53 bits. - * @defaultValue `true` - */ - promoteLongs?: boolean; - /** - * when deserializing a Binary will return it as a node.js Buffer instance. - * @defaultValue `false` - */ - promoteBuffers?: boolean; - /** - * when deserializing will promote BSON values to their Node.js closest equivalent types. - * @defaultValue `true` - */ - promoteValues?: boolean; - /** - * allow to specify if there what fields we wish to return as unserialized raw buffer. - * @defaultValue `null` - */ - fieldsAsRaw?: Document; - /** - * return BSON regular expressions as BSONRegExp instances. - * @defaultValue `false` - */ - bsonRegExp?: boolean; - /** - * allows the buffer to be larger than the parsed BSON object. - * @defaultValue `false` - */ - allowObjectSmallerThanBufferSize?: boolean; - /** - * Offset into buffer to begin reading document from - * @defaultValue `0` - */ - index?: number; - - raw?: boolean; - /** Allows for opt-out utf-8 validation for all keys or - * specified keys. Must be all true or all false. - * - * @example - * ```js - * // disables validation on all keys - * validation: { utf8: false } - * - * // enables validation only on specified keys a, b, and c - * validation: { utf8: { a: true, b: true, c: true } } - * - * // disables validation only on specified keys a, b - * validation: { utf8: { a: false, b: false } } - * ``` - */ - validation?: { utf8: boolean | Record | Record }; -} - -// Internal long versions -const JS_INT_MAX_LONG = Long.fromNumber(constants.JS_INT_MAX); -const JS_INT_MIN_LONG = Long.fromNumber(constants.JS_INT_MIN); - -export function internalDeserialize( - buffer: Uint8Array, - options: DeserializeOptions, - isArray?: boolean -): Document { - options = options == null ? {} : options; - const index = options && options.index ? options.index : 0; - // Read the document size - const size = NumberUtils.getInt32LE(buffer, index); - - if (size < 5) { - throw new BSONError(`bson size must be >= 5, is ${size}`); - } - - if (options.allowObjectSmallerThanBufferSize && buffer.length < size) { - throw new BSONError(`buffer length ${buffer.length} must be >= bson size ${size}`); - } - - if (!options.allowObjectSmallerThanBufferSize && buffer.length !== size) { - throw new BSONError(`buffer length ${buffer.length} must === bson size ${size}`); - } - - if (size + index > buffer.byteLength) { - throw new BSONError( - `(bson size ${size} + options.index ${index} must be <= buffer length ${buffer.byteLength})` - ); - } - - // Illegal end value - if (buffer[index + size - 1] !== 0) { - throw new BSONError( - "One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00" - ); - } - - // Start deserialization - return deserializeObject(buffer, index, options, isArray); -} - -const allowedDBRefKeys = /^\$ref$|^\$id$|^\$db$/; - -function deserializeObject( - buffer: Uint8Array, - index: number, - options: DeserializeOptions, - isArray = false -) { - const fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw']; - - // Return raw bson buffer instead of parsing it - const raw = options['raw'] == null ? false : options['raw']; - - // Return BSONRegExp objects instead of native regular expressions - const bsonRegExp = typeof options['bsonRegExp'] === 'boolean' ? options['bsonRegExp'] : false; - - // Controls the promotion of values vs wrapper classes - const promoteBuffers = options.promoteBuffers ?? false; - const promoteLongs = options.promoteLongs ?? true; - const promoteValues = options.promoteValues ?? true; - const useBigInt64 = options.useBigInt64 ?? false; - - if (useBigInt64 && !promoteValues) { - throw new BSONError('Must either request bigint or Long for int64 deserialization'); - } - - if (useBigInt64 && !promoteLongs) { - throw new BSONError('Must either request bigint or Long for int64 deserialization'); - } - - // Ensures default validation option if none given - const validation = options.validation == null ? { utf8: true } : options.validation; - - // Shows if global utf-8 validation is enabled or disabled - let globalUTFValidation = true; - // Reflects utf-8 validation setting regardless of global or specific key validation - let validationSetting: boolean; - // Set of keys either to enable or disable validation on - let utf8KeysSet; - - // Check for boolean uniformity and empty validation option - const utf8ValidatedKeys = validation.utf8; - if (typeof utf8ValidatedKeys === 'boolean') { - validationSetting = utf8ValidatedKeys; - } else { - globalUTFValidation = false; - const utf8ValidationValues = Object.keys(utf8ValidatedKeys).map(function (key) { - return utf8ValidatedKeys[key]; - }); - if (utf8ValidationValues.length === 0) { - throw new BSONError('UTF-8 validation setting cannot be empty'); - } - if (typeof utf8ValidationValues[0] !== 'boolean') { - throw new BSONError('Invalid UTF-8 validation option, must specify boolean values'); - } - validationSetting = utf8ValidationValues[0]; - // Ensures boolean uniformity in utf-8 validation (all true or all false) - if (!utf8ValidationValues.every(item => item === validationSetting)) { - throw new BSONError('Invalid UTF-8 validation option - keys must be all true or all false'); - } - } - - // Add keys to set that will either be validated or not based on validationSetting - if (!globalUTFValidation) { - utf8KeysSet = new Set(); - - for (const key of Object.keys(utf8ValidatedKeys)) { - utf8KeysSet.add(key); - } - } - - // Set the start index - const startIndex = index; - - // Validate that we have at least 4 bytes of buffer - if (buffer.length < 5) throw new BSONError('corrupt bson message < 5 bytes long'); - - // Read the document size - const size = NumberUtils.getInt32LE(buffer, index); - index += 4; - - // Ensure buffer is valid size - if (size < 5 || size > buffer.length) throw new BSONError('corrupt bson message'); - - // Create holding object - const object: Document = isArray ? [] : {}; - // Used for arrays to skip having to perform utf8 decoding - let arrayIndex = 0; - const done = false; - - let isPossibleDBRef = isArray ? false : null; - - // While we have more left data left keep parsing - while (!done) { - // Read the type - const elementType = buffer[index++]; - - // If we get a zero it's the last byte, exit - if (elementType === 0) break; - - // Get the start search index - let i = index; - // Locate the end of the c string - while (buffer[i] !== 0x00 && i < buffer.length) { - i++; - } - - // If are at the end of the buffer there is a problem with the document - if (i >= buffer.byteLength) throw new BSONError('Bad BSON Document: illegal CString'); - - // Represents the key - const name = isArray ? arrayIndex++ : ByteUtils.toUTF8(buffer, index, i, false); - - // shouldValidateKey is true if the key should be validated, false otherwise - let shouldValidateKey = true; - if (globalUTFValidation || utf8KeysSet?.has(name)) { - shouldValidateKey = validationSetting; - } else { - shouldValidateKey = !validationSetting; - } - - if (isPossibleDBRef !== false && (name as string)[0] === '$') { - isPossibleDBRef = allowedDBRefKeys.test(name as string); - } - let value; - - index = i + 1; - - if (elementType === constants.BSON_DATA_STRING) { - const stringSize = NumberUtils.getInt32LE(buffer, index); - index += 4; - if ( - stringSize <= 0 || - stringSize > buffer.length - index || - buffer[index + stringSize - 1] !== 0 - ) { - throw new BSONError('bad string length in bson'); - } - value = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey); - index = index + stringSize; - } else if (elementType === constants.BSON_DATA_OID) { - const oid = ByteUtils.allocateUnsafe(12); - for (let i = 0; i < 12; i++) oid[i] = buffer[index + i]; - value = new ObjectId(oid); - index = index + 12; - } else if (elementType === constants.BSON_DATA_INT && promoteValues === false) { - value = new Int32(NumberUtils.getInt32LE(buffer, index)); - index += 4; - } else if (elementType === constants.BSON_DATA_INT) { - value = NumberUtils.getInt32LE(buffer, index); - index += 4; - } else if (elementType === constants.BSON_DATA_NUMBER) { - value = NumberUtils.getFloat64LE(buffer, index); - index += 8; - if (promoteValues === false) value = new Double(value); - } else if (elementType === constants.BSON_DATA_DATE) { - const lowBits = NumberUtils.getInt32LE(buffer, index); - const highBits = NumberUtils.getInt32LE(buffer, index + 4); - index += 8; - - value = new Date(new Long(lowBits, highBits).toNumber()); - } else if (elementType === constants.BSON_DATA_BOOLEAN) { - if (buffer[index] !== 0 && buffer[index] !== 1) - throw new BSONError('illegal boolean type value'); - value = buffer[index++] === 1; - } else if (elementType === constants.BSON_DATA_OBJECT) { - const _index = index; - const objectSize = NumberUtils.getInt32LE(buffer, index); - - if (objectSize <= 0 || objectSize > buffer.length - index) - throw new BSONError('bad embedded document length in bson'); - - // We have a raw value - if (raw) { - value = buffer.subarray(index, index + objectSize); - } else { - let objectOptions = options; - if (!globalUTFValidation) { - objectOptions = { ...options, validation: { utf8: shouldValidateKey } }; - } - value = deserializeObject(buffer, _index, objectOptions, false); - } - - index = index + objectSize; - } else if (elementType === constants.BSON_DATA_ARRAY) { - const _index = index; - const objectSize = NumberUtils.getInt32LE(buffer, index); - let arrayOptions: DeserializeOptions = options; - - // Stop index - const stopIndex = index + objectSize; - - // All elements of array to be returned as raw bson - if (fieldsAsRaw && fieldsAsRaw[name]) { - arrayOptions = { ...options, raw: true }; - } - - if (!globalUTFValidation) { - arrayOptions = { ...arrayOptions, validation: { utf8: shouldValidateKey } }; - } - value = deserializeObject(buffer, _index, arrayOptions, true); - index = index + objectSize; - - if (buffer[index - 1] !== 0) throw new BSONError('invalid array terminator byte'); - if (index !== stopIndex) throw new BSONError('corrupted array bson'); - } else if (elementType === constants.BSON_DATA_UNDEFINED) { - value = undefined; - } else if (elementType === constants.BSON_DATA_NULL) { - value = null; - } else if (elementType === constants.BSON_DATA_LONG) { - if (useBigInt64) { - value = NumberUtils.getBigInt64LE(buffer, index); - index += 8; - } else { - // Unpack the low and high bits - const lowBits = NumberUtils.getInt32LE(buffer, index); - const highBits = NumberUtils.getInt32LE(buffer, index + 4); - index += 8; - - const long = new Long(lowBits, highBits); - // Promote the long if possible - if (promoteLongs && promoteValues === true) { - value = - long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) - ? long.toNumber() - : long; - } else { - value = long; - } - } - } else if (elementType === constants.BSON_DATA_DECIMAL128) { - // Buffer to contain the decimal bytes - const bytes = ByteUtils.allocateUnsafe(16); - // Copy the next 16 bytes into the bytes buffer - for (let i = 0; i < 16; i++) bytes[i] = buffer[index + i]; - // Update index - index = index + 16; - // Assign the new Decimal128 value - value = new Decimal128(bytes); - } else if (elementType === constants.BSON_DATA_BINARY) { - let binarySize = NumberUtils.getInt32LE(buffer, index); - index += 4; - const totalBinarySize = binarySize; - const subType = buffer[index++]; - - // Did we have a negative binary size, throw - if (binarySize < 0) throw new BSONError('Negative binary type element size found'); - - // Is the length longer than the document - if (binarySize > buffer.byteLength) - throw new BSONError('Binary type size larger than document size'); - - // If we have subtype 2 skip the 4 bytes for the size - if (subType === Binary.SUBTYPE_BYTE_ARRAY) { - binarySize = NumberUtils.getInt32LE(buffer, index); - index += 4; - if (binarySize < 0) - throw new BSONError('Negative binary type element size found for subtype 0x02'); - if (binarySize > totalBinarySize - 4) - throw new BSONError('Binary type with subtype 0x02 contains too long binary size'); - if (binarySize < totalBinarySize - 4) - throw new BSONError('Binary type with subtype 0x02 contains too short binary size'); - } - - if (promoteBuffers && promoteValues) { - value = ByteUtils.toLocalBufferType(buffer.subarray(index, index + binarySize)); - } else { - value = new Binary(buffer.subarray(index, index + binarySize), subType); - if (subType === constants.BSON_BINARY_SUBTYPE_UUID_NEW && UUID.isValid(value)) { - value = value.toUUID(); - } - } - - // Update the index - index = index + binarySize; - } else if (elementType === constants.BSON_DATA_REGEXP && bsonRegExp === false) { - // Get the start search index - i = index; - // Locate the end of the c string - while (buffer[i] !== 0x00 && i < buffer.length) { - i++; - } - // If are at the end of the buffer there is a problem with the document - if (i >= buffer.length) throw new BSONError('Bad BSON Document: illegal CString'); - // Return the C string - const source = ByteUtils.toUTF8(buffer, index, i, false); - // Create the regexp - index = i + 1; - - // Get the start search index - i = index; - // Locate the end of the c string - while (buffer[i] !== 0x00 && i < buffer.length) { - i++; - } - // If are at the end of the buffer there is a problem with the document - if (i >= buffer.length) throw new BSONError('Bad BSON Document: illegal CString'); - // Return the C string - const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false); - index = i + 1; - - // For each option add the corresponding one for javascript - const optionsArray = new Array(regExpOptions.length); - - // Parse options - for (i = 0; i < regExpOptions.length; i++) { - switch (regExpOptions[i]) { - case 'm': - optionsArray[i] = 'm'; - break; - case 's': - optionsArray[i] = 'g'; - break; - case 'i': - optionsArray[i] = 'i'; - break; - } - } - - value = new RegExp(source, optionsArray.join('')); - } else if (elementType === constants.BSON_DATA_REGEXP && bsonRegExp === true) { - // Get the start search index - i = index; - // Locate the end of the c string - while (buffer[i] !== 0x00 && i < buffer.length) { - i++; - } - // If are at the end of the buffer there is a problem with the document - if (i >= buffer.length) throw new BSONError('Bad BSON Document: illegal CString'); - // Return the C string - const source = ByteUtils.toUTF8(buffer, index, i, false); - index = i + 1; - - // Get the start search index - i = index; - // Locate the end of the c string - while (buffer[i] !== 0x00 && i < buffer.length) { - i++; - } - // If are at the end of the buffer there is a problem with the document - if (i >= buffer.length) throw new BSONError('Bad BSON Document: illegal CString'); - // Return the C string - const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false); - index = i + 1; - - // Set the object - value = new BSONRegExp(source, regExpOptions); - } else if (elementType === constants.BSON_DATA_SYMBOL) { - const stringSize = NumberUtils.getInt32LE(buffer, index); - index += 4; - if ( - stringSize <= 0 || - stringSize > buffer.length - index || - buffer[index + stringSize - 1] !== 0 - ) { - throw new BSONError('bad string length in bson'); - } - const symbol = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey); - value = promoteValues ? symbol : new BSONSymbol(symbol); - index = index + stringSize; - } else if (elementType === constants.BSON_DATA_TIMESTAMP) { - value = new Timestamp({ - i: NumberUtils.getUint32LE(buffer, index), - t: NumberUtils.getUint32LE(buffer, index + 4) - }); - index += 8; - } else if (elementType === constants.BSON_DATA_MIN_KEY) { - value = new MinKey(); - } else if (elementType === constants.BSON_DATA_MAX_KEY) { - value = new MaxKey(); - } else if (elementType === constants.BSON_DATA_CODE) { - const stringSize = NumberUtils.getInt32LE(buffer, index); - index += 4; - if ( - stringSize <= 0 || - stringSize > buffer.length - index || - buffer[index + stringSize - 1] !== 0 - ) { - throw new BSONError('bad string length in bson'); - } - const functionString = ByteUtils.toUTF8( - buffer, - index, - index + stringSize - 1, - shouldValidateKey - ); - - value = new Code(functionString); - - // Update parse index position - index = index + stringSize; - } else if (elementType === constants.BSON_DATA_CODE_W_SCOPE) { - const totalSize = NumberUtils.getInt32LE(buffer, index); - index += 4; - - // Element cannot be shorter than totalSize + stringSize + documentSize + terminator - if (totalSize < 4 + 4 + 4 + 1) { - throw new BSONError('code_w_scope total size shorter minimum expected length'); - } - - // Get the code string size - const stringSize = NumberUtils.getInt32LE(buffer, index); - index += 4; - // Check if we have a valid string - if ( - stringSize <= 0 || - stringSize > buffer.length - index || - buffer[index + stringSize - 1] !== 0 - ) { - throw new BSONError('bad string length in bson'); - } - - // Javascript function - const functionString = ByteUtils.toUTF8( - buffer, - index, - index + stringSize - 1, - shouldValidateKey - ); - // Update parse index position - index = index + stringSize; - // Parse the element - const _index = index; - // Decode the size of the object document - const objectSize = NumberUtils.getInt32LE(buffer, index); - // Decode the scope object - const scopeObject = deserializeObject(buffer, _index, options, false); - // Adjust the index - index = index + objectSize; - - // Check if field length is too short - if (totalSize < 4 + 4 + objectSize + stringSize) { - throw new BSONError('code_w_scope total size is too short, truncating scope'); - } - - // Check if totalSize field is too long - if (totalSize > 4 + 4 + objectSize + stringSize) { - throw new BSONError('code_w_scope total size is too long, clips outer document'); - } - - value = new Code(functionString, scopeObject); - } else if (elementType === constants.BSON_DATA_DBPOINTER) { - // Get the code string size - const stringSize = NumberUtils.getInt32LE(buffer, index); - index += 4; - // Check if we have a valid string - if ( - stringSize <= 0 || - stringSize > buffer.length - index || - buffer[index + stringSize - 1] !== 0 - ) - throw new BSONError('bad string length in bson'); - // Namespace - const namespace = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey); - // Update parse index position - index = index + stringSize; - - // Read the oid - const oidBuffer = ByteUtils.allocateUnsafe(12); - for (let i = 0; i < 12; i++) oidBuffer[i] = buffer[index + i]; - const oid = new ObjectId(oidBuffer); - - // Update the index - index = index + 12; - - // Upgrade to DBRef type - value = new DBRef(namespace, oid); - } else { - throw new BSONError( - `Detected unknown BSON type ${elementType.toString(16)} for fieldname "${name}"` - ); - } - if (name === '__proto__') { - Object.defineProperty(object, name, { - value, - writable: true, - enumerable: true, - configurable: true - }); - } else { - object[name] = value; - } - } - - // Check if the deserialization was against a valid array/object - if (size !== index - startIndex) { - if (isArray) throw new BSONError('corrupt array bson'); - throw new BSONError('corrupt object bson'); - } - - // if we did not find "$ref", "$id", "$db", or found an extraneous $key, don't make a DBRef - if (!isPossibleDBRef) return object; - - if (isDBRefLike(object)) { - const copy = Object.assign({}, object) as Partial; - delete copy.$ref; - delete copy.$id; - delete copy.$db; - return new DBRef(object.$ref, object.$id, object.$db, copy); - } - - return object; -} diff --git a/server/node_modules/bson/src/parser/on_demand/index.ts b/server/node_modules/bson/src/parser/on_demand/index.ts deleted file mode 100644 index f099c115..00000000 --- a/server/node_modules/bson/src/parser/on_demand/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { ByteUtils } from '../../utils/byte_utils'; -import { NumberUtils } from '../../utils/number_utils'; -import { type BSONElement, parseToElements } from './parse_to_elements'; -/** - * @experimental - * @public - * - * A new set of BSON APIs that are currently experimental and not intended for production use. - */ -export type OnDemand = { - parseToElements: (this: void, bytes: Uint8Array, startOffset?: number) => Iterable; - // Types - BSONElement: BSONElement; - - // Utils - ByteUtils: ByteUtils; - NumberUtils: NumberUtils; -}; - -/** - * @experimental - * @public - */ -const onDemand: OnDemand = Object.create(null); - -onDemand.parseToElements = parseToElements; -onDemand.ByteUtils = ByteUtils; -onDemand.NumberUtils = NumberUtils; - -Object.freeze(onDemand); - -export { onDemand }; diff --git a/server/node_modules/bson/src/parser/on_demand/parse_to_elements.ts b/server/node_modules/bson/src/parser/on_demand/parse_to_elements.ts deleted file mode 100644 index cc5366aa..00000000 --- a/server/node_modules/bson/src/parser/on_demand/parse_to_elements.ts +++ /dev/null @@ -1,190 +0,0 @@ -import { BSONOffsetError } from '../../error'; -import { NumberUtils } from '../../utils/number_utils'; - -/** - * @internal - * - * @remarks - * - This enum is const so the code we produce will inline the numbers - * - `minKey` is set to 255 so unsigned comparisons succeed - * - Modify with caution, double check the bundle contains literals - */ -const BSONElementType = { - double: 1, - string: 2, - object: 3, - array: 4, - binData: 5, - undefined: 6, - objectId: 7, - bool: 8, - date: 9, - null: 10, - regex: 11, - dbPointer: 12, - javascript: 13, - symbol: 14, - javascriptWithScope: 15, - int: 16, - timestamp: 17, - long: 18, - decimal: 19, - minKey: 255, - maxKey: 127 -} as const; - -type BSONElementType = (typeof BSONElementType)[keyof typeof BSONElementType]; - -/** - * @public - * @experimental - */ -export type BSONElement = [ - type: number, - nameOffset: number, - nameLength: number, - offset: number, - length: number -]; - -function getSize(source: Uint8Array, offset: number) { - try { - return NumberUtils.getNonnegativeInt32LE(source, offset); - } catch (cause) { - throw new BSONOffsetError('BSON size cannot be negative', offset, { cause }); - } -} - -/** - * Searches for null terminator of a BSON element's value (Never the document null terminator) - * **Does not** bounds check since this should **ONLY** be used within parseToElements which has asserted that `bytes` ends with a `0x00`. - * So this will at most iterate to the document's terminator and error if that is the offset reached. - */ -function findNull(bytes: Uint8Array, offset: number): number { - let nullTerminatorOffset = offset; - - for (; bytes[nullTerminatorOffset] !== 0x00; nullTerminatorOffset++); - - if (nullTerminatorOffset === bytes.length - 1) { - // We reached the null terminator of the document, not a value's - throw new BSONOffsetError('Null terminator not found', offset); - } - - return nullTerminatorOffset; -} - -/** - * @public - * @experimental - */ -export function parseToElements( - bytes: Uint8Array, - startOffset: number | null = 0 -): Iterable { - startOffset ??= 0; - - if (bytes.length < 5) { - throw new BSONOffsetError( - `Input must be at least 5 bytes, got ${bytes.length} bytes`, - startOffset - ); - } - - const documentSize = getSize(bytes, startOffset); - - if (documentSize > bytes.length - startOffset) { - throw new BSONOffsetError( - `Parsed documentSize (${documentSize} bytes) does not match input length (${bytes.length} bytes)`, - startOffset - ); - } - - if (bytes[startOffset + documentSize - 1] !== 0x00) { - throw new BSONOffsetError('BSON documents must end in 0x00', startOffset + documentSize); - } - - const elements: BSONElement[] = []; - let offset = startOffset + 4; - - while (offset <= documentSize + startOffset) { - const type = bytes[offset]; - offset += 1; - - if (type === 0) { - if (offset - startOffset !== documentSize) { - throw new BSONOffsetError(`Invalid 0x00 type byte`, offset); - } - break; - } - - const nameOffset = offset; - const nameLength = findNull(bytes, offset) - nameOffset; - offset += nameLength + 1; - - let length: number; - - if ( - type === BSONElementType.double || - type === BSONElementType.long || - type === BSONElementType.date || - type === BSONElementType.timestamp - ) { - length = 8; - } else if (type === BSONElementType.int) { - length = 4; - } else if (type === BSONElementType.objectId) { - length = 12; - } else if (type === BSONElementType.decimal) { - length = 16; - } else if (type === BSONElementType.bool) { - length = 1; - } else if ( - type === BSONElementType.null || - type === BSONElementType.undefined || - type === BSONElementType.maxKey || - type === BSONElementType.minKey - ) { - length = 0; - } - // Needs a size calculation - else if (type === BSONElementType.regex) { - length = findNull(bytes, findNull(bytes, offset) + 1) + 1 - offset; - } else if ( - type === BSONElementType.object || - type === BSONElementType.array || - type === BSONElementType.javascriptWithScope - ) { - length = getSize(bytes, offset); - } else if ( - type === BSONElementType.string || - type === BSONElementType.binData || - type === BSONElementType.dbPointer || - type === BSONElementType.javascript || - type === BSONElementType.symbol - ) { - length = getSize(bytes, offset) + 4; - if (type === BSONElementType.binData) { - // binary subtype - length += 1; - } - if (type === BSONElementType.dbPointer) { - // dbPointer's objectId - length += 12; - } - } else { - throw new BSONOffsetError( - `Invalid 0x${type.toString(16).padStart(2, '0')} type byte`, - offset - ); - } - - if (length > documentSize) { - throw new BSONOffsetError('value reports length larger than document', offset); - } - - elements.push([type, nameOffset, nameLength, offset, length]); - offset += length; - } - - return elements; -} diff --git a/server/node_modules/bson/src/parser/serializer.ts b/server/node_modules/bson/src/parser/serializer.ts deleted file mode 100644 index d76bd842..00000000 --- a/server/node_modules/bson/src/parser/serializer.ts +++ /dev/null @@ -1,954 +0,0 @@ -import { Binary, validateBinaryVector } from '../binary'; -import type { BSONSymbol, DBRef, Document, MaxKey } from '../bson'; -import type { Code } from '../code'; -import * as constants from '../constants'; -import type { DBRefLike } from '../db_ref'; -import type { Decimal128 } from '../decimal128'; -import type { Double } from '../double'; -import { BSONError, BSONVersionError } from '../error'; -import type { Int32 } from '../int_32'; -import { Long } from '../long'; -import type { MinKey } from '../min_key'; -import type { ObjectId } from '../objectid'; -import type { BSONRegExp } from '../regexp'; -import { ByteUtils } from '../utils/byte_utils'; -import { NumberUtils } from '../utils/number_utils'; -import { isAnyArrayBuffer, isDate, isMap, isRegExp, isUint8Array } from './utils'; - -/** @public */ -export interface SerializeOptions { - /** - * the serializer will check if keys are valid. - * @defaultValue `false` - */ - checkKeys?: boolean; - /** - * serialize the javascript functions - * @defaultValue `false` - */ - serializeFunctions?: boolean; - /** - * serialize will not emit undefined fields - * note that the driver sets this to `false` - * @defaultValue `true` - */ - ignoreUndefined?: boolean; - /** @internal Resize internal buffer */ - minInternalBufferSize?: number; - /** - * the index in the buffer where we wish to start serializing into - * @defaultValue `0` - */ - index?: number; -} - -const regexp = /\x00/; // eslint-disable-line no-control-regex -const ignoreKeys = new Set(['$db', '$ref', '$id', '$clusterTime']); - -/* - * isArray indicates if we are writing to a BSON array (type 0x04) - * which forces the "key" which really an array index as a string to be written as ascii - * This will catch any errors in index as a string generation - */ - -function serializeString(buffer: Uint8Array, key: string, value: string, index: number) { - // Encode String type - buffer[index++] = constants.BSON_DATA_STRING; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write the string - const size = ByteUtils.encodeUTF8Into(buffer, value, index + 4); - // Write the size of the string to buffer - NumberUtils.setInt32LE(buffer, index, size + 1); - // Update index - index = index + 4 + size; - // Write zero - buffer[index++] = 0; - return index; -} - -function serializeNumber(buffer: Uint8Array, key: string, value: number, index: number) { - const isNegativeZero = Object.is(value, -0); - - const type = - !isNegativeZero && - Number.isSafeInteger(value) && - value <= constants.BSON_INT32_MAX && - value >= constants.BSON_INT32_MIN - ? constants.BSON_DATA_INT - : constants.BSON_DATA_NUMBER; - - buffer[index++] = type; - - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - index = index + numberOfWrittenBytes; - buffer[index++] = 0x00; - - if (type === constants.BSON_DATA_INT) { - index += NumberUtils.setInt32LE(buffer, index, value); - } else { - index += NumberUtils.setFloat64LE(buffer, index, value); - } - - return index; -} - -function serializeBigInt(buffer: Uint8Array, key: string, value: bigint, index: number) { - buffer[index++] = constants.BSON_DATA_LONG; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index += numberOfWrittenBytes; - buffer[index++] = 0; - - index += NumberUtils.setBigInt64LE(buffer, index, value); - - return index; -} - -function serializeNull(buffer: Uint8Array, key: string, _: unknown, index: number) { - // Set long type - buffer[index++] = constants.BSON_DATA_NULL; - - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - return index; -} - -function serializeBoolean(buffer: Uint8Array, key: string, value: boolean, index: number) { - // Write the type - buffer[index++] = constants.BSON_DATA_BOOLEAN; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Encode the boolean value - buffer[index++] = value ? 1 : 0; - return index; -} - -function serializeDate(buffer: Uint8Array, key: string, value: Date, index: number) { - // Write the type - buffer[index++] = constants.BSON_DATA_DATE; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - - // Write the date - const dateInMilis = Long.fromNumber(value.getTime()); - const lowBits = dateInMilis.getLowBits(); - const highBits = dateInMilis.getHighBits(); - // Encode low bits - index += NumberUtils.setInt32LE(buffer, index, lowBits); - // Encode high bits - index += NumberUtils.setInt32LE(buffer, index, highBits); - return index; -} - -function serializeRegExp(buffer: Uint8Array, key: string, value: RegExp, index: number) { - // Write the type - buffer[index++] = constants.BSON_DATA_REGEXP; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - if (value.source && value.source.match(regexp) != null) { - throw new BSONError('value ' + value.source + ' must not contain null bytes'); - } - // Adjust the index - index = index + ByteUtils.encodeUTF8Into(buffer, value.source, index); - // Write zero - buffer[index++] = 0x00; - // Write the parameters - if (value.ignoreCase) buffer[index++] = 0x69; // i - if (value.global) buffer[index++] = 0x73; // s - if (value.multiline) buffer[index++] = 0x6d; // m - - // Add ending zero - buffer[index++] = 0x00; - return index; -} - -function serializeBSONRegExp(buffer: Uint8Array, key: string, value: BSONRegExp, index: number) { - // Write the type - buffer[index++] = constants.BSON_DATA_REGEXP; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - - // Check the pattern for 0 bytes - if (value.pattern.match(regexp) != null) { - // The BSON spec doesn't allow keys with null bytes because keys are - // null-terminated. - throw new BSONError('pattern ' + value.pattern + ' must not contain null bytes'); - } - - // Adjust the index - index = index + ByteUtils.encodeUTF8Into(buffer, value.pattern, index); - // Write zero - buffer[index++] = 0x00; - // Write the options - const sortedOptions = value.options.split('').sort().join(''); - index = index + ByteUtils.encodeUTF8Into(buffer, sortedOptions, index); - // Add ending zero - buffer[index++] = 0x00; - return index; -} - -function serializeMinMax(buffer: Uint8Array, key: string, value: MinKey | MaxKey, index: number) { - // Write the type of either min or max key - if (value === null) { - buffer[index++] = constants.BSON_DATA_NULL; - } else if (value._bsontype === 'MinKey') { - buffer[index++] = constants.BSON_DATA_MIN_KEY; - } else { - buffer[index++] = constants.BSON_DATA_MAX_KEY; - } - - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - return index; -} - -function serializeObjectId(buffer: Uint8Array, key: string, value: ObjectId, index: number) { - // Write the type - buffer[index++] = constants.BSON_DATA_OID; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - - index += value.serializeInto(buffer, index); - - // Adjust index - return index; -} - -function serializeBuffer(buffer: Uint8Array, key: string, value: Uint8Array, index: number) { - // Write the type - buffer[index++] = constants.BSON_DATA_BINARY; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Get size of the buffer (current write point) - const size = value.length; - // Write the size of the string to buffer - index += NumberUtils.setInt32LE(buffer, index, size); - // Write the default subtype - buffer[index++] = constants.BSON_BINARY_SUBTYPE_DEFAULT; - // Copy the content form the binary field to the buffer - if (size <= 16) { - for (let i = 0; i < size; i++) buffer[index + i] = value[i]; - } else { - buffer.set(value, index); - } - // Adjust the index - index = index + size; - return index; -} - -function serializeObject( - buffer: Uint8Array, - key: string, - value: Document, - index: number, - checkKeys: boolean, - depth: number, - serializeFunctions: boolean, - ignoreUndefined: boolean, - path: Set -) { - if (path.has(value)) { - throw new BSONError('Cannot convert circular structure to BSON'); - } - - path.add(value); - - // Write the type - buffer[index++] = Array.isArray(value) ? constants.BSON_DATA_ARRAY : constants.BSON_DATA_OBJECT; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - const endIndex = serializeInto( - buffer, - value, - checkKeys, - index, - depth + 1, - serializeFunctions, - ignoreUndefined, - path - ); - - path.delete(value); - - return endIndex; -} - -function serializeDecimal128(buffer: Uint8Array, key: string, value: Decimal128, index: number) { - buffer[index++] = constants.BSON_DATA_DECIMAL128; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write the data from the value - for (let i = 0; i < 16; i++) buffer[index + i] = value.bytes[i]; - return index + 16; -} - -function serializeLong(buffer: Uint8Array, key: string, value: Long, index: number) { - // Write the type - buffer[index++] = - value._bsontype === 'Long' ? constants.BSON_DATA_LONG : constants.BSON_DATA_TIMESTAMP; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write the date - const lowBits = value.getLowBits(); - const highBits = value.getHighBits(); - // Encode low bits - index += NumberUtils.setInt32LE(buffer, index, lowBits); - // Encode high bits - index += NumberUtils.setInt32LE(buffer, index, highBits); - return index; -} - -function serializeInt32(buffer: Uint8Array, key: string, value: Int32 | number, index: number) { - value = value.valueOf(); - // Set int type 32 bits or less - buffer[index++] = constants.BSON_DATA_INT; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write the int value - index += NumberUtils.setInt32LE(buffer, index, value); - return index; -} - -function serializeDouble(buffer: Uint8Array, key: string, value: Double, index: number) { - // Encode as double - buffer[index++] = constants.BSON_DATA_NUMBER; - - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - - // Write float - index += NumberUtils.setFloat64LE(buffer, index, value.value); - - return index; -} - -function serializeFunction(buffer: Uint8Array, key: string, value: Function, index: number) { - buffer[index++] = constants.BSON_DATA_CODE; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Function string - const functionString = value.toString(); - - // Write the string - const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1; - // Write the size of the string to buffer - NumberUtils.setInt32LE(buffer, index, size); - // Update index - index = index + 4 + size - 1; - // Write zero - buffer[index++] = 0; - return index; -} - -function serializeCode( - buffer: Uint8Array, - key: string, - value: Code, - index: number, - checkKeys = false, - depth = 0, - serializeFunctions = false, - ignoreUndefined = true, - path: Set -) { - if (value.scope && typeof value.scope === 'object') { - // Write the type - buffer[index++] = constants.BSON_DATA_CODE_W_SCOPE; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - - // Starting index - let startIndex = index; - - // Serialize the function - // Get the function string - const functionString = value.code; - // Index adjustment - index = index + 4; - // Write string into buffer - const codeSize = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1; - // Write the size of the string to buffer - NumberUtils.setInt32LE(buffer, index, codeSize); - // Write end 0 - buffer[index + 4 + codeSize - 1] = 0; - // Write the - index = index + codeSize + 4; - - // Serialize the scope value - const endIndex = serializeInto( - buffer, - value.scope, - checkKeys, - index, - depth + 1, - serializeFunctions, - ignoreUndefined, - path - ); - index = endIndex - 1; - - // Writ the total - const totalSize = endIndex - startIndex; - - // Write the total size of the object - startIndex += NumberUtils.setInt32LE(buffer, startIndex, totalSize); - // Write trailing zero - buffer[index++] = 0; - } else { - buffer[index++] = constants.BSON_DATA_CODE; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Function string - const functionString = value.code.toString(); - // Write the string - const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1; - // Write the size of the string to buffer - NumberUtils.setInt32LE(buffer, index, size); - // Update index - index = index + 4 + size - 1; - // Write zero - buffer[index++] = 0; - } - - return index; -} - -function serializeBinary(buffer: Uint8Array, key: string, value: Binary, index: number) { - // Write the type - buffer[index++] = constants.BSON_DATA_BINARY; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Extract the buffer - const data = value.buffer; - // Calculate size - let size = value.position; - // Add the deprecated 02 type 4 bytes of size to total - if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) size = size + 4; - // Write the size of the string to buffer - index += NumberUtils.setInt32LE(buffer, index, size); - // Write the subtype to the buffer - buffer[index++] = value.sub_type; - - // If we have binary type 2 the 4 first bytes are the size - if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) { - size = size - 4; - index += NumberUtils.setInt32LE(buffer, index, size); - } - - if (value.sub_type === Binary.SUBTYPE_VECTOR) { - validateBinaryVector(value); - } - - if (size <= 16) { - for (let i = 0; i < size; i++) buffer[index + i] = data[i]; - } else { - buffer.set(data, index); - } - // Adjust the index - index = index + value.position; - return index; -} - -function serializeSymbol(buffer: Uint8Array, key: string, value: BSONSymbol, index: number) { - // Write the type - buffer[index++] = constants.BSON_DATA_SYMBOL; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write the string - const size = ByteUtils.encodeUTF8Into(buffer, value.value, index + 4) + 1; - // Write the size of the string to buffer - NumberUtils.setInt32LE(buffer, index, size); - // Update index - index = index + 4 + size - 1; - // Write zero - buffer[index++] = 0; - return index; -} - -function serializeDBRef( - buffer: Uint8Array, - key: string, - value: DBRef, - index: number, - depth: number, - serializeFunctions: boolean, - path: Set -) { - // Write the type - buffer[index++] = constants.BSON_DATA_OBJECT; - // Number of written bytes - const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index); - - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - - let startIndex = index; - let output: DBRefLike = { - $ref: value.collection || value.namespace, // "namespace" was what library 1.x called "collection" - $id: value.oid - }; - - if (value.db != null) { - output.$db = value.db; - } - - output = Object.assign(output, value.fields); - const endIndex = serializeInto( - buffer, - output, - false, - index, - depth + 1, - serializeFunctions, - true, - path - ); - - // Calculate object size - const size = endIndex - startIndex; - // Write the size - startIndex += NumberUtils.setInt32LE(buffer, index, size); - // Set index - return endIndex; -} - -export function serializeInto( - buffer: Uint8Array, - object: Document, - checkKeys: boolean, - startingIndex: number, - depth: number, - serializeFunctions: boolean, - ignoreUndefined: boolean, - path: Set | null -): number { - if (path == null) { - // We are at the root input - if (object == null) { - // ONLY the root should turn into an empty document - // BSON Empty document has a size of 5 (LE) - buffer[0] = 0x05; - buffer[1] = 0x00; - buffer[2] = 0x00; - buffer[3] = 0x00; - // All documents end with null terminator - buffer[4] = 0x00; - return 5; - } - - if (Array.isArray(object)) { - throw new BSONError('serialize does not support an array as the root input'); - } - if (typeof object !== 'object') { - throw new BSONError('serialize does not support non-object as the root input'); - } else if ('_bsontype' in object && typeof object._bsontype === 'string') { - throw new BSONError(`BSON types cannot be serialized as a document`); - } else if ( - isDate(object) || - isRegExp(object) || - isUint8Array(object) || - isAnyArrayBuffer(object) - ) { - throw new BSONError(`date, regexp, typedarray, and arraybuffer cannot be BSON documents`); - } - - path = new Set(); - } - - // Push the object to the path - path.add(object); - - // Start place to serialize into - let index = startingIndex + 4; - - // Special case isArray - if (Array.isArray(object)) { - // Get object keys - for (let i = 0; i < object.length; i++) { - const key = `${i}`; - let value = object[i]; - - // Is there an override value - if (typeof value?.toBSON === 'function') { - value = value.toBSON(); - } - - // Check the type of the value - const type = typeof value; - - if (value === undefined) { - index = serializeNull(buffer, key, value, index); - } else if (value === null) { - index = serializeNull(buffer, key, value, index); - } else if (type === 'string') { - index = serializeString(buffer, key, value, index); - } else if (type === 'number') { - index = serializeNumber(buffer, key, value, index); - } else if (type === 'bigint') { - index = serializeBigInt(buffer, key, value, index); - } else if (type === 'boolean') { - index = serializeBoolean(buffer, key, value, index); - } else if (type === 'object' && value._bsontype == null) { - if (value instanceof Date || isDate(value)) { - index = serializeDate(buffer, key, value, index); - } else if (value instanceof Uint8Array || isUint8Array(value)) { - index = serializeBuffer(buffer, key, value, index); - } else if (value instanceof RegExp || isRegExp(value)) { - index = serializeRegExp(buffer, key, value, index); - } else { - index = serializeObject( - buffer, - key, - value, - index, - checkKeys, - depth, - serializeFunctions, - ignoreUndefined, - path - ); - } - } else if (type === 'object') { - if (value[constants.BSON_VERSION_SYMBOL] !== constants.BSON_MAJOR_VERSION) { - throw new BSONVersionError(); - } else if (value._bsontype === 'ObjectId') { - index = serializeObjectId(buffer, key, value, index); - } else if (value._bsontype === 'Decimal128') { - index = serializeDecimal128(buffer, key, value, index); - } else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') { - index = serializeLong(buffer, key, value, index); - } else if (value._bsontype === 'Double') { - index = serializeDouble(buffer, key, value, index); - } else if (value._bsontype === 'Code') { - index = serializeCode( - buffer, - key, - value, - index, - checkKeys, - depth, - serializeFunctions, - ignoreUndefined, - path - ); - } else if (value._bsontype === 'Binary') { - index = serializeBinary(buffer, key, value, index); - } else if (value._bsontype === 'BSONSymbol') { - index = serializeSymbol(buffer, key, value, index); - } else if (value._bsontype === 'DBRef') { - index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path); - } else if (value._bsontype === 'BSONRegExp') { - index = serializeBSONRegExp(buffer, key, value, index); - } else if (value._bsontype === 'Int32') { - index = serializeInt32(buffer, key, value, index); - } else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') { - index = serializeMinMax(buffer, key, value, index); - } else if (typeof value._bsontype !== 'undefined') { - throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`); - } - } else if (type === 'function' && serializeFunctions) { - index = serializeFunction(buffer, key, value, index); - } - } - } else if (object instanceof Map || isMap(object)) { - const iterator = object.entries(); - let done = false; - - while (!done) { - // Unpack the next entry - const entry = iterator.next(); - done = !!entry.done; - // Are we done, then skip and terminate - if (done) continue; - - // Get the entry values - const key = entry.value ? entry.value[0] : undefined; - let value = entry.value ? entry.value[1] : undefined; - - if (typeof value?.toBSON === 'function') { - value = value.toBSON(); - } - - // Check the type of the value - const type = typeof value; - - // Check the key and throw error if it's illegal - if (typeof key === 'string' && !ignoreKeys.has(key)) { - if (key.match(regexp) != null) { - // The BSON spec doesn't allow keys with null bytes because keys are - // null-terminated. - throw new BSONError('key ' + key + ' must not contain null bytes'); - } - - if (checkKeys) { - if ('$' === key[0]) { - throw new BSONError('key ' + key + " must not start with '$'"); - } else if (key.includes('.')) { - throw new BSONError('key ' + key + " must not contain '.'"); - } - } - } - - if (value === undefined) { - if (ignoreUndefined === false) index = serializeNull(buffer, key, value, index); - } else if (value === null) { - index = serializeNull(buffer, key, value, index); - } else if (type === 'string') { - index = serializeString(buffer, key, value, index); - } else if (type === 'number') { - index = serializeNumber(buffer, key, value, index); - } else if (type === 'bigint') { - index = serializeBigInt(buffer, key, value, index); - } else if (type === 'boolean') { - index = serializeBoolean(buffer, key, value, index); - } else if (type === 'object' && value._bsontype == null) { - if (value instanceof Date || isDate(value)) { - index = serializeDate(buffer, key, value, index); - } else if (value instanceof Uint8Array || isUint8Array(value)) { - index = serializeBuffer(buffer, key, value, index); - } else if (value instanceof RegExp || isRegExp(value)) { - index = serializeRegExp(buffer, key, value, index); - } else { - index = serializeObject( - buffer, - key, - value, - index, - checkKeys, - depth, - serializeFunctions, - ignoreUndefined, - path - ); - } - } else if (type === 'object') { - if (value[constants.BSON_VERSION_SYMBOL] !== constants.BSON_MAJOR_VERSION) { - throw new BSONVersionError(); - } else if (value._bsontype === 'ObjectId') { - index = serializeObjectId(buffer, key, value, index); - } else if (value._bsontype === 'Decimal128') { - index = serializeDecimal128(buffer, key, value, index); - } else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') { - index = serializeLong(buffer, key, value, index); - } else if (value._bsontype === 'Double') { - index = serializeDouble(buffer, key, value, index); - } else if (value._bsontype === 'Code') { - index = serializeCode( - buffer, - key, - value, - index, - checkKeys, - depth, - serializeFunctions, - ignoreUndefined, - path - ); - } else if (value._bsontype === 'Binary') { - index = serializeBinary(buffer, key, value, index); - } else if (value._bsontype === 'BSONSymbol') { - index = serializeSymbol(buffer, key, value, index); - } else if (value._bsontype === 'DBRef') { - index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path); - } else if (value._bsontype === 'BSONRegExp') { - index = serializeBSONRegExp(buffer, key, value, index); - } else if (value._bsontype === 'Int32') { - index = serializeInt32(buffer, key, value, index); - } else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') { - index = serializeMinMax(buffer, key, value, index); - } else if (typeof value._bsontype !== 'undefined') { - throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`); - } - } else if (type === 'function' && serializeFunctions) { - index = serializeFunction(buffer, key, value, index); - } - } - } else { - if (typeof object?.toBSON === 'function') { - // Provided a custom serialization method - object = object.toBSON(); - if (object != null && typeof object !== 'object') { - throw new BSONError('toBSON function did not return an object'); - } - } - - // Iterate over all the keys - for (const key of Object.keys(object)) { - let value = object[key]; - // Is there an override value - if (typeof value?.toBSON === 'function') { - value = value.toBSON(); - } - - // Check the type of the value - const type = typeof value; - - // Check the key and throw error if it's illegal - if (typeof key === 'string' && !ignoreKeys.has(key)) { - if (key.match(regexp) != null) { - // The BSON spec doesn't allow keys with null bytes because keys are - // null-terminated. - throw new BSONError('key ' + key + ' must not contain null bytes'); - } - - if (checkKeys) { - if ('$' === key[0]) { - throw new BSONError('key ' + key + " must not start with '$'"); - } else if (key.includes('.')) { - throw new BSONError('key ' + key + " must not contain '.'"); - } - } - } - - if (value === undefined) { - if (ignoreUndefined === false) index = serializeNull(buffer, key, value, index); - } else if (value === null) { - index = serializeNull(buffer, key, value, index); - } else if (type === 'string') { - index = serializeString(buffer, key, value, index); - } else if (type === 'number') { - index = serializeNumber(buffer, key, value, index); - } else if (type === 'bigint') { - index = serializeBigInt(buffer, key, value, index); - } else if (type === 'boolean') { - index = serializeBoolean(buffer, key, value, index); - } else if (type === 'object' && value._bsontype == null) { - if (value instanceof Date || isDate(value)) { - index = serializeDate(buffer, key, value, index); - } else if (value instanceof Uint8Array || isUint8Array(value)) { - index = serializeBuffer(buffer, key, value, index); - } else if (value instanceof RegExp || isRegExp(value)) { - index = serializeRegExp(buffer, key, value, index); - } else { - index = serializeObject( - buffer, - key, - value, - index, - checkKeys, - depth, - serializeFunctions, - ignoreUndefined, - path - ); - } - } else if (type === 'object') { - if (value[constants.BSON_VERSION_SYMBOL] !== constants.BSON_MAJOR_VERSION) { - throw new BSONVersionError(); - } else if (value._bsontype === 'ObjectId') { - index = serializeObjectId(buffer, key, value, index); - } else if (value._bsontype === 'Decimal128') { - index = serializeDecimal128(buffer, key, value, index); - } else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') { - index = serializeLong(buffer, key, value, index); - } else if (value._bsontype === 'Double') { - index = serializeDouble(buffer, key, value, index); - } else if (value._bsontype === 'Code') { - index = serializeCode( - buffer, - key, - value, - index, - checkKeys, - depth, - serializeFunctions, - ignoreUndefined, - path - ); - } else if (value._bsontype === 'Binary') { - index = serializeBinary(buffer, key, value, index); - } else if (value._bsontype === 'BSONSymbol') { - index = serializeSymbol(buffer, key, value, index); - } else if (value._bsontype === 'DBRef') { - index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path); - } else if (value._bsontype === 'BSONRegExp') { - index = serializeBSONRegExp(buffer, key, value, index); - } else if (value._bsontype === 'Int32') { - index = serializeInt32(buffer, key, value, index); - } else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') { - index = serializeMinMax(buffer, key, value, index); - } else if (typeof value._bsontype !== 'undefined') { - throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`); - } - } else if (type === 'function' && serializeFunctions) { - index = serializeFunction(buffer, key, value, index); - } - } - } - - // Remove the path - path.delete(object); - - // Final padding byte for object - buffer[index++] = 0x00; - - // Final size - const size = index - startingIndex; - // Write the size of the object - startingIndex += NumberUtils.setInt32LE(buffer, startingIndex, size); - return index; -} diff --git a/server/node_modules/bson/src/parser/utils.ts b/server/node_modules/bson/src/parser/utils.ts deleted file mode 100644 index 2e383991..00000000 --- a/server/node_modules/bson/src/parser/utils.ts +++ /dev/null @@ -1,69 +0,0 @@ -const TypedArrayPrototypeGetSymbolToStringTag = (() => { - // Type check system lovingly referenced from: - // https://github.com/nodejs/node/blob/7450332339ed40481f470df2a3014e2ec355d8d8/lib/internal/util/types.js#L13-L15 - // eslint-disable-next-line @typescript-eslint/unbound-method -- the intention is to call this method with a bound value - const g = Object.getOwnPropertyDescriptor( - Object.getPrototypeOf(Uint8Array.prototype), - Symbol.toStringTag - )!.get!; - - return (value: unknown) => g.call(value); -})(); - -export function isUint8Array(value: unknown): value is Uint8Array { - return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Uint8Array'; -} - -export function isAnyArrayBuffer(value: unknown): value is ArrayBuffer { - return ( - typeof value === 'object' && - value != null && - Symbol.toStringTag in value && - (value[Symbol.toStringTag] === 'ArrayBuffer' || - value[Symbol.toStringTag] === 'SharedArrayBuffer') - ); -} - -export function isRegExp(regexp: unknown): regexp is RegExp { - return regexp instanceof RegExp || Object.prototype.toString.call(regexp) === '[object RegExp]'; -} - -export function isMap(value: unknown): value is Map { - return ( - typeof value === 'object' && - value != null && - Symbol.toStringTag in value && - value[Symbol.toStringTag] === 'Map' - ); -} - -export function isDate(date: unknown): date is Date { - return date instanceof Date || Object.prototype.toString.call(date) === '[object Date]'; -} - -export type InspectFn = (x: unknown, options?: unknown) => string; -export function defaultInspect(x: unknown, _options?: unknown): string { - return JSON.stringify(x, (k: string, v: unknown) => { - if (typeof v === 'bigint') { - return { $numberLong: `${v}` }; - } else if (isMap(v)) { - return Object.fromEntries(v); - } - return v; - }); -} - -/** @internal */ -type StylizeFunction = (x: string, style: string) => string; -/** @internal */ -export function getStylizeFunction(options?: unknown): StylizeFunction | undefined { - const stylizeExists = - options != null && - typeof options === 'object' && - 'stylize' in options && - typeof options.stylize === 'function'; - - if (stylizeExists) { - return options.stylize as StylizeFunction; - } -} diff --git a/server/node_modules/bson/src/regexp.ts b/server/node_modules/bson/src/regexp.ts deleted file mode 100644 index e401a290..00000000 --- a/server/node_modules/bson/src/regexp.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { BSONValue } from './bson_value'; -import { BSONError } from './error'; -import type { EJSONOptions } from './extended_json'; -import { type InspectFn, defaultInspect, getStylizeFunction } from './parser/utils'; - -function alphabetize(str: string): string { - return str.split('').sort().join(''); -} - -/** @public */ -export interface BSONRegExpExtendedLegacy { - $regex: string | BSONRegExp; - $options: string; -} - -/** @public */ -export interface BSONRegExpExtended { - $regularExpression: { - pattern: string; - options: string; - }; -} - -/** - * A class representation of the BSON RegExp type. - * @public - * @category BSONType - */ -export class BSONRegExp extends BSONValue { - get _bsontype(): 'BSONRegExp' { - return 'BSONRegExp'; - } - - pattern!: string; - options!: string; - /** - * @param pattern - The regular expression pattern to match - * @param options - The regular expression options - */ - constructor(pattern: string, options?: string) { - super(); - this.pattern = pattern; - this.options = alphabetize(options ?? ''); - - if (this.pattern.indexOf('\x00') !== -1) { - throw new BSONError( - `BSON Regex patterns cannot contain null bytes, found: ${JSON.stringify(this.pattern)}` - ); - } - if (this.options.indexOf('\x00') !== -1) { - throw new BSONError( - `BSON Regex options cannot contain null bytes, found: ${JSON.stringify(this.options)}` - ); - } - - // Validate options - for (let i = 0; i < this.options.length; i++) { - if ( - !( - this.options[i] === 'i' || - this.options[i] === 'm' || - this.options[i] === 'x' || - this.options[i] === 'l' || - this.options[i] === 's' || - this.options[i] === 'u' - ) - ) { - throw new BSONError(`The regular expression option [${this.options[i]}] is not supported`); - } - } - } - - static parseOptions(options?: string): string { - return options ? options.split('').sort().join('') : ''; - } - - /** @internal */ - toExtendedJSON(options?: EJSONOptions): BSONRegExpExtendedLegacy | BSONRegExpExtended { - options = options || {}; - if (options.legacy) { - return { $regex: this.pattern, $options: this.options }; - } - return { $regularExpression: { pattern: this.pattern, options: this.options } }; - } - - /** @internal */ - static fromExtendedJSON(doc: BSONRegExpExtendedLegacy | BSONRegExpExtended): BSONRegExp { - if ('$regex' in doc) { - if (typeof doc.$regex !== 'string') { - // This is for $regex query operators that have extended json values. - if (doc.$regex._bsontype === 'BSONRegExp') { - return doc as unknown as BSONRegExp; - } - } else { - return new BSONRegExp(doc.$regex, BSONRegExp.parseOptions(doc.$options)); - } - } - if ('$regularExpression' in doc) { - return new BSONRegExp( - doc.$regularExpression.pattern, - BSONRegExp.parseOptions(doc.$regularExpression.options) - ); - } - throw new BSONError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(doc)}`); - } - - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string { - const stylize = getStylizeFunction(options) ?? (v => v); - inspect ??= defaultInspect; - const pattern = stylize(inspect(this.pattern), 'regexp'); - const flags = stylize(inspect(this.options), 'regexp'); - return `new BSONRegExp(${pattern}, ${flags})`; - } -} diff --git a/server/node_modules/bson/src/symbol.ts b/server/node_modules/bson/src/symbol.ts deleted file mode 100644 index 6835ab95..00000000 --- a/server/node_modules/bson/src/symbol.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { BSONValue } from './bson_value'; -import { type InspectFn, defaultInspect } from './parser/utils'; - -/** @public */ -export interface BSONSymbolExtended { - $symbol: string; -} - -/** - * A class representation of the BSON Symbol type. - * @public - * @category BSONType - */ -export class BSONSymbol extends BSONValue { - get _bsontype(): 'BSONSymbol' { - return 'BSONSymbol'; - } - - value!: string; - /** - * @param value - the string representing the symbol. - */ - constructor(value: string) { - super(); - this.value = value; - } - - /** Access the wrapped string value. */ - valueOf(): string { - return this.value; - } - - toString(): string { - return this.value; - } - - toJSON(): string { - return this.value; - } - - /** @internal */ - toExtendedJSON(): BSONSymbolExtended { - return { $symbol: this.value }; - } - - /** @internal */ - static fromExtendedJSON(doc: BSONSymbolExtended): BSONSymbol { - return new BSONSymbol(doc.$symbol); - } - - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string { - inspect ??= defaultInspect; - return `new BSONSymbol(${inspect(this.value, options)})`; - } -} diff --git a/server/node_modules/bson/src/timestamp.ts b/server/node_modules/bson/src/timestamp.ts deleted file mode 100644 index 0cba6f69..00000000 --- a/server/node_modules/bson/src/timestamp.ts +++ /dev/null @@ -1,167 +0,0 @@ -import { BSONError } from './error'; -import type { Int32 } from './int_32'; -import { Long } from './long'; -import { type InspectFn, defaultInspect } from './parser/utils'; - -/** @public */ -export type TimestampOverrides = '_bsontype' | 'toExtendedJSON' | 'fromExtendedJSON' | 'inspect'; -/** @public */ -export type LongWithoutOverrides = new ( - low: unknown, - high?: number | boolean, - unsigned?: boolean -) => { - [P in Exclude]: Long[P]; -}; -/** @public */ -export const LongWithoutOverridesClass: LongWithoutOverrides = - Long as unknown as LongWithoutOverrides; - -/** @public */ -export interface TimestampExtended { - $timestamp: { - t: number; - i: number; - }; -} - -/** - * @public - * @category BSONType - * - * A special type for _internal_ MongoDB use and is **not** associated with the regular Date type. - */ -export class Timestamp extends LongWithoutOverridesClass { - get _bsontype(): 'Timestamp' { - return 'Timestamp'; - } - - static readonly MAX_VALUE = Long.MAX_UNSIGNED_VALUE; - - /** - * An incrementing ordinal for operations within a given second. - */ - get i(): number { - return this.low >>> 0; - } - - /** - * A `time_t` value measuring seconds since the Unix epoch - */ - get t(): number { - return this.high >>> 0; - } - - /** - * @param int - A 64-bit bigint representing the Timestamp. - */ - constructor(int: bigint); - /** - * @param long - A 64-bit Long representing the Timestamp. - */ - constructor(long: Long); - /** - * @param value - A pair of two values indicating timestamp and increment. - */ - constructor(value: { t: number; i: number }); - constructor(low?: bigint | Long | { t: number | Int32; i: number | Int32 }) { - if (low == null) { - super(0, 0, true); - } else if (typeof low === 'bigint') { - super(low, true); - } else if (Long.isLong(low)) { - super(low.low, low.high, true); - } else if (typeof low === 'object' && 't' in low && 'i' in low) { - if (typeof low.t !== 'number' && (typeof low.t !== 'object' || low.t._bsontype !== 'Int32')) { - throw new BSONError('Timestamp constructed from { t, i } must provide t as a number'); - } - if (typeof low.i !== 'number' && (typeof low.i !== 'object' || low.i._bsontype !== 'Int32')) { - throw new BSONError('Timestamp constructed from { t, i } must provide i as a number'); - } - const t = Number(low.t); - const i = Number(low.i); - if (t < 0 || Number.isNaN(t)) { - throw new BSONError('Timestamp constructed from { t, i } must provide a positive t'); - } - if (i < 0 || Number.isNaN(i)) { - throw new BSONError('Timestamp constructed from { t, i } must provide a positive i'); - } - if (t > 0xffff_ffff) { - throw new BSONError( - 'Timestamp constructed from { t, i } must provide t equal or less than uint32 max' - ); - } - if (i > 0xffff_ffff) { - throw new BSONError( - 'Timestamp constructed from { t, i } must provide i equal or less than uint32 max' - ); - } - - super(i, t, true); - } else { - throw new BSONError( - 'A Timestamp can only be constructed with: bigint, Long, or { t: number; i: number }' - ); - } - } - - toJSON(): { $timestamp: string } { - return { - $timestamp: this.toString() - }; - } - - /** Returns a Timestamp represented by the given (32-bit) integer value. */ - static fromInt(value: number): Timestamp { - return new Timestamp(Long.fromInt(value, true)); - } - - /** Returns a Timestamp representing the given number value, provided that it is a finite number. Otherwise, zero is returned. */ - static fromNumber(value: number): Timestamp { - return new Timestamp(Long.fromNumber(value, true)); - } - - /** - * Returns a Timestamp for the given high and low bits. Each is assumed to use 32 bits. - * - * @param lowBits - the low 32-bits. - * @param highBits - the high 32-bits. - */ - static fromBits(lowBits: number, highBits: number): Timestamp { - return new Timestamp({ i: lowBits, t: highBits }); - } - - /** - * Returns a Timestamp from the given string, optionally using the given radix. - * - * @param str - the textual representation of the Timestamp. - * @param optRadix - the radix in which the text is written. - */ - static fromString(str: string, optRadix: number): Timestamp { - return new Timestamp(Long.fromString(str, true, optRadix)); - } - - /** @internal */ - toExtendedJSON(): TimestampExtended { - return { $timestamp: { t: this.t, i: this.i } }; - } - - /** @internal */ - static fromExtendedJSON(doc: TimestampExtended): Timestamp { - // The Long check is necessary because extended JSON has different behavior given the size of the input number - const i = Long.isLong(doc.$timestamp.i) - ? doc.$timestamp.i.getLowBitsUnsigned() // Need to fetch the least significant 32 bits - : doc.$timestamp.i; - const t = Long.isLong(doc.$timestamp.t) - ? doc.$timestamp.t.getLowBitsUnsigned() // Need to fetch the least significant 32 bits - : doc.$timestamp.t; - return new Timestamp({ t, i }); - } - - inspect(depth?: number, options?: unknown, inspect?: InspectFn): string { - inspect ??= defaultInspect; - const t = inspect(this.t, options); - const i = inspect(this.i, options); - return `new Timestamp({ t: ${t}, i: ${i} })`; - } -} diff --git a/server/node_modules/bson/src/utils/byte_utils.ts b/server/node_modules/bson/src/utils/byte_utils.ts deleted file mode 100644 index 05e30515..00000000 --- a/server/node_modules/bson/src/utils/byte_utils.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { nodeJsByteUtils } from './node_byte_utils'; -import { webByteUtils } from './web_byte_utils'; - -/** - * @public - * @experimental - * - * A collection of functions that help work with data in a Uint8Array. - * ByteUtils is configured at load time to use Node.js or Web based APIs for the internal implementations. - */ -export type ByteUtils = { - /** Transforms the input to an instance of Buffer if running on node, otherwise Uint8Array */ - toLocalBufferType: (buffer: Uint8Array | ArrayBufferView | ArrayBuffer) => Uint8Array; - /** Create empty space of size */ - allocate: (size: number) => Uint8Array; - /** Create empty space of size, use pooled memory when available */ - allocateUnsafe: (size: number) => Uint8Array; - /** Check if two Uint8Arrays are deep equal */ - equals: (a: Uint8Array, b: Uint8Array) => boolean; - /** Check if two Uint8Arrays are deep equal */ - fromNumberArray: (array: number[]) => Uint8Array; - /** Create a Uint8Array from a base64 string */ - fromBase64: (base64: string) => Uint8Array; - /** Create a base64 string from bytes */ - toBase64: (buffer: Uint8Array) => string; - /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */ - fromISO88591: (codePoints: string) => Uint8Array; - /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */ - toISO88591: (buffer: Uint8Array) => string; - /** Create a Uint8Array from a hex string */ - fromHex: (hex: string) => Uint8Array; - /** Create a lowercase hex string from bytes */ - toHex: (buffer: Uint8Array) => string; - /** Create a string from utf8 code units, fatal=true will throw an error if UTF-8 bytes are invalid, fatal=false will insert replacement characters */ - toUTF8: (buffer: Uint8Array, start: number, end: number, fatal: boolean) => string; - /** Get the utf8 code unit count from a string if it were to be transformed to utf8 */ - utf8ByteLength: (input: string) => number; - /** Encode UTF8 bytes generated from `source` string into `destination` at byteOffset. Returns the number of bytes encoded. */ - encodeUTF8Into: (destination: Uint8Array, source: string, byteOffset: number) => number; - /** Generate a Uint8Array filled with random bytes with byteLength */ - randomBytes: (byteLength: number) => Uint8Array; - /** Interprets `buffer` as an array of 32-bit values and swaps the byte order in-place. */ - swap32: (buffer: Uint8Array) => Uint8Array; -}; - -declare const Buffer: { new (): unknown; prototype?: { _isBuffer?: boolean } } | undefined; - -/** - * Check that a global Buffer exists that is a function and - * does not have a '_isBuffer' property defined on the prototype - * (this is to prevent using the npm buffer) - */ -const hasGlobalBuffer = typeof Buffer === 'function' && Buffer.prototype?._isBuffer !== true; - -/** - * This is the only ByteUtils that should be used across the rest of the BSON library. - * - * The type annotation is important here, it asserts that each of the platform specific - * utils implementations are compatible with the common one. - * - * @internal - */ -export const ByteUtils: ByteUtils = hasGlobalBuffer ? nodeJsByteUtils : webByteUtils; diff --git a/server/node_modules/bson/src/utils/latin.ts b/server/node_modules/bson/src/utils/latin.ts deleted file mode 100644 index 5dd5c91f..00000000 --- a/server/node_modules/bson/src/utils/latin.ts +++ /dev/null @@ -1,104 +0,0 @@ -/** - * This function is an optimization for small basic latin strings. - * @internal - * @remarks - * ### Important characteristics: - * - If the uint8array or distance between start and end is 0 this function returns an empty string - * - If the byteLength of the string is 1, 2, or 3 we invoke String.fromCharCode and manually offset into the buffer - * - If the byteLength of the string is less than or equal to 20 an array of bytes is built and `String.fromCharCode.apply` is called with the result - * - If any byte exceeds 128 this function returns null - * - * @param uint8array - A sequence of bytes that may contain basic latin characters - * @param start - The start index from which to search the uint8array - * @param end - The index to stop searching the uint8array - * @returns string if all bytes are within the basic latin range, otherwise null - */ -export function tryReadBasicLatin( - uint8array: Uint8Array, - start: number, - end: number -): string | null { - if (uint8array.length === 0) { - return ''; - } - - const stringByteLength = end - start; - if (stringByteLength === 0) { - return ''; - } - - if (stringByteLength > 20) { - return null; - } - - if (stringByteLength === 1 && uint8array[start] < 128) { - return String.fromCharCode(uint8array[start]); - } - - if (stringByteLength === 2 && uint8array[start] < 128 && uint8array[start + 1] < 128) { - return String.fromCharCode(uint8array[start]) + String.fromCharCode(uint8array[start + 1]); - } - - if ( - stringByteLength === 3 && - uint8array[start] < 128 && - uint8array[start + 1] < 128 && - uint8array[start + 2] < 128 - ) { - return ( - String.fromCharCode(uint8array[start]) + - String.fromCharCode(uint8array[start + 1]) + - String.fromCharCode(uint8array[start + 2]) - ); - } - - const latinBytes = []; - for (let i = start; i < end; i++) { - const byte = uint8array[i]; - if (byte > 127) { - return null; - } - latinBytes.push(byte); - } - - return String.fromCharCode(...latinBytes); -} - -/** - * This function is an optimization for writing small basic latin strings. - * @internal - * @remarks - * ### Important characteristics: - * - If the string length is 0 return 0, do not perform any work - * - If a string is longer than 25 code units return null - * - If any code unit exceeds 128 this function returns null - * - * @param destination - The uint8array to serialize the string to - * @param source - The string to turn into UTF-8 bytes if it fits in the basic latin range - * @param offset - The position in the destination to begin writing bytes to - * @returns the number of bytes written to destination if all code units are below 128, otherwise null - */ -export function tryWriteBasicLatin( - destination: Uint8Array, - source: string, - offset: number -): number | null { - if (source.length === 0) return 0; - - if (source.length > 25) return null; - - if (destination.length - offset < source.length) return null; - - for ( - let charOffset = 0, destinationOffset = offset; - charOffset < source.length; - charOffset++, destinationOffset++ - ) { - const char = source.charCodeAt(charOffset); - if (char > 127) return null; - - destination[destinationOffset] = char; - } - - return source.length; -} diff --git a/server/node_modules/bson/src/utils/node_byte_utils.ts b/server/node_modules/bson/src/utils/node_byte_utils.ts deleted file mode 100644 index b47e723d..00000000 --- a/server/node_modules/bson/src/utils/node_byte_utils.ts +++ /dev/null @@ -1,168 +0,0 @@ -import { BSONError } from '../error'; -import { parseUtf8 } from '../parse_utf8'; -import { tryReadBasicLatin, tryWriteBasicLatin } from './latin'; - -type NodeJsEncoding = 'base64' | 'hex' | 'utf8' | 'binary'; -type NodeJsBuffer = ArrayBufferView & - Uint8Array & { - write(string: string, offset: number, length: undefined, encoding: 'utf8'): number; - copy(target: Uint8Array, targetStart: number, sourceStart: number, sourceEnd: number): number; - toString: (this: Uint8Array, encoding: NodeJsEncoding, start?: number, end?: number) => string; - equals: (this: Uint8Array, other: Uint8Array) => boolean; - swap32: (this: NodeJsBuffer) => NodeJsBuffer; - }; -type NodeJsBufferConstructor = Omit & { - alloc: (size: number) => NodeJsBuffer; - allocUnsafe: (size: number) => NodeJsBuffer; - from(array: number[]): NodeJsBuffer; - from(array: Uint8Array): NodeJsBuffer; - from(array: ArrayBuffer): NodeJsBuffer; - from(array: ArrayBuffer, byteOffset: number, byteLength: number): NodeJsBuffer; - from(base64: string, encoding: NodeJsEncoding): NodeJsBuffer; - byteLength(input: string, encoding: 'utf8'): number; - isBuffer(value: unknown): value is NodeJsBuffer; -}; - -// This can be nullish, but we gate the nodejs functions on being exported whether or not this exists -// Node.js global -declare const Buffer: NodeJsBufferConstructor; -declare const require: (mod: 'crypto') => { randomBytes: (byteLength: number) => Uint8Array }; - -/** @internal */ -export function nodejsMathRandomBytes(byteLength: number) { - return nodeJsByteUtils.fromNumberArray( - Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)) - ); -} - -/** - * @internal - * WARNING: REQUIRE WILL BE REWRITTEN - * - * This code is carefully used by require_rewriter.mjs any modifications must be reflected in the plugin. - * - * @remarks - * "crypto" is the only dependency BSON needs. This presents a problem for creating a bundle of the BSON library - * in an es module format that can be used both on the browser and in Node.js. In Node.js when BSON is imported as - * an es module, there will be no global require function defined, making the code below fallback to the much less desireable math.random bytes. - * In order to make our es module bundle work as expected on Node.js we need to change this `require()` to a dynamic import, and the dynamic - * import must be top-level awaited since es modules are async. So we rely on a custom rollup plugin to seek out the following lines of code - * and replace `require` with `await import` and the IIFE line (`nodejsRandomBytes = (() => { ... })()`) with `nodejsRandomBytes = await (async () => { ... })()` - * when generating an es module bundle. - */ -const nodejsRandomBytes: (byteLength: number) => Uint8Array = (() => { - try { - return require('crypto').randomBytes; - } catch { - return nodejsMathRandomBytes; - } -})(); - -/** @internal */ -export const nodeJsByteUtils = { - toLocalBufferType(potentialBuffer: Uint8Array | NodeJsBuffer | ArrayBuffer): NodeJsBuffer { - if (Buffer.isBuffer(potentialBuffer)) { - return potentialBuffer; - } - - if (ArrayBuffer.isView(potentialBuffer)) { - return Buffer.from( - potentialBuffer.buffer, - potentialBuffer.byteOffset, - potentialBuffer.byteLength - ); - } - - const stringTag = - potentialBuffer?.[Symbol.toStringTag] ?? Object.prototype.toString.call(potentialBuffer); - if ( - stringTag === 'ArrayBuffer' || - stringTag === 'SharedArrayBuffer' || - stringTag === '[object ArrayBuffer]' || - stringTag === '[object SharedArrayBuffer]' - ) { - return Buffer.from(potentialBuffer); - } - - throw new BSONError(`Cannot create Buffer from the passed potentialBuffer.`); - }, - - allocate(size: number): NodeJsBuffer { - return Buffer.alloc(size); - }, - - allocateUnsafe(size: number): NodeJsBuffer { - return Buffer.allocUnsafe(size); - }, - - equals(a: Uint8Array, b: Uint8Array): boolean { - return nodeJsByteUtils.toLocalBufferType(a).equals(b); - }, - - fromNumberArray(array: number[]): NodeJsBuffer { - return Buffer.from(array); - }, - - fromBase64(base64: string): NodeJsBuffer { - return Buffer.from(base64, 'base64'); - }, - - toBase64(buffer: Uint8Array): string { - return nodeJsByteUtils.toLocalBufferType(buffer).toString('base64'); - }, - - /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */ - fromISO88591(codePoints: string): NodeJsBuffer { - return Buffer.from(codePoints, 'binary'); - }, - - /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */ - toISO88591(buffer: Uint8Array): string { - return nodeJsByteUtils.toLocalBufferType(buffer).toString('binary'); - }, - - fromHex(hex: string): NodeJsBuffer { - return Buffer.from(hex, 'hex'); - }, - - toHex(buffer: Uint8Array): string { - return nodeJsByteUtils.toLocalBufferType(buffer).toString('hex'); - }, - - toUTF8(buffer: Uint8Array, start: number, end: number, fatal: boolean): string { - const basicLatin = end - start <= 20 ? tryReadBasicLatin(buffer, start, end) : null; - if (basicLatin != null) { - return basicLatin; - } - - const string = nodeJsByteUtils.toLocalBufferType(buffer).toString('utf8', start, end); - if (fatal) { - for (let i = 0; i < string.length; i++) { - if (string.charCodeAt(i) === 0xfffd) { - parseUtf8(buffer, start, end, true); - break; - } - } - } - return string; - }, - - utf8ByteLength(input: string): number { - return Buffer.byteLength(input, 'utf8'); - }, - - encodeUTF8Into(buffer: Uint8Array, source: string, byteOffset: number): number { - const latinBytesWritten = tryWriteBasicLatin(buffer, source, byteOffset); - if (latinBytesWritten != null) { - return latinBytesWritten; - } - - return nodeJsByteUtils.toLocalBufferType(buffer).write(source, byteOffset, undefined, 'utf8'); - }, - - randomBytes: nodejsRandomBytes, - - swap32(buffer: Uint8Array): NodeJsBuffer { - return nodeJsByteUtils.toLocalBufferType(buffer).swap32(); - } -}; diff --git a/server/node_modules/bson/src/utils/number_utils.ts b/server/node_modules/bson/src/utils/number_utils.ts deleted file mode 100644 index 5970a963..00000000 --- a/server/node_modules/bson/src/utils/number_utils.ts +++ /dev/null @@ -1,213 +0,0 @@ -const FLOAT = new Float64Array(1); -const FLOAT_BYTES = new Uint8Array(FLOAT.buffer, 0, 8); - -FLOAT[0] = -1; -// Little endian [0, 0, 0, 0, 0, 0, 240, 191] -// Big endian [191, 240, 0, 0, 0, 0, 0, 0] -const isBigEndian = FLOAT_BYTES[7] === 0; - -/** - * @experimental - * @public - * - * A collection of functions that get or set various numeric types and bit widths from a Uint8Array. - */ -export type NumberUtils = { - /** Is true if the current system is big endian. */ - isBigEndian: boolean; - /** - * Parses a signed int32 at offset. Throws a `RangeError` if value is negative. - */ - getNonnegativeInt32LE: (source: Uint8Array, offset: number) => number; - getInt32LE: (source: Uint8Array, offset: number) => number; - getUint32LE: (source: Uint8Array, offset: number) => number; - getUint32BE: (source: Uint8Array, offset: number) => number; - getBigInt64LE: (source: Uint8Array, offset: number) => bigint; - getFloat64LE: (source: Uint8Array, offset: number) => number; - setInt32BE: (destination: Uint8Array, offset: number, value: number) => 4; - setInt32LE: (destination: Uint8Array, offset: number, value: number) => 4; - setBigInt64LE: (destination: Uint8Array, offset: number, value: bigint) => 8; - setFloat64LE: (destination: Uint8Array, offset: number, value: number) => 8; -}; - -/** - * Number parsing and serializing utilities. - * - * @experimental - * @public - */ -export const NumberUtils: NumberUtils = { - isBigEndian, - - getNonnegativeInt32LE(source: Uint8Array, offset: number): number { - if (source[offset + 3] > 127) { - throw new RangeError(`Size cannot be negative at offset: ${offset}`); - } - return ( - source[offset] | - (source[offset + 1] << 8) | - (source[offset + 2] << 16) | - (source[offset + 3] << 24) - ); - }, - - /** Reads a little-endian 32-bit integer from source */ - getInt32LE(source: Uint8Array, offset: number): number { - return ( - source[offset] | - (source[offset + 1] << 8) | - (source[offset + 2] << 16) | - (source[offset + 3] << 24) - ); - }, - - /** Reads a little-endian 32-bit unsigned integer from source */ - getUint32LE(source: Uint8Array, offset: number): number { - return ( - source[offset] + - source[offset + 1] * 256 + - source[offset + 2] * 65536 + - source[offset + 3] * 16777216 - ); - }, - - /** Reads a big-endian 32-bit integer from source */ - getUint32BE(source: Uint8Array, offset: number): number { - return ( - source[offset + 3] + - source[offset + 2] * 256 + - source[offset + 1] * 65536 + - source[offset] * 16777216 - ); - }, - - /** Reads a little-endian 64-bit integer from source */ - getBigInt64LE(source: Uint8Array, offset: number): bigint { - // eslint-disable-next-line no-restricted-globals - const hi = BigInt( - source[offset + 4] + - source[offset + 5] * 256 + - source[offset + 6] * 65536 + - (source[offset + 7] << 24) - ); // Overflow - - // eslint-disable-next-line no-restricted-globals - const lo = BigInt( - source[offset] + - source[offset + 1] * 256 + - source[offset + 2] * 65536 + - source[offset + 3] * 16777216 - ); - // eslint-disable-next-line no-restricted-globals - return (hi << BigInt(32)) + lo; - }, - - /** Reads a little-endian 64-bit float from source */ - getFloat64LE: isBigEndian - ? (source: Uint8Array, offset: number) => { - FLOAT_BYTES[7] = source[offset]; - FLOAT_BYTES[6] = source[offset + 1]; - FLOAT_BYTES[5] = source[offset + 2]; - FLOAT_BYTES[4] = source[offset + 3]; - FLOAT_BYTES[3] = source[offset + 4]; - FLOAT_BYTES[2] = source[offset + 5]; - FLOAT_BYTES[1] = source[offset + 6]; - FLOAT_BYTES[0] = source[offset + 7]; - return FLOAT[0]; - } - : (source: Uint8Array, offset: number) => { - FLOAT_BYTES[0] = source[offset]; - FLOAT_BYTES[1] = source[offset + 1]; - FLOAT_BYTES[2] = source[offset + 2]; - FLOAT_BYTES[3] = source[offset + 3]; - FLOAT_BYTES[4] = source[offset + 4]; - FLOAT_BYTES[5] = source[offset + 5]; - FLOAT_BYTES[6] = source[offset + 6]; - FLOAT_BYTES[7] = source[offset + 7]; - return FLOAT[0]; - }, - - /** Writes a big-endian 32-bit integer to destination, can be signed or unsigned */ - setInt32BE(destination: Uint8Array, offset: number, value: number): 4 { - destination[offset + 3] = value; - value >>>= 8; - destination[offset + 2] = value; - value >>>= 8; - destination[offset + 1] = value; - value >>>= 8; - destination[offset] = value; - return 4; - }, - - /** Writes a little-endian 32-bit integer to destination, can be signed or unsigned */ - setInt32LE(destination: Uint8Array, offset: number, value: number): 4 { - destination[offset] = value; - value >>>= 8; - destination[offset + 1] = value; - value >>>= 8; - destination[offset + 2] = value; - value >>>= 8; - destination[offset + 3] = value; - return 4; - }, - - /** Write a little-endian 64-bit integer to source */ - setBigInt64LE(destination: Uint8Array, offset: number, value: bigint): 8 { - /* eslint-disable-next-line no-restricted-globals -- This is allowed here as useBigInt64=true */ - const mask32bits = BigInt(0xffff_ffff); - - /** lower 32 bits */ - let lo = Number(value & mask32bits); - destination[offset] = lo; - lo >>= 8; - destination[offset + 1] = lo; - lo >>= 8; - destination[offset + 2] = lo; - lo >>= 8; - destination[offset + 3] = lo; - - /* - eslint-disable-next-line no-restricted-globals - -- This is allowed here as useBigInt64=true - - upper 32 bits - */ - let hi = Number((value >> BigInt(32)) & mask32bits); - destination[offset + 4] = hi; - hi >>= 8; - destination[offset + 5] = hi; - hi >>= 8; - destination[offset + 6] = hi; - hi >>= 8; - destination[offset + 7] = hi; - - return 8; - }, - - /** Writes a little-endian 64-bit float to destination */ - setFloat64LE: isBigEndian - ? (destination: Uint8Array, offset: number, value: number) => { - FLOAT[0] = value; - destination[offset] = FLOAT_BYTES[7]; - destination[offset + 1] = FLOAT_BYTES[6]; - destination[offset + 2] = FLOAT_BYTES[5]; - destination[offset + 3] = FLOAT_BYTES[4]; - destination[offset + 4] = FLOAT_BYTES[3]; - destination[offset + 5] = FLOAT_BYTES[2]; - destination[offset + 6] = FLOAT_BYTES[1]; - destination[offset + 7] = FLOAT_BYTES[0]; - return 8; - } - : (destination: Uint8Array, offset: number, value: number) => { - FLOAT[0] = value; - destination[offset] = FLOAT_BYTES[0]; - destination[offset + 1] = FLOAT_BYTES[1]; - destination[offset + 2] = FLOAT_BYTES[2]; - destination[offset + 3] = FLOAT_BYTES[3]; - destination[offset + 4] = FLOAT_BYTES[4]; - destination[offset + 5] = FLOAT_BYTES[5]; - destination[offset + 6] = FLOAT_BYTES[6]; - destination[offset + 7] = FLOAT_BYTES[7]; - return 8; - } -}; diff --git a/server/node_modules/bson/src/utils/string_utils.ts b/server/node_modules/bson/src/utils/string_utils.ts deleted file mode 100644 index 1ffb118e..00000000 --- a/server/node_modules/bson/src/utils/string_utils.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @internal - * Removes leading zeros and explicit plus from textual representation of a number. - */ -export function removeLeadingZerosAndExplicitPlus(str: string): string { - if (str === '') { - return str; - } - - let startIndex = 0; - - const isNegative = str[startIndex] === '-'; - const isExplicitlyPositive = str[startIndex] === '+'; - - if (isExplicitlyPositive || isNegative) { - startIndex += 1; - } - - let foundInsignificantZero = false; - - for (; startIndex < str.length && str[startIndex] === '0'; ++startIndex) { - foundInsignificantZero = true; - } - - if (!foundInsignificantZero) { - return isExplicitlyPositive ? str.slice(1) : str; - } - - return `${isNegative ? '-' : ''}${str.length === startIndex ? '0' : str.slice(startIndex)}`; -} - -/** - * @internal - * Returns false for an string that contains invalid characters for its radix, else returns the original string. - * @param str - The textual representation of the Long - * @param radix - The radix in which the text is written (2-36), defaults to 10 - */ -export function validateStringCharacters(str: string, radix?: number): false | string { - radix = radix ?? 10; - const validCharacters = '0123456789abcdefghijklmnopqrstuvwxyz'.slice(0, radix); - // regex is case insensitive and checks that each character within the string is one of the validCharacters - const regex = new RegExp(`[^-+${validCharacters}]`, 'i'); - return regex.test(str) ? false : str; -} diff --git a/server/node_modules/bson/src/utils/web_byte_utils.ts b/server/node_modules/bson/src/utils/web_byte_utils.ts deleted file mode 100644 index 336d37ed..00000000 --- a/server/node_modules/bson/src/utils/web_byte_utils.ts +++ /dev/null @@ -1,216 +0,0 @@ -import { BSONError } from '../error'; -import { tryReadBasicLatin } from './latin'; -import { parseUtf8 } from '../parse_utf8'; - -type TextDecoder = { - readonly encoding: string; - readonly fatal: boolean; - readonly ignoreBOM: boolean; - decode(input?: Uint8Array): string; -}; -type TextDecoderConstructor = { - new (label: 'utf8', options: { fatal: boolean; ignoreBOM?: boolean }): TextDecoder; -}; - -type TextEncoder = { - readonly encoding: string; - encode(input?: string): Uint8Array; -}; -type TextEncoderConstructor = { - new (): TextEncoder; -}; - -// Web global -declare const TextDecoder: TextDecoderConstructor; -declare const TextEncoder: TextEncoderConstructor; -declare const atob: (base64: string) => string; -declare const btoa: (binary: string) => string; - -type ArrayBufferViewWithTag = ArrayBufferView & { - [Symbol.toStringTag]?: string; -}; - -function isReactNative() { - const { navigator } = globalThis as { navigator?: { product?: string } }; - return typeof navigator === 'object' && navigator.product === 'ReactNative'; -} - -/** @internal */ -export function webMathRandomBytes(byteLength: number) { - if (byteLength < 0) { - throw new RangeError(`The argument 'byteLength' is invalid. Received ${byteLength}`); - } - return webByteUtils.fromNumberArray( - Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)) - ); -} - -/** @internal */ -const webRandomBytes: (byteLength: number) => Uint8Array = (() => { - const { crypto } = globalThis as { - crypto?: { getRandomValues?: (space: Uint8Array) => Uint8Array }; - }; - if (crypto != null && typeof crypto.getRandomValues === 'function') { - return (byteLength: number) => { - // @ts-expect-error: crypto.getRandomValues cannot actually be null here - // You cannot separate getRandomValues from crypto (need to have this === crypto) - return crypto.getRandomValues(webByteUtils.allocate(byteLength)); - }; - } else { - if (isReactNative()) { - const { console } = globalThis as { console?: { warn?: (message: string) => void } }; - console?.warn?.( - 'BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.' - ); - } - return webMathRandomBytes; - } -})(); - -const HEX_DIGIT = /(\d|[a-f])/i; - -/** @internal */ -export const webByteUtils = { - toLocalBufferType( - potentialUint8array: Uint8Array | ArrayBufferViewWithTag | ArrayBuffer - ): Uint8Array { - const stringTag = - potentialUint8array?.[Symbol.toStringTag] ?? - Object.prototype.toString.call(potentialUint8array); - - if (stringTag === 'Uint8Array') { - return potentialUint8array as Uint8Array; - } - - if (ArrayBuffer.isView(potentialUint8array)) { - return new Uint8Array( - potentialUint8array.buffer.slice( - potentialUint8array.byteOffset, - potentialUint8array.byteOffset + potentialUint8array.byteLength - ) - ); - } - - if ( - stringTag === 'ArrayBuffer' || - stringTag === 'SharedArrayBuffer' || - stringTag === '[object ArrayBuffer]' || - stringTag === '[object SharedArrayBuffer]' - ) { - return new Uint8Array(potentialUint8array); - } - - throw new BSONError(`Cannot make a Uint8Array from passed potentialBuffer.`); - }, - - allocate(size: number): Uint8Array { - if (typeof size !== 'number') { - throw new TypeError(`The "size" argument must be of type number. Received ${String(size)}`); - } - return new Uint8Array(size); - }, - - allocateUnsafe(size: number): Uint8Array { - return webByteUtils.allocate(size); - }, - - equals(a: Uint8Array, b: Uint8Array): boolean { - if (a.byteLength !== b.byteLength) { - return false; - } - for (let i = 0; i < a.byteLength; i++) { - if (a[i] !== b[i]) { - return false; - } - } - return true; - }, - - fromNumberArray(array: number[]): Uint8Array { - return Uint8Array.from(array); - }, - - fromBase64(base64: string): Uint8Array { - return Uint8Array.from(atob(base64), c => c.charCodeAt(0)); - }, - - toBase64(uint8array: Uint8Array): string { - return btoa(webByteUtils.toISO88591(uint8array)); - }, - - /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */ - fromISO88591(codePoints: string): Uint8Array { - return Uint8Array.from(codePoints, c => c.charCodeAt(0) & 0xff); - }, - - /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */ - toISO88591(uint8array: Uint8Array): string { - return Array.from(Uint16Array.from(uint8array), b => String.fromCharCode(b)).join(''); - }, - - fromHex(hex: string): Uint8Array { - const evenLengthHex = hex.length % 2 === 0 ? hex : hex.slice(0, hex.length - 1); - const buffer = []; - - for (let i = 0; i < evenLengthHex.length; i += 2) { - const firstDigit = evenLengthHex[i]; - const secondDigit = evenLengthHex[i + 1]; - - if (!HEX_DIGIT.test(firstDigit)) { - break; - } - if (!HEX_DIGIT.test(secondDigit)) { - break; - } - - const hexDigit = Number.parseInt(`${firstDigit}${secondDigit}`, 16); - buffer.push(hexDigit); - } - - return Uint8Array.from(buffer); - }, - - toHex(uint8array: Uint8Array): string { - return Array.from(uint8array, byte => byte.toString(16).padStart(2, '0')).join(''); - }, - - toUTF8(uint8array: Uint8Array, start: number, end: number, fatal: boolean): string { - const basicLatin = end - start <= 20 ? tryReadBasicLatin(uint8array, start, end) : null; - if (basicLatin != null) { - return basicLatin; - } - - return parseUtf8(uint8array, start, end, fatal); - }, - - utf8ByteLength(input: string): number { - return new TextEncoder().encode(input).byteLength; - }, - - encodeUTF8Into(uint8array: Uint8Array, source: string, byteOffset: number): number { - const bytes = new TextEncoder().encode(source); - uint8array.set(bytes, byteOffset); - return bytes.byteLength; - }, - - randomBytes: webRandomBytes, - - swap32(buffer: Uint8Array): Uint8Array { - if (buffer.length % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits'); - } - - for (let i = 0; i < buffer.length; i += 4) { - const byte0 = buffer[i]; - const byte1 = buffer[i + 1]; - const byte2 = buffer[i + 2]; - const byte3 = buffer[i + 3]; - buffer[i] = byte3; - buffer[i + 1] = byte2; - buffer[i + 2] = byte1; - buffer[i + 3] = byte0; - } - - return buffer; - } -}; diff --git a/server/node_modules/bson/vendor/base64/LICENSE-MIT.txt b/server/node_modules/bson/vendor/base64/LICENSE-MIT.txt deleted file mode 100644 index a41e0a7e..00000000 --- a/server/node_modules/bson/vendor/base64/LICENSE-MIT.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright Mathias Bynens - -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/bson/vendor/base64/README.md b/server/node_modules/bson/vendor/base64/README.md deleted file mode 100644 index ab0ef251..00000000 --- a/server/node_modules/bson/vendor/base64/README.md +++ /dev/null @@ -1,112 +0,0 @@ -# base64 [![Build status](https://travis-ci.org/mathiasbynens/base64.svg?branch=master)](https://travis-ci.org/mathiasbynens/base64) [![Code coverage status](http://img.shields.io/coveralls/mathiasbynens/base64/master.svg)](https://coveralls.io/r/mathiasbynens/base64) - -_base64_ is a robust base64 encoder/decoder that is fully compatible with [`atob()` and `btoa()`](https://html.spec.whatwg.org/multipage/webappapis.html#atob), written in JavaScript. The base64-encoding and -decoding algorithms it uses are fully [RFC 4648](https://tools.ietf.org/html/rfc4648#section-4) compliant. - -## Installation - -Via [npm](https://www.npmjs.com/): - -```bash -npm install base-64 -``` - -In a browser: - -```html - -``` - -In [Narwhal](http://narwhaljs.org/), [Node.js](https://nodejs.org/), and [RingoJS](http://ringojs.org/): - -```js -var base64 = require('base-64'); -``` - -In [Rhino](http://www.mozilla.org/rhino/): - -```js -load('base64.js'); -``` - -Using an AMD loader like [RequireJS](http://requirejs.org/): - -```js -require( - { - 'paths': { - 'base64': 'path/to/base64' - } - }, - ['base64'], - function(base64) { - console.log(base64); - } -); -``` - -## API - -### `base64.version` - -A string representing the semantic version number. - -### `base64.encode(input)` - -This function takes a byte string (the `input` parameter) and encodes it according to base64. The input data must be in the form of a string containing only characters in the range from U+0000 to U+00FF, each representing a binary byte with values `0x00` to `0xFF`. The `base64.encode()` function is designed to be fully compatible with [`btoa()` as described in the HTML Standard](https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowbase64-btoa). - -```js -var encodedData = base64.encode(input); -``` - -To base64-encode any Unicode string, [encode it as UTF-8 first](https://github.com/mathiasbynens/utf8.js#utf8encodestring): - -```js -var base64 = require('base-64'); -var utf8 = require('utf8'); - -var text = 'foo © bar 𝌆 baz'; -var bytes = utf8.encode(text); -var encoded = base64.encode(bytes); -console.log(encoded); -// → 'Zm9vIMKpIGJhciDwnYyGIGJheg==' -``` - -### `base64.decode(input)` - -This function takes a base64-encoded string (the `input` parameter) and decodes it. The return value is in the form of a string containing only characters in the range from U+0000 to U+00FF, each representing a binary byte with values `0x00` to `0xFF`. The `base64.decode()` function is designed to be fully compatible with [`atob()` as described in the HTML Standard](https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowbase64-atob). - -```js -var decodedData = base64.decode(encodedData); -``` - -To base64-decode UTF-8-encoded data back into a Unicode string, [UTF-8-decode it](https://github.com/mathiasbynens/utf8.js#utf8decodebytestring) after base64-decoding it: - -```js -var encoded = 'Zm9vIMKpIGJhciDwnYyGIGJheg=='; -var bytes = base64.decode(encoded); -var text = utf8.decode(bytes); -console.log(text); -// → 'foo © bar 𝌆 baz' -``` - -## Support - -_base64_ is designed to work in at least Node.js v0.10.0, Narwhal 0.3.2, RingoJS 0.8-0.9, PhantomJS 1.9.0, Rhino 1.7RC4, as well as old and modern versions of Chrome, Firefox, Safari, Opera, and Internet Explorer. - -## Unit tests & code coverage - -After cloning this repository, run `npm install` to install the dependencies needed for development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`. - -Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, and web browsers as well, use `grunt test`. - -To generate the code coverage report, use `grunt cover`. - -## Author - -| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | -|---| -| [Mathias Bynens](https://mathiasbynens.be/) | - -## License - -_base64_ is available under the [MIT](https://mths.be/mit) license. diff --git a/server/node_modules/bson/vendor/base64/base64.js b/server/node_modules/bson/vendor/base64/base64.js deleted file mode 100644 index 611b4461..00000000 --- a/server/node_modules/bson/vendor/base64/base64.js +++ /dev/null @@ -1,157 +0,0 @@ -/*! https://mths.be/base64 v1.0.0 by @mathias | MIT license */ -;(function(root) { - - // Detect free variables `exports`. - var freeExports = typeof exports == 'object' && exports; - - // Detect free variable `module`. - var freeModule = typeof module == 'object' && module && - module.exports == freeExports && module; - - /*--------------------------------------------------------------------------*/ - - var InvalidCharacterError = function(message) { - this.message = message; - }; - InvalidCharacterError.prototype = new Error; - InvalidCharacterError.prototype.name = 'InvalidCharacterError'; - - var error = function(message) { - // Note: the error messages used throughout this file match those used by - // the native `atob`/`btoa` implementation in Chromium. - throw new InvalidCharacterError(message); - }; - - var TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - // http://whatwg.org/html/common-microsyntaxes.html#space-character - var REGEX_SPACE_CHARACTERS = /[\t\n\f\r ]/g; - - // `decode` is designed to be fully compatible with `atob` as described in the - // HTML Standard. http://whatwg.org/html/webappapis.html#dom-windowbase64-atob - // The optimized base64-decoding algorithm used is based on @atk’s excellent - // implementation. https://gist.github.com/atk/1020396 - var decode = function(input) { - input = String(input) - .replace(REGEX_SPACE_CHARACTERS, ''); - var length = input.length; - if (length % 4 == 0) { - input = input.replace(/==?$/, ''); - length = input.length; - } - if ( - length % 4 == 1 || - // http://whatwg.org/C#alphanumeric-ascii-characters - /[^+a-zA-Z0-9/]/.test(input) - ) { - error( - 'Invalid character: the string to be decoded is not correctly encoded.' - ); - } - var bitCounter = 0; - var bitStorage; - var buffer; - var output = ''; - var position = -1; - while (++position < length) { - buffer = TABLE.indexOf(input.charAt(position)); - bitStorage = bitCounter % 4 ? bitStorage * 64 + buffer : buffer; - // Unless this is the first of a group of 4 characters… - if (bitCounter++ % 4) { - // …convert the first 8 bits to a single ASCII character. - output += String.fromCharCode( - 0xFF & bitStorage >> (-2 * bitCounter & 6) - ); - } - } - return output; - }; - - // `encode` is designed to be fully compatible with `btoa` as described in the - // HTML Standard: http://whatwg.org/html/webappapis.html#dom-windowbase64-btoa - var encode = function(input) { - input = String(input); - if (/[^\0-\xFF]/.test(input)) { - // Note: no need to special-case astral symbols here, as surrogates are - // matched, and the input is supposed to only contain ASCII anyway. - error( - 'The string to be encoded contains characters outside of the ' + - 'Latin1 range.' - ); - } - var padding = input.length % 3; - var output = ''; - var position = -1; - var a; - var b; - var c; - var buffer; - // Make sure any padding is handled outside of the loop. - var length = input.length - padding; - - while (++position < length) { - // Read three bytes, i.e. 24 bits. - a = input.charCodeAt(position) << 16; - b = input.charCodeAt(++position) << 8; - c = input.charCodeAt(++position); - buffer = a + b + c; - // Turn the 24 bits into four chunks of 6 bits each, and append the - // matching character for each of them to the output. - output += ( - TABLE.charAt(buffer >> 18 & 0x3F) + - TABLE.charAt(buffer >> 12 & 0x3F) + - TABLE.charAt(buffer >> 6 & 0x3F) + - TABLE.charAt(buffer & 0x3F) - ); - } - - if (padding == 2) { - a = input.charCodeAt(position) << 8; - b = input.charCodeAt(++position); - buffer = a + b; - output += ( - TABLE.charAt(buffer >> 10) + - TABLE.charAt((buffer >> 4) & 0x3F) + - TABLE.charAt((buffer << 2) & 0x3F) + - '=' - ); - } else if (padding == 1) { - buffer = input.charCodeAt(position); - output += ( - TABLE.charAt(buffer >> 2) + - TABLE.charAt((buffer << 4) & 0x3F) + - '==' - ); - } - - return output; - }; - - var base64 = { - 'encode': encode, - 'decode': decode, - 'version': '1.0.0' - }; - - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - typeof define == 'function' && - typeof define.amd == 'object' && - define.amd - ) { - define(function() { - return base64; - }); - } else if (freeExports && !freeExports.nodeType) { - if (freeModule) { // in Node.js or RingoJS v0.8.0+ - freeModule.exports = base64; - } else { // in Narwhal or RingoJS v0.7.0- - for (var key in base64) { - base64.hasOwnProperty(key) && (freeExports[key] = base64[key]); - } - } - } else { // in Rhino or a web browser - root.base64 = base64; - } - -}(this)); diff --git a/server/node_modules/bson/vendor/base64/package.json b/server/node_modules/bson/vendor/base64/package.json deleted file mode 100644 index 479b0a18..00000000 --- a/server/node_modules/bson/vendor/base64/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "base-64", - "version": "1.0.0", - "description": "A robust base64 encoder/decoder that is fully compatible with `atob()` and `btoa()`, written in JavaScript.", - "homepage": "https://mths.be/base64", - "main": "base64.js", - "keywords": [ - "codec", - "decoder", - "encoder", - "base64", - "atob", - "btoa" - ], - "license": "MIT", - "author": { - "name": "Mathias Bynens", - "url": "https://mathiasbynens.be/" - }, - "repository": { - "type": "git", - "url": "https://github.com/mathiasbynens/base64.git" - }, - "bugs": "https://github.com/mathiasbynens/base64/issues", - "files": [ - "LICENSE-MIT.txt", - "base64.js" - ], - "scripts": { - "test": "mocha tests/tests.js", - "build": "grunt build" - }, - "devDependencies": { - "coveralls": "^2.11.4", - "grunt": "^0.4.5", - "grunt-cli": "^1.3.2", - "grunt-shell": "^1.1.2", - "grunt-template": "^0.2.3", - "istanbul": "^0.4.0", - "mocha": "^6.2.0", - "regenerate": "^1.2.1" - } -} diff --git a/server/node_modules/bson/vendor/text-encoding/LICENSE.md b/server/node_modules/bson/vendor/text-encoding/LICENSE.md deleted file mode 100644 index 5ab10466..00000000 --- a/server/node_modules/bson/vendor/text-encoding/LICENSE.md +++ /dev/null @@ -1,237 +0,0 @@ -The encoding indexes, algorithms, and many comments in the code -derive from the Encoding Standard https://encoding.spec.whatwg.org/ - -Otherwise, the code of this repository is released under the Unlicense -license and is also dual-licensed under an Apache 2.0 license. Both -are included below. - -# Unlicense - -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -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 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. - -For more information, please refer to - -# Apache 2.0 License - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/server/node_modules/bson/vendor/text-encoding/README.md b/server/node_modules/bson/vendor/text-encoding/README.md deleted file mode 100644 index b9af0e31..00000000 --- a/server/node_modules/bson/vendor/text-encoding/README.md +++ /dev/null @@ -1,111 +0,0 @@ -text-encoding -============== - -This is a polyfill for the [Encoding Living -Standard](https://encoding.spec.whatwg.org/) API for the Web, allowing -encoding and decoding of textual data to and from Typed Array buffers -for binary data in JavaScript. - -By default it adheres to the spec and does not support *encoding* to -legacy encodings, only *decoding*. It is also implemented to match the -specification's algorithms, rather than for performance. The intended -use is within Web pages, so it has no dependency on server frameworks -or particular module schemes. - -Basic examples and tests are included. - -### Install ### - -There are a few ways you can get and use the `text-encoding` library. - -### HTML Page Usage ### - -Clone the repo and include the files directly: - -```html - - - -``` - -This is the only use case the developer cares about. If you want those -fancy module and/or package manager things that are popular these days -you should probably use a different library. - -#### Package Managers #### - -The package is published to **npm** and **bower** as `text-encoding`. -Use through these is not really supported, since they aren't used by -the developer of the library. Using `require()` in interesting ways -probably breaks. Patches welcome, as long as they don't break the -basic use of the files via ` -``` - -To support the legacy encodings (which may be stateful), the -TextEncoder `encode()` method accepts an optional dictionary and -`stream` option, e.g. `encoder.encode(string, {stream: true});` This -is not needed for standard encoding since the input is always in -complete code points. diff --git a/server/node_modules/bson/vendor/text-encoding/index.js b/server/node_modules/bson/vendor/text-encoding/index.js deleted file mode 100644 index cc57d658..00000000 --- a/server/node_modules/bson/vendor/text-encoding/index.js +++ /dev/null @@ -1,9 +0,0 @@ -// This is free and unencumbered software released into the public domain. -// See LICENSE.md for more information. - -var encoding = require("./lib/encoding.js"); - -module.exports = { - TextEncoder: encoding.TextEncoder, - TextDecoder: encoding.TextDecoder, -}; diff --git a/server/node_modules/bson/vendor/text-encoding/package.json b/server/node_modules/bson/vendor/text-encoding/package.json deleted file mode 100644 index ffc3155a..00000000 --- a/server/node_modules/bson/vendor/text-encoding/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "text-encoding", - "author": "Joshua Bell ", - "contributors": [ - "Joshua Bell ", - "Rick Eyre ", - "Eugen Podaru ", - "Filip Dupanović ", - "Anne van Kesteren ", - "Author: Francis Avila ", - "Michael J. Ryan ", - "Pierre Queinnec ", - "Zack Weinberg " - ], - "version": "0.7.0", - "description": "Polyfill for the Encoding Living Standard's API.", - "main": "index.js", - "files": [ - "index.js", - "lib/encoding.js", - "lib/encoding-indexes.js" - ], - "repository": { - "type": "git", - "url": "https://github.com/inexorabletash/text-encoding.git" - }, - "keywords": [ - "encoding", - "decoding", - "living standard" - ], - "bugs": { - "url": "https://github.com/inexorabletash/text-encoding/issues" - }, - "homepage": "https://github.com/inexorabletash/text-encoding", - "license": "(Unlicense OR Apache-2.0)" -} diff --git a/server/node_modules/buffer-equal-constant-time/.npmignore b/server/node_modules/buffer-equal-constant-time/.npmignore deleted file mode 100644 index 34e4f5c2..00000000 --- a/server/node_modules/buffer-equal-constant-time/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -.*.sw[mnop] -node_modules/ diff --git a/server/node_modules/buffer-equal-constant-time/.travis.yml b/server/node_modules/buffer-equal-constant-time/.travis.yml deleted file mode 100644 index 78e1c014..00000000 --- a/server/node_modules/buffer-equal-constant-time/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: -- "0.11" -- "0.10" diff --git a/server/node_modules/buffer-equal-constant-time/LICENSE.txt b/server/node_modules/buffer-equal-constant-time/LICENSE.txt deleted file mode 100644 index 9a064f3f..00000000 --- a/server/node_modules/buffer-equal-constant-time/LICENSE.txt +++ /dev/null @@ -1,12 +0,0 @@ -Copyright (c) 2013, GoInstant Inc., a salesforce.com company -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -* Neither the name of salesforce.com, nor GoInstant, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/server/node_modules/buffer-equal-constant-time/README.md b/server/node_modules/buffer-equal-constant-time/README.md deleted file mode 100644 index 4f227f58..00000000 --- a/server/node_modules/buffer-equal-constant-time/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# buffer-equal-constant-time - -Constant-time `Buffer` comparison for node.js. Should work with browserify too. - -[![Build Status](https://travis-ci.org/goinstant/buffer-equal-constant-time.png?branch=master)](https://travis-ci.org/goinstant/buffer-equal-constant-time) - -```sh - npm install buffer-equal-constant-time -``` - -# Usage - -```js - var bufferEq = require('buffer-equal-constant-time'); - - var a = new Buffer('asdf'); - var b = new Buffer('asdf'); - if (bufferEq(a,b)) { - // the same! - } else { - // different in at least one byte! - } -``` - -If you'd like to install an `.equal()` method onto the node.js `Buffer` and -`SlowBuffer` prototypes: - -```js - require('buffer-equal-constant-time').install(); - - var a = new Buffer('asdf'); - var b = new Buffer('asdf'); - if (a.equal(b)) { - // the same! - } else { - // different in at least one byte! - } -``` - -To get rid of the installed `.equal()` method, call `.restore()`: - -```js - require('buffer-equal-constant-time').restore(); -``` - -# Legal - -© 2013 GoInstant Inc., a salesforce.com company - -Licensed under the BSD 3-clause license. diff --git a/server/node_modules/buffer-equal-constant-time/index.js b/server/node_modules/buffer-equal-constant-time/index.js deleted file mode 100644 index 5462c1f8..00000000 --- a/server/node_modules/buffer-equal-constant-time/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/*jshint node:true */ -'use strict'; -var Buffer = require('buffer').Buffer; // browserify -var SlowBuffer = require('buffer').SlowBuffer; - -module.exports = bufferEq; - -function bufferEq(a, b) { - - // shortcutting on type is necessary for correctness - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - return false; - } - - // buffer sizes should be well-known information, so despite this - // shortcutting, it doesn't leak any information about the *contents* of the - // buffers. - if (a.length !== b.length) { - return false; - } - - var c = 0; - for (var i = 0; i < a.length; i++) { - /*jshint bitwise:false */ - c |= a[i] ^ b[i]; // XOR - } - return c === 0; -} - -bufferEq.install = function() { - Buffer.prototype.equal = SlowBuffer.prototype.equal = function equal(that) { - return bufferEq(this, that); - }; -}; - -var origBufEqual = Buffer.prototype.equal; -var origSlowBufEqual = SlowBuffer.prototype.equal; -bufferEq.restore = function() { - Buffer.prototype.equal = origBufEqual; - SlowBuffer.prototype.equal = origSlowBufEqual; -}; diff --git a/server/node_modules/buffer-equal-constant-time/package.json b/server/node_modules/buffer-equal-constant-time/package.json deleted file mode 100644 index 17c7de22..00000000 --- a/server/node_modules/buffer-equal-constant-time/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "buffer-equal-constant-time", - "version": "1.0.1", - "description": "Constant-time comparison of Buffers", - "main": "index.js", - "scripts": { - "test": "mocha test.js" - }, - "repository": "git@github.com:goinstant/buffer-equal-constant-time.git", - "keywords": [ - "buffer", - "equal", - "constant-time", - "crypto" - ], - "author": "GoInstant Inc., a salesforce.com company", - "license": "BSD-3-Clause", - "devDependencies": { - "mocha": "~1.15.1" - } -} diff --git a/server/node_modules/buffer-equal-constant-time/test.js b/server/node_modules/buffer-equal-constant-time/test.js deleted file mode 100644 index 0bc972d8..00000000 --- a/server/node_modules/buffer-equal-constant-time/test.js +++ /dev/null @@ -1,42 +0,0 @@ -/*jshint node:true */ -'use strict'; - -var bufferEq = require('./index'); -var assert = require('assert'); - -describe('buffer-equal-constant-time', function() { - var a = new Buffer('asdfasdf123456'); - var b = new Buffer('asdfasdf123456'); - var c = new Buffer('asdfasdf'); - - describe('bufferEq', function() { - it('says a == b', function() { - assert.strictEqual(bufferEq(a, b), true); - }); - - it('says a != c', function() { - assert.strictEqual(bufferEq(a, c), false); - }); - }); - - describe('install/restore', function() { - before(function() { - bufferEq.install(); - }); - after(function() { - bufferEq.restore(); - }); - - it('installed an .equal method', function() { - var SlowBuffer = require('buffer').SlowBuffer; - assert.ok(Buffer.prototype.equal); - assert.ok(SlowBuffer.prototype.equal); - }); - - it('infected existing Buffers', function() { - assert.strictEqual(a.equal(b), true); - assert.strictEqual(a.equal(c), false); - }); - }); - -}); diff --git a/server/node_modules/bytes/History.md b/server/node_modules/bytes/History.md deleted file mode 100644 index d60ce0e6..00000000 --- a/server/node_modules/bytes/History.md +++ /dev/null @@ -1,97 +0,0 @@ -3.1.2 / 2022-01-27 -================== - - * Fix return value for un-parsable strings - -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 deleted file mode 100644 index 63e95a96..00000000 --- a/server/node_modules/bytes/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -(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 deleted file mode 100644 index 5790e23e..00000000 --- a/server/node_modules/bytes/Readme.md +++ /dev/null @@ -1,152 +0,0 @@ -# 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 deleted file mode 100644 index 6f2d0f89..00000000 --- a/server/node_modules/bytes/index.js +++ /dev/null @@ -1,170 +0,0 @@ -/*! - * 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(); - } - - if (isNaN(floatValue)) { - return null; - } - - return Math.floor(map[unit] * floatValue); -} diff --git a/server/node_modules/bytes/package.json b/server/node_modules/bytes/package.json deleted file mode 100644 index f2b6a8b0..00000000 --- a/server/node_modules/bytes/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "bytes", - "description": "Utility to parse a string bytes to bytes and vice-versa", - "version": "3.1.2", - "author": "TJ Holowaychuk (http://tjholowaychuk.com)", - "contributors": [ - "Jed Watson ", - "Théo FIDRY " - ], - "license": "MIT", - "keywords": [ - "byte", - "bytes", - "utility", - "parse", - "parser", - "convert", - "converter" - ], - "repository": "visionmedia/bytes.js", - "devDependencies": { - "eslint": "7.32.0", - "eslint-plugin-markdown": "2.2.1", - "mocha": "9.2.0", - "nyc": "15.1.0" - }, - "files": [ - "History.md", - "LICENSE", - "Readme.md", - "index.js" - ], - "engines": { - "node": ">= 0.8" - }, - "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" - } -} diff --git a/server/node_modules/call-bind-apply-helpers/.eslintrc b/server/node_modules/call-bind-apply-helpers/.eslintrc deleted file mode 100644 index 201e859b..00000000 --- a/server/node_modules/call-bind-apply-helpers/.eslintrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "root": true, - - "extends": "@ljharb", - - "rules": { - "func-name-matching": 0, - "id-length": 0, - "new-cap": [2, { - "capIsNewExceptions": [ - "GetIntrinsic", - ], - }], - "no-extra-parens": 0, - "no-magic-numbers": 0, - }, -} diff --git a/server/node_modules/call-bind-apply-helpers/.github/FUNDING.yml b/server/node_modules/call-bind-apply-helpers/.github/FUNDING.yml deleted file mode 100644 index 0011e9d6..00000000 --- a/server/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +++ /dev/null @@ -1,12 +0,0 @@ -# These are supported funding model platforms - -github: [ljharb] -patreon: # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: npm/call-bind-apply-helpers -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username -custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/server/node_modules/call-bind-apply-helpers/.nycrc b/server/node_modules/call-bind-apply-helpers/.nycrc deleted file mode 100644 index bdd626ce..00000000 --- a/server/node_modules/call-bind-apply-helpers/.nycrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "all": true, - "check-coverage": false, - "reporter": ["text-summary", "text", "html", "json"], - "exclude": [ - "coverage", - "test" - ] -} diff --git a/server/node_modules/call-bind-apply-helpers/CHANGELOG.md b/server/node_modules/call-bind-apply-helpers/CHANGELOG.md deleted file mode 100644 index 24849428..00000000 --- a/server/node_modules/call-bind-apply-helpers/CHANGELOG.md +++ /dev/null @@ -1,30 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [v1.0.2](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.1...v1.0.2) - 2025-02-12 - -### Commits - -- [types] improve inferred types [`e6f9586`](https://github.com/ljharb/call-bind-apply-helpers/commit/e6f95860a3c72879cb861a858cdfb8138fbedec1) -- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape`, `es-value-fixtures`, `for-each`, `has-strict-mode`, `object-inspect` [`e43d540`](https://github.com/ljharb/call-bind-apply-helpers/commit/e43d5409f97543bfbb11f345d47d8ce4e066d8c1) - -## [v1.0.1](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.0...v1.0.1) - 2024-12-08 - -### Commits - -- [types] `reflectApply`: fix types [`4efc396`](https://github.com/ljharb/call-bind-apply-helpers/commit/4efc3965351a4f02cc55e836fa391d3d11ef2ef8) -- [Fix] `reflectApply`: oops, Reflect is not a function [`83cc739`](https://github.com/ljharb/call-bind-apply-helpers/commit/83cc7395de6b79b7730bdf092f1436f0b1263c75) -- [Dev Deps] update `@arethetypeswrong/cli` [`80bd5d3`](https://github.com/ljharb/call-bind-apply-helpers/commit/80bd5d3ae58b4f6b6995ce439dd5a1bcb178a940) - -## v1.0.0 - 2024-12-05 - -### Commits - -- Initial implementation, tests, readme [`7879629`](https://github.com/ljharb/call-bind-apply-helpers/commit/78796290f9b7430c9934d6f33d94ae9bc89fce04) -- Initial commit [`3f1dc16`](https://github.com/ljharb/call-bind-apply-helpers/commit/3f1dc164afc43285631b114a5f9dd9137b2b952f) -- npm init [`081df04`](https://github.com/ljharb/call-bind-apply-helpers/commit/081df048c312fcee400922026f6e97281200a603) -- Only apps should have lockfiles [`5b9ca0f`](https://github.com/ljharb/call-bind-apply-helpers/commit/5b9ca0fe8101ebfaf309c549caac4e0a017ed930) diff --git a/server/node_modules/call-bind-apply-helpers/LICENSE b/server/node_modules/call-bind-apply-helpers/LICENSE deleted file mode 100644 index f82f3896..00000000 --- a/server/node_modules/call-bind-apply-helpers/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 Jordan Harband - -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/call-bind-apply-helpers/README.md b/server/node_modules/call-bind-apply-helpers/README.md deleted file mode 100644 index 8fc0dae1..00000000 --- a/server/node_modules/call-bind-apply-helpers/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# call-bind-apply-helpers [![Version Badge][npm-version-svg]][package-url] - -[![github actions][actions-image]][actions-url] -[![coverage][codecov-image]][codecov-url] -[![dependency status][deps-svg]][deps-url] -[![dev dependency status][dev-deps-svg]][dev-deps-url] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] - -[![npm badge][npm-badge-png]][package-url] - -Helper functions around Function call/apply/bind, for use in `call-bind`. - -The only packages that should likely ever use this package directly are `call-bind` and `get-intrinsic`. -Please use `call-bind` unless you have a very good reason not to. - -## Getting started - -```sh -npm install --save call-bind-apply-helpers -``` - -## Usage/Examples - -```js -const assert = require('assert'); -const callBindBasic = require('call-bind-apply-helpers'); - -function f(a, b) { - assert.equal(this, 1); - assert.equal(a, 2); - assert.equal(b, 3); - assert.equal(arguments.length, 2); -} - -const fBound = callBindBasic([f, 1]); - -delete Function.prototype.call; -delete Function.prototype.bind; - -fBound(2, 3); -``` - -## Tests - -Clone the repo, `npm install`, and run `npm test` - -[package-url]: https://npmjs.org/package/call-bind-apply-helpers -[npm-version-svg]: https://versionbadg.es/ljharb/call-bind-apply-helpers.svg -[deps-svg]: https://david-dm.org/ljharb/call-bind-apply-helpers.svg -[deps-url]: https://david-dm.org/ljharb/call-bind-apply-helpers -[dev-deps-svg]: https://david-dm.org/ljharb/call-bind-apply-helpers/dev-status.svg -[dev-deps-url]: https://david-dm.org/ljharb/call-bind-apply-helpers#info=devDependencies -[npm-badge-png]: https://nodei.co/npm/call-bind-apply-helpers.png?downloads=true&stars=true -[license-image]: https://img.shields.io/npm/l/call-bind-apply-helpers.svg -[license-url]: LICENSE -[downloads-image]: https://img.shields.io/npm/dm/call-bind-apply-helpers.svg -[downloads-url]: https://npm-stat.com/charts.html?package=call-bind-apply-helpers -[codecov-image]: https://codecov.io/gh/ljharb/call-bind-apply-helpers/branch/main/graphs/badge.svg -[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind-apply-helpers/ -[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind-apply-helpers -[actions-url]: https://github.com/ljharb/call-bind-apply-helpers/actions diff --git a/server/node_modules/call-bind-apply-helpers/actualApply.d.ts b/server/node_modules/call-bind-apply-helpers/actualApply.d.ts deleted file mode 100644 index b87286a2..00000000 --- a/server/node_modules/call-bind-apply-helpers/actualApply.d.ts +++ /dev/null @@ -1 +0,0 @@ -export = Reflect.apply; \ No newline at end of file diff --git a/server/node_modules/call-bind-apply-helpers/actualApply.js b/server/node_modules/call-bind-apply-helpers/actualApply.js deleted file mode 100644 index ffa51355..00000000 --- a/server/node_modules/call-bind-apply-helpers/actualApply.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -var bind = require('function-bind'); - -var $apply = require('./functionApply'); -var $call = require('./functionCall'); -var $reflectApply = require('./reflectApply'); - -/** @type {import('./actualApply')} */ -module.exports = $reflectApply || bind.call($call, $apply); diff --git a/server/node_modules/call-bind-apply-helpers/applyBind.d.ts b/server/node_modules/call-bind-apply-helpers/applyBind.d.ts deleted file mode 100644 index d176c1ab..00000000 --- a/server/node_modules/call-bind-apply-helpers/applyBind.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import actualApply from './actualApply'; - -type TupleSplitHead = T['length'] extends N - ? T - : T extends [...infer R, any] - ? TupleSplitHead - : never - -type TupleSplitTail = O['length'] extends N - ? T - : T extends [infer F, ...infer R] - ? TupleSplitTail<[...R], N, [...O, F]> - : never - -type TupleSplit = [TupleSplitHead, TupleSplitTail] - -declare function applyBind(...args: TupleSplit, 2>[1]): ReturnType; - -export = applyBind; \ No newline at end of file diff --git a/server/node_modules/call-bind-apply-helpers/applyBind.js b/server/node_modules/call-bind-apply-helpers/applyBind.js deleted file mode 100644 index d2b77231..00000000 --- a/server/node_modules/call-bind-apply-helpers/applyBind.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -var bind = require('function-bind'); -var $apply = require('./functionApply'); -var actualApply = require('./actualApply'); - -/** @type {import('./applyBind')} */ -module.exports = function applyBind() { - return actualApply(bind, $apply, arguments); -}; diff --git a/server/node_modules/call-bind-apply-helpers/functionApply.d.ts b/server/node_modules/call-bind-apply-helpers/functionApply.d.ts deleted file mode 100644 index 1f6e11b3..00000000 --- a/server/node_modules/call-bind-apply-helpers/functionApply.d.ts +++ /dev/null @@ -1 +0,0 @@ -export = Function.prototype.apply; \ No newline at end of file diff --git a/server/node_modules/call-bind-apply-helpers/functionApply.js b/server/node_modules/call-bind-apply-helpers/functionApply.js deleted file mode 100644 index c71df9c2..00000000 --- a/server/node_modules/call-bind-apply-helpers/functionApply.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; - -/** @type {import('./functionApply')} */ -module.exports = Function.prototype.apply; diff --git a/server/node_modules/call-bind-apply-helpers/functionCall.d.ts b/server/node_modules/call-bind-apply-helpers/functionCall.d.ts deleted file mode 100644 index 15e93df3..00000000 --- a/server/node_modules/call-bind-apply-helpers/functionCall.d.ts +++ /dev/null @@ -1 +0,0 @@ -export = Function.prototype.call; \ No newline at end of file diff --git a/server/node_modules/call-bind-apply-helpers/functionCall.js b/server/node_modules/call-bind-apply-helpers/functionCall.js deleted file mode 100644 index 7a8d8735..00000000 --- a/server/node_modules/call-bind-apply-helpers/functionCall.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; - -/** @type {import('./functionCall')} */ -module.exports = Function.prototype.call; diff --git a/server/node_modules/call-bind-apply-helpers/index.d.ts b/server/node_modules/call-bind-apply-helpers/index.d.ts deleted file mode 100644 index 541516bd..00000000 --- a/server/node_modules/call-bind-apply-helpers/index.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -type RemoveFromTuple< - Tuple extends readonly unknown[], - RemoveCount extends number, - Index extends 1[] = [] -> = Index["length"] extends RemoveCount - ? Tuple - : Tuple extends [infer First, ...infer Rest] - ? RemoveFromTuple - : Tuple; - -type ConcatTuples< - Prefix extends readonly unknown[], - Suffix extends readonly unknown[] -> = [...Prefix, ...Suffix]; - -type ExtractFunctionParams = T extends (this: infer TThis, ...args: infer P extends readonly unknown[]) => infer R - ? { thisArg: TThis; params: P; returnType: R } - : never; - -type BindFunction< - T extends (this: any, ...args: any[]) => any, - TThis, - TBoundArgs extends readonly unknown[], - ReceiverBound extends boolean -> = ExtractFunctionParams extends { - thisArg: infer OrigThis; - params: infer P extends readonly unknown[]; - returnType: infer R; -} - ? ReceiverBound extends true - ? (...args: RemoveFromTuple>) => R extends [OrigThis, ...infer Rest] - ? [TThis, ...Rest] // Replace `this` with `thisArg` - : R - : >>( - thisArg: U, - ...args: RemainingArgs - ) => R extends [OrigThis, ...infer Rest] - ? [U, ...ConcatTuples] // Preserve bound args in return type - : R - : never; - -declare function callBind< - const T extends (this: any, ...args: any[]) => any, - Extracted extends ExtractFunctionParams, - const TBoundArgs extends Partial & readonly unknown[], - const TThis extends Extracted["thisArg"] ->( - args: [fn: T, thisArg: TThis, ...boundArgs: TBoundArgs] -): BindFunction; - -declare function callBind< - const T extends (this: any, ...args: any[]) => any, - Extracted extends ExtractFunctionParams, - const TBoundArgs extends Partial & readonly unknown[] ->( - args: [fn: T, ...boundArgs: TBoundArgs] -): BindFunction; - -declare function callBind( - args: [fn: Exclude, ...rest: TArgs] -): never; - -// export as namespace callBind; -export = callBind; diff --git a/server/node_modules/call-bind-apply-helpers/index.js b/server/node_modules/call-bind-apply-helpers/index.js deleted file mode 100644 index 2f6dab4c..00000000 --- a/server/node_modules/call-bind-apply-helpers/index.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -var bind = require('function-bind'); -var $TypeError = require('es-errors/type'); - -var $call = require('./functionCall'); -var $actualApply = require('./actualApply'); - -/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */ -module.exports = function callBindBasic(args) { - if (args.length < 1 || typeof args[0] !== 'function') { - throw new $TypeError('a function is required'); - } - return $actualApply(bind, $call, args); -}; diff --git a/server/node_modules/call-bind-apply-helpers/package.json b/server/node_modules/call-bind-apply-helpers/package.json deleted file mode 100644 index 923b8be2..00000000 --- a/server/node_modules/call-bind-apply-helpers/package.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "name": "call-bind-apply-helpers", - "version": "1.0.2", - "description": "Helper functions around Function call/apply/bind, for use in `call-bind`", - "main": "index.js", - "exports": { - ".": "./index.js", - "./actualApply": "./actualApply.js", - "./applyBind": "./applyBind.js", - "./functionApply": "./functionApply.js", - "./functionCall": "./functionCall.js", - "./reflectApply": "./reflectApply.js", - "./package.json": "./package.json" - }, - "scripts": { - "prepack": "npmignore --auto --commentLines=auto", - "prepublish": "not-in-publish || npm run prepublishOnly", - "prepublishOnly": "safe-publish-latest", - "prelint": "evalmd README.md", - "lint": "eslint --ext=.js,.mjs .", - "postlint": "tsc -p . && attw -P", - "pretest": "npm run lint", - "tests-only": "nyc tape 'test/**/*.js'", - "test": "npm run tests-only", - "posttest": "npx npm@'>=10.2' audit --production", - "version": "auto-changelog && git add CHANGELOG.md", - "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/ljharb/call-bind-apply-helpers.git" - }, - "author": "Jordan Harband ", - "license": "MIT", - "bugs": { - "url": "https://github.com/ljharb/call-bind-apply-helpers/issues" - }, - "homepage": "https://github.com/ljharb/call-bind-apply-helpers#readme", - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2" - }, - "devDependencies": { - "@arethetypeswrong/cli": "^0.17.3", - "@ljharb/eslint-config": "^21.1.1", - "@ljharb/tsconfig": "^0.2.3", - "@types/for-each": "^0.3.3", - "@types/function-bind": "^1.1.10", - "@types/object-inspect": "^1.13.0", - "@types/tape": "^5.8.1", - "auto-changelog": "^2.5.0", - "encoding": "^0.1.13", - "es-value-fixtures": "^1.7.1", - "eslint": "=8.8.0", - "evalmd": "^0.0.19", - "for-each": "^0.3.5", - "has-strict-mode": "^1.1.0", - "in-publish": "^2.0.1", - "npmignore": "^0.3.1", - "nyc": "^10.3.2", - "object-inspect": "^1.13.4", - "safe-publish-latest": "^2.0.0", - "tape": "^5.9.0", - "typescript": "next" - }, - "testling": { - "files": "test/index.js" - }, - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false, - "hideCredit": true - }, - "publishConfig": { - "ignore": [ - ".github/workflows" - ] - }, - "engines": { - "node": ">= 0.4" - } -} diff --git a/server/node_modules/call-bind-apply-helpers/reflectApply.d.ts b/server/node_modules/call-bind-apply-helpers/reflectApply.d.ts deleted file mode 100644 index 6b2ae764..00000000 --- a/server/node_modules/call-bind-apply-helpers/reflectApply.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const reflectApply: false | typeof Reflect.apply; - -export = reflectApply; diff --git a/server/node_modules/call-bind-apply-helpers/reflectApply.js b/server/node_modules/call-bind-apply-helpers/reflectApply.js deleted file mode 100644 index 3d03caa6..00000000 --- a/server/node_modules/call-bind-apply-helpers/reflectApply.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; - -/** @type {import('./reflectApply')} */ -module.exports = typeof Reflect !== 'undefined' && Reflect && Reflect.apply; diff --git a/server/node_modules/call-bind-apply-helpers/test/index.js b/server/node_modules/call-bind-apply-helpers/test/index.js deleted file mode 100644 index 1cdc89ed..00000000 --- a/server/node_modules/call-bind-apply-helpers/test/index.js +++ /dev/null @@ -1,63 +0,0 @@ -'use strict'; - -var callBind = require('../'); -var hasStrictMode = require('has-strict-mode')(); -var forEach = require('for-each'); -var inspect = require('object-inspect'); -var v = require('es-value-fixtures'); - -var test = require('tape'); - -test('callBindBasic', function (t) { - forEach(v.nonFunctions, function (nonFunction) { - t['throws']( - // @ts-expect-error - function () { callBind([nonFunction]); }, - TypeError, - inspect(nonFunction) + ' is not a function' - ); - }); - - var sentinel = { sentinel: true }; - /** @type {(this: T, a: A, b: B) => [T | undefined, A, B]} */ - var func = function (a, b) { - // eslint-disable-next-line no-invalid-this - return [!hasStrictMode && this === global ? undefined : this, a, b]; - }; - t.equal(func.length, 2, 'original function length is 2'); - - /** type {(thisArg: unknown, a: number, b: number) => [unknown, number, number]} */ - var bound = callBind([func]); - /** type {((a: number, b: number) => [typeof sentinel, typeof a, typeof b])} */ - var boundR = callBind([func, sentinel]); - /** type {((b: number) => [typeof sentinel, number, typeof b])} */ - var boundArg = callBind([func, sentinel, /** @type {const} */ (1)]); - - // @ts-expect-error - t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with no args'); - - // @ts-expect-error - t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args'); - // @ts-expect-error - t.deepEqual(bound(1, 2), [hasStrictMode ? 1 : Object(1), 2, undefined], 'bound func too few args'); - // @ts-expect-error - t.deepEqual(boundR(), [sentinel, undefined, undefined], 'bound func with receiver, with too few args'); - // @ts-expect-error - t.deepEqual(boundArg(), [sentinel, 1, undefined], 'bound func with receiver and arg, with too few args'); - - t.deepEqual(func(1, 2), [undefined, 1, 2], 'unbound func with right args'); - t.deepEqual(bound(1, 2, 3), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with right args'); - t.deepEqual(boundR(1, 2), [sentinel, 1, 2], 'bound func with receiver, with right args'); - t.deepEqual(boundArg(2), [sentinel, 1, 2], 'bound func with receiver and arg, with right arg'); - - // @ts-expect-error - t.deepEqual(func(1, 2, 3), [undefined, 1, 2], 'unbound func with too many args'); - // @ts-expect-error - t.deepEqual(bound(1, 2, 3, 4), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with too many args'); - // @ts-expect-error - t.deepEqual(boundR(1, 2, 3), [sentinel, 1, 2], 'bound func with receiver, with too many args'); - // @ts-expect-error - t.deepEqual(boundArg(2, 3), [sentinel, 1, 2], 'bound func with receiver and arg, with too many args'); - - t.end(); -}); diff --git a/server/node_modules/call-bind-apply-helpers/tsconfig.json b/server/node_modules/call-bind-apply-helpers/tsconfig.json deleted file mode 100644 index aef99930..00000000 --- a/server/node_modules/call-bind-apply-helpers/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "@ljharb/tsconfig", - "compilerOptions": { - "target": "es2021", - }, - "exclude": [ - "coverage", - ], -} \ No newline at end of file diff --git a/server/node_modules/call-bound/.eslintrc b/server/node_modules/call-bound/.eslintrc deleted file mode 100644 index 2612ed8f..00000000 --- a/server/node_modules/call-bound/.eslintrc +++ /dev/null @@ -1,13 +0,0 @@ -{ - "root": true, - - "extends": "@ljharb", - - "rules": { - "new-cap": [2, { - "capIsNewExceptions": [ - "GetIntrinsic", - ], - }], - }, -} diff --git a/server/node_modules/call-bound/.github/FUNDING.yml b/server/node_modules/call-bound/.github/FUNDING.yml deleted file mode 100644 index 2a2a1357..00000000 --- a/server/node_modules/call-bound/.github/FUNDING.yml +++ /dev/null @@ -1,12 +0,0 @@ -# These are supported funding model platforms - -github: [ljharb] -patreon: # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: npm/call-bound -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username -custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/server/node_modules/call-bound/.nycrc b/server/node_modules/call-bound/.nycrc deleted file mode 100644 index bdd626ce..00000000 --- a/server/node_modules/call-bound/.nycrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "all": true, - "check-coverage": false, - "reporter": ["text-summary", "text", "html", "json"], - "exclude": [ - "coverage", - "test" - ] -} diff --git a/server/node_modules/call-bound/CHANGELOG.md b/server/node_modules/call-bound/CHANGELOG.md deleted file mode 100644 index 8bde4e9a..00000000 --- a/server/node_modules/call-bound/CHANGELOG.md +++ /dev/null @@ -1,42 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [v1.0.4](https://github.com/ljharb/call-bound/compare/v1.0.3...v1.0.4) - 2025-03-03 - -### Commits - -- [types] improve types [`e648922`](https://github.com/ljharb/call-bound/commit/e6489222a9e54f350fbf952ceabe51fd8b6027ff) -- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape`, `es-value-fixtures`, `for-each`, `has-strict-mode`, `object-inspect` [`a42a5eb`](https://github.com/ljharb/call-bound/commit/a42a5ebe6c1b54fcdc7997c7dc64fdca9e936719) -- [Deps] update `call-bind-apply-helpers`, `get-intrinsic` [`f529eac`](https://github.com/ljharb/call-bound/commit/f529eac132404c17156bbc23ab2297a25d0f20b8) - -## [v1.0.3](https://github.com/ljharb/call-bound/compare/v1.0.2...v1.0.3) - 2024-12-15 - -### Commits - -- [Refactor] use `call-bind-apply-helpers` instead of `call-bind` [`5e0b134`](https://github.com/ljharb/call-bound/commit/5e0b13496df14fb7d05dae9412f088da8d3f75be) -- [Deps] update `get-intrinsic` [`41fc967`](https://github.com/ljharb/call-bound/commit/41fc96732a22c7b7e8f381f93ccc54bb6293be2e) -- [readme] fix example [`79a0137`](https://github.com/ljharb/call-bound/commit/79a0137723f7c6d09c9c05452bbf8d5efb5d6e49) -- [meta] add `sideEffects` flag [`08b07be`](https://github.com/ljharb/call-bound/commit/08b07be7f1c03f67dc6f3cdaf0906259771859f7) - -## [v1.0.2](https://github.com/ljharb/call-bound/compare/v1.0.1...v1.0.2) - 2024-12-10 - -### Commits - -- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `gopd` [`e6a5ffe`](https://github.com/ljharb/call-bound/commit/e6a5ffe849368fe4f74dfd6cdeca1b9baa39e8d5) -- [Deps] update `call-bind`, `get-intrinsic` [`2aeb5b5`](https://github.com/ljharb/call-bound/commit/2aeb5b521dc2b2683d1345c753ea1161de2d1c14) -- [types] improve return type [`1a0c9fe`](https://github.com/ljharb/call-bound/commit/1a0c9fe3114471e7ca1f57d104e2efe713bb4871) - -## v1.0.1 - 2024-12-05 - -### Commits - -- Initial implementation, tests, readme, types [`6d94121`](https://github.com/ljharb/call-bound/commit/6d94121a9243602e506334069f7a03189fe3363d) -- Initial commit [`0eae867`](https://github.com/ljharb/call-bound/commit/0eae867334ea025c33e6e91cdecfc9df96680cf9) -- npm init [`71b2479`](https://github.com/ljharb/call-bound/commit/71b2479c6723e0b7d91a6b663613067e98b7b275) -- Only apps should have lockfiles [`c3754a9`](https://github.com/ljharb/call-bound/commit/c3754a949b7f9132b47e2d18c1729889736741eb) -- [actions] skip `npm ls` in node < 10 [`74275a5`](https://github.com/ljharb/call-bound/commit/74275a5186b8caf6309b6b97472bdcb0df4683a8) -- [Dev Deps] add missing peer dep [`1354de8`](https://github.com/ljharb/call-bound/commit/1354de8679413e4ae9c523d85f76fa7a5e032d97) diff --git a/server/node_modules/call-bound/LICENSE b/server/node_modules/call-bound/LICENSE deleted file mode 100644 index f82f3896..00000000 --- a/server/node_modules/call-bound/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 Jordan Harband - -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/call-bound/README.md b/server/node_modules/call-bound/README.md deleted file mode 100644 index a44e43e5..00000000 --- a/server/node_modules/call-bound/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# call-bound [![Version Badge][npm-version-svg]][package-url] - -[![github actions][actions-image]][actions-url] -[![coverage][codecov-image]][codecov-url] -[![dependency status][deps-svg]][deps-url] -[![dev dependency status][dev-deps-svg]][dev-deps-url] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] - -[![npm badge][npm-badge-png]][package-url] - -Robust call-bound JavaScript intrinsics, using `call-bind` and `get-intrinsic`. - -## Getting started - -```sh -npm install --save call-bound -``` - -## Usage/Examples - -```js -const assert = require('assert'); -const callBound = require('call-bound'); - -const slice = callBound('Array.prototype.slice'); - -delete Function.prototype.call; -delete Function.prototype.bind; -delete Array.prototype.slice; - -assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]); -``` - -## Tests - -Clone the repo, `npm install`, and run `npm test` - -[package-url]: https://npmjs.org/package/call-bound -[npm-version-svg]: https://versionbadg.es/ljharb/call-bound.svg -[deps-svg]: https://david-dm.org/ljharb/call-bound.svg -[deps-url]: https://david-dm.org/ljharb/call-bound -[dev-deps-svg]: https://david-dm.org/ljharb/call-bound/dev-status.svg -[dev-deps-url]: https://david-dm.org/ljharb/call-bound#info=devDependencies -[npm-badge-png]: https://nodei.co/npm/call-bound.png?downloads=true&stars=true -[license-image]: https://img.shields.io/npm/l/call-bound.svg -[license-url]: LICENSE -[downloads-image]: https://img.shields.io/npm/dm/call-bound.svg -[downloads-url]: https://npm-stat.com/charts.html?package=call-bound -[codecov-image]: https://codecov.io/gh/ljharb/call-bound/branch/main/graphs/badge.svg -[codecov-url]: https://app.codecov.io/gh/ljharb/call-bound/ -[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bound -[actions-url]: https://github.com/ljharb/call-bound/actions diff --git a/server/node_modules/call-bound/index.d.ts b/server/node_modules/call-bound/index.d.ts deleted file mode 100644 index 5562f00e..00000000 --- a/server/node_modules/call-bound/index.d.ts +++ /dev/null @@ -1,94 +0,0 @@ -type Intrinsic = typeof globalThis; - -type IntrinsicName = keyof Intrinsic | `%${keyof Intrinsic}%`; - -type IntrinsicPath = IntrinsicName | `${StripPercents}.${string}` | `%${StripPercents}.${string}%`; - -type AllowMissing = boolean; - -type StripPercents = T extends `%${infer U}%` ? U : T; - -type BindMethodPrecise = - F extends (this: infer This, ...args: infer Args) => infer R - ? (obj: This, ...args: Args) => R - : F extends { - (this: infer This1, ...args: infer Args1): infer R1; - (this: infer This2, ...args: infer Args2): infer R2 - } - ? { - (obj: This1, ...args: Args1): R1; - (obj: This2, ...args: Args2): R2 - } - : never - -// Extract method type from a prototype -type GetPrototypeMethod = - (typeof globalThis)[T] extends { prototype: any } - ? M extends keyof (typeof globalThis)[T]['prototype'] - ? (typeof globalThis)[T]['prototype'][M] - : never - : never - -// Get static property/method -type GetStaticMember = - P extends keyof (typeof globalThis)[T] ? (typeof globalThis)[T][P] : never - -// Type that maps string path to actual bound function or value with better precision -type BoundIntrinsic = - S extends `${infer Obj}.prototype.${infer Method}` - ? Obj extends keyof typeof globalThis - ? BindMethodPrecise> - : unknown - : S extends `${infer Obj}.${infer Prop}` - ? Obj extends keyof typeof globalThis - ? GetStaticMember - : unknown - : unknown - -declare function arraySlice(array: readonly T[], start?: number, end?: number): T[]; -declare function arraySlice(array: ArrayLike, start?: number, end?: number): T[]; -declare function arraySlice(array: IArguments, start?: number, end?: number): T[]; - -// Special cases for methods that need explicit typing -interface SpecialCases { - '%Object.prototype.isPrototypeOf%': (thisArg: {}, obj: unknown) => boolean; - '%String.prototype.replace%': { - (str: string, searchValue: string | RegExp, replaceValue: string): string; - (str: string, searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string - }; - '%Object.prototype.toString%': (obj: {}) => string; - '%Object.prototype.hasOwnProperty%': (obj: {}, v: PropertyKey) => boolean; - '%Array.prototype.slice%': typeof arraySlice; - '%Array.prototype.map%': (array: readonly T[], callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any) => U[]; - '%Array.prototype.filter%': (array: readonly T[], predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any) => T[]; - '%Array.prototype.indexOf%': (array: readonly T[], searchElement: T, fromIndex?: number) => number; - '%Function.prototype.apply%': (fn: (...args: A) => R, thisArg: any, args: A) => R; - '%Function.prototype.call%': (fn: (...args: A) => R, thisArg: any, ...args: A) => R; - '%Function.prototype.bind%': (fn: (...args: A) => R, thisArg: any, ...args: A) => (...remainingArgs: A) => R; - '%Promise.prototype.then%': { - (promise: Promise, onfulfilled: (value: T) => R | PromiseLike): Promise; - (promise: Promise, onfulfilled: ((value: T) => R | PromiseLike) | undefined | null, onrejected: (reason: any) => R | PromiseLike): Promise; - }; - '%RegExp.prototype.test%': (regexp: RegExp, str: string) => boolean; - '%RegExp.prototype.exec%': (regexp: RegExp, str: string) => RegExpExecArray | null; - '%Error.prototype.toString%': (error: Error) => string; - '%TypeError.prototype.toString%': (error: TypeError) => string; - '%String.prototype.split%': ( - obj: unknown, - splitter: string | RegExp | { - [Symbol.split](string: string, limit?: number): string[]; - }, - limit?: number | undefined - ) => string[]; -} - -/** - * Returns a bound function for a prototype method, or a value for a static property. - * - * @param name - The name of the intrinsic (e.g. 'Array.prototype.slice') - * @param {AllowMissing} [allowMissing] - Whether to allow missing intrinsics (default: false) - */ -declare function callBound, S extends IntrinsicPath>(name: K, allowMissing?: AllowMissing): SpecialCases[`%${StripPercents}%`]; -declare function callBound, S extends IntrinsicPath>(name: S, allowMissing?: AllowMissing): BoundIntrinsic; - -export = callBound; diff --git a/server/node_modules/call-bound/index.js b/server/node_modules/call-bound/index.js deleted file mode 100644 index e9ade749..00000000 --- a/server/node_modules/call-bound/index.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -var GetIntrinsic = require('get-intrinsic'); - -var callBindBasic = require('call-bind-apply-helpers'); - -/** @type {(thisArg: string, searchString: string, position?: number) => number} */ -var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]); - -/** @type {import('.')} */ -module.exports = function callBoundIntrinsic(name, allowMissing) { - /* eslint no-extra-parens: 0 */ - - var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing)); - if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { - return callBindBasic(/** @type {const} */ ([intrinsic])); - } - return intrinsic; -}; diff --git a/server/node_modules/call-bound/package.json b/server/node_modules/call-bound/package.json deleted file mode 100644 index d542db43..00000000 --- a/server/node_modules/call-bound/package.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "name": "call-bound", - "version": "1.0.4", - "description": "Robust call-bound JavaScript intrinsics, using `call-bind` and `get-intrinsic`.", - "main": "index.js", - "exports": { - ".": "./index.js", - "./package.json": "./package.json" - }, - "sideEffects": false, - "scripts": { - "prepack": "npmignore --auto --commentLines=auto", - "prepublish": "not-in-publish || npm run prepublishOnly", - "prepublishOnly": "safe-publish-latest", - "prelint": "evalmd README.md", - "lint": "eslint --ext=.js,.mjs .", - "postlint": "tsc -p . && attw -P", - "pretest": "npm run lint", - "tests-only": "nyc tape 'test/**/*.js'", - "test": "npm run tests-only", - "posttest": "npx npm@'>=10.2' audit --production", - "version": "auto-changelog && git add CHANGELOG.md", - "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/ljharb/call-bound.git" - }, - "keywords": [ - "javascript", - "ecmascript", - "es", - "js", - "callbind", - "callbound", - "call", - "bind", - "bound", - "call-bind", - "call-bound", - "function", - "es-abstract" - ], - "author": "Jordan Harband ", - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/ljharb/call-bound/issues" - }, - "homepage": "https://github.com/ljharb/call-bound#readme", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "get-intrinsic": "^1.3.0" - }, - "devDependencies": { - "@arethetypeswrong/cli": "^0.17.4", - "@ljharb/eslint-config": "^21.1.1", - "@ljharb/tsconfig": "^0.3.0", - "@types/call-bind": "^1.0.5", - "@types/get-intrinsic": "^1.2.3", - "@types/tape": "^5.8.1", - "auto-changelog": "^2.5.0", - "encoding": "^0.1.13", - "es-value-fixtures": "^1.7.1", - "eslint": "=8.8.0", - "evalmd": "^0.0.19", - "for-each": "^0.3.5", - "gopd": "^1.2.0", - "has-strict-mode": "^1.1.0", - "in-publish": "^2.0.1", - "npmignore": "^0.3.1", - "nyc": "^10.3.2", - "object-inspect": "^1.13.4", - "safe-publish-latest": "^2.0.0", - "tape": "^5.9.0", - "typescript": "next" - }, - "testling": { - "files": "test/index.js" - }, - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false, - "hideCredit": true - }, - "publishConfig": { - "ignore": [ - ".github/workflows" - ] - }, - "engines": { - "node": ">= 0.4" - } -} diff --git a/server/node_modules/call-bound/test/index.js b/server/node_modules/call-bound/test/index.js deleted file mode 100644 index a2fc9f0f..00000000 --- a/server/node_modules/call-bound/test/index.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; - -var test = require('tape'); - -var callBound = require('../'); - -/** @template {true} T @template U @typedef {T extends U ? T : never} AssertType */ - -test('callBound', function (t) { - // static primitive - t.equal(callBound('Array.length'), Array.length, 'Array.length yields itself'); - t.equal(callBound('%Array.length%'), Array.length, '%Array.length% yields itself'); - - // static non-function object - t.equal(callBound('Array.prototype'), Array.prototype, 'Array.prototype yields itself'); - t.equal(callBound('%Array.prototype%'), Array.prototype, '%Array.prototype% yields itself'); - t.equal(callBound('Array.constructor'), Array.constructor, 'Array.constructor yields itself'); - t.equal(callBound('%Array.constructor%'), Array.constructor, '%Array.constructor% yields itself'); - - // static function - t.equal(callBound('Date.parse'), Date.parse, 'Date.parse yields itself'); - t.equal(callBound('%Date.parse%'), Date.parse, '%Date.parse% yields itself'); - - // prototype primitive - t.equal(callBound('Error.prototype.message'), Error.prototype.message, 'Error.prototype.message yields itself'); - t.equal(callBound('%Error.prototype.message%'), Error.prototype.message, '%Error.prototype.message% yields itself'); - - var x = callBound('Object.prototype.toString'); - var y = callBound('%Object.prototype.toString%'); - - // prototype function - t.notEqual(x, Object.prototype.toString, 'Object.prototype.toString does not yield itself'); - t.notEqual(y, Object.prototype.toString, '%Object.prototype.toString% does not yield itself'); - t.equal(x(true), Object.prototype.toString.call(true), 'call-bound Object.prototype.toString calls into the original'); - t.equal(y(true), Object.prototype.toString.call(true), 'call-bound %Object.prototype.toString% calls into the original'); - - t['throws']( - // @ts-expect-error - function () { callBound('does not exist'); }, - SyntaxError, - 'nonexistent intrinsic throws' - ); - t['throws']( - // @ts-expect-error - function () { callBound('does not exist', true); }, - SyntaxError, - 'allowMissing arg still throws for unknown intrinsic' - ); - - t.test('real but absent intrinsic', { skip: typeof WeakRef !== 'undefined' }, function (st) { - st['throws']( - function () { callBound('WeakRef'); }, - TypeError, - 'real but absent intrinsic throws' - ); - st.equal(callBound('WeakRef', true), undefined, 'allowMissing arg avoids exception'); - st.end(); - }); - - t.end(); -}); diff --git a/server/node_modules/call-bound/tsconfig.json b/server/node_modules/call-bound/tsconfig.json deleted file mode 100644 index 8976d98b..00000000 --- a/server/node_modules/call-bound/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "@ljharb/tsconfig", - "compilerOptions": { - "target": "ESNext", - "lib": ["es2024"], - }, - "exclude": [ - "coverage", - ], -} diff --git a/server/node_modules/chokidar/LICENSE b/server/node_modules/chokidar/LICENSE deleted file mode 100644 index fa9162b5..00000000 --- a/server/node_modules/chokidar/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2012-2019 Paul Miller (https://paulmillr.com), Elan Shanker - -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/chokidar/README.md b/server/node_modules/chokidar/README.md deleted file mode 100644 index 8e25decb..00000000 --- a/server/node_modules/chokidar/README.md +++ /dev/null @@ -1,308 +0,0 @@ -# Chokidar [![Weekly downloads](https://img.shields.io/npm/dw/chokidar.svg)](https://github.com/paulmillr/chokidar) [![Yearly downloads](https://img.shields.io/npm/dy/chokidar.svg)](https://github.com/paulmillr/chokidar) - -> Minimal and efficient cross-platform file watching library - -[![NPM](https://nodei.co/npm/chokidar.png)](https://www.npmjs.com/package/chokidar) - -## Why? - -Node.js `fs.watch`: - -* Doesn't report filenames on MacOS. -* Doesn't report events at all when using editors like Sublime on MacOS. -* Often reports events twice. -* Emits most changes as `rename`. -* Does not provide an easy way to recursively watch file trees. -* Does not support recursive watching on Linux. - -Node.js `fs.watchFile`: - -* Almost as bad at event handling. -* Also does not provide any recursive watching. -* Results in high CPU utilization. - -Chokidar resolves these problems. - -Initially made for **[Brunch](https://brunch.io/)** (an ultra-swift web app build tool), it is now used in -[Microsoft's Visual Studio Code](https://github.com/microsoft/vscode), -[gulp](https://github.com/gulpjs/gulp/), -[karma](https://karma-runner.github.io/), -[PM2](https://github.com/Unitech/PM2), -[browserify](http://browserify.org/), -[webpack](https://webpack.github.io/), -[BrowserSync](https://www.browsersync.io/), -and [many others](https://www.npmjs.com/browse/depended/chokidar). -It has proven itself in production environments. - -Version 3 is out! Check out our blog post about it: [Chokidar 3: How to save 32TB of traffic every week](https://paulmillr.com/posts/chokidar-3-save-32tb-of-traffic/) - -## How? - -Chokidar does still rely on the Node.js core `fs` module, but when using -`fs.watch` and `fs.watchFile` for watching, it normalizes the events it -receives, often checking for truth by getting file stats and/or dir contents. - -On MacOS, chokidar by default uses a native extension exposing the Darwin -`FSEvents` API. This provides very efficient recursive watching compared with -implementations like `kqueue` available on most \*nix platforms. Chokidar still -does have to do some work to normalize the events received that way as well. - -On most other platforms, the `fs.watch`-based implementation is the default, which -avoids polling and keeps CPU usage down. Be advised that chokidar will initiate -watchers recursively for everything within scope of the paths that have been -specified, so be judicious about not wasting system resources by watching much -more than needed. - -## Getting started - -Install with npm: - -```sh -npm install chokidar -``` - -Then `require` and use it in your code: - -```javascript -const chokidar = require('chokidar'); - -// One-liner for current directory -chokidar.watch('.').on('all', (event, path) => { - console.log(event, path); -}); -``` - -## API - -```javascript -// Example of a more typical implementation structure - -// Initialize watcher. -const watcher = chokidar.watch('file, dir, glob, or array', { - ignored: /(^|[\/\\])\../, // ignore dotfiles - persistent: true -}); - -// Something to use when events are received. -const log = console.log.bind(console); -// Add event listeners. -watcher - .on('add', path => log(`File ${path} has been added`)) - .on('change', path => log(`File ${path} has been changed`)) - .on('unlink', path => log(`File ${path} has been removed`)); - -// More possible events. -watcher - .on('addDir', path => log(`Directory ${path} has been added`)) - .on('unlinkDir', path => log(`Directory ${path} has been removed`)) - .on('error', error => log(`Watcher error: ${error}`)) - .on('ready', () => log('Initial scan complete. Ready for changes')) - .on('raw', (event, path, details) => { // internal - log('Raw event info:', event, path, details); - }); - -// 'add', 'addDir' and 'change' events also receive stat() results as second -// argument when available: https://nodejs.org/api/fs.html#fs_class_fs_stats -watcher.on('change', (path, stats) => { - if (stats) console.log(`File ${path} changed size to ${stats.size}`); -}); - -// Watch new files. -watcher.add('new-file'); -watcher.add(['new-file-2', 'new-file-3', '**/other-file*']); - -// Get list of actual paths being watched on the filesystem -var watchedPaths = watcher.getWatched(); - -// Un-watch some files. -await watcher.unwatch('new-file*'); - -// Stop watching. -// The method is async! -watcher.close().then(() => console.log('closed')); - -// Full list of options. See below for descriptions. -// Do not use this example! -chokidar.watch('file', { - persistent: true, - - ignored: '*.txt', - ignoreInitial: false, - followSymlinks: true, - cwd: '.', - disableGlobbing: false, - - usePolling: false, - interval: 100, - binaryInterval: 300, - alwaysStat: false, - depth: 99, - awaitWriteFinish: { - stabilityThreshold: 2000, - pollInterval: 100 - }, - - ignorePermissionErrors: false, - atomic: true // or a custom 'atomicity delay', in milliseconds (default 100) -}); - -``` - -`chokidar.watch(paths, [options])` - -* `paths` (string or array of strings). Paths to files, dirs to be watched -recursively, or glob patterns. - - Note: globs must not contain windows separators (`\`), - because that's how they work by the standard — - you'll need to replace them with forward slashes (`/`). - - Note 2: for additional glob documentation, check out low-level - library: [picomatch](https://github.com/micromatch/picomatch). -* `options` (object) Options object as defined below: - -#### Persistence - -* `persistent` (default: `true`). Indicates whether the process -should continue to run as long as files are being watched. If set to -`false` when using `fsevents` to watch, no more events will be emitted -after `ready`, even if the process continues to run. - -#### Path filtering - -* `ignored` ([anymatch](https://github.com/es128/anymatch)-compatible definition) -Defines files/paths to be ignored. The whole relative or absolute path is -tested, not just filename. If a function with two arguments is provided, it -gets called twice per path - once with a single argument (the path), second -time with two arguments (the path and the -[`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) -object of that path). -* `ignoreInitial` (default: `false`). If set to `false` then `add`/`addDir` events are also emitted for matching paths while -instantiating the watching as chokidar discovers these file paths (before the `ready` event). -* `followSymlinks` (default: `true`). When `false`, only the -symlinks themselves will be watched for changes instead of following -the link references and bubbling events through the link's path. -* `cwd` (no default). The base directory from which watch `paths` are to be -derived. Paths emitted with events will be relative to this. -* `disableGlobbing` (default: `false`). If set to `true` then the strings passed to `.watch()` and `.add()` are treated as -literal path names, even if they look like globs. - -#### Performance - -* `usePolling` (default: `false`). -Whether to use fs.watchFile (backed by polling), or fs.watch. If polling -leads to high CPU utilization, consider setting this to `false`. It is -typically necessary to **set this to `true` to successfully watch files over -a network**, and it may be necessary to successfully watch files in other -non-standard situations. Setting to `true` explicitly on MacOS overrides the -`useFsEvents` default. You may also set the CHOKIDAR_USEPOLLING env variable -to true (1) or false (0) in order to override this option. -* _Polling-specific settings_ (effective when `usePolling: true`) - * `interval` (default: `100`). Interval of file system polling, in milliseconds. You may also - set the CHOKIDAR_INTERVAL env variable to override this option. - * `binaryInterval` (default: `300`). Interval of file system - polling for binary files. - ([see list of binary extensions](https://github.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json)) -* `useFsEvents` (default: `true` on MacOS). Whether to use the -`fsevents` watching interface if available. When set to `true` explicitly -and `fsevents` is available this supercedes the `usePolling` setting. When -set to `false` on MacOS, `usePolling: true` becomes the default. -* `alwaysStat` (default: `false`). If relying upon the -[`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) -object that may get passed with `add`, `addDir`, and `change` events, set -this to `true` to ensure it is provided even in cases where it wasn't -already available from the underlying watch events. -* `depth` (default: `undefined`). If set, limits how many levels of -subdirectories will be traversed. -* `awaitWriteFinish` (default: `false`). -By default, the `add` event will fire when a file first appears on disk, before -the entire file has been written. Furthermore, in some cases some `change` -events will be emitted while the file is being written. In some cases, -especially when watching for large files there will be a need to wait for the -write operation to finish before responding to a file creation or modification. -Setting `awaitWriteFinish` to `true` (or a truthy value) will poll file size, -holding its `add` and `change` events until the size does not change for a -configurable amount of time. The appropriate duration setting is heavily -dependent on the OS and hardware. For accurate detection this parameter should -be relatively high, making file watching much less responsive. -Use with caution. - * *`options.awaitWriteFinish` can be set to an object in order to adjust - timing params:* - * `awaitWriteFinish.stabilityThreshold` (default: 2000). Amount of time in - milliseconds for a file size to remain constant before emitting its event. - * `awaitWriteFinish.pollInterval` (default: 100). File size polling interval, in milliseconds. - -#### Errors - -* `ignorePermissionErrors` (default: `false`). Indicates whether to watch files -that don't have read permissions if possible. If watching fails due to `EPERM` -or `EACCES` with this set to `true`, the errors will be suppressed silently. -* `atomic` (default: `true` if `useFsEvents` and `usePolling` are `false`). -Automatically filters out artifacts that occur when using editors that use -"atomic writes" instead of writing directly to the source file. If a file is -re-added within 100 ms of being deleted, Chokidar emits a `change` event -rather than `unlink` then `add`. If the default of 100 ms does not work well -for you, you can override it by setting `atomic` to a custom value, in -milliseconds. - -### Methods & Events - -`chokidar.watch()` produces an instance of `FSWatcher`. Methods of `FSWatcher`: - -* `.add(path / paths)`: Add files, directories, or glob patterns for tracking. -Takes an array of strings or just one string. -* `.on(event, callback)`: Listen for an FS event. -Available events: `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `ready`, -`raw`, `error`. -Additionally `all` is available which gets emitted with the underlying event -name and path for every event other than `ready`, `raw`, and `error`. `raw` is internal, use it carefully. -* `.unwatch(path / paths)`: Stop watching files, directories, or glob patterns. -Takes an array of strings or just one string. -* `.close()`: **async** Removes all listeners from watched files. Asynchronous, returns Promise. Use with `await` to ensure bugs don't happen. -* `.getWatched()`: Returns an object representing all the paths on the file -system being watched by this `FSWatcher` instance. The object's keys are all the -directories (using absolute paths unless the `cwd` option was used), and the -values are arrays of the names of the items contained in each directory. - -## CLI - -If you need a CLI interface for your file watching, check out -[chokidar-cli](https://github.com/open-cli-tools/chokidar-cli), allowing you to -execute a command on each change, or get a stdio stream of change events. - -## Install Troubleshooting - -* `npm WARN optional dep failed, continuing fsevents@n.n.n` - * This message is normal part of how `npm` handles optional dependencies and is - not indicative of a problem. Even if accompanied by other related error messages, - Chokidar should function properly. - -* `TypeError: fsevents is not a constructor` - * Update chokidar by doing `rm -rf node_modules package-lock.json yarn.lock && npm install`, or update your dependency that uses chokidar. - -* Chokidar is producing `ENOSP` error on Linux, like this: - * `bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell` - `Error: watch /home/ ENOSPC` - * This means Chokidar ran out of file handles and you'll need to increase their count by executing the following command in Terminal: - `echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p` - -## Changelog - -For more detailed changelog, see [`full_changelog.md`](.github/full_changelog.md). -- **v3.5 (Jan 6, 2021):** Support for ARM Macs with Apple Silicon. Fixes for deleted symlinks. -- **v3.4 (Apr 26, 2020):** Support for directory-based symlinks. Fixes for macos file replacement. -- **v3.3 (Nov 2, 2019):** `FSWatcher#close()` method became async. That fixes IO race conditions related to close method. -- **v3.2 (Oct 1, 2019):** Improve Linux RAM usage by 50%. Race condition fixes. Windows glob fixes. Improve stability by using tight range of dependency versions. -- **v3.1 (Sep 16, 2019):** dotfiles are no longer filtered out by default. Use `ignored` option if needed. Improve initial Linux scan time by 50%. -- **v3 (Apr 30, 2019):** massive CPU & RAM consumption improvements; reduces deps / package size by a factor of 17x and bumps Node.js requirement to v8.16 and higher. -- **v2 (Dec 29, 2017):** Globs are now posix-style-only; without windows support. Tons of bugfixes. -- **v1 (Apr 7, 2015):** Glob support, symlink support, tons of bugfixes. Node 0.8+ is supported -- **v0.1 (Apr 20, 2012):** Initial release, extracted from [Brunch](https://github.com/brunch/brunch/blob/9847a065aea300da99bd0753f90354cde9de1261/src/helpers.coffee#L66) - -## Also - -Why was chokidar named this way? What's the meaning behind it? - ->Chowkidar is a transliteration of a Hindi word meaning 'watchman, gatekeeper', चौकीदार. This ultimately comes from Sanskrit _ चतुष्क_ (crossway, quadrangle, consisting-of-four). This word is also used in other languages like Urdu as (چوکیدار) which is widely used in Pakistan and India. - -## License - -MIT (c) Paul Miller (), see [LICENSE](LICENSE) file. diff --git a/server/node_modules/chokidar/index.js b/server/node_modules/chokidar/index.js deleted file mode 100644 index 8752893c..00000000 --- a/server/node_modules/chokidar/index.js +++ /dev/null @@ -1,973 +0,0 @@ -'use strict'; - -const { EventEmitter } = require('events'); -const fs = require('fs'); -const sysPath = require('path'); -const { promisify } = require('util'); -const readdirp = require('readdirp'); -const anymatch = require('anymatch').default; -const globParent = require('glob-parent'); -const isGlob = require('is-glob'); -const braces = require('braces'); -const normalizePath = require('normalize-path'); - -const NodeFsHandler = require('./lib/nodefs-handler'); -const FsEventsHandler = require('./lib/fsevents-handler'); -const { - EV_ALL, - EV_READY, - EV_ADD, - EV_CHANGE, - EV_UNLINK, - EV_ADD_DIR, - EV_UNLINK_DIR, - EV_RAW, - EV_ERROR, - - STR_CLOSE, - STR_END, - - BACK_SLASH_RE, - DOUBLE_SLASH_RE, - SLASH_OR_BACK_SLASH_RE, - DOT_RE, - REPLACER_RE, - - SLASH, - SLASH_SLASH, - BRACE_START, - BANG, - ONE_DOT, - TWO_DOTS, - GLOBSTAR, - SLASH_GLOBSTAR, - ANYMATCH_OPTS, - STRING_TYPE, - FUNCTION_TYPE, - EMPTY_STR, - EMPTY_FN, - - isWindows, - isMacos, - isIBMi -} = require('./lib/constants'); - -const stat = promisify(fs.stat); -const readdir = promisify(fs.readdir); - -/** - * @typedef {String} Path - * @typedef {'all'|'add'|'addDir'|'change'|'unlink'|'unlinkDir'|'raw'|'error'|'ready'} EventName - * @typedef {'readdir'|'watch'|'add'|'remove'|'change'} ThrottleType - */ - -/** - * - * @typedef {Object} WatchHelpers - * @property {Boolean} followSymlinks - * @property {'stat'|'lstat'} statMethod - * @property {Path} path - * @property {Path} watchPath - * @property {Function} entryPath - * @property {Boolean} hasGlob - * @property {Object} globFilter - * @property {Function} filterPath - * @property {Function} filterDir - */ - -const arrify = (value = []) => Array.isArray(value) ? value : [value]; -const flatten = (list, result = []) => { - list.forEach(item => { - if (Array.isArray(item)) { - flatten(item, result); - } else { - result.push(item); - } - }); - return result; -}; - -const unifyPaths = (paths_) => { - /** - * @type {Array} - */ - const paths = flatten(arrify(paths_)); - if (!paths.every(p => typeof p === STRING_TYPE)) { - throw new TypeError(`Non-string provided as watch path: ${paths}`); - } - return paths.map(normalizePathToUnix); -}; - -// If SLASH_SLASH occurs at the beginning of path, it is not replaced -// because "//StoragePC/DrivePool/Movies" is a valid network path -const toUnix = (string) => { - let str = string.replace(BACK_SLASH_RE, SLASH); - let prepend = false; - if (str.startsWith(SLASH_SLASH)) { - prepend = true; - } - while (str.match(DOUBLE_SLASH_RE)) { - str = str.replace(DOUBLE_SLASH_RE, SLASH); - } - if (prepend) { - str = SLASH + str; - } - return str; -}; - -// Our version of upath.normalize -// TODO: this is not equal to path-normalize module - investigate why -const normalizePathToUnix = (path) => toUnix(sysPath.normalize(toUnix(path))); - -const normalizeIgnored = (cwd = EMPTY_STR) => (path) => { - if (typeof path !== STRING_TYPE) return path; - return normalizePathToUnix(sysPath.isAbsolute(path) ? path : sysPath.join(cwd, path)); -}; - -const getAbsolutePath = (path, cwd) => { - if (sysPath.isAbsolute(path)) { - return path; - } - if (path.startsWith(BANG)) { - return BANG + sysPath.join(cwd, path.slice(1)); - } - return sysPath.join(cwd, path); -}; - -const undef = (opts, key) => opts[key] === undefined; - -/** - * Directory entry. - * @property {Path} path - * @property {Set} items - */ -class DirEntry { - /** - * @param {Path} dir - * @param {Function} removeWatcher - */ - constructor(dir, removeWatcher) { - this.path = dir; - this._removeWatcher = removeWatcher; - /** @type {Set} */ - this.items = new Set(); - } - - add(item) { - const {items} = this; - if (!items) return; - if (item !== ONE_DOT && item !== TWO_DOTS) items.add(item); - } - - async remove(item) { - const {items} = this; - if (!items) return; - items.delete(item); - if (items.size > 0) return; - - const dir = this.path; - try { - await readdir(dir); - } catch (err) { - if (this._removeWatcher) { - this._removeWatcher(sysPath.dirname(dir), sysPath.basename(dir)); - } - } - } - - has(item) { - const {items} = this; - if (!items) return; - return items.has(item); - } - - /** - * @returns {Array} - */ - getChildren() { - const {items} = this; - if (!items) return; - return [...items.values()]; - } - - dispose() { - this.items.clear(); - delete this.path; - delete this._removeWatcher; - delete this.items; - Object.freeze(this); - } -} - -const STAT_METHOD_F = 'stat'; -const STAT_METHOD_L = 'lstat'; -class WatchHelper { - constructor(path, watchPath, follow, fsw) { - this.fsw = fsw; - this.path = path = path.replace(REPLACER_RE, EMPTY_STR); - this.watchPath = watchPath; - this.fullWatchPath = sysPath.resolve(watchPath); - this.hasGlob = watchPath !== path; - /** @type {object|boolean} */ - if (path === EMPTY_STR) this.hasGlob = false; - this.globSymlink = this.hasGlob && follow ? undefined : false; - this.globFilter = this.hasGlob ? anymatch(path, undefined, ANYMATCH_OPTS) : false; - this.dirParts = this.getDirParts(path); - this.dirParts.forEach((parts) => { - if (parts.length > 1) parts.pop(); - }); - this.followSymlinks = follow; - this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L; - } - - checkGlobSymlink(entry) { - // only need to resolve once - // first entry should always have entry.parentDir === EMPTY_STR - if (this.globSymlink === undefined) { - this.globSymlink = entry.fullParentDir === this.fullWatchPath ? - false : {realPath: entry.fullParentDir, linkPath: this.fullWatchPath}; - } - - if (this.globSymlink) { - return entry.fullPath.replace(this.globSymlink.realPath, this.globSymlink.linkPath); - } - - return entry.fullPath; - } - - entryPath(entry) { - return sysPath.join(this.watchPath, - sysPath.relative(this.watchPath, this.checkGlobSymlink(entry)) - ); - } - - filterPath(entry) { - const {stats} = entry; - if (stats && stats.isSymbolicLink()) return this.filterDir(entry); - const resolvedPath = this.entryPath(entry); - const matchesGlob = this.hasGlob && typeof this.globFilter === FUNCTION_TYPE ? - this.globFilter(resolvedPath) : true; - return matchesGlob && - this.fsw._isntIgnored(resolvedPath, stats) && - this.fsw._hasReadPermissions(stats); - } - - getDirParts(path) { - if (!this.hasGlob) return []; - const parts = []; - const expandedPath = path.includes(BRACE_START) ? braces.expand(path) : [path]; - expandedPath.forEach((path) => { - parts.push(sysPath.relative(this.watchPath, path).split(SLASH_OR_BACK_SLASH_RE)); - }); - return parts; - } - - filterDir(entry) { - if (this.hasGlob) { - const entryParts = this.getDirParts(this.checkGlobSymlink(entry)); - let globstar = false; - this.unmatchedGlob = !this.dirParts.some((parts) => { - return parts.every((part, i) => { - if (part === GLOBSTAR) globstar = true; - return globstar || !entryParts[0][i] || anymatch(part, entryParts[0][i], ANYMATCH_OPTS); - }); - }); - } - return !this.unmatchedGlob && this.fsw._isntIgnored(this.entryPath(entry), entry.stats); - } -} - -/** - * Watches files & directories for changes. Emitted events: - * `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error` - * - * new FSWatcher() - * .add(directories) - * .on('add', path => log('File', path, 'was added')) - */ -class FSWatcher extends EventEmitter { -// Not indenting methods for history sake; for now. -constructor(_opts) { - super(); - - const opts = {}; - if (_opts) Object.assign(opts, _opts); // for frozen objects - - /** @type {Map} */ - this._watched = new Map(); - /** @type {Map} */ - this._closers = new Map(); - /** @type {Set} */ - this._ignoredPaths = new Set(); - - /** @type {Map} */ - this._throttled = new Map(); - - /** @type {Map} */ - this._symlinkPaths = new Map(); - - this._streams = new Set(); - this.closed = false; - - // Set up default options. - if (undef(opts, 'persistent')) opts.persistent = true; - if (undef(opts, 'ignoreInitial')) opts.ignoreInitial = false; - if (undef(opts, 'ignorePermissionErrors')) opts.ignorePermissionErrors = false; - if (undef(opts, 'interval')) opts.interval = 100; - if (undef(opts, 'binaryInterval')) opts.binaryInterval = 300; - if (undef(opts, 'disableGlobbing')) opts.disableGlobbing = false; - opts.enableBinaryInterval = opts.binaryInterval !== opts.interval; - - // Enable fsevents on OS X when polling isn't explicitly enabled. - if (undef(opts, 'useFsEvents')) opts.useFsEvents = !opts.usePolling; - - // If we can't use fsevents, ensure the options reflect it's disabled. - const canUseFsEvents = FsEventsHandler.canUse(); - if (!canUseFsEvents) opts.useFsEvents = false; - - // Use polling on Mac if not using fsevents. - // Other platforms use non-polling fs_watch. - if (undef(opts, 'usePolling') && !opts.useFsEvents) { - opts.usePolling = isMacos; - } - - // Always default to polling on IBM i because fs.watch() is not available on IBM i. - if(isIBMi) { - opts.usePolling = true; - } - - // Global override (useful for end-developers that need to force polling for all - // instances of chokidar, regardless of usage/dependency depth) - const envPoll = process.env.CHOKIDAR_USEPOLLING; - if (envPoll !== undefined) { - const envLower = envPoll.toLowerCase(); - - if (envLower === 'false' || envLower === '0') { - opts.usePolling = false; - } else if (envLower === 'true' || envLower === '1') { - opts.usePolling = true; - } else { - opts.usePolling = !!envLower; - } - } - const envInterval = process.env.CHOKIDAR_INTERVAL; - if (envInterval) { - opts.interval = Number.parseInt(envInterval, 10); - } - - // Editor atomic write normalization enabled by default with fs.watch - if (undef(opts, 'atomic')) opts.atomic = !opts.usePolling && !opts.useFsEvents; - if (opts.atomic) this._pendingUnlinks = new Map(); - - if (undef(opts, 'followSymlinks')) opts.followSymlinks = true; - - if (undef(opts, 'awaitWriteFinish')) opts.awaitWriteFinish = false; - if (opts.awaitWriteFinish === true) opts.awaitWriteFinish = {}; - const awf = opts.awaitWriteFinish; - if (awf) { - if (!awf.stabilityThreshold) awf.stabilityThreshold = 2000; - if (!awf.pollInterval) awf.pollInterval = 100; - this._pendingWrites = new Map(); - } - if (opts.ignored) opts.ignored = arrify(opts.ignored); - - let readyCalls = 0; - this._emitReady = () => { - readyCalls++; - if (readyCalls >= this._readyCount) { - this._emitReady = EMPTY_FN; - this._readyEmitted = true; - // use process.nextTick to allow time for listener to be bound - process.nextTick(() => this.emit(EV_READY)); - } - }; - this._emitRaw = (...args) => this.emit(EV_RAW, ...args); - this._readyEmitted = false; - this.options = opts; - - // Initialize with proper watcher. - if (opts.useFsEvents) { - this._fsEventsHandler = new FsEventsHandler(this); - } else { - this._nodeFsHandler = new NodeFsHandler(this); - } - - // You’re frozen when your heart’s not open. - Object.freeze(opts); -} - -// Public methods - -/** - * Adds paths to be watched on an existing FSWatcher instance - * @param {Path|Array} paths_ - * @param {String=} _origAdd private; for handling non-existent paths to be watched - * @param {Boolean=} _internal private; indicates a non-user add - * @returns {FSWatcher} for chaining - */ -add(paths_, _origAdd, _internal) { - const {cwd, disableGlobbing} = this.options; - this.closed = false; - let paths = unifyPaths(paths_); - if (cwd) { - paths = paths.map((path) => { - const absPath = getAbsolutePath(path, cwd); - - // Check `path` instead of `absPath` because the cwd portion can't be a glob - if (disableGlobbing || !isGlob(path)) { - return absPath; - } - return normalizePath(absPath); - }); - } - - // set aside negated glob strings - paths = paths.filter((path) => { - if (path.startsWith(BANG)) { - this._ignoredPaths.add(path.slice(1)); - return false; - } - - // if a path is being added that was previously ignored, stop ignoring it - this._ignoredPaths.delete(path); - this._ignoredPaths.delete(path + SLASH_GLOBSTAR); - - // reset the cached userIgnored anymatch fn - // to make ignoredPaths changes effective - this._userIgnored = undefined; - - return true; - }); - - if (this.options.useFsEvents && this._fsEventsHandler) { - if (!this._readyCount) this._readyCount = paths.length; - if (this.options.persistent) this._readyCount += paths.length; - paths.forEach((path) => this._fsEventsHandler._addToFsEvents(path)); - } else { - if (!this._readyCount) this._readyCount = 0; - this._readyCount += paths.length; - Promise.all( - paths.map(async path => { - const res = await this._nodeFsHandler._addToNodeFs(path, !_internal, 0, 0, _origAdd); - if (res) this._emitReady(); - return res; - }) - ).then(results => { - if (this.closed) return; - results.filter(item => item).forEach(item => { - this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item)); - }); - }); - } - - return this; -} - -/** - * Close watchers or start ignoring events from specified paths. - * @param {Path|Array} paths_ - string or array of strings, file/directory paths and/or globs - * @returns {FSWatcher} for chaining -*/ -unwatch(paths_) { - if (this.closed) return this; - const paths = unifyPaths(paths_); - const {cwd} = this.options; - - paths.forEach((path) => { - // convert to absolute path unless relative path already matches - if (!sysPath.isAbsolute(path) && !this._closers.has(path)) { - if (cwd) path = sysPath.join(cwd, path); - path = sysPath.resolve(path); - } - - this._closePath(path); - - this._ignoredPaths.add(path); - if (this._watched.has(path)) { - this._ignoredPaths.add(path + SLASH_GLOBSTAR); - } - - // reset the cached userIgnored anymatch fn - // to make ignoredPaths changes effective - this._userIgnored = undefined; - }); - - return this; -} - -/** - * Close watchers and remove all listeners from watched paths. - * @returns {Promise}. -*/ -close() { - if (this.closed) return this._closePromise; - this.closed = true; - - // Memory management. - this.removeAllListeners(); - const closers = []; - this._closers.forEach(closerList => closerList.forEach(closer => { - const promise = closer(); - if (promise instanceof Promise) closers.push(promise); - })); - this._streams.forEach(stream => stream.destroy()); - this._userIgnored = undefined; - this._readyCount = 0; - this._readyEmitted = false; - this._watched.forEach(dirent => dirent.dispose()); - ['closers', 'watched', 'streams', 'symlinkPaths', 'throttled'].forEach(key => { - this[`_${key}`].clear(); - }); - - this._closePromise = closers.length ? Promise.all(closers).then(() => undefined) : Promise.resolve(); - return this._closePromise; -} - -/** - * Expose list of watched paths - * @returns {Object} for chaining -*/ -getWatched() { - const watchList = {}; - this._watched.forEach((entry, dir) => { - const key = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir; - watchList[key || ONE_DOT] = entry.getChildren().sort(); - }); - return watchList; -} - -emitWithAll(event, args) { - this.emit(...args); - if (event !== EV_ERROR) this.emit(EV_ALL, ...args); -} - -// Common helpers -// -------------- - -/** - * Normalize and emit events. - * Calling _emit DOES NOT MEAN emit() would be called! - * @param {EventName} event Type of event - * @param {Path} path File or directory path - * @param {*=} val1 arguments to be passed with event - * @param {*=} val2 - * @param {*=} val3 - * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag - */ -async _emit(event, path, val1, val2, val3) { - if (this.closed) return; - - const opts = this.options; - if (isWindows) path = sysPath.normalize(path); - if (opts.cwd) path = sysPath.relative(opts.cwd, path); - /** @type Array */ - const args = [event, path]; - if (val3 !== undefined) args.push(val1, val2, val3); - else if (val2 !== undefined) args.push(val1, val2); - else if (val1 !== undefined) args.push(val1); - - const awf = opts.awaitWriteFinish; - let pw; - if (awf && (pw = this._pendingWrites.get(path))) { - pw.lastChange = new Date(); - return this; - } - - if (opts.atomic) { - if (event === EV_UNLINK) { - this._pendingUnlinks.set(path, args); - setTimeout(() => { - this._pendingUnlinks.forEach((entry, path) => { - this.emit(...entry); - this.emit(EV_ALL, ...entry); - this._pendingUnlinks.delete(path); - }); - }, typeof opts.atomic === 'number' ? opts.atomic : 100); - return this; - } - if (event === EV_ADD && this._pendingUnlinks.has(path)) { - event = args[0] = EV_CHANGE; - this._pendingUnlinks.delete(path); - } - } - - if (awf && (event === EV_ADD || event === EV_CHANGE) && this._readyEmitted) { - const awfEmit = (err, stats) => { - if (err) { - event = args[0] = EV_ERROR; - args[1] = err; - this.emitWithAll(event, args); - } else if (stats) { - // if stats doesn't exist the file must have been deleted - if (args.length > 2) { - args[2] = stats; - } else { - args.push(stats); - } - this.emitWithAll(event, args); - } - }; - - this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit); - return this; - } - - if (event === EV_CHANGE) { - const isThrottled = !this._throttle(EV_CHANGE, path, 50); - if (isThrottled) return this; - } - - if (opts.alwaysStat && val1 === undefined && - (event === EV_ADD || event === EV_ADD_DIR || event === EV_CHANGE) - ) { - const fullPath = opts.cwd ? sysPath.join(opts.cwd, path) : path; - let stats; - try { - stats = await stat(fullPath); - } catch (err) {} - // Suppress event when fs_stat fails, to avoid sending undefined 'stat' - if (!stats || this.closed) return; - args.push(stats); - } - this.emitWithAll(event, args); - - return this; -} - -/** - * Common handler for errors - * @param {Error} error - * @returns {Error|Boolean} The error if defined, otherwise the value of the FSWatcher instance's `closed` flag - */ -_handleError(error) { - const code = error && error.code; - if (error && code !== 'ENOENT' && code !== 'ENOTDIR' && - (!this.options.ignorePermissionErrors || (code !== 'EPERM' && code !== 'EACCES')) - ) { - this.emit(EV_ERROR, error); - } - return error || this.closed; -} - -/** - * Helper utility for throttling - * @param {ThrottleType} actionType type being throttled - * @param {Path} path being acted upon - * @param {Number} timeout duration of time to suppress duplicate actions - * @returns {Object|false} tracking object or false if action should be suppressed - */ -_throttle(actionType, path, timeout) { - if (!this._throttled.has(actionType)) { - this._throttled.set(actionType, new Map()); - } - - /** @type {Map} */ - const action = this._throttled.get(actionType); - /** @type {Object} */ - const actionPath = action.get(path); - - if (actionPath) { - actionPath.count++; - return false; - } - - let timeoutObject; - const clear = () => { - const item = action.get(path); - const count = item ? item.count : 0; - action.delete(path); - clearTimeout(timeoutObject); - if (item) clearTimeout(item.timeoutObject); - return count; - }; - timeoutObject = setTimeout(clear, timeout); - const thr = {timeoutObject, clear, count: 0}; - action.set(path, thr); - return thr; -} - -_incrReadyCount() { - return this._readyCount++; -} - -/** - * Awaits write operation to finish. - * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback. - * @param {Path} path being acted upon - * @param {Number} threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished - * @param {EventName} event - * @param {Function} awfEmit Callback to be called when ready for event to be emitted. - */ -_awaitWriteFinish(path, threshold, event, awfEmit) { - let timeoutHandler; - - let fullPath = path; - if (this.options.cwd && !sysPath.isAbsolute(path)) { - fullPath = sysPath.join(this.options.cwd, path); - } - - const now = new Date(); - - const awaitWriteFinish = (prevStat) => { - fs.stat(fullPath, (err, curStat) => { - if (err || !this._pendingWrites.has(path)) { - if (err && err.code !== 'ENOENT') awfEmit(err); - return; - } - - const now = Number(new Date()); - - if (prevStat && curStat.size !== prevStat.size) { - this._pendingWrites.get(path).lastChange = now; - } - const pw = this._pendingWrites.get(path); - const df = now - pw.lastChange; - - if (df >= threshold) { - this._pendingWrites.delete(path); - awfEmit(undefined, curStat); - } else { - timeoutHandler = setTimeout( - awaitWriteFinish, - this.options.awaitWriteFinish.pollInterval, - curStat - ); - } - }); - }; - - if (!this._pendingWrites.has(path)) { - this._pendingWrites.set(path, { - lastChange: now, - cancelWait: () => { - this._pendingWrites.delete(path); - clearTimeout(timeoutHandler); - return event; - } - }); - timeoutHandler = setTimeout( - awaitWriteFinish, - this.options.awaitWriteFinish.pollInterval - ); - } -} - -_getGlobIgnored() { - return [...this._ignoredPaths.values()]; -} - -/** - * Determines whether user has asked to ignore this path. - * @param {Path} path filepath or dir - * @param {fs.Stats=} stats result of fs.stat - * @returns {Boolean} - */ -_isIgnored(path, stats) { - if (this.options.atomic && DOT_RE.test(path)) return true; - if (!this._userIgnored) { - const {cwd} = this.options; - const ign = this.options.ignored; - - const ignored = ign && ign.map(normalizeIgnored(cwd)); - const paths = arrify(ignored) - .filter((path) => typeof path === STRING_TYPE && !isGlob(path)) - .map((path) => path + SLASH_GLOBSTAR); - const list = this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths); - this._userIgnored = anymatch(list, undefined, ANYMATCH_OPTS); - } - - return this._userIgnored([path, stats]); -} - -_isntIgnored(path, stat) { - return !this._isIgnored(path, stat); -} - -/** - * Provides a set of common helpers and properties relating to symlink and glob handling. - * @param {Path} path file, directory, or glob pattern being watched - * @param {Number=} depth at any depth > 0, this isn't a glob - * @returns {WatchHelper} object containing helpers for this path - */ -_getWatchHelpers(path, depth) { - const watchPath = depth || this.options.disableGlobbing || !isGlob(path) ? path : globParent(path); - const follow = this.options.followSymlinks; - - return new WatchHelper(path, watchPath, follow, this); -} - -// Directory helpers -// ----------------- - -/** - * Provides directory tracking objects - * @param {String} directory path of the directory - * @returns {DirEntry} the directory's tracking object - */ -_getWatchedDir(directory) { - if (!this._boundRemove) this._boundRemove = this._remove.bind(this); - const dir = sysPath.resolve(directory); - if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove)); - return this._watched.get(dir); -} - -// File helpers -// ------------ - -/** - * Check for read permissions. - * Based on this answer on SO: https://stackoverflow.com/a/11781404/1358405 - * @param {fs.Stats} stats - object, result of fs_stat - * @returns {Boolean} indicates whether the file can be read -*/ -_hasReadPermissions(stats) { - if (this.options.ignorePermissionErrors) return true; - - // stats.mode may be bigint - const md = stats && Number.parseInt(stats.mode, 10); - const st = md & 0o777; - const it = Number.parseInt(st.toString(8)[0], 10); - return Boolean(4 & it); -} - -/** - * Handles emitting unlink events for - * files and directories, and via recursion, for - * files and directories within directories that are unlinked - * @param {String} directory within which the following item is located - * @param {String} item base path of item/directory - * @returns {void} -*/ -_remove(directory, item, isDirectory) { - // if what is being deleted is a directory, get that directory's paths - // for recursive deleting and cleaning of watched object - // if it is not a directory, nestedDirectoryChildren will be empty array - const path = sysPath.join(directory, item); - const fullPath = sysPath.resolve(path); - isDirectory = isDirectory != null - ? isDirectory - : this._watched.has(path) || this._watched.has(fullPath); - - // prevent duplicate handling in case of arriving here nearly simultaneously - // via multiple paths (such as _handleFile and _handleDir) - if (!this._throttle('remove', path, 100)) return; - - // if the only watched file is removed, watch for its return - if (!isDirectory && !this.options.useFsEvents && this._watched.size === 1) { - this.add(directory, item, true); - } - - // This will create a new entry in the watched object in either case - // so we got to do the directory check beforehand - const wp = this._getWatchedDir(path); - const nestedDirectoryChildren = wp.getChildren(); - - // Recursively remove children directories / files. - nestedDirectoryChildren.forEach(nested => this._remove(path, nested)); - - // Check if item was on the watched list and remove it - const parent = this._getWatchedDir(directory); - const wasTracked = parent.has(item); - parent.remove(item); - - // Fixes issue #1042 -> Relative paths were detected and added as symlinks - // (https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L612), - // but never removed from the map in case the path was deleted. - // This leads to an incorrect state if the path was recreated: - // https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L553 - if (this._symlinkPaths.has(fullPath)) { - this._symlinkPaths.delete(fullPath); - } - - // If we wait for this file to be fully written, cancel the wait. - let relPath = path; - if (this.options.cwd) relPath = sysPath.relative(this.options.cwd, path); - if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) { - const event = this._pendingWrites.get(relPath).cancelWait(); - if (event === EV_ADD) return; - } - - // The Entry will either be a directory that just got removed - // or a bogus entry to a file, in either case we have to remove it - this._watched.delete(path); - this._watched.delete(fullPath); - const eventName = isDirectory ? EV_UNLINK_DIR : EV_UNLINK; - if (wasTracked && !this._isIgnored(path)) this._emit(eventName, path); - - // Avoid conflicts if we later create another file with the same name - if (!this.options.useFsEvents) { - this._closePath(path); - } -} - -/** - * Closes all watchers for a path - * @param {Path} path - */ -_closePath(path) { - this._closeFile(path) - const dir = sysPath.dirname(path); - this._getWatchedDir(dir).remove(sysPath.basename(path)); -} - -/** - * Closes only file-specific watchers - * @param {Path} path - */ -_closeFile(path) { - const closers = this._closers.get(path); - if (!closers) return; - closers.forEach(closer => closer()); - this._closers.delete(path); -} - -/** - * - * @param {Path} path - * @param {Function} closer - */ -_addPathCloser(path, closer) { - if (!closer) return; - let list = this._closers.get(path); - if (!list) { - list = []; - this._closers.set(path, list); - } - list.push(closer); -} - -_readdirp(root, opts) { - if (this.closed) return; - const options = {type: EV_ALL, alwaysStat: true, lstat: true, ...opts}; - let stream = readdirp(root, options); - this._streams.add(stream); - stream.once(STR_CLOSE, () => { - stream = undefined; - }); - stream.once(STR_END, () => { - if (stream) { - this._streams.delete(stream); - stream = undefined; - } - }); - return stream; -} - -} - -// Export FSWatcher class -exports.FSWatcher = FSWatcher; - -/** - * Instantiates watcher with paths to be tracked. - * @param {String|Array} paths file/directory paths and/or globs - * @param {Object=} options chokidar opts - * @returns an instance of FSWatcher for chaining. - */ -const watch = (paths, options) => { - const watcher = new FSWatcher(options); - watcher.add(paths); - return watcher; -}; - -exports.watch = watch; diff --git a/server/node_modules/chokidar/package.json b/server/node_modules/chokidar/package.json deleted file mode 100644 index e8f8b3d9..00000000 --- a/server/node_modules/chokidar/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "chokidar", - "description": "Minimal and efficient cross-platform file watching library", - "version": "3.6.0", - "homepage": "https://github.com/paulmillr/chokidar", - "author": "Paul Miller (https://paulmillr.com)", - "contributors": [ - "Paul Miller (https://paulmillr.com)", - "Elan Shanker" - ], - "engines": { - "node": ">= 8.10.0" - }, - "main": "index.js", - "types": "./types/index.d.ts", - "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" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - }, - "devDependencies": { - "@types/node": "^14", - "chai": "^4.3", - "dtslint": "^3.3.0", - "eslint": "^7.0.0", - "mocha": "^7.0.0", - "rimraf": "^3.0.0", - "sinon": "^9.0.1", - "sinon-chai": "^3.3.0", - "typescript": "^4.4.3", - "upath": "^1.2.0" - }, - "files": [ - "index.js", - "lib/*.js", - "types/index.d.ts" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/paulmillr/chokidar.git" - }, - "bugs": { - "url": "https://github.com/paulmillr/chokidar/issues" - }, - "license": "MIT", - "scripts": { - "dtslint": "dtslint types", - "lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .", - "build": "npm ls", - "mocha": "mocha --exit --timeout 90000", - "test": "npm run lint && npm run mocha" - }, - "keywords": [ - "fs", - "watch", - "watchFile", - "watcher", - "watching", - "file", - "fsevents" - ], - "funding": "https://paulmillr.com/funding/" -} diff --git a/server/node_modules/chokidar/types/index.d.ts b/server/node_modules/chokidar/types/index.d.ts deleted file mode 100644 index 45580663..00000000 --- a/server/node_modules/chokidar/types/index.d.ts +++ /dev/null @@ -1,192 +0,0 @@ -// TypeScript Version: 3.0 - -/// - -import * as fs from "fs"; -import { EventEmitter } from "events"; -import { Matcher } from 'anymatch'; - -export class FSWatcher extends EventEmitter implements fs.FSWatcher { - options: WatchOptions; - - /** - * Constructs a new FSWatcher instance with optional WatchOptions parameter. - */ - constructor(options?: WatchOptions); - - /** - * Add files, directories, or glob patterns for tracking. Takes an array of strings or just one - * string. - */ - add(paths: string | ReadonlyArray): this; - - /** - * Stop watching files, directories, or glob patterns. Takes an array of strings or just one - * string. - */ - unwatch(paths: string | ReadonlyArray): this; - - /** - * Returns an object representing all the paths on the file system being watched by this - * `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless - * the `cwd` option was used), and the values are arrays of the names of the items contained in - * each directory. - */ - getWatched(): { - [directory: string]: string[]; - }; - - /** - * Removes all listeners from watched files. - */ - close(): Promise; - - on(event: 'add'|'addDir'|'change', listener: (path: string, stats?: fs.Stats) => void): this; - - on(event: 'all', listener: (eventName: 'add'|'addDir'|'change'|'unlink'|'unlinkDir', path: string, stats?: fs.Stats) => void): this; - - /** - * Error occurred - */ - on(event: 'error', listener: (error: Error) => void): this; - - /** - * Exposes the native Node `fs.FSWatcher events` - */ - on(event: 'raw', listener: (eventName: string, path: string, details: any) => void): this; - - /** - * Fires when the initial scan is complete - */ - on(event: 'ready', listener: () => void): this; - - on(event: 'unlink'|'unlinkDir', listener: (path: string) => void): this; - - on(event: string, listener: (...args: any[]) => void): this; - - ref(): this; - - unref(): this; -} - -export interface WatchOptions { - /** - * Indicates whether the process should continue to run as long as files are being watched. If - * set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`, - * even if the process continues to run. - */ - persistent?: boolean; - - /** - * ([anymatch](https://github.com/micromatch/anymatch)-compatible definition) Defines files/paths to - * be ignored. The whole relative or absolute path is tested, not just filename. If a function - * with two arguments is provided, it gets called twice per path - once with a single argument - * (the path), second time with two arguments (the path and the - * [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path). - */ - ignored?: Matcher; - - /** - * If set to `false` then `add`/`addDir` events are also emitted for matching paths while - * instantiating the watching as chokidar discovers these file paths (before the `ready` event). - */ - ignoreInitial?: boolean; - - /** - * When `false`, only the symlinks themselves will be watched for changes instead of following - * the link references and bubbling events through the link's path. - */ - followSymlinks?: boolean; - - /** - * The base directory from which watch `paths` are to be derived. Paths emitted with events will - * be relative to this. - */ - cwd?: string; - - /** - * If set to true then the strings passed to .watch() and .add() are treated as literal path - * names, even if they look like globs. Default: false. - */ - disableGlobbing?: boolean; - - /** - * Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU - * utilization, consider setting this to `false`. It is typically necessary to **set this to - * `true` to successfully watch files over a network**, and it may be necessary to successfully - * watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides - * the `useFsEvents` default. - */ - usePolling?: boolean; - - /** - * Whether to use the `fsevents` watching interface if available. When set to `true` explicitly - * and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on - * OS X, `usePolling: true` becomes the default. - */ - useFsEvents?: boolean; - - /** - * If relying upon the [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object that - * may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is - * provided even in cases where it wasn't already available from the underlying watch events. - */ - alwaysStat?: boolean; - - /** - * If set, limits how many levels of subdirectories will be traversed. - */ - depth?: number; - - /** - * Interval of file system polling. - */ - interval?: number; - - /** - * Interval of file system polling for binary files. ([see list of binary extensions](https://gi - * thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json)) - */ - binaryInterval?: number; - - /** - * Indicates whether to watch files that don't have read permissions if possible. If watching - * fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed - * silently. - */ - ignorePermissionErrors?: boolean; - - /** - * `true` if `useFsEvents` and `usePolling` are `false`). Automatically filters out artifacts - * that occur when using editors that use "atomic writes" instead of writing directly to the - * source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change` - * event rather than `unlink` then `add`. If the default of 100 ms does not work well for you, - * you can override it by setting `atomic` to a custom value, in milliseconds. - */ - atomic?: boolean | number; - - /** - * can be set to an object in order to adjust timing params: - */ - awaitWriteFinish?: AwaitWriteFinishOptions | boolean; -} - -export interface AwaitWriteFinishOptions { - /** - * Amount of time in milliseconds for a file size to remain constant before emitting its event. - */ - stabilityThreshold?: number; - - /** - * File size polling interval. - */ - pollInterval?: number; -} - -/** - * produces an instance of `FSWatcher`. - */ -export function watch( - paths: string | ReadonlyArray, - options?: WatchOptions -): FSWatcher; diff --git a/server/node_modules/concat-map/.travis.yml b/server/node_modules/concat-map/.travis.yml deleted file mode 100644 index f1d0f13c..00000000 --- a/server/node_modules/concat-map/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 diff --git a/server/node_modules/concat-map/LICENSE b/server/node_modules/concat-map/LICENSE deleted file mode 100644 index ee27ba4b..00000000 --- a/server/node_modules/concat-map/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -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/concat-map/README.markdown b/server/node_modules/concat-map/README.markdown deleted file mode 100644 index 408f70a1..00000000 --- a/server/node_modules/concat-map/README.markdown +++ /dev/null @@ -1,62 +0,0 @@ -concat-map -========== - -Concatenative mapdashery. - -[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) - -[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) - -example -======= - -``` js -var concatMap = require('concat-map'); -var xs = [ 1, 2, 3, 4, 5, 6 ]; -var ys = concatMap(xs, function (x) { - return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; -}); -console.dir(ys); -``` - -*** - -``` -[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] -``` - -methods -======= - -``` js -var concatMap = require('concat-map') -``` - -concatMap(xs, fn) ------------------ - -Return an array of concatenated elements by calling `fn(x, i)` for each element -`x` and each index `i` in the array `xs`. - -When `fn(x, i)` returns an array, its result will be concatenated with the -result array. If `fn(x, i)` returns anything else, that value will be pushed -onto the end of the result array. - -install -======= - -With [npm](http://npmjs.org) do: - -``` -npm install concat-map -``` - -license -======= - -MIT - -notes -===== - -This module was written while sitting high above the ground in a tree. diff --git a/server/node_modules/concat-map/example/map.js b/server/node_modules/concat-map/example/map.js deleted file mode 100644 index 33656217..00000000 --- a/server/node_modules/concat-map/example/map.js +++ /dev/null @@ -1,6 +0,0 @@ -var concatMap = require('../'); -var xs = [ 1, 2, 3, 4, 5, 6 ]; -var ys = concatMap(xs, function (x) { - return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; -}); -console.dir(ys); diff --git a/server/node_modules/concat-map/index.js b/server/node_modules/concat-map/index.js deleted file mode 100644 index b29a7812..00000000 --- a/server/node_modules/concat-map/index.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = function (xs, fn) { - var res = []; - for (var i = 0; i < xs.length; i++) { - var x = fn(xs[i], i); - if (isArray(x)) res.push.apply(res, x); - else res.push(x); - } - return res; -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; diff --git a/server/node_modules/concat-map/package.json b/server/node_modules/concat-map/package.json deleted file mode 100644 index d3640e6b..00000000 --- a/server/node_modules/concat-map/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name" : "concat-map", - "description" : "concatenative mapdashery", - "version" : "0.0.1", - "repository" : { - "type" : "git", - "url" : "git://github.com/substack/node-concat-map.git" - }, - "main" : "index.js", - "keywords" : [ - "concat", - "concatMap", - "map", - "functional", - "higher-order" - ], - "directories" : { - "example" : "example", - "test" : "test" - }, - "scripts" : { - "test" : "tape test/*.js" - }, - "devDependencies" : { - "tape" : "~2.4.0" - }, - "license" : "MIT", - "author" : { - "name" : "James Halliday", - "email" : "mail@substack.net", - "url" : "http://substack.net" - }, - "testling" : { - "files" : "test/*.js", - "browsers" : { - "ie" : [ 6, 7, 8, 9 ], - "ff" : [ 3.5, 10, 15.0 ], - "chrome" : [ 10, 22 ], - "safari" : [ 5.1 ], - "opera" : [ 12 ] - } - } -} diff --git a/server/node_modules/concat-map/test/map.js b/server/node_modules/concat-map/test/map.js deleted file mode 100644 index fdbd7022..00000000 --- a/server/node_modules/concat-map/test/map.js +++ /dev/null @@ -1,39 +0,0 @@ -var concatMap = require('../'); -var test = require('tape'); - -test('empty or not', function (t) { - var xs = [ 1, 2, 3, 4, 5, 6 ]; - var ixes = []; - var ys = concatMap(xs, function (x, ix) { - ixes.push(ix); - return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; - }); - t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); - t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); - t.end(); -}); - -test('always something', function (t) { - var xs = [ 'a', 'b', 'c', 'd' ]; - var ys = concatMap(xs, function (x) { - return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; - }); - t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); - t.end(); -}); - -test('scalars', function (t) { - var xs = [ 'a', 'b', 'c', 'd' ]; - var ys = concatMap(xs, function (x) { - return x === 'b' ? [ 'B', 'B', 'B' ] : x; - }); - t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); - t.end(); -}); - -test('undefs', function (t) { - var xs = [ 'a', 'b', 'c', 'd' ]; - var ys = concatMap(xs, function () {}); - t.same(ys, [ undefined, undefined, undefined, undefined ]); - t.end(); -}); diff --git a/server/node_modules/content-disposition/HISTORY.md b/server/node_modules/content-disposition/HISTORY.md deleted file mode 100644 index ff0b68bb..00000000 --- a/server/node_modules/content-disposition/HISTORY.md +++ /dev/null @@ -1,66 +0,0 @@ -1.0.0 / 2024-08-31 -================== - - * drop node <18 - * allow utf8 as alias for utf-8 - -0.5.4 / 2021-12-10 -================== - - * deps: safe-buffer@5.2.1 - -0.5.3 / 2018-12-17 -================== - - * Use `safe-buffer` for improved Buffer API - -0.5.2 / 2016-12-08 -================== - - * Fix `parse` to accept any linear whitespace character - -0.5.1 / 2016-01-17 -================== - - * perf: enable strict mode - -0.5.0 / 2014-10-11 -================== - - * Add `parse` function - -0.4.0 / 2014-09-21 -================== - - * Expand non-Unicode `filename` to the full ISO-8859-1 charset - -0.3.0 / 2014-09-20 -================== - - * Add `fallback` option - * Add `type` option - -0.2.0 / 2014-09-19 -================== - - * Reduce ambiguity of file names with hex escape in buggy browsers - -0.1.2 / 2014-09-19 -================== - - * Fix periodic invalid Unicode filename header - -0.1.1 / 2014-09-19 -================== - - * Fix invalid characters appearing in `filename*` parameter - -0.1.0 / 2014-09-18 -================== - - * Make the `filename` argument optional - -0.0.0 / 2014-09-18 -================== - - * Initial release diff --git a/server/node_modules/content-disposition/LICENSE b/server/node_modules/content-disposition/LICENSE deleted file mode 100644 index 84441fbb..00000000 --- a/server/node_modules/content-disposition/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2014-2017 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/content-disposition/README.md b/server/node_modules/content-disposition/README.md deleted file mode 100644 index 3a0bb055..00000000 --- a/server/node_modules/content-disposition/README.md +++ /dev/null @@ -1,142 +0,0 @@ -# content-disposition - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][github-actions-ci-image]][github-actions-ci-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Create and parse HTTP `Content-Disposition` header - -## Installation - -```sh -$ npm install content-disposition -``` - -## API - -```js -var contentDisposition = require('content-disposition') -``` - -### contentDisposition(filename, options) - -Create an attachment `Content-Disposition` header value using the given file name, -if supplied. The `filename` is optional and if no file name is desired, but you -want to specify `options`, set `filename` to `undefined`. - -```js -res.setHeader('Content-Disposition', contentDisposition('∫ maths.pdf')) -``` - -**note** HTTP headers are of the ISO-8859-1 character set. If you are writing this -header through a means different from `setHeader` in Node.js, you'll want to specify -the `'binary'` encoding in Node.js. - -#### Options - -`contentDisposition` accepts these properties in the options object. - -##### fallback - -If the `filename` option is outside ISO-8859-1, then the file name is actually -stored in a supplemental field for clients that support Unicode file names and -a ISO-8859-1 version of the file name is automatically generated. - -This specifies the ISO-8859-1 file name to override the automatic generation or -disables the generation all together, defaults to `true`. - - - A string will specify the ISO-8859-1 file name to use in place of automatic - generation. - - `false` will disable including a ISO-8859-1 file name and only include the - Unicode version (unless the file name is already ISO-8859-1). - - `true` will enable automatic generation if the file name is outside ISO-8859-1. - -If the `filename` option is ISO-8859-1 and this option is specified and has a -different value, then the `filename` option is encoded in the extended field -and this set as the fallback field, even though they are both ISO-8859-1. - -##### type - -Specifies the disposition type, defaults to `"attachment"`. This can also be -`"inline"`, or any other value (all values except inline are treated like -`attachment`, but can convey additional information if both parties agree to -it). The type is normalized to lower-case. - -### contentDisposition.parse(string) - -```js -var disposition = contentDisposition.parse('attachment; filename="EURO rates.txt"; filename*=UTF-8\'\'%e2%82%ac%20rates.txt') -``` - -Parse a `Content-Disposition` header string. This automatically handles extended -("Unicode") parameters by decoding them and providing them under the standard -parameter name. This will return an object with the following properties (examples -are shown for the string `'attachment; filename="EURO rates.txt"; filename*=UTF-8\'\'%e2%82%ac%20rates.txt'`): - - - `type`: The disposition type (always lower case). Example: `'attachment'` - - - `parameters`: An object of the parameters in the disposition (name of parameter - always lower case and extended versions replace non-extended versions). Example: - `{filename: "€ rates.txt"}` - -## Examples - -### Send a file for download - -```js -var contentDisposition = require('content-disposition') -var destroy = require('destroy') -var fs = require('fs') -var http = require('http') -var onFinished = require('on-finished') - -var filePath = '/path/to/public/plans.pdf' - -http.createServer(function onRequest (req, res) { - // set headers - res.setHeader('Content-Type', 'application/pdf') - res.setHeader('Content-Disposition', contentDisposition(filePath)) - - // send file - var stream = fs.createReadStream(filePath) - stream.pipe(res) - onFinished(res, function () { - destroy(stream) - }) -}) -``` - -## Testing - -```sh -$ npm test -``` - -## References - -- [RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1][rfc-2616] -- [RFC 5987: Character Set and Language Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters][rfc-5987] -- [RFC 6266: Use of the Content-Disposition Header Field in the Hypertext Transfer Protocol (HTTP)][rfc-6266] -- [Test Cases for HTTP Content-Disposition header field (RFC 6266) and the Encodings defined in RFCs 2047, 2231 and 5987][tc-2231] - -[rfc-2616]: https://tools.ietf.org/html/rfc2616 -[rfc-5987]: https://tools.ietf.org/html/rfc5987 -[rfc-6266]: https://tools.ietf.org/html/rfc6266 -[tc-2231]: http://greenbytes.de/tech/tc2231/ - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/content-disposition.svg -[npm-url]: https://npmjs.org/package/content-disposition -[node-version-image]: https://img.shields.io/node/v/content-disposition.svg -[node-version-url]: https://nodejs.org/en/download -[coveralls-image]: https://img.shields.io/coveralls/jshttp/content-disposition.svg -[coveralls-url]: https://coveralls.io/r/jshttp/content-disposition?branch=master -[downloads-image]: https://img.shields.io/npm/dm/content-disposition.svg -[downloads-url]: https://npmjs.org/package/content-disposition -[github-actions-ci-image]: https://img.shields.io/github/workflow/status/jshttp/content-disposition/ci/master?label=ci -[github-actions-ci-url]: https://github.com/jshttp/content-disposition?query=workflow%3Aci diff --git a/server/node_modules/content-disposition/index.js b/server/node_modules/content-disposition/index.js deleted file mode 100644 index 44f1d51f..00000000 --- a/server/node_modules/content-disposition/index.js +++ /dev/null @@ -1,459 +0,0 @@ -/*! - * content-disposition - * Copyright(c) 2014-2017 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module exports. - * @public - */ - -module.exports = contentDisposition -module.exports.parse = parse - -/** - * Module dependencies. - * @private - */ - -var basename = require('path').basename -var Buffer = require('safe-buffer').Buffer - -/** - * RegExp to match non attr-char, *after* encodeURIComponent (i.e. not including "%") - * @private - */ - -var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g // eslint-disable-line no-control-regex - -/** - * RegExp to match percent encoding escape. - * @private - */ - -var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/ -var HEX_ESCAPE_REPLACE_REGEXP = /%([0-9A-Fa-f]{2})/g - -/** - * RegExp to match non-latin1 characters. - * @private - */ - -var NON_LATIN1_REGEXP = /[^\x20-\x7e\xa0-\xff]/g - -/** - * RegExp to match quoted-pair in RFC 2616 - * - * quoted-pair = "\" CHAR - * CHAR = - * @private - */ - -var QESC_REGEXP = /\\([\u0000-\u007f])/g // eslint-disable-line no-control-regex - -/** - * RegExp to match chars that must be quoted-pair in RFC 2616 - * @private - */ - -var QUOTE_REGEXP = /([\\"])/g - -/** - * RegExp for various RFC 2616 grammar - * - * parameter = token "=" ( token | quoted-string ) - * token = 1* - * separators = "(" | ")" | "<" | ">" | "@" - * | "," | ";" | ":" | "\" | <"> - * | "/" | "[" | "]" | "?" | "=" - * | "{" | "}" | SP | HT - * quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) - * qdtext = > - * quoted-pair = "\" CHAR - * CHAR = - * TEXT = - * LWS = [CRLF] 1*( SP | HT ) - * CRLF = CR LF - * CR = - * LF = - * SP = - * HT = - * CTL = - * OCTET = - * @private - */ - -var PARAM_REGEXP = /;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g // eslint-disable-line no-control-regex -var TEXT_REGEXP = /^[\x20-\x7e\x80-\xff]+$/ -var TOKEN_REGEXP = /^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/ - -/** - * RegExp for various RFC 5987 grammar - * - * ext-value = charset "'" [ language ] "'" value-chars - * charset = "UTF-8" / "ISO-8859-1" / mime-charset - * mime-charset = 1*mime-charsetc - * mime-charsetc = ALPHA / DIGIT - * / "!" / "#" / "$" / "%" / "&" - * / "+" / "-" / "^" / "_" / "`" - * / "{" / "}" / "~" - * language = ( 2*3ALPHA [ extlang ] ) - * / 4ALPHA - * / 5*8ALPHA - * extlang = *3( "-" 3ALPHA ) - * value-chars = *( pct-encoded / attr-char ) - * pct-encoded = "%" HEXDIG HEXDIG - * attr-char = ALPHA / DIGIT - * / "!" / "#" / "$" / "&" / "+" / "-" / "." - * / "^" / "_" / "`" / "|" / "~" - * @private - */ - -var EXT_VALUE_REGEXP = /^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/ - -/** - * RegExp for various RFC 6266 grammar - * - * disposition-type = "inline" | "attachment" | disp-ext-type - * disp-ext-type = token - * disposition-parm = filename-parm | disp-ext-parm - * filename-parm = "filename" "=" value - * | "filename*" "=" ext-value - * disp-ext-parm = token "=" value - * | ext-token "=" ext-value - * ext-token = - * @private - */ - -var DISPOSITION_TYPE_REGEXP = /^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/ // eslint-disable-line no-control-regex - -/** - * Create an attachment Content-Disposition header. - * - * @param {string} [filename] - * @param {object} [options] - * @param {string} [options.type=attachment] - * @param {string|boolean} [options.fallback=true] - * @return {string} - * @public - */ - -function contentDisposition (filename, options) { - var opts = options || {} - - // get type - var type = opts.type || 'attachment' - - // get parameters - var params = createparams(filename, opts.fallback) - - // format into string - return format(new ContentDisposition(type, params)) -} - -/** - * Create parameters object from filename and fallback. - * - * @param {string} [filename] - * @param {string|boolean} [fallback=true] - * @return {object} - * @private - */ - -function createparams (filename, fallback) { - if (filename === undefined) { - return - } - - var params = {} - - if (typeof filename !== 'string') { - throw new TypeError('filename must be a string') - } - - // fallback defaults to true - if (fallback === undefined) { - fallback = true - } - - if (typeof fallback !== 'string' && typeof fallback !== 'boolean') { - throw new TypeError('fallback must be a string or boolean') - } - - if (typeof fallback === 'string' && NON_LATIN1_REGEXP.test(fallback)) { - throw new TypeError('fallback must be ISO-8859-1 string') - } - - // restrict to file base name - var name = basename(filename) - - // determine if name is suitable for quoted string - var isQuotedString = TEXT_REGEXP.test(name) - - // generate fallback name - var fallbackName = typeof fallback !== 'string' - ? fallback && getlatin1(name) - : basename(fallback) - var hasFallback = typeof fallbackName === 'string' && fallbackName !== name - - // set extended filename parameter - if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name)) { - params['filename*'] = name - } - - // set filename parameter - if (isQuotedString || hasFallback) { - params.filename = hasFallback - ? fallbackName - : name - } - - return params -} - -/** - * Format object to Content-Disposition header. - * - * @param {object} obj - * @param {string} obj.type - * @param {object} [obj.parameters] - * @return {string} - * @private - */ - -function format (obj) { - var parameters = obj.parameters - var type = obj.type - - if (!type || typeof type !== 'string' || !TOKEN_REGEXP.test(type)) { - throw new TypeError('invalid type') - } - - // start with normalized type - var string = String(type).toLowerCase() - - // append parameters - if (parameters && typeof parameters === 'object') { - var param - var params = Object.keys(parameters).sort() - - for (var i = 0; i < params.length; i++) { - param = params[i] - - var val = param.slice(-1) === '*' - ? ustring(parameters[param]) - : qstring(parameters[param]) - - string += '; ' + param + '=' + val - } - } - - return string -} - -/** - * Decode a RFC 5987 field value (gracefully). - * - * @param {string} str - * @return {string} - * @private - */ - -function decodefield (str) { - var match = EXT_VALUE_REGEXP.exec(str) - - if (!match) { - throw new TypeError('invalid extended field value') - } - - var charset = match[1].toLowerCase() - var encoded = match[2] - var value - - // to binary string - var binary = encoded.replace(HEX_ESCAPE_REPLACE_REGEXP, pdecode) - - switch (charset) { - case 'iso-8859-1': - value = getlatin1(binary) - break - case 'utf-8': - case 'utf8': - value = Buffer.from(binary, 'binary').toString('utf8') - break - default: - throw new TypeError('unsupported charset in extended field') - } - - return value -} - -/** - * Get ISO-8859-1 version of string. - * - * @param {string} val - * @return {string} - * @private - */ - -function getlatin1 (val) { - // simple Unicode -> ISO-8859-1 transformation - return String(val).replace(NON_LATIN1_REGEXP, '?') -} - -/** - * Parse Content-Disposition header string. - * - * @param {string} string - * @return {object} - * @public - */ - -function parse (string) { - if (!string || typeof string !== 'string') { - throw new TypeError('argument string is required') - } - - var match = DISPOSITION_TYPE_REGEXP.exec(string) - - if (!match) { - throw new TypeError('invalid type format') - } - - // normalize type - var index = match[0].length - var type = match[1].toLowerCase() - - var key - var names = [] - var params = {} - var value - - // calculate index to start at - index = PARAM_REGEXP.lastIndex = match[0].slice(-1) === ';' - ? index - 1 - : index - - // match parameters - while ((match = PARAM_REGEXP.exec(string))) { - if (match.index !== index) { - throw new TypeError('invalid parameter format') - } - - index += match[0].length - key = match[1].toLowerCase() - value = match[2] - - if (names.indexOf(key) !== -1) { - throw new TypeError('invalid duplicate parameter') - } - - names.push(key) - - if (key.indexOf('*') + 1 === key.length) { - // decode extended value - key = key.slice(0, -1) - value = decodefield(value) - - // overwrite existing value - params[key] = value - continue - } - - if (typeof params[key] === 'string') { - continue - } - - if (value[0] === '"') { - // remove quotes and escapes - value = value - .slice(1, -1) - .replace(QESC_REGEXP, '$1') - } - - params[key] = value - } - - if (index !== -1 && index !== string.length) { - throw new TypeError('invalid parameter format') - } - - return new ContentDisposition(type, params) -} - -/** - * Percent decode a single character. - * - * @param {string} str - * @param {string} hex - * @return {string} - * @private - */ - -function pdecode (str, hex) { - return String.fromCharCode(parseInt(hex, 16)) -} - -/** - * Percent encode a single character. - * - * @param {string} char - * @return {string} - * @private - */ - -function pencode (char) { - return '%' + String(char) - .charCodeAt(0) - .toString(16) - .toUpperCase() -} - -/** - * Quote a string for HTTP. - * - * @param {string} val - * @return {string} - * @private - */ - -function qstring (val) { - var str = String(val) - - return '"' + str.replace(QUOTE_REGEXP, '\\$1') + '"' -} - -/** - * Encode a Unicode string for HTTP (RFC 5987). - * - * @param {string} val - * @return {string} - * @private - */ - -function ustring (val) { - var str = String(val) - - // percent encode as UTF-8 - var encoded = encodeURIComponent(str) - .replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode) - - return 'UTF-8\'\'' + encoded -} - -/** - * Class for parsed Content-Disposition header for v8 optimization - * - * @public - * @param {string} type - * @param {object} parameters - * @constructor - */ - -function ContentDisposition (type, parameters) { - this.type = type - this.parameters = parameters -} diff --git a/server/node_modules/content-disposition/package.json b/server/node_modules/content-disposition/package.json deleted file mode 100644 index 5cea50ba..00000000 --- a/server/node_modules/content-disposition/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "content-disposition", - "description": "Create and parse Content-Disposition header", - "version": "1.0.0", - "author": "Douglas Christopher Wilson ", - "license": "MIT", - "keywords": [ - "content-disposition", - "http", - "rfc6266", - "res" - ], - "repository": "jshttp/content-disposition", - "dependencies": { - "safe-buffer": "5.2.1" - }, - "devDependencies": { - "deep-equal": "1.0.1", - "eslint": "7.32.0", - "eslint-config-standard": "13.0.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", - "mocha": "^9.2.2", - "nyc": "15.1.0" - }, - "files": [ - "LICENSE", - "HISTORY.md", - "README.md", - "index.js" - ], - "engines": { - "node": ">= 0.6" - }, - "scripts": { - "lint": "eslint .", - "test": "mocha --reporter spec --bail --check-leaks test/", - "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", - "test-cov": "nyc --reporter=html --reporter=text npm test" - } -} diff --git a/server/node_modules/content-type/HISTORY.md b/server/node_modules/content-type/HISTORY.md deleted file mode 100644 index 45836713..00000000 --- a/server/node_modules/content-type/HISTORY.md +++ /dev/null @@ -1,29 +0,0 @@ -1.0.5 / 2023-01-29 -================== - - * perf: skip value escaping when unnecessary - -1.0.4 / 2017-09-11 -================== - - * perf: skip parameter parsing when no parameters - -1.0.3 / 2017-09-10 -================== - - * perf: remove argument reassignment - -1.0.2 / 2016-05-09 -================== - - * perf: enable strict mode - -1.0.1 / 2015-02-13 -================== - - * Improve missing `Content-Type` header error message - -1.0.0 / 2015-02-01 -================== - - * Initial implementation, derived from `media-typer@0.3.0` diff --git a/server/node_modules/content-type/LICENSE b/server/node_modules/content-type/LICENSE deleted file mode 100644 index 34b1a2de..00000000 --- a/server/node_modules/content-type/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -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/content-type/README.md b/server/node_modules/content-type/README.md deleted file mode 100644 index c1a922a9..00000000 --- a/server/node_modules/content-type/README.md +++ /dev/null @@ -1,94 +0,0 @@ -# content-type - -[![NPM Version][npm-version-image]][npm-url] -[![NPM Downloads][npm-downloads-image]][npm-url] -[![Node.js Version][node-image]][node-url] -[![Build Status][ci-image]][ci-url] -[![Coverage Status][coveralls-image]][coveralls-url] - -Create and parse HTTP Content-Type header according to RFC 7231 - -## Installation - -```sh -$ npm install content-type -``` - -## API - -```js -var contentType = require('content-type') -``` - -### contentType.parse(string) - -```js -var obj = contentType.parse('image/svg+xml; charset=utf-8') -``` - -Parse a `Content-Type` header. This will return an object with the following -properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`): - - - `type`: The media type (the type and subtype, always lower case). - Example: `'image/svg+xml'` - - - `parameters`: An object of the parameters in the media type (name of parameter - always lower case). Example: `{charset: 'utf-8'}` - -Throws a `TypeError` if the string is missing or invalid. - -### contentType.parse(req) - -```js -var obj = contentType.parse(req) -``` - -Parse the `Content-Type` header from the given `req`. Short-cut for -`contentType.parse(req.headers['content-type'])`. - -Throws a `TypeError` if the `Content-Type` header is missing or invalid. - -### contentType.parse(res) - -```js -var obj = contentType.parse(res) -``` - -Parse the `Content-Type` header set on the given `res`. Short-cut for -`contentType.parse(res.getHeader('content-type'))`. - -Throws a `TypeError` if the `Content-Type` header is missing or invalid. - -### contentType.format(obj) - -```js -var str = contentType.format({ - type: 'image/svg+xml', - parameters: { charset: 'utf-8' } -}) -``` - -Format an object into a `Content-Type` header. This will return a string of the -content type for the given object with the following properties (examples are -shown that produce the string `'image/svg+xml; charset=utf-8'`): - - - `type`: The media type (will be lower-cased). Example: `'image/svg+xml'` - - - `parameters`: An object of the parameters in the media type (name of the - parameter will be lower-cased). Example: `{charset: 'utf-8'}` - -Throws a `TypeError` if the object contains an invalid type or parameter names. - -## License - -[MIT](LICENSE) - -[ci-image]: https://badgen.net/github/checks/jshttp/content-type/master?label=ci -[ci-url]: https://github.com/jshttp/content-type/actions/workflows/ci.yml -[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/content-type/master -[coveralls-url]: https://coveralls.io/r/jshttp/content-type?branch=master -[node-image]: https://badgen.net/npm/node/content-type -[node-url]: https://nodejs.org/en/download -[npm-downloads-image]: https://badgen.net/npm/dm/content-type -[npm-url]: https://npmjs.org/package/content-type -[npm-version-image]: https://badgen.net/npm/v/content-type diff --git a/server/node_modules/content-type/index.js b/server/node_modules/content-type/index.js deleted file mode 100644 index 41840e7b..00000000 --- a/server/node_modules/content-type/index.js +++ /dev/null @@ -1,225 +0,0 @@ -/*! - * content-type - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1 - * - * parameter = token "=" ( token / quoted-string ) - * token = 1*tchar - * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" - * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" - * / DIGIT / ALPHA - * ; any VCHAR, except delimiters - * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE - * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text - * obs-text = %x80-FF - * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) - */ -var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g // eslint-disable-line no-control-regex -var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/ // eslint-disable-line no-control-regex -var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/ - -/** - * RegExp to match quoted-pair in RFC 7230 sec 3.2.6 - * - * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) - * obs-text = %x80-FF - */ -var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g // eslint-disable-line no-control-regex - -/** - * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6 - */ -var QUOTE_REGEXP = /([\\"])/g - -/** - * RegExp to match type in RFC 7231 sec 3.1.1.1 - * - * media-type = type "/" subtype - * type = token - * subtype = token - */ -var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/ - -/** - * Module exports. - * @public - */ - -exports.format = format -exports.parse = parse - -/** - * Format object to media type. - * - * @param {object} obj - * @return {string} - * @public - */ - -function format (obj) { - if (!obj || typeof obj !== 'object') { - throw new TypeError('argument obj is required') - } - - var parameters = obj.parameters - var type = obj.type - - if (!type || !TYPE_REGEXP.test(type)) { - throw new TypeError('invalid type') - } - - var string = type - - // append parameters - if (parameters && typeof parameters === 'object') { - var param - var params = Object.keys(parameters).sort() - - for (var i = 0; i < params.length; i++) { - param = params[i] - - if (!TOKEN_REGEXP.test(param)) { - throw new TypeError('invalid parameter name') - } - - string += '; ' + param + '=' + qstring(parameters[param]) - } - } - - return string -} - -/** - * Parse media type to object. - * - * @param {string|object} string - * @return {Object} - * @public - */ - -function parse (string) { - if (!string) { - throw new TypeError('argument string is required') - } - - // support req/res-like objects as argument - var header = typeof string === 'object' - ? getcontenttype(string) - : string - - if (typeof header !== 'string') { - throw new TypeError('argument string is required to be a string') - } - - var index = header.indexOf(';') - var type = index !== -1 - ? header.slice(0, index).trim() - : header.trim() - - if (!TYPE_REGEXP.test(type)) { - throw new TypeError('invalid media type') - } - - var obj = new ContentType(type.toLowerCase()) - - // parse parameters - if (index !== -1) { - var key - var match - var value - - PARAM_REGEXP.lastIndex = index - - while ((match = PARAM_REGEXP.exec(header))) { - if (match.index !== index) { - throw new TypeError('invalid parameter format') - } - - index += match[0].length - key = match[1].toLowerCase() - value = match[2] - - if (value.charCodeAt(0) === 0x22 /* " */) { - // remove quotes - value = value.slice(1, -1) - - // remove escapes - if (value.indexOf('\\') !== -1) { - value = value.replace(QESC_REGEXP, '$1') - } - } - - obj.parameters[key] = value - } - - if (index !== header.length) { - throw new TypeError('invalid parameter format') - } - } - - return obj -} - -/** - * Get content-type from req/res objects. - * - * @param {object} - * @return {Object} - * @private - */ - -function getcontenttype (obj) { - var header - - if (typeof obj.getHeader === 'function') { - // res-like - header = obj.getHeader('content-type') - } else if (typeof obj.headers === 'object') { - // req-like - header = obj.headers && obj.headers['content-type'] - } - - if (typeof header !== 'string') { - throw new TypeError('content-type header is missing from object') - } - - return header -} - -/** - * Quote a string if necessary. - * - * @param {string} val - * @return {string} - * @private - */ - -function qstring (val) { - var str = String(val) - - // no need to quote tokens - if (TOKEN_REGEXP.test(str)) { - return str - } - - if (str.length > 0 && !TEXT_REGEXP.test(str)) { - throw new TypeError('invalid parameter value') - } - - return '"' + str.replace(QUOTE_REGEXP, '\\$1') + '"' -} - -/** - * Class to represent a content type. - * @private - */ -function ContentType (type) { - this.parameters = Object.create(null) - this.type = type -} diff --git a/server/node_modules/content-type/package.json b/server/node_modules/content-type/package.json deleted file mode 100644 index 9db19f63..00000000 --- a/server/node_modules/content-type/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "content-type", - "description": "Create and parse HTTP Content-Type header", - "version": "1.0.5", - "author": "Douglas Christopher Wilson ", - "license": "MIT", - "keywords": [ - "content-type", - "http", - "req", - "res", - "rfc7231" - ], - "repository": "jshttp/content-type", - "devDependencies": { - "deep-equal": "1.0.1", - "eslint": "8.32.0", - "eslint-config-standard": "15.0.1", - "eslint-plugin-import": "2.27.5", - "eslint-plugin-node": "11.1.0", - "eslint-plugin-promise": "6.1.1", - "eslint-plugin-standard": "4.1.0", - "mocha": "10.2.0", - "nyc": "15.1.0" - }, - "files": [ - "LICENSE", - "HISTORY.md", - "README.md", - "index.js" - ], - "engines": { - "node": ">= 0.6" - }, - "scripts": { - "lint": "eslint .", - "test": "mocha --reporter spec --check-leaks --bail test/", - "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", - "test-cov": "nyc --reporter=html --reporter=text npm test", - "version": "node scripts/version-history.js && git add HISTORY.md" - } -} diff --git a/server/node_modules/cookie-parser/HISTORY.md b/server/node_modules/cookie-parser/HISTORY.md deleted file mode 100644 index 00ea683d..00000000 --- a/server/node_modules/cookie-parser/HISTORY.md +++ /dev/null @@ -1,124 +0,0 @@ -1.4.7 / 2024-10-08 -========== - - * deps: cookie@0.7.2 - - Fix object assignment of `hasOwnProperty` - * deps: cookie@0.7.1 - - Allow leading dot for domain - - Although not permitted in the spec, some users expect this to work and user agents ignore the leading dot according to spec - - Add fast path for `serialize` without options, use `obj.hasOwnProperty` when parsing - * deps: cookie@0.7.0 - - perf: parse cookies ~10% faster - - fix: narrow the validation of cookies to match RFC6265 - - fix: add `main` to `package.json` for rspack - * deps: cookie@0.6.0 - - Add `partitioned` option - * deps: cookie@0.5.0 - - Add `priority` option - - Fix `expires` option to reject invalid dates - - pref: improve default decode speed - - pref: remove slow string split in parse - * deps: cookie@0.4.2 - - pref: read value only when assigning in parse - - pref: remove unnecessary regexp in parse - -1.4.6 / 2021-11-16 -================== - - * deps: cookie@0.4.1 - -1.4.5 / 2020-03-14 -================== - - * deps: cookie@0.4.0 - -1.4.4 / 2019-02-12 -================== - - * perf: normalize `secret` argument only once - -1.4.3 / 2016-05-26 -================== - - * deps: cookie@0.3.1 - - perf: use for loop in parse - -1.4.2 / 2016-05-20 -================== - - * deps: cookie@0.2.4 - - perf: enable strict mode - - perf: use for loop in parse - - perf: use string concatenation for serialization - -1.4.1 / 2016-01-11 -================== - - * deps: cookie@0.2.3 - * perf: enable strict mode - -1.4.0 / 2015-09-18 -================== - - * Accept array of secrets in addition to a single secret - * Fix `JSONCookie` to return `undefined` for non-string arguments - * Fix `signedCookie` to return `undefined` for non-string arguments - * deps: cookie@0.2.2 - -1.3.5 / 2015-05-19 -================== - - * deps: cookie@0.1.3 - - Slight optimizations - -1.3.4 / 2015-02-15 -================== - - * deps: cookie-signature@1.0.6 - -1.3.3 / 2014-09-05 -================== - - * deps: cookie-signature@1.0.5 - -1.3.2 / 2014-06-26 -================== - - * deps: cookie-signature@1.0.4 - - fix for timing attacks - -1.3.1 / 2014-06-17 -================== - - * actually export `signedCookie` - -1.3.0 / 2014-06-17 -================== - - * add `signedCookie` export for single cookie unsigning - -1.2.0 / 2014-06-17 -================== - - * export parsing functions - * `req.cookies` and `req.signedCookies` are now plain objects - * slightly faster parsing of many cookies - -1.1.0 / 2014-05-12 -================== - - * Support for NodeJS version 0.8 - * deps: cookie@0.1.2 - - Fix for maxAge == 0 - - made compat with expires field - - tweak maxAge NaN error message - -1.0.1 / 2014-02-20 -================== - - * add missing dependencies - -1.0.0 / 2014-02-15 -================== - - * Genesis from `connect` diff --git a/server/node_modules/cookie-parser/LICENSE b/server/node_modules/cookie-parser/LICENSE deleted file mode 100644 index 343f2ada..00000000 --- a/server/node_modules/cookie-parser/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 TJ Holowaychuk -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/cookie-parser/README.md b/server/node_modules/cookie-parser/README.md deleted file mode 100644 index b8ecd7b2..00000000 --- a/server/node_modules/cookie-parser/README.md +++ /dev/null @@ -1,119 +0,0 @@ -# cookie-parser - -[![NPM Version][npm-version-image]][npm-url] -[![NPM Downloads][npm-downloads-image]][npm-url] -[![Build Status][ci-image]][ci-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Parse `Cookie` header and populate `req.cookies` with an object keyed by the -cookie names. Optionally you may enable signed cookie support by passing a -`secret` string, which assigns `req.secret` so it may be used by other -middleware. - -## Installation - -```sh -$ npm install cookie-parser -``` - -## API - -```js -var cookieParser = require('cookie-parser') -``` - -### cookieParser(secret, options) - -Create a new cookie parser middleware function using the given `secret` and -`options`. - -- `secret` a string or array used for signing cookies. This is optional and if - not specified, will not parse signed cookies. If a string is provided, this - is used as the secret. If an array is provided, an attempt will be made to - unsign the cookie with each secret in order. -- `options` an object that is passed to `cookie.parse` as the second option. See - [cookie](https://www.npmjs.org/package/cookie) for more information. - - `decode` a function to decode the value of the cookie - -The middleware will parse the `Cookie` header on the request and expose the -cookie data as the property `req.cookies` and, if a `secret` was provided, as -the property `req.signedCookies`. These properties are name value pairs of the -cookie name to cookie value. - -When `secret` is provided, this module will unsign and validate any signed cookie -values and move those name value pairs from `req.cookies` into `req.signedCookies`. -A signed cookie is a cookie that has a value prefixed with `s:`. Signed cookies -that fail signature validation will have the value `false` instead of the tampered -value. - -In addition, this module supports special "JSON cookies". These are cookie where -the value is prefixed with `j:`. When these values are encountered, the value will -be exposed as the result of `JSON.parse`. If parsing fails, the original value will -remain. - -### cookieParser.JSONCookie(str) - -Parse a cookie value as a JSON cookie. This will return the parsed JSON value -if it was a JSON cookie, otherwise, it will return the passed value. - -### cookieParser.JSONCookies(cookies) - -Given an object, this will iterate over the keys and call `JSONCookie` on each -value, replacing the original value with the parsed value. This returns the -same object that was passed in. - -### cookieParser.signedCookie(str, secret) - -Parse a cookie value as a signed cookie. This will return the parsed unsigned -value if it was a signed cookie and the signature was valid. If the value was -not signed, the original value is returned. If the value was signed but the -signature could not be validated, `false` is returned. - -The `secret` argument can be an array or string. If a string is provided, this -is used as the secret. If an array is provided, an attempt will be made to -unsign the cookie with each secret in order. - -### cookieParser.signedCookies(cookies, secret) - -Given an object, this will iterate over the keys and check if any value is a -signed cookie. If it is a signed cookie and the signature is valid, the key -will be deleted from the object and added to the new object that is returned. - -The `secret` argument can be an array or string. If a string is provided, this -is used as the secret. If an array is provided, an attempt will be made to -unsign the cookie with each secret in order. - -## Example - -```js -var express = require('express') -var cookieParser = require('cookie-parser') - -var app = express() -app.use(cookieParser()) - -app.get('/', function (req, res) { - // Cookies that have not been signed - console.log('Cookies: ', req.cookies) - - // Cookies that have been signed - console.log('Signed Cookies: ', req.signedCookies) -}) - -app.listen(8080) - -// curl command that sends an HTTP request with two cookies -// curl http://127.0.0.1:8080 --cookie "Cho=Kim;Greet=Hello" -``` - -## License - -[MIT](LICENSE) - -[ci-image]: https://badgen.net/github/checks/expressjs/cookie-parser/master?label=ci -[ci-url]: https://github.com/expressjs/cookie-parser/actions?query=workflow%3Aci -[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/cookie-parser/master -[coveralls-url]: https://coveralls.io/r/expressjs/cookie-parser?branch=master -[npm-downloads-image]: https://badgen.net/npm/dm/cookie-parser -[npm-url]: https://npmjs.org/package/cookie-parser -[npm-version-image]: https://badgen.net/npm/v/cookie-parser diff --git a/server/node_modules/cookie-parser/index.js b/server/node_modules/cookie-parser/index.js deleted file mode 100644 index dd6d479a..00000000 --- a/server/node_modules/cookie-parser/index.js +++ /dev/null @@ -1,182 +0,0 @@ -/*! - * cookie-parser - * Copyright(c) 2014 TJ Holowaychuk - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - * @private - */ - -var cookie = require('cookie') -var signature = require('cookie-signature') - -/** - * Module exports. - * @public - */ - -module.exports = cookieParser -module.exports.JSONCookie = JSONCookie -module.exports.JSONCookies = JSONCookies -module.exports.signedCookie = signedCookie -module.exports.signedCookies = signedCookies - -/** - * Parse Cookie header and populate `req.cookies` - * with an object keyed by the cookie names. - * - * @param {string|array} [secret] A string (or array of strings) representing cookie signing secret(s). - * @param {Object} [options] - * @return {Function} - * @public - */ - -function cookieParser (secret, options) { - var secrets = !secret || Array.isArray(secret) - ? (secret || []) - : [secret] - - return function cookieParser (req, res, next) { - if (req.cookies) { - return next() - } - - var cookies = req.headers.cookie - - req.secret = secrets[0] - req.cookies = Object.create(null) - req.signedCookies = Object.create(null) - - // no cookies - if (!cookies) { - return next() - } - - req.cookies = cookie.parse(cookies, options) - - // parse signed cookies - if (secrets.length !== 0) { - req.signedCookies = signedCookies(req.cookies, secrets) - req.signedCookies = JSONCookies(req.signedCookies) - } - - // parse JSON cookies - req.cookies = JSONCookies(req.cookies) - - next() - } -} - -/** - * Parse JSON cookie string. - * - * @param {String} str - * @return {Object} Parsed object or undefined if not json cookie - * @public - */ - -function JSONCookie (str) { - if (typeof str !== 'string' || str.substr(0, 2) !== 'j:') { - return undefined - } - - try { - return JSON.parse(str.slice(2)) - } catch (err) { - return undefined - } -} - -/** - * Parse JSON cookies. - * - * @param {Object} obj - * @return {Object} - * @public - */ - -function JSONCookies (obj) { - var cookies = Object.keys(obj) - var key - var val - - for (var i = 0; i < cookies.length; i++) { - key = cookies[i] - val = JSONCookie(obj[key]) - - if (val) { - obj[key] = val - } - } - - return obj -} - -/** - * Parse a signed cookie string, return the decoded value. - * - * @param {String} str signed cookie string - * @param {string|array} secret - * @return {String} decoded value - * @public - */ - -function signedCookie (str, secret) { - if (typeof str !== 'string') { - return undefined - } - - if (str.substr(0, 2) !== 's:') { - return str - } - - var secrets = !secret || Array.isArray(secret) - ? (secret || []) - : [secret] - - for (var i = 0; i < secrets.length; i++) { - var val = signature.unsign(str.slice(2), secrets[i]) - - if (val !== false) { - return val - } - } - - return false -} - -/** - * Parse signed cookies, returning an object containing the decoded key/value - * pairs, while removing the signed key from obj. - * - * @param {Object} obj - * @param {string|array} secret - * @return {Object} - * @public - */ - -function signedCookies (obj, secret) { - var cookies = Object.keys(obj) - var dec - var key - var ret = Object.create(null) - var val - - for (var i = 0; i < cookies.length; i++) { - key = cookies[i] - val = obj[key] - dec = signedCookie(val, secret) - - if (val !== dec) { - ret[key] = dec - delete obj[key] - } - } - - return ret -} diff --git a/server/node_modules/cookie-parser/package.json b/server/node_modules/cookie-parser/package.json deleted file mode 100644 index b1e86f08..00000000 --- a/server/node_modules/cookie-parser/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "cookie-parser", - "description": "Parse HTTP request cookies", - "version": "1.4.7", - "author": "TJ Holowaychuk (http://tjholowaychuk.com)", - "contributors": [ - "Douglas Christopher Wilson " - ], - "license": "MIT", - "repository": "expressjs/cookie-parser", - "keywords": [ - "cookie", - "middleware" - ], - "dependencies": { - "cookie": "0.7.2", - "cookie-signature": "1.0.6" - }, - "devDependencies": { - "eslint": "7.32.0", - "eslint-config-standard": "14.1.1", - "eslint-plugin-import": "2.25.2", - "eslint-plugin-markdown": "2.2.1", - "eslint-plugin-node": "11.1.0", - "eslint-plugin-promise": "4.3.1", - "eslint-plugin-standard": "4.1.0", - "mocha": "9.2.1", - "nyc": "15.1.0", - "supertest": "6.1.6" - }, - "files": [ - "LICENSE", - "HISTORY.md", - "index.js" - ], - "engines": { - "node": ">= 0.8.0" - }, - "scripts": { - "lint": "eslint .", - "test": "mocha --reporter spec --bail --check-leaks test/", - "test-ci": "nyc --reporter=lcov --reporter=text npm test", - "test-cov": "nyc --reporter=html --reporter=text npm test" - } -} diff --git a/server/node_modules/cookie-signature/.npmignore b/server/node_modules/cookie-signature/.npmignore deleted file mode 100644 index f1250e58..00000000 --- a/server/node_modules/cookie-signature/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/server/node_modules/cookie-signature/History.md b/server/node_modules/cookie-signature/History.md deleted file mode 100644 index 78513cc3..00000000 --- a/server/node_modules/cookie-signature/History.md +++ /dev/null @@ -1,38 +0,0 @@ -1.0.6 / 2015-02-03 -================== - -* use `npm test` instead of `make test` to run tests -* clearer assertion messages when checking input - - -1.0.5 / 2014-09-05 -================== - -* add license to package.json - -1.0.4 / 2014-06-25 -================== - - * corrected avoidance of timing attacks (thanks @tenbits!) - -1.0.3 / 2014-01-28 -================== - - * [incorrect] fix for timing attacks - -1.0.2 / 2014-01-28 -================== - - * fix missing repository warning - * fix typo in test - -1.0.1 / 2013-04-15 -================== - - * Revert "Changed underlying HMAC algo. to sha512." - * Revert "Fix for timing attacks on MAC verification." - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/server/node_modules/cookie-signature/Readme.md b/server/node_modules/cookie-signature/Readme.md deleted file mode 100644 index 2559e841..00000000 --- a/server/node_modules/cookie-signature/Readme.md +++ /dev/null @@ -1,42 +0,0 @@ - -# cookie-signature - - Sign and unsign cookies. - -## Example - -```js -var cookie = require('cookie-signature'); - -var val = cookie.sign('hello', 'tobiiscool'); -val.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI'); - -var val = cookie.sign('hello', 'tobiiscool'); -cookie.unsign(val, 'tobiiscool').should.equal('hello'); -cookie.unsign(val, 'luna').should.be.false; -``` - -## License - -(The MIT License) - -Copyright (c) 2012 LearnBoost <tj@learnboost.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. \ No newline at end of file diff --git a/server/node_modules/cookie-signature/index.js b/server/node_modules/cookie-signature/index.js deleted file mode 100644 index b8c9463a..00000000 --- a/server/node_modules/cookie-signature/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Module dependencies. - */ - -var crypto = require('crypto'); - -/** - * Sign the given `val` with `secret`. - * - * @param {String} val - * @param {String} secret - * @return {String} - * @api private - */ - -exports.sign = function(val, secret){ - if ('string' != typeof val) throw new TypeError("Cookie value must be provided as a string."); - if ('string' != typeof secret) throw new TypeError("Secret string must be provided."); - return val + '.' + crypto - .createHmac('sha256', secret) - .update(val) - .digest('base64') - .replace(/\=+$/, ''); -}; - -/** - * Unsign and decode the given `val` with `secret`, - * returning `false` if the signature is invalid. - * - * @param {String} val - * @param {String} secret - * @return {String|Boolean} - * @api private - */ - -exports.unsign = function(val, secret){ - if ('string' != typeof val) throw new TypeError("Signed cookie string must be provided."); - if ('string' != typeof secret) throw new TypeError("Secret string must be provided."); - var str = val.slice(0, val.lastIndexOf('.')) - , mac = exports.sign(str, secret); - - return sha1(mac) == sha1(val) ? str : false; -}; - -/** - * Private - */ - -function sha1(str){ - return crypto.createHash('sha1').update(str).digest('hex'); -} diff --git a/server/node_modules/cookie-signature/package.json b/server/node_modules/cookie-signature/package.json deleted file mode 100644 index 29c4498e..00000000 --- a/server/node_modules/cookie-signature/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "cookie-signature", - "version": "1.0.6", - "description": "Sign and unsign cookies", - "keywords": ["cookie", "sign", "unsign"], - "author": "TJ Holowaychuk ", - "license": "MIT", - "repository": { "type": "git", "url": "https://github.com/visionmedia/node-cookie-signature.git"}, - "dependencies": {}, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "scripts": { - "test": "mocha --require should --reporter spec" - }, - "main": "index" -} diff --git a/server/node_modules/cookie/LICENSE b/server/node_modules/cookie/LICENSE deleted file mode 100644 index 058b6b4e..00000000 --- a/server/node_modules/cookie/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -(The MIT License) - -Copyright (c) 2012-2014 Roman Shtylman -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/cookie/README.md b/server/node_modules/cookie/README.md deleted file mode 100644 index 71fdac11..00000000 --- a/server/node_modules/cookie/README.md +++ /dev/null @@ -1,317 +0,0 @@ -# cookie - -[![NPM Version][npm-version-image]][npm-url] -[![NPM Downloads][npm-downloads-image]][npm-url] -[![Node.js Version][node-image]][node-url] -[![Build Status][ci-image]][ci-url] -[![Coverage Status][coveralls-image]][coveralls-url] - -Basic HTTP cookie parser and serializer for HTTP servers. - -## 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 cookie -``` - -## API - -```js -var cookie = require('cookie'); -``` - -### cookie.parse(str, options) - -Parse an HTTP `Cookie` header string and returning an object of all cookie name-value pairs. -The `str` argument is the string representing a `Cookie` header value and `options` is an -optional object containing additional parsing options. - -```js -var cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2'); -// { foo: 'bar', equation: 'E=mc^2' } -``` - -#### Options - -`cookie.parse` accepts these properties in the options object. - -##### decode - -Specifies a function that will be used to decode a cookie's value. Since the value of a cookie -has a limited character set (and must be a simple string), this function can be used to decode -a previously-encoded cookie value into a JavaScript string or other object. - -The default function is the global `decodeURIComponent`, which will decode any URL-encoded -sequences into their byte representations. - -**note** if an error is thrown from this function, the original, non-decoded cookie value will -be returned as the cookie's value. - -### cookie.serialize(name, value, options) - -Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the -name for the cookie, the `value` argument is the value to set the cookie to, and the `options` -argument is an optional object containing additional serialization options. - -```js -var setCookie = cookie.serialize('foo', 'bar'); -// foo=bar -``` - -#### Options - -`cookie.serialize` accepts these properties in the options object. - -##### domain - -Specifies the value for the [`Domain` `Set-Cookie` attribute][rfc-6265-5.2.3]. By default, no -domain is set, and most clients will consider the cookie to apply to only the current domain. - -##### encode - -Specifies a function that will be used to encode a cookie's value. Since value of a cookie -has a limited character set (and must be a simple string), this function can be used to encode -a value into a string suited for a cookie's value. - -The default function is the global `encodeURIComponent`, which will encode a JavaScript string -into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range. - -##### expires - -Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute][rfc-6265-5.2.1]. -By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and -will delete it on a condition like exiting a web browser application. - -**note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and -`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, -so if both are set, they should point to the same date and time. - -##### httpOnly - -Specifies the `boolean` value for the [`HttpOnly` `Set-Cookie` attribute][rfc-6265-5.2.6]. When truthy, -the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set. - -**note** be careful when setting this to `true`, as compliant clients will not allow client-side -JavaScript to see the cookie in `document.cookie`. - -##### maxAge - -Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute][rfc-6265-5.2.2]. -The given number will be converted to an integer by rounding down. By default, no maximum age is set. - -**note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and -`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, -so if both are set, they should point to the same date and time. - -##### partitioned - -Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](rfc-cutler-httpbis-partitioned-cookies) -attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the -`Partitioned` attribute is not set. - -**note** This is an attribute that has not yet been fully standardized, and may change in the future. -This also means many clients may ignore this attribute until they understand it. - -More information about can be found in [the proposal](https://github.com/privacycg/CHIPS). - -##### path - -Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6265-5.2.4]. By default, the path -is considered the ["default path"][rfc-6265-5.1.4]. - -##### priority - -Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1]. - - - `'low'` will set the `Priority` attribute to `Low`. - - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set. - - `'high'` will set the `Priority` attribute to `High`. - -More information about the different priority levels can be found in -[the specification][rfc-west-cookie-priority-00-4.1]. - -**note** This is an attribute that has not yet been fully standardized, and may change in the future. -This also means many clients may ignore this attribute until they understand it. - -##### sameSite - -Specifies the `boolean` or `string` to be the value for the [`SameSite` `Set-Cookie` attribute][rfc-6265bis-09-5.4.7]. - - - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement. - - `false` will not set the `SameSite` attribute. - - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement. - - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie. - - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement. - -More information about the different enforcement levels can be found in -[the specification][rfc-6265bis-09-5.4.7]. - -**note** This is an attribute that has not yet been fully standardized, and may change in the future. -This also means many clients may ignore this attribute until they understand it. - -##### secure - -Specifies the `boolean` value for the [`Secure` `Set-Cookie` attribute][rfc-6265-5.2.5]. When truthy, -the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set. - -**note** be careful when setting this to `true`, as compliant clients will not send the cookie back to -the server in the future if the browser does not have an HTTPS connection. - -## Example - -The following example uses this module in conjunction with the Node.js core HTTP server -to prompt a user for their name and display it back on future visits. - -```js -var cookie = require('cookie'); -var escapeHtml = require('escape-html'); -var http = require('http'); -var url = require('url'); - -function onRequest(req, res) { - // Parse the query string - var query = url.parse(req.url, true, true).query; - - if (query && query.name) { - // Set a new cookie with the name - res.setHeader('Set-Cookie', cookie.serialize('name', String(query.name), { - httpOnly: true, - maxAge: 60 * 60 * 24 * 7 // 1 week - })); - - // Redirect back after setting cookie - res.statusCode = 302; - res.setHeader('Location', req.headers.referer || '/'); - res.end(); - return; - } - - // Parse the cookies on the request - var cookies = cookie.parse(req.headers.cookie || ''); - - // Get the visitor name set in the cookie - var name = cookies.name; - - res.setHeader('Content-Type', 'text/html; charset=UTF-8'); - - if (name) { - res.write('

Welcome back, ' + escapeHtml(name) + '!

'); - } else { - res.write('

Hello, new visitor!

'); - } - - res.write('
'); - res.write(' '); - res.end('
'); -} - -http.createServer(onRequest).listen(3000); -``` - -## Testing - -```sh -$ npm test -``` - -## Benchmark - -``` -$ npm run bench - -> cookie@0.5.0 bench -> node benchmark/index.js - - node@18.18.2 - acorn@8.10.0 - ada@2.6.0 - ares@1.19.1 - brotli@1.0.9 - cldr@43.1 - icu@73.2 - llhttp@6.0.11 - modules@108 - napi@9 - nghttp2@1.57.0 - nghttp3@0.7.0 - ngtcp2@0.8.1 - openssl@3.0.10+quic - simdutf@3.2.14 - tz@2023c - undici@5.26.3 - unicode@15.0 - uv@1.44.2 - uvwasi@0.0.18 - v8@10.2.154.26-node.26 - zlib@1.2.13.1-motley - -> node benchmark/parse-top.js - - cookie.parse - top sites - - 14 tests completed. - - parse accounts.google.com x 2,588,913 ops/sec ±0.74% (186 runs sampled) - parse apple.com x 2,370,002 ops/sec ±0.69% (186 runs sampled) - parse cloudflare.com x 2,213,102 ops/sec ±0.88% (188 runs sampled) - parse docs.google.com x 2,194,157 ops/sec ±1.03% (184 runs sampled) - parse drive.google.com x 2,265,084 ops/sec ±0.79% (187 runs sampled) - parse en.wikipedia.org x 457,099 ops/sec ±0.81% (186 runs sampled) - parse linkedin.com x 504,407 ops/sec ±0.89% (186 runs sampled) - parse maps.google.com x 1,230,959 ops/sec ±0.98% (186 runs sampled) - parse microsoft.com x 926,294 ops/sec ±0.88% (184 runs sampled) - parse play.google.com x 2,311,338 ops/sec ±0.83% (185 runs sampled) - parse support.google.com x 1,508,850 ops/sec ±0.86% (186 runs sampled) - parse www.google.com x 1,022,582 ops/sec ±1.32% (182 runs sampled) - parse youtu.be x 332,136 ops/sec ±1.02% (185 runs sampled) - parse youtube.com x 323,833 ops/sec ±0.77% (183 runs sampled) - -> node benchmark/parse.js - - cookie.parse - generic - - 6 tests completed. - - simple x 3,214,032 ops/sec ±1.61% (183 runs sampled) - decode x 587,237 ops/sec ±1.16% (187 runs sampled) - unquote x 2,954,618 ops/sec ±1.35% (183 runs sampled) - duplicates x 857,008 ops/sec ±0.89% (187 runs sampled) - 10 cookies x 292,133 ops/sec ±0.89% (187 runs sampled) - 100 cookies x 22,610 ops/sec ±0.68% (187 runs sampled) -``` - -## References - -- [RFC 6265: HTTP State Management Mechanism][rfc-6265] -- [Same-site Cookies][rfc-6265bis-09-5.4.7] - -[rfc-cutler-httpbis-partitioned-cookies]: https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/ -[rfc-west-cookie-priority-00-4.1]: https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1 -[rfc-6265bis-09-5.4.7]: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7 -[rfc-6265]: https://tools.ietf.org/html/rfc6265 -[rfc-6265-5.1.4]: https://tools.ietf.org/html/rfc6265#section-5.1.4 -[rfc-6265-5.2.1]: https://tools.ietf.org/html/rfc6265#section-5.2.1 -[rfc-6265-5.2.2]: https://tools.ietf.org/html/rfc6265#section-5.2.2 -[rfc-6265-5.2.3]: https://tools.ietf.org/html/rfc6265#section-5.2.3 -[rfc-6265-5.2.4]: https://tools.ietf.org/html/rfc6265#section-5.2.4 -[rfc-6265-5.2.5]: https://tools.ietf.org/html/rfc6265#section-5.2.5 -[rfc-6265-5.2.6]: https://tools.ietf.org/html/rfc6265#section-5.2.6 -[rfc-6265-5.3]: https://tools.ietf.org/html/rfc6265#section-5.3 - -## License - -[MIT](LICENSE) - -[ci-image]: https://badgen.net/github/checks/jshttp/cookie/master?label=ci -[ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml -[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/cookie/master -[coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master -[node-image]: https://badgen.net/npm/node/cookie -[node-url]: https://nodejs.org/en/download -[npm-downloads-image]: https://badgen.net/npm/dm/cookie -[npm-url]: https://npmjs.org/package/cookie -[npm-version-image]: https://badgen.net/npm/v/cookie diff --git a/server/node_modules/cookie/SECURITY.md b/server/node_modules/cookie/SECURITY.md deleted file mode 100644 index fd4a6c53..00000000 --- a/server/node_modules/cookie/SECURITY.md +++ /dev/null @@ -1,25 +0,0 @@ -# Security Policies and Procedures - -## Reporting a Bug - -The `cookie` team and community take all security bugs seriously. Thank -you for improving the security of the project. We appreciate your efforts and -responsible disclosure and will make every effort to acknowledge your -contributions. - -Report security bugs by emailing the current owner(s) of `cookie`. This -information can be found in the npm registry using the command -`npm owner ls cookie`. -If unsure or unable to get the information from the above, open an issue -in the [project issue tracker](https://github.com/jshttp/cookie/issues) -asking for the current contact information. - -To ensure the timely response to your report, please ensure that the entirety -of the report is contained within the email body and not solely behind a web -link or an attachment. - -At least one owner will acknowledge your email within 48 hours, and will send a -more detailed response within 48 hours indicating the next steps in handling -your report. After the initial reply to your report, the owners will -endeavor to keep you informed of the progress towards a fix and full -announcement, and may ask for additional information or guidance. diff --git a/server/node_modules/cookie/index.js b/server/node_modules/cookie/index.js deleted file mode 100644 index acd5acd6..00000000 --- a/server/node_modules/cookie/index.js +++ /dev/null @@ -1,335 +0,0 @@ -/*! - * cookie - * Copyright(c) 2012-2014 Roman Shtylman - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict'; - -/** - * Module exports. - * @public - */ - -exports.parse = parse; -exports.serialize = serialize; - -/** - * Module variables. - * @private - */ - -var __toString = Object.prototype.toString -var __hasOwnProperty = Object.prototype.hasOwnProperty - -/** - * RegExp to match cookie-name in RFC 6265 sec 4.1.1 - * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2 - * which has been replaced by the token definition in RFC 7230 appendix B. - * - * cookie-name = token - * token = 1*tchar - * tchar = "!" / "#" / "$" / "%" / "&" / "'" / - * "*" / "+" / "-" / "." / "^" / "_" / - * "`" / "|" / "~" / DIGIT / ALPHA - */ - -var cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/; - -/** - * RegExp to match cookie-value in RFC 6265 sec 4.1.1 - * - * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE ) - * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E - * ; US-ASCII characters excluding CTLs, - * ; whitespace DQUOTE, comma, semicolon, - * ; and backslash - */ - -var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/; - -/** - * RegExp to match domain-value in RFC 6265 sec 4.1.1 - * - * domain-value = - * ; defined in [RFC1034], Section 3.5, as - * ; enhanced by [RFC1123], Section 2.1 - * =